Merge branch 'master' into next

Signed-off-by: David Ahern <dsahern@gmail.com>
This commit is contained in:
David Ahern 2019-08-18 11:40:30 -07:00
commit 7ad06c82e7
9 changed files with 40 additions and 14 deletions

View File

@ -6,17 +6,24 @@
* Desired design of maximum size and alignment (see RFC2553) * Desired design of maximum size and alignment (see RFC2553)
*/ */
#define _K_SS_MAXSIZE 128 /* Implementation specific max size */ #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; 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 { struct __kernel_sockaddr_storage {
__kernel_sa_family_t ss_family; /* address family */ union {
/* Following field(s) are implementation specific */ struct {
char __data[_K_SS_MAXSIZE - sizeof(unsigned short)]; __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, */ /* space to achieve desired size, */
/* _SS_MAXSIZE value minus size of ss_family */ /* _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 */ #endif /* _LINUX_SOCKET_H */

View File

@ -186,6 +186,7 @@ static void print_nh_group(FILE *fp, const struct rtattr *grps_attr)
close_json_object(); close_json_object();
} }
print_string(PRINT_FP, NULL, "%s", " ");
close_json_array(PRINT_JSON, NULL); close_json_array(PRINT_JSON, NULL);
} }

View File

@ -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) void print_nl(void)
{ {
if (!_jw) if (!_jw)

View File

@ -168,7 +168,7 @@ static int get_netmask(unsigned int *val, const char *arg, int base)
if (!get_unsigned(val, arg, base)) if (!get_unsigned(val, arg, base))
return 0; 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) { if (!get_addr_1(&addr, arg, AF_INET) && addr.family == AF_INET) {
int b = mask2bits(addr.data[0]); int b = mask2bits(addr.data[0]);

View File

@ -1,5 +1,5 @@
/* /*
* em_ipt.c IPtables extenstions matching Ematch * em_ipt.c IPtables extensions matching Ematch
* *
* (C) 2018 Eyal Birger <eyal.birger@gmail.com> * (C) 2018 Eyal Birger <eyal.birger@gmail.com>
* *

View File

@ -39,7 +39,7 @@ static void explain(void)
" [ loss state P13 [P31 [P32 [P23 P14]]]\n" \ " [ loss state P13 [P31 [P32 [P23 P14]]]\n" \
" [ loss gemodel PERCENT [R [1-H [1-K]]]\n" \ " [ loss gemodel PERCENT [R [1-H [1-K]]]\n" \
" [ ecn ]\n" \ " [ ecn ]\n" \
" [ reorder PRECENT [CORRELATION] [ gap DISTANCE ]]\n" \ " [ reorder PERCENT [CORRELATION] [ gap DISTANCE ]]\n" \
" [ rate RATE [PACKETOVERHEAD] [CELLSIZE] [CELLOVERHEAD]]\n" \ " [ rate RATE [PACKETOVERHEAD] [CELLSIZE] [CELLOVERHEAD]]\n" \
" [ slot MIN_DELAY [MAX_DELAY] [packets MAX_PACKETS]" \ " [ slot MIN_DELAY [MAX_DELAY] [packets MAX_PACKETS]" \
" [bytes MAX_BYTES]]\n" \ " [bytes MAX_BYTES]]\n" \

View File

@ -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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -74,6 +74,7 @@ static int tc_filter_modify(int cmd, unsigned int flags, int argc, char **argv)
__u32 prio = 0; __u32 prio = 0;
__u32 protocol = 0; __u32 protocol = 0;
int protocol_set = 0; int protocol_set = 0;
__u32 block_index = 0;
__u32 chain_index; __u32 chain_index;
int chain_index_set = 0; int chain_index_set = 0;
char *fhandle = NULL; char *fhandle = NULL;
@ -89,7 +90,21 @@ static int tc_filter_modify(int cmd, unsigned int flags, int argc, char **argv)
NEXT_ARG(); NEXT_ARG();
if (d[0]) if (d[0])
duparg("dev", *argv); duparg("dev", *argv);
if (block_index) {
fprintf(stderr, "Error: \"dev\" and \"block\" are mutually exclusive\n");
return -1;
}
strncpy(d, *argv, sizeof(d)-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) { } else if (strcmp(*argv, "root") == 0) {
if (req.t.tcm_parent) { if (req.t.tcm_parent) {
fprintf(stderr, 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); fprintf(stderr, "Cannot find device \"%s\"\n", d);
return 1; return 1;
} }
} else if (block_index) {
req.t.tcm_ifindex = TCM_IFINDEX_MAGIC_BLOCK;
req.t.tcm_block_index = block_index;
} }
if (q) { if (q) {
@ -396,7 +414,7 @@ static int tc_filter_get(int cmd, unsigned int flags, int argc, char **argv)
if (d[0]) if (d[0])
duparg("dev", *argv); duparg("dev", *argv);
if (block_index) { 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; return -1;
} }
strncpy(d, *argv, sizeof(d)-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) if (block_index)
duparg("block", *argv); duparg("block", *argv);
if (d[0]) { 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; return -1;
} }
if (get_u32(&block_index, *argv, 0) || !block_index) if (get_u32(&block_index, *argv, 0) || !block_index)

View File

@ -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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License