diff --git a/include/uapi/linux/socket.h b/include/uapi/linux/socket.h index 268b9482..debcf26f 100644 --- a/include/uapi/linux/socket.h +++ b/include/uapi/linux/socket.h @@ -6,17 +6,24 @@ * Desired design of maximum size and alignment (see RFC2553) */ #define _K_SS_MAXSIZE 128 /* Implementation specific max size */ -#define _K_SS_ALIGNSIZE (__alignof__ (struct sockaddr *)) - /* Implementation specific desired alignment */ typedef unsigned short __kernel_sa_family_t; +/* + * The definition uses anonymous union and struct in order to control the + * default alignment. + */ struct __kernel_sockaddr_storage { - __kernel_sa_family_t ss_family; /* address family */ - /* Following field(s) are implementation specific */ - char __data[_K_SS_MAXSIZE - sizeof(unsigned short)]; + union { + struct { + __kernel_sa_family_t ss_family; /* address family */ + /* Following field(s) are implementation specific */ + char __data[_K_SS_MAXSIZE - sizeof(unsigned short)]; /* space to achieve desired size, */ /* _SS_MAXSIZE value minus size of ss_family */ -} __attribute__ ((aligned(_K_SS_ALIGNSIZE))); /* force desired alignment */ + }; + void *__align; /* implementation specific desired alignment */ + }; +}; #endif /* _LINUX_SOCKET_H */ diff --git a/ip/ipnexthop.c b/ip/ipnexthop.c index 97f09e74..f35aab52 100644 --- a/ip/ipnexthop.c +++ b/ip/ipnexthop.c @@ -186,6 +186,7 @@ static void print_nh_group(FILE *fp, const struct rtattr *grps_attr) close_json_object(); } + print_string(PRINT_FP, NULL, "%s", " "); close_json_array(PRINT_JSON, NULL); } diff --git a/lib/json_print.c b/lib/json_print.c index 4eb2d0dc..43ea69bb 100644 --- a/lib/json_print.c +++ b/lib/json_print.c @@ -224,7 +224,7 @@ void print_color_null(enum output_type type, } } -/* Print line seperator (if not in JSON mode) */ +/* Print line separator (if not in JSON mode) */ void print_nl(void) { if (!_jw) diff --git a/lib/utils.c b/lib/utils.c index 4c43f8fd..95d46ff2 100644 --- a/lib/utils.c +++ b/lib/utils.c @@ -168,7 +168,7 @@ static int get_netmask(unsigned int *val, const char *arg, int base) if (!get_unsigned(val, arg, base)) return 0; - /* try coverting dotted quad to CIDR */ + /* try converting dotted quad to CIDR */ if (!get_addr_1(&addr, arg, AF_INET) && addr.family == AF_INET) { int b = mask2bits(addr.data[0]); diff --git a/tc/em_ipt.c b/tc/em_ipt.c index aa2edd63..b15c3ba5 100644 --- a/tc/em_ipt.c +++ b/tc/em_ipt.c @@ -1,5 +1,5 @@ /* - * em_ipt.c IPtables extenstions matching Ematch + * em_ipt.c IPtables extensions matching Ematch * * (C) 2018 Eyal Birger * diff --git a/tc/q_netem.c b/tc/q_netem.c index 6d748f68..d01450fc 100644 --- a/tc/q_netem.c +++ b/tc/q_netem.c @@ -39,7 +39,7 @@ static void explain(void) " [ loss state P13 [P31 [P32 [P23 P14]]]\n" \ " [ loss gemodel PERCENT [R [1-H [1-K]]]\n" \ " [ ecn ]\n" \ - " [ reorder PRECENT [CORRELATION] [ gap DISTANCE ]]\n" \ + " [ reorder PERCENT [CORRELATION] [ gap DISTANCE ]]\n" \ " [ rate RATE [PACKETOVERHEAD] [CELLSIZE] [CELLOVERHEAD]]\n" \ " [ slot MIN_DELAY [MAX_DELAY] [packets MAX_PACKETS]" \ " [bytes MAX_BYTES]]\n" \ diff --git a/tc/tc_cbq.c b/tc/tc_cbq.c index c811456b..f56011ad 100644 --- a/tc/tc_cbq.c +++ b/tc/tc_cbq.c @@ -1,5 +1,5 @@ /* - * tc_cbq.c CBQ maintanance routines. + * tc_cbq.c CBQ maintenance routines. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License diff --git a/tc/tc_filter.c b/tc/tc_filter.c index 53759a7a..f7d2e4a6 100644 --- a/tc/tc_filter.c +++ b/tc/tc_filter.c @@ -74,6 +74,7 @@ static int tc_filter_modify(int cmd, unsigned int flags, int argc, char **argv) __u32 prio = 0; __u32 protocol = 0; int protocol_set = 0; + __u32 block_index = 0; __u32 chain_index; int chain_index_set = 0; char *fhandle = NULL; @@ -89,7 +90,21 @@ static int tc_filter_modify(int cmd, unsigned int flags, int argc, char **argv) NEXT_ARG(); if (d[0]) duparg("dev", *argv); + if (block_index) { + fprintf(stderr, "Error: \"dev\" and \"block\" are mutually exclusive\n"); + return -1; + } strncpy(d, *argv, sizeof(d)-1); + } else if (matches(*argv, "block") == 0) { + NEXT_ARG(); + if (block_index) + duparg("block", *argv); + if (d[0]) { + fprintf(stderr, "Error: \"dev\" and \"block\" are mutually exclusive\n"); + return -1; + } + if (get_u32(&block_index, *argv, 0) || !block_index) + invarg("invalid block index value", *argv); } else if (strcmp(*argv, "root") == 0) { if (req.t.tcm_parent) { fprintf(stderr, @@ -184,6 +199,9 @@ static int tc_filter_modify(int cmd, unsigned int flags, int argc, char **argv) fprintf(stderr, "Cannot find device \"%s\"\n", d); return 1; } + } else if (block_index) { + req.t.tcm_ifindex = TCM_IFINDEX_MAGIC_BLOCK; + req.t.tcm_block_index = block_index; } if (q) { @@ -396,7 +414,7 @@ static int tc_filter_get(int cmd, unsigned int flags, int argc, char **argv) if (d[0]) duparg("dev", *argv); if (block_index) { - fprintf(stderr, "Error: \"dev\" and \"block\" are mutually exlusive\n"); + fprintf(stderr, "Error: \"dev\" and \"block\" are mutually exclusive\n"); return -1; } strncpy(d, *argv, sizeof(d)-1); @@ -405,7 +423,7 @@ static int tc_filter_get(int cmd, unsigned int flags, int argc, char **argv) if (block_index) duparg("block", *argv); if (d[0]) { - fprintf(stderr, "Error: \"dev\" and \"block\" are mutually exlusive\n"); + fprintf(stderr, "Error: \"dev\" and \"block\" are mutually exclusive\n"); return -1; } if (get_u32(&block_index, *argv, 0) || !block_index) diff --git a/tc/tc_red.c b/tc/tc_red.c index 3ce3ca42..681ca297 100644 --- a/tc/tc_red.c +++ b/tc/tc_red.c @@ -1,5 +1,5 @@ /* - * tc_red.c RED maintanance routines. + * tc_red.c RED maintenance routines. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License