diff --git a/.gitignore b/.gitignore index a559709..669af3f 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/iproute-3.10.0-74.el7.tar.xz +SOURCES/iproute-4.11.0-0.el7.tar.xz diff --git a/.iproute.metadata b/.iproute.metadata index ba7fa72..5ace8c2 100644 --- a/.iproute.metadata +++ b/.iproute.metadata @@ -1 +1 @@ -603fecb6e4911850c8316c38f7ea576856744e57 SOURCES/iproute-3.10.0-74.el7.tar.xz +44b3b021eb4bf5416469e485753d877df1c3c848 SOURCES/iproute-4.11.0-0.el7.tar.xz diff --git a/SOURCES/0001-Confirm-success-for-each-tc-batch-command.patch b/SOURCES/0001-Confirm-success-for-each-tc-batch-command.patch new file mode 100644 index 0000000..1920f9f --- /dev/null +++ b/SOURCES/0001-Confirm-success-for-each-tc-batch-command.patch @@ -0,0 +1,105 @@ +From d9a1dc236a9bcc06f04d609e2654f76c6a9459e7 Mon Sep 17 00:00:00 2001 +From: Phil Sutter +Date: Mon, 14 Dec 2015 21:02:18 +0100 +Subject: [PATCH] Confirm success for each tc -batch command +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=977844 +Upstream Status: Rejected. + +The original patch has been extended by the related man page additions +which were contained in another local patch. + +commit 8c5024483cbbfdc092945a00be05d917485b9af3 +Author: Petr Písař +Date: Thu Sep 19 11:25:49 2013 +0200 + + Confirm success for each tc -batch command + + If `tc -force -batch' is fed by a controlling program from a pipe, + it's not possible to recognize when a command has been processes + successfully. + + This patch adds an optional `-OK' option to the tc(8) tool, so `tc + -force -OK -batch' will print "OK\n" to standard output on each + successfully completed tc command. + + Signed-off-by: Petr Písař + +Signed-off-by: Phil Sutter +--- + man/man8/tc.8 | 8 +++++++- + tc/tc.c | 8 +++++++- + 2 files changed, 14 insertions(+), 2 deletions(-) + +diff --git a/man/man8/tc.8 b/man/man8/tc.8 +index f96911a..a341a8f 100644 +--- a/man/man8/tc.8 ++++ b/man/man8/tc.8 +@@ -62,7 +62,7 @@ tc \- show / manipulate traffic control settings + .P + .ti 8 + .IR OPTIONS " := {" +-\fB[ -force ] -b\fR[\fIatch\fR] \fB[ filename ] \fR| ++\fB[ -force ] [ -OK ] -b\fR[\fIatch\fR] \fB[ filename ] \fR| + \fB[ \fB-n\fR[\fIetns\fR] name \fB] \fR| + \fB[ \fB-nm \fR| \fB-nam\fR[\fIes\fR] \fB] \fR| + \fB[ \fR{ \fB-cf \fR| \fB-c\fR[\fIonf\fR] \fR} \fB[ filename ] \fB] \fR} +@@ -603,6 +603,12 @@ don't terminate tc on errors in batch mode. + If there were any errors during execution of the commands, the application return code will be non zero. + + .TP ++.BR "\-OK" ++in batch mode, print ++.B OK ++and a new line on standard output after each successfully interpreted command. ++ ++.TP + .BR "\-n" , " \-net" , " \-netns " + switches + .B tc +diff --git a/tc/tc.c b/tc/tc.c +index 8e64a82..360c9f1 100644 +--- a/tc/tc.c ++++ b/tc/tc.c +@@ -42,6 +42,7 @@ int batch_mode; + int resolve_hosts; + int use_iec; + int force; ++int ok; + bool use_names; + + static char *conf_file; +@@ -188,7 +189,7 @@ noexist: + static void usage(void) + { + fprintf(stderr, "Usage: tc [ OPTIONS ] OBJECT { COMMAND | help }\n" +- " tc [-force] -batch filename\n" ++ " tc [-force] [-OK] -batch filename\n" + "where OBJECT := { qdisc | class | filter | action | monitor | exec }\n" + " OPTIONS := { -s[tatistics] | -d[etails] | -r[aw] | -p[retty] | -b[atch] [filename] | -n[etns] name |\n" + " -nm | -nam[es] | { -cf | -conf } path }\n"); +@@ -254,6 +255,9 @@ static int batch(const char *name) + ret = 1; + if (!force) + break; ++ } else if (ok) { ++ printf("OK\n"); ++ fflush(stdout); + } + } + if (line) +@@ -293,6 +297,8 @@ int main(int argc, char **argv) + return 0; + } else if (matches(argv[1], "-force") == 0) { + ++force; ++ } else if (matches(argv[1], "-OK") == 0) { ++ ++ok; + } else if (matches(argv[1], "-batch") == 0) { + argc--; argv++; + if (argc <= 1) +-- +1.8.3.1 + diff --git a/SOURCES/0001-misc-ss-tcp-cwnd-should-be-unsigned.patch b/SOURCES/0001-misc-ss-tcp-cwnd-should-be-unsigned.patch deleted file mode 100644 index a8ad76f..0000000 --- a/SOURCES/0001-misc-ss-tcp-cwnd-should-be-unsigned.patch +++ /dev/null @@ -1,66 +0,0 @@ -From f9a228a373bc7dc77a7ddc5c601c801c8e8498aa Mon Sep 17 00:00:00 2001 -From: Davide Caratti -Date: Fri, 18 Nov 2016 11:45:54 +0100 -Subject: [PATCH] misc/ss: tcp cwnd should be unsigned - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1375215 -Upstream Status: iproute2.git commit d1f338b31858 -Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=12041044 -Tested: on local VM using iperf3 on loopback - -commit d1f338b31858005b2550da05098d56ea4e8fd401 -Author: Hangbin Liu -Date: Thu Sep 22 16:40:28 2016 +0800 - - misc/ss: tcp cwnd should be unsigned - - tcp->snd_cwd is a u32, but ss treats it like a signed int. This may - results in negative bandwidth calculations. - - Signed-off-by: Hangbin Liu - Acked-by: Phil Sutter - -Signed-off-by: Davide Caratti ---- - misc/ss.c | 7 ++++--- - 1 file changed, 4 insertions(+), 3 deletions(-) - -diff --git a/misc/ss.c b/misc/ss.c -index c385d47..45fb4b0 100644 ---- a/misc/ss.c -+++ b/misc/ss.c -@@ -759,11 +759,12 @@ struct tcpstat - int probes; - char cong_alg[16]; - double rto, ato, rtt, rttvar; -- int qack, cwnd, ssthresh, backoff; -+ int qack, ssthresh, backoff; - double send_bps; - int snd_wscale; - int rcv_wscale; - int mss; -+ unsigned int cwnd; - unsigned int lastsnd; - unsigned int lastrcv; - unsigned int lastack; -@@ -1692,7 +1693,7 @@ static void tcp_stats_print(struct tcpstat *s) - if (s->mss) - printf(" mss:%d", s->mss); - if (s->cwnd) -- printf(" cwnd:%d", s->cwnd); -+ printf(" cwnd:%u", s->cwnd); - if (s->ssthresh) - printf(" ssthresh:%d", s->ssthresh); - -@@ -1783,7 +1784,7 @@ static int tcp_show_line(char *line, const struct filter *f, int family) - return 0; - - opt[0] = 0; -- n = sscanf(data, "%x %x:%x %x:%x %x %d %d %u %d %llx %d %d %d %d %d %[^\n]\n", -+ n = sscanf(data, "%x %x:%x %x:%x %x %d %d %u %d %llx %d %d %d %u %d %[^\n]\n", - &s.ss.state, &s.ss.wq, &s.ss.rq, - &s.timer, &s.timeout, &s.retrans, &s.ss.uid, &s.probes, - &s.ss.ino, &s.ss.refcnt, &s.ss.sk, &rto, &ato, &s.qack, &s.cwnd, --- -1.8.3.1 - diff --git a/SOURCES/0002-Really-fix-get_addr-and-get_prefix-error-messages.patch b/SOURCES/0002-Really-fix-get_addr-and-get_prefix-error-messages.patch new file mode 100644 index 0000000..a54aeea --- /dev/null +++ b/SOURCES/0002-Really-fix-get_addr-and-get_prefix-error-messages.patch @@ -0,0 +1,88 @@ +From aed8229c0bec5c56deaf1ea2047ca0263732477f Mon Sep 17 00:00:00 2001 +From: Phil Sutter +Date: Fri, 11 Aug 2017 11:11:32 +0200 +Subject: [PATCH] Really fix get_addr() and get_prefix() error messages + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1477206 +Upstream Status: iproute2.git commit 34705c807a389 + +commit 34705c807a38909247d1bb29ccdffe42e5c1dab3 +Author: Phil Sutter +Date: Tue Aug 1 18:36:11 2017 +0200 + + Really fix get_addr() and get_prefix() error messages + + Both functions take the desired address family as a parameter. So using + that to notify the user what address family was expected is correct, + unlike using dst->family which will tell the user only what address + family was specified. + + The situation which commit 334af76143368 tried to fix was when 'ip' + would accept addresses from multiple families. In that case, the family + parameter is set to AF_UNSPEC so that get_addr_1() may accept any valid + address. + + This patch introduces a wrapper around family_name() which returns the + string "any valid" for AF_UNSPEC instead of the three question marks + unsuitable for use in error messages. + + Tests for AF_UNSPEC: + + | # ip a a 256.10.166.1/24 dev d0 + | Error: any valid prefix is expected rather than "256.10.166.1/24". + + | # ip neighbor add proxy 2001:db8::g dev d0 + | Error: any valid address is expected rather than "2001:db8::g". + + Tests for explicit address family: + + | # ip -6 addrlabel add prefix 1.1.1.1/24 label 123 + | Error: inet6 prefix is expected rather than "1.1.1.1/24". + + | # ip -4 addrlabel add prefix dead:beef::1/24 label 123 + | Error: inet prefix is expected rather than "dead:beef::1/24". + + Reported-by: Jaroslav Aster + Fixes: 334af76143368 ("fix get_addr() and get_prefix() error messages") + Signed-off-by: Phil Sutter +--- + lib/utils.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/lib/utils.c b/lib/utils.c +index 6d5642f..7d6ee53 100644 +--- a/lib/utils.c ++++ b/lib/utils.c +@@ -613,12 +613,19 @@ done: + return err; + } + ++static const char *family_name_verbose(int family) ++{ ++ if (family == AF_UNSPEC) ++ return "any valid"; ++ return family_name(family); ++} ++ + int get_addr(inet_prefix *dst, const char *arg, int family) + { + if (get_addr_1(dst, arg, family)) { + fprintf(stderr, + "Error: %s address is expected rather than \"%s\".\n", +- family_name(dst->family), arg); ++ family_name_verbose(family), arg); + exit(1); + } + return 0; +@@ -636,7 +643,7 @@ int get_prefix(inet_prefix *dst, char *arg, int family) + if (get_prefix_1(dst, arg, family)) { + fprintf(stderr, + "Error: %s prefix is expected rather than \"%s\".\n", +- family_name(dst->family), arg); ++ family_name_verbose(family), arg); + exit(1); + } + return 0; +-- +1.8.3.1 + diff --git a/SOURCES/0002-macsec-fix-input-of-port-improve-documentation-of-ad.patch b/SOURCES/0002-macsec-fix-input-of-port-improve-documentation-of-ad.patch deleted file mode 100644 index 93dc48b..0000000 --- a/SOURCES/0002-macsec-fix-input-of-port-improve-documentation-of-ad.patch +++ /dev/null @@ -1,129 +0,0 @@ -From 9c3efe55ac335b744aa993351f20ea9488aeaae5 Mon Sep 17 00:00:00 2001 -From: Davide Caratti -Date: Fri, 25 Nov 2016 10:43:09 +0100 -Subject: [PATCH] macsec: fix input of 'port', improve documentation of - 'address' - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1355629 -Upstream Status: iproute2.git commit 5898bd667a48 - -commit 5898bd667a483c12ba0ca53aa0ef39f9b98d2fc9 -Author: Davide Caratti -Date: Tue Aug 30 13:23:12 2016 +0200 - - macsec: fix input of 'port', improve documentation of 'address' - - remove hardcoded base 10 parsing of 'port' parameter, update man page - and fix usage() functions as well. Fix misleading line in man page that - theoretically allowed specifying 'port' keyword right after 'sci' keyword. - Provide documentation of 'address' parameter in man pages and in usage() - functions as well. - - Signed-off-by: Davide Caratti - -Signed-off-by: Davide Caratti ---- - ip/ipmacsec.c | 6 +++--- - man/man8/ip-link.8.in | 14 +++++++++++--- - man/man8/ip-macsec.8 | 12 +++++++++--- - 3 files changed, 23 insertions(+), 9 deletions(-) - -diff --git a/ip/ipmacsec.c b/ip/ipmacsec.c -index 329be00..21e53be 100644 ---- a/ip/ipmacsec.c -+++ b/ip/ipmacsec.c -@@ -110,7 +110,7 @@ static void ipmacsec_usage(void) - fprintf(stderr, "where OPTS := [ pn ] [ on | off ]\n"); - fprintf(stderr, " ID := 128-bit hex string\n"); - fprintf(stderr, " KEY := 128-bit hex string\n"); -- fprintf(stderr, " SCI := { sci | port address }\n"); -+ fprintf(stderr, " SCI := { sci | port { 1..2^16-1 } address }\n"); - - exit(-1); - } -@@ -154,7 +154,7 @@ static int get_sci(__u64 *sci, const char *arg) - - static int get_port(__be16 *port, const char *arg) - { -- return get_be16(port, arg, 10); -+ return get_be16(port, arg, 0); - } - - #define _STR(a) #a -@@ -1083,7 +1083,7 @@ static bool check_txsc_flags(bool es, bool scb, bool sci) - static void usage(FILE *f) - { - fprintf(f, -- "Usage: ... macsec [ port PORT | sci SCI ]\n" -+ "Usage: ... macsec [ [ address ] port { 1..2^16-1 } | sci ]\n" - " [ cipher { default | gcm-aes-128 } ]\n" - " [ icvlen { 8..16 } ]\n" - " [ encrypt { on | off } ]\n" -diff --git a/man/man8/ip-link.8.in b/man/man8/ip-link.8.in -index 8968cf2..fd665b8 100644 ---- a/man/man8/ip-link.8.in -+++ b/man/man8/ip-link.8.in -@@ -782,7 +782,9 @@ For a link of type - the following additional arguments are supported: - - .BI "ip link add link " DEVICE " name " NAME " type macsec" --[ -+[ [ -+.BI address " " -+] - .BI port " PORT" - | - .BI sci " SCI" -@@ -806,8 +808,14 @@ the following additional arguments are supported: - - .in +8 - .sp --.BI port " PORT " --- sets the port number for this MACsec device. -+.BI address " " -+- sets the system identifier component of secure channel for this MACsec device. -+ -+.sp -+.BI port " PORT " -+- sets the port number component of secure channel for this MACsec device, in a -+range from 1 to 65535 inclusive. Numbers with a leading " 0 " or " 0x " are -+interpreted as octal and hexadecimal, respectively. - - .sp - .BI sci " SCI " -diff --git a/man/man8/ip-macsec.8 b/man/man8/ip-macsec.8 -index 105aeec..1aca3bd 100644 ---- a/man/man8/ip-macsec.8 -+++ b/man/man8/ip-macsec.8 -@@ -3,10 +3,12 @@ - ip-macsec \- MACsec device configuration - .SH "SYNOPSIS" - .BI "ip link add link " DEVICE " name " NAME " type macsec " --[ -+[ [ -+.BI address " " -+] - .BI port " PORT" - | --.BI sci " SCI" -+.BI sci " " - ] [ - .BR cipher " { " default " | " gcm-aes-128 " } ] [" - .BI icvlen " ICVLEN" -@@ -62,8 +64,12 @@ ip-macsec \- MACsec device configuration - .IR SCI " := { " - .B sci - .IR " | " --.BI port " " address " " -+.BI port -+.IR PORT -+.BI address " " - } -+.br -+.IR PORT " := { " 1..2^16-1 " } " - - - .SH DESCRIPTION --- -1.8.3.1 - diff --git a/SOURCES/0003-macsec-fix-byte-ordering-on-input-display-of-sci.patch b/SOURCES/0003-macsec-fix-byte-ordering-on-input-display-of-sci.patch deleted file mode 100644 index ff4ab89..0000000 --- a/SOURCES/0003-macsec-fix-byte-ordering-on-input-display-of-sci.patch +++ /dev/null @@ -1,138 +0,0 @@ -From 22f1d933f66b7e87734fcefd7b70fb0db3ebce16 Mon Sep 17 00:00:00 2001 -From: Davide Caratti -Date: Fri, 25 Nov 2016 10:43:10 +0100 -Subject: [PATCH] macsec: fix byte ordering on input/display of 'sci' - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1355629 -Upstream Status: iproute2.git commit 0330f49ea06e - -Conflicts: -- ntohll() and htonll() have been added manually because of missing -upstream commit 1e5293056a02. -- get_be64() has been aded manually _ it was left behind while -backporting upstream commit 9f7401fa4967, because of the missing -implementation of htonll()/ntohll(). - -commit 0330f49ea06eed134b51a6924faf64ec6b1bb3ed -Author: Davide Caratti -Date: Tue Aug 30 13:23:14 2016 +0200 - - macsec: fix byte ordering on input/display of 'sci' - - use get_be64() in place of get_u64() when parsing input 'sci' parameter, - so that 'sci' can be entered using network byte order regardless the - endianness of target system; use ntohll() when printing out 'sci'. While - at it, improve documentation of 'sci' in ip-link.8. - - Signed-off-by: Davide Caratti - -Signed-off-by: Davide Caratti ---- - include/utils.h | 4 ++++ - ip/ipmacsec.c | 8 ++++---- - lib/utils.c | 11 +++++++++++ - man/man8/ip-link.8.in | 4 +++- - 4 files changed, 22 insertions(+), 5 deletions(-) - -diff --git a/include/utils.h b/include/utils.h -index fad82dc..2d1e390 100644 ---- a/include/utils.h -+++ b/include/utils.h -@@ -98,6 +98,7 @@ extern int get_u16(__u16 *val, const char *arg, int base); - extern int get_s16(__s16 *val, const char *arg, int base); - extern int get_u8(__u8 *val, const char *arg, int base); - extern int get_s8(__s8 *val, const char *arg, int base); -+int get_be64(__be64 *val, const char *arg, int base); - int get_be32(__be32 *val, const char *arg, int base); - int get_be16(__be16 *val, const char *arg, int base); - -@@ -159,6 +160,9 @@ int print_timestamp(FILE *fp); - - #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) - -+#define htonll(x) ((1==htonl(1)) ? (x) : ((uint64_t)htonl((x) & 0xFFFFFFFF) << 32) | htonl((x) >> 32)) -+#define ntohll(x) ((1==ntohl(1)) ? (x) : ((uint64_t)ntohl((x) & 0xFFFFFFFF) << 32) | ntohl((x) >> 32)) -+ - extern int cmdlineno; - extern ssize_t getcmdline(char **line, size_t *len, FILE *in); - extern int makeargs(char *line, char *argv[], int maxargs); -diff --git a/ip/ipmacsec.c b/ip/ipmacsec.c -index 21e53be..596594f 100644 ---- a/ip/ipmacsec.c -+++ b/ip/ipmacsec.c -@@ -149,7 +149,7 @@ static int get_an(__u8 *val, const char *arg) - - static int get_sci(__u64 *sci, const char *arg) - { -- return get_u64(sci, arg, 16); -+ return get_be64(sci, arg, 16); - } - - static int get_port(__be16 *port, const char *arg) -@@ -791,7 +791,7 @@ static void print_tx_sc(const char *prefix, __u64 sci, __u8 encoding_sa, - struct rtattr *a; - int rem; - -- printf("%sTXSC: %016llx on SA %d\n", prefix, sci, encoding_sa); -+ printf("%sTXSC: %016llx on SA %d\n", prefix, ntohll(sci), encoding_sa); - print_secy_stats(prefix, secy_stats); - print_txsc_stats(prefix, txsc_stats); - -@@ -860,7 +860,7 @@ static void print_rx_sc(const char *prefix, __u64 sci, __u8 active, - struct rtattr *a; - int rem; - -- printf("%sRXSC: %016llx, state %s\n", prefix, sci, -+ printf("%sRXSC: %016llx, state %s\n", prefix, ntohll(sci), - values_on_off[!!active]); - print_rxsc_stats(prefix, rxsc_stats); - -@@ -1032,7 +1032,7 @@ static void macsec_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - - if (tb[IFLA_MACSEC_SCI]) { - fprintf(f, "sci %016llx ", -- rta_getattr_u64(tb[IFLA_MACSEC_SCI])); -+ ntohll(rta_getattr_u64(tb[IFLA_MACSEC_SCI]))); - } - - print_flag(f, tb, "protect", IFLA_MACSEC_PROTECT); -diff --git a/lib/utils.c b/lib/utils.c -index b310166..d3ed875 100644 ---- a/lib/utils.c -+++ b/lib/utils.c -@@ -363,6 +363,17 @@ int get_s8(__s8 *val, const char *arg, int base) - return 0; - } - -+int get_be64(__be64 *val, const char *arg, int base) -+{ -+ __u64 v; -+ int ret = get_u64(&v, arg, base); -+ -+ if (!ret) -+ *val = htonll(v); -+ -+ return ret; -+} -+ - int get_be32(__be32 *val, const char *arg, int base) - { - __u32 v; -diff --git a/man/man8/ip-link.8.in b/man/man8/ip-link.8.in -index fd665b8..73cd86d 100644 ---- a/man/man8/ip-link.8.in -+++ b/man/man8/ip-link.8.in -@@ -819,7 +819,9 @@ interpreted as octal and hexadecimal, respectively. - - .sp - .BI sci " SCI " --- sets the SCI for this MACsec device. -+- sets the secure channel identifier for this MACsec device. -+.I SCI -+is a 64bit wide number in hexadecimal format. - - .sp - .BI cipher " CIPHER_SUITE " --- -1.8.3.1 - diff --git a/SOURCES/0003-tc-simple-Fix-documentation.patch b/SOURCES/0003-tc-simple-Fix-documentation.patch new file mode 100644 index 0000000..f7edb1e --- /dev/null +++ b/SOURCES/0003-tc-simple-Fix-documentation.patch @@ -0,0 +1,102 @@ +From 3d016b2ca5862b3f47da5b28aca43bd96d5c3c49 Mon Sep 17 00:00:00 2001 +From: Phil Sutter +Date: Fri, 11 Aug 2017 11:13:26 +0200 +Subject: [PATCH] tc-simple: Fix documentation + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1477523 +Upstream Status: iproute2.git commit e2a055dd23f0e + +commit e2a055dd23f0e7527a987c24687cb6b0b86f0cde +Author: Phil Sutter +Date: Thu Aug 3 17:00:51 2017 +0200 + + tc-simple: Fix documentation + + - CONTROL has to come last, otherwise 'index' applies to gact and not + simple itself. + - Man page wasn't updated to reflect syntax changes. + + Signed-off-by: Phil Sutter +--- + man/man8/tc-simple.8 | 29 ++++++++++++++++++++++++++--- + tc/m_simple.c | 4 ++-- + 2 files changed, 28 insertions(+), 5 deletions(-) + +diff --git a/man/man8/tc-simple.8 b/man/man8/tc-simple.8 +index 2206dc3..7363ab5 100644 +--- a/man/man8/tc-simple.8 ++++ b/man/man8/tc-simple.8 +@@ -6,15 +6,37 @@ simple - basic example action + .in +8 + .ti -8 + .BR tc " ... " "action simple" +-.I STRING ++[ ++.BI sdata " STRING" ++] [ ++.BI index " INDEX" ++] [ ++.I CONTROL ++] ++ ++.ti -8 ++.IR CONTROL " := {" ++.BR reclassify " | " pipe " | " drop " | " continue " | " ok " }" ++ + .SH DESCRIPTION + This is a pedagogical example rather than an actually useful action. Upon every access, it prints the given + .I STRING + which may be of arbitrary length. + .SH OPTIONS + .TP +-.I STRING ++.BI sdata " STRING" + The actual string to print. ++.TP ++.BI index " INDEX" ++Optional action index value. ++.TP ++.I CONTROL ++Indicate how ++.B tc ++should proceed after executing the action. For a description of the possible ++.I CONTROL ++values, see ++.BR tc-actions (8). + .SH EXAMPLES + The following example makes the kernel yell "Incoming ICMP!" every time it sees + an incoming ICMP on eth0. Steps are: +@@ -36,7 +58,7 @@ display stats again and observe increment by 1 + .EX + hadi@noma1:$ tc qdisc add dev eth0 ingress + hadi@noma1:$tc filter add dev eth0 parent ffff: protocol ip prio 5 \\ +- u32 match ip protocol 1 0xff flowid 1:1 action simple "Incoming ICMP" ++ u32 match ip protocol 1 0xff flowid 1:1 action simple sdata "Incoming ICMP" + + hadi@noma1:$ sudo tc -s filter ls dev eth0 parent ffff: + filter protocol ip pref 5 u32 +@@ -74,3 +96,4 @@ display stats again and observe increment by 1 + .EE + .SH SEE ALSO + .BR tc (8) ++.BR tc-actions (8) +diff --git a/tc/m_simple.c b/tc/m_simple.c +index 3a8bd91..ab63384 100644 +--- a/tc/m_simple.c ++++ b/tc/m_simple.c +@@ -81,10 +81,10 @@ + #endif + static void explain(void) + { +- fprintf(stderr, "Usage:... simple [sdata STRING] [CONTROL] [index INDEX]\n"); ++ fprintf(stderr, "Usage:... simple [sdata STRING] [index INDEX] [CONTROL]\n"); + fprintf(stderr, "\tSTRING being an arbitrary string\n" +- "\tCONTROL := reclassify|pipe|drop|continue|ok\n" + "\tINDEX := optional index value used\n"); ++ "\tCONTROL := reclassify|pipe|drop|continue|ok\n" + } + + static void usage(void) +-- +1.8.3.1 + diff --git a/SOURCES/0004-tc-fix-m_simple-usage.patch b/SOURCES/0004-tc-fix-m_simple-usage.patch new file mode 100644 index 0000000..f25c633 --- /dev/null +++ b/SOURCES/0004-tc-fix-m_simple-usage.patch @@ -0,0 +1,37 @@ +From d203110b883afafa58b735a3e94c71f255db7608 Mon Sep 17 00:00:00 2001 +From: Phil Sutter +Date: Fri, 11 Aug 2017 11:13:26 +0200 +Subject: [PATCH] tc: fix m_simple usage + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1477523 +Upstream Status: iproute2.git commit 620fc6696d4f4 + +commit 620fc6696d4f4e9ad540a45892873b0382907739 +Author: Stephen Hemminger +Date: Thu Aug 3 16:10:18 2017 -0700 + + tc: fix m_simple usage + + Signed-off-by: Stephen Hemminger +--- + tc/m_simple.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tc/m_simple.c b/tc/m_simple.c +index ab63384..65e48ad 100644 +--- a/tc/m_simple.c ++++ b/tc/m_simple.c +@@ -83,8 +83,8 @@ static void explain(void) + { + fprintf(stderr, "Usage:... simple [sdata STRING] [index INDEX] [CONTROL]\n"); + fprintf(stderr, "\tSTRING being an arbitrary string\n" +- "\tINDEX := optional index value used\n"); +- "\tCONTROL := reclassify|pipe|drop|continue|ok\n" ++ "\tINDEX := optional index value used\n" ++ "\tCONTROL := reclassify|pipe|drop|continue|ok\n"); + } + + static void usage(void) +-- +1.8.3.1 + diff --git a/SOURCES/0004-update-inet_diag.h-header.patch b/SOURCES/0004-update-inet_diag.h-header.patch deleted file mode 100644 index 6f58343..0000000 --- a/SOURCES/0004-update-inet_diag.h-header.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 219f04e854453e7386ba6e3fb81b3c40a6591c1c Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Wed, 1 Feb 2017 12:09:36 +0100 -Subject: [PATCH] update inet_diag.h header - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1063934 -Upstream Status: iproute2.git commit 8b5be9ecfff49 - -commit 8b5be9ecfff493d06189234405be210404dc38bb -Author: Stephen Hemminger -Date: Tue Apr 19 08:06:11 2016 -0700 - - update inet_diag.h header ---- - include/linux/inet_diag.h | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/include/linux/inet_diag.h b/include/linux/inet_diag.h -index 1db4116..b806fcf 100644 ---- a/include/linux/inet_diag.h -+++ b/include/linux/inet_diag.h -@@ -113,6 +113,8 @@ enum { - INET_DIAG_DCTCPINFO, - INET_DIAG_PROTOCOL, /* response attribute only */ - INET_DIAG_SKV6ONLY, -+ INET_DIAG_LOCALS, -+ INET_DIAG_PEERS, - }; - - #define INET_DIAG_MAX INET_DIAG_SKV6ONLY --- -1.8.3.1 - diff --git a/SOURCES/0005-bpf-Make-bytecode-file-reading-a-little-more-robust.patch b/SOURCES/0005-bpf-Make-bytecode-file-reading-a-little-more-robust.patch new file mode 100644 index 0000000..d135b59 --- /dev/null +++ b/SOURCES/0005-bpf-Make-bytecode-file-reading-a-little-more-robust.patch @@ -0,0 +1,96 @@ +From 91cda136ef27402256dbf85434374b43ab52d932 Mon Sep 17 00:00:00 2001 +From: Phil Sutter +Date: Fri, 11 Aug 2017 11:15:30 +0200 +Subject: [PATCH] bpf: Make bytecode-file reading a little more robust + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1477491 +Upstream Status: iproute2.git commit 3da3ebfca85b8 + +commit 3da3ebfca85b8f1e8252b898453d8cb383c5c398 +Author: Phil Sutter +Date: Wed Aug 2 14:57:56 2017 +0200 + + bpf: Make bytecode-file reading a little more robust + + bpf_parse_string() will now correctly handle: + + - Extraneous whitespace, + - OPs on multiple lines and + - overlong file names. + + The added feature of allowing to have OPs on multiple lines (like e.g. + tcpdump prints them) is rather a side effect of fixing detection of + malformed bytecode files having random content on a second line, like + e.g.: + + | 4,40 0 0 12,21 0 1 2048,6 0 0 262144,6 0 0 0 + | foobar + + Cc: Daniel Borkmann + Signed-off-by: Phil Sutter + Acked-by: Daniel Borkmann +--- + lib/bpf.c | 32 ++++++++++++++++++++++++-------- + 1 file changed, 24 insertions(+), 8 deletions(-) + +diff --git a/lib/bpf.c b/lib/bpf.c +index 04ee1ab..73dac5c 100644 +--- a/lib/bpf.c ++++ b/lib/bpf.c +@@ -160,11 +160,11 @@ static int bpf_parse_string(char *arg, bool from_file, __u16 *bpf_len, + + if (from_file) { + size_t tmp_len, op_len = sizeof("65535 255 255 4294967295,"); +- char *tmp_string, *last; ++ char *tmp_string, *pos, c, c_prev = ' '; + FILE *fp; + + tmp_len = sizeof("4096,") + BPF_MAXINSNS * op_len; +- tmp_string = calloc(1, tmp_len); ++ tmp_string = pos = calloc(1, tmp_len); + if (tmp_string == NULL) + return -ENOMEM; + +@@ -175,17 +175,33 @@ static int bpf_parse_string(char *arg, bool from_file, __u16 *bpf_len, + return -ENOENT; + } + +- if (!fgets(tmp_string, tmp_len, fp)) { ++ while ((c = fgetc(fp)) != EOF) { ++ switch (c) { ++ case '\n': ++ if (c_prev != ',') ++ *(pos++) = ','; ++ break; ++ case ' ': ++ case '\t': ++ if (c_prev != ' ') ++ *(pos++) = c; ++ break; ++ default: ++ *(pos++) = c; ++ } ++ if (pos - tmp_string == tmp_len) ++ break; ++ c_prev = c; ++ } ++ ++ if (!feof(fp)) { + free(tmp_string); + fclose(fp); +- return -EIO; ++ return -E2BIG; + } + + fclose(fp); +- +- last = &tmp_string[strlen(tmp_string) - 1]; +- if (*last == '\n') +- *last = 0; ++ *pos = 0; + + *need_release = true; + *bpf_string = tmp_string; +-- +1.8.3.1 + diff --git a/SOURCES/0005-include-Add-linux-sctp.h.patch b/SOURCES/0005-include-Add-linux-sctp.h.patch deleted file mode 100644 index 0a8828b..0000000 --- a/SOURCES/0005-include-Add-linux-sctp.h.patch +++ /dev/null @@ -1,1036 +0,0 @@ -From fc2a51e9d65617dfcc0271aa94781cae597f89d3 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Wed, 1 Feb 2017 12:09:59 +0100 -Subject: [PATCH] include: Add linux/sctp.h - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1063934 -Upstream Status: iproute2.git commit 5dec02d7b4b70 - -commit 5dec02d7b4b70128a661bab1ff991c605ba28b3f -Author: Phil Sutter -Date: Wed Nov 9 12:12:23 2016 +0100 - - include: Add linux/sctp.h - - Add sanitized UAPI linux/sctp.h header file. - - Signed-off-by: Phil Sutter ---- - include/linux/sctp.h | 1005 ++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 1005 insertions(+) - create mode 100644 include/linux/sctp.h - -diff --git a/include/linux/sctp.h b/include/linux/sctp.h -new file mode 100644 -index 0000000..eee08c0 ---- /dev/null -+++ b/include/linux/sctp.h -@@ -0,0 +1,1005 @@ -+/* SCTP kernel implementation -+ * (C) Copyright IBM Corp. 2001, 2004 -+ * Copyright (c) 1999-2000 Cisco, Inc. -+ * Copyright (c) 1999-2001 Motorola, Inc. -+ * Copyright (c) 2002 Intel Corp. -+ * -+ * This file is part of the SCTP kernel implementation -+ * -+ * This header represents the structures and constants needed to support -+ * the SCTP Extension to the Sockets API. -+ * -+ * This SCTP implementation is free software; -+ * you can redistribute it and/or modify it under the terms of -+ * the GNU General Public License as published by -+ * the Free Software Foundation; either version 2, or (at your option) -+ * any later version. -+ * -+ * This SCTP implementation is distributed in the hope that it -+ * will be useful, but WITHOUT ANY WARRANTY; without even the implied -+ * ************************ -+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -+ * See the GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with GNU CC; see the file COPYING. If not, see -+ * . -+ * -+ * Please send any bug reports or fixes you make to the -+ * email address(es): -+ * lksctp developers -+ * -+ * Or submit a bug report through the following website: -+ * http://www.sf.net/projects/lksctp -+ * -+ * Written or modified by: -+ * La Monte H.P. Yarroll -+ * R. Stewart -+ * K. Morneau -+ * Q. Xie -+ * Karl Knutson -+ * Jon Grimm -+ * Daisy Chang -+ * Ryan Layer -+ * Ardelle Fan -+ * Sridhar Samudrala -+ * Inaky Perez-Gonzalez -+ * Vlad Yasevich -+ * -+ * Any bugs reported given to us we will try to fix... any fixes shared will -+ * be incorporated into the next SCTP release. -+ */ -+ -+#ifndef _SCTP_H -+#define _SCTP_H -+ -+#include -+#include -+ -+typedef __s32 sctp_assoc_t; -+ -+/* The following symbols come from the Sockets API Extensions for -+ * SCTP . -+ */ -+#define SCTP_RTOINFO 0 -+#define SCTP_ASSOCINFO 1 -+#define SCTP_INITMSG 2 -+#define SCTP_NODELAY 3 /* Get/set nodelay option. */ -+#define SCTP_AUTOCLOSE 4 -+#define SCTP_SET_PEER_PRIMARY_ADDR 5 -+#define SCTP_PRIMARY_ADDR 6 -+#define SCTP_ADAPTATION_LAYER 7 -+#define SCTP_DISABLE_FRAGMENTS 8 -+#define SCTP_PEER_ADDR_PARAMS 9 -+#define SCTP_DEFAULT_SEND_PARAM 10 -+#define SCTP_EVENTS 11 -+#define SCTP_I_WANT_MAPPED_V4_ADDR 12 /* Turn on/off mapped v4 addresses */ -+#define SCTP_MAXSEG 13 /* Get/set maximum fragment. */ -+#define SCTP_STATUS 14 -+#define SCTP_GET_PEER_ADDR_INFO 15 -+#define SCTP_DELAYED_ACK_TIME 16 -+#define SCTP_DELAYED_ACK SCTP_DELAYED_ACK_TIME -+#define SCTP_DELAYED_SACK SCTP_DELAYED_ACK_TIME -+#define SCTP_CONTEXT 17 -+#define SCTP_FRAGMENT_INTERLEAVE 18 -+#define SCTP_PARTIAL_DELIVERY_POINT 19 /* Set/Get partial delivery point */ -+#define SCTP_MAX_BURST 20 /* Set/Get max burst */ -+#define SCTP_AUTH_CHUNK 21 /* Set only: add a chunk type to authenticate */ -+#define SCTP_HMAC_IDENT 22 -+#define SCTP_AUTH_KEY 23 -+#define SCTP_AUTH_ACTIVE_KEY 24 -+#define SCTP_AUTH_DELETE_KEY 25 -+#define SCTP_PEER_AUTH_CHUNKS 26 /* Read only */ -+#define SCTP_LOCAL_AUTH_CHUNKS 27 /* Read only */ -+#define SCTP_GET_ASSOC_NUMBER 28 /* Read only */ -+#define SCTP_GET_ASSOC_ID_LIST 29 /* Read only */ -+#define SCTP_AUTO_ASCONF 30 -+#define SCTP_PEER_ADDR_THLDS 31 -+#define SCTP_RECVRCVINFO 32 -+#define SCTP_RECVNXTINFO 33 -+#define SCTP_DEFAULT_SNDINFO 34 -+ -+/* Internal Socket Options. Some of the sctp library functions are -+ * implemented using these socket options. -+ */ -+#define SCTP_SOCKOPT_BINDX_ADD 100 /* BINDX requests for adding addrs */ -+#define SCTP_SOCKOPT_BINDX_REM 101 /* BINDX requests for removing addrs. */ -+#define SCTP_SOCKOPT_PEELOFF 102 /* peel off association. */ -+/* Options 104-106 are deprecated and removed. Do not use this space */ -+#define SCTP_SOCKOPT_CONNECTX_OLD 107 /* CONNECTX old requests. */ -+#define SCTP_GET_PEER_ADDRS 108 /* Get all peer address. */ -+#define SCTP_GET_LOCAL_ADDRS 109 /* Get all local address. */ -+#define SCTP_SOCKOPT_CONNECTX 110 /* CONNECTX requests. */ -+#define SCTP_SOCKOPT_CONNECTX3 111 /* CONNECTX requests (updated) */ -+#define SCTP_GET_ASSOC_STATS 112 /* Read only */ -+#define SCTP_PR_SUPPORTED 113 -+#define SCTP_DEFAULT_PRINFO 114 -+#define SCTP_PR_ASSOC_STATUS 115 -+ -+/* PR-SCTP policies */ -+#define SCTP_PR_SCTP_NONE 0x0000 -+#define SCTP_PR_SCTP_TTL 0x0010 -+#define SCTP_PR_SCTP_RTX 0x0020 -+#define SCTP_PR_SCTP_PRIO 0x0030 -+#define SCTP_PR_SCTP_MAX SCTP_PR_SCTP_PRIO -+#define SCTP_PR_SCTP_MASK 0x0030 -+ -+#define __SCTP_PR_INDEX(x) ((x >> 4) - 1) -+#define SCTP_PR_INDEX(x) __SCTP_PR_INDEX(SCTP_PR_SCTP_ ## x) -+ -+#define SCTP_PR_POLICY(x) ((x) & SCTP_PR_SCTP_MASK) -+#define SCTP_PR_SET_POLICY(flags, x) \ -+ do { \ -+ flags &= ~SCTP_PR_SCTP_MASK; \ -+ flags |= x; \ -+ } while (0) -+ -+#define SCTP_PR_TTL_ENABLED(x) (SCTP_PR_POLICY(x) == SCTP_PR_SCTP_TTL) -+#define SCTP_PR_RTX_ENABLED(x) (SCTP_PR_POLICY(x) == SCTP_PR_SCTP_RTX) -+#define SCTP_PR_PRIO_ENABLED(x) (SCTP_PR_POLICY(x) == SCTP_PR_SCTP_PRIO) -+ -+/* These are bit fields for msghdr->msg_flags. See section 5.1. */ -+/* On user space Linux, these live in as an enum. */ -+enum sctp_msg_flags { -+ MSG_NOTIFICATION = 0x8000, -+#define MSG_NOTIFICATION MSG_NOTIFICATION -+}; -+ -+/* 5.3.1 SCTP Initiation Structure (SCTP_INIT) -+ * -+ * This cmsghdr structure provides information for initializing new -+ * SCTP associations with sendmsg(). The SCTP_INITMSG socket option -+ * uses this same data structure. This structure is not used for -+ * recvmsg(). -+ * -+ * cmsg_level cmsg_type cmsg_data[] -+ * ------------ ------------ ---------------------- -+ * IPPROTO_SCTP SCTP_INIT struct sctp_initmsg -+ */ -+struct sctp_initmsg { -+ __u16 sinit_num_ostreams; -+ __u16 sinit_max_instreams; -+ __u16 sinit_max_attempts; -+ __u16 sinit_max_init_timeo; -+}; -+ -+/* 5.3.2 SCTP Header Information Structure (SCTP_SNDRCV) -+ * -+ * This cmsghdr structure specifies SCTP options for sendmsg() and -+ * describes SCTP header information about a received message through -+ * recvmsg(). -+ * -+ * cmsg_level cmsg_type cmsg_data[] -+ * ------------ ------------ ---------------------- -+ * IPPROTO_SCTP SCTP_SNDRCV struct sctp_sndrcvinfo -+ */ -+struct sctp_sndrcvinfo { -+ __u16 sinfo_stream; -+ __u16 sinfo_ssn; -+ __u16 sinfo_flags; -+ __u32 sinfo_ppid; -+ __u32 sinfo_context; -+ __u32 sinfo_timetolive; -+ __u32 sinfo_tsn; -+ __u32 sinfo_cumtsn; -+ sctp_assoc_t sinfo_assoc_id; -+}; -+ -+/* 5.3.4 SCTP Send Information Structure (SCTP_SNDINFO) -+ * -+ * This cmsghdr structure specifies SCTP options for sendmsg(). -+ * -+ * cmsg_level cmsg_type cmsg_data[] -+ * ------------ ------------ ------------------- -+ * IPPROTO_SCTP SCTP_SNDINFO struct sctp_sndinfo -+ */ -+struct sctp_sndinfo { -+ __u16 snd_sid; -+ __u16 snd_flags; -+ __u32 snd_ppid; -+ __u32 snd_context; -+ sctp_assoc_t snd_assoc_id; -+}; -+ -+/* 5.3.5 SCTP Receive Information Structure (SCTP_RCVINFO) -+ * -+ * This cmsghdr structure describes SCTP receive information -+ * about a received message through recvmsg(). -+ * -+ * cmsg_level cmsg_type cmsg_data[] -+ * ------------ ------------ ------------------- -+ * IPPROTO_SCTP SCTP_RCVINFO struct sctp_rcvinfo -+ */ -+struct sctp_rcvinfo { -+ __u16 rcv_sid; -+ __u16 rcv_ssn; -+ __u16 rcv_flags; -+ __u32 rcv_ppid; -+ __u32 rcv_tsn; -+ __u32 rcv_cumtsn; -+ __u32 rcv_context; -+ sctp_assoc_t rcv_assoc_id; -+}; -+ -+/* 5.3.6 SCTP Next Receive Information Structure (SCTP_NXTINFO) -+ * -+ * This cmsghdr structure describes SCTP receive information -+ * of the next message that will be delivered through recvmsg() -+ * if this information is already available when delivering -+ * the current message. -+ * -+ * cmsg_level cmsg_type cmsg_data[] -+ * ------------ ------------ ------------------- -+ * IPPROTO_SCTP SCTP_NXTINFO struct sctp_nxtinfo -+ */ -+struct sctp_nxtinfo { -+ __u16 nxt_sid; -+ __u16 nxt_flags; -+ __u32 nxt_ppid; -+ __u32 nxt_length; -+ sctp_assoc_t nxt_assoc_id; -+}; -+ -+/* -+ * sinfo_flags: 16 bits (unsigned integer) -+ * -+ * This field may contain any of the following flags and is composed of -+ * a bitwise OR of these values. -+ */ -+enum sctp_sinfo_flags { -+ SCTP_UNORDERED = (1 << 0), /* Send/receive message unordered. */ -+ SCTP_ADDR_OVER = (1 << 1), /* Override the primary destination. */ -+ SCTP_ABORT = (1 << 2), /* Send an ABORT message to the peer. */ -+ SCTP_SACK_IMMEDIATELY = (1 << 3), /* SACK should be sent without delay. */ -+ SCTP_NOTIFICATION = MSG_NOTIFICATION, /* Next message is not user msg but notification. */ -+ SCTP_EOF = MSG_FIN, /* Initiate graceful shutdown process. */ -+}; -+ -+typedef union { -+ __u8 raw; -+ struct sctp_initmsg init; -+ struct sctp_sndrcvinfo sndrcv; -+} sctp_cmsg_data_t; -+ -+/* These are cmsg_types. */ -+typedef enum sctp_cmsg_type { -+ SCTP_INIT, /* 5.2.1 SCTP Initiation Structure */ -+#define SCTP_INIT SCTP_INIT -+ SCTP_SNDRCV, /* 5.2.2 SCTP Header Information Structure */ -+#define SCTP_SNDRCV SCTP_SNDRCV -+ SCTP_SNDINFO, /* 5.3.4 SCTP Send Information Structure */ -+#define SCTP_SNDINFO SCTP_SNDINFO -+ SCTP_RCVINFO, /* 5.3.5 SCTP Receive Information Structure */ -+#define SCTP_RCVINFO SCTP_RCVINFO -+ SCTP_NXTINFO, /* 5.3.6 SCTP Next Receive Information Structure */ -+#define SCTP_NXTINFO SCTP_NXTINFO -+} sctp_cmsg_t; -+ -+/* -+ * 5.3.1.1 SCTP_ASSOC_CHANGE -+ * -+ * Communication notifications inform the ULP that an SCTP association -+ * has either begun or ended. The identifier for a new association is -+ * provided by this notificaion. The notification information has the -+ * following format: -+ * -+ */ -+struct sctp_assoc_change { -+ __u16 sac_type; -+ __u16 sac_flags; -+ __u32 sac_length; -+ __u16 sac_state; -+ __u16 sac_error; -+ __u16 sac_outbound_streams; -+ __u16 sac_inbound_streams; -+ sctp_assoc_t sac_assoc_id; -+ __u8 sac_info[0]; -+}; -+ -+/* -+ * sac_state: 32 bits (signed integer) -+ * -+ * This field holds one of a number of values that communicate the -+ * event that happened to the association. They include: -+ * -+ * Note: The following state names deviate from the API draft as -+ * the names clash too easily with other kernel symbols. -+ */ -+enum sctp_sac_state { -+ SCTP_COMM_UP, -+ SCTP_COMM_LOST, -+ SCTP_RESTART, -+ SCTP_SHUTDOWN_COMP, -+ SCTP_CANT_STR_ASSOC, -+}; -+ -+/* -+ * 5.3.1.2 SCTP_PEER_ADDR_CHANGE -+ * -+ * When a destination address on a multi-homed peer encounters a change -+ * an interface details event is sent. The information has the -+ * following structure: -+ */ -+struct sctp_paddr_change { -+ __u16 spc_type; -+ __u16 spc_flags; -+ __u32 spc_length; -+ struct sockaddr_storage spc_aaddr; -+ int spc_state; -+ int spc_error; -+ sctp_assoc_t spc_assoc_id; -+} __attribute__((packed, aligned(4))); -+ -+/* -+ * spc_state: 32 bits (signed integer) -+ * -+ * This field holds one of a number of values that communicate the -+ * event that happened to the address. They include: -+ */ -+enum sctp_spc_state { -+ SCTP_ADDR_AVAILABLE, -+ SCTP_ADDR_UNREACHABLE, -+ SCTP_ADDR_REMOVED, -+ SCTP_ADDR_ADDED, -+ SCTP_ADDR_MADE_PRIM, -+ SCTP_ADDR_CONFIRMED, -+}; -+ -+ -+/* -+ * 5.3.1.3 SCTP_REMOTE_ERROR -+ * -+ * A remote peer may send an Operational Error message to its peer. -+ * This message indicates a variety of error conditions on an -+ * association. The entire error TLV as it appears on the wire is -+ * included in a SCTP_REMOTE_ERROR event. Please refer to the SCTP -+ * specification [SCTP] and any extensions for a list of possible -+ * error formats. SCTP error TLVs have the format: -+ */ -+struct sctp_remote_error { -+ __u16 sre_type; -+ __u16 sre_flags; -+ __u32 sre_length; -+ __u16 sre_error; -+ sctp_assoc_t sre_assoc_id; -+ __u8 sre_data[0]; -+}; -+ -+ -+/* -+ * 5.3.1.4 SCTP_SEND_FAILED -+ * -+ * If SCTP cannot deliver a message it may return the message as a -+ * notification. -+ */ -+struct sctp_send_failed { -+ __u16 ssf_type; -+ __u16 ssf_flags; -+ __u32 ssf_length; -+ __u32 ssf_error; -+ struct sctp_sndrcvinfo ssf_info; -+ sctp_assoc_t ssf_assoc_id; -+ __u8 ssf_data[0]; -+}; -+ -+/* -+ * ssf_flags: 16 bits (unsigned integer) -+ * -+ * The flag value will take one of the following values -+ * -+ * SCTP_DATA_UNSENT - Indicates that the data was never put on -+ * the wire. -+ * -+ * SCTP_DATA_SENT - Indicates that the data was put on the wire. -+ * Note that this does not necessarily mean that the -+ * data was (or was not) successfully delivered. -+ */ -+enum sctp_ssf_flags { -+ SCTP_DATA_UNSENT, -+ SCTP_DATA_SENT, -+}; -+ -+/* -+ * 5.3.1.5 SCTP_SHUTDOWN_EVENT -+ * -+ * When a peer sends a SHUTDOWN, SCTP delivers this notification to -+ * inform the application that it should cease sending data. -+ */ -+struct sctp_shutdown_event { -+ __u16 sse_type; -+ __u16 sse_flags; -+ __u32 sse_length; -+ sctp_assoc_t sse_assoc_id; -+}; -+ -+/* -+ * 5.3.1.6 SCTP_ADAPTATION_INDICATION -+ * -+ * When a peer sends a Adaptation Layer Indication parameter , SCTP -+ * delivers this notification to inform the application -+ * that of the peers requested adaptation layer. -+ */ -+struct sctp_adaptation_event { -+ __u16 sai_type; -+ __u16 sai_flags; -+ __u32 sai_length; -+ __u32 sai_adaptation_ind; -+ sctp_assoc_t sai_assoc_id; -+}; -+ -+/* -+ * 5.3.1.7 SCTP_PARTIAL_DELIVERY_EVENT -+ * -+ * When a receiver is engaged in a partial delivery of a -+ * message this notification will be used to indicate -+ * various events. -+ */ -+struct sctp_pdapi_event { -+ __u16 pdapi_type; -+ __u16 pdapi_flags; -+ __u32 pdapi_length; -+ __u32 pdapi_indication; -+ sctp_assoc_t pdapi_assoc_id; -+}; -+ -+enum { SCTP_PARTIAL_DELIVERY_ABORTED=0, }; -+ -+/* -+ * 5.3.1.8. SCTP_AUTHENTICATION_EVENT -+ * -+ * When a receiver is using authentication this message will provide -+ * notifications regarding new keys being made active as well as errors. -+ */ -+struct sctp_authkey_event { -+ __u16 auth_type; -+ __u16 auth_flags; -+ __u32 auth_length; -+ __u16 auth_keynumber; -+ __u16 auth_altkeynumber; -+ __u32 auth_indication; -+ sctp_assoc_t auth_assoc_id; -+}; -+ -+enum { SCTP_AUTH_NEWKEY = 0, }; -+ -+/* -+ * 6.1.9. SCTP_SENDER_DRY_EVENT -+ * -+ * When the SCTP stack has no more user data to send or retransmit, this -+ * notification is given to the user. Also, at the time when a user app -+ * subscribes to this event, if there is no data to be sent or -+ * retransmit, the stack will immediately send up this notification. -+ */ -+struct sctp_sender_dry_event { -+ __u16 sender_dry_type; -+ __u16 sender_dry_flags; -+ __u32 sender_dry_length; -+ sctp_assoc_t sender_dry_assoc_id; -+}; -+ -+/* -+ * Described in Section 7.3 -+ * Ancillary Data and Notification Interest Options -+ */ -+struct sctp_event_subscribe { -+ __u8 sctp_data_io_event; -+ __u8 sctp_association_event; -+ __u8 sctp_address_event; -+ __u8 sctp_send_failure_event; -+ __u8 sctp_peer_error_event; -+ __u8 sctp_shutdown_event; -+ __u8 sctp_partial_delivery_event; -+ __u8 sctp_adaptation_layer_event; -+ __u8 sctp_authentication_event; -+ __u8 sctp_sender_dry_event; -+}; -+ -+/* -+ * 5.3.1 SCTP Notification Structure -+ * -+ * The notification structure is defined as the union of all -+ * notification types. -+ * -+ */ -+union sctp_notification { -+ struct { -+ __u16 sn_type; /* Notification type. */ -+ __u16 sn_flags; -+ __u32 sn_length; -+ } sn_header; -+ struct sctp_assoc_change sn_assoc_change; -+ struct sctp_paddr_change sn_paddr_change; -+ struct sctp_remote_error sn_remote_error; -+ struct sctp_send_failed sn_send_failed; -+ struct sctp_shutdown_event sn_shutdown_event; -+ struct sctp_adaptation_event sn_adaptation_event; -+ struct sctp_pdapi_event sn_pdapi_event; -+ struct sctp_authkey_event sn_authkey_event; -+ struct sctp_sender_dry_event sn_sender_dry_event; -+}; -+ -+/* Section 5.3.1 -+ * All standard values for sn_type flags are greater than 2^15. -+ * Values from 2^15 and down are reserved. -+ */ -+ -+enum sctp_sn_type { -+ SCTP_SN_TYPE_BASE = (1<<15), -+ SCTP_ASSOC_CHANGE, -+#define SCTP_ASSOC_CHANGE SCTP_ASSOC_CHANGE -+ SCTP_PEER_ADDR_CHANGE, -+#define SCTP_PEER_ADDR_CHANGE SCTP_PEER_ADDR_CHANGE -+ SCTP_SEND_FAILED, -+#define SCTP_SEND_FAILED SCTP_SEND_FAILED -+ SCTP_REMOTE_ERROR, -+#define SCTP_REMOTE_ERROR SCTP_REMOTE_ERROR -+ SCTP_SHUTDOWN_EVENT, -+#define SCTP_SHUTDOWN_EVENT SCTP_SHUTDOWN_EVENT -+ SCTP_PARTIAL_DELIVERY_EVENT, -+#define SCTP_PARTIAL_DELIVERY_EVENT SCTP_PARTIAL_DELIVERY_EVENT -+ SCTP_ADAPTATION_INDICATION, -+#define SCTP_ADAPTATION_INDICATION SCTP_ADAPTATION_INDICATION -+ SCTP_AUTHENTICATION_EVENT, -+#define SCTP_AUTHENTICATION_INDICATION SCTP_AUTHENTICATION_EVENT -+ SCTP_SENDER_DRY_EVENT, -+#define SCTP_SENDER_DRY_EVENT SCTP_SENDER_DRY_EVENT -+}; -+ -+/* Notification error codes used to fill up the error fields in some -+ * notifications. -+ * SCTP_PEER_ADDRESS_CHAGE : spc_error -+ * SCTP_ASSOC_CHANGE : sac_error -+ * These names should be potentially included in the draft 04 of the SCTP -+ * sockets API specification. -+ */ -+typedef enum sctp_sn_error { -+ SCTP_FAILED_THRESHOLD, -+ SCTP_RECEIVED_SACK, -+ SCTP_HEARTBEAT_SUCCESS, -+ SCTP_RESPONSE_TO_USER_REQ, -+ SCTP_INTERNAL_ERROR, -+ SCTP_SHUTDOWN_GUARD_EXPIRES, -+ SCTP_PEER_FAULTY, -+} sctp_sn_error_t; -+ -+/* -+ * 7.1.1 Retransmission Timeout Parameters (SCTP_RTOINFO) -+ * -+ * The protocol parameters used to initialize and bound retransmission -+ * timeout (RTO) are tunable. See [SCTP] for more information on how -+ * these parameters are used in RTO calculation. -+ */ -+struct sctp_rtoinfo { -+ sctp_assoc_t srto_assoc_id; -+ __u32 srto_initial; -+ __u32 srto_max; -+ __u32 srto_min; -+}; -+ -+/* -+ * 7.1.2 Association Parameters (SCTP_ASSOCINFO) -+ * -+ * This option is used to both examine and set various association and -+ * endpoint parameters. -+ */ -+struct sctp_assocparams { -+ sctp_assoc_t sasoc_assoc_id; -+ __u16 sasoc_asocmaxrxt; -+ __u16 sasoc_number_peer_destinations; -+ __u32 sasoc_peer_rwnd; -+ __u32 sasoc_local_rwnd; -+ __u32 sasoc_cookie_life; -+}; -+ -+/* -+ * 7.1.9 Set Peer Primary Address (SCTP_SET_PEER_PRIMARY_ADDR) -+ * -+ * Requests that the peer mark the enclosed address as the association -+ * primary. The enclosed address must be one of the association's -+ * locally bound addresses. The following structure is used to make a -+ * set primary request: -+ */ -+struct sctp_setpeerprim { -+ sctp_assoc_t sspp_assoc_id; -+ struct sockaddr_storage sspp_addr; -+} __attribute__((packed, aligned(4))); -+ -+/* -+ * 7.1.10 Set Primary Address (SCTP_PRIMARY_ADDR) -+ * -+ * Requests that the local SCTP stack use the enclosed peer address as -+ * the association primary. The enclosed address must be one of the -+ * association peer's addresses. The following structure is used to -+ * make a set peer primary request: -+ */ -+struct sctp_prim { -+ sctp_assoc_t ssp_assoc_id; -+ struct sockaddr_storage ssp_addr; -+} __attribute__((packed, aligned(4))); -+ -+/* For backward compatibility use, define the old name too */ -+#define sctp_setprim sctp_prim -+ -+/* -+ * 7.1.11 Set Adaptation Layer Indicator (SCTP_ADAPTATION_LAYER) -+ * -+ * Requests that the local endpoint set the specified Adaptation Layer -+ * Indication parameter for all future INIT and INIT-ACK exchanges. -+ */ -+struct sctp_setadaptation { -+ __u32 ssb_adaptation_ind; -+}; -+ -+/* -+ * 7.1.13 Peer Address Parameters (SCTP_PEER_ADDR_PARAMS) -+ * -+ * Applications can enable or disable heartbeats for any peer address -+ * of an association, modify an address's heartbeat interval, force a -+ * heartbeat to be sent immediately, and adjust the address's maximum -+ * number of retransmissions sent before an address is considered -+ * unreachable. The following structure is used to access and modify an -+ * address's parameters: -+ */ -+enum sctp_spp_flags { -+ SPP_HB_ENABLE = 1<<0, /*Enable heartbeats*/ -+ SPP_HB_DISABLE = 1<<1, /*Disable heartbeats*/ -+ SPP_HB = SPP_HB_ENABLE | SPP_HB_DISABLE, -+ SPP_HB_DEMAND = 1<<2, /*Send heartbeat immediately*/ -+ SPP_PMTUD_ENABLE = 1<<3, /*Enable PMTU discovery*/ -+ SPP_PMTUD_DISABLE = 1<<4, /*Disable PMTU discovery*/ -+ SPP_PMTUD = SPP_PMTUD_ENABLE | SPP_PMTUD_DISABLE, -+ SPP_SACKDELAY_ENABLE = 1<<5, /*Enable SACK*/ -+ SPP_SACKDELAY_DISABLE = 1<<6, /*Disable SACK*/ -+ SPP_SACKDELAY = SPP_SACKDELAY_ENABLE | SPP_SACKDELAY_DISABLE, -+ SPP_HB_TIME_IS_ZERO = 1<<7, /* Set HB delay to 0 */ -+}; -+ -+struct sctp_paddrparams { -+ sctp_assoc_t spp_assoc_id; -+ struct sockaddr_storage spp_address; -+ __u32 spp_hbinterval; -+ __u16 spp_pathmaxrxt; -+ __u32 spp_pathmtu; -+ __u32 spp_sackdelay; -+ __u32 spp_flags; -+} __attribute__((packed, aligned(4))); -+ -+/* -+ * 7.1.18. Add a chunk that must be authenticated (SCTP_AUTH_CHUNK) -+ * -+ * This set option adds a chunk type that the user is requesting to be -+ * received only in an authenticated way. Changes to the list of chunks -+ * will only effect future associations on the socket. -+ */ -+struct sctp_authchunk { -+ __u8 sauth_chunk; -+}; -+ -+/* -+ * 7.1.19. Get or set the list of supported HMAC Identifiers (SCTP_HMAC_IDENT) -+ * -+ * This option gets or sets the list of HMAC algorithms that the local -+ * endpoint requires the peer to use. -+ */ -+/* This here is only used by user space as is. It might not be a good idea -+ * to export/reveal the whole structure with reserved fields etc. -+ */ -+enum { -+ SCTP_AUTH_HMAC_ID_SHA1 = 1, -+ SCTP_AUTH_HMAC_ID_SHA256 = 3, -+}; -+ -+struct sctp_hmacalgo { -+ __u32 shmac_num_idents; -+ __u16 shmac_idents[]; -+}; -+ -+/* Sadly, user and kernel space have different names for -+ * this structure member, so this is to not break anything. -+ */ -+#define shmac_number_of_idents shmac_num_idents -+ -+/* -+ * 7.1.20. Set a shared key (SCTP_AUTH_KEY) -+ * -+ * This option will set a shared secret key which is used to build an -+ * association shared key. -+ */ -+struct sctp_authkey { -+ sctp_assoc_t sca_assoc_id; -+ __u16 sca_keynumber; -+ __u16 sca_keylength; -+ __u8 sca_key[]; -+}; -+ -+/* -+ * 7.1.21. Get or set the active shared key (SCTP_AUTH_ACTIVE_KEY) -+ * -+ * This option will get or set the active shared key to be used to build -+ * the association shared key. -+ */ -+ -+struct sctp_authkeyid { -+ sctp_assoc_t scact_assoc_id; -+ __u16 scact_keynumber; -+}; -+ -+ -+/* -+ * 7.1.23. Get or set delayed ack timer (SCTP_DELAYED_SACK) -+ * -+ * This option will effect the way delayed acks are performed. This -+ * option allows you to get or set the delayed ack time, in -+ * milliseconds. It also allows changing the delayed ack frequency. -+ * Changing the frequency to 1 disables the delayed sack algorithm. If -+ * the assoc_id is 0, then this sets or gets the endpoints default -+ * values. If the assoc_id field is non-zero, then the set or get -+ * effects the specified association for the one to many model (the -+ * assoc_id field is ignored by the one to one model). Note that if -+ * sack_delay or sack_freq are 0 when setting this option, then the -+ * current values will remain unchanged. -+ */ -+struct sctp_sack_info { -+ sctp_assoc_t sack_assoc_id; -+ uint32_t sack_delay; -+ uint32_t sack_freq; -+}; -+ -+struct sctp_assoc_value { -+ sctp_assoc_t assoc_id; -+ uint32_t assoc_value; -+}; -+ -+/* -+ * 7.2.2 Peer Address Information -+ * -+ * Applications can retrieve information about a specific peer address -+ * of an association, including its reachability state, congestion -+ * window, and retransmission timer values. This information is -+ * read-only. The following structure is used to access this -+ * information: -+ */ -+struct sctp_paddrinfo { -+ sctp_assoc_t spinfo_assoc_id; -+ struct sockaddr_storage spinfo_address; -+ __s32 spinfo_state; -+ __u32 spinfo_cwnd; -+ __u32 spinfo_srtt; -+ __u32 spinfo_rto; -+ __u32 spinfo_mtu; -+} __attribute__((packed, aligned(4))); -+ -+/* Peer addresses's state. */ -+/* UNKNOWN: Peer address passed by the upper layer in sendmsg or connect[x] -+ * calls. -+ * UNCONFIRMED: Peer address received in INIT/INIT-ACK address parameters. -+ * Not yet confirmed by a heartbeat and not available for data -+ * transfers. -+ * ACTIVE : Peer address confirmed, active and available for data transfers. -+ * INACTIVE: Peer address inactive and not available for data transfers. -+ */ -+enum sctp_spinfo_state { -+ SCTP_INACTIVE, -+ SCTP_PF, -+ SCTP_ACTIVE, -+ SCTP_UNCONFIRMED, -+ SCTP_UNKNOWN = 0xffff /* Value used for transport state unknown */ -+}; -+ -+/* -+ * 7.2.1 Association Status (SCTP_STATUS) -+ * -+ * Applications can retrieve current status information about an -+ * association, including association state, peer receiver window size, -+ * number of unacked data chunks, and number of data chunks pending -+ * receipt. This information is read-only. The following structure is -+ * used to access this information: -+ */ -+struct sctp_status { -+ sctp_assoc_t sstat_assoc_id; -+ __s32 sstat_state; -+ __u32 sstat_rwnd; -+ __u16 sstat_unackdata; -+ __u16 sstat_penddata; -+ __u16 sstat_instrms; -+ __u16 sstat_outstrms; -+ __u32 sstat_fragmentation_point; -+ struct sctp_paddrinfo sstat_primary; -+}; -+ -+/* -+ * 7.2.3. Get the list of chunks the peer requires to be authenticated -+ * (SCTP_PEER_AUTH_CHUNKS) -+ * -+ * This option gets a list of chunks for a specified association that -+ * the peer requires to be received authenticated only. -+ */ -+struct sctp_authchunks { -+ sctp_assoc_t gauth_assoc_id; -+ __u32 gauth_number_of_chunks; -+ uint8_t gauth_chunks[]; -+}; -+ -+/* The broken spelling has been released already in lksctp-tools header, -+ * so don't break anyone, now that it's fixed. -+ */ -+#define guth_number_of_chunks gauth_number_of_chunks -+ -+/* Association states. */ -+enum sctp_sstat_state { -+ SCTP_EMPTY = 0, -+ SCTP_CLOSED = 1, -+ SCTP_COOKIE_WAIT = 2, -+ SCTP_COOKIE_ECHOED = 3, -+ SCTP_ESTABLISHED = 4, -+ SCTP_SHUTDOWN_PENDING = 5, -+ SCTP_SHUTDOWN_SENT = 6, -+ SCTP_SHUTDOWN_RECEIVED = 7, -+ SCTP_SHUTDOWN_ACK_SENT = 8, -+}; -+ -+/* -+ * 8.2.6. Get the Current Identifiers of Associations -+ * (SCTP_GET_ASSOC_ID_LIST) -+ * -+ * This option gets the current list of SCTP association identifiers of -+ * the SCTP associations handled by a one-to-many style socket. -+ */ -+struct sctp_assoc_ids { -+ __u32 gaids_number_of_ids; -+ sctp_assoc_t gaids_assoc_id[]; -+}; -+ -+/* -+ * 8.3, 8.5 get all peer/local addresses in an association. -+ * This parameter struct is used by SCTP_GET_PEER_ADDRS and -+ * SCTP_GET_LOCAL_ADDRS socket options used internally to implement -+ * sctp_getpaddrs() and sctp_getladdrs() API. -+ */ -+struct sctp_getaddrs_old { -+ sctp_assoc_t assoc_id; -+ int addr_num; -+ struct sockaddr *addrs; -+}; -+ -+struct sctp_getaddrs { -+ sctp_assoc_t assoc_id; /*input*/ -+ __u32 addr_num; /*output*/ -+ __u8 addrs[0]; /*output, variable size*/ -+}; -+ -+/* A socket user request obtained via SCTP_GET_ASSOC_STATS that retrieves -+ * association stats. All stats are counts except sas_maxrto and -+ * sas_obs_rto_ipaddr. maxrto is the max observed rto + transport since -+ * the last call. Will return 0 when RTO was not update since last call -+ */ -+struct sctp_assoc_stats { -+ sctp_assoc_t sas_assoc_id; /* Input */ -+ /* Transport of observed max RTO */ -+ struct sockaddr_storage sas_obs_rto_ipaddr; -+ __u64 sas_maxrto; /* Maximum Observed RTO for period */ -+ __u64 sas_isacks; /* SACKs received */ -+ __u64 sas_osacks; /* SACKs sent */ -+ __u64 sas_opackets; /* Packets sent */ -+ __u64 sas_ipackets; /* Packets received */ -+ __u64 sas_rtxchunks; /* Retransmitted Chunks */ -+ __u64 sas_outofseqtsns;/* TSN received > next expected */ -+ __u64 sas_idupchunks; /* Dups received (ordered+unordered) */ -+ __u64 sas_gapcnt; /* Gap Acknowledgements Received */ -+ __u64 sas_ouodchunks; /* Unordered data chunks sent */ -+ __u64 sas_iuodchunks; /* Unordered data chunks received */ -+ __u64 sas_oodchunks; /* Ordered data chunks sent */ -+ __u64 sas_iodchunks; /* Ordered data chunks received */ -+ __u64 sas_octrlchunks; /* Control chunks sent */ -+ __u64 sas_ictrlchunks; /* Control chunks received */ -+}; -+ -+/* -+ * 8.1 sctp_bindx() -+ * -+ * The flags parameter is formed from the bitwise OR of zero or more of the -+ * following currently defined flags: -+ */ -+#define SCTP_BINDX_ADD_ADDR 0x01 -+#define SCTP_BINDX_REM_ADDR 0x02 -+ -+/* This is the structure that is passed as an argument(optval) to -+ * getsockopt(SCTP_SOCKOPT_PEELOFF). -+ */ -+typedef struct { -+ sctp_assoc_t associd; -+ int sd; -+} sctp_peeloff_arg_t; -+ -+/* -+ * Peer Address Thresholds socket option -+ */ -+struct sctp_paddrthlds { -+ sctp_assoc_t spt_assoc_id; -+ struct sockaddr_storage spt_address; -+ __u16 spt_pathmaxrxt; -+ __u16 spt_pathpfthld; -+}; -+ -+/* -+ * Socket Option for Getting the Association/Stream-Specific PR-SCTP Status -+ */ -+struct sctp_prstatus { -+ sctp_assoc_t sprstat_assoc_id; -+ __u16 sprstat_sid; -+ __u16 sprstat_policy; -+ __u64 sprstat_abandoned_unsent; -+ __u64 sprstat_abandoned_sent; -+}; -+ -+struct sctp_default_prinfo { -+ sctp_assoc_t pr_assoc_id; -+ __u32 pr_value; -+ __u16 pr_policy; -+}; -+ -+struct sctp_info { -+ __u32 sctpi_tag; -+ __u32 sctpi_state; -+ __u32 sctpi_rwnd; -+ __u16 sctpi_unackdata; -+ __u16 sctpi_penddata; -+ __u16 sctpi_instrms; -+ __u16 sctpi_outstrms; -+ __u32 sctpi_fragmentation_point; -+ __u32 sctpi_inqueue; -+ __u32 sctpi_outqueue; -+ __u32 sctpi_overall_error; -+ __u32 sctpi_max_burst; -+ __u32 sctpi_maxseg; -+ __u32 sctpi_peer_rwnd; -+ __u32 sctpi_peer_tag; -+ __u8 sctpi_peer_capable; -+ __u8 sctpi_peer_sack; -+ __u16 __reserved1; -+ -+ /* assoc status info */ -+ __u64 sctpi_isacks; -+ __u64 sctpi_osacks; -+ __u64 sctpi_opackets; -+ __u64 sctpi_ipackets; -+ __u64 sctpi_rtxchunks; -+ __u64 sctpi_outofseqtsns; -+ __u64 sctpi_idupchunks; -+ __u64 sctpi_gapcnt; -+ __u64 sctpi_ouodchunks; -+ __u64 sctpi_iuodchunks; -+ __u64 sctpi_oodchunks; -+ __u64 sctpi_iodchunks; -+ __u64 sctpi_octrlchunks; -+ __u64 sctpi_ictrlchunks; -+ -+ /* primary transport info */ -+ struct sockaddr_storage sctpi_p_address; -+ __s32 sctpi_p_state; -+ __u32 sctpi_p_cwnd; -+ __u32 sctpi_p_srtt; -+ __u32 sctpi_p_rto; -+ __u32 sctpi_p_hbinterval; -+ __u32 sctpi_p_pathmaxrxt; -+ __u32 sctpi_p_sackdelay; -+ __u32 sctpi_p_sackfreq; -+ __u32 sctpi_p_ssthresh; -+ __u32 sctpi_p_partial_bytes_acked; -+ __u32 sctpi_p_flight_size; -+ __u16 sctpi_p_error; -+ __u16 __reserved2; -+ -+ /* sctp sock info */ -+ __u32 sctpi_s_autoclose; -+ __u32 sctpi_s_adaptation_ind; -+ __u32 sctpi_s_pd_point; -+ __u8 sctpi_s_nodelay; -+ __u8 sctpi_s_disable_fragments; -+ __u8 sctpi_s_v4mapped; -+ __u8 sctpi_s_frag_interleave; -+ __u32 sctpi_s_type; -+ __u32 __reserved3; -+}; -+ -+#endif /* _SCTP_H */ --- -1.8.3.1 - diff --git a/SOURCES/0006-ss-Add-support-for-SCTP-protocol.patch b/SOURCES/0006-ss-Add-support-for-SCTP-protocol.patch deleted file mode 100644 index 9f8a16b..0000000 --- a/SOURCES/0006-ss-Add-support-for-SCTP-protocol.patch +++ /dev/null @@ -1,454 +0,0 @@ -From 48d997511c1537ec8e2d6227251f8be1ede064d4 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Wed, 1 Feb 2017 12:10:00 +0100 -Subject: [PATCH] ss: Add support for SCTP protocol - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1063934 -Upstream Status: iproute2.git commit f89d46ad63f6f -Conflicts: -* missing commit 6885e3bf8efa3 - ("ss: Include -E option for socket destroy events") -* missing commit acd1e437befbb ("misc: fix style issues") -* missing commit 82d73ea03a149 ("ss: Refactor inet_show_sock") -* missing other commandline flags/features -* fixed for missing commit a418e451643e7 - ("make format_host non-reentrant by default") - -commit f89d46ad63f6f606f777da964205bc53b2197cfa -Author: Phil Sutter -Date: Wed Nov 9 12:12:24 2016 +0100 - - ss: Add support for SCTP protocol - - This makes use of the sctp_diag interface recently added to the kernel. - - Joint work with Xin Long who provided the PoC implementation which I - merely polished up a bit. - - Signed-off-by: Phil Sutter ---- - man/man8/ss.8 | 3 + - misc/ss.c | 215 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--- - 2 files changed, 210 insertions(+), 8 deletions(-) - -diff --git a/man/man8/ss.8 b/man/man8/ss.8 -index f4d5264..b02a68c 100644 ---- a/man/man8/ss.8 -+++ b/man/man8/ss.8 -@@ -114,6 +114,9 @@ Display RAW sockets. - .B \-x, \-\-unix - Display Unix domain sockets (alias for -f unix). - .TP -+.B \-S, \-\-sctp -+Display SCTP sockets. -+.TP - .B \-f FAMILY, \-\-family=FAMILY - Display sockets of type FAMILY. - Currently the following families are supported: unix, inet, inet6, link, netlink. -diff --git a/misc/ss.c b/misc/ss.c -index 45fb4b0..d438428 100644 ---- a/misc/ss.c -+++ b/misc/ss.c -@@ -42,6 +42,7 @@ - #include - #include - #include -+#include - - #define MAGIC_SEQ 123456 - -@@ -99,6 +100,7 @@ int show_proc_ctx = 0; - int show_sock_ctx = 0; - /* If show_users & show_proc_ctx only do user_ent_hash_build() once */ - int user_ent_hash_build_init = 0; -+int sctp_ino; - - int netid_width; - int state_width; -@@ -108,6 +110,7 @@ int serv_width; - int screen_width; - - static const char *TCP_PROTO = "tcp"; -+static const char *SCTP_PROTO = "sctp"; - static const char *UDP_PROTO = "udp"; - static const char *RAW_PROTO = "raw"; - static const char *dg_proto = NULL; -@@ -124,13 +127,14 @@ enum - PACKET_DG_DB, - PACKET_R_DB, - NETLINK_DB, -+ SCTP_DB, - MAX_DB - }; - - #define PACKET_DBM ((1<ino) -+ return false; -+ return true; -+} -+ - static void sock_state_print(struct sockstat *s, const char *sock_name) - { - if (netid_width) -- printf("%-*s ", netid_width, sock_name); -- if (state_width) -- printf("%-*s ", state_width, sstate_name[s->state]); -+ printf("%-*s ", netid_width, -+ is_sctp_assoc(s, sock_name) ? "" : sock_name); -+ if (state_width) { -+ if (is_sctp_assoc(s, sock_name)) -+ printf("`- %-*s ", state_width - 3, -+ sctp_sstate_name[s->state]); -+ else -+ printf("%-*s ", state_width, sstate_name[s->state]); -+ } - - printf("%-6d %-6d ", s->rq, s->wq); - } -@@ -895,6 +944,8 @@ static void init_service_resolver(void) - c->proto = TCP_PROTO; - else if (strcmp(proto, UDP_PROTO) == 0) - c->proto = UDP_PROTO; -+ else if (strcmp(proto, SCTP_PROTO) == 0) -+ c->proto = SCTP_PROTO; - else - c->proto = NULL; - c->next = rlist; -@@ -1566,6 +1617,8 @@ static char *proto_name(int protocol) - return "udp"; - case IPPROTO_TCP: - return "tcp"; -+ case IPPROTO_SCTP: -+ return "sctp"; - case IPPROTO_DCCP: - return "dccp"; - } -@@ -1658,6 +1711,56 @@ static char *sprint_bw(char *buf, double bw) - return buf; - } - -+static void sctp_stats_print(struct sctp_info *s) -+{ -+ if (s->sctpi_tag) -+ printf(" tag:%x", s->sctpi_tag); -+ if (s->sctpi_state) -+ printf(" state:%s", sctp_sstate_name[s->sctpi_state]); -+ if (s->sctpi_rwnd) -+ printf(" rwnd:%d", s->sctpi_rwnd); -+ if (s->sctpi_unackdata) -+ printf(" unackdata:%d", s->sctpi_unackdata); -+ if (s->sctpi_penddata) -+ printf(" penddata:%d", s->sctpi_penddata); -+ if (s->sctpi_instrms) -+ printf(" instrms:%d", s->sctpi_instrms); -+ if (s->sctpi_outstrms) -+ printf(" outstrms:%d", s->sctpi_outstrms); -+ if (s->sctpi_inqueue) -+ printf(" inqueue:%d", s->sctpi_inqueue); -+ if (s->sctpi_outqueue) -+ printf(" outqueue:%d", s->sctpi_outqueue); -+ if (s->sctpi_overall_error) -+ printf(" overerr:%d", s->sctpi_overall_error); -+ if (s->sctpi_max_burst) -+ printf(" maxburst:%d", s->sctpi_max_burst); -+ if (s->sctpi_maxseg) -+ printf(" maxseg:%d", s->sctpi_maxseg); -+ if (s->sctpi_peer_rwnd) -+ printf(" prwnd:%d", s->sctpi_peer_rwnd); -+ if (s->sctpi_peer_tag) -+ printf(" ptag:%x", s->sctpi_peer_tag); -+ if (s->sctpi_peer_capable) -+ printf(" pcapable:%d", s->sctpi_peer_capable); -+ if (s->sctpi_peer_sack) -+ printf(" psack:%d", s->sctpi_peer_sack); -+ if (s->sctpi_s_autoclose) -+ printf(" autoclose:%d", s->sctpi_s_autoclose); -+ if (s->sctpi_s_adaptation_ind) -+ printf(" adapind:%d", s->sctpi_s_adaptation_ind); -+ if (s->sctpi_s_pd_point) -+ printf(" pdpoint:%d", s->sctpi_s_pd_point); -+ if (s->sctpi_s_nodelay) -+ printf(" nodealy:%d", s->sctpi_s_nodelay); -+ if (s->sctpi_s_disable_fragments) -+ printf(" nofrag:%d", s->sctpi_s_disable_fragments); -+ if (s->sctpi_s_v4mapped) -+ printf(" v4mapped:%d", s->sctpi_s_v4mapped); -+ if (s->sctpi_s_frag_interleave) -+ printf(" fraginl:%d", s->sctpi_s_frag_interleave); -+} -+ - static void tcp_stats_print(struct tcpstat *s) - { - char b1[64]; -@@ -1762,6 +1865,13 @@ static void tcp_timer_print(struct tcpstat *s) - } - } - -+static void sctp_timer_print(struct tcpstat *s) -+{ -+ if (s->timer) -+ printf(" timer:(T3_RTX,%s,%d)", -+ print_ms_timer(s->timeout), s->retrans); -+} -+ - static int tcp_show_line(char *line, const struct filter *f, int family) - { - int rto = 0, ato = 0; -@@ -2007,6 +2117,67 @@ static void tcp_show_info(const struct nlmsghdr *nlh, struct inet_diag_msg *r, - } - } - -+static const char *format_host_sa(struct sockaddr_storage *sa) -+{ -+ char buf[1024]; -+ union { -+ struct sockaddr_in sin; -+ struct sockaddr_in6 sin6; -+ } *saddr = (void *)sa; -+ -+ switch (sa->ss_family) { -+ case AF_INET: -+ return format_host(AF_INET, 4, &saddr->sin.sin_addr, -+ buf, sizeof(buf)); -+ case AF_INET6: -+ return format_host(AF_INET6, 16, &saddr->sin6.sin6_addr, -+ buf, sizeof(buf)); -+ default: -+ return ""; -+ } -+} -+ -+static void sctp_show_info(const struct nlmsghdr *nlh, struct inet_diag_msg *r, -+ struct rtattr *tb[]) -+{ -+ struct sockaddr_storage *sa; -+ int len; -+ -+ print_skmeminfo(tb, INET_DIAG_SKMEMINFO); -+ -+ if (tb[INET_DIAG_LOCALS]) { -+ len = RTA_PAYLOAD(tb[INET_DIAG_LOCALS]); -+ sa = RTA_DATA(tb[INET_DIAG_LOCALS]); -+ -+ printf("locals:%s", format_host_sa(sa)); -+ for (sa++, len -= sizeof(*sa); len > 0; sa++, len -= sizeof(*sa)) -+ printf(",%s", format_host_sa(sa)); -+ -+ } -+ if (tb[INET_DIAG_PEERS]) { -+ len = RTA_PAYLOAD(tb[INET_DIAG_PEERS]); -+ sa = RTA_DATA(tb[INET_DIAG_PEERS]); -+ -+ printf(" peers:%s", format_host_sa(sa)); -+ for (sa++, len -= sizeof(*sa); len > 0; sa++, len -= sizeof(*sa)) -+ printf(",%s", format_host_sa(sa)); -+ } -+ if (tb[INET_DIAG_INFO]) { -+ struct sctp_info *info; -+ len = RTA_PAYLOAD(tb[INET_DIAG_INFO]); -+ -+ /* workaround for older kernels with less fields */ -+ if (len < sizeof(*info)) { -+ info = alloca(sizeof(*info)); -+ memcpy(info, RTA_DATA(tb[INET_DIAG_INFO]), len); -+ memset((char *)info + len, 0, sizeof(*info) - len); -+ } else -+ info = RTA_DATA(tb[INET_DIAG_INFO]); -+ -+ sctp_stats_print(info); -+ } -+} -+ - static int inet_show_sock(struct nlmsghdr *nlh, struct filter *f, int protocol) - { - struct rtattr * tb[INET_DIAG_MAX+1]; -@@ -2047,7 +2218,10 @@ static int inet_show_sock(struct nlmsghdr *nlh, struct filter *f, int protocol) - t.timer = r->idiag_timer; - t.timeout = r->idiag_expires; - t.retrans = r->idiag_retrans; -- tcp_timer_print(&t); -+ if (protocol == IPPROTO_SCTP) -+ sctp_timer_print(&t); -+ else -+ tcp_timer_print(&t); - } - - if (show_details) { -@@ -2066,8 +2240,12 @@ static int inet_show_sock(struct nlmsghdr *nlh, struct filter *f, int protocol) - - if (show_mem || show_tcpinfo) { - printf("\n\t"); -- tcp_show_info(nlh, r, tb); -+ if (protocol == IPPROTO_SCTP) -+ sctp_show_info(nlh, r, tb); -+ else -+ tcp_show_info(nlh, r, tb); - } -+ sctp_ino = s.ino; - - printf("\n"); - return 0; -@@ -2392,6 +2570,17 @@ outerr: - } while (0); - } - -+static int sctp_show(struct filter *f) -+{ -+ if (!filter_af_get(f, AF_INET) && !filter_af_get(f, AF_INET6)) -+ return 0; -+ -+ if (!getenv("PROC_NET_SCTP") && !getenv("PROC_ROOT") -+ && inet_show_netlink(f, NULL, IPPROTO_SCTP) == 0) -+ return 0; -+ -+ return 0; -+} - - static int dgram_show_line(char *line, const struct filter *f, int family) - { -@@ -3343,6 +3532,7 @@ static void _usage(FILE *dest) - " -6, --ipv6 display only IP version 6 sockets\n" - " -0, --packet display PACKET sockets\n" - " -t, --tcp display only TCP sockets\n" -+" -S, --sctp display only SCTP sockets\n" - " -u, --udp display only UDP sockets\n" - " -d, --dccp display only DCCP sockets\n" - " -w, --raw display only RAW sockets\n" -@@ -3419,6 +3609,7 @@ static const struct option long_opts[] = { - { "bpf", 0, 0, 'b' }, - { "dccp", 0, 0, 'd' }, - { "tcp", 0, 0, 't' }, -+ { "sctp", 0, 0, 'S' }, - { "udp", 0, 0, 'u' }, - { "raw", 0, 0, 'w' }, - { "unix", 0, 0, 'x' }, -@@ -3452,7 +3643,7 @@ int main(int argc, char *argv[]) - int ch; - int state_filter = 0; - -- while ((ch = getopt_long(argc, argv, "dhaletuwxnro460spbf:miA:D:F:vVzZN:", -+ while ((ch = getopt_long(argc, argv, "dhaletuwxnro460spbf:miA:D:F:vVzZN:S", - long_opts, NULL)) != EOF) { - switch(ch) { - case 'n': -@@ -3488,6 +3679,9 @@ int main(int argc, char *argv[]) - case 't': - filter_db_set(¤t_filter, TCP_DB); - break; -+ case 'S': -+ filter_db_set(¤t_filter, SCTP_DB); -+ break; - case 'u': - filter_db_set(¤t_filter, UDP_DB); - break; -@@ -3551,6 +3745,7 @@ int main(int argc, char *argv[]) - filter_db_set(¤t_filter, UDP_DB); - filter_db_set(¤t_filter, DCCP_DB); - filter_db_set(¤t_filter, TCP_DB); -+ filter_db_set(¤t_filter, SCTP_DB); - filter_db_set(¤t_filter, RAW_DB); - } else if (strcmp(p, "udp") == 0) { - filter_db_set(¤t_filter, UDP_DB); -@@ -3558,6 +3753,8 @@ int main(int argc, char *argv[]) - filter_db_set(¤t_filter, DCCP_DB); - } else if (strcmp(p, "tcp") == 0) { - filter_db_set(¤t_filter, TCP_DB); -+ } else if (strcmp(p, "sctp") == 0) { -+ filter_db_set(¤t_filter, SCTP_DB); - } else if (strcmp(p, "raw") == 0) { - filter_db_set(¤t_filter, RAW_DB); - } else if (strcmp(p, "unix") == 0) { -@@ -3682,7 +3879,7 @@ int main(int argc, char *argv[]) - filter_merge_defaults(¤t_filter); - - if (resolve_services && resolve_hosts && -- (current_filter.dbs&(UNIX_DBM|(1< +Date: Thu, 31 Aug 2017 14:23:11 +0200 +Subject: [PATCH] ss: Fix for added diag support check + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1487152 +Upstream Status: iproute2.git commit 6c6bbc30f4e7f + +commit 6c6bbc30f4e7fedc74381627f7ec86d26050b404 +Author: Phil Sutter +Date: Mon Aug 28 19:31:22 2017 +0200 + + ss: Fix for added diag support check + + Commit 9f66764e308e9 ("libnetlink: Add test for error code returned from + netlink reply") changed rtnl_dump_filter_l() to return an error in case + NLMSG_DONE would contain one, even if it was ENOENT. + + This in turn breaks ss when it tries to dump DCCP sockets on a system + without support for it: The function tcp_show(), which is shared between + TCP and DCCP, will start parsing /proc since inet_show_netlink() returns + an error - yet it parses /proc/net/tcp which doesn't make sense for DCCP + sockets at all. + + On my system, a call to 'ss' without further arguments prints the list + of connected TCP sockets twice. + + Fix this by introducing a dedicated function dccp_show() which does not + have a fallback to /proc, just like sctp_show(). And since tcp_show() + is no longer "multi-purpose", drop it's socktype parameter. + + Fixes: 9f66764e308e9 ("libnetlink: Add test for error code returned from netlink reply") + Signed-off-by: Phil Sutter +--- + misc/ss.c | 20 ++++++++++++++++---- + 1 file changed, 16 insertions(+), 4 deletions(-) + +diff --git a/misc/ss.c b/misc/ss.c +index 12763c9..b84baf3 100644 +--- a/misc/ss.c ++++ b/misc/ss.c +@@ -2735,7 +2735,7 @@ static int tcp_show_netlink_file(struct filter *f) + } + } + +-static int tcp_show(struct filter *f, int socktype) ++static int tcp_show(struct filter *f) + { + FILE *fp = NULL; + char *buf = NULL; +@@ -2750,7 +2750,7 @@ static int tcp_show(struct filter *f, int socktype) + return tcp_show_netlink_file(f); + + if (!getenv("PROC_NET_TCP") && !getenv("PROC_ROOT") +- && inet_show_netlink(f, NULL, socktype) == 0) ++ && inet_show_netlink(f, NULL, IPPROTO_TCP) == 0) + return 0; + + /* Sigh... We have to parse /proc/net/tcp... */ +@@ -2818,6 +2818,18 @@ outerr: + } while (0); + } + ++static int dccp_show(struct filter *f) ++{ ++ if (!filter_af_get(f, AF_INET) && !filter_af_get(f, AF_INET6)) ++ return 0; ++ ++ if (!getenv("PROC_NET_DCCP") && !getenv("PROC_ROOT") ++ && inet_show_netlink(f, NULL, IPPROTO_DCCP) == 0) ++ return 0; ++ ++ return 0; ++} ++ + static int sctp_show(struct filter *f) + { + if (!filter_af_get(f, AF_INET) && !filter_af_get(f, AF_INET6)) +@@ -4368,9 +4380,9 @@ int main(int argc, char *argv[]) + if (current_filter.dbs & (1< -Date: Wed, 1 Feb 2017 14:19:26 +0100 -Subject: [PATCH] remove unnecessary extern - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1329730 -Upstream Status: iproute2.git commit 892e21248cfdb -Conflicts: Parts applied manually due to multiple context changes. - -commit 892e21248cfdb8c1332d46a01df253eae748c9d8 -Author: Stephen Hemminger -Date: Thu Aug 13 14:09:58 2015 -0700 - - remove unnecessary extern - - No need for extern on function prototypes. ---- - include/dlfcn.h | 2 +- - include/libnetlink.h | 78 +++++++++++++++++++++++++++------------------------- - include/ll_map.h | 18 ++++++------ - include/namespace.h | 6 ++-- - include/utils.h | 56 ++++++++++++++++++------------------- - 5 files changed, 82 insertions(+), 78 deletions(-) - -diff --git a/include/dlfcn.h b/include/dlfcn.h -index c54f8d8..f15bc2c 100644 ---- a/include/dlfcn.h -+++ b/include/dlfcn.h -@@ -19,7 +19,7 @@ static inline void *dlopen(const char *file, int flag) - return NULL; - } - --extern void *_dlsym(const char *sym); -+void *_dlsym(const char *sym); - static inline void *dlsym(void *handle, const char *sym) - { - if (handle != _FAKE_DLFCN_HDL) -diff --git a/include/libnetlink.h b/include/libnetlink.h -index 8c90873..40fa6ff 100644 ---- a/include/libnetlink.h -+++ b/include/libnetlink.h -@@ -26,20 +26,20 @@ struct rtnl_handle - - extern int rcvbuf; - --extern int rtnl_open(struct rtnl_handle *rth, unsigned subscriptions) -+int rtnl_open(struct rtnl_handle *rth, unsigned subscriptions) - __attribute__((warn_unused_result)); - --extern int rtnl_open_byproto(struct rtnl_handle *rth, unsigned subscriptions, -+int rtnl_open_byproto(struct rtnl_handle *rth, unsigned subscriptions, - int protocol) - __attribute__((warn_unused_result)); - --extern void rtnl_close(struct rtnl_handle *rth); --extern int rtnl_wilddump_request(struct rtnl_handle *rth, int fam, int type) -+void rtnl_close(struct rtnl_handle *rth); -+int rtnl_wilddump_request(struct rtnl_handle *rth, int fam, int type) - __attribute__((warn_unused_result)); --extern int rtnl_wilddump_req_filter(struct rtnl_handle *rth, int fam, int type, -+int rtnl_wilddump_req_filter(struct rtnl_handle *rth, int fam, int type, - __u32 filt_mask) - __attribute__((warn_unused_result)); --extern int rtnl_dump_request(struct rtnl_handle *rth, int type, void *req, -+int rtnl_dump_request(struct rtnl_handle *rth, int type, void *req, - int len) - __attribute__((warn_unused_result)); - -@@ -61,43 +61,47 @@ struct rtnl_dump_filter_arg - __u16 nc_flags; - }; - --extern int rtnl_dump_filter_l(struct rtnl_handle *rth, -+int rtnl_dump_filter_l(struct rtnl_handle *rth, - const struct rtnl_dump_filter_arg *arg); - int rtnl_dump_filter_nc(struct rtnl_handle *rth, - rtnl_filter_t filter, - void *arg, __u16 nc_flags); - #define rtnl_dump_filter(rth, filter, arg) \ - rtnl_dump_filter_nc(rth, filter, arg, 0) --extern int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, -- struct nlmsghdr *answer, size_t len) -+int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, -+ struct nlmsghdr *answer, size_t len) - __attribute__((warn_unused_result)); --extern int rtnl_send(struct rtnl_handle *rth, const void *buf, int) -+int rtnl_send(struct rtnl_handle *rth, const void *buf, int) - __attribute__((warn_unused_result)); --extern int rtnl_send_check(struct rtnl_handle *rth, const void *buf, int) -+int rtnl_send_check(struct rtnl_handle *rth, const void *buf, int) - __attribute__((warn_unused_result)); - --extern int addattr(struct nlmsghdr *n, int maxlen, int type); --extern int addattr8(struct nlmsghdr *n, int maxlen, int type, __u8 data); --extern int addattr16(struct nlmsghdr *n, int maxlen, int type, __u16 data); --extern int addattr32(struct nlmsghdr *n, int maxlen, int type, __u32 data); --extern int addattr64(struct nlmsghdr *n, int maxlen, int type, __u64 data); --extern int addattrstrz(struct nlmsghdr *n, int maxlen, int type, const char *data); -- --extern int addattr_l(struct nlmsghdr *n, int maxlen, int type, const void *data, int alen); --extern int addraw_l(struct nlmsghdr *n, int maxlen, const void *data, int len); --extern struct rtattr *addattr_nest(struct nlmsghdr *n, int maxlen, int type); --extern int addattr_nest_end(struct nlmsghdr *n, struct rtattr *nest); --extern struct rtattr *addattr_nest_compat(struct nlmsghdr *n, int maxlen, int type, const void *data, int len); --extern int addattr_nest_compat_end(struct nlmsghdr *n, struct rtattr *nest); --extern int rta_addattr32(struct rtattr *rta, int maxlen, int type, __u32 data); --extern int rta_addattr_l(struct rtattr *rta, int maxlen, int type, const void *data, int alen); -- --extern int parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int len); --extern int parse_rtattr_flags(struct rtattr *tb[], int max, struct rtattr *rta, -+int addattr(struct nlmsghdr *n, int maxlen, int type); -+int addattr8(struct nlmsghdr *n, int maxlen, int type, __u8 data); -+int addattr16(struct nlmsghdr *n, int maxlen, int type, __u16 data); -+int addattr32(struct nlmsghdr *n, int maxlen, int type, __u32 data); -+int addattr64(struct nlmsghdr *n, int maxlen, int type, __u64 data); -+int addattrstrz(struct nlmsghdr *n, int maxlen, int type, const char *data); -+ -+int addattr_l(struct nlmsghdr *n, int maxlen, int type, -+ const void *data, int alen); -+int addraw_l(struct nlmsghdr *n, int maxlen, const void *data, int len); -+struct rtattr *addattr_nest(struct nlmsghdr *n, int maxlen, int type); -+int addattr_nest_end(struct nlmsghdr *n, struct rtattr *nest); -+struct rtattr *addattr_nest_compat(struct nlmsghdr *n, int maxlen, int type, -+ const void *data, int len); -+int addattr_nest_compat_end(struct nlmsghdr *n, struct rtattr *nest); -+int rta_addattr32(struct rtattr *rta, int maxlen, int type, __u32 data); -+int rta_addattr_l(struct rtattr *rta, int maxlen, int type, -+ const void *data, int alen); -+ -+int parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int len); -+int parse_rtattr_flags(struct rtattr *tb[], int max, struct rtattr *rta, - int len, unsigned short flags); --extern int parse_rtattr_byindex(struct rtattr *tb[], int max, struct rtattr *rta, int len); --extern struct rtattr *parse_rtattr_one(int type, struct rtattr *rta, int len); --extern int __parse_rtattr_nested_compat(struct rtattr *tb[], int max, struct rtattr *rta, int len); -+int parse_rtattr_byindex(struct rtattr *tb[], int max, -+ struct rtattr *rta, int len); -+struct rtattr *parse_rtattr_one(int type, struct rtattr *rta, int len); -+int __parse_rtattr_nested_compat(struct rtattr *tb[], int max, struct rtattr *rta, int len); - - #define parse_rtattr_nested(tb, max, rta) \ - (parse_rtattr((tb), (max), RTA_DATA(rta), RTA_PAYLOAD(rta))) -@@ -132,11 +136,11 @@ static inline const char *rta_getattr_str(const struct rtattr *rta) - return (const char *)RTA_DATA(rta); - } - --extern int rtnl_listen_all_nsid(struct rtnl_handle *); --extern int rtnl_listen(struct rtnl_handle *, rtnl_listen_filter_t handler, -- void *jarg); --extern int rtnl_from_file(FILE *, rtnl_listen_filter_t handler, -- void *jarg); -+int rtnl_listen_all_nsid(struct rtnl_handle *); -+int rtnl_listen(struct rtnl_handle *, rtnl_listen_filter_t handler, -+ void *jarg); -+int rtnl_from_file(FILE *, rtnl_listen_filter_t handler, -+ void *jarg); - - #define NLMSG_TAIL(nmsg) \ - ((struct rtattr *) (((void *) (nmsg)) + NLMSG_ALIGN((nmsg)->nlmsg_len))) -diff --git a/include/ll_map.h b/include/ll_map.h -index b98a571..949bfc3 100644 ---- a/include/ll_map.h -+++ b/include/ll_map.h -@@ -1,15 +1,15 @@ - #ifndef __LL_MAP_H__ - #define __LL_MAP_H__ 1 - --extern int ll_remember_index(const struct sockaddr_nl *who, -- struct nlmsghdr *n, void *arg); -+int ll_remember_index(const struct sockaddr_nl *who, -+ struct nlmsghdr *n, void *arg); - --extern void ll_init_map(struct rtnl_handle *rth); --extern unsigned ll_name_to_index(const char *name); --extern const char *ll_index_to_name(unsigned idx); --extern const char *ll_idx_n2a(unsigned idx, char *buf); --extern int ll_index_to_type(unsigned idx); --extern int ll_index_to_flags(unsigned idx); --extern unsigned namehash(const char *str); -+void ll_init_map(struct rtnl_handle *rth); -+unsigned ll_name_to_index(const char *name); -+const char *ll_index_to_name(unsigned idx); -+const char *ll_idx_n2a(unsigned idx, char *buf); -+int ll_index_to_type(unsigned idx); -+int ll_index_to_flags(unsigned idx); -+unsigned namehash(const char *str); - - #endif /* __LL_MAP_H__ */ -diff --git a/include/namespace.h b/include/namespace.h -index 5add9d2..51324b2 100644 ---- a/include/namespace.h -+++ b/include/namespace.h -@@ -43,9 +43,9 @@ static inline int setns(int fd, int nstype) - } - #endif /* HAVE_SETNS */ - --extern int netns_switch(char *netns); --extern int netns_get_fd(const char *netns); --extern int netns_foreach(int (*func)(char *nsname, void *arg), void *arg); -+int netns_switch(char *netns); -+int netns_get_fd(const char *netns); -+int netns_foreach(int (*func)(char *nsname, void *arg), void *arg); - - struct netns_func { - int (*func)(char *nsname, void *arg); -diff --git a/include/utils.h b/include/utils.h -index 2d1e390..a1f9eb3 100644 ---- a/include/utils.h -+++ b/include/utils.h -@@ -42,7 +42,7 @@ extern bool do_all; - #define SPRINT_BSIZE 64 - #define SPRINT_BUF(x) char x[SPRINT_BSIZE] - --extern void incomplete_command(void) __attribute__((noreturn)); -+void incomplete_command(void) __attribute__((noreturn)); - - #define NEXT_ARG() do { argv++; if (--argc <= 0) incomplete_command(); } while(0) - #define NEXT_ARG_OK() (argc - 1 > 0) -@@ -77,27 +77,27 @@ struct ipx_addr { - u_int8_t ipx_node[IPX_NODE_LEN]; - }; - --extern __u32 get_addr32(const char *name); --extern int get_addr_1(inet_prefix *dst, const char *arg, int family); --extern int get_prefix_1(inet_prefix *dst, char *arg, int family); --extern int get_addr(inet_prefix *dst, const char *arg, int family); --extern int get_prefix(inet_prefix *dst, char *arg, int family); --extern int mask2bits(__u32 netmask); -+__u32 get_addr32(const char *name); -+int get_addr_1(inet_prefix *dst, const char *arg, int family); -+int get_prefix_1(inet_prefix *dst, char *arg, int family); -+int get_addr(inet_prefix *dst, const char *arg, int family); -+int get_prefix(inet_prefix *dst, char *arg, int family); -+int mask2bits(__u32 netmask); - - int get_hex(char c); --extern int get_integer(int *val, const char *arg, int base); --extern int get_unsigned(unsigned *val, const char *arg, int base); --extern int get_time_rtt(unsigned *val, const char *arg, int *raw); -+int get_integer(int *val, const char *arg, int base); -+int get_unsigned(unsigned *val, const char *arg, int base); -+int get_time_rtt(unsigned *val, const char *arg, int *raw); - #define get_byte get_u8 - #define get_ushort get_u16 - #define get_short get_s16 --extern int get_u64(__u64 *val, const char *arg, int base); --extern int get_u32(__u32 *val, const char *arg, int base); --extern int get_s32(__s32 *val, const char *arg, int base); --extern int get_u16(__u16 *val, const char *arg, int base); --extern int get_s16(__s16 *val, const char *arg, int base); --extern int get_u8(__u8 *val, const char *arg, int base); --extern int get_s8(__s8 *val, const char *arg, int base); -+int get_u64(__u64 *val, const char *arg, int base); -+int get_u32(__u32 *val, const char *arg, int base); -+int get_s32(__s32 *val, const char *arg, int base); -+int get_u16(__u16 *val, const char *arg, int base); -+int get_s16(__s16 *val, const char *arg, int base); -+int get_u8(__u8 *val, const char *arg, int base); -+int get_s8(__s8 *val, const char *arg, int base); - int get_be64(__be64 *val, const char *arg, int base); - int get_be32(__be32 *val, const char *arg, int base); - int get_be16(__be16 *val, const char *arg, int base); -@@ -105,20 +105,20 @@ int get_be16(__be16 *val, const char *arg, int base); - char *hexstring_n2a(const __u8 *str, int len, char *buf, int blen); - __u8 *hexstring_a2n(const char *str, __u8 *buf, int blen, unsigned int *len); - --extern const char *format_host(int af, int len, const void *addr, -+const char *format_host(int af, int len, const void *addr, - char *buf, int buflen); --extern const char *rt_addr_n2a(int af, int len, const void *addr, -+const char *rt_addr_n2a(int af, int len, const void *addr, - char *buf, int buflen); - --extern int read_family(const char *name); --extern const char *family_name(int family); -+int read_family(const char *name); -+const char *family_name(int family); - - void missarg(const char *) __attribute__((noreturn)); - void invarg(const char *, const char *) __attribute__((noreturn)); - void duparg(const char *, const char *) __attribute__((noreturn)); - void duparg2(const char *, const char *) __attribute__((noreturn)); - int matches(const char *arg, const char *pattern); --extern int inet_addr_match(const inet_prefix *a, const inet_prefix *b, int bits); -+int inet_addr_match(const inet_prefix *a, const inet_prefix *b, int bits); - - const char *dnet_ntop(int af, const void *addr, char *str, size_t len); - int dnet_pton(int af, const char *src, void *addr); -@@ -127,7 +127,7 @@ const char *ipx_ntop(int af, const void *addr, char *str, size_t len); - int ipx_pton(int af, const char *src, void *addr); - - extern int __iproute2_hz_internal; --extern int __get_hz(void); -+__get_hz(void); - - static __inline__ int get_hz(void) - { -@@ -137,7 +137,7 @@ static __inline__ int get_hz(void) - } - - extern int __iproute2_user_hz_internal; --extern int __get_user_hz(void); -+int __get_user_hz(void); - - static __inline__ int get_user_hz(void) - { -@@ -164,16 +164,16 @@ int print_timestamp(FILE *fp); - #define ntohll(x) ((1==ntohl(1)) ? (x) : ((uint64_t)ntohl((x) & 0xFFFFFFFF) << 32) | ntohl((x) >> 32)) - - extern int cmdlineno; --extern ssize_t getcmdline(char **line, size_t *len, FILE *in); --extern int makeargs(char *line, char *argv[], int maxargs); --extern int inet_get_addr(const char *src, __u32 *dst, struct in6_addr *dst6); -+ssize_t getcmdline(char **line, size_t *len, FILE *in); -+int makeargs(char *line, char *argv[], int maxargs); -+int inet_get_addr(const char *src, __u32 *dst, struct in6_addr *dst6); - - struct iplink_req; - int iplink_parse(int argc, char **argv, struct iplink_req *req, - char **name, char **type, char **link, char **dev, - int *group); - --extern int do_each_netns(int (*func)(char *nsname, void *arg), void *arg, -+int do_each_netns(int (*func)(char *nsname, void *arg), void *arg, - bool show_label); - - char *int_to_str(int val, char *buf); --- -1.8.3.1 - diff --git a/SOURCES/0007-tc-simple.8-Fix-reference-to-non-existing-tc-actions.patch b/SOURCES/0007-tc-simple.8-Fix-reference-to-non-existing-tc-actions.patch new file mode 100644 index 0000000..9028079 --- /dev/null +++ b/SOURCES/0007-tc-simple.8-Fix-reference-to-non-existing-tc-actions.patch @@ -0,0 +1,31 @@ +From 4917021d1ebea2b75cdcf31272452aa5cc3ff7ec Mon Sep 17 00:00:00 2001 +From: Phil Sutter +Date: Fri, 1 Sep 2017 13:05:45 +0200 +Subject: [PATCH] tc-simple.8: Fix reference to non-existing tc-actions.8 + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1477523 +Upstream Status: RHEL-only + +The referenced man page doesn't exist in RHEL iproute package, so better +refer to an existing one which also contains the CONTROL value +description. +--- + man/man8/tc-simple.8 | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/man/man8/tc-simple.8 b/man/man8/tc-simple.8 +index 7363ab5..a0deb0b 100644 +--- a/man/man8/tc-simple.8 ++++ b/man/man8/tc-simple.8 +@@ -36,7 +36,7 @@ Indicate how + should proceed after executing the action. For a description of the possible + .I CONTROL + values, see +-.BR tc-actions (8). ++.BR tc-pedit (8). + .SH EXAMPLES + The following example makes the kernel yell "Incoming ICMP!" every time it sees + an incoming ICMP on eth0. Steps are: +-- +1.8.3.1 + diff --git a/SOURCES/0008-lib-bpf-Fix-bytecode-file-parsing.patch b/SOURCES/0008-lib-bpf-Fix-bytecode-file-parsing.patch new file mode 100644 index 0000000..f9247d7 --- /dev/null +++ b/SOURCES/0008-lib-bpf-Fix-bytecode-file-parsing.patch @@ -0,0 +1,74 @@ +From 584ca9f67952162dfdd02d984aa12640e45a4235 Mon Sep 17 00:00:00 2001 +From: Phil Sutter +Date: Wed, 6 Sep 2017 11:53:53 +0200 +Subject: [PATCH] lib/bpf: Fix bytecode-file parsing + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1477491 +Upstream Status: iproute2.git commit 7c87c7fed18d1 + +commit 7c87c7fed18d1162e045c8331cb68fa440bc5728 +Author: Phil Sutter +Date: Tue Aug 29 17:09:45 2017 +0200 + + lib/bpf: Fix bytecode-file parsing + + The signedness of char type is implementation dependent, and there are + architectures on which it is unsigned by default. In that case, the + check whether fgetc() returned EOF failed because the return value was + assigned an (unsigned) char variable prior to comparison with EOF (which + is defined to -1). Fix this by using int as type for 'c' variable, which + also matches the declaration of fgetc(). + + While being at it, fix the parser logic to correctly handle multiple + empty lines and consecutive whitespace and tab characters to further + improve the parser's robustness. Note that this will still detect double + separator characters, so doesn't soften up the parser too much. + + Fixes: 3da3ebfca85b8 ("bpf: Make bytecode-file reading a little more robust") + Cc: Daniel Borkmann + Signed-off-by: Phil Sutter + Acked-by: Daniel Borkmann +--- + lib/bpf.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/lib/bpf.c b/lib/bpf.c +index 73dac5c..3aabf44 100644 +--- a/lib/bpf.c ++++ b/lib/bpf.c +@@ -160,8 +160,9 @@ static int bpf_parse_string(char *arg, bool from_file, __u16 *bpf_len, + + if (from_file) { + size_t tmp_len, op_len = sizeof("65535 255 255 4294967295,"); +- char *tmp_string, *pos, c, c_prev = ' '; ++ char *tmp_string, *pos, c_prev = ' '; + FILE *fp; ++ int c; + + tmp_len = sizeof("4096,") + BPF_MAXINSNS * op_len; + tmp_string = pos = calloc(1, tmp_len); +@@ -180,18 +181,20 @@ static int bpf_parse_string(char *arg, bool from_file, __u16 *bpf_len, + case '\n': + if (c_prev != ',') + *(pos++) = ','; ++ c_prev = ','; + break; + case ' ': + case '\t': + if (c_prev != ' ') + *(pos++) = c; ++ c_prev = ' '; + break; + default: + *(pos++) = c; ++ c_prev = c; + } + if (pos - tmp_string == tmp_len) + break; +- c_prev = c; + } + + if (!feof(fp)) { +-- +1.8.3.1 + diff --git a/SOURCES/0008-utils-add-missing-return-value.patch b/SOURCES/0008-utils-add-missing-return-value.patch deleted file mode 100644 index 42e231a..0000000 --- a/SOURCES/0008-utils-add-missing-return-value.patch +++ /dev/null @@ -1,37 +0,0 @@ -From d3fb2ca3d65e566e11c6016f7832dd5f251a7715 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Wed, 1 Feb 2017 14:20:10 +0100 -Subject: [PATCH] utils: add missing return value - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1329730 -Upstream Status: iproute2.git commit e3c27c2db68d2 - -commit e3c27c2db68d2dc0e9816fd70d80fda7f9aea2ec -Author: Zhang Shengju -Date: Fri Aug 14 01:36:20 2015 +0000 - - utils: add missing return value - - Add missing return value to fix warnings - - Signed-off-by: Zhang Shengju ---- - include/utils.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/include/utils.h b/include/utils.h -index a1f9eb3..6634f66 100644 ---- a/include/utils.h -+++ b/include/utils.h -@@ -127,7 +127,7 @@ const char *ipx_ntop(int af, const void *addr, char *str, size_t len); - int ipx_pton(int af, const char *src, void *addr); - - extern int __iproute2_hz_internal; --__get_hz(void); -+int __get_hz(void); - - static __inline__ int get_hz(void) - { --- -1.8.3.1 - diff --git a/SOURCES/0009-libnetlink-introduce-rta_nest-and-u8-u16-u64-helpers.patch b/SOURCES/0009-libnetlink-introduce-rta_nest-and-u8-u16-u64-helpers.patch deleted file mode 100644 index 2e1fe54..0000000 --- a/SOURCES/0009-libnetlink-introduce-rta_nest-and-u8-u16-u64-helpers.patch +++ /dev/null @@ -1,102 +0,0 @@ -From ff021313a4175ec85193c25551698e58e85e86e0 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Wed, 1 Feb 2017 14:20:11 +0100 -Subject: [PATCH] libnetlink: introduce rta_nest and u8, u16, u64 helpers for - nesting within rtattr - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1329730 -Upstream Status: iproute2.git commit 303cc9cbeed6c - -commit 303cc9cbeed6cfb9f08a4073f07cb466cc8098e8 -Author: Roopa Prabhu -Date: Thu Oct 15 13:13:38 2015 +0200 - - libnetlink: introduce rta_nest and u8, u16, u64 helpers for nesting within rtattr - - This patch introduces two new api's rta_nest and rta_nest_end to - nest attributes inside a rta attribute represented by 'struct rtattr' - as required to construct a nexthop. Also adds rta_addattr* variants - for u8, u16 and u64 as needed to support encapsulation. - - Signed-off-by: Roopa Prabhu - Signed-off-by: Thomas Graf - Acked-by: Jiri Benc ---- - include/libnetlink.h | 10 ++++++++++ - lib/libnetlink.c | 31 +++++++++++++++++++++++++++++++ - 2 files changed, 41 insertions(+) - -diff --git a/include/libnetlink.h b/include/libnetlink.h -index 40fa6ff..7ea3f4a 100644 ---- a/include/libnetlink.h -+++ b/include/libnetlink.h -@@ -91,7 +91,10 @@ int addattr_nest_end(struct nlmsghdr *n, struct rtattr *nest); - struct rtattr *addattr_nest_compat(struct nlmsghdr *n, int maxlen, int type, - const void *data, int len); - int addattr_nest_compat_end(struct nlmsghdr *n, struct rtattr *nest); -+int rta_addattr8(struct rtattr *rta, int maxlen, int type, __u8 data); -+int rta_addattr16(struct rtattr *rta, int maxlen, int type, __u16 data); - int rta_addattr32(struct rtattr *rta, int maxlen, int type, __u32 data); -+int rta_addattr64(struct rtattr *rta, int maxlen, int type, __u64 data); - int rta_addattr_l(struct rtattr *rta, int maxlen, int type, - const void *data, int alen); - -@@ -103,6 +106,13 @@ int parse_rtattr_byindex(struct rtattr *tb[], int max, - struct rtattr *parse_rtattr_one(int type, struct rtattr *rta, int len); - int __parse_rtattr_nested_compat(struct rtattr *tb[], int max, struct rtattr *rta, int len); - -+struct rtattr *rta_nest(struct rtattr *rta, int maxlen, int type); -+int rta_nest_end(struct rtattr *rta, struct rtattr *nest); -+ -+#define RTA_TAIL(rta) \ -+ ((struct rtattr *) (((void *) (rta)) + \ -+ RTA_ALIGN((rta)->rta_len))) -+ - #define parse_rtattr_nested(tb, max, rta) \ - (parse_rtattr((tb), (max), RTA_DATA(rta), RTA_PAYLOAD(rta))) - -diff --git a/lib/libnetlink.c b/lib/libnetlink.c -index 96bde59..9e653cc 100644 ---- a/lib/libnetlink.c -+++ b/lib/libnetlink.c -@@ -723,6 +723,37 @@ int rta_addattr_l(struct rtattr *rta, int maxlen, int type, - return 0; - } - -+int rta_addattr8(struct rtattr *rta, int maxlen, int type, __u8 data) -+{ -+ return rta_addattr_l(rta, maxlen, type, &data, sizeof(__u8)); -+} -+ -+int rta_addattr16(struct rtattr *rta, int maxlen, int type, __u16 data) -+{ -+ return rta_addattr_l(rta, maxlen, type, &data, sizeof(__u16)); -+} -+ -+int rta_addattr64(struct rtattr *rta, int maxlen, int type, __u64 data) -+{ -+ return rta_addattr_l(rta, maxlen, type, &data, sizeof(__u64)); -+} -+ -+struct rtattr *rta_nest(struct rtattr *rta, int maxlen, int type) -+{ -+ struct rtattr *nest = RTA_TAIL(rta); -+ -+ rta_addattr_l(rta, maxlen, type, NULL, 0); -+ -+ return nest; -+} -+ -+int rta_nest_end(struct rtattr *rta, struct rtattr *nest) -+{ -+ nest->rta_len = (void *)RTA_TAIL(rta) - (void *)nest; -+ -+ return rta->rta_len; -+} -+ - int parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int len) - { - return parse_rtattr_flags(tb, max, rta, len, 0); --- -1.8.3.1 - diff --git a/SOURCES/0009-tc-simple.8-Fix-one-more-reference-to-non-existing-t.patch b/SOURCES/0009-tc-simple.8-Fix-one-more-reference-to-non-existing-t.patch new file mode 100644 index 0000000..4ce8185 --- /dev/null +++ b/SOURCES/0009-tc-simple.8-Fix-one-more-reference-to-non-existing-t.patch @@ -0,0 +1,27 @@ +From 3905b2d8f676601c022804d197be9165dacff11c Mon Sep 17 00:00:00 2001 +From: Phil Sutter +Date: Wed, 6 Sep 2017 15:44:19 +0200 +Subject: [PATCH] tc-simple.8: Fix one more reference to non-existing + tc-actions.8 + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1477523 +Upstream Status: RHEL-only + +Previous fix missed to update the SEE ALSO section as well. +--- + man/man8/tc-simple.8 | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/man/man8/tc-simple.8 b/man/man8/tc-simple.8 +index a0deb0b..beab313 100644 +--- a/man/man8/tc-simple.8 ++++ b/man/man8/tc-simple.8 +@@ -96,4 +96,4 @@ display stats again and observe increment by 1 + .EE + .SH SEE ALSO + .BR tc (8) +-.BR tc-actions (8) ++.BR tc-pedit (8) +-- +1.8.3.1 + diff --git a/SOURCES/0010-tc-m_xt-Prevent-a-segfault-in-libipt.patch b/SOURCES/0010-tc-m_xt-Prevent-a-segfault-in-libipt.patch new file mode 100644 index 0000000..253d00f --- /dev/null +++ b/SOURCES/0010-tc-m_xt-Prevent-a-segfault-in-libipt.patch @@ -0,0 +1,49 @@ +From 074062808c630f2efb55c7093d510b44a38e74e5 Mon Sep 17 00:00:00 2001 +From: Phil Sutter +Date: Thu, 14 Sep 2017 15:27:47 +0200 +Subject: [PATCH] tc: m_xt: Prevent a segfault in libipt + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1465599 +Upstream Status: iproute2.git commit f6fc1055e41a8 + +commit f6fc1055e41a8a924313c336b39b9ffe0c86938b +Author: Phil Sutter +Date: Tue May 23 15:40:57 2017 +0200 + + tc: m_xt: Prevent a segfault in libipt + + This happens with NAT targets, such as SNAT, DNAT and MASQUERADE. These + are still not usable with this patch, but at least tc doesn't crash + anymore when one tries to use them. + + Signed-off-by: Phil Sutter +--- + tc/m_xt.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/tc/m_xt.c b/tc/m_xt.c +index e59df8e..ad52d23 100644 +--- a/tc/m_xt.c ++++ b/tc/m_xt.c +@@ -146,6 +146,9 @@ static int parse_ipt(struct action_util *a, int *argc_p, + char ***argv_p, int tca_id, struct nlmsghdr *n) + { + struct xtables_target *m = NULL; ++#if XTABLES_VERSION_CODE >= 6 ++ struct ipt_entry fw = {}; ++#endif + struct rtattr *tail; + + int c; +@@ -206,7 +209,7 @@ static int parse_ipt(struct action_util *a, int *argc_p, + default: + #if XTABLES_VERSION_CODE >= 6 + if (m != NULL && m->x6_parse != NULL) { +- xtables_option_tpcall(c, argv, 0, m, NULL); ++ xtables_option_tpcall(c, argv, 0, m, &fw); + #else + if (m != NULL && m->parse != NULL) { + m->parse(c - m->option_offset, argv, 0, +-- +1.8.3.1 + diff --git a/SOURCES/0011-link_gre6-really-support-encaplimit-option.patch b/SOURCES/0011-link_gre6-really-support-encaplimit-option.patch new file mode 100644 index 0000000..5a6eefa --- /dev/null +++ b/SOURCES/0011-link_gre6-really-support-encaplimit-option.patch @@ -0,0 +1,51 @@ +From 2db276543a03633a61ba0815a01c8bb2846830ab Mon Sep 17 00:00:00 2001 +From: Phil Sutter +Date: Thu, 14 Sep 2017 15:30:37 +0200 +Subject: [PATCH] link_gre6: really support encaplimit option + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1459600 +Upstream Status: iproute2.git commit a11b7b71a6eba +Conflicts: Context change due to missing commit ad4b1425c3182 + ("iplink: Expose IFLA_*_FWMARK attributes for supported link + types"). + +commit a11b7b71a6eba4ee80e931e4f75321a0cf0116f1 +Author: Nicolas Dichtel +Date: Wed Jun 14 18:45:42 2017 +0200 + + link_gre6: really support encaplimit option + + This option is documented in gre6 help, but was not supported. + + Fixes: af89576d7a8c ("iproute2: GRE over IPv6 tunnel support.") + Signed-off-by: Nicolas Dichtel +--- + ip/link_gre6.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/ip/link_gre6.c b/ip/link_gre6.c +index 1b4fb05..76416b2 100644 +--- a/ip/link_gre6.c ++++ b/ip/link_gre6.c +@@ -339,6 +339,18 @@ get_failed: + encapflags |= TUNNEL_ENCAP_FLAG_REMCSUM; + } else if (strcmp(*argv, "noencap-remcsum") == 0) { + encapflags &= ~TUNNEL_ENCAP_FLAG_REMCSUM; ++ } else if (strcmp(*argv, "encaplimit") == 0) { ++ NEXT_ARG(); ++ if (strcmp(*argv, "none") == 0) { ++ flags |= IP6_TNL_F_IGN_ENCAP_LIMIT; ++ } else { ++ __u8 uval; ++ ++ if (get_u8(&uval, *argv, 0) < -1) ++ invarg("invalid ELIM", *argv); ++ encap_limit = uval; ++ flags &= ~IP6_TNL_F_IGN_ENCAP_LIMIT; ++ } + } else + usage(); + argc--; argv++; +-- +1.8.3.1 + diff --git a/SOURCES/0012-tc-fix-typo-in-manpage.patch b/SOURCES/0012-tc-fix-typo-in-manpage.patch new file mode 100644 index 0000000..6041fbe --- /dev/null +++ b/SOURCES/0012-tc-fix-typo-in-manpage.patch @@ -0,0 +1,40 @@ +From beb8e1aa7ed08f86fb87ff58f7c69aaa2b68b862 Mon Sep 17 00:00:00 2001 +From: Phil Sutter +Date: Thu, 14 Sep 2017 15:38:46 +0200 +Subject: [PATCH] tc: fix typo in manpage + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417162 +Upstream Status: iproute2.git commit b09515553fded + +commit b09515553fded944713955815a3f1cc855384abd +Author: Matteo Croce +Date: Fri Jul 7 15:08:33 2017 +0200 + + tc: fix typo in manpage + + Fix a typo in the 'tc' manpage and reword some sentences. + + Signed-off-by: Matteo Croce +--- + man/man8/tc-csum.8 | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/man/man8/tc-csum.8 b/man/man8/tc-csum.8 +index 718301d..409ab71 100644 +--- a/man/man8/tc-csum.8 ++++ b/man/man8/tc-csum.8 +@@ -29,9 +29,9 @@ csum - checksum update action + The + .B csum + action triggers checksum recalculation of specified packet headers. It is +-commonly used after packet editing using the ++commonly used to fix incorrect checksums after the + .B pedit +-action to fix for then incorrect checksums. ++action has modified the packet content. + .SH OPTIONS + .TP + .I TARGET +-- +1.8.3.1 + diff --git a/SOURCES/0013-ip-neigh-allow-flush-FAILED-neighbour-entry.patch b/SOURCES/0013-ip-neigh-allow-flush-FAILED-neighbour-entry.patch new file mode 100644 index 0000000..ed4b410 --- /dev/null +++ b/SOURCES/0013-ip-neigh-allow-flush-FAILED-neighbour-entry.patch @@ -0,0 +1,52 @@ +From 3b6fd8227cbb03b5b211d2cb53534ad405673668 Mon Sep 17 00:00:00 2001 +From: Matteo Croce +Date: Wed, 2 Aug 2017 13:57:17 +0200 +Subject: [PATCH] ip neigh: allow flush FAILED neighbour entry + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1469945 +Tested: locally using proper reproducer +Upstream Status: merged 37a5f7c5 + +commit 37a5f7c571623059ae671992f72feaa444a6ffc8 +Author: Hangbin Liu +Date: Fri Jun 16 11:31:52 2017 +0800 + + ip neigh: allow flush FAILED neighbour entry + + After upstream commit 5071034e4af7 ('neigh: Really delete an arp/neigh entry + on "ip neigh delete" or "arp -d"'), we could delete a single FAILED neighbour + entry now. But `ip neigh flush` still skip the FAILED entry. + + Move the filter after first round flush so we can flush FAILED entry on fixed + kernel and also do not keep retrying on old kernel. + + Signed-off-by: Hangbin Liu + +Signed-off-by: Matteo Croce +--- + ip/ipneigh.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ip/ipneigh.c b/ip/ipneigh.c +index 4d8fc85..9c38a60 100644 +--- a/ip/ipneigh.c ++++ b/ip/ipneigh.c +@@ -445,7 +445,6 @@ static int do_show_or_flush(int argc, char **argv, int flush) + filter.flushb = flushb; + filter.flushp = 0; + filter.flushe = sizeof(flushb); +- filter.state &= ~NUD_FAILED; + + while (round < MAX_ROUNDS) { + if (rtnl_dump_request_n(&rth, &req.n) < 0) { +@@ -474,6 +473,7 @@ static int do_show_or_flush(int argc, char **argv, int flush) + printf("\n*** Round %d, deleting %d entries ***\n", round, filter.flushed); + fflush(stdout); + } ++ filter.state &= ~NUD_FAILED; + } + printf("*** Flush not complete bailing out after %d rounds\n", + MAX_ROUNDS); +-- +1.8.3.1 + diff --git a/SOURCES/0014-netns-avoid-directory-traversal.patch b/SOURCES/0014-netns-avoid-directory-traversal.patch new file mode 100644 index 0000000..fc03b02 --- /dev/null +++ b/SOURCES/0014-netns-avoid-directory-traversal.patch @@ -0,0 +1,58 @@ +From 74061958f56a4626a3a146c72f16e43012e828f1 Mon Sep 17 00:00:00 2001 +From: Phil Sutter +Date: Thu, 14 Sep 2017 15:39:23 +0200 +Subject: [PATCH] netns: avoid directory traversal + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1468529 +Upstream Status: iproute2.git commit 79928fd0552b5 + +commit 79928fd0552b520aa36a22e71144d10a32f7e4fe +Author: Matteo Croce +Date: Thu Jul 20 00:36:32 2017 +0200 + + netns: avoid directory traversal + + ip netns keeps track of created namespaces with bind mounts named + /var/run/netns/. No input sanitization is done, allowing creation and + deletion of files relatives to /var/run/netns or, if the path is non existent or + invalid, allows to create "untracked" namespaces (invisible to the tool). + + This commit denies creation or deletion of namespaces with names contaning + "/" or matching exactly "." or "..". + + Signed-off-by: Matteo Croce +--- + ip/ipnetns.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/ip/ipnetns.c b/ip/ipnetns.c +index 0b0378a..4254994 100644 +--- a/ip/ipnetns.c ++++ b/ip/ipnetns.c +@@ -766,6 +766,11 @@ static int netns_monitor(int argc, char **argv) + return 0; + } + ++static int invalid_name(const char *name) ++{ ++ return strchr(name, '/') || !strcmp(name, ".") || !strcmp(name, ".."); ++} ++ + int do_netns(int argc, char **argv) + { + netns_nsid_socket_init(); +@@ -775,6 +780,11 @@ int do_netns(int argc, char **argv) + return netns_list(0, NULL); + } + ++ if (argc > 1 && invalid_name(argv[1])) { ++ fprintf(stderr, "Invalid netns name \"%s\"\n", argv[1]); ++ exit(-1); ++ } ++ + if ((matches(*argv, "list") == 0) || (matches(*argv, "show") == 0) || + (matches(*argv, "lst") == 0)) { + netns_map_init(); +-- +1.8.3.1 + diff --git a/SOURCES/0015-ip-route-Prevent-some-double-spaces-in-output.patch b/SOURCES/0015-ip-route-Prevent-some-double-spaces-in-output.patch deleted file mode 100644 index 456db19..0000000 --- a/SOURCES/0015-ip-route-Prevent-some-double-spaces-in-output.patch +++ /dev/null @@ -1,77 +0,0 @@ -From 7913342bac7907f849ee6af7abeba2e30a1c0c46 Mon Sep 17 00:00:00 2001 -From: Timothy Redaelli -Date: Fri, 10 Feb 2017 12:20:19 +0100 -Subject: [PATCH] ip-route: Prevent some double spaces in output - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1374446 -Upstream Status: iproute2.git commit 7cc7cb8 -Conflicts: Context changes due to missing commits - bc23430, 7faf1588 and 56f5daac - -commit 7cc7cb8a888bf50c4e118b6bce4c6926321d0689 -Author: Phil Sutter -Date: Tue Aug 23 11:52:45 2016 +0200 - - ip-route: Prevent some double spaces in output - - The code is a bit messy, as it starts with space after text and at some - point switches to space before text. But either way, printing space - before *and* after text almost certainly leads to printing more - whitespace than necessary. - - Signed-off-by: Phil Sutter - -Signed-off-by: Timothy Redaelli ---- - ip/iproute.c | 14 +++++++------- - 1 file changed, 7 insertions(+), 7 deletions(-) - -diff --git a/ip/iproute.c b/ip/iproute.c -index bb18bbe..8a706ea 100644 ---- a/ip/iproute.c -+++ b/ip/iproute.c -@@ -414,24 +414,24 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - - if (!(r->rtm_flags&RTM_F_CLONED)) { - if (table != RT_TABLE_MAIN && !filter.tb) -- fprintf(fp, " table %s ", rtnl_rttable_n2a(table, b1, sizeof(b1))); -+ fprintf(fp, "table %s ", rtnl_rttable_n2a(table, b1, sizeof(b1))); - if (r->rtm_protocol != RTPROT_BOOT && filter.protocolmask != -1) -- fprintf(fp, " proto %s ", rtnl_rtprot_n2a(r->rtm_protocol, b1, sizeof(b1))); -+ fprintf(fp, "proto %s ", rtnl_rtprot_n2a(r->rtm_protocol, b1, sizeof(b1))); - if (r->rtm_scope != RT_SCOPE_UNIVERSE && filter.scopemask != -1) -- fprintf(fp, " scope %s ", rtnl_rtscope_n2a(r->rtm_scope, b1, sizeof(b1))); -+ fprintf(fp, "scope %s ", rtnl_rtscope_n2a(r->rtm_scope, b1, sizeof(b1))); - } - if (tb[RTA_PREFSRC] && filter.rprefsrc.bitlen != host_len) { - /* Do not use format_host(). It is our local addr - and symbolic name will not be useful. - */ -- fprintf(fp, " src %s ", -+ fprintf(fp, "src %s ", - rt_addr_n2a(r->rtm_family, - RTA_PAYLOAD(tb[RTA_PREFSRC]), - RTA_DATA(tb[RTA_PREFSRC]), - abuf, sizeof(abuf))); - } - if (tb[RTA_PRIORITY]) -- fprintf(fp, " metric %u ", rta_getattr_u32(tb[RTA_PRIORITY])); -+ fprintf(fp, "metric %u ", rta_getattr_u32(tb[RTA_PRIORITY])); - if (r->rtm_flags & RTNH_F_DEAD) - fprintf(fp, "dead "); - if (r->rtm_flags & RTNH_F_ONLINK) -@@ -444,9 +444,9 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - unsigned int mark = *(unsigned int*)RTA_DATA(tb[RTA_MARK]); - if (mark) { - if (mark >= 16) -- fprintf(fp, " mark 0x%x", mark); -+ fprintf(fp, "mark 0x%x", mark); - else -- fprintf(fp, " mark %u", mark); -+ fprintf(fp, "mark %u", mark); - } - } - --- -1.8.3.1 - diff --git a/SOURCES/0015-utils-return-default-family-when-rtm_family-is-not-R.patch b/SOURCES/0015-utils-return-default-family-when-rtm_family-is-not-R.patch new file mode 100644 index 0000000..5d59c09 --- /dev/null +++ b/SOURCES/0015-utils-return-default-family-when-rtm_family-is-not-R.patch @@ -0,0 +1,58 @@ +From 420957e4c56f65703c6f2f24da0ea35c6b7bbcda Mon Sep 17 00:00:00 2001 +From: Stefano Brivio +Date: Thu, 27 Jul 2017 21:52:30 +0200 +Subject: [PATCH] utils: return default family when rtm_family is not + RTNL_FAMILY_IPMR/IP6MR + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1475762 +Upstream Status: iproute2.git commit 5ce897a03bfd + +commit 5ce897a03bfda76dc66dc1acfa014fc0e3d3022a +Author: Hangbin Liu +Date: Thu Jul 27 17:44:15 2017 +0800 + + utils: return default family when rtm_family is not RTNL_FAMILY_IPMR/IP6MR + + When we get a multicast route, the rtm_type is RTN_MULTICAST, but the + rtm_family may be AF_INET. If we only check the type with RTNL_FAMILY_IPMR, + we will get malformed address. e.g. + + + ip -4 route add multicast 172.111.1.1 dev em1 table main + + Before fix: + + ip route list type multicast table main + multicast ac6f:101:800:400:400:0:3c00:0 dev em1 scope link + + After fix: + + ip route list type multicast table main + multicast 172.111.1.1 dev em1 scope link + + Fixes: 56e3eb4c3400 ("ip: route: fix multicast route dumps") + Signed-off-by: Hangbin Liu + Acked-by: Phil Sutter + +Signed-off-by: Stefano Brivio +--- + lib/utils.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/lib/utils.c b/lib/utils.c +index 7d6ee53..9f55391 100644 +--- a/lib/utils.c ++++ b/lib/utils.c +@@ -1219,5 +1219,11 @@ int get_real_family(int rtm_type, int rtm_family) + if (rtm_type != RTN_MULTICAST) + return rtm_family; + +- return rtm_family == RTNL_FAMILY_IPMR ? AF_INET : AF_INET6; ++ if (rtm_family == RTNL_FAMILY_IPMR) ++ return AF_INET; ++ ++ if (rtm_family == RTNL_FAMILY_IP6MR) ++ return AF_INET6; ++ ++ return rtm_family; + } +-- +1.8.3.1 + diff --git a/SOURCES/0016-ipaddress-Simplify-vf_info-parsing.patch b/SOURCES/0016-ipaddress-Simplify-vf_info-parsing.patch deleted file mode 100644 index 21830d6..0000000 --- a/SOURCES/0016-ipaddress-Simplify-vf_info-parsing.patch +++ /dev/null @@ -1,113 +0,0 @@ -From 50d1b124825f1900937b5fc9a9075890bfd3c2c3 Mon Sep 17 00:00:00 2001 -From: Timothy Redaelli -Date: Thu, 9 Feb 2017 18:55:28 +0100 -Subject: [PATCH] ipaddress: Simplify vf_info parsing - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1264149 -Upstream Status: iproute2.git commit ff9463e -Conflicts: Context changes due to missing commit 56e9f0a - -commit ff9463e048a55d1262869ef6f6897c44c11fe094 -Author: Phil Sutter -Date: Tue Nov 8 22:29:11 2016 +0100 - - ipaddress: Simplify vf_info parsing - - Commit 7b8179c780a1a ("iproute2: Add new command to ip link to - enable/disable VF spoof check") tried to add support for - IFLA_VF_SPOOFCHK in a backwards-compatible manner, but aparently overdid - it: parse_rtattr_nested() handles missing attributes perfectly fine in - that it will leave the relevant field unassigned so calling code can - just compare against NULL. There is no need to layback from the previous - (IFLA_VF_TX_RATE) attribute to the next to check if IFLA_VF_SPOOFCHK is - present or not. To the contrary, it establishes a potentially incorrect - assumption of these two attributes directly following each other which - may not be the case (although up to now, kernel aligns them this way). - - This patch cleans up the code to adhere to the common way of checking - for attribute existence. It has been tested to return correct results - regardless of whether the kernel exports IFLA_VF_SPOOFCHK or not. - - Signed-off-by: Phil Sutter - Reviewed-by: Greg Rose - -Signed-off-by: Timothy Redaelli ---- - ip/ipaddress.c | 44 ++++++++++---------------------------------- - 1 file changed, 10 insertions(+), 34 deletions(-) - -diff --git a/ip/ipaddress.c b/ip/ipaddress.c -index 62a25bc..c8ec779 100644 ---- a/ip/ipaddress.c -+++ b/ip/ipaddress.c -@@ -291,10 +291,7 @@ static void print_vfinfo(FILE *fp, struct rtattr *vfinfo) - struct ifla_vf_mac *vf_mac; - struct ifla_vf_vlan *vf_vlan; - struct ifla_vf_tx_rate *vf_tx_rate; -- struct ifla_vf_spoofchk *vf_spoofchk; -- struct ifla_vf_link_state *vf_linkstate; - struct rtattr *vf[IFLA_VF_MAX + 1] = {}; -- struct rtattr *tmp; - SPRINT_BUF(b1); - - if (vfinfo->rta_type != IFLA_VF_INFO) { -@@ -308,31 +305,6 @@ static void print_vfinfo(FILE *fp, struct rtattr *vfinfo) - vf_vlan = RTA_DATA(vf[IFLA_VF_VLAN]); - vf_tx_rate = RTA_DATA(vf[IFLA_VF_TX_RATE]); - -- /* Check if the spoof checking vf info type is supported by -- * this kernel. -- */ -- tmp = (struct rtattr *)((char *)vf[IFLA_VF_TX_RATE] + -- vf[IFLA_VF_TX_RATE]->rta_len); -- -- if (tmp->rta_type != IFLA_VF_SPOOFCHK) -- vf_spoofchk = NULL; -- else -- vf_spoofchk = RTA_DATA(vf[IFLA_VF_SPOOFCHK]); -- -- if (vf_spoofchk) { -- /* Check if the link state vf info type is supported by -- * this kernel. -- */ -- tmp = (struct rtattr *)((char *)vf[IFLA_VF_SPOOFCHK] + -- vf[IFLA_VF_SPOOFCHK]->rta_len); -- -- if (tmp->rta_type != IFLA_VF_LINK_STATE) -- vf_linkstate = NULL; -- else -- vf_linkstate = RTA_DATA(vf[IFLA_VF_LINK_STATE]); -- } else -- vf_linkstate = NULL; -- - fprintf(fp, "%s vf %d MAC %s", _SL_, vf_mac->vf, - ll_addr_n2a((unsigned char *)&vf_mac->mac, - ETH_ALEN, 0, b1, sizeof(b1))); -@@ -351,14 +323,18 @@ static void print_vfinfo(FILE *fp, struct rtattr *vfinfo) - if (vf_rate->min_tx_rate) - fprintf(fp, ", min_tx_rate %dMbps", vf_rate->min_tx_rate); - } -+ if (vf[IFLA_VF_SPOOFCHK]) { -+ struct ifla_vf_spoofchk *vf_spoofchk = -+ RTA_DATA(vf[IFLA_VF_SPOOFCHK]); - -- if (vf_spoofchk && vf_spoofchk->setting != -1) { -- if (vf_spoofchk->setting) -- fprintf(fp, ", spoof checking on"); -- else -- fprintf(fp, ", spoof checking off"); -+ if (vf_spoofchk->setting != -1) -+ fprintf(fp, ", spoof checking %s", -+ vf_spoofchk->setting ? "on" : "off"); - } -- if (vf_linkstate) { -+ if (vf[IFLA_VF_LINK_STATE]) { -+ struct ifla_vf_link_state *vf_linkstate = -+ RTA_DATA(vf[IFLA_VF_LINK_STATE]); -+ - if (vf_linkstate->link_state == IFLA_VF_LINK_STATE_AUTO) - fprintf(fp, ", link-state auto"); - else if (vf_linkstate->link_state == IFLA_VF_LINK_STATE_ENABLE) --- -1.8.3.1 - diff --git a/SOURCES/0016-link_gre6-Fix-for-changing-tclass-flowlabel.patch b/SOURCES/0016-link_gre6-Fix-for-changing-tclass-flowlabel.patch new file mode 100644 index 0000000..f098bbe --- /dev/null +++ b/SOURCES/0016-link_gre6-Fix-for-changing-tclass-flowlabel.patch @@ -0,0 +1,49 @@ +From 449517f7769dde4905564ce17e126bfd4e1f7147 Mon Sep 17 00:00:00 2001 +From: Phil Sutter +Date: Fri, 6 Oct 2017 17:27:09 +0200 +Subject: [PATCH] link_gre6: Fix for changing tclass/flowlabel + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1487486 +Upstream Status: iproute2.git commit e7fefb3214b5a + +commit e7fefb3214b5a1ed030cab9df513560c503a9851 +Author: Phil Sutter +Date: Fri Sep 1 16:08:08 2017 +0200 + + link_gre6: Fix for changing tclass/flowlabel + + When trying to change tclass or flowlabel of a GREv6 tunnel which has + the respective value set already, the code accidentally bitwise OR'ed + the old and the new value, leading to unexpected results. Fix this by + clearing the relevant bits of flowinfo variable prior to assigning the + new value. + + Fixes: af89576d7a8c4 ("iproute2: GRE over IPv6 tunnel support.") + Signed-off-by: Phil Sutter +--- + ip/link_gre6.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/ip/link_gre6.c b/ip/link_gre6.c +index 76416b2..fe3ab64 100644 +--- a/ip/link_gre6.c ++++ b/ip/link_gre6.c +@@ -282,6 +282,7 @@ get_failed: + else { + if (get_u8(&uval, *argv, 16)) + invarg("invalid TClass", *argv); ++ flowinfo &= ~IP6_FLOWINFO_TCLASS; + flowinfo |= htonl((__u32)uval << 20) & IP6_FLOWINFO_TCLASS; + flags &= ~IP6_TNL_F_USE_ORIG_TCLASS; + } +@@ -297,6 +298,7 @@ get_failed: + invarg("invalid Flowlabel", *argv); + if (uval > 0xFFFFF) + invarg("invalid Flowlabel", *argv); ++ flowinfo &= ~IP6_FLOWINFO_FLOWLABEL; + flowinfo |= htonl(uval) & IP6_FLOWINFO_FLOWLABEL; + flags &= ~IP6_TNL_F_USE_ORIG_FLOWLABEL; + } +-- +1.8.3.1 + diff --git a/SOURCES/0017-ipaddress-Print-IFLA_VF_QUERY_RSS_EN-setting.patch b/SOURCES/0017-ipaddress-Print-IFLA_VF_QUERY_RSS_EN-setting.patch deleted file mode 100644 index d3da716..0000000 --- a/SOURCES/0017-ipaddress-Print-IFLA_VF_QUERY_RSS_EN-setting.patch +++ /dev/null @@ -1,51 +0,0 @@ -From c4814acb2073e56a0feb085b41c441fe9b275cfc Mon Sep 17 00:00:00 2001 -From: Timothy Redaelli -Date: Thu, 9 Feb 2017 18:55:29 +0100 -Subject: [PATCH] ipaddress: Print IFLA_VF_QUERY_RSS_EN setting - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1264149 -Upstream Status: iproute2.git commit 4fb4a10 - -commit 4fb4a10e120b16c292c215791decccc47dc14604 -Author: Phil Sutter -Date: Mon Nov 14 09:29:54 2016 +0100 - - ipaddress: Print IFLA_VF_QUERY_RSS_EN setting - - Signed-off-by: Phil Sutter - -Signed-off-by: Timothy Redaelli ---- - ip/ipaddress.c | 16 ++++++++++++++++ - 1 file changed, 16 insertions(+) - -diff --git a/ip/ipaddress.c b/ip/ipaddress.c -index c8ec779..a38cef0 100644 ---- a/ip/ipaddress.c -+++ b/ip/ipaddress.c -@@ -349,6 +349,22 @@ static void print_vfinfo(FILE *fp, struct rtattr *vfinfo) - fprintf(fp, ", trust %s", - vf_trust->setting ? "on" : "off"); - } -+ if (vf[IFLA_VF_RSS_QUERY_EN]) { -+ struct ifla_vf_rss_query_en *rss_query = -+ RTA_DATA(vf[IFLA_VF_RSS_QUERY_EN]); -+ -+ if (rss_query->setting != -1) -+ fprintf(fp, ", query_rss %s", -+ rss_query->setting ? "on" : "off"); -+ } -+ if (vf[IFLA_VF_RSS_QUERY_EN]) { -+ struct ifla_vf_rss_query_en *rss_query = -+ RTA_DATA(vf[IFLA_VF_RSS_QUERY_EN]); -+ -+ if (rss_query->setting != -1) -+ fprintf(fp, ", query_rss %s", -+ rss_query->setting ? "on" : "off"); -+ } - } - - static void print_num(FILE *fp, unsigned width, uint64_t count) --- -1.8.3.1 - diff --git a/SOURCES/0017-netlink-Change-rtnl_dump_done-to-always-show-error.patch b/SOURCES/0017-netlink-Change-rtnl_dump_done-to-always-show-error.patch new file mode 100644 index 0000000..c8d1956 --- /dev/null +++ b/SOURCES/0017-netlink-Change-rtnl_dump_done-to-always-show-error.patch @@ -0,0 +1,92 @@ +From 61ccf0f453306e727e254e6de1641bb934a3b7ec Mon Sep 17 00:00:00 2001 +From: Hangbin Liu +Date: Wed, 8 Nov 2017 14:39:07 +0800 +Subject: [PATCH] netlink: Change rtnl_dump_done to always show error + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1380803 +Upstream Status: iproute2.git commit 05a14fc12188 + +commit 05a14fc1218885ba6236b409fbf6b89976b8636e +Author: David Ahern +Date: Tue May 16 14:22:46 2017 -0700 + + netlink: Change rtnl_dump_done to always show error + + The original code which became rtnl_dump_done only shows netlink errors + if the protocol is NETLINK_SOCK_DIAG, but netlink dumps always appends + the length which contains any error encountered during the dump. Update + rtnl_dump_done to always show the error if there is one. + + As an *example* without this patch, dumping a route object that exceeds + the internal buffer size terminates with no message to the user -- the + dump just ends because the NLMSG_DONE attribute was received. With this + patch the user at least gets a message that the dump was aborted. + + $ ip ro ls + default via 10.0.2.2 dev eth0 + 10.0.2.0/24 dev eth0 proto kernel scope link src 10.0.2.15 + 10.10.0.0/16 dev veth1 proto kernel scope link src 10.10.0.1 + 172.16.1.0/24 dev br0.11 proto kernel scope link src 172.16.1.1 + Error: Buffer too small for object + Dump terminated + + The point of this patch is to notify the user of a failure versus + silently exiting on a partial dump. Because the NLMSG_DONE attribute + was received, the entire dump needs to be restarted to use a larger + buffer for EMSGSIZE errors. That could be done automatically but it + has other user impacts (e.g., duplicate output if the dump is + restarted) and should be the subject of a different patch. + + Signed-off-by: David Ahern + +Signed-off-by: Hangbin Liu +--- + lib/libnetlink.c | 28 +++++++++++++++++----------- + 1 file changed, 17 insertions(+), 11 deletions(-) + +diff --git a/lib/libnetlink.c b/lib/libnetlink.c +index 9303b66..e91bd5a 100644 +--- a/lib/libnetlink.c ++++ b/lib/libnetlink.c +@@ -266,21 +266,27 @@ static int rtnl_dump_done(const struct rtnl_handle *rth, + { + int len = *(int *)NLMSG_DATA(h); + +- if (rth->proto == NETLINK_SOCK_DIAG) { +- if (h->nlmsg_len < NLMSG_LENGTH(sizeof(int))) { +- fprintf(stderr, "DONE truncated\n"); +- return -1; +- } +- ++ if (h->nlmsg_len < NLMSG_LENGTH(sizeof(int))) { ++ fprintf(stderr, "DONE truncated\n"); ++ return -1; ++ } + +- if (len < 0) { +- errno = -len; +- if (errno == ENOENT || errno == EOPNOTSUPP) +- return -1; ++ if (len < 0) { ++ errno = -len; ++ switch (errno) { ++ case ENOENT: ++ case EOPNOTSUPP: ++ return -1; ++ case EMSGSIZE: ++ fprintf(stderr, ++ "Error: Buffer too small for object.\n"); ++ break; ++ default: + perror("RTNETLINK answers"); +- return len; + } ++ return len; + } ++ + return 0; + } + +-- +1.8.3.1 + diff --git a/SOURCES/0018-ip-vfinfo-remove-code-duplication-for-IFLA_VF_RSS_QU.patch b/SOURCES/0018-ip-vfinfo-remove-code-duplication-for-IFLA_VF_RSS_QU.patch deleted file mode 100644 index 32bbb63..0000000 --- a/SOURCES/0018-ip-vfinfo-remove-code-duplication-for-IFLA_VF_RSS_QU.patch +++ /dev/null @@ -1,49 +0,0 @@ -From e36e4077efd4d662274c66c248f5051f35967995 Mon Sep 17 00:00:00 2001 -From: Timothy Redaelli -Date: Thu, 9 Feb 2017 18:55:30 +0100 -Subject: [PATCH] ip: vfinfo: remove code duplication for IFLA_VF_RSS_QUERY_EN -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1264149 -Upstream Status: iproute2.git commit fd4ca03 - -commit fd4ca03935b13789a3e5f01eeda1395ed6cb3b2a -Author: Julien Fortin -Date: Fri Dec 16 17:36:05 2016 +0100 - - ip: vfinfo: remove code duplication for IFLA_VF_RSS_QUERY_EN - - Fixes: 4fb4a10e120b1 ("ipaddress: Print IFLA_VF_QUERY_RSS_EN setting”) - - Signed-off-by: Julien Fortin - Acked-by: Phil Sutter - -Signed-off-by: Timothy Redaelli ---- - ip/ipaddress.c | 8 -------- - 1 file changed, 8 deletions(-) - -diff --git a/ip/ipaddress.c b/ip/ipaddress.c -index a38cef0..e39137f 100644 ---- a/ip/ipaddress.c -+++ b/ip/ipaddress.c -@@ -357,14 +357,6 @@ static void print_vfinfo(FILE *fp, struct rtattr *vfinfo) - fprintf(fp, ", query_rss %s", - rss_query->setting ? "on" : "off"); - } -- if (vf[IFLA_VF_RSS_QUERY_EN]) { -- struct ifla_vf_rss_query_en *rss_query = -- RTA_DATA(vf[IFLA_VF_RSS_QUERY_EN]); -- -- if (rss_query->setting != -1) -- fprintf(fp, ", query_rss %s", -- rss_query->setting ? "on" : "off"); -- } - } - - static void print_num(FILE *fp, unsigned width, uint64_t count) --- -1.8.3.1 - diff --git a/SOURCES/0018-libnetlink-drop-unused-parameter-to-rtnl_dump_done.patch b/SOURCES/0018-libnetlink-drop-unused-parameter-to-rtnl_dump_done.patch new file mode 100644 index 0000000..cccda65 --- /dev/null +++ b/SOURCES/0018-libnetlink-drop-unused-parameter-to-rtnl_dump_done.patch @@ -0,0 +1,47 @@ +From 9346e08c2f9059decf889fb89f2859e7ed61f573 Mon Sep 17 00:00:00 2001 +From: Hangbin Liu +Date: Wed, 8 Nov 2017 14:39:08 +0800 +Subject: [PATCH] libnetlink: drop unused parameter to rtnl_dump_done + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1380803 +Upstream Status: iproute2.git commit 0efa625765b4 + +commit 0efa625765b4481e1e474526eb0feda747b720e5 +Author: Stephen Hemminger +Date: Thu Aug 24 15:02:32 2017 -0700 + + libnetlink: drop unused parameter to rtnl_dump_done + + Signed-off-by: Stephen Hemminger + +Signed-off-by: Hangbin Liu +--- + lib/libnetlink.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/lib/libnetlink.c b/lib/libnetlink.c +index e91bd5a..b08518d 100644 +--- a/lib/libnetlink.c ++++ b/lib/libnetlink.c +@@ -261,8 +261,7 @@ int rtnl_dump_request_n(struct rtnl_handle *rth, struct nlmsghdr *n) + return sendmsg(rth->fd, &msg, 0); + } + +-static int rtnl_dump_done(const struct rtnl_handle *rth, +- struct nlmsghdr *h) ++static int rtnl_dump_done(struct nlmsghdr *h) + { + int len = *(int *)NLMSG_DATA(h); + +@@ -368,7 +367,7 @@ int rtnl_dump_filter_l(struct rtnl_handle *rth, + dump_intr = 1; + + if (h->nlmsg_type == NLMSG_DONE) { +- err = rtnl_dump_done(rth, h); ++ err = rtnl_dump_done(h); + if (err < 0) + return -1; + +-- +1.8.3.1 + diff --git a/SOURCES/0019-iproute-Add-support-for-extended-ack-to-rtnl_talk.patch b/SOURCES/0019-iproute-Add-support-for-extended-ack-to-rtnl_talk.patch new file mode 100644 index 0000000..84cded6 --- /dev/null +++ b/SOURCES/0019-iproute-Add-support-for-extended-ack-to-rtnl_talk.patch @@ -0,0 +1,255 @@ +From a9f81b704c4e883a996927e77afdb960a7f47fd9 Mon Sep 17 00:00:00 2001 +From: Hangbin Liu +Date: Wed, 8 Nov 2017 14:39:09 +0800 +Subject: [PATCH] iproute: Add support for extended ack to rtnl_talk + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1380803 +Upstream Status: iproute2.git commit b6432e68ac2f +Conflicts: Manually added NETLINK_EXT_ACK define to linux headers. + +commit b6432e68ac2f1f6b4ea50aa0d6d47e72c445c71c +Author: Stephen Hemminger +Date: Fri Aug 4 09:52:15 2017 -0700 + + iproute: Add support for extended ack to rtnl_talk + + Add support for extended ack error reporting via libmnl. + Add a new function rtnl_talk_extack that takes a callback as an input + arg. If a netlink response contains extack attributes, the callback is + is invoked with the the err string, offset in the message and a pointer + to the message returned by the kernel. + + If iproute2 is built without libmnl, it will still work but + extended error reports from kernel will not be available. + + Signed-off-by: Stephen Hemminger + +Signed-off-by: Hangbin Liu + +squash! iproute: Add support for extended ack to rtnl_talk +--- + include/libnetlink.h | 6 +++ + include/linux/netlink.h | 1 + + lib/Makefile | 7 ++++ + lib/libnetlink.c | 109 ++++++++++++++++++++++++++++++++++++++++++++---- + 4 files changed, 116 insertions(+), 7 deletions(-) + +diff --git a/include/libnetlink.h b/include/libnetlink.h +index bd0267d..654aebc 100644 +--- a/include/libnetlink.h ++++ b/include/libnetlink.h +@@ -65,6 +65,9 @@ typedef int (*rtnl_listen_filter_t)(const struct sockaddr_nl *, + struct rtnl_ctrl_data *, + struct nlmsghdr *n, void *); + ++typedef int (*nl_ext_ack_fn_t)(const char *errmsg, uint32_t off, ++ const struct nlmsghdr *inner_nlh); ++ + struct rtnl_dump_filter_arg { + rtnl_filter_t filter; + void *arg1; +@@ -81,6 +84,9 @@ int rtnl_dump_filter_nc(struct rtnl_handle *rth, + int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, + struct nlmsghdr *answer, size_t len) + __attribute__((warn_unused_result)); ++int rtnl_talk_extack(struct rtnl_handle *rtnl, struct nlmsghdr *n, ++ struct nlmsghdr *answer, size_t len, nl_ext_ack_fn_t errfn) ++ __attribute__((warn_unused_result)); + int rtnl_talk_suppress_rtnl_errmsg(struct rtnl_handle *rtnl, struct nlmsghdr *n, + struct nlmsghdr *answer, size_t len) + __attribute__((warn_unused_result)); +diff --git a/include/linux/netlink.h b/include/linux/netlink.h +index a982b3c..d1e26a2 100644 +--- a/include/linux/netlink.h ++++ b/include/linux/netlink.h +@@ -113,6 +113,7 @@ struct nlmsgerr { + #define NETLINK_LISTEN_ALL_NSID 8 + #define NETLINK_LIST_MEMBERSHIPS 9 + #define NETLINK_CAP_ACK 10 ++#define NETLINK_EXT_ACK 11 + + struct nl_pktinfo { + __u32 group; +diff --git a/lib/Makefile b/lib/Makefile +index 1d24ca2..f81888c 100644 +--- a/lib/Makefile ++++ b/lib/Makefile +@@ -4,6 +4,13 @@ ifeq ($(IP_CONFIG_SETNS),y) + CFLAGS += -DHAVE_SETNS + endif + ++ifeq ($(HAVE_MNL),y) ++ CFLAGS += $(shell $(PKG_CONFIG) libmnl --cflags) ++ LDLIBS += $(shell $(PKG_CONFIG) libmnl --libs) ++else ++@warn "libmnl required for error support" ++endif ++ + CFLAGS += -fPIC + + UTILOBJ = utils.o rt_names.o ll_types.o ll_proto.o ll_addr.o \ +diff --git a/lib/libnetlink.c b/lib/libnetlink.c +index b08518d..a057831 100644 +--- a/lib/libnetlink.c ++++ b/lib/libnetlink.c +@@ -36,6 +36,79 @@ + + int rcvbuf = 1024 * 1024; + ++#ifdef HAVE_LIBMNL ++#include ++ ++static const enum mnl_attr_data_type extack_policy[NLMSGERR_ATTR_MAX + 1] = { ++ [NLMSGERR_ATTR_MSG] = MNL_TYPE_NUL_STRING, ++ [NLMSGERR_ATTR_OFFS] = MNL_TYPE_U32, ++}; ++ ++static int err_attr_cb(const struct nlattr *attr, void *data) ++{ ++ const struct nlattr **tb = data; ++ uint16_t type; ++ ++ if (mnl_attr_type_valid(attr, NLMSGERR_ATTR_MAX) < 0) ++ return MNL_CB_ERROR; ++ ++ type = mnl_attr_get_type(attr); ++ if (mnl_attr_validate(attr, extack_policy[type]) < 0) ++ return MNL_CB_ERROR; ++ ++ ++ tb[type] = attr; ++ return MNL_CB_OK; ++} ++ ++ ++/* dump netlink extended ack error message */ ++static int nl_dump_ext_err(const struct nlmsghdr *nlh, nl_ext_ack_fn_t errfn) ++{ ++ struct nlattr *tb[NLMSGERR_ATTR_MAX + 1]; ++ const struct nlmsgerr *err = mnl_nlmsg_get_payload(nlh); ++ const struct nlmsghdr *err_nlh = NULL; ++ unsigned int hlen = sizeof(*err); ++ const char *errmsg = NULL; ++ uint32_t off = 0; ++ ++ if (!errfn) ++ return 0; ++ ++ /* no TLVs, nothing to do here */ ++ if (!(nlh->nlmsg_flags & NLM_F_ACK_TLVS)) ++ return 0; ++ ++ /* if NLM_F_CAPPED is set then the inner err msg was capped */ ++ if (!(nlh->nlmsg_flags & NLM_F_CAPPED)) ++ hlen += mnl_nlmsg_get_payload_len(&err->msg); ++ ++ mnl_attr_parse(nlh, hlen, err_attr_cb, tb); ++ ++ if (tb[NLMSGERR_ATTR_MSG]) ++ errmsg = mnl_attr_get_str(tb[NLMSGERR_ATTR_MSG]); ++ ++ if (tb[NLMSGERR_ATTR_OFFS]) { ++ off = mnl_attr_get_u32(tb[NLMSGERR_ATTR_OFFS]); ++ ++ if (off > nlh->nlmsg_len) { ++ fprintf(stderr, ++ "Invalid offset for NLMSGERR_ATTR_OFFS\n"); ++ off = 0; ++ } else if (!(nlh->nlmsg_flags & NLM_F_CAPPED)) ++ err_nlh = &err->msg; ++ } ++ ++ return errfn(errmsg, off, err_nlh); ++} ++#else ++/* No extended error ack without libmnl */ ++static int nl_dump_ext_err(const struct nlmsghdr *nlh, nl_ext_ack_fn_t errfn) ++{ ++ return 0; ++} ++#endif ++ + void rtnl_close(struct rtnl_handle *rth) + { + if (rth->fd >= 0) { +@@ -49,6 +122,7 @@ int rtnl_open_byproto(struct rtnl_handle *rth, unsigned int subscriptions, + { + socklen_t addr_len; + int sndbuf = 32768; ++ int one = 1; + + memset(rth, 0, sizeof(*rth)); + +@@ -71,6 +145,10 @@ int rtnl_open_byproto(struct rtnl_handle *rth, unsigned int subscriptions, + return -1; + } + ++ /* Older kernels may no support extended ACK reporting */ ++ setsockopt(rth->fd, SOL_NETLINK, NETLINK_EXT_ACK, ++ &one, sizeof(one)); ++ + memset(&rth->local, 0, sizeof(rth->local)); + rth->local.nl_family = AF_NETLINK; + rth->local.nl_groups = subscriptions; +@@ -421,9 +499,19 @@ int rtnl_dump_filter_nc(struct rtnl_handle *rth, + return rtnl_dump_filter_l(rth, a); + } + ++static void rtnl_talk_error(struct nlmsghdr *h, struct nlmsgerr *err, ++ nl_ext_ack_fn_t errfn) ++{ ++ if (nl_dump_ext_err(h, errfn)) ++ return; ++ ++ fprintf(stderr, "RTNETLINK answers: %s\n", ++ strerror(-err->error)); ++} ++ + static int __rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, + struct nlmsghdr *answer, size_t maxlen, +- bool show_rtnl_err) ++ bool show_rtnl_err, nl_ext_ack_fn_t errfn) + { + int status; + unsigned int seq; +@@ -510,10 +598,10 @@ static int __rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, + return 0; + } + +- if (rtnl->proto != NETLINK_SOCK_DIAG && show_rtnl_err) +- fprintf(stderr, +- "RTNETLINK answers: %s\n", +- strerror(-err->error)); ++ if (rtnl->proto != NETLINK_SOCK_DIAG && ++ show_rtnl_err) ++ rtnl_talk_error(h, err, errfn); ++ + errno = -err->error; + return -1; + } +@@ -545,13 +633,20 @@ static int __rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, + int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, + struct nlmsghdr *answer, size_t maxlen) + { +- return __rtnl_talk(rtnl, n, answer, maxlen, true); ++ return __rtnl_talk(rtnl, n, answer, maxlen, true, NULL); ++} ++ ++int rtnl_talk_extack(struct rtnl_handle *rtnl, struct nlmsghdr *n, ++ struct nlmsghdr *answer, size_t maxlen, ++ nl_ext_ack_fn_t errfn) ++{ ++ return __rtnl_talk(rtnl, n, answer, maxlen, true, errfn); + } + + int rtnl_talk_suppress_rtnl_errmsg(struct rtnl_handle *rtnl, struct nlmsghdr *n, + struct nlmsghdr *answer, size_t maxlen) + { +- return __rtnl_talk(rtnl, n, answer, maxlen, false); ++ return __rtnl_talk(rtnl, n, answer, maxlen, false, NULL); + } + + int rtnl_listen_all_nsid(struct rtnl_handle *rth) +-- +1.8.3.1 + diff --git a/SOURCES/0019-macsec-fix-input-range-of-icvlen-parameter.patch b/SOURCES/0019-macsec-fix-input-range-of-icvlen-parameter.patch deleted file mode 100644 index 56a716b..0000000 --- a/SOURCES/0019-macsec-fix-input-range-of-icvlen-parameter.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 2dbe403fcb0dac676d4f57125238630812342b9b Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 21 Feb 2017 22:09:56 +0100 -Subject: [PATCH] macsec: fix input range of 'icvlen' parameter - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1373121 -Upstream Status: iproute2.git commit f20f5f79909fd -Conflicts: -* Added missing MACSEC_STD_ICV_LEN define to linux headers. - -commit f20f5f79909fdc6327fcd015a3850645a236729d -Author: Davide Caratti -Date: Fri Sep 9 16:02:22 2016 +0200 - - macsec: fix input range of 'icvlen' parameter - - the maximum possible ICV length in a MACsec frame is 16 octects, not 32: - fix get_icvlen() accordingly, so that a proper error message is displayed - in case input 'icvlen' is greater than 16. - - Signed-off-by: Davide Caratti - Acked-by: Phil Sutter - Acked-by: Sabrina Dubroca ---- - include/linux/if_macsec.h | 2 ++ - ip/ipmacsec.c | 4 ++-- - 2 files changed, 4 insertions(+), 2 deletions(-) - -diff --git a/include/linux/if_macsec.h b/include/linux/if_macsec.h -index cbd4faa..22939a3 100644 ---- a/include/linux/if_macsec.h -+++ b/include/linux/if_macsec.h -@@ -26,6 +26,8 @@ - - #define MACSEC_MIN_ICV_LEN 8 - #define MACSEC_MAX_ICV_LEN 32 -+/* upper limit for ICV length as recommended by IEEE802.1AE-2006 */ -+#define MACSEC_STD_ICV_LEN 16 - - enum macsec_attrs { - MACSEC_ATTR_UNSPEC, -diff --git a/ip/ipmacsec.c b/ip/ipmacsec.c -index 596594f..0c51bfc 100644 ---- a/ip/ipmacsec.c -+++ b/ip/ipmacsec.c -@@ -167,9 +167,9 @@ static void get_icvlen(__u8 *icvlen, char *arg) - if (ret) - invarg("expected ICV length", arg); - -- if (*icvlen < MACSEC_MIN_ICV_LEN || *icvlen > MACSEC_MAX_ICV_LEN) -+ if (*icvlen < MACSEC_MIN_ICV_LEN || *icvlen > MACSEC_STD_ICV_LEN) - invarg("ICV length must be in the range {" -- STR(MACSEC_MIN_ICV_LEN) ".." STR(MACSEC_MAX_ICV_LEN) -+ STR(MACSEC_MIN_ICV_LEN) ".." STR(MACSEC_STD_ICV_LEN) - "}", arg); - } - --- -1.8.3.1 - diff --git a/SOURCES/0020-iplink-bridge_slave-add-support-for-IFLA_BRPORT_MULT.patch b/SOURCES/0020-iplink-bridge_slave-add-support-for-IFLA_BRPORT_MULT.patch deleted file mode 100644 index 5c8b2bd..0000000 --- a/SOURCES/0020-iplink-bridge_slave-add-support-for-IFLA_BRPORT_MULT.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 80c5549318cec082da0793526e8e471e946103be Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 21 Feb 2017 22:25:04 +0100 -Subject: [PATCH] iplink: bridge_slave: add support for - IFLA_BRPORT_MULTICAST_ROUTER - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1374360 -Upstream Status: iproute2.git commit 10759a90ab589 -Conflicts: Context changes due to missing commits: -* f6e615dec9ee9 ("iplink: bridge_slave: add support for - IFLA_BRPORT_PROXYARP") -* 38b31a78da859 ("iplink: bridge_slave: add support for - IFLA_BRPORT_PROXYARP_WIFI") - -commit 10759a90ab5896b5b0ca8ddd7b91c5b3a7466062 -Author: Nikolay Aleksandrov -Date: Tue Feb 16 16:08:54 2016 +0100 - - iplink: bridge_slave: add support for IFLA_BRPORT_MULTICAST_ROUTER - - Add support to be able to view and change IFLA_BRPORT_MULTICAST_ROUTER port - attribute. - - Signed-off-by: Nikolay Aleksandrov ---- - ip/iplink_bridge_slave.c | 13 +++++++++++++ - 1 file changed, 13 insertions(+) - -diff --git a/ip/iplink_bridge_slave.c b/ip/iplink_bridge_slave.c -index 4593872..9ed44b1 100644 ---- a/ip/iplink_bridge_slave.c -+++ b/ip/iplink_bridge_slave.c -@@ -29,6 +29,7 @@ static void print_explain(FILE *f) - " [ root_block {on | off} ]\n" - " [ learning {on | off} ]\n" - " [ flood {on | off} ]\n" -+ " [ mcast_router MULTICAST_ROUTER ]\n" - ); - } - -@@ -98,6 +99,10 @@ static void bridge_slave_print_opt(struct link_util *lu, FILE *f, - if (tb[IFLA_BRPORT_UNICAST_FLOOD]) - print_onoff(f, "flood", - rta_getattr_u8(tb[IFLA_BRPORT_UNICAST_FLOOD])); -+ -+ if (tb[IFLA_BRPORT_MULTICAST_ROUTER]) -+ fprintf(f, "mcast_router %u ", -+ rta_getattr_u8(tb[IFLA_BRPORT_MULTICAST_ROUTER])); - } - - static void bridge_slave_parse_on_off(char *arg_name, char *arg_val, -@@ -162,6 +167,14 @@ static int bridge_slave_parse_opt(struct link_util *lu, int argc, char **argv, - NEXT_ARG(); - bridge_slave_parse_on_off("flood", *argv, n, - IFLA_BRPORT_UNICAST_FLOOD); -+ } else if (matches(*argv, "mcast_router") == 0) { -+ __u8 mcast_router; -+ -+ NEXT_ARG(); -+ if (get_u8(&mcast_router, *argv, 0)) -+ invarg("invalid mcast_router", *argv); -+ addattr8(n, 1024, IFLA_BRPORT_MULTICAST_ROUTER, -+ mcast_router); - } else if (matches(*argv, "help") == 0) { - explain(); - return -1; --- -1.8.3.1 - diff --git a/SOURCES/0020-iplink-check-for-message-truncation-in-iplink_get.patch b/SOURCES/0020-iplink-check-for-message-truncation-in-iplink_get.patch new file mode 100644 index 0000000..00b71ef --- /dev/null +++ b/SOURCES/0020-iplink-check-for-message-truncation-in-iplink_get.patch @@ -0,0 +1,51 @@ +From 8372b7bb8f7211563d888fdd30e473c161f7d0a0 Mon Sep 17 00:00:00 2001 +From: Hangbin Liu +Date: Wed, 8 Nov 2017 14:39:10 +0800 +Subject: [PATCH] iplink: check for message truncation in iplink_get() + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1380803 +Upstream Status: iproute2.git commit 6599162b958e + +commit 6599162b958ea5a43d729df4f30aad515db26ff4 +Author: Michal Kubecek +Date: Fri Sep 1 18:39:11 2017 +0200 + + iplink: check for message truncation in iplink_get() + + If message length exceeds maxlen argument of rtnl_talk(), it is truncated + to maxlen but unlike in the case of truncation to the length of local + buffer in rtnl_talk(), the caller doesn't get any indication of a problem. + + In particular, iplink_get() passes the truncated message on and parsing it + results in various warnings and sometimes even a segfault (observed with + "ip link show dev ..." for a NIC with 125 VFs). + + Handle message truncation in iplink_get() the same way as truncation in + rtnl_talk() would be handled: return an error. + + Signed-off-by: Michal Kubecek + +Signed-off-by: Hangbin Liu +--- + ip/iplink.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/ip/iplink.c b/ip/iplink.c +index da3f9a7..2b2421f 100644 +--- a/ip/iplink.c ++++ b/ip/iplink.c +@@ -1031,6 +1031,11 @@ int iplink_get(unsigned int flags, char *name, __u32 filt_mask) + + if (rtnl_talk(&rth, &req.n, &answer.n, sizeof(answer)) < 0) + return -2; ++ if (answer.n.nlmsg_len > sizeof(answer.buf)) { ++ fprintf(stderr, "Message truncated from %u to %lu\n", ++ answer.n.nlmsg_len, sizeof(answer.buf)); ++ return -2; ++ } + + if (brief) + print_linkinfo_brief(NULL, &answer.n, stdout); +-- +1.8.3.1 + diff --git a/SOURCES/0021-iplink-bridge_slave-add-support-for-IFLA_BRPORT_FAST.patch b/SOURCES/0021-iplink-bridge_slave-add-support-for-IFLA_BRPORT_FAST.patch deleted file mode 100644 index 49cb66b..0000000 --- a/SOURCES/0021-iplink-bridge_slave-add-support-for-IFLA_BRPORT_FAST.patch +++ /dev/null @@ -1,59 +0,0 @@ -From c725387502629782970a262a0d78bfb50c7dd0b3 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 21 Feb 2017 22:26:27 +0100 -Subject: [PATCH] iplink: bridge_slave: add support for IFLA_BRPORT_FAST_LEAVE - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1374360 -Upstream Status: iproute2.git commit 478a8e5920684 - -commit 478a8e59206841b2a2d32a29fdd0cbec1965cd5e -Author: Nikolay Aleksandrov -Date: Tue Feb 16 16:08:55 2016 +0100 - - iplink: bridge_slave: add support for IFLA_BRPORT_FAST_LEAVE - - Add support to be able to view and change IFLA_BRPORT_FAST_LEAVE - port attribute. - - Signed-off-by: Nikolay Aleksandrov ---- - ip/iplink_bridge_slave.c | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/ip/iplink_bridge_slave.c b/ip/iplink_bridge_slave.c -index 9ed44b1..66c3a00 100644 ---- a/ip/iplink_bridge_slave.c -+++ b/ip/iplink_bridge_slave.c -@@ -30,6 +30,7 @@ static void print_explain(FILE *f) - " [ learning {on | off} ]\n" - " [ flood {on | off} ]\n" - " [ mcast_router MULTICAST_ROUTER ]\n" -+ " [ mcast_fast_leave {on | off} ]\n" - ); - } - -@@ -103,6 +104,10 @@ static void bridge_slave_print_opt(struct link_util *lu, FILE *f, - if (tb[IFLA_BRPORT_MULTICAST_ROUTER]) - fprintf(f, "mcast_router %u ", - rta_getattr_u8(tb[IFLA_BRPORT_MULTICAST_ROUTER])); -+ -+ if (tb[IFLA_BRPORT_FAST_LEAVE]) -+ print_onoff(f, "mcast_fast_leave", -+ rta_getattr_u8(tb[IFLA_BRPORT_FAST_LEAVE])); - } - - static void bridge_slave_parse_on_off(char *arg_name, char *arg_val, -@@ -175,6 +180,10 @@ static int bridge_slave_parse_opt(struct link_util *lu, int argc, char **argv, - invarg("invalid mcast_router", *argv); - addattr8(n, 1024, IFLA_BRPORT_MULTICAST_ROUTER, - mcast_router); -+ } else if (matches(*argv, "mcast_fast_leave") == 0) { -+ NEXT_ARG(); -+ bridge_slave_parse_on_off("mcast_fast_leave", *argv, n, -+ IFLA_BRPORT_FAST_LEAVE); - } else if (matches(*argv, "help") == 0) { - explain(); - return -1; --- -1.8.3.1 - diff --git a/SOURCES/0021-iplink-double-the-buffer-size-also-in-iplink_get.patch b/SOURCES/0021-iplink-double-the-buffer-size-also-in-iplink_get.patch new file mode 100644 index 0000000..c6d653a --- /dev/null +++ b/SOURCES/0021-iplink-double-the-buffer-size-also-in-iplink_get.patch @@ -0,0 +1,48 @@ +From c560900fc16eeac064cc7c43a96c5343fe68ae76 Mon Sep 17 00:00:00 2001 +From: Hangbin Liu +Date: Wed, 8 Nov 2017 14:39:11 +0800 +Subject: [PATCH] iplink: double the buffer size also in iplink_get() + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1380803 +Upstream Status: iproute2.git commit 460c03f3f3cc + +commit 460c03f3f3cc436ff4673d75722ba68a6ec9343d +Author: Michal Kubecek +Date: Fri Sep 1 18:39:16 2017 +0200 + + iplink: double the buffer size also in iplink_get() + + Commit 72b365e8e0fd ("libnetlink: Double the dump buffer size") increased + the buffer size for "ip link show" command to 32 KB to handle NICs with + large number of VFs. With "dev" filter, a different code path is taken and + iplink_get() still uses only 16 KB buffer. + + The size of 32768 is not very future-proof as NICs supporting 120-128 VFs + are already in use so that single RTM_NEWLINK message in the dump can + exceed 30000 bytes. But it's what rtnl_talk() and rtnl_dump_filter_l() use + so let's be consistent. Once this proves insufficient, all three sizes + should be increased. + + Signed-off-by: Michal Kubecek + +Signed-off-by: Hangbin Liu +--- + ip/iplink.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ip/iplink.c b/ip/iplink.c +index 2b2421f..5afbadf 100644 +--- a/ip/iplink.c ++++ b/ip/iplink.c +@@ -1015,7 +1015,7 @@ int iplink_get(unsigned int flags, char *name, __u32 filt_mask) + }; + struct { + struct nlmsghdr n; +- char buf[16384]; ++ char buf[32768]; + } answer; + + if (name) { +-- +1.8.3.1 + diff --git a/SOURCES/0022-lib-libnetlink-re-malloc-buff-if-size-is-not-enough.patch b/SOURCES/0022-lib-libnetlink-re-malloc-buff-if-size-is-not-enough.patch new file mode 100644 index 0000000..8e429aa --- /dev/null +++ b/SOURCES/0022-lib-libnetlink-re-malloc-buff-if-size-is-not-enough.patch @@ -0,0 +1,252 @@ +From 49e7c0e7c8c9a982fd3aa69bbed4e306a1dcb331 Mon Sep 17 00:00:00 2001 +From: Hangbin Liu +Date: Wed, 8 Nov 2017 14:39:12 +0800 +Subject: [PATCH] lib/libnetlink: re malloc buff if size is not enough + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1380803 +Upstream Status: iproute2.git net-next commit 2d34851cd341 + +commit 2d34851cd341f0e1b3fc17ca3e6e874229f3a1f8 +Author: Hangbin Liu +Date: Thu Oct 26 09:41:46 2017 +0800 + + lib/libnetlink: re malloc buff if size is not enough + + With commit 72b365e8e0fd ("libnetlink: Double the dump buffer size") + we doubled the buffer size to support more VFs. But the VFs number is + increasing all the time. Some customers even use more than 200 VFs now. + + We could not double it everytime when the buffer is not enough. Let's just + not hard code the buffer size and malloc the correct number when running. + + Introduce function rtnl_recvmsg() to always return a newly allocated buffer. + The caller need to free it after using. + + Signed-off-by: Hangbin Liu + Signed-off-by: Phil Sutter + +Signed-off-by: Hangbin Liu +--- + lib/libnetlink.c | 114 ++++++++++++++++++++++++++++++++++++++----------------- + 1 file changed, 80 insertions(+), 34 deletions(-) + +diff --git a/lib/libnetlink.c b/lib/libnetlink.c +index a057831..446c960 100644 +--- a/lib/libnetlink.c ++++ b/lib/libnetlink.c +@@ -386,6 +386,64 @@ static void rtnl_dump_error(const struct rtnl_handle *rth, + } + } + ++static int __rtnl_recvmsg(int fd, struct msghdr *msg, int flags) ++{ ++ int len; ++ ++ do { ++ len = recvmsg(fd, msg, flags); ++ } while (len < 0 && (errno == EINTR || errno == EAGAIN)); ++ ++ if (len < 0) { ++ fprintf(stderr, "netlink receive error %s (%d)\n", ++ strerror(errno), errno); ++ return -errno; ++ } ++ ++ if (len == 0) { ++ fprintf(stderr, "EOF on netlink\n"); ++ return -ENODATA; ++ } ++ ++ return len; ++} ++ ++static int rtnl_recvmsg(int fd, struct msghdr *msg, char **answer) ++{ ++ struct iovec *iov = msg->msg_iov; ++ char *buf; ++ int len; ++ ++ iov->iov_base = NULL; ++ iov->iov_len = 0; ++ ++ len = __rtnl_recvmsg(fd, msg, MSG_PEEK | MSG_TRUNC); ++ if (len < 0) ++ return len; ++ ++ buf = malloc(len); ++ if (!buf) { ++ fprintf(stderr, "malloc error: not enough buffer\n"); ++ return -ENOMEM; ++ } ++ ++ iov->iov_base = buf; ++ iov->iov_len = len; ++ ++ len = __rtnl_recvmsg(fd, msg, 0); ++ if (len < 0) { ++ free(buf); ++ return len; ++ } ++ ++ if (answer) ++ *answer = buf; ++ else ++ free(buf); ++ ++ return len; ++} ++ + int rtnl_dump_filter_l(struct rtnl_handle *rth, + const struct rtnl_dump_filter_arg *arg) + { +@@ -397,31 +455,18 @@ int rtnl_dump_filter_l(struct rtnl_handle *rth, + .msg_iov = &iov, + .msg_iovlen = 1, + }; +- char buf[32768]; ++ char *buf; + int dump_intr = 0; + +- iov.iov_base = buf; + while (1) { + int status; + const struct rtnl_dump_filter_arg *a; + int found_done = 0; + int msglen = 0; + +- iov.iov_len = sizeof(buf); +- status = recvmsg(rth->fd, &msg, 0); +- +- if (status < 0) { +- if (errno == EINTR || errno == EAGAIN) +- continue; +- fprintf(stderr, "netlink receive error %s (%d)\n", +- strerror(errno), errno); +- return -1; +- } +- +- if (status == 0) { +- fprintf(stderr, "EOF on netlink\n"); +- return -1; +- } ++ status = rtnl_recvmsg(rth->fd, &msg, &buf); ++ if (status < 0) ++ return status; + + if (rth->dump_fp) + fwrite(buf, 1, NLMSG_ALIGN(status), rth->dump_fp); +@@ -446,8 +491,10 @@ int rtnl_dump_filter_l(struct rtnl_handle *rth, + + if (h->nlmsg_type == NLMSG_DONE) { + err = rtnl_dump_done(h); +- if (err < 0) ++ if (err < 0) { ++ free(buf); + return -1; ++ } + + found_done = 1; + break; /* process next filter */ +@@ -455,19 +502,23 @@ int rtnl_dump_filter_l(struct rtnl_handle *rth, + + if (h->nlmsg_type == NLMSG_ERROR) { + rtnl_dump_error(rth, h); ++ free(buf); + return -1; + } + + if (!rth->dump_fp) { + err = a->filter(&nladdr, h, a->arg1); +- if (err < 0) ++ if (err < 0) { ++ free(buf); + return err; ++ } + } + + skip_it: + h = NLMSG_NEXT(h, msglen); + } + } ++ free(buf); + + if (found_done) { + if (dump_intr) +@@ -527,7 +578,7 @@ static int __rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, + .msg_iov = &iov, + .msg_iovlen = 1, + }; +- char buf[32768] = {}; ++ char *buf; + + n->nlmsg_seq = seq = ++rtnl->seq; + +@@ -540,22 +591,12 @@ static int __rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, + return -1; + } + +- iov.iov_base = buf; + while (1) { +- iov.iov_len = sizeof(buf); +- status = recvmsg(rtnl->fd, &msg, 0); ++ status = rtnl_recvmsg(rtnl->fd, &msg, &buf); ++ ++ if (status < 0) ++ return status; + +- if (status < 0) { +- if (errno == EINTR || errno == EAGAIN) +- continue; +- fprintf(stderr, "netlink receive error %s (%d)\n", +- strerror(errno), errno); +- return -1; +- } +- if (status == 0) { +- fprintf(stderr, "EOF on netlink\n"); +- return -1; +- } + if (msg.msg_namelen != sizeof(nladdr)) { + fprintf(stderr, + "sender address length == %d\n", +@@ -569,6 +610,7 @@ static int __rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, + if (l < 0 || len > status) { + if (msg.msg_flags & MSG_TRUNC) { + fprintf(stderr, "Truncated message\n"); ++ free(buf); + return -1; + } + fprintf(stderr, +@@ -595,6 +637,7 @@ static int __rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, + if (answer) + memcpy(answer, h, + MIN(maxlen, h->nlmsg_len)); ++ free(buf); + return 0; + } + +@@ -603,12 +646,14 @@ static int __rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, + rtnl_talk_error(h, err, errfn); + + errno = -err->error; ++ free(buf); + return -1; + } + + if (answer) { + memcpy(answer, h, + MIN(maxlen, h->nlmsg_len)); ++ free(buf); + return 0; + } + +@@ -617,6 +662,7 @@ static int __rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, + status -= NLMSG_ALIGN(len); + h = (struct nlmsghdr *)((char *)h + NLMSG_ALIGN(len)); + } ++ free(buf); + + if (msg.msg_flags & MSG_TRUNC) { + fprintf(stderr, "Message truncated\n"); +-- +1.8.3.1 + diff --git a/SOURCES/0022-man-ip-link-Remove-bits-about-proxy_arp-and-proxy_ar.patch b/SOURCES/0022-man-ip-link-Remove-bits-about-proxy_arp-and-proxy_ar.patch deleted file mode 100644 index 8fa5945..0000000 --- a/SOURCES/0022-man-ip-link-Remove-bits-about-proxy_arp-and-proxy_ar.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 75b314be0b22357ef564e451bc8d8dd1b9de74aa Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 21 Feb 2017 22:26:28 +0100 -Subject: [PATCH] man: ip-link: Remove bits about proxy_arp and proxy_arp_wifi - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1374360 -Upstream Status: RHEL only - -These are not supported in RHEL7 (neither kernel nor iproute), so remove -them from the man page also. ---- - man/man8/ip-link.8.in | 15 +-------------- - 1 file changed, 1 insertion(+), 14 deletions(-) - -diff --git a/man/man8/ip-link.8.in b/man/man8/ip-link.8.in -index 73cd86d..cfd996a 100644 ---- a/man/man8/ip-link.8.in -+++ b/man/man8/ip-link.8.in -@@ -1130,10 +1130,6 @@ the following additional arguments are supported: - ] [ - .BR flood " { " on " | " off " }" - ] [ --.BR proxy_arp " { " on " | " off " }" --] [ --.BR proxy_arp_wifi " { " on " | " off " }" --] [ - .BI mcast_router " MULTICAST_ROUTER" - ] [ - .BR mcast_fast_leave " { " on " | " off "} ]" -@@ -1174,16 +1170,7 @@ port to be reflected back. - - .BR flood " { " on " | " off " }" - - open the flood gates on this port, i.e. forward all unicast frames to this --port also. Requires --.BR proxy_arp " and " proxy_arp_wifi --to be turned off. -- --.BR proxy_arp " { " on " | " off " }" --- enable proxy ARP on this port. -- --.BR proxy_arp_wifi " { " on " | " off " }" --- enable proxy ARP on this port which meets extended requirements by IEEE --802.11 and Hotspot 2.0 specifications. -+port also. - - .BI mcast_router " MULTICAST_ROUTER" - - configure this port for having multicast routers attached. A port with a --- -1.8.3.1 - diff --git a/SOURCES/0023-iplink-add-missing-link-type.patch b/SOURCES/0023-iplink-add-missing-link-type.patch deleted file mode 100644 index 1d0f650..0000000 --- a/SOURCES/0023-iplink-add-missing-link-type.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 904e3ea057b28f80235222fd8d4a3afd5eb7c908 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 21 Feb 2017 22:33:18 +0100 -Subject: [PATCH] iplink: add missing link type - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1374493 -Upstream Status: iproute2.git commit d8cf93de04d93 -Conflicts: Patch manually applied - RHEL doesn't support ipvlan but - macsec support has already been backported. - -commit d8cf93de04d9372f478fc2e59e2fe8bce1953b7a -Author: Zhang Shengju -Date: Wed Aug 12 06:03:22 2015 +0000 - - iplink: add missing link type - - Add missing link type "bridge_slave". - - Signed-off-by: Zhang Shengju ---- - ip/iplink.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/ip/iplink.c b/ip/iplink.c -index e0e0fe9..f75193f 100644 ---- a/ip/iplink.c -+++ b/ip/iplink.c -@@ -97,7 +97,7 @@ void iplink_usage(void) - fprintf(stderr, "TYPE := { vlan | veth | vcan | dummy | ifb | macvlan | macvtap |\n"); - fprintf(stderr, " bridge | bond | ipoib | ip6tnl | ipip | sit | vxlan |\n"); - fprintf(stderr, " gre | gretap | ip6gre | ip6gretap | vti | nlmon |\n"); -- fprintf(stderr, " bond_slave | geneve | macsec }\n"); -+ fprintf(stderr, " bond_slave | geneve | bridge_slave | macsec }\n"); - } - exit(-1); - } --- -1.8.3.1 - diff --git a/SOURCES/0023-lib-libnetlink-update-rtnl_talk-to-support-malloc-bu.patch b/SOURCES/0023-lib-libnetlink-update-rtnl_talk-to-support-malloc-bu.patch new file mode 100644 index 0000000..7080671 --- /dev/null +++ b/SOURCES/0023-lib-libnetlink-update-rtnl_talk-to-support-malloc-bu.patch @@ -0,0 +1,1604 @@ +From 3d76c7eea3caaddcc0608ad35a9e6fab3df11f8e Mon Sep 17 00:00:00 2001 +From: Hangbin Liu +Date: Wed, 8 Nov 2017 14:39:13 +0800 +Subject: [PATCH] lib/libnetlink: update rtnl_talk to support malloc buff at + run time + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1380803 +Upstream Status: iproute2.git net-next commit 86bf43c7c2fd + +Conflicts: +- iplink_get@ip/iplink.c: no function open_json_object() due to missing + e4a1216aeb2a ("ip: iplink.c: open/close json obj for ip -brief -json link + show dev DEV"). Lack of last parameter for print_linkinfo_brief() due to + missing 63891c70137f ("ip address: Change print_linkinfo_brief to take + filter as an input") +- gre_parse_opt@ip/link_gre.c: context conflicts due to missing new + flag IFLA_GRE_ERSPAN_INDEX. +- gre_parse_opt@ip/link_gre6.c: context conflicts due to missing new + flag IFLA_GRE_FWMARK. +- ip6tunnel_parse_opt@ip/link_ip6tnl.c: context conflicts due to missing new + flag IFLA_IPTUN_FWMARK. +- iptunnel_parse_opt@ip/link_iptnl.c: context conflicts due to missing new + flag IFLA_IPTUN_FWMARK. +- vti_parse_opt@ip/link_vti.c: context conflicts due to missing new flag + IFLA_VTI_FWMARK +- vti6_parse_opt@ip/link_vti6.c: context conflicts due to missing new flag + IFLA_VTI_FWMARK + +commit 86bf43c7c2fdc33d7c021b4a1add1c8facbca51c +Author: Hangbin Liu +Date: Thu Oct 26 09:41:47 2017 +0800 + + lib/libnetlink: update rtnl_talk to support malloc buff at run time + + This is an update for 460c03f3f3cc ("iplink: double the buffer size also in + iplink_get()"). After update, we will not need to double the buffer size + every time when VFs number increased. + + With call like rtnl_talk(&rth, &req.n, NULL, 0), we can simply remove the + length parameter. + + With call like rtnl_talk(&rth, nlh, nlh, sizeof(req), I add a new variable + answer to avoid overwrite data in nlh, because it may has more info after + nlh. also this will avoid nlh buffer not enough issue. + + We need to free answer after using. + + Signed-off-by: Hangbin Liu + Signed-off-by: Phil Sutter + +Signed-off-by: Hangbin Liu +--- + bridge/fdb.c | 2 +- + bridge/link.c | 2 +- + bridge/mdb.c | 2 +- + bridge/vlan.c | 2 +- + genl/ctrl.c | 19 ++++++++++++------- + include/libnetlink.h | 6 +++--- + ip/ipaddress.c | 4 ++-- + ip/ipaddrlabel.c | 4 ++-- + ip/ipfou.c | 4 ++-- + ip/ipila.c | 4 ++-- + ip/ipl2tp.c | 8 ++++---- + ip/iplink.c | 38 +++++++++++++++++++------------------- + ip/iplink_vrf.c | 44 ++++++++++++++++++++------------------------ + ip/ipmacsec.c | 2 +- + ip/ipneigh.c | 2 +- + ip/ipnetns.c | 23 ++++++++++++++--------- + ip/ipntable.c | 2 +- + ip/iproute.c | 26 +++++++++++++++++--------- + ip/iprule.c | 6 +++--- + ip/iptoken.c | 2 +- + ip/link_gre.c | 11 +++++++---- + ip/link_gre6.c | 11 +++++++---- + ip/link_ip6tnl.c | 11 +++++++---- + ip/link_iptnl.c | 11 +++++++---- + ip/link_vti.c | 11 +++++++---- + ip/link_vti6.c | 11 +++++++---- + ip/tcp_metrics.c | 8 +++++--- + ip/xfrm_policy.c | 25 +++++++++++++------------ + ip/xfrm_state.c | 30 ++++++++++++++++-------------- + lib/libgenl.c | 9 +++++++-- + lib/libnetlink.c | 24 +++++++++++------------- + misc/ss.c | 2 +- + tc/m_action.c | 12 ++++++------ + tc/tc_class.c | 2 +- + tc/tc_filter.c | 8 +++++--- + tc/tc_qdisc.c | 2 +- + 36 files changed, 216 insertions(+), 174 deletions(-) + +diff --git a/bridge/fdb.c b/bridge/fdb.c +index a71a78f..4859edb 100644 +--- a/bridge/fdb.c ++++ b/bridge/fdb.c +@@ -529,7 +529,7 @@ static int fdb_modify(int cmd, int flags, int argc, char **argv) + return -1; + } + +- if (rtnl_talk(&rth, &req.n, NULL, 0) < 0) ++ if (rtnl_talk(&rth, &req.n, NULL) < 0) + return -1; + + return 0; +diff --git a/bridge/link.c b/bridge/link.c +index 93472ad..cc29a2a 100644 +--- a/bridge/link.c ++++ b/bridge/link.c +@@ -426,7 +426,7 @@ static int brlink_modify(int argc, char **argv) + addattr_nest_end(&req.n, nest); + } + +- if (rtnl_talk(&rth, &req.n, NULL, 0) < 0) ++ if (rtnl_talk(&rth, &req.n, NULL) < 0) + return -1; + + return 0; +diff --git a/bridge/mdb.c b/bridge/mdb.c +index e60ff3e..fbd8184 100644 +--- a/bridge/mdb.c ++++ b/bridge/mdb.c +@@ -298,7 +298,7 @@ static int mdb_modify(int cmd, int flags, int argc, char **argv) + entry.vid = vid; + addattr_l(&req.n, sizeof(req), MDBA_SET_ENTRY, &entry, sizeof(entry)); + +- if (rtnl_talk(&rth, &req.n, NULL, 0) < 0) ++ if (rtnl_talk(&rth, &req.n, NULL) < 0) + return -1; + + return 0; +diff --git a/bridge/vlan.c b/bridge/vlan.c +index ebcdace..5d68359 100644 +--- a/bridge/vlan.c ++++ b/bridge/vlan.c +@@ -133,7 +133,7 @@ static int vlan_modify(int cmd, int argc, char **argv) + + addattr_nest_end(&req.n, afspec); + +- if (rtnl_talk(&rth, &req.n, NULL, 0) < 0) ++ if (rtnl_talk(&rth, &req.n, NULL) < 0) + return -1; + + return 0; +diff --git a/genl/ctrl.c b/genl/ctrl.c +index 6abd525..21e857c 100644 +--- a/genl/ctrl.c ++++ b/genl/ctrl.c +@@ -55,6 +55,7 @@ int genl_ctrl_resolve_family(const char *family) + }; + struct nlmsghdr *nlh = &req.n; + struct genlmsghdr *ghdr = &req.g; ++ struct nlmsghdr *answer = NULL; + + if (rtnl_open_byproto(&rth, 0, NETLINK_GENERIC) < 0) { + fprintf(stderr, "Cannot open generic netlink socket\n"); +@@ -63,19 +64,19 @@ int genl_ctrl_resolve_family(const char *family) + + addattr_l(nlh, 128, CTRL_ATTR_FAMILY_NAME, family, strlen(family) + 1); + +- if (rtnl_talk(&rth, nlh, nlh, sizeof(req)) < 0) { ++ if (rtnl_talk(&rth, nlh, &answer) < 0) { + fprintf(stderr, "Error talking to the kernel\n"); + goto errout; + } + + { + struct rtattr *tb[CTRL_ATTR_MAX + 1]; +- int len = nlh->nlmsg_len; ++ int len = answer->nlmsg_len; + struct rtattr *attrs; + +- if (nlh->nlmsg_type != GENL_ID_CTRL) { ++ if (answer->nlmsg_type != GENL_ID_CTRL) { + fprintf(stderr, "Not a controller message, nlmsg_len=%d " +- "nlmsg_type=0x%x\n", nlh->nlmsg_len, nlh->nlmsg_type); ++ "nlmsg_type=0x%x\n", answer->nlmsg_len, answer->nlmsg_type); + goto errout; + } + +@@ -88,10 +89,11 @@ int genl_ctrl_resolve_family(const char *family) + + if (len < 0) { + fprintf(stderr, "wrong controller message len %d\n", len); ++ free(answer); + return -1; + } + +- attrs = (struct rtattr *) ((char *) ghdr + GENL_HDRLEN); ++ attrs = (struct rtattr *) ((char *) answer + NLMSG_LENGTH(GENL_HDRLEN)); + parse_rtattr(tb, CTRL_ATTR_MAX, attrs, len); + + if (tb[CTRL_ATTR_FAMILY_ID] == NULL) { +@@ -103,6 +105,7 @@ int genl_ctrl_resolve_family(const char *family) + } + + errout: ++ free(answer); + rtnl_close(&rth); + return ret; + } +@@ -299,6 +302,7 @@ static int ctrl_list(int cmd, int argc, char **argv) + .g.cmd = CTRL_CMD_GETFAMILY, + }; + struct nlmsghdr *nlh = &req.n; ++ struct nlmsghdr *answer = NULL; + + if (rtnl_open_byproto(&rth, 0, NETLINK_GENERIC) < 0) { + fprintf(stderr, "Cannot open generic netlink socket\n"); +@@ -331,12 +335,12 @@ static int ctrl_list(int cmd, int argc, char **argv) + goto ctrl_done; + } + +- if (rtnl_talk(&rth, nlh, nlh, sizeof(req)) < 0) { ++ if (rtnl_talk(&rth, nlh, &answer) < 0) { + fprintf(stderr, "Error talking to the kernel\n"); + goto ctrl_done; + } + +- if (print_ctrl2(NULL, nlh, (void *) stdout) < 0) { ++ if (print_ctrl2(NULL, answer, (void *) stdout) < 0) { + fprintf(stderr, "Dump terminated\n"); + goto ctrl_done; + } +@@ -358,6 +362,7 @@ static int ctrl_list(int cmd, int argc, char **argv) + + ret = 0; + ctrl_done: ++ free(answer); + rtnl_close(&rth); + return ret; + } +diff --git a/include/libnetlink.h b/include/libnetlink.h +index 654aebc..2136d2b 100644 +--- a/include/libnetlink.h ++++ b/include/libnetlink.h +@@ -82,13 +82,13 @@ int rtnl_dump_filter_nc(struct rtnl_handle *rth, + #define rtnl_dump_filter(rth, filter, arg) \ + rtnl_dump_filter_nc(rth, filter, arg, 0) + int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, +- struct nlmsghdr *answer, size_t len) ++ struct nlmsghdr **answer) + __attribute__((warn_unused_result)); + int rtnl_talk_extack(struct rtnl_handle *rtnl, struct nlmsghdr *n, +- struct nlmsghdr *answer, size_t len, nl_ext_ack_fn_t errfn) ++ struct nlmsghdr **answer, nl_ext_ack_fn_t errfn) + __attribute__((warn_unused_result)); + int rtnl_talk_suppress_rtnl_errmsg(struct rtnl_handle *rtnl, struct nlmsghdr *n, +- struct nlmsghdr *answer, size_t len) ++ struct nlmsghdr **answer) + __attribute__((warn_unused_result)); + int rtnl_send(struct rtnl_handle *rth, const void *buf, int) + __attribute__((warn_unused_result)); +diff --git a/ip/ipaddress.c b/ip/ipaddress.c +index b8d9c7d..7492075 100644 +--- a/ip/ipaddress.c ++++ b/ip/ipaddress.c +@@ -1356,7 +1356,7 @@ static int restore_handler(const struct sockaddr_nl *nl, + + ll_init_map(&rth); + +- ret = rtnl_talk(&rth, n, n, sizeof(*n)); ++ ret = rtnl_talk(&rth, n, NULL); + if ((ret < 0) && (errno == EEXIST)) + ret = 0; + +@@ -2064,7 +2064,7 @@ static int ipaddr_modify(int cmd, int flags, int argc, char **argv) + return -1; + } + +- if (rtnl_talk(&rth, &req.n, NULL, 0) < 0) ++ if (rtnl_talk(&rth, &req.n, NULL) < 0) + return -2; + + return 0; +diff --git a/ip/ipaddrlabel.c b/ip/ipaddrlabel.c +index 1d324da..6ea9bff 100644 +--- a/ip/ipaddrlabel.c ++++ b/ip/ipaddrlabel.c +@@ -176,7 +176,7 @@ static int ipaddrlabel_modify(int cmd, int argc, char **argv) + if (req.ifal.ifal_family == AF_UNSPEC) + req.ifal.ifal_family = AF_INET6; + +- if (rtnl_talk(&rth, &req.n, NULL, 0) < 0) ++ if (rtnl_talk(&rth, &req.n, NULL) < 0) + return -2; + + return 0; +@@ -203,7 +203,7 @@ static int flush_addrlabel(const struct sockaddr_nl *who, struct nlmsghdr *n, vo + if (rtnl_open(&rth2, 0) < 0) + return -1; + +- if (rtnl_talk(&rth2, n, NULL, 0) < 0) ++ if (rtnl_talk(&rth2, n, NULL) < 0) + return -2; + + rtnl_close(&rth2); +diff --git a/ip/ipfou.c b/ip/ipfou.c +index 00dbe15..23000dc 100644 +--- a/ip/ipfou.c ++++ b/ip/ipfou.c +@@ -116,7 +116,7 @@ static int do_add(int argc, char **argv) + + fou_parse_opt(argc, argv, &req.n, true); + +- if (rtnl_talk(&genl_rth, &req.n, NULL, 0) < 0) ++ if (rtnl_talk(&genl_rth, &req.n, NULL) < 0) + return -2; + + return 0; +@@ -128,7 +128,7 @@ static int do_del(int argc, char **argv) + + fou_parse_opt(argc, argv, &req.n, false); + +- if (rtnl_talk(&genl_rth, &req.n, NULL, 0) < 0) ++ if (rtnl_talk(&genl_rth, &req.n, NULL) < 0) + return -2; + + return 0; +diff --git a/ip/ipila.c b/ip/ipila.c +index 843cc16..0403fc4 100644 +--- a/ip/ipila.c ++++ b/ip/ipila.c +@@ -220,7 +220,7 @@ static int do_add(int argc, char **argv) + + ila_parse_opt(argc, argv, &req.n, true); + +- if (rtnl_talk(&genl_rth, &req.n, NULL, 0) < 0) ++ if (rtnl_talk(&genl_rth, &req.n, NULL) < 0) + return -2; + + return 0; +@@ -232,7 +232,7 @@ static int do_del(int argc, char **argv) + + ila_parse_opt(argc, argv, &req.n, false); + +- if (rtnl_talk(&genl_rth, &req.n, NULL, 0) < 0) ++ if (rtnl_talk(&genl_rth, &req.n, NULL) < 0) + return -2; + + return 0; +diff --git a/ip/ipl2tp.c b/ip/ipl2tp.c +index 88664c9..742adbe 100644 +--- a/ip/ipl2tp.c ++++ b/ip/ipl2tp.c +@@ -129,7 +129,7 @@ static int create_tunnel(struct l2tp_parm *p) + addattr(&req.n, 1024, L2TP_ATTR_UDP_ZERO_CSUM6_RX); + } + +- if (rtnl_talk(&genl_rth, &req.n, NULL, 0) < 0) ++ if (rtnl_talk(&genl_rth, &req.n, NULL) < 0) + return -2; + + return 0; +@@ -142,7 +142,7 @@ static int delete_tunnel(struct l2tp_parm *p) + + addattr32(&req.n, 128, L2TP_ATTR_CONN_ID, p->tunnel_id); + +- if (rtnl_talk(&genl_rth, &req.n, NULL, 0) < 0) ++ if (rtnl_talk(&genl_rth, &req.n, NULL) < 0) + return -2; + + return 0; +@@ -185,7 +185,7 @@ static int create_session(struct l2tp_parm *p) + if (p->ifname && p->ifname[0]) + addattrstrz(&req.n, 1024, L2TP_ATTR_IFNAME, p->ifname); + +- if (rtnl_talk(&genl_rth, &req.n, NULL, 0) < 0) ++ if (rtnl_talk(&genl_rth, &req.n, NULL) < 0) + return -2; + + return 0; +@@ -198,7 +198,7 @@ static int delete_session(struct l2tp_parm *p) + + addattr32(&req.n, 1024, L2TP_ATTR_CONN_ID, p->tunnel_id); + addattr32(&req.n, 1024, L2TP_ATTR_SESSION_ID, p->session_id); +- if (rtnl_talk(&genl_rth, &req.n, NULL, 0) < 0) ++ if (rtnl_talk(&genl_rth, &req.n, NULL) < 0) + return -2; + + return 0; +diff --git a/ip/iplink.c b/ip/iplink.c +index 5afbadf..b08d227 100644 +--- a/ip/iplink.c ++++ b/ip/iplink.c +@@ -247,19 +247,26 @@ static int nl_get_ll_addr_len(unsigned int dev_index) + .ifi_index = dev_index, + } + }; ++ struct nlmsghdr *answer; + struct rtattr *tb[IFLA_MAX+1]; + +- if (rtnl_talk(&rth, &req.n, &req.n, sizeof(req)) < 0) ++ if (rtnl_talk(&rth, &req.n, &answer) < 0) + return -1; + +- len = req.n.nlmsg_len - NLMSG_LENGTH(sizeof(req.i)); +- if (len < 0) ++ len = answer->nlmsg_len - NLMSG_LENGTH(sizeof(struct ifinfomsg)); ++ if (len < 0) { ++ free(answer); + return -1; ++ } + +- parse_rtattr_flags(tb, IFLA_MAX, IFLA_RTA(&req.i), len, NLA_F_NESTED); +- if (!tb[IFLA_ADDRESS]) ++ parse_rtattr_flags(tb, IFLA_MAX, IFLA_RTA(NLMSG_DATA(answer)), ++ len, NLA_F_NESTED); ++ if (!tb[IFLA_ADDRESS]) { ++ free(answer); + return -1; ++ } + ++ free(answer); + return RTA_PAYLOAD(tb[IFLA_ADDRESS]); + } + +@@ -903,7 +910,7 @@ static int iplink_modify(int cmd, unsigned int flags, int argc, char **argv) + + req.i.ifi_index = 0; + addattr32(&req.n, sizeof(req), IFLA_GROUP, group); +- if (rtnl_talk(&rth, &req.n, NULL, 0) < 0) ++ if (rtnl_talk(&rth, &req.n, NULL) < 0) + return -2; + return 0; + } +@@ -998,7 +1005,7 @@ static int iplink_modify(int cmd, unsigned int flags, int argc, char **argv) + return -1; + } + +- if (rtnl_talk(&rth, &req.n, NULL, 0) < 0) ++ if (rtnl_talk(&rth, &req.n, NULL) < 0) + return -2; + + return 0; +@@ -1013,10 +1020,7 @@ int iplink_get(unsigned int flags, char *name, __u32 filt_mask) + .n.nlmsg_type = RTM_GETLINK, + .i.ifi_family = preferred_family, + }; +- struct { +- struct nlmsghdr n; +- char buf[32768]; +- } answer; ++ struct nlmsghdr *answer; + + if (name) { + len = strlen(name) + 1; +@@ -1029,19 +1033,15 @@ int iplink_get(unsigned int flags, char *name, __u32 filt_mask) + } + addattr32(&req.n, sizeof(req), IFLA_EXT_MASK, filt_mask); + +- if (rtnl_talk(&rth, &req.n, &answer.n, sizeof(answer)) < 0) +- return -2; +- if (answer.n.nlmsg_len > sizeof(answer.buf)) { +- fprintf(stderr, "Message truncated from %u to %lu\n", +- answer.n.nlmsg_len, sizeof(answer.buf)); ++ if (rtnl_talk(&rth, &req.n, &answer) < 0) + return -2; +- } + + if (brief) +- print_linkinfo_brief(NULL, &answer.n, stdout); ++ print_linkinfo_brief(NULL, answer, stdout); + else +- print_linkinfo(NULL, &answer.n, stdout); ++ print_linkinfo(NULL, answer, stdout); + ++ free(answer); + return 0; + } + +diff --git a/ip/iplink_vrf.c b/ip/iplink_vrf.c +index 917630e..370bb86 100644 +--- a/ip/iplink_vrf.c ++++ b/ip/iplink_vrf.c +@@ -114,10 +114,7 @@ __u32 ipvrf_get_table(const char *name) + .ifi_family = preferred_family, + }, + }; +- struct { +- struct nlmsghdr n; +- char buf[8192]; +- } answer; ++ struct nlmsghdr *answer; + struct rtattr *tb[IFLA_MAX+1]; + struct rtattr *li[IFLA_INFO_MAX+1]; + struct rtattr *vrf_attr[IFLA_VRF_MAX + 1]; +@@ -127,8 +124,7 @@ __u32 ipvrf_get_table(const char *name) + + addattr_l(&req.n, sizeof(req), IFLA_IFNAME, name, strlen(name) + 1); + +- if (rtnl_talk_suppress_rtnl_errmsg(&rth, &req.n, +- &answer.n, sizeof(answer)) < 0) { ++ if (rtnl_talk_suppress_rtnl_errmsg(&rth, &req.n, &answer) < 0) { + /* special case "default" vrf to be the main table */ + if (errno == ENODEV && !strcmp(name, "default")) + rtnl_rttable_a2n(&tb_id, "main"); +@@ -136,25 +132,25 @@ __u32 ipvrf_get_table(const char *name) + return tb_id; + } + +- ifi = NLMSG_DATA(&answer.n); +- len = answer.n.nlmsg_len - NLMSG_LENGTH(sizeof(*ifi)); ++ ifi = NLMSG_DATA(answer); ++ len = answer->nlmsg_len - NLMSG_LENGTH(sizeof(*ifi)); + if (len < 0) { + fprintf(stderr, "BUG: Invalid response to link query.\n"); +- return 0; ++ goto out; + } + + parse_rtattr(tb, IFLA_MAX, IFLA_RTA(ifi), len); + + if (!tb[IFLA_LINKINFO]) +- return 0; ++ goto out; + + parse_rtattr_nested(li, IFLA_INFO_MAX, tb[IFLA_LINKINFO]); + + if (!li[IFLA_INFO_KIND] || !li[IFLA_INFO_DATA]) +- return 0; ++ goto out; + + if (strcmp(RTA_DATA(li[IFLA_INFO_KIND]), "vrf")) +- return 0; ++ goto out; + + parse_rtattr_nested(vrf_attr, IFLA_VRF_MAX, li[IFLA_INFO_DATA]); + if (vrf_attr[IFLA_VRF_TABLE]) +@@ -163,6 +159,8 @@ __u32 ipvrf_get_table(const char *name) + if (!tb_id) + fprintf(stderr, "BUG: VRF %s is missing table id\n", name); + ++out: ++ free(answer); + return tb_id; + } + +@@ -182,10 +180,7 @@ int name_is_vrf(const char *name) + .ifi_family = preferred_family, + }, + }; +- struct { +- struct nlmsghdr n; +- char buf[8192]; +- } answer; ++ struct nlmsghdr *answer; + struct rtattr *tb[IFLA_MAX+1]; + struct rtattr *li[IFLA_INFO_MAX+1]; + struct ifinfomsg *ifi; +@@ -193,29 +188,30 @@ int name_is_vrf(const char *name) + + addattr_l(&req.n, sizeof(req), IFLA_IFNAME, name, strlen(name) + 1); + +- if (rtnl_talk_suppress_rtnl_errmsg(&rth, &req.n, +- &answer.n, sizeof(answer)) < 0) ++ if (rtnl_talk_suppress_rtnl_errmsg(&rth, &req.n, &answer) < 0) + return 0; + +- ifi = NLMSG_DATA(&answer.n); +- len = answer.n.nlmsg_len - NLMSG_LENGTH(sizeof(*ifi)); ++ ifi = NLMSG_DATA(answer); ++ len = answer->nlmsg_len - NLMSG_LENGTH(sizeof(*ifi)); + if (len < 0) { + fprintf(stderr, "BUG: Invalid response to link query.\n"); +- return 0; ++ goto out; + } + + parse_rtattr(tb, IFLA_MAX, IFLA_RTA(ifi), len); + + if (!tb[IFLA_LINKINFO]) +- return 0; ++ goto out; + + parse_rtattr_nested(li, IFLA_INFO_MAX, tb[IFLA_LINKINFO]); + + if (!li[IFLA_INFO_KIND]) +- return 0; ++ goto out; + + if (strcmp(RTA_DATA(li[IFLA_INFO_KIND]), "vrf")) +- return 0; ++ goto out; + ++out: ++ free(answer); + return ifi->ifi_index; + } +diff --git a/ip/ipmacsec.c b/ip/ipmacsec.c +index aa89a00..9a2d0eb 100644 +--- a/ip/ipmacsec.c ++++ b/ip/ipmacsec.c +@@ -421,7 +421,7 @@ static int do_modify_nl(enum cmd c, enum macsec_nl_commands cmd, int ifindex, + addattr_nest_end(&req.n, attr_sa); + + talk: +- if (rtnl_talk(&genl_rth, &req.n, NULL, 0) < 0) ++ if (rtnl_talk(&genl_rth, &req.n, NULL) < 0) + return -2; + + return 0; +diff --git a/ip/ipneigh.c b/ip/ipneigh.c +index 9c38a60..32f2d55 100644 +--- a/ip/ipneigh.c ++++ b/ip/ipneigh.c +@@ -184,7 +184,7 @@ static int ipneigh_modify(int cmd, int flags, int argc, char **argv) + return -1; + } + +- if (rtnl_talk(&rth, &req.n, NULL, 0) < 0) ++ if (rtnl_talk(&rth, &req.n, NULL) < 0) + exit(2); + + return 0; +diff --git a/ip/ipnetns.c b/ip/ipnetns.c +index 4254994..1c0ade9 100644 +--- a/ip/ipnetns.c ++++ b/ip/ipnetns.c +@@ -95,12 +95,13 @@ static int get_netnsid_from_name(const char *name) + struct nlmsghdr n; + struct rtgenmsg g; + char buf[1024]; +- } answer, req = { ++ } req = { + .n.nlmsg_len = NLMSG_LENGTH(sizeof(struct rtgenmsg)), + .n.nlmsg_flags = NLM_F_REQUEST, + .n.nlmsg_type = RTM_GETNSID, + .g.rtgen_family = AF_UNSPEC, + }; ++ struct nlmsghdr *answer; + struct rtattr *tb[NETNSA_MAX + 1]; + struct rtgenmsg *rthdr; + int len, fd; +@@ -110,26 +111,30 @@ static int get_netnsid_from_name(const char *name) + return fd; + + addattr32(&req.n, 1024, NETNSA_FD, fd); +- if (rtnl_talk(&rtnsh, &req.n, &answer.n, sizeof(answer)) < 0) { ++ if (rtnl_talk(&rtnsh, &req.n, &answer) < 0) { + close(fd); + return -2; + } + close(fd); + + /* Validate message and parse attributes */ +- if (answer.n.nlmsg_type == NLMSG_ERROR) +- return -1; ++ if (answer->nlmsg_type == NLMSG_ERROR) ++ goto err_out; + +- rthdr = NLMSG_DATA(&answer.n); +- len = answer.n.nlmsg_len - NLMSG_SPACE(sizeof(*rthdr)); ++ rthdr = NLMSG_DATA(answer); ++ len = answer->nlmsg_len - NLMSG_SPACE(sizeof(*rthdr)); + if (len < 0) +- return -1; ++ goto err_out; + + parse_rtattr(tb, NETNSA_MAX, NETNS_RTA(rthdr), len); + +- if (tb[NETNSA_NSID]) ++ if (tb[NETNSA_NSID]) { ++ free(answer); + return rta_getattr_u32(tb[NETNSA_NSID]); ++ } + ++err_out: ++ free(answer); + return -1; + } + +@@ -690,7 +695,7 @@ static int set_netnsid_from_name(const char *name, int nsid) + + addattr32(&req.n, 1024, NETNSA_FD, fd); + addattr32(&req.n, 1024, NETNSA_NSID, nsid); +- if (rtnl_talk(&rth, &req.n, NULL, 0) < 0) ++ if (rtnl_talk(&rth, &req.n, NULL) < 0) + err = -2; + + close(fd); +diff --git a/ip/ipntable.c b/ip/ipntable.c +index 879626e..6506332 100644 +--- a/ip/ipntable.c ++++ b/ip/ipntable.c +@@ -306,7 +306,7 @@ static int ipntable_modify(int cmd, int flags, int argc, char **argv) + RTA_PAYLOAD(parms_rta)); + } + +- if (rtnl_talk(&rth, &req.n, NULL, 0) < 0) ++ if (rtnl_talk(&rth, &req.n, NULL) < 0) + exit(2); + + return 0; +diff --git a/ip/iproute.c b/ip/iproute.c +index 5e23613..35fdce8 100644 +--- a/ip/iproute.c ++++ b/ip/iproute.c +@@ -1271,7 +1271,7 @@ static int iproute_modify(int cmd, unsigned int flags, int argc, char **argv) + if (!type_ok && req.r.rtm_family == AF_MPLS) + req.r.rtm_type = RTN_UNICAST; + +- if (rtnl_talk(&rth, &req.n, NULL, 0) < 0) ++ if (rtnl_talk(&rth, &req.n, NULL) < 0) + return -2; + + return 0; +@@ -1649,6 +1649,7 @@ static int iproute_get(int argc, char **argv) + }; + char *idev = NULL; + char *odev = NULL; ++ struct nlmsghdr *answer; + int connected = 0; + int from_ok = 0; + unsigned int mark = 0; +@@ -1753,26 +1754,29 @@ static int iproute_get(int argc, char **argv) + + req.r.rtm_flags |= RTM_F_LOOKUP_TABLE; + +- if (rtnl_talk(&rth, &req.n, &req.n, sizeof(req)) < 0) ++ if (rtnl_talk(&rth, &req.n, &answer) < 0) + return -2; + + if (connected && !from_ok) { +- struct rtmsg *r = NLMSG_DATA(&req.n); +- int len = req.n.nlmsg_len; ++ struct rtmsg *r = NLMSG_DATA(answer); ++ int len = answer->nlmsg_len; + struct rtattr *tb[RTA_MAX+1]; + +- if (print_route(NULL, &req.n, (void *)stdout) < 0) { ++ if (print_route(NULL, answer, (void *)stdout) < 0) { + fprintf(stderr, "An error :-)\n"); ++ free(answer); + return -1; + } + +- if (req.n.nlmsg_type != RTM_NEWROUTE) { ++ if (answer->nlmsg_type != RTM_NEWROUTE) { + fprintf(stderr, "Not a route?\n"); ++ free(answer); + return -1; + } + len -= NLMSG_LENGTH(sizeof(*r)); + if (len < 0) { + fprintf(stderr, "Wrong len %d\n", len); ++ free(answer); + return -1; + } + +@@ -1783,6 +1787,7 @@ static int iproute_get(int argc, char **argv) + r->rtm_src_len = 8*RTA_PAYLOAD(tb[RTA_PREFSRC]); + } else if (!tb[RTA_SRC]) { + fprintf(stderr, "Failed to connect the route\n"); ++ free(answer); + return -1; + } + if (!odev && tb[RTA_OIF]) +@@ -1796,15 +1801,18 @@ static int iproute_get(int argc, char **argv) + req.n.nlmsg_flags = NLM_F_REQUEST; + req.n.nlmsg_type = RTM_GETROUTE; + +- if (rtnl_talk(&rth, &req.n, &req.n, sizeof(req)) < 0) ++ free(answer); ++ if (rtnl_talk(&rth, &req.n, &answer) < 0) + return -2; + } + +- if (print_route(NULL, &req.n, (void *)stdout) < 0) { ++ if (print_route(NULL, answer, (void *)stdout) < 0) { + fprintf(stderr, "An error :-)\n"); ++ free(answer); + return -1; + } + ++ free(answer); + return 0; + } + +@@ -1848,7 +1856,7 @@ restore: + + ll_init_map(&rth); + +- ret = rtnl_talk(&rth, n, n, sizeof(*n)); ++ ret = rtnl_talk(&rth, n, NULL); + if ((ret < 0) && (errno == EEXIST)) + ret = 0; + +diff --git a/ip/iprule.c b/ip/iprule.c +index 8313138..e64b4d7 100644 +--- a/ip/iprule.c ++++ b/ip/iprule.c +@@ -393,7 +393,7 @@ static int flush_rule(const struct sockaddr_nl *who, struct nlmsghdr *n, + if (rtnl_open(&rth2, 0) < 0) + return -1; + +- if (rtnl_talk(&rth2, n, NULL, 0) < 0) ++ if (rtnl_talk(&rth2, n, NULL) < 0) + return -2; + + rtnl_close(&rth2); +@@ -553,7 +553,7 @@ static int restore_handler(const struct sockaddr_nl *nl, + + ll_init_map(&rth); + +- ret = rtnl_talk(&rth, n, n, sizeof(*n)); ++ ret = rtnl_talk(&rth, n, NULL); + if ((ret < 0) && (errno == EEXIST)) + ret = 0; + +@@ -760,7 +760,7 @@ static int iprule_modify(int cmd, int argc, char **argv) + if (!table_ok && cmd == RTM_NEWRULE) + req.r.rtm_table = RT_TABLE_MAIN; + +- if (rtnl_talk(&rth, &req.n, NULL, 0) < 0) ++ if (rtnl_talk(&rth, &req.n, NULL) < 0) + return -2; + + return 0; +diff --git a/ip/iptoken.c b/ip/iptoken.c +index 1869f76..0528bad 100644 +--- a/ip/iptoken.c ++++ b/ip/iptoken.c +@@ -166,7 +166,7 @@ static int iptoken_set(int argc, char **argv, bool delete) + addattr_nest_end(&req.n, afs6); + addattr_nest_end(&req.n, afs); + +- if (rtnl_talk(&rth, &req.n, NULL, 0) < 0) ++ if (rtnl_talk(&rth, &req.n, NULL) < 0) + return -2; + + return 0; +diff --git a/ip/link_gre.c b/ip/link_gre.c +index 35d437a..ced9936 100644 +--- a/ip/link_gre.c ++++ b/ip/link_gre.c +@@ -64,7 +64,6 @@ static int gre_parse_opt(struct link_util *lu, int argc, char **argv, + struct { + struct nlmsghdr n; + struct ifinfomsg i; +- char buf[16384]; + } req = { + .n.nlmsg_len = NLMSG_LENGTH(sizeof(*ifi)), + .n.nlmsg_flags = NLM_F_REQUEST, +@@ -72,6 +71,7 @@ static int gre_parse_opt(struct link_util *lu, int argc, char **argv, + .i.ifi_family = preferred_family, + .i.ifi_index = ifi->ifi_index, + }; ++ struct nlmsghdr *answer = NULL; + struct rtattr *tb[IFLA_MAX + 1]; + struct rtattr *linkinfo[IFLA_INFO_MAX+1]; + struct rtattr *greinfo[IFLA_GRE_MAX + 1]; +@@ -93,19 +93,20 @@ static int gre_parse_opt(struct link_util *lu, int argc, char **argv, + __u8 metadata = 0; + + if (!(n->nlmsg_flags & NLM_F_CREATE)) { +- if (rtnl_talk(&rth, &req.n, &req.n, sizeof(req)) < 0) { ++ if (rtnl_talk(&rth, &req.n, &answer) < 0) { + get_failed: + fprintf(stderr, + "Failed to get existing tunnel info.\n"); ++ free(answer); + return -1; + } + +- len = req.n.nlmsg_len; ++ len = answer->nlmsg_len; + len -= NLMSG_LENGTH(sizeof(*ifi)); + if (len < 0) + goto get_failed; + +- parse_rtattr(tb, IFLA_MAX, IFLA_RTA(&req.i), len); ++ parse_rtattr(tb, IFLA_MAX, IFLA_RTA(NLMSG_DATA(answer)), len); + + if (!tb[IFLA_LINKINFO]) + goto get_failed; +@@ -160,6 +161,8 @@ get_failed: + + if (greinfo[IFLA_GRE_COLLECT_METADATA]) + metadata = 1; ++ ++ free(answer); + } + + while (argc > 0) { +diff --git a/ip/link_gre6.c b/ip/link_gre6.c +index fe3ab64..932f9ee 100644 +--- a/ip/link_gre6.c ++++ b/ip/link_gre6.c +@@ -76,7 +76,6 @@ static int gre_parse_opt(struct link_util *lu, int argc, char **argv, + struct { + struct nlmsghdr n; + struct ifinfomsg i; +- char buf[1024]; + } req = { + .n.nlmsg_len = NLMSG_LENGTH(sizeof(*ifi)), + .n.nlmsg_flags = NLM_F_REQUEST, +@@ -84,6 +83,7 @@ static int gre_parse_opt(struct link_util *lu, int argc, char **argv, + .i.ifi_family = preferred_family, + .i.ifi_index = ifi->ifi_index, + }; ++ struct nlmsghdr *answer = NULL; + struct rtattr *tb[IFLA_MAX + 1]; + struct rtattr *linkinfo[IFLA_INFO_MAX+1]; + struct rtattr *greinfo[IFLA_GRE_MAX + 1]; +@@ -105,19 +105,20 @@ static int gre_parse_opt(struct link_util *lu, int argc, char **argv, + int len; + + if (!(n->nlmsg_flags & NLM_F_CREATE)) { +- if (rtnl_talk(&rth, &req.n, &req.n, sizeof(req)) < 0) { ++ if (rtnl_talk(&rth, &req.n, &answer) < 0) { + get_failed: + fprintf(stderr, + "Failed to get existing tunnel info.\n"); ++ free(answer); + return -1; + } + +- len = req.n.nlmsg_len; ++ len = answer->nlmsg_len; + len -= NLMSG_LENGTH(sizeof(*ifi)); + if (len < 0) + goto get_failed; + +- parse_rtattr(tb, IFLA_MAX, IFLA_RTA(&req.i), len); ++ parse_rtattr(tb, IFLA_MAX, IFLA_RTA(NLMSG_DATA(answer)), len); + + if (!tb[IFLA_LINKINFO]) + goto get_failed; +@@ -174,6 +175,8 @@ get_failed: + + if (greinfo[IFLA_GRE_ENCAP_DPORT]) + encapdport = rta_getattr_u16(greinfo[IFLA_GRE_ENCAP_DPORT]); ++ ++ free(answer); + } + + while (argc > 0) { +diff --git a/ip/link_ip6tnl.c b/ip/link_ip6tnl.c +index 6bb968d..2304364 100644 +--- a/ip/link_ip6tnl.c ++++ b/ip/link_ip6tnl.c +@@ -74,7 +74,6 @@ static int ip6tunnel_parse_opt(struct link_util *lu, int argc, char **argv, + struct { + struct nlmsghdr n; + struct ifinfomsg i; +- char buf[2048]; + } req = { + .n.nlmsg_len = NLMSG_LENGTH(sizeof(*ifi)), + .n.nlmsg_flags = NLM_F_REQUEST, +@@ -82,6 +81,7 @@ static int ip6tunnel_parse_opt(struct link_util *lu, int argc, char **argv, + .i.ifi_family = preferred_family, + .i.ifi_index = ifi->ifi_index, + }; ++ struct nlmsghdr *answer = NULL; + struct rtattr *tb[IFLA_MAX + 1]; + struct rtattr *linkinfo[IFLA_INFO_MAX+1]; + struct rtattr *iptuninfo[IFLA_IPTUN_MAX + 1]; +@@ -101,19 +101,20 @@ static int ip6tunnel_parse_opt(struct link_util *lu, int argc, char **argv, + __u8 metadata = 0; + + if (!(n->nlmsg_flags & NLM_F_CREATE)) { +- if (rtnl_talk(&rth, &req.n, &req.n, sizeof(req)) < 0) { ++ if (rtnl_talk(&rth, &req.n, &answer) < 0) { + get_failed: + fprintf(stderr, + "Failed to get existing tunnel info.\n"); ++ free(answer); + return -1; + } + +- len = req.n.nlmsg_len; ++ len = answer->nlmsg_len; + len -= NLMSG_LENGTH(sizeof(*ifi)); + if (len < 0) + goto get_failed; + +- parse_rtattr(tb, IFLA_MAX, IFLA_RTA(&req.i), len); ++ parse_rtattr(tb, IFLA_MAX, IFLA_RTA(NLMSG_DATA(answer)), len); + + if (!tb[IFLA_LINKINFO]) + goto get_failed; +@@ -153,6 +154,8 @@ get_failed: + proto = rta_getattr_u8(iptuninfo[IFLA_IPTUN_PROTO]); + if (iptuninfo[IFLA_IPTUN_COLLECT_METADATA]) + metadata = 1; ++ ++ free(answer); + } + + while (argc > 0) { +diff --git a/ip/link_iptnl.c b/ip/link_iptnl.c +index f180b92..528e287 100644 +--- a/ip/link_iptnl.c ++++ b/ip/link_iptnl.c +@@ -72,7 +72,6 @@ static int iptunnel_parse_opt(struct link_util *lu, int argc, char **argv, + struct { + struct nlmsghdr n; + struct ifinfomsg i; +- char buf[2048]; + } req = { + .n.nlmsg_len = NLMSG_LENGTH(sizeof(*ifi)), + .n.nlmsg_flags = NLM_F_REQUEST, +@@ -80,6 +79,7 @@ static int iptunnel_parse_opt(struct link_util *lu, int argc, char **argv, + .i.ifi_family = preferred_family, + .i.ifi_index = ifi->ifi_index, + }; ++ struct nlmsghdr *answer = NULL; + struct rtattr *tb[IFLA_MAX + 1]; + struct rtattr *linkinfo[IFLA_INFO_MAX+1]; + struct rtattr *iptuninfo[IFLA_IPTUN_MAX + 1]; +@@ -103,19 +103,20 @@ static int iptunnel_parse_opt(struct link_util *lu, int argc, char **argv, + __u8 metadata = 0; + + if (!(n->nlmsg_flags & NLM_F_CREATE)) { +- if (rtnl_talk(&rth, &req.n, &req.n, sizeof(req)) < 0) { ++ if (rtnl_talk(&rth, &req.n, &answer) < 0) { + get_failed: + fprintf(stderr, + "Failed to get existing tunnel info.\n"); ++ free(answer); + return -1; + } + +- len = req.n.nlmsg_len; ++ len = answer->nlmsg_len; + len -= NLMSG_LENGTH(sizeof(*ifi)); + if (len < 0) + goto get_failed; + +- parse_rtattr(tb, IFLA_MAX, IFLA_RTA(&req.i), len); ++ parse_rtattr(tb, IFLA_MAX, IFLA_RTA(NLMSG_DATA(answer)), len); + + if (!tb[IFLA_LINKINFO]) + goto get_failed; +@@ -179,6 +180,8 @@ get_failed: + rta_getattr_u16(iptuninfo[IFLA_IPTUN_6RD_RELAY_PREFIXLEN]); + if (iptuninfo[IFLA_IPTUN_COLLECT_METADATA]) + metadata = 1; ++ ++ free(answer); + } + + while (argc > 0) { +diff --git a/ip/link_vti.c b/ip/link_vti.c +index 95bc23e..d2aacbe 100644 +--- a/ip/link_vti.c ++++ b/ip/link_vti.c +@@ -51,7 +51,6 @@ static int vti_parse_opt(struct link_util *lu, int argc, char **argv, + struct { + struct nlmsghdr n; + struct ifinfomsg i; +- char buf[1024]; + } req = { + .n.nlmsg_len = NLMSG_LENGTH(sizeof(*ifi)), + .n.nlmsg_flags = NLM_F_REQUEST, +@@ -59,6 +58,7 @@ static int vti_parse_opt(struct link_util *lu, int argc, char **argv, + .i.ifi_family = preferred_family, + .i.ifi_index = ifi->ifi_index, + }; ++ struct nlmsghdr *answer = NULL; + struct rtattr *tb[IFLA_MAX + 1]; + struct rtattr *linkinfo[IFLA_INFO_MAX+1]; + struct rtattr *vtiinfo[IFLA_VTI_MAX + 1]; +@@ -70,19 +70,20 @@ static int vti_parse_opt(struct link_util *lu, int argc, char **argv, + int len; + + if (!(n->nlmsg_flags & NLM_F_CREATE)) { +- if (rtnl_talk(&rth, &req.n, &req.n, sizeof(req)) < 0) { ++ if (rtnl_talk(&rth, &req.n, &answer) < 0) { + get_failed: + fprintf(stderr, + "Failed to get existing tunnel info.\n"); ++ free(answer); + return -1; + } + +- len = req.n.nlmsg_len; ++ len = answer->nlmsg_len; + len -= NLMSG_LENGTH(sizeof(*ifi)); + if (len < 0) + goto get_failed; + +- parse_rtattr(tb, IFLA_MAX, IFLA_RTA(&req.i), len); ++ parse_rtattr(tb, IFLA_MAX, IFLA_RTA(NLMSG_DATA(answer)), len); + + if (!tb[IFLA_LINKINFO]) + goto get_failed; +@@ -109,6 +110,8 @@ get_failed: + + if (vtiinfo[IFLA_VTI_LINK]) + link = rta_getattr_u8(vtiinfo[IFLA_VTI_LINK]); ++ ++ free(answer); + } + + while (argc > 0) { +diff --git a/ip/link_vti6.c b/ip/link_vti6.c +index 9ca127a..aedfbea 100644 +--- a/ip/link_vti6.c ++++ b/ip/link_vti6.c +@@ -46,7 +46,6 @@ static int vti6_parse_opt(struct link_util *lu, int argc, char **argv, + struct { + struct nlmsghdr n; + struct ifinfomsg i; +- char buf[1024]; + } req = { + .n.nlmsg_len = NLMSG_LENGTH(sizeof(*ifi)), + .n.nlmsg_flags = NLM_F_REQUEST, +@@ -54,6 +53,7 @@ static int vti6_parse_opt(struct link_util *lu, int argc, char **argv, + .i.ifi_family = preferred_family, + .i.ifi_index = ifi->ifi_index, + }; ++ struct nlmsghdr *answer = NULL; + struct rtattr *tb[IFLA_MAX + 1]; + struct rtattr *linkinfo[IFLA_INFO_MAX+1]; + struct rtattr *vtiinfo[IFLA_VTI_MAX + 1]; +@@ -65,19 +65,20 @@ static int vti6_parse_opt(struct link_util *lu, int argc, char **argv, + int len; + + if (!(n->nlmsg_flags & NLM_F_CREATE)) { +- if (rtnl_talk(&rth, &req.n, &req.n, sizeof(req)) < 0) { ++ if (rtnl_talk(&rth, &req.n, &answer) < 0) { + get_failed: + fprintf(stderr, + "Failed to get existing tunnel info.\n"); ++ free(answer); + return -1; + } + +- len = req.n.nlmsg_len; ++ len = answer->nlmsg_len; + len -= NLMSG_LENGTH(sizeof(*ifi)); + if (len < 0) + goto get_failed; + +- parse_rtattr(tb, IFLA_MAX, IFLA_RTA(&req.i), len); ++ parse_rtattr(tb, IFLA_MAX, IFLA_RTA(NLMSG_DATA(answer)), len); + + if (!tb[IFLA_LINKINFO]) + goto get_failed; +@@ -104,6 +105,8 @@ get_failed: + + if (vtiinfo[IFLA_VTI_LINK]) + link = rta_getattr_u8(vtiinfo[IFLA_VTI_LINK]); ++ ++ free(answer); + } + + while (argc > 0) { +diff --git a/ip/tcp_metrics.c b/ip/tcp_metrics.c +index 8972acd..3f9790e 100644 +--- a/ip/tcp_metrics.c ++++ b/ip/tcp_metrics.c +@@ -306,6 +306,7 @@ static int process_msg(const struct sockaddr_nl *who, struct nlmsghdr *n, + static int tcpm_do_cmd(int cmd, int argc, char **argv) + { + TCPM_REQUEST(req, 1024, TCP_METRICS_CMD_GET, NLM_F_REQUEST); ++ struct nlmsghdr *answer; + int atype = -1, stype = -1; + int ack; + +@@ -457,15 +458,16 @@ static int tcpm_do_cmd(int cmd, int argc, char **argv) + } + + if (ack) { +- if (rtnl_talk(&grth, &req.n, NULL, 0) < 0) ++ if (rtnl_talk(&grth, &req.n, NULL) < 0) + return -2; + } else if (atype >= 0) { +- if (rtnl_talk(&grth, &req.n, &req.n, sizeof(req)) < 0) ++ if (rtnl_talk(&grth, &req.n, &answer) < 0) + return -2; +- if (process_msg(NULL, &req.n, stdout) < 0) { ++ if (process_msg(NULL, answer, stdout) < 0) { + fprintf(stderr, "Dump terminated\n"); + exit(1); + } ++ free(answer); + } else { + req.n.nlmsg_seq = grth.dump = ++grth.seq; + if (rtnl_send(&grth, &req, req.n.nlmsg_len) < 0) { +diff --git a/ip/xfrm_policy.c b/ip/xfrm_policy.c +index de689c4..98460a0 100644 +--- a/ip/xfrm_policy.c ++++ b/ip/xfrm_policy.c +@@ -386,7 +386,7 @@ static int xfrm_policy_modify(int cmd, unsigned int flags, int argc, char **argv + if (req.xpinfo.sel.family == AF_UNSPEC) + req.xpinfo.sel.family = AF_INET; + +- if (rtnl_talk(&rth, &req.n, NULL, 0) < 0) ++ if (rtnl_talk(&rth, &req.n, NULL) < 0) + exit(2); + + rtnl_close(&rth); +@@ -548,7 +548,7 @@ int xfrm_policy_print(const struct sockaddr_nl *who, struct nlmsghdr *n, + } + + static int xfrm_policy_get_or_delete(int argc, char **argv, int delete, +- void *res_nlbuf, size_t res_size) ++ struct nlmsghdr **answer) + { + struct rtnl_handle rth; + struct { +@@ -659,7 +659,7 @@ static int xfrm_policy_get_or_delete(int argc, char **argv, int delete, + (void *)&ctx, ctx.sctx.len); + } + +- if (rtnl_talk(&rth, &req.n, res_nlbuf, res_size) < 0) ++ if (rtnl_talk(&rth, &req.n, answer) < 0) + exit(2); + + rtnl_close(&rth); +@@ -669,21 +669,21 @@ static int xfrm_policy_get_or_delete(int argc, char **argv, int delete, + + static int xfrm_policy_delete(int argc, char **argv) + { +- return xfrm_policy_get_or_delete(argc, argv, 1, NULL, 0); ++ return xfrm_policy_get_or_delete(argc, argv, 1, NULL); + } + + static int xfrm_policy_get(int argc, char **argv) + { +- char buf[NLMSG_BUF_SIZE] = {}; +- struct nlmsghdr *n = (struct nlmsghdr *)buf; ++ struct nlmsghdr *n = NULL; + +- xfrm_policy_get_or_delete(argc, argv, 0, n, sizeof(buf)); ++ xfrm_policy_get_or_delete(argc, argv, 0, &n); + + if (xfrm_policy_print(NULL, n, (void *)stdout) < 0) { + fprintf(stderr, "An error :-)\n"); + exit(1); + } + ++ free(n); + return 0; + } + +@@ -1049,7 +1049,7 @@ static int xfrm_spd_setinfo(int argc, char **argv) + if (rtnl_open_byproto(&rth, 0, NETLINK_XFRM) < 0) + exit(1); + +- if (rtnl_talk(&rth, &req.n, NULL, 0) < 0) ++ if (rtnl_talk(&rth, &req.n, NULL) < 0) + exit(2); + + rtnl_close(&rth); +@@ -1063,22 +1063,23 @@ static int xfrm_spd_getinfo(int argc, char **argv) + struct { + struct nlmsghdr n; + __u32 flags; +- char ans[128]; + } req = { + .n.nlmsg_len = NLMSG_LENGTH(sizeof(__u32)), + .n.nlmsg_flags = NLM_F_REQUEST, + .n.nlmsg_type = XFRM_MSG_GETSPDINFO, + .flags = 0XFFFFFFFF, + }; ++ struct nlmsghdr *answer; + + if (rtnl_open_byproto(&rth, 0, NETLINK_XFRM) < 0) + exit(1); + +- if (rtnl_talk(&rth, &req.n, &req.n, sizeof(req)) < 0) ++ if (rtnl_talk(&rth, &req.n, &answer) < 0) + exit(2); + +- print_spdinfo(&req.n, (void *)stdout); ++ print_spdinfo(answer, (void *)stdout); + ++ free(answer); + rtnl_close(&rth); + + return 0; +@@ -1123,7 +1124,7 @@ static int xfrm_policy_flush(int argc, char **argv) + if (show_stats > 1) + fprintf(stderr, "Flush policy\n"); + +- if (rtnl_talk(&rth, &req.n, NULL, 0) < 0) ++ if (rtnl_talk(&rth, &req.n, NULL) < 0) + exit(2); + + rtnl_close(&rth); +diff --git a/ip/xfrm_state.c b/ip/xfrm_state.c +index ea7d4f3..04ed349 100644 +--- a/ip/xfrm_state.c ++++ b/ip/xfrm_state.c +@@ -677,7 +677,7 @@ static int xfrm_state_modify(int cmd, unsigned int flags, int argc, char **argv) + if (req.xsinfo.family == AF_UNSPEC) + req.xsinfo.family = AF_INET; + +- if (rtnl_talk(&rth, &req.n, NULL, 0) < 0) ++ if (rtnl_talk(&rth, &req.n, NULL) < 0) + exit(2); + + rtnl_close(&rth); +@@ -708,8 +708,7 @@ static int xfrm_state_allocspi(int argc, char **argv) + char *minp = NULL; + char *maxp = NULL; + struct xfrm_mark mark = {0, 0}; +- char res_buf[NLMSG_BUF_SIZE] = {}; +- struct nlmsghdr *res_n = (struct nlmsghdr *)res_buf; ++ struct nlmsghdr *answer; + + while (argc > 0) { + if (strcmp(*argv, "mode") == 0) { +@@ -809,14 +808,15 @@ static int xfrm_state_allocspi(int argc, char **argv) + req.xspi.info.family = AF_INET; + + +- if (rtnl_talk(&rth, &req.n, res_n, sizeof(res_buf)) < 0) ++ if (rtnl_talk(&rth, &req.n, &answer) < 0) + exit(2); + +- if (xfrm_state_print(NULL, res_n, (void *)stdout) < 0) { ++ if (xfrm_state_print(NULL, answer, (void *)stdout) < 0) { + fprintf(stderr, "An error :-)\n"); + exit(1); + } + ++ free(answer); + rtnl_close(&rth); + + return 0; +@@ -997,19 +997,20 @@ static int xfrm_state_get_or_delete(int argc, char **argv, int delete) + req.xsid.family = AF_INET; + + if (delete) { +- if (rtnl_talk(&rth, &req.n, NULL, 0) < 0) ++ if (rtnl_talk(&rth, &req.n, NULL) < 0) + exit(2); + } else { +- char buf[NLMSG_BUF_SIZE] = {}; +- struct nlmsghdr *res_n = (struct nlmsghdr *)buf; ++ struct nlmsghdr *answer; + +- if (rtnl_talk(&rth, &req.n, res_n, sizeof(req)) < 0) ++ if (rtnl_talk(&rth, &req.n, &answer) < 0) + exit(2); + +- if (xfrm_state_print(NULL, res_n, (void *)stdout) < 0) { ++ if (xfrm_state_print(NULL, answer, (void *)stdout) < 0) { + fprintf(stderr, "An error :-)\n"); + exit(1); + } ++ ++ free(answer); + } + + rtnl_close(&rth); +@@ -1265,22 +1266,23 @@ static int xfrm_sad_getinfo(int argc, char **argv) + struct { + struct nlmsghdr n; + __u32 flags; +- char ans[64]; + } req = { + .n.nlmsg_len = NLMSG_LENGTH(sizeof(req.flags)), + .n.nlmsg_flags = NLM_F_REQUEST, + .n.nlmsg_type = XFRM_MSG_GETSADINFO, + .flags = 0XFFFFFFFF, + }; ++ struct nlmsghdr *answer; + + if (rtnl_open_byproto(&rth, 0, NETLINK_XFRM) < 0) + exit(1); + +- if (rtnl_talk(&rth, &req.n, &req.n, sizeof(req)) < 0) ++ if (rtnl_talk(&rth, &req.n, &answer) < 0) + exit(2); + +- print_sadinfo(&req.n, (void *)stdout); ++ print_sadinfo(answer, (void *)stdout); + ++ free(answer); + rtnl_close(&rth); + + return 0; +@@ -1327,7 +1329,7 @@ static int xfrm_state_flush(int argc, char **argv) + fprintf(stderr, "Flush state with XFRM-PROTO value \"%s\"\n", + strxf_xfrmproto(req.xsf.proto)); + +- if (rtnl_talk(&rth, &req.n, NULL, 0) < 0) ++ if (rtnl_talk(&rth, &req.n, NULL) < 0) + exit(2); + + rtnl_close(&rth); +diff --git a/lib/libgenl.c b/lib/libgenl.c +index 50d2d92..bb5fbb5 100644 +--- a/lib/libgenl.c ++++ b/lib/libgenl.c +@@ -49,16 +49,21 @@ int genl_resolve_family(struct rtnl_handle *grth, const char *family) + { + GENL_REQUEST(req, 1024, GENL_ID_CTRL, 0, 0, CTRL_CMD_GETFAMILY, + NLM_F_REQUEST); ++ struct nlmsghdr *answer; ++ int fnum; + + addattr_l(&req.n, sizeof(req), CTRL_ATTR_FAMILY_NAME, + family, strlen(family) + 1); + +- if (rtnl_talk(grth, &req.n, &req.n, sizeof(req)) < 0) { ++ if (rtnl_talk(grth, &req.n, &answer) < 0) { + fprintf(stderr, "Error talking to the kernel\n"); + return -2; + } + +- return genl_parse_getfamily(&req.n); ++ fnum = genl_parse_getfamily(answer); ++ free(answer); ++ ++ return fnum; + } + + int genl_init_handle(struct rtnl_handle *grth, const char *family, +diff --git a/lib/libnetlink.c b/lib/libnetlink.c +index 446c960..75e20ab 100644 +--- a/lib/libnetlink.c ++++ b/lib/libnetlink.c +@@ -561,7 +561,7 @@ static void rtnl_talk_error(struct nlmsghdr *h, struct nlmsgerr *err, + } + + static int __rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, +- struct nlmsghdr *answer, size_t maxlen, ++ struct nlmsghdr **answer, + bool show_rtnl_err, nl_ext_ack_fn_t errfn) + { + int status; +@@ -635,9 +635,9 @@ static int __rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, + fprintf(stderr, "ERROR truncated\n"); + } else if (!err->error) { + if (answer) +- memcpy(answer, h, +- MIN(maxlen, h->nlmsg_len)); +- free(buf); ++ *answer = (struct nlmsghdr *)buf; ++ else ++ free(buf); + return 0; + } + +@@ -651,9 +651,7 @@ static int __rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, + } + + if (answer) { +- memcpy(answer, h, +- MIN(maxlen, h->nlmsg_len)); +- free(buf); ++ *answer = (struct nlmsghdr *)buf; + return 0; + } + +@@ -677,22 +675,22 @@ static int __rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, + } + + int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, +- struct nlmsghdr *answer, size_t maxlen) ++ struct nlmsghdr **answer) + { +- return __rtnl_talk(rtnl, n, answer, maxlen, true, NULL); ++ return __rtnl_talk(rtnl, n, answer, true, NULL); + } + + int rtnl_talk_extack(struct rtnl_handle *rtnl, struct nlmsghdr *n, +- struct nlmsghdr *answer, size_t maxlen, ++ struct nlmsghdr **answer, + nl_ext_ack_fn_t errfn) + { +- return __rtnl_talk(rtnl, n, answer, maxlen, true, errfn); ++ return __rtnl_talk(rtnl, n, answer, true, errfn); + } + + int rtnl_talk_suppress_rtnl_errmsg(struct rtnl_handle *rtnl, struct nlmsghdr *n, +- struct nlmsghdr *answer, size_t maxlen) ++ struct nlmsghdr **answer) + { +- return __rtnl_talk(rtnl, n, answer, maxlen, false, NULL); ++ return __rtnl_talk(rtnl, n, answer, false, NULL); + } + + int rtnl_listen_all_nsid(struct rtnl_handle *rth) +diff --git a/misc/ss.c b/misc/ss.c +index b84baf3..d3fb9a7 100644 +--- a/misc/ss.c ++++ b/misc/ss.c +@@ -2588,7 +2588,7 @@ static int kill_inet_sock(struct nlmsghdr *h, void *arg, struct sockstat *s) + raw->sdiag_raw_protocol = s->raw_prot; + } + +- return rtnl_talk(rth, &req.nlh, NULL, 0); ++ return rtnl_talk(rth, &req.nlh, NULL); + } + + static int show_one_inet_sock(const struct sockaddr_nl *addr, +diff --git a/tc/m_action.c b/tc/m_action.c +index 6ebe85e..90b2a11 100644 +--- a/tc/m_action.c ++++ b/tc/m_action.c +@@ -506,18 +506,18 @@ static int tc_action_gd(int cmd, unsigned int flags, int *argc_p, char ***argv_p + tail->rta_len = (void *) NLMSG_TAIL(&req.n) - (void *) tail; + + req.n.nlmsg_seq = rth.dump = ++rth.seq; +- if (cmd == RTM_GETACTION) +- ans = &req.n; + +- if (rtnl_talk(&rth, &req.n, ans, MAX_MSG) < 0) { ++ if (rtnl_talk(&rth, &req.n, &ans) < 0) { + fprintf(stderr, "We have an error talking to the kernel\n"); + return 1; + } + +- if (ans && print_action(NULL, &req.n, (void *)stdout) < 0) { ++ if (cmd == RTM_GETACTION && print_action(NULL, ans, stdout) < 0) { + fprintf(stderr, "Dump terminated\n"); ++ free(ans); + return 1; + } ++ free(ans); + + *argc_p = argc; + *argv_p = argv; +@@ -550,7 +550,7 @@ static int tc_action_modify(int cmd, unsigned int flags, int *argc_p, char ***ar + } + tail->rta_len = (void *) NLMSG_TAIL(&req.n) - (void *) tail; + +- if (rtnl_talk(&rth, &req.n, NULL, 0) < 0) { ++ if (rtnl_talk(&rth, &req.n, NULL) < 0) { + fprintf(stderr, "We have an error talking to the kernel\n"); + ret = -1; + } +@@ -617,7 +617,7 @@ static int tc_act_list_or_flush(int argc, char **argv, int event) + req.n.nlmsg_type = RTM_DELACTION; + req.n.nlmsg_flags |= NLM_F_ROOT; + req.n.nlmsg_flags |= NLM_F_REQUEST; +- if (rtnl_talk(&rth, &req.n, NULL, 0) < 0) { ++ if (rtnl_talk(&rth, &req.n, NULL) < 0) { + fprintf(stderr, "We have an error flushing\n"); + return 1; + } +diff --git a/tc/tc_class.c b/tc/tc_class.c +index 1a1f1fa..0214775 100644 +--- a/tc/tc_class.c ++++ b/tc/tc_class.c +@@ -149,7 +149,7 @@ static int tc_class_modify(int cmd, unsigned int flags, int argc, char **argv) + } + } + +- if (rtnl_talk(&rth, &req.n, NULL, 0) < 0) ++ if (rtnl_talk(&rth, &req.n, NULL) < 0) + return 2; + + return 0; +diff --git a/tc/tc_filter.c b/tc/tc_filter.c +index ff8713b..e640492 100644 +--- a/tc/tc_filter.c ++++ b/tc/tc_filter.c +@@ -181,7 +181,7 @@ static int tc_filter_modify(int cmd, unsigned int flags, int argc, char **argv) + } + } + +- if (rtnl_talk(&rth, &req.n, NULL, 0) < 0) { ++ if (rtnl_talk(&rth, &req.n, NULL) < 0) { + fprintf(stderr, "We have an error talking to the kernel\n"); + return 2; + } +@@ -307,6 +307,7 @@ static int tc_filter_get(int cmd, unsigned int flags, int argc, char **argv) + .t.tcm_parent = TC_H_UNSPEC, + .t.tcm_family = AF_UNSPEC, + }; ++ struct nlmsghdr *answer; + struct filter_util *q = NULL; + __u32 prio = 0; + __u32 protocol = 0; +@@ -445,13 +446,14 @@ static int tc_filter_get(int cmd, unsigned int flags, int argc, char **argv) + return -1; + } + +- if (rtnl_talk(&rth, &req.n, &req.n, MAX_MSG) < 0) { ++ if (rtnl_talk(&rth, &req.n, &answer) < 0) { + fprintf(stderr, "We have an error talking to the kernel\n"); + return 2; + } + +- print_filter(NULL, &req.n, (void *)stdout); ++ print_filter(NULL, answer, (void *)stdout); + ++ free(answer); + return 0; + } + +diff --git a/tc/tc_qdisc.c b/tc/tc_qdisc.c +index 3a3701c..8b0c5c7 100644 +--- a/tc/tc_qdisc.c ++++ b/tc/tc_qdisc.c +@@ -190,7 +190,7 @@ static int tc_qdisc_modify(int cmd, unsigned int flags, int argc, char **argv) + req.t.tcm_ifindex = idx; + } + +- if (rtnl_talk(&rth, &req.n, NULL, 0) < 0) ++ if (rtnl_talk(&rth, &req.n, NULL) < 0) + return 2; + + return 0; +-- +1.8.3.1 + diff --git a/SOURCES/0024-Revert-man-ip-link-Remove-bits-about-proxy_arp-and-p.patch b/SOURCES/0024-Revert-man-ip-link-Remove-bits-about-proxy_arp-and-p.patch deleted file mode 100644 index 4d812d3..0000000 --- a/SOURCES/0024-Revert-man-ip-link-Remove-bits-about-proxy_arp-and-p.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 64afb125ce17483937f3988a7b76ef0e100c2fcc Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 12:21:21 +0100 -Subject: [PATCH] Revert "man: ip-link: Remove bits about proxy_arp and - proxy_arp_wifi" - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1374360 -Upstream Status: RHEL only. - -This reverts commit 75b314be0b22357ef564e451bc8d8dd1b9de74aa. ---- - man/man8/ip-link.8.in | 15 ++++++++++++++- - 1 file changed, 14 insertions(+), 1 deletion(-) - -diff --git a/man/man8/ip-link.8.in b/man/man8/ip-link.8.in -index cfd996a..73cd86d 100644 ---- a/man/man8/ip-link.8.in -+++ b/man/man8/ip-link.8.in -@@ -1130,6 +1130,10 @@ the following additional arguments are supported: - ] [ - .BR flood " { " on " | " off " }" - ] [ -+.BR proxy_arp " { " on " | " off " }" -+] [ -+.BR proxy_arp_wifi " { " on " | " off " }" -+] [ - .BI mcast_router " MULTICAST_ROUTER" - ] [ - .BR mcast_fast_leave " { " on " | " off "} ]" -@@ -1170,7 +1174,16 @@ port to be reflected back. - - .BR flood " { " on " | " off " }" - - open the flood gates on this port, i.e. forward all unicast frames to this --port also. -+port also. Requires -+.BR proxy_arp " and " proxy_arp_wifi -+to be turned off. -+ -+.BR proxy_arp " { " on " | " off " }" -+- enable proxy ARP on this port. -+ -+.BR proxy_arp_wifi " { " on " | " off " }" -+- enable proxy ARP on this port which meets extended requirements by IEEE -+802.11 and Hotspot 2.0 specifications. - - .BI mcast_router " MULTICAST_ROUTER" - - configure this port for having multicast routers attached. A port with a --- -1.8.3.1 - diff --git a/SOURCES/0024-Update-linux-headers.patch b/SOURCES/0024-Update-linux-headers.patch new file mode 100644 index 0000000..a7c413c --- /dev/null +++ b/SOURCES/0024-Update-linux-headers.patch @@ -0,0 +1,2048 @@ +From 7f123fac8aa0ff7741777935121e1b394c56e75a Mon Sep 17 00:00:00 2001 +From: Phil Sutter +Date: Fri, 10 Nov 2017 10:19:43 +0100 +Subject: [PATCH] Update linux headers + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1456539 + +This updates include/linux to the state just before commit 596b1c94aa38e +("iproute: build more easily on Android"). +--- + include/linux/bpf.h | 253 ++++++++++++++++++++++- + include/linux/can/vxcan.h | 12 ++ + include/linux/devlink.h | 92 ++++++++- + include/linux/elf-em.h | 1 - + include/linux/if_arp.h | 2 + + include/linux/if_ether.h | 6 + + include/linux/if_link.h | 37 +++- + include/linux/if_packet.h | 1 + + include/linux/if_tunnel.h | 4 + + include/linux/inet_diag.h | 2 + + include/linux/ipsec.h | 47 +++++ + include/linux/lwtunnel.h | 1 + + include/linux/magic.h | 3 + + include/linux/mpls_iptunnel.h | 2 + + include/linux/neighbour.h | 1 + + include/linux/netlink.h | 67 +++++- + include/linux/netlink_diag.h | 10 + + include/linux/pfkeyv2.h | 383 +++++++++++++++++++++++++++++++++++ + include/linux/pkt_cls.h | 37 +++- + include/linux/pkt_sched.h | 8 + + include/linux/rtnetlink.h | 36 +++- + include/linux/sctp.h | 38 ++++ + include/linux/seg6.h | 54 +++++ + include/linux/seg6_genl.h | 32 +++ + include/linux/seg6_hmac.h | 22 ++ + include/linux/seg6_iptunnel.h | 40 ++++ + include/linux/seg6_local.h | 68 +++++++ + include/linux/tc_act/tc_bpf.h | 1 + + include/linux/tc_act/tc_tunnel_key.h | 1 + + include/linux/tcp.h | 27 ++- + include/linux/xfrm.h | 9 + + 31 files changed, 1272 insertions(+), 25 deletions(-) + create mode 100644 include/linux/can/vxcan.h + create mode 100644 include/linux/ipsec.h + create mode 100644 include/linux/pfkeyv2.h + create mode 100644 include/linux/seg6.h + create mode 100644 include/linux/seg6_genl.h + create mode 100644 include/linux/seg6_hmac.h + create mode 100644 include/linux/seg6_iptunnel.h + create mode 100644 include/linux/seg6_local.h + +diff --git a/include/linux/bpf.h b/include/linux/bpf.h +index 178e20c..0895a52 100644 +--- a/include/linux/bpf.h ++++ b/include/linux/bpf.h +@@ -30,9 +30,14 @@ + #define BPF_FROM_LE BPF_TO_LE + #define BPF_FROM_BE BPF_TO_BE + ++/* jmp encodings */ + #define BPF_JNE 0x50 /* jump != */ ++#define BPF_JLT 0xa0 /* LT is unsigned, '<' */ ++#define BPF_JLE 0xb0 /* LE is unsigned, '<=' */ + #define BPF_JSGT 0x60 /* SGT is signed '>', GT in x86 */ + #define BPF_JSGE 0x70 /* SGE is signed '>=', GE in x86 */ ++#define BPF_JSLT 0xc0 /* SLT is signed, '<' */ ++#define BPF_JSLE 0xd0 /* SLE is signed, '<=' */ + #define BPF_CALL 0x80 /* function call */ + #define BPF_EXIT 0x90 /* function return */ + +@@ -81,6 +86,12 @@ enum bpf_cmd { + BPF_OBJ_GET, + BPF_PROG_ATTACH, + BPF_PROG_DETACH, ++ BPF_PROG_TEST_RUN, ++ BPF_PROG_GET_NEXT_ID, ++ BPF_MAP_GET_NEXT_ID, ++ BPF_PROG_GET_FD_BY_ID, ++ BPF_MAP_GET_FD_BY_ID, ++ BPF_OBJ_GET_INFO_BY_FD, + }; + + enum bpf_map_type { +@@ -96,6 +107,10 @@ enum bpf_map_type { + BPF_MAP_TYPE_LRU_HASH, + BPF_MAP_TYPE_LRU_PERCPU_HASH, + BPF_MAP_TYPE_LPM_TRIE, ++ BPF_MAP_TYPE_ARRAY_OF_MAPS, ++ BPF_MAP_TYPE_HASH_OF_MAPS, ++ BPF_MAP_TYPE_DEVMAP, ++ BPF_MAP_TYPE_SOCKMAP, + }; + + enum bpf_prog_type { +@@ -112,12 +127,17 @@ enum bpf_prog_type { + BPF_PROG_TYPE_LWT_IN, + BPF_PROG_TYPE_LWT_OUT, + BPF_PROG_TYPE_LWT_XMIT, ++ BPF_PROG_TYPE_SOCK_OPS, ++ BPF_PROG_TYPE_SK_SKB, + }; + + enum bpf_attach_type { + BPF_CGROUP_INET_INGRESS, + BPF_CGROUP_INET_EGRESS, + BPF_CGROUP_INET_SOCK_CREATE, ++ BPF_CGROUP_SOCK_OPS, ++ BPF_SK_SKB_STREAM_PARSER, ++ BPF_SK_SKB_STREAM_VERDICT, + __MAX_BPF_ATTACH_TYPE + }; + +@@ -129,6 +149,13 @@ enum bpf_attach_type { + */ + #define BPF_F_ALLOW_OVERRIDE (1U << 0) + ++/* If BPF_F_STRICT_ALIGNMENT is used in BPF_PROG_LOAD command, the ++ * verifier will perform strict alignment checking as if the kernel ++ * has been built with CONFIG_EFFICIENT_UNALIGNED_ACCESS not set, ++ * and NET_IP_ALIGN defined to 2. ++ */ ++#define BPF_F_STRICT_ALIGNMENT (1U << 0) ++ + #define BPF_PSEUDO_MAP_FD 1 + + /* flags for BPF_MAP_UPDATE_ELEM command */ +@@ -136,6 +163,7 @@ enum bpf_attach_type { + #define BPF_NOEXIST 1 /* create new element if it didn't exist */ + #define BPF_EXIST 2 /* update existing element */ + ++/* flags for BPF_MAP_CREATE command */ + #define BPF_F_NO_PREALLOC (1U << 0) + /* Instead of having one common LRU list in the + * BPF_MAP_TYPE_LRU_[PERCPU_]HASH map, use a percpu LRU list +@@ -144,6 +172,8 @@ enum bpf_attach_type { + * across different LRU lists. + */ + #define BPF_F_NO_COMMON_LRU (1U << 1) ++/* Specify numa node during map creation */ ++#define BPF_F_NUMA_NODE (1U << 2) + + union bpf_attr { + struct { /* anonymous struct used by BPF_MAP_CREATE command */ +@@ -151,7 +181,13 @@ union bpf_attr { + __u32 key_size; /* size of key in bytes */ + __u32 value_size; /* size of value in bytes */ + __u32 max_entries; /* max number of entries in a map */ +- __u32 map_flags; /* prealloc or not */ ++ __u32 map_flags; /* BPF_MAP_CREATE related ++ * flags defined above. ++ */ ++ __u32 inner_map_fd; /* fd pointing to the inner map */ ++ __u32 numa_node; /* numa node (effective only if ++ * BPF_F_NUMA_NODE is set). ++ */ + }; + + struct { /* anonymous struct used by BPF_MAP_*_ELEM commands */ +@@ -173,6 +209,7 @@ union bpf_attr { + __u32 log_size; /* size of user buffer */ + __aligned_u64 log_buf; /* user supplied buffer */ + __u32 kern_version; /* checked when prog_type=kprobe */ ++ __u32 prog_flags; + }; + + struct { /* anonymous struct used by BPF_OBJ_* commands */ +@@ -186,6 +223,32 @@ union bpf_attr { + __u32 attach_type; + __u32 attach_flags; + }; ++ ++ struct { /* anonymous struct used by BPF_PROG_TEST_RUN command */ ++ __u32 prog_fd; ++ __u32 retval; ++ __u32 data_size_in; ++ __u32 data_size_out; ++ __aligned_u64 data_in; ++ __aligned_u64 data_out; ++ __u32 repeat; ++ __u32 duration; ++ } test; ++ ++ struct { /* anonymous struct used by BPF_*_GET_*_ID */ ++ union { ++ __u32 start_id; ++ __u32 prog_id; ++ __u32 map_id; ++ }; ++ __u32 next_id; ++ }; ++ ++ struct { /* anonymous struct used by BPF_OBJ_GET_INFO_BY_FD */ ++ __u32 bpf_fd; ++ __u32 info_len; ++ __aligned_u64 info; ++ } info; + } __attribute__((aligned(8))); + + /* BPF helper function descriptions: +@@ -290,26 +353,40 @@ union bpf_attr { + * @flags: room for future extensions + * Return: 0 on success or negative error + * +- * u64 bpf_perf_event_read(&map, index) +- * Return: Number events read or error code ++ * u64 bpf_perf_event_read(map, flags) ++ * read perf event counter value ++ * @map: pointer to perf_event_array map ++ * @flags: index of event in the map or bitmask flags ++ * Return: value of perf event counter read or error code + * + * int bpf_redirect(ifindex, flags) + * redirect to another netdev + * @ifindex: ifindex of the net device +- * @flags: bit 0 - if set, redirect to ingress instead of egress +- * other bits - reserved +- * Return: TC_ACT_REDIRECT ++ * @flags: ++ * cls_bpf: ++ * bit 0 - if set, redirect to ingress instead of egress ++ * other bits - reserved ++ * xdp_bpf: ++ * all bits - reserved ++ * Return: cls_bpf: TC_ACT_REDIRECT on success or TC_ACT_SHOT on error ++ * xdp_bfp: XDP_REDIRECT on success or XDP_ABORT on error ++ * int bpf_redirect_map(map, key, flags) ++ * redirect to endpoint in map ++ * @map: pointer to dev map ++ * @key: index in map to lookup ++ * @flags: -- ++ * Return: XDP_REDIRECT on success or XDP_ABORT on error + * + * u32 bpf_get_route_realm(skb) + * retrieve a dst's tclassid + * @skb: pointer to skb + * Return: realm if != 0 + * +- * int bpf_perf_event_output(ctx, map, index, data, size) ++ * int bpf_perf_event_output(ctx, map, flags, data, size) + * output perf raw sample + * @ctx: struct pt_regs* + * @map: pointer to perf_event_array map +- * @index: index of event in the map ++ * @flags: index of event in the map or bitmask flags + * @data: data on stack to be output as raw data + * @size: size of data + * Return: 0 on success or negative error +@@ -456,6 +533,55 @@ union bpf_attr { + * Return: + * > 0 length of the string including the trailing NUL on success + * < 0 error ++ * ++ * u64 bpf_get_socket_cookie(skb) ++ * Get the cookie for the socket stored inside sk_buff. ++ * @skb: pointer to skb ++ * Return: 8 Bytes non-decreasing number on success or 0 if the socket ++ * field is missing inside sk_buff ++ * ++ * u32 bpf_get_socket_uid(skb) ++ * Get the owner uid of the socket stored inside sk_buff. ++ * @skb: pointer to skb ++ * Return: uid of the socket owner on success or overflowuid if failed. ++ * ++ * u32 bpf_set_hash(skb, hash) ++ * Set full skb->hash. ++ * @skb: pointer to skb ++ * @hash: hash to set ++ * ++ * int bpf_setsockopt(bpf_socket, level, optname, optval, optlen) ++ * Calls setsockopt. Not all opts are available, only those with ++ * integer optvals plus TCP_CONGESTION. ++ * Supported levels: SOL_SOCKET and IPROTO_TCP ++ * @bpf_socket: pointer to bpf_socket ++ * @level: SOL_SOCKET or IPROTO_TCP ++ * @optname: option name ++ * @optval: pointer to option value ++ * @optlen: length of optval in byes ++ * Return: 0 or negative error ++ * ++ * int bpf_skb_adjust_room(skb, len_diff, mode, flags) ++ * Grow or shrink room in sk_buff. ++ * @skb: pointer to skb ++ * @len_diff: (signed) amount of room to grow/shrink ++ * @mode: operation mode (enum bpf_adj_room_mode) ++ * @flags: reserved for future use ++ * Return: 0 on success or negative error code ++ * ++ * int bpf_sk_redirect_map(map, key, flags) ++ * Redirect skb to a sock in map using key as a lookup key for the ++ * sock in map. ++ * @map: pointer to sockmap ++ * @key: key to lookup sock in map ++ * @flags: reserved for future use ++ * Return: SK_REDIRECT ++ * ++ * int bpf_sock_map_update(skops, map, key, flags) ++ * @skops: pointer to bpf_sock_ops ++ * @map: pointer to sockmap to update ++ * @key: key to insert/update sock in map ++ * @flags: same flags as map update elem + */ + #define __BPF_FUNC_MAPPER(FN) \ + FN(unspec), \ +@@ -503,7 +629,15 @@ union bpf_attr { + FN(get_numa_node_id), \ + FN(skb_change_head), \ + FN(xdp_adjust_head), \ +- FN(probe_read_str), ++ FN(probe_read_str), \ ++ FN(get_socket_cookie), \ ++ FN(get_socket_uid), \ ++ FN(set_hash), \ ++ FN(setsockopt), \ ++ FN(skb_adjust_room), \ ++ FN(redirect_map), \ ++ FN(sk_redirect_map), \ ++ FN(sock_map_update), \ + + /* integer value in 'imm' field of BPF_CALL instruction selects which helper + * function eBPF program intends to call +@@ -553,6 +687,11 @@ enum bpf_func_id { + /* BPF_FUNC_perf_event_output for sk_buff input context. */ + #define BPF_F_CTXLEN_MASK (0xfffffULL << 32) + ++/* Mode for BPF_FUNC_skb_adjust_room helper. */ ++enum bpf_adj_room_mode { ++ BPF_ADJ_ROOM_NET, ++}; ++ + /* user accessible mirror of in-kernel sk_buff. + * new fields can only be added to the end of this structure + */ +@@ -574,6 +713,16 @@ struct __sk_buff { + __u32 tc_classid; + __u32 data; + __u32 data_end; ++ __u32 napi_id; ++ ++ /* accessed by BPF_PROG_TYPE_sk_skb types */ ++ __u32 family; ++ __u32 remote_ip4; /* Stored in network byte order */ ++ __u32 local_ip4; /* Stored in network byte order */ ++ __u32 remote_ip6[4]; /* Stored in network byte order */ ++ __u32 local_ip6[4]; /* Stored in network byte order */ ++ __u32 remote_port; /* Stored in network byte order */ ++ __u32 local_port; /* stored in host byte order */ + }; + + struct bpf_tunnel_key { +@@ -609,20 +758,23 @@ struct bpf_sock { + __u32 family; + __u32 type; + __u32 protocol; ++ __u32 mark; ++ __u32 priority; + }; + + #define XDP_PACKET_HEADROOM 256 + + /* User return codes for XDP prog type. + * A valid XDP program must return one of these defined values. All other +- * return codes are reserved for future use. Unknown return codes will result +- * in packet drop. ++ * return codes are reserved for future use. Unknown return codes will ++ * result in packet drops and a warning via bpf_warn_invalid_xdp_action(). + */ + enum xdp_action { + XDP_ABORTED = 0, + XDP_DROP, + XDP_PASS, + XDP_TX, ++ XDP_REDIRECT, + }; + + /* user accessible metadata for XDP packet hook +@@ -633,4 +785,83 @@ struct xdp_md { + __u32 data_end; + }; + ++enum sk_action { ++ SK_ABORTED = 0, ++ SK_DROP, ++ SK_REDIRECT, ++}; ++ ++#define BPF_TAG_SIZE 8 ++ ++struct bpf_prog_info { ++ __u32 type; ++ __u32 id; ++ __u8 tag[BPF_TAG_SIZE]; ++ __u32 jited_prog_len; ++ __u32 xlated_prog_len; ++ __aligned_u64 jited_prog_insns; ++ __aligned_u64 xlated_prog_insns; ++} __attribute__((aligned(8))); ++ ++struct bpf_map_info { ++ __u32 type; ++ __u32 id; ++ __u32 key_size; ++ __u32 value_size; ++ __u32 max_entries; ++ __u32 map_flags; ++} __attribute__((aligned(8))); ++ ++/* User bpf_sock_ops struct to access socket values and specify request ops ++ * and their replies. ++ * Some of this fields are in network (bigendian) byte order and may need ++ * to be converted before use (bpf_ntohl() defined in samples/bpf/bpf_endian.h). ++ * New fields can only be added at the end of this structure ++ */ ++struct bpf_sock_ops { ++ __u32 op; ++ union { ++ __u32 reply; ++ __u32 replylong[4]; ++ }; ++ __u32 family; ++ __u32 remote_ip4; /* Stored in network byte order */ ++ __u32 local_ip4; /* Stored in network byte order */ ++ __u32 remote_ip6[4]; /* Stored in network byte order */ ++ __u32 local_ip6[4]; /* Stored in network byte order */ ++ __u32 remote_port; /* Stored in network byte order */ ++ __u32 local_port; /* stored in host byte order */ ++}; ++ ++/* List of known BPF sock_ops operators. ++ * New entries can only be added at the end ++ */ ++enum { ++ BPF_SOCK_OPS_VOID, ++ BPF_SOCK_OPS_TIMEOUT_INIT, /* Should return SYN-RTO value to use or ++ * -1 if default value should be used ++ */ ++ BPF_SOCK_OPS_RWND_INIT, /* Should return initial advertized ++ * window (in packets) or -1 if default ++ * value should be used ++ */ ++ BPF_SOCK_OPS_TCP_CONNECT_CB, /* Calls BPF program right before an ++ * active connection is initialized ++ */ ++ BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB, /* Calls BPF program when an ++ * active connection is ++ * established ++ */ ++ BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB, /* Calls BPF program when a ++ * passive connection is ++ * established ++ */ ++ BPF_SOCK_OPS_NEEDS_ECN, /* If connection's congestion control ++ * needs ECN ++ */ ++}; ++ ++#define TCP_BPF_IW 1001 /* Set TCP initial congestion window */ ++#define TCP_BPF_SNDCWND_CLAMP 1002 /* Set sndcwnd_clamp */ ++ + #endif /* __LINUX_BPF_H__ */ +diff --git a/include/linux/can/vxcan.h b/include/linux/can/vxcan.h +new file mode 100644 +index 0000000..5b29e8a +--- /dev/null ++++ b/include/linux/can/vxcan.h +@@ -0,0 +1,12 @@ ++#ifndef _CAN_VXCAN_H ++#define _CAN_VXCAN_H ++ ++enum { ++ VXCAN_INFO_UNSPEC, ++ VXCAN_INFO_PEER, ++ ++ __VXCAN_INFO_MAX ++#define VXCAN_INFO_MAX (__VXCAN_INFO_MAX - 1) ++}; ++ ++#endif +diff --git a/include/linux/devlink.h b/include/linux/devlink.h +index 2ad3585..a62695e 100644 +--- a/include/linux/devlink.h ++++ b/include/linux/devlink.h +@@ -65,8 +65,12 @@ enum devlink_command { + #define DEVLINK_CMD_ESWITCH_MODE_SET /* obsolete, never use this! */ \ + DEVLINK_CMD_ESWITCH_SET + +- /* add new commands above here */ ++ DEVLINK_CMD_DPIPE_TABLE_GET, ++ DEVLINK_CMD_DPIPE_ENTRIES_GET, ++ DEVLINK_CMD_DPIPE_HEADERS_GET, ++ DEVLINK_CMD_DPIPE_TABLE_COUNTERS_SET, + ++ /* add new commands above here */ + __DEVLINK_CMD_MAX, + DEVLINK_CMD_MAX = __DEVLINK_CMD_MAX - 1 + }; +@@ -115,6 +119,11 @@ enum devlink_eswitch_inline_mode { + DEVLINK_ESWITCH_INLINE_MODE_TRANSPORT, + }; + ++enum devlink_eswitch_encap_mode { ++ DEVLINK_ESWITCH_ENCAP_MODE_NONE, ++ DEVLINK_ESWITCH_ENCAP_MODE_BASIC, ++}; ++ + enum devlink_attr { + /* don't change the order or add anything between, this is ABI! */ + DEVLINK_ATTR_UNSPEC, +@@ -148,10 +157,91 @@ enum devlink_attr { + DEVLINK_ATTR_ESWITCH_MODE, /* u16 */ + DEVLINK_ATTR_ESWITCH_INLINE_MODE, /* u8 */ + ++ DEVLINK_ATTR_DPIPE_TABLES, /* nested */ ++ DEVLINK_ATTR_DPIPE_TABLE, /* nested */ ++ DEVLINK_ATTR_DPIPE_TABLE_NAME, /* string */ ++ DEVLINK_ATTR_DPIPE_TABLE_SIZE, /* u64 */ ++ DEVLINK_ATTR_DPIPE_TABLE_MATCHES, /* nested */ ++ DEVLINK_ATTR_DPIPE_TABLE_ACTIONS, /* nested */ ++ DEVLINK_ATTR_DPIPE_TABLE_COUNTERS_ENABLED, /* u8 */ ++ ++ DEVLINK_ATTR_DPIPE_ENTRIES, /* nested */ ++ DEVLINK_ATTR_DPIPE_ENTRY, /* nested */ ++ DEVLINK_ATTR_DPIPE_ENTRY_INDEX, /* u64 */ ++ DEVLINK_ATTR_DPIPE_ENTRY_MATCH_VALUES, /* nested */ ++ DEVLINK_ATTR_DPIPE_ENTRY_ACTION_VALUES, /* nested */ ++ DEVLINK_ATTR_DPIPE_ENTRY_COUNTER, /* u64 */ ++ ++ DEVLINK_ATTR_DPIPE_MATCH, /* nested */ ++ DEVLINK_ATTR_DPIPE_MATCH_VALUE, /* nested */ ++ DEVLINK_ATTR_DPIPE_MATCH_TYPE, /* u32 */ ++ ++ DEVLINK_ATTR_DPIPE_ACTION, /* nested */ ++ DEVLINK_ATTR_DPIPE_ACTION_VALUE, /* nested */ ++ DEVLINK_ATTR_DPIPE_ACTION_TYPE, /* u32 */ ++ ++ DEVLINK_ATTR_DPIPE_VALUE, ++ DEVLINK_ATTR_DPIPE_VALUE_MASK, ++ DEVLINK_ATTR_DPIPE_VALUE_MAPPING, /* u32 */ ++ ++ DEVLINK_ATTR_DPIPE_HEADERS, /* nested */ ++ DEVLINK_ATTR_DPIPE_HEADER, /* nested */ ++ DEVLINK_ATTR_DPIPE_HEADER_NAME, /* string */ ++ DEVLINK_ATTR_DPIPE_HEADER_ID, /* u32 */ ++ DEVLINK_ATTR_DPIPE_HEADER_FIELDS, /* nested */ ++ DEVLINK_ATTR_DPIPE_HEADER_GLOBAL, /* u8 */ ++ DEVLINK_ATTR_DPIPE_HEADER_INDEX, /* u32 */ ++ ++ DEVLINK_ATTR_DPIPE_FIELD, /* nested */ ++ DEVLINK_ATTR_DPIPE_FIELD_NAME, /* string */ ++ DEVLINK_ATTR_DPIPE_FIELD_ID, /* u32 */ ++ DEVLINK_ATTR_DPIPE_FIELD_BITWIDTH, /* u32 */ ++ DEVLINK_ATTR_DPIPE_FIELD_MAPPING_TYPE, /* u32 */ ++ ++ DEVLINK_ATTR_PAD, ++ ++ DEVLINK_ATTR_ESWITCH_ENCAP_MODE, /* u8 */ ++ + /* add new attributes above here, update the policy in devlink.c */ + + __DEVLINK_ATTR_MAX, + DEVLINK_ATTR_MAX = __DEVLINK_ATTR_MAX - 1 + }; + ++/* Mapping between internal resource described by the field and system ++ * structure ++ */ ++enum devlink_dpipe_field_mapping_type { ++ DEVLINK_DPIPE_FIELD_MAPPING_TYPE_NONE, ++ DEVLINK_DPIPE_FIELD_MAPPING_TYPE_IFINDEX, ++}; ++ ++/* Match type - specify the type of the match */ ++enum devlink_dpipe_match_type { ++ DEVLINK_DPIPE_MATCH_TYPE_FIELD_EXACT, ++}; ++ ++/* Action type - specify the action type */ ++enum devlink_dpipe_action_type { ++ DEVLINK_DPIPE_ACTION_TYPE_FIELD_MODIFY, ++}; ++ ++enum devlink_dpipe_field_ethernet_id { ++ DEVLINK_DPIPE_FIELD_ETHERNET_DST_MAC, ++}; ++ ++enum devlink_dpipe_field_ipv4_id { ++ DEVLINK_DPIPE_FIELD_IPV4_DST_IP, ++}; ++ ++enum devlink_dpipe_field_ipv6_id { ++ DEVLINK_DPIPE_FIELD_IPV6_DST_IP, ++}; ++ ++enum devlink_dpipe_header_id { ++ DEVLINK_DPIPE_HEADER_ETHERNET, ++ DEVLINK_DPIPE_HEADER_IPV4, ++ DEVLINK_DPIPE_HEADER_IPV6, ++}; ++ + #endif /* _LINUX_DEVLINK_H_ */ +diff --git a/include/linux/elf-em.h b/include/linux/elf-em.h +index cb5d1a5..9cd1de9 100644 +--- a/include/linux/elf-em.h ++++ b/include/linux/elf-em.h +@@ -42,7 +42,6 @@ + #define EM_TILEGX 191 /* Tilera TILE-Gx */ + #define EM_BPF 247 /* Linux BPF - in-kernel virtual machine */ + #define EM_FRV 0x5441 /* Fujitsu FR-V */ +-#define EM_AVR32 0x18ad /* Atmel AVR32 */ + + /* + * This is an interim value that we will use until the committee comes +diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h +index d001bdb..199f253 100644 +--- a/include/linux/if_arp.h ++++ b/include/linux/if_arp.h +@@ -59,6 +59,7 @@ + #define ARPHRD_LAPB 516 /* LAPB */ + #define ARPHRD_DDCMP 517 /* Digital's DDCMP protocol */ + #define ARPHRD_RAWHDLC 518 /* Raw HDLC */ ++#define ARPHRD_RAWIP 519 /* Raw IP */ + + #define ARPHRD_TUNNEL 768 /* IPIP tunnel */ + #define ARPHRD_TUNNEL6 769 /* IP6IP6 tunnel */ +@@ -95,6 +96,7 @@ + #define ARPHRD_IP6GRE 823 /* GRE over IPv6 */ + #define ARPHRD_NETLINK 824 /* Netlink header */ + #define ARPHRD_6LOWPAN 825 /* IPv6 over LoWPAN */ ++#define ARPHRD_VSOCKMON 826 /* Vsock monitor header */ + + #define ARPHRD_VOID 0xFFFF /* Void type, nothing is known */ + #define ARPHRD_NONE 0xFFFE /* zero header length */ +diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h +index b7d3beb..7dde037 100644 +--- a/include/linux/if_ether.h ++++ b/include/linux/if_ether.h +@@ -66,6 +66,7 @@ + #define ETH_P_ATALK 0x809B /* Appletalk DDP */ + #define ETH_P_AARP 0x80F3 /* Appletalk AARP */ + #define ETH_P_8021Q 0x8100 /* 802.1Q VLAN Extended Header */ ++#define ETH_P_ERSPAN 0x88BE /* ERSPAN type II */ + #define ETH_P_IPX 0x8137 /* IPX over DIX */ + #define ETH_P_IPV6 0x86DD /* IPv6 over bluebook */ + #define ETH_P_PAUSE 0x8808 /* IEEE Pause frames. See 802.3 31B */ +@@ -98,11 +99,13 @@ + #define ETH_P_FIP 0x8914 /* FCoE Initialization Protocol */ + #define ETH_P_80221 0x8917 /* IEEE 802.21 Media Independent Handover Protocol */ + #define ETH_P_HSR 0x892F /* IEC 62439-3 HSRv1 */ ++#define ETH_P_NSH 0x894F /* Network Service Header */ + #define ETH_P_LOOPBACK 0x9000 /* Ethernet loopback packet, per IEEE 802.3 */ + #define ETH_P_QINQ1 0x9100 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */ + #define ETH_P_QINQ2 0x9200 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */ + #define ETH_P_QINQ3 0x9300 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */ + #define ETH_P_EDSA 0xDADA /* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */ ++#define ETH_P_IFE 0xED3E /* ForCES inter-FE LFB type */ + #define ETH_P_AF_IUCV 0xFBFB /* IBM af_iucv [ NOT AN OFFICIALLY REGISTERED ID ] */ + + #define ETH_P_802_3_MIN 0x0600 /* If the value in the ethernet type is less than this value +@@ -137,6 +140,9 @@ + #define ETH_P_IEEE802154 0x00F6 /* IEEE802.15.4 frame */ + #define ETH_P_CAIF 0x00F7 /* ST-Ericsson CAIF protocol */ + #define ETH_P_XDSA 0x00F8 /* Multiplexed DSA protocol */ ++#define ETH_P_MAP 0x00F9 /* Qualcomm multiplexing and ++ * aggregation protocol ++ */ + + /* + * This is an Ethernet frame header. +diff --git a/include/linux/if_link.h b/include/linux/if_link.h +index b0bdbd6..1f97d05 100644 +--- a/include/linux/if_link.h ++++ b/include/linux/if_link.h +@@ -157,6 +157,7 @@ enum { + IFLA_GSO_MAX_SIZE, + IFLA_PAD, + IFLA_XDP, ++ IFLA_EVENT, + __IFLA_MAX + }; + +@@ -321,6 +322,7 @@ enum { + IFLA_BRPORT_MCAST_FLOOD, + IFLA_BRPORT_MCAST_TO_UCAST, + IFLA_BRPORT_VLAN_TUNNEL, ++ IFLA_BRPORT_BCAST_FLOOD, + __IFLA_BRPORT_MAX + }; + #define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1) +@@ -536,11 +538,18 @@ enum { + #define IFLA_PPP_MAX (__IFLA_PPP_MAX - 1) + + /* GTP section */ ++ ++enum ifla_gtp_role { ++ GTP_ROLE_GGSN = 0, ++ GTP_ROLE_SGSN, ++}; ++ + enum { + IFLA_GTP_UNSPEC, + IFLA_GTP_FD0, + IFLA_GTP_FD1, + IFLA_GTP_PDP_HASHSIZE, ++ IFLA_GTP_ROLE, + __IFLA_GTP_MAX, + }; + #define IFLA_GTP_MAX (__IFLA_GTP_MAX - 1) +@@ -878,16 +887,42 @@ enum { + /* XDP section */ + + #define XDP_FLAGS_UPDATE_IF_NOEXIST (1U << 0) +-#define XDP_FLAGS_MASK (XDP_FLAGS_UPDATE_IF_NOEXIST) ++#define XDP_FLAGS_SKB_MODE (1U << 1) ++#define XDP_FLAGS_DRV_MODE (1U << 2) ++#define XDP_FLAGS_HW_MODE (1U << 3) ++#define XDP_FLAGS_MODES (XDP_FLAGS_SKB_MODE | \ ++ XDP_FLAGS_DRV_MODE | \ ++ XDP_FLAGS_HW_MODE) ++#define XDP_FLAGS_MASK (XDP_FLAGS_UPDATE_IF_NOEXIST | \ ++ XDP_FLAGS_MODES) ++ ++/* These are stored into IFLA_XDP_ATTACHED on dump. */ ++enum { ++ XDP_ATTACHED_NONE = 0, ++ XDP_ATTACHED_DRV, ++ XDP_ATTACHED_SKB, ++ XDP_ATTACHED_HW, ++}; + + enum { + IFLA_XDP_UNSPEC, + IFLA_XDP_FD, + IFLA_XDP_ATTACHED, + IFLA_XDP_FLAGS, ++ IFLA_XDP_PROG_ID, + __IFLA_XDP_MAX, + }; + + #define IFLA_XDP_MAX (__IFLA_XDP_MAX - 1) + ++enum { ++ IFLA_EVENT_NONE, ++ IFLA_EVENT_REBOOT, /* internal reset / reboot */ ++ IFLA_EVENT_FEATURES, /* change in offload features */ ++ IFLA_EVENT_BONDING_FAILOVER, /* change in active slave */ ++ IFLA_EVENT_NOTIFY_PEERS, /* re-sent grat. arp/ndisc */ ++ IFLA_EVENT_IGMP_RESEND, /* re-sent IGMP JOIN */ ++ IFLA_EVENT_BONDING_OPTIONS, /* change in bonding options */ ++}; ++ + #endif /* _LINUX_IF_LINK_H */ +diff --git a/include/linux/if_packet.h b/include/linux/if_packet.h +index 9e7edfd..4df96a7 100644 +--- a/include/linux/if_packet.h ++++ b/include/linux/if_packet.h +@@ -66,6 +66,7 @@ struct sockaddr_ll { + #define PACKET_FANOUT_CBPF 6 + #define PACKET_FANOUT_EBPF 7 + #define PACKET_FANOUT_FLAG_ROLLOVER 0x1000 ++#define PACKET_FANOUT_FLAG_UNIQUEID 0x2000 + #define PACKET_FANOUT_FLAG_DEFRAG 0x8000 + + struct tpacket_stats { +diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h +index 4f975f5..21834ca 100644 +--- a/include/linux/if_tunnel.h ++++ b/include/linux/if_tunnel.h +@@ -75,6 +75,7 @@ enum { + IFLA_IPTUN_ENCAP_SPORT, + IFLA_IPTUN_ENCAP_DPORT, + IFLA_IPTUN_COLLECT_METADATA, ++ IFLA_IPTUN_FWMARK, + __IFLA_IPTUN_MAX, + }; + #define IFLA_IPTUN_MAX (__IFLA_IPTUN_MAX - 1) +@@ -132,6 +133,8 @@ enum { + IFLA_GRE_ENCAP_DPORT, + IFLA_GRE_COLLECT_METADATA, + IFLA_GRE_IGNORE_DF, ++ IFLA_GRE_FWMARK, ++ IFLA_GRE_ERSPAN_INDEX, + __IFLA_GRE_MAX, + }; + +@@ -147,6 +150,7 @@ enum { + IFLA_VTI_OKEY, + IFLA_VTI_LOCAL, + IFLA_VTI_REMOTE, ++ IFLA_VTI_FWMARK, + __IFLA_VTI_MAX, + }; + +diff --git a/include/linux/inet_diag.h b/include/linux/inet_diag.h +index f7bf781..bada4d7 100644 +--- a/include/linux/inet_diag.h ++++ b/include/linux/inet_diag.h +@@ -142,6 +142,8 @@ enum { + INET_DIAG_PAD, + INET_DIAG_MARK, + INET_DIAG_BBRINFO, ++ INET_DIAG_CLASS_ID, ++ INET_DIAG_MD5SIG, + __INET_DIAG_MAX, + }; + +diff --git a/include/linux/ipsec.h b/include/linux/ipsec.h +new file mode 100644 +index 0000000..d17a630 +--- /dev/null ++++ b/include/linux/ipsec.h +@@ -0,0 +1,47 @@ ++#ifndef _LINUX_IPSEC_H ++#define _LINUX_IPSEC_H ++ ++/* The definitions, required to talk to KAME racoon IKE. */ ++ ++#include ++ ++#define IPSEC_PORT_ANY 0 ++#define IPSEC_ULPROTO_ANY 255 ++#define IPSEC_PROTO_ANY 255 ++ ++enum { ++ IPSEC_MODE_ANY = 0, /* We do not support this for SA */ ++ IPSEC_MODE_TRANSPORT = 1, ++ IPSEC_MODE_TUNNEL = 2, ++ IPSEC_MODE_BEET = 3 ++}; ++ ++enum { ++ IPSEC_DIR_ANY = 0, ++ IPSEC_DIR_INBOUND = 1, ++ IPSEC_DIR_OUTBOUND = 2, ++ IPSEC_DIR_FWD = 3, /* It is our own */ ++ IPSEC_DIR_MAX = 4, ++ IPSEC_DIR_INVALID = 5 ++}; ++ ++enum { ++ IPSEC_POLICY_DISCARD = 0, ++ IPSEC_POLICY_NONE = 1, ++ IPSEC_POLICY_IPSEC = 2, ++ IPSEC_POLICY_ENTRUST = 3, ++ IPSEC_POLICY_BYPASS = 4 ++}; ++ ++enum { ++ IPSEC_LEVEL_DEFAULT = 0, ++ IPSEC_LEVEL_USE = 1, ++ IPSEC_LEVEL_REQUIRE = 2, ++ IPSEC_LEVEL_UNIQUE = 3 ++}; ++ ++#define IPSEC_MANUAL_REQID_MAX 0x3fff ++ ++#define IPSEC_REPLAYWSIZE 32 ++ ++#endif /* _LINUX_IPSEC_H */ +diff --git a/include/linux/lwtunnel.h b/include/linux/lwtunnel.h +index faa6eab..3298426 100644 +--- a/include/linux/lwtunnel.h ++++ b/include/linux/lwtunnel.h +@@ -11,6 +11,7 @@ enum lwtunnel_encap_types { + LWTUNNEL_ENCAP_IP6, + LWTUNNEL_ENCAP_SEG6, + LWTUNNEL_ENCAP_BPF, ++ LWTUNNEL_ENCAP_SEG6_LOCAL, + __LWTUNNEL_ENCAP_MAX, + }; + +diff --git a/include/linux/magic.h b/include/linux/magic.h +index e230af2..e439565 100644 +--- a/include/linux/magic.h ++++ b/include/linux/magic.h +@@ -42,6 +42,7 @@ + #define MSDOS_SUPER_MAGIC 0x4d44 /* MD */ + #define NCP_SUPER_MAGIC 0x564c /* Guess, what 0x564c is :-) */ + #define NFS_SUPER_MAGIC 0x6969 ++#define OCFS2_SUPER_MAGIC 0x7461636f + #define OPENPROM_SUPER_MAGIC 0x9fa1 + #define QNX4_SUPER_MAGIC 0x002f /* qnx4 fs detection */ + #define QNX6_SUPER_MAGIC 0x68191122 /* qnx6 fs detection */ +@@ -80,6 +81,8 @@ + #define BTRFS_TEST_MAGIC 0x73727279 + #define NSFS_MAGIC 0x6e736673 + #define BPF_FS_MAGIC 0xcafe4a11 ++#define AAFS_MAGIC 0x5a3c69f0 ++ + /* Since UDF 2.01 is ISO 13346 based... */ + #define UDF_SUPER_MAGIC 0x15013346 + #define BALLOON_KVM_MAGIC 0x13661366 +diff --git a/include/linux/mpls_iptunnel.h b/include/linux/mpls_iptunnel.h +index 4132c3c..1a0e57b 100644 +--- a/include/linux/mpls_iptunnel.h ++++ b/include/linux/mpls_iptunnel.h +@@ -16,11 +16,13 @@ + /* MPLS tunnel attributes + * [RTA_ENCAP] = { + * [MPLS_IPTUNNEL_DST] ++ * [MPLS_IPTUNNEL_TTL] + * } + */ + enum { + MPLS_IPTUNNEL_UNSPEC, + MPLS_IPTUNNEL_DST, ++ MPLS_IPTUNNEL_TTL, + __MPLS_IPTUNNEL_MAX, + }; + #define MPLS_IPTUNNEL_MAX (__MPLS_IPTUNNEL_MAX - 1) +diff --git a/include/linux/neighbour.h b/include/linux/neighbour.h +index f3d16db..3199d28 100644 +--- a/include/linux/neighbour.h ++++ b/include/linux/neighbour.h +@@ -41,6 +41,7 @@ enum { + #define NTF_MASTER 0x04 + #define NTF_PROXY 0x08 /* == ATF_PUBL */ + #define NTF_EXT_LEARNED 0x10 ++#define NTF_OFFLOADED 0x20 + #define NTF_ROUTER 0x80 + + /* +diff --git a/include/linux/netlink.h b/include/linux/netlink.h +index d1e26a2..ec0690b 100644 +--- a/include/linux/netlink.h ++++ b/include/linux/netlink.h +@@ -50,12 +50,12 @@ struct nlmsghdr { + + /* Flags values */ + +-#define NLM_F_REQUEST 1 /* It is request message. */ +-#define NLM_F_MULTI 2 /* Multipart message, terminated by NLMSG_DONE */ +-#define NLM_F_ACK 4 /* Reply with ack, with zero or error code */ +-#define NLM_F_ECHO 8 /* Echo this request */ +-#define NLM_F_DUMP_INTR 16 /* Dump was inconsistent due to sequence change */ +-#define NLM_F_DUMP_FILTERED 32 /* Dump was filtered as requested */ ++#define NLM_F_REQUEST 0x01 /* It is request message. */ ++#define NLM_F_MULTI 0x02 /* Multipart message, terminated by NLMSG_DONE */ ++#define NLM_F_ACK 0x04 /* Reply with ack, with zero or error code */ ++#define NLM_F_ECHO 0x08 /* Echo this request */ ++#define NLM_F_DUMP_INTR 0x10 /* Dump was inconsistent due to sequence change */ ++#define NLM_F_DUMP_FILTERED 0x20 /* Dump was filtered as requested */ + + /* Modifiers to GET request */ + #define NLM_F_ROOT 0x100 /* specify tree root */ +@@ -69,6 +69,13 @@ struct nlmsghdr { + #define NLM_F_CREATE 0x400 /* Create, if it does not exist */ + #define NLM_F_APPEND 0x800 /* Add to end of list */ + ++/* Modifiers to DELETE request */ ++#define NLM_F_NONREC 0x100 /* Do not delete recursively */ ++ ++/* Flags for ACK message */ ++#define NLM_F_CAPPED 0x100 /* request was capped */ ++#define NLM_F_ACK_TLVS 0x200 /* extended ACK TVLs were included */ ++ + /* + 4.4BSD ADD NLM_F_CREATE|NLM_F_EXCL + 4.4BSD CHANGE NLM_F_REPLACE +@@ -101,6 +108,37 @@ struct nlmsghdr { + struct nlmsgerr { + int error; + struct nlmsghdr msg; ++ /* ++ * followed by the message contents unless NETLINK_CAP_ACK was set ++ * or the ACK indicates success (error == 0) ++ * message length is aligned with NLMSG_ALIGN() ++ */ ++ /* ++ * followed by TLVs defined in enum nlmsgerr_attrs ++ * if NETLINK_EXT_ACK was set ++ */ ++}; ++ ++/** ++ * enum nlmsgerr_attrs - nlmsgerr attributes ++ * @NLMSGERR_ATTR_UNUSED: unused ++ * @NLMSGERR_ATTR_MSG: error message string (string) ++ * @NLMSGERR_ATTR_OFFS: offset of the invalid attribute in the original ++ * message, counting from the beginning of the header (u32) ++ * @NLMSGERR_ATTR_COOKIE: arbitrary subsystem specific cookie to ++ * be used - in the success case - to identify a created ++ * object or operation or similar (binary) ++ * @__NLMSGERR_ATTR_MAX: number of attributes ++ * @NLMSGERR_ATTR_MAX: highest attribute number ++ */ ++enum nlmsgerr_attrs { ++ NLMSGERR_ATTR_UNUSED, ++ NLMSGERR_ATTR_MSG, ++ NLMSGERR_ATTR_OFFS, ++ NLMSGERR_ATTR_COOKIE, ++ ++ __NLMSGERR_ATTR_MAX, ++ NLMSGERR_ATTR_MAX = __NLMSGERR_ATTR_MAX - 1 + }; + + #define NETLINK_ADD_MEMBERSHIP 1 +@@ -187,5 +225,22 @@ struct nlattr { + #define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1)) + #define NLA_HDRLEN ((int) NLA_ALIGN(sizeof(struct nlattr))) + ++/* Generic 32 bitflags attribute content sent to the kernel. ++ * ++ * The value is a bitmap that defines the values being set ++ * The selector is a bitmask that defines which value is legit ++ * ++ * Examples: ++ * value = 0x0, and selector = 0x1 ++ * implies we are selecting bit 1 and we want to set its value to 0. ++ * ++ * value = 0x2, and selector = 0x2 ++ * implies we are selecting bit 2 and we want to set its value to 1. ++ * ++ */ ++struct nla_bitfield32 { ++ __u32 value; ++ __u32 selector; ++}; + + #endif /* __LINUX_NETLINK_H */ +diff --git a/include/linux/netlink_diag.h b/include/linux/netlink_diag.h +index defd25f..c8c8c7d 100644 +--- a/include/linux/netlink_diag.h ++++ b/include/linux/netlink_diag.h +@@ -38,6 +38,7 @@ enum { + NETLINK_DIAG_GROUPS, + NETLINK_DIAG_RX_RING, + NETLINK_DIAG_TX_RING, ++ NETLINK_DIAG_FLAGS, + + __NETLINK_DIAG_MAX, + }; +@@ -50,5 +51,14 @@ enum { + #define NDIAG_SHOW_GROUPS 0x00000002 /* show groups of a netlink socket */ + /* deprecated since 4.6 */ + #define NDIAG_SHOW_RING_CFG 0x00000004 /* show ring configuration */ ++#define NDIAG_SHOW_FLAGS 0x00000008 /* show flags of a netlink socket */ ++ ++/* flags */ ++#define NDIAG_FLAG_CB_RUNNING 0x00000001 ++#define NDIAG_FLAG_PKTINFO 0x00000002 ++#define NDIAG_FLAG_BROADCAST_ERROR 0x00000004 ++#define NDIAG_FLAG_NO_ENOBUFS 0x00000008 ++#define NDIAG_FLAG_LISTEN_ALL_NSID 0x00000010 ++#define NDIAG_FLAG_CAP_ACK 0x00000020 + + #endif +diff --git a/include/linux/pfkeyv2.h b/include/linux/pfkeyv2.h +new file mode 100644 +index 0000000..ada7f01 +--- /dev/null ++++ b/include/linux/pfkeyv2.h +@@ -0,0 +1,383 @@ ++/* PF_KEY user interface, this is defined by rfc2367 so ++ * do not make arbitrary modifications or else this header ++ * file will not be compliant. ++ */ ++ ++#ifndef _LINUX_PFKEY2_H ++#define _LINUX_PFKEY2_H ++ ++#include ++ ++#define PF_KEY_V2 2 ++#define PFKEYV2_REVISION 199806L ++ ++struct sadb_msg { ++ __u8 sadb_msg_version; ++ __u8 sadb_msg_type; ++ __u8 sadb_msg_errno; ++ __u8 sadb_msg_satype; ++ __u16 sadb_msg_len; ++ __u16 sadb_msg_reserved; ++ __u32 sadb_msg_seq; ++ __u32 sadb_msg_pid; ++} __attribute__((packed)); ++/* sizeof(struct sadb_msg) == 16 */ ++ ++struct sadb_ext { ++ __u16 sadb_ext_len; ++ __u16 sadb_ext_type; ++} __attribute__((packed)); ++/* sizeof(struct sadb_ext) == 4 */ ++ ++struct sadb_sa { ++ __u16 sadb_sa_len; ++ __u16 sadb_sa_exttype; ++ __be32 sadb_sa_spi; ++ __u8 sadb_sa_replay; ++ __u8 sadb_sa_state; ++ __u8 sadb_sa_auth; ++ __u8 sadb_sa_encrypt; ++ __u32 sadb_sa_flags; ++} __attribute__((packed)); ++/* sizeof(struct sadb_sa) == 16 */ ++ ++struct sadb_lifetime { ++ __u16 sadb_lifetime_len; ++ __u16 sadb_lifetime_exttype; ++ __u32 sadb_lifetime_allocations; ++ __u64 sadb_lifetime_bytes; ++ __u64 sadb_lifetime_addtime; ++ __u64 sadb_lifetime_usetime; ++} __attribute__((packed)); ++/* sizeof(struct sadb_lifetime) == 32 */ ++ ++struct sadb_address { ++ __u16 sadb_address_len; ++ __u16 sadb_address_exttype; ++ __u8 sadb_address_proto; ++ __u8 sadb_address_prefixlen; ++ __u16 sadb_address_reserved; ++} __attribute__((packed)); ++/* sizeof(struct sadb_address) == 8 */ ++ ++struct sadb_key { ++ __u16 sadb_key_len; ++ __u16 sadb_key_exttype; ++ __u16 sadb_key_bits; ++ __u16 sadb_key_reserved; ++} __attribute__((packed)); ++/* sizeof(struct sadb_key) == 8 */ ++ ++struct sadb_ident { ++ __u16 sadb_ident_len; ++ __u16 sadb_ident_exttype; ++ __u16 sadb_ident_type; ++ __u16 sadb_ident_reserved; ++ __u64 sadb_ident_id; ++} __attribute__((packed)); ++/* sizeof(struct sadb_ident) == 16 */ ++ ++struct sadb_sens { ++ __u16 sadb_sens_len; ++ __u16 sadb_sens_exttype; ++ __u32 sadb_sens_dpd; ++ __u8 sadb_sens_sens_level; ++ __u8 sadb_sens_sens_len; ++ __u8 sadb_sens_integ_level; ++ __u8 sadb_sens_integ_len; ++ __u32 sadb_sens_reserved; ++} __attribute__((packed)); ++/* sizeof(struct sadb_sens) == 16 */ ++ ++/* followed by: ++ __u64 sadb_sens_bitmap[sens_len]; ++ __u64 sadb_integ_bitmap[integ_len]; */ ++ ++struct sadb_prop { ++ __u16 sadb_prop_len; ++ __u16 sadb_prop_exttype; ++ __u8 sadb_prop_replay; ++ __u8 sadb_prop_reserved[3]; ++} __attribute__((packed)); ++/* sizeof(struct sadb_prop) == 8 */ ++ ++/* followed by: ++ struct sadb_comb sadb_combs[(sadb_prop_len + ++ sizeof(__u64) - sizeof(struct sadb_prop)) / ++ sizeof(struct sadb_comb)]; */ ++ ++struct sadb_comb { ++ __u8 sadb_comb_auth; ++ __u8 sadb_comb_encrypt; ++ __u16 sadb_comb_flags; ++ __u16 sadb_comb_auth_minbits; ++ __u16 sadb_comb_auth_maxbits; ++ __u16 sadb_comb_encrypt_minbits; ++ __u16 sadb_comb_encrypt_maxbits; ++ __u32 sadb_comb_reserved; ++ __u32 sadb_comb_soft_allocations; ++ __u32 sadb_comb_hard_allocations; ++ __u64 sadb_comb_soft_bytes; ++ __u64 sadb_comb_hard_bytes; ++ __u64 sadb_comb_soft_addtime; ++ __u64 sadb_comb_hard_addtime; ++ __u64 sadb_comb_soft_usetime; ++ __u64 sadb_comb_hard_usetime; ++} __attribute__((packed)); ++/* sizeof(struct sadb_comb) == 72 */ ++ ++struct sadb_supported { ++ __u16 sadb_supported_len; ++ __u16 sadb_supported_exttype; ++ __u32 sadb_supported_reserved; ++} __attribute__((packed)); ++/* sizeof(struct sadb_supported) == 8 */ ++ ++/* followed by: ++ struct sadb_alg sadb_algs[(sadb_supported_len + ++ sizeof(__u64) - sizeof(struct sadb_supported)) / ++ sizeof(struct sadb_alg)]; */ ++ ++struct sadb_alg { ++ __u8 sadb_alg_id; ++ __u8 sadb_alg_ivlen; ++ __u16 sadb_alg_minbits; ++ __u16 sadb_alg_maxbits; ++ __u16 sadb_alg_reserved; ++} __attribute__((packed)); ++/* sizeof(struct sadb_alg) == 8 */ ++ ++struct sadb_spirange { ++ __u16 sadb_spirange_len; ++ __u16 sadb_spirange_exttype; ++ __u32 sadb_spirange_min; ++ __u32 sadb_spirange_max; ++ __u32 sadb_spirange_reserved; ++} __attribute__((packed)); ++/* sizeof(struct sadb_spirange) == 16 */ ++ ++struct sadb_x_kmprivate { ++ __u16 sadb_x_kmprivate_len; ++ __u16 sadb_x_kmprivate_exttype; ++ __u32 sadb_x_kmprivate_reserved; ++} __attribute__((packed)); ++/* sizeof(struct sadb_x_kmprivate) == 8 */ ++ ++struct sadb_x_sa2 { ++ __u16 sadb_x_sa2_len; ++ __u16 sadb_x_sa2_exttype; ++ __u8 sadb_x_sa2_mode; ++ __u8 sadb_x_sa2_reserved1; ++ __u16 sadb_x_sa2_reserved2; ++ __u32 sadb_x_sa2_sequence; ++ __u32 sadb_x_sa2_reqid; ++} __attribute__((packed)); ++/* sizeof(struct sadb_x_sa2) == 16 */ ++ ++struct sadb_x_policy { ++ __u16 sadb_x_policy_len; ++ __u16 sadb_x_policy_exttype; ++ __u16 sadb_x_policy_type; ++ __u8 sadb_x_policy_dir; ++ __u8 sadb_x_policy_reserved; ++ __u32 sadb_x_policy_id; ++ __u32 sadb_x_policy_priority; ++} __attribute__((packed)); ++/* sizeof(struct sadb_x_policy) == 16 */ ++ ++struct sadb_x_ipsecrequest { ++ __u16 sadb_x_ipsecrequest_len; ++ __u16 sadb_x_ipsecrequest_proto; ++ __u8 sadb_x_ipsecrequest_mode; ++ __u8 sadb_x_ipsecrequest_level; ++ __u16 sadb_x_ipsecrequest_reserved1; ++ __u32 sadb_x_ipsecrequest_reqid; ++ __u32 sadb_x_ipsecrequest_reserved2; ++} __attribute__((packed)); ++/* sizeof(struct sadb_x_ipsecrequest) == 16 */ ++ ++/* This defines the TYPE of Nat Traversal in use. Currently only one ++ * type of NAT-T is supported, draft-ietf-ipsec-udp-encaps-06 ++ */ ++struct sadb_x_nat_t_type { ++ __u16 sadb_x_nat_t_type_len; ++ __u16 sadb_x_nat_t_type_exttype; ++ __u8 sadb_x_nat_t_type_type; ++ __u8 sadb_x_nat_t_type_reserved[3]; ++} __attribute__((packed)); ++/* sizeof(struct sadb_x_nat_t_type) == 8 */ ++ ++/* Pass a NAT Traversal port (Source or Dest port) */ ++struct sadb_x_nat_t_port { ++ __u16 sadb_x_nat_t_port_len; ++ __u16 sadb_x_nat_t_port_exttype; ++ __be16 sadb_x_nat_t_port_port; ++ __u16 sadb_x_nat_t_port_reserved; ++} __attribute__((packed)); ++/* sizeof(struct sadb_x_nat_t_port) == 8 */ ++ ++/* Generic LSM security context */ ++struct sadb_x_sec_ctx { ++ __u16 sadb_x_sec_len; ++ __u16 sadb_x_sec_exttype; ++ __u8 sadb_x_ctx_alg; /* LSMs: e.g., selinux == 1 */ ++ __u8 sadb_x_ctx_doi; ++ __u16 sadb_x_ctx_len; ++} __attribute__((packed)); ++/* sizeof(struct sadb_sec_ctx) = 8 */ ++ ++/* Used by MIGRATE to pass addresses IKE will use to perform ++ * negotiation with the peer */ ++struct sadb_x_kmaddress { ++ __u16 sadb_x_kmaddress_len; ++ __u16 sadb_x_kmaddress_exttype; ++ __u32 sadb_x_kmaddress_reserved; ++} __attribute__((packed)); ++/* sizeof(struct sadb_x_kmaddress) == 8 */ ++ ++/* To specify the SA dump filter */ ++struct sadb_x_filter { ++ __u16 sadb_x_filter_len; ++ __u16 sadb_x_filter_exttype; ++ __u32 sadb_x_filter_saddr[4]; ++ __u32 sadb_x_filter_daddr[4]; ++ __u16 sadb_x_filter_family; ++ __u8 sadb_x_filter_splen; ++ __u8 sadb_x_filter_dplen; ++} __attribute__((packed)); ++/* sizeof(struct sadb_x_filter) == 40 */ ++ ++/* Message types */ ++#define SADB_RESERVED 0 ++#define SADB_GETSPI 1 ++#define SADB_UPDATE 2 ++#define SADB_ADD 3 ++#define SADB_DELETE 4 ++#define SADB_GET 5 ++#define SADB_ACQUIRE 6 ++#define SADB_REGISTER 7 ++#define SADB_EXPIRE 8 ++#define SADB_FLUSH 9 ++#define SADB_DUMP 10 ++#define SADB_X_PROMISC 11 ++#define SADB_X_PCHANGE 12 ++#define SADB_X_SPDUPDATE 13 ++#define SADB_X_SPDADD 14 ++#define SADB_X_SPDDELETE 15 ++#define SADB_X_SPDGET 16 ++#define SADB_X_SPDACQUIRE 17 ++#define SADB_X_SPDDUMP 18 ++#define SADB_X_SPDFLUSH 19 ++#define SADB_X_SPDSETIDX 20 ++#define SADB_X_SPDEXPIRE 21 ++#define SADB_X_SPDDELETE2 22 ++#define SADB_X_NAT_T_NEW_MAPPING 23 ++#define SADB_X_MIGRATE 24 ++#define SADB_MAX 24 ++ ++/* Security Association flags */ ++#define SADB_SAFLAGS_PFS 1 ++#define SADB_SAFLAGS_NOPMTUDISC 0x20000000 ++#define SADB_SAFLAGS_DECAP_DSCP 0x40000000 ++#define SADB_SAFLAGS_NOECN 0x80000000 ++ ++/* Security Association states */ ++#define SADB_SASTATE_LARVAL 0 ++#define SADB_SASTATE_MATURE 1 ++#define SADB_SASTATE_DYING 2 ++#define SADB_SASTATE_DEAD 3 ++#define SADB_SASTATE_MAX 3 ++ ++/* Security Association types */ ++#define SADB_SATYPE_UNSPEC 0 ++#define SADB_SATYPE_AH 2 ++#define SADB_SATYPE_ESP 3 ++#define SADB_SATYPE_RSVP 5 ++#define SADB_SATYPE_OSPFV2 6 ++#define SADB_SATYPE_RIPV2 7 ++#define SADB_SATYPE_MIP 8 ++#define SADB_X_SATYPE_IPCOMP 9 ++#define SADB_SATYPE_MAX 9 ++ ++/* Authentication algorithms */ ++#define SADB_AALG_NONE 0 ++#define SADB_AALG_MD5HMAC 2 ++#define SADB_AALG_SHA1HMAC 3 ++#define SADB_X_AALG_SHA2_256HMAC 5 ++#define SADB_X_AALG_SHA2_384HMAC 6 ++#define SADB_X_AALG_SHA2_512HMAC 7 ++#define SADB_X_AALG_RIPEMD160HMAC 8 ++#define SADB_X_AALG_AES_XCBC_MAC 9 ++#define SADB_X_AALG_NULL 251 /* kame */ ++#define SADB_AALG_MAX 251 ++ ++/* Encryption algorithms */ ++#define SADB_EALG_NONE 0 ++#define SADB_EALG_DESCBC 2 ++#define SADB_EALG_3DESCBC 3 ++#define SADB_X_EALG_CASTCBC 6 ++#define SADB_X_EALG_BLOWFISHCBC 7 ++#define SADB_EALG_NULL 11 ++#define SADB_X_EALG_AESCBC 12 ++#define SADB_X_EALG_AESCTR 13 ++#define SADB_X_EALG_AES_CCM_ICV8 14 ++#define SADB_X_EALG_AES_CCM_ICV12 15 ++#define SADB_X_EALG_AES_CCM_ICV16 16 ++#define SADB_X_EALG_AES_GCM_ICV8 18 ++#define SADB_X_EALG_AES_GCM_ICV12 19 ++#define SADB_X_EALG_AES_GCM_ICV16 20 ++#define SADB_X_EALG_CAMELLIACBC 22 ++#define SADB_X_EALG_NULL_AES_GMAC 23 ++#define SADB_EALG_MAX 253 /* last EALG */ ++/* private allocations should use 249-255 (RFC2407) */ ++#define SADB_X_EALG_SERPENTCBC 252 /* draft-ietf-ipsec-ciph-aes-cbc-00 */ ++#define SADB_X_EALG_TWOFISHCBC 253 /* draft-ietf-ipsec-ciph-aes-cbc-00 */ ++ ++/* Compression algorithms */ ++#define SADB_X_CALG_NONE 0 ++#define SADB_X_CALG_OUI 1 ++#define SADB_X_CALG_DEFLATE 2 ++#define SADB_X_CALG_LZS 3 ++#define SADB_X_CALG_LZJH 4 ++#define SADB_X_CALG_MAX 4 ++ ++/* Extension Header values */ ++#define SADB_EXT_RESERVED 0 ++#define SADB_EXT_SA 1 ++#define SADB_EXT_LIFETIME_CURRENT 2 ++#define SADB_EXT_LIFETIME_HARD 3 ++#define SADB_EXT_LIFETIME_SOFT 4 ++#define SADB_EXT_ADDRESS_SRC 5 ++#define SADB_EXT_ADDRESS_DST 6 ++#define SADB_EXT_ADDRESS_PROXY 7 ++#define SADB_EXT_KEY_AUTH 8 ++#define SADB_EXT_KEY_ENCRYPT 9 ++#define SADB_EXT_IDENTITY_SRC 10 ++#define SADB_EXT_IDENTITY_DST 11 ++#define SADB_EXT_SENSITIVITY 12 ++#define SADB_EXT_PROPOSAL 13 ++#define SADB_EXT_SUPPORTED_AUTH 14 ++#define SADB_EXT_SUPPORTED_ENCRYPT 15 ++#define SADB_EXT_SPIRANGE 16 ++#define SADB_X_EXT_KMPRIVATE 17 ++#define SADB_X_EXT_POLICY 18 ++#define SADB_X_EXT_SA2 19 ++/* The next four entries are for setting up NAT Traversal */ ++#define SADB_X_EXT_NAT_T_TYPE 20 ++#define SADB_X_EXT_NAT_T_SPORT 21 ++#define SADB_X_EXT_NAT_T_DPORT 22 ++#define SADB_X_EXT_NAT_T_OA 23 ++#define SADB_X_EXT_SEC_CTX 24 ++/* Used with MIGRATE to pass @ to IKE for negotiation */ ++#define SADB_X_EXT_KMADDRESS 25 ++#define SADB_X_EXT_FILTER 26 ++#define SADB_EXT_MAX 26 ++ ++/* Identity Extension values */ ++#define SADB_IDENTTYPE_RESERVED 0 ++#define SADB_IDENTTYPE_PREFIX 1 ++#define SADB_IDENTTYPE_FQDN 2 ++#define SADB_IDENTTYPE_USERFQDN 3 ++#define SADB_IDENTTYPE_MAX 3 ++ ++#endif /* !(_LINUX_PFKEY2_H) */ +diff --git a/include/linux/pkt_cls.h b/include/linux/pkt_cls.h +index 7a69f2a..d5e2bf6 100644 +--- a/include/linux/pkt_cls.h ++++ b/include/linux/pkt_cls.h +@@ -37,7 +37,28 @@ enum { + #define TC_ACT_QUEUED 5 + #define TC_ACT_REPEAT 6 + #define TC_ACT_REDIRECT 7 +-#define TC_ACT_JUMP 0x10000000 ++#define TC_ACT_TRAP 8 /* For hw path, this means "trap to cpu" ++ * and don't further process the frame ++ * in hardware. For sw path, this is ++ * equivalent of TC_ACT_STOLEN - drop ++ * the skb and act like everything ++ * is alright. ++ */ ++ ++/* There is a special kind of actions called "extended actions", ++ * which need a value parameter. These have a local opcode located in ++ * the highest nibble, starting from 1. The rest of the bits ++ * are used to carry the value. These two parts together make ++ * a combined opcode. ++ */ ++#define __TC_ACT_EXT_SHIFT 28 ++#define __TC_ACT_EXT(local) ((local) << __TC_ACT_EXT_SHIFT) ++#define TC_ACT_EXT_VAL_MASK ((1 << __TC_ACT_EXT_SHIFT) - 1) ++#define TC_ACT_EXT_CMP(combined, opcode) \ ++ (((combined) & (~TC_ACT_EXT_VAL_MASK)) == opcode) ++ ++#define TC_ACT_JUMP __TC_ACT_EXT(1) ++#define TC_ACT_GOTO_CHAIN __TC_ACT_EXT(2) + + /* Action type identifiers*/ + enum { +@@ -348,6 +369,7 @@ enum { + TCA_BPF_FLAGS, + TCA_BPF_FLAGS_GEN, + TCA_BPF_TAG, ++ TCA_BPF_ID, + __TCA_BPF_MAX, + }; + +@@ -432,6 +454,19 @@ enum { + TCA_FLOWER_KEY_ARP_THA, /* ETH_ALEN */ + TCA_FLOWER_KEY_ARP_THA_MASK, /* ETH_ALEN */ + ++ TCA_FLOWER_KEY_MPLS_TTL, /* u8 - 8 bits */ ++ TCA_FLOWER_KEY_MPLS_BOS, /* u8 - 1 bit */ ++ TCA_FLOWER_KEY_MPLS_TC, /* u8 - 3 bits */ ++ TCA_FLOWER_KEY_MPLS_LABEL, /* be32 - 20 bits */ ++ ++ TCA_FLOWER_KEY_TCP_FLAGS, /* be16 */ ++ TCA_FLOWER_KEY_TCP_FLAGS_MASK, /* be16 */ ++ ++ TCA_FLOWER_KEY_IP_TOS, /* u8 */ ++ TCA_FLOWER_KEY_IP_TOS_MASK, /* u8 */ ++ TCA_FLOWER_KEY_IP_TTL, /* u8 */ ++ TCA_FLOWER_KEY_IP_TTL_MASK, /* u8 */ ++ + __TCA_FLOWER_MAX, + }; + +diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h +index df7451d..099bf55 100644 +--- a/include/linux/pkt_sched.h ++++ b/include/linux/pkt_sched.h +@@ -617,6 +617,14 @@ struct tc_drr_stats { + #define TC_QOPT_BITMASK 15 + #define TC_QOPT_MAX_QUEUE 16 + ++enum { ++ TC_MQPRIO_HW_OFFLOAD_NONE, /* no offload requested */ ++ TC_MQPRIO_HW_OFFLOAD_TCS, /* offload TCs, no queue counts */ ++ __TC_MQPRIO_HW_OFFLOAD_MAX ++}; ++ ++#define TC_MQPRIO_HW_OFFLOAD_MAX (__TC_MQPRIO_HW_OFFLOAD_MAX - 1) ++ + struct tc_mqprio_qopt { + __u8 num_tc; + __u8 prio_tc_map[TC_QOPT_BITMASK + 1]; +diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h +index d42fe83..813e9e0 100644 +--- a/include/linux/rtnetlink.h ++++ b/include/linux/rtnetlink.h +@@ -122,6 +122,8 @@ enum { + + RTM_NEWNETCONF = 80, + #define RTM_NEWNETCONF RTM_NEWNETCONF ++ RTM_DELNETCONF, ++#define RTM_DELNETCONF RTM_DELNETCONF + RTM_GETNETCONF = 82, + #define RTM_GETNETCONF RTM_GETNETCONF + +@@ -144,6 +146,9 @@ enum { + RTM_GETSTATS = 94, + #define RTM_GETSTATS RTM_GETSTATS + ++ RTM_NEWCACHEREPORT = 96, ++#define RTM_NEWCACHEREPORT RTM_NEWCACHEREPORT ++ + __RTM_MAX, + #define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1) + }; +@@ -276,6 +281,7 @@ enum rt_scope_t { + #define RTM_F_EQUALIZE 0x400 /* Multipath equalizer: NI */ + #define RTM_F_PREFIX 0x800 /* Prefix addresses */ + #define RTM_F_LOOKUP_TABLE 0x1000 /* set rtm_table to FIB lookup result */ ++#define RTM_F_FIB_MATCH 0x2000 /* return full fib lookup match */ + + /* Reserved table identifiers */ + +@@ -319,6 +325,7 @@ enum rtattr_type_t { + RTA_EXPIRES, + RTA_PAD, + RTA_UID, ++ RTA_TTL_PROPAGATE, + __RTA_MAX + }; + +@@ -545,6 +552,8 @@ enum { + TCA_STATS2, + TCA_STAB, + TCA_PAD, ++ TCA_DUMP_INVISIBLE, ++ TCA_CHAIN, + __TCA_MAX + }; + +@@ -658,6 +667,10 @@ enum rtnetlink_groups { + #define RTNLGRP_NSID RTNLGRP_NSID + RTNLGRP_MPLS_NETCONF, + #define RTNLGRP_MPLS_NETCONF RTNLGRP_MPLS_NETCONF ++ RTNLGRP_IPV4_MROUTE_R, ++#define RTNLGRP_IPV4_MROUTE_R RTNLGRP_IPV4_MROUTE_R ++ RTNLGRP_IPV6_MROUTE_R, ++#define RTNLGRP_IPV6_MROUTE_R RTNLGRP_IPV6_MROUTE_R + __RTNLGRP_MAX + }; + #define RTNLGRP_MAX (__RTNLGRP_MAX - 1) +@@ -668,10 +681,29 @@ struct tcamsg { + unsigned char tca__pad1; + unsigned short tca__pad2; + }; ++ ++enum { ++ TCA_ROOT_UNSPEC, ++ TCA_ROOT_TAB, ++#define TCA_ACT_TAB TCA_ROOT_TAB ++#define TCAA_MAX TCA_ROOT_TAB ++ TCA_ROOT_FLAGS, ++ TCA_ROOT_COUNT, ++ TCA_ROOT_TIME_DELTA, /* in msecs */ ++ __TCA_ROOT_MAX, ++#define TCA_ROOT_MAX (__TCA_ROOT_MAX - 1) ++}; ++ + #define TA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct tcamsg)))) + #define TA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct tcamsg)) +-#define TCA_ACT_TAB 1 /* attr type must be >=1 */ +-#define TCAA_MAX 1 ++/* tcamsg flags stored in attribute TCA_ROOT_FLAGS ++ * ++ * TCA_FLAG_LARGE_DUMP_ON user->kernel to request for larger than TCA_ACT_MAX_PRIO ++ * actions in a dump. All dump responses will contain the number of actions ++ * being dumped stored in for user app's consumption in TCA_ROOT_COUNT ++ * ++ */ ++#define TCA_FLAG_LARGE_DUMP_ON (1 << 0) + + /* New extended info filters for IFLA_EXT_MASK */ + #define RTEXT_FILTER_VF (1 << 0) +diff --git a/include/linux/sctp.h b/include/linux/sctp.h +index 5e08b3d..fec24c4 100644 +--- a/include/linux/sctp.h ++++ b/include/linux/sctp.h +@@ -115,10 +115,13 @@ typedef __s32 sctp_assoc_t; + #define SCTP_PR_SUPPORTED 113 + #define SCTP_DEFAULT_PRINFO 114 + #define SCTP_PR_ASSOC_STATUS 115 ++#define SCTP_PR_STREAM_STATUS 116 ++#define SCTP_RECONFIG_SUPPORTED 117 + #define SCTP_ENABLE_STREAM_RESET 118 + #define SCTP_RESET_STREAMS 119 + #define SCTP_RESET_ASSOC 120 + #define SCTP_ADD_STREAMS 121 ++#define SCTP_SOCKOPT_PEELOFF_FLAGS 122 + + /* PR-SCTP policies */ + #define SCTP_PR_SCTP_NONE 0x0000 +@@ -502,6 +505,28 @@ struct sctp_stream_reset_event { + __u16 strreset_stream_list[]; + }; + ++#define SCTP_ASSOC_RESET_DENIED 0x0004 ++#define SCTP_ASSOC_RESET_FAILED 0x0008 ++struct sctp_assoc_reset_event { ++ __u16 assocreset_type; ++ __u16 assocreset_flags; ++ __u32 assocreset_length; ++ sctp_assoc_t assocreset_assoc_id; ++ __u32 assocreset_local_tsn; ++ __u32 assocreset_remote_tsn; ++}; ++ ++#define SCTP_ASSOC_CHANGE_DENIED 0x0004 ++#define SCTP_ASSOC_CHANGE_FAILED 0x0008 ++struct sctp_stream_change_event { ++ __u16 strchange_type; ++ __u16 strchange_flags; ++ __u32 strchange_length; ++ sctp_assoc_t strchange_assoc_id; ++ __u16 strchange_instrms; ++ __u16 strchange_outstrms; ++}; ++ + /* + * Described in Section 7.3 + * Ancillary Data and Notification Interest Options +@@ -518,6 +543,8 @@ struct sctp_event_subscribe { + __u8 sctp_authentication_event; + __u8 sctp_sender_dry_event; + __u8 sctp_stream_reset_event; ++ __u8 sctp_assoc_reset_event; ++ __u8 sctp_stream_change_event; + }; + + /* +@@ -543,6 +570,8 @@ union sctp_notification { + struct sctp_authkey_event sn_authkey_event; + struct sctp_sender_dry_event sn_sender_dry_event; + struct sctp_stream_reset_event sn_strreset_event; ++ struct sctp_assoc_reset_event sn_assocreset_event; ++ struct sctp_stream_change_event sn_strchange_event; + }; + + /* Section 5.3.1 +@@ -572,6 +601,10 @@ enum sctp_sn_type { + #define SCTP_SENDER_DRY_EVENT SCTP_SENDER_DRY_EVENT + SCTP_STREAM_RESET_EVENT, + #define SCTP_STREAM_RESET_EVENT SCTP_STREAM_RESET_EVENT ++ SCTP_ASSOC_RESET_EVENT, ++#define SCTP_ASSOC_RESET_EVENT SCTP_ASSOC_RESET_EVENT ++ SCTP_STREAM_CHANGE_EVENT, ++#define SCTP_STREAM_CHANGE_EVENT SCTP_STREAM_CHANGE_EVENT + }; + + /* Notification error codes used to fill up the error fields in some +@@ -940,6 +973,11 @@ typedef struct { + int sd; + } sctp_peeloff_arg_t; + ++typedef struct { ++ sctp_peeloff_arg_t p_arg; ++ unsigned flags; ++} sctp_peeloff_flags_arg_t; ++ + /* + * Peer Address Thresholds socket option + */ +diff --git a/include/linux/seg6.h b/include/linux/seg6.h +new file mode 100644 +index 0000000..0715279 +--- /dev/null ++++ b/include/linux/seg6.h +@@ -0,0 +1,54 @@ ++/* ++ * SR-IPv6 implementation ++ * ++ * Author: ++ * David Lebrun ++ * ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version ++ * 2 of the License, or (at your option) any later version. ++ */ ++ ++#ifndef _LINUX_SEG6_H ++#define _LINUX_SEG6_H ++ ++#include ++#include /* For struct in6_addr. */ ++ ++/* ++ * SRH ++ */ ++struct ipv6_sr_hdr { ++ __u8 nexthdr; ++ __u8 hdrlen; ++ __u8 type; ++ __u8 segments_left; ++ __u8 first_segment; ++ __u8 flags; ++ __u16 reserved; ++ ++ struct in6_addr segments[0]; ++}; ++ ++#define SR6_FLAG1_PROTECTED (1 << 6) ++#define SR6_FLAG1_OAM (1 << 5) ++#define SR6_FLAG1_ALERT (1 << 4) ++#define SR6_FLAG1_HMAC (1 << 3) ++ ++#define SR6_TLV_INGRESS 1 ++#define SR6_TLV_EGRESS 2 ++#define SR6_TLV_OPAQUE 3 ++#define SR6_TLV_PADDING 4 ++#define SR6_TLV_HMAC 5 ++ ++#define sr_has_hmac(srh) ((srh)->flags & SR6_FLAG1_HMAC) ++ ++struct sr6_tlv { ++ __u8 type; ++ __u8 len; ++ __u8 data[0]; ++}; ++ ++#endif +diff --git a/include/linux/seg6_genl.h b/include/linux/seg6_genl.h +new file mode 100644 +index 0000000..99382f9 +--- /dev/null ++++ b/include/linux/seg6_genl.h +@@ -0,0 +1,32 @@ ++#ifndef _LINUX_SEG6_GENL_H ++#define _LINUX_SEG6_GENL_H ++ ++#define SEG6_GENL_NAME "SEG6" ++#define SEG6_GENL_VERSION 0x1 ++ ++enum { ++ SEG6_ATTR_UNSPEC, ++ SEG6_ATTR_DST, ++ SEG6_ATTR_DSTLEN, ++ SEG6_ATTR_HMACKEYID, ++ SEG6_ATTR_SECRET, ++ SEG6_ATTR_SECRETLEN, ++ SEG6_ATTR_ALGID, ++ SEG6_ATTR_HMACINFO, ++ __SEG6_ATTR_MAX, ++}; ++ ++#define SEG6_ATTR_MAX (__SEG6_ATTR_MAX - 1) ++ ++enum { ++ SEG6_CMD_UNSPEC, ++ SEG6_CMD_SETHMAC, ++ SEG6_CMD_DUMPHMAC, ++ SEG6_CMD_SET_TUNSRC, ++ SEG6_CMD_GET_TUNSRC, ++ __SEG6_CMD_MAX, ++}; ++ ++#define SEG6_CMD_MAX (__SEG6_CMD_MAX - 1) ++ ++#endif +diff --git a/include/linux/seg6_hmac.h b/include/linux/seg6_hmac.h +new file mode 100644 +index 0000000..704f93e +--- /dev/null ++++ b/include/linux/seg6_hmac.h +@@ -0,0 +1,22 @@ ++#ifndef _LINUX_SEG6_HMAC_H ++#define _LINUX_SEG6_HMAC_H ++ ++#include ++#include ++ ++#define SEG6_HMAC_SECRET_LEN 64 ++#define SEG6_HMAC_FIELD_LEN 32 ++ ++struct sr6_tlv_hmac { ++ struct sr6_tlv tlvhdr; ++ __u16 reserved; ++ __be32 hmackeyid; ++ __u8 hmac[SEG6_HMAC_FIELD_LEN]; ++}; ++ ++enum { ++ SEG6_HMAC_ALGO_SHA1 = 1, ++ SEG6_HMAC_ALGO_SHA256 = 2, ++}; ++ ++#endif +diff --git a/include/linux/seg6_iptunnel.h b/include/linux/seg6_iptunnel.h +new file mode 100644 +index 0000000..a5dc05a +--- /dev/null ++++ b/include/linux/seg6_iptunnel.h +@@ -0,0 +1,40 @@ ++/* ++ * SR-IPv6 implementation ++ * ++ * Author: ++ * David Lebrun ++ * ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version ++ * 2 of the License, or (at your option) any later version. ++ */ ++ ++#ifndef _LINUX_SEG6_IPTUNNEL_H ++#define _LINUX_SEG6_IPTUNNEL_H ++ ++#include /* For struct ipv6_sr_hdr. */ ++ ++enum { ++ SEG6_IPTUNNEL_UNSPEC, ++ SEG6_IPTUNNEL_SRH, ++ __SEG6_IPTUNNEL_MAX, ++}; ++#define SEG6_IPTUNNEL_MAX (__SEG6_IPTUNNEL_MAX - 1) ++ ++struct seg6_iptunnel_encap { ++ int mode; ++ struct ipv6_sr_hdr srh[0]; ++}; ++ ++#define SEG6_IPTUN_ENCAP_SIZE(x) ((sizeof(*x)) + (((x)->srh->hdrlen + 1) << 3)) ++ ++enum { ++ SEG6_IPTUN_MODE_INLINE, ++ SEG6_IPTUN_MODE_ENCAP, ++ SEG6_IPTUN_MODE_L2ENCAP, ++}; ++ ++ ++#endif +diff --git a/include/linux/seg6_local.h b/include/linux/seg6_local.h +new file mode 100644 +index 0000000..76b90d6 +--- /dev/null ++++ b/include/linux/seg6_local.h +@@ -0,0 +1,68 @@ ++/* ++ * SR-IPv6 implementation ++ * ++ * Author: ++ * David Lebrun ++ * ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version ++ * 2 of the License, or (at your option) any later version. ++ */ ++ ++#ifndef _LINUX_SEG6_LOCAL_H ++#define _LINUX_SEG6_LOCAL_H ++ ++#include ++ ++enum { ++ SEG6_LOCAL_UNSPEC, ++ SEG6_LOCAL_ACTION, ++ SEG6_LOCAL_SRH, ++ SEG6_LOCAL_TABLE, ++ SEG6_LOCAL_NH4, ++ SEG6_LOCAL_NH6, ++ SEG6_LOCAL_IIF, ++ SEG6_LOCAL_OIF, ++ __SEG6_LOCAL_MAX, ++}; ++#define SEG6_LOCAL_MAX (__SEG6_LOCAL_MAX - 1) ++ ++enum { ++ SEG6_LOCAL_ACTION_UNSPEC = 0, ++ /* node segment */ ++ SEG6_LOCAL_ACTION_END = 1, ++ /* adjacency segment (IPv6 cross-connect) */ ++ SEG6_LOCAL_ACTION_END_X = 2, ++ /* lookup of next seg NH in table */ ++ SEG6_LOCAL_ACTION_END_T = 3, ++ /* decap and L2 cross-connect */ ++ SEG6_LOCAL_ACTION_END_DX2 = 4, ++ /* decap and IPv6 cross-connect */ ++ SEG6_LOCAL_ACTION_END_DX6 = 5, ++ /* decap and IPv4 cross-connect */ ++ SEG6_LOCAL_ACTION_END_DX4 = 6, ++ /* decap and lookup of DA in v6 table */ ++ SEG6_LOCAL_ACTION_END_DT6 = 7, ++ /* decap and lookup of DA in v4 table */ ++ SEG6_LOCAL_ACTION_END_DT4 = 8, ++ /* binding segment with insertion */ ++ SEG6_LOCAL_ACTION_END_B6 = 9, ++ /* binding segment with encapsulation */ ++ SEG6_LOCAL_ACTION_END_B6_ENCAP = 10, ++ /* binding segment with MPLS encap */ ++ SEG6_LOCAL_ACTION_END_BM = 11, ++ /* lookup last seg in table */ ++ SEG6_LOCAL_ACTION_END_S = 12, ++ /* forward to SR-unaware VNF with static proxy */ ++ SEG6_LOCAL_ACTION_END_AS = 13, ++ /* forward to SR-unaware VNF with masquerading */ ++ SEG6_LOCAL_ACTION_END_AM = 14, ++ ++ __SEG6_LOCAL_ACTION_MAX, ++}; ++ ++#define SEG6_LOCAL_ACTION_MAX (__SEG6_LOCAL_ACTION_MAX - 1) ++ ++#endif +diff --git a/include/linux/tc_act/tc_bpf.h b/include/linux/tc_act/tc_bpf.h +index 975b50d..8dc2ac0 100644 +--- a/include/linux/tc_act/tc_bpf.h ++++ b/include/linux/tc_act/tc_bpf.h +@@ -28,6 +28,7 @@ enum { + TCA_ACT_BPF_NAME, + TCA_ACT_BPF_PAD, + TCA_ACT_BPF_TAG, ++ TCA_ACT_BPF_ID, + __TCA_ACT_BPF_MAX, + }; + #define TCA_ACT_BPF_MAX (__TCA_ACT_BPF_MAX - 1) +diff --git a/include/linux/tc_act/tc_tunnel_key.h b/include/linux/tc_act/tc_tunnel_key.h +index 84ea55e..afcd4be 100644 +--- a/include/linux/tc_act/tc_tunnel_key.h ++++ b/include/linux/tc_act/tc_tunnel_key.h +@@ -34,6 +34,7 @@ enum { + TCA_TUNNEL_KEY_ENC_KEY_ID, /* be64 */ + TCA_TUNNEL_KEY_PAD, + TCA_TUNNEL_KEY_ENC_DST_PORT, /* be16 */ ++ TCA_TUNNEL_KEY_NO_CSUM, /* u8 */ + __TCA_TUNNEL_KEY_MAX, + }; + +diff --git a/include/linux/tcp.h b/include/linux/tcp.h +index d34fb5c..8edad3f 100644 +--- a/include/linux/tcp.h ++++ b/include/linux/tcp.h +@@ -117,6 +117,8 @@ enum { + #define TCP_SAVED_SYN 28 /* Get SYN headers recorded for connection */ + #define TCP_REPAIR_WINDOW 29 /* Get/set window parameters */ + #define TCP_FASTOPEN_CONNECT 30 /* Attempt FastOpen with connect */ ++#define TCP_ULP 31 /* Attach a ULP to a TCP connection */ ++#define TCP_MD5SIG_EXT 32 /* TCP MD5 Signature with extensions */ + + struct tcp_repair_opt { + __u32 opt_code; +@@ -229,17 +231,38 @@ enum { + TCP_NLA_SNDBUF_LIMITED, /* Time (usec) limited by send buffer */ + TCP_NLA_DATA_SEGS_OUT, /* Data pkts sent including retransmission */ + TCP_NLA_TOTAL_RETRANS, /* Data pkts retransmitted */ ++ TCP_NLA_PACING_RATE, /* Pacing rate in bytes per second */ ++ TCP_NLA_DELIVERY_RATE, /* Delivery rate in bytes per second */ ++ TCP_NLA_SND_CWND, /* Sending congestion window */ ++ TCP_NLA_REORDERING, /* Reordering metric */ ++ TCP_NLA_MIN_RTT, /* minimum RTT */ ++ TCP_NLA_RECUR_RETRANS, /* Recurring retransmits for the current pkt */ ++ TCP_NLA_DELIVERY_RATE_APP_LMT, /* delivery rate application limited ? */ ++ + }; + + /* for TCP_MD5SIG socket option */ + #define TCP_MD5SIG_MAXKEYLEN 80 + ++/* tcp_md5sig extension flags for TCP_MD5SIG_EXT */ ++#define TCP_MD5SIG_FLAG_PREFIX 1 /* address prefix length */ ++ + struct tcp_md5sig { + struct __kernel_sockaddr_storage tcpm_addr; /* address associated */ +- __u16 __tcpm_pad1; /* zero */ ++ __u8 tcpm_flags; /* extension flags */ ++ __u8 tcpm_prefixlen; /* address prefix */ + __u16 tcpm_keylen; /* key length */ +- __u32 __tcpm_pad2; /* zero */ ++ __u32 __tcpm_pad; /* zero */ + __u8 tcpm_key[TCP_MD5SIG_MAXKEYLEN]; /* key (binary) */ + }; + ++/* INET_DIAG_MD5SIG */ ++struct tcp_diag_md5sig { ++ __u8 tcpm_family; ++ __u8 tcpm_prefixlen; ++ __u16 tcpm_keylen; ++ __be32 tcpm_addr[4]; ++ __u8 tcpm_key[TCP_MD5SIG_MAXKEYLEN]; ++}; ++ + #endif /* _LINUX_TCP_H */ +diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h +index d2dd1fd..5790293 100644 +--- a/include/linux/xfrm.h ++++ b/include/linux/xfrm.h +@@ -303,6 +303,8 @@ enum xfrm_attr_type_t { + XFRMA_PROTO, /* __u8 */ + XFRMA_ADDRESS_FILTER, /* struct xfrm_address_filter */ + XFRMA_PAD, ++ XFRMA_OFFLOAD_DEV, /* struct xfrm_state_offload */ ++ XFRMA_OUTPUT_MARK, /* __u32 */ + __XFRMA_MAX + + #define XFRMA_MAX (__XFRMA_MAX - 1) +@@ -494,6 +496,13 @@ struct xfrm_address_filter { + __u8 dplen; + }; + ++struct xfrm_user_offload { ++ int ifindex; ++ __u8 flags; ++}; ++#define XFRM_OFFLOAD_IPV6 1 ++#define XFRM_OFFLOAD_INBOUND 2 ++ + /* backwards compatibility for userspace */ + #define XFRMGRP_ACQUIRE 1 + #define XFRMGRP_EXPIRE 2 +-- +1.8.3.1 + diff --git a/SOURCES/0025-devlink-Change-netlink-attribute-validation.patch b/SOURCES/0025-devlink-Change-netlink-attribute-validation.patch new file mode 100644 index 0000000..832c7da --- /dev/null +++ b/SOURCES/0025-devlink-Change-netlink-attribute-validation.patch @@ -0,0 +1,151 @@ +From 56a3a027d053ab592a3363a92108c93c150301f5 Mon Sep 17 00:00:00 2001 +From: Kamal Heib +Date: Thu, 9 Nov 2017 04:44:32 -0500 +Subject: [PATCH] devlink: Change netlink attribute validation + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1456539 + +commit 4f10cede93b758785f5b201774ed3e02eaf1a7bb +Author: Arkadi Sharshevsky +Date: Wed May 3 13:25:22 2017 +0200 + + devlink: Change netlink attribute validation + + Currently the netlink attribute resolving is done by a sequence of + if's. Change the attribute resolving to table lookup. + + Signed-off-by: Arkadi Sharshevsky + Signed-off-by: Jiri Pirko + Reviewed-by: Greg Rose + +Signed-off-by: Kamal Heib +--- + devlink/devlink.c | 103 ++++++++++++++++-------------------------------------- + 1 file changed, 30 insertions(+), 73 deletions(-) + +diff --git a/devlink/devlink.c b/devlink/devlink.c +index e90226e..35220d8 100644 +--- a/devlink/devlink.c ++++ b/devlink/devlink.c +@@ -232,88 +232,45 @@ static bool dl_no_arg(struct dl *dl) + return dl_argc(dl) == 0; + } + ++static const enum mnl_attr_data_type devlink_policy[DEVLINK_ATTR_MAX + 1] = { ++ [DEVLINK_ATTR_BUS_NAME] = MNL_TYPE_NUL_STRING, ++ [DEVLINK_ATTR_DEV_NAME] = MNL_TYPE_NUL_STRING, ++ [DEVLINK_ATTR_PORT_INDEX] = MNL_TYPE_U32, ++ [DEVLINK_ATTR_PORT_TYPE] = MNL_TYPE_U16, ++ [DEVLINK_ATTR_PORT_DESIRED_TYPE] = MNL_TYPE_U16, ++ [DEVLINK_ATTR_PORT_NETDEV_IFINDEX] = MNL_TYPE_U32, ++ [DEVLINK_ATTR_PORT_NETDEV_NAME] = MNL_TYPE_NUL_STRING, ++ [DEVLINK_ATTR_PORT_IBDEV_NAME] = MNL_TYPE_NUL_STRING, ++ [DEVLINK_ATTR_SB_INDEX] = MNL_TYPE_U32, ++ [DEVLINK_ATTR_SB_SIZE] = MNL_TYPE_U32, ++ [DEVLINK_ATTR_SB_INGRESS_POOL_COUNT] = MNL_TYPE_U16, ++ [DEVLINK_ATTR_SB_EGRESS_POOL_COUNT] = MNL_TYPE_U16, ++ [DEVLINK_ATTR_SB_INGRESS_TC_COUNT] = MNL_TYPE_U16, ++ [DEVLINK_ATTR_SB_EGRESS_TC_COUNT] = MNL_TYPE_U16, ++ [DEVLINK_ATTR_SB_POOL_INDEX] = MNL_TYPE_U16, ++ [DEVLINK_ATTR_SB_POOL_TYPE] = MNL_TYPE_U8, ++ [DEVLINK_ATTR_SB_POOL_SIZE] = MNL_TYPE_U32, ++ [DEVLINK_ATTR_SB_POOL_THRESHOLD_TYPE] = MNL_TYPE_U8, ++ [DEVLINK_ATTR_SB_THRESHOLD] = MNL_TYPE_U32, ++ [DEVLINK_ATTR_SB_TC_INDEX] = MNL_TYPE_U16, ++ [DEVLINK_ATTR_SB_OCC_CUR] = MNL_TYPE_U32, ++ [DEVLINK_ATTR_SB_OCC_MAX] = MNL_TYPE_U32, ++ [DEVLINK_ATTR_ESWITCH_MODE] = MNL_TYPE_U16, ++ [DEVLINK_ATTR_ESWITCH_INLINE_MODE] = MNL_TYPE_U8, ++}; ++ + static int attr_cb(const struct nlattr *attr, void *data) + { + const struct nlattr **tb = data; + int type; + +- type = mnl_attr_get_type(attr); +- + if (mnl_attr_type_valid(attr, DEVLINK_ATTR_MAX) < 0) + return MNL_CB_ERROR; + +- if (type == DEVLINK_ATTR_BUS_NAME && +- mnl_attr_validate(attr, MNL_TYPE_NUL_STRING) < 0) +- return MNL_CB_ERROR; +- if (type == DEVLINK_ATTR_DEV_NAME && +- mnl_attr_validate(attr, MNL_TYPE_NUL_STRING) < 0) +- return MNL_CB_ERROR; +- if (type == DEVLINK_ATTR_PORT_INDEX && +- mnl_attr_validate(attr, MNL_TYPE_U32) < 0) +- return MNL_CB_ERROR; +- if (type == DEVLINK_ATTR_PORT_TYPE && +- mnl_attr_validate(attr, MNL_TYPE_U16) < 0) +- return MNL_CB_ERROR; +- if (type == DEVLINK_ATTR_PORT_DESIRED_TYPE && +- mnl_attr_validate(attr, MNL_TYPE_U16) < 0) +- return MNL_CB_ERROR; +- if (type == DEVLINK_ATTR_PORT_NETDEV_IFINDEX && +- mnl_attr_validate(attr, MNL_TYPE_U32) < 0) +- return MNL_CB_ERROR; +- if (type == DEVLINK_ATTR_PORT_NETDEV_NAME && +- mnl_attr_validate(attr, MNL_TYPE_NUL_STRING) < 0) +- return MNL_CB_ERROR; +- if (type == DEVLINK_ATTR_PORT_IBDEV_NAME && +- mnl_attr_validate(attr, MNL_TYPE_NUL_STRING) < 0) +- return MNL_CB_ERROR; +- if (type == DEVLINK_ATTR_SB_INDEX && +- mnl_attr_validate(attr, MNL_TYPE_U32) < 0) +- return MNL_CB_ERROR; +- if (type == DEVLINK_ATTR_SB_SIZE && +- mnl_attr_validate(attr, MNL_TYPE_U32) < 0) +- return MNL_CB_ERROR; +- if (type == DEVLINK_ATTR_SB_INGRESS_POOL_COUNT && +- mnl_attr_validate(attr, MNL_TYPE_U16) < 0) +- return MNL_CB_ERROR; +- if (type == DEVLINK_ATTR_SB_EGRESS_POOL_COUNT && +- mnl_attr_validate(attr, MNL_TYPE_U16) < 0) +- return MNL_CB_ERROR; +- if (type == DEVLINK_ATTR_SB_INGRESS_TC_COUNT && +- mnl_attr_validate(attr, MNL_TYPE_U16) < 0) +- return MNL_CB_ERROR; +- if (type == DEVLINK_ATTR_SB_EGRESS_TC_COUNT && +- mnl_attr_validate(attr, MNL_TYPE_U16) < 0) +- return MNL_CB_ERROR; +- if (type == DEVLINK_ATTR_SB_POOL_INDEX && +- mnl_attr_validate(attr, MNL_TYPE_U16) < 0) +- return MNL_CB_ERROR; +- if (type == DEVLINK_ATTR_SB_POOL_TYPE && +- mnl_attr_validate(attr, MNL_TYPE_U8) < 0) +- return MNL_CB_ERROR; +- if (type == DEVLINK_ATTR_SB_POOL_SIZE && +- mnl_attr_validate(attr, MNL_TYPE_U32) < 0) +- return MNL_CB_ERROR; +- if (type == DEVLINK_ATTR_SB_POOL_THRESHOLD_TYPE && +- mnl_attr_validate(attr, MNL_TYPE_U8) < 0) +- return MNL_CB_ERROR; +- if (type == DEVLINK_ATTR_SB_THRESHOLD && +- mnl_attr_validate(attr, MNL_TYPE_U32) < 0) +- return MNL_CB_ERROR; +- if (type == DEVLINK_ATTR_SB_TC_INDEX && +- mnl_attr_validate(attr, MNL_TYPE_U16) < 0) +- return MNL_CB_ERROR; +- if (type == DEVLINK_ATTR_SB_OCC_CUR && +- mnl_attr_validate(attr, MNL_TYPE_U32) < 0) +- return MNL_CB_ERROR; +- if (type == DEVLINK_ATTR_SB_OCC_MAX && +- mnl_attr_validate(attr, MNL_TYPE_U32) < 0) +- return MNL_CB_ERROR; +- if (type == DEVLINK_ATTR_ESWITCH_MODE && +- mnl_attr_validate(attr, MNL_TYPE_U16) < 0) +- return MNL_CB_ERROR; +- if (type == DEVLINK_ATTR_ESWITCH_INLINE_MODE && +- mnl_attr_validate(attr, MNL_TYPE_U8) < 0) ++ type = mnl_attr_get_type(attr); ++ if (mnl_attr_validate(attr, devlink_policy[type]) < 0) + return MNL_CB_ERROR; ++ + tb[type] = attr; + return MNL_CB_OK; + } +-- +1.8.3.1 + diff --git a/SOURCES/0025-iplink-bridge_slave-add-support-for-IFLA_BRPORT_PROX.patch b/SOURCES/0025-iplink-bridge_slave-add-support-for-IFLA_BRPORT_PROX.patch deleted file mode 100644 index cd11140..0000000 --- a/SOURCES/0025-iplink-bridge_slave-add-support-for-IFLA_BRPORT_PROX.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 61a81751cb25ce21c1daca887b8f0fb5d5a412ab Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 12:22:06 +0100 -Subject: [PATCH] iplink: bridge_slave: add support for IFLA_BRPORT_PROXYARP - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1374360 -Upstream Status: iproute2.git commit f6e615dec9ee9 -Conflicts: Context changes due to previously backported mcast_router and - mcast_fast_leave attributes. - -commit f6e615dec9ee9b688308e85a03a51125a9c9fdb9 -Author: Nikolay Aleksandrov -Date: Tue Feb 16 16:08:52 2016 +0100 - - iplink: bridge_slave: add support for IFLA_BRPORT_PROXYARP - - Add support to be able to view and change IFLA_BRPORT_PROXYARP port - attribute. - - Signed-off-by: Nikolay Aleksandrov ---- - ip/iplink_bridge_slave.c | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/ip/iplink_bridge_slave.c b/ip/iplink_bridge_slave.c -index 66c3a00..5a84948 100644 ---- a/ip/iplink_bridge_slave.c -+++ b/ip/iplink_bridge_slave.c -@@ -29,6 +29,7 @@ static void print_explain(FILE *f) - " [ root_block {on | off} ]\n" - " [ learning {on | off} ]\n" - " [ flood {on | off} ]\n" -+ " [ proxy_arp {on | off} ]\n" - " [ mcast_router MULTICAST_ROUTER ]\n" - " [ mcast_fast_leave {on | off} ]\n" - ); -@@ -101,6 +102,10 @@ static void bridge_slave_print_opt(struct link_util *lu, FILE *f, - print_onoff(f, "flood", - rta_getattr_u8(tb[IFLA_BRPORT_UNICAST_FLOOD])); - -+ if (tb[IFLA_BRPORT_PROXYARP]) -+ print_onoff(f, "proxy_arp", -+ rta_getattr_u8(tb[IFLA_BRPORT_PROXYARP])); -+ - if (tb[IFLA_BRPORT_MULTICAST_ROUTER]) - fprintf(f, "mcast_router %u ", - rta_getattr_u8(tb[IFLA_BRPORT_MULTICAST_ROUTER])); -@@ -172,6 +177,10 @@ static int bridge_slave_parse_opt(struct link_util *lu, int argc, char **argv, - NEXT_ARG(); - bridge_slave_parse_on_off("flood", *argv, n, - IFLA_BRPORT_UNICAST_FLOOD); -+ } else if (matches(*argv, "proxy_arp") == 0) { -+ NEXT_ARG(); -+ bridge_slave_parse_on_off("proxy_arp", *argv, n, -+ IFLA_BRPORT_PROXYARP); - } else if (matches(*argv, "mcast_router") == 0) { - __u8 mcast_router; - --- -1.8.3.1 - diff --git a/SOURCES/0026-devlink-Add-support-for-pipeline-debug-dpipe.patch b/SOURCES/0026-devlink-Add-support-for-pipeline-debug-dpipe.patch new file mode 100644 index 0000000..7bebb6c --- /dev/null +++ b/SOURCES/0026-devlink-Add-support-for-pipeline-debug-dpipe.patch @@ -0,0 +1,1597 @@ +From 120f9c488ba7d291f899f1ec2f77e0ae33efcd88 Mon Sep 17 00:00:00 2001 +From: Kamal Heib +Date: Thu, 9 Nov 2017 04:44:32 -0500 +Subject: [PATCH] devlink: Add support for pipeline debug (dpipe) + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1456539 + +commit 153c1a9b21e5b7b78e066de2b93a4edb8c3dc498 +Author: Arkadi Sharshevsky +Date: Wed May 3 13:25:23 2017 +0200 + + devlink: Add support for pipeline debug (dpipe) + + Add support for pipeline debug (dpipe). The headers are used both the + gain visibillity into the headers supported by the hardware, and to + build the headers/field database which is used by other commands. + + Examples: + + First we can see the headers supported by the hardware: + + $devlink dpipe header show pci/0000:03:00.0 + + pci/0000:03:00.0: + name mlxsw_meta + field: + name erif_port bitwidth 32 mapping_type ifindex + name l3_forward bitwidth 1 + name l3_drop bitwidth 1 + + Note that mapping_type is presented only if relevant. Also the header/ + field id's are reported by the kernel they are not shown by default. + They can be observed by using the -v option. Also the headers scope + (global/local) is specified. + + $devlink -v dpipe header show pci/0000:03:00.0 + + pci/0000:03:00.0: + name mlxsw_meta id 0 global false + field: + name erif_port id 0 bitwidth 32 mapping_type ifindex + name l3_forward id 1 bitwidth 1 + name l3_drop id 2 bitwidth 1 + + Second we can examine the tables supported by the hardware. In order + to dump all the tables no table name should be provided: + $devlink dpipe table show pci/0000:03:00.0 + + In order to examine specific table its name have to be specified: + $devlink dpipe table show pci/0000:03:00.0 name erif + + pci/0000:03:00.0: + name mlxsw_erif size 800 counters_enabled true + match: + type field_exact header mlxsw_meta field erif_port mapping ifindex + action: + type field_modify header mlxsw_meta field l3_forward + type field_modify header mlxsw_meta field l3_drop + + To enable/disable counters on the table: + $devlink dpipe table set pci/0000:03:00.0 name erif counters enable + $devlink dpipe table set pci/0000:03:00.0 name erif counters disable + + In order to see the current entries in the hardware for specific table: + $devlink dpipe table dump pci/0000:03:00.0 name erif + + pci/0000:03:00.0: + index 0 counter 0 + match_value: + type field_exact header mlxsw_meta field erif_port mapping ifindex mapping_value 383 value 0 + action_value: + type field_modify header mlxsw_meta field l3_forward value 1 + + index 1 counter 0 + match_value: + type field_exact header mlxsw_meta field erif_port mapping ifindex mapping_value 381 value 1 + action_value: + type field_modify header mlxsw_meta field l3_forward value 1 + + In the above example the table contains two entries which does match + on erif port and forwards the packet or drop it (currently only the + forward count is implemented). The counter values are provided for + example. In case the counting is not enabled on the table the counters + will not be available. + + Signed-off-by: Arkadi Sharshevsky + Signed-off-by: Jiri Pirko + +Signed-off-by: Kamal Heib +--- + devlink/devlink.c | 1353 +++++++++++++++++++++++++++++++++++++++++++++++++---- + 1 file changed, 1254 insertions(+), 99 deletions(-) + +diff --git a/devlink/devlink.c b/devlink/devlink.c +index 35220d8..e22ee0a 100644 +--- a/devlink/devlink.c ++++ b/devlink/devlink.c +@@ -34,7 +34,15 @@ + #define ESWITCH_INLINE_MODE_TRANSPORT "transport" + + #define pr_err(args...) fprintf(stderr, ##args) +-#define pr_out(args...) fprintf(stdout, ##args) ++#define pr_out(args...) \ ++ do { \ ++ if (g_indent_newline) { \ ++ fprintf(stdout, "%s", g_indent_str); \ ++ g_indent_newline = false; \ ++ } \ ++ fprintf(stdout, ##args); \ ++ } while (0) ++ + #define pr_out_sp(num, args...) \ + do { \ + int ret = fprintf(stdout, ##args); \ +@@ -42,6 +50,35 @@ + fprintf(stdout, "%*s", num - ret, ""); \ + } while (0) + ++static int g_indent_level; ++static bool g_indent_newline; ++#define INDENT_STR_STEP 2 ++#define INDENT_STR_MAXLEN 32 ++static char g_indent_str[INDENT_STR_MAXLEN + 1] = ""; ++ ++static void __pr_out_indent_inc(void) ++{ ++ if (g_indent_level + INDENT_STR_STEP > INDENT_STR_MAXLEN) ++ return; ++ g_indent_level += INDENT_STR_STEP; ++ memset(g_indent_str, ' ', sizeof(g_indent_str)); ++ g_indent_str[g_indent_level] = '\0'; ++} ++ ++static void __pr_out_indent_dec(void) ++{ ++ if (g_indent_level - INDENT_STR_STEP < 0) ++ return; ++ g_indent_level -= INDENT_STR_STEP; ++ g_indent_str[g_indent_level] = '\0'; ++} ++ ++static void __pr_out_newline(void) ++{ ++ pr_out("\n"); ++ g_indent_newline = true; ++} ++ + static int _mnlg_socket_recv_run(struct mnlg_socket *nlg, + mnl_cb_t data_cb, void *data) + { +@@ -137,6 +174,8 @@ static void ifname_map_free(struct ifname_map *ifname_map) + #define DL_OPT_SB_TC BIT(10) + #define DL_OPT_ESWITCH_MODE BIT(11) + #define DL_OPT_ESWITCH_INLINE_MODE BIT(12) ++#define DL_OPT_DPIPE_TABLE_NAME BIT(13) ++#define DL_OPT_DPIPE_TABLE_COUNTERS BIT(14) + + struct dl_opts { + uint32_t present; /* flags of present items */ +@@ -154,6 +193,8 @@ struct dl_opts { + uint16_t sb_tc_index; + enum devlink_eswitch_mode eswitch_mode; + enum devlink_eswitch_inline_mode eswitch_inline_mode; ++ const char *dpipe_table_name; ++ bool dpipe_counters_enable; + }; + + struct dl { +@@ -166,6 +207,7 @@ struct dl { + json_writer_t *jw; + bool json_output; + bool pretty_output; ++ bool verbose; + struct { + bool present; + char *bus_name; +@@ -257,6 +299,38 @@ static const enum mnl_attr_data_type devlink_policy[DEVLINK_ATTR_MAX + 1] = { + [DEVLINK_ATTR_SB_OCC_MAX] = MNL_TYPE_U32, + [DEVLINK_ATTR_ESWITCH_MODE] = MNL_TYPE_U16, + [DEVLINK_ATTR_ESWITCH_INLINE_MODE] = MNL_TYPE_U8, ++ [DEVLINK_ATTR_DPIPE_TABLES] = MNL_TYPE_NESTED, ++ [DEVLINK_ATTR_DPIPE_TABLE] = MNL_TYPE_NESTED, ++ [DEVLINK_ATTR_DPIPE_TABLE_NAME] = MNL_TYPE_STRING, ++ [DEVLINK_ATTR_DPIPE_TABLE_SIZE] = MNL_TYPE_U64, ++ [DEVLINK_ATTR_DPIPE_TABLE_MATCHES] = MNL_TYPE_NESTED, ++ [DEVLINK_ATTR_DPIPE_TABLE_ACTIONS] = MNL_TYPE_NESTED, ++ [DEVLINK_ATTR_DPIPE_TABLE_COUNTERS_ENABLED] = MNL_TYPE_U8, ++ [DEVLINK_ATTR_DPIPE_ENTRIES] = MNL_TYPE_NESTED, ++ [DEVLINK_ATTR_DPIPE_ENTRY] = MNL_TYPE_NESTED, ++ [DEVLINK_ATTR_DPIPE_ENTRY_INDEX] = MNL_TYPE_U64, ++ [DEVLINK_ATTR_DPIPE_ENTRY_MATCH_VALUES] = MNL_TYPE_NESTED, ++ [DEVLINK_ATTR_DPIPE_ENTRY_ACTION_VALUES] = MNL_TYPE_NESTED, ++ [DEVLINK_ATTR_DPIPE_ENTRY_COUNTER] = MNL_TYPE_U64, ++ [DEVLINK_ATTR_DPIPE_MATCH] = MNL_TYPE_NESTED, ++ [DEVLINK_ATTR_DPIPE_MATCH_VALUE] = MNL_TYPE_NESTED, ++ [DEVLINK_ATTR_DPIPE_MATCH_TYPE] = MNL_TYPE_U32, ++ [DEVLINK_ATTR_DPIPE_ACTION] = MNL_TYPE_NESTED, ++ [DEVLINK_ATTR_DPIPE_ACTION_VALUE] = MNL_TYPE_NESTED, ++ [DEVLINK_ATTR_DPIPE_ACTION_TYPE] = MNL_TYPE_U32, ++ [DEVLINK_ATTR_DPIPE_VALUE_MAPPING] = MNL_TYPE_U32, ++ [DEVLINK_ATTR_DPIPE_HEADERS] = MNL_TYPE_NESTED, ++ [DEVLINK_ATTR_DPIPE_HEADER] = MNL_TYPE_NESTED, ++ [DEVLINK_ATTR_DPIPE_HEADER_NAME] = MNL_TYPE_STRING, ++ [DEVLINK_ATTR_DPIPE_HEADER_ID] = MNL_TYPE_U32, ++ [DEVLINK_ATTR_DPIPE_HEADER_FIELDS] = MNL_TYPE_NESTED, ++ [DEVLINK_ATTR_DPIPE_HEADER_GLOBAL] = MNL_TYPE_U8, ++ [DEVLINK_ATTR_DPIPE_HEADER_INDEX] = MNL_TYPE_U32, ++ [DEVLINK_ATTR_DPIPE_FIELD] = MNL_TYPE_NESTED, ++ [DEVLINK_ATTR_DPIPE_FIELD_NAME] = MNL_TYPE_STRING, ++ [DEVLINK_ATTR_DPIPE_FIELD_ID] = MNL_TYPE_U32, ++ [DEVLINK_ATTR_DPIPE_FIELD_BITWIDTH] = MNL_TYPE_U32, ++ [DEVLINK_ATTR_DPIPE_FIELD_MAPPING_TYPE] = MNL_TYPE_U32, + }; + + static int attr_cb(const struct nlattr *attr, void *data) +@@ -666,6 +740,20 @@ static int eswitch_inline_mode_get(const char *typestr, + return 0; + } + ++static int dpipe_counters_enable_get(const char *typestr, ++ bool *counters_enable) ++{ ++ if (strcmp(typestr, "enable") == 0) { ++ *counters_enable = 1; ++ } else if (strcmp(typestr, "disable") == 0) { ++ *counters_enable = 0; ++ } else { ++ pr_err("Unknown counter_state \"%s\"\n", typestr); ++ return -EINVAL; ++ } ++ return 0; ++} ++ + static int dl_argv_parse(struct dl *dl, uint32_t o_required, + uint32_t o_optional) + { +@@ -800,6 +888,27 @@ static int dl_argv_parse(struct dl *dl, uint32_t o_required, + if (err) + return err; + o_found |= DL_OPT_ESWITCH_INLINE_MODE; ++ } else if (dl_argv_match(dl, "name") && ++ (o_all & DL_OPT_DPIPE_TABLE_NAME)) { ++ dl_arg_inc(dl); ++ err = dl_argv_str(dl, &opts->dpipe_table_name); ++ if (err) ++ return err; ++ o_found |= DL_OPT_DPIPE_TABLE_NAME; ++ } else if (dl_argv_match(dl, "counters") && ++ (o_all & DL_OPT_DPIPE_TABLE_COUNTERS)) { ++ const char *typestr; ++ ++ dl_arg_inc(dl); ++ err = dl_argv_str(dl, &typestr); ++ if (err) ++ return err; ++ err = dpipe_counters_enable_get(typestr, ++ &opts->dpipe_counters_enable); ++ if (err) ++ return err; ++ o_found |= DL_OPT_DPIPE_TABLE_COUNTERS; ++ + } else { + pr_err("Unknown option \"%s\"\n", dl_argv(dl)); + return -EINVAL; +@@ -866,6 +975,17 @@ static int dl_argv_parse(struct dl *dl, uint32_t o_required, + return -EINVAL; + } + ++ if ((o_required & DL_OPT_DPIPE_TABLE_NAME) && ++ !(o_found & DL_OPT_DPIPE_TABLE_NAME)) { ++ pr_err("Dpipe table name expected\n"); ++ return -EINVAL; ++ } ++ ++ if ((o_required & DL_OPT_DPIPE_TABLE_COUNTERS) && ++ !(o_found & DL_OPT_DPIPE_TABLE_COUNTERS)) { ++ pr_err("Dpipe table counter state expected\n"); ++ return -EINVAL; ++ } + return 0; + } + +@@ -915,6 +1035,12 @@ static void dl_opts_put(struct nlmsghdr *nlh, struct dl *dl) + if (opts->present & DL_OPT_ESWITCH_INLINE_MODE) + mnl_attr_put_u8(nlh, DEVLINK_ATTR_ESWITCH_INLINE_MODE, + opts->eswitch_inline_mode); ++ if (opts->present & DL_OPT_DPIPE_TABLE_NAME) ++ mnl_attr_put_strz(nlh, DEVLINK_ATTR_DPIPE_TABLE_NAME, ++ opts->dpipe_table_name); ++ if (opts->present & DL_OPT_DPIPE_TABLE_COUNTERS) ++ mnl_attr_put_u8(nlh, DEVLINK_ATTR_DPIPE_TABLE_COUNTERS_ENABLED, ++ opts->dpipe_counters_enable); + } + + static int dl_argv_parse_put(struct nlmsghdr *nlh, struct dl *dl, +@@ -1033,7 +1159,19 @@ static void __pr_out_handle_start(struct dl *dl, struct nlattr **tb, + jsonw_start_object(dl->jw); + } + } else { +- pr_out("%s%s", buf, content ? ":" : ""); ++ if (array) { ++ if (should_arr_last_handle_end(dl, bus_name, dev_name)) ++ __pr_out_indent_dec(); ++ if (should_arr_last_handle_start(dl, bus_name, ++ dev_name)) { ++ pr_out("%s%s", buf, content ? ":" : ""); ++ __pr_out_newline(); ++ __pr_out_indent_inc(); ++ arr_last_handle_set(dl, bus_name, dev_name); ++ } ++ } else { ++ pr_out("%s%s", buf, content ? ":" : ""); ++ } + } + } + +@@ -1047,7 +1185,7 @@ static void pr_out_handle_end(struct dl *dl) + if (dl->json_output) + jsonw_end_object(dl->jw); + else +- pr_out("\n"); ++ __pr_out_newline(); + } + + static void pr_out_handle(struct dl *dl, struct nlattr **tb) +@@ -1163,18 +1301,26 @@ static void pr_out_port_handle_end(struct dl *dl) + + static void pr_out_str(struct dl *dl, const char *name, const char *val) + { +- if (dl->json_output) ++ if (dl->json_output) { + jsonw_string_field(dl->jw, name, val); +- else +- pr_out(" %s %s", name, val); ++ } else { ++ if (g_indent_newline) ++ pr_out("%s %s", name, val); ++ else ++ pr_out(" %s %s", name, val); ++ } + } + + static void pr_out_uint(struct dl *dl, const char *name, unsigned int val) + { +- if (dl->json_output) ++ if (dl->json_output) { + jsonw_uint_field(dl->jw, name, val); +- else +- pr_out(" %s %u", name, val); ++ } else { ++ if (g_indent_newline) ++ pr_out("%s %u", name, val); ++ else ++ pr_out(" %s %u", name, val); ++ } + } + + static void pr_out_dev(struct dl *dl, struct nlattr **tb) +@@ -1201,6 +1347,42 @@ static void pr_out_section_end(struct dl *dl) + } + } + ++static void pr_out_array_start(struct dl *dl, const char *name) ++{ ++ if (dl->json_output) { ++ jsonw_name(dl->jw, name); ++ jsonw_start_array(dl->jw); ++ } else { ++ if (!g_indent_newline) ++ __pr_out_newline(); ++ pr_out("%s:", name); ++ __pr_out_newline(); ++ __pr_out_indent_inc(); ++ } ++} ++ ++static void pr_out_array_end(struct dl *dl) ++{ ++ if (dl->json_output) ++ jsonw_end_array(dl->jw); ++ else ++ __pr_out_indent_dec(); ++} ++ ++static void pr_out_entry_start(struct dl *dl) ++{ ++ if (dl->json_output) ++ jsonw_start_object(dl->jw); ++} ++ ++static void pr_out_entry_end(struct dl *dl) ++{ ++ if (dl->json_output) ++ jsonw_end_object(dl->jw); ++ else ++ __pr_out_newline(); ++} ++ + static const char *eswitch_mode_name(uint32_t mode) + { + switch (mode) { +@@ -2423,129 +2605,1102 @@ static int cmd_mon(struct dl *dl) + return -ENOENT; + } + +-static void help(void) ++struct dpipe_field { ++ char *name; ++ unsigned int id; ++ unsigned int bitwidth; ++ enum devlink_dpipe_field_mapping_type mapping_type; ++}; ++ ++struct dpipe_header { ++ struct list_head list; ++ char *name; ++ unsigned int id; ++ struct dpipe_field *fields; ++ unsigned int fields_count; ++}; ++ ++struct dpipe_ctx { ++ struct dl *dl; ++ int err; ++ struct list_head global_headers; ++ struct list_head local_headers; ++ bool print_headers; ++}; ++ ++static struct dpipe_header *dpipe_header_alloc(unsigned int fields_count) + { +- pr_err("Usage: devlink [ OPTIONS ] OBJECT { COMMAND | help }\n" +- "where OBJECT := { dev | port | sb | monitor }\n" +- " OPTIONS := { -V[ersion] | -n[no-nice-names] | -j[json] | -p[pretty] }\n"); ++ struct dpipe_header *header; ++ ++ header = calloc(1, sizeof(struct dpipe_header)); ++ if (!header) ++ return NULL; ++ header->fields = calloc(fields_count, sizeof(struct dpipe_field)); ++ if (!header->fields) ++ goto err_fields_alloc; ++ header->fields_count = fields_count; ++ return header; ++ ++err_fields_alloc: ++ free(header); ++ return NULL; + } + +-static int dl_cmd(struct dl *dl) ++static void dpipe_header_free(struct dpipe_header *header) + { +- if (dl_argv_match(dl, "help") || dl_no_arg(dl)) { +- help(); +- return 0; +- } else if (dl_argv_match(dl, "dev")) { +- dl_arg_inc(dl); +- return cmd_dev(dl); +- } else if (dl_argv_match(dl, "port")) { +- dl_arg_inc(dl); +- return cmd_port(dl); +- } else if (dl_argv_match(dl, "sb")) { +- dl_arg_inc(dl); +- return cmd_sb(dl); +- } else if (dl_argv_match(dl, "monitor")) { +- dl_arg_inc(dl); +- return cmd_mon(dl); ++ free(header->fields); ++ free(header); ++} ++ ++static void dpipe_header_clear(struct dpipe_header *header) ++{ ++ struct dpipe_field *field; ++ int i; ++ ++ for (i = 0; i < header->fields_count; i++) { ++ field = &header->fields[i]; ++ free(field->name); + } +- pr_err("Object \"%s\" not found\n", dl_argv(dl)); +- return -ENOENT; ++ free(header->name); + } + +-static int dl_init(struct dl *dl, int argc, char **argv) ++static void dpipe_header_add(struct dpipe_ctx *ctx, ++ struct dpipe_header *header, bool global) + { +- int err; ++ if (global) ++ list_add(&header->list, &ctx->global_headers); ++ else ++ list_add(&header->list, &ctx->local_headers); ++} + +- dl->argc = argc; +- dl->argv = argv; ++static void dpipe_header_del(struct dpipe_header *header) ++{ ++ list_del(&header->list); ++} + +- dl->nlg = mnlg_socket_open(DEVLINK_GENL_NAME, DEVLINK_GENL_VERSION); +- if (!dl->nlg) { +- pr_err("Failed to connect to devlink Netlink\n"); +- return -errno; ++static struct dpipe_ctx *dpipe_ctx_alloc(struct dl *dl) ++{ ++ struct dpipe_ctx *ctx; ++ ++ ctx = calloc(1, sizeof(struct dpipe_ctx)); ++ if (!ctx) ++ return NULL; ++ ctx->dl = dl; ++ INIT_LIST_HEAD(&ctx->global_headers); ++ INIT_LIST_HEAD(&ctx->local_headers); ++ return ctx; ++} ++ ++static void dpipe_ctx_free(struct dpipe_ctx *ctx) ++{ ++ free(ctx); ++} ++ ++static void dpipe_ctx_clear(struct dpipe_ctx *ctx) ++{ ++ struct dpipe_header *header, *tmp; ++ ++ list_for_each_entry_safe(header, tmp, &ctx->global_headers, ++ list) { ++ dpipe_header_del(header); ++ dpipe_header_clear(header); ++ dpipe_header_free(header); ++ } ++ list_for_each_entry_safe(header, tmp, &ctx->local_headers, ++ list) { ++ dpipe_header_del(header); ++ dpipe_header_clear(header); ++ dpipe_header_free(header); + } ++} + +- err = ifname_map_init(dl); +- if (err) { +- pr_err("Failed to create index map\n"); +- goto err_ifname_map_create; ++static const char *dpipe_header_id2s(struct dpipe_ctx *ctx, ++ uint32_t header_id, bool global) ++{ ++ struct list_head *header_list; ++ struct dpipe_header *header; ++ ++ if (global) ++ header_list = &ctx->global_headers; ++ else ++ header_list = &ctx->local_headers; ++ list_for_each_entry(header, header_list, list) { ++ if (header->id != header_id) ++ continue; ++ return header->name; + } +- if (dl->json_output) { +- dl->jw = jsonw_new(stdout); +- if (!dl->jw) { +- pr_err("Failed to create JSON writer\n"); +- goto err_json_new; +- } +- jsonw_pretty(dl->jw, dl->pretty_output); ++ return NULL; ++} ++ ++static const char *dpipe_field_id2s(struct dpipe_ctx *ctx, ++ uint32_t header_id, ++ uint32_t field_id, bool global) ++{ ++ struct list_head *header_list; ++ struct dpipe_header *header; ++ ++ if (global) ++ header_list = &ctx->global_headers; ++ else ++ header_list = &ctx->local_headers; ++ list_for_each_entry(header, header_list, list) { ++ if (header->id != header_id) ++ continue; ++ return header->fields[field_id].name; + } +- return 0; ++ return NULL; ++} + +-err_json_new: +- ifname_map_fini(dl); +-err_ifname_map_create: +- mnlg_socket_close(dl->nlg); +- return err; ++static const char * ++dpipe_field_mapping_e2s(enum devlink_dpipe_field_mapping_type mapping_type) ++{ ++ switch (mapping_type) { ++ case DEVLINK_DPIPE_FIELD_MAPPING_TYPE_NONE: ++ return NULL; ++ case DEVLINK_DPIPE_FIELD_MAPPING_TYPE_IFINDEX: ++ return "ifindex"; ++ default: ++ return ""; ++ } + } + +-static void dl_fini(struct dl *dl) ++static const char * ++dpipe_mapping_get(struct dpipe_ctx *ctx, uint32_t header_id, ++ uint32_t field_id, bool global) + { +- if (dl->json_output) +- jsonw_destroy(&dl->jw); +- ifname_map_fini(dl); +- mnlg_socket_close(dl->nlg); ++ enum devlink_dpipe_field_mapping_type mapping_type; ++ struct list_head *header_list; ++ struct dpipe_header *header; ++ ++ if (global) ++ header_list = &ctx->global_headers; ++ else ++ header_list = &ctx->local_headers; ++ list_for_each_entry(header, header_list, list) { ++ if (header->id != header_id) ++ continue; ++ mapping_type = header->fields[field_id].mapping_type; ++ return dpipe_field_mapping_e2s(mapping_type); ++ } ++ return NULL; + } + +-static struct dl *dl_alloc(void) ++static void pr_out_dpipe_fields(struct dpipe_ctx *ctx, ++ struct dpipe_field *fields, ++ unsigned int field_count) + { +- struct dl *dl; ++ struct dpipe_field *field; ++ int i; + +- dl = calloc(1, sizeof(*dl)); +- if (!dl) +- return NULL; +- return dl; ++ for (i = 0; i < field_count; i++) { ++ field = &fields[i]; ++ pr_out_entry_start(ctx->dl); ++ pr_out_str(ctx->dl, "name", field->name); ++ if (ctx->dl->verbose) ++ pr_out_uint(ctx->dl, "id", field->id); ++ pr_out_uint(ctx->dl, "bitwidth", field->bitwidth); ++ if (field->mapping_type) ++ pr_out_str(ctx->dl, "mapping_type", ++ dpipe_field_mapping_e2s(field->mapping_type)); ++ pr_out_entry_end(ctx->dl); ++ } + } + +-static void dl_free(struct dl *dl) ++static void ++pr_out_dpipe_header(struct dpipe_ctx *ctx, struct nlattr **tb, ++ struct dpipe_header *header, bool global) + { +- free(dl); ++ pr_out_handle_start_arr(ctx->dl, tb); ++ pr_out_str(ctx->dl, "name", header->name); ++ if (ctx->dl->verbose) { ++ pr_out_uint(ctx->dl, "id", header->id); ++ pr_out_str(ctx->dl, "global", ++ global ? "true" : "false"); ++ } ++ pr_out_array_start(ctx->dl, "field"); ++ pr_out_dpipe_fields(ctx, header->fields, ++ header->fields_count); ++ pr_out_array_end(ctx->dl); ++ pr_out_handle_end(ctx->dl); + } + +-int main(int argc, char **argv) ++static void pr_out_dpipe_headers(struct dpipe_ctx *ctx, ++ struct nlattr **tb) + { +- static const struct option long_options[] = { +- { "Version", no_argument, NULL, 'V' }, +- { "no-nice-names", no_argument, NULL, 'n' }, +- { "json", no_argument, NULL, 'j' }, +- { "pretty", no_argument, NULL, 'p' }, +- { NULL, 0, NULL, 0 } +- }; +- struct dl *dl; +- int opt; ++ struct dpipe_header *header; ++ ++ list_for_each_entry(header, &ctx->local_headers, list) ++ pr_out_dpipe_header(ctx, tb, header, false); ++ ++ list_for_each_entry(header, &ctx->global_headers, list) ++ pr_out_dpipe_header(ctx, tb, header, true); ++} ++ ++static int dpipe_header_field_get(struct nlattr *nl, struct dpipe_field *field) ++{ ++ struct nlattr *nla_field[DEVLINK_ATTR_MAX + 1] = {}; ++ const char *name; + int err; +- int ret; + +- dl = dl_alloc(); +- if (!dl) { +- pr_err("Failed to allocate memory for devlink\n"); +- return EXIT_FAILURE; ++ err = mnl_attr_parse_nested(nl, attr_cb, nla_field); ++ if (err != MNL_CB_OK) ++ return -EINVAL; ++ if (!nla_field[DEVLINK_ATTR_DPIPE_FIELD_ID] || ++ !nla_field[DEVLINK_ATTR_DPIPE_FIELD_NAME] || ++ !nla_field[DEVLINK_ATTR_DPIPE_FIELD_BITWIDTH] || ++ !nla_field[DEVLINK_ATTR_DPIPE_FIELD_MAPPING_TYPE]) ++ return -EINVAL; ++ ++ name = mnl_attr_get_str(nla_field[DEVLINK_ATTR_DPIPE_FIELD_NAME]); ++ field->id = mnl_attr_get_u32(nla_field[DEVLINK_ATTR_DPIPE_FIELD_ID]); ++ field->bitwidth = mnl_attr_get_u32(nla_field[DEVLINK_ATTR_DPIPE_FIELD_BITWIDTH]); ++ field->name = strdup(name); ++ if (!field->name) ++ return -ENOMEM; ++ field->mapping_type = mnl_attr_get_u32(nla_field[DEVLINK_ATTR_DPIPE_FIELD_MAPPING_TYPE]); ++ return 0; ++} ++ ++static int dpipe_header_fields_get(struct nlattr *nla_fields, ++ struct dpipe_field *fields) ++{ ++ struct nlattr *nla_field; ++ int count = 0; ++ int err; ++ ++ mnl_attr_for_each_nested(nla_field, nla_fields) { ++ err = dpipe_header_field_get(nla_field, &fields[count]); ++ if (err) ++ return err; ++ count++; + } ++ return 0; ++} + +- while ((opt = getopt_long(argc, argv, "Vnjp", +- long_options, NULL)) >= 0) { ++static unsigned int dpipe_header_field_count_get(struct nlattr *nla_fields) ++{ ++ struct nlattr *nla_field; ++ unsigned int count = 0; + +- switch (opt) { +- case 'V': +- printf("devlink utility, iproute2-ss%s\n", SNAPSHOT); +- ret = EXIT_SUCCESS; +- goto dl_free; +- case 'n': +- dl->no_nice_names = true; +- break; +- case 'j': +- dl->json_output = true; +- break; +- case 'p': +- dl->pretty_output = true; ++ mnl_attr_for_each_nested(nla_field, nla_fields) ++ count++; ++ return count; ++} ++ ++static int dpipe_header_get(struct dpipe_ctx *ctx, struct nlattr *nl) ++{ ++ struct nlattr *nla_header[DEVLINK_ATTR_MAX + 1] = {}; ++ struct dpipe_header *header; ++ unsigned int fields_count; ++ const char *header_name; ++ bool global; ++ int err; ++ ++ err = mnl_attr_parse_nested(nl, attr_cb, nla_header); ++ if (err != MNL_CB_OK) ++ return -EINVAL; ++ ++ if (!nla_header[DEVLINK_ATTR_DPIPE_HEADER_NAME] || ++ !nla_header[DEVLINK_ATTR_DPIPE_HEADER_ID] || ++ !nla_header[DEVLINK_ATTR_DPIPE_HEADER_FIELDS]) ++ return -EINVAL; ++ ++ fields_count = dpipe_header_field_count_get(nla_header[DEVLINK_ATTR_DPIPE_HEADER_FIELDS]); ++ header = dpipe_header_alloc(fields_count); ++ if (!header) ++ return -ENOMEM; ++ ++ header_name = mnl_attr_get_str(nla_header[DEVLINK_ATTR_DPIPE_HEADER_NAME]); ++ header->name = strdup(header_name); ++ header->id = mnl_attr_get_u32(nla_header[DEVLINK_ATTR_DPIPE_HEADER_ID]); ++ header->fields_count = fields_count; ++ global = !!mnl_attr_get_u8(nla_header[DEVLINK_ATTR_DPIPE_HEADER_GLOBAL]); ++ ++ err = dpipe_header_fields_get(nla_header[DEVLINK_ATTR_DPIPE_HEADER_FIELDS], ++ header->fields); ++ if (err) ++ goto err_field_get; ++ dpipe_header_add(ctx, header, global); ++ return 0; ++ ++err_field_get: ++ dpipe_header_free(header); ++ return err; ++} ++ ++static int dpipe_headers_get(struct dpipe_ctx *ctx, struct nlattr **tb) ++{ ++ struct nlattr *nla_headers = tb[DEVLINK_ATTR_DPIPE_HEADERS]; ++ struct nlattr *nla_header; ++ int err; ++ ++ mnl_attr_for_each_nested(nla_header, nla_headers) { ++ err = dpipe_header_get(ctx, nla_header); ++ if (err) ++ return err; ++ } ++ return 0; ++} ++ ++static int cmd_dpipe_header_cb(const struct nlmsghdr *nlh, void *data) ++{ ++ struct dpipe_ctx *ctx = data; ++ struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {}; ++ struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); ++ int err; ++ ++ mnl_attr_parse(nlh, sizeof(*genl), attr_cb, tb); ++ if (!tb[DEVLINK_ATTR_BUS_NAME] || !tb[DEVLINK_ATTR_DEV_NAME] || ++ !tb[DEVLINK_ATTR_DPIPE_HEADERS]) ++ return MNL_CB_ERROR; ++ err = dpipe_headers_get(ctx, tb); ++ if (err) { ++ ctx->err = err; ++ return MNL_CB_ERROR; ++ } ++ ++ if (ctx->print_headers) ++ pr_out_dpipe_headers(ctx, tb); ++ return MNL_CB_OK; ++} ++ ++static int cmd_dpipe_headers_show(struct dl *dl) ++{ ++ struct nlmsghdr *nlh; ++ struct dpipe_ctx *ctx; ++ uint16_t flags = NLM_F_REQUEST | NLM_F_ACK; ++ int err; ++ ++ nlh = mnlg_msg_prepare(dl->nlg, DEVLINK_CMD_DPIPE_HEADERS_GET, flags); ++ ++ err = dl_argv_parse_put(nlh, dl, DL_OPT_HANDLE, 0); ++ if (err) ++ return err; ++ ++ ctx = dpipe_ctx_alloc(dl); ++ if (!ctx) ++ return -ENOMEM; ++ ++ ctx->print_headers = true; ++ ++ pr_out_section_start(dl, "header"); ++ err = _mnlg_socket_sndrcv(dl->nlg, nlh, cmd_dpipe_header_cb, ctx); ++ if (err) ++ pr_err("error get headers %s\n", strerror(ctx->err)); ++ pr_out_section_end(dl); ++ ++ dpipe_ctx_clear(ctx); ++ dpipe_ctx_free(ctx); ++ return err; ++} ++ ++static void cmd_dpipe_header_help(void) ++{ ++ pr_err("Usage: devlink dpipe headers show DEV\n"); ++} ++ ++static int cmd_dpipe_header(struct dl *dl) ++{ ++ if (dl_argv_match(dl, "help") || dl_no_arg(dl)) { ++ cmd_dpipe_header_help(); ++ return 0; ++ } else if (dl_argv_match(dl, "show")) { ++ dl_arg_inc(dl); ++ return cmd_dpipe_headers_show(dl); ++ } ++ pr_err("Command \"%s\" not found\n", dl_argv(dl)); ++ return -ENOENT; ++} ++ ++static const char ++*dpipe_action_type_e2s(enum devlink_dpipe_action_type action_type) ++{ ++ switch (action_type) { ++ case DEVLINK_DPIPE_ACTION_TYPE_FIELD_MODIFY: ++ return "field_modify"; ++ default: ++ return ""; ++ } ++} ++ ++static void pr_out_dpipe_action(struct dpipe_ctx *ctx, ++ uint32_t header_id, uint32_t field_id, ++ uint32_t action_type, bool global) ++{ ++ const char *mapping; ++ ++ pr_out_str(ctx->dl, "type", dpipe_action_type_e2s(action_type)); ++ pr_out_str(ctx->dl, "header", dpipe_header_id2s(ctx, header_id, ++ global)); ++ pr_out_str(ctx->dl, "field", dpipe_field_id2s(ctx, header_id, field_id, ++ global)); ++ mapping = dpipe_mapping_get(ctx, header_id, field_id, global); ++ if (mapping) ++ pr_out_str(ctx->dl, "mapping", mapping); ++} ++ ++static int dpipe_action_show(struct dpipe_ctx *ctx, struct nlattr *nl) ++{ ++ struct nlattr *nla_action[DEVLINK_ATTR_MAX + 1] = {}; ++ uint32_t header_id, field_id, action_type; ++ bool global; ++ int err; ++ ++ err = mnl_attr_parse_nested(nl, attr_cb, nla_action); ++ if (err != MNL_CB_OK) ++ return -EINVAL; ++ ++ if (!nla_action[DEVLINK_ATTR_DPIPE_ACTION_TYPE] || ++ !nla_action[DEVLINK_ATTR_DPIPE_HEADER_INDEX] || ++ !nla_action[DEVLINK_ATTR_DPIPE_HEADER_ID] || ++ !nla_action[DEVLINK_ATTR_DPIPE_FIELD_ID]) { ++ return -EINVAL; ++ } ++ ++ header_id = mnl_attr_get_u32(nla_action[DEVLINK_ATTR_DPIPE_HEADER_ID]); ++ field_id = mnl_attr_get_u32(nla_action[DEVLINK_ATTR_DPIPE_FIELD_ID]); ++ action_type = mnl_attr_get_u32(nla_action[DEVLINK_ATTR_DPIPE_ACTION_TYPE]); ++ global = !!mnl_attr_get_u8(nla_action[DEVLINK_ATTR_DPIPE_HEADER_GLOBAL]); ++ ++ pr_out_dpipe_action(ctx, header_id, field_id, action_type, global); ++ return 0; ++} ++ ++static int dpipe_table_actions_show(struct dpipe_ctx *ctx, ++ struct nlattr *nla_actions) ++{ ++ struct nlattr *nla_action; ++ ++ mnl_attr_for_each_nested(nla_action, nla_actions) { ++ pr_out_entry_start(ctx->dl); ++ if (dpipe_action_show(ctx, nla_action)) ++ goto err_action_show; ++ pr_out_entry_end(ctx->dl); ++ } ++ return 0; ++ ++err_action_show: ++ pr_out_entry_end(ctx->dl); ++ return -EINVAL; ++} ++ ++static const char * ++dpipe_match_type_e2s(enum devlink_dpipe_match_type match_type) ++{ ++ switch (match_type) { ++ case DEVLINK_DPIPE_MATCH_TYPE_FIELD_EXACT: ++ return "field_exact"; ++ default: ++ return ""; ++ } ++} ++ ++static void pr_out_dpipe_match(struct dpipe_ctx *ctx, ++ uint32_t header_id, uint32_t field_id, ++ uint32_t match_type, bool global) ++{ ++ const char *mapping; ++ ++ pr_out_str(ctx->dl, "type", dpipe_match_type_e2s(match_type)); ++ pr_out_str(ctx->dl, "header", dpipe_header_id2s(ctx, header_id, ++ global)); ++ pr_out_str(ctx->dl, "field", dpipe_field_id2s(ctx, header_id, field_id, ++ global)); ++ mapping = dpipe_mapping_get(ctx, header_id, field_id, global); ++ if (mapping) ++ pr_out_str(ctx->dl, "mapping", mapping); ++ ++} ++ ++static int dpipe_match_show(struct dpipe_ctx *ctx, struct nlattr *nl) ++{ ++ struct nlattr *nla_match[DEVLINK_ATTR_MAX + 1] = {}; ++ uint32_t header_id, field_id, match_type; ++ bool global; ++ int err; ++ ++ err = mnl_attr_parse_nested(nl, attr_cb, nla_match); ++ if (err != MNL_CB_OK) ++ return -EINVAL; ++ ++ if (!nla_match[DEVLINK_ATTR_DPIPE_MATCH_TYPE] || ++ !nla_match[DEVLINK_ATTR_DPIPE_HEADER_INDEX] || ++ !nla_match[DEVLINK_ATTR_DPIPE_HEADER_ID] || ++ !nla_match[DEVLINK_ATTR_DPIPE_FIELD_ID]) { ++ return -EINVAL; ++ } ++ ++ match_type = mnl_attr_get_u32(nla_match[DEVLINK_ATTR_DPIPE_MATCH_TYPE]); ++ header_id = mnl_attr_get_u32(nla_match[DEVLINK_ATTR_DPIPE_HEADER_ID]); ++ field_id = mnl_attr_get_u32(nla_match[DEVLINK_ATTR_DPIPE_FIELD_ID]); ++ global = !!mnl_attr_get_u8(nla_match[DEVLINK_ATTR_DPIPE_HEADER_GLOBAL]); ++ ++ pr_out_dpipe_match(ctx, header_id, field_id, match_type, global); ++ return 0; ++} ++ ++static int dpipe_table_matches_show(struct dpipe_ctx *ctx, ++ struct nlattr *nla_matches) ++{ ++ struct nlattr *nla_match; ++ ++ mnl_attr_for_each_nested(nla_match, nla_matches) { ++ pr_out_entry_start(ctx->dl); ++ if (dpipe_match_show(ctx, nla_match)) ++ goto err_match_show; ++ pr_out_entry_end(ctx->dl); ++ } ++ return 0; ++ ++err_match_show: ++ pr_out_entry_end(ctx->dl); ++ return -EINVAL; ++} ++ ++static int dpipe_table_show(struct dpipe_ctx *ctx, struct nlattr *nl) ++{ ++ struct nlattr *nla_table[DEVLINK_ATTR_MAX + 1] = {}; ++ bool counters_enabled; ++ const char *name; ++ uint32_t size; ++ int err; ++ ++ err = mnl_attr_parse_nested(nl, attr_cb, nla_table); ++ if (err != MNL_CB_OK) ++ return -EINVAL; ++ ++ if (!nla_table[DEVLINK_ATTR_DPIPE_TABLE_NAME] || ++ !nla_table[DEVLINK_ATTR_DPIPE_TABLE_SIZE] || ++ !nla_table[DEVLINK_ATTR_DPIPE_TABLE_ACTIONS] || ++ !nla_table[DEVLINK_ATTR_DPIPE_TABLE_MATCHES] || ++ !nla_table[DEVLINK_ATTR_DPIPE_TABLE_COUNTERS_ENABLED]) { ++ return -EINVAL; ++ } ++ ++ name = mnl_attr_get_str(nla_table[DEVLINK_ATTR_DPIPE_TABLE_NAME]); ++ size = mnl_attr_get_u32(nla_table[DEVLINK_ATTR_DPIPE_TABLE_SIZE]); ++ counters_enabled = !!mnl_attr_get_u8(nla_table[DEVLINK_ATTR_DPIPE_TABLE_COUNTERS_ENABLED]); ++ ++ pr_out_str(ctx->dl, "name", name); ++ pr_out_uint(ctx->dl, "size", size); ++ pr_out_str(ctx->dl, "counters_enabled", ++ counters_enabled ? "true" : "false"); ++ ++ pr_out_array_start(ctx->dl, "match"); ++ if (dpipe_table_matches_show(ctx, nla_table[DEVLINK_ATTR_DPIPE_TABLE_MATCHES])) ++ goto err_matches_show; ++ pr_out_array_end(ctx->dl); ++ ++ pr_out_array_start(ctx->dl, "action"); ++ if (dpipe_table_actions_show(ctx, nla_table[DEVLINK_ATTR_DPIPE_TABLE_ACTIONS])) ++ goto err_actions_show; ++ pr_out_array_end(ctx->dl); ++ ++ return 0; ++ ++err_actions_show: ++err_matches_show: ++ pr_out_array_end(ctx->dl); ++ return -EINVAL; ++} ++ ++static int dpipe_tables_show(struct dpipe_ctx *ctx, struct nlattr **tb) ++{ ++ struct nlattr *nla_tables = tb[DEVLINK_ATTR_DPIPE_TABLES]; ++ struct nlattr *nla_table; ++ ++ mnl_attr_for_each_nested(nla_table, nla_tables) { ++ pr_out_handle_start_arr(ctx->dl, tb); ++ if (dpipe_table_show(ctx, nla_table)) ++ goto err_table_show; ++ pr_out_handle_end(ctx->dl); ++ } ++ return 0; ++ ++err_table_show: ++ pr_out_handle_end(ctx->dl); ++ return -EINVAL; ++} ++ ++static int cmd_dpipe_table_show_cb(const struct nlmsghdr *nlh, void *data) ++{ ++ struct dpipe_ctx *ctx = data; ++ struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {}; ++ struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); ++ ++ mnl_attr_parse(nlh, sizeof(*genl), attr_cb, tb); ++ if (!tb[DEVLINK_ATTR_BUS_NAME] || !tb[DEVLINK_ATTR_DEV_NAME] || ++ !tb[DEVLINK_ATTR_DPIPE_TABLES]) ++ return MNL_CB_ERROR; ++ ++ if (dpipe_tables_show(ctx, tb)) ++ return MNL_CB_ERROR; ++ return MNL_CB_OK; ++} ++ ++static int cmd_dpipe_table_show(struct dl *dl) ++{ ++ struct nlmsghdr *nlh; ++ struct dpipe_ctx *ctx; ++ uint16_t flags = NLM_F_REQUEST; ++ int err; ++ ++ ctx = dpipe_ctx_alloc(dl); ++ if (!ctx) ++ return -ENOMEM; ++ ++ err = dl_argv_parse(dl, DL_OPT_HANDLE, DL_OPT_DPIPE_TABLE_NAME); ++ if (err) ++ goto out; ++ ++ nlh = mnlg_msg_prepare(dl->nlg, DEVLINK_CMD_DPIPE_HEADERS_GET, flags); ++ dl_opts_put(nlh, dl); ++ err = _mnlg_socket_sndrcv(dl->nlg, nlh, cmd_dpipe_header_cb, ctx); ++ if (err) { ++ pr_err("error get headers %s\n", strerror(ctx->err)); ++ goto out; ++ } ++ ++ flags = NLM_F_REQUEST | NLM_F_ACK; ++ nlh = mnlg_msg_prepare(dl->nlg, DEVLINK_CMD_DPIPE_TABLE_GET, flags); ++ dl_opts_put(nlh, dl); ++ ++ pr_out_section_start(dl, "table"); ++ _mnlg_socket_sndrcv(dl->nlg, nlh, cmd_dpipe_table_show_cb, ctx); ++ pr_out_section_end(dl); ++out: ++ dpipe_ctx_clear(ctx); ++ dpipe_ctx_free(ctx); ++ return err; ++} ++ ++static int cmd_dpipe_table_set(struct dl *dl) ++{ ++ struct nlmsghdr *nlh; ++ int err; ++ ++ nlh = mnlg_msg_prepare(dl->nlg, DEVLINK_CMD_DPIPE_TABLE_COUNTERS_SET, ++ NLM_F_REQUEST | NLM_F_ACK); ++ ++ err = dl_argv_parse_put(nlh, dl, ++ DL_OPT_HANDLE | DL_OPT_DPIPE_TABLE_NAME | ++ DL_OPT_DPIPE_TABLE_COUNTERS, 0); ++ if (err) ++ return err; ++ ++ return _mnlg_socket_sndrcv(dl->nlg, nlh, NULL, NULL); ++} ++ ++static int dpipe_entry_value_show(struct dpipe_ctx *ctx, ++ struct nlattr **nla_match_value) ++{ ++ uint16_t value_len; ++ bool mask, mapping; ++ ++ mask = !!nla_match_value[DEVLINK_ATTR_DPIPE_VALUE_MASK]; ++ mapping = !!nla_match_value[DEVLINK_ATTR_DPIPE_VALUE_MAPPING]; ++ ++ value_len = mnl_attr_get_payload_len(nla_match_value[DEVLINK_ATTR_DPIPE_VALUE]); ++ if (value_len == sizeof(uint32_t)) { ++ uint32_t value, value_mask, value_mapping; ++ ++ if (mapping) { ++ value_mapping = mnl_attr_get_u32(nla_match_value[DEVLINK_ATTR_DPIPE_VALUE_MAPPING]); ++ pr_out_uint(ctx->dl, "mapping_value", value_mapping); ++ } ++ ++ if (mask) { ++ value_mask = mnl_attr_get_u32(nla_match_value[DEVLINK_ATTR_DPIPE_VALUE_MASK]); ++ pr_out_uint(ctx->dl, "mask_value", value_mask); ++ } ++ ++ value = mnl_attr_get_u32(nla_match_value[DEVLINK_ATTR_DPIPE_VALUE]); ++ pr_out_uint(ctx->dl, "value", value); ++ ++ } else { ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ ++static int dpipe_entry_match_value_show(struct dpipe_ctx *ctx, ++ struct nlattr *nl) ++{ ++ struct nlattr *nla_match_value[DEVLINK_ATTR_MAX + 1] = {}; ++ int err; ++ ++ err = mnl_attr_parse_nested(nl, attr_cb, nla_match_value); ++ if (err != MNL_CB_OK) ++ return -EINVAL; ++ ++ if (!nla_match_value[DEVLINK_ATTR_DPIPE_MATCH] || ++ !nla_match_value[DEVLINK_ATTR_DPIPE_VALUE]) { ++ return -EINVAL; ++ } ++ ++ pr_out_entry_start(ctx->dl); ++ if (dpipe_match_show(ctx, nla_match_value[DEVLINK_ATTR_DPIPE_MATCH])) ++ goto err_match_show; ++ if (dpipe_entry_value_show(ctx, nla_match_value)) ++ goto err_value_show; ++ pr_out_entry_end(ctx->dl); ++ ++ return 0; ++ ++err_match_show: ++err_value_show: ++ pr_out_entry_end(ctx->dl); ++ return -EINVAL; ++} ++ ++static int dpipe_entry_action_value_show(struct dpipe_ctx *ctx, ++ struct nlattr *nl) ++{ ++ struct nlattr *nla_action_value[DEVLINK_ATTR_MAX + 1] = {}; ++ int err; ++ ++ err = mnl_attr_parse_nested(nl, attr_cb, nla_action_value); ++ if (err != MNL_CB_OK) ++ return -EINVAL; ++ ++ if (!nla_action_value[DEVLINK_ATTR_DPIPE_ACTION] || ++ !nla_action_value[DEVLINK_ATTR_DPIPE_VALUE]) { ++ return -EINVAL; ++ } ++ ++ pr_out_entry_start(ctx->dl); ++ if (dpipe_action_show(ctx, nla_action_value[DEVLINK_ATTR_DPIPE_ACTION])) ++ goto err_action_show; ++ if (dpipe_entry_value_show(ctx, nla_action_value)) ++ goto err_value_show; ++ pr_out_entry_end(ctx->dl); ++ ++ return 0; ++ ++err_action_show: ++err_value_show: ++ pr_out_entry_end(ctx->dl); ++ return -EINVAL; ++} ++ ++static int ++dpipe_tables_action_values_show(struct dpipe_ctx *ctx, ++ struct nlattr *nla_action_values) ++{ ++ struct nlattr *nla_action_value; ++ ++ mnl_attr_for_each_nested(nla_action_value, nla_action_values) { ++ if (dpipe_entry_action_value_show(ctx, nla_action_value)) ++ return -EINVAL; ++ } ++ return 0; ++} ++ ++static int ++dpipe_tables_match_values_show(struct dpipe_ctx *ctx, ++ struct nlattr *nla_match_values) ++{ ++ struct nlattr *nla_match_value; ++ ++ mnl_attr_for_each_nested(nla_match_value, nla_match_values) { ++ if (dpipe_entry_match_value_show(ctx, nla_match_value)) ++ return -EINVAL; ++ } ++ return 0; ++} ++ ++static int dpipe_entry_show(struct dpipe_ctx *ctx, struct nlattr *nl) ++{ ++ struct nlattr *nla_entry[DEVLINK_ATTR_MAX + 1] = {}; ++ uint32_t entry_index; ++ uint64_t counter; ++ int err; ++ ++ err = mnl_attr_parse_nested(nl, attr_cb, nla_entry); ++ if (err != MNL_CB_OK) ++ return -EINVAL; ++ ++ if (!nla_entry[DEVLINK_ATTR_DPIPE_ENTRY_INDEX] || ++ !nla_entry[DEVLINK_ATTR_DPIPE_ENTRY_MATCH_VALUES] || ++ !nla_entry[DEVLINK_ATTR_DPIPE_ENTRY_ACTION_VALUES]) { ++ return -EINVAL; ++ } ++ ++ entry_index = mnl_attr_get_u32(nla_entry[DEVLINK_ATTR_DPIPE_ENTRY_INDEX]); ++ pr_out_uint(ctx->dl, "index", entry_index); ++ ++ if (nla_entry[DEVLINK_ATTR_DPIPE_ENTRY_COUNTER]) { ++ counter = mnl_attr_get_u64(nla_entry[DEVLINK_ATTR_DPIPE_ENTRY_COUNTER]); ++ pr_out_uint(ctx->dl, "counter", counter); ++ } ++ ++ pr_out_array_start(ctx->dl, "match_value"); ++ if (dpipe_tables_match_values_show(ctx, ++ nla_entry[DEVLINK_ATTR_DPIPE_ENTRY_MATCH_VALUES])) ++ goto err_match_values_show; ++ pr_out_array_end(ctx->dl); ++ ++ pr_out_array_start(ctx->dl, "action_value"); ++ if (dpipe_tables_action_values_show(ctx, ++ nla_entry[DEVLINK_ATTR_DPIPE_ENTRY_ACTION_VALUES])) ++ goto err_action_values_show; ++ pr_out_array_end(ctx->dl); ++ return 0; ++ ++err_action_values_show: ++err_match_values_show: ++ pr_out_array_end(ctx->dl); ++ return -EINVAL; ++} ++ ++static int dpipe_table_entries_show(struct dpipe_ctx *ctx, struct nlattr **tb) ++{ ++ struct nlattr *nla_entries = tb[DEVLINK_ATTR_DPIPE_ENTRIES]; ++ struct nlattr *nla_entry; ++ ++ mnl_attr_for_each_nested(nla_entry, nla_entries) { ++ pr_out_handle_start_arr(ctx->dl, tb); ++ if (dpipe_entry_show(ctx, nla_entry)) ++ goto err_entry_show; ++ pr_out_handle_end(ctx->dl); ++ } ++ return 0; ++ ++err_entry_show: ++ pr_out_handle_end(ctx->dl); ++ return -EINVAL; ++} ++ ++static int cmd_dpipe_table_entry_dump_cb(const struct nlmsghdr *nlh, void *data) ++{ ++ struct dpipe_ctx *ctx = data; ++ struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {}; ++ struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); ++ ++ mnl_attr_parse(nlh, sizeof(*genl), attr_cb, tb); ++ if (!tb[DEVLINK_ATTR_BUS_NAME] || !tb[DEVLINK_ATTR_DEV_NAME] || ++ !tb[DEVLINK_ATTR_DPIPE_ENTRIES]) ++ return MNL_CB_ERROR; ++ ++ if (dpipe_table_entries_show(ctx, tb)) ++ return MNL_CB_ERROR; ++ return MNL_CB_OK; ++} ++ ++static int cmd_dpipe_table_dump(struct dl *dl) ++{ ++ struct nlmsghdr *nlh; ++ struct dpipe_ctx *ctx; ++ uint16_t flags = NLM_F_REQUEST; ++ int err; ++ ++ ctx = dpipe_ctx_alloc(dl); ++ if (!ctx) ++ return -ENOMEM; ++ ++ err = dl_argv_parse(dl, DL_OPT_HANDLE | DL_OPT_DPIPE_TABLE_NAME, 0); ++ if (err) ++ goto out; ++ ++ nlh = mnlg_msg_prepare(dl->nlg, DEVLINK_CMD_DPIPE_HEADERS_GET, flags); ++ dl_opts_put(nlh, dl); ++ err = _mnlg_socket_sndrcv(dl->nlg, nlh, cmd_dpipe_header_cb, ctx); ++ if (err) { ++ pr_err("error get headers %s\n", strerror(ctx->err)); ++ goto out; ++ } ++ ++ flags = NLM_F_REQUEST | NLM_F_ACK; ++ nlh = mnlg_msg_prepare(dl->nlg, DEVLINK_CMD_DPIPE_ENTRIES_GET, flags); ++ dl_opts_put(nlh, dl); ++ ++ pr_out_section_start(dl, "table_entry"); ++ _mnlg_socket_sndrcv(dl->nlg, nlh, cmd_dpipe_table_entry_dump_cb, ctx); ++ pr_out_section_end(dl); ++out: ++ dpipe_ctx_clear(ctx); ++ dpipe_ctx_free(ctx); ++ return err; ++} ++ ++static void cmd_dpipe_table_help(void) ++{ ++ pr_err("Usage: devlink dpipe table [ OBJECT-LIST ]\n" ++ "where OBJECT-LIST := { show | set | dump }\n"); ++} ++ ++static int cmd_dpipe_table(struct dl *dl) ++{ ++ if (dl_argv_match(dl, "help") || dl_no_arg(dl)) { ++ cmd_dpipe_table_help(); ++ return 0; ++ } else if (dl_argv_match(dl, "show")) { ++ dl_arg_inc(dl); ++ return cmd_dpipe_table_show(dl); ++ } else if (dl_argv_match(dl, "set")) { ++ dl_arg_inc(dl); ++ return cmd_dpipe_table_set(dl); ++ } else if (dl_argv_match(dl, "dump")) { ++ dl_arg_inc(dl); ++ return cmd_dpipe_table_dump(dl); ++ } ++ pr_err("Command \"%s\" not found\n", dl_argv(dl)); ++ return -ENOENT; ++} ++ ++static void cmd_dpipe_help(void) ++{ ++ pr_err("Usage: devlink dpipe [ OBJECT-LIST ]\n" ++ "where OBJECT-LIST := { header | table }\n"); ++} ++ ++static int cmd_dpipe(struct dl *dl) ++{ ++ if (dl_argv_match(dl, "help") || dl_no_arg(dl)) { ++ cmd_dpipe_help(); ++ return 0; ++ } else if (dl_argv_match(dl, "header")) { ++ dl_arg_inc(dl); ++ return cmd_dpipe_header(dl); ++ } else if (dl_argv_match(dl, "table")) { ++ dl_arg_inc(dl); ++ return cmd_dpipe_table(dl); ++ } ++ pr_err("Command \"%s\" not found\n", dl_argv(dl)); ++ return -ENOENT; ++} ++ ++static void help(void) ++{ ++ pr_err("Usage: devlink [ OPTIONS ] OBJECT { COMMAND | help }\n" ++ "where OBJECT := { dev | port | sb | monitor | dpipe }\n" ++ " OPTIONS := { -V[ersion] | -n[no-nice-names] | -j[json] | -p[pretty] | -v[verbose] }\n"); ++} ++ ++static int dl_cmd(struct dl *dl) ++{ ++ if (dl_argv_match(dl, "help") || dl_no_arg(dl)) { ++ help(); ++ return 0; ++ } else if (dl_argv_match(dl, "dev")) { ++ dl_arg_inc(dl); ++ return cmd_dev(dl); ++ } else if (dl_argv_match(dl, "port")) { ++ dl_arg_inc(dl); ++ return cmd_port(dl); ++ } else if (dl_argv_match(dl, "sb")) { ++ dl_arg_inc(dl); ++ return cmd_sb(dl); ++ } else if (dl_argv_match(dl, "monitor")) { ++ dl_arg_inc(dl); ++ return cmd_mon(dl); ++ } else if (dl_argv_match(dl, "dpipe")) { ++ dl_arg_inc(dl); ++ return cmd_dpipe(dl); ++ } ++ pr_err("Object \"%s\" not found\n", dl_argv(dl)); ++ return -ENOENT; ++} ++ ++static int dl_init(struct dl *dl, int argc, char **argv) ++{ ++ int err; ++ ++ dl->argc = argc; ++ dl->argv = argv; ++ ++ dl->nlg = mnlg_socket_open(DEVLINK_GENL_NAME, DEVLINK_GENL_VERSION); ++ if (!dl->nlg) { ++ pr_err("Failed to connect to devlink Netlink\n"); ++ return -errno; ++ } ++ ++ err = ifname_map_init(dl); ++ if (err) { ++ pr_err("Failed to create index map\n"); ++ goto err_ifname_map_create; ++ } ++ if (dl->json_output) { ++ dl->jw = jsonw_new(stdout); ++ if (!dl->jw) { ++ pr_err("Failed to create JSON writer\n"); ++ goto err_json_new; ++ } ++ jsonw_pretty(dl->jw, dl->pretty_output); ++ } ++ return 0; ++ ++err_json_new: ++ ifname_map_fini(dl); ++err_ifname_map_create: ++ mnlg_socket_close(dl->nlg); ++ return err; ++} ++ ++static void dl_fini(struct dl *dl) ++{ ++ if (dl->json_output) ++ jsonw_destroy(&dl->jw); ++ ifname_map_fini(dl); ++ mnlg_socket_close(dl->nlg); ++} ++ ++static struct dl *dl_alloc(void) ++{ ++ struct dl *dl; ++ ++ dl = calloc(1, sizeof(*dl)); ++ if (!dl) ++ return NULL; ++ return dl; ++} ++ ++static void dl_free(struct dl *dl) ++{ ++ free(dl); ++} ++ ++int main(int argc, char **argv) ++{ ++ static const struct option long_options[] = { ++ { "Version", no_argument, NULL, 'V' }, ++ { "no-nice-names", no_argument, NULL, 'n' }, ++ { "json", no_argument, NULL, 'j' }, ++ { "pretty", no_argument, NULL, 'p' }, ++ { "verbose", no_argument, NULL, 'v' }, ++ { NULL, 0, NULL, 0 } ++ }; ++ struct dl *dl; ++ int opt; ++ int err; ++ int ret; ++ ++ dl = dl_alloc(); ++ if (!dl) { ++ pr_err("Failed to allocate memory for devlink\n"); ++ return EXIT_FAILURE; ++ } ++ ++ while ((opt = getopt_long(argc, argv, "Vnjpv", ++ long_options, NULL)) >= 0) { ++ ++ switch (opt) { ++ case 'V': ++ printf("devlink utility, iproute2-ss%s\n", SNAPSHOT); ++ ret = EXIT_SUCCESS; ++ goto dl_free; ++ case 'n': ++ dl->no_nice_names = true; ++ break; ++ case 'j': ++ dl->json_output = true; ++ break; ++ case 'p': ++ dl->pretty_output = true; ++ break; ++ case 'v': ++ dl->verbose = true; + break; + default: + pr_err("Unknown option.\n"); +-- +1.8.3.1 + diff --git a/SOURCES/0026-iplink-bridge_slave-add-support-for-IFLA_BRPORT_PROX.patch b/SOURCES/0026-iplink-bridge_slave-add-support-for-IFLA_BRPORT_PROX.patch deleted file mode 100644 index 0edfa2e..0000000 --- a/SOURCES/0026-iplink-bridge_slave-add-support-for-IFLA_BRPORT_PROX.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 8cbb3468d69696ba38fb5e1015afb8d7f2e499d9 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 12:22:59 +0100 -Subject: [PATCH] iplink: bridge_slave: add support for - IFLA_BRPORT_PROXYARP_WIFI - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1374360 -Upstream Status: iproute2.git commit 38b31a78da859 -Conflicts: Context changes due to previously backported mcast_router and - mcast_fast_leave attributes. - -commit 38b31a78da859e4b72037b66477871ba8fc7bd1e -Author: Nikolay Aleksandrov -Date: Tue Feb 16 16:08:53 2016 +0100 - - iplink: bridge_slave: add support for IFLA_BRPORT_PROXYARP_WIFI - - Add support to be able to view and change IFLA_BRPORT_PROXYARP_WIFI port - attribute. - - Signed-off-by: Nikolay Aleksandrov ---- - ip/iplink_bridge_slave.c | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/ip/iplink_bridge_slave.c b/ip/iplink_bridge_slave.c -index 5a84948..3538176 100644 ---- a/ip/iplink_bridge_slave.c -+++ b/ip/iplink_bridge_slave.c -@@ -30,6 +30,7 @@ static void print_explain(FILE *f) - " [ learning {on | off} ]\n" - " [ flood {on | off} ]\n" - " [ proxy_arp {on | off} ]\n" -+ " [ proxy_arp_wifi {on | off} ]\n" - " [ mcast_router MULTICAST_ROUTER ]\n" - " [ mcast_fast_leave {on | off} ]\n" - ); -@@ -106,6 +107,10 @@ static void bridge_slave_print_opt(struct link_util *lu, FILE *f, - print_onoff(f, "proxy_arp", - rta_getattr_u8(tb[IFLA_BRPORT_PROXYARP])); - -+ if (tb[IFLA_BRPORT_PROXYARP_WIFI]) -+ print_onoff(f, "proxy_arp_wifi", -+ rta_getattr_u8(tb[IFLA_BRPORT_PROXYARP_WIFI])); -+ - if (tb[IFLA_BRPORT_MULTICAST_ROUTER]) - fprintf(f, "mcast_router %u ", - rta_getattr_u8(tb[IFLA_BRPORT_MULTICAST_ROUTER])); -@@ -181,6 +186,10 @@ static int bridge_slave_parse_opt(struct link_util *lu, int argc, char **argv, - NEXT_ARG(); - bridge_slave_parse_on_off("proxy_arp", *argv, n, - IFLA_BRPORT_PROXYARP); -+ } else if (matches(*argv, "proxy_arp_wifi") == 0) { -+ NEXT_ARG(); -+ bridge_slave_parse_on_off("proxy_arp_wifi", *argv, n, -+ IFLA_BRPORT_PROXYARP_WIFI); - } else if (matches(*argv, "mcast_router") == 0) { - __u8 mcast_router; - --- -1.8.3.1 - diff --git a/SOURCES/0027-bridge-fix-reporting-of-IPv6-addresses.patch b/SOURCES/0027-bridge-fix-reporting-of-IPv6-addresses.patch deleted file mode 100644 index dd38d4c..0000000 --- a/SOURCES/0027-bridge-fix-reporting-of-IPv6-addresses.patch +++ /dev/null @@ -1,41 +0,0 @@ -From fe16587affe3050d0c3b9438aa6470a7951270fa Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:09:08 +0100 -Subject: [PATCH] bridge: fix reporting of IPv6 addresses - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 9e763fa5d332f - -commit 9e763fa5d332f5839673aaf4a7cae10e97932564 -Author: Mike Rapoport -Date: Thu Mar 20 13:06:10 2014 +0200 - - bridge: fix reporting of IPv6 addresses - - Signed-off-by: Mike Rapoport ---- - bridge/fdb.c | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -diff --git a/bridge/fdb.c b/bridge/fdb.c -index 0191c76..092945b 100644 ---- a/bridge/fdb.c -+++ b/bridge/fdb.c -@@ -104,8 +104,13 @@ int print_fdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - - if (tb[NDA_DST]) { - SPRINT_BUF(abuf); -+ int family = AF_INET; -+ -+ if (RTA_PAYLOAD(tb[NDA_DST]) == sizeof(struct in6_addr)) -+ family = AF_INET6; -+ - fprintf(fp, "dst %s ", -- format_host(AF_INET, -+ format_host(family, - RTA_PAYLOAD(tb[NDA_DST]), - RTA_DATA(tb[NDA_DST]), - abuf, sizeof(abuf))); --- -1.8.3.1 - diff --git a/SOURCES/0027-tc-Reflect-HW-offload-status.patch b/SOURCES/0027-tc-Reflect-HW-offload-status.patch new file mode 100644 index 0000000..5a21a4d --- /dev/null +++ b/SOURCES/0027-tc-Reflect-HW-offload-status.patch @@ -0,0 +1,104 @@ +From 724d67b36f9e6bbbfac88b29fee019c05284a888 Mon Sep 17 00:00:00 2001 +From: Kamal Heib +Date: Thu, 9 Nov 2017 04:44:32 -0500 +Subject: [PATCH] tc: Reflect HW offload status + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1456539 + +commit e57285b81a098ed705d683ce94f9abd1cc53438a +Author: Or Gerlitz +Date: Thu May 4 16:15:15 2017 +0300 + + tc: Reflect HW offload status + + Currently there is no way of querying whether a filter is + offloaded to HW or not when using "both" policy (where none + of skip_sw or skip_hw flags are set by user-space). + + Add two new flags, "in hw" and "not in hw" such that user + space can determine if a filter is actually offloaded to + hw or not. The "in hw" UAPI semantics was chosen so it's + similar to the "skip hw" flag logic. + + If none of these two flags are set, this signals running + over older kernel. + + Signed-off-by: Or Gerlitz + Reviewed-by: Jiri Pirko + Reviewed-by: Simon Horman + +Signed-off-by: Kamal Heib +--- + tc/f_bpf.c | 5 +++++ + tc/f_flower.c | 5 +++++ + tc/f_matchall.c | 5 +++++ + tc/f_u32.c | 5 +++++ + 4 files changed, 20 insertions(+) + +diff --git a/tc/f_bpf.c b/tc/f_bpf.c +index df8a259..75c44c0 100644 +--- a/tc/f_bpf.c ++++ b/tc/f_bpf.c +@@ -210,6 +210,11 @@ static int bpf_print_opt(struct filter_util *qu, FILE *f, + fprintf(f, "skip_hw "); + if (flags & TCA_CLS_FLAGS_SKIP_SW) + fprintf(f, "skip_sw "); ++ ++ if (flags & TCA_CLS_FLAGS_IN_HW) ++ fprintf(f, "in_hw "); ++ else if (flags & TCA_CLS_FLAGS_NOT_IN_HW) ++ fprintf(f, "not_in_hw "); + } + + if (tb[TCA_BPF_OPS] && tb[TCA_BPF_OPS_LEN]) +diff --git a/tc/f_flower.c b/tc/f_flower.c +index 5aac4a0..ebc63ca 100644 +--- a/tc/f_flower.c ++++ b/tc/f_flower.c +@@ -1171,6 +1171,11 @@ static int flower_print_opt(struct filter_util *qu, FILE *f, + fprintf(f, "\n skip_hw"); + if (flags & TCA_CLS_FLAGS_SKIP_SW) + fprintf(f, "\n skip_sw"); ++ ++ if (flags & TCA_CLS_FLAGS_IN_HW) ++ fprintf(f, "\n in_hw"); ++ else if (flags & TCA_CLS_FLAGS_NOT_IN_HW) ++ fprintf(f, "\n not_in_hw"); + } + + if (tb[TCA_FLOWER_ACT]) +diff --git a/tc/f_matchall.c b/tc/f_matchall.c +index ac48630..5a51e75 100644 +--- a/tc/f_matchall.c ++++ b/tc/f_matchall.c +@@ -137,6 +137,11 @@ static int matchall_print_opt(struct filter_util *qu, FILE *f, + fprintf(f, "\n skip_hw"); + if (flags & TCA_CLS_FLAGS_SKIP_SW) + fprintf(f, "\n skip_sw"); ++ ++ if (flags & TCA_CLS_FLAGS_IN_HW) ++ fprintf(f, "\n in_hw"); ++ else if (flags & TCA_CLS_FLAGS_NOT_IN_HW) ++ fprintf(f, "\n not_in_hw"); + } + + if (tb[TCA_MATCHALL_ACT]) +diff --git a/tc/f_u32.c b/tc/f_u32.c +index 92c1fcd..ff700e9 100644 +--- a/tc/f_u32.c ++++ b/tc/f_u32.c +@@ -1264,6 +1264,11 @@ static int u32_print_opt(struct filter_util *qu, FILE *f, struct rtattr *opt, + fprintf(f, "skip_hw "); + if (flags & TCA_CLS_FLAGS_SKIP_SW) + fprintf(f, "skip_sw "); ++ ++ if (flags & TCA_CLS_FLAGS_IN_HW) ++ fprintf(f, "in_hw "); ++ else if (flags & TCA_CLS_FLAGS_NOT_IN_HW) ++ fprintf(f, "not_in_hw "); + } + + if (tb[TCA_U32_PCNT]) { +-- +1.8.3.1 + diff --git a/SOURCES/0028-iproute2-ipa-show-port-id.patch b/SOURCES/0028-iproute2-ipa-show-port-id.patch deleted file mode 100644 index f91d5d8..0000000 --- a/SOURCES/0028-iproute2-ipa-show-port-id.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 3d68599ce6e1a6dca3f1781ab3589d6a78fd5c8e Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:09:08 +0100 -Subject: [PATCH] iproute2: ipa: show port id - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit c897067480a0e - -commit c897067480a0e0fbf6231edf1ded8fc12ca6ad9d -Author: Jiri Pirko -Date: Thu May 15 15:10:22 2014 +0200 - - iproute2: ipa: show port id - - Signed-off-by: Jiri Pirko ---- - ip/ipaddress.c | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/ip/ipaddress.c b/ip/ipaddress.c -index e39137f..0c741ff 100644 ---- a/ip/ipaddress.c -+++ b/ip/ipaddress.c -@@ -635,6 +635,14 @@ int print_linkinfo(const struct sockaddr_nl *who, - fprintf(fp, "master %s ", ll_idx_n2a(*(int*)RTA_DATA(tb[IFLA_MASTER]), b1)); - } - -+ if (tb[IFLA_PHYS_PORT_ID]) { -+ SPRINT_BUF(b1); -+ fprintf(fp, "portid %s ", -+ hexstring_n2a(RTA_DATA(tb[IFLA_PHYS_PORT_ID]), -+ RTA_PAYLOAD(tb[IFLA_PHYS_PORT_ID]), -+ b1, sizeof(b1))); -+ } -+ - if (tb[IFLA_OPERSTATE]) - print_operstate(fp, rta_getattr_u8(tb[IFLA_OPERSTATE])); - --- -1.8.3.1 - diff --git a/SOURCES/0028-pedit-Fix-a-typo-in-warning.patch b/SOURCES/0028-pedit-Fix-a-typo-in-warning.patch new file mode 100644 index 0000000..e19cd7d --- /dev/null +++ b/SOURCES/0028-pedit-Fix-a-typo-in-warning.patch @@ -0,0 +1,39 @@ +From b2e49d92325d876d29e2d4f1a83bd86adfc4bc73 Mon Sep 17 00:00:00 2001 +From: Kamal Heib +Date: Thu, 9 Nov 2017 04:44:32 -0500 +Subject: [PATCH] pedit: Fix a typo in warning + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1456539 + +commit 290cdc058d8bbcae3cfefafe83d8263e02ac5a6f +Author: Amir Vadai +Date: Sun May 14 11:17:43 2017 +0300 + + pedit: Fix a typo in warning + + 'ex' attribute should be placed after 'action pedit' and not after + 'munge'. + + Signed-off-by: Amir Vadai + +Signed-off-by: Kamal Heib +--- + tc/m_pedit.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tc/m_pedit.c b/tc/m_pedit.c +index 6498dd9..7ef2acc 100644 +--- a/tc/m_pedit.c ++++ b/tc/m_pedit.c +@@ -146,7 +146,7 @@ int pack_key(struct m_pedit_sel *_sel, struct m_pedit_key *tkey) + if (tkey->htype != TCA_PEDIT_KEY_EX_HDR_TYPE_NETWORK || + tkey->cmd != TCA_PEDIT_KEY_EX_CMD_SET) { + fprintf(stderr, +- "Munge parameters not supported. Use 'munge ex'.\n"); ++ "Munge parameters not supported. Use 'pedit ex munge ...'.\n"); + return -1; + } + } +-- +1.8.3.1 + diff --git a/SOURCES/0029-bridge-Add-learning-and-flood-support.patch b/SOURCES/0029-bridge-Add-learning-and-flood-support.patch deleted file mode 100644 index 7bb0a03..0000000 --- a/SOURCES/0029-bridge-Add-learning-and-flood-support.patch +++ /dev/null @@ -1,117 +0,0 @@ -From 8e5969521d5df7a63d9a20597cb9d52b776c3e6e Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:09:08 +0100 -Subject: [PATCH] bridge: Add learning and flood support - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit f0f4ab600b5a9 - -commit f0f4ab600b5a9d1f718c8812e20dffe61ca95989 -Author: Vlad Yasevich -Date: Wed May 21 09:53:43 2014 -0400 - - bridge: Add learning and flood support - - Add ability to control learning and flood flags on bridge - ports. - - Signed-off-by: Vlad Yasevich ---- - bridge/link.c | 22 ++++++++++++++++++++++ - man/man8/bridge.8 | 12 ++++++++++++ - 2 files changed, 34 insertions(+) - -diff --git a/bridge/link.c b/bridge/link.c -index 19d0642..176c906 100644 ---- a/bridge/link.c -+++ b/bridge/link.c -@@ -185,6 +185,12 @@ int print_linkinfo(const struct sockaddr_nl *who, - if (prtb[IFLA_BRPORT_FAST_LEAVE]) - print_onoff(fp, "fastleave", - rta_getattr_u8(prtb[IFLA_BRPORT_FAST_LEAVE])); -+ if (prtb[IFLA_BRPORT_LEARNING]) -+ print_onoff(fp, "learning", -+ rta_getattr_u8(prtb[IFLA_BRPORT_LEARNING])); -+ if (prtb[IFLA_BRPORT_UNICAST_FLOOD]) -+ print_onoff(fp, "flood", -+ rta_getattr_u8(prtb[IFLA_BRPORT_UNICAST_FLOOD])); - } - } else - print_portstate(fp, rta_getattr_u8(tb[IFLA_PROTINFO])); -@@ -214,6 +220,8 @@ static void usage(void) - fprintf(stderr, " [ hairpin {on | off} ] \n"); - fprintf(stderr, " [ fastleave {on | off} ]\n"); - fprintf(stderr, " [ root_block {on | off} ]\n"); -+ fprintf(stderr, " [ learning {on | off} ]\n"); -+ fprintf(stderr, " [ flood {on | off} ]\n"); - fprintf(stderr, " [ hwmode {vepa | veb} ]\n"); - fprintf(stderr, " bridge link show [dev DEV]\n"); - exit(-1); -@@ -243,6 +251,8 @@ static int brlink_modify(int argc, char **argv) - char buf[512]; - } req; - char *d = NULL; -+ __s8 learning = -1; -+ __s8 flood = -1; - __s8 hairpin = -1; - __s8 bpdu_guard = -1; - __s8 fast_leave = -1; -@@ -281,6 +291,14 @@ static int brlink_modify(int argc, char **argv) - NEXT_ARG(); - if (!on_off("root_block", &root_block, *argv)) - exit(-1); -+ } else if (strcmp(*argv, "learning") == 0) { -+ NEXT_ARG(); -+ if (!on_off("learning", &learning, *argv)) -+ exit(-1); -+ } else if (strcmp(*argv, "flood") == 0) { -+ NEXT_ARG(); -+ if (!on_off("flood", &flood, *argv)) -+ exit(-1); - } else if (strcmp(*argv, "cost") == 0) { - NEXT_ARG(); - cost = atoi(*argv); -@@ -335,6 +353,10 @@ static int brlink_modify(int argc, char **argv) - fast_leave); - if (root_block >= 0) - addattr8(&req.n, sizeof(req), IFLA_BRPORT_PROTECT, root_block); -+ if (flood >= 0) -+ addattr8(&req.n, sizeof(req), IFLA_BRPORT_UNICAST_FLOOD, flood); -+ if (learning >= 0) -+ addattr8(&req.n, sizeof(req), IFLA_BRPORT_LEARNING, learning); - - if (cost > 0) - addattr32(&req.n, sizeof(req), IFLA_BRPORT_COST, cost); -diff --git a/man/man8/bridge.8 b/man/man8/bridge.8 -index 4f48546..5e51d54 100644 ---- a/man/man8/bridge.8 -+++ b/man/man8/bridge.8 -@@ -37,6 +37,8 @@ bridge \- show / manipulate bridge addresses and devices - .BR hairpin " { " on " | " off " } ] [ " - .BR fastleave " { " on " | " off " } ] [ " - .BR root_block " { " on " | " off " } ] [ " -+.BR learning " { " on " | " off " } ] [ " -+.BR flood " { " on " | " off " } ] [ " - .BR hwmode " { " vepa " | " veb " } ] " - - .ti -8 -@@ -255,6 +257,16 @@ Controls whether a given port is allowed to become root port or not. Only used - when STP is enabled on the bridge. By default the flag is off. - - .TP -+.BR "learning on " or " learning off " -+Controls whether a given port will learn MAC addresses from received traffic or -+not. If learning if off, the bridge will end up flooding any traffic for which -+it has no FDB entry. By default this flag is on. -+ -+.TP -+.BR "flooding on " or " flooding off " -+Controls whether a given port will flood unicast traffic for which there is no FDB entry. By default this flag is on. -+ -+.TP - .BI hwmode - Some network interface cards support HW bridge functionality and they may be - configured in different modes. Currently support modes are: --- -1.8.3.1 - diff --git a/SOURCES/0029-pedit-Do-not-allow-using-retain-for-too-big-fields.patch b/SOURCES/0029-pedit-Do-not-allow-using-retain-for-too-big-fields.patch new file mode 100644 index 0000000..8a3d95b --- /dev/null +++ b/SOURCES/0029-pedit-Do-not-allow-using-retain-for-too-big-fields.patch @@ -0,0 +1,58 @@ +From 2bf855b076bbe5aa4665f7efd8bcaf882821cab5 Mon Sep 17 00:00:00 2001 +From: Kamal Heib +Date: Thu, 9 Nov 2017 04:44:32 -0500 +Subject: [PATCH] pedit: Do not allow using retain for too big fields + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1456539 + +commit cdca191862775c47533908301760edd55763e861 +Author: Amir Vadai +Date: Sun May 14 11:17:44 2017 +0300 + + pedit: Do not allow using retain for too big fields + + Using retain for fields longer than 32 bits is not supported. + Do not allow user to do it. + + Signed-off-by: Amir Vadai + +Signed-off-by: Kamal Heib +--- + man/man8/tc-pedit.8 | 3 ++- + tc/m_pedit.c | 6 ++++++ + 2 files changed, 8 insertions(+), 1 deletion(-) + +diff --git a/man/man8/tc-pedit.8 b/man/man8/tc-pedit.8 +index 7f482ea..9c4d57b 100644 +--- a/man/man8/tc-pedit.8 ++++ b/man/man8/tc-pedit.8 +@@ -266,7 +266,8 @@ Keep the addressed data as is. + .BI retain " RVAL" + This optional extra part of + .I CMD_SPEC +-allows to exclude bits from being changed. ++allows to exclude bits from being changed. Supported only for 32 bits fields ++or smaller. + .TP + .I CONTROL + The following keywords allow to control how the tree of qdisc, classes, +diff --git a/tc/m_pedit.c b/tc/m_pedit.c +index 7ef2acc..9b74c96 100644 +--- a/tc/m_pedit.c ++++ b/tc/m_pedit.c +@@ -353,6 +353,12 @@ int parse_cmd(int *argc_p, char ***argv_p, __u32 len, int type, __u32 retain, + argv++; + } + ++ if (len > 4 && retain != ~0) { ++ fprintf(stderr, ++ "retain is not supported for fields longer the 32 bits\n"); ++ return -1; ++ } ++ + if (type == TMAC) { + res = pack_mac(sel, tkey, (__u8 *)val); + goto done; +-- +1.8.3.1 + diff --git a/SOURCES/0030-bridge-Make-filter_index-match-in-signedness.patch b/SOURCES/0030-bridge-Make-filter_index-match-in-signedness.patch deleted file mode 100644 index f7c8f8d..0000000 --- a/SOURCES/0030-bridge-Make-filter_index-match-in-signedness.patch +++ /dev/null @@ -1,115 +0,0 @@ -From e063ae1315f846a27351ace6968ff7dccb2e368c Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:09:08 +0100 -Subject: [PATCH] bridge: Make filter_index match in signedness - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 9dca899b2d971 - -commit 9dca899b2d97163f18b66c21b5e7acec893b0fa4 -Author: Andreas Henriksson -Date: Wed Jun 4 19:40:37 2014 +0200 - - bridge: Make filter_index match in signedness - - Michael Tautschnig wrote: - - During a rebuild [...]. Please note that we use our research - compiler tool-chain (using tools from the cbmc package), which permits extended - reporting on type inconsistencies at link time. - - [...] - gcc bridge.o fdb.o monitor.o link.o mdb.o vlan.o ../lib/libnetlink.a ../lib/libutil.a ../lib/libnetlink.a ../lib/libutil.a -o bridge - file link.c line 18: error: conflicting types for variable "filter_index" - old definition in module fdb file fdb.c line 29 - signed int - new definition in module link file link.c line 18 - unsigned int - : recipe for target 'bridge' failed - make[3]: *** [bridge] Error 64 - make[3]: Leaving directory '/srv/jenkins-slave/workspace/sid-goto-cc-iproute2/iproute2-3.14.0/bridge' - Makefile:45: recipe for target 'all' failed - - While practical constraints may limit the value of filter_index to remain within - the bounds of a positive signed int, there is certainly no such guarantee here. - Also, a plain majority vote suggests that this really just a wrong declaration - in link.c as several declarations of filter_index as signed int exist. - - [...] - - My followup on this was: - - I think the majority is wrong. - - filter_index is assigned exclusively from if_nametoindex or ll_name_to_index - which both return unsigned int. - - Changing it to unsigned everywhere seems better. - - This has been minimally tested by using the bridge tool - to add vids and showing available vids on different devices. - - Reported-by: Michael Tautschnig - Signed-off-by: Andreas Henriksson ---- - bridge/fdb.c | 2 +- - bridge/link.c | 2 +- - bridge/mdb.c | 2 +- - bridge/vlan.c | 2 +- - 4 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/bridge/fdb.c b/bridge/fdb.c -index 092945b..b29c776 100644 ---- a/bridge/fdb.c -+++ b/bridge/fdb.c -@@ -26,7 +26,7 @@ - #include "rt_names.h" - #include "utils.h" - --int filter_index; -+static unsigned int filter_index; - - static void usage(void) - { -diff --git a/bridge/link.c b/bridge/link.c -index 176c906..14e4e5a 100644 ---- a/bridge/link.c -+++ b/bridge/link.c -@@ -15,7 +15,7 @@ - #include "utils.h" - #include "br_common.h" - --unsigned int filter_index; -+static unsigned int filter_index; - - static const char *port_states[] = { - [BR_STATE_DISABLED] = "disabled", -diff --git a/bridge/mdb.c b/bridge/mdb.c -index 1cd03e0..837fa5d 100644 ---- a/bridge/mdb.c -+++ b/bridge/mdb.c -@@ -24,7 +24,7 @@ - ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct br_port_msg)))) - #endif - --int filter_index; -+static unsigned int filter_index; - - static void usage(void) - { -diff --git a/bridge/vlan.c b/bridge/vlan.c -index 54e10d0..2ceecc9 100644 ---- a/bridge/vlan.c -+++ b/bridge/vlan.c -@@ -13,7 +13,7 @@ - #include "br_common.h" - #include "utils.h" - --int filter_index; -+static unsigned int filter_index; - - static void usage(void) - { --- -1.8.3.1 - diff --git a/SOURCES/0030-pedit-Check-for-extended-capability-in-protocol-pars.patch b/SOURCES/0030-pedit-Check-for-extended-capability-in-protocol-pars.patch new file mode 100644 index 0000000..81a89ce --- /dev/null +++ b/SOURCES/0030-pedit-Check-for-extended-capability-in-protocol-pars.patch @@ -0,0 +1,55 @@ +From 0bc6d74ce3291b669bc05524b404bc6914dab5ba Mon Sep 17 00:00:00 2001 +From: Kamal Heib +Date: Thu, 9 Nov 2017 04:44:32 -0500 +Subject: [PATCH] pedit: Check for extended capability in protocol parser + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1456539 + +commit a13426fe1a2b0fdebacc33820105523934eb355f +Author: Amir Vadai +Date: Sun May 14 11:17:45 2017 +0300 + + pedit: Check for extended capability in protocol parser + + Do not allow using eth and udp header types if non-extended pedit kABI + is being used. Other protocol parsers already have this check. + + Signed-off-by: Amir Vadai + +Signed-off-by: Kamal Heib +--- + tc/p_eth.c | 3 +++ + tc/p_udp.c | 3 +++ + 2 files changed, 6 insertions(+) + +diff --git a/tc/p_eth.c b/tc/p_eth.c +index ad3e28f..2d2f96c 100644 +--- a/tc/p_eth.c ++++ b/tc/p_eth.c +@@ -34,6 +34,9 @@ parse_eth(int *argc_p, char ***argv_p, + if (argc < 2) + return -1; + ++ if (!sel->extended) ++ return -1; ++ + tkey->htype = TCA_PEDIT_KEY_EX_HDR_TYPE_ETH; + + if (strcmp(*argv, "type") == 0) { +diff --git a/tc/p_udp.c b/tc/p_udp.c +index a56a1b5..3916d95 100644 +--- a/tc/p_udp.c ++++ b/tc/p_udp.c +@@ -34,6 +34,9 @@ parse_udp(int *argc_p, char ***argv_p, + if (argc < 2) + return -1; + ++ if (!sel->extended) ++ return -1; ++ + tkey->htype = TCA_PEDIT_KEY_EX_HDR_TYPE_UDP; + + if (strcmp(*argv, "sport") == 0) { +-- +1.8.3.1 + diff --git a/SOURCES/0031-link-dump-filter.patch b/SOURCES/0031-link-dump-filter.patch deleted file mode 100644 index 4a85e89..0000000 --- a/SOURCES/0031-link-dump-filter.patch +++ /dev/null @@ -1,128 +0,0 @@ -From a8851ce90a891abe9c45dd9d79e8d673b7258646 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:09:08 +0100 -Subject: [PATCH] link dump filter - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 50b9950dd9011 -Conflicts: Manually applied changes to added code from previously - backported commit c079e121a73af ("libnetlink: add size - argument to rtnl_talk"). - -commit 50b9950dd90114609e10298c0fa32a9371250687 -Author: Roopa Prabhu -Date: Wed Jul 16 07:13:25 2014 -0700 - - link dump filter - - This patch avoids a full link wildump request when the user has specified - a single link. Uses RTM_GETLINK without the NLM_F_DUMP flag. - - This helps on a system with large number of interfaces. - - This patch currently only uses the link ifindex in the filter. - Hoping to provide a subsequent kernel patch to do link dump filtering on - other attributes in the kernel. - - In iplink_get, to be safe, this patch currently sets the answer buffer - size to the max size that libnetlink rtnl_talk can copy. The current api - does not seem to provide a way to indicate the answer buf size. - - changelog from RFC to v1: - - incorporated comments from stephen (fixed comment and fixed if/else block) - - changelog from v1 to v2: - - fix whitespaces error - - Signed-off-by: Roopa Prabhu ---- - ip/ip_common.h | 1 + - ip/ipaddress.c | 13 +++++++++++++ - ip/iplink.c | 35 +++++++++++++++++++++++++++++++++++ - 3 files changed, 49 insertions(+) - -diff --git a/ip/ip_common.h b/ip/ip_common.h -index 42eda66..286f61f 100644 ---- a/ip/ip_common.h -+++ b/ip/ip_common.h -@@ -56,6 +56,7 @@ extern int do_ipl2tp(int argc, char **argv); - extern int do_tcp_metrics(int argc, char **argv); - extern int do_ipnetconf(int argc, char **argv); - extern int do_iptoken(int argc, char **argv); -+extern int iplink_get(unsigned int flags, char *name, __u32 filt_mask); - - static inline int rtm_get_table(struct rtmsg *r, struct rtattr **tb) - { -diff --git a/ip/ipaddress.c b/ip/ipaddress.c -index 0c741ff..b24b103 100644 ---- a/ip/ipaddress.c -+++ b/ip/ipaddress.c -@@ -1392,6 +1392,19 @@ static int ipaddr_list_flush_or_save(int argc, char **argv, int action) - exit(0); - } - -+ /* -+ * If only filter_dev present and none of the other -+ * link filters are present, use RTM_GETLINK to get -+ * the link device -+ */ -+ if (filter_dev && filter.group == -1 && do_link == 1) { -+ if (iplink_get(0, filter_dev, RTEXT_FILTER_VF) < 0) { -+ perror("Cannot send link get request"); -+ exit(1); -+ } -+ exit(0); -+ } -+ - if (rtnl_wilddump_request(&rth, preferred_family, RTM_GETLINK) < 0) { - perror("Cannot send dump request"); - exit(1); -diff --git a/ip/iplink.c b/ip/iplink.c -index f75193f..10f97af 100644 ---- a/ip/iplink.c -+++ b/ip/iplink.c -@@ -829,6 +829,41 @@ static int iplink_modify(int cmd, unsigned int flags, int argc, char **argv) - return 0; - } - -+int iplink_get(unsigned int flags, char *name, __u32 filt_mask) -+{ -+ int len; -+ struct iplink_req req; -+ struct { -+ struct nlmsghdr n; -+ char buf[16384]; -+ } answer; -+ -+ memset(&req, 0, sizeof(req)); -+ -+ req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifinfomsg)); -+ req.n.nlmsg_flags = NLM_F_REQUEST|flags; -+ req.n.nlmsg_type = RTM_GETLINK; -+ req.i.ifi_family = preferred_family; -+ -+ if (name) { -+ len = strlen(name) + 1; -+ if (len == 1) -+ invarg("\"\" is not a valid device identifier\n", -+ "name"); -+ if (len > IFNAMSIZ) -+ invarg("\"name\" too long\n", name); -+ addattr_l(&req.n, sizeof(req), IFLA_IFNAME, name, len); -+ } -+ addattr32(&req.n, sizeof(req), IFLA_EXT_MASK, filt_mask); -+ -+ if (rtnl_talk(&rth, &req.n, &answer.n, sizeof(answer)) < 0) -+ return -2; -+ -+ print_linkinfo(NULL, &answer.n, stdout); -+ -+ return 0; -+} -+ - #if IPLINK_IOCTL_COMPAT - static int get_ctl_fd(void) - { --- -1.8.3.1 - diff --git a/SOURCES/0031-pedit-Introduce-ipv6-support.patch b/SOURCES/0031-pedit-Introduce-ipv6-support.patch new file mode 100644 index 0000000..aacdc14 --- /dev/null +++ b/SOURCES/0031-pedit-Introduce-ipv6-support.patch @@ -0,0 +1,304 @@ +From 26ab66d7c43c3ef60ab058d4c3da8989a5c1dd46 Mon Sep 17 00:00:00 2001 +From: Kamal Heib +Date: Thu, 9 Nov 2017 04:44:32 -0500 +Subject: [PATCH] pedit: Introduce ipv6 support + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1456539 + +commit f3e1b2448a95baef587965b08f48d49b6e1ec2cb +Author: Amir Vadai +Date: Sun May 14 11:17:46 2017 +0300 + + pedit: Introduce ipv6 support + + Add support for modifying IPv6 headers using pedit. + + Signed-off-by: Amir Vadai + +Signed-off-by: Kamal Heib +--- + man/man8/tc-pedit.8 | 30 ++++++++++++++++++ + tc/Makefile | 1 + + tc/m_pedit.c | 43 +++++++++++++++++++++++-- + tc/p_ip.c | 17 +--------- + tc/p_ip6.c | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++++ + 5 files changed, 164 insertions(+), 18 deletions(-) + create mode 100644 tc/p_ip6.c + +diff --git a/man/man8/tc-pedit.8 b/man/man8/tc-pedit.8 +index 9c4d57b..82d4217 100644 +--- a/man/man8/tc-pedit.8 ++++ b/man/man8/tc-pedit.8 +@@ -33,6 +33,8 @@ pedit - generic packet editor action + | + .BI ip " EX_IPHDR_FIELD" + | ++.BI ip6 " IP6HDR_FIELD" ++| + .BI tcp " TCPHDR_FIELD" + | + .BI udp " UDPHDR_FIELD" +@@ -55,6 +57,12 @@ pedit - generic packet editor action + .IR EX_IPHDR_FIELD " := { " + .BR ttl " }" + ++ ++.ti -8 ++.IR IP6HDR_FIELD " := { " ++.BR src " | " dst " | " flow_lbl " | " payload_len " | " nexthdr " |" ++.BR hoplimit " }" ++ + .ti -8 + .IR TCPHDR_FIELD " := { " + .BR sport " | " dport " | " flags " }" +@@ -211,6 +219,25 @@ are: + .B ttl + .RE + .TP ++.BI ip6 " IP6HDR_FIELD" ++The supported keywords for ++.I IP6HDR_FIELD ++are: ++.RS ++.TP ++.B src ++.TQ ++.B dst ++.TQ ++.B flow_lbl ++.TQ ++.B payload_len ++.TQ ++.B nexthdr ++.TQ ++.B hoplimit ++.RE ++.TP + .BI tcp " TCPHDR_FIELD" + The supported keywords for + .I TCPHDR_FIELD +@@ -331,6 +358,9 @@ tc filter add dev eth0 parent ffff: u32 \\ + action pedit ex munge ip dst set 192.168.1.199 + tc filter add dev eth0 parent ffff: u32 \\ + match ip sport 22 0xffff \\ ++ action pedit ex munge ip6 dst set fe80::dacb:8aff:fec7:320e ++tc filter add dev eth0 parent ffff: u32 \\ ++ match ip sport 22 0xffff \\ + action pedit ex munge eth dst set 11:22:33:44:55:66 + tc filter add dev eth0 parent ffff: u32 \\ + match ip dport 23 0xffff \\ +diff --git a/tc/Makefile b/tc/Makefile +index 446a113..9a6bb1d 100644 +--- a/tc/Makefile ++++ b/tc/Makefile +@@ -53,6 +53,7 @@ TCMODULES += m_bpf.o + TCMODULES += m_tunnel_key.o + TCMODULES += m_sample.o + TCMODULES += p_ip.o ++TCMODULES += p_ip6.o + TCMODULES += p_icmp.o + TCMODULES += p_eth.o + TCMODULES += p_tcp.o +diff --git a/tc/m_pedit.c b/tc/m_pedit.c +index 9b74c96..dfa6b2c 100644 +--- a/tc/m_pedit.c ++++ b/tc/m_pedit.c +@@ -257,6 +257,32 @@ static int pack_mac(struct m_pedit_sel *sel, struct m_pedit_key *tkey, + return ret; + } + ++static int pack_ipv6(struct m_pedit_sel *sel, struct m_pedit_key *tkey, ++ __u32 *ipv6) ++{ ++ int ret = 0; ++ int i; ++ ++ if (tkey->off & 0x3) { ++ fprintf(stderr, ++ "pack_ipv6: IPv6 offsets must begin in 32bit boundaries\n"); ++ return -1; ++ } ++ ++ for (i = 0; i < 4; i++) { ++ tkey->mask = 0; ++ tkey->val = ntohl(ipv6[i]); ++ ++ ret = pack_key32(~0, sel, tkey); ++ if (ret) ++ return ret; ++ ++ tkey->off += 4; ++ } ++ ++ return 0; ++} ++ + int parse_val(int *argc_p, char ***argv_p, __u32 *val, int type) + { + int argc = *argc_p; +@@ -281,8 +307,16 @@ int parse_val(int *argc_p, char ***argv_p, __u32 *val, int type) + return 0; + } + +- if (type == TIPV6) +- return -1; /* not implemented yet */ ++ if (type == TIPV6) { ++ inet_prefix addr; ++ ++ if (get_prefix_1(&addr, *argv, AF_INET6)) ++ return -1; ++ ++ memcpy(val, addr.data, addr.bytelen); ++ ++ return 0; ++ } + + if (type == TMAC) { + #define MAC_ALEN 6 +@@ -364,6 +398,11 @@ int parse_cmd(int *argc_p, char ***argv_p, __u32 len, int type, __u32 retain, + goto done; + } + ++ if (type == TIPV6) { ++ res = pack_ipv6(sel, tkey, val); ++ goto done; ++ } ++ + tkey->val = *v; + tkey->mask = *m; + +diff --git a/tc/p_ip.c b/tc/p_ip.c +index 22fe650..0272a6e 100644 +--- a/tc/p_ip.c ++++ b/tc/p_ip.c +@@ -1,5 +1,5 @@ + /* +- * m_pedit.c packet editor: IPV4/6 header ++ * p_ip.c packet editor: IPV4 header + * + * This program is free software; you can distribute it and/or + * modify it under the terms of the GNU General Public License +@@ -156,23 +156,8 @@ done: + return res; + } + +-static int +-parse_ip6(int *argc_p, char ***argv_p, +- struct m_pedit_sel *sel, struct m_pedit_key *tkey) +-{ +- int res = -1; +- return res; +-} +- + struct m_pedit_util p_pedit_ip = { + NULL, + "ip", + parse_ip, + }; +- +- +-struct m_pedit_util p_pedit_ip6 = { +- NULL, +- "ip6", +- parse_ip6, +-}; +diff --git a/tc/p_ip6.c b/tc/p_ip6.c +new file mode 100644 +index 0000000..a4824bd +--- /dev/null ++++ b/tc/p_ip6.c +@@ -0,0 +1,91 @@ ++/* ++ * p_ip6.c packet editor: IPV6 header ++ * ++ * This program is free software; you can distribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version ++ * 2 of the License, or (at your option) any later version. ++ * ++ * Authors: Amir Vadai ++ * ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include "utils.h" ++#include "tc_util.h" ++#include "m_pedit.h" ++ ++static int ++parse_ip6(int *argc_p, char ***argv_p, ++ struct m_pedit_sel *sel, struct m_pedit_key *tkey) ++{ ++ int res = -1; ++ int argc = *argc_p; ++ char **argv = *argv_p; ++ ++ if (argc < 2) ++ return -1; ++ ++ if (!sel->extended) ++ return -1; ++ ++ tkey->htype = TCA_PEDIT_KEY_EX_HDR_TYPE_IP6; ++ ++ if (strcmp(*argv, "src") == 0) { ++ NEXT_ARG(); ++ tkey->off = 8; ++ res = parse_cmd(&argc, &argv, 16, TIPV6, RU32, sel, tkey); ++ goto done; ++ } ++ if (strcmp(*argv, "dst") == 0) { ++ NEXT_ARG(); ++ tkey->off = 24; ++ res = parse_cmd(&argc, &argv, 16, TIPV6, RU32, sel, tkey); ++ goto done; ++ } ++ if (strcmp(*argv, "flow_lbl") == 0) { ++ NEXT_ARG(); ++ tkey->off = 0; ++ res = parse_cmd(&argc, &argv, 4, TU32, 0x0007ffff, sel, tkey); ++ goto done; ++ } ++ if (strcmp(*argv, "payload_len") == 0) { ++ NEXT_ARG(); ++ tkey->off = 4; ++ res = parse_cmd(&argc, &argv, 2, TU32, RU16, sel, tkey); ++ goto done; ++ } ++ if (strcmp(*argv, "nexthdr") == 0) { ++ NEXT_ARG(); ++ tkey->off = 6; ++ res = parse_cmd(&argc, &argv, 1, TU32, RU8, sel, tkey); ++ goto done; ++ } ++ if (strcmp(*argv, "hoplimit") == 0) { ++ NEXT_ARG(); ++ tkey->off = 7; ++ res = parse_cmd(&argc, &argv, 1, TU32, RU8, sel, tkey); ++ goto done; ++ } ++ ++ return -1; ++ ++done: ++ *argc_p = argc; ++ *argv_p = argv; ++ return res; ++} ++ ++struct m_pedit_util p_pedit_ip6 = { ++ NULL, ++ "ipv6", ++ parse_ip6, ++}; +-- +1.8.3.1 + diff --git a/SOURCES/0032-devlink-Add-option-to-set-and-show-eswitch-encapsula.patch b/SOURCES/0032-devlink-Add-option-to-set-and-show-eswitch-encapsula.patch new file mode 100644 index 0000000..00d638f --- /dev/null +++ b/SOURCES/0032-devlink-Add-option-to-set-and-show-eswitch-encapsula.patch @@ -0,0 +1,189 @@ +From d9857ffec0266aea1c56ee26369972ade68f501a Mon Sep 17 00:00:00 2001 +From: Kamal Heib +Date: Thu, 9 Nov 2017 04:44:32 -0500 +Subject: [PATCH] devlink: Add option to set and show eswitch encapsulation + support + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1456539 + +commit d315b706e9d4a550096140aa298d46b2aa7733e9 +Author: Roi Dayan +Date: Sun May 21 08:37:27 2017 +0300 + + devlink: Add option to set and show eswitch encapsulation support + + This is an e-switch global knob to enable HW support for applying + encapsulation/decapsulation to VF traffic as part of SRIOV e-switch offloading. + + The actual encap/decap is carried out (along with the matching and other + actions) per offloaded e-switch rules, e.g as done when offloading the TC tunnel + key action. + + Possible values are enable/disable. + + Signed-off-by: Roi Dayan + Reviewed-by: Jiri Pirko + +Signed-off-by: Kamal Heib +--- + devlink/devlink.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++- + man/man8/devlink-dev.8 | 13 +++++++++++++ + 2 files changed, 60 insertions(+), 1 deletion(-) + +diff --git a/devlink/devlink.c b/devlink/devlink.c +index e22ee0a..f9bc16c 100644 +--- a/devlink/devlink.c ++++ b/devlink/devlink.c +@@ -176,6 +176,7 @@ static void ifname_map_free(struct ifname_map *ifname_map) + #define DL_OPT_ESWITCH_INLINE_MODE BIT(12) + #define DL_OPT_DPIPE_TABLE_NAME BIT(13) + #define DL_OPT_DPIPE_TABLE_COUNTERS BIT(14) ++#define DL_OPT_ESWITCH_ENCAP_MODE BIT(15) + + struct dl_opts { + uint32_t present; /* flags of present items */ +@@ -195,6 +196,7 @@ struct dl_opts { + enum devlink_eswitch_inline_mode eswitch_inline_mode; + const char *dpipe_table_name; + bool dpipe_counters_enable; ++ bool eswitch_encap_mode; + }; + + struct dl { +@@ -299,6 +301,7 @@ static const enum mnl_attr_data_type devlink_policy[DEVLINK_ATTR_MAX + 1] = { + [DEVLINK_ATTR_SB_OCC_MAX] = MNL_TYPE_U32, + [DEVLINK_ATTR_ESWITCH_MODE] = MNL_TYPE_U16, + [DEVLINK_ATTR_ESWITCH_INLINE_MODE] = MNL_TYPE_U8, ++ [DEVLINK_ATTR_ESWITCH_ENCAP_MODE] = MNL_TYPE_U8, + [DEVLINK_ATTR_DPIPE_TABLES] = MNL_TYPE_NESTED, + [DEVLINK_ATTR_DPIPE_TABLE] = MNL_TYPE_NESTED, + [DEVLINK_ATTR_DPIPE_TABLE_NAME] = MNL_TYPE_STRING, +@@ -754,6 +757,19 @@ static int dpipe_counters_enable_get(const char *typestr, + return 0; + } + ++static int eswitch_encap_mode_get(const char *typestr, bool *p_mode) ++{ ++ if (strcmp(typestr, "enable") == 0) { ++ *p_mode = true; ++ } else if (strcmp(typestr, "disable") == 0) { ++ *p_mode = false; ++ } else { ++ pr_err("Unknown eswitch encap mode \"%s\"\n", typestr); ++ return -EINVAL; ++ } ++ return 0; ++} ++ + static int dl_argv_parse(struct dl *dl, uint32_t o_required, + uint32_t o_optional) + { +@@ -908,7 +924,19 @@ static int dl_argv_parse(struct dl *dl, uint32_t o_required, + if (err) + return err; + o_found |= DL_OPT_DPIPE_TABLE_COUNTERS; ++ } else if (dl_argv_match(dl, "encap") && ++ (o_all & DL_OPT_ESWITCH_ENCAP_MODE)) { ++ const char *typestr; + ++ dl_arg_inc(dl); ++ err = dl_argv_str(dl, &typestr); ++ if (err) ++ return err; ++ err = eswitch_encap_mode_get(typestr, ++ &opts->eswitch_encap_mode); ++ if (err) ++ return err; ++ o_found |= DL_OPT_ESWITCH_ENCAP_MODE; + } else { + pr_err("Unknown option \"%s\"\n", dl_argv(dl)); + return -EINVAL; +@@ -986,6 +1014,13 @@ static int dl_argv_parse(struct dl *dl, uint32_t o_required, + pr_err("Dpipe table counter state expected\n"); + return -EINVAL; + } ++ ++ if ((o_required & DL_OPT_ESWITCH_ENCAP_MODE) && ++ !(o_found & DL_OPT_ESWITCH_ENCAP_MODE)) { ++ pr_err("E-Switch encapsulation option expected.\n"); ++ return -EINVAL; ++ } ++ + return 0; + } + +@@ -1041,6 +1076,9 @@ static void dl_opts_put(struct nlmsghdr *nlh, struct dl *dl) + if (opts->present & DL_OPT_DPIPE_TABLE_COUNTERS) + mnl_attr_put_u8(nlh, DEVLINK_ATTR_DPIPE_TABLE_COUNTERS_ENABLED, + opts->dpipe_counters_enable); ++ if (opts->present & DL_OPT_ESWITCH_ENCAP_MODE) ++ mnl_attr_put_u8(nlh, DEVLINK_ATTR_ESWITCH_ENCAP_MODE, ++ opts->eswitch_encap_mode); + } + + static int dl_argv_parse_put(struct nlmsghdr *nlh, struct dl *dl, +@@ -1097,6 +1135,7 @@ static void cmd_dev_help(void) + pr_err("Usage: devlink dev show [ DEV ]\n"); + pr_err(" devlink dev eswitch set DEV [ mode { legacy | switchdev } ]\n"); + pr_err(" [ inline-mode { none | link | network | transport } ]\n"); ++ pr_err(" [ encap { disable | enable } ]\n"); + pr_err(" devlink dev eswitch show DEV\n"); + } + +@@ -1421,6 +1460,12 @@ static void pr_out_eswitch(struct dl *dl, struct nlattr **tb) + eswitch_inline_mode_name(mnl_attr_get_u8( + tb[DEVLINK_ATTR_ESWITCH_INLINE_MODE]))); + ++ if (tb[DEVLINK_ATTR_ESWITCH_ENCAP_MODE]) { ++ bool encap_mode = !!mnl_attr_get_u8(tb[DEVLINK_ATTR_ESWITCH_ENCAP_MODE]); ++ ++ pr_out_str(dl, "encap", encap_mode ? "enable" : "disable"); ++ } ++ + pr_out_handle_end(dl); + } + +@@ -1465,7 +1510,8 @@ static int cmd_dev_eswitch_set(struct dl *dl) + + err = dl_argv_parse_put(nlh, dl, DL_OPT_HANDLE, + DL_OPT_ESWITCH_MODE | +- DL_OPT_ESWITCH_INLINE_MODE); ++ DL_OPT_ESWITCH_INLINE_MODE | ++ DL_OPT_ESWITCH_ENCAP_MODE); + + if (err) + return err; +diff --git a/man/man8/devlink-dev.8 b/man/man8/devlink-dev.8 +index 6bfe66f..b074d57 100644 +--- a/man/man8/devlink-dev.8 ++++ b/man/man8/devlink-dev.8 +@@ -34,6 +34,9 @@ devlink-dev \- devlink device configuration + .RI "[ " + .BR inline-mode " { " none " | " link " | " network " | " transport " } " + .RI "]" ++.RI "[ " ++.BR encap " { " disable " | " enable " } " ++.RI "]" + + .ti -8 + .BR "devlink dev eswitch show" +@@ -81,6 +84,16 @@ Some HWs need the VF driver to put part of the packet headers on the TX descript + .I transport + - L4 mode + ++.TP ++.BR encap " { " disable " | " enable " } " ++Set eswitch encapsulation support ++ ++.I disable ++- Disable encapsulation support ++ ++.I enable ++- Enable encapsulation support ++ + .SH "EXAMPLES" + .PP + devlink dev show +-- +1.8.3.1 + diff --git a/SOURCES/0032-iproute2-bridge-bring-to-above-par-with-brctl-show-m.patch b/SOURCES/0032-iproute2-bridge-bring-to-above-par-with-brctl-show-m.patch deleted file mode 100644 index bae8b69..0000000 --- a/SOURCES/0032-iproute2-bridge-bring-to-above-par-with-brctl-show-m.patch +++ /dev/null @@ -1,180 +0,0 @@ -From 93a55d061ebebecdbb4af950771ebc371675b6cf Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:09:45 +0100 -Subject: [PATCH] iproute2 bridge: bring to above par with brctl show macs - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit aeb14eb0b2649 - -commit aeb14eb0b2649ae6048b9cc0a10152079035ee92 -Author: Jamal Hadi Salim -Date: Fri Jul 4 08:37:10 2014 -0400 - - iproute2 bridge: bring to above par with brctl show macs - - root@moja-mojo:bridge# ./bridge fdb help - Usage: bridge fdb { add | append | del | replace } ADDR dev DEV {self|master} [ temp ] - [router] [ dst IPADDR] [ vlan VID ] - [ port PORT] [ vni VNI ] [via DEV] - bridge fdb {show} [ br BRDEV ] [ brport DEV ] - - Lets start with two bridges each with a port... - - root@moja-mojo:bridge# ./bridge link - 10: sw1-p1 state DOWN : mtu 1500 master sw1 state disabled priority 32 cost 100 - 11: eth1 state DOWN : mtu 1500 master br0 state disabled priority 32 cost 100 - - show all... - root@moja-mojo:bridge# ./bridge fdb show - 33:33:00:00:00:01 dev ifb0 self permanent - 33:33:00:00:00:01 dev ifb1 self permanent - 33:33:00:00:00:01 dev eth0 self permanent - 01:00:5e:00:00:01 dev eth0 self permanent - 33:33:ff:92:c0:60 dev eth0 self permanent - 33:33:00:00:00:fb dev eth0 self permanent - 01:00:5e:00:00:fb dev eth0 self permanent - 01:00:5e:7f:ff:fd dev eth0 self permanent - 01:00:5e:00:00:01 dev wlan0 self permanent - 33:33:00:00:00:01 dev wlan0 self permanent - 33:33:ff:c2:84:3b dev wlan0 self permanent - 33:33:00:00:00:fb dev wlan0 self permanent - 01:00:5e:00:00:01 dev virbr0 self permanent - 01:00:5e:00:00:fb dev virbr0 self permanent - 33:33:00:00:00:01 dev br0 self permanent - 33:33:00:00:00:01 dev sw1 self permanent - 33:33:00:00:00:01 dev dummy0 self permanent - 5e:f4:03:44:da:9a dev sw1-p1 vlan 0 master sw1 permanent - 33:33:00:00:00:01 dev sw1-p1 self permanent - b6:5e:dd:ce:d7:5e dev eth1 vlan 0 master br0 permanent - 33:33:00:00:00:01 dev eth1 self permanent - - Lets see a netdev that is *not* attached to a bridge - - root@moja-mojo:bridge# ./bridge fdb show brport eth0 - 33:33:00:00:00:01 self permanent - 01:00:5e:00:00:01 self permanent - 33:33:ff:92:c0:60 self permanent - 33:33:00:00:00:fb self permanent - 01:00:5e:00:00:fb self permanent - 01:00:5e:7f:ff:fd self permanent - - Lets see a netdev that is bridge port - root@moja-mojo:bridge# ./bridge fdb show brport eth1 - hadi@jhs-1:/media/MT1/other-gits/iproute-jul04/bridge$ ./bridge fdb show brport eth1 - b6:5e:dd:ce:d7:5e vlan 0 master br0 permanent - 33:33:00:00:00:01 self permanent - - Specify the correct bridge and you get good stuff - root@moja-mojo:bridge# ./bridge fdb show brport eth1 br br0 - 6:5e:dd:ce:d7:5e vlan 0 master br0 permanent - 33:33:00:00:00:01 self permanent - - Specify the wrong bridge and you get good nada - root@moja-mojo:bridge# ./bridge fdb show brport eth1 br sw1 - - dump br0 - root@moja-mojo:bridge# ./bridge fdb show br br0 - 33:33:00:00:00:01 dev br0 self permanent - b6:5e:dd:ce:d7:5e dev eth1 vlan 0 master br0 permanent - 33:33:00:00:00:01 dev eth1 self permanent - - dump sw1 - root@moja-mojo:bridge# ./bridge fdb show br sw1 - 33:33:00:00:00:01 dev sw1 self permanent - 5e:f4:03:44:da:9a dev sw1-p1 vlan 0 master sw1 permanent - 33:33:00:00:00:01 dev sw1-p1 self permanent - - Lets move a port from one bridge to another for shits-and-giggles - (as the New Brunswickians like to say) - root@moja-mojo:bridge# ip link set sw1-p1 master br0 - - Now dump again br0 - root@moja-mojo:bridge# ./bridge fdb show br br0 - 33:33:00:00:00:01 dev br0 self permanent - 5e:f4:03:44:da:9a dev sw1-p1 vlan 0 master br0 permanent - 33:33:00:00:00:01 dev sw1-p1 self permanent - b6:5e:dd:ce:d7:5e dev eth1 vlan 0 master br0 permanent - 33:33:00:00:00:01 dev eth1 self permanent - - Signed-off-by: Jamal Hadi Salim ---- - bridge/fdb.c | 38 +++++++++++++++++++++++++++++++++----- - 1 file changed, 33 insertions(+), 5 deletions(-) - -diff --git a/bridge/fdb.c b/bridge/fdb.c -index b29c776..97385d0 100644 ---- a/bridge/fdb.c -+++ b/bridge/fdb.c -@@ -34,7 +34,7 @@ static void usage(void) - " [ self ] [ master ] [ use ] [ router ]\n" - " [ local | temp ] [ dst IPADDR ] [ vlan VID ]\n" - " [ port PORT] [ vni VNI ] [via DEV]\n"); -- fprintf(stderr, " bridge fdb {show} [ dev DEV ]\n"); -+ fprintf(stderr, " bridge fdb {show} [ br BRDEV ] [ brport DEV ]\n"); - exit(-1); - } - -@@ -165,18 +165,45 @@ int print_fdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - - static int fdb_show(int argc, char **argv) - { -+ struct { -+ struct nlmsghdr n; -+ struct ifinfomsg ifm; -+ char buf[256]; -+ } req; -+ - char *filter_dev = NULL; -+ char *br = NULL; -+ int msg_size = sizeof(struct ifinfomsg); -+ -+ memset(&req, 0, sizeof(req)); -+ req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifinfomsg)); -+ req.ifm.ifi_family = PF_BRIDGE; - - while (argc > 0) { -- if (strcmp(*argv, "dev") == 0) { -+ if ((strcmp(*argv, "brport") == 0) || strcmp(*argv, "dev") == 0) { - NEXT_ARG(); -- if (filter_dev) -- duparg("dev", *argv); - filter_dev = *argv; -+ } else if (strcmp(*argv, "br") == 0) { -+ NEXT_ARG(); -+ br = *argv; -+ } else { -+ if (matches(*argv, "help") == 0) -+ usage(); - } - argc--; argv++; - } - -+ if (br) { -+ int br_ifindex = ll_name_to_index(br); -+ if (br_ifindex == 0) { -+ fprintf(stderr, "Cannot find bridge device \"%s\"\n", br); -+ return -1; -+ } -+ addattr32(&req.n, sizeof(req), IFLA_MASTER, br_ifindex); -+ msg_size += RTA_LENGTH(4); -+ } -+ -+ /*we'll keep around filter_dev for older kernels */ - if (filter_dev) { - filter_index = if_nametoindex(filter_dev); - if (filter_index == 0) { -@@ -184,9 +211,10 @@ static int fdb_show(int argc, char **argv) - filter_dev); - return -1; - } -+ req.ifm.ifi_index = filter_index; - } - -- if (rtnl_wilddump_request(&rth, PF_BRIDGE, RTM_GETNEIGH) < 0) { -+ if (rtnl_dump_request(&rth, RTM_GETNEIGH, &req.ifm, msg_size) < 0) { - perror("Cannot send dump request"); - exit(1); - } --- -1.8.3.1 - diff --git a/SOURCES/0033-bridge-fdb-fix-statistics-output-spacing.patch b/SOURCES/0033-bridge-fdb-fix-statistics-output-spacing.patch deleted file mode 100644 index 5588bbb..0000000 --- a/SOURCES/0033-bridge-fdb-fix-statistics-output-spacing.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 823813e882655ad9e92fde4e2f2c71313aa6d261 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:09:45 +0100 -Subject: [PATCH] bridge/fdb: fix statistics output spacing - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 85c1807f16774 - -commit 85c1807f16774286c7fa67090b2fad4d1dae4f18 -Author: Scott Feldman -Date: Thu Dec 4 09:57:14 2014 +0100 - - bridge/fdb: fix statistics output spacing - - Signed-off-by: Scott Feldman - Signed-off-by: Jiri Pirko ---- - bridge/fdb.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/bridge/fdb.c b/bridge/fdb.c -index 97385d0..77f0c77 100644 ---- a/bridge/fdb.c -+++ b/bridge/fdb.c -@@ -146,7 +146,7 @@ int print_fdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - struct nda_cacheinfo *ci = RTA_DATA(tb[NDA_CACHEINFO]); - int hz = get_user_hz(); - -- fprintf(fp, " used %d/%d", ci->ndm_used/hz, -+ fprintf(fp, "used %d/%d ", ci->ndm_used/hz, - ci->ndm_updated/hz); - } - if (r->ndm_flags & NTF_SELF) --- -1.8.3.1 - diff --git a/SOURCES/0033-tc-flower-add-support-for-tcp-flags.patch b/SOURCES/0033-tc-flower-add-support-for-tcp-flags.patch new file mode 100644 index 0000000..333ce11 --- /dev/null +++ b/SOURCES/0033-tc-flower-add-support-for-tcp-flags.patch @@ -0,0 +1,154 @@ +From 7cbf364a5f68ba008c5e0702266fe3dc606b1d6f Mon Sep 17 00:00:00 2001 +From: Kamal Heib +Date: Thu, 9 Nov 2017 04:44:32 -0500 +Subject: [PATCH] tc: flower: add support for tcp flags + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1456539 + +commit 0c30d14d0a2fc2fb6b7fef62bea05f2e5c3eb26a +Author: Jiri Pirko +Date: Tue May 23 23:51:39 2017 +0200 + + tc: flower: add support for tcp flags + + Allow user to insert a flower classifier filter rule which includes + match for tcp flags. + + Signed-off-by: Jiri Pirko + +Signed-off-by: Kamal Heib +--- + man/man8/tc-flower.8 | 8 +++++++ + tc/f_flower.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 70 insertions(+) + +diff --git a/man/man8/tc-flower.8 b/man/man8/tc-flower.8 +index ba29065..7648079 100644 +--- a/man/man8/tc-flower.8 ++++ b/man/man8/tc-flower.8 +@@ -35,6 +35,8 @@ flower \- flow based traffic control filter + .IR PREFIX " | { " + .BR dst_port " | " src_port " } " + .IR port_number " } | " ++.B tcp_flags ++.IR MASKED_TCP_FLAGS " | " + .B type + .IR MASKED_TYPE " | " + .B code +@@ -136,6 +138,12 @@ Match on layer 4 protocol source or destination port number. Only available for + .BR ip_proto " values " udp ", " tcp " and " sctp + which have to be specified in beforehand. + .TP ++.BI tcp_flags " MASKED_TCP_FLAGS" ++Match on TCP flags represented as 12bit bitfield in in hexadecimal format. ++A mask may be optionally provided to limit the bits which are matched. A mask ++is provided by following the value with a slash and then the mask. If the mask ++is missing then a match on all bits is assumed. ++.TP + .BI type " MASKED_TYPE" + .TQ + .BI code " MASKED_CODE" +diff --git a/tc/f_flower.c b/tc/f_flower.c +index ebc63ca..1b6b46e 100644 +--- a/tc/f_flower.c ++++ b/tc/f_flower.c +@@ -57,6 +57,7 @@ static void explain(void) + " src_ip PREFIX |\n" + " dst_port PORT-NUMBER |\n" + " src_port PORT-NUMBER |\n" ++ " tcp_flags MASKED-TCP_FLAGS |\n" + " type MASKED-ICMP-TYPE |\n" + " code MASKED-ICMP-CODE |\n" + " arp_tip IPV4-PREFIX |\n" +@@ -474,6 +475,41 @@ static int flower_parse_port(char *str, __u8 ip_proto, + return 0; + } + ++#define TCP_FLAGS_MAX_MASK 0xfff ++ ++static int flower_parse_tcp_flags(char *str, int flags_type, int mask_type, ++ struct nlmsghdr *n) ++{ ++ char *slash; ++ int ret, err = -1; ++ __u16 flags; ++ ++ slash = strchr(str, '/'); ++ if (slash) ++ *slash = '\0'; ++ ++ ret = get_u16(&flags, str, 16); ++ if (ret < 0 || flags & ~TCP_FLAGS_MAX_MASK) ++ goto err; ++ ++ addattr16(n, MAX_MSG, flags_type, htons(flags)); ++ ++ if (slash) { ++ ret = get_u16(&flags, slash + 1, 16); ++ if (ret < 0 || flags & ~TCP_FLAGS_MAX_MASK) ++ goto err; ++ } else { ++ flags = TCP_FLAGS_MAX_MASK; ++ } ++ addattr16(n, MAX_MSG, mask_type, htons(flags)); ++ ++ err = 0; ++err: ++ if (slash) ++ *slash = '/'; ++ return err; ++} ++ + static int flower_parse_key_id(const char *str, int type, struct nlmsghdr *n) + { + int ret; +@@ -671,6 +707,16 @@ static int flower_parse_opt(struct filter_util *qu, char *handle, + fprintf(stderr, "Illegal \"src_port\"\n"); + return -1; + } ++ } else if (matches(*argv, "tcp_flags") == 0) { ++ NEXT_ARG(); ++ ret = flower_parse_tcp_flags(*argv, ++ TCA_FLOWER_KEY_TCP_FLAGS, ++ TCA_FLOWER_KEY_TCP_FLAGS_MASK, ++ n); ++ if (ret < 0) { ++ fprintf(stderr, "Illegal \"tcp_flags\"\n"); ++ return -1; ++ } + } else if (matches(*argv, "type") == 0) { + NEXT_ARG(); + ret = flower_parse_icmp(*argv, eth_type, ip_proto, +@@ -1000,6 +1046,19 @@ static void flower_print_port(FILE *f, char *name, struct rtattr *attr) + fprintf(f, "\n %s %d", name, rta_getattr_be16(attr)); + } + ++static void flower_print_tcp_flags(FILE *f, char *name, ++ struct rtattr *flags_attr, ++ struct rtattr *mask_attr) ++{ ++ if (!flags_attr) ++ return; ++ fprintf(f, "\n %s %x", name, rta_getattr_be16(flags_attr)); ++ if (!mask_attr) ++ return; ++ fprintf(f, "/%x", rta_getattr_be16(mask_attr)); ++} ++ ++ + static void flower_print_key_id(FILE *f, const char *name, + struct rtattr *attr) + { +@@ -1110,6 +1169,9 @@ static int flower_print_opt(struct filter_util *qu, FILE *f, + if (nl_type >= 0) + flower_print_port(f, "src_port", tb[nl_type]); + ++ flower_print_tcp_flags(f, "tcp_flags", tb[TCA_FLOWER_KEY_TCP_FLAGS], ++ tb[TCA_FLOWER_KEY_TCP_FLAGS_MASK]); ++ + nl_type = flower_icmp_attr_type(eth_type, ip_proto, + FLOWER_ICMP_FIELD_TYPE); + nl_mask_type = flower_icmp_attr_mask_type(eth_type, ip_proto, +-- +1.8.3.1 + diff --git a/SOURCES/0034-bridge-fdb-add-flag-indication-for-FDB-entry-synced-.patch b/SOURCES/0034-bridge-fdb-add-flag-indication-for-FDB-entry-synced-.patch deleted file mode 100644 index 343970e..0000000 --- a/SOURCES/0034-bridge-fdb-add-flag-indication-for-FDB-entry-synced-.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 542da2c545d5c309524620a6fe3683cbfb205936 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:09:45 +0100 -Subject: [PATCH] bridge/fdb: add flag/indication for FDB entry synced from - offload device - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 28467b7f3facd - -commit 28467b7f3facd6114b2fbe0c9fecf57adbd52e12 -Author: Scott Feldman -Date: Thu Dec 4 09:57:15 2014 +0100 - - bridge/fdb: add flag/indication for FDB entry synced from offload device - - Add NTF_EXT_LEARNED flag to neigh flags to indicate FDB entry learned by - device has been learned externally to bridge FDB. For these entries, - add "external" annotation in bridge fdb show output: - - 00:02:00:00:03:00 dev swp2 used 2/2 master br0 external - 00:02:00:00:03:00 dev swp2 self permanent - - In the example above, 00:02:00:00:03:00 is shown twice on dev swp2. The - first entry if from the bridge (master) and is marked as "external" by - the offload device. The second entry is from the brport offload device (self), - and was learned by the device. - - Signed-off-by: Scott Feldman - Signed-off-by: Jiri Pirko - Acked-by: Jamal Hadi Salim ---- - bridge/fdb.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/bridge/fdb.c b/bridge/fdb.c -index 77f0c77..e411932 100644 ---- a/bridge/fdb.c -+++ b/bridge/fdb.c -@@ -158,6 +158,8 @@ int print_fdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - fprintf(fp, "master "); - if (r->ndm_flags & NTF_ROUTER) - fprintf(fp, "router "); -+ if (r->ndm_flags & NTF_EXT_LEARNED) -+ fprintf(fp, "external "); - - fprintf(fp, "%s\n", state_n2a(r->ndm_state)); - return 0; --- -1.8.3.1 - diff --git a/SOURCES/0034-iplink-Update-usage-in-help-message.patch b/SOURCES/0034-iplink-Update-usage-in-help-message.patch new file mode 100644 index 0000000..63422a8 --- /dev/null +++ b/SOURCES/0034-iplink-Update-usage-in-help-message.patch @@ -0,0 +1,60 @@ +From 41b38afb79a82eec66fea08fc021a35cf1d550fc Mon Sep 17 00:00:00 2001 +From: Kamal Heib +Date: Thu, 9 Nov 2017 04:44:32 -0500 +Subject: [PATCH] iplink: Update usage in help message + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1456539 + +commit 5a3ec4ba64783a640e7716a37faae4be49489e51 +Author: Eli Cohen +Date: Sun Jun 4 15:36:48 2017 +0300 + + iplink: Update usage in help message + + Add to usage message a description of how to configure Infiniband node + and port GUIDs. Also modify the man page to emphasize the GUIDs are + configured for Infiniband VFs. + + Fixes: d91fb3f4c7e4 ("Add support for configuring Infiniband GUIDs") + Signed-off-by: Eli Cohen + Signed-off-by: Tariq Toukan + +Signed-off-by: Kamal Heib +--- + ip/iplink.c | 2 ++ + man/man8/ip-link.8.in | 4 ++-- + 2 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/ip/iplink.c b/ip/iplink.c +index b08d227..193997c 100644 +--- a/ip/iplink.c ++++ b/ip/iplink.c +@@ -91,6 +91,8 @@ void iplink_usage(void) + " [ query_rss { on | off} ]\n" + " [ state { auto | enable | disable} ] ]\n" + " [ trust { on | off} ] ]\n" ++ " [ node_guid { eui64 } ]\n" ++ " [ port_guid { eui64 } ]\n" + " [ xdp { off |\n" + " object FILE [ section NAME ] [ verbose ] |\n" + " pinned FILE } ]\n" +diff --git a/man/man8/ip-link.8.in b/man/man8/ip-link.8.in +index a5ddfe7..48417db 100644 +--- a/man/man8/ip-link.8.in ++++ b/man/man8/ip-link.8.in +@@ -1564,10 +1564,10 @@ sent by the VF. + which may impact security and/or performance. (e.g. VF multicast promiscuous mode) + .sp + .BI node_guid " eui64" +-- configure node GUID for the VF. ++- configure node GUID for Infiniband VFs. + .sp + .BI port_guid " eui64" +-- configure port GUID for the VF. ++- configure port GUID for Infiniband VFs. + .in -8 + + .TP +-- +1.8.3.1 + diff --git a/SOURCES/0035-bridge-link-add-option-self.patch b/SOURCES/0035-bridge-link-add-option-self.patch deleted file mode 100644 index ccef7c5..0000000 --- a/SOURCES/0035-bridge-link-add-option-self.patch +++ /dev/null @@ -1,81 +0,0 @@ -From fdd7d2f09ca54afb4271b2f50c69fb8991f56db2 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:09:45 +0100 -Subject: [PATCH] bridge link: add option 'self' - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 6fdb465869ccd - -commit 6fdb465869ccda91d9cc2e6f8ee3aca448df5d33 -Author: Roopa Prabhu -Date: Sat Dec 6 00:21:01 2014 -0800 - - bridge link: add option 'self' - - Currently self is set internally only if hwmode is set. - This makes it necessary for the hw to have a mode. - There is no hwmode really required to go to hardware. So, introduce - self for anybody who wants to target hardware. - - v1 -> v2 - - fix a few bugs. Initialize flags to zero: this was required to - keep the current behaviour unchanged. - - v2 -> v3 - - fix comment - - Signed-off-by: Roopa Prabhu - Reviewed-by: Jiri Pirko ---- - bridge/link.c | 18 ++++++++++-------- - 1 file changed, 10 insertions(+), 8 deletions(-) - -diff --git a/bridge/link.c b/bridge/link.c -index 14e4e5a..4e0fd96 100644 ---- a/bridge/link.c -+++ b/bridge/link.c -@@ -261,7 +261,7 @@ static int brlink_modify(int argc, char **argv) - __s16 priority = -1; - __s8 state = -1; - __s16 mode = -1; -- __u16 flags = BRIDGE_FLAGS_MASTER; -+ __u16 flags = 0; - struct rtattr *nest; - - memset(&req, 0, sizeof(req)); -@@ -321,6 +321,8 @@ static int brlink_modify(int argc, char **argv) - "\"veb\".\n"); - exit(-1); - } -+ } else if (strcmp(*argv, "self") == 0) { -+ flags = BRIDGE_FLAGS_SELF; - } else { - usage(); - } -@@ -369,16 +371,16 @@ static int brlink_modify(int argc, char **argv) - - addattr_nest_end(&req.n, nest); - -- /* IFLA_AF_SPEC nested attribute. Contains IFLA_BRIDGE_FLAGS that -- * designates master or self operation as well as 'vepa' or 'veb' -- * operation modes. These are only valid in 'self' mode on some -- * devices so far. Thus we only need to include the flags attribute -- * if we are setting the hw mode. -+ /* IFLA_AF_SPEC nested attribute. Contains IFLA_BRIDGE_FLAGS that -+ * designates master or self operation and IFLA_BRIDGE_MODE -+ * for hw 'vepa' or 'veb' operation modes. The hwmodes are -+ * only valid in 'self' mode on some devices so far. - */ -- if (mode >= 0) { -+ if (mode >= 0 || flags > 0) { - nest = addattr_nest(&req.n, sizeof(req), IFLA_AF_SPEC); - -- addattr16(&req.n, sizeof(req), IFLA_BRIDGE_FLAGS, flags); -+ if (flags > 0) -+ addattr16(&req.n, sizeof(req), IFLA_BRIDGE_FLAGS, flags); - - if (mode >= 0) - addattr16(&req.n, sizeof(req), IFLA_BRIDGE_MODE, mode); --- -1.8.3.1 - diff --git a/SOURCES/0035-tc-flower-add-support-for-matching-on-ip-tos-and-ttl.patch b/SOURCES/0035-tc-flower-add-support-for-matching-on-ip-tos-and-ttl.patch new file mode 100644 index 0000000..7aef8b0 --- /dev/null +++ b/SOURCES/0035-tc-flower-add-support-for-matching-on-ip-tos-and-ttl.patch @@ -0,0 +1,177 @@ +From f8e5b20689cdc1f488140d9da4adf6f3ca421d3f Mon Sep 17 00:00:00 2001 +From: Kamal Heib +Date: Thu, 9 Nov 2017 04:44:32 -0500 +Subject: [PATCH] tc: flower: add support for matching on ip tos and ttl + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1456539 + +commit 6ea2c2b1cff676be2d01029a01cbd84d0675213c +Author: Or Gerlitz +Date: Wed Jun 7 15:17:54 2017 +0300 + + tc: flower: add support for matching on ip tos and ttl + + Allow users to set flower classifier filter rules which + include matches for ip tos and ttl. + + Signed-off-by: Or Gerlitz + Reviewed-by: Jiri Pirko + +Signed-off-by: Kamal Heib +--- + man/man8/tc-flower.8 | 17 +++++++++++- + tc/f_flower.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 91 insertions(+), 1 deletion(-) + +diff --git a/man/man8/tc-flower.8 b/man/man8/tc-flower.8 +index 7648079..be46f02 100644 +--- a/man/man8/tc-flower.8 ++++ b/man/man8/tc-flower.8 +@@ -30,7 +30,11 @@ flower \- flow based traffic control filter + .BR vlan_ethtype " { " ipv4 " | " ipv6 " | " + .IR ETH_TYPE " } | " + .BR ip_proto " { " tcp " | " udp " | " sctp " | " icmp " | " icmpv6 " | " +-.IR IP_PROTO " } | { " ++.IR IP_PROTO " } | " ++.B ip_tos ++.IR MASKED_IP_TOS " | " ++.B ip_ttl ++.IR MASKED_IP_TTL " | { " + .BR dst_ip " | " src_ip " } " + .IR PREFIX " | { " + .BR dst_port " | " src_port " } " +@@ -122,6 +126,17 @@ may be + .BR tcp ", " udp ", " sctp ", " icmp ", " icmpv6 + or an unsigned 8bit value in hexadecimal format. + .TP ++.BI ip_tos " MASKED_IP_TOS" ++Match on ipv4 TOS or ipv6 traffic-class - eight bits in hexadecimal format. ++A mask may be optionally provided to limit the bits which are matched. A mask ++is provided by following the value with a slash and then the mask. If the mask ++is missing then a match on all bits is assumed. ++.TP ++.BI ip_ttl " MASKED_IP_TTL" ++Match on ipv4 TTL or ipv6 hop-limit - eight bits value in decimal or hexadecimal format. ++A mask may be optionally provided to limit the bits which are matched. Same ++logic is used for the mask as with matching on ip_tos. ++.TP + .BI dst_ip " PREFIX" + .TQ + .BI src_ip " PREFIX" +diff --git a/tc/f_flower.c b/tc/f_flower.c +index 1b6b46e..5be693a 100644 +--- a/tc/f_flower.c ++++ b/tc/f_flower.c +@@ -53,6 +53,8 @@ static void explain(void) + " dst_mac MASKED-LLADDR |\n" + " src_mac MASKED-LLADDR |\n" + " ip_proto [tcp | udp | sctp | icmp | icmpv6 | IP-PROTO ] |\n" ++ " ip_tos MASKED-IP_TOS |\n" ++ " ip_ttl MASKED-IP_TTL |\n" + " dst_ip PREFIX |\n" + " src_ip PREFIX |\n" + " dst_port PORT-NUMBER |\n" +@@ -510,6 +512,41 @@ err: + return err; + } + ++static int flower_parse_ip_tos_ttl(char *str, int key_type, int mask_type, ++ struct nlmsghdr *n) ++{ ++ char *slash; ++ int ret, err = -1; ++ __u8 tos_ttl; ++ ++ slash = strchr(str, '/'); ++ if (slash) ++ *slash = '\0'; ++ ++ ret = get_u8(&tos_ttl, str, 10); ++ if (ret < 0) ++ ret = get_u8(&tos_ttl, str, 16); ++ if (ret < 0) ++ goto err; ++ ++ addattr8(n, MAX_MSG, key_type, tos_ttl); ++ ++ if (slash) { ++ ret = get_u8(&tos_ttl, slash + 1, 16); ++ if (ret < 0) ++ goto err; ++ } else { ++ tos_ttl = 0xff; ++ } ++ addattr8(n, MAX_MSG, mask_type, tos_ttl); ++ ++ err = 0; ++err: ++ if (slash) ++ *slash = '/'; ++ return err; ++} ++ + static int flower_parse_key_id(const char *str, int type, struct nlmsghdr *n) + { + int ret; +@@ -665,6 +702,26 @@ static int flower_parse_opt(struct filter_util *qu, char *handle, + fprintf(stderr, "Illegal \"ip_proto\"\n"); + return -1; + } ++ } else if (matches(*argv, "ip_tos") == 0) { ++ NEXT_ARG(); ++ ret = flower_parse_ip_tos_ttl(*argv, ++ TCA_FLOWER_KEY_IP_TOS, ++ TCA_FLOWER_KEY_IP_TOS_MASK, ++ n); ++ if (ret < 0) { ++ fprintf(stderr, "Illegal \"ip_tos\"\n"); ++ return -1; ++ } ++ } else if (matches(*argv, "ip_ttl") == 0) { ++ NEXT_ARG(); ++ ret = flower_parse_ip_tos_ttl(*argv, ++ TCA_FLOWER_KEY_IP_TTL, ++ TCA_FLOWER_KEY_IP_TTL_MASK, ++ n); ++ if (ret < 0) { ++ fprintf(stderr, "Illegal \"ip_ttl\"\n"); ++ return -1; ++ } + } else if (matches(*argv, "dst_ip") == 0) { + NEXT_ARG(); + ret = flower_parse_ip_addr(*argv, vlan_ethtype ? +@@ -963,6 +1020,19 @@ static void flower_print_ip_proto(FILE *f, __u8 *p_ip_proto, + *p_ip_proto = ip_proto; + } + ++static void flower_print_ip_attr(FILE *f, char *name, ++ struct rtattr *key_attr, ++ struct rtattr *mask_attr) ++{ ++ if (!key_attr) ++ return; ++ ++ fprintf(f, "\n %s %x", name, rta_getattr_u8(key_attr)); ++ if (!mask_attr) ++ return; ++ fprintf(f, "/%x", rta_getattr_u8(mask_attr)); ++} ++ + static void flower_print_matching_flags(FILE *f, char *name, + enum flower_matching_flags type, + struct rtattr *attr, +@@ -1150,6 +1220,11 @@ static int flower_print_opt(struct filter_util *qu, FILE *f, + flower_print_eth_type(f, ð_type, tb[TCA_FLOWER_KEY_ETH_TYPE]); + flower_print_ip_proto(f, &ip_proto, tb[TCA_FLOWER_KEY_IP_PROTO]); + ++ flower_print_ip_attr(f, "ip_tos", tb[TCA_FLOWER_KEY_IP_TOS], ++ tb[TCA_FLOWER_KEY_IP_TOS_MASK]); ++ flower_print_ip_attr(f, "ip_ttl", tb[TCA_FLOWER_KEY_IP_TTL], ++ tb[TCA_FLOWER_KEY_IP_TTL_MASK]); ++ + flower_print_ip_addr(f, "dst_ip", eth_type, + tb[TCA_FLOWER_KEY_IPV4_DST], + tb[TCA_FLOWER_KEY_IPV4_DST_MASK], +-- +1.8.3.1 + diff --git a/SOURCES/0036-bridge-link-add-learning_sync-policy-flag.patch b/SOURCES/0036-bridge-link-add-learning_sync-policy-flag.patch deleted file mode 100644 index c2b8cff..0000000 --- a/SOURCES/0036-bridge-link-add-learning_sync-policy-flag.patch +++ /dev/null @@ -1,121 +0,0 @@ -From 1fbff3fcfe0dc2ba063726d703a39bbfc2182b56 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:09:46 +0100 -Subject: [PATCH] bridge/link: add learning_sync policy flag - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 674bb438bc5cc - -commit 674bb438bc5cc61a9e16f97a236203ea2f50523f -Author: Scott Feldman -Date: Mon Dec 29 12:20:07 2014 -0800 - - bridge/link: add learning_sync policy flag - - v2: - - Resending now that the dust has cleared in 3.18 on "self" vs. hwmode debate for - brport settings. learning_sync is now set/cleared using "self" qualifier on - brport. - - v1: - - Add 'learned_sync' flag to turn on/off syncing of learned MAC addresses from - offload device to bridge's FDB. Flag is be set/cleared on offload device port - using "self" qualifier: - - $ sudo bridge link set dev swp1 learning_sync on self - - $ bridge -d link show dev swp1 - 2: swp1 state UNKNOWN : mtu 1500 master br0 state forwarding priority 32 cost 2 - hairpin off guard off root_block off fastleave off learning off flood off - 2: swp1 state UNKNOWN : mtu 1500 master br0 - learning on learning_sync on - - Adds new IFLA_BRPORT_LEARNED_SYNCED attribute for IFLA_PROTINFO on the SELF - brport. - - Signed-off-by: Scott Feldman ---- - bridge/link.c | 12 ++++++++++++ - man/man8/bridge.8 | 6 ++++++ - 2 files changed, 18 insertions(+) - -diff --git a/bridge/link.c b/bridge/link.c -index 4e0fd96..8b18931 100644 ---- a/bridge/link.c -+++ b/bridge/link.c -@@ -188,6 +188,9 @@ int print_linkinfo(const struct sockaddr_nl *who, - if (prtb[IFLA_BRPORT_LEARNING]) - print_onoff(fp, "learning", - rta_getattr_u8(prtb[IFLA_BRPORT_LEARNING])); -+ if (prtb[IFLA_BRPORT_LEARNING_SYNC]) -+ print_onoff(fp, "learning_sync", -+ rta_getattr_u8(prtb[IFLA_BRPORT_LEARNING_SYNC])); - if (prtb[IFLA_BRPORT_UNICAST_FLOOD]) - print_onoff(fp, "flood", - rta_getattr_u8(prtb[IFLA_BRPORT_UNICAST_FLOOD])); -@@ -221,6 +224,7 @@ static void usage(void) - fprintf(stderr, " [ fastleave {on | off} ]\n"); - fprintf(stderr, " [ root_block {on | off} ]\n"); - fprintf(stderr, " [ learning {on | off} ]\n"); -+ fprintf(stderr, " [ learning_sync {on | off} ]\n"); - fprintf(stderr, " [ flood {on | off} ]\n"); - fprintf(stderr, " [ hwmode {vepa | veb} ]\n"); - fprintf(stderr, " bridge link show [dev DEV]\n"); -@@ -252,6 +256,7 @@ static int brlink_modify(int argc, char **argv) - } req; - char *d = NULL; - __s8 learning = -1; -+ __s8 learning_sync = -1; - __s8 flood = -1; - __s8 hairpin = -1; - __s8 bpdu_guard = -1; -@@ -295,6 +300,10 @@ static int brlink_modify(int argc, char **argv) - NEXT_ARG(); - if (!on_off("learning", &learning, *argv)) - exit(-1); -+ } else if (strcmp(*argv, "learning_sync") == 0) { -+ NEXT_ARG(); -+ if (!on_off("learning_sync", &learning_sync, *argv)) -+ exit(-1); - } else if (strcmp(*argv, "flood") == 0) { - NEXT_ARG(); - if (!on_off("flood", &flood, *argv)) -@@ -359,6 +368,9 @@ static int brlink_modify(int argc, char **argv) - addattr8(&req.n, sizeof(req), IFLA_BRPORT_UNICAST_FLOOD, flood); - if (learning >= 0) - addattr8(&req.n, sizeof(req), IFLA_BRPORT_LEARNING, learning); -+ if (learning_sync >= 0) -+ addattr8(&req.n, sizeof(req), IFLA_BRPORT_LEARNING_SYNC, -+ learning_sync); - - if (cost > 0) - addattr32(&req.n, sizeof(req), IFLA_BRPORT_COST, cost); -diff --git a/man/man8/bridge.8 b/man/man8/bridge.8 -index 5e51d54..42fe922 100644 ---- a/man/man8/bridge.8 -+++ b/man/man8/bridge.8 -@@ -38,6 +38,7 @@ bridge \- show / manipulate bridge addresses and devices - .BR fastleave " { " on " | " off " } ] [ " - .BR root_block " { " on " | " off " } ] [ " - .BR learning " { " on " | " off " } ] [ " -+.BR learning_sync " { " on " | " off " } ] [ " - .BR flood " { " on " | " off " } ] [ " - .BR hwmode " { " vepa " | " veb " } ] " - -@@ -263,6 +264,11 @@ not. If learning if off, the bridge will end up flooding any traffic for which - it has no FDB entry. By default this flag is on. - - .TP -+.BR "learning_sync on " or " learning_sync off " -+Controls whether a given port will sync MAC addresses learned on device port to -+bridge FDB. -+ -+.TP - .BR "flooding on " or " flooding off " - Controls whether a given port will flood unicast traffic for which there is no FDB entry. By default this flag is on. - --- -1.8.3.1 - diff --git a/SOURCES/0036-iproute-build-more-easily-on-Android.patch b/SOURCES/0036-iproute-build-more-easily-on-Android.patch new file mode 100644 index 0000000..29c0186 --- /dev/null +++ b/SOURCES/0036-iproute-build-more-easily-on-Android.patch @@ -0,0 +1,33934 @@ +From 9b0d1f60b01ac442ee3ec15c47c99d3756938034 Mon Sep 17 00:00:00 2001 +From: Phil Sutter +Date: Mon, 13 Nov 2017 18:09:56 +0100 +Subject: [PATCH] iproute: build more easily on Android + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1472759 +Upstream Status: iproute2.git commit 596b1c94aa38e + +commit 596b1c94aa38e21b7a8c8562e8b61ccb744255d2 +Author: Lorenzo Colitti +Date: Tue Oct 3 02:03:37 2017 +0900 + + iproute: build more easily on Android + + iproute2 contains a bunch of kernel headers, including uapi ones. + Android's libc uses uapi headers almost directly, and uses a + script to fix kernel types that don't match what userspace + expects. + + For example: https://issuetracker.google.com/36987220 reports + that our struct ip_mreq_source contains "__be32 imr_multiaddr" + rather than "struct in_addr imr_multiaddr". The script addresses + this by replacing the uapi struct definition with a #include + which contains the traditional userspace + definition. + + Unfortunately, when we compile iproute2, this definition + conflicts with the one in iproute2's linux/in.h. + + Historically we've just solved this problem by running "git rm" + on all the iproute2 include/linux headers that break Android's + libc. However, deleting the files in this way makes it harder to + keep up with upstream, because every upstream change to + an include file causes a merge conflict with the delete. + + This patch fixes the problem by moving the iproute2 linux headers + from include/linux to include/uapi/linux. + + Tested: compiles on ubuntu trusty (glibc) + + Signed-off-by: Elliott Hughes + Signed-off-by: Lorenzo Colitti +--- + Makefile | 2 +- + include/linux/atm.h | 241 ------ + include/linux/atmapi.h | 29 - + include/linux/atmarp.h | 41 - + include/linux/atmdev.h | 215 ----- + include/linux/atmioc.h | 41 - + include/linux/atmsap.h | 162 ---- + include/linux/bpf.h | 867 ------------------- + include/linux/bpf_common.h | 55 -- + include/linux/can.h | 201 ----- + include/linux/can/netlink.h | 142 ---- + include/linux/can/vxcan.h | 12 - + include/linux/devlink.h | 247 ------ + include/linux/elf-em.h | 60 -- + include/linux/fib_rules.h | 80 -- + include/linux/filter.h | 89 -- + include/linux/fou.h | 41 - + include/linux/gen_stats.h | 79 -- + include/linux/genetlink.h | 88 -- + include/linux/hdlc/ioctl.h | 84 -- + include/linux/icmpv6.h | 166 ---- + include/linux/if.h | 292 ------- + include/linux/if_addr.h | 67 -- + include/linux/if_addrlabel.h | 32 - + include/linux/if_alg.h | 42 - + include/linux/if_arp.h | 163 ---- + include/linux/if_bonding.h | 130 --- + include/linux/if_bridge.h | 294 ------- + include/linux/if_ether.h | 158 ---- + include/linux/if_link.h | 928 -------------------- + include/linux/if_macsec.h | 171 ---- + include/linux/if_packet.h | 302 ------- + include/linux/if_tun.h | 107 --- + include/linux/if_tunnel.h | 158 ---- + include/linux/if_vlan.h | 64 -- + include/linux/ife.h | 18 - + include/linux/ila.h | 45 - + include/linux/in.h | 300 ------- + include/linux/in6.h | 296 ------- + include/linux/in_route.h | 32 - + include/linux/inet_diag.h | 196 ----- + include/linux/ip.h | 175 ---- + include/linux/ip6_tunnel.h | 53 -- + include/linux/ipsec.h | 47 - + include/linux/kernel.h | 14 - + include/linux/l2tp.h | 199 ----- + include/linux/libc-compat.h | 213 ----- + include/linux/limits.h | 20 - + include/linux/lwtunnel.h | 70 -- + include/linux/magic.h | 91 -- + include/linux/mpls.h | 76 -- + include/linux/mpls_iptunnel.h | 30 - + include/linux/neighbour.h | 171 ---- + include/linux/net_namespace.h | 23 - + include/linux/netconf.h | 28 - + include/linux/netdevice.h | 65 -- + include/linux/netfilter.h | 77 -- + include/linux/netfilter/ipset/ip_set.h | 304 ------- + include/linux/netfilter/x_tables.h | 185 ---- + include/linux/netfilter/xt_set.h | 93 -- + include/linux/netfilter/xt_tcpudp.h | 36 - + include/linux/netfilter_ipv4.h | 79 -- + include/linux/netfilter_ipv4/ip_tables.h | 228 ----- + include/linux/netfilter_ipv6.h | 77 -- + include/linux/netfilter_ipv6/ip6_tables.h | 269 ------ + include/linux/netlink.h | 246 ------ + include/linux/netlink_diag.h | 64 -- + include/linux/packet_diag.h | 80 -- + include/linux/param.h | 6 - + include/linux/pfkeyv2.h | 383 --------- + include/linux/pkt_cls.h | 569 ------------- + include/linux/pkt_sched.h | 874 ------------------- + include/linux/posix_types.h | 37 - + include/linux/rtnetlink.h | 718 ---------------- + include/linux/sctp.h | 1085 ------------------------ + include/linux/seg6.h | 54 -- + include/linux/seg6_genl.h | 32 - + include/linux/seg6_hmac.h | 22 - + include/linux/seg6_iptunnel.h | 40 - + include/linux/seg6_local.h | 68 -- + include/linux/sock_diag.h | 38 - + include/linux/socket.h | 21 - + include/linux/sockios.h | 152 ---- + include/linux/stddef.h | 5 - + include/linux/sysinfo.h | 24 - + include/linux/tc_act/tc_bpf.h | 36 - + include/linux/tc_act/tc_connmark.h | 23 - + include/linux/tc_act/tc_csum.h | 34 - + include/linux/tc_act/tc_defact.h | 20 - + include/linux/tc_act/tc_gact.h | 33 - + include/linux/tc_act/tc_ife.h | 32 - + include/linux/tc_act/tc_ipt.h | 22 - + include/linux/tc_act/tc_mirred.h | 28 - + include/linux/tc_act/tc_nat.h | 28 - + include/linux/tc_act/tc_pedit.h | 66 -- + include/linux/tc_act/tc_sample.h | 26 - + include/linux/tc_act/tc_skbedit.h | 51 -- + include/linux/tc_act/tc_skbmod.h | 39 - + include/linux/tc_act/tc_tunnel_key.h | 43 - + include/linux/tc_act/tc_vlan.h | 38 - + include/linux/tc_ematch/tc_em_cmp.h | 25 - + include/linux/tc_ematch/tc_em_meta.h | 92 -- + include/linux/tc_ematch/tc_em_nbyte.h | 13 - + include/linux/tcp.h | 268 ------ + include/linux/tcp_metrics.h | 60 -- + include/linux/tipc.h | 256 ------ + include/linux/tipc_netlink.h | 294 ------- + include/linux/types.h | 47 - + include/linux/unix_diag.h | 58 -- + include/linux/veth.h | 12 - + include/linux/xfrm.h | 536 ------------ + include/uapi/linux/atm.h | 241 ++++++ + include/uapi/linux/atmapi.h | 29 + + include/uapi/linux/atmarp.h | 41 + + include/uapi/linux/atmdev.h | 215 +++++ + include/uapi/linux/atmioc.h | 41 + + include/uapi/linux/atmsap.h | 162 ++++ + include/uapi/linux/bpf.h | 867 +++++++++++++++++++ + include/uapi/linux/bpf_common.h | 55 ++ + include/uapi/linux/can.h | 201 +++++ + include/uapi/linux/can/netlink.h | 142 ++++ + include/uapi/linux/can/vxcan.h | 12 + + include/uapi/linux/devlink.h | 247 ++++++ + include/uapi/linux/elf-em.h | 60 ++ + include/uapi/linux/fib_rules.h | 80 ++ + include/uapi/linux/filter.h | 89 ++ + include/uapi/linux/fou.h | 41 + + include/uapi/linux/gen_stats.h | 79 ++ + include/uapi/linux/genetlink.h | 88 ++ + include/uapi/linux/hdlc/ioctl.h | 84 ++ + include/uapi/linux/icmpv6.h | 166 ++++ + include/uapi/linux/if.h | 292 +++++++ + include/uapi/linux/if_addr.h | 67 ++ + include/uapi/linux/if_addrlabel.h | 32 + + include/uapi/linux/if_alg.h | 42 + + include/uapi/linux/if_arp.h | 163 ++++ + include/uapi/linux/if_bonding.h | 130 +++ + include/uapi/linux/if_bridge.h | 294 +++++++ + include/uapi/linux/if_ether.h | 158 ++++ + include/uapi/linux/if_link.h | 928 ++++++++++++++++++++ + include/uapi/linux/if_macsec.h | 171 ++++ + include/uapi/linux/if_packet.h | 302 +++++++ + include/uapi/linux/if_tun.h | 107 +++ + include/uapi/linux/if_tunnel.h | 158 ++++ + include/uapi/linux/if_vlan.h | 64 ++ + include/uapi/linux/ife.h | 18 + + include/uapi/linux/ila.h | 45 + + include/uapi/linux/in.h | 300 +++++++ + include/uapi/linux/in6.h | 296 +++++++ + include/uapi/linux/in_route.h | 32 + + include/uapi/linux/inet_diag.h | 196 +++++ + include/uapi/linux/ip.h | 175 ++++ + include/uapi/linux/ip6_tunnel.h | 53 ++ + include/uapi/linux/ipsec.h | 47 + + include/uapi/linux/kernel.h | 14 + + include/uapi/linux/l2tp.h | 199 +++++ + include/uapi/linux/libc-compat.h | 213 +++++ + include/uapi/linux/limits.h | 20 + + include/uapi/linux/lwtunnel.h | 70 ++ + include/uapi/linux/magic.h | 91 ++ + include/uapi/linux/mpls.h | 76 ++ + include/uapi/linux/mpls_iptunnel.h | 30 + + include/uapi/linux/neighbour.h | 171 ++++ + include/uapi/linux/net_namespace.h | 23 + + include/uapi/linux/netconf.h | 28 + + include/uapi/linux/netdevice.h | 65 ++ + include/uapi/linux/netfilter.h | 77 ++ + include/uapi/linux/netfilter/ipset/ip_set.h | 304 +++++++ + include/uapi/linux/netfilter/x_tables.h | 185 ++++ + include/uapi/linux/netfilter/xt_set.h | 93 ++ + include/uapi/linux/netfilter/xt_tcpudp.h | 36 + + include/uapi/linux/netfilter_ipv4.h | 79 ++ + include/uapi/linux/netfilter_ipv4/ip_tables.h | 228 +++++ + include/uapi/linux/netfilter_ipv6.h | 77 ++ + include/uapi/linux/netfilter_ipv6/ip6_tables.h | 269 ++++++ + include/uapi/linux/netlink.h | 246 ++++++ + include/uapi/linux/netlink_diag.h | 64 ++ + include/uapi/linux/packet_diag.h | 80 ++ + include/uapi/linux/param.h | 6 + + include/uapi/linux/pfkeyv2.h | 383 +++++++++ + include/uapi/linux/pkt_cls.h | 569 +++++++++++++ + include/uapi/linux/pkt_sched.h | 874 +++++++++++++++++++ + include/uapi/linux/posix_types.h | 37 + + include/uapi/linux/rtnetlink.h | 718 ++++++++++++++++ + include/uapi/linux/sctp.h | 1085 ++++++++++++++++++++++++ + include/uapi/linux/seg6.h | 54 ++ + include/uapi/linux/seg6_genl.h | 32 + + include/uapi/linux/seg6_hmac.h | 22 + + include/uapi/linux/seg6_iptunnel.h | 40 + + include/uapi/linux/seg6_local.h | 68 ++ + include/uapi/linux/sock_diag.h | 38 + + include/uapi/linux/socket.h | 21 + + include/uapi/linux/sockios.h | 152 ++++ + include/uapi/linux/stddef.h | 5 + + include/uapi/linux/sysinfo.h | 24 + + include/uapi/linux/tc_act/tc_bpf.h | 36 + + include/uapi/linux/tc_act/tc_connmark.h | 23 + + include/uapi/linux/tc_act/tc_csum.h | 34 + + include/uapi/linux/tc_act/tc_defact.h | 20 + + include/uapi/linux/tc_act/tc_gact.h | 33 + + include/uapi/linux/tc_act/tc_ife.h | 32 + + include/uapi/linux/tc_act/tc_ipt.h | 22 + + include/uapi/linux/tc_act/tc_mirred.h | 28 + + include/uapi/linux/tc_act/tc_nat.h | 28 + + include/uapi/linux/tc_act/tc_pedit.h | 66 ++ + include/uapi/linux/tc_act/tc_sample.h | 26 + + include/uapi/linux/tc_act/tc_skbedit.h | 51 ++ + include/uapi/linux/tc_act/tc_skbmod.h | 39 + + include/uapi/linux/tc_act/tc_tunnel_key.h | 43 + + include/uapi/linux/tc_act/tc_vlan.h | 38 + + include/uapi/linux/tc_ematch/tc_em_cmp.h | 25 + + include/uapi/linux/tc_ematch/tc_em_meta.h | 92 ++ + include/uapi/linux/tc_ematch/tc_em_nbyte.h | 13 + + include/uapi/linux/tcp.h | 268 ++++++ + include/uapi/linux/tcp_metrics.h | 60 ++ + include/uapi/linux/tipc.h | 256 ++++++ + include/uapi/linux/tipc_netlink.h | 294 +++++++ + include/uapi/linux/types.h | 47 + + include/uapi/linux/unix_diag.h | 58 ++ + include/uapi/linux/veth.h | 12 + + include/uapi/linux/xfrm.h | 536 ++++++++++++ + 221 files changed, 16057 insertions(+), 16057 deletions(-) + delete mode 100644 include/linux/atm.h + delete mode 100644 include/linux/atmapi.h + delete mode 100644 include/linux/atmarp.h + delete mode 100644 include/linux/atmdev.h + delete mode 100644 include/linux/atmioc.h + delete mode 100644 include/linux/atmsap.h + delete mode 100644 include/linux/bpf.h + delete mode 100644 include/linux/bpf_common.h + delete mode 100644 include/linux/can.h + delete mode 100644 include/linux/can/netlink.h + delete mode 100644 include/linux/can/vxcan.h + delete mode 100644 include/linux/devlink.h + delete mode 100644 include/linux/elf-em.h + delete mode 100644 include/linux/fib_rules.h + delete mode 100644 include/linux/filter.h + delete mode 100644 include/linux/fou.h + delete mode 100644 include/linux/gen_stats.h + delete mode 100644 include/linux/genetlink.h + delete mode 100644 include/linux/hdlc/ioctl.h + delete mode 100644 include/linux/icmpv6.h + delete mode 100644 include/linux/if.h + delete mode 100644 include/linux/if_addr.h + delete mode 100644 include/linux/if_addrlabel.h + delete mode 100644 include/linux/if_alg.h + delete mode 100644 include/linux/if_arp.h + delete mode 100644 include/linux/if_bonding.h + delete mode 100644 include/linux/if_bridge.h + delete mode 100644 include/linux/if_ether.h + delete mode 100644 include/linux/if_link.h + delete mode 100644 include/linux/if_macsec.h + delete mode 100644 include/linux/if_packet.h + delete mode 100644 include/linux/if_tun.h + delete mode 100644 include/linux/if_tunnel.h + delete mode 100644 include/linux/if_vlan.h + delete mode 100644 include/linux/ife.h + delete mode 100644 include/linux/ila.h + delete mode 100644 include/linux/in.h + delete mode 100644 include/linux/in6.h + delete mode 100644 include/linux/in_route.h + delete mode 100644 include/linux/inet_diag.h + delete mode 100644 include/linux/ip.h + delete mode 100644 include/linux/ip6_tunnel.h + delete mode 100644 include/linux/ipsec.h + delete mode 100644 include/linux/kernel.h + delete mode 100644 include/linux/l2tp.h + delete mode 100644 include/linux/libc-compat.h + delete mode 100644 include/linux/limits.h + delete mode 100644 include/linux/lwtunnel.h + delete mode 100644 include/linux/magic.h + delete mode 100644 include/linux/mpls.h + delete mode 100644 include/linux/mpls_iptunnel.h + delete mode 100644 include/linux/neighbour.h + delete mode 100644 include/linux/net_namespace.h + delete mode 100644 include/linux/netconf.h + delete mode 100644 include/linux/netdevice.h + delete mode 100644 include/linux/netfilter.h + delete mode 100644 include/linux/netfilter/ipset/ip_set.h + delete mode 100644 include/linux/netfilter/x_tables.h + delete mode 100644 include/linux/netfilter/xt_set.h + delete mode 100644 include/linux/netfilter/xt_tcpudp.h + delete mode 100644 include/linux/netfilter_ipv4.h + delete mode 100644 include/linux/netfilter_ipv4/ip_tables.h + delete mode 100644 include/linux/netfilter_ipv6.h + delete mode 100644 include/linux/netfilter_ipv6/ip6_tables.h + delete mode 100644 include/linux/netlink.h + delete mode 100644 include/linux/netlink_diag.h + delete mode 100644 include/linux/packet_diag.h + delete mode 100644 include/linux/param.h + delete mode 100644 include/linux/pfkeyv2.h + delete mode 100644 include/linux/pkt_cls.h + delete mode 100644 include/linux/pkt_sched.h + delete mode 100644 include/linux/posix_types.h + delete mode 100644 include/linux/rtnetlink.h + delete mode 100644 include/linux/sctp.h + delete mode 100644 include/linux/seg6.h + delete mode 100644 include/linux/seg6_genl.h + delete mode 100644 include/linux/seg6_hmac.h + delete mode 100644 include/linux/seg6_iptunnel.h + delete mode 100644 include/linux/seg6_local.h + delete mode 100644 include/linux/sock_diag.h + delete mode 100644 include/linux/socket.h + delete mode 100644 include/linux/sockios.h + delete mode 100644 include/linux/stddef.h + delete mode 100644 include/linux/sysinfo.h + delete mode 100644 include/linux/tc_act/tc_bpf.h + delete mode 100644 include/linux/tc_act/tc_connmark.h + delete mode 100644 include/linux/tc_act/tc_csum.h + delete mode 100644 include/linux/tc_act/tc_defact.h + delete mode 100644 include/linux/tc_act/tc_gact.h + delete mode 100644 include/linux/tc_act/tc_ife.h + delete mode 100644 include/linux/tc_act/tc_ipt.h + delete mode 100644 include/linux/tc_act/tc_mirred.h + delete mode 100644 include/linux/tc_act/tc_nat.h + delete mode 100644 include/linux/tc_act/tc_pedit.h + delete mode 100644 include/linux/tc_act/tc_sample.h + delete mode 100644 include/linux/tc_act/tc_skbedit.h + delete mode 100644 include/linux/tc_act/tc_skbmod.h + delete mode 100644 include/linux/tc_act/tc_tunnel_key.h + delete mode 100644 include/linux/tc_act/tc_vlan.h + delete mode 100644 include/linux/tc_ematch/tc_em_cmp.h + delete mode 100644 include/linux/tc_ematch/tc_em_meta.h + delete mode 100644 include/linux/tc_ematch/tc_em_nbyte.h + delete mode 100644 include/linux/tcp.h + delete mode 100644 include/linux/tcp_metrics.h + delete mode 100644 include/linux/tipc.h + delete mode 100644 include/linux/tipc_netlink.h + delete mode 100644 include/linux/types.h + delete mode 100644 include/linux/unix_diag.h + delete mode 100644 include/linux/veth.h + delete mode 100644 include/linux/xfrm.h + create mode 100644 include/uapi/linux/atm.h + create mode 100644 include/uapi/linux/atmapi.h + create mode 100644 include/uapi/linux/atmarp.h + create mode 100644 include/uapi/linux/atmdev.h + create mode 100644 include/uapi/linux/atmioc.h + create mode 100644 include/uapi/linux/atmsap.h + create mode 100644 include/uapi/linux/bpf.h + create mode 100644 include/uapi/linux/bpf_common.h + create mode 100644 include/uapi/linux/can.h + create mode 100644 include/uapi/linux/can/netlink.h + create mode 100644 include/uapi/linux/can/vxcan.h + create mode 100644 include/uapi/linux/devlink.h + create mode 100644 include/uapi/linux/elf-em.h + create mode 100644 include/uapi/linux/fib_rules.h + create mode 100644 include/uapi/linux/filter.h + create mode 100644 include/uapi/linux/fou.h + create mode 100644 include/uapi/linux/gen_stats.h + create mode 100644 include/uapi/linux/genetlink.h + create mode 100644 include/uapi/linux/hdlc/ioctl.h + create mode 100644 include/uapi/linux/icmpv6.h + create mode 100644 include/uapi/linux/if.h + create mode 100644 include/uapi/linux/if_addr.h + create mode 100644 include/uapi/linux/if_addrlabel.h + create mode 100644 include/uapi/linux/if_alg.h + create mode 100644 include/uapi/linux/if_arp.h + create mode 100644 include/uapi/linux/if_bonding.h + create mode 100644 include/uapi/linux/if_bridge.h + create mode 100644 include/uapi/linux/if_ether.h + create mode 100644 include/uapi/linux/if_link.h + create mode 100644 include/uapi/linux/if_macsec.h + create mode 100644 include/uapi/linux/if_packet.h + create mode 100644 include/uapi/linux/if_tun.h + create mode 100644 include/uapi/linux/if_tunnel.h + create mode 100644 include/uapi/linux/if_vlan.h + create mode 100644 include/uapi/linux/ife.h + create mode 100644 include/uapi/linux/ila.h + create mode 100644 include/uapi/linux/in.h + create mode 100644 include/uapi/linux/in6.h + create mode 100644 include/uapi/linux/in_route.h + create mode 100644 include/uapi/linux/inet_diag.h + create mode 100644 include/uapi/linux/ip.h + create mode 100644 include/uapi/linux/ip6_tunnel.h + create mode 100644 include/uapi/linux/ipsec.h + create mode 100644 include/uapi/linux/kernel.h + create mode 100644 include/uapi/linux/l2tp.h + create mode 100644 include/uapi/linux/libc-compat.h + create mode 100644 include/uapi/linux/limits.h + create mode 100644 include/uapi/linux/lwtunnel.h + create mode 100644 include/uapi/linux/magic.h + create mode 100644 include/uapi/linux/mpls.h + create mode 100644 include/uapi/linux/mpls_iptunnel.h + create mode 100644 include/uapi/linux/neighbour.h + create mode 100644 include/uapi/linux/net_namespace.h + create mode 100644 include/uapi/linux/netconf.h + create mode 100644 include/uapi/linux/netdevice.h + create mode 100644 include/uapi/linux/netfilter.h + create mode 100644 include/uapi/linux/netfilter/ipset/ip_set.h + create mode 100644 include/uapi/linux/netfilter/x_tables.h + create mode 100644 include/uapi/linux/netfilter/xt_set.h + create mode 100644 include/uapi/linux/netfilter/xt_tcpudp.h + create mode 100644 include/uapi/linux/netfilter_ipv4.h + create mode 100644 include/uapi/linux/netfilter_ipv4/ip_tables.h + create mode 100644 include/uapi/linux/netfilter_ipv6.h + create mode 100644 include/uapi/linux/netfilter_ipv6/ip6_tables.h + create mode 100644 include/uapi/linux/netlink.h + create mode 100644 include/uapi/linux/netlink_diag.h + create mode 100644 include/uapi/linux/packet_diag.h + create mode 100644 include/uapi/linux/param.h + create mode 100644 include/uapi/linux/pfkeyv2.h + create mode 100644 include/uapi/linux/pkt_cls.h + create mode 100644 include/uapi/linux/pkt_sched.h + create mode 100644 include/uapi/linux/posix_types.h + create mode 100644 include/uapi/linux/rtnetlink.h + create mode 100644 include/uapi/linux/sctp.h + create mode 100644 include/uapi/linux/seg6.h + create mode 100644 include/uapi/linux/seg6_genl.h + create mode 100644 include/uapi/linux/seg6_hmac.h + create mode 100644 include/uapi/linux/seg6_iptunnel.h + create mode 100644 include/uapi/linux/seg6_local.h + create mode 100644 include/uapi/linux/sock_diag.h + create mode 100644 include/uapi/linux/socket.h + create mode 100644 include/uapi/linux/sockios.h + create mode 100644 include/uapi/linux/stddef.h + create mode 100644 include/uapi/linux/sysinfo.h + create mode 100644 include/uapi/linux/tc_act/tc_bpf.h + create mode 100644 include/uapi/linux/tc_act/tc_connmark.h + create mode 100644 include/uapi/linux/tc_act/tc_csum.h + create mode 100644 include/uapi/linux/tc_act/tc_defact.h + create mode 100644 include/uapi/linux/tc_act/tc_gact.h + create mode 100644 include/uapi/linux/tc_act/tc_ife.h + create mode 100644 include/uapi/linux/tc_act/tc_ipt.h + create mode 100644 include/uapi/linux/tc_act/tc_mirred.h + create mode 100644 include/uapi/linux/tc_act/tc_nat.h + create mode 100644 include/uapi/linux/tc_act/tc_pedit.h + create mode 100644 include/uapi/linux/tc_act/tc_sample.h + create mode 100644 include/uapi/linux/tc_act/tc_skbedit.h + create mode 100644 include/uapi/linux/tc_act/tc_skbmod.h + create mode 100644 include/uapi/linux/tc_act/tc_tunnel_key.h + create mode 100644 include/uapi/linux/tc_act/tc_vlan.h + create mode 100644 include/uapi/linux/tc_ematch/tc_em_cmp.h + create mode 100644 include/uapi/linux/tc_ematch/tc_em_meta.h + create mode 100644 include/uapi/linux/tc_ematch/tc_em_nbyte.h + create mode 100644 include/uapi/linux/tcp.h + create mode 100644 include/uapi/linux/tcp_metrics.h + create mode 100644 include/uapi/linux/tipc.h + create mode 100644 include/uapi/linux/tipc_netlink.h + create mode 100644 include/uapi/linux/types.h + create mode 100644 include/uapi/linux/unix_diag.h + create mode 100644 include/uapi/linux/veth.h + create mode 100644 include/uapi/linux/xfrm.h + +diff --git a/Makefile b/Makefile +index 18de7dc..df2fa33 100644 +--- a/Makefile ++++ b/Makefile +@@ -49,7 +49,7 @@ CCOPTS = -O2 + WFLAGS := -Wall -Wstrict-prototypes -Wmissing-prototypes + WFLAGS += -Wmissing-declarations -Wold-style-definition -Wformat=2 + +-CFLAGS := $(WFLAGS) $(CCOPTS) -I../include $(DEFINES) $(CFLAGS) ++CFLAGS := $(WFLAGS) $(CCOPTS) -I../include -I../include/uapi $(DEFINES) $(CFLAGS) + YACCFLAGS = -d -t -v + + SUBDIRS=lib ip tc bridge misc netem genl tipc devlink man +diff --git a/include/linux/atm.h b/include/linux/atm.h +deleted file mode 100644 +index 08e27be..0000000 +--- a/include/linux/atm.h ++++ /dev/null +@@ -1,241 +0,0 @@ +-/* atm.h - general ATM declarations */ +- +-/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ +- +- +-/* +- * WARNING: User-space programs should not #include directly. +- * Instead, #include +- */ +- +-#ifndef _LINUX_ATM_H +-#define _LINUX_ATM_H +- +-/* +- * BEGIN_xx and END_xx markers are used for automatic generation of +- * documentation. Do not change them. +- */ +- +- +-#include +-#include +-#include +-#include +- +- +-/* general ATM constants */ +-#define ATM_CELL_SIZE 53 /* ATM cell size incl. header */ +-#define ATM_CELL_PAYLOAD 48 /* ATM payload size */ +-#define ATM_AAL0_SDU 52 /* AAL0 SDU size */ +-#define ATM_MAX_AAL34_PDU 65535 /* maximum AAL3/4 PDU payload */ +-#define ATM_AAL5_TRAILER 8 /* AAL5 trailer size */ +-#define ATM_MAX_AAL5_PDU 65535 /* maximum AAL5 PDU payload */ +-#define ATM_MAX_CDV 9999 /* maximum (default) CDV */ +-#define ATM_NOT_RSV_VCI 32 /* first non-reserved VCI value */ +- +-#define ATM_MAX_VPI 255 /* maximum VPI at the UNI */ +-#define ATM_MAX_VPI_NNI 4096 /* maximum VPI at the NNI */ +-#define ATM_MAX_VCI 65535 /* maximum VCI */ +- +- +-/* "protcol" values for the socket system call */ +-#define ATM_NO_AAL 0 /* AAL not specified */ +-#define ATM_AAL0 13 /* "raw" ATM cells */ +-#define ATM_AAL1 1 /* AAL1 (CBR) */ +-#define ATM_AAL2 2 /* AAL2 (VBR) */ +-#define ATM_AAL34 3 /* AAL3/4 (data) */ +-#define ATM_AAL5 5 /* AAL5 (data) */ +- +-/* +- * socket option name coding functions +- * +- * Note that __SO_ENCODE and __SO_LEVEL are somewhat a hack since the +- * << 22 only reserves 9 bits for the level. On some architectures +- * SOL_SOCKET is 0xFFFF, so that's a bit of a problem +- */ +- +-#define __SO_ENCODE(l,n,t) ((((l) & 0x1FF) << 22) | ((n) << 16) | \ +- sizeof(t)) +-#define __SO_LEVEL_MATCH(c,m) (((c) >> 22) == ((m) & 0x1FF)) +-#define __SO_NUMBER(c) (((c) >> 16) & 0x3f) +-#define __SO_SIZE(c) ((c) & 0x3fff) +- +-/* +- * ATM layer +- */ +- +-#define SO_SETCLP __SO_ENCODE(SOL_ATM,0,int) +- /* set CLP bit value - TODO */ +-#define SO_CIRANGE __SO_ENCODE(SOL_ATM,1,struct atm_cirange) +- /* connection identifier range; socket must be +- bound or connected */ +-#define SO_ATMQOS __SO_ENCODE(SOL_ATM,2,struct atm_qos) +- /* Quality of Service setting */ +-#define SO_ATMSAP __SO_ENCODE(SOL_ATM,3,struct atm_sap) +- /* Service Access Point */ +-#define SO_ATMPVC __SO_ENCODE(SOL_ATM,4,struct sockaddr_atmpvc) +- /* "PVC" address (also for SVCs); get only */ +-#define SO_MULTIPOINT __SO_ENCODE(SOL_ATM, 5, int) +- /* make this vc a p2mp */ +- +- +-/* +- * Note @@@: since the socket layers don't really distinguish the control and +- * the data plane but generally seems to be data plane-centric, any layer is +- * about equally wrong for the SAP. If you have a better idea about this, +- * please speak up ... +- */ +- +- +-/* ATM cell header (for AAL0) */ +- +-/* BEGIN_CH */ +-#define ATM_HDR_GFC_MASK 0xf0000000 +-#define ATM_HDR_GFC_SHIFT 28 +-#define ATM_HDR_VPI_MASK 0x0ff00000 +-#define ATM_HDR_VPI_SHIFT 20 +-#define ATM_HDR_VCI_MASK 0x000ffff0 +-#define ATM_HDR_VCI_SHIFT 4 +-#define ATM_HDR_PTI_MASK 0x0000000e +-#define ATM_HDR_PTI_SHIFT 1 +-#define ATM_HDR_CLP 0x00000001 +-/* END_CH */ +- +- +-/* PTI codings */ +- +-/* BEGIN_PTI */ +-#define ATM_PTI_US0 0 /* user data cell, congestion not exp, SDU-type 0 */ +-#define ATM_PTI_US1 1 /* user data cell, congestion not exp, SDU-type 1 */ +-#define ATM_PTI_UCES0 2 /* user data cell, cong. experienced, SDU-type 0 */ +-#define ATM_PTI_UCES1 3 /* user data cell, cong. experienced, SDU-type 1 */ +-#define ATM_PTI_SEGF5 4 /* segment OAM F5 flow related cell */ +-#define ATM_PTI_E2EF5 5 /* end-to-end OAM F5 flow related cell */ +-#define ATM_PTI_RSV_RM 6 /* reserved for traffic control/resource mgmt */ +-#define ATM_PTI_RSV 7 /* reserved */ +-/* END_PTI */ +- +- +-/* +- * The following items should stay in linux/atm.h, which should be linked to +- * netatm/atm.h +- */ +- +-/* Traffic description */ +- +-#define ATM_NONE 0 /* no traffic */ +-#define ATM_UBR 1 +-#define ATM_CBR 2 +-#define ATM_VBR 3 +-#define ATM_ABR 4 +-#define ATM_ANYCLASS 5 /* compatible with everything */ +- +-#define ATM_MAX_PCR -1 /* maximum available PCR */ +- +-struct atm_trafprm { +- unsigned char traffic_class; /* traffic class (ATM_UBR, ...) */ +- int max_pcr; /* maximum PCR in cells per second */ +- int pcr; /* desired PCR in cells per second */ +- int min_pcr; /* minimum PCR in cells per second */ +- int max_cdv; /* maximum CDV in microseconds */ +- int max_sdu; /* maximum SDU in bytes */ +- /* extra params for ABR */ +- unsigned int icr; /* Initial Cell Rate (24-bit) */ +- unsigned int tbe; /* Transient Buffer Exposure (24-bit) */ +- unsigned int frtt : 24; /* Fixed Round Trip Time (24-bit) */ +- unsigned int rif : 4; /* Rate Increment Factor (4-bit) */ +- unsigned int rdf : 4; /* Rate Decrease Factor (4-bit) */ +- unsigned int nrm_pres :1; /* nrm present bit */ +- unsigned int trm_pres :1; /* rm present bit */ +- unsigned int adtf_pres :1; /* adtf present bit */ +- unsigned int cdf_pres :1; /* cdf present bit*/ +- unsigned int nrm :3; /* Max # of Cells for each forward RM cell (3-bit) */ +- unsigned int trm :3; /* Time between forward RM cells (3-bit) */ +- unsigned int adtf :10; /* ACR Decrease Time Factor (10-bit) */ +- unsigned int cdf :3; /* Cutoff Decrease Factor (3-bit) */ +- unsigned int spare :9; /* spare bits */ +-}; +- +-struct atm_qos { +- struct atm_trafprm txtp; /* parameters in TX direction */ +- struct atm_trafprm rxtp __ATM_API_ALIGN; +- /* parameters in RX direction */ +- unsigned char aal __ATM_API_ALIGN; +-}; +- +-/* PVC addressing */ +- +-#define ATM_ITF_ANY -1 /* "magic" PVC address values */ +-#define ATM_VPI_ANY -1 +-#define ATM_VCI_ANY -1 +-#define ATM_VPI_UNSPEC -2 +-#define ATM_VCI_UNSPEC -2 +- +- +-struct sockaddr_atmpvc { +- unsigned short sap_family; /* address family, AF_ATMPVC */ +- struct { /* PVC address */ +- short itf; /* ATM interface */ +- short vpi; /* VPI (only 8 bits at UNI) */ +- int vci; /* VCI (only 16 bits at UNI) */ +- } sap_addr __ATM_API_ALIGN; /* PVC address */ +-}; +- +-/* SVC addressing */ +- +-#define ATM_ESA_LEN 20 /* ATM End System Address length */ +-#define ATM_E164_LEN 12 /* maximum E.164 number length */ +- +-#define ATM_AFI_DCC 0x39 /* DCC ATM Format */ +-#define ATM_AFI_ICD 0x47 /* ICD ATM Format */ +-#define ATM_AFI_E164 0x45 /* E.164 ATM Format */ +-#define ATM_AFI_LOCAL 0x49 /* Local ATM Format */ +- +-#define ATM_AFI_DCC_GROUP 0xBD /* DCC ATM Group Format */ +-#define ATM_AFI_ICD_GROUP 0xC5 /* ICD ATM Group Format */ +-#define ATM_AFI_E164_GROUP 0xC3 /* E.164 ATM Group Format */ +-#define ATM_AFI_LOCAL_GROUP 0xC7 /* Local ATM Group Format */ +- +-#define ATM_LIJ_NONE 0 /* no leaf-initiated join */ +-#define ATM_LIJ 1 /* request joining */ +-#define ATM_LIJ_RPJ 2 /* set to root-prompted join */ +-#define ATM_LIJ_NJ 3 /* set to network join */ +- +- +-struct sockaddr_atmsvc { +- unsigned short sas_family; /* address family, AF_ATMSVC */ +- struct { /* SVC address */ +- unsigned char prv[ATM_ESA_LEN];/* private ATM address */ +- char pub[ATM_E164_LEN+1]; /* public address (E.164) */ +- /* unused addresses must be bzero'ed */ +- char lij_type; /* role in LIJ call; one of ATM_LIJ* */ +- __u32 lij_id; /* LIJ call identifier */ +- } sas_addr __ATM_API_ALIGN; /* SVC address */ +-}; +- +- +-static __inline__ int atmsvc_addr_in_use(struct sockaddr_atmsvc addr) +-{ +- return *addr.sas_addr.prv || *addr.sas_addr.pub; +-} +- +- +-static __inline__ int atmpvc_addr_in_use(struct sockaddr_atmpvc addr) +-{ +- return addr.sap_addr.itf || addr.sap_addr.vpi || addr.sap_addr.vci; +-} +- +- +-/* +- * Some stuff for linux/sockios.h +- */ +- +-struct atmif_sioc { +- int number; +- int length; +- void *arg; +-}; +- +- +-typedef unsigned short atm_backend_t; +-#endif /* _LINUX_ATM_H */ +diff --git a/include/linux/atmapi.h b/include/linux/atmapi.h +deleted file mode 100644 +index 8fe54d9..0000000 +--- a/include/linux/atmapi.h ++++ /dev/null +@@ -1,29 +0,0 @@ +-/* atmapi.h - ATM API user space/kernel compatibility */ +- +-/* Written 1999,2000 by Werner Almesberger, EPFL ICA */ +- +- +-#ifndef _LINUX_ATMAPI_H +-#define _LINUX_ATMAPI_H +- +-#if defined(__sparc__) || defined(__ia64__) +-/* such alignment is not required on 32 bit sparcs, but we can't +- figure that we are on a sparc64 while compiling user-space programs. */ +-#define __ATM_API_ALIGN __attribute__((aligned(8))) +-#else +-#define __ATM_API_ALIGN +-#endif +- +- +-/* +- * Opaque type for kernel pointers. Note that _ is never accessed. We need +- * the struct in order hide the array, so that we can make simple assignments +- * instead of being forced to use memcpy. It also improves error reporting for +- * code that still assumes that we're passing unsigned longs. +- * +- * Convention: NULL pointers are passed as a field of all zeroes. +- */ +- +-typedef struct { unsigned char _[8]; } __ATM_API_ALIGN atm_kptr_t; +- +-#endif +diff --git a/include/linux/atmarp.h b/include/linux/atmarp.h +deleted file mode 100644 +index 231f4bd..0000000 +--- a/include/linux/atmarp.h ++++ /dev/null +@@ -1,41 +0,0 @@ +-/* atmarp.h - ATM ARP protocol and kernel-demon interface definitions */ +- +-/* Written 1995-1999 by Werner Almesberger, EPFL LRC/ICA */ +- +- +-#ifndef _LINUX_ATMARP_H +-#define _LINUX_ATMARP_H +- +-#include +-#include +-#include +- +- +-#define ATMARP_RETRY_DELAY 30 /* request next resolution or forget +- NAK after 30 sec - should go into +- atmclip.h */ +-#define ATMARP_MAX_UNRES_PACKETS 5 /* queue that many packets while +- waiting for the resolver */ +- +- +-#define ATMARPD_CTRL _IO('a',ATMIOC_CLIP+1) /* become atmarpd ctrl sock */ +-#define ATMARP_MKIP _IO('a',ATMIOC_CLIP+2) /* attach socket to IP */ +-#define ATMARP_SETENTRY _IO('a',ATMIOC_CLIP+3) /* fill or hide ARP entry */ +-#define ATMARP_ENCAP _IO('a',ATMIOC_CLIP+5) /* change encapsulation */ +- +- +-enum atmarp_ctrl_type { +- act_invalid, /* catch uninitialized structures */ +- act_need, /* need address resolution */ +- act_up, /* interface is coming up */ +- act_down, /* interface is going down */ +- act_change /* interface configuration has changed */ +-}; +- +-struct atmarp_ctrl { +- enum atmarp_ctrl_type type; /* message type */ +- int itf_num;/* interface number (if present) */ +- __be32 ip; /* IP address (act_need only) */ +-}; +- +-#endif +diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h +deleted file mode 100644 +index 8faa8b9..0000000 +--- a/include/linux/atmdev.h ++++ /dev/null +@@ -1,215 +0,0 @@ +-/* atmdev.h - ATM device driver declarations and various related items */ +- +-/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ +- +- +-#ifndef LINUX_ATMDEV_H +-#define LINUX_ATMDEV_H +- +- +-#include +-#include +-#include +- +- +-#define ESI_LEN 6 +- +-#define ATM_OC3_PCR (155520000/270*260/8/53) +- /* OC3 link rate: 155520000 bps +- SONET overhead: /270*260 (9 section, 1 path) +- bits per cell: /8/53 +- max cell rate: 353207.547 cells/sec */ +-#define ATM_25_PCR ((25600000/8-8000)/54) +- /* 25 Mbps ATM cell rate (59111) */ +-#define ATM_OC12_PCR (622080000/1080*1040/8/53) +- /* OC12 link rate: 622080000 bps +- SONET overhead: /1080*1040 +- bits per cell: /8/53 +- max cell rate: 1412830.188 cells/sec */ +-#define ATM_DS3_PCR (8000*12) +- /* DS3: 12 cells in a 125 usec time slot */ +- +- +-#define __AAL_STAT_ITEMS \ +- __HANDLE_ITEM(tx); /* TX okay */ \ +- __HANDLE_ITEM(tx_err); /* TX errors */ \ +- __HANDLE_ITEM(rx); /* RX okay */ \ +- __HANDLE_ITEM(rx_err); /* RX errors */ \ +- __HANDLE_ITEM(rx_drop); /* RX out of memory */ +- +-struct atm_aal_stats { +-#define __HANDLE_ITEM(i) int i +- __AAL_STAT_ITEMS +-#undef __HANDLE_ITEM +-}; +- +- +-struct atm_dev_stats { +- struct atm_aal_stats aal0; +- struct atm_aal_stats aal34; +- struct atm_aal_stats aal5; +-} __ATM_API_ALIGN; +- +- +-#define ATM_GETLINKRATE _IOW('a',ATMIOC_ITF+1,struct atmif_sioc) +- /* get link rate */ +-#define ATM_GETNAMES _IOW('a',ATMIOC_ITF+3,struct atm_iobuf) +- /* get interface names (numbers) */ +-#define ATM_GETTYPE _IOW('a',ATMIOC_ITF+4,struct atmif_sioc) +- /* get interface type name */ +-#define ATM_GETESI _IOW('a',ATMIOC_ITF+5,struct atmif_sioc) +- /* get interface ESI */ +-#define ATM_GETADDR _IOW('a',ATMIOC_ITF+6,struct atmif_sioc) +- /* get itf's local ATM addr. list */ +-#define ATM_RSTADDR _IOW('a',ATMIOC_ITF+7,struct atmif_sioc) +- /* reset itf's ATM address list */ +-#define ATM_ADDADDR _IOW('a',ATMIOC_ITF+8,struct atmif_sioc) +- /* add a local ATM address */ +-#define ATM_DELADDR _IOW('a',ATMIOC_ITF+9,struct atmif_sioc) +- /* remove a local ATM address */ +-#define ATM_GETCIRANGE _IOW('a',ATMIOC_ITF+10,struct atmif_sioc) +- /* get connection identifier range */ +-#define ATM_SETCIRANGE _IOW('a',ATMIOC_ITF+11,struct atmif_sioc) +- /* set connection identifier range */ +-#define ATM_SETESI _IOW('a',ATMIOC_ITF+12,struct atmif_sioc) +- /* set interface ESI */ +-#define ATM_SETESIF _IOW('a',ATMIOC_ITF+13,struct atmif_sioc) +- /* force interface ESI */ +-#define ATM_ADDLECSADDR _IOW('a', ATMIOC_ITF+14, struct atmif_sioc) +- /* register a LECS address */ +-#define ATM_DELLECSADDR _IOW('a', ATMIOC_ITF+15, struct atmif_sioc) +- /* unregister a LECS address */ +-#define ATM_GETLECSADDR _IOW('a', ATMIOC_ITF+16, struct atmif_sioc) +- /* retrieve LECS address(es) */ +- +-#define ATM_GETSTAT _IOW('a',ATMIOC_SARCOM+0,struct atmif_sioc) +- /* get AAL layer statistics */ +-#define ATM_GETSTATZ _IOW('a',ATMIOC_SARCOM+1,struct atmif_sioc) +- /* get AAL layer statistics and zero */ +-#define ATM_GETLOOP _IOW('a',ATMIOC_SARCOM+2,struct atmif_sioc) +- /* get loopback mode */ +-#define ATM_SETLOOP _IOW('a',ATMIOC_SARCOM+3,struct atmif_sioc) +- /* set loopback mode */ +-#define ATM_QUERYLOOP _IOW('a',ATMIOC_SARCOM+4,struct atmif_sioc) +- /* query supported loopback modes */ +-#define ATM_SETSC _IOW('a',ATMIOC_SPECIAL+1,int) +- /* enable or disable single-copy */ +-#define ATM_SETBACKEND _IOW('a',ATMIOC_SPECIAL+2,atm_backend_t) +- /* set backend handler */ +-#define ATM_NEWBACKENDIF _IOW('a',ATMIOC_SPECIAL+3,atm_backend_t) +- /* use backend to make new if */ +-#define ATM_ADDPARTY _IOW('a', ATMIOC_SPECIAL+4,struct atm_iobuf) +- /* add party to p2mp call */ +-#ifdef CONFIG_COMPAT +-/* It actually takes struct sockaddr_atmsvc, not struct atm_iobuf */ +-#define COMPAT_ATM_ADDPARTY _IOW('a', ATMIOC_SPECIAL+4,struct compat_atm_iobuf) +-#endif +-#define ATM_DROPPARTY _IOW('a', ATMIOC_SPECIAL+5,int) +- /* drop party from p2mp call */ +- +-/* +- * These are backend handkers that can be set via the ATM_SETBACKEND call +- * above. In the future we may support dynamic loading of these - for now, +- * they're just being used to share the ATMIOC_BACKEND ioctls +- */ +-#define ATM_BACKEND_RAW 0 +-#define ATM_BACKEND_PPP 1 /* PPPoATM - RFC2364 */ +-#define ATM_BACKEND_BR2684 2 /* Bridged RFC1483/2684 */ +- +-/* for ATM_GETTYPE */ +-#define ATM_ITFTYP_LEN 8 /* maximum length of interface type name */ +- +-/* +- * Loopback modes for ATM_{PHY,SAR}_{GET,SET}LOOP +- */ +- +-/* Point of loopback CPU-->SAR-->PHY-->line--> ... */ +-#define __ATM_LM_NONE 0 /* no loop back ^ ^ ^ ^ */ +-#define __ATM_LM_AAL 1 /* loop back PDUs --' | | | */ +-#define __ATM_LM_ATM 2 /* loop back ATM cells ---' | | */ +-/* RESERVED 4 loop back on PHY side ---' */ +-#define __ATM_LM_PHY 8 /* loop back bits (digital) ----' | */ +-#define __ATM_LM_ANALOG 16 /* loop back the analog signal --------' */ +- +-/* Direction of loopback */ +-#define __ATM_LM_MKLOC(n) ((n)) /* Local (i.e. loop TX to RX) */ +-#define __ATM_LM_MKRMT(n) ((n) << 8) /* Remote (i.e. loop RX to TX) */ +- +-#define __ATM_LM_XTLOC(n) ((n) & 0xff) +-#define __ATM_LM_XTRMT(n) (((n) >> 8) & 0xff) +- +-#define ATM_LM_NONE 0 /* no loopback */ +- +-#define ATM_LM_LOC_AAL __ATM_LM_MKLOC(__ATM_LM_AAL) +-#define ATM_LM_LOC_ATM __ATM_LM_MKLOC(__ATM_LM_ATM) +-#define ATM_LM_LOC_PHY __ATM_LM_MKLOC(__ATM_LM_PHY) +-#define ATM_LM_LOC_ANALOG __ATM_LM_MKLOC(__ATM_LM_ANALOG) +- +-#define ATM_LM_RMT_AAL __ATM_LM_MKRMT(__ATM_LM_AAL) +-#define ATM_LM_RMT_ATM __ATM_LM_MKRMT(__ATM_LM_ATM) +-#define ATM_LM_RMT_PHY __ATM_LM_MKRMT(__ATM_LM_PHY) +-#define ATM_LM_RMT_ANALOG __ATM_LM_MKRMT(__ATM_LM_ANALOG) +- +-/* +- * Note: ATM_LM_LOC_* and ATM_LM_RMT_* can be combined, provided that +- * __ATM_LM_XTLOC(x) <= __ATM_LM_XTRMT(x) +- */ +- +- +-struct atm_iobuf { +- int length; +- void *buffer; +-}; +- +-/* for ATM_GETCIRANGE / ATM_SETCIRANGE */ +- +-#define ATM_CI_MAX -1 /* use maximum range of VPI/VCI */ +- +-struct atm_cirange { +- signed char vpi_bits; /* 1..8, ATM_CI_MAX (-1) for maximum */ +- signed char vci_bits; /* 1..16, ATM_CI_MAX (-1) for maximum */ +-}; +- +-/* for ATM_SETSC; actually taken from the ATM_VF number space */ +- +-#define ATM_SC_RX 1024 /* enable RX single-copy */ +-#define ATM_SC_TX 2048 /* enable TX single-copy */ +- +-#define ATM_BACKLOG_DEFAULT 32 /* if we get more, we're likely to time out +- anyway */ +- +-/* MF: change_qos (Modify) flags */ +- +-#define ATM_MF_IMMED 1 /* Block until change is effective */ +-#define ATM_MF_INC_RSV 2 /* Change reservation on increase */ +-#define ATM_MF_INC_SHP 4 /* Change shaping on increase */ +-#define ATM_MF_DEC_RSV 8 /* Change reservation on decrease */ +-#define ATM_MF_DEC_SHP 16 /* Change shaping on decrease */ +-#define ATM_MF_BWD 32 /* Set the backward direction parameters */ +- +-#define ATM_MF_SET (ATM_MF_INC_RSV | ATM_MF_INC_SHP | ATM_MF_DEC_RSV | \ +- ATM_MF_DEC_SHP | ATM_MF_BWD) +- +-/* +- * ATM_VS_* are used to express VC state in a human-friendly way. +- */ +- +-#define ATM_VS_IDLE 0 /* VC is not used */ +-#define ATM_VS_CONNECTED 1 /* VC is connected */ +-#define ATM_VS_CLOSING 2 /* VC is closing */ +-#define ATM_VS_LISTEN 3 /* VC is listening for incoming setups */ +-#define ATM_VS_INUSE 4 /* VC is in use (registered with atmsigd) */ +-#define ATM_VS_BOUND 5 /* VC is bound */ +- +-#define ATM_VS2TXT_MAP \ +- "IDLE", "CONNECTED", "CLOSING", "LISTEN", "INUSE", "BOUND" +- +-#define ATM_VF2TXT_MAP \ +- "ADDR", "READY", "PARTIAL", "REGIS", \ +- "RELEASED", "HASQOS", "LISTEN", "META", \ +- "256", "512", "1024", "2048", \ +- "SESSION", "HASSAP", "BOUND", "CLOSE" +- +- +- +-#endif /* LINUX_ATMDEV_H */ +diff --git a/include/linux/atmioc.h b/include/linux/atmioc.h +deleted file mode 100644 +index 37f67aa..0000000 +--- a/include/linux/atmioc.h ++++ /dev/null +@@ -1,41 +0,0 @@ +-/* atmioc.h - ranges for ATM-related ioctl numbers */ +- +-/* Written 1995-1999 by Werner Almesberger, EPFL LRC/ICA */ +- +- +-/* +- * See http://icawww1.epfl.ch/linux-atm/magic.html for the complete list of +- * "magic" ioctl numbers. +- */ +- +- +-#ifndef _LINUX_ATMIOC_H +-#define _LINUX_ATMIOC_H +- +-#include +- /* everybody including atmioc.h will also need _IO{,R,W,WR} */ +- +-#define ATMIOC_PHYCOM 0x00 /* PHY device common ioctls, globally unique */ +-#define ATMIOC_PHYCOM_END 0x0f +-#define ATMIOC_PHYTYP 0x10 /* PHY dev type ioctls, unique per PHY type */ +-#define ATMIOC_PHYTYP_END 0x2f +-#define ATMIOC_PHYPRV 0x30 /* PHY dev private ioctls, unique per driver */ +-#define ATMIOC_PHYPRV_END 0x4f +-#define ATMIOC_SARCOM 0x50 /* SAR device common ioctls, globally unique */ +-#define ATMIOC_SARCOM_END 0x50 +-#define ATMIOC_SARPRV 0x60 /* SAR dev private ioctls, unique per driver */ +-#define ATMIOC_SARPRV_END 0x7f +-#define ATMIOC_ITF 0x80 /* Interface ioctls, globally unique */ +-#define ATMIOC_ITF_END 0x8f +-#define ATMIOC_BACKEND 0x90 /* ATM generic backend ioctls, u. per backend */ +-#define ATMIOC_BACKEND_END 0xaf +-/* 0xb0-0xbf: Reserved for future use */ +-#define ATMIOC_AREQUIPA 0xc0 /* Application requested IP over ATM, glob. u. */ +-#define ATMIOC_LANE 0xd0 /* LAN Emulation, globally unique */ +-#define ATMIOC_MPOA 0xd8 /* MPOA, globally unique */ +-#define ATMIOC_CLIP 0xe0 /* Classical IP over ATM control, globally u. */ +-#define ATMIOC_CLIP_END 0xef +-#define ATMIOC_SPECIAL 0xf0 /* Special-purpose controls, globally unique */ +-#define ATMIOC_SPECIAL_END 0xff +- +-#endif +diff --git a/include/linux/atmsap.h b/include/linux/atmsap.h +deleted file mode 100644 +index 799b104..0000000 +--- a/include/linux/atmsap.h ++++ /dev/null +@@ -1,162 +0,0 @@ +-/* atmsap.h - ATM Service Access Point addressing definitions */ +- +-/* Written 1995-1999 by Werner Almesberger, EPFL LRC/ICA */ +- +- +-#ifndef _LINUX_ATMSAP_H +-#define _LINUX_ATMSAP_H +- +-#include +- +-/* +- * BEGIN_xx and END_xx markers are used for automatic generation of +- * documentation. Do not change them. +- */ +- +- +-/* +- * Layer 2 protocol identifiers +- */ +- +-/* BEGIN_L2 */ +-#define ATM_L2_NONE 0 /* L2 not specified */ +-#define ATM_L2_ISO1745 0x01 /* Basic mode ISO 1745 */ +-#define ATM_L2_Q291 0x02 /* ITU-T Q.291 (Rec. I.441) */ +-#define ATM_L2_X25_LL 0x06 /* ITU-T X.25, link layer */ +-#define ATM_L2_X25_ML 0x07 /* ITU-T X.25, multilink */ +-#define ATM_L2_LAPB 0x08 /* Extended LAPB, half-duplex (Rec. T.71) */ +-#define ATM_L2_HDLC_ARM 0x09 /* HDLC ARM (ISO/IEC 4335) */ +-#define ATM_L2_HDLC_NRM 0x0a /* HDLC NRM (ISO/IEC 4335) */ +-#define ATM_L2_HDLC_ABM 0x0b /* HDLC ABM (ISO/IEC 4335) */ +-#define ATM_L2_ISO8802 0x0c /* LAN LLC (ISO/IEC 8802/2) */ +-#define ATM_L2_X75 0x0d /* ITU-T X.75, SLP */ +-#define ATM_L2_Q922 0x0e /* ITU-T Q.922 */ +-#define ATM_L2_USER 0x10 /* user-specified */ +-#define ATM_L2_ISO7776 0x11 /* ISO 7776 DTE-DTE */ +-/* END_L2 */ +- +- +-/* +- * Layer 3 protocol identifiers +- */ +- +-/* BEGIN_L3 */ +-#define ATM_L3_NONE 0 /* L3 not specified */ +-#define ATM_L3_X25 0x06 /* ITU-T X.25, packet layer */ +-#define ATM_L3_ISO8208 0x07 /* ISO/IEC 8208 */ +-#define ATM_L3_X223 0x08 /* ITU-T X.223 | ISO/IEC 8878 */ +-#define ATM_L3_ISO8473 0x09 /* ITU-T X.233 | ISO/IEC 8473 */ +-#define ATM_L3_T70 0x0a /* ITU-T T.70 minimum network layer */ +-#define ATM_L3_TR9577 0x0b /* ISO/IEC TR 9577 */ +-#define ATM_L3_H310 0x0c /* ITU-T Recommendation H.310 */ +-#define ATM_L3_H321 0x0d /* ITU-T Recommendation H.321 */ +-#define ATM_L3_USER 0x10 /* user-specified */ +-/* END_L3 */ +- +- +-/* +- * High layer identifiers +- */ +- +-/* BEGIN_HL */ +-#define ATM_HL_NONE 0 /* HL not specified */ +-#define ATM_HL_ISO 0x01 /* ISO */ +-#define ATM_HL_USER 0x02 /* user-specific */ +-#define ATM_HL_HLP 0x03 /* high layer profile - UNI 3.0 only */ +-#define ATM_HL_VENDOR 0x04 /* vendor-specific application identifier */ +-/* END_HL */ +- +- +-/* +- * ITU-T coded mode of operation +- */ +- +-/* BEGIN_IMD */ +-#define ATM_IMD_NONE 0 /* mode not specified */ +-#define ATM_IMD_NORMAL 1 /* normal mode of operation */ +-#define ATM_IMD_EXTENDED 2 /* extended mode of operation */ +-/* END_IMD */ +- +-/* +- * H.310 code points +- */ +- +-#define ATM_TT_NONE 0 /* terminal type not specified */ +-#define ATM_TT_RX 1 /* receive only */ +-#define ATM_TT_TX 2 /* send only */ +-#define ATM_TT_RXTX 3 /* receive and send */ +- +-#define ATM_MC_NONE 0 /* no multiplexing */ +-#define ATM_MC_TS 1 /* transport stream (TS) */ +-#define ATM_MC_TS_FEC 2 /* transport stream with forward error corr. */ +-#define ATM_MC_PS 3 /* program stream (PS) */ +-#define ATM_MC_PS_FEC 4 /* program stream with forward error corr. */ +-#define ATM_MC_H221 5 /* ITU-T Rec. H.221 */ +- +-/* +- * SAP structures +- */ +- +-#define ATM_MAX_HLI 8 /* maximum high-layer information length */ +- +- +-struct atm_blli { +- unsigned char l2_proto; /* layer 2 protocol */ +- union { +- struct { +- unsigned char mode; /* mode of operation (ATM_IMD_xxx), 0 if */ +- /* absent */ +- unsigned char window; /* window size (k), 1-127 (0 to omit) */ +- } itu; /* ITU-T encoding */ +- unsigned char user; /* user-specified l2 information */ +- } l2; +- unsigned char l3_proto; /* layer 3 protocol */ +- union { +- struct { +- unsigned char mode; /* mode of operation (ATM_IMD_xxx), 0 if */ +- /* absent */ +- unsigned char def_size; /* default packet size (log2), 4-12 (0 to */ +- /* omit) */ +- unsigned char window;/* packet window size, 1-127 (0 to omit) */ +- } itu; /* ITU-T encoding */ +- unsigned char user; /* user specified l3 information */ +- struct { /* if l3_proto = ATM_L3_H310 */ +- unsigned char term_type; /* terminal type */ +- unsigned char fw_mpx_cap; /* forward multiplexing capability */ +- /* only if term_type != ATM_TT_NONE */ +- unsigned char bw_mpx_cap; /* backward multiplexing capability */ +- /* only if term_type != ATM_TT_NONE */ +- } h310; +- struct { /* if l3_proto = ATM_L3_TR9577 */ +- unsigned char ipi; /* initial protocol id */ +- unsigned char snap[5];/* IEEE 802.1 SNAP identifier */ +- /* (only if ipi == NLPID_IEEE802_1_SNAP) */ +- } tr9577; +- } l3; +-} __ATM_API_ALIGN; +- +- +-struct atm_bhli { +- unsigned char hl_type; /* high layer information type */ +- unsigned char hl_length; /* length (only if hl_type == ATM_HL_USER || */ +- /* hl_type == ATM_HL_ISO) */ +- unsigned char hl_info[ATM_MAX_HLI];/* high layer information */ +-}; +- +- +-#define ATM_MAX_BLLI 3 /* maximum number of BLLI elements */ +- +- +-struct atm_sap { +- struct atm_bhli bhli; /* local SAP, high-layer information */ +- struct atm_blli blli[ATM_MAX_BLLI] __ATM_API_ALIGN; +- /* local SAP, low-layer info */ +-}; +- +- +-static __inline__ int blli_in_use(struct atm_blli blli) +-{ +- return blli.l2_proto || blli.l3_proto; +-} +- +-#endif +diff --git a/include/linux/bpf.h b/include/linux/bpf.h +deleted file mode 100644 +index 0895a52..0000000 +--- a/include/linux/bpf.h ++++ /dev/null +@@ -1,867 +0,0 @@ +-/* Copyright (c) 2011-2014 PLUMgrid, http://plumgrid.com +- * +- * This program is free software; you can redistribute it and/or +- * modify it under the terms of version 2 of the GNU General Public +- * License as published by the Free Software Foundation. +- */ +-#ifndef __LINUX_BPF_H__ +-#define __LINUX_BPF_H__ +- +-#include +-#include +- +-/* Extended instruction set based on top of classic BPF */ +- +-/* instruction classes */ +-#define BPF_ALU64 0x07 /* alu mode in double word width */ +- +-/* ld/ldx fields */ +-#define BPF_DW 0x18 /* double word */ +-#define BPF_XADD 0xc0 /* exclusive add */ +- +-/* alu/jmp fields */ +-#define BPF_MOV 0xb0 /* mov reg to reg */ +-#define BPF_ARSH 0xc0 /* sign extending arithmetic shift right */ +- +-/* change endianness of a register */ +-#define BPF_END 0xd0 /* flags for endianness conversion: */ +-#define BPF_TO_LE 0x00 /* convert to little-endian */ +-#define BPF_TO_BE 0x08 /* convert to big-endian */ +-#define BPF_FROM_LE BPF_TO_LE +-#define BPF_FROM_BE BPF_TO_BE +- +-/* jmp encodings */ +-#define BPF_JNE 0x50 /* jump != */ +-#define BPF_JLT 0xa0 /* LT is unsigned, '<' */ +-#define BPF_JLE 0xb0 /* LE is unsigned, '<=' */ +-#define BPF_JSGT 0x60 /* SGT is signed '>', GT in x86 */ +-#define BPF_JSGE 0x70 /* SGE is signed '>=', GE in x86 */ +-#define BPF_JSLT 0xc0 /* SLT is signed, '<' */ +-#define BPF_JSLE 0xd0 /* SLE is signed, '<=' */ +-#define BPF_CALL 0x80 /* function call */ +-#define BPF_EXIT 0x90 /* function return */ +- +-/* Register numbers */ +-enum { +- BPF_REG_0 = 0, +- BPF_REG_1, +- BPF_REG_2, +- BPF_REG_3, +- BPF_REG_4, +- BPF_REG_5, +- BPF_REG_6, +- BPF_REG_7, +- BPF_REG_8, +- BPF_REG_9, +- BPF_REG_10, +- __MAX_BPF_REG, +-}; +- +-/* BPF has 10 general purpose 64-bit registers and stack frame. */ +-#define MAX_BPF_REG __MAX_BPF_REG +- +-struct bpf_insn { +- __u8 code; /* opcode */ +- __u8 dst_reg:4; /* dest register */ +- __u8 src_reg:4; /* source register */ +- __s16 off; /* signed offset */ +- __s32 imm; /* signed immediate constant */ +-}; +- +-/* Key of an a BPF_MAP_TYPE_LPM_TRIE entry */ +-struct bpf_lpm_trie_key { +- __u32 prefixlen; /* up to 32 for AF_INET, 128 for AF_INET6 */ +- __u8 data[0]; /* Arbitrary size */ +-}; +- +-/* BPF syscall commands, see bpf(2) man-page for details. */ +-enum bpf_cmd { +- BPF_MAP_CREATE, +- BPF_MAP_LOOKUP_ELEM, +- BPF_MAP_UPDATE_ELEM, +- BPF_MAP_DELETE_ELEM, +- BPF_MAP_GET_NEXT_KEY, +- BPF_PROG_LOAD, +- BPF_OBJ_PIN, +- BPF_OBJ_GET, +- BPF_PROG_ATTACH, +- BPF_PROG_DETACH, +- BPF_PROG_TEST_RUN, +- BPF_PROG_GET_NEXT_ID, +- BPF_MAP_GET_NEXT_ID, +- BPF_PROG_GET_FD_BY_ID, +- BPF_MAP_GET_FD_BY_ID, +- BPF_OBJ_GET_INFO_BY_FD, +-}; +- +-enum bpf_map_type { +- BPF_MAP_TYPE_UNSPEC, +- BPF_MAP_TYPE_HASH, +- BPF_MAP_TYPE_ARRAY, +- BPF_MAP_TYPE_PROG_ARRAY, +- BPF_MAP_TYPE_PERF_EVENT_ARRAY, +- BPF_MAP_TYPE_PERCPU_HASH, +- BPF_MAP_TYPE_PERCPU_ARRAY, +- BPF_MAP_TYPE_STACK_TRACE, +- BPF_MAP_TYPE_CGROUP_ARRAY, +- BPF_MAP_TYPE_LRU_HASH, +- BPF_MAP_TYPE_LRU_PERCPU_HASH, +- BPF_MAP_TYPE_LPM_TRIE, +- BPF_MAP_TYPE_ARRAY_OF_MAPS, +- BPF_MAP_TYPE_HASH_OF_MAPS, +- BPF_MAP_TYPE_DEVMAP, +- BPF_MAP_TYPE_SOCKMAP, +-}; +- +-enum bpf_prog_type { +- BPF_PROG_TYPE_UNSPEC, +- BPF_PROG_TYPE_SOCKET_FILTER, +- BPF_PROG_TYPE_KPROBE, +- BPF_PROG_TYPE_SCHED_CLS, +- BPF_PROG_TYPE_SCHED_ACT, +- BPF_PROG_TYPE_TRACEPOINT, +- BPF_PROG_TYPE_XDP, +- BPF_PROG_TYPE_PERF_EVENT, +- BPF_PROG_TYPE_CGROUP_SKB, +- BPF_PROG_TYPE_CGROUP_SOCK, +- BPF_PROG_TYPE_LWT_IN, +- BPF_PROG_TYPE_LWT_OUT, +- BPF_PROG_TYPE_LWT_XMIT, +- BPF_PROG_TYPE_SOCK_OPS, +- BPF_PROG_TYPE_SK_SKB, +-}; +- +-enum bpf_attach_type { +- BPF_CGROUP_INET_INGRESS, +- BPF_CGROUP_INET_EGRESS, +- BPF_CGROUP_INET_SOCK_CREATE, +- BPF_CGROUP_SOCK_OPS, +- BPF_SK_SKB_STREAM_PARSER, +- BPF_SK_SKB_STREAM_VERDICT, +- __MAX_BPF_ATTACH_TYPE +-}; +- +-#define MAX_BPF_ATTACH_TYPE __MAX_BPF_ATTACH_TYPE +- +-/* If BPF_F_ALLOW_OVERRIDE flag is used in BPF_PROG_ATTACH command +- * to the given target_fd cgroup the descendent cgroup will be able to +- * override effective bpf program that was inherited from this cgroup +- */ +-#define BPF_F_ALLOW_OVERRIDE (1U << 0) +- +-/* If BPF_F_STRICT_ALIGNMENT is used in BPF_PROG_LOAD command, the +- * verifier will perform strict alignment checking as if the kernel +- * has been built with CONFIG_EFFICIENT_UNALIGNED_ACCESS not set, +- * and NET_IP_ALIGN defined to 2. +- */ +-#define BPF_F_STRICT_ALIGNMENT (1U << 0) +- +-#define BPF_PSEUDO_MAP_FD 1 +- +-/* flags for BPF_MAP_UPDATE_ELEM command */ +-#define BPF_ANY 0 /* create new element or update existing */ +-#define BPF_NOEXIST 1 /* create new element if it didn't exist */ +-#define BPF_EXIST 2 /* update existing element */ +- +-/* flags for BPF_MAP_CREATE command */ +-#define BPF_F_NO_PREALLOC (1U << 0) +-/* Instead of having one common LRU list in the +- * BPF_MAP_TYPE_LRU_[PERCPU_]HASH map, use a percpu LRU list +- * which can scale and perform better. +- * Note, the LRU nodes (including free nodes) cannot be moved +- * across different LRU lists. +- */ +-#define BPF_F_NO_COMMON_LRU (1U << 1) +-/* Specify numa node during map creation */ +-#define BPF_F_NUMA_NODE (1U << 2) +- +-union bpf_attr { +- struct { /* anonymous struct used by BPF_MAP_CREATE command */ +- __u32 map_type; /* one of enum bpf_map_type */ +- __u32 key_size; /* size of key in bytes */ +- __u32 value_size; /* size of value in bytes */ +- __u32 max_entries; /* max number of entries in a map */ +- __u32 map_flags; /* BPF_MAP_CREATE related +- * flags defined above. +- */ +- __u32 inner_map_fd; /* fd pointing to the inner map */ +- __u32 numa_node; /* numa node (effective only if +- * BPF_F_NUMA_NODE is set). +- */ +- }; +- +- struct { /* anonymous struct used by BPF_MAP_*_ELEM commands */ +- __u32 map_fd; +- __aligned_u64 key; +- union { +- __aligned_u64 value; +- __aligned_u64 next_key; +- }; +- __u64 flags; +- }; +- +- struct { /* anonymous struct used by BPF_PROG_LOAD command */ +- __u32 prog_type; /* one of enum bpf_prog_type */ +- __u32 insn_cnt; +- __aligned_u64 insns; +- __aligned_u64 license; +- __u32 log_level; /* verbosity level of verifier */ +- __u32 log_size; /* size of user buffer */ +- __aligned_u64 log_buf; /* user supplied buffer */ +- __u32 kern_version; /* checked when prog_type=kprobe */ +- __u32 prog_flags; +- }; +- +- struct { /* anonymous struct used by BPF_OBJ_* commands */ +- __aligned_u64 pathname; +- __u32 bpf_fd; +- }; +- +- struct { /* anonymous struct used by BPF_PROG_ATTACH/DETACH commands */ +- __u32 target_fd; /* container object to attach to */ +- __u32 attach_bpf_fd; /* eBPF program to attach */ +- __u32 attach_type; +- __u32 attach_flags; +- }; +- +- struct { /* anonymous struct used by BPF_PROG_TEST_RUN command */ +- __u32 prog_fd; +- __u32 retval; +- __u32 data_size_in; +- __u32 data_size_out; +- __aligned_u64 data_in; +- __aligned_u64 data_out; +- __u32 repeat; +- __u32 duration; +- } test; +- +- struct { /* anonymous struct used by BPF_*_GET_*_ID */ +- union { +- __u32 start_id; +- __u32 prog_id; +- __u32 map_id; +- }; +- __u32 next_id; +- }; +- +- struct { /* anonymous struct used by BPF_OBJ_GET_INFO_BY_FD */ +- __u32 bpf_fd; +- __u32 info_len; +- __aligned_u64 info; +- } info; +-} __attribute__((aligned(8))); +- +-/* BPF helper function descriptions: +- * +- * void *bpf_map_lookup_elem(&map, &key) +- * Return: Map value or NULL +- * +- * int bpf_map_update_elem(&map, &key, &value, flags) +- * Return: 0 on success or negative error +- * +- * int bpf_map_delete_elem(&map, &key) +- * Return: 0 on success or negative error +- * +- * int bpf_probe_read(void *dst, int size, void *src) +- * Return: 0 on success or negative error +- * +- * u64 bpf_ktime_get_ns(void) +- * Return: current ktime +- * +- * int bpf_trace_printk(const char *fmt, int fmt_size, ...) +- * Return: length of buffer written or negative error +- * +- * u32 bpf_prandom_u32(void) +- * Return: random value +- * +- * u32 bpf_raw_smp_processor_id(void) +- * Return: SMP processor ID +- * +- * int bpf_skb_store_bytes(skb, offset, from, len, flags) +- * store bytes into packet +- * @skb: pointer to skb +- * @offset: offset within packet from skb->mac_header +- * @from: pointer where to copy bytes from +- * @len: number of bytes to store into packet +- * @flags: bit 0 - if true, recompute skb->csum +- * other bits - reserved +- * Return: 0 on success or negative error +- * +- * int bpf_l3_csum_replace(skb, offset, from, to, flags) +- * recompute IP checksum +- * @skb: pointer to skb +- * @offset: offset within packet where IP checksum is located +- * @from: old value of header field +- * @to: new value of header field +- * @flags: bits 0-3 - size of header field +- * other bits - reserved +- * Return: 0 on success or negative error +- * +- * int bpf_l4_csum_replace(skb, offset, from, to, flags) +- * recompute TCP/UDP checksum +- * @skb: pointer to skb +- * @offset: offset within packet where TCP/UDP checksum is located +- * @from: old value of header field +- * @to: new value of header field +- * @flags: bits 0-3 - size of header field +- * bit 4 - is pseudo header +- * other bits - reserved +- * Return: 0 on success or negative error +- * +- * int bpf_tail_call(ctx, prog_array_map, index) +- * jump into another BPF program +- * @ctx: context pointer passed to next program +- * @prog_array_map: pointer to map which type is BPF_MAP_TYPE_PROG_ARRAY +- * @index: index inside array that selects specific program to run +- * Return: 0 on success or negative error +- * +- * int bpf_clone_redirect(skb, ifindex, flags) +- * redirect to another netdev +- * @skb: pointer to skb +- * @ifindex: ifindex of the net device +- * @flags: bit 0 - if set, redirect to ingress instead of egress +- * other bits - reserved +- * Return: 0 on success or negative error +- * +- * u64 bpf_get_current_pid_tgid(void) +- * Return: current->tgid << 32 | current->pid +- * +- * u64 bpf_get_current_uid_gid(void) +- * Return: current_gid << 32 | current_uid +- * +- * int bpf_get_current_comm(char *buf, int size_of_buf) +- * stores current->comm into buf +- * Return: 0 on success or negative error +- * +- * u32 bpf_get_cgroup_classid(skb) +- * retrieve a proc's classid +- * @skb: pointer to skb +- * Return: classid if != 0 +- * +- * int bpf_skb_vlan_push(skb, vlan_proto, vlan_tci) +- * Return: 0 on success or negative error +- * +- * int bpf_skb_vlan_pop(skb) +- * Return: 0 on success or negative error +- * +- * int bpf_skb_get_tunnel_key(skb, key, size, flags) +- * int bpf_skb_set_tunnel_key(skb, key, size, flags) +- * retrieve or populate tunnel metadata +- * @skb: pointer to skb +- * @key: pointer to 'struct bpf_tunnel_key' +- * @size: size of 'struct bpf_tunnel_key' +- * @flags: room for future extensions +- * Return: 0 on success or negative error +- * +- * u64 bpf_perf_event_read(map, flags) +- * read perf event counter value +- * @map: pointer to perf_event_array map +- * @flags: index of event in the map or bitmask flags +- * Return: value of perf event counter read or error code +- * +- * int bpf_redirect(ifindex, flags) +- * redirect to another netdev +- * @ifindex: ifindex of the net device +- * @flags: +- * cls_bpf: +- * bit 0 - if set, redirect to ingress instead of egress +- * other bits - reserved +- * xdp_bpf: +- * all bits - reserved +- * Return: cls_bpf: TC_ACT_REDIRECT on success or TC_ACT_SHOT on error +- * xdp_bfp: XDP_REDIRECT on success or XDP_ABORT on error +- * int bpf_redirect_map(map, key, flags) +- * redirect to endpoint in map +- * @map: pointer to dev map +- * @key: index in map to lookup +- * @flags: -- +- * Return: XDP_REDIRECT on success or XDP_ABORT on error +- * +- * u32 bpf_get_route_realm(skb) +- * retrieve a dst's tclassid +- * @skb: pointer to skb +- * Return: realm if != 0 +- * +- * int bpf_perf_event_output(ctx, map, flags, data, size) +- * output perf raw sample +- * @ctx: struct pt_regs* +- * @map: pointer to perf_event_array map +- * @flags: index of event in the map or bitmask flags +- * @data: data on stack to be output as raw data +- * @size: size of data +- * Return: 0 on success or negative error +- * +- * int bpf_get_stackid(ctx, map, flags) +- * walk user or kernel stack and return id +- * @ctx: struct pt_regs* +- * @map: pointer to stack_trace map +- * @flags: bits 0-7 - numer of stack frames to skip +- * bit 8 - collect user stack instead of kernel +- * bit 9 - compare stacks by hash only +- * bit 10 - if two different stacks hash into the same stackid +- * discard old +- * other bits - reserved +- * Return: >= 0 stackid on success or negative error +- * +- * s64 bpf_csum_diff(from, from_size, to, to_size, seed) +- * calculate csum diff +- * @from: raw from buffer +- * @from_size: length of from buffer +- * @to: raw to buffer +- * @to_size: length of to buffer +- * @seed: optional seed +- * Return: csum result or negative error code +- * +- * int bpf_skb_get_tunnel_opt(skb, opt, size) +- * retrieve tunnel options metadata +- * @skb: pointer to skb +- * @opt: pointer to raw tunnel option data +- * @size: size of @opt +- * Return: option size +- * +- * int bpf_skb_set_tunnel_opt(skb, opt, size) +- * populate tunnel options metadata +- * @skb: pointer to skb +- * @opt: pointer to raw tunnel option data +- * @size: size of @opt +- * Return: 0 on success or negative error +- * +- * int bpf_skb_change_proto(skb, proto, flags) +- * Change protocol of the skb. Currently supported is v4 -> v6, +- * v6 -> v4 transitions. The helper will also resize the skb. eBPF +- * program is expected to fill the new headers via skb_store_bytes +- * and lX_csum_replace. +- * @skb: pointer to skb +- * @proto: new skb->protocol type +- * @flags: reserved +- * Return: 0 on success or negative error +- * +- * int bpf_skb_change_type(skb, type) +- * Change packet type of skb. +- * @skb: pointer to skb +- * @type: new skb->pkt_type type +- * Return: 0 on success or negative error +- * +- * int bpf_skb_under_cgroup(skb, map, index) +- * Check cgroup2 membership of skb +- * @skb: pointer to skb +- * @map: pointer to bpf_map in BPF_MAP_TYPE_CGROUP_ARRAY type +- * @index: index of the cgroup in the bpf_map +- * Return: +- * == 0 skb failed the cgroup2 descendant test +- * == 1 skb succeeded the cgroup2 descendant test +- * < 0 error +- * +- * u32 bpf_get_hash_recalc(skb) +- * Retrieve and possibly recalculate skb->hash. +- * @skb: pointer to skb +- * Return: hash +- * +- * u64 bpf_get_current_task(void) +- * Returns current task_struct +- * Return: current +- * +- * int bpf_probe_write_user(void *dst, void *src, int len) +- * safely attempt to write to a location +- * @dst: destination address in userspace +- * @src: source address on stack +- * @len: number of bytes to copy +- * Return: 0 on success or negative error +- * +- * int bpf_current_task_under_cgroup(map, index) +- * Check cgroup2 membership of current task +- * @map: pointer to bpf_map in BPF_MAP_TYPE_CGROUP_ARRAY type +- * @index: index of the cgroup in the bpf_map +- * Return: +- * == 0 current failed the cgroup2 descendant test +- * == 1 current succeeded the cgroup2 descendant test +- * < 0 error +- * +- * int bpf_skb_change_tail(skb, len, flags) +- * The helper will resize the skb to the given new size, to be used f.e. +- * with control messages. +- * @skb: pointer to skb +- * @len: new skb length +- * @flags: reserved +- * Return: 0 on success or negative error +- * +- * int bpf_skb_pull_data(skb, len) +- * The helper will pull in non-linear data in case the skb is non-linear +- * and not all of len are part of the linear section. Only needed for +- * read/write with direct packet access. +- * @skb: pointer to skb +- * @len: len to make read/writeable +- * Return: 0 on success or negative error +- * +- * s64 bpf_csum_update(skb, csum) +- * Adds csum into skb->csum in case of CHECKSUM_COMPLETE. +- * @skb: pointer to skb +- * @csum: csum to add +- * Return: csum on success or negative error +- * +- * void bpf_set_hash_invalid(skb) +- * Invalidate current skb->hash. +- * @skb: pointer to skb +- * +- * int bpf_get_numa_node_id() +- * Return: Id of current NUMA node. +- * +- * int bpf_skb_change_head() +- * Grows headroom of skb and adjusts MAC header offset accordingly. +- * Will extends/reallocae as required automatically. +- * May change skb data pointer and will thus invalidate any check +- * performed for direct packet access. +- * @skb: pointer to skb +- * @len: length of header to be pushed in front +- * @flags: Flags (unused for now) +- * Return: 0 on success or negative error +- * +- * int bpf_xdp_adjust_head(xdp_md, delta) +- * Adjust the xdp_md.data by delta +- * @xdp_md: pointer to xdp_md +- * @delta: An positive/negative integer to be added to xdp_md.data +- * Return: 0 on success or negative on error +- * +- * int bpf_probe_read_str(void *dst, int size, const void *unsafe_ptr) +- * Copy a NUL terminated string from unsafe address. In case the string +- * length is smaller than size, the target is not padded with further NUL +- * bytes. In case the string length is larger than size, just count-1 +- * bytes are copied and the last byte is set to NUL. +- * @dst: destination address +- * @size: maximum number of bytes to copy, including the trailing NUL +- * @unsafe_ptr: unsafe address +- * Return: +- * > 0 length of the string including the trailing NUL on success +- * < 0 error +- * +- * u64 bpf_get_socket_cookie(skb) +- * Get the cookie for the socket stored inside sk_buff. +- * @skb: pointer to skb +- * Return: 8 Bytes non-decreasing number on success or 0 if the socket +- * field is missing inside sk_buff +- * +- * u32 bpf_get_socket_uid(skb) +- * Get the owner uid of the socket stored inside sk_buff. +- * @skb: pointer to skb +- * Return: uid of the socket owner on success or overflowuid if failed. +- * +- * u32 bpf_set_hash(skb, hash) +- * Set full skb->hash. +- * @skb: pointer to skb +- * @hash: hash to set +- * +- * int bpf_setsockopt(bpf_socket, level, optname, optval, optlen) +- * Calls setsockopt. Not all opts are available, only those with +- * integer optvals plus TCP_CONGESTION. +- * Supported levels: SOL_SOCKET and IPROTO_TCP +- * @bpf_socket: pointer to bpf_socket +- * @level: SOL_SOCKET or IPROTO_TCP +- * @optname: option name +- * @optval: pointer to option value +- * @optlen: length of optval in byes +- * Return: 0 or negative error +- * +- * int bpf_skb_adjust_room(skb, len_diff, mode, flags) +- * Grow or shrink room in sk_buff. +- * @skb: pointer to skb +- * @len_diff: (signed) amount of room to grow/shrink +- * @mode: operation mode (enum bpf_adj_room_mode) +- * @flags: reserved for future use +- * Return: 0 on success or negative error code +- * +- * int bpf_sk_redirect_map(map, key, flags) +- * Redirect skb to a sock in map using key as a lookup key for the +- * sock in map. +- * @map: pointer to sockmap +- * @key: key to lookup sock in map +- * @flags: reserved for future use +- * Return: SK_REDIRECT +- * +- * int bpf_sock_map_update(skops, map, key, flags) +- * @skops: pointer to bpf_sock_ops +- * @map: pointer to sockmap to update +- * @key: key to insert/update sock in map +- * @flags: same flags as map update elem +- */ +-#define __BPF_FUNC_MAPPER(FN) \ +- FN(unspec), \ +- FN(map_lookup_elem), \ +- FN(map_update_elem), \ +- FN(map_delete_elem), \ +- FN(probe_read), \ +- FN(ktime_get_ns), \ +- FN(trace_printk), \ +- FN(get_prandom_u32), \ +- FN(get_smp_processor_id), \ +- FN(skb_store_bytes), \ +- FN(l3_csum_replace), \ +- FN(l4_csum_replace), \ +- FN(tail_call), \ +- FN(clone_redirect), \ +- FN(get_current_pid_tgid), \ +- FN(get_current_uid_gid), \ +- FN(get_current_comm), \ +- FN(get_cgroup_classid), \ +- FN(skb_vlan_push), \ +- FN(skb_vlan_pop), \ +- FN(skb_get_tunnel_key), \ +- FN(skb_set_tunnel_key), \ +- FN(perf_event_read), \ +- FN(redirect), \ +- FN(get_route_realm), \ +- FN(perf_event_output), \ +- FN(skb_load_bytes), \ +- FN(get_stackid), \ +- FN(csum_diff), \ +- FN(skb_get_tunnel_opt), \ +- FN(skb_set_tunnel_opt), \ +- FN(skb_change_proto), \ +- FN(skb_change_type), \ +- FN(skb_under_cgroup), \ +- FN(get_hash_recalc), \ +- FN(get_current_task), \ +- FN(probe_write_user), \ +- FN(current_task_under_cgroup), \ +- FN(skb_change_tail), \ +- FN(skb_pull_data), \ +- FN(csum_update), \ +- FN(set_hash_invalid), \ +- FN(get_numa_node_id), \ +- FN(skb_change_head), \ +- FN(xdp_adjust_head), \ +- FN(probe_read_str), \ +- FN(get_socket_cookie), \ +- FN(get_socket_uid), \ +- FN(set_hash), \ +- FN(setsockopt), \ +- FN(skb_adjust_room), \ +- FN(redirect_map), \ +- FN(sk_redirect_map), \ +- FN(sock_map_update), \ +- +-/* integer value in 'imm' field of BPF_CALL instruction selects which helper +- * function eBPF program intends to call +- */ +-#define __BPF_ENUM_FN(x) BPF_FUNC_ ## x +-enum bpf_func_id { +- __BPF_FUNC_MAPPER(__BPF_ENUM_FN) +- __BPF_FUNC_MAX_ID, +-}; +-#undef __BPF_ENUM_FN +- +-/* All flags used by eBPF helper functions, placed here. */ +- +-/* BPF_FUNC_skb_store_bytes flags. */ +-#define BPF_F_RECOMPUTE_CSUM (1ULL << 0) +-#define BPF_F_INVALIDATE_HASH (1ULL << 1) +- +-/* BPF_FUNC_l3_csum_replace and BPF_FUNC_l4_csum_replace flags. +- * First 4 bits are for passing the header field size. +- */ +-#define BPF_F_HDR_FIELD_MASK 0xfULL +- +-/* BPF_FUNC_l4_csum_replace flags. */ +-#define BPF_F_PSEUDO_HDR (1ULL << 4) +-#define BPF_F_MARK_MANGLED_0 (1ULL << 5) +-#define BPF_F_MARK_ENFORCE (1ULL << 6) +- +-/* BPF_FUNC_clone_redirect and BPF_FUNC_redirect flags. */ +-#define BPF_F_INGRESS (1ULL << 0) +- +-/* BPF_FUNC_skb_set_tunnel_key and BPF_FUNC_skb_get_tunnel_key flags. */ +-#define BPF_F_TUNINFO_IPV6 (1ULL << 0) +- +-/* BPF_FUNC_get_stackid flags. */ +-#define BPF_F_SKIP_FIELD_MASK 0xffULL +-#define BPF_F_USER_STACK (1ULL << 8) +-#define BPF_F_FAST_STACK_CMP (1ULL << 9) +-#define BPF_F_REUSE_STACKID (1ULL << 10) +- +-/* BPF_FUNC_skb_set_tunnel_key flags. */ +-#define BPF_F_ZERO_CSUM_TX (1ULL << 1) +-#define BPF_F_DONT_FRAGMENT (1ULL << 2) +- +-/* BPF_FUNC_perf_event_output and BPF_FUNC_perf_event_read flags. */ +-#define BPF_F_INDEX_MASK 0xffffffffULL +-#define BPF_F_CURRENT_CPU BPF_F_INDEX_MASK +-/* BPF_FUNC_perf_event_output for sk_buff input context. */ +-#define BPF_F_CTXLEN_MASK (0xfffffULL << 32) +- +-/* Mode for BPF_FUNC_skb_adjust_room helper. */ +-enum bpf_adj_room_mode { +- BPF_ADJ_ROOM_NET, +-}; +- +-/* user accessible mirror of in-kernel sk_buff. +- * new fields can only be added to the end of this structure +- */ +-struct __sk_buff { +- __u32 len; +- __u32 pkt_type; +- __u32 mark; +- __u32 queue_mapping; +- __u32 protocol; +- __u32 vlan_present; +- __u32 vlan_tci; +- __u32 vlan_proto; +- __u32 priority; +- __u32 ingress_ifindex; +- __u32 ifindex; +- __u32 tc_index; +- __u32 cb[5]; +- __u32 hash; +- __u32 tc_classid; +- __u32 data; +- __u32 data_end; +- __u32 napi_id; +- +- /* accessed by BPF_PROG_TYPE_sk_skb types */ +- __u32 family; +- __u32 remote_ip4; /* Stored in network byte order */ +- __u32 local_ip4; /* Stored in network byte order */ +- __u32 remote_ip6[4]; /* Stored in network byte order */ +- __u32 local_ip6[4]; /* Stored in network byte order */ +- __u32 remote_port; /* Stored in network byte order */ +- __u32 local_port; /* stored in host byte order */ +-}; +- +-struct bpf_tunnel_key { +- __u32 tunnel_id; +- union { +- __u32 remote_ipv4; +- __u32 remote_ipv6[4]; +- }; +- __u8 tunnel_tos; +- __u8 tunnel_ttl; +- __u16 tunnel_ext; +- __u32 tunnel_label; +-}; +- +-/* Generic BPF return codes which all BPF program types may support. +- * The values are binary compatible with their TC_ACT_* counter-part to +- * provide backwards compatibility with existing SCHED_CLS and SCHED_ACT +- * programs. +- * +- * XDP is handled seprately, see XDP_*. +- */ +-enum bpf_ret_code { +- BPF_OK = 0, +- /* 1 reserved */ +- BPF_DROP = 2, +- /* 3-6 reserved */ +- BPF_REDIRECT = 7, +- /* >127 are reserved for prog type specific return codes */ +-}; +- +-struct bpf_sock { +- __u32 bound_dev_if; +- __u32 family; +- __u32 type; +- __u32 protocol; +- __u32 mark; +- __u32 priority; +-}; +- +-#define XDP_PACKET_HEADROOM 256 +- +-/* User return codes for XDP prog type. +- * A valid XDP program must return one of these defined values. All other +- * return codes are reserved for future use. Unknown return codes will +- * result in packet drops and a warning via bpf_warn_invalid_xdp_action(). +- */ +-enum xdp_action { +- XDP_ABORTED = 0, +- XDP_DROP, +- XDP_PASS, +- XDP_TX, +- XDP_REDIRECT, +-}; +- +-/* user accessible metadata for XDP packet hook +- * new fields must be added to the end of this structure +- */ +-struct xdp_md { +- __u32 data; +- __u32 data_end; +-}; +- +-enum sk_action { +- SK_ABORTED = 0, +- SK_DROP, +- SK_REDIRECT, +-}; +- +-#define BPF_TAG_SIZE 8 +- +-struct bpf_prog_info { +- __u32 type; +- __u32 id; +- __u8 tag[BPF_TAG_SIZE]; +- __u32 jited_prog_len; +- __u32 xlated_prog_len; +- __aligned_u64 jited_prog_insns; +- __aligned_u64 xlated_prog_insns; +-} __attribute__((aligned(8))); +- +-struct bpf_map_info { +- __u32 type; +- __u32 id; +- __u32 key_size; +- __u32 value_size; +- __u32 max_entries; +- __u32 map_flags; +-} __attribute__((aligned(8))); +- +-/* User bpf_sock_ops struct to access socket values and specify request ops +- * and their replies. +- * Some of this fields are in network (bigendian) byte order and may need +- * to be converted before use (bpf_ntohl() defined in samples/bpf/bpf_endian.h). +- * New fields can only be added at the end of this structure +- */ +-struct bpf_sock_ops { +- __u32 op; +- union { +- __u32 reply; +- __u32 replylong[4]; +- }; +- __u32 family; +- __u32 remote_ip4; /* Stored in network byte order */ +- __u32 local_ip4; /* Stored in network byte order */ +- __u32 remote_ip6[4]; /* Stored in network byte order */ +- __u32 local_ip6[4]; /* Stored in network byte order */ +- __u32 remote_port; /* Stored in network byte order */ +- __u32 local_port; /* stored in host byte order */ +-}; +- +-/* List of known BPF sock_ops operators. +- * New entries can only be added at the end +- */ +-enum { +- BPF_SOCK_OPS_VOID, +- BPF_SOCK_OPS_TIMEOUT_INIT, /* Should return SYN-RTO value to use or +- * -1 if default value should be used +- */ +- BPF_SOCK_OPS_RWND_INIT, /* Should return initial advertized +- * window (in packets) or -1 if default +- * value should be used +- */ +- BPF_SOCK_OPS_TCP_CONNECT_CB, /* Calls BPF program right before an +- * active connection is initialized +- */ +- BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB, /* Calls BPF program when an +- * active connection is +- * established +- */ +- BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB, /* Calls BPF program when a +- * passive connection is +- * established +- */ +- BPF_SOCK_OPS_NEEDS_ECN, /* If connection's congestion control +- * needs ECN +- */ +-}; +- +-#define TCP_BPF_IW 1001 /* Set TCP initial congestion window */ +-#define TCP_BPF_SNDCWND_CLAMP 1002 /* Set sndcwnd_clamp */ +- +-#endif /* __LINUX_BPF_H__ */ +diff --git a/include/linux/bpf_common.h b/include/linux/bpf_common.h +deleted file mode 100644 +index afe7433..0000000 +--- a/include/linux/bpf_common.h ++++ /dev/null +@@ -1,55 +0,0 @@ +-#ifndef __LINUX_BPF_COMMON_H__ +-#define __LINUX_BPF_COMMON_H__ +- +-/* Instruction classes */ +-#define BPF_CLASS(code) ((code) & 0x07) +-#define BPF_LD 0x00 +-#define BPF_LDX 0x01 +-#define BPF_ST 0x02 +-#define BPF_STX 0x03 +-#define BPF_ALU 0x04 +-#define BPF_JMP 0x05 +-#define BPF_RET 0x06 +-#define BPF_MISC 0x07 +- +-/* ld/ldx fields */ +-#define BPF_SIZE(code) ((code) & 0x18) +-#define BPF_W 0x00 +-#define BPF_H 0x08 +-#define BPF_B 0x10 +-#define BPF_MODE(code) ((code) & 0xe0) +-#define BPF_IMM 0x00 +-#define BPF_ABS 0x20 +-#define BPF_IND 0x40 +-#define BPF_MEM 0x60 +-#define BPF_LEN 0x80 +-#define BPF_MSH 0xa0 +- +-/* alu/jmp fields */ +-#define BPF_OP(code) ((code) & 0xf0) +-#define BPF_ADD 0x00 +-#define BPF_SUB 0x10 +-#define BPF_MUL 0x20 +-#define BPF_DIV 0x30 +-#define BPF_OR 0x40 +-#define BPF_AND 0x50 +-#define BPF_LSH 0x60 +-#define BPF_RSH 0x70 +-#define BPF_NEG 0x80 +-#define BPF_MOD 0x90 +-#define BPF_XOR 0xa0 +- +-#define BPF_JA 0x00 +-#define BPF_JEQ 0x10 +-#define BPF_JGT 0x20 +-#define BPF_JGE 0x30 +-#define BPF_JSET 0x40 +-#define BPF_SRC(code) ((code) & 0x08) +-#define BPF_K 0x00 +-#define BPF_X 0x08 +- +-#ifndef BPF_MAXINSNS +-#define BPF_MAXINSNS 4096 +-#endif +- +-#endif /* __LINUX_BPF_COMMON_H__ */ +diff --git a/include/linux/can.h b/include/linux/can.h +deleted file mode 100644 +index f7a810d..0000000 +--- a/include/linux/can.h ++++ /dev/null +@@ -1,201 +0,0 @@ +-/* +- * linux/can.h +- * +- * Definitions for CAN network layer (socket addr / CAN frame / CAN filter) +- * +- * Authors: Oliver Hartkopp +- * Urs Thuermann +- * Copyright (c) 2002-2007 Volkswagen Group Electronic Research +- * All rights reserved. +- * +- * Redistribution and use in source and binary forms, with or without +- * modification, are permitted provided that the following conditions +- * are met: +- * 1. Redistributions of source code must retain the above copyright +- * notice, this list of conditions and the following disclaimer. +- * 2. Redistributions in binary form must reproduce the above copyright +- * notice, this list of conditions and the following disclaimer in the +- * documentation and/or other materials provided with the distribution. +- * 3. Neither the name of Volkswagen nor the names of its contributors +- * may be used to endorse or promote products derived from this software +- * without specific prior written permission. +- * +- * Alternatively, provided that this notice is retained in full, this +- * software may be distributed under the terms of the GNU General +- * Public License ("GPL") version 2, in which case the provisions of the +- * GPL apply INSTEAD OF those given above. +- * +- * The provided data structures and external interfaces from this code +- * are not restricted to be used by modules with a GPL compatible license. +- * +- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +- * DAMAGE. +- */ +- +-#ifndef _CAN_H +-#define _CAN_H +- +-#include +-#include +- +-/* controller area network (CAN) kernel definitions */ +- +-/* special address description flags for the CAN_ID */ +-#define CAN_EFF_FLAG 0x80000000U /* EFF/SFF is set in the MSB */ +-#define CAN_RTR_FLAG 0x40000000U /* remote transmission request */ +-#define CAN_ERR_FLAG 0x20000000U /* error message frame */ +- +-/* valid bits in CAN ID for frame formats */ +-#define CAN_SFF_MASK 0x000007FFU /* standard frame format (SFF) */ +-#define CAN_EFF_MASK 0x1FFFFFFFU /* extended frame format (EFF) */ +-#define CAN_ERR_MASK 0x1FFFFFFFU /* omit EFF, RTR, ERR flags */ +- +-/* +- * Controller Area Network Identifier structure +- * +- * bit 0-28 : CAN identifier (11/29 bit) +- * bit 29 : error message frame flag (0 = data frame, 1 = error message) +- * bit 30 : remote transmission request flag (1 = rtr frame) +- * bit 31 : frame format flag (0 = standard 11 bit, 1 = extended 29 bit) +- */ +-typedef __u32 canid_t; +- +-#define CAN_SFF_ID_BITS 11 +-#define CAN_EFF_ID_BITS 29 +- +-/* +- * Controller Area Network Error Message Frame Mask structure +- * +- * bit 0-28 : error class mask (see include/linux/can/error.h) +- * bit 29-31 : set to zero +- */ +-typedef __u32 can_err_mask_t; +- +-/* CAN payload length and DLC definitions according to ISO 11898-1 */ +-#define CAN_MAX_DLC 8 +-#define CAN_MAX_DLEN 8 +- +-/* CAN FD payload length and DLC definitions according to ISO 11898-7 */ +-#define CANFD_MAX_DLC 15 +-#define CANFD_MAX_DLEN 64 +- +-/** +- * struct can_frame - basic CAN frame structure +- * @can_id: CAN ID of the frame and CAN_*_FLAG flags, see canid_t definition +- * @can_dlc: frame payload length in byte (0 .. 8) aka data length code +- * N.B. the DLC field from ISO 11898-1 Chapter 8.4.2.3 has a 1:1 +- * mapping of the 'data length code' to the real payload length +- * @__pad: padding +- * @__res0: reserved / padding +- * @__res1: reserved / padding +- * @data: CAN frame payload (up to 8 byte) +- */ +-struct can_frame { +- canid_t can_id; /* 32 bit CAN_ID + EFF/RTR/ERR flags */ +- __u8 can_dlc; /* frame payload length in byte (0 .. CAN_MAX_DLEN) */ +- __u8 __pad; /* padding */ +- __u8 __res0; /* reserved / padding */ +- __u8 __res1; /* reserved / padding */ +- __u8 data[CAN_MAX_DLEN] __attribute__((aligned(8))); +-}; +- +-/* +- * defined bits for canfd_frame.flags +- * +- * The use of struct canfd_frame implies the Extended Data Length (EDL) bit to +- * be set in the CAN frame bitstream on the wire. The EDL bit switch turns +- * the CAN controllers bitstream processor into the CAN FD mode which creates +- * two new options within the CAN FD frame specification: +- * +- * Bit Rate Switch - to indicate a second bitrate is/was used for the payload +- * Error State Indicator - represents the error state of the transmitting node +- * +- * As the CANFD_ESI bit is internally generated by the transmitting CAN +- * controller only the CANFD_BRS bit is relevant for real CAN controllers when +- * building a CAN FD frame for transmission. Setting the CANFD_ESI bit can make +- * sense for virtual CAN interfaces to test applications with echoed frames. +- */ +-#define CANFD_BRS 0x01 /* bit rate switch (second bitrate for payload data) */ +-#define CANFD_ESI 0x02 /* error state indicator of the transmitting node */ +- +-/** +- * struct canfd_frame - CAN flexible data rate frame structure +- * @can_id: CAN ID of the frame and CAN_*_FLAG flags, see canid_t definition +- * @len: frame payload length in byte (0 .. CANFD_MAX_DLEN) +- * @flags: additional flags for CAN FD +- * @__res0: reserved / padding +- * @__res1: reserved / padding +- * @data: CAN FD frame payload (up to CANFD_MAX_DLEN byte) +- */ +-struct canfd_frame { +- canid_t can_id; /* 32 bit CAN_ID + EFF/RTR/ERR flags */ +- __u8 len; /* frame payload length in byte */ +- __u8 flags; /* additional flags for CAN FD */ +- __u8 __res0; /* reserved / padding */ +- __u8 __res1; /* reserved / padding */ +- __u8 data[CANFD_MAX_DLEN] __attribute__((aligned(8))); +-}; +- +-#define CAN_MTU (sizeof(struct can_frame)) +-#define CANFD_MTU (sizeof(struct canfd_frame)) +- +-/* particular protocols of the protocol family PF_CAN */ +-#define CAN_RAW 1 /* RAW sockets */ +-#define CAN_BCM 2 /* Broadcast Manager */ +-#define CAN_TP16 3 /* VAG Transport Protocol v1.6 */ +-#define CAN_TP20 4 /* VAG Transport Protocol v2.0 */ +-#define CAN_MCNET 5 /* Bosch MCNet */ +-#define CAN_ISOTP 6 /* ISO 15765-2 Transport Protocol */ +-#define CAN_NPROTO 7 +- +-#define SOL_CAN_BASE 100 +- +-/** +- * struct sockaddr_can - the sockaddr structure for CAN sockets +- * @can_family: address family number AF_CAN. +- * @can_ifindex: CAN network interface index. +- * @can_addr: protocol specific address information +- */ +-struct sockaddr_can { +- __kernel_sa_family_t can_family; +- int can_ifindex; +- union { +- /* transport protocol class address information (e.g. ISOTP) */ +- struct { canid_t rx_id, tx_id; } tp; +- +- /* reserved for future CAN protocols address information */ +- } can_addr; +-}; +- +-/** +- * struct can_filter - CAN ID based filter in can_register(). +- * @can_id: relevant bits of CAN ID which are not masked out. +- * @can_mask: CAN mask (see description) +- * +- * Description: +- * A filter matches, when +- * +- * & mask == can_id & mask +- * +- * The filter can be inverted (CAN_INV_FILTER bit set in can_id) or it can +- * filter for error message frames (CAN_ERR_FLAG bit set in mask). +- */ +-struct can_filter { +- canid_t can_id; +- canid_t can_mask; +-}; +- +-#define CAN_INV_FILTER 0x20000000U /* to be set in can_filter.can_id */ +-#define CAN_RAW_FILTER_MAX 512 /* maximum number of can_filter set via setsockopt() */ +- +-#endif /* !_UAPI_CAN_H */ +diff --git a/include/linux/can/netlink.h b/include/linux/can/netlink.h +deleted file mode 100644 +index b9214bd..0000000 +--- a/include/linux/can/netlink.h ++++ /dev/null +@@ -1,142 +0,0 @@ +-/* +- * linux/can/netlink.h +- * +- * Definitions for the CAN netlink interface +- * +- * Copyright (c) 2009 Wolfgang Grandegger +- * +- * This program is free software; you can redistribute it and/or modify +- * it under the terms of the version 2 of the GNU General Public License +- * as published by the Free Software Foundation +- * +- * This program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- */ +- +-#ifndef _CAN_NETLINK_H +-#define _CAN_NETLINK_H +- +-#include +- +-/* +- * CAN bit-timing parameters +- * +- * For further information, please read chapter "8 BIT TIMING +- * REQUIREMENTS" of the "Bosch CAN Specification version 2.0" +- * at http://www.semiconductors.bosch.de/pdf/can2spec.pdf. +- */ +-struct can_bittiming { +- __u32 bitrate; /* Bit-rate in bits/second */ +- __u32 sample_point; /* Sample point in one-tenth of a percent */ +- __u32 tq; /* Time quanta (TQ) in nanoseconds */ +- __u32 prop_seg; /* Propagation segment in TQs */ +- __u32 phase_seg1; /* Phase buffer segment 1 in TQs */ +- __u32 phase_seg2; /* Phase buffer segment 2 in TQs */ +- __u32 sjw; /* Synchronisation jump width in TQs */ +- __u32 brp; /* Bit-rate prescaler */ +-}; +- +-/* +- * CAN harware-dependent bit-timing constant +- * +- * Used for calculating and checking bit-timing parameters +- */ +-struct can_bittiming_const { +- char name[16]; /* Name of the CAN controller hardware */ +- __u32 tseg1_min; /* Time segement 1 = prop_seg + phase_seg1 */ +- __u32 tseg1_max; +- __u32 tseg2_min; /* Time segement 2 = phase_seg2 */ +- __u32 tseg2_max; +- __u32 sjw_max; /* Synchronisation jump width */ +- __u32 brp_min; /* Bit-rate prescaler */ +- __u32 brp_max; +- __u32 brp_inc; +-}; +- +-/* +- * CAN clock parameters +- */ +-struct can_clock { +- __u32 freq; /* CAN system clock frequency in Hz */ +-}; +- +-/* +- * CAN operational and error states +- */ +-enum can_state { +- CAN_STATE_ERROR_ACTIVE = 0, /* RX/TX error count < 96 */ +- CAN_STATE_ERROR_WARNING, /* RX/TX error count < 128 */ +- CAN_STATE_ERROR_PASSIVE, /* RX/TX error count < 256 */ +- CAN_STATE_BUS_OFF, /* RX/TX error count >= 256 */ +- CAN_STATE_STOPPED, /* Device is stopped */ +- CAN_STATE_SLEEPING, /* Device is sleeping */ +- CAN_STATE_MAX +-}; +- +-/* +- * CAN bus error counters +- */ +-struct can_berr_counter { +- __u16 txerr; +- __u16 rxerr; +-}; +- +-/* +- * CAN controller mode +- */ +-struct can_ctrlmode { +- __u32 mask; +- __u32 flags; +-}; +- +-#define CAN_CTRLMODE_LOOPBACK 0x01 /* Loopback mode */ +-#define CAN_CTRLMODE_LISTENONLY 0x02 /* Listen-only mode */ +-#define CAN_CTRLMODE_3_SAMPLES 0x04 /* Triple sampling mode */ +-#define CAN_CTRLMODE_ONE_SHOT 0x08 /* One-Shot mode */ +-#define CAN_CTRLMODE_BERR_REPORTING 0x10 /* Bus-error reporting */ +-#define CAN_CTRLMODE_FD 0x20 /* CAN FD mode */ +-#define CAN_CTRLMODE_PRESUME_ACK 0x40 /* Ignore missing CAN ACKs */ +-#define CAN_CTRLMODE_FD_NON_ISO 0x80 /* CAN FD in non-ISO mode */ +- +-/* +- * CAN device statistics +- */ +-struct can_device_stats { +- __u32 bus_error; /* Bus errors */ +- __u32 error_warning; /* Changes to error warning state */ +- __u32 error_passive; /* Changes to error passive state */ +- __u32 bus_off; /* Changes to bus off state */ +- __u32 arbitration_lost; /* Arbitration lost errors */ +- __u32 restarts; /* CAN controller re-starts */ +-}; +- +-/* +- * CAN netlink interface +- */ +-enum { +- IFLA_CAN_UNSPEC, +- IFLA_CAN_BITTIMING, +- IFLA_CAN_BITTIMING_CONST, +- IFLA_CAN_CLOCK, +- IFLA_CAN_STATE, +- IFLA_CAN_CTRLMODE, +- IFLA_CAN_RESTART_MS, +- IFLA_CAN_RESTART, +- IFLA_CAN_BERR_COUNTER, +- IFLA_CAN_DATA_BITTIMING, +- IFLA_CAN_DATA_BITTIMING_CONST, +- IFLA_CAN_TERMINATION, +- IFLA_CAN_TERMINATION_CONST, +- IFLA_CAN_BITRATE_CONST, +- IFLA_CAN_DATA_BITRATE_CONST, +- __IFLA_CAN_MAX +-}; +- +-#define IFLA_CAN_MAX (__IFLA_CAN_MAX - 1) +- +-/* u16 termination range: 1..65535 Ohms */ +-#define CAN_TERMINATION_DISABLED 0 +- +-#endif /* !_UAPI_CAN_NETLINK_H */ +diff --git a/include/linux/can/vxcan.h b/include/linux/can/vxcan.h +deleted file mode 100644 +index 5b29e8a..0000000 +--- a/include/linux/can/vxcan.h ++++ /dev/null +@@ -1,12 +0,0 @@ +-#ifndef _CAN_VXCAN_H +-#define _CAN_VXCAN_H +- +-enum { +- VXCAN_INFO_UNSPEC, +- VXCAN_INFO_PEER, +- +- __VXCAN_INFO_MAX +-#define VXCAN_INFO_MAX (__VXCAN_INFO_MAX - 1) +-}; +- +-#endif +diff --git a/include/linux/devlink.h b/include/linux/devlink.h +deleted file mode 100644 +index a62695e..0000000 +--- a/include/linux/devlink.h ++++ /dev/null +@@ -1,247 +0,0 @@ +-/* +- * include/uapi/linux/devlink.h - Network physical device Netlink interface +- * Copyright (c) 2016 Mellanox Technologies. All rights reserved. +- * Copyright (c) 2016 Jiri Pirko +- * +- * This program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2 of the License, or +- * (at your option) any later version. +- */ +- +-#ifndef _LINUX_DEVLINK_H_ +-#define _LINUX_DEVLINK_H_ +- +-#define DEVLINK_GENL_NAME "devlink" +-#define DEVLINK_GENL_VERSION 0x1 +-#define DEVLINK_GENL_MCGRP_CONFIG_NAME "config" +- +-enum devlink_command { +- /* don't change the order or add anything between, this is ABI! */ +- DEVLINK_CMD_UNSPEC, +- +- DEVLINK_CMD_GET, /* can dump */ +- DEVLINK_CMD_SET, +- DEVLINK_CMD_NEW, +- DEVLINK_CMD_DEL, +- +- DEVLINK_CMD_PORT_GET, /* can dump */ +- DEVLINK_CMD_PORT_SET, +- DEVLINK_CMD_PORT_NEW, +- DEVLINK_CMD_PORT_DEL, +- +- DEVLINK_CMD_PORT_SPLIT, +- DEVLINK_CMD_PORT_UNSPLIT, +- +- DEVLINK_CMD_SB_GET, /* can dump */ +- DEVLINK_CMD_SB_SET, +- DEVLINK_CMD_SB_NEW, +- DEVLINK_CMD_SB_DEL, +- +- DEVLINK_CMD_SB_POOL_GET, /* can dump */ +- DEVLINK_CMD_SB_POOL_SET, +- DEVLINK_CMD_SB_POOL_NEW, +- DEVLINK_CMD_SB_POOL_DEL, +- +- DEVLINK_CMD_SB_PORT_POOL_GET, /* can dump */ +- DEVLINK_CMD_SB_PORT_POOL_SET, +- DEVLINK_CMD_SB_PORT_POOL_NEW, +- DEVLINK_CMD_SB_PORT_POOL_DEL, +- +- DEVLINK_CMD_SB_TC_POOL_BIND_GET, /* can dump */ +- DEVLINK_CMD_SB_TC_POOL_BIND_SET, +- DEVLINK_CMD_SB_TC_POOL_BIND_NEW, +- DEVLINK_CMD_SB_TC_POOL_BIND_DEL, +- +- /* Shared buffer occupancy monitoring commands */ +- DEVLINK_CMD_SB_OCC_SNAPSHOT, +- DEVLINK_CMD_SB_OCC_MAX_CLEAR, +- +- DEVLINK_CMD_ESWITCH_GET, +-#define DEVLINK_CMD_ESWITCH_MODE_GET /* obsolete, never use this! */ \ +- DEVLINK_CMD_ESWITCH_GET +- +- DEVLINK_CMD_ESWITCH_SET, +-#define DEVLINK_CMD_ESWITCH_MODE_SET /* obsolete, never use this! */ \ +- DEVLINK_CMD_ESWITCH_SET +- +- DEVLINK_CMD_DPIPE_TABLE_GET, +- DEVLINK_CMD_DPIPE_ENTRIES_GET, +- DEVLINK_CMD_DPIPE_HEADERS_GET, +- DEVLINK_CMD_DPIPE_TABLE_COUNTERS_SET, +- +- /* add new commands above here */ +- __DEVLINK_CMD_MAX, +- DEVLINK_CMD_MAX = __DEVLINK_CMD_MAX - 1 +-}; +- +-enum devlink_port_type { +- DEVLINK_PORT_TYPE_NOTSET, +- DEVLINK_PORT_TYPE_AUTO, +- DEVLINK_PORT_TYPE_ETH, +- DEVLINK_PORT_TYPE_IB, +-}; +- +-enum devlink_sb_pool_type { +- DEVLINK_SB_POOL_TYPE_INGRESS, +- DEVLINK_SB_POOL_TYPE_EGRESS, +-}; +- +-/* static threshold - limiting the maximum number of bytes. +- * dynamic threshold - limiting the maximum number of bytes +- * based on the currently available free space in the shared buffer pool. +- * In this mode, the maximum quota is calculated based +- * on the following formula: +- * max_quota = alpha / (1 + alpha) * Free_Buffer +- * While Free_Buffer is the amount of none-occupied buffer associated to +- * the relevant pool. +- * The value range which can be passed is 0-20 and serves +- * for computation of alpha by following formula: +- * alpha = 2 ^ (passed_value - 10) +- */ +- +-enum devlink_sb_threshold_type { +- DEVLINK_SB_THRESHOLD_TYPE_STATIC, +- DEVLINK_SB_THRESHOLD_TYPE_DYNAMIC, +-}; +- +-#define DEVLINK_SB_THRESHOLD_TO_ALPHA_MAX 20 +- +-enum devlink_eswitch_mode { +- DEVLINK_ESWITCH_MODE_LEGACY, +- DEVLINK_ESWITCH_MODE_SWITCHDEV, +-}; +- +-enum devlink_eswitch_inline_mode { +- DEVLINK_ESWITCH_INLINE_MODE_NONE, +- DEVLINK_ESWITCH_INLINE_MODE_LINK, +- DEVLINK_ESWITCH_INLINE_MODE_NETWORK, +- DEVLINK_ESWITCH_INLINE_MODE_TRANSPORT, +-}; +- +-enum devlink_eswitch_encap_mode { +- DEVLINK_ESWITCH_ENCAP_MODE_NONE, +- DEVLINK_ESWITCH_ENCAP_MODE_BASIC, +-}; +- +-enum devlink_attr { +- /* don't change the order or add anything between, this is ABI! */ +- DEVLINK_ATTR_UNSPEC, +- +- /* bus name + dev name together are a handle for devlink entity */ +- DEVLINK_ATTR_BUS_NAME, /* string */ +- DEVLINK_ATTR_DEV_NAME, /* string */ +- +- DEVLINK_ATTR_PORT_INDEX, /* u32 */ +- DEVLINK_ATTR_PORT_TYPE, /* u16 */ +- DEVLINK_ATTR_PORT_DESIRED_TYPE, /* u16 */ +- DEVLINK_ATTR_PORT_NETDEV_IFINDEX, /* u32 */ +- DEVLINK_ATTR_PORT_NETDEV_NAME, /* string */ +- DEVLINK_ATTR_PORT_IBDEV_NAME, /* string */ +- DEVLINK_ATTR_PORT_SPLIT_COUNT, /* u32 */ +- DEVLINK_ATTR_PORT_SPLIT_GROUP, /* u32 */ +- DEVLINK_ATTR_SB_INDEX, /* u32 */ +- DEVLINK_ATTR_SB_SIZE, /* u32 */ +- DEVLINK_ATTR_SB_INGRESS_POOL_COUNT, /* u16 */ +- DEVLINK_ATTR_SB_EGRESS_POOL_COUNT, /* u16 */ +- DEVLINK_ATTR_SB_INGRESS_TC_COUNT, /* u16 */ +- DEVLINK_ATTR_SB_EGRESS_TC_COUNT, /* u16 */ +- DEVLINK_ATTR_SB_POOL_INDEX, /* u16 */ +- DEVLINK_ATTR_SB_POOL_TYPE, /* u8 */ +- DEVLINK_ATTR_SB_POOL_SIZE, /* u32 */ +- DEVLINK_ATTR_SB_POOL_THRESHOLD_TYPE, /* u8 */ +- DEVLINK_ATTR_SB_THRESHOLD, /* u32 */ +- DEVLINK_ATTR_SB_TC_INDEX, /* u16 */ +- DEVLINK_ATTR_SB_OCC_CUR, /* u32 */ +- DEVLINK_ATTR_SB_OCC_MAX, /* u32 */ +- DEVLINK_ATTR_ESWITCH_MODE, /* u16 */ +- DEVLINK_ATTR_ESWITCH_INLINE_MODE, /* u8 */ +- +- DEVLINK_ATTR_DPIPE_TABLES, /* nested */ +- DEVLINK_ATTR_DPIPE_TABLE, /* nested */ +- DEVLINK_ATTR_DPIPE_TABLE_NAME, /* string */ +- DEVLINK_ATTR_DPIPE_TABLE_SIZE, /* u64 */ +- DEVLINK_ATTR_DPIPE_TABLE_MATCHES, /* nested */ +- DEVLINK_ATTR_DPIPE_TABLE_ACTIONS, /* nested */ +- DEVLINK_ATTR_DPIPE_TABLE_COUNTERS_ENABLED, /* u8 */ +- +- DEVLINK_ATTR_DPIPE_ENTRIES, /* nested */ +- DEVLINK_ATTR_DPIPE_ENTRY, /* nested */ +- DEVLINK_ATTR_DPIPE_ENTRY_INDEX, /* u64 */ +- DEVLINK_ATTR_DPIPE_ENTRY_MATCH_VALUES, /* nested */ +- DEVLINK_ATTR_DPIPE_ENTRY_ACTION_VALUES, /* nested */ +- DEVLINK_ATTR_DPIPE_ENTRY_COUNTER, /* u64 */ +- +- DEVLINK_ATTR_DPIPE_MATCH, /* nested */ +- DEVLINK_ATTR_DPIPE_MATCH_VALUE, /* nested */ +- DEVLINK_ATTR_DPIPE_MATCH_TYPE, /* u32 */ +- +- DEVLINK_ATTR_DPIPE_ACTION, /* nested */ +- DEVLINK_ATTR_DPIPE_ACTION_VALUE, /* nested */ +- DEVLINK_ATTR_DPIPE_ACTION_TYPE, /* u32 */ +- +- DEVLINK_ATTR_DPIPE_VALUE, +- DEVLINK_ATTR_DPIPE_VALUE_MASK, +- DEVLINK_ATTR_DPIPE_VALUE_MAPPING, /* u32 */ +- +- DEVLINK_ATTR_DPIPE_HEADERS, /* nested */ +- DEVLINK_ATTR_DPIPE_HEADER, /* nested */ +- DEVLINK_ATTR_DPIPE_HEADER_NAME, /* string */ +- DEVLINK_ATTR_DPIPE_HEADER_ID, /* u32 */ +- DEVLINK_ATTR_DPIPE_HEADER_FIELDS, /* nested */ +- DEVLINK_ATTR_DPIPE_HEADER_GLOBAL, /* u8 */ +- DEVLINK_ATTR_DPIPE_HEADER_INDEX, /* u32 */ +- +- DEVLINK_ATTR_DPIPE_FIELD, /* nested */ +- DEVLINK_ATTR_DPIPE_FIELD_NAME, /* string */ +- DEVLINK_ATTR_DPIPE_FIELD_ID, /* u32 */ +- DEVLINK_ATTR_DPIPE_FIELD_BITWIDTH, /* u32 */ +- DEVLINK_ATTR_DPIPE_FIELD_MAPPING_TYPE, /* u32 */ +- +- DEVLINK_ATTR_PAD, +- +- DEVLINK_ATTR_ESWITCH_ENCAP_MODE, /* u8 */ +- +- /* add new attributes above here, update the policy in devlink.c */ +- +- __DEVLINK_ATTR_MAX, +- DEVLINK_ATTR_MAX = __DEVLINK_ATTR_MAX - 1 +-}; +- +-/* Mapping between internal resource described by the field and system +- * structure +- */ +-enum devlink_dpipe_field_mapping_type { +- DEVLINK_DPIPE_FIELD_MAPPING_TYPE_NONE, +- DEVLINK_DPIPE_FIELD_MAPPING_TYPE_IFINDEX, +-}; +- +-/* Match type - specify the type of the match */ +-enum devlink_dpipe_match_type { +- DEVLINK_DPIPE_MATCH_TYPE_FIELD_EXACT, +-}; +- +-/* Action type - specify the action type */ +-enum devlink_dpipe_action_type { +- DEVLINK_DPIPE_ACTION_TYPE_FIELD_MODIFY, +-}; +- +-enum devlink_dpipe_field_ethernet_id { +- DEVLINK_DPIPE_FIELD_ETHERNET_DST_MAC, +-}; +- +-enum devlink_dpipe_field_ipv4_id { +- DEVLINK_DPIPE_FIELD_IPV4_DST_IP, +-}; +- +-enum devlink_dpipe_field_ipv6_id { +- DEVLINK_DPIPE_FIELD_IPV6_DST_IP, +-}; +- +-enum devlink_dpipe_header_id { +- DEVLINK_DPIPE_HEADER_ETHERNET, +- DEVLINK_DPIPE_HEADER_IPV4, +- DEVLINK_DPIPE_HEADER_IPV6, +-}; +- +-#endif /* _LINUX_DEVLINK_H_ */ +diff --git a/include/linux/elf-em.h b/include/linux/elf-em.h +deleted file mode 100644 +index 9cd1de9..0000000 +--- a/include/linux/elf-em.h ++++ /dev/null +@@ -1,60 +0,0 @@ +-#ifndef _LINUX_ELF_EM_H +-#define _LINUX_ELF_EM_H +- +-/* These constants define the various ELF target machines */ +-#define EM_NONE 0 +-#define EM_M32 1 +-#define EM_SPARC 2 +-#define EM_386 3 +-#define EM_68K 4 +-#define EM_88K 5 +-#define EM_486 6 /* Perhaps disused */ +-#define EM_860 7 +-#define EM_MIPS 8 /* MIPS R3000 (officially, big-endian only) */ +- /* Next two are historical and binaries and +- modules of these types will be rejected by +- Linux. */ +-#define EM_MIPS_RS3_LE 10 /* MIPS R3000 little-endian */ +-#define EM_MIPS_RS4_BE 10 /* MIPS R4000 big-endian */ +- +-#define EM_PARISC 15 /* HPPA */ +-#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */ +-#define EM_PPC 20 /* PowerPC */ +-#define EM_PPC64 21 /* PowerPC64 */ +-#define EM_SPU 23 /* Cell BE SPU */ +-#define EM_ARM 40 /* ARM 32 bit */ +-#define EM_SH 42 /* SuperH */ +-#define EM_SPARCV9 43 /* SPARC v9 64-bit */ +-#define EM_H8_300 46 /* Renesas H8/300 */ +-#define EM_IA_64 50 /* HP/Intel IA-64 */ +-#define EM_X86_64 62 /* AMD x86-64 */ +-#define EM_S390 22 /* IBM S/390 */ +-#define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */ +-#define EM_M32R 88 /* Renesas M32R */ +-#define EM_MN10300 89 /* Panasonic/MEI MN10300, AM33 */ +-#define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */ +-#define EM_BLACKFIN 106 /* ADI Blackfin Processor */ +-#define EM_ALTERA_NIOS2 113 /* Altera Nios II soft-core processor */ +-#define EM_TI_C6000 140 /* TI C6X DSPs */ +-#define EM_AARCH64 183 /* ARM 64 bit */ +-#define EM_TILEPRO 188 /* Tilera TILEPro */ +-#define EM_MICROBLAZE 189 /* Xilinx MicroBlaze */ +-#define EM_TILEGX 191 /* Tilera TILE-Gx */ +-#define EM_BPF 247 /* Linux BPF - in-kernel virtual machine */ +-#define EM_FRV 0x5441 /* Fujitsu FR-V */ +- +-/* +- * This is an interim value that we will use until the committee comes +- * up with a final number. +- */ +-#define EM_ALPHA 0x9026 +- +-/* Bogus old m32r magic number, used by old tools. */ +-#define EM_CYGNUS_M32R 0x9041 +-/* This is the old interim value for S/390 architecture */ +-#define EM_S390_OLD 0xA390 +-/* Also Panasonic/MEI MN10300, AM33 */ +-#define EM_CYGNUS_MN10300 0xbeef +- +- +-#endif /* _LINUX_ELF_EM_H */ +diff --git a/include/linux/fib_rules.h b/include/linux/fib_rules.h +deleted file mode 100644 +index bbf02a6..0000000 +--- a/include/linux/fib_rules.h ++++ /dev/null +@@ -1,80 +0,0 @@ +-#ifndef __LINUX_FIB_RULES_H +-#define __LINUX_FIB_RULES_H +- +-#include +-#include +- +-/* rule is permanent, and cannot be deleted */ +-#define FIB_RULE_PERMANENT 0x00000001 +-#define FIB_RULE_INVERT 0x00000002 +-#define FIB_RULE_UNRESOLVED 0x00000004 +-#define FIB_RULE_IIF_DETACHED 0x00000008 +-#define FIB_RULE_DEV_DETACHED FIB_RULE_IIF_DETACHED +-#define FIB_RULE_OIF_DETACHED 0x00000010 +- +-/* try to find source address in routing lookups */ +-#define FIB_RULE_FIND_SADDR 0x00010000 +- +-struct fib_rule_hdr { +- __u8 family; +- __u8 dst_len; +- __u8 src_len; +- __u8 tos; +- +- __u8 table; +- __u8 res1; /* reserved */ +- __u8 res2; /* reserved */ +- __u8 action; +- +- __u32 flags; +-}; +- +-struct fib_rule_uid_range { +- __u32 start; +- __u32 end; +-}; +- +-enum { +- FRA_UNSPEC, +- FRA_DST, /* destination address */ +- FRA_SRC, /* source address */ +- FRA_IIFNAME, /* interface name */ +-#define FRA_IFNAME FRA_IIFNAME +- FRA_GOTO, /* target to jump to (FR_ACT_GOTO) */ +- FRA_UNUSED2, +- FRA_PRIORITY, /* priority/preference */ +- FRA_UNUSED3, +- FRA_UNUSED4, +- FRA_UNUSED5, +- FRA_FWMARK, /* mark */ +- FRA_FLOW, /* flow/class id */ +- FRA_TUN_ID, +- FRA_SUPPRESS_IFGROUP, +- FRA_SUPPRESS_PREFIXLEN, +- FRA_TABLE, /* Extended table id */ +- FRA_FWMASK, /* mask for netfilter mark */ +- FRA_OIFNAME, +- FRA_PAD, +- FRA_L3MDEV, /* iif or oif is l3mdev goto its table */ +- FRA_UID_RANGE, /* UID range */ +- __FRA_MAX +-}; +- +-#define FRA_MAX (__FRA_MAX - 1) +- +-enum { +- FR_ACT_UNSPEC, +- FR_ACT_TO_TBL, /* Pass to fixed table */ +- FR_ACT_GOTO, /* Jump to another rule */ +- FR_ACT_NOP, /* No operation */ +- FR_ACT_RES3, +- FR_ACT_RES4, +- FR_ACT_BLACKHOLE, /* Drop without notification */ +- FR_ACT_UNREACHABLE, /* Drop with ENETUNREACH */ +- FR_ACT_PROHIBIT, /* Drop with EACCES */ +- __FR_ACT_MAX, +-}; +- +-#define FR_ACT_MAX (__FR_ACT_MAX - 1) +- +-#endif +diff --git a/include/linux/filter.h b/include/linux/filter.h +deleted file mode 100644 +index e4f2f74..0000000 +--- a/include/linux/filter.h ++++ /dev/null +@@ -1,89 +0,0 @@ +-/* +- * Linux Socket Filter Data Structures +- */ +- +-#ifndef __LINUX_FILTER_H__ +-#define __LINUX_FILTER_H__ +- +- +-#include +-#include +- +-/* +- * Current version of the filter code architecture. +- */ +-#define BPF_MAJOR_VERSION 1 +-#define BPF_MINOR_VERSION 1 +- +-/* +- * Try and keep these values and structures similar to BSD, especially +- * the BPF code definitions which need to match so you can share filters +- */ +- +-struct sock_filter { /* Filter block */ +- __u16 code; /* Actual filter code */ +- __u8 jt; /* Jump true */ +- __u8 jf; /* Jump false */ +- __u32 k; /* Generic multiuse field */ +-}; +- +-struct sock_fprog { /* Required for SO_ATTACH_FILTER. */ +- unsigned short len; /* Number of filter blocks */ +- struct sock_filter *filter; +-}; +- +-/* ret - BPF_K and BPF_X also apply */ +-#define BPF_RVAL(code) ((code) & 0x18) +-#define BPF_A 0x10 +- +-/* misc */ +-#define BPF_MISCOP(code) ((code) & 0xf8) +-#define BPF_TAX 0x00 +-#define BPF_TXA 0x80 +- +-/* +- * Macros for filter block array initializers. +- */ +-#ifndef BPF_STMT +-#define BPF_STMT(code, k) { (unsigned short)(code), 0, 0, k } +-#endif +-#ifndef BPF_JUMP +-#define BPF_JUMP(code, k, jt, jf) { (unsigned short)(code), jt, jf, k } +-#endif +- +-/* +- * Number of scratch memory words for: BPF_ST and BPF_STX +- */ +-#define BPF_MEMWORDS 16 +- +-/* RATIONALE. Negative offsets are invalid in BPF. +- We use them to reference ancillary data. +- Unlike introduction new instructions, it does not break +- existing compilers/optimizers. +- */ +-#define SKF_AD_OFF (-0x1000) +-#define SKF_AD_PROTOCOL 0 +-#define SKF_AD_PKTTYPE 4 +-#define SKF_AD_IFINDEX 8 +-#define SKF_AD_NLATTR 12 +-#define SKF_AD_NLATTR_NEST 16 +-#define SKF_AD_MARK 20 +-#define SKF_AD_QUEUE 24 +-#define SKF_AD_HATYPE 28 +-#define SKF_AD_RXHASH 32 +-#define SKF_AD_CPU 36 +-#define SKF_AD_ALU_XOR_X 40 +-#define SKF_AD_VLAN_TAG 44 +-#define SKF_AD_VLAN_TAG_PRESENT 48 +-#define SKF_AD_PAY_OFFSET 52 +-#define SKF_AD_RANDOM 56 +-#define SKF_AD_VLAN_TPID 60 +-#define SKF_AD_MAX 64 +- +-#define SKF_NET_OFF (-0x100000) +-#define SKF_LL_OFF (-0x200000) +- +-#define BPF_NET_OFF SKF_NET_OFF +-#define BPF_LL_OFF SKF_LL_OFF +- +-#endif /* __LINUX_FILTER_H__ */ +diff --git a/include/linux/fou.h b/include/linux/fou.h +deleted file mode 100644 +index 744c323..0000000 +--- a/include/linux/fou.h ++++ /dev/null +@@ -1,41 +0,0 @@ +-/* fou.h - FOU Interface */ +- +-#ifndef _LINUX_FOU_H +-#define _LINUX_FOU_H +- +-/* NETLINK_GENERIC related info +- */ +-#define FOU_GENL_NAME "fou" +-#define FOU_GENL_VERSION 0x1 +- +-enum { +- FOU_ATTR_UNSPEC, +- FOU_ATTR_PORT, /* u16 */ +- FOU_ATTR_AF, /* u8 */ +- FOU_ATTR_IPPROTO, /* u8 */ +- FOU_ATTR_TYPE, /* u8 */ +- FOU_ATTR_REMCSUM_NOPARTIAL, /* flag */ +- +- __FOU_ATTR_MAX, +-}; +- +-#define FOU_ATTR_MAX (__FOU_ATTR_MAX - 1) +- +-enum { +- FOU_CMD_UNSPEC, +- FOU_CMD_ADD, +- FOU_CMD_DEL, +- FOU_CMD_GET, +- +- __FOU_CMD_MAX, +-}; +- +-enum { +- FOU_ENCAP_UNSPEC, +- FOU_ENCAP_DIRECT, +- FOU_ENCAP_GUE, +-}; +- +-#define FOU_CMD_MAX (__FOU_CMD_MAX - 1) +- +-#endif /* _LINUX_FOU_H */ +diff --git a/include/linux/gen_stats.h b/include/linux/gen_stats.h +deleted file mode 100644 +index 52deccc..0000000 +--- a/include/linux/gen_stats.h ++++ /dev/null +@@ -1,79 +0,0 @@ +-#ifndef __LINUX_GEN_STATS_H +-#define __LINUX_GEN_STATS_H +- +-#include +- +-enum { +- TCA_STATS_UNSPEC, +- TCA_STATS_BASIC, +- TCA_STATS_RATE_EST, +- TCA_STATS_QUEUE, +- TCA_STATS_APP, +- TCA_STATS_RATE_EST64, +- TCA_STATS_PAD, +- __TCA_STATS_MAX, +-}; +-#define TCA_STATS_MAX (__TCA_STATS_MAX - 1) +- +-/** +- * struct gnet_stats_basic - byte/packet throughput statistics +- * @bytes: number of seen bytes +- * @packets: number of seen packets +- */ +-struct gnet_stats_basic { +- __u64 bytes; +- __u32 packets; +-}; +-struct gnet_stats_basic_packed { +- __u64 bytes; +- __u32 packets; +-} __attribute__ ((packed)); +- +-/** +- * struct gnet_stats_rate_est - rate estimator +- * @bps: current byte rate +- * @pps: current packet rate +- */ +-struct gnet_stats_rate_est { +- __u32 bps; +- __u32 pps; +-}; +- +-/** +- * struct gnet_stats_rate_est64 - rate estimator +- * @bps: current byte rate +- * @pps: current packet rate +- */ +-struct gnet_stats_rate_est64 { +- __u64 bps; +- __u64 pps; +-}; +- +-/** +- * struct gnet_stats_queue - queuing statistics +- * @qlen: queue length +- * @backlog: backlog size of queue +- * @drops: number of dropped packets +- * @requeues: number of requeues +- * @overlimits: number of enqueues over the limit +- */ +-struct gnet_stats_queue { +- __u32 qlen; +- __u32 backlog; +- __u32 drops; +- __u32 requeues; +- __u32 overlimits; +-}; +- +-/** +- * struct gnet_estimator - rate estimator configuration +- * @interval: sampling period +- * @ewma_log: the log of measurement window weight +- */ +-struct gnet_estimator { +- signed char interval; +- unsigned char ewma_log; +-}; +- +- +-#endif /* __LINUX_GEN_STATS_H */ +diff --git a/include/linux/genetlink.h b/include/linux/genetlink.h +deleted file mode 100644 +index 08239d8..0000000 +--- a/include/linux/genetlink.h ++++ /dev/null +@@ -1,88 +0,0 @@ +-#ifndef __LINUX_GENERIC_NETLINK_H +-#define __LINUX_GENERIC_NETLINK_H +- +-#include +-#include +- +-#define GENL_NAMSIZ 16 /* length of family name */ +- +-#define GENL_MIN_ID NLMSG_MIN_TYPE +-#define GENL_MAX_ID 1023 +- +-struct genlmsghdr { +- __u8 cmd; +- __u8 version; +- __u16 reserved; +-}; +- +-#define GENL_HDRLEN NLMSG_ALIGN(sizeof(struct genlmsghdr)) +- +-#define GENL_ADMIN_PERM 0x01 +-#define GENL_CMD_CAP_DO 0x02 +-#define GENL_CMD_CAP_DUMP 0x04 +-#define GENL_CMD_CAP_HASPOL 0x08 +-#define GENL_UNS_ADMIN_PERM 0x10 +- +-/* +- * List of reserved static generic netlink identifiers: +- */ +-#define GENL_ID_CTRL NLMSG_MIN_TYPE +-#define GENL_ID_VFS_DQUOT (NLMSG_MIN_TYPE + 1) +-#define GENL_ID_PMCRAID (NLMSG_MIN_TYPE + 2) +-/* must be last reserved + 1 */ +-#define GENL_START_ALLOC (NLMSG_MIN_TYPE + 3) +- +-/************************************************************************** +- * Controller +- **************************************************************************/ +- +-enum { +- CTRL_CMD_UNSPEC, +- CTRL_CMD_NEWFAMILY, +- CTRL_CMD_DELFAMILY, +- CTRL_CMD_GETFAMILY, +- CTRL_CMD_NEWOPS, +- CTRL_CMD_DELOPS, +- CTRL_CMD_GETOPS, +- CTRL_CMD_NEWMCAST_GRP, +- CTRL_CMD_DELMCAST_GRP, +- CTRL_CMD_GETMCAST_GRP, /* unused */ +- __CTRL_CMD_MAX, +-}; +- +-#define CTRL_CMD_MAX (__CTRL_CMD_MAX - 1) +- +-enum { +- CTRL_ATTR_UNSPEC, +- CTRL_ATTR_FAMILY_ID, +- CTRL_ATTR_FAMILY_NAME, +- CTRL_ATTR_VERSION, +- CTRL_ATTR_HDRSIZE, +- CTRL_ATTR_MAXATTR, +- CTRL_ATTR_OPS, +- CTRL_ATTR_MCAST_GROUPS, +- __CTRL_ATTR_MAX, +-}; +- +-#define CTRL_ATTR_MAX (__CTRL_ATTR_MAX - 1) +- +-enum { +- CTRL_ATTR_OP_UNSPEC, +- CTRL_ATTR_OP_ID, +- CTRL_ATTR_OP_FLAGS, +- __CTRL_ATTR_OP_MAX, +-}; +- +-#define CTRL_ATTR_OP_MAX (__CTRL_ATTR_OP_MAX - 1) +- +-enum { +- CTRL_ATTR_MCAST_GRP_UNSPEC, +- CTRL_ATTR_MCAST_GRP_NAME, +- CTRL_ATTR_MCAST_GRP_ID, +- __CTRL_ATTR_MCAST_GRP_MAX, +-}; +- +-#define CTRL_ATTR_MCAST_GRP_MAX (__CTRL_ATTR_MCAST_GRP_MAX - 1) +- +- +-#endif /* __LINUX_GENERIC_NETLINK_H */ +diff --git a/include/linux/hdlc/ioctl.h b/include/linux/hdlc/ioctl.h +deleted file mode 100644 +index 04bc027..0000000 +--- a/include/linux/hdlc/ioctl.h ++++ /dev/null +@@ -1,84 +0,0 @@ +-#ifndef __HDLC_IOCTL_H__ +-#define __HDLC_IOCTL_H__ +- +- +-#define GENERIC_HDLC_VERSION 4 /* For synchronization with sethdlc utility */ +- +-#define CLOCK_DEFAULT 0 /* Default setting */ +-#define CLOCK_EXT 1 /* External TX and RX clock - DTE */ +-#define CLOCK_INT 2 /* Internal TX and RX clock - DCE */ +-#define CLOCK_TXINT 3 /* Internal TX and external RX clock */ +-#define CLOCK_TXFROMRX 4 /* TX clock derived from external RX clock */ +- +- +-#define ENCODING_DEFAULT 0 /* Default setting */ +-#define ENCODING_NRZ 1 +-#define ENCODING_NRZI 2 +-#define ENCODING_FM_MARK 3 +-#define ENCODING_FM_SPACE 4 +-#define ENCODING_MANCHESTER 5 +- +- +-#define PARITY_DEFAULT 0 /* Default setting */ +-#define PARITY_NONE 1 /* No parity */ +-#define PARITY_CRC16_PR0 2 /* CRC16, initial value 0x0000 */ +-#define PARITY_CRC16_PR1 3 /* CRC16, initial value 0xFFFF */ +-#define PARITY_CRC16_PR0_CCITT 4 /* CRC16, initial 0x0000, ITU-T version */ +-#define PARITY_CRC16_PR1_CCITT 5 /* CRC16, initial 0xFFFF, ITU-T version */ +-#define PARITY_CRC32_PR0_CCITT 6 /* CRC32, initial value 0x00000000 */ +-#define PARITY_CRC32_PR1_CCITT 7 /* CRC32, initial value 0xFFFFFFFF */ +- +-#define LMI_DEFAULT 0 /* Default setting */ +-#define LMI_NONE 1 /* No LMI, all PVCs are static */ +-#define LMI_ANSI 2 /* ANSI Annex D */ +-#define LMI_CCITT 3 /* ITU-T Annex A */ +-#define LMI_CISCO 4 /* The "original" LMI, aka Gang of Four */ +- +-#ifndef __ASSEMBLY__ +- +-typedef struct { +- unsigned int clock_rate; /* bits per second */ +- unsigned int clock_type; /* internal, external, TX-internal etc. */ +- unsigned short loopback; +-} sync_serial_settings; /* V.35, V.24, X.21 */ +- +-typedef struct { +- unsigned int clock_rate; /* bits per second */ +- unsigned int clock_type; /* internal, external, TX-internal etc. */ +- unsigned short loopback; +- unsigned int slot_map; +-} te1_settings; /* T1, E1 */ +- +-typedef struct { +- unsigned short encoding; +- unsigned short parity; +-} raw_hdlc_proto; +- +-typedef struct { +- unsigned int t391; +- unsigned int t392; +- unsigned int n391; +- unsigned int n392; +- unsigned int n393; +- unsigned short lmi; +- unsigned short dce; /* 1 for DCE (network side) operation */ +-} fr_proto; +- +-typedef struct { +- unsigned int dlci; +-} fr_proto_pvc; /* for creating/deleting FR PVCs */ +- +-typedef struct { +- unsigned int dlci; +- char master[IFNAMSIZ]; /* Name of master FRAD device */ +-}fr_proto_pvc_info; /* for returning PVC information only */ +- +-typedef struct { +- unsigned int interval; +- unsigned int timeout; +-} cisco_proto; +- +-/* PPP doesn't need any info now - supply length = 0 to ioctl */ +- +-#endif /* __ASSEMBLY__ */ +-#endif /* __HDLC_IOCTL_H__ */ +diff --git a/include/linux/icmpv6.h b/include/linux/icmpv6.h +deleted file mode 100644 +index a2e839e..0000000 +--- a/include/linux/icmpv6.h ++++ /dev/null +@@ -1,166 +0,0 @@ +-#ifndef _LINUX_ICMPV6_H +-#define _LINUX_ICMPV6_H +- +-#include +-#include +- +-struct icmp6hdr { +- +- __u8 icmp6_type; +- __u8 icmp6_code; +- __sum16 icmp6_cksum; +- +- +- union { +- __be32 un_data32[1]; +- __be16 un_data16[2]; +- __u8 un_data8[4]; +- +- struct icmpv6_echo { +- __be16 identifier; +- __be16 sequence; +- } u_echo; +- +- struct icmpv6_nd_advt { +-#if defined(__LITTLE_ENDIAN_BITFIELD) +- __u32 reserved:5, +- override:1, +- solicited:1, +- router:1, +- reserved2:24; +-#elif defined(__BIG_ENDIAN_BITFIELD) +- __u32 router:1, +- solicited:1, +- override:1, +- reserved:29; +-#else +-#error "Please fix " +-#endif +- } u_nd_advt; +- +- struct icmpv6_nd_ra { +- __u8 hop_limit; +-#if defined(__LITTLE_ENDIAN_BITFIELD) +- __u8 reserved:3, +- router_pref:2, +- home_agent:1, +- other:1, +- managed:1; +- +-#elif defined(__BIG_ENDIAN_BITFIELD) +- __u8 managed:1, +- other:1, +- home_agent:1, +- router_pref:2, +- reserved:3; +-#else +-#error "Please fix " +-#endif +- __be16 rt_lifetime; +- } u_nd_ra; +- +- } icmp6_dataun; +- +-#define icmp6_identifier icmp6_dataun.u_echo.identifier +-#define icmp6_sequence icmp6_dataun.u_echo.sequence +-#define icmp6_pointer icmp6_dataun.un_data32[0] +-#define icmp6_mtu icmp6_dataun.un_data32[0] +-#define icmp6_unused icmp6_dataun.un_data32[0] +-#define icmp6_maxdelay icmp6_dataun.un_data16[0] +-#define icmp6_router icmp6_dataun.u_nd_advt.router +-#define icmp6_solicited icmp6_dataun.u_nd_advt.solicited +-#define icmp6_override icmp6_dataun.u_nd_advt.override +-#define icmp6_ndiscreserved icmp6_dataun.u_nd_advt.reserved +-#define icmp6_hop_limit icmp6_dataun.u_nd_ra.hop_limit +-#define icmp6_addrconf_managed icmp6_dataun.u_nd_ra.managed +-#define icmp6_addrconf_other icmp6_dataun.u_nd_ra.other +-#define icmp6_rt_lifetime icmp6_dataun.u_nd_ra.rt_lifetime +-#define icmp6_router_pref icmp6_dataun.u_nd_ra.router_pref +-}; +- +- +-#define ICMPV6_ROUTER_PREF_LOW 0x3 +-#define ICMPV6_ROUTER_PREF_MEDIUM 0x0 +-#define ICMPV6_ROUTER_PREF_HIGH 0x1 +-#define ICMPV6_ROUTER_PREF_INVALID 0x2 +- +-#define ICMPV6_DEST_UNREACH 1 +-#define ICMPV6_PKT_TOOBIG 2 +-#define ICMPV6_TIME_EXCEED 3 +-#define ICMPV6_PARAMPROB 4 +- +-#define ICMPV6_INFOMSG_MASK 0x80 +- +-#define ICMPV6_ECHO_REQUEST 128 +-#define ICMPV6_ECHO_REPLY 129 +-#define ICMPV6_MGM_QUERY 130 +-#define ICMPV6_MGM_REPORT 131 +-#define ICMPV6_MGM_REDUCTION 132 +- +-#define ICMPV6_NI_QUERY 139 +-#define ICMPV6_NI_REPLY 140 +- +-#define ICMPV6_MLD2_REPORT 143 +- +-#define ICMPV6_DHAAD_REQUEST 144 +-#define ICMPV6_DHAAD_REPLY 145 +-#define ICMPV6_MOBILE_PREFIX_SOL 146 +-#define ICMPV6_MOBILE_PREFIX_ADV 147 +- +-/* +- * Codes for Destination Unreachable +- */ +-#define ICMPV6_NOROUTE 0 +-#define ICMPV6_ADM_PROHIBITED 1 +-#define ICMPV6_NOT_NEIGHBOUR 2 +-#define ICMPV6_ADDR_UNREACH 3 +-#define ICMPV6_PORT_UNREACH 4 +-#define ICMPV6_POLICY_FAIL 5 +-#define ICMPV6_REJECT_ROUTE 6 +- +-/* +- * Codes for Time Exceeded +- */ +-#define ICMPV6_EXC_HOPLIMIT 0 +-#define ICMPV6_EXC_FRAGTIME 1 +- +-/* +- * Codes for Parameter Problem +- */ +-#define ICMPV6_HDR_FIELD 0 +-#define ICMPV6_UNK_NEXTHDR 1 +-#define ICMPV6_UNK_OPTION 2 +- +-/* +- * constants for (set|get)sockopt +- */ +- +-#define ICMPV6_FILTER 1 +- +-/* +- * ICMPV6 filter +- */ +- +-#define ICMPV6_FILTER_BLOCK 1 +-#define ICMPV6_FILTER_PASS 2 +-#define ICMPV6_FILTER_BLOCKOTHERS 3 +-#define ICMPV6_FILTER_PASSONLY 4 +- +-struct icmp6_filter { +- __u32 data[8]; +-}; +- +-/* +- * Definitions for MLDv2 +- */ +-#define MLD2_MODE_IS_INCLUDE 1 +-#define MLD2_MODE_IS_EXCLUDE 2 +-#define MLD2_CHANGE_TO_INCLUDE 3 +-#define MLD2_CHANGE_TO_EXCLUDE 4 +-#define MLD2_ALLOW_NEW_SOURCES 5 +-#define MLD2_BLOCK_OLD_SOURCES 6 +- +-#define MLD2_ALL_MCR_INIT { { { 0xff,0x02,0,0,0,0,0,0,0,0,0,0,0,0,0,0x16 } } } +- +- +-#endif /* _LINUX_ICMPV6_H */ +diff --git a/include/linux/if.h b/include/linux/if.h +deleted file mode 100644 +index b4ba020..0000000 +--- a/include/linux/if.h ++++ /dev/null +@@ -1,292 +0,0 @@ +-/* +- * INET An implementation of the TCP/IP protocol suite for the LINUX +- * operating system. INET is implemented using the BSD Socket +- * interface as the means of communication with the user level. +- * +- * Global definitions for the INET interface module. +- * +- * Version: @(#)if.h 1.0.2 04/18/93 +- * +- * Authors: Original taken from Berkeley UNIX 4.3, (c) UCB 1982-1988 +- * Ross Biro +- * Fred N. van Kempen, +- * +- * This program is free software; you can redistribute it and/or +- * modify it under the terms of the GNU General Public License +- * as published by the Free Software Foundation; either version +- * 2 of the License, or (at your option) any later version. +- */ +-#ifndef _LINUX_IF_H +-#define _LINUX_IF_H +- +-#include /* for compatibility with glibc */ +-#include /* for "__kernel_caddr_t" et al */ +-#include /* for "struct sockaddr" et al */ +- /* for "__user" et al */ +- +-#include /* for struct sockaddr. */ +- +-#if __UAPI_DEF_IF_IFNAMSIZ +-#define IFNAMSIZ 16 +-#endif /* __UAPI_DEF_IF_IFNAMSIZ */ +-#define IFALIASZ 256 +-#include +- +-/* For glibc compatibility. An empty enum does not compile. */ +-#if __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO != 0 || \ +- __UAPI_DEF_IF_NET_DEVICE_FLAGS != 0 +-/** +- * enum net_device_flags - &struct net_device flags +- * +- * These are the &struct net_device flags, they can be set by drivers, the +- * kernel and some can be triggered by userspace. Userspace can query and +- * set these flags using userspace utilities but there is also a sysfs +- * entry available for all dev flags which can be queried and set. These flags +- * are shared for all types of net_devices. The sysfs entries are available +- * via /sys/class/net//flags. Flags which can be toggled through sysfs +- * are annotated below, note that only a few flags can be toggled and some +- * other flags are always preserved from the original net_device flags +- * even if you try to set them via sysfs. Flags which are always preserved +- * are kept under the flag grouping @IFF_VOLATILE. Flags which are __volatile__ +- * are annotated below as such. +- * +- * You should have a pretty good reason to be extending these flags. +- * +- * @IFF_UP: interface is up. Can be toggled through sysfs. +- * @IFF_BROADCAST: broadcast address valid. Volatile. +- * @IFF_DEBUG: turn on debugging. Can be toggled through sysfs. +- * @IFF_LOOPBACK: is a loopback net. Volatile. +- * @IFF_POINTOPOINT: interface is has p-p link. Volatile. +- * @IFF_NOTRAILERS: avoid use of trailers. Can be toggled through sysfs. +- * Volatile. +- * @IFF_RUNNING: interface RFC2863 OPER_UP. Volatile. +- * @IFF_NOARP: no ARP protocol. Can be toggled through sysfs. Volatile. +- * @IFF_PROMISC: receive all packets. Can be toggled through sysfs. +- * @IFF_ALLMULTI: receive all multicast packets. Can be toggled through +- * sysfs. +- * @IFF_MASTER: master of a load balancer. Volatile. +- * @IFF_SLAVE: slave of a load balancer. Volatile. +- * @IFF_MULTICAST: Supports multicast. Can be toggled through sysfs. +- * @IFF_PORTSEL: can set media type. Can be toggled through sysfs. +- * @IFF_AUTOMEDIA: auto media select active. Can be toggled through sysfs. +- * @IFF_DYNAMIC: dialup device with changing addresses. Can be toggled +- * through sysfs. +- * @IFF_LOWER_UP: driver signals L1 up. Volatile. +- * @IFF_DORMANT: driver signals dormant. Volatile. +- * @IFF_ECHO: echo sent packets. Volatile. +- */ +-enum net_device_flags { +-/* for compatibility with glibc net/if.h */ +-#if __UAPI_DEF_IF_NET_DEVICE_FLAGS +- IFF_UP = 1<<0, /* sysfs */ +- IFF_BROADCAST = 1<<1, /* __volatile__ */ +- IFF_DEBUG = 1<<2, /* sysfs */ +- IFF_LOOPBACK = 1<<3, /* __volatile__ */ +- IFF_POINTOPOINT = 1<<4, /* __volatile__ */ +- IFF_NOTRAILERS = 1<<5, /* sysfs */ +- IFF_RUNNING = 1<<6, /* __volatile__ */ +- IFF_NOARP = 1<<7, /* sysfs */ +- IFF_PROMISC = 1<<8, /* sysfs */ +- IFF_ALLMULTI = 1<<9, /* sysfs */ +- IFF_MASTER = 1<<10, /* __volatile__ */ +- IFF_SLAVE = 1<<11, /* __volatile__ */ +- IFF_MULTICAST = 1<<12, /* sysfs */ +- IFF_PORTSEL = 1<<13, /* sysfs */ +- IFF_AUTOMEDIA = 1<<14, /* sysfs */ +- IFF_DYNAMIC = 1<<15, /* sysfs */ +-#endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS */ +-#if __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO +- IFF_LOWER_UP = 1<<16, /* __volatile__ */ +- IFF_DORMANT = 1<<17, /* __volatile__ */ +- IFF_ECHO = 1<<18, /* __volatile__ */ +-#endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */ +-}; +-#endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO != 0 || __UAPI_DEF_IF_NET_DEVICE_FLAGS != 0 */ +- +-/* for compatibility with glibc net/if.h */ +-#if __UAPI_DEF_IF_NET_DEVICE_FLAGS +-#define IFF_UP IFF_UP +-#define IFF_BROADCAST IFF_BROADCAST +-#define IFF_DEBUG IFF_DEBUG +-#define IFF_LOOPBACK IFF_LOOPBACK +-#define IFF_POINTOPOINT IFF_POINTOPOINT +-#define IFF_NOTRAILERS IFF_NOTRAILERS +-#define IFF_RUNNING IFF_RUNNING +-#define IFF_NOARP IFF_NOARP +-#define IFF_PROMISC IFF_PROMISC +-#define IFF_ALLMULTI IFF_ALLMULTI +-#define IFF_MASTER IFF_MASTER +-#define IFF_SLAVE IFF_SLAVE +-#define IFF_MULTICAST IFF_MULTICAST +-#define IFF_PORTSEL IFF_PORTSEL +-#define IFF_AUTOMEDIA IFF_AUTOMEDIA +-#define IFF_DYNAMIC IFF_DYNAMIC +-#endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS */ +- +-#if __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO +-#define IFF_LOWER_UP IFF_LOWER_UP +-#define IFF_DORMANT IFF_DORMANT +-#define IFF_ECHO IFF_ECHO +-#endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */ +- +-#define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\ +- IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT) +- +-#define IF_GET_IFACE 0x0001 /* for querying only */ +-#define IF_GET_PROTO 0x0002 +- +-/* For definitions see hdlc.h */ +-#define IF_IFACE_V35 0x1000 /* V.35 serial interface */ +-#define IF_IFACE_V24 0x1001 /* V.24 serial interface */ +-#define IF_IFACE_X21 0x1002 /* X.21 serial interface */ +-#define IF_IFACE_T1 0x1003 /* T1 telco serial interface */ +-#define IF_IFACE_E1 0x1004 /* E1 telco serial interface */ +-#define IF_IFACE_SYNC_SERIAL 0x1005 /* can't be set by software */ +-#define IF_IFACE_X21D 0x1006 /* X.21 Dual Clocking (FarSite) */ +- +-/* For definitions see hdlc.h */ +-#define IF_PROTO_HDLC 0x2000 /* raw HDLC protocol */ +-#define IF_PROTO_PPP 0x2001 /* PPP protocol */ +-#define IF_PROTO_CISCO 0x2002 /* Cisco HDLC protocol */ +-#define IF_PROTO_FR 0x2003 /* Frame Relay protocol */ +-#define IF_PROTO_FR_ADD_PVC 0x2004 /* Create FR PVC */ +-#define IF_PROTO_FR_DEL_PVC 0x2005 /* Delete FR PVC */ +-#define IF_PROTO_X25 0x2006 /* X.25 */ +-#define IF_PROTO_HDLC_ETH 0x2007 /* raw HDLC, Ethernet emulation */ +-#define IF_PROTO_FR_ADD_ETH_PVC 0x2008 /* Create FR Ethernet-bridged PVC */ +-#define IF_PROTO_FR_DEL_ETH_PVC 0x2009 /* Delete FR Ethernet-bridged PVC */ +-#define IF_PROTO_FR_PVC 0x200A /* for reading PVC status */ +-#define IF_PROTO_FR_ETH_PVC 0x200B +-#define IF_PROTO_RAW 0x200C /* RAW Socket */ +- +-/* RFC 2863 operational status */ +-enum { +- IF_OPER_UNKNOWN, +- IF_OPER_NOTPRESENT, +- IF_OPER_DOWN, +- IF_OPER_LOWERLAYERDOWN, +- IF_OPER_TESTING, +- IF_OPER_DORMANT, +- IF_OPER_UP, +-}; +- +-/* link modes */ +-enum { +- IF_LINK_MODE_DEFAULT, +- IF_LINK_MODE_DORMANT, /* limit upward transition to dormant */ +-}; +- +-/* +- * Device mapping structure. I'd just gone off and designed a +- * beautiful scheme using only loadable modules with arguments +- * for driver options and along come the PCMCIA people 8) +- * +- * Ah well. The get() side of this is good for WDSETUP, and it'll +- * be handy for debugging things. The set side is fine for now and +- * being very small might be worth keeping for clean configuration. +- */ +- +-/* for compatibility with glibc net/if.h */ +-#if __UAPI_DEF_IF_IFMAP +-struct ifmap { +- unsigned long mem_start; +- unsigned long mem_end; +- unsigned short base_addr; +- unsigned char irq; +- unsigned char dma; +- unsigned char port; +- /* 3 bytes spare */ +-}; +-#endif /* __UAPI_DEF_IF_IFMAP */ +- +-struct if_settings { +- unsigned int type; /* Type of physical device or protocol */ +- unsigned int size; /* Size of the data allocated by the caller */ +- union { +- /* {atm/eth/dsl}_settings anyone ? */ +- raw_hdlc_proto *raw_hdlc; +- cisco_proto *cisco; +- fr_proto *fr; +- fr_proto_pvc *fr_pvc; +- fr_proto_pvc_info *fr_pvc_info; +- +- /* interface settings */ +- sync_serial_settings *sync; +- te1_settings *te1; +- } ifs_ifsu; +-}; +- +-/* +- * Interface request structure used for socket +- * ioctl's. All interface ioctl's must have parameter +- * definitions which begin with ifr_name. The +- * remainder may be interface specific. +- */ +- +-/* for compatibility with glibc net/if.h */ +-#if __UAPI_DEF_IF_IFREQ +-struct ifreq { +-#define IFHWADDRLEN 6 +- union +- { +- char ifrn_name[IFNAMSIZ]; /* if name, e.g. "en0" */ +- } ifr_ifrn; +- +- union { +- struct sockaddr ifru_addr; +- struct sockaddr ifru_dstaddr; +- struct sockaddr ifru_broadaddr; +- struct sockaddr ifru_netmask; +- struct sockaddr ifru_hwaddr; +- short ifru_flags; +- int ifru_ivalue; +- int ifru_mtu; +- struct ifmap ifru_map; +- char ifru_slave[IFNAMSIZ]; /* Just fits the size */ +- char ifru_newname[IFNAMSIZ]; +- void * ifru_data; +- struct if_settings ifru_settings; +- } ifr_ifru; +-}; +-#endif /* __UAPI_DEF_IF_IFREQ */ +- +-#define ifr_name ifr_ifrn.ifrn_name /* interface name */ +-#define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */ +-#define ifr_addr ifr_ifru.ifru_addr /* address */ +-#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-p lnk */ +-#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ +-#define ifr_netmask ifr_ifru.ifru_netmask /* interface net mask */ +-#define ifr_flags ifr_ifru.ifru_flags /* flags */ +-#define ifr_metric ifr_ifru.ifru_ivalue /* metric */ +-#define ifr_mtu ifr_ifru.ifru_mtu /* mtu */ +-#define ifr_map ifr_ifru.ifru_map /* device map */ +-#define ifr_slave ifr_ifru.ifru_slave /* slave device */ +-#define ifr_data ifr_ifru.ifru_data /* for use by interface */ +-#define ifr_ifindex ifr_ifru.ifru_ivalue /* interface index */ +-#define ifr_bandwidth ifr_ifru.ifru_ivalue /* link bandwidth */ +-#define ifr_qlen ifr_ifru.ifru_ivalue /* Queue length */ +-#define ifr_newname ifr_ifru.ifru_newname /* New name */ +-#define ifr_settings ifr_ifru.ifru_settings /* Device/proto settings*/ +- +-/* +- * Structure used in SIOCGIFCONF request. +- * Used to retrieve interface configuration +- * for machine (useful for programs which +- * must know all networks accessible). +- */ +- +-/* for compatibility with glibc net/if.h */ +-#if __UAPI_DEF_IF_IFCONF +-struct ifconf { +- int ifc_len; /* size of buffer */ +- union { +- char *ifcu_buf; +- struct ifreq *ifcu_req; +- } ifc_ifcu; +-}; +-#endif /* __UAPI_DEF_IF_IFCONF */ +- +-#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */ +-#define ifc_req ifc_ifcu.ifcu_req /* array of structures */ +- +-#endif /* _LINUX_IF_H */ +diff --git a/include/linux/if_addr.h b/include/linux/if_addr.h +deleted file mode 100644 +index 26f0ecf..0000000 +--- a/include/linux/if_addr.h ++++ /dev/null +@@ -1,67 +0,0 @@ +-#ifndef __LINUX_IF_ADDR_H +-#define __LINUX_IF_ADDR_H +- +-#include +-#include +- +-struct ifaddrmsg { +- __u8 ifa_family; +- __u8 ifa_prefixlen; /* The prefix length */ +- __u8 ifa_flags; /* Flags */ +- __u8 ifa_scope; /* Address scope */ +- __u32 ifa_index; /* Link index */ +-}; +- +-/* +- * Important comment: +- * IFA_ADDRESS is prefix address, rather than local interface address. +- * It makes no difference for normally configured broadcast interfaces, +- * but for point-to-point IFA_ADDRESS is DESTINATION address, +- * local address is supplied in IFA_LOCAL attribute. +- * +- * IFA_FLAGS is a u32 attribute that extends the u8 field ifa_flags. +- * If present, the value from struct ifaddrmsg will be ignored. +- */ +-enum { +- IFA_UNSPEC, +- IFA_ADDRESS, +- IFA_LOCAL, +- IFA_LABEL, +- IFA_BROADCAST, +- IFA_ANYCAST, +- IFA_CACHEINFO, +- IFA_MULTICAST, +- IFA_FLAGS, +- __IFA_MAX, +-}; +- +-#define IFA_MAX (__IFA_MAX - 1) +- +-/* ifa_flags */ +-#define IFA_F_SECONDARY 0x01 +-#define IFA_F_TEMPORARY IFA_F_SECONDARY +- +-#define IFA_F_NODAD 0x02 +-#define IFA_F_OPTIMISTIC 0x04 +-#define IFA_F_DADFAILED 0x08 +-#define IFA_F_HOMEADDRESS 0x10 +-#define IFA_F_DEPRECATED 0x20 +-#define IFA_F_TENTATIVE 0x40 +-#define IFA_F_PERMANENT 0x80 +-#define IFA_F_MANAGETEMPADDR 0x100 +-#define IFA_F_NOPREFIXROUTE 0x200 +-#define IFA_F_MCAUTOJOIN 0x400 +-#define IFA_F_STABLE_PRIVACY 0x800 +- +-struct ifa_cacheinfo { +- __u32 ifa_prefered; +- __u32 ifa_valid; +- __u32 cstamp; /* created timestamp, hundredths of seconds */ +- __u32 tstamp; /* updated timestamp, hundredths of seconds */ +-}; +- +-/* backwards compatibility for userspace */ +-#define IFA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifaddrmsg)))) +-#define IFA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ifaddrmsg)) +- +-#endif +diff --git a/include/linux/if_addrlabel.h b/include/linux/if_addrlabel.h +deleted file mode 100644 +index 54580c2..0000000 +--- a/include/linux/if_addrlabel.h ++++ /dev/null +@@ -1,32 +0,0 @@ +-/* +- * if_addrlabel.h - netlink interface for address labels +- * +- * Copyright (C)2007 USAGI/WIDE Project, All Rights Reserved. +- * +- * Authors: +- * YOSHIFUJI Hideaki @ USAGI/WIDE +- */ +- +-#ifndef __LINUX_IF_ADDRLABEL_H +-#define __LINUX_IF_ADDRLABEL_H +- +-#include +- +-struct ifaddrlblmsg { +- __u8 ifal_family; /* Address family */ +- __u8 __ifal_reserved; /* Reserved */ +- __u8 ifal_prefixlen; /* Prefix length */ +- __u8 ifal_flags; /* Flags */ +- __u32 ifal_index; /* Link index */ +- __u32 ifal_seq; /* sequence number */ +-}; +- +-enum { +- IFAL_ADDRESS = 1, +- IFAL_LABEL = 2, +- __IFAL_MAX +-}; +- +-#define IFAL_MAX (__IFAL_MAX - 1) +- +-#endif +diff --git a/include/linux/if_alg.h b/include/linux/if_alg.h +deleted file mode 100644 +index f2acd2f..0000000 +--- a/include/linux/if_alg.h ++++ /dev/null +@@ -1,42 +0,0 @@ +-/* +- * if_alg: User-space algorithm interface +- * +- * Copyright (c) 2010 Herbert Xu +- * +- * This program is free software; you can redistribute it and/or modify it +- * under the terms of the GNU General Public License as published by the Free +- * Software Foundation; either version 2 of the License, or (at your option) +- * any later version. +- * +- */ +- +-#ifndef _LINUX_IF_ALG_H +-#define _LINUX_IF_ALG_H +- +-#include +- +-struct sockaddr_alg { +- __u16 salg_family; +- __u8 salg_type[14]; +- __u32 salg_feat; +- __u32 salg_mask; +- __u8 salg_name[64]; +-}; +- +-struct af_alg_iv { +- __u32 ivlen; +- __u8 iv[0]; +-}; +- +-/* Socket options */ +-#define ALG_SET_KEY 1 +-#define ALG_SET_IV 2 +-#define ALG_SET_OP 3 +-#define ALG_SET_AEAD_ASSOCLEN 4 +-#define ALG_SET_AEAD_AUTHSIZE 5 +- +-/* Operations */ +-#define ALG_OP_DECRYPT 0 +-#define ALG_OP_ENCRYPT 1 +- +-#endif /* _LINUX_IF_ALG_H */ +diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h +deleted file mode 100644 +index 199f253..0000000 +--- a/include/linux/if_arp.h ++++ /dev/null +@@ -1,163 +0,0 @@ +-/* +- * INET An implementation of the TCP/IP protocol suite for the LINUX +- * operating system. INET is implemented using the BSD Socket +- * interface as the means of communication with the user level. +- * +- * Global definitions for the ARP (RFC 826) protocol. +- * +- * Version: @(#)if_arp.h 1.0.1 04/16/93 +- * +- * Authors: Original taken from Berkeley UNIX 4.3, (c) UCB 1986-1988 +- * Portions taken from the KA9Q/NOS (v2.00m PA0GRI) source. +- * Ross Biro +- * Fred N. van Kempen, +- * Florian La Roche, +- * Jonathan Layes +- * Arnaldo Carvalho de Melo ARPHRD_HWX25 +- * +- * This program is free software; you can redistribute it and/or +- * modify it under the terms of the GNU General Public License +- * as published by the Free Software Foundation; either version +- * 2 of the License, or (at your option) any later version. +- */ +-#ifndef _LINUX_IF_ARP_H +-#define _LINUX_IF_ARP_H +- +-#include +- +-/* ARP protocol HARDWARE identifiers. */ +-#define ARPHRD_NETROM 0 /* from KA9Q: NET/ROM pseudo */ +-#define ARPHRD_ETHER 1 /* Ethernet 10Mbps */ +-#define ARPHRD_EETHER 2 /* Experimental Ethernet */ +-#define ARPHRD_AX25 3 /* AX.25 Level 2 */ +-#define ARPHRD_PRONET 4 /* PROnet token ring */ +-#define ARPHRD_CHAOS 5 /* Chaosnet */ +-#define ARPHRD_IEEE802 6 /* IEEE 802.2 Ethernet/TR/TB */ +-#define ARPHRD_ARCNET 7 /* ARCnet */ +-#define ARPHRD_APPLETLK 8 /* APPLEtalk */ +-#define ARPHRD_DLCI 15 /* Frame Relay DLCI */ +-#define ARPHRD_ATM 19 /* ATM */ +-#define ARPHRD_METRICOM 23 /* Metricom STRIP (new IANA id) */ +-#define ARPHRD_IEEE1394 24 /* IEEE 1394 IPv4 - RFC 2734 */ +-#define ARPHRD_EUI64 27 /* EUI-64 */ +-#define ARPHRD_INFINIBAND 32 /* InfiniBand */ +- +-/* Dummy types for non ARP hardware */ +-#define ARPHRD_SLIP 256 +-#define ARPHRD_CSLIP 257 +-#define ARPHRD_SLIP6 258 +-#define ARPHRD_CSLIP6 259 +-#define ARPHRD_RSRVD 260 /* Notional KISS type */ +-#define ARPHRD_ADAPT 264 +-#define ARPHRD_ROSE 270 +-#define ARPHRD_X25 271 /* CCITT X.25 */ +-#define ARPHRD_HWX25 272 /* Boards with X.25 in firmware */ +-#define ARPHRD_CAN 280 /* Controller Area Network */ +-#define ARPHRD_PPP 512 +-#define ARPHRD_CISCO 513 /* Cisco HDLC */ +-#define ARPHRD_HDLC ARPHRD_CISCO +-#define ARPHRD_LAPB 516 /* LAPB */ +-#define ARPHRD_DDCMP 517 /* Digital's DDCMP protocol */ +-#define ARPHRD_RAWHDLC 518 /* Raw HDLC */ +-#define ARPHRD_RAWIP 519 /* Raw IP */ +- +-#define ARPHRD_TUNNEL 768 /* IPIP tunnel */ +-#define ARPHRD_TUNNEL6 769 /* IP6IP6 tunnel */ +-#define ARPHRD_FRAD 770 /* Frame Relay Access Device */ +-#define ARPHRD_SKIP 771 /* SKIP vif */ +-#define ARPHRD_LOOPBACK 772 /* Loopback device */ +-#define ARPHRD_LOCALTLK 773 /* Localtalk device */ +-#define ARPHRD_FDDI 774 /* Fiber Distributed Data Interface */ +-#define ARPHRD_BIF 775 /* AP1000 BIF */ +-#define ARPHRD_SIT 776 /* sit0 device - IPv6-in-IPv4 */ +-#define ARPHRD_IPDDP 777 /* IP over DDP tunneller */ +-#define ARPHRD_IPGRE 778 /* GRE over IP */ +-#define ARPHRD_PIMREG 779 /* PIMSM register interface */ +-#define ARPHRD_HIPPI 780 /* High Performance Parallel Interface */ +-#define ARPHRD_ASH 781 /* Nexus 64Mbps Ash */ +-#define ARPHRD_ECONET 782 /* Acorn Econet */ +-#define ARPHRD_IRDA 783 /* Linux-IrDA */ +-/* ARP works differently on different FC media .. so */ +-#define ARPHRD_FCPP 784 /* Point to point fibrechannel */ +-#define ARPHRD_FCAL 785 /* Fibrechannel arbitrated loop */ +-#define ARPHRD_FCPL 786 /* Fibrechannel public loop */ +-#define ARPHRD_FCFABRIC 787 /* Fibrechannel fabric */ +- /* 787->799 reserved for fibrechannel media types */ +-#define ARPHRD_IEEE802_TR 800 /* Magic type ident for TR */ +-#define ARPHRD_IEEE80211 801 /* IEEE 802.11 */ +-#define ARPHRD_IEEE80211_PRISM 802 /* IEEE 802.11 + Prism2 header */ +-#define ARPHRD_IEEE80211_RADIOTAP 803 /* IEEE 802.11 + radiotap header */ +-#define ARPHRD_IEEE802154 804 +-#define ARPHRD_IEEE802154_MONITOR 805 /* IEEE 802.15.4 network monitor */ +- +-#define ARPHRD_PHONET 820 /* PhoNet media type */ +-#define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */ +-#define ARPHRD_CAIF 822 /* CAIF media type */ +-#define ARPHRD_IP6GRE 823 /* GRE over IPv6 */ +-#define ARPHRD_NETLINK 824 /* Netlink header */ +-#define ARPHRD_6LOWPAN 825 /* IPv6 over LoWPAN */ +-#define ARPHRD_VSOCKMON 826 /* Vsock monitor header */ +- +-#define ARPHRD_VOID 0xFFFF /* Void type, nothing is known */ +-#define ARPHRD_NONE 0xFFFE /* zero header length */ +- +-/* ARP protocol opcodes. */ +-#define ARPOP_REQUEST 1 /* ARP request */ +-#define ARPOP_REPLY 2 /* ARP reply */ +-#define ARPOP_RREQUEST 3 /* RARP request */ +-#define ARPOP_RREPLY 4 /* RARP reply */ +-#define ARPOP_InREQUEST 8 /* InARP request */ +-#define ARPOP_InREPLY 9 /* InARP reply */ +-#define ARPOP_NAK 10 /* (ATM)ARP NAK */ +- +- +-/* ARP ioctl request. */ +-struct arpreq { +- struct sockaddr arp_pa; /* protocol address */ +- struct sockaddr arp_ha; /* hardware address */ +- int arp_flags; /* flags */ +- struct sockaddr arp_netmask; /* netmask (only for proxy arps) */ +- char arp_dev[16]; +-}; +- +-struct arpreq_old { +- struct sockaddr arp_pa; /* protocol address */ +- struct sockaddr arp_ha; /* hardware address */ +- int arp_flags; /* flags */ +- struct sockaddr arp_netmask; /* netmask (only for proxy arps) */ +-}; +- +-/* ARP Flag values. */ +-#define ATF_COM 0x02 /* completed entry (ha valid) */ +-#define ATF_PERM 0x04 /* permanent entry */ +-#define ATF_PUBL 0x08 /* publish entry */ +-#define ATF_USETRAILERS 0x10 /* has requested trailers */ +-#define ATF_NETMASK 0x20 /* want to use a netmask (only +- for proxy entries) */ +-#define ATF_DONTPUB 0x40 /* don't answer this addresses */ +- +-/* +- * This structure defines an ethernet arp header. +- */ +- +-struct arphdr { +- __be16 ar_hrd; /* format of hardware address */ +- __be16 ar_pro; /* format of protocol address */ +- unsigned char ar_hln; /* length of hardware address */ +- unsigned char ar_pln; /* length of protocol address */ +- __be16 ar_op; /* ARP opcode (command) */ +- +-#if 0 +- /* +- * Ethernet looks like this : This bit is variable sized however... +- */ +- unsigned char ar_sha[ETH_ALEN]; /* sender hardware address */ +- unsigned char ar_sip[4]; /* sender IP address */ +- unsigned char ar_tha[ETH_ALEN]; /* target hardware address */ +- unsigned char ar_tip[4]; /* target IP address */ +-#endif +- +-}; +- +- +-#endif /* _LINUX_IF_ARP_H */ +diff --git a/include/linux/if_bonding.h b/include/linux/if_bonding.h +deleted file mode 100644 +index 9635a62..0000000 +--- a/include/linux/if_bonding.h ++++ /dev/null +@@ -1,130 +0,0 @@ +-/* +- * Bond several ethernet interfaces into a Cisco, running 'Etherchannel'. +- * +- * +- * Portions are (c) Copyright 1995 Simon "Guru Aleph-Null" Janes +- * NCM: Network and Communications Management, Inc. +- * +- * BUT, I'm the one who modified it for ethernet, so: +- * (c) Copyright 1999, Thomas Davis, tadavis@lbl.gov +- * +- * This software may be used and distributed according to the terms +- * of the GNU Public License, incorporated herein by reference. +- * +- * 2003/03/18 - Amir Noam +- * - Added support for getting slave's speed and duplex via ethtool. +- * Needed for 802.3ad and other future modes. +- * +- * 2003/03/18 - Tsippy Mendelson and +- * Shmulik Hen +- * - Enable support of modes that need to use the unique mac address of +- * each slave. +- * +- * 2003/03/18 - Tsippy Mendelson and +- * Amir Noam +- * - Moved driver's private data types to bonding.h +- * +- * 2003/03/18 - Amir Noam , +- * Tsippy Mendelson and +- * Shmulik Hen +- * - Added support for IEEE 802.3ad Dynamic link aggregation mode. +- * +- * 2003/05/01 - Amir Noam +- * - Added ABI version control to restore compatibility between +- * new/old ifenslave and new/old bonding. +- * +- * 2003/12/01 - Shmulik Hen +- * - Code cleanup and style changes +- * +- * 2005/05/05 - Jason Gabler +- * - added definitions for various XOR hashing policies +- */ +- +-#ifndef _LINUX_IF_BONDING_H +-#define _LINUX_IF_BONDING_H +- +-#include +-#include +-#include +- +-/* userland - kernel ABI version (2003/05/08) */ +-#define BOND_ABI_VERSION 2 +- +-/* +- * We can remove these ioctl definitions in 2.5. People should use the +- * SIOC*** versions of them instead +- */ +-#define BOND_ENSLAVE_OLD (SIOCDEVPRIVATE) +-#define BOND_RELEASE_OLD (SIOCDEVPRIVATE + 1) +-#define BOND_SETHWADDR_OLD (SIOCDEVPRIVATE + 2) +-#define BOND_SLAVE_INFO_QUERY_OLD (SIOCDEVPRIVATE + 11) +-#define BOND_INFO_QUERY_OLD (SIOCDEVPRIVATE + 12) +-#define BOND_CHANGE_ACTIVE_OLD (SIOCDEVPRIVATE + 13) +- +-#define BOND_CHECK_MII_STATUS (SIOCGMIIPHY) +- +-#define BOND_MODE_ROUNDROBIN 0 +-#define BOND_MODE_ACTIVEBACKUP 1 +-#define BOND_MODE_XOR 2 +-#define BOND_MODE_BROADCAST 3 +-#define BOND_MODE_8023AD 4 +-#define BOND_MODE_TLB 5 +-#define BOND_MODE_ALB 6 /* TLB + RLB (receive load balancing) */ +- +-/* each slave's link has 4 states */ +-#define BOND_LINK_UP 0 /* link is up and running */ +-#define BOND_LINK_FAIL 1 /* link has just gone down */ +-#define BOND_LINK_DOWN 2 /* link has been down for too long time */ +-#define BOND_LINK_BACK 3 /* link is going back */ +- +-/* each slave has several states */ +-#define BOND_STATE_ACTIVE 0 /* link is active */ +-#define BOND_STATE_BACKUP 1 /* link is backup */ +- +-#define BOND_DEFAULT_MAX_BONDS 1 /* Default maximum number of devices to support */ +- +-#define BOND_DEFAULT_TX_QUEUES 16 /* Default number of tx queues per device */ +- +-#define BOND_DEFAULT_RESEND_IGMP 1 /* Default number of IGMP membership reports */ +- +-/* hashing types */ +-#define BOND_XMIT_POLICY_LAYER2 0 /* layer 2 (MAC only), default */ +-#define BOND_XMIT_POLICY_LAYER34 1 /* layer 3+4 (IP ^ (TCP || UDP)) */ +-#define BOND_XMIT_POLICY_LAYER23 2 /* layer 2+3 (IP ^ MAC) */ +-#define BOND_XMIT_POLICY_ENCAP23 3 /* encapsulated layer 2+3 */ +-#define BOND_XMIT_POLICY_ENCAP34 4 /* encapsulated layer 3+4 */ +- +-typedef struct ifbond { +- __s32 bond_mode; +- __s32 num_slaves; +- __s32 miimon; +-} ifbond; +- +-typedef struct ifslave { +- __s32 slave_id; /* Used as an IN param to the BOND_SLAVE_INFO_QUERY ioctl */ +- char slave_name[IFNAMSIZ]; +- __s8 link; +- __s8 state; +- __u32 link_failure_count; +-} ifslave; +- +-struct ad_info { +- __u16 aggregator_id; +- __u16 ports; +- __u16 actor_key; +- __u16 partner_key; +- __u8 partner_system[ETH_ALEN]; +-}; +- +-#endif /* _LINUX_IF_BONDING_H */ +- +-/* +- * Local variables: +- * version-control: t +- * kept-new-versions: 5 +- * c-indent-level: 8 +- * c-basic-offset: 8 +- * tab-width: 8 +- * End: +- */ +- +diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h +deleted file mode 100644 +index 156f443..0000000 +--- a/include/linux/if_bridge.h ++++ /dev/null +@@ -1,294 +0,0 @@ +-/* +- * Linux ethernet bridge +- * +- * Authors: +- * Lennert Buytenhek +- * +- * This program is free software; you can redistribute it and/or +- * modify it under the terms of the GNU General Public License +- * as published by the Free Software Foundation; either version +- * 2 of the License, or (at your option) any later version. +- */ +- +-#ifndef _LINUX_IF_BRIDGE_H +-#define _LINUX_IF_BRIDGE_H +- +-#include +-#include +-#include +- +-#define SYSFS_BRIDGE_ATTR "bridge" +-#define SYSFS_BRIDGE_FDB "brforward" +-#define SYSFS_BRIDGE_PORT_SUBDIR "brif" +-#define SYSFS_BRIDGE_PORT_ATTR "brport" +-#define SYSFS_BRIDGE_PORT_LINK "bridge" +- +-#define BRCTL_VERSION 1 +- +-#define BRCTL_GET_VERSION 0 +-#define BRCTL_GET_BRIDGES 1 +-#define BRCTL_ADD_BRIDGE 2 +-#define BRCTL_DEL_BRIDGE 3 +-#define BRCTL_ADD_IF 4 +-#define BRCTL_DEL_IF 5 +-#define BRCTL_GET_BRIDGE_INFO 6 +-#define BRCTL_GET_PORT_LIST 7 +-#define BRCTL_SET_BRIDGE_FORWARD_DELAY 8 +-#define BRCTL_SET_BRIDGE_HELLO_TIME 9 +-#define BRCTL_SET_BRIDGE_MAX_AGE 10 +-#define BRCTL_SET_AGEING_TIME 11 +-#define BRCTL_SET_GC_INTERVAL 12 +-#define BRCTL_GET_PORT_INFO 13 +-#define BRCTL_SET_BRIDGE_STP_STATE 14 +-#define BRCTL_SET_BRIDGE_PRIORITY 15 +-#define BRCTL_SET_PORT_PRIORITY 16 +-#define BRCTL_SET_PATH_COST 17 +-#define BRCTL_GET_FDB_ENTRIES 18 +- +-#define BR_STATE_DISABLED 0 +-#define BR_STATE_LISTENING 1 +-#define BR_STATE_LEARNING 2 +-#define BR_STATE_FORWARDING 3 +-#define BR_STATE_BLOCKING 4 +- +-struct __bridge_info { +- __u64 designated_root; +- __u64 bridge_id; +- __u32 root_path_cost; +- __u32 max_age; +- __u32 hello_time; +- __u32 forward_delay; +- __u32 bridge_max_age; +- __u32 bridge_hello_time; +- __u32 bridge_forward_delay; +- __u8 topology_change; +- __u8 topology_change_detected; +- __u8 root_port; +- __u8 stp_enabled; +- __u32 ageing_time; +- __u32 gc_interval; +- __u32 hello_timer_value; +- __u32 tcn_timer_value; +- __u32 topology_change_timer_value; +- __u32 gc_timer_value; +-}; +- +-struct __port_info { +- __u64 designated_root; +- __u64 designated_bridge; +- __u16 port_id; +- __u16 designated_port; +- __u32 path_cost; +- __u32 designated_cost; +- __u8 state; +- __u8 top_change_ack; +- __u8 config_pending; +- __u8 unused0; +- __u32 message_age_timer_value; +- __u32 forward_delay_timer_value; +- __u32 hold_timer_value; +-}; +- +-struct __fdb_entry { +- __u8 mac_addr[ETH_ALEN]; +- __u8 port_no; +- __u8 is_local; +- __u32 ageing_timer_value; +- __u8 port_hi; +- __u8 pad0; +- __u16 unused; +-}; +- +-/* Bridge Flags */ +-#define BRIDGE_FLAGS_MASTER 1 /* Bridge command to/from master */ +-#define BRIDGE_FLAGS_SELF 2 /* Bridge command to/from lowerdev */ +- +-#define BRIDGE_MODE_VEB 0 /* Default loopback mode */ +-#define BRIDGE_MODE_VEPA 1 /* 802.1Qbg defined VEPA mode */ +-#define BRIDGE_MODE_UNDEF 0xFFFF /* mode undefined */ +- +-/* Bridge management nested attributes +- * [IFLA_AF_SPEC] = { +- * [IFLA_BRIDGE_FLAGS] +- * [IFLA_BRIDGE_MODE] +- * [IFLA_BRIDGE_VLAN_INFO] +- * } +- */ +-enum { +- IFLA_BRIDGE_FLAGS, +- IFLA_BRIDGE_MODE, +- IFLA_BRIDGE_VLAN_INFO, +- IFLA_BRIDGE_VLAN_TUNNEL_INFO, +- __IFLA_BRIDGE_MAX, +-}; +-#define IFLA_BRIDGE_MAX (__IFLA_BRIDGE_MAX - 1) +- +-#define BRIDGE_VLAN_INFO_MASTER (1<<0) /* Operate on Bridge device as well */ +-#define BRIDGE_VLAN_INFO_PVID (1<<1) /* VLAN is PVID, ingress untagged */ +-#define BRIDGE_VLAN_INFO_UNTAGGED (1<<2) /* VLAN egresses untagged */ +-#define BRIDGE_VLAN_INFO_RANGE_BEGIN (1<<3) /* VLAN is start of vlan range */ +-#define BRIDGE_VLAN_INFO_RANGE_END (1<<4) /* VLAN is end of vlan range */ +-#define BRIDGE_VLAN_INFO_BRENTRY (1<<5) /* Global bridge VLAN entry */ +- +-struct bridge_vlan_info { +- __u16 flags; +- __u16 vid; +-}; +- +-enum { +- IFLA_BRIDGE_VLAN_TUNNEL_UNSPEC, +- IFLA_BRIDGE_VLAN_TUNNEL_ID, +- IFLA_BRIDGE_VLAN_TUNNEL_VID, +- IFLA_BRIDGE_VLAN_TUNNEL_FLAGS, +- __IFLA_BRIDGE_VLAN_TUNNEL_MAX, +-}; +- +-#define IFLA_BRIDGE_VLAN_TUNNEL_MAX (__IFLA_BRIDGE_VLAN_TUNNEL_MAX - 1) +- +-struct bridge_vlan_xstats { +- __u64 rx_bytes; +- __u64 rx_packets; +- __u64 tx_bytes; +- __u64 tx_packets; +- __u16 vid; +- __u16 flags; +- __u32 pad2; +-}; +- +-/* Bridge multicast database attributes +- * [MDBA_MDB] = { +- * [MDBA_MDB_ENTRY] = { +- * [MDBA_MDB_ENTRY_INFO] { +- * struct br_mdb_entry +- * [MDBA_MDB_EATTR attributes] +- * } +- * } +- * } +- * [MDBA_ROUTER] = { +- * [MDBA_ROUTER_PORT] = { +- * u32 ifindex +- * [MDBA_ROUTER_PATTR attributes] +- * } +- * } +- */ +-enum { +- MDBA_UNSPEC, +- MDBA_MDB, +- MDBA_ROUTER, +- __MDBA_MAX, +-}; +-#define MDBA_MAX (__MDBA_MAX - 1) +- +-enum { +- MDBA_MDB_UNSPEC, +- MDBA_MDB_ENTRY, +- __MDBA_MDB_MAX, +-}; +-#define MDBA_MDB_MAX (__MDBA_MDB_MAX - 1) +- +-enum { +- MDBA_MDB_ENTRY_UNSPEC, +- MDBA_MDB_ENTRY_INFO, +- __MDBA_MDB_ENTRY_MAX, +-}; +-#define MDBA_MDB_ENTRY_MAX (__MDBA_MDB_ENTRY_MAX - 1) +- +-/* per mdb entry additional attributes */ +-enum { +- MDBA_MDB_EATTR_UNSPEC, +- MDBA_MDB_EATTR_TIMER, +- __MDBA_MDB_EATTR_MAX +-}; +-#define MDBA_MDB_EATTR_MAX (__MDBA_MDB_EATTR_MAX - 1) +- +-/* multicast router types */ +-enum { +- MDB_RTR_TYPE_DISABLED, +- MDB_RTR_TYPE_TEMP_QUERY, +- MDB_RTR_TYPE_PERM, +- MDB_RTR_TYPE_TEMP +-}; +- +-enum { +- MDBA_ROUTER_UNSPEC, +- MDBA_ROUTER_PORT, +- __MDBA_ROUTER_MAX, +-}; +-#define MDBA_ROUTER_MAX (__MDBA_ROUTER_MAX - 1) +- +-/* router port attributes */ +-enum { +- MDBA_ROUTER_PATTR_UNSPEC, +- MDBA_ROUTER_PATTR_TIMER, +- MDBA_ROUTER_PATTR_TYPE, +- __MDBA_ROUTER_PATTR_MAX +-}; +-#define MDBA_ROUTER_PATTR_MAX (__MDBA_ROUTER_PATTR_MAX - 1) +- +-struct br_port_msg { +- __u8 family; +- __u32 ifindex; +-}; +- +-struct br_mdb_entry { +- __u32 ifindex; +-#define MDB_TEMPORARY 0 +-#define MDB_PERMANENT 1 +- __u8 state; +-#define MDB_FLAGS_OFFLOAD (1 << 0) +- __u8 flags; +- __u16 vid; +- struct { +- union { +- __be32 ip4; +- struct in6_addr ip6; +- } u; +- __be16 proto; +- } addr; +-}; +- +-enum { +- MDBA_SET_ENTRY_UNSPEC, +- MDBA_SET_ENTRY, +- __MDBA_SET_ENTRY_MAX, +-}; +-#define MDBA_SET_ENTRY_MAX (__MDBA_SET_ENTRY_MAX - 1) +- +-/* Embedded inside LINK_XSTATS_TYPE_BRIDGE */ +-enum { +- BRIDGE_XSTATS_UNSPEC, +- BRIDGE_XSTATS_VLAN, +- BRIDGE_XSTATS_MCAST, +- BRIDGE_XSTATS_PAD, +- __BRIDGE_XSTATS_MAX +-}; +-#define BRIDGE_XSTATS_MAX (__BRIDGE_XSTATS_MAX - 1) +- +-enum { +- BR_MCAST_DIR_RX, +- BR_MCAST_DIR_TX, +- BR_MCAST_DIR_SIZE +-}; +- +-/* IGMP/MLD statistics */ +-struct br_mcast_stats { +- __u64 igmp_v1queries[BR_MCAST_DIR_SIZE]; +- __u64 igmp_v2queries[BR_MCAST_DIR_SIZE]; +- __u64 igmp_v3queries[BR_MCAST_DIR_SIZE]; +- __u64 igmp_leaves[BR_MCAST_DIR_SIZE]; +- __u64 igmp_v1reports[BR_MCAST_DIR_SIZE]; +- __u64 igmp_v2reports[BR_MCAST_DIR_SIZE]; +- __u64 igmp_v3reports[BR_MCAST_DIR_SIZE]; +- __u64 igmp_parse_errors; +- +- __u64 mld_v1queries[BR_MCAST_DIR_SIZE]; +- __u64 mld_v2queries[BR_MCAST_DIR_SIZE]; +- __u64 mld_leaves[BR_MCAST_DIR_SIZE]; +- __u64 mld_v1reports[BR_MCAST_DIR_SIZE]; +- __u64 mld_v2reports[BR_MCAST_DIR_SIZE]; +- __u64 mld_parse_errors; +- +- __u64 mcast_bytes[BR_MCAST_DIR_SIZE]; +- __u64 mcast_packets[BR_MCAST_DIR_SIZE]; +-}; +-#endif /* _LINUX_IF_BRIDGE_H */ +diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h +deleted file mode 100644 +index 7dde037..0000000 +--- a/include/linux/if_ether.h ++++ /dev/null +@@ -1,158 +0,0 @@ +-/* +- * INET An implementation of the TCP/IP protocol suite for the LINUX +- * operating system. INET is implemented using the BSD Socket +- * interface as the means of communication with the user level. +- * +- * Global definitions for the Ethernet IEEE 802.3 interface. +- * +- * Version: @(#)if_ether.h 1.0.1a 02/08/94 +- * +- * Author: Fred N. van Kempen, +- * Donald Becker, +- * Alan Cox, +- * Steve Whitehouse, +- * +- * This program is free software; you can redistribute it and/or +- * modify it under the terms of the GNU General Public License +- * as published by the Free Software Foundation; either version +- * 2 of the License, or (at your option) any later version. +- */ +- +-#ifndef _LINUX_IF_ETHER_H +-#define _LINUX_IF_ETHER_H +- +-#include +- +-/* +- * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble +- * and FCS/CRC (frame check sequence). +- */ +- +-#define ETH_ALEN 6 /* Octets in one ethernet addr */ +-#define ETH_HLEN 14 /* Total octets in header. */ +-#define ETH_ZLEN 60 /* Min. octets in frame sans FCS */ +-#define ETH_DATA_LEN 1500 /* Max. octets in payload */ +-#define ETH_FRAME_LEN 1514 /* Max. octets in frame sans FCS */ +-#define ETH_FCS_LEN 4 /* Octets in the FCS */ +- +-#define ETH_MIN_MTU 68 /* Min IPv4 MTU per RFC791 */ +-#define ETH_MAX_MTU 0xFFFFU /* 65535, same as IP_MAX_MTU */ +- +-/* +- * These are the defined Ethernet Protocol ID's. +- */ +- +-#define ETH_P_LOOP 0x0060 /* Ethernet Loopback packet */ +-#define ETH_P_PUP 0x0200 /* Xerox PUP packet */ +-#define ETH_P_PUPAT 0x0201 /* Xerox PUP Addr Trans packet */ +-#define ETH_P_TSN 0x22F0 /* TSN (IEEE 1722) packet */ +-#define ETH_P_IP 0x0800 /* Internet Protocol packet */ +-#define ETH_P_X25 0x0805 /* CCITT X.25 */ +-#define ETH_P_ARP 0x0806 /* Address Resolution packet */ +-#define ETH_P_BPQ 0x08FF /* G8BPQ AX.25 Ethernet Packet [ NOT AN OFFICIALLY REGISTERED ID ] */ +-#define ETH_P_IEEEPUP 0x0a00 /* Xerox IEEE802.3 PUP packet */ +-#define ETH_P_IEEEPUPAT 0x0a01 /* Xerox IEEE802.3 PUP Addr Trans packet */ +-#define ETH_P_BATMAN 0x4305 /* B.A.T.M.A.N.-Advanced packet [ NOT AN OFFICIALLY REGISTERED ID ] */ +-#define ETH_P_DEC 0x6000 /* DEC Assigned proto */ +-#define ETH_P_DNA_DL 0x6001 /* DEC DNA Dump/Load */ +-#define ETH_P_DNA_RC 0x6002 /* DEC DNA Remote Console */ +-#define ETH_P_DNA_RT 0x6003 /* DEC DNA Routing */ +-#define ETH_P_LAT 0x6004 /* DEC LAT */ +-#define ETH_P_DIAG 0x6005 /* DEC Diagnostics */ +-#define ETH_P_CUST 0x6006 /* DEC Customer use */ +-#define ETH_P_SCA 0x6007 /* DEC Systems Comms Arch */ +-#define ETH_P_TEB 0x6558 /* Trans Ether Bridging */ +-#define ETH_P_RARP 0x8035 /* Reverse Addr Res packet */ +-#define ETH_P_ATALK 0x809B /* Appletalk DDP */ +-#define ETH_P_AARP 0x80F3 /* Appletalk AARP */ +-#define ETH_P_8021Q 0x8100 /* 802.1Q VLAN Extended Header */ +-#define ETH_P_ERSPAN 0x88BE /* ERSPAN type II */ +-#define ETH_P_IPX 0x8137 /* IPX over DIX */ +-#define ETH_P_IPV6 0x86DD /* IPv6 over bluebook */ +-#define ETH_P_PAUSE 0x8808 /* IEEE Pause frames. See 802.3 31B */ +-#define ETH_P_SLOW 0x8809 /* Slow Protocol. See 802.3ad 43B */ +-#define ETH_P_WCCP 0x883E /* Web-cache coordination protocol +- * defined in draft-wilson-wrec-wccp-v2-00.txt */ +-#define ETH_P_MPLS_UC 0x8847 /* MPLS Unicast traffic */ +-#define ETH_P_MPLS_MC 0x8848 /* MPLS Multicast traffic */ +-#define ETH_P_ATMMPOA 0x884c /* MultiProtocol Over ATM */ +-#define ETH_P_PPP_DISC 0x8863 /* PPPoE discovery messages */ +-#define ETH_P_PPP_SES 0x8864 /* PPPoE session messages */ +-#define ETH_P_LINK_CTL 0x886c /* HPNA, wlan link local tunnel */ +-#define ETH_P_ATMFATE 0x8884 /* Frame-based ATM Transport +- * over Ethernet +- */ +-#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ +-#define ETH_P_AOE 0x88A2 /* ATA over Ethernet */ +-#define ETH_P_8021AD 0x88A8 /* 802.1ad Service VLAN */ +-#define ETH_P_802_EX1 0x88B5 /* 802.1 Local Experimental 1. */ +-#define ETH_P_TIPC 0x88CA /* TIPC */ +-#define ETH_P_MACSEC 0x88E5 /* 802.1ae MACsec */ +-#define ETH_P_8021AH 0x88E7 /* 802.1ah Backbone Service Tag */ +-#define ETH_P_MVRP 0x88F5 /* 802.1Q MVRP */ +-#define ETH_P_1588 0x88F7 /* IEEE 1588 Timesync */ +-#define ETH_P_NCSI 0x88F8 /* NCSI protocol */ +-#define ETH_P_PRP 0x88FB /* IEC 62439-3 PRP/HSRv0 */ +-#define ETH_P_FCOE 0x8906 /* Fibre Channel over Ethernet */ +-#define ETH_P_IBOE 0x8915 /* Infiniband over Ethernet */ +-#define ETH_P_TDLS 0x890D /* TDLS */ +-#define ETH_P_FIP 0x8914 /* FCoE Initialization Protocol */ +-#define ETH_P_80221 0x8917 /* IEEE 802.21 Media Independent Handover Protocol */ +-#define ETH_P_HSR 0x892F /* IEC 62439-3 HSRv1 */ +-#define ETH_P_NSH 0x894F /* Network Service Header */ +-#define ETH_P_LOOPBACK 0x9000 /* Ethernet loopback packet, per IEEE 802.3 */ +-#define ETH_P_QINQ1 0x9100 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */ +-#define ETH_P_QINQ2 0x9200 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */ +-#define ETH_P_QINQ3 0x9300 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */ +-#define ETH_P_EDSA 0xDADA /* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */ +-#define ETH_P_IFE 0xED3E /* ForCES inter-FE LFB type */ +-#define ETH_P_AF_IUCV 0xFBFB /* IBM af_iucv [ NOT AN OFFICIALLY REGISTERED ID ] */ +- +-#define ETH_P_802_3_MIN 0x0600 /* If the value in the ethernet type is less than this value +- * then the frame is Ethernet II. Else it is 802.3 */ +- +-/* +- * Non DIX types. Won't clash for 1500 types. +- */ +- +-#define ETH_P_802_3 0x0001 /* Dummy type for 802.3 frames */ +-#define ETH_P_AX25 0x0002 /* Dummy protocol id for AX.25 */ +-#define ETH_P_ALL 0x0003 /* Every packet (be careful!!!) */ +-#define ETH_P_802_2 0x0004 /* 802.2 frames */ +-#define ETH_P_SNAP 0x0005 /* Internal only */ +-#define ETH_P_DDCMP 0x0006 /* DEC DDCMP: Internal only */ +-#define ETH_P_WAN_PPP 0x0007 /* Dummy type for WAN PPP frames*/ +-#define ETH_P_PPP_MP 0x0008 /* Dummy type for PPP MP frames */ +-#define ETH_P_LOCALTALK 0x0009 /* Localtalk pseudo type */ +-#define ETH_P_CAN 0x000C /* CAN: Controller Area Network */ +-#define ETH_P_CANFD 0x000D /* CANFD: CAN flexible data rate*/ +-#define ETH_P_PPPTALK 0x0010 /* Dummy type for Atalk over PPP*/ +-#define ETH_P_TR_802_2 0x0011 /* 802.2 frames */ +-#define ETH_P_MOBITEX 0x0015 /* Mobitex (kaz@cafe.net) */ +-#define ETH_P_CONTROL 0x0016 /* Card specific control frames */ +-#define ETH_P_IRDA 0x0017 /* Linux-IrDA */ +-#define ETH_P_ECONET 0x0018 /* Acorn Econet */ +-#define ETH_P_HDLC 0x0019 /* HDLC frames */ +-#define ETH_P_ARCNET 0x001A /* 1A for ArcNet :-) */ +-#define ETH_P_DSA 0x001B /* Distributed Switch Arch. */ +-#define ETH_P_TRAILER 0x001C /* Trailer switch tagging */ +-#define ETH_P_PHONET 0x00F5 /* Nokia Phonet frames */ +-#define ETH_P_IEEE802154 0x00F6 /* IEEE802.15.4 frame */ +-#define ETH_P_CAIF 0x00F7 /* ST-Ericsson CAIF protocol */ +-#define ETH_P_XDSA 0x00F8 /* Multiplexed DSA protocol */ +-#define ETH_P_MAP 0x00F9 /* Qualcomm multiplexing and +- * aggregation protocol +- */ +- +-/* +- * This is an Ethernet frame header. +- */ +- +-struct ethhdr { +- unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ +- unsigned char h_source[ETH_ALEN]; /* source ether addr */ +- __be16 h_proto; /* packet type ID field */ +-} __attribute__((packed)); +- +- +-#endif /* _LINUX_IF_ETHER_H */ +diff --git a/include/linux/if_link.h b/include/linux/if_link.h +deleted file mode 100644 +index 1f97d05..0000000 +--- a/include/linux/if_link.h ++++ /dev/null +@@ -1,928 +0,0 @@ +-#ifndef _LINUX_IF_LINK_H +-#define _LINUX_IF_LINK_H +- +-#include +-#include +- +-/* This struct should be in sync with struct rtnl_link_stats64 */ +-struct rtnl_link_stats { +- __u32 rx_packets; /* total packets received */ +- __u32 tx_packets; /* total packets transmitted */ +- __u32 rx_bytes; /* total bytes received */ +- __u32 tx_bytes; /* total bytes transmitted */ +- __u32 rx_errors; /* bad packets received */ +- __u32 tx_errors; /* packet transmit problems */ +- __u32 rx_dropped; /* no space in linux buffers */ +- __u32 tx_dropped; /* no space available in linux */ +- __u32 multicast; /* multicast packets received */ +- __u32 collisions; +- +- /* detailed rx_errors: */ +- __u32 rx_length_errors; +- __u32 rx_over_errors; /* receiver ring buff overflow */ +- __u32 rx_crc_errors; /* recved pkt with crc error */ +- __u32 rx_frame_errors; /* recv'd frame alignment error */ +- __u32 rx_fifo_errors; /* recv'r fifo overrun */ +- __u32 rx_missed_errors; /* receiver missed packet */ +- +- /* detailed tx_errors */ +- __u32 tx_aborted_errors; +- __u32 tx_carrier_errors; +- __u32 tx_fifo_errors; +- __u32 tx_heartbeat_errors; +- __u32 tx_window_errors; +- +- /* for cslip etc */ +- __u32 rx_compressed; +- __u32 tx_compressed; +- +- __u32 rx_nohandler; /* dropped, no handler found */ +-}; +- +-/* The main device statistics structure */ +-struct rtnl_link_stats64 { +- __u64 rx_packets; /* total packets received */ +- __u64 tx_packets; /* total packets transmitted */ +- __u64 rx_bytes; /* total bytes received */ +- __u64 tx_bytes; /* total bytes transmitted */ +- __u64 rx_errors; /* bad packets received */ +- __u64 tx_errors; /* packet transmit problems */ +- __u64 rx_dropped; /* no space in linux buffers */ +- __u64 tx_dropped; /* no space available in linux */ +- __u64 multicast; /* multicast packets received */ +- __u64 collisions; +- +- /* detailed rx_errors: */ +- __u64 rx_length_errors; +- __u64 rx_over_errors; /* receiver ring buff overflow */ +- __u64 rx_crc_errors; /* recved pkt with crc error */ +- __u64 rx_frame_errors; /* recv'd frame alignment error */ +- __u64 rx_fifo_errors; /* recv'r fifo overrun */ +- __u64 rx_missed_errors; /* receiver missed packet */ +- +- /* detailed tx_errors */ +- __u64 tx_aborted_errors; +- __u64 tx_carrier_errors; +- __u64 tx_fifo_errors; +- __u64 tx_heartbeat_errors; +- __u64 tx_window_errors; +- +- /* for cslip etc */ +- __u64 rx_compressed; +- __u64 tx_compressed; +- +- __u64 rx_nohandler; /* dropped, no handler found */ +-}; +- +-/* The struct should be in sync with struct ifmap */ +-struct rtnl_link_ifmap { +- __u64 mem_start; +- __u64 mem_end; +- __u64 base_addr; +- __u16 irq; +- __u8 dma; +- __u8 port; +-}; +- +-/* +- * IFLA_AF_SPEC +- * Contains nested attributes for address family specific attributes. +- * Each address family may create a attribute with the address family +- * number as type and create its own attribute structure in it. +- * +- * Example: +- * [IFLA_AF_SPEC] = { +- * [AF_INET] = { +- * [IFLA_INET_CONF] = ..., +- * }, +- * [AF_INET6] = { +- * [IFLA_INET6_FLAGS] = ..., +- * [IFLA_INET6_CONF] = ..., +- * } +- * } +- */ +- +-enum { +- IFLA_UNSPEC, +- IFLA_ADDRESS, +- IFLA_BROADCAST, +- IFLA_IFNAME, +- IFLA_MTU, +- IFLA_LINK, +- IFLA_QDISC, +- IFLA_STATS, +- IFLA_COST, +-#define IFLA_COST IFLA_COST +- IFLA_PRIORITY, +-#define IFLA_PRIORITY IFLA_PRIORITY +- IFLA_MASTER, +-#define IFLA_MASTER IFLA_MASTER +- IFLA_WIRELESS, /* Wireless Extension event - see wireless.h */ +-#define IFLA_WIRELESS IFLA_WIRELESS +- IFLA_PROTINFO, /* Protocol specific information for a link */ +-#define IFLA_PROTINFO IFLA_PROTINFO +- IFLA_TXQLEN, +-#define IFLA_TXQLEN IFLA_TXQLEN +- IFLA_MAP, +-#define IFLA_MAP IFLA_MAP +- IFLA_WEIGHT, +-#define IFLA_WEIGHT IFLA_WEIGHT +- IFLA_OPERSTATE, +- IFLA_LINKMODE, +- IFLA_LINKINFO, +-#define IFLA_LINKINFO IFLA_LINKINFO +- IFLA_NET_NS_PID, +- IFLA_IFALIAS, +- IFLA_NUM_VF, /* Number of VFs if device is SR-IOV PF */ +- IFLA_VFINFO_LIST, +- IFLA_STATS64, +- IFLA_VF_PORTS, +- IFLA_PORT_SELF, +- IFLA_AF_SPEC, +- IFLA_GROUP, /* Group the device belongs to */ +- IFLA_NET_NS_FD, +- IFLA_EXT_MASK, /* Extended info mask, VFs, etc */ +- IFLA_PROMISCUITY, /* Promiscuity count: > 0 means acts PROMISC */ +-#define IFLA_PROMISCUITY IFLA_PROMISCUITY +- IFLA_NUM_TX_QUEUES, +- IFLA_NUM_RX_QUEUES, +- IFLA_CARRIER, +- IFLA_PHYS_PORT_ID, +- IFLA_CARRIER_CHANGES, +- IFLA_PHYS_SWITCH_ID, +- IFLA_LINK_NETNSID, +- IFLA_PHYS_PORT_NAME, +- IFLA_PROTO_DOWN, +- IFLA_GSO_MAX_SEGS, +- IFLA_GSO_MAX_SIZE, +- IFLA_PAD, +- IFLA_XDP, +- IFLA_EVENT, +- __IFLA_MAX +-}; +- +- +-#define IFLA_MAX (__IFLA_MAX - 1) +- +-/* backwards compatibility for userspace */ +-#define IFLA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifinfomsg)))) +-#define IFLA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ifinfomsg)) +- +-enum { +- IFLA_INET_UNSPEC, +- IFLA_INET_CONF, +- __IFLA_INET_MAX, +-}; +- +-#define IFLA_INET_MAX (__IFLA_INET_MAX - 1) +- +-/* ifi_flags. +- +- IFF_* flags. +- +- The only change is: +- IFF_LOOPBACK, IFF_BROADCAST and IFF_POINTOPOINT are +- more not changeable by user. They describe link media +- characteristics and set by device driver. +- +- Comments: +- - Combination IFF_BROADCAST|IFF_POINTOPOINT is invalid +- - If neither of these three flags are set; +- the interface is NBMA. +- +- - IFF_MULTICAST does not mean anything special: +- multicasts can be used on all not-NBMA links. +- IFF_MULTICAST means that this media uses special encapsulation +- for multicast frames. Apparently, all IFF_POINTOPOINT and +- IFF_BROADCAST devices are able to use multicasts too. +- */ +- +-/* IFLA_LINK. +- For usual devices it is equal ifi_index. +- If it is a "virtual interface" (f.e. tunnel), ifi_link +- can point to real physical interface (f.e. for bandwidth calculations), +- or maybe 0, what means, that real media is unknown (usual +- for IPIP tunnels, when route to endpoint is allowed to change) +- */ +- +-/* Subtype attributes for IFLA_PROTINFO */ +-enum { +- IFLA_INET6_UNSPEC, +- IFLA_INET6_FLAGS, /* link flags */ +- IFLA_INET6_CONF, /* sysctl parameters */ +- IFLA_INET6_STATS, /* statistics */ +- IFLA_INET6_MCAST, /* MC things. What of them? */ +- IFLA_INET6_CACHEINFO, /* time values and max reasm size */ +- IFLA_INET6_ICMP6STATS, /* statistics (icmpv6) */ +- IFLA_INET6_TOKEN, /* device token */ +- IFLA_INET6_ADDR_GEN_MODE, /* implicit address generator mode */ +- __IFLA_INET6_MAX +-}; +- +-#define IFLA_INET6_MAX (__IFLA_INET6_MAX - 1) +- +-enum in6_addr_gen_mode { +- IN6_ADDR_GEN_MODE_EUI64, +- IN6_ADDR_GEN_MODE_NONE, +- IN6_ADDR_GEN_MODE_STABLE_PRIVACY, +- IN6_ADDR_GEN_MODE_RANDOM, +-}; +- +-/* Bridge section */ +- +-enum { +- IFLA_BR_UNSPEC, +- IFLA_BR_FORWARD_DELAY, +- IFLA_BR_HELLO_TIME, +- IFLA_BR_MAX_AGE, +- IFLA_BR_AGEING_TIME, +- IFLA_BR_STP_STATE, +- IFLA_BR_PRIORITY, +- IFLA_BR_VLAN_FILTERING, +- IFLA_BR_VLAN_PROTOCOL, +- IFLA_BR_GROUP_FWD_MASK, +- IFLA_BR_ROOT_ID, +- IFLA_BR_BRIDGE_ID, +- IFLA_BR_ROOT_PORT, +- IFLA_BR_ROOT_PATH_COST, +- IFLA_BR_TOPOLOGY_CHANGE, +- IFLA_BR_TOPOLOGY_CHANGE_DETECTED, +- IFLA_BR_HELLO_TIMER, +- IFLA_BR_TCN_TIMER, +- IFLA_BR_TOPOLOGY_CHANGE_TIMER, +- IFLA_BR_GC_TIMER, +- IFLA_BR_GROUP_ADDR, +- IFLA_BR_FDB_FLUSH, +- IFLA_BR_MCAST_ROUTER, +- IFLA_BR_MCAST_SNOOPING, +- IFLA_BR_MCAST_QUERY_USE_IFADDR, +- IFLA_BR_MCAST_QUERIER, +- IFLA_BR_MCAST_HASH_ELASTICITY, +- IFLA_BR_MCAST_HASH_MAX, +- IFLA_BR_MCAST_LAST_MEMBER_CNT, +- IFLA_BR_MCAST_STARTUP_QUERY_CNT, +- IFLA_BR_MCAST_LAST_MEMBER_INTVL, +- IFLA_BR_MCAST_MEMBERSHIP_INTVL, +- IFLA_BR_MCAST_QUERIER_INTVL, +- IFLA_BR_MCAST_QUERY_INTVL, +- IFLA_BR_MCAST_QUERY_RESPONSE_INTVL, +- IFLA_BR_MCAST_STARTUP_QUERY_INTVL, +- IFLA_BR_NF_CALL_IPTABLES, +- IFLA_BR_NF_CALL_IP6TABLES, +- IFLA_BR_NF_CALL_ARPTABLES, +- IFLA_BR_VLAN_DEFAULT_PVID, +- IFLA_BR_PAD, +- IFLA_BR_VLAN_STATS_ENABLED, +- IFLA_BR_MCAST_STATS_ENABLED, +- IFLA_BR_MCAST_IGMP_VERSION, +- IFLA_BR_MCAST_MLD_VERSION, +- __IFLA_BR_MAX, +-}; +- +-#define IFLA_BR_MAX (__IFLA_BR_MAX - 1) +- +-struct ifla_bridge_id { +- __u8 prio[2]; +- __u8 addr[6]; /* ETH_ALEN */ +-}; +- +-enum { +- BRIDGE_MODE_UNSPEC, +- BRIDGE_MODE_HAIRPIN, +-}; +- +-enum { +- IFLA_BRPORT_UNSPEC, +- IFLA_BRPORT_STATE, /* Spanning tree state */ +- IFLA_BRPORT_PRIORITY, /* " priority */ +- IFLA_BRPORT_COST, /* " cost */ +- IFLA_BRPORT_MODE, /* mode (hairpin) */ +- IFLA_BRPORT_GUARD, /* bpdu guard */ +- IFLA_BRPORT_PROTECT, /* root port protection */ +- IFLA_BRPORT_FAST_LEAVE, /* multicast fast leave */ +- IFLA_BRPORT_LEARNING, /* mac learning */ +- IFLA_BRPORT_UNICAST_FLOOD, /* flood unicast traffic */ +- IFLA_BRPORT_PROXYARP, /* proxy ARP */ +- IFLA_BRPORT_LEARNING_SYNC, /* mac learning sync from device */ +- IFLA_BRPORT_PROXYARP_WIFI, /* proxy ARP for Wi-Fi */ +- IFLA_BRPORT_ROOT_ID, /* designated root */ +- IFLA_BRPORT_BRIDGE_ID, /* designated bridge */ +- IFLA_BRPORT_DESIGNATED_PORT, +- IFLA_BRPORT_DESIGNATED_COST, +- IFLA_BRPORT_ID, +- IFLA_BRPORT_NO, +- IFLA_BRPORT_TOPOLOGY_CHANGE_ACK, +- IFLA_BRPORT_CONFIG_PENDING, +- IFLA_BRPORT_MESSAGE_AGE_TIMER, +- IFLA_BRPORT_FORWARD_DELAY_TIMER, +- IFLA_BRPORT_HOLD_TIMER, +- IFLA_BRPORT_FLUSH, +- IFLA_BRPORT_MULTICAST_ROUTER, +- IFLA_BRPORT_PAD, +- IFLA_BRPORT_MCAST_FLOOD, +- IFLA_BRPORT_MCAST_TO_UCAST, +- IFLA_BRPORT_VLAN_TUNNEL, +- IFLA_BRPORT_BCAST_FLOOD, +- __IFLA_BRPORT_MAX +-}; +-#define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1) +- +-struct ifla_cacheinfo { +- __u32 max_reasm_len; +- __u32 tstamp; /* ipv6InterfaceTable updated timestamp */ +- __u32 reachable_time; +- __u32 retrans_time; +-}; +- +-enum { +- IFLA_INFO_UNSPEC, +- IFLA_INFO_KIND, +- IFLA_INFO_DATA, +- IFLA_INFO_XSTATS, +- IFLA_INFO_SLAVE_KIND, +- IFLA_INFO_SLAVE_DATA, +- __IFLA_INFO_MAX, +-}; +- +-#define IFLA_INFO_MAX (__IFLA_INFO_MAX - 1) +- +-/* VLAN section */ +- +-enum { +- IFLA_VLAN_UNSPEC, +- IFLA_VLAN_ID, +- IFLA_VLAN_FLAGS, +- IFLA_VLAN_EGRESS_QOS, +- IFLA_VLAN_INGRESS_QOS, +- IFLA_VLAN_PROTOCOL, +- __IFLA_VLAN_MAX, +-}; +- +-#define IFLA_VLAN_MAX (__IFLA_VLAN_MAX - 1) +- +-struct ifla_vlan_flags { +- __u32 flags; +- __u32 mask; +-}; +- +-enum { +- IFLA_VLAN_QOS_UNSPEC, +- IFLA_VLAN_QOS_MAPPING, +- __IFLA_VLAN_QOS_MAX +-}; +- +-#define IFLA_VLAN_QOS_MAX (__IFLA_VLAN_QOS_MAX - 1) +- +-struct ifla_vlan_qos_mapping { +- __u32 from; +- __u32 to; +-}; +- +-/* MACVLAN section */ +-enum { +- IFLA_MACVLAN_UNSPEC, +- IFLA_MACVLAN_MODE, +- IFLA_MACVLAN_FLAGS, +- IFLA_MACVLAN_MACADDR_MODE, +- IFLA_MACVLAN_MACADDR, +- IFLA_MACVLAN_MACADDR_DATA, +- IFLA_MACVLAN_MACADDR_COUNT, +- __IFLA_MACVLAN_MAX, +-}; +- +-#define IFLA_MACVLAN_MAX (__IFLA_MACVLAN_MAX - 1) +- +-enum macvlan_mode { +- MACVLAN_MODE_PRIVATE = 1, /* don't talk to other macvlans */ +- MACVLAN_MODE_VEPA = 2, /* talk to other ports through ext bridge */ +- MACVLAN_MODE_BRIDGE = 4, /* talk to bridge ports directly */ +- MACVLAN_MODE_PASSTHRU = 8,/* take over the underlying device */ +- MACVLAN_MODE_SOURCE = 16,/* use source MAC address list to assign */ +-}; +- +-enum macvlan_macaddr_mode { +- MACVLAN_MACADDR_ADD, +- MACVLAN_MACADDR_DEL, +- MACVLAN_MACADDR_FLUSH, +- MACVLAN_MACADDR_SET, +-}; +- +-#define MACVLAN_FLAG_NOPROMISC 1 +- +-/* VRF section */ +-enum { +- IFLA_VRF_UNSPEC, +- IFLA_VRF_TABLE, +- __IFLA_VRF_MAX +-}; +- +-#define IFLA_VRF_MAX (__IFLA_VRF_MAX - 1) +- +-enum { +- IFLA_VRF_PORT_UNSPEC, +- IFLA_VRF_PORT_TABLE, +- __IFLA_VRF_PORT_MAX +-}; +- +-#define IFLA_VRF_PORT_MAX (__IFLA_VRF_PORT_MAX - 1) +- +-/* MACSEC section */ +-enum { +- IFLA_MACSEC_UNSPEC, +- IFLA_MACSEC_SCI, +- IFLA_MACSEC_PORT, +- IFLA_MACSEC_ICV_LEN, +- IFLA_MACSEC_CIPHER_SUITE, +- IFLA_MACSEC_WINDOW, +- IFLA_MACSEC_ENCODING_SA, +- IFLA_MACSEC_ENCRYPT, +- IFLA_MACSEC_PROTECT, +- IFLA_MACSEC_INC_SCI, +- IFLA_MACSEC_ES, +- IFLA_MACSEC_SCB, +- IFLA_MACSEC_REPLAY_PROTECT, +- IFLA_MACSEC_VALIDATION, +- IFLA_MACSEC_PAD, +- __IFLA_MACSEC_MAX, +-}; +- +-#define IFLA_MACSEC_MAX (__IFLA_MACSEC_MAX - 1) +- +-enum macsec_validation_type { +- MACSEC_VALIDATE_DISABLED = 0, +- MACSEC_VALIDATE_CHECK = 1, +- MACSEC_VALIDATE_STRICT = 2, +- __MACSEC_VALIDATE_END, +- MACSEC_VALIDATE_MAX = __MACSEC_VALIDATE_END - 1, +-}; +- +-/* IPVLAN section */ +-enum { +- IFLA_IPVLAN_UNSPEC, +- IFLA_IPVLAN_MODE, +- __IFLA_IPVLAN_MAX +-}; +- +-#define IFLA_IPVLAN_MAX (__IFLA_IPVLAN_MAX - 1) +- +-enum ipvlan_mode { +- IPVLAN_MODE_L2 = 0, +- IPVLAN_MODE_L3, +- IPVLAN_MODE_L3S, +- IPVLAN_MODE_MAX +-}; +- +-/* VXLAN section */ +-enum { +- IFLA_VXLAN_UNSPEC, +- IFLA_VXLAN_ID, +- IFLA_VXLAN_GROUP, /* group or remote address */ +- IFLA_VXLAN_LINK, +- IFLA_VXLAN_LOCAL, +- IFLA_VXLAN_TTL, +- IFLA_VXLAN_TOS, +- IFLA_VXLAN_LEARNING, +- IFLA_VXLAN_AGEING, +- IFLA_VXLAN_LIMIT, +- IFLA_VXLAN_PORT_RANGE, /* source port */ +- IFLA_VXLAN_PROXY, +- IFLA_VXLAN_RSC, +- IFLA_VXLAN_L2MISS, +- IFLA_VXLAN_L3MISS, +- IFLA_VXLAN_PORT, /* destination port */ +- IFLA_VXLAN_GROUP6, +- IFLA_VXLAN_LOCAL6, +- IFLA_VXLAN_UDP_CSUM, +- IFLA_VXLAN_UDP_ZERO_CSUM6_TX, +- IFLA_VXLAN_UDP_ZERO_CSUM6_RX, +- IFLA_VXLAN_REMCSUM_TX, +- IFLA_VXLAN_REMCSUM_RX, +- IFLA_VXLAN_GBP, +- IFLA_VXLAN_REMCSUM_NOPARTIAL, +- IFLA_VXLAN_COLLECT_METADATA, +- IFLA_VXLAN_LABEL, +- IFLA_VXLAN_GPE, +- __IFLA_VXLAN_MAX +-}; +-#define IFLA_VXLAN_MAX (__IFLA_VXLAN_MAX - 1) +- +-struct ifla_vxlan_port_range { +- __be16 low; +- __be16 high; +-}; +- +-/* GENEVE section */ +-enum { +- IFLA_GENEVE_UNSPEC, +- IFLA_GENEVE_ID, +- IFLA_GENEVE_REMOTE, +- IFLA_GENEVE_TTL, +- IFLA_GENEVE_TOS, +- IFLA_GENEVE_PORT, /* destination port */ +- IFLA_GENEVE_COLLECT_METADATA, +- IFLA_GENEVE_REMOTE6, +- IFLA_GENEVE_UDP_CSUM, +- IFLA_GENEVE_UDP_ZERO_CSUM6_TX, +- IFLA_GENEVE_UDP_ZERO_CSUM6_RX, +- IFLA_GENEVE_LABEL, +- __IFLA_GENEVE_MAX +-}; +-#define IFLA_GENEVE_MAX (__IFLA_GENEVE_MAX - 1) +- +-/* PPP section */ +-enum { +- IFLA_PPP_UNSPEC, +- IFLA_PPP_DEV_FD, +- __IFLA_PPP_MAX +-}; +-#define IFLA_PPP_MAX (__IFLA_PPP_MAX - 1) +- +-/* GTP section */ +- +-enum ifla_gtp_role { +- GTP_ROLE_GGSN = 0, +- GTP_ROLE_SGSN, +-}; +- +-enum { +- IFLA_GTP_UNSPEC, +- IFLA_GTP_FD0, +- IFLA_GTP_FD1, +- IFLA_GTP_PDP_HASHSIZE, +- IFLA_GTP_ROLE, +- __IFLA_GTP_MAX, +-}; +-#define IFLA_GTP_MAX (__IFLA_GTP_MAX - 1) +- +-/* Bonding section */ +- +-enum { +- IFLA_BOND_UNSPEC, +- IFLA_BOND_MODE, +- IFLA_BOND_ACTIVE_SLAVE, +- IFLA_BOND_MIIMON, +- IFLA_BOND_UPDELAY, +- IFLA_BOND_DOWNDELAY, +- IFLA_BOND_USE_CARRIER, +- IFLA_BOND_ARP_INTERVAL, +- IFLA_BOND_ARP_IP_TARGET, +- IFLA_BOND_ARP_VALIDATE, +- IFLA_BOND_ARP_ALL_TARGETS, +- IFLA_BOND_PRIMARY, +- IFLA_BOND_PRIMARY_RESELECT, +- IFLA_BOND_FAIL_OVER_MAC, +- IFLA_BOND_XMIT_HASH_POLICY, +- IFLA_BOND_RESEND_IGMP, +- IFLA_BOND_NUM_PEER_NOTIF, +- IFLA_BOND_ALL_SLAVES_ACTIVE, +- IFLA_BOND_MIN_LINKS, +- IFLA_BOND_LP_INTERVAL, +- IFLA_BOND_PACKETS_PER_SLAVE, +- IFLA_BOND_AD_LACP_RATE, +- IFLA_BOND_AD_SELECT, +- IFLA_BOND_AD_INFO, +- IFLA_BOND_AD_ACTOR_SYS_PRIO, +- IFLA_BOND_AD_USER_PORT_KEY, +- IFLA_BOND_AD_ACTOR_SYSTEM, +- IFLA_BOND_TLB_DYNAMIC_LB, +- __IFLA_BOND_MAX, +-}; +- +-#define IFLA_BOND_MAX (__IFLA_BOND_MAX - 1) +- +-enum { +- IFLA_BOND_AD_INFO_UNSPEC, +- IFLA_BOND_AD_INFO_AGGREGATOR, +- IFLA_BOND_AD_INFO_NUM_PORTS, +- IFLA_BOND_AD_INFO_ACTOR_KEY, +- IFLA_BOND_AD_INFO_PARTNER_KEY, +- IFLA_BOND_AD_INFO_PARTNER_MAC, +- __IFLA_BOND_AD_INFO_MAX, +-}; +- +-#define IFLA_BOND_AD_INFO_MAX (__IFLA_BOND_AD_INFO_MAX - 1) +- +-enum { +- IFLA_BOND_SLAVE_UNSPEC, +- IFLA_BOND_SLAVE_STATE, +- IFLA_BOND_SLAVE_MII_STATUS, +- IFLA_BOND_SLAVE_LINK_FAILURE_COUNT, +- IFLA_BOND_SLAVE_PERM_HWADDR, +- IFLA_BOND_SLAVE_QUEUE_ID, +- IFLA_BOND_SLAVE_AD_AGGREGATOR_ID, +- IFLA_BOND_SLAVE_AD_ACTOR_OPER_PORT_STATE, +- IFLA_BOND_SLAVE_AD_PARTNER_OPER_PORT_STATE, +- __IFLA_BOND_SLAVE_MAX, +-}; +- +-#define IFLA_BOND_SLAVE_MAX (__IFLA_BOND_SLAVE_MAX - 1) +- +-/* SR-IOV virtual function management section */ +- +-enum { +- IFLA_VF_INFO_UNSPEC, +- IFLA_VF_INFO, +- __IFLA_VF_INFO_MAX, +-}; +- +-#define IFLA_VF_INFO_MAX (__IFLA_VF_INFO_MAX - 1) +- +-enum { +- IFLA_VF_UNSPEC, +- IFLA_VF_MAC, /* Hardware queue specific attributes */ +- IFLA_VF_VLAN, /* VLAN ID and QoS */ +- IFLA_VF_TX_RATE, /* Max TX Bandwidth Allocation */ +- IFLA_VF_SPOOFCHK, /* Spoof Checking on/off switch */ +- IFLA_VF_LINK_STATE, /* link state enable/disable/auto switch */ +- IFLA_VF_RATE, /* Min and Max TX Bandwidth Allocation */ +- IFLA_VF_RSS_QUERY_EN, /* RSS Redirection Table and Hash Key query +- * on/off switch +- */ +- IFLA_VF_STATS, /* network device statistics */ +- IFLA_VF_TRUST, /* Trust VF */ +- IFLA_VF_IB_NODE_GUID, /* VF Infiniband node GUID */ +- IFLA_VF_IB_PORT_GUID, /* VF Infiniband port GUID */ +- IFLA_VF_VLAN_LIST, /* nested list of vlans, option for QinQ */ +- __IFLA_VF_MAX, +-}; +- +-#define IFLA_VF_MAX (__IFLA_VF_MAX - 1) +- +-struct ifla_vf_mac { +- __u32 vf; +- __u8 mac[32]; /* MAX_ADDR_LEN */ +-}; +- +-struct ifla_vf_vlan { +- __u32 vf; +- __u32 vlan; /* 0 - 4095, 0 disables VLAN filter */ +- __u32 qos; +-}; +- +-enum { +- IFLA_VF_VLAN_INFO_UNSPEC, +- IFLA_VF_VLAN_INFO, /* VLAN ID, QoS and VLAN protocol */ +- __IFLA_VF_VLAN_INFO_MAX, +-}; +- +-#define IFLA_VF_VLAN_INFO_MAX (__IFLA_VF_VLAN_INFO_MAX - 1) +-#define MAX_VLAN_LIST_LEN 1 +- +-struct ifla_vf_vlan_info { +- __u32 vf; +- __u32 vlan; /* 0 - 4095, 0 disables VLAN filter */ +- __u32 qos; +- __be16 vlan_proto; /* VLAN protocol either 802.1Q or 802.1ad */ +-}; +- +-struct ifla_vf_tx_rate { +- __u32 vf; +- __u32 rate; /* Max TX bandwidth in Mbps, 0 disables throttling */ +-}; +- +-struct ifla_vf_rate { +- __u32 vf; +- __u32 min_tx_rate; /* Min Bandwidth in Mbps */ +- __u32 max_tx_rate; /* Max Bandwidth in Mbps */ +-}; +- +-struct ifla_vf_spoofchk { +- __u32 vf; +- __u32 setting; +-}; +- +-struct ifla_vf_guid { +- __u32 vf; +- __u64 guid; +-}; +- +-enum { +- IFLA_VF_LINK_STATE_AUTO, /* link state of the uplink */ +- IFLA_VF_LINK_STATE_ENABLE, /* link always up */ +- IFLA_VF_LINK_STATE_DISABLE, /* link always down */ +- __IFLA_VF_LINK_STATE_MAX, +-}; +- +-struct ifla_vf_link_state { +- __u32 vf; +- __u32 link_state; +-}; +- +-struct ifla_vf_rss_query_en { +- __u32 vf; +- __u32 setting; +-}; +- +-enum { +- IFLA_VF_STATS_RX_PACKETS, +- IFLA_VF_STATS_TX_PACKETS, +- IFLA_VF_STATS_RX_BYTES, +- IFLA_VF_STATS_TX_BYTES, +- IFLA_VF_STATS_BROADCAST, +- IFLA_VF_STATS_MULTICAST, +- IFLA_VF_STATS_PAD, +- __IFLA_VF_STATS_MAX, +-}; +- +-#define IFLA_VF_STATS_MAX (__IFLA_VF_STATS_MAX - 1) +- +-struct ifla_vf_trust { +- __u32 vf; +- __u32 setting; +-}; +- +-/* VF ports management section +- * +- * Nested layout of set/get msg is: +- * +- * [IFLA_NUM_VF] +- * [IFLA_VF_PORTS] +- * [IFLA_VF_PORT] +- * [IFLA_PORT_*], ... +- * [IFLA_VF_PORT] +- * [IFLA_PORT_*], ... +- * ... +- * [IFLA_PORT_SELF] +- * [IFLA_PORT_*], ... +- */ +- +-enum { +- IFLA_VF_PORT_UNSPEC, +- IFLA_VF_PORT, /* nest */ +- __IFLA_VF_PORT_MAX, +-}; +- +-#define IFLA_VF_PORT_MAX (__IFLA_VF_PORT_MAX - 1) +- +-enum { +- IFLA_PORT_UNSPEC, +- IFLA_PORT_VF, /* __u32 */ +- IFLA_PORT_PROFILE, /* string */ +- IFLA_PORT_VSI_TYPE, /* 802.1Qbg (pre-)standard VDP */ +- IFLA_PORT_INSTANCE_UUID, /* binary UUID */ +- IFLA_PORT_HOST_UUID, /* binary UUID */ +- IFLA_PORT_REQUEST, /* __u8 */ +- IFLA_PORT_RESPONSE, /* __u16, output only */ +- __IFLA_PORT_MAX, +-}; +- +-#define IFLA_PORT_MAX (__IFLA_PORT_MAX - 1) +- +-#define PORT_PROFILE_MAX 40 +-#define PORT_UUID_MAX 16 +-#define PORT_SELF_VF -1 +- +-enum { +- PORT_REQUEST_PREASSOCIATE = 0, +- PORT_REQUEST_PREASSOCIATE_RR, +- PORT_REQUEST_ASSOCIATE, +- PORT_REQUEST_DISASSOCIATE, +-}; +- +-enum { +- PORT_VDP_RESPONSE_SUCCESS = 0, +- PORT_VDP_RESPONSE_INVALID_FORMAT, +- PORT_VDP_RESPONSE_INSUFFICIENT_RESOURCES, +- PORT_VDP_RESPONSE_UNUSED_VTID, +- PORT_VDP_RESPONSE_VTID_VIOLATION, +- PORT_VDP_RESPONSE_VTID_VERSION_VIOALTION, +- PORT_VDP_RESPONSE_OUT_OF_SYNC, +- /* 0x08-0xFF reserved for future VDP use */ +- PORT_PROFILE_RESPONSE_SUCCESS = 0x100, +- PORT_PROFILE_RESPONSE_INPROGRESS, +- PORT_PROFILE_RESPONSE_INVALID, +- PORT_PROFILE_RESPONSE_BADSTATE, +- PORT_PROFILE_RESPONSE_INSUFFICIENT_RESOURCES, +- PORT_PROFILE_RESPONSE_ERROR, +-}; +- +-struct ifla_port_vsi { +- __u8 vsi_mgr_id; +- __u8 vsi_type_id[3]; +- __u8 vsi_type_version; +- __u8 pad[3]; +-}; +- +- +-/* IPoIB section */ +- +-enum { +- IFLA_IPOIB_UNSPEC, +- IFLA_IPOIB_PKEY, +- IFLA_IPOIB_MODE, +- IFLA_IPOIB_UMCAST, +- __IFLA_IPOIB_MAX +-}; +- +-enum { +- IPOIB_MODE_DATAGRAM = 0, /* using unreliable datagram QPs */ +- IPOIB_MODE_CONNECTED = 1, /* using connected QPs */ +-}; +- +-#define IFLA_IPOIB_MAX (__IFLA_IPOIB_MAX - 1) +- +- +-/* HSR section */ +- +-enum { +- IFLA_HSR_UNSPEC, +- IFLA_HSR_SLAVE1, +- IFLA_HSR_SLAVE2, +- IFLA_HSR_MULTICAST_SPEC, /* Last byte of supervision addr */ +- IFLA_HSR_SUPERVISION_ADDR, /* Supervision frame multicast addr */ +- IFLA_HSR_SEQ_NR, +- IFLA_HSR_VERSION, /* HSR version */ +- __IFLA_HSR_MAX, +-}; +- +-#define IFLA_HSR_MAX (__IFLA_HSR_MAX - 1) +- +-/* STATS section */ +- +-struct if_stats_msg { +- __u8 family; +- __u8 pad1; +- __u16 pad2; +- __u32 ifindex; +- __u32 filter_mask; +-}; +- +-/* A stats attribute can be netdev specific or a global stat. +- * For netdev stats, lets use the prefix IFLA_STATS_LINK_* +- */ +-enum { +- IFLA_STATS_UNSPEC, /* also used as 64bit pad attribute */ +- IFLA_STATS_LINK_64, +- IFLA_STATS_LINK_XSTATS, +- IFLA_STATS_LINK_XSTATS_SLAVE, +- IFLA_STATS_LINK_OFFLOAD_XSTATS, +- IFLA_STATS_AF_SPEC, +- __IFLA_STATS_MAX, +-}; +- +-#define IFLA_STATS_MAX (__IFLA_STATS_MAX - 1) +- +-#define IFLA_STATS_FILTER_BIT(ATTR) (1 << (ATTR - 1)) +- +-/* These are embedded into IFLA_STATS_LINK_XSTATS: +- * [IFLA_STATS_LINK_XSTATS] +- * -> [LINK_XSTATS_TYPE_xxx] +- * -> [rtnl link type specific attributes] +- */ +-enum { +- LINK_XSTATS_TYPE_UNSPEC, +- LINK_XSTATS_TYPE_BRIDGE, +- __LINK_XSTATS_TYPE_MAX +-}; +-#define LINK_XSTATS_TYPE_MAX (__LINK_XSTATS_TYPE_MAX - 1) +- +-/* These are stats embedded into IFLA_STATS_LINK_OFFLOAD_XSTATS */ +-enum { +- IFLA_OFFLOAD_XSTATS_UNSPEC, +- IFLA_OFFLOAD_XSTATS_CPU_HIT, /* struct rtnl_link_stats64 */ +- __IFLA_OFFLOAD_XSTATS_MAX +-}; +-#define IFLA_OFFLOAD_XSTATS_MAX (__IFLA_OFFLOAD_XSTATS_MAX - 1) +- +-/* XDP section */ +- +-#define XDP_FLAGS_UPDATE_IF_NOEXIST (1U << 0) +-#define XDP_FLAGS_SKB_MODE (1U << 1) +-#define XDP_FLAGS_DRV_MODE (1U << 2) +-#define XDP_FLAGS_HW_MODE (1U << 3) +-#define XDP_FLAGS_MODES (XDP_FLAGS_SKB_MODE | \ +- XDP_FLAGS_DRV_MODE | \ +- XDP_FLAGS_HW_MODE) +-#define XDP_FLAGS_MASK (XDP_FLAGS_UPDATE_IF_NOEXIST | \ +- XDP_FLAGS_MODES) +- +-/* These are stored into IFLA_XDP_ATTACHED on dump. */ +-enum { +- XDP_ATTACHED_NONE = 0, +- XDP_ATTACHED_DRV, +- XDP_ATTACHED_SKB, +- XDP_ATTACHED_HW, +-}; +- +-enum { +- IFLA_XDP_UNSPEC, +- IFLA_XDP_FD, +- IFLA_XDP_ATTACHED, +- IFLA_XDP_FLAGS, +- IFLA_XDP_PROG_ID, +- __IFLA_XDP_MAX, +-}; +- +-#define IFLA_XDP_MAX (__IFLA_XDP_MAX - 1) +- +-enum { +- IFLA_EVENT_NONE, +- IFLA_EVENT_REBOOT, /* internal reset / reboot */ +- IFLA_EVENT_FEATURES, /* change in offload features */ +- IFLA_EVENT_BONDING_FAILOVER, /* change in active slave */ +- IFLA_EVENT_NOTIFY_PEERS, /* re-sent grat. arp/ndisc */ +- IFLA_EVENT_IGMP_RESEND, /* re-sent IGMP JOIN */ +- IFLA_EVENT_BONDING_OPTIONS, /* change in bonding options */ +-}; +- +-#endif /* _LINUX_IF_LINK_H */ +diff --git a/include/linux/if_macsec.h b/include/linux/if_macsec.h +deleted file mode 100644 +index 22939a3..0000000 +--- a/include/linux/if_macsec.h ++++ /dev/null +@@ -1,171 +0,0 @@ +-/* +- * include/uapi/linux/if_macsec.h - MACsec device +- * +- * Copyright (c) 2015 Sabrina Dubroca +- * +- * This program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2 of the License, or +- * (at your option) any later version. +- */ +- +-#ifndef _MACSEC_H +-#define _MACSEC_H +- +-#include +- +-#define MACSEC_GENL_NAME "macsec" +-#define MACSEC_GENL_VERSION 1 +- +-#define MACSEC_MAX_KEY_LEN 128 +- +-#define MACSEC_KEYID_LEN 16 +- +-#define MACSEC_DEFAULT_CIPHER_ID 0x0080020001000001ULL +-#define MACSEC_DEFAULT_CIPHER_ALT 0x0080C20001000001ULL +- +-#define MACSEC_MIN_ICV_LEN 8 +-#define MACSEC_MAX_ICV_LEN 32 +-/* upper limit for ICV length as recommended by IEEE802.1AE-2006 */ +-#define MACSEC_STD_ICV_LEN 16 +- +-enum macsec_attrs { +- MACSEC_ATTR_UNSPEC, +- MACSEC_ATTR_IFINDEX, /* u32, ifindex of the MACsec netdevice */ +- MACSEC_ATTR_RXSC_CONFIG, /* config, nested macsec_rxsc_attrs */ +- MACSEC_ATTR_SA_CONFIG, /* config, nested macsec_sa_attrs */ +- MACSEC_ATTR_SECY, /* dump, nested macsec_secy_attrs */ +- MACSEC_ATTR_TXSA_LIST, /* dump, nested, macsec_sa_attrs for each TXSA */ +- MACSEC_ATTR_RXSC_LIST, /* dump, nested, macsec_rxsc_attrs for each RXSC */ +- MACSEC_ATTR_TXSC_STATS, /* dump, nested, macsec_txsc_stats_attr */ +- MACSEC_ATTR_SECY_STATS, /* dump, nested, macsec_secy_stats_attr */ +- __MACSEC_ATTR_END, +- NUM_MACSEC_ATTR = __MACSEC_ATTR_END, +- MACSEC_ATTR_MAX = __MACSEC_ATTR_END - 1, +-}; +- +-enum macsec_secy_attrs { +- MACSEC_SECY_ATTR_UNSPEC, +- MACSEC_SECY_ATTR_SCI, +- MACSEC_SECY_ATTR_ENCODING_SA, +- MACSEC_SECY_ATTR_WINDOW, +- MACSEC_SECY_ATTR_CIPHER_SUITE, +- MACSEC_SECY_ATTR_ICV_LEN, +- MACSEC_SECY_ATTR_PROTECT, +- MACSEC_SECY_ATTR_REPLAY, +- MACSEC_SECY_ATTR_OPER, +- MACSEC_SECY_ATTR_VALIDATE, +- MACSEC_SECY_ATTR_ENCRYPT, +- MACSEC_SECY_ATTR_INC_SCI, +- MACSEC_SECY_ATTR_ES, +- MACSEC_SECY_ATTR_SCB, +- MACSEC_SECY_ATTR_PAD, +- __MACSEC_SECY_ATTR_END, +- NUM_MACSEC_SECY_ATTR = __MACSEC_SECY_ATTR_END, +- MACSEC_SECY_ATTR_MAX = __MACSEC_SECY_ATTR_END - 1, +-}; +- +-enum macsec_rxsc_attrs { +- MACSEC_RXSC_ATTR_UNSPEC, +- MACSEC_RXSC_ATTR_SCI, /* config/dump, u64 */ +- MACSEC_RXSC_ATTR_ACTIVE, /* config/dump, u8 0..1 */ +- MACSEC_RXSC_ATTR_SA_LIST, /* dump, nested */ +- MACSEC_RXSC_ATTR_STATS, /* dump, nested, macsec_rxsc_stats_attr */ +- MACSEC_RXSC_ATTR_PAD, +- __MACSEC_RXSC_ATTR_END, +- NUM_MACSEC_RXSC_ATTR = __MACSEC_RXSC_ATTR_END, +- MACSEC_RXSC_ATTR_MAX = __MACSEC_RXSC_ATTR_END - 1, +-}; +- +-enum macsec_sa_attrs { +- MACSEC_SA_ATTR_UNSPEC, +- MACSEC_SA_ATTR_AN, /* config/dump, u8 0..3 */ +- MACSEC_SA_ATTR_ACTIVE, /* config/dump, u8 0..1 */ +- MACSEC_SA_ATTR_PN, /* config/dump, u32 */ +- MACSEC_SA_ATTR_KEY, /* config, data */ +- MACSEC_SA_ATTR_KEYID, /* config/dump, 128-bit */ +- MACSEC_SA_ATTR_STATS, /* dump, nested, macsec_sa_stats_attr */ +- MACSEC_SA_ATTR_PAD, +- __MACSEC_SA_ATTR_END, +- NUM_MACSEC_SA_ATTR = __MACSEC_SA_ATTR_END, +- MACSEC_SA_ATTR_MAX = __MACSEC_SA_ATTR_END - 1, +-}; +- +-enum macsec_nl_commands { +- MACSEC_CMD_GET_TXSC, +- MACSEC_CMD_ADD_RXSC, +- MACSEC_CMD_DEL_RXSC, +- MACSEC_CMD_UPD_RXSC, +- MACSEC_CMD_ADD_TXSA, +- MACSEC_CMD_DEL_TXSA, +- MACSEC_CMD_UPD_TXSA, +- MACSEC_CMD_ADD_RXSA, +- MACSEC_CMD_DEL_RXSA, +- MACSEC_CMD_UPD_RXSA, +-}; +- +-/* u64 per-RXSC stats */ +-enum macsec_rxsc_stats_attr { +- MACSEC_RXSC_STATS_ATTR_UNSPEC, +- MACSEC_RXSC_STATS_ATTR_IN_OCTETS_VALIDATED, +- MACSEC_RXSC_STATS_ATTR_IN_OCTETS_DECRYPTED, +- MACSEC_RXSC_STATS_ATTR_IN_PKTS_UNCHECKED, +- MACSEC_RXSC_STATS_ATTR_IN_PKTS_DELAYED, +- MACSEC_RXSC_STATS_ATTR_IN_PKTS_OK, +- MACSEC_RXSC_STATS_ATTR_IN_PKTS_INVALID, +- MACSEC_RXSC_STATS_ATTR_IN_PKTS_LATE, +- MACSEC_RXSC_STATS_ATTR_IN_PKTS_NOT_VALID, +- MACSEC_RXSC_STATS_ATTR_IN_PKTS_NOT_USING_SA, +- MACSEC_RXSC_STATS_ATTR_IN_PKTS_UNUSED_SA, +- MACSEC_RXSC_STATS_ATTR_PAD, +- __MACSEC_RXSC_STATS_ATTR_END, +- NUM_MACSEC_RXSC_STATS_ATTR = __MACSEC_RXSC_STATS_ATTR_END, +- MACSEC_RXSC_STATS_ATTR_MAX = __MACSEC_RXSC_STATS_ATTR_END - 1, +-}; +- +-/* u32 per-{RX,TX}SA stats */ +-enum macsec_sa_stats_attr { +- MACSEC_SA_STATS_ATTR_UNSPEC, +- MACSEC_SA_STATS_ATTR_IN_PKTS_OK, +- MACSEC_SA_STATS_ATTR_IN_PKTS_INVALID, +- MACSEC_SA_STATS_ATTR_IN_PKTS_NOT_VALID, +- MACSEC_SA_STATS_ATTR_IN_PKTS_NOT_USING_SA, +- MACSEC_SA_STATS_ATTR_IN_PKTS_UNUSED_SA, +- MACSEC_SA_STATS_ATTR_OUT_PKTS_PROTECTED, +- MACSEC_SA_STATS_ATTR_OUT_PKTS_ENCRYPTED, +- __MACSEC_SA_STATS_ATTR_END, +- NUM_MACSEC_SA_STATS_ATTR = __MACSEC_SA_STATS_ATTR_END, +- MACSEC_SA_STATS_ATTR_MAX = __MACSEC_SA_STATS_ATTR_END - 1, +-}; +- +-/* u64 per-TXSC stats */ +-enum macsec_txsc_stats_attr { +- MACSEC_TXSC_STATS_ATTR_UNSPEC, +- MACSEC_TXSC_STATS_ATTR_OUT_PKTS_PROTECTED, +- MACSEC_TXSC_STATS_ATTR_OUT_PKTS_ENCRYPTED, +- MACSEC_TXSC_STATS_ATTR_OUT_OCTETS_PROTECTED, +- MACSEC_TXSC_STATS_ATTR_OUT_OCTETS_ENCRYPTED, +- MACSEC_TXSC_STATS_ATTR_PAD, +- __MACSEC_TXSC_STATS_ATTR_END, +- NUM_MACSEC_TXSC_STATS_ATTR = __MACSEC_TXSC_STATS_ATTR_END, +- MACSEC_TXSC_STATS_ATTR_MAX = __MACSEC_TXSC_STATS_ATTR_END - 1, +-}; +- +-/* u64 per-SecY stats */ +-enum macsec_secy_stats_attr { +- MACSEC_SECY_STATS_ATTR_UNSPEC, +- MACSEC_SECY_STATS_ATTR_OUT_PKTS_UNTAGGED, +- MACSEC_SECY_STATS_ATTR_IN_PKTS_UNTAGGED, +- MACSEC_SECY_STATS_ATTR_OUT_PKTS_TOO_LONG, +- MACSEC_SECY_STATS_ATTR_IN_PKTS_NO_TAG, +- MACSEC_SECY_STATS_ATTR_IN_PKTS_BAD_TAG, +- MACSEC_SECY_STATS_ATTR_IN_PKTS_UNKNOWN_SCI, +- MACSEC_SECY_STATS_ATTR_IN_PKTS_NO_SCI, +- MACSEC_SECY_STATS_ATTR_IN_PKTS_OVERRUN, +- MACSEC_SECY_STATS_ATTR_PAD, +- __MACSEC_SECY_STATS_ATTR_END, +- NUM_MACSEC_SECY_STATS_ATTR = __MACSEC_SECY_STATS_ATTR_END, +- MACSEC_SECY_STATS_ATTR_MAX = __MACSEC_SECY_STATS_ATTR_END - 1, +-}; +- +-#endif /* _MACSEC_H */ +diff --git a/include/linux/if_packet.h b/include/linux/if_packet.h +deleted file mode 100644 +index 4df96a7..0000000 +--- a/include/linux/if_packet.h ++++ /dev/null +@@ -1,302 +0,0 @@ +-#ifndef __LINUX_IF_PACKET_H +-#define __LINUX_IF_PACKET_H +- +-#include +- +-struct sockaddr_pkt { +- unsigned short spkt_family; +- unsigned char spkt_device[14]; +- __be16 spkt_protocol; +-}; +- +-struct sockaddr_ll { +- unsigned short sll_family; +- __be16 sll_protocol; +- int sll_ifindex; +- unsigned short sll_hatype; +- unsigned char sll_pkttype; +- unsigned char sll_halen; +- unsigned char sll_addr[8]; +-}; +- +-/* Packet types */ +- +-#define PACKET_HOST 0 /* To us */ +-#define PACKET_BROADCAST 1 /* To all */ +-#define PACKET_MULTICAST 2 /* To group */ +-#define PACKET_OTHERHOST 3 /* To someone else */ +-#define PACKET_OUTGOING 4 /* Outgoing of any type */ +-#define PACKET_LOOPBACK 5 /* MC/BRD frame looped back */ +-#define PACKET_USER 6 /* To user space */ +-#define PACKET_KERNEL 7 /* To kernel space */ +-/* Unused, PACKET_FASTROUTE and PACKET_LOOPBACK are invisible to user space */ +-#define PACKET_FASTROUTE 6 /* Fastrouted frame */ +- +-/* Packet socket options */ +- +-#define PACKET_ADD_MEMBERSHIP 1 +-#define PACKET_DROP_MEMBERSHIP 2 +-#define PACKET_RECV_OUTPUT 3 +-/* Value 4 is still used by obsolete turbo-packet. */ +-#define PACKET_RX_RING 5 +-#define PACKET_STATISTICS 6 +-#define PACKET_COPY_THRESH 7 +-#define PACKET_AUXDATA 8 +-#define PACKET_ORIGDEV 9 +-#define PACKET_VERSION 10 +-#define PACKET_HDRLEN 11 +-#define PACKET_RESERVE 12 +-#define PACKET_TX_RING 13 +-#define PACKET_LOSS 14 +-#define PACKET_VNET_HDR 15 +-#define PACKET_TX_TIMESTAMP 16 +-#define PACKET_TIMESTAMP 17 +-#define PACKET_FANOUT 18 +-#define PACKET_TX_HAS_OFF 19 +-#define PACKET_QDISC_BYPASS 20 +-#define PACKET_ROLLOVER_STATS 21 +-#define PACKET_FANOUT_DATA 22 +- +-#define PACKET_FANOUT_HASH 0 +-#define PACKET_FANOUT_LB 1 +-#define PACKET_FANOUT_CPU 2 +-#define PACKET_FANOUT_ROLLOVER 3 +-#define PACKET_FANOUT_RND 4 +-#define PACKET_FANOUT_QM 5 +-#define PACKET_FANOUT_CBPF 6 +-#define PACKET_FANOUT_EBPF 7 +-#define PACKET_FANOUT_FLAG_ROLLOVER 0x1000 +-#define PACKET_FANOUT_FLAG_UNIQUEID 0x2000 +-#define PACKET_FANOUT_FLAG_DEFRAG 0x8000 +- +-struct tpacket_stats { +- unsigned int tp_packets; +- unsigned int tp_drops; +-}; +- +-struct tpacket_stats_v3 { +- unsigned int tp_packets; +- unsigned int tp_drops; +- unsigned int tp_freeze_q_cnt; +-}; +- +-struct tpacket_rollover_stats { +- __aligned_u64 tp_all; +- __aligned_u64 tp_huge; +- __aligned_u64 tp_failed; +-}; +- +-union tpacket_stats_u { +- struct tpacket_stats stats1; +- struct tpacket_stats_v3 stats3; +-}; +- +-struct tpacket_auxdata { +- __u32 tp_status; +- __u32 tp_len; +- __u32 tp_snaplen; +- __u16 tp_mac; +- __u16 tp_net; +- __u16 tp_vlan_tci; +- __u16 tp_vlan_tpid; +-}; +- +-/* Rx ring - header status */ +-#define TP_STATUS_KERNEL 0 +-#define TP_STATUS_USER (1 << 0) +-#define TP_STATUS_COPY (1 << 1) +-#define TP_STATUS_LOSING (1 << 2) +-#define TP_STATUS_CSUMNOTREADY (1 << 3) +-#define TP_STATUS_VLAN_VALID (1 << 4) /* auxdata has valid tp_vlan_tci */ +-#define TP_STATUS_BLK_TMO (1 << 5) +-#define TP_STATUS_VLAN_TPID_VALID (1 << 6) /* auxdata has valid tp_vlan_tpid */ +-#define TP_STATUS_CSUM_VALID (1 << 7) +- +-/* Tx ring - header status */ +-#define TP_STATUS_AVAILABLE 0 +-#define TP_STATUS_SEND_REQUEST (1 << 0) +-#define TP_STATUS_SENDING (1 << 1) +-#define TP_STATUS_WRONG_FORMAT (1 << 2) +- +-/* Rx and Tx ring - header status */ +-#define TP_STATUS_TS_SOFTWARE (1 << 29) +-#define TP_STATUS_TS_SYS_HARDWARE (1 << 30) /* deprecated, never set */ +-#define TP_STATUS_TS_RAW_HARDWARE (1 << 31) +- +-/* Rx ring - feature request bits */ +-#define TP_FT_REQ_FILL_RXHASH 0x1 +- +-struct tpacket_hdr { +- unsigned long tp_status; +- unsigned int tp_len; +- unsigned int tp_snaplen; +- unsigned short tp_mac; +- unsigned short tp_net; +- unsigned int tp_sec; +- unsigned int tp_usec; +-}; +- +-#define TPACKET_ALIGNMENT 16 +-#define TPACKET_ALIGN(x) (((x)+TPACKET_ALIGNMENT-1)&~(TPACKET_ALIGNMENT-1)) +-#define TPACKET_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket_hdr)) + sizeof(struct sockaddr_ll)) +- +-struct tpacket2_hdr { +- __u32 tp_status; +- __u32 tp_len; +- __u32 tp_snaplen; +- __u16 tp_mac; +- __u16 tp_net; +- __u32 tp_sec; +- __u32 tp_nsec; +- __u16 tp_vlan_tci; +- __u16 tp_vlan_tpid; +- __u8 tp_padding[4]; +-}; +- +-struct tpacket_hdr_variant1 { +- __u32 tp_rxhash; +- __u32 tp_vlan_tci; +- __u16 tp_vlan_tpid; +- __u16 tp_padding; +-}; +- +-struct tpacket3_hdr { +- __u32 tp_next_offset; +- __u32 tp_sec; +- __u32 tp_nsec; +- __u32 tp_snaplen; +- __u32 tp_len; +- __u32 tp_status; +- __u16 tp_mac; +- __u16 tp_net; +- /* pkt_hdr variants */ +- union { +- struct tpacket_hdr_variant1 hv1; +- }; +- __u8 tp_padding[8]; +-}; +- +-struct tpacket_bd_ts { +- unsigned int ts_sec; +- union { +- unsigned int ts_usec; +- unsigned int ts_nsec; +- }; +-}; +- +-struct tpacket_hdr_v1 { +- __u32 block_status; +- __u32 num_pkts; +- __u32 offset_to_first_pkt; +- +- /* Number of valid bytes (including padding) +- * blk_len <= tp_block_size +- */ +- __u32 blk_len; +- +- /* +- * Quite a few uses of sequence number: +- * 1. Make sure cache flush etc worked. +- * Well, one can argue - why not use the increasing ts below? +- * But look at 2. below first. +- * 2. When you pass around blocks to other user space decoders, +- * you can see which blk[s] is[are] outstanding etc. +- * 3. Validate kernel code. +- */ +- __aligned_u64 seq_num; +- +- /* +- * ts_last_pkt: +- * +- * Case 1. Block has 'N'(N >=1) packets and TMO'd(timed out) +- * ts_last_pkt == 'time-stamp of last packet' and NOT the +- * time when the timer fired and the block was closed. +- * By providing the ts of the last packet we can absolutely +- * guarantee that time-stamp wise, the first packet in the +- * next block will never precede the last packet of the +- * previous block. +- * Case 2. Block has zero packets and TMO'd +- * ts_last_pkt = time when the timer fired and the block +- * was closed. +- * Case 3. Block has 'N' packets and NO TMO. +- * ts_last_pkt = time-stamp of the last pkt in the block. +- * +- * ts_first_pkt: +- * Is always the time-stamp when the block was opened. +- * Case a) ZERO packets +- * No packets to deal with but atleast you know the +- * time-interval of this block. +- * Case b) Non-zero packets +- * Use the ts of the first packet in the block. +- * +- */ +- struct tpacket_bd_ts ts_first_pkt, ts_last_pkt; +-}; +- +-union tpacket_bd_header_u { +- struct tpacket_hdr_v1 bh1; +-}; +- +-struct tpacket_block_desc { +- __u32 version; +- __u32 offset_to_priv; +- union tpacket_bd_header_u hdr; +-}; +- +-#define TPACKET2_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket2_hdr)) + sizeof(struct sockaddr_ll)) +-#define TPACKET3_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket3_hdr)) + sizeof(struct sockaddr_ll)) +- +-enum tpacket_versions { +- TPACKET_V1, +- TPACKET_V2, +- TPACKET_V3 +-}; +- +-/* +- Frame structure: +- +- - Start. Frame must be aligned to TPACKET_ALIGNMENT=16 +- - struct tpacket_hdr +- - pad to TPACKET_ALIGNMENT=16 +- - struct sockaddr_ll +- - Gap, chosen so that packet data (Start+tp_net) alignes to TPACKET_ALIGNMENT=16 +- - Start+tp_mac: [ Optional MAC header ] +- - Start+tp_net: Packet data, aligned to TPACKET_ALIGNMENT=16. +- - Pad to align to TPACKET_ALIGNMENT=16 +- */ +- +-struct tpacket_req { +- unsigned int tp_block_size; /* Minimal size of contiguous block */ +- unsigned int tp_block_nr; /* Number of blocks */ +- unsigned int tp_frame_size; /* Size of frame */ +- unsigned int tp_frame_nr; /* Total number of frames */ +-}; +- +-struct tpacket_req3 { +- unsigned int tp_block_size; /* Minimal size of contiguous block */ +- unsigned int tp_block_nr; /* Number of blocks */ +- unsigned int tp_frame_size; /* Size of frame */ +- unsigned int tp_frame_nr; /* Total number of frames */ +- unsigned int tp_retire_blk_tov; /* timeout in msecs */ +- unsigned int tp_sizeof_priv; /* offset to private data area */ +- unsigned int tp_feature_req_word; +-}; +- +-union tpacket_req_u { +- struct tpacket_req req; +- struct tpacket_req3 req3; +-}; +- +-struct packet_mreq { +- int mr_ifindex; +- unsigned short mr_type; +- unsigned short mr_alen; +- unsigned char mr_address[8]; +-}; +- +-#define PACKET_MR_MULTICAST 0 +-#define PACKET_MR_PROMISC 1 +-#define PACKET_MR_ALLMULTI 2 +-#define PACKET_MR_UNICAST 3 +- +-#endif +diff --git a/include/linux/if_tun.h b/include/linux/if_tun.h +deleted file mode 100644 +index d5ecb42..0000000 +--- a/include/linux/if_tun.h ++++ /dev/null +@@ -1,107 +0,0 @@ +-/* +- * Universal TUN/TAP device driver. +- * Copyright (C) 1999-2000 Maxim Krasnyansky +- * +- * This program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2 of the License, or +- * (at your option) any later version. +- * +- * This program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- */ +- +-#ifndef __IF_TUN_H +-#define __IF_TUN_H +- +-#include +-#include +-#include +- +-/* Read queue size */ +-#define TUN_READQ_SIZE 500 +-/* TUN device type flags: deprecated. Use IFF_TUN/IFF_TAP instead. */ +-#define TUN_TUN_DEV IFF_TUN +-#define TUN_TAP_DEV IFF_TAP +-#define TUN_TYPE_MASK 0x000f +- +-/* Ioctl defines */ +-#define TUNSETNOCSUM _IOW('T', 200, int) +-#define TUNSETDEBUG _IOW('T', 201, int) +-#define TUNSETIFF _IOW('T', 202, int) +-#define TUNSETPERSIST _IOW('T', 203, int) +-#define TUNSETOWNER _IOW('T', 204, int) +-#define TUNSETLINK _IOW('T', 205, int) +-#define TUNSETGROUP _IOW('T', 206, int) +-#define TUNGETFEATURES _IOR('T', 207, unsigned int) +-#define TUNSETOFFLOAD _IOW('T', 208, unsigned int) +-#define TUNSETTXFILTER _IOW('T', 209, unsigned int) +-#define TUNGETIFF _IOR('T', 210, unsigned int) +-#define TUNGETSNDBUF _IOR('T', 211, int) +-#define TUNSETSNDBUF _IOW('T', 212, int) +-#define TUNATTACHFILTER _IOW('T', 213, struct sock_fprog) +-#define TUNDETACHFILTER _IOW('T', 214, struct sock_fprog) +-#define TUNGETVNETHDRSZ _IOR('T', 215, int) +-#define TUNSETVNETHDRSZ _IOW('T', 216, int) +-#define TUNSETQUEUE _IOW('T', 217, int) +-#define TUNSETIFINDEX _IOW('T', 218, unsigned int) +-#define TUNGETFILTER _IOR('T', 219, struct sock_fprog) +-#define TUNSETVNETLE _IOW('T', 220, int) +-#define TUNGETVNETLE _IOR('T', 221, int) +-/* The TUNSETVNETBE and TUNGETVNETBE ioctls are for cross-endian support on +- * little-endian hosts. Not all kernel configurations support them, but all +- * configurations that support SET also support GET. +- */ +-#define TUNSETVNETBE _IOW('T', 222, int) +-#define TUNGETVNETBE _IOR('T', 223, int) +- +-/* TUNSETIFF ifr flags */ +-#define IFF_TUN 0x0001 +-#define IFF_TAP 0x0002 +-#define IFF_NO_PI 0x1000 +-/* This flag has no real effect */ +-#define IFF_ONE_QUEUE 0x2000 +-#define IFF_VNET_HDR 0x4000 +-#define IFF_TUN_EXCL 0x8000 +-#define IFF_MULTI_QUEUE 0x0100 +-#define IFF_ATTACH_QUEUE 0x0200 +-#define IFF_DETACH_QUEUE 0x0400 +-/* read-only flag */ +-#define IFF_PERSIST 0x0800 +-#define IFF_NOFILTER 0x1000 +- +-/* Socket options */ +-#define TUN_TX_TIMESTAMP 1 +- +-/* Features for GSO (TUNSETOFFLOAD). */ +-#define TUN_F_CSUM 0x01 /* You can hand me unchecksummed packets. */ +-#define TUN_F_TSO4 0x02 /* I can handle TSO for IPv4 packets */ +-#define TUN_F_TSO6 0x04 /* I can handle TSO for IPv6 packets */ +-#define TUN_F_TSO_ECN 0x08 /* I can handle TSO with ECN bits. */ +-#define TUN_F_UFO 0x10 /* I can handle UFO packets */ +- +-/* Protocol info prepended to the packets (when IFF_NO_PI is not set) */ +-#define TUN_PKT_STRIP 0x0001 +-struct tun_pi { +- __u16 flags; +- __be16 proto; +-}; +- +-/* +- * Filter spec (used for SETXXFILTER ioctls) +- * This stuff is applicable only to the TAP (Ethernet) devices. +- * If the count is zero the filter is disabled and the driver accepts +- * all packets (promisc mode). +- * If the filter is enabled in order to accept broadcast packets +- * broadcast addr must be explicitly included in the addr list. +- */ +-#define TUN_FLT_ALLMULTI 0x0001 /* Accept all multicast packets */ +-struct tun_filter { +- __u16 flags; /* TUN_FLT_ flags see above */ +- __u16 count; /* Number of addresses */ +- __u8 addr[0][ETH_ALEN]; +-}; +- +-#endif /* __IF_TUN_H */ +diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h +deleted file mode 100644 +index 21834ca..0000000 +--- a/include/linux/if_tunnel.h ++++ /dev/null +@@ -1,158 +0,0 @@ +-#ifndef _IF_TUNNEL_H_ +-#define _IF_TUNNEL_H_ +- +-#include +-#include +-#include +-#include +-#include +- +- +-#define SIOCGETTUNNEL (SIOCDEVPRIVATE + 0) +-#define SIOCADDTUNNEL (SIOCDEVPRIVATE + 1) +-#define SIOCDELTUNNEL (SIOCDEVPRIVATE + 2) +-#define SIOCCHGTUNNEL (SIOCDEVPRIVATE + 3) +-#define SIOCGETPRL (SIOCDEVPRIVATE + 4) +-#define SIOCADDPRL (SIOCDEVPRIVATE + 5) +-#define SIOCDELPRL (SIOCDEVPRIVATE + 6) +-#define SIOCCHGPRL (SIOCDEVPRIVATE + 7) +-#define SIOCGET6RD (SIOCDEVPRIVATE + 8) +-#define SIOCADD6RD (SIOCDEVPRIVATE + 9) +-#define SIOCDEL6RD (SIOCDEVPRIVATE + 10) +-#define SIOCCHG6RD (SIOCDEVPRIVATE + 11) +- +-#define GRE_CSUM __cpu_to_be16(0x8000) +-#define GRE_ROUTING __cpu_to_be16(0x4000) +-#define GRE_KEY __cpu_to_be16(0x2000) +-#define GRE_SEQ __cpu_to_be16(0x1000) +-#define GRE_STRICT __cpu_to_be16(0x0800) +-#define GRE_REC __cpu_to_be16(0x0700) +-#define GRE_ACK __cpu_to_be16(0x0080) +-#define GRE_FLAGS __cpu_to_be16(0x0078) +-#define GRE_VERSION __cpu_to_be16(0x0007) +- +-#define GRE_IS_CSUM(f) ((f) & GRE_CSUM) +-#define GRE_IS_ROUTING(f) ((f) & GRE_ROUTING) +-#define GRE_IS_KEY(f) ((f) & GRE_KEY) +-#define GRE_IS_SEQ(f) ((f) & GRE_SEQ) +-#define GRE_IS_STRICT(f) ((f) & GRE_STRICT) +-#define GRE_IS_REC(f) ((f) & GRE_REC) +-#define GRE_IS_ACK(f) ((f) & GRE_ACK) +- +-#define GRE_VERSION_0 __cpu_to_be16(0x0000) +-#define GRE_VERSION_1 __cpu_to_be16(0x0001) +-#define GRE_PROTO_PPP __cpu_to_be16(0x880b) +-#define GRE_PPTP_KEY_MASK __cpu_to_be32(0xffff) +- +-struct ip_tunnel_parm { +- char name[IFNAMSIZ]; +- int link; +- __be16 i_flags; +- __be16 o_flags; +- __be32 i_key; +- __be32 o_key; +- struct iphdr iph; +-}; +- +-enum { +- IFLA_IPTUN_UNSPEC, +- IFLA_IPTUN_LINK, +- IFLA_IPTUN_LOCAL, +- IFLA_IPTUN_REMOTE, +- IFLA_IPTUN_TTL, +- IFLA_IPTUN_TOS, +- IFLA_IPTUN_ENCAP_LIMIT, +- IFLA_IPTUN_FLOWINFO, +- IFLA_IPTUN_FLAGS, +- IFLA_IPTUN_PROTO, +- IFLA_IPTUN_PMTUDISC, +- IFLA_IPTUN_6RD_PREFIX, +- IFLA_IPTUN_6RD_RELAY_PREFIX, +- IFLA_IPTUN_6RD_PREFIXLEN, +- IFLA_IPTUN_6RD_RELAY_PREFIXLEN, +- IFLA_IPTUN_ENCAP_TYPE, +- IFLA_IPTUN_ENCAP_FLAGS, +- IFLA_IPTUN_ENCAP_SPORT, +- IFLA_IPTUN_ENCAP_DPORT, +- IFLA_IPTUN_COLLECT_METADATA, +- IFLA_IPTUN_FWMARK, +- __IFLA_IPTUN_MAX, +-}; +-#define IFLA_IPTUN_MAX (__IFLA_IPTUN_MAX - 1) +- +-enum tunnel_encap_types { +- TUNNEL_ENCAP_NONE, +- TUNNEL_ENCAP_FOU, +- TUNNEL_ENCAP_GUE, +-}; +- +-#define TUNNEL_ENCAP_FLAG_CSUM (1<<0) +-#define TUNNEL_ENCAP_FLAG_CSUM6 (1<<1) +-#define TUNNEL_ENCAP_FLAG_REMCSUM (1<<2) +- +-/* SIT-mode i_flags */ +-#define SIT_ISATAP 0x0001 +- +-struct ip_tunnel_prl { +- __be32 addr; +- __u16 flags; +- __u16 __reserved; +- __u32 datalen; +- __u32 __reserved2; +- /* data follows */ +-}; +- +-/* PRL flags */ +-#define PRL_DEFAULT 0x0001 +- +-struct ip_tunnel_6rd { +- struct in6_addr prefix; +- __be32 relay_prefix; +- __u16 prefixlen; +- __u16 relay_prefixlen; +-}; +- +-enum { +- IFLA_GRE_UNSPEC, +- IFLA_GRE_LINK, +- IFLA_GRE_IFLAGS, +- IFLA_GRE_OFLAGS, +- IFLA_GRE_IKEY, +- IFLA_GRE_OKEY, +- IFLA_GRE_LOCAL, +- IFLA_GRE_REMOTE, +- IFLA_GRE_TTL, +- IFLA_GRE_TOS, +- IFLA_GRE_PMTUDISC, +- IFLA_GRE_ENCAP_LIMIT, +- IFLA_GRE_FLOWINFO, +- IFLA_GRE_FLAGS, +- IFLA_GRE_ENCAP_TYPE, +- IFLA_GRE_ENCAP_FLAGS, +- IFLA_GRE_ENCAP_SPORT, +- IFLA_GRE_ENCAP_DPORT, +- IFLA_GRE_COLLECT_METADATA, +- IFLA_GRE_IGNORE_DF, +- IFLA_GRE_FWMARK, +- IFLA_GRE_ERSPAN_INDEX, +- __IFLA_GRE_MAX, +-}; +- +-#define IFLA_GRE_MAX (__IFLA_GRE_MAX - 1) +- +-/* VTI-mode i_flags */ +-#define VTI_ISVTI ((__be16)0x0001) +- +-enum { +- IFLA_VTI_UNSPEC, +- IFLA_VTI_LINK, +- IFLA_VTI_IKEY, +- IFLA_VTI_OKEY, +- IFLA_VTI_LOCAL, +- IFLA_VTI_REMOTE, +- IFLA_VTI_FWMARK, +- __IFLA_VTI_MAX, +-}; +- +-#define IFLA_VTI_MAX (__IFLA_VTI_MAX - 1) +-#endif /* _IF_TUNNEL_H_ */ +diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h +deleted file mode 100644 +index 24ae007..0000000 +--- a/include/linux/if_vlan.h ++++ /dev/null +@@ -1,64 +0,0 @@ +-/* +- * VLAN An implementation of 802.1Q VLAN tagging. +- * +- * Authors: Ben Greear +- * +- * This program is free software; you can redistribute it and/or +- * modify it under the terms of the GNU General Public License +- * as published by the Free Software Foundation; either version +- * 2 of the License, or (at your option) any later version. +- * +- */ +- +-#ifndef _LINUX_IF_VLAN_H_ +-#define _LINUX_IF_VLAN_H_ +- +- +-/* VLAN IOCTLs are found in sockios.h */ +- +-/* Passed in vlan_ioctl_args structure to determine behaviour. */ +-enum vlan_ioctl_cmds { +- ADD_VLAN_CMD, +- DEL_VLAN_CMD, +- SET_VLAN_INGRESS_PRIORITY_CMD, +- SET_VLAN_EGRESS_PRIORITY_CMD, +- GET_VLAN_INGRESS_PRIORITY_CMD, +- GET_VLAN_EGRESS_PRIORITY_CMD, +- SET_VLAN_NAME_TYPE_CMD, +- SET_VLAN_FLAG_CMD, +- GET_VLAN_REALDEV_NAME_CMD, /* If this works, you know it's a VLAN device, btw */ +- GET_VLAN_VID_CMD /* Get the VID of this VLAN (specified by name) */ +-}; +- +-enum vlan_flags { +- VLAN_FLAG_REORDER_HDR = 0x1, +- VLAN_FLAG_GVRP = 0x2, +- VLAN_FLAG_LOOSE_BINDING = 0x4, +- VLAN_FLAG_MVRP = 0x8, +-}; +- +-enum vlan_name_types { +- VLAN_NAME_TYPE_PLUS_VID, /* Name will look like: vlan0005 */ +- VLAN_NAME_TYPE_RAW_PLUS_VID, /* name will look like: eth1.0005 */ +- VLAN_NAME_TYPE_PLUS_VID_NO_PAD, /* Name will look like: vlan5 */ +- VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD, /* Name will look like: eth0.5 */ +- VLAN_NAME_TYPE_HIGHEST +-}; +- +-struct vlan_ioctl_args { +- int cmd; /* Should be one of the vlan_ioctl_cmds enum above. */ +- char device1[24]; +- +- union { +- char device2[24]; +- int VID; +- unsigned int skb_priority; +- unsigned int name_type; +- unsigned int bind_type; +- unsigned int flag; /* Matches vlan_dev_priv flags */ +- } u; +- +- short vlan_qos; +-}; +- +-#endif /* _LINUX_IF_VLAN_H_ */ +diff --git a/include/linux/ife.h b/include/linux/ife.h +deleted file mode 100644 +index 2954da3..0000000 +--- a/include/linux/ife.h ++++ /dev/null +@@ -1,18 +0,0 @@ +-#ifndef __UAPI_IFE_H +-#define __UAPI_IFE_H +- +-#define IFE_METAHDRLEN 2 +- +-enum { +- IFE_META_SKBMARK = 1, +- IFE_META_HASHID, +- IFE_META_PRIO, +- IFE_META_QMAP, +- IFE_META_TCINDEX, +- __IFE_META_MAX +-}; +- +-/*Can be overridden at runtime by module option*/ +-#define IFE_META_MAX (__IFE_META_MAX - 1) +- +-#endif +diff --git a/include/linux/ila.h b/include/linux/ila.h +deleted file mode 100644 +index 7e328d7..0000000 +--- a/include/linux/ila.h ++++ /dev/null +@@ -1,45 +0,0 @@ +-/* ila.h - ILA Interface */ +- +-#ifndef _LINUX_ILA_H +-#define _LINUX_ILA_H +- +-/* NETLINK_GENERIC related info */ +-#define ILA_GENL_NAME "ila" +-#define ILA_GENL_VERSION 0x1 +- +-enum { +- ILA_ATTR_UNSPEC, +- ILA_ATTR_LOCATOR, /* u64 */ +- ILA_ATTR_IDENTIFIER, /* u64 */ +- ILA_ATTR_LOCATOR_MATCH, /* u64 */ +- ILA_ATTR_IFINDEX, /* s32 */ +- ILA_ATTR_DIR, /* u32 */ +- ILA_ATTR_PAD, +- ILA_ATTR_CSUM_MODE, /* u8 */ +- +- __ILA_ATTR_MAX, +-}; +- +-#define ILA_ATTR_MAX (__ILA_ATTR_MAX - 1) +- +-enum { +- ILA_CMD_UNSPEC, +- ILA_CMD_ADD, +- ILA_CMD_DEL, +- ILA_CMD_GET, +- +- __ILA_CMD_MAX, +-}; +- +-#define ILA_CMD_MAX (__ILA_CMD_MAX - 1) +- +-#define ILA_DIR_IN (1 << 0) +-#define ILA_DIR_OUT (1 << 1) +- +-enum { +- ILA_CSUM_ADJUST_TRANSPORT, +- ILA_CSUM_NEUTRAL_MAP, +- ILA_CSUM_NO_ACTION, +-}; +- +-#endif /* _LINUX_ILA_H */ +diff --git a/include/linux/in.h b/include/linux/in.h +deleted file mode 100644 +index 9439efa..0000000 +--- a/include/linux/in.h ++++ /dev/null +@@ -1,300 +0,0 @@ +-/* +- * INET An implementation of the TCP/IP protocol suite for the LINUX +- * operating system. INET is implemented using the BSD Socket +- * interface as the means of communication with the user level. +- * +- * Definitions of the Internet Protocol. +- * +- * Version: @(#)in.h 1.0.1 04/21/93 +- * +- * Authors: Original taken from the GNU Project file. +- * Fred N. van Kempen, +- * +- * This program is free software; you can redistribute it and/or +- * modify it under the terms of the GNU General Public License +- * as published by the Free Software Foundation; either version +- * 2 of the License, or (at your option) any later version. +- */ +-#ifndef _LINUX_IN_H +-#define _LINUX_IN_H +- +-#include +-#include +-#include +- +-#if __UAPI_DEF_IN_IPPROTO +-/* Standard well-defined IP protocols. */ +-enum { +- IPPROTO_IP = 0, /* Dummy protocol for TCP */ +-#define IPPROTO_IP IPPROTO_IP +- IPPROTO_ICMP = 1, /* Internet Control Message Protocol */ +-#define IPPROTO_ICMP IPPROTO_ICMP +- IPPROTO_IGMP = 2, /* Internet Group Management Protocol */ +-#define IPPROTO_IGMP IPPROTO_IGMP +- IPPROTO_IPIP = 4, /* IPIP tunnels (older KA9Q tunnels use 94) */ +-#define IPPROTO_IPIP IPPROTO_IPIP +- IPPROTO_TCP = 6, /* Transmission Control Protocol */ +-#define IPPROTO_TCP IPPROTO_TCP +- IPPROTO_EGP = 8, /* Exterior Gateway Protocol */ +-#define IPPROTO_EGP IPPROTO_EGP +- IPPROTO_PUP = 12, /* PUP protocol */ +-#define IPPROTO_PUP IPPROTO_PUP +- IPPROTO_UDP = 17, /* User Datagram Protocol */ +-#define IPPROTO_UDP IPPROTO_UDP +- IPPROTO_IDP = 22, /* XNS IDP protocol */ +-#define IPPROTO_IDP IPPROTO_IDP +- IPPROTO_TP = 29, /* SO Transport Protocol Class 4 */ +-#define IPPROTO_TP IPPROTO_TP +- IPPROTO_DCCP = 33, /* Datagram Congestion Control Protocol */ +-#define IPPROTO_DCCP IPPROTO_DCCP +- IPPROTO_IPV6 = 41, /* IPv6-in-IPv4 tunnelling */ +-#define IPPROTO_IPV6 IPPROTO_IPV6 +- IPPROTO_RSVP = 46, /* RSVP Protocol */ +-#define IPPROTO_RSVP IPPROTO_RSVP +- IPPROTO_GRE = 47, /* Cisco GRE tunnels (rfc 1701,1702) */ +-#define IPPROTO_GRE IPPROTO_GRE +- IPPROTO_ESP = 50, /* Encapsulation Security Payload protocol */ +-#define IPPROTO_ESP IPPROTO_ESP +- IPPROTO_AH = 51, /* Authentication Header protocol */ +-#define IPPROTO_AH IPPROTO_AH +- IPPROTO_MTP = 92, /* Multicast Transport Protocol */ +-#define IPPROTO_MTP IPPROTO_MTP +- IPPROTO_BEETPH = 94, /* IP option pseudo header for BEET */ +-#define IPPROTO_BEETPH IPPROTO_BEETPH +- IPPROTO_ENCAP = 98, /* Encapsulation Header */ +-#define IPPROTO_ENCAP IPPROTO_ENCAP +- IPPROTO_PIM = 103, /* Protocol Independent Multicast */ +-#define IPPROTO_PIM IPPROTO_PIM +- IPPROTO_COMP = 108, /* Compression Header Protocol */ +-#define IPPROTO_COMP IPPROTO_COMP +- IPPROTO_SCTP = 132, /* Stream Control Transport Protocol */ +-#define IPPROTO_SCTP IPPROTO_SCTP +- IPPROTO_UDPLITE = 136, /* UDP-Lite (RFC 3828) */ +-#define IPPROTO_UDPLITE IPPROTO_UDPLITE +- IPPROTO_MPLS = 137, /* MPLS in IP (RFC 4023) */ +-#define IPPROTO_MPLS IPPROTO_MPLS +- IPPROTO_RAW = 255, /* Raw IP packets */ +-#define IPPROTO_RAW IPPROTO_RAW +- IPPROTO_MAX +-}; +-#endif +- +-#if __UAPI_DEF_IN_ADDR +-/* Internet address. */ +-struct in_addr { +- __be32 s_addr; +-}; +-#endif +- +-#define IP_TOS 1 +-#define IP_TTL 2 +-#define IP_HDRINCL 3 +-#define IP_OPTIONS 4 +-#define IP_ROUTER_ALERT 5 +-#define IP_RECVOPTS 6 +-#define IP_RETOPTS 7 +-#define IP_PKTINFO 8 +-#define IP_PKTOPTIONS 9 +-#define IP_MTU_DISCOVER 10 +-#define IP_RECVERR 11 +-#define IP_RECVTTL 12 +-#define IP_RECVTOS 13 +-#define IP_MTU 14 +-#define IP_FREEBIND 15 +-#define IP_IPSEC_POLICY 16 +-#define IP_XFRM_POLICY 17 +-#define IP_PASSSEC 18 +-#define IP_TRANSPARENT 19 +- +-/* BSD compatibility */ +-#define IP_RECVRETOPTS IP_RETOPTS +- +-/* TProxy original addresses */ +-#define IP_ORIGDSTADDR 20 +-#define IP_RECVORIGDSTADDR IP_ORIGDSTADDR +- +-#define IP_MINTTL 21 +-#define IP_NODEFRAG 22 +-#define IP_CHECKSUM 23 +-#define IP_BIND_ADDRESS_NO_PORT 24 +-#define IP_RECVFRAGSIZE 25 +- +-/* IP_MTU_DISCOVER values */ +-#define IP_PMTUDISC_DONT 0 /* Never send DF frames */ +-#define IP_PMTUDISC_WANT 1 /* Use per route hints */ +-#define IP_PMTUDISC_DO 2 /* Always DF */ +-#define IP_PMTUDISC_PROBE 3 /* Ignore dst pmtu */ +-/* Always use interface mtu (ignores dst pmtu) but don't set DF flag. +- * Also incoming ICMP frag_needed notifications will be ignored on +- * this socket to prevent accepting spoofed ones. +- */ +-#define IP_PMTUDISC_INTERFACE 4 +-/* weaker version of IP_PMTUDISC_INTERFACE, which allos packets to get +- * fragmented if they exeed the interface mtu +- */ +-#define IP_PMTUDISC_OMIT 5 +- +-#define IP_MULTICAST_IF 32 +-#define IP_MULTICAST_TTL 33 +-#define IP_MULTICAST_LOOP 34 +-#define IP_ADD_MEMBERSHIP 35 +-#define IP_DROP_MEMBERSHIP 36 +-#define IP_UNBLOCK_SOURCE 37 +-#define IP_BLOCK_SOURCE 38 +-#define IP_ADD_SOURCE_MEMBERSHIP 39 +-#define IP_DROP_SOURCE_MEMBERSHIP 40 +-#define IP_MSFILTER 41 +-#define MCAST_JOIN_GROUP 42 +-#define MCAST_BLOCK_SOURCE 43 +-#define MCAST_UNBLOCK_SOURCE 44 +-#define MCAST_LEAVE_GROUP 45 +-#define MCAST_JOIN_SOURCE_GROUP 46 +-#define MCAST_LEAVE_SOURCE_GROUP 47 +-#define MCAST_MSFILTER 48 +-#define IP_MULTICAST_ALL 49 +-#define IP_UNICAST_IF 50 +- +-#define MCAST_EXCLUDE 0 +-#define MCAST_INCLUDE 1 +- +-/* These need to appear somewhere around here */ +-#define IP_DEFAULT_MULTICAST_TTL 1 +-#define IP_DEFAULT_MULTICAST_LOOP 1 +- +-/* Request struct for multicast socket ops */ +- +-#if __UAPI_DEF_IP_MREQ +-struct ip_mreq { +- struct in_addr imr_multiaddr; /* IP multicast address of group */ +- struct in_addr imr_interface; /* local IP address of interface */ +-}; +- +-struct ip_mreqn { +- struct in_addr imr_multiaddr; /* IP multicast address of group */ +- struct in_addr imr_address; /* local IP address of interface */ +- int imr_ifindex; /* Interface index */ +-}; +- +-struct ip_mreq_source { +- __be32 imr_multiaddr; +- __be32 imr_interface; +- __be32 imr_sourceaddr; +-}; +- +-struct ip_msfilter { +- __be32 imsf_multiaddr; +- __be32 imsf_interface; +- __u32 imsf_fmode; +- __u32 imsf_numsrc; +- __be32 imsf_slist[1]; +-}; +- +-#define IP_MSFILTER_SIZE(numsrc) \ +- (sizeof(struct ip_msfilter) - sizeof(__u32) \ +- + (numsrc) * sizeof(__u32)) +- +-struct group_req { +- __u32 gr_interface; /* interface index */ +- struct __kernel_sockaddr_storage gr_group; /* group address */ +-}; +- +-struct group_source_req { +- __u32 gsr_interface; /* interface index */ +- struct __kernel_sockaddr_storage gsr_group; /* group address */ +- struct __kernel_sockaddr_storage gsr_source; /* source address */ +-}; +- +-struct group_filter { +- __u32 gf_interface; /* interface index */ +- struct __kernel_sockaddr_storage gf_group; /* multicast address */ +- __u32 gf_fmode; /* filter mode */ +- __u32 gf_numsrc; /* number of sources */ +- struct __kernel_sockaddr_storage gf_slist[1]; /* interface index */ +-}; +- +-#define GROUP_FILTER_SIZE(numsrc) \ +- (sizeof(struct group_filter) - sizeof(struct __kernel_sockaddr_storage) \ +- + (numsrc) * sizeof(struct __kernel_sockaddr_storage)) +-#endif +- +-#if __UAPI_DEF_IN_PKTINFO +-struct in_pktinfo { +- int ipi_ifindex; +- struct in_addr ipi_spec_dst; +- struct in_addr ipi_addr; +-}; +-#endif +- +-/* Structure describing an Internet (IP) socket address. */ +-#if __UAPI_DEF_SOCKADDR_IN +-#define __SOCK_SIZE__ 16 /* sizeof(struct sockaddr) */ +-struct sockaddr_in { +- __kernel_sa_family_t sin_family; /* Address family */ +- __be16 sin_port; /* Port number */ +- struct in_addr sin_addr; /* Internet address */ +- +- /* Pad to size of `struct sockaddr'. */ +- unsigned char __pad[__SOCK_SIZE__ - sizeof(short int) - +- sizeof(unsigned short int) - sizeof(struct in_addr)]; +-}; +-#define sin_zero __pad /* for BSD UNIX comp. -FvK */ +-#endif +- +-#if __UAPI_DEF_IN_CLASS +-/* +- * Definitions of the bits in an Internet address integer. +- * On subnets, host and network parts are found according +- * to the subnet mask, not these masks. +- */ +-#define IN_CLASSA(a) ((((long int) (a)) & 0x80000000) == 0) +-#define IN_CLASSA_NET 0xff000000 +-#define IN_CLASSA_NSHIFT 24 +-#define IN_CLASSA_HOST (0xffffffff & ~IN_CLASSA_NET) +-#define IN_CLASSA_MAX 128 +- +-#define IN_CLASSB(a) ((((long int) (a)) & 0xc0000000) == 0x80000000) +-#define IN_CLASSB_NET 0xffff0000 +-#define IN_CLASSB_NSHIFT 16 +-#define IN_CLASSB_HOST (0xffffffff & ~IN_CLASSB_NET) +-#define IN_CLASSB_MAX 65536 +- +-#define IN_CLASSC(a) ((((long int) (a)) & 0xe0000000) == 0xc0000000) +-#define IN_CLASSC_NET 0xffffff00 +-#define IN_CLASSC_NSHIFT 8 +-#define IN_CLASSC_HOST (0xffffffff & ~IN_CLASSC_NET) +- +-#define IN_CLASSD(a) ((((long int) (a)) & 0xf0000000) == 0xe0000000) +-#define IN_MULTICAST(a) IN_CLASSD(a) +-#define IN_MULTICAST_NET 0xF0000000 +- +-#define IN_EXPERIMENTAL(a) ((((long int) (a)) & 0xf0000000) == 0xf0000000) +-#define IN_BADCLASS(a) IN_EXPERIMENTAL((a)) +- +-/* Address to accept any incoming messages. */ +-#define INADDR_ANY ((unsigned long int) 0x00000000) +- +-/* Address to send to all hosts. */ +-#define INADDR_BROADCAST ((unsigned long int) 0xffffffff) +- +-/* Address indicating an error return. */ +-#define INADDR_NONE ((unsigned long int) 0xffffffff) +- +-/* Network number for local host loopback. */ +-#define IN_LOOPBACKNET 127 +- +-/* Address to loopback in software to local host. */ +-#define INADDR_LOOPBACK 0x7f000001 /* 127.0.0.1 */ +-#define IN_LOOPBACK(a) ((((long int) (a)) & 0xff000000) == 0x7f000000) +- +-/* Defines for Multicast INADDR */ +-#define INADDR_UNSPEC_GROUP 0xe0000000U /* 224.0.0.0 */ +-#define INADDR_ALLHOSTS_GROUP 0xe0000001U /* 224.0.0.1 */ +-#define INADDR_ALLRTRS_GROUP 0xe0000002U /* 224.0.0.2 */ +-#define INADDR_MAX_LOCAL_GROUP 0xe00000ffU /* 224.0.0.255 */ +-#endif +- +-/* contains the htonl type stuff.. */ +-#include +- +- +-#endif /* _LINUX_IN_H */ +diff --git a/include/linux/in6.h b/include/linux/in6.h +deleted file mode 100644 +index 6f3bdee..0000000 +--- a/include/linux/in6.h ++++ /dev/null +@@ -1,296 +0,0 @@ +-/* +- * Types and definitions for AF_INET6 +- * Linux INET6 implementation +- * +- * Authors: +- * Pedro Roque +- * +- * Sources: +- * IPv6 Program Interfaces for BSD Systems +- * +- * +- * Advanced Sockets API for IPv6 +- * +- * +- * This program is free software; you can redistribute it and/or +- * modify it under the terms of the GNU General Public License +- * as published by the Free Software Foundation; either version +- * 2 of the License, or (at your option) any later version. +- */ +- +-#ifndef _LINUX_IN6_H +-#define _LINUX_IN6_H +- +-#include +-#include +- +-/* +- * IPv6 address structure +- */ +- +-#if __UAPI_DEF_IN6_ADDR +-struct in6_addr { +- union { +- __u8 u6_addr8[16]; +-#if __UAPI_DEF_IN6_ADDR_ALT +- __be16 u6_addr16[8]; +- __be32 u6_addr32[4]; +-#endif +- } in6_u; +-#define s6_addr in6_u.u6_addr8 +-#if __UAPI_DEF_IN6_ADDR_ALT +-#define s6_addr16 in6_u.u6_addr16 +-#define s6_addr32 in6_u.u6_addr32 +-#endif +-}; +-#endif /* __UAPI_DEF_IN6_ADDR */ +- +-#if __UAPI_DEF_SOCKADDR_IN6 +-struct sockaddr_in6 { +- unsigned short int sin6_family; /* AF_INET6 */ +- __be16 sin6_port; /* Transport layer port # */ +- __be32 sin6_flowinfo; /* IPv6 flow information */ +- struct in6_addr sin6_addr; /* IPv6 address */ +- __u32 sin6_scope_id; /* scope id (new in RFC2553) */ +-}; +-#endif /* __UAPI_DEF_SOCKADDR_IN6 */ +- +-#if __UAPI_DEF_IPV6_MREQ +-struct ipv6_mreq { +- /* IPv6 multicast address of group */ +- struct in6_addr ipv6mr_multiaddr; +- +- /* local IPv6 address of interface */ +- int ipv6mr_ifindex; +-}; +-#endif /* __UAPI_DEF_IVP6_MREQ */ +- +-#define ipv6mr_acaddr ipv6mr_multiaddr +- +-struct in6_flowlabel_req { +- struct in6_addr flr_dst; +- __be32 flr_label; +- __u8 flr_action; +- __u8 flr_share; +- __u16 flr_flags; +- __u16 flr_expires; +- __u16 flr_linger; +- __u32 __flr_pad; +- /* Options in format of IPV6_PKTOPTIONS */ +-}; +- +-#define IPV6_FL_A_GET 0 +-#define IPV6_FL_A_PUT 1 +-#define IPV6_FL_A_RENEW 2 +- +-#define IPV6_FL_F_CREATE 1 +-#define IPV6_FL_F_EXCL 2 +-#define IPV6_FL_F_REFLECT 4 +-#define IPV6_FL_F_REMOTE 8 +- +-#define IPV6_FL_S_NONE 0 +-#define IPV6_FL_S_EXCL 1 +-#define IPV6_FL_S_PROCESS 2 +-#define IPV6_FL_S_USER 3 +-#define IPV6_FL_S_ANY 255 +- +- +-/* +- * Bitmask constant declarations to help applications select out the +- * flow label and priority fields. +- * +- * Note that this are in host byte order while the flowinfo field of +- * sockaddr_in6 is in network byte order. +- */ +- +-#define IPV6_FLOWINFO_FLOWLABEL 0x000fffff +-#define IPV6_FLOWINFO_PRIORITY 0x0ff00000 +- +-/* These definitions are obsolete */ +-#define IPV6_PRIORITY_UNCHARACTERIZED 0x0000 +-#define IPV6_PRIORITY_FILLER 0x0100 +-#define IPV6_PRIORITY_UNATTENDED 0x0200 +-#define IPV6_PRIORITY_RESERVED1 0x0300 +-#define IPV6_PRIORITY_BULK 0x0400 +-#define IPV6_PRIORITY_RESERVED2 0x0500 +-#define IPV6_PRIORITY_INTERACTIVE 0x0600 +-#define IPV6_PRIORITY_CONTROL 0x0700 +-#define IPV6_PRIORITY_8 0x0800 +-#define IPV6_PRIORITY_9 0x0900 +-#define IPV6_PRIORITY_10 0x0a00 +-#define IPV6_PRIORITY_11 0x0b00 +-#define IPV6_PRIORITY_12 0x0c00 +-#define IPV6_PRIORITY_13 0x0d00 +-#define IPV6_PRIORITY_14 0x0e00 +-#define IPV6_PRIORITY_15 0x0f00 +- +-/* +- * IPV6 extension headers +- */ +-#if __UAPI_DEF_IPPROTO_V6 +-#define IPPROTO_HOPOPTS 0 /* IPv6 hop-by-hop options */ +-#define IPPROTO_ROUTING 43 /* IPv6 routing header */ +-#define IPPROTO_FRAGMENT 44 /* IPv6 fragmentation header */ +-#define IPPROTO_ICMPV6 58 /* ICMPv6 */ +-#define IPPROTO_NONE 59 /* IPv6 no next header */ +-#define IPPROTO_DSTOPTS 60 /* IPv6 destination options */ +-#define IPPROTO_MH 135 /* IPv6 mobility header */ +-#endif /* __UAPI_DEF_IPPROTO_V6 */ +- +-/* +- * IPv6 TLV options. +- */ +-#define IPV6_TLV_PAD1 0 +-#define IPV6_TLV_PADN 1 +-#define IPV6_TLV_ROUTERALERT 5 +-#define IPV6_TLV_CALIPSO 7 /* RFC 5570 */ +-#define IPV6_TLV_JUMBO 194 +-#define IPV6_TLV_HAO 201 /* home address option */ +- +-/* +- * IPV6 socket options +- */ +-#if __UAPI_DEF_IPV6_OPTIONS +-#define IPV6_ADDRFORM 1 +-#define IPV6_2292PKTINFO 2 +-#define IPV6_2292HOPOPTS 3 +-#define IPV6_2292DSTOPTS 4 +-#define IPV6_2292RTHDR 5 +-#define IPV6_2292PKTOPTIONS 6 +-#define IPV6_CHECKSUM 7 +-#define IPV6_2292HOPLIMIT 8 +-#define IPV6_NEXTHOP 9 +-#define IPV6_AUTHHDR 10 /* obsolete */ +-#define IPV6_FLOWINFO 11 +- +-#define IPV6_UNICAST_HOPS 16 +-#define IPV6_MULTICAST_IF 17 +-#define IPV6_MULTICAST_HOPS 18 +-#define IPV6_MULTICAST_LOOP 19 +-#define IPV6_ADD_MEMBERSHIP 20 +-#define IPV6_DROP_MEMBERSHIP 21 +-#define IPV6_ROUTER_ALERT 22 +-#define IPV6_MTU_DISCOVER 23 +-#define IPV6_MTU 24 +-#define IPV6_RECVERR 25 +-#define IPV6_V6ONLY 26 +-#define IPV6_JOIN_ANYCAST 27 +-#define IPV6_LEAVE_ANYCAST 28 +- +-/* IPV6_MTU_DISCOVER values */ +-#define IPV6_PMTUDISC_DONT 0 +-#define IPV6_PMTUDISC_WANT 1 +-#define IPV6_PMTUDISC_DO 2 +-#define IPV6_PMTUDISC_PROBE 3 +-/* same as IPV6_PMTUDISC_PROBE, provided for symetry with IPv4 +- * also see comments on IP_PMTUDISC_INTERFACE +- */ +-#define IPV6_PMTUDISC_INTERFACE 4 +-/* weaker version of IPV6_PMTUDISC_INTERFACE, which allows packets to +- * get fragmented if they exceed the interface mtu +- */ +-#define IPV6_PMTUDISC_OMIT 5 +- +-/* Flowlabel */ +-#define IPV6_FLOWLABEL_MGR 32 +-#define IPV6_FLOWINFO_SEND 33 +- +-#define IPV6_IPSEC_POLICY 34 +-#define IPV6_XFRM_POLICY 35 +-#define IPV6_HDRINCL 36 +-#endif +- +-/* +- * Multicast: +- * Following socket options are shared between IPv4 and IPv6. +- * +- * MCAST_JOIN_GROUP 42 +- * MCAST_BLOCK_SOURCE 43 +- * MCAST_UNBLOCK_SOURCE 44 +- * MCAST_LEAVE_GROUP 45 +- * MCAST_JOIN_SOURCE_GROUP 46 +- * MCAST_LEAVE_SOURCE_GROUP 47 +- * MCAST_MSFILTER 48 +- */ +- +-/* +- * Advanced API (RFC3542) (1) +- * +- * Note: IPV6_RECVRTHDRDSTOPTS does not exist. see net/ipv6/datagram.c. +- */ +- +-#define IPV6_RECVPKTINFO 49 +-#define IPV6_PKTINFO 50 +-#define IPV6_RECVHOPLIMIT 51 +-#define IPV6_HOPLIMIT 52 +-#define IPV6_RECVHOPOPTS 53 +-#define IPV6_HOPOPTS 54 +-#define IPV6_RTHDRDSTOPTS 55 +-#define IPV6_RECVRTHDR 56 +-#define IPV6_RTHDR 57 +-#define IPV6_RECVDSTOPTS 58 +-#define IPV6_DSTOPTS 59 +-#define IPV6_RECVPATHMTU 60 +-#define IPV6_PATHMTU 61 +-#define IPV6_DONTFRAG 62 +-#if 0 /* not yet */ +-#define IPV6_USE_MIN_MTU 63 +-#endif +- +-/* +- * Netfilter (1) +- * +- * Following socket options are used in ip6_tables; +- * see include/linux/netfilter_ipv6/ip6_tables.h. +- * +- * IP6T_SO_SET_REPLACE / IP6T_SO_GET_INFO 64 +- * IP6T_SO_SET_ADD_COUNTERS / IP6T_SO_GET_ENTRIES 65 +- */ +- +-/* +- * Advanced API (RFC3542) (2) +- */ +-#define IPV6_RECVTCLASS 66 +-#define IPV6_TCLASS 67 +- +-/* +- * Netfilter (2) +- * +- * Following socket options are used in ip6_tables; +- * see include/linux/netfilter_ipv6/ip6_tables.h. +- * +- * IP6T_SO_GET_REVISION_MATCH 68 +- * IP6T_SO_GET_REVISION_TARGET 69 +- * IP6T_SO_ORIGINAL_DST 80 +- */ +- +-#define IPV6_AUTOFLOWLABEL 70 +-/* RFC5014: Source address selection */ +-#define IPV6_ADDR_PREFERENCES 72 +- +-#define IPV6_PREFER_SRC_TMP 0x0001 +-#define IPV6_PREFER_SRC_PUBLIC 0x0002 +-#define IPV6_PREFER_SRC_PUBTMP_DEFAULT 0x0100 +-#define IPV6_PREFER_SRC_COA 0x0004 +-#define IPV6_PREFER_SRC_HOME 0x0400 +-#define IPV6_PREFER_SRC_CGA 0x0008 +-#define IPV6_PREFER_SRC_NONCGA 0x0800 +- +-/* RFC5082: Generalized Ttl Security Mechanism */ +-#define IPV6_MINHOPCOUNT 73 +- +-#define IPV6_ORIGDSTADDR 74 +-#define IPV6_RECVORIGDSTADDR IPV6_ORIGDSTADDR +-#define IPV6_TRANSPARENT 75 +-#define IPV6_UNICAST_IF 76 +-#define IPV6_RECVFRAGSIZE 77 +- +-/* +- * Multicast Routing: +- * see include/uapi/linux/mroute6.h. +- * +- * MRT6_BASE 200 +- * ... +- * MRT6_MAX +- */ +-#endif /* _LINUX_IN6_H */ +diff --git a/include/linux/in_route.h b/include/linux/in_route.h +deleted file mode 100644 +index b261b8c..0000000 +--- a/include/linux/in_route.h ++++ /dev/null +@@ -1,32 +0,0 @@ +-#ifndef _LINUX_IN_ROUTE_H +-#define _LINUX_IN_ROUTE_H +- +-/* IPv4 routing cache flags */ +- +-#define RTCF_DEAD RTNH_F_DEAD +-#define RTCF_ONLINK RTNH_F_ONLINK +- +-/* Obsolete flag. About to be deleted */ +-#define RTCF_NOPMTUDISC RTM_F_NOPMTUDISC +- +-#define RTCF_NOTIFY 0x00010000 +-#define RTCF_DIRECTDST 0x00020000 /* unused */ +-#define RTCF_REDIRECTED 0x00040000 +-#define RTCF_TPROXY 0x00080000 /* unused */ +- +-#define RTCF_FAST 0x00200000 /* unused */ +-#define RTCF_MASQ 0x00400000 /* unused */ +-#define RTCF_SNAT 0x00800000 /* unused */ +-#define RTCF_DOREDIRECT 0x01000000 +-#define RTCF_DIRECTSRC 0x04000000 +-#define RTCF_DNAT 0x08000000 +-#define RTCF_BROADCAST 0x10000000 +-#define RTCF_MULTICAST 0x20000000 +-#define RTCF_REJECT 0x40000000 /* unused */ +-#define RTCF_LOCAL 0x80000000 +- +-#define RTCF_NAT (RTCF_DNAT|RTCF_SNAT) +- +-#define RT_TOS(tos) ((tos)&IPTOS_TOS_MASK) +- +-#endif /* _LINUX_IN_ROUTE_H */ +diff --git a/include/linux/inet_diag.h b/include/linux/inet_diag.h +deleted file mode 100644 +index bada4d7..0000000 +--- a/include/linux/inet_diag.h ++++ /dev/null +@@ -1,196 +0,0 @@ +-#ifndef _INET_DIAG_H_ +-#define _INET_DIAG_H_ +- +-#include +- +-/* Just some random number */ +-#define TCPDIAG_GETSOCK 18 +-#define DCCPDIAG_GETSOCK 19 +- +-#define INET_DIAG_GETSOCK_MAX 24 +- +-/* Socket identity */ +-struct inet_diag_sockid { +- __be16 idiag_sport; +- __be16 idiag_dport; +- __be32 idiag_src[4]; +- __be32 idiag_dst[4]; +- __u32 idiag_if; +- __u32 idiag_cookie[2]; +-#define INET_DIAG_NOCOOKIE (~0U) +-}; +- +-/* Request structure */ +- +-struct inet_diag_req { +- __u8 idiag_family; /* Family of addresses. */ +- __u8 idiag_src_len; +- __u8 idiag_dst_len; +- __u8 idiag_ext; /* Query extended information */ +- +- struct inet_diag_sockid id; +- +- __u32 idiag_states; /* States to dump */ +- __u32 idiag_dbs; /* Tables to dump (NI) */ +-}; +- +-struct inet_diag_req_v2 { +- __u8 sdiag_family; +- __u8 sdiag_protocol; +- __u8 idiag_ext; +- __u8 pad; +- __u32 idiag_states; +- struct inet_diag_sockid id; +-}; +- +-/* +- * SOCK_RAW sockets require the underlied protocol to be +- * additionally specified so we can use @pad member for +- * this, but we can't rename it because userspace programs +- * still may depend on this name. Instead lets use another +- * structure definition as an alias for struct +- * @inet_diag_req_v2. +- */ +-struct inet_diag_req_raw { +- __u8 sdiag_family; +- __u8 sdiag_protocol; +- __u8 idiag_ext; +- __u8 sdiag_raw_protocol; +- __u32 idiag_states; +- struct inet_diag_sockid id; +-}; +- +-enum { +- INET_DIAG_REQ_NONE, +- INET_DIAG_REQ_BYTECODE, +-}; +- +-#define INET_DIAG_REQ_MAX INET_DIAG_REQ_BYTECODE +- +-/* Bytecode is sequence of 4 byte commands followed by variable arguments. +- * All the commands identified by "code" are conditional jumps forward: +- * to offset cc+"yes" or to offset cc+"no". "yes" is supposed to be +- * length of the command and its arguments. +- */ +- +-struct inet_diag_bc_op { +- unsigned char code; +- unsigned char yes; +- unsigned short no; +-}; +- +-enum { +- INET_DIAG_BC_NOP, +- INET_DIAG_BC_JMP, +- INET_DIAG_BC_S_GE, +- INET_DIAG_BC_S_LE, +- INET_DIAG_BC_D_GE, +- INET_DIAG_BC_D_LE, +- INET_DIAG_BC_AUTO, +- INET_DIAG_BC_S_COND, +- INET_DIAG_BC_D_COND, +- INET_DIAG_BC_DEV_COND, /* u32 ifindex */ +- INET_DIAG_BC_MARK_COND, +-}; +- +-struct inet_diag_hostcond { +- __u8 family; +- __u8 prefix_len; +- int port; +- __be32 addr[0]; +-}; +- +-struct inet_diag_markcond { +- __u32 mark; +- __u32 mask; +-}; +- +-/* Base info structure. It contains socket identity (addrs/ports/cookie) +- * and, alas, the information shown by netstat. */ +-struct inet_diag_msg { +- __u8 idiag_family; +- __u8 idiag_state; +- __u8 idiag_timer; +- __u8 idiag_retrans; +- +- struct inet_diag_sockid id; +- +- __u32 idiag_expires; +- __u32 idiag_rqueue; +- __u32 idiag_wqueue; +- __u32 idiag_uid; +- __u32 idiag_inode; +-}; +- +-/* Extensions */ +- +-enum { +- INET_DIAG_NONE, +- INET_DIAG_MEMINFO, +- INET_DIAG_INFO, +- INET_DIAG_VEGASINFO, +- INET_DIAG_CONG, +- INET_DIAG_TOS, +- INET_DIAG_TCLASS, +- INET_DIAG_SKMEMINFO, +- INET_DIAG_SHUTDOWN, +- INET_DIAG_DCTCPINFO, +- INET_DIAG_PROTOCOL, /* response attribute only */ +- INET_DIAG_SKV6ONLY, +- INET_DIAG_LOCALS, +- INET_DIAG_PEERS, +- INET_DIAG_PAD, +- INET_DIAG_MARK, +- INET_DIAG_BBRINFO, +- INET_DIAG_CLASS_ID, +- INET_DIAG_MD5SIG, +- __INET_DIAG_MAX, +-}; +- +-#define INET_DIAG_MAX (__INET_DIAG_MAX - 1) +- +-/* INET_DIAG_MEM */ +- +-struct inet_diag_meminfo { +- __u32 idiag_rmem; +- __u32 idiag_wmem; +- __u32 idiag_fmem; +- __u32 idiag_tmem; +-}; +- +-/* INET_DIAG_VEGASINFO */ +- +-struct tcpvegas_info { +- __u32 tcpv_enabled; +- __u32 tcpv_rttcnt; +- __u32 tcpv_rtt; +- __u32 tcpv_minrtt; +-}; +- +-/* INET_DIAG_DCTCPINFO */ +- +-struct tcp_dctcp_info { +- __u16 dctcp_enabled; +- __u16 dctcp_ce_state; +- __u32 dctcp_alpha; +- __u32 dctcp_ab_ecn; +- __u32 dctcp_ab_tot; +-}; +- +-/* INET_DIAG_BBRINFO */ +- +-struct tcp_bbr_info { +- /* u64 bw: max-filtered BW (app throughput) estimate in Byte per sec: */ +- __u32 bbr_bw_lo; /* lower 32 bits of bw */ +- __u32 bbr_bw_hi; /* upper 32 bits of bw */ +- __u32 bbr_min_rtt; /* min-filtered RTT in uSec */ +- __u32 bbr_pacing_gain; /* pacing gain shifted left 8 bits */ +- __u32 bbr_cwnd_gain; /* cwnd gain shifted left 8 bits */ +-}; +- +-union tcp_cc_info { +- struct tcpvegas_info vegas; +- struct tcp_dctcp_info dctcp; +- struct tcp_bbr_info bbr; +-}; +-#endif /* _INET_DIAG_H_ */ +diff --git a/include/linux/ip.h b/include/linux/ip.h +deleted file mode 100644 +index 1907284..0000000 +--- a/include/linux/ip.h ++++ /dev/null +@@ -1,175 +0,0 @@ +-/* +- * INET An implementation of the TCP/IP protocol suite for the LINUX +- * operating system. INET is implemented using the BSD Socket +- * interface as the means of communication with the user level. +- * +- * Definitions for the IP protocol. +- * +- * Version: @(#)ip.h 1.0.2 04/28/93 +- * +- * Authors: Fred N. van Kempen, +- * +- * This program is free software; you can redistribute it and/or +- * modify it under the terms of the GNU General Public License +- * as published by the Free Software Foundation; either version +- * 2 of the License, or (at your option) any later version. +- */ +-#ifndef _LINUX_IP_H +-#define _LINUX_IP_H +-#include +-#include +- +-#define IPTOS_TOS_MASK 0x1E +-#define IPTOS_TOS(tos) ((tos)&IPTOS_TOS_MASK) +-#define IPTOS_LOWDELAY 0x10 +-#define IPTOS_THROUGHPUT 0x08 +-#define IPTOS_RELIABILITY 0x04 +-#define IPTOS_MINCOST 0x02 +- +-#define IPTOS_PREC_MASK 0xE0 +-#define IPTOS_PREC(tos) ((tos)&IPTOS_PREC_MASK) +-#define IPTOS_PREC_NETCONTROL 0xe0 +-#define IPTOS_PREC_INTERNETCONTROL 0xc0 +-#define IPTOS_PREC_CRITIC_ECP 0xa0 +-#define IPTOS_PREC_FLASHOVERRIDE 0x80 +-#define IPTOS_PREC_FLASH 0x60 +-#define IPTOS_PREC_IMMEDIATE 0x40 +-#define IPTOS_PREC_PRIORITY 0x20 +-#define IPTOS_PREC_ROUTINE 0x00 +- +- +-/* IP options */ +-#define IPOPT_COPY 0x80 +-#define IPOPT_CLASS_MASK 0x60 +-#define IPOPT_NUMBER_MASK 0x1f +- +-#define IPOPT_COPIED(o) ((o)&IPOPT_COPY) +-#define IPOPT_CLASS(o) ((o)&IPOPT_CLASS_MASK) +-#define IPOPT_NUMBER(o) ((o)&IPOPT_NUMBER_MASK) +- +-#define IPOPT_CONTROL 0x00 +-#define IPOPT_RESERVED1 0x20 +-#define IPOPT_MEASUREMENT 0x40 +-#define IPOPT_RESERVED2 0x60 +- +-#define IPOPT_END (0 |IPOPT_CONTROL) +-#define IPOPT_NOOP (1 |IPOPT_CONTROL) +-#define IPOPT_SEC (2 |IPOPT_CONTROL|IPOPT_COPY) +-#define IPOPT_LSRR (3 |IPOPT_CONTROL|IPOPT_COPY) +-#define IPOPT_TIMESTAMP (4 |IPOPT_MEASUREMENT) +-#define IPOPT_CIPSO (6 |IPOPT_CONTROL|IPOPT_COPY) +-#define IPOPT_RR (7 |IPOPT_CONTROL) +-#define IPOPT_SID (8 |IPOPT_CONTROL|IPOPT_COPY) +-#define IPOPT_SSRR (9 |IPOPT_CONTROL|IPOPT_COPY) +-#define IPOPT_RA (20|IPOPT_CONTROL|IPOPT_COPY) +- +-#define IPVERSION 4 +-#define MAXTTL 255 +-#define IPDEFTTL 64 +- +-#define IPOPT_OPTVAL 0 +-#define IPOPT_OLEN 1 +-#define IPOPT_OFFSET 2 +-#define IPOPT_MINOFF 4 +-#define MAX_IPOPTLEN 40 +-#define IPOPT_NOP IPOPT_NOOP +-#define IPOPT_EOL IPOPT_END +-#define IPOPT_TS IPOPT_TIMESTAMP +- +-#define IPOPT_TS_TSONLY 0 /* timestamps only */ +-#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */ +-#define IPOPT_TS_PRESPEC 3 /* specified modules only */ +- +-#define IPV4_BEET_PHMAXLEN 8 +- +-struct iphdr { +-#if defined(__LITTLE_ENDIAN_BITFIELD) +- __u8 ihl:4, +- version:4; +-#elif defined (__BIG_ENDIAN_BITFIELD) +- __u8 version:4, +- ihl:4; +-#else +-#error "Please fix " +-#endif +- __u8 tos; +- __be16 tot_len; +- __be16 id; +- __be16 frag_off; +- __u8 ttl; +- __u8 protocol; +- __sum16 check; +- __be32 saddr; +- __be32 daddr; +- /*The options start here. */ +-}; +- +- +-struct ip_auth_hdr { +- __u8 nexthdr; +- __u8 hdrlen; /* This one is measured in 32 bit units! */ +- __be16 reserved; +- __be32 spi; +- __be32 seq_no; /* Sequence number */ +- __u8 auth_data[0]; /* Variable len but >=4. Mind the 64 bit alignment! */ +-}; +- +-struct ip_esp_hdr { +- __be32 spi; +- __be32 seq_no; /* Sequence number */ +- __u8 enc_data[0]; /* Variable len but >=8. Mind the 64 bit alignment! */ +-}; +- +-struct ip_comp_hdr { +- __u8 nexthdr; +- __u8 flags; +- __be16 cpi; +-}; +- +-struct ip_beet_phdr { +- __u8 nexthdr; +- __u8 hdrlen; +- __u8 padlen; +- __u8 reserved; +-}; +- +-/* index values for the variables in ipv4_devconf */ +-enum +-{ +- IPV4_DEVCONF_FORWARDING=1, +- IPV4_DEVCONF_MC_FORWARDING, +- IPV4_DEVCONF_PROXY_ARP, +- IPV4_DEVCONF_ACCEPT_REDIRECTS, +- IPV4_DEVCONF_SECURE_REDIRECTS, +- IPV4_DEVCONF_SEND_REDIRECTS, +- IPV4_DEVCONF_SHARED_MEDIA, +- IPV4_DEVCONF_RP_FILTER, +- IPV4_DEVCONF_ACCEPT_SOURCE_ROUTE, +- IPV4_DEVCONF_BOOTP_RELAY, +- IPV4_DEVCONF_LOG_MARTIANS, +- IPV4_DEVCONF_TAG, +- IPV4_DEVCONF_ARPFILTER, +- IPV4_DEVCONF_MEDIUM_ID, +- IPV4_DEVCONF_NOXFRM, +- IPV4_DEVCONF_NOPOLICY, +- IPV4_DEVCONF_FORCE_IGMP_VERSION, +- IPV4_DEVCONF_ARP_ANNOUNCE, +- IPV4_DEVCONF_ARP_IGNORE, +- IPV4_DEVCONF_PROMOTE_SECONDARIES, +- IPV4_DEVCONF_ARP_ACCEPT, +- IPV4_DEVCONF_ARP_NOTIFY, +- IPV4_DEVCONF_ACCEPT_LOCAL, +- IPV4_DEVCONF_SRC_VMARK, +- IPV4_DEVCONF_PROXY_ARP_PVLAN, +- IPV4_DEVCONF_ROUTE_LOCALNET, +- IPV4_DEVCONF_IGMPV2_UNSOLICITED_REPORT_INTERVAL, +- IPV4_DEVCONF_IGMPV3_UNSOLICITED_REPORT_INTERVAL, +- IPV4_DEVCONF_IGNORE_ROUTES_WITH_LINKDOWN, +- IPV4_DEVCONF_DROP_UNICAST_IN_L2_MULTICAST, +- IPV4_DEVCONF_DROP_GRATUITOUS_ARP, +- __IPV4_DEVCONF_MAX +-}; +- +-#define IPV4_DEVCONF_MAX (__IPV4_DEVCONF_MAX - 1) +- +-#endif /* _LINUX_IP_H */ +diff --git a/include/linux/ip6_tunnel.h b/include/linux/ip6_tunnel.h +deleted file mode 100644 +index 425926c..0000000 +--- a/include/linux/ip6_tunnel.h ++++ /dev/null +@@ -1,53 +0,0 @@ +-#ifndef _IP6_TUNNEL_H +-#define _IP6_TUNNEL_H +- +-#include +-#include /* For IFNAMSIZ. */ +-#include /* For struct in6_addr. */ +- +-#define IPV6_TLV_TNL_ENCAP_LIMIT 4 +-#define IPV6_DEFAULT_TNL_ENCAP_LIMIT 4 +- +-/* don't add encapsulation limit if one isn't present in inner packet */ +-#define IP6_TNL_F_IGN_ENCAP_LIMIT 0x1 +-/* copy the traffic class field from the inner packet */ +-#define IP6_TNL_F_USE_ORIG_TCLASS 0x2 +-/* copy the flowlabel from the inner packet */ +-#define IP6_TNL_F_USE_ORIG_FLOWLABEL 0x4 +-/* being used for Mobile IPv6 */ +-#define IP6_TNL_F_MIP6_DEV 0x8 +-/* copy DSCP from the outer packet */ +-#define IP6_TNL_F_RCV_DSCP_COPY 0x10 +-/* copy fwmark from inner packet */ +-#define IP6_TNL_F_USE_ORIG_FWMARK 0x20 +- +-struct ip6_tnl_parm { +- char name[IFNAMSIZ]; /* name of tunnel device */ +- int link; /* ifindex of underlying L2 interface */ +- __u8 proto; /* tunnel protocol */ +- __u8 encap_limit; /* encapsulation limit for tunnel */ +- __u8 hop_limit; /* hop limit for tunnel */ +- __be32 flowinfo; /* traffic class and flowlabel for tunnel */ +- __u32 flags; /* tunnel flags */ +- struct in6_addr laddr; /* local tunnel end-point address */ +- struct in6_addr raddr; /* remote tunnel end-point address */ +-}; +- +-struct ip6_tnl_parm2 { +- char name[IFNAMSIZ]; /* name of tunnel device */ +- int link; /* ifindex of underlying L2 interface */ +- __u8 proto; /* tunnel protocol */ +- __u8 encap_limit; /* encapsulation limit for tunnel */ +- __u8 hop_limit; /* hop limit for tunnel */ +- __be32 flowinfo; /* traffic class and flowlabel for tunnel */ +- __u32 flags; /* tunnel flags */ +- struct in6_addr laddr; /* local tunnel end-point address */ +- struct in6_addr raddr; /* remote tunnel end-point address */ +- +- __be16 i_flags; +- __be16 o_flags; +- __be32 i_key; +- __be32 o_key; +-}; +- +-#endif +diff --git a/include/linux/ipsec.h b/include/linux/ipsec.h +deleted file mode 100644 +index d17a630..0000000 +--- a/include/linux/ipsec.h ++++ /dev/null +@@ -1,47 +0,0 @@ +-#ifndef _LINUX_IPSEC_H +-#define _LINUX_IPSEC_H +- +-/* The definitions, required to talk to KAME racoon IKE. */ +- +-#include +- +-#define IPSEC_PORT_ANY 0 +-#define IPSEC_ULPROTO_ANY 255 +-#define IPSEC_PROTO_ANY 255 +- +-enum { +- IPSEC_MODE_ANY = 0, /* We do not support this for SA */ +- IPSEC_MODE_TRANSPORT = 1, +- IPSEC_MODE_TUNNEL = 2, +- IPSEC_MODE_BEET = 3 +-}; +- +-enum { +- IPSEC_DIR_ANY = 0, +- IPSEC_DIR_INBOUND = 1, +- IPSEC_DIR_OUTBOUND = 2, +- IPSEC_DIR_FWD = 3, /* It is our own */ +- IPSEC_DIR_MAX = 4, +- IPSEC_DIR_INVALID = 5 +-}; +- +-enum { +- IPSEC_POLICY_DISCARD = 0, +- IPSEC_POLICY_NONE = 1, +- IPSEC_POLICY_IPSEC = 2, +- IPSEC_POLICY_ENTRUST = 3, +- IPSEC_POLICY_BYPASS = 4 +-}; +- +-enum { +- IPSEC_LEVEL_DEFAULT = 0, +- IPSEC_LEVEL_USE = 1, +- IPSEC_LEVEL_REQUIRE = 2, +- IPSEC_LEVEL_UNIQUE = 3 +-}; +- +-#define IPSEC_MANUAL_REQID_MAX 0x3fff +- +-#define IPSEC_REPLAYWSIZE 32 +- +-#endif /* _LINUX_IPSEC_H */ +diff --git a/include/linux/kernel.h b/include/linux/kernel.h +deleted file mode 100644 +index 527549f..0000000 +--- a/include/linux/kernel.h ++++ /dev/null +@@ -1,14 +0,0 @@ +-#ifndef _LINUX_KERNEL_H +-#define _LINUX_KERNEL_H +- +-#include +- +-/* +- * 'kernel.h' contains some often-used function prototypes etc +- */ +-#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1) +-#define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask)) +- +-#define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) +- +-#endif /* _LINUX_KERNEL_H */ +diff --git a/include/linux/l2tp.h b/include/linux/l2tp.h +deleted file mode 100644 +index 8a80007..0000000 +--- a/include/linux/l2tp.h ++++ /dev/null +@@ -1,199 +0,0 @@ +-/* +- * L2TP-over-IP socket for L2TPv3. +- * +- * Author: James Chapman +- */ +- +-#ifndef _LINUX_L2TP_H_ +-#define _LINUX_L2TP_H_ +- +-#include +-#include +-#include +-#include +- +-#define IPPROTO_L2TP 115 +- +-/** +- * struct sockaddr_l2tpip - the sockaddr structure for L2TP-over-IP sockets +- * @l2tp_family: address family number AF_L2TPIP. +- * @l2tp_addr: protocol specific address information +- * @l2tp_conn_id: connection id of tunnel +- */ +-#define __SOCK_SIZE__ 16 /* sizeof(struct sockaddr) */ +-struct sockaddr_l2tpip { +- /* The first fields must match struct sockaddr_in */ +- __kernel_sa_family_t l2tp_family; /* AF_INET */ +- __be16 l2tp_unused; /* INET port number (unused) */ +- struct in_addr l2tp_addr; /* Internet address */ +- +- __u32 l2tp_conn_id; /* Connection ID of tunnel */ +- +- /* Pad to size of `struct sockaddr'. */ +- unsigned char __pad[__SOCK_SIZE__ - +- sizeof(__kernel_sa_family_t) - +- sizeof(__be16) - sizeof(struct in_addr) - +- sizeof(__u32)]; +-}; +- +-/** +- * struct sockaddr_l2tpip6 - the sockaddr structure for L2TP-over-IPv6 sockets +- * @l2tp_family: address family number AF_L2TPIP. +- * @l2tp_addr: protocol specific address information +- * @l2tp_conn_id: connection id of tunnel +- */ +-struct sockaddr_l2tpip6 { +- /* The first fields must match struct sockaddr_in6 */ +- __kernel_sa_family_t l2tp_family; /* AF_INET6 */ +- __be16 l2tp_unused; /* INET port number (unused) */ +- __be32 l2tp_flowinfo; /* IPv6 flow information */ +- struct in6_addr l2tp_addr; /* IPv6 address */ +- __u32 l2tp_scope_id; /* scope id (new in RFC2553) */ +- __u32 l2tp_conn_id; /* Connection ID of tunnel */ +-}; +- +-/***************************************************************************** +- * NETLINK_GENERIC netlink family. +- *****************************************************************************/ +- +-/* +- * Commands. +- * Valid TLVs of each command are:- +- * TUNNEL_CREATE - CONN_ID, pw_type, netns, ifname, ipinfo, udpinfo, udpcsum, vlanid +- * TUNNEL_DELETE - CONN_ID +- * TUNNEL_MODIFY - CONN_ID, udpcsum +- * TUNNEL_GETSTATS - CONN_ID, (stats) +- * TUNNEL_GET - CONN_ID, (...) +- * SESSION_CREATE - SESSION_ID, PW_TYPE, offset, data_seq, cookie, peer_cookie, offset, l2spec +- * SESSION_DELETE - SESSION_ID +- * SESSION_MODIFY - SESSION_ID, data_seq +- * SESSION_GET - SESSION_ID, (...) +- * SESSION_GETSTATS - SESSION_ID, (stats) +- * +- */ +-enum { +- L2TP_CMD_NOOP, +- L2TP_CMD_TUNNEL_CREATE, +- L2TP_CMD_TUNNEL_DELETE, +- L2TP_CMD_TUNNEL_MODIFY, +- L2TP_CMD_TUNNEL_GET, +- L2TP_CMD_SESSION_CREATE, +- L2TP_CMD_SESSION_DELETE, +- L2TP_CMD_SESSION_MODIFY, +- L2TP_CMD_SESSION_GET, +- __L2TP_CMD_MAX, +-}; +- +-#define L2TP_CMD_MAX (__L2TP_CMD_MAX - 1) +- +-/* +- * ATTR types defined for L2TP +- */ +-enum { +- L2TP_ATTR_NONE, /* no data */ +- L2TP_ATTR_PW_TYPE, /* u16, enum l2tp_pwtype */ +- L2TP_ATTR_ENCAP_TYPE, /* u16, enum l2tp_encap_type */ +- L2TP_ATTR_OFFSET, /* u16 */ +- L2TP_ATTR_DATA_SEQ, /* u16 */ +- L2TP_ATTR_L2SPEC_TYPE, /* u8, enum l2tp_l2spec_type */ +- L2TP_ATTR_L2SPEC_LEN, /* u8, enum l2tp_l2spec_type */ +- L2TP_ATTR_PROTO_VERSION, /* u8 */ +- L2TP_ATTR_IFNAME, /* string */ +- L2TP_ATTR_CONN_ID, /* u32 */ +- L2TP_ATTR_PEER_CONN_ID, /* u32 */ +- L2TP_ATTR_SESSION_ID, /* u32 */ +- L2TP_ATTR_PEER_SESSION_ID, /* u32 */ +- L2TP_ATTR_UDP_CSUM, /* u8 */ +- L2TP_ATTR_VLAN_ID, /* u16 */ +- L2TP_ATTR_COOKIE, /* 0, 4 or 8 bytes */ +- L2TP_ATTR_PEER_COOKIE, /* 0, 4 or 8 bytes */ +- L2TP_ATTR_DEBUG, /* u32, enum l2tp_debug_flags */ +- L2TP_ATTR_RECV_SEQ, /* u8 */ +- L2TP_ATTR_SEND_SEQ, /* u8 */ +- L2TP_ATTR_LNS_MODE, /* u8 */ +- L2TP_ATTR_USING_IPSEC, /* u8 */ +- L2TP_ATTR_RECV_TIMEOUT, /* msec */ +- L2TP_ATTR_FD, /* int */ +- L2TP_ATTR_IP_SADDR, /* u32 */ +- L2TP_ATTR_IP_DADDR, /* u32 */ +- L2TP_ATTR_UDP_SPORT, /* u16 */ +- L2TP_ATTR_UDP_DPORT, /* u16 */ +- L2TP_ATTR_MTU, /* u16 */ +- L2TP_ATTR_MRU, /* u16 */ +- L2TP_ATTR_STATS, /* nested */ +- L2TP_ATTR_IP6_SADDR, /* struct in6_addr */ +- L2TP_ATTR_IP6_DADDR, /* struct in6_addr */ +- L2TP_ATTR_UDP_ZERO_CSUM6_TX, /* flag */ +- L2TP_ATTR_UDP_ZERO_CSUM6_RX, /* flag */ +- L2TP_ATTR_PAD, +- __L2TP_ATTR_MAX, +-}; +- +-#define L2TP_ATTR_MAX (__L2TP_ATTR_MAX - 1) +- +-/* Nested in L2TP_ATTR_STATS */ +-enum { +- L2TP_ATTR_STATS_NONE, /* no data */ +- L2TP_ATTR_TX_PACKETS, /* u64 */ +- L2TP_ATTR_TX_BYTES, /* u64 */ +- L2TP_ATTR_TX_ERRORS, /* u64 */ +- L2TP_ATTR_RX_PACKETS, /* u64 */ +- L2TP_ATTR_RX_BYTES, /* u64 */ +- L2TP_ATTR_RX_SEQ_DISCARDS, /* u64 */ +- L2TP_ATTR_RX_OOS_PACKETS, /* u64 */ +- L2TP_ATTR_RX_ERRORS, /* u64 */ +- L2TP_ATTR_STATS_PAD, +- __L2TP_ATTR_STATS_MAX, +-}; +- +-#define L2TP_ATTR_STATS_MAX (__L2TP_ATTR_STATS_MAX - 1) +- +-enum l2tp_pwtype { +- L2TP_PWTYPE_NONE = 0x0000, +- L2TP_PWTYPE_ETH_VLAN = 0x0004, +- L2TP_PWTYPE_ETH = 0x0005, +- L2TP_PWTYPE_PPP = 0x0007, +- L2TP_PWTYPE_PPP_AC = 0x0008, +- L2TP_PWTYPE_IP = 0x000b, +- __L2TP_PWTYPE_MAX +-}; +- +-enum l2tp_l2spec_type { +- L2TP_L2SPECTYPE_NONE, +- L2TP_L2SPECTYPE_DEFAULT, +-}; +- +-enum l2tp_encap_type { +- L2TP_ENCAPTYPE_UDP, +- L2TP_ENCAPTYPE_IP, +-}; +- +-enum l2tp_seqmode { +- L2TP_SEQ_NONE = 0, +- L2TP_SEQ_IP = 1, +- L2TP_SEQ_ALL = 2, +-}; +- +-/** +- * enum l2tp_debug_flags - debug message categories for L2TP tunnels/sessions +- * +- * @L2TP_MSG_DEBUG: verbose debug (if compiled in) +- * @L2TP_MSG_CONTROL: userspace - kernel interface +- * @L2TP_MSG_SEQ: sequence numbers +- * @L2TP_MSG_DATA: data packets +- */ +-enum l2tp_debug_flags { +- L2TP_MSG_DEBUG = (1 << 0), +- L2TP_MSG_CONTROL = (1 << 1), +- L2TP_MSG_SEQ = (1 << 2), +- L2TP_MSG_DATA = (1 << 3), +-}; +- +-/* +- * NETLINK_GENERIC related info +- */ +-#define L2TP_GENL_NAME "l2tp" +-#define L2TP_GENL_VERSION 0x1 +-#define L2TP_GENL_MCGROUP "l2tp" +- +-#endif /* _LINUX_L2TP_H_ */ +diff --git a/include/linux/libc-compat.h b/include/linux/libc-compat.h +deleted file mode 100644 +index f38571d..0000000 +--- a/include/linux/libc-compat.h ++++ /dev/null +@@ -1,213 +0,0 @@ +-/* +- * Compatibility interface for userspace libc header coordination: +- * +- * Define compatibility macros that are used to control the inclusion or +- * exclusion of UAPI structures and definitions in coordination with another +- * userspace C library. +- * +- * This header is intended to solve the problem of UAPI definitions that +- * conflict with userspace definitions. If a UAPI header has such conflicting +- * definitions then the solution is as follows: +- * +- * * Synchronize the UAPI header and the libc headers so either one can be +- * used and such that the ABI is preserved. If this is not possible then +- * no simple compatibility interface exists (you need to write translating +- * wrappers and rename things) and you can't use this interface. +- * +- * Then follow this process: +- * +- * (a) Include libc-compat.h in the UAPI header. +- * e.g. #include +- * This include must be as early as possible. +- * +- * (b) In libc-compat.h add enough code to detect that the comflicting +- * userspace libc header has been included first. +- * +- * (c) If the userspace libc header has been included first define a set of +- * guard macros of the form __UAPI_DEF_FOO and set their values to 1, else +- * set their values to 0. +- * +- * (d) Back in the UAPI header with the conflicting definitions, guard the +- * definitions with: +- * #if __UAPI_DEF_FOO +- * ... +- * #endif +- * +- * This fixes the situation where the linux headers are included *after* the +- * libc headers. To fix the problem with the inclusion in the other order the +- * userspace libc headers must be fixed like this: +- * +- * * For all definitions that conflict with kernel definitions wrap those +- * defines in the following: +- * #if !__UAPI_DEF_FOO +- * ... +- * #endif +- * +- * This prevents the redefinition of a construct already defined by the kernel. +- */ +-#ifndef _LIBC_COMPAT_H +-#define _LIBC_COMPAT_H +- +-/* We have included glibc headers... */ +-#if defined(__GLIBC__) +- +-/* Coordinate with glibc net/if.h header. */ +-#if defined(_NET_IF_H) && defined(__USE_MISC) +- +-/* GLIBC headers included first so don't define anything +- * that would already be defined. */ +- +-#define __UAPI_DEF_IF_IFCONF 0 +-#define __UAPI_DEF_IF_IFMAP 0 +-#define __UAPI_DEF_IF_IFNAMSIZ 0 +-#define __UAPI_DEF_IF_IFREQ 0 +-/* Everything up to IFF_DYNAMIC, matches net/if.h until glibc 2.23 */ +-#define __UAPI_DEF_IF_NET_DEVICE_FLAGS 0 +-/* For the future if glibc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */ +-#ifndef __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO +-#define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 1 +-#endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */ +- +-#else /* _NET_IF_H */ +- +-/* Linux headers included first, and we must define everything +- * we need. The expectation is that glibc will check the +- * __UAPI_DEF_* defines and adjust appropriately. */ +- +-#define __UAPI_DEF_IF_IFCONF 1 +-#define __UAPI_DEF_IF_IFMAP 1 +-#define __UAPI_DEF_IF_IFNAMSIZ 1 +-#define __UAPI_DEF_IF_IFREQ 1 +-/* Everything up to IFF_DYNAMIC, matches net/if.h until glibc 2.23 */ +-#define __UAPI_DEF_IF_NET_DEVICE_FLAGS 1 +-/* For the future if glibc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */ +-#define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 1 +- +-#endif /* _NET_IF_H */ +- +-/* Coordinate with glibc netinet/in.h header. */ +-#if defined(_NETINET_IN_H) +- +-/* GLIBC headers included first so don't define anything +- * that would already be defined. */ +-#define __UAPI_DEF_IN_ADDR 0 +-#define __UAPI_DEF_IN_IPPROTO 0 +-#define __UAPI_DEF_IN_PKTINFO 0 +-#define __UAPI_DEF_IP_MREQ 0 +-#define __UAPI_DEF_SOCKADDR_IN 0 +-#define __UAPI_DEF_IN_CLASS 0 +- +-#define __UAPI_DEF_IN6_ADDR 0 +-/* The exception is the in6_addr macros which must be defined +- * if the glibc code didn't define them. This guard matches +- * the guard in glibc/inet/netinet/in.h which defines the +- * additional in6_addr macros e.g. s6_addr16, and s6_addr32. */ +-#if defined(__USE_MISC) || defined (__USE_GNU) +-#define __UAPI_DEF_IN6_ADDR_ALT 0 +-#else +-#define __UAPI_DEF_IN6_ADDR_ALT 1 +-#endif +-#define __UAPI_DEF_SOCKADDR_IN6 0 +-#define __UAPI_DEF_IPV6_MREQ 0 +-#define __UAPI_DEF_IPPROTO_V6 0 +-#define __UAPI_DEF_IPV6_OPTIONS 0 +-#define __UAPI_DEF_IN6_PKTINFO 0 +-#define __UAPI_DEF_IP6_MTUINFO 0 +- +-#else +- +-/* Linux headers included first, and we must define everything +- * we need. The expectation is that glibc will check the +- * __UAPI_DEF_* defines and adjust appropriately. */ +-#define __UAPI_DEF_IN_ADDR 1 +-#define __UAPI_DEF_IN_IPPROTO 1 +-#define __UAPI_DEF_IN_PKTINFO 1 +-#define __UAPI_DEF_IP_MREQ 1 +-#define __UAPI_DEF_SOCKADDR_IN 1 +-#define __UAPI_DEF_IN_CLASS 1 +- +-#define __UAPI_DEF_IN6_ADDR 1 +-/* We unconditionally define the in6_addr macros and glibc must +- * coordinate. */ +-#define __UAPI_DEF_IN6_ADDR_ALT 1 +-#define __UAPI_DEF_SOCKADDR_IN6 1 +-#define __UAPI_DEF_IPV6_MREQ 1 +-#define __UAPI_DEF_IPPROTO_V6 1 +-#define __UAPI_DEF_IPV6_OPTIONS 1 +-#define __UAPI_DEF_IN6_PKTINFO 1 +-#define __UAPI_DEF_IP6_MTUINFO 1 +- +-#endif /* _NETINET_IN_H */ +- +-/* Coordinate with glibc netipx/ipx.h header. */ +-#if defined(__NETIPX_IPX_H) +- +-#define __UAPI_DEF_SOCKADDR_IPX 0 +-#define __UAPI_DEF_IPX_ROUTE_DEFINITION 0 +-#define __UAPI_DEF_IPX_INTERFACE_DEFINITION 0 +-#define __UAPI_DEF_IPX_CONFIG_DATA 0 +-#define __UAPI_DEF_IPX_ROUTE_DEF 0 +- +-#else /* defined(__NETIPX_IPX_H) */ +- +-#define __UAPI_DEF_SOCKADDR_IPX 1 +-#define __UAPI_DEF_IPX_ROUTE_DEFINITION 1 +-#define __UAPI_DEF_IPX_INTERFACE_DEFINITION 1 +-#define __UAPI_DEF_IPX_CONFIG_DATA 1 +-#define __UAPI_DEF_IPX_ROUTE_DEF 1 +- +-#endif /* defined(__NETIPX_IPX_H) */ +- +-/* Definitions for xattr.h */ +-#if defined(_SYS_XATTR_H) +-#define __UAPI_DEF_XATTR 0 +-#else +-#define __UAPI_DEF_XATTR 1 +-#endif +- +-/* If we did not see any headers from any supported C libraries, +- * or we are being included in the kernel, then define everything +- * that we need. */ +-#else /* !defined(__GLIBC__) */ +- +-/* Definitions for if.h */ +-#define __UAPI_DEF_IF_IFCONF 1 +-#define __UAPI_DEF_IF_IFMAP 1 +-#define __UAPI_DEF_IF_IFNAMSIZ 1 +-#define __UAPI_DEF_IF_IFREQ 1 +-/* Everything up to IFF_DYNAMIC, matches net/if.h until glibc 2.23 */ +-#define __UAPI_DEF_IF_NET_DEVICE_FLAGS 1 +-/* For the future if glibc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */ +-#define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 1 +- +-/* Definitions for in.h */ +-#define __UAPI_DEF_IN_ADDR 1 +-#define __UAPI_DEF_IN_IPPROTO 1 +-#define __UAPI_DEF_IN_PKTINFO 1 +-#define __UAPI_DEF_IP_MREQ 1 +-#define __UAPI_DEF_SOCKADDR_IN 1 +-#define __UAPI_DEF_IN_CLASS 1 +- +-/* Definitions for in6.h */ +-#define __UAPI_DEF_IN6_ADDR 1 +-#define __UAPI_DEF_IN6_ADDR_ALT 1 +-#define __UAPI_DEF_SOCKADDR_IN6 1 +-#define __UAPI_DEF_IPV6_MREQ 1 +-#define __UAPI_DEF_IPPROTO_V6 1 +-#define __UAPI_DEF_IPV6_OPTIONS 1 +-#define __UAPI_DEF_IN6_PKTINFO 1 +-#define __UAPI_DEF_IP6_MTUINFO 1 +- +-/* Definitions for ipx.h */ +-#define __UAPI_DEF_SOCKADDR_IPX 1 +-#define __UAPI_DEF_IPX_ROUTE_DEFINITION 1 +-#define __UAPI_DEF_IPX_INTERFACE_DEFINITION 1 +-#define __UAPI_DEF_IPX_CONFIG_DATA 1 +-#define __UAPI_DEF_IPX_ROUTE_DEF 1 +- +-/* Definitions for xattr.h */ +-#define __UAPI_DEF_XATTR 1 +- +-#endif /* __GLIBC__ */ +- +-#endif /* _LIBC_COMPAT_H */ +diff --git a/include/linux/limits.h b/include/linux/limits.h +deleted file mode 100644 +index 2d0f941..0000000 +--- a/include/linux/limits.h ++++ /dev/null +@@ -1,20 +0,0 @@ +-#ifndef _LINUX_LIMITS_H +-#define _LINUX_LIMITS_H +- +-#define NR_OPEN 1024 +- +-#define NGROUPS_MAX 65536 /* supplemental group IDs are available */ +-#define ARG_MAX 131072 /* # bytes of args + environ for exec() */ +-#define LINK_MAX 127 /* # links a file may have */ +-#define MAX_CANON 255 /* size of the canonical input queue */ +-#define MAX_INPUT 255 /* size of the type-ahead buffer */ +-#define NAME_MAX 255 /* # chars in a file name */ +-#define PATH_MAX 4096 /* # chars in a path name including nul */ +-#define PIPE_BUF 4096 /* # bytes in atomic write to a pipe */ +-#define XATTR_NAME_MAX 255 /* # chars in an extended attribute name */ +-#define XATTR_SIZE_MAX 65536 /* size of an extended attribute value (64k) */ +-#define XATTR_LIST_MAX 65536 /* size of extended attribute namelist (64k) */ +- +-#define RTSIG_MAX 32 +- +-#endif +diff --git a/include/linux/lwtunnel.h b/include/linux/lwtunnel.h +deleted file mode 100644 +index 3298426..0000000 +--- a/include/linux/lwtunnel.h ++++ /dev/null +@@ -1,70 +0,0 @@ +-#ifndef _LWTUNNEL_H_ +-#define _LWTUNNEL_H_ +- +-#include +- +-enum lwtunnel_encap_types { +- LWTUNNEL_ENCAP_NONE, +- LWTUNNEL_ENCAP_MPLS, +- LWTUNNEL_ENCAP_IP, +- LWTUNNEL_ENCAP_ILA, +- LWTUNNEL_ENCAP_IP6, +- LWTUNNEL_ENCAP_SEG6, +- LWTUNNEL_ENCAP_BPF, +- LWTUNNEL_ENCAP_SEG6_LOCAL, +- __LWTUNNEL_ENCAP_MAX, +-}; +- +-#define LWTUNNEL_ENCAP_MAX (__LWTUNNEL_ENCAP_MAX - 1) +- +-enum lwtunnel_ip_t { +- LWTUNNEL_IP_UNSPEC, +- LWTUNNEL_IP_ID, +- LWTUNNEL_IP_DST, +- LWTUNNEL_IP_SRC, +- LWTUNNEL_IP_TTL, +- LWTUNNEL_IP_TOS, +- LWTUNNEL_IP_FLAGS, +- LWTUNNEL_IP_PAD, +- __LWTUNNEL_IP_MAX, +-}; +- +-#define LWTUNNEL_IP_MAX (__LWTUNNEL_IP_MAX - 1) +- +-enum lwtunnel_ip6_t { +- LWTUNNEL_IP6_UNSPEC, +- LWTUNNEL_IP6_ID, +- LWTUNNEL_IP6_DST, +- LWTUNNEL_IP6_SRC, +- LWTUNNEL_IP6_HOPLIMIT, +- LWTUNNEL_IP6_TC, +- LWTUNNEL_IP6_FLAGS, +- LWTUNNEL_IP6_PAD, +- __LWTUNNEL_IP6_MAX, +-}; +- +-#define LWTUNNEL_IP6_MAX (__LWTUNNEL_IP6_MAX - 1) +- +-enum { +- LWT_BPF_PROG_UNSPEC, +- LWT_BPF_PROG_FD, +- LWT_BPF_PROG_NAME, +- __LWT_BPF_PROG_MAX, +-}; +- +-#define LWT_BPF_PROG_MAX (__LWT_BPF_PROG_MAX - 1) +- +-enum { +- LWT_BPF_UNSPEC, +- LWT_BPF_IN, +- LWT_BPF_OUT, +- LWT_BPF_XMIT, +- LWT_BPF_XMIT_HEADROOM, +- __LWT_BPF_MAX, +-}; +- +-#define LWT_BPF_MAX (__LWT_BPF_MAX - 1) +- +-#define LWT_BPF_MAX_HEADROOM 256 +- +-#endif /* _LWTUNNEL_H_ */ +diff --git a/include/linux/magic.h b/include/linux/magic.h +deleted file mode 100644 +index e439565..0000000 +--- a/include/linux/magic.h ++++ /dev/null +@@ -1,91 +0,0 @@ +-#ifndef __LINUX_MAGIC_H__ +-#define __LINUX_MAGIC_H__ +- +-#define ADFS_SUPER_MAGIC 0xadf5 +-#define AFFS_SUPER_MAGIC 0xadff +-#define AFS_SUPER_MAGIC 0x5346414F +-#define AUTOFS_SUPER_MAGIC 0x0187 +-#define CODA_SUPER_MAGIC 0x73757245 +-#define CRAMFS_MAGIC 0x28cd3d45 /* some random number */ +-#define CRAMFS_MAGIC_WEND 0x453dcd28 /* magic number with the wrong endianess */ +-#define DEBUGFS_MAGIC 0x64626720 +-#define SECURITYFS_MAGIC 0x73636673 +-#define SELINUX_MAGIC 0xf97cff8c +-#define SMACK_MAGIC 0x43415d53 /* "SMAC" */ +-#define RAMFS_MAGIC 0x858458f6 /* some random number */ +-#define TMPFS_MAGIC 0x01021994 +-#define HUGETLBFS_MAGIC 0x958458f6 /* some random number */ +-#define SQUASHFS_MAGIC 0x73717368 +-#define ECRYPTFS_SUPER_MAGIC 0xf15f +-#define EFS_SUPER_MAGIC 0x414A53 +-#define EXT2_SUPER_MAGIC 0xEF53 +-#define EXT3_SUPER_MAGIC 0xEF53 +-#define XENFS_SUPER_MAGIC 0xabba1974 +-#define EXT4_SUPER_MAGIC 0xEF53 +-#define BTRFS_SUPER_MAGIC 0x9123683E +-#define NILFS_SUPER_MAGIC 0x3434 +-#define F2FS_SUPER_MAGIC 0xF2F52010 +-#define HPFS_SUPER_MAGIC 0xf995e849 +-#define ISOFS_SUPER_MAGIC 0x9660 +-#define JFFS2_SUPER_MAGIC 0x72b6 +-#define PSTOREFS_MAGIC 0x6165676C +-#define EFIVARFS_MAGIC 0xde5e81e4 +-#define HOSTFS_SUPER_MAGIC 0x00c0ffee +-#define OVERLAYFS_SUPER_MAGIC 0x794c7630 +- +-#define MINIX_SUPER_MAGIC 0x137F /* minix v1 fs, 14 char names */ +-#define MINIX_SUPER_MAGIC2 0x138F /* minix v1 fs, 30 char names */ +-#define MINIX2_SUPER_MAGIC 0x2468 /* minix v2 fs, 14 char names */ +-#define MINIX2_SUPER_MAGIC2 0x2478 /* minix v2 fs, 30 char names */ +-#define MINIX3_SUPER_MAGIC 0x4d5a /* minix v3 fs, 60 char names */ +- +-#define MSDOS_SUPER_MAGIC 0x4d44 /* MD */ +-#define NCP_SUPER_MAGIC 0x564c /* Guess, what 0x564c is :-) */ +-#define NFS_SUPER_MAGIC 0x6969 +-#define OCFS2_SUPER_MAGIC 0x7461636f +-#define OPENPROM_SUPER_MAGIC 0x9fa1 +-#define QNX4_SUPER_MAGIC 0x002f /* qnx4 fs detection */ +-#define QNX6_SUPER_MAGIC 0x68191122 /* qnx6 fs detection */ +- +-#define REISERFS_SUPER_MAGIC 0x52654973 /* used by gcc */ +- /* used by file system utilities that +- look at the superblock, etc. */ +-#define REISERFS_SUPER_MAGIC_STRING "ReIsErFs" +-#define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs" +-#define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs" +- +-#define SMB_SUPER_MAGIC 0x517B +-#define CGROUP_SUPER_MAGIC 0x27e0eb +-#define CGROUP2_SUPER_MAGIC 0x63677270 +- +-#define RDTGROUP_SUPER_MAGIC 0x7655821 +- +-#define STACK_END_MAGIC 0x57AC6E9D +- +-#define TRACEFS_MAGIC 0x74726163 +- +-#define V9FS_MAGIC 0x01021997 +- +-#define BDEVFS_MAGIC 0x62646576 +-#define DAXFS_MAGIC 0x64646178 +-#define BINFMTFS_MAGIC 0x42494e4d +-#define DEVPTS_SUPER_MAGIC 0x1cd1 +-#define FUTEXFS_SUPER_MAGIC 0xBAD1DEA +-#define PIPEFS_MAGIC 0x50495045 +-#define PROC_SUPER_MAGIC 0x9fa0 +-#define SOCKFS_MAGIC 0x534F434B +-#define SYSFS_MAGIC 0x62656572 +-#define USBDEVICE_SUPER_MAGIC 0x9fa2 +-#define MTD_INODE_FS_MAGIC 0x11307854 +-#define ANON_INODE_FS_MAGIC 0x09041934 +-#define BTRFS_TEST_MAGIC 0x73727279 +-#define NSFS_MAGIC 0x6e736673 +-#define BPF_FS_MAGIC 0xcafe4a11 +-#define AAFS_MAGIC 0x5a3c69f0 +- +-/* Since UDF 2.01 is ISO 13346 based... */ +-#define UDF_SUPER_MAGIC 0x15013346 +-#define BALLOON_KVM_MAGIC 0x13661366 +-#define ZSMALLOC_MAGIC 0x58295829 +- +-#endif /* __LINUX_MAGIC_H__ */ +diff --git a/include/linux/mpls.h b/include/linux/mpls.h +deleted file mode 100644 +index bf5b625..0000000 +--- a/include/linux/mpls.h ++++ /dev/null +@@ -1,76 +0,0 @@ +-#ifndef _MPLS_H +-#define _MPLS_H +- +-#include +-#include +- +-/* Reference: RFC 5462, RFC 3032 +- * +- * 0 1 2 3 +- * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +- * | Label | TC |S| TTL | +- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +- * +- * Label: Label Value, 20 bits +- * TC: Traffic Class field, 3 bits +- * S: Bottom of Stack, 1 bit +- * TTL: Time to Live, 8 bits +- */ +- +-struct mpls_label { +- __be32 entry; +-}; +- +-#define MPLS_LS_LABEL_MASK 0xFFFFF000 +-#define MPLS_LS_LABEL_SHIFT 12 +-#define MPLS_LS_TC_MASK 0x00000E00 +-#define MPLS_LS_TC_SHIFT 9 +-#define MPLS_LS_S_MASK 0x00000100 +-#define MPLS_LS_S_SHIFT 8 +-#define MPLS_LS_TTL_MASK 0x000000FF +-#define MPLS_LS_TTL_SHIFT 0 +- +-/* Reserved labels */ +-#define MPLS_LABEL_IPV4NULL 0 /* RFC3032 */ +-#define MPLS_LABEL_RTALERT 1 /* RFC3032 */ +-#define MPLS_LABEL_IPV6NULL 2 /* RFC3032 */ +-#define MPLS_LABEL_IMPLNULL 3 /* RFC3032 */ +-#define MPLS_LABEL_ENTROPY 7 /* RFC6790 */ +-#define MPLS_LABEL_GAL 13 /* RFC5586 */ +-#define MPLS_LABEL_OAMALERT 14 /* RFC3429 */ +-#define MPLS_LABEL_EXTENSION 15 /* RFC7274 */ +- +-#define MPLS_LABEL_FIRST_UNRESERVED 16 /* RFC3032 */ +- +-/* These are embedded into IFLA_STATS_AF_SPEC: +- * [IFLA_STATS_AF_SPEC] +- * -> [AF_MPLS] +- * -> [MPLS_STATS_xxx] +- * +- * Attributes: +- * [MPLS_STATS_LINK] = { +- * struct mpls_link_stats +- * } +- */ +-enum { +- MPLS_STATS_UNSPEC, /* also used as 64bit pad attribute */ +- MPLS_STATS_LINK, +- __MPLS_STATS_MAX, +-}; +- +-#define MPLS_STATS_MAX (__MPLS_STATS_MAX - 1) +- +-struct mpls_link_stats { +- __u64 rx_packets; /* total packets received */ +- __u64 tx_packets; /* total packets transmitted */ +- __u64 rx_bytes; /* total bytes received */ +- __u64 tx_bytes; /* total bytes transmitted */ +- __u64 rx_errors; /* bad packets received */ +- __u64 tx_errors; /* packet transmit problems */ +- __u64 rx_dropped; /* packet dropped on receive */ +- __u64 tx_dropped; /* packet dropped on transmit */ +- __u64 rx_noroute; /* no route for packet dest */ +-}; +- +-#endif /* _MPLS_H */ +diff --git a/include/linux/mpls_iptunnel.h b/include/linux/mpls_iptunnel.h +deleted file mode 100644 +index 1a0e57b..0000000 +--- a/include/linux/mpls_iptunnel.h ++++ /dev/null +@@ -1,30 +0,0 @@ +-/* +- * mpls tunnel api +- * +- * Authors: +- * Roopa Prabhu +- * +- * This program is free software; you can redistribute it and/or +- * modify it under the terms of the GNU General Public License +- * as published by the Free Software Foundation; either version +- * 2 of the License, or (at your option) any later version. +- */ +- +-#ifndef _LINUX_MPLS_IPTUNNEL_H +-#define _LINUX_MPLS_IPTUNNEL_H +- +-/* MPLS tunnel attributes +- * [RTA_ENCAP] = { +- * [MPLS_IPTUNNEL_DST] +- * [MPLS_IPTUNNEL_TTL] +- * } +- */ +-enum { +- MPLS_IPTUNNEL_UNSPEC, +- MPLS_IPTUNNEL_DST, +- MPLS_IPTUNNEL_TTL, +- __MPLS_IPTUNNEL_MAX, +-}; +-#define MPLS_IPTUNNEL_MAX (__MPLS_IPTUNNEL_MAX - 1) +- +-#endif /* _LINUX_MPLS_IPTUNNEL_H */ +diff --git a/include/linux/neighbour.h b/include/linux/neighbour.h +deleted file mode 100644 +index 3199d28..0000000 +--- a/include/linux/neighbour.h ++++ /dev/null +@@ -1,171 +0,0 @@ +-#ifndef __LINUX_NEIGHBOUR_H +-#define __LINUX_NEIGHBOUR_H +- +-#include +-#include +- +-struct ndmsg { +- __u8 ndm_family; +- __u8 ndm_pad1; +- __u16 ndm_pad2; +- __s32 ndm_ifindex; +- __u16 ndm_state; +- __u8 ndm_flags; +- __u8 ndm_type; +-}; +- +-enum { +- NDA_UNSPEC, +- NDA_DST, +- NDA_LLADDR, +- NDA_CACHEINFO, +- NDA_PROBES, +- NDA_VLAN, +- NDA_PORT, +- NDA_VNI, +- NDA_IFINDEX, +- NDA_MASTER, +- NDA_LINK_NETNSID, +- NDA_SRC_VNI, +- __NDA_MAX +-}; +- +-#define NDA_MAX (__NDA_MAX - 1) +- +-/* +- * Neighbor Cache Entry Flags +- */ +- +-#define NTF_USE 0x01 +-#define NTF_SELF 0x02 +-#define NTF_MASTER 0x04 +-#define NTF_PROXY 0x08 /* == ATF_PUBL */ +-#define NTF_EXT_LEARNED 0x10 +-#define NTF_OFFLOADED 0x20 +-#define NTF_ROUTER 0x80 +- +-/* +- * Neighbor Cache Entry States. +- */ +- +-#define NUD_INCOMPLETE 0x01 +-#define NUD_REACHABLE 0x02 +-#define NUD_STALE 0x04 +-#define NUD_DELAY 0x08 +-#define NUD_PROBE 0x10 +-#define NUD_FAILED 0x20 +- +-/* Dummy states */ +-#define NUD_NOARP 0x40 +-#define NUD_PERMANENT 0x80 +-#define NUD_NONE 0x00 +- +-/* NUD_NOARP & NUD_PERMANENT are pseudostates, they never change +- and make no address resolution or NUD. +- NUD_PERMANENT also cannot be deleted by garbage collectors. +- */ +- +-struct nda_cacheinfo { +- __u32 ndm_confirmed; +- __u32 ndm_used; +- __u32 ndm_updated; +- __u32 ndm_refcnt; +-}; +- +-/***************************************************************** +- * Neighbour tables specific messages. +- * +- * To retrieve the neighbour tables send RTM_GETNEIGHTBL with the +- * NLM_F_DUMP flag set. Every neighbour table configuration is +- * spread over multiple messages to avoid running into message +- * size limits on systems with many interfaces. The first message +- * in the sequence transports all not device specific data such as +- * statistics, configuration, and the default parameter set. +- * This message is followed by 0..n messages carrying device +- * specific parameter sets. +- * Although the ordering should be sufficient, NDTA_NAME can be +- * used to identify sequences. The initial message can be identified +- * by checking for NDTA_CONFIG. The device specific messages do +- * not contain this TLV but have NDTPA_IFINDEX set to the +- * corresponding interface index. +- * +- * To change neighbour table attributes, send RTM_SETNEIGHTBL +- * with NDTA_NAME set. Changeable attribute include NDTA_THRESH[1-3], +- * NDTA_GC_INTERVAL, and all TLVs in NDTA_PARMS unless marked +- * otherwise. Device specific parameter sets can be changed by +- * setting NDTPA_IFINDEX to the interface index of the corresponding +- * device. +- ****/ +- +-struct ndt_stats { +- __u64 ndts_allocs; +- __u64 ndts_destroys; +- __u64 ndts_hash_grows; +- __u64 ndts_res_failed; +- __u64 ndts_lookups; +- __u64 ndts_hits; +- __u64 ndts_rcv_probes_mcast; +- __u64 ndts_rcv_probes_ucast; +- __u64 ndts_periodic_gc_runs; +- __u64 ndts_forced_gc_runs; +- __u64 ndts_table_fulls; +-}; +- +-enum { +- NDTPA_UNSPEC, +- NDTPA_IFINDEX, /* u32, unchangeable */ +- NDTPA_REFCNT, /* u32, read-only */ +- NDTPA_REACHABLE_TIME, /* u64, read-only, msecs */ +- NDTPA_BASE_REACHABLE_TIME, /* u64, msecs */ +- NDTPA_RETRANS_TIME, /* u64, msecs */ +- NDTPA_GC_STALETIME, /* u64, msecs */ +- NDTPA_DELAY_PROBE_TIME, /* u64, msecs */ +- NDTPA_QUEUE_LEN, /* u32 */ +- NDTPA_APP_PROBES, /* u32 */ +- NDTPA_UCAST_PROBES, /* u32 */ +- NDTPA_MCAST_PROBES, /* u32 */ +- NDTPA_ANYCAST_DELAY, /* u64, msecs */ +- NDTPA_PROXY_DELAY, /* u64, msecs */ +- NDTPA_PROXY_QLEN, /* u32 */ +- NDTPA_LOCKTIME, /* u64, msecs */ +- NDTPA_QUEUE_LENBYTES, /* u32 */ +- NDTPA_MCAST_REPROBES, /* u32 */ +- NDTPA_PAD, +- __NDTPA_MAX +-}; +-#define NDTPA_MAX (__NDTPA_MAX - 1) +- +-struct ndtmsg { +- __u8 ndtm_family; +- __u8 ndtm_pad1; +- __u16 ndtm_pad2; +-}; +- +-struct ndt_config { +- __u16 ndtc_key_len; +- __u16 ndtc_entry_size; +- __u32 ndtc_entries; +- __u32 ndtc_last_flush; /* delta to now in msecs */ +- __u32 ndtc_last_rand; /* delta to now in msecs */ +- __u32 ndtc_hash_rnd; +- __u32 ndtc_hash_mask; +- __u32 ndtc_hash_chain_gc; +- __u32 ndtc_proxy_qlen; +-}; +- +-enum { +- NDTA_UNSPEC, +- NDTA_NAME, /* char *, unchangeable */ +- NDTA_THRESH1, /* u32 */ +- NDTA_THRESH2, /* u32 */ +- NDTA_THRESH3, /* u32 */ +- NDTA_CONFIG, /* struct ndt_config, read-only */ +- NDTA_PARMS, /* nested TLV NDTPA_* */ +- NDTA_STATS, /* struct ndt_stats, read-only */ +- NDTA_GC_INTERVAL, /* u64, msecs */ +- NDTA_PAD, +- __NDTA_MAX +-}; +-#define NDTA_MAX (__NDTA_MAX - 1) +- +-#endif +diff --git a/include/linux/net_namespace.h b/include/linux/net_namespace.h +deleted file mode 100644 +index 9a92b7e..0000000 +--- a/include/linux/net_namespace.h ++++ /dev/null +@@ -1,23 +0,0 @@ +-/* Copyright (c) 2015 6WIND S.A. +- * Author: Nicolas Dichtel +- * +- * This program is free software; you can redistribute it and/or modify it +- * under the terms and conditions of the GNU General Public License, +- * version 2, as published by the Free Software Foundation. +- */ +-#ifndef _LINUX_NET_NAMESPACE_H_ +-#define _LINUX_NET_NAMESPACE_H_ +- +-/* Attributes of RTM_NEWNSID/RTM_GETNSID messages */ +-enum { +- NETNSA_NONE, +-#define NETNSA_NSID_NOT_ASSIGNED -1 +- NETNSA_NSID, +- NETNSA_PID, +- NETNSA_FD, +- __NETNSA_MAX, +-}; +- +-#define NETNSA_MAX (__NETNSA_MAX - 1) +- +-#endif /* _LINUX_NET_NAMESPACE_H_ */ +diff --git a/include/linux/netconf.h b/include/linux/netconf.h +deleted file mode 100644 +index 4afbd7d..0000000 +--- a/include/linux/netconf.h ++++ /dev/null +@@ -1,28 +0,0 @@ +-#ifndef _LINUX_NETCONF_H_ +-#define _LINUX_NETCONF_H_ +- +-#include +-#include +- +-struct netconfmsg { +- __u8 ncm_family; +-}; +- +-enum { +- NETCONFA_UNSPEC, +- NETCONFA_IFINDEX, +- NETCONFA_FORWARDING, +- NETCONFA_RP_FILTER, +- NETCONFA_MC_FORWARDING, +- NETCONFA_PROXY_NEIGH, +- NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN, +- NETCONFA_INPUT, +- __NETCONFA_MAX +-}; +-#define NETCONFA_MAX (__NETCONFA_MAX - 1) +-#define NETCONFA_ALL -1 +- +-#define NETCONFA_IFINDEX_ALL -1 +-#define NETCONFA_IFINDEX_DEFAULT -2 +- +-#endif /* _LINUX_NETCONF_H_ */ +diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h +deleted file mode 100644 +index 66fceb4..0000000 +--- a/include/linux/netdevice.h ++++ /dev/null +@@ -1,65 +0,0 @@ +-/* +- * INET An implementation of the TCP/IP protocol suite for the LINUX +- * operating system. INET is implemented using the BSD Socket +- * interface as the means of communication with the user level. +- * +- * Definitions for the Interfaces handler. +- * +- * Version: @(#)dev.h 1.0.10 08/12/93 +- * +- * Authors: Ross Biro +- * Fred N. van Kempen, +- * Corey Minyard +- * Donald J. Becker, +- * Alan Cox, +- * Bjorn Ekwall. +- * Pekka Riikonen +- * +- * This program is free software; you can redistribute it and/or +- * modify it under the terms of the GNU General Public License +- * as published by the Free Software Foundation; either version +- * 2 of the License, or (at your option) any later version. +- * +- * Moved to /usr/include/linux for NET3 +- */ +-#ifndef _LINUX_NETDEVICE_H +-#define _LINUX_NETDEVICE_H +- +-#include +-#include +-#include +-#include +- +- +-#define MAX_ADDR_LEN 32 /* Largest hardware address length */ +- +-/* Initial net device group. All devices belong to group 0 by default. */ +-#define INIT_NETDEV_GROUP 0 +- +- +-/* interface name assignment types (sysfs name_assign_type attribute) */ +-#define NET_NAME_UNKNOWN 0 /* unknown origin (not exposed to userspace) */ +-#define NET_NAME_ENUM 1 /* enumerated by kernel */ +-#define NET_NAME_PREDICTABLE 2 /* predictably named by the kernel */ +-#define NET_NAME_USER 3 /* provided by user-space */ +-#define NET_NAME_RENAMED 4 /* renamed by user-space */ +- +-/* Media selection options. */ +-enum { +- IF_PORT_UNKNOWN = 0, +- IF_PORT_10BASE2, +- IF_PORT_10BASET, +- IF_PORT_AUI, +- IF_PORT_100BASET, +- IF_PORT_100BASETX, +- IF_PORT_100BASEFX +-}; +- +-/* hardware address assignment types */ +-#define NET_ADDR_PERM 0 /* address is permanent (default) */ +-#define NET_ADDR_RANDOM 1 /* address is generated randomly */ +-#define NET_ADDR_STOLEN 2 /* address is stolen from other device */ +-#define NET_ADDR_SET 3 /* address is set using +- * dev_set_mac_address() */ +- +-#endif /* _LINUX_NETDEVICE_H */ +diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h +deleted file mode 100644 +index ff4a4a5..0000000 +--- a/include/linux/netfilter.h ++++ /dev/null +@@ -1,77 +0,0 @@ +-#ifndef __LINUX_NETFILTER_H +-#define __LINUX_NETFILTER_H +- +-#include +- +-#include +-#include +- +-/* Responses from hook functions. */ +-#define NF_DROP 0 +-#define NF_ACCEPT 1 +-#define NF_STOLEN 2 +-#define NF_QUEUE 3 +-#define NF_REPEAT 4 +-#define NF_STOP 5 /* Deprecated, for userspace nf_queue compatibility. */ +-#define NF_MAX_VERDICT NF_STOP +- +-/* we overload the higher bits for encoding auxiliary data such as the queue +- * number or errno values. Not nice, but better than additional function +- * arguments. */ +-#define NF_VERDICT_MASK 0x000000ff +- +-/* extra verdict flags have mask 0x0000ff00 */ +-#define NF_VERDICT_FLAG_QUEUE_BYPASS 0x00008000 +- +-/* queue number (NF_QUEUE) or errno (NF_DROP) */ +-#define NF_VERDICT_QMASK 0xffff0000 +-#define NF_VERDICT_QBITS 16 +- +-#define NF_QUEUE_NR(x) ((((x) << 16) & NF_VERDICT_QMASK) | NF_QUEUE) +- +-#define NF_DROP_ERR(x) (((-x) << 16) | NF_DROP) +- +-/* only for userspace compatibility */ +-/* Generic cache responses from hook functions. +- <= 0x2000 is used for protocol-flags. */ +-#define NFC_UNKNOWN 0x4000 +-#define NFC_ALTERED 0x8000 +- +-/* NF_VERDICT_BITS should be 8 now, but userspace might break if this changes */ +-#define NF_VERDICT_BITS 16 +- +-enum nf_inet_hooks { +- NF_INET_PRE_ROUTING, +- NF_INET_LOCAL_IN, +- NF_INET_FORWARD, +- NF_INET_LOCAL_OUT, +- NF_INET_POST_ROUTING, +- NF_INET_NUMHOOKS +-}; +- +-enum nf_dev_hooks { +- NF_NETDEV_INGRESS, +- NF_NETDEV_NUMHOOKS +-}; +- +-enum { +- NFPROTO_UNSPEC = 0, +- NFPROTO_INET = 1, +- NFPROTO_IPV4 = 2, +- NFPROTO_ARP = 3, +- NFPROTO_NETDEV = 5, +- NFPROTO_BRIDGE = 7, +- NFPROTO_IPV6 = 10, +- NFPROTO_DECNET = 12, +- NFPROTO_NUMPROTO, +-}; +- +-union nf_inet_addr { +- __u32 all[4]; +- __be32 ip; +- __be32 ip6[4]; +- struct in_addr in; +- struct in6_addr in6; +-}; +- +-#endif /* __LINUX_NETFILTER_H */ +diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h +deleted file mode 100644 +index a6c96b0..0000000 +--- a/include/linux/netfilter/ipset/ip_set.h ++++ /dev/null +@@ -1,304 +0,0 @@ +-/* Copyright (C) 2000-2002 Joakim Axelsson +- * Patrick Schaaf +- * Martin Josefsson +- * Copyright (C) 2003-2011 Jozsef Kadlecsik +- * +- * This program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License version 2 as +- * published by the Free Software Foundation. +- */ +-#ifndef _IP_SET_H +-#define _IP_SET_H +- +-#include +- +-/* The protocol version */ +-#define IPSET_PROTOCOL 6 +- +-/* The max length of strings including NUL: set and type identifiers */ +-#define IPSET_MAXNAMELEN 32 +- +-/* The maximum permissible comment length we will accept over netlink */ +-#define IPSET_MAX_COMMENT_SIZE 255 +- +-/* Message types and commands */ +-enum ipset_cmd { +- IPSET_CMD_NONE, +- IPSET_CMD_PROTOCOL, /* 1: Return protocol version */ +- IPSET_CMD_CREATE, /* 2: Create a new (empty) set */ +- IPSET_CMD_DESTROY, /* 3: Destroy a (empty) set */ +- IPSET_CMD_FLUSH, /* 4: Remove all elements from a set */ +- IPSET_CMD_RENAME, /* 5: Rename a set */ +- IPSET_CMD_SWAP, /* 6: Swap two sets */ +- IPSET_CMD_LIST, /* 7: List sets */ +- IPSET_CMD_SAVE, /* 8: Save sets */ +- IPSET_CMD_ADD, /* 9: Add an element to a set */ +- IPSET_CMD_DEL, /* 10: Delete an element from a set */ +- IPSET_CMD_TEST, /* 11: Test an element in a set */ +- IPSET_CMD_HEADER, /* 12: Get set header data only */ +- IPSET_CMD_TYPE, /* 13: Get set type */ +- IPSET_MSG_MAX, /* Netlink message commands */ +- +- /* Commands in userspace: */ +- IPSET_CMD_RESTORE = IPSET_MSG_MAX, /* 14: Enter restore mode */ +- IPSET_CMD_HELP, /* 15: Get help */ +- IPSET_CMD_VERSION, /* 16: Get program version */ +- IPSET_CMD_QUIT, /* 17: Quit from interactive mode */ +- +- IPSET_CMD_MAX, +- +- IPSET_CMD_COMMIT = IPSET_CMD_MAX, /* 18: Commit buffered commands */ +-}; +- +-/* Attributes at command level */ +-enum { +- IPSET_ATTR_UNSPEC, +- IPSET_ATTR_PROTOCOL, /* 1: Protocol version */ +- IPSET_ATTR_SETNAME, /* 2: Name of the set */ +- IPSET_ATTR_TYPENAME, /* 3: Typename */ +- IPSET_ATTR_SETNAME2 = IPSET_ATTR_TYPENAME, /* Setname at rename/swap */ +- IPSET_ATTR_REVISION, /* 4: Settype revision */ +- IPSET_ATTR_FAMILY, /* 5: Settype family */ +- IPSET_ATTR_FLAGS, /* 6: Flags at command level */ +- IPSET_ATTR_DATA, /* 7: Nested attributes */ +- IPSET_ATTR_ADT, /* 8: Multiple data containers */ +- IPSET_ATTR_LINENO, /* 9: Restore lineno */ +- IPSET_ATTR_PROTOCOL_MIN, /* 10: Minimal supported version number */ +- IPSET_ATTR_REVISION_MIN = IPSET_ATTR_PROTOCOL_MIN, /* type rev min */ +- __IPSET_ATTR_CMD_MAX, +-}; +-#define IPSET_ATTR_CMD_MAX (__IPSET_ATTR_CMD_MAX - 1) +- +-/* CADT specific attributes */ +-enum { +- IPSET_ATTR_IP = IPSET_ATTR_UNSPEC + 1, +- IPSET_ATTR_IP_FROM = IPSET_ATTR_IP, +- IPSET_ATTR_IP_TO, /* 2 */ +- IPSET_ATTR_CIDR, /* 3 */ +- IPSET_ATTR_PORT, /* 4 */ +- IPSET_ATTR_PORT_FROM = IPSET_ATTR_PORT, +- IPSET_ATTR_PORT_TO, /* 5 */ +- IPSET_ATTR_TIMEOUT, /* 6 */ +- IPSET_ATTR_PROTO, /* 7 */ +- IPSET_ATTR_CADT_FLAGS, /* 8 */ +- IPSET_ATTR_CADT_LINENO = IPSET_ATTR_LINENO, /* 9 */ +- IPSET_ATTR_MARK, /* 10 */ +- IPSET_ATTR_MARKMASK, /* 11 */ +- /* Reserve empty slots */ +- IPSET_ATTR_CADT_MAX = 16, +- /* Create-only specific attributes */ +- IPSET_ATTR_GC, +- IPSET_ATTR_HASHSIZE, +- IPSET_ATTR_MAXELEM, +- IPSET_ATTR_NETMASK, +- IPSET_ATTR_PROBES, +- IPSET_ATTR_RESIZE, +- IPSET_ATTR_SIZE, +- /* Kernel-only */ +- IPSET_ATTR_ELEMENTS, +- IPSET_ATTR_REFERENCES, +- IPSET_ATTR_MEMSIZE, +- +- __IPSET_ATTR_CREATE_MAX, +-}; +-#define IPSET_ATTR_CREATE_MAX (__IPSET_ATTR_CREATE_MAX - 1) +- +-/* ADT specific attributes */ +-enum { +- IPSET_ATTR_ETHER = IPSET_ATTR_CADT_MAX + 1, +- IPSET_ATTR_NAME, +- IPSET_ATTR_NAMEREF, +- IPSET_ATTR_IP2, +- IPSET_ATTR_CIDR2, +- IPSET_ATTR_IP2_TO, +- IPSET_ATTR_IFACE, +- IPSET_ATTR_BYTES, +- IPSET_ATTR_PACKETS, +- IPSET_ATTR_COMMENT, +- IPSET_ATTR_SKBMARK, +- IPSET_ATTR_SKBPRIO, +- IPSET_ATTR_SKBQUEUE, +- IPSET_ATTR_PAD, +- __IPSET_ATTR_ADT_MAX, +-}; +-#define IPSET_ATTR_ADT_MAX (__IPSET_ATTR_ADT_MAX - 1) +- +-/* IP specific attributes */ +-enum { +- IPSET_ATTR_IPADDR_IPV4 = IPSET_ATTR_UNSPEC + 1, +- IPSET_ATTR_IPADDR_IPV6, +- __IPSET_ATTR_IPADDR_MAX, +-}; +-#define IPSET_ATTR_IPADDR_MAX (__IPSET_ATTR_IPADDR_MAX - 1) +- +-/* Error codes */ +-enum ipset_errno { +- IPSET_ERR_PRIVATE = 4096, +- IPSET_ERR_PROTOCOL, +- IPSET_ERR_FIND_TYPE, +- IPSET_ERR_MAX_SETS, +- IPSET_ERR_BUSY, +- IPSET_ERR_EXIST_SETNAME2, +- IPSET_ERR_TYPE_MISMATCH, +- IPSET_ERR_EXIST, +- IPSET_ERR_INVALID_CIDR, +- IPSET_ERR_INVALID_NETMASK, +- IPSET_ERR_INVALID_FAMILY, +- IPSET_ERR_TIMEOUT, +- IPSET_ERR_REFERENCED, +- IPSET_ERR_IPADDR_IPV4, +- IPSET_ERR_IPADDR_IPV6, +- IPSET_ERR_COUNTER, +- IPSET_ERR_COMMENT, +- IPSET_ERR_INVALID_MARKMASK, +- IPSET_ERR_SKBINFO, +- +- /* Type specific error codes */ +- IPSET_ERR_TYPE_SPECIFIC = 4352, +-}; +- +-/* Flags at command level or match/target flags, lower half of cmdattrs*/ +-enum ipset_cmd_flags { +- IPSET_FLAG_BIT_EXIST = 0, +- IPSET_FLAG_EXIST = (1 << IPSET_FLAG_BIT_EXIST), +- IPSET_FLAG_BIT_LIST_SETNAME = 1, +- IPSET_FLAG_LIST_SETNAME = (1 << IPSET_FLAG_BIT_LIST_SETNAME), +- IPSET_FLAG_BIT_LIST_HEADER = 2, +- IPSET_FLAG_LIST_HEADER = (1 << IPSET_FLAG_BIT_LIST_HEADER), +- IPSET_FLAG_BIT_SKIP_COUNTER_UPDATE = 3, +- IPSET_FLAG_SKIP_COUNTER_UPDATE = +- (1 << IPSET_FLAG_BIT_SKIP_COUNTER_UPDATE), +- IPSET_FLAG_BIT_SKIP_SUBCOUNTER_UPDATE = 4, +- IPSET_FLAG_SKIP_SUBCOUNTER_UPDATE = +- (1 << IPSET_FLAG_BIT_SKIP_SUBCOUNTER_UPDATE), +- IPSET_FLAG_BIT_MATCH_COUNTERS = 5, +- IPSET_FLAG_MATCH_COUNTERS = (1 << IPSET_FLAG_BIT_MATCH_COUNTERS), +- IPSET_FLAG_BIT_RETURN_NOMATCH = 7, +- IPSET_FLAG_RETURN_NOMATCH = (1 << IPSET_FLAG_BIT_RETURN_NOMATCH), +- IPSET_FLAG_BIT_MAP_SKBMARK = 8, +- IPSET_FLAG_MAP_SKBMARK = (1 << IPSET_FLAG_BIT_MAP_SKBMARK), +- IPSET_FLAG_BIT_MAP_SKBPRIO = 9, +- IPSET_FLAG_MAP_SKBPRIO = (1 << IPSET_FLAG_BIT_MAP_SKBPRIO), +- IPSET_FLAG_BIT_MAP_SKBQUEUE = 10, +- IPSET_FLAG_MAP_SKBQUEUE = (1 << IPSET_FLAG_BIT_MAP_SKBQUEUE), +- IPSET_FLAG_CMD_MAX = 15, +-}; +- +-/* Flags at CADT attribute level, upper half of cmdattrs */ +-enum ipset_cadt_flags { +- IPSET_FLAG_BIT_BEFORE = 0, +- IPSET_FLAG_BEFORE = (1 << IPSET_FLAG_BIT_BEFORE), +- IPSET_FLAG_BIT_PHYSDEV = 1, +- IPSET_FLAG_PHYSDEV = (1 << IPSET_FLAG_BIT_PHYSDEV), +- IPSET_FLAG_BIT_NOMATCH = 2, +- IPSET_FLAG_NOMATCH = (1 << IPSET_FLAG_BIT_NOMATCH), +- IPSET_FLAG_BIT_WITH_COUNTERS = 3, +- IPSET_FLAG_WITH_COUNTERS = (1 << IPSET_FLAG_BIT_WITH_COUNTERS), +- IPSET_FLAG_BIT_WITH_COMMENT = 4, +- IPSET_FLAG_WITH_COMMENT = (1 << IPSET_FLAG_BIT_WITH_COMMENT), +- IPSET_FLAG_BIT_WITH_FORCEADD = 5, +- IPSET_FLAG_WITH_FORCEADD = (1 << IPSET_FLAG_BIT_WITH_FORCEADD), +- IPSET_FLAG_BIT_WITH_SKBINFO = 6, +- IPSET_FLAG_WITH_SKBINFO = (1 << IPSET_FLAG_BIT_WITH_SKBINFO), +- IPSET_FLAG_CADT_MAX = 15, +-}; +- +-/* The flag bits which correspond to the non-extension create flags */ +-enum ipset_create_flags { +- IPSET_CREATE_FLAG_BIT_FORCEADD = 0, +- IPSET_CREATE_FLAG_FORCEADD = (1 << IPSET_CREATE_FLAG_BIT_FORCEADD), +- IPSET_CREATE_FLAG_BIT_MAX = 7, +-}; +- +-/* Commands with settype-specific attributes */ +-enum ipset_adt { +- IPSET_ADD, +- IPSET_DEL, +- IPSET_TEST, +- IPSET_ADT_MAX, +- IPSET_CREATE = IPSET_ADT_MAX, +- IPSET_CADT_MAX, +-}; +- +-/* Sets are identified by an index in kernel space. Tweak with ip_set_id_t +- * and IPSET_INVALID_ID if you want to increase the max number of sets. +- */ +-typedef __u16 ip_set_id_t; +- +-#define IPSET_INVALID_ID 65535 +- +-enum ip_set_dim { +- IPSET_DIM_ZERO = 0, +- IPSET_DIM_ONE, +- IPSET_DIM_TWO, +- IPSET_DIM_THREE, +- /* Max dimension in elements. +- * If changed, new revision of iptables match/target is required. +- */ +- IPSET_DIM_MAX = 6, +- /* Backward compatibility: set match revision 2 */ +- IPSET_BIT_RETURN_NOMATCH = 7, +-}; +- +-/* Option flags for kernel operations */ +-enum ip_set_kopt { +- IPSET_INV_MATCH = (1 << IPSET_DIM_ZERO), +- IPSET_DIM_ONE_SRC = (1 << IPSET_DIM_ONE), +- IPSET_DIM_TWO_SRC = (1 << IPSET_DIM_TWO), +- IPSET_DIM_THREE_SRC = (1 << IPSET_DIM_THREE), +- IPSET_RETURN_NOMATCH = (1 << IPSET_BIT_RETURN_NOMATCH), +-}; +- +-enum { +- IPSET_COUNTER_NONE = 0, +- IPSET_COUNTER_EQ, +- IPSET_COUNTER_NE, +- IPSET_COUNTER_LT, +- IPSET_COUNTER_GT, +-}; +- +-/* Backward compatibility for set match v3 */ +-struct ip_set_counter_match0 { +- __u8 op; +- __u64 value; +-}; +- +-struct ip_set_counter_match { +- __aligned_u64 value; +- __u8 op; +-}; +- +-/* Interface to iptables/ip6tables */ +- +-#define SO_IP_SET 83 +- +-union ip_set_name_index { +- char name[IPSET_MAXNAMELEN]; +- ip_set_id_t index; +-}; +- +-#define IP_SET_OP_GET_BYNAME 0x00000006 /* Get set index by name */ +-struct ip_set_req_get_set { +- unsigned int op; +- unsigned int version; +- union ip_set_name_index set; +-}; +- +-#define IP_SET_OP_GET_BYINDEX 0x00000007 /* Get set name by index */ +-/* Uses ip_set_req_get_set */ +- +-#define IP_SET_OP_GET_FNAME 0x00000008 /* Get set index and family */ +-struct ip_set_req_get_set_family { +- unsigned int op; +- unsigned int version; +- unsigned int family; +- union ip_set_name_index set; +-}; +- +-#define IP_SET_OP_VERSION 0x00000100 /* Ask kernel version */ +-struct ip_set_req_version { +- unsigned int op; +- unsigned int version; +-}; +- +-#endif /* _IP_SET_H */ +diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h +deleted file mode 100644 +index 4120970..0000000 +--- a/include/linux/netfilter/x_tables.h ++++ /dev/null +@@ -1,185 +0,0 @@ +-#ifndef _X_TABLES_H +-#define _X_TABLES_H +-#include +-#include +- +-#define XT_FUNCTION_MAXNAMELEN 30 +-#define XT_EXTENSION_MAXNAMELEN 29 +-#define XT_TABLE_MAXNAMELEN 32 +- +-struct xt_entry_match { +- union { +- struct { +- __u16 match_size; +- +- /* Used by userspace */ +- char name[XT_EXTENSION_MAXNAMELEN]; +- __u8 revision; +- } user; +- struct { +- __u16 match_size; +- +- /* Used inside the kernel */ +- struct xt_match *match; +- } kernel; +- +- /* Total length */ +- __u16 match_size; +- } u; +- +- unsigned char data[0]; +-}; +- +-struct xt_entry_target { +- union { +- struct { +- __u16 target_size; +- +- /* Used by userspace */ +- char name[XT_EXTENSION_MAXNAMELEN]; +- __u8 revision; +- } user; +- struct { +- __u16 target_size; +- +- /* Used inside the kernel */ +- struct xt_target *target; +- } kernel; +- +- /* Total length */ +- __u16 target_size; +- } u; +- +- unsigned char data[0]; +-}; +- +-#define XT_TARGET_INIT(__name, __size) \ +-{ \ +- .target.u.user = { \ +- .target_size = XT_ALIGN(__size), \ +- .name = __name, \ +- }, \ +-} +- +-struct xt_standard_target { +- struct xt_entry_target target; +- int verdict; +-}; +- +-struct xt_error_target { +- struct xt_entry_target target; +- char errorname[XT_FUNCTION_MAXNAMELEN]; +-}; +- +-/* The argument to IPT_SO_GET_REVISION_*. Returns highest revision +- * kernel supports, if >= revision. */ +-struct xt_get_revision { +- char name[XT_EXTENSION_MAXNAMELEN]; +- __u8 revision; +-}; +- +-/* CONTINUE verdict for targets */ +-#define XT_CONTINUE 0xFFFFFFFF +- +-/* For standard target */ +-#define XT_RETURN (-NF_REPEAT - 1) +- +-/* this is a dummy structure to find out the alignment requirement for a struct +- * containing all the fundamental data types that are used in ipt_entry, +- * ip6t_entry and arpt_entry. This sucks, and it is a hack. It will be my +- * personal pleasure to remove it -HW +- */ +-struct _xt_align { +- __u8 u8; +- __u16 u16; +- __u32 u32; +- __u64 u64; +-}; +- +-#define XT_ALIGN(s) __ALIGN_KERNEL((s), __alignof__(struct _xt_align)) +- +-/* Standard return verdict, or do jump. */ +-#define XT_STANDARD_TARGET "" +-/* Error verdict. */ +-#define XT_ERROR_TARGET "ERROR" +- +-#define SET_COUNTER(c,b,p) do { (c).bcnt = (b); (c).pcnt = (p); } while(0) +-#define ADD_COUNTER(c,b,p) do { (c).bcnt += (b); (c).pcnt += (p); } while(0) +- +-struct xt_counters { +- __u64 pcnt, bcnt; /* Packet and byte counters */ +-}; +- +-/* The argument to IPT_SO_ADD_COUNTERS. */ +-struct xt_counters_info { +- /* Which table. */ +- char name[XT_TABLE_MAXNAMELEN]; +- +- unsigned int num_counters; +- +- /* The counters (actually `number' of these). */ +- struct xt_counters counters[0]; +-}; +- +-#define XT_INV_PROTO 0x40 /* Invert the sense of PROTO. */ +- +-/* fn returns 0 to continue iteration */ +-#define XT_MATCH_ITERATE(type, e, fn, args...) \ +-({ \ +- unsigned int __i; \ +- int __ret = 0; \ +- struct xt_entry_match *__m; \ +- \ +- for (__i = sizeof(type); \ +- __i < (e)->target_offset; \ +- __i += __m->u.match_size) { \ +- __m = (void *)e + __i; \ +- \ +- __ret = fn(__m , ## args); \ +- if (__ret != 0) \ +- break; \ +- } \ +- __ret; \ +-}) +- +-/* fn returns 0 to continue iteration */ +-#define XT_ENTRY_ITERATE_CONTINUE(type, entries, size, n, fn, args...) \ +-({ \ +- unsigned int __i, __n; \ +- int __ret = 0; \ +- type *__entry; \ +- \ +- for (__i = 0, __n = 0; __i < (size); \ +- __i += __entry->next_offset, __n++) { \ +- __entry = (void *)(entries) + __i; \ +- if (__n < n) \ +- continue; \ +- \ +- __ret = fn(__entry , ## args); \ +- if (__ret != 0) \ +- break; \ +- } \ +- __ret; \ +-}) +- +-/* fn returns 0 to continue iteration */ +-#define XT_ENTRY_ITERATE(type, entries, size, fn, args...) \ +- XT_ENTRY_ITERATE_CONTINUE(type, entries, size, 0, fn, args) +- +- +-/* pos is normally a struct ipt_entry/ip6t_entry/etc. */ +-#define xt_entry_foreach(pos, ehead, esize) \ +- for ((pos) = (typeof(pos))(ehead); \ +- (pos) < (typeof(pos))((char *)(ehead) + (esize)); \ +- (pos) = (typeof(pos))((char *)(pos) + (pos)->next_offset)) +- +-/* can only be xt_entry_match, so no use of typeof here */ +-#define xt_ematch_foreach(pos, entry) \ +- for ((pos) = (struct xt_entry_match *)entry->elems; \ +- (pos) < (struct xt_entry_match *)((char *)(entry) + \ +- (entry)->target_offset); \ +- (pos) = (struct xt_entry_match *)((char *)(pos) + \ +- (pos)->u.match_size)) +- +- +-#endif /* _X_TABLES_H */ +diff --git a/include/linux/netfilter/xt_set.h b/include/linux/netfilter/xt_set.h +deleted file mode 100644 +index d4e0234..0000000 +--- a/include/linux/netfilter/xt_set.h ++++ /dev/null +@@ -1,93 +0,0 @@ +-#ifndef _XT_SET_H +-#define _XT_SET_H +- +-#include +-#include +- +-/* Revision 0 interface: backward compatible with netfilter/iptables */ +- +-/* +- * Option flags for kernel operations (xt_set_info_v0) +- */ +-#define IPSET_SRC 0x01 /* Source match/add */ +-#define IPSET_DST 0x02 /* Destination match/add */ +-#define IPSET_MATCH_INV 0x04 /* Inverse matching */ +- +-struct xt_set_info_v0 { +- ip_set_id_t index; +- union { +- __u32 flags[IPSET_DIM_MAX + 1]; +- struct { +- __u32 __flags[IPSET_DIM_MAX]; +- __u8 dim; +- __u8 flags; +- } compat; +- } u; +-}; +- +-/* match and target infos */ +-struct xt_set_info_match_v0 { +- struct xt_set_info_v0 match_set; +-}; +- +-struct xt_set_info_target_v0 { +- struct xt_set_info_v0 add_set; +- struct xt_set_info_v0 del_set; +-}; +- +-/* Revision 1 match and target */ +- +-struct xt_set_info { +- ip_set_id_t index; +- __u8 dim; +- __u8 flags; +-}; +- +-/* match and target infos */ +-struct xt_set_info_match_v1 { +- struct xt_set_info match_set; +-}; +- +-struct xt_set_info_target_v1 { +- struct xt_set_info add_set; +- struct xt_set_info del_set; +-}; +- +-/* Revision 2 target */ +- +-struct xt_set_info_target_v2 { +- struct xt_set_info add_set; +- struct xt_set_info del_set; +- __u32 flags; +- __u32 timeout; +-}; +- +-/* Revision 3 match */ +- +-struct xt_set_info_match_v3 { +- struct xt_set_info match_set; +- struct ip_set_counter_match0 packets; +- struct ip_set_counter_match0 bytes; +- __u32 flags; +-}; +- +-/* Revision 3 target */ +- +-struct xt_set_info_target_v3 { +- struct xt_set_info add_set; +- struct xt_set_info del_set; +- struct xt_set_info map_set; +- __u32 flags; +- __u32 timeout; +-}; +- +-/* Revision 4 match */ +- +-struct xt_set_info_match_v4 { +- struct xt_set_info match_set; +- struct ip_set_counter_match packets; +- struct ip_set_counter_match bytes; +- __u32 flags; +-}; +- +-#endif /*_XT_SET_H*/ +diff --git a/include/linux/netfilter/xt_tcpudp.h b/include/linux/netfilter/xt_tcpudp.h +deleted file mode 100644 +index 38aa7b3..0000000 +--- a/include/linux/netfilter/xt_tcpudp.h ++++ /dev/null +@@ -1,36 +0,0 @@ +-#ifndef _XT_TCPUDP_H +-#define _XT_TCPUDP_H +- +-#include +- +-/* TCP matching stuff */ +-struct xt_tcp { +- __u16 spts[2]; /* Source port range. */ +- __u16 dpts[2]; /* Destination port range. */ +- __u8 option; /* TCP Option iff non-zero*/ +- __u8 flg_mask; /* TCP flags mask byte */ +- __u8 flg_cmp; /* TCP flags compare byte */ +- __u8 invflags; /* Inverse flags */ +-}; +- +-/* Values for "inv" field in struct ipt_tcp. */ +-#define XT_TCP_INV_SRCPT 0x01 /* Invert the sense of source ports. */ +-#define XT_TCP_INV_DSTPT 0x02 /* Invert the sense of dest ports. */ +-#define XT_TCP_INV_FLAGS 0x04 /* Invert the sense of TCP flags. */ +-#define XT_TCP_INV_OPTION 0x08 /* Invert the sense of option test. */ +-#define XT_TCP_INV_MASK 0x0F /* All possible flags. */ +- +-/* UDP matching stuff */ +-struct xt_udp { +- __u16 spts[2]; /* Source port range. */ +- __u16 dpts[2]; /* Destination port range. */ +- __u8 invflags; /* Inverse flags */ +-}; +- +-/* Values for "invflags" field in struct ipt_udp. */ +-#define XT_UDP_INV_SRCPT 0x01 /* Invert the sense of source ports. */ +-#define XT_UDP_INV_DSTPT 0x02 /* Invert the sense of dest ports. */ +-#define XT_UDP_INV_MASK 0x03 /* All possible flags. */ +- +- +-#endif +diff --git a/include/linux/netfilter_ipv4.h b/include/linux/netfilter_ipv4.h +deleted file mode 100644 +index a5f4dc7..0000000 +--- a/include/linux/netfilter_ipv4.h ++++ /dev/null +@@ -1,79 +0,0 @@ +-/* IPv4-specific defines for netfilter. +- * (C)1998 Rusty Russell -- This code is GPL. +- */ +-#ifndef __LINUX_IP_NETFILTER_H +-#define __LINUX_IP_NETFILTER_H +- +- +-#include +- +-/* only for userspace compatibility */ +- +-#include /* for INT_MIN, INT_MAX */ +- +-/* IP Cache bits. */ +-/* Src IP address. */ +-#define NFC_IP_SRC 0x0001 +-/* Dest IP address. */ +-#define NFC_IP_DST 0x0002 +-/* Input device. */ +-#define NFC_IP_IF_IN 0x0004 +-/* Output device. */ +-#define NFC_IP_IF_OUT 0x0008 +-/* TOS. */ +-#define NFC_IP_TOS 0x0010 +-/* Protocol. */ +-#define NFC_IP_PROTO 0x0020 +-/* IP options. */ +-#define NFC_IP_OPTIONS 0x0040 +-/* Frag & flags. */ +-#define NFC_IP_FRAG 0x0080 +- +-/* Per-protocol information: only matters if proto match. */ +-/* TCP flags. */ +-#define NFC_IP_TCPFLAGS 0x0100 +-/* Source port. */ +-#define NFC_IP_SRC_PT 0x0200 +-/* Dest port. */ +-#define NFC_IP_DST_PT 0x0400 +-/* Something else about the proto */ +-#define NFC_IP_PROTO_UNKNOWN 0x2000 +- +-/* IP Hooks */ +-/* After promisc drops, checksum checks. */ +-#define NF_IP_PRE_ROUTING 0 +-/* If the packet is destined for this box. */ +-#define NF_IP_LOCAL_IN 1 +-/* If the packet is destined for another interface. */ +-#define NF_IP_FORWARD 2 +-/* Packets coming from a local process. */ +-#define NF_IP_LOCAL_OUT 3 +-/* Packets about to hit the wire. */ +-#define NF_IP_POST_ROUTING 4 +-#define NF_IP_NUMHOOKS 5 +- +-enum nf_ip_hook_priorities { +- NF_IP_PRI_FIRST = INT_MIN, +- NF_IP_PRI_CONNTRACK_DEFRAG = -400, +- NF_IP_PRI_RAW = -300, +- NF_IP_PRI_SELINUX_FIRST = -225, +- NF_IP_PRI_CONNTRACK = -200, +- NF_IP_PRI_MANGLE = -150, +- NF_IP_PRI_NAT_DST = -100, +- NF_IP_PRI_FILTER = 0, +- NF_IP_PRI_SECURITY = 50, +- NF_IP_PRI_NAT_SRC = 100, +- NF_IP_PRI_SELINUX_LAST = 225, +- NF_IP_PRI_CONNTRACK_HELPER = 300, +- NF_IP_PRI_CONNTRACK_CONFIRM = INT_MAX, +- NF_IP_PRI_LAST = INT_MAX, +-}; +- +-/* Arguments for setsockopt SOL_IP: */ +-/* 2.0 firewalling went from 64 through 71 (and +256, +512, etc). */ +-/* 2.2 firewalling (+ masq) went from 64 through 76 */ +-/* 2.4 firewalling went 64 through 67. */ +-#define SO_ORIGINAL_DST 80 +- +- +-#endif /* __LINUX_IP_NETFILTER_H */ +diff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h +deleted file mode 100644 +index 456fb86..0000000 +--- a/include/linux/netfilter_ipv4/ip_tables.h ++++ /dev/null +@@ -1,228 +0,0 @@ +-/* +- * 25-Jul-1998 Major changes to allow for ip chain table +- * +- * 3-Jan-2000 Named tables to allow packet selection for different uses. +- */ +- +-/* +- * Format of an IP firewall descriptor +- * +- * src, dst, src_mask, dst_mask are always stored in network byte order. +- * flags are stored in host byte order (of course). +- * Port numbers are stored in HOST byte order. +- */ +- +-#ifndef _IPTABLES_H +-#define _IPTABLES_H +- +-#include +- +-#include +-#include +- +-#include +- +-#define IPT_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN +-#define IPT_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN +-#define ipt_match xt_match +-#define ipt_target xt_target +-#define ipt_table xt_table +-#define ipt_get_revision xt_get_revision +-#define ipt_entry_match xt_entry_match +-#define ipt_entry_target xt_entry_target +-#define ipt_standard_target xt_standard_target +-#define ipt_error_target xt_error_target +-#define ipt_counters xt_counters +-#define IPT_CONTINUE XT_CONTINUE +-#define IPT_RETURN XT_RETURN +- +-/* This group is older than old (iptables < v1.4.0-rc1~89) */ +-#include +-#define ipt_udp xt_udp +-#define ipt_tcp xt_tcp +-#define IPT_TCP_INV_SRCPT XT_TCP_INV_SRCPT +-#define IPT_TCP_INV_DSTPT XT_TCP_INV_DSTPT +-#define IPT_TCP_INV_FLAGS XT_TCP_INV_FLAGS +-#define IPT_TCP_INV_OPTION XT_TCP_INV_OPTION +-#define IPT_TCP_INV_MASK XT_TCP_INV_MASK +-#define IPT_UDP_INV_SRCPT XT_UDP_INV_SRCPT +-#define IPT_UDP_INV_DSTPT XT_UDP_INV_DSTPT +-#define IPT_UDP_INV_MASK XT_UDP_INV_MASK +- +-/* The argument to IPT_SO_ADD_COUNTERS. */ +-#define ipt_counters_info xt_counters_info +-/* Standard return verdict, or do jump. */ +-#define IPT_STANDARD_TARGET XT_STANDARD_TARGET +-/* Error verdict. */ +-#define IPT_ERROR_TARGET XT_ERROR_TARGET +- +-/* fn returns 0 to continue iteration */ +-#define IPT_MATCH_ITERATE(e, fn, args...) \ +- XT_MATCH_ITERATE(struct ipt_entry, e, fn, ## args) +- +-/* fn returns 0 to continue iteration */ +-#define IPT_ENTRY_ITERATE(entries, size, fn, args...) \ +- XT_ENTRY_ITERATE(struct ipt_entry, entries, size, fn, ## args) +- +-/* Yes, Virginia, you have to zero the padding. */ +-struct ipt_ip { +- /* Source and destination IP addr */ +- struct in_addr src, dst; +- /* Mask for src and dest IP addr */ +- struct in_addr smsk, dmsk; +- char iniface[IFNAMSIZ], outiface[IFNAMSIZ]; +- unsigned char iniface_mask[IFNAMSIZ], outiface_mask[IFNAMSIZ]; +- +- /* Protocol, 0 = ANY */ +- __u16 proto; +- +- /* Flags word */ +- __u8 flags; +- /* Inverse flags */ +- __u8 invflags; +-}; +- +-/* Values for "flag" field in struct ipt_ip (general ip structure). */ +-#define IPT_F_FRAG 0x01 /* Set if rule is a fragment rule */ +-#define IPT_F_GOTO 0x02 /* Set if jump is a goto */ +-#define IPT_F_MASK 0x03 /* All possible flag bits mask. */ +- +-/* Values for "inv" field in struct ipt_ip. */ +-#define IPT_INV_VIA_IN 0x01 /* Invert the sense of IN IFACE. */ +-#define IPT_INV_VIA_OUT 0x02 /* Invert the sense of OUT IFACE */ +-#define IPT_INV_TOS 0x04 /* Invert the sense of TOS. */ +-#define IPT_INV_SRCIP 0x08 /* Invert the sense of SRC IP. */ +-#define IPT_INV_DSTIP 0x10 /* Invert the sense of DST OP. */ +-#define IPT_INV_FRAG 0x20 /* Invert the sense of FRAG. */ +-#define IPT_INV_PROTO XT_INV_PROTO +-#define IPT_INV_MASK 0x7F /* All possible flag bits mask. */ +- +-/* This structure defines each of the firewall rules. Consists of 3 +- parts which are 1) general IP header stuff 2) match specific +- stuff 3) the target to perform if the rule matches */ +-struct ipt_entry { +- struct ipt_ip ip; +- +- /* Mark with fields that we care about. */ +- unsigned int nfcache; +- +- /* Size of ipt_entry + matches */ +- __u16 target_offset; +- /* Size of ipt_entry + matches + target */ +- __u16 next_offset; +- +- /* Back pointer */ +- unsigned int comefrom; +- +- /* Packet and byte counters. */ +- struct xt_counters counters; +- +- /* The matches (if any), then the target. */ +- unsigned char elems[0]; +-}; +- +-/* +- * New IP firewall options for [gs]etsockopt at the RAW IP level. +- * Unlike BSD Linux inherits IP options so you don't have to use a raw +- * socket for this. Instead we check rights in the calls. +- * +- * ATTENTION: check linux/in.h before adding new number here. +- */ +-#define IPT_BASE_CTL 64 +- +-#define IPT_SO_SET_REPLACE (IPT_BASE_CTL) +-#define IPT_SO_SET_ADD_COUNTERS (IPT_BASE_CTL + 1) +-#define IPT_SO_SET_MAX IPT_SO_SET_ADD_COUNTERS +- +-#define IPT_SO_GET_INFO (IPT_BASE_CTL) +-#define IPT_SO_GET_ENTRIES (IPT_BASE_CTL + 1) +-#define IPT_SO_GET_REVISION_MATCH (IPT_BASE_CTL + 2) +-#define IPT_SO_GET_REVISION_TARGET (IPT_BASE_CTL + 3) +-#define IPT_SO_GET_MAX IPT_SO_GET_REVISION_TARGET +- +-/* ICMP matching stuff */ +-struct ipt_icmp { +- __u8 type; /* type to match */ +- __u8 code[2]; /* range of code */ +- __u8 invflags; /* Inverse flags */ +-}; +- +-/* Values for "inv" field for struct ipt_icmp. */ +-#define IPT_ICMP_INV 0x01 /* Invert the sense of type/code test */ +- +-/* The argument to IPT_SO_GET_INFO */ +-struct ipt_getinfo { +- /* Which table: caller fills this in. */ +- char name[XT_TABLE_MAXNAMELEN]; +- +- /* Kernel fills these in. */ +- /* Which hook entry points are valid: bitmask */ +- unsigned int valid_hooks; +- +- /* Hook entry points: one per netfilter hook. */ +- unsigned int hook_entry[NF_INET_NUMHOOKS]; +- +- /* Underflow points. */ +- unsigned int underflow[NF_INET_NUMHOOKS]; +- +- /* Number of entries */ +- unsigned int num_entries; +- +- /* Size of entries. */ +- unsigned int size; +-}; +- +-/* The argument to IPT_SO_SET_REPLACE. */ +-struct ipt_replace { +- /* Which table. */ +- char name[XT_TABLE_MAXNAMELEN]; +- +- /* Which hook entry points are valid: bitmask. You can't +- change this. */ +- unsigned int valid_hooks; +- +- /* Number of entries */ +- unsigned int num_entries; +- +- /* Total size of new entries */ +- unsigned int size; +- +- /* Hook entry points. */ +- unsigned int hook_entry[NF_INET_NUMHOOKS]; +- +- /* Underflow points. */ +- unsigned int underflow[NF_INET_NUMHOOKS]; +- +- /* Information about old entries: */ +- /* Number of counters (must be equal to current number of entries). */ +- unsigned int num_counters; +- /* The old entries' counters. */ +- struct xt_counters *counters; +- +- /* The entries (hang off end: not really an array). */ +- struct ipt_entry entries[0]; +-}; +- +-/* The argument to IPT_SO_GET_ENTRIES. */ +-struct ipt_get_entries { +- /* Which table: user fills this in. */ +- char name[XT_TABLE_MAXNAMELEN]; +- +- /* User fills this in: total entry size. */ +- unsigned int size; +- +- /* The entries. */ +- struct ipt_entry entrytable[0]; +-}; +- +-/* Helper functions */ +-static __inline__ struct xt_entry_target * +-ipt_get_target(struct ipt_entry *e) +-{ +- return (void *)e + e->target_offset; +-} +- +-/* +- * Main firewall chains definitions and global var's definitions. +- */ +-#endif /* _IPTABLES_H */ +diff --git a/include/linux/netfilter_ipv6.h b/include/linux/netfilter_ipv6.h +deleted file mode 100644 +index 8483d1d..0000000 +--- a/include/linux/netfilter_ipv6.h ++++ /dev/null +@@ -1,77 +0,0 @@ +-/* IPv6-specific defines for netfilter. +- * (C)1998 Rusty Russell -- This code is GPL. +- * (C)1999 David Jeffery +- * this header was blatantly ripped from netfilter_ipv4.h +- * it's amazing what adding a bunch of 6s can do =8^) +- */ +-#ifndef __LINUX_IP6_NETFILTER_H +-#define __LINUX_IP6_NETFILTER_H +- +- +-#include +- +-/* only for userspace compatibility */ +- +-#include /* for INT_MIN, INT_MAX */ +- +-/* IP Cache bits. */ +-/* Src IP address. */ +-#define NFC_IP6_SRC 0x0001 +-/* Dest IP address. */ +-#define NFC_IP6_DST 0x0002 +-/* Input device. */ +-#define NFC_IP6_IF_IN 0x0004 +-/* Output device. */ +-#define NFC_IP6_IF_OUT 0x0008 +-/* TOS. */ +-#define NFC_IP6_TOS 0x0010 +-/* Protocol. */ +-#define NFC_IP6_PROTO 0x0020 +-/* IP options. */ +-#define NFC_IP6_OPTIONS 0x0040 +-/* Frag & flags. */ +-#define NFC_IP6_FRAG 0x0080 +- +- +-/* Per-protocol information: only matters if proto match. */ +-/* TCP flags. */ +-#define NFC_IP6_TCPFLAGS 0x0100 +-/* Source port. */ +-#define NFC_IP6_SRC_PT 0x0200 +-/* Dest port. */ +-#define NFC_IP6_DST_PT 0x0400 +-/* Something else about the proto */ +-#define NFC_IP6_PROTO_UNKNOWN 0x2000 +- +-/* IP6 Hooks */ +-/* After promisc drops, checksum checks. */ +-#define NF_IP6_PRE_ROUTING 0 +-/* If the packet is destined for this box. */ +-#define NF_IP6_LOCAL_IN 1 +-/* If the packet is destined for another interface. */ +-#define NF_IP6_FORWARD 2 +-/* Packets coming from a local process. */ +-#define NF_IP6_LOCAL_OUT 3 +-/* Packets about to hit the wire. */ +-#define NF_IP6_POST_ROUTING 4 +-#define NF_IP6_NUMHOOKS 5 +- +- +-enum nf_ip6_hook_priorities { +- NF_IP6_PRI_FIRST = INT_MIN, +- NF_IP6_PRI_CONNTRACK_DEFRAG = -400, +- NF_IP6_PRI_RAW = -300, +- NF_IP6_PRI_SELINUX_FIRST = -225, +- NF_IP6_PRI_CONNTRACK = -200, +- NF_IP6_PRI_MANGLE = -150, +- NF_IP6_PRI_NAT_DST = -100, +- NF_IP6_PRI_FILTER = 0, +- NF_IP6_PRI_SECURITY = 50, +- NF_IP6_PRI_NAT_SRC = 100, +- NF_IP6_PRI_SELINUX_LAST = 225, +- NF_IP6_PRI_CONNTRACK_HELPER = 300, +- NF_IP6_PRI_LAST = INT_MAX, +-}; +- +- +-#endif /* __LINUX_IP6_NETFILTER_H */ +diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h +deleted file mode 100644 +index fcc8cca..0000000 +--- a/include/linux/netfilter_ipv6/ip6_tables.h ++++ /dev/null +@@ -1,269 +0,0 @@ +-/* +- * 25-Jul-1998 Major changes to allow for ip chain table +- * +- * 3-Jan-2000 Named tables to allow packet selection for different uses. +- */ +- +-/* +- * Format of an IP6 firewall descriptor +- * +- * src, dst, src_mask, dst_mask are always stored in network byte order. +- * flags are stored in host byte order (of course). +- * Port numbers are stored in HOST byte order. +- */ +- +-#ifndef _IP6_TABLES_H +-#define _IP6_TABLES_H +- +-#include +- +-#include +-#include +- +-#include +- +-#define IP6T_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN +-#define IP6T_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN +-#define ip6t_match xt_match +-#define ip6t_target xt_target +-#define ip6t_table xt_table +-#define ip6t_get_revision xt_get_revision +-#define ip6t_entry_match xt_entry_match +-#define ip6t_entry_target xt_entry_target +-#define ip6t_standard_target xt_standard_target +-#define ip6t_error_target xt_error_target +-#define ip6t_counters xt_counters +-#define IP6T_CONTINUE XT_CONTINUE +-#define IP6T_RETURN XT_RETURN +- +-/* Pre-iptables-1.4.0 */ +-#include +-#define ip6t_tcp xt_tcp +-#define ip6t_udp xt_udp +-#define IP6T_TCP_INV_SRCPT XT_TCP_INV_SRCPT +-#define IP6T_TCP_INV_DSTPT XT_TCP_INV_DSTPT +-#define IP6T_TCP_INV_FLAGS XT_TCP_INV_FLAGS +-#define IP6T_TCP_INV_OPTION XT_TCP_INV_OPTION +-#define IP6T_TCP_INV_MASK XT_TCP_INV_MASK +-#define IP6T_UDP_INV_SRCPT XT_UDP_INV_SRCPT +-#define IP6T_UDP_INV_DSTPT XT_UDP_INV_DSTPT +-#define IP6T_UDP_INV_MASK XT_UDP_INV_MASK +- +-#define ip6t_counters_info xt_counters_info +-#define IP6T_STANDARD_TARGET XT_STANDARD_TARGET +-#define IP6T_ERROR_TARGET XT_ERROR_TARGET +-#define IP6T_MATCH_ITERATE(e, fn, args...) \ +- XT_MATCH_ITERATE(struct ip6t_entry, e, fn, ## args) +-#define IP6T_ENTRY_ITERATE(entries, size, fn, args...) \ +- XT_ENTRY_ITERATE(struct ip6t_entry, entries, size, fn, ## args) +- +-/* Yes, Virginia, you have to zero the padding. */ +-struct ip6t_ip6 { +- /* Source and destination IP6 addr */ +- struct in6_addr src, dst; +- /* Mask for src and dest IP6 addr */ +- struct in6_addr smsk, dmsk; +- char iniface[IFNAMSIZ], outiface[IFNAMSIZ]; +- unsigned char iniface_mask[IFNAMSIZ], outiface_mask[IFNAMSIZ]; +- +- /* Upper protocol number +- * - The allowed value is 0 (any) or protocol number of last parsable +- * header, which is 50 (ESP), 59 (No Next Header), 135 (MH), or +- * the non IPv6 extension headers. +- * - The protocol numbers of IPv6 extension headers except of ESP and +- * MH do not match any packets. +- * - You also need to set IP6T_FLAGS_PROTO to "flags" to check protocol. +- */ +- __u16 proto; +- /* TOS to match iff flags & IP6T_F_TOS */ +- __u8 tos; +- +- /* Flags word */ +- __u8 flags; +- /* Inverse flags */ +- __u8 invflags; +-}; +- +-/* Values for "flag" field in struct ip6t_ip6 (general ip6 structure). */ +-#define IP6T_F_PROTO 0x01 /* Set if rule cares about upper +- protocols */ +-#define IP6T_F_TOS 0x02 /* Match the TOS. */ +-#define IP6T_F_GOTO 0x04 /* Set if jump is a goto */ +-#define IP6T_F_MASK 0x07 /* All possible flag bits mask. */ +- +-/* Values for "inv" field in struct ip6t_ip6. */ +-#define IP6T_INV_VIA_IN 0x01 /* Invert the sense of IN IFACE. */ +-#define IP6T_INV_VIA_OUT 0x02 /* Invert the sense of OUT IFACE */ +-#define IP6T_INV_TOS 0x04 /* Invert the sense of TOS. */ +-#define IP6T_INV_SRCIP 0x08 /* Invert the sense of SRC IP. */ +-#define IP6T_INV_DSTIP 0x10 /* Invert the sense of DST OP. */ +-#define IP6T_INV_FRAG 0x20 /* Invert the sense of FRAG. */ +-#define IP6T_INV_PROTO XT_INV_PROTO +-#define IP6T_INV_MASK 0x7F /* All possible flag bits mask. */ +- +-/* This structure defines each of the firewall rules. Consists of 3 +- parts which are 1) general IP header stuff 2) match specific +- stuff 3) the target to perform if the rule matches */ +-struct ip6t_entry { +- struct ip6t_ip6 ipv6; +- +- /* Mark with fields that we care about. */ +- unsigned int nfcache; +- +- /* Size of ipt_entry + matches */ +- __u16 target_offset; +- /* Size of ipt_entry + matches + target */ +- __u16 next_offset; +- +- /* Back pointer */ +- unsigned int comefrom; +- +- /* Packet and byte counters. */ +- struct xt_counters counters; +- +- /* The matches (if any), then the target. */ +- unsigned char elems[0]; +-}; +- +-/* Standard entry */ +-struct ip6t_standard { +- struct ip6t_entry entry; +- struct xt_standard_target target; +-}; +- +-struct ip6t_error { +- struct ip6t_entry entry; +- struct xt_error_target target; +-}; +- +-#define IP6T_ENTRY_INIT(__size) \ +-{ \ +- .target_offset = sizeof(struct ip6t_entry), \ +- .next_offset = (__size), \ +-} +- +-#define IP6T_STANDARD_INIT(__verdict) \ +-{ \ +- .entry = IP6T_ENTRY_INIT(sizeof(struct ip6t_standard)), \ +- .target = XT_TARGET_INIT(XT_STANDARD_TARGET, \ +- sizeof(struct xt_standard_target)), \ +- .target.verdict = -(__verdict) - 1, \ +-} +- +-#define IP6T_ERROR_INIT \ +-{ \ +- .entry = IP6T_ENTRY_INIT(sizeof(struct ip6t_error)), \ +- .target = XT_TARGET_INIT(XT_ERROR_TARGET, \ +- sizeof(struct xt_error_target)), \ +- .target.errorname = "ERROR", \ +-} +- +-/* +- * New IP firewall options for [gs]etsockopt at the RAW IP level. +- * Unlike BSD Linux inherits IP options so you don't have to use +- * a raw socket for this. Instead we check rights in the calls. +- * +- * ATTENTION: check linux/in6.h before adding new number here. +- */ +-#define IP6T_BASE_CTL 64 +- +-#define IP6T_SO_SET_REPLACE (IP6T_BASE_CTL) +-#define IP6T_SO_SET_ADD_COUNTERS (IP6T_BASE_CTL + 1) +-#define IP6T_SO_SET_MAX IP6T_SO_SET_ADD_COUNTERS +- +-#define IP6T_SO_GET_INFO (IP6T_BASE_CTL) +-#define IP6T_SO_GET_ENTRIES (IP6T_BASE_CTL + 1) +-#define IP6T_SO_GET_REVISION_MATCH (IP6T_BASE_CTL + 4) +-#define IP6T_SO_GET_REVISION_TARGET (IP6T_BASE_CTL + 5) +-#define IP6T_SO_GET_MAX IP6T_SO_GET_REVISION_TARGET +- +-/* obtain original address if REDIRECT'd connection */ +-#define IP6T_SO_ORIGINAL_DST 80 +- +-/* ICMP matching stuff */ +-struct ip6t_icmp { +- __u8 type; /* type to match */ +- __u8 code[2]; /* range of code */ +- __u8 invflags; /* Inverse flags */ +-}; +- +-/* Values for "inv" field for struct ipt_icmp. */ +-#define IP6T_ICMP_INV 0x01 /* Invert the sense of type/code test */ +- +-/* The argument to IP6T_SO_GET_INFO */ +-struct ip6t_getinfo { +- /* Which table: caller fills this in. */ +- char name[XT_TABLE_MAXNAMELEN]; +- +- /* Kernel fills these in. */ +- /* Which hook entry points are valid: bitmask */ +- unsigned int valid_hooks; +- +- /* Hook entry points: one per netfilter hook. */ +- unsigned int hook_entry[NF_INET_NUMHOOKS]; +- +- /* Underflow points. */ +- unsigned int underflow[NF_INET_NUMHOOKS]; +- +- /* Number of entries */ +- unsigned int num_entries; +- +- /* Size of entries. */ +- unsigned int size; +-}; +- +-/* The argument to IP6T_SO_SET_REPLACE. */ +-struct ip6t_replace { +- /* Which table. */ +- char name[XT_TABLE_MAXNAMELEN]; +- +- /* Which hook entry points are valid: bitmask. You can't +- change this. */ +- unsigned int valid_hooks; +- +- /* Number of entries */ +- unsigned int num_entries; +- +- /* Total size of new entries */ +- unsigned int size; +- +- /* Hook entry points. */ +- unsigned int hook_entry[NF_INET_NUMHOOKS]; +- +- /* Underflow points. */ +- unsigned int underflow[NF_INET_NUMHOOKS]; +- +- /* Information about old entries: */ +- /* Number of counters (must be equal to current number of entries). */ +- unsigned int num_counters; +- /* The old entries' counters. */ +- struct xt_counters *counters; +- +- /* The entries (hang off end: not really an array). */ +- struct ip6t_entry entries[0]; +-}; +- +-/* The argument to IP6T_SO_GET_ENTRIES. */ +-struct ip6t_get_entries { +- /* Which table: user fills this in. */ +- char name[XT_TABLE_MAXNAMELEN]; +- +- /* User fills this in: total entry size. */ +- unsigned int size; +- +- /* The entries. */ +- struct ip6t_entry entrytable[0]; +-}; +- +-/* Helper functions */ +-static __inline__ struct xt_entry_target * +-ip6t_get_target(struct ip6t_entry *e) +-{ +- return (void *)e + e->target_offset; +-} +- +-/* +- * Main firewall chains definitions and global var's definitions. +- */ +- +-#endif /* _IP6_TABLES_H */ +diff --git a/include/linux/netlink.h b/include/linux/netlink.h +deleted file mode 100644 +index ec0690b..0000000 +--- a/include/linux/netlink.h ++++ /dev/null +@@ -1,246 +0,0 @@ +-#ifndef __LINUX_NETLINK_H +-#define __LINUX_NETLINK_H +- +-#include +-#include /* for __kernel_sa_family_t */ +-#include +- +-#define NETLINK_ROUTE 0 /* Routing/device hook */ +-#define NETLINK_UNUSED 1 /* Unused number */ +-#define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */ +-#define NETLINK_FIREWALL 3 /* Unused number, formerly ip_queue */ +-#define NETLINK_SOCK_DIAG 4 /* socket monitoring */ +-#define NETLINK_NFLOG 5 /* netfilter/iptables ULOG */ +-#define NETLINK_XFRM 6 /* ipsec */ +-#define NETLINK_SELINUX 7 /* SELinux event notifications */ +-#define NETLINK_ISCSI 8 /* Open-iSCSI */ +-#define NETLINK_AUDIT 9 /* auditing */ +-#define NETLINK_FIB_LOOKUP 10 +-#define NETLINK_CONNECTOR 11 +-#define NETLINK_NETFILTER 12 /* netfilter subsystem */ +-#define NETLINK_IP6_FW 13 +-#define NETLINK_DNRTMSG 14 /* DECnet routing messages */ +-#define NETLINK_KOBJECT_UEVENT 15 /* Kernel messages to userspace */ +-#define NETLINK_GENERIC 16 +-/* leave room for NETLINK_DM (DM Events) */ +-#define NETLINK_SCSITRANSPORT 18 /* SCSI Transports */ +-#define NETLINK_ECRYPTFS 19 +-#define NETLINK_RDMA 20 +-#define NETLINK_CRYPTO 21 /* Crypto layer */ +-#define NETLINK_SMC 22 /* SMC monitoring */ +- +-#define NETLINK_INET_DIAG NETLINK_SOCK_DIAG +- +-#define MAX_LINKS 32 +- +-struct sockaddr_nl { +- __kernel_sa_family_t nl_family; /* AF_NETLINK */ +- unsigned short nl_pad; /* zero */ +- __u32 nl_pid; /* port ID */ +- __u32 nl_groups; /* multicast groups mask */ +-}; +- +-struct nlmsghdr { +- __u32 nlmsg_len; /* Length of message including header */ +- __u16 nlmsg_type; /* Message content */ +- __u16 nlmsg_flags; /* Additional flags */ +- __u32 nlmsg_seq; /* Sequence number */ +- __u32 nlmsg_pid; /* Sending process port ID */ +-}; +- +-/* Flags values */ +- +-#define NLM_F_REQUEST 0x01 /* It is request message. */ +-#define NLM_F_MULTI 0x02 /* Multipart message, terminated by NLMSG_DONE */ +-#define NLM_F_ACK 0x04 /* Reply with ack, with zero or error code */ +-#define NLM_F_ECHO 0x08 /* Echo this request */ +-#define NLM_F_DUMP_INTR 0x10 /* Dump was inconsistent due to sequence change */ +-#define NLM_F_DUMP_FILTERED 0x20 /* Dump was filtered as requested */ +- +-/* Modifiers to GET request */ +-#define NLM_F_ROOT 0x100 /* specify tree root */ +-#define NLM_F_MATCH 0x200 /* return all matching */ +-#define NLM_F_ATOMIC 0x400 /* atomic GET */ +-#define NLM_F_DUMP (NLM_F_ROOT|NLM_F_MATCH) +- +-/* Modifiers to NEW request */ +-#define NLM_F_REPLACE 0x100 /* Override existing */ +-#define NLM_F_EXCL 0x200 /* Do not touch, if it exists */ +-#define NLM_F_CREATE 0x400 /* Create, if it does not exist */ +-#define NLM_F_APPEND 0x800 /* Add to end of list */ +- +-/* Modifiers to DELETE request */ +-#define NLM_F_NONREC 0x100 /* Do not delete recursively */ +- +-/* Flags for ACK message */ +-#define NLM_F_CAPPED 0x100 /* request was capped */ +-#define NLM_F_ACK_TLVS 0x200 /* extended ACK TVLs were included */ +- +-/* +- 4.4BSD ADD NLM_F_CREATE|NLM_F_EXCL +- 4.4BSD CHANGE NLM_F_REPLACE +- +- True CHANGE NLM_F_CREATE|NLM_F_REPLACE +- Append NLM_F_CREATE +- Check NLM_F_EXCL +- */ +- +-#define NLMSG_ALIGNTO 4U +-#define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) ) +-#define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr))) +-#define NLMSG_LENGTH(len) ((len) + NLMSG_HDRLEN) +-#define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len)) +-#define NLMSG_DATA(nlh) ((void*)(((char*)nlh) + NLMSG_LENGTH(0))) +-#define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \ +- (struct nlmsghdr*)(((char*)(nlh)) + NLMSG_ALIGN((nlh)->nlmsg_len))) +-#define NLMSG_OK(nlh,len) ((len) >= (int)sizeof(struct nlmsghdr) && \ +- (nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && \ +- (nlh)->nlmsg_len <= (len)) +-#define NLMSG_PAYLOAD(nlh,len) ((nlh)->nlmsg_len - NLMSG_SPACE((len))) +- +-#define NLMSG_NOOP 0x1 /* Nothing. */ +-#define NLMSG_ERROR 0x2 /* Error */ +-#define NLMSG_DONE 0x3 /* End of a dump */ +-#define NLMSG_OVERRUN 0x4 /* Data lost */ +- +-#define NLMSG_MIN_TYPE 0x10 /* < 0x10: reserved control messages */ +- +-struct nlmsgerr { +- int error; +- struct nlmsghdr msg; +- /* +- * followed by the message contents unless NETLINK_CAP_ACK was set +- * or the ACK indicates success (error == 0) +- * message length is aligned with NLMSG_ALIGN() +- */ +- /* +- * followed by TLVs defined in enum nlmsgerr_attrs +- * if NETLINK_EXT_ACK was set +- */ +-}; +- +-/** +- * enum nlmsgerr_attrs - nlmsgerr attributes +- * @NLMSGERR_ATTR_UNUSED: unused +- * @NLMSGERR_ATTR_MSG: error message string (string) +- * @NLMSGERR_ATTR_OFFS: offset of the invalid attribute in the original +- * message, counting from the beginning of the header (u32) +- * @NLMSGERR_ATTR_COOKIE: arbitrary subsystem specific cookie to +- * be used - in the success case - to identify a created +- * object or operation or similar (binary) +- * @__NLMSGERR_ATTR_MAX: number of attributes +- * @NLMSGERR_ATTR_MAX: highest attribute number +- */ +-enum nlmsgerr_attrs { +- NLMSGERR_ATTR_UNUSED, +- NLMSGERR_ATTR_MSG, +- NLMSGERR_ATTR_OFFS, +- NLMSGERR_ATTR_COOKIE, +- +- __NLMSGERR_ATTR_MAX, +- NLMSGERR_ATTR_MAX = __NLMSGERR_ATTR_MAX - 1 +-}; +- +-#define NETLINK_ADD_MEMBERSHIP 1 +-#define NETLINK_DROP_MEMBERSHIP 2 +-#define NETLINK_PKTINFO 3 +-#define NETLINK_BROADCAST_ERROR 4 +-#define NETLINK_NO_ENOBUFS 5 +-#define NETLINK_RX_RING 6 +-#define NETLINK_TX_RING 7 +-#define NETLINK_LISTEN_ALL_NSID 8 +-#define NETLINK_LIST_MEMBERSHIPS 9 +-#define NETLINK_CAP_ACK 10 +-#define NETLINK_EXT_ACK 11 +- +-struct nl_pktinfo { +- __u32 group; +-}; +- +-struct nl_mmap_req { +- unsigned int nm_block_size; +- unsigned int nm_block_nr; +- unsigned int nm_frame_size; +- unsigned int nm_frame_nr; +-}; +- +-struct nl_mmap_hdr { +- unsigned int nm_status; +- unsigned int nm_len; +- __u32 nm_group; +- /* credentials */ +- __u32 nm_pid; +- __u32 nm_uid; +- __u32 nm_gid; +-}; +- +-enum nl_mmap_status { +- NL_MMAP_STATUS_UNUSED, +- NL_MMAP_STATUS_RESERVED, +- NL_MMAP_STATUS_VALID, +- NL_MMAP_STATUS_COPY, +- NL_MMAP_STATUS_SKIP, +-}; +- +-#define NL_MMAP_MSG_ALIGNMENT NLMSG_ALIGNTO +-#define NL_MMAP_MSG_ALIGN(sz) __ALIGN_KERNEL(sz, NL_MMAP_MSG_ALIGNMENT) +-#define NL_MMAP_HDRLEN NL_MMAP_MSG_ALIGN(sizeof(struct nl_mmap_hdr)) +- +-#define NET_MAJOR 36 /* Major 36 is reserved for networking */ +- +-enum { +- NETLINK_UNCONNECTED = 0, +- NETLINK_CONNECTED, +-}; +- +-/* +- * <------- NLA_HDRLEN ------> <-- NLA_ALIGN(payload)--> +- * +---------------------+- - -+- - - - - - - - - -+- - -+ +- * | Header | Pad | Payload | Pad | +- * | (struct nlattr) | ing | | ing | +- * +---------------------+- - -+- - - - - - - - - -+- - -+ +- * <-------------- nlattr->nla_len --------------> +- */ +- +-struct nlattr { +- __u16 nla_len; +- __u16 nla_type; +-}; +- +-/* +- * nla_type (16 bits) +- * +---+---+-------------------------------+ +- * | N | O | Attribute Type | +- * +---+---+-------------------------------+ +- * N := Carries nested attributes +- * O := Payload stored in network byte order +- * +- * Note: The N and O flag are mutually exclusive. +- */ +-#define NLA_F_NESTED (1 << 15) +-#define NLA_F_NET_BYTEORDER (1 << 14) +-#define NLA_TYPE_MASK ~(NLA_F_NESTED | NLA_F_NET_BYTEORDER) +- +-#define NLA_ALIGNTO 4 +-#define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1)) +-#define NLA_HDRLEN ((int) NLA_ALIGN(sizeof(struct nlattr))) +- +-/* Generic 32 bitflags attribute content sent to the kernel. +- * +- * The value is a bitmap that defines the values being set +- * The selector is a bitmask that defines which value is legit +- * +- * Examples: +- * value = 0x0, and selector = 0x1 +- * implies we are selecting bit 1 and we want to set its value to 0. +- * +- * value = 0x2, and selector = 0x2 +- * implies we are selecting bit 2 and we want to set its value to 1. +- * +- */ +-struct nla_bitfield32 { +- __u32 value; +- __u32 selector; +-}; +- +-#endif /* __LINUX_NETLINK_H */ +diff --git a/include/linux/netlink_diag.h b/include/linux/netlink_diag.h +deleted file mode 100644 +index c8c8c7d..0000000 +--- a/include/linux/netlink_diag.h ++++ /dev/null +@@ -1,64 +0,0 @@ +-#ifndef __NETLINK_DIAG_H__ +-#define __NETLINK_DIAG_H__ +- +-#include +- +-struct netlink_diag_req { +- __u8 sdiag_family; +- __u8 sdiag_protocol; +- __u16 pad; +- __u32 ndiag_ino; +- __u32 ndiag_show; +- __u32 ndiag_cookie[2]; +-}; +- +-struct netlink_diag_msg { +- __u8 ndiag_family; +- __u8 ndiag_type; +- __u8 ndiag_protocol; +- __u8 ndiag_state; +- +- __u32 ndiag_portid; +- __u32 ndiag_dst_portid; +- __u32 ndiag_dst_group; +- __u32 ndiag_ino; +- __u32 ndiag_cookie[2]; +-}; +- +-struct netlink_diag_ring { +- __u32 ndr_block_size; +- __u32 ndr_block_nr; +- __u32 ndr_frame_size; +- __u32 ndr_frame_nr; +-}; +- +-enum { +- /* NETLINK_DIAG_NONE, standard nl API requires this attribute! */ +- NETLINK_DIAG_MEMINFO, +- NETLINK_DIAG_GROUPS, +- NETLINK_DIAG_RX_RING, +- NETLINK_DIAG_TX_RING, +- NETLINK_DIAG_FLAGS, +- +- __NETLINK_DIAG_MAX, +-}; +- +-#define NETLINK_DIAG_MAX (__NETLINK_DIAG_MAX - 1) +- +-#define NDIAG_PROTO_ALL ((__u8) ~0) +- +-#define NDIAG_SHOW_MEMINFO 0x00000001 /* show memory info of a socket */ +-#define NDIAG_SHOW_GROUPS 0x00000002 /* show groups of a netlink socket */ +-/* deprecated since 4.6 */ +-#define NDIAG_SHOW_RING_CFG 0x00000004 /* show ring configuration */ +-#define NDIAG_SHOW_FLAGS 0x00000008 /* show flags of a netlink socket */ +- +-/* flags */ +-#define NDIAG_FLAG_CB_RUNNING 0x00000001 +-#define NDIAG_FLAG_PKTINFO 0x00000002 +-#define NDIAG_FLAG_BROADCAST_ERROR 0x00000004 +-#define NDIAG_FLAG_NO_ENOBUFS 0x00000008 +-#define NDIAG_FLAG_LISTEN_ALL_NSID 0x00000010 +-#define NDIAG_FLAG_CAP_ACK 0x00000020 +- +-#endif +diff --git a/include/linux/packet_diag.h b/include/linux/packet_diag.h +deleted file mode 100644 +index 0c5d5dd..0000000 +--- a/include/linux/packet_diag.h ++++ /dev/null +@@ -1,80 +0,0 @@ +-#ifndef __PACKET_DIAG_H__ +-#define __PACKET_DIAG_H__ +- +-#include +- +-struct packet_diag_req { +- __u8 sdiag_family; +- __u8 sdiag_protocol; +- __u16 pad; +- __u32 pdiag_ino; +- __u32 pdiag_show; +- __u32 pdiag_cookie[2]; +-}; +- +-#define PACKET_SHOW_INFO 0x00000001 /* Basic packet_sk information */ +-#define PACKET_SHOW_MCLIST 0x00000002 /* A set of packet_diag_mclist-s */ +-#define PACKET_SHOW_RING_CFG 0x00000004 /* Rings configuration parameters */ +-#define PACKET_SHOW_FANOUT 0x00000008 +-#define PACKET_SHOW_MEMINFO 0x00000010 +-#define PACKET_SHOW_FILTER 0x00000020 +- +-struct packet_diag_msg { +- __u8 pdiag_family; +- __u8 pdiag_type; +- __u16 pdiag_num; +- +- __u32 pdiag_ino; +- __u32 pdiag_cookie[2]; +-}; +- +-enum { +- /* PACKET_DIAG_NONE, standard nl API requires this attribute! */ +- PACKET_DIAG_INFO, +- PACKET_DIAG_MCLIST, +- PACKET_DIAG_RX_RING, +- PACKET_DIAG_TX_RING, +- PACKET_DIAG_FANOUT, +- PACKET_DIAG_UID, +- PACKET_DIAG_MEMINFO, +- PACKET_DIAG_FILTER, +- +- __PACKET_DIAG_MAX, +-}; +- +-#define PACKET_DIAG_MAX (__PACKET_DIAG_MAX - 1) +- +-struct packet_diag_info { +- __u32 pdi_index; +- __u32 pdi_version; +- __u32 pdi_reserve; +- __u32 pdi_copy_thresh; +- __u32 pdi_tstamp; +- __u32 pdi_flags; +- +-#define PDI_RUNNING 0x1 +-#define PDI_AUXDATA 0x2 +-#define PDI_ORIGDEV 0x4 +-#define PDI_VNETHDR 0x8 +-#define PDI_LOSS 0x10 +-}; +- +-struct packet_diag_mclist { +- __u32 pdmc_index; +- __u32 pdmc_count; +- __u16 pdmc_type; +- __u16 pdmc_alen; +- __u8 pdmc_addr[32]; /* MAX_ADDR_LEN */ +-}; +- +-struct packet_diag_ring { +- __u32 pdr_block_size; +- __u32 pdr_block_nr; +- __u32 pdr_frame_size; +- __u32 pdr_frame_nr; +- __u32 pdr_retire_tmo; +- __u32 pdr_sizeof_priv; +- __u32 pdr_features; +-}; +- +-#endif +diff --git a/include/linux/param.h b/include/linux/param.h +deleted file mode 100644 +index 092e92f..0000000 +--- a/include/linux/param.h ++++ /dev/null +@@ -1,6 +0,0 @@ +-#ifndef _LINUX_PARAM_H +-#define _LINUX_PARAM_H +- +-#include +- +-#endif +diff --git a/include/linux/pfkeyv2.h b/include/linux/pfkeyv2.h +deleted file mode 100644 +index ada7f01..0000000 +--- a/include/linux/pfkeyv2.h ++++ /dev/null +@@ -1,383 +0,0 @@ +-/* PF_KEY user interface, this is defined by rfc2367 so +- * do not make arbitrary modifications or else this header +- * file will not be compliant. +- */ +- +-#ifndef _LINUX_PFKEY2_H +-#define _LINUX_PFKEY2_H +- +-#include +- +-#define PF_KEY_V2 2 +-#define PFKEYV2_REVISION 199806L +- +-struct sadb_msg { +- __u8 sadb_msg_version; +- __u8 sadb_msg_type; +- __u8 sadb_msg_errno; +- __u8 sadb_msg_satype; +- __u16 sadb_msg_len; +- __u16 sadb_msg_reserved; +- __u32 sadb_msg_seq; +- __u32 sadb_msg_pid; +-} __attribute__((packed)); +-/* sizeof(struct sadb_msg) == 16 */ +- +-struct sadb_ext { +- __u16 sadb_ext_len; +- __u16 sadb_ext_type; +-} __attribute__((packed)); +-/* sizeof(struct sadb_ext) == 4 */ +- +-struct sadb_sa { +- __u16 sadb_sa_len; +- __u16 sadb_sa_exttype; +- __be32 sadb_sa_spi; +- __u8 sadb_sa_replay; +- __u8 sadb_sa_state; +- __u8 sadb_sa_auth; +- __u8 sadb_sa_encrypt; +- __u32 sadb_sa_flags; +-} __attribute__((packed)); +-/* sizeof(struct sadb_sa) == 16 */ +- +-struct sadb_lifetime { +- __u16 sadb_lifetime_len; +- __u16 sadb_lifetime_exttype; +- __u32 sadb_lifetime_allocations; +- __u64 sadb_lifetime_bytes; +- __u64 sadb_lifetime_addtime; +- __u64 sadb_lifetime_usetime; +-} __attribute__((packed)); +-/* sizeof(struct sadb_lifetime) == 32 */ +- +-struct sadb_address { +- __u16 sadb_address_len; +- __u16 sadb_address_exttype; +- __u8 sadb_address_proto; +- __u8 sadb_address_prefixlen; +- __u16 sadb_address_reserved; +-} __attribute__((packed)); +-/* sizeof(struct sadb_address) == 8 */ +- +-struct sadb_key { +- __u16 sadb_key_len; +- __u16 sadb_key_exttype; +- __u16 sadb_key_bits; +- __u16 sadb_key_reserved; +-} __attribute__((packed)); +-/* sizeof(struct sadb_key) == 8 */ +- +-struct sadb_ident { +- __u16 sadb_ident_len; +- __u16 sadb_ident_exttype; +- __u16 sadb_ident_type; +- __u16 sadb_ident_reserved; +- __u64 sadb_ident_id; +-} __attribute__((packed)); +-/* sizeof(struct sadb_ident) == 16 */ +- +-struct sadb_sens { +- __u16 sadb_sens_len; +- __u16 sadb_sens_exttype; +- __u32 sadb_sens_dpd; +- __u8 sadb_sens_sens_level; +- __u8 sadb_sens_sens_len; +- __u8 sadb_sens_integ_level; +- __u8 sadb_sens_integ_len; +- __u32 sadb_sens_reserved; +-} __attribute__((packed)); +-/* sizeof(struct sadb_sens) == 16 */ +- +-/* followed by: +- __u64 sadb_sens_bitmap[sens_len]; +- __u64 sadb_integ_bitmap[integ_len]; */ +- +-struct sadb_prop { +- __u16 sadb_prop_len; +- __u16 sadb_prop_exttype; +- __u8 sadb_prop_replay; +- __u8 sadb_prop_reserved[3]; +-} __attribute__((packed)); +-/* sizeof(struct sadb_prop) == 8 */ +- +-/* followed by: +- struct sadb_comb sadb_combs[(sadb_prop_len + +- sizeof(__u64) - sizeof(struct sadb_prop)) / +- sizeof(struct sadb_comb)]; */ +- +-struct sadb_comb { +- __u8 sadb_comb_auth; +- __u8 sadb_comb_encrypt; +- __u16 sadb_comb_flags; +- __u16 sadb_comb_auth_minbits; +- __u16 sadb_comb_auth_maxbits; +- __u16 sadb_comb_encrypt_minbits; +- __u16 sadb_comb_encrypt_maxbits; +- __u32 sadb_comb_reserved; +- __u32 sadb_comb_soft_allocations; +- __u32 sadb_comb_hard_allocations; +- __u64 sadb_comb_soft_bytes; +- __u64 sadb_comb_hard_bytes; +- __u64 sadb_comb_soft_addtime; +- __u64 sadb_comb_hard_addtime; +- __u64 sadb_comb_soft_usetime; +- __u64 sadb_comb_hard_usetime; +-} __attribute__((packed)); +-/* sizeof(struct sadb_comb) == 72 */ +- +-struct sadb_supported { +- __u16 sadb_supported_len; +- __u16 sadb_supported_exttype; +- __u32 sadb_supported_reserved; +-} __attribute__((packed)); +-/* sizeof(struct sadb_supported) == 8 */ +- +-/* followed by: +- struct sadb_alg sadb_algs[(sadb_supported_len + +- sizeof(__u64) - sizeof(struct sadb_supported)) / +- sizeof(struct sadb_alg)]; */ +- +-struct sadb_alg { +- __u8 sadb_alg_id; +- __u8 sadb_alg_ivlen; +- __u16 sadb_alg_minbits; +- __u16 sadb_alg_maxbits; +- __u16 sadb_alg_reserved; +-} __attribute__((packed)); +-/* sizeof(struct sadb_alg) == 8 */ +- +-struct sadb_spirange { +- __u16 sadb_spirange_len; +- __u16 sadb_spirange_exttype; +- __u32 sadb_spirange_min; +- __u32 sadb_spirange_max; +- __u32 sadb_spirange_reserved; +-} __attribute__((packed)); +-/* sizeof(struct sadb_spirange) == 16 */ +- +-struct sadb_x_kmprivate { +- __u16 sadb_x_kmprivate_len; +- __u16 sadb_x_kmprivate_exttype; +- __u32 sadb_x_kmprivate_reserved; +-} __attribute__((packed)); +-/* sizeof(struct sadb_x_kmprivate) == 8 */ +- +-struct sadb_x_sa2 { +- __u16 sadb_x_sa2_len; +- __u16 sadb_x_sa2_exttype; +- __u8 sadb_x_sa2_mode; +- __u8 sadb_x_sa2_reserved1; +- __u16 sadb_x_sa2_reserved2; +- __u32 sadb_x_sa2_sequence; +- __u32 sadb_x_sa2_reqid; +-} __attribute__((packed)); +-/* sizeof(struct sadb_x_sa2) == 16 */ +- +-struct sadb_x_policy { +- __u16 sadb_x_policy_len; +- __u16 sadb_x_policy_exttype; +- __u16 sadb_x_policy_type; +- __u8 sadb_x_policy_dir; +- __u8 sadb_x_policy_reserved; +- __u32 sadb_x_policy_id; +- __u32 sadb_x_policy_priority; +-} __attribute__((packed)); +-/* sizeof(struct sadb_x_policy) == 16 */ +- +-struct sadb_x_ipsecrequest { +- __u16 sadb_x_ipsecrequest_len; +- __u16 sadb_x_ipsecrequest_proto; +- __u8 sadb_x_ipsecrequest_mode; +- __u8 sadb_x_ipsecrequest_level; +- __u16 sadb_x_ipsecrequest_reserved1; +- __u32 sadb_x_ipsecrequest_reqid; +- __u32 sadb_x_ipsecrequest_reserved2; +-} __attribute__((packed)); +-/* sizeof(struct sadb_x_ipsecrequest) == 16 */ +- +-/* This defines the TYPE of Nat Traversal in use. Currently only one +- * type of NAT-T is supported, draft-ietf-ipsec-udp-encaps-06 +- */ +-struct sadb_x_nat_t_type { +- __u16 sadb_x_nat_t_type_len; +- __u16 sadb_x_nat_t_type_exttype; +- __u8 sadb_x_nat_t_type_type; +- __u8 sadb_x_nat_t_type_reserved[3]; +-} __attribute__((packed)); +-/* sizeof(struct sadb_x_nat_t_type) == 8 */ +- +-/* Pass a NAT Traversal port (Source or Dest port) */ +-struct sadb_x_nat_t_port { +- __u16 sadb_x_nat_t_port_len; +- __u16 sadb_x_nat_t_port_exttype; +- __be16 sadb_x_nat_t_port_port; +- __u16 sadb_x_nat_t_port_reserved; +-} __attribute__((packed)); +-/* sizeof(struct sadb_x_nat_t_port) == 8 */ +- +-/* Generic LSM security context */ +-struct sadb_x_sec_ctx { +- __u16 sadb_x_sec_len; +- __u16 sadb_x_sec_exttype; +- __u8 sadb_x_ctx_alg; /* LSMs: e.g., selinux == 1 */ +- __u8 sadb_x_ctx_doi; +- __u16 sadb_x_ctx_len; +-} __attribute__((packed)); +-/* sizeof(struct sadb_sec_ctx) = 8 */ +- +-/* Used by MIGRATE to pass addresses IKE will use to perform +- * negotiation with the peer */ +-struct sadb_x_kmaddress { +- __u16 sadb_x_kmaddress_len; +- __u16 sadb_x_kmaddress_exttype; +- __u32 sadb_x_kmaddress_reserved; +-} __attribute__((packed)); +-/* sizeof(struct sadb_x_kmaddress) == 8 */ +- +-/* To specify the SA dump filter */ +-struct sadb_x_filter { +- __u16 sadb_x_filter_len; +- __u16 sadb_x_filter_exttype; +- __u32 sadb_x_filter_saddr[4]; +- __u32 sadb_x_filter_daddr[4]; +- __u16 sadb_x_filter_family; +- __u8 sadb_x_filter_splen; +- __u8 sadb_x_filter_dplen; +-} __attribute__((packed)); +-/* sizeof(struct sadb_x_filter) == 40 */ +- +-/* Message types */ +-#define SADB_RESERVED 0 +-#define SADB_GETSPI 1 +-#define SADB_UPDATE 2 +-#define SADB_ADD 3 +-#define SADB_DELETE 4 +-#define SADB_GET 5 +-#define SADB_ACQUIRE 6 +-#define SADB_REGISTER 7 +-#define SADB_EXPIRE 8 +-#define SADB_FLUSH 9 +-#define SADB_DUMP 10 +-#define SADB_X_PROMISC 11 +-#define SADB_X_PCHANGE 12 +-#define SADB_X_SPDUPDATE 13 +-#define SADB_X_SPDADD 14 +-#define SADB_X_SPDDELETE 15 +-#define SADB_X_SPDGET 16 +-#define SADB_X_SPDACQUIRE 17 +-#define SADB_X_SPDDUMP 18 +-#define SADB_X_SPDFLUSH 19 +-#define SADB_X_SPDSETIDX 20 +-#define SADB_X_SPDEXPIRE 21 +-#define SADB_X_SPDDELETE2 22 +-#define SADB_X_NAT_T_NEW_MAPPING 23 +-#define SADB_X_MIGRATE 24 +-#define SADB_MAX 24 +- +-/* Security Association flags */ +-#define SADB_SAFLAGS_PFS 1 +-#define SADB_SAFLAGS_NOPMTUDISC 0x20000000 +-#define SADB_SAFLAGS_DECAP_DSCP 0x40000000 +-#define SADB_SAFLAGS_NOECN 0x80000000 +- +-/* Security Association states */ +-#define SADB_SASTATE_LARVAL 0 +-#define SADB_SASTATE_MATURE 1 +-#define SADB_SASTATE_DYING 2 +-#define SADB_SASTATE_DEAD 3 +-#define SADB_SASTATE_MAX 3 +- +-/* Security Association types */ +-#define SADB_SATYPE_UNSPEC 0 +-#define SADB_SATYPE_AH 2 +-#define SADB_SATYPE_ESP 3 +-#define SADB_SATYPE_RSVP 5 +-#define SADB_SATYPE_OSPFV2 6 +-#define SADB_SATYPE_RIPV2 7 +-#define SADB_SATYPE_MIP 8 +-#define SADB_X_SATYPE_IPCOMP 9 +-#define SADB_SATYPE_MAX 9 +- +-/* Authentication algorithms */ +-#define SADB_AALG_NONE 0 +-#define SADB_AALG_MD5HMAC 2 +-#define SADB_AALG_SHA1HMAC 3 +-#define SADB_X_AALG_SHA2_256HMAC 5 +-#define SADB_X_AALG_SHA2_384HMAC 6 +-#define SADB_X_AALG_SHA2_512HMAC 7 +-#define SADB_X_AALG_RIPEMD160HMAC 8 +-#define SADB_X_AALG_AES_XCBC_MAC 9 +-#define SADB_X_AALG_NULL 251 /* kame */ +-#define SADB_AALG_MAX 251 +- +-/* Encryption algorithms */ +-#define SADB_EALG_NONE 0 +-#define SADB_EALG_DESCBC 2 +-#define SADB_EALG_3DESCBC 3 +-#define SADB_X_EALG_CASTCBC 6 +-#define SADB_X_EALG_BLOWFISHCBC 7 +-#define SADB_EALG_NULL 11 +-#define SADB_X_EALG_AESCBC 12 +-#define SADB_X_EALG_AESCTR 13 +-#define SADB_X_EALG_AES_CCM_ICV8 14 +-#define SADB_X_EALG_AES_CCM_ICV12 15 +-#define SADB_X_EALG_AES_CCM_ICV16 16 +-#define SADB_X_EALG_AES_GCM_ICV8 18 +-#define SADB_X_EALG_AES_GCM_ICV12 19 +-#define SADB_X_EALG_AES_GCM_ICV16 20 +-#define SADB_X_EALG_CAMELLIACBC 22 +-#define SADB_X_EALG_NULL_AES_GMAC 23 +-#define SADB_EALG_MAX 253 /* last EALG */ +-/* private allocations should use 249-255 (RFC2407) */ +-#define SADB_X_EALG_SERPENTCBC 252 /* draft-ietf-ipsec-ciph-aes-cbc-00 */ +-#define SADB_X_EALG_TWOFISHCBC 253 /* draft-ietf-ipsec-ciph-aes-cbc-00 */ +- +-/* Compression algorithms */ +-#define SADB_X_CALG_NONE 0 +-#define SADB_X_CALG_OUI 1 +-#define SADB_X_CALG_DEFLATE 2 +-#define SADB_X_CALG_LZS 3 +-#define SADB_X_CALG_LZJH 4 +-#define SADB_X_CALG_MAX 4 +- +-/* Extension Header values */ +-#define SADB_EXT_RESERVED 0 +-#define SADB_EXT_SA 1 +-#define SADB_EXT_LIFETIME_CURRENT 2 +-#define SADB_EXT_LIFETIME_HARD 3 +-#define SADB_EXT_LIFETIME_SOFT 4 +-#define SADB_EXT_ADDRESS_SRC 5 +-#define SADB_EXT_ADDRESS_DST 6 +-#define SADB_EXT_ADDRESS_PROXY 7 +-#define SADB_EXT_KEY_AUTH 8 +-#define SADB_EXT_KEY_ENCRYPT 9 +-#define SADB_EXT_IDENTITY_SRC 10 +-#define SADB_EXT_IDENTITY_DST 11 +-#define SADB_EXT_SENSITIVITY 12 +-#define SADB_EXT_PROPOSAL 13 +-#define SADB_EXT_SUPPORTED_AUTH 14 +-#define SADB_EXT_SUPPORTED_ENCRYPT 15 +-#define SADB_EXT_SPIRANGE 16 +-#define SADB_X_EXT_KMPRIVATE 17 +-#define SADB_X_EXT_POLICY 18 +-#define SADB_X_EXT_SA2 19 +-/* The next four entries are for setting up NAT Traversal */ +-#define SADB_X_EXT_NAT_T_TYPE 20 +-#define SADB_X_EXT_NAT_T_SPORT 21 +-#define SADB_X_EXT_NAT_T_DPORT 22 +-#define SADB_X_EXT_NAT_T_OA 23 +-#define SADB_X_EXT_SEC_CTX 24 +-/* Used with MIGRATE to pass @ to IKE for negotiation */ +-#define SADB_X_EXT_KMADDRESS 25 +-#define SADB_X_EXT_FILTER 26 +-#define SADB_EXT_MAX 26 +- +-/* Identity Extension values */ +-#define SADB_IDENTTYPE_RESERVED 0 +-#define SADB_IDENTTYPE_PREFIX 1 +-#define SADB_IDENTTYPE_FQDN 2 +-#define SADB_IDENTTYPE_USERFQDN 3 +-#define SADB_IDENTTYPE_MAX 3 +- +-#endif /* !(_LINUX_PFKEY2_H) */ +diff --git a/include/linux/pkt_cls.h b/include/linux/pkt_cls.h +deleted file mode 100644 +index d5e2bf6..0000000 +--- a/include/linux/pkt_cls.h ++++ /dev/null +@@ -1,569 +0,0 @@ +-#ifndef __LINUX_PKT_CLS_H +-#define __LINUX_PKT_CLS_H +- +-#include +-#include +- +-#define TC_COOKIE_MAX_SIZE 16 +- +-/* Action attributes */ +-enum { +- TCA_ACT_UNSPEC, +- TCA_ACT_KIND, +- TCA_ACT_OPTIONS, +- TCA_ACT_INDEX, +- TCA_ACT_STATS, +- TCA_ACT_PAD, +- TCA_ACT_COOKIE, +- __TCA_ACT_MAX +-}; +- +-#define TCA_ACT_MAX __TCA_ACT_MAX +-#define TCA_OLD_COMPAT (TCA_ACT_MAX+1) +-#define TCA_ACT_MAX_PRIO 32 +-#define TCA_ACT_BIND 1 +-#define TCA_ACT_NOBIND 0 +-#define TCA_ACT_UNBIND 1 +-#define TCA_ACT_NOUNBIND 0 +-#define TCA_ACT_REPLACE 1 +-#define TCA_ACT_NOREPLACE 0 +- +-#define TC_ACT_UNSPEC (-1) +-#define TC_ACT_OK 0 +-#define TC_ACT_RECLASSIFY 1 +-#define TC_ACT_SHOT 2 +-#define TC_ACT_PIPE 3 +-#define TC_ACT_STOLEN 4 +-#define TC_ACT_QUEUED 5 +-#define TC_ACT_REPEAT 6 +-#define TC_ACT_REDIRECT 7 +-#define TC_ACT_TRAP 8 /* For hw path, this means "trap to cpu" +- * and don't further process the frame +- * in hardware. For sw path, this is +- * equivalent of TC_ACT_STOLEN - drop +- * the skb and act like everything +- * is alright. +- */ +- +-/* There is a special kind of actions called "extended actions", +- * which need a value parameter. These have a local opcode located in +- * the highest nibble, starting from 1. The rest of the bits +- * are used to carry the value. These two parts together make +- * a combined opcode. +- */ +-#define __TC_ACT_EXT_SHIFT 28 +-#define __TC_ACT_EXT(local) ((local) << __TC_ACT_EXT_SHIFT) +-#define TC_ACT_EXT_VAL_MASK ((1 << __TC_ACT_EXT_SHIFT) - 1) +-#define TC_ACT_EXT_CMP(combined, opcode) \ +- (((combined) & (~TC_ACT_EXT_VAL_MASK)) == opcode) +- +-#define TC_ACT_JUMP __TC_ACT_EXT(1) +-#define TC_ACT_GOTO_CHAIN __TC_ACT_EXT(2) +- +-/* Action type identifiers*/ +-enum { +- TCA_ID_UNSPEC=0, +- TCA_ID_POLICE=1, +- /* other actions go here */ +- __TCA_ID_MAX=255 +-}; +- +-#define TCA_ID_MAX __TCA_ID_MAX +- +-struct tc_police { +- __u32 index; +- int action; +-#define TC_POLICE_UNSPEC TC_ACT_UNSPEC +-#define TC_POLICE_OK TC_ACT_OK +-#define TC_POLICE_RECLASSIFY TC_ACT_RECLASSIFY +-#define TC_POLICE_SHOT TC_ACT_SHOT +-#define TC_POLICE_PIPE TC_ACT_PIPE +- +- __u32 limit; +- __u32 burst; +- __u32 mtu; +- struct tc_ratespec rate; +- struct tc_ratespec peakrate; +- int refcnt; +- int bindcnt; +- __u32 capab; +-}; +- +-struct tcf_t { +- __u64 install; +- __u64 lastuse; +- __u64 expires; +- __u64 firstuse; +-}; +- +-struct tc_cnt { +- int refcnt; +- int bindcnt; +-}; +- +-#define tc_gen \ +- __u32 index; \ +- __u32 capab; \ +- int action; \ +- int refcnt; \ +- int bindcnt +- +-enum { +- TCA_POLICE_UNSPEC, +- TCA_POLICE_TBF, +- TCA_POLICE_RATE, +- TCA_POLICE_PEAKRATE, +- TCA_POLICE_AVRATE, +- TCA_POLICE_RESULT, +- TCA_POLICE_TM, +- TCA_POLICE_PAD, +- __TCA_POLICE_MAX +-#define TCA_POLICE_RESULT TCA_POLICE_RESULT +-}; +- +-#define TCA_POLICE_MAX (__TCA_POLICE_MAX - 1) +- +-/* tca flags definitions */ +-#define TCA_CLS_FLAGS_SKIP_HW (1 << 0) /* don't offload filter to HW */ +-#define TCA_CLS_FLAGS_SKIP_SW (1 << 1) /* don't use filter in SW */ +-#define TCA_CLS_FLAGS_IN_HW (1 << 2) /* filter is offloaded to HW */ +-#define TCA_CLS_FLAGS_NOT_IN_HW (1 << 3) /* filter isn't offloaded to HW */ +- +-/* U32 filters */ +- +-#define TC_U32_HTID(h) ((h)&0xFFF00000) +-#define TC_U32_USERHTID(h) (TC_U32_HTID(h)>>20) +-#define TC_U32_HASH(h) (((h)>>12)&0xFF) +-#define TC_U32_NODE(h) ((h)&0xFFF) +-#define TC_U32_KEY(h) ((h)&0xFFFFF) +-#define TC_U32_UNSPEC 0 +-#define TC_U32_ROOT (0xFFF00000) +- +-enum { +- TCA_U32_UNSPEC, +- TCA_U32_CLASSID, +- TCA_U32_HASH, +- TCA_U32_LINK, +- TCA_U32_DIVISOR, +- TCA_U32_SEL, +- TCA_U32_POLICE, +- TCA_U32_ACT, +- TCA_U32_INDEV, +- TCA_U32_PCNT, +- TCA_U32_MARK, +- TCA_U32_FLAGS, +- TCA_U32_PAD, +- __TCA_U32_MAX +-}; +- +-#define TCA_U32_MAX (__TCA_U32_MAX - 1) +- +-struct tc_u32_key { +- __be32 mask; +- __be32 val; +- int off; +- int offmask; +-}; +- +-struct tc_u32_sel { +- unsigned char flags; +- unsigned char offshift; +- unsigned char nkeys; +- +- __be16 offmask; +- __u16 off; +- short offoff; +- +- short hoff; +- __be32 hmask; +- struct tc_u32_key keys[0]; +-}; +- +-struct tc_u32_mark { +- __u32 val; +- __u32 mask; +- __u32 success; +-}; +- +-struct tc_u32_pcnt { +- __u64 rcnt; +- __u64 rhit; +- __u64 kcnts[0]; +-}; +- +-/* Flags */ +- +-#define TC_U32_TERMINAL 1 +-#define TC_U32_OFFSET 2 +-#define TC_U32_VAROFFSET 4 +-#define TC_U32_EAT 8 +- +-#define TC_U32_MAXDEPTH 8 +- +- +-/* RSVP filter */ +- +-enum { +- TCA_RSVP_UNSPEC, +- TCA_RSVP_CLASSID, +- TCA_RSVP_DST, +- TCA_RSVP_SRC, +- TCA_RSVP_PINFO, +- TCA_RSVP_POLICE, +- TCA_RSVP_ACT, +- __TCA_RSVP_MAX +-}; +- +-#define TCA_RSVP_MAX (__TCA_RSVP_MAX - 1 ) +- +-struct tc_rsvp_gpi { +- __u32 key; +- __u32 mask; +- int offset; +-}; +- +-struct tc_rsvp_pinfo { +- struct tc_rsvp_gpi dpi; +- struct tc_rsvp_gpi spi; +- __u8 protocol; +- __u8 tunnelid; +- __u8 tunnelhdr; +- __u8 pad; +-}; +- +-/* ROUTE filter */ +- +-enum { +- TCA_ROUTE4_UNSPEC, +- TCA_ROUTE4_CLASSID, +- TCA_ROUTE4_TO, +- TCA_ROUTE4_FROM, +- TCA_ROUTE4_IIF, +- TCA_ROUTE4_POLICE, +- TCA_ROUTE4_ACT, +- __TCA_ROUTE4_MAX +-}; +- +-#define TCA_ROUTE4_MAX (__TCA_ROUTE4_MAX - 1) +- +- +-/* FW filter */ +- +-enum { +- TCA_FW_UNSPEC, +- TCA_FW_CLASSID, +- TCA_FW_POLICE, +- TCA_FW_INDEV, /* used by CONFIG_NET_CLS_IND */ +- TCA_FW_ACT, /* used by CONFIG_NET_CLS_ACT */ +- TCA_FW_MASK, +- __TCA_FW_MAX +-}; +- +-#define TCA_FW_MAX (__TCA_FW_MAX - 1) +- +-/* TC index filter */ +- +-enum { +- TCA_TCINDEX_UNSPEC, +- TCA_TCINDEX_HASH, +- TCA_TCINDEX_MASK, +- TCA_TCINDEX_SHIFT, +- TCA_TCINDEX_FALL_THROUGH, +- TCA_TCINDEX_CLASSID, +- TCA_TCINDEX_POLICE, +- TCA_TCINDEX_ACT, +- __TCA_TCINDEX_MAX +-}; +- +-#define TCA_TCINDEX_MAX (__TCA_TCINDEX_MAX - 1) +- +-/* Flow filter */ +- +-enum { +- FLOW_KEY_SRC, +- FLOW_KEY_DST, +- FLOW_KEY_PROTO, +- FLOW_KEY_PROTO_SRC, +- FLOW_KEY_PROTO_DST, +- FLOW_KEY_IIF, +- FLOW_KEY_PRIORITY, +- FLOW_KEY_MARK, +- FLOW_KEY_NFCT, +- FLOW_KEY_NFCT_SRC, +- FLOW_KEY_NFCT_DST, +- FLOW_KEY_NFCT_PROTO_SRC, +- FLOW_KEY_NFCT_PROTO_DST, +- FLOW_KEY_RTCLASSID, +- FLOW_KEY_SKUID, +- FLOW_KEY_SKGID, +- FLOW_KEY_VLAN_TAG, +- FLOW_KEY_RXHASH, +- __FLOW_KEY_MAX, +-}; +- +-#define FLOW_KEY_MAX (__FLOW_KEY_MAX - 1) +- +-enum { +- FLOW_MODE_MAP, +- FLOW_MODE_HASH, +-}; +- +-enum { +- TCA_FLOW_UNSPEC, +- TCA_FLOW_KEYS, +- TCA_FLOW_MODE, +- TCA_FLOW_BASECLASS, +- TCA_FLOW_RSHIFT, +- TCA_FLOW_ADDEND, +- TCA_FLOW_MASK, +- TCA_FLOW_XOR, +- TCA_FLOW_DIVISOR, +- TCA_FLOW_ACT, +- TCA_FLOW_POLICE, +- TCA_FLOW_EMATCHES, +- TCA_FLOW_PERTURB, +- __TCA_FLOW_MAX +-}; +- +-#define TCA_FLOW_MAX (__TCA_FLOW_MAX - 1) +- +-/* Basic filter */ +- +-enum { +- TCA_BASIC_UNSPEC, +- TCA_BASIC_CLASSID, +- TCA_BASIC_EMATCHES, +- TCA_BASIC_ACT, +- TCA_BASIC_POLICE, +- __TCA_BASIC_MAX +-}; +- +-#define TCA_BASIC_MAX (__TCA_BASIC_MAX - 1) +- +- +-/* Cgroup classifier */ +- +-enum { +- TCA_CGROUP_UNSPEC, +- TCA_CGROUP_ACT, +- TCA_CGROUP_POLICE, +- TCA_CGROUP_EMATCHES, +- __TCA_CGROUP_MAX, +-}; +- +-#define TCA_CGROUP_MAX (__TCA_CGROUP_MAX - 1) +- +-/* BPF classifier */ +- +-#define TCA_BPF_FLAG_ACT_DIRECT (1 << 0) +- +-enum { +- TCA_BPF_UNSPEC, +- TCA_BPF_ACT, +- TCA_BPF_POLICE, +- TCA_BPF_CLASSID, +- TCA_BPF_OPS_LEN, +- TCA_BPF_OPS, +- TCA_BPF_FD, +- TCA_BPF_NAME, +- TCA_BPF_FLAGS, +- TCA_BPF_FLAGS_GEN, +- TCA_BPF_TAG, +- TCA_BPF_ID, +- __TCA_BPF_MAX, +-}; +- +-#define TCA_BPF_MAX (__TCA_BPF_MAX - 1) +- +-/* Flower classifier */ +- +-enum { +- TCA_FLOWER_UNSPEC, +- TCA_FLOWER_CLASSID, +- TCA_FLOWER_INDEV, +- TCA_FLOWER_ACT, +- TCA_FLOWER_KEY_ETH_DST, /* ETH_ALEN */ +- TCA_FLOWER_KEY_ETH_DST_MASK, /* ETH_ALEN */ +- TCA_FLOWER_KEY_ETH_SRC, /* ETH_ALEN */ +- TCA_FLOWER_KEY_ETH_SRC_MASK, /* ETH_ALEN */ +- TCA_FLOWER_KEY_ETH_TYPE, /* be16 */ +- TCA_FLOWER_KEY_IP_PROTO, /* u8 */ +- TCA_FLOWER_KEY_IPV4_SRC, /* be32 */ +- TCA_FLOWER_KEY_IPV4_SRC_MASK, /* be32 */ +- TCA_FLOWER_KEY_IPV4_DST, /* be32 */ +- TCA_FLOWER_KEY_IPV4_DST_MASK, /* be32 */ +- TCA_FLOWER_KEY_IPV6_SRC, /* struct in6_addr */ +- TCA_FLOWER_KEY_IPV6_SRC_MASK, /* struct in6_addr */ +- TCA_FLOWER_KEY_IPV6_DST, /* struct in6_addr */ +- TCA_FLOWER_KEY_IPV6_DST_MASK, /* struct in6_addr */ +- TCA_FLOWER_KEY_TCP_SRC, /* be16 */ +- TCA_FLOWER_KEY_TCP_DST, /* be16 */ +- TCA_FLOWER_KEY_UDP_SRC, /* be16 */ +- TCA_FLOWER_KEY_UDP_DST, /* be16 */ +- +- TCA_FLOWER_FLAGS, +- TCA_FLOWER_KEY_VLAN_ID, /* be16 */ +- TCA_FLOWER_KEY_VLAN_PRIO, /* u8 */ +- TCA_FLOWER_KEY_VLAN_ETH_TYPE, /* be16 */ +- +- TCA_FLOWER_KEY_ENC_KEY_ID, /* be32 */ +- TCA_FLOWER_KEY_ENC_IPV4_SRC, /* be32 */ +- TCA_FLOWER_KEY_ENC_IPV4_SRC_MASK,/* be32 */ +- TCA_FLOWER_KEY_ENC_IPV4_DST, /* be32 */ +- TCA_FLOWER_KEY_ENC_IPV4_DST_MASK,/* be32 */ +- TCA_FLOWER_KEY_ENC_IPV6_SRC, /* struct in6_addr */ +- TCA_FLOWER_KEY_ENC_IPV6_SRC_MASK,/* struct in6_addr */ +- TCA_FLOWER_KEY_ENC_IPV6_DST, /* struct in6_addr */ +- TCA_FLOWER_KEY_ENC_IPV6_DST_MASK,/* struct in6_addr */ +- +- TCA_FLOWER_KEY_TCP_SRC_MASK, /* be16 */ +- TCA_FLOWER_KEY_TCP_DST_MASK, /* be16 */ +- TCA_FLOWER_KEY_UDP_SRC_MASK, /* be16 */ +- TCA_FLOWER_KEY_UDP_DST_MASK, /* be16 */ +- TCA_FLOWER_KEY_SCTP_SRC_MASK, /* be16 */ +- TCA_FLOWER_KEY_SCTP_DST_MASK, /* be16 */ +- +- TCA_FLOWER_KEY_SCTP_SRC, /* be16 */ +- TCA_FLOWER_KEY_SCTP_DST, /* be16 */ +- +- TCA_FLOWER_KEY_ENC_UDP_SRC_PORT, /* be16 */ +- TCA_FLOWER_KEY_ENC_UDP_SRC_PORT_MASK, /* be16 */ +- TCA_FLOWER_KEY_ENC_UDP_DST_PORT, /* be16 */ +- TCA_FLOWER_KEY_ENC_UDP_DST_PORT_MASK, /* be16 */ +- +- TCA_FLOWER_KEY_FLAGS, /* be32 */ +- TCA_FLOWER_KEY_FLAGS_MASK, /* be32 */ +- +- TCA_FLOWER_KEY_ICMPV4_CODE, /* u8 */ +- TCA_FLOWER_KEY_ICMPV4_CODE_MASK,/* u8 */ +- TCA_FLOWER_KEY_ICMPV4_TYPE, /* u8 */ +- TCA_FLOWER_KEY_ICMPV4_TYPE_MASK,/* u8 */ +- TCA_FLOWER_KEY_ICMPV6_CODE, /* u8 */ +- TCA_FLOWER_KEY_ICMPV6_CODE_MASK,/* u8 */ +- TCA_FLOWER_KEY_ICMPV6_TYPE, /* u8 */ +- TCA_FLOWER_KEY_ICMPV6_TYPE_MASK,/* u8 */ +- +- TCA_FLOWER_KEY_ARP_SIP, /* be32 */ +- TCA_FLOWER_KEY_ARP_SIP_MASK, /* be32 */ +- TCA_FLOWER_KEY_ARP_TIP, /* be32 */ +- TCA_FLOWER_KEY_ARP_TIP_MASK, /* be32 */ +- TCA_FLOWER_KEY_ARP_OP, /* u8 */ +- TCA_FLOWER_KEY_ARP_OP_MASK, /* u8 */ +- TCA_FLOWER_KEY_ARP_SHA, /* ETH_ALEN */ +- TCA_FLOWER_KEY_ARP_SHA_MASK, /* ETH_ALEN */ +- TCA_FLOWER_KEY_ARP_THA, /* ETH_ALEN */ +- TCA_FLOWER_KEY_ARP_THA_MASK, /* ETH_ALEN */ +- +- TCA_FLOWER_KEY_MPLS_TTL, /* u8 - 8 bits */ +- TCA_FLOWER_KEY_MPLS_BOS, /* u8 - 1 bit */ +- TCA_FLOWER_KEY_MPLS_TC, /* u8 - 3 bits */ +- TCA_FLOWER_KEY_MPLS_LABEL, /* be32 - 20 bits */ +- +- TCA_FLOWER_KEY_TCP_FLAGS, /* be16 */ +- TCA_FLOWER_KEY_TCP_FLAGS_MASK, /* be16 */ +- +- TCA_FLOWER_KEY_IP_TOS, /* u8 */ +- TCA_FLOWER_KEY_IP_TOS_MASK, /* u8 */ +- TCA_FLOWER_KEY_IP_TTL, /* u8 */ +- TCA_FLOWER_KEY_IP_TTL_MASK, /* u8 */ +- +- __TCA_FLOWER_MAX, +-}; +- +-#define TCA_FLOWER_MAX (__TCA_FLOWER_MAX - 1) +- +-enum { +- TCA_FLOWER_KEY_FLAGS_IS_FRAGMENT = (1 << 0), +-}; +- +-/* Match-all classifier */ +- +-enum { +- TCA_MATCHALL_UNSPEC, +- TCA_MATCHALL_CLASSID, +- TCA_MATCHALL_ACT, +- TCA_MATCHALL_FLAGS, +- __TCA_MATCHALL_MAX, +-}; +- +-#define TCA_MATCHALL_MAX (__TCA_MATCHALL_MAX - 1) +- +-/* Extended Matches */ +- +-struct tcf_ematch_tree_hdr { +- __u16 nmatches; +- __u16 progid; +-}; +- +-enum { +- TCA_EMATCH_TREE_UNSPEC, +- TCA_EMATCH_TREE_HDR, +- TCA_EMATCH_TREE_LIST, +- __TCA_EMATCH_TREE_MAX +-}; +-#define TCA_EMATCH_TREE_MAX (__TCA_EMATCH_TREE_MAX - 1) +- +-struct tcf_ematch_hdr { +- __u16 matchid; +- __u16 kind; +- __u16 flags; +- __u16 pad; /* currently unused */ +-}; +- +-/* 0 1 +- * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 +- * +-----------------------+-+-+---+ +- * | Unused |S|I| R | +- * +-----------------------+-+-+---+ +- * +- * R(2) ::= relation to next ematch +- * where: 0 0 END (last ematch) +- * 0 1 AND +- * 1 0 OR +- * 1 1 Unused (invalid) +- * I(1) ::= invert result +- * S(1) ::= simple payload +- */ +-#define TCF_EM_REL_END 0 +-#define TCF_EM_REL_AND (1<<0) +-#define TCF_EM_REL_OR (1<<1) +-#define TCF_EM_INVERT (1<<2) +-#define TCF_EM_SIMPLE (1<<3) +- +-#define TCF_EM_REL_MASK 3 +-#define TCF_EM_REL_VALID(v) (((v) & TCF_EM_REL_MASK) != TCF_EM_REL_MASK) +- +-enum { +- TCF_LAYER_LINK, +- TCF_LAYER_NETWORK, +- TCF_LAYER_TRANSPORT, +- __TCF_LAYER_MAX +-}; +-#define TCF_LAYER_MAX (__TCF_LAYER_MAX - 1) +- +-/* Ematch type assignments +- * 1..32767 Reserved for ematches inside kernel tree +- * 32768..65535 Free to use, not reliable +- */ +-#define TCF_EM_CONTAINER 0 +-#define TCF_EM_CMP 1 +-#define TCF_EM_NBYTE 2 +-#define TCF_EM_U32 3 +-#define TCF_EM_META 4 +-#define TCF_EM_TEXT 5 +-#define TCF_EM_VLAN 6 +-#define TCF_EM_CANID 7 +-#define TCF_EM_IPSET 8 +-#define TCF_EM_MAX 8 +- +-enum { +- TCF_EM_PROG_TC +-}; +- +-enum { +- TCF_EM_OPND_EQ, +- TCF_EM_OPND_GT, +- TCF_EM_OPND_LT +-}; +- +-#endif +diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h +deleted file mode 100644 +index 099bf55..0000000 +--- a/include/linux/pkt_sched.h ++++ /dev/null +@@ -1,874 +0,0 @@ +-#ifndef __LINUX_PKT_SCHED_H +-#define __LINUX_PKT_SCHED_H +- +-#include +- +-/* Logical priority bands not depending on specific packet scheduler. +- Every scheduler will map them to real traffic classes, if it has +- no more precise mechanism to classify packets. +- +- These numbers have no special meaning, though their coincidence +- with obsolete IPv6 values is not occasional :-). New IPv6 drafts +- preferred full anarchy inspired by diffserv group. +- +- Note: TC_PRIO_BESTEFFORT does not mean that it is the most unhappy +- class, actually, as rule it will be handled with more care than +- filler or even bulk. +- */ +- +-#define TC_PRIO_BESTEFFORT 0 +-#define TC_PRIO_FILLER 1 +-#define TC_PRIO_BULK 2 +-#define TC_PRIO_INTERACTIVE_BULK 4 +-#define TC_PRIO_INTERACTIVE 6 +-#define TC_PRIO_CONTROL 7 +- +-#define TC_PRIO_MAX 15 +- +-/* Generic queue statistics, available for all the elements. +- Particular schedulers may have also their private records. +- */ +- +-struct tc_stats { +- __u64 bytes; /* Number of enqueued bytes */ +- __u32 packets; /* Number of enqueued packets */ +- __u32 drops; /* Packets dropped because of lack of resources */ +- __u32 overlimits; /* Number of throttle events when this +- * flow goes out of allocated bandwidth */ +- __u32 bps; /* Current flow byte rate */ +- __u32 pps; /* Current flow packet rate */ +- __u32 qlen; +- __u32 backlog; +-}; +- +-struct tc_estimator { +- signed char interval; +- unsigned char ewma_log; +-}; +- +-/* "Handles" +- --------- +- +- All the traffic control objects have 32bit identifiers, or "handles". +- +- They can be considered as opaque numbers from user API viewpoint, +- but actually they always consist of two fields: major and +- minor numbers, which are interpreted by kernel specially, +- that may be used by applications, though not recommended. +- +- F.e. qdisc handles always have minor number equal to zero, +- classes (or flows) have major equal to parent qdisc major, and +- minor uniquely identifying class inside qdisc. +- +- Macros to manipulate handles: +- */ +- +-#define TC_H_MAJ_MASK (0xFFFF0000U) +-#define TC_H_MIN_MASK (0x0000FFFFU) +-#define TC_H_MAJ(h) ((h)&TC_H_MAJ_MASK) +-#define TC_H_MIN(h) ((h)&TC_H_MIN_MASK) +-#define TC_H_MAKE(maj,min) (((maj)&TC_H_MAJ_MASK)|((min)&TC_H_MIN_MASK)) +- +-#define TC_H_UNSPEC (0U) +-#define TC_H_ROOT (0xFFFFFFFFU) +-#define TC_H_INGRESS (0xFFFFFFF1U) +-#define TC_H_CLSACT TC_H_INGRESS +- +-#define TC_H_MIN_INGRESS 0xFFF2U +-#define TC_H_MIN_EGRESS 0xFFF3U +- +-/* Need to corrospond to iproute2 tc/tc_core.h "enum link_layer" */ +-enum tc_link_layer { +- TC_LINKLAYER_UNAWARE, /* Indicate unaware old iproute2 util */ +- TC_LINKLAYER_ETHERNET, +- TC_LINKLAYER_ATM, +-}; +-#define TC_LINKLAYER_MASK 0x0F /* limit use to lower 4 bits */ +- +-struct tc_ratespec { +- unsigned char cell_log; +- __u8 linklayer; /* lower 4 bits */ +- unsigned short overhead; +- short cell_align; +- unsigned short mpu; +- __u32 rate; +-}; +- +-#define TC_RTAB_SIZE 1024 +- +-struct tc_sizespec { +- unsigned char cell_log; +- unsigned char size_log; +- short cell_align; +- int overhead; +- unsigned int linklayer; +- unsigned int mpu; +- unsigned int mtu; +- unsigned int tsize; +-}; +- +-enum { +- TCA_STAB_UNSPEC, +- TCA_STAB_BASE, +- TCA_STAB_DATA, +- __TCA_STAB_MAX +-}; +- +-#define TCA_STAB_MAX (__TCA_STAB_MAX - 1) +- +-/* FIFO section */ +- +-struct tc_fifo_qopt { +- __u32 limit; /* Queue length: bytes for bfifo, packets for pfifo */ +-}; +- +-/* PRIO section */ +- +-#define TCQ_PRIO_BANDS 16 +-#define TCQ_MIN_PRIO_BANDS 2 +- +-struct tc_prio_qopt { +- int bands; /* Number of bands */ +- __u8 priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> PRIO band */ +-}; +- +-/* MULTIQ section */ +- +-struct tc_multiq_qopt { +- __u16 bands; /* Number of bands */ +- __u16 max_bands; /* Maximum number of queues */ +-}; +- +-/* PLUG section */ +- +-#define TCQ_PLUG_BUFFER 0 +-#define TCQ_PLUG_RELEASE_ONE 1 +-#define TCQ_PLUG_RELEASE_INDEFINITE 2 +-#define TCQ_PLUG_LIMIT 3 +- +-struct tc_plug_qopt { +- /* TCQ_PLUG_BUFFER: Inset a plug into the queue and +- * buffer any incoming packets +- * TCQ_PLUG_RELEASE_ONE: Dequeue packets from queue head +- * to beginning of the next plug. +- * TCQ_PLUG_RELEASE_INDEFINITE: Dequeue all packets from queue. +- * Stop buffering packets until the next TCQ_PLUG_BUFFER +- * command is received (just act as a pass-thru queue). +- * TCQ_PLUG_LIMIT: Increase/decrease queue size +- */ +- int action; +- __u32 limit; +-}; +- +-/* TBF section */ +- +-struct tc_tbf_qopt { +- struct tc_ratespec rate; +- struct tc_ratespec peakrate; +- __u32 limit; +- __u32 buffer; +- __u32 mtu; +-}; +- +-enum { +- TCA_TBF_UNSPEC, +- TCA_TBF_PARMS, +- TCA_TBF_RTAB, +- TCA_TBF_PTAB, +- TCA_TBF_RATE64, +- TCA_TBF_PRATE64, +- TCA_TBF_BURST, +- TCA_TBF_PBURST, +- TCA_TBF_PAD, +- __TCA_TBF_MAX, +-}; +- +-#define TCA_TBF_MAX (__TCA_TBF_MAX - 1) +- +- +-/* TEQL section */ +- +-/* TEQL does not require any parameters */ +- +-/* SFQ section */ +- +-struct tc_sfq_qopt { +- unsigned quantum; /* Bytes per round allocated to flow */ +- int perturb_period; /* Period of hash perturbation */ +- __u32 limit; /* Maximal packets in queue */ +- unsigned divisor; /* Hash divisor */ +- unsigned flows; /* Maximal number of flows */ +-}; +- +-struct tc_sfqred_stats { +- __u32 prob_drop; /* Early drops, below max threshold */ +- __u32 forced_drop; /* Early drops, after max threshold */ +- __u32 prob_mark; /* Marked packets, below max threshold */ +- __u32 forced_mark; /* Marked packets, after max threshold */ +- __u32 prob_mark_head; /* Marked packets, below max threshold */ +- __u32 forced_mark_head;/* Marked packets, after max threshold */ +-}; +- +-struct tc_sfq_qopt_v1 { +- struct tc_sfq_qopt v0; +- unsigned int depth; /* max number of packets per flow */ +- unsigned int headdrop; +-/* SFQRED parameters */ +- __u32 limit; /* HARD maximal flow queue length (bytes) */ +- __u32 qth_min; /* Min average length threshold (bytes) */ +- __u32 qth_max; /* Max average length threshold (bytes) */ +- unsigned char Wlog; /* log(W) */ +- unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */ +- unsigned char Scell_log; /* cell size for idle damping */ +- unsigned char flags; +- __u32 max_P; /* probability, high resolution */ +-/* SFQRED stats */ +- struct tc_sfqred_stats stats; +-}; +- +- +-struct tc_sfq_xstats { +- __s32 allot; +-}; +- +-/* RED section */ +- +-enum { +- TCA_RED_UNSPEC, +- TCA_RED_PARMS, +- TCA_RED_STAB, +- TCA_RED_MAX_P, +- __TCA_RED_MAX, +-}; +- +-#define TCA_RED_MAX (__TCA_RED_MAX - 1) +- +-struct tc_red_qopt { +- __u32 limit; /* HARD maximal queue length (bytes) */ +- __u32 qth_min; /* Min average length threshold (bytes) */ +- __u32 qth_max; /* Max average length threshold (bytes) */ +- unsigned char Wlog; /* log(W) */ +- unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */ +- unsigned char Scell_log; /* cell size for idle damping */ +- unsigned char flags; +-#define TC_RED_ECN 1 +-#define TC_RED_HARDDROP 2 +-#define TC_RED_ADAPTATIVE 4 +-}; +- +-struct tc_red_xstats { +- __u32 early; /* Early drops */ +- __u32 pdrop; /* Drops due to queue limits */ +- __u32 other; /* Drops due to drop() calls */ +- __u32 marked; /* Marked packets */ +-}; +- +-/* GRED section */ +- +-#define MAX_DPs 16 +- +-enum { +- TCA_GRED_UNSPEC, +- TCA_GRED_PARMS, +- TCA_GRED_STAB, +- TCA_GRED_DPS, +- TCA_GRED_MAX_P, +- TCA_GRED_LIMIT, +- __TCA_GRED_MAX, +-}; +- +-#define TCA_GRED_MAX (__TCA_GRED_MAX - 1) +- +-struct tc_gred_qopt { +- __u32 limit; /* HARD maximal queue length (bytes) */ +- __u32 qth_min; /* Min average length threshold (bytes) */ +- __u32 qth_max; /* Max average length threshold (bytes) */ +- __u32 DP; /* up to 2^32 DPs */ +- __u32 backlog; +- __u32 qave; +- __u32 forced; +- __u32 early; +- __u32 other; +- __u32 pdrop; +- __u8 Wlog; /* log(W) */ +- __u8 Plog; /* log(P_max/(qth_max-qth_min)) */ +- __u8 Scell_log; /* cell size for idle damping */ +- __u8 prio; /* prio of this VQ */ +- __u32 packets; +- __u32 bytesin; +-}; +- +-/* gred setup */ +-struct tc_gred_sopt { +- __u32 DPs; +- __u32 def_DP; +- __u8 grio; +- __u8 flags; +- __u16 pad1; +-}; +- +-/* CHOKe section */ +- +-enum { +- TCA_CHOKE_UNSPEC, +- TCA_CHOKE_PARMS, +- TCA_CHOKE_STAB, +- TCA_CHOKE_MAX_P, +- __TCA_CHOKE_MAX, +-}; +- +-#define TCA_CHOKE_MAX (__TCA_CHOKE_MAX - 1) +- +-struct tc_choke_qopt { +- __u32 limit; /* Hard queue length (packets) */ +- __u32 qth_min; /* Min average threshold (packets) */ +- __u32 qth_max; /* Max average threshold (packets) */ +- unsigned char Wlog; /* log(W) */ +- unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */ +- unsigned char Scell_log; /* cell size for idle damping */ +- unsigned char flags; /* see RED flags */ +-}; +- +-struct tc_choke_xstats { +- __u32 early; /* Early drops */ +- __u32 pdrop; /* Drops due to queue limits */ +- __u32 other; /* Drops due to drop() calls */ +- __u32 marked; /* Marked packets */ +- __u32 matched; /* Drops due to flow match */ +-}; +- +-/* HTB section */ +-#define TC_HTB_NUMPRIO 8 +-#define TC_HTB_MAXDEPTH 8 +-#define TC_HTB_PROTOVER 3 /* the same as HTB and TC's major */ +- +-struct tc_htb_opt { +- struct tc_ratespec rate; +- struct tc_ratespec ceil; +- __u32 buffer; +- __u32 cbuffer; +- __u32 quantum; +- __u32 level; /* out only */ +- __u32 prio; +-}; +-struct tc_htb_glob { +- __u32 version; /* to match HTB/TC */ +- __u32 rate2quantum; /* bps->quantum divisor */ +- __u32 defcls; /* default class number */ +- __u32 debug; /* debug flags */ +- +- /* stats */ +- __u32 direct_pkts; /* count of non shaped packets */ +-}; +-enum { +- TCA_HTB_UNSPEC, +- TCA_HTB_PARMS, +- TCA_HTB_INIT, +- TCA_HTB_CTAB, +- TCA_HTB_RTAB, +- TCA_HTB_DIRECT_QLEN, +- TCA_HTB_RATE64, +- TCA_HTB_CEIL64, +- TCA_HTB_PAD, +- __TCA_HTB_MAX, +-}; +- +-#define TCA_HTB_MAX (__TCA_HTB_MAX - 1) +- +-struct tc_htb_xstats { +- __u32 lends; +- __u32 borrows; +- __u32 giants; /* too big packets (rate will not be accurate) */ +- __u32 tokens; +- __u32 ctokens; +-}; +- +-/* HFSC section */ +- +-struct tc_hfsc_qopt { +- __u16 defcls; /* default class */ +-}; +- +-struct tc_service_curve { +- __u32 m1; /* slope of the first segment in bps */ +- __u32 d; /* x-projection of the first segment in us */ +- __u32 m2; /* slope of the second segment in bps */ +-}; +- +-struct tc_hfsc_stats { +- __u64 work; /* total work done */ +- __u64 rtwork; /* work done by real-time criteria */ +- __u32 period; /* current period */ +- __u32 level; /* class level in hierarchy */ +-}; +- +-enum { +- TCA_HFSC_UNSPEC, +- TCA_HFSC_RSC, +- TCA_HFSC_FSC, +- TCA_HFSC_USC, +- __TCA_HFSC_MAX, +-}; +- +-#define TCA_HFSC_MAX (__TCA_HFSC_MAX - 1) +- +- +-/* CBQ section */ +- +-#define TC_CBQ_MAXPRIO 8 +-#define TC_CBQ_MAXLEVEL 8 +-#define TC_CBQ_DEF_EWMA 5 +- +-struct tc_cbq_lssopt { +- unsigned char change; +- unsigned char flags; +-#define TCF_CBQ_LSS_BOUNDED 1 +-#define TCF_CBQ_LSS_ISOLATED 2 +- unsigned char ewma_log; +- unsigned char level; +-#define TCF_CBQ_LSS_FLAGS 1 +-#define TCF_CBQ_LSS_EWMA 2 +-#define TCF_CBQ_LSS_MAXIDLE 4 +-#define TCF_CBQ_LSS_MINIDLE 8 +-#define TCF_CBQ_LSS_OFFTIME 0x10 +-#define TCF_CBQ_LSS_AVPKT 0x20 +- __u32 maxidle; +- __u32 minidle; +- __u32 offtime; +- __u32 avpkt; +-}; +- +-struct tc_cbq_wrropt { +- unsigned char flags; +- unsigned char priority; +- unsigned char cpriority; +- unsigned char __reserved; +- __u32 allot; +- __u32 weight; +-}; +- +-struct tc_cbq_ovl { +- unsigned char strategy; +-#define TC_CBQ_OVL_CLASSIC 0 +-#define TC_CBQ_OVL_DELAY 1 +-#define TC_CBQ_OVL_LOWPRIO 2 +-#define TC_CBQ_OVL_DROP 3 +-#define TC_CBQ_OVL_RCLASSIC 4 +- unsigned char priority2; +- __u16 pad; +- __u32 penalty; +-}; +- +-struct tc_cbq_police { +- unsigned char police; +- unsigned char __res1; +- unsigned short __res2; +-}; +- +-struct tc_cbq_fopt { +- __u32 split; +- __u32 defmap; +- __u32 defchange; +-}; +- +-struct tc_cbq_xstats { +- __u32 borrows; +- __u32 overactions; +- __s32 avgidle; +- __s32 undertime; +-}; +- +-enum { +- TCA_CBQ_UNSPEC, +- TCA_CBQ_LSSOPT, +- TCA_CBQ_WRROPT, +- TCA_CBQ_FOPT, +- TCA_CBQ_OVL_STRATEGY, +- TCA_CBQ_RATE, +- TCA_CBQ_RTAB, +- TCA_CBQ_POLICE, +- __TCA_CBQ_MAX, +-}; +- +-#define TCA_CBQ_MAX (__TCA_CBQ_MAX - 1) +- +-/* dsmark section */ +- +-enum { +- TCA_DSMARK_UNSPEC, +- TCA_DSMARK_INDICES, +- TCA_DSMARK_DEFAULT_INDEX, +- TCA_DSMARK_SET_TC_INDEX, +- TCA_DSMARK_MASK, +- TCA_DSMARK_VALUE, +- __TCA_DSMARK_MAX, +-}; +- +-#define TCA_DSMARK_MAX (__TCA_DSMARK_MAX - 1) +- +-/* ATM section */ +- +-enum { +- TCA_ATM_UNSPEC, +- TCA_ATM_FD, /* file/socket descriptor */ +- TCA_ATM_PTR, /* pointer to descriptor - later */ +- TCA_ATM_HDR, /* LL header */ +- TCA_ATM_EXCESS, /* excess traffic class (0 for CLP) */ +- TCA_ATM_ADDR, /* PVC address (for output only) */ +- TCA_ATM_STATE, /* VC state (ATM_VS_*; for output only) */ +- __TCA_ATM_MAX, +-}; +- +-#define TCA_ATM_MAX (__TCA_ATM_MAX - 1) +- +-/* Network emulator */ +- +-enum { +- TCA_NETEM_UNSPEC, +- TCA_NETEM_CORR, +- TCA_NETEM_DELAY_DIST, +- TCA_NETEM_REORDER, +- TCA_NETEM_CORRUPT, +- TCA_NETEM_LOSS, +- TCA_NETEM_RATE, +- TCA_NETEM_ECN, +- TCA_NETEM_RATE64, +- TCA_NETEM_PAD, +- __TCA_NETEM_MAX, +-}; +- +-#define TCA_NETEM_MAX (__TCA_NETEM_MAX - 1) +- +-struct tc_netem_qopt { +- __u32 latency; /* added delay (us) */ +- __u32 limit; /* fifo limit (packets) */ +- __u32 loss; /* random packet loss (0=none ~0=100%) */ +- __u32 gap; /* re-ordering gap (0 for none) */ +- __u32 duplicate; /* random packet dup (0=none ~0=100%) */ +- __u32 jitter; /* random jitter in latency (us) */ +-}; +- +-struct tc_netem_corr { +- __u32 delay_corr; /* delay correlation */ +- __u32 loss_corr; /* packet loss correlation */ +- __u32 dup_corr; /* duplicate correlation */ +-}; +- +-struct tc_netem_reorder { +- __u32 probability; +- __u32 correlation; +-}; +- +-struct tc_netem_corrupt { +- __u32 probability; +- __u32 correlation; +-}; +- +-struct tc_netem_rate { +- __u32 rate; /* byte/s */ +- __s32 packet_overhead; +- __u32 cell_size; +- __s32 cell_overhead; +-}; +- +-enum { +- NETEM_LOSS_UNSPEC, +- NETEM_LOSS_GI, /* General Intuitive - 4 state model */ +- NETEM_LOSS_GE, /* Gilbert Elliot models */ +- __NETEM_LOSS_MAX +-}; +-#define NETEM_LOSS_MAX (__NETEM_LOSS_MAX - 1) +- +-/* State transition probabilities for 4 state model */ +-struct tc_netem_gimodel { +- __u32 p13; +- __u32 p31; +- __u32 p32; +- __u32 p14; +- __u32 p23; +-}; +- +-/* Gilbert-Elliot models */ +-struct tc_netem_gemodel { +- __u32 p; +- __u32 r; +- __u32 h; +- __u32 k1; +-}; +- +-#define NETEM_DIST_SCALE 8192 +-#define NETEM_DIST_MAX 16384 +- +-/* DRR */ +- +-enum { +- TCA_DRR_UNSPEC, +- TCA_DRR_QUANTUM, +- __TCA_DRR_MAX +-}; +- +-#define TCA_DRR_MAX (__TCA_DRR_MAX - 1) +- +-struct tc_drr_stats { +- __u32 deficit; +-}; +- +-/* MQPRIO */ +-#define TC_QOPT_BITMASK 15 +-#define TC_QOPT_MAX_QUEUE 16 +- +-enum { +- TC_MQPRIO_HW_OFFLOAD_NONE, /* no offload requested */ +- TC_MQPRIO_HW_OFFLOAD_TCS, /* offload TCs, no queue counts */ +- __TC_MQPRIO_HW_OFFLOAD_MAX +-}; +- +-#define TC_MQPRIO_HW_OFFLOAD_MAX (__TC_MQPRIO_HW_OFFLOAD_MAX - 1) +- +-struct tc_mqprio_qopt { +- __u8 num_tc; +- __u8 prio_tc_map[TC_QOPT_BITMASK + 1]; +- __u8 hw; +- __u16 count[TC_QOPT_MAX_QUEUE]; +- __u16 offset[TC_QOPT_MAX_QUEUE]; +-}; +- +-/* SFB */ +- +-enum { +- TCA_SFB_UNSPEC, +- TCA_SFB_PARMS, +- __TCA_SFB_MAX, +-}; +- +-#define TCA_SFB_MAX (__TCA_SFB_MAX - 1) +- +-/* +- * Note: increment, decrement are Q0.16 fixed-point values. +- */ +-struct tc_sfb_qopt { +- __u32 rehash_interval; /* delay between hash move, in ms */ +- __u32 warmup_time; /* double buffering warmup time in ms (warmup_time < rehash_interval) */ +- __u32 max; /* max len of qlen_min */ +- __u32 bin_size; /* maximum queue length per bin */ +- __u32 increment; /* probability increment, (d1 in Blue) */ +- __u32 decrement; /* probability decrement, (d2 in Blue) */ +- __u32 limit; /* max SFB queue length */ +- __u32 penalty_rate; /* inelastic flows are rate limited to 'rate' pps */ +- __u32 penalty_burst; +-}; +- +-struct tc_sfb_xstats { +- __u32 earlydrop; +- __u32 penaltydrop; +- __u32 bucketdrop; +- __u32 queuedrop; +- __u32 childdrop; /* drops in child qdisc */ +- __u32 marked; +- __u32 maxqlen; +- __u32 maxprob; +- __u32 avgprob; +-}; +- +-#define SFB_MAX_PROB 0xFFFF +- +-/* QFQ */ +-enum { +- TCA_QFQ_UNSPEC, +- TCA_QFQ_WEIGHT, +- TCA_QFQ_LMAX, +- __TCA_QFQ_MAX +-}; +- +-#define TCA_QFQ_MAX (__TCA_QFQ_MAX - 1) +- +-struct tc_qfq_stats { +- __u32 weight; +- __u32 lmax; +-}; +- +-/* CODEL */ +- +-enum { +- TCA_CODEL_UNSPEC, +- TCA_CODEL_TARGET, +- TCA_CODEL_LIMIT, +- TCA_CODEL_INTERVAL, +- TCA_CODEL_ECN, +- TCA_CODEL_CE_THRESHOLD, +- __TCA_CODEL_MAX +-}; +- +-#define TCA_CODEL_MAX (__TCA_CODEL_MAX - 1) +- +-struct tc_codel_xstats { +- __u32 maxpacket; /* largest packet we've seen so far */ +- __u32 count; /* how many drops we've done since the last time we +- * entered dropping state +- */ +- __u32 lastcount; /* count at entry to dropping state */ +- __u32 ldelay; /* in-queue delay seen by most recently dequeued packet */ +- __s32 drop_next; /* time to drop next packet */ +- __u32 drop_overlimit; /* number of time max qdisc packet limit was hit */ +- __u32 ecn_mark; /* number of packets we ECN marked instead of dropped */ +- __u32 dropping; /* are we in dropping state ? */ +- __u32 ce_mark; /* number of CE marked packets because of ce_threshold */ +-}; +- +-/* FQ_CODEL */ +- +-enum { +- TCA_FQ_CODEL_UNSPEC, +- TCA_FQ_CODEL_TARGET, +- TCA_FQ_CODEL_LIMIT, +- TCA_FQ_CODEL_INTERVAL, +- TCA_FQ_CODEL_ECN, +- TCA_FQ_CODEL_FLOWS, +- TCA_FQ_CODEL_QUANTUM, +- TCA_FQ_CODEL_CE_THRESHOLD, +- TCA_FQ_CODEL_DROP_BATCH_SIZE, +- TCA_FQ_CODEL_MEMORY_LIMIT, +- __TCA_FQ_CODEL_MAX +-}; +- +-#define TCA_FQ_CODEL_MAX (__TCA_FQ_CODEL_MAX - 1) +- +-enum { +- TCA_FQ_CODEL_XSTATS_QDISC, +- TCA_FQ_CODEL_XSTATS_CLASS, +-}; +- +-struct tc_fq_codel_qd_stats { +- __u32 maxpacket; /* largest packet we've seen so far */ +- __u32 drop_overlimit; /* number of time max qdisc +- * packet limit was hit +- */ +- __u32 ecn_mark; /* number of packets we ECN marked +- * instead of being dropped +- */ +- __u32 new_flow_count; /* number of time packets +- * created a 'new flow' +- */ +- __u32 new_flows_len; /* count of flows in new list */ +- __u32 old_flows_len; /* count of flows in old list */ +- __u32 ce_mark; /* packets above ce_threshold */ +- __u32 memory_usage; /* in bytes */ +- __u32 drop_overmemory; +-}; +- +-struct tc_fq_codel_cl_stats { +- __s32 deficit; +- __u32 ldelay; /* in-queue delay seen by most recently +- * dequeued packet +- */ +- __u32 count; +- __u32 lastcount; +- __u32 dropping; +- __s32 drop_next; +-}; +- +-struct tc_fq_codel_xstats { +- __u32 type; +- union { +- struct tc_fq_codel_qd_stats qdisc_stats; +- struct tc_fq_codel_cl_stats class_stats; +- }; +-}; +- +-/* FQ */ +- +-enum { +- TCA_FQ_UNSPEC, +- +- TCA_FQ_PLIMIT, /* limit of total number of packets in queue */ +- +- TCA_FQ_FLOW_PLIMIT, /* limit of packets per flow */ +- +- TCA_FQ_QUANTUM, /* RR quantum */ +- +- TCA_FQ_INITIAL_QUANTUM, /* RR quantum for new flow */ +- +- TCA_FQ_RATE_ENABLE, /* enable/disable rate limiting */ +- +- TCA_FQ_FLOW_DEFAULT_RATE,/* obsolete, do not use */ +- +- TCA_FQ_FLOW_MAX_RATE, /* per flow max rate */ +- +- TCA_FQ_BUCKETS_LOG, /* log2(number of buckets) */ +- +- TCA_FQ_FLOW_REFILL_DELAY, /* flow credit refill delay in usec */ +- +- TCA_FQ_ORPHAN_MASK, /* mask applied to orphaned skb hashes */ +- +- TCA_FQ_LOW_RATE_THRESHOLD, /* per packet delay under this rate */ +- +- __TCA_FQ_MAX +-}; +- +-#define TCA_FQ_MAX (__TCA_FQ_MAX - 1) +- +-struct tc_fq_qd_stats { +- __u64 gc_flows; +- __u64 highprio_packets; +- __u64 tcp_retrans; +- __u64 throttled; +- __u64 flows_plimit; +- __u64 pkts_too_long; +- __u64 allocation_errors; +- __s64 time_next_delayed_flow; +- __u32 flows; +- __u32 inactive_flows; +- __u32 throttled_flows; +- __u32 unthrottle_latency_ns; +-}; +- +-/* Heavy-Hitter Filter */ +- +-enum { +- TCA_HHF_UNSPEC, +- TCA_HHF_BACKLOG_LIMIT, +- TCA_HHF_QUANTUM, +- TCA_HHF_HH_FLOWS_LIMIT, +- TCA_HHF_RESET_TIMEOUT, +- TCA_HHF_ADMIT_BYTES, +- TCA_HHF_EVICT_TIMEOUT, +- TCA_HHF_NON_HH_WEIGHT, +- __TCA_HHF_MAX +-}; +- +-#define TCA_HHF_MAX (__TCA_HHF_MAX - 1) +- +-struct tc_hhf_xstats { +- __u32 drop_overlimit; /* number of times max qdisc packet limit +- * was hit +- */ +- __u32 hh_overlimit; /* number of times max heavy-hitters was hit */ +- __u32 hh_tot_count; /* number of captured heavy-hitters so far */ +- __u32 hh_cur_count; /* number of current heavy-hitters */ +-}; +- +-/* PIE */ +-enum { +- TCA_PIE_UNSPEC, +- TCA_PIE_TARGET, +- TCA_PIE_LIMIT, +- TCA_PIE_TUPDATE, +- TCA_PIE_ALPHA, +- TCA_PIE_BETA, +- TCA_PIE_ECN, +- TCA_PIE_BYTEMODE, +- __TCA_PIE_MAX +-}; +-#define TCA_PIE_MAX (__TCA_PIE_MAX - 1) +- +-struct tc_pie_xstats { +- __u32 prob; /* current probability */ +- __u32 delay; /* current delay in ms */ +- __u32 avg_dq_rate; /* current average dq_rate in bits/pie_time */ +- __u32 packets_in; /* total number of packets enqueued */ +- __u32 dropped; /* packets dropped due to pie_action */ +- __u32 overlimit; /* dropped due to lack of space in queue */ +- __u32 maxq; /* maximum queue size */ +- __u32 ecn_mark; /* packets marked with ecn*/ +-}; +-#endif +diff --git a/include/linux/posix_types.h b/include/linux/posix_types.h +deleted file mode 100644 +index 988f76e..0000000 +--- a/include/linux/posix_types.h ++++ /dev/null +@@ -1,37 +0,0 @@ +-#ifndef _LINUX_POSIX_TYPES_H +-#define _LINUX_POSIX_TYPES_H +- +-#include +- +-/* +- * This allows for 1024 file descriptors: if NR_OPEN is ever grown +- * beyond that you'll have to change this too. But 1024 fd's seem to be +- * enough even for such "real" unices like OSF/1, so hopefully this is +- * one limit that doesn't have to be changed [again]. +- * +- * Note that POSIX wants the FD_CLEAR(fd,fdsetp) defines to be in +- * (and thus ) - but this is a more logical +- * place for them. Solved by having dummy defines in . +- */ +- +-/* +- * This macro may have been defined in . But we always +- * use the one here. +- */ +-#undef __FD_SETSIZE +-#define __FD_SETSIZE 1024 +- +-typedef struct { +- unsigned long fds_bits[__FD_SETSIZE / (8 * sizeof(long))]; +-} __kernel_fd_set; +- +-/* Type of a signal handler. */ +-typedef void (*__kernel_sighandler_t)(int); +- +-/* Type of a SYSV IPC key. */ +-typedef int __kernel_key_t; +-typedef int __kernel_mqd_t; +- +-#include +- +-#endif /* _LINUX_POSIX_TYPES_H */ +diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h +deleted file mode 100644 +index 813e9e0..0000000 +--- a/include/linux/rtnetlink.h ++++ /dev/null +@@ -1,718 +0,0 @@ +-#ifndef __LINUX_RTNETLINK_H +-#define __LINUX_RTNETLINK_H +- +-#include +-#include +-#include +-#include +-#include +- +-/* rtnetlink families. Values up to 127 are reserved for real address +- * families, values above 128 may be used arbitrarily. +- */ +-#define RTNL_FAMILY_IPMR 128 +-#define RTNL_FAMILY_IP6MR 129 +-#define RTNL_FAMILY_MAX 129 +- +-/**** +- * Routing/neighbour discovery messages. +- ****/ +- +-/* Types of messages */ +- +-enum { +- RTM_BASE = 16, +-#define RTM_BASE RTM_BASE +- +- RTM_NEWLINK = 16, +-#define RTM_NEWLINK RTM_NEWLINK +- RTM_DELLINK, +-#define RTM_DELLINK RTM_DELLINK +- RTM_GETLINK, +-#define RTM_GETLINK RTM_GETLINK +- RTM_SETLINK, +-#define RTM_SETLINK RTM_SETLINK +- +- RTM_NEWADDR = 20, +-#define RTM_NEWADDR RTM_NEWADDR +- RTM_DELADDR, +-#define RTM_DELADDR RTM_DELADDR +- RTM_GETADDR, +-#define RTM_GETADDR RTM_GETADDR +- +- RTM_NEWROUTE = 24, +-#define RTM_NEWROUTE RTM_NEWROUTE +- RTM_DELROUTE, +-#define RTM_DELROUTE RTM_DELROUTE +- RTM_GETROUTE, +-#define RTM_GETROUTE RTM_GETROUTE +- +- RTM_NEWNEIGH = 28, +-#define RTM_NEWNEIGH RTM_NEWNEIGH +- RTM_DELNEIGH, +-#define RTM_DELNEIGH RTM_DELNEIGH +- RTM_GETNEIGH, +-#define RTM_GETNEIGH RTM_GETNEIGH +- +- RTM_NEWRULE = 32, +-#define RTM_NEWRULE RTM_NEWRULE +- RTM_DELRULE, +-#define RTM_DELRULE RTM_DELRULE +- RTM_GETRULE, +-#define RTM_GETRULE RTM_GETRULE +- +- RTM_NEWQDISC = 36, +-#define RTM_NEWQDISC RTM_NEWQDISC +- RTM_DELQDISC, +-#define RTM_DELQDISC RTM_DELQDISC +- RTM_GETQDISC, +-#define RTM_GETQDISC RTM_GETQDISC +- +- RTM_NEWTCLASS = 40, +-#define RTM_NEWTCLASS RTM_NEWTCLASS +- RTM_DELTCLASS, +-#define RTM_DELTCLASS RTM_DELTCLASS +- RTM_GETTCLASS, +-#define RTM_GETTCLASS RTM_GETTCLASS +- +- RTM_NEWTFILTER = 44, +-#define RTM_NEWTFILTER RTM_NEWTFILTER +- RTM_DELTFILTER, +-#define RTM_DELTFILTER RTM_DELTFILTER +- RTM_GETTFILTER, +-#define RTM_GETTFILTER RTM_GETTFILTER +- +- RTM_NEWACTION = 48, +-#define RTM_NEWACTION RTM_NEWACTION +- RTM_DELACTION, +-#define RTM_DELACTION RTM_DELACTION +- RTM_GETACTION, +-#define RTM_GETACTION RTM_GETACTION +- +- RTM_NEWPREFIX = 52, +-#define RTM_NEWPREFIX RTM_NEWPREFIX +- +- RTM_GETMULTICAST = 58, +-#define RTM_GETMULTICAST RTM_GETMULTICAST +- +- RTM_GETANYCAST = 62, +-#define RTM_GETANYCAST RTM_GETANYCAST +- +- RTM_NEWNEIGHTBL = 64, +-#define RTM_NEWNEIGHTBL RTM_NEWNEIGHTBL +- RTM_GETNEIGHTBL = 66, +-#define RTM_GETNEIGHTBL RTM_GETNEIGHTBL +- RTM_SETNEIGHTBL, +-#define RTM_SETNEIGHTBL RTM_SETNEIGHTBL +- +- RTM_NEWNDUSEROPT = 68, +-#define RTM_NEWNDUSEROPT RTM_NEWNDUSEROPT +- +- RTM_NEWADDRLABEL = 72, +-#define RTM_NEWADDRLABEL RTM_NEWADDRLABEL +- RTM_DELADDRLABEL, +-#define RTM_DELADDRLABEL RTM_DELADDRLABEL +- RTM_GETADDRLABEL, +-#define RTM_GETADDRLABEL RTM_GETADDRLABEL +- +- RTM_GETDCB = 78, +-#define RTM_GETDCB RTM_GETDCB +- RTM_SETDCB, +-#define RTM_SETDCB RTM_SETDCB +- +- RTM_NEWNETCONF = 80, +-#define RTM_NEWNETCONF RTM_NEWNETCONF +- RTM_DELNETCONF, +-#define RTM_DELNETCONF RTM_DELNETCONF +- RTM_GETNETCONF = 82, +-#define RTM_GETNETCONF RTM_GETNETCONF +- +- RTM_NEWMDB = 84, +-#define RTM_NEWMDB RTM_NEWMDB +- RTM_DELMDB = 85, +-#define RTM_DELMDB RTM_DELMDB +- RTM_GETMDB = 86, +-#define RTM_GETMDB RTM_GETMDB +- +- RTM_NEWNSID = 88, +-#define RTM_NEWNSID RTM_NEWNSID +- RTM_DELNSID = 89, +-#define RTM_DELNSID RTM_DELNSID +- RTM_GETNSID = 90, +-#define RTM_GETNSID RTM_GETNSID +- +- RTM_NEWSTATS = 92, +-#define RTM_NEWSTATS RTM_NEWSTATS +- RTM_GETSTATS = 94, +-#define RTM_GETSTATS RTM_GETSTATS +- +- RTM_NEWCACHEREPORT = 96, +-#define RTM_NEWCACHEREPORT RTM_NEWCACHEREPORT +- +- __RTM_MAX, +-#define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1) +-}; +- +-#define RTM_NR_MSGTYPES (RTM_MAX + 1 - RTM_BASE) +-#define RTM_NR_FAMILIES (RTM_NR_MSGTYPES >> 2) +-#define RTM_FAM(cmd) (((cmd) - RTM_BASE) >> 2) +- +-/* +- Generic structure for encapsulation of optional route information. +- It is reminiscent of sockaddr, but with sa_family replaced +- with attribute type. +- */ +- +-struct rtattr { +- unsigned short rta_len; +- unsigned short rta_type; +-}; +- +-/* Macros to handle rtattributes */ +- +-#define RTA_ALIGNTO 4U +-#define RTA_ALIGN(len) ( ((len)+RTA_ALIGNTO-1) & ~(RTA_ALIGNTO-1) ) +-#define RTA_OK(rta,len) ((len) >= (int)sizeof(struct rtattr) && \ +- (rta)->rta_len >= sizeof(struct rtattr) && \ +- (rta)->rta_len <= (len)) +-#define RTA_NEXT(rta,attrlen) ((attrlen) -= RTA_ALIGN((rta)->rta_len), \ +- (struct rtattr*)(((char*)(rta)) + RTA_ALIGN((rta)->rta_len))) +-#define RTA_LENGTH(len) (RTA_ALIGN(sizeof(struct rtattr)) + (len)) +-#define RTA_SPACE(len) RTA_ALIGN(RTA_LENGTH(len)) +-#define RTA_DATA(rta) ((void*)(((char*)(rta)) + RTA_LENGTH(0))) +-#define RTA_PAYLOAD(rta) ((int)((rta)->rta_len) - RTA_LENGTH(0)) +- +- +- +- +-/****************************************************************************** +- * Definitions used in routing table administration. +- ****/ +- +-struct rtmsg { +- unsigned char rtm_family; +- unsigned char rtm_dst_len; +- unsigned char rtm_src_len; +- unsigned char rtm_tos; +- +- unsigned char rtm_table; /* Routing table id */ +- unsigned char rtm_protocol; /* Routing protocol; see below */ +- unsigned char rtm_scope; /* See below */ +- unsigned char rtm_type; /* See below */ +- +- unsigned rtm_flags; +-}; +- +-/* rtm_type */ +- +-enum { +- RTN_UNSPEC, +- RTN_UNICAST, /* Gateway or direct route */ +- RTN_LOCAL, /* Accept locally */ +- RTN_BROADCAST, /* Accept locally as broadcast, +- send as broadcast */ +- RTN_ANYCAST, /* Accept locally as broadcast, +- but send as unicast */ +- RTN_MULTICAST, /* Multicast route */ +- RTN_BLACKHOLE, /* Drop */ +- RTN_UNREACHABLE, /* Destination is unreachable */ +- RTN_PROHIBIT, /* Administratively prohibited */ +- RTN_THROW, /* Not in this table */ +- RTN_NAT, /* Translate this address */ +- RTN_XRESOLVE, /* Use external resolver */ +- __RTN_MAX +-}; +- +-#define RTN_MAX (__RTN_MAX - 1) +- +- +-/* rtm_protocol */ +- +-#define RTPROT_UNSPEC 0 +-#define RTPROT_REDIRECT 1 /* Route installed by ICMP redirects; +- not used by current IPv4 */ +-#define RTPROT_KERNEL 2 /* Route installed by kernel */ +-#define RTPROT_BOOT 3 /* Route installed during boot */ +-#define RTPROT_STATIC 4 /* Route installed by administrator */ +- +-/* Values of protocol >= RTPROT_STATIC are not interpreted by kernel; +- they are just passed from user and back as is. +- It will be used by hypothetical multiple routing daemons. +- Note that protocol values should be standardized in order to +- avoid conflicts. +- */ +- +-#define RTPROT_GATED 8 /* Apparently, GateD */ +-#define RTPROT_RA 9 /* RDISC/ND router advertisements */ +-#define RTPROT_MRT 10 /* Merit MRT */ +-#define RTPROT_ZEBRA 11 /* Zebra */ +-#define RTPROT_BIRD 12 /* BIRD */ +-#define RTPROT_DNROUTED 13 /* DECnet routing daemon */ +-#define RTPROT_XORP 14 /* XORP */ +-#define RTPROT_NTK 15 /* Netsukuku */ +-#define RTPROT_DHCP 16 /* DHCP client */ +-#define RTPROT_MROUTED 17 /* Multicast daemon */ +-#define RTPROT_BABEL 42 /* Babel daemon */ +- +-/* rtm_scope +- +- Really it is not scope, but sort of distance to the destination. +- NOWHERE are reserved for not existing destinations, HOST is our +- local addresses, LINK are destinations, located on directly attached +- link and UNIVERSE is everywhere in the Universe. +- +- Intermediate values are also possible f.e. interior routes +- could be assigned a value between UNIVERSE and LINK. +-*/ +- +-enum rt_scope_t { +- RT_SCOPE_UNIVERSE=0, +-/* User defined values */ +- RT_SCOPE_SITE=200, +- RT_SCOPE_LINK=253, +- RT_SCOPE_HOST=254, +- RT_SCOPE_NOWHERE=255 +-}; +- +-/* rtm_flags */ +- +-#define RTM_F_NOTIFY 0x100 /* Notify user of route change */ +-#define RTM_F_CLONED 0x200 /* This route is cloned */ +-#define RTM_F_EQUALIZE 0x400 /* Multipath equalizer: NI */ +-#define RTM_F_PREFIX 0x800 /* Prefix addresses */ +-#define RTM_F_LOOKUP_TABLE 0x1000 /* set rtm_table to FIB lookup result */ +-#define RTM_F_FIB_MATCH 0x2000 /* return full fib lookup match */ +- +-/* Reserved table identifiers */ +- +-enum rt_class_t { +- RT_TABLE_UNSPEC=0, +-/* User defined values */ +- RT_TABLE_COMPAT=252, +- RT_TABLE_DEFAULT=253, +- RT_TABLE_MAIN=254, +- RT_TABLE_LOCAL=255, +- RT_TABLE_MAX=0xFFFFFFFF +-}; +- +- +-/* Routing message attributes */ +- +-enum rtattr_type_t { +- RTA_UNSPEC, +- RTA_DST, +- RTA_SRC, +- RTA_IIF, +- RTA_OIF, +- RTA_GATEWAY, +- RTA_PRIORITY, +- RTA_PREFSRC, +- RTA_METRICS, +- RTA_MULTIPATH, +- RTA_PROTOINFO, /* no longer used */ +- RTA_FLOW, +- RTA_CACHEINFO, +- RTA_SESSION, /* no longer used */ +- RTA_MP_ALGO, /* no longer used */ +- RTA_TABLE, +- RTA_MARK, +- RTA_MFC_STATS, +- RTA_VIA, +- RTA_NEWDST, +- RTA_PREF, +- RTA_ENCAP_TYPE, +- RTA_ENCAP, +- RTA_EXPIRES, +- RTA_PAD, +- RTA_UID, +- RTA_TTL_PROPAGATE, +- __RTA_MAX +-}; +- +-#define RTA_MAX (__RTA_MAX - 1) +- +-#define RTM_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct rtmsg)))) +-#define RTM_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct rtmsg)) +- +-/* RTM_MULTIPATH --- array of struct rtnexthop. +- * +- * "struct rtnexthop" describes all necessary nexthop information, +- * i.e. parameters of path to a destination via this nexthop. +- * +- * At the moment it is impossible to set different prefsrc, mtu, window +- * and rtt for different paths from multipath. +- */ +- +-struct rtnexthop { +- unsigned short rtnh_len; +- unsigned char rtnh_flags; +- unsigned char rtnh_hops; +- int rtnh_ifindex; +-}; +- +-/* rtnh_flags */ +- +-#define RTNH_F_DEAD 1 /* Nexthop is dead (used by multipath) */ +-#define RTNH_F_PERVASIVE 2 /* Do recursive gateway lookup */ +-#define RTNH_F_ONLINK 4 /* Gateway is forced on link */ +-#define RTNH_F_OFFLOAD 8 /* offloaded route */ +-#define RTNH_F_LINKDOWN 16 /* carrier-down on nexthop */ +-#define RTNH_F_UNRESOLVED 32 /* The entry is unresolved (ipmr) */ +- +-#define RTNH_COMPARE_MASK (RTNH_F_DEAD | RTNH_F_LINKDOWN | RTNH_F_OFFLOAD) +- +-/* Macros to handle hexthops */ +- +-#define RTNH_ALIGNTO 4 +-#define RTNH_ALIGN(len) ( ((len)+RTNH_ALIGNTO-1) & ~(RTNH_ALIGNTO-1) ) +-#define RTNH_OK(rtnh,len) ((rtnh)->rtnh_len >= sizeof(struct rtnexthop) && \ +- ((int)(rtnh)->rtnh_len) <= (len)) +-#define RTNH_NEXT(rtnh) ((struct rtnexthop*)(((char*)(rtnh)) + RTNH_ALIGN((rtnh)->rtnh_len))) +-#define RTNH_LENGTH(len) (RTNH_ALIGN(sizeof(struct rtnexthop)) + (len)) +-#define RTNH_SPACE(len) RTNH_ALIGN(RTNH_LENGTH(len)) +-#define RTNH_DATA(rtnh) ((struct rtattr*)(((char*)(rtnh)) + RTNH_LENGTH(0))) +- +-/* RTA_VIA */ +-struct rtvia { +- __kernel_sa_family_t rtvia_family; +- __u8 rtvia_addr[0]; +-}; +- +-/* RTM_CACHEINFO */ +- +-struct rta_cacheinfo { +- __u32 rta_clntref; +- __u32 rta_lastuse; +- __s32 rta_expires; +- __u32 rta_error; +- __u32 rta_used; +- +-#define RTNETLINK_HAVE_PEERINFO 1 +- __u32 rta_id; +- __u32 rta_ts; +- __u32 rta_tsage; +-}; +- +-/* RTM_METRICS --- array of struct rtattr with types of RTAX_* */ +- +-enum { +- RTAX_UNSPEC, +-#define RTAX_UNSPEC RTAX_UNSPEC +- RTAX_LOCK, +-#define RTAX_LOCK RTAX_LOCK +- RTAX_MTU, +-#define RTAX_MTU RTAX_MTU +- RTAX_WINDOW, +-#define RTAX_WINDOW RTAX_WINDOW +- RTAX_RTT, +-#define RTAX_RTT RTAX_RTT +- RTAX_RTTVAR, +-#define RTAX_RTTVAR RTAX_RTTVAR +- RTAX_SSTHRESH, +-#define RTAX_SSTHRESH RTAX_SSTHRESH +- RTAX_CWND, +-#define RTAX_CWND RTAX_CWND +- RTAX_ADVMSS, +-#define RTAX_ADVMSS RTAX_ADVMSS +- RTAX_REORDERING, +-#define RTAX_REORDERING RTAX_REORDERING +- RTAX_HOPLIMIT, +-#define RTAX_HOPLIMIT RTAX_HOPLIMIT +- RTAX_INITCWND, +-#define RTAX_INITCWND RTAX_INITCWND +- RTAX_FEATURES, +-#define RTAX_FEATURES RTAX_FEATURES +- RTAX_RTO_MIN, +-#define RTAX_RTO_MIN RTAX_RTO_MIN +- RTAX_INITRWND, +-#define RTAX_INITRWND RTAX_INITRWND +- RTAX_QUICKACK, +-#define RTAX_QUICKACK RTAX_QUICKACK +- RTAX_CC_ALGO, +-#define RTAX_CC_ALGO RTAX_CC_ALGO +- __RTAX_MAX +-}; +- +-#define RTAX_MAX (__RTAX_MAX - 1) +- +-#define RTAX_FEATURE_ECN (1 << 0) +-#define RTAX_FEATURE_SACK (1 << 1) +-#define RTAX_FEATURE_TIMESTAMP (1 << 2) +-#define RTAX_FEATURE_ALLFRAG (1 << 3) +- +-#define RTAX_FEATURE_MASK (RTAX_FEATURE_ECN | RTAX_FEATURE_SACK | \ +- RTAX_FEATURE_TIMESTAMP | RTAX_FEATURE_ALLFRAG) +- +-struct rta_session { +- __u8 proto; +- __u8 pad1; +- __u16 pad2; +- +- union { +- struct { +- __u16 sport; +- __u16 dport; +- } ports; +- +- struct { +- __u8 type; +- __u8 code; +- __u16 ident; +- } icmpt; +- +- __u32 spi; +- } u; +-}; +- +-struct rta_mfc_stats { +- __u64 mfcs_packets; +- __u64 mfcs_bytes; +- __u64 mfcs_wrong_if; +-}; +- +-/**** +- * General form of address family dependent message. +- ****/ +- +-struct rtgenmsg { +- unsigned char rtgen_family; +-}; +- +-/***************************************************************** +- * Link layer specific messages. +- ****/ +- +-/* struct ifinfomsg +- * passes link level specific information, not dependent +- * on network protocol. +- */ +- +-struct ifinfomsg { +- unsigned char ifi_family; +- unsigned char __ifi_pad; +- unsigned short ifi_type; /* ARPHRD_* */ +- int ifi_index; /* Link index */ +- unsigned ifi_flags; /* IFF_* flags */ +- unsigned ifi_change; /* IFF_* change mask */ +-}; +- +-/******************************************************************** +- * prefix information +- ****/ +- +-struct prefixmsg { +- unsigned char prefix_family; +- unsigned char prefix_pad1; +- unsigned short prefix_pad2; +- int prefix_ifindex; +- unsigned char prefix_type; +- unsigned char prefix_len; +- unsigned char prefix_flags; +- unsigned char prefix_pad3; +-}; +- +-enum +-{ +- PREFIX_UNSPEC, +- PREFIX_ADDRESS, +- PREFIX_CACHEINFO, +- __PREFIX_MAX +-}; +- +-#define PREFIX_MAX (__PREFIX_MAX - 1) +- +-struct prefix_cacheinfo { +- __u32 preferred_time; +- __u32 valid_time; +-}; +- +- +-/***************************************************************** +- * Traffic control messages. +- ****/ +- +-struct tcmsg { +- unsigned char tcm_family; +- unsigned char tcm__pad1; +- unsigned short tcm__pad2; +- int tcm_ifindex; +- __u32 tcm_handle; +- __u32 tcm_parent; +- __u32 tcm_info; +-}; +- +-enum { +- TCA_UNSPEC, +- TCA_KIND, +- TCA_OPTIONS, +- TCA_STATS, +- TCA_XSTATS, +- TCA_RATE, +- TCA_FCNT, +- TCA_STATS2, +- TCA_STAB, +- TCA_PAD, +- TCA_DUMP_INVISIBLE, +- TCA_CHAIN, +- __TCA_MAX +-}; +- +-#define TCA_MAX (__TCA_MAX - 1) +- +-#define TCA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct tcmsg)))) +-#define TCA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct tcmsg)) +- +-/******************************************************************** +- * Neighbor Discovery userland options +- ****/ +- +-struct nduseroptmsg { +- unsigned char nduseropt_family; +- unsigned char nduseropt_pad1; +- unsigned short nduseropt_opts_len; /* Total length of options */ +- int nduseropt_ifindex; +- __u8 nduseropt_icmp_type; +- __u8 nduseropt_icmp_code; +- unsigned short nduseropt_pad2; +- unsigned int nduseropt_pad3; +- /* Followed by one or more ND options */ +-}; +- +-enum { +- NDUSEROPT_UNSPEC, +- NDUSEROPT_SRCADDR, +- __NDUSEROPT_MAX +-}; +- +-#define NDUSEROPT_MAX (__NDUSEROPT_MAX - 1) +- +-/* RTnetlink multicast groups - backwards compatibility for userspace */ +-#define RTMGRP_LINK 1 +-#define RTMGRP_NOTIFY 2 +-#define RTMGRP_NEIGH 4 +-#define RTMGRP_TC 8 +- +-#define RTMGRP_IPV4_IFADDR 0x10 +-#define RTMGRP_IPV4_MROUTE 0x20 +-#define RTMGRP_IPV4_ROUTE 0x40 +-#define RTMGRP_IPV4_RULE 0x80 +- +-#define RTMGRP_IPV6_IFADDR 0x100 +-#define RTMGRP_IPV6_MROUTE 0x200 +-#define RTMGRP_IPV6_ROUTE 0x400 +-#define RTMGRP_IPV6_IFINFO 0x800 +- +-#define RTMGRP_DECnet_IFADDR 0x1000 +-#define RTMGRP_DECnet_ROUTE 0x4000 +- +-#define RTMGRP_IPV6_PREFIX 0x20000 +- +-/* RTnetlink multicast groups */ +-enum rtnetlink_groups { +- RTNLGRP_NONE, +-#define RTNLGRP_NONE RTNLGRP_NONE +- RTNLGRP_LINK, +-#define RTNLGRP_LINK RTNLGRP_LINK +- RTNLGRP_NOTIFY, +-#define RTNLGRP_NOTIFY RTNLGRP_NOTIFY +- RTNLGRP_NEIGH, +-#define RTNLGRP_NEIGH RTNLGRP_NEIGH +- RTNLGRP_TC, +-#define RTNLGRP_TC RTNLGRP_TC +- RTNLGRP_IPV4_IFADDR, +-#define RTNLGRP_IPV4_IFADDR RTNLGRP_IPV4_IFADDR +- RTNLGRP_IPV4_MROUTE, +-#define RTNLGRP_IPV4_MROUTE RTNLGRP_IPV4_MROUTE +- RTNLGRP_IPV4_ROUTE, +-#define RTNLGRP_IPV4_ROUTE RTNLGRP_IPV4_ROUTE +- RTNLGRP_IPV4_RULE, +-#define RTNLGRP_IPV4_RULE RTNLGRP_IPV4_RULE +- RTNLGRP_IPV6_IFADDR, +-#define RTNLGRP_IPV6_IFADDR RTNLGRP_IPV6_IFADDR +- RTNLGRP_IPV6_MROUTE, +-#define RTNLGRP_IPV6_MROUTE RTNLGRP_IPV6_MROUTE +- RTNLGRP_IPV6_ROUTE, +-#define RTNLGRP_IPV6_ROUTE RTNLGRP_IPV6_ROUTE +- RTNLGRP_IPV6_IFINFO, +-#define RTNLGRP_IPV6_IFINFO RTNLGRP_IPV6_IFINFO +- RTNLGRP_DECnet_IFADDR, +-#define RTNLGRP_DECnet_IFADDR RTNLGRP_DECnet_IFADDR +- RTNLGRP_NOP2, +- RTNLGRP_DECnet_ROUTE, +-#define RTNLGRP_DECnet_ROUTE RTNLGRP_DECnet_ROUTE +- RTNLGRP_DECnet_RULE, +-#define RTNLGRP_DECnet_RULE RTNLGRP_DECnet_RULE +- RTNLGRP_NOP4, +- RTNLGRP_IPV6_PREFIX, +-#define RTNLGRP_IPV6_PREFIX RTNLGRP_IPV6_PREFIX +- RTNLGRP_IPV6_RULE, +-#define RTNLGRP_IPV6_RULE RTNLGRP_IPV6_RULE +- RTNLGRP_ND_USEROPT, +-#define RTNLGRP_ND_USEROPT RTNLGRP_ND_USEROPT +- RTNLGRP_PHONET_IFADDR, +-#define RTNLGRP_PHONET_IFADDR RTNLGRP_PHONET_IFADDR +- RTNLGRP_PHONET_ROUTE, +-#define RTNLGRP_PHONET_ROUTE RTNLGRP_PHONET_ROUTE +- RTNLGRP_DCB, +-#define RTNLGRP_DCB RTNLGRP_DCB +- RTNLGRP_IPV4_NETCONF, +-#define RTNLGRP_IPV4_NETCONF RTNLGRP_IPV4_NETCONF +- RTNLGRP_IPV6_NETCONF, +-#define RTNLGRP_IPV6_NETCONF RTNLGRP_IPV6_NETCONF +- RTNLGRP_MDB, +-#define RTNLGRP_MDB RTNLGRP_MDB +- RTNLGRP_MPLS_ROUTE, +-#define RTNLGRP_MPLS_ROUTE RTNLGRP_MPLS_ROUTE +- RTNLGRP_NSID, +-#define RTNLGRP_NSID RTNLGRP_NSID +- RTNLGRP_MPLS_NETCONF, +-#define RTNLGRP_MPLS_NETCONF RTNLGRP_MPLS_NETCONF +- RTNLGRP_IPV4_MROUTE_R, +-#define RTNLGRP_IPV4_MROUTE_R RTNLGRP_IPV4_MROUTE_R +- RTNLGRP_IPV6_MROUTE_R, +-#define RTNLGRP_IPV6_MROUTE_R RTNLGRP_IPV6_MROUTE_R +- __RTNLGRP_MAX +-}; +-#define RTNLGRP_MAX (__RTNLGRP_MAX - 1) +- +-/* TC action piece */ +-struct tcamsg { +- unsigned char tca_family; +- unsigned char tca__pad1; +- unsigned short tca__pad2; +-}; +- +-enum { +- TCA_ROOT_UNSPEC, +- TCA_ROOT_TAB, +-#define TCA_ACT_TAB TCA_ROOT_TAB +-#define TCAA_MAX TCA_ROOT_TAB +- TCA_ROOT_FLAGS, +- TCA_ROOT_COUNT, +- TCA_ROOT_TIME_DELTA, /* in msecs */ +- __TCA_ROOT_MAX, +-#define TCA_ROOT_MAX (__TCA_ROOT_MAX - 1) +-}; +- +-#define TA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct tcamsg)))) +-#define TA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct tcamsg)) +-/* tcamsg flags stored in attribute TCA_ROOT_FLAGS +- * +- * TCA_FLAG_LARGE_DUMP_ON user->kernel to request for larger than TCA_ACT_MAX_PRIO +- * actions in a dump. All dump responses will contain the number of actions +- * being dumped stored in for user app's consumption in TCA_ROOT_COUNT +- * +- */ +-#define TCA_FLAG_LARGE_DUMP_ON (1 << 0) +- +-/* New extended info filters for IFLA_EXT_MASK */ +-#define RTEXT_FILTER_VF (1 << 0) +-#define RTEXT_FILTER_BRVLAN (1 << 1) +-#define RTEXT_FILTER_BRVLAN_COMPRESSED (1 << 2) +-#define RTEXT_FILTER_SKIP_STATS (1 << 3) +- +-/* End of information exported to user level */ +- +- +- +-#endif /* __LINUX_RTNETLINK_H */ +diff --git a/include/linux/sctp.h b/include/linux/sctp.h +deleted file mode 100644 +index fec24c4..0000000 +--- a/include/linux/sctp.h ++++ /dev/null +@@ -1,1085 +0,0 @@ +-/* SCTP kernel implementation +- * (C) Copyright IBM Corp. 2001, 2004 +- * Copyright (c) 1999-2000 Cisco, Inc. +- * Copyright (c) 1999-2001 Motorola, Inc. +- * Copyright (c) 2002 Intel Corp. +- * +- * This file is part of the SCTP kernel implementation +- * +- * This header represents the structures and constants needed to support +- * the SCTP Extension to the Sockets API. +- * +- * This SCTP implementation is free software; +- * you can redistribute it and/or modify it under the terms of +- * the GNU General Public License as published by +- * the Free Software Foundation; either version 2, or (at your option) +- * any later version. +- * +- * This SCTP implementation is distributed in the hope that it +- * will be useful, but WITHOUT ANY WARRANTY; without even the implied +- * ************************ +- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +- * See the GNU General Public License for more details. +- * +- * You should have received a copy of the GNU General Public License +- * along with GNU CC; see the file COPYING. If not, see +- * . +- * +- * Please send any bug reports or fixes you make to the +- * email address(es): +- * lksctp developers +- * +- * Or submit a bug report through the following website: +- * http://www.sf.net/projects/lksctp +- * +- * Written or modified by: +- * La Monte H.P. Yarroll +- * R. Stewart +- * K. Morneau +- * Q. Xie +- * Karl Knutson +- * Jon Grimm +- * Daisy Chang +- * Ryan Layer +- * Ardelle Fan +- * Sridhar Samudrala +- * Inaky Perez-Gonzalez +- * Vlad Yasevich +- * +- * Any bugs reported given to us we will try to fix... any fixes shared will +- * be incorporated into the next SCTP release. +- */ +- +-#ifndef _SCTP_H +-#define _SCTP_H +- +-#include +-#include +- +-typedef __s32 sctp_assoc_t; +- +-/* The following symbols come from the Sockets API Extensions for +- * SCTP . +- */ +-#define SCTP_RTOINFO 0 +-#define SCTP_ASSOCINFO 1 +-#define SCTP_INITMSG 2 +-#define SCTP_NODELAY 3 /* Get/set nodelay option. */ +-#define SCTP_AUTOCLOSE 4 +-#define SCTP_SET_PEER_PRIMARY_ADDR 5 +-#define SCTP_PRIMARY_ADDR 6 +-#define SCTP_ADAPTATION_LAYER 7 +-#define SCTP_DISABLE_FRAGMENTS 8 +-#define SCTP_PEER_ADDR_PARAMS 9 +-#define SCTP_DEFAULT_SEND_PARAM 10 +-#define SCTP_EVENTS 11 +-#define SCTP_I_WANT_MAPPED_V4_ADDR 12 /* Turn on/off mapped v4 addresses */ +-#define SCTP_MAXSEG 13 /* Get/set maximum fragment. */ +-#define SCTP_STATUS 14 +-#define SCTP_GET_PEER_ADDR_INFO 15 +-#define SCTP_DELAYED_ACK_TIME 16 +-#define SCTP_DELAYED_ACK SCTP_DELAYED_ACK_TIME +-#define SCTP_DELAYED_SACK SCTP_DELAYED_ACK_TIME +-#define SCTP_CONTEXT 17 +-#define SCTP_FRAGMENT_INTERLEAVE 18 +-#define SCTP_PARTIAL_DELIVERY_POINT 19 /* Set/Get partial delivery point */ +-#define SCTP_MAX_BURST 20 /* Set/Get max burst */ +-#define SCTP_AUTH_CHUNK 21 /* Set only: add a chunk type to authenticate */ +-#define SCTP_HMAC_IDENT 22 +-#define SCTP_AUTH_KEY 23 +-#define SCTP_AUTH_ACTIVE_KEY 24 +-#define SCTP_AUTH_DELETE_KEY 25 +-#define SCTP_PEER_AUTH_CHUNKS 26 /* Read only */ +-#define SCTP_LOCAL_AUTH_CHUNKS 27 /* Read only */ +-#define SCTP_GET_ASSOC_NUMBER 28 /* Read only */ +-#define SCTP_GET_ASSOC_ID_LIST 29 /* Read only */ +-#define SCTP_AUTO_ASCONF 30 +-#define SCTP_PEER_ADDR_THLDS 31 +-#define SCTP_RECVRCVINFO 32 +-#define SCTP_RECVNXTINFO 33 +-#define SCTP_DEFAULT_SNDINFO 34 +- +-/* Internal Socket Options. Some of the sctp library functions are +- * implemented using these socket options. +- */ +-#define SCTP_SOCKOPT_BINDX_ADD 100 /* BINDX requests for adding addrs */ +-#define SCTP_SOCKOPT_BINDX_REM 101 /* BINDX requests for removing addrs. */ +-#define SCTP_SOCKOPT_PEELOFF 102 /* peel off association. */ +-/* Options 104-106 are deprecated and removed. Do not use this space */ +-#define SCTP_SOCKOPT_CONNECTX_OLD 107 /* CONNECTX old requests. */ +-#define SCTP_GET_PEER_ADDRS 108 /* Get all peer address. */ +-#define SCTP_GET_LOCAL_ADDRS 109 /* Get all local address. */ +-#define SCTP_SOCKOPT_CONNECTX 110 /* CONNECTX requests. */ +-#define SCTP_SOCKOPT_CONNECTX3 111 /* CONNECTX requests (updated) */ +-#define SCTP_GET_ASSOC_STATS 112 /* Read only */ +-#define SCTP_PR_SUPPORTED 113 +-#define SCTP_DEFAULT_PRINFO 114 +-#define SCTP_PR_ASSOC_STATUS 115 +-#define SCTP_PR_STREAM_STATUS 116 +-#define SCTP_RECONFIG_SUPPORTED 117 +-#define SCTP_ENABLE_STREAM_RESET 118 +-#define SCTP_RESET_STREAMS 119 +-#define SCTP_RESET_ASSOC 120 +-#define SCTP_ADD_STREAMS 121 +-#define SCTP_SOCKOPT_PEELOFF_FLAGS 122 +- +-/* PR-SCTP policies */ +-#define SCTP_PR_SCTP_NONE 0x0000 +-#define SCTP_PR_SCTP_TTL 0x0010 +-#define SCTP_PR_SCTP_RTX 0x0020 +-#define SCTP_PR_SCTP_PRIO 0x0030 +-#define SCTP_PR_SCTP_MAX SCTP_PR_SCTP_PRIO +-#define SCTP_PR_SCTP_MASK 0x0030 +- +-#define __SCTP_PR_INDEX(x) ((x >> 4) - 1) +-#define SCTP_PR_INDEX(x) __SCTP_PR_INDEX(SCTP_PR_SCTP_ ## x) +- +-#define SCTP_PR_POLICY(x) ((x) & SCTP_PR_SCTP_MASK) +-#define SCTP_PR_SET_POLICY(flags, x) \ +- do { \ +- flags &= ~SCTP_PR_SCTP_MASK; \ +- flags |= x; \ +- } while (0) +- +-#define SCTP_PR_TTL_ENABLED(x) (SCTP_PR_POLICY(x) == SCTP_PR_SCTP_TTL) +-#define SCTP_PR_RTX_ENABLED(x) (SCTP_PR_POLICY(x) == SCTP_PR_SCTP_RTX) +-#define SCTP_PR_PRIO_ENABLED(x) (SCTP_PR_POLICY(x) == SCTP_PR_SCTP_PRIO) +- +-/* For enable stream reset */ +-#define SCTP_ENABLE_RESET_STREAM_REQ 0x01 +-#define SCTP_ENABLE_RESET_ASSOC_REQ 0x02 +-#define SCTP_ENABLE_CHANGE_ASSOC_REQ 0x04 +-#define SCTP_ENABLE_STRRESET_MASK 0x07 +- +-#define SCTP_STREAM_RESET_INCOMING 0x01 +-#define SCTP_STREAM_RESET_OUTGOING 0x02 +- +-/* These are bit fields for msghdr->msg_flags. See section 5.1. */ +-/* On user space Linux, these live in as an enum. */ +-enum sctp_msg_flags { +- MSG_NOTIFICATION = 0x8000, +-#define MSG_NOTIFICATION MSG_NOTIFICATION +-}; +- +-/* 5.3.1 SCTP Initiation Structure (SCTP_INIT) +- * +- * This cmsghdr structure provides information for initializing new +- * SCTP associations with sendmsg(). The SCTP_INITMSG socket option +- * uses this same data structure. This structure is not used for +- * recvmsg(). +- * +- * cmsg_level cmsg_type cmsg_data[] +- * ------------ ------------ ---------------------- +- * IPPROTO_SCTP SCTP_INIT struct sctp_initmsg +- */ +-struct sctp_initmsg { +- __u16 sinit_num_ostreams; +- __u16 sinit_max_instreams; +- __u16 sinit_max_attempts; +- __u16 sinit_max_init_timeo; +-}; +- +-/* 5.3.2 SCTP Header Information Structure (SCTP_SNDRCV) +- * +- * This cmsghdr structure specifies SCTP options for sendmsg() and +- * describes SCTP header information about a received message through +- * recvmsg(). +- * +- * cmsg_level cmsg_type cmsg_data[] +- * ------------ ------------ ---------------------- +- * IPPROTO_SCTP SCTP_SNDRCV struct sctp_sndrcvinfo +- */ +-struct sctp_sndrcvinfo { +- __u16 sinfo_stream; +- __u16 sinfo_ssn; +- __u16 sinfo_flags; +- __u32 sinfo_ppid; +- __u32 sinfo_context; +- __u32 sinfo_timetolive; +- __u32 sinfo_tsn; +- __u32 sinfo_cumtsn; +- sctp_assoc_t sinfo_assoc_id; +-}; +- +-/* 5.3.4 SCTP Send Information Structure (SCTP_SNDINFO) +- * +- * This cmsghdr structure specifies SCTP options for sendmsg(). +- * +- * cmsg_level cmsg_type cmsg_data[] +- * ------------ ------------ ------------------- +- * IPPROTO_SCTP SCTP_SNDINFO struct sctp_sndinfo +- */ +-struct sctp_sndinfo { +- __u16 snd_sid; +- __u16 snd_flags; +- __u32 snd_ppid; +- __u32 snd_context; +- sctp_assoc_t snd_assoc_id; +-}; +- +-/* 5.3.5 SCTP Receive Information Structure (SCTP_RCVINFO) +- * +- * This cmsghdr structure describes SCTP receive information +- * about a received message through recvmsg(). +- * +- * cmsg_level cmsg_type cmsg_data[] +- * ------------ ------------ ------------------- +- * IPPROTO_SCTP SCTP_RCVINFO struct sctp_rcvinfo +- */ +-struct sctp_rcvinfo { +- __u16 rcv_sid; +- __u16 rcv_ssn; +- __u16 rcv_flags; +- __u32 rcv_ppid; +- __u32 rcv_tsn; +- __u32 rcv_cumtsn; +- __u32 rcv_context; +- sctp_assoc_t rcv_assoc_id; +-}; +- +-/* 5.3.6 SCTP Next Receive Information Structure (SCTP_NXTINFO) +- * +- * This cmsghdr structure describes SCTP receive information +- * of the next message that will be delivered through recvmsg() +- * if this information is already available when delivering +- * the current message. +- * +- * cmsg_level cmsg_type cmsg_data[] +- * ------------ ------------ ------------------- +- * IPPROTO_SCTP SCTP_NXTINFO struct sctp_nxtinfo +- */ +-struct sctp_nxtinfo { +- __u16 nxt_sid; +- __u16 nxt_flags; +- __u32 nxt_ppid; +- __u32 nxt_length; +- sctp_assoc_t nxt_assoc_id; +-}; +- +-/* +- * sinfo_flags: 16 bits (unsigned integer) +- * +- * This field may contain any of the following flags and is composed of +- * a bitwise OR of these values. +- */ +-enum sctp_sinfo_flags { +- SCTP_UNORDERED = (1 << 0), /* Send/receive message unordered. */ +- SCTP_ADDR_OVER = (1 << 1), /* Override the primary destination. */ +- SCTP_ABORT = (1 << 2), /* Send an ABORT message to the peer. */ +- SCTP_SACK_IMMEDIATELY = (1 << 3), /* SACK should be sent without delay. */ +- SCTP_NOTIFICATION = MSG_NOTIFICATION, /* Next message is not user msg but notification. */ +- SCTP_EOF = MSG_FIN, /* Initiate graceful shutdown process. */ +-}; +- +-typedef union { +- __u8 raw; +- struct sctp_initmsg init; +- struct sctp_sndrcvinfo sndrcv; +-} sctp_cmsg_data_t; +- +-/* These are cmsg_types. */ +-typedef enum sctp_cmsg_type { +- SCTP_INIT, /* 5.2.1 SCTP Initiation Structure */ +-#define SCTP_INIT SCTP_INIT +- SCTP_SNDRCV, /* 5.2.2 SCTP Header Information Structure */ +-#define SCTP_SNDRCV SCTP_SNDRCV +- SCTP_SNDINFO, /* 5.3.4 SCTP Send Information Structure */ +-#define SCTP_SNDINFO SCTP_SNDINFO +- SCTP_RCVINFO, /* 5.3.5 SCTP Receive Information Structure */ +-#define SCTP_RCVINFO SCTP_RCVINFO +- SCTP_NXTINFO, /* 5.3.6 SCTP Next Receive Information Structure */ +-#define SCTP_NXTINFO SCTP_NXTINFO +-} sctp_cmsg_t; +- +-/* +- * 5.3.1.1 SCTP_ASSOC_CHANGE +- * +- * Communication notifications inform the ULP that an SCTP association +- * has either begun or ended. The identifier for a new association is +- * provided by this notificaion. The notification information has the +- * following format: +- * +- */ +-struct sctp_assoc_change { +- __u16 sac_type; +- __u16 sac_flags; +- __u32 sac_length; +- __u16 sac_state; +- __u16 sac_error; +- __u16 sac_outbound_streams; +- __u16 sac_inbound_streams; +- sctp_assoc_t sac_assoc_id; +- __u8 sac_info[0]; +-}; +- +-/* +- * sac_state: 32 bits (signed integer) +- * +- * This field holds one of a number of values that communicate the +- * event that happened to the association. They include: +- * +- * Note: The following state names deviate from the API draft as +- * the names clash too easily with other kernel symbols. +- */ +-enum sctp_sac_state { +- SCTP_COMM_UP, +- SCTP_COMM_LOST, +- SCTP_RESTART, +- SCTP_SHUTDOWN_COMP, +- SCTP_CANT_STR_ASSOC, +-}; +- +-/* +- * 5.3.1.2 SCTP_PEER_ADDR_CHANGE +- * +- * When a destination address on a multi-homed peer encounters a change +- * an interface details event is sent. The information has the +- * following structure: +- */ +-struct sctp_paddr_change { +- __u16 spc_type; +- __u16 spc_flags; +- __u32 spc_length; +- struct sockaddr_storage spc_aaddr; +- int spc_state; +- int spc_error; +- sctp_assoc_t spc_assoc_id; +-} __attribute__((packed, aligned(4))); +- +-/* +- * spc_state: 32 bits (signed integer) +- * +- * This field holds one of a number of values that communicate the +- * event that happened to the address. They include: +- */ +-enum sctp_spc_state { +- SCTP_ADDR_AVAILABLE, +- SCTP_ADDR_UNREACHABLE, +- SCTP_ADDR_REMOVED, +- SCTP_ADDR_ADDED, +- SCTP_ADDR_MADE_PRIM, +- SCTP_ADDR_CONFIRMED, +-}; +- +- +-/* +- * 5.3.1.3 SCTP_REMOTE_ERROR +- * +- * A remote peer may send an Operational Error message to its peer. +- * This message indicates a variety of error conditions on an +- * association. The entire error TLV as it appears on the wire is +- * included in a SCTP_REMOTE_ERROR event. Please refer to the SCTP +- * specification [SCTP] and any extensions for a list of possible +- * error formats. SCTP error TLVs have the format: +- */ +-struct sctp_remote_error { +- __u16 sre_type; +- __u16 sre_flags; +- __u32 sre_length; +- __u16 sre_error; +- sctp_assoc_t sre_assoc_id; +- __u8 sre_data[0]; +-}; +- +- +-/* +- * 5.3.1.4 SCTP_SEND_FAILED +- * +- * If SCTP cannot deliver a message it may return the message as a +- * notification. +- */ +-struct sctp_send_failed { +- __u16 ssf_type; +- __u16 ssf_flags; +- __u32 ssf_length; +- __u32 ssf_error; +- struct sctp_sndrcvinfo ssf_info; +- sctp_assoc_t ssf_assoc_id; +- __u8 ssf_data[0]; +-}; +- +-/* +- * ssf_flags: 16 bits (unsigned integer) +- * +- * The flag value will take one of the following values +- * +- * SCTP_DATA_UNSENT - Indicates that the data was never put on +- * the wire. +- * +- * SCTP_DATA_SENT - Indicates that the data was put on the wire. +- * Note that this does not necessarily mean that the +- * data was (or was not) successfully delivered. +- */ +-enum sctp_ssf_flags { +- SCTP_DATA_UNSENT, +- SCTP_DATA_SENT, +-}; +- +-/* +- * 5.3.1.5 SCTP_SHUTDOWN_EVENT +- * +- * When a peer sends a SHUTDOWN, SCTP delivers this notification to +- * inform the application that it should cease sending data. +- */ +-struct sctp_shutdown_event { +- __u16 sse_type; +- __u16 sse_flags; +- __u32 sse_length; +- sctp_assoc_t sse_assoc_id; +-}; +- +-/* +- * 5.3.1.6 SCTP_ADAPTATION_INDICATION +- * +- * When a peer sends a Adaptation Layer Indication parameter , SCTP +- * delivers this notification to inform the application +- * that of the peers requested adaptation layer. +- */ +-struct sctp_adaptation_event { +- __u16 sai_type; +- __u16 sai_flags; +- __u32 sai_length; +- __u32 sai_adaptation_ind; +- sctp_assoc_t sai_assoc_id; +-}; +- +-/* +- * 5.3.1.7 SCTP_PARTIAL_DELIVERY_EVENT +- * +- * When a receiver is engaged in a partial delivery of a +- * message this notification will be used to indicate +- * various events. +- */ +-struct sctp_pdapi_event { +- __u16 pdapi_type; +- __u16 pdapi_flags; +- __u32 pdapi_length; +- __u32 pdapi_indication; +- sctp_assoc_t pdapi_assoc_id; +-}; +- +-enum { SCTP_PARTIAL_DELIVERY_ABORTED=0, }; +- +-/* +- * 5.3.1.8. SCTP_AUTHENTICATION_EVENT +- * +- * When a receiver is using authentication this message will provide +- * notifications regarding new keys being made active as well as errors. +- */ +-struct sctp_authkey_event { +- __u16 auth_type; +- __u16 auth_flags; +- __u32 auth_length; +- __u16 auth_keynumber; +- __u16 auth_altkeynumber; +- __u32 auth_indication; +- sctp_assoc_t auth_assoc_id; +-}; +- +-enum { SCTP_AUTH_NEWKEY = 0, }; +- +-/* +- * 6.1.9. SCTP_SENDER_DRY_EVENT +- * +- * When the SCTP stack has no more user data to send or retransmit, this +- * notification is given to the user. Also, at the time when a user app +- * subscribes to this event, if there is no data to be sent or +- * retransmit, the stack will immediately send up this notification. +- */ +-struct sctp_sender_dry_event { +- __u16 sender_dry_type; +- __u16 sender_dry_flags; +- __u32 sender_dry_length; +- sctp_assoc_t sender_dry_assoc_id; +-}; +- +-#define SCTP_STREAM_RESET_INCOMING_SSN 0x0001 +-#define SCTP_STREAM_RESET_OUTGOING_SSN 0x0002 +-#define SCTP_STREAM_RESET_DENIED 0x0004 +-#define SCTP_STREAM_RESET_FAILED 0x0008 +-struct sctp_stream_reset_event { +- __u16 strreset_type; +- __u16 strreset_flags; +- __u32 strreset_length; +- sctp_assoc_t strreset_assoc_id; +- __u16 strreset_stream_list[]; +-}; +- +-#define SCTP_ASSOC_RESET_DENIED 0x0004 +-#define SCTP_ASSOC_RESET_FAILED 0x0008 +-struct sctp_assoc_reset_event { +- __u16 assocreset_type; +- __u16 assocreset_flags; +- __u32 assocreset_length; +- sctp_assoc_t assocreset_assoc_id; +- __u32 assocreset_local_tsn; +- __u32 assocreset_remote_tsn; +-}; +- +-#define SCTP_ASSOC_CHANGE_DENIED 0x0004 +-#define SCTP_ASSOC_CHANGE_FAILED 0x0008 +-struct sctp_stream_change_event { +- __u16 strchange_type; +- __u16 strchange_flags; +- __u32 strchange_length; +- sctp_assoc_t strchange_assoc_id; +- __u16 strchange_instrms; +- __u16 strchange_outstrms; +-}; +- +-/* +- * Described in Section 7.3 +- * Ancillary Data and Notification Interest Options +- */ +-struct sctp_event_subscribe { +- __u8 sctp_data_io_event; +- __u8 sctp_association_event; +- __u8 sctp_address_event; +- __u8 sctp_send_failure_event; +- __u8 sctp_peer_error_event; +- __u8 sctp_shutdown_event; +- __u8 sctp_partial_delivery_event; +- __u8 sctp_adaptation_layer_event; +- __u8 sctp_authentication_event; +- __u8 sctp_sender_dry_event; +- __u8 sctp_stream_reset_event; +- __u8 sctp_assoc_reset_event; +- __u8 sctp_stream_change_event; +-}; +- +-/* +- * 5.3.1 SCTP Notification Structure +- * +- * The notification structure is defined as the union of all +- * notification types. +- * +- */ +-union sctp_notification { +- struct { +- __u16 sn_type; /* Notification type. */ +- __u16 sn_flags; +- __u32 sn_length; +- } sn_header; +- struct sctp_assoc_change sn_assoc_change; +- struct sctp_paddr_change sn_paddr_change; +- struct sctp_remote_error sn_remote_error; +- struct sctp_send_failed sn_send_failed; +- struct sctp_shutdown_event sn_shutdown_event; +- struct sctp_adaptation_event sn_adaptation_event; +- struct sctp_pdapi_event sn_pdapi_event; +- struct sctp_authkey_event sn_authkey_event; +- struct sctp_sender_dry_event sn_sender_dry_event; +- struct sctp_stream_reset_event sn_strreset_event; +- struct sctp_assoc_reset_event sn_assocreset_event; +- struct sctp_stream_change_event sn_strchange_event; +-}; +- +-/* Section 5.3.1 +- * All standard values for sn_type flags are greater than 2^15. +- * Values from 2^15 and down are reserved. +- */ +- +-enum sctp_sn_type { +- SCTP_SN_TYPE_BASE = (1<<15), +- SCTP_ASSOC_CHANGE, +-#define SCTP_ASSOC_CHANGE SCTP_ASSOC_CHANGE +- SCTP_PEER_ADDR_CHANGE, +-#define SCTP_PEER_ADDR_CHANGE SCTP_PEER_ADDR_CHANGE +- SCTP_SEND_FAILED, +-#define SCTP_SEND_FAILED SCTP_SEND_FAILED +- SCTP_REMOTE_ERROR, +-#define SCTP_REMOTE_ERROR SCTP_REMOTE_ERROR +- SCTP_SHUTDOWN_EVENT, +-#define SCTP_SHUTDOWN_EVENT SCTP_SHUTDOWN_EVENT +- SCTP_PARTIAL_DELIVERY_EVENT, +-#define SCTP_PARTIAL_DELIVERY_EVENT SCTP_PARTIAL_DELIVERY_EVENT +- SCTP_ADAPTATION_INDICATION, +-#define SCTP_ADAPTATION_INDICATION SCTP_ADAPTATION_INDICATION +- SCTP_AUTHENTICATION_EVENT, +-#define SCTP_AUTHENTICATION_INDICATION SCTP_AUTHENTICATION_EVENT +- SCTP_SENDER_DRY_EVENT, +-#define SCTP_SENDER_DRY_EVENT SCTP_SENDER_DRY_EVENT +- SCTP_STREAM_RESET_EVENT, +-#define SCTP_STREAM_RESET_EVENT SCTP_STREAM_RESET_EVENT +- SCTP_ASSOC_RESET_EVENT, +-#define SCTP_ASSOC_RESET_EVENT SCTP_ASSOC_RESET_EVENT +- SCTP_STREAM_CHANGE_EVENT, +-#define SCTP_STREAM_CHANGE_EVENT SCTP_STREAM_CHANGE_EVENT +-}; +- +-/* Notification error codes used to fill up the error fields in some +- * notifications. +- * SCTP_PEER_ADDRESS_CHAGE : spc_error +- * SCTP_ASSOC_CHANGE : sac_error +- * These names should be potentially included in the draft 04 of the SCTP +- * sockets API specification. +- */ +-typedef enum sctp_sn_error { +- SCTP_FAILED_THRESHOLD, +- SCTP_RECEIVED_SACK, +- SCTP_HEARTBEAT_SUCCESS, +- SCTP_RESPONSE_TO_USER_REQ, +- SCTP_INTERNAL_ERROR, +- SCTP_SHUTDOWN_GUARD_EXPIRES, +- SCTP_PEER_FAULTY, +-} sctp_sn_error_t; +- +-/* +- * 7.1.1 Retransmission Timeout Parameters (SCTP_RTOINFO) +- * +- * The protocol parameters used to initialize and bound retransmission +- * timeout (RTO) are tunable. See [SCTP] for more information on how +- * these parameters are used in RTO calculation. +- */ +-struct sctp_rtoinfo { +- sctp_assoc_t srto_assoc_id; +- __u32 srto_initial; +- __u32 srto_max; +- __u32 srto_min; +-}; +- +-/* +- * 7.1.2 Association Parameters (SCTP_ASSOCINFO) +- * +- * This option is used to both examine and set various association and +- * endpoint parameters. +- */ +-struct sctp_assocparams { +- sctp_assoc_t sasoc_assoc_id; +- __u16 sasoc_asocmaxrxt; +- __u16 sasoc_number_peer_destinations; +- __u32 sasoc_peer_rwnd; +- __u32 sasoc_local_rwnd; +- __u32 sasoc_cookie_life; +-}; +- +-/* +- * 7.1.9 Set Peer Primary Address (SCTP_SET_PEER_PRIMARY_ADDR) +- * +- * Requests that the peer mark the enclosed address as the association +- * primary. The enclosed address must be one of the association's +- * locally bound addresses. The following structure is used to make a +- * set primary request: +- */ +-struct sctp_setpeerprim { +- sctp_assoc_t sspp_assoc_id; +- struct sockaddr_storage sspp_addr; +-} __attribute__((packed, aligned(4))); +- +-/* +- * 7.1.10 Set Primary Address (SCTP_PRIMARY_ADDR) +- * +- * Requests that the local SCTP stack use the enclosed peer address as +- * the association primary. The enclosed address must be one of the +- * association peer's addresses. The following structure is used to +- * make a set peer primary request: +- */ +-struct sctp_prim { +- sctp_assoc_t ssp_assoc_id; +- struct sockaddr_storage ssp_addr; +-} __attribute__((packed, aligned(4))); +- +-/* For backward compatibility use, define the old name too */ +-#define sctp_setprim sctp_prim +- +-/* +- * 7.1.11 Set Adaptation Layer Indicator (SCTP_ADAPTATION_LAYER) +- * +- * Requests that the local endpoint set the specified Adaptation Layer +- * Indication parameter for all future INIT and INIT-ACK exchanges. +- */ +-struct sctp_setadaptation { +- __u32 ssb_adaptation_ind; +-}; +- +-/* +- * 7.1.13 Peer Address Parameters (SCTP_PEER_ADDR_PARAMS) +- * +- * Applications can enable or disable heartbeats for any peer address +- * of an association, modify an address's heartbeat interval, force a +- * heartbeat to be sent immediately, and adjust the address's maximum +- * number of retransmissions sent before an address is considered +- * unreachable. The following structure is used to access and modify an +- * address's parameters: +- */ +-enum sctp_spp_flags { +- SPP_HB_ENABLE = 1<<0, /*Enable heartbeats*/ +- SPP_HB_DISABLE = 1<<1, /*Disable heartbeats*/ +- SPP_HB = SPP_HB_ENABLE | SPP_HB_DISABLE, +- SPP_HB_DEMAND = 1<<2, /*Send heartbeat immediately*/ +- SPP_PMTUD_ENABLE = 1<<3, /*Enable PMTU discovery*/ +- SPP_PMTUD_DISABLE = 1<<4, /*Disable PMTU discovery*/ +- SPP_PMTUD = SPP_PMTUD_ENABLE | SPP_PMTUD_DISABLE, +- SPP_SACKDELAY_ENABLE = 1<<5, /*Enable SACK*/ +- SPP_SACKDELAY_DISABLE = 1<<6, /*Disable SACK*/ +- SPP_SACKDELAY = SPP_SACKDELAY_ENABLE | SPP_SACKDELAY_DISABLE, +- SPP_HB_TIME_IS_ZERO = 1<<7, /* Set HB delay to 0 */ +-}; +- +-struct sctp_paddrparams { +- sctp_assoc_t spp_assoc_id; +- struct sockaddr_storage spp_address; +- __u32 spp_hbinterval; +- __u16 spp_pathmaxrxt; +- __u32 spp_pathmtu; +- __u32 spp_sackdelay; +- __u32 spp_flags; +-} __attribute__((packed, aligned(4))); +- +-/* +- * 7.1.18. Add a chunk that must be authenticated (SCTP_AUTH_CHUNK) +- * +- * This set option adds a chunk type that the user is requesting to be +- * received only in an authenticated way. Changes to the list of chunks +- * will only effect future associations on the socket. +- */ +-struct sctp_authchunk { +- __u8 sauth_chunk; +-}; +- +-/* +- * 7.1.19. Get or set the list of supported HMAC Identifiers (SCTP_HMAC_IDENT) +- * +- * This option gets or sets the list of HMAC algorithms that the local +- * endpoint requires the peer to use. +- */ +-/* This here is only used by user space as is. It might not be a good idea +- * to export/reveal the whole structure with reserved fields etc. +- */ +-enum { +- SCTP_AUTH_HMAC_ID_SHA1 = 1, +- SCTP_AUTH_HMAC_ID_SHA256 = 3, +-}; +- +-struct sctp_hmacalgo { +- __u32 shmac_num_idents; +- __u16 shmac_idents[]; +-}; +- +-/* Sadly, user and kernel space have different names for +- * this structure member, so this is to not break anything. +- */ +-#define shmac_number_of_idents shmac_num_idents +- +-/* +- * 7.1.20. Set a shared key (SCTP_AUTH_KEY) +- * +- * This option will set a shared secret key which is used to build an +- * association shared key. +- */ +-struct sctp_authkey { +- sctp_assoc_t sca_assoc_id; +- __u16 sca_keynumber; +- __u16 sca_keylength; +- __u8 sca_key[]; +-}; +- +-/* +- * 7.1.21. Get or set the active shared key (SCTP_AUTH_ACTIVE_KEY) +- * +- * This option will get or set the active shared key to be used to build +- * the association shared key. +- */ +- +-struct sctp_authkeyid { +- sctp_assoc_t scact_assoc_id; +- __u16 scact_keynumber; +-}; +- +- +-/* +- * 7.1.23. Get or set delayed ack timer (SCTP_DELAYED_SACK) +- * +- * This option will effect the way delayed acks are performed. This +- * option allows you to get or set the delayed ack time, in +- * milliseconds. It also allows changing the delayed ack frequency. +- * Changing the frequency to 1 disables the delayed sack algorithm. If +- * the assoc_id is 0, then this sets or gets the endpoints default +- * values. If the assoc_id field is non-zero, then the set or get +- * effects the specified association for the one to many model (the +- * assoc_id field is ignored by the one to one model). Note that if +- * sack_delay or sack_freq are 0 when setting this option, then the +- * current values will remain unchanged. +- */ +-struct sctp_sack_info { +- sctp_assoc_t sack_assoc_id; +- uint32_t sack_delay; +- uint32_t sack_freq; +-}; +- +-struct sctp_assoc_value { +- sctp_assoc_t assoc_id; +- uint32_t assoc_value; +-}; +- +-/* +- * 7.2.2 Peer Address Information +- * +- * Applications can retrieve information about a specific peer address +- * of an association, including its reachability state, congestion +- * window, and retransmission timer values. This information is +- * read-only. The following structure is used to access this +- * information: +- */ +-struct sctp_paddrinfo { +- sctp_assoc_t spinfo_assoc_id; +- struct sockaddr_storage spinfo_address; +- __s32 spinfo_state; +- __u32 spinfo_cwnd; +- __u32 spinfo_srtt; +- __u32 spinfo_rto; +- __u32 spinfo_mtu; +-} __attribute__((packed, aligned(4))); +- +-/* Peer addresses's state. */ +-/* UNKNOWN: Peer address passed by the upper layer in sendmsg or connect[x] +- * calls. +- * UNCONFIRMED: Peer address received in INIT/INIT-ACK address parameters. +- * Not yet confirmed by a heartbeat and not available for data +- * transfers. +- * ACTIVE : Peer address confirmed, active and available for data transfers. +- * INACTIVE: Peer address inactive and not available for data transfers. +- */ +-enum sctp_spinfo_state { +- SCTP_INACTIVE, +- SCTP_PF, +- SCTP_ACTIVE, +- SCTP_UNCONFIRMED, +- SCTP_UNKNOWN = 0xffff /* Value used for transport state unknown */ +-}; +- +-/* +- * 7.2.1 Association Status (SCTP_STATUS) +- * +- * Applications can retrieve current status information about an +- * association, including association state, peer receiver window size, +- * number of unacked data chunks, and number of data chunks pending +- * receipt. This information is read-only. The following structure is +- * used to access this information: +- */ +-struct sctp_status { +- sctp_assoc_t sstat_assoc_id; +- __s32 sstat_state; +- __u32 sstat_rwnd; +- __u16 sstat_unackdata; +- __u16 sstat_penddata; +- __u16 sstat_instrms; +- __u16 sstat_outstrms; +- __u32 sstat_fragmentation_point; +- struct sctp_paddrinfo sstat_primary; +-}; +- +-/* +- * 7.2.3. Get the list of chunks the peer requires to be authenticated +- * (SCTP_PEER_AUTH_CHUNKS) +- * +- * This option gets a list of chunks for a specified association that +- * the peer requires to be received authenticated only. +- */ +-struct sctp_authchunks { +- sctp_assoc_t gauth_assoc_id; +- __u32 gauth_number_of_chunks; +- uint8_t gauth_chunks[]; +-}; +- +-/* The broken spelling has been released already in lksctp-tools header, +- * so don't break anyone, now that it's fixed. +- */ +-#define guth_number_of_chunks gauth_number_of_chunks +- +-/* Association states. */ +-enum sctp_sstat_state { +- SCTP_EMPTY = 0, +- SCTP_CLOSED = 1, +- SCTP_COOKIE_WAIT = 2, +- SCTP_COOKIE_ECHOED = 3, +- SCTP_ESTABLISHED = 4, +- SCTP_SHUTDOWN_PENDING = 5, +- SCTP_SHUTDOWN_SENT = 6, +- SCTP_SHUTDOWN_RECEIVED = 7, +- SCTP_SHUTDOWN_ACK_SENT = 8, +-}; +- +-/* +- * 8.2.6. Get the Current Identifiers of Associations +- * (SCTP_GET_ASSOC_ID_LIST) +- * +- * This option gets the current list of SCTP association identifiers of +- * the SCTP associations handled by a one-to-many style socket. +- */ +-struct sctp_assoc_ids { +- __u32 gaids_number_of_ids; +- sctp_assoc_t gaids_assoc_id[]; +-}; +- +-/* +- * 8.3, 8.5 get all peer/local addresses in an association. +- * This parameter struct is used by SCTP_GET_PEER_ADDRS and +- * SCTP_GET_LOCAL_ADDRS socket options used internally to implement +- * sctp_getpaddrs() and sctp_getladdrs() API. +- */ +-struct sctp_getaddrs_old { +- sctp_assoc_t assoc_id; +- int addr_num; +- struct sockaddr *addrs; +-}; +- +-struct sctp_getaddrs { +- sctp_assoc_t assoc_id; /*input*/ +- __u32 addr_num; /*output*/ +- __u8 addrs[0]; /*output, variable size*/ +-}; +- +-/* A socket user request obtained via SCTP_GET_ASSOC_STATS that retrieves +- * association stats. All stats are counts except sas_maxrto and +- * sas_obs_rto_ipaddr. maxrto is the max observed rto + transport since +- * the last call. Will return 0 when RTO was not update since last call +- */ +-struct sctp_assoc_stats { +- sctp_assoc_t sas_assoc_id; /* Input */ +- /* Transport of observed max RTO */ +- struct sockaddr_storage sas_obs_rto_ipaddr; +- __u64 sas_maxrto; /* Maximum Observed RTO for period */ +- __u64 sas_isacks; /* SACKs received */ +- __u64 sas_osacks; /* SACKs sent */ +- __u64 sas_opackets; /* Packets sent */ +- __u64 sas_ipackets; /* Packets received */ +- __u64 sas_rtxchunks; /* Retransmitted Chunks */ +- __u64 sas_outofseqtsns;/* TSN received > next expected */ +- __u64 sas_idupchunks; /* Dups received (ordered+unordered) */ +- __u64 sas_gapcnt; /* Gap Acknowledgements Received */ +- __u64 sas_ouodchunks; /* Unordered data chunks sent */ +- __u64 sas_iuodchunks; /* Unordered data chunks received */ +- __u64 sas_oodchunks; /* Ordered data chunks sent */ +- __u64 sas_iodchunks; /* Ordered data chunks received */ +- __u64 sas_octrlchunks; /* Control chunks sent */ +- __u64 sas_ictrlchunks; /* Control chunks received */ +-}; +- +-/* +- * 8.1 sctp_bindx() +- * +- * The flags parameter is formed from the bitwise OR of zero or more of the +- * following currently defined flags: +- */ +-#define SCTP_BINDX_ADD_ADDR 0x01 +-#define SCTP_BINDX_REM_ADDR 0x02 +- +-/* This is the structure that is passed as an argument(optval) to +- * getsockopt(SCTP_SOCKOPT_PEELOFF). +- */ +-typedef struct { +- sctp_assoc_t associd; +- int sd; +-} sctp_peeloff_arg_t; +- +-typedef struct { +- sctp_peeloff_arg_t p_arg; +- unsigned flags; +-} sctp_peeloff_flags_arg_t; +- +-/* +- * Peer Address Thresholds socket option +- */ +-struct sctp_paddrthlds { +- sctp_assoc_t spt_assoc_id; +- struct sockaddr_storage spt_address; +- __u16 spt_pathmaxrxt; +- __u16 spt_pathpfthld; +-}; +- +-/* +- * Socket Option for Getting the Association/Stream-Specific PR-SCTP Status +- */ +-struct sctp_prstatus { +- sctp_assoc_t sprstat_assoc_id; +- __u16 sprstat_sid; +- __u16 sprstat_policy; +- __u64 sprstat_abandoned_unsent; +- __u64 sprstat_abandoned_sent; +-}; +- +-struct sctp_default_prinfo { +- sctp_assoc_t pr_assoc_id; +- __u32 pr_value; +- __u16 pr_policy; +-}; +- +-struct sctp_info { +- __u32 sctpi_tag; +- __u32 sctpi_state; +- __u32 sctpi_rwnd; +- __u16 sctpi_unackdata; +- __u16 sctpi_penddata; +- __u16 sctpi_instrms; +- __u16 sctpi_outstrms; +- __u32 sctpi_fragmentation_point; +- __u32 sctpi_inqueue; +- __u32 sctpi_outqueue; +- __u32 sctpi_overall_error; +- __u32 sctpi_max_burst; +- __u32 sctpi_maxseg; +- __u32 sctpi_peer_rwnd; +- __u32 sctpi_peer_tag; +- __u8 sctpi_peer_capable; +- __u8 sctpi_peer_sack; +- __u16 __reserved1; +- +- /* assoc status info */ +- __u64 sctpi_isacks; +- __u64 sctpi_osacks; +- __u64 sctpi_opackets; +- __u64 sctpi_ipackets; +- __u64 sctpi_rtxchunks; +- __u64 sctpi_outofseqtsns; +- __u64 sctpi_idupchunks; +- __u64 sctpi_gapcnt; +- __u64 sctpi_ouodchunks; +- __u64 sctpi_iuodchunks; +- __u64 sctpi_oodchunks; +- __u64 sctpi_iodchunks; +- __u64 sctpi_octrlchunks; +- __u64 sctpi_ictrlchunks; +- +- /* primary transport info */ +- struct sockaddr_storage sctpi_p_address; +- __s32 sctpi_p_state; +- __u32 sctpi_p_cwnd; +- __u32 sctpi_p_srtt; +- __u32 sctpi_p_rto; +- __u32 sctpi_p_hbinterval; +- __u32 sctpi_p_pathmaxrxt; +- __u32 sctpi_p_sackdelay; +- __u32 sctpi_p_sackfreq; +- __u32 sctpi_p_ssthresh; +- __u32 sctpi_p_partial_bytes_acked; +- __u32 sctpi_p_flight_size; +- __u16 sctpi_p_error; +- __u16 __reserved2; +- +- /* sctp sock info */ +- __u32 sctpi_s_autoclose; +- __u32 sctpi_s_adaptation_ind; +- __u32 sctpi_s_pd_point; +- __u8 sctpi_s_nodelay; +- __u8 sctpi_s_disable_fragments; +- __u8 sctpi_s_v4mapped; +- __u8 sctpi_s_frag_interleave; +- __u32 sctpi_s_type; +- __u32 __reserved3; +-}; +- +-struct sctp_reset_streams { +- sctp_assoc_t srs_assoc_id; +- uint16_t srs_flags; +- uint16_t srs_number_streams; /* 0 == ALL */ +- uint16_t srs_stream_list[]; /* list if srs_num_streams is not 0 */ +-}; +- +-struct sctp_add_streams { +- sctp_assoc_t sas_assoc_id; +- uint16_t sas_instrms; +- uint16_t sas_outstrms; +-}; +- +-#endif /* _SCTP_H */ +diff --git a/include/linux/seg6.h b/include/linux/seg6.h +deleted file mode 100644 +index 0715279..0000000 +--- a/include/linux/seg6.h ++++ /dev/null +@@ -1,54 +0,0 @@ +-/* +- * SR-IPv6 implementation +- * +- * Author: +- * David Lebrun +- * +- * +- * This program is free software; you can redistribute it and/or +- * modify it under the terms of the GNU General Public License +- * as published by the Free Software Foundation; either version +- * 2 of the License, or (at your option) any later version. +- */ +- +-#ifndef _LINUX_SEG6_H +-#define _LINUX_SEG6_H +- +-#include +-#include /* For struct in6_addr. */ +- +-/* +- * SRH +- */ +-struct ipv6_sr_hdr { +- __u8 nexthdr; +- __u8 hdrlen; +- __u8 type; +- __u8 segments_left; +- __u8 first_segment; +- __u8 flags; +- __u16 reserved; +- +- struct in6_addr segments[0]; +-}; +- +-#define SR6_FLAG1_PROTECTED (1 << 6) +-#define SR6_FLAG1_OAM (1 << 5) +-#define SR6_FLAG1_ALERT (1 << 4) +-#define SR6_FLAG1_HMAC (1 << 3) +- +-#define SR6_TLV_INGRESS 1 +-#define SR6_TLV_EGRESS 2 +-#define SR6_TLV_OPAQUE 3 +-#define SR6_TLV_PADDING 4 +-#define SR6_TLV_HMAC 5 +- +-#define sr_has_hmac(srh) ((srh)->flags & SR6_FLAG1_HMAC) +- +-struct sr6_tlv { +- __u8 type; +- __u8 len; +- __u8 data[0]; +-}; +- +-#endif +diff --git a/include/linux/seg6_genl.h b/include/linux/seg6_genl.h +deleted file mode 100644 +index 99382f9..0000000 +--- a/include/linux/seg6_genl.h ++++ /dev/null +@@ -1,32 +0,0 @@ +-#ifndef _LINUX_SEG6_GENL_H +-#define _LINUX_SEG6_GENL_H +- +-#define SEG6_GENL_NAME "SEG6" +-#define SEG6_GENL_VERSION 0x1 +- +-enum { +- SEG6_ATTR_UNSPEC, +- SEG6_ATTR_DST, +- SEG6_ATTR_DSTLEN, +- SEG6_ATTR_HMACKEYID, +- SEG6_ATTR_SECRET, +- SEG6_ATTR_SECRETLEN, +- SEG6_ATTR_ALGID, +- SEG6_ATTR_HMACINFO, +- __SEG6_ATTR_MAX, +-}; +- +-#define SEG6_ATTR_MAX (__SEG6_ATTR_MAX - 1) +- +-enum { +- SEG6_CMD_UNSPEC, +- SEG6_CMD_SETHMAC, +- SEG6_CMD_DUMPHMAC, +- SEG6_CMD_SET_TUNSRC, +- SEG6_CMD_GET_TUNSRC, +- __SEG6_CMD_MAX, +-}; +- +-#define SEG6_CMD_MAX (__SEG6_CMD_MAX - 1) +- +-#endif +diff --git a/include/linux/seg6_hmac.h b/include/linux/seg6_hmac.h +deleted file mode 100644 +index 704f93e..0000000 +--- a/include/linux/seg6_hmac.h ++++ /dev/null +@@ -1,22 +0,0 @@ +-#ifndef _LINUX_SEG6_HMAC_H +-#define _LINUX_SEG6_HMAC_H +- +-#include +-#include +- +-#define SEG6_HMAC_SECRET_LEN 64 +-#define SEG6_HMAC_FIELD_LEN 32 +- +-struct sr6_tlv_hmac { +- struct sr6_tlv tlvhdr; +- __u16 reserved; +- __be32 hmackeyid; +- __u8 hmac[SEG6_HMAC_FIELD_LEN]; +-}; +- +-enum { +- SEG6_HMAC_ALGO_SHA1 = 1, +- SEG6_HMAC_ALGO_SHA256 = 2, +-}; +- +-#endif +diff --git a/include/linux/seg6_iptunnel.h b/include/linux/seg6_iptunnel.h +deleted file mode 100644 +index a5dc05a..0000000 +--- a/include/linux/seg6_iptunnel.h ++++ /dev/null +@@ -1,40 +0,0 @@ +-/* +- * SR-IPv6 implementation +- * +- * Author: +- * David Lebrun +- * +- * +- * This program is free software; you can redistribute it and/or +- * modify it under the terms of the GNU General Public License +- * as published by the Free Software Foundation; either version +- * 2 of the License, or (at your option) any later version. +- */ +- +-#ifndef _LINUX_SEG6_IPTUNNEL_H +-#define _LINUX_SEG6_IPTUNNEL_H +- +-#include /* For struct ipv6_sr_hdr. */ +- +-enum { +- SEG6_IPTUNNEL_UNSPEC, +- SEG6_IPTUNNEL_SRH, +- __SEG6_IPTUNNEL_MAX, +-}; +-#define SEG6_IPTUNNEL_MAX (__SEG6_IPTUNNEL_MAX - 1) +- +-struct seg6_iptunnel_encap { +- int mode; +- struct ipv6_sr_hdr srh[0]; +-}; +- +-#define SEG6_IPTUN_ENCAP_SIZE(x) ((sizeof(*x)) + (((x)->srh->hdrlen + 1) << 3)) +- +-enum { +- SEG6_IPTUN_MODE_INLINE, +- SEG6_IPTUN_MODE_ENCAP, +- SEG6_IPTUN_MODE_L2ENCAP, +-}; +- +- +-#endif +diff --git a/include/linux/seg6_local.h b/include/linux/seg6_local.h +deleted file mode 100644 +index 76b90d6..0000000 +--- a/include/linux/seg6_local.h ++++ /dev/null +@@ -1,68 +0,0 @@ +-/* +- * SR-IPv6 implementation +- * +- * Author: +- * David Lebrun +- * +- * +- * This program is free software; you can redistribute it and/or +- * modify it under the terms of the GNU General Public License +- * as published by the Free Software Foundation; either version +- * 2 of the License, or (at your option) any later version. +- */ +- +-#ifndef _LINUX_SEG6_LOCAL_H +-#define _LINUX_SEG6_LOCAL_H +- +-#include +- +-enum { +- SEG6_LOCAL_UNSPEC, +- SEG6_LOCAL_ACTION, +- SEG6_LOCAL_SRH, +- SEG6_LOCAL_TABLE, +- SEG6_LOCAL_NH4, +- SEG6_LOCAL_NH6, +- SEG6_LOCAL_IIF, +- SEG6_LOCAL_OIF, +- __SEG6_LOCAL_MAX, +-}; +-#define SEG6_LOCAL_MAX (__SEG6_LOCAL_MAX - 1) +- +-enum { +- SEG6_LOCAL_ACTION_UNSPEC = 0, +- /* node segment */ +- SEG6_LOCAL_ACTION_END = 1, +- /* adjacency segment (IPv6 cross-connect) */ +- SEG6_LOCAL_ACTION_END_X = 2, +- /* lookup of next seg NH in table */ +- SEG6_LOCAL_ACTION_END_T = 3, +- /* decap and L2 cross-connect */ +- SEG6_LOCAL_ACTION_END_DX2 = 4, +- /* decap and IPv6 cross-connect */ +- SEG6_LOCAL_ACTION_END_DX6 = 5, +- /* decap and IPv4 cross-connect */ +- SEG6_LOCAL_ACTION_END_DX4 = 6, +- /* decap and lookup of DA in v6 table */ +- SEG6_LOCAL_ACTION_END_DT6 = 7, +- /* decap and lookup of DA in v4 table */ +- SEG6_LOCAL_ACTION_END_DT4 = 8, +- /* binding segment with insertion */ +- SEG6_LOCAL_ACTION_END_B6 = 9, +- /* binding segment with encapsulation */ +- SEG6_LOCAL_ACTION_END_B6_ENCAP = 10, +- /* binding segment with MPLS encap */ +- SEG6_LOCAL_ACTION_END_BM = 11, +- /* lookup last seg in table */ +- SEG6_LOCAL_ACTION_END_S = 12, +- /* forward to SR-unaware VNF with static proxy */ +- SEG6_LOCAL_ACTION_END_AS = 13, +- /* forward to SR-unaware VNF with masquerading */ +- SEG6_LOCAL_ACTION_END_AM = 14, +- +- __SEG6_LOCAL_ACTION_MAX, +-}; +- +-#define SEG6_LOCAL_ACTION_MAX (__SEG6_LOCAL_ACTION_MAX - 1) +- +-#endif +diff --git a/include/linux/sock_diag.h b/include/linux/sock_diag.h +deleted file mode 100644 +index 901231e..0000000 +--- a/include/linux/sock_diag.h ++++ /dev/null +@@ -1,38 +0,0 @@ +-#ifndef __SOCK_DIAG_H__ +-#define __SOCK_DIAG_H__ +- +-#include +- +-#define SOCK_DIAG_BY_FAMILY 20 +-#define SOCK_DESTROY 21 +- +-struct sock_diag_req { +- __u8 sdiag_family; +- __u8 sdiag_protocol; +-}; +- +-enum { +- SK_MEMINFO_RMEM_ALLOC, +- SK_MEMINFO_RCVBUF, +- SK_MEMINFO_WMEM_ALLOC, +- SK_MEMINFO_SNDBUF, +- SK_MEMINFO_FWD_ALLOC, +- SK_MEMINFO_WMEM_QUEUED, +- SK_MEMINFO_OPTMEM, +- SK_MEMINFO_BACKLOG, +- SK_MEMINFO_DROPS, +- +- SK_MEMINFO_VARS, +-}; +- +-enum sknetlink_groups { +- SKNLGRP_NONE, +- SKNLGRP_INET_TCP_DESTROY, +- SKNLGRP_INET_UDP_DESTROY, +- SKNLGRP_INET6_TCP_DESTROY, +- SKNLGRP_INET6_UDP_DESTROY, +- __SKNLGRP_MAX, +-}; +-#define SKNLGRP_MAX (__SKNLGRP_MAX - 1) +- +-#endif /* __SOCK_DIAG_H__ */ +diff --git a/include/linux/socket.h b/include/linux/socket.h +deleted file mode 100644 +index 8c1e501..0000000 +--- a/include/linux/socket.h ++++ /dev/null +@@ -1,21 +0,0 @@ +-#ifndef _LINUX_SOCKET_H +-#define _LINUX_SOCKET_H +- +-/* +- * 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; +- +-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)]; +- /* space to achieve desired size, */ +- /* _SS_MAXSIZE value minus size of ss_family */ +-} __attribute__ ((aligned(_K_SS_ALIGNSIZE))); /* force desired alignment */ +- +-#endif /* _LINUX_SOCKET_H */ +diff --git a/include/linux/sockios.h b/include/linux/sockios.h +deleted file mode 100644 +index 79d029d..0000000 +--- a/include/linux/sockios.h ++++ /dev/null +@@ -1,152 +0,0 @@ +-/* +- * INET An implementation of the TCP/IP protocol suite for the LINUX +- * operating system. INET is implemented using the BSD Socket +- * interface as the means of communication with the user level. +- * +- * Definitions of the socket-level I/O control calls. +- * +- * Version: @(#)sockios.h 1.0.2 03/09/93 +- * +- * Authors: Ross Biro +- * Fred N. van Kempen, +- * +- * This program is free software; you can redistribute it and/or +- * modify it under the terms of the GNU General Public License +- * as published by the Free Software Foundation; either version +- * 2 of the License, or (at your option) any later version. +- */ +-#ifndef _LINUX_SOCKIOS_H +-#define _LINUX_SOCKIOS_H +- +-#include +- +-/* Linux-specific socket ioctls */ +-#define SIOCINQ FIONREAD +-#define SIOCOUTQ TIOCOUTQ /* output queue size (not sent + not acked) */ +- +-#define SOCK_IOC_TYPE 0x89 +- +-/* Routing table calls. */ +-#define SIOCADDRT 0x890B /* add routing table entry */ +-#define SIOCDELRT 0x890C /* delete routing table entry */ +-#define SIOCRTMSG 0x890D /* unused */ +- +-/* Socket configuration controls. */ +-#define SIOCGIFNAME 0x8910 /* get iface name */ +-#define SIOCSIFLINK 0x8911 /* set iface channel */ +-#define SIOCGIFCONF 0x8912 /* get iface list */ +-#define SIOCGIFFLAGS 0x8913 /* get flags */ +-#define SIOCSIFFLAGS 0x8914 /* set flags */ +-#define SIOCGIFADDR 0x8915 /* get PA address */ +-#define SIOCSIFADDR 0x8916 /* set PA address */ +-#define SIOCGIFDSTADDR 0x8917 /* get remote PA address */ +-#define SIOCSIFDSTADDR 0x8918 /* set remote PA address */ +-#define SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */ +-#define SIOCSIFBRDADDR 0x891a /* set broadcast PA address */ +-#define SIOCGIFNETMASK 0x891b /* get network PA mask */ +-#define SIOCSIFNETMASK 0x891c /* set network PA mask */ +-#define SIOCGIFMETRIC 0x891d /* get metric */ +-#define SIOCSIFMETRIC 0x891e /* set metric */ +-#define SIOCGIFMEM 0x891f /* get memory address (BSD) */ +-#define SIOCSIFMEM 0x8920 /* set memory address (BSD) */ +-#define SIOCGIFMTU 0x8921 /* get MTU size */ +-#define SIOCSIFMTU 0x8922 /* set MTU size */ +-#define SIOCSIFNAME 0x8923 /* set interface name */ +-#define SIOCSIFHWADDR 0x8924 /* set hardware address */ +-#define SIOCGIFENCAP 0x8925 /* get/set encapsulations */ +-#define SIOCSIFENCAP 0x8926 +-#define SIOCGIFHWADDR 0x8927 /* Get hardware address */ +-#define SIOCGIFSLAVE 0x8929 /* Driver slaving support */ +-#define SIOCSIFSLAVE 0x8930 +-#define SIOCADDMULTI 0x8931 /* Multicast address lists */ +-#define SIOCDELMULTI 0x8932 +-#define SIOCGIFINDEX 0x8933 /* name -> if_index mapping */ +-#define SIOGIFINDEX SIOCGIFINDEX /* misprint compatibility :-) */ +-#define SIOCSIFPFLAGS 0x8934 /* set/get extended flags set */ +-#define SIOCGIFPFLAGS 0x8935 +-#define SIOCDIFADDR 0x8936 /* delete PA address */ +-#define SIOCSIFHWBROADCAST 0x8937 /* set hardware broadcast addr */ +-#define SIOCGIFCOUNT 0x8938 /* get number of devices */ +- +-#define SIOCGIFBR 0x8940 /* Bridging support */ +-#define SIOCSIFBR 0x8941 /* Set bridging options */ +- +-#define SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */ +-#define SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */ +- +-/* SIOCGIFDIVERT was: 0x8944 Frame diversion support */ +-/* SIOCSIFDIVERT was: 0x8945 Set frame diversion options */ +- +-#define SIOCETHTOOL 0x8946 /* Ethtool interface */ +- +-#define SIOCGMIIPHY 0x8947 /* Get address of MII PHY in use. */ +-#define SIOCGMIIREG 0x8948 /* Read MII PHY register. */ +-#define SIOCSMIIREG 0x8949 /* Write MII PHY register. */ +- +-#define SIOCWANDEV 0x894A /* get/set netdev parameters */ +- +-#define SIOCOUTQNSD 0x894B /* output queue size (not sent only) */ +-#define SIOCGSKNS 0x894C /* get socket network namespace */ +- +-/* ARP cache control calls. */ +- /* 0x8950 - 0x8952 * obsolete calls, don't re-use */ +-#define SIOCDARP 0x8953 /* delete ARP table entry */ +-#define SIOCGARP 0x8954 /* get ARP table entry */ +-#define SIOCSARP 0x8955 /* set ARP table entry */ +- +-/* RARP cache control calls. */ +-#define SIOCDRARP 0x8960 /* delete RARP table entry */ +-#define SIOCGRARP 0x8961 /* get RARP table entry */ +-#define SIOCSRARP 0x8962 /* set RARP table entry */ +- +-/* Driver configuration calls */ +- +-#define SIOCGIFMAP 0x8970 /* Get device parameters */ +-#define SIOCSIFMAP 0x8971 /* Set device parameters */ +- +-/* DLCI configuration calls */ +- +-#define SIOCADDDLCI 0x8980 /* Create new DLCI device */ +-#define SIOCDELDLCI 0x8981 /* Delete DLCI device */ +- +-#define SIOCGIFVLAN 0x8982 /* 802.1Q VLAN support */ +-#define SIOCSIFVLAN 0x8983 /* Set 802.1Q VLAN options */ +- +-/* bonding calls */ +- +-#define SIOCBONDENSLAVE 0x8990 /* enslave a device to the bond */ +-#define SIOCBONDRELEASE 0x8991 /* release a slave from the bond*/ +-#define SIOCBONDSETHWADDR 0x8992 /* set the hw addr of the bond */ +-#define SIOCBONDSLAVEINFOQUERY 0x8993 /* rtn info about slave state */ +-#define SIOCBONDINFOQUERY 0x8994 /* rtn info about bond state */ +-#define SIOCBONDCHANGEACTIVE 0x8995 /* update to a new active slave */ +- +-/* bridge calls */ +-#define SIOCBRADDBR 0x89a0 /* create new bridge device */ +-#define SIOCBRDELBR 0x89a1 /* remove bridge device */ +-#define SIOCBRADDIF 0x89a2 /* add interface to bridge */ +-#define SIOCBRDELIF 0x89a3 /* remove interface from bridge */ +- +-/* hardware time stamping: parameters in linux/net_tstamp.h */ +-#define SIOCSHWTSTAMP 0x89b0 /* set and get config */ +-#define SIOCGHWTSTAMP 0x89b1 /* get config */ +- +-/* Device private ioctl calls */ +- +-/* +- * These 16 ioctls are available to devices via the do_ioctl() device +- * vector. Each device should include this file and redefine these names +- * as their own. Because these are device dependent it is a good idea +- * _NOT_ to issue them to random objects and hope. +- * +- * THESE IOCTLS ARE _DEPRECATED_ AND WILL DISAPPEAR IN 2.5.X -DaveM +- */ +- +-#define SIOCDEVPRIVATE 0x89F0 /* to 89FF */ +- +-/* +- * These 16 ioctl calls are protocol private +- */ +- +-#define SIOCPROTOPRIVATE 0x89E0 /* to 89EF */ +-#endif /* _LINUX_SOCKIOS_H */ +diff --git a/include/linux/stddef.h b/include/linux/stddef.h +deleted file mode 100644 +index 4bb69de..0000000 +--- a/include/linux/stddef.h ++++ /dev/null +@@ -1,5 +0,0 @@ +- +- +-#ifndef __always_inline +-#define __always_inline __inline__ +-#endif +diff --git a/include/linux/sysinfo.h b/include/linux/sysinfo.h +deleted file mode 100644 +index 934335a..0000000 +--- a/include/linux/sysinfo.h ++++ /dev/null +@@ -1,24 +0,0 @@ +-#ifndef _LINUX_SYSINFO_H +-#define _LINUX_SYSINFO_H +- +-#include +- +-#define SI_LOAD_SHIFT 16 +-struct sysinfo { +- __kernel_long_t uptime; /* Seconds since boot */ +- __kernel_ulong_t loads[3]; /* 1, 5, and 15 minute load averages */ +- __kernel_ulong_t totalram; /* Total usable main memory size */ +- __kernel_ulong_t freeram; /* Available memory size */ +- __kernel_ulong_t sharedram; /* Amount of shared memory */ +- __kernel_ulong_t bufferram; /* Memory used by buffers */ +- __kernel_ulong_t totalswap; /* Total swap space size */ +- __kernel_ulong_t freeswap; /* swap space still available */ +- __u16 procs; /* Number of current processes */ +- __u16 pad; /* Explicit padding for m68k */ +- __kernel_ulong_t totalhigh; /* Total high memory size */ +- __kernel_ulong_t freehigh; /* Available high memory size */ +- __u32 mem_unit; /* Memory unit size in bytes */ +- char _f[20-2*sizeof(__kernel_ulong_t)-sizeof(__u32)]; /* Padding: libc5 uses this.. */ +-}; +- +-#endif /* _LINUX_SYSINFO_H */ +diff --git a/include/linux/tc_act/tc_bpf.h b/include/linux/tc_act/tc_bpf.h +deleted file mode 100644 +index 8dc2ac0..0000000 +--- a/include/linux/tc_act/tc_bpf.h ++++ /dev/null +@@ -1,36 +0,0 @@ +-/* +- * Copyright (c) 2015 Jiri Pirko +- * +- * This program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2 of the License, or +- * (at your option) any later version. +- */ +- +-#ifndef __LINUX_TC_BPF_H +-#define __LINUX_TC_BPF_H +- +-#include +- +-#define TCA_ACT_BPF 13 +- +-struct tc_act_bpf { +- tc_gen; +-}; +- +-enum { +- TCA_ACT_BPF_UNSPEC, +- TCA_ACT_BPF_TM, +- TCA_ACT_BPF_PARMS, +- TCA_ACT_BPF_OPS_LEN, +- TCA_ACT_BPF_OPS, +- TCA_ACT_BPF_FD, +- TCA_ACT_BPF_NAME, +- TCA_ACT_BPF_PAD, +- TCA_ACT_BPF_TAG, +- TCA_ACT_BPF_ID, +- __TCA_ACT_BPF_MAX, +-}; +-#define TCA_ACT_BPF_MAX (__TCA_ACT_BPF_MAX - 1) +- +-#endif +diff --git a/include/linux/tc_act/tc_connmark.h b/include/linux/tc_act/tc_connmark.h +deleted file mode 100644 +index 62a5e94..0000000 +--- a/include/linux/tc_act/tc_connmark.h ++++ /dev/null +@@ -1,23 +0,0 @@ +-#ifndef __UAPI_TC_CONNMARK_H +-#define __UAPI_TC_CONNMARK_H +- +-#include +-#include +- +-#define TCA_ACT_CONNMARK 14 +- +-struct tc_connmark { +- tc_gen; +- __u16 zone; +-}; +- +-enum { +- TCA_CONNMARK_UNSPEC, +- TCA_CONNMARK_PARMS, +- TCA_CONNMARK_TM, +- TCA_CONNMARK_PAD, +- __TCA_CONNMARK_MAX +-}; +-#define TCA_CONNMARK_MAX (__TCA_CONNMARK_MAX - 1) +- +-#endif +diff --git a/include/linux/tc_act/tc_csum.h b/include/linux/tc_act/tc_csum.h +deleted file mode 100644 +index a11bb35..0000000 +--- a/include/linux/tc_act/tc_csum.h ++++ /dev/null +@@ -1,34 +0,0 @@ +-#ifndef __LINUX_TC_CSUM_H +-#define __LINUX_TC_CSUM_H +- +-#include +-#include +- +-#define TCA_ACT_CSUM 16 +- +-enum { +- TCA_CSUM_UNSPEC, +- TCA_CSUM_PARMS, +- TCA_CSUM_TM, +- TCA_CSUM_PAD, +- __TCA_CSUM_MAX +-}; +-#define TCA_CSUM_MAX (__TCA_CSUM_MAX - 1) +- +-enum { +- TCA_CSUM_UPDATE_FLAG_IPV4HDR = 1, +- TCA_CSUM_UPDATE_FLAG_ICMP = 2, +- TCA_CSUM_UPDATE_FLAG_IGMP = 4, +- TCA_CSUM_UPDATE_FLAG_TCP = 8, +- TCA_CSUM_UPDATE_FLAG_UDP = 16, +- TCA_CSUM_UPDATE_FLAG_UDPLITE = 32, +- TCA_CSUM_UPDATE_FLAG_SCTP = 64, +-}; +- +-struct tc_csum { +- tc_gen; +- +- __u32 update_flags; +-}; +- +-#endif /* __LINUX_TC_CSUM_H */ +diff --git a/include/linux/tc_act/tc_defact.h b/include/linux/tc_act/tc_defact.h +deleted file mode 100644 +index d2a3abb..0000000 +--- a/include/linux/tc_act/tc_defact.h ++++ /dev/null +@@ -1,20 +0,0 @@ +-#ifndef __LINUX_TC_DEF_H +-#define __LINUX_TC_DEF_H +- +-#include +- +-struct tc_defact { +- tc_gen; +-}; +- +-enum { +- TCA_DEF_UNSPEC, +- TCA_DEF_TM, +- TCA_DEF_PARMS, +- TCA_DEF_DATA, +- TCA_DEF_PAD, +- __TCA_DEF_MAX +-}; +-#define TCA_DEF_MAX (__TCA_DEF_MAX - 1) +- +-#endif +diff --git a/include/linux/tc_act/tc_gact.h b/include/linux/tc_act/tc_gact.h +deleted file mode 100644 +index 70b536a..0000000 +--- a/include/linux/tc_act/tc_gact.h ++++ /dev/null +@@ -1,33 +0,0 @@ +-#ifndef __LINUX_TC_GACT_H +-#define __LINUX_TC_GACT_H +- +-#include +-#include +- +-#define TCA_ACT_GACT 5 +-struct tc_gact { +- tc_gen; +- +-}; +- +-struct tc_gact_p { +-#define PGACT_NONE 0 +-#define PGACT_NETRAND 1 +-#define PGACT_DETERM 2 +-#define MAX_RAND (PGACT_DETERM + 1 ) +- __u16 ptype; +- __u16 pval; +- int paction; +-}; +- +-enum { +- TCA_GACT_UNSPEC, +- TCA_GACT_TM, +- TCA_GACT_PARMS, +- TCA_GACT_PROB, +- TCA_GACT_PAD, +- __TCA_GACT_MAX +-}; +-#define TCA_GACT_MAX (__TCA_GACT_MAX - 1) +- +-#endif +diff --git a/include/linux/tc_act/tc_ife.h b/include/linux/tc_act/tc_ife.h +deleted file mode 100644 +index 7c28178..0000000 +--- a/include/linux/tc_act/tc_ife.h ++++ /dev/null +@@ -1,32 +0,0 @@ +-#ifndef __UAPI_TC_IFE_H +-#define __UAPI_TC_IFE_H +- +-#include +-#include +-#include +- +-#define TCA_ACT_IFE 25 +-/* Flag bits for now just encoding/decoding; mutually exclusive */ +-#define IFE_ENCODE 1 +-#define IFE_DECODE 0 +- +-struct tc_ife { +- tc_gen; +- __u16 flags; +-}; +- +-/*XXX: We need to encode the total number of bytes consumed */ +-enum { +- TCA_IFE_UNSPEC, +- TCA_IFE_PARMS, +- TCA_IFE_TM, +- TCA_IFE_DMAC, +- TCA_IFE_SMAC, +- TCA_IFE_TYPE, +- TCA_IFE_METALST, +- TCA_IFE_PAD, +- __TCA_IFE_MAX +-}; +-#define TCA_IFE_MAX (__TCA_IFE_MAX - 1) +- +-#endif +diff --git a/include/linux/tc_act/tc_ipt.h b/include/linux/tc_act/tc_ipt.h +deleted file mode 100644 +index 7c6e155..0000000 +--- a/include/linux/tc_act/tc_ipt.h ++++ /dev/null +@@ -1,22 +0,0 @@ +-#ifndef __LINUX_TC_IPT_H +-#define __LINUX_TC_IPT_H +- +-#include +- +-#define TCA_ACT_IPT 6 +-#define TCA_ACT_XT 10 +- +-enum { +- TCA_IPT_UNSPEC, +- TCA_IPT_TABLE, +- TCA_IPT_HOOK, +- TCA_IPT_INDEX, +- TCA_IPT_CNT, +- TCA_IPT_TM, +- TCA_IPT_TARG, +- TCA_IPT_PAD, +- __TCA_IPT_MAX +-}; +-#define TCA_IPT_MAX (__TCA_IPT_MAX - 1) +- +-#endif +diff --git a/include/linux/tc_act/tc_mirred.h b/include/linux/tc_act/tc_mirred.h +deleted file mode 100644 +index 3d7a2b3..0000000 +--- a/include/linux/tc_act/tc_mirred.h ++++ /dev/null +@@ -1,28 +0,0 @@ +-#ifndef __LINUX_TC_MIR_H +-#define __LINUX_TC_MIR_H +- +-#include +-#include +- +-#define TCA_ACT_MIRRED 8 +-#define TCA_EGRESS_REDIR 1 /* packet redirect to EGRESS*/ +-#define TCA_EGRESS_MIRROR 2 /* mirror packet to EGRESS */ +-#define TCA_INGRESS_REDIR 3 /* packet redirect to INGRESS*/ +-#define TCA_INGRESS_MIRROR 4 /* mirror packet to INGRESS */ +- +-struct tc_mirred { +- tc_gen; +- int eaction; /* one of IN/EGRESS_MIRROR/REDIR */ +- __u32 ifindex; /* ifindex of egress port */ +-}; +- +-enum { +- TCA_MIRRED_UNSPEC, +- TCA_MIRRED_TM, +- TCA_MIRRED_PARMS, +- TCA_MIRRED_PAD, +- __TCA_MIRRED_MAX +-}; +-#define TCA_MIRRED_MAX (__TCA_MIRRED_MAX - 1) +- +-#endif +diff --git a/include/linux/tc_act/tc_nat.h b/include/linux/tc_act/tc_nat.h +deleted file mode 100644 +index 923457c..0000000 +--- a/include/linux/tc_act/tc_nat.h ++++ /dev/null +@@ -1,28 +0,0 @@ +-#ifndef __LINUX_TC_NAT_H +-#define __LINUX_TC_NAT_H +- +-#include +-#include +- +-#define TCA_ACT_NAT 9 +- +-enum { +- TCA_NAT_UNSPEC, +- TCA_NAT_PARMS, +- TCA_NAT_TM, +- TCA_NAT_PAD, +- __TCA_NAT_MAX +-}; +-#define TCA_NAT_MAX (__TCA_NAT_MAX - 1) +- +-#define TCA_NAT_FLAG_EGRESS 1 +- +-struct tc_nat { +- tc_gen; +- __be32 old_addr; +- __be32 new_addr; +- __be32 mask; +- __u32 flags; +-}; +- +-#endif +diff --git a/include/linux/tc_act/tc_pedit.h b/include/linux/tc_act/tc_pedit.h +deleted file mode 100644 +index 143d2b3..0000000 +--- a/include/linux/tc_act/tc_pedit.h ++++ /dev/null +@@ -1,66 +0,0 @@ +-#ifndef __LINUX_TC_PED_H +-#define __LINUX_TC_PED_H +- +-#include +-#include +- +-#define TCA_ACT_PEDIT 7 +- +-enum { +- TCA_PEDIT_UNSPEC, +- TCA_PEDIT_TM, +- TCA_PEDIT_PARMS, +- TCA_PEDIT_PAD, +- TCA_PEDIT_PARMS_EX, +- TCA_PEDIT_KEYS_EX, +- TCA_PEDIT_KEY_EX, +- __TCA_PEDIT_MAX +-}; +-#define TCA_PEDIT_MAX (__TCA_PEDIT_MAX - 1) +- +-enum { +- TCA_PEDIT_KEY_EX_HTYPE = 1, +- TCA_PEDIT_KEY_EX_CMD = 2, +- __TCA_PEDIT_KEY_EX_MAX +-}; +-#define TCA_PEDIT_KEY_EX_MAX (__TCA_PEDIT_KEY_EX_MAX - 1) +- +- /* TCA_PEDIT_KEY_EX_HDR_TYPE_NETWROK is a special case for legacy users. It +- * means no specific header type - offset is relative to the network layer +- */ +-enum pedit_header_type { +- TCA_PEDIT_KEY_EX_HDR_TYPE_NETWORK = 0, +- TCA_PEDIT_KEY_EX_HDR_TYPE_ETH = 1, +- TCA_PEDIT_KEY_EX_HDR_TYPE_IP4 = 2, +- TCA_PEDIT_KEY_EX_HDR_TYPE_IP6 = 3, +- TCA_PEDIT_KEY_EX_HDR_TYPE_TCP = 4, +- TCA_PEDIT_KEY_EX_HDR_TYPE_UDP = 5, +- __PEDIT_HDR_TYPE_MAX, +-}; +-#define TCA_PEDIT_HDR_TYPE_MAX (__PEDIT_HDR_TYPE_MAX - 1) +- +-enum pedit_cmd { +- TCA_PEDIT_KEY_EX_CMD_SET = 0, +- TCA_PEDIT_KEY_EX_CMD_ADD = 1, +- __PEDIT_CMD_MAX, +-}; +-#define TCA_PEDIT_CMD_MAX (__PEDIT_CMD_MAX - 1) +- +-struct tc_pedit_key { +- __u32 mask; /* AND */ +- __u32 val; /*XOR */ +- __u32 off; /*offset */ +- __u32 at; +- __u32 offmask; +- __u32 shift; +-}; +- +-struct tc_pedit_sel { +- tc_gen; +- unsigned char nkeys; +- unsigned char flags; +- struct tc_pedit_key keys[0]; +-}; +-#define tc_pedit tc_pedit_sel +- +-#endif +diff --git a/include/linux/tc_act/tc_sample.h b/include/linux/tc_act/tc_sample.h +deleted file mode 100644 +index edc9058..0000000 +--- a/include/linux/tc_act/tc_sample.h ++++ /dev/null +@@ -1,26 +0,0 @@ +-#ifndef __LINUX_TC_SAMPLE_H +-#define __LINUX_TC_SAMPLE_H +- +-#include +-#include +-#include +- +-#define TCA_ACT_SAMPLE 26 +- +-struct tc_sample { +- tc_gen; +-}; +- +-enum { +- TCA_SAMPLE_UNSPEC, +- TCA_SAMPLE_TM, +- TCA_SAMPLE_PARMS, +- TCA_SAMPLE_RATE, +- TCA_SAMPLE_TRUNC_SIZE, +- TCA_SAMPLE_PSAMPLE_GROUP, +- TCA_SAMPLE_PAD, +- __TCA_SAMPLE_MAX +-}; +-#define TCA_SAMPLE_MAX (__TCA_SAMPLE_MAX - 1) +- +-#endif +diff --git a/include/linux/tc_act/tc_skbedit.h b/include/linux/tc_act/tc_skbedit.h +deleted file mode 100644 +index 2884425..0000000 +--- a/include/linux/tc_act/tc_skbedit.h ++++ /dev/null +@@ -1,51 +0,0 @@ +-/* +- * Copyright (c) 2008, Intel Corporation. +- * +- * This program is free software; you can redistribute it and/or modify it +- * under the terms and conditions of the GNU General Public License, +- * version 2, as published by the Free Software Foundation. +- * +- * This program is distributed in the hope it will be useful, but WITHOUT +- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +- * more details. +- * +- * You should have received a copy of the GNU General Public License along with +- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple +- * Place - Suite 330, Boston, MA 02111-1307 USA. +- * +- * Author: Alexander Duyck +- */ +- +-#ifndef __LINUX_TC_SKBEDIT_H +-#define __LINUX_TC_SKBEDIT_H +- +-#include +- +-#define TCA_ACT_SKBEDIT 11 +- +-#define SKBEDIT_F_PRIORITY 0x1 +-#define SKBEDIT_F_QUEUE_MAPPING 0x2 +-#define SKBEDIT_F_MARK 0x4 +-#define SKBEDIT_F_PTYPE 0x8 +-#define SKBEDIT_F_MASK 0x10 +- +-struct tc_skbedit { +- tc_gen; +-}; +- +-enum { +- TCA_SKBEDIT_UNSPEC, +- TCA_SKBEDIT_TM, +- TCA_SKBEDIT_PARMS, +- TCA_SKBEDIT_PRIORITY, +- TCA_SKBEDIT_QUEUE_MAPPING, +- TCA_SKBEDIT_MARK, +- TCA_SKBEDIT_PAD, +- TCA_SKBEDIT_PTYPE, +- TCA_SKBEDIT_MASK, +- __TCA_SKBEDIT_MAX +-}; +-#define TCA_SKBEDIT_MAX (__TCA_SKBEDIT_MAX - 1) +- +-#endif +diff --git a/include/linux/tc_act/tc_skbmod.h b/include/linux/tc_act/tc_skbmod.h +deleted file mode 100644 +index 10fc07d..0000000 +--- a/include/linux/tc_act/tc_skbmod.h ++++ /dev/null +@@ -1,39 +0,0 @@ +-/* +- * Copyright (c) 2016, Jamal Hadi Salim +- * +- * This program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2 of the License, or +- * (at your option) any later version. +-*/ +- +-#ifndef __LINUX_TC_SKBMOD_H +-#define __LINUX_TC_SKBMOD_H +- +-#include +- +-#define TCA_ACT_SKBMOD 15 +- +-#define SKBMOD_F_DMAC 0x1 +-#define SKBMOD_F_SMAC 0x2 +-#define SKBMOD_F_ETYPE 0x4 +-#define SKBMOD_F_SWAPMAC 0x8 +- +-struct tc_skbmod { +- tc_gen; +- __u64 flags; +-}; +- +-enum { +- TCA_SKBMOD_UNSPEC, +- TCA_SKBMOD_TM, +- TCA_SKBMOD_PARMS, +- TCA_SKBMOD_DMAC, +- TCA_SKBMOD_SMAC, +- TCA_SKBMOD_ETYPE, +- TCA_SKBMOD_PAD, +- __TCA_SKBMOD_MAX +-}; +-#define TCA_SKBMOD_MAX (__TCA_SKBMOD_MAX - 1) +- +-#endif +diff --git a/include/linux/tc_act/tc_tunnel_key.h b/include/linux/tc_act/tc_tunnel_key.h +deleted file mode 100644 +index afcd4be..0000000 +--- a/include/linux/tc_act/tc_tunnel_key.h ++++ /dev/null +@@ -1,43 +0,0 @@ +-/* +- * Copyright (c) 2016, Amir Vadai +- * Copyright (c) 2016, Mellanox Technologies. All rights reserved. +- * +- * This program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2 of the License, or +- * (at your option) any later version. +- */ +- +-#ifndef __LINUX_TC_TUNNEL_KEY_H +-#define __LINUX_TC_TUNNEL_KEY_H +- +-#include +- +-#define TCA_ACT_TUNNEL_KEY 17 +- +-#define TCA_TUNNEL_KEY_ACT_SET 1 +-#define TCA_TUNNEL_KEY_ACT_RELEASE 2 +- +-struct tc_tunnel_key { +- tc_gen; +- int t_action; +-}; +- +-enum { +- TCA_TUNNEL_KEY_UNSPEC, +- TCA_TUNNEL_KEY_TM, +- TCA_TUNNEL_KEY_PARMS, +- TCA_TUNNEL_KEY_ENC_IPV4_SRC, /* be32 */ +- TCA_TUNNEL_KEY_ENC_IPV4_DST, /* be32 */ +- TCA_TUNNEL_KEY_ENC_IPV6_SRC, /* struct in6_addr */ +- TCA_TUNNEL_KEY_ENC_IPV6_DST, /* struct in6_addr */ +- TCA_TUNNEL_KEY_ENC_KEY_ID, /* be64 */ +- TCA_TUNNEL_KEY_PAD, +- TCA_TUNNEL_KEY_ENC_DST_PORT, /* be16 */ +- TCA_TUNNEL_KEY_NO_CSUM, /* u8 */ +- __TCA_TUNNEL_KEY_MAX, +-}; +- +-#define TCA_TUNNEL_KEY_MAX (__TCA_TUNNEL_KEY_MAX - 1) +- +-#endif +diff --git a/include/linux/tc_act/tc_vlan.h b/include/linux/tc_act/tc_vlan.h +deleted file mode 100644 +index bddb272..0000000 +--- a/include/linux/tc_act/tc_vlan.h ++++ /dev/null +@@ -1,38 +0,0 @@ +-/* +- * Copyright (c) 2014 Jiri Pirko +- * +- * This program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2 of the License, or +- * (at your option) any later version. +- */ +- +-#ifndef __LINUX_TC_VLAN_H +-#define __LINUX_TC_VLAN_H +- +-#include +- +-#define TCA_ACT_VLAN 12 +- +-#define TCA_VLAN_ACT_POP 1 +-#define TCA_VLAN_ACT_PUSH 2 +-#define TCA_VLAN_ACT_MODIFY 3 +- +-struct tc_vlan { +- tc_gen; +- int v_action; +-}; +- +-enum { +- TCA_VLAN_UNSPEC, +- TCA_VLAN_TM, +- TCA_VLAN_PARMS, +- TCA_VLAN_PUSH_VLAN_ID, +- TCA_VLAN_PUSH_VLAN_PROTOCOL, +- TCA_VLAN_PAD, +- TCA_VLAN_PUSH_VLAN_PRIORITY, +- __TCA_VLAN_MAX, +-}; +-#define TCA_VLAN_MAX (__TCA_VLAN_MAX - 1) +- +-#endif +diff --git a/include/linux/tc_ematch/tc_em_cmp.h b/include/linux/tc_ematch/tc_em_cmp.h +deleted file mode 100644 +index f34bb1b..0000000 +--- a/include/linux/tc_ematch/tc_em_cmp.h ++++ /dev/null +@@ -1,25 +0,0 @@ +-#ifndef __LINUX_TC_EM_CMP_H +-#define __LINUX_TC_EM_CMP_H +- +-#include +-#include +- +-struct tcf_em_cmp { +- __u32 val; +- __u32 mask; +- __u16 off; +- __u8 align:4; +- __u8 flags:4; +- __u8 layer:4; +- __u8 opnd:4; +-}; +- +-enum { +- TCF_EM_ALIGN_U8 = 1, +- TCF_EM_ALIGN_U16 = 2, +- TCF_EM_ALIGN_U32 = 4 +-}; +- +-#define TCF_EM_CMP_TRANS 1 +- +-#endif +diff --git a/include/linux/tc_ematch/tc_em_meta.h b/include/linux/tc_ematch/tc_em_meta.h +deleted file mode 100644 +index b11f8ce..0000000 +--- a/include/linux/tc_ematch/tc_em_meta.h ++++ /dev/null +@@ -1,92 +0,0 @@ +-#ifndef __LINUX_TC_EM_META_H +-#define __LINUX_TC_EM_META_H +- +-#include +-#include +- +-enum { +- TCA_EM_META_UNSPEC, +- TCA_EM_META_HDR, +- TCA_EM_META_LVALUE, +- TCA_EM_META_RVALUE, +- __TCA_EM_META_MAX +-}; +-#define TCA_EM_META_MAX (__TCA_EM_META_MAX - 1) +- +-struct tcf_meta_val { +- __u16 kind; +- __u8 shift; +- __u8 op; +-}; +- +-#define TCF_META_TYPE_MASK (0xf << 12) +-#define TCF_META_TYPE(kind) (((kind) & TCF_META_TYPE_MASK) >> 12) +-#define TCF_META_ID_MASK 0x7ff +-#define TCF_META_ID(kind) ((kind) & TCF_META_ID_MASK) +- +-enum { +- TCF_META_TYPE_VAR, +- TCF_META_TYPE_INT, +- __TCF_META_TYPE_MAX +-}; +-#define TCF_META_TYPE_MAX (__TCF_META_TYPE_MAX - 1) +- +-enum { +- TCF_META_ID_VALUE, +- TCF_META_ID_RANDOM, +- TCF_META_ID_LOADAVG_0, +- TCF_META_ID_LOADAVG_1, +- TCF_META_ID_LOADAVG_2, +- TCF_META_ID_DEV, +- TCF_META_ID_PRIORITY, +- TCF_META_ID_PROTOCOL, +- TCF_META_ID_PKTTYPE, +- TCF_META_ID_PKTLEN, +- TCF_META_ID_DATALEN, +- TCF_META_ID_MACLEN, +- TCF_META_ID_NFMARK, +- TCF_META_ID_TCINDEX, +- TCF_META_ID_RTCLASSID, +- TCF_META_ID_RTIIF, +- TCF_META_ID_SK_FAMILY, +- TCF_META_ID_SK_STATE, +- TCF_META_ID_SK_REUSE, +- TCF_META_ID_SK_BOUND_IF, +- TCF_META_ID_SK_REFCNT, +- TCF_META_ID_SK_SHUTDOWN, +- TCF_META_ID_SK_PROTO, +- TCF_META_ID_SK_TYPE, +- TCF_META_ID_SK_RCVBUF, +- TCF_META_ID_SK_RMEM_ALLOC, +- TCF_META_ID_SK_WMEM_ALLOC, +- TCF_META_ID_SK_OMEM_ALLOC, +- TCF_META_ID_SK_WMEM_QUEUED, +- TCF_META_ID_SK_RCV_QLEN, +- TCF_META_ID_SK_SND_QLEN, +- TCF_META_ID_SK_ERR_QLEN, +- TCF_META_ID_SK_FORWARD_ALLOCS, +- TCF_META_ID_SK_SNDBUF, +- TCF_META_ID_SK_ALLOCS, +- __TCF_META_ID_SK_ROUTE_CAPS, /* unimplemented but in ABI already */ +- TCF_META_ID_SK_HASH, +- TCF_META_ID_SK_LINGERTIME, +- TCF_META_ID_SK_ACK_BACKLOG, +- TCF_META_ID_SK_MAX_ACK_BACKLOG, +- TCF_META_ID_SK_PRIO, +- TCF_META_ID_SK_RCVLOWAT, +- TCF_META_ID_SK_RCVTIMEO, +- TCF_META_ID_SK_SNDTIMEO, +- TCF_META_ID_SK_SENDMSG_OFF, +- TCF_META_ID_SK_WRITE_PENDING, +- TCF_META_ID_VLAN_TAG, +- TCF_META_ID_RXHASH, +- __TCF_META_ID_MAX +-}; +-#define TCF_META_ID_MAX (__TCF_META_ID_MAX - 1) +- +-struct tcf_meta_hdr { +- struct tcf_meta_val left; +- struct tcf_meta_val right; +-}; +- +-#endif +diff --git a/include/linux/tc_ematch/tc_em_nbyte.h b/include/linux/tc_ematch/tc_em_nbyte.h +deleted file mode 100644 +index 7172cfb..0000000 +--- a/include/linux/tc_ematch/tc_em_nbyte.h ++++ /dev/null +@@ -1,13 +0,0 @@ +-#ifndef __LINUX_TC_EM_NBYTE_H +-#define __LINUX_TC_EM_NBYTE_H +- +-#include +-#include +- +-struct tcf_em_nbyte { +- __u16 off; +- __u16 len:12; +- __u8 layer:4; +-}; +- +-#endif +diff --git a/include/linux/tcp.h b/include/linux/tcp.h +deleted file mode 100644 +index 8edad3f..0000000 +--- a/include/linux/tcp.h ++++ /dev/null +@@ -1,268 +0,0 @@ +-/* +- * INET An implementation of the TCP/IP protocol suite for the LINUX +- * operating system. INET is implemented using the BSD Socket +- * interface as the means of communication with the user level. +- * +- * Definitions for the TCP protocol. +- * +- * Version: @(#)tcp.h 1.0.2 04/28/93 +- * +- * Author: Fred N. van Kempen, +- * +- * This program is free software; you can redistribute it and/or +- * modify it under the terms of the GNU General Public License +- * as published by the Free Software Foundation; either version +- * 2 of the License, or (at your option) any later version. +- */ +-#ifndef _LINUX_TCP_H +-#define _LINUX_TCP_H +- +-#include +-#include +-#include +- +-struct tcphdr { +- __be16 source; +- __be16 dest; +- __be32 seq; +- __be32 ack_seq; +-#if defined(__LITTLE_ENDIAN_BITFIELD) +- __u16 res1:4, +- doff:4, +- fin:1, +- syn:1, +- rst:1, +- psh:1, +- ack:1, +- urg:1, +- ece:1, +- cwr:1; +-#elif defined(__BIG_ENDIAN_BITFIELD) +- __u16 doff:4, +- res1:4, +- cwr:1, +- ece:1, +- urg:1, +- ack:1, +- psh:1, +- rst:1, +- syn:1, +- fin:1; +-#else +-#error "Adjust your defines" +-#endif +- __be16 window; +- __sum16 check; +- __be16 urg_ptr; +-}; +- +-/* +- * The union cast uses a gcc extension to avoid aliasing problems +- * (union is compatible to any of its members) +- * This means this part of the code is -fstrict-aliasing safe now. +- */ +-union tcp_word_hdr { +- struct tcphdr hdr; +- __be32 words[5]; +-}; +- +-#define tcp_flag_word(tp) ( ((union tcp_word_hdr *)(tp))->words [3]) +- +-enum { +- TCP_FLAG_CWR = __constant_cpu_to_be32(0x00800000), +- TCP_FLAG_ECE = __constant_cpu_to_be32(0x00400000), +- TCP_FLAG_URG = __constant_cpu_to_be32(0x00200000), +- TCP_FLAG_ACK = __constant_cpu_to_be32(0x00100000), +- TCP_FLAG_PSH = __constant_cpu_to_be32(0x00080000), +- TCP_FLAG_RST = __constant_cpu_to_be32(0x00040000), +- TCP_FLAG_SYN = __constant_cpu_to_be32(0x00020000), +- TCP_FLAG_FIN = __constant_cpu_to_be32(0x00010000), +- TCP_RESERVED_BITS = __constant_cpu_to_be32(0x0F000000), +- TCP_DATA_OFFSET = __constant_cpu_to_be32(0xF0000000) +-}; +- +-/* +- * TCP general constants +- */ +-#define TCP_MSS_DEFAULT 536U /* IPv4 (RFC1122, RFC2581) */ +-#define TCP_MSS_DESIRED 1220U /* IPv6 (tunneled), EDNS0 (RFC3226) */ +- +-/* TCP socket options */ +-#define TCP_NODELAY 1 /* Turn off Nagle's algorithm. */ +-#define TCP_MAXSEG 2 /* Limit MSS */ +-#define TCP_CORK 3 /* Never send partially complete segments */ +-#define TCP_KEEPIDLE 4 /* Start keeplives after this period */ +-#define TCP_KEEPINTVL 5 /* Interval between keepalives */ +-#define TCP_KEEPCNT 6 /* Number of keepalives before death */ +-#define TCP_SYNCNT 7 /* Number of SYN retransmits */ +-#define TCP_LINGER2 8 /* Life time of orphaned FIN-WAIT-2 state */ +-#define TCP_DEFER_ACCEPT 9 /* Wake up listener only when data arrive */ +-#define TCP_WINDOW_CLAMP 10 /* Bound advertised window */ +-#define TCP_INFO 11 /* Information about this connection. */ +-#define TCP_QUICKACK 12 /* Block/reenable quick acks */ +-#define TCP_CONGESTION 13 /* Congestion control algorithm */ +-#define TCP_MD5SIG 14 /* TCP MD5 Signature (RFC2385) */ +-#define TCP_THIN_LINEAR_TIMEOUTS 16 /* Use linear timeouts for thin streams*/ +-#define TCP_THIN_DUPACK 17 /* Fast retrans. after 1 dupack */ +-#define TCP_USER_TIMEOUT 18 /* How long for loss retry before timeout */ +-#define TCP_REPAIR 19 /* TCP sock is under repair right now */ +-#define TCP_REPAIR_QUEUE 20 +-#define TCP_QUEUE_SEQ 21 +-#define TCP_REPAIR_OPTIONS 22 +-#define TCP_FASTOPEN 23 /* Enable FastOpen on listeners */ +-#define TCP_TIMESTAMP 24 +-#define TCP_NOTSENT_LOWAT 25 /* limit number of unsent bytes in write queue */ +-#define TCP_CC_INFO 26 /* Get Congestion Control (optional) info */ +-#define TCP_SAVE_SYN 27 /* Record SYN headers for new connections */ +-#define TCP_SAVED_SYN 28 /* Get SYN headers recorded for connection */ +-#define TCP_REPAIR_WINDOW 29 /* Get/set window parameters */ +-#define TCP_FASTOPEN_CONNECT 30 /* Attempt FastOpen with connect */ +-#define TCP_ULP 31 /* Attach a ULP to a TCP connection */ +-#define TCP_MD5SIG_EXT 32 /* TCP MD5 Signature with extensions */ +- +-struct tcp_repair_opt { +- __u32 opt_code; +- __u32 opt_val; +-}; +- +-struct tcp_repair_window { +- __u32 snd_wl1; +- __u32 snd_wnd; +- __u32 max_window; +- +- __u32 rcv_wnd; +- __u32 rcv_wup; +-}; +- +-enum { +- TCP_NO_QUEUE, +- TCP_RECV_QUEUE, +- TCP_SEND_QUEUE, +- TCP_QUEUES_NR, +-}; +- +-/* for TCP_INFO socket option */ +-#define TCPI_OPT_TIMESTAMPS 1 +-#define TCPI_OPT_SACK 2 +-#define TCPI_OPT_WSCALE 4 +-#define TCPI_OPT_ECN 8 /* ECN was negociated at TCP session init */ +-#define TCPI_OPT_ECN_SEEN 16 /* we received at least one packet with ECT */ +-#define TCPI_OPT_SYN_DATA 32 /* SYN-ACK acked data in SYN sent or rcvd */ +- +-enum tcp_ca_state { +- TCP_CA_Open = 0, +-#define TCPF_CA_Open (1< +- +-/* NETLINK_GENERIC related info +- */ +-#define TCP_METRICS_GENL_NAME "tcp_metrics" +-#define TCP_METRICS_GENL_VERSION 0x1 +- +-enum tcp_metric_index { +- TCP_METRIC_RTT, /* in ms units */ +- TCP_METRIC_RTTVAR, /* in ms units */ +- TCP_METRIC_SSTHRESH, +- TCP_METRIC_CWND, +- TCP_METRIC_REORDERING, +- +- TCP_METRIC_RTT_US, /* in usec units */ +- TCP_METRIC_RTTVAR_US, /* in usec units */ +- +- /* Always last. */ +- __TCP_METRIC_MAX, +-}; +- +-#define TCP_METRIC_MAX (__TCP_METRIC_MAX - 1) +- +-enum { +- TCP_METRICS_ATTR_UNSPEC, +- TCP_METRICS_ATTR_ADDR_IPV4, /* u32 */ +- TCP_METRICS_ATTR_ADDR_IPV6, /* binary */ +- TCP_METRICS_ATTR_AGE, /* msecs */ +- TCP_METRICS_ATTR_TW_TSVAL, /* u32, raw, rcv tsval */ +- TCP_METRICS_ATTR_TW_TS_STAMP, /* s32, sec age */ +- TCP_METRICS_ATTR_VALS, /* nested +1, u32 */ +- TCP_METRICS_ATTR_FOPEN_MSS, /* u16 */ +- TCP_METRICS_ATTR_FOPEN_SYN_DROPS, /* u16, count of drops */ +- TCP_METRICS_ATTR_FOPEN_SYN_DROP_TS, /* msecs age */ +- TCP_METRICS_ATTR_FOPEN_COOKIE, /* binary */ +- TCP_METRICS_ATTR_SADDR_IPV4, /* u32 */ +- TCP_METRICS_ATTR_SADDR_IPV6, /* binary */ +- TCP_METRICS_ATTR_PAD, +- +- __TCP_METRICS_ATTR_MAX, +-}; +- +-#define TCP_METRICS_ATTR_MAX (__TCP_METRICS_ATTR_MAX - 1) +- +-enum { +- TCP_METRICS_CMD_UNSPEC, +- TCP_METRICS_CMD_GET, +- TCP_METRICS_CMD_DEL, +- +- __TCP_METRICS_CMD_MAX, +-}; +- +-#define TCP_METRICS_CMD_MAX (__TCP_METRICS_CMD_MAX - 1) +- +-#endif /* _LINUX_TCP_METRICS_H */ +diff --git a/include/linux/tipc.h b/include/linux/tipc.h +deleted file mode 100644 +index 924fb5c..0000000 +--- a/include/linux/tipc.h ++++ /dev/null +@@ -1,256 +0,0 @@ +-/* +- * include/uapi/linux/tipc.h: Header for TIPC socket interface +- * +- * Copyright (c) 2003-2006, 2015-2016 Ericsson AB +- * Copyright (c) 2005, 2010-2011, Wind River Systems +- * All rights reserved. +- * +- * Redistribution and use in source and binary forms, with or without +- * modification, are permitted provided that the following conditions are met: +- * +- * 1. Redistributions of source code must retain the above copyright +- * notice, this list of conditions and the following disclaimer. +- * 2. Redistributions in binary form must reproduce the above copyright +- * notice, this list of conditions and the following disclaimer in the +- * documentation and/or other materials provided with the distribution. +- * 3. Neither the names of the copyright holders nor the names of its +- * contributors may be used to endorse or promote products derived from +- * this software without specific prior written permission. +- * +- * Alternatively, this software may be distributed under the terms of the +- * GNU General Public License ("GPL") version 2 as published by the Free +- * Software Foundation. +- * +- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +- * POSSIBILITY OF SUCH DAMAGE. +- */ +- +-#ifndef _LINUX_TIPC_H_ +-#define _LINUX_TIPC_H_ +- +-#include +-#include +- +-/* +- * TIPC addressing primitives +- */ +- +-struct tipc_portid { +- __u32 ref; +- __u32 node; +-}; +- +-struct tipc_name { +- __u32 type; +- __u32 instance; +-}; +- +-struct tipc_name_seq { +- __u32 type; +- __u32 lower; +- __u32 upper; +-}; +- +-/* TIPC Address Size, Offset, Mask specification for Z.C.N +- */ +-#define TIPC_NODE_BITS 12 +-#define TIPC_CLUSTER_BITS 12 +-#define TIPC_ZONE_BITS 8 +- +-#define TIPC_NODE_OFFSET 0 +-#define TIPC_CLUSTER_OFFSET TIPC_NODE_BITS +-#define TIPC_ZONE_OFFSET (TIPC_CLUSTER_OFFSET + TIPC_CLUSTER_BITS) +- +-#define TIPC_NODE_SIZE ((1UL << TIPC_NODE_BITS) - 1) +-#define TIPC_CLUSTER_SIZE ((1UL << TIPC_CLUSTER_BITS) - 1) +-#define TIPC_ZONE_SIZE ((1UL << TIPC_ZONE_BITS) - 1) +- +-#define TIPC_NODE_MASK (TIPC_NODE_SIZE << TIPC_NODE_OFFSET) +-#define TIPC_CLUSTER_MASK (TIPC_CLUSTER_SIZE << TIPC_CLUSTER_OFFSET) +-#define TIPC_ZONE_MASK (TIPC_ZONE_SIZE << TIPC_ZONE_OFFSET) +- +-#define TIPC_ZONE_CLUSTER_MASK (TIPC_ZONE_MASK | TIPC_CLUSTER_MASK) +- +-static __inline__ __u32 tipc_addr(unsigned int zone, +- unsigned int cluster, +- unsigned int node) +-{ +- return (zone << TIPC_ZONE_OFFSET) | +- (cluster << TIPC_CLUSTER_OFFSET) | +- node; +-} +- +-static __inline__ unsigned int tipc_zone(__u32 addr) +-{ +- return addr >> TIPC_ZONE_OFFSET; +-} +- +-static __inline__ unsigned int tipc_cluster(__u32 addr) +-{ +- return (addr & TIPC_CLUSTER_MASK) >> TIPC_CLUSTER_OFFSET; +-} +- +-static __inline__ unsigned int tipc_node(__u32 addr) +-{ +- return addr & TIPC_NODE_MASK; +-} +- +-/* +- * Application-accessible port name types +- */ +- +-#define TIPC_CFG_SRV 0 /* configuration service name type */ +-#define TIPC_TOP_SRV 1 /* topology service name type */ +-#define TIPC_LINK_STATE 2 /* link state name type */ +-#define TIPC_RESERVED_TYPES 64 /* lowest user-publishable name type */ +- +-/* +- * Publication scopes when binding port names and port name sequences +- */ +- +-#define TIPC_ZONE_SCOPE 1 +-#define TIPC_CLUSTER_SCOPE 2 +-#define TIPC_NODE_SCOPE 3 +- +-/* +- * Limiting values for messages +- */ +- +-#define TIPC_MAX_USER_MSG_SIZE 66000U +- +-/* +- * Message importance levels +- */ +- +-#define TIPC_LOW_IMPORTANCE 0 +-#define TIPC_MEDIUM_IMPORTANCE 1 +-#define TIPC_HIGH_IMPORTANCE 2 +-#define TIPC_CRITICAL_IMPORTANCE 3 +- +-/* +- * Msg rejection/connection shutdown reasons +- */ +- +-#define TIPC_OK 0 +-#define TIPC_ERR_NO_NAME 1 +-#define TIPC_ERR_NO_PORT 2 +-#define TIPC_ERR_NO_NODE 3 +-#define TIPC_ERR_OVERLOAD 4 +-#define TIPC_CONN_SHUTDOWN 5 +- +-/* +- * TIPC topology subscription service definitions +- */ +- +-#define TIPC_SUB_PORTS 0x01 /* filter for port availability */ +-#define TIPC_SUB_SERVICE 0x02 /* filter for service availability */ +-#define TIPC_SUB_CANCEL 0x04 /* cancel a subscription */ +- +-#define TIPC_WAIT_FOREVER (~0) /* timeout for permanent subscription */ +- +-struct tipc_subscr { +- struct tipc_name_seq seq; /* name sequence of interest */ +- __u32 timeout; /* subscription duration (in ms) */ +- __u32 filter; /* bitmask of filter options */ +- char usr_handle[8]; /* available for subscriber use */ +-}; +- +-#define TIPC_PUBLISHED 1 /* publication event */ +-#define TIPC_WITHDRAWN 2 /* withdraw event */ +-#define TIPC_SUBSCR_TIMEOUT 3 /* subscription timeout event */ +- +-struct tipc_event { +- __u32 event; /* event type */ +- __u32 found_lower; /* matching name seq instances */ +- __u32 found_upper; /* " " " " */ +- struct tipc_portid port; /* associated port */ +- struct tipc_subscr s; /* associated subscription */ +-}; +- +-/* +- * Socket API +- */ +- +-#ifndef AF_TIPC +-#define AF_TIPC 30 +-#endif +- +-#ifndef PF_TIPC +-#define PF_TIPC AF_TIPC +-#endif +- +-#ifndef SOL_TIPC +-#define SOL_TIPC 271 +-#endif +- +-#define TIPC_ADDR_NAMESEQ 1 +-#define TIPC_ADDR_MCAST 1 +-#define TIPC_ADDR_NAME 2 +-#define TIPC_ADDR_ID 3 +- +-struct sockaddr_tipc { +- unsigned short family; +- unsigned char addrtype; +- signed char scope; +- union { +- struct tipc_portid id; +- struct tipc_name_seq nameseq; +- struct { +- struct tipc_name name; +- __u32 domain; +- } name; +- } addr; +-}; +- +-/* +- * Ancillary data objects supported by recvmsg() +- */ +- +-#define TIPC_ERRINFO 1 /* error info */ +-#define TIPC_RETDATA 2 /* returned data */ +-#define TIPC_DESTNAME 3 /* destination name */ +- +-/* +- * TIPC-specific socket option names +- */ +- +-#define TIPC_IMPORTANCE 127 /* Default: TIPC_LOW_IMPORTANCE */ +-#define TIPC_SRC_DROPPABLE 128 /* Default: based on socket type */ +-#define TIPC_DEST_DROPPABLE 129 /* Default: based on socket type */ +-#define TIPC_CONN_TIMEOUT 130 /* Default: 8000 (ms) */ +-#define TIPC_NODE_RECVQ_DEPTH 131 /* Default: none (read only) */ +-#define TIPC_SOCK_RECVQ_DEPTH 132 /* Default: none (read only) */ +-#define TIPC_MCAST_BROADCAST 133 /* Default: TIPC selects. No arg */ +-#define TIPC_MCAST_REPLICAST 134 /* Default: TIPC selects. No arg */ +- +-/* +- * Maximum sizes of TIPC bearer-related names (including terminating NULL) +- * The string formatting for each name element is: +- * media: media +- * interface: media:interface name +- * link: Z.C.N:interface-Z.C.N:interface +- * +- */ +- +-#define TIPC_MAX_MEDIA_NAME 16 +-#define TIPC_MAX_IF_NAME 16 +-#define TIPC_MAX_BEARER_NAME 32 +-#define TIPC_MAX_LINK_NAME 60 +- +-#define SIOCGETLINKNAME SIOCPROTOPRIVATE +- +-struct tipc_sioc_ln_req { +- __u32 peer; +- __u32 bearer_id; +- char linkname[TIPC_MAX_LINK_NAME]; +-}; +-#endif +diff --git a/include/linux/tipc_netlink.h b/include/linux/tipc_netlink.h +deleted file mode 100644 +index f9edd20..0000000 +--- a/include/linux/tipc_netlink.h ++++ /dev/null +@@ -1,294 +0,0 @@ +-/* +- * Copyright (c) 2014, Ericsson AB +- * All rights reserved. +- * +- * Redistribution and use in source and binary forms, with or without +- * modification, are permitted provided that the following conditions are met: +- * +- * 1. Redistributions of source code must retain the above copyright +- * notice, this list of conditions and the following disclaimer. +- * 2. Redistributions in binary form must reproduce the above copyright +- * notice, this list of conditions and the following disclaimer in the +- * documentation and/or other materials provided with the distribution. +- * 3. Neither the names of the copyright holders nor the names of its +- * contributors may be used to endorse or promote products derived from +- * this software without specific prior written permission. +- * +- * Alternatively, this software may be distributed under the terms of the +- * GNU General Public License ("GPL") version 2 as published by the Free +- * Software Foundation. +- * +- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +- * POSSIBILITY OF SUCH DAMAGE. +- */ +- +-#ifndef _LINUX_TIPC_NETLINK_H_ +-#define _LINUX_TIPC_NETLINK_H_ +- +-#define TIPC_GENL_V2_NAME "TIPCv2" +-#define TIPC_GENL_V2_VERSION 0x1 +- +-/* Netlink commands */ +-enum { +- TIPC_NL_UNSPEC, +- TIPC_NL_LEGACY, +- TIPC_NL_BEARER_DISABLE, +- TIPC_NL_BEARER_ENABLE, +- TIPC_NL_BEARER_GET, +- TIPC_NL_BEARER_SET, +- TIPC_NL_SOCK_GET, +- TIPC_NL_PUBL_GET, +- TIPC_NL_LINK_GET, +- TIPC_NL_LINK_SET, +- TIPC_NL_LINK_RESET_STATS, +- TIPC_NL_MEDIA_GET, +- TIPC_NL_MEDIA_SET, +- TIPC_NL_NODE_GET, +- TIPC_NL_NET_GET, +- TIPC_NL_NET_SET, +- TIPC_NL_NAME_TABLE_GET, +- TIPC_NL_MON_SET, +- TIPC_NL_MON_GET, +- TIPC_NL_MON_PEER_GET, +- TIPC_NL_PEER_REMOVE, +- TIPC_NL_BEARER_ADD, +- TIPC_NL_UDP_GET_REMOTEIP, +- +- __TIPC_NL_CMD_MAX, +- TIPC_NL_CMD_MAX = __TIPC_NL_CMD_MAX - 1 +-}; +- +-/* Top level netlink attributes */ +-enum { +- TIPC_NLA_UNSPEC, +- TIPC_NLA_BEARER, /* nest */ +- TIPC_NLA_SOCK, /* nest */ +- TIPC_NLA_PUBL, /* nest */ +- TIPC_NLA_LINK, /* nest */ +- TIPC_NLA_MEDIA, /* nest */ +- TIPC_NLA_NODE, /* nest */ +- TIPC_NLA_NET, /* nest */ +- TIPC_NLA_NAME_TABLE, /* nest */ +- TIPC_NLA_MON, /* nest */ +- TIPC_NLA_MON_PEER, /* nest */ +- +- __TIPC_NLA_MAX, +- TIPC_NLA_MAX = __TIPC_NLA_MAX - 1 +-}; +- +-/* Bearer info */ +-enum { +- TIPC_NLA_BEARER_UNSPEC, +- TIPC_NLA_BEARER_NAME, /* string */ +- TIPC_NLA_BEARER_PROP, /* nest */ +- TIPC_NLA_BEARER_DOMAIN, /* u32 */ +- TIPC_NLA_BEARER_UDP_OPTS, /* nest */ +- +- __TIPC_NLA_BEARER_MAX, +- TIPC_NLA_BEARER_MAX = __TIPC_NLA_BEARER_MAX - 1 +-}; +- +-enum { +- TIPC_NLA_UDP_UNSPEC, +- TIPC_NLA_UDP_LOCAL, /* sockaddr_storage */ +- TIPC_NLA_UDP_REMOTE, /* sockaddr_storage */ +- TIPC_NLA_UDP_MULTI_REMOTEIP, /* flag */ +- +- __TIPC_NLA_UDP_MAX, +- TIPC_NLA_UDP_MAX = __TIPC_NLA_UDP_MAX - 1 +-}; +-/* Socket info */ +-enum { +- TIPC_NLA_SOCK_UNSPEC, +- TIPC_NLA_SOCK_ADDR, /* u32 */ +- TIPC_NLA_SOCK_REF, /* u32 */ +- TIPC_NLA_SOCK_CON, /* nest */ +- TIPC_NLA_SOCK_HAS_PUBL, /* flag */ +- +- __TIPC_NLA_SOCK_MAX, +- TIPC_NLA_SOCK_MAX = __TIPC_NLA_SOCK_MAX - 1 +-}; +- +-/* Link info */ +-enum { +- TIPC_NLA_LINK_UNSPEC, +- TIPC_NLA_LINK_NAME, /* string */ +- TIPC_NLA_LINK_DEST, /* u32 */ +- TIPC_NLA_LINK_MTU, /* u32 */ +- TIPC_NLA_LINK_BROADCAST, /* flag */ +- TIPC_NLA_LINK_UP, /* flag */ +- TIPC_NLA_LINK_ACTIVE, /* flag */ +- TIPC_NLA_LINK_PROP, /* nest */ +- TIPC_NLA_LINK_STATS, /* nest */ +- TIPC_NLA_LINK_RX, /* u32 */ +- TIPC_NLA_LINK_TX, /* u32 */ +- +- __TIPC_NLA_LINK_MAX, +- TIPC_NLA_LINK_MAX = __TIPC_NLA_LINK_MAX - 1 +-}; +- +-/* Media info */ +-enum { +- TIPC_NLA_MEDIA_UNSPEC, +- TIPC_NLA_MEDIA_NAME, /* string */ +- TIPC_NLA_MEDIA_PROP, /* nest */ +- +- __TIPC_NLA_MEDIA_MAX, +- TIPC_NLA_MEDIA_MAX = __TIPC_NLA_MEDIA_MAX - 1 +-}; +- +-/* Node info */ +-enum { +- TIPC_NLA_NODE_UNSPEC, +- TIPC_NLA_NODE_ADDR, /* u32 */ +- TIPC_NLA_NODE_UP, /* flag */ +- +- __TIPC_NLA_NODE_MAX, +- TIPC_NLA_NODE_MAX = __TIPC_NLA_NODE_MAX - 1 +-}; +- +-/* Net info */ +-enum { +- TIPC_NLA_NET_UNSPEC, +- TIPC_NLA_NET_ID, /* u32 */ +- TIPC_NLA_NET_ADDR, /* u32 */ +- +- __TIPC_NLA_NET_MAX, +- TIPC_NLA_NET_MAX = __TIPC_NLA_NET_MAX - 1 +-}; +- +-/* Name table info */ +-enum { +- TIPC_NLA_NAME_TABLE_UNSPEC, +- TIPC_NLA_NAME_TABLE_PUBL, /* nest */ +- +- __TIPC_NLA_NAME_TABLE_MAX, +- TIPC_NLA_NAME_TABLE_MAX = __TIPC_NLA_NAME_TABLE_MAX - 1 +-}; +- +-/* Monitor info */ +-enum { +- TIPC_NLA_MON_UNSPEC, +- TIPC_NLA_MON_ACTIVATION_THRESHOLD, /* u32 */ +- TIPC_NLA_MON_REF, /* u32 */ +- TIPC_NLA_MON_ACTIVE, /* flag */ +- TIPC_NLA_MON_BEARER_NAME, /* string */ +- TIPC_NLA_MON_PEERCNT, /* u32 */ +- TIPC_NLA_MON_LISTGEN, /* u32 */ +- +- __TIPC_NLA_MON_MAX, +- TIPC_NLA_MON_MAX = __TIPC_NLA_MON_MAX - 1 +-}; +- +-/* Publication info */ +-enum { +- TIPC_NLA_PUBL_UNSPEC, +- +- TIPC_NLA_PUBL_TYPE, /* u32 */ +- TIPC_NLA_PUBL_LOWER, /* u32 */ +- TIPC_NLA_PUBL_UPPER, /* u32 */ +- TIPC_NLA_PUBL_SCOPE, /* u32 */ +- TIPC_NLA_PUBL_NODE, /* u32 */ +- TIPC_NLA_PUBL_REF, /* u32 */ +- TIPC_NLA_PUBL_KEY, /* u32 */ +- +- __TIPC_NLA_PUBL_MAX, +- TIPC_NLA_PUBL_MAX = __TIPC_NLA_PUBL_MAX - 1 +-}; +- +-/* Monitor peer info */ +-enum { +- TIPC_NLA_MON_PEER_UNSPEC, +- +- TIPC_NLA_MON_PEER_ADDR, /* u32 */ +- TIPC_NLA_MON_PEER_DOMGEN, /* u32 */ +- TIPC_NLA_MON_PEER_APPLIED, /* u32 */ +- TIPC_NLA_MON_PEER_UPMAP, /* u64 */ +- TIPC_NLA_MON_PEER_MEMBERS, /* tlv */ +- TIPC_NLA_MON_PEER_UP, /* flag */ +- TIPC_NLA_MON_PEER_HEAD, /* flag */ +- TIPC_NLA_MON_PEER_LOCAL, /* flag */ +- TIPC_NLA_MON_PEER_PAD, /* flag */ +- +- __TIPC_NLA_MON_PEER_MAX, +- TIPC_NLA_MON_PEER_MAX = __TIPC_NLA_MON_PEER_MAX - 1 +-}; +- +-/* Nest, connection info */ +-enum { +- TIPC_NLA_CON_UNSPEC, +- +- TIPC_NLA_CON_FLAG, /* flag */ +- TIPC_NLA_CON_NODE, /* u32 */ +- TIPC_NLA_CON_SOCK, /* u32 */ +- TIPC_NLA_CON_TYPE, /* u32 */ +- TIPC_NLA_CON_INST, /* u32 */ +- +- __TIPC_NLA_CON_MAX, +- TIPC_NLA_CON_MAX = __TIPC_NLA_CON_MAX - 1 +-}; +- +-/* Nest, link propreties. Valid for link, media and bearer */ +-enum { +- TIPC_NLA_PROP_UNSPEC, +- +- TIPC_NLA_PROP_PRIO, /* u32 */ +- TIPC_NLA_PROP_TOL, /* u32 */ +- TIPC_NLA_PROP_WIN, /* u32 */ +- +- __TIPC_NLA_PROP_MAX, +- TIPC_NLA_PROP_MAX = __TIPC_NLA_PROP_MAX - 1 +-}; +- +-/* Nest, statistics info */ +-enum { +- TIPC_NLA_STATS_UNSPEC, +- +- TIPC_NLA_STATS_RX_INFO, /* u32 */ +- TIPC_NLA_STATS_RX_FRAGMENTS, /* u32 */ +- TIPC_NLA_STATS_RX_FRAGMENTED, /* u32 */ +- TIPC_NLA_STATS_RX_BUNDLES, /* u32 */ +- TIPC_NLA_STATS_RX_BUNDLED, /* u32 */ +- TIPC_NLA_STATS_TX_INFO, /* u32 */ +- TIPC_NLA_STATS_TX_FRAGMENTS, /* u32 */ +- TIPC_NLA_STATS_TX_FRAGMENTED, /* u32 */ +- TIPC_NLA_STATS_TX_BUNDLES, /* u32 */ +- TIPC_NLA_STATS_TX_BUNDLED, /* u32 */ +- TIPC_NLA_STATS_MSG_PROF_TOT, /* u32 */ +- TIPC_NLA_STATS_MSG_LEN_CNT, /* u32 */ +- TIPC_NLA_STATS_MSG_LEN_TOT, /* u32 */ +- TIPC_NLA_STATS_MSG_LEN_P0, /* u32 */ +- TIPC_NLA_STATS_MSG_LEN_P1, /* u32 */ +- TIPC_NLA_STATS_MSG_LEN_P2, /* u32 */ +- TIPC_NLA_STATS_MSG_LEN_P3, /* u32 */ +- TIPC_NLA_STATS_MSG_LEN_P4, /* u32 */ +- TIPC_NLA_STATS_MSG_LEN_P5, /* u32 */ +- TIPC_NLA_STATS_MSG_LEN_P6, /* u32 */ +- TIPC_NLA_STATS_RX_STATES, /* u32 */ +- TIPC_NLA_STATS_RX_PROBES, /* u32 */ +- TIPC_NLA_STATS_RX_NACKS, /* u32 */ +- TIPC_NLA_STATS_RX_DEFERRED, /* u32 */ +- TIPC_NLA_STATS_TX_STATES, /* u32 */ +- TIPC_NLA_STATS_TX_PROBES, /* u32 */ +- TIPC_NLA_STATS_TX_NACKS, /* u32 */ +- TIPC_NLA_STATS_TX_ACKS, /* u32 */ +- TIPC_NLA_STATS_RETRANSMITTED, /* u32 */ +- TIPC_NLA_STATS_DUPLICATES, /* u32 */ +- TIPC_NLA_STATS_LINK_CONGS, /* u32 */ +- TIPC_NLA_STATS_MAX_QUEUE, /* u32 */ +- TIPC_NLA_STATS_AVG_QUEUE, /* u32 */ +- +- __TIPC_NLA_STATS_MAX, +- TIPC_NLA_STATS_MAX = __TIPC_NLA_STATS_MAX - 1 +-}; +- +-#endif +diff --git a/include/linux/types.h b/include/linux/types.h +deleted file mode 100644 +index c640657..0000000 +--- a/include/linux/types.h ++++ /dev/null +@@ -1,47 +0,0 @@ +-#ifndef _LINUX_TYPES_H +-#define _LINUX_TYPES_H +- +-#include +- +-#ifndef __ASSEMBLY__ +- +-#include +- +- +-/* +- * Below are truly Linux-specific types that should never collide with +- * any application/library that wants linux/types.h. +- */ +- +-#ifdef __CHECKER__ +-#define __bitwise__ __attribute__((bitwise)) +-#else +-#define __bitwise__ +-#endif +-#define __bitwise __bitwise__ +- +-typedef __u16 __bitwise __le16; +-typedef __u16 __bitwise __be16; +-typedef __u32 __bitwise __le32; +-typedef __u32 __bitwise __be32; +-typedef __u64 __bitwise __le64; +-typedef __u64 __bitwise __be64; +- +-typedef __u16 __bitwise __sum16; +-typedef __u32 __bitwise __wsum; +- +-/* +- * aligned_u64 should be used in defining kernel<->userspace ABIs to avoid +- * common 32/64-bit compat problems. +- * 64-bit values align to 4-byte boundaries on x86_32 (and possibly other +- * architectures) and to 8-byte boundaries on 64-bit architectures. The new +- * aligned_64 type enforces 8-byte alignment so that structs containing +- * aligned_64 values have the same alignment on 32-bit and 64-bit architectures. +- * No conversions are necessary between 32-bit user-space and a 64-bit kernel. +- */ +-#define __aligned_u64 __u64 __attribute__((aligned(8))) +-#define __aligned_be64 __be64 __attribute__((aligned(8))) +-#define __aligned_le64 __le64 __attribute__((aligned(8))) +- +-#endif /* __ASSEMBLY__ */ +-#endif /* _LINUX_TYPES_H */ +diff --git a/include/linux/unix_diag.h b/include/linux/unix_diag.h +deleted file mode 100644 +index 1eb0b8d..0000000 +--- a/include/linux/unix_diag.h ++++ /dev/null +@@ -1,58 +0,0 @@ +-#ifndef __UNIX_DIAG_H__ +-#define __UNIX_DIAG_H__ +- +-#include +- +-struct unix_diag_req { +- __u8 sdiag_family; +- __u8 sdiag_protocol; +- __u16 pad; +- __u32 udiag_states; +- __u32 udiag_ino; +- __u32 udiag_show; +- __u32 udiag_cookie[2]; +-}; +- +-#define UDIAG_SHOW_NAME 0x00000001 /* show name (not path) */ +-#define UDIAG_SHOW_VFS 0x00000002 /* show VFS inode info */ +-#define UDIAG_SHOW_PEER 0x00000004 /* show peer socket info */ +-#define UDIAG_SHOW_ICONS 0x00000008 /* show pending connections */ +-#define UDIAG_SHOW_RQLEN 0x00000010 /* show skb receive queue len */ +-#define UDIAG_SHOW_MEMINFO 0x00000020 /* show memory info of a socket */ +- +-struct unix_diag_msg { +- __u8 udiag_family; +- __u8 udiag_type; +- __u8 udiag_state; +- __u8 pad; +- +- __u32 udiag_ino; +- __u32 udiag_cookie[2]; +-}; +- +-enum { +- /* UNIX_DIAG_NONE, standard nl API requires this attribute! */ +- UNIX_DIAG_NAME, +- UNIX_DIAG_VFS, +- UNIX_DIAG_PEER, +- UNIX_DIAG_ICONS, +- UNIX_DIAG_RQLEN, +- UNIX_DIAG_MEMINFO, +- UNIX_DIAG_SHUTDOWN, +- +- __UNIX_DIAG_MAX, +-}; +- +-#define UNIX_DIAG_MAX (__UNIX_DIAG_MAX - 1) +- +-struct unix_diag_vfs { +- __u32 udiag_vfs_ino; +- __u32 udiag_vfs_dev; +-}; +- +-struct unix_diag_rqlen { +- __u32 udiag_rqueue; +- __u32 udiag_wqueue; +-}; +- +-#endif +diff --git a/include/linux/veth.h b/include/linux/veth.h +deleted file mode 100644 +index 3354c1e..0000000 +--- a/include/linux/veth.h ++++ /dev/null +@@ -1,12 +0,0 @@ +-#ifndef __NET_VETH_H_ +-#define __NET_VETH_H_ +- +-enum { +- VETH_INFO_UNSPEC, +- VETH_INFO_PEER, +- +- __VETH_INFO_MAX +-#define VETH_INFO_MAX (__VETH_INFO_MAX - 1) +-}; +- +-#endif +diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h +deleted file mode 100644 +index 5790293..0000000 +--- a/include/linux/xfrm.h ++++ /dev/null +@@ -1,536 +0,0 @@ +-#ifndef _LINUX_XFRM_H +-#define _LINUX_XFRM_H +- +-#include +-#include +- +-/* All of the structures in this file may not change size as they are +- * passed into the kernel from userspace via netlink sockets. +- */ +- +-/* Structure to encapsulate addresses. I do not want to use +- * "standard" structure. My apologies. +- */ +-typedef union { +- __be32 a4; +- __be32 a6[4]; +- struct in6_addr in6; +-} xfrm_address_t; +- +-/* Ident of a specific xfrm_state. It is used on input to lookup +- * the state by (spi,daddr,ah/esp) or to store information about +- * spi, protocol and tunnel address on output. +- */ +-struct xfrm_id { +- xfrm_address_t daddr; +- __be32 spi; +- __u8 proto; +-}; +- +-struct xfrm_sec_ctx { +- __u8 ctx_doi; +- __u8 ctx_alg; +- __u16 ctx_len; +- __u32 ctx_sid; +- char ctx_str[0]; +-}; +- +-/* Security Context Domains of Interpretation */ +-#define XFRM_SC_DOI_RESERVED 0 +-#define XFRM_SC_DOI_LSM 1 +- +-/* Security Context Algorithms */ +-#define XFRM_SC_ALG_RESERVED 0 +-#define XFRM_SC_ALG_SELINUX 1 +- +-/* Selector, used as selector both on policy rules (SPD) and SAs. */ +- +-struct xfrm_selector { +- xfrm_address_t daddr; +- xfrm_address_t saddr; +- __be16 dport; +- __be16 dport_mask; +- __be16 sport; +- __be16 sport_mask; +- __u16 family; +- __u8 prefixlen_d; +- __u8 prefixlen_s; +- __u8 proto; +- int ifindex; +- __kernel_uid32_t user; +-}; +- +-#define XFRM_INF (~(__u64)0) +- +-struct xfrm_lifetime_cfg { +- __u64 soft_byte_limit; +- __u64 hard_byte_limit; +- __u64 soft_packet_limit; +- __u64 hard_packet_limit; +- __u64 soft_add_expires_seconds; +- __u64 hard_add_expires_seconds; +- __u64 soft_use_expires_seconds; +- __u64 hard_use_expires_seconds; +-}; +- +-struct xfrm_lifetime_cur { +- __u64 bytes; +- __u64 packets; +- __u64 add_time; +- __u64 use_time; +-}; +- +-struct xfrm_replay_state { +- __u32 oseq; +- __u32 seq; +- __u32 bitmap; +-}; +- +-#define XFRMA_REPLAY_ESN_MAX 4096 +- +-struct xfrm_replay_state_esn { +- unsigned int bmp_len; +- __u32 oseq; +- __u32 seq; +- __u32 oseq_hi; +- __u32 seq_hi; +- __u32 replay_window; +- __u32 bmp[0]; +-}; +- +-struct xfrm_algo { +- char alg_name[64]; +- unsigned int alg_key_len; /* in bits */ +- char alg_key[0]; +-}; +- +-struct xfrm_algo_auth { +- char alg_name[64]; +- unsigned int alg_key_len; /* in bits */ +- unsigned int alg_trunc_len; /* in bits */ +- char alg_key[0]; +-}; +- +-struct xfrm_algo_aead { +- char alg_name[64]; +- unsigned int alg_key_len; /* in bits */ +- unsigned int alg_icv_len; /* in bits */ +- char alg_key[0]; +-}; +- +-struct xfrm_stats { +- __u32 replay_window; +- __u32 replay; +- __u32 integrity_failed; +-}; +- +-enum { +- XFRM_POLICY_TYPE_MAIN = 0, +- XFRM_POLICY_TYPE_SUB = 1, +- XFRM_POLICY_TYPE_MAX = 2, +- XFRM_POLICY_TYPE_ANY = 255 +-}; +- +-enum { +- XFRM_POLICY_IN = 0, +- XFRM_POLICY_OUT = 1, +- XFRM_POLICY_FWD = 2, +- XFRM_POLICY_MASK = 3, +- XFRM_POLICY_MAX = 3 +-}; +- +-enum { +- XFRM_SHARE_ANY, /* No limitations */ +- XFRM_SHARE_SESSION, /* For this session only */ +- XFRM_SHARE_USER, /* For this user only */ +- XFRM_SHARE_UNIQUE /* Use once */ +-}; +- +-#define XFRM_MODE_TRANSPORT 0 +-#define XFRM_MODE_TUNNEL 1 +-#define XFRM_MODE_ROUTEOPTIMIZATION 2 +-#define XFRM_MODE_IN_TRIGGER 3 +-#define XFRM_MODE_BEET 4 +-#define XFRM_MODE_MAX 5 +- +-/* Netlink configuration messages. */ +-enum { +- XFRM_MSG_BASE = 0x10, +- +- XFRM_MSG_NEWSA = 0x10, +-#define XFRM_MSG_NEWSA XFRM_MSG_NEWSA +- XFRM_MSG_DELSA, +-#define XFRM_MSG_DELSA XFRM_MSG_DELSA +- XFRM_MSG_GETSA, +-#define XFRM_MSG_GETSA XFRM_MSG_GETSA +- +- XFRM_MSG_NEWPOLICY, +-#define XFRM_MSG_NEWPOLICY XFRM_MSG_NEWPOLICY +- XFRM_MSG_DELPOLICY, +-#define XFRM_MSG_DELPOLICY XFRM_MSG_DELPOLICY +- XFRM_MSG_GETPOLICY, +-#define XFRM_MSG_GETPOLICY XFRM_MSG_GETPOLICY +- +- XFRM_MSG_ALLOCSPI, +-#define XFRM_MSG_ALLOCSPI XFRM_MSG_ALLOCSPI +- XFRM_MSG_ACQUIRE, +-#define XFRM_MSG_ACQUIRE XFRM_MSG_ACQUIRE +- XFRM_MSG_EXPIRE, +-#define XFRM_MSG_EXPIRE XFRM_MSG_EXPIRE +- +- XFRM_MSG_UPDPOLICY, +-#define XFRM_MSG_UPDPOLICY XFRM_MSG_UPDPOLICY +- XFRM_MSG_UPDSA, +-#define XFRM_MSG_UPDSA XFRM_MSG_UPDSA +- +- XFRM_MSG_POLEXPIRE, +-#define XFRM_MSG_POLEXPIRE XFRM_MSG_POLEXPIRE +- +- XFRM_MSG_FLUSHSA, +-#define XFRM_MSG_FLUSHSA XFRM_MSG_FLUSHSA +- XFRM_MSG_FLUSHPOLICY, +-#define XFRM_MSG_FLUSHPOLICY XFRM_MSG_FLUSHPOLICY +- +- XFRM_MSG_NEWAE, +-#define XFRM_MSG_NEWAE XFRM_MSG_NEWAE +- XFRM_MSG_GETAE, +-#define XFRM_MSG_GETAE XFRM_MSG_GETAE +- +- XFRM_MSG_REPORT, +-#define XFRM_MSG_REPORT XFRM_MSG_REPORT +- +- XFRM_MSG_MIGRATE, +-#define XFRM_MSG_MIGRATE XFRM_MSG_MIGRATE +- +- XFRM_MSG_NEWSADINFO, +-#define XFRM_MSG_NEWSADINFO XFRM_MSG_NEWSADINFO +- XFRM_MSG_GETSADINFO, +-#define XFRM_MSG_GETSADINFO XFRM_MSG_GETSADINFO +- +- XFRM_MSG_NEWSPDINFO, +-#define XFRM_MSG_NEWSPDINFO XFRM_MSG_NEWSPDINFO +- XFRM_MSG_GETSPDINFO, +-#define XFRM_MSG_GETSPDINFO XFRM_MSG_GETSPDINFO +- +- XFRM_MSG_MAPPING, +-#define XFRM_MSG_MAPPING XFRM_MSG_MAPPING +- __XFRM_MSG_MAX +-}; +-#define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1) +- +-#define XFRM_NR_MSGTYPES (XFRM_MSG_MAX + 1 - XFRM_MSG_BASE) +- +-/* +- * Generic LSM security context for comunicating to user space +- * NOTE: Same format as sadb_x_sec_ctx +- */ +-struct xfrm_user_sec_ctx { +- __u16 len; +- __u16 exttype; +- __u8 ctx_alg; /* LSMs: e.g., selinux == 1 */ +- __u8 ctx_doi; +- __u16 ctx_len; +-}; +- +-struct xfrm_user_tmpl { +- struct xfrm_id id; +- __u16 family; +- xfrm_address_t saddr; +- __u32 reqid; +- __u8 mode; +- __u8 share; +- __u8 optional; +- __u32 aalgos; +- __u32 ealgos; +- __u32 calgos; +-}; +- +-struct xfrm_encap_tmpl { +- __u16 encap_type; +- __be16 encap_sport; +- __be16 encap_dport; +- xfrm_address_t encap_oa; +-}; +- +-/* AEVENT flags */ +-enum xfrm_ae_ftype_t { +- XFRM_AE_UNSPEC, +- XFRM_AE_RTHR=1, /* replay threshold*/ +- XFRM_AE_RVAL=2, /* replay value */ +- XFRM_AE_LVAL=4, /* lifetime value */ +- XFRM_AE_ETHR=8, /* expiry timer threshold */ +- XFRM_AE_CR=16, /* Event cause is replay update */ +- XFRM_AE_CE=32, /* Event cause is timer expiry */ +- XFRM_AE_CU=64, /* Event cause is policy update */ +- __XFRM_AE_MAX +- +-#define XFRM_AE_MAX (__XFRM_AE_MAX - 1) +-}; +- +-struct xfrm_userpolicy_type { +- __u8 type; +- __u16 reserved1; +- __u8 reserved2; +-}; +- +-/* Netlink message attributes. */ +-enum xfrm_attr_type_t { +- XFRMA_UNSPEC, +- XFRMA_ALG_AUTH, /* struct xfrm_algo */ +- XFRMA_ALG_CRYPT, /* struct xfrm_algo */ +- XFRMA_ALG_COMP, /* struct xfrm_algo */ +- XFRMA_ENCAP, /* struct xfrm_algo + struct xfrm_encap_tmpl */ +- XFRMA_TMPL, /* 1 or more struct xfrm_user_tmpl */ +- XFRMA_SA, /* struct xfrm_usersa_info */ +- XFRMA_POLICY, /*struct xfrm_userpolicy_info */ +- XFRMA_SEC_CTX, /* struct xfrm_sec_ctx */ +- XFRMA_LTIME_VAL, +- XFRMA_REPLAY_VAL, +- XFRMA_REPLAY_THRESH, +- XFRMA_ETIMER_THRESH, +- XFRMA_SRCADDR, /* xfrm_address_t */ +- XFRMA_COADDR, /* xfrm_address_t */ +- XFRMA_LASTUSED, /* unsigned long */ +- XFRMA_POLICY_TYPE, /* struct xfrm_userpolicy_type */ +- XFRMA_MIGRATE, +- XFRMA_ALG_AEAD, /* struct xfrm_algo_aead */ +- XFRMA_KMADDRESS, /* struct xfrm_user_kmaddress */ +- XFRMA_ALG_AUTH_TRUNC, /* struct xfrm_algo_auth */ +- XFRMA_MARK, /* struct xfrm_mark */ +- XFRMA_TFCPAD, /* __u32 */ +- XFRMA_REPLAY_ESN_VAL, /* struct xfrm_replay_state_esn */ +- XFRMA_SA_EXTRA_FLAGS, /* __u32 */ +- XFRMA_PROTO, /* __u8 */ +- XFRMA_ADDRESS_FILTER, /* struct xfrm_address_filter */ +- XFRMA_PAD, +- XFRMA_OFFLOAD_DEV, /* struct xfrm_state_offload */ +- XFRMA_OUTPUT_MARK, /* __u32 */ +- __XFRMA_MAX +- +-#define XFRMA_MAX (__XFRMA_MAX - 1) +-}; +- +-struct xfrm_mark { +- __u32 v; /* value */ +- __u32 m; /* mask */ +-}; +- +-enum xfrm_sadattr_type_t { +- XFRMA_SAD_UNSPEC, +- XFRMA_SAD_CNT, +- XFRMA_SAD_HINFO, +- __XFRMA_SAD_MAX +- +-#define XFRMA_SAD_MAX (__XFRMA_SAD_MAX - 1) +-}; +- +-struct xfrmu_sadhinfo { +- __u32 sadhcnt; /* current hash bkts */ +- __u32 sadhmcnt; /* max allowed hash bkts */ +-}; +- +-enum xfrm_spdattr_type_t { +- XFRMA_SPD_UNSPEC, +- XFRMA_SPD_INFO, +- XFRMA_SPD_HINFO, +- XFRMA_SPD_IPV4_HTHRESH, +- XFRMA_SPD_IPV6_HTHRESH, +- __XFRMA_SPD_MAX +- +-#define XFRMA_SPD_MAX (__XFRMA_SPD_MAX - 1) +-}; +- +-struct xfrmu_spdinfo { +- __u32 incnt; +- __u32 outcnt; +- __u32 fwdcnt; +- __u32 inscnt; +- __u32 outscnt; +- __u32 fwdscnt; +-}; +- +-struct xfrmu_spdhinfo { +- __u32 spdhcnt; +- __u32 spdhmcnt; +-}; +- +-struct xfrmu_spdhthresh { +- __u8 lbits; +- __u8 rbits; +-}; +- +-struct xfrm_usersa_info { +- struct xfrm_selector sel; +- struct xfrm_id id; +- xfrm_address_t saddr; +- struct xfrm_lifetime_cfg lft; +- struct xfrm_lifetime_cur curlft; +- struct xfrm_stats stats; +- __u32 seq; +- __u32 reqid; +- __u16 family; +- __u8 mode; /* XFRM_MODE_xxx */ +- __u8 replay_window; +- __u8 flags; +-#define XFRM_STATE_NOECN 1 +-#define XFRM_STATE_DECAP_DSCP 2 +-#define XFRM_STATE_NOPMTUDISC 4 +-#define XFRM_STATE_WILDRECV 8 +-#define XFRM_STATE_ICMP 16 +-#define XFRM_STATE_AF_UNSPEC 32 +-#define XFRM_STATE_ALIGN4 64 +-#define XFRM_STATE_ESN 128 +-}; +- +-#define XFRM_SA_XFLAG_DONT_ENCAP_DSCP 1 +- +-struct xfrm_usersa_id { +- xfrm_address_t daddr; +- __be32 spi; +- __u16 family; +- __u8 proto; +-}; +- +-struct xfrm_aevent_id { +- struct xfrm_usersa_id sa_id; +- xfrm_address_t saddr; +- __u32 flags; +- __u32 reqid; +-}; +- +-struct xfrm_userspi_info { +- struct xfrm_usersa_info info; +- __u32 min; +- __u32 max; +-}; +- +-struct xfrm_userpolicy_info { +- struct xfrm_selector sel; +- struct xfrm_lifetime_cfg lft; +- struct xfrm_lifetime_cur curlft; +- __u32 priority; +- __u32 index; +- __u8 dir; +- __u8 action; +-#define XFRM_POLICY_ALLOW 0 +-#define XFRM_POLICY_BLOCK 1 +- __u8 flags; +-#define XFRM_POLICY_LOCALOK 1 /* Allow user to override global policy */ +- /* Automatically expand selector to include matching ICMP payloads. */ +-#define XFRM_POLICY_ICMP 2 +- __u8 share; +-}; +- +-struct xfrm_userpolicy_id { +- struct xfrm_selector sel; +- __u32 index; +- __u8 dir; +-}; +- +-struct xfrm_user_acquire { +- struct xfrm_id id; +- xfrm_address_t saddr; +- struct xfrm_selector sel; +- struct xfrm_userpolicy_info policy; +- __u32 aalgos; +- __u32 ealgos; +- __u32 calgos; +- __u32 seq; +-}; +- +-struct xfrm_user_expire { +- struct xfrm_usersa_info state; +- __u8 hard; +-}; +- +-struct xfrm_user_polexpire { +- struct xfrm_userpolicy_info pol; +- __u8 hard; +-}; +- +-struct xfrm_usersa_flush { +- __u8 proto; +-}; +- +-struct xfrm_user_report { +- __u8 proto; +- struct xfrm_selector sel; +-}; +- +-/* Used by MIGRATE to pass addresses IKE should use to perform +- * SA negotiation with the peer */ +-struct xfrm_user_kmaddress { +- xfrm_address_t local; +- xfrm_address_t remote; +- __u32 reserved; +- __u16 family; +-}; +- +-struct xfrm_user_migrate { +- xfrm_address_t old_daddr; +- xfrm_address_t old_saddr; +- xfrm_address_t new_daddr; +- xfrm_address_t new_saddr; +- __u8 proto; +- __u8 mode; +- __u16 reserved; +- __u32 reqid; +- __u16 old_family; +- __u16 new_family; +-}; +- +-struct xfrm_user_mapping { +- struct xfrm_usersa_id id; +- __u32 reqid; +- xfrm_address_t old_saddr; +- xfrm_address_t new_saddr; +- __be16 old_sport; +- __be16 new_sport; +-}; +- +-struct xfrm_address_filter { +- xfrm_address_t saddr; +- xfrm_address_t daddr; +- __u16 family; +- __u8 splen; +- __u8 dplen; +-}; +- +-struct xfrm_user_offload { +- int ifindex; +- __u8 flags; +-}; +-#define XFRM_OFFLOAD_IPV6 1 +-#define XFRM_OFFLOAD_INBOUND 2 +- +-/* backwards compatibility for userspace */ +-#define XFRMGRP_ACQUIRE 1 +-#define XFRMGRP_EXPIRE 2 +-#define XFRMGRP_SA 4 +-#define XFRMGRP_POLICY 8 +-#define XFRMGRP_REPORT 0x20 +- +-enum xfrm_nlgroups { +- XFRMNLGRP_NONE, +-#define XFRMNLGRP_NONE XFRMNLGRP_NONE +- XFRMNLGRP_ACQUIRE, +-#define XFRMNLGRP_ACQUIRE XFRMNLGRP_ACQUIRE +- XFRMNLGRP_EXPIRE, +-#define XFRMNLGRP_EXPIRE XFRMNLGRP_EXPIRE +- XFRMNLGRP_SA, +-#define XFRMNLGRP_SA XFRMNLGRP_SA +- XFRMNLGRP_POLICY, +-#define XFRMNLGRP_POLICY XFRMNLGRP_POLICY +- XFRMNLGRP_AEVENTS, +-#define XFRMNLGRP_AEVENTS XFRMNLGRP_AEVENTS +- XFRMNLGRP_REPORT, +-#define XFRMNLGRP_REPORT XFRMNLGRP_REPORT +- XFRMNLGRP_MIGRATE, +-#define XFRMNLGRP_MIGRATE XFRMNLGRP_MIGRATE +- XFRMNLGRP_MAPPING, +-#define XFRMNLGRP_MAPPING XFRMNLGRP_MAPPING +- __XFRMNLGRP_MAX +-}; +-#define XFRMNLGRP_MAX (__XFRMNLGRP_MAX - 1) +- +-#endif /* _LINUX_XFRM_H */ +diff --git a/include/uapi/linux/atm.h b/include/uapi/linux/atm.h +new file mode 100644 +index 0000000..08e27be +--- /dev/null ++++ b/include/uapi/linux/atm.h +@@ -0,0 +1,241 @@ ++/* atm.h - general ATM declarations */ ++ ++/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ ++ ++ ++/* ++ * WARNING: User-space programs should not #include directly. ++ * Instead, #include ++ */ ++ ++#ifndef _LINUX_ATM_H ++#define _LINUX_ATM_H ++ ++/* ++ * BEGIN_xx and END_xx markers are used for automatic generation of ++ * documentation. Do not change them. ++ */ ++ ++ ++#include ++#include ++#include ++#include ++ ++ ++/* general ATM constants */ ++#define ATM_CELL_SIZE 53 /* ATM cell size incl. header */ ++#define ATM_CELL_PAYLOAD 48 /* ATM payload size */ ++#define ATM_AAL0_SDU 52 /* AAL0 SDU size */ ++#define ATM_MAX_AAL34_PDU 65535 /* maximum AAL3/4 PDU payload */ ++#define ATM_AAL5_TRAILER 8 /* AAL5 trailer size */ ++#define ATM_MAX_AAL5_PDU 65535 /* maximum AAL5 PDU payload */ ++#define ATM_MAX_CDV 9999 /* maximum (default) CDV */ ++#define ATM_NOT_RSV_VCI 32 /* first non-reserved VCI value */ ++ ++#define ATM_MAX_VPI 255 /* maximum VPI at the UNI */ ++#define ATM_MAX_VPI_NNI 4096 /* maximum VPI at the NNI */ ++#define ATM_MAX_VCI 65535 /* maximum VCI */ ++ ++ ++/* "protcol" values for the socket system call */ ++#define ATM_NO_AAL 0 /* AAL not specified */ ++#define ATM_AAL0 13 /* "raw" ATM cells */ ++#define ATM_AAL1 1 /* AAL1 (CBR) */ ++#define ATM_AAL2 2 /* AAL2 (VBR) */ ++#define ATM_AAL34 3 /* AAL3/4 (data) */ ++#define ATM_AAL5 5 /* AAL5 (data) */ ++ ++/* ++ * socket option name coding functions ++ * ++ * Note that __SO_ENCODE and __SO_LEVEL are somewhat a hack since the ++ * << 22 only reserves 9 bits for the level. On some architectures ++ * SOL_SOCKET is 0xFFFF, so that's a bit of a problem ++ */ ++ ++#define __SO_ENCODE(l,n,t) ((((l) & 0x1FF) << 22) | ((n) << 16) | \ ++ sizeof(t)) ++#define __SO_LEVEL_MATCH(c,m) (((c) >> 22) == ((m) & 0x1FF)) ++#define __SO_NUMBER(c) (((c) >> 16) & 0x3f) ++#define __SO_SIZE(c) ((c) & 0x3fff) ++ ++/* ++ * ATM layer ++ */ ++ ++#define SO_SETCLP __SO_ENCODE(SOL_ATM,0,int) ++ /* set CLP bit value - TODO */ ++#define SO_CIRANGE __SO_ENCODE(SOL_ATM,1,struct atm_cirange) ++ /* connection identifier range; socket must be ++ bound or connected */ ++#define SO_ATMQOS __SO_ENCODE(SOL_ATM,2,struct atm_qos) ++ /* Quality of Service setting */ ++#define SO_ATMSAP __SO_ENCODE(SOL_ATM,3,struct atm_sap) ++ /* Service Access Point */ ++#define SO_ATMPVC __SO_ENCODE(SOL_ATM,4,struct sockaddr_atmpvc) ++ /* "PVC" address (also for SVCs); get only */ ++#define SO_MULTIPOINT __SO_ENCODE(SOL_ATM, 5, int) ++ /* make this vc a p2mp */ ++ ++ ++/* ++ * Note @@@: since the socket layers don't really distinguish the control and ++ * the data plane but generally seems to be data plane-centric, any layer is ++ * about equally wrong for the SAP. If you have a better idea about this, ++ * please speak up ... ++ */ ++ ++ ++/* ATM cell header (for AAL0) */ ++ ++/* BEGIN_CH */ ++#define ATM_HDR_GFC_MASK 0xf0000000 ++#define ATM_HDR_GFC_SHIFT 28 ++#define ATM_HDR_VPI_MASK 0x0ff00000 ++#define ATM_HDR_VPI_SHIFT 20 ++#define ATM_HDR_VCI_MASK 0x000ffff0 ++#define ATM_HDR_VCI_SHIFT 4 ++#define ATM_HDR_PTI_MASK 0x0000000e ++#define ATM_HDR_PTI_SHIFT 1 ++#define ATM_HDR_CLP 0x00000001 ++/* END_CH */ ++ ++ ++/* PTI codings */ ++ ++/* BEGIN_PTI */ ++#define ATM_PTI_US0 0 /* user data cell, congestion not exp, SDU-type 0 */ ++#define ATM_PTI_US1 1 /* user data cell, congestion not exp, SDU-type 1 */ ++#define ATM_PTI_UCES0 2 /* user data cell, cong. experienced, SDU-type 0 */ ++#define ATM_PTI_UCES1 3 /* user data cell, cong. experienced, SDU-type 1 */ ++#define ATM_PTI_SEGF5 4 /* segment OAM F5 flow related cell */ ++#define ATM_PTI_E2EF5 5 /* end-to-end OAM F5 flow related cell */ ++#define ATM_PTI_RSV_RM 6 /* reserved for traffic control/resource mgmt */ ++#define ATM_PTI_RSV 7 /* reserved */ ++/* END_PTI */ ++ ++ ++/* ++ * The following items should stay in linux/atm.h, which should be linked to ++ * netatm/atm.h ++ */ ++ ++/* Traffic description */ ++ ++#define ATM_NONE 0 /* no traffic */ ++#define ATM_UBR 1 ++#define ATM_CBR 2 ++#define ATM_VBR 3 ++#define ATM_ABR 4 ++#define ATM_ANYCLASS 5 /* compatible with everything */ ++ ++#define ATM_MAX_PCR -1 /* maximum available PCR */ ++ ++struct atm_trafprm { ++ unsigned char traffic_class; /* traffic class (ATM_UBR, ...) */ ++ int max_pcr; /* maximum PCR in cells per second */ ++ int pcr; /* desired PCR in cells per second */ ++ int min_pcr; /* minimum PCR in cells per second */ ++ int max_cdv; /* maximum CDV in microseconds */ ++ int max_sdu; /* maximum SDU in bytes */ ++ /* extra params for ABR */ ++ unsigned int icr; /* Initial Cell Rate (24-bit) */ ++ unsigned int tbe; /* Transient Buffer Exposure (24-bit) */ ++ unsigned int frtt : 24; /* Fixed Round Trip Time (24-bit) */ ++ unsigned int rif : 4; /* Rate Increment Factor (4-bit) */ ++ unsigned int rdf : 4; /* Rate Decrease Factor (4-bit) */ ++ unsigned int nrm_pres :1; /* nrm present bit */ ++ unsigned int trm_pres :1; /* rm present bit */ ++ unsigned int adtf_pres :1; /* adtf present bit */ ++ unsigned int cdf_pres :1; /* cdf present bit*/ ++ unsigned int nrm :3; /* Max # of Cells for each forward RM cell (3-bit) */ ++ unsigned int trm :3; /* Time between forward RM cells (3-bit) */ ++ unsigned int adtf :10; /* ACR Decrease Time Factor (10-bit) */ ++ unsigned int cdf :3; /* Cutoff Decrease Factor (3-bit) */ ++ unsigned int spare :9; /* spare bits */ ++}; ++ ++struct atm_qos { ++ struct atm_trafprm txtp; /* parameters in TX direction */ ++ struct atm_trafprm rxtp __ATM_API_ALIGN; ++ /* parameters in RX direction */ ++ unsigned char aal __ATM_API_ALIGN; ++}; ++ ++/* PVC addressing */ ++ ++#define ATM_ITF_ANY -1 /* "magic" PVC address values */ ++#define ATM_VPI_ANY -1 ++#define ATM_VCI_ANY -1 ++#define ATM_VPI_UNSPEC -2 ++#define ATM_VCI_UNSPEC -2 ++ ++ ++struct sockaddr_atmpvc { ++ unsigned short sap_family; /* address family, AF_ATMPVC */ ++ struct { /* PVC address */ ++ short itf; /* ATM interface */ ++ short vpi; /* VPI (only 8 bits at UNI) */ ++ int vci; /* VCI (only 16 bits at UNI) */ ++ } sap_addr __ATM_API_ALIGN; /* PVC address */ ++}; ++ ++/* SVC addressing */ ++ ++#define ATM_ESA_LEN 20 /* ATM End System Address length */ ++#define ATM_E164_LEN 12 /* maximum E.164 number length */ ++ ++#define ATM_AFI_DCC 0x39 /* DCC ATM Format */ ++#define ATM_AFI_ICD 0x47 /* ICD ATM Format */ ++#define ATM_AFI_E164 0x45 /* E.164 ATM Format */ ++#define ATM_AFI_LOCAL 0x49 /* Local ATM Format */ ++ ++#define ATM_AFI_DCC_GROUP 0xBD /* DCC ATM Group Format */ ++#define ATM_AFI_ICD_GROUP 0xC5 /* ICD ATM Group Format */ ++#define ATM_AFI_E164_GROUP 0xC3 /* E.164 ATM Group Format */ ++#define ATM_AFI_LOCAL_GROUP 0xC7 /* Local ATM Group Format */ ++ ++#define ATM_LIJ_NONE 0 /* no leaf-initiated join */ ++#define ATM_LIJ 1 /* request joining */ ++#define ATM_LIJ_RPJ 2 /* set to root-prompted join */ ++#define ATM_LIJ_NJ 3 /* set to network join */ ++ ++ ++struct sockaddr_atmsvc { ++ unsigned short sas_family; /* address family, AF_ATMSVC */ ++ struct { /* SVC address */ ++ unsigned char prv[ATM_ESA_LEN];/* private ATM address */ ++ char pub[ATM_E164_LEN+1]; /* public address (E.164) */ ++ /* unused addresses must be bzero'ed */ ++ char lij_type; /* role in LIJ call; one of ATM_LIJ* */ ++ __u32 lij_id; /* LIJ call identifier */ ++ } sas_addr __ATM_API_ALIGN; /* SVC address */ ++}; ++ ++ ++static __inline__ int atmsvc_addr_in_use(struct sockaddr_atmsvc addr) ++{ ++ return *addr.sas_addr.prv || *addr.sas_addr.pub; ++} ++ ++ ++static __inline__ int atmpvc_addr_in_use(struct sockaddr_atmpvc addr) ++{ ++ return addr.sap_addr.itf || addr.sap_addr.vpi || addr.sap_addr.vci; ++} ++ ++ ++/* ++ * Some stuff for linux/sockios.h ++ */ ++ ++struct atmif_sioc { ++ int number; ++ int length; ++ void *arg; ++}; ++ ++ ++typedef unsigned short atm_backend_t; ++#endif /* _LINUX_ATM_H */ +diff --git a/include/uapi/linux/atmapi.h b/include/uapi/linux/atmapi.h +new file mode 100644 +index 0000000..8fe54d9 +--- /dev/null ++++ b/include/uapi/linux/atmapi.h +@@ -0,0 +1,29 @@ ++/* atmapi.h - ATM API user space/kernel compatibility */ ++ ++/* Written 1999,2000 by Werner Almesberger, EPFL ICA */ ++ ++ ++#ifndef _LINUX_ATMAPI_H ++#define _LINUX_ATMAPI_H ++ ++#if defined(__sparc__) || defined(__ia64__) ++/* such alignment is not required on 32 bit sparcs, but we can't ++ figure that we are on a sparc64 while compiling user-space programs. */ ++#define __ATM_API_ALIGN __attribute__((aligned(8))) ++#else ++#define __ATM_API_ALIGN ++#endif ++ ++ ++/* ++ * Opaque type for kernel pointers. Note that _ is never accessed. We need ++ * the struct in order hide the array, so that we can make simple assignments ++ * instead of being forced to use memcpy. It also improves error reporting for ++ * code that still assumes that we're passing unsigned longs. ++ * ++ * Convention: NULL pointers are passed as a field of all zeroes. ++ */ ++ ++typedef struct { unsigned char _[8]; } __ATM_API_ALIGN atm_kptr_t; ++ ++#endif +diff --git a/include/uapi/linux/atmarp.h b/include/uapi/linux/atmarp.h +new file mode 100644 +index 0000000..231f4bd +--- /dev/null ++++ b/include/uapi/linux/atmarp.h +@@ -0,0 +1,41 @@ ++/* atmarp.h - ATM ARP protocol and kernel-demon interface definitions */ ++ ++/* Written 1995-1999 by Werner Almesberger, EPFL LRC/ICA */ ++ ++ ++#ifndef _LINUX_ATMARP_H ++#define _LINUX_ATMARP_H ++ ++#include ++#include ++#include ++ ++ ++#define ATMARP_RETRY_DELAY 30 /* request next resolution or forget ++ NAK after 30 sec - should go into ++ atmclip.h */ ++#define ATMARP_MAX_UNRES_PACKETS 5 /* queue that many packets while ++ waiting for the resolver */ ++ ++ ++#define ATMARPD_CTRL _IO('a',ATMIOC_CLIP+1) /* become atmarpd ctrl sock */ ++#define ATMARP_MKIP _IO('a',ATMIOC_CLIP+2) /* attach socket to IP */ ++#define ATMARP_SETENTRY _IO('a',ATMIOC_CLIP+3) /* fill or hide ARP entry */ ++#define ATMARP_ENCAP _IO('a',ATMIOC_CLIP+5) /* change encapsulation */ ++ ++ ++enum atmarp_ctrl_type { ++ act_invalid, /* catch uninitialized structures */ ++ act_need, /* need address resolution */ ++ act_up, /* interface is coming up */ ++ act_down, /* interface is going down */ ++ act_change /* interface configuration has changed */ ++}; ++ ++struct atmarp_ctrl { ++ enum atmarp_ctrl_type type; /* message type */ ++ int itf_num;/* interface number (if present) */ ++ __be32 ip; /* IP address (act_need only) */ ++}; ++ ++#endif +diff --git a/include/uapi/linux/atmdev.h b/include/uapi/linux/atmdev.h +new file mode 100644 +index 0000000..8faa8b9 +--- /dev/null ++++ b/include/uapi/linux/atmdev.h +@@ -0,0 +1,215 @@ ++/* atmdev.h - ATM device driver declarations and various related items */ ++ ++/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ ++ ++ ++#ifndef LINUX_ATMDEV_H ++#define LINUX_ATMDEV_H ++ ++ ++#include ++#include ++#include ++ ++ ++#define ESI_LEN 6 ++ ++#define ATM_OC3_PCR (155520000/270*260/8/53) ++ /* OC3 link rate: 155520000 bps ++ SONET overhead: /270*260 (9 section, 1 path) ++ bits per cell: /8/53 ++ max cell rate: 353207.547 cells/sec */ ++#define ATM_25_PCR ((25600000/8-8000)/54) ++ /* 25 Mbps ATM cell rate (59111) */ ++#define ATM_OC12_PCR (622080000/1080*1040/8/53) ++ /* OC12 link rate: 622080000 bps ++ SONET overhead: /1080*1040 ++ bits per cell: /8/53 ++ max cell rate: 1412830.188 cells/sec */ ++#define ATM_DS3_PCR (8000*12) ++ /* DS3: 12 cells in a 125 usec time slot */ ++ ++ ++#define __AAL_STAT_ITEMS \ ++ __HANDLE_ITEM(tx); /* TX okay */ \ ++ __HANDLE_ITEM(tx_err); /* TX errors */ \ ++ __HANDLE_ITEM(rx); /* RX okay */ \ ++ __HANDLE_ITEM(rx_err); /* RX errors */ \ ++ __HANDLE_ITEM(rx_drop); /* RX out of memory */ ++ ++struct atm_aal_stats { ++#define __HANDLE_ITEM(i) int i ++ __AAL_STAT_ITEMS ++#undef __HANDLE_ITEM ++}; ++ ++ ++struct atm_dev_stats { ++ struct atm_aal_stats aal0; ++ struct atm_aal_stats aal34; ++ struct atm_aal_stats aal5; ++} __ATM_API_ALIGN; ++ ++ ++#define ATM_GETLINKRATE _IOW('a',ATMIOC_ITF+1,struct atmif_sioc) ++ /* get link rate */ ++#define ATM_GETNAMES _IOW('a',ATMIOC_ITF+3,struct atm_iobuf) ++ /* get interface names (numbers) */ ++#define ATM_GETTYPE _IOW('a',ATMIOC_ITF+4,struct atmif_sioc) ++ /* get interface type name */ ++#define ATM_GETESI _IOW('a',ATMIOC_ITF+5,struct atmif_sioc) ++ /* get interface ESI */ ++#define ATM_GETADDR _IOW('a',ATMIOC_ITF+6,struct atmif_sioc) ++ /* get itf's local ATM addr. list */ ++#define ATM_RSTADDR _IOW('a',ATMIOC_ITF+7,struct atmif_sioc) ++ /* reset itf's ATM address list */ ++#define ATM_ADDADDR _IOW('a',ATMIOC_ITF+8,struct atmif_sioc) ++ /* add a local ATM address */ ++#define ATM_DELADDR _IOW('a',ATMIOC_ITF+9,struct atmif_sioc) ++ /* remove a local ATM address */ ++#define ATM_GETCIRANGE _IOW('a',ATMIOC_ITF+10,struct atmif_sioc) ++ /* get connection identifier range */ ++#define ATM_SETCIRANGE _IOW('a',ATMIOC_ITF+11,struct atmif_sioc) ++ /* set connection identifier range */ ++#define ATM_SETESI _IOW('a',ATMIOC_ITF+12,struct atmif_sioc) ++ /* set interface ESI */ ++#define ATM_SETESIF _IOW('a',ATMIOC_ITF+13,struct atmif_sioc) ++ /* force interface ESI */ ++#define ATM_ADDLECSADDR _IOW('a', ATMIOC_ITF+14, struct atmif_sioc) ++ /* register a LECS address */ ++#define ATM_DELLECSADDR _IOW('a', ATMIOC_ITF+15, struct atmif_sioc) ++ /* unregister a LECS address */ ++#define ATM_GETLECSADDR _IOW('a', ATMIOC_ITF+16, struct atmif_sioc) ++ /* retrieve LECS address(es) */ ++ ++#define ATM_GETSTAT _IOW('a',ATMIOC_SARCOM+0,struct atmif_sioc) ++ /* get AAL layer statistics */ ++#define ATM_GETSTATZ _IOW('a',ATMIOC_SARCOM+1,struct atmif_sioc) ++ /* get AAL layer statistics and zero */ ++#define ATM_GETLOOP _IOW('a',ATMIOC_SARCOM+2,struct atmif_sioc) ++ /* get loopback mode */ ++#define ATM_SETLOOP _IOW('a',ATMIOC_SARCOM+3,struct atmif_sioc) ++ /* set loopback mode */ ++#define ATM_QUERYLOOP _IOW('a',ATMIOC_SARCOM+4,struct atmif_sioc) ++ /* query supported loopback modes */ ++#define ATM_SETSC _IOW('a',ATMIOC_SPECIAL+1,int) ++ /* enable or disable single-copy */ ++#define ATM_SETBACKEND _IOW('a',ATMIOC_SPECIAL+2,atm_backend_t) ++ /* set backend handler */ ++#define ATM_NEWBACKENDIF _IOW('a',ATMIOC_SPECIAL+3,atm_backend_t) ++ /* use backend to make new if */ ++#define ATM_ADDPARTY _IOW('a', ATMIOC_SPECIAL+4,struct atm_iobuf) ++ /* add party to p2mp call */ ++#ifdef CONFIG_COMPAT ++/* It actually takes struct sockaddr_atmsvc, not struct atm_iobuf */ ++#define COMPAT_ATM_ADDPARTY _IOW('a', ATMIOC_SPECIAL+4,struct compat_atm_iobuf) ++#endif ++#define ATM_DROPPARTY _IOW('a', ATMIOC_SPECIAL+5,int) ++ /* drop party from p2mp call */ ++ ++/* ++ * These are backend handkers that can be set via the ATM_SETBACKEND call ++ * above. In the future we may support dynamic loading of these - for now, ++ * they're just being used to share the ATMIOC_BACKEND ioctls ++ */ ++#define ATM_BACKEND_RAW 0 ++#define ATM_BACKEND_PPP 1 /* PPPoATM - RFC2364 */ ++#define ATM_BACKEND_BR2684 2 /* Bridged RFC1483/2684 */ ++ ++/* for ATM_GETTYPE */ ++#define ATM_ITFTYP_LEN 8 /* maximum length of interface type name */ ++ ++/* ++ * Loopback modes for ATM_{PHY,SAR}_{GET,SET}LOOP ++ */ ++ ++/* Point of loopback CPU-->SAR-->PHY-->line--> ... */ ++#define __ATM_LM_NONE 0 /* no loop back ^ ^ ^ ^ */ ++#define __ATM_LM_AAL 1 /* loop back PDUs --' | | | */ ++#define __ATM_LM_ATM 2 /* loop back ATM cells ---' | | */ ++/* RESERVED 4 loop back on PHY side ---' */ ++#define __ATM_LM_PHY 8 /* loop back bits (digital) ----' | */ ++#define __ATM_LM_ANALOG 16 /* loop back the analog signal --------' */ ++ ++/* Direction of loopback */ ++#define __ATM_LM_MKLOC(n) ((n)) /* Local (i.e. loop TX to RX) */ ++#define __ATM_LM_MKRMT(n) ((n) << 8) /* Remote (i.e. loop RX to TX) */ ++ ++#define __ATM_LM_XTLOC(n) ((n) & 0xff) ++#define __ATM_LM_XTRMT(n) (((n) >> 8) & 0xff) ++ ++#define ATM_LM_NONE 0 /* no loopback */ ++ ++#define ATM_LM_LOC_AAL __ATM_LM_MKLOC(__ATM_LM_AAL) ++#define ATM_LM_LOC_ATM __ATM_LM_MKLOC(__ATM_LM_ATM) ++#define ATM_LM_LOC_PHY __ATM_LM_MKLOC(__ATM_LM_PHY) ++#define ATM_LM_LOC_ANALOG __ATM_LM_MKLOC(__ATM_LM_ANALOG) ++ ++#define ATM_LM_RMT_AAL __ATM_LM_MKRMT(__ATM_LM_AAL) ++#define ATM_LM_RMT_ATM __ATM_LM_MKRMT(__ATM_LM_ATM) ++#define ATM_LM_RMT_PHY __ATM_LM_MKRMT(__ATM_LM_PHY) ++#define ATM_LM_RMT_ANALOG __ATM_LM_MKRMT(__ATM_LM_ANALOG) ++ ++/* ++ * Note: ATM_LM_LOC_* and ATM_LM_RMT_* can be combined, provided that ++ * __ATM_LM_XTLOC(x) <= __ATM_LM_XTRMT(x) ++ */ ++ ++ ++struct atm_iobuf { ++ int length; ++ void *buffer; ++}; ++ ++/* for ATM_GETCIRANGE / ATM_SETCIRANGE */ ++ ++#define ATM_CI_MAX -1 /* use maximum range of VPI/VCI */ ++ ++struct atm_cirange { ++ signed char vpi_bits; /* 1..8, ATM_CI_MAX (-1) for maximum */ ++ signed char vci_bits; /* 1..16, ATM_CI_MAX (-1) for maximum */ ++}; ++ ++/* for ATM_SETSC; actually taken from the ATM_VF number space */ ++ ++#define ATM_SC_RX 1024 /* enable RX single-copy */ ++#define ATM_SC_TX 2048 /* enable TX single-copy */ ++ ++#define ATM_BACKLOG_DEFAULT 32 /* if we get more, we're likely to time out ++ anyway */ ++ ++/* MF: change_qos (Modify) flags */ ++ ++#define ATM_MF_IMMED 1 /* Block until change is effective */ ++#define ATM_MF_INC_RSV 2 /* Change reservation on increase */ ++#define ATM_MF_INC_SHP 4 /* Change shaping on increase */ ++#define ATM_MF_DEC_RSV 8 /* Change reservation on decrease */ ++#define ATM_MF_DEC_SHP 16 /* Change shaping on decrease */ ++#define ATM_MF_BWD 32 /* Set the backward direction parameters */ ++ ++#define ATM_MF_SET (ATM_MF_INC_RSV | ATM_MF_INC_SHP | ATM_MF_DEC_RSV | \ ++ ATM_MF_DEC_SHP | ATM_MF_BWD) ++ ++/* ++ * ATM_VS_* are used to express VC state in a human-friendly way. ++ */ ++ ++#define ATM_VS_IDLE 0 /* VC is not used */ ++#define ATM_VS_CONNECTED 1 /* VC is connected */ ++#define ATM_VS_CLOSING 2 /* VC is closing */ ++#define ATM_VS_LISTEN 3 /* VC is listening for incoming setups */ ++#define ATM_VS_INUSE 4 /* VC is in use (registered with atmsigd) */ ++#define ATM_VS_BOUND 5 /* VC is bound */ ++ ++#define ATM_VS2TXT_MAP \ ++ "IDLE", "CONNECTED", "CLOSING", "LISTEN", "INUSE", "BOUND" ++ ++#define ATM_VF2TXT_MAP \ ++ "ADDR", "READY", "PARTIAL", "REGIS", \ ++ "RELEASED", "HASQOS", "LISTEN", "META", \ ++ "256", "512", "1024", "2048", \ ++ "SESSION", "HASSAP", "BOUND", "CLOSE" ++ ++ ++ ++#endif /* LINUX_ATMDEV_H */ +diff --git a/include/uapi/linux/atmioc.h b/include/uapi/linux/atmioc.h +new file mode 100644 +index 0000000..37f67aa +--- /dev/null ++++ b/include/uapi/linux/atmioc.h +@@ -0,0 +1,41 @@ ++/* atmioc.h - ranges for ATM-related ioctl numbers */ ++ ++/* Written 1995-1999 by Werner Almesberger, EPFL LRC/ICA */ ++ ++ ++/* ++ * See http://icawww1.epfl.ch/linux-atm/magic.html for the complete list of ++ * "magic" ioctl numbers. ++ */ ++ ++ ++#ifndef _LINUX_ATMIOC_H ++#define _LINUX_ATMIOC_H ++ ++#include ++ /* everybody including atmioc.h will also need _IO{,R,W,WR} */ ++ ++#define ATMIOC_PHYCOM 0x00 /* PHY device common ioctls, globally unique */ ++#define ATMIOC_PHYCOM_END 0x0f ++#define ATMIOC_PHYTYP 0x10 /* PHY dev type ioctls, unique per PHY type */ ++#define ATMIOC_PHYTYP_END 0x2f ++#define ATMIOC_PHYPRV 0x30 /* PHY dev private ioctls, unique per driver */ ++#define ATMIOC_PHYPRV_END 0x4f ++#define ATMIOC_SARCOM 0x50 /* SAR device common ioctls, globally unique */ ++#define ATMIOC_SARCOM_END 0x50 ++#define ATMIOC_SARPRV 0x60 /* SAR dev private ioctls, unique per driver */ ++#define ATMIOC_SARPRV_END 0x7f ++#define ATMIOC_ITF 0x80 /* Interface ioctls, globally unique */ ++#define ATMIOC_ITF_END 0x8f ++#define ATMIOC_BACKEND 0x90 /* ATM generic backend ioctls, u. per backend */ ++#define ATMIOC_BACKEND_END 0xaf ++/* 0xb0-0xbf: Reserved for future use */ ++#define ATMIOC_AREQUIPA 0xc0 /* Application requested IP over ATM, glob. u. */ ++#define ATMIOC_LANE 0xd0 /* LAN Emulation, globally unique */ ++#define ATMIOC_MPOA 0xd8 /* MPOA, globally unique */ ++#define ATMIOC_CLIP 0xe0 /* Classical IP over ATM control, globally u. */ ++#define ATMIOC_CLIP_END 0xef ++#define ATMIOC_SPECIAL 0xf0 /* Special-purpose controls, globally unique */ ++#define ATMIOC_SPECIAL_END 0xff ++ ++#endif +diff --git a/include/uapi/linux/atmsap.h b/include/uapi/linux/atmsap.h +new file mode 100644 +index 0000000..799b104 +--- /dev/null ++++ b/include/uapi/linux/atmsap.h +@@ -0,0 +1,162 @@ ++/* atmsap.h - ATM Service Access Point addressing definitions */ ++ ++/* Written 1995-1999 by Werner Almesberger, EPFL LRC/ICA */ ++ ++ ++#ifndef _LINUX_ATMSAP_H ++#define _LINUX_ATMSAP_H ++ ++#include ++ ++/* ++ * BEGIN_xx and END_xx markers are used for automatic generation of ++ * documentation. Do not change them. ++ */ ++ ++ ++/* ++ * Layer 2 protocol identifiers ++ */ ++ ++/* BEGIN_L2 */ ++#define ATM_L2_NONE 0 /* L2 not specified */ ++#define ATM_L2_ISO1745 0x01 /* Basic mode ISO 1745 */ ++#define ATM_L2_Q291 0x02 /* ITU-T Q.291 (Rec. I.441) */ ++#define ATM_L2_X25_LL 0x06 /* ITU-T X.25, link layer */ ++#define ATM_L2_X25_ML 0x07 /* ITU-T X.25, multilink */ ++#define ATM_L2_LAPB 0x08 /* Extended LAPB, half-duplex (Rec. T.71) */ ++#define ATM_L2_HDLC_ARM 0x09 /* HDLC ARM (ISO/IEC 4335) */ ++#define ATM_L2_HDLC_NRM 0x0a /* HDLC NRM (ISO/IEC 4335) */ ++#define ATM_L2_HDLC_ABM 0x0b /* HDLC ABM (ISO/IEC 4335) */ ++#define ATM_L2_ISO8802 0x0c /* LAN LLC (ISO/IEC 8802/2) */ ++#define ATM_L2_X75 0x0d /* ITU-T X.75, SLP */ ++#define ATM_L2_Q922 0x0e /* ITU-T Q.922 */ ++#define ATM_L2_USER 0x10 /* user-specified */ ++#define ATM_L2_ISO7776 0x11 /* ISO 7776 DTE-DTE */ ++/* END_L2 */ ++ ++ ++/* ++ * Layer 3 protocol identifiers ++ */ ++ ++/* BEGIN_L3 */ ++#define ATM_L3_NONE 0 /* L3 not specified */ ++#define ATM_L3_X25 0x06 /* ITU-T X.25, packet layer */ ++#define ATM_L3_ISO8208 0x07 /* ISO/IEC 8208 */ ++#define ATM_L3_X223 0x08 /* ITU-T X.223 | ISO/IEC 8878 */ ++#define ATM_L3_ISO8473 0x09 /* ITU-T X.233 | ISO/IEC 8473 */ ++#define ATM_L3_T70 0x0a /* ITU-T T.70 minimum network layer */ ++#define ATM_L3_TR9577 0x0b /* ISO/IEC TR 9577 */ ++#define ATM_L3_H310 0x0c /* ITU-T Recommendation H.310 */ ++#define ATM_L3_H321 0x0d /* ITU-T Recommendation H.321 */ ++#define ATM_L3_USER 0x10 /* user-specified */ ++/* END_L3 */ ++ ++ ++/* ++ * High layer identifiers ++ */ ++ ++/* BEGIN_HL */ ++#define ATM_HL_NONE 0 /* HL not specified */ ++#define ATM_HL_ISO 0x01 /* ISO */ ++#define ATM_HL_USER 0x02 /* user-specific */ ++#define ATM_HL_HLP 0x03 /* high layer profile - UNI 3.0 only */ ++#define ATM_HL_VENDOR 0x04 /* vendor-specific application identifier */ ++/* END_HL */ ++ ++ ++/* ++ * ITU-T coded mode of operation ++ */ ++ ++/* BEGIN_IMD */ ++#define ATM_IMD_NONE 0 /* mode not specified */ ++#define ATM_IMD_NORMAL 1 /* normal mode of operation */ ++#define ATM_IMD_EXTENDED 2 /* extended mode of operation */ ++/* END_IMD */ ++ ++/* ++ * H.310 code points ++ */ ++ ++#define ATM_TT_NONE 0 /* terminal type not specified */ ++#define ATM_TT_RX 1 /* receive only */ ++#define ATM_TT_TX 2 /* send only */ ++#define ATM_TT_RXTX 3 /* receive and send */ ++ ++#define ATM_MC_NONE 0 /* no multiplexing */ ++#define ATM_MC_TS 1 /* transport stream (TS) */ ++#define ATM_MC_TS_FEC 2 /* transport stream with forward error corr. */ ++#define ATM_MC_PS 3 /* program stream (PS) */ ++#define ATM_MC_PS_FEC 4 /* program stream with forward error corr. */ ++#define ATM_MC_H221 5 /* ITU-T Rec. H.221 */ ++ ++/* ++ * SAP structures ++ */ ++ ++#define ATM_MAX_HLI 8 /* maximum high-layer information length */ ++ ++ ++struct atm_blli { ++ unsigned char l2_proto; /* layer 2 protocol */ ++ union { ++ struct { ++ unsigned char mode; /* mode of operation (ATM_IMD_xxx), 0 if */ ++ /* absent */ ++ unsigned char window; /* window size (k), 1-127 (0 to omit) */ ++ } itu; /* ITU-T encoding */ ++ unsigned char user; /* user-specified l2 information */ ++ } l2; ++ unsigned char l3_proto; /* layer 3 protocol */ ++ union { ++ struct { ++ unsigned char mode; /* mode of operation (ATM_IMD_xxx), 0 if */ ++ /* absent */ ++ unsigned char def_size; /* default packet size (log2), 4-12 (0 to */ ++ /* omit) */ ++ unsigned char window;/* packet window size, 1-127 (0 to omit) */ ++ } itu; /* ITU-T encoding */ ++ unsigned char user; /* user specified l3 information */ ++ struct { /* if l3_proto = ATM_L3_H310 */ ++ unsigned char term_type; /* terminal type */ ++ unsigned char fw_mpx_cap; /* forward multiplexing capability */ ++ /* only if term_type != ATM_TT_NONE */ ++ unsigned char bw_mpx_cap; /* backward multiplexing capability */ ++ /* only if term_type != ATM_TT_NONE */ ++ } h310; ++ struct { /* if l3_proto = ATM_L3_TR9577 */ ++ unsigned char ipi; /* initial protocol id */ ++ unsigned char snap[5];/* IEEE 802.1 SNAP identifier */ ++ /* (only if ipi == NLPID_IEEE802_1_SNAP) */ ++ } tr9577; ++ } l3; ++} __ATM_API_ALIGN; ++ ++ ++struct atm_bhli { ++ unsigned char hl_type; /* high layer information type */ ++ unsigned char hl_length; /* length (only if hl_type == ATM_HL_USER || */ ++ /* hl_type == ATM_HL_ISO) */ ++ unsigned char hl_info[ATM_MAX_HLI];/* high layer information */ ++}; ++ ++ ++#define ATM_MAX_BLLI 3 /* maximum number of BLLI elements */ ++ ++ ++struct atm_sap { ++ struct atm_bhli bhli; /* local SAP, high-layer information */ ++ struct atm_blli blli[ATM_MAX_BLLI] __ATM_API_ALIGN; ++ /* local SAP, low-layer info */ ++}; ++ ++ ++static __inline__ int blli_in_use(struct atm_blli blli) ++{ ++ return blli.l2_proto || blli.l3_proto; ++} ++ ++#endif +diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h +new file mode 100644 +index 0000000..0895a52 +--- /dev/null ++++ b/include/uapi/linux/bpf.h +@@ -0,0 +1,867 @@ ++/* Copyright (c) 2011-2014 PLUMgrid, http://plumgrid.com ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of version 2 of the GNU General Public ++ * License as published by the Free Software Foundation. ++ */ ++#ifndef __LINUX_BPF_H__ ++#define __LINUX_BPF_H__ ++ ++#include ++#include ++ ++/* Extended instruction set based on top of classic BPF */ ++ ++/* instruction classes */ ++#define BPF_ALU64 0x07 /* alu mode in double word width */ ++ ++/* ld/ldx fields */ ++#define BPF_DW 0x18 /* double word */ ++#define BPF_XADD 0xc0 /* exclusive add */ ++ ++/* alu/jmp fields */ ++#define BPF_MOV 0xb0 /* mov reg to reg */ ++#define BPF_ARSH 0xc0 /* sign extending arithmetic shift right */ ++ ++/* change endianness of a register */ ++#define BPF_END 0xd0 /* flags for endianness conversion: */ ++#define BPF_TO_LE 0x00 /* convert to little-endian */ ++#define BPF_TO_BE 0x08 /* convert to big-endian */ ++#define BPF_FROM_LE BPF_TO_LE ++#define BPF_FROM_BE BPF_TO_BE ++ ++/* jmp encodings */ ++#define BPF_JNE 0x50 /* jump != */ ++#define BPF_JLT 0xa0 /* LT is unsigned, '<' */ ++#define BPF_JLE 0xb0 /* LE is unsigned, '<=' */ ++#define BPF_JSGT 0x60 /* SGT is signed '>', GT in x86 */ ++#define BPF_JSGE 0x70 /* SGE is signed '>=', GE in x86 */ ++#define BPF_JSLT 0xc0 /* SLT is signed, '<' */ ++#define BPF_JSLE 0xd0 /* SLE is signed, '<=' */ ++#define BPF_CALL 0x80 /* function call */ ++#define BPF_EXIT 0x90 /* function return */ ++ ++/* Register numbers */ ++enum { ++ BPF_REG_0 = 0, ++ BPF_REG_1, ++ BPF_REG_2, ++ BPF_REG_3, ++ BPF_REG_4, ++ BPF_REG_5, ++ BPF_REG_6, ++ BPF_REG_7, ++ BPF_REG_8, ++ BPF_REG_9, ++ BPF_REG_10, ++ __MAX_BPF_REG, ++}; ++ ++/* BPF has 10 general purpose 64-bit registers and stack frame. */ ++#define MAX_BPF_REG __MAX_BPF_REG ++ ++struct bpf_insn { ++ __u8 code; /* opcode */ ++ __u8 dst_reg:4; /* dest register */ ++ __u8 src_reg:4; /* source register */ ++ __s16 off; /* signed offset */ ++ __s32 imm; /* signed immediate constant */ ++}; ++ ++/* Key of an a BPF_MAP_TYPE_LPM_TRIE entry */ ++struct bpf_lpm_trie_key { ++ __u32 prefixlen; /* up to 32 for AF_INET, 128 for AF_INET6 */ ++ __u8 data[0]; /* Arbitrary size */ ++}; ++ ++/* BPF syscall commands, see bpf(2) man-page for details. */ ++enum bpf_cmd { ++ BPF_MAP_CREATE, ++ BPF_MAP_LOOKUP_ELEM, ++ BPF_MAP_UPDATE_ELEM, ++ BPF_MAP_DELETE_ELEM, ++ BPF_MAP_GET_NEXT_KEY, ++ BPF_PROG_LOAD, ++ BPF_OBJ_PIN, ++ BPF_OBJ_GET, ++ BPF_PROG_ATTACH, ++ BPF_PROG_DETACH, ++ BPF_PROG_TEST_RUN, ++ BPF_PROG_GET_NEXT_ID, ++ BPF_MAP_GET_NEXT_ID, ++ BPF_PROG_GET_FD_BY_ID, ++ BPF_MAP_GET_FD_BY_ID, ++ BPF_OBJ_GET_INFO_BY_FD, ++}; ++ ++enum bpf_map_type { ++ BPF_MAP_TYPE_UNSPEC, ++ BPF_MAP_TYPE_HASH, ++ BPF_MAP_TYPE_ARRAY, ++ BPF_MAP_TYPE_PROG_ARRAY, ++ BPF_MAP_TYPE_PERF_EVENT_ARRAY, ++ BPF_MAP_TYPE_PERCPU_HASH, ++ BPF_MAP_TYPE_PERCPU_ARRAY, ++ BPF_MAP_TYPE_STACK_TRACE, ++ BPF_MAP_TYPE_CGROUP_ARRAY, ++ BPF_MAP_TYPE_LRU_HASH, ++ BPF_MAP_TYPE_LRU_PERCPU_HASH, ++ BPF_MAP_TYPE_LPM_TRIE, ++ BPF_MAP_TYPE_ARRAY_OF_MAPS, ++ BPF_MAP_TYPE_HASH_OF_MAPS, ++ BPF_MAP_TYPE_DEVMAP, ++ BPF_MAP_TYPE_SOCKMAP, ++}; ++ ++enum bpf_prog_type { ++ BPF_PROG_TYPE_UNSPEC, ++ BPF_PROG_TYPE_SOCKET_FILTER, ++ BPF_PROG_TYPE_KPROBE, ++ BPF_PROG_TYPE_SCHED_CLS, ++ BPF_PROG_TYPE_SCHED_ACT, ++ BPF_PROG_TYPE_TRACEPOINT, ++ BPF_PROG_TYPE_XDP, ++ BPF_PROG_TYPE_PERF_EVENT, ++ BPF_PROG_TYPE_CGROUP_SKB, ++ BPF_PROG_TYPE_CGROUP_SOCK, ++ BPF_PROG_TYPE_LWT_IN, ++ BPF_PROG_TYPE_LWT_OUT, ++ BPF_PROG_TYPE_LWT_XMIT, ++ BPF_PROG_TYPE_SOCK_OPS, ++ BPF_PROG_TYPE_SK_SKB, ++}; ++ ++enum bpf_attach_type { ++ BPF_CGROUP_INET_INGRESS, ++ BPF_CGROUP_INET_EGRESS, ++ BPF_CGROUP_INET_SOCK_CREATE, ++ BPF_CGROUP_SOCK_OPS, ++ BPF_SK_SKB_STREAM_PARSER, ++ BPF_SK_SKB_STREAM_VERDICT, ++ __MAX_BPF_ATTACH_TYPE ++}; ++ ++#define MAX_BPF_ATTACH_TYPE __MAX_BPF_ATTACH_TYPE ++ ++/* If BPF_F_ALLOW_OVERRIDE flag is used in BPF_PROG_ATTACH command ++ * to the given target_fd cgroup the descendent cgroup will be able to ++ * override effective bpf program that was inherited from this cgroup ++ */ ++#define BPF_F_ALLOW_OVERRIDE (1U << 0) ++ ++/* If BPF_F_STRICT_ALIGNMENT is used in BPF_PROG_LOAD command, the ++ * verifier will perform strict alignment checking as if the kernel ++ * has been built with CONFIG_EFFICIENT_UNALIGNED_ACCESS not set, ++ * and NET_IP_ALIGN defined to 2. ++ */ ++#define BPF_F_STRICT_ALIGNMENT (1U << 0) ++ ++#define BPF_PSEUDO_MAP_FD 1 ++ ++/* flags for BPF_MAP_UPDATE_ELEM command */ ++#define BPF_ANY 0 /* create new element or update existing */ ++#define BPF_NOEXIST 1 /* create new element if it didn't exist */ ++#define BPF_EXIST 2 /* update existing element */ ++ ++/* flags for BPF_MAP_CREATE command */ ++#define BPF_F_NO_PREALLOC (1U << 0) ++/* Instead of having one common LRU list in the ++ * BPF_MAP_TYPE_LRU_[PERCPU_]HASH map, use a percpu LRU list ++ * which can scale and perform better. ++ * Note, the LRU nodes (including free nodes) cannot be moved ++ * across different LRU lists. ++ */ ++#define BPF_F_NO_COMMON_LRU (1U << 1) ++/* Specify numa node during map creation */ ++#define BPF_F_NUMA_NODE (1U << 2) ++ ++union bpf_attr { ++ struct { /* anonymous struct used by BPF_MAP_CREATE command */ ++ __u32 map_type; /* one of enum bpf_map_type */ ++ __u32 key_size; /* size of key in bytes */ ++ __u32 value_size; /* size of value in bytes */ ++ __u32 max_entries; /* max number of entries in a map */ ++ __u32 map_flags; /* BPF_MAP_CREATE related ++ * flags defined above. ++ */ ++ __u32 inner_map_fd; /* fd pointing to the inner map */ ++ __u32 numa_node; /* numa node (effective only if ++ * BPF_F_NUMA_NODE is set). ++ */ ++ }; ++ ++ struct { /* anonymous struct used by BPF_MAP_*_ELEM commands */ ++ __u32 map_fd; ++ __aligned_u64 key; ++ union { ++ __aligned_u64 value; ++ __aligned_u64 next_key; ++ }; ++ __u64 flags; ++ }; ++ ++ struct { /* anonymous struct used by BPF_PROG_LOAD command */ ++ __u32 prog_type; /* one of enum bpf_prog_type */ ++ __u32 insn_cnt; ++ __aligned_u64 insns; ++ __aligned_u64 license; ++ __u32 log_level; /* verbosity level of verifier */ ++ __u32 log_size; /* size of user buffer */ ++ __aligned_u64 log_buf; /* user supplied buffer */ ++ __u32 kern_version; /* checked when prog_type=kprobe */ ++ __u32 prog_flags; ++ }; ++ ++ struct { /* anonymous struct used by BPF_OBJ_* commands */ ++ __aligned_u64 pathname; ++ __u32 bpf_fd; ++ }; ++ ++ struct { /* anonymous struct used by BPF_PROG_ATTACH/DETACH commands */ ++ __u32 target_fd; /* container object to attach to */ ++ __u32 attach_bpf_fd; /* eBPF program to attach */ ++ __u32 attach_type; ++ __u32 attach_flags; ++ }; ++ ++ struct { /* anonymous struct used by BPF_PROG_TEST_RUN command */ ++ __u32 prog_fd; ++ __u32 retval; ++ __u32 data_size_in; ++ __u32 data_size_out; ++ __aligned_u64 data_in; ++ __aligned_u64 data_out; ++ __u32 repeat; ++ __u32 duration; ++ } test; ++ ++ struct { /* anonymous struct used by BPF_*_GET_*_ID */ ++ union { ++ __u32 start_id; ++ __u32 prog_id; ++ __u32 map_id; ++ }; ++ __u32 next_id; ++ }; ++ ++ struct { /* anonymous struct used by BPF_OBJ_GET_INFO_BY_FD */ ++ __u32 bpf_fd; ++ __u32 info_len; ++ __aligned_u64 info; ++ } info; ++} __attribute__((aligned(8))); ++ ++/* BPF helper function descriptions: ++ * ++ * void *bpf_map_lookup_elem(&map, &key) ++ * Return: Map value or NULL ++ * ++ * int bpf_map_update_elem(&map, &key, &value, flags) ++ * Return: 0 on success or negative error ++ * ++ * int bpf_map_delete_elem(&map, &key) ++ * Return: 0 on success or negative error ++ * ++ * int bpf_probe_read(void *dst, int size, void *src) ++ * Return: 0 on success or negative error ++ * ++ * u64 bpf_ktime_get_ns(void) ++ * Return: current ktime ++ * ++ * int bpf_trace_printk(const char *fmt, int fmt_size, ...) ++ * Return: length of buffer written or negative error ++ * ++ * u32 bpf_prandom_u32(void) ++ * Return: random value ++ * ++ * u32 bpf_raw_smp_processor_id(void) ++ * Return: SMP processor ID ++ * ++ * int bpf_skb_store_bytes(skb, offset, from, len, flags) ++ * store bytes into packet ++ * @skb: pointer to skb ++ * @offset: offset within packet from skb->mac_header ++ * @from: pointer where to copy bytes from ++ * @len: number of bytes to store into packet ++ * @flags: bit 0 - if true, recompute skb->csum ++ * other bits - reserved ++ * Return: 0 on success or negative error ++ * ++ * int bpf_l3_csum_replace(skb, offset, from, to, flags) ++ * recompute IP checksum ++ * @skb: pointer to skb ++ * @offset: offset within packet where IP checksum is located ++ * @from: old value of header field ++ * @to: new value of header field ++ * @flags: bits 0-3 - size of header field ++ * other bits - reserved ++ * Return: 0 on success or negative error ++ * ++ * int bpf_l4_csum_replace(skb, offset, from, to, flags) ++ * recompute TCP/UDP checksum ++ * @skb: pointer to skb ++ * @offset: offset within packet where TCP/UDP checksum is located ++ * @from: old value of header field ++ * @to: new value of header field ++ * @flags: bits 0-3 - size of header field ++ * bit 4 - is pseudo header ++ * other bits - reserved ++ * Return: 0 on success or negative error ++ * ++ * int bpf_tail_call(ctx, prog_array_map, index) ++ * jump into another BPF program ++ * @ctx: context pointer passed to next program ++ * @prog_array_map: pointer to map which type is BPF_MAP_TYPE_PROG_ARRAY ++ * @index: index inside array that selects specific program to run ++ * Return: 0 on success or negative error ++ * ++ * int bpf_clone_redirect(skb, ifindex, flags) ++ * redirect to another netdev ++ * @skb: pointer to skb ++ * @ifindex: ifindex of the net device ++ * @flags: bit 0 - if set, redirect to ingress instead of egress ++ * other bits - reserved ++ * Return: 0 on success or negative error ++ * ++ * u64 bpf_get_current_pid_tgid(void) ++ * Return: current->tgid << 32 | current->pid ++ * ++ * u64 bpf_get_current_uid_gid(void) ++ * Return: current_gid << 32 | current_uid ++ * ++ * int bpf_get_current_comm(char *buf, int size_of_buf) ++ * stores current->comm into buf ++ * Return: 0 on success or negative error ++ * ++ * u32 bpf_get_cgroup_classid(skb) ++ * retrieve a proc's classid ++ * @skb: pointer to skb ++ * Return: classid if != 0 ++ * ++ * int bpf_skb_vlan_push(skb, vlan_proto, vlan_tci) ++ * Return: 0 on success or negative error ++ * ++ * int bpf_skb_vlan_pop(skb) ++ * Return: 0 on success or negative error ++ * ++ * int bpf_skb_get_tunnel_key(skb, key, size, flags) ++ * int bpf_skb_set_tunnel_key(skb, key, size, flags) ++ * retrieve or populate tunnel metadata ++ * @skb: pointer to skb ++ * @key: pointer to 'struct bpf_tunnel_key' ++ * @size: size of 'struct bpf_tunnel_key' ++ * @flags: room for future extensions ++ * Return: 0 on success or negative error ++ * ++ * u64 bpf_perf_event_read(map, flags) ++ * read perf event counter value ++ * @map: pointer to perf_event_array map ++ * @flags: index of event in the map or bitmask flags ++ * Return: value of perf event counter read or error code ++ * ++ * int bpf_redirect(ifindex, flags) ++ * redirect to another netdev ++ * @ifindex: ifindex of the net device ++ * @flags: ++ * cls_bpf: ++ * bit 0 - if set, redirect to ingress instead of egress ++ * other bits - reserved ++ * xdp_bpf: ++ * all bits - reserved ++ * Return: cls_bpf: TC_ACT_REDIRECT on success or TC_ACT_SHOT on error ++ * xdp_bfp: XDP_REDIRECT on success or XDP_ABORT on error ++ * int bpf_redirect_map(map, key, flags) ++ * redirect to endpoint in map ++ * @map: pointer to dev map ++ * @key: index in map to lookup ++ * @flags: -- ++ * Return: XDP_REDIRECT on success or XDP_ABORT on error ++ * ++ * u32 bpf_get_route_realm(skb) ++ * retrieve a dst's tclassid ++ * @skb: pointer to skb ++ * Return: realm if != 0 ++ * ++ * int bpf_perf_event_output(ctx, map, flags, data, size) ++ * output perf raw sample ++ * @ctx: struct pt_regs* ++ * @map: pointer to perf_event_array map ++ * @flags: index of event in the map or bitmask flags ++ * @data: data on stack to be output as raw data ++ * @size: size of data ++ * Return: 0 on success or negative error ++ * ++ * int bpf_get_stackid(ctx, map, flags) ++ * walk user or kernel stack and return id ++ * @ctx: struct pt_regs* ++ * @map: pointer to stack_trace map ++ * @flags: bits 0-7 - numer of stack frames to skip ++ * bit 8 - collect user stack instead of kernel ++ * bit 9 - compare stacks by hash only ++ * bit 10 - if two different stacks hash into the same stackid ++ * discard old ++ * other bits - reserved ++ * Return: >= 0 stackid on success or negative error ++ * ++ * s64 bpf_csum_diff(from, from_size, to, to_size, seed) ++ * calculate csum diff ++ * @from: raw from buffer ++ * @from_size: length of from buffer ++ * @to: raw to buffer ++ * @to_size: length of to buffer ++ * @seed: optional seed ++ * Return: csum result or negative error code ++ * ++ * int bpf_skb_get_tunnel_opt(skb, opt, size) ++ * retrieve tunnel options metadata ++ * @skb: pointer to skb ++ * @opt: pointer to raw tunnel option data ++ * @size: size of @opt ++ * Return: option size ++ * ++ * int bpf_skb_set_tunnel_opt(skb, opt, size) ++ * populate tunnel options metadata ++ * @skb: pointer to skb ++ * @opt: pointer to raw tunnel option data ++ * @size: size of @opt ++ * Return: 0 on success or negative error ++ * ++ * int bpf_skb_change_proto(skb, proto, flags) ++ * Change protocol of the skb. Currently supported is v4 -> v6, ++ * v6 -> v4 transitions. The helper will also resize the skb. eBPF ++ * program is expected to fill the new headers via skb_store_bytes ++ * and lX_csum_replace. ++ * @skb: pointer to skb ++ * @proto: new skb->protocol type ++ * @flags: reserved ++ * Return: 0 on success or negative error ++ * ++ * int bpf_skb_change_type(skb, type) ++ * Change packet type of skb. ++ * @skb: pointer to skb ++ * @type: new skb->pkt_type type ++ * Return: 0 on success or negative error ++ * ++ * int bpf_skb_under_cgroup(skb, map, index) ++ * Check cgroup2 membership of skb ++ * @skb: pointer to skb ++ * @map: pointer to bpf_map in BPF_MAP_TYPE_CGROUP_ARRAY type ++ * @index: index of the cgroup in the bpf_map ++ * Return: ++ * == 0 skb failed the cgroup2 descendant test ++ * == 1 skb succeeded the cgroup2 descendant test ++ * < 0 error ++ * ++ * u32 bpf_get_hash_recalc(skb) ++ * Retrieve and possibly recalculate skb->hash. ++ * @skb: pointer to skb ++ * Return: hash ++ * ++ * u64 bpf_get_current_task(void) ++ * Returns current task_struct ++ * Return: current ++ * ++ * int bpf_probe_write_user(void *dst, void *src, int len) ++ * safely attempt to write to a location ++ * @dst: destination address in userspace ++ * @src: source address on stack ++ * @len: number of bytes to copy ++ * Return: 0 on success or negative error ++ * ++ * int bpf_current_task_under_cgroup(map, index) ++ * Check cgroup2 membership of current task ++ * @map: pointer to bpf_map in BPF_MAP_TYPE_CGROUP_ARRAY type ++ * @index: index of the cgroup in the bpf_map ++ * Return: ++ * == 0 current failed the cgroup2 descendant test ++ * == 1 current succeeded the cgroup2 descendant test ++ * < 0 error ++ * ++ * int bpf_skb_change_tail(skb, len, flags) ++ * The helper will resize the skb to the given new size, to be used f.e. ++ * with control messages. ++ * @skb: pointer to skb ++ * @len: new skb length ++ * @flags: reserved ++ * Return: 0 on success or negative error ++ * ++ * int bpf_skb_pull_data(skb, len) ++ * The helper will pull in non-linear data in case the skb is non-linear ++ * and not all of len are part of the linear section. Only needed for ++ * read/write with direct packet access. ++ * @skb: pointer to skb ++ * @len: len to make read/writeable ++ * Return: 0 on success or negative error ++ * ++ * s64 bpf_csum_update(skb, csum) ++ * Adds csum into skb->csum in case of CHECKSUM_COMPLETE. ++ * @skb: pointer to skb ++ * @csum: csum to add ++ * Return: csum on success or negative error ++ * ++ * void bpf_set_hash_invalid(skb) ++ * Invalidate current skb->hash. ++ * @skb: pointer to skb ++ * ++ * int bpf_get_numa_node_id() ++ * Return: Id of current NUMA node. ++ * ++ * int bpf_skb_change_head() ++ * Grows headroom of skb and adjusts MAC header offset accordingly. ++ * Will extends/reallocae as required automatically. ++ * May change skb data pointer and will thus invalidate any check ++ * performed for direct packet access. ++ * @skb: pointer to skb ++ * @len: length of header to be pushed in front ++ * @flags: Flags (unused for now) ++ * Return: 0 on success or negative error ++ * ++ * int bpf_xdp_adjust_head(xdp_md, delta) ++ * Adjust the xdp_md.data by delta ++ * @xdp_md: pointer to xdp_md ++ * @delta: An positive/negative integer to be added to xdp_md.data ++ * Return: 0 on success or negative on error ++ * ++ * int bpf_probe_read_str(void *dst, int size, const void *unsafe_ptr) ++ * Copy a NUL terminated string from unsafe address. In case the string ++ * length is smaller than size, the target is not padded with further NUL ++ * bytes. In case the string length is larger than size, just count-1 ++ * bytes are copied and the last byte is set to NUL. ++ * @dst: destination address ++ * @size: maximum number of bytes to copy, including the trailing NUL ++ * @unsafe_ptr: unsafe address ++ * Return: ++ * > 0 length of the string including the trailing NUL on success ++ * < 0 error ++ * ++ * u64 bpf_get_socket_cookie(skb) ++ * Get the cookie for the socket stored inside sk_buff. ++ * @skb: pointer to skb ++ * Return: 8 Bytes non-decreasing number on success or 0 if the socket ++ * field is missing inside sk_buff ++ * ++ * u32 bpf_get_socket_uid(skb) ++ * Get the owner uid of the socket stored inside sk_buff. ++ * @skb: pointer to skb ++ * Return: uid of the socket owner on success or overflowuid if failed. ++ * ++ * u32 bpf_set_hash(skb, hash) ++ * Set full skb->hash. ++ * @skb: pointer to skb ++ * @hash: hash to set ++ * ++ * int bpf_setsockopt(bpf_socket, level, optname, optval, optlen) ++ * Calls setsockopt. Not all opts are available, only those with ++ * integer optvals plus TCP_CONGESTION. ++ * Supported levels: SOL_SOCKET and IPROTO_TCP ++ * @bpf_socket: pointer to bpf_socket ++ * @level: SOL_SOCKET or IPROTO_TCP ++ * @optname: option name ++ * @optval: pointer to option value ++ * @optlen: length of optval in byes ++ * Return: 0 or negative error ++ * ++ * int bpf_skb_adjust_room(skb, len_diff, mode, flags) ++ * Grow or shrink room in sk_buff. ++ * @skb: pointer to skb ++ * @len_diff: (signed) amount of room to grow/shrink ++ * @mode: operation mode (enum bpf_adj_room_mode) ++ * @flags: reserved for future use ++ * Return: 0 on success or negative error code ++ * ++ * int bpf_sk_redirect_map(map, key, flags) ++ * Redirect skb to a sock in map using key as a lookup key for the ++ * sock in map. ++ * @map: pointer to sockmap ++ * @key: key to lookup sock in map ++ * @flags: reserved for future use ++ * Return: SK_REDIRECT ++ * ++ * int bpf_sock_map_update(skops, map, key, flags) ++ * @skops: pointer to bpf_sock_ops ++ * @map: pointer to sockmap to update ++ * @key: key to insert/update sock in map ++ * @flags: same flags as map update elem ++ */ ++#define __BPF_FUNC_MAPPER(FN) \ ++ FN(unspec), \ ++ FN(map_lookup_elem), \ ++ FN(map_update_elem), \ ++ FN(map_delete_elem), \ ++ FN(probe_read), \ ++ FN(ktime_get_ns), \ ++ FN(trace_printk), \ ++ FN(get_prandom_u32), \ ++ FN(get_smp_processor_id), \ ++ FN(skb_store_bytes), \ ++ FN(l3_csum_replace), \ ++ FN(l4_csum_replace), \ ++ FN(tail_call), \ ++ FN(clone_redirect), \ ++ FN(get_current_pid_tgid), \ ++ FN(get_current_uid_gid), \ ++ FN(get_current_comm), \ ++ FN(get_cgroup_classid), \ ++ FN(skb_vlan_push), \ ++ FN(skb_vlan_pop), \ ++ FN(skb_get_tunnel_key), \ ++ FN(skb_set_tunnel_key), \ ++ FN(perf_event_read), \ ++ FN(redirect), \ ++ FN(get_route_realm), \ ++ FN(perf_event_output), \ ++ FN(skb_load_bytes), \ ++ FN(get_stackid), \ ++ FN(csum_diff), \ ++ FN(skb_get_tunnel_opt), \ ++ FN(skb_set_tunnel_opt), \ ++ FN(skb_change_proto), \ ++ FN(skb_change_type), \ ++ FN(skb_under_cgroup), \ ++ FN(get_hash_recalc), \ ++ FN(get_current_task), \ ++ FN(probe_write_user), \ ++ FN(current_task_under_cgroup), \ ++ FN(skb_change_tail), \ ++ FN(skb_pull_data), \ ++ FN(csum_update), \ ++ FN(set_hash_invalid), \ ++ FN(get_numa_node_id), \ ++ FN(skb_change_head), \ ++ FN(xdp_adjust_head), \ ++ FN(probe_read_str), \ ++ FN(get_socket_cookie), \ ++ FN(get_socket_uid), \ ++ FN(set_hash), \ ++ FN(setsockopt), \ ++ FN(skb_adjust_room), \ ++ FN(redirect_map), \ ++ FN(sk_redirect_map), \ ++ FN(sock_map_update), \ ++ ++/* integer value in 'imm' field of BPF_CALL instruction selects which helper ++ * function eBPF program intends to call ++ */ ++#define __BPF_ENUM_FN(x) BPF_FUNC_ ## x ++enum bpf_func_id { ++ __BPF_FUNC_MAPPER(__BPF_ENUM_FN) ++ __BPF_FUNC_MAX_ID, ++}; ++#undef __BPF_ENUM_FN ++ ++/* All flags used by eBPF helper functions, placed here. */ ++ ++/* BPF_FUNC_skb_store_bytes flags. */ ++#define BPF_F_RECOMPUTE_CSUM (1ULL << 0) ++#define BPF_F_INVALIDATE_HASH (1ULL << 1) ++ ++/* BPF_FUNC_l3_csum_replace and BPF_FUNC_l4_csum_replace flags. ++ * First 4 bits are for passing the header field size. ++ */ ++#define BPF_F_HDR_FIELD_MASK 0xfULL ++ ++/* BPF_FUNC_l4_csum_replace flags. */ ++#define BPF_F_PSEUDO_HDR (1ULL << 4) ++#define BPF_F_MARK_MANGLED_0 (1ULL << 5) ++#define BPF_F_MARK_ENFORCE (1ULL << 6) ++ ++/* BPF_FUNC_clone_redirect and BPF_FUNC_redirect flags. */ ++#define BPF_F_INGRESS (1ULL << 0) ++ ++/* BPF_FUNC_skb_set_tunnel_key and BPF_FUNC_skb_get_tunnel_key flags. */ ++#define BPF_F_TUNINFO_IPV6 (1ULL << 0) ++ ++/* BPF_FUNC_get_stackid flags. */ ++#define BPF_F_SKIP_FIELD_MASK 0xffULL ++#define BPF_F_USER_STACK (1ULL << 8) ++#define BPF_F_FAST_STACK_CMP (1ULL << 9) ++#define BPF_F_REUSE_STACKID (1ULL << 10) ++ ++/* BPF_FUNC_skb_set_tunnel_key flags. */ ++#define BPF_F_ZERO_CSUM_TX (1ULL << 1) ++#define BPF_F_DONT_FRAGMENT (1ULL << 2) ++ ++/* BPF_FUNC_perf_event_output and BPF_FUNC_perf_event_read flags. */ ++#define BPF_F_INDEX_MASK 0xffffffffULL ++#define BPF_F_CURRENT_CPU BPF_F_INDEX_MASK ++/* BPF_FUNC_perf_event_output for sk_buff input context. */ ++#define BPF_F_CTXLEN_MASK (0xfffffULL << 32) ++ ++/* Mode for BPF_FUNC_skb_adjust_room helper. */ ++enum bpf_adj_room_mode { ++ BPF_ADJ_ROOM_NET, ++}; ++ ++/* user accessible mirror of in-kernel sk_buff. ++ * new fields can only be added to the end of this structure ++ */ ++struct __sk_buff { ++ __u32 len; ++ __u32 pkt_type; ++ __u32 mark; ++ __u32 queue_mapping; ++ __u32 protocol; ++ __u32 vlan_present; ++ __u32 vlan_tci; ++ __u32 vlan_proto; ++ __u32 priority; ++ __u32 ingress_ifindex; ++ __u32 ifindex; ++ __u32 tc_index; ++ __u32 cb[5]; ++ __u32 hash; ++ __u32 tc_classid; ++ __u32 data; ++ __u32 data_end; ++ __u32 napi_id; ++ ++ /* accessed by BPF_PROG_TYPE_sk_skb types */ ++ __u32 family; ++ __u32 remote_ip4; /* Stored in network byte order */ ++ __u32 local_ip4; /* Stored in network byte order */ ++ __u32 remote_ip6[4]; /* Stored in network byte order */ ++ __u32 local_ip6[4]; /* Stored in network byte order */ ++ __u32 remote_port; /* Stored in network byte order */ ++ __u32 local_port; /* stored in host byte order */ ++}; ++ ++struct bpf_tunnel_key { ++ __u32 tunnel_id; ++ union { ++ __u32 remote_ipv4; ++ __u32 remote_ipv6[4]; ++ }; ++ __u8 tunnel_tos; ++ __u8 tunnel_ttl; ++ __u16 tunnel_ext; ++ __u32 tunnel_label; ++}; ++ ++/* Generic BPF return codes which all BPF program types may support. ++ * The values are binary compatible with their TC_ACT_* counter-part to ++ * provide backwards compatibility with existing SCHED_CLS and SCHED_ACT ++ * programs. ++ * ++ * XDP is handled seprately, see XDP_*. ++ */ ++enum bpf_ret_code { ++ BPF_OK = 0, ++ /* 1 reserved */ ++ BPF_DROP = 2, ++ /* 3-6 reserved */ ++ BPF_REDIRECT = 7, ++ /* >127 are reserved for prog type specific return codes */ ++}; ++ ++struct bpf_sock { ++ __u32 bound_dev_if; ++ __u32 family; ++ __u32 type; ++ __u32 protocol; ++ __u32 mark; ++ __u32 priority; ++}; ++ ++#define XDP_PACKET_HEADROOM 256 ++ ++/* User return codes for XDP prog type. ++ * A valid XDP program must return one of these defined values. All other ++ * return codes are reserved for future use. Unknown return codes will ++ * result in packet drops and a warning via bpf_warn_invalid_xdp_action(). ++ */ ++enum xdp_action { ++ XDP_ABORTED = 0, ++ XDP_DROP, ++ XDP_PASS, ++ XDP_TX, ++ XDP_REDIRECT, ++}; ++ ++/* user accessible metadata for XDP packet hook ++ * new fields must be added to the end of this structure ++ */ ++struct xdp_md { ++ __u32 data; ++ __u32 data_end; ++}; ++ ++enum sk_action { ++ SK_ABORTED = 0, ++ SK_DROP, ++ SK_REDIRECT, ++}; ++ ++#define BPF_TAG_SIZE 8 ++ ++struct bpf_prog_info { ++ __u32 type; ++ __u32 id; ++ __u8 tag[BPF_TAG_SIZE]; ++ __u32 jited_prog_len; ++ __u32 xlated_prog_len; ++ __aligned_u64 jited_prog_insns; ++ __aligned_u64 xlated_prog_insns; ++} __attribute__((aligned(8))); ++ ++struct bpf_map_info { ++ __u32 type; ++ __u32 id; ++ __u32 key_size; ++ __u32 value_size; ++ __u32 max_entries; ++ __u32 map_flags; ++} __attribute__((aligned(8))); ++ ++/* User bpf_sock_ops struct to access socket values and specify request ops ++ * and their replies. ++ * Some of this fields are in network (bigendian) byte order and may need ++ * to be converted before use (bpf_ntohl() defined in samples/bpf/bpf_endian.h). ++ * New fields can only be added at the end of this structure ++ */ ++struct bpf_sock_ops { ++ __u32 op; ++ union { ++ __u32 reply; ++ __u32 replylong[4]; ++ }; ++ __u32 family; ++ __u32 remote_ip4; /* Stored in network byte order */ ++ __u32 local_ip4; /* Stored in network byte order */ ++ __u32 remote_ip6[4]; /* Stored in network byte order */ ++ __u32 local_ip6[4]; /* Stored in network byte order */ ++ __u32 remote_port; /* Stored in network byte order */ ++ __u32 local_port; /* stored in host byte order */ ++}; ++ ++/* List of known BPF sock_ops operators. ++ * New entries can only be added at the end ++ */ ++enum { ++ BPF_SOCK_OPS_VOID, ++ BPF_SOCK_OPS_TIMEOUT_INIT, /* Should return SYN-RTO value to use or ++ * -1 if default value should be used ++ */ ++ BPF_SOCK_OPS_RWND_INIT, /* Should return initial advertized ++ * window (in packets) or -1 if default ++ * value should be used ++ */ ++ BPF_SOCK_OPS_TCP_CONNECT_CB, /* Calls BPF program right before an ++ * active connection is initialized ++ */ ++ BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB, /* Calls BPF program when an ++ * active connection is ++ * established ++ */ ++ BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB, /* Calls BPF program when a ++ * passive connection is ++ * established ++ */ ++ BPF_SOCK_OPS_NEEDS_ECN, /* If connection's congestion control ++ * needs ECN ++ */ ++}; ++ ++#define TCP_BPF_IW 1001 /* Set TCP initial congestion window */ ++#define TCP_BPF_SNDCWND_CLAMP 1002 /* Set sndcwnd_clamp */ ++ ++#endif /* __LINUX_BPF_H__ */ +diff --git a/include/uapi/linux/bpf_common.h b/include/uapi/linux/bpf_common.h +new file mode 100644 +index 0000000..afe7433 +--- /dev/null ++++ b/include/uapi/linux/bpf_common.h +@@ -0,0 +1,55 @@ ++#ifndef __LINUX_BPF_COMMON_H__ ++#define __LINUX_BPF_COMMON_H__ ++ ++/* Instruction classes */ ++#define BPF_CLASS(code) ((code) & 0x07) ++#define BPF_LD 0x00 ++#define BPF_LDX 0x01 ++#define BPF_ST 0x02 ++#define BPF_STX 0x03 ++#define BPF_ALU 0x04 ++#define BPF_JMP 0x05 ++#define BPF_RET 0x06 ++#define BPF_MISC 0x07 ++ ++/* ld/ldx fields */ ++#define BPF_SIZE(code) ((code) & 0x18) ++#define BPF_W 0x00 ++#define BPF_H 0x08 ++#define BPF_B 0x10 ++#define BPF_MODE(code) ((code) & 0xe0) ++#define BPF_IMM 0x00 ++#define BPF_ABS 0x20 ++#define BPF_IND 0x40 ++#define BPF_MEM 0x60 ++#define BPF_LEN 0x80 ++#define BPF_MSH 0xa0 ++ ++/* alu/jmp fields */ ++#define BPF_OP(code) ((code) & 0xf0) ++#define BPF_ADD 0x00 ++#define BPF_SUB 0x10 ++#define BPF_MUL 0x20 ++#define BPF_DIV 0x30 ++#define BPF_OR 0x40 ++#define BPF_AND 0x50 ++#define BPF_LSH 0x60 ++#define BPF_RSH 0x70 ++#define BPF_NEG 0x80 ++#define BPF_MOD 0x90 ++#define BPF_XOR 0xa0 ++ ++#define BPF_JA 0x00 ++#define BPF_JEQ 0x10 ++#define BPF_JGT 0x20 ++#define BPF_JGE 0x30 ++#define BPF_JSET 0x40 ++#define BPF_SRC(code) ((code) & 0x08) ++#define BPF_K 0x00 ++#define BPF_X 0x08 ++ ++#ifndef BPF_MAXINSNS ++#define BPF_MAXINSNS 4096 ++#endif ++ ++#endif /* __LINUX_BPF_COMMON_H__ */ +diff --git a/include/uapi/linux/can.h b/include/uapi/linux/can.h +new file mode 100644 +index 0000000..f7a810d +--- /dev/null ++++ b/include/uapi/linux/can.h +@@ -0,0 +1,201 @@ ++/* ++ * linux/can.h ++ * ++ * Definitions for CAN network layer (socket addr / CAN frame / CAN filter) ++ * ++ * Authors: Oliver Hartkopp ++ * Urs Thuermann ++ * Copyright (c) 2002-2007 Volkswagen Group Electronic Research ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * 1. Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * 2. Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * 3. Neither the name of Volkswagen nor the names of its contributors ++ * may be used to endorse or promote products derived from this software ++ * without specific prior written permission. ++ * ++ * Alternatively, provided that this notice is retained in full, this ++ * software may be distributed under the terms of the GNU General ++ * Public License ("GPL") version 2, in which case the provisions of the ++ * GPL apply INSTEAD OF those given above. ++ * ++ * The provided data structures and external interfaces from this code ++ * are not restricted to be used by modules with a GPL compatible license. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ++ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ++ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ++ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ++ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ++ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ++ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ++ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ++ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ++ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH ++ * DAMAGE. ++ */ ++ ++#ifndef _CAN_H ++#define _CAN_H ++ ++#include ++#include ++ ++/* controller area network (CAN) kernel definitions */ ++ ++/* special address description flags for the CAN_ID */ ++#define CAN_EFF_FLAG 0x80000000U /* EFF/SFF is set in the MSB */ ++#define CAN_RTR_FLAG 0x40000000U /* remote transmission request */ ++#define CAN_ERR_FLAG 0x20000000U /* error message frame */ ++ ++/* valid bits in CAN ID for frame formats */ ++#define CAN_SFF_MASK 0x000007FFU /* standard frame format (SFF) */ ++#define CAN_EFF_MASK 0x1FFFFFFFU /* extended frame format (EFF) */ ++#define CAN_ERR_MASK 0x1FFFFFFFU /* omit EFF, RTR, ERR flags */ ++ ++/* ++ * Controller Area Network Identifier structure ++ * ++ * bit 0-28 : CAN identifier (11/29 bit) ++ * bit 29 : error message frame flag (0 = data frame, 1 = error message) ++ * bit 30 : remote transmission request flag (1 = rtr frame) ++ * bit 31 : frame format flag (0 = standard 11 bit, 1 = extended 29 bit) ++ */ ++typedef __u32 canid_t; ++ ++#define CAN_SFF_ID_BITS 11 ++#define CAN_EFF_ID_BITS 29 ++ ++/* ++ * Controller Area Network Error Message Frame Mask structure ++ * ++ * bit 0-28 : error class mask (see include/linux/can/error.h) ++ * bit 29-31 : set to zero ++ */ ++typedef __u32 can_err_mask_t; ++ ++/* CAN payload length and DLC definitions according to ISO 11898-1 */ ++#define CAN_MAX_DLC 8 ++#define CAN_MAX_DLEN 8 ++ ++/* CAN FD payload length and DLC definitions according to ISO 11898-7 */ ++#define CANFD_MAX_DLC 15 ++#define CANFD_MAX_DLEN 64 ++ ++/** ++ * struct can_frame - basic CAN frame structure ++ * @can_id: CAN ID of the frame and CAN_*_FLAG flags, see canid_t definition ++ * @can_dlc: frame payload length in byte (0 .. 8) aka data length code ++ * N.B. the DLC field from ISO 11898-1 Chapter 8.4.2.3 has a 1:1 ++ * mapping of the 'data length code' to the real payload length ++ * @__pad: padding ++ * @__res0: reserved / padding ++ * @__res1: reserved / padding ++ * @data: CAN frame payload (up to 8 byte) ++ */ ++struct can_frame { ++ canid_t can_id; /* 32 bit CAN_ID + EFF/RTR/ERR flags */ ++ __u8 can_dlc; /* frame payload length in byte (0 .. CAN_MAX_DLEN) */ ++ __u8 __pad; /* padding */ ++ __u8 __res0; /* reserved / padding */ ++ __u8 __res1; /* reserved / padding */ ++ __u8 data[CAN_MAX_DLEN] __attribute__((aligned(8))); ++}; ++ ++/* ++ * defined bits for canfd_frame.flags ++ * ++ * The use of struct canfd_frame implies the Extended Data Length (EDL) bit to ++ * be set in the CAN frame bitstream on the wire. The EDL bit switch turns ++ * the CAN controllers bitstream processor into the CAN FD mode which creates ++ * two new options within the CAN FD frame specification: ++ * ++ * Bit Rate Switch - to indicate a second bitrate is/was used for the payload ++ * Error State Indicator - represents the error state of the transmitting node ++ * ++ * As the CANFD_ESI bit is internally generated by the transmitting CAN ++ * controller only the CANFD_BRS bit is relevant for real CAN controllers when ++ * building a CAN FD frame for transmission. Setting the CANFD_ESI bit can make ++ * sense for virtual CAN interfaces to test applications with echoed frames. ++ */ ++#define CANFD_BRS 0x01 /* bit rate switch (second bitrate for payload data) */ ++#define CANFD_ESI 0x02 /* error state indicator of the transmitting node */ ++ ++/** ++ * struct canfd_frame - CAN flexible data rate frame structure ++ * @can_id: CAN ID of the frame and CAN_*_FLAG flags, see canid_t definition ++ * @len: frame payload length in byte (0 .. CANFD_MAX_DLEN) ++ * @flags: additional flags for CAN FD ++ * @__res0: reserved / padding ++ * @__res1: reserved / padding ++ * @data: CAN FD frame payload (up to CANFD_MAX_DLEN byte) ++ */ ++struct canfd_frame { ++ canid_t can_id; /* 32 bit CAN_ID + EFF/RTR/ERR flags */ ++ __u8 len; /* frame payload length in byte */ ++ __u8 flags; /* additional flags for CAN FD */ ++ __u8 __res0; /* reserved / padding */ ++ __u8 __res1; /* reserved / padding */ ++ __u8 data[CANFD_MAX_DLEN] __attribute__((aligned(8))); ++}; ++ ++#define CAN_MTU (sizeof(struct can_frame)) ++#define CANFD_MTU (sizeof(struct canfd_frame)) ++ ++/* particular protocols of the protocol family PF_CAN */ ++#define CAN_RAW 1 /* RAW sockets */ ++#define CAN_BCM 2 /* Broadcast Manager */ ++#define CAN_TP16 3 /* VAG Transport Protocol v1.6 */ ++#define CAN_TP20 4 /* VAG Transport Protocol v2.0 */ ++#define CAN_MCNET 5 /* Bosch MCNet */ ++#define CAN_ISOTP 6 /* ISO 15765-2 Transport Protocol */ ++#define CAN_NPROTO 7 ++ ++#define SOL_CAN_BASE 100 ++ ++/** ++ * struct sockaddr_can - the sockaddr structure for CAN sockets ++ * @can_family: address family number AF_CAN. ++ * @can_ifindex: CAN network interface index. ++ * @can_addr: protocol specific address information ++ */ ++struct sockaddr_can { ++ __kernel_sa_family_t can_family; ++ int can_ifindex; ++ union { ++ /* transport protocol class address information (e.g. ISOTP) */ ++ struct { canid_t rx_id, tx_id; } tp; ++ ++ /* reserved for future CAN protocols address information */ ++ } can_addr; ++}; ++ ++/** ++ * struct can_filter - CAN ID based filter in can_register(). ++ * @can_id: relevant bits of CAN ID which are not masked out. ++ * @can_mask: CAN mask (see description) ++ * ++ * Description: ++ * A filter matches, when ++ * ++ * & mask == can_id & mask ++ * ++ * The filter can be inverted (CAN_INV_FILTER bit set in can_id) or it can ++ * filter for error message frames (CAN_ERR_FLAG bit set in mask). ++ */ ++struct can_filter { ++ canid_t can_id; ++ canid_t can_mask; ++}; ++ ++#define CAN_INV_FILTER 0x20000000U /* to be set in can_filter.can_id */ ++#define CAN_RAW_FILTER_MAX 512 /* maximum number of can_filter set via setsockopt() */ ++ ++#endif /* !_UAPI_CAN_H */ +diff --git a/include/uapi/linux/can/netlink.h b/include/uapi/linux/can/netlink.h +new file mode 100644 +index 0000000..b9214bd +--- /dev/null ++++ b/include/uapi/linux/can/netlink.h +@@ -0,0 +1,142 @@ ++/* ++ * linux/can/netlink.h ++ * ++ * Definitions for the CAN netlink interface ++ * ++ * Copyright (c) 2009 Wolfgang Grandegger ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the version 2 of the GNU General Public License ++ * as published by the Free Software Foundation ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ */ ++ ++#ifndef _CAN_NETLINK_H ++#define _CAN_NETLINK_H ++ ++#include ++ ++/* ++ * CAN bit-timing parameters ++ * ++ * For further information, please read chapter "8 BIT TIMING ++ * REQUIREMENTS" of the "Bosch CAN Specification version 2.0" ++ * at http://www.semiconductors.bosch.de/pdf/can2spec.pdf. ++ */ ++struct can_bittiming { ++ __u32 bitrate; /* Bit-rate in bits/second */ ++ __u32 sample_point; /* Sample point in one-tenth of a percent */ ++ __u32 tq; /* Time quanta (TQ) in nanoseconds */ ++ __u32 prop_seg; /* Propagation segment in TQs */ ++ __u32 phase_seg1; /* Phase buffer segment 1 in TQs */ ++ __u32 phase_seg2; /* Phase buffer segment 2 in TQs */ ++ __u32 sjw; /* Synchronisation jump width in TQs */ ++ __u32 brp; /* Bit-rate prescaler */ ++}; ++ ++/* ++ * CAN harware-dependent bit-timing constant ++ * ++ * Used for calculating and checking bit-timing parameters ++ */ ++struct can_bittiming_const { ++ char name[16]; /* Name of the CAN controller hardware */ ++ __u32 tseg1_min; /* Time segement 1 = prop_seg + phase_seg1 */ ++ __u32 tseg1_max; ++ __u32 tseg2_min; /* Time segement 2 = phase_seg2 */ ++ __u32 tseg2_max; ++ __u32 sjw_max; /* Synchronisation jump width */ ++ __u32 brp_min; /* Bit-rate prescaler */ ++ __u32 brp_max; ++ __u32 brp_inc; ++}; ++ ++/* ++ * CAN clock parameters ++ */ ++struct can_clock { ++ __u32 freq; /* CAN system clock frequency in Hz */ ++}; ++ ++/* ++ * CAN operational and error states ++ */ ++enum can_state { ++ CAN_STATE_ERROR_ACTIVE = 0, /* RX/TX error count < 96 */ ++ CAN_STATE_ERROR_WARNING, /* RX/TX error count < 128 */ ++ CAN_STATE_ERROR_PASSIVE, /* RX/TX error count < 256 */ ++ CAN_STATE_BUS_OFF, /* RX/TX error count >= 256 */ ++ CAN_STATE_STOPPED, /* Device is stopped */ ++ CAN_STATE_SLEEPING, /* Device is sleeping */ ++ CAN_STATE_MAX ++}; ++ ++/* ++ * CAN bus error counters ++ */ ++struct can_berr_counter { ++ __u16 txerr; ++ __u16 rxerr; ++}; ++ ++/* ++ * CAN controller mode ++ */ ++struct can_ctrlmode { ++ __u32 mask; ++ __u32 flags; ++}; ++ ++#define CAN_CTRLMODE_LOOPBACK 0x01 /* Loopback mode */ ++#define CAN_CTRLMODE_LISTENONLY 0x02 /* Listen-only mode */ ++#define CAN_CTRLMODE_3_SAMPLES 0x04 /* Triple sampling mode */ ++#define CAN_CTRLMODE_ONE_SHOT 0x08 /* One-Shot mode */ ++#define CAN_CTRLMODE_BERR_REPORTING 0x10 /* Bus-error reporting */ ++#define CAN_CTRLMODE_FD 0x20 /* CAN FD mode */ ++#define CAN_CTRLMODE_PRESUME_ACK 0x40 /* Ignore missing CAN ACKs */ ++#define CAN_CTRLMODE_FD_NON_ISO 0x80 /* CAN FD in non-ISO mode */ ++ ++/* ++ * CAN device statistics ++ */ ++struct can_device_stats { ++ __u32 bus_error; /* Bus errors */ ++ __u32 error_warning; /* Changes to error warning state */ ++ __u32 error_passive; /* Changes to error passive state */ ++ __u32 bus_off; /* Changes to bus off state */ ++ __u32 arbitration_lost; /* Arbitration lost errors */ ++ __u32 restarts; /* CAN controller re-starts */ ++}; ++ ++/* ++ * CAN netlink interface ++ */ ++enum { ++ IFLA_CAN_UNSPEC, ++ IFLA_CAN_BITTIMING, ++ IFLA_CAN_BITTIMING_CONST, ++ IFLA_CAN_CLOCK, ++ IFLA_CAN_STATE, ++ IFLA_CAN_CTRLMODE, ++ IFLA_CAN_RESTART_MS, ++ IFLA_CAN_RESTART, ++ IFLA_CAN_BERR_COUNTER, ++ IFLA_CAN_DATA_BITTIMING, ++ IFLA_CAN_DATA_BITTIMING_CONST, ++ IFLA_CAN_TERMINATION, ++ IFLA_CAN_TERMINATION_CONST, ++ IFLA_CAN_BITRATE_CONST, ++ IFLA_CAN_DATA_BITRATE_CONST, ++ __IFLA_CAN_MAX ++}; ++ ++#define IFLA_CAN_MAX (__IFLA_CAN_MAX - 1) ++ ++/* u16 termination range: 1..65535 Ohms */ ++#define CAN_TERMINATION_DISABLED 0 ++ ++#endif /* !_UAPI_CAN_NETLINK_H */ +diff --git a/include/uapi/linux/can/vxcan.h b/include/uapi/linux/can/vxcan.h +new file mode 100644 +index 0000000..5b29e8a +--- /dev/null ++++ b/include/uapi/linux/can/vxcan.h +@@ -0,0 +1,12 @@ ++#ifndef _CAN_VXCAN_H ++#define _CAN_VXCAN_H ++ ++enum { ++ VXCAN_INFO_UNSPEC, ++ VXCAN_INFO_PEER, ++ ++ __VXCAN_INFO_MAX ++#define VXCAN_INFO_MAX (__VXCAN_INFO_MAX - 1) ++}; ++ ++#endif +diff --git a/include/uapi/linux/devlink.h b/include/uapi/linux/devlink.h +new file mode 100644 +index 0000000..a62695e +--- /dev/null ++++ b/include/uapi/linux/devlink.h +@@ -0,0 +1,247 @@ ++/* ++ * include/uapi/linux/devlink.h - Network physical device Netlink interface ++ * Copyright (c) 2016 Mellanox Technologies. All rights reserved. ++ * Copyright (c) 2016 Jiri Pirko ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ */ ++ ++#ifndef _LINUX_DEVLINK_H_ ++#define _LINUX_DEVLINK_H_ ++ ++#define DEVLINK_GENL_NAME "devlink" ++#define DEVLINK_GENL_VERSION 0x1 ++#define DEVLINK_GENL_MCGRP_CONFIG_NAME "config" ++ ++enum devlink_command { ++ /* don't change the order or add anything between, this is ABI! */ ++ DEVLINK_CMD_UNSPEC, ++ ++ DEVLINK_CMD_GET, /* can dump */ ++ DEVLINK_CMD_SET, ++ DEVLINK_CMD_NEW, ++ DEVLINK_CMD_DEL, ++ ++ DEVLINK_CMD_PORT_GET, /* can dump */ ++ DEVLINK_CMD_PORT_SET, ++ DEVLINK_CMD_PORT_NEW, ++ DEVLINK_CMD_PORT_DEL, ++ ++ DEVLINK_CMD_PORT_SPLIT, ++ DEVLINK_CMD_PORT_UNSPLIT, ++ ++ DEVLINK_CMD_SB_GET, /* can dump */ ++ DEVLINK_CMD_SB_SET, ++ DEVLINK_CMD_SB_NEW, ++ DEVLINK_CMD_SB_DEL, ++ ++ DEVLINK_CMD_SB_POOL_GET, /* can dump */ ++ DEVLINK_CMD_SB_POOL_SET, ++ DEVLINK_CMD_SB_POOL_NEW, ++ DEVLINK_CMD_SB_POOL_DEL, ++ ++ DEVLINK_CMD_SB_PORT_POOL_GET, /* can dump */ ++ DEVLINK_CMD_SB_PORT_POOL_SET, ++ DEVLINK_CMD_SB_PORT_POOL_NEW, ++ DEVLINK_CMD_SB_PORT_POOL_DEL, ++ ++ DEVLINK_CMD_SB_TC_POOL_BIND_GET, /* can dump */ ++ DEVLINK_CMD_SB_TC_POOL_BIND_SET, ++ DEVLINK_CMD_SB_TC_POOL_BIND_NEW, ++ DEVLINK_CMD_SB_TC_POOL_BIND_DEL, ++ ++ /* Shared buffer occupancy monitoring commands */ ++ DEVLINK_CMD_SB_OCC_SNAPSHOT, ++ DEVLINK_CMD_SB_OCC_MAX_CLEAR, ++ ++ DEVLINK_CMD_ESWITCH_GET, ++#define DEVLINK_CMD_ESWITCH_MODE_GET /* obsolete, never use this! */ \ ++ DEVLINK_CMD_ESWITCH_GET ++ ++ DEVLINK_CMD_ESWITCH_SET, ++#define DEVLINK_CMD_ESWITCH_MODE_SET /* obsolete, never use this! */ \ ++ DEVLINK_CMD_ESWITCH_SET ++ ++ DEVLINK_CMD_DPIPE_TABLE_GET, ++ DEVLINK_CMD_DPIPE_ENTRIES_GET, ++ DEVLINK_CMD_DPIPE_HEADERS_GET, ++ DEVLINK_CMD_DPIPE_TABLE_COUNTERS_SET, ++ ++ /* add new commands above here */ ++ __DEVLINK_CMD_MAX, ++ DEVLINK_CMD_MAX = __DEVLINK_CMD_MAX - 1 ++}; ++ ++enum devlink_port_type { ++ DEVLINK_PORT_TYPE_NOTSET, ++ DEVLINK_PORT_TYPE_AUTO, ++ DEVLINK_PORT_TYPE_ETH, ++ DEVLINK_PORT_TYPE_IB, ++}; ++ ++enum devlink_sb_pool_type { ++ DEVLINK_SB_POOL_TYPE_INGRESS, ++ DEVLINK_SB_POOL_TYPE_EGRESS, ++}; ++ ++/* static threshold - limiting the maximum number of bytes. ++ * dynamic threshold - limiting the maximum number of bytes ++ * based on the currently available free space in the shared buffer pool. ++ * In this mode, the maximum quota is calculated based ++ * on the following formula: ++ * max_quota = alpha / (1 + alpha) * Free_Buffer ++ * While Free_Buffer is the amount of none-occupied buffer associated to ++ * the relevant pool. ++ * The value range which can be passed is 0-20 and serves ++ * for computation of alpha by following formula: ++ * alpha = 2 ^ (passed_value - 10) ++ */ ++ ++enum devlink_sb_threshold_type { ++ DEVLINK_SB_THRESHOLD_TYPE_STATIC, ++ DEVLINK_SB_THRESHOLD_TYPE_DYNAMIC, ++}; ++ ++#define DEVLINK_SB_THRESHOLD_TO_ALPHA_MAX 20 ++ ++enum devlink_eswitch_mode { ++ DEVLINK_ESWITCH_MODE_LEGACY, ++ DEVLINK_ESWITCH_MODE_SWITCHDEV, ++}; ++ ++enum devlink_eswitch_inline_mode { ++ DEVLINK_ESWITCH_INLINE_MODE_NONE, ++ DEVLINK_ESWITCH_INLINE_MODE_LINK, ++ DEVLINK_ESWITCH_INLINE_MODE_NETWORK, ++ DEVLINK_ESWITCH_INLINE_MODE_TRANSPORT, ++}; ++ ++enum devlink_eswitch_encap_mode { ++ DEVLINK_ESWITCH_ENCAP_MODE_NONE, ++ DEVLINK_ESWITCH_ENCAP_MODE_BASIC, ++}; ++ ++enum devlink_attr { ++ /* don't change the order or add anything between, this is ABI! */ ++ DEVLINK_ATTR_UNSPEC, ++ ++ /* bus name + dev name together are a handle for devlink entity */ ++ DEVLINK_ATTR_BUS_NAME, /* string */ ++ DEVLINK_ATTR_DEV_NAME, /* string */ ++ ++ DEVLINK_ATTR_PORT_INDEX, /* u32 */ ++ DEVLINK_ATTR_PORT_TYPE, /* u16 */ ++ DEVLINK_ATTR_PORT_DESIRED_TYPE, /* u16 */ ++ DEVLINK_ATTR_PORT_NETDEV_IFINDEX, /* u32 */ ++ DEVLINK_ATTR_PORT_NETDEV_NAME, /* string */ ++ DEVLINK_ATTR_PORT_IBDEV_NAME, /* string */ ++ DEVLINK_ATTR_PORT_SPLIT_COUNT, /* u32 */ ++ DEVLINK_ATTR_PORT_SPLIT_GROUP, /* u32 */ ++ DEVLINK_ATTR_SB_INDEX, /* u32 */ ++ DEVLINK_ATTR_SB_SIZE, /* u32 */ ++ DEVLINK_ATTR_SB_INGRESS_POOL_COUNT, /* u16 */ ++ DEVLINK_ATTR_SB_EGRESS_POOL_COUNT, /* u16 */ ++ DEVLINK_ATTR_SB_INGRESS_TC_COUNT, /* u16 */ ++ DEVLINK_ATTR_SB_EGRESS_TC_COUNT, /* u16 */ ++ DEVLINK_ATTR_SB_POOL_INDEX, /* u16 */ ++ DEVLINK_ATTR_SB_POOL_TYPE, /* u8 */ ++ DEVLINK_ATTR_SB_POOL_SIZE, /* u32 */ ++ DEVLINK_ATTR_SB_POOL_THRESHOLD_TYPE, /* u8 */ ++ DEVLINK_ATTR_SB_THRESHOLD, /* u32 */ ++ DEVLINK_ATTR_SB_TC_INDEX, /* u16 */ ++ DEVLINK_ATTR_SB_OCC_CUR, /* u32 */ ++ DEVLINK_ATTR_SB_OCC_MAX, /* u32 */ ++ DEVLINK_ATTR_ESWITCH_MODE, /* u16 */ ++ DEVLINK_ATTR_ESWITCH_INLINE_MODE, /* u8 */ ++ ++ DEVLINK_ATTR_DPIPE_TABLES, /* nested */ ++ DEVLINK_ATTR_DPIPE_TABLE, /* nested */ ++ DEVLINK_ATTR_DPIPE_TABLE_NAME, /* string */ ++ DEVLINK_ATTR_DPIPE_TABLE_SIZE, /* u64 */ ++ DEVLINK_ATTR_DPIPE_TABLE_MATCHES, /* nested */ ++ DEVLINK_ATTR_DPIPE_TABLE_ACTIONS, /* nested */ ++ DEVLINK_ATTR_DPIPE_TABLE_COUNTERS_ENABLED, /* u8 */ ++ ++ DEVLINK_ATTR_DPIPE_ENTRIES, /* nested */ ++ DEVLINK_ATTR_DPIPE_ENTRY, /* nested */ ++ DEVLINK_ATTR_DPIPE_ENTRY_INDEX, /* u64 */ ++ DEVLINK_ATTR_DPIPE_ENTRY_MATCH_VALUES, /* nested */ ++ DEVLINK_ATTR_DPIPE_ENTRY_ACTION_VALUES, /* nested */ ++ DEVLINK_ATTR_DPIPE_ENTRY_COUNTER, /* u64 */ ++ ++ DEVLINK_ATTR_DPIPE_MATCH, /* nested */ ++ DEVLINK_ATTR_DPIPE_MATCH_VALUE, /* nested */ ++ DEVLINK_ATTR_DPIPE_MATCH_TYPE, /* u32 */ ++ ++ DEVLINK_ATTR_DPIPE_ACTION, /* nested */ ++ DEVLINK_ATTR_DPIPE_ACTION_VALUE, /* nested */ ++ DEVLINK_ATTR_DPIPE_ACTION_TYPE, /* u32 */ ++ ++ DEVLINK_ATTR_DPIPE_VALUE, ++ DEVLINK_ATTR_DPIPE_VALUE_MASK, ++ DEVLINK_ATTR_DPIPE_VALUE_MAPPING, /* u32 */ ++ ++ DEVLINK_ATTR_DPIPE_HEADERS, /* nested */ ++ DEVLINK_ATTR_DPIPE_HEADER, /* nested */ ++ DEVLINK_ATTR_DPIPE_HEADER_NAME, /* string */ ++ DEVLINK_ATTR_DPIPE_HEADER_ID, /* u32 */ ++ DEVLINK_ATTR_DPIPE_HEADER_FIELDS, /* nested */ ++ DEVLINK_ATTR_DPIPE_HEADER_GLOBAL, /* u8 */ ++ DEVLINK_ATTR_DPIPE_HEADER_INDEX, /* u32 */ ++ ++ DEVLINK_ATTR_DPIPE_FIELD, /* nested */ ++ DEVLINK_ATTR_DPIPE_FIELD_NAME, /* string */ ++ DEVLINK_ATTR_DPIPE_FIELD_ID, /* u32 */ ++ DEVLINK_ATTR_DPIPE_FIELD_BITWIDTH, /* u32 */ ++ DEVLINK_ATTR_DPIPE_FIELD_MAPPING_TYPE, /* u32 */ ++ ++ DEVLINK_ATTR_PAD, ++ ++ DEVLINK_ATTR_ESWITCH_ENCAP_MODE, /* u8 */ ++ ++ /* add new attributes above here, update the policy in devlink.c */ ++ ++ __DEVLINK_ATTR_MAX, ++ DEVLINK_ATTR_MAX = __DEVLINK_ATTR_MAX - 1 ++}; ++ ++/* Mapping between internal resource described by the field and system ++ * structure ++ */ ++enum devlink_dpipe_field_mapping_type { ++ DEVLINK_DPIPE_FIELD_MAPPING_TYPE_NONE, ++ DEVLINK_DPIPE_FIELD_MAPPING_TYPE_IFINDEX, ++}; ++ ++/* Match type - specify the type of the match */ ++enum devlink_dpipe_match_type { ++ DEVLINK_DPIPE_MATCH_TYPE_FIELD_EXACT, ++}; ++ ++/* Action type - specify the action type */ ++enum devlink_dpipe_action_type { ++ DEVLINK_DPIPE_ACTION_TYPE_FIELD_MODIFY, ++}; ++ ++enum devlink_dpipe_field_ethernet_id { ++ DEVLINK_DPIPE_FIELD_ETHERNET_DST_MAC, ++}; ++ ++enum devlink_dpipe_field_ipv4_id { ++ DEVLINK_DPIPE_FIELD_IPV4_DST_IP, ++}; ++ ++enum devlink_dpipe_field_ipv6_id { ++ DEVLINK_DPIPE_FIELD_IPV6_DST_IP, ++}; ++ ++enum devlink_dpipe_header_id { ++ DEVLINK_DPIPE_HEADER_ETHERNET, ++ DEVLINK_DPIPE_HEADER_IPV4, ++ DEVLINK_DPIPE_HEADER_IPV6, ++}; ++ ++#endif /* _LINUX_DEVLINK_H_ */ +diff --git a/include/uapi/linux/elf-em.h b/include/uapi/linux/elf-em.h +new file mode 100644 +index 0000000..9cd1de9 +--- /dev/null ++++ b/include/uapi/linux/elf-em.h +@@ -0,0 +1,60 @@ ++#ifndef _LINUX_ELF_EM_H ++#define _LINUX_ELF_EM_H ++ ++/* These constants define the various ELF target machines */ ++#define EM_NONE 0 ++#define EM_M32 1 ++#define EM_SPARC 2 ++#define EM_386 3 ++#define EM_68K 4 ++#define EM_88K 5 ++#define EM_486 6 /* Perhaps disused */ ++#define EM_860 7 ++#define EM_MIPS 8 /* MIPS R3000 (officially, big-endian only) */ ++ /* Next two are historical and binaries and ++ modules of these types will be rejected by ++ Linux. */ ++#define EM_MIPS_RS3_LE 10 /* MIPS R3000 little-endian */ ++#define EM_MIPS_RS4_BE 10 /* MIPS R4000 big-endian */ ++ ++#define EM_PARISC 15 /* HPPA */ ++#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */ ++#define EM_PPC 20 /* PowerPC */ ++#define EM_PPC64 21 /* PowerPC64 */ ++#define EM_SPU 23 /* Cell BE SPU */ ++#define EM_ARM 40 /* ARM 32 bit */ ++#define EM_SH 42 /* SuperH */ ++#define EM_SPARCV9 43 /* SPARC v9 64-bit */ ++#define EM_H8_300 46 /* Renesas H8/300 */ ++#define EM_IA_64 50 /* HP/Intel IA-64 */ ++#define EM_X86_64 62 /* AMD x86-64 */ ++#define EM_S390 22 /* IBM S/390 */ ++#define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */ ++#define EM_M32R 88 /* Renesas M32R */ ++#define EM_MN10300 89 /* Panasonic/MEI MN10300, AM33 */ ++#define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */ ++#define EM_BLACKFIN 106 /* ADI Blackfin Processor */ ++#define EM_ALTERA_NIOS2 113 /* Altera Nios II soft-core processor */ ++#define EM_TI_C6000 140 /* TI C6X DSPs */ ++#define EM_AARCH64 183 /* ARM 64 bit */ ++#define EM_TILEPRO 188 /* Tilera TILEPro */ ++#define EM_MICROBLAZE 189 /* Xilinx MicroBlaze */ ++#define EM_TILEGX 191 /* Tilera TILE-Gx */ ++#define EM_BPF 247 /* Linux BPF - in-kernel virtual machine */ ++#define EM_FRV 0x5441 /* Fujitsu FR-V */ ++ ++/* ++ * This is an interim value that we will use until the committee comes ++ * up with a final number. ++ */ ++#define EM_ALPHA 0x9026 ++ ++/* Bogus old m32r magic number, used by old tools. */ ++#define EM_CYGNUS_M32R 0x9041 ++/* This is the old interim value for S/390 architecture */ ++#define EM_S390_OLD 0xA390 ++/* Also Panasonic/MEI MN10300, AM33 */ ++#define EM_CYGNUS_MN10300 0xbeef ++ ++ ++#endif /* _LINUX_ELF_EM_H */ +diff --git a/include/uapi/linux/fib_rules.h b/include/uapi/linux/fib_rules.h +new file mode 100644 +index 0000000..bbf02a6 +--- /dev/null ++++ b/include/uapi/linux/fib_rules.h +@@ -0,0 +1,80 @@ ++#ifndef __LINUX_FIB_RULES_H ++#define __LINUX_FIB_RULES_H ++ ++#include ++#include ++ ++/* rule is permanent, and cannot be deleted */ ++#define FIB_RULE_PERMANENT 0x00000001 ++#define FIB_RULE_INVERT 0x00000002 ++#define FIB_RULE_UNRESOLVED 0x00000004 ++#define FIB_RULE_IIF_DETACHED 0x00000008 ++#define FIB_RULE_DEV_DETACHED FIB_RULE_IIF_DETACHED ++#define FIB_RULE_OIF_DETACHED 0x00000010 ++ ++/* try to find source address in routing lookups */ ++#define FIB_RULE_FIND_SADDR 0x00010000 ++ ++struct fib_rule_hdr { ++ __u8 family; ++ __u8 dst_len; ++ __u8 src_len; ++ __u8 tos; ++ ++ __u8 table; ++ __u8 res1; /* reserved */ ++ __u8 res2; /* reserved */ ++ __u8 action; ++ ++ __u32 flags; ++}; ++ ++struct fib_rule_uid_range { ++ __u32 start; ++ __u32 end; ++}; ++ ++enum { ++ FRA_UNSPEC, ++ FRA_DST, /* destination address */ ++ FRA_SRC, /* source address */ ++ FRA_IIFNAME, /* interface name */ ++#define FRA_IFNAME FRA_IIFNAME ++ FRA_GOTO, /* target to jump to (FR_ACT_GOTO) */ ++ FRA_UNUSED2, ++ FRA_PRIORITY, /* priority/preference */ ++ FRA_UNUSED3, ++ FRA_UNUSED4, ++ FRA_UNUSED5, ++ FRA_FWMARK, /* mark */ ++ FRA_FLOW, /* flow/class id */ ++ FRA_TUN_ID, ++ FRA_SUPPRESS_IFGROUP, ++ FRA_SUPPRESS_PREFIXLEN, ++ FRA_TABLE, /* Extended table id */ ++ FRA_FWMASK, /* mask for netfilter mark */ ++ FRA_OIFNAME, ++ FRA_PAD, ++ FRA_L3MDEV, /* iif or oif is l3mdev goto its table */ ++ FRA_UID_RANGE, /* UID range */ ++ __FRA_MAX ++}; ++ ++#define FRA_MAX (__FRA_MAX - 1) ++ ++enum { ++ FR_ACT_UNSPEC, ++ FR_ACT_TO_TBL, /* Pass to fixed table */ ++ FR_ACT_GOTO, /* Jump to another rule */ ++ FR_ACT_NOP, /* No operation */ ++ FR_ACT_RES3, ++ FR_ACT_RES4, ++ FR_ACT_BLACKHOLE, /* Drop without notification */ ++ FR_ACT_UNREACHABLE, /* Drop with ENETUNREACH */ ++ FR_ACT_PROHIBIT, /* Drop with EACCES */ ++ __FR_ACT_MAX, ++}; ++ ++#define FR_ACT_MAX (__FR_ACT_MAX - 1) ++ ++#endif +diff --git a/include/uapi/linux/filter.h b/include/uapi/linux/filter.h +new file mode 100644 +index 0000000..e4f2f74 +--- /dev/null ++++ b/include/uapi/linux/filter.h +@@ -0,0 +1,89 @@ ++/* ++ * Linux Socket Filter Data Structures ++ */ ++ ++#ifndef __LINUX_FILTER_H__ ++#define __LINUX_FILTER_H__ ++ ++ ++#include ++#include ++ ++/* ++ * Current version of the filter code architecture. ++ */ ++#define BPF_MAJOR_VERSION 1 ++#define BPF_MINOR_VERSION 1 ++ ++/* ++ * Try and keep these values and structures similar to BSD, especially ++ * the BPF code definitions which need to match so you can share filters ++ */ ++ ++struct sock_filter { /* Filter block */ ++ __u16 code; /* Actual filter code */ ++ __u8 jt; /* Jump true */ ++ __u8 jf; /* Jump false */ ++ __u32 k; /* Generic multiuse field */ ++}; ++ ++struct sock_fprog { /* Required for SO_ATTACH_FILTER. */ ++ unsigned short len; /* Number of filter blocks */ ++ struct sock_filter *filter; ++}; ++ ++/* ret - BPF_K and BPF_X also apply */ ++#define BPF_RVAL(code) ((code) & 0x18) ++#define BPF_A 0x10 ++ ++/* misc */ ++#define BPF_MISCOP(code) ((code) & 0xf8) ++#define BPF_TAX 0x00 ++#define BPF_TXA 0x80 ++ ++/* ++ * Macros for filter block array initializers. ++ */ ++#ifndef BPF_STMT ++#define BPF_STMT(code, k) { (unsigned short)(code), 0, 0, k } ++#endif ++#ifndef BPF_JUMP ++#define BPF_JUMP(code, k, jt, jf) { (unsigned short)(code), jt, jf, k } ++#endif ++ ++/* ++ * Number of scratch memory words for: BPF_ST and BPF_STX ++ */ ++#define BPF_MEMWORDS 16 ++ ++/* RATIONALE. Negative offsets are invalid in BPF. ++ We use them to reference ancillary data. ++ Unlike introduction new instructions, it does not break ++ existing compilers/optimizers. ++ */ ++#define SKF_AD_OFF (-0x1000) ++#define SKF_AD_PROTOCOL 0 ++#define SKF_AD_PKTTYPE 4 ++#define SKF_AD_IFINDEX 8 ++#define SKF_AD_NLATTR 12 ++#define SKF_AD_NLATTR_NEST 16 ++#define SKF_AD_MARK 20 ++#define SKF_AD_QUEUE 24 ++#define SKF_AD_HATYPE 28 ++#define SKF_AD_RXHASH 32 ++#define SKF_AD_CPU 36 ++#define SKF_AD_ALU_XOR_X 40 ++#define SKF_AD_VLAN_TAG 44 ++#define SKF_AD_VLAN_TAG_PRESENT 48 ++#define SKF_AD_PAY_OFFSET 52 ++#define SKF_AD_RANDOM 56 ++#define SKF_AD_VLAN_TPID 60 ++#define SKF_AD_MAX 64 ++ ++#define SKF_NET_OFF (-0x100000) ++#define SKF_LL_OFF (-0x200000) ++ ++#define BPF_NET_OFF SKF_NET_OFF ++#define BPF_LL_OFF SKF_LL_OFF ++ ++#endif /* __LINUX_FILTER_H__ */ +diff --git a/include/uapi/linux/fou.h b/include/uapi/linux/fou.h +new file mode 100644 +index 0000000..744c323 +--- /dev/null ++++ b/include/uapi/linux/fou.h +@@ -0,0 +1,41 @@ ++/* fou.h - FOU Interface */ ++ ++#ifndef _LINUX_FOU_H ++#define _LINUX_FOU_H ++ ++/* NETLINK_GENERIC related info ++ */ ++#define FOU_GENL_NAME "fou" ++#define FOU_GENL_VERSION 0x1 ++ ++enum { ++ FOU_ATTR_UNSPEC, ++ FOU_ATTR_PORT, /* u16 */ ++ FOU_ATTR_AF, /* u8 */ ++ FOU_ATTR_IPPROTO, /* u8 */ ++ FOU_ATTR_TYPE, /* u8 */ ++ FOU_ATTR_REMCSUM_NOPARTIAL, /* flag */ ++ ++ __FOU_ATTR_MAX, ++}; ++ ++#define FOU_ATTR_MAX (__FOU_ATTR_MAX - 1) ++ ++enum { ++ FOU_CMD_UNSPEC, ++ FOU_CMD_ADD, ++ FOU_CMD_DEL, ++ FOU_CMD_GET, ++ ++ __FOU_CMD_MAX, ++}; ++ ++enum { ++ FOU_ENCAP_UNSPEC, ++ FOU_ENCAP_DIRECT, ++ FOU_ENCAP_GUE, ++}; ++ ++#define FOU_CMD_MAX (__FOU_CMD_MAX - 1) ++ ++#endif /* _LINUX_FOU_H */ +diff --git a/include/uapi/linux/gen_stats.h b/include/uapi/linux/gen_stats.h +new file mode 100644 +index 0000000..52deccc +--- /dev/null ++++ b/include/uapi/linux/gen_stats.h +@@ -0,0 +1,79 @@ ++#ifndef __LINUX_GEN_STATS_H ++#define __LINUX_GEN_STATS_H ++ ++#include ++ ++enum { ++ TCA_STATS_UNSPEC, ++ TCA_STATS_BASIC, ++ TCA_STATS_RATE_EST, ++ TCA_STATS_QUEUE, ++ TCA_STATS_APP, ++ TCA_STATS_RATE_EST64, ++ TCA_STATS_PAD, ++ __TCA_STATS_MAX, ++}; ++#define TCA_STATS_MAX (__TCA_STATS_MAX - 1) ++ ++/** ++ * struct gnet_stats_basic - byte/packet throughput statistics ++ * @bytes: number of seen bytes ++ * @packets: number of seen packets ++ */ ++struct gnet_stats_basic { ++ __u64 bytes; ++ __u32 packets; ++}; ++struct gnet_stats_basic_packed { ++ __u64 bytes; ++ __u32 packets; ++} __attribute__ ((packed)); ++ ++/** ++ * struct gnet_stats_rate_est - rate estimator ++ * @bps: current byte rate ++ * @pps: current packet rate ++ */ ++struct gnet_stats_rate_est { ++ __u32 bps; ++ __u32 pps; ++}; ++ ++/** ++ * struct gnet_stats_rate_est64 - rate estimator ++ * @bps: current byte rate ++ * @pps: current packet rate ++ */ ++struct gnet_stats_rate_est64 { ++ __u64 bps; ++ __u64 pps; ++}; ++ ++/** ++ * struct gnet_stats_queue - queuing statistics ++ * @qlen: queue length ++ * @backlog: backlog size of queue ++ * @drops: number of dropped packets ++ * @requeues: number of requeues ++ * @overlimits: number of enqueues over the limit ++ */ ++struct gnet_stats_queue { ++ __u32 qlen; ++ __u32 backlog; ++ __u32 drops; ++ __u32 requeues; ++ __u32 overlimits; ++}; ++ ++/** ++ * struct gnet_estimator - rate estimator configuration ++ * @interval: sampling period ++ * @ewma_log: the log of measurement window weight ++ */ ++struct gnet_estimator { ++ signed char interval; ++ unsigned char ewma_log; ++}; ++ ++ ++#endif /* __LINUX_GEN_STATS_H */ +diff --git a/include/uapi/linux/genetlink.h b/include/uapi/linux/genetlink.h +new file mode 100644 +index 0000000..08239d8 +--- /dev/null ++++ b/include/uapi/linux/genetlink.h +@@ -0,0 +1,88 @@ ++#ifndef __LINUX_GENERIC_NETLINK_H ++#define __LINUX_GENERIC_NETLINK_H ++ ++#include ++#include ++ ++#define GENL_NAMSIZ 16 /* length of family name */ ++ ++#define GENL_MIN_ID NLMSG_MIN_TYPE ++#define GENL_MAX_ID 1023 ++ ++struct genlmsghdr { ++ __u8 cmd; ++ __u8 version; ++ __u16 reserved; ++}; ++ ++#define GENL_HDRLEN NLMSG_ALIGN(sizeof(struct genlmsghdr)) ++ ++#define GENL_ADMIN_PERM 0x01 ++#define GENL_CMD_CAP_DO 0x02 ++#define GENL_CMD_CAP_DUMP 0x04 ++#define GENL_CMD_CAP_HASPOL 0x08 ++#define GENL_UNS_ADMIN_PERM 0x10 ++ ++/* ++ * List of reserved static generic netlink identifiers: ++ */ ++#define GENL_ID_CTRL NLMSG_MIN_TYPE ++#define GENL_ID_VFS_DQUOT (NLMSG_MIN_TYPE + 1) ++#define GENL_ID_PMCRAID (NLMSG_MIN_TYPE + 2) ++/* must be last reserved + 1 */ ++#define GENL_START_ALLOC (NLMSG_MIN_TYPE + 3) ++ ++/************************************************************************** ++ * Controller ++ **************************************************************************/ ++ ++enum { ++ CTRL_CMD_UNSPEC, ++ CTRL_CMD_NEWFAMILY, ++ CTRL_CMD_DELFAMILY, ++ CTRL_CMD_GETFAMILY, ++ CTRL_CMD_NEWOPS, ++ CTRL_CMD_DELOPS, ++ CTRL_CMD_GETOPS, ++ CTRL_CMD_NEWMCAST_GRP, ++ CTRL_CMD_DELMCAST_GRP, ++ CTRL_CMD_GETMCAST_GRP, /* unused */ ++ __CTRL_CMD_MAX, ++}; ++ ++#define CTRL_CMD_MAX (__CTRL_CMD_MAX - 1) ++ ++enum { ++ CTRL_ATTR_UNSPEC, ++ CTRL_ATTR_FAMILY_ID, ++ CTRL_ATTR_FAMILY_NAME, ++ CTRL_ATTR_VERSION, ++ CTRL_ATTR_HDRSIZE, ++ CTRL_ATTR_MAXATTR, ++ CTRL_ATTR_OPS, ++ CTRL_ATTR_MCAST_GROUPS, ++ __CTRL_ATTR_MAX, ++}; ++ ++#define CTRL_ATTR_MAX (__CTRL_ATTR_MAX - 1) ++ ++enum { ++ CTRL_ATTR_OP_UNSPEC, ++ CTRL_ATTR_OP_ID, ++ CTRL_ATTR_OP_FLAGS, ++ __CTRL_ATTR_OP_MAX, ++}; ++ ++#define CTRL_ATTR_OP_MAX (__CTRL_ATTR_OP_MAX - 1) ++ ++enum { ++ CTRL_ATTR_MCAST_GRP_UNSPEC, ++ CTRL_ATTR_MCAST_GRP_NAME, ++ CTRL_ATTR_MCAST_GRP_ID, ++ __CTRL_ATTR_MCAST_GRP_MAX, ++}; ++ ++#define CTRL_ATTR_MCAST_GRP_MAX (__CTRL_ATTR_MCAST_GRP_MAX - 1) ++ ++ ++#endif /* __LINUX_GENERIC_NETLINK_H */ +diff --git a/include/uapi/linux/hdlc/ioctl.h b/include/uapi/linux/hdlc/ioctl.h +new file mode 100644 +index 0000000..04bc027 +--- /dev/null ++++ b/include/uapi/linux/hdlc/ioctl.h +@@ -0,0 +1,84 @@ ++#ifndef __HDLC_IOCTL_H__ ++#define __HDLC_IOCTL_H__ ++ ++ ++#define GENERIC_HDLC_VERSION 4 /* For synchronization with sethdlc utility */ ++ ++#define CLOCK_DEFAULT 0 /* Default setting */ ++#define CLOCK_EXT 1 /* External TX and RX clock - DTE */ ++#define CLOCK_INT 2 /* Internal TX and RX clock - DCE */ ++#define CLOCK_TXINT 3 /* Internal TX and external RX clock */ ++#define CLOCK_TXFROMRX 4 /* TX clock derived from external RX clock */ ++ ++ ++#define ENCODING_DEFAULT 0 /* Default setting */ ++#define ENCODING_NRZ 1 ++#define ENCODING_NRZI 2 ++#define ENCODING_FM_MARK 3 ++#define ENCODING_FM_SPACE 4 ++#define ENCODING_MANCHESTER 5 ++ ++ ++#define PARITY_DEFAULT 0 /* Default setting */ ++#define PARITY_NONE 1 /* No parity */ ++#define PARITY_CRC16_PR0 2 /* CRC16, initial value 0x0000 */ ++#define PARITY_CRC16_PR1 3 /* CRC16, initial value 0xFFFF */ ++#define PARITY_CRC16_PR0_CCITT 4 /* CRC16, initial 0x0000, ITU-T version */ ++#define PARITY_CRC16_PR1_CCITT 5 /* CRC16, initial 0xFFFF, ITU-T version */ ++#define PARITY_CRC32_PR0_CCITT 6 /* CRC32, initial value 0x00000000 */ ++#define PARITY_CRC32_PR1_CCITT 7 /* CRC32, initial value 0xFFFFFFFF */ ++ ++#define LMI_DEFAULT 0 /* Default setting */ ++#define LMI_NONE 1 /* No LMI, all PVCs are static */ ++#define LMI_ANSI 2 /* ANSI Annex D */ ++#define LMI_CCITT 3 /* ITU-T Annex A */ ++#define LMI_CISCO 4 /* The "original" LMI, aka Gang of Four */ ++ ++#ifndef __ASSEMBLY__ ++ ++typedef struct { ++ unsigned int clock_rate; /* bits per second */ ++ unsigned int clock_type; /* internal, external, TX-internal etc. */ ++ unsigned short loopback; ++} sync_serial_settings; /* V.35, V.24, X.21 */ ++ ++typedef struct { ++ unsigned int clock_rate; /* bits per second */ ++ unsigned int clock_type; /* internal, external, TX-internal etc. */ ++ unsigned short loopback; ++ unsigned int slot_map; ++} te1_settings; /* T1, E1 */ ++ ++typedef struct { ++ unsigned short encoding; ++ unsigned short parity; ++} raw_hdlc_proto; ++ ++typedef struct { ++ unsigned int t391; ++ unsigned int t392; ++ unsigned int n391; ++ unsigned int n392; ++ unsigned int n393; ++ unsigned short lmi; ++ unsigned short dce; /* 1 for DCE (network side) operation */ ++} fr_proto; ++ ++typedef struct { ++ unsigned int dlci; ++} fr_proto_pvc; /* for creating/deleting FR PVCs */ ++ ++typedef struct { ++ unsigned int dlci; ++ char master[IFNAMSIZ]; /* Name of master FRAD device */ ++}fr_proto_pvc_info; /* for returning PVC information only */ ++ ++typedef struct { ++ unsigned int interval; ++ unsigned int timeout; ++} cisco_proto; ++ ++/* PPP doesn't need any info now - supply length = 0 to ioctl */ ++ ++#endif /* __ASSEMBLY__ */ ++#endif /* __HDLC_IOCTL_H__ */ +diff --git a/include/uapi/linux/icmpv6.h b/include/uapi/linux/icmpv6.h +new file mode 100644 +index 0000000..a2e839e +--- /dev/null ++++ b/include/uapi/linux/icmpv6.h +@@ -0,0 +1,166 @@ ++#ifndef _LINUX_ICMPV6_H ++#define _LINUX_ICMPV6_H ++ ++#include ++#include ++ ++struct icmp6hdr { ++ ++ __u8 icmp6_type; ++ __u8 icmp6_code; ++ __sum16 icmp6_cksum; ++ ++ ++ union { ++ __be32 un_data32[1]; ++ __be16 un_data16[2]; ++ __u8 un_data8[4]; ++ ++ struct icmpv6_echo { ++ __be16 identifier; ++ __be16 sequence; ++ } u_echo; ++ ++ struct icmpv6_nd_advt { ++#if defined(__LITTLE_ENDIAN_BITFIELD) ++ __u32 reserved:5, ++ override:1, ++ solicited:1, ++ router:1, ++ reserved2:24; ++#elif defined(__BIG_ENDIAN_BITFIELD) ++ __u32 router:1, ++ solicited:1, ++ override:1, ++ reserved:29; ++#else ++#error "Please fix " ++#endif ++ } u_nd_advt; ++ ++ struct icmpv6_nd_ra { ++ __u8 hop_limit; ++#if defined(__LITTLE_ENDIAN_BITFIELD) ++ __u8 reserved:3, ++ router_pref:2, ++ home_agent:1, ++ other:1, ++ managed:1; ++ ++#elif defined(__BIG_ENDIAN_BITFIELD) ++ __u8 managed:1, ++ other:1, ++ home_agent:1, ++ router_pref:2, ++ reserved:3; ++#else ++#error "Please fix " ++#endif ++ __be16 rt_lifetime; ++ } u_nd_ra; ++ ++ } icmp6_dataun; ++ ++#define icmp6_identifier icmp6_dataun.u_echo.identifier ++#define icmp6_sequence icmp6_dataun.u_echo.sequence ++#define icmp6_pointer icmp6_dataun.un_data32[0] ++#define icmp6_mtu icmp6_dataun.un_data32[0] ++#define icmp6_unused icmp6_dataun.un_data32[0] ++#define icmp6_maxdelay icmp6_dataun.un_data16[0] ++#define icmp6_router icmp6_dataun.u_nd_advt.router ++#define icmp6_solicited icmp6_dataun.u_nd_advt.solicited ++#define icmp6_override icmp6_dataun.u_nd_advt.override ++#define icmp6_ndiscreserved icmp6_dataun.u_nd_advt.reserved ++#define icmp6_hop_limit icmp6_dataun.u_nd_ra.hop_limit ++#define icmp6_addrconf_managed icmp6_dataun.u_nd_ra.managed ++#define icmp6_addrconf_other icmp6_dataun.u_nd_ra.other ++#define icmp6_rt_lifetime icmp6_dataun.u_nd_ra.rt_lifetime ++#define icmp6_router_pref icmp6_dataun.u_nd_ra.router_pref ++}; ++ ++ ++#define ICMPV6_ROUTER_PREF_LOW 0x3 ++#define ICMPV6_ROUTER_PREF_MEDIUM 0x0 ++#define ICMPV6_ROUTER_PREF_HIGH 0x1 ++#define ICMPV6_ROUTER_PREF_INVALID 0x2 ++ ++#define ICMPV6_DEST_UNREACH 1 ++#define ICMPV6_PKT_TOOBIG 2 ++#define ICMPV6_TIME_EXCEED 3 ++#define ICMPV6_PARAMPROB 4 ++ ++#define ICMPV6_INFOMSG_MASK 0x80 ++ ++#define ICMPV6_ECHO_REQUEST 128 ++#define ICMPV6_ECHO_REPLY 129 ++#define ICMPV6_MGM_QUERY 130 ++#define ICMPV6_MGM_REPORT 131 ++#define ICMPV6_MGM_REDUCTION 132 ++ ++#define ICMPV6_NI_QUERY 139 ++#define ICMPV6_NI_REPLY 140 ++ ++#define ICMPV6_MLD2_REPORT 143 ++ ++#define ICMPV6_DHAAD_REQUEST 144 ++#define ICMPV6_DHAAD_REPLY 145 ++#define ICMPV6_MOBILE_PREFIX_SOL 146 ++#define ICMPV6_MOBILE_PREFIX_ADV 147 ++ ++/* ++ * Codes for Destination Unreachable ++ */ ++#define ICMPV6_NOROUTE 0 ++#define ICMPV6_ADM_PROHIBITED 1 ++#define ICMPV6_NOT_NEIGHBOUR 2 ++#define ICMPV6_ADDR_UNREACH 3 ++#define ICMPV6_PORT_UNREACH 4 ++#define ICMPV6_POLICY_FAIL 5 ++#define ICMPV6_REJECT_ROUTE 6 ++ ++/* ++ * Codes for Time Exceeded ++ */ ++#define ICMPV6_EXC_HOPLIMIT 0 ++#define ICMPV6_EXC_FRAGTIME 1 ++ ++/* ++ * Codes for Parameter Problem ++ */ ++#define ICMPV6_HDR_FIELD 0 ++#define ICMPV6_UNK_NEXTHDR 1 ++#define ICMPV6_UNK_OPTION 2 ++ ++/* ++ * constants for (set|get)sockopt ++ */ ++ ++#define ICMPV6_FILTER 1 ++ ++/* ++ * ICMPV6 filter ++ */ ++ ++#define ICMPV6_FILTER_BLOCK 1 ++#define ICMPV6_FILTER_PASS 2 ++#define ICMPV6_FILTER_BLOCKOTHERS 3 ++#define ICMPV6_FILTER_PASSONLY 4 ++ ++struct icmp6_filter { ++ __u32 data[8]; ++}; ++ ++/* ++ * Definitions for MLDv2 ++ */ ++#define MLD2_MODE_IS_INCLUDE 1 ++#define MLD2_MODE_IS_EXCLUDE 2 ++#define MLD2_CHANGE_TO_INCLUDE 3 ++#define MLD2_CHANGE_TO_EXCLUDE 4 ++#define MLD2_ALLOW_NEW_SOURCES 5 ++#define MLD2_BLOCK_OLD_SOURCES 6 ++ ++#define MLD2_ALL_MCR_INIT { { { 0xff,0x02,0,0,0,0,0,0,0,0,0,0,0,0,0,0x16 } } } ++ ++ ++#endif /* _LINUX_ICMPV6_H */ +diff --git a/include/uapi/linux/if.h b/include/uapi/linux/if.h +new file mode 100644 +index 0000000..b4ba020 +--- /dev/null ++++ b/include/uapi/linux/if.h +@@ -0,0 +1,292 @@ ++/* ++ * INET An implementation of the TCP/IP protocol suite for the LINUX ++ * operating system. INET is implemented using the BSD Socket ++ * interface as the means of communication with the user level. ++ * ++ * Global definitions for the INET interface module. ++ * ++ * Version: @(#)if.h 1.0.2 04/18/93 ++ * ++ * Authors: Original taken from Berkeley UNIX 4.3, (c) UCB 1982-1988 ++ * Ross Biro ++ * Fred N. van Kempen, ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version ++ * 2 of the License, or (at your option) any later version. ++ */ ++#ifndef _LINUX_IF_H ++#define _LINUX_IF_H ++ ++#include /* for compatibility with glibc */ ++#include /* for "__kernel_caddr_t" et al */ ++#include /* for "struct sockaddr" et al */ ++ /* for "__user" et al */ ++ ++#include /* for struct sockaddr. */ ++ ++#if __UAPI_DEF_IF_IFNAMSIZ ++#define IFNAMSIZ 16 ++#endif /* __UAPI_DEF_IF_IFNAMSIZ */ ++#define IFALIASZ 256 ++#include ++ ++/* For glibc compatibility. An empty enum does not compile. */ ++#if __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO != 0 || \ ++ __UAPI_DEF_IF_NET_DEVICE_FLAGS != 0 ++/** ++ * enum net_device_flags - &struct net_device flags ++ * ++ * These are the &struct net_device flags, they can be set by drivers, the ++ * kernel and some can be triggered by userspace. Userspace can query and ++ * set these flags using userspace utilities but there is also a sysfs ++ * entry available for all dev flags which can be queried and set. These flags ++ * are shared for all types of net_devices. The sysfs entries are available ++ * via /sys/class/net//flags. Flags which can be toggled through sysfs ++ * are annotated below, note that only a few flags can be toggled and some ++ * other flags are always preserved from the original net_device flags ++ * even if you try to set them via sysfs. Flags which are always preserved ++ * are kept under the flag grouping @IFF_VOLATILE. Flags which are __volatile__ ++ * are annotated below as such. ++ * ++ * You should have a pretty good reason to be extending these flags. ++ * ++ * @IFF_UP: interface is up. Can be toggled through sysfs. ++ * @IFF_BROADCAST: broadcast address valid. Volatile. ++ * @IFF_DEBUG: turn on debugging. Can be toggled through sysfs. ++ * @IFF_LOOPBACK: is a loopback net. Volatile. ++ * @IFF_POINTOPOINT: interface is has p-p link. Volatile. ++ * @IFF_NOTRAILERS: avoid use of trailers. Can be toggled through sysfs. ++ * Volatile. ++ * @IFF_RUNNING: interface RFC2863 OPER_UP. Volatile. ++ * @IFF_NOARP: no ARP protocol. Can be toggled through sysfs. Volatile. ++ * @IFF_PROMISC: receive all packets. Can be toggled through sysfs. ++ * @IFF_ALLMULTI: receive all multicast packets. Can be toggled through ++ * sysfs. ++ * @IFF_MASTER: master of a load balancer. Volatile. ++ * @IFF_SLAVE: slave of a load balancer. Volatile. ++ * @IFF_MULTICAST: Supports multicast. Can be toggled through sysfs. ++ * @IFF_PORTSEL: can set media type. Can be toggled through sysfs. ++ * @IFF_AUTOMEDIA: auto media select active. Can be toggled through sysfs. ++ * @IFF_DYNAMIC: dialup device with changing addresses. Can be toggled ++ * through sysfs. ++ * @IFF_LOWER_UP: driver signals L1 up. Volatile. ++ * @IFF_DORMANT: driver signals dormant. Volatile. ++ * @IFF_ECHO: echo sent packets. Volatile. ++ */ ++enum net_device_flags { ++/* for compatibility with glibc net/if.h */ ++#if __UAPI_DEF_IF_NET_DEVICE_FLAGS ++ IFF_UP = 1<<0, /* sysfs */ ++ IFF_BROADCAST = 1<<1, /* __volatile__ */ ++ IFF_DEBUG = 1<<2, /* sysfs */ ++ IFF_LOOPBACK = 1<<3, /* __volatile__ */ ++ IFF_POINTOPOINT = 1<<4, /* __volatile__ */ ++ IFF_NOTRAILERS = 1<<5, /* sysfs */ ++ IFF_RUNNING = 1<<6, /* __volatile__ */ ++ IFF_NOARP = 1<<7, /* sysfs */ ++ IFF_PROMISC = 1<<8, /* sysfs */ ++ IFF_ALLMULTI = 1<<9, /* sysfs */ ++ IFF_MASTER = 1<<10, /* __volatile__ */ ++ IFF_SLAVE = 1<<11, /* __volatile__ */ ++ IFF_MULTICAST = 1<<12, /* sysfs */ ++ IFF_PORTSEL = 1<<13, /* sysfs */ ++ IFF_AUTOMEDIA = 1<<14, /* sysfs */ ++ IFF_DYNAMIC = 1<<15, /* sysfs */ ++#endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS */ ++#if __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO ++ IFF_LOWER_UP = 1<<16, /* __volatile__ */ ++ IFF_DORMANT = 1<<17, /* __volatile__ */ ++ IFF_ECHO = 1<<18, /* __volatile__ */ ++#endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */ ++}; ++#endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO != 0 || __UAPI_DEF_IF_NET_DEVICE_FLAGS != 0 */ ++ ++/* for compatibility with glibc net/if.h */ ++#if __UAPI_DEF_IF_NET_DEVICE_FLAGS ++#define IFF_UP IFF_UP ++#define IFF_BROADCAST IFF_BROADCAST ++#define IFF_DEBUG IFF_DEBUG ++#define IFF_LOOPBACK IFF_LOOPBACK ++#define IFF_POINTOPOINT IFF_POINTOPOINT ++#define IFF_NOTRAILERS IFF_NOTRAILERS ++#define IFF_RUNNING IFF_RUNNING ++#define IFF_NOARP IFF_NOARP ++#define IFF_PROMISC IFF_PROMISC ++#define IFF_ALLMULTI IFF_ALLMULTI ++#define IFF_MASTER IFF_MASTER ++#define IFF_SLAVE IFF_SLAVE ++#define IFF_MULTICAST IFF_MULTICAST ++#define IFF_PORTSEL IFF_PORTSEL ++#define IFF_AUTOMEDIA IFF_AUTOMEDIA ++#define IFF_DYNAMIC IFF_DYNAMIC ++#endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS */ ++ ++#if __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO ++#define IFF_LOWER_UP IFF_LOWER_UP ++#define IFF_DORMANT IFF_DORMANT ++#define IFF_ECHO IFF_ECHO ++#endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */ ++ ++#define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\ ++ IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT) ++ ++#define IF_GET_IFACE 0x0001 /* for querying only */ ++#define IF_GET_PROTO 0x0002 ++ ++/* For definitions see hdlc.h */ ++#define IF_IFACE_V35 0x1000 /* V.35 serial interface */ ++#define IF_IFACE_V24 0x1001 /* V.24 serial interface */ ++#define IF_IFACE_X21 0x1002 /* X.21 serial interface */ ++#define IF_IFACE_T1 0x1003 /* T1 telco serial interface */ ++#define IF_IFACE_E1 0x1004 /* E1 telco serial interface */ ++#define IF_IFACE_SYNC_SERIAL 0x1005 /* can't be set by software */ ++#define IF_IFACE_X21D 0x1006 /* X.21 Dual Clocking (FarSite) */ ++ ++/* For definitions see hdlc.h */ ++#define IF_PROTO_HDLC 0x2000 /* raw HDLC protocol */ ++#define IF_PROTO_PPP 0x2001 /* PPP protocol */ ++#define IF_PROTO_CISCO 0x2002 /* Cisco HDLC protocol */ ++#define IF_PROTO_FR 0x2003 /* Frame Relay protocol */ ++#define IF_PROTO_FR_ADD_PVC 0x2004 /* Create FR PVC */ ++#define IF_PROTO_FR_DEL_PVC 0x2005 /* Delete FR PVC */ ++#define IF_PROTO_X25 0x2006 /* X.25 */ ++#define IF_PROTO_HDLC_ETH 0x2007 /* raw HDLC, Ethernet emulation */ ++#define IF_PROTO_FR_ADD_ETH_PVC 0x2008 /* Create FR Ethernet-bridged PVC */ ++#define IF_PROTO_FR_DEL_ETH_PVC 0x2009 /* Delete FR Ethernet-bridged PVC */ ++#define IF_PROTO_FR_PVC 0x200A /* for reading PVC status */ ++#define IF_PROTO_FR_ETH_PVC 0x200B ++#define IF_PROTO_RAW 0x200C /* RAW Socket */ ++ ++/* RFC 2863 operational status */ ++enum { ++ IF_OPER_UNKNOWN, ++ IF_OPER_NOTPRESENT, ++ IF_OPER_DOWN, ++ IF_OPER_LOWERLAYERDOWN, ++ IF_OPER_TESTING, ++ IF_OPER_DORMANT, ++ IF_OPER_UP, ++}; ++ ++/* link modes */ ++enum { ++ IF_LINK_MODE_DEFAULT, ++ IF_LINK_MODE_DORMANT, /* limit upward transition to dormant */ ++}; ++ ++/* ++ * Device mapping structure. I'd just gone off and designed a ++ * beautiful scheme using only loadable modules with arguments ++ * for driver options and along come the PCMCIA people 8) ++ * ++ * Ah well. The get() side of this is good for WDSETUP, and it'll ++ * be handy for debugging things. The set side is fine for now and ++ * being very small might be worth keeping for clean configuration. ++ */ ++ ++/* for compatibility with glibc net/if.h */ ++#if __UAPI_DEF_IF_IFMAP ++struct ifmap { ++ unsigned long mem_start; ++ unsigned long mem_end; ++ unsigned short base_addr; ++ unsigned char irq; ++ unsigned char dma; ++ unsigned char port; ++ /* 3 bytes spare */ ++}; ++#endif /* __UAPI_DEF_IF_IFMAP */ ++ ++struct if_settings { ++ unsigned int type; /* Type of physical device or protocol */ ++ unsigned int size; /* Size of the data allocated by the caller */ ++ union { ++ /* {atm/eth/dsl}_settings anyone ? */ ++ raw_hdlc_proto *raw_hdlc; ++ cisco_proto *cisco; ++ fr_proto *fr; ++ fr_proto_pvc *fr_pvc; ++ fr_proto_pvc_info *fr_pvc_info; ++ ++ /* interface settings */ ++ sync_serial_settings *sync; ++ te1_settings *te1; ++ } ifs_ifsu; ++}; ++ ++/* ++ * Interface request structure used for socket ++ * ioctl's. All interface ioctl's must have parameter ++ * definitions which begin with ifr_name. The ++ * remainder may be interface specific. ++ */ ++ ++/* for compatibility with glibc net/if.h */ ++#if __UAPI_DEF_IF_IFREQ ++struct ifreq { ++#define IFHWADDRLEN 6 ++ union ++ { ++ char ifrn_name[IFNAMSIZ]; /* if name, e.g. "en0" */ ++ } ifr_ifrn; ++ ++ union { ++ struct sockaddr ifru_addr; ++ struct sockaddr ifru_dstaddr; ++ struct sockaddr ifru_broadaddr; ++ struct sockaddr ifru_netmask; ++ struct sockaddr ifru_hwaddr; ++ short ifru_flags; ++ int ifru_ivalue; ++ int ifru_mtu; ++ struct ifmap ifru_map; ++ char ifru_slave[IFNAMSIZ]; /* Just fits the size */ ++ char ifru_newname[IFNAMSIZ]; ++ void * ifru_data; ++ struct if_settings ifru_settings; ++ } ifr_ifru; ++}; ++#endif /* __UAPI_DEF_IF_IFREQ */ ++ ++#define ifr_name ifr_ifrn.ifrn_name /* interface name */ ++#define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */ ++#define ifr_addr ifr_ifru.ifru_addr /* address */ ++#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-p lnk */ ++#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ ++#define ifr_netmask ifr_ifru.ifru_netmask /* interface net mask */ ++#define ifr_flags ifr_ifru.ifru_flags /* flags */ ++#define ifr_metric ifr_ifru.ifru_ivalue /* metric */ ++#define ifr_mtu ifr_ifru.ifru_mtu /* mtu */ ++#define ifr_map ifr_ifru.ifru_map /* device map */ ++#define ifr_slave ifr_ifru.ifru_slave /* slave device */ ++#define ifr_data ifr_ifru.ifru_data /* for use by interface */ ++#define ifr_ifindex ifr_ifru.ifru_ivalue /* interface index */ ++#define ifr_bandwidth ifr_ifru.ifru_ivalue /* link bandwidth */ ++#define ifr_qlen ifr_ifru.ifru_ivalue /* Queue length */ ++#define ifr_newname ifr_ifru.ifru_newname /* New name */ ++#define ifr_settings ifr_ifru.ifru_settings /* Device/proto settings*/ ++ ++/* ++ * Structure used in SIOCGIFCONF request. ++ * Used to retrieve interface configuration ++ * for machine (useful for programs which ++ * must know all networks accessible). ++ */ ++ ++/* for compatibility with glibc net/if.h */ ++#if __UAPI_DEF_IF_IFCONF ++struct ifconf { ++ int ifc_len; /* size of buffer */ ++ union { ++ char *ifcu_buf; ++ struct ifreq *ifcu_req; ++ } ifc_ifcu; ++}; ++#endif /* __UAPI_DEF_IF_IFCONF */ ++ ++#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */ ++#define ifc_req ifc_ifcu.ifcu_req /* array of structures */ ++ ++#endif /* _LINUX_IF_H */ +diff --git a/include/uapi/linux/if_addr.h b/include/uapi/linux/if_addr.h +new file mode 100644 +index 0000000..26f0ecf +--- /dev/null ++++ b/include/uapi/linux/if_addr.h +@@ -0,0 +1,67 @@ ++#ifndef __LINUX_IF_ADDR_H ++#define __LINUX_IF_ADDR_H ++ ++#include ++#include ++ ++struct ifaddrmsg { ++ __u8 ifa_family; ++ __u8 ifa_prefixlen; /* The prefix length */ ++ __u8 ifa_flags; /* Flags */ ++ __u8 ifa_scope; /* Address scope */ ++ __u32 ifa_index; /* Link index */ ++}; ++ ++/* ++ * Important comment: ++ * IFA_ADDRESS is prefix address, rather than local interface address. ++ * It makes no difference for normally configured broadcast interfaces, ++ * but for point-to-point IFA_ADDRESS is DESTINATION address, ++ * local address is supplied in IFA_LOCAL attribute. ++ * ++ * IFA_FLAGS is a u32 attribute that extends the u8 field ifa_flags. ++ * If present, the value from struct ifaddrmsg will be ignored. ++ */ ++enum { ++ IFA_UNSPEC, ++ IFA_ADDRESS, ++ IFA_LOCAL, ++ IFA_LABEL, ++ IFA_BROADCAST, ++ IFA_ANYCAST, ++ IFA_CACHEINFO, ++ IFA_MULTICAST, ++ IFA_FLAGS, ++ __IFA_MAX, ++}; ++ ++#define IFA_MAX (__IFA_MAX - 1) ++ ++/* ifa_flags */ ++#define IFA_F_SECONDARY 0x01 ++#define IFA_F_TEMPORARY IFA_F_SECONDARY ++ ++#define IFA_F_NODAD 0x02 ++#define IFA_F_OPTIMISTIC 0x04 ++#define IFA_F_DADFAILED 0x08 ++#define IFA_F_HOMEADDRESS 0x10 ++#define IFA_F_DEPRECATED 0x20 ++#define IFA_F_TENTATIVE 0x40 ++#define IFA_F_PERMANENT 0x80 ++#define IFA_F_MANAGETEMPADDR 0x100 ++#define IFA_F_NOPREFIXROUTE 0x200 ++#define IFA_F_MCAUTOJOIN 0x400 ++#define IFA_F_STABLE_PRIVACY 0x800 ++ ++struct ifa_cacheinfo { ++ __u32 ifa_prefered; ++ __u32 ifa_valid; ++ __u32 cstamp; /* created timestamp, hundredths of seconds */ ++ __u32 tstamp; /* updated timestamp, hundredths of seconds */ ++}; ++ ++/* backwards compatibility for userspace */ ++#define IFA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifaddrmsg)))) ++#define IFA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ifaddrmsg)) ++ ++#endif +diff --git a/include/uapi/linux/if_addrlabel.h b/include/uapi/linux/if_addrlabel.h +new file mode 100644 +index 0000000..54580c2 +--- /dev/null ++++ b/include/uapi/linux/if_addrlabel.h +@@ -0,0 +1,32 @@ ++/* ++ * if_addrlabel.h - netlink interface for address labels ++ * ++ * Copyright (C)2007 USAGI/WIDE Project, All Rights Reserved. ++ * ++ * Authors: ++ * YOSHIFUJI Hideaki @ USAGI/WIDE ++ */ ++ ++#ifndef __LINUX_IF_ADDRLABEL_H ++#define __LINUX_IF_ADDRLABEL_H ++ ++#include ++ ++struct ifaddrlblmsg { ++ __u8 ifal_family; /* Address family */ ++ __u8 __ifal_reserved; /* Reserved */ ++ __u8 ifal_prefixlen; /* Prefix length */ ++ __u8 ifal_flags; /* Flags */ ++ __u32 ifal_index; /* Link index */ ++ __u32 ifal_seq; /* sequence number */ ++}; ++ ++enum { ++ IFAL_ADDRESS = 1, ++ IFAL_LABEL = 2, ++ __IFAL_MAX ++}; ++ ++#define IFAL_MAX (__IFAL_MAX - 1) ++ ++#endif +diff --git a/include/uapi/linux/if_alg.h b/include/uapi/linux/if_alg.h +new file mode 100644 +index 0000000..f2acd2f +--- /dev/null ++++ b/include/uapi/linux/if_alg.h +@@ -0,0 +1,42 @@ ++/* ++ * if_alg: User-space algorithm interface ++ * ++ * Copyright (c) 2010 Herbert Xu ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the Free ++ * Software Foundation; either version 2 of the License, or (at your option) ++ * any later version. ++ * ++ */ ++ ++#ifndef _LINUX_IF_ALG_H ++#define _LINUX_IF_ALG_H ++ ++#include ++ ++struct sockaddr_alg { ++ __u16 salg_family; ++ __u8 salg_type[14]; ++ __u32 salg_feat; ++ __u32 salg_mask; ++ __u8 salg_name[64]; ++}; ++ ++struct af_alg_iv { ++ __u32 ivlen; ++ __u8 iv[0]; ++}; ++ ++/* Socket options */ ++#define ALG_SET_KEY 1 ++#define ALG_SET_IV 2 ++#define ALG_SET_OP 3 ++#define ALG_SET_AEAD_ASSOCLEN 4 ++#define ALG_SET_AEAD_AUTHSIZE 5 ++ ++/* Operations */ ++#define ALG_OP_DECRYPT 0 ++#define ALG_OP_ENCRYPT 1 ++ ++#endif /* _LINUX_IF_ALG_H */ +diff --git a/include/uapi/linux/if_arp.h b/include/uapi/linux/if_arp.h +new file mode 100644 +index 0000000..199f253 +--- /dev/null ++++ b/include/uapi/linux/if_arp.h +@@ -0,0 +1,163 @@ ++/* ++ * INET An implementation of the TCP/IP protocol suite for the LINUX ++ * operating system. INET is implemented using the BSD Socket ++ * interface as the means of communication with the user level. ++ * ++ * Global definitions for the ARP (RFC 826) protocol. ++ * ++ * Version: @(#)if_arp.h 1.0.1 04/16/93 ++ * ++ * Authors: Original taken from Berkeley UNIX 4.3, (c) UCB 1986-1988 ++ * Portions taken from the KA9Q/NOS (v2.00m PA0GRI) source. ++ * Ross Biro ++ * Fred N. van Kempen, ++ * Florian La Roche, ++ * Jonathan Layes ++ * Arnaldo Carvalho de Melo ARPHRD_HWX25 ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version ++ * 2 of the License, or (at your option) any later version. ++ */ ++#ifndef _LINUX_IF_ARP_H ++#define _LINUX_IF_ARP_H ++ ++#include ++ ++/* ARP protocol HARDWARE identifiers. */ ++#define ARPHRD_NETROM 0 /* from KA9Q: NET/ROM pseudo */ ++#define ARPHRD_ETHER 1 /* Ethernet 10Mbps */ ++#define ARPHRD_EETHER 2 /* Experimental Ethernet */ ++#define ARPHRD_AX25 3 /* AX.25 Level 2 */ ++#define ARPHRD_PRONET 4 /* PROnet token ring */ ++#define ARPHRD_CHAOS 5 /* Chaosnet */ ++#define ARPHRD_IEEE802 6 /* IEEE 802.2 Ethernet/TR/TB */ ++#define ARPHRD_ARCNET 7 /* ARCnet */ ++#define ARPHRD_APPLETLK 8 /* APPLEtalk */ ++#define ARPHRD_DLCI 15 /* Frame Relay DLCI */ ++#define ARPHRD_ATM 19 /* ATM */ ++#define ARPHRD_METRICOM 23 /* Metricom STRIP (new IANA id) */ ++#define ARPHRD_IEEE1394 24 /* IEEE 1394 IPv4 - RFC 2734 */ ++#define ARPHRD_EUI64 27 /* EUI-64 */ ++#define ARPHRD_INFINIBAND 32 /* InfiniBand */ ++ ++/* Dummy types for non ARP hardware */ ++#define ARPHRD_SLIP 256 ++#define ARPHRD_CSLIP 257 ++#define ARPHRD_SLIP6 258 ++#define ARPHRD_CSLIP6 259 ++#define ARPHRD_RSRVD 260 /* Notional KISS type */ ++#define ARPHRD_ADAPT 264 ++#define ARPHRD_ROSE 270 ++#define ARPHRD_X25 271 /* CCITT X.25 */ ++#define ARPHRD_HWX25 272 /* Boards with X.25 in firmware */ ++#define ARPHRD_CAN 280 /* Controller Area Network */ ++#define ARPHRD_PPP 512 ++#define ARPHRD_CISCO 513 /* Cisco HDLC */ ++#define ARPHRD_HDLC ARPHRD_CISCO ++#define ARPHRD_LAPB 516 /* LAPB */ ++#define ARPHRD_DDCMP 517 /* Digital's DDCMP protocol */ ++#define ARPHRD_RAWHDLC 518 /* Raw HDLC */ ++#define ARPHRD_RAWIP 519 /* Raw IP */ ++ ++#define ARPHRD_TUNNEL 768 /* IPIP tunnel */ ++#define ARPHRD_TUNNEL6 769 /* IP6IP6 tunnel */ ++#define ARPHRD_FRAD 770 /* Frame Relay Access Device */ ++#define ARPHRD_SKIP 771 /* SKIP vif */ ++#define ARPHRD_LOOPBACK 772 /* Loopback device */ ++#define ARPHRD_LOCALTLK 773 /* Localtalk device */ ++#define ARPHRD_FDDI 774 /* Fiber Distributed Data Interface */ ++#define ARPHRD_BIF 775 /* AP1000 BIF */ ++#define ARPHRD_SIT 776 /* sit0 device - IPv6-in-IPv4 */ ++#define ARPHRD_IPDDP 777 /* IP over DDP tunneller */ ++#define ARPHRD_IPGRE 778 /* GRE over IP */ ++#define ARPHRD_PIMREG 779 /* PIMSM register interface */ ++#define ARPHRD_HIPPI 780 /* High Performance Parallel Interface */ ++#define ARPHRD_ASH 781 /* Nexus 64Mbps Ash */ ++#define ARPHRD_ECONET 782 /* Acorn Econet */ ++#define ARPHRD_IRDA 783 /* Linux-IrDA */ ++/* ARP works differently on different FC media .. so */ ++#define ARPHRD_FCPP 784 /* Point to point fibrechannel */ ++#define ARPHRD_FCAL 785 /* Fibrechannel arbitrated loop */ ++#define ARPHRD_FCPL 786 /* Fibrechannel public loop */ ++#define ARPHRD_FCFABRIC 787 /* Fibrechannel fabric */ ++ /* 787->799 reserved for fibrechannel media types */ ++#define ARPHRD_IEEE802_TR 800 /* Magic type ident for TR */ ++#define ARPHRD_IEEE80211 801 /* IEEE 802.11 */ ++#define ARPHRD_IEEE80211_PRISM 802 /* IEEE 802.11 + Prism2 header */ ++#define ARPHRD_IEEE80211_RADIOTAP 803 /* IEEE 802.11 + radiotap header */ ++#define ARPHRD_IEEE802154 804 ++#define ARPHRD_IEEE802154_MONITOR 805 /* IEEE 802.15.4 network monitor */ ++ ++#define ARPHRD_PHONET 820 /* PhoNet media type */ ++#define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */ ++#define ARPHRD_CAIF 822 /* CAIF media type */ ++#define ARPHRD_IP6GRE 823 /* GRE over IPv6 */ ++#define ARPHRD_NETLINK 824 /* Netlink header */ ++#define ARPHRD_6LOWPAN 825 /* IPv6 over LoWPAN */ ++#define ARPHRD_VSOCKMON 826 /* Vsock monitor header */ ++ ++#define ARPHRD_VOID 0xFFFF /* Void type, nothing is known */ ++#define ARPHRD_NONE 0xFFFE /* zero header length */ ++ ++/* ARP protocol opcodes. */ ++#define ARPOP_REQUEST 1 /* ARP request */ ++#define ARPOP_REPLY 2 /* ARP reply */ ++#define ARPOP_RREQUEST 3 /* RARP request */ ++#define ARPOP_RREPLY 4 /* RARP reply */ ++#define ARPOP_InREQUEST 8 /* InARP request */ ++#define ARPOP_InREPLY 9 /* InARP reply */ ++#define ARPOP_NAK 10 /* (ATM)ARP NAK */ ++ ++ ++/* ARP ioctl request. */ ++struct arpreq { ++ struct sockaddr arp_pa; /* protocol address */ ++ struct sockaddr arp_ha; /* hardware address */ ++ int arp_flags; /* flags */ ++ struct sockaddr arp_netmask; /* netmask (only for proxy arps) */ ++ char arp_dev[16]; ++}; ++ ++struct arpreq_old { ++ struct sockaddr arp_pa; /* protocol address */ ++ struct sockaddr arp_ha; /* hardware address */ ++ int arp_flags; /* flags */ ++ struct sockaddr arp_netmask; /* netmask (only for proxy arps) */ ++}; ++ ++/* ARP Flag values. */ ++#define ATF_COM 0x02 /* completed entry (ha valid) */ ++#define ATF_PERM 0x04 /* permanent entry */ ++#define ATF_PUBL 0x08 /* publish entry */ ++#define ATF_USETRAILERS 0x10 /* has requested trailers */ ++#define ATF_NETMASK 0x20 /* want to use a netmask (only ++ for proxy entries) */ ++#define ATF_DONTPUB 0x40 /* don't answer this addresses */ ++ ++/* ++ * This structure defines an ethernet arp header. ++ */ ++ ++struct arphdr { ++ __be16 ar_hrd; /* format of hardware address */ ++ __be16 ar_pro; /* format of protocol address */ ++ unsigned char ar_hln; /* length of hardware address */ ++ unsigned char ar_pln; /* length of protocol address */ ++ __be16 ar_op; /* ARP opcode (command) */ ++ ++#if 0 ++ /* ++ * Ethernet looks like this : This bit is variable sized however... ++ */ ++ unsigned char ar_sha[ETH_ALEN]; /* sender hardware address */ ++ unsigned char ar_sip[4]; /* sender IP address */ ++ unsigned char ar_tha[ETH_ALEN]; /* target hardware address */ ++ unsigned char ar_tip[4]; /* target IP address */ ++#endif ++ ++}; ++ ++ ++#endif /* _LINUX_IF_ARP_H */ +diff --git a/include/uapi/linux/if_bonding.h b/include/uapi/linux/if_bonding.h +new file mode 100644 +index 0000000..9635a62 +--- /dev/null ++++ b/include/uapi/linux/if_bonding.h +@@ -0,0 +1,130 @@ ++/* ++ * Bond several ethernet interfaces into a Cisco, running 'Etherchannel'. ++ * ++ * ++ * Portions are (c) Copyright 1995 Simon "Guru Aleph-Null" Janes ++ * NCM: Network and Communications Management, Inc. ++ * ++ * BUT, I'm the one who modified it for ethernet, so: ++ * (c) Copyright 1999, Thomas Davis, tadavis@lbl.gov ++ * ++ * This software may be used and distributed according to the terms ++ * of the GNU Public License, incorporated herein by reference. ++ * ++ * 2003/03/18 - Amir Noam ++ * - Added support for getting slave's speed and duplex via ethtool. ++ * Needed for 802.3ad and other future modes. ++ * ++ * 2003/03/18 - Tsippy Mendelson and ++ * Shmulik Hen ++ * - Enable support of modes that need to use the unique mac address of ++ * each slave. ++ * ++ * 2003/03/18 - Tsippy Mendelson and ++ * Amir Noam ++ * - Moved driver's private data types to bonding.h ++ * ++ * 2003/03/18 - Amir Noam , ++ * Tsippy Mendelson and ++ * Shmulik Hen ++ * - Added support for IEEE 802.3ad Dynamic link aggregation mode. ++ * ++ * 2003/05/01 - Amir Noam ++ * - Added ABI version control to restore compatibility between ++ * new/old ifenslave and new/old bonding. ++ * ++ * 2003/12/01 - Shmulik Hen ++ * - Code cleanup and style changes ++ * ++ * 2005/05/05 - Jason Gabler ++ * - added definitions for various XOR hashing policies ++ */ ++ ++#ifndef _LINUX_IF_BONDING_H ++#define _LINUX_IF_BONDING_H ++ ++#include ++#include ++#include ++ ++/* userland - kernel ABI version (2003/05/08) */ ++#define BOND_ABI_VERSION 2 ++ ++/* ++ * We can remove these ioctl definitions in 2.5. People should use the ++ * SIOC*** versions of them instead ++ */ ++#define BOND_ENSLAVE_OLD (SIOCDEVPRIVATE) ++#define BOND_RELEASE_OLD (SIOCDEVPRIVATE + 1) ++#define BOND_SETHWADDR_OLD (SIOCDEVPRIVATE + 2) ++#define BOND_SLAVE_INFO_QUERY_OLD (SIOCDEVPRIVATE + 11) ++#define BOND_INFO_QUERY_OLD (SIOCDEVPRIVATE + 12) ++#define BOND_CHANGE_ACTIVE_OLD (SIOCDEVPRIVATE + 13) ++ ++#define BOND_CHECK_MII_STATUS (SIOCGMIIPHY) ++ ++#define BOND_MODE_ROUNDROBIN 0 ++#define BOND_MODE_ACTIVEBACKUP 1 ++#define BOND_MODE_XOR 2 ++#define BOND_MODE_BROADCAST 3 ++#define BOND_MODE_8023AD 4 ++#define BOND_MODE_TLB 5 ++#define BOND_MODE_ALB 6 /* TLB + RLB (receive load balancing) */ ++ ++/* each slave's link has 4 states */ ++#define BOND_LINK_UP 0 /* link is up and running */ ++#define BOND_LINK_FAIL 1 /* link has just gone down */ ++#define BOND_LINK_DOWN 2 /* link has been down for too long time */ ++#define BOND_LINK_BACK 3 /* link is going back */ ++ ++/* each slave has several states */ ++#define BOND_STATE_ACTIVE 0 /* link is active */ ++#define BOND_STATE_BACKUP 1 /* link is backup */ ++ ++#define BOND_DEFAULT_MAX_BONDS 1 /* Default maximum number of devices to support */ ++ ++#define BOND_DEFAULT_TX_QUEUES 16 /* Default number of tx queues per device */ ++ ++#define BOND_DEFAULT_RESEND_IGMP 1 /* Default number of IGMP membership reports */ ++ ++/* hashing types */ ++#define BOND_XMIT_POLICY_LAYER2 0 /* layer 2 (MAC only), default */ ++#define BOND_XMIT_POLICY_LAYER34 1 /* layer 3+4 (IP ^ (TCP || UDP)) */ ++#define BOND_XMIT_POLICY_LAYER23 2 /* layer 2+3 (IP ^ MAC) */ ++#define BOND_XMIT_POLICY_ENCAP23 3 /* encapsulated layer 2+3 */ ++#define BOND_XMIT_POLICY_ENCAP34 4 /* encapsulated layer 3+4 */ ++ ++typedef struct ifbond { ++ __s32 bond_mode; ++ __s32 num_slaves; ++ __s32 miimon; ++} ifbond; ++ ++typedef struct ifslave { ++ __s32 slave_id; /* Used as an IN param to the BOND_SLAVE_INFO_QUERY ioctl */ ++ char slave_name[IFNAMSIZ]; ++ __s8 link; ++ __s8 state; ++ __u32 link_failure_count; ++} ifslave; ++ ++struct ad_info { ++ __u16 aggregator_id; ++ __u16 ports; ++ __u16 actor_key; ++ __u16 partner_key; ++ __u8 partner_system[ETH_ALEN]; ++}; ++ ++#endif /* _LINUX_IF_BONDING_H */ ++ ++/* ++ * Local variables: ++ * version-control: t ++ * kept-new-versions: 5 ++ * c-indent-level: 8 ++ * c-basic-offset: 8 ++ * tab-width: 8 ++ * End: ++ */ ++ +diff --git a/include/uapi/linux/if_bridge.h b/include/uapi/linux/if_bridge.h +new file mode 100644 +index 0000000..156f443 +--- /dev/null ++++ b/include/uapi/linux/if_bridge.h +@@ -0,0 +1,294 @@ ++/* ++ * Linux ethernet bridge ++ * ++ * Authors: ++ * Lennert Buytenhek ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version ++ * 2 of the License, or (at your option) any later version. ++ */ ++ ++#ifndef _LINUX_IF_BRIDGE_H ++#define _LINUX_IF_BRIDGE_H ++ ++#include ++#include ++#include ++ ++#define SYSFS_BRIDGE_ATTR "bridge" ++#define SYSFS_BRIDGE_FDB "brforward" ++#define SYSFS_BRIDGE_PORT_SUBDIR "brif" ++#define SYSFS_BRIDGE_PORT_ATTR "brport" ++#define SYSFS_BRIDGE_PORT_LINK "bridge" ++ ++#define BRCTL_VERSION 1 ++ ++#define BRCTL_GET_VERSION 0 ++#define BRCTL_GET_BRIDGES 1 ++#define BRCTL_ADD_BRIDGE 2 ++#define BRCTL_DEL_BRIDGE 3 ++#define BRCTL_ADD_IF 4 ++#define BRCTL_DEL_IF 5 ++#define BRCTL_GET_BRIDGE_INFO 6 ++#define BRCTL_GET_PORT_LIST 7 ++#define BRCTL_SET_BRIDGE_FORWARD_DELAY 8 ++#define BRCTL_SET_BRIDGE_HELLO_TIME 9 ++#define BRCTL_SET_BRIDGE_MAX_AGE 10 ++#define BRCTL_SET_AGEING_TIME 11 ++#define BRCTL_SET_GC_INTERVAL 12 ++#define BRCTL_GET_PORT_INFO 13 ++#define BRCTL_SET_BRIDGE_STP_STATE 14 ++#define BRCTL_SET_BRIDGE_PRIORITY 15 ++#define BRCTL_SET_PORT_PRIORITY 16 ++#define BRCTL_SET_PATH_COST 17 ++#define BRCTL_GET_FDB_ENTRIES 18 ++ ++#define BR_STATE_DISABLED 0 ++#define BR_STATE_LISTENING 1 ++#define BR_STATE_LEARNING 2 ++#define BR_STATE_FORWARDING 3 ++#define BR_STATE_BLOCKING 4 ++ ++struct __bridge_info { ++ __u64 designated_root; ++ __u64 bridge_id; ++ __u32 root_path_cost; ++ __u32 max_age; ++ __u32 hello_time; ++ __u32 forward_delay; ++ __u32 bridge_max_age; ++ __u32 bridge_hello_time; ++ __u32 bridge_forward_delay; ++ __u8 topology_change; ++ __u8 topology_change_detected; ++ __u8 root_port; ++ __u8 stp_enabled; ++ __u32 ageing_time; ++ __u32 gc_interval; ++ __u32 hello_timer_value; ++ __u32 tcn_timer_value; ++ __u32 topology_change_timer_value; ++ __u32 gc_timer_value; ++}; ++ ++struct __port_info { ++ __u64 designated_root; ++ __u64 designated_bridge; ++ __u16 port_id; ++ __u16 designated_port; ++ __u32 path_cost; ++ __u32 designated_cost; ++ __u8 state; ++ __u8 top_change_ack; ++ __u8 config_pending; ++ __u8 unused0; ++ __u32 message_age_timer_value; ++ __u32 forward_delay_timer_value; ++ __u32 hold_timer_value; ++}; ++ ++struct __fdb_entry { ++ __u8 mac_addr[ETH_ALEN]; ++ __u8 port_no; ++ __u8 is_local; ++ __u32 ageing_timer_value; ++ __u8 port_hi; ++ __u8 pad0; ++ __u16 unused; ++}; ++ ++/* Bridge Flags */ ++#define BRIDGE_FLAGS_MASTER 1 /* Bridge command to/from master */ ++#define BRIDGE_FLAGS_SELF 2 /* Bridge command to/from lowerdev */ ++ ++#define BRIDGE_MODE_VEB 0 /* Default loopback mode */ ++#define BRIDGE_MODE_VEPA 1 /* 802.1Qbg defined VEPA mode */ ++#define BRIDGE_MODE_UNDEF 0xFFFF /* mode undefined */ ++ ++/* Bridge management nested attributes ++ * [IFLA_AF_SPEC] = { ++ * [IFLA_BRIDGE_FLAGS] ++ * [IFLA_BRIDGE_MODE] ++ * [IFLA_BRIDGE_VLAN_INFO] ++ * } ++ */ ++enum { ++ IFLA_BRIDGE_FLAGS, ++ IFLA_BRIDGE_MODE, ++ IFLA_BRIDGE_VLAN_INFO, ++ IFLA_BRIDGE_VLAN_TUNNEL_INFO, ++ __IFLA_BRIDGE_MAX, ++}; ++#define IFLA_BRIDGE_MAX (__IFLA_BRIDGE_MAX - 1) ++ ++#define BRIDGE_VLAN_INFO_MASTER (1<<0) /* Operate on Bridge device as well */ ++#define BRIDGE_VLAN_INFO_PVID (1<<1) /* VLAN is PVID, ingress untagged */ ++#define BRIDGE_VLAN_INFO_UNTAGGED (1<<2) /* VLAN egresses untagged */ ++#define BRIDGE_VLAN_INFO_RANGE_BEGIN (1<<3) /* VLAN is start of vlan range */ ++#define BRIDGE_VLAN_INFO_RANGE_END (1<<4) /* VLAN is end of vlan range */ ++#define BRIDGE_VLAN_INFO_BRENTRY (1<<5) /* Global bridge VLAN entry */ ++ ++struct bridge_vlan_info { ++ __u16 flags; ++ __u16 vid; ++}; ++ ++enum { ++ IFLA_BRIDGE_VLAN_TUNNEL_UNSPEC, ++ IFLA_BRIDGE_VLAN_TUNNEL_ID, ++ IFLA_BRIDGE_VLAN_TUNNEL_VID, ++ IFLA_BRIDGE_VLAN_TUNNEL_FLAGS, ++ __IFLA_BRIDGE_VLAN_TUNNEL_MAX, ++}; ++ ++#define IFLA_BRIDGE_VLAN_TUNNEL_MAX (__IFLA_BRIDGE_VLAN_TUNNEL_MAX - 1) ++ ++struct bridge_vlan_xstats { ++ __u64 rx_bytes; ++ __u64 rx_packets; ++ __u64 tx_bytes; ++ __u64 tx_packets; ++ __u16 vid; ++ __u16 flags; ++ __u32 pad2; ++}; ++ ++/* Bridge multicast database attributes ++ * [MDBA_MDB] = { ++ * [MDBA_MDB_ENTRY] = { ++ * [MDBA_MDB_ENTRY_INFO] { ++ * struct br_mdb_entry ++ * [MDBA_MDB_EATTR attributes] ++ * } ++ * } ++ * } ++ * [MDBA_ROUTER] = { ++ * [MDBA_ROUTER_PORT] = { ++ * u32 ifindex ++ * [MDBA_ROUTER_PATTR attributes] ++ * } ++ * } ++ */ ++enum { ++ MDBA_UNSPEC, ++ MDBA_MDB, ++ MDBA_ROUTER, ++ __MDBA_MAX, ++}; ++#define MDBA_MAX (__MDBA_MAX - 1) ++ ++enum { ++ MDBA_MDB_UNSPEC, ++ MDBA_MDB_ENTRY, ++ __MDBA_MDB_MAX, ++}; ++#define MDBA_MDB_MAX (__MDBA_MDB_MAX - 1) ++ ++enum { ++ MDBA_MDB_ENTRY_UNSPEC, ++ MDBA_MDB_ENTRY_INFO, ++ __MDBA_MDB_ENTRY_MAX, ++}; ++#define MDBA_MDB_ENTRY_MAX (__MDBA_MDB_ENTRY_MAX - 1) ++ ++/* per mdb entry additional attributes */ ++enum { ++ MDBA_MDB_EATTR_UNSPEC, ++ MDBA_MDB_EATTR_TIMER, ++ __MDBA_MDB_EATTR_MAX ++}; ++#define MDBA_MDB_EATTR_MAX (__MDBA_MDB_EATTR_MAX - 1) ++ ++/* multicast router types */ ++enum { ++ MDB_RTR_TYPE_DISABLED, ++ MDB_RTR_TYPE_TEMP_QUERY, ++ MDB_RTR_TYPE_PERM, ++ MDB_RTR_TYPE_TEMP ++}; ++ ++enum { ++ MDBA_ROUTER_UNSPEC, ++ MDBA_ROUTER_PORT, ++ __MDBA_ROUTER_MAX, ++}; ++#define MDBA_ROUTER_MAX (__MDBA_ROUTER_MAX - 1) ++ ++/* router port attributes */ ++enum { ++ MDBA_ROUTER_PATTR_UNSPEC, ++ MDBA_ROUTER_PATTR_TIMER, ++ MDBA_ROUTER_PATTR_TYPE, ++ __MDBA_ROUTER_PATTR_MAX ++}; ++#define MDBA_ROUTER_PATTR_MAX (__MDBA_ROUTER_PATTR_MAX - 1) ++ ++struct br_port_msg { ++ __u8 family; ++ __u32 ifindex; ++}; ++ ++struct br_mdb_entry { ++ __u32 ifindex; ++#define MDB_TEMPORARY 0 ++#define MDB_PERMANENT 1 ++ __u8 state; ++#define MDB_FLAGS_OFFLOAD (1 << 0) ++ __u8 flags; ++ __u16 vid; ++ struct { ++ union { ++ __be32 ip4; ++ struct in6_addr ip6; ++ } u; ++ __be16 proto; ++ } addr; ++}; ++ ++enum { ++ MDBA_SET_ENTRY_UNSPEC, ++ MDBA_SET_ENTRY, ++ __MDBA_SET_ENTRY_MAX, ++}; ++#define MDBA_SET_ENTRY_MAX (__MDBA_SET_ENTRY_MAX - 1) ++ ++/* Embedded inside LINK_XSTATS_TYPE_BRIDGE */ ++enum { ++ BRIDGE_XSTATS_UNSPEC, ++ BRIDGE_XSTATS_VLAN, ++ BRIDGE_XSTATS_MCAST, ++ BRIDGE_XSTATS_PAD, ++ __BRIDGE_XSTATS_MAX ++}; ++#define BRIDGE_XSTATS_MAX (__BRIDGE_XSTATS_MAX - 1) ++ ++enum { ++ BR_MCAST_DIR_RX, ++ BR_MCAST_DIR_TX, ++ BR_MCAST_DIR_SIZE ++}; ++ ++/* IGMP/MLD statistics */ ++struct br_mcast_stats { ++ __u64 igmp_v1queries[BR_MCAST_DIR_SIZE]; ++ __u64 igmp_v2queries[BR_MCAST_DIR_SIZE]; ++ __u64 igmp_v3queries[BR_MCAST_DIR_SIZE]; ++ __u64 igmp_leaves[BR_MCAST_DIR_SIZE]; ++ __u64 igmp_v1reports[BR_MCAST_DIR_SIZE]; ++ __u64 igmp_v2reports[BR_MCAST_DIR_SIZE]; ++ __u64 igmp_v3reports[BR_MCAST_DIR_SIZE]; ++ __u64 igmp_parse_errors; ++ ++ __u64 mld_v1queries[BR_MCAST_DIR_SIZE]; ++ __u64 mld_v2queries[BR_MCAST_DIR_SIZE]; ++ __u64 mld_leaves[BR_MCAST_DIR_SIZE]; ++ __u64 mld_v1reports[BR_MCAST_DIR_SIZE]; ++ __u64 mld_v2reports[BR_MCAST_DIR_SIZE]; ++ __u64 mld_parse_errors; ++ ++ __u64 mcast_bytes[BR_MCAST_DIR_SIZE]; ++ __u64 mcast_packets[BR_MCAST_DIR_SIZE]; ++}; ++#endif /* _LINUX_IF_BRIDGE_H */ +diff --git a/include/uapi/linux/if_ether.h b/include/uapi/linux/if_ether.h +new file mode 100644 +index 0000000..7dde037 +--- /dev/null ++++ b/include/uapi/linux/if_ether.h +@@ -0,0 +1,158 @@ ++/* ++ * INET An implementation of the TCP/IP protocol suite for the LINUX ++ * operating system. INET is implemented using the BSD Socket ++ * interface as the means of communication with the user level. ++ * ++ * Global definitions for the Ethernet IEEE 802.3 interface. ++ * ++ * Version: @(#)if_ether.h 1.0.1a 02/08/94 ++ * ++ * Author: Fred N. van Kempen, ++ * Donald Becker, ++ * Alan Cox, ++ * Steve Whitehouse, ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version ++ * 2 of the License, or (at your option) any later version. ++ */ ++ ++#ifndef _LINUX_IF_ETHER_H ++#define _LINUX_IF_ETHER_H ++ ++#include ++ ++/* ++ * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble ++ * and FCS/CRC (frame check sequence). ++ */ ++ ++#define ETH_ALEN 6 /* Octets in one ethernet addr */ ++#define ETH_HLEN 14 /* Total octets in header. */ ++#define ETH_ZLEN 60 /* Min. octets in frame sans FCS */ ++#define ETH_DATA_LEN 1500 /* Max. octets in payload */ ++#define ETH_FRAME_LEN 1514 /* Max. octets in frame sans FCS */ ++#define ETH_FCS_LEN 4 /* Octets in the FCS */ ++ ++#define ETH_MIN_MTU 68 /* Min IPv4 MTU per RFC791 */ ++#define ETH_MAX_MTU 0xFFFFU /* 65535, same as IP_MAX_MTU */ ++ ++/* ++ * These are the defined Ethernet Protocol ID's. ++ */ ++ ++#define ETH_P_LOOP 0x0060 /* Ethernet Loopback packet */ ++#define ETH_P_PUP 0x0200 /* Xerox PUP packet */ ++#define ETH_P_PUPAT 0x0201 /* Xerox PUP Addr Trans packet */ ++#define ETH_P_TSN 0x22F0 /* TSN (IEEE 1722) packet */ ++#define ETH_P_IP 0x0800 /* Internet Protocol packet */ ++#define ETH_P_X25 0x0805 /* CCITT X.25 */ ++#define ETH_P_ARP 0x0806 /* Address Resolution packet */ ++#define ETH_P_BPQ 0x08FF /* G8BPQ AX.25 Ethernet Packet [ NOT AN OFFICIALLY REGISTERED ID ] */ ++#define ETH_P_IEEEPUP 0x0a00 /* Xerox IEEE802.3 PUP packet */ ++#define ETH_P_IEEEPUPAT 0x0a01 /* Xerox IEEE802.3 PUP Addr Trans packet */ ++#define ETH_P_BATMAN 0x4305 /* B.A.T.M.A.N.-Advanced packet [ NOT AN OFFICIALLY REGISTERED ID ] */ ++#define ETH_P_DEC 0x6000 /* DEC Assigned proto */ ++#define ETH_P_DNA_DL 0x6001 /* DEC DNA Dump/Load */ ++#define ETH_P_DNA_RC 0x6002 /* DEC DNA Remote Console */ ++#define ETH_P_DNA_RT 0x6003 /* DEC DNA Routing */ ++#define ETH_P_LAT 0x6004 /* DEC LAT */ ++#define ETH_P_DIAG 0x6005 /* DEC Diagnostics */ ++#define ETH_P_CUST 0x6006 /* DEC Customer use */ ++#define ETH_P_SCA 0x6007 /* DEC Systems Comms Arch */ ++#define ETH_P_TEB 0x6558 /* Trans Ether Bridging */ ++#define ETH_P_RARP 0x8035 /* Reverse Addr Res packet */ ++#define ETH_P_ATALK 0x809B /* Appletalk DDP */ ++#define ETH_P_AARP 0x80F3 /* Appletalk AARP */ ++#define ETH_P_8021Q 0x8100 /* 802.1Q VLAN Extended Header */ ++#define ETH_P_ERSPAN 0x88BE /* ERSPAN type II */ ++#define ETH_P_IPX 0x8137 /* IPX over DIX */ ++#define ETH_P_IPV6 0x86DD /* IPv6 over bluebook */ ++#define ETH_P_PAUSE 0x8808 /* IEEE Pause frames. See 802.3 31B */ ++#define ETH_P_SLOW 0x8809 /* Slow Protocol. See 802.3ad 43B */ ++#define ETH_P_WCCP 0x883E /* Web-cache coordination protocol ++ * defined in draft-wilson-wrec-wccp-v2-00.txt */ ++#define ETH_P_MPLS_UC 0x8847 /* MPLS Unicast traffic */ ++#define ETH_P_MPLS_MC 0x8848 /* MPLS Multicast traffic */ ++#define ETH_P_ATMMPOA 0x884c /* MultiProtocol Over ATM */ ++#define ETH_P_PPP_DISC 0x8863 /* PPPoE discovery messages */ ++#define ETH_P_PPP_SES 0x8864 /* PPPoE session messages */ ++#define ETH_P_LINK_CTL 0x886c /* HPNA, wlan link local tunnel */ ++#define ETH_P_ATMFATE 0x8884 /* Frame-based ATM Transport ++ * over Ethernet ++ */ ++#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ ++#define ETH_P_AOE 0x88A2 /* ATA over Ethernet */ ++#define ETH_P_8021AD 0x88A8 /* 802.1ad Service VLAN */ ++#define ETH_P_802_EX1 0x88B5 /* 802.1 Local Experimental 1. */ ++#define ETH_P_TIPC 0x88CA /* TIPC */ ++#define ETH_P_MACSEC 0x88E5 /* 802.1ae MACsec */ ++#define ETH_P_8021AH 0x88E7 /* 802.1ah Backbone Service Tag */ ++#define ETH_P_MVRP 0x88F5 /* 802.1Q MVRP */ ++#define ETH_P_1588 0x88F7 /* IEEE 1588 Timesync */ ++#define ETH_P_NCSI 0x88F8 /* NCSI protocol */ ++#define ETH_P_PRP 0x88FB /* IEC 62439-3 PRP/HSRv0 */ ++#define ETH_P_FCOE 0x8906 /* Fibre Channel over Ethernet */ ++#define ETH_P_IBOE 0x8915 /* Infiniband over Ethernet */ ++#define ETH_P_TDLS 0x890D /* TDLS */ ++#define ETH_P_FIP 0x8914 /* FCoE Initialization Protocol */ ++#define ETH_P_80221 0x8917 /* IEEE 802.21 Media Independent Handover Protocol */ ++#define ETH_P_HSR 0x892F /* IEC 62439-3 HSRv1 */ ++#define ETH_P_NSH 0x894F /* Network Service Header */ ++#define ETH_P_LOOPBACK 0x9000 /* Ethernet loopback packet, per IEEE 802.3 */ ++#define ETH_P_QINQ1 0x9100 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */ ++#define ETH_P_QINQ2 0x9200 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */ ++#define ETH_P_QINQ3 0x9300 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */ ++#define ETH_P_EDSA 0xDADA /* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */ ++#define ETH_P_IFE 0xED3E /* ForCES inter-FE LFB type */ ++#define ETH_P_AF_IUCV 0xFBFB /* IBM af_iucv [ NOT AN OFFICIALLY REGISTERED ID ] */ ++ ++#define ETH_P_802_3_MIN 0x0600 /* If the value in the ethernet type is less than this value ++ * then the frame is Ethernet II. Else it is 802.3 */ ++ ++/* ++ * Non DIX types. Won't clash for 1500 types. ++ */ ++ ++#define ETH_P_802_3 0x0001 /* Dummy type for 802.3 frames */ ++#define ETH_P_AX25 0x0002 /* Dummy protocol id for AX.25 */ ++#define ETH_P_ALL 0x0003 /* Every packet (be careful!!!) */ ++#define ETH_P_802_2 0x0004 /* 802.2 frames */ ++#define ETH_P_SNAP 0x0005 /* Internal only */ ++#define ETH_P_DDCMP 0x0006 /* DEC DDCMP: Internal only */ ++#define ETH_P_WAN_PPP 0x0007 /* Dummy type for WAN PPP frames*/ ++#define ETH_P_PPP_MP 0x0008 /* Dummy type for PPP MP frames */ ++#define ETH_P_LOCALTALK 0x0009 /* Localtalk pseudo type */ ++#define ETH_P_CAN 0x000C /* CAN: Controller Area Network */ ++#define ETH_P_CANFD 0x000D /* CANFD: CAN flexible data rate*/ ++#define ETH_P_PPPTALK 0x0010 /* Dummy type for Atalk over PPP*/ ++#define ETH_P_TR_802_2 0x0011 /* 802.2 frames */ ++#define ETH_P_MOBITEX 0x0015 /* Mobitex (kaz@cafe.net) */ ++#define ETH_P_CONTROL 0x0016 /* Card specific control frames */ ++#define ETH_P_IRDA 0x0017 /* Linux-IrDA */ ++#define ETH_P_ECONET 0x0018 /* Acorn Econet */ ++#define ETH_P_HDLC 0x0019 /* HDLC frames */ ++#define ETH_P_ARCNET 0x001A /* 1A for ArcNet :-) */ ++#define ETH_P_DSA 0x001B /* Distributed Switch Arch. */ ++#define ETH_P_TRAILER 0x001C /* Trailer switch tagging */ ++#define ETH_P_PHONET 0x00F5 /* Nokia Phonet frames */ ++#define ETH_P_IEEE802154 0x00F6 /* IEEE802.15.4 frame */ ++#define ETH_P_CAIF 0x00F7 /* ST-Ericsson CAIF protocol */ ++#define ETH_P_XDSA 0x00F8 /* Multiplexed DSA protocol */ ++#define ETH_P_MAP 0x00F9 /* Qualcomm multiplexing and ++ * aggregation protocol ++ */ ++ ++/* ++ * This is an Ethernet frame header. ++ */ ++ ++struct ethhdr { ++ unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ ++ unsigned char h_source[ETH_ALEN]; /* source ether addr */ ++ __be16 h_proto; /* packet type ID field */ ++} __attribute__((packed)); ++ ++ ++#endif /* _LINUX_IF_ETHER_H */ +diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h +new file mode 100644 +index 0000000..1f97d05 +--- /dev/null ++++ b/include/uapi/linux/if_link.h +@@ -0,0 +1,928 @@ ++#ifndef _LINUX_IF_LINK_H ++#define _LINUX_IF_LINK_H ++ ++#include ++#include ++ ++/* This struct should be in sync with struct rtnl_link_stats64 */ ++struct rtnl_link_stats { ++ __u32 rx_packets; /* total packets received */ ++ __u32 tx_packets; /* total packets transmitted */ ++ __u32 rx_bytes; /* total bytes received */ ++ __u32 tx_bytes; /* total bytes transmitted */ ++ __u32 rx_errors; /* bad packets received */ ++ __u32 tx_errors; /* packet transmit problems */ ++ __u32 rx_dropped; /* no space in linux buffers */ ++ __u32 tx_dropped; /* no space available in linux */ ++ __u32 multicast; /* multicast packets received */ ++ __u32 collisions; ++ ++ /* detailed rx_errors: */ ++ __u32 rx_length_errors; ++ __u32 rx_over_errors; /* receiver ring buff overflow */ ++ __u32 rx_crc_errors; /* recved pkt with crc error */ ++ __u32 rx_frame_errors; /* recv'd frame alignment error */ ++ __u32 rx_fifo_errors; /* recv'r fifo overrun */ ++ __u32 rx_missed_errors; /* receiver missed packet */ ++ ++ /* detailed tx_errors */ ++ __u32 tx_aborted_errors; ++ __u32 tx_carrier_errors; ++ __u32 tx_fifo_errors; ++ __u32 tx_heartbeat_errors; ++ __u32 tx_window_errors; ++ ++ /* for cslip etc */ ++ __u32 rx_compressed; ++ __u32 tx_compressed; ++ ++ __u32 rx_nohandler; /* dropped, no handler found */ ++}; ++ ++/* The main device statistics structure */ ++struct rtnl_link_stats64 { ++ __u64 rx_packets; /* total packets received */ ++ __u64 tx_packets; /* total packets transmitted */ ++ __u64 rx_bytes; /* total bytes received */ ++ __u64 tx_bytes; /* total bytes transmitted */ ++ __u64 rx_errors; /* bad packets received */ ++ __u64 tx_errors; /* packet transmit problems */ ++ __u64 rx_dropped; /* no space in linux buffers */ ++ __u64 tx_dropped; /* no space available in linux */ ++ __u64 multicast; /* multicast packets received */ ++ __u64 collisions; ++ ++ /* detailed rx_errors: */ ++ __u64 rx_length_errors; ++ __u64 rx_over_errors; /* receiver ring buff overflow */ ++ __u64 rx_crc_errors; /* recved pkt with crc error */ ++ __u64 rx_frame_errors; /* recv'd frame alignment error */ ++ __u64 rx_fifo_errors; /* recv'r fifo overrun */ ++ __u64 rx_missed_errors; /* receiver missed packet */ ++ ++ /* detailed tx_errors */ ++ __u64 tx_aborted_errors; ++ __u64 tx_carrier_errors; ++ __u64 tx_fifo_errors; ++ __u64 tx_heartbeat_errors; ++ __u64 tx_window_errors; ++ ++ /* for cslip etc */ ++ __u64 rx_compressed; ++ __u64 tx_compressed; ++ ++ __u64 rx_nohandler; /* dropped, no handler found */ ++}; ++ ++/* The struct should be in sync with struct ifmap */ ++struct rtnl_link_ifmap { ++ __u64 mem_start; ++ __u64 mem_end; ++ __u64 base_addr; ++ __u16 irq; ++ __u8 dma; ++ __u8 port; ++}; ++ ++/* ++ * IFLA_AF_SPEC ++ * Contains nested attributes for address family specific attributes. ++ * Each address family may create a attribute with the address family ++ * number as type and create its own attribute structure in it. ++ * ++ * Example: ++ * [IFLA_AF_SPEC] = { ++ * [AF_INET] = { ++ * [IFLA_INET_CONF] = ..., ++ * }, ++ * [AF_INET6] = { ++ * [IFLA_INET6_FLAGS] = ..., ++ * [IFLA_INET6_CONF] = ..., ++ * } ++ * } ++ */ ++ ++enum { ++ IFLA_UNSPEC, ++ IFLA_ADDRESS, ++ IFLA_BROADCAST, ++ IFLA_IFNAME, ++ IFLA_MTU, ++ IFLA_LINK, ++ IFLA_QDISC, ++ IFLA_STATS, ++ IFLA_COST, ++#define IFLA_COST IFLA_COST ++ IFLA_PRIORITY, ++#define IFLA_PRIORITY IFLA_PRIORITY ++ IFLA_MASTER, ++#define IFLA_MASTER IFLA_MASTER ++ IFLA_WIRELESS, /* Wireless Extension event - see wireless.h */ ++#define IFLA_WIRELESS IFLA_WIRELESS ++ IFLA_PROTINFO, /* Protocol specific information for a link */ ++#define IFLA_PROTINFO IFLA_PROTINFO ++ IFLA_TXQLEN, ++#define IFLA_TXQLEN IFLA_TXQLEN ++ IFLA_MAP, ++#define IFLA_MAP IFLA_MAP ++ IFLA_WEIGHT, ++#define IFLA_WEIGHT IFLA_WEIGHT ++ IFLA_OPERSTATE, ++ IFLA_LINKMODE, ++ IFLA_LINKINFO, ++#define IFLA_LINKINFO IFLA_LINKINFO ++ IFLA_NET_NS_PID, ++ IFLA_IFALIAS, ++ IFLA_NUM_VF, /* Number of VFs if device is SR-IOV PF */ ++ IFLA_VFINFO_LIST, ++ IFLA_STATS64, ++ IFLA_VF_PORTS, ++ IFLA_PORT_SELF, ++ IFLA_AF_SPEC, ++ IFLA_GROUP, /* Group the device belongs to */ ++ IFLA_NET_NS_FD, ++ IFLA_EXT_MASK, /* Extended info mask, VFs, etc */ ++ IFLA_PROMISCUITY, /* Promiscuity count: > 0 means acts PROMISC */ ++#define IFLA_PROMISCUITY IFLA_PROMISCUITY ++ IFLA_NUM_TX_QUEUES, ++ IFLA_NUM_RX_QUEUES, ++ IFLA_CARRIER, ++ IFLA_PHYS_PORT_ID, ++ IFLA_CARRIER_CHANGES, ++ IFLA_PHYS_SWITCH_ID, ++ IFLA_LINK_NETNSID, ++ IFLA_PHYS_PORT_NAME, ++ IFLA_PROTO_DOWN, ++ IFLA_GSO_MAX_SEGS, ++ IFLA_GSO_MAX_SIZE, ++ IFLA_PAD, ++ IFLA_XDP, ++ IFLA_EVENT, ++ __IFLA_MAX ++}; ++ ++ ++#define IFLA_MAX (__IFLA_MAX - 1) ++ ++/* backwards compatibility for userspace */ ++#define IFLA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifinfomsg)))) ++#define IFLA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ifinfomsg)) ++ ++enum { ++ IFLA_INET_UNSPEC, ++ IFLA_INET_CONF, ++ __IFLA_INET_MAX, ++}; ++ ++#define IFLA_INET_MAX (__IFLA_INET_MAX - 1) ++ ++/* ifi_flags. ++ ++ IFF_* flags. ++ ++ The only change is: ++ IFF_LOOPBACK, IFF_BROADCAST and IFF_POINTOPOINT are ++ more not changeable by user. They describe link media ++ characteristics and set by device driver. ++ ++ Comments: ++ - Combination IFF_BROADCAST|IFF_POINTOPOINT is invalid ++ - If neither of these three flags are set; ++ the interface is NBMA. ++ ++ - IFF_MULTICAST does not mean anything special: ++ multicasts can be used on all not-NBMA links. ++ IFF_MULTICAST means that this media uses special encapsulation ++ for multicast frames. Apparently, all IFF_POINTOPOINT and ++ IFF_BROADCAST devices are able to use multicasts too. ++ */ ++ ++/* IFLA_LINK. ++ For usual devices it is equal ifi_index. ++ If it is a "virtual interface" (f.e. tunnel), ifi_link ++ can point to real physical interface (f.e. for bandwidth calculations), ++ or maybe 0, what means, that real media is unknown (usual ++ for IPIP tunnels, when route to endpoint is allowed to change) ++ */ ++ ++/* Subtype attributes for IFLA_PROTINFO */ ++enum { ++ IFLA_INET6_UNSPEC, ++ IFLA_INET6_FLAGS, /* link flags */ ++ IFLA_INET6_CONF, /* sysctl parameters */ ++ IFLA_INET6_STATS, /* statistics */ ++ IFLA_INET6_MCAST, /* MC things. What of them? */ ++ IFLA_INET6_CACHEINFO, /* time values and max reasm size */ ++ IFLA_INET6_ICMP6STATS, /* statistics (icmpv6) */ ++ IFLA_INET6_TOKEN, /* device token */ ++ IFLA_INET6_ADDR_GEN_MODE, /* implicit address generator mode */ ++ __IFLA_INET6_MAX ++}; ++ ++#define IFLA_INET6_MAX (__IFLA_INET6_MAX - 1) ++ ++enum in6_addr_gen_mode { ++ IN6_ADDR_GEN_MODE_EUI64, ++ IN6_ADDR_GEN_MODE_NONE, ++ IN6_ADDR_GEN_MODE_STABLE_PRIVACY, ++ IN6_ADDR_GEN_MODE_RANDOM, ++}; ++ ++/* Bridge section */ ++ ++enum { ++ IFLA_BR_UNSPEC, ++ IFLA_BR_FORWARD_DELAY, ++ IFLA_BR_HELLO_TIME, ++ IFLA_BR_MAX_AGE, ++ IFLA_BR_AGEING_TIME, ++ IFLA_BR_STP_STATE, ++ IFLA_BR_PRIORITY, ++ IFLA_BR_VLAN_FILTERING, ++ IFLA_BR_VLAN_PROTOCOL, ++ IFLA_BR_GROUP_FWD_MASK, ++ IFLA_BR_ROOT_ID, ++ IFLA_BR_BRIDGE_ID, ++ IFLA_BR_ROOT_PORT, ++ IFLA_BR_ROOT_PATH_COST, ++ IFLA_BR_TOPOLOGY_CHANGE, ++ IFLA_BR_TOPOLOGY_CHANGE_DETECTED, ++ IFLA_BR_HELLO_TIMER, ++ IFLA_BR_TCN_TIMER, ++ IFLA_BR_TOPOLOGY_CHANGE_TIMER, ++ IFLA_BR_GC_TIMER, ++ IFLA_BR_GROUP_ADDR, ++ IFLA_BR_FDB_FLUSH, ++ IFLA_BR_MCAST_ROUTER, ++ IFLA_BR_MCAST_SNOOPING, ++ IFLA_BR_MCAST_QUERY_USE_IFADDR, ++ IFLA_BR_MCAST_QUERIER, ++ IFLA_BR_MCAST_HASH_ELASTICITY, ++ IFLA_BR_MCAST_HASH_MAX, ++ IFLA_BR_MCAST_LAST_MEMBER_CNT, ++ IFLA_BR_MCAST_STARTUP_QUERY_CNT, ++ IFLA_BR_MCAST_LAST_MEMBER_INTVL, ++ IFLA_BR_MCAST_MEMBERSHIP_INTVL, ++ IFLA_BR_MCAST_QUERIER_INTVL, ++ IFLA_BR_MCAST_QUERY_INTVL, ++ IFLA_BR_MCAST_QUERY_RESPONSE_INTVL, ++ IFLA_BR_MCAST_STARTUP_QUERY_INTVL, ++ IFLA_BR_NF_CALL_IPTABLES, ++ IFLA_BR_NF_CALL_IP6TABLES, ++ IFLA_BR_NF_CALL_ARPTABLES, ++ IFLA_BR_VLAN_DEFAULT_PVID, ++ IFLA_BR_PAD, ++ IFLA_BR_VLAN_STATS_ENABLED, ++ IFLA_BR_MCAST_STATS_ENABLED, ++ IFLA_BR_MCAST_IGMP_VERSION, ++ IFLA_BR_MCAST_MLD_VERSION, ++ __IFLA_BR_MAX, ++}; ++ ++#define IFLA_BR_MAX (__IFLA_BR_MAX - 1) ++ ++struct ifla_bridge_id { ++ __u8 prio[2]; ++ __u8 addr[6]; /* ETH_ALEN */ ++}; ++ ++enum { ++ BRIDGE_MODE_UNSPEC, ++ BRIDGE_MODE_HAIRPIN, ++}; ++ ++enum { ++ IFLA_BRPORT_UNSPEC, ++ IFLA_BRPORT_STATE, /* Spanning tree state */ ++ IFLA_BRPORT_PRIORITY, /* " priority */ ++ IFLA_BRPORT_COST, /* " cost */ ++ IFLA_BRPORT_MODE, /* mode (hairpin) */ ++ IFLA_BRPORT_GUARD, /* bpdu guard */ ++ IFLA_BRPORT_PROTECT, /* root port protection */ ++ IFLA_BRPORT_FAST_LEAVE, /* multicast fast leave */ ++ IFLA_BRPORT_LEARNING, /* mac learning */ ++ IFLA_BRPORT_UNICAST_FLOOD, /* flood unicast traffic */ ++ IFLA_BRPORT_PROXYARP, /* proxy ARP */ ++ IFLA_BRPORT_LEARNING_SYNC, /* mac learning sync from device */ ++ IFLA_BRPORT_PROXYARP_WIFI, /* proxy ARP for Wi-Fi */ ++ IFLA_BRPORT_ROOT_ID, /* designated root */ ++ IFLA_BRPORT_BRIDGE_ID, /* designated bridge */ ++ IFLA_BRPORT_DESIGNATED_PORT, ++ IFLA_BRPORT_DESIGNATED_COST, ++ IFLA_BRPORT_ID, ++ IFLA_BRPORT_NO, ++ IFLA_BRPORT_TOPOLOGY_CHANGE_ACK, ++ IFLA_BRPORT_CONFIG_PENDING, ++ IFLA_BRPORT_MESSAGE_AGE_TIMER, ++ IFLA_BRPORT_FORWARD_DELAY_TIMER, ++ IFLA_BRPORT_HOLD_TIMER, ++ IFLA_BRPORT_FLUSH, ++ IFLA_BRPORT_MULTICAST_ROUTER, ++ IFLA_BRPORT_PAD, ++ IFLA_BRPORT_MCAST_FLOOD, ++ IFLA_BRPORT_MCAST_TO_UCAST, ++ IFLA_BRPORT_VLAN_TUNNEL, ++ IFLA_BRPORT_BCAST_FLOOD, ++ __IFLA_BRPORT_MAX ++}; ++#define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1) ++ ++struct ifla_cacheinfo { ++ __u32 max_reasm_len; ++ __u32 tstamp; /* ipv6InterfaceTable updated timestamp */ ++ __u32 reachable_time; ++ __u32 retrans_time; ++}; ++ ++enum { ++ IFLA_INFO_UNSPEC, ++ IFLA_INFO_KIND, ++ IFLA_INFO_DATA, ++ IFLA_INFO_XSTATS, ++ IFLA_INFO_SLAVE_KIND, ++ IFLA_INFO_SLAVE_DATA, ++ __IFLA_INFO_MAX, ++}; ++ ++#define IFLA_INFO_MAX (__IFLA_INFO_MAX - 1) ++ ++/* VLAN section */ ++ ++enum { ++ IFLA_VLAN_UNSPEC, ++ IFLA_VLAN_ID, ++ IFLA_VLAN_FLAGS, ++ IFLA_VLAN_EGRESS_QOS, ++ IFLA_VLAN_INGRESS_QOS, ++ IFLA_VLAN_PROTOCOL, ++ __IFLA_VLAN_MAX, ++}; ++ ++#define IFLA_VLAN_MAX (__IFLA_VLAN_MAX - 1) ++ ++struct ifla_vlan_flags { ++ __u32 flags; ++ __u32 mask; ++}; ++ ++enum { ++ IFLA_VLAN_QOS_UNSPEC, ++ IFLA_VLAN_QOS_MAPPING, ++ __IFLA_VLAN_QOS_MAX ++}; ++ ++#define IFLA_VLAN_QOS_MAX (__IFLA_VLAN_QOS_MAX - 1) ++ ++struct ifla_vlan_qos_mapping { ++ __u32 from; ++ __u32 to; ++}; ++ ++/* MACVLAN section */ ++enum { ++ IFLA_MACVLAN_UNSPEC, ++ IFLA_MACVLAN_MODE, ++ IFLA_MACVLAN_FLAGS, ++ IFLA_MACVLAN_MACADDR_MODE, ++ IFLA_MACVLAN_MACADDR, ++ IFLA_MACVLAN_MACADDR_DATA, ++ IFLA_MACVLAN_MACADDR_COUNT, ++ __IFLA_MACVLAN_MAX, ++}; ++ ++#define IFLA_MACVLAN_MAX (__IFLA_MACVLAN_MAX - 1) ++ ++enum macvlan_mode { ++ MACVLAN_MODE_PRIVATE = 1, /* don't talk to other macvlans */ ++ MACVLAN_MODE_VEPA = 2, /* talk to other ports through ext bridge */ ++ MACVLAN_MODE_BRIDGE = 4, /* talk to bridge ports directly */ ++ MACVLAN_MODE_PASSTHRU = 8,/* take over the underlying device */ ++ MACVLAN_MODE_SOURCE = 16,/* use source MAC address list to assign */ ++}; ++ ++enum macvlan_macaddr_mode { ++ MACVLAN_MACADDR_ADD, ++ MACVLAN_MACADDR_DEL, ++ MACVLAN_MACADDR_FLUSH, ++ MACVLAN_MACADDR_SET, ++}; ++ ++#define MACVLAN_FLAG_NOPROMISC 1 ++ ++/* VRF section */ ++enum { ++ IFLA_VRF_UNSPEC, ++ IFLA_VRF_TABLE, ++ __IFLA_VRF_MAX ++}; ++ ++#define IFLA_VRF_MAX (__IFLA_VRF_MAX - 1) ++ ++enum { ++ IFLA_VRF_PORT_UNSPEC, ++ IFLA_VRF_PORT_TABLE, ++ __IFLA_VRF_PORT_MAX ++}; ++ ++#define IFLA_VRF_PORT_MAX (__IFLA_VRF_PORT_MAX - 1) ++ ++/* MACSEC section */ ++enum { ++ IFLA_MACSEC_UNSPEC, ++ IFLA_MACSEC_SCI, ++ IFLA_MACSEC_PORT, ++ IFLA_MACSEC_ICV_LEN, ++ IFLA_MACSEC_CIPHER_SUITE, ++ IFLA_MACSEC_WINDOW, ++ IFLA_MACSEC_ENCODING_SA, ++ IFLA_MACSEC_ENCRYPT, ++ IFLA_MACSEC_PROTECT, ++ IFLA_MACSEC_INC_SCI, ++ IFLA_MACSEC_ES, ++ IFLA_MACSEC_SCB, ++ IFLA_MACSEC_REPLAY_PROTECT, ++ IFLA_MACSEC_VALIDATION, ++ IFLA_MACSEC_PAD, ++ __IFLA_MACSEC_MAX, ++}; ++ ++#define IFLA_MACSEC_MAX (__IFLA_MACSEC_MAX - 1) ++ ++enum macsec_validation_type { ++ MACSEC_VALIDATE_DISABLED = 0, ++ MACSEC_VALIDATE_CHECK = 1, ++ MACSEC_VALIDATE_STRICT = 2, ++ __MACSEC_VALIDATE_END, ++ MACSEC_VALIDATE_MAX = __MACSEC_VALIDATE_END - 1, ++}; ++ ++/* IPVLAN section */ ++enum { ++ IFLA_IPVLAN_UNSPEC, ++ IFLA_IPVLAN_MODE, ++ __IFLA_IPVLAN_MAX ++}; ++ ++#define IFLA_IPVLAN_MAX (__IFLA_IPVLAN_MAX - 1) ++ ++enum ipvlan_mode { ++ IPVLAN_MODE_L2 = 0, ++ IPVLAN_MODE_L3, ++ IPVLAN_MODE_L3S, ++ IPVLAN_MODE_MAX ++}; ++ ++/* VXLAN section */ ++enum { ++ IFLA_VXLAN_UNSPEC, ++ IFLA_VXLAN_ID, ++ IFLA_VXLAN_GROUP, /* group or remote address */ ++ IFLA_VXLAN_LINK, ++ IFLA_VXLAN_LOCAL, ++ IFLA_VXLAN_TTL, ++ IFLA_VXLAN_TOS, ++ IFLA_VXLAN_LEARNING, ++ IFLA_VXLAN_AGEING, ++ IFLA_VXLAN_LIMIT, ++ IFLA_VXLAN_PORT_RANGE, /* source port */ ++ IFLA_VXLAN_PROXY, ++ IFLA_VXLAN_RSC, ++ IFLA_VXLAN_L2MISS, ++ IFLA_VXLAN_L3MISS, ++ IFLA_VXLAN_PORT, /* destination port */ ++ IFLA_VXLAN_GROUP6, ++ IFLA_VXLAN_LOCAL6, ++ IFLA_VXLAN_UDP_CSUM, ++ IFLA_VXLAN_UDP_ZERO_CSUM6_TX, ++ IFLA_VXLAN_UDP_ZERO_CSUM6_RX, ++ IFLA_VXLAN_REMCSUM_TX, ++ IFLA_VXLAN_REMCSUM_RX, ++ IFLA_VXLAN_GBP, ++ IFLA_VXLAN_REMCSUM_NOPARTIAL, ++ IFLA_VXLAN_COLLECT_METADATA, ++ IFLA_VXLAN_LABEL, ++ IFLA_VXLAN_GPE, ++ __IFLA_VXLAN_MAX ++}; ++#define IFLA_VXLAN_MAX (__IFLA_VXLAN_MAX - 1) ++ ++struct ifla_vxlan_port_range { ++ __be16 low; ++ __be16 high; ++}; ++ ++/* GENEVE section */ ++enum { ++ IFLA_GENEVE_UNSPEC, ++ IFLA_GENEVE_ID, ++ IFLA_GENEVE_REMOTE, ++ IFLA_GENEVE_TTL, ++ IFLA_GENEVE_TOS, ++ IFLA_GENEVE_PORT, /* destination port */ ++ IFLA_GENEVE_COLLECT_METADATA, ++ IFLA_GENEVE_REMOTE6, ++ IFLA_GENEVE_UDP_CSUM, ++ IFLA_GENEVE_UDP_ZERO_CSUM6_TX, ++ IFLA_GENEVE_UDP_ZERO_CSUM6_RX, ++ IFLA_GENEVE_LABEL, ++ __IFLA_GENEVE_MAX ++}; ++#define IFLA_GENEVE_MAX (__IFLA_GENEVE_MAX - 1) ++ ++/* PPP section */ ++enum { ++ IFLA_PPP_UNSPEC, ++ IFLA_PPP_DEV_FD, ++ __IFLA_PPP_MAX ++}; ++#define IFLA_PPP_MAX (__IFLA_PPP_MAX - 1) ++ ++/* GTP section */ ++ ++enum ifla_gtp_role { ++ GTP_ROLE_GGSN = 0, ++ GTP_ROLE_SGSN, ++}; ++ ++enum { ++ IFLA_GTP_UNSPEC, ++ IFLA_GTP_FD0, ++ IFLA_GTP_FD1, ++ IFLA_GTP_PDP_HASHSIZE, ++ IFLA_GTP_ROLE, ++ __IFLA_GTP_MAX, ++}; ++#define IFLA_GTP_MAX (__IFLA_GTP_MAX - 1) ++ ++/* Bonding section */ ++ ++enum { ++ IFLA_BOND_UNSPEC, ++ IFLA_BOND_MODE, ++ IFLA_BOND_ACTIVE_SLAVE, ++ IFLA_BOND_MIIMON, ++ IFLA_BOND_UPDELAY, ++ IFLA_BOND_DOWNDELAY, ++ IFLA_BOND_USE_CARRIER, ++ IFLA_BOND_ARP_INTERVAL, ++ IFLA_BOND_ARP_IP_TARGET, ++ IFLA_BOND_ARP_VALIDATE, ++ IFLA_BOND_ARP_ALL_TARGETS, ++ IFLA_BOND_PRIMARY, ++ IFLA_BOND_PRIMARY_RESELECT, ++ IFLA_BOND_FAIL_OVER_MAC, ++ IFLA_BOND_XMIT_HASH_POLICY, ++ IFLA_BOND_RESEND_IGMP, ++ IFLA_BOND_NUM_PEER_NOTIF, ++ IFLA_BOND_ALL_SLAVES_ACTIVE, ++ IFLA_BOND_MIN_LINKS, ++ IFLA_BOND_LP_INTERVAL, ++ IFLA_BOND_PACKETS_PER_SLAVE, ++ IFLA_BOND_AD_LACP_RATE, ++ IFLA_BOND_AD_SELECT, ++ IFLA_BOND_AD_INFO, ++ IFLA_BOND_AD_ACTOR_SYS_PRIO, ++ IFLA_BOND_AD_USER_PORT_KEY, ++ IFLA_BOND_AD_ACTOR_SYSTEM, ++ IFLA_BOND_TLB_DYNAMIC_LB, ++ __IFLA_BOND_MAX, ++}; ++ ++#define IFLA_BOND_MAX (__IFLA_BOND_MAX - 1) ++ ++enum { ++ IFLA_BOND_AD_INFO_UNSPEC, ++ IFLA_BOND_AD_INFO_AGGREGATOR, ++ IFLA_BOND_AD_INFO_NUM_PORTS, ++ IFLA_BOND_AD_INFO_ACTOR_KEY, ++ IFLA_BOND_AD_INFO_PARTNER_KEY, ++ IFLA_BOND_AD_INFO_PARTNER_MAC, ++ __IFLA_BOND_AD_INFO_MAX, ++}; ++ ++#define IFLA_BOND_AD_INFO_MAX (__IFLA_BOND_AD_INFO_MAX - 1) ++ ++enum { ++ IFLA_BOND_SLAVE_UNSPEC, ++ IFLA_BOND_SLAVE_STATE, ++ IFLA_BOND_SLAVE_MII_STATUS, ++ IFLA_BOND_SLAVE_LINK_FAILURE_COUNT, ++ IFLA_BOND_SLAVE_PERM_HWADDR, ++ IFLA_BOND_SLAVE_QUEUE_ID, ++ IFLA_BOND_SLAVE_AD_AGGREGATOR_ID, ++ IFLA_BOND_SLAVE_AD_ACTOR_OPER_PORT_STATE, ++ IFLA_BOND_SLAVE_AD_PARTNER_OPER_PORT_STATE, ++ __IFLA_BOND_SLAVE_MAX, ++}; ++ ++#define IFLA_BOND_SLAVE_MAX (__IFLA_BOND_SLAVE_MAX - 1) ++ ++/* SR-IOV virtual function management section */ ++ ++enum { ++ IFLA_VF_INFO_UNSPEC, ++ IFLA_VF_INFO, ++ __IFLA_VF_INFO_MAX, ++}; ++ ++#define IFLA_VF_INFO_MAX (__IFLA_VF_INFO_MAX - 1) ++ ++enum { ++ IFLA_VF_UNSPEC, ++ IFLA_VF_MAC, /* Hardware queue specific attributes */ ++ IFLA_VF_VLAN, /* VLAN ID and QoS */ ++ IFLA_VF_TX_RATE, /* Max TX Bandwidth Allocation */ ++ IFLA_VF_SPOOFCHK, /* Spoof Checking on/off switch */ ++ IFLA_VF_LINK_STATE, /* link state enable/disable/auto switch */ ++ IFLA_VF_RATE, /* Min and Max TX Bandwidth Allocation */ ++ IFLA_VF_RSS_QUERY_EN, /* RSS Redirection Table and Hash Key query ++ * on/off switch ++ */ ++ IFLA_VF_STATS, /* network device statistics */ ++ IFLA_VF_TRUST, /* Trust VF */ ++ IFLA_VF_IB_NODE_GUID, /* VF Infiniband node GUID */ ++ IFLA_VF_IB_PORT_GUID, /* VF Infiniband port GUID */ ++ IFLA_VF_VLAN_LIST, /* nested list of vlans, option for QinQ */ ++ __IFLA_VF_MAX, ++}; ++ ++#define IFLA_VF_MAX (__IFLA_VF_MAX - 1) ++ ++struct ifla_vf_mac { ++ __u32 vf; ++ __u8 mac[32]; /* MAX_ADDR_LEN */ ++}; ++ ++struct ifla_vf_vlan { ++ __u32 vf; ++ __u32 vlan; /* 0 - 4095, 0 disables VLAN filter */ ++ __u32 qos; ++}; ++ ++enum { ++ IFLA_VF_VLAN_INFO_UNSPEC, ++ IFLA_VF_VLAN_INFO, /* VLAN ID, QoS and VLAN protocol */ ++ __IFLA_VF_VLAN_INFO_MAX, ++}; ++ ++#define IFLA_VF_VLAN_INFO_MAX (__IFLA_VF_VLAN_INFO_MAX - 1) ++#define MAX_VLAN_LIST_LEN 1 ++ ++struct ifla_vf_vlan_info { ++ __u32 vf; ++ __u32 vlan; /* 0 - 4095, 0 disables VLAN filter */ ++ __u32 qos; ++ __be16 vlan_proto; /* VLAN protocol either 802.1Q or 802.1ad */ ++}; ++ ++struct ifla_vf_tx_rate { ++ __u32 vf; ++ __u32 rate; /* Max TX bandwidth in Mbps, 0 disables throttling */ ++}; ++ ++struct ifla_vf_rate { ++ __u32 vf; ++ __u32 min_tx_rate; /* Min Bandwidth in Mbps */ ++ __u32 max_tx_rate; /* Max Bandwidth in Mbps */ ++}; ++ ++struct ifla_vf_spoofchk { ++ __u32 vf; ++ __u32 setting; ++}; ++ ++struct ifla_vf_guid { ++ __u32 vf; ++ __u64 guid; ++}; ++ ++enum { ++ IFLA_VF_LINK_STATE_AUTO, /* link state of the uplink */ ++ IFLA_VF_LINK_STATE_ENABLE, /* link always up */ ++ IFLA_VF_LINK_STATE_DISABLE, /* link always down */ ++ __IFLA_VF_LINK_STATE_MAX, ++}; ++ ++struct ifla_vf_link_state { ++ __u32 vf; ++ __u32 link_state; ++}; ++ ++struct ifla_vf_rss_query_en { ++ __u32 vf; ++ __u32 setting; ++}; ++ ++enum { ++ IFLA_VF_STATS_RX_PACKETS, ++ IFLA_VF_STATS_TX_PACKETS, ++ IFLA_VF_STATS_RX_BYTES, ++ IFLA_VF_STATS_TX_BYTES, ++ IFLA_VF_STATS_BROADCAST, ++ IFLA_VF_STATS_MULTICAST, ++ IFLA_VF_STATS_PAD, ++ __IFLA_VF_STATS_MAX, ++}; ++ ++#define IFLA_VF_STATS_MAX (__IFLA_VF_STATS_MAX - 1) ++ ++struct ifla_vf_trust { ++ __u32 vf; ++ __u32 setting; ++}; ++ ++/* VF ports management section ++ * ++ * Nested layout of set/get msg is: ++ * ++ * [IFLA_NUM_VF] ++ * [IFLA_VF_PORTS] ++ * [IFLA_VF_PORT] ++ * [IFLA_PORT_*], ... ++ * [IFLA_VF_PORT] ++ * [IFLA_PORT_*], ... ++ * ... ++ * [IFLA_PORT_SELF] ++ * [IFLA_PORT_*], ... ++ */ ++ ++enum { ++ IFLA_VF_PORT_UNSPEC, ++ IFLA_VF_PORT, /* nest */ ++ __IFLA_VF_PORT_MAX, ++}; ++ ++#define IFLA_VF_PORT_MAX (__IFLA_VF_PORT_MAX - 1) ++ ++enum { ++ IFLA_PORT_UNSPEC, ++ IFLA_PORT_VF, /* __u32 */ ++ IFLA_PORT_PROFILE, /* string */ ++ IFLA_PORT_VSI_TYPE, /* 802.1Qbg (pre-)standard VDP */ ++ IFLA_PORT_INSTANCE_UUID, /* binary UUID */ ++ IFLA_PORT_HOST_UUID, /* binary UUID */ ++ IFLA_PORT_REQUEST, /* __u8 */ ++ IFLA_PORT_RESPONSE, /* __u16, output only */ ++ __IFLA_PORT_MAX, ++}; ++ ++#define IFLA_PORT_MAX (__IFLA_PORT_MAX - 1) ++ ++#define PORT_PROFILE_MAX 40 ++#define PORT_UUID_MAX 16 ++#define PORT_SELF_VF -1 ++ ++enum { ++ PORT_REQUEST_PREASSOCIATE = 0, ++ PORT_REQUEST_PREASSOCIATE_RR, ++ PORT_REQUEST_ASSOCIATE, ++ PORT_REQUEST_DISASSOCIATE, ++}; ++ ++enum { ++ PORT_VDP_RESPONSE_SUCCESS = 0, ++ PORT_VDP_RESPONSE_INVALID_FORMAT, ++ PORT_VDP_RESPONSE_INSUFFICIENT_RESOURCES, ++ PORT_VDP_RESPONSE_UNUSED_VTID, ++ PORT_VDP_RESPONSE_VTID_VIOLATION, ++ PORT_VDP_RESPONSE_VTID_VERSION_VIOALTION, ++ PORT_VDP_RESPONSE_OUT_OF_SYNC, ++ /* 0x08-0xFF reserved for future VDP use */ ++ PORT_PROFILE_RESPONSE_SUCCESS = 0x100, ++ PORT_PROFILE_RESPONSE_INPROGRESS, ++ PORT_PROFILE_RESPONSE_INVALID, ++ PORT_PROFILE_RESPONSE_BADSTATE, ++ PORT_PROFILE_RESPONSE_INSUFFICIENT_RESOURCES, ++ PORT_PROFILE_RESPONSE_ERROR, ++}; ++ ++struct ifla_port_vsi { ++ __u8 vsi_mgr_id; ++ __u8 vsi_type_id[3]; ++ __u8 vsi_type_version; ++ __u8 pad[3]; ++}; ++ ++ ++/* IPoIB section */ ++ ++enum { ++ IFLA_IPOIB_UNSPEC, ++ IFLA_IPOIB_PKEY, ++ IFLA_IPOIB_MODE, ++ IFLA_IPOIB_UMCAST, ++ __IFLA_IPOIB_MAX ++}; ++ ++enum { ++ IPOIB_MODE_DATAGRAM = 0, /* using unreliable datagram QPs */ ++ IPOIB_MODE_CONNECTED = 1, /* using connected QPs */ ++}; ++ ++#define IFLA_IPOIB_MAX (__IFLA_IPOIB_MAX - 1) ++ ++ ++/* HSR section */ ++ ++enum { ++ IFLA_HSR_UNSPEC, ++ IFLA_HSR_SLAVE1, ++ IFLA_HSR_SLAVE2, ++ IFLA_HSR_MULTICAST_SPEC, /* Last byte of supervision addr */ ++ IFLA_HSR_SUPERVISION_ADDR, /* Supervision frame multicast addr */ ++ IFLA_HSR_SEQ_NR, ++ IFLA_HSR_VERSION, /* HSR version */ ++ __IFLA_HSR_MAX, ++}; ++ ++#define IFLA_HSR_MAX (__IFLA_HSR_MAX - 1) ++ ++/* STATS section */ ++ ++struct if_stats_msg { ++ __u8 family; ++ __u8 pad1; ++ __u16 pad2; ++ __u32 ifindex; ++ __u32 filter_mask; ++}; ++ ++/* A stats attribute can be netdev specific or a global stat. ++ * For netdev stats, lets use the prefix IFLA_STATS_LINK_* ++ */ ++enum { ++ IFLA_STATS_UNSPEC, /* also used as 64bit pad attribute */ ++ IFLA_STATS_LINK_64, ++ IFLA_STATS_LINK_XSTATS, ++ IFLA_STATS_LINK_XSTATS_SLAVE, ++ IFLA_STATS_LINK_OFFLOAD_XSTATS, ++ IFLA_STATS_AF_SPEC, ++ __IFLA_STATS_MAX, ++}; ++ ++#define IFLA_STATS_MAX (__IFLA_STATS_MAX - 1) ++ ++#define IFLA_STATS_FILTER_BIT(ATTR) (1 << (ATTR - 1)) ++ ++/* These are embedded into IFLA_STATS_LINK_XSTATS: ++ * [IFLA_STATS_LINK_XSTATS] ++ * -> [LINK_XSTATS_TYPE_xxx] ++ * -> [rtnl link type specific attributes] ++ */ ++enum { ++ LINK_XSTATS_TYPE_UNSPEC, ++ LINK_XSTATS_TYPE_BRIDGE, ++ __LINK_XSTATS_TYPE_MAX ++}; ++#define LINK_XSTATS_TYPE_MAX (__LINK_XSTATS_TYPE_MAX - 1) ++ ++/* These are stats embedded into IFLA_STATS_LINK_OFFLOAD_XSTATS */ ++enum { ++ IFLA_OFFLOAD_XSTATS_UNSPEC, ++ IFLA_OFFLOAD_XSTATS_CPU_HIT, /* struct rtnl_link_stats64 */ ++ __IFLA_OFFLOAD_XSTATS_MAX ++}; ++#define IFLA_OFFLOAD_XSTATS_MAX (__IFLA_OFFLOAD_XSTATS_MAX - 1) ++ ++/* XDP section */ ++ ++#define XDP_FLAGS_UPDATE_IF_NOEXIST (1U << 0) ++#define XDP_FLAGS_SKB_MODE (1U << 1) ++#define XDP_FLAGS_DRV_MODE (1U << 2) ++#define XDP_FLAGS_HW_MODE (1U << 3) ++#define XDP_FLAGS_MODES (XDP_FLAGS_SKB_MODE | \ ++ XDP_FLAGS_DRV_MODE | \ ++ XDP_FLAGS_HW_MODE) ++#define XDP_FLAGS_MASK (XDP_FLAGS_UPDATE_IF_NOEXIST | \ ++ XDP_FLAGS_MODES) ++ ++/* These are stored into IFLA_XDP_ATTACHED on dump. */ ++enum { ++ XDP_ATTACHED_NONE = 0, ++ XDP_ATTACHED_DRV, ++ XDP_ATTACHED_SKB, ++ XDP_ATTACHED_HW, ++}; ++ ++enum { ++ IFLA_XDP_UNSPEC, ++ IFLA_XDP_FD, ++ IFLA_XDP_ATTACHED, ++ IFLA_XDP_FLAGS, ++ IFLA_XDP_PROG_ID, ++ __IFLA_XDP_MAX, ++}; ++ ++#define IFLA_XDP_MAX (__IFLA_XDP_MAX - 1) ++ ++enum { ++ IFLA_EVENT_NONE, ++ IFLA_EVENT_REBOOT, /* internal reset / reboot */ ++ IFLA_EVENT_FEATURES, /* change in offload features */ ++ IFLA_EVENT_BONDING_FAILOVER, /* change in active slave */ ++ IFLA_EVENT_NOTIFY_PEERS, /* re-sent grat. arp/ndisc */ ++ IFLA_EVENT_IGMP_RESEND, /* re-sent IGMP JOIN */ ++ IFLA_EVENT_BONDING_OPTIONS, /* change in bonding options */ ++}; ++ ++#endif /* _LINUX_IF_LINK_H */ +diff --git a/include/uapi/linux/if_macsec.h b/include/uapi/linux/if_macsec.h +new file mode 100644 +index 0000000..22939a3 +--- /dev/null ++++ b/include/uapi/linux/if_macsec.h +@@ -0,0 +1,171 @@ ++/* ++ * include/uapi/linux/if_macsec.h - MACsec device ++ * ++ * Copyright (c) 2015 Sabrina Dubroca ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ */ ++ ++#ifndef _MACSEC_H ++#define _MACSEC_H ++ ++#include ++ ++#define MACSEC_GENL_NAME "macsec" ++#define MACSEC_GENL_VERSION 1 ++ ++#define MACSEC_MAX_KEY_LEN 128 ++ ++#define MACSEC_KEYID_LEN 16 ++ ++#define MACSEC_DEFAULT_CIPHER_ID 0x0080020001000001ULL ++#define MACSEC_DEFAULT_CIPHER_ALT 0x0080C20001000001ULL ++ ++#define MACSEC_MIN_ICV_LEN 8 ++#define MACSEC_MAX_ICV_LEN 32 ++/* upper limit for ICV length as recommended by IEEE802.1AE-2006 */ ++#define MACSEC_STD_ICV_LEN 16 ++ ++enum macsec_attrs { ++ MACSEC_ATTR_UNSPEC, ++ MACSEC_ATTR_IFINDEX, /* u32, ifindex of the MACsec netdevice */ ++ MACSEC_ATTR_RXSC_CONFIG, /* config, nested macsec_rxsc_attrs */ ++ MACSEC_ATTR_SA_CONFIG, /* config, nested macsec_sa_attrs */ ++ MACSEC_ATTR_SECY, /* dump, nested macsec_secy_attrs */ ++ MACSEC_ATTR_TXSA_LIST, /* dump, nested, macsec_sa_attrs for each TXSA */ ++ MACSEC_ATTR_RXSC_LIST, /* dump, nested, macsec_rxsc_attrs for each RXSC */ ++ MACSEC_ATTR_TXSC_STATS, /* dump, nested, macsec_txsc_stats_attr */ ++ MACSEC_ATTR_SECY_STATS, /* dump, nested, macsec_secy_stats_attr */ ++ __MACSEC_ATTR_END, ++ NUM_MACSEC_ATTR = __MACSEC_ATTR_END, ++ MACSEC_ATTR_MAX = __MACSEC_ATTR_END - 1, ++}; ++ ++enum macsec_secy_attrs { ++ MACSEC_SECY_ATTR_UNSPEC, ++ MACSEC_SECY_ATTR_SCI, ++ MACSEC_SECY_ATTR_ENCODING_SA, ++ MACSEC_SECY_ATTR_WINDOW, ++ MACSEC_SECY_ATTR_CIPHER_SUITE, ++ MACSEC_SECY_ATTR_ICV_LEN, ++ MACSEC_SECY_ATTR_PROTECT, ++ MACSEC_SECY_ATTR_REPLAY, ++ MACSEC_SECY_ATTR_OPER, ++ MACSEC_SECY_ATTR_VALIDATE, ++ MACSEC_SECY_ATTR_ENCRYPT, ++ MACSEC_SECY_ATTR_INC_SCI, ++ MACSEC_SECY_ATTR_ES, ++ MACSEC_SECY_ATTR_SCB, ++ MACSEC_SECY_ATTR_PAD, ++ __MACSEC_SECY_ATTR_END, ++ NUM_MACSEC_SECY_ATTR = __MACSEC_SECY_ATTR_END, ++ MACSEC_SECY_ATTR_MAX = __MACSEC_SECY_ATTR_END - 1, ++}; ++ ++enum macsec_rxsc_attrs { ++ MACSEC_RXSC_ATTR_UNSPEC, ++ MACSEC_RXSC_ATTR_SCI, /* config/dump, u64 */ ++ MACSEC_RXSC_ATTR_ACTIVE, /* config/dump, u8 0..1 */ ++ MACSEC_RXSC_ATTR_SA_LIST, /* dump, nested */ ++ MACSEC_RXSC_ATTR_STATS, /* dump, nested, macsec_rxsc_stats_attr */ ++ MACSEC_RXSC_ATTR_PAD, ++ __MACSEC_RXSC_ATTR_END, ++ NUM_MACSEC_RXSC_ATTR = __MACSEC_RXSC_ATTR_END, ++ MACSEC_RXSC_ATTR_MAX = __MACSEC_RXSC_ATTR_END - 1, ++}; ++ ++enum macsec_sa_attrs { ++ MACSEC_SA_ATTR_UNSPEC, ++ MACSEC_SA_ATTR_AN, /* config/dump, u8 0..3 */ ++ MACSEC_SA_ATTR_ACTIVE, /* config/dump, u8 0..1 */ ++ MACSEC_SA_ATTR_PN, /* config/dump, u32 */ ++ MACSEC_SA_ATTR_KEY, /* config, data */ ++ MACSEC_SA_ATTR_KEYID, /* config/dump, 128-bit */ ++ MACSEC_SA_ATTR_STATS, /* dump, nested, macsec_sa_stats_attr */ ++ MACSEC_SA_ATTR_PAD, ++ __MACSEC_SA_ATTR_END, ++ NUM_MACSEC_SA_ATTR = __MACSEC_SA_ATTR_END, ++ MACSEC_SA_ATTR_MAX = __MACSEC_SA_ATTR_END - 1, ++}; ++ ++enum macsec_nl_commands { ++ MACSEC_CMD_GET_TXSC, ++ MACSEC_CMD_ADD_RXSC, ++ MACSEC_CMD_DEL_RXSC, ++ MACSEC_CMD_UPD_RXSC, ++ MACSEC_CMD_ADD_TXSA, ++ MACSEC_CMD_DEL_TXSA, ++ MACSEC_CMD_UPD_TXSA, ++ MACSEC_CMD_ADD_RXSA, ++ MACSEC_CMD_DEL_RXSA, ++ MACSEC_CMD_UPD_RXSA, ++}; ++ ++/* u64 per-RXSC stats */ ++enum macsec_rxsc_stats_attr { ++ MACSEC_RXSC_STATS_ATTR_UNSPEC, ++ MACSEC_RXSC_STATS_ATTR_IN_OCTETS_VALIDATED, ++ MACSEC_RXSC_STATS_ATTR_IN_OCTETS_DECRYPTED, ++ MACSEC_RXSC_STATS_ATTR_IN_PKTS_UNCHECKED, ++ MACSEC_RXSC_STATS_ATTR_IN_PKTS_DELAYED, ++ MACSEC_RXSC_STATS_ATTR_IN_PKTS_OK, ++ MACSEC_RXSC_STATS_ATTR_IN_PKTS_INVALID, ++ MACSEC_RXSC_STATS_ATTR_IN_PKTS_LATE, ++ MACSEC_RXSC_STATS_ATTR_IN_PKTS_NOT_VALID, ++ MACSEC_RXSC_STATS_ATTR_IN_PKTS_NOT_USING_SA, ++ MACSEC_RXSC_STATS_ATTR_IN_PKTS_UNUSED_SA, ++ MACSEC_RXSC_STATS_ATTR_PAD, ++ __MACSEC_RXSC_STATS_ATTR_END, ++ NUM_MACSEC_RXSC_STATS_ATTR = __MACSEC_RXSC_STATS_ATTR_END, ++ MACSEC_RXSC_STATS_ATTR_MAX = __MACSEC_RXSC_STATS_ATTR_END - 1, ++}; ++ ++/* u32 per-{RX,TX}SA stats */ ++enum macsec_sa_stats_attr { ++ MACSEC_SA_STATS_ATTR_UNSPEC, ++ MACSEC_SA_STATS_ATTR_IN_PKTS_OK, ++ MACSEC_SA_STATS_ATTR_IN_PKTS_INVALID, ++ MACSEC_SA_STATS_ATTR_IN_PKTS_NOT_VALID, ++ MACSEC_SA_STATS_ATTR_IN_PKTS_NOT_USING_SA, ++ MACSEC_SA_STATS_ATTR_IN_PKTS_UNUSED_SA, ++ MACSEC_SA_STATS_ATTR_OUT_PKTS_PROTECTED, ++ MACSEC_SA_STATS_ATTR_OUT_PKTS_ENCRYPTED, ++ __MACSEC_SA_STATS_ATTR_END, ++ NUM_MACSEC_SA_STATS_ATTR = __MACSEC_SA_STATS_ATTR_END, ++ MACSEC_SA_STATS_ATTR_MAX = __MACSEC_SA_STATS_ATTR_END - 1, ++}; ++ ++/* u64 per-TXSC stats */ ++enum macsec_txsc_stats_attr { ++ MACSEC_TXSC_STATS_ATTR_UNSPEC, ++ MACSEC_TXSC_STATS_ATTR_OUT_PKTS_PROTECTED, ++ MACSEC_TXSC_STATS_ATTR_OUT_PKTS_ENCRYPTED, ++ MACSEC_TXSC_STATS_ATTR_OUT_OCTETS_PROTECTED, ++ MACSEC_TXSC_STATS_ATTR_OUT_OCTETS_ENCRYPTED, ++ MACSEC_TXSC_STATS_ATTR_PAD, ++ __MACSEC_TXSC_STATS_ATTR_END, ++ NUM_MACSEC_TXSC_STATS_ATTR = __MACSEC_TXSC_STATS_ATTR_END, ++ MACSEC_TXSC_STATS_ATTR_MAX = __MACSEC_TXSC_STATS_ATTR_END - 1, ++}; ++ ++/* u64 per-SecY stats */ ++enum macsec_secy_stats_attr { ++ MACSEC_SECY_STATS_ATTR_UNSPEC, ++ MACSEC_SECY_STATS_ATTR_OUT_PKTS_UNTAGGED, ++ MACSEC_SECY_STATS_ATTR_IN_PKTS_UNTAGGED, ++ MACSEC_SECY_STATS_ATTR_OUT_PKTS_TOO_LONG, ++ MACSEC_SECY_STATS_ATTR_IN_PKTS_NO_TAG, ++ MACSEC_SECY_STATS_ATTR_IN_PKTS_BAD_TAG, ++ MACSEC_SECY_STATS_ATTR_IN_PKTS_UNKNOWN_SCI, ++ MACSEC_SECY_STATS_ATTR_IN_PKTS_NO_SCI, ++ MACSEC_SECY_STATS_ATTR_IN_PKTS_OVERRUN, ++ MACSEC_SECY_STATS_ATTR_PAD, ++ __MACSEC_SECY_STATS_ATTR_END, ++ NUM_MACSEC_SECY_STATS_ATTR = __MACSEC_SECY_STATS_ATTR_END, ++ MACSEC_SECY_STATS_ATTR_MAX = __MACSEC_SECY_STATS_ATTR_END - 1, ++}; ++ ++#endif /* _MACSEC_H */ +diff --git a/include/uapi/linux/if_packet.h b/include/uapi/linux/if_packet.h +new file mode 100644 +index 0000000..4df96a7 +--- /dev/null ++++ b/include/uapi/linux/if_packet.h +@@ -0,0 +1,302 @@ ++#ifndef __LINUX_IF_PACKET_H ++#define __LINUX_IF_PACKET_H ++ ++#include ++ ++struct sockaddr_pkt { ++ unsigned short spkt_family; ++ unsigned char spkt_device[14]; ++ __be16 spkt_protocol; ++}; ++ ++struct sockaddr_ll { ++ unsigned short sll_family; ++ __be16 sll_protocol; ++ int sll_ifindex; ++ unsigned short sll_hatype; ++ unsigned char sll_pkttype; ++ unsigned char sll_halen; ++ unsigned char sll_addr[8]; ++}; ++ ++/* Packet types */ ++ ++#define PACKET_HOST 0 /* To us */ ++#define PACKET_BROADCAST 1 /* To all */ ++#define PACKET_MULTICAST 2 /* To group */ ++#define PACKET_OTHERHOST 3 /* To someone else */ ++#define PACKET_OUTGOING 4 /* Outgoing of any type */ ++#define PACKET_LOOPBACK 5 /* MC/BRD frame looped back */ ++#define PACKET_USER 6 /* To user space */ ++#define PACKET_KERNEL 7 /* To kernel space */ ++/* Unused, PACKET_FASTROUTE and PACKET_LOOPBACK are invisible to user space */ ++#define PACKET_FASTROUTE 6 /* Fastrouted frame */ ++ ++/* Packet socket options */ ++ ++#define PACKET_ADD_MEMBERSHIP 1 ++#define PACKET_DROP_MEMBERSHIP 2 ++#define PACKET_RECV_OUTPUT 3 ++/* Value 4 is still used by obsolete turbo-packet. */ ++#define PACKET_RX_RING 5 ++#define PACKET_STATISTICS 6 ++#define PACKET_COPY_THRESH 7 ++#define PACKET_AUXDATA 8 ++#define PACKET_ORIGDEV 9 ++#define PACKET_VERSION 10 ++#define PACKET_HDRLEN 11 ++#define PACKET_RESERVE 12 ++#define PACKET_TX_RING 13 ++#define PACKET_LOSS 14 ++#define PACKET_VNET_HDR 15 ++#define PACKET_TX_TIMESTAMP 16 ++#define PACKET_TIMESTAMP 17 ++#define PACKET_FANOUT 18 ++#define PACKET_TX_HAS_OFF 19 ++#define PACKET_QDISC_BYPASS 20 ++#define PACKET_ROLLOVER_STATS 21 ++#define PACKET_FANOUT_DATA 22 ++ ++#define PACKET_FANOUT_HASH 0 ++#define PACKET_FANOUT_LB 1 ++#define PACKET_FANOUT_CPU 2 ++#define PACKET_FANOUT_ROLLOVER 3 ++#define PACKET_FANOUT_RND 4 ++#define PACKET_FANOUT_QM 5 ++#define PACKET_FANOUT_CBPF 6 ++#define PACKET_FANOUT_EBPF 7 ++#define PACKET_FANOUT_FLAG_ROLLOVER 0x1000 ++#define PACKET_FANOUT_FLAG_UNIQUEID 0x2000 ++#define PACKET_FANOUT_FLAG_DEFRAG 0x8000 ++ ++struct tpacket_stats { ++ unsigned int tp_packets; ++ unsigned int tp_drops; ++}; ++ ++struct tpacket_stats_v3 { ++ unsigned int tp_packets; ++ unsigned int tp_drops; ++ unsigned int tp_freeze_q_cnt; ++}; ++ ++struct tpacket_rollover_stats { ++ __aligned_u64 tp_all; ++ __aligned_u64 tp_huge; ++ __aligned_u64 tp_failed; ++}; ++ ++union tpacket_stats_u { ++ struct tpacket_stats stats1; ++ struct tpacket_stats_v3 stats3; ++}; ++ ++struct tpacket_auxdata { ++ __u32 tp_status; ++ __u32 tp_len; ++ __u32 tp_snaplen; ++ __u16 tp_mac; ++ __u16 tp_net; ++ __u16 tp_vlan_tci; ++ __u16 tp_vlan_tpid; ++}; ++ ++/* Rx ring - header status */ ++#define TP_STATUS_KERNEL 0 ++#define TP_STATUS_USER (1 << 0) ++#define TP_STATUS_COPY (1 << 1) ++#define TP_STATUS_LOSING (1 << 2) ++#define TP_STATUS_CSUMNOTREADY (1 << 3) ++#define TP_STATUS_VLAN_VALID (1 << 4) /* auxdata has valid tp_vlan_tci */ ++#define TP_STATUS_BLK_TMO (1 << 5) ++#define TP_STATUS_VLAN_TPID_VALID (1 << 6) /* auxdata has valid tp_vlan_tpid */ ++#define TP_STATUS_CSUM_VALID (1 << 7) ++ ++/* Tx ring - header status */ ++#define TP_STATUS_AVAILABLE 0 ++#define TP_STATUS_SEND_REQUEST (1 << 0) ++#define TP_STATUS_SENDING (1 << 1) ++#define TP_STATUS_WRONG_FORMAT (1 << 2) ++ ++/* Rx and Tx ring - header status */ ++#define TP_STATUS_TS_SOFTWARE (1 << 29) ++#define TP_STATUS_TS_SYS_HARDWARE (1 << 30) /* deprecated, never set */ ++#define TP_STATUS_TS_RAW_HARDWARE (1 << 31) ++ ++/* Rx ring - feature request bits */ ++#define TP_FT_REQ_FILL_RXHASH 0x1 ++ ++struct tpacket_hdr { ++ unsigned long tp_status; ++ unsigned int tp_len; ++ unsigned int tp_snaplen; ++ unsigned short tp_mac; ++ unsigned short tp_net; ++ unsigned int tp_sec; ++ unsigned int tp_usec; ++}; ++ ++#define TPACKET_ALIGNMENT 16 ++#define TPACKET_ALIGN(x) (((x)+TPACKET_ALIGNMENT-1)&~(TPACKET_ALIGNMENT-1)) ++#define TPACKET_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket_hdr)) + sizeof(struct sockaddr_ll)) ++ ++struct tpacket2_hdr { ++ __u32 tp_status; ++ __u32 tp_len; ++ __u32 tp_snaplen; ++ __u16 tp_mac; ++ __u16 tp_net; ++ __u32 tp_sec; ++ __u32 tp_nsec; ++ __u16 tp_vlan_tci; ++ __u16 tp_vlan_tpid; ++ __u8 tp_padding[4]; ++}; ++ ++struct tpacket_hdr_variant1 { ++ __u32 tp_rxhash; ++ __u32 tp_vlan_tci; ++ __u16 tp_vlan_tpid; ++ __u16 tp_padding; ++}; ++ ++struct tpacket3_hdr { ++ __u32 tp_next_offset; ++ __u32 tp_sec; ++ __u32 tp_nsec; ++ __u32 tp_snaplen; ++ __u32 tp_len; ++ __u32 tp_status; ++ __u16 tp_mac; ++ __u16 tp_net; ++ /* pkt_hdr variants */ ++ union { ++ struct tpacket_hdr_variant1 hv1; ++ }; ++ __u8 tp_padding[8]; ++}; ++ ++struct tpacket_bd_ts { ++ unsigned int ts_sec; ++ union { ++ unsigned int ts_usec; ++ unsigned int ts_nsec; ++ }; ++}; ++ ++struct tpacket_hdr_v1 { ++ __u32 block_status; ++ __u32 num_pkts; ++ __u32 offset_to_first_pkt; ++ ++ /* Number of valid bytes (including padding) ++ * blk_len <= tp_block_size ++ */ ++ __u32 blk_len; ++ ++ /* ++ * Quite a few uses of sequence number: ++ * 1. Make sure cache flush etc worked. ++ * Well, one can argue - why not use the increasing ts below? ++ * But look at 2. below first. ++ * 2. When you pass around blocks to other user space decoders, ++ * you can see which blk[s] is[are] outstanding etc. ++ * 3. Validate kernel code. ++ */ ++ __aligned_u64 seq_num; ++ ++ /* ++ * ts_last_pkt: ++ * ++ * Case 1. Block has 'N'(N >=1) packets and TMO'd(timed out) ++ * ts_last_pkt == 'time-stamp of last packet' and NOT the ++ * time when the timer fired and the block was closed. ++ * By providing the ts of the last packet we can absolutely ++ * guarantee that time-stamp wise, the first packet in the ++ * next block will never precede the last packet of the ++ * previous block. ++ * Case 2. Block has zero packets and TMO'd ++ * ts_last_pkt = time when the timer fired and the block ++ * was closed. ++ * Case 3. Block has 'N' packets and NO TMO. ++ * ts_last_pkt = time-stamp of the last pkt in the block. ++ * ++ * ts_first_pkt: ++ * Is always the time-stamp when the block was opened. ++ * Case a) ZERO packets ++ * No packets to deal with but atleast you know the ++ * time-interval of this block. ++ * Case b) Non-zero packets ++ * Use the ts of the first packet in the block. ++ * ++ */ ++ struct tpacket_bd_ts ts_first_pkt, ts_last_pkt; ++}; ++ ++union tpacket_bd_header_u { ++ struct tpacket_hdr_v1 bh1; ++}; ++ ++struct tpacket_block_desc { ++ __u32 version; ++ __u32 offset_to_priv; ++ union tpacket_bd_header_u hdr; ++}; ++ ++#define TPACKET2_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket2_hdr)) + sizeof(struct sockaddr_ll)) ++#define TPACKET3_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket3_hdr)) + sizeof(struct sockaddr_ll)) ++ ++enum tpacket_versions { ++ TPACKET_V1, ++ TPACKET_V2, ++ TPACKET_V3 ++}; ++ ++/* ++ Frame structure: ++ ++ - Start. Frame must be aligned to TPACKET_ALIGNMENT=16 ++ - struct tpacket_hdr ++ - pad to TPACKET_ALIGNMENT=16 ++ - struct sockaddr_ll ++ - Gap, chosen so that packet data (Start+tp_net) alignes to TPACKET_ALIGNMENT=16 ++ - Start+tp_mac: [ Optional MAC header ] ++ - Start+tp_net: Packet data, aligned to TPACKET_ALIGNMENT=16. ++ - Pad to align to TPACKET_ALIGNMENT=16 ++ */ ++ ++struct tpacket_req { ++ unsigned int tp_block_size; /* Minimal size of contiguous block */ ++ unsigned int tp_block_nr; /* Number of blocks */ ++ unsigned int tp_frame_size; /* Size of frame */ ++ unsigned int tp_frame_nr; /* Total number of frames */ ++}; ++ ++struct tpacket_req3 { ++ unsigned int tp_block_size; /* Minimal size of contiguous block */ ++ unsigned int tp_block_nr; /* Number of blocks */ ++ unsigned int tp_frame_size; /* Size of frame */ ++ unsigned int tp_frame_nr; /* Total number of frames */ ++ unsigned int tp_retire_blk_tov; /* timeout in msecs */ ++ unsigned int tp_sizeof_priv; /* offset to private data area */ ++ unsigned int tp_feature_req_word; ++}; ++ ++union tpacket_req_u { ++ struct tpacket_req req; ++ struct tpacket_req3 req3; ++}; ++ ++struct packet_mreq { ++ int mr_ifindex; ++ unsigned short mr_type; ++ unsigned short mr_alen; ++ unsigned char mr_address[8]; ++}; ++ ++#define PACKET_MR_MULTICAST 0 ++#define PACKET_MR_PROMISC 1 ++#define PACKET_MR_ALLMULTI 2 ++#define PACKET_MR_UNICAST 3 ++ ++#endif +diff --git a/include/uapi/linux/if_tun.h b/include/uapi/linux/if_tun.h +new file mode 100644 +index 0000000..d5ecb42 +--- /dev/null ++++ b/include/uapi/linux/if_tun.h +@@ -0,0 +1,107 @@ ++/* ++ * Universal TUN/TAP device driver. ++ * Copyright (C) 1999-2000 Maxim Krasnyansky ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ */ ++ ++#ifndef __IF_TUN_H ++#define __IF_TUN_H ++ ++#include ++#include ++#include ++ ++/* Read queue size */ ++#define TUN_READQ_SIZE 500 ++/* TUN device type flags: deprecated. Use IFF_TUN/IFF_TAP instead. */ ++#define TUN_TUN_DEV IFF_TUN ++#define TUN_TAP_DEV IFF_TAP ++#define TUN_TYPE_MASK 0x000f ++ ++/* Ioctl defines */ ++#define TUNSETNOCSUM _IOW('T', 200, int) ++#define TUNSETDEBUG _IOW('T', 201, int) ++#define TUNSETIFF _IOW('T', 202, int) ++#define TUNSETPERSIST _IOW('T', 203, int) ++#define TUNSETOWNER _IOW('T', 204, int) ++#define TUNSETLINK _IOW('T', 205, int) ++#define TUNSETGROUP _IOW('T', 206, int) ++#define TUNGETFEATURES _IOR('T', 207, unsigned int) ++#define TUNSETOFFLOAD _IOW('T', 208, unsigned int) ++#define TUNSETTXFILTER _IOW('T', 209, unsigned int) ++#define TUNGETIFF _IOR('T', 210, unsigned int) ++#define TUNGETSNDBUF _IOR('T', 211, int) ++#define TUNSETSNDBUF _IOW('T', 212, int) ++#define TUNATTACHFILTER _IOW('T', 213, struct sock_fprog) ++#define TUNDETACHFILTER _IOW('T', 214, struct sock_fprog) ++#define TUNGETVNETHDRSZ _IOR('T', 215, int) ++#define TUNSETVNETHDRSZ _IOW('T', 216, int) ++#define TUNSETQUEUE _IOW('T', 217, int) ++#define TUNSETIFINDEX _IOW('T', 218, unsigned int) ++#define TUNGETFILTER _IOR('T', 219, struct sock_fprog) ++#define TUNSETVNETLE _IOW('T', 220, int) ++#define TUNGETVNETLE _IOR('T', 221, int) ++/* The TUNSETVNETBE and TUNGETVNETBE ioctls are for cross-endian support on ++ * little-endian hosts. Not all kernel configurations support them, but all ++ * configurations that support SET also support GET. ++ */ ++#define TUNSETVNETBE _IOW('T', 222, int) ++#define TUNGETVNETBE _IOR('T', 223, int) ++ ++/* TUNSETIFF ifr flags */ ++#define IFF_TUN 0x0001 ++#define IFF_TAP 0x0002 ++#define IFF_NO_PI 0x1000 ++/* This flag has no real effect */ ++#define IFF_ONE_QUEUE 0x2000 ++#define IFF_VNET_HDR 0x4000 ++#define IFF_TUN_EXCL 0x8000 ++#define IFF_MULTI_QUEUE 0x0100 ++#define IFF_ATTACH_QUEUE 0x0200 ++#define IFF_DETACH_QUEUE 0x0400 ++/* read-only flag */ ++#define IFF_PERSIST 0x0800 ++#define IFF_NOFILTER 0x1000 ++ ++/* Socket options */ ++#define TUN_TX_TIMESTAMP 1 ++ ++/* Features for GSO (TUNSETOFFLOAD). */ ++#define TUN_F_CSUM 0x01 /* You can hand me unchecksummed packets. */ ++#define TUN_F_TSO4 0x02 /* I can handle TSO for IPv4 packets */ ++#define TUN_F_TSO6 0x04 /* I can handle TSO for IPv6 packets */ ++#define TUN_F_TSO_ECN 0x08 /* I can handle TSO with ECN bits. */ ++#define TUN_F_UFO 0x10 /* I can handle UFO packets */ ++ ++/* Protocol info prepended to the packets (when IFF_NO_PI is not set) */ ++#define TUN_PKT_STRIP 0x0001 ++struct tun_pi { ++ __u16 flags; ++ __be16 proto; ++}; ++ ++/* ++ * Filter spec (used for SETXXFILTER ioctls) ++ * This stuff is applicable only to the TAP (Ethernet) devices. ++ * If the count is zero the filter is disabled and the driver accepts ++ * all packets (promisc mode). ++ * If the filter is enabled in order to accept broadcast packets ++ * broadcast addr must be explicitly included in the addr list. ++ */ ++#define TUN_FLT_ALLMULTI 0x0001 /* Accept all multicast packets */ ++struct tun_filter { ++ __u16 flags; /* TUN_FLT_ flags see above */ ++ __u16 count; /* Number of addresses */ ++ __u8 addr[0][ETH_ALEN]; ++}; ++ ++#endif /* __IF_TUN_H */ +diff --git a/include/uapi/linux/if_tunnel.h b/include/uapi/linux/if_tunnel.h +new file mode 100644 +index 0000000..21834ca +--- /dev/null ++++ b/include/uapi/linux/if_tunnel.h +@@ -0,0 +1,158 @@ ++#ifndef _IF_TUNNEL_H_ ++#define _IF_TUNNEL_H_ ++ ++#include ++#include ++#include ++#include ++#include ++ ++ ++#define SIOCGETTUNNEL (SIOCDEVPRIVATE + 0) ++#define SIOCADDTUNNEL (SIOCDEVPRIVATE + 1) ++#define SIOCDELTUNNEL (SIOCDEVPRIVATE + 2) ++#define SIOCCHGTUNNEL (SIOCDEVPRIVATE + 3) ++#define SIOCGETPRL (SIOCDEVPRIVATE + 4) ++#define SIOCADDPRL (SIOCDEVPRIVATE + 5) ++#define SIOCDELPRL (SIOCDEVPRIVATE + 6) ++#define SIOCCHGPRL (SIOCDEVPRIVATE + 7) ++#define SIOCGET6RD (SIOCDEVPRIVATE + 8) ++#define SIOCADD6RD (SIOCDEVPRIVATE + 9) ++#define SIOCDEL6RD (SIOCDEVPRIVATE + 10) ++#define SIOCCHG6RD (SIOCDEVPRIVATE + 11) ++ ++#define GRE_CSUM __cpu_to_be16(0x8000) ++#define GRE_ROUTING __cpu_to_be16(0x4000) ++#define GRE_KEY __cpu_to_be16(0x2000) ++#define GRE_SEQ __cpu_to_be16(0x1000) ++#define GRE_STRICT __cpu_to_be16(0x0800) ++#define GRE_REC __cpu_to_be16(0x0700) ++#define GRE_ACK __cpu_to_be16(0x0080) ++#define GRE_FLAGS __cpu_to_be16(0x0078) ++#define GRE_VERSION __cpu_to_be16(0x0007) ++ ++#define GRE_IS_CSUM(f) ((f) & GRE_CSUM) ++#define GRE_IS_ROUTING(f) ((f) & GRE_ROUTING) ++#define GRE_IS_KEY(f) ((f) & GRE_KEY) ++#define GRE_IS_SEQ(f) ((f) & GRE_SEQ) ++#define GRE_IS_STRICT(f) ((f) & GRE_STRICT) ++#define GRE_IS_REC(f) ((f) & GRE_REC) ++#define GRE_IS_ACK(f) ((f) & GRE_ACK) ++ ++#define GRE_VERSION_0 __cpu_to_be16(0x0000) ++#define GRE_VERSION_1 __cpu_to_be16(0x0001) ++#define GRE_PROTO_PPP __cpu_to_be16(0x880b) ++#define GRE_PPTP_KEY_MASK __cpu_to_be32(0xffff) ++ ++struct ip_tunnel_parm { ++ char name[IFNAMSIZ]; ++ int link; ++ __be16 i_flags; ++ __be16 o_flags; ++ __be32 i_key; ++ __be32 o_key; ++ struct iphdr iph; ++}; ++ ++enum { ++ IFLA_IPTUN_UNSPEC, ++ IFLA_IPTUN_LINK, ++ IFLA_IPTUN_LOCAL, ++ IFLA_IPTUN_REMOTE, ++ IFLA_IPTUN_TTL, ++ IFLA_IPTUN_TOS, ++ IFLA_IPTUN_ENCAP_LIMIT, ++ IFLA_IPTUN_FLOWINFO, ++ IFLA_IPTUN_FLAGS, ++ IFLA_IPTUN_PROTO, ++ IFLA_IPTUN_PMTUDISC, ++ IFLA_IPTUN_6RD_PREFIX, ++ IFLA_IPTUN_6RD_RELAY_PREFIX, ++ IFLA_IPTUN_6RD_PREFIXLEN, ++ IFLA_IPTUN_6RD_RELAY_PREFIXLEN, ++ IFLA_IPTUN_ENCAP_TYPE, ++ IFLA_IPTUN_ENCAP_FLAGS, ++ IFLA_IPTUN_ENCAP_SPORT, ++ IFLA_IPTUN_ENCAP_DPORT, ++ IFLA_IPTUN_COLLECT_METADATA, ++ IFLA_IPTUN_FWMARK, ++ __IFLA_IPTUN_MAX, ++}; ++#define IFLA_IPTUN_MAX (__IFLA_IPTUN_MAX - 1) ++ ++enum tunnel_encap_types { ++ TUNNEL_ENCAP_NONE, ++ TUNNEL_ENCAP_FOU, ++ TUNNEL_ENCAP_GUE, ++}; ++ ++#define TUNNEL_ENCAP_FLAG_CSUM (1<<0) ++#define TUNNEL_ENCAP_FLAG_CSUM6 (1<<1) ++#define TUNNEL_ENCAP_FLAG_REMCSUM (1<<2) ++ ++/* SIT-mode i_flags */ ++#define SIT_ISATAP 0x0001 ++ ++struct ip_tunnel_prl { ++ __be32 addr; ++ __u16 flags; ++ __u16 __reserved; ++ __u32 datalen; ++ __u32 __reserved2; ++ /* data follows */ ++}; ++ ++/* PRL flags */ ++#define PRL_DEFAULT 0x0001 ++ ++struct ip_tunnel_6rd { ++ struct in6_addr prefix; ++ __be32 relay_prefix; ++ __u16 prefixlen; ++ __u16 relay_prefixlen; ++}; ++ ++enum { ++ IFLA_GRE_UNSPEC, ++ IFLA_GRE_LINK, ++ IFLA_GRE_IFLAGS, ++ IFLA_GRE_OFLAGS, ++ IFLA_GRE_IKEY, ++ IFLA_GRE_OKEY, ++ IFLA_GRE_LOCAL, ++ IFLA_GRE_REMOTE, ++ IFLA_GRE_TTL, ++ IFLA_GRE_TOS, ++ IFLA_GRE_PMTUDISC, ++ IFLA_GRE_ENCAP_LIMIT, ++ IFLA_GRE_FLOWINFO, ++ IFLA_GRE_FLAGS, ++ IFLA_GRE_ENCAP_TYPE, ++ IFLA_GRE_ENCAP_FLAGS, ++ IFLA_GRE_ENCAP_SPORT, ++ IFLA_GRE_ENCAP_DPORT, ++ IFLA_GRE_COLLECT_METADATA, ++ IFLA_GRE_IGNORE_DF, ++ IFLA_GRE_FWMARK, ++ IFLA_GRE_ERSPAN_INDEX, ++ __IFLA_GRE_MAX, ++}; ++ ++#define IFLA_GRE_MAX (__IFLA_GRE_MAX - 1) ++ ++/* VTI-mode i_flags */ ++#define VTI_ISVTI ((__be16)0x0001) ++ ++enum { ++ IFLA_VTI_UNSPEC, ++ IFLA_VTI_LINK, ++ IFLA_VTI_IKEY, ++ IFLA_VTI_OKEY, ++ IFLA_VTI_LOCAL, ++ IFLA_VTI_REMOTE, ++ IFLA_VTI_FWMARK, ++ __IFLA_VTI_MAX, ++}; ++ ++#define IFLA_VTI_MAX (__IFLA_VTI_MAX - 1) ++#endif /* _IF_TUNNEL_H_ */ +diff --git a/include/uapi/linux/if_vlan.h b/include/uapi/linux/if_vlan.h +new file mode 100644 +index 0000000..24ae007 +--- /dev/null ++++ b/include/uapi/linux/if_vlan.h +@@ -0,0 +1,64 @@ ++/* ++ * VLAN An implementation of 802.1Q VLAN tagging. ++ * ++ * Authors: Ben Greear ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version ++ * 2 of the License, or (at your option) any later version. ++ * ++ */ ++ ++#ifndef _LINUX_IF_VLAN_H_ ++#define _LINUX_IF_VLAN_H_ ++ ++ ++/* VLAN IOCTLs are found in sockios.h */ ++ ++/* Passed in vlan_ioctl_args structure to determine behaviour. */ ++enum vlan_ioctl_cmds { ++ ADD_VLAN_CMD, ++ DEL_VLAN_CMD, ++ SET_VLAN_INGRESS_PRIORITY_CMD, ++ SET_VLAN_EGRESS_PRIORITY_CMD, ++ GET_VLAN_INGRESS_PRIORITY_CMD, ++ GET_VLAN_EGRESS_PRIORITY_CMD, ++ SET_VLAN_NAME_TYPE_CMD, ++ SET_VLAN_FLAG_CMD, ++ GET_VLAN_REALDEV_NAME_CMD, /* If this works, you know it's a VLAN device, btw */ ++ GET_VLAN_VID_CMD /* Get the VID of this VLAN (specified by name) */ ++}; ++ ++enum vlan_flags { ++ VLAN_FLAG_REORDER_HDR = 0x1, ++ VLAN_FLAG_GVRP = 0x2, ++ VLAN_FLAG_LOOSE_BINDING = 0x4, ++ VLAN_FLAG_MVRP = 0x8, ++}; ++ ++enum vlan_name_types { ++ VLAN_NAME_TYPE_PLUS_VID, /* Name will look like: vlan0005 */ ++ VLAN_NAME_TYPE_RAW_PLUS_VID, /* name will look like: eth1.0005 */ ++ VLAN_NAME_TYPE_PLUS_VID_NO_PAD, /* Name will look like: vlan5 */ ++ VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD, /* Name will look like: eth0.5 */ ++ VLAN_NAME_TYPE_HIGHEST ++}; ++ ++struct vlan_ioctl_args { ++ int cmd; /* Should be one of the vlan_ioctl_cmds enum above. */ ++ char device1[24]; ++ ++ union { ++ char device2[24]; ++ int VID; ++ unsigned int skb_priority; ++ unsigned int name_type; ++ unsigned int bind_type; ++ unsigned int flag; /* Matches vlan_dev_priv flags */ ++ } u; ++ ++ short vlan_qos; ++}; ++ ++#endif /* _LINUX_IF_VLAN_H_ */ +diff --git a/include/uapi/linux/ife.h b/include/uapi/linux/ife.h +new file mode 100644 +index 0000000..2954da3 +--- /dev/null ++++ b/include/uapi/linux/ife.h +@@ -0,0 +1,18 @@ ++#ifndef __UAPI_IFE_H ++#define __UAPI_IFE_H ++ ++#define IFE_METAHDRLEN 2 ++ ++enum { ++ IFE_META_SKBMARK = 1, ++ IFE_META_HASHID, ++ IFE_META_PRIO, ++ IFE_META_QMAP, ++ IFE_META_TCINDEX, ++ __IFE_META_MAX ++}; ++ ++/*Can be overridden at runtime by module option*/ ++#define IFE_META_MAX (__IFE_META_MAX - 1) ++ ++#endif +diff --git a/include/uapi/linux/ila.h b/include/uapi/linux/ila.h +new file mode 100644 +index 0000000..7e328d7 +--- /dev/null ++++ b/include/uapi/linux/ila.h +@@ -0,0 +1,45 @@ ++/* ila.h - ILA Interface */ ++ ++#ifndef _LINUX_ILA_H ++#define _LINUX_ILA_H ++ ++/* NETLINK_GENERIC related info */ ++#define ILA_GENL_NAME "ila" ++#define ILA_GENL_VERSION 0x1 ++ ++enum { ++ ILA_ATTR_UNSPEC, ++ ILA_ATTR_LOCATOR, /* u64 */ ++ ILA_ATTR_IDENTIFIER, /* u64 */ ++ ILA_ATTR_LOCATOR_MATCH, /* u64 */ ++ ILA_ATTR_IFINDEX, /* s32 */ ++ ILA_ATTR_DIR, /* u32 */ ++ ILA_ATTR_PAD, ++ ILA_ATTR_CSUM_MODE, /* u8 */ ++ ++ __ILA_ATTR_MAX, ++}; ++ ++#define ILA_ATTR_MAX (__ILA_ATTR_MAX - 1) ++ ++enum { ++ ILA_CMD_UNSPEC, ++ ILA_CMD_ADD, ++ ILA_CMD_DEL, ++ ILA_CMD_GET, ++ ++ __ILA_CMD_MAX, ++}; ++ ++#define ILA_CMD_MAX (__ILA_CMD_MAX - 1) ++ ++#define ILA_DIR_IN (1 << 0) ++#define ILA_DIR_OUT (1 << 1) ++ ++enum { ++ ILA_CSUM_ADJUST_TRANSPORT, ++ ILA_CSUM_NEUTRAL_MAP, ++ ILA_CSUM_NO_ACTION, ++}; ++ ++#endif /* _LINUX_ILA_H */ +diff --git a/include/uapi/linux/in.h b/include/uapi/linux/in.h +new file mode 100644 +index 0000000..9439efa +--- /dev/null ++++ b/include/uapi/linux/in.h +@@ -0,0 +1,300 @@ ++/* ++ * INET An implementation of the TCP/IP protocol suite for the LINUX ++ * operating system. INET is implemented using the BSD Socket ++ * interface as the means of communication with the user level. ++ * ++ * Definitions of the Internet Protocol. ++ * ++ * Version: @(#)in.h 1.0.1 04/21/93 ++ * ++ * Authors: Original taken from the GNU Project file. ++ * Fred N. van Kempen, ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version ++ * 2 of the License, or (at your option) any later version. ++ */ ++#ifndef _LINUX_IN_H ++#define _LINUX_IN_H ++ ++#include ++#include ++#include ++ ++#if __UAPI_DEF_IN_IPPROTO ++/* Standard well-defined IP protocols. */ ++enum { ++ IPPROTO_IP = 0, /* Dummy protocol for TCP */ ++#define IPPROTO_IP IPPROTO_IP ++ IPPROTO_ICMP = 1, /* Internet Control Message Protocol */ ++#define IPPROTO_ICMP IPPROTO_ICMP ++ IPPROTO_IGMP = 2, /* Internet Group Management Protocol */ ++#define IPPROTO_IGMP IPPROTO_IGMP ++ IPPROTO_IPIP = 4, /* IPIP tunnels (older KA9Q tunnels use 94) */ ++#define IPPROTO_IPIP IPPROTO_IPIP ++ IPPROTO_TCP = 6, /* Transmission Control Protocol */ ++#define IPPROTO_TCP IPPROTO_TCP ++ IPPROTO_EGP = 8, /* Exterior Gateway Protocol */ ++#define IPPROTO_EGP IPPROTO_EGP ++ IPPROTO_PUP = 12, /* PUP protocol */ ++#define IPPROTO_PUP IPPROTO_PUP ++ IPPROTO_UDP = 17, /* User Datagram Protocol */ ++#define IPPROTO_UDP IPPROTO_UDP ++ IPPROTO_IDP = 22, /* XNS IDP protocol */ ++#define IPPROTO_IDP IPPROTO_IDP ++ IPPROTO_TP = 29, /* SO Transport Protocol Class 4 */ ++#define IPPROTO_TP IPPROTO_TP ++ IPPROTO_DCCP = 33, /* Datagram Congestion Control Protocol */ ++#define IPPROTO_DCCP IPPROTO_DCCP ++ IPPROTO_IPV6 = 41, /* IPv6-in-IPv4 tunnelling */ ++#define IPPROTO_IPV6 IPPROTO_IPV6 ++ IPPROTO_RSVP = 46, /* RSVP Protocol */ ++#define IPPROTO_RSVP IPPROTO_RSVP ++ IPPROTO_GRE = 47, /* Cisco GRE tunnels (rfc 1701,1702) */ ++#define IPPROTO_GRE IPPROTO_GRE ++ IPPROTO_ESP = 50, /* Encapsulation Security Payload protocol */ ++#define IPPROTO_ESP IPPROTO_ESP ++ IPPROTO_AH = 51, /* Authentication Header protocol */ ++#define IPPROTO_AH IPPROTO_AH ++ IPPROTO_MTP = 92, /* Multicast Transport Protocol */ ++#define IPPROTO_MTP IPPROTO_MTP ++ IPPROTO_BEETPH = 94, /* IP option pseudo header for BEET */ ++#define IPPROTO_BEETPH IPPROTO_BEETPH ++ IPPROTO_ENCAP = 98, /* Encapsulation Header */ ++#define IPPROTO_ENCAP IPPROTO_ENCAP ++ IPPROTO_PIM = 103, /* Protocol Independent Multicast */ ++#define IPPROTO_PIM IPPROTO_PIM ++ IPPROTO_COMP = 108, /* Compression Header Protocol */ ++#define IPPROTO_COMP IPPROTO_COMP ++ IPPROTO_SCTP = 132, /* Stream Control Transport Protocol */ ++#define IPPROTO_SCTP IPPROTO_SCTP ++ IPPROTO_UDPLITE = 136, /* UDP-Lite (RFC 3828) */ ++#define IPPROTO_UDPLITE IPPROTO_UDPLITE ++ IPPROTO_MPLS = 137, /* MPLS in IP (RFC 4023) */ ++#define IPPROTO_MPLS IPPROTO_MPLS ++ IPPROTO_RAW = 255, /* Raw IP packets */ ++#define IPPROTO_RAW IPPROTO_RAW ++ IPPROTO_MAX ++}; ++#endif ++ ++#if __UAPI_DEF_IN_ADDR ++/* Internet address. */ ++struct in_addr { ++ __be32 s_addr; ++}; ++#endif ++ ++#define IP_TOS 1 ++#define IP_TTL 2 ++#define IP_HDRINCL 3 ++#define IP_OPTIONS 4 ++#define IP_ROUTER_ALERT 5 ++#define IP_RECVOPTS 6 ++#define IP_RETOPTS 7 ++#define IP_PKTINFO 8 ++#define IP_PKTOPTIONS 9 ++#define IP_MTU_DISCOVER 10 ++#define IP_RECVERR 11 ++#define IP_RECVTTL 12 ++#define IP_RECVTOS 13 ++#define IP_MTU 14 ++#define IP_FREEBIND 15 ++#define IP_IPSEC_POLICY 16 ++#define IP_XFRM_POLICY 17 ++#define IP_PASSSEC 18 ++#define IP_TRANSPARENT 19 ++ ++/* BSD compatibility */ ++#define IP_RECVRETOPTS IP_RETOPTS ++ ++/* TProxy original addresses */ ++#define IP_ORIGDSTADDR 20 ++#define IP_RECVORIGDSTADDR IP_ORIGDSTADDR ++ ++#define IP_MINTTL 21 ++#define IP_NODEFRAG 22 ++#define IP_CHECKSUM 23 ++#define IP_BIND_ADDRESS_NO_PORT 24 ++#define IP_RECVFRAGSIZE 25 ++ ++/* IP_MTU_DISCOVER values */ ++#define IP_PMTUDISC_DONT 0 /* Never send DF frames */ ++#define IP_PMTUDISC_WANT 1 /* Use per route hints */ ++#define IP_PMTUDISC_DO 2 /* Always DF */ ++#define IP_PMTUDISC_PROBE 3 /* Ignore dst pmtu */ ++/* Always use interface mtu (ignores dst pmtu) but don't set DF flag. ++ * Also incoming ICMP frag_needed notifications will be ignored on ++ * this socket to prevent accepting spoofed ones. ++ */ ++#define IP_PMTUDISC_INTERFACE 4 ++/* weaker version of IP_PMTUDISC_INTERFACE, which allos packets to get ++ * fragmented if they exeed the interface mtu ++ */ ++#define IP_PMTUDISC_OMIT 5 ++ ++#define IP_MULTICAST_IF 32 ++#define IP_MULTICAST_TTL 33 ++#define IP_MULTICAST_LOOP 34 ++#define IP_ADD_MEMBERSHIP 35 ++#define IP_DROP_MEMBERSHIP 36 ++#define IP_UNBLOCK_SOURCE 37 ++#define IP_BLOCK_SOURCE 38 ++#define IP_ADD_SOURCE_MEMBERSHIP 39 ++#define IP_DROP_SOURCE_MEMBERSHIP 40 ++#define IP_MSFILTER 41 ++#define MCAST_JOIN_GROUP 42 ++#define MCAST_BLOCK_SOURCE 43 ++#define MCAST_UNBLOCK_SOURCE 44 ++#define MCAST_LEAVE_GROUP 45 ++#define MCAST_JOIN_SOURCE_GROUP 46 ++#define MCAST_LEAVE_SOURCE_GROUP 47 ++#define MCAST_MSFILTER 48 ++#define IP_MULTICAST_ALL 49 ++#define IP_UNICAST_IF 50 ++ ++#define MCAST_EXCLUDE 0 ++#define MCAST_INCLUDE 1 ++ ++/* These need to appear somewhere around here */ ++#define IP_DEFAULT_MULTICAST_TTL 1 ++#define IP_DEFAULT_MULTICAST_LOOP 1 ++ ++/* Request struct for multicast socket ops */ ++ ++#if __UAPI_DEF_IP_MREQ ++struct ip_mreq { ++ struct in_addr imr_multiaddr; /* IP multicast address of group */ ++ struct in_addr imr_interface; /* local IP address of interface */ ++}; ++ ++struct ip_mreqn { ++ struct in_addr imr_multiaddr; /* IP multicast address of group */ ++ struct in_addr imr_address; /* local IP address of interface */ ++ int imr_ifindex; /* Interface index */ ++}; ++ ++struct ip_mreq_source { ++ __be32 imr_multiaddr; ++ __be32 imr_interface; ++ __be32 imr_sourceaddr; ++}; ++ ++struct ip_msfilter { ++ __be32 imsf_multiaddr; ++ __be32 imsf_interface; ++ __u32 imsf_fmode; ++ __u32 imsf_numsrc; ++ __be32 imsf_slist[1]; ++}; ++ ++#define IP_MSFILTER_SIZE(numsrc) \ ++ (sizeof(struct ip_msfilter) - sizeof(__u32) \ ++ + (numsrc) * sizeof(__u32)) ++ ++struct group_req { ++ __u32 gr_interface; /* interface index */ ++ struct __kernel_sockaddr_storage gr_group; /* group address */ ++}; ++ ++struct group_source_req { ++ __u32 gsr_interface; /* interface index */ ++ struct __kernel_sockaddr_storage gsr_group; /* group address */ ++ struct __kernel_sockaddr_storage gsr_source; /* source address */ ++}; ++ ++struct group_filter { ++ __u32 gf_interface; /* interface index */ ++ struct __kernel_sockaddr_storage gf_group; /* multicast address */ ++ __u32 gf_fmode; /* filter mode */ ++ __u32 gf_numsrc; /* number of sources */ ++ struct __kernel_sockaddr_storage gf_slist[1]; /* interface index */ ++}; ++ ++#define GROUP_FILTER_SIZE(numsrc) \ ++ (sizeof(struct group_filter) - sizeof(struct __kernel_sockaddr_storage) \ ++ + (numsrc) * sizeof(struct __kernel_sockaddr_storage)) ++#endif ++ ++#if __UAPI_DEF_IN_PKTINFO ++struct in_pktinfo { ++ int ipi_ifindex; ++ struct in_addr ipi_spec_dst; ++ struct in_addr ipi_addr; ++}; ++#endif ++ ++/* Structure describing an Internet (IP) socket address. */ ++#if __UAPI_DEF_SOCKADDR_IN ++#define __SOCK_SIZE__ 16 /* sizeof(struct sockaddr) */ ++struct sockaddr_in { ++ __kernel_sa_family_t sin_family; /* Address family */ ++ __be16 sin_port; /* Port number */ ++ struct in_addr sin_addr; /* Internet address */ ++ ++ /* Pad to size of `struct sockaddr'. */ ++ unsigned char __pad[__SOCK_SIZE__ - sizeof(short int) - ++ sizeof(unsigned short int) - sizeof(struct in_addr)]; ++}; ++#define sin_zero __pad /* for BSD UNIX comp. -FvK */ ++#endif ++ ++#if __UAPI_DEF_IN_CLASS ++/* ++ * Definitions of the bits in an Internet address integer. ++ * On subnets, host and network parts are found according ++ * to the subnet mask, not these masks. ++ */ ++#define IN_CLASSA(a) ((((long int) (a)) & 0x80000000) == 0) ++#define IN_CLASSA_NET 0xff000000 ++#define IN_CLASSA_NSHIFT 24 ++#define IN_CLASSA_HOST (0xffffffff & ~IN_CLASSA_NET) ++#define IN_CLASSA_MAX 128 ++ ++#define IN_CLASSB(a) ((((long int) (a)) & 0xc0000000) == 0x80000000) ++#define IN_CLASSB_NET 0xffff0000 ++#define IN_CLASSB_NSHIFT 16 ++#define IN_CLASSB_HOST (0xffffffff & ~IN_CLASSB_NET) ++#define IN_CLASSB_MAX 65536 ++ ++#define IN_CLASSC(a) ((((long int) (a)) & 0xe0000000) == 0xc0000000) ++#define IN_CLASSC_NET 0xffffff00 ++#define IN_CLASSC_NSHIFT 8 ++#define IN_CLASSC_HOST (0xffffffff & ~IN_CLASSC_NET) ++ ++#define IN_CLASSD(a) ((((long int) (a)) & 0xf0000000) == 0xe0000000) ++#define IN_MULTICAST(a) IN_CLASSD(a) ++#define IN_MULTICAST_NET 0xF0000000 ++ ++#define IN_EXPERIMENTAL(a) ((((long int) (a)) & 0xf0000000) == 0xf0000000) ++#define IN_BADCLASS(a) IN_EXPERIMENTAL((a)) ++ ++/* Address to accept any incoming messages. */ ++#define INADDR_ANY ((unsigned long int) 0x00000000) ++ ++/* Address to send to all hosts. */ ++#define INADDR_BROADCAST ((unsigned long int) 0xffffffff) ++ ++/* Address indicating an error return. */ ++#define INADDR_NONE ((unsigned long int) 0xffffffff) ++ ++/* Network number for local host loopback. */ ++#define IN_LOOPBACKNET 127 ++ ++/* Address to loopback in software to local host. */ ++#define INADDR_LOOPBACK 0x7f000001 /* 127.0.0.1 */ ++#define IN_LOOPBACK(a) ((((long int) (a)) & 0xff000000) == 0x7f000000) ++ ++/* Defines for Multicast INADDR */ ++#define INADDR_UNSPEC_GROUP 0xe0000000U /* 224.0.0.0 */ ++#define INADDR_ALLHOSTS_GROUP 0xe0000001U /* 224.0.0.1 */ ++#define INADDR_ALLRTRS_GROUP 0xe0000002U /* 224.0.0.2 */ ++#define INADDR_MAX_LOCAL_GROUP 0xe00000ffU /* 224.0.0.255 */ ++#endif ++ ++/* contains the htonl type stuff.. */ ++#include ++ ++ ++#endif /* _LINUX_IN_H */ +diff --git a/include/uapi/linux/in6.h b/include/uapi/linux/in6.h +new file mode 100644 +index 0000000..6f3bdee +--- /dev/null ++++ b/include/uapi/linux/in6.h +@@ -0,0 +1,296 @@ ++/* ++ * Types and definitions for AF_INET6 ++ * Linux INET6 implementation ++ * ++ * Authors: ++ * Pedro Roque ++ * ++ * Sources: ++ * IPv6 Program Interfaces for BSD Systems ++ * ++ * ++ * Advanced Sockets API for IPv6 ++ * ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version ++ * 2 of the License, or (at your option) any later version. ++ */ ++ ++#ifndef _LINUX_IN6_H ++#define _LINUX_IN6_H ++ ++#include ++#include ++ ++/* ++ * IPv6 address structure ++ */ ++ ++#if __UAPI_DEF_IN6_ADDR ++struct in6_addr { ++ union { ++ __u8 u6_addr8[16]; ++#if __UAPI_DEF_IN6_ADDR_ALT ++ __be16 u6_addr16[8]; ++ __be32 u6_addr32[4]; ++#endif ++ } in6_u; ++#define s6_addr in6_u.u6_addr8 ++#if __UAPI_DEF_IN6_ADDR_ALT ++#define s6_addr16 in6_u.u6_addr16 ++#define s6_addr32 in6_u.u6_addr32 ++#endif ++}; ++#endif /* __UAPI_DEF_IN6_ADDR */ ++ ++#if __UAPI_DEF_SOCKADDR_IN6 ++struct sockaddr_in6 { ++ unsigned short int sin6_family; /* AF_INET6 */ ++ __be16 sin6_port; /* Transport layer port # */ ++ __be32 sin6_flowinfo; /* IPv6 flow information */ ++ struct in6_addr sin6_addr; /* IPv6 address */ ++ __u32 sin6_scope_id; /* scope id (new in RFC2553) */ ++}; ++#endif /* __UAPI_DEF_SOCKADDR_IN6 */ ++ ++#if __UAPI_DEF_IPV6_MREQ ++struct ipv6_mreq { ++ /* IPv6 multicast address of group */ ++ struct in6_addr ipv6mr_multiaddr; ++ ++ /* local IPv6 address of interface */ ++ int ipv6mr_ifindex; ++}; ++#endif /* __UAPI_DEF_IVP6_MREQ */ ++ ++#define ipv6mr_acaddr ipv6mr_multiaddr ++ ++struct in6_flowlabel_req { ++ struct in6_addr flr_dst; ++ __be32 flr_label; ++ __u8 flr_action; ++ __u8 flr_share; ++ __u16 flr_flags; ++ __u16 flr_expires; ++ __u16 flr_linger; ++ __u32 __flr_pad; ++ /* Options in format of IPV6_PKTOPTIONS */ ++}; ++ ++#define IPV6_FL_A_GET 0 ++#define IPV6_FL_A_PUT 1 ++#define IPV6_FL_A_RENEW 2 ++ ++#define IPV6_FL_F_CREATE 1 ++#define IPV6_FL_F_EXCL 2 ++#define IPV6_FL_F_REFLECT 4 ++#define IPV6_FL_F_REMOTE 8 ++ ++#define IPV6_FL_S_NONE 0 ++#define IPV6_FL_S_EXCL 1 ++#define IPV6_FL_S_PROCESS 2 ++#define IPV6_FL_S_USER 3 ++#define IPV6_FL_S_ANY 255 ++ ++ ++/* ++ * Bitmask constant declarations to help applications select out the ++ * flow label and priority fields. ++ * ++ * Note that this are in host byte order while the flowinfo field of ++ * sockaddr_in6 is in network byte order. ++ */ ++ ++#define IPV6_FLOWINFO_FLOWLABEL 0x000fffff ++#define IPV6_FLOWINFO_PRIORITY 0x0ff00000 ++ ++/* These definitions are obsolete */ ++#define IPV6_PRIORITY_UNCHARACTERIZED 0x0000 ++#define IPV6_PRIORITY_FILLER 0x0100 ++#define IPV6_PRIORITY_UNATTENDED 0x0200 ++#define IPV6_PRIORITY_RESERVED1 0x0300 ++#define IPV6_PRIORITY_BULK 0x0400 ++#define IPV6_PRIORITY_RESERVED2 0x0500 ++#define IPV6_PRIORITY_INTERACTIVE 0x0600 ++#define IPV6_PRIORITY_CONTROL 0x0700 ++#define IPV6_PRIORITY_8 0x0800 ++#define IPV6_PRIORITY_9 0x0900 ++#define IPV6_PRIORITY_10 0x0a00 ++#define IPV6_PRIORITY_11 0x0b00 ++#define IPV6_PRIORITY_12 0x0c00 ++#define IPV6_PRIORITY_13 0x0d00 ++#define IPV6_PRIORITY_14 0x0e00 ++#define IPV6_PRIORITY_15 0x0f00 ++ ++/* ++ * IPV6 extension headers ++ */ ++#if __UAPI_DEF_IPPROTO_V6 ++#define IPPROTO_HOPOPTS 0 /* IPv6 hop-by-hop options */ ++#define IPPROTO_ROUTING 43 /* IPv6 routing header */ ++#define IPPROTO_FRAGMENT 44 /* IPv6 fragmentation header */ ++#define IPPROTO_ICMPV6 58 /* ICMPv6 */ ++#define IPPROTO_NONE 59 /* IPv6 no next header */ ++#define IPPROTO_DSTOPTS 60 /* IPv6 destination options */ ++#define IPPROTO_MH 135 /* IPv6 mobility header */ ++#endif /* __UAPI_DEF_IPPROTO_V6 */ ++ ++/* ++ * IPv6 TLV options. ++ */ ++#define IPV6_TLV_PAD1 0 ++#define IPV6_TLV_PADN 1 ++#define IPV6_TLV_ROUTERALERT 5 ++#define IPV6_TLV_CALIPSO 7 /* RFC 5570 */ ++#define IPV6_TLV_JUMBO 194 ++#define IPV6_TLV_HAO 201 /* home address option */ ++ ++/* ++ * IPV6 socket options ++ */ ++#if __UAPI_DEF_IPV6_OPTIONS ++#define IPV6_ADDRFORM 1 ++#define IPV6_2292PKTINFO 2 ++#define IPV6_2292HOPOPTS 3 ++#define IPV6_2292DSTOPTS 4 ++#define IPV6_2292RTHDR 5 ++#define IPV6_2292PKTOPTIONS 6 ++#define IPV6_CHECKSUM 7 ++#define IPV6_2292HOPLIMIT 8 ++#define IPV6_NEXTHOP 9 ++#define IPV6_AUTHHDR 10 /* obsolete */ ++#define IPV6_FLOWINFO 11 ++ ++#define IPV6_UNICAST_HOPS 16 ++#define IPV6_MULTICAST_IF 17 ++#define IPV6_MULTICAST_HOPS 18 ++#define IPV6_MULTICAST_LOOP 19 ++#define IPV6_ADD_MEMBERSHIP 20 ++#define IPV6_DROP_MEMBERSHIP 21 ++#define IPV6_ROUTER_ALERT 22 ++#define IPV6_MTU_DISCOVER 23 ++#define IPV6_MTU 24 ++#define IPV6_RECVERR 25 ++#define IPV6_V6ONLY 26 ++#define IPV6_JOIN_ANYCAST 27 ++#define IPV6_LEAVE_ANYCAST 28 ++ ++/* IPV6_MTU_DISCOVER values */ ++#define IPV6_PMTUDISC_DONT 0 ++#define IPV6_PMTUDISC_WANT 1 ++#define IPV6_PMTUDISC_DO 2 ++#define IPV6_PMTUDISC_PROBE 3 ++/* same as IPV6_PMTUDISC_PROBE, provided for symetry with IPv4 ++ * also see comments on IP_PMTUDISC_INTERFACE ++ */ ++#define IPV6_PMTUDISC_INTERFACE 4 ++/* weaker version of IPV6_PMTUDISC_INTERFACE, which allows packets to ++ * get fragmented if they exceed the interface mtu ++ */ ++#define IPV6_PMTUDISC_OMIT 5 ++ ++/* Flowlabel */ ++#define IPV6_FLOWLABEL_MGR 32 ++#define IPV6_FLOWINFO_SEND 33 ++ ++#define IPV6_IPSEC_POLICY 34 ++#define IPV6_XFRM_POLICY 35 ++#define IPV6_HDRINCL 36 ++#endif ++ ++/* ++ * Multicast: ++ * Following socket options are shared between IPv4 and IPv6. ++ * ++ * MCAST_JOIN_GROUP 42 ++ * MCAST_BLOCK_SOURCE 43 ++ * MCAST_UNBLOCK_SOURCE 44 ++ * MCAST_LEAVE_GROUP 45 ++ * MCAST_JOIN_SOURCE_GROUP 46 ++ * MCAST_LEAVE_SOURCE_GROUP 47 ++ * MCAST_MSFILTER 48 ++ */ ++ ++/* ++ * Advanced API (RFC3542) (1) ++ * ++ * Note: IPV6_RECVRTHDRDSTOPTS does not exist. see net/ipv6/datagram.c. ++ */ ++ ++#define IPV6_RECVPKTINFO 49 ++#define IPV6_PKTINFO 50 ++#define IPV6_RECVHOPLIMIT 51 ++#define IPV6_HOPLIMIT 52 ++#define IPV6_RECVHOPOPTS 53 ++#define IPV6_HOPOPTS 54 ++#define IPV6_RTHDRDSTOPTS 55 ++#define IPV6_RECVRTHDR 56 ++#define IPV6_RTHDR 57 ++#define IPV6_RECVDSTOPTS 58 ++#define IPV6_DSTOPTS 59 ++#define IPV6_RECVPATHMTU 60 ++#define IPV6_PATHMTU 61 ++#define IPV6_DONTFRAG 62 ++#if 0 /* not yet */ ++#define IPV6_USE_MIN_MTU 63 ++#endif ++ ++/* ++ * Netfilter (1) ++ * ++ * Following socket options are used in ip6_tables; ++ * see include/linux/netfilter_ipv6/ip6_tables.h. ++ * ++ * IP6T_SO_SET_REPLACE / IP6T_SO_GET_INFO 64 ++ * IP6T_SO_SET_ADD_COUNTERS / IP6T_SO_GET_ENTRIES 65 ++ */ ++ ++/* ++ * Advanced API (RFC3542) (2) ++ */ ++#define IPV6_RECVTCLASS 66 ++#define IPV6_TCLASS 67 ++ ++/* ++ * Netfilter (2) ++ * ++ * Following socket options are used in ip6_tables; ++ * see include/linux/netfilter_ipv6/ip6_tables.h. ++ * ++ * IP6T_SO_GET_REVISION_MATCH 68 ++ * IP6T_SO_GET_REVISION_TARGET 69 ++ * IP6T_SO_ORIGINAL_DST 80 ++ */ ++ ++#define IPV6_AUTOFLOWLABEL 70 ++/* RFC5014: Source address selection */ ++#define IPV6_ADDR_PREFERENCES 72 ++ ++#define IPV6_PREFER_SRC_TMP 0x0001 ++#define IPV6_PREFER_SRC_PUBLIC 0x0002 ++#define IPV6_PREFER_SRC_PUBTMP_DEFAULT 0x0100 ++#define IPV6_PREFER_SRC_COA 0x0004 ++#define IPV6_PREFER_SRC_HOME 0x0400 ++#define IPV6_PREFER_SRC_CGA 0x0008 ++#define IPV6_PREFER_SRC_NONCGA 0x0800 ++ ++/* RFC5082: Generalized Ttl Security Mechanism */ ++#define IPV6_MINHOPCOUNT 73 ++ ++#define IPV6_ORIGDSTADDR 74 ++#define IPV6_RECVORIGDSTADDR IPV6_ORIGDSTADDR ++#define IPV6_TRANSPARENT 75 ++#define IPV6_UNICAST_IF 76 ++#define IPV6_RECVFRAGSIZE 77 ++ ++/* ++ * Multicast Routing: ++ * see include/uapi/linux/mroute6.h. ++ * ++ * MRT6_BASE 200 ++ * ... ++ * MRT6_MAX ++ */ ++#endif /* _LINUX_IN6_H */ +diff --git a/include/uapi/linux/in_route.h b/include/uapi/linux/in_route.h +new file mode 100644 +index 0000000..b261b8c +--- /dev/null ++++ b/include/uapi/linux/in_route.h +@@ -0,0 +1,32 @@ ++#ifndef _LINUX_IN_ROUTE_H ++#define _LINUX_IN_ROUTE_H ++ ++/* IPv4 routing cache flags */ ++ ++#define RTCF_DEAD RTNH_F_DEAD ++#define RTCF_ONLINK RTNH_F_ONLINK ++ ++/* Obsolete flag. About to be deleted */ ++#define RTCF_NOPMTUDISC RTM_F_NOPMTUDISC ++ ++#define RTCF_NOTIFY 0x00010000 ++#define RTCF_DIRECTDST 0x00020000 /* unused */ ++#define RTCF_REDIRECTED 0x00040000 ++#define RTCF_TPROXY 0x00080000 /* unused */ ++ ++#define RTCF_FAST 0x00200000 /* unused */ ++#define RTCF_MASQ 0x00400000 /* unused */ ++#define RTCF_SNAT 0x00800000 /* unused */ ++#define RTCF_DOREDIRECT 0x01000000 ++#define RTCF_DIRECTSRC 0x04000000 ++#define RTCF_DNAT 0x08000000 ++#define RTCF_BROADCAST 0x10000000 ++#define RTCF_MULTICAST 0x20000000 ++#define RTCF_REJECT 0x40000000 /* unused */ ++#define RTCF_LOCAL 0x80000000 ++ ++#define RTCF_NAT (RTCF_DNAT|RTCF_SNAT) ++ ++#define RT_TOS(tos) ((tos)&IPTOS_TOS_MASK) ++ ++#endif /* _LINUX_IN_ROUTE_H */ +diff --git a/include/uapi/linux/inet_diag.h b/include/uapi/linux/inet_diag.h +new file mode 100644 +index 0000000..bada4d7 +--- /dev/null ++++ b/include/uapi/linux/inet_diag.h +@@ -0,0 +1,196 @@ ++#ifndef _INET_DIAG_H_ ++#define _INET_DIAG_H_ ++ ++#include ++ ++/* Just some random number */ ++#define TCPDIAG_GETSOCK 18 ++#define DCCPDIAG_GETSOCK 19 ++ ++#define INET_DIAG_GETSOCK_MAX 24 ++ ++/* Socket identity */ ++struct inet_diag_sockid { ++ __be16 idiag_sport; ++ __be16 idiag_dport; ++ __be32 idiag_src[4]; ++ __be32 idiag_dst[4]; ++ __u32 idiag_if; ++ __u32 idiag_cookie[2]; ++#define INET_DIAG_NOCOOKIE (~0U) ++}; ++ ++/* Request structure */ ++ ++struct inet_diag_req { ++ __u8 idiag_family; /* Family of addresses. */ ++ __u8 idiag_src_len; ++ __u8 idiag_dst_len; ++ __u8 idiag_ext; /* Query extended information */ ++ ++ struct inet_diag_sockid id; ++ ++ __u32 idiag_states; /* States to dump */ ++ __u32 idiag_dbs; /* Tables to dump (NI) */ ++}; ++ ++struct inet_diag_req_v2 { ++ __u8 sdiag_family; ++ __u8 sdiag_protocol; ++ __u8 idiag_ext; ++ __u8 pad; ++ __u32 idiag_states; ++ struct inet_diag_sockid id; ++}; ++ ++/* ++ * SOCK_RAW sockets require the underlied protocol to be ++ * additionally specified so we can use @pad member for ++ * this, but we can't rename it because userspace programs ++ * still may depend on this name. Instead lets use another ++ * structure definition as an alias for struct ++ * @inet_diag_req_v2. ++ */ ++struct inet_diag_req_raw { ++ __u8 sdiag_family; ++ __u8 sdiag_protocol; ++ __u8 idiag_ext; ++ __u8 sdiag_raw_protocol; ++ __u32 idiag_states; ++ struct inet_diag_sockid id; ++}; ++ ++enum { ++ INET_DIAG_REQ_NONE, ++ INET_DIAG_REQ_BYTECODE, ++}; ++ ++#define INET_DIAG_REQ_MAX INET_DIAG_REQ_BYTECODE ++ ++/* Bytecode is sequence of 4 byte commands followed by variable arguments. ++ * All the commands identified by "code" are conditional jumps forward: ++ * to offset cc+"yes" or to offset cc+"no". "yes" is supposed to be ++ * length of the command and its arguments. ++ */ ++ ++struct inet_diag_bc_op { ++ unsigned char code; ++ unsigned char yes; ++ unsigned short no; ++}; ++ ++enum { ++ INET_DIAG_BC_NOP, ++ INET_DIAG_BC_JMP, ++ INET_DIAG_BC_S_GE, ++ INET_DIAG_BC_S_LE, ++ INET_DIAG_BC_D_GE, ++ INET_DIAG_BC_D_LE, ++ INET_DIAG_BC_AUTO, ++ INET_DIAG_BC_S_COND, ++ INET_DIAG_BC_D_COND, ++ INET_DIAG_BC_DEV_COND, /* u32 ifindex */ ++ INET_DIAG_BC_MARK_COND, ++}; ++ ++struct inet_diag_hostcond { ++ __u8 family; ++ __u8 prefix_len; ++ int port; ++ __be32 addr[0]; ++}; ++ ++struct inet_diag_markcond { ++ __u32 mark; ++ __u32 mask; ++}; ++ ++/* Base info structure. It contains socket identity (addrs/ports/cookie) ++ * and, alas, the information shown by netstat. */ ++struct inet_diag_msg { ++ __u8 idiag_family; ++ __u8 idiag_state; ++ __u8 idiag_timer; ++ __u8 idiag_retrans; ++ ++ struct inet_diag_sockid id; ++ ++ __u32 idiag_expires; ++ __u32 idiag_rqueue; ++ __u32 idiag_wqueue; ++ __u32 idiag_uid; ++ __u32 idiag_inode; ++}; ++ ++/* Extensions */ ++ ++enum { ++ INET_DIAG_NONE, ++ INET_DIAG_MEMINFO, ++ INET_DIAG_INFO, ++ INET_DIAG_VEGASINFO, ++ INET_DIAG_CONG, ++ INET_DIAG_TOS, ++ INET_DIAG_TCLASS, ++ INET_DIAG_SKMEMINFO, ++ INET_DIAG_SHUTDOWN, ++ INET_DIAG_DCTCPINFO, ++ INET_DIAG_PROTOCOL, /* response attribute only */ ++ INET_DIAG_SKV6ONLY, ++ INET_DIAG_LOCALS, ++ INET_DIAG_PEERS, ++ INET_DIAG_PAD, ++ INET_DIAG_MARK, ++ INET_DIAG_BBRINFO, ++ INET_DIAG_CLASS_ID, ++ INET_DIAG_MD5SIG, ++ __INET_DIAG_MAX, ++}; ++ ++#define INET_DIAG_MAX (__INET_DIAG_MAX - 1) ++ ++/* INET_DIAG_MEM */ ++ ++struct inet_diag_meminfo { ++ __u32 idiag_rmem; ++ __u32 idiag_wmem; ++ __u32 idiag_fmem; ++ __u32 idiag_tmem; ++}; ++ ++/* INET_DIAG_VEGASINFO */ ++ ++struct tcpvegas_info { ++ __u32 tcpv_enabled; ++ __u32 tcpv_rttcnt; ++ __u32 tcpv_rtt; ++ __u32 tcpv_minrtt; ++}; ++ ++/* INET_DIAG_DCTCPINFO */ ++ ++struct tcp_dctcp_info { ++ __u16 dctcp_enabled; ++ __u16 dctcp_ce_state; ++ __u32 dctcp_alpha; ++ __u32 dctcp_ab_ecn; ++ __u32 dctcp_ab_tot; ++}; ++ ++/* INET_DIAG_BBRINFO */ ++ ++struct tcp_bbr_info { ++ /* u64 bw: max-filtered BW (app throughput) estimate in Byte per sec: */ ++ __u32 bbr_bw_lo; /* lower 32 bits of bw */ ++ __u32 bbr_bw_hi; /* upper 32 bits of bw */ ++ __u32 bbr_min_rtt; /* min-filtered RTT in uSec */ ++ __u32 bbr_pacing_gain; /* pacing gain shifted left 8 bits */ ++ __u32 bbr_cwnd_gain; /* cwnd gain shifted left 8 bits */ ++}; ++ ++union tcp_cc_info { ++ struct tcpvegas_info vegas; ++ struct tcp_dctcp_info dctcp; ++ struct tcp_bbr_info bbr; ++}; ++#endif /* _INET_DIAG_H_ */ +diff --git a/include/uapi/linux/ip.h b/include/uapi/linux/ip.h +new file mode 100644 +index 0000000..1907284 +--- /dev/null ++++ b/include/uapi/linux/ip.h +@@ -0,0 +1,175 @@ ++/* ++ * INET An implementation of the TCP/IP protocol suite for the LINUX ++ * operating system. INET is implemented using the BSD Socket ++ * interface as the means of communication with the user level. ++ * ++ * Definitions for the IP protocol. ++ * ++ * Version: @(#)ip.h 1.0.2 04/28/93 ++ * ++ * Authors: Fred N. van Kempen, ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version ++ * 2 of the License, or (at your option) any later version. ++ */ ++#ifndef _LINUX_IP_H ++#define _LINUX_IP_H ++#include ++#include ++ ++#define IPTOS_TOS_MASK 0x1E ++#define IPTOS_TOS(tos) ((tos)&IPTOS_TOS_MASK) ++#define IPTOS_LOWDELAY 0x10 ++#define IPTOS_THROUGHPUT 0x08 ++#define IPTOS_RELIABILITY 0x04 ++#define IPTOS_MINCOST 0x02 ++ ++#define IPTOS_PREC_MASK 0xE0 ++#define IPTOS_PREC(tos) ((tos)&IPTOS_PREC_MASK) ++#define IPTOS_PREC_NETCONTROL 0xe0 ++#define IPTOS_PREC_INTERNETCONTROL 0xc0 ++#define IPTOS_PREC_CRITIC_ECP 0xa0 ++#define IPTOS_PREC_FLASHOVERRIDE 0x80 ++#define IPTOS_PREC_FLASH 0x60 ++#define IPTOS_PREC_IMMEDIATE 0x40 ++#define IPTOS_PREC_PRIORITY 0x20 ++#define IPTOS_PREC_ROUTINE 0x00 ++ ++ ++/* IP options */ ++#define IPOPT_COPY 0x80 ++#define IPOPT_CLASS_MASK 0x60 ++#define IPOPT_NUMBER_MASK 0x1f ++ ++#define IPOPT_COPIED(o) ((o)&IPOPT_COPY) ++#define IPOPT_CLASS(o) ((o)&IPOPT_CLASS_MASK) ++#define IPOPT_NUMBER(o) ((o)&IPOPT_NUMBER_MASK) ++ ++#define IPOPT_CONTROL 0x00 ++#define IPOPT_RESERVED1 0x20 ++#define IPOPT_MEASUREMENT 0x40 ++#define IPOPT_RESERVED2 0x60 ++ ++#define IPOPT_END (0 |IPOPT_CONTROL) ++#define IPOPT_NOOP (1 |IPOPT_CONTROL) ++#define IPOPT_SEC (2 |IPOPT_CONTROL|IPOPT_COPY) ++#define IPOPT_LSRR (3 |IPOPT_CONTROL|IPOPT_COPY) ++#define IPOPT_TIMESTAMP (4 |IPOPT_MEASUREMENT) ++#define IPOPT_CIPSO (6 |IPOPT_CONTROL|IPOPT_COPY) ++#define IPOPT_RR (7 |IPOPT_CONTROL) ++#define IPOPT_SID (8 |IPOPT_CONTROL|IPOPT_COPY) ++#define IPOPT_SSRR (9 |IPOPT_CONTROL|IPOPT_COPY) ++#define IPOPT_RA (20|IPOPT_CONTROL|IPOPT_COPY) ++ ++#define IPVERSION 4 ++#define MAXTTL 255 ++#define IPDEFTTL 64 ++ ++#define IPOPT_OPTVAL 0 ++#define IPOPT_OLEN 1 ++#define IPOPT_OFFSET 2 ++#define IPOPT_MINOFF 4 ++#define MAX_IPOPTLEN 40 ++#define IPOPT_NOP IPOPT_NOOP ++#define IPOPT_EOL IPOPT_END ++#define IPOPT_TS IPOPT_TIMESTAMP ++ ++#define IPOPT_TS_TSONLY 0 /* timestamps only */ ++#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */ ++#define IPOPT_TS_PRESPEC 3 /* specified modules only */ ++ ++#define IPV4_BEET_PHMAXLEN 8 ++ ++struct iphdr { ++#if defined(__LITTLE_ENDIAN_BITFIELD) ++ __u8 ihl:4, ++ version:4; ++#elif defined (__BIG_ENDIAN_BITFIELD) ++ __u8 version:4, ++ ihl:4; ++#else ++#error "Please fix " ++#endif ++ __u8 tos; ++ __be16 tot_len; ++ __be16 id; ++ __be16 frag_off; ++ __u8 ttl; ++ __u8 protocol; ++ __sum16 check; ++ __be32 saddr; ++ __be32 daddr; ++ /*The options start here. */ ++}; ++ ++ ++struct ip_auth_hdr { ++ __u8 nexthdr; ++ __u8 hdrlen; /* This one is measured in 32 bit units! */ ++ __be16 reserved; ++ __be32 spi; ++ __be32 seq_no; /* Sequence number */ ++ __u8 auth_data[0]; /* Variable len but >=4. Mind the 64 bit alignment! */ ++}; ++ ++struct ip_esp_hdr { ++ __be32 spi; ++ __be32 seq_no; /* Sequence number */ ++ __u8 enc_data[0]; /* Variable len but >=8. Mind the 64 bit alignment! */ ++}; ++ ++struct ip_comp_hdr { ++ __u8 nexthdr; ++ __u8 flags; ++ __be16 cpi; ++}; ++ ++struct ip_beet_phdr { ++ __u8 nexthdr; ++ __u8 hdrlen; ++ __u8 padlen; ++ __u8 reserved; ++}; ++ ++/* index values for the variables in ipv4_devconf */ ++enum ++{ ++ IPV4_DEVCONF_FORWARDING=1, ++ IPV4_DEVCONF_MC_FORWARDING, ++ IPV4_DEVCONF_PROXY_ARP, ++ IPV4_DEVCONF_ACCEPT_REDIRECTS, ++ IPV4_DEVCONF_SECURE_REDIRECTS, ++ IPV4_DEVCONF_SEND_REDIRECTS, ++ IPV4_DEVCONF_SHARED_MEDIA, ++ IPV4_DEVCONF_RP_FILTER, ++ IPV4_DEVCONF_ACCEPT_SOURCE_ROUTE, ++ IPV4_DEVCONF_BOOTP_RELAY, ++ IPV4_DEVCONF_LOG_MARTIANS, ++ IPV4_DEVCONF_TAG, ++ IPV4_DEVCONF_ARPFILTER, ++ IPV4_DEVCONF_MEDIUM_ID, ++ IPV4_DEVCONF_NOXFRM, ++ IPV4_DEVCONF_NOPOLICY, ++ IPV4_DEVCONF_FORCE_IGMP_VERSION, ++ IPV4_DEVCONF_ARP_ANNOUNCE, ++ IPV4_DEVCONF_ARP_IGNORE, ++ IPV4_DEVCONF_PROMOTE_SECONDARIES, ++ IPV4_DEVCONF_ARP_ACCEPT, ++ IPV4_DEVCONF_ARP_NOTIFY, ++ IPV4_DEVCONF_ACCEPT_LOCAL, ++ IPV4_DEVCONF_SRC_VMARK, ++ IPV4_DEVCONF_PROXY_ARP_PVLAN, ++ IPV4_DEVCONF_ROUTE_LOCALNET, ++ IPV4_DEVCONF_IGMPV2_UNSOLICITED_REPORT_INTERVAL, ++ IPV4_DEVCONF_IGMPV3_UNSOLICITED_REPORT_INTERVAL, ++ IPV4_DEVCONF_IGNORE_ROUTES_WITH_LINKDOWN, ++ IPV4_DEVCONF_DROP_UNICAST_IN_L2_MULTICAST, ++ IPV4_DEVCONF_DROP_GRATUITOUS_ARP, ++ __IPV4_DEVCONF_MAX ++}; ++ ++#define IPV4_DEVCONF_MAX (__IPV4_DEVCONF_MAX - 1) ++ ++#endif /* _LINUX_IP_H */ +diff --git a/include/uapi/linux/ip6_tunnel.h b/include/uapi/linux/ip6_tunnel.h +new file mode 100644 +index 0000000..425926c +--- /dev/null ++++ b/include/uapi/linux/ip6_tunnel.h +@@ -0,0 +1,53 @@ ++#ifndef _IP6_TUNNEL_H ++#define _IP6_TUNNEL_H ++ ++#include ++#include /* For IFNAMSIZ. */ ++#include /* For struct in6_addr. */ ++ ++#define IPV6_TLV_TNL_ENCAP_LIMIT 4 ++#define IPV6_DEFAULT_TNL_ENCAP_LIMIT 4 ++ ++/* don't add encapsulation limit if one isn't present in inner packet */ ++#define IP6_TNL_F_IGN_ENCAP_LIMIT 0x1 ++/* copy the traffic class field from the inner packet */ ++#define IP6_TNL_F_USE_ORIG_TCLASS 0x2 ++/* copy the flowlabel from the inner packet */ ++#define IP6_TNL_F_USE_ORIG_FLOWLABEL 0x4 ++/* being used for Mobile IPv6 */ ++#define IP6_TNL_F_MIP6_DEV 0x8 ++/* copy DSCP from the outer packet */ ++#define IP6_TNL_F_RCV_DSCP_COPY 0x10 ++/* copy fwmark from inner packet */ ++#define IP6_TNL_F_USE_ORIG_FWMARK 0x20 ++ ++struct ip6_tnl_parm { ++ char name[IFNAMSIZ]; /* name of tunnel device */ ++ int link; /* ifindex of underlying L2 interface */ ++ __u8 proto; /* tunnel protocol */ ++ __u8 encap_limit; /* encapsulation limit for tunnel */ ++ __u8 hop_limit; /* hop limit for tunnel */ ++ __be32 flowinfo; /* traffic class and flowlabel for tunnel */ ++ __u32 flags; /* tunnel flags */ ++ struct in6_addr laddr; /* local tunnel end-point address */ ++ struct in6_addr raddr; /* remote tunnel end-point address */ ++}; ++ ++struct ip6_tnl_parm2 { ++ char name[IFNAMSIZ]; /* name of tunnel device */ ++ int link; /* ifindex of underlying L2 interface */ ++ __u8 proto; /* tunnel protocol */ ++ __u8 encap_limit; /* encapsulation limit for tunnel */ ++ __u8 hop_limit; /* hop limit for tunnel */ ++ __be32 flowinfo; /* traffic class and flowlabel for tunnel */ ++ __u32 flags; /* tunnel flags */ ++ struct in6_addr laddr; /* local tunnel end-point address */ ++ struct in6_addr raddr; /* remote tunnel end-point address */ ++ ++ __be16 i_flags; ++ __be16 o_flags; ++ __be32 i_key; ++ __be32 o_key; ++}; ++ ++#endif +diff --git a/include/uapi/linux/ipsec.h b/include/uapi/linux/ipsec.h +new file mode 100644 +index 0000000..d17a630 +--- /dev/null ++++ b/include/uapi/linux/ipsec.h +@@ -0,0 +1,47 @@ ++#ifndef _LINUX_IPSEC_H ++#define _LINUX_IPSEC_H ++ ++/* The definitions, required to talk to KAME racoon IKE. */ ++ ++#include ++ ++#define IPSEC_PORT_ANY 0 ++#define IPSEC_ULPROTO_ANY 255 ++#define IPSEC_PROTO_ANY 255 ++ ++enum { ++ IPSEC_MODE_ANY = 0, /* We do not support this for SA */ ++ IPSEC_MODE_TRANSPORT = 1, ++ IPSEC_MODE_TUNNEL = 2, ++ IPSEC_MODE_BEET = 3 ++}; ++ ++enum { ++ IPSEC_DIR_ANY = 0, ++ IPSEC_DIR_INBOUND = 1, ++ IPSEC_DIR_OUTBOUND = 2, ++ IPSEC_DIR_FWD = 3, /* It is our own */ ++ IPSEC_DIR_MAX = 4, ++ IPSEC_DIR_INVALID = 5 ++}; ++ ++enum { ++ IPSEC_POLICY_DISCARD = 0, ++ IPSEC_POLICY_NONE = 1, ++ IPSEC_POLICY_IPSEC = 2, ++ IPSEC_POLICY_ENTRUST = 3, ++ IPSEC_POLICY_BYPASS = 4 ++}; ++ ++enum { ++ IPSEC_LEVEL_DEFAULT = 0, ++ IPSEC_LEVEL_USE = 1, ++ IPSEC_LEVEL_REQUIRE = 2, ++ IPSEC_LEVEL_UNIQUE = 3 ++}; ++ ++#define IPSEC_MANUAL_REQID_MAX 0x3fff ++ ++#define IPSEC_REPLAYWSIZE 32 ++ ++#endif /* _LINUX_IPSEC_H */ +diff --git a/include/uapi/linux/kernel.h b/include/uapi/linux/kernel.h +new file mode 100644 +index 0000000..527549f +--- /dev/null ++++ b/include/uapi/linux/kernel.h +@@ -0,0 +1,14 @@ ++#ifndef _LINUX_KERNEL_H ++#define _LINUX_KERNEL_H ++ ++#include ++ ++/* ++ * 'kernel.h' contains some often-used function prototypes etc ++ */ ++#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1) ++#define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask)) ++ ++#define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) ++ ++#endif /* _LINUX_KERNEL_H */ +diff --git a/include/uapi/linux/l2tp.h b/include/uapi/linux/l2tp.h +new file mode 100644 +index 0000000..8a80007 +--- /dev/null ++++ b/include/uapi/linux/l2tp.h +@@ -0,0 +1,199 @@ ++/* ++ * L2TP-over-IP socket for L2TPv3. ++ * ++ * Author: James Chapman ++ */ ++ ++#ifndef _LINUX_L2TP_H_ ++#define _LINUX_L2TP_H_ ++ ++#include ++#include ++#include ++#include ++ ++#define IPPROTO_L2TP 115 ++ ++/** ++ * struct sockaddr_l2tpip - the sockaddr structure for L2TP-over-IP sockets ++ * @l2tp_family: address family number AF_L2TPIP. ++ * @l2tp_addr: protocol specific address information ++ * @l2tp_conn_id: connection id of tunnel ++ */ ++#define __SOCK_SIZE__ 16 /* sizeof(struct sockaddr) */ ++struct sockaddr_l2tpip { ++ /* The first fields must match struct sockaddr_in */ ++ __kernel_sa_family_t l2tp_family; /* AF_INET */ ++ __be16 l2tp_unused; /* INET port number (unused) */ ++ struct in_addr l2tp_addr; /* Internet address */ ++ ++ __u32 l2tp_conn_id; /* Connection ID of tunnel */ ++ ++ /* Pad to size of `struct sockaddr'. */ ++ unsigned char __pad[__SOCK_SIZE__ - ++ sizeof(__kernel_sa_family_t) - ++ sizeof(__be16) - sizeof(struct in_addr) - ++ sizeof(__u32)]; ++}; ++ ++/** ++ * struct sockaddr_l2tpip6 - the sockaddr structure for L2TP-over-IPv6 sockets ++ * @l2tp_family: address family number AF_L2TPIP. ++ * @l2tp_addr: protocol specific address information ++ * @l2tp_conn_id: connection id of tunnel ++ */ ++struct sockaddr_l2tpip6 { ++ /* The first fields must match struct sockaddr_in6 */ ++ __kernel_sa_family_t l2tp_family; /* AF_INET6 */ ++ __be16 l2tp_unused; /* INET port number (unused) */ ++ __be32 l2tp_flowinfo; /* IPv6 flow information */ ++ struct in6_addr l2tp_addr; /* IPv6 address */ ++ __u32 l2tp_scope_id; /* scope id (new in RFC2553) */ ++ __u32 l2tp_conn_id; /* Connection ID of tunnel */ ++}; ++ ++/***************************************************************************** ++ * NETLINK_GENERIC netlink family. ++ *****************************************************************************/ ++ ++/* ++ * Commands. ++ * Valid TLVs of each command are:- ++ * TUNNEL_CREATE - CONN_ID, pw_type, netns, ifname, ipinfo, udpinfo, udpcsum, vlanid ++ * TUNNEL_DELETE - CONN_ID ++ * TUNNEL_MODIFY - CONN_ID, udpcsum ++ * TUNNEL_GETSTATS - CONN_ID, (stats) ++ * TUNNEL_GET - CONN_ID, (...) ++ * SESSION_CREATE - SESSION_ID, PW_TYPE, offset, data_seq, cookie, peer_cookie, offset, l2spec ++ * SESSION_DELETE - SESSION_ID ++ * SESSION_MODIFY - SESSION_ID, data_seq ++ * SESSION_GET - SESSION_ID, (...) ++ * SESSION_GETSTATS - SESSION_ID, (stats) ++ * ++ */ ++enum { ++ L2TP_CMD_NOOP, ++ L2TP_CMD_TUNNEL_CREATE, ++ L2TP_CMD_TUNNEL_DELETE, ++ L2TP_CMD_TUNNEL_MODIFY, ++ L2TP_CMD_TUNNEL_GET, ++ L2TP_CMD_SESSION_CREATE, ++ L2TP_CMD_SESSION_DELETE, ++ L2TP_CMD_SESSION_MODIFY, ++ L2TP_CMD_SESSION_GET, ++ __L2TP_CMD_MAX, ++}; ++ ++#define L2TP_CMD_MAX (__L2TP_CMD_MAX - 1) ++ ++/* ++ * ATTR types defined for L2TP ++ */ ++enum { ++ L2TP_ATTR_NONE, /* no data */ ++ L2TP_ATTR_PW_TYPE, /* u16, enum l2tp_pwtype */ ++ L2TP_ATTR_ENCAP_TYPE, /* u16, enum l2tp_encap_type */ ++ L2TP_ATTR_OFFSET, /* u16 */ ++ L2TP_ATTR_DATA_SEQ, /* u16 */ ++ L2TP_ATTR_L2SPEC_TYPE, /* u8, enum l2tp_l2spec_type */ ++ L2TP_ATTR_L2SPEC_LEN, /* u8, enum l2tp_l2spec_type */ ++ L2TP_ATTR_PROTO_VERSION, /* u8 */ ++ L2TP_ATTR_IFNAME, /* string */ ++ L2TP_ATTR_CONN_ID, /* u32 */ ++ L2TP_ATTR_PEER_CONN_ID, /* u32 */ ++ L2TP_ATTR_SESSION_ID, /* u32 */ ++ L2TP_ATTR_PEER_SESSION_ID, /* u32 */ ++ L2TP_ATTR_UDP_CSUM, /* u8 */ ++ L2TP_ATTR_VLAN_ID, /* u16 */ ++ L2TP_ATTR_COOKIE, /* 0, 4 or 8 bytes */ ++ L2TP_ATTR_PEER_COOKIE, /* 0, 4 or 8 bytes */ ++ L2TP_ATTR_DEBUG, /* u32, enum l2tp_debug_flags */ ++ L2TP_ATTR_RECV_SEQ, /* u8 */ ++ L2TP_ATTR_SEND_SEQ, /* u8 */ ++ L2TP_ATTR_LNS_MODE, /* u8 */ ++ L2TP_ATTR_USING_IPSEC, /* u8 */ ++ L2TP_ATTR_RECV_TIMEOUT, /* msec */ ++ L2TP_ATTR_FD, /* int */ ++ L2TP_ATTR_IP_SADDR, /* u32 */ ++ L2TP_ATTR_IP_DADDR, /* u32 */ ++ L2TP_ATTR_UDP_SPORT, /* u16 */ ++ L2TP_ATTR_UDP_DPORT, /* u16 */ ++ L2TP_ATTR_MTU, /* u16 */ ++ L2TP_ATTR_MRU, /* u16 */ ++ L2TP_ATTR_STATS, /* nested */ ++ L2TP_ATTR_IP6_SADDR, /* struct in6_addr */ ++ L2TP_ATTR_IP6_DADDR, /* struct in6_addr */ ++ L2TP_ATTR_UDP_ZERO_CSUM6_TX, /* flag */ ++ L2TP_ATTR_UDP_ZERO_CSUM6_RX, /* flag */ ++ L2TP_ATTR_PAD, ++ __L2TP_ATTR_MAX, ++}; ++ ++#define L2TP_ATTR_MAX (__L2TP_ATTR_MAX - 1) ++ ++/* Nested in L2TP_ATTR_STATS */ ++enum { ++ L2TP_ATTR_STATS_NONE, /* no data */ ++ L2TP_ATTR_TX_PACKETS, /* u64 */ ++ L2TP_ATTR_TX_BYTES, /* u64 */ ++ L2TP_ATTR_TX_ERRORS, /* u64 */ ++ L2TP_ATTR_RX_PACKETS, /* u64 */ ++ L2TP_ATTR_RX_BYTES, /* u64 */ ++ L2TP_ATTR_RX_SEQ_DISCARDS, /* u64 */ ++ L2TP_ATTR_RX_OOS_PACKETS, /* u64 */ ++ L2TP_ATTR_RX_ERRORS, /* u64 */ ++ L2TP_ATTR_STATS_PAD, ++ __L2TP_ATTR_STATS_MAX, ++}; ++ ++#define L2TP_ATTR_STATS_MAX (__L2TP_ATTR_STATS_MAX - 1) ++ ++enum l2tp_pwtype { ++ L2TP_PWTYPE_NONE = 0x0000, ++ L2TP_PWTYPE_ETH_VLAN = 0x0004, ++ L2TP_PWTYPE_ETH = 0x0005, ++ L2TP_PWTYPE_PPP = 0x0007, ++ L2TP_PWTYPE_PPP_AC = 0x0008, ++ L2TP_PWTYPE_IP = 0x000b, ++ __L2TP_PWTYPE_MAX ++}; ++ ++enum l2tp_l2spec_type { ++ L2TP_L2SPECTYPE_NONE, ++ L2TP_L2SPECTYPE_DEFAULT, ++}; ++ ++enum l2tp_encap_type { ++ L2TP_ENCAPTYPE_UDP, ++ L2TP_ENCAPTYPE_IP, ++}; ++ ++enum l2tp_seqmode { ++ L2TP_SEQ_NONE = 0, ++ L2TP_SEQ_IP = 1, ++ L2TP_SEQ_ALL = 2, ++}; ++ ++/** ++ * enum l2tp_debug_flags - debug message categories for L2TP tunnels/sessions ++ * ++ * @L2TP_MSG_DEBUG: verbose debug (if compiled in) ++ * @L2TP_MSG_CONTROL: userspace - kernel interface ++ * @L2TP_MSG_SEQ: sequence numbers ++ * @L2TP_MSG_DATA: data packets ++ */ ++enum l2tp_debug_flags { ++ L2TP_MSG_DEBUG = (1 << 0), ++ L2TP_MSG_CONTROL = (1 << 1), ++ L2TP_MSG_SEQ = (1 << 2), ++ L2TP_MSG_DATA = (1 << 3), ++}; ++ ++/* ++ * NETLINK_GENERIC related info ++ */ ++#define L2TP_GENL_NAME "l2tp" ++#define L2TP_GENL_VERSION 0x1 ++#define L2TP_GENL_MCGROUP "l2tp" ++ ++#endif /* _LINUX_L2TP_H_ */ +diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h +new file mode 100644 +index 0000000..f38571d +--- /dev/null ++++ b/include/uapi/linux/libc-compat.h +@@ -0,0 +1,213 @@ ++/* ++ * Compatibility interface for userspace libc header coordination: ++ * ++ * Define compatibility macros that are used to control the inclusion or ++ * exclusion of UAPI structures and definitions in coordination with another ++ * userspace C library. ++ * ++ * This header is intended to solve the problem of UAPI definitions that ++ * conflict with userspace definitions. If a UAPI header has such conflicting ++ * definitions then the solution is as follows: ++ * ++ * * Synchronize the UAPI header and the libc headers so either one can be ++ * used and such that the ABI is preserved. If this is not possible then ++ * no simple compatibility interface exists (you need to write translating ++ * wrappers and rename things) and you can't use this interface. ++ * ++ * Then follow this process: ++ * ++ * (a) Include libc-compat.h in the UAPI header. ++ * e.g. #include ++ * This include must be as early as possible. ++ * ++ * (b) In libc-compat.h add enough code to detect that the comflicting ++ * userspace libc header has been included first. ++ * ++ * (c) If the userspace libc header has been included first define a set of ++ * guard macros of the form __UAPI_DEF_FOO and set their values to 1, else ++ * set their values to 0. ++ * ++ * (d) Back in the UAPI header with the conflicting definitions, guard the ++ * definitions with: ++ * #if __UAPI_DEF_FOO ++ * ... ++ * #endif ++ * ++ * This fixes the situation where the linux headers are included *after* the ++ * libc headers. To fix the problem with the inclusion in the other order the ++ * userspace libc headers must be fixed like this: ++ * ++ * * For all definitions that conflict with kernel definitions wrap those ++ * defines in the following: ++ * #if !__UAPI_DEF_FOO ++ * ... ++ * #endif ++ * ++ * This prevents the redefinition of a construct already defined by the kernel. ++ */ ++#ifndef _LIBC_COMPAT_H ++#define _LIBC_COMPAT_H ++ ++/* We have included glibc headers... */ ++#if defined(__GLIBC__) ++ ++/* Coordinate with glibc net/if.h header. */ ++#if defined(_NET_IF_H) && defined(__USE_MISC) ++ ++/* GLIBC headers included first so don't define anything ++ * that would already be defined. */ ++ ++#define __UAPI_DEF_IF_IFCONF 0 ++#define __UAPI_DEF_IF_IFMAP 0 ++#define __UAPI_DEF_IF_IFNAMSIZ 0 ++#define __UAPI_DEF_IF_IFREQ 0 ++/* Everything up to IFF_DYNAMIC, matches net/if.h until glibc 2.23 */ ++#define __UAPI_DEF_IF_NET_DEVICE_FLAGS 0 ++/* For the future if glibc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */ ++#ifndef __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO ++#define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 1 ++#endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */ ++ ++#else /* _NET_IF_H */ ++ ++/* Linux headers included first, and we must define everything ++ * we need. The expectation is that glibc will check the ++ * __UAPI_DEF_* defines and adjust appropriately. */ ++ ++#define __UAPI_DEF_IF_IFCONF 1 ++#define __UAPI_DEF_IF_IFMAP 1 ++#define __UAPI_DEF_IF_IFNAMSIZ 1 ++#define __UAPI_DEF_IF_IFREQ 1 ++/* Everything up to IFF_DYNAMIC, matches net/if.h until glibc 2.23 */ ++#define __UAPI_DEF_IF_NET_DEVICE_FLAGS 1 ++/* For the future if glibc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */ ++#define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 1 ++ ++#endif /* _NET_IF_H */ ++ ++/* Coordinate with glibc netinet/in.h header. */ ++#if defined(_NETINET_IN_H) ++ ++/* GLIBC headers included first so don't define anything ++ * that would already be defined. */ ++#define __UAPI_DEF_IN_ADDR 0 ++#define __UAPI_DEF_IN_IPPROTO 0 ++#define __UAPI_DEF_IN_PKTINFO 0 ++#define __UAPI_DEF_IP_MREQ 0 ++#define __UAPI_DEF_SOCKADDR_IN 0 ++#define __UAPI_DEF_IN_CLASS 0 ++ ++#define __UAPI_DEF_IN6_ADDR 0 ++/* The exception is the in6_addr macros which must be defined ++ * if the glibc code didn't define them. This guard matches ++ * the guard in glibc/inet/netinet/in.h which defines the ++ * additional in6_addr macros e.g. s6_addr16, and s6_addr32. */ ++#if defined(__USE_MISC) || defined (__USE_GNU) ++#define __UAPI_DEF_IN6_ADDR_ALT 0 ++#else ++#define __UAPI_DEF_IN6_ADDR_ALT 1 ++#endif ++#define __UAPI_DEF_SOCKADDR_IN6 0 ++#define __UAPI_DEF_IPV6_MREQ 0 ++#define __UAPI_DEF_IPPROTO_V6 0 ++#define __UAPI_DEF_IPV6_OPTIONS 0 ++#define __UAPI_DEF_IN6_PKTINFO 0 ++#define __UAPI_DEF_IP6_MTUINFO 0 ++ ++#else ++ ++/* Linux headers included first, and we must define everything ++ * we need. The expectation is that glibc will check the ++ * __UAPI_DEF_* defines and adjust appropriately. */ ++#define __UAPI_DEF_IN_ADDR 1 ++#define __UAPI_DEF_IN_IPPROTO 1 ++#define __UAPI_DEF_IN_PKTINFO 1 ++#define __UAPI_DEF_IP_MREQ 1 ++#define __UAPI_DEF_SOCKADDR_IN 1 ++#define __UAPI_DEF_IN_CLASS 1 ++ ++#define __UAPI_DEF_IN6_ADDR 1 ++/* We unconditionally define the in6_addr macros and glibc must ++ * coordinate. */ ++#define __UAPI_DEF_IN6_ADDR_ALT 1 ++#define __UAPI_DEF_SOCKADDR_IN6 1 ++#define __UAPI_DEF_IPV6_MREQ 1 ++#define __UAPI_DEF_IPPROTO_V6 1 ++#define __UAPI_DEF_IPV6_OPTIONS 1 ++#define __UAPI_DEF_IN6_PKTINFO 1 ++#define __UAPI_DEF_IP6_MTUINFO 1 ++ ++#endif /* _NETINET_IN_H */ ++ ++/* Coordinate with glibc netipx/ipx.h header. */ ++#if defined(__NETIPX_IPX_H) ++ ++#define __UAPI_DEF_SOCKADDR_IPX 0 ++#define __UAPI_DEF_IPX_ROUTE_DEFINITION 0 ++#define __UAPI_DEF_IPX_INTERFACE_DEFINITION 0 ++#define __UAPI_DEF_IPX_CONFIG_DATA 0 ++#define __UAPI_DEF_IPX_ROUTE_DEF 0 ++ ++#else /* defined(__NETIPX_IPX_H) */ ++ ++#define __UAPI_DEF_SOCKADDR_IPX 1 ++#define __UAPI_DEF_IPX_ROUTE_DEFINITION 1 ++#define __UAPI_DEF_IPX_INTERFACE_DEFINITION 1 ++#define __UAPI_DEF_IPX_CONFIG_DATA 1 ++#define __UAPI_DEF_IPX_ROUTE_DEF 1 ++ ++#endif /* defined(__NETIPX_IPX_H) */ ++ ++/* Definitions for xattr.h */ ++#if defined(_SYS_XATTR_H) ++#define __UAPI_DEF_XATTR 0 ++#else ++#define __UAPI_DEF_XATTR 1 ++#endif ++ ++/* If we did not see any headers from any supported C libraries, ++ * or we are being included in the kernel, then define everything ++ * that we need. */ ++#else /* !defined(__GLIBC__) */ ++ ++/* Definitions for if.h */ ++#define __UAPI_DEF_IF_IFCONF 1 ++#define __UAPI_DEF_IF_IFMAP 1 ++#define __UAPI_DEF_IF_IFNAMSIZ 1 ++#define __UAPI_DEF_IF_IFREQ 1 ++/* Everything up to IFF_DYNAMIC, matches net/if.h until glibc 2.23 */ ++#define __UAPI_DEF_IF_NET_DEVICE_FLAGS 1 ++/* For the future if glibc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */ ++#define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 1 ++ ++/* Definitions for in.h */ ++#define __UAPI_DEF_IN_ADDR 1 ++#define __UAPI_DEF_IN_IPPROTO 1 ++#define __UAPI_DEF_IN_PKTINFO 1 ++#define __UAPI_DEF_IP_MREQ 1 ++#define __UAPI_DEF_SOCKADDR_IN 1 ++#define __UAPI_DEF_IN_CLASS 1 ++ ++/* Definitions for in6.h */ ++#define __UAPI_DEF_IN6_ADDR 1 ++#define __UAPI_DEF_IN6_ADDR_ALT 1 ++#define __UAPI_DEF_SOCKADDR_IN6 1 ++#define __UAPI_DEF_IPV6_MREQ 1 ++#define __UAPI_DEF_IPPROTO_V6 1 ++#define __UAPI_DEF_IPV6_OPTIONS 1 ++#define __UAPI_DEF_IN6_PKTINFO 1 ++#define __UAPI_DEF_IP6_MTUINFO 1 ++ ++/* Definitions for ipx.h */ ++#define __UAPI_DEF_SOCKADDR_IPX 1 ++#define __UAPI_DEF_IPX_ROUTE_DEFINITION 1 ++#define __UAPI_DEF_IPX_INTERFACE_DEFINITION 1 ++#define __UAPI_DEF_IPX_CONFIG_DATA 1 ++#define __UAPI_DEF_IPX_ROUTE_DEF 1 ++ ++/* Definitions for xattr.h */ ++#define __UAPI_DEF_XATTR 1 ++ ++#endif /* __GLIBC__ */ ++ ++#endif /* _LIBC_COMPAT_H */ +diff --git a/include/uapi/linux/limits.h b/include/uapi/linux/limits.h +new file mode 100644 +index 0000000..2d0f941 +--- /dev/null ++++ b/include/uapi/linux/limits.h +@@ -0,0 +1,20 @@ ++#ifndef _LINUX_LIMITS_H ++#define _LINUX_LIMITS_H ++ ++#define NR_OPEN 1024 ++ ++#define NGROUPS_MAX 65536 /* supplemental group IDs are available */ ++#define ARG_MAX 131072 /* # bytes of args + environ for exec() */ ++#define LINK_MAX 127 /* # links a file may have */ ++#define MAX_CANON 255 /* size of the canonical input queue */ ++#define MAX_INPUT 255 /* size of the type-ahead buffer */ ++#define NAME_MAX 255 /* # chars in a file name */ ++#define PATH_MAX 4096 /* # chars in a path name including nul */ ++#define PIPE_BUF 4096 /* # bytes in atomic write to a pipe */ ++#define XATTR_NAME_MAX 255 /* # chars in an extended attribute name */ ++#define XATTR_SIZE_MAX 65536 /* size of an extended attribute value (64k) */ ++#define XATTR_LIST_MAX 65536 /* size of extended attribute namelist (64k) */ ++ ++#define RTSIG_MAX 32 ++ ++#endif +diff --git a/include/uapi/linux/lwtunnel.h b/include/uapi/linux/lwtunnel.h +new file mode 100644 +index 0000000..3298426 +--- /dev/null ++++ b/include/uapi/linux/lwtunnel.h +@@ -0,0 +1,70 @@ ++#ifndef _LWTUNNEL_H_ ++#define _LWTUNNEL_H_ ++ ++#include ++ ++enum lwtunnel_encap_types { ++ LWTUNNEL_ENCAP_NONE, ++ LWTUNNEL_ENCAP_MPLS, ++ LWTUNNEL_ENCAP_IP, ++ LWTUNNEL_ENCAP_ILA, ++ LWTUNNEL_ENCAP_IP6, ++ LWTUNNEL_ENCAP_SEG6, ++ LWTUNNEL_ENCAP_BPF, ++ LWTUNNEL_ENCAP_SEG6_LOCAL, ++ __LWTUNNEL_ENCAP_MAX, ++}; ++ ++#define LWTUNNEL_ENCAP_MAX (__LWTUNNEL_ENCAP_MAX - 1) ++ ++enum lwtunnel_ip_t { ++ LWTUNNEL_IP_UNSPEC, ++ LWTUNNEL_IP_ID, ++ LWTUNNEL_IP_DST, ++ LWTUNNEL_IP_SRC, ++ LWTUNNEL_IP_TTL, ++ LWTUNNEL_IP_TOS, ++ LWTUNNEL_IP_FLAGS, ++ LWTUNNEL_IP_PAD, ++ __LWTUNNEL_IP_MAX, ++}; ++ ++#define LWTUNNEL_IP_MAX (__LWTUNNEL_IP_MAX - 1) ++ ++enum lwtunnel_ip6_t { ++ LWTUNNEL_IP6_UNSPEC, ++ LWTUNNEL_IP6_ID, ++ LWTUNNEL_IP6_DST, ++ LWTUNNEL_IP6_SRC, ++ LWTUNNEL_IP6_HOPLIMIT, ++ LWTUNNEL_IP6_TC, ++ LWTUNNEL_IP6_FLAGS, ++ LWTUNNEL_IP6_PAD, ++ __LWTUNNEL_IP6_MAX, ++}; ++ ++#define LWTUNNEL_IP6_MAX (__LWTUNNEL_IP6_MAX - 1) ++ ++enum { ++ LWT_BPF_PROG_UNSPEC, ++ LWT_BPF_PROG_FD, ++ LWT_BPF_PROG_NAME, ++ __LWT_BPF_PROG_MAX, ++}; ++ ++#define LWT_BPF_PROG_MAX (__LWT_BPF_PROG_MAX - 1) ++ ++enum { ++ LWT_BPF_UNSPEC, ++ LWT_BPF_IN, ++ LWT_BPF_OUT, ++ LWT_BPF_XMIT, ++ LWT_BPF_XMIT_HEADROOM, ++ __LWT_BPF_MAX, ++}; ++ ++#define LWT_BPF_MAX (__LWT_BPF_MAX - 1) ++ ++#define LWT_BPF_MAX_HEADROOM 256 ++ ++#endif /* _LWTUNNEL_H_ */ +diff --git a/include/uapi/linux/magic.h b/include/uapi/linux/magic.h +new file mode 100644 +index 0000000..e439565 +--- /dev/null ++++ b/include/uapi/linux/magic.h +@@ -0,0 +1,91 @@ ++#ifndef __LINUX_MAGIC_H__ ++#define __LINUX_MAGIC_H__ ++ ++#define ADFS_SUPER_MAGIC 0xadf5 ++#define AFFS_SUPER_MAGIC 0xadff ++#define AFS_SUPER_MAGIC 0x5346414F ++#define AUTOFS_SUPER_MAGIC 0x0187 ++#define CODA_SUPER_MAGIC 0x73757245 ++#define CRAMFS_MAGIC 0x28cd3d45 /* some random number */ ++#define CRAMFS_MAGIC_WEND 0x453dcd28 /* magic number with the wrong endianess */ ++#define DEBUGFS_MAGIC 0x64626720 ++#define SECURITYFS_MAGIC 0x73636673 ++#define SELINUX_MAGIC 0xf97cff8c ++#define SMACK_MAGIC 0x43415d53 /* "SMAC" */ ++#define RAMFS_MAGIC 0x858458f6 /* some random number */ ++#define TMPFS_MAGIC 0x01021994 ++#define HUGETLBFS_MAGIC 0x958458f6 /* some random number */ ++#define SQUASHFS_MAGIC 0x73717368 ++#define ECRYPTFS_SUPER_MAGIC 0xf15f ++#define EFS_SUPER_MAGIC 0x414A53 ++#define EXT2_SUPER_MAGIC 0xEF53 ++#define EXT3_SUPER_MAGIC 0xEF53 ++#define XENFS_SUPER_MAGIC 0xabba1974 ++#define EXT4_SUPER_MAGIC 0xEF53 ++#define BTRFS_SUPER_MAGIC 0x9123683E ++#define NILFS_SUPER_MAGIC 0x3434 ++#define F2FS_SUPER_MAGIC 0xF2F52010 ++#define HPFS_SUPER_MAGIC 0xf995e849 ++#define ISOFS_SUPER_MAGIC 0x9660 ++#define JFFS2_SUPER_MAGIC 0x72b6 ++#define PSTOREFS_MAGIC 0x6165676C ++#define EFIVARFS_MAGIC 0xde5e81e4 ++#define HOSTFS_SUPER_MAGIC 0x00c0ffee ++#define OVERLAYFS_SUPER_MAGIC 0x794c7630 ++ ++#define MINIX_SUPER_MAGIC 0x137F /* minix v1 fs, 14 char names */ ++#define MINIX_SUPER_MAGIC2 0x138F /* minix v1 fs, 30 char names */ ++#define MINIX2_SUPER_MAGIC 0x2468 /* minix v2 fs, 14 char names */ ++#define MINIX2_SUPER_MAGIC2 0x2478 /* minix v2 fs, 30 char names */ ++#define MINIX3_SUPER_MAGIC 0x4d5a /* minix v3 fs, 60 char names */ ++ ++#define MSDOS_SUPER_MAGIC 0x4d44 /* MD */ ++#define NCP_SUPER_MAGIC 0x564c /* Guess, what 0x564c is :-) */ ++#define NFS_SUPER_MAGIC 0x6969 ++#define OCFS2_SUPER_MAGIC 0x7461636f ++#define OPENPROM_SUPER_MAGIC 0x9fa1 ++#define QNX4_SUPER_MAGIC 0x002f /* qnx4 fs detection */ ++#define QNX6_SUPER_MAGIC 0x68191122 /* qnx6 fs detection */ ++ ++#define REISERFS_SUPER_MAGIC 0x52654973 /* used by gcc */ ++ /* used by file system utilities that ++ look at the superblock, etc. */ ++#define REISERFS_SUPER_MAGIC_STRING "ReIsErFs" ++#define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs" ++#define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs" ++ ++#define SMB_SUPER_MAGIC 0x517B ++#define CGROUP_SUPER_MAGIC 0x27e0eb ++#define CGROUP2_SUPER_MAGIC 0x63677270 ++ ++#define RDTGROUP_SUPER_MAGIC 0x7655821 ++ ++#define STACK_END_MAGIC 0x57AC6E9D ++ ++#define TRACEFS_MAGIC 0x74726163 ++ ++#define V9FS_MAGIC 0x01021997 ++ ++#define BDEVFS_MAGIC 0x62646576 ++#define DAXFS_MAGIC 0x64646178 ++#define BINFMTFS_MAGIC 0x42494e4d ++#define DEVPTS_SUPER_MAGIC 0x1cd1 ++#define FUTEXFS_SUPER_MAGIC 0xBAD1DEA ++#define PIPEFS_MAGIC 0x50495045 ++#define PROC_SUPER_MAGIC 0x9fa0 ++#define SOCKFS_MAGIC 0x534F434B ++#define SYSFS_MAGIC 0x62656572 ++#define USBDEVICE_SUPER_MAGIC 0x9fa2 ++#define MTD_INODE_FS_MAGIC 0x11307854 ++#define ANON_INODE_FS_MAGIC 0x09041934 ++#define BTRFS_TEST_MAGIC 0x73727279 ++#define NSFS_MAGIC 0x6e736673 ++#define BPF_FS_MAGIC 0xcafe4a11 ++#define AAFS_MAGIC 0x5a3c69f0 ++ ++/* Since UDF 2.01 is ISO 13346 based... */ ++#define UDF_SUPER_MAGIC 0x15013346 ++#define BALLOON_KVM_MAGIC 0x13661366 ++#define ZSMALLOC_MAGIC 0x58295829 ++ ++#endif /* __LINUX_MAGIC_H__ */ +diff --git a/include/uapi/linux/mpls.h b/include/uapi/linux/mpls.h +new file mode 100644 +index 0000000..bf5b625 +--- /dev/null ++++ b/include/uapi/linux/mpls.h +@@ -0,0 +1,76 @@ ++#ifndef _MPLS_H ++#define _MPLS_H ++ ++#include ++#include ++ ++/* Reference: RFC 5462, RFC 3032 ++ * ++ * 0 1 2 3 ++ * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 ++ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ++ * | Label | TC |S| TTL | ++ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ++ * ++ * Label: Label Value, 20 bits ++ * TC: Traffic Class field, 3 bits ++ * S: Bottom of Stack, 1 bit ++ * TTL: Time to Live, 8 bits ++ */ ++ ++struct mpls_label { ++ __be32 entry; ++}; ++ ++#define MPLS_LS_LABEL_MASK 0xFFFFF000 ++#define MPLS_LS_LABEL_SHIFT 12 ++#define MPLS_LS_TC_MASK 0x00000E00 ++#define MPLS_LS_TC_SHIFT 9 ++#define MPLS_LS_S_MASK 0x00000100 ++#define MPLS_LS_S_SHIFT 8 ++#define MPLS_LS_TTL_MASK 0x000000FF ++#define MPLS_LS_TTL_SHIFT 0 ++ ++/* Reserved labels */ ++#define MPLS_LABEL_IPV4NULL 0 /* RFC3032 */ ++#define MPLS_LABEL_RTALERT 1 /* RFC3032 */ ++#define MPLS_LABEL_IPV6NULL 2 /* RFC3032 */ ++#define MPLS_LABEL_IMPLNULL 3 /* RFC3032 */ ++#define MPLS_LABEL_ENTROPY 7 /* RFC6790 */ ++#define MPLS_LABEL_GAL 13 /* RFC5586 */ ++#define MPLS_LABEL_OAMALERT 14 /* RFC3429 */ ++#define MPLS_LABEL_EXTENSION 15 /* RFC7274 */ ++ ++#define MPLS_LABEL_FIRST_UNRESERVED 16 /* RFC3032 */ ++ ++/* These are embedded into IFLA_STATS_AF_SPEC: ++ * [IFLA_STATS_AF_SPEC] ++ * -> [AF_MPLS] ++ * -> [MPLS_STATS_xxx] ++ * ++ * Attributes: ++ * [MPLS_STATS_LINK] = { ++ * struct mpls_link_stats ++ * } ++ */ ++enum { ++ MPLS_STATS_UNSPEC, /* also used as 64bit pad attribute */ ++ MPLS_STATS_LINK, ++ __MPLS_STATS_MAX, ++}; ++ ++#define MPLS_STATS_MAX (__MPLS_STATS_MAX - 1) ++ ++struct mpls_link_stats { ++ __u64 rx_packets; /* total packets received */ ++ __u64 tx_packets; /* total packets transmitted */ ++ __u64 rx_bytes; /* total bytes received */ ++ __u64 tx_bytes; /* total bytes transmitted */ ++ __u64 rx_errors; /* bad packets received */ ++ __u64 tx_errors; /* packet transmit problems */ ++ __u64 rx_dropped; /* packet dropped on receive */ ++ __u64 tx_dropped; /* packet dropped on transmit */ ++ __u64 rx_noroute; /* no route for packet dest */ ++}; ++ ++#endif /* _MPLS_H */ +diff --git a/include/uapi/linux/mpls_iptunnel.h b/include/uapi/linux/mpls_iptunnel.h +new file mode 100644 +index 0000000..1a0e57b +--- /dev/null ++++ b/include/uapi/linux/mpls_iptunnel.h +@@ -0,0 +1,30 @@ ++/* ++ * mpls tunnel api ++ * ++ * Authors: ++ * Roopa Prabhu ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version ++ * 2 of the License, or (at your option) any later version. ++ */ ++ ++#ifndef _LINUX_MPLS_IPTUNNEL_H ++#define _LINUX_MPLS_IPTUNNEL_H ++ ++/* MPLS tunnel attributes ++ * [RTA_ENCAP] = { ++ * [MPLS_IPTUNNEL_DST] ++ * [MPLS_IPTUNNEL_TTL] ++ * } ++ */ ++enum { ++ MPLS_IPTUNNEL_UNSPEC, ++ MPLS_IPTUNNEL_DST, ++ MPLS_IPTUNNEL_TTL, ++ __MPLS_IPTUNNEL_MAX, ++}; ++#define MPLS_IPTUNNEL_MAX (__MPLS_IPTUNNEL_MAX - 1) ++ ++#endif /* _LINUX_MPLS_IPTUNNEL_H */ +diff --git a/include/uapi/linux/neighbour.h b/include/uapi/linux/neighbour.h +new file mode 100644 +index 0000000..3199d28 +--- /dev/null ++++ b/include/uapi/linux/neighbour.h +@@ -0,0 +1,171 @@ ++#ifndef __LINUX_NEIGHBOUR_H ++#define __LINUX_NEIGHBOUR_H ++ ++#include ++#include ++ ++struct ndmsg { ++ __u8 ndm_family; ++ __u8 ndm_pad1; ++ __u16 ndm_pad2; ++ __s32 ndm_ifindex; ++ __u16 ndm_state; ++ __u8 ndm_flags; ++ __u8 ndm_type; ++}; ++ ++enum { ++ NDA_UNSPEC, ++ NDA_DST, ++ NDA_LLADDR, ++ NDA_CACHEINFO, ++ NDA_PROBES, ++ NDA_VLAN, ++ NDA_PORT, ++ NDA_VNI, ++ NDA_IFINDEX, ++ NDA_MASTER, ++ NDA_LINK_NETNSID, ++ NDA_SRC_VNI, ++ __NDA_MAX ++}; ++ ++#define NDA_MAX (__NDA_MAX - 1) ++ ++/* ++ * Neighbor Cache Entry Flags ++ */ ++ ++#define NTF_USE 0x01 ++#define NTF_SELF 0x02 ++#define NTF_MASTER 0x04 ++#define NTF_PROXY 0x08 /* == ATF_PUBL */ ++#define NTF_EXT_LEARNED 0x10 ++#define NTF_OFFLOADED 0x20 ++#define NTF_ROUTER 0x80 ++ ++/* ++ * Neighbor Cache Entry States. ++ */ ++ ++#define NUD_INCOMPLETE 0x01 ++#define NUD_REACHABLE 0x02 ++#define NUD_STALE 0x04 ++#define NUD_DELAY 0x08 ++#define NUD_PROBE 0x10 ++#define NUD_FAILED 0x20 ++ ++/* Dummy states */ ++#define NUD_NOARP 0x40 ++#define NUD_PERMANENT 0x80 ++#define NUD_NONE 0x00 ++ ++/* NUD_NOARP & NUD_PERMANENT are pseudostates, they never change ++ and make no address resolution or NUD. ++ NUD_PERMANENT also cannot be deleted by garbage collectors. ++ */ ++ ++struct nda_cacheinfo { ++ __u32 ndm_confirmed; ++ __u32 ndm_used; ++ __u32 ndm_updated; ++ __u32 ndm_refcnt; ++}; ++ ++/***************************************************************** ++ * Neighbour tables specific messages. ++ * ++ * To retrieve the neighbour tables send RTM_GETNEIGHTBL with the ++ * NLM_F_DUMP flag set. Every neighbour table configuration is ++ * spread over multiple messages to avoid running into message ++ * size limits on systems with many interfaces. The first message ++ * in the sequence transports all not device specific data such as ++ * statistics, configuration, and the default parameter set. ++ * This message is followed by 0..n messages carrying device ++ * specific parameter sets. ++ * Although the ordering should be sufficient, NDTA_NAME can be ++ * used to identify sequences. The initial message can be identified ++ * by checking for NDTA_CONFIG. The device specific messages do ++ * not contain this TLV but have NDTPA_IFINDEX set to the ++ * corresponding interface index. ++ * ++ * To change neighbour table attributes, send RTM_SETNEIGHTBL ++ * with NDTA_NAME set. Changeable attribute include NDTA_THRESH[1-3], ++ * NDTA_GC_INTERVAL, and all TLVs in NDTA_PARMS unless marked ++ * otherwise. Device specific parameter sets can be changed by ++ * setting NDTPA_IFINDEX to the interface index of the corresponding ++ * device. ++ ****/ ++ ++struct ndt_stats { ++ __u64 ndts_allocs; ++ __u64 ndts_destroys; ++ __u64 ndts_hash_grows; ++ __u64 ndts_res_failed; ++ __u64 ndts_lookups; ++ __u64 ndts_hits; ++ __u64 ndts_rcv_probes_mcast; ++ __u64 ndts_rcv_probes_ucast; ++ __u64 ndts_periodic_gc_runs; ++ __u64 ndts_forced_gc_runs; ++ __u64 ndts_table_fulls; ++}; ++ ++enum { ++ NDTPA_UNSPEC, ++ NDTPA_IFINDEX, /* u32, unchangeable */ ++ NDTPA_REFCNT, /* u32, read-only */ ++ NDTPA_REACHABLE_TIME, /* u64, read-only, msecs */ ++ NDTPA_BASE_REACHABLE_TIME, /* u64, msecs */ ++ NDTPA_RETRANS_TIME, /* u64, msecs */ ++ NDTPA_GC_STALETIME, /* u64, msecs */ ++ NDTPA_DELAY_PROBE_TIME, /* u64, msecs */ ++ NDTPA_QUEUE_LEN, /* u32 */ ++ NDTPA_APP_PROBES, /* u32 */ ++ NDTPA_UCAST_PROBES, /* u32 */ ++ NDTPA_MCAST_PROBES, /* u32 */ ++ NDTPA_ANYCAST_DELAY, /* u64, msecs */ ++ NDTPA_PROXY_DELAY, /* u64, msecs */ ++ NDTPA_PROXY_QLEN, /* u32 */ ++ NDTPA_LOCKTIME, /* u64, msecs */ ++ NDTPA_QUEUE_LENBYTES, /* u32 */ ++ NDTPA_MCAST_REPROBES, /* u32 */ ++ NDTPA_PAD, ++ __NDTPA_MAX ++}; ++#define NDTPA_MAX (__NDTPA_MAX - 1) ++ ++struct ndtmsg { ++ __u8 ndtm_family; ++ __u8 ndtm_pad1; ++ __u16 ndtm_pad2; ++}; ++ ++struct ndt_config { ++ __u16 ndtc_key_len; ++ __u16 ndtc_entry_size; ++ __u32 ndtc_entries; ++ __u32 ndtc_last_flush; /* delta to now in msecs */ ++ __u32 ndtc_last_rand; /* delta to now in msecs */ ++ __u32 ndtc_hash_rnd; ++ __u32 ndtc_hash_mask; ++ __u32 ndtc_hash_chain_gc; ++ __u32 ndtc_proxy_qlen; ++}; ++ ++enum { ++ NDTA_UNSPEC, ++ NDTA_NAME, /* char *, unchangeable */ ++ NDTA_THRESH1, /* u32 */ ++ NDTA_THRESH2, /* u32 */ ++ NDTA_THRESH3, /* u32 */ ++ NDTA_CONFIG, /* struct ndt_config, read-only */ ++ NDTA_PARMS, /* nested TLV NDTPA_* */ ++ NDTA_STATS, /* struct ndt_stats, read-only */ ++ NDTA_GC_INTERVAL, /* u64, msecs */ ++ NDTA_PAD, ++ __NDTA_MAX ++}; ++#define NDTA_MAX (__NDTA_MAX - 1) ++ ++#endif +diff --git a/include/uapi/linux/net_namespace.h b/include/uapi/linux/net_namespace.h +new file mode 100644 +index 0000000..9a92b7e +--- /dev/null ++++ b/include/uapi/linux/net_namespace.h +@@ -0,0 +1,23 @@ ++/* Copyright (c) 2015 6WIND S.A. ++ * Author: Nicolas Dichtel ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms and conditions of the GNU General Public License, ++ * version 2, as published by the Free Software Foundation. ++ */ ++#ifndef _LINUX_NET_NAMESPACE_H_ ++#define _LINUX_NET_NAMESPACE_H_ ++ ++/* Attributes of RTM_NEWNSID/RTM_GETNSID messages */ ++enum { ++ NETNSA_NONE, ++#define NETNSA_NSID_NOT_ASSIGNED -1 ++ NETNSA_NSID, ++ NETNSA_PID, ++ NETNSA_FD, ++ __NETNSA_MAX, ++}; ++ ++#define NETNSA_MAX (__NETNSA_MAX - 1) ++ ++#endif /* _LINUX_NET_NAMESPACE_H_ */ +diff --git a/include/uapi/linux/netconf.h b/include/uapi/linux/netconf.h +new file mode 100644 +index 0000000..4afbd7d +--- /dev/null ++++ b/include/uapi/linux/netconf.h +@@ -0,0 +1,28 @@ ++#ifndef _LINUX_NETCONF_H_ ++#define _LINUX_NETCONF_H_ ++ ++#include ++#include ++ ++struct netconfmsg { ++ __u8 ncm_family; ++}; ++ ++enum { ++ NETCONFA_UNSPEC, ++ NETCONFA_IFINDEX, ++ NETCONFA_FORWARDING, ++ NETCONFA_RP_FILTER, ++ NETCONFA_MC_FORWARDING, ++ NETCONFA_PROXY_NEIGH, ++ NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN, ++ NETCONFA_INPUT, ++ __NETCONFA_MAX ++}; ++#define NETCONFA_MAX (__NETCONFA_MAX - 1) ++#define NETCONFA_ALL -1 ++ ++#define NETCONFA_IFINDEX_ALL -1 ++#define NETCONFA_IFINDEX_DEFAULT -2 ++ ++#endif /* _LINUX_NETCONF_H_ */ +diff --git a/include/uapi/linux/netdevice.h b/include/uapi/linux/netdevice.h +new file mode 100644 +index 0000000..66fceb4 +--- /dev/null ++++ b/include/uapi/linux/netdevice.h +@@ -0,0 +1,65 @@ ++/* ++ * INET An implementation of the TCP/IP protocol suite for the LINUX ++ * operating system. INET is implemented using the BSD Socket ++ * interface as the means of communication with the user level. ++ * ++ * Definitions for the Interfaces handler. ++ * ++ * Version: @(#)dev.h 1.0.10 08/12/93 ++ * ++ * Authors: Ross Biro ++ * Fred N. van Kempen, ++ * Corey Minyard ++ * Donald J. Becker, ++ * Alan Cox, ++ * Bjorn Ekwall. ++ * Pekka Riikonen ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version ++ * 2 of the License, or (at your option) any later version. ++ * ++ * Moved to /usr/include/linux for NET3 ++ */ ++#ifndef _LINUX_NETDEVICE_H ++#define _LINUX_NETDEVICE_H ++ ++#include ++#include ++#include ++#include ++ ++ ++#define MAX_ADDR_LEN 32 /* Largest hardware address length */ ++ ++/* Initial net device group. All devices belong to group 0 by default. */ ++#define INIT_NETDEV_GROUP 0 ++ ++ ++/* interface name assignment types (sysfs name_assign_type attribute) */ ++#define NET_NAME_UNKNOWN 0 /* unknown origin (not exposed to userspace) */ ++#define NET_NAME_ENUM 1 /* enumerated by kernel */ ++#define NET_NAME_PREDICTABLE 2 /* predictably named by the kernel */ ++#define NET_NAME_USER 3 /* provided by user-space */ ++#define NET_NAME_RENAMED 4 /* renamed by user-space */ ++ ++/* Media selection options. */ ++enum { ++ IF_PORT_UNKNOWN = 0, ++ IF_PORT_10BASE2, ++ IF_PORT_10BASET, ++ IF_PORT_AUI, ++ IF_PORT_100BASET, ++ IF_PORT_100BASETX, ++ IF_PORT_100BASEFX ++}; ++ ++/* hardware address assignment types */ ++#define NET_ADDR_PERM 0 /* address is permanent (default) */ ++#define NET_ADDR_RANDOM 1 /* address is generated randomly */ ++#define NET_ADDR_STOLEN 2 /* address is stolen from other device */ ++#define NET_ADDR_SET 3 /* address is set using ++ * dev_set_mac_address() */ ++ ++#endif /* _LINUX_NETDEVICE_H */ +diff --git a/include/uapi/linux/netfilter.h b/include/uapi/linux/netfilter.h +new file mode 100644 +index 0000000..ff4a4a5 +--- /dev/null ++++ b/include/uapi/linux/netfilter.h +@@ -0,0 +1,77 @@ ++#ifndef __LINUX_NETFILTER_H ++#define __LINUX_NETFILTER_H ++ ++#include ++ ++#include ++#include ++ ++/* Responses from hook functions. */ ++#define NF_DROP 0 ++#define NF_ACCEPT 1 ++#define NF_STOLEN 2 ++#define NF_QUEUE 3 ++#define NF_REPEAT 4 ++#define NF_STOP 5 /* Deprecated, for userspace nf_queue compatibility. */ ++#define NF_MAX_VERDICT NF_STOP ++ ++/* we overload the higher bits for encoding auxiliary data such as the queue ++ * number or errno values. Not nice, but better than additional function ++ * arguments. */ ++#define NF_VERDICT_MASK 0x000000ff ++ ++/* extra verdict flags have mask 0x0000ff00 */ ++#define NF_VERDICT_FLAG_QUEUE_BYPASS 0x00008000 ++ ++/* queue number (NF_QUEUE) or errno (NF_DROP) */ ++#define NF_VERDICT_QMASK 0xffff0000 ++#define NF_VERDICT_QBITS 16 ++ ++#define NF_QUEUE_NR(x) ((((x) << 16) & NF_VERDICT_QMASK) | NF_QUEUE) ++ ++#define NF_DROP_ERR(x) (((-x) << 16) | NF_DROP) ++ ++/* only for userspace compatibility */ ++/* Generic cache responses from hook functions. ++ <= 0x2000 is used for protocol-flags. */ ++#define NFC_UNKNOWN 0x4000 ++#define NFC_ALTERED 0x8000 ++ ++/* NF_VERDICT_BITS should be 8 now, but userspace might break if this changes */ ++#define NF_VERDICT_BITS 16 ++ ++enum nf_inet_hooks { ++ NF_INET_PRE_ROUTING, ++ NF_INET_LOCAL_IN, ++ NF_INET_FORWARD, ++ NF_INET_LOCAL_OUT, ++ NF_INET_POST_ROUTING, ++ NF_INET_NUMHOOKS ++}; ++ ++enum nf_dev_hooks { ++ NF_NETDEV_INGRESS, ++ NF_NETDEV_NUMHOOKS ++}; ++ ++enum { ++ NFPROTO_UNSPEC = 0, ++ NFPROTO_INET = 1, ++ NFPROTO_IPV4 = 2, ++ NFPROTO_ARP = 3, ++ NFPROTO_NETDEV = 5, ++ NFPROTO_BRIDGE = 7, ++ NFPROTO_IPV6 = 10, ++ NFPROTO_DECNET = 12, ++ NFPROTO_NUMPROTO, ++}; ++ ++union nf_inet_addr { ++ __u32 all[4]; ++ __be32 ip; ++ __be32 ip6[4]; ++ struct in_addr in; ++ struct in6_addr in6; ++}; ++ ++#endif /* __LINUX_NETFILTER_H */ +diff --git a/include/uapi/linux/netfilter/ipset/ip_set.h b/include/uapi/linux/netfilter/ipset/ip_set.h +new file mode 100644 +index 0000000..a6c96b0 +--- /dev/null ++++ b/include/uapi/linux/netfilter/ipset/ip_set.h +@@ -0,0 +1,304 @@ ++/* Copyright (C) 2000-2002 Joakim Axelsson ++ * Patrick Schaaf ++ * Martin Josefsson ++ * Copyright (C) 2003-2011 Jozsef Kadlecsik ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ */ ++#ifndef _IP_SET_H ++#define _IP_SET_H ++ ++#include ++ ++/* The protocol version */ ++#define IPSET_PROTOCOL 6 ++ ++/* The max length of strings including NUL: set and type identifiers */ ++#define IPSET_MAXNAMELEN 32 ++ ++/* The maximum permissible comment length we will accept over netlink */ ++#define IPSET_MAX_COMMENT_SIZE 255 ++ ++/* Message types and commands */ ++enum ipset_cmd { ++ IPSET_CMD_NONE, ++ IPSET_CMD_PROTOCOL, /* 1: Return protocol version */ ++ IPSET_CMD_CREATE, /* 2: Create a new (empty) set */ ++ IPSET_CMD_DESTROY, /* 3: Destroy a (empty) set */ ++ IPSET_CMD_FLUSH, /* 4: Remove all elements from a set */ ++ IPSET_CMD_RENAME, /* 5: Rename a set */ ++ IPSET_CMD_SWAP, /* 6: Swap two sets */ ++ IPSET_CMD_LIST, /* 7: List sets */ ++ IPSET_CMD_SAVE, /* 8: Save sets */ ++ IPSET_CMD_ADD, /* 9: Add an element to a set */ ++ IPSET_CMD_DEL, /* 10: Delete an element from a set */ ++ IPSET_CMD_TEST, /* 11: Test an element in a set */ ++ IPSET_CMD_HEADER, /* 12: Get set header data only */ ++ IPSET_CMD_TYPE, /* 13: Get set type */ ++ IPSET_MSG_MAX, /* Netlink message commands */ ++ ++ /* Commands in userspace: */ ++ IPSET_CMD_RESTORE = IPSET_MSG_MAX, /* 14: Enter restore mode */ ++ IPSET_CMD_HELP, /* 15: Get help */ ++ IPSET_CMD_VERSION, /* 16: Get program version */ ++ IPSET_CMD_QUIT, /* 17: Quit from interactive mode */ ++ ++ IPSET_CMD_MAX, ++ ++ IPSET_CMD_COMMIT = IPSET_CMD_MAX, /* 18: Commit buffered commands */ ++}; ++ ++/* Attributes at command level */ ++enum { ++ IPSET_ATTR_UNSPEC, ++ IPSET_ATTR_PROTOCOL, /* 1: Protocol version */ ++ IPSET_ATTR_SETNAME, /* 2: Name of the set */ ++ IPSET_ATTR_TYPENAME, /* 3: Typename */ ++ IPSET_ATTR_SETNAME2 = IPSET_ATTR_TYPENAME, /* Setname at rename/swap */ ++ IPSET_ATTR_REVISION, /* 4: Settype revision */ ++ IPSET_ATTR_FAMILY, /* 5: Settype family */ ++ IPSET_ATTR_FLAGS, /* 6: Flags at command level */ ++ IPSET_ATTR_DATA, /* 7: Nested attributes */ ++ IPSET_ATTR_ADT, /* 8: Multiple data containers */ ++ IPSET_ATTR_LINENO, /* 9: Restore lineno */ ++ IPSET_ATTR_PROTOCOL_MIN, /* 10: Minimal supported version number */ ++ IPSET_ATTR_REVISION_MIN = IPSET_ATTR_PROTOCOL_MIN, /* type rev min */ ++ __IPSET_ATTR_CMD_MAX, ++}; ++#define IPSET_ATTR_CMD_MAX (__IPSET_ATTR_CMD_MAX - 1) ++ ++/* CADT specific attributes */ ++enum { ++ IPSET_ATTR_IP = IPSET_ATTR_UNSPEC + 1, ++ IPSET_ATTR_IP_FROM = IPSET_ATTR_IP, ++ IPSET_ATTR_IP_TO, /* 2 */ ++ IPSET_ATTR_CIDR, /* 3 */ ++ IPSET_ATTR_PORT, /* 4 */ ++ IPSET_ATTR_PORT_FROM = IPSET_ATTR_PORT, ++ IPSET_ATTR_PORT_TO, /* 5 */ ++ IPSET_ATTR_TIMEOUT, /* 6 */ ++ IPSET_ATTR_PROTO, /* 7 */ ++ IPSET_ATTR_CADT_FLAGS, /* 8 */ ++ IPSET_ATTR_CADT_LINENO = IPSET_ATTR_LINENO, /* 9 */ ++ IPSET_ATTR_MARK, /* 10 */ ++ IPSET_ATTR_MARKMASK, /* 11 */ ++ /* Reserve empty slots */ ++ IPSET_ATTR_CADT_MAX = 16, ++ /* Create-only specific attributes */ ++ IPSET_ATTR_GC, ++ IPSET_ATTR_HASHSIZE, ++ IPSET_ATTR_MAXELEM, ++ IPSET_ATTR_NETMASK, ++ IPSET_ATTR_PROBES, ++ IPSET_ATTR_RESIZE, ++ IPSET_ATTR_SIZE, ++ /* Kernel-only */ ++ IPSET_ATTR_ELEMENTS, ++ IPSET_ATTR_REFERENCES, ++ IPSET_ATTR_MEMSIZE, ++ ++ __IPSET_ATTR_CREATE_MAX, ++}; ++#define IPSET_ATTR_CREATE_MAX (__IPSET_ATTR_CREATE_MAX - 1) ++ ++/* ADT specific attributes */ ++enum { ++ IPSET_ATTR_ETHER = IPSET_ATTR_CADT_MAX + 1, ++ IPSET_ATTR_NAME, ++ IPSET_ATTR_NAMEREF, ++ IPSET_ATTR_IP2, ++ IPSET_ATTR_CIDR2, ++ IPSET_ATTR_IP2_TO, ++ IPSET_ATTR_IFACE, ++ IPSET_ATTR_BYTES, ++ IPSET_ATTR_PACKETS, ++ IPSET_ATTR_COMMENT, ++ IPSET_ATTR_SKBMARK, ++ IPSET_ATTR_SKBPRIO, ++ IPSET_ATTR_SKBQUEUE, ++ IPSET_ATTR_PAD, ++ __IPSET_ATTR_ADT_MAX, ++}; ++#define IPSET_ATTR_ADT_MAX (__IPSET_ATTR_ADT_MAX - 1) ++ ++/* IP specific attributes */ ++enum { ++ IPSET_ATTR_IPADDR_IPV4 = IPSET_ATTR_UNSPEC + 1, ++ IPSET_ATTR_IPADDR_IPV6, ++ __IPSET_ATTR_IPADDR_MAX, ++}; ++#define IPSET_ATTR_IPADDR_MAX (__IPSET_ATTR_IPADDR_MAX - 1) ++ ++/* Error codes */ ++enum ipset_errno { ++ IPSET_ERR_PRIVATE = 4096, ++ IPSET_ERR_PROTOCOL, ++ IPSET_ERR_FIND_TYPE, ++ IPSET_ERR_MAX_SETS, ++ IPSET_ERR_BUSY, ++ IPSET_ERR_EXIST_SETNAME2, ++ IPSET_ERR_TYPE_MISMATCH, ++ IPSET_ERR_EXIST, ++ IPSET_ERR_INVALID_CIDR, ++ IPSET_ERR_INVALID_NETMASK, ++ IPSET_ERR_INVALID_FAMILY, ++ IPSET_ERR_TIMEOUT, ++ IPSET_ERR_REFERENCED, ++ IPSET_ERR_IPADDR_IPV4, ++ IPSET_ERR_IPADDR_IPV6, ++ IPSET_ERR_COUNTER, ++ IPSET_ERR_COMMENT, ++ IPSET_ERR_INVALID_MARKMASK, ++ IPSET_ERR_SKBINFO, ++ ++ /* Type specific error codes */ ++ IPSET_ERR_TYPE_SPECIFIC = 4352, ++}; ++ ++/* Flags at command level or match/target flags, lower half of cmdattrs*/ ++enum ipset_cmd_flags { ++ IPSET_FLAG_BIT_EXIST = 0, ++ IPSET_FLAG_EXIST = (1 << IPSET_FLAG_BIT_EXIST), ++ IPSET_FLAG_BIT_LIST_SETNAME = 1, ++ IPSET_FLAG_LIST_SETNAME = (1 << IPSET_FLAG_BIT_LIST_SETNAME), ++ IPSET_FLAG_BIT_LIST_HEADER = 2, ++ IPSET_FLAG_LIST_HEADER = (1 << IPSET_FLAG_BIT_LIST_HEADER), ++ IPSET_FLAG_BIT_SKIP_COUNTER_UPDATE = 3, ++ IPSET_FLAG_SKIP_COUNTER_UPDATE = ++ (1 << IPSET_FLAG_BIT_SKIP_COUNTER_UPDATE), ++ IPSET_FLAG_BIT_SKIP_SUBCOUNTER_UPDATE = 4, ++ IPSET_FLAG_SKIP_SUBCOUNTER_UPDATE = ++ (1 << IPSET_FLAG_BIT_SKIP_SUBCOUNTER_UPDATE), ++ IPSET_FLAG_BIT_MATCH_COUNTERS = 5, ++ IPSET_FLAG_MATCH_COUNTERS = (1 << IPSET_FLAG_BIT_MATCH_COUNTERS), ++ IPSET_FLAG_BIT_RETURN_NOMATCH = 7, ++ IPSET_FLAG_RETURN_NOMATCH = (1 << IPSET_FLAG_BIT_RETURN_NOMATCH), ++ IPSET_FLAG_BIT_MAP_SKBMARK = 8, ++ IPSET_FLAG_MAP_SKBMARK = (1 << IPSET_FLAG_BIT_MAP_SKBMARK), ++ IPSET_FLAG_BIT_MAP_SKBPRIO = 9, ++ IPSET_FLAG_MAP_SKBPRIO = (1 << IPSET_FLAG_BIT_MAP_SKBPRIO), ++ IPSET_FLAG_BIT_MAP_SKBQUEUE = 10, ++ IPSET_FLAG_MAP_SKBQUEUE = (1 << IPSET_FLAG_BIT_MAP_SKBQUEUE), ++ IPSET_FLAG_CMD_MAX = 15, ++}; ++ ++/* Flags at CADT attribute level, upper half of cmdattrs */ ++enum ipset_cadt_flags { ++ IPSET_FLAG_BIT_BEFORE = 0, ++ IPSET_FLAG_BEFORE = (1 << IPSET_FLAG_BIT_BEFORE), ++ IPSET_FLAG_BIT_PHYSDEV = 1, ++ IPSET_FLAG_PHYSDEV = (1 << IPSET_FLAG_BIT_PHYSDEV), ++ IPSET_FLAG_BIT_NOMATCH = 2, ++ IPSET_FLAG_NOMATCH = (1 << IPSET_FLAG_BIT_NOMATCH), ++ IPSET_FLAG_BIT_WITH_COUNTERS = 3, ++ IPSET_FLAG_WITH_COUNTERS = (1 << IPSET_FLAG_BIT_WITH_COUNTERS), ++ IPSET_FLAG_BIT_WITH_COMMENT = 4, ++ IPSET_FLAG_WITH_COMMENT = (1 << IPSET_FLAG_BIT_WITH_COMMENT), ++ IPSET_FLAG_BIT_WITH_FORCEADD = 5, ++ IPSET_FLAG_WITH_FORCEADD = (1 << IPSET_FLAG_BIT_WITH_FORCEADD), ++ IPSET_FLAG_BIT_WITH_SKBINFO = 6, ++ IPSET_FLAG_WITH_SKBINFO = (1 << IPSET_FLAG_BIT_WITH_SKBINFO), ++ IPSET_FLAG_CADT_MAX = 15, ++}; ++ ++/* The flag bits which correspond to the non-extension create flags */ ++enum ipset_create_flags { ++ IPSET_CREATE_FLAG_BIT_FORCEADD = 0, ++ IPSET_CREATE_FLAG_FORCEADD = (1 << IPSET_CREATE_FLAG_BIT_FORCEADD), ++ IPSET_CREATE_FLAG_BIT_MAX = 7, ++}; ++ ++/* Commands with settype-specific attributes */ ++enum ipset_adt { ++ IPSET_ADD, ++ IPSET_DEL, ++ IPSET_TEST, ++ IPSET_ADT_MAX, ++ IPSET_CREATE = IPSET_ADT_MAX, ++ IPSET_CADT_MAX, ++}; ++ ++/* Sets are identified by an index in kernel space. Tweak with ip_set_id_t ++ * and IPSET_INVALID_ID if you want to increase the max number of sets. ++ */ ++typedef __u16 ip_set_id_t; ++ ++#define IPSET_INVALID_ID 65535 ++ ++enum ip_set_dim { ++ IPSET_DIM_ZERO = 0, ++ IPSET_DIM_ONE, ++ IPSET_DIM_TWO, ++ IPSET_DIM_THREE, ++ /* Max dimension in elements. ++ * If changed, new revision of iptables match/target is required. ++ */ ++ IPSET_DIM_MAX = 6, ++ /* Backward compatibility: set match revision 2 */ ++ IPSET_BIT_RETURN_NOMATCH = 7, ++}; ++ ++/* Option flags for kernel operations */ ++enum ip_set_kopt { ++ IPSET_INV_MATCH = (1 << IPSET_DIM_ZERO), ++ IPSET_DIM_ONE_SRC = (1 << IPSET_DIM_ONE), ++ IPSET_DIM_TWO_SRC = (1 << IPSET_DIM_TWO), ++ IPSET_DIM_THREE_SRC = (1 << IPSET_DIM_THREE), ++ IPSET_RETURN_NOMATCH = (1 << IPSET_BIT_RETURN_NOMATCH), ++}; ++ ++enum { ++ IPSET_COUNTER_NONE = 0, ++ IPSET_COUNTER_EQ, ++ IPSET_COUNTER_NE, ++ IPSET_COUNTER_LT, ++ IPSET_COUNTER_GT, ++}; ++ ++/* Backward compatibility for set match v3 */ ++struct ip_set_counter_match0 { ++ __u8 op; ++ __u64 value; ++}; ++ ++struct ip_set_counter_match { ++ __aligned_u64 value; ++ __u8 op; ++}; ++ ++/* Interface to iptables/ip6tables */ ++ ++#define SO_IP_SET 83 ++ ++union ip_set_name_index { ++ char name[IPSET_MAXNAMELEN]; ++ ip_set_id_t index; ++}; ++ ++#define IP_SET_OP_GET_BYNAME 0x00000006 /* Get set index by name */ ++struct ip_set_req_get_set { ++ unsigned int op; ++ unsigned int version; ++ union ip_set_name_index set; ++}; ++ ++#define IP_SET_OP_GET_BYINDEX 0x00000007 /* Get set name by index */ ++/* Uses ip_set_req_get_set */ ++ ++#define IP_SET_OP_GET_FNAME 0x00000008 /* Get set index and family */ ++struct ip_set_req_get_set_family { ++ unsigned int op; ++ unsigned int version; ++ unsigned int family; ++ union ip_set_name_index set; ++}; ++ ++#define IP_SET_OP_VERSION 0x00000100 /* Ask kernel version */ ++struct ip_set_req_version { ++ unsigned int op; ++ unsigned int version; ++}; ++ ++#endif /* _IP_SET_H */ +diff --git a/include/uapi/linux/netfilter/x_tables.h b/include/uapi/linux/netfilter/x_tables.h +new file mode 100644 +index 0000000..4120970 +--- /dev/null ++++ b/include/uapi/linux/netfilter/x_tables.h +@@ -0,0 +1,185 @@ ++#ifndef _X_TABLES_H ++#define _X_TABLES_H ++#include ++#include ++ ++#define XT_FUNCTION_MAXNAMELEN 30 ++#define XT_EXTENSION_MAXNAMELEN 29 ++#define XT_TABLE_MAXNAMELEN 32 ++ ++struct xt_entry_match { ++ union { ++ struct { ++ __u16 match_size; ++ ++ /* Used by userspace */ ++ char name[XT_EXTENSION_MAXNAMELEN]; ++ __u8 revision; ++ } user; ++ struct { ++ __u16 match_size; ++ ++ /* Used inside the kernel */ ++ struct xt_match *match; ++ } kernel; ++ ++ /* Total length */ ++ __u16 match_size; ++ } u; ++ ++ unsigned char data[0]; ++}; ++ ++struct xt_entry_target { ++ union { ++ struct { ++ __u16 target_size; ++ ++ /* Used by userspace */ ++ char name[XT_EXTENSION_MAXNAMELEN]; ++ __u8 revision; ++ } user; ++ struct { ++ __u16 target_size; ++ ++ /* Used inside the kernel */ ++ struct xt_target *target; ++ } kernel; ++ ++ /* Total length */ ++ __u16 target_size; ++ } u; ++ ++ unsigned char data[0]; ++}; ++ ++#define XT_TARGET_INIT(__name, __size) \ ++{ \ ++ .target.u.user = { \ ++ .target_size = XT_ALIGN(__size), \ ++ .name = __name, \ ++ }, \ ++} ++ ++struct xt_standard_target { ++ struct xt_entry_target target; ++ int verdict; ++}; ++ ++struct xt_error_target { ++ struct xt_entry_target target; ++ char errorname[XT_FUNCTION_MAXNAMELEN]; ++}; ++ ++/* The argument to IPT_SO_GET_REVISION_*. Returns highest revision ++ * kernel supports, if >= revision. */ ++struct xt_get_revision { ++ char name[XT_EXTENSION_MAXNAMELEN]; ++ __u8 revision; ++}; ++ ++/* CONTINUE verdict for targets */ ++#define XT_CONTINUE 0xFFFFFFFF ++ ++/* For standard target */ ++#define XT_RETURN (-NF_REPEAT - 1) ++ ++/* this is a dummy structure to find out the alignment requirement for a struct ++ * containing all the fundamental data types that are used in ipt_entry, ++ * ip6t_entry and arpt_entry. This sucks, and it is a hack. It will be my ++ * personal pleasure to remove it -HW ++ */ ++struct _xt_align { ++ __u8 u8; ++ __u16 u16; ++ __u32 u32; ++ __u64 u64; ++}; ++ ++#define XT_ALIGN(s) __ALIGN_KERNEL((s), __alignof__(struct _xt_align)) ++ ++/* Standard return verdict, or do jump. */ ++#define XT_STANDARD_TARGET "" ++/* Error verdict. */ ++#define XT_ERROR_TARGET "ERROR" ++ ++#define SET_COUNTER(c,b,p) do { (c).bcnt = (b); (c).pcnt = (p); } while(0) ++#define ADD_COUNTER(c,b,p) do { (c).bcnt += (b); (c).pcnt += (p); } while(0) ++ ++struct xt_counters { ++ __u64 pcnt, bcnt; /* Packet and byte counters */ ++}; ++ ++/* The argument to IPT_SO_ADD_COUNTERS. */ ++struct xt_counters_info { ++ /* Which table. */ ++ char name[XT_TABLE_MAXNAMELEN]; ++ ++ unsigned int num_counters; ++ ++ /* The counters (actually `number' of these). */ ++ struct xt_counters counters[0]; ++}; ++ ++#define XT_INV_PROTO 0x40 /* Invert the sense of PROTO. */ ++ ++/* fn returns 0 to continue iteration */ ++#define XT_MATCH_ITERATE(type, e, fn, args...) \ ++({ \ ++ unsigned int __i; \ ++ int __ret = 0; \ ++ struct xt_entry_match *__m; \ ++ \ ++ for (__i = sizeof(type); \ ++ __i < (e)->target_offset; \ ++ __i += __m->u.match_size) { \ ++ __m = (void *)e + __i; \ ++ \ ++ __ret = fn(__m , ## args); \ ++ if (__ret != 0) \ ++ break; \ ++ } \ ++ __ret; \ ++}) ++ ++/* fn returns 0 to continue iteration */ ++#define XT_ENTRY_ITERATE_CONTINUE(type, entries, size, n, fn, args...) \ ++({ \ ++ unsigned int __i, __n; \ ++ int __ret = 0; \ ++ type *__entry; \ ++ \ ++ for (__i = 0, __n = 0; __i < (size); \ ++ __i += __entry->next_offset, __n++) { \ ++ __entry = (void *)(entries) + __i; \ ++ if (__n < n) \ ++ continue; \ ++ \ ++ __ret = fn(__entry , ## args); \ ++ if (__ret != 0) \ ++ break; \ ++ } \ ++ __ret; \ ++}) ++ ++/* fn returns 0 to continue iteration */ ++#define XT_ENTRY_ITERATE(type, entries, size, fn, args...) \ ++ XT_ENTRY_ITERATE_CONTINUE(type, entries, size, 0, fn, args) ++ ++ ++/* pos is normally a struct ipt_entry/ip6t_entry/etc. */ ++#define xt_entry_foreach(pos, ehead, esize) \ ++ for ((pos) = (typeof(pos))(ehead); \ ++ (pos) < (typeof(pos))((char *)(ehead) + (esize)); \ ++ (pos) = (typeof(pos))((char *)(pos) + (pos)->next_offset)) ++ ++/* can only be xt_entry_match, so no use of typeof here */ ++#define xt_ematch_foreach(pos, entry) \ ++ for ((pos) = (struct xt_entry_match *)entry->elems; \ ++ (pos) < (struct xt_entry_match *)((char *)(entry) + \ ++ (entry)->target_offset); \ ++ (pos) = (struct xt_entry_match *)((char *)(pos) + \ ++ (pos)->u.match_size)) ++ ++ ++#endif /* _X_TABLES_H */ +diff --git a/include/uapi/linux/netfilter/xt_set.h b/include/uapi/linux/netfilter/xt_set.h +new file mode 100644 +index 0000000..d4e0234 +--- /dev/null ++++ b/include/uapi/linux/netfilter/xt_set.h +@@ -0,0 +1,93 @@ ++#ifndef _XT_SET_H ++#define _XT_SET_H ++ ++#include ++#include ++ ++/* Revision 0 interface: backward compatible with netfilter/iptables */ ++ ++/* ++ * Option flags for kernel operations (xt_set_info_v0) ++ */ ++#define IPSET_SRC 0x01 /* Source match/add */ ++#define IPSET_DST 0x02 /* Destination match/add */ ++#define IPSET_MATCH_INV 0x04 /* Inverse matching */ ++ ++struct xt_set_info_v0 { ++ ip_set_id_t index; ++ union { ++ __u32 flags[IPSET_DIM_MAX + 1]; ++ struct { ++ __u32 __flags[IPSET_DIM_MAX]; ++ __u8 dim; ++ __u8 flags; ++ } compat; ++ } u; ++}; ++ ++/* match and target infos */ ++struct xt_set_info_match_v0 { ++ struct xt_set_info_v0 match_set; ++}; ++ ++struct xt_set_info_target_v0 { ++ struct xt_set_info_v0 add_set; ++ struct xt_set_info_v0 del_set; ++}; ++ ++/* Revision 1 match and target */ ++ ++struct xt_set_info { ++ ip_set_id_t index; ++ __u8 dim; ++ __u8 flags; ++}; ++ ++/* match and target infos */ ++struct xt_set_info_match_v1 { ++ struct xt_set_info match_set; ++}; ++ ++struct xt_set_info_target_v1 { ++ struct xt_set_info add_set; ++ struct xt_set_info del_set; ++}; ++ ++/* Revision 2 target */ ++ ++struct xt_set_info_target_v2 { ++ struct xt_set_info add_set; ++ struct xt_set_info del_set; ++ __u32 flags; ++ __u32 timeout; ++}; ++ ++/* Revision 3 match */ ++ ++struct xt_set_info_match_v3 { ++ struct xt_set_info match_set; ++ struct ip_set_counter_match0 packets; ++ struct ip_set_counter_match0 bytes; ++ __u32 flags; ++}; ++ ++/* Revision 3 target */ ++ ++struct xt_set_info_target_v3 { ++ struct xt_set_info add_set; ++ struct xt_set_info del_set; ++ struct xt_set_info map_set; ++ __u32 flags; ++ __u32 timeout; ++}; ++ ++/* Revision 4 match */ ++ ++struct xt_set_info_match_v4 { ++ struct xt_set_info match_set; ++ struct ip_set_counter_match packets; ++ struct ip_set_counter_match bytes; ++ __u32 flags; ++}; ++ ++#endif /*_XT_SET_H*/ +diff --git a/include/uapi/linux/netfilter/xt_tcpudp.h b/include/uapi/linux/netfilter/xt_tcpudp.h +new file mode 100644 +index 0000000..38aa7b3 +--- /dev/null ++++ b/include/uapi/linux/netfilter/xt_tcpudp.h +@@ -0,0 +1,36 @@ ++#ifndef _XT_TCPUDP_H ++#define _XT_TCPUDP_H ++ ++#include ++ ++/* TCP matching stuff */ ++struct xt_tcp { ++ __u16 spts[2]; /* Source port range. */ ++ __u16 dpts[2]; /* Destination port range. */ ++ __u8 option; /* TCP Option iff non-zero*/ ++ __u8 flg_mask; /* TCP flags mask byte */ ++ __u8 flg_cmp; /* TCP flags compare byte */ ++ __u8 invflags; /* Inverse flags */ ++}; ++ ++/* Values for "inv" field in struct ipt_tcp. */ ++#define XT_TCP_INV_SRCPT 0x01 /* Invert the sense of source ports. */ ++#define XT_TCP_INV_DSTPT 0x02 /* Invert the sense of dest ports. */ ++#define XT_TCP_INV_FLAGS 0x04 /* Invert the sense of TCP flags. */ ++#define XT_TCP_INV_OPTION 0x08 /* Invert the sense of option test. */ ++#define XT_TCP_INV_MASK 0x0F /* All possible flags. */ ++ ++/* UDP matching stuff */ ++struct xt_udp { ++ __u16 spts[2]; /* Source port range. */ ++ __u16 dpts[2]; /* Destination port range. */ ++ __u8 invflags; /* Inverse flags */ ++}; ++ ++/* Values for "invflags" field in struct ipt_udp. */ ++#define XT_UDP_INV_SRCPT 0x01 /* Invert the sense of source ports. */ ++#define XT_UDP_INV_DSTPT 0x02 /* Invert the sense of dest ports. */ ++#define XT_UDP_INV_MASK 0x03 /* All possible flags. */ ++ ++ ++#endif +diff --git a/include/uapi/linux/netfilter_ipv4.h b/include/uapi/linux/netfilter_ipv4.h +new file mode 100644 +index 0000000..a5f4dc7 +--- /dev/null ++++ b/include/uapi/linux/netfilter_ipv4.h +@@ -0,0 +1,79 @@ ++/* IPv4-specific defines for netfilter. ++ * (C)1998 Rusty Russell -- This code is GPL. ++ */ ++#ifndef __LINUX_IP_NETFILTER_H ++#define __LINUX_IP_NETFILTER_H ++ ++ ++#include ++ ++/* only for userspace compatibility */ ++ ++#include /* for INT_MIN, INT_MAX */ ++ ++/* IP Cache bits. */ ++/* Src IP address. */ ++#define NFC_IP_SRC 0x0001 ++/* Dest IP address. */ ++#define NFC_IP_DST 0x0002 ++/* Input device. */ ++#define NFC_IP_IF_IN 0x0004 ++/* Output device. */ ++#define NFC_IP_IF_OUT 0x0008 ++/* TOS. */ ++#define NFC_IP_TOS 0x0010 ++/* Protocol. */ ++#define NFC_IP_PROTO 0x0020 ++/* IP options. */ ++#define NFC_IP_OPTIONS 0x0040 ++/* Frag & flags. */ ++#define NFC_IP_FRAG 0x0080 ++ ++/* Per-protocol information: only matters if proto match. */ ++/* TCP flags. */ ++#define NFC_IP_TCPFLAGS 0x0100 ++/* Source port. */ ++#define NFC_IP_SRC_PT 0x0200 ++/* Dest port. */ ++#define NFC_IP_DST_PT 0x0400 ++/* Something else about the proto */ ++#define NFC_IP_PROTO_UNKNOWN 0x2000 ++ ++/* IP Hooks */ ++/* After promisc drops, checksum checks. */ ++#define NF_IP_PRE_ROUTING 0 ++/* If the packet is destined for this box. */ ++#define NF_IP_LOCAL_IN 1 ++/* If the packet is destined for another interface. */ ++#define NF_IP_FORWARD 2 ++/* Packets coming from a local process. */ ++#define NF_IP_LOCAL_OUT 3 ++/* Packets about to hit the wire. */ ++#define NF_IP_POST_ROUTING 4 ++#define NF_IP_NUMHOOKS 5 ++ ++enum nf_ip_hook_priorities { ++ NF_IP_PRI_FIRST = INT_MIN, ++ NF_IP_PRI_CONNTRACK_DEFRAG = -400, ++ NF_IP_PRI_RAW = -300, ++ NF_IP_PRI_SELINUX_FIRST = -225, ++ NF_IP_PRI_CONNTRACK = -200, ++ NF_IP_PRI_MANGLE = -150, ++ NF_IP_PRI_NAT_DST = -100, ++ NF_IP_PRI_FILTER = 0, ++ NF_IP_PRI_SECURITY = 50, ++ NF_IP_PRI_NAT_SRC = 100, ++ NF_IP_PRI_SELINUX_LAST = 225, ++ NF_IP_PRI_CONNTRACK_HELPER = 300, ++ NF_IP_PRI_CONNTRACK_CONFIRM = INT_MAX, ++ NF_IP_PRI_LAST = INT_MAX, ++}; ++ ++/* Arguments for setsockopt SOL_IP: */ ++/* 2.0 firewalling went from 64 through 71 (and +256, +512, etc). */ ++/* 2.2 firewalling (+ masq) went from 64 through 76 */ ++/* 2.4 firewalling went 64 through 67. */ ++#define SO_ORIGINAL_DST 80 ++ ++ ++#endif /* __LINUX_IP_NETFILTER_H */ +diff --git a/include/uapi/linux/netfilter_ipv4/ip_tables.h b/include/uapi/linux/netfilter_ipv4/ip_tables.h +new file mode 100644 +index 0000000..456fb86 +--- /dev/null ++++ b/include/uapi/linux/netfilter_ipv4/ip_tables.h +@@ -0,0 +1,228 @@ ++/* ++ * 25-Jul-1998 Major changes to allow for ip chain table ++ * ++ * 3-Jan-2000 Named tables to allow packet selection for different uses. ++ */ ++ ++/* ++ * Format of an IP firewall descriptor ++ * ++ * src, dst, src_mask, dst_mask are always stored in network byte order. ++ * flags are stored in host byte order (of course). ++ * Port numbers are stored in HOST byte order. ++ */ ++ ++#ifndef _IPTABLES_H ++#define _IPTABLES_H ++ ++#include ++ ++#include ++#include ++ ++#include ++ ++#define IPT_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN ++#define IPT_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN ++#define ipt_match xt_match ++#define ipt_target xt_target ++#define ipt_table xt_table ++#define ipt_get_revision xt_get_revision ++#define ipt_entry_match xt_entry_match ++#define ipt_entry_target xt_entry_target ++#define ipt_standard_target xt_standard_target ++#define ipt_error_target xt_error_target ++#define ipt_counters xt_counters ++#define IPT_CONTINUE XT_CONTINUE ++#define IPT_RETURN XT_RETURN ++ ++/* This group is older than old (iptables < v1.4.0-rc1~89) */ ++#include ++#define ipt_udp xt_udp ++#define ipt_tcp xt_tcp ++#define IPT_TCP_INV_SRCPT XT_TCP_INV_SRCPT ++#define IPT_TCP_INV_DSTPT XT_TCP_INV_DSTPT ++#define IPT_TCP_INV_FLAGS XT_TCP_INV_FLAGS ++#define IPT_TCP_INV_OPTION XT_TCP_INV_OPTION ++#define IPT_TCP_INV_MASK XT_TCP_INV_MASK ++#define IPT_UDP_INV_SRCPT XT_UDP_INV_SRCPT ++#define IPT_UDP_INV_DSTPT XT_UDP_INV_DSTPT ++#define IPT_UDP_INV_MASK XT_UDP_INV_MASK ++ ++/* The argument to IPT_SO_ADD_COUNTERS. */ ++#define ipt_counters_info xt_counters_info ++/* Standard return verdict, or do jump. */ ++#define IPT_STANDARD_TARGET XT_STANDARD_TARGET ++/* Error verdict. */ ++#define IPT_ERROR_TARGET XT_ERROR_TARGET ++ ++/* fn returns 0 to continue iteration */ ++#define IPT_MATCH_ITERATE(e, fn, args...) \ ++ XT_MATCH_ITERATE(struct ipt_entry, e, fn, ## args) ++ ++/* fn returns 0 to continue iteration */ ++#define IPT_ENTRY_ITERATE(entries, size, fn, args...) \ ++ XT_ENTRY_ITERATE(struct ipt_entry, entries, size, fn, ## args) ++ ++/* Yes, Virginia, you have to zero the padding. */ ++struct ipt_ip { ++ /* Source and destination IP addr */ ++ struct in_addr src, dst; ++ /* Mask for src and dest IP addr */ ++ struct in_addr smsk, dmsk; ++ char iniface[IFNAMSIZ], outiface[IFNAMSIZ]; ++ unsigned char iniface_mask[IFNAMSIZ], outiface_mask[IFNAMSIZ]; ++ ++ /* Protocol, 0 = ANY */ ++ __u16 proto; ++ ++ /* Flags word */ ++ __u8 flags; ++ /* Inverse flags */ ++ __u8 invflags; ++}; ++ ++/* Values for "flag" field in struct ipt_ip (general ip structure). */ ++#define IPT_F_FRAG 0x01 /* Set if rule is a fragment rule */ ++#define IPT_F_GOTO 0x02 /* Set if jump is a goto */ ++#define IPT_F_MASK 0x03 /* All possible flag bits mask. */ ++ ++/* Values for "inv" field in struct ipt_ip. */ ++#define IPT_INV_VIA_IN 0x01 /* Invert the sense of IN IFACE. */ ++#define IPT_INV_VIA_OUT 0x02 /* Invert the sense of OUT IFACE */ ++#define IPT_INV_TOS 0x04 /* Invert the sense of TOS. */ ++#define IPT_INV_SRCIP 0x08 /* Invert the sense of SRC IP. */ ++#define IPT_INV_DSTIP 0x10 /* Invert the sense of DST OP. */ ++#define IPT_INV_FRAG 0x20 /* Invert the sense of FRAG. */ ++#define IPT_INV_PROTO XT_INV_PROTO ++#define IPT_INV_MASK 0x7F /* All possible flag bits mask. */ ++ ++/* This structure defines each of the firewall rules. Consists of 3 ++ parts which are 1) general IP header stuff 2) match specific ++ stuff 3) the target to perform if the rule matches */ ++struct ipt_entry { ++ struct ipt_ip ip; ++ ++ /* Mark with fields that we care about. */ ++ unsigned int nfcache; ++ ++ /* Size of ipt_entry + matches */ ++ __u16 target_offset; ++ /* Size of ipt_entry + matches + target */ ++ __u16 next_offset; ++ ++ /* Back pointer */ ++ unsigned int comefrom; ++ ++ /* Packet and byte counters. */ ++ struct xt_counters counters; ++ ++ /* The matches (if any), then the target. */ ++ unsigned char elems[0]; ++}; ++ ++/* ++ * New IP firewall options for [gs]etsockopt at the RAW IP level. ++ * Unlike BSD Linux inherits IP options so you don't have to use a raw ++ * socket for this. Instead we check rights in the calls. ++ * ++ * ATTENTION: check linux/in.h before adding new number here. ++ */ ++#define IPT_BASE_CTL 64 ++ ++#define IPT_SO_SET_REPLACE (IPT_BASE_CTL) ++#define IPT_SO_SET_ADD_COUNTERS (IPT_BASE_CTL + 1) ++#define IPT_SO_SET_MAX IPT_SO_SET_ADD_COUNTERS ++ ++#define IPT_SO_GET_INFO (IPT_BASE_CTL) ++#define IPT_SO_GET_ENTRIES (IPT_BASE_CTL + 1) ++#define IPT_SO_GET_REVISION_MATCH (IPT_BASE_CTL + 2) ++#define IPT_SO_GET_REVISION_TARGET (IPT_BASE_CTL + 3) ++#define IPT_SO_GET_MAX IPT_SO_GET_REVISION_TARGET ++ ++/* ICMP matching stuff */ ++struct ipt_icmp { ++ __u8 type; /* type to match */ ++ __u8 code[2]; /* range of code */ ++ __u8 invflags; /* Inverse flags */ ++}; ++ ++/* Values for "inv" field for struct ipt_icmp. */ ++#define IPT_ICMP_INV 0x01 /* Invert the sense of type/code test */ ++ ++/* The argument to IPT_SO_GET_INFO */ ++struct ipt_getinfo { ++ /* Which table: caller fills this in. */ ++ char name[XT_TABLE_MAXNAMELEN]; ++ ++ /* Kernel fills these in. */ ++ /* Which hook entry points are valid: bitmask */ ++ unsigned int valid_hooks; ++ ++ /* Hook entry points: one per netfilter hook. */ ++ unsigned int hook_entry[NF_INET_NUMHOOKS]; ++ ++ /* Underflow points. */ ++ unsigned int underflow[NF_INET_NUMHOOKS]; ++ ++ /* Number of entries */ ++ unsigned int num_entries; ++ ++ /* Size of entries. */ ++ unsigned int size; ++}; ++ ++/* The argument to IPT_SO_SET_REPLACE. */ ++struct ipt_replace { ++ /* Which table. */ ++ char name[XT_TABLE_MAXNAMELEN]; ++ ++ /* Which hook entry points are valid: bitmask. You can't ++ change this. */ ++ unsigned int valid_hooks; ++ ++ /* Number of entries */ ++ unsigned int num_entries; ++ ++ /* Total size of new entries */ ++ unsigned int size; ++ ++ /* Hook entry points. */ ++ unsigned int hook_entry[NF_INET_NUMHOOKS]; ++ ++ /* Underflow points. */ ++ unsigned int underflow[NF_INET_NUMHOOKS]; ++ ++ /* Information about old entries: */ ++ /* Number of counters (must be equal to current number of entries). */ ++ unsigned int num_counters; ++ /* The old entries' counters. */ ++ struct xt_counters *counters; ++ ++ /* The entries (hang off end: not really an array). */ ++ struct ipt_entry entries[0]; ++}; ++ ++/* The argument to IPT_SO_GET_ENTRIES. */ ++struct ipt_get_entries { ++ /* Which table: user fills this in. */ ++ char name[XT_TABLE_MAXNAMELEN]; ++ ++ /* User fills this in: total entry size. */ ++ unsigned int size; ++ ++ /* The entries. */ ++ struct ipt_entry entrytable[0]; ++}; ++ ++/* Helper functions */ ++static __inline__ struct xt_entry_target * ++ipt_get_target(struct ipt_entry *e) ++{ ++ return (void *)e + e->target_offset; ++} ++ ++/* ++ * Main firewall chains definitions and global var's definitions. ++ */ ++#endif /* _IPTABLES_H */ +diff --git a/include/uapi/linux/netfilter_ipv6.h b/include/uapi/linux/netfilter_ipv6.h +new file mode 100644 +index 0000000..8483d1d +--- /dev/null ++++ b/include/uapi/linux/netfilter_ipv6.h +@@ -0,0 +1,77 @@ ++/* IPv6-specific defines for netfilter. ++ * (C)1998 Rusty Russell -- This code is GPL. ++ * (C)1999 David Jeffery ++ * this header was blatantly ripped from netfilter_ipv4.h ++ * it's amazing what adding a bunch of 6s can do =8^) ++ */ ++#ifndef __LINUX_IP6_NETFILTER_H ++#define __LINUX_IP6_NETFILTER_H ++ ++ ++#include ++ ++/* only for userspace compatibility */ ++ ++#include /* for INT_MIN, INT_MAX */ ++ ++/* IP Cache bits. */ ++/* Src IP address. */ ++#define NFC_IP6_SRC 0x0001 ++/* Dest IP address. */ ++#define NFC_IP6_DST 0x0002 ++/* Input device. */ ++#define NFC_IP6_IF_IN 0x0004 ++/* Output device. */ ++#define NFC_IP6_IF_OUT 0x0008 ++/* TOS. */ ++#define NFC_IP6_TOS 0x0010 ++/* Protocol. */ ++#define NFC_IP6_PROTO 0x0020 ++/* IP options. */ ++#define NFC_IP6_OPTIONS 0x0040 ++/* Frag & flags. */ ++#define NFC_IP6_FRAG 0x0080 ++ ++ ++/* Per-protocol information: only matters if proto match. */ ++/* TCP flags. */ ++#define NFC_IP6_TCPFLAGS 0x0100 ++/* Source port. */ ++#define NFC_IP6_SRC_PT 0x0200 ++/* Dest port. */ ++#define NFC_IP6_DST_PT 0x0400 ++/* Something else about the proto */ ++#define NFC_IP6_PROTO_UNKNOWN 0x2000 ++ ++/* IP6 Hooks */ ++/* After promisc drops, checksum checks. */ ++#define NF_IP6_PRE_ROUTING 0 ++/* If the packet is destined for this box. */ ++#define NF_IP6_LOCAL_IN 1 ++/* If the packet is destined for another interface. */ ++#define NF_IP6_FORWARD 2 ++/* Packets coming from a local process. */ ++#define NF_IP6_LOCAL_OUT 3 ++/* Packets about to hit the wire. */ ++#define NF_IP6_POST_ROUTING 4 ++#define NF_IP6_NUMHOOKS 5 ++ ++ ++enum nf_ip6_hook_priorities { ++ NF_IP6_PRI_FIRST = INT_MIN, ++ NF_IP6_PRI_CONNTRACK_DEFRAG = -400, ++ NF_IP6_PRI_RAW = -300, ++ NF_IP6_PRI_SELINUX_FIRST = -225, ++ NF_IP6_PRI_CONNTRACK = -200, ++ NF_IP6_PRI_MANGLE = -150, ++ NF_IP6_PRI_NAT_DST = -100, ++ NF_IP6_PRI_FILTER = 0, ++ NF_IP6_PRI_SECURITY = 50, ++ NF_IP6_PRI_NAT_SRC = 100, ++ NF_IP6_PRI_SELINUX_LAST = 225, ++ NF_IP6_PRI_CONNTRACK_HELPER = 300, ++ NF_IP6_PRI_LAST = INT_MAX, ++}; ++ ++ ++#endif /* __LINUX_IP6_NETFILTER_H */ +diff --git a/include/uapi/linux/netfilter_ipv6/ip6_tables.h b/include/uapi/linux/netfilter_ipv6/ip6_tables.h +new file mode 100644 +index 0000000..fcc8cca +--- /dev/null ++++ b/include/uapi/linux/netfilter_ipv6/ip6_tables.h +@@ -0,0 +1,269 @@ ++/* ++ * 25-Jul-1998 Major changes to allow for ip chain table ++ * ++ * 3-Jan-2000 Named tables to allow packet selection for different uses. ++ */ ++ ++/* ++ * Format of an IP6 firewall descriptor ++ * ++ * src, dst, src_mask, dst_mask are always stored in network byte order. ++ * flags are stored in host byte order (of course). ++ * Port numbers are stored in HOST byte order. ++ */ ++ ++#ifndef _IP6_TABLES_H ++#define _IP6_TABLES_H ++ ++#include ++ ++#include ++#include ++ ++#include ++ ++#define IP6T_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN ++#define IP6T_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN ++#define ip6t_match xt_match ++#define ip6t_target xt_target ++#define ip6t_table xt_table ++#define ip6t_get_revision xt_get_revision ++#define ip6t_entry_match xt_entry_match ++#define ip6t_entry_target xt_entry_target ++#define ip6t_standard_target xt_standard_target ++#define ip6t_error_target xt_error_target ++#define ip6t_counters xt_counters ++#define IP6T_CONTINUE XT_CONTINUE ++#define IP6T_RETURN XT_RETURN ++ ++/* Pre-iptables-1.4.0 */ ++#include ++#define ip6t_tcp xt_tcp ++#define ip6t_udp xt_udp ++#define IP6T_TCP_INV_SRCPT XT_TCP_INV_SRCPT ++#define IP6T_TCP_INV_DSTPT XT_TCP_INV_DSTPT ++#define IP6T_TCP_INV_FLAGS XT_TCP_INV_FLAGS ++#define IP6T_TCP_INV_OPTION XT_TCP_INV_OPTION ++#define IP6T_TCP_INV_MASK XT_TCP_INV_MASK ++#define IP6T_UDP_INV_SRCPT XT_UDP_INV_SRCPT ++#define IP6T_UDP_INV_DSTPT XT_UDP_INV_DSTPT ++#define IP6T_UDP_INV_MASK XT_UDP_INV_MASK ++ ++#define ip6t_counters_info xt_counters_info ++#define IP6T_STANDARD_TARGET XT_STANDARD_TARGET ++#define IP6T_ERROR_TARGET XT_ERROR_TARGET ++#define IP6T_MATCH_ITERATE(e, fn, args...) \ ++ XT_MATCH_ITERATE(struct ip6t_entry, e, fn, ## args) ++#define IP6T_ENTRY_ITERATE(entries, size, fn, args...) \ ++ XT_ENTRY_ITERATE(struct ip6t_entry, entries, size, fn, ## args) ++ ++/* Yes, Virginia, you have to zero the padding. */ ++struct ip6t_ip6 { ++ /* Source and destination IP6 addr */ ++ struct in6_addr src, dst; ++ /* Mask for src and dest IP6 addr */ ++ struct in6_addr smsk, dmsk; ++ char iniface[IFNAMSIZ], outiface[IFNAMSIZ]; ++ unsigned char iniface_mask[IFNAMSIZ], outiface_mask[IFNAMSIZ]; ++ ++ /* Upper protocol number ++ * - The allowed value is 0 (any) or protocol number of last parsable ++ * header, which is 50 (ESP), 59 (No Next Header), 135 (MH), or ++ * the non IPv6 extension headers. ++ * - The protocol numbers of IPv6 extension headers except of ESP and ++ * MH do not match any packets. ++ * - You also need to set IP6T_FLAGS_PROTO to "flags" to check protocol. ++ */ ++ __u16 proto; ++ /* TOS to match iff flags & IP6T_F_TOS */ ++ __u8 tos; ++ ++ /* Flags word */ ++ __u8 flags; ++ /* Inverse flags */ ++ __u8 invflags; ++}; ++ ++/* Values for "flag" field in struct ip6t_ip6 (general ip6 structure). */ ++#define IP6T_F_PROTO 0x01 /* Set if rule cares about upper ++ protocols */ ++#define IP6T_F_TOS 0x02 /* Match the TOS. */ ++#define IP6T_F_GOTO 0x04 /* Set if jump is a goto */ ++#define IP6T_F_MASK 0x07 /* All possible flag bits mask. */ ++ ++/* Values for "inv" field in struct ip6t_ip6. */ ++#define IP6T_INV_VIA_IN 0x01 /* Invert the sense of IN IFACE. */ ++#define IP6T_INV_VIA_OUT 0x02 /* Invert the sense of OUT IFACE */ ++#define IP6T_INV_TOS 0x04 /* Invert the sense of TOS. */ ++#define IP6T_INV_SRCIP 0x08 /* Invert the sense of SRC IP. */ ++#define IP6T_INV_DSTIP 0x10 /* Invert the sense of DST OP. */ ++#define IP6T_INV_FRAG 0x20 /* Invert the sense of FRAG. */ ++#define IP6T_INV_PROTO XT_INV_PROTO ++#define IP6T_INV_MASK 0x7F /* All possible flag bits mask. */ ++ ++/* This structure defines each of the firewall rules. Consists of 3 ++ parts which are 1) general IP header stuff 2) match specific ++ stuff 3) the target to perform if the rule matches */ ++struct ip6t_entry { ++ struct ip6t_ip6 ipv6; ++ ++ /* Mark with fields that we care about. */ ++ unsigned int nfcache; ++ ++ /* Size of ipt_entry + matches */ ++ __u16 target_offset; ++ /* Size of ipt_entry + matches + target */ ++ __u16 next_offset; ++ ++ /* Back pointer */ ++ unsigned int comefrom; ++ ++ /* Packet and byte counters. */ ++ struct xt_counters counters; ++ ++ /* The matches (if any), then the target. */ ++ unsigned char elems[0]; ++}; ++ ++/* Standard entry */ ++struct ip6t_standard { ++ struct ip6t_entry entry; ++ struct xt_standard_target target; ++}; ++ ++struct ip6t_error { ++ struct ip6t_entry entry; ++ struct xt_error_target target; ++}; ++ ++#define IP6T_ENTRY_INIT(__size) \ ++{ \ ++ .target_offset = sizeof(struct ip6t_entry), \ ++ .next_offset = (__size), \ ++} ++ ++#define IP6T_STANDARD_INIT(__verdict) \ ++{ \ ++ .entry = IP6T_ENTRY_INIT(sizeof(struct ip6t_standard)), \ ++ .target = XT_TARGET_INIT(XT_STANDARD_TARGET, \ ++ sizeof(struct xt_standard_target)), \ ++ .target.verdict = -(__verdict) - 1, \ ++} ++ ++#define IP6T_ERROR_INIT \ ++{ \ ++ .entry = IP6T_ENTRY_INIT(sizeof(struct ip6t_error)), \ ++ .target = XT_TARGET_INIT(XT_ERROR_TARGET, \ ++ sizeof(struct xt_error_target)), \ ++ .target.errorname = "ERROR", \ ++} ++ ++/* ++ * New IP firewall options for [gs]etsockopt at the RAW IP level. ++ * Unlike BSD Linux inherits IP options so you don't have to use ++ * a raw socket for this. Instead we check rights in the calls. ++ * ++ * ATTENTION: check linux/in6.h before adding new number here. ++ */ ++#define IP6T_BASE_CTL 64 ++ ++#define IP6T_SO_SET_REPLACE (IP6T_BASE_CTL) ++#define IP6T_SO_SET_ADD_COUNTERS (IP6T_BASE_CTL + 1) ++#define IP6T_SO_SET_MAX IP6T_SO_SET_ADD_COUNTERS ++ ++#define IP6T_SO_GET_INFO (IP6T_BASE_CTL) ++#define IP6T_SO_GET_ENTRIES (IP6T_BASE_CTL + 1) ++#define IP6T_SO_GET_REVISION_MATCH (IP6T_BASE_CTL + 4) ++#define IP6T_SO_GET_REVISION_TARGET (IP6T_BASE_CTL + 5) ++#define IP6T_SO_GET_MAX IP6T_SO_GET_REVISION_TARGET ++ ++/* obtain original address if REDIRECT'd connection */ ++#define IP6T_SO_ORIGINAL_DST 80 ++ ++/* ICMP matching stuff */ ++struct ip6t_icmp { ++ __u8 type; /* type to match */ ++ __u8 code[2]; /* range of code */ ++ __u8 invflags; /* Inverse flags */ ++}; ++ ++/* Values for "inv" field for struct ipt_icmp. */ ++#define IP6T_ICMP_INV 0x01 /* Invert the sense of type/code test */ ++ ++/* The argument to IP6T_SO_GET_INFO */ ++struct ip6t_getinfo { ++ /* Which table: caller fills this in. */ ++ char name[XT_TABLE_MAXNAMELEN]; ++ ++ /* Kernel fills these in. */ ++ /* Which hook entry points are valid: bitmask */ ++ unsigned int valid_hooks; ++ ++ /* Hook entry points: one per netfilter hook. */ ++ unsigned int hook_entry[NF_INET_NUMHOOKS]; ++ ++ /* Underflow points. */ ++ unsigned int underflow[NF_INET_NUMHOOKS]; ++ ++ /* Number of entries */ ++ unsigned int num_entries; ++ ++ /* Size of entries. */ ++ unsigned int size; ++}; ++ ++/* The argument to IP6T_SO_SET_REPLACE. */ ++struct ip6t_replace { ++ /* Which table. */ ++ char name[XT_TABLE_MAXNAMELEN]; ++ ++ /* Which hook entry points are valid: bitmask. You can't ++ change this. */ ++ unsigned int valid_hooks; ++ ++ /* Number of entries */ ++ unsigned int num_entries; ++ ++ /* Total size of new entries */ ++ unsigned int size; ++ ++ /* Hook entry points. */ ++ unsigned int hook_entry[NF_INET_NUMHOOKS]; ++ ++ /* Underflow points. */ ++ unsigned int underflow[NF_INET_NUMHOOKS]; ++ ++ /* Information about old entries: */ ++ /* Number of counters (must be equal to current number of entries). */ ++ unsigned int num_counters; ++ /* The old entries' counters. */ ++ struct xt_counters *counters; ++ ++ /* The entries (hang off end: not really an array). */ ++ struct ip6t_entry entries[0]; ++}; ++ ++/* The argument to IP6T_SO_GET_ENTRIES. */ ++struct ip6t_get_entries { ++ /* Which table: user fills this in. */ ++ char name[XT_TABLE_MAXNAMELEN]; ++ ++ /* User fills this in: total entry size. */ ++ unsigned int size; ++ ++ /* The entries. */ ++ struct ip6t_entry entrytable[0]; ++}; ++ ++/* Helper functions */ ++static __inline__ struct xt_entry_target * ++ip6t_get_target(struct ip6t_entry *e) ++{ ++ return (void *)e + e->target_offset; ++} ++ ++/* ++ * Main firewall chains definitions and global var's definitions. ++ */ ++ ++#endif /* _IP6_TABLES_H */ +diff --git a/include/uapi/linux/netlink.h b/include/uapi/linux/netlink.h +new file mode 100644 +index 0000000..ec0690b +--- /dev/null ++++ b/include/uapi/linux/netlink.h +@@ -0,0 +1,246 @@ ++#ifndef __LINUX_NETLINK_H ++#define __LINUX_NETLINK_H ++ ++#include ++#include /* for __kernel_sa_family_t */ ++#include ++ ++#define NETLINK_ROUTE 0 /* Routing/device hook */ ++#define NETLINK_UNUSED 1 /* Unused number */ ++#define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */ ++#define NETLINK_FIREWALL 3 /* Unused number, formerly ip_queue */ ++#define NETLINK_SOCK_DIAG 4 /* socket monitoring */ ++#define NETLINK_NFLOG 5 /* netfilter/iptables ULOG */ ++#define NETLINK_XFRM 6 /* ipsec */ ++#define NETLINK_SELINUX 7 /* SELinux event notifications */ ++#define NETLINK_ISCSI 8 /* Open-iSCSI */ ++#define NETLINK_AUDIT 9 /* auditing */ ++#define NETLINK_FIB_LOOKUP 10 ++#define NETLINK_CONNECTOR 11 ++#define NETLINK_NETFILTER 12 /* netfilter subsystem */ ++#define NETLINK_IP6_FW 13 ++#define NETLINK_DNRTMSG 14 /* DECnet routing messages */ ++#define NETLINK_KOBJECT_UEVENT 15 /* Kernel messages to userspace */ ++#define NETLINK_GENERIC 16 ++/* leave room for NETLINK_DM (DM Events) */ ++#define NETLINK_SCSITRANSPORT 18 /* SCSI Transports */ ++#define NETLINK_ECRYPTFS 19 ++#define NETLINK_RDMA 20 ++#define NETLINK_CRYPTO 21 /* Crypto layer */ ++#define NETLINK_SMC 22 /* SMC monitoring */ ++ ++#define NETLINK_INET_DIAG NETLINK_SOCK_DIAG ++ ++#define MAX_LINKS 32 ++ ++struct sockaddr_nl { ++ __kernel_sa_family_t nl_family; /* AF_NETLINK */ ++ unsigned short nl_pad; /* zero */ ++ __u32 nl_pid; /* port ID */ ++ __u32 nl_groups; /* multicast groups mask */ ++}; ++ ++struct nlmsghdr { ++ __u32 nlmsg_len; /* Length of message including header */ ++ __u16 nlmsg_type; /* Message content */ ++ __u16 nlmsg_flags; /* Additional flags */ ++ __u32 nlmsg_seq; /* Sequence number */ ++ __u32 nlmsg_pid; /* Sending process port ID */ ++}; ++ ++/* Flags values */ ++ ++#define NLM_F_REQUEST 0x01 /* It is request message. */ ++#define NLM_F_MULTI 0x02 /* Multipart message, terminated by NLMSG_DONE */ ++#define NLM_F_ACK 0x04 /* Reply with ack, with zero or error code */ ++#define NLM_F_ECHO 0x08 /* Echo this request */ ++#define NLM_F_DUMP_INTR 0x10 /* Dump was inconsistent due to sequence change */ ++#define NLM_F_DUMP_FILTERED 0x20 /* Dump was filtered as requested */ ++ ++/* Modifiers to GET request */ ++#define NLM_F_ROOT 0x100 /* specify tree root */ ++#define NLM_F_MATCH 0x200 /* return all matching */ ++#define NLM_F_ATOMIC 0x400 /* atomic GET */ ++#define NLM_F_DUMP (NLM_F_ROOT|NLM_F_MATCH) ++ ++/* Modifiers to NEW request */ ++#define NLM_F_REPLACE 0x100 /* Override existing */ ++#define NLM_F_EXCL 0x200 /* Do not touch, if it exists */ ++#define NLM_F_CREATE 0x400 /* Create, if it does not exist */ ++#define NLM_F_APPEND 0x800 /* Add to end of list */ ++ ++/* Modifiers to DELETE request */ ++#define NLM_F_NONREC 0x100 /* Do not delete recursively */ ++ ++/* Flags for ACK message */ ++#define NLM_F_CAPPED 0x100 /* request was capped */ ++#define NLM_F_ACK_TLVS 0x200 /* extended ACK TVLs were included */ ++ ++/* ++ 4.4BSD ADD NLM_F_CREATE|NLM_F_EXCL ++ 4.4BSD CHANGE NLM_F_REPLACE ++ ++ True CHANGE NLM_F_CREATE|NLM_F_REPLACE ++ Append NLM_F_CREATE ++ Check NLM_F_EXCL ++ */ ++ ++#define NLMSG_ALIGNTO 4U ++#define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) ) ++#define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr))) ++#define NLMSG_LENGTH(len) ((len) + NLMSG_HDRLEN) ++#define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len)) ++#define NLMSG_DATA(nlh) ((void*)(((char*)nlh) + NLMSG_LENGTH(0))) ++#define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \ ++ (struct nlmsghdr*)(((char*)(nlh)) + NLMSG_ALIGN((nlh)->nlmsg_len))) ++#define NLMSG_OK(nlh,len) ((len) >= (int)sizeof(struct nlmsghdr) && \ ++ (nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && \ ++ (nlh)->nlmsg_len <= (len)) ++#define NLMSG_PAYLOAD(nlh,len) ((nlh)->nlmsg_len - NLMSG_SPACE((len))) ++ ++#define NLMSG_NOOP 0x1 /* Nothing. */ ++#define NLMSG_ERROR 0x2 /* Error */ ++#define NLMSG_DONE 0x3 /* End of a dump */ ++#define NLMSG_OVERRUN 0x4 /* Data lost */ ++ ++#define NLMSG_MIN_TYPE 0x10 /* < 0x10: reserved control messages */ ++ ++struct nlmsgerr { ++ int error; ++ struct nlmsghdr msg; ++ /* ++ * followed by the message contents unless NETLINK_CAP_ACK was set ++ * or the ACK indicates success (error == 0) ++ * message length is aligned with NLMSG_ALIGN() ++ */ ++ /* ++ * followed by TLVs defined in enum nlmsgerr_attrs ++ * if NETLINK_EXT_ACK was set ++ */ ++}; ++ ++/** ++ * enum nlmsgerr_attrs - nlmsgerr attributes ++ * @NLMSGERR_ATTR_UNUSED: unused ++ * @NLMSGERR_ATTR_MSG: error message string (string) ++ * @NLMSGERR_ATTR_OFFS: offset of the invalid attribute in the original ++ * message, counting from the beginning of the header (u32) ++ * @NLMSGERR_ATTR_COOKIE: arbitrary subsystem specific cookie to ++ * be used - in the success case - to identify a created ++ * object or operation or similar (binary) ++ * @__NLMSGERR_ATTR_MAX: number of attributes ++ * @NLMSGERR_ATTR_MAX: highest attribute number ++ */ ++enum nlmsgerr_attrs { ++ NLMSGERR_ATTR_UNUSED, ++ NLMSGERR_ATTR_MSG, ++ NLMSGERR_ATTR_OFFS, ++ NLMSGERR_ATTR_COOKIE, ++ ++ __NLMSGERR_ATTR_MAX, ++ NLMSGERR_ATTR_MAX = __NLMSGERR_ATTR_MAX - 1 ++}; ++ ++#define NETLINK_ADD_MEMBERSHIP 1 ++#define NETLINK_DROP_MEMBERSHIP 2 ++#define NETLINK_PKTINFO 3 ++#define NETLINK_BROADCAST_ERROR 4 ++#define NETLINK_NO_ENOBUFS 5 ++#define NETLINK_RX_RING 6 ++#define NETLINK_TX_RING 7 ++#define NETLINK_LISTEN_ALL_NSID 8 ++#define NETLINK_LIST_MEMBERSHIPS 9 ++#define NETLINK_CAP_ACK 10 ++#define NETLINK_EXT_ACK 11 ++ ++struct nl_pktinfo { ++ __u32 group; ++}; ++ ++struct nl_mmap_req { ++ unsigned int nm_block_size; ++ unsigned int nm_block_nr; ++ unsigned int nm_frame_size; ++ unsigned int nm_frame_nr; ++}; ++ ++struct nl_mmap_hdr { ++ unsigned int nm_status; ++ unsigned int nm_len; ++ __u32 nm_group; ++ /* credentials */ ++ __u32 nm_pid; ++ __u32 nm_uid; ++ __u32 nm_gid; ++}; ++ ++enum nl_mmap_status { ++ NL_MMAP_STATUS_UNUSED, ++ NL_MMAP_STATUS_RESERVED, ++ NL_MMAP_STATUS_VALID, ++ NL_MMAP_STATUS_COPY, ++ NL_MMAP_STATUS_SKIP, ++}; ++ ++#define NL_MMAP_MSG_ALIGNMENT NLMSG_ALIGNTO ++#define NL_MMAP_MSG_ALIGN(sz) __ALIGN_KERNEL(sz, NL_MMAP_MSG_ALIGNMENT) ++#define NL_MMAP_HDRLEN NL_MMAP_MSG_ALIGN(sizeof(struct nl_mmap_hdr)) ++ ++#define NET_MAJOR 36 /* Major 36 is reserved for networking */ ++ ++enum { ++ NETLINK_UNCONNECTED = 0, ++ NETLINK_CONNECTED, ++}; ++ ++/* ++ * <------- NLA_HDRLEN ------> <-- NLA_ALIGN(payload)--> ++ * +---------------------+- - -+- - - - - - - - - -+- - -+ ++ * | Header | Pad | Payload | Pad | ++ * | (struct nlattr) | ing | | ing | ++ * +---------------------+- - -+- - - - - - - - - -+- - -+ ++ * <-------------- nlattr->nla_len --------------> ++ */ ++ ++struct nlattr { ++ __u16 nla_len; ++ __u16 nla_type; ++}; ++ ++/* ++ * nla_type (16 bits) ++ * +---+---+-------------------------------+ ++ * | N | O | Attribute Type | ++ * +---+---+-------------------------------+ ++ * N := Carries nested attributes ++ * O := Payload stored in network byte order ++ * ++ * Note: The N and O flag are mutually exclusive. ++ */ ++#define NLA_F_NESTED (1 << 15) ++#define NLA_F_NET_BYTEORDER (1 << 14) ++#define NLA_TYPE_MASK ~(NLA_F_NESTED | NLA_F_NET_BYTEORDER) ++ ++#define NLA_ALIGNTO 4 ++#define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1)) ++#define NLA_HDRLEN ((int) NLA_ALIGN(sizeof(struct nlattr))) ++ ++/* Generic 32 bitflags attribute content sent to the kernel. ++ * ++ * The value is a bitmap that defines the values being set ++ * The selector is a bitmask that defines which value is legit ++ * ++ * Examples: ++ * value = 0x0, and selector = 0x1 ++ * implies we are selecting bit 1 and we want to set its value to 0. ++ * ++ * value = 0x2, and selector = 0x2 ++ * implies we are selecting bit 2 and we want to set its value to 1. ++ * ++ */ ++struct nla_bitfield32 { ++ __u32 value; ++ __u32 selector; ++}; ++ ++#endif /* __LINUX_NETLINK_H */ +diff --git a/include/uapi/linux/netlink_diag.h b/include/uapi/linux/netlink_diag.h +new file mode 100644 +index 0000000..c8c8c7d +--- /dev/null ++++ b/include/uapi/linux/netlink_diag.h +@@ -0,0 +1,64 @@ ++#ifndef __NETLINK_DIAG_H__ ++#define __NETLINK_DIAG_H__ ++ ++#include ++ ++struct netlink_diag_req { ++ __u8 sdiag_family; ++ __u8 sdiag_protocol; ++ __u16 pad; ++ __u32 ndiag_ino; ++ __u32 ndiag_show; ++ __u32 ndiag_cookie[2]; ++}; ++ ++struct netlink_diag_msg { ++ __u8 ndiag_family; ++ __u8 ndiag_type; ++ __u8 ndiag_protocol; ++ __u8 ndiag_state; ++ ++ __u32 ndiag_portid; ++ __u32 ndiag_dst_portid; ++ __u32 ndiag_dst_group; ++ __u32 ndiag_ino; ++ __u32 ndiag_cookie[2]; ++}; ++ ++struct netlink_diag_ring { ++ __u32 ndr_block_size; ++ __u32 ndr_block_nr; ++ __u32 ndr_frame_size; ++ __u32 ndr_frame_nr; ++}; ++ ++enum { ++ /* NETLINK_DIAG_NONE, standard nl API requires this attribute! */ ++ NETLINK_DIAG_MEMINFO, ++ NETLINK_DIAG_GROUPS, ++ NETLINK_DIAG_RX_RING, ++ NETLINK_DIAG_TX_RING, ++ NETLINK_DIAG_FLAGS, ++ ++ __NETLINK_DIAG_MAX, ++}; ++ ++#define NETLINK_DIAG_MAX (__NETLINK_DIAG_MAX - 1) ++ ++#define NDIAG_PROTO_ALL ((__u8) ~0) ++ ++#define NDIAG_SHOW_MEMINFO 0x00000001 /* show memory info of a socket */ ++#define NDIAG_SHOW_GROUPS 0x00000002 /* show groups of a netlink socket */ ++/* deprecated since 4.6 */ ++#define NDIAG_SHOW_RING_CFG 0x00000004 /* show ring configuration */ ++#define NDIAG_SHOW_FLAGS 0x00000008 /* show flags of a netlink socket */ ++ ++/* flags */ ++#define NDIAG_FLAG_CB_RUNNING 0x00000001 ++#define NDIAG_FLAG_PKTINFO 0x00000002 ++#define NDIAG_FLAG_BROADCAST_ERROR 0x00000004 ++#define NDIAG_FLAG_NO_ENOBUFS 0x00000008 ++#define NDIAG_FLAG_LISTEN_ALL_NSID 0x00000010 ++#define NDIAG_FLAG_CAP_ACK 0x00000020 ++ ++#endif +diff --git a/include/uapi/linux/packet_diag.h b/include/uapi/linux/packet_diag.h +new file mode 100644 +index 0000000..0c5d5dd +--- /dev/null ++++ b/include/uapi/linux/packet_diag.h +@@ -0,0 +1,80 @@ ++#ifndef __PACKET_DIAG_H__ ++#define __PACKET_DIAG_H__ ++ ++#include ++ ++struct packet_diag_req { ++ __u8 sdiag_family; ++ __u8 sdiag_protocol; ++ __u16 pad; ++ __u32 pdiag_ino; ++ __u32 pdiag_show; ++ __u32 pdiag_cookie[2]; ++}; ++ ++#define PACKET_SHOW_INFO 0x00000001 /* Basic packet_sk information */ ++#define PACKET_SHOW_MCLIST 0x00000002 /* A set of packet_diag_mclist-s */ ++#define PACKET_SHOW_RING_CFG 0x00000004 /* Rings configuration parameters */ ++#define PACKET_SHOW_FANOUT 0x00000008 ++#define PACKET_SHOW_MEMINFO 0x00000010 ++#define PACKET_SHOW_FILTER 0x00000020 ++ ++struct packet_diag_msg { ++ __u8 pdiag_family; ++ __u8 pdiag_type; ++ __u16 pdiag_num; ++ ++ __u32 pdiag_ino; ++ __u32 pdiag_cookie[2]; ++}; ++ ++enum { ++ /* PACKET_DIAG_NONE, standard nl API requires this attribute! */ ++ PACKET_DIAG_INFO, ++ PACKET_DIAG_MCLIST, ++ PACKET_DIAG_RX_RING, ++ PACKET_DIAG_TX_RING, ++ PACKET_DIAG_FANOUT, ++ PACKET_DIAG_UID, ++ PACKET_DIAG_MEMINFO, ++ PACKET_DIAG_FILTER, ++ ++ __PACKET_DIAG_MAX, ++}; ++ ++#define PACKET_DIAG_MAX (__PACKET_DIAG_MAX - 1) ++ ++struct packet_diag_info { ++ __u32 pdi_index; ++ __u32 pdi_version; ++ __u32 pdi_reserve; ++ __u32 pdi_copy_thresh; ++ __u32 pdi_tstamp; ++ __u32 pdi_flags; ++ ++#define PDI_RUNNING 0x1 ++#define PDI_AUXDATA 0x2 ++#define PDI_ORIGDEV 0x4 ++#define PDI_VNETHDR 0x8 ++#define PDI_LOSS 0x10 ++}; ++ ++struct packet_diag_mclist { ++ __u32 pdmc_index; ++ __u32 pdmc_count; ++ __u16 pdmc_type; ++ __u16 pdmc_alen; ++ __u8 pdmc_addr[32]; /* MAX_ADDR_LEN */ ++}; ++ ++struct packet_diag_ring { ++ __u32 pdr_block_size; ++ __u32 pdr_block_nr; ++ __u32 pdr_frame_size; ++ __u32 pdr_frame_nr; ++ __u32 pdr_retire_tmo; ++ __u32 pdr_sizeof_priv; ++ __u32 pdr_features; ++}; ++ ++#endif +diff --git a/include/uapi/linux/param.h b/include/uapi/linux/param.h +new file mode 100644 +index 0000000..092e92f +--- /dev/null ++++ b/include/uapi/linux/param.h +@@ -0,0 +1,6 @@ ++#ifndef _LINUX_PARAM_H ++#define _LINUX_PARAM_H ++ ++#include ++ ++#endif +diff --git a/include/uapi/linux/pfkeyv2.h b/include/uapi/linux/pfkeyv2.h +new file mode 100644 +index 0000000..ada7f01 +--- /dev/null ++++ b/include/uapi/linux/pfkeyv2.h +@@ -0,0 +1,383 @@ ++/* PF_KEY user interface, this is defined by rfc2367 so ++ * do not make arbitrary modifications or else this header ++ * file will not be compliant. ++ */ ++ ++#ifndef _LINUX_PFKEY2_H ++#define _LINUX_PFKEY2_H ++ ++#include ++ ++#define PF_KEY_V2 2 ++#define PFKEYV2_REVISION 199806L ++ ++struct sadb_msg { ++ __u8 sadb_msg_version; ++ __u8 sadb_msg_type; ++ __u8 sadb_msg_errno; ++ __u8 sadb_msg_satype; ++ __u16 sadb_msg_len; ++ __u16 sadb_msg_reserved; ++ __u32 sadb_msg_seq; ++ __u32 sadb_msg_pid; ++} __attribute__((packed)); ++/* sizeof(struct sadb_msg) == 16 */ ++ ++struct sadb_ext { ++ __u16 sadb_ext_len; ++ __u16 sadb_ext_type; ++} __attribute__((packed)); ++/* sizeof(struct sadb_ext) == 4 */ ++ ++struct sadb_sa { ++ __u16 sadb_sa_len; ++ __u16 sadb_sa_exttype; ++ __be32 sadb_sa_spi; ++ __u8 sadb_sa_replay; ++ __u8 sadb_sa_state; ++ __u8 sadb_sa_auth; ++ __u8 sadb_sa_encrypt; ++ __u32 sadb_sa_flags; ++} __attribute__((packed)); ++/* sizeof(struct sadb_sa) == 16 */ ++ ++struct sadb_lifetime { ++ __u16 sadb_lifetime_len; ++ __u16 sadb_lifetime_exttype; ++ __u32 sadb_lifetime_allocations; ++ __u64 sadb_lifetime_bytes; ++ __u64 sadb_lifetime_addtime; ++ __u64 sadb_lifetime_usetime; ++} __attribute__((packed)); ++/* sizeof(struct sadb_lifetime) == 32 */ ++ ++struct sadb_address { ++ __u16 sadb_address_len; ++ __u16 sadb_address_exttype; ++ __u8 sadb_address_proto; ++ __u8 sadb_address_prefixlen; ++ __u16 sadb_address_reserved; ++} __attribute__((packed)); ++/* sizeof(struct sadb_address) == 8 */ ++ ++struct sadb_key { ++ __u16 sadb_key_len; ++ __u16 sadb_key_exttype; ++ __u16 sadb_key_bits; ++ __u16 sadb_key_reserved; ++} __attribute__((packed)); ++/* sizeof(struct sadb_key) == 8 */ ++ ++struct sadb_ident { ++ __u16 sadb_ident_len; ++ __u16 sadb_ident_exttype; ++ __u16 sadb_ident_type; ++ __u16 sadb_ident_reserved; ++ __u64 sadb_ident_id; ++} __attribute__((packed)); ++/* sizeof(struct sadb_ident) == 16 */ ++ ++struct sadb_sens { ++ __u16 sadb_sens_len; ++ __u16 sadb_sens_exttype; ++ __u32 sadb_sens_dpd; ++ __u8 sadb_sens_sens_level; ++ __u8 sadb_sens_sens_len; ++ __u8 sadb_sens_integ_level; ++ __u8 sadb_sens_integ_len; ++ __u32 sadb_sens_reserved; ++} __attribute__((packed)); ++/* sizeof(struct sadb_sens) == 16 */ ++ ++/* followed by: ++ __u64 sadb_sens_bitmap[sens_len]; ++ __u64 sadb_integ_bitmap[integ_len]; */ ++ ++struct sadb_prop { ++ __u16 sadb_prop_len; ++ __u16 sadb_prop_exttype; ++ __u8 sadb_prop_replay; ++ __u8 sadb_prop_reserved[3]; ++} __attribute__((packed)); ++/* sizeof(struct sadb_prop) == 8 */ ++ ++/* followed by: ++ struct sadb_comb sadb_combs[(sadb_prop_len + ++ sizeof(__u64) - sizeof(struct sadb_prop)) / ++ sizeof(struct sadb_comb)]; */ ++ ++struct sadb_comb { ++ __u8 sadb_comb_auth; ++ __u8 sadb_comb_encrypt; ++ __u16 sadb_comb_flags; ++ __u16 sadb_comb_auth_minbits; ++ __u16 sadb_comb_auth_maxbits; ++ __u16 sadb_comb_encrypt_minbits; ++ __u16 sadb_comb_encrypt_maxbits; ++ __u32 sadb_comb_reserved; ++ __u32 sadb_comb_soft_allocations; ++ __u32 sadb_comb_hard_allocations; ++ __u64 sadb_comb_soft_bytes; ++ __u64 sadb_comb_hard_bytes; ++ __u64 sadb_comb_soft_addtime; ++ __u64 sadb_comb_hard_addtime; ++ __u64 sadb_comb_soft_usetime; ++ __u64 sadb_comb_hard_usetime; ++} __attribute__((packed)); ++/* sizeof(struct sadb_comb) == 72 */ ++ ++struct sadb_supported { ++ __u16 sadb_supported_len; ++ __u16 sadb_supported_exttype; ++ __u32 sadb_supported_reserved; ++} __attribute__((packed)); ++/* sizeof(struct sadb_supported) == 8 */ ++ ++/* followed by: ++ struct sadb_alg sadb_algs[(sadb_supported_len + ++ sizeof(__u64) - sizeof(struct sadb_supported)) / ++ sizeof(struct sadb_alg)]; */ ++ ++struct sadb_alg { ++ __u8 sadb_alg_id; ++ __u8 sadb_alg_ivlen; ++ __u16 sadb_alg_minbits; ++ __u16 sadb_alg_maxbits; ++ __u16 sadb_alg_reserved; ++} __attribute__((packed)); ++/* sizeof(struct sadb_alg) == 8 */ ++ ++struct sadb_spirange { ++ __u16 sadb_spirange_len; ++ __u16 sadb_spirange_exttype; ++ __u32 sadb_spirange_min; ++ __u32 sadb_spirange_max; ++ __u32 sadb_spirange_reserved; ++} __attribute__((packed)); ++/* sizeof(struct sadb_spirange) == 16 */ ++ ++struct sadb_x_kmprivate { ++ __u16 sadb_x_kmprivate_len; ++ __u16 sadb_x_kmprivate_exttype; ++ __u32 sadb_x_kmprivate_reserved; ++} __attribute__((packed)); ++/* sizeof(struct sadb_x_kmprivate) == 8 */ ++ ++struct sadb_x_sa2 { ++ __u16 sadb_x_sa2_len; ++ __u16 sadb_x_sa2_exttype; ++ __u8 sadb_x_sa2_mode; ++ __u8 sadb_x_sa2_reserved1; ++ __u16 sadb_x_sa2_reserved2; ++ __u32 sadb_x_sa2_sequence; ++ __u32 sadb_x_sa2_reqid; ++} __attribute__((packed)); ++/* sizeof(struct sadb_x_sa2) == 16 */ ++ ++struct sadb_x_policy { ++ __u16 sadb_x_policy_len; ++ __u16 sadb_x_policy_exttype; ++ __u16 sadb_x_policy_type; ++ __u8 sadb_x_policy_dir; ++ __u8 sadb_x_policy_reserved; ++ __u32 sadb_x_policy_id; ++ __u32 sadb_x_policy_priority; ++} __attribute__((packed)); ++/* sizeof(struct sadb_x_policy) == 16 */ ++ ++struct sadb_x_ipsecrequest { ++ __u16 sadb_x_ipsecrequest_len; ++ __u16 sadb_x_ipsecrequest_proto; ++ __u8 sadb_x_ipsecrequest_mode; ++ __u8 sadb_x_ipsecrequest_level; ++ __u16 sadb_x_ipsecrequest_reserved1; ++ __u32 sadb_x_ipsecrequest_reqid; ++ __u32 sadb_x_ipsecrequest_reserved2; ++} __attribute__((packed)); ++/* sizeof(struct sadb_x_ipsecrequest) == 16 */ ++ ++/* This defines the TYPE of Nat Traversal in use. Currently only one ++ * type of NAT-T is supported, draft-ietf-ipsec-udp-encaps-06 ++ */ ++struct sadb_x_nat_t_type { ++ __u16 sadb_x_nat_t_type_len; ++ __u16 sadb_x_nat_t_type_exttype; ++ __u8 sadb_x_nat_t_type_type; ++ __u8 sadb_x_nat_t_type_reserved[3]; ++} __attribute__((packed)); ++/* sizeof(struct sadb_x_nat_t_type) == 8 */ ++ ++/* Pass a NAT Traversal port (Source or Dest port) */ ++struct sadb_x_nat_t_port { ++ __u16 sadb_x_nat_t_port_len; ++ __u16 sadb_x_nat_t_port_exttype; ++ __be16 sadb_x_nat_t_port_port; ++ __u16 sadb_x_nat_t_port_reserved; ++} __attribute__((packed)); ++/* sizeof(struct sadb_x_nat_t_port) == 8 */ ++ ++/* Generic LSM security context */ ++struct sadb_x_sec_ctx { ++ __u16 sadb_x_sec_len; ++ __u16 sadb_x_sec_exttype; ++ __u8 sadb_x_ctx_alg; /* LSMs: e.g., selinux == 1 */ ++ __u8 sadb_x_ctx_doi; ++ __u16 sadb_x_ctx_len; ++} __attribute__((packed)); ++/* sizeof(struct sadb_sec_ctx) = 8 */ ++ ++/* Used by MIGRATE to pass addresses IKE will use to perform ++ * negotiation with the peer */ ++struct sadb_x_kmaddress { ++ __u16 sadb_x_kmaddress_len; ++ __u16 sadb_x_kmaddress_exttype; ++ __u32 sadb_x_kmaddress_reserved; ++} __attribute__((packed)); ++/* sizeof(struct sadb_x_kmaddress) == 8 */ ++ ++/* To specify the SA dump filter */ ++struct sadb_x_filter { ++ __u16 sadb_x_filter_len; ++ __u16 sadb_x_filter_exttype; ++ __u32 sadb_x_filter_saddr[4]; ++ __u32 sadb_x_filter_daddr[4]; ++ __u16 sadb_x_filter_family; ++ __u8 sadb_x_filter_splen; ++ __u8 sadb_x_filter_dplen; ++} __attribute__((packed)); ++/* sizeof(struct sadb_x_filter) == 40 */ ++ ++/* Message types */ ++#define SADB_RESERVED 0 ++#define SADB_GETSPI 1 ++#define SADB_UPDATE 2 ++#define SADB_ADD 3 ++#define SADB_DELETE 4 ++#define SADB_GET 5 ++#define SADB_ACQUIRE 6 ++#define SADB_REGISTER 7 ++#define SADB_EXPIRE 8 ++#define SADB_FLUSH 9 ++#define SADB_DUMP 10 ++#define SADB_X_PROMISC 11 ++#define SADB_X_PCHANGE 12 ++#define SADB_X_SPDUPDATE 13 ++#define SADB_X_SPDADD 14 ++#define SADB_X_SPDDELETE 15 ++#define SADB_X_SPDGET 16 ++#define SADB_X_SPDACQUIRE 17 ++#define SADB_X_SPDDUMP 18 ++#define SADB_X_SPDFLUSH 19 ++#define SADB_X_SPDSETIDX 20 ++#define SADB_X_SPDEXPIRE 21 ++#define SADB_X_SPDDELETE2 22 ++#define SADB_X_NAT_T_NEW_MAPPING 23 ++#define SADB_X_MIGRATE 24 ++#define SADB_MAX 24 ++ ++/* Security Association flags */ ++#define SADB_SAFLAGS_PFS 1 ++#define SADB_SAFLAGS_NOPMTUDISC 0x20000000 ++#define SADB_SAFLAGS_DECAP_DSCP 0x40000000 ++#define SADB_SAFLAGS_NOECN 0x80000000 ++ ++/* Security Association states */ ++#define SADB_SASTATE_LARVAL 0 ++#define SADB_SASTATE_MATURE 1 ++#define SADB_SASTATE_DYING 2 ++#define SADB_SASTATE_DEAD 3 ++#define SADB_SASTATE_MAX 3 ++ ++/* Security Association types */ ++#define SADB_SATYPE_UNSPEC 0 ++#define SADB_SATYPE_AH 2 ++#define SADB_SATYPE_ESP 3 ++#define SADB_SATYPE_RSVP 5 ++#define SADB_SATYPE_OSPFV2 6 ++#define SADB_SATYPE_RIPV2 7 ++#define SADB_SATYPE_MIP 8 ++#define SADB_X_SATYPE_IPCOMP 9 ++#define SADB_SATYPE_MAX 9 ++ ++/* Authentication algorithms */ ++#define SADB_AALG_NONE 0 ++#define SADB_AALG_MD5HMAC 2 ++#define SADB_AALG_SHA1HMAC 3 ++#define SADB_X_AALG_SHA2_256HMAC 5 ++#define SADB_X_AALG_SHA2_384HMAC 6 ++#define SADB_X_AALG_SHA2_512HMAC 7 ++#define SADB_X_AALG_RIPEMD160HMAC 8 ++#define SADB_X_AALG_AES_XCBC_MAC 9 ++#define SADB_X_AALG_NULL 251 /* kame */ ++#define SADB_AALG_MAX 251 ++ ++/* Encryption algorithms */ ++#define SADB_EALG_NONE 0 ++#define SADB_EALG_DESCBC 2 ++#define SADB_EALG_3DESCBC 3 ++#define SADB_X_EALG_CASTCBC 6 ++#define SADB_X_EALG_BLOWFISHCBC 7 ++#define SADB_EALG_NULL 11 ++#define SADB_X_EALG_AESCBC 12 ++#define SADB_X_EALG_AESCTR 13 ++#define SADB_X_EALG_AES_CCM_ICV8 14 ++#define SADB_X_EALG_AES_CCM_ICV12 15 ++#define SADB_X_EALG_AES_CCM_ICV16 16 ++#define SADB_X_EALG_AES_GCM_ICV8 18 ++#define SADB_X_EALG_AES_GCM_ICV12 19 ++#define SADB_X_EALG_AES_GCM_ICV16 20 ++#define SADB_X_EALG_CAMELLIACBC 22 ++#define SADB_X_EALG_NULL_AES_GMAC 23 ++#define SADB_EALG_MAX 253 /* last EALG */ ++/* private allocations should use 249-255 (RFC2407) */ ++#define SADB_X_EALG_SERPENTCBC 252 /* draft-ietf-ipsec-ciph-aes-cbc-00 */ ++#define SADB_X_EALG_TWOFISHCBC 253 /* draft-ietf-ipsec-ciph-aes-cbc-00 */ ++ ++/* Compression algorithms */ ++#define SADB_X_CALG_NONE 0 ++#define SADB_X_CALG_OUI 1 ++#define SADB_X_CALG_DEFLATE 2 ++#define SADB_X_CALG_LZS 3 ++#define SADB_X_CALG_LZJH 4 ++#define SADB_X_CALG_MAX 4 ++ ++/* Extension Header values */ ++#define SADB_EXT_RESERVED 0 ++#define SADB_EXT_SA 1 ++#define SADB_EXT_LIFETIME_CURRENT 2 ++#define SADB_EXT_LIFETIME_HARD 3 ++#define SADB_EXT_LIFETIME_SOFT 4 ++#define SADB_EXT_ADDRESS_SRC 5 ++#define SADB_EXT_ADDRESS_DST 6 ++#define SADB_EXT_ADDRESS_PROXY 7 ++#define SADB_EXT_KEY_AUTH 8 ++#define SADB_EXT_KEY_ENCRYPT 9 ++#define SADB_EXT_IDENTITY_SRC 10 ++#define SADB_EXT_IDENTITY_DST 11 ++#define SADB_EXT_SENSITIVITY 12 ++#define SADB_EXT_PROPOSAL 13 ++#define SADB_EXT_SUPPORTED_AUTH 14 ++#define SADB_EXT_SUPPORTED_ENCRYPT 15 ++#define SADB_EXT_SPIRANGE 16 ++#define SADB_X_EXT_KMPRIVATE 17 ++#define SADB_X_EXT_POLICY 18 ++#define SADB_X_EXT_SA2 19 ++/* The next four entries are for setting up NAT Traversal */ ++#define SADB_X_EXT_NAT_T_TYPE 20 ++#define SADB_X_EXT_NAT_T_SPORT 21 ++#define SADB_X_EXT_NAT_T_DPORT 22 ++#define SADB_X_EXT_NAT_T_OA 23 ++#define SADB_X_EXT_SEC_CTX 24 ++/* Used with MIGRATE to pass @ to IKE for negotiation */ ++#define SADB_X_EXT_KMADDRESS 25 ++#define SADB_X_EXT_FILTER 26 ++#define SADB_EXT_MAX 26 ++ ++/* Identity Extension values */ ++#define SADB_IDENTTYPE_RESERVED 0 ++#define SADB_IDENTTYPE_PREFIX 1 ++#define SADB_IDENTTYPE_FQDN 2 ++#define SADB_IDENTTYPE_USERFQDN 3 ++#define SADB_IDENTTYPE_MAX 3 ++ ++#endif /* !(_LINUX_PFKEY2_H) */ +diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h +new file mode 100644 +index 0000000..d5e2bf6 +--- /dev/null ++++ b/include/uapi/linux/pkt_cls.h +@@ -0,0 +1,569 @@ ++#ifndef __LINUX_PKT_CLS_H ++#define __LINUX_PKT_CLS_H ++ ++#include ++#include ++ ++#define TC_COOKIE_MAX_SIZE 16 ++ ++/* Action attributes */ ++enum { ++ TCA_ACT_UNSPEC, ++ TCA_ACT_KIND, ++ TCA_ACT_OPTIONS, ++ TCA_ACT_INDEX, ++ TCA_ACT_STATS, ++ TCA_ACT_PAD, ++ TCA_ACT_COOKIE, ++ __TCA_ACT_MAX ++}; ++ ++#define TCA_ACT_MAX __TCA_ACT_MAX ++#define TCA_OLD_COMPAT (TCA_ACT_MAX+1) ++#define TCA_ACT_MAX_PRIO 32 ++#define TCA_ACT_BIND 1 ++#define TCA_ACT_NOBIND 0 ++#define TCA_ACT_UNBIND 1 ++#define TCA_ACT_NOUNBIND 0 ++#define TCA_ACT_REPLACE 1 ++#define TCA_ACT_NOREPLACE 0 ++ ++#define TC_ACT_UNSPEC (-1) ++#define TC_ACT_OK 0 ++#define TC_ACT_RECLASSIFY 1 ++#define TC_ACT_SHOT 2 ++#define TC_ACT_PIPE 3 ++#define TC_ACT_STOLEN 4 ++#define TC_ACT_QUEUED 5 ++#define TC_ACT_REPEAT 6 ++#define TC_ACT_REDIRECT 7 ++#define TC_ACT_TRAP 8 /* For hw path, this means "trap to cpu" ++ * and don't further process the frame ++ * in hardware. For sw path, this is ++ * equivalent of TC_ACT_STOLEN - drop ++ * the skb and act like everything ++ * is alright. ++ */ ++ ++/* There is a special kind of actions called "extended actions", ++ * which need a value parameter. These have a local opcode located in ++ * the highest nibble, starting from 1. The rest of the bits ++ * are used to carry the value. These two parts together make ++ * a combined opcode. ++ */ ++#define __TC_ACT_EXT_SHIFT 28 ++#define __TC_ACT_EXT(local) ((local) << __TC_ACT_EXT_SHIFT) ++#define TC_ACT_EXT_VAL_MASK ((1 << __TC_ACT_EXT_SHIFT) - 1) ++#define TC_ACT_EXT_CMP(combined, opcode) \ ++ (((combined) & (~TC_ACT_EXT_VAL_MASK)) == opcode) ++ ++#define TC_ACT_JUMP __TC_ACT_EXT(1) ++#define TC_ACT_GOTO_CHAIN __TC_ACT_EXT(2) ++ ++/* Action type identifiers*/ ++enum { ++ TCA_ID_UNSPEC=0, ++ TCA_ID_POLICE=1, ++ /* other actions go here */ ++ __TCA_ID_MAX=255 ++}; ++ ++#define TCA_ID_MAX __TCA_ID_MAX ++ ++struct tc_police { ++ __u32 index; ++ int action; ++#define TC_POLICE_UNSPEC TC_ACT_UNSPEC ++#define TC_POLICE_OK TC_ACT_OK ++#define TC_POLICE_RECLASSIFY TC_ACT_RECLASSIFY ++#define TC_POLICE_SHOT TC_ACT_SHOT ++#define TC_POLICE_PIPE TC_ACT_PIPE ++ ++ __u32 limit; ++ __u32 burst; ++ __u32 mtu; ++ struct tc_ratespec rate; ++ struct tc_ratespec peakrate; ++ int refcnt; ++ int bindcnt; ++ __u32 capab; ++}; ++ ++struct tcf_t { ++ __u64 install; ++ __u64 lastuse; ++ __u64 expires; ++ __u64 firstuse; ++}; ++ ++struct tc_cnt { ++ int refcnt; ++ int bindcnt; ++}; ++ ++#define tc_gen \ ++ __u32 index; \ ++ __u32 capab; \ ++ int action; \ ++ int refcnt; \ ++ int bindcnt ++ ++enum { ++ TCA_POLICE_UNSPEC, ++ TCA_POLICE_TBF, ++ TCA_POLICE_RATE, ++ TCA_POLICE_PEAKRATE, ++ TCA_POLICE_AVRATE, ++ TCA_POLICE_RESULT, ++ TCA_POLICE_TM, ++ TCA_POLICE_PAD, ++ __TCA_POLICE_MAX ++#define TCA_POLICE_RESULT TCA_POLICE_RESULT ++}; ++ ++#define TCA_POLICE_MAX (__TCA_POLICE_MAX - 1) ++ ++/* tca flags definitions */ ++#define TCA_CLS_FLAGS_SKIP_HW (1 << 0) /* don't offload filter to HW */ ++#define TCA_CLS_FLAGS_SKIP_SW (1 << 1) /* don't use filter in SW */ ++#define TCA_CLS_FLAGS_IN_HW (1 << 2) /* filter is offloaded to HW */ ++#define TCA_CLS_FLAGS_NOT_IN_HW (1 << 3) /* filter isn't offloaded to HW */ ++ ++/* U32 filters */ ++ ++#define TC_U32_HTID(h) ((h)&0xFFF00000) ++#define TC_U32_USERHTID(h) (TC_U32_HTID(h)>>20) ++#define TC_U32_HASH(h) (((h)>>12)&0xFF) ++#define TC_U32_NODE(h) ((h)&0xFFF) ++#define TC_U32_KEY(h) ((h)&0xFFFFF) ++#define TC_U32_UNSPEC 0 ++#define TC_U32_ROOT (0xFFF00000) ++ ++enum { ++ TCA_U32_UNSPEC, ++ TCA_U32_CLASSID, ++ TCA_U32_HASH, ++ TCA_U32_LINK, ++ TCA_U32_DIVISOR, ++ TCA_U32_SEL, ++ TCA_U32_POLICE, ++ TCA_U32_ACT, ++ TCA_U32_INDEV, ++ TCA_U32_PCNT, ++ TCA_U32_MARK, ++ TCA_U32_FLAGS, ++ TCA_U32_PAD, ++ __TCA_U32_MAX ++}; ++ ++#define TCA_U32_MAX (__TCA_U32_MAX - 1) ++ ++struct tc_u32_key { ++ __be32 mask; ++ __be32 val; ++ int off; ++ int offmask; ++}; ++ ++struct tc_u32_sel { ++ unsigned char flags; ++ unsigned char offshift; ++ unsigned char nkeys; ++ ++ __be16 offmask; ++ __u16 off; ++ short offoff; ++ ++ short hoff; ++ __be32 hmask; ++ struct tc_u32_key keys[0]; ++}; ++ ++struct tc_u32_mark { ++ __u32 val; ++ __u32 mask; ++ __u32 success; ++}; ++ ++struct tc_u32_pcnt { ++ __u64 rcnt; ++ __u64 rhit; ++ __u64 kcnts[0]; ++}; ++ ++/* Flags */ ++ ++#define TC_U32_TERMINAL 1 ++#define TC_U32_OFFSET 2 ++#define TC_U32_VAROFFSET 4 ++#define TC_U32_EAT 8 ++ ++#define TC_U32_MAXDEPTH 8 ++ ++ ++/* RSVP filter */ ++ ++enum { ++ TCA_RSVP_UNSPEC, ++ TCA_RSVP_CLASSID, ++ TCA_RSVP_DST, ++ TCA_RSVP_SRC, ++ TCA_RSVP_PINFO, ++ TCA_RSVP_POLICE, ++ TCA_RSVP_ACT, ++ __TCA_RSVP_MAX ++}; ++ ++#define TCA_RSVP_MAX (__TCA_RSVP_MAX - 1 ) ++ ++struct tc_rsvp_gpi { ++ __u32 key; ++ __u32 mask; ++ int offset; ++}; ++ ++struct tc_rsvp_pinfo { ++ struct tc_rsvp_gpi dpi; ++ struct tc_rsvp_gpi spi; ++ __u8 protocol; ++ __u8 tunnelid; ++ __u8 tunnelhdr; ++ __u8 pad; ++}; ++ ++/* ROUTE filter */ ++ ++enum { ++ TCA_ROUTE4_UNSPEC, ++ TCA_ROUTE4_CLASSID, ++ TCA_ROUTE4_TO, ++ TCA_ROUTE4_FROM, ++ TCA_ROUTE4_IIF, ++ TCA_ROUTE4_POLICE, ++ TCA_ROUTE4_ACT, ++ __TCA_ROUTE4_MAX ++}; ++ ++#define TCA_ROUTE4_MAX (__TCA_ROUTE4_MAX - 1) ++ ++ ++/* FW filter */ ++ ++enum { ++ TCA_FW_UNSPEC, ++ TCA_FW_CLASSID, ++ TCA_FW_POLICE, ++ TCA_FW_INDEV, /* used by CONFIG_NET_CLS_IND */ ++ TCA_FW_ACT, /* used by CONFIG_NET_CLS_ACT */ ++ TCA_FW_MASK, ++ __TCA_FW_MAX ++}; ++ ++#define TCA_FW_MAX (__TCA_FW_MAX - 1) ++ ++/* TC index filter */ ++ ++enum { ++ TCA_TCINDEX_UNSPEC, ++ TCA_TCINDEX_HASH, ++ TCA_TCINDEX_MASK, ++ TCA_TCINDEX_SHIFT, ++ TCA_TCINDEX_FALL_THROUGH, ++ TCA_TCINDEX_CLASSID, ++ TCA_TCINDEX_POLICE, ++ TCA_TCINDEX_ACT, ++ __TCA_TCINDEX_MAX ++}; ++ ++#define TCA_TCINDEX_MAX (__TCA_TCINDEX_MAX - 1) ++ ++/* Flow filter */ ++ ++enum { ++ FLOW_KEY_SRC, ++ FLOW_KEY_DST, ++ FLOW_KEY_PROTO, ++ FLOW_KEY_PROTO_SRC, ++ FLOW_KEY_PROTO_DST, ++ FLOW_KEY_IIF, ++ FLOW_KEY_PRIORITY, ++ FLOW_KEY_MARK, ++ FLOW_KEY_NFCT, ++ FLOW_KEY_NFCT_SRC, ++ FLOW_KEY_NFCT_DST, ++ FLOW_KEY_NFCT_PROTO_SRC, ++ FLOW_KEY_NFCT_PROTO_DST, ++ FLOW_KEY_RTCLASSID, ++ FLOW_KEY_SKUID, ++ FLOW_KEY_SKGID, ++ FLOW_KEY_VLAN_TAG, ++ FLOW_KEY_RXHASH, ++ __FLOW_KEY_MAX, ++}; ++ ++#define FLOW_KEY_MAX (__FLOW_KEY_MAX - 1) ++ ++enum { ++ FLOW_MODE_MAP, ++ FLOW_MODE_HASH, ++}; ++ ++enum { ++ TCA_FLOW_UNSPEC, ++ TCA_FLOW_KEYS, ++ TCA_FLOW_MODE, ++ TCA_FLOW_BASECLASS, ++ TCA_FLOW_RSHIFT, ++ TCA_FLOW_ADDEND, ++ TCA_FLOW_MASK, ++ TCA_FLOW_XOR, ++ TCA_FLOW_DIVISOR, ++ TCA_FLOW_ACT, ++ TCA_FLOW_POLICE, ++ TCA_FLOW_EMATCHES, ++ TCA_FLOW_PERTURB, ++ __TCA_FLOW_MAX ++}; ++ ++#define TCA_FLOW_MAX (__TCA_FLOW_MAX - 1) ++ ++/* Basic filter */ ++ ++enum { ++ TCA_BASIC_UNSPEC, ++ TCA_BASIC_CLASSID, ++ TCA_BASIC_EMATCHES, ++ TCA_BASIC_ACT, ++ TCA_BASIC_POLICE, ++ __TCA_BASIC_MAX ++}; ++ ++#define TCA_BASIC_MAX (__TCA_BASIC_MAX - 1) ++ ++ ++/* Cgroup classifier */ ++ ++enum { ++ TCA_CGROUP_UNSPEC, ++ TCA_CGROUP_ACT, ++ TCA_CGROUP_POLICE, ++ TCA_CGROUP_EMATCHES, ++ __TCA_CGROUP_MAX, ++}; ++ ++#define TCA_CGROUP_MAX (__TCA_CGROUP_MAX - 1) ++ ++/* BPF classifier */ ++ ++#define TCA_BPF_FLAG_ACT_DIRECT (1 << 0) ++ ++enum { ++ TCA_BPF_UNSPEC, ++ TCA_BPF_ACT, ++ TCA_BPF_POLICE, ++ TCA_BPF_CLASSID, ++ TCA_BPF_OPS_LEN, ++ TCA_BPF_OPS, ++ TCA_BPF_FD, ++ TCA_BPF_NAME, ++ TCA_BPF_FLAGS, ++ TCA_BPF_FLAGS_GEN, ++ TCA_BPF_TAG, ++ TCA_BPF_ID, ++ __TCA_BPF_MAX, ++}; ++ ++#define TCA_BPF_MAX (__TCA_BPF_MAX - 1) ++ ++/* Flower classifier */ ++ ++enum { ++ TCA_FLOWER_UNSPEC, ++ TCA_FLOWER_CLASSID, ++ TCA_FLOWER_INDEV, ++ TCA_FLOWER_ACT, ++ TCA_FLOWER_KEY_ETH_DST, /* ETH_ALEN */ ++ TCA_FLOWER_KEY_ETH_DST_MASK, /* ETH_ALEN */ ++ TCA_FLOWER_KEY_ETH_SRC, /* ETH_ALEN */ ++ TCA_FLOWER_KEY_ETH_SRC_MASK, /* ETH_ALEN */ ++ TCA_FLOWER_KEY_ETH_TYPE, /* be16 */ ++ TCA_FLOWER_KEY_IP_PROTO, /* u8 */ ++ TCA_FLOWER_KEY_IPV4_SRC, /* be32 */ ++ TCA_FLOWER_KEY_IPV4_SRC_MASK, /* be32 */ ++ TCA_FLOWER_KEY_IPV4_DST, /* be32 */ ++ TCA_FLOWER_KEY_IPV4_DST_MASK, /* be32 */ ++ TCA_FLOWER_KEY_IPV6_SRC, /* struct in6_addr */ ++ TCA_FLOWER_KEY_IPV6_SRC_MASK, /* struct in6_addr */ ++ TCA_FLOWER_KEY_IPV6_DST, /* struct in6_addr */ ++ TCA_FLOWER_KEY_IPV6_DST_MASK, /* struct in6_addr */ ++ TCA_FLOWER_KEY_TCP_SRC, /* be16 */ ++ TCA_FLOWER_KEY_TCP_DST, /* be16 */ ++ TCA_FLOWER_KEY_UDP_SRC, /* be16 */ ++ TCA_FLOWER_KEY_UDP_DST, /* be16 */ ++ ++ TCA_FLOWER_FLAGS, ++ TCA_FLOWER_KEY_VLAN_ID, /* be16 */ ++ TCA_FLOWER_KEY_VLAN_PRIO, /* u8 */ ++ TCA_FLOWER_KEY_VLAN_ETH_TYPE, /* be16 */ ++ ++ TCA_FLOWER_KEY_ENC_KEY_ID, /* be32 */ ++ TCA_FLOWER_KEY_ENC_IPV4_SRC, /* be32 */ ++ TCA_FLOWER_KEY_ENC_IPV4_SRC_MASK,/* be32 */ ++ TCA_FLOWER_KEY_ENC_IPV4_DST, /* be32 */ ++ TCA_FLOWER_KEY_ENC_IPV4_DST_MASK,/* be32 */ ++ TCA_FLOWER_KEY_ENC_IPV6_SRC, /* struct in6_addr */ ++ TCA_FLOWER_KEY_ENC_IPV6_SRC_MASK,/* struct in6_addr */ ++ TCA_FLOWER_KEY_ENC_IPV6_DST, /* struct in6_addr */ ++ TCA_FLOWER_KEY_ENC_IPV6_DST_MASK,/* struct in6_addr */ ++ ++ TCA_FLOWER_KEY_TCP_SRC_MASK, /* be16 */ ++ TCA_FLOWER_KEY_TCP_DST_MASK, /* be16 */ ++ TCA_FLOWER_KEY_UDP_SRC_MASK, /* be16 */ ++ TCA_FLOWER_KEY_UDP_DST_MASK, /* be16 */ ++ TCA_FLOWER_KEY_SCTP_SRC_MASK, /* be16 */ ++ TCA_FLOWER_KEY_SCTP_DST_MASK, /* be16 */ ++ ++ TCA_FLOWER_KEY_SCTP_SRC, /* be16 */ ++ TCA_FLOWER_KEY_SCTP_DST, /* be16 */ ++ ++ TCA_FLOWER_KEY_ENC_UDP_SRC_PORT, /* be16 */ ++ TCA_FLOWER_KEY_ENC_UDP_SRC_PORT_MASK, /* be16 */ ++ TCA_FLOWER_KEY_ENC_UDP_DST_PORT, /* be16 */ ++ TCA_FLOWER_KEY_ENC_UDP_DST_PORT_MASK, /* be16 */ ++ ++ TCA_FLOWER_KEY_FLAGS, /* be32 */ ++ TCA_FLOWER_KEY_FLAGS_MASK, /* be32 */ ++ ++ TCA_FLOWER_KEY_ICMPV4_CODE, /* u8 */ ++ TCA_FLOWER_KEY_ICMPV4_CODE_MASK,/* u8 */ ++ TCA_FLOWER_KEY_ICMPV4_TYPE, /* u8 */ ++ TCA_FLOWER_KEY_ICMPV4_TYPE_MASK,/* u8 */ ++ TCA_FLOWER_KEY_ICMPV6_CODE, /* u8 */ ++ TCA_FLOWER_KEY_ICMPV6_CODE_MASK,/* u8 */ ++ TCA_FLOWER_KEY_ICMPV6_TYPE, /* u8 */ ++ TCA_FLOWER_KEY_ICMPV6_TYPE_MASK,/* u8 */ ++ ++ TCA_FLOWER_KEY_ARP_SIP, /* be32 */ ++ TCA_FLOWER_KEY_ARP_SIP_MASK, /* be32 */ ++ TCA_FLOWER_KEY_ARP_TIP, /* be32 */ ++ TCA_FLOWER_KEY_ARP_TIP_MASK, /* be32 */ ++ TCA_FLOWER_KEY_ARP_OP, /* u8 */ ++ TCA_FLOWER_KEY_ARP_OP_MASK, /* u8 */ ++ TCA_FLOWER_KEY_ARP_SHA, /* ETH_ALEN */ ++ TCA_FLOWER_KEY_ARP_SHA_MASK, /* ETH_ALEN */ ++ TCA_FLOWER_KEY_ARP_THA, /* ETH_ALEN */ ++ TCA_FLOWER_KEY_ARP_THA_MASK, /* ETH_ALEN */ ++ ++ TCA_FLOWER_KEY_MPLS_TTL, /* u8 - 8 bits */ ++ TCA_FLOWER_KEY_MPLS_BOS, /* u8 - 1 bit */ ++ TCA_FLOWER_KEY_MPLS_TC, /* u8 - 3 bits */ ++ TCA_FLOWER_KEY_MPLS_LABEL, /* be32 - 20 bits */ ++ ++ TCA_FLOWER_KEY_TCP_FLAGS, /* be16 */ ++ TCA_FLOWER_KEY_TCP_FLAGS_MASK, /* be16 */ ++ ++ TCA_FLOWER_KEY_IP_TOS, /* u8 */ ++ TCA_FLOWER_KEY_IP_TOS_MASK, /* u8 */ ++ TCA_FLOWER_KEY_IP_TTL, /* u8 */ ++ TCA_FLOWER_KEY_IP_TTL_MASK, /* u8 */ ++ ++ __TCA_FLOWER_MAX, ++}; ++ ++#define TCA_FLOWER_MAX (__TCA_FLOWER_MAX - 1) ++ ++enum { ++ TCA_FLOWER_KEY_FLAGS_IS_FRAGMENT = (1 << 0), ++}; ++ ++/* Match-all classifier */ ++ ++enum { ++ TCA_MATCHALL_UNSPEC, ++ TCA_MATCHALL_CLASSID, ++ TCA_MATCHALL_ACT, ++ TCA_MATCHALL_FLAGS, ++ __TCA_MATCHALL_MAX, ++}; ++ ++#define TCA_MATCHALL_MAX (__TCA_MATCHALL_MAX - 1) ++ ++/* Extended Matches */ ++ ++struct tcf_ematch_tree_hdr { ++ __u16 nmatches; ++ __u16 progid; ++}; ++ ++enum { ++ TCA_EMATCH_TREE_UNSPEC, ++ TCA_EMATCH_TREE_HDR, ++ TCA_EMATCH_TREE_LIST, ++ __TCA_EMATCH_TREE_MAX ++}; ++#define TCA_EMATCH_TREE_MAX (__TCA_EMATCH_TREE_MAX - 1) ++ ++struct tcf_ematch_hdr { ++ __u16 matchid; ++ __u16 kind; ++ __u16 flags; ++ __u16 pad; /* currently unused */ ++}; ++ ++/* 0 1 ++ * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 ++ * +-----------------------+-+-+---+ ++ * | Unused |S|I| R | ++ * +-----------------------+-+-+---+ ++ * ++ * R(2) ::= relation to next ematch ++ * where: 0 0 END (last ematch) ++ * 0 1 AND ++ * 1 0 OR ++ * 1 1 Unused (invalid) ++ * I(1) ::= invert result ++ * S(1) ::= simple payload ++ */ ++#define TCF_EM_REL_END 0 ++#define TCF_EM_REL_AND (1<<0) ++#define TCF_EM_REL_OR (1<<1) ++#define TCF_EM_INVERT (1<<2) ++#define TCF_EM_SIMPLE (1<<3) ++ ++#define TCF_EM_REL_MASK 3 ++#define TCF_EM_REL_VALID(v) (((v) & TCF_EM_REL_MASK) != TCF_EM_REL_MASK) ++ ++enum { ++ TCF_LAYER_LINK, ++ TCF_LAYER_NETWORK, ++ TCF_LAYER_TRANSPORT, ++ __TCF_LAYER_MAX ++}; ++#define TCF_LAYER_MAX (__TCF_LAYER_MAX - 1) ++ ++/* Ematch type assignments ++ * 1..32767 Reserved for ematches inside kernel tree ++ * 32768..65535 Free to use, not reliable ++ */ ++#define TCF_EM_CONTAINER 0 ++#define TCF_EM_CMP 1 ++#define TCF_EM_NBYTE 2 ++#define TCF_EM_U32 3 ++#define TCF_EM_META 4 ++#define TCF_EM_TEXT 5 ++#define TCF_EM_VLAN 6 ++#define TCF_EM_CANID 7 ++#define TCF_EM_IPSET 8 ++#define TCF_EM_MAX 8 ++ ++enum { ++ TCF_EM_PROG_TC ++}; ++ ++enum { ++ TCF_EM_OPND_EQ, ++ TCF_EM_OPND_GT, ++ TCF_EM_OPND_LT ++}; ++ ++#endif +diff --git a/include/uapi/linux/pkt_sched.h b/include/uapi/linux/pkt_sched.h +new file mode 100644 +index 0000000..099bf55 +--- /dev/null ++++ b/include/uapi/linux/pkt_sched.h +@@ -0,0 +1,874 @@ ++#ifndef __LINUX_PKT_SCHED_H ++#define __LINUX_PKT_SCHED_H ++ ++#include ++ ++/* Logical priority bands not depending on specific packet scheduler. ++ Every scheduler will map them to real traffic classes, if it has ++ no more precise mechanism to classify packets. ++ ++ These numbers have no special meaning, though their coincidence ++ with obsolete IPv6 values is not occasional :-). New IPv6 drafts ++ preferred full anarchy inspired by diffserv group. ++ ++ Note: TC_PRIO_BESTEFFORT does not mean that it is the most unhappy ++ class, actually, as rule it will be handled with more care than ++ filler or even bulk. ++ */ ++ ++#define TC_PRIO_BESTEFFORT 0 ++#define TC_PRIO_FILLER 1 ++#define TC_PRIO_BULK 2 ++#define TC_PRIO_INTERACTIVE_BULK 4 ++#define TC_PRIO_INTERACTIVE 6 ++#define TC_PRIO_CONTROL 7 ++ ++#define TC_PRIO_MAX 15 ++ ++/* Generic queue statistics, available for all the elements. ++ Particular schedulers may have also their private records. ++ */ ++ ++struct tc_stats { ++ __u64 bytes; /* Number of enqueued bytes */ ++ __u32 packets; /* Number of enqueued packets */ ++ __u32 drops; /* Packets dropped because of lack of resources */ ++ __u32 overlimits; /* Number of throttle events when this ++ * flow goes out of allocated bandwidth */ ++ __u32 bps; /* Current flow byte rate */ ++ __u32 pps; /* Current flow packet rate */ ++ __u32 qlen; ++ __u32 backlog; ++}; ++ ++struct tc_estimator { ++ signed char interval; ++ unsigned char ewma_log; ++}; ++ ++/* "Handles" ++ --------- ++ ++ All the traffic control objects have 32bit identifiers, or "handles". ++ ++ They can be considered as opaque numbers from user API viewpoint, ++ but actually they always consist of two fields: major and ++ minor numbers, which are interpreted by kernel specially, ++ that may be used by applications, though not recommended. ++ ++ F.e. qdisc handles always have minor number equal to zero, ++ classes (or flows) have major equal to parent qdisc major, and ++ minor uniquely identifying class inside qdisc. ++ ++ Macros to manipulate handles: ++ */ ++ ++#define TC_H_MAJ_MASK (0xFFFF0000U) ++#define TC_H_MIN_MASK (0x0000FFFFU) ++#define TC_H_MAJ(h) ((h)&TC_H_MAJ_MASK) ++#define TC_H_MIN(h) ((h)&TC_H_MIN_MASK) ++#define TC_H_MAKE(maj,min) (((maj)&TC_H_MAJ_MASK)|((min)&TC_H_MIN_MASK)) ++ ++#define TC_H_UNSPEC (0U) ++#define TC_H_ROOT (0xFFFFFFFFU) ++#define TC_H_INGRESS (0xFFFFFFF1U) ++#define TC_H_CLSACT TC_H_INGRESS ++ ++#define TC_H_MIN_INGRESS 0xFFF2U ++#define TC_H_MIN_EGRESS 0xFFF3U ++ ++/* Need to corrospond to iproute2 tc/tc_core.h "enum link_layer" */ ++enum tc_link_layer { ++ TC_LINKLAYER_UNAWARE, /* Indicate unaware old iproute2 util */ ++ TC_LINKLAYER_ETHERNET, ++ TC_LINKLAYER_ATM, ++}; ++#define TC_LINKLAYER_MASK 0x0F /* limit use to lower 4 bits */ ++ ++struct tc_ratespec { ++ unsigned char cell_log; ++ __u8 linklayer; /* lower 4 bits */ ++ unsigned short overhead; ++ short cell_align; ++ unsigned short mpu; ++ __u32 rate; ++}; ++ ++#define TC_RTAB_SIZE 1024 ++ ++struct tc_sizespec { ++ unsigned char cell_log; ++ unsigned char size_log; ++ short cell_align; ++ int overhead; ++ unsigned int linklayer; ++ unsigned int mpu; ++ unsigned int mtu; ++ unsigned int tsize; ++}; ++ ++enum { ++ TCA_STAB_UNSPEC, ++ TCA_STAB_BASE, ++ TCA_STAB_DATA, ++ __TCA_STAB_MAX ++}; ++ ++#define TCA_STAB_MAX (__TCA_STAB_MAX - 1) ++ ++/* FIFO section */ ++ ++struct tc_fifo_qopt { ++ __u32 limit; /* Queue length: bytes for bfifo, packets for pfifo */ ++}; ++ ++/* PRIO section */ ++ ++#define TCQ_PRIO_BANDS 16 ++#define TCQ_MIN_PRIO_BANDS 2 ++ ++struct tc_prio_qopt { ++ int bands; /* Number of bands */ ++ __u8 priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> PRIO band */ ++}; ++ ++/* MULTIQ section */ ++ ++struct tc_multiq_qopt { ++ __u16 bands; /* Number of bands */ ++ __u16 max_bands; /* Maximum number of queues */ ++}; ++ ++/* PLUG section */ ++ ++#define TCQ_PLUG_BUFFER 0 ++#define TCQ_PLUG_RELEASE_ONE 1 ++#define TCQ_PLUG_RELEASE_INDEFINITE 2 ++#define TCQ_PLUG_LIMIT 3 ++ ++struct tc_plug_qopt { ++ /* TCQ_PLUG_BUFFER: Inset a plug into the queue and ++ * buffer any incoming packets ++ * TCQ_PLUG_RELEASE_ONE: Dequeue packets from queue head ++ * to beginning of the next plug. ++ * TCQ_PLUG_RELEASE_INDEFINITE: Dequeue all packets from queue. ++ * Stop buffering packets until the next TCQ_PLUG_BUFFER ++ * command is received (just act as a pass-thru queue). ++ * TCQ_PLUG_LIMIT: Increase/decrease queue size ++ */ ++ int action; ++ __u32 limit; ++}; ++ ++/* TBF section */ ++ ++struct tc_tbf_qopt { ++ struct tc_ratespec rate; ++ struct tc_ratespec peakrate; ++ __u32 limit; ++ __u32 buffer; ++ __u32 mtu; ++}; ++ ++enum { ++ TCA_TBF_UNSPEC, ++ TCA_TBF_PARMS, ++ TCA_TBF_RTAB, ++ TCA_TBF_PTAB, ++ TCA_TBF_RATE64, ++ TCA_TBF_PRATE64, ++ TCA_TBF_BURST, ++ TCA_TBF_PBURST, ++ TCA_TBF_PAD, ++ __TCA_TBF_MAX, ++}; ++ ++#define TCA_TBF_MAX (__TCA_TBF_MAX - 1) ++ ++ ++/* TEQL section */ ++ ++/* TEQL does not require any parameters */ ++ ++/* SFQ section */ ++ ++struct tc_sfq_qopt { ++ unsigned quantum; /* Bytes per round allocated to flow */ ++ int perturb_period; /* Period of hash perturbation */ ++ __u32 limit; /* Maximal packets in queue */ ++ unsigned divisor; /* Hash divisor */ ++ unsigned flows; /* Maximal number of flows */ ++}; ++ ++struct tc_sfqred_stats { ++ __u32 prob_drop; /* Early drops, below max threshold */ ++ __u32 forced_drop; /* Early drops, after max threshold */ ++ __u32 prob_mark; /* Marked packets, below max threshold */ ++ __u32 forced_mark; /* Marked packets, after max threshold */ ++ __u32 prob_mark_head; /* Marked packets, below max threshold */ ++ __u32 forced_mark_head;/* Marked packets, after max threshold */ ++}; ++ ++struct tc_sfq_qopt_v1 { ++ struct tc_sfq_qopt v0; ++ unsigned int depth; /* max number of packets per flow */ ++ unsigned int headdrop; ++/* SFQRED parameters */ ++ __u32 limit; /* HARD maximal flow queue length (bytes) */ ++ __u32 qth_min; /* Min average length threshold (bytes) */ ++ __u32 qth_max; /* Max average length threshold (bytes) */ ++ unsigned char Wlog; /* log(W) */ ++ unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */ ++ unsigned char Scell_log; /* cell size for idle damping */ ++ unsigned char flags; ++ __u32 max_P; /* probability, high resolution */ ++/* SFQRED stats */ ++ struct tc_sfqred_stats stats; ++}; ++ ++ ++struct tc_sfq_xstats { ++ __s32 allot; ++}; ++ ++/* RED section */ ++ ++enum { ++ TCA_RED_UNSPEC, ++ TCA_RED_PARMS, ++ TCA_RED_STAB, ++ TCA_RED_MAX_P, ++ __TCA_RED_MAX, ++}; ++ ++#define TCA_RED_MAX (__TCA_RED_MAX - 1) ++ ++struct tc_red_qopt { ++ __u32 limit; /* HARD maximal queue length (bytes) */ ++ __u32 qth_min; /* Min average length threshold (bytes) */ ++ __u32 qth_max; /* Max average length threshold (bytes) */ ++ unsigned char Wlog; /* log(W) */ ++ unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */ ++ unsigned char Scell_log; /* cell size for idle damping */ ++ unsigned char flags; ++#define TC_RED_ECN 1 ++#define TC_RED_HARDDROP 2 ++#define TC_RED_ADAPTATIVE 4 ++}; ++ ++struct tc_red_xstats { ++ __u32 early; /* Early drops */ ++ __u32 pdrop; /* Drops due to queue limits */ ++ __u32 other; /* Drops due to drop() calls */ ++ __u32 marked; /* Marked packets */ ++}; ++ ++/* GRED section */ ++ ++#define MAX_DPs 16 ++ ++enum { ++ TCA_GRED_UNSPEC, ++ TCA_GRED_PARMS, ++ TCA_GRED_STAB, ++ TCA_GRED_DPS, ++ TCA_GRED_MAX_P, ++ TCA_GRED_LIMIT, ++ __TCA_GRED_MAX, ++}; ++ ++#define TCA_GRED_MAX (__TCA_GRED_MAX - 1) ++ ++struct tc_gred_qopt { ++ __u32 limit; /* HARD maximal queue length (bytes) */ ++ __u32 qth_min; /* Min average length threshold (bytes) */ ++ __u32 qth_max; /* Max average length threshold (bytes) */ ++ __u32 DP; /* up to 2^32 DPs */ ++ __u32 backlog; ++ __u32 qave; ++ __u32 forced; ++ __u32 early; ++ __u32 other; ++ __u32 pdrop; ++ __u8 Wlog; /* log(W) */ ++ __u8 Plog; /* log(P_max/(qth_max-qth_min)) */ ++ __u8 Scell_log; /* cell size for idle damping */ ++ __u8 prio; /* prio of this VQ */ ++ __u32 packets; ++ __u32 bytesin; ++}; ++ ++/* gred setup */ ++struct tc_gred_sopt { ++ __u32 DPs; ++ __u32 def_DP; ++ __u8 grio; ++ __u8 flags; ++ __u16 pad1; ++}; ++ ++/* CHOKe section */ ++ ++enum { ++ TCA_CHOKE_UNSPEC, ++ TCA_CHOKE_PARMS, ++ TCA_CHOKE_STAB, ++ TCA_CHOKE_MAX_P, ++ __TCA_CHOKE_MAX, ++}; ++ ++#define TCA_CHOKE_MAX (__TCA_CHOKE_MAX - 1) ++ ++struct tc_choke_qopt { ++ __u32 limit; /* Hard queue length (packets) */ ++ __u32 qth_min; /* Min average threshold (packets) */ ++ __u32 qth_max; /* Max average threshold (packets) */ ++ unsigned char Wlog; /* log(W) */ ++ unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */ ++ unsigned char Scell_log; /* cell size for idle damping */ ++ unsigned char flags; /* see RED flags */ ++}; ++ ++struct tc_choke_xstats { ++ __u32 early; /* Early drops */ ++ __u32 pdrop; /* Drops due to queue limits */ ++ __u32 other; /* Drops due to drop() calls */ ++ __u32 marked; /* Marked packets */ ++ __u32 matched; /* Drops due to flow match */ ++}; ++ ++/* HTB section */ ++#define TC_HTB_NUMPRIO 8 ++#define TC_HTB_MAXDEPTH 8 ++#define TC_HTB_PROTOVER 3 /* the same as HTB and TC's major */ ++ ++struct tc_htb_opt { ++ struct tc_ratespec rate; ++ struct tc_ratespec ceil; ++ __u32 buffer; ++ __u32 cbuffer; ++ __u32 quantum; ++ __u32 level; /* out only */ ++ __u32 prio; ++}; ++struct tc_htb_glob { ++ __u32 version; /* to match HTB/TC */ ++ __u32 rate2quantum; /* bps->quantum divisor */ ++ __u32 defcls; /* default class number */ ++ __u32 debug; /* debug flags */ ++ ++ /* stats */ ++ __u32 direct_pkts; /* count of non shaped packets */ ++}; ++enum { ++ TCA_HTB_UNSPEC, ++ TCA_HTB_PARMS, ++ TCA_HTB_INIT, ++ TCA_HTB_CTAB, ++ TCA_HTB_RTAB, ++ TCA_HTB_DIRECT_QLEN, ++ TCA_HTB_RATE64, ++ TCA_HTB_CEIL64, ++ TCA_HTB_PAD, ++ __TCA_HTB_MAX, ++}; ++ ++#define TCA_HTB_MAX (__TCA_HTB_MAX - 1) ++ ++struct tc_htb_xstats { ++ __u32 lends; ++ __u32 borrows; ++ __u32 giants; /* too big packets (rate will not be accurate) */ ++ __u32 tokens; ++ __u32 ctokens; ++}; ++ ++/* HFSC section */ ++ ++struct tc_hfsc_qopt { ++ __u16 defcls; /* default class */ ++}; ++ ++struct tc_service_curve { ++ __u32 m1; /* slope of the first segment in bps */ ++ __u32 d; /* x-projection of the first segment in us */ ++ __u32 m2; /* slope of the second segment in bps */ ++}; ++ ++struct tc_hfsc_stats { ++ __u64 work; /* total work done */ ++ __u64 rtwork; /* work done by real-time criteria */ ++ __u32 period; /* current period */ ++ __u32 level; /* class level in hierarchy */ ++}; ++ ++enum { ++ TCA_HFSC_UNSPEC, ++ TCA_HFSC_RSC, ++ TCA_HFSC_FSC, ++ TCA_HFSC_USC, ++ __TCA_HFSC_MAX, ++}; ++ ++#define TCA_HFSC_MAX (__TCA_HFSC_MAX - 1) ++ ++ ++/* CBQ section */ ++ ++#define TC_CBQ_MAXPRIO 8 ++#define TC_CBQ_MAXLEVEL 8 ++#define TC_CBQ_DEF_EWMA 5 ++ ++struct tc_cbq_lssopt { ++ unsigned char change; ++ unsigned char flags; ++#define TCF_CBQ_LSS_BOUNDED 1 ++#define TCF_CBQ_LSS_ISOLATED 2 ++ unsigned char ewma_log; ++ unsigned char level; ++#define TCF_CBQ_LSS_FLAGS 1 ++#define TCF_CBQ_LSS_EWMA 2 ++#define TCF_CBQ_LSS_MAXIDLE 4 ++#define TCF_CBQ_LSS_MINIDLE 8 ++#define TCF_CBQ_LSS_OFFTIME 0x10 ++#define TCF_CBQ_LSS_AVPKT 0x20 ++ __u32 maxidle; ++ __u32 minidle; ++ __u32 offtime; ++ __u32 avpkt; ++}; ++ ++struct tc_cbq_wrropt { ++ unsigned char flags; ++ unsigned char priority; ++ unsigned char cpriority; ++ unsigned char __reserved; ++ __u32 allot; ++ __u32 weight; ++}; ++ ++struct tc_cbq_ovl { ++ unsigned char strategy; ++#define TC_CBQ_OVL_CLASSIC 0 ++#define TC_CBQ_OVL_DELAY 1 ++#define TC_CBQ_OVL_LOWPRIO 2 ++#define TC_CBQ_OVL_DROP 3 ++#define TC_CBQ_OVL_RCLASSIC 4 ++ unsigned char priority2; ++ __u16 pad; ++ __u32 penalty; ++}; ++ ++struct tc_cbq_police { ++ unsigned char police; ++ unsigned char __res1; ++ unsigned short __res2; ++}; ++ ++struct tc_cbq_fopt { ++ __u32 split; ++ __u32 defmap; ++ __u32 defchange; ++}; ++ ++struct tc_cbq_xstats { ++ __u32 borrows; ++ __u32 overactions; ++ __s32 avgidle; ++ __s32 undertime; ++}; ++ ++enum { ++ TCA_CBQ_UNSPEC, ++ TCA_CBQ_LSSOPT, ++ TCA_CBQ_WRROPT, ++ TCA_CBQ_FOPT, ++ TCA_CBQ_OVL_STRATEGY, ++ TCA_CBQ_RATE, ++ TCA_CBQ_RTAB, ++ TCA_CBQ_POLICE, ++ __TCA_CBQ_MAX, ++}; ++ ++#define TCA_CBQ_MAX (__TCA_CBQ_MAX - 1) ++ ++/* dsmark section */ ++ ++enum { ++ TCA_DSMARK_UNSPEC, ++ TCA_DSMARK_INDICES, ++ TCA_DSMARK_DEFAULT_INDEX, ++ TCA_DSMARK_SET_TC_INDEX, ++ TCA_DSMARK_MASK, ++ TCA_DSMARK_VALUE, ++ __TCA_DSMARK_MAX, ++}; ++ ++#define TCA_DSMARK_MAX (__TCA_DSMARK_MAX - 1) ++ ++/* ATM section */ ++ ++enum { ++ TCA_ATM_UNSPEC, ++ TCA_ATM_FD, /* file/socket descriptor */ ++ TCA_ATM_PTR, /* pointer to descriptor - later */ ++ TCA_ATM_HDR, /* LL header */ ++ TCA_ATM_EXCESS, /* excess traffic class (0 for CLP) */ ++ TCA_ATM_ADDR, /* PVC address (for output only) */ ++ TCA_ATM_STATE, /* VC state (ATM_VS_*; for output only) */ ++ __TCA_ATM_MAX, ++}; ++ ++#define TCA_ATM_MAX (__TCA_ATM_MAX - 1) ++ ++/* Network emulator */ ++ ++enum { ++ TCA_NETEM_UNSPEC, ++ TCA_NETEM_CORR, ++ TCA_NETEM_DELAY_DIST, ++ TCA_NETEM_REORDER, ++ TCA_NETEM_CORRUPT, ++ TCA_NETEM_LOSS, ++ TCA_NETEM_RATE, ++ TCA_NETEM_ECN, ++ TCA_NETEM_RATE64, ++ TCA_NETEM_PAD, ++ __TCA_NETEM_MAX, ++}; ++ ++#define TCA_NETEM_MAX (__TCA_NETEM_MAX - 1) ++ ++struct tc_netem_qopt { ++ __u32 latency; /* added delay (us) */ ++ __u32 limit; /* fifo limit (packets) */ ++ __u32 loss; /* random packet loss (0=none ~0=100%) */ ++ __u32 gap; /* re-ordering gap (0 for none) */ ++ __u32 duplicate; /* random packet dup (0=none ~0=100%) */ ++ __u32 jitter; /* random jitter in latency (us) */ ++}; ++ ++struct tc_netem_corr { ++ __u32 delay_corr; /* delay correlation */ ++ __u32 loss_corr; /* packet loss correlation */ ++ __u32 dup_corr; /* duplicate correlation */ ++}; ++ ++struct tc_netem_reorder { ++ __u32 probability; ++ __u32 correlation; ++}; ++ ++struct tc_netem_corrupt { ++ __u32 probability; ++ __u32 correlation; ++}; ++ ++struct tc_netem_rate { ++ __u32 rate; /* byte/s */ ++ __s32 packet_overhead; ++ __u32 cell_size; ++ __s32 cell_overhead; ++}; ++ ++enum { ++ NETEM_LOSS_UNSPEC, ++ NETEM_LOSS_GI, /* General Intuitive - 4 state model */ ++ NETEM_LOSS_GE, /* Gilbert Elliot models */ ++ __NETEM_LOSS_MAX ++}; ++#define NETEM_LOSS_MAX (__NETEM_LOSS_MAX - 1) ++ ++/* State transition probabilities for 4 state model */ ++struct tc_netem_gimodel { ++ __u32 p13; ++ __u32 p31; ++ __u32 p32; ++ __u32 p14; ++ __u32 p23; ++}; ++ ++/* Gilbert-Elliot models */ ++struct tc_netem_gemodel { ++ __u32 p; ++ __u32 r; ++ __u32 h; ++ __u32 k1; ++}; ++ ++#define NETEM_DIST_SCALE 8192 ++#define NETEM_DIST_MAX 16384 ++ ++/* DRR */ ++ ++enum { ++ TCA_DRR_UNSPEC, ++ TCA_DRR_QUANTUM, ++ __TCA_DRR_MAX ++}; ++ ++#define TCA_DRR_MAX (__TCA_DRR_MAX - 1) ++ ++struct tc_drr_stats { ++ __u32 deficit; ++}; ++ ++/* MQPRIO */ ++#define TC_QOPT_BITMASK 15 ++#define TC_QOPT_MAX_QUEUE 16 ++ ++enum { ++ TC_MQPRIO_HW_OFFLOAD_NONE, /* no offload requested */ ++ TC_MQPRIO_HW_OFFLOAD_TCS, /* offload TCs, no queue counts */ ++ __TC_MQPRIO_HW_OFFLOAD_MAX ++}; ++ ++#define TC_MQPRIO_HW_OFFLOAD_MAX (__TC_MQPRIO_HW_OFFLOAD_MAX - 1) ++ ++struct tc_mqprio_qopt { ++ __u8 num_tc; ++ __u8 prio_tc_map[TC_QOPT_BITMASK + 1]; ++ __u8 hw; ++ __u16 count[TC_QOPT_MAX_QUEUE]; ++ __u16 offset[TC_QOPT_MAX_QUEUE]; ++}; ++ ++/* SFB */ ++ ++enum { ++ TCA_SFB_UNSPEC, ++ TCA_SFB_PARMS, ++ __TCA_SFB_MAX, ++}; ++ ++#define TCA_SFB_MAX (__TCA_SFB_MAX - 1) ++ ++/* ++ * Note: increment, decrement are Q0.16 fixed-point values. ++ */ ++struct tc_sfb_qopt { ++ __u32 rehash_interval; /* delay between hash move, in ms */ ++ __u32 warmup_time; /* double buffering warmup time in ms (warmup_time < rehash_interval) */ ++ __u32 max; /* max len of qlen_min */ ++ __u32 bin_size; /* maximum queue length per bin */ ++ __u32 increment; /* probability increment, (d1 in Blue) */ ++ __u32 decrement; /* probability decrement, (d2 in Blue) */ ++ __u32 limit; /* max SFB queue length */ ++ __u32 penalty_rate; /* inelastic flows are rate limited to 'rate' pps */ ++ __u32 penalty_burst; ++}; ++ ++struct tc_sfb_xstats { ++ __u32 earlydrop; ++ __u32 penaltydrop; ++ __u32 bucketdrop; ++ __u32 queuedrop; ++ __u32 childdrop; /* drops in child qdisc */ ++ __u32 marked; ++ __u32 maxqlen; ++ __u32 maxprob; ++ __u32 avgprob; ++}; ++ ++#define SFB_MAX_PROB 0xFFFF ++ ++/* QFQ */ ++enum { ++ TCA_QFQ_UNSPEC, ++ TCA_QFQ_WEIGHT, ++ TCA_QFQ_LMAX, ++ __TCA_QFQ_MAX ++}; ++ ++#define TCA_QFQ_MAX (__TCA_QFQ_MAX - 1) ++ ++struct tc_qfq_stats { ++ __u32 weight; ++ __u32 lmax; ++}; ++ ++/* CODEL */ ++ ++enum { ++ TCA_CODEL_UNSPEC, ++ TCA_CODEL_TARGET, ++ TCA_CODEL_LIMIT, ++ TCA_CODEL_INTERVAL, ++ TCA_CODEL_ECN, ++ TCA_CODEL_CE_THRESHOLD, ++ __TCA_CODEL_MAX ++}; ++ ++#define TCA_CODEL_MAX (__TCA_CODEL_MAX - 1) ++ ++struct tc_codel_xstats { ++ __u32 maxpacket; /* largest packet we've seen so far */ ++ __u32 count; /* how many drops we've done since the last time we ++ * entered dropping state ++ */ ++ __u32 lastcount; /* count at entry to dropping state */ ++ __u32 ldelay; /* in-queue delay seen by most recently dequeued packet */ ++ __s32 drop_next; /* time to drop next packet */ ++ __u32 drop_overlimit; /* number of time max qdisc packet limit was hit */ ++ __u32 ecn_mark; /* number of packets we ECN marked instead of dropped */ ++ __u32 dropping; /* are we in dropping state ? */ ++ __u32 ce_mark; /* number of CE marked packets because of ce_threshold */ ++}; ++ ++/* FQ_CODEL */ ++ ++enum { ++ TCA_FQ_CODEL_UNSPEC, ++ TCA_FQ_CODEL_TARGET, ++ TCA_FQ_CODEL_LIMIT, ++ TCA_FQ_CODEL_INTERVAL, ++ TCA_FQ_CODEL_ECN, ++ TCA_FQ_CODEL_FLOWS, ++ TCA_FQ_CODEL_QUANTUM, ++ TCA_FQ_CODEL_CE_THRESHOLD, ++ TCA_FQ_CODEL_DROP_BATCH_SIZE, ++ TCA_FQ_CODEL_MEMORY_LIMIT, ++ __TCA_FQ_CODEL_MAX ++}; ++ ++#define TCA_FQ_CODEL_MAX (__TCA_FQ_CODEL_MAX - 1) ++ ++enum { ++ TCA_FQ_CODEL_XSTATS_QDISC, ++ TCA_FQ_CODEL_XSTATS_CLASS, ++}; ++ ++struct tc_fq_codel_qd_stats { ++ __u32 maxpacket; /* largest packet we've seen so far */ ++ __u32 drop_overlimit; /* number of time max qdisc ++ * packet limit was hit ++ */ ++ __u32 ecn_mark; /* number of packets we ECN marked ++ * instead of being dropped ++ */ ++ __u32 new_flow_count; /* number of time packets ++ * created a 'new flow' ++ */ ++ __u32 new_flows_len; /* count of flows in new list */ ++ __u32 old_flows_len; /* count of flows in old list */ ++ __u32 ce_mark; /* packets above ce_threshold */ ++ __u32 memory_usage; /* in bytes */ ++ __u32 drop_overmemory; ++}; ++ ++struct tc_fq_codel_cl_stats { ++ __s32 deficit; ++ __u32 ldelay; /* in-queue delay seen by most recently ++ * dequeued packet ++ */ ++ __u32 count; ++ __u32 lastcount; ++ __u32 dropping; ++ __s32 drop_next; ++}; ++ ++struct tc_fq_codel_xstats { ++ __u32 type; ++ union { ++ struct tc_fq_codel_qd_stats qdisc_stats; ++ struct tc_fq_codel_cl_stats class_stats; ++ }; ++}; ++ ++/* FQ */ ++ ++enum { ++ TCA_FQ_UNSPEC, ++ ++ TCA_FQ_PLIMIT, /* limit of total number of packets in queue */ ++ ++ TCA_FQ_FLOW_PLIMIT, /* limit of packets per flow */ ++ ++ TCA_FQ_QUANTUM, /* RR quantum */ ++ ++ TCA_FQ_INITIAL_QUANTUM, /* RR quantum for new flow */ ++ ++ TCA_FQ_RATE_ENABLE, /* enable/disable rate limiting */ ++ ++ TCA_FQ_FLOW_DEFAULT_RATE,/* obsolete, do not use */ ++ ++ TCA_FQ_FLOW_MAX_RATE, /* per flow max rate */ ++ ++ TCA_FQ_BUCKETS_LOG, /* log2(number of buckets) */ ++ ++ TCA_FQ_FLOW_REFILL_DELAY, /* flow credit refill delay in usec */ ++ ++ TCA_FQ_ORPHAN_MASK, /* mask applied to orphaned skb hashes */ ++ ++ TCA_FQ_LOW_RATE_THRESHOLD, /* per packet delay under this rate */ ++ ++ __TCA_FQ_MAX ++}; ++ ++#define TCA_FQ_MAX (__TCA_FQ_MAX - 1) ++ ++struct tc_fq_qd_stats { ++ __u64 gc_flows; ++ __u64 highprio_packets; ++ __u64 tcp_retrans; ++ __u64 throttled; ++ __u64 flows_plimit; ++ __u64 pkts_too_long; ++ __u64 allocation_errors; ++ __s64 time_next_delayed_flow; ++ __u32 flows; ++ __u32 inactive_flows; ++ __u32 throttled_flows; ++ __u32 unthrottle_latency_ns; ++}; ++ ++/* Heavy-Hitter Filter */ ++ ++enum { ++ TCA_HHF_UNSPEC, ++ TCA_HHF_BACKLOG_LIMIT, ++ TCA_HHF_QUANTUM, ++ TCA_HHF_HH_FLOWS_LIMIT, ++ TCA_HHF_RESET_TIMEOUT, ++ TCA_HHF_ADMIT_BYTES, ++ TCA_HHF_EVICT_TIMEOUT, ++ TCA_HHF_NON_HH_WEIGHT, ++ __TCA_HHF_MAX ++}; ++ ++#define TCA_HHF_MAX (__TCA_HHF_MAX - 1) ++ ++struct tc_hhf_xstats { ++ __u32 drop_overlimit; /* number of times max qdisc packet limit ++ * was hit ++ */ ++ __u32 hh_overlimit; /* number of times max heavy-hitters was hit */ ++ __u32 hh_tot_count; /* number of captured heavy-hitters so far */ ++ __u32 hh_cur_count; /* number of current heavy-hitters */ ++}; ++ ++/* PIE */ ++enum { ++ TCA_PIE_UNSPEC, ++ TCA_PIE_TARGET, ++ TCA_PIE_LIMIT, ++ TCA_PIE_TUPDATE, ++ TCA_PIE_ALPHA, ++ TCA_PIE_BETA, ++ TCA_PIE_ECN, ++ TCA_PIE_BYTEMODE, ++ __TCA_PIE_MAX ++}; ++#define TCA_PIE_MAX (__TCA_PIE_MAX - 1) ++ ++struct tc_pie_xstats { ++ __u32 prob; /* current probability */ ++ __u32 delay; /* current delay in ms */ ++ __u32 avg_dq_rate; /* current average dq_rate in bits/pie_time */ ++ __u32 packets_in; /* total number of packets enqueued */ ++ __u32 dropped; /* packets dropped due to pie_action */ ++ __u32 overlimit; /* dropped due to lack of space in queue */ ++ __u32 maxq; /* maximum queue size */ ++ __u32 ecn_mark; /* packets marked with ecn*/ ++}; ++#endif +diff --git a/include/uapi/linux/posix_types.h b/include/uapi/linux/posix_types.h +new file mode 100644 +index 0000000..988f76e +--- /dev/null ++++ b/include/uapi/linux/posix_types.h +@@ -0,0 +1,37 @@ ++#ifndef _LINUX_POSIX_TYPES_H ++#define _LINUX_POSIX_TYPES_H ++ ++#include ++ ++/* ++ * This allows for 1024 file descriptors: if NR_OPEN is ever grown ++ * beyond that you'll have to change this too. But 1024 fd's seem to be ++ * enough even for such "real" unices like OSF/1, so hopefully this is ++ * one limit that doesn't have to be changed [again]. ++ * ++ * Note that POSIX wants the FD_CLEAR(fd,fdsetp) defines to be in ++ * (and thus ) - but this is a more logical ++ * place for them. Solved by having dummy defines in . ++ */ ++ ++/* ++ * This macro may have been defined in . But we always ++ * use the one here. ++ */ ++#undef __FD_SETSIZE ++#define __FD_SETSIZE 1024 ++ ++typedef struct { ++ unsigned long fds_bits[__FD_SETSIZE / (8 * sizeof(long))]; ++} __kernel_fd_set; ++ ++/* Type of a signal handler. */ ++typedef void (*__kernel_sighandler_t)(int); ++ ++/* Type of a SYSV IPC key. */ ++typedef int __kernel_key_t; ++typedef int __kernel_mqd_t; ++ ++#include ++ ++#endif /* _LINUX_POSIX_TYPES_H */ +diff --git a/include/uapi/linux/rtnetlink.h b/include/uapi/linux/rtnetlink.h +new file mode 100644 +index 0000000..813e9e0 +--- /dev/null ++++ b/include/uapi/linux/rtnetlink.h +@@ -0,0 +1,718 @@ ++#ifndef __LINUX_RTNETLINK_H ++#define __LINUX_RTNETLINK_H ++ ++#include ++#include ++#include ++#include ++#include ++ ++/* rtnetlink families. Values up to 127 are reserved for real address ++ * families, values above 128 may be used arbitrarily. ++ */ ++#define RTNL_FAMILY_IPMR 128 ++#define RTNL_FAMILY_IP6MR 129 ++#define RTNL_FAMILY_MAX 129 ++ ++/**** ++ * Routing/neighbour discovery messages. ++ ****/ ++ ++/* Types of messages */ ++ ++enum { ++ RTM_BASE = 16, ++#define RTM_BASE RTM_BASE ++ ++ RTM_NEWLINK = 16, ++#define RTM_NEWLINK RTM_NEWLINK ++ RTM_DELLINK, ++#define RTM_DELLINK RTM_DELLINK ++ RTM_GETLINK, ++#define RTM_GETLINK RTM_GETLINK ++ RTM_SETLINK, ++#define RTM_SETLINK RTM_SETLINK ++ ++ RTM_NEWADDR = 20, ++#define RTM_NEWADDR RTM_NEWADDR ++ RTM_DELADDR, ++#define RTM_DELADDR RTM_DELADDR ++ RTM_GETADDR, ++#define RTM_GETADDR RTM_GETADDR ++ ++ RTM_NEWROUTE = 24, ++#define RTM_NEWROUTE RTM_NEWROUTE ++ RTM_DELROUTE, ++#define RTM_DELROUTE RTM_DELROUTE ++ RTM_GETROUTE, ++#define RTM_GETROUTE RTM_GETROUTE ++ ++ RTM_NEWNEIGH = 28, ++#define RTM_NEWNEIGH RTM_NEWNEIGH ++ RTM_DELNEIGH, ++#define RTM_DELNEIGH RTM_DELNEIGH ++ RTM_GETNEIGH, ++#define RTM_GETNEIGH RTM_GETNEIGH ++ ++ RTM_NEWRULE = 32, ++#define RTM_NEWRULE RTM_NEWRULE ++ RTM_DELRULE, ++#define RTM_DELRULE RTM_DELRULE ++ RTM_GETRULE, ++#define RTM_GETRULE RTM_GETRULE ++ ++ RTM_NEWQDISC = 36, ++#define RTM_NEWQDISC RTM_NEWQDISC ++ RTM_DELQDISC, ++#define RTM_DELQDISC RTM_DELQDISC ++ RTM_GETQDISC, ++#define RTM_GETQDISC RTM_GETQDISC ++ ++ RTM_NEWTCLASS = 40, ++#define RTM_NEWTCLASS RTM_NEWTCLASS ++ RTM_DELTCLASS, ++#define RTM_DELTCLASS RTM_DELTCLASS ++ RTM_GETTCLASS, ++#define RTM_GETTCLASS RTM_GETTCLASS ++ ++ RTM_NEWTFILTER = 44, ++#define RTM_NEWTFILTER RTM_NEWTFILTER ++ RTM_DELTFILTER, ++#define RTM_DELTFILTER RTM_DELTFILTER ++ RTM_GETTFILTER, ++#define RTM_GETTFILTER RTM_GETTFILTER ++ ++ RTM_NEWACTION = 48, ++#define RTM_NEWACTION RTM_NEWACTION ++ RTM_DELACTION, ++#define RTM_DELACTION RTM_DELACTION ++ RTM_GETACTION, ++#define RTM_GETACTION RTM_GETACTION ++ ++ RTM_NEWPREFIX = 52, ++#define RTM_NEWPREFIX RTM_NEWPREFIX ++ ++ RTM_GETMULTICAST = 58, ++#define RTM_GETMULTICAST RTM_GETMULTICAST ++ ++ RTM_GETANYCAST = 62, ++#define RTM_GETANYCAST RTM_GETANYCAST ++ ++ RTM_NEWNEIGHTBL = 64, ++#define RTM_NEWNEIGHTBL RTM_NEWNEIGHTBL ++ RTM_GETNEIGHTBL = 66, ++#define RTM_GETNEIGHTBL RTM_GETNEIGHTBL ++ RTM_SETNEIGHTBL, ++#define RTM_SETNEIGHTBL RTM_SETNEIGHTBL ++ ++ RTM_NEWNDUSEROPT = 68, ++#define RTM_NEWNDUSEROPT RTM_NEWNDUSEROPT ++ ++ RTM_NEWADDRLABEL = 72, ++#define RTM_NEWADDRLABEL RTM_NEWADDRLABEL ++ RTM_DELADDRLABEL, ++#define RTM_DELADDRLABEL RTM_DELADDRLABEL ++ RTM_GETADDRLABEL, ++#define RTM_GETADDRLABEL RTM_GETADDRLABEL ++ ++ RTM_GETDCB = 78, ++#define RTM_GETDCB RTM_GETDCB ++ RTM_SETDCB, ++#define RTM_SETDCB RTM_SETDCB ++ ++ RTM_NEWNETCONF = 80, ++#define RTM_NEWNETCONF RTM_NEWNETCONF ++ RTM_DELNETCONF, ++#define RTM_DELNETCONF RTM_DELNETCONF ++ RTM_GETNETCONF = 82, ++#define RTM_GETNETCONF RTM_GETNETCONF ++ ++ RTM_NEWMDB = 84, ++#define RTM_NEWMDB RTM_NEWMDB ++ RTM_DELMDB = 85, ++#define RTM_DELMDB RTM_DELMDB ++ RTM_GETMDB = 86, ++#define RTM_GETMDB RTM_GETMDB ++ ++ RTM_NEWNSID = 88, ++#define RTM_NEWNSID RTM_NEWNSID ++ RTM_DELNSID = 89, ++#define RTM_DELNSID RTM_DELNSID ++ RTM_GETNSID = 90, ++#define RTM_GETNSID RTM_GETNSID ++ ++ RTM_NEWSTATS = 92, ++#define RTM_NEWSTATS RTM_NEWSTATS ++ RTM_GETSTATS = 94, ++#define RTM_GETSTATS RTM_GETSTATS ++ ++ RTM_NEWCACHEREPORT = 96, ++#define RTM_NEWCACHEREPORT RTM_NEWCACHEREPORT ++ ++ __RTM_MAX, ++#define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1) ++}; ++ ++#define RTM_NR_MSGTYPES (RTM_MAX + 1 - RTM_BASE) ++#define RTM_NR_FAMILIES (RTM_NR_MSGTYPES >> 2) ++#define RTM_FAM(cmd) (((cmd) - RTM_BASE) >> 2) ++ ++/* ++ Generic structure for encapsulation of optional route information. ++ It is reminiscent of sockaddr, but with sa_family replaced ++ with attribute type. ++ */ ++ ++struct rtattr { ++ unsigned short rta_len; ++ unsigned short rta_type; ++}; ++ ++/* Macros to handle rtattributes */ ++ ++#define RTA_ALIGNTO 4U ++#define RTA_ALIGN(len) ( ((len)+RTA_ALIGNTO-1) & ~(RTA_ALIGNTO-1) ) ++#define RTA_OK(rta,len) ((len) >= (int)sizeof(struct rtattr) && \ ++ (rta)->rta_len >= sizeof(struct rtattr) && \ ++ (rta)->rta_len <= (len)) ++#define RTA_NEXT(rta,attrlen) ((attrlen) -= RTA_ALIGN((rta)->rta_len), \ ++ (struct rtattr*)(((char*)(rta)) + RTA_ALIGN((rta)->rta_len))) ++#define RTA_LENGTH(len) (RTA_ALIGN(sizeof(struct rtattr)) + (len)) ++#define RTA_SPACE(len) RTA_ALIGN(RTA_LENGTH(len)) ++#define RTA_DATA(rta) ((void*)(((char*)(rta)) + RTA_LENGTH(0))) ++#define RTA_PAYLOAD(rta) ((int)((rta)->rta_len) - RTA_LENGTH(0)) ++ ++ ++ ++ ++/****************************************************************************** ++ * Definitions used in routing table administration. ++ ****/ ++ ++struct rtmsg { ++ unsigned char rtm_family; ++ unsigned char rtm_dst_len; ++ unsigned char rtm_src_len; ++ unsigned char rtm_tos; ++ ++ unsigned char rtm_table; /* Routing table id */ ++ unsigned char rtm_protocol; /* Routing protocol; see below */ ++ unsigned char rtm_scope; /* See below */ ++ unsigned char rtm_type; /* See below */ ++ ++ unsigned rtm_flags; ++}; ++ ++/* rtm_type */ ++ ++enum { ++ RTN_UNSPEC, ++ RTN_UNICAST, /* Gateway or direct route */ ++ RTN_LOCAL, /* Accept locally */ ++ RTN_BROADCAST, /* Accept locally as broadcast, ++ send as broadcast */ ++ RTN_ANYCAST, /* Accept locally as broadcast, ++ but send as unicast */ ++ RTN_MULTICAST, /* Multicast route */ ++ RTN_BLACKHOLE, /* Drop */ ++ RTN_UNREACHABLE, /* Destination is unreachable */ ++ RTN_PROHIBIT, /* Administratively prohibited */ ++ RTN_THROW, /* Not in this table */ ++ RTN_NAT, /* Translate this address */ ++ RTN_XRESOLVE, /* Use external resolver */ ++ __RTN_MAX ++}; ++ ++#define RTN_MAX (__RTN_MAX - 1) ++ ++ ++/* rtm_protocol */ ++ ++#define RTPROT_UNSPEC 0 ++#define RTPROT_REDIRECT 1 /* Route installed by ICMP redirects; ++ not used by current IPv4 */ ++#define RTPROT_KERNEL 2 /* Route installed by kernel */ ++#define RTPROT_BOOT 3 /* Route installed during boot */ ++#define RTPROT_STATIC 4 /* Route installed by administrator */ ++ ++/* Values of protocol >= RTPROT_STATIC are not interpreted by kernel; ++ they are just passed from user and back as is. ++ It will be used by hypothetical multiple routing daemons. ++ Note that protocol values should be standardized in order to ++ avoid conflicts. ++ */ ++ ++#define RTPROT_GATED 8 /* Apparently, GateD */ ++#define RTPROT_RA 9 /* RDISC/ND router advertisements */ ++#define RTPROT_MRT 10 /* Merit MRT */ ++#define RTPROT_ZEBRA 11 /* Zebra */ ++#define RTPROT_BIRD 12 /* BIRD */ ++#define RTPROT_DNROUTED 13 /* DECnet routing daemon */ ++#define RTPROT_XORP 14 /* XORP */ ++#define RTPROT_NTK 15 /* Netsukuku */ ++#define RTPROT_DHCP 16 /* DHCP client */ ++#define RTPROT_MROUTED 17 /* Multicast daemon */ ++#define RTPROT_BABEL 42 /* Babel daemon */ ++ ++/* rtm_scope ++ ++ Really it is not scope, but sort of distance to the destination. ++ NOWHERE are reserved for not existing destinations, HOST is our ++ local addresses, LINK are destinations, located on directly attached ++ link and UNIVERSE is everywhere in the Universe. ++ ++ Intermediate values are also possible f.e. interior routes ++ could be assigned a value between UNIVERSE and LINK. ++*/ ++ ++enum rt_scope_t { ++ RT_SCOPE_UNIVERSE=0, ++/* User defined values */ ++ RT_SCOPE_SITE=200, ++ RT_SCOPE_LINK=253, ++ RT_SCOPE_HOST=254, ++ RT_SCOPE_NOWHERE=255 ++}; ++ ++/* rtm_flags */ ++ ++#define RTM_F_NOTIFY 0x100 /* Notify user of route change */ ++#define RTM_F_CLONED 0x200 /* This route is cloned */ ++#define RTM_F_EQUALIZE 0x400 /* Multipath equalizer: NI */ ++#define RTM_F_PREFIX 0x800 /* Prefix addresses */ ++#define RTM_F_LOOKUP_TABLE 0x1000 /* set rtm_table to FIB lookup result */ ++#define RTM_F_FIB_MATCH 0x2000 /* return full fib lookup match */ ++ ++/* Reserved table identifiers */ ++ ++enum rt_class_t { ++ RT_TABLE_UNSPEC=0, ++/* User defined values */ ++ RT_TABLE_COMPAT=252, ++ RT_TABLE_DEFAULT=253, ++ RT_TABLE_MAIN=254, ++ RT_TABLE_LOCAL=255, ++ RT_TABLE_MAX=0xFFFFFFFF ++}; ++ ++ ++/* Routing message attributes */ ++ ++enum rtattr_type_t { ++ RTA_UNSPEC, ++ RTA_DST, ++ RTA_SRC, ++ RTA_IIF, ++ RTA_OIF, ++ RTA_GATEWAY, ++ RTA_PRIORITY, ++ RTA_PREFSRC, ++ RTA_METRICS, ++ RTA_MULTIPATH, ++ RTA_PROTOINFO, /* no longer used */ ++ RTA_FLOW, ++ RTA_CACHEINFO, ++ RTA_SESSION, /* no longer used */ ++ RTA_MP_ALGO, /* no longer used */ ++ RTA_TABLE, ++ RTA_MARK, ++ RTA_MFC_STATS, ++ RTA_VIA, ++ RTA_NEWDST, ++ RTA_PREF, ++ RTA_ENCAP_TYPE, ++ RTA_ENCAP, ++ RTA_EXPIRES, ++ RTA_PAD, ++ RTA_UID, ++ RTA_TTL_PROPAGATE, ++ __RTA_MAX ++}; ++ ++#define RTA_MAX (__RTA_MAX - 1) ++ ++#define RTM_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct rtmsg)))) ++#define RTM_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct rtmsg)) ++ ++/* RTM_MULTIPATH --- array of struct rtnexthop. ++ * ++ * "struct rtnexthop" describes all necessary nexthop information, ++ * i.e. parameters of path to a destination via this nexthop. ++ * ++ * At the moment it is impossible to set different prefsrc, mtu, window ++ * and rtt for different paths from multipath. ++ */ ++ ++struct rtnexthop { ++ unsigned short rtnh_len; ++ unsigned char rtnh_flags; ++ unsigned char rtnh_hops; ++ int rtnh_ifindex; ++}; ++ ++/* rtnh_flags */ ++ ++#define RTNH_F_DEAD 1 /* Nexthop is dead (used by multipath) */ ++#define RTNH_F_PERVASIVE 2 /* Do recursive gateway lookup */ ++#define RTNH_F_ONLINK 4 /* Gateway is forced on link */ ++#define RTNH_F_OFFLOAD 8 /* offloaded route */ ++#define RTNH_F_LINKDOWN 16 /* carrier-down on nexthop */ ++#define RTNH_F_UNRESOLVED 32 /* The entry is unresolved (ipmr) */ ++ ++#define RTNH_COMPARE_MASK (RTNH_F_DEAD | RTNH_F_LINKDOWN | RTNH_F_OFFLOAD) ++ ++/* Macros to handle hexthops */ ++ ++#define RTNH_ALIGNTO 4 ++#define RTNH_ALIGN(len) ( ((len)+RTNH_ALIGNTO-1) & ~(RTNH_ALIGNTO-1) ) ++#define RTNH_OK(rtnh,len) ((rtnh)->rtnh_len >= sizeof(struct rtnexthop) && \ ++ ((int)(rtnh)->rtnh_len) <= (len)) ++#define RTNH_NEXT(rtnh) ((struct rtnexthop*)(((char*)(rtnh)) + RTNH_ALIGN((rtnh)->rtnh_len))) ++#define RTNH_LENGTH(len) (RTNH_ALIGN(sizeof(struct rtnexthop)) + (len)) ++#define RTNH_SPACE(len) RTNH_ALIGN(RTNH_LENGTH(len)) ++#define RTNH_DATA(rtnh) ((struct rtattr*)(((char*)(rtnh)) + RTNH_LENGTH(0))) ++ ++/* RTA_VIA */ ++struct rtvia { ++ __kernel_sa_family_t rtvia_family; ++ __u8 rtvia_addr[0]; ++}; ++ ++/* RTM_CACHEINFO */ ++ ++struct rta_cacheinfo { ++ __u32 rta_clntref; ++ __u32 rta_lastuse; ++ __s32 rta_expires; ++ __u32 rta_error; ++ __u32 rta_used; ++ ++#define RTNETLINK_HAVE_PEERINFO 1 ++ __u32 rta_id; ++ __u32 rta_ts; ++ __u32 rta_tsage; ++}; ++ ++/* RTM_METRICS --- array of struct rtattr with types of RTAX_* */ ++ ++enum { ++ RTAX_UNSPEC, ++#define RTAX_UNSPEC RTAX_UNSPEC ++ RTAX_LOCK, ++#define RTAX_LOCK RTAX_LOCK ++ RTAX_MTU, ++#define RTAX_MTU RTAX_MTU ++ RTAX_WINDOW, ++#define RTAX_WINDOW RTAX_WINDOW ++ RTAX_RTT, ++#define RTAX_RTT RTAX_RTT ++ RTAX_RTTVAR, ++#define RTAX_RTTVAR RTAX_RTTVAR ++ RTAX_SSTHRESH, ++#define RTAX_SSTHRESH RTAX_SSTHRESH ++ RTAX_CWND, ++#define RTAX_CWND RTAX_CWND ++ RTAX_ADVMSS, ++#define RTAX_ADVMSS RTAX_ADVMSS ++ RTAX_REORDERING, ++#define RTAX_REORDERING RTAX_REORDERING ++ RTAX_HOPLIMIT, ++#define RTAX_HOPLIMIT RTAX_HOPLIMIT ++ RTAX_INITCWND, ++#define RTAX_INITCWND RTAX_INITCWND ++ RTAX_FEATURES, ++#define RTAX_FEATURES RTAX_FEATURES ++ RTAX_RTO_MIN, ++#define RTAX_RTO_MIN RTAX_RTO_MIN ++ RTAX_INITRWND, ++#define RTAX_INITRWND RTAX_INITRWND ++ RTAX_QUICKACK, ++#define RTAX_QUICKACK RTAX_QUICKACK ++ RTAX_CC_ALGO, ++#define RTAX_CC_ALGO RTAX_CC_ALGO ++ __RTAX_MAX ++}; ++ ++#define RTAX_MAX (__RTAX_MAX - 1) ++ ++#define RTAX_FEATURE_ECN (1 << 0) ++#define RTAX_FEATURE_SACK (1 << 1) ++#define RTAX_FEATURE_TIMESTAMP (1 << 2) ++#define RTAX_FEATURE_ALLFRAG (1 << 3) ++ ++#define RTAX_FEATURE_MASK (RTAX_FEATURE_ECN | RTAX_FEATURE_SACK | \ ++ RTAX_FEATURE_TIMESTAMP | RTAX_FEATURE_ALLFRAG) ++ ++struct rta_session { ++ __u8 proto; ++ __u8 pad1; ++ __u16 pad2; ++ ++ union { ++ struct { ++ __u16 sport; ++ __u16 dport; ++ } ports; ++ ++ struct { ++ __u8 type; ++ __u8 code; ++ __u16 ident; ++ } icmpt; ++ ++ __u32 spi; ++ } u; ++}; ++ ++struct rta_mfc_stats { ++ __u64 mfcs_packets; ++ __u64 mfcs_bytes; ++ __u64 mfcs_wrong_if; ++}; ++ ++/**** ++ * General form of address family dependent message. ++ ****/ ++ ++struct rtgenmsg { ++ unsigned char rtgen_family; ++}; ++ ++/***************************************************************** ++ * Link layer specific messages. ++ ****/ ++ ++/* struct ifinfomsg ++ * passes link level specific information, not dependent ++ * on network protocol. ++ */ ++ ++struct ifinfomsg { ++ unsigned char ifi_family; ++ unsigned char __ifi_pad; ++ unsigned short ifi_type; /* ARPHRD_* */ ++ int ifi_index; /* Link index */ ++ unsigned ifi_flags; /* IFF_* flags */ ++ unsigned ifi_change; /* IFF_* change mask */ ++}; ++ ++/******************************************************************** ++ * prefix information ++ ****/ ++ ++struct prefixmsg { ++ unsigned char prefix_family; ++ unsigned char prefix_pad1; ++ unsigned short prefix_pad2; ++ int prefix_ifindex; ++ unsigned char prefix_type; ++ unsigned char prefix_len; ++ unsigned char prefix_flags; ++ unsigned char prefix_pad3; ++}; ++ ++enum ++{ ++ PREFIX_UNSPEC, ++ PREFIX_ADDRESS, ++ PREFIX_CACHEINFO, ++ __PREFIX_MAX ++}; ++ ++#define PREFIX_MAX (__PREFIX_MAX - 1) ++ ++struct prefix_cacheinfo { ++ __u32 preferred_time; ++ __u32 valid_time; ++}; ++ ++ ++/***************************************************************** ++ * Traffic control messages. ++ ****/ ++ ++struct tcmsg { ++ unsigned char tcm_family; ++ unsigned char tcm__pad1; ++ unsigned short tcm__pad2; ++ int tcm_ifindex; ++ __u32 tcm_handle; ++ __u32 tcm_parent; ++ __u32 tcm_info; ++}; ++ ++enum { ++ TCA_UNSPEC, ++ TCA_KIND, ++ TCA_OPTIONS, ++ TCA_STATS, ++ TCA_XSTATS, ++ TCA_RATE, ++ TCA_FCNT, ++ TCA_STATS2, ++ TCA_STAB, ++ TCA_PAD, ++ TCA_DUMP_INVISIBLE, ++ TCA_CHAIN, ++ __TCA_MAX ++}; ++ ++#define TCA_MAX (__TCA_MAX - 1) ++ ++#define TCA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct tcmsg)))) ++#define TCA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct tcmsg)) ++ ++/******************************************************************** ++ * Neighbor Discovery userland options ++ ****/ ++ ++struct nduseroptmsg { ++ unsigned char nduseropt_family; ++ unsigned char nduseropt_pad1; ++ unsigned short nduseropt_opts_len; /* Total length of options */ ++ int nduseropt_ifindex; ++ __u8 nduseropt_icmp_type; ++ __u8 nduseropt_icmp_code; ++ unsigned short nduseropt_pad2; ++ unsigned int nduseropt_pad3; ++ /* Followed by one or more ND options */ ++}; ++ ++enum { ++ NDUSEROPT_UNSPEC, ++ NDUSEROPT_SRCADDR, ++ __NDUSEROPT_MAX ++}; ++ ++#define NDUSEROPT_MAX (__NDUSEROPT_MAX - 1) ++ ++/* RTnetlink multicast groups - backwards compatibility for userspace */ ++#define RTMGRP_LINK 1 ++#define RTMGRP_NOTIFY 2 ++#define RTMGRP_NEIGH 4 ++#define RTMGRP_TC 8 ++ ++#define RTMGRP_IPV4_IFADDR 0x10 ++#define RTMGRP_IPV4_MROUTE 0x20 ++#define RTMGRP_IPV4_ROUTE 0x40 ++#define RTMGRP_IPV4_RULE 0x80 ++ ++#define RTMGRP_IPV6_IFADDR 0x100 ++#define RTMGRP_IPV6_MROUTE 0x200 ++#define RTMGRP_IPV6_ROUTE 0x400 ++#define RTMGRP_IPV6_IFINFO 0x800 ++ ++#define RTMGRP_DECnet_IFADDR 0x1000 ++#define RTMGRP_DECnet_ROUTE 0x4000 ++ ++#define RTMGRP_IPV6_PREFIX 0x20000 ++ ++/* RTnetlink multicast groups */ ++enum rtnetlink_groups { ++ RTNLGRP_NONE, ++#define RTNLGRP_NONE RTNLGRP_NONE ++ RTNLGRP_LINK, ++#define RTNLGRP_LINK RTNLGRP_LINK ++ RTNLGRP_NOTIFY, ++#define RTNLGRP_NOTIFY RTNLGRP_NOTIFY ++ RTNLGRP_NEIGH, ++#define RTNLGRP_NEIGH RTNLGRP_NEIGH ++ RTNLGRP_TC, ++#define RTNLGRP_TC RTNLGRP_TC ++ RTNLGRP_IPV4_IFADDR, ++#define RTNLGRP_IPV4_IFADDR RTNLGRP_IPV4_IFADDR ++ RTNLGRP_IPV4_MROUTE, ++#define RTNLGRP_IPV4_MROUTE RTNLGRP_IPV4_MROUTE ++ RTNLGRP_IPV4_ROUTE, ++#define RTNLGRP_IPV4_ROUTE RTNLGRP_IPV4_ROUTE ++ RTNLGRP_IPV4_RULE, ++#define RTNLGRP_IPV4_RULE RTNLGRP_IPV4_RULE ++ RTNLGRP_IPV6_IFADDR, ++#define RTNLGRP_IPV6_IFADDR RTNLGRP_IPV6_IFADDR ++ RTNLGRP_IPV6_MROUTE, ++#define RTNLGRP_IPV6_MROUTE RTNLGRP_IPV6_MROUTE ++ RTNLGRP_IPV6_ROUTE, ++#define RTNLGRP_IPV6_ROUTE RTNLGRP_IPV6_ROUTE ++ RTNLGRP_IPV6_IFINFO, ++#define RTNLGRP_IPV6_IFINFO RTNLGRP_IPV6_IFINFO ++ RTNLGRP_DECnet_IFADDR, ++#define RTNLGRP_DECnet_IFADDR RTNLGRP_DECnet_IFADDR ++ RTNLGRP_NOP2, ++ RTNLGRP_DECnet_ROUTE, ++#define RTNLGRP_DECnet_ROUTE RTNLGRP_DECnet_ROUTE ++ RTNLGRP_DECnet_RULE, ++#define RTNLGRP_DECnet_RULE RTNLGRP_DECnet_RULE ++ RTNLGRP_NOP4, ++ RTNLGRP_IPV6_PREFIX, ++#define RTNLGRP_IPV6_PREFIX RTNLGRP_IPV6_PREFIX ++ RTNLGRP_IPV6_RULE, ++#define RTNLGRP_IPV6_RULE RTNLGRP_IPV6_RULE ++ RTNLGRP_ND_USEROPT, ++#define RTNLGRP_ND_USEROPT RTNLGRP_ND_USEROPT ++ RTNLGRP_PHONET_IFADDR, ++#define RTNLGRP_PHONET_IFADDR RTNLGRP_PHONET_IFADDR ++ RTNLGRP_PHONET_ROUTE, ++#define RTNLGRP_PHONET_ROUTE RTNLGRP_PHONET_ROUTE ++ RTNLGRP_DCB, ++#define RTNLGRP_DCB RTNLGRP_DCB ++ RTNLGRP_IPV4_NETCONF, ++#define RTNLGRP_IPV4_NETCONF RTNLGRP_IPV4_NETCONF ++ RTNLGRP_IPV6_NETCONF, ++#define RTNLGRP_IPV6_NETCONF RTNLGRP_IPV6_NETCONF ++ RTNLGRP_MDB, ++#define RTNLGRP_MDB RTNLGRP_MDB ++ RTNLGRP_MPLS_ROUTE, ++#define RTNLGRP_MPLS_ROUTE RTNLGRP_MPLS_ROUTE ++ RTNLGRP_NSID, ++#define RTNLGRP_NSID RTNLGRP_NSID ++ RTNLGRP_MPLS_NETCONF, ++#define RTNLGRP_MPLS_NETCONF RTNLGRP_MPLS_NETCONF ++ RTNLGRP_IPV4_MROUTE_R, ++#define RTNLGRP_IPV4_MROUTE_R RTNLGRP_IPV4_MROUTE_R ++ RTNLGRP_IPV6_MROUTE_R, ++#define RTNLGRP_IPV6_MROUTE_R RTNLGRP_IPV6_MROUTE_R ++ __RTNLGRP_MAX ++}; ++#define RTNLGRP_MAX (__RTNLGRP_MAX - 1) ++ ++/* TC action piece */ ++struct tcamsg { ++ unsigned char tca_family; ++ unsigned char tca__pad1; ++ unsigned short tca__pad2; ++}; ++ ++enum { ++ TCA_ROOT_UNSPEC, ++ TCA_ROOT_TAB, ++#define TCA_ACT_TAB TCA_ROOT_TAB ++#define TCAA_MAX TCA_ROOT_TAB ++ TCA_ROOT_FLAGS, ++ TCA_ROOT_COUNT, ++ TCA_ROOT_TIME_DELTA, /* in msecs */ ++ __TCA_ROOT_MAX, ++#define TCA_ROOT_MAX (__TCA_ROOT_MAX - 1) ++}; ++ ++#define TA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct tcamsg)))) ++#define TA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct tcamsg)) ++/* tcamsg flags stored in attribute TCA_ROOT_FLAGS ++ * ++ * TCA_FLAG_LARGE_DUMP_ON user->kernel to request for larger than TCA_ACT_MAX_PRIO ++ * actions in a dump. All dump responses will contain the number of actions ++ * being dumped stored in for user app's consumption in TCA_ROOT_COUNT ++ * ++ */ ++#define TCA_FLAG_LARGE_DUMP_ON (1 << 0) ++ ++/* New extended info filters for IFLA_EXT_MASK */ ++#define RTEXT_FILTER_VF (1 << 0) ++#define RTEXT_FILTER_BRVLAN (1 << 1) ++#define RTEXT_FILTER_BRVLAN_COMPRESSED (1 << 2) ++#define RTEXT_FILTER_SKIP_STATS (1 << 3) ++ ++/* End of information exported to user level */ ++ ++ ++ ++#endif /* __LINUX_RTNETLINK_H */ +diff --git a/include/uapi/linux/sctp.h b/include/uapi/linux/sctp.h +new file mode 100644 +index 0000000..fec24c4 +--- /dev/null ++++ b/include/uapi/linux/sctp.h +@@ -0,0 +1,1085 @@ ++/* SCTP kernel implementation ++ * (C) Copyright IBM Corp. 2001, 2004 ++ * Copyright (c) 1999-2000 Cisco, Inc. ++ * Copyright (c) 1999-2001 Motorola, Inc. ++ * Copyright (c) 2002 Intel Corp. ++ * ++ * This file is part of the SCTP kernel implementation ++ * ++ * This header represents the structures and constants needed to support ++ * the SCTP Extension to the Sockets API. ++ * ++ * This SCTP implementation is free software; ++ * you can redistribute it and/or modify it under the terms of ++ * the GNU General Public License as published by ++ * the Free Software Foundation; either version 2, or (at your option) ++ * any later version. ++ * ++ * This SCTP implementation is distributed in the hope that it ++ * will be useful, but WITHOUT ANY WARRANTY; without even the implied ++ * ************************ ++ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ * See the GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with GNU CC; see the file COPYING. If not, see ++ * . ++ * ++ * Please send any bug reports or fixes you make to the ++ * email address(es): ++ * lksctp developers ++ * ++ * Or submit a bug report through the following website: ++ * http://www.sf.net/projects/lksctp ++ * ++ * Written or modified by: ++ * La Monte H.P. Yarroll ++ * R. Stewart ++ * K. Morneau ++ * Q. Xie ++ * Karl Knutson ++ * Jon Grimm ++ * Daisy Chang ++ * Ryan Layer ++ * Ardelle Fan ++ * Sridhar Samudrala ++ * Inaky Perez-Gonzalez ++ * Vlad Yasevich ++ * ++ * Any bugs reported given to us we will try to fix... any fixes shared will ++ * be incorporated into the next SCTP release. ++ */ ++ ++#ifndef _SCTP_H ++#define _SCTP_H ++ ++#include ++#include ++ ++typedef __s32 sctp_assoc_t; ++ ++/* The following symbols come from the Sockets API Extensions for ++ * SCTP . ++ */ ++#define SCTP_RTOINFO 0 ++#define SCTP_ASSOCINFO 1 ++#define SCTP_INITMSG 2 ++#define SCTP_NODELAY 3 /* Get/set nodelay option. */ ++#define SCTP_AUTOCLOSE 4 ++#define SCTP_SET_PEER_PRIMARY_ADDR 5 ++#define SCTP_PRIMARY_ADDR 6 ++#define SCTP_ADAPTATION_LAYER 7 ++#define SCTP_DISABLE_FRAGMENTS 8 ++#define SCTP_PEER_ADDR_PARAMS 9 ++#define SCTP_DEFAULT_SEND_PARAM 10 ++#define SCTP_EVENTS 11 ++#define SCTP_I_WANT_MAPPED_V4_ADDR 12 /* Turn on/off mapped v4 addresses */ ++#define SCTP_MAXSEG 13 /* Get/set maximum fragment. */ ++#define SCTP_STATUS 14 ++#define SCTP_GET_PEER_ADDR_INFO 15 ++#define SCTP_DELAYED_ACK_TIME 16 ++#define SCTP_DELAYED_ACK SCTP_DELAYED_ACK_TIME ++#define SCTP_DELAYED_SACK SCTP_DELAYED_ACK_TIME ++#define SCTP_CONTEXT 17 ++#define SCTP_FRAGMENT_INTERLEAVE 18 ++#define SCTP_PARTIAL_DELIVERY_POINT 19 /* Set/Get partial delivery point */ ++#define SCTP_MAX_BURST 20 /* Set/Get max burst */ ++#define SCTP_AUTH_CHUNK 21 /* Set only: add a chunk type to authenticate */ ++#define SCTP_HMAC_IDENT 22 ++#define SCTP_AUTH_KEY 23 ++#define SCTP_AUTH_ACTIVE_KEY 24 ++#define SCTP_AUTH_DELETE_KEY 25 ++#define SCTP_PEER_AUTH_CHUNKS 26 /* Read only */ ++#define SCTP_LOCAL_AUTH_CHUNKS 27 /* Read only */ ++#define SCTP_GET_ASSOC_NUMBER 28 /* Read only */ ++#define SCTP_GET_ASSOC_ID_LIST 29 /* Read only */ ++#define SCTP_AUTO_ASCONF 30 ++#define SCTP_PEER_ADDR_THLDS 31 ++#define SCTP_RECVRCVINFO 32 ++#define SCTP_RECVNXTINFO 33 ++#define SCTP_DEFAULT_SNDINFO 34 ++ ++/* Internal Socket Options. Some of the sctp library functions are ++ * implemented using these socket options. ++ */ ++#define SCTP_SOCKOPT_BINDX_ADD 100 /* BINDX requests for adding addrs */ ++#define SCTP_SOCKOPT_BINDX_REM 101 /* BINDX requests for removing addrs. */ ++#define SCTP_SOCKOPT_PEELOFF 102 /* peel off association. */ ++/* Options 104-106 are deprecated and removed. Do not use this space */ ++#define SCTP_SOCKOPT_CONNECTX_OLD 107 /* CONNECTX old requests. */ ++#define SCTP_GET_PEER_ADDRS 108 /* Get all peer address. */ ++#define SCTP_GET_LOCAL_ADDRS 109 /* Get all local address. */ ++#define SCTP_SOCKOPT_CONNECTX 110 /* CONNECTX requests. */ ++#define SCTP_SOCKOPT_CONNECTX3 111 /* CONNECTX requests (updated) */ ++#define SCTP_GET_ASSOC_STATS 112 /* Read only */ ++#define SCTP_PR_SUPPORTED 113 ++#define SCTP_DEFAULT_PRINFO 114 ++#define SCTP_PR_ASSOC_STATUS 115 ++#define SCTP_PR_STREAM_STATUS 116 ++#define SCTP_RECONFIG_SUPPORTED 117 ++#define SCTP_ENABLE_STREAM_RESET 118 ++#define SCTP_RESET_STREAMS 119 ++#define SCTP_RESET_ASSOC 120 ++#define SCTP_ADD_STREAMS 121 ++#define SCTP_SOCKOPT_PEELOFF_FLAGS 122 ++ ++/* PR-SCTP policies */ ++#define SCTP_PR_SCTP_NONE 0x0000 ++#define SCTP_PR_SCTP_TTL 0x0010 ++#define SCTP_PR_SCTP_RTX 0x0020 ++#define SCTP_PR_SCTP_PRIO 0x0030 ++#define SCTP_PR_SCTP_MAX SCTP_PR_SCTP_PRIO ++#define SCTP_PR_SCTP_MASK 0x0030 ++ ++#define __SCTP_PR_INDEX(x) ((x >> 4) - 1) ++#define SCTP_PR_INDEX(x) __SCTP_PR_INDEX(SCTP_PR_SCTP_ ## x) ++ ++#define SCTP_PR_POLICY(x) ((x) & SCTP_PR_SCTP_MASK) ++#define SCTP_PR_SET_POLICY(flags, x) \ ++ do { \ ++ flags &= ~SCTP_PR_SCTP_MASK; \ ++ flags |= x; \ ++ } while (0) ++ ++#define SCTP_PR_TTL_ENABLED(x) (SCTP_PR_POLICY(x) == SCTP_PR_SCTP_TTL) ++#define SCTP_PR_RTX_ENABLED(x) (SCTP_PR_POLICY(x) == SCTP_PR_SCTP_RTX) ++#define SCTP_PR_PRIO_ENABLED(x) (SCTP_PR_POLICY(x) == SCTP_PR_SCTP_PRIO) ++ ++/* For enable stream reset */ ++#define SCTP_ENABLE_RESET_STREAM_REQ 0x01 ++#define SCTP_ENABLE_RESET_ASSOC_REQ 0x02 ++#define SCTP_ENABLE_CHANGE_ASSOC_REQ 0x04 ++#define SCTP_ENABLE_STRRESET_MASK 0x07 ++ ++#define SCTP_STREAM_RESET_INCOMING 0x01 ++#define SCTP_STREAM_RESET_OUTGOING 0x02 ++ ++/* These are bit fields for msghdr->msg_flags. See section 5.1. */ ++/* On user space Linux, these live in as an enum. */ ++enum sctp_msg_flags { ++ MSG_NOTIFICATION = 0x8000, ++#define MSG_NOTIFICATION MSG_NOTIFICATION ++}; ++ ++/* 5.3.1 SCTP Initiation Structure (SCTP_INIT) ++ * ++ * This cmsghdr structure provides information for initializing new ++ * SCTP associations with sendmsg(). The SCTP_INITMSG socket option ++ * uses this same data structure. This structure is not used for ++ * recvmsg(). ++ * ++ * cmsg_level cmsg_type cmsg_data[] ++ * ------------ ------------ ---------------------- ++ * IPPROTO_SCTP SCTP_INIT struct sctp_initmsg ++ */ ++struct sctp_initmsg { ++ __u16 sinit_num_ostreams; ++ __u16 sinit_max_instreams; ++ __u16 sinit_max_attempts; ++ __u16 sinit_max_init_timeo; ++}; ++ ++/* 5.3.2 SCTP Header Information Structure (SCTP_SNDRCV) ++ * ++ * This cmsghdr structure specifies SCTP options for sendmsg() and ++ * describes SCTP header information about a received message through ++ * recvmsg(). ++ * ++ * cmsg_level cmsg_type cmsg_data[] ++ * ------------ ------------ ---------------------- ++ * IPPROTO_SCTP SCTP_SNDRCV struct sctp_sndrcvinfo ++ */ ++struct sctp_sndrcvinfo { ++ __u16 sinfo_stream; ++ __u16 sinfo_ssn; ++ __u16 sinfo_flags; ++ __u32 sinfo_ppid; ++ __u32 sinfo_context; ++ __u32 sinfo_timetolive; ++ __u32 sinfo_tsn; ++ __u32 sinfo_cumtsn; ++ sctp_assoc_t sinfo_assoc_id; ++}; ++ ++/* 5.3.4 SCTP Send Information Structure (SCTP_SNDINFO) ++ * ++ * This cmsghdr structure specifies SCTP options for sendmsg(). ++ * ++ * cmsg_level cmsg_type cmsg_data[] ++ * ------------ ------------ ------------------- ++ * IPPROTO_SCTP SCTP_SNDINFO struct sctp_sndinfo ++ */ ++struct sctp_sndinfo { ++ __u16 snd_sid; ++ __u16 snd_flags; ++ __u32 snd_ppid; ++ __u32 snd_context; ++ sctp_assoc_t snd_assoc_id; ++}; ++ ++/* 5.3.5 SCTP Receive Information Structure (SCTP_RCVINFO) ++ * ++ * This cmsghdr structure describes SCTP receive information ++ * about a received message through recvmsg(). ++ * ++ * cmsg_level cmsg_type cmsg_data[] ++ * ------------ ------------ ------------------- ++ * IPPROTO_SCTP SCTP_RCVINFO struct sctp_rcvinfo ++ */ ++struct sctp_rcvinfo { ++ __u16 rcv_sid; ++ __u16 rcv_ssn; ++ __u16 rcv_flags; ++ __u32 rcv_ppid; ++ __u32 rcv_tsn; ++ __u32 rcv_cumtsn; ++ __u32 rcv_context; ++ sctp_assoc_t rcv_assoc_id; ++}; ++ ++/* 5.3.6 SCTP Next Receive Information Structure (SCTP_NXTINFO) ++ * ++ * This cmsghdr structure describes SCTP receive information ++ * of the next message that will be delivered through recvmsg() ++ * if this information is already available when delivering ++ * the current message. ++ * ++ * cmsg_level cmsg_type cmsg_data[] ++ * ------------ ------------ ------------------- ++ * IPPROTO_SCTP SCTP_NXTINFO struct sctp_nxtinfo ++ */ ++struct sctp_nxtinfo { ++ __u16 nxt_sid; ++ __u16 nxt_flags; ++ __u32 nxt_ppid; ++ __u32 nxt_length; ++ sctp_assoc_t nxt_assoc_id; ++}; ++ ++/* ++ * sinfo_flags: 16 bits (unsigned integer) ++ * ++ * This field may contain any of the following flags and is composed of ++ * a bitwise OR of these values. ++ */ ++enum sctp_sinfo_flags { ++ SCTP_UNORDERED = (1 << 0), /* Send/receive message unordered. */ ++ SCTP_ADDR_OVER = (1 << 1), /* Override the primary destination. */ ++ SCTP_ABORT = (1 << 2), /* Send an ABORT message to the peer. */ ++ SCTP_SACK_IMMEDIATELY = (1 << 3), /* SACK should be sent without delay. */ ++ SCTP_NOTIFICATION = MSG_NOTIFICATION, /* Next message is not user msg but notification. */ ++ SCTP_EOF = MSG_FIN, /* Initiate graceful shutdown process. */ ++}; ++ ++typedef union { ++ __u8 raw; ++ struct sctp_initmsg init; ++ struct sctp_sndrcvinfo sndrcv; ++} sctp_cmsg_data_t; ++ ++/* These are cmsg_types. */ ++typedef enum sctp_cmsg_type { ++ SCTP_INIT, /* 5.2.1 SCTP Initiation Structure */ ++#define SCTP_INIT SCTP_INIT ++ SCTP_SNDRCV, /* 5.2.2 SCTP Header Information Structure */ ++#define SCTP_SNDRCV SCTP_SNDRCV ++ SCTP_SNDINFO, /* 5.3.4 SCTP Send Information Structure */ ++#define SCTP_SNDINFO SCTP_SNDINFO ++ SCTP_RCVINFO, /* 5.3.5 SCTP Receive Information Structure */ ++#define SCTP_RCVINFO SCTP_RCVINFO ++ SCTP_NXTINFO, /* 5.3.6 SCTP Next Receive Information Structure */ ++#define SCTP_NXTINFO SCTP_NXTINFO ++} sctp_cmsg_t; ++ ++/* ++ * 5.3.1.1 SCTP_ASSOC_CHANGE ++ * ++ * Communication notifications inform the ULP that an SCTP association ++ * has either begun or ended. The identifier for a new association is ++ * provided by this notificaion. The notification information has the ++ * following format: ++ * ++ */ ++struct sctp_assoc_change { ++ __u16 sac_type; ++ __u16 sac_flags; ++ __u32 sac_length; ++ __u16 sac_state; ++ __u16 sac_error; ++ __u16 sac_outbound_streams; ++ __u16 sac_inbound_streams; ++ sctp_assoc_t sac_assoc_id; ++ __u8 sac_info[0]; ++}; ++ ++/* ++ * sac_state: 32 bits (signed integer) ++ * ++ * This field holds one of a number of values that communicate the ++ * event that happened to the association. They include: ++ * ++ * Note: The following state names deviate from the API draft as ++ * the names clash too easily with other kernel symbols. ++ */ ++enum sctp_sac_state { ++ SCTP_COMM_UP, ++ SCTP_COMM_LOST, ++ SCTP_RESTART, ++ SCTP_SHUTDOWN_COMP, ++ SCTP_CANT_STR_ASSOC, ++}; ++ ++/* ++ * 5.3.1.2 SCTP_PEER_ADDR_CHANGE ++ * ++ * When a destination address on a multi-homed peer encounters a change ++ * an interface details event is sent. The information has the ++ * following structure: ++ */ ++struct sctp_paddr_change { ++ __u16 spc_type; ++ __u16 spc_flags; ++ __u32 spc_length; ++ struct sockaddr_storage spc_aaddr; ++ int spc_state; ++ int spc_error; ++ sctp_assoc_t spc_assoc_id; ++} __attribute__((packed, aligned(4))); ++ ++/* ++ * spc_state: 32 bits (signed integer) ++ * ++ * This field holds one of a number of values that communicate the ++ * event that happened to the address. They include: ++ */ ++enum sctp_spc_state { ++ SCTP_ADDR_AVAILABLE, ++ SCTP_ADDR_UNREACHABLE, ++ SCTP_ADDR_REMOVED, ++ SCTP_ADDR_ADDED, ++ SCTP_ADDR_MADE_PRIM, ++ SCTP_ADDR_CONFIRMED, ++}; ++ ++ ++/* ++ * 5.3.1.3 SCTP_REMOTE_ERROR ++ * ++ * A remote peer may send an Operational Error message to its peer. ++ * This message indicates a variety of error conditions on an ++ * association. The entire error TLV as it appears on the wire is ++ * included in a SCTP_REMOTE_ERROR event. Please refer to the SCTP ++ * specification [SCTP] and any extensions for a list of possible ++ * error formats. SCTP error TLVs have the format: ++ */ ++struct sctp_remote_error { ++ __u16 sre_type; ++ __u16 sre_flags; ++ __u32 sre_length; ++ __u16 sre_error; ++ sctp_assoc_t sre_assoc_id; ++ __u8 sre_data[0]; ++}; ++ ++ ++/* ++ * 5.3.1.4 SCTP_SEND_FAILED ++ * ++ * If SCTP cannot deliver a message it may return the message as a ++ * notification. ++ */ ++struct sctp_send_failed { ++ __u16 ssf_type; ++ __u16 ssf_flags; ++ __u32 ssf_length; ++ __u32 ssf_error; ++ struct sctp_sndrcvinfo ssf_info; ++ sctp_assoc_t ssf_assoc_id; ++ __u8 ssf_data[0]; ++}; ++ ++/* ++ * ssf_flags: 16 bits (unsigned integer) ++ * ++ * The flag value will take one of the following values ++ * ++ * SCTP_DATA_UNSENT - Indicates that the data was never put on ++ * the wire. ++ * ++ * SCTP_DATA_SENT - Indicates that the data was put on the wire. ++ * Note that this does not necessarily mean that the ++ * data was (or was not) successfully delivered. ++ */ ++enum sctp_ssf_flags { ++ SCTP_DATA_UNSENT, ++ SCTP_DATA_SENT, ++}; ++ ++/* ++ * 5.3.1.5 SCTP_SHUTDOWN_EVENT ++ * ++ * When a peer sends a SHUTDOWN, SCTP delivers this notification to ++ * inform the application that it should cease sending data. ++ */ ++struct sctp_shutdown_event { ++ __u16 sse_type; ++ __u16 sse_flags; ++ __u32 sse_length; ++ sctp_assoc_t sse_assoc_id; ++}; ++ ++/* ++ * 5.3.1.6 SCTP_ADAPTATION_INDICATION ++ * ++ * When a peer sends a Adaptation Layer Indication parameter , SCTP ++ * delivers this notification to inform the application ++ * that of the peers requested adaptation layer. ++ */ ++struct sctp_adaptation_event { ++ __u16 sai_type; ++ __u16 sai_flags; ++ __u32 sai_length; ++ __u32 sai_adaptation_ind; ++ sctp_assoc_t sai_assoc_id; ++}; ++ ++/* ++ * 5.3.1.7 SCTP_PARTIAL_DELIVERY_EVENT ++ * ++ * When a receiver is engaged in a partial delivery of a ++ * message this notification will be used to indicate ++ * various events. ++ */ ++struct sctp_pdapi_event { ++ __u16 pdapi_type; ++ __u16 pdapi_flags; ++ __u32 pdapi_length; ++ __u32 pdapi_indication; ++ sctp_assoc_t pdapi_assoc_id; ++}; ++ ++enum { SCTP_PARTIAL_DELIVERY_ABORTED=0, }; ++ ++/* ++ * 5.3.1.8. SCTP_AUTHENTICATION_EVENT ++ * ++ * When a receiver is using authentication this message will provide ++ * notifications regarding new keys being made active as well as errors. ++ */ ++struct sctp_authkey_event { ++ __u16 auth_type; ++ __u16 auth_flags; ++ __u32 auth_length; ++ __u16 auth_keynumber; ++ __u16 auth_altkeynumber; ++ __u32 auth_indication; ++ sctp_assoc_t auth_assoc_id; ++}; ++ ++enum { SCTP_AUTH_NEWKEY = 0, }; ++ ++/* ++ * 6.1.9. SCTP_SENDER_DRY_EVENT ++ * ++ * When the SCTP stack has no more user data to send or retransmit, this ++ * notification is given to the user. Also, at the time when a user app ++ * subscribes to this event, if there is no data to be sent or ++ * retransmit, the stack will immediately send up this notification. ++ */ ++struct sctp_sender_dry_event { ++ __u16 sender_dry_type; ++ __u16 sender_dry_flags; ++ __u32 sender_dry_length; ++ sctp_assoc_t sender_dry_assoc_id; ++}; ++ ++#define SCTP_STREAM_RESET_INCOMING_SSN 0x0001 ++#define SCTP_STREAM_RESET_OUTGOING_SSN 0x0002 ++#define SCTP_STREAM_RESET_DENIED 0x0004 ++#define SCTP_STREAM_RESET_FAILED 0x0008 ++struct sctp_stream_reset_event { ++ __u16 strreset_type; ++ __u16 strreset_flags; ++ __u32 strreset_length; ++ sctp_assoc_t strreset_assoc_id; ++ __u16 strreset_stream_list[]; ++}; ++ ++#define SCTP_ASSOC_RESET_DENIED 0x0004 ++#define SCTP_ASSOC_RESET_FAILED 0x0008 ++struct sctp_assoc_reset_event { ++ __u16 assocreset_type; ++ __u16 assocreset_flags; ++ __u32 assocreset_length; ++ sctp_assoc_t assocreset_assoc_id; ++ __u32 assocreset_local_tsn; ++ __u32 assocreset_remote_tsn; ++}; ++ ++#define SCTP_ASSOC_CHANGE_DENIED 0x0004 ++#define SCTP_ASSOC_CHANGE_FAILED 0x0008 ++struct sctp_stream_change_event { ++ __u16 strchange_type; ++ __u16 strchange_flags; ++ __u32 strchange_length; ++ sctp_assoc_t strchange_assoc_id; ++ __u16 strchange_instrms; ++ __u16 strchange_outstrms; ++}; ++ ++/* ++ * Described in Section 7.3 ++ * Ancillary Data and Notification Interest Options ++ */ ++struct sctp_event_subscribe { ++ __u8 sctp_data_io_event; ++ __u8 sctp_association_event; ++ __u8 sctp_address_event; ++ __u8 sctp_send_failure_event; ++ __u8 sctp_peer_error_event; ++ __u8 sctp_shutdown_event; ++ __u8 sctp_partial_delivery_event; ++ __u8 sctp_adaptation_layer_event; ++ __u8 sctp_authentication_event; ++ __u8 sctp_sender_dry_event; ++ __u8 sctp_stream_reset_event; ++ __u8 sctp_assoc_reset_event; ++ __u8 sctp_stream_change_event; ++}; ++ ++/* ++ * 5.3.1 SCTP Notification Structure ++ * ++ * The notification structure is defined as the union of all ++ * notification types. ++ * ++ */ ++union sctp_notification { ++ struct { ++ __u16 sn_type; /* Notification type. */ ++ __u16 sn_flags; ++ __u32 sn_length; ++ } sn_header; ++ struct sctp_assoc_change sn_assoc_change; ++ struct sctp_paddr_change sn_paddr_change; ++ struct sctp_remote_error sn_remote_error; ++ struct sctp_send_failed sn_send_failed; ++ struct sctp_shutdown_event sn_shutdown_event; ++ struct sctp_adaptation_event sn_adaptation_event; ++ struct sctp_pdapi_event sn_pdapi_event; ++ struct sctp_authkey_event sn_authkey_event; ++ struct sctp_sender_dry_event sn_sender_dry_event; ++ struct sctp_stream_reset_event sn_strreset_event; ++ struct sctp_assoc_reset_event sn_assocreset_event; ++ struct sctp_stream_change_event sn_strchange_event; ++}; ++ ++/* Section 5.3.1 ++ * All standard values for sn_type flags are greater than 2^15. ++ * Values from 2^15 and down are reserved. ++ */ ++ ++enum sctp_sn_type { ++ SCTP_SN_TYPE_BASE = (1<<15), ++ SCTP_ASSOC_CHANGE, ++#define SCTP_ASSOC_CHANGE SCTP_ASSOC_CHANGE ++ SCTP_PEER_ADDR_CHANGE, ++#define SCTP_PEER_ADDR_CHANGE SCTP_PEER_ADDR_CHANGE ++ SCTP_SEND_FAILED, ++#define SCTP_SEND_FAILED SCTP_SEND_FAILED ++ SCTP_REMOTE_ERROR, ++#define SCTP_REMOTE_ERROR SCTP_REMOTE_ERROR ++ SCTP_SHUTDOWN_EVENT, ++#define SCTP_SHUTDOWN_EVENT SCTP_SHUTDOWN_EVENT ++ SCTP_PARTIAL_DELIVERY_EVENT, ++#define SCTP_PARTIAL_DELIVERY_EVENT SCTP_PARTIAL_DELIVERY_EVENT ++ SCTP_ADAPTATION_INDICATION, ++#define SCTP_ADAPTATION_INDICATION SCTP_ADAPTATION_INDICATION ++ SCTP_AUTHENTICATION_EVENT, ++#define SCTP_AUTHENTICATION_INDICATION SCTP_AUTHENTICATION_EVENT ++ SCTP_SENDER_DRY_EVENT, ++#define SCTP_SENDER_DRY_EVENT SCTP_SENDER_DRY_EVENT ++ SCTP_STREAM_RESET_EVENT, ++#define SCTP_STREAM_RESET_EVENT SCTP_STREAM_RESET_EVENT ++ SCTP_ASSOC_RESET_EVENT, ++#define SCTP_ASSOC_RESET_EVENT SCTP_ASSOC_RESET_EVENT ++ SCTP_STREAM_CHANGE_EVENT, ++#define SCTP_STREAM_CHANGE_EVENT SCTP_STREAM_CHANGE_EVENT ++}; ++ ++/* Notification error codes used to fill up the error fields in some ++ * notifications. ++ * SCTP_PEER_ADDRESS_CHAGE : spc_error ++ * SCTP_ASSOC_CHANGE : sac_error ++ * These names should be potentially included in the draft 04 of the SCTP ++ * sockets API specification. ++ */ ++typedef enum sctp_sn_error { ++ SCTP_FAILED_THRESHOLD, ++ SCTP_RECEIVED_SACK, ++ SCTP_HEARTBEAT_SUCCESS, ++ SCTP_RESPONSE_TO_USER_REQ, ++ SCTP_INTERNAL_ERROR, ++ SCTP_SHUTDOWN_GUARD_EXPIRES, ++ SCTP_PEER_FAULTY, ++} sctp_sn_error_t; ++ ++/* ++ * 7.1.1 Retransmission Timeout Parameters (SCTP_RTOINFO) ++ * ++ * The protocol parameters used to initialize and bound retransmission ++ * timeout (RTO) are tunable. See [SCTP] for more information on how ++ * these parameters are used in RTO calculation. ++ */ ++struct sctp_rtoinfo { ++ sctp_assoc_t srto_assoc_id; ++ __u32 srto_initial; ++ __u32 srto_max; ++ __u32 srto_min; ++}; ++ ++/* ++ * 7.1.2 Association Parameters (SCTP_ASSOCINFO) ++ * ++ * This option is used to both examine and set various association and ++ * endpoint parameters. ++ */ ++struct sctp_assocparams { ++ sctp_assoc_t sasoc_assoc_id; ++ __u16 sasoc_asocmaxrxt; ++ __u16 sasoc_number_peer_destinations; ++ __u32 sasoc_peer_rwnd; ++ __u32 sasoc_local_rwnd; ++ __u32 sasoc_cookie_life; ++}; ++ ++/* ++ * 7.1.9 Set Peer Primary Address (SCTP_SET_PEER_PRIMARY_ADDR) ++ * ++ * Requests that the peer mark the enclosed address as the association ++ * primary. The enclosed address must be one of the association's ++ * locally bound addresses. The following structure is used to make a ++ * set primary request: ++ */ ++struct sctp_setpeerprim { ++ sctp_assoc_t sspp_assoc_id; ++ struct sockaddr_storage sspp_addr; ++} __attribute__((packed, aligned(4))); ++ ++/* ++ * 7.1.10 Set Primary Address (SCTP_PRIMARY_ADDR) ++ * ++ * Requests that the local SCTP stack use the enclosed peer address as ++ * the association primary. The enclosed address must be one of the ++ * association peer's addresses. The following structure is used to ++ * make a set peer primary request: ++ */ ++struct sctp_prim { ++ sctp_assoc_t ssp_assoc_id; ++ struct sockaddr_storage ssp_addr; ++} __attribute__((packed, aligned(4))); ++ ++/* For backward compatibility use, define the old name too */ ++#define sctp_setprim sctp_prim ++ ++/* ++ * 7.1.11 Set Adaptation Layer Indicator (SCTP_ADAPTATION_LAYER) ++ * ++ * Requests that the local endpoint set the specified Adaptation Layer ++ * Indication parameter for all future INIT and INIT-ACK exchanges. ++ */ ++struct sctp_setadaptation { ++ __u32 ssb_adaptation_ind; ++}; ++ ++/* ++ * 7.1.13 Peer Address Parameters (SCTP_PEER_ADDR_PARAMS) ++ * ++ * Applications can enable or disable heartbeats for any peer address ++ * of an association, modify an address's heartbeat interval, force a ++ * heartbeat to be sent immediately, and adjust the address's maximum ++ * number of retransmissions sent before an address is considered ++ * unreachable. The following structure is used to access and modify an ++ * address's parameters: ++ */ ++enum sctp_spp_flags { ++ SPP_HB_ENABLE = 1<<0, /*Enable heartbeats*/ ++ SPP_HB_DISABLE = 1<<1, /*Disable heartbeats*/ ++ SPP_HB = SPP_HB_ENABLE | SPP_HB_DISABLE, ++ SPP_HB_DEMAND = 1<<2, /*Send heartbeat immediately*/ ++ SPP_PMTUD_ENABLE = 1<<3, /*Enable PMTU discovery*/ ++ SPP_PMTUD_DISABLE = 1<<4, /*Disable PMTU discovery*/ ++ SPP_PMTUD = SPP_PMTUD_ENABLE | SPP_PMTUD_DISABLE, ++ SPP_SACKDELAY_ENABLE = 1<<5, /*Enable SACK*/ ++ SPP_SACKDELAY_DISABLE = 1<<6, /*Disable SACK*/ ++ SPP_SACKDELAY = SPP_SACKDELAY_ENABLE | SPP_SACKDELAY_DISABLE, ++ SPP_HB_TIME_IS_ZERO = 1<<7, /* Set HB delay to 0 */ ++}; ++ ++struct sctp_paddrparams { ++ sctp_assoc_t spp_assoc_id; ++ struct sockaddr_storage spp_address; ++ __u32 spp_hbinterval; ++ __u16 spp_pathmaxrxt; ++ __u32 spp_pathmtu; ++ __u32 spp_sackdelay; ++ __u32 spp_flags; ++} __attribute__((packed, aligned(4))); ++ ++/* ++ * 7.1.18. Add a chunk that must be authenticated (SCTP_AUTH_CHUNK) ++ * ++ * This set option adds a chunk type that the user is requesting to be ++ * received only in an authenticated way. Changes to the list of chunks ++ * will only effect future associations on the socket. ++ */ ++struct sctp_authchunk { ++ __u8 sauth_chunk; ++}; ++ ++/* ++ * 7.1.19. Get or set the list of supported HMAC Identifiers (SCTP_HMAC_IDENT) ++ * ++ * This option gets or sets the list of HMAC algorithms that the local ++ * endpoint requires the peer to use. ++ */ ++/* This here is only used by user space as is. It might not be a good idea ++ * to export/reveal the whole structure with reserved fields etc. ++ */ ++enum { ++ SCTP_AUTH_HMAC_ID_SHA1 = 1, ++ SCTP_AUTH_HMAC_ID_SHA256 = 3, ++}; ++ ++struct sctp_hmacalgo { ++ __u32 shmac_num_idents; ++ __u16 shmac_idents[]; ++}; ++ ++/* Sadly, user and kernel space have different names for ++ * this structure member, so this is to not break anything. ++ */ ++#define shmac_number_of_idents shmac_num_idents ++ ++/* ++ * 7.1.20. Set a shared key (SCTP_AUTH_KEY) ++ * ++ * This option will set a shared secret key which is used to build an ++ * association shared key. ++ */ ++struct sctp_authkey { ++ sctp_assoc_t sca_assoc_id; ++ __u16 sca_keynumber; ++ __u16 sca_keylength; ++ __u8 sca_key[]; ++}; ++ ++/* ++ * 7.1.21. Get or set the active shared key (SCTP_AUTH_ACTIVE_KEY) ++ * ++ * This option will get or set the active shared key to be used to build ++ * the association shared key. ++ */ ++ ++struct sctp_authkeyid { ++ sctp_assoc_t scact_assoc_id; ++ __u16 scact_keynumber; ++}; ++ ++ ++/* ++ * 7.1.23. Get or set delayed ack timer (SCTP_DELAYED_SACK) ++ * ++ * This option will effect the way delayed acks are performed. This ++ * option allows you to get or set the delayed ack time, in ++ * milliseconds. It also allows changing the delayed ack frequency. ++ * Changing the frequency to 1 disables the delayed sack algorithm. If ++ * the assoc_id is 0, then this sets or gets the endpoints default ++ * values. If the assoc_id field is non-zero, then the set or get ++ * effects the specified association for the one to many model (the ++ * assoc_id field is ignored by the one to one model). Note that if ++ * sack_delay or sack_freq are 0 when setting this option, then the ++ * current values will remain unchanged. ++ */ ++struct sctp_sack_info { ++ sctp_assoc_t sack_assoc_id; ++ uint32_t sack_delay; ++ uint32_t sack_freq; ++}; ++ ++struct sctp_assoc_value { ++ sctp_assoc_t assoc_id; ++ uint32_t assoc_value; ++}; ++ ++/* ++ * 7.2.2 Peer Address Information ++ * ++ * Applications can retrieve information about a specific peer address ++ * of an association, including its reachability state, congestion ++ * window, and retransmission timer values. This information is ++ * read-only. The following structure is used to access this ++ * information: ++ */ ++struct sctp_paddrinfo { ++ sctp_assoc_t spinfo_assoc_id; ++ struct sockaddr_storage spinfo_address; ++ __s32 spinfo_state; ++ __u32 spinfo_cwnd; ++ __u32 spinfo_srtt; ++ __u32 spinfo_rto; ++ __u32 spinfo_mtu; ++} __attribute__((packed, aligned(4))); ++ ++/* Peer addresses's state. */ ++/* UNKNOWN: Peer address passed by the upper layer in sendmsg or connect[x] ++ * calls. ++ * UNCONFIRMED: Peer address received in INIT/INIT-ACK address parameters. ++ * Not yet confirmed by a heartbeat and not available for data ++ * transfers. ++ * ACTIVE : Peer address confirmed, active and available for data transfers. ++ * INACTIVE: Peer address inactive and not available for data transfers. ++ */ ++enum sctp_spinfo_state { ++ SCTP_INACTIVE, ++ SCTP_PF, ++ SCTP_ACTIVE, ++ SCTP_UNCONFIRMED, ++ SCTP_UNKNOWN = 0xffff /* Value used for transport state unknown */ ++}; ++ ++/* ++ * 7.2.1 Association Status (SCTP_STATUS) ++ * ++ * Applications can retrieve current status information about an ++ * association, including association state, peer receiver window size, ++ * number of unacked data chunks, and number of data chunks pending ++ * receipt. This information is read-only. The following structure is ++ * used to access this information: ++ */ ++struct sctp_status { ++ sctp_assoc_t sstat_assoc_id; ++ __s32 sstat_state; ++ __u32 sstat_rwnd; ++ __u16 sstat_unackdata; ++ __u16 sstat_penddata; ++ __u16 sstat_instrms; ++ __u16 sstat_outstrms; ++ __u32 sstat_fragmentation_point; ++ struct sctp_paddrinfo sstat_primary; ++}; ++ ++/* ++ * 7.2.3. Get the list of chunks the peer requires to be authenticated ++ * (SCTP_PEER_AUTH_CHUNKS) ++ * ++ * This option gets a list of chunks for a specified association that ++ * the peer requires to be received authenticated only. ++ */ ++struct sctp_authchunks { ++ sctp_assoc_t gauth_assoc_id; ++ __u32 gauth_number_of_chunks; ++ uint8_t gauth_chunks[]; ++}; ++ ++/* The broken spelling has been released already in lksctp-tools header, ++ * so don't break anyone, now that it's fixed. ++ */ ++#define guth_number_of_chunks gauth_number_of_chunks ++ ++/* Association states. */ ++enum sctp_sstat_state { ++ SCTP_EMPTY = 0, ++ SCTP_CLOSED = 1, ++ SCTP_COOKIE_WAIT = 2, ++ SCTP_COOKIE_ECHOED = 3, ++ SCTP_ESTABLISHED = 4, ++ SCTP_SHUTDOWN_PENDING = 5, ++ SCTP_SHUTDOWN_SENT = 6, ++ SCTP_SHUTDOWN_RECEIVED = 7, ++ SCTP_SHUTDOWN_ACK_SENT = 8, ++}; ++ ++/* ++ * 8.2.6. Get the Current Identifiers of Associations ++ * (SCTP_GET_ASSOC_ID_LIST) ++ * ++ * This option gets the current list of SCTP association identifiers of ++ * the SCTP associations handled by a one-to-many style socket. ++ */ ++struct sctp_assoc_ids { ++ __u32 gaids_number_of_ids; ++ sctp_assoc_t gaids_assoc_id[]; ++}; ++ ++/* ++ * 8.3, 8.5 get all peer/local addresses in an association. ++ * This parameter struct is used by SCTP_GET_PEER_ADDRS and ++ * SCTP_GET_LOCAL_ADDRS socket options used internally to implement ++ * sctp_getpaddrs() and sctp_getladdrs() API. ++ */ ++struct sctp_getaddrs_old { ++ sctp_assoc_t assoc_id; ++ int addr_num; ++ struct sockaddr *addrs; ++}; ++ ++struct sctp_getaddrs { ++ sctp_assoc_t assoc_id; /*input*/ ++ __u32 addr_num; /*output*/ ++ __u8 addrs[0]; /*output, variable size*/ ++}; ++ ++/* A socket user request obtained via SCTP_GET_ASSOC_STATS that retrieves ++ * association stats. All stats are counts except sas_maxrto and ++ * sas_obs_rto_ipaddr. maxrto is the max observed rto + transport since ++ * the last call. Will return 0 when RTO was not update since last call ++ */ ++struct sctp_assoc_stats { ++ sctp_assoc_t sas_assoc_id; /* Input */ ++ /* Transport of observed max RTO */ ++ struct sockaddr_storage sas_obs_rto_ipaddr; ++ __u64 sas_maxrto; /* Maximum Observed RTO for period */ ++ __u64 sas_isacks; /* SACKs received */ ++ __u64 sas_osacks; /* SACKs sent */ ++ __u64 sas_opackets; /* Packets sent */ ++ __u64 sas_ipackets; /* Packets received */ ++ __u64 sas_rtxchunks; /* Retransmitted Chunks */ ++ __u64 sas_outofseqtsns;/* TSN received > next expected */ ++ __u64 sas_idupchunks; /* Dups received (ordered+unordered) */ ++ __u64 sas_gapcnt; /* Gap Acknowledgements Received */ ++ __u64 sas_ouodchunks; /* Unordered data chunks sent */ ++ __u64 sas_iuodchunks; /* Unordered data chunks received */ ++ __u64 sas_oodchunks; /* Ordered data chunks sent */ ++ __u64 sas_iodchunks; /* Ordered data chunks received */ ++ __u64 sas_octrlchunks; /* Control chunks sent */ ++ __u64 sas_ictrlchunks; /* Control chunks received */ ++}; ++ ++/* ++ * 8.1 sctp_bindx() ++ * ++ * The flags parameter is formed from the bitwise OR of zero or more of the ++ * following currently defined flags: ++ */ ++#define SCTP_BINDX_ADD_ADDR 0x01 ++#define SCTP_BINDX_REM_ADDR 0x02 ++ ++/* This is the structure that is passed as an argument(optval) to ++ * getsockopt(SCTP_SOCKOPT_PEELOFF). ++ */ ++typedef struct { ++ sctp_assoc_t associd; ++ int sd; ++} sctp_peeloff_arg_t; ++ ++typedef struct { ++ sctp_peeloff_arg_t p_arg; ++ unsigned flags; ++} sctp_peeloff_flags_arg_t; ++ ++/* ++ * Peer Address Thresholds socket option ++ */ ++struct sctp_paddrthlds { ++ sctp_assoc_t spt_assoc_id; ++ struct sockaddr_storage spt_address; ++ __u16 spt_pathmaxrxt; ++ __u16 spt_pathpfthld; ++}; ++ ++/* ++ * Socket Option for Getting the Association/Stream-Specific PR-SCTP Status ++ */ ++struct sctp_prstatus { ++ sctp_assoc_t sprstat_assoc_id; ++ __u16 sprstat_sid; ++ __u16 sprstat_policy; ++ __u64 sprstat_abandoned_unsent; ++ __u64 sprstat_abandoned_sent; ++}; ++ ++struct sctp_default_prinfo { ++ sctp_assoc_t pr_assoc_id; ++ __u32 pr_value; ++ __u16 pr_policy; ++}; ++ ++struct sctp_info { ++ __u32 sctpi_tag; ++ __u32 sctpi_state; ++ __u32 sctpi_rwnd; ++ __u16 sctpi_unackdata; ++ __u16 sctpi_penddata; ++ __u16 sctpi_instrms; ++ __u16 sctpi_outstrms; ++ __u32 sctpi_fragmentation_point; ++ __u32 sctpi_inqueue; ++ __u32 sctpi_outqueue; ++ __u32 sctpi_overall_error; ++ __u32 sctpi_max_burst; ++ __u32 sctpi_maxseg; ++ __u32 sctpi_peer_rwnd; ++ __u32 sctpi_peer_tag; ++ __u8 sctpi_peer_capable; ++ __u8 sctpi_peer_sack; ++ __u16 __reserved1; ++ ++ /* assoc status info */ ++ __u64 sctpi_isacks; ++ __u64 sctpi_osacks; ++ __u64 sctpi_opackets; ++ __u64 sctpi_ipackets; ++ __u64 sctpi_rtxchunks; ++ __u64 sctpi_outofseqtsns; ++ __u64 sctpi_idupchunks; ++ __u64 sctpi_gapcnt; ++ __u64 sctpi_ouodchunks; ++ __u64 sctpi_iuodchunks; ++ __u64 sctpi_oodchunks; ++ __u64 sctpi_iodchunks; ++ __u64 sctpi_octrlchunks; ++ __u64 sctpi_ictrlchunks; ++ ++ /* primary transport info */ ++ struct sockaddr_storage sctpi_p_address; ++ __s32 sctpi_p_state; ++ __u32 sctpi_p_cwnd; ++ __u32 sctpi_p_srtt; ++ __u32 sctpi_p_rto; ++ __u32 sctpi_p_hbinterval; ++ __u32 sctpi_p_pathmaxrxt; ++ __u32 sctpi_p_sackdelay; ++ __u32 sctpi_p_sackfreq; ++ __u32 sctpi_p_ssthresh; ++ __u32 sctpi_p_partial_bytes_acked; ++ __u32 sctpi_p_flight_size; ++ __u16 sctpi_p_error; ++ __u16 __reserved2; ++ ++ /* sctp sock info */ ++ __u32 sctpi_s_autoclose; ++ __u32 sctpi_s_adaptation_ind; ++ __u32 sctpi_s_pd_point; ++ __u8 sctpi_s_nodelay; ++ __u8 sctpi_s_disable_fragments; ++ __u8 sctpi_s_v4mapped; ++ __u8 sctpi_s_frag_interleave; ++ __u32 sctpi_s_type; ++ __u32 __reserved3; ++}; ++ ++struct sctp_reset_streams { ++ sctp_assoc_t srs_assoc_id; ++ uint16_t srs_flags; ++ uint16_t srs_number_streams; /* 0 == ALL */ ++ uint16_t srs_stream_list[]; /* list if srs_num_streams is not 0 */ ++}; ++ ++struct sctp_add_streams { ++ sctp_assoc_t sas_assoc_id; ++ uint16_t sas_instrms; ++ uint16_t sas_outstrms; ++}; ++ ++#endif /* _SCTP_H */ +diff --git a/include/uapi/linux/seg6.h b/include/uapi/linux/seg6.h +new file mode 100644 +index 0000000..0715279 +--- /dev/null ++++ b/include/uapi/linux/seg6.h +@@ -0,0 +1,54 @@ ++/* ++ * SR-IPv6 implementation ++ * ++ * Author: ++ * David Lebrun ++ * ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version ++ * 2 of the License, or (at your option) any later version. ++ */ ++ ++#ifndef _LINUX_SEG6_H ++#define _LINUX_SEG6_H ++ ++#include ++#include /* For struct in6_addr. */ ++ ++/* ++ * SRH ++ */ ++struct ipv6_sr_hdr { ++ __u8 nexthdr; ++ __u8 hdrlen; ++ __u8 type; ++ __u8 segments_left; ++ __u8 first_segment; ++ __u8 flags; ++ __u16 reserved; ++ ++ struct in6_addr segments[0]; ++}; ++ ++#define SR6_FLAG1_PROTECTED (1 << 6) ++#define SR6_FLAG1_OAM (1 << 5) ++#define SR6_FLAG1_ALERT (1 << 4) ++#define SR6_FLAG1_HMAC (1 << 3) ++ ++#define SR6_TLV_INGRESS 1 ++#define SR6_TLV_EGRESS 2 ++#define SR6_TLV_OPAQUE 3 ++#define SR6_TLV_PADDING 4 ++#define SR6_TLV_HMAC 5 ++ ++#define sr_has_hmac(srh) ((srh)->flags & SR6_FLAG1_HMAC) ++ ++struct sr6_tlv { ++ __u8 type; ++ __u8 len; ++ __u8 data[0]; ++}; ++ ++#endif +diff --git a/include/uapi/linux/seg6_genl.h b/include/uapi/linux/seg6_genl.h +new file mode 100644 +index 0000000..99382f9 +--- /dev/null ++++ b/include/uapi/linux/seg6_genl.h +@@ -0,0 +1,32 @@ ++#ifndef _LINUX_SEG6_GENL_H ++#define _LINUX_SEG6_GENL_H ++ ++#define SEG6_GENL_NAME "SEG6" ++#define SEG6_GENL_VERSION 0x1 ++ ++enum { ++ SEG6_ATTR_UNSPEC, ++ SEG6_ATTR_DST, ++ SEG6_ATTR_DSTLEN, ++ SEG6_ATTR_HMACKEYID, ++ SEG6_ATTR_SECRET, ++ SEG6_ATTR_SECRETLEN, ++ SEG6_ATTR_ALGID, ++ SEG6_ATTR_HMACINFO, ++ __SEG6_ATTR_MAX, ++}; ++ ++#define SEG6_ATTR_MAX (__SEG6_ATTR_MAX - 1) ++ ++enum { ++ SEG6_CMD_UNSPEC, ++ SEG6_CMD_SETHMAC, ++ SEG6_CMD_DUMPHMAC, ++ SEG6_CMD_SET_TUNSRC, ++ SEG6_CMD_GET_TUNSRC, ++ __SEG6_CMD_MAX, ++}; ++ ++#define SEG6_CMD_MAX (__SEG6_CMD_MAX - 1) ++ ++#endif +diff --git a/include/uapi/linux/seg6_hmac.h b/include/uapi/linux/seg6_hmac.h +new file mode 100644 +index 0000000..704f93e +--- /dev/null ++++ b/include/uapi/linux/seg6_hmac.h +@@ -0,0 +1,22 @@ ++#ifndef _LINUX_SEG6_HMAC_H ++#define _LINUX_SEG6_HMAC_H ++ ++#include ++#include ++ ++#define SEG6_HMAC_SECRET_LEN 64 ++#define SEG6_HMAC_FIELD_LEN 32 ++ ++struct sr6_tlv_hmac { ++ struct sr6_tlv tlvhdr; ++ __u16 reserved; ++ __be32 hmackeyid; ++ __u8 hmac[SEG6_HMAC_FIELD_LEN]; ++}; ++ ++enum { ++ SEG6_HMAC_ALGO_SHA1 = 1, ++ SEG6_HMAC_ALGO_SHA256 = 2, ++}; ++ ++#endif +diff --git a/include/uapi/linux/seg6_iptunnel.h b/include/uapi/linux/seg6_iptunnel.h +new file mode 100644 +index 0000000..a5dc05a +--- /dev/null ++++ b/include/uapi/linux/seg6_iptunnel.h +@@ -0,0 +1,40 @@ ++/* ++ * SR-IPv6 implementation ++ * ++ * Author: ++ * David Lebrun ++ * ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version ++ * 2 of the License, or (at your option) any later version. ++ */ ++ ++#ifndef _LINUX_SEG6_IPTUNNEL_H ++#define _LINUX_SEG6_IPTUNNEL_H ++ ++#include /* For struct ipv6_sr_hdr. */ ++ ++enum { ++ SEG6_IPTUNNEL_UNSPEC, ++ SEG6_IPTUNNEL_SRH, ++ __SEG6_IPTUNNEL_MAX, ++}; ++#define SEG6_IPTUNNEL_MAX (__SEG6_IPTUNNEL_MAX - 1) ++ ++struct seg6_iptunnel_encap { ++ int mode; ++ struct ipv6_sr_hdr srh[0]; ++}; ++ ++#define SEG6_IPTUN_ENCAP_SIZE(x) ((sizeof(*x)) + (((x)->srh->hdrlen + 1) << 3)) ++ ++enum { ++ SEG6_IPTUN_MODE_INLINE, ++ SEG6_IPTUN_MODE_ENCAP, ++ SEG6_IPTUN_MODE_L2ENCAP, ++}; ++ ++ ++#endif +diff --git a/include/uapi/linux/seg6_local.h b/include/uapi/linux/seg6_local.h +new file mode 100644 +index 0000000..76b90d6 +--- /dev/null ++++ b/include/uapi/linux/seg6_local.h +@@ -0,0 +1,68 @@ ++/* ++ * SR-IPv6 implementation ++ * ++ * Author: ++ * David Lebrun ++ * ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version ++ * 2 of the License, or (at your option) any later version. ++ */ ++ ++#ifndef _LINUX_SEG6_LOCAL_H ++#define _LINUX_SEG6_LOCAL_H ++ ++#include ++ ++enum { ++ SEG6_LOCAL_UNSPEC, ++ SEG6_LOCAL_ACTION, ++ SEG6_LOCAL_SRH, ++ SEG6_LOCAL_TABLE, ++ SEG6_LOCAL_NH4, ++ SEG6_LOCAL_NH6, ++ SEG6_LOCAL_IIF, ++ SEG6_LOCAL_OIF, ++ __SEG6_LOCAL_MAX, ++}; ++#define SEG6_LOCAL_MAX (__SEG6_LOCAL_MAX - 1) ++ ++enum { ++ SEG6_LOCAL_ACTION_UNSPEC = 0, ++ /* node segment */ ++ SEG6_LOCAL_ACTION_END = 1, ++ /* adjacency segment (IPv6 cross-connect) */ ++ SEG6_LOCAL_ACTION_END_X = 2, ++ /* lookup of next seg NH in table */ ++ SEG6_LOCAL_ACTION_END_T = 3, ++ /* decap and L2 cross-connect */ ++ SEG6_LOCAL_ACTION_END_DX2 = 4, ++ /* decap and IPv6 cross-connect */ ++ SEG6_LOCAL_ACTION_END_DX6 = 5, ++ /* decap and IPv4 cross-connect */ ++ SEG6_LOCAL_ACTION_END_DX4 = 6, ++ /* decap and lookup of DA in v6 table */ ++ SEG6_LOCAL_ACTION_END_DT6 = 7, ++ /* decap and lookup of DA in v4 table */ ++ SEG6_LOCAL_ACTION_END_DT4 = 8, ++ /* binding segment with insertion */ ++ SEG6_LOCAL_ACTION_END_B6 = 9, ++ /* binding segment with encapsulation */ ++ SEG6_LOCAL_ACTION_END_B6_ENCAP = 10, ++ /* binding segment with MPLS encap */ ++ SEG6_LOCAL_ACTION_END_BM = 11, ++ /* lookup last seg in table */ ++ SEG6_LOCAL_ACTION_END_S = 12, ++ /* forward to SR-unaware VNF with static proxy */ ++ SEG6_LOCAL_ACTION_END_AS = 13, ++ /* forward to SR-unaware VNF with masquerading */ ++ SEG6_LOCAL_ACTION_END_AM = 14, ++ ++ __SEG6_LOCAL_ACTION_MAX, ++}; ++ ++#define SEG6_LOCAL_ACTION_MAX (__SEG6_LOCAL_ACTION_MAX - 1) ++ ++#endif +diff --git a/include/uapi/linux/sock_diag.h b/include/uapi/linux/sock_diag.h +new file mode 100644 +index 0000000..901231e +--- /dev/null ++++ b/include/uapi/linux/sock_diag.h +@@ -0,0 +1,38 @@ ++#ifndef __SOCK_DIAG_H__ ++#define __SOCK_DIAG_H__ ++ ++#include ++ ++#define SOCK_DIAG_BY_FAMILY 20 ++#define SOCK_DESTROY 21 ++ ++struct sock_diag_req { ++ __u8 sdiag_family; ++ __u8 sdiag_protocol; ++}; ++ ++enum { ++ SK_MEMINFO_RMEM_ALLOC, ++ SK_MEMINFO_RCVBUF, ++ SK_MEMINFO_WMEM_ALLOC, ++ SK_MEMINFO_SNDBUF, ++ SK_MEMINFO_FWD_ALLOC, ++ SK_MEMINFO_WMEM_QUEUED, ++ SK_MEMINFO_OPTMEM, ++ SK_MEMINFO_BACKLOG, ++ SK_MEMINFO_DROPS, ++ ++ SK_MEMINFO_VARS, ++}; ++ ++enum sknetlink_groups { ++ SKNLGRP_NONE, ++ SKNLGRP_INET_TCP_DESTROY, ++ SKNLGRP_INET_UDP_DESTROY, ++ SKNLGRP_INET6_TCP_DESTROY, ++ SKNLGRP_INET6_UDP_DESTROY, ++ __SKNLGRP_MAX, ++}; ++#define SKNLGRP_MAX (__SKNLGRP_MAX - 1) ++ ++#endif /* __SOCK_DIAG_H__ */ +diff --git a/include/uapi/linux/socket.h b/include/uapi/linux/socket.h +new file mode 100644 +index 0000000..8c1e501 +--- /dev/null ++++ b/include/uapi/linux/socket.h +@@ -0,0 +1,21 @@ ++#ifndef _LINUX_SOCKET_H ++#define _LINUX_SOCKET_H ++ ++/* ++ * 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; ++ ++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)]; ++ /* space to achieve desired size, */ ++ /* _SS_MAXSIZE value minus size of ss_family */ ++} __attribute__ ((aligned(_K_SS_ALIGNSIZE))); /* force desired alignment */ ++ ++#endif /* _LINUX_SOCKET_H */ +diff --git a/include/uapi/linux/sockios.h b/include/uapi/linux/sockios.h +new file mode 100644 +index 0000000..79d029d +--- /dev/null ++++ b/include/uapi/linux/sockios.h +@@ -0,0 +1,152 @@ ++/* ++ * INET An implementation of the TCP/IP protocol suite for the LINUX ++ * operating system. INET is implemented using the BSD Socket ++ * interface as the means of communication with the user level. ++ * ++ * Definitions of the socket-level I/O control calls. ++ * ++ * Version: @(#)sockios.h 1.0.2 03/09/93 ++ * ++ * Authors: Ross Biro ++ * Fred N. van Kempen, ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version ++ * 2 of the License, or (at your option) any later version. ++ */ ++#ifndef _LINUX_SOCKIOS_H ++#define _LINUX_SOCKIOS_H ++ ++#include ++ ++/* Linux-specific socket ioctls */ ++#define SIOCINQ FIONREAD ++#define SIOCOUTQ TIOCOUTQ /* output queue size (not sent + not acked) */ ++ ++#define SOCK_IOC_TYPE 0x89 ++ ++/* Routing table calls. */ ++#define SIOCADDRT 0x890B /* add routing table entry */ ++#define SIOCDELRT 0x890C /* delete routing table entry */ ++#define SIOCRTMSG 0x890D /* unused */ ++ ++/* Socket configuration controls. */ ++#define SIOCGIFNAME 0x8910 /* get iface name */ ++#define SIOCSIFLINK 0x8911 /* set iface channel */ ++#define SIOCGIFCONF 0x8912 /* get iface list */ ++#define SIOCGIFFLAGS 0x8913 /* get flags */ ++#define SIOCSIFFLAGS 0x8914 /* set flags */ ++#define SIOCGIFADDR 0x8915 /* get PA address */ ++#define SIOCSIFADDR 0x8916 /* set PA address */ ++#define SIOCGIFDSTADDR 0x8917 /* get remote PA address */ ++#define SIOCSIFDSTADDR 0x8918 /* set remote PA address */ ++#define SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */ ++#define SIOCSIFBRDADDR 0x891a /* set broadcast PA address */ ++#define SIOCGIFNETMASK 0x891b /* get network PA mask */ ++#define SIOCSIFNETMASK 0x891c /* set network PA mask */ ++#define SIOCGIFMETRIC 0x891d /* get metric */ ++#define SIOCSIFMETRIC 0x891e /* set metric */ ++#define SIOCGIFMEM 0x891f /* get memory address (BSD) */ ++#define SIOCSIFMEM 0x8920 /* set memory address (BSD) */ ++#define SIOCGIFMTU 0x8921 /* get MTU size */ ++#define SIOCSIFMTU 0x8922 /* set MTU size */ ++#define SIOCSIFNAME 0x8923 /* set interface name */ ++#define SIOCSIFHWADDR 0x8924 /* set hardware address */ ++#define SIOCGIFENCAP 0x8925 /* get/set encapsulations */ ++#define SIOCSIFENCAP 0x8926 ++#define SIOCGIFHWADDR 0x8927 /* Get hardware address */ ++#define SIOCGIFSLAVE 0x8929 /* Driver slaving support */ ++#define SIOCSIFSLAVE 0x8930 ++#define SIOCADDMULTI 0x8931 /* Multicast address lists */ ++#define SIOCDELMULTI 0x8932 ++#define SIOCGIFINDEX 0x8933 /* name -> if_index mapping */ ++#define SIOGIFINDEX SIOCGIFINDEX /* misprint compatibility :-) */ ++#define SIOCSIFPFLAGS 0x8934 /* set/get extended flags set */ ++#define SIOCGIFPFLAGS 0x8935 ++#define SIOCDIFADDR 0x8936 /* delete PA address */ ++#define SIOCSIFHWBROADCAST 0x8937 /* set hardware broadcast addr */ ++#define SIOCGIFCOUNT 0x8938 /* get number of devices */ ++ ++#define SIOCGIFBR 0x8940 /* Bridging support */ ++#define SIOCSIFBR 0x8941 /* Set bridging options */ ++ ++#define SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */ ++#define SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */ ++ ++/* SIOCGIFDIVERT was: 0x8944 Frame diversion support */ ++/* SIOCSIFDIVERT was: 0x8945 Set frame diversion options */ ++ ++#define SIOCETHTOOL 0x8946 /* Ethtool interface */ ++ ++#define SIOCGMIIPHY 0x8947 /* Get address of MII PHY in use. */ ++#define SIOCGMIIREG 0x8948 /* Read MII PHY register. */ ++#define SIOCSMIIREG 0x8949 /* Write MII PHY register. */ ++ ++#define SIOCWANDEV 0x894A /* get/set netdev parameters */ ++ ++#define SIOCOUTQNSD 0x894B /* output queue size (not sent only) */ ++#define SIOCGSKNS 0x894C /* get socket network namespace */ ++ ++/* ARP cache control calls. */ ++ /* 0x8950 - 0x8952 * obsolete calls, don't re-use */ ++#define SIOCDARP 0x8953 /* delete ARP table entry */ ++#define SIOCGARP 0x8954 /* get ARP table entry */ ++#define SIOCSARP 0x8955 /* set ARP table entry */ ++ ++/* RARP cache control calls. */ ++#define SIOCDRARP 0x8960 /* delete RARP table entry */ ++#define SIOCGRARP 0x8961 /* get RARP table entry */ ++#define SIOCSRARP 0x8962 /* set RARP table entry */ ++ ++/* Driver configuration calls */ ++ ++#define SIOCGIFMAP 0x8970 /* Get device parameters */ ++#define SIOCSIFMAP 0x8971 /* Set device parameters */ ++ ++/* DLCI configuration calls */ ++ ++#define SIOCADDDLCI 0x8980 /* Create new DLCI device */ ++#define SIOCDELDLCI 0x8981 /* Delete DLCI device */ ++ ++#define SIOCGIFVLAN 0x8982 /* 802.1Q VLAN support */ ++#define SIOCSIFVLAN 0x8983 /* Set 802.1Q VLAN options */ ++ ++/* bonding calls */ ++ ++#define SIOCBONDENSLAVE 0x8990 /* enslave a device to the bond */ ++#define SIOCBONDRELEASE 0x8991 /* release a slave from the bond*/ ++#define SIOCBONDSETHWADDR 0x8992 /* set the hw addr of the bond */ ++#define SIOCBONDSLAVEINFOQUERY 0x8993 /* rtn info about slave state */ ++#define SIOCBONDINFOQUERY 0x8994 /* rtn info about bond state */ ++#define SIOCBONDCHANGEACTIVE 0x8995 /* update to a new active slave */ ++ ++/* bridge calls */ ++#define SIOCBRADDBR 0x89a0 /* create new bridge device */ ++#define SIOCBRDELBR 0x89a1 /* remove bridge device */ ++#define SIOCBRADDIF 0x89a2 /* add interface to bridge */ ++#define SIOCBRDELIF 0x89a3 /* remove interface from bridge */ ++ ++/* hardware time stamping: parameters in linux/net_tstamp.h */ ++#define SIOCSHWTSTAMP 0x89b0 /* set and get config */ ++#define SIOCGHWTSTAMP 0x89b1 /* get config */ ++ ++/* Device private ioctl calls */ ++ ++/* ++ * These 16 ioctls are available to devices via the do_ioctl() device ++ * vector. Each device should include this file and redefine these names ++ * as their own. Because these are device dependent it is a good idea ++ * _NOT_ to issue them to random objects and hope. ++ * ++ * THESE IOCTLS ARE _DEPRECATED_ AND WILL DISAPPEAR IN 2.5.X -DaveM ++ */ ++ ++#define SIOCDEVPRIVATE 0x89F0 /* to 89FF */ ++ ++/* ++ * These 16 ioctl calls are protocol private ++ */ ++ ++#define SIOCPROTOPRIVATE 0x89E0 /* to 89EF */ ++#endif /* _LINUX_SOCKIOS_H */ +diff --git a/include/uapi/linux/stddef.h b/include/uapi/linux/stddef.h +new file mode 100644 +index 0000000..4bb69de +--- /dev/null ++++ b/include/uapi/linux/stddef.h +@@ -0,0 +1,5 @@ ++ ++ ++#ifndef __always_inline ++#define __always_inline __inline__ ++#endif +diff --git a/include/uapi/linux/sysinfo.h b/include/uapi/linux/sysinfo.h +new file mode 100644 +index 0000000..934335a +--- /dev/null ++++ b/include/uapi/linux/sysinfo.h +@@ -0,0 +1,24 @@ ++#ifndef _LINUX_SYSINFO_H ++#define _LINUX_SYSINFO_H ++ ++#include ++ ++#define SI_LOAD_SHIFT 16 ++struct sysinfo { ++ __kernel_long_t uptime; /* Seconds since boot */ ++ __kernel_ulong_t loads[3]; /* 1, 5, and 15 minute load averages */ ++ __kernel_ulong_t totalram; /* Total usable main memory size */ ++ __kernel_ulong_t freeram; /* Available memory size */ ++ __kernel_ulong_t sharedram; /* Amount of shared memory */ ++ __kernel_ulong_t bufferram; /* Memory used by buffers */ ++ __kernel_ulong_t totalswap; /* Total swap space size */ ++ __kernel_ulong_t freeswap; /* swap space still available */ ++ __u16 procs; /* Number of current processes */ ++ __u16 pad; /* Explicit padding for m68k */ ++ __kernel_ulong_t totalhigh; /* Total high memory size */ ++ __kernel_ulong_t freehigh; /* Available high memory size */ ++ __u32 mem_unit; /* Memory unit size in bytes */ ++ char _f[20-2*sizeof(__kernel_ulong_t)-sizeof(__u32)]; /* Padding: libc5 uses this.. */ ++}; ++ ++#endif /* _LINUX_SYSINFO_H */ +diff --git a/include/uapi/linux/tc_act/tc_bpf.h b/include/uapi/linux/tc_act/tc_bpf.h +new file mode 100644 +index 0000000..8dc2ac0 +--- /dev/null ++++ b/include/uapi/linux/tc_act/tc_bpf.h +@@ -0,0 +1,36 @@ ++/* ++ * Copyright (c) 2015 Jiri Pirko ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ */ ++ ++#ifndef __LINUX_TC_BPF_H ++#define __LINUX_TC_BPF_H ++ ++#include ++ ++#define TCA_ACT_BPF 13 ++ ++struct tc_act_bpf { ++ tc_gen; ++}; ++ ++enum { ++ TCA_ACT_BPF_UNSPEC, ++ TCA_ACT_BPF_TM, ++ TCA_ACT_BPF_PARMS, ++ TCA_ACT_BPF_OPS_LEN, ++ TCA_ACT_BPF_OPS, ++ TCA_ACT_BPF_FD, ++ TCA_ACT_BPF_NAME, ++ TCA_ACT_BPF_PAD, ++ TCA_ACT_BPF_TAG, ++ TCA_ACT_BPF_ID, ++ __TCA_ACT_BPF_MAX, ++}; ++#define TCA_ACT_BPF_MAX (__TCA_ACT_BPF_MAX - 1) ++ ++#endif +diff --git a/include/uapi/linux/tc_act/tc_connmark.h b/include/uapi/linux/tc_act/tc_connmark.h +new file mode 100644 +index 0000000..62a5e94 +--- /dev/null ++++ b/include/uapi/linux/tc_act/tc_connmark.h +@@ -0,0 +1,23 @@ ++#ifndef __UAPI_TC_CONNMARK_H ++#define __UAPI_TC_CONNMARK_H ++ ++#include ++#include ++ ++#define TCA_ACT_CONNMARK 14 ++ ++struct tc_connmark { ++ tc_gen; ++ __u16 zone; ++}; ++ ++enum { ++ TCA_CONNMARK_UNSPEC, ++ TCA_CONNMARK_PARMS, ++ TCA_CONNMARK_TM, ++ TCA_CONNMARK_PAD, ++ __TCA_CONNMARK_MAX ++}; ++#define TCA_CONNMARK_MAX (__TCA_CONNMARK_MAX - 1) ++ ++#endif +diff --git a/include/uapi/linux/tc_act/tc_csum.h b/include/uapi/linux/tc_act/tc_csum.h +new file mode 100644 +index 0000000..a11bb35 +--- /dev/null ++++ b/include/uapi/linux/tc_act/tc_csum.h +@@ -0,0 +1,34 @@ ++#ifndef __LINUX_TC_CSUM_H ++#define __LINUX_TC_CSUM_H ++ ++#include ++#include ++ ++#define TCA_ACT_CSUM 16 ++ ++enum { ++ TCA_CSUM_UNSPEC, ++ TCA_CSUM_PARMS, ++ TCA_CSUM_TM, ++ TCA_CSUM_PAD, ++ __TCA_CSUM_MAX ++}; ++#define TCA_CSUM_MAX (__TCA_CSUM_MAX - 1) ++ ++enum { ++ TCA_CSUM_UPDATE_FLAG_IPV4HDR = 1, ++ TCA_CSUM_UPDATE_FLAG_ICMP = 2, ++ TCA_CSUM_UPDATE_FLAG_IGMP = 4, ++ TCA_CSUM_UPDATE_FLAG_TCP = 8, ++ TCA_CSUM_UPDATE_FLAG_UDP = 16, ++ TCA_CSUM_UPDATE_FLAG_UDPLITE = 32, ++ TCA_CSUM_UPDATE_FLAG_SCTP = 64, ++}; ++ ++struct tc_csum { ++ tc_gen; ++ ++ __u32 update_flags; ++}; ++ ++#endif /* __LINUX_TC_CSUM_H */ +diff --git a/include/uapi/linux/tc_act/tc_defact.h b/include/uapi/linux/tc_act/tc_defact.h +new file mode 100644 +index 0000000..d2a3abb +--- /dev/null ++++ b/include/uapi/linux/tc_act/tc_defact.h +@@ -0,0 +1,20 @@ ++#ifndef __LINUX_TC_DEF_H ++#define __LINUX_TC_DEF_H ++ ++#include ++ ++struct tc_defact { ++ tc_gen; ++}; ++ ++enum { ++ TCA_DEF_UNSPEC, ++ TCA_DEF_TM, ++ TCA_DEF_PARMS, ++ TCA_DEF_DATA, ++ TCA_DEF_PAD, ++ __TCA_DEF_MAX ++}; ++#define TCA_DEF_MAX (__TCA_DEF_MAX - 1) ++ ++#endif +diff --git a/include/uapi/linux/tc_act/tc_gact.h b/include/uapi/linux/tc_act/tc_gact.h +new file mode 100644 +index 0000000..70b536a +--- /dev/null ++++ b/include/uapi/linux/tc_act/tc_gact.h +@@ -0,0 +1,33 @@ ++#ifndef __LINUX_TC_GACT_H ++#define __LINUX_TC_GACT_H ++ ++#include ++#include ++ ++#define TCA_ACT_GACT 5 ++struct tc_gact { ++ tc_gen; ++ ++}; ++ ++struct tc_gact_p { ++#define PGACT_NONE 0 ++#define PGACT_NETRAND 1 ++#define PGACT_DETERM 2 ++#define MAX_RAND (PGACT_DETERM + 1 ) ++ __u16 ptype; ++ __u16 pval; ++ int paction; ++}; ++ ++enum { ++ TCA_GACT_UNSPEC, ++ TCA_GACT_TM, ++ TCA_GACT_PARMS, ++ TCA_GACT_PROB, ++ TCA_GACT_PAD, ++ __TCA_GACT_MAX ++}; ++#define TCA_GACT_MAX (__TCA_GACT_MAX - 1) ++ ++#endif +diff --git a/include/uapi/linux/tc_act/tc_ife.h b/include/uapi/linux/tc_act/tc_ife.h +new file mode 100644 +index 0000000..7c28178 +--- /dev/null ++++ b/include/uapi/linux/tc_act/tc_ife.h +@@ -0,0 +1,32 @@ ++#ifndef __UAPI_TC_IFE_H ++#define __UAPI_TC_IFE_H ++ ++#include ++#include ++#include ++ ++#define TCA_ACT_IFE 25 ++/* Flag bits for now just encoding/decoding; mutually exclusive */ ++#define IFE_ENCODE 1 ++#define IFE_DECODE 0 ++ ++struct tc_ife { ++ tc_gen; ++ __u16 flags; ++}; ++ ++/*XXX: We need to encode the total number of bytes consumed */ ++enum { ++ TCA_IFE_UNSPEC, ++ TCA_IFE_PARMS, ++ TCA_IFE_TM, ++ TCA_IFE_DMAC, ++ TCA_IFE_SMAC, ++ TCA_IFE_TYPE, ++ TCA_IFE_METALST, ++ TCA_IFE_PAD, ++ __TCA_IFE_MAX ++}; ++#define TCA_IFE_MAX (__TCA_IFE_MAX - 1) ++ ++#endif +diff --git a/include/uapi/linux/tc_act/tc_ipt.h b/include/uapi/linux/tc_act/tc_ipt.h +new file mode 100644 +index 0000000..7c6e155 +--- /dev/null ++++ b/include/uapi/linux/tc_act/tc_ipt.h +@@ -0,0 +1,22 @@ ++#ifndef __LINUX_TC_IPT_H ++#define __LINUX_TC_IPT_H ++ ++#include ++ ++#define TCA_ACT_IPT 6 ++#define TCA_ACT_XT 10 ++ ++enum { ++ TCA_IPT_UNSPEC, ++ TCA_IPT_TABLE, ++ TCA_IPT_HOOK, ++ TCA_IPT_INDEX, ++ TCA_IPT_CNT, ++ TCA_IPT_TM, ++ TCA_IPT_TARG, ++ TCA_IPT_PAD, ++ __TCA_IPT_MAX ++}; ++#define TCA_IPT_MAX (__TCA_IPT_MAX - 1) ++ ++#endif +diff --git a/include/uapi/linux/tc_act/tc_mirred.h b/include/uapi/linux/tc_act/tc_mirred.h +new file mode 100644 +index 0000000..3d7a2b3 +--- /dev/null ++++ b/include/uapi/linux/tc_act/tc_mirred.h +@@ -0,0 +1,28 @@ ++#ifndef __LINUX_TC_MIR_H ++#define __LINUX_TC_MIR_H ++ ++#include ++#include ++ ++#define TCA_ACT_MIRRED 8 ++#define TCA_EGRESS_REDIR 1 /* packet redirect to EGRESS*/ ++#define TCA_EGRESS_MIRROR 2 /* mirror packet to EGRESS */ ++#define TCA_INGRESS_REDIR 3 /* packet redirect to INGRESS*/ ++#define TCA_INGRESS_MIRROR 4 /* mirror packet to INGRESS */ ++ ++struct tc_mirred { ++ tc_gen; ++ int eaction; /* one of IN/EGRESS_MIRROR/REDIR */ ++ __u32 ifindex; /* ifindex of egress port */ ++}; ++ ++enum { ++ TCA_MIRRED_UNSPEC, ++ TCA_MIRRED_TM, ++ TCA_MIRRED_PARMS, ++ TCA_MIRRED_PAD, ++ __TCA_MIRRED_MAX ++}; ++#define TCA_MIRRED_MAX (__TCA_MIRRED_MAX - 1) ++ ++#endif +diff --git a/include/uapi/linux/tc_act/tc_nat.h b/include/uapi/linux/tc_act/tc_nat.h +new file mode 100644 +index 0000000..923457c +--- /dev/null ++++ b/include/uapi/linux/tc_act/tc_nat.h +@@ -0,0 +1,28 @@ ++#ifndef __LINUX_TC_NAT_H ++#define __LINUX_TC_NAT_H ++ ++#include ++#include ++ ++#define TCA_ACT_NAT 9 ++ ++enum { ++ TCA_NAT_UNSPEC, ++ TCA_NAT_PARMS, ++ TCA_NAT_TM, ++ TCA_NAT_PAD, ++ __TCA_NAT_MAX ++}; ++#define TCA_NAT_MAX (__TCA_NAT_MAX - 1) ++ ++#define TCA_NAT_FLAG_EGRESS 1 ++ ++struct tc_nat { ++ tc_gen; ++ __be32 old_addr; ++ __be32 new_addr; ++ __be32 mask; ++ __u32 flags; ++}; ++ ++#endif +diff --git a/include/uapi/linux/tc_act/tc_pedit.h b/include/uapi/linux/tc_act/tc_pedit.h +new file mode 100644 +index 0000000..143d2b3 +--- /dev/null ++++ b/include/uapi/linux/tc_act/tc_pedit.h +@@ -0,0 +1,66 @@ ++#ifndef __LINUX_TC_PED_H ++#define __LINUX_TC_PED_H ++ ++#include ++#include ++ ++#define TCA_ACT_PEDIT 7 ++ ++enum { ++ TCA_PEDIT_UNSPEC, ++ TCA_PEDIT_TM, ++ TCA_PEDIT_PARMS, ++ TCA_PEDIT_PAD, ++ TCA_PEDIT_PARMS_EX, ++ TCA_PEDIT_KEYS_EX, ++ TCA_PEDIT_KEY_EX, ++ __TCA_PEDIT_MAX ++}; ++#define TCA_PEDIT_MAX (__TCA_PEDIT_MAX - 1) ++ ++enum { ++ TCA_PEDIT_KEY_EX_HTYPE = 1, ++ TCA_PEDIT_KEY_EX_CMD = 2, ++ __TCA_PEDIT_KEY_EX_MAX ++}; ++#define TCA_PEDIT_KEY_EX_MAX (__TCA_PEDIT_KEY_EX_MAX - 1) ++ ++ /* TCA_PEDIT_KEY_EX_HDR_TYPE_NETWROK is a special case for legacy users. It ++ * means no specific header type - offset is relative to the network layer ++ */ ++enum pedit_header_type { ++ TCA_PEDIT_KEY_EX_HDR_TYPE_NETWORK = 0, ++ TCA_PEDIT_KEY_EX_HDR_TYPE_ETH = 1, ++ TCA_PEDIT_KEY_EX_HDR_TYPE_IP4 = 2, ++ TCA_PEDIT_KEY_EX_HDR_TYPE_IP6 = 3, ++ TCA_PEDIT_KEY_EX_HDR_TYPE_TCP = 4, ++ TCA_PEDIT_KEY_EX_HDR_TYPE_UDP = 5, ++ __PEDIT_HDR_TYPE_MAX, ++}; ++#define TCA_PEDIT_HDR_TYPE_MAX (__PEDIT_HDR_TYPE_MAX - 1) ++ ++enum pedit_cmd { ++ TCA_PEDIT_KEY_EX_CMD_SET = 0, ++ TCA_PEDIT_KEY_EX_CMD_ADD = 1, ++ __PEDIT_CMD_MAX, ++}; ++#define TCA_PEDIT_CMD_MAX (__PEDIT_CMD_MAX - 1) ++ ++struct tc_pedit_key { ++ __u32 mask; /* AND */ ++ __u32 val; /*XOR */ ++ __u32 off; /*offset */ ++ __u32 at; ++ __u32 offmask; ++ __u32 shift; ++}; ++ ++struct tc_pedit_sel { ++ tc_gen; ++ unsigned char nkeys; ++ unsigned char flags; ++ struct tc_pedit_key keys[0]; ++}; ++#define tc_pedit tc_pedit_sel ++ ++#endif +diff --git a/include/uapi/linux/tc_act/tc_sample.h b/include/uapi/linux/tc_act/tc_sample.h +new file mode 100644 +index 0000000..edc9058 +--- /dev/null ++++ b/include/uapi/linux/tc_act/tc_sample.h +@@ -0,0 +1,26 @@ ++#ifndef __LINUX_TC_SAMPLE_H ++#define __LINUX_TC_SAMPLE_H ++ ++#include ++#include ++#include ++ ++#define TCA_ACT_SAMPLE 26 ++ ++struct tc_sample { ++ tc_gen; ++}; ++ ++enum { ++ TCA_SAMPLE_UNSPEC, ++ TCA_SAMPLE_TM, ++ TCA_SAMPLE_PARMS, ++ TCA_SAMPLE_RATE, ++ TCA_SAMPLE_TRUNC_SIZE, ++ TCA_SAMPLE_PSAMPLE_GROUP, ++ TCA_SAMPLE_PAD, ++ __TCA_SAMPLE_MAX ++}; ++#define TCA_SAMPLE_MAX (__TCA_SAMPLE_MAX - 1) ++ ++#endif +diff --git a/include/uapi/linux/tc_act/tc_skbedit.h b/include/uapi/linux/tc_act/tc_skbedit.h +new file mode 100644 +index 0000000..2884425 +--- /dev/null ++++ b/include/uapi/linux/tc_act/tc_skbedit.h +@@ -0,0 +1,51 @@ ++/* ++ * Copyright (c) 2008, Intel Corporation. ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms and conditions of the GNU General Public License, ++ * version 2, as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ++ * more details. ++ * ++ * You should have received a copy of the GNU General Public License along with ++ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple ++ * Place - Suite 330, Boston, MA 02111-1307 USA. ++ * ++ * Author: Alexander Duyck ++ */ ++ ++#ifndef __LINUX_TC_SKBEDIT_H ++#define __LINUX_TC_SKBEDIT_H ++ ++#include ++ ++#define TCA_ACT_SKBEDIT 11 ++ ++#define SKBEDIT_F_PRIORITY 0x1 ++#define SKBEDIT_F_QUEUE_MAPPING 0x2 ++#define SKBEDIT_F_MARK 0x4 ++#define SKBEDIT_F_PTYPE 0x8 ++#define SKBEDIT_F_MASK 0x10 ++ ++struct tc_skbedit { ++ tc_gen; ++}; ++ ++enum { ++ TCA_SKBEDIT_UNSPEC, ++ TCA_SKBEDIT_TM, ++ TCA_SKBEDIT_PARMS, ++ TCA_SKBEDIT_PRIORITY, ++ TCA_SKBEDIT_QUEUE_MAPPING, ++ TCA_SKBEDIT_MARK, ++ TCA_SKBEDIT_PAD, ++ TCA_SKBEDIT_PTYPE, ++ TCA_SKBEDIT_MASK, ++ __TCA_SKBEDIT_MAX ++}; ++#define TCA_SKBEDIT_MAX (__TCA_SKBEDIT_MAX - 1) ++ ++#endif +diff --git a/include/uapi/linux/tc_act/tc_skbmod.h b/include/uapi/linux/tc_act/tc_skbmod.h +new file mode 100644 +index 0000000..10fc07d +--- /dev/null ++++ b/include/uapi/linux/tc_act/tc_skbmod.h +@@ -0,0 +1,39 @@ ++/* ++ * Copyright (c) 2016, Jamal Hadi Salim ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++*/ ++ ++#ifndef __LINUX_TC_SKBMOD_H ++#define __LINUX_TC_SKBMOD_H ++ ++#include ++ ++#define TCA_ACT_SKBMOD 15 ++ ++#define SKBMOD_F_DMAC 0x1 ++#define SKBMOD_F_SMAC 0x2 ++#define SKBMOD_F_ETYPE 0x4 ++#define SKBMOD_F_SWAPMAC 0x8 ++ ++struct tc_skbmod { ++ tc_gen; ++ __u64 flags; ++}; ++ ++enum { ++ TCA_SKBMOD_UNSPEC, ++ TCA_SKBMOD_TM, ++ TCA_SKBMOD_PARMS, ++ TCA_SKBMOD_DMAC, ++ TCA_SKBMOD_SMAC, ++ TCA_SKBMOD_ETYPE, ++ TCA_SKBMOD_PAD, ++ __TCA_SKBMOD_MAX ++}; ++#define TCA_SKBMOD_MAX (__TCA_SKBMOD_MAX - 1) ++ ++#endif +diff --git a/include/uapi/linux/tc_act/tc_tunnel_key.h b/include/uapi/linux/tc_act/tc_tunnel_key.h +new file mode 100644 +index 0000000..afcd4be +--- /dev/null ++++ b/include/uapi/linux/tc_act/tc_tunnel_key.h +@@ -0,0 +1,43 @@ ++/* ++ * Copyright (c) 2016, Amir Vadai ++ * Copyright (c) 2016, Mellanox Technologies. All rights reserved. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ */ ++ ++#ifndef __LINUX_TC_TUNNEL_KEY_H ++#define __LINUX_TC_TUNNEL_KEY_H ++ ++#include ++ ++#define TCA_ACT_TUNNEL_KEY 17 ++ ++#define TCA_TUNNEL_KEY_ACT_SET 1 ++#define TCA_TUNNEL_KEY_ACT_RELEASE 2 ++ ++struct tc_tunnel_key { ++ tc_gen; ++ int t_action; ++}; ++ ++enum { ++ TCA_TUNNEL_KEY_UNSPEC, ++ TCA_TUNNEL_KEY_TM, ++ TCA_TUNNEL_KEY_PARMS, ++ TCA_TUNNEL_KEY_ENC_IPV4_SRC, /* be32 */ ++ TCA_TUNNEL_KEY_ENC_IPV4_DST, /* be32 */ ++ TCA_TUNNEL_KEY_ENC_IPV6_SRC, /* struct in6_addr */ ++ TCA_TUNNEL_KEY_ENC_IPV6_DST, /* struct in6_addr */ ++ TCA_TUNNEL_KEY_ENC_KEY_ID, /* be64 */ ++ TCA_TUNNEL_KEY_PAD, ++ TCA_TUNNEL_KEY_ENC_DST_PORT, /* be16 */ ++ TCA_TUNNEL_KEY_NO_CSUM, /* u8 */ ++ __TCA_TUNNEL_KEY_MAX, ++}; ++ ++#define TCA_TUNNEL_KEY_MAX (__TCA_TUNNEL_KEY_MAX - 1) ++ ++#endif +diff --git a/include/uapi/linux/tc_act/tc_vlan.h b/include/uapi/linux/tc_act/tc_vlan.h +new file mode 100644 +index 0000000..bddb272 +--- /dev/null ++++ b/include/uapi/linux/tc_act/tc_vlan.h +@@ -0,0 +1,38 @@ ++/* ++ * Copyright (c) 2014 Jiri Pirko ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ */ ++ ++#ifndef __LINUX_TC_VLAN_H ++#define __LINUX_TC_VLAN_H ++ ++#include ++ ++#define TCA_ACT_VLAN 12 ++ ++#define TCA_VLAN_ACT_POP 1 ++#define TCA_VLAN_ACT_PUSH 2 ++#define TCA_VLAN_ACT_MODIFY 3 ++ ++struct tc_vlan { ++ tc_gen; ++ int v_action; ++}; ++ ++enum { ++ TCA_VLAN_UNSPEC, ++ TCA_VLAN_TM, ++ TCA_VLAN_PARMS, ++ TCA_VLAN_PUSH_VLAN_ID, ++ TCA_VLAN_PUSH_VLAN_PROTOCOL, ++ TCA_VLAN_PAD, ++ TCA_VLAN_PUSH_VLAN_PRIORITY, ++ __TCA_VLAN_MAX, ++}; ++#define TCA_VLAN_MAX (__TCA_VLAN_MAX - 1) ++ ++#endif +diff --git a/include/uapi/linux/tc_ematch/tc_em_cmp.h b/include/uapi/linux/tc_ematch/tc_em_cmp.h +new file mode 100644 +index 0000000..f34bb1b +--- /dev/null ++++ b/include/uapi/linux/tc_ematch/tc_em_cmp.h +@@ -0,0 +1,25 @@ ++#ifndef __LINUX_TC_EM_CMP_H ++#define __LINUX_TC_EM_CMP_H ++ ++#include ++#include ++ ++struct tcf_em_cmp { ++ __u32 val; ++ __u32 mask; ++ __u16 off; ++ __u8 align:4; ++ __u8 flags:4; ++ __u8 layer:4; ++ __u8 opnd:4; ++}; ++ ++enum { ++ TCF_EM_ALIGN_U8 = 1, ++ TCF_EM_ALIGN_U16 = 2, ++ TCF_EM_ALIGN_U32 = 4 ++}; ++ ++#define TCF_EM_CMP_TRANS 1 ++ ++#endif +diff --git a/include/uapi/linux/tc_ematch/tc_em_meta.h b/include/uapi/linux/tc_ematch/tc_em_meta.h +new file mode 100644 +index 0000000..b11f8ce +--- /dev/null ++++ b/include/uapi/linux/tc_ematch/tc_em_meta.h +@@ -0,0 +1,92 @@ ++#ifndef __LINUX_TC_EM_META_H ++#define __LINUX_TC_EM_META_H ++ ++#include ++#include ++ ++enum { ++ TCA_EM_META_UNSPEC, ++ TCA_EM_META_HDR, ++ TCA_EM_META_LVALUE, ++ TCA_EM_META_RVALUE, ++ __TCA_EM_META_MAX ++}; ++#define TCA_EM_META_MAX (__TCA_EM_META_MAX - 1) ++ ++struct tcf_meta_val { ++ __u16 kind; ++ __u8 shift; ++ __u8 op; ++}; ++ ++#define TCF_META_TYPE_MASK (0xf << 12) ++#define TCF_META_TYPE(kind) (((kind) & TCF_META_TYPE_MASK) >> 12) ++#define TCF_META_ID_MASK 0x7ff ++#define TCF_META_ID(kind) ((kind) & TCF_META_ID_MASK) ++ ++enum { ++ TCF_META_TYPE_VAR, ++ TCF_META_TYPE_INT, ++ __TCF_META_TYPE_MAX ++}; ++#define TCF_META_TYPE_MAX (__TCF_META_TYPE_MAX - 1) ++ ++enum { ++ TCF_META_ID_VALUE, ++ TCF_META_ID_RANDOM, ++ TCF_META_ID_LOADAVG_0, ++ TCF_META_ID_LOADAVG_1, ++ TCF_META_ID_LOADAVG_2, ++ TCF_META_ID_DEV, ++ TCF_META_ID_PRIORITY, ++ TCF_META_ID_PROTOCOL, ++ TCF_META_ID_PKTTYPE, ++ TCF_META_ID_PKTLEN, ++ TCF_META_ID_DATALEN, ++ TCF_META_ID_MACLEN, ++ TCF_META_ID_NFMARK, ++ TCF_META_ID_TCINDEX, ++ TCF_META_ID_RTCLASSID, ++ TCF_META_ID_RTIIF, ++ TCF_META_ID_SK_FAMILY, ++ TCF_META_ID_SK_STATE, ++ TCF_META_ID_SK_REUSE, ++ TCF_META_ID_SK_BOUND_IF, ++ TCF_META_ID_SK_REFCNT, ++ TCF_META_ID_SK_SHUTDOWN, ++ TCF_META_ID_SK_PROTO, ++ TCF_META_ID_SK_TYPE, ++ TCF_META_ID_SK_RCVBUF, ++ TCF_META_ID_SK_RMEM_ALLOC, ++ TCF_META_ID_SK_WMEM_ALLOC, ++ TCF_META_ID_SK_OMEM_ALLOC, ++ TCF_META_ID_SK_WMEM_QUEUED, ++ TCF_META_ID_SK_RCV_QLEN, ++ TCF_META_ID_SK_SND_QLEN, ++ TCF_META_ID_SK_ERR_QLEN, ++ TCF_META_ID_SK_FORWARD_ALLOCS, ++ TCF_META_ID_SK_SNDBUF, ++ TCF_META_ID_SK_ALLOCS, ++ __TCF_META_ID_SK_ROUTE_CAPS, /* unimplemented but in ABI already */ ++ TCF_META_ID_SK_HASH, ++ TCF_META_ID_SK_LINGERTIME, ++ TCF_META_ID_SK_ACK_BACKLOG, ++ TCF_META_ID_SK_MAX_ACK_BACKLOG, ++ TCF_META_ID_SK_PRIO, ++ TCF_META_ID_SK_RCVLOWAT, ++ TCF_META_ID_SK_RCVTIMEO, ++ TCF_META_ID_SK_SNDTIMEO, ++ TCF_META_ID_SK_SENDMSG_OFF, ++ TCF_META_ID_SK_WRITE_PENDING, ++ TCF_META_ID_VLAN_TAG, ++ TCF_META_ID_RXHASH, ++ __TCF_META_ID_MAX ++}; ++#define TCF_META_ID_MAX (__TCF_META_ID_MAX - 1) ++ ++struct tcf_meta_hdr { ++ struct tcf_meta_val left; ++ struct tcf_meta_val right; ++}; ++ ++#endif +diff --git a/include/uapi/linux/tc_ematch/tc_em_nbyte.h b/include/uapi/linux/tc_ematch/tc_em_nbyte.h +new file mode 100644 +index 0000000..7172cfb +--- /dev/null ++++ b/include/uapi/linux/tc_ematch/tc_em_nbyte.h +@@ -0,0 +1,13 @@ ++#ifndef __LINUX_TC_EM_NBYTE_H ++#define __LINUX_TC_EM_NBYTE_H ++ ++#include ++#include ++ ++struct tcf_em_nbyte { ++ __u16 off; ++ __u16 len:12; ++ __u8 layer:4; ++}; ++ ++#endif +diff --git a/include/uapi/linux/tcp.h b/include/uapi/linux/tcp.h +new file mode 100644 +index 0000000..8edad3f +--- /dev/null ++++ b/include/uapi/linux/tcp.h +@@ -0,0 +1,268 @@ ++/* ++ * INET An implementation of the TCP/IP protocol suite for the LINUX ++ * operating system. INET is implemented using the BSD Socket ++ * interface as the means of communication with the user level. ++ * ++ * Definitions for the TCP protocol. ++ * ++ * Version: @(#)tcp.h 1.0.2 04/28/93 ++ * ++ * Author: Fred N. van Kempen, ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version ++ * 2 of the License, or (at your option) any later version. ++ */ ++#ifndef _LINUX_TCP_H ++#define _LINUX_TCP_H ++ ++#include ++#include ++#include ++ ++struct tcphdr { ++ __be16 source; ++ __be16 dest; ++ __be32 seq; ++ __be32 ack_seq; ++#if defined(__LITTLE_ENDIAN_BITFIELD) ++ __u16 res1:4, ++ doff:4, ++ fin:1, ++ syn:1, ++ rst:1, ++ psh:1, ++ ack:1, ++ urg:1, ++ ece:1, ++ cwr:1; ++#elif defined(__BIG_ENDIAN_BITFIELD) ++ __u16 doff:4, ++ res1:4, ++ cwr:1, ++ ece:1, ++ urg:1, ++ ack:1, ++ psh:1, ++ rst:1, ++ syn:1, ++ fin:1; ++#else ++#error "Adjust your defines" ++#endif ++ __be16 window; ++ __sum16 check; ++ __be16 urg_ptr; ++}; ++ ++/* ++ * The union cast uses a gcc extension to avoid aliasing problems ++ * (union is compatible to any of its members) ++ * This means this part of the code is -fstrict-aliasing safe now. ++ */ ++union tcp_word_hdr { ++ struct tcphdr hdr; ++ __be32 words[5]; ++}; ++ ++#define tcp_flag_word(tp) ( ((union tcp_word_hdr *)(tp))->words [3]) ++ ++enum { ++ TCP_FLAG_CWR = __constant_cpu_to_be32(0x00800000), ++ TCP_FLAG_ECE = __constant_cpu_to_be32(0x00400000), ++ TCP_FLAG_URG = __constant_cpu_to_be32(0x00200000), ++ TCP_FLAG_ACK = __constant_cpu_to_be32(0x00100000), ++ TCP_FLAG_PSH = __constant_cpu_to_be32(0x00080000), ++ TCP_FLAG_RST = __constant_cpu_to_be32(0x00040000), ++ TCP_FLAG_SYN = __constant_cpu_to_be32(0x00020000), ++ TCP_FLAG_FIN = __constant_cpu_to_be32(0x00010000), ++ TCP_RESERVED_BITS = __constant_cpu_to_be32(0x0F000000), ++ TCP_DATA_OFFSET = __constant_cpu_to_be32(0xF0000000) ++}; ++ ++/* ++ * TCP general constants ++ */ ++#define TCP_MSS_DEFAULT 536U /* IPv4 (RFC1122, RFC2581) */ ++#define TCP_MSS_DESIRED 1220U /* IPv6 (tunneled), EDNS0 (RFC3226) */ ++ ++/* TCP socket options */ ++#define TCP_NODELAY 1 /* Turn off Nagle's algorithm. */ ++#define TCP_MAXSEG 2 /* Limit MSS */ ++#define TCP_CORK 3 /* Never send partially complete segments */ ++#define TCP_KEEPIDLE 4 /* Start keeplives after this period */ ++#define TCP_KEEPINTVL 5 /* Interval between keepalives */ ++#define TCP_KEEPCNT 6 /* Number of keepalives before death */ ++#define TCP_SYNCNT 7 /* Number of SYN retransmits */ ++#define TCP_LINGER2 8 /* Life time of orphaned FIN-WAIT-2 state */ ++#define TCP_DEFER_ACCEPT 9 /* Wake up listener only when data arrive */ ++#define TCP_WINDOW_CLAMP 10 /* Bound advertised window */ ++#define TCP_INFO 11 /* Information about this connection. */ ++#define TCP_QUICKACK 12 /* Block/reenable quick acks */ ++#define TCP_CONGESTION 13 /* Congestion control algorithm */ ++#define TCP_MD5SIG 14 /* TCP MD5 Signature (RFC2385) */ ++#define TCP_THIN_LINEAR_TIMEOUTS 16 /* Use linear timeouts for thin streams*/ ++#define TCP_THIN_DUPACK 17 /* Fast retrans. after 1 dupack */ ++#define TCP_USER_TIMEOUT 18 /* How long for loss retry before timeout */ ++#define TCP_REPAIR 19 /* TCP sock is under repair right now */ ++#define TCP_REPAIR_QUEUE 20 ++#define TCP_QUEUE_SEQ 21 ++#define TCP_REPAIR_OPTIONS 22 ++#define TCP_FASTOPEN 23 /* Enable FastOpen on listeners */ ++#define TCP_TIMESTAMP 24 ++#define TCP_NOTSENT_LOWAT 25 /* limit number of unsent bytes in write queue */ ++#define TCP_CC_INFO 26 /* Get Congestion Control (optional) info */ ++#define TCP_SAVE_SYN 27 /* Record SYN headers for new connections */ ++#define TCP_SAVED_SYN 28 /* Get SYN headers recorded for connection */ ++#define TCP_REPAIR_WINDOW 29 /* Get/set window parameters */ ++#define TCP_FASTOPEN_CONNECT 30 /* Attempt FastOpen with connect */ ++#define TCP_ULP 31 /* Attach a ULP to a TCP connection */ ++#define TCP_MD5SIG_EXT 32 /* TCP MD5 Signature with extensions */ ++ ++struct tcp_repair_opt { ++ __u32 opt_code; ++ __u32 opt_val; ++}; ++ ++struct tcp_repair_window { ++ __u32 snd_wl1; ++ __u32 snd_wnd; ++ __u32 max_window; ++ ++ __u32 rcv_wnd; ++ __u32 rcv_wup; ++}; ++ ++enum { ++ TCP_NO_QUEUE, ++ TCP_RECV_QUEUE, ++ TCP_SEND_QUEUE, ++ TCP_QUEUES_NR, ++}; ++ ++/* for TCP_INFO socket option */ ++#define TCPI_OPT_TIMESTAMPS 1 ++#define TCPI_OPT_SACK 2 ++#define TCPI_OPT_WSCALE 4 ++#define TCPI_OPT_ECN 8 /* ECN was negociated at TCP session init */ ++#define TCPI_OPT_ECN_SEEN 16 /* we received at least one packet with ECT */ ++#define TCPI_OPT_SYN_DATA 32 /* SYN-ACK acked data in SYN sent or rcvd */ ++ ++enum tcp_ca_state { ++ TCP_CA_Open = 0, ++#define TCPF_CA_Open (1< ++ ++/* NETLINK_GENERIC related info ++ */ ++#define TCP_METRICS_GENL_NAME "tcp_metrics" ++#define TCP_METRICS_GENL_VERSION 0x1 ++ ++enum tcp_metric_index { ++ TCP_METRIC_RTT, /* in ms units */ ++ TCP_METRIC_RTTVAR, /* in ms units */ ++ TCP_METRIC_SSTHRESH, ++ TCP_METRIC_CWND, ++ TCP_METRIC_REORDERING, ++ ++ TCP_METRIC_RTT_US, /* in usec units */ ++ TCP_METRIC_RTTVAR_US, /* in usec units */ ++ ++ /* Always last. */ ++ __TCP_METRIC_MAX, ++}; ++ ++#define TCP_METRIC_MAX (__TCP_METRIC_MAX - 1) ++ ++enum { ++ TCP_METRICS_ATTR_UNSPEC, ++ TCP_METRICS_ATTR_ADDR_IPV4, /* u32 */ ++ TCP_METRICS_ATTR_ADDR_IPV6, /* binary */ ++ TCP_METRICS_ATTR_AGE, /* msecs */ ++ TCP_METRICS_ATTR_TW_TSVAL, /* u32, raw, rcv tsval */ ++ TCP_METRICS_ATTR_TW_TS_STAMP, /* s32, sec age */ ++ TCP_METRICS_ATTR_VALS, /* nested +1, u32 */ ++ TCP_METRICS_ATTR_FOPEN_MSS, /* u16 */ ++ TCP_METRICS_ATTR_FOPEN_SYN_DROPS, /* u16, count of drops */ ++ TCP_METRICS_ATTR_FOPEN_SYN_DROP_TS, /* msecs age */ ++ TCP_METRICS_ATTR_FOPEN_COOKIE, /* binary */ ++ TCP_METRICS_ATTR_SADDR_IPV4, /* u32 */ ++ TCP_METRICS_ATTR_SADDR_IPV6, /* binary */ ++ TCP_METRICS_ATTR_PAD, ++ ++ __TCP_METRICS_ATTR_MAX, ++}; ++ ++#define TCP_METRICS_ATTR_MAX (__TCP_METRICS_ATTR_MAX - 1) ++ ++enum { ++ TCP_METRICS_CMD_UNSPEC, ++ TCP_METRICS_CMD_GET, ++ TCP_METRICS_CMD_DEL, ++ ++ __TCP_METRICS_CMD_MAX, ++}; ++ ++#define TCP_METRICS_CMD_MAX (__TCP_METRICS_CMD_MAX - 1) ++ ++#endif /* _LINUX_TCP_METRICS_H */ +diff --git a/include/uapi/linux/tipc.h b/include/uapi/linux/tipc.h +new file mode 100644 +index 0000000..924fb5c +--- /dev/null ++++ b/include/uapi/linux/tipc.h +@@ -0,0 +1,256 @@ ++/* ++ * include/uapi/linux/tipc.h: Header for TIPC socket interface ++ * ++ * Copyright (c) 2003-2006, 2015-2016 Ericsson AB ++ * Copyright (c) 2005, 2010-2011, Wind River Systems ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions are met: ++ * ++ * 1. Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * 2. Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * 3. Neither the names of the copyright holders nor the names of its ++ * contributors may be used to endorse or promote products derived from ++ * this software without specific prior written permission. ++ * ++ * Alternatively, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2 as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE ++ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR ++ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ++ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ++ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ++ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ++ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ++ * POSSIBILITY OF SUCH DAMAGE. ++ */ ++ ++#ifndef _LINUX_TIPC_H_ ++#define _LINUX_TIPC_H_ ++ ++#include ++#include ++ ++/* ++ * TIPC addressing primitives ++ */ ++ ++struct tipc_portid { ++ __u32 ref; ++ __u32 node; ++}; ++ ++struct tipc_name { ++ __u32 type; ++ __u32 instance; ++}; ++ ++struct tipc_name_seq { ++ __u32 type; ++ __u32 lower; ++ __u32 upper; ++}; ++ ++/* TIPC Address Size, Offset, Mask specification for Z.C.N ++ */ ++#define TIPC_NODE_BITS 12 ++#define TIPC_CLUSTER_BITS 12 ++#define TIPC_ZONE_BITS 8 ++ ++#define TIPC_NODE_OFFSET 0 ++#define TIPC_CLUSTER_OFFSET TIPC_NODE_BITS ++#define TIPC_ZONE_OFFSET (TIPC_CLUSTER_OFFSET + TIPC_CLUSTER_BITS) ++ ++#define TIPC_NODE_SIZE ((1UL << TIPC_NODE_BITS) - 1) ++#define TIPC_CLUSTER_SIZE ((1UL << TIPC_CLUSTER_BITS) - 1) ++#define TIPC_ZONE_SIZE ((1UL << TIPC_ZONE_BITS) - 1) ++ ++#define TIPC_NODE_MASK (TIPC_NODE_SIZE << TIPC_NODE_OFFSET) ++#define TIPC_CLUSTER_MASK (TIPC_CLUSTER_SIZE << TIPC_CLUSTER_OFFSET) ++#define TIPC_ZONE_MASK (TIPC_ZONE_SIZE << TIPC_ZONE_OFFSET) ++ ++#define TIPC_ZONE_CLUSTER_MASK (TIPC_ZONE_MASK | TIPC_CLUSTER_MASK) ++ ++static __inline__ __u32 tipc_addr(unsigned int zone, ++ unsigned int cluster, ++ unsigned int node) ++{ ++ return (zone << TIPC_ZONE_OFFSET) | ++ (cluster << TIPC_CLUSTER_OFFSET) | ++ node; ++} ++ ++static __inline__ unsigned int tipc_zone(__u32 addr) ++{ ++ return addr >> TIPC_ZONE_OFFSET; ++} ++ ++static __inline__ unsigned int tipc_cluster(__u32 addr) ++{ ++ return (addr & TIPC_CLUSTER_MASK) >> TIPC_CLUSTER_OFFSET; ++} ++ ++static __inline__ unsigned int tipc_node(__u32 addr) ++{ ++ return addr & TIPC_NODE_MASK; ++} ++ ++/* ++ * Application-accessible port name types ++ */ ++ ++#define TIPC_CFG_SRV 0 /* configuration service name type */ ++#define TIPC_TOP_SRV 1 /* topology service name type */ ++#define TIPC_LINK_STATE 2 /* link state name type */ ++#define TIPC_RESERVED_TYPES 64 /* lowest user-publishable name type */ ++ ++/* ++ * Publication scopes when binding port names and port name sequences ++ */ ++ ++#define TIPC_ZONE_SCOPE 1 ++#define TIPC_CLUSTER_SCOPE 2 ++#define TIPC_NODE_SCOPE 3 ++ ++/* ++ * Limiting values for messages ++ */ ++ ++#define TIPC_MAX_USER_MSG_SIZE 66000U ++ ++/* ++ * Message importance levels ++ */ ++ ++#define TIPC_LOW_IMPORTANCE 0 ++#define TIPC_MEDIUM_IMPORTANCE 1 ++#define TIPC_HIGH_IMPORTANCE 2 ++#define TIPC_CRITICAL_IMPORTANCE 3 ++ ++/* ++ * Msg rejection/connection shutdown reasons ++ */ ++ ++#define TIPC_OK 0 ++#define TIPC_ERR_NO_NAME 1 ++#define TIPC_ERR_NO_PORT 2 ++#define TIPC_ERR_NO_NODE 3 ++#define TIPC_ERR_OVERLOAD 4 ++#define TIPC_CONN_SHUTDOWN 5 ++ ++/* ++ * TIPC topology subscription service definitions ++ */ ++ ++#define TIPC_SUB_PORTS 0x01 /* filter for port availability */ ++#define TIPC_SUB_SERVICE 0x02 /* filter for service availability */ ++#define TIPC_SUB_CANCEL 0x04 /* cancel a subscription */ ++ ++#define TIPC_WAIT_FOREVER (~0) /* timeout for permanent subscription */ ++ ++struct tipc_subscr { ++ struct tipc_name_seq seq; /* name sequence of interest */ ++ __u32 timeout; /* subscription duration (in ms) */ ++ __u32 filter; /* bitmask of filter options */ ++ char usr_handle[8]; /* available for subscriber use */ ++}; ++ ++#define TIPC_PUBLISHED 1 /* publication event */ ++#define TIPC_WITHDRAWN 2 /* withdraw event */ ++#define TIPC_SUBSCR_TIMEOUT 3 /* subscription timeout event */ ++ ++struct tipc_event { ++ __u32 event; /* event type */ ++ __u32 found_lower; /* matching name seq instances */ ++ __u32 found_upper; /* " " " " */ ++ struct tipc_portid port; /* associated port */ ++ struct tipc_subscr s; /* associated subscription */ ++}; ++ ++/* ++ * Socket API ++ */ ++ ++#ifndef AF_TIPC ++#define AF_TIPC 30 ++#endif ++ ++#ifndef PF_TIPC ++#define PF_TIPC AF_TIPC ++#endif ++ ++#ifndef SOL_TIPC ++#define SOL_TIPC 271 ++#endif ++ ++#define TIPC_ADDR_NAMESEQ 1 ++#define TIPC_ADDR_MCAST 1 ++#define TIPC_ADDR_NAME 2 ++#define TIPC_ADDR_ID 3 ++ ++struct sockaddr_tipc { ++ unsigned short family; ++ unsigned char addrtype; ++ signed char scope; ++ union { ++ struct tipc_portid id; ++ struct tipc_name_seq nameseq; ++ struct { ++ struct tipc_name name; ++ __u32 domain; ++ } name; ++ } addr; ++}; ++ ++/* ++ * Ancillary data objects supported by recvmsg() ++ */ ++ ++#define TIPC_ERRINFO 1 /* error info */ ++#define TIPC_RETDATA 2 /* returned data */ ++#define TIPC_DESTNAME 3 /* destination name */ ++ ++/* ++ * TIPC-specific socket option names ++ */ ++ ++#define TIPC_IMPORTANCE 127 /* Default: TIPC_LOW_IMPORTANCE */ ++#define TIPC_SRC_DROPPABLE 128 /* Default: based on socket type */ ++#define TIPC_DEST_DROPPABLE 129 /* Default: based on socket type */ ++#define TIPC_CONN_TIMEOUT 130 /* Default: 8000 (ms) */ ++#define TIPC_NODE_RECVQ_DEPTH 131 /* Default: none (read only) */ ++#define TIPC_SOCK_RECVQ_DEPTH 132 /* Default: none (read only) */ ++#define TIPC_MCAST_BROADCAST 133 /* Default: TIPC selects. No arg */ ++#define TIPC_MCAST_REPLICAST 134 /* Default: TIPC selects. No arg */ ++ ++/* ++ * Maximum sizes of TIPC bearer-related names (including terminating NULL) ++ * The string formatting for each name element is: ++ * media: media ++ * interface: media:interface name ++ * link: Z.C.N:interface-Z.C.N:interface ++ * ++ */ ++ ++#define TIPC_MAX_MEDIA_NAME 16 ++#define TIPC_MAX_IF_NAME 16 ++#define TIPC_MAX_BEARER_NAME 32 ++#define TIPC_MAX_LINK_NAME 60 ++ ++#define SIOCGETLINKNAME SIOCPROTOPRIVATE ++ ++struct tipc_sioc_ln_req { ++ __u32 peer; ++ __u32 bearer_id; ++ char linkname[TIPC_MAX_LINK_NAME]; ++}; ++#endif +diff --git a/include/uapi/linux/tipc_netlink.h b/include/uapi/linux/tipc_netlink.h +new file mode 100644 +index 0000000..f9edd20 +--- /dev/null ++++ b/include/uapi/linux/tipc_netlink.h +@@ -0,0 +1,294 @@ ++/* ++ * Copyright (c) 2014, Ericsson AB ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions are met: ++ * ++ * 1. Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * 2. Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * 3. Neither the names of the copyright holders nor the names of its ++ * contributors may be used to endorse or promote products derived from ++ * this software without specific prior written permission. ++ * ++ * Alternatively, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2 as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE ++ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR ++ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ++ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ++ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ++ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ++ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ++ * POSSIBILITY OF SUCH DAMAGE. ++ */ ++ ++#ifndef _LINUX_TIPC_NETLINK_H_ ++#define _LINUX_TIPC_NETLINK_H_ ++ ++#define TIPC_GENL_V2_NAME "TIPCv2" ++#define TIPC_GENL_V2_VERSION 0x1 ++ ++/* Netlink commands */ ++enum { ++ TIPC_NL_UNSPEC, ++ TIPC_NL_LEGACY, ++ TIPC_NL_BEARER_DISABLE, ++ TIPC_NL_BEARER_ENABLE, ++ TIPC_NL_BEARER_GET, ++ TIPC_NL_BEARER_SET, ++ TIPC_NL_SOCK_GET, ++ TIPC_NL_PUBL_GET, ++ TIPC_NL_LINK_GET, ++ TIPC_NL_LINK_SET, ++ TIPC_NL_LINK_RESET_STATS, ++ TIPC_NL_MEDIA_GET, ++ TIPC_NL_MEDIA_SET, ++ TIPC_NL_NODE_GET, ++ TIPC_NL_NET_GET, ++ TIPC_NL_NET_SET, ++ TIPC_NL_NAME_TABLE_GET, ++ TIPC_NL_MON_SET, ++ TIPC_NL_MON_GET, ++ TIPC_NL_MON_PEER_GET, ++ TIPC_NL_PEER_REMOVE, ++ TIPC_NL_BEARER_ADD, ++ TIPC_NL_UDP_GET_REMOTEIP, ++ ++ __TIPC_NL_CMD_MAX, ++ TIPC_NL_CMD_MAX = __TIPC_NL_CMD_MAX - 1 ++}; ++ ++/* Top level netlink attributes */ ++enum { ++ TIPC_NLA_UNSPEC, ++ TIPC_NLA_BEARER, /* nest */ ++ TIPC_NLA_SOCK, /* nest */ ++ TIPC_NLA_PUBL, /* nest */ ++ TIPC_NLA_LINK, /* nest */ ++ TIPC_NLA_MEDIA, /* nest */ ++ TIPC_NLA_NODE, /* nest */ ++ TIPC_NLA_NET, /* nest */ ++ TIPC_NLA_NAME_TABLE, /* nest */ ++ TIPC_NLA_MON, /* nest */ ++ TIPC_NLA_MON_PEER, /* nest */ ++ ++ __TIPC_NLA_MAX, ++ TIPC_NLA_MAX = __TIPC_NLA_MAX - 1 ++}; ++ ++/* Bearer info */ ++enum { ++ TIPC_NLA_BEARER_UNSPEC, ++ TIPC_NLA_BEARER_NAME, /* string */ ++ TIPC_NLA_BEARER_PROP, /* nest */ ++ TIPC_NLA_BEARER_DOMAIN, /* u32 */ ++ TIPC_NLA_BEARER_UDP_OPTS, /* nest */ ++ ++ __TIPC_NLA_BEARER_MAX, ++ TIPC_NLA_BEARER_MAX = __TIPC_NLA_BEARER_MAX - 1 ++}; ++ ++enum { ++ TIPC_NLA_UDP_UNSPEC, ++ TIPC_NLA_UDP_LOCAL, /* sockaddr_storage */ ++ TIPC_NLA_UDP_REMOTE, /* sockaddr_storage */ ++ TIPC_NLA_UDP_MULTI_REMOTEIP, /* flag */ ++ ++ __TIPC_NLA_UDP_MAX, ++ TIPC_NLA_UDP_MAX = __TIPC_NLA_UDP_MAX - 1 ++}; ++/* Socket info */ ++enum { ++ TIPC_NLA_SOCK_UNSPEC, ++ TIPC_NLA_SOCK_ADDR, /* u32 */ ++ TIPC_NLA_SOCK_REF, /* u32 */ ++ TIPC_NLA_SOCK_CON, /* nest */ ++ TIPC_NLA_SOCK_HAS_PUBL, /* flag */ ++ ++ __TIPC_NLA_SOCK_MAX, ++ TIPC_NLA_SOCK_MAX = __TIPC_NLA_SOCK_MAX - 1 ++}; ++ ++/* Link info */ ++enum { ++ TIPC_NLA_LINK_UNSPEC, ++ TIPC_NLA_LINK_NAME, /* string */ ++ TIPC_NLA_LINK_DEST, /* u32 */ ++ TIPC_NLA_LINK_MTU, /* u32 */ ++ TIPC_NLA_LINK_BROADCAST, /* flag */ ++ TIPC_NLA_LINK_UP, /* flag */ ++ TIPC_NLA_LINK_ACTIVE, /* flag */ ++ TIPC_NLA_LINK_PROP, /* nest */ ++ TIPC_NLA_LINK_STATS, /* nest */ ++ TIPC_NLA_LINK_RX, /* u32 */ ++ TIPC_NLA_LINK_TX, /* u32 */ ++ ++ __TIPC_NLA_LINK_MAX, ++ TIPC_NLA_LINK_MAX = __TIPC_NLA_LINK_MAX - 1 ++}; ++ ++/* Media info */ ++enum { ++ TIPC_NLA_MEDIA_UNSPEC, ++ TIPC_NLA_MEDIA_NAME, /* string */ ++ TIPC_NLA_MEDIA_PROP, /* nest */ ++ ++ __TIPC_NLA_MEDIA_MAX, ++ TIPC_NLA_MEDIA_MAX = __TIPC_NLA_MEDIA_MAX - 1 ++}; ++ ++/* Node info */ ++enum { ++ TIPC_NLA_NODE_UNSPEC, ++ TIPC_NLA_NODE_ADDR, /* u32 */ ++ TIPC_NLA_NODE_UP, /* flag */ ++ ++ __TIPC_NLA_NODE_MAX, ++ TIPC_NLA_NODE_MAX = __TIPC_NLA_NODE_MAX - 1 ++}; ++ ++/* Net info */ ++enum { ++ TIPC_NLA_NET_UNSPEC, ++ TIPC_NLA_NET_ID, /* u32 */ ++ TIPC_NLA_NET_ADDR, /* u32 */ ++ ++ __TIPC_NLA_NET_MAX, ++ TIPC_NLA_NET_MAX = __TIPC_NLA_NET_MAX - 1 ++}; ++ ++/* Name table info */ ++enum { ++ TIPC_NLA_NAME_TABLE_UNSPEC, ++ TIPC_NLA_NAME_TABLE_PUBL, /* nest */ ++ ++ __TIPC_NLA_NAME_TABLE_MAX, ++ TIPC_NLA_NAME_TABLE_MAX = __TIPC_NLA_NAME_TABLE_MAX - 1 ++}; ++ ++/* Monitor info */ ++enum { ++ TIPC_NLA_MON_UNSPEC, ++ TIPC_NLA_MON_ACTIVATION_THRESHOLD, /* u32 */ ++ TIPC_NLA_MON_REF, /* u32 */ ++ TIPC_NLA_MON_ACTIVE, /* flag */ ++ TIPC_NLA_MON_BEARER_NAME, /* string */ ++ TIPC_NLA_MON_PEERCNT, /* u32 */ ++ TIPC_NLA_MON_LISTGEN, /* u32 */ ++ ++ __TIPC_NLA_MON_MAX, ++ TIPC_NLA_MON_MAX = __TIPC_NLA_MON_MAX - 1 ++}; ++ ++/* Publication info */ ++enum { ++ TIPC_NLA_PUBL_UNSPEC, ++ ++ TIPC_NLA_PUBL_TYPE, /* u32 */ ++ TIPC_NLA_PUBL_LOWER, /* u32 */ ++ TIPC_NLA_PUBL_UPPER, /* u32 */ ++ TIPC_NLA_PUBL_SCOPE, /* u32 */ ++ TIPC_NLA_PUBL_NODE, /* u32 */ ++ TIPC_NLA_PUBL_REF, /* u32 */ ++ TIPC_NLA_PUBL_KEY, /* u32 */ ++ ++ __TIPC_NLA_PUBL_MAX, ++ TIPC_NLA_PUBL_MAX = __TIPC_NLA_PUBL_MAX - 1 ++}; ++ ++/* Monitor peer info */ ++enum { ++ TIPC_NLA_MON_PEER_UNSPEC, ++ ++ TIPC_NLA_MON_PEER_ADDR, /* u32 */ ++ TIPC_NLA_MON_PEER_DOMGEN, /* u32 */ ++ TIPC_NLA_MON_PEER_APPLIED, /* u32 */ ++ TIPC_NLA_MON_PEER_UPMAP, /* u64 */ ++ TIPC_NLA_MON_PEER_MEMBERS, /* tlv */ ++ TIPC_NLA_MON_PEER_UP, /* flag */ ++ TIPC_NLA_MON_PEER_HEAD, /* flag */ ++ TIPC_NLA_MON_PEER_LOCAL, /* flag */ ++ TIPC_NLA_MON_PEER_PAD, /* flag */ ++ ++ __TIPC_NLA_MON_PEER_MAX, ++ TIPC_NLA_MON_PEER_MAX = __TIPC_NLA_MON_PEER_MAX - 1 ++}; ++ ++/* Nest, connection info */ ++enum { ++ TIPC_NLA_CON_UNSPEC, ++ ++ TIPC_NLA_CON_FLAG, /* flag */ ++ TIPC_NLA_CON_NODE, /* u32 */ ++ TIPC_NLA_CON_SOCK, /* u32 */ ++ TIPC_NLA_CON_TYPE, /* u32 */ ++ TIPC_NLA_CON_INST, /* u32 */ ++ ++ __TIPC_NLA_CON_MAX, ++ TIPC_NLA_CON_MAX = __TIPC_NLA_CON_MAX - 1 ++}; ++ ++/* Nest, link propreties. Valid for link, media and bearer */ ++enum { ++ TIPC_NLA_PROP_UNSPEC, ++ ++ TIPC_NLA_PROP_PRIO, /* u32 */ ++ TIPC_NLA_PROP_TOL, /* u32 */ ++ TIPC_NLA_PROP_WIN, /* u32 */ ++ ++ __TIPC_NLA_PROP_MAX, ++ TIPC_NLA_PROP_MAX = __TIPC_NLA_PROP_MAX - 1 ++}; ++ ++/* Nest, statistics info */ ++enum { ++ TIPC_NLA_STATS_UNSPEC, ++ ++ TIPC_NLA_STATS_RX_INFO, /* u32 */ ++ TIPC_NLA_STATS_RX_FRAGMENTS, /* u32 */ ++ TIPC_NLA_STATS_RX_FRAGMENTED, /* u32 */ ++ TIPC_NLA_STATS_RX_BUNDLES, /* u32 */ ++ TIPC_NLA_STATS_RX_BUNDLED, /* u32 */ ++ TIPC_NLA_STATS_TX_INFO, /* u32 */ ++ TIPC_NLA_STATS_TX_FRAGMENTS, /* u32 */ ++ TIPC_NLA_STATS_TX_FRAGMENTED, /* u32 */ ++ TIPC_NLA_STATS_TX_BUNDLES, /* u32 */ ++ TIPC_NLA_STATS_TX_BUNDLED, /* u32 */ ++ TIPC_NLA_STATS_MSG_PROF_TOT, /* u32 */ ++ TIPC_NLA_STATS_MSG_LEN_CNT, /* u32 */ ++ TIPC_NLA_STATS_MSG_LEN_TOT, /* u32 */ ++ TIPC_NLA_STATS_MSG_LEN_P0, /* u32 */ ++ TIPC_NLA_STATS_MSG_LEN_P1, /* u32 */ ++ TIPC_NLA_STATS_MSG_LEN_P2, /* u32 */ ++ TIPC_NLA_STATS_MSG_LEN_P3, /* u32 */ ++ TIPC_NLA_STATS_MSG_LEN_P4, /* u32 */ ++ TIPC_NLA_STATS_MSG_LEN_P5, /* u32 */ ++ TIPC_NLA_STATS_MSG_LEN_P6, /* u32 */ ++ TIPC_NLA_STATS_RX_STATES, /* u32 */ ++ TIPC_NLA_STATS_RX_PROBES, /* u32 */ ++ TIPC_NLA_STATS_RX_NACKS, /* u32 */ ++ TIPC_NLA_STATS_RX_DEFERRED, /* u32 */ ++ TIPC_NLA_STATS_TX_STATES, /* u32 */ ++ TIPC_NLA_STATS_TX_PROBES, /* u32 */ ++ TIPC_NLA_STATS_TX_NACKS, /* u32 */ ++ TIPC_NLA_STATS_TX_ACKS, /* u32 */ ++ TIPC_NLA_STATS_RETRANSMITTED, /* u32 */ ++ TIPC_NLA_STATS_DUPLICATES, /* u32 */ ++ TIPC_NLA_STATS_LINK_CONGS, /* u32 */ ++ TIPC_NLA_STATS_MAX_QUEUE, /* u32 */ ++ TIPC_NLA_STATS_AVG_QUEUE, /* u32 */ ++ ++ __TIPC_NLA_STATS_MAX, ++ TIPC_NLA_STATS_MAX = __TIPC_NLA_STATS_MAX - 1 ++}; ++ ++#endif +diff --git a/include/uapi/linux/types.h b/include/uapi/linux/types.h +new file mode 100644 +index 0000000..c640657 +--- /dev/null ++++ b/include/uapi/linux/types.h +@@ -0,0 +1,47 @@ ++#ifndef _LINUX_TYPES_H ++#define _LINUX_TYPES_H ++ ++#include ++ ++#ifndef __ASSEMBLY__ ++ ++#include ++ ++ ++/* ++ * Below are truly Linux-specific types that should never collide with ++ * any application/library that wants linux/types.h. ++ */ ++ ++#ifdef __CHECKER__ ++#define __bitwise__ __attribute__((bitwise)) ++#else ++#define __bitwise__ ++#endif ++#define __bitwise __bitwise__ ++ ++typedef __u16 __bitwise __le16; ++typedef __u16 __bitwise __be16; ++typedef __u32 __bitwise __le32; ++typedef __u32 __bitwise __be32; ++typedef __u64 __bitwise __le64; ++typedef __u64 __bitwise __be64; ++ ++typedef __u16 __bitwise __sum16; ++typedef __u32 __bitwise __wsum; ++ ++/* ++ * aligned_u64 should be used in defining kernel<->userspace ABIs to avoid ++ * common 32/64-bit compat problems. ++ * 64-bit values align to 4-byte boundaries on x86_32 (and possibly other ++ * architectures) and to 8-byte boundaries on 64-bit architectures. The new ++ * aligned_64 type enforces 8-byte alignment so that structs containing ++ * aligned_64 values have the same alignment on 32-bit and 64-bit architectures. ++ * No conversions are necessary between 32-bit user-space and a 64-bit kernel. ++ */ ++#define __aligned_u64 __u64 __attribute__((aligned(8))) ++#define __aligned_be64 __be64 __attribute__((aligned(8))) ++#define __aligned_le64 __le64 __attribute__((aligned(8))) ++ ++#endif /* __ASSEMBLY__ */ ++#endif /* _LINUX_TYPES_H */ +diff --git a/include/uapi/linux/unix_diag.h b/include/uapi/linux/unix_diag.h +new file mode 100644 +index 0000000..1eb0b8d +--- /dev/null ++++ b/include/uapi/linux/unix_diag.h +@@ -0,0 +1,58 @@ ++#ifndef __UNIX_DIAG_H__ ++#define __UNIX_DIAG_H__ ++ ++#include ++ ++struct unix_diag_req { ++ __u8 sdiag_family; ++ __u8 sdiag_protocol; ++ __u16 pad; ++ __u32 udiag_states; ++ __u32 udiag_ino; ++ __u32 udiag_show; ++ __u32 udiag_cookie[2]; ++}; ++ ++#define UDIAG_SHOW_NAME 0x00000001 /* show name (not path) */ ++#define UDIAG_SHOW_VFS 0x00000002 /* show VFS inode info */ ++#define UDIAG_SHOW_PEER 0x00000004 /* show peer socket info */ ++#define UDIAG_SHOW_ICONS 0x00000008 /* show pending connections */ ++#define UDIAG_SHOW_RQLEN 0x00000010 /* show skb receive queue len */ ++#define UDIAG_SHOW_MEMINFO 0x00000020 /* show memory info of a socket */ ++ ++struct unix_diag_msg { ++ __u8 udiag_family; ++ __u8 udiag_type; ++ __u8 udiag_state; ++ __u8 pad; ++ ++ __u32 udiag_ino; ++ __u32 udiag_cookie[2]; ++}; ++ ++enum { ++ /* UNIX_DIAG_NONE, standard nl API requires this attribute! */ ++ UNIX_DIAG_NAME, ++ UNIX_DIAG_VFS, ++ UNIX_DIAG_PEER, ++ UNIX_DIAG_ICONS, ++ UNIX_DIAG_RQLEN, ++ UNIX_DIAG_MEMINFO, ++ UNIX_DIAG_SHUTDOWN, ++ ++ __UNIX_DIAG_MAX, ++}; ++ ++#define UNIX_DIAG_MAX (__UNIX_DIAG_MAX - 1) ++ ++struct unix_diag_vfs { ++ __u32 udiag_vfs_ino; ++ __u32 udiag_vfs_dev; ++}; ++ ++struct unix_diag_rqlen { ++ __u32 udiag_rqueue; ++ __u32 udiag_wqueue; ++}; ++ ++#endif +diff --git a/include/uapi/linux/veth.h b/include/uapi/linux/veth.h +new file mode 100644 +index 0000000..3354c1e +--- /dev/null ++++ b/include/uapi/linux/veth.h +@@ -0,0 +1,12 @@ ++#ifndef __NET_VETH_H_ ++#define __NET_VETH_H_ ++ ++enum { ++ VETH_INFO_UNSPEC, ++ VETH_INFO_PEER, ++ ++ __VETH_INFO_MAX ++#define VETH_INFO_MAX (__VETH_INFO_MAX - 1) ++}; ++ ++#endif +diff --git a/include/uapi/linux/xfrm.h b/include/uapi/linux/xfrm.h +new file mode 100644 +index 0000000..5790293 +--- /dev/null ++++ b/include/uapi/linux/xfrm.h +@@ -0,0 +1,536 @@ ++#ifndef _LINUX_XFRM_H ++#define _LINUX_XFRM_H ++ ++#include ++#include ++ ++/* All of the structures in this file may not change size as they are ++ * passed into the kernel from userspace via netlink sockets. ++ */ ++ ++/* Structure to encapsulate addresses. I do not want to use ++ * "standard" structure. My apologies. ++ */ ++typedef union { ++ __be32 a4; ++ __be32 a6[4]; ++ struct in6_addr in6; ++} xfrm_address_t; ++ ++/* Ident of a specific xfrm_state. It is used on input to lookup ++ * the state by (spi,daddr,ah/esp) or to store information about ++ * spi, protocol and tunnel address on output. ++ */ ++struct xfrm_id { ++ xfrm_address_t daddr; ++ __be32 spi; ++ __u8 proto; ++}; ++ ++struct xfrm_sec_ctx { ++ __u8 ctx_doi; ++ __u8 ctx_alg; ++ __u16 ctx_len; ++ __u32 ctx_sid; ++ char ctx_str[0]; ++}; ++ ++/* Security Context Domains of Interpretation */ ++#define XFRM_SC_DOI_RESERVED 0 ++#define XFRM_SC_DOI_LSM 1 ++ ++/* Security Context Algorithms */ ++#define XFRM_SC_ALG_RESERVED 0 ++#define XFRM_SC_ALG_SELINUX 1 ++ ++/* Selector, used as selector both on policy rules (SPD) and SAs. */ ++ ++struct xfrm_selector { ++ xfrm_address_t daddr; ++ xfrm_address_t saddr; ++ __be16 dport; ++ __be16 dport_mask; ++ __be16 sport; ++ __be16 sport_mask; ++ __u16 family; ++ __u8 prefixlen_d; ++ __u8 prefixlen_s; ++ __u8 proto; ++ int ifindex; ++ __kernel_uid32_t user; ++}; ++ ++#define XFRM_INF (~(__u64)0) ++ ++struct xfrm_lifetime_cfg { ++ __u64 soft_byte_limit; ++ __u64 hard_byte_limit; ++ __u64 soft_packet_limit; ++ __u64 hard_packet_limit; ++ __u64 soft_add_expires_seconds; ++ __u64 hard_add_expires_seconds; ++ __u64 soft_use_expires_seconds; ++ __u64 hard_use_expires_seconds; ++}; ++ ++struct xfrm_lifetime_cur { ++ __u64 bytes; ++ __u64 packets; ++ __u64 add_time; ++ __u64 use_time; ++}; ++ ++struct xfrm_replay_state { ++ __u32 oseq; ++ __u32 seq; ++ __u32 bitmap; ++}; ++ ++#define XFRMA_REPLAY_ESN_MAX 4096 ++ ++struct xfrm_replay_state_esn { ++ unsigned int bmp_len; ++ __u32 oseq; ++ __u32 seq; ++ __u32 oseq_hi; ++ __u32 seq_hi; ++ __u32 replay_window; ++ __u32 bmp[0]; ++}; ++ ++struct xfrm_algo { ++ char alg_name[64]; ++ unsigned int alg_key_len; /* in bits */ ++ char alg_key[0]; ++}; ++ ++struct xfrm_algo_auth { ++ char alg_name[64]; ++ unsigned int alg_key_len; /* in bits */ ++ unsigned int alg_trunc_len; /* in bits */ ++ char alg_key[0]; ++}; ++ ++struct xfrm_algo_aead { ++ char alg_name[64]; ++ unsigned int alg_key_len; /* in bits */ ++ unsigned int alg_icv_len; /* in bits */ ++ char alg_key[0]; ++}; ++ ++struct xfrm_stats { ++ __u32 replay_window; ++ __u32 replay; ++ __u32 integrity_failed; ++}; ++ ++enum { ++ XFRM_POLICY_TYPE_MAIN = 0, ++ XFRM_POLICY_TYPE_SUB = 1, ++ XFRM_POLICY_TYPE_MAX = 2, ++ XFRM_POLICY_TYPE_ANY = 255 ++}; ++ ++enum { ++ XFRM_POLICY_IN = 0, ++ XFRM_POLICY_OUT = 1, ++ XFRM_POLICY_FWD = 2, ++ XFRM_POLICY_MASK = 3, ++ XFRM_POLICY_MAX = 3 ++}; ++ ++enum { ++ XFRM_SHARE_ANY, /* No limitations */ ++ XFRM_SHARE_SESSION, /* For this session only */ ++ XFRM_SHARE_USER, /* For this user only */ ++ XFRM_SHARE_UNIQUE /* Use once */ ++}; ++ ++#define XFRM_MODE_TRANSPORT 0 ++#define XFRM_MODE_TUNNEL 1 ++#define XFRM_MODE_ROUTEOPTIMIZATION 2 ++#define XFRM_MODE_IN_TRIGGER 3 ++#define XFRM_MODE_BEET 4 ++#define XFRM_MODE_MAX 5 ++ ++/* Netlink configuration messages. */ ++enum { ++ XFRM_MSG_BASE = 0x10, ++ ++ XFRM_MSG_NEWSA = 0x10, ++#define XFRM_MSG_NEWSA XFRM_MSG_NEWSA ++ XFRM_MSG_DELSA, ++#define XFRM_MSG_DELSA XFRM_MSG_DELSA ++ XFRM_MSG_GETSA, ++#define XFRM_MSG_GETSA XFRM_MSG_GETSA ++ ++ XFRM_MSG_NEWPOLICY, ++#define XFRM_MSG_NEWPOLICY XFRM_MSG_NEWPOLICY ++ XFRM_MSG_DELPOLICY, ++#define XFRM_MSG_DELPOLICY XFRM_MSG_DELPOLICY ++ XFRM_MSG_GETPOLICY, ++#define XFRM_MSG_GETPOLICY XFRM_MSG_GETPOLICY ++ ++ XFRM_MSG_ALLOCSPI, ++#define XFRM_MSG_ALLOCSPI XFRM_MSG_ALLOCSPI ++ XFRM_MSG_ACQUIRE, ++#define XFRM_MSG_ACQUIRE XFRM_MSG_ACQUIRE ++ XFRM_MSG_EXPIRE, ++#define XFRM_MSG_EXPIRE XFRM_MSG_EXPIRE ++ ++ XFRM_MSG_UPDPOLICY, ++#define XFRM_MSG_UPDPOLICY XFRM_MSG_UPDPOLICY ++ XFRM_MSG_UPDSA, ++#define XFRM_MSG_UPDSA XFRM_MSG_UPDSA ++ ++ XFRM_MSG_POLEXPIRE, ++#define XFRM_MSG_POLEXPIRE XFRM_MSG_POLEXPIRE ++ ++ XFRM_MSG_FLUSHSA, ++#define XFRM_MSG_FLUSHSA XFRM_MSG_FLUSHSA ++ XFRM_MSG_FLUSHPOLICY, ++#define XFRM_MSG_FLUSHPOLICY XFRM_MSG_FLUSHPOLICY ++ ++ XFRM_MSG_NEWAE, ++#define XFRM_MSG_NEWAE XFRM_MSG_NEWAE ++ XFRM_MSG_GETAE, ++#define XFRM_MSG_GETAE XFRM_MSG_GETAE ++ ++ XFRM_MSG_REPORT, ++#define XFRM_MSG_REPORT XFRM_MSG_REPORT ++ ++ XFRM_MSG_MIGRATE, ++#define XFRM_MSG_MIGRATE XFRM_MSG_MIGRATE ++ ++ XFRM_MSG_NEWSADINFO, ++#define XFRM_MSG_NEWSADINFO XFRM_MSG_NEWSADINFO ++ XFRM_MSG_GETSADINFO, ++#define XFRM_MSG_GETSADINFO XFRM_MSG_GETSADINFO ++ ++ XFRM_MSG_NEWSPDINFO, ++#define XFRM_MSG_NEWSPDINFO XFRM_MSG_NEWSPDINFO ++ XFRM_MSG_GETSPDINFO, ++#define XFRM_MSG_GETSPDINFO XFRM_MSG_GETSPDINFO ++ ++ XFRM_MSG_MAPPING, ++#define XFRM_MSG_MAPPING XFRM_MSG_MAPPING ++ __XFRM_MSG_MAX ++}; ++#define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1) ++ ++#define XFRM_NR_MSGTYPES (XFRM_MSG_MAX + 1 - XFRM_MSG_BASE) ++ ++/* ++ * Generic LSM security context for comunicating to user space ++ * NOTE: Same format as sadb_x_sec_ctx ++ */ ++struct xfrm_user_sec_ctx { ++ __u16 len; ++ __u16 exttype; ++ __u8 ctx_alg; /* LSMs: e.g., selinux == 1 */ ++ __u8 ctx_doi; ++ __u16 ctx_len; ++}; ++ ++struct xfrm_user_tmpl { ++ struct xfrm_id id; ++ __u16 family; ++ xfrm_address_t saddr; ++ __u32 reqid; ++ __u8 mode; ++ __u8 share; ++ __u8 optional; ++ __u32 aalgos; ++ __u32 ealgos; ++ __u32 calgos; ++}; ++ ++struct xfrm_encap_tmpl { ++ __u16 encap_type; ++ __be16 encap_sport; ++ __be16 encap_dport; ++ xfrm_address_t encap_oa; ++}; ++ ++/* AEVENT flags */ ++enum xfrm_ae_ftype_t { ++ XFRM_AE_UNSPEC, ++ XFRM_AE_RTHR=1, /* replay threshold*/ ++ XFRM_AE_RVAL=2, /* replay value */ ++ XFRM_AE_LVAL=4, /* lifetime value */ ++ XFRM_AE_ETHR=8, /* expiry timer threshold */ ++ XFRM_AE_CR=16, /* Event cause is replay update */ ++ XFRM_AE_CE=32, /* Event cause is timer expiry */ ++ XFRM_AE_CU=64, /* Event cause is policy update */ ++ __XFRM_AE_MAX ++ ++#define XFRM_AE_MAX (__XFRM_AE_MAX - 1) ++}; ++ ++struct xfrm_userpolicy_type { ++ __u8 type; ++ __u16 reserved1; ++ __u8 reserved2; ++}; ++ ++/* Netlink message attributes. */ ++enum xfrm_attr_type_t { ++ XFRMA_UNSPEC, ++ XFRMA_ALG_AUTH, /* struct xfrm_algo */ ++ XFRMA_ALG_CRYPT, /* struct xfrm_algo */ ++ XFRMA_ALG_COMP, /* struct xfrm_algo */ ++ XFRMA_ENCAP, /* struct xfrm_algo + struct xfrm_encap_tmpl */ ++ XFRMA_TMPL, /* 1 or more struct xfrm_user_tmpl */ ++ XFRMA_SA, /* struct xfrm_usersa_info */ ++ XFRMA_POLICY, /*struct xfrm_userpolicy_info */ ++ XFRMA_SEC_CTX, /* struct xfrm_sec_ctx */ ++ XFRMA_LTIME_VAL, ++ XFRMA_REPLAY_VAL, ++ XFRMA_REPLAY_THRESH, ++ XFRMA_ETIMER_THRESH, ++ XFRMA_SRCADDR, /* xfrm_address_t */ ++ XFRMA_COADDR, /* xfrm_address_t */ ++ XFRMA_LASTUSED, /* unsigned long */ ++ XFRMA_POLICY_TYPE, /* struct xfrm_userpolicy_type */ ++ XFRMA_MIGRATE, ++ XFRMA_ALG_AEAD, /* struct xfrm_algo_aead */ ++ XFRMA_KMADDRESS, /* struct xfrm_user_kmaddress */ ++ XFRMA_ALG_AUTH_TRUNC, /* struct xfrm_algo_auth */ ++ XFRMA_MARK, /* struct xfrm_mark */ ++ XFRMA_TFCPAD, /* __u32 */ ++ XFRMA_REPLAY_ESN_VAL, /* struct xfrm_replay_state_esn */ ++ XFRMA_SA_EXTRA_FLAGS, /* __u32 */ ++ XFRMA_PROTO, /* __u8 */ ++ XFRMA_ADDRESS_FILTER, /* struct xfrm_address_filter */ ++ XFRMA_PAD, ++ XFRMA_OFFLOAD_DEV, /* struct xfrm_state_offload */ ++ XFRMA_OUTPUT_MARK, /* __u32 */ ++ __XFRMA_MAX ++ ++#define XFRMA_MAX (__XFRMA_MAX - 1) ++}; ++ ++struct xfrm_mark { ++ __u32 v; /* value */ ++ __u32 m; /* mask */ ++}; ++ ++enum xfrm_sadattr_type_t { ++ XFRMA_SAD_UNSPEC, ++ XFRMA_SAD_CNT, ++ XFRMA_SAD_HINFO, ++ __XFRMA_SAD_MAX ++ ++#define XFRMA_SAD_MAX (__XFRMA_SAD_MAX - 1) ++}; ++ ++struct xfrmu_sadhinfo { ++ __u32 sadhcnt; /* current hash bkts */ ++ __u32 sadhmcnt; /* max allowed hash bkts */ ++}; ++ ++enum xfrm_spdattr_type_t { ++ XFRMA_SPD_UNSPEC, ++ XFRMA_SPD_INFO, ++ XFRMA_SPD_HINFO, ++ XFRMA_SPD_IPV4_HTHRESH, ++ XFRMA_SPD_IPV6_HTHRESH, ++ __XFRMA_SPD_MAX ++ ++#define XFRMA_SPD_MAX (__XFRMA_SPD_MAX - 1) ++}; ++ ++struct xfrmu_spdinfo { ++ __u32 incnt; ++ __u32 outcnt; ++ __u32 fwdcnt; ++ __u32 inscnt; ++ __u32 outscnt; ++ __u32 fwdscnt; ++}; ++ ++struct xfrmu_spdhinfo { ++ __u32 spdhcnt; ++ __u32 spdhmcnt; ++}; ++ ++struct xfrmu_spdhthresh { ++ __u8 lbits; ++ __u8 rbits; ++}; ++ ++struct xfrm_usersa_info { ++ struct xfrm_selector sel; ++ struct xfrm_id id; ++ xfrm_address_t saddr; ++ struct xfrm_lifetime_cfg lft; ++ struct xfrm_lifetime_cur curlft; ++ struct xfrm_stats stats; ++ __u32 seq; ++ __u32 reqid; ++ __u16 family; ++ __u8 mode; /* XFRM_MODE_xxx */ ++ __u8 replay_window; ++ __u8 flags; ++#define XFRM_STATE_NOECN 1 ++#define XFRM_STATE_DECAP_DSCP 2 ++#define XFRM_STATE_NOPMTUDISC 4 ++#define XFRM_STATE_WILDRECV 8 ++#define XFRM_STATE_ICMP 16 ++#define XFRM_STATE_AF_UNSPEC 32 ++#define XFRM_STATE_ALIGN4 64 ++#define XFRM_STATE_ESN 128 ++}; ++ ++#define XFRM_SA_XFLAG_DONT_ENCAP_DSCP 1 ++ ++struct xfrm_usersa_id { ++ xfrm_address_t daddr; ++ __be32 spi; ++ __u16 family; ++ __u8 proto; ++}; ++ ++struct xfrm_aevent_id { ++ struct xfrm_usersa_id sa_id; ++ xfrm_address_t saddr; ++ __u32 flags; ++ __u32 reqid; ++}; ++ ++struct xfrm_userspi_info { ++ struct xfrm_usersa_info info; ++ __u32 min; ++ __u32 max; ++}; ++ ++struct xfrm_userpolicy_info { ++ struct xfrm_selector sel; ++ struct xfrm_lifetime_cfg lft; ++ struct xfrm_lifetime_cur curlft; ++ __u32 priority; ++ __u32 index; ++ __u8 dir; ++ __u8 action; ++#define XFRM_POLICY_ALLOW 0 ++#define XFRM_POLICY_BLOCK 1 ++ __u8 flags; ++#define XFRM_POLICY_LOCALOK 1 /* Allow user to override global policy */ ++ /* Automatically expand selector to include matching ICMP payloads. */ ++#define XFRM_POLICY_ICMP 2 ++ __u8 share; ++}; ++ ++struct xfrm_userpolicy_id { ++ struct xfrm_selector sel; ++ __u32 index; ++ __u8 dir; ++}; ++ ++struct xfrm_user_acquire { ++ struct xfrm_id id; ++ xfrm_address_t saddr; ++ struct xfrm_selector sel; ++ struct xfrm_userpolicy_info policy; ++ __u32 aalgos; ++ __u32 ealgos; ++ __u32 calgos; ++ __u32 seq; ++}; ++ ++struct xfrm_user_expire { ++ struct xfrm_usersa_info state; ++ __u8 hard; ++}; ++ ++struct xfrm_user_polexpire { ++ struct xfrm_userpolicy_info pol; ++ __u8 hard; ++}; ++ ++struct xfrm_usersa_flush { ++ __u8 proto; ++}; ++ ++struct xfrm_user_report { ++ __u8 proto; ++ struct xfrm_selector sel; ++}; ++ ++/* Used by MIGRATE to pass addresses IKE should use to perform ++ * SA negotiation with the peer */ ++struct xfrm_user_kmaddress { ++ xfrm_address_t local; ++ xfrm_address_t remote; ++ __u32 reserved; ++ __u16 family; ++}; ++ ++struct xfrm_user_migrate { ++ xfrm_address_t old_daddr; ++ xfrm_address_t old_saddr; ++ xfrm_address_t new_daddr; ++ xfrm_address_t new_saddr; ++ __u8 proto; ++ __u8 mode; ++ __u16 reserved; ++ __u32 reqid; ++ __u16 old_family; ++ __u16 new_family; ++}; ++ ++struct xfrm_user_mapping { ++ struct xfrm_usersa_id id; ++ __u32 reqid; ++ xfrm_address_t old_saddr; ++ xfrm_address_t new_saddr; ++ __be16 old_sport; ++ __be16 new_sport; ++}; ++ ++struct xfrm_address_filter { ++ xfrm_address_t saddr; ++ xfrm_address_t daddr; ++ __u16 family; ++ __u8 splen; ++ __u8 dplen; ++}; ++ ++struct xfrm_user_offload { ++ int ifindex; ++ __u8 flags; ++}; ++#define XFRM_OFFLOAD_IPV6 1 ++#define XFRM_OFFLOAD_INBOUND 2 ++ ++/* backwards compatibility for userspace */ ++#define XFRMGRP_ACQUIRE 1 ++#define XFRMGRP_EXPIRE 2 ++#define XFRMGRP_SA 4 ++#define XFRMGRP_POLICY 8 ++#define XFRMGRP_REPORT 0x20 ++ ++enum xfrm_nlgroups { ++ XFRMNLGRP_NONE, ++#define XFRMNLGRP_NONE XFRMNLGRP_NONE ++ XFRMNLGRP_ACQUIRE, ++#define XFRMNLGRP_ACQUIRE XFRMNLGRP_ACQUIRE ++ XFRMNLGRP_EXPIRE, ++#define XFRMNLGRP_EXPIRE XFRMNLGRP_EXPIRE ++ XFRMNLGRP_SA, ++#define XFRMNLGRP_SA XFRMNLGRP_SA ++ XFRMNLGRP_POLICY, ++#define XFRMNLGRP_POLICY XFRMNLGRP_POLICY ++ XFRMNLGRP_AEVENTS, ++#define XFRMNLGRP_AEVENTS XFRMNLGRP_AEVENTS ++ XFRMNLGRP_REPORT, ++#define XFRMNLGRP_REPORT XFRMNLGRP_REPORT ++ XFRMNLGRP_MIGRATE, ++#define XFRMNLGRP_MIGRATE XFRMNLGRP_MIGRATE ++ XFRMNLGRP_MAPPING, ++#define XFRMNLGRP_MAPPING XFRMNLGRP_MAPPING ++ __XFRMNLGRP_MAX ++}; ++#define XFRMNLGRP_MAX (__XFRMNLGRP_MAX - 1) ++ ++#endif /* _LINUX_XFRM_H */ +-- +1.8.3.1 + diff --git a/SOURCES/0037-iproute2-bridge-support-vlan-range-adds.patch b/SOURCES/0037-iproute2-bridge-support-vlan-range-adds.patch deleted file mode 100644 index c4da625..0000000 --- a/SOURCES/0037-iproute2-bridge-support-vlan-range-adds.patch +++ /dev/null @@ -1,142 +0,0 @@ -From 739809454864ecec6098a849c009526fc59d44d3 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:09:46 +0100 -Subject: [PATCH] iproute2: bridge: support vlan range adds - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 3ac0d36ddde97 - -commit 3ac0d36ddde9715a8d027a919eb564f7b42c6c40 -Author: Roopa Prabhu -Date: Sun Jan 25 18:26:24 2015 -0800 - - iproute2: bridge: support vlan range adds - - This patch adds vlan range support to bridge add command - using the newly added vinfo flags BRIDGE_VLAN_INFO_RANGE_BEGIN and - BRIDGE_VLAN_INFO_RANGE_END. - - $bridge vlan show - port vlan ids - br0 1 PVID Egress Untagged - - dummy0 1 PVID Egress Untagged - - $bridge vlan add vid 10-15 dev dummy0 - port vlan ids - br0 1 PVID Egress Untagged - - dummy0 1 PVID Egress Untagged - 10 - 11 - 12 - 13 - 14 - 15 - - $bridge vlan del vid 14 dev dummy0 - - $bridge vlan show - port vlan ids - br0 1 PVID Egress Untagged - - dummy0 1 PVID Egress Untagged - 10 - 11 - 12 - 13 - 15 - - $bridge vlan del vid 10-15 dev dummy0 - - $bridge vlan show - port vlan ids - br0 1 PVID Egress Untagged - - dummy0 1 PVID Egress Untagged - - Signed-off-by: Roopa Prabhu - Signed-off-by: Wilson Kok ---- - bridge/vlan.c | 44 ++++++++++++++++++++++++++++++++++++++++---- - 1 file changed, 40 insertions(+), 4 deletions(-) - -diff --git a/bridge/vlan.c b/bridge/vlan.c -index 2ceecc9..da53b4d 100644 ---- a/bridge/vlan.c -+++ b/bridge/vlan.c -@@ -32,6 +32,7 @@ static int vlan_modify(int cmd, int argc, char **argv) - } req; - char *d = NULL; - short vid = -1; -+ short vid_end = -1; - struct rtattr *afspec; - struct bridge_vlan_info vinfo; - unsigned short flags = 0; -@@ -49,8 +50,18 @@ static int vlan_modify(int cmd, int argc, char **argv) - NEXT_ARG(); - d = *argv; - } else if (strcmp(*argv, "vid") == 0) { -+ char *p; - NEXT_ARG(); -- vid = atoi(*argv); -+ p = strchr(*argv, '-'); -+ if (p) { -+ *p = '\0'; -+ p++; -+ vid = atoi(*argv); -+ vid_end = atoi(p); -+ vinfo.flags |= BRIDGE_VLAN_INFO_RANGE_BEGIN; -+ } else { -+ vid = atoi(*argv); -+ } - } else if (strcmp(*argv, "self") == 0) { - flags |= BRIDGE_FLAGS_SELF; - } else if (strcmp(*argv, "master") == 0) { -@@ -83,15 +94,40 @@ static int vlan_modify(int cmd, int argc, char **argv) - return -1; - } - -- vinfo.vid = vid; -+ if (vinfo.flags & BRIDGE_VLAN_INFO_RANGE_BEGIN) { -+ if (vid_end == -1 || vid_end >= 4096 || vid >= vid_end) { -+ fprintf(stderr, "Invalid VLAN range \"%hu-%hu\"\n", -+ vid, vid_end); -+ return -1; -+ } -+ if (vinfo.flags & BRIDGE_VLAN_INFO_PVID) { -+ fprintf(stderr, -+ "pvid cannot be configured for a vlan range\n"); -+ return -1; -+ } -+ } - - afspec = addattr_nest(&req.n, sizeof(req), IFLA_AF_SPEC); - - if (flags) - addattr16(&req.n, sizeof(req), IFLA_BRIDGE_FLAGS, flags); - -- addattr_l(&req.n, sizeof(req), IFLA_BRIDGE_VLAN_INFO, &vinfo, -- sizeof(vinfo)); -+ vinfo.vid = vid; -+ if (vid_end != -1) { -+ /* send vlan range start */ -+ addattr_l(&req.n, sizeof(req), IFLA_BRIDGE_VLAN_INFO, &vinfo, -+ sizeof(vinfo)); -+ vinfo.flags &= ~BRIDGE_VLAN_INFO_RANGE_BEGIN; -+ -+ /* Now send the vlan range end */ -+ vinfo.flags |= BRIDGE_VLAN_INFO_RANGE_END; -+ vinfo.vid = vid_end; -+ addattr_l(&req.n, sizeof(req), IFLA_BRIDGE_VLAN_INFO, &vinfo, -+ sizeof(vinfo)); -+ } else { -+ addattr_l(&req.n, sizeof(req), IFLA_BRIDGE_VLAN_INFO, &vinfo, -+ sizeof(vinfo)); -+ } - - addattr_nest_end(&req.n, afspec); - --- -1.8.3.1 - diff --git a/SOURCES/0037-uapi-add-include-linux-vm_sockets_diag.h.patch b/SOURCES/0037-uapi-add-include-linux-vm_sockets_diag.h.patch new file mode 100644 index 0000000..46d589f --- /dev/null +++ b/SOURCES/0037-uapi-add-include-linux-vm_sockets_diag.h.patch @@ -0,0 +1,64 @@ +From 74e00895532b878a902f9b0477e1b00d1be9df59 Mon Sep 17 00:00:00 2001 +From: Stefano Brivio +Date: Sun, 22 Oct 2017 21:44:25 +0200 +Subject: [PATCH] uapi: add include linux/vm_sockets_diag.h + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1472759 +Upstream Status: iproute2.git commit e9b0d82dfac2 + +commit e9b0d82dfac25912cf757945d9caf6fe2371f526 +Author: Stephen Hemminger +Date: Wed Oct 11 10:49:25 2017 -0700 + + uapi: add include linux/vm_sockets_diag.h + + Signed-off-by: Stephen Hemminger + +Signed-off-by: Stefano Brivio +--- + include/uapi/linux/vm_sockets_diag.h | 33 +++++++++++++++++++++++++++++++++ + 1 file changed, 33 insertions(+) + create mode 100644 include/uapi/linux/vm_sockets_diag.h + +diff --git a/include/uapi/linux/vm_sockets_diag.h b/include/uapi/linux/vm_sockets_diag.h +new file mode 100644 +index 0000000..a732a6f +--- /dev/null ++++ b/include/uapi/linux/vm_sockets_diag.h +@@ -0,0 +1,33 @@ ++/* AF_VSOCK sock_diag(7) interface for querying open sockets */ ++ ++#ifndef __VM_SOCKETS_DIAG_H__ ++#define __VM_SOCKETS_DIAG_H__ ++ ++#include ++ ++/* Request */ ++struct vsock_diag_req { ++ __u8 sdiag_family; /* must be AF_VSOCK */ ++ __u8 sdiag_protocol; /* must be 0 */ ++ __u16 pad; /* must be 0 */ ++ __u32 vdiag_states; /* query bitmap (e.g. 1 << TCP_LISTEN) */ ++ __u32 vdiag_ino; /* must be 0 (reserved) */ ++ __u32 vdiag_show; /* must be 0 (reserved) */ ++ __u32 vdiag_cookie[2]; ++}; ++ ++/* Response */ ++struct vsock_diag_msg { ++ __u8 vdiag_family; /* AF_VSOCK */ ++ __u8 vdiag_type; /* SOCK_STREAM or SOCK_DGRAM */ ++ __u8 vdiag_state; /* sk_state (e.g. TCP_LISTEN) */ ++ __u8 vdiag_shutdown; /* local RCV_SHUTDOWN | SEND_SHUTDOWN */ ++ __u32 vdiag_src_cid; ++ __u32 vdiag_src_port; ++ __u32 vdiag_dst_cid; ++ __u32 vdiag_dst_port; ++ __u32 vdiag_ino; ++ __u32 vdiag_cookie[2]; ++}; ++ ++#endif /* __VM_SOCKETS_DIAG_H__ */ +-- +1.8.3.1 + diff --git a/SOURCES/0038-iproute2-bridge-vlan-show-new-option-to-print-ranges.patch b/SOURCES/0038-iproute2-bridge-vlan-show-new-option-to-print-ranges.patch deleted file mode 100644 index e4f92f7..0000000 --- a/SOURCES/0038-iproute2-bridge-vlan-show-new-option-to-print-ranges.patch +++ /dev/null @@ -1,133 +0,0 @@ -From d5204cfdd974da0de3b3902cedb717ab3548b35a Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:09:46 +0100 -Subject: [PATCH] iproute2: bridge vlan show new option to print ranges - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit a2f7934dd04f8 - -commit a2f7934dd04f8e762cc7a3f5f2e7a1edd4a93643 -Author: Roopa Prabhu -Date: Sun Jan 25 18:26:25 2015 -0800 - - iproute2: bridge vlan show new option to print ranges - - Introduce new option -c[ompressvlans] to request - vlan ranges from kernel - - (pls suggest better option names if this does not look ok) - - $bridge vlan show - port vlan ids - dummy0 1 PVID Egress Untagged - - dummy1 1 PVID Egress Untagged - 2 - 3 - 4 - 5 - 6 - 7 - 9 - 10 - 12 - - br0 1 PVID Egress Untagged - - $bridge help - Usage: bridge [ OPTIONS ] OBJECT { COMMAND | help } - where OBJECT := { link | fdb | mdb | vlan | monitor } - OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | - -o[neline] | -t[imestamp] | -n[etns] name | - -c[ompressvlans] } - $bridge -c vlan show - port vlan ids - dummy0 1 PVID Egress Untagged - - dummy1 1 PVID Egress Untagged - 2-7 - 9-10 - 12 - - br0 1 PVID Egress Untagged - - Signed-off-by: Roopa Prabhu ---- - bridge/br_common.h | 1 + - bridge/bridge.c | 6 +++++- - bridge/vlan.c | 11 +++++++++-- - 3 files changed, 15 insertions(+), 3 deletions(-) - -diff --git a/bridge/br_common.h b/bridge/br_common.h -index 12fce3e..169a162 100644 ---- a/bridge/br_common.h -+++ b/bridge/br_common.h -@@ -16,4 +16,5 @@ extern int preferred_family; - extern int show_stats; - extern int show_details; - extern int timestamp; -+extern int compress_vlans; - extern struct rtnl_handle rth; -diff --git a/bridge/bridge.c b/bridge/bridge.c -index 5fcc552..88469ca 100644 ---- a/bridge/bridge.c -+++ b/bridge/bridge.c -@@ -21,6 +21,7 @@ int resolve_hosts; - int oneline = 0; - int show_stats; - int show_details; -+int compress_vlans; - int timestamp; - char * _SL_ = NULL; - -@@ -32,7 +33,8 @@ static void usage(void) - "Usage: bridge [ OPTIONS ] OBJECT { COMMAND | help }\n" - "where OBJECT := { link | fdb | mdb | vlan | monitor }\n" - " OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] |\n" --" -o[neline] | -t[imestamp] | -n[etns] name }\n"); -+" -o[neline] | -t[imestamp] | -n[etns] name |\n" -+" -c[ompressvlans] }\n"); - exit(-1); - } - -@@ -117,6 +119,8 @@ main(int argc, char **argv) - NEXT_ARG(); - if (netns_switch(argv[1])) - exit(-1); -+ } else if (matches(opt, "-compressvlans") == 0) { -+ ++compress_vlans; - } else { - fprintf(stderr, "Option \"%s\" is unknown, try \"bridge help\".\n", opt); - exit(-1); -diff --git a/bridge/vlan.c b/bridge/vlan.c -index da53b4d..0fb479c 100644 ---- a/bridge/vlan.c -+++ b/bridge/vlan.c -@@ -182,7 +182,12 @@ static int print_vlan(const struct sockaddr_nl *who, - continue; - - vinfo = RTA_DATA(i); -- fprintf(fp, "\t %hu", vinfo->vid); -+ if (vinfo->flags & BRIDGE_VLAN_INFO_RANGE_END) -+ fprintf(fp, "-%hu", vinfo->vid); -+ else -+ fprintf(fp, "\t %hu", vinfo->vid); -+ if (vinfo->flags & BRIDGE_VLAN_INFO_RANGE_BEGIN) -+ continue; - if (vinfo->flags & BRIDGE_VLAN_INFO_PVID) - fprintf(fp, " PVID"); - if (vinfo->flags & BRIDGE_VLAN_INFO_UNTAGGED) -@@ -218,7 +223,9 @@ static int vlan_show(int argc, char **argv) - } - - if (rtnl_wilddump_req_filter(&rth, PF_BRIDGE, RTM_GETLINK, -- RTEXT_FILTER_BRVLAN) < 0) { -+ (compress_vlans ? -+ RTEXT_FILTER_BRVLAN_COMPRESSED : -+ RTEXT_FILTER_BRVLAN)) < 0) { - perror("Cannont send dump request"); - exit(1); - } --- -1.8.3.1 - diff --git a/SOURCES/0038-ss-allow-AF_FAMILY-constants-32.patch b/SOURCES/0038-ss-allow-AF_FAMILY-constants-32.patch new file mode 100644 index 0000000..2c0fbfd --- /dev/null +++ b/SOURCES/0038-ss-allow-AF_FAMILY-constants-32.patch @@ -0,0 +1,213 @@ +From f59533eb3cb188a23456444aeb19ac3634eddd8c Mon Sep 17 00:00:00 2001 +From: Stefano Brivio +Date: Sun, 22 Oct 2017 21:44:26 +0200 +Subject: [PATCH] ss: allow AF_FAMILY constants >32 + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1472759 +Upstream Status: iproute2.git commit b338a3e7e7d9 + +commit b338a3e7e7d95c9d46de9748604da06287664033 +Author: Stefan Hajnoczi +Date: Fri Oct 6 11:48:39 2017 -0400 + + ss: allow AF_FAMILY constants >32 + + Linux has more than 32 address families defined in . Use + a 64-bit type so all of them can be represented in the filter->families + bitmask. + + It's easy to introduce bugs when using (1 << AF_FAMILY) because the + value is 32-bit. This can produce incorrect results from bitmask + operations so introduce the FAMILY_MASK() macro to eliminate these bugs. + + Signed-off-by: Stefan Hajnoczi + +Signed-off-by: Stefano Brivio +--- + misc/ss.c | 54 ++++++++++++++++++++++++++++-------------------------- + 1 file changed, 28 insertions(+), 26 deletions(-) + +diff --git a/misc/ss.c b/misc/ss.c +index d3fb9a7..0d64527 100644 +--- a/misc/ss.c ++++ b/misc/ss.c +@@ -170,55 +170,57 @@ enum { + struct filter { + int dbs; + int states; +- int families; ++ uint64_t families; + struct ssfilter *f; + bool kill; + }; + ++#define FAMILY_MASK(family) ((uint64_t)1 << (family)) ++ + static const struct filter default_dbs[MAX_DB] = { + [TCP_DB] = { + .states = SS_CONN, +- .families = (1 << AF_INET) | (1 << AF_INET6), ++ .families = FAMILY_MASK(AF_INET) | FAMILY_MASK(AF_INET6), + }, + [DCCP_DB] = { + .states = SS_CONN, +- .families = (1 << AF_INET) | (1 << AF_INET6), ++ .families = FAMILY_MASK(AF_INET) | FAMILY_MASK(AF_INET6), + }, + [UDP_DB] = { + .states = (1 << SS_ESTABLISHED), +- .families = (1 << AF_INET) | (1 << AF_INET6), ++ .families = FAMILY_MASK(AF_INET) | FAMILY_MASK(AF_INET6), + }, + [RAW_DB] = { + .states = (1 << SS_ESTABLISHED), +- .families = (1 << AF_INET) | (1 << AF_INET6), ++ .families = FAMILY_MASK(AF_INET) | FAMILY_MASK(AF_INET6), + }, + [UNIX_DG_DB] = { + .states = (1 << SS_CLOSE), +- .families = (1 << AF_UNIX), ++ .families = FAMILY_MASK(AF_UNIX), + }, + [UNIX_ST_DB] = { + .states = SS_CONN, +- .families = (1 << AF_UNIX), ++ .families = FAMILY_MASK(AF_UNIX), + }, + [UNIX_SQ_DB] = { + .states = SS_CONN, +- .families = (1 << AF_UNIX), ++ .families = FAMILY_MASK(AF_UNIX), + }, + [PACKET_DG_DB] = { + .states = (1 << SS_CLOSE), +- .families = (1 << AF_PACKET), ++ .families = FAMILY_MASK(AF_PACKET), + }, + [PACKET_R_DB] = { + .states = (1 << SS_CLOSE), +- .families = (1 << AF_PACKET), ++ .families = FAMILY_MASK(AF_PACKET), + }, + [NETLINK_DB] = { + .states = (1 << SS_CLOSE), +- .families = (1 << AF_NETLINK), ++ .families = FAMILY_MASK(AF_NETLINK), + }, + [SCTP_DB] = { + .states = SS_CONN, +- .families = (1 << AF_INET) | (1 << AF_INET6), ++ .families = FAMILY_MASK(AF_INET) | FAMILY_MASK(AF_INET6), + }, + }; + +@@ -258,14 +260,14 @@ static void filter_db_set(struct filter *f, int db) + static void filter_af_set(struct filter *f, int af) + { + f->states |= default_afs[af].states; +- f->families |= 1 << af; ++ f->families |= FAMILY_MASK(af); + do_default = 0; + preferred_family = af; + } + + static int filter_af_get(struct filter *f, int af) + { +- return f->families & (1 << af); ++ return !!(f->families & FAMILY_MASK(af)); + } + + static void filter_default_dbs(struct filter *f) +@@ -302,7 +304,7 @@ static void filter_merge_defaults(struct filter *f) + f->families |= default_dbs[db].families; + } + for (af = 0; af < AF_MAX; af++) { +- if (!(f->families & (1 << af))) ++ if (!(f->families & FAMILY_MASK(af))) + continue; + + if (!(default_afs[af].dbs & f->dbs)) +@@ -2599,7 +2601,7 @@ static int show_one_inet_sock(const struct sockaddr_nl *addr, + struct inet_diag_msg *r = NLMSG_DATA(h); + struct sockstat s = {}; + +- if (!(diag_arg->f->families & (1 << r->idiag_family))) ++ if (!(diag_arg->f->families & FAMILY_MASK(r->idiag_family))) + return 0; + + parse_diag_msg(h, &s); +@@ -2785,7 +2787,7 @@ static int tcp_show(struct filter *f) + return -1; + } + +- if (f->families & (1<families & FAMILY_MASK(AF_INET)) { + if ((fp = net_tcp_open()) == NULL) + goto outerr; + +@@ -2795,7 +2797,7 @@ static int tcp_show(struct filter *f) + fclose(fp); + } + +- if ((f->families & (1<families & FAMILY_MASK(AF_INET6)) && + (fp = net_tcp6_open()) != NULL) { + setbuffer(fp, buf, bufsize); + if (generic_record_read(fp, tcp_show_line, f, AF_INET6)) +@@ -2894,7 +2896,7 @@ static int udp_show(struct filter *f) + && inet_show_netlink(f, NULL, IPPROTO_UDP) == 0) + return 0; + +- if (f->families&(1<families&FAMILY_MASK(AF_INET)) { + if ((fp = net_udp_open()) == NULL) + goto outerr; + if (generic_record_read(fp, dgram_show_line, f, AF_INET)) +@@ -2902,7 +2904,7 @@ static int udp_show(struct filter *f) + fclose(fp); + } + +- if ((f->families&(1<families&FAMILY_MASK(AF_INET6)) && + (fp = net_udp6_open()) != NULL) { + if (generic_record_read(fp, dgram_show_line, f, AF_INET6)) + goto outerr; +@@ -2934,7 +2936,7 @@ static int raw_show(struct filter *f) + inet_show_netlink(f, NULL, IPPROTO_RAW) == 0) + return 0; + +- if (f->families&(1<families&FAMILY_MASK(AF_INET)) { + if ((fp = net_raw_open()) == NULL) + goto outerr; + if (generic_record_read(fp, dgram_show_line, f, AF_INET)) +@@ -2942,7 +2944,7 @@ static int raw_show(struct filter *f) + fclose(fp); + } + +- if ((f->families&(1<families&FAMILY_MASK(AF_INET6)) && + (fp = net_raw6_open()) != NULL) { + if (generic_record_read(fp, dgram_show_line, f, AF_INET6)) + goto outerr; +@@ -3682,13 +3684,13 @@ static int handle_follow_request(struct filter *f) + int groups = 0; + struct rtnl_handle rth; + +- if (f->families & (1 << AF_INET) && f->dbs & (1 << TCP_DB)) ++ if (f->families & FAMILY_MASK(AF_INET) && f->dbs & (1 << TCP_DB)) + groups |= 1 << (SKNLGRP_INET_TCP_DESTROY - 1); +- if (f->families & (1 << AF_INET) && f->dbs & (1 << UDP_DB)) ++ if (f->families & FAMILY_MASK(AF_INET) && f->dbs & (1 << UDP_DB)) + groups |= 1 << (SKNLGRP_INET_UDP_DESTROY - 1); +- if (f->families & (1 << AF_INET6) && f->dbs & (1 << TCP_DB)) ++ if (f->families & FAMILY_MASK(AF_INET6) && f->dbs & (1 << TCP_DB)) + groups |= 1 << (SKNLGRP_INET6_TCP_DESTROY - 1); +- if (f->families & (1 << AF_INET6) && f->dbs & (1 << UDP_DB)) ++ if (f->families & FAMILY_MASK(AF_INET6) && f->dbs & (1 << UDP_DB)) + groups |= 1 << (SKNLGRP_INET6_UDP_DESTROY - 1); + + if (groups == 0) +-- +1.8.3.1 + diff --git a/SOURCES/0039-Allow-specifying-bridge-port-STP-state-by-name-rathe.patch b/SOURCES/0039-Allow-specifying-bridge-port-STP-state-by-name-rathe.patch deleted file mode 100644 index c1dda50..0000000 --- a/SOURCES/0039-Allow-specifying-bridge-port-STP-state-by-name-rathe.patch +++ /dev/null @@ -1,78 +0,0 @@ -From 9abd0130706603ffc408ecb8a09c7586eca14826 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:09:46 +0100 -Subject: [PATCH] Allow specifying bridge port STP state by name rather than - number. - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 6b8c871dc1045 -Conflicts: Changes in removed code due to previously backported double - whitespace cleanup - removed double whitespaces from added - text manually. - -commit 6b8c871dc104576c9f55d87937d6dd445d77f34f -Author: Alex Pilon -Date: Thu Feb 19 14:27:46 2015 -0500 - - Allow specifying bridge port STP state by name rather than number. - - The existing behaviour forces one to memorize the integer constants for - STP port states. - - # bridge link set dev dummy0 state 3 - - This patch makes it possible to use the lowercased port state name. - - # bridge link set dev dummy0 state forwarding - - Invalid non-integer inputs now cause exit with status -1. - - Signed-off-by: Alex Pilon ---- - bridge/link.c | 14 +++++++++++++- - man/man8/bridge.8 | 4 +++- - 2 files changed, 16 insertions(+), 2 deletions(-) - -diff --git a/bridge/link.c b/bridge/link.c -index 8b18931..06a2c0f 100644 ---- a/bridge/link.c -+++ b/bridge/link.c -@@ -316,7 +316,19 @@ static int brlink_modify(int argc, char **argv) - priority = atoi(*argv); - } else if (strcmp(*argv, "state") == 0) { - NEXT_ARG(); -- state = atoi(*argv); -+ char *endptr; -+ size_t nstates = sizeof(port_states) / sizeof(*port_states); -+ state = strtol(*argv, &endptr, 10); -+ if (!(**argv != '\0' && *endptr == '\0')) { -+ for (state = 0; state < nstates; state++) -+ if (strcmp(port_states[state], *argv) == 0) -+ break; -+ if (state == nstates) { -+ fprintf(stderr, -+ "Error: invalid STP port state\n"); -+ exit(-1); -+ } -+ } - } else if (strcmp(*argv, "hwmode") == 0) { - NEXT_ARG(); - flags = BRIDGE_FLAGS_SELF; -diff --git a/man/man8/bridge.8 b/man/man8/bridge.8 -index 42fe922..c742c83 100644 ---- a/man/man8/bridge.8 -+++ b/man/man8/bridge.8 -@@ -207,7 +207,9 @@ droot port selectio algorithms. - .TP - .BI state " STATE " - the operation state of the port. This is primarily used by user space STP/RSTP --implementation. The following is a list of valid values: -+implementation. One may enter a lowercased port state name, or one of the -+numbers below. Negative inputs are ignored, and unrecognized names return an -+error. - - .B 0 - - port is DISABLED. Make this port completely inactive. --- -1.8.3.1 - diff --git a/SOURCES/0039-ss-add-AF_VSOCK-support.patch b/SOURCES/0039-ss-add-AF_VSOCK-support.patch new file mode 100644 index 0000000..ce5b7fb --- /dev/null +++ b/SOURCES/0039-ss-add-AF_VSOCK-support.patch @@ -0,0 +1,398 @@ +From fe898bd10be2bc527f81421f06afff77e8ba42eb Mon Sep 17 00:00:00 2001 +From: Stefano Brivio +Date: Sun, 22 Oct 2017 21:44:27 +0200 +Subject: [PATCH] ss: add AF_VSOCK support + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1472759 +Upstream Status: iproute2.git commit c759116a0b2b + +commit c759116a0b2b6da8df9687b0a40ac69050132c77 +Author: Stefan Hajnoczi +Date: Fri Oct 6 11:48:41 2017 -0400 + + ss: add AF_VSOCK support + + The AF_VSOCK address family is a host<->guest communications channel + supported by VMware, KVM, and Hyper-V. Initial VMware support was + released in Linux 3.9 in 2013 and transports for other hypervisors were + added later. + + AF_VSOCK addresses are tuples. The 32-bit cid + integer is comparable to an IP address. AF_VSOCK ports work like + TCP/UDP ports. + + Both SOCK_STREAM and SOCK_DGRAM socket types are available. + + This patch adds AF_VSOCK support to ss(8) so that sockets can be + observed. + + Signed-off-by: Stefan Hajnoczi + +Signed-off-by: Stefano Brivio +--- + man/man8/ss.8 | 8 ++- + misc/ss.c | 184 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++- + 2 files changed, 188 insertions(+), 4 deletions(-) + +diff --git a/man/man8/ss.8 b/man/man8/ss.8 +index 81de69d..4323eee 100644 +--- a/man/man8/ss.8 ++++ b/man/man8/ss.8 +@@ -125,14 +125,18 @@ Display Unix domain sockets (alias for -f unix). + .B \-S, \-\-sctp + Display SCTP sockets. + .TP ++.B \-\-vsock ++Display vsock sockets (alias for -f vsock). ++.TP + .B \-f FAMILY, \-\-family=FAMILY + Display sockets of type FAMILY. +-Currently the following families are supported: unix, inet, inet6, link, netlink. ++Currently the following families are supported: unix, inet, inet6, link, netlink, vsock. + .TP + .B \-A QUERY, \-\-query=QUERY, \-\-socket=QUERY + List of socket tables to dump, separated by commas. The following identifiers + are understood: all, inet, tcp, udp, raw, unix, packet, netlink, unix_dgram, +-unix_stream, unix_seqpacket, packet_raw, packet_dgram, dccp, sctp. ++unix_stream, unix_seqpacket, packet_raw, packet_dgram, dccp, sctp, ++vsock_stream, vsock_dgram. + .TP + .B \-D FILE, \-\-diag=FILE + Do not display anything, just dump raw information about TCP sockets to FILE after applying filters. If FILE is - stdout is used. +diff --git a/misc/ss.c b/misc/ss.c +index 0d64527..e922665 100644 +--- a/misc/ss.c ++++ b/misc/ss.c +@@ -44,6 +44,7 @@ + #include + #include + #include ++#include + + #define MAGIC_SEQ 123456 + +@@ -126,6 +127,8 @@ enum { + PACKET_R_DB, + NETLINK_DB, + SCTP_DB, ++ VSOCK_ST_DB, ++ VSOCK_DG_DB, + MAX_DB + }; + +@@ -134,6 +137,7 @@ enum { + #define ALL_DB ((1<type); ++ break; + default: + sock_name = "unknown"; + } +@@ -1139,6 +1172,8 @@ static int run_ssfilter(struct ssfilter *f, struct sockstat *s) + return s->lport == 0 && s->local.data[0] == 0; + if (s->local.family == AF_NETLINK) + return s->lport < 0; ++ if (s->local.family == AF_VSOCK) ++ return s->lport > 1023; + + return is_ephemeral(s->lport); + } +@@ -1515,6 +1550,15 @@ void *parse_devcond(char *name) + return res; + } + ++static void vsock_set_inet_prefix(inet_prefix *a, __u32 cid) ++{ ++ *a = (inet_prefix){ ++ .bytelen = sizeof(cid), ++ .family = AF_VSOCK, ++ }; ++ memcpy(a->data, &cid, sizeof(cid)); ++} ++ + void *parse_hostcond(char *addr, bool is_port) + { + char *port = NULL; +@@ -1589,6 +1633,37 @@ void *parse_hostcond(char *addr, bool is_port) + goto out; + } + ++ if (fam == AF_VSOCK || strncmp(addr, "vsock:", 6) == 0) { ++ __u32 cid = ~(__u32)0; ++ ++ a.addr.family = AF_VSOCK; ++ if (strncmp(addr, "vsock:", 6) == 0) ++ addr += 6; ++ ++ if (is_port) ++ port = addr; ++ else { ++ port = strchr(addr, ':'); ++ if (port) { ++ *port = '\0'; ++ port++; ++ } ++ } ++ ++ if (port && strcmp(port, "*") && ++ get_u32((__u32 *)&a.port, port, 0)) ++ return NULL; ++ ++ if (addr[0] && strcmp(addr, "*")) { ++ a.addr.bitlen = 32; ++ if (get_u32(&cid, addr, 0)) ++ return NULL; ++ } ++ vsock_set_inet_prefix(&a.addr, cid); ++ fam = AF_VSOCK; ++ goto out; ++ } ++ + if (fam == AF_INET || !strncmp(addr, "inet:", 5)) { + fam = AF_INET; + if (!strncmp(addr, "inet:", 5)) +@@ -3653,6 +3728,88 @@ static int netlink_show(struct filter *f) + return 0; + } + ++static bool vsock_type_skip(struct sockstat *s, struct filter *f) ++{ ++ if (s->type == SOCK_STREAM && !(f->dbs & (1 << VSOCK_ST_DB))) ++ return true; ++ if (s->type == SOCK_DGRAM && !(f->dbs & (1 << VSOCK_DG_DB))) ++ return true; ++ return false; ++} ++ ++static void vsock_addr_print(inet_prefix *a, __u32 port) ++{ ++ char cid_str[sizeof("4294967295")]; ++ char port_str[sizeof("4294967295")]; ++ __u32 cid; ++ ++ memcpy(&cid, a->data, sizeof(cid)); ++ ++ if (cid == ~(__u32)0) ++ snprintf(cid_str, sizeof(cid_str), "*"); ++ else ++ snprintf(cid_str, sizeof(cid_str), "%u", cid); ++ ++ if (port == ~(__u32)0) ++ snprintf(port_str, sizeof(port_str), "*"); ++ else ++ snprintf(port_str, sizeof(port_str), "%u", port); ++ ++ sock_addr_print(cid_str, ":", port_str, NULL); ++} ++ ++static void vsock_stats_print(struct sockstat *s, struct filter *f) ++{ ++ sock_state_print(s); ++ ++ vsock_addr_print(&s->local, s->lport); ++ vsock_addr_print(&s->remote, s->rport); ++ ++ proc_ctx_print(s); ++ ++ printf("\n"); ++} ++ ++static int vsock_show_sock(const struct sockaddr_nl *addr, ++ struct nlmsghdr *nlh, void *arg) ++{ ++ struct filter *f = (struct filter *)arg; ++ struct vsock_diag_msg *r = NLMSG_DATA(nlh); ++ struct sockstat stat = { ++ .type = r->vdiag_type, ++ .lport = r->vdiag_src_port, ++ .rport = r->vdiag_dst_port, ++ .state = r->vdiag_state, ++ .ino = r->vdiag_ino, ++ }; ++ ++ vsock_set_inet_prefix(&stat.local, r->vdiag_src_cid); ++ vsock_set_inet_prefix(&stat.remote, r->vdiag_dst_cid); ++ ++ if (vsock_type_skip(&stat, f)) ++ return 0; ++ ++ if (f->f && run_ssfilter(f->f, &stat) == 0) ++ return 0; ++ ++ vsock_stats_print(&stat, f); ++ ++ return 0; ++} ++ ++static int vsock_show(struct filter *f) ++{ ++ DIAG_REQUEST(req, struct vsock_diag_req r); ++ ++ if (!filter_af_get(f, AF_VSOCK)) ++ return 0; ++ ++ req.r.sdiag_family = AF_VSOCK; ++ req.r.vdiag_states = f->states; ++ ++ return handle_netlink_request(f, &req.nlh, sizeof(req), vsock_show_sock); ++} ++ + struct sock_diag_msg { + __u8 sdiag_family; + }; +@@ -3673,6 +3830,8 @@ static int generic_show_sock(const struct sockaddr_nl *addr, + return packet_show_sock(addr, nlh, arg); + case AF_NETLINK: + return netlink_show_sock(addr, nlh, arg); ++ case AF_VSOCK: ++ return vsock_show_sock(addr, nlh, arg); + default: + return -1; + } +@@ -3900,14 +4059,15 @@ static void _usage(FILE *dest) + " -d, --dccp display only DCCP sockets\n" + " -w, --raw display only RAW sockets\n" + " -x, --unix display only Unix domain sockets\n" ++" --vsock display only vsock sockets\n" + " -f, --family=FAMILY display sockets of type FAMILY\n" +-" FAMILY := {inet|inet6|link|unix|netlink|help}\n" ++" FAMILY := {inet|inet6|link|unix|netlink|vsock|help}\n" + "\n" + " -K, --kill forcibly close sockets, display what was closed\n" + " -H, --no-header Suppress header line\n" + "\n" + " -A, --query=QUERY, --socket=QUERY\n" +-" QUERY := {all|inet|tcp|udp|raw|unix|unix_dgram|unix_stream|unix_seqpacket|packet|netlink}[,QUERY]\n" ++" QUERY := {all|inet|tcp|udp|raw|unix|unix_dgram|unix_stream|unix_seqpacket|packet|netlink|vsock_stream|vsock_dgram}[,QUERY]\n" + "\n" + " -D, --diag=FILE Dump raw information about TCP sockets to FILE\n" + " -F, --filter=FILE read filter information from FILE\n" +@@ -3980,6 +4140,9 @@ static int scan_state(const char *state) + exit(-1); + } + ++/* Values 'v' and 'V' are already used so a non-character is used */ ++#define OPT_VSOCK 256 ++ + static const struct option long_opts[] = { + { "numeric", 0, 0, 'n' }, + { "resolve", 0, 0, 'r' }, +@@ -3996,6 +4159,7 @@ static const struct option long_opts[] = { + { "udp", 0, 0, 'u' }, + { "raw", 0, 0, 'w' }, + { "unix", 0, 0, 'x' }, ++ { "vsock", 0, 0, OPT_VSOCK }, + { "all", 0, 0, 'a' }, + { "listening", 0, 0, 'l' }, + { "ipv4", 0, 0, '4' }, +@@ -4081,6 +4245,9 @@ int main(int argc, char *argv[]) + case 'x': + filter_af_set(¤t_filter, AF_UNIX); + break; ++ case OPT_VSOCK: ++ filter_af_set(¤t_filter, AF_VSOCK); ++ break; + case 'a': + state_filter = SS_ALL; + break; +@@ -4107,6 +4274,8 @@ int main(int argc, char *argv[]) + filter_af_set(¤t_filter, AF_UNIX); + else if (strcmp(optarg, "netlink") == 0) + filter_af_set(¤t_filter, AF_NETLINK); ++ else if (strcmp(optarg, "vsock") == 0) ++ filter_af_set(¤t_filter, AF_VSOCK); + else if (strcmp(optarg, "help") == 0) + help(); + else { +@@ -4172,6 +4341,15 @@ int main(int argc, char *argv[]) + filter_db_set(¤t_filter, PACKET_DG_DB); + } else if (strcmp(p, "netlink") == 0) { + filter_db_set(¤t_filter, NETLINK_DB); ++ } else if (strcmp(p, "vsock") == 0) { ++ filter_db_set(¤t_filter, VSOCK_ST_DB); ++ filter_db_set(¤t_filter, VSOCK_DG_DB); ++ } else if (strcmp(p, "vsock_stream") == 0 || ++ strcmp(p, "v_str") == 0) { ++ filter_db_set(¤t_filter, VSOCK_ST_DB); ++ } else if (strcmp(p, "vsock_dgram") == 0 || ++ strcmp(p, "v_dgr") == 0) { ++ filter_db_set(¤t_filter, VSOCK_DG_DB); + } else { + fprintf(stderr, "ss: \"%s\" is illegal socket table id\n", p); + usage(); +@@ -4387,6 +4565,8 @@ int main(int argc, char *argv[]) + dccp_show(¤t_filter); + if (current_filter.dbs & (1< -Date: Tue, 28 Feb 2017 16:10:15 +0100 -Subject: [PATCH] bridge link: add support to specify master - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 22a98f5140373 - -commit 22a98f5140373198ea2a5ca721fea937c6f7b509 -Author: Roopa Prabhu -Date: Thu Feb 26 00:12:59 2015 -0800 - - bridge link: add support to specify master - - This patch adds support to specify 'master' keyword, - to target a bridge link command explicitly to the software - bridge driver. - - Adds self/master keywords to usage and man page - - v2: - fix usage to say (self and master) and not (self or master) - - Signed-off-by: Roopa Prabhu ---- - bridge/link.c | 5 ++++- - man/man8/bridge.8 | 12 +++++++++++- - 2 files changed, 15 insertions(+), 2 deletions(-) - -diff --git a/bridge/link.c b/bridge/link.c -index 06a2c0f..69c0bfb 100644 ---- a/bridge/link.c -+++ b/bridge/link.c -@@ -227,6 +227,7 @@ static void usage(void) - fprintf(stderr, " [ learning_sync {on | off} ]\n"); - fprintf(stderr, " [ flood {on | off} ]\n"); - fprintf(stderr, " [ hwmode {vepa | veb} ]\n"); -+ fprintf(stderr, " [ self ] [ master ]\n"); - fprintf(stderr, " bridge link show [dev DEV]\n"); - exit(-1); - } -@@ -343,7 +344,9 @@ static int brlink_modify(int argc, char **argv) - exit(-1); - } - } else if (strcmp(*argv, "self") == 0) { -- flags = BRIDGE_FLAGS_SELF; -+ flags |= BRIDGE_FLAGS_SELF; -+ } else if (strcmp(*argv, "master") == 0) { -+ flags |= BRIDGE_FLAGS_MASTER; - } else { - usage(); - } -diff --git a/man/man8/bridge.8 b/man/man8/bridge.8 -index c742c83..8fae74b 100644 ---- a/man/man8/bridge.8 -+++ b/man/man8/bridge.8 -@@ -40,7 +40,8 @@ bridge \- show / manipulate bridge addresses and devices - .BR learning " { " on " | " off " } ] [ " - .BR learning_sync " { " on " | " off " } ] [ " - .BR flood " { " on " | " off " } ] [ " --.BR hwmode " { " vepa " | " veb " } ] " -+.BR hwmode " { " vepa " | " veb " } ] [ " -+.BR self " ] [ " master " ] " - - .ti -8 - .BR "bridge link" " [ " show " ] [ " -@@ -286,6 +287,15 @@ switch. - .B veb - - bridging happens in hardware. - -+.TP -+.BI self -+link setting is configured on specified physical device -+ -+.TP -+.BI master -+link setting is configured on the software bridge (default) -+ -+ - .SS bridge link show - list bridge port configuration. - - This command displays the current bridge port configuration and flags. --- -1.8.3.1 - diff --git a/SOURCES/0040-link_gre6-Detect-invalid-encaplimit-values.patch b/SOURCES/0040-link_gre6-Detect-invalid-encaplimit-values.patch new file mode 100644 index 0000000..17ed549 --- /dev/null +++ b/SOURCES/0040-link_gre6-Detect-invalid-encaplimit-values.patch @@ -0,0 +1,39 @@ +From 90a1430fca8d5165e1909de9f009aa9f4d6430ef Mon Sep 17 00:00:00 2001 +From: Phil Sutter +Date: Wed, 29 Nov 2017 18:36:17 +0100 +Subject: [PATCH] link_gre6: Detect invalid encaplimit values + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1459600 +Upstream Status: iproute2.git commit 56708ae7c9535 + +commit 56708ae7c9535859223c5b68097b35bf0fae677c +Author: Phil Sutter +Date: Tue Nov 28 16:49:58 2017 +0100 + + link_gre6: Detect invalid encaplimit values + + Looks like a typo: get_u8() returns 0 on success and -1 on error, so the + error checking here was ineffective. + + Fixes: a11b7b71a6eba ("link_gre6: really support encaplimit option") + Signed-off-by: Phil Sutter +--- + ip/link_gre6.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ip/link_gre6.c b/ip/link_gre6.c +index 932f9ee..a9d18ee 100644 +--- a/ip/link_gre6.c ++++ b/ip/link_gre6.c +@@ -351,7 +351,7 @@ get_failed: + } else { + __u8 uval; + +- if (get_u8(&uval, *argv, 0) < -1) ++ if (get_u8(&uval, *argv, 0)) + invarg("invalid ELIM", *argv); + encap_limit = uval; + flags &= ~IP6_TNL_F_IGN_ENCAP_LIMIT; +-- +1.8.3.1 + diff --git a/SOURCES/0041-fix-ip-force-batch-to-continue-on-errors.patch b/SOURCES/0041-fix-ip-force-batch-to-continue-on-errors.patch deleted file mode 100644 index 8153abe..0000000 --- a/SOURCES/0041-fix-ip-force-batch-to-continue-on-errors.patch +++ /dev/null @@ -1,234 +0,0 @@ -From 88997b4cd8480bcbcb3b0470020968a944495233 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:10:15 +0100 -Subject: [PATCH] fix ip -force -batch to continue on errors - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 42ecedd4bae53 -Conflicts: Previously backported changes to rtnl_talk() signature. - -commit 42ecedd4bae534fc688194a795eb4548c6530cda -Author: Roopa Prabhu -Date: Tue Mar 17 19:26:32 2015 -0700 - - fix ip -force -batch to continue on errors - - This patch replaces exits with returns in several - iproute2 commands. This fixes `ip -batch -force` - to not exit but continue on errors. - - $cat c.txt - route del 1.2.3.0/24 dev eth0 - route del 1.2.4.0/24 dev eth0 - route del 1.2.5.0/24 dev eth0 - route add 1.2.3.0/24 dev eth0 - - $ip -force -batch c.txt - RTNETLINK answers: No such process - Command failed c.txt:2 - RTNETLINK answers: No such process - Command failed c.txt:3 - - Reported-by: Sven-Haegar Koch - Signed-off-by: Roopa Prabhu ---- - bridge/fdb.c | 6 +++--- - bridge/link.c | 24 ++++++++++++------------ - bridge/mdb.c | 8 ++++---- - bridge/vlan.c | 4 ++-- - ip/iproute.c | 2 +- - 5 files changed, 22 insertions(+), 22 deletions(-) - -diff --git a/bridge/fdb.c b/bridge/fdb.c -index e411932..3020633 100644 ---- a/bridge/fdb.c -+++ b/bridge/fdb.c -@@ -322,7 +322,7 @@ static int fdb_modify(int cmd, int flags, int argc, char **argv) - - if (d == NULL || addr == NULL) { - fprintf(stderr, "Device and address are required arguments.\n"); -- exit(-1); -+ return -1; - } - - /* Assume self */ -@@ -337,7 +337,7 @@ static int fdb_modify(int cmd, int flags, int argc, char **argv) - abuf, abuf+1, abuf+2, - abuf+3, abuf+4, abuf+5) != 6) { - fprintf(stderr, "Invalid mac address %s\n", addr); -- exit(-1); -+ return -1; - } - - addattr_l(&req.n, sizeof(req), NDA_LLADDR, abuf, ETH_ALEN); -@@ -365,7 +365,7 @@ static int fdb_modify(int cmd, int flags, int argc, char **argv) - } - - if (rtnl_talk(&rth, &req.n, NULL, 0) < 0) -- exit(2); -+ return -1; - - return 0; - } -diff --git a/bridge/link.c b/bridge/link.c -index 69c0bfb..a9b1262 100644 ---- a/bridge/link.c -+++ b/bridge/link.c -@@ -284,31 +284,31 @@ static int brlink_modify(int argc, char **argv) - } else if (strcmp(*argv, "guard") == 0) { - NEXT_ARG(); - if (!on_off("guard", &bpdu_guard, *argv)) -- exit(-1); -+ return -1; - } else if (strcmp(*argv, "hairpin") == 0) { - NEXT_ARG(); - if (!on_off("hairping", &hairpin, *argv)) -- exit(-1); -+ return -1; - } else if (strcmp(*argv, "fastleave") == 0) { - NEXT_ARG(); - if (!on_off("fastleave", &fast_leave, *argv)) -- exit(-1); -+ return -1; - } else if (strcmp(*argv, "root_block") == 0) { - NEXT_ARG(); - if (!on_off("root_block", &root_block, *argv)) -- exit(-1); -+ return -1; - } else if (strcmp(*argv, "learning") == 0) { - NEXT_ARG(); - if (!on_off("learning", &learning, *argv)) -- exit(-1); -+ return -1; - } else if (strcmp(*argv, "learning_sync") == 0) { - NEXT_ARG(); - if (!on_off("learning_sync", &learning_sync, *argv)) -- exit(-1); -+ return -1; - } else if (strcmp(*argv, "flood") == 0) { - NEXT_ARG(); - if (!on_off("flood", &flood, *argv)) -- exit(-1); -+ return -1; - } else if (strcmp(*argv, "cost") == 0) { - NEXT_ARG(); - cost = atoi(*argv); -@@ -327,7 +327,7 @@ static int brlink_modify(int argc, char **argv) - if (state == nstates) { - fprintf(stderr, - "Error: invalid STP port state\n"); -- exit(-1); -+ return -1; - } - } - } else if (strcmp(*argv, "hwmode") == 0) { -@@ -341,7 +341,7 @@ static int brlink_modify(int argc, char **argv) - fprintf(stderr, - "Mode argument must be \"vepa\" or " - "\"veb\".\n"); -- exit(-1); -+ return -1; - } - } else if (strcmp(*argv, "self") == 0) { - flags |= BRIDGE_FLAGS_SELF; -@@ -354,14 +354,14 @@ static int brlink_modify(int argc, char **argv) - } - if (d == NULL) { - fprintf(stderr, "Device is a required argument.\n"); -- exit(-1); -+ return -1; - } - - - req.ifm.ifi_index = ll_name_to_index(d); - if (req.ifm.ifi_index == 0) { - fprintf(stderr, "Cannot find bridge device \"%s\"\n", d); -- exit(-1); -+ return -1; - } - - /* Nested PROTINFO attribute. Contains: port flags, cost, priority and -@@ -416,7 +416,7 @@ static int brlink_modify(int argc, char **argv) - } - - if (rtnl_talk(&rth, &req.n, NULL, 0) < 0) -- exit(2); -+ return -1; - - return 0; - } -diff --git a/bridge/mdb.c b/bridge/mdb.c -index 837fa5d..9a8ed54 100644 ---- a/bridge/mdb.c -+++ b/bridge/mdb.c -@@ -145,12 +145,12 @@ static int mdb_show(int argc, char **argv) - - if (rtnl_wilddump_request(&rth, PF_BRIDGE, RTM_GETMDB) < 0) { - perror("Cannot send dump request"); -- exit(1); -+ return -1; - } - - if (rtnl_dump_filter(&rth, print_mdb, stdout) < 0) { - fprintf(stderr, "Dump terminated\n"); -- exit(1); -+ return -1; - } - - return 0; -@@ -198,7 +198,7 @@ static int mdb_modify(int cmd, int flags, int argc, char **argv) - - if (d == NULL || grp == NULL || p == NULL) { - fprintf(stderr, "Device, group address and port name are required arguments.\n"); -- exit(-1); -+ return -1; - } - - req.bpm.ifindex = ll_name_to_index(d); -@@ -225,7 +225,7 @@ static int mdb_modify(int cmd, int flags, int argc, char **argv) - addattr_l(&req.n, sizeof(req), MDBA_SET_ENTRY, &entry, sizeof(entry)); - - if (rtnl_talk(&rth, &req.n, NULL, 0) < 0) -- exit(2); -+ return -1; - - return 0; - } -diff --git a/bridge/vlan.c b/bridge/vlan.c -index 0fb479c..ac2f523 100644 ---- a/bridge/vlan.c -+++ b/bridge/vlan.c -@@ -80,7 +80,7 @@ static int vlan_modify(int cmd, int argc, char **argv) - - if (d == NULL || vid == -1) { - fprintf(stderr, "Device and VLAN ID are required arguments.\n"); -- exit(-1); -+ return -1; - } - - req.ifm.ifi_index = ll_name_to_index(d); -@@ -132,7 +132,7 @@ static int vlan_modify(int cmd, int argc, char **argv) - addattr_nest_end(&req.n, afspec); - - if (rtnl_talk(&rth, &req.n, NULL, 0) < 0) -- exit(2); -+ return -1; - - return 0; - } -diff --git a/ip/iproute.c b/ip/iproute.c -index 8a706ea..9dcfd19 100644 ---- a/ip/iproute.c -+++ b/ip/iproute.c -@@ -1112,7 +1112,7 @@ static int iproute_modify(int cmd, unsigned flags, int argc, char **argv) - req.r.rtm_family = AF_INET; - - if (rtnl_talk(&rth, &req.n, NULL, 0) < 0) -- exit(2); -+ return -1; - - return 0; - } --- -1.8.3.1 - diff --git a/SOURCES/0041-man-tc-csum.8-Fix-inconsistency-in-example-descripti.patch b/SOURCES/0041-man-tc-csum.8-Fix-inconsistency-in-example-descripti.patch new file mode 100644 index 0000000..ddd8d95 --- /dev/null +++ b/SOURCES/0041-man-tc-csum.8-Fix-inconsistency-in-example-descripti.patch @@ -0,0 +1,42 @@ +From f08752c12351c79145e3a6caf346e3d971370a9c Mon Sep 17 00:00:00 2001 +From: Phil Sutter +Date: Wed, 6 Dec 2017 13:21:16 +0100 +Subject: [PATCH] man: tc-csum.8: Fix inconsistency in example description + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417162 +Upstream Status: iproute2.git commit 6bf156415a588 + +commit 6bf156415a588fa1c975be9a18a1579f63a936a2 +Author: Phil Sutter +Date: Wed Nov 29 18:34:09 2017 +0100 + + man: tc-csum.8: Fix inconsistency in example description + + Commit 6bbe5e6290db5 ("man: tc-csum.8: Fix example") changed both source + and destination IP addresses in example code but missed to update the + example's description accordingly. + + Fixes: 6bbe5e6290db5 ("man: tc-csum.8: Fix example") + Signed-off-by: Phil Sutter +--- + man/man8/tc-csum.8 | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/man/man8/tc-csum.8 b/man/man8/tc-csum.8 +index 409ab71..65724b8 100644 +--- a/man/man8/tc-csum.8 ++++ b/man/man8/tc-csum.8 +@@ -53,8 +53,8 @@ SCTP header + .B SWEETS + These are merely syntactic sugar and ignored internally. + .SH EXAMPLES +-The following performs stateless NAT for incoming packets from 192.168.1.100 to +-new destination 18.52.86.120 (0x12345678 in hex). Assuming these are UDP ++The following performs stateless NAT for incoming packets from 192.0.2.100 to ++new destination 198.51.100.1. Assuming these are UDP + packets, both IP and UDP checksums have to be recalculated: + + .RS +-- +1.8.3.1 + diff --git a/SOURCES/0042-route-label-externally-offloaded-routes.patch b/SOURCES/0042-route-label-externally-offloaded-routes.patch deleted file mode 100644 index 2250b98..0000000 --- a/SOURCES/0042-route-label-externally-offloaded-routes.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 002cfe8913c88232569f316c7446834f985d52ff Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:10:39 +0100 -Subject: [PATCH] route: label externally offloaded routes - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 655444bdadfcf - -commit 655444bdadfcf348d4e668476f493e542587446b -Author: Scott Feldman -Date: Sat Mar 7 22:15:35 2015 -0800 - - route: label externally offloaded routes - - On ip route print dump, label externally offloaded routes with "external". - Offloaded routes are flagged with RTNH_F_EXTERNAL, a recent additon to - net-next. For example: - - $ ip route - default via 192.168.0.2 dev eth0 - 11.0.0.0/30 dev swp1 proto kernel scope link src 11.0.0.2 external - 11.0.0.4/30 via 11.0.0.1 dev swp1 proto zebra metric 20 external - 11.0.0.8/30 dev swp2 proto kernel scope link src 11.0.0.10 external - 11.0.0.12/30 via 11.0.0.9 dev swp2 proto zebra metric 20 external - 12.0.0.2 proto zebra metric 30 external - nexthop via 11.0.0.1 dev swp1 weight 1 - nexthop via 11.0.0.9 dev swp2 weight 1 - 12.0.0.3 via 11.0.0.1 dev swp1 proto zebra metric 20 external - 12.0.0.4 via 11.0.0.9 dev swp2 proto zebra metric 20 external - 192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.15 - - Signed-off-by: Scott Feldman - Reviewed-by: Jiri Pirko ---- - ip/iproute.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/ip/iproute.c b/ip/iproute.c -index 9dcfd19..6d64469 100644 ---- a/ip/iproute.c -+++ b/ip/iproute.c -@@ -438,6 +438,8 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - fprintf(fp, "onlink "); - if (r->rtm_flags & RTNH_F_PERVASIVE) - fprintf(fp, "pervasive "); -+ if (r->rtm_flags & RTNH_F_EXTERNAL) -+ fprintf(fp, "external "); - if (r->rtm_flags & RTM_F_NOTIFY) - fprintf(fp, "notify "); - if (tb[RTA_MARK]) { --- -1.8.3.1 - diff --git a/SOURCES/0042-tc-fix-command-tc-actions-del-hang-issue.patch b/SOURCES/0042-tc-fix-command-tc-actions-del-hang-issue.patch new file mode 100644 index 0000000..54d524e --- /dev/null +++ b/SOURCES/0042-tc-fix-command-tc-actions-del-hang-issue.patch @@ -0,0 +1,42 @@ +From dbc597c9d1e0e65cc9d989d8057f9a083c2f5779 Mon Sep 17 00:00:00 2001 +From: Phil Sutter +Date: Fri, 15 Dec 2017 16:13:46 +0100 +Subject: [PATCH] tc: fix command "tc actions del" hang issue + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1526394 +Upstream Status: iproute2.git commit 83cf5bc73b858 + +commit 83cf5bc73b858608d59c3c6126a9f37e793e15dd +Author: Chris Mi +Date: Thu Dec 14 18:09:00 2017 +0900 + + tc: fix command "tc actions del" hang issue + + If command is RTM_DELACTION, a non-NULL pointer is passed to rtnl_talk(). + Then flag NLM_F_ACK is not set on n->nlmsg_flags and netlink_ack() will + not be called. Command tc will wait for the reply for ever. + + Fixes: 86bf43c7c2fd ("lib/libnetlink: update rtnl_talk to support malloc buff at run time") + Reviewed-by: Jiri Pirko + Signed-off-by: Chris Mi + Signed-off-by: Stephen Hemminger +--- + tc/m_action.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tc/m_action.c b/tc/m_action.c +index 90b2a11..7cfd9e0 100644 +--- a/tc/m_action.c ++++ b/tc/m_action.c +@@ -507,7 +507,7 @@ static int tc_action_gd(int cmd, unsigned int flags, int *argc_p, char ***argv_p + + req.n.nlmsg_seq = rth.dump = ++rth.seq; + +- if (rtnl_talk(&rth, &req.n, &ans) < 0) { ++ if (rtnl_talk(&rth, &req.n, cmd == RTM_DELACTION ? NULL : &ans) < 0) { + fprintf(stderr, "We have an error talking to the kernel\n"); + return 1; + } +-- +1.8.3.1 + diff --git a/SOURCES/0043-ip-link-Fix-use-after-free-in-nl_get_ll_addr_len.patch b/SOURCES/0043-ip-link-Fix-use-after-free-in-nl_get_ll_addr_len.patch new file mode 100644 index 0000000..2eda52a --- /dev/null +++ b/SOURCES/0043-ip-link-Fix-use-after-free-in-nl_get_ll_addr_len.patch @@ -0,0 +1,43 @@ +From dcafeb49b2538cc7118cb64f62c685980c106b48 Mon Sep 17 00:00:00 2001 +From: Phil Sutter +Date: Tue, 6 Mar 2018 11:35:28 +0100 +Subject: [PATCH] ip-link: Fix use after free in nl_get_ll_addr_len() + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1550097 +Upstream Status: iproute2.git commit 06867c3719587 + +commit 06867c371958773e39b4ccac07cfe3e2fff2ea55 +Author: Phil Sutter +Date: Thu Mar 1 10:35:12 2018 +0100 + + ip-link: Fix use after free in nl_get_ll_addr_len() + + Immediately after freeing the buffer returned from rtnl_talk(), it is + accessed again via pointer in struct rtattr array. This leads to some + builds not allowing to set an interface's MAC address because the + expected length value is garbage. + + Fixes: 86bf43c7c2fdc ("lib/libnetlink: update rtnl_talk to support malloc buff at run time") + Signed-off-by: Phil Sutter +--- + ip/iplink.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/ip/iplink.c b/ip/iplink.c +index 193997c..db5b2c9 100644 +--- a/ip/iplink.c ++++ b/ip/iplink.c +@@ -268,8 +268,9 @@ static int nl_get_ll_addr_len(unsigned int dev_index) + return -1; + } + ++ len = RTA_PAYLOAD(tb[IFLA_ADDRESS]); + free(answer); +- return RTA_PAYLOAD(tb[IFLA_ADDRESS]); ++ return len; + } + + static void iplink_parse_vf_vlan_info(int vf, int *argcp, char ***argvp, +-- +1.8.3.1 + diff --git a/SOURCES/0043-iproute2-unify-naming-for-entries-offloaded-to-hardw.patch b/SOURCES/0043-iproute2-unify-naming-for-entries-offloaded-to-hardw.patch deleted file mode 100644 index 1072976..0000000 --- a/SOURCES/0043-iproute2-unify-naming-for-entries-offloaded-to-hardw.patch +++ /dev/null @@ -1,91 +0,0 @@ -From 61ce940e17bcc13378c59fed8247a1afa7ae918d Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:10:39 +0100 -Subject: [PATCH] iproute2: unify naming for entries offloaded to hardware - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit aa05b988f53b5 - -commit aa05b988f53b5ce68f25c5b4e52c6bd3e32a6347 -Author: Andy Gospodarek -Date: Fri Apr 10 16:50:40 2015 -0400 - - iproute2: unify naming for entries offloaded to hardware - - The kernel now has the capability to offload FDB and FIB entries to hardware. - It is important to let users know if table entries are also offloaded to - hardware. Currently offloaded FDB entries are indicated by the existence of - the flag 'external' on the entry as of the following commit: - - commit 28467b7f3facd6114b2fbe0c9fecf57adbd52e12 - Author: Scott Feldman - Date: Thu Dec 4 09:57:15 2014 +0100 - - bridge/fdb: add flag/indication for FDB entry synced from offload device - - When the patch to add support for indicating that FIB entries were also - offloaded as posted to netdev by Scott Feldman it became clear that 'external' - would not be an ideal name for routes. There could definitely be confusion - about what this might mean since many routes are to external networks -- a - collision/confusion that did not happen with FDB. - - Scott Feldman asked me to check with others and build concensus around a name. - After speaking with several people about this I am proposing we refer to both - FDB and FIB entries that are currently backed by hardware (based on the work - done in rocker) with the flag 'offload' appended to the end ofthe entry. - - Some people liked the string 'external,' others liked 'hardware,' but the point - is to communicate that these routes are available to something that will will - offload the forwarding normally done by the kernel. Since the term 'offload' - is used so frequently it seems appropriate to use the same language in - ip/bridge output. - - The term 'offload' also seems to resonate with many of the people who have - responded on Scott's original thread or to those who I reached out to directly - and did respond to my query, so it seems we have reached consensus that it - should be the term used going forward. - - v2: rebased against net-next branch - - Signed-off-by: Andy Gospodarek - CC: Jamal Hadi Salim - CC: Jeff Kirsher - CC: Jiri Pirko - CC: John W. Linville - CC: Roopa Prabhu - CC: Scott Feldman - CC: Stephen Hemminger ---- - bridge/fdb.c | 2 +- - ip/iproute.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/bridge/fdb.c b/bridge/fdb.c -index 3020633..edf621c 100644 ---- a/bridge/fdb.c -+++ b/bridge/fdb.c -@@ -159,7 +159,7 @@ int print_fdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - if (r->ndm_flags & NTF_ROUTER) - fprintf(fp, "router "); - if (r->ndm_flags & NTF_EXT_LEARNED) -- fprintf(fp, "external "); -+ fprintf(fp, "offload "); - - fprintf(fp, "%s\n", state_n2a(r->ndm_state)); - return 0; -diff --git a/ip/iproute.c b/ip/iproute.c -index 6d64469..3f4b91a 100644 ---- a/ip/iproute.c -+++ b/ip/iproute.c -@@ -439,7 +439,7 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - if (r->rtm_flags & RTNH_F_PERVASIVE) - fprintf(fp, "pervasive "); - if (r->rtm_flags & RTNH_F_EXTERNAL) -- fprintf(fp, "external "); -+ fprintf(fp, "offload "); - if (r->rtm_flags & RTM_F_NOTIFY) - fprintf(fp, "notify "); - if (tb[RTA_MARK]) { --- -1.8.3.1 - diff --git a/SOURCES/0044-ip-return-correct-exit-code-on-route-failure.patch b/SOURCES/0044-ip-return-correct-exit-code-on-route-failure.patch deleted file mode 100644 index 1e0d25e..0000000 --- a/SOURCES/0044-ip-return-correct-exit-code-on-route-failure.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 24feca1579b6bdcff4d9b495ce5ce0da6b4b6dc0 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:10:39 +0100 -Subject: [PATCH] ip: return correct exit code on route failure - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit d58ba4ba2a532 -Conflicts: Previously backported changes to rtnl_talk() signature. - -commit d58ba4ba2a532f3ebfa640c42ec2622b54740cdf -Author: Stephen Hemminger -Date: Wed May 6 09:48:06 2015 -0700 - - ip: return correct exit code on route failure - - If kernel complains about ip route request, exit status should be - 2 not 1. - - This fixes regression introduced by: - commit 42ecedd4bae534fc688194a795eb4548c6530cda - Author: Roopa Prabhu - Date: Tue Mar 17 19:26:32 2015 -0700 - - fix ip -force -batch to continue on errors ---- - ip/iproute.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/ip/iproute.c b/ip/iproute.c -index 3f4b91a..73c6db9 100644 ---- a/ip/iproute.c -+++ b/ip/iproute.c -@@ -1114,7 +1114,7 @@ static int iproute_modify(int cmd, unsigned flags, int argc, char **argv) - req.r.rtm_family = AF_INET; - - if (rtnl_talk(&rth, &req.n, NULL, 0) < 0) -- return -1; -+ return -2; - - return 0; - } --- -1.8.3.1 - diff --git a/SOURCES/0045-iproute2-ipa-show-switch-id.patch b/SOURCES/0045-iproute2-ipa-show-switch-id.patch deleted file mode 100644 index 05e9c55..0000000 --- a/SOURCES/0045-iproute2-ipa-show-switch-id.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 84a13f487d76e62d1ff3be6ed94d7305f72205e8 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:10:58 +0100 -Subject: [PATCH] iproute2: ipa: show switch id - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 122f2fc5739c1 - -commit 122f2fc5739c1ba9967775581201eefece855602 -Author: Jiri Pirko -Date: Wed Jul 8 17:08:18 2015 +0200 - - iproute2: ipa: show switch id - - We forgot to include this patch somehow. So do it now. - - Signed-off-by: Jiri Pirko - Acked-by: Andy Gospodarek ---- - ip/ipaddress.c | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/ip/ipaddress.c b/ip/ipaddress.c -index b24b103..45b47f9 100644 ---- a/ip/ipaddress.c -+++ b/ip/ipaddress.c -@@ -643,6 +643,14 @@ int print_linkinfo(const struct sockaddr_nl *who, - b1, sizeof(b1))); - } - -+ if (tb[IFLA_PHYS_SWITCH_ID]) { -+ SPRINT_BUF(b1); -+ fprintf(fp, "switchid %s ", -+ hexstring_n2a(RTA_DATA(tb[IFLA_PHYS_SWITCH_ID]), -+ RTA_PAYLOAD(tb[IFLA_PHYS_SWITCH_ID]), -+ b1, sizeof(b1))); -+ } -+ - if (tb[IFLA_OPERSTATE]) - print_operstate(fp, rta_getattr_u8(tb[IFLA_OPERSTATE])); - --- -1.8.3.1 - diff --git a/SOURCES/0046-ip-fix-all-the-checkpatch-warnings.patch b/SOURCES/0046-ip-fix-all-the-checkpatch-warnings.patch deleted file mode 100644 index 2da15b7..0000000 --- a/SOURCES/0046-ip-fix-all-the-checkpatch-warnings.patch +++ /dev/null @@ -1,257 +0,0 @@ -From dca16c0ab9a250b332e46deca0c9770988c5bc42 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:10:58 +0100 -Subject: [PATCH] ip: fix all the checkpatch warnings - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit ec7aff5c4f15f - -commit ec7aff5c4f15fbf7fe4886e826dffa02e1f7673b -Author: Stephen Hemminger -Date: Sun Jul 26 21:46:44 2015 -0700 - - ip: fix all the checkpatch warnings - - Zhang Shengju some places where tabs were not being used. - Go ahead and fix all the trival checkpatch warnings in ip/ip.c - Also fix bridge.c ---- - bridge/bridge.c | 34 +++++++++++++++++++--------------- - include/utils.h | 2 +- - ip/ip.c | 48 ++++++++++++++++++++++++++---------------------- - 3 files changed, 46 insertions(+), 38 deletions(-) - -diff --git a/bridge/bridge.c b/bridge/bridge.c -index 88469ca..eaf09c8 100644 ---- a/bridge/bridge.c -+++ b/bridge/bridge.c -@@ -18,12 +18,12 @@ - struct rtnl_handle rth = { .fd = -1 }; - int preferred_family = AF_UNSPEC; - int resolve_hosts; --int oneline = 0; -+int oneline; - int show_stats; - int show_details; - int compress_vlans; - int timestamp; --char * _SL_ = NULL; -+const char *_SL_; - - static void usage(void) __attribute__((noreturn)); - -@@ -31,10 +31,10 @@ static void usage(void) - { - fprintf(stderr, - "Usage: bridge [ OPTIONS ] OBJECT { COMMAND | help }\n" --"where OBJECT := { link | fdb | mdb | vlan | monitor }\n" --" OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] |\n" --" -o[neline] | -t[imestamp] | -n[etns] name |\n" --" -c[ompressvlans] }\n"); -+"where OBJECT := { link | fdb | mdb | vlan | monitor }\n" -+" OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] |\n" -+" -o[neline] | -t[imestamp] | -n[etns] name |\n" -+" -c[ompressvlans] }\n"); - exit(-1); - } - -@@ -48,9 +48,9 @@ static const struct cmd { - const char *cmd; - int (*func)(int argc, char **argv); - } cmds[] = { -- { "link", do_link }, -- { "fdb", do_fdb }, -- { "mdb", do_mdb }, -+ { "link", do_link }, -+ { "fdb", do_fdb }, -+ { "mdb", do_mdb }, - { "vlan", do_vlan }, - { "monitor", do_monitor }, - { "help", do_help }, -@@ -66,7 +66,8 @@ static int do_cmd(const char *argv0, int argc, char **argv) - return c->func(argc-1, argv+1); - } - -- fprintf(stderr, "Object \"%s\" is unknown, try \"bridge help\".\n", argv0); -+ fprintf(stderr, -+ "Object \"%s\" is unknown, try \"bridge help\".\n", argv0); - return -1; - } - -@@ -74,8 +75,9 @@ int - main(int argc, char **argv) - { - while (argc > 1) { -- char *opt = argv[1]; -- if (strcmp(opt,"--") == 0) { -+ const char *opt = argv[1]; -+ -+ if (strcmp(opt, "--") == 0) { - argc--; argv++; - break; - } -@@ -98,7 +100,7 @@ main(int argc, char **argv) - ++oneline; - } else if (matches(opt, "-timestamp") == 0) { - ++timestamp; -- } else if (matches(opt, "-family") == 0) { -+ } else if (matches(opt, "-family") == 0) { - argc--; - argv++; - if (argc <= 1) -@@ -122,13 +124,15 @@ main(int argc, char **argv) - } else if (matches(opt, "-compressvlans") == 0) { - ++compress_vlans; - } else { -- fprintf(stderr, "Option \"%s\" is unknown, try \"bridge help\".\n", opt); -+ fprintf(stderr, -+ "Option \"%s\" is unknown, try \"bridge help\".\n", -+ opt); - exit(-1); - } - argc--; argv++; - } - -- _SL_ = oneline ? "\\" : "\n" ; -+ _SL_ = oneline ? "\\" : "\n"; - - if (rtnl_open(&rth, 0) < 0) - exit(1); -diff --git a/include/utils.h b/include/utils.h -index 1ee9343..22198cb 100644 ---- a/include/utils.h -+++ b/include/utils.h -@@ -21,7 +21,7 @@ extern int resolve_hosts; - extern int oneline; - extern int timestamp; - extern int timestamp_short; --extern char * _SL_; -+extern const char * _SL_; - extern int max_flush_loops; - extern int batch_mode; - extern bool do_all; -diff --git a/ip/ip.c b/ip/ip.c -index d6f1391..644e712 100644 ---- a/ip/ip.c -+++ b/ip/ip.c -@@ -25,18 +25,18 @@ - #include "namespace.h" - - int preferred_family = AF_UNSPEC; --int human_readable = 0; --int use_iec = 0; --int show_stats = 0; --int show_details = 0; --int resolve_hosts = 0; --int oneline = 0; --int timestamp = 0; --char * _SL_ = NULL; --int force = 0; -+int human_readable; -+int use_iec; -+int show_stats; -+int show_details; -+int resolve_hosts; -+int oneline; -+int timestamp; -+const char *_SL_; -+int force; - int max_flush_loops = 10; --int batch_mode = 0; --bool do_all = false; -+int batch_mode; -+bool do_all; - - struct rtnl_handle rth = { .fd = -1 }; - -@@ -63,7 +63,7 @@ static void usage(void) - static int do_help(int argc, char **argv) - { - usage(); -- return 0; -+ return 0; - } - - static const struct cmd { -@@ -88,7 +88,7 @@ static const struct cmd { - { "tap", do_iptuntap }, - { "token", do_iptoken }, - { "tcpmetrics", do_tcp_metrics }, -- { "tcp_metrics",do_tcp_metrics }, -+ { "tcp_metrics", do_tcp_metrics }, - { "monitor", do_ipmonitor }, - { "xfrm", do_xfrm }, - { "mroute", do_multiroute }, -@@ -104,9 +104,8 @@ static int do_cmd(const char *argv0, int argc, char **argv) - const struct cmd *c; - - for (c = cmds; c->cmd; ++c) { -- if (matches(argv0, c->cmd) == 0) { -+ if (matches(argv0, c->cmd) == 0) - return -(c->func(argc-1, argv+1)); -- } - } - - fprintf(stderr, "Object \"%s\" is unknown, try \"ip help\".\n", argv0); -@@ -123,7 +122,8 @@ static int batch(const char *name) - - if (name && strcmp(name, "-") != 0) { - if (freopen(name, "r", stdin) == NULL) { -- fprintf(stderr, "Cannot open file \"%s\" for reading: %s\n", -+ fprintf(stderr, -+ "Cannot open file \"%s\" for reading: %s\n", - name, strerror(errno)); - return EXIT_FAILURE; - } -@@ -144,7 +144,8 @@ static int batch(const char *name) - continue; /* blank line */ - - if (do_cmd(largv[0], largc, largv)) { -- fprintf(stderr, "Command failed %s:%d\n", name, cmdlineno); -+ fprintf(stderr, "Command failed %s:%d\n", -+ name, cmdlineno); - ret = EXIT_FAILURE; - if (!force) - break; -@@ -171,7 +172,8 @@ int main(int argc, char **argv) - - while (argc > 1) { - char *opt = argv[1]; -- if (strcmp(opt,"--") == 0) { -+ -+ if (strcmp(opt, "--") == 0) { - argc--; argv++; - break; - } -@@ -184,8 +186,8 @@ int main(int argc, char **argv) - argv++; - if (argc <= 1) - usage(); -- max_flush_loops = atoi(argv[1]); -- } else if (matches(opt, "-family") == 0) { -+ max_flush_loops = atoi(argv[1]); -+ } else if (matches(opt, "-family") == 0) { - argc--; - argv++; - if (argc <= 1) -@@ -264,13 +266,15 @@ int main(int argc, char **argv) - } else if (matches(opt, "-all") == 0) { - do_all = true; - } else { -- fprintf(stderr, "Option \"%s\" is unknown, try \"ip -help\".\n", opt); -+ fprintf(stderr, -+ "Option \"%s\" is unknown, try \"ip -help\".\n", -+ opt); - exit(-1); - } - argc--; argv++; - } - -- _SL_ = oneline ? "\\" : "\n" ; -+ _SL_ = oneline ? "\\" : "\n"; - - if (batch_file) - return batch(batch_file); --- -1.8.3.1 - diff --git a/SOURCES/0047-bridge-mdb-add-support-for-router-add-del-notificati.patch b/SOURCES/0047-bridge-mdb-add-support-for-router-add-del-notificati.patch deleted file mode 100644 index c15758c..0000000 --- a/SOURCES/0047-bridge-mdb-add-support-for-router-add-del-notificati.patch +++ /dev/null @@ -1,78 +0,0 @@ -From caf1f1dfd523c10dd8c9d3694ba485b6edb5dd5d Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:11:06 +0100 -Subject: [PATCH] bridge: mdb: add support for router add/del notifications - monitoring - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 6b4867e62175c - -commit 6b4867e62175ca0635f8cf6b22f882272d5a2219 -Author: Nikolay Aleksandrov -Date: Mon Jul 27 13:44:05 2015 +0200 - - bridge: mdb: add support for router add/del notifications monitoring - - This patch adds support for ADDMDB/DELMDB notifications about router ports - which have been added or deleted/expired respectively. - - Example output: - $ bridge -s monitor mdb - Deleted router port dev eth3 master br0 - router port dev eth3 master br0 - - Signed-off-by: Nikolay Aleksandrov ---- - bridge/mdb.c | 22 +++++++++++++++++----- - 1 file changed, 17 insertions(+), 5 deletions(-) - -diff --git a/bridge/mdb.c b/bridge/mdb.c -index 9a8ed54..680ec30 100644 ---- a/bridge/mdb.c -+++ b/bridge/mdb.c -@@ -82,7 +82,7 @@ int print_mdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - FILE *fp = arg; - struct br_port_msg *r = NLMSG_DATA(n); - int len = n->nlmsg_len; -- struct rtattr * tb[MDBA_MAX+1]; -+ struct rtattr *tb[MDBA_MAX+1], *i; - - if (n->nlmsg_type != RTM_GETMDB && n->nlmsg_type != RTM_NEWMDB && n->nlmsg_type != RTM_DELMDB) { - fprintf(stderr, "Not RTM_GETMDB, RTM_NEWMDB or RTM_DELMDB: %08x %08x %08x\n", -@@ -103,7 +103,6 @@ int print_mdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - parse_rtattr(tb, MDBA_MAX, MDBA_RTA(r), n->nlmsg_len - NLMSG_LENGTH(sizeof(*r))); - - if (tb[MDBA_MDB]) { -- struct rtattr *i; - int rem = RTA_PAYLOAD(tb[MDBA_MDB]); - - for (i = RTA_DATA(tb[MDBA_MDB]); RTA_OK(i, rem); i = RTA_NEXT(i, rem)) -@@ -111,9 +110,22 @@ int print_mdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - } - - if (tb[MDBA_ROUTER]) { -- if (show_details) { -- fprintf(fp, "router ports on %s: ", ll_index_to_name(r->ifindex)); -- br_print_router_ports(fp, tb[MDBA_ROUTER]); -+ if (n->nlmsg_type == RTM_GETMDB) { -+ if (show_details) { -+ fprintf(fp, "router ports on %s: ", -+ ll_index_to_name(r->ifindex)); -+ br_print_router_ports(fp, tb[MDBA_ROUTER]); -+ } -+ } else { -+ uint32_t *port_ifindex; -+ -+ i = RTA_DATA(tb[MDBA_ROUTER]); -+ port_ifindex = RTA_DATA(i); -+ if (n->nlmsg_type == RTM_DELMDB) -+ fprintf(fp, "Deleted "); -+ fprintf(fp, "router port dev %s master %s\n", -+ ll_index_to_name(*port_ifindex), -+ ll_index_to_name(r->ifindex)); - } - } - --- -1.8.3.1 - diff --git a/SOURCES/0048-ip-link-proto_down-config-and-display.patch b/SOURCES/0048-ip-link-proto_down-config-and-display.patch deleted file mode 100644 index 32ebea5..0000000 --- a/SOURCES/0048-ip-link-proto_down-config-and-display.patch +++ /dev/null @@ -1,119 +0,0 @@ -From 88507d6ca29f372ad4e8ac17933876205b8d4bab Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:11:06 +0100 -Subject: [PATCH] ip link: proto_down config and display. - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 188648270ae9d -Conflicts: Man page change applied manually due to previously backported - synopsis syntax fixup. - -commit 188648270ae9d5d967fddf496cd2f2a5ac04e2bf -Author: Anuradha Karuppiah -Date: Tue Jul 14 13:43:22 2015 -0700 - - ip link: proto_down config and display. - - This patch adds support to set and display protodown on a switch port. The - switch driver can handle this error state by doing a phys down on the port. - - One example user space application setting this flag is a multi-chassis - LAG application to handle split-brain situation on peer-link failure. - - Example: - root@net-next:~# ip link set eth1 protodown on - root@net-next:~/iproute2# ip link show eth1 - 4: eth1: mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000 - link/ether 52:54:00:12:35:01 brd ff:ff:ff:ff:ff:ff protodown on - root@net-next:~/iproute2# ip link set eth1 protodown off - root@net-next:~/iproute2# ip link show eth1 - 4: eth1: mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000 - link/ether 52:54:00:12:35:01 brd ff:ff:ff:ff:ff:ff - root@net-next:~/iproute2# - - Signed-off-by: Anuradha Karuppiah - Signed-off-by: Andy Gospodarek - Signed-off-by: Roopa Prabhu - Signed-off-by: Wilson Kok ---- - ip/ipaddress.c | 5 +++++ - ip/iplink.c | 13 +++++++++++++ - man/man8/ip-link.8.in | 8 ++++++++ - 3 files changed, 26 insertions(+) - -diff --git a/ip/ipaddress.c b/ip/ipaddress.c -index 45b47f9..d5bc2dc 100644 ---- a/ip/ipaddress.c -+++ b/ip/ipaddress.c -@@ -692,6 +692,11 @@ int print_linkinfo(const struct sockaddr_nl *who, - fprintf(fp, " link-netnsid unknown"); - } - -+ if (tb[IFLA_PROTO_DOWN]) { -+ if (rta_getattr_u8(tb[IFLA_PROTO_DOWN])) -+ fprintf(fp, " protodown on "); -+ } -+ - if (tb[IFLA_PROMISCUITY] && show_details) - fprintf(fp, " promiscuity %u ", - *(int*)RTA_DATA(tb[IFLA_PROMISCUITY])); -diff --git a/ip/iplink.c b/ip/iplink.c -index 10f97af..06b0a6d 100644 ---- a/ip/iplink.c -+++ b/ip/iplink.c -@@ -89,6 +89,7 @@ void iplink_usage(void) - fprintf(stderr, " [ master DEVICE ]\n"); - fprintf(stderr, " [ nomaster ]\n"); - fprintf(stderr, " [ addrgenmode { eui64 | none } ]\n"); -+ fprintf(stderr, " [ protodown { on | off } ]\n"); - fprintf(stderr, " ip link show [ DEVICE | group GROUP ] [up] [master DEV] [type TYPE]\n"); - - if (iplink_have_newlink()) { -@@ -661,6 +662,18 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req, - invarg("Invalid \"link-netnsid\" value\n", *argv); - addattr32(&req->n, sizeof(*req), IFLA_LINK_NETNSID, - link_netnsid); -+ } else if (strcmp(*argv, "protodown") == 0) { -+ unsigned int proto_down; -+ -+ NEXT_ARG(); -+ if (strcmp(*argv, "on") == 0) -+ proto_down = 1; -+ else if (strcmp(*argv, "off") == 0) -+ proto_down = 0; -+ else -+ return on_off("protodown", *argv); -+ addattr8(&req->n, sizeof(*req), IFLA_PROTO_DOWN, -+ proto_down); - } else { - if (strcmp(*argv, "dev") == 0) { - NEXT_ARG(); -diff --git a/man/man8/ip-link.8.in b/man/man8/ip-link.8.in -index 73cd86d..38e5416 100644 ---- a/man/man8/ip-link.8.in -+++ b/man/man8/ip-link.8.in -@@ -66,6 +66,8 @@ ip-link \- network device configuration - .br - .RB "[ " promisc " { " on " | " off " } ]" - .br -+.BR "[ " protodown " { " on " | " off " } ]" -+.br - .RB "[ " trailers " { " on " | " off " } ]" - .br - .RB "[ " txqueuelen -@@ -936,6 +938,12 @@ change the - flag on the device. - - .TP -+.BR "protodown on " or " protodown off" -+change the -+.B PROTODOWN -+state on the device. Indicates that a protocol error has been detected on the port. Switch drivers can react to this error by doing a phys down on the switch port. -+ -+.TP - .BR "dynamic on " or " dynamic off" - change the - .B DYNAMIC --- -1.8.3.1 - diff --git a/SOURCES/0049-bridge-mdb-add-support-for-vlans.patch b/SOURCES/0049-bridge-mdb-add-support-for-vlans.patch deleted file mode 100644 index cbcaa33..0000000 --- a/SOURCES/0049-bridge-mdb-add-support-for-vlans.patch +++ /dev/null @@ -1,124 +0,0 @@ -From 8dab50579927df9b7dacd82480bbefc1cc231547 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:11:51 +0100 -Subject: [PATCH] bridge: mdb: add support for vlans - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 6aac8617139a9 - -commit 6aac8617139a96a124d63aeae843b73c38f88fc5 -Author: Nikolay Aleksandrov -Date: Wed Jul 15 08:45:20 2015 -0700 - - bridge: mdb: add support for vlans - - This patch allows the user to specify the vlan of the mdb group being - added or deleted and adds support for displaying the vlan when - dumping mdb information or monitoring it. It also updates the man page - to reflect the new "vid" argument for mdb. - - Signed-off-by: Nikolay Aleksandrov ---- - bridge/mdb.c | 31 +++++++++++++++++++------------ - man/man8/bridge.8 | 8 +++++++- - 2 files changed, 26 insertions(+), 13 deletions(-) - -diff --git a/bridge/mdb.c b/bridge/mdb.c -index 680ec30..1b34f69 100644 ---- a/bridge/mdb.c -+++ b/bridge/mdb.c -@@ -28,7 +28,7 @@ static unsigned int filter_index; - - static void usage(void) - { -- fprintf(stderr, "Usage: bridge mdb { add | del } dev DEV port PORT grp GROUP [permanent | temp]\n"); -+ fprintf(stderr, "Usage: bridge mdb { add | del } dev DEV port PORT grp GROUP [permanent | temp] [vid VID]\n"); - fprintf(stderr, " bridge mdb {show} [ dev DEV ]\n"); - exit(-1); - } -@@ -51,17 +51,19 @@ static void br_print_router_ports(FILE *f, struct rtattr *attr) - static void print_mdb_entry(FILE *f, int ifindex, struct br_mdb_entry *e) - { - SPRINT_BUF(abuf); -- -- if (e->addr.proto == htons(ETH_P_IP)) -- fprintf(f, "dev %s port %s grp %s %s\n", ll_index_to_name(ifindex), -- ll_index_to_name(e->ifindex), -- inet_ntop(AF_INET, &e->addr.u.ip4, abuf, sizeof(abuf)), -- (e->state & MDB_PERMANENT) ? "permanent" : "temp"); -- else -- fprintf(f, "dev %s port %s grp %s %s\n", ll_index_to_name(ifindex), -- ll_index_to_name(e->ifindex), -- inet_ntop(AF_INET6, &e->addr.u.ip6, abuf, sizeof(abuf)), -- (e->state & MDB_PERMANENT) ? "permanent" : "temp"); -+ const void *src; -+ int af; -+ -+ af = e->addr.proto == htons(ETH_P_IP) ? AF_INET : AF_INET6; -+ src = af == AF_INET ? (const void *)&e->addr.u.ip4 : -+ (const void *)&e->addr.u.ip6; -+ fprintf(f, "dev %s port %s grp %s %s", ll_index_to_name(ifindex), -+ ll_index_to_name(e->ifindex), -+ inet_ntop(af, src, abuf, sizeof(abuf)), -+ (e->state & MDB_PERMANENT) ? "permanent" : "temp"); -+ if (e->vid) -+ fprintf(f, " vid %hu", e->vid); -+ fprintf(f, "\n"); - } - - static void br_print_mdb_entry(FILE *f, int ifindex, struct rtattr *attr) -@@ -177,6 +179,7 @@ static int mdb_modify(int cmd, int flags, int argc, char **argv) - } req; - struct br_mdb_entry entry; - char *d = NULL, *p = NULL, *grp = NULL; -+ short vid = 0; - - memset(&req, 0, sizeof(req)); - memset(&entry, 0, sizeof(entry)); -@@ -201,6 +204,9 @@ static int mdb_modify(int cmd, int flags, int argc, char **argv) - entry.state |= MDB_PERMANENT; - } else if (strcmp(*argv, "temp") == 0) { - ;/* nothing */ -+ } else if (strcmp(*argv, "vid") == 0) { -+ NEXT_ARG(); -+ vid = atoi(*argv); - } else { - if (matches(*argv, "help") == 0) - usage(); -@@ -234,6 +240,7 @@ static int mdb_modify(int cmd, int flags, int argc, char **argv) - } else - entry.addr.proto = htons(ETH_P_IP); - -+ entry.vid = vid; - addattr_l(&req.n, sizeof(req), MDBA_SET_ENTRY, &entry, sizeof(entry)); - - if (rtnl_talk(&rth, &req.n, NULL, 0) < 0) -diff --git a/man/man8/bridge.8 b/man/man8/bridge.8 -index 8fae74b..210a3ee 100644 ---- a/man/man8/bridge.8 -+++ b/man/man8/bridge.8 -@@ -77,7 +77,9 @@ bridge \- show / manipulate bridge addresses and devices - .IR PORT - .B grp - .IR GROUP " [ " --.BR permanent " | " temp " ]" -+.BR permanent " | " temp " ] [ " -+.B vid -+.IR VID " ] " - - .ti -8 - .BR "bridge mdb show " [ " -@@ -435,6 +437,10 @@ the port. - - the mdb entry is temporary (default) - .sp - -+.TP -+.BI vid " VID" -+the VLAN ID which is known to have members of this multicast group. -+ - .in -8 - .SS bridge mdb delete - delete a multicast group database entry - This command removes an existing mdb entry. --- -1.8.3.1 - diff --git a/SOURCES/0050-bridge-mdb-add-deleted-when-monitoring-delmdb-event.patch b/SOURCES/0050-bridge-mdb-add-deleted-when-monitoring-delmdb-event.patch deleted file mode 100644 index 239da14..0000000 --- a/SOURCES/0050-bridge-mdb-add-deleted-when-monitoring-delmdb-event.patch +++ /dev/null @@ -1,88 +0,0 @@ -From ade2d09ef2a32d65a7a389b4b76b470c782addf2 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:11:51 +0100 -Subject: [PATCH] bridge: mdb: add deleted when monitoring delmdb event - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 90d73159d9a32 - -commit 90d73159d9a326fa59c5e340ae3489f63ec49b3e -Author: Nikolay Aleksandrov -Date: Thu Jul 30 11:30:32 2015 +0200 - - bridge: mdb: add deleted when monitoring delmdb event - - Before this patch both addmdb and delmdb events were printed the same, - now we'll get a "Deleted" string in front when delmdb is received. - Before: - $ bridge mdb add dev br0 port eth3 grp 239.0.0.1 - (monitor) dev br0 port eth3 grp 239.0.0.1 temp - $ bridge mdb del dev br0 port eth3 grp 239.0.0.1 - (monitor) dev br0 port eth3 grp 239.0.0.1 temp - ^^ No way to differentiate between both events. - - After: - $ bridge mdb add dev br0 port eth3 grp 239.0.0.1 - (monitor) dev br0 port eth3 grp 239.0.0.1 temp - $ bridge mdb del dev br0 port eth3 grp 239.0.0.1 - (monitor) Deleted dev br0 port eth3 grp 239.0.0.1 temp - - Signed-off-by: Nikolay Aleksandrov ---- - bridge/mdb.c | 12 ++++++++---- - 1 file changed, 8 insertions(+), 4 deletions(-) - -diff --git a/bridge/mdb.c b/bridge/mdb.c -index 1b34f69..b14bd01 100644 ---- a/bridge/mdb.c -+++ b/bridge/mdb.c -@@ -48,7 +48,8 @@ static void br_print_router_ports(FILE *f, struct rtattr *attr) - fprintf(f, "\n"); - } - --static void print_mdb_entry(FILE *f, int ifindex, struct br_mdb_entry *e) -+static void print_mdb_entry(FILE *f, int ifindex, struct br_mdb_entry *e, -+ struct nlmsghdr *n) - { - SPRINT_BUF(abuf); - const void *src; -@@ -57,6 +58,8 @@ static void print_mdb_entry(FILE *f, int ifindex, struct br_mdb_entry *e) - af = e->addr.proto == htons(ETH_P_IP) ? AF_INET : AF_INET6; - src = af == AF_INET ? (const void *)&e->addr.u.ip4 : - (const void *)&e->addr.u.ip6; -+ if (n->nlmsg_type == RTM_DELMDB) -+ fprintf(f, "Deleted "); - fprintf(f, "dev %s port %s grp %s %s", ll_index_to_name(ifindex), - ll_index_to_name(e->ifindex), - inet_ntop(af, src, abuf, sizeof(abuf)), -@@ -66,7 +69,8 @@ static void print_mdb_entry(FILE *f, int ifindex, struct br_mdb_entry *e) - fprintf(f, "\n"); - } - --static void br_print_mdb_entry(FILE *f, int ifindex, struct rtattr *attr) -+static void br_print_mdb_entry(FILE *f, int ifindex, struct rtattr *attr, -+ struct nlmsghdr *n) - { - struct rtattr *i; - int rem; -@@ -75,7 +79,7 @@ static void br_print_mdb_entry(FILE *f, int ifindex, struct rtattr *attr) - rem = RTA_PAYLOAD(attr); - for (i = RTA_DATA(attr); RTA_OK(i, rem); i = RTA_NEXT(i, rem)) { - e = RTA_DATA(i); -- print_mdb_entry(f, ifindex, e); -+ print_mdb_entry(f, ifindex, e, n); - } - } - -@@ -108,7 +112,7 @@ int print_mdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - int rem = RTA_PAYLOAD(tb[MDBA_MDB]); - - for (i = RTA_DATA(tb[MDBA_MDB]); RTA_OK(i, rem); i = RTA_NEXT(i, rem)) -- br_print_mdb_entry(fp, r->ifindex, i); -+ br_print_mdb_entry(fp, r->ifindex, i, n); - } - - if (tb[MDBA_ROUTER]) { --- -1.8.3.1 - diff --git a/SOURCES/0051-iplink-add-support-for-IFLA_BR_VLAN_FILTERING-attrib.patch b/SOURCES/0051-iplink-add-support-for-IFLA_BR_VLAN_FILTERING-attrib.patch deleted file mode 100644 index 81afe82..0000000 --- a/SOURCES/0051-iplink-add-support-for-IFLA_BR_VLAN_FILTERING-attrib.patch +++ /dev/null @@ -1,73 +0,0 @@ -From da328c76f8d7942a1cd6a20976b2d6a7bbcf049c Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:11:51 +0100 -Subject: [PATCH] iplink: add support for IFLA_BR_VLAN_FILTERING attribute - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit e4d456f0bb83b - -commit e4d456f0bb83ba926c380da8b865f145ece3944f -Author: Nikolay Aleksandrov -Date: Wed Aug 12 09:19:06 2015 -0700 - - iplink: add support for IFLA_BR_VLAN_FILTERING attribute - - This patch implements support for the IFLA_BR_VLAN_FILTERING attribute - in iproute2 so it can enable/disable vlan_filtering. - - Example: - $ ip link set br0 type bridge vlan_filtering 1 - $ ip -d link show br0 - 6: br0: mtu 1500 qdisc noqueue state - UP mode DEFAULT group default - link/ether 08:00:27:ea:07:38 brd ff:ff:ff:ff:ff:ff promiscuity 0 - bridge forward_delay 1500 hello_time 200 max_age 2000 vlan_filtering 1 - addrgenmode eui64 - - Signed-off-by: Nikolay Aleksandrov ---- - ip/iplink_bridge.c | 14 ++++++++++++++ - 1 file changed, 14 insertions(+) - -diff --git a/ip/iplink_bridge.c b/ip/iplink_bridge.c -index e704e29..a8bc840 100644 ---- a/ip/iplink_bridge.c -+++ b/ip/iplink_bridge.c -@@ -26,6 +26,7 @@ static void print_explain(FILE *f) - " [ ageing_time AGEING_TIME ]\n" - " [ stp_state STP_STATE ]\n" - " [ priority PRIORITY ]\n" -+ " [ vlan_filtering VLAN_FILTERING ]\n" - ); - } - -@@ -84,6 +85,15 @@ static int bridge_parse_opt(struct link_util *lu, int argc, char **argv, - return -1; - } - addattr16(n, 1024, IFLA_BR_PRIORITY, prio); -+ } else if (matches(*argv, "vlan_filtering") == 0) { -+ __u8 vlan_filter; -+ -+ NEXT_ARG(); -+ if (get_u8(&vlan_filter, *argv, 0)) { -+ invarg("invalid vlan_filtering", *argv); -+ return -1; -+ } -+ addattr8(n, 1024, IFLA_BR_VLAN_FILTERING, vlan_filter); - } else if (matches(*argv, "help") == 0) { - explain(); - return -1; -@@ -126,6 +136,10 @@ static void bridge_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - if (tb[IFLA_BR_PRIORITY]) - fprintf(f, "priority %u ", - rta_getattr_u16(tb[IFLA_BR_PRIORITY])); -+ -+ if (tb[IFLA_BR_VLAN_FILTERING]) -+ fprintf(f, "vlan_filtering %u ", -+ rta_getattr_u8(tb[IFLA_BR_VLAN_FILTERING])); - } - - static void bridge_print_help(struct link_util *lu, int argc, char **argv, --- -1.8.3.1 - diff --git a/SOURCES/0052-iplink-Add-support-for-IFLA_BR_VLAN_PROTOCOL-attribu.patch b/SOURCES/0052-iplink-Add-support-for-IFLA_BR_VLAN_PROTOCOL-attribu.patch deleted file mode 100644 index 76c8aa9..0000000 --- a/SOURCES/0052-iplink-Add-support-for-IFLA_BR_VLAN_PROTOCOL-attribu.patch +++ /dev/null @@ -1,87 +0,0 @@ -From 3072b81b5f71121d587679f5644ccab0ed71da09 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:11:51 +0100 -Subject: [PATCH] iplink: Add support for IFLA_BR_VLAN_PROTOCOL attribute - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 1eea5c46ec59d - -commit 1eea5c46ec59d732d47df7f2be1e84fa534f9ce5 -Author: Toshiaki Makita -Date: Mon Aug 31 18:48:46 2015 +0900 - - iplink: Add support for IFLA_BR_VLAN_PROTOCOL attribute - - This patch adds support for bridge vlan_protocol. - - Example: - $ ip link set br0 type bridge vlan_protocol 802.1ad - $ ip -d link show br0 - 4: br0: mtu 1500 qdisc noqueue state - UP mode DEFAULT group default qlen 1000 - link/ether 44:37:e6:ab:cd:ef brd ff:ff:ff:ff:ff:ff promiscuity 0 - bridge forward_delay 0 hello_time 200 max_age 2000 ageing_time 30000 - stp_state 0 priority 32768 vlan_filtering 0 vlan_protocol 802.1ad - addrgenmode eui64 - - Signed-off-by: Toshiaki Makita ---- - ip/iplink_bridge.c | 21 +++++++++++++++++++++ - 1 file changed, 21 insertions(+) - -diff --git a/ip/iplink_bridge.c b/ip/iplink_bridge.c -index a8bc840..1c71f2e 100644 ---- a/ip/iplink_bridge.c -+++ b/ip/iplink_bridge.c -@@ -14,6 +14,7 @@ - #include - #include - -+#include "rt_names.h" - #include "utils.h" - #include "ip_common.h" - -@@ -27,6 +28,9 @@ static void print_explain(FILE *f) - " [ stp_state STP_STATE ]\n" - " [ priority PRIORITY ]\n" - " [ vlan_filtering VLAN_FILTERING ]\n" -+ " [ vlan_protocol VLAN_PROTOCOL ]\n" -+ "\n" -+ "Where: VLAN_PROTOCOL := { 802.1Q | 802.1ad }\n" - ); - } - -@@ -94,6 +98,15 @@ static int bridge_parse_opt(struct link_util *lu, int argc, char **argv, - return -1; - } - addattr8(n, 1024, IFLA_BR_VLAN_FILTERING, vlan_filter); -+ } else if (matches(*argv, "vlan_protocol") == 0) { -+ __u16 vlan_proto; -+ -+ NEXT_ARG(); -+ if (ll_proto_a2n(&vlan_proto, *argv)) { -+ invarg("invalid vlan_protocol", *argv); -+ return -1; -+ } -+ addattr16(n, 1024, IFLA_BR_VLAN_PROTOCOL, vlan_proto); - } else if (matches(*argv, "help") == 0) { - explain(); - return -1; -@@ -140,6 +153,14 @@ static void bridge_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - if (tb[IFLA_BR_VLAN_FILTERING]) - fprintf(f, "vlan_filtering %u ", - rta_getattr_u8(tb[IFLA_BR_VLAN_FILTERING])); -+ -+ if (tb[IFLA_BR_VLAN_PROTOCOL]) { -+ SPRINT_BUF(b1); -+ -+ fprintf(f, "vlan_protocol %s ", -+ ll_proto_n2a(rta_getattr_u16(tb[IFLA_BR_VLAN_PROTOCOL]), -+ b1, sizeof(b1))); -+ } - } - - static void bridge_print_help(struct link_util *lu, int argc, char **argv, --- -1.8.3.1 - diff --git a/SOURCES/0053-bridge-add-batch-command-support.patch b/SOURCES/0053-bridge-add-batch-command-support.patch deleted file mode 100644 index 2611093..0000000 --- a/SOURCES/0053-bridge-add-batch-command-support.patch +++ /dev/null @@ -1,162 +0,0 @@ -From 7f257cb3dd2966aee6fdfc128ab2cb001cc123da Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:11:51 +0100 -Subject: [PATCH] bridge: add batch command support - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 9de8c6d9765f2 - -commit 9de8c6d9765f284f8f15ccbe4af791259afe707e -Author: Wilson Kok -Date: Sun Oct 11 14:03:03 2015 -0700 - - bridge: add batch command support - - This patch adds support to batch bridge commands. - Follows ip batch code. - - Signed-off-by: Wilson Kok - Signed-off-by: Roopa Prabhu - Acked-by: Christophe Gouault ---- - bridge/bridge.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ - man/man8/bridge.8 | 11 +++++++++++ - 2 files changed, 70 insertions(+) - -diff --git a/bridge/bridge.c b/bridge/bridge.c -index eaf09c8..72f153f 100644 ---- a/bridge/bridge.c -+++ b/bridge/bridge.c -@@ -9,6 +9,7 @@ - #include - #include - #include -+#include - - #include "SNAPSHOT.h" - #include "utils.h" -@@ -23,6 +24,8 @@ int show_stats; - int show_details; - int compress_vlans; - int timestamp; -+char *batch_file; -+int force; - const char *_SL_; - - static void usage(void) __attribute__((noreturn)); -@@ -31,6 +34,7 @@ static void usage(void) - { - fprintf(stderr, - "Usage: bridge [ OPTIONS ] OBJECT { COMMAND | help }\n" -+" bridge [ -force ] -batch filename\n" - "where OBJECT := { link | fdb | mdb | vlan | monitor }\n" - " OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] |\n" - " -o[neline] | -t[imestamp] | -n[etns] name |\n" -@@ -71,6 +75,50 @@ static int do_cmd(const char *argv0, int argc, char **argv) - return -1; - } - -+static int batch(const char *name) -+{ -+ char *line = NULL; -+ size_t len = 0; -+ int ret = EXIT_SUCCESS; -+ -+ if (name && strcmp(name, "-") != 0) { -+ if (freopen(name, "r", stdin) == NULL) { -+ fprintf(stderr, -+ "Cannot open file \"%s\" for reading: %s\n", -+ name, strerror(errno)); -+ return EXIT_FAILURE; -+ } -+ } -+ -+ if (rtnl_open(&rth, 0) < 0) { -+ fprintf(stderr, "Cannot open rtnetlink\n"); -+ return EXIT_FAILURE; -+ } -+ -+ cmdlineno = 0; -+ while (getcmdline(&line, &len, stdin) != -1) { -+ char *largv[100]; -+ int largc; -+ -+ largc = makeargs(line, largv, 100); -+ if (largc == 0) -+ continue; /* blank line */ -+ -+ if (do_cmd(largv[0], largc, largv)) { -+ fprintf(stderr, "Command failed %s:%d\n", -+ name, cmdlineno); -+ ret = EXIT_FAILURE; -+ if (!force) -+ break; -+ } -+ } -+ if (line) -+ free(line); -+ -+ rtnl_close(&rth); -+ return ret; -+} -+ - int - main(int argc, char **argv) - { -@@ -123,6 +171,14 @@ main(int argc, char **argv) - exit(-1); - } else if (matches(opt, "-compressvlans") == 0) { - ++compress_vlans; -+ } else if (matches(opt, "-force") == 0) { -+ ++force; -+ } else if (matches(opt, "-batch") == 0) { -+ argc--; -+ argv++; -+ if (argc <= 1) -+ usage(); -+ batch_file = argv[1]; - } else { - fprintf(stderr, - "Option \"%s\" is unknown, try \"bridge help\".\n", -@@ -134,6 +190,9 @@ main(int argc, char **argv) - - _SL_ = oneline ? "\\" : "\n"; - -+ if (batch_file) -+ return batch(batch_file); -+ - if (rtnl_open(&rth, 0) < 0) - exit(1); - -diff --git a/man/man8/bridge.8 b/man/man8/bridge.8 -index 210a3ee..2f72710 100644 ---- a/man/man8/bridge.8 -+++ b/man/man8/bridge.8 -@@ -21,6 +21,7 @@ bridge \- show / manipulate bridge addresses and devices - \fB\-V\fR[\fIersion\fR] | - \fB\-s\fR[\fItatistics\fR] | - \fB\-n\fR[\fIetns\fR] name } -+\fB\-b\fR[\fIatch\fR] filename } - - .ti -8 - .BR "bridge link set" -@@ -137,6 +138,16 @@ to - .RI "-n[etns] " NETNS " [ " OPTIONS " ] " OBJECT " { " COMMAND " | " - .BR help " }" - -+.TP -+.BR "\-b", " \-batch " -+Read commands from provided file or standard input and invoke them. -+First failure will cause termination of bridge command. -+ -+.TP -+.BR "\-force" -+Don't terminate bridge command on errors in batch mode. -+If there were any errors during execution of the commands, the application -+return code will be non zero. - - .SH BRIDGE - COMMAND SYNTAX - --- -1.8.3.1 - diff --git a/SOURCES/0054-ip-bridge-document-timestamp-option.patch b/SOURCES/0054-ip-bridge-document-timestamp-option.patch deleted file mode 100644 index 3262e93..0000000 --- a/SOURCES/0054-ip-bridge-document-timestamp-option.patch +++ /dev/null @@ -1,54 +0,0 @@ -From dea6707510769d0fba936c1be868b123df9bb159 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:11:52 +0100 -Subject: [PATCH] ip, bridge: document -timestamp option - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 25bc3d3d4aac6 - -commit 25bc3d3d4aac6d0ab20a01d922b8e8ad6eb2232e -Author: Satish Ashok -Date: Mon Oct 12 09:28:55 2015 -0700 - - ip, bridge: document -timestamp option - - This patch documents bridge and ip -timestamp option - - Signed-off-by: Satish Ashok ---- - man/man8/bridge.8 | 3 +++ - man/man8/ip.8 | 4 ++++ - 2 files changed, 7 insertions(+) - -diff --git a/man/man8/bridge.8 b/man/man8/bridge.8 -index 2f72710..6cbf72b 100644 ---- a/man/man8/bridge.8 -+++ b/man/man8/bridge.8 -@@ -308,6 +308,9 @@ link setting is configured on specified physical device - .BI master - link setting is configured on the software bridge (default) - -+.TP -+.BR "\-t" , " \-timestamp" -+display current time when using monitor option. - - .SS bridge link show - list bridge port configuration. - -diff --git a/man/man8/ip.8 b/man/man8/ip.8 -index b1c0bc0..caaa1c1 100644 ---- a/man/man8/ip.8 -+++ b/man/man8/ip.8 -@@ -195,6 +195,10 @@ Set the netlink socket receive buffer size, defaults to 1MB. - .BR "\-iec" - print human readable rates in IEC units (e.g. 1Ki = 1024). - -+.TP -+.BR "\-t" , " \-timestamp" -+display current time when using monitor option. -+ - .SH IP - COMMAND SYNTAX - - .SS --- -1.8.3.1 - diff --git a/SOURCES/0055-bridge-add-calls-to-fflush-in-fdb-and-mdb-print-func.patch b/SOURCES/0055-bridge-add-calls-to-fflush-in-fdb-and-mdb-print-func.patch deleted file mode 100644 index 9c2bd42..0000000 --- a/SOURCES/0055-bridge-add-calls-to-fflush-in-fdb-and-mdb-print-func.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 284eed75d40124e365c49b3412441d31b9d70784 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:11:52 +0100 -Subject: [PATCH] bridge: add calls to fflush in fdb and mdb print functions - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 4d45bf3bafa69 - -commit 4d45bf3bafa6960720193dbf57042a3b43b73868 -Author: Wilson Kok -Date: Thu Oct 15 14:53:17 2015 -0700 - - bridge: add calls to fflush in fdb and mdb print functions - - This patch adds fflush in fdb and mdb print functions - - Signed-off-by: Wilson Kok - Signed-off-by: Roopa Prabhu ---- - bridge/fdb.c | 2 ++ - bridge/mdb.c | 2 ++ - 2 files changed, 4 insertions(+) - -diff --git a/bridge/fdb.c b/bridge/fdb.c -index edf621c..8a706d8 100644 ---- a/bridge/fdb.c -+++ b/bridge/fdb.c -@@ -162,6 +162,8 @@ int print_fdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - fprintf(fp, "offload "); - - fprintf(fp, "%s\n", state_n2a(r->ndm_state)); -+ fflush(fp); -+ - return 0; - } - -diff --git a/bridge/mdb.c b/bridge/mdb.c -index b14bd01..24c4903 100644 ---- a/bridge/mdb.c -+++ b/bridge/mdb.c -@@ -135,6 +135,8 @@ int print_mdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - } - } - -+ fflush(fp); -+ - return 0; - } - --- -1.8.3.1 - diff --git a/SOURCES/0056-bridge-fdb-minor-syntax-fix-in-help-text.patch b/SOURCES/0056-bridge-fdb-minor-syntax-fix-in-help-text.patch deleted file mode 100644 index 680b755..0000000 --- a/SOURCES/0056-bridge-fdb-minor-syntax-fix-in-help-text.patch +++ /dev/null @@ -1,39 +0,0 @@ -From d9e8a0597c658e7b33856b3f4621b253de72d923 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:11:52 +0100 -Subject: [PATCH] bridge: fdb: minor syntax fix in help text - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit bd5bbad450079 - -commit bd5bbad45007937758ec1339f2612049ce7187d7 -Author: Phil Sutter -Date: Thu Oct 29 10:55:24 2015 +0100 - - bridge: fdb: minor syntax fix in help text ---- - bridge/fdb.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/bridge/fdb.c b/bridge/fdb.c -index 8a706d8..8767c96 100644 ---- a/bridge/fdb.c -+++ b/bridge/fdb.c -@@ -30,11 +30,11 @@ static unsigned int filter_index; - - static void usage(void) - { -- fprintf(stderr, "Usage: bridge fdb { add | append | del | replace ADDR dev DEV\n" -+ fprintf(stderr, "Usage: bridge fdb { add | append | del | replace } ADDR dev DEV\n" - " [ self ] [ master ] [ use ] [ router ]\n" - " [ local | temp ] [ dst IPADDR ] [ vlan VID ]\n" -- " [ port PORT] [ vni VNI ] [via DEV]\n"); -- fprintf(stderr, " bridge fdb {show} [ br BRDEV ] [ brport DEV ]\n"); -+ " [ port PORT] [ vni VNI ] [ via DEV ]\n"); -+ fprintf(stderr, " bridge fdb [ show [ br BRDEV ] [ brport DEV ] ]\n"); - exit(-1); - } - --- -1.8.3.1 - diff --git a/SOURCES/0057-bridge.8-document-fdb-replace-command.patch b/SOURCES/0057-bridge.8-document-fdb-replace-command.patch deleted file mode 100644 index 962de57..0000000 --- a/SOURCES/0057-bridge.8-document-fdb-replace-command.patch +++ /dev/null @@ -1,52 +0,0 @@ -From e8d0fdaf5f409584b9ff6110d294ddd783aeb3d2 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:11:59 +0100 -Subject: [PATCH] bridge.8: document fdb replace command - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 6e2e2cf03a2fe - -commit 6e2e2cf03a2fe5777ee75e943444a343756042c0 -Author: Phil Sutter -Date: Wed Nov 18 12:46:42 2015 +0100 - - bridge.8: document fdb replace command - - Despite commit 45a82e5 ("iproute vxlan add support for fdb replace - command"), the 'fdb replace' command was not mentioned in bridge.8. - - Signed-off-by: Phil Sutter ---- - man/man8/bridge.8 | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - -diff --git a/man/man8/bridge.8 b/man/man8/bridge.8 -index 6cbf72b..38f7b8b 100644 ---- a/man/man8/bridge.8 -+++ b/man/man8/bridge.8 -@@ -50,7 +50,7 @@ bridge \- show / manipulate bridge addresses and devices - .IR DEV " ]" - - .ti -8 --.BR "bridge fdb" " { " add " | " append " | " del " } " -+.BR "bridge fdb" " { " add " | " append " | " del " | " replace " } " - .I LLADDR - .B dev - .IR DEV " { " -@@ -407,6 +407,13 @@ This command removes an existing fdb entry. - The arguments are the same as with - .BR "bridge fdb add" , - -+.SS bridge fdb replace - replace a forwarding database entry -+If no matching entry is found, a new one will be created instead. -+ -+.PP -+The arguments are the same as with -+.BR "bridge fdb add" , -+ - .SS bridge fdb show - list forwarding entries. - - This command displays the current forwarding table. --- -1.8.3.1 - diff --git a/SOURCES/0058-bridge.8-minor-formatting-cleanup.patch b/SOURCES/0058-bridge.8-minor-formatting-cleanup.patch deleted file mode 100644 index 815ee82..0000000 --- a/SOURCES/0058-bridge.8-minor-formatting-cleanup.patch +++ /dev/null @@ -1,170 +0,0 @@ -From f68083e618f8450858815dadd541eff0d20eb6e2 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:11:59 +0100 -Subject: [PATCH] bridge.8: minor formatting cleanup - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit fc31817d1f2ee - -commit fc31817d1f2ee8098b875a8b122f136a7564e339 -Author: Phil Sutter -Date: Tue Nov 24 15:50:00 2015 +0100 - - bridge.8: minor formatting cleanup - - - Replace commas at end of subsection with dots. - - Replace double whitespace by single one. - - Signed-off-by: Phil Sutter ---- - man/man8/bridge.8 | 46 +++++++++++++++++++++++----------------------- - 1 file changed, 23 insertions(+), 23 deletions(-) - -diff --git a/man/man8/bridge.8 b/man/man8/bridge.8 -index 38f7b8b..864f983 100644 ---- a/man/man8/bridge.8 -+++ b/man/man8/bridge.8 -@@ -25,14 +25,14 @@ bridge \- show / manipulate bridge addresses and devices - - .ti -8 - .BR "bridge link set" --.B dev -+.B dev - .IR DEV - .IR " [ " --.B cost -+.B cost - .IR COST " ] [ " --.B priority --.IR PRIO " ] [ " --.B state -+.B priority -+.IR PRIO " ] [ " -+.B state - .IR STATE "] [" - .BR guard " { " on " | " off " } ] [ " - .BR hairpin " { " on " | " off " } ] [ " -@@ -42,21 +42,21 @@ bridge \- show / manipulate bridge addresses and devices - .BR learning_sync " { " on " | " off " } ] [ " - .BR flood " { " on " | " off " } ] [ " - .BR hwmode " { " vepa " | " veb " } ] [ " --.BR self " ] [ " master " ] " -+.BR self " ] [ " master " ] " - - .ti -8 - .BR "bridge link" " [ " show " ] [ " --.B dev -+.B dev - .IR DEV " ]" - - .ti -8 - .BR "bridge fdb" " { " add " | " append " | " del " | " replace " } " - .I LLADDR --.B dev -+.B dev - .IR DEV " { " - .BR local " | " temp " } [ " - .BR self " ] [ " master " ] [ " router " ] [ " use " ] [ " --.B dst -+.B dst - .IR IPADDR " ] [ " - .B vni - .IR VNI " ] [" -@@ -67,12 +67,12 @@ bridge \- show / manipulate bridge addresses and devices - - .ti -8 - .BR "bridge fdb" " [ " show " ] [ " --.B dev -+.B dev - .IR DEV " ]" - - .ti -8 - .BR "bridge mdb" " { " add " | " del " } " --.B dev -+.B dev - .IR DEV - .B port - .IR PORT -@@ -84,21 +84,21 @@ bridge \- show / manipulate bridge addresses and devices - - .ti -8 - .BR "bridge mdb show " [ " --.B dev -+.B dev - .IR DEV " ]" - - .ti -8 - .BR "bridge vlan" " { " add " | " del " } " --.B dev -+.B dev - .IR DEV --.B vid -+.B vid - .IR VID " [ " --.BR pvid " ] [ " untagged " ] [ " --.BR self " ] [ " master " ] " -+.BR pvid " ] [ " untagged " ] [ " -+.BR self " ] [ " master " ] " - - .ti -8 - .BR "bridge vlan" " [ " show " ] [ " --.B dev -+.B dev - .IR DEV " ]" - - .ti -8 -@@ -319,7 +319,7 @@ This command displays the current bridge port configuration and flags. - .SH bridge fdb - forwarding database management - - .B fdb --objects contain known Ethernet addresses on a link. -+objects contain known Ethernet addresses on a link. - - .P - The corresponding commands display fdb entries, add new entries, -@@ -398,21 +398,21 @@ sends a copy of the data packet to each entry found. - - .PP - The arguments are the same as with --.BR "bridge fdb add" , -+.BR "bridge fdb add" . - - .SS bridge fdb delete - delete a forwarding database entry - This command removes an existing fdb entry. - - .PP - The arguments are the same as with --.BR "bridge fdb add" , -+.BR "bridge fdb add" . - - .SS bridge fdb replace - replace a forwarding database entry - If no matching entry is found, a new one will be created instead. - - .PP - The arguments are the same as with --.BR "bridge fdb add" , -+.BR "bridge fdb add" . - - .SS bridge fdb show - list forwarding entries. - -@@ -548,7 +548,7 @@ This command displays the current VLAN filter table. - - The - .B bridge --utility can monitor the state of devices and addresses -+utility can monitor the state of devices and addresses - continuously. This option has a slightly different format. - Namely, the - .B monitor -@@ -560,7 +560,7 @@ command is the first in the command line and then the object list follows: - .I OBJECT-LIST - is the list of object types that we want to monitor. - It may contain --.BR link ", " fdb ", and " mdb "." -+.BR link ", " fdb ", and " mdb "." - If no - .B file - argument is given, --- -1.8.3.1 - diff --git a/SOURCES/0059-bridge-support-for-static-fdb-entries.patch b/SOURCES/0059-bridge-support-for-static-fdb-entries.patch deleted file mode 100644 index 408b800..0000000 --- a/SOURCES/0059-bridge-support-for-static-fdb-entries.patch +++ /dev/null @@ -1,80 +0,0 @@ -From 6c0e3f0160da03f50871e2e3692e3168f8c2a62b Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:12:00 +0100 -Subject: [PATCH] bridge: support for static fdb entries - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit a1987cd17fcb0 - -commit a1987cd17fcb042bd80f0dc2bf51941769fdb493 -Author: Roopa Prabhu -Date: Wed Jan 27 09:09:37 2016 -0800 - - bridge: support for static fdb entries - - There is no intuitive option to add static fdb entries today. - 'temp' seems to have a side effect of adding - 'static' fdb entries. But the name and intent - of 'temp' does not say anything about it being static. - - example: - bridge fdb add operates as follows: - - $bridge fdb add 00:01:02:03:04:05 dev eth0 master - $bridge fdb add 00:01:02:03:04:06 dev eth0 master temp - $bridge fdb add 00:01:02:03:04:07 dev eth0 master local - - $bridge fdb show - 00:01:02:03:04:05 dev eth0 permanent - 00:01:02:03:04:06 dev eth0 static - 00:01:02:03:04:07 dev eth0 permanent - 00:01:02:03:04:08 dev eth0 <<== dynamic, ageable learned mac - - This patch adds a new bridge fdb type 'static' which - makes sure NUD_NOARP and NUD_REACHABLE is set for static - entries. This effectively is nothing but what 'temp' - does today. But the name 'temp' is misleading. - - After the patch: - $bridge fdb add 00:01:02:03:04:06 dev eth0 master static - - $bridge fdb show - 00:01:02:03:04:06 dev eth0 static - - 'temp' could ideally be a dynamic mac that can age (ie just - NUD_REACHABLE). But, 'temp' sets 'NUD_NOARP' and 'NUD_REACHABLE'. - Too late to change 'temp' now. But, we are thinking of introduing a - 'dynamic' keyword after this patch that only sets NUD_REACHABLE. - - Signed-off-by: Wilson Kok - Signed-off-by: Roopa Prabhu ---- - bridge/fdb.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/bridge/fdb.c b/bridge/fdb.c -index 8767c96..cb07345 100644 ---- a/bridge/fdb.c -+++ b/bridge/fdb.c -@@ -32,7 +32,7 @@ static void usage(void) - { - fprintf(stderr, "Usage: bridge fdb { add | append | del | replace } ADDR dev DEV\n" - " [ self ] [ master ] [ use ] [ router ]\n" -- " [ local | temp ] [ dst IPADDR ] [ vlan VID ]\n" -+ " [ local | temp | static ] [ dst IPADDR ] [ vlan VID ]\n" - " [ port PORT] [ vni VNI ] [ via DEV ]\n"); - fprintf(stderr, " bridge fdb [ show [ br BRDEV ] [ brport DEV ] ]\n"); - exit(-1); -@@ -300,7 +300,8 @@ static int fdb_modify(int cmd, int flags, int argc, char **argv) - } else if (matches(*argv, "local") == 0|| - matches(*argv, "permanent") == 0) { - req.ndm.ndm_state |= NUD_PERMANENT; -- } else if (matches(*argv, "temp") == 0) { -+ } else if (matches(*argv, "temp") == 0 || -+ matches(*argv, "static") == 0) { - req.ndm.ndm_state |= NUD_REACHABLE; - } else if (matches(*argv, "vlan") == 0) { - if (vid >= 0) --- -1.8.3.1 - diff --git a/SOURCES/0060-iplink-bridge-export-bridge_id-and-designated_root.patch b/SOURCES/0060-iplink-bridge-export-bridge_id-and-designated_root.patch deleted file mode 100644 index 46a399a..0000000 --- a/SOURCES/0060-iplink-bridge-export-bridge_id-and-designated_root.patch +++ /dev/null @@ -1,76 +0,0 @@ -From e356155477080e21d9c443fc963b7019bbc579ca Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:12:00 +0100 -Subject: [PATCH] iplink: bridge: export bridge_id and designated_root - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 70dfb0b8836d8 - -commit 70dfb0b8836d8fb17009b5473b14f4bc470cb68d -Author: Nikolay Aleksandrov -Date: Tue Feb 9 00:14:19 2016 +0100 - - iplink: bridge: export bridge_id and designated_root - - Netlink returns the bridge_id and designated_root, we just need to - make them visible. - - Signed-off-by: Nikolay Aleksandrov ---- - ip/iplink_bridge.c | 26 ++++++++++++++++++++++++++ - 1 file changed, 26 insertions(+) - -diff --git a/ip/iplink_bridge.c b/ip/iplink_bridge.c -index 1c71f2e..050afaa 100644 ---- a/ip/iplink_bridge.c -+++ b/ip/iplink_bridge.c -@@ -13,6 +13,7 @@ - #include - #include - #include -+#include - - #include "rt_names.h" - #include "utils.h" -@@ -39,6 +40,15 @@ static void explain(void) - print_explain(stderr); - } - -+static void br_dump_bridge_id(const struct ifla_bridge_id *id, char *buf, -+ size_t len) -+{ -+ char eaddr[32]; -+ -+ ether_ntoa_r((const struct ether_addr *)id->addr, eaddr); -+ snprintf(buf, len, "%.2x%.2x.%s", id->prio[0], id->prio[1], eaddr); -+} -+ - static int bridge_parse_opt(struct link_util *lu, int argc, char **argv, - struct nlmsghdr *n) - { -@@ -161,6 +171,22 @@ static void bridge_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - ll_proto_n2a(rta_getattr_u16(tb[IFLA_BR_VLAN_PROTOCOL]), - b1, sizeof(b1))); - } -+ -+ if (tb[IFLA_BR_BRIDGE_ID]) { -+ char bridge_id[32]; -+ -+ br_dump_bridge_id(RTA_DATA(tb[IFLA_BR_BRIDGE_ID]), bridge_id, -+ sizeof(bridge_id)); -+ fprintf(f, "bridge_id %s ", bridge_id); -+ } -+ -+ if (tb[IFLA_BR_ROOT_ID]) { -+ char root_id[32]; -+ -+ br_dump_bridge_id(RTA_DATA(tb[IFLA_BR_BRIDGE_ID]), root_id, -+ sizeof(root_id)); -+ fprintf(f, "designated_root %s ", root_id); -+ } - } - - static void bridge_print_help(struct link_util *lu, int argc, char **argv, --- -1.8.3.1 - diff --git a/SOURCES/0061-iplink-bridge-export-root_-port-path_cost-topology_c.patch b/SOURCES/0061-iplink-bridge-export-root_-port-path_cost-topology_c.patch deleted file mode 100644 index 1d48064..0000000 --- a/SOURCES/0061-iplink-bridge-export-root_-port-path_cost-topology_c.patch +++ /dev/null @@ -1,52 +0,0 @@ -From abf463728db5643a88cf212f7ff6937ae888674c Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:12:00 +0100 -Subject: [PATCH] iplink: bridge: export root_(port|path_cost), topology_change - and change_detected - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 4e3bbc66580fc - -commit 4e3bbc66580fc7249217df9e0ef18cbb50876561 -Author: Nikolay Aleksandrov -Date: Tue Feb 9 00:14:20 2016 +0100 - - iplink: bridge: export root_(port|path_cost), topology_change and change_detected - - Netlink already export these values, we just need to make them visible. - - Signed-off-by: Nikolay Aleksandrov ---- - ip/iplink_bridge.c | 16 ++++++++++++++++ - 1 file changed, 16 insertions(+) - -diff --git a/ip/iplink_bridge.c b/ip/iplink_bridge.c -index 050afaa..bf6cb71 100644 ---- a/ip/iplink_bridge.c -+++ b/ip/iplink_bridge.c -@@ -187,6 +187,22 @@ static void bridge_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - sizeof(root_id)); - fprintf(f, "designated_root %s ", root_id); - } -+ -+ if (tb[IFLA_BR_ROOT_PORT]) -+ fprintf(f, "root_port %u ", -+ rta_getattr_u16(tb[IFLA_BR_ROOT_PORT])); -+ -+ if (tb[IFLA_BR_ROOT_PATH_COST]) -+ fprintf(f, "root_path_cost %u ", -+ rta_getattr_u32(tb[IFLA_BR_ROOT_PATH_COST])); -+ -+ if (tb[IFLA_BR_TOPOLOGY_CHANGE]) -+ fprintf(f, "topology_change %u ", -+ rta_getattr_u8(tb[IFLA_BR_TOPOLOGY_CHANGE])); -+ -+ if (tb[IFLA_BR_TOPOLOGY_CHANGE_DETECTED]) -+ fprintf(f, "topology_change_detected %u ", -+ rta_getattr_u8(tb[IFLA_BR_TOPOLOGY_CHANGE_DETECTED])); - } - - static void bridge_print_help(struct link_util *lu, int argc, char **argv, --- -1.8.3.1 - diff --git a/SOURCES/0062-iplink-bridge-export-read-only-timers.patch b/SOURCES/0062-iplink-bridge-export-read-only-timers.patch deleted file mode 100644 index 1ffc114..0000000 --- a/SOURCES/0062-iplink-bridge-export-read-only-timers.patch +++ /dev/null @@ -1,100 +0,0 @@ -From 58d4d6459347811ef8d75826221f94b3f56b824a Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:12:00 +0100 -Subject: [PATCH] iplink: bridge: export read-only timers - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 8c0f7a16305f8 - -commit 8c0f7a16305f86baaefe16050139a03b1f3b24ee -Author: Nikolay Aleksandrov -Date: Tue Feb 9 00:14:21 2016 +0100 - - iplink: bridge: export read-only timers - - Netlink already provides hello_timer, tcn_timer, topology_change_timer - and gc_timer, so let's make them visible. - - Signed-off-by: Nikolay Aleksandrov ---- - include/utils.h | 18 ++++++++++++++++++ - ip/iplink_bridge.c | 34 ++++++++++++++++++++++++++++++++++ - 2 files changed, 52 insertions(+) - -diff --git a/include/utils.h b/include/utils.h -index 22198cb..9839d9d 100644 ---- a/include/utils.h -+++ b/include/utils.h -@@ -159,6 +159,24 @@ static inline __u32 nl_mgrp(__u32 group) - return group ? (1 << (group - 1)) : 0; - } - -+/* courtesy of bridge-utils */ -+static inline unsigned long __tv_to_jiffies(const struct timeval *tv) -+{ -+ unsigned long long jif; -+ -+ jif = 1000000ULL * tv->tv_sec + tv->tv_usec; -+ -+ return jif/10000; -+} -+ -+static inline void __jiffies_to_tv(struct timeval *tv, unsigned long jiffies) -+{ -+ unsigned long long tvusec; -+ -+ tvusec = 10000ULL*jiffies; -+ tv->tv_sec = tvusec/1000000; -+ tv->tv_usec = tvusec - 1000000 * tv->tv_sec; -+} - - int print_timestamp(FILE *fp); - -diff --git a/ip/iplink_bridge.c b/ip/iplink_bridge.c -index bf6cb71..2bd3182 100644 ---- a/ip/iplink_bridge.c -+++ b/ip/iplink_bridge.c -@@ -203,6 +203,40 @@ static void bridge_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - if (tb[IFLA_BR_TOPOLOGY_CHANGE_DETECTED]) - fprintf(f, "topology_change_detected %u ", - rta_getattr_u8(tb[IFLA_BR_TOPOLOGY_CHANGE_DETECTED])); -+ -+ if (tb[IFLA_BR_HELLO_TIMER]) { -+ struct timeval tv; -+ -+ __jiffies_to_tv(&tv, rta_getattr_u64(tb[IFLA_BR_HELLO_TIMER])); -+ fprintf(f, "hello_timer %4i.%.2i ", (int)tv.tv_sec, -+ (int)tv.tv_usec/10000); -+ } -+ -+ if (tb[IFLA_BR_TCN_TIMER]) { -+ struct timeval tv; -+ -+ __jiffies_to_tv(&tv, rta_getattr_u64(tb[IFLA_BR_TCN_TIMER])); -+ fprintf(f, "tcn_timer %4i.%.2i ", (int)tv.tv_sec, -+ (int)tv.tv_usec/10000); -+ } -+ -+ if (tb[IFLA_BR_TOPOLOGY_CHANGE_TIMER]) { -+ unsigned long jiffies; -+ struct timeval tv; -+ -+ jiffies = rta_getattr_u64(tb[IFLA_BR_TOPOLOGY_CHANGE_TIMER]); -+ __jiffies_to_tv(&tv, jiffies); -+ fprintf(f, "topology_change_timer %4i.%.2i ", (int)tv.tv_sec, -+ (int)tv.tv_usec/10000); -+ } -+ -+ if (tb[IFLA_BR_GC_TIMER]) { -+ struct timeval tv; -+ -+ __jiffies_to_tv(&tv, rta_getattr_u64(tb[IFLA_BR_GC_TIMER])); -+ fprintf(f, "gc_timer %4i.%.2i ", (int)tv.tv_sec, -+ (int)tv.tv_usec/10000); -+ } - } - - static void bridge_print_help(struct link_util *lu, int argc, char **argv, --- -1.8.3.1 - diff --git a/SOURCES/0063-iplink-bridge-add-support-for-IFLA_BR_GROUP_FWD_MASK.patch b/SOURCES/0063-iplink-bridge-add-support-for-IFLA_BR_GROUP_FWD_MASK.patch deleted file mode 100644 index cbb1cea..0000000 --- a/SOURCES/0063-iplink-bridge-add-support-for-IFLA_BR_GROUP_FWD_MASK.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 5eacb8e1529a21a32cb45d58fdb1d8c3d562aea0 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:12:00 +0100 -Subject: [PATCH] iplink: bridge: add support for IFLA_BR_GROUP_FWD_MASK - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 8caaf33bdb61d - -commit 8caaf33bdb61d8bc55db4445fd81e098777e8014 -Author: Nikolay Aleksandrov -Date: Tue Feb 9 00:14:22 2016 +0100 - - iplink: bridge: add support for IFLA_BR_GROUP_FWD_MASK - - This patch implements support for the IFLA_BR_GROUP_FWD_MASK attribute - in iproute2 so it can change the group forwarding mask. - - Signed-off-by: Nikolay Aleksandrov ---- - ip/iplink_bridge.c | 13 +++++++++++++ - 1 file changed, 13 insertions(+) - -diff --git a/ip/iplink_bridge.c b/ip/iplink_bridge.c -index 2bd3182..77d4ee1 100644 ---- a/ip/iplink_bridge.c -+++ b/ip/iplink_bridge.c -@@ -28,6 +28,7 @@ static void print_explain(FILE *f) - " [ ageing_time AGEING_TIME ]\n" - " [ stp_state STP_STATE ]\n" - " [ priority PRIORITY ]\n" -+ " [ group_fwd_mask MASK ]\n" - " [ vlan_filtering VLAN_FILTERING ]\n" - " [ vlan_protocol VLAN_PROTOCOL ]\n" - "\n" -@@ -117,6 +118,14 @@ static int bridge_parse_opt(struct link_util *lu, int argc, char **argv, - return -1; - } - addattr16(n, 1024, IFLA_BR_VLAN_PROTOCOL, vlan_proto); -+ } else if (matches(*argv, "group_fwd_mask") == 0) { -+ __u16 fwd_mask; -+ -+ NEXT_ARG(); -+ if (get_u16(&fwd_mask, *argv, 0)) -+ invarg("invalid group_fwd_mask", *argv); -+ -+ addattr16(n, 1024, IFLA_BR_GROUP_FWD_MASK, fwd_mask); - } else if (matches(*argv, "help") == 0) { - explain(); - return -1; -@@ -237,6 +246,10 @@ static void bridge_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - fprintf(f, "gc_timer %4i.%.2i ", (int)tv.tv_sec, - (int)tv.tv_usec/10000); - } -+ -+ if (tb[IFLA_BR_GROUP_FWD_MASK]) -+ fprintf(f, "group_fwd_mask %#x ", -+ rta_getattr_u16(tb[IFLA_BR_GROUP_FWD_MASK])); - } - - static void bridge_print_help(struct link_util *lu, int argc, char **argv, --- -1.8.3.1 - diff --git a/SOURCES/0064-iplink-bridge-add-support-for-IFLA_BR_GROUP_ADDR.patch b/SOURCES/0064-iplink-bridge-add-support-for-IFLA_BR_GROUP_ADDR.patch deleted file mode 100644 index cb05396..0000000 --- a/SOURCES/0064-iplink-bridge-add-support-for-IFLA_BR_GROUP_ADDR.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 070419b6c1eec0a88a464bcfcd8a3a3755f19ffc Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:12:00 +0100 -Subject: [PATCH] iplink: bridge: add support for IFLA_BR_GROUP_ADDR - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 0a61aa3963e25 - -commit 0a61aa3963e25a32e82cad8cdd04f31532ec5b3f -Author: Nikolay Aleksandrov -Date: Tue Feb 9 00:14:23 2016 +0100 - - iplink: bridge: add support for IFLA_BR_GROUP_ADDR - - This patch implements support for the IFLA_BR_GROUP_ADDR attribute - in iproute2 so it can change the group address. - - Signed-off-by: Nikolay Aleksandrov ---- - ip/iplink_bridge.c | 19 +++++++++++++++++++ - 1 file changed, 19 insertions(+) - -diff --git a/ip/iplink_bridge.c b/ip/iplink_bridge.c -index 77d4ee1..6ef6c4b 100644 ---- a/ip/iplink_bridge.c -+++ b/ip/iplink_bridge.c -@@ -29,6 +29,7 @@ static void print_explain(FILE *f) - " [ stp_state STP_STATE ]\n" - " [ priority PRIORITY ]\n" - " [ group_fwd_mask MASK ]\n" -+ " [ group_address ADDRESS ]\n" - " [ vlan_filtering VLAN_FILTERING ]\n" - " [ vlan_protocol VLAN_PROTOCOL ]\n" - "\n" -@@ -126,6 +127,15 @@ static int bridge_parse_opt(struct link_util *lu, int argc, char **argv, - invarg("invalid group_fwd_mask", *argv); - - addattr16(n, 1024, IFLA_BR_GROUP_FWD_MASK, fwd_mask); -+ } else if (matches(*argv, "group_address") == 0) { -+ char llabuf[32]; -+ int len; -+ -+ NEXT_ARG(); -+ len = ll_addr_a2n(llabuf, sizeof(llabuf), *argv); -+ if (len < 0) -+ return -1; -+ addattr_l(n, 1024, IFLA_BR_GROUP_ADDR, llabuf, len); - } else if (matches(*argv, "help") == 0) { - explain(); - return -1; -@@ -250,6 +260,15 @@ static void bridge_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - if (tb[IFLA_BR_GROUP_FWD_MASK]) - fprintf(f, "group_fwd_mask %#x ", - rta_getattr_u16(tb[IFLA_BR_GROUP_FWD_MASK])); -+ -+ if (tb[IFLA_BR_GROUP_ADDR]) { -+ SPRINT_BUF(mac); -+ -+ fprintf(f, "group_address %s ", -+ ll_addr_n2a(RTA_DATA(tb[IFLA_BR_GROUP_ADDR]), -+ RTA_PAYLOAD(tb[IFLA_BR_GROUP_ADDR]), -+ 1 /*ARPHDR_ETHER*/, mac, sizeof(mac))); -+ } - } - - static void bridge_print_help(struct link_util *lu, int argc, char **argv, --- -1.8.3.1 - diff --git a/SOURCES/0065-iplink-bridge-add-support-for-IFLA_BR_VLAN_DEFAULT_P.patch b/SOURCES/0065-iplink-bridge-add-support-for-IFLA_BR_VLAN_DEFAULT_P.patch deleted file mode 100644 index e01b302..0000000 --- a/SOURCES/0065-iplink-bridge-add-support-for-IFLA_BR_VLAN_DEFAULT_P.patch +++ /dev/null @@ -1,64 +0,0 @@ -From f4ee3de83773cd4b84c2ffe3639c2f9558005c23 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:12:00 +0100 -Subject: [PATCH] iplink: bridge: add support for IFLA_BR_VLAN_DEFAULT_PVID - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 719832af6c862 - -commit 719832af6c862a04247f28c73b72bf0eea4c7984 -Author: Nikolay Aleksandrov -Date: Tue Feb 9 00:14:24 2016 +0100 - - iplink: bridge: add support for IFLA_BR_VLAN_DEFAULT_PVID - - This patch implements support for the IFLA_BR_VLAN_DEFAULT_PVID - attribute in iproute2 so it can change the default pvid. - - Signed-off-by: Nikolay Aleksandrov ---- - ip/iplink_bridge.c | 14 ++++++++++++++ - 1 file changed, 14 insertions(+) - -diff --git a/ip/iplink_bridge.c b/ip/iplink_bridge.c -index 6ef6c4b..da3a063 100644 ---- a/ip/iplink_bridge.c -+++ b/ip/iplink_bridge.c -@@ -32,6 +32,7 @@ static void print_explain(FILE *f) - " [ group_address ADDRESS ]\n" - " [ vlan_filtering VLAN_FILTERING ]\n" - " [ vlan_protocol VLAN_PROTOCOL ]\n" -+ " [ vlan_default_pvid VLAN_DEFAULT_PVID ]\n" - "\n" - "Where: VLAN_PROTOCOL := { 802.1Q | 802.1ad }\n" - ); -@@ -136,6 +137,15 @@ static int bridge_parse_opt(struct link_util *lu, int argc, char **argv, - if (len < 0) - return -1; - addattr_l(n, 1024, IFLA_BR_GROUP_ADDR, llabuf, len); -+ } else if (matches(*argv, "vlan_default_pvid") == 0) { -+ __u16 default_pvid; -+ -+ NEXT_ARG(); -+ if (get_u16(&default_pvid, *argv, 0)) -+ invarg("invalid vlan_default_pvid", *argv); -+ -+ addattr16(n, 1024, IFLA_BR_VLAN_DEFAULT_PVID, -+ default_pvid); - } else if (matches(*argv, "help") == 0) { - explain(); - return -1; -@@ -257,6 +267,10 @@ static void bridge_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - (int)tv.tv_usec/10000); - } - -+ if (tb[IFLA_BR_VLAN_DEFAULT_PVID]) -+ fprintf(f, "vlan_default_pvid %u ", -+ rta_getattr_u16(tb[IFLA_BR_VLAN_DEFAULT_PVID])); -+ - if (tb[IFLA_BR_GROUP_FWD_MASK]) - fprintf(f, "group_fwd_mask %#x ", - rta_getattr_u16(tb[IFLA_BR_GROUP_FWD_MASK])); --- -1.8.3.1 - diff --git a/SOURCES/0066-iplink-bridge-add-support-for-IFLA_BR_MCAST_ROUTER.patch b/SOURCES/0066-iplink-bridge-add-support-for-IFLA_BR_MCAST_ROUTER.patch deleted file mode 100644 index f9882d4..0000000 --- a/SOURCES/0066-iplink-bridge-add-support-for-IFLA_BR_MCAST_ROUTER.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 8cb947c8168fdbe1d63fbf9dc6945ce8f17eb6d3 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:12:00 +0100 -Subject: [PATCH] iplink: bridge: add support for IFLA_BR_MCAST_ROUTER - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 963d137cf927c - -commit 963d137cf927c4d323cf77fb30c3695feff5367b -Author: Nikolay Aleksandrov -Date: Tue Feb 9 00:14:25 2016 +0100 - - iplink: bridge: add support for IFLA_BR_MCAST_ROUTER - - This patch implements support for the IFLA_BR_MCAST_ROUTER attribute - in iproute2 so it can change the multicast router value. - - Signed-off-by: Nikolay Aleksandrov ---- - ip/iplink_bridge.c | 13 +++++++++++++ - 1 file changed, 13 insertions(+) - -diff --git a/ip/iplink_bridge.c b/ip/iplink_bridge.c -index da3a063..7c2165c 100644 ---- a/ip/iplink_bridge.c -+++ b/ip/iplink_bridge.c -@@ -33,6 +33,7 @@ static void print_explain(FILE *f) - " [ vlan_filtering VLAN_FILTERING ]\n" - " [ vlan_protocol VLAN_PROTOCOL ]\n" - " [ vlan_default_pvid VLAN_DEFAULT_PVID ]\n" -+ " [ mcast_router MULTICAST_ROUTER ]\n" - "\n" - "Where: VLAN_PROTOCOL := { 802.1Q | 802.1ad }\n" - ); -@@ -146,6 +147,14 @@ static int bridge_parse_opt(struct link_util *lu, int argc, char **argv, - - addattr16(n, 1024, IFLA_BR_VLAN_DEFAULT_PVID, - default_pvid); -+ } else if (matches(*argv, "mcast_router") == 0) { -+ __u8 mcast_router; -+ -+ NEXT_ARG(); -+ if (get_u8(&mcast_router, *argv, 0)) -+ invarg("invalid mcast_router", *argv); -+ -+ addattr8(n, 1024, IFLA_BR_MCAST_ROUTER, mcast_router); - } else if (matches(*argv, "help") == 0) { - explain(); - return -1; -@@ -283,6 +292,10 @@ static void bridge_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - RTA_PAYLOAD(tb[IFLA_BR_GROUP_ADDR]), - 1 /*ARPHDR_ETHER*/, mac, sizeof(mac))); - } -+ -+ if (tb[IFLA_BR_MCAST_ROUTER]) -+ fprintf(f, "mcast_router %u ", -+ rta_getattr_u8(tb[IFLA_BR_MCAST_ROUTER])); - } - - static void bridge_print_help(struct link_util *lu, int argc, char **argv, --- -1.8.3.1 - diff --git a/SOURCES/0067-iplink-bridge-add-support-for-IFLA_BR_MCAST_SNOOPING.patch b/SOURCES/0067-iplink-bridge-add-support-for-IFLA_BR_MCAST_SNOOPING.patch deleted file mode 100644 index 6975c9a..0000000 --- a/SOURCES/0067-iplink-bridge-add-support-for-IFLA_BR_MCAST_SNOOPING.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 8769aa87b7b1def755ce8f7c1865815b038580c9 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:12:00 +0100 -Subject: [PATCH] iplink: bridge: add support for IFLA_BR_MCAST_SNOOPING - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 7ddd2d946cebf - -commit 7ddd2d946cebf031c90d7b0d62b32bd880f7af8c -Author: Nikolay Aleksandrov -Date: Tue Feb 9 00:14:26 2016 +0100 - - iplink: bridge: add support for IFLA_BR_MCAST_SNOOPING - - This patch implements support for the IFLA_BR_MCAST_SNOOPING attribute - in iproute2 so it can change the multicast snooping value. - - Signed-off-by: Nikolay Aleksandrov ---- - ip/iplink_bridge.c | 13 +++++++++++++ - 1 file changed, 13 insertions(+) - -diff --git a/ip/iplink_bridge.c b/ip/iplink_bridge.c -index 7c2165c..a216bd4 100644 ---- a/ip/iplink_bridge.c -+++ b/ip/iplink_bridge.c -@@ -33,6 +33,7 @@ static void print_explain(FILE *f) - " [ vlan_filtering VLAN_FILTERING ]\n" - " [ vlan_protocol VLAN_PROTOCOL ]\n" - " [ vlan_default_pvid VLAN_DEFAULT_PVID ]\n" -+ " [ mcast_snooping MULTICAST_SNOOPING ]\n" - " [ mcast_router MULTICAST_ROUTER ]\n" - "\n" - "Where: VLAN_PROTOCOL := { 802.1Q | 802.1ad }\n" -@@ -155,6 +156,14 @@ static int bridge_parse_opt(struct link_util *lu, int argc, char **argv, - invarg("invalid mcast_router", *argv); - - addattr8(n, 1024, IFLA_BR_MCAST_ROUTER, mcast_router); -+ } else if (matches(*argv, "mcast_snooping") == 0) { -+ __u8 mcast_snoop; -+ -+ NEXT_ARG(); -+ if (get_u8(&mcast_snoop, *argv, 0)) -+ invarg("invalid mcast_snooping", *argv); -+ -+ addattr8(n, 1024, IFLA_BR_MCAST_SNOOPING, mcast_snoop); - } else if (matches(*argv, "help") == 0) { - explain(); - return -1; -@@ -293,6 +302,10 @@ static void bridge_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - 1 /*ARPHDR_ETHER*/, mac, sizeof(mac))); - } - -+ if (tb[IFLA_BR_MCAST_SNOOPING]) -+ fprintf(f, "mcast_snooping %u ", -+ rta_getattr_u8(tb[IFLA_BR_MCAST_SNOOPING])); -+ - if (tb[IFLA_BR_MCAST_ROUTER]) - fprintf(f, "mcast_router %u ", - rta_getattr_u8(tb[IFLA_BR_MCAST_ROUTER])); --- -1.8.3.1 - diff --git a/SOURCES/0068-iplink-bridge-add-support-for-IFLA_BR_MCAST_QUERY_US.patch b/SOURCES/0068-iplink-bridge-add-support-for-IFLA_BR_MCAST_QUERY_US.patch deleted file mode 100644 index 1e24f01..0000000 --- a/SOURCES/0068-iplink-bridge-add-support-for-IFLA_BR_MCAST_QUERY_US.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 5bc978a10c2bb2f4542f329c3cb8a44b323e26fd Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:12:01 +0100 -Subject: [PATCH] iplink: bridge: add support for - IFLA_BR_MCAST_QUERY_USE_IFADDR - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 449843d1d6b7e - -commit 449843d1d6b7ed11723b6a6585a4b781a110ffdd -Author: Nikolay Aleksandrov -Date: Tue Feb 9 00:14:27 2016 +0100 - - iplink: bridge: add support for IFLA_BR_MCAST_QUERY_USE_IFADDR - - This patch implements support for the IFLA_BR_MCAST_QUERY_USE_IFADDR - attribute in iproute2 so it can toggle the multicast_query_use_ifaddr val. - - Signed-off-by: Nikolay Aleksandrov ---- - ip/iplink_bridge.c | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) - -diff --git a/ip/iplink_bridge.c b/ip/iplink_bridge.c -index a216bd4..7b2bba8 100644 ---- a/ip/iplink_bridge.c -+++ b/ip/iplink_bridge.c -@@ -35,6 +35,7 @@ static void print_explain(FILE *f) - " [ vlan_default_pvid VLAN_DEFAULT_PVID ]\n" - " [ mcast_snooping MULTICAST_SNOOPING ]\n" - " [ mcast_router MULTICAST_ROUTER ]\n" -+ " [ mcast_query_use_ifaddr MCAST_QUERY_USE_IFADDR ]\n" - "\n" - "Where: VLAN_PROTOCOL := { 802.1Q | 802.1ad }\n" - ); -@@ -164,6 +165,16 @@ static int bridge_parse_opt(struct link_util *lu, int argc, char **argv, - invarg("invalid mcast_snooping", *argv); - - addattr8(n, 1024, IFLA_BR_MCAST_SNOOPING, mcast_snoop); -+ } else if (matches(*argv, "mcast_query_use_ifaddr") == 0) { -+ __u8 mcast_qui; -+ -+ NEXT_ARG(); -+ if (get_u8(&mcast_qui, *argv, 0)) -+ invarg("invalid mcast_query_use_ifaddr", -+ *argv); -+ -+ addattr8(n, 1024, IFLA_BR_MCAST_QUERY_USE_IFADDR, -+ mcast_qui); - } else if (matches(*argv, "help") == 0) { - explain(); - return -1; -@@ -309,6 +320,10 @@ static void bridge_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - if (tb[IFLA_BR_MCAST_ROUTER]) - fprintf(f, "mcast_router %u ", - rta_getattr_u8(tb[IFLA_BR_MCAST_ROUTER])); -+ -+ if (tb[IFLA_BR_MCAST_QUERY_USE_IFADDR]) -+ fprintf(f, "mcast_query_use_ifaddr %u ", -+ rta_getattr_u8(tb[IFLA_BR_MCAST_QUERY_USE_IFADDR])); - } - - static void bridge_print_help(struct link_util *lu, int argc, char **argv, --- -1.8.3.1 - diff --git a/SOURCES/0069-iplink-bridge-add-support-for-IFLA_BR_MCAST_QUERIER.patch b/SOURCES/0069-iplink-bridge-add-support-for-IFLA_BR_MCAST_QUERIER.patch deleted file mode 100644 index 9731e19..0000000 --- a/SOURCES/0069-iplink-bridge-add-support-for-IFLA_BR_MCAST_QUERIER.patch +++ /dev/null @@ -1,63 +0,0 @@ -From fe330edb2a14d72af6175027c00b19c336501c6c Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:12:01 +0100 -Subject: [PATCH] iplink: bridge: add support for IFLA_BR_MCAST_QUERIER - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 0778b741225a5 - -commit 0778b741225a51bb6d72fe42683267e86bc31215 -Author: Nikolay Aleksandrov -Date: Tue Feb 9 00:14:28 2016 +0100 - - iplink: bridge: add support for IFLA_BR_MCAST_QUERIER - - This patch implements support for the IFLA_BR_MCAST_QUERIER attribute - in iproute2 so it can toggle the mcast querier value. - - Signed-off-by: Nikolay Aleksandrov ---- - ip/iplink_bridge.c | 13 +++++++++++++ - 1 file changed, 13 insertions(+) - -diff --git a/ip/iplink_bridge.c b/ip/iplink_bridge.c -index 7b2bba8..620a9f9 100644 ---- a/ip/iplink_bridge.c -+++ b/ip/iplink_bridge.c -@@ -36,6 +36,7 @@ static void print_explain(FILE *f) - " [ mcast_snooping MULTICAST_SNOOPING ]\n" - " [ mcast_router MULTICAST_ROUTER ]\n" - " [ mcast_query_use_ifaddr MCAST_QUERY_USE_IFADDR ]\n" -+ " [ mcast_querier MULTICAST_QUERIER ]\n" - "\n" - "Where: VLAN_PROTOCOL := { 802.1Q | 802.1ad }\n" - ); -@@ -175,6 +176,14 @@ static int bridge_parse_opt(struct link_util *lu, int argc, char **argv, - - addattr8(n, 1024, IFLA_BR_MCAST_QUERY_USE_IFADDR, - mcast_qui); -+ } else if (matches(*argv, "mcast_querier") == 0) { -+ __u8 mcast_querier; -+ -+ NEXT_ARG(); -+ if (get_u8(&mcast_querier, *argv, 0)) -+ invarg("invalid mcast_querier", *argv); -+ -+ addattr8(n, 1024, IFLA_BR_MCAST_QUERIER, mcast_querier); - } else if (matches(*argv, "help") == 0) { - explain(); - return -1; -@@ -324,6 +333,10 @@ static void bridge_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - if (tb[IFLA_BR_MCAST_QUERY_USE_IFADDR]) - fprintf(f, "mcast_query_use_ifaddr %u ", - rta_getattr_u8(tb[IFLA_BR_MCAST_QUERY_USE_IFADDR])); -+ -+ if (tb[IFLA_BR_MCAST_QUERIER]) -+ fprintf(f, "mcast_querier %u ", -+ rta_getattr_u8(tb[IFLA_BR_MCAST_QUERIER])); - } - - static void bridge_print_help(struct link_util *lu, int argc, char **argv, --- -1.8.3.1 - diff --git a/SOURCES/0070-iplink-bridge-add-support-for-IFLA_BR_MCAST_HASH_ELA.patch b/SOURCES/0070-iplink-bridge-add-support-for-IFLA_BR_MCAST_HASH_ELA.patch deleted file mode 100644 index 6609d4f..0000000 --- a/SOURCES/0070-iplink-bridge-add-support-for-IFLA_BR_MCAST_HASH_ELA.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 42636a2ce4901df806543e994fa6cffc6992656f Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:12:01 +0100 -Subject: [PATCH] iplink: bridge: add support for IFLA_BR_MCAST_HASH_ELASTICITY - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 92c0ef7071b38 - -commit 92c0ef7071b3895ea89f26b7b7b6a77141e43578 -Author: Nikolay Aleksandrov -Date: Tue Feb 9 00:14:29 2016 +0100 - - iplink: bridge: add support for IFLA_BR_MCAST_HASH_ELASTICITY - - This patch implements support for the IFLA_BR_MCAST_HASH_ELASTICTITY - attribute in iproute2 so it can change the hash elasticity value. - - Signed-off-by: Nikolay Aleksandrov ---- - ip/iplink_bridge.c | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) - -diff --git a/ip/iplink_bridge.c b/ip/iplink_bridge.c -index 620a9f9..3e444d3 100644 ---- a/ip/iplink_bridge.c -+++ b/ip/iplink_bridge.c -@@ -37,6 +37,7 @@ static void print_explain(FILE *f) - " [ mcast_router MULTICAST_ROUTER ]\n" - " [ mcast_query_use_ifaddr MCAST_QUERY_USE_IFADDR ]\n" - " [ mcast_querier MULTICAST_QUERIER ]\n" -+ " [ mcast_hash_elasticity HASH_ELASTICITY ]\n" - "\n" - "Where: VLAN_PROTOCOL := { 802.1Q | 802.1ad }\n" - ); -@@ -184,6 +185,16 @@ static int bridge_parse_opt(struct link_util *lu, int argc, char **argv, - invarg("invalid mcast_querier", *argv); - - addattr8(n, 1024, IFLA_BR_MCAST_QUERIER, mcast_querier); -+ } else if (matches(*argv, "mcast_hash_elasticity") == 0) { -+ __u32 mcast_hash_el; -+ -+ NEXT_ARG(); -+ if (get_u32(&mcast_hash_el, *argv, 0)) -+ invarg("invalid mcast_hash_elasticity", -+ *argv); -+ -+ addattr32(n, 1024, IFLA_BR_MCAST_HASH_ELASTICITY, -+ mcast_hash_el); - } else if (matches(*argv, "help") == 0) { - explain(); - return -1; -@@ -337,6 +348,10 @@ static void bridge_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - if (tb[IFLA_BR_MCAST_QUERIER]) - fprintf(f, "mcast_querier %u ", - rta_getattr_u8(tb[IFLA_BR_MCAST_QUERIER])); -+ -+ if (tb[IFLA_BR_MCAST_HASH_ELASTICITY]) -+ fprintf(f, "mcast_hash_elasticity %u ", -+ rta_getattr_u32(tb[IFLA_BR_MCAST_HASH_ELASTICITY])); - } - - static void bridge_print_help(struct link_util *lu, int argc, char **argv, --- -1.8.3.1 - diff --git a/SOURCES/0071-iplink-bridge-add-support-for-IFLA_BR_MCAST_HASH_MAX.patch b/SOURCES/0071-iplink-bridge-add-support-for-IFLA_BR_MCAST_HASH_MAX.patch deleted file mode 100644 index 1736339..0000000 --- a/SOURCES/0071-iplink-bridge-add-support-for-IFLA_BR_MCAST_HASH_MAX.patch +++ /dev/null @@ -1,64 +0,0 @@ -From 41e7d29781bc840644e366ba340d41af80076cdc Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:12:01 +0100 -Subject: [PATCH] iplink: bridge: add support for IFLA_BR_MCAST_HASH_MAX - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 8b9eb7cd25941 - -commit 8b9eb7cd259416d0a46bd7ed7820f6bfdd909b64 -Author: Nikolay Aleksandrov -Date: Tue Feb 9 00:14:30 2016 +0100 - - iplink: bridge: add support for IFLA_BR_MCAST_HASH_MAX - - This patch implements support for the IFLA_BR_MCAST_HASH_MAX attribute - in iproute2 so it can change the maximum hashed entries. - - Signed-off-by: Nikolay Aleksandrov ---- - ip/iplink_bridge.c | 14 ++++++++++++++ - 1 file changed, 14 insertions(+) - -diff --git a/ip/iplink_bridge.c b/ip/iplink_bridge.c -index 3e444d3..42067ed 100644 ---- a/ip/iplink_bridge.c -+++ b/ip/iplink_bridge.c -@@ -38,6 +38,7 @@ static void print_explain(FILE *f) - " [ mcast_query_use_ifaddr MCAST_QUERY_USE_IFADDR ]\n" - " [ mcast_querier MULTICAST_QUERIER ]\n" - " [ mcast_hash_elasticity HASH_ELASTICITY ]\n" -+ " [ mcast_hash_max HASH_MAX ]\n" - "\n" - "Where: VLAN_PROTOCOL := { 802.1Q | 802.1ad }\n" - ); -@@ -195,6 +196,15 @@ static int bridge_parse_opt(struct link_util *lu, int argc, char **argv, - - addattr32(n, 1024, IFLA_BR_MCAST_HASH_ELASTICITY, - mcast_hash_el); -+ } else if (matches(*argv, "mcast_hash_max") == 0) { -+ __u32 mcast_hash_max; -+ -+ NEXT_ARG(); -+ if (get_u32(&mcast_hash_max, *argv, 0)) -+ invarg("invalid mcast_hash_max", *argv); -+ -+ addattr32(n, 1024, IFLA_BR_MCAST_HASH_MAX, -+ mcast_hash_max); - } else if (matches(*argv, "help") == 0) { - explain(); - return -1; -@@ -352,6 +362,10 @@ static void bridge_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - if (tb[IFLA_BR_MCAST_HASH_ELASTICITY]) - fprintf(f, "mcast_hash_elasticity %u ", - rta_getattr_u32(tb[IFLA_BR_MCAST_HASH_ELASTICITY])); -+ -+ if (tb[IFLA_BR_MCAST_HASH_MAX]) -+ fprintf(f, "mcast_hash_max %u ", -+ rta_getattr_u32(tb[IFLA_BR_MCAST_HASH_MAX])); - } - - static void bridge_print_help(struct link_util *lu, int argc, char **argv, --- -1.8.3.1 - diff --git a/SOURCES/0072-iplink-bridge-add-support-for-IFLA_BR_MCAST_LAST_MEM.patch b/SOURCES/0072-iplink-bridge-add-support-for-IFLA_BR_MCAST_LAST_MEM.patch deleted file mode 100644 index ed05a79..0000000 --- a/SOURCES/0072-iplink-bridge-add-support-for-IFLA_BR_MCAST_LAST_MEM.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 9cc95859ba4632a7774631d80191aec91c84753a Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:12:01 +0100 -Subject: [PATCH] iplink: bridge: add support for IFLA_BR_MCAST_LAST_MEMBER_CNT - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit fb44cadb9200f - -commit fb44cadb9200f85fc1c78c5a208ce7bed2c5a594 -Author: Nikolay Aleksandrov -Date: Tue Feb 9 00:14:31 2016 +0100 - - iplink: bridge: add support for IFLA_BR_MCAST_LAST_MEMBER_CNT - - This patch implements support for the IFLA_BR_MCAST_LAST_MEMBER_CNT - attribute in iproute2 so it can change the last member count value. - - Signed-off-by: Nikolay Aleksandrov ---- - ip/iplink_bridge.c | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) - -diff --git a/ip/iplink_bridge.c b/ip/iplink_bridge.c -index 42067ed..54297a7 100644 ---- a/ip/iplink_bridge.c -+++ b/ip/iplink_bridge.c -@@ -39,6 +39,7 @@ static void print_explain(FILE *f) - " [ mcast_querier MULTICAST_QUERIER ]\n" - " [ mcast_hash_elasticity HASH_ELASTICITY ]\n" - " [ mcast_hash_max HASH_MAX ]\n" -+ " [ mcast_last_member_count LAST_MEMBER_COUNT ]\n" - "\n" - "Where: VLAN_PROTOCOL := { 802.1Q | 802.1ad }\n" - ); -@@ -205,6 +206,16 @@ static int bridge_parse_opt(struct link_util *lu, int argc, char **argv, - - addattr32(n, 1024, IFLA_BR_MCAST_HASH_MAX, - mcast_hash_max); -+ } else if (matches(*argv, "mcast_last_member_count") == 0) { -+ __u32 mcast_lmc; -+ -+ NEXT_ARG(); -+ if (get_u32(&mcast_lmc, *argv, 0)) -+ invarg("invalid mcast_last_member_count", -+ *argv); -+ -+ addattr32(n, 1024, IFLA_BR_MCAST_LAST_MEMBER_CNT, -+ mcast_lmc); - } else if (matches(*argv, "help") == 0) { - explain(); - return -1; -@@ -366,6 +377,10 @@ static void bridge_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - if (tb[IFLA_BR_MCAST_HASH_MAX]) - fprintf(f, "mcast_hash_max %u ", - rta_getattr_u32(tb[IFLA_BR_MCAST_HASH_MAX])); -+ -+ if (tb[IFLA_BR_MCAST_LAST_MEMBER_CNT]) -+ fprintf(f, "mcast_last_member_count %u ", -+ rta_getattr_u32(tb[IFLA_BR_MCAST_LAST_MEMBER_CNT])); - } - - static void bridge_print_help(struct link_util *lu, int argc, char **argv, --- -1.8.3.1 - diff --git a/SOURCES/0073-iplink-bridge-add-support-for-IFLA_BR_MCAST_STARTUP_.patch b/SOURCES/0073-iplink-bridge-add-support-for-IFLA_BR_MCAST_STARTUP_.patch deleted file mode 100644 index ec1c15e..0000000 --- a/SOURCES/0073-iplink-bridge-add-support-for-IFLA_BR_MCAST_STARTUP_.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 8367034ba2ee56645911c33f7b6b4b4cd712ec4a Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:12:01 +0100 -Subject: [PATCH] iplink: bridge: add support for - IFLA_BR_MCAST_STARTUP_QUERY_CNT - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit ceb6486655254 - -commit ceb6486655254f6abde06276b564b0bb1fc2ea11 -Author: Nikolay Aleksandrov -Date: Tue Feb 9 00:14:32 2016 +0100 - - iplink: bridge: add support for IFLA_BR_MCAST_STARTUP_QUERY_CNT - - This patch implements support for the IFLA_BR_MCAST_STARTUP_QUERY_CNT - attribute in iproute2 so it can change the startup query count. - - Signed-off-by: Nikolay Aleksandrov ---- - ip/iplink_bridge.c | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) - -diff --git a/ip/iplink_bridge.c b/ip/iplink_bridge.c -index 54297a7..86ae6f9 100644 ---- a/ip/iplink_bridge.c -+++ b/ip/iplink_bridge.c -@@ -40,6 +40,7 @@ static void print_explain(FILE *f) - " [ mcast_hash_elasticity HASH_ELASTICITY ]\n" - " [ mcast_hash_max HASH_MAX ]\n" - " [ mcast_last_member_count LAST_MEMBER_COUNT ]\n" -+ " [ mcast_startup_query_count STARTUP_QUERY_COUNT ]\n" - "\n" - "Where: VLAN_PROTOCOL := { 802.1Q | 802.1ad }\n" - ); -@@ -216,6 +217,16 @@ static int bridge_parse_opt(struct link_util *lu, int argc, char **argv, - - addattr32(n, 1024, IFLA_BR_MCAST_LAST_MEMBER_CNT, - mcast_lmc); -+ } else if (matches(*argv, "mcast_startup_query_count") == 0) { -+ __u32 mcast_sqc; -+ -+ NEXT_ARG(); -+ if (get_u32(&mcast_sqc, *argv, 0)) -+ invarg("invalid mcast_startup_query_count", -+ *argv); -+ -+ addattr32(n, 1024, IFLA_BR_MCAST_STARTUP_QUERY_CNT, -+ mcast_sqc); - } else if (matches(*argv, "help") == 0) { - explain(); - return -1; -@@ -381,6 +392,10 @@ static void bridge_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - if (tb[IFLA_BR_MCAST_LAST_MEMBER_CNT]) - fprintf(f, "mcast_last_member_count %u ", - rta_getattr_u32(tb[IFLA_BR_MCAST_LAST_MEMBER_CNT])); -+ -+ if (tb[IFLA_BR_MCAST_STARTUP_QUERY_CNT]) -+ fprintf(f, "mcast_startup_query_count %u ", -+ rta_getattr_u32(tb[IFLA_BR_MCAST_STARTUP_QUERY_CNT])); - } - - static void bridge_print_help(struct link_util *lu, int argc, char **argv, --- -1.8.3.1 - diff --git a/SOURCES/0074-iplink-bridge-add-support-for-IFLA_BR_MCAST_LAST_MEM.patch b/SOURCES/0074-iplink-bridge-add-support-for-IFLA_BR_MCAST_LAST_MEM.patch deleted file mode 100644 index 07aa3c0..0000000 --- a/SOURCES/0074-iplink-bridge-add-support-for-IFLA_BR_MCAST_LAST_MEM.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 53337da90ff5a087814056c2fc271e07b4db852c Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:12:01 +0100 -Subject: [PATCH] iplink: bridge: add support for - IFLA_BR_MCAST_LAST_MEMBER_INTVL - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 10082a253fb26 - -commit 10082a253fb2649b94093dec7737b15c72e159d4 -Author: Nikolay Aleksandrov -Date: Tue Feb 9 00:14:33 2016 +0100 - - iplink: bridge: add support for IFLA_BR_MCAST_LAST_MEMBER_INTVL - - This patch implements support for the IFLA_BR_MCAST_LAST_MEMBER_INTVL - attribute in iproute2 so it can change the last member interval. - - Signed-off-by: Nikolay Aleksandrov ---- - ip/iplink_bridge.c | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) - -diff --git a/ip/iplink_bridge.c b/ip/iplink_bridge.c -index 86ae6f9..5d8810c 100644 ---- a/ip/iplink_bridge.c -+++ b/ip/iplink_bridge.c -@@ -41,6 +41,7 @@ static void print_explain(FILE *f) - " [ mcast_hash_max HASH_MAX ]\n" - " [ mcast_last_member_count LAST_MEMBER_COUNT ]\n" - " [ mcast_startup_query_count STARTUP_QUERY_COUNT ]\n" -+ " [ mcast_last_member_interval LAST_MEMBER_INTERVAL ]\n" - "\n" - "Where: VLAN_PROTOCOL := { 802.1Q | 802.1ad }\n" - ); -@@ -227,6 +228,16 @@ static int bridge_parse_opt(struct link_util *lu, int argc, char **argv, - - addattr32(n, 1024, IFLA_BR_MCAST_STARTUP_QUERY_CNT, - mcast_sqc); -+ } else if (matches(*argv, "mcast_last_member_interval") == 0) { -+ __u64 mcast_last_member_intvl; -+ -+ NEXT_ARG(); -+ if (get_u64(&mcast_last_member_intvl, *argv, 0)) -+ invarg("invalid mcast_last_member_interval", -+ *argv); -+ -+ addattr64(n, 1024, IFLA_BR_MCAST_LAST_MEMBER_INTVL, -+ mcast_last_member_intvl); - } else if (matches(*argv, "help") == 0) { - explain(); - return -1; -@@ -396,6 +407,10 @@ static void bridge_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - if (tb[IFLA_BR_MCAST_STARTUP_QUERY_CNT]) - fprintf(f, "mcast_startup_query_count %u ", - rta_getattr_u32(tb[IFLA_BR_MCAST_STARTUP_QUERY_CNT])); -+ -+ if (tb[IFLA_BR_MCAST_LAST_MEMBER_INTVL]) -+ fprintf(f, "mcast_last_member_interval %llu ", -+ rta_getattr_u64(tb[IFLA_BR_MCAST_LAST_MEMBER_INTVL])); - } - - static void bridge_print_help(struct link_util *lu, int argc, char **argv, --- -1.8.3.1 - diff --git a/SOURCES/0075-iplink-bridge-add-support-for-IFLA_BR_MCAST_MEMBERSH.patch b/SOURCES/0075-iplink-bridge-add-support-for-IFLA_BR_MCAST_MEMBERSH.patch deleted file mode 100644 index 2bdf0f7..0000000 --- a/SOURCES/0075-iplink-bridge-add-support-for-IFLA_BR_MCAST_MEMBERSH.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 4e6c30dc16307138c4af26258ad1206b62933364 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:12:01 +0100 -Subject: [PATCH] iplink: bridge: add support for - IFLA_BR_MCAST_MEMBERSHIP_INTVL - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 7f3d559226458 - -commit 7f3d559226458b4b99e78c17080fd263a913e386 -Author: Nikolay Aleksandrov -Date: Tue Feb 9 00:14:34 2016 +0100 - - iplink: bridge: add support for IFLA_BR_MCAST_MEMBERSHIP_INTVL - - This patch implements support for the IFLA_BR_MCAST_MEMBERSHIP_INTVL - attribute in iproute2 so it can change the membership interval. - - Signed-off-by: Nikolay Aleksandrov ---- - ip/iplink_bridge.c | 16 ++++++++++++++++ - 1 file changed, 16 insertions(+) - -diff --git a/ip/iplink_bridge.c b/ip/iplink_bridge.c -index 5d8810c..8f4c207 100644 ---- a/ip/iplink_bridge.c -+++ b/ip/iplink_bridge.c -@@ -42,6 +42,7 @@ static void print_explain(FILE *f) - " [ mcast_last_member_count LAST_MEMBER_COUNT ]\n" - " [ mcast_startup_query_count STARTUP_QUERY_COUNT ]\n" - " [ mcast_last_member_interval LAST_MEMBER_INTERVAL ]\n" -+ " [ mcast_membership_interval MEMBERSHIP_INTERVAL ]\n" - "\n" - "Where: VLAN_PROTOCOL := { 802.1Q | 802.1ad }\n" - ); -@@ -238,6 +239,17 @@ static int bridge_parse_opt(struct link_util *lu, int argc, char **argv, - - addattr64(n, 1024, IFLA_BR_MCAST_LAST_MEMBER_INTVL, - mcast_last_member_intvl); -+ } else if (matches(*argv, "mcast_membership_interval") == 0) { -+ __u64 mcast_membership_intvl; -+ -+ NEXT_ARG(); -+ if (get_u64(&mcast_membership_intvl, *argv, 0)) { -+ invarg("invalid mcast_membership_interval", -+ *argv); -+ return -1; -+ } -+ addattr64(n, 1024, IFLA_BR_MCAST_MEMBERSHIP_INTVL, -+ mcast_membership_intvl); - } else if (matches(*argv, "help") == 0) { - explain(); - return -1; -@@ -411,6 +423,10 @@ static void bridge_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - if (tb[IFLA_BR_MCAST_LAST_MEMBER_INTVL]) - fprintf(f, "mcast_last_member_interval %llu ", - rta_getattr_u64(tb[IFLA_BR_MCAST_LAST_MEMBER_INTVL])); -+ -+ if (tb[IFLA_BR_MCAST_MEMBERSHIP_INTVL]) -+ fprintf(f, "mcast_membership_interval %llu ", -+ rta_getattr_u64(tb[IFLA_BR_MCAST_MEMBERSHIP_INTVL])); - } - - static void bridge_print_help(struct link_util *lu, int argc, char **argv, --- -1.8.3.1 - diff --git a/SOURCES/0076-iplink-bridge-add-support-for-IFLA_BR_MCAST_QUERIER_.patch b/SOURCES/0076-iplink-bridge-add-support-for-IFLA_BR_MCAST_QUERIER_.patch deleted file mode 100644 index e0451f2..0000000 --- a/SOURCES/0076-iplink-bridge-add-support-for-IFLA_BR_MCAST_QUERIER_.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 14f79941a8b8622ea0b2310685a4dc625ec3b2c5 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:12:02 +0100 -Subject: [PATCH] iplink: bridge: add support for IFLA_BR_MCAST_QUERIER_INTVL - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 1f2244b851dd2 - -commit 1f2244b851dd21dd023b43afd902251d39b2d43b -Author: Nikolay Aleksandrov -Date: Tue Feb 9 00:14:35 2016 +0100 - - iplink: bridge: add support for IFLA_BR_MCAST_QUERIER_INTVL - - This patch implements support for the IFLA_BR_MCAST_QUERIER_INTVL - attribute in iproute2 so it can change the querier interval. - - Signed-off-by: Nikolay Aleksandrov ---- - ip/iplink_bridge.c | 16 ++++++++++++++++ - 1 file changed, 16 insertions(+) - -diff --git a/ip/iplink_bridge.c b/ip/iplink_bridge.c -index 8f4c207..6f54dbb 100644 ---- a/ip/iplink_bridge.c -+++ b/ip/iplink_bridge.c -@@ -43,6 +43,7 @@ static void print_explain(FILE *f) - " [ mcast_startup_query_count STARTUP_QUERY_COUNT ]\n" - " [ mcast_last_member_interval LAST_MEMBER_INTERVAL ]\n" - " [ mcast_membership_interval MEMBERSHIP_INTERVAL ]\n" -+ " [ mcast_querier_interval QUERIER_INTERVAL ]\n" - "\n" - "Where: VLAN_PROTOCOL := { 802.1Q | 802.1ad }\n" - ); -@@ -250,6 +251,17 @@ static int bridge_parse_opt(struct link_util *lu, int argc, char **argv, - } - addattr64(n, 1024, IFLA_BR_MCAST_MEMBERSHIP_INTVL, - mcast_membership_intvl); -+ } else if (matches(*argv, "mcast_querier_interval") == 0) { -+ __u64 mcast_querier_intvl; -+ -+ NEXT_ARG(); -+ if (get_u64(&mcast_querier_intvl, *argv, 0)) { -+ invarg("invalid mcast_querier_interval", -+ *argv); -+ return -1; -+ } -+ addattr64(n, 1024, IFLA_BR_MCAST_QUERIER_INTVL, -+ mcast_querier_intvl); - } else if (matches(*argv, "help") == 0) { - explain(); - return -1; -@@ -427,6 +439,10 @@ static void bridge_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - if (tb[IFLA_BR_MCAST_MEMBERSHIP_INTVL]) - fprintf(f, "mcast_membership_interval %llu ", - rta_getattr_u64(tb[IFLA_BR_MCAST_MEMBERSHIP_INTVL])); -+ -+ if (tb[IFLA_BR_MCAST_QUERIER_INTVL]) -+ fprintf(f, "mcast_querier_interval %llu ", -+ rta_getattr_u64(tb[IFLA_BR_MCAST_QUERIER_INTVL])); - } - - static void bridge_print_help(struct link_util *lu, int argc, char **argv, --- -1.8.3.1 - diff --git a/SOURCES/0077-iplink-bridge-add-support-for-IFLA_BR_MCAST_QUERY_IN.patch b/SOURCES/0077-iplink-bridge-add-support-for-IFLA_BR_MCAST_QUERY_IN.patch deleted file mode 100644 index 05d96f6..0000000 --- a/SOURCES/0077-iplink-bridge-add-support-for-IFLA_BR_MCAST_QUERY_IN.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 5265f76dc4a09dcfe073f3e2c91bf43dcfab87dd Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:12:02 +0100 -Subject: [PATCH] iplink: bridge: add support for IFLA_BR_MCAST_QUERY_INTVL - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 5a32388f5ce73 - -commit 5a32388f5ce730d7df2b512dbe31398e5a027a96 -Author: Nikolay Aleksandrov -Date: Tue Feb 9 00:14:36 2016 +0100 - - iplink: bridge: add support for IFLA_BR_MCAST_QUERY_INTVL - - This patch implements support for the IFLA_BR_MCAST_QUERY_INTVL attribute - in iproute2 so it can change the query interval. - - Signed-off-by: Nikolay Aleksandrov ---- - ip/iplink_bridge.c | 16 ++++++++++++++++ - 1 file changed, 16 insertions(+) - -diff --git a/ip/iplink_bridge.c b/ip/iplink_bridge.c -index 6f54dbb..d9fabf4 100644 ---- a/ip/iplink_bridge.c -+++ b/ip/iplink_bridge.c -@@ -44,6 +44,7 @@ static void print_explain(FILE *f) - " [ mcast_last_member_interval LAST_MEMBER_INTERVAL ]\n" - " [ mcast_membership_interval MEMBERSHIP_INTERVAL ]\n" - " [ mcast_querier_interval QUERIER_INTERVAL ]\n" -+ " [ mcast_query_interval QUERY_INTERVAL ]\n" - "\n" - "Where: VLAN_PROTOCOL := { 802.1Q | 802.1ad }\n" - ); -@@ -262,6 +263,17 @@ static int bridge_parse_opt(struct link_util *lu, int argc, char **argv, - } - addattr64(n, 1024, IFLA_BR_MCAST_QUERIER_INTVL, - mcast_querier_intvl); -+ } else if (matches(*argv, "mcast_query_interval") == 0) { -+ __u64 mcast_query_intvl; -+ -+ NEXT_ARG(); -+ if (get_u64(&mcast_query_intvl, *argv, 0)) { -+ invarg("invalid mcast_query_interval", -+ *argv); -+ return -1; -+ } -+ addattr64(n, 1024, IFLA_BR_MCAST_QUERY_INTVL, -+ mcast_query_intvl); - } else if (matches(*argv, "help") == 0) { - explain(); - return -1; -@@ -443,6 +455,10 @@ static void bridge_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - if (tb[IFLA_BR_MCAST_QUERIER_INTVL]) - fprintf(f, "mcast_querier_interval %llu ", - rta_getattr_u64(tb[IFLA_BR_MCAST_QUERIER_INTVL])); -+ -+ if (tb[IFLA_BR_MCAST_QUERY_INTVL]) -+ fprintf(f, "mcast_query_interval %llu ", -+ rta_getattr_u64(tb[IFLA_BR_MCAST_QUERY_INTVL])); - } - - static void bridge_print_help(struct link_util *lu, int argc, char **argv, --- -1.8.3.1 - diff --git a/SOURCES/0078-iplink-bridge-add-support-for-IFLA_BR_MCAST_QUERY_RE.patch b/SOURCES/0078-iplink-bridge-add-support-for-IFLA_BR_MCAST_QUERY_RE.patch deleted file mode 100644 index def6f64..0000000 --- a/SOURCES/0078-iplink-bridge-add-support-for-IFLA_BR_MCAST_QUERY_RE.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 8ca6ae82fe2238d2fa645d45922d6bc50c1a8f6c Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:12:02 +0100 -Subject: [PATCH] iplink: bridge: add support for - IFLA_BR_MCAST_QUERY_RESPONSE_INTVL - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 483df11cf1136 - -commit 483df11cf113668116cdc69e076194d0b4e7cc7f -Author: Nikolay Aleksandrov -Date: Tue Feb 9 00:14:37 2016 +0100 - - iplink: bridge: add support for IFLA_BR_MCAST_QUERY_RESPONSE_INTVL - - This patch implements support for the IFLA_BR_MCAST_QUERY_RESPONSE_INTVL - attribute in iproute2 so it can change the query response interval. - - Signed-off-by: Nikolay Aleksandrov ---- - ip/iplink_bridge.c | 16 ++++++++++++++++ - 1 file changed, 16 insertions(+) - -diff --git a/ip/iplink_bridge.c b/ip/iplink_bridge.c -index d9fabf4..3bdb954 100644 ---- a/ip/iplink_bridge.c -+++ b/ip/iplink_bridge.c -@@ -45,6 +45,7 @@ static void print_explain(FILE *f) - " [ mcast_membership_interval MEMBERSHIP_INTERVAL ]\n" - " [ mcast_querier_interval QUERIER_INTERVAL ]\n" - " [ mcast_query_interval QUERY_INTERVAL ]\n" -+ " [ mcast_query_response_interval QUERY_RESPONSE_INTERVAL ]\n" - "\n" - "Where: VLAN_PROTOCOL := { 802.1Q | 802.1ad }\n" - ); -@@ -274,6 +275,17 @@ static int bridge_parse_opt(struct link_util *lu, int argc, char **argv, - } - addattr64(n, 1024, IFLA_BR_MCAST_QUERY_INTVL, - mcast_query_intvl); -+ } else if (!matches(*argv, "mcast_query_response_interval")) { -+ __u64 mcast_query_resp_intvl; -+ -+ NEXT_ARG(); -+ if (get_u64(&mcast_query_resp_intvl, *argv, 0)) { -+ invarg("invalid mcast_query_response_interval", -+ *argv); -+ return -1; -+ } -+ addattr64(n, 1024, IFLA_BR_MCAST_QUERY_RESPONSE_INTVL, -+ mcast_query_resp_intvl); - } else if (matches(*argv, "help") == 0) { - explain(); - return -1; -@@ -459,6 +471,10 @@ static void bridge_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - if (tb[IFLA_BR_MCAST_QUERY_INTVL]) - fprintf(f, "mcast_query_interval %llu ", - rta_getattr_u64(tb[IFLA_BR_MCAST_QUERY_INTVL])); -+ -+ if (tb[IFLA_BR_MCAST_QUERY_RESPONSE_INTVL]) -+ fprintf(f, "mcast_query_response_interval %llu ", -+ rta_getattr_u64(tb[IFLA_BR_MCAST_QUERY_RESPONSE_INTVL])); - } - - static void bridge_print_help(struct link_util *lu, int argc, char **argv, --- -1.8.3.1 - diff --git a/SOURCES/0079-iplink-bridge-add-support-for-IFLA_BR_MCAST_STARTUP_.patch b/SOURCES/0079-iplink-bridge-add-support-for-IFLA_BR_MCAST_STARTUP_.patch deleted file mode 100644 index 27000ce..0000000 --- a/SOURCES/0079-iplink-bridge-add-support-for-IFLA_BR_MCAST_STARTUP_.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 288eb5fb2e9e8925fed54ec078ee4873ca3e5978 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:12:02 +0100 -Subject: [PATCH] iplink: bridge: add support for - IFLA_BR_MCAST_STARTUP_QUERY_INTVL - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 178b18066a871 - -commit 178b18066a871f1bc7e7e91620d4a1ca859bba7c -Author: Nikolay Aleksandrov -Date: Tue Feb 9 00:14:38 2016 +0100 - - iplink: bridge: add support for IFLA_BR_MCAST_STARTUP_QUERY_INTVL - - This patch implements support for the IFLA_BR_MCAST_STARTUP_QUERY_INTVL - attribute in iproute2 so it can change the startup query interval. - - Signed-off-by: Nikolay Aleksandrov ---- - ip/iplink_bridge.c | 16 ++++++++++++++++ - 1 file changed, 16 insertions(+) - -diff --git a/ip/iplink_bridge.c b/ip/iplink_bridge.c -index 3bdb954..2c8f351 100644 ---- a/ip/iplink_bridge.c -+++ b/ip/iplink_bridge.c -@@ -46,6 +46,7 @@ static void print_explain(FILE *f) - " [ mcast_querier_interval QUERIER_INTERVAL ]\n" - " [ mcast_query_interval QUERY_INTERVAL ]\n" - " [ mcast_query_response_interval QUERY_RESPONSE_INTERVAL ]\n" -+ " [ mcast_startup_query_interval STARTUP_QUERY_INTERVAL ]\n" - "\n" - "Where: VLAN_PROTOCOL := { 802.1Q | 802.1ad }\n" - ); -@@ -286,6 +287,17 @@ static int bridge_parse_opt(struct link_util *lu, int argc, char **argv, - } - addattr64(n, 1024, IFLA_BR_MCAST_QUERY_RESPONSE_INTVL, - mcast_query_resp_intvl); -+ } else if (!matches(*argv, "mcast_startup_query_interval")) { -+ __u64 mcast_startup_query_intvl; -+ -+ NEXT_ARG(); -+ if (get_u64(&mcast_startup_query_intvl, *argv, 0)) { -+ invarg("invalid mcast_startup_query_interval", -+ *argv); -+ return -1; -+ } -+ addattr64(n, 1024, IFLA_BR_MCAST_STARTUP_QUERY_INTVL, -+ mcast_startup_query_intvl); - } else if (matches(*argv, "help") == 0) { - explain(); - return -1; -@@ -475,6 +487,10 @@ static void bridge_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - if (tb[IFLA_BR_MCAST_QUERY_RESPONSE_INTVL]) - fprintf(f, "mcast_query_response_interval %llu ", - rta_getattr_u64(tb[IFLA_BR_MCAST_QUERY_RESPONSE_INTVL])); -+ -+ if (tb[IFLA_BR_MCAST_STARTUP_QUERY_INTVL]) -+ fprintf(f, "mcast_startup_query_interval %llu ", -+ rta_getattr_u64(tb[IFLA_BR_MCAST_STARTUP_QUERY_INTVL])); - } - - static void bridge_print_help(struct link_util *lu, int argc, char **argv, --- -1.8.3.1 - diff --git a/SOURCES/0080-iplink-bridge_slave-export-read-only-values.patch b/SOURCES/0080-iplink-bridge_slave-export-read-only-values.patch deleted file mode 100644 index 0d92ea2..0000000 --- a/SOURCES/0080-iplink-bridge_slave-export-read-only-values.patch +++ /dev/null @@ -1,137 +0,0 @@ -From 6eda4d7ea7eda19e7a67b0ae0892993fff9bd573 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:12:02 +0100 -Subject: [PATCH] iplink: bridge_slave: export read-only values - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 3069539fb8efd -Conflicts: Changed context due to other backports in that area. - -commit 3069539fb8efd8353d46a6be1a501f77871888ca -Author: Nikolay Aleksandrov -Date: Tue Feb 16 16:08:51 2016 +0100 - - iplink: bridge_slave: export read-only values - - Export all the read-only values that get returned about a bridge port - such as the timers, the ids, designated_port and cost, - topology_change_ack and config_pending. For the bridge ids the - br_dump_bridge_id function is exported from iplink_bridge. - - Signed-off-by: Nikolay Aleksandrov ---- - ip/ip_common.h | 2 ++ - ip/iplink_bridge.c | 3 +-- - ip/iplink_bridge_slave.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 72 insertions(+), 2 deletions(-) - -diff --git a/ip/ip_common.h b/ip/ip_common.h -index 286f61f..abab49d 100644 ---- a/ip/ip_common.h -+++ b/ip/ip_common.h -@@ -89,6 +89,8 @@ struct link_util - struct link_util *get_link_kind(const char *kind); - struct link_util *get_link_slave_kind(const char *slave_kind); - -+void br_dump_bridge_id(const struct ifla_bridge_id *id, char *buf, size_t len); -+ - #ifndef INFINITY_LIFE_TIME - #define INFINITY_LIFE_TIME 0xFFFFFFFFU - #endif -diff --git a/ip/iplink_bridge.c b/ip/iplink_bridge.c -index 2c8f351..7cec078 100644 ---- a/ip/iplink_bridge.c -+++ b/ip/iplink_bridge.c -@@ -57,8 +57,7 @@ static void explain(void) - print_explain(stderr); - } - --static void br_dump_bridge_id(const struct ifla_bridge_id *id, char *buf, -- size_t len) -+void br_dump_bridge_id(const struct ifla_bridge_id *id, char *buf, size_t len) - { - char eaddr[32]; - -diff --git a/ip/iplink_bridge_slave.c b/ip/iplink_bridge_slave.c -index 3538176..3ec2bba 100644 ---- a/ip/iplink_bridge_slave.c -+++ b/ip/iplink_bridge_slave.c -@@ -103,6 +103,75 @@ static void bridge_slave_print_opt(struct link_util *lu, FILE *f, - print_onoff(f, "flood", - rta_getattr_u8(tb[IFLA_BRPORT_UNICAST_FLOOD])); - -+ if (tb[IFLA_BRPORT_ID]) -+ fprintf(f, "port_id 0x%x ", -+ rta_getattr_u16(tb[IFLA_BRPORT_ID])); -+ -+ if (tb[IFLA_BRPORT_NO]) -+ fprintf(f, "port_no 0x%x ", -+ rta_getattr_u16(tb[IFLA_BRPORT_NO])); -+ -+ if (tb[IFLA_BRPORT_DESIGNATED_PORT]) -+ fprintf(f, "designated_port %u ", -+ rta_getattr_u16(tb[IFLA_BRPORT_DESIGNATED_PORT])); -+ -+ if (tb[IFLA_BRPORT_DESIGNATED_COST]) -+ fprintf(f, "designated_cost %u ", -+ rta_getattr_u16(tb[IFLA_BRPORT_DESIGNATED_COST])); -+ -+ if (tb[IFLA_BRPORT_BRIDGE_ID]) { -+ char bridge_id[32]; -+ -+ br_dump_bridge_id(RTA_DATA(tb[IFLA_BRPORT_BRIDGE_ID]), -+ bridge_id, sizeof(bridge_id)); -+ fprintf(f, "designated_bridge %s ", bridge_id); -+ } -+ -+ if (tb[IFLA_BRPORT_ROOT_ID]) { -+ char root_id[32]; -+ -+ br_dump_bridge_id(RTA_DATA(tb[IFLA_BRPORT_ROOT_ID]), -+ root_id, sizeof(root_id)); -+ fprintf(f, "designated_root %s ", root_id); -+ } -+ -+ if (tb[IFLA_BRPORT_HOLD_TIMER]) { -+ struct timeval tv; -+ __u64 htimer; -+ -+ htimer = rta_getattr_u64(tb[IFLA_BRPORT_HOLD_TIMER]); -+ __jiffies_to_tv(&tv, htimer); -+ fprintf(f, "hold_timer %4i.%.2i ", (int)tv.tv_sec, -+ (int)tv.tv_usec/10000); -+ } -+ -+ if (tb[IFLA_BRPORT_MESSAGE_AGE_TIMER]) { -+ struct timeval tv; -+ __u64 agetimer; -+ -+ agetimer = rta_getattr_u64(tb[IFLA_BRPORT_MESSAGE_AGE_TIMER]); -+ __jiffies_to_tv(&tv, agetimer); -+ fprintf(f, "message_age_timer %4i.%.2i ", (int)tv.tv_sec, -+ (int)tv.tv_usec/10000); -+ } -+ -+ if (tb[IFLA_BRPORT_FORWARD_DELAY_TIMER]) { -+ struct timeval tv; -+ __u64 fwdtimer; -+ -+ fwdtimer = rta_getattr_u64(tb[IFLA_BRPORT_FORWARD_DELAY_TIMER]); -+ __jiffies_to_tv(&tv, fwdtimer); -+ fprintf(f, "forward_delay_timer %4i.%.2i ", (int)tv.tv_sec, -+ (int)tv.tv_usec/10000); -+ } -+ -+ if (tb[IFLA_BRPORT_TOPOLOGY_CHANGE_ACK]) -+ fprintf(f, "topology_change_ack %u ", -+ rta_getattr_u8(tb[IFLA_BRPORT_TOPOLOGY_CHANGE_ACK])); -+ -+ if (tb[IFLA_BRPORT_CONFIG_PENDING]) -+ fprintf(f, "config_pending %u ", -+ rta_getattr_u8(tb[IFLA_BRPORT_CONFIG_PENDING])); - if (tb[IFLA_BRPORT_PROXYARP]) - print_onoff(f, "proxy_arp", - rta_getattr_u8(tb[IFLA_BRPORT_PROXYARP])); --- -1.8.3.1 - diff --git a/SOURCES/0081-bridge-add-support-for-dynamic-fdb-entries.patch b/SOURCES/0081-bridge-add-support-for-dynamic-fdb-entries.patch deleted file mode 100644 index 95d474c..0000000 --- a/SOURCES/0081-bridge-add-support-for-dynamic-fdb-entries.patch +++ /dev/null @@ -1,94 +0,0 @@ -From cd6557d21815618a2ba6d27d8a2015575a854fd1 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:12:21 +0100 -Subject: [PATCH] bridge: add support for dynamic fdb entries - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit c6d0cfb54b8b4 - -commit c6d0cfb54b8b467a57d259f5c9cec91f94f4e59e -Author: Roopa Prabhu -Date: Fri Feb 19 21:34:52 2016 -0800 - - bridge: add support for dynamic fdb entries - - This patch is a follow up to the recently added - 'static' fdb option. - - It introduces a new option 'dynamic' which adds - dynamic fdb entries with NUD_REACHABLE. - - $bridge fdb add 00:01:02:03:04:06 dev eth0 master dynamic - - $bridge fdb show - 00:01:02:03:04:06 dev eth0 - - This patch also documents all fdb types. Removes 'temp' - from usage message since it is now replaced by 'static'. - 'temp' still works and is synonymous with static. - - Signed-off-by: Wilson Kok - Signed-off-by: Roopa Prabhu ---- - bridge/fdb.c | 5 ++++- - man/man8/bridge.8 | 14 +++++++++++++- - 2 files changed, 17 insertions(+), 2 deletions(-) - -diff --git a/bridge/fdb.c b/bridge/fdb.c -index cb07345..0222fd6 100644 ---- a/bridge/fdb.c -+++ b/bridge/fdb.c -@@ -32,7 +32,7 @@ static void usage(void) - { - fprintf(stderr, "Usage: bridge fdb { add | append | del | replace } ADDR dev DEV\n" - " [ self ] [ master ] [ use ] [ router ]\n" -- " [ local | temp | static ] [ dst IPADDR ] [ vlan VID ]\n" -+ " [ local | static | dynamic ] [ dst IPADDR ] [ vlan VID ]\n" - " [ port PORT] [ vni VNI ] [ via DEV ]\n"); - fprintf(stderr, " bridge fdb [ show [ br BRDEV ] [ brport DEV ] ]\n"); - exit(-1); -@@ -303,6 +303,9 @@ static int fdb_modify(int cmd, int flags, int argc, char **argv) - } else if (matches(*argv, "temp") == 0 || - matches(*argv, "static") == 0) { - req.ndm.ndm_state |= NUD_REACHABLE; -+ } else if (matches(*argv, "dynamic") == 0) { -+ req.ndm.ndm_state |= NUD_REACHABLE; -+ req.ndm.ndm_state &= ~NUD_NOARP; - } else if (matches(*argv, "vlan") == 0) { - if (vid >= 0) - duparg2("vlan", *argv); -diff --git a/man/man8/bridge.8 b/man/man8/bridge.8 -index 864f983..0a36e75 100644 ---- a/man/man8/bridge.8 -+++ b/man/man8/bridge.8 -@@ -54,7 +54,7 @@ bridge \- show / manipulate bridge addresses and devices - .I LLADDR - .B dev - .IR DEV " { " --.BR local " | " temp " } [ " -+.BR local " | " static " | " dynamic " } [ " - .BR self " ] [ " master " ] [ " router " ] [ " use " ] [ " - .B dst - .IR IPADDR " ] [ " -@@ -338,6 +338,18 @@ the Ethernet MAC address. - .BI dev " DEV" - the interface to which this address is associated. - -+.B local -+- is a local permanent fdb entry -+.sp -+ -+.B static -+- is a static (no arp) fdb entry -+.sp -+ -+.B dynamic -+- is a dynamic reachable age-able fdb entry -+.sp -+ - .B self - - the address is associated with the port drivers fdb. Usually hardware. - .sp --- -1.8.3.1 - diff --git a/SOURCES/0082-iplink-bridge-remove-unnecessary-returns.patch b/SOURCES/0082-iplink-bridge-remove-unnecessary-returns.patch deleted file mode 100644 index 0aaf96a..0000000 --- a/SOURCES/0082-iplink-bridge-remove-unnecessary-returns.patch +++ /dev/null @@ -1,120 +0,0 @@ -From 7ddb2ef80b5e6cb2ec411dc5721d574d9bec1ff8 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:12:21 +0100 -Subject: [PATCH] iplink: bridge: remove unnecessary returns - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 8a4cd3943fb84 -Conflicts: Dropped some chunks due to missing nf_call_* support. - -commit 8a4cd3943fb8498a108f0d494bb3176deb01ab0f -Author: Nikolay Aleksandrov -Date: Thu Feb 18 20:54:34 2016 +0100 - - iplink: bridge: remove unnecessary returns - - invarg exits so no need to return, remove this c&p error from my recent - patches - - Signed-off-by: Nikolay Aleksandrov ---- - ip/iplink_bridge.c | 35 ++++++++++++++--------------------- - 1 file changed, 14 insertions(+), 21 deletions(-) - -diff --git a/ip/iplink_bridge.c b/ip/iplink_bridge.c -index 7cec078..6a0acf7 100644 ---- a/ip/iplink_bridge.c -+++ b/ip/iplink_bridge.c -@@ -119,19 +119,17 @@ static int bridge_parse_opt(struct link_util *lu, int argc, char **argv, - __u8 vlan_filter; - - NEXT_ARG(); -- if (get_u8(&vlan_filter, *argv, 0)) { -+ if (get_u8(&vlan_filter, *argv, 0)) - invarg("invalid vlan_filtering", *argv); -- return -1; -- } -+ - addattr8(n, 1024, IFLA_BR_VLAN_FILTERING, vlan_filter); - } else if (matches(*argv, "vlan_protocol") == 0) { - __u16 vlan_proto; - - NEXT_ARG(); -- if (ll_proto_a2n(&vlan_proto, *argv)) { -+ if (ll_proto_a2n(&vlan_proto, *argv)) - invarg("invalid vlan_protocol", *argv); -- return -1; -- } -+ - addattr16(n, 1024, IFLA_BR_VLAN_PROTOCOL, vlan_proto); - } else if (matches(*argv, "group_fwd_mask") == 0) { - __u16 fwd_mask; -@@ -246,55 +244,50 @@ static int bridge_parse_opt(struct link_util *lu, int argc, char **argv, - __u64 mcast_membership_intvl; - - NEXT_ARG(); -- if (get_u64(&mcast_membership_intvl, *argv, 0)) { -+ if (get_u64(&mcast_membership_intvl, *argv, 0)) - invarg("invalid mcast_membership_interval", - *argv); -- return -1; -- } -+ - addattr64(n, 1024, IFLA_BR_MCAST_MEMBERSHIP_INTVL, - mcast_membership_intvl); - } else if (matches(*argv, "mcast_querier_interval") == 0) { - __u64 mcast_querier_intvl; - - NEXT_ARG(); -- if (get_u64(&mcast_querier_intvl, *argv, 0)) { -+ if (get_u64(&mcast_querier_intvl, *argv, 0)) - invarg("invalid mcast_querier_interval", - *argv); -- return -1; -- } -+ - addattr64(n, 1024, IFLA_BR_MCAST_QUERIER_INTVL, - mcast_querier_intvl); - } else if (matches(*argv, "mcast_query_interval") == 0) { - __u64 mcast_query_intvl; - - NEXT_ARG(); -- if (get_u64(&mcast_query_intvl, *argv, 0)) { -+ if (get_u64(&mcast_query_intvl, *argv, 0)) - invarg("invalid mcast_query_interval", - *argv); -- return -1; -- } -+ - addattr64(n, 1024, IFLA_BR_MCAST_QUERY_INTVL, - mcast_query_intvl); - } else if (!matches(*argv, "mcast_query_response_interval")) { - __u64 mcast_query_resp_intvl; - - NEXT_ARG(); -- if (get_u64(&mcast_query_resp_intvl, *argv, 0)) { -+ if (get_u64(&mcast_query_resp_intvl, *argv, 0)) - invarg("invalid mcast_query_response_interval", - *argv); -- return -1; -- } -+ - addattr64(n, 1024, IFLA_BR_MCAST_QUERY_RESPONSE_INTVL, - mcast_query_resp_intvl); - } else if (!matches(*argv, "mcast_startup_query_interval")) { - __u64 mcast_startup_query_intvl; - - NEXT_ARG(); -- if (get_u64(&mcast_startup_query_intvl, *argv, 0)) { -+ if (get_u64(&mcast_startup_query_intvl, *argv, 0)) - invarg("invalid mcast_startup_query_interval", - *argv); -- return -1; -- } -+ - addattr64(n, 1024, IFLA_BR_MCAST_STARTUP_QUERY_INTVL, - mcast_startup_query_intvl); - } else if (matches(*argv, "help") == 0) { --- -1.8.3.1 - diff --git a/SOURCES/0083-bridge-mdb-add-user-space-support-for-extended-attri.patch b/SOURCES/0083-bridge-mdb-add-user-space-support-for-extended-attri.patch deleted file mode 100644 index 604f48c..0000000 --- a/SOURCES/0083-bridge-mdb-add-user-space-support-for-extended-attri.patch +++ /dev/null @@ -1,111 +0,0 @@ -From c55cf2cf1b127e5a08830c158fddc45fc8e5c8d8 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:12:38 +0100 -Subject: [PATCH] bridge: mdb: add user-space support for extended attributes - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 05d4f64d4abfe - -commit 05d4f64d4abfe198144df807d7d496086c5a7ce9 -Author: Nikolay Aleksandrov -Date: Mon Feb 22 15:16:13 2016 +0100 - - bridge: mdb: add user-space support for extended attributes - - Recently support was added to the kernel to be able to add more per-mdb - entry attributes via standard netlink attributes of type MDBA_MDB_EATTR_. - This patch adds support to iproute2 to parse and output these - attributes. The first exported attribute is the mdb "timer" value which - is shown only when the "-s" iproute2 arg is used. - - Example: - $ bridge -s mdb show - dev br0 port eth1 grp 239.0.0.11 permanent 0.00 - dev br0 port eth1 grp 239.0.0.10 temp 244.15 - dev br0 port eth1 grp 239.0.0.1 temp 245.21 - dev br0 port eth1 grp 239.0.0.5 temp 246.43 - dev br0 port eth2 grp 239.0.0.5 temp 248.44 - dev br0 port eth1 grp 239.0.0.2 temp 245.32 - - Signed-off-by: Nikolay Aleksandrov ---- - bridge/br_common.h | 3 +++ - bridge/mdb.c | 15 ++++++++++++--- - man/man8/bridge.8 | 5 +++++ - 3 files changed, 20 insertions(+), 3 deletions(-) - -diff --git a/bridge/br_common.h b/bridge/br_common.h -index 169a162..41eb0dc 100644 ---- a/bridge/br_common.h -+++ b/bridge/br_common.h -@@ -1,3 +1,6 @@ -+#define MDB_RTA(r) \ -+ ((struct rtattr *)(((char *)(r)) + RTA_ALIGN(sizeof(struct br_mdb_entry)))) -+ - extern int print_linkinfo(const struct sockaddr_nl *who, - struct nlmsghdr *n, - void *arg); -diff --git a/bridge/mdb.c b/bridge/mdb.c -index 24c4903..09d4b22 100644 ---- a/bridge/mdb.c -+++ b/bridge/mdb.c -@@ -49,7 +49,7 @@ static void br_print_router_ports(FILE *f, struct rtattr *attr) - } - - static void print_mdb_entry(FILE *f, int ifindex, struct br_mdb_entry *e, -- struct nlmsghdr *n) -+ struct nlmsghdr *n, struct rtattr **tb) - { - SPRINT_BUF(abuf); - const void *src; -@@ -66,20 +66,29 @@ static void print_mdb_entry(FILE *f, int ifindex, struct br_mdb_entry *e, - (e->state & MDB_PERMANENT) ? "permanent" : "temp"); - if (e->vid) - fprintf(f, " vid %hu", e->vid); -+ if (show_stats && tb && tb[MDBA_MDB_EATTR_TIMER]) { -+ struct timeval tv; -+ -+ __jiffies_to_tv(&tv, rta_getattr_u32(tb[MDBA_MDB_EATTR_TIMER])); -+ fprintf(f, "%4i.%.2i", (int)tv.tv_sec, (int)tv.tv_usec/10000); -+ } - fprintf(f, "\n"); - } - - static void br_print_mdb_entry(FILE *f, int ifindex, struct rtattr *attr, - struct nlmsghdr *n) - { -+ struct rtattr *etb[MDBA_MDB_EATTR_MAX + 1]; -+ struct br_mdb_entry *e; - struct rtattr *i; - int rem; -- struct br_mdb_entry *e; - - rem = RTA_PAYLOAD(attr); - for (i = RTA_DATA(attr); RTA_OK(i, rem); i = RTA_NEXT(i, rem)) { - e = RTA_DATA(i); -- print_mdb_entry(f, ifindex, e, n); -+ parse_rtattr(etb, MDBA_MDB_EATTR_MAX, MDB_RTA(RTA_DATA(i)), -+ RTA_PAYLOAD(i) - RTA_ALIGN(sizeof(*e))); -+ print_mdb_entry(f, ifindex, e, n, etb); - } - } - -diff --git a/man/man8/bridge.8 b/man/man8/bridge.8 -index 0a36e75..08f327b 100644 ---- a/man/man8/bridge.8 -+++ b/man/man8/bridge.8 -@@ -503,6 +503,11 @@ With the - option, the command becomes verbose. It prints out the ports known to have - a connected router. - -+.PP -+With the -+.B -statistics -+option, the command displays timer values for mdb entries. -+ - .SH bridge vlan - VLAN filter list - - .B vlan --- -1.8.3.1 - diff --git a/SOURCES/0084-bridge-mdb-add-support-for-offloaded-mdb-entries.patch b/SOURCES/0084-bridge-mdb-add-support-for-offloaded-mdb-entries.patch deleted file mode 100644 index 110805f..0000000 --- a/SOURCES/0084-bridge-mdb-add-support-for-offloaded-mdb-entries.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 74776a9a952915531233e5092e6e1dbfdaf846d5 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:12:38 +0100 -Subject: [PATCH] bridge: mdb: add support for offloaded mdb entries - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 29d61fb385967 - -commit 29d61fb385967e6e558aad99f68714df42f18c38 -Author: Elad Raz -Date: Sun Mar 6 12:46:04 2016 -0800 - - bridge: mdb: add support for offloaded mdb entries - - Mark MDB entries which are offloaded to HW with "offload" flag - - Signed-off-by: Elad Raz - Signed-off-by: Jiri Pirko ---- - bridge/mdb.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/bridge/mdb.c b/bridge/mdb.c -index 09d4b22..600596c 100644 ---- a/bridge/mdb.c -+++ b/bridge/mdb.c -@@ -60,10 +60,11 @@ static void print_mdb_entry(FILE *f, int ifindex, struct br_mdb_entry *e, - (const void *)&e->addr.u.ip6; - if (n->nlmsg_type == RTM_DELMDB) - fprintf(f, "Deleted "); -- fprintf(f, "dev %s port %s grp %s %s", ll_index_to_name(ifindex), -+ fprintf(f, "dev %s port %s grp %s %s %s", ll_index_to_name(ifindex), - ll_index_to_name(e->ifindex), - inet_ntop(af, src, abuf, sizeof(abuf)), -- (e->state & MDB_PERMANENT) ? "permanent" : "temp"); -+ (e->state & MDB_PERMANENT) ? "permanent" : "temp", -+ (e->flags & MDB_FLAGS_OFFLOAD) ? "offload" : ""); - if (e->vid) - fprintf(f, " vid %hu", e->vid); - if (show_stats && tb && tb[MDBA_MDB_EATTR_TIMER]) { --- -1.8.3.1 - diff --git a/SOURCES/0085-bridge-mdb-add-support-for-extended-router-port-info.patch b/SOURCES/0085-bridge-mdb-add-support-for-extended-router-port-info.patch deleted file mode 100644 index aea98ac..0000000 --- a/SOURCES/0085-bridge-mdb-add-support-for-extended-router-port-info.patch +++ /dev/null @@ -1,155 +0,0 @@ -From 90e24d0fe6dc4f5f4b5e6d75322e604c63f1cb14 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:12:38 +0100 -Subject: [PATCH] bridge: mdb: add support for extended router port information - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit ba0372670d1fa - -commit ba0372670d1fad0ae6cdbf970000ac7f4f72030f -Author: Nikolay Aleksandrov -Date: Mon Mar 14 11:04:46 2016 +0100 - - bridge: mdb: add support for extended router port information - - Recently a new temp router port mode was added and with it the dumped - information was extended similar to how mdb entries were done. This - patch adds support to dump the new information by using the "-s" switch. - Example: - $ bridge -d -s mdb show - dev br0 port eth1 grp ff02::1:ffbf:5716 temp 234.39 - dev br0 port eth1 grp 239.0.0.2 temp 97.17 - dev br0 port eth1 grp 239.0.0.3 temp 105.36 - router ports on br0: eth1 0.00 permanent - router ports on br0: eth2 254.87 temp - - It also updates the bridge man page. - - Signed-off-by: Nikolay Aleksandrov ---- - bridge/br_common.h | 3 +++ - bridge/mdb.c | 53 ++++++++++++++++++++++++++++++++++++++++++++--------- - man/man8/bridge.8 | 6 +++++- - 3 files changed, 52 insertions(+), 10 deletions(-) - -diff --git a/bridge/br_common.h b/bridge/br_common.h -index 41eb0dc..5ea45c9 100644 ---- a/bridge/br_common.h -+++ b/bridge/br_common.h -@@ -1,6 +1,9 @@ - #define MDB_RTA(r) \ - ((struct rtattr *)(((char *)(r)) + RTA_ALIGN(sizeof(struct br_mdb_entry)))) - -+#define MDB_RTR_RTA(r) \ -+ ((struct rtattr *)(((char *)(r)) + RTA_ALIGN(sizeof(__u32)))) -+ - extern int print_linkinfo(const struct sockaddr_nl *who, - struct nlmsghdr *n, - void *arg); -diff --git a/bridge/mdb.c b/bridge/mdb.c -index 600596c..97da4dc 100644 ---- a/bridge/mdb.c -+++ b/bridge/mdb.c -@@ -33,19 +33,56 @@ static void usage(void) - exit(-1); - } - --static void br_print_router_ports(FILE *f, struct rtattr *attr) -+static bool is_temp_mcast_rtr(__u8 type) -+{ -+ return type == MDB_RTR_TYPE_TEMP_QUERY || type == MDB_RTR_TYPE_TEMP; -+} -+ -+static void __print_router_port_stats(FILE *f, struct rtattr *pattr) -+{ -+ struct rtattr *tb[MDBA_ROUTER_PATTR_MAX + 1]; -+ struct timeval tv; -+ __u8 type; -+ -+ parse_rtattr(tb, MDBA_ROUTER_PATTR_MAX, MDB_RTR_RTA(RTA_DATA(pattr)), -+ RTA_PAYLOAD(pattr) - RTA_ALIGN(sizeof(uint32_t))); -+ if (tb[MDBA_ROUTER_PATTR_TIMER]) { -+ __jiffies_to_tv(&tv, -+ rta_getattr_u32(tb[MDBA_ROUTER_PATTR_TIMER])); -+ fprintf(f, " %4i.%.2i", -+ (int)tv.tv_sec, (int)tv.tv_usec/10000); -+ } -+ if (tb[MDBA_ROUTER_PATTR_TYPE]) { -+ type = rta_getattr_u8(tb[MDBA_ROUTER_PATTR_TYPE]); -+ fprintf(f, " %s", -+ is_temp_mcast_rtr(type) ? "temp" : "permanent"); -+ } -+} -+ -+static void br_print_router_ports(FILE *f, struct rtattr *attr, __u32 brifidx) - { - uint32_t *port_ifindex; - struct rtattr *i; - int rem; - -+ if (!show_stats) -+ fprintf(f, "router ports on %s: ", ll_index_to_name(brifidx)); -+ - rem = RTA_PAYLOAD(attr); - for (i = RTA_DATA(attr); RTA_OK(i, rem); i = RTA_NEXT(i, rem)) { - port_ifindex = RTA_DATA(i); -- fprintf(f, "%s ", ll_index_to_name(*port_ifindex)); -+ if (show_stats) { -+ fprintf(f, "router ports on %s: %s", -+ ll_index_to_name(brifidx), -+ ll_index_to_name(*port_ifindex)); -+ __print_router_port_stats(f, i); -+ fprintf(f, "\n"); -+ } else { -+ fprintf(f, "%s ", ll_index_to_name(*port_ifindex)); -+ } - } -- -- fprintf(f, "\n"); -+ if (!show_stats) -+ fprintf(f, "\n"); - } - - static void print_mdb_entry(FILE *f, int ifindex, struct br_mdb_entry *e, -@@ -127,11 +164,9 @@ int print_mdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - - if (tb[MDBA_ROUTER]) { - if (n->nlmsg_type == RTM_GETMDB) { -- if (show_details) { -- fprintf(fp, "router ports on %s: ", -- ll_index_to_name(r->ifindex)); -- br_print_router_ports(fp, tb[MDBA_ROUTER]); -- } -+ if (show_details) -+ br_print_router_ports(fp, tb[MDBA_ROUTER], -+ r->ifindex); - } else { - uint32_t *port_ifindex; - -diff --git a/man/man8/bridge.8 b/man/man8/bridge.8 -index 08f327b..4d5d743 100644 ---- a/man/man8/bridge.8 -+++ b/man/man8/bridge.8 -@@ -119,6 +119,10 @@ is given multiple times, the amount of information increases. - As a rule, the information is statistics or some time values. - - .TP -+.BR "\-d" , " \-details" -+print detailed information about MDB router ports. -+ -+.TP - .BR "\-n" , " \-net" , " \-netns " - switches - .B bridge -@@ -506,7 +510,7 @@ a connected router. - .PP - With the - .B -statistics --option, the command displays timer values for mdb entries. -+option, the command displays timer values for mdb and router port entries. - - .SH bridge vlan - VLAN filter list - --- -1.8.3.1 - diff --git a/SOURCES/0086-bridge-code-cleanup.patch b/SOURCES/0086-bridge-code-cleanup.patch deleted file mode 100644 index a07b3a3..0000000 --- a/SOURCES/0086-bridge-code-cleanup.patch +++ /dev/null @@ -1,313 +0,0 @@ -From 86b1bf040e1282bf95244c9c8b43c16567b6e133 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:12:38 +0100 -Subject: [PATCH] bridge: code cleanup - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit df4b043f0845e - -commit df4b043f0845eaf3534b32925c5e79970f9a95a0 -Author: Stephen Hemminger -Date: Mon Mar 21 11:56:01 2016 -0700 - - bridge: code cleanup - - Use checkpatch auto fix to cleanup lingering style issues ---- - bridge/fdb.c | 20 +++++++++++--------- - bridge/link.c | 25 +++++++++++++------------ - bridge/mdb.c | 6 +++--- - bridge/monitor.c | 13 +++++++------ - bridge/vlan.c | 9 +++++---- - 5 files changed, 39 insertions(+), 34 deletions(-) - -diff --git a/bridge/fdb.c b/bridge/fdb.c -index 0222fd6..2d2498a 100644 ---- a/bridge/fdb.c -+++ b/bridge/fdb.c -@@ -33,12 +33,12 @@ static void usage(void) - fprintf(stderr, "Usage: bridge fdb { add | append | del | replace } ADDR dev DEV\n" - " [ self ] [ master ] [ use ] [ router ]\n" - " [ local | static | dynamic ] [ dst IPADDR ] [ vlan VID ]\n" -- " [ port PORT] [ vni VNI ] [ via DEV ]\n"); -+ " [ port PORT] [ vni VNI ] [ via DEV ]\n"); - fprintf(stderr, " bridge fdb [ show [ br BRDEV ] [ brport DEV ] ]\n"); - exit(-1); - } - --static const char *state_n2a(unsigned s) -+static const char *state_n2a(unsigned int s) - { - static char buf[32]; - -@@ -63,7 +63,7 @@ int print_fdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - FILE *fp = arg; - struct ndmsg *r = NLMSG_DATA(n); - int len = n->nlmsg_len; -- struct rtattr * tb[NDA_MAX+1]; -+ struct rtattr *tb[NDA_MAX+1]; - - if (n->nlmsg_type != RTM_NEWNEIGH && n->nlmsg_type != RTM_DELNEIGH) { - fprintf(stderr, "Not RTM_NEWNEIGH: %08x %08x %08x\n", -@@ -118,6 +118,7 @@ int print_fdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - - if (tb[NDA_VLAN]) { - __u16 vid = rta_getattr_u16(tb[NDA_VLAN]); -+ - fprintf(fp, "vlan %hu ", vid); - } - -@@ -170,9 +171,9 @@ int print_fdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - static int fdb_show(int argc, char **argv) - { - struct { -- struct nlmsghdr n; -+ struct nlmsghdr n; - struct ifinfomsg ifm; -- char buf[256]; -+ char buf[256]; - } req; - - char *filter_dev = NULL; -@@ -199,6 +200,7 @@ static int fdb_show(int argc, char **argv) - - if (br) { - int br_ifindex = ll_name_to_index(br); -+ - if (br_ifindex == 0) { - fprintf(stderr, "Cannot find bridge device \"%s\"\n", br); - return -1; -@@ -234,9 +236,9 @@ static int fdb_show(int argc, char **argv) - static int fdb_modify(int cmd, int flags, int argc, char **argv) - { - struct { -- struct nlmsghdr n; -- struct ndmsg ndm; -- char buf[256]; -+ struct nlmsghdr n; -+ struct ndmsg ndm; -+ char buf[256]; - } req; - char *addr = NULL; - char *d = NULL; -@@ -297,7 +299,7 @@ static int fdb_modify(int cmd, int flags, int argc, char **argv) - req.ndm.ndm_flags |= NTF_MASTER; - } else if (matches(*argv, "router") == 0) { - req.ndm.ndm_flags |= NTF_ROUTER; -- } else if (matches(*argv, "local") == 0|| -+ } else if (matches(*argv, "local") == 0 || - matches(*argv, "permanent") == 0) { - req.ndm.ndm_state |= NUD_PERMANENT; - } else if (matches(*argv, "temp") == 0 || -diff --git a/bridge/link.c b/bridge/link.c -index a9b1262..353e1c3 100644 ---- a/bridge/link.c -+++ b/bridge/link.c -@@ -25,17 +25,17 @@ static const char *port_states[] = { - [BR_STATE_BLOCKING] = "blocking", - }; - --extern char *if_indextoname (unsigned int __ifindex, char *__ifname); -+extern char *if_indextoname(unsigned int __ifindex, char *__ifname); - --static void print_link_flags(FILE *fp, unsigned flags) -+static void print_link_flags(FILE *fp, unsigned int flags) - { - fprintf(fp, "<"); - if (flags & IFF_UP && !(flags & IFF_RUNNING)) - fprintf(fp, "NO-CARRIER%s", flags ? "," : ""); - flags &= ~IFF_RUNNING; - #define _PF(f) if (flags&IFF_##f) { \ -- flags &= ~IFF_##f ; \ -- fprintf(fp, #f "%s", flags ? "," : ""); } -+ flags &= ~IFF_##f ; \ -+ fprintf(fp, #f "%s", flags ? "," : ""); } - _PF(LOOPBACK); - _PF(BROADCAST); - _PF(POINTOPOINT); -@@ -55,7 +55,7 @@ static void print_link_flags(FILE *fp, unsigned flags) - _PF(DORMANT); - _PF(ECHO); - #undef _PF -- if (flags) -+ if (flags) - fprintf(fp, "%x", flags); - fprintf(fp, "> "); - } -@@ -69,7 +69,7 @@ static const char *hw_mode[] = {"VEB", "VEPA"}; - - static void print_operstate(FILE *f, __u8 state) - { -- if (state >= sizeof(oper_states)/sizeof(oper_states[0])) -+ if (state >= ARRAY_SIZE(oper_states)) - fprintf(f, "state %#x ", state); - else - fprintf(f, "state %s ", oper_states[state]); -@@ -90,7 +90,7 @@ static void print_onoff(FILE *f, char *flag, __u8 val) - - static void print_hwmode(FILE *f, __u16 mode) - { -- if (mode >= sizeof(hw_mode)/sizeof(hw_mode[0])) -+ if (mode >= ARRAY_SIZE(hw_mode)) - fprintf(f, "hwmode %#hx ", mode); - else - fprintf(f, "hwmode %s ", hw_mode[mode]); -@@ -102,14 +102,14 @@ int print_linkinfo(const struct sockaddr_nl *who, - FILE *fp = arg; - int len = n->nlmsg_len; - struct ifinfomsg *ifi = NLMSG_DATA(n); -- struct rtattr * tb[IFLA_MAX+1]; -+ struct rtattr *tb[IFLA_MAX+1]; - char b1[IFNAMSIZ]; - - len -= NLMSG_LENGTH(sizeof(*ifi)); - if (len < 0) { - fprintf(stderr, "Message too short!\n"); - return -1; -- } -+ } - - if (!(ifi->ifi_family == AF_BRIDGE || ifi->ifi_family == AF_UNSPEC)) - return 0; -@@ -136,6 +136,7 @@ int print_linkinfo(const struct sockaddr_nl *who, - if (tb[IFLA_LINK]) { - SPRINT_BUF(b1); - int iflink = rta_getattr_u32(tb[IFLA_LINK]); -+ - if (iflink == 0) - fprintf(fp, "@NONE: "); - else -@@ -220,7 +221,7 @@ static void usage(void) - { - fprintf(stderr, "Usage: bridge link set dev DEV [ cost COST ] [ priority PRIO ] [ state STATE ]\n"); - fprintf(stderr, " [ guard {on | off} ]\n"); -- fprintf(stderr, " [ hairpin {on | off} ] \n"); -+ fprintf(stderr, " [ hairpin {on | off} ]\n"); - fprintf(stderr, " [ fastleave {on | off} ]\n"); - fprintf(stderr, " [ root_block {on | off} ]\n"); - fprintf(stderr, " [ learning {on | off} ]\n"); -@@ -319,6 +320,7 @@ static int brlink_modify(int argc, char **argv) - NEXT_ARG(); - char *endptr; - size_t nstates = sizeof(port_states) / sizeof(*port_states); -+ - state = strtol(*argv, &endptr, 10); - if (!(**argv != '\0' && *endptr == '\0')) { - for (state = 0; state < nstates; state++) -@@ -339,8 +341,7 @@ static int brlink_modify(int argc, char **argv) - mode = BRIDGE_MODE_VEB; - else { - fprintf(stderr, -- "Mode argument must be \"vepa\" or " -- "\"veb\".\n"); -+ "Mode argument must be \"vepa\" or \"veb\".\n"); - return -1; - } - } else if (strcmp(*argv, "self") == 0) { -diff --git a/bridge/mdb.c b/bridge/mdb.c -index 97da4dc..842536e 100644 ---- a/bridge/mdb.c -+++ b/bridge/mdb.c -@@ -21,7 +21,7 @@ - - #ifndef MDBA_RTA - #define MDBA_RTA(r) \ -- ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct br_port_msg)))) -+ ((struct rtattr *)(((char *)(r)) + NLMSG_ALIGN(sizeof(struct br_port_msg)))) - #endif - - static unsigned int filter_index; -@@ -224,9 +224,9 @@ static int mdb_show(int argc, char **argv) - static int mdb_modify(int cmd, int flags, int argc, char **argv) - { - struct { -- struct nlmsghdr n; -+ struct nlmsghdr n; - struct br_port_msg bpm; -- char buf[1024]; -+ char buf[1024]; - } req; - struct br_mdb_entry entry; - char *d = NULL, *p = NULL, *grp = NULL; -diff --git a/bridge/monitor.c b/bridge/monitor.c -index 590de76..987257c 100644 ---- a/bridge/monitor.c -+++ b/bridge/monitor.c -@@ -86,10 +86,10 @@ static int accept_msg(const struct sockaddr_nl *who, - int do_monitor(int argc, char **argv) - { - char *file = NULL; -- unsigned groups = ~RTMGRP_TC; -- int llink=0; -- int lneigh=0; -- int lmdb=0; -+ unsigned int groups = ~RTMGRP_TC; -+ int llink = 0; -+ int lneigh = 0; -+ int lmdb = 0; - - rtnl_close(&rth); - -@@ -98,7 +98,7 @@ int do_monitor(int argc, char **argv) - NEXT_ARG(); - file = *argv; - } else if (matches(*argv, "link") == 0) { -- llink=1; -+ llink = 1; - groups = 0; - } else if (matches(*argv, "fdb") == 0) { - lneigh = 1; -@@ -108,7 +108,7 @@ int do_monitor(int argc, char **argv) - groups = 0; - } else if (strcmp(*argv, "all") == 0) { - groups = ~RTMGRP_TC; -- prefix_banner=1; -+ prefix_banner = 1; - } else if (matches(*argv, "help") == 0) { - usage(); - } else { -@@ -132,6 +132,7 @@ int do_monitor(int argc, char **argv) - if (file) { - FILE *fp; - int err; -+ - fp = fopen(file, "r"); - if (fp == NULL) { - perror("Cannot fopen"); -diff --git a/bridge/vlan.c b/bridge/vlan.c -index ac2f523..ae58832 100644 ---- a/bridge/vlan.c -+++ b/bridge/vlan.c -@@ -26,9 +26,9 @@ static void usage(void) - static int vlan_modify(int cmd, int argc, char **argv) - { - struct { -- struct nlmsghdr n; -- struct ifinfomsg ifm; -- char buf[1024]; -+ struct nlmsghdr n; -+ struct ifinfomsg ifm; -+ char buf[1024]; - } req; - char *d = NULL; - short vid = -1; -@@ -51,6 +51,7 @@ static int vlan_modify(int cmd, int argc, char **argv) - d = *argv; - } else if (strcmp(*argv, "vid") == 0) { - char *p; -+ - NEXT_ARG(); - p = strchr(*argv, '-'); - if (p) { -@@ -144,7 +145,7 @@ static int print_vlan(const struct sockaddr_nl *who, - FILE *fp = arg; - struct ifinfomsg *ifm = NLMSG_DATA(n); - int len = n->nlmsg_len; -- struct rtattr * tb[IFLA_MAX+1]; -+ struct rtattr *tb[IFLA_MAX+1]; - - if (n->nlmsg_type != RTM_NEWLINK) { - fprintf(stderr, "Not RTM_NEWLINK: %08x %08x %08x\n", --- -1.8.3.1 - diff --git a/SOURCES/0087-bridge-fdb-add-support-to-filter-by-vlan-id.patch b/SOURCES/0087-bridge-fdb-add-support-to-filter-by-vlan-id.patch deleted file mode 100644 index 54bc4a7..0000000 --- a/SOURCES/0087-bridge-fdb-add-support-to-filter-by-vlan-id.patch +++ /dev/null @@ -1,99 +0,0 @@ -From a6192164b9d05f22e93266f63ec090a910930f29 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:12:44 +0100 -Subject: [PATCH] bridge: fdb: add support to filter by vlan id - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit ae6eb9075fdfe - -commit ae6eb9075fdfe1bf0804c9a9315a37e111e8e293 -Author: Nikolay Aleksandrov -Date: Mon Apr 11 17:45:14 2016 +0200 - - bridge: fdb: add support to filter by vlan id - - Add the optional keyword "vlan" to bridge fdb show so the user can request - filtering by a specific vlan id. Currently the filtering is implemented - only in user-space. The argument name has been chosen to match the - add/del one - "vlan". - - Example: - $ bridge fdb show vlan 400 - 52:54:00:bf:57:16 dev eth2 vlan 400 master br0 permanent - - Signed-off-by: Nikolay Aleksandrov ---- - bridge/fdb.c | 21 +++++++++++++++------ - 1 file changed, 15 insertions(+), 6 deletions(-) - -diff --git a/bridge/fdb.c b/bridge/fdb.c -index 2d2498a..d184f7e 100644 ---- a/bridge/fdb.c -+++ b/bridge/fdb.c -@@ -26,7 +26,7 @@ - #include "rt_names.h" - #include "utils.h" - --static unsigned int filter_index; -+static unsigned int filter_index, filter_vlan; - - static void usage(void) - { -@@ -34,7 +34,7 @@ static void usage(void) - " [ self ] [ master ] [ use ] [ router ]\n" - " [ local | static | dynamic ] [ dst IPADDR ] [ vlan VID ]\n" - " [ port PORT] [ vni VNI ] [ via DEV ]\n"); -- fprintf(stderr, " bridge fdb [ show [ br BRDEV ] [ brport DEV ] ]\n"); -+ fprintf(stderr, " bridge fdb [ show [ br BRDEV ] [ brport DEV ] [ vlan VID ] ]\n"); - exit(-1); - } - -@@ -64,6 +64,7 @@ int print_fdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - struct ndmsg *r = NLMSG_DATA(n); - int len = n->nlmsg_len; - struct rtattr *tb[NDA_MAX+1]; -+ __u16 vid = 0; - - if (n->nlmsg_type != RTM_NEWNEIGH && n->nlmsg_type != RTM_DELNEIGH) { - fprintf(stderr, "Not RTM_NEWNEIGH: %08x %08x %08x\n", -@@ -87,6 +88,12 @@ int print_fdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - parse_rtattr(tb, NDA_MAX, NDA_RTA(r), - n->nlmsg_len - NLMSG_LENGTH(sizeof(*r))); - -+ if (tb[NDA_VLAN]) -+ vid = rta_getattr_u16(tb[NDA_VLAN]); -+ -+ if (filter_vlan && filter_vlan != vid) -+ return 0; -+ - if (n->nlmsg_type == RTM_DELNEIGH) - fprintf(fp, "Deleted "); - -@@ -116,11 +123,8 @@ int print_fdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - abuf, sizeof(abuf))); - } - -- if (tb[NDA_VLAN]) { -- __u16 vid = rta_getattr_u16(tb[NDA_VLAN]); -- -+ if (vid) - fprintf(fp, "vlan %hu ", vid); -- } - - if (tb[NDA_PORT]) - fprintf(fp, "port %d ", ntohs(rta_getattr_u16(tb[NDA_PORT]))); -@@ -191,6 +195,11 @@ static int fdb_show(int argc, char **argv) - } else if (strcmp(*argv, "br") == 0) { - NEXT_ARG(); - br = *argv; -+ } else if (strcmp(*argv, "vlan") == 0) { -+ NEXT_ARG(); -+ if (filter_vlan) -+ duparg("vlan", *argv); -+ filter_vlan = atoi(*argv); - } else { - if (matches(*argv, "help") == 0) - usage(); --- -1.8.3.1 - diff --git a/SOURCES/0088-bridge-mdb-add-support-to-filter-by-vlan-id.patch b/SOURCES/0088-bridge-mdb-add-support-to-filter-by-vlan-id.patch deleted file mode 100644 index d7986d5..0000000 --- a/SOURCES/0088-bridge-mdb-add-support-to-filter-by-vlan-id.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 1cb87286da87c759ec99bc6833ae177a3141ac73 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:12:44 +0100 -Subject: [PATCH] bridge: mdb: add support to filter by vlan id - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 24687d678fd54 - -commit 24687d678fd540c554f76dd43a06933ba1ca5c7d -Author: Nikolay Aleksandrov -Date: Mon Apr 11 17:45:15 2016 +0200 - - bridge: mdb: add support to filter by vlan id - - Add the optional keyword "vid" to bridge mdb show so the user can - request filtering by a specific vlan id. Currently the filtering is - implemented only in user-space. The argument name has been chosen to match - the add/del one - "vid". - - Example: - $ bridge mdb show vid 200 - dev br0 port eth2 grp 239.0.0.1 permanent vid 200 - - Signed-off-by: Nikolay Aleksandrov ---- - bridge/mdb.c | 11 +++++++++-- - 1 file changed, 9 insertions(+), 2 deletions(-) - -diff --git a/bridge/mdb.c b/bridge/mdb.c -index 842536e..6c904f8 100644 ---- a/bridge/mdb.c -+++ b/bridge/mdb.c -@@ -24,12 +24,12 @@ - ((struct rtattr *)(((char *)(r)) + NLMSG_ALIGN(sizeof(struct br_port_msg)))) - #endif - --static unsigned int filter_index; -+static unsigned int filter_index, filter_vlan; - - static void usage(void) - { - fprintf(stderr, "Usage: bridge mdb { add | del } dev DEV port PORT grp GROUP [permanent | temp] [vid VID]\n"); -- fprintf(stderr, " bridge mdb {show} [ dev DEV ]\n"); -+ fprintf(stderr, " bridge mdb {show} [ dev DEV ] [ vid VID ]\n"); - exit(-1); - } - -@@ -92,6 +92,8 @@ static void print_mdb_entry(FILE *f, int ifindex, struct br_mdb_entry *e, - const void *src; - int af; - -+ if (filter_vlan && e->vid != filter_vlan) -+ return; - af = e->addr.proto == htons(ETH_P_IP) ? AF_INET : AF_INET6; - src = af == AF_INET ? (const void *)&e->addr.u.ip4 : - (const void *)&e->addr.u.ip6; -@@ -195,6 +197,11 @@ static int mdb_show(int argc, char **argv) - if (filter_dev) - duparg("dev", *argv); - filter_dev = *argv; -+ } else if (strcmp(*argv, "vid") == 0) { -+ NEXT_ARG(); -+ if (filter_vlan) -+ duparg("vid", *argv); -+ filter_vlan = atoi(*argv); - } - argc--; argv++; - } --- -1.8.3.1 - diff --git a/SOURCES/0089-bridge-vlan-add-support-to-filter-by-vlan-id.patch b/SOURCES/0089-bridge-vlan-add-support-to-filter-by-vlan-id.patch deleted file mode 100644 index b7c55a7..0000000 --- a/SOURCES/0089-bridge-vlan-add-support-to-filter-by-vlan-id.patch +++ /dev/null @@ -1,162 +0,0 @@ -From e139f3f1d7f669edea662b9f847faee30f2c5f6c Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:12:44 +0100 -Subject: [PATCH] bridge: vlan: add support to filter by vlan id - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 5a2d0201cce16 - -commit 5a2d0201cce161617b30102d10b709fa24c6e833 -Author: Nikolay Aleksandrov -Date: Mon Apr 11 17:45:16 2016 +0200 - - bridge: vlan: add support to filter by vlan id - - Add the optional keyword "vid" to bridge vlan show so the user can - request filtering by a specific vlan id. Currently the filtering is - implemented only in user-space. The argument name has been chosen to - match the add/del one - "vid". This filtering can be used also with the - "-compressvlans" option to see in which range is a vlan (if in any). - Also this will be used to show only specific per-vlan statistics later - when support is added to the kernel for it. - - Examples: - $ bridge vlan show vid 450 - port vlan ids - eth2 450 - - $ bridge -c vlan show vid 450 - port vlan ids - eth2 400-500 - - $ bridge vlan show vid 1 - port vlan ids - eth1 1 PVID Egress Untagged - eth2 1 PVID - br0 1 PVID Egress Untagged - - Signed-off-by: Nikolay Aleksandrov ---- - bridge/vlan.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++++---------- - 1 file changed, 50 insertions(+), 10 deletions(-) - -diff --git a/bridge/vlan.c b/bridge/vlan.c -index ae58832..717025a 100644 ---- a/bridge/vlan.c -+++ b/bridge/vlan.c -@@ -13,13 +13,13 @@ - #include "br_common.h" - #include "utils.h" - --static unsigned int filter_index; -+static unsigned int filter_index, filter_vlan; - - static void usage(void) - { - fprintf(stderr, "Usage: bridge vlan { add | del } vid VLAN_ID dev DEV [ pvid] [ untagged ]\n"); - fprintf(stderr, " [ self ] [ master ]\n"); -- fprintf(stderr, " bridge vlan { show } [ dev DEV ]\n"); -+ fprintf(stderr, " bridge vlan { show } [ dev DEV ] [ vid VLAN_ID ]\n"); - exit(-1); - } - -@@ -138,6 +138,26 @@ static int vlan_modify(int cmd, int argc, char **argv) - return 0; - } - -+/* In order to use this function for both filtering and non-filtering cases -+ * we need to make it a tristate: -+ * return -1 - if filtering we've gone over so don't continue -+ * return 0 - skip entry and continue (applies to range start or to entries -+ * which are less than filter_vlan) -+ * return 1 - print the entry and continue -+ */ -+static int filter_vlan_check(struct bridge_vlan_info *vinfo) -+{ -+ /* if we're filtering we should stop on the first greater entry */ -+ if (filter_vlan && vinfo->vid > filter_vlan && -+ !(vinfo->flags & BRIDGE_VLAN_INFO_RANGE_END)) -+ return -1; -+ if ((vinfo->flags & BRIDGE_VLAN_INFO_RANGE_BEGIN) || -+ vinfo->vid < filter_vlan) -+ return 0; -+ -+ return 1; -+} -+ - static int print_vlan(const struct sockaddr_nl *who, - struct nlmsghdr *n, - void *arg) -@@ -169,26 +189,40 @@ static int print_vlan(const struct sockaddr_nl *who, - - /* if AF_SPEC isn't there, vlan table is not preset for this port */ - if (!tb[IFLA_AF_SPEC]) { -- fprintf(fp, "%s\tNone\n", ll_index_to_name(ifm->ifi_index)); -+ if (!filter_vlan) -+ fprintf(fp, "%s\tNone\n", -+ ll_index_to_name(ifm->ifi_index)); - return 0; - } else { - struct rtattr *i, *list = tb[IFLA_AF_SPEC]; - int rem = RTA_PAYLOAD(list); -+ __u16 last_vid_start = 0; - -- fprintf(fp, "%s", ll_index_to_name(ifm->ifi_index)); -+ if (!filter_vlan) -+ fprintf(fp, "%s", ll_index_to_name(ifm->ifi_index)); - for (i = RTA_DATA(list); RTA_OK(i, rem); i = RTA_NEXT(i, rem)) { - struct bridge_vlan_info *vinfo; -+ int vcheck_ret; - - if (i->rta_type != IFLA_BRIDGE_VLAN_INFO) - continue; - - vinfo = RTA_DATA(i); -- if (vinfo->flags & BRIDGE_VLAN_INFO_RANGE_END) -- fprintf(fp, "-%hu", vinfo->vid); -- else -- fprintf(fp, "\t %hu", vinfo->vid); -- if (vinfo->flags & BRIDGE_VLAN_INFO_RANGE_BEGIN) -+ -+ if (!(vinfo->flags & BRIDGE_VLAN_INFO_RANGE_END)) -+ last_vid_start = vinfo->vid; -+ vcheck_ret = filter_vlan_check(vinfo); -+ if (vcheck_ret == -1) -+ break; -+ else if (vcheck_ret == 0) - continue; -+ -+ if (filter_vlan) -+ fprintf(fp, "%s", -+ ll_index_to_name(ifm->ifi_index)); -+ fprintf(fp, "\t %hu", last_vid_start); -+ if (last_vid_start != vinfo->vid) -+ fprintf(fp, "-%hu", vinfo->vid); - if (vinfo->flags & BRIDGE_VLAN_INFO_PVID) - fprintf(fp, " PVID"); - if (vinfo->flags & BRIDGE_VLAN_INFO_UNTAGGED) -@@ -196,7 +230,8 @@ static int print_vlan(const struct sockaddr_nl *who, - fprintf(fp, "\n"); - } - } -- fprintf(fp, "\n"); -+ if (!filter_vlan) -+ fprintf(fp, "\n"); - fflush(fp); - return 0; - } -@@ -211,6 +246,11 @@ static int vlan_show(int argc, char **argv) - if (filter_dev) - duparg("dev", *argv); - filter_dev = *argv; -+ } else if (strcmp(*argv, "vid") == 0) { -+ NEXT_ARG(); -+ if (filter_vlan) -+ duparg("vid", *argv); -+ filter_vlan = atoi(*argv); - } - argc--; argv++; - } --- -1.8.3.1 - diff --git a/SOURCES/0090-bridge-vlan-fix-a-few-fdb-typos-in-vlan-doc.patch b/SOURCES/0090-bridge-vlan-fix-a-few-fdb-typos-in-vlan-doc.patch deleted file mode 100644 index d5cbf9b..0000000 --- a/SOURCES/0090-bridge-vlan-fix-a-few-fdb-typos-in-vlan-doc.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 5445d3424bd41eb6c1296a48104095777d44204d Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:12:44 +0100 -Subject: [PATCH] bridge: vlan: fix a few "fdb" typos in vlan doc - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 296cee6fdfaab - -commit 296cee6fdfaabfbf29a9f6bbf106c83c82c1d838 -Author: Vivien Didelot -Date: Tue Jun 21 15:28:26 2016 -0400 - - bridge: vlan: fix a few "fdb" typos in vlan doc - - Signed-off-by: Vivien Didelot ---- - bridge/vlan.c | 2 +- - man/man8/bridge.8 | 4 ++-- - 2 files changed, 3 insertions(+), 3 deletions(-) - -diff --git a/bridge/vlan.c b/bridge/vlan.c -index 717025a..a8a2e1d 100644 ---- a/bridge/vlan.c -+++ b/bridge/vlan.c -@@ -299,6 +299,6 @@ int do_vlan(int argc, char **argv) - } else - return vlan_show(0, NULL); - -- fprintf(stderr, "Command \"%s\" is unknown, try \"bridge fdb help\".\n", *argv); -+ fprintf(stderr, "Command \"%s\" is unknown, try \"bridge vlan help\".\n", *argv); - exit(-1); - } -diff --git a/man/man8/bridge.8 b/man/man8/bridge.8 -index 4d5d743..3024eb2 100644 ---- a/man/man8/bridge.8 -+++ b/man/man8/bridge.8 -@@ -551,8 +551,8 @@ device is the bridge device. - .BI master - the vlan is configured on the software bridge (default). - --.SS bridge vlan delete - delete a forwarding database entry --This command removes an existing fdb entry. -+.SS bridge vlan delete - delete a vlan filter entry -+This command removes an existing vlan filter entry. - - .PP - The arguments are the same as with --- -1.8.3.1 - diff --git a/SOURCES/0091-bridge-man-fix-brige-typo.patch b/SOURCES/0091-bridge-man-fix-brige-typo.patch deleted file mode 100644 index 79d4c41..0000000 --- a/SOURCES/0091-bridge-man-fix-brige-typo.patch +++ /dev/null @@ -1,35 +0,0 @@ -From c3556926885b1ed7bf587c3b52ae4000ef5d7994 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:12:44 +0100 -Subject: [PATCH] bridge: man: fix "brige" typo - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 7fab22abd1ff6 - -commit 7fab22abd1ff6c8e8d4e5cd3602d7c28a3fa98de -Author: Vivien Didelot -Date: Tue Jun 21 15:28:50 2016 -0400 - - bridge: man: fix "brige" typo - - Signed-off-by: Vivien Didelot ---- - man/man8/bridge.8 | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/man/man8/bridge.8 b/man/man8/bridge.8 -index 3024eb2..d654e1c 100644 ---- a/man/man8/bridge.8 -+++ b/man/man8/bridge.8 -@@ -234,7 +234,7 @@ error. - .sp - - .B 1 --- STP LISTENING state. Only valid if STP is enabled on the brige. In this -+- STP LISTENING state. Only valid if STP is enabled on the bridge. In this - state the port for list for STP BPDUs and drop all other traffic. - .sp - --- -1.8.3.1 - diff --git a/SOURCES/0092-bridge-man-fix-BPUD-typo.patch b/SOURCES/0092-bridge-man-fix-BPUD-typo.patch deleted file mode 100644 index 2d9bcf3..0000000 --- a/SOURCES/0092-bridge-man-fix-BPUD-typo.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 12eec28475af5e65ceb63734ac57f6cf453e2c79 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:12:44 +0100 -Subject: [PATCH] bridge: man: fix BPUD typo - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 400b5404af35f - -commit 400b5404af35f58f501780663693886d37c2061e -Author: Vivien Didelot -Date: Wed Jun 29 15:26:10 2016 -0400 - - bridge: man: fix BPUD typo - - s/BPUD/BPDU/ in guard description. - - Signed-off-by: Vivien Didelot ---- - man/man8/bridge.8 | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/man/man8/bridge.8 b/man/man8/bridge.8 -index d654e1c..bf9c2c1 100644 ---- a/man/man8/bridge.8 -+++ b/man/man8/bridge.8 -@@ -256,7 +256,7 @@ STP BPDUs. - - .TP - .BR "guard on " or " guard off " --Controls whether STP BPUDs will be processed by the bridge port. By default, -+Controls whether STP BPDUs will be processed by the bridge port. By default, - the flag is turned off allowed BPDU processing. Turning this flag on will - cause the port to stop processing STP BPDUs. - --- -1.8.3.1 - diff --git a/SOURCES/0093-bridge-man-fix-STP-LISTENING-description.patch b/SOURCES/0093-bridge-man-fix-STP-LISTENING-description.patch deleted file mode 100644 index fb61898..0000000 --- a/SOURCES/0093-bridge-man-fix-STP-LISTENING-description.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 98a6989361034f7b1687e01252fc04daf692b992 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:12:45 +0100 -Subject: [PATCH] bridge: man: fix STP LISTENING description - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 3aa8f8cb7af95 - -commit 3aa8f8cb7af952bd09efb7ec6d4f3f0507ada16a -Author: Vivien Didelot -Date: Wed Jun 29 15:26:29 2016 -0400 - - bridge: man: fix STP LISTENING description - - Correct the unclear and poorly conjugated STP LISTENING documentation. - - Signed-off-by: Vivien Didelot ---- - man/man8/bridge.8 | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/man/man8/bridge.8 b/man/man8/bridge.8 -index bf9c2c1..c09b8c3 100644 ---- a/man/man8/bridge.8 -+++ b/man/man8/bridge.8 -@@ -235,7 +235,7 @@ error. - - .B 1 - - STP LISTENING state. Only valid if STP is enabled on the bridge. In this --state the port for list for STP BPDUs and drop all other traffic. -+state the port listens for STP BPDUs and drops all other traffic frames. - .sp - - .B 2 --- -1.8.3.1 - diff --git a/SOURCES/0094-RH-INTERNAL-Update-kernel-headers-to-v4.10.0.patch b/SOURCES/0094-RH-INTERNAL-Update-kernel-headers-to-v4.10.0.patch deleted file mode 100644 index c608274..0000000 --- a/SOURCES/0094-RH-INTERNAL-Update-kernel-headers-to-v4.10.0.patch +++ /dev/null @@ -1,2769 +0,0 @@ -From be29df0107ec0cdc9c8d0b8ed4ada5380fefe570 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:12:45 +0100 -Subject: [PATCH] RH-INTERNAL: Update kernel headers to v4.10.0 - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: RHEL only. - -Obtained using the following command: -$ git checkout v4.10.0 -- include/linux ---- - include/linux/bpf.h | 571 ++++++++++++++++++++++++----------- - include/linux/can.h | 1 + - include/linux/devlink.h | 16 + - include/linux/fib_rules.h | 8 + - include/linux/gen_stats.h | 1 + - include/linux/genetlink.h | 3 +- - include/linux/if.h | 4 +- - include/linux/if_alg.h | 42 +++ - include/linux/if_bonding.h | 130 ++++++++ - include/linux/if_bridge.h | 47 +++ - include/linux/if_ether.h | 5 + - include/linux/if_link.h | 112 ++++++- - include/linux/if_packet.h | 301 ++++++++++++++++++ - include/linux/if_tunnel.h | 21 +- - include/linux/ila.h | 8 + - include/linux/in.h | 1 + - include/linux/in6.h | 2 + - include/linux/inet_diag.h | 42 ++- - include/linux/l2tp.h | 28 +- - include/linux/libc-compat.h | 28 +- - include/linux/lwtunnel.h | 26 ++ - include/linux/neighbour.h | 2 + - include/linux/netfilter.h | 2 +- - include/linux/netlink_diag.h | 1 + - include/linux/pkt_cls.h | 76 ++++- - include/linux/pkt_sched.h | 11 +- - include/linux/rtnetlink.h | 10 +- - include/linux/sock_diag.h | 1 + - include/linux/tc_act/tc_bpf.h | 2 + - include/linux/tc_act/tc_connmark.h | 1 + - include/linux/tc_act/tc_csum.h | 1 + - include/linux/tc_act/tc_defact.h | 1 + - include/linux/tc_act/tc_gact.h | 1 + - include/linux/tc_act/tc_ife.h | 4 +- - include/linux/tc_act/tc_ipt.h | 1 + - include/linux/tc_act/tc_mirred.h | 1 + - include/linux/tc_act/tc_nat.h | 1 + - include/linux/tc_act/tc_pedit.h | 1 + - include/linux/tc_act/tc_skbedit.h | 5 + - include/linux/tc_act/tc_tunnel_key.h | 42 +++ - include/linux/tc_act/tc_vlan.h | 3 + - include/linux/tcp.h | 25 ++ - include/linux/tcp_metrics.h | 1 + - include/linux/tipc.h | 30 +- - include/linux/tipc_netlink.h | 41 +++ - include/linux/types.h | 4 - - include/linux/xfrm.h | 3 +- - 47 files changed, 1470 insertions(+), 198 deletions(-) - create mode 100644 include/linux/if_alg.h - create mode 100644 include/linux/if_bonding.h - create mode 100644 include/linux/if_packet.h - create mode 100644 include/linux/tc_act/tc_tunnel_key.h - -diff --git a/include/linux/bpf.h b/include/linux/bpf.h -index 0f5d6f5..2d45228 100644 ---- a/include/linux/bpf.h -+++ b/include/linux/bpf.h -@@ -73,6 +73,8 @@ enum bpf_cmd { - BPF_PROG_LOAD, - BPF_OBJ_PIN, - BPF_OBJ_GET, -+ BPF_PROG_ATTACH, -+ BPF_PROG_DETACH, - }; - - enum bpf_map_type { -@@ -84,6 +86,9 @@ enum bpf_map_type { - BPF_MAP_TYPE_PERCPU_HASH, - BPF_MAP_TYPE_PERCPU_ARRAY, - BPF_MAP_TYPE_STACK_TRACE, -+ BPF_MAP_TYPE_CGROUP_ARRAY, -+ BPF_MAP_TYPE_LRU_HASH, -+ BPF_MAP_TYPE_LRU_PERCPU_HASH, - }; - - enum bpf_prog_type { -@@ -92,8 +97,31 @@ enum bpf_prog_type { - BPF_PROG_TYPE_KPROBE, - BPF_PROG_TYPE_SCHED_CLS, - BPF_PROG_TYPE_SCHED_ACT, -+ BPF_PROG_TYPE_TRACEPOINT, -+ BPF_PROG_TYPE_XDP, -+ BPF_PROG_TYPE_PERF_EVENT, -+ BPF_PROG_TYPE_CGROUP_SKB, -+ BPF_PROG_TYPE_CGROUP_SOCK, -+ BPF_PROG_TYPE_LWT_IN, -+ BPF_PROG_TYPE_LWT_OUT, -+ BPF_PROG_TYPE_LWT_XMIT, - }; - -+enum bpf_attach_type { -+ BPF_CGROUP_INET_INGRESS, -+ BPF_CGROUP_INET_EGRESS, -+ BPF_CGROUP_INET_SOCK_CREATE, -+ __MAX_BPF_ATTACH_TYPE -+}; -+ -+#define MAX_BPF_ATTACH_TYPE __MAX_BPF_ATTACH_TYPE -+ -+/* If BPF_F_ALLOW_OVERRIDE flag is used in BPF_PROG_ATTACH command -+ * to the given target_fd cgroup the descendent cgroup will be able to -+ * override effective bpf program that was inherited from this cgroup -+ */ -+#define BPF_F_ALLOW_OVERRIDE (1U << 0) -+ - #define BPF_PSEUDO_MAP_FD 1 - - /* flags for BPF_MAP_UPDATE_ELEM command */ -@@ -102,6 +130,13 @@ enum bpf_prog_type { - #define BPF_EXIST 2 /* update existing element */ - - #define BPF_F_NO_PREALLOC (1U << 0) -+/* Instead of having one common LRU list in the -+ * BPF_MAP_TYPE_LRU_[PERCPU_]HASH map, use a percpu LRU list -+ * which can scale and perform better. -+ * Note, the LRU nodes (including free nodes) cannot be moved -+ * across different LRU lists. -+ */ -+#define BPF_F_NO_COMMON_LRU (1U << 1) - - union bpf_attr { - struct { /* anonymous struct used by BPF_MAP_CREATE command */ -@@ -137,183 +172,328 @@ union bpf_attr { - __aligned_u64 pathname; - __u32 bpf_fd; - }; -+ -+ struct { /* anonymous struct used by BPF_PROG_ATTACH/DETACH commands */ -+ __u32 target_fd; /* container object to attach to */ -+ __u32 attach_bpf_fd; /* eBPF program to attach */ -+ __u32 attach_type; -+ __u32 attach_flags; -+ }; - } __attribute__((aligned(8))); - -+/* BPF helper function descriptions: -+ * -+ * void *bpf_map_lookup_elem(&map, &key) -+ * Return: Map value or NULL -+ * -+ * int bpf_map_update_elem(&map, &key, &value, flags) -+ * Return: 0 on success or negative error -+ * -+ * int bpf_map_delete_elem(&map, &key) -+ * Return: 0 on success or negative error -+ * -+ * int bpf_probe_read(void *dst, int size, void *src) -+ * Return: 0 on success or negative error -+ * -+ * u64 bpf_ktime_get_ns(void) -+ * Return: current ktime -+ * -+ * int bpf_trace_printk(const char *fmt, int fmt_size, ...) -+ * Return: length of buffer written or negative error -+ * -+ * u32 bpf_prandom_u32(void) -+ * Return: random value -+ * -+ * u32 bpf_raw_smp_processor_id(void) -+ * Return: SMP processor ID -+ * -+ * int bpf_skb_store_bytes(skb, offset, from, len, flags) -+ * store bytes into packet -+ * @skb: pointer to skb -+ * @offset: offset within packet from skb->mac_header -+ * @from: pointer where to copy bytes from -+ * @len: number of bytes to store into packet -+ * @flags: bit 0 - if true, recompute skb->csum -+ * other bits - reserved -+ * Return: 0 on success or negative error -+ * -+ * int bpf_l3_csum_replace(skb, offset, from, to, flags) -+ * recompute IP checksum -+ * @skb: pointer to skb -+ * @offset: offset within packet where IP checksum is located -+ * @from: old value of header field -+ * @to: new value of header field -+ * @flags: bits 0-3 - size of header field -+ * other bits - reserved -+ * Return: 0 on success or negative error -+ * -+ * int bpf_l4_csum_replace(skb, offset, from, to, flags) -+ * recompute TCP/UDP checksum -+ * @skb: pointer to skb -+ * @offset: offset within packet where TCP/UDP checksum is located -+ * @from: old value of header field -+ * @to: new value of header field -+ * @flags: bits 0-3 - size of header field -+ * bit 4 - is pseudo header -+ * other bits - reserved -+ * Return: 0 on success or negative error -+ * -+ * int bpf_tail_call(ctx, prog_array_map, index) -+ * jump into another BPF program -+ * @ctx: context pointer passed to next program -+ * @prog_array_map: pointer to map which type is BPF_MAP_TYPE_PROG_ARRAY -+ * @index: index inside array that selects specific program to run -+ * Return: 0 on success or negative error -+ * -+ * int bpf_clone_redirect(skb, ifindex, flags) -+ * redirect to another netdev -+ * @skb: pointer to skb -+ * @ifindex: ifindex of the net device -+ * @flags: bit 0 - if set, redirect to ingress instead of egress -+ * other bits - reserved -+ * Return: 0 on success or negative error -+ * -+ * u64 bpf_get_current_pid_tgid(void) -+ * Return: current->tgid << 32 | current->pid -+ * -+ * u64 bpf_get_current_uid_gid(void) -+ * Return: current_gid << 32 | current_uid -+ * -+ * int bpf_get_current_comm(char *buf, int size_of_buf) -+ * stores current->comm into buf -+ * Return: 0 on success or negative error -+ * -+ * u32 bpf_get_cgroup_classid(skb) -+ * retrieve a proc's classid -+ * @skb: pointer to skb -+ * Return: classid if != 0 -+ * -+ * int bpf_skb_vlan_push(skb, vlan_proto, vlan_tci) -+ * Return: 0 on success or negative error -+ * -+ * int bpf_skb_vlan_pop(skb) -+ * Return: 0 on success or negative error -+ * -+ * int bpf_skb_get_tunnel_key(skb, key, size, flags) -+ * int bpf_skb_set_tunnel_key(skb, key, size, flags) -+ * retrieve or populate tunnel metadata -+ * @skb: pointer to skb -+ * @key: pointer to 'struct bpf_tunnel_key' -+ * @size: size of 'struct bpf_tunnel_key' -+ * @flags: room for future extensions -+ * Return: 0 on success or negative error -+ * -+ * u64 bpf_perf_event_read(&map, index) -+ * Return: Number events read or error code -+ * -+ * int bpf_redirect(ifindex, flags) -+ * redirect to another netdev -+ * @ifindex: ifindex of the net device -+ * @flags: bit 0 - if set, redirect to ingress instead of egress -+ * other bits - reserved -+ * Return: TC_ACT_REDIRECT -+ * -+ * u32 bpf_get_route_realm(skb) -+ * retrieve a dst's tclassid -+ * @skb: pointer to skb -+ * Return: realm if != 0 -+ * -+ * int bpf_perf_event_output(ctx, map, index, data, size) -+ * output perf raw sample -+ * @ctx: struct pt_regs* -+ * @map: pointer to perf_event_array map -+ * @index: index of event in the map -+ * @data: data on stack to be output as raw data -+ * @size: size of data -+ * Return: 0 on success or negative error -+ * -+ * int bpf_get_stackid(ctx, map, flags) -+ * walk user or kernel stack and return id -+ * @ctx: struct pt_regs* -+ * @map: pointer to stack_trace map -+ * @flags: bits 0-7 - numer of stack frames to skip -+ * bit 8 - collect user stack instead of kernel -+ * bit 9 - compare stacks by hash only -+ * bit 10 - if two different stacks hash into the same stackid -+ * discard old -+ * other bits - reserved -+ * Return: >= 0 stackid on success or negative error -+ * -+ * s64 bpf_csum_diff(from, from_size, to, to_size, seed) -+ * calculate csum diff -+ * @from: raw from buffer -+ * @from_size: length of from buffer -+ * @to: raw to buffer -+ * @to_size: length of to buffer -+ * @seed: optional seed -+ * Return: csum result or negative error code -+ * -+ * int bpf_skb_get_tunnel_opt(skb, opt, size) -+ * retrieve tunnel options metadata -+ * @skb: pointer to skb -+ * @opt: pointer to raw tunnel option data -+ * @size: size of @opt -+ * Return: option size -+ * -+ * int bpf_skb_set_tunnel_opt(skb, opt, size) -+ * populate tunnel options metadata -+ * @skb: pointer to skb -+ * @opt: pointer to raw tunnel option data -+ * @size: size of @opt -+ * Return: 0 on success or negative error -+ * -+ * int bpf_skb_change_proto(skb, proto, flags) -+ * Change protocol of the skb. Currently supported is v4 -> v6, -+ * v6 -> v4 transitions. The helper will also resize the skb. eBPF -+ * program is expected to fill the new headers via skb_store_bytes -+ * and lX_csum_replace. -+ * @skb: pointer to skb -+ * @proto: new skb->protocol type -+ * @flags: reserved -+ * Return: 0 on success or negative error -+ * -+ * int bpf_skb_change_type(skb, type) -+ * Change packet type of skb. -+ * @skb: pointer to skb -+ * @type: new skb->pkt_type type -+ * Return: 0 on success or negative error -+ * -+ * int bpf_skb_under_cgroup(skb, map, index) -+ * Check cgroup2 membership of skb -+ * @skb: pointer to skb -+ * @map: pointer to bpf_map in BPF_MAP_TYPE_CGROUP_ARRAY type -+ * @index: index of the cgroup in the bpf_map -+ * Return: -+ * == 0 skb failed the cgroup2 descendant test -+ * == 1 skb succeeded the cgroup2 descendant test -+ * < 0 error -+ * -+ * u32 bpf_get_hash_recalc(skb) -+ * Retrieve and possibly recalculate skb->hash. -+ * @skb: pointer to skb -+ * Return: hash -+ * -+ * u64 bpf_get_current_task(void) -+ * Returns current task_struct -+ * Return: current -+ * -+ * int bpf_probe_write_user(void *dst, void *src, int len) -+ * safely attempt to write to a location -+ * @dst: destination address in userspace -+ * @src: source address on stack -+ * @len: number of bytes to copy -+ * Return: 0 on success or negative error -+ * -+ * int bpf_current_task_under_cgroup(map, index) -+ * Check cgroup2 membership of current task -+ * @map: pointer to bpf_map in BPF_MAP_TYPE_CGROUP_ARRAY type -+ * @index: index of the cgroup in the bpf_map -+ * Return: -+ * == 0 current failed the cgroup2 descendant test -+ * == 1 current succeeded the cgroup2 descendant test -+ * < 0 error -+ * -+ * int bpf_skb_change_tail(skb, len, flags) -+ * The helper will resize the skb to the given new size, to be used f.e. -+ * with control messages. -+ * @skb: pointer to skb -+ * @len: new skb length -+ * @flags: reserved -+ * Return: 0 on success or negative error -+ * -+ * int bpf_skb_pull_data(skb, len) -+ * The helper will pull in non-linear data in case the skb is non-linear -+ * and not all of len are part of the linear section. Only needed for -+ * read/write with direct packet access. -+ * @skb: pointer to skb -+ * @len: len to make read/writeable -+ * Return: 0 on success or negative error -+ * -+ * s64 bpf_csum_update(skb, csum) -+ * Adds csum into skb->csum in case of CHECKSUM_COMPLETE. -+ * @skb: pointer to skb -+ * @csum: csum to add -+ * Return: csum on success or negative error -+ * -+ * void bpf_set_hash_invalid(skb) -+ * Invalidate current skb->hash. -+ * @skb: pointer to skb -+ * -+ * int bpf_get_numa_node_id() -+ * Return: Id of current NUMA node. -+ * -+ * int bpf_skb_change_head() -+ * Grows headroom of skb and adjusts MAC header offset accordingly. -+ * Will extends/reallocae as required automatically. -+ * May change skb data pointer and will thus invalidate any check -+ * performed for direct packet access. -+ * @skb: pointer to skb -+ * @len: length of header to be pushed in front -+ * @flags: Flags (unused for now) -+ * Return: 0 on success or negative error -+ * -+ * int bpf_xdp_adjust_head(xdp_md, delta) -+ * Adjust the xdp_md.data by delta -+ * @xdp_md: pointer to xdp_md -+ * @delta: An positive/negative integer to be added to xdp_md.data -+ * Return: 0 on success or negative on error -+ */ -+#define __BPF_FUNC_MAPPER(FN) \ -+ FN(unspec), \ -+ FN(map_lookup_elem), \ -+ FN(map_update_elem), \ -+ FN(map_delete_elem), \ -+ FN(probe_read), \ -+ FN(ktime_get_ns), \ -+ FN(trace_printk), \ -+ FN(get_prandom_u32), \ -+ FN(get_smp_processor_id), \ -+ FN(skb_store_bytes), \ -+ FN(l3_csum_replace), \ -+ FN(l4_csum_replace), \ -+ FN(tail_call), \ -+ FN(clone_redirect), \ -+ FN(get_current_pid_tgid), \ -+ FN(get_current_uid_gid), \ -+ FN(get_current_comm), \ -+ FN(get_cgroup_classid), \ -+ FN(skb_vlan_push), \ -+ FN(skb_vlan_pop), \ -+ FN(skb_get_tunnel_key), \ -+ FN(skb_set_tunnel_key), \ -+ FN(perf_event_read), \ -+ FN(redirect), \ -+ FN(get_route_realm), \ -+ FN(perf_event_output), \ -+ FN(skb_load_bytes), \ -+ FN(get_stackid), \ -+ FN(csum_diff), \ -+ FN(skb_get_tunnel_opt), \ -+ FN(skb_set_tunnel_opt), \ -+ FN(skb_change_proto), \ -+ FN(skb_change_type), \ -+ FN(skb_under_cgroup), \ -+ FN(get_hash_recalc), \ -+ FN(get_current_task), \ -+ FN(probe_write_user), \ -+ FN(current_task_under_cgroup), \ -+ FN(skb_change_tail), \ -+ FN(skb_pull_data), \ -+ FN(csum_update), \ -+ FN(set_hash_invalid), \ -+ FN(get_numa_node_id), \ -+ FN(skb_change_head), \ -+ FN(xdp_adjust_head), -+ - /* integer value in 'imm' field of BPF_CALL instruction selects which helper - * function eBPF program intends to call - */ -+#define __BPF_ENUM_FN(x) BPF_FUNC_ ## x - enum bpf_func_id { -- BPF_FUNC_unspec, -- BPF_FUNC_map_lookup_elem, /* void *map_lookup_elem(&map, &key) */ -- BPF_FUNC_map_update_elem, /* int map_update_elem(&map, &key, &value, flags) */ -- BPF_FUNC_map_delete_elem, /* int map_delete_elem(&map, &key) */ -- BPF_FUNC_probe_read, /* int bpf_probe_read(void *dst, int size, void *src) */ -- BPF_FUNC_ktime_get_ns, /* u64 bpf_ktime_get_ns(void) */ -- BPF_FUNC_trace_printk, /* int bpf_trace_printk(const char *fmt, int fmt_size, ...) */ -- BPF_FUNC_get_prandom_u32, /* u32 prandom_u32(void) */ -- BPF_FUNC_get_smp_processor_id, /* u32 raw_smp_processor_id(void) */ -- -- /** -- * skb_store_bytes(skb, offset, from, len, flags) - store bytes into packet -- * @skb: pointer to skb -- * @offset: offset within packet from skb->mac_header -- * @from: pointer where to copy bytes from -- * @len: number of bytes to store into packet -- * @flags: bit 0 - if true, recompute skb->csum -- * other bits - reserved -- * Return: 0 on success -- */ -- BPF_FUNC_skb_store_bytes, -- -- /** -- * l3_csum_replace(skb, offset, from, to, flags) - recompute IP checksum -- * @skb: pointer to skb -- * @offset: offset within packet where IP checksum is located -- * @from: old value of header field -- * @to: new value of header field -- * @flags: bits 0-3 - size of header field -- * other bits - reserved -- * Return: 0 on success -- */ -- BPF_FUNC_l3_csum_replace, -- -- /** -- * l4_csum_replace(skb, offset, from, to, flags) - recompute TCP/UDP checksum -- * @skb: pointer to skb -- * @offset: offset within packet where TCP/UDP checksum is located -- * @from: old value of header field -- * @to: new value of header field -- * @flags: bits 0-3 - size of header field -- * bit 4 - is pseudo header -- * other bits - reserved -- * Return: 0 on success -- */ -- BPF_FUNC_l4_csum_replace, -- -- /** -- * bpf_tail_call(ctx, prog_array_map, index) - jump into another BPF program -- * @ctx: context pointer passed to next program -- * @prog_array_map: pointer to map which type is BPF_MAP_TYPE_PROG_ARRAY -- * @index: index inside array that selects specific program to run -- * Return: 0 on success -- */ -- BPF_FUNC_tail_call, -- -- /** -- * bpf_clone_redirect(skb, ifindex, flags) - redirect to another netdev -- * @skb: pointer to skb -- * @ifindex: ifindex of the net device -- * @flags: bit 0 - if set, redirect to ingress instead of egress -- * other bits - reserved -- * Return: 0 on success -- */ -- BPF_FUNC_clone_redirect, -- -- /** -- * u64 bpf_get_current_pid_tgid(void) -- * Return: current->tgid << 32 | current->pid -- */ -- BPF_FUNC_get_current_pid_tgid, -- -- /** -- * u64 bpf_get_current_uid_gid(void) -- * Return: current_gid << 32 | current_uid -- */ -- BPF_FUNC_get_current_uid_gid, -- -- /** -- * bpf_get_current_comm(char *buf, int size_of_buf) -- * stores current->comm into buf -- * Return: 0 on success -- */ -- BPF_FUNC_get_current_comm, -- -- /** -- * bpf_get_cgroup_classid(skb) - retrieve a proc's classid -- * @skb: pointer to skb -- * Return: classid if != 0 -- */ -- BPF_FUNC_get_cgroup_classid, -- BPF_FUNC_skb_vlan_push, /* bpf_skb_vlan_push(skb, vlan_proto, vlan_tci) */ -- BPF_FUNC_skb_vlan_pop, /* bpf_skb_vlan_pop(skb) */ -- -- /** -- * bpf_skb_[gs]et_tunnel_key(skb, key, size, flags) -- * retrieve or populate tunnel metadata -- * @skb: pointer to skb -- * @key: pointer to 'struct bpf_tunnel_key' -- * @size: size of 'struct bpf_tunnel_key' -- * @flags: room for future extensions -- * Retrun: 0 on success -- */ -- BPF_FUNC_skb_get_tunnel_key, -- BPF_FUNC_skb_set_tunnel_key, -- BPF_FUNC_perf_event_read, /* u64 bpf_perf_event_read(&map, index) */ -- /** -- * bpf_redirect(ifindex, flags) - redirect to another netdev -- * @ifindex: ifindex of the net device -- * @flags: bit 0 - if set, redirect to ingress instead of egress -- * other bits - reserved -- * Return: TC_ACT_REDIRECT -- */ -- BPF_FUNC_redirect, -- -- /** -- * bpf_get_route_realm(skb) - retrieve a dst's tclassid -- * @skb: pointer to skb -- * Return: realm if != 0 -- */ -- BPF_FUNC_get_route_realm, -- -- /** -- * bpf_perf_event_output(ctx, map, index, data, size) - output perf raw sample -- * @ctx: struct pt_regs* -- * @map: pointer to perf_event_array map -- * @index: index of event in the map -- * @data: data on stack to be output as raw data -- * @size: size of data -- * Return: 0 on success -- */ -- BPF_FUNC_perf_event_output, -- BPF_FUNC_skb_load_bytes, -- -- /** -- * bpf_get_stackid(ctx, map, flags) - walk user or kernel stack and return id -- * @ctx: struct pt_regs* -- * @map: pointer to stack_trace map -- * @flags: bits 0-7 - numer of stack frames to skip -- * bit 8 - collect user stack instead of kernel -- * bit 9 - compare stacks by hash only -- * bit 10 - if two different stacks hash into the same stackid -- * discard old -- * other bits - reserved -- * Return: >= 0 stackid on success or negative error -- */ -- BPF_FUNC_get_stackid, -- -- /** -- * bpf_csum_diff(from, from_size, to, to_size, seed) - calculate csum diff -- * @from: raw from buffer -- * @from_size: length of from buffer -- * @to: raw to buffer -- * @to_size: length of to buffer -- * @seed: optional seed -- * Return: csum result -- */ -- BPF_FUNC_csum_diff, -- -- /** -- * bpf_skb_[gs]et_tunnel_opt(skb, opt, size) -- * retrieve or populate tunnel options metadata -- * @skb: pointer to skb -- * @opt: pointer to raw tunnel option data -- * @size: size of @opt -- * Return: 0 on success for set, option size for get -- */ -- BPF_FUNC_skb_get_tunnel_opt, -- BPF_FUNC_skb_set_tunnel_opt, -+ __BPF_FUNC_MAPPER(__BPF_ENUM_FN) - __BPF_FUNC_MAX_ID, - }; -+#undef __BPF_ENUM_FN - - /* All flags used by eBPF helper functions, placed here. */ - -@@ -346,6 +526,12 @@ enum bpf_func_id { - #define BPF_F_ZERO_CSUM_TX (1ULL << 1) - #define BPF_F_DONT_FRAGMENT (1ULL << 2) - -+/* BPF_FUNC_perf_event_output and BPF_FUNC_perf_event_read flags. */ -+#define BPF_F_INDEX_MASK 0xffffffffULL -+#define BPF_F_CURRENT_CPU BPF_F_INDEX_MASK -+/* BPF_FUNC_perf_event_output for sk_buff input context. */ -+#define BPF_F_CTXLEN_MASK (0xfffffULL << 32) -+ - /* user accessible mirror of in-kernel sk_buff. - * new fields can only be added to the end of this structure - */ -@@ -365,6 +551,8 @@ struct __sk_buff { - __u32 cb[5]; - __u32 hash; - __u32 tc_classid; -+ __u32 data; -+ __u32 data_end; - }; - - struct bpf_tunnel_key { -@@ -379,4 +567,49 @@ struct bpf_tunnel_key { - __u32 tunnel_label; - }; - -+/* Generic BPF return codes which all BPF program types may support. -+ * The values are binary compatible with their TC_ACT_* counter-part to -+ * provide backwards compatibility with existing SCHED_CLS and SCHED_ACT -+ * programs. -+ * -+ * XDP is handled seprately, see XDP_*. -+ */ -+enum bpf_ret_code { -+ BPF_OK = 0, -+ /* 1 reserved */ -+ BPF_DROP = 2, -+ /* 3-6 reserved */ -+ BPF_REDIRECT = 7, -+ /* >127 are reserved for prog type specific return codes */ -+}; -+ -+struct bpf_sock { -+ __u32 bound_dev_if; -+ __u32 family; -+ __u32 type; -+ __u32 protocol; -+}; -+ -+#define XDP_PACKET_HEADROOM 256 -+ -+/* User return codes for XDP prog type. -+ * A valid XDP program must return one of these defined values. All other -+ * return codes are reserved for future use. Unknown return codes will result -+ * in packet drop. -+ */ -+enum xdp_action { -+ XDP_ABORTED = 0, -+ XDP_DROP, -+ XDP_PASS, -+ XDP_TX, -+}; -+ -+/* user accessible metadata for XDP packet hook -+ * new fields must be added to the end of this structure -+ */ -+struct xdp_md { -+ __u32 data; -+ __u32 data_end; -+}; -+ - #endif /* __LINUX_BPF_H__ */ -diff --git a/include/linux/can.h b/include/linux/can.h -index 4af39b0..f7a810d 100644 ---- a/include/linux/can.h -+++ b/include/linux/can.h -@@ -196,5 +196,6 @@ struct can_filter { - }; - - #define CAN_INV_FILTER 0x20000000U /* to be set in can_filter.can_id */ -+#define CAN_RAW_FILTER_MAX 512 /* maximum number of can_filter set via setsockopt() */ - - #endif /* !_UAPI_CAN_H */ -diff --git a/include/linux/devlink.h b/include/linux/devlink.h -index 0e21d00..7c14d77 100644 ---- a/include/linux/devlink.h -+++ b/include/linux/devlink.h -@@ -57,6 +57,8 @@ enum devlink_command { - DEVLINK_CMD_SB_OCC_SNAPSHOT, - DEVLINK_CMD_SB_OCC_MAX_CLEAR, - -+ DEVLINK_CMD_ESWITCH_MODE_GET, -+ DEVLINK_CMD_ESWITCH_MODE_SET, - /* add new commands above here */ - - __DEVLINK_CMD_MAX, -@@ -95,6 +97,18 @@ enum devlink_sb_threshold_type { - - #define DEVLINK_SB_THRESHOLD_TO_ALPHA_MAX 20 - -+enum devlink_eswitch_mode { -+ DEVLINK_ESWITCH_MODE_LEGACY, -+ DEVLINK_ESWITCH_MODE_SWITCHDEV, -+}; -+ -+enum devlink_eswitch_inline_mode { -+ DEVLINK_ESWITCH_INLINE_MODE_NONE, -+ DEVLINK_ESWITCH_INLINE_MODE_LINK, -+ DEVLINK_ESWITCH_INLINE_MODE_NETWORK, -+ DEVLINK_ESWITCH_INLINE_MODE_TRANSPORT, -+}; -+ - enum devlink_attr { - /* don't change the order or add anything between, this is ABI! */ - DEVLINK_ATTR_UNSPEC, -@@ -125,6 +139,8 @@ enum devlink_attr { - DEVLINK_ATTR_SB_TC_INDEX, /* u16 */ - DEVLINK_ATTR_SB_OCC_CUR, /* u32 */ - DEVLINK_ATTR_SB_OCC_MAX, /* u32 */ -+ DEVLINK_ATTR_ESWITCH_MODE, /* u16 */ -+ DEVLINK_ATTR_ESWITCH_INLINE_MODE, /* u8 */ - - /* add new attributes above here, update the policy in devlink.c */ - -diff --git a/include/linux/fib_rules.h b/include/linux/fib_rules.h -index 96161b8..bbf02a6 100644 ---- a/include/linux/fib_rules.h -+++ b/include/linux/fib_rules.h -@@ -29,6 +29,11 @@ struct fib_rule_hdr { - __u32 flags; - }; - -+struct fib_rule_uid_range { -+ __u32 start; -+ __u32 end; -+}; -+ - enum { - FRA_UNSPEC, - FRA_DST, /* destination address */ -@@ -49,6 +54,9 @@ enum { - FRA_TABLE, /* Extended table id */ - FRA_FWMASK, /* mask for netfilter mark */ - FRA_OIFNAME, -+ FRA_PAD, -+ FRA_L3MDEV, /* iif or oif is l3mdev goto its table */ -+ FRA_UID_RANGE, /* UID range */ - __FRA_MAX - }; - -diff --git a/include/linux/gen_stats.h b/include/linux/gen_stats.h -index 6487317..52deccc 100644 ---- a/include/linux/gen_stats.h -+++ b/include/linux/gen_stats.h -@@ -10,6 +10,7 @@ enum { - TCA_STATS_QUEUE, - TCA_STATS_APP, - TCA_STATS_RATE_EST64, -+ TCA_STATS_PAD, - __TCA_STATS_MAX, - }; - #define TCA_STATS_MAX (__TCA_STATS_MAX - 1) -diff --git a/include/linux/genetlink.h b/include/linux/genetlink.h -index e792092..08239d8 100644 ---- a/include/linux/genetlink.h -+++ b/include/linux/genetlink.h -@@ -26,10 +26,11 @@ struct genlmsghdr { - /* - * List of reserved static generic netlink identifiers: - */ --#define GENL_ID_GENERATE 0 - #define GENL_ID_CTRL NLMSG_MIN_TYPE - #define GENL_ID_VFS_DQUOT (NLMSG_MIN_TYPE + 1) - #define GENL_ID_PMCRAID (NLMSG_MIN_TYPE + 2) -+/* must be last reserved + 1 */ -+#define GENL_START_ALLOC (NLMSG_MIN_TYPE + 3) - - /************************************************************************** - * Controller -diff --git a/include/linux/if.h b/include/linux/if.h -index 5b84948..bf33a3e 100644 ---- a/include/linux/if.h -+++ b/include/linux/if.h -@@ -31,7 +31,7 @@ - #include - - /* For glibc compatibility. An empty enum does not compile. */ --#if __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO != 0 && \ -+#if __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO != 0 || \ - __UAPI_DEF_IF_NET_DEVICE_FLAGS != 0 - /** - * enum net_device_flags - &struct net_device flags -@@ -99,7 +99,7 @@ enum net_device_flags { - IFF_ECHO = 1<<18, /* __volatile__ */ - #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */ - }; --#endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO != 0 && __UAPI_DEF_IF_NET_DEVICE_FLAGS != 0 */ -+#endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO != 0 || __UAPI_DEF_IF_NET_DEVICE_FLAGS != 0 */ - - /* for compatibility with glibc net/if.h */ - #if __UAPI_DEF_IF_NET_DEVICE_FLAGS -diff --git a/include/linux/if_alg.h b/include/linux/if_alg.h -new file mode 100644 -index 0000000..f2acd2f ---- /dev/null -+++ b/include/linux/if_alg.h -@@ -0,0 +1,42 @@ -+/* -+ * if_alg: User-space algorithm interface -+ * -+ * Copyright (c) 2010 Herbert Xu -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License as published by the Free -+ * Software Foundation; either version 2 of the License, or (at your option) -+ * any later version. -+ * -+ */ -+ -+#ifndef _LINUX_IF_ALG_H -+#define _LINUX_IF_ALG_H -+ -+#include -+ -+struct sockaddr_alg { -+ __u16 salg_family; -+ __u8 salg_type[14]; -+ __u32 salg_feat; -+ __u32 salg_mask; -+ __u8 salg_name[64]; -+}; -+ -+struct af_alg_iv { -+ __u32 ivlen; -+ __u8 iv[0]; -+}; -+ -+/* Socket options */ -+#define ALG_SET_KEY 1 -+#define ALG_SET_IV 2 -+#define ALG_SET_OP 3 -+#define ALG_SET_AEAD_ASSOCLEN 4 -+#define ALG_SET_AEAD_AUTHSIZE 5 -+ -+/* Operations */ -+#define ALG_OP_DECRYPT 0 -+#define ALG_OP_ENCRYPT 1 -+ -+#endif /* _LINUX_IF_ALG_H */ -diff --git a/include/linux/if_bonding.h b/include/linux/if_bonding.h -new file mode 100644 -index 0000000..9635a62 ---- /dev/null -+++ b/include/linux/if_bonding.h -@@ -0,0 +1,130 @@ -+/* -+ * Bond several ethernet interfaces into a Cisco, running 'Etherchannel'. -+ * -+ * -+ * Portions are (c) Copyright 1995 Simon "Guru Aleph-Null" Janes -+ * NCM: Network and Communications Management, Inc. -+ * -+ * BUT, I'm the one who modified it for ethernet, so: -+ * (c) Copyright 1999, Thomas Davis, tadavis@lbl.gov -+ * -+ * This software may be used and distributed according to the terms -+ * of the GNU Public License, incorporated herein by reference. -+ * -+ * 2003/03/18 - Amir Noam -+ * - Added support for getting slave's speed and duplex via ethtool. -+ * Needed for 802.3ad and other future modes. -+ * -+ * 2003/03/18 - Tsippy Mendelson and -+ * Shmulik Hen -+ * - Enable support of modes that need to use the unique mac address of -+ * each slave. -+ * -+ * 2003/03/18 - Tsippy Mendelson and -+ * Amir Noam -+ * - Moved driver's private data types to bonding.h -+ * -+ * 2003/03/18 - Amir Noam , -+ * Tsippy Mendelson and -+ * Shmulik Hen -+ * - Added support for IEEE 802.3ad Dynamic link aggregation mode. -+ * -+ * 2003/05/01 - Amir Noam -+ * - Added ABI version control to restore compatibility between -+ * new/old ifenslave and new/old bonding. -+ * -+ * 2003/12/01 - Shmulik Hen -+ * - Code cleanup and style changes -+ * -+ * 2005/05/05 - Jason Gabler -+ * - added definitions for various XOR hashing policies -+ */ -+ -+#ifndef _LINUX_IF_BONDING_H -+#define _LINUX_IF_BONDING_H -+ -+#include -+#include -+#include -+ -+/* userland - kernel ABI version (2003/05/08) */ -+#define BOND_ABI_VERSION 2 -+ -+/* -+ * We can remove these ioctl definitions in 2.5. People should use the -+ * SIOC*** versions of them instead -+ */ -+#define BOND_ENSLAVE_OLD (SIOCDEVPRIVATE) -+#define BOND_RELEASE_OLD (SIOCDEVPRIVATE + 1) -+#define BOND_SETHWADDR_OLD (SIOCDEVPRIVATE + 2) -+#define BOND_SLAVE_INFO_QUERY_OLD (SIOCDEVPRIVATE + 11) -+#define BOND_INFO_QUERY_OLD (SIOCDEVPRIVATE + 12) -+#define BOND_CHANGE_ACTIVE_OLD (SIOCDEVPRIVATE + 13) -+ -+#define BOND_CHECK_MII_STATUS (SIOCGMIIPHY) -+ -+#define BOND_MODE_ROUNDROBIN 0 -+#define BOND_MODE_ACTIVEBACKUP 1 -+#define BOND_MODE_XOR 2 -+#define BOND_MODE_BROADCAST 3 -+#define BOND_MODE_8023AD 4 -+#define BOND_MODE_TLB 5 -+#define BOND_MODE_ALB 6 /* TLB + RLB (receive load balancing) */ -+ -+/* each slave's link has 4 states */ -+#define BOND_LINK_UP 0 /* link is up and running */ -+#define BOND_LINK_FAIL 1 /* link has just gone down */ -+#define BOND_LINK_DOWN 2 /* link has been down for too long time */ -+#define BOND_LINK_BACK 3 /* link is going back */ -+ -+/* each slave has several states */ -+#define BOND_STATE_ACTIVE 0 /* link is active */ -+#define BOND_STATE_BACKUP 1 /* link is backup */ -+ -+#define BOND_DEFAULT_MAX_BONDS 1 /* Default maximum number of devices to support */ -+ -+#define BOND_DEFAULT_TX_QUEUES 16 /* Default number of tx queues per device */ -+ -+#define BOND_DEFAULT_RESEND_IGMP 1 /* Default number of IGMP membership reports */ -+ -+/* hashing types */ -+#define BOND_XMIT_POLICY_LAYER2 0 /* layer 2 (MAC only), default */ -+#define BOND_XMIT_POLICY_LAYER34 1 /* layer 3+4 (IP ^ (TCP || UDP)) */ -+#define BOND_XMIT_POLICY_LAYER23 2 /* layer 2+3 (IP ^ MAC) */ -+#define BOND_XMIT_POLICY_ENCAP23 3 /* encapsulated layer 2+3 */ -+#define BOND_XMIT_POLICY_ENCAP34 4 /* encapsulated layer 3+4 */ -+ -+typedef struct ifbond { -+ __s32 bond_mode; -+ __s32 num_slaves; -+ __s32 miimon; -+} ifbond; -+ -+typedef struct ifslave { -+ __s32 slave_id; /* Used as an IN param to the BOND_SLAVE_INFO_QUERY ioctl */ -+ char slave_name[IFNAMSIZ]; -+ __s8 link; -+ __s8 state; -+ __u32 link_failure_count; -+} ifslave; -+ -+struct ad_info { -+ __u16 aggregator_id; -+ __u16 ports; -+ __u16 actor_key; -+ __u16 partner_key; -+ __u8 partner_system[ETH_ALEN]; -+}; -+ -+#endif /* _LINUX_IF_BONDING_H */ -+ -+/* -+ * Local variables: -+ * version-control: t -+ * kept-new-versions: 5 -+ * c-indent-level: 8 -+ * c-basic-offset: 8 -+ * tab-width: 8 -+ * End: -+ */ -+ -diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h -index 8de96b7..b7393dd 100644 ---- a/include/linux/if_bridge.h -+++ b/include/linux/if_bridge.h -@@ -134,6 +134,16 @@ struct bridge_vlan_info { - __u16 vid; - }; - -+struct bridge_vlan_xstats { -+ __u64 rx_bytes; -+ __u64 rx_packets; -+ __u64 tx_bytes; -+ __u64 tx_packets; -+ __u16 vid; -+ __u16 flags; -+ __u32 pad2; -+}; -+ - /* Bridge multicast database attributes - * [MDBA_MDB] = { - * [MDBA_MDB_ENTRY] = { -@@ -233,4 +243,41 @@ enum { - }; - #define MDBA_SET_ENTRY_MAX (__MDBA_SET_ENTRY_MAX - 1) - -+/* Embedded inside LINK_XSTATS_TYPE_BRIDGE */ -+enum { -+ BRIDGE_XSTATS_UNSPEC, -+ BRIDGE_XSTATS_VLAN, -+ BRIDGE_XSTATS_MCAST, -+ BRIDGE_XSTATS_PAD, -+ __BRIDGE_XSTATS_MAX -+}; -+#define BRIDGE_XSTATS_MAX (__BRIDGE_XSTATS_MAX - 1) -+ -+enum { -+ BR_MCAST_DIR_RX, -+ BR_MCAST_DIR_TX, -+ BR_MCAST_DIR_SIZE -+}; -+ -+/* IGMP/MLD statistics */ -+struct br_mcast_stats { -+ __u64 igmp_v1queries[BR_MCAST_DIR_SIZE]; -+ __u64 igmp_v2queries[BR_MCAST_DIR_SIZE]; -+ __u64 igmp_v3queries[BR_MCAST_DIR_SIZE]; -+ __u64 igmp_leaves[BR_MCAST_DIR_SIZE]; -+ __u64 igmp_v1reports[BR_MCAST_DIR_SIZE]; -+ __u64 igmp_v2reports[BR_MCAST_DIR_SIZE]; -+ __u64 igmp_v3reports[BR_MCAST_DIR_SIZE]; -+ __u64 igmp_parse_errors; -+ -+ __u64 mld_v1queries[BR_MCAST_DIR_SIZE]; -+ __u64 mld_v2queries[BR_MCAST_DIR_SIZE]; -+ __u64 mld_leaves[BR_MCAST_DIR_SIZE]; -+ __u64 mld_v1reports[BR_MCAST_DIR_SIZE]; -+ __u64 mld_v2reports[BR_MCAST_DIR_SIZE]; -+ __u64 mld_parse_errors; -+ -+ __u64 mcast_bytes[BR_MCAST_DIR_SIZE]; -+ __u64 mcast_packets[BR_MCAST_DIR_SIZE]; -+}; - #endif /* _LINUX_IF_BRIDGE_H */ -diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h -index 8f3b0f4..6ff4a72 100644 ---- a/include/linux/if_ether.h -+++ b/include/linux/if_ether.h -@@ -35,6 +35,9 @@ - #define ETH_FRAME_LEN 1514 /* Max. octets in frame sans FCS */ - #define ETH_FCS_LEN 4 /* Octets in the FCS */ - -+#define ETH_MIN_MTU 68 /* Min IPv4 MTU per RFC791 */ -+#define ETH_MAX_MTU 0xFFFFU /* 65535, same as IP_MAX_MTU */ -+ - /* - * These are the defined Ethernet Protocol ID's. - */ -@@ -87,11 +90,13 @@ - #define ETH_P_8021AH 0x88E7 /* 802.1ah Backbone Service Tag */ - #define ETH_P_MVRP 0x88F5 /* 802.1Q MVRP */ - #define ETH_P_1588 0x88F7 /* IEEE 1588 Timesync */ -+#define ETH_P_NCSI 0x88F8 /* NCSI protocol */ - #define ETH_P_PRP 0x88FB /* IEC 62439-3 PRP/HSRv0 */ - #define ETH_P_FCOE 0x8906 /* Fibre Channel over Ethernet */ - #define ETH_P_TDLS 0x890D /* TDLS */ - #define ETH_P_FIP 0x8914 /* FCoE Initialization Protocol */ - #define ETH_P_80221 0x8917 /* IEEE 802.21 Media Independent Handover Protocol */ -+#define ETH_P_HSR 0x892F /* IEC 62439-3 HSRv1 */ - #define ETH_P_LOOPBACK 0x9000 /* Ethernet loopback packet, per IEEE 802.3 */ - #define ETH_P_QINQ1 0x9100 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */ - #define ETH_P_QINQ2 0x9200 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */ -diff --git a/include/linux/if_link.h b/include/linux/if_link.h -index 6a688e8..4422474 100644 ---- a/include/linux/if_link.h -+++ b/include/linux/if_link.h -@@ -155,6 +155,8 @@ enum { - IFLA_PROTO_DOWN, - IFLA_GSO_MAX_SEGS, - IFLA_GSO_MAX_SIZE, -+ IFLA_PAD, -+ IFLA_XDP, - __IFLA_MAX - }; - -@@ -268,6 +270,11 @@ enum { - IFLA_BR_NF_CALL_IP6TABLES, - IFLA_BR_NF_CALL_ARPTABLES, - IFLA_BR_VLAN_DEFAULT_PVID, -+ IFLA_BR_PAD, -+ IFLA_BR_VLAN_STATS_ENABLED, -+ IFLA_BR_MCAST_STATS_ENABLED, -+ IFLA_BR_MCAST_IGMP_VERSION, -+ IFLA_BR_MCAST_MLD_VERSION, - __IFLA_BR_MAX, - }; - -@@ -310,6 +317,8 @@ enum { - IFLA_BRPORT_HOLD_TIMER, - IFLA_BRPORT_FLUSH, - IFLA_BRPORT_MULTICAST_ROUTER, -+ IFLA_BRPORT_PAD, -+ IFLA_BRPORT_MCAST_FLOOD, - __IFLA_BRPORT_MAX - }; - #define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1) -@@ -429,6 +438,7 @@ enum { - IFLA_MACSEC_SCB, - IFLA_MACSEC_REPLAY_PROTECT, - IFLA_MACSEC_VALIDATION, -+ IFLA_MACSEC_PAD, - __IFLA_MACSEC_MAX, - }; - -@@ -454,6 +464,7 @@ enum { - enum ipvlan_mode { - IPVLAN_MODE_L2 = 0, - IPVLAN_MODE_L3, -+ IPVLAN_MODE_L3S, - IPVLAN_MODE_MAX - }; - -@@ -486,6 +497,7 @@ enum { - IFLA_VXLAN_REMCSUM_NOPARTIAL, - IFLA_VXLAN_COLLECT_METADATA, - IFLA_VXLAN_LABEL, -+ IFLA_VXLAN_GPE, - __IFLA_VXLAN_MAX - }; - #define IFLA_VXLAN_MAX (__IFLA_VXLAN_MAX - 1) -@@ -513,6 +525,24 @@ enum { - }; - #define IFLA_GENEVE_MAX (__IFLA_GENEVE_MAX - 1) - -+/* PPP section */ -+enum { -+ IFLA_PPP_UNSPEC, -+ IFLA_PPP_DEV_FD, -+ __IFLA_PPP_MAX -+}; -+#define IFLA_PPP_MAX (__IFLA_PPP_MAX - 1) -+ -+/* GTP section */ -+enum { -+ IFLA_GTP_UNSPEC, -+ IFLA_GTP_FD0, -+ IFLA_GTP_FD1, -+ IFLA_GTP_PDP_HASHSIZE, -+ __IFLA_GTP_MAX, -+}; -+#define IFLA_GTP_MAX (__IFLA_GTP_MAX - 1) -+ - /* Bonding section */ - - enum { -@@ -589,7 +619,7 @@ enum { - enum { - IFLA_VF_UNSPEC, - IFLA_VF_MAC, /* Hardware queue specific attributes */ -- IFLA_VF_VLAN, -+ IFLA_VF_VLAN, /* VLAN ID and QoS */ - IFLA_VF_TX_RATE, /* Max TX Bandwidth Allocation */ - IFLA_VF_SPOOFCHK, /* Spoof Checking on/off switch */ - IFLA_VF_LINK_STATE, /* link state enable/disable/auto switch */ -@@ -601,6 +631,7 @@ enum { - IFLA_VF_TRUST, /* Trust VF */ - IFLA_VF_IB_NODE_GUID, /* VF Infiniband node GUID */ - IFLA_VF_IB_PORT_GUID, /* VF Infiniband port GUID */ -+ IFLA_VF_VLAN_LIST, /* nested list of vlans, option for QinQ */ - __IFLA_VF_MAX, - }; - -@@ -617,6 +648,22 @@ struct ifla_vf_vlan { - __u32 qos; - }; - -+enum { -+ IFLA_VF_VLAN_INFO_UNSPEC, -+ IFLA_VF_VLAN_INFO, /* VLAN ID, QoS and VLAN protocol */ -+ __IFLA_VF_VLAN_INFO_MAX, -+}; -+ -+#define IFLA_VF_VLAN_INFO_MAX (__IFLA_VF_VLAN_INFO_MAX - 1) -+#define MAX_VLAN_LIST_LEN 1 -+ -+struct ifla_vf_vlan_info { -+ __u32 vf; -+ __u32 vlan; /* 0 - 4095, 0 disables VLAN filter */ -+ __u32 qos; -+ __be16 vlan_proto; /* VLAN protocol either 802.1Q or 802.1ad */ -+}; -+ - struct ifla_vf_tx_rate { - __u32 vf; - __u32 rate; /* Max TX bandwidth in Mbps, 0 disables throttling */ -@@ -662,6 +709,7 @@ enum { - IFLA_VF_STATS_TX_BYTES, - IFLA_VF_STATS_BROADCAST, - IFLA_VF_STATS_MULTICAST, -+ IFLA_VF_STATS_PAD, - __IFLA_VF_STATS_MAX, - }; - -@@ -772,9 +820,71 @@ enum { - IFLA_HSR_MULTICAST_SPEC, /* Last byte of supervision addr */ - IFLA_HSR_SUPERVISION_ADDR, /* Supervision frame multicast addr */ - IFLA_HSR_SEQ_NR, -+ IFLA_HSR_VERSION, /* HSR version */ - __IFLA_HSR_MAX, - }; - - #define IFLA_HSR_MAX (__IFLA_HSR_MAX - 1) - -+/* STATS section */ -+ -+struct if_stats_msg { -+ __u8 family; -+ __u8 pad1; -+ __u16 pad2; -+ __u32 ifindex; -+ __u32 filter_mask; -+}; -+ -+/* A stats attribute can be netdev specific or a global stat. -+ * For netdev stats, lets use the prefix IFLA_STATS_LINK_* -+ */ -+enum { -+ IFLA_STATS_UNSPEC, /* also used as 64bit pad attribute */ -+ IFLA_STATS_LINK_64, -+ IFLA_STATS_LINK_XSTATS, -+ IFLA_STATS_LINK_XSTATS_SLAVE, -+ IFLA_STATS_LINK_OFFLOAD_XSTATS, -+ __IFLA_STATS_MAX, -+}; -+ -+#define IFLA_STATS_MAX (__IFLA_STATS_MAX - 1) -+ -+#define IFLA_STATS_FILTER_BIT(ATTR) (1 << (ATTR - 1)) -+ -+/* These are embedded into IFLA_STATS_LINK_XSTATS: -+ * [IFLA_STATS_LINK_XSTATS] -+ * -> [LINK_XSTATS_TYPE_xxx] -+ * -> [rtnl link type specific attributes] -+ */ -+enum { -+ LINK_XSTATS_TYPE_UNSPEC, -+ LINK_XSTATS_TYPE_BRIDGE, -+ __LINK_XSTATS_TYPE_MAX -+}; -+#define LINK_XSTATS_TYPE_MAX (__LINK_XSTATS_TYPE_MAX - 1) -+ -+/* These are stats embedded into IFLA_STATS_LINK_OFFLOAD_XSTATS */ -+enum { -+ IFLA_OFFLOAD_XSTATS_UNSPEC, -+ IFLA_OFFLOAD_XSTATS_CPU_HIT, /* struct rtnl_link_stats64 */ -+ __IFLA_OFFLOAD_XSTATS_MAX -+}; -+#define IFLA_OFFLOAD_XSTATS_MAX (__IFLA_OFFLOAD_XSTATS_MAX - 1) -+ -+/* XDP section */ -+ -+#define XDP_FLAGS_UPDATE_IF_NOEXIST (1U << 0) -+#define XDP_FLAGS_MASK (XDP_FLAGS_UPDATE_IF_NOEXIST) -+ -+enum { -+ IFLA_XDP_UNSPEC, -+ IFLA_XDP_FD, -+ IFLA_XDP_ATTACHED, -+ IFLA_XDP_FLAGS, -+ __IFLA_XDP_MAX, -+}; -+ -+#define IFLA_XDP_MAX (__IFLA_XDP_MAX - 1) -+ - #endif /* _LINUX_IF_LINK_H */ -diff --git a/include/linux/if_packet.h b/include/linux/if_packet.h -new file mode 100644 -index 0000000..9e7edfd ---- /dev/null -+++ b/include/linux/if_packet.h -@@ -0,0 +1,301 @@ -+#ifndef __LINUX_IF_PACKET_H -+#define __LINUX_IF_PACKET_H -+ -+#include -+ -+struct sockaddr_pkt { -+ unsigned short spkt_family; -+ unsigned char spkt_device[14]; -+ __be16 spkt_protocol; -+}; -+ -+struct sockaddr_ll { -+ unsigned short sll_family; -+ __be16 sll_protocol; -+ int sll_ifindex; -+ unsigned short sll_hatype; -+ unsigned char sll_pkttype; -+ unsigned char sll_halen; -+ unsigned char sll_addr[8]; -+}; -+ -+/* Packet types */ -+ -+#define PACKET_HOST 0 /* To us */ -+#define PACKET_BROADCAST 1 /* To all */ -+#define PACKET_MULTICAST 2 /* To group */ -+#define PACKET_OTHERHOST 3 /* To someone else */ -+#define PACKET_OUTGOING 4 /* Outgoing of any type */ -+#define PACKET_LOOPBACK 5 /* MC/BRD frame looped back */ -+#define PACKET_USER 6 /* To user space */ -+#define PACKET_KERNEL 7 /* To kernel space */ -+/* Unused, PACKET_FASTROUTE and PACKET_LOOPBACK are invisible to user space */ -+#define PACKET_FASTROUTE 6 /* Fastrouted frame */ -+ -+/* Packet socket options */ -+ -+#define PACKET_ADD_MEMBERSHIP 1 -+#define PACKET_DROP_MEMBERSHIP 2 -+#define PACKET_RECV_OUTPUT 3 -+/* Value 4 is still used by obsolete turbo-packet. */ -+#define PACKET_RX_RING 5 -+#define PACKET_STATISTICS 6 -+#define PACKET_COPY_THRESH 7 -+#define PACKET_AUXDATA 8 -+#define PACKET_ORIGDEV 9 -+#define PACKET_VERSION 10 -+#define PACKET_HDRLEN 11 -+#define PACKET_RESERVE 12 -+#define PACKET_TX_RING 13 -+#define PACKET_LOSS 14 -+#define PACKET_VNET_HDR 15 -+#define PACKET_TX_TIMESTAMP 16 -+#define PACKET_TIMESTAMP 17 -+#define PACKET_FANOUT 18 -+#define PACKET_TX_HAS_OFF 19 -+#define PACKET_QDISC_BYPASS 20 -+#define PACKET_ROLLOVER_STATS 21 -+#define PACKET_FANOUT_DATA 22 -+ -+#define PACKET_FANOUT_HASH 0 -+#define PACKET_FANOUT_LB 1 -+#define PACKET_FANOUT_CPU 2 -+#define PACKET_FANOUT_ROLLOVER 3 -+#define PACKET_FANOUT_RND 4 -+#define PACKET_FANOUT_QM 5 -+#define PACKET_FANOUT_CBPF 6 -+#define PACKET_FANOUT_EBPF 7 -+#define PACKET_FANOUT_FLAG_ROLLOVER 0x1000 -+#define PACKET_FANOUT_FLAG_DEFRAG 0x8000 -+ -+struct tpacket_stats { -+ unsigned int tp_packets; -+ unsigned int tp_drops; -+}; -+ -+struct tpacket_stats_v3 { -+ unsigned int tp_packets; -+ unsigned int tp_drops; -+ unsigned int tp_freeze_q_cnt; -+}; -+ -+struct tpacket_rollover_stats { -+ __aligned_u64 tp_all; -+ __aligned_u64 tp_huge; -+ __aligned_u64 tp_failed; -+}; -+ -+union tpacket_stats_u { -+ struct tpacket_stats stats1; -+ struct tpacket_stats_v3 stats3; -+}; -+ -+struct tpacket_auxdata { -+ __u32 tp_status; -+ __u32 tp_len; -+ __u32 tp_snaplen; -+ __u16 tp_mac; -+ __u16 tp_net; -+ __u16 tp_vlan_tci; -+ __u16 tp_vlan_tpid; -+}; -+ -+/* Rx ring - header status */ -+#define TP_STATUS_KERNEL 0 -+#define TP_STATUS_USER (1 << 0) -+#define TP_STATUS_COPY (1 << 1) -+#define TP_STATUS_LOSING (1 << 2) -+#define TP_STATUS_CSUMNOTREADY (1 << 3) -+#define TP_STATUS_VLAN_VALID (1 << 4) /* auxdata has valid tp_vlan_tci */ -+#define TP_STATUS_BLK_TMO (1 << 5) -+#define TP_STATUS_VLAN_TPID_VALID (1 << 6) /* auxdata has valid tp_vlan_tpid */ -+#define TP_STATUS_CSUM_VALID (1 << 7) -+ -+/* Tx ring - header status */ -+#define TP_STATUS_AVAILABLE 0 -+#define TP_STATUS_SEND_REQUEST (1 << 0) -+#define TP_STATUS_SENDING (1 << 1) -+#define TP_STATUS_WRONG_FORMAT (1 << 2) -+ -+/* Rx and Tx ring - header status */ -+#define TP_STATUS_TS_SOFTWARE (1 << 29) -+#define TP_STATUS_TS_SYS_HARDWARE (1 << 30) /* deprecated, never set */ -+#define TP_STATUS_TS_RAW_HARDWARE (1 << 31) -+ -+/* Rx ring - feature request bits */ -+#define TP_FT_REQ_FILL_RXHASH 0x1 -+ -+struct tpacket_hdr { -+ unsigned long tp_status; -+ unsigned int tp_len; -+ unsigned int tp_snaplen; -+ unsigned short tp_mac; -+ unsigned short tp_net; -+ unsigned int tp_sec; -+ unsigned int tp_usec; -+}; -+ -+#define TPACKET_ALIGNMENT 16 -+#define TPACKET_ALIGN(x) (((x)+TPACKET_ALIGNMENT-1)&~(TPACKET_ALIGNMENT-1)) -+#define TPACKET_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket_hdr)) + sizeof(struct sockaddr_ll)) -+ -+struct tpacket2_hdr { -+ __u32 tp_status; -+ __u32 tp_len; -+ __u32 tp_snaplen; -+ __u16 tp_mac; -+ __u16 tp_net; -+ __u32 tp_sec; -+ __u32 tp_nsec; -+ __u16 tp_vlan_tci; -+ __u16 tp_vlan_tpid; -+ __u8 tp_padding[4]; -+}; -+ -+struct tpacket_hdr_variant1 { -+ __u32 tp_rxhash; -+ __u32 tp_vlan_tci; -+ __u16 tp_vlan_tpid; -+ __u16 tp_padding; -+}; -+ -+struct tpacket3_hdr { -+ __u32 tp_next_offset; -+ __u32 tp_sec; -+ __u32 tp_nsec; -+ __u32 tp_snaplen; -+ __u32 tp_len; -+ __u32 tp_status; -+ __u16 tp_mac; -+ __u16 tp_net; -+ /* pkt_hdr variants */ -+ union { -+ struct tpacket_hdr_variant1 hv1; -+ }; -+ __u8 tp_padding[8]; -+}; -+ -+struct tpacket_bd_ts { -+ unsigned int ts_sec; -+ union { -+ unsigned int ts_usec; -+ unsigned int ts_nsec; -+ }; -+}; -+ -+struct tpacket_hdr_v1 { -+ __u32 block_status; -+ __u32 num_pkts; -+ __u32 offset_to_first_pkt; -+ -+ /* Number of valid bytes (including padding) -+ * blk_len <= tp_block_size -+ */ -+ __u32 blk_len; -+ -+ /* -+ * Quite a few uses of sequence number: -+ * 1. Make sure cache flush etc worked. -+ * Well, one can argue - why not use the increasing ts below? -+ * But look at 2. below first. -+ * 2. When you pass around blocks to other user space decoders, -+ * you can see which blk[s] is[are] outstanding etc. -+ * 3. Validate kernel code. -+ */ -+ __aligned_u64 seq_num; -+ -+ /* -+ * ts_last_pkt: -+ * -+ * Case 1. Block has 'N'(N >=1) packets and TMO'd(timed out) -+ * ts_last_pkt == 'time-stamp of last packet' and NOT the -+ * time when the timer fired and the block was closed. -+ * By providing the ts of the last packet we can absolutely -+ * guarantee that time-stamp wise, the first packet in the -+ * next block will never precede the last packet of the -+ * previous block. -+ * Case 2. Block has zero packets and TMO'd -+ * ts_last_pkt = time when the timer fired and the block -+ * was closed. -+ * Case 3. Block has 'N' packets and NO TMO. -+ * ts_last_pkt = time-stamp of the last pkt in the block. -+ * -+ * ts_first_pkt: -+ * Is always the time-stamp when the block was opened. -+ * Case a) ZERO packets -+ * No packets to deal with but atleast you know the -+ * time-interval of this block. -+ * Case b) Non-zero packets -+ * Use the ts of the first packet in the block. -+ * -+ */ -+ struct tpacket_bd_ts ts_first_pkt, ts_last_pkt; -+}; -+ -+union tpacket_bd_header_u { -+ struct tpacket_hdr_v1 bh1; -+}; -+ -+struct tpacket_block_desc { -+ __u32 version; -+ __u32 offset_to_priv; -+ union tpacket_bd_header_u hdr; -+}; -+ -+#define TPACKET2_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket2_hdr)) + sizeof(struct sockaddr_ll)) -+#define TPACKET3_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket3_hdr)) + sizeof(struct sockaddr_ll)) -+ -+enum tpacket_versions { -+ TPACKET_V1, -+ TPACKET_V2, -+ TPACKET_V3 -+}; -+ -+/* -+ Frame structure: -+ -+ - Start. Frame must be aligned to TPACKET_ALIGNMENT=16 -+ - struct tpacket_hdr -+ - pad to TPACKET_ALIGNMENT=16 -+ - struct sockaddr_ll -+ - Gap, chosen so that packet data (Start+tp_net) alignes to TPACKET_ALIGNMENT=16 -+ - Start+tp_mac: [ Optional MAC header ] -+ - Start+tp_net: Packet data, aligned to TPACKET_ALIGNMENT=16. -+ - Pad to align to TPACKET_ALIGNMENT=16 -+ */ -+ -+struct tpacket_req { -+ unsigned int tp_block_size; /* Minimal size of contiguous block */ -+ unsigned int tp_block_nr; /* Number of blocks */ -+ unsigned int tp_frame_size; /* Size of frame */ -+ unsigned int tp_frame_nr; /* Total number of frames */ -+}; -+ -+struct tpacket_req3 { -+ unsigned int tp_block_size; /* Minimal size of contiguous block */ -+ unsigned int tp_block_nr; /* Number of blocks */ -+ unsigned int tp_frame_size; /* Size of frame */ -+ unsigned int tp_frame_nr; /* Total number of frames */ -+ unsigned int tp_retire_blk_tov; /* timeout in msecs */ -+ unsigned int tp_sizeof_priv; /* offset to private data area */ -+ unsigned int tp_feature_req_word; -+}; -+ -+union tpacket_req_u { -+ struct tpacket_req req; -+ struct tpacket_req3 req3; -+}; -+ -+struct packet_mreq { -+ int mr_ifindex; -+ unsigned short mr_type; -+ unsigned short mr_alen; -+ unsigned char mr_address[8]; -+}; -+ -+#define PACKET_MR_MULTICAST 0 -+#define PACKET_MR_PROMISC 1 -+#define PACKET_MR_ALLMULTI 2 -+#define PACKET_MR_UNICAST 3 -+ -+#endif -diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h -index f0201ca..4f975f5 100644 ---- a/include/linux/if_tunnel.h -+++ b/include/linux/if_tunnel.h -@@ -2,6 +2,9 @@ - #define _IF_TUNNEL_H_ - - #include -+#include -+#include -+#include - #include - - -@@ -24,9 +27,23 @@ - #define GRE_SEQ __cpu_to_be16(0x1000) - #define GRE_STRICT __cpu_to_be16(0x0800) - #define GRE_REC __cpu_to_be16(0x0700) --#define GRE_FLAGS __cpu_to_be16(0x00F8) -+#define GRE_ACK __cpu_to_be16(0x0080) -+#define GRE_FLAGS __cpu_to_be16(0x0078) - #define GRE_VERSION __cpu_to_be16(0x0007) - -+#define GRE_IS_CSUM(f) ((f) & GRE_CSUM) -+#define GRE_IS_ROUTING(f) ((f) & GRE_ROUTING) -+#define GRE_IS_KEY(f) ((f) & GRE_KEY) -+#define GRE_IS_SEQ(f) ((f) & GRE_SEQ) -+#define GRE_IS_STRICT(f) ((f) & GRE_STRICT) -+#define GRE_IS_REC(f) ((f) & GRE_REC) -+#define GRE_IS_ACK(f) ((f) & GRE_ACK) -+ -+#define GRE_VERSION_0 __cpu_to_be16(0x0000) -+#define GRE_VERSION_1 __cpu_to_be16(0x0001) -+#define GRE_PROTO_PPP __cpu_to_be16(0x880b) -+#define GRE_PPTP_KEY_MASK __cpu_to_be32(0xffff) -+ - struct ip_tunnel_parm { - char name[IFNAMSIZ]; - int link; -@@ -57,6 +74,7 @@ enum { - IFLA_IPTUN_ENCAP_FLAGS, - IFLA_IPTUN_ENCAP_SPORT, - IFLA_IPTUN_ENCAP_DPORT, -+ IFLA_IPTUN_COLLECT_METADATA, - __IFLA_IPTUN_MAX, - }; - #define IFLA_IPTUN_MAX (__IFLA_IPTUN_MAX - 1) -@@ -113,6 +131,7 @@ enum { - IFLA_GRE_ENCAP_SPORT, - IFLA_GRE_ENCAP_DPORT, - IFLA_GRE_COLLECT_METADATA, -+ IFLA_GRE_IGNORE_DF, - __IFLA_GRE_MAX, - }; - -diff --git a/include/linux/ila.h b/include/linux/ila.h -index 4f9e1de..7e328d7 100644 ---- a/include/linux/ila.h -+++ b/include/linux/ila.h -@@ -14,6 +14,8 @@ enum { - ILA_ATTR_LOCATOR_MATCH, /* u64 */ - ILA_ATTR_IFINDEX, /* s32 */ - ILA_ATTR_DIR, /* u32 */ -+ ILA_ATTR_PAD, -+ ILA_ATTR_CSUM_MODE, /* u8 */ - - __ILA_ATTR_MAX, - }; -@@ -34,4 +36,10 @@ enum { - #define ILA_DIR_IN (1 << 0) - #define ILA_DIR_OUT (1 << 1) - -+enum { -+ ILA_CSUM_ADJUST_TRANSPORT, -+ ILA_CSUM_NEUTRAL_MAP, -+ ILA_CSUM_NO_ACTION, -+}; -+ - #endif /* _LINUX_ILA_H */ -diff --git a/include/linux/in.h b/include/linux/in.h -index 194b43b..9439efa 100644 ---- a/include/linux/in.h -+++ b/include/linux/in.h -@@ -117,6 +117,7 @@ struct in_addr { - #define IP_NODEFRAG 22 - #define IP_CHECKSUM 23 - #define IP_BIND_ADDRESS_NO_PORT 24 -+#define IP_RECVFRAGSIZE 25 - - /* IP_MTU_DISCOVER values */ - #define IP_PMTUDISC_DONT 0 /* Never send DF frames */ -diff --git a/include/linux/in6.h b/include/linux/in6.h -index aa5b66d..6f3bdee 100644 ---- a/include/linux/in6.h -+++ b/include/linux/in6.h -@@ -143,6 +143,7 @@ struct in6_flowlabel_req { - #define IPV6_TLV_PAD1 0 - #define IPV6_TLV_PADN 1 - #define IPV6_TLV_ROUTERALERT 5 -+#define IPV6_TLV_CALIPSO 7 /* RFC 5570 */ - #define IPV6_TLV_JUMBO 194 - #define IPV6_TLV_HAO 201 /* home address option */ - -@@ -282,6 +283,7 @@ struct in6_flowlabel_req { - #define IPV6_RECVORIGDSTADDR IPV6_ORIGDSTADDR - #define IPV6_TRANSPARENT 75 - #define IPV6_UNICAST_IF 76 -+#define IPV6_RECVFRAGSIZE 77 - - /* - * Multicast Routing: -diff --git a/include/linux/inet_diag.h b/include/linux/inet_diag.h -index b806fcf..f7bf781 100644 ---- a/include/linux/inet_diag.h -+++ b/include/linux/inet_diag.h -@@ -43,6 +43,23 @@ struct inet_diag_req_v2 { - struct inet_diag_sockid id; - }; - -+/* -+ * SOCK_RAW sockets require the underlied protocol to be -+ * additionally specified so we can use @pad member for -+ * this, but we can't rename it because userspace programs -+ * still may depend on this name. Instead lets use another -+ * structure definition as an alias for struct -+ * @inet_diag_req_v2. -+ */ -+struct inet_diag_req_raw { -+ __u8 sdiag_family; -+ __u8 sdiag_protocol; -+ __u8 idiag_ext; -+ __u8 sdiag_raw_protocol; -+ __u32 idiag_states; -+ struct inet_diag_sockid id; -+}; -+ - enum { - INET_DIAG_REQ_NONE, - INET_DIAG_REQ_BYTECODE, -@@ -72,6 +89,8 @@ enum { - INET_DIAG_BC_AUTO, - INET_DIAG_BC_S_COND, - INET_DIAG_BC_D_COND, -+ INET_DIAG_BC_DEV_COND, /* u32 ifindex */ -+ INET_DIAG_BC_MARK_COND, - }; - - struct inet_diag_hostcond { -@@ -81,6 +100,11 @@ struct inet_diag_hostcond { - __be32 addr[0]; - }; - -+struct inet_diag_markcond { -+ __u32 mark; -+ __u32 mask; -+}; -+ - /* Base info structure. It contains socket identity (addrs/ports/cookie) - * and, alas, the information shown by netstat. */ - struct inet_diag_msg { -@@ -115,9 +139,13 @@ enum { - INET_DIAG_SKV6ONLY, - INET_DIAG_LOCALS, - INET_DIAG_PEERS, -+ INET_DIAG_PAD, -+ INET_DIAG_MARK, -+ INET_DIAG_BBRINFO, -+ __INET_DIAG_MAX, - }; - --#define INET_DIAG_MAX INET_DIAG_SKV6ONLY -+#define INET_DIAG_MAX (__INET_DIAG_MAX - 1) - - /* INET_DIAG_MEM */ - -@@ -147,8 +175,20 @@ struct tcp_dctcp_info { - __u32 dctcp_ab_tot; - }; - -+/* INET_DIAG_BBRINFO */ -+ -+struct tcp_bbr_info { -+ /* u64 bw: max-filtered BW (app throughput) estimate in Byte per sec: */ -+ __u32 bbr_bw_lo; /* lower 32 bits of bw */ -+ __u32 bbr_bw_hi; /* upper 32 bits of bw */ -+ __u32 bbr_min_rtt; /* min-filtered RTT in uSec */ -+ __u32 bbr_pacing_gain; /* pacing gain shifted left 8 bits */ -+ __u32 bbr_cwnd_gain; /* cwnd gain shifted left 8 bits */ -+}; -+ - union tcp_cc_info { - struct tcpvegas_info vegas; - struct tcp_dctcp_info dctcp; -+ struct tcp_bbr_info bbr; - }; - #endif /* _INET_DIAG_H_ */ -diff --git a/include/linux/l2tp.h b/include/linux/l2tp.h -index 5b0e36d..8a80007 100644 ---- a/include/linux/l2tp.h -+++ b/include/linux/l2tp.h -@@ -9,7 +9,8 @@ - - #include - #include --#include -+#include -+#include - - #define IPPROTO_L2TP 115 - -@@ -29,7 +30,7 @@ struct sockaddr_l2tpip { - __u32 l2tp_conn_id; /* Connection ID of tunnel */ - - /* Pad to size of `struct sockaddr'. */ -- unsigned char __pad[sizeof(struct sockaddr) - -+ unsigned char __pad[__SOCK_SIZE__ - - sizeof(__kernel_sa_family_t) - - sizeof(__be16) - sizeof(struct in_addr) - - sizeof(__u32)]; -@@ -106,7 +107,7 @@ enum { - L2TP_ATTR_VLAN_ID, /* u16 */ - L2TP_ATTR_COOKIE, /* 0, 4 or 8 bytes */ - L2TP_ATTR_PEER_COOKIE, /* 0, 4 or 8 bytes */ -- L2TP_ATTR_DEBUG, /* u32 */ -+ L2TP_ATTR_DEBUG, /* u32, enum l2tp_debug_flags */ - L2TP_ATTR_RECV_SEQ, /* u8 */ - L2TP_ATTR_SEND_SEQ, /* u8 */ - L2TP_ATTR_LNS_MODE, /* u8 */ -@@ -122,8 +123,9 @@ enum { - L2TP_ATTR_STATS, /* nested */ - L2TP_ATTR_IP6_SADDR, /* struct in6_addr */ - L2TP_ATTR_IP6_DADDR, /* struct in6_addr */ -- L2TP_ATTR_UDP_ZERO_CSUM6_TX, /* u8 */ -- L2TP_ATTR_UDP_ZERO_CSUM6_RX, /* u8 */ -+ L2TP_ATTR_UDP_ZERO_CSUM6_TX, /* flag */ -+ L2TP_ATTR_UDP_ZERO_CSUM6_RX, /* flag */ -+ L2TP_ATTR_PAD, - __L2TP_ATTR_MAX, - }; - -@@ -140,6 +142,7 @@ enum { - L2TP_ATTR_RX_SEQ_DISCARDS, /* u64 */ - L2TP_ATTR_RX_OOS_PACKETS, /* u64 */ - L2TP_ATTR_RX_ERRORS, /* u64 */ -+ L2TP_ATTR_STATS_PAD, - __L2TP_ATTR_STATS_MAX, - }; - -@@ -171,6 +174,21 @@ enum l2tp_seqmode { - L2TP_SEQ_ALL = 2, - }; - -+/** -+ * enum l2tp_debug_flags - debug message categories for L2TP tunnels/sessions -+ * -+ * @L2TP_MSG_DEBUG: verbose debug (if compiled in) -+ * @L2TP_MSG_CONTROL: userspace - kernel interface -+ * @L2TP_MSG_SEQ: sequence numbers -+ * @L2TP_MSG_DATA: data packets -+ */ -+enum l2tp_debug_flags { -+ L2TP_MSG_DEBUG = (1 << 0), -+ L2TP_MSG_CONTROL = (1 << 1), -+ L2TP_MSG_SEQ = (1 << 2), -+ L2TP_MSG_DATA = (1 << 3), -+}; -+ - /* - * NETLINK_GENERIC related info - */ -diff --git a/include/linux/libc-compat.h b/include/linux/libc-compat.h -index b3c2085..f38571d 100644 ---- a/include/linux/libc-compat.h -+++ b/include/linux/libc-compat.h -@@ -52,7 +52,7 @@ - #if defined(__GLIBC__) - - /* Coordinate with glibc net/if.h header. */ --#if defined(_NET_IF_H) -+#if defined(_NET_IF_H) && defined(__USE_MISC) - - /* GLIBC headers included first so don't define anything - * that would already be defined. */ -@@ -139,6 +139,25 @@ - - #endif /* _NETINET_IN_H */ - -+/* Coordinate with glibc netipx/ipx.h header. */ -+#if defined(__NETIPX_IPX_H) -+ -+#define __UAPI_DEF_SOCKADDR_IPX 0 -+#define __UAPI_DEF_IPX_ROUTE_DEFINITION 0 -+#define __UAPI_DEF_IPX_INTERFACE_DEFINITION 0 -+#define __UAPI_DEF_IPX_CONFIG_DATA 0 -+#define __UAPI_DEF_IPX_ROUTE_DEF 0 -+ -+#else /* defined(__NETIPX_IPX_H) */ -+ -+#define __UAPI_DEF_SOCKADDR_IPX 1 -+#define __UAPI_DEF_IPX_ROUTE_DEFINITION 1 -+#define __UAPI_DEF_IPX_INTERFACE_DEFINITION 1 -+#define __UAPI_DEF_IPX_CONFIG_DATA 1 -+#define __UAPI_DEF_IPX_ROUTE_DEF 1 -+ -+#endif /* defined(__NETIPX_IPX_H) */ -+ - /* Definitions for xattr.h */ - #if defined(_SYS_XATTR_H) - #define __UAPI_DEF_XATTR 0 -@@ -179,6 +198,13 @@ - #define __UAPI_DEF_IN6_PKTINFO 1 - #define __UAPI_DEF_IP6_MTUINFO 1 - -+/* Definitions for ipx.h */ -+#define __UAPI_DEF_SOCKADDR_IPX 1 -+#define __UAPI_DEF_IPX_ROUTE_DEFINITION 1 -+#define __UAPI_DEF_IPX_INTERFACE_DEFINITION 1 -+#define __UAPI_DEF_IPX_CONFIG_DATA 1 -+#define __UAPI_DEF_IPX_ROUTE_DEF 1 -+ - /* Definitions for xattr.h */ - #define __UAPI_DEF_XATTR 1 - -diff --git a/include/linux/lwtunnel.h b/include/linux/lwtunnel.h -index 1d2f4f6..faa6eab 100644 ---- a/include/linux/lwtunnel.h -+++ b/include/linux/lwtunnel.h -@@ -9,6 +9,8 @@ enum lwtunnel_encap_types { - LWTUNNEL_ENCAP_IP, - LWTUNNEL_ENCAP_ILA, - LWTUNNEL_ENCAP_IP6, -+ LWTUNNEL_ENCAP_SEG6, -+ LWTUNNEL_ENCAP_BPF, - __LWTUNNEL_ENCAP_MAX, - }; - -@@ -22,6 +24,7 @@ enum lwtunnel_ip_t { - LWTUNNEL_IP_TTL, - LWTUNNEL_IP_TOS, - LWTUNNEL_IP_FLAGS, -+ LWTUNNEL_IP_PAD, - __LWTUNNEL_IP_MAX, - }; - -@@ -35,9 +38,32 @@ enum lwtunnel_ip6_t { - LWTUNNEL_IP6_HOPLIMIT, - LWTUNNEL_IP6_TC, - LWTUNNEL_IP6_FLAGS, -+ LWTUNNEL_IP6_PAD, - __LWTUNNEL_IP6_MAX, - }; - - #define LWTUNNEL_IP6_MAX (__LWTUNNEL_IP6_MAX - 1) - -+enum { -+ LWT_BPF_PROG_UNSPEC, -+ LWT_BPF_PROG_FD, -+ LWT_BPF_PROG_NAME, -+ __LWT_BPF_PROG_MAX, -+}; -+ -+#define LWT_BPF_PROG_MAX (__LWT_BPF_PROG_MAX - 1) -+ -+enum { -+ LWT_BPF_UNSPEC, -+ LWT_BPF_IN, -+ LWT_BPF_OUT, -+ LWT_BPF_XMIT, -+ LWT_BPF_XMIT_HEADROOM, -+ __LWT_BPF_MAX, -+}; -+ -+#define LWT_BPF_MAX (__LWT_BPF_MAX - 1) -+ -+#define LWT_BPF_MAX_HEADROOM 256 -+ - #endif /* _LWTUNNEL_H_ */ -diff --git a/include/linux/neighbour.h b/include/linux/neighbour.h -index 788655b..bd99a8d 100644 ---- a/include/linux/neighbour.h -+++ b/include/linux/neighbour.h -@@ -128,6 +128,7 @@ enum { - NDTPA_LOCKTIME, /* u64, msecs */ - NDTPA_QUEUE_LENBYTES, /* u32 */ - NDTPA_MCAST_REPROBES, /* u32 */ -+ NDTPA_PAD, - __NDTPA_MAX - }; - #define NDTPA_MAX (__NDTPA_MAX - 1) -@@ -160,6 +161,7 @@ enum { - NDTA_PARMS, /* nested TLV NDTPA_* */ - NDTA_STATS, /* struct ndt_stats, read-only */ - NDTA_GC_INTERVAL, /* u64, msecs */ -+ NDTA_PAD, - __NDTA_MAX - }; - #define NDTA_MAX (__NDTA_MAX - 1) -diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h -index b71b4c9..d8bc1e6 100644 ---- a/include/linux/netfilter.h -+++ b/include/linux/netfilter.h -@@ -13,7 +13,7 @@ - #define NF_STOLEN 2 - #define NF_QUEUE 3 - #define NF_REPEAT 4 --#define NF_STOP 5 -+#define NF_STOP 5 /* Deprecated, for userspace nf_queue compatibility. */ - #define NF_MAX_VERDICT NF_STOP - - /* we overload the higher bits for encoding auxiliary data such as the queue -diff --git a/include/linux/netlink_diag.h b/include/linux/netlink_diag.h -index f2159d3..defd25f 100644 ---- a/include/linux/netlink_diag.h -+++ b/include/linux/netlink_diag.h -@@ -48,6 +48,7 @@ enum { - - #define NDIAG_SHOW_MEMINFO 0x00000001 /* show memory info of a socket */ - #define NDIAG_SHOW_GROUPS 0x00000002 /* show groups of a netlink socket */ -+/* deprecated since 4.6 */ - #define NDIAG_SHOW_RING_CFG 0x00000004 /* show ring configuration */ - - #endif -diff --git a/include/linux/pkt_cls.h b/include/linux/pkt_cls.h -index b69358b..af17f3c 100644 ---- a/include/linux/pkt_cls.h -+++ b/include/linux/pkt_cls.h -@@ -12,6 +12,7 @@ enum { - TCA_ACT_OPTIONS, - TCA_ACT_INDEX, - TCA_ACT_STATS, -+ TCA_ACT_PAD, - __TCA_ACT_MAX - }; - -@@ -60,8 +61,8 @@ struct tc_police { - __u32 mtu; - struct tc_ratespec rate; - struct tc_ratespec peakrate; -- int refcnt; -- int bindcnt; -+ int refcnt; -+ int bindcnt; - __u32 capab; - }; - -@@ -69,10 +70,11 @@ struct tcf_t { - __u64 install; - __u64 lastuse; - __u64 expires; -+ __u64 firstuse; - }; - - struct tc_cnt { -- int refcnt; -+ int refcnt; - int bindcnt; - }; - -@@ -90,12 +92,18 @@ enum { - TCA_POLICE_PEAKRATE, - TCA_POLICE_AVRATE, - TCA_POLICE_RESULT, -+ TCA_POLICE_TM, -+ TCA_POLICE_PAD, - __TCA_POLICE_MAX - #define TCA_POLICE_RESULT TCA_POLICE_RESULT - }; - - #define TCA_POLICE_MAX (__TCA_POLICE_MAX - 1) - -+/* tca flags definitions */ -+#define TCA_CLS_FLAGS_SKIP_HW (1 << 0) -+#define TCA_CLS_FLAGS_SKIP_SW (1 << 1) -+ - /* U32 filters */ - - #define TC_U32_HTID(h) ((h)&0xFFF00000) -@@ -114,11 +122,12 @@ enum { - TCA_U32_DIVISOR, - TCA_U32_SEL, - TCA_U32_POLICE, -- TCA_U32_ACT, -+ TCA_U32_ACT, - TCA_U32_INDEV, - TCA_U32_PCNT, - TCA_U32_MARK, - TCA_U32_FLAGS, -+ TCA_U32_PAD, - __TCA_U32_MAX - }; - -@@ -333,6 +342,8 @@ enum { - TCA_BPF_FD, - TCA_BPF_NAME, - TCA_BPF_FLAGS, -+ TCA_BPF_FLAGS_GEN, -+ TCA_BPF_TAG, - __TCA_BPF_MAX, - }; - -@@ -365,11 +376,68 @@ enum { - TCA_FLOWER_KEY_UDP_DST, /* be16 */ - - TCA_FLOWER_FLAGS, -+ TCA_FLOWER_KEY_VLAN_ID, /* be16 */ -+ TCA_FLOWER_KEY_VLAN_PRIO, /* u8 */ -+ TCA_FLOWER_KEY_VLAN_ETH_TYPE, /* be16 */ -+ -+ TCA_FLOWER_KEY_ENC_KEY_ID, /* be32 */ -+ TCA_FLOWER_KEY_ENC_IPV4_SRC, /* be32 */ -+ TCA_FLOWER_KEY_ENC_IPV4_SRC_MASK,/* be32 */ -+ TCA_FLOWER_KEY_ENC_IPV4_DST, /* be32 */ -+ TCA_FLOWER_KEY_ENC_IPV4_DST_MASK,/* be32 */ -+ TCA_FLOWER_KEY_ENC_IPV6_SRC, /* struct in6_addr */ -+ TCA_FLOWER_KEY_ENC_IPV6_SRC_MASK,/* struct in6_addr */ -+ TCA_FLOWER_KEY_ENC_IPV6_DST, /* struct in6_addr */ -+ TCA_FLOWER_KEY_ENC_IPV6_DST_MASK,/* struct in6_addr */ -+ -+ TCA_FLOWER_KEY_TCP_SRC_MASK, /* be16 */ -+ TCA_FLOWER_KEY_TCP_DST_MASK, /* be16 */ -+ TCA_FLOWER_KEY_UDP_SRC_MASK, /* be16 */ -+ TCA_FLOWER_KEY_UDP_DST_MASK, /* be16 */ -+ TCA_FLOWER_KEY_SCTP_SRC_MASK, /* be16 */ -+ TCA_FLOWER_KEY_SCTP_DST_MASK, /* be16 */ -+ -+ TCA_FLOWER_KEY_SCTP_SRC, /* be16 */ -+ TCA_FLOWER_KEY_SCTP_DST, /* be16 */ -+ -+ TCA_FLOWER_KEY_ENC_UDP_SRC_PORT, /* be16 */ -+ TCA_FLOWER_KEY_ENC_UDP_SRC_PORT_MASK, /* be16 */ -+ TCA_FLOWER_KEY_ENC_UDP_DST_PORT, /* be16 */ -+ TCA_FLOWER_KEY_ENC_UDP_DST_PORT_MASK, /* be16 */ -+ -+ TCA_FLOWER_KEY_FLAGS, /* be32 */ -+ TCA_FLOWER_KEY_FLAGS_MASK, /* be32 */ -+ -+ TCA_FLOWER_KEY_ICMPV4_CODE, /* u8 */ -+ TCA_FLOWER_KEY_ICMPV4_CODE_MASK,/* u8 */ -+ TCA_FLOWER_KEY_ICMPV4_TYPE, /* u8 */ -+ TCA_FLOWER_KEY_ICMPV4_TYPE_MASK,/* u8 */ -+ TCA_FLOWER_KEY_ICMPV6_CODE, /* u8 */ -+ TCA_FLOWER_KEY_ICMPV6_CODE_MASK,/* u8 */ -+ TCA_FLOWER_KEY_ICMPV6_TYPE, /* u8 */ -+ TCA_FLOWER_KEY_ICMPV6_TYPE_MASK,/* u8 */ -+ - __TCA_FLOWER_MAX, - }; - - #define TCA_FLOWER_MAX (__TCA_FLOWER_MAX - 1) - -+enum { -+ TCA_FLOWER_KEY_FLAGS_IS_FRAGMENT = (1 << 0), -+}; -+ -+/* Match-all classifier */ -+ -+enum { -+ TCA_MATCHALL_UNSPEC, -+ TCA_MATCHALL_CLASSID, -+ TCA_MATCHALL_ACT, -+ TCA_MATCHALL_FLAGS, -+ __TCA_MATCHALL_MAX, -+}; -+ -+#define TCA_MATCHALL_MAX (__TCA_MATCHALL_MAX - 1) -+ - /* Extended Matches */ - - struct tcf_ematch_tree_hdr { -diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h -index 8cb18b4..df7451d 100644 ---- a/include/linux/pkt_sched.h -+++ b/include/linux/pkt_sched.h -@@ -179,6 +179,7 @@ enum { - TCA_TBF_PRATE64, - TCA_TBF_BURST, - TCA_TBF_PBURST, -+ TCA_TBF_PAD, - __TCA_TBF_MAX, - }; - -@@ -368,6 +369,7 @@ enum { - TCA_HTB_DIRECT_QLEN, - TCA_HTB_RATE64, - TCA_HTB_CEIL64, -+ TCA_HTB_PAD, - __TCA_HTB_MAX, - }; - -@@ -531,6 +533,7 @@ enum { - TCA_NETEM_RATE, - TCA_NETEM_ECN, - TCA_NETEM_RATE64, -+ TCA_NETEM_PAD, - __TCA_NETEM_MAX, - }; - -@@ -715,6 +718,8 @@ enum { - TCA_FQ_CODEL_FLOWS, - TCA_FQ_CODEL_QUANTUM, - TCA_FQ_CODEL_CE_THRESHOLD, -+ TCA_FQ_CODEL_DROP_BATCH_SIZE, -+ TCA_FQ_CODEL_MEMORY_LIMIT, - __TCA_FQ_CODEL_MAX - }; - -@@ -739,6 +744,8 @@ struct tc_fq_codel_qd_stats { - __u32 new_flows_len; /* count of flows in new list */ - __u32 old_flows_len; /* count of flows in old list */ - __u32 ce_mark; /* packets above ce_threshold */ -+ __u32 memory_usage; /* in bytes */ -+ __u32 drop_overmemory; - }; - - struct tc_fq_codel_cl_stats { -@@ -785,6 +792,8 @@ enum { - - TCA_FQ_ORPHAN_MASK, /* mask applied to orphaned skb hashes */ - -+ TCA_FQ_LOW_RATE_THRESHOLD, /* per packet delay under this rate */ -+ - __TCA_FQ_MAX - }; - -@@ -802,7 +811,7 @@ struct tc_fq_qd_stats { - __u32 flows; - __u32 inactive_flows; - __u32 throttled_flows; -- __u32 pad; -+ __u32 unthrottle_latency_ns; - }; - - /* Heavy-Hitter Filter */ -diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h -index 6aaa2a3..78a70c2 100644 ---- a/include/linux/rtnetlink.h -+++ b/include/linux/rtnetlink.h -@@ -139,6 +139,11 @@ enum { - RTM_GETNSID = 90, - #define RTM_GETNSID RTM_GETNSID - -+ RTM_NEWSTATS = 92, -+#define RTM_NEWSTATS RTM_NEWSTATS -+ RTM_GETSTATS = 94, -+#define RTM_GETSTATS RTM_GETSTATS -+ - __RTM_MAX, - #define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1) - }; -@@ -312,6 +317,8 @@ enum rtattr_type_t { - RTA_ENCAP_TYPE, - RTA_ENCAP, - RTA_EXPIRES, -+ RTA_PAD, -+ RTA_UID, - __RTA_MAX - }; - -@@ -344,7 +351,7 @@ struct rtnexthop { - #define RTNH_F_OFFLOAD 8 /* offloaded route */ - #define RTNH_F_LINKDOWN 16 /* carrier-down on nexthop */ - --#define RTNH_COMPARE_MASK (RTNH_F_DEAD | RTNH_F_LINKDOWN) -+#define RTNH_COMPARE_MASK (RTNH_F_DEAD | RTNH_F_LINKDOWN | RTNH_F_OFFLOAD) - - /* Macros to handle hexthops */ - -@@ -536,6 +543,7 @@ enum { - TCA_FCNT, - TCA_STATS2, - TCA_STAB, -+ TCA_PAD, - __TCA_MAX - }; - -diff --git a/include/linux/sock_diag.h b/include/linux/sock_diag.h -index dafcb89..901231e 100644 ---- a/include/linux/sock_diag.h -+++ b/include/linux/sock_diag.h -@@ -20,6 +20,7 @@ enum { - SK_MEMINFO_WMEM_QUEUED, - SK_MEMINFO_OPTMEM, - SK_MEMINFO_BACKLOG, -+ SK_MEMINFO_DROPS, - - SK_MEMINFO_VARS, - }; -diff --git a/include/linux/tc_act/tc_bpf.h b/include/linux/tc_act/tc_bpf.h -index 07f17cc..975b50d 100644 ---- a/include/linux/tc_act/tc_bpf.h -+++ b/include/linux/tc_act/tc_bpf.h -@@ -26,6 +26,8 @@ enum { - TCA_ACT_BPF_OPS, - TCA_ACT_BPF_FD, - TCA_ACT_BPF_NAME, -+ TCA_ACT_BPF_PAD, -+ TCA_ACT_BPF_TAG, - __TCA_ACT_BPF_MAX, - }; - #define TCA_ACT_BPF_MAX (__TCA_ACT_BPF_MAX - 1) -diff --git a/include/linux/tc_act/tc_connmark.h b/include/linux/tc_act/tc_connmark.h -index 994b097..62a5e94 100644 ---- a/include/linux/tc_act/tc_connmark.h -+++ b/include/linux/tc_act/tc_connmark.h -@@ -15,6 +15,7 @@ enum { - TCA_CONNMARK_UNSPEC, - TCA_CONNMARK_PARMS, - TCA_CONNMARK_TM, -+ TCA_CONNMARK_PAD, - __TCA_CONNMARK_MAX - }; - #define TCA_CONNMARK_MAX (__TCA_CONNMARK_MAX - 1) -diff --git a/include/linux/tc_act/tc_csum.h b/include/linux/tc_act/tc_csum.h -index a047c49..8ac8041 100644 ---- a/include/linux/tc_act/tc_csum.h -+++ b/include/linux/tc_act/tc_csum.h -@@ -10,6 +10,7 @@ enum { - TCA_CSUM_UNSPEC, - TCA_CSUM_PARMS, - TCA_CSUM_TM, -+ TCA_CSUM_PAD, - __TCA_CSUM_MAX - }; - #define TCA_CSUM_MAX (__TCA_CSUM_MAX - 1) -diff --git a/include/linux/tc_act/tc_defact.h b/include/linux/tc_act/tc_defact.h -index 17dddb4..d2a3abb 100644 ---- a/include/linux/tc_act/tc_defact.h -+++ b/include/linux/tc_act/tc_defact.h -@@ -12,6 +12,7 @@ enum { - TCA_DEF_TM, - TCA_DEF_PARMS, - TCA_DEF_DATA, -+ TCA_DEF_PAD, - __TCA_DEF_MAX - }; - #define TCA_DEF_MAX (__TCA_DEF_MAX - 1) -diff --git a/include/linux/tc_act/tc_gact.h b/include/linux/tc_act/tc_gact.h -index f7bf94e..70b536a 100644 ---- a/include/linux/tc_act/tc_gact.h -+++ b/include/linux/tc_act/tc_gact.h -@@ -25,6 +25,7 @@ enum { - TCA_GACT_TM, - TCA_GACT_PARMS, - TCA_GACT_PROB, -+ TCA_GACT_PAD, - __TCA_GACT_MAX - }; - #define TCA_GACT_MAX (__TCA_GACT_MAX - 1) -diff --git a/include/linux/tc_act/tc_ife.h b/include/linux/tc_act/tc_ife.h -index d648ff6..cd18360 100644 ---- a/include/linux/tc_act/tc_ife.h -+++ b/include/linux/tc_act/tc_ife.h -@@ -23,6 +23,7 @@ enum { - TCA_IFE_SMAC, - TCA_IFE_TYPE, - TCA_IFE_METALST, -+ TCA_IFE_PAD, - __TCA_IFE_MAX - }; - #define TCA_IFE_MAX (__TCA_IFE_MAX - 1) -@@ -31,8 +32,9 @@ enum { - #define IFE_META_HASHID 2 - #define IFE_META_PRIO 3 - #define IFE_META_QMAP 4 -+#define IFE_META_TCINDEX 5 - /*Can be overridden at runtime by module option*/ --#define __IFE_META_MAX 5 -+#define __IFE_META_MAX 6 - #define IFE_META_MAX (__IFE_META_MAX - 1) - - #endif -diff --git a/include/linux/tc_act/tc_ipt.h b/include/linux/tc_act/tc_ipt.h -index 130aaad..7c6e155 100644 ---- a/include/linux/tc_act/tc_ipt.h -+++ b/include/linux/tc_act/tc_ipt.h -@@ -14,6 +14,7 @@ enum { - TCA_IPT_CNT, - TCA_IPT_TM, - TCA_IPT_TARG, -+ TCA_IPT_PAD, - __TCA_IPT_MAX - }; - #define TCA_IPT_MAX (__TCA_IPT_MAX - 1) -diff --git a/include/linux/tc_act/tc_mirred.h b/include/linux/tc_act/tc_mirred.h -index 7561750..3d7a2b3 100644 ---- a/include/linux/tc_act/tc_mirred.h -+++ b/include/linux/tc_act/tc_mirred.h -@@ -20,6 +20,7 @@ enum { - TCA_MIRRED_UNSPEC, - TCA_MIRRED_TM, - TCA_MIRRED_PARMS, -+ TCA_MIRRED_PAD, - __TCA_MIRRED_MAX - }; - #define TCA_MIRRED_MAX (__TCA_MIRRED_MAX - 1) -diff --git a/include/linux/tc_act/tc_nat.h b/include/linux/tc_act/tc_nat.h -index 6663aeb..923457c 100644 ---- a/include/linux/tc_act/tc_nat.h -+++ b/include/linux/tc_act/tc_nat.h -@@ -10,6 +10,7 @@ enum { - TCA_NAT_UNSPEC, - TCA_NAT_PARMS, - TCA_NAT_TM, -+ TCA_NAT_PAD, - __TCA_NAT_MAX - }; - #define TCA_NAT_MAX (__TCA_NAT_MAX - 1) -diff --git a/include/linux/tc_act/tc_pedit.h b/include/linux/tc_act/tc_pedit.h -index 716cfab..6389959 100644 ---- a/include/linux/tc_act/tc_pedit.h -+++ b/include/linux/tc_act/tc_pedit.h -@@ -10,6 +10,7 @@ enum { - TCA_PEDIT_UNSPEC, - TCA_PEDIT_TM, - TCA_PEDIT_PARMS, -+ TCA_PEDIT_PAD, - __TCA_PEDIT_MAX - }; - #define TCA_PEDIT_MAX (__TCA_PEDIT_MAX - 1) -diff --git a/include/linux/tc_act/tc_skbedit.h b/include/linux/tc_act/tc_skbedit.h -index 7a2e910..2884425 100644 ---- a/include/linux/tc_act/tc_skbedit.h -+++ b/include/linux/tc_act/tc_skbedit.h -@@ -27,6 +27,8 @@ - #define SKBEDIT_F_PRIORITY 0x1 - #define SKBEDIT_F_QUEUE_MAPPING 0x2 - #define SKBEDIT_F_MARK 0x4 -+#define SKBEDIT_F_PTYPE 0x8 -+#define SKBEDIT_F_MASK 0x10 - - struct tc_skbedit { - tc_gen; -@@ -39,6 +41,9 @@ enum { - TCA_SKBEDIT_PRIORITY, - TCA_SKBEDIT_QUEUE_MAPPING, - TCA_SKBEDIT_MARK, -+ TCA_SKBEDIT_PAD, -+ TCA_SKBEDIT_PTYPE, -+ TCA_SKBEDIT_MASK, - __TCA_SKBEDIT_MAX - }; - #define TCA_SKBEDIT_MAX (__TCA_SKBEDIT_MAX - 1) -diff --git a/include/linux/tc_act/tc_tunnel_key.h b/include/linux/tc_act/tc_tunnel_key.h -new file mode 100644 -index 0000000..84ea55e ---- /dev/null -+++ b/include/linux/tc_act/tc_tunnel_key.h -@@ -0,0 +1,42 @@ -+/* -+ * Copyright (c) 2016, Amir Vadai -+ * Copyright (c) 2016, Mellanox Technologies. All rights reserved. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ */ -+ -+#ifndef __LINUX_TC_TUNNEL_KEY_H -+#define __LINUX_TC_TUNNEL_KEY_H -+ -+#include -+ -+#define TCA_ACT_TUNNEL_KEY 17 -+ -+#define TCA_TUNNEL_KEY_ACT_SET 1 -+#define TCA_TUNNEL_KEY_ACT_RELEASE 2 -+ -+struct tc_tunnel_key { -+ tc_gen; -+ int t_action; -+}; -+ -+enum { -+ TCA_TUNNEL_KEY_UNSPEC, -+ TCA_TUNNEL_KEY_TM, -+ TCA_TUNNEL_KEY_PARMS, -+ TCA_TUNNEL_KEY_ENC_IPV4_SRC, /* be32 */ -+ TCA_TUNNEL_KEY_ENC_IPV4_DST, /* be32 */ -+ TCA_TUNNEL_KEY_ENC_IPV6_SRC, /* struct in6_addr */ -+ TCA_TUNNEL_KEY_ENC_IPV6_DST, /* struct in6_addr */ -+ TCA_TUNNEL_KEY_ENC_KEY_ID, /* be64 */ -+ TCA_TUNNEL_KEY_PAD, -+ TCA_TUNNEL_KEY_ENC_DST_PORT, /* be16 */ -+ __TCA_TUNNEL_KEY_MAX, -+}; -+ -+#define TCA_TUNNEL_KEY_MAX (__TCA_TUNNEL_KEY_MAX - 1) -+ -+#endif -diff --git a/include/linux/tc_act/tc_vlan.h b/include/linux/tc_act/tc_vlan.h -index f7b8d44..bddb272 100644 ---- a/include/linux/tc_act/tc_vlan.h -+++ b/include/linux/tc_act/tc_vlan.h -@@ -16,6 +16,7 @@ - - #define TCA_VLAN_ACT_POP 1 - #define TCA_VLAN_ACT_PUSH 2 -+#define TCA_VLAN_ACT_MODIFY 3 - - struct tc_vlan { - tc_gen; -@@ -28,6 +29,8 @@ enum { - TCA_VLAN_PARMS, - TCA_VLAN_PUSH_VLAN_ID, - TCA_VLAN_PUSH_VLAN_PROTOCOL, -+ TCA_VLAN_PAD, -+ TCA_VLAN_PUSH_VLAN_PRIORITY, - __TCA_VLAN_MAX, - }; - #define TCA_VLAN_MAX (__TCA_VLAN_MAX - 1) -diff --git a/include/linux/tcp.h b/include/linux/tcp.h -index 7f21db9..646c488 100644 ---- a/include/linux/tcp.h -+++ b/include/linux/tcp.h -@@ -115,12 +115,22 @@ enum { - #define TCP_CC_INFO 26 /* Get Congestion Control (optional) info */ - #define TCP_SAVE_SYN 27 /* Record SYN headers for new connections */ - #define TCP_SAVED_SYN 28 /* Get SYN headers recorded for connection */ -+#define TCP_REPAIR_WINDOW 29 /* Get/set window parameters */ - - struct tcp_repair_opt { - __u32 opt_code; - __u32 opt_val; - }; - -+struct tcp_repair_window { -+ __u32 snd_wl1; -+ __u32 snd_wnd; -+ __u32 max_window; -+ -+ __u32 rcv_wnd; -+ __u32 rcv_wup; -+}; -+ - enum { - TCP_NO_QUEUE, - TCP_RECV_QUEUE, -@@ -157,6 +167,7 @@ struct tcp_info { - __u8 tcpi_backoff; - __u8 tcpi_options; - __u8 tcpi_snd_wscale : 4, tcpi_rcv_wscale : 4; -+ __u8 tcpi_delivery_rate_app_limited:1; - - __u32 tcpi_rto; - __u32 tcpi_ato; -@@ -201,6 +212,20 @@ struct tcp_info { - __u32 tcpi_min_rtt; - __u32 tcpi_data_segs_in; /* RFC4898 tcpEStatsDataSegsIn */ - __u32 tcpi_data_segs_out; /* RFC4898 tcpEStatsDataSegsOut */ -+ -+ __u64 tcpi_delivery_rate; -+ -+ __u64 tcpi_busy_time; /* Time (usec) busy sending data */ -+ __u64 tcpi_rwnd_limited; /* Time (usec) limited by receive window */ -+ __u64 tcpi_sndbuf_limited; /* Time (usec) limited by send buffer */ -+}; -+ -+/* netlink attributes types for SCM_TIMESTAMPING_OPT_STATS */ -+enum { -+ TCP_NLA_PAD, -+ TCP_NLA_BUSY, /* Time (usec) busy sending data */ -+ TCP_NLA_RWND_LIMITED, /* Time (usec) limited by receive window */ -+ TCP_NLA_SNDBUF_LIMITED, /* Time (usec) limited by send buffer */ - }; - - /* for TCP_MD5SIG socket option */ -diff --git a/include/linux/tcp_metrics.h b/include/linux/tcp_metrics.h -index 9353392..80ad90d 100644 ---- a/include/linux/tcp_metrics.h -+++ b/include/linux/tcp_metrics.h -@@ -40,6 +40,7 @@ enum { - TCP_METRICS_ATTR_FOPEN_COOKIE, /* binary */ - TCP_METRICS_ATTR_SADDR_IPV4, /* u32 */ - TCP_METRICS_ATTR_SADDR_IPV6, /* binary */ -+ TCP_METRICS_ATTR_PAD, - - __TCP_METRICS_ATTR_MAX, - }; -diff --git a/include/linux/tipc.h b/include/linux/tipc.h -index ebd3b63..4004300 100644 ---- a/include/linux/tipc.h -+++ b/include/linux/tipc.h -@@ -60,26 +60,48 @@ struct tipc_name_seq { - __u32 upper; - }; - -+/* TIPC Address Size, Offset, Mask specification for Z.C.N -+ */ -+#define TIPC_NODE_BITS 12 -+#define TIPC_CLUSTER_BITS 12 -+#define TIPC_ZONE_BITS 8 -+ -+#define TIPC_NODE_OFFSET 0 -+#define TIPC_CLUSTER_OFFSET TIPC_NODE_BITS -+#define TIPC_ZONE_OFFSET (TIPC_CLUSTER_OFFSET + TIPC_CLUSTER_BITS) -+ -+#define TIPC_NODE_SIZE ((1UL << TIPC_NODE_BITS) - 1) -+#define TIPC_CLUSTER_SIZE ((1UL << TIPC_CLUSTER_BITS) - 1) -+#define TIPC_ZONE_SIZE ((1UL << TIPC_ZONE_BITS) - 1) -+ -+#define TIPC_NODE_MASK (TIPC_NODE_SIZE << TIPC_NODE_OFFSET) -+#define TIPC_CLUSTER_MASK (TIPC_CLUSTER_SIZE << TIPC_CLUSTER_OFFSET) -+#define TIPC_ZONE_MASK (TIPC_ZONE_SIZE << TIPC_ZONE_OFFSET) -+ -+#define TIPC_ZONE_CLUSTER_MASK (TIPC_ZONE_MASK | TIPC_CLUSTER_MASK) -+ - static __inline__ __u32 tipc_addr(unsigned int zone, - unsigned int cluster, - unsigned int node) - { -- return (zone << 24) | (cluster << 12) | node; -+ return (zone << TIPC_ZONE_OFFSET) | -+ (cluster << TIPC_CLUSTER_OFFSET) | -+ node; - } - - static __inline__ unsigned int tipc_zone(__u32 addr) - { -- return addr >> 24; -+ return addr >> TIPC_ZONE_OFFSET; - } - - static __inline__ unsigned int tipc_cluster(__u32 addr) - { -- return (addr >> 12) & 0xfff; -+ return (addr & TIPC_CLUSTER_MASK) >> TIPC_CLUSTER_OFFSET; - } - - static __inline__ unsigned int tipc_node(__u32 addr) - { -- return addr & 0xfff; -+ return addr & TIPC_NODE_MASK; - } - - /* -diff --git a/include/linux/tipc_netlink.h b/include/linux/tipc_netlink.h -index d4c8f14..f9edd20 100644 ---- a/include/linux/tipc_netlink.h -+++ b/include/linux/tipc_netlink.h -@@ -56,6 +56,12 @@ enum { - TIPC_NL_NET_GET, - TIPC_NL_NET_SET, - TIPC_NL_NAME_TABLE_GET, -+ TIPC_NL_MON_SET, -+ TIPC_NL_MON_GET, -+ TIPC_NL_MON_PEER_GET, -+ TIPC_NL_PEER_REMOVE, -+ TIPC_NL_BEARER_ADD, -+ TIPC_NL_UDP_GET_REMOTEIP, - - __TIPC_NL_CMD_MAX, - TIPC_NL_CMD_MAX = __TIPC_NL_CMD_MAX - 1 -@@ -72,6 +78,8 @@ enum { - TIPC_NLA_NODE, /* nest */ - TIPC_NLA_NET, /* nest */ - TIPC_NLA_NAME_TABLE, /* nest */ -+ TIPC_NLA_MON, /* nest */ -+ TIPC_NLA_MON_PEER, /* nest */ - - __TIPC_NLA_MAX, - TIPC_NLA_MAX = __TIPC_NLA_MAX - 1 -@@ -93,6 +101,7 @@ enum { - TIPC_NLA_UDP_UNSPEC, - TIPC_NLA_UDP_LOCAL, /* sockaddr_storage */ - TIPC_NLA_UDP_REMOTE, /* sockaddr_storage */ -+ TIPC_NLA_UDP_MULTI_REMOTEIP, /* flag */ - - __TIPC_NLA_UDP_MAX, - TIPC_NLA_UDP_MAX = __TIPC_NLA_UDP_MAX - 1 -@@ -166,6 +175,20 @@ enum { - TIPC_NLA_NAME_TABLE_MAX = __TIPC_NLA_NAME_TABLE_MAX - 1 - }; - -+/* Monitor info */ -+enum { -+ TIPC_NLA_MON_UNSPEC, -+ TIPC_NLA_MON_ACTIVATION_THRESHOLD, /* u32 */ -+ TIPC_NLA_MON_REF, /* u32 */ -+ TIPC_NLA_MON_ACTIVE, /* flag */ -+ TIPC_NLA_MON_BEARER_NAME, /* string */ -+ TIPC_NLA_MON_PEERCNT, /* u32 */ -+ TIPC_NLA_MON_LISTGEN, /* u32 */ -+ -+ __TIPC_NLA_MON_MAX, -+ TIPC_NLA_MON_MAX = __TIPC_NLA_MON_MAX - 1 -+}; -+ - /* Publication info */ - enum { - TIPC_NLA_PUBL_UNSPEC, -@@ -182,6 +205,24 @@ enum { - TIPC_NLA_PUBL_MAX = __TIPC_NLA_PUBL_MAX - 1 - }; - -+/* Monitor peer info */ -+enum { -+ TIPC_NLA_MON_PEER_UNSPEC, -+ -+ TIPC_NLA_MON_PEER_ADDR, /* u32 */ -+ TIPC_NLA_MON_PEER_DOMGEN, /* u32 */ -+ TIPC_NLA_MON_PEER_APPLIED, /* u32 */ -+ TIPC_NLA_MON_PEER_UPMAP, /* u64 */ -+ TIPC_NLA_MON_PEER_MEMBERS, /* tlv */ -+ TIPC_NLA_MON_PEER_UP, /* flag */ -+ TIPC_NLA_MON_PEER_HEAD, /* flag */ -+ TIPC_NLA_MON_PEER_LOCAL, /* flag */ -+ TIPC_NLA_MON_PEER_PAD, /* flag */ -+ -+ __TIPC_NLA_MON_PEER_MAX, -+ TIPC_NLA_MON_PEER_MAX = __TIPC_NLA_MON_PEER_MAX - 1 -+}; -+ - /* Nest, connection info */ - enum { - TIPC_NLA_CON_UNSPEC, -diff --git a/include/linux/types.h b/include/linux/types.h -index 23ea78f..c640657 100644 ---- a/include/linux/types.h -+++ b/include/linux/types.h -@@ -18,11 +18,7 @@ - #else - #define __bitwise__ - #endif --#ifdef __CHECK_ENDIAN__ - #define __bitwise __bitwise__ --#else --#define __bitwise --#endif - - typedef __u16 __bitwise __le16; - typedef __u16 __bitwise __be16; -diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h -index b8f5451..d2dd1fd 100644 ---- a/include/linux/xfrm.h -+++ b/include/linux/xfrm.h -@@ -298,10 +298,11 @@ enum xfrm_attr_type_t { - XFRMA_ALG_AUTH_TRUNC, /* struct xfrm_algo_auth */ - XFRMA_MARK, /* struct xfrm_mark */ - XFRMA_TFCPAD, /* __u32 */ -- XFRMA_REPLAY_ESN_VAL, /* struct xfrm_replay_esn */ -+ XFRMA_REPLAY_ESN_VAL, /* struct xfrm_replay_state_esn */ - XFRMA_SA_EXTRA_FLAGS, /* __u32 */ - XFRMA_PROTO, /* __u8 */ - XFRMA_ADDRESS_FILTER, /* struct xfrm_address_filter */ -+ XFRMA_PAD, - __XFRMA_MAX - - #define XFRMA_MAX (__XFRMA_MAX - 1) --- -1.8.3.1 - diff --git a/SOURCES/0095-bridge-add-support-for-the-multicast-flood-flag.patch b/SOURCES/0095-bridge-add-support-for-the-multicast-flood-flag.patch deleted file mode 100644 index a6a8162..0000000 --- a/SOURCES/0095-bridge-add-support-for-the-multicast-flood-flag.patch +++ /dev/null @@ -1,164 +0,0 @@ -From b13ed2eea122977b06091fe4dc1f885ac24ff168 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:13:18 +0100 -Subject: [PATCH] bridge: add support for the multicast flood flag - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit 9208b4e7c9834 - -commit 9208b4e7c983447368c43e4cdc3d2cfce9e19069 -Author: Nikolay Aleksandrov -Date: Thu Oct 13 17:54:20 2016 +0200 - - bridge: add support for the multicast flood flag - - Recently a new per-port flag was added which controls the flooding of - unknown multicast, this patch adds support for controlling it via iproute2. - It also updates the man pages with information about the new flag. - - Signed-off-by: Nikolay Aleksandrov ---- - bridge/link.c | 12 ++++++++++++ - ip/iplink_bridge_slave.c | 9 +++++++++ - man/man8/bridge.8 | 7 ++++++- - man/man8/ip-link.8.in | 7 ++++++- - 4 files changed, 33 insertions(+), 2 deletions(-) - -diff --git a/bridge/link.c b/bridge/link.c -index 353e1c3..da49469 100644 ---- a/bridge/link.c -+++ b/bridge/link.c -@@ -195,6 +195,9 @@ int print_linkinfo(const struct sockaddr_nl *who, - if (prtb[IFLA_BRPORT_UNICAST_FLOOD]) - print_onoff(fp, "flood", - rta_getattr_u8(prtb[IFLA_BRPORT_UNICAST_FLOOD])); -+ if (prtb[IFLA_BRPORT_MCAST_FLOOD]) -+ print_onoff(fp, "mcast_flood", -+ rta_getattr_u8(prtb[IFLA_BRPORT_MCAST_FLOOD])); - } - } else - print_portstate(fp, rta_getattr_u8(tb[IFLA_PROTINFO])); -@@ -227,6 +230,7 @@ static void usage(void) - fprintf(stderr, " [ learning {on | off} ]\n"); - fprintf(stderr, " [ learning_sync {on | off} ]\n"); - fprintf(stderr, " [ flood {on | off} ]\n"); -+ fprintf(stderr, " [ mcast_flood {on | off} ]\n"); - fprintf(stderr, " [ hwmode {vepa | veb} ]\n"); - fprintf(stderr, " [ self ] [ master ]\n"); - fprintf(stderr, " bridge link show [dev DEV]\n"); -@@ -260,6 +264,7 @@ static int brlink_modify(int argc, char **argv) - __s8 learning = -1; - __s8 learning_sync = -1; - __s8 flood = -1; -+ __s8 mcast_flood = -1; - __s8 hairpin = -1; - __s8 bpdu_guard = -1; - __s8 fast_leave = -1; -@@ -310,6 +315,10 @@ static int brlink_modify(int argc, char **argv) - NEXT_ARG(); - if (!on_off("flood", &flood, *argv)) - return -1; -+ } else if (strcmp(*argv, "mcast_flood") == 0) { -+ NEXT_ARG(); -+ if (!on_off("mcast_flood", &mcast_flood, *argv)) -+ return -1; - } else if (strcmp(*argv, "cost") == 0) { - NEXT_ARG(); - cost = atoi(*argv); -@@ -382,6 +391,9 @@ static int brlink_modify(int argc, char **argv) - addattr8(&req.n, sizeof(req), IFLA_BRPORT_PROTECT, root_block); - if (flood >= 0) - addattr8(&req.n, sizeof(req), IFLA_BRPORT_UNICAST_FLOOD, flood); -+ if (mcast_flood >= 0) -+ addattr8(&req.n, sizeof(req), IFLA_BRPORT_MCAST_FLOOD, -+ mcast_flood); - if (learning >= 0) - addattr8(&req.n, sizeof(req), IFLA_BRPORT_LEARNING, learning); - if (learning_sync >= 0) -diff --git a/ip/iplink_bridge_slave.c b/ip/iplink_bridge_slave.c -index 3ec2bba..95efca8 100644 ---- a/ip/iplink_bridge_slave.c -+++ b/ip/iplink_bridge_slave.c -@@ -33,6 +33,7 @@ static void print_explain(FILE *f) - " [ proxy_arp_wifi {on | off} ]\n" - " [ mcast_router MULTICAST_ROUTER ]\n" - " [ mcast_fast_leave {on | off} ]\n" -+ " [ mcast_flood {on | off} ]\n" - ); - } - -@@ -187,6 +188,10 @@ static void bridge_slave_print_opt(struct link_util *lu, FILE *f, - if (tb[IFLA_BRPORT_FAST_LEAVE]) - print_onoff(f, "mcast_fast_leave", - rta_getattr_u8(tb[IFLA_BRPORT_FAST_LEAVE])); -+ -+ if (tb[IFLA_BRPORT_MCAST_FLOOD]) -+ print_onoff(f, "mcast_flood", -+ rta_getattr_u8(tb[IFLA_BRPORT_MCAST_FLOOD])); - } - - static void bridge_slave_parse_on_off(char *arg_name, char *arg_val, -@@ -251,6 +256,10 @@ static int bridge_slave_parse_opt(struct link_util *lu, int argc, char **argv, - NEXT_ARG(); - bridge_slave_parse_on_off("flood", *argv, n, - IFLA_BRPORT_UNICAST_FLOOD); -+ } else if (matches(*argv, "mcast_flood") == 0) { -+ NEXT_ARG(); -+ bridge_slave_parse_on_off("mcast_flood", *argv, n, -+ IFLA_BRPORT_MCAST_FLOOD); - } else if (matches(*argv, "proxy_arp") == 0) { - NEXT_ARG(); - bridge_slave_parse_on_off("proxy_arp", *argv, n, -diff --git a/man/man8/bridge.8 b/man/man8/bridge.8 -index c09b8c3..77124bb 100644 ---- a/man/man8/bridge.8 -+++ b/man/man8/bridge.8 -@@ -42,7 +42,8 @@ bridge \- show / manipulate bridge addresses and devices - .BR learning_sync " { " on " | " off " } ] [ " - .BR flood " { " on " | " off " } ] [ " - .BR hwmode " { " vepa " | " veb " } ] [ " --.BR self " ] [ " master " ] " -+.BR mcast_flood " { " on " | " off " } ] [ " -+.BR self " ] [ " master " ]" - - .ti -8 - .BR "bridge link" " [ " show " ] [ " -@@ -305,6 +306,10 @@ switch. - - bridging happens in hardware. - - .TP -+.BR "mcast_flood on " or " mcast_flood off " -+Controls whether a given port will be flooded with multicast traffic for which there is no MDB entry. By default this flag is on. -+ -+.TP - .BI self - link setting is configured on specified physical device - -diff --git a/man/man8/ip-link.8.in b/man/man8/ip-link.8.in -index 38e5416..8030203 100644 ---- a/man/man8/ip-link.8.in -+++ b/man/man8/ip-link.8.in -@@ -1144,7 +1144,9 @@ the following additional arguments are supported: - ] [ - .BI mcast_router " MULTICAST_ROUTER" - ] [ --.BR mcast_fast_leave " { " on " | " off "} ]" -+.BR mcast_fast_leave " { " on " | " off "}" -+] [ -+.BR mcast_flood " { " on " | " off " } ]" - - .in +8 - .sp -@@ -1213,6 +1215,9 @@ queries. - .B fastleave - option above. - -+.BR mcast_flood " { " on " | " off " }" -+- controls whether a given port will be flooded with multicast traffic for which there is no MDB entry. -+ - .in -8 - - .TP --- -1.8.3.1 - diff --git a/SOURCES/0096-change-of-rtnetlink-to-use-RTN_F_OFFLOAD.patch b/SOURCES/0096-change-of-rtnetlink-to-use-RTN_F_OFFLOAD.patch deleted file mode 100644 index 0509a72..0000000 --- a/SOURCES/0096-change-of-rtnetlink-to-use-RTN_F_OFFLOAD.patch +++ /dev/null @@ -1,35 +0,0 @@ -From ecf397760bfe1a5f9742cafa75761e68678c38ee Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 28 Feb 2017 16:13:18 +0100 -Subject: [PATCH] change of rtnetlink to use RTN_F_OFFLOAD - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289 -Upstream Status: iproute2.git commit c52827e9077f7 - -commit c52827e9077f781f4d5f52f0c0aa67b59151e187 -Author: Stephen Hemminger -Date: Wed May 27 18:29:02 2015 -0700 - - change of rtnetlink to use RTN_F_OFFLOAD - - The definition of offload flag changed during 4.1 rc process. ---- - ip/iproute.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/ip/iproute.c b/ip/iproute.c -index 73c6db9..eb5d145 100644 ---- a/ip/iproute.c -+++ b/ip/iproute.c -@@ -438,7 +438,7 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - fprintf(fp, "onlink "); - if (r->rtm_flags & RTNH_F_PERVASIVE) - fprintf(fp, "pervasive "); -- if (r->rtm_flags & RTNH_F_EXTERNAL) -+ if (r->rtm_flags & RTNH_F_OFFLOAD) - fprintf(fp, "offload "); - if (r->rtm_flags & RTM_F_NOTIFY) - fprintf(fp, "notify "); --- -1.8.3.1 - diff --git a/SOURCES/0097-ip-make-resolve-addr-to-print-names-rather-than-addr.patch b/SOURCES/0097-ip-make-resolve-addr-to-print-names-rather-than-addr.patch deleted file mode 100644 index 8fcdd1e..0000000 --- a/SOURCES/0097-ip-make-resolve-addr-to-print-names-rather-than-addr.patch +++ /dev/null @@ -1,64 +0,0 @@ -From 678ff7158b887b5ecd32e5c6be319a8541001b50 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 13:17:53 +0100 -Subject: [PATCH] ip: make -resolve addr to print names rather than addresses - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629 -Upstream Status: iproute2.git commit ffa35d930b9ba - -commit ffa35d930b9bae8324768c5b018adaf26258aff9 -Author: Sami Kerola -Date: Mon Sep 30 22:01:48 2013 +0100 - - ip: make -resolve addr to print names rather than addresses - - As a system admin I occasionally want to be able to check that all - interfaces has a name in DNS or /etc/hosts file. - - Signed-off-by: Sami Kerola ---- - ip/ipaddress.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/ip/ipaddress.c b/ip/ipaddress.c -index d5bc2dc..147bcca 100644 ---- a/ip/ipaddress.c -+++ b/ip/ipaddress.c -@@ -864,7 +864,7 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n, - fprintf(fp, " family %d ", ifa->ifa_family); - - if (rta_tb[IFA_LOCAL]) { -- fprintf(fp, "%s", rt_addr_n2a(ifa->ifa_family, -+ fprintf(fp, "%s", format_host(ifa->ifa_family, - RTA_PAYLOAD(rta_tb[IFA_LOCAL]), - RTA_DATA(rta_tb[IFA_LOCAL]), - abuf, sizeof(abuf))); -@@ -875,7 +875,7 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n, - fprintf(fp, "/%d ", ifa->ifa_prefixlen); - } else { - fprintf(fp, " peer %s/%d ", -- rt_addr_n2a(ifa->ifa_family, -+ format_host(ifa->ifa_family, - RTA_PAYLOAD(rta_tb[IFA_ADDRESS]), - RTA_DATA(rta_tb[IFA_ADDRESS]), - abuf, sizeof(abuf)), -@@ -885,14 +885,14 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n, - - if (rta_tb[IFA_BROADCAST]) { - fprintf(fp, "brd %s ", -- rt_addr_n2a(ifa->ifa_family, -+ format_host(ifa->ifa_family, - RTA_PAYLOAD(rta_tb[IFA_BROADCAST]), - RTA_DATA(rta_tb[IFA_BROADCAST]), - abuf, sizeof(abuf))); - } - if (rta_tb[IFA_ANYCAST]) { - fprintf(fp, "any %s ", -- rt_addr_n2a(ifa->ifa_family, -+ format_host(ifa->ifa_family, - RTA_PAYLOAD(rta_tb[IFA_ANYCAST]), - RTA_DATA(rta_tb[IFA_ANYCAST]), - abuf, sizeof(abuf))); --- -1.8.3.1 - diff --git a/SOURCES/0098-tc-add-support-for-Flower-classifier.patch b/SOURCES/0098-tc-add-support-for-Flower-classifier.patch deleted file mode 100644 index 356466f..0000000 --- a/SOURCES/0098-tc-add-support-for-Flower-classifier.patch +++ /dev/null @@ -1,582 +0,0 @@ -From 47a5dbb5c02336730a7c1f601b2351521c31c16b Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 13:17:53 +0100 -Subject: [PATCH] tc: add support for Flower classifier - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629 -Upstream Status: iproute2.git commit 30eb304ecd1dd - -commit 30eb304ecd1dd7e452847fabea779de0dbe3f1a5 -Author: Jiri Pirko -Date: Fri May 15 13:34:04 2015 +0200 - - tc: add support for Flower classifier - - Signed-off-by: Jiri Pirko ---- - tc/Makefile | 1 + - tc/f_flower.c | 540 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 541 insertions(+) - create mode 100644 tc/f_flower.c - -diff --git a/tc/Makefile b/tc/Makefile -index 59ee1dd..a6ad9ae 100644 ---- a/tc/Makefile -+++ b/tc/Makefile -@@ -30,6 +30,7 @@ TCMODULES += f_basic.o - TCMODULES += f_bpf.o - TCMODULES += f_flow.o - TCMODULES += f_cgroup.o -+TCMODULES += f_flower.o - TCMODULES += q_dsmark.o - TCMODULES += q_gred.o - TCMODULES += f_tcindex.o -diff --git a/tc/f_flower.c b/tc/f_flower.c -new file mode 100644 -index 0000000..9a5ea06 ---- /dev/null -+++ b/tc/f_flower.c -@@ -0,0 +1,540 @@ -+/* -+ * f_flower.c Flower Classifier -+ * -+ * This program is free software; you can distribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * as published by the Free Software Foundation; either version -+ * 2 of the License, or (at your option) any later version. -+ * -+ * Authors: Jiri Pirko -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "utils.h" -+#include "tc_util.h" -+#include "rt_names.h" -+ -+static void explain(void) -+{ -+ fprintf(stderr, "Usage: ... flower [ MATCH-LIST ]\n"); -+ fprintf(stderr, " [ action ACTION-SPEC ] [ classid CLASSID ]\n"); -+ fprintf(stderr, "\n"); -+ fprintf(stderr, "Where: MATCH-LIST := [ MATCH-LIST ] MATCH\n"); -+ fprintf(stderr, " MATCH := [ indev DEV-NAME | \n"); -+ fprintf(stderr, " dst_mac MAC-ADDR | \n"); -+ fprintf(stderr, " src_mac MAC-ADDR | \n"); -+ fprintf(stderr, " eth_type [ipv4 | ipv6 | ETH-TYPE ] | \n"); -+ fprintf(stderr, " ip_proto [tcp | udp | IP-PROTO ] | \n"); -+ fprintf(stderr, " dst_ip [ IPV4-ADDR | IPV6-ADDR ] | \n"); -+ fprintf(stderr, " src_ip [ IPV4-ADDR | IPV6-ADDR ] | \n"); -+ fprintf(stderr, " dst_port PORT-NUMBER | \n"); -+ fprintf(stderr, " src_port PORT-NUMBER | \n"); -+ fprintf(stderr, " FILTERID := X:Y:Z\n"); -+ fprintf(stderr, " ACTION-SPEC := ... look at individual actions\n"); -+ fprintf(stderr, "\n"); -+ fprintf(stderr, "NOTE: CLASSID, ETH-TYPE, IP-PROTO are parsed as hexadecimal input.\n"); -+ fprintf(stderr, "NOTE: There can be only used one mask per one prio. If user needs\n"); -+ fprintf(stderr, " to specify different mask, he has to use different prio.\n"); -+} -+ -+static int flower_parse_eth_addr(char *str, int addr_type, int mask_type, -+ struct nlmsghdr *n) -+{ -+ int ret; -+ char addr[ETH_ALEN]; -+ -+ ret = ll_addr_a2n(addr, sizeof(addr), str); -+ if (ret < 0) -+ return -1; -+ addattr_l(n, MAX_MSG, addr_type, addr, sizeof(addr)); -+ memset(addr, 0xff, ETH_ALEN); -+ addattr_l(n, MAX_MSG, mask_type, addr, sizeof(addr)); -+ return 0; -+} -+ -+static int flower_parse_eth_type(char *str, int type, __be16 *p_eth_type, -+ struct nlmsghdr *n) -+{ -+ int ret; -+ __be16 eth_type; -+ -+ if (matches(str, "ipv4") == 0) { -+ eth_type = htons(ETH_P_IP); -+ } else if (matches(str, "ipv6") == 0) { -+ eth_type = htons(ETH_P_IPV6); -+ } else { -+ __u16 tmp; -+ -+ ret = get_u16(&tmp, str, 16); -+ if (ret) -+ return -1; -+ eth_type = htons(tmp); -+ } -+ addattr16(n, MAX_MSG, type, eth_type); -+ *p_eth_type = eth_type; -+ return 0; -+} -+ -+static int flower_parse_ip_proto(char *str, __be16 eth_type, int type, -+ __u8 *p_ip_proto, struct nlmsghdr *n) -+{ -+ int ret; -+ __u8 ip_proto; -+ -+ if (eth_type != htons(ETH_P_IP) && eth_type != htons(ETH_P_IPV6)) { -+ fprintf(stderr, "Illegal \"eth_type\" for ip proto\n"); -+ return -1; -+ } -+ if (matches(str, "tcp") == 0) { -+ ip_proto = IPPROTO_TCP; -+ } else if (matches(str, "udp") == 0) { -+ ip_proto = IPPROTO_UDP; -+ } else { -+ ret = get_u8(&ip_proto, str, 16); -+ if (ret) -+ return -1; -+ } -+ addattr8(n, MAX_MSG, type, ip_proto); -+ *p_ip_proto = ip_proto; -+ return 0; -+} -+ -+static int flower_parse_ip_addr(char *str, __be16 eth_type, -+ int addr4_type, int mask4_type, -+ int addr6_type, int mask6_type, -+ struct nlmsghdr *n) -+{ -+ int ret; -+ inet_prefix addr; -+ int family; -+ int bits; -+ int i; -+ -+ if (eth_type == htons(ETH_P_IP)) { -+ family = AF_INET; -+ } else if (eth_type == htons(ETH_P_IPV6)) { -+ family = AF_INET6; -+ } else { -+ fprintf(stderr, "Illegal \"eth_type\" for ip address\n"); -+ return -1; -+ } -+ -+ ret = get_prefix(&addr, str, family); -+ if (ret) -+ return -1; -+ -+ if (addr.family != family) -+ return -1; -+ -+ addattr_l(n, MAX_MSG, addr.family == AF_INET ? addr4_type : addr6_type, -+ addr.data, addr.bytelen); -+ -+ memset(addr.data, 0xff, addr.bytelen); -+ bits = addr.bitlen; -+ for (i = 0; i < addr.bytelen / 4; i++) { -+ if (!bits) { -+ addr.data[i] = 0; -+ } else if (bits / 32 >= 1) { -+ bits -= 32; -+ } else { -+ addr.data[i] <<= 32 - bits; -+ addr.data[i] = htonl(addr.data[i]); -+ bits = 0; -+ } -+ } -+ -+ addattr_l(n, MAX_MSG, addr.family == AF_INET ? mask4_type : mask6_type, -+ addr.data, addr.bytelen); -+ -+ return 0; -+} -+ -+static int flower_parse_port(char *str, __u8 ip_port, -+ int tcp_type, int udp_type, struct nlmsghdr *n) -+{ -+ int ret; -+ int type; -+ __be16 port; -+ -+ if (ip_port == IPPROTO_TCP) { -+ type = tcp_type; -+ } else if (ip_port == IPPROTO_UDP) { -+ type = udp_type; -+ } else { -+ fprintf(stderr, "Illegal \"ip_proto\" for port\n"); -+ return -1; -+ } -+ -+ ret = get_u16(&port, str, 10); -+ if (ret) -+ return -1; -+ -+ addattr16(n, MAX_MSG, type, htons(port)); -+ -+ return 0; -+} -+ -+static int flower_parse_opt(struct filter_util *qu, char *handle, -+ int argc, char **argv, struct nlmsghdr *n) -+{ -+ int ret; -+ struct tcmsg *t = NLMSG_DATA(n); -+ struct rtattr *tail; -+ __be16 eth_type = 0; -+ __u8 ip_proto = 0xff; -+ -+ if (argc == 0) -+ return 0; -+ -+ if (handle) { -+ ret = get_u32(&t->tcm_handle, handle, 0); -+ if (ret) { -+ fprintf(stderr, "Illegal \"handle\"\n"); -+ return -1; -+ } -+ } -+ -+ tail = (struct rtattr *) (((void *) n) + NLMSG_ALIGN(n->nlmsg_len)); -+ addattr_l(n, MAX_MSG, TCA_OPTIONS, NULL, 0); -+ -+ while (argc > 0) { -+ if (matches(*argv, "classid") == 0 || -+ matches(*argv, "flowid") == 0) { -+ unsigned handle; -+ -+ NEXT_ARG(); -+ ret = get_tc_classid(&handle, *argv); -+ if (ret) { -+ fprintf(stderr, "Illegal \"classid\"\n"); -+ return -1; -+ } -+ addattr_l(n, MAX_MSG, TCA_FLOWER_CLASSID, &handle, 4); -+ } else if (matches(*argv, "indev") == 0) { -+ char ifname[IFNAMSIZ]; -+ -+ NEXT_ARG(); -+ memset(ifname, 0, sizeof(ifname)); -+ strncpy(ifname, *argv, sizeof(ifname) - 1); -+ addattrstrz(n, MAX_MSG, TCA_FLOWER_INDEV, ifname); -+ } else if (matches(*argv, "dst_mac") == 0) { -+ NEXT_ARG(); -+ ret = flower_parse_eth_addr(*argv, -+ TCA_FLOWER_KEY_ETH_DST, -+ TCA_FLOWER_KEY_ETH_DST_MASK, -+ n); -+ if (ret < 0) { -+ fprintf(stderr, "Illegal \"dst_mac\"\n"); -+ return -1; -+ } -+ } else if (matches(*argv, "src_mac") == 0) { -+ NEXT_ARG(); -+ ret = flower_parse_eth_addr(*argv, -+ TCA_FLOWER_KEY_ETH_SRC, -+ TCA_FLOWER_KEY_ETH_SRC_MASK, -+ n); -+ if (ret < 0) { -+ fprintf(stderr, "Illegal \"src_mac\"\n"); -+ return -1; -+ } -+ } else if (matches(*argv, "eth_type") == 0) { -+ NEXT_ARG(); -+ ret = flower_parse_eth_type(*argv, -+ TCA_FLOWER_KEY_ETH_TYPE, -+ ð_type, n); -+ if (ret < 0) { -+ fprintf(stderr, "Illegal \"eth_type\"\n"); -+ return -1; -+ } -+ } else if (matches(*argv, "ip_proto") == 0) { -+ NEXT_ARG(); -+ ret = flower_parse_ip_proto(*argv, eth_type, -+ TCA_FLOWER_KEY_IP_PROTO, -+ &ip_proto, n); -+ if (ret < 0) { -+ fprintf(stderr, "Illegal \"ip_proto\"\n"); -+ return -1; -+ } -+ } else if (matches(*argv, "dst_ip") == 0) { -+ NEXT_ARG(); -+ ret = flower_parse_ip_addr(*argv, eth_type, -+ TCA_FLOWER_KEY_IPV4_DST, -+ TCA_FLOWER_KEY_IPV4_DST_MASK, -+ TCA_FLOWER_KEY_IPV6_DST, -+ TCA_FLOWER_KEY_IPV6_DST_MASK, -+ n); -+ if (ret < 0) { -+ fprintf(stderr, "Illegal \"dst_ip\"\n"); -+ return -1; -+ } -+ } else if (matches(*argv, "src_ip") == 0) { -+ NEXT_ARG(); -+ ret = flower_parse_ip_addr(*argv, eth_type, -+ TCA_FLOWER_KEY_IPV4_SRC, -+ TCA_FLOWER_KEY_IPV4_SRC_MASK, -+ TCA_FLOWER_KEY_IPV6_SRC, -+ TCA_FLOWER_KEY_IPV6_SRC_MASK, -+ n); -+ if (ret < 0) { -+ fprintf(stderr, "Illegal \"src_ip\"\n"); -+ return -1; -+ } -+ } else if (matches(*argv, "dst_port") == 0) { -+ NEXT_ARG(); -+ ret = flower_parse_port(*argv, ip_proto, -+ TCA_FLOWER_KEY_TCP_DST, -+ TCA_FLOWER_KEY_UDP_DST, n); -+ if (ret < 0) { -+ fprintf(stderr, "Illegal \"dst_port\"\n"); -+ return -1; -+ } -+ } else if (matches(*argv, "src_port") == 0) { -+ NEXT_ARG(); -+ ret = flower_parse_port(*argv, ip_proto, -+ TCA_FLOWER_KEY_TCP_SRC, -+ TCA_FLOWER_KEY_UDP_SRC, n); -+ if (ret < 0) { -+ fprintf(stderr, "Illegal \"src_port\"\n"); -+ return -1; -+ } -+ } else if (matches(*argv, "action") == 0) { -+ NEXT_ARG(); -+ ret = parse_action(&argc, &argv, TCA_FLOWER_ACT, n); -+ if (ret) { -+ fprintf(stderr, "Illegal \"action\"\n"); -+ return -1; -+ } -+ continue; -+ } else if (strcmp(*argv, "help") == 0) { -+ explain(); -+ return -1; -+ } else { -+ fprintf(stderr, "What is \"%s\"?\n", *argv); -+ explain(); -+ return -1; -+ } -+ argc--; argv++; -+ } -+ -+ tail->rta_len = (((void*)n)+n->nlmsg_len) - (void*)tail; -+ -+ return 0; -+} -+ -+static int __mask_bits(char *addr, size_t len) -+{ -+ int bits = 0; -+ bool hole = false; -+ int i; -+ int j; -+ -+ for (i = 0; i < len; i++, addr++) { -+ for (j = 7; j >= 0; j--) { -+ if (((*addr) >> j) & 0x1) { -+ if (hole) -+ return -1; -+ bits++; -+ } else if (bits) { -+ hole = true; -+ } else{ -+ return -1; -+ } -+ } -+ } -+ return bits; -+} -+ -+static void flower_print_eth_addr(FILE *f, char *name, -+ struct rtattr *addr_attr, -+ struct rtattr *mask_attr) -+{ -+ SPRINT_BUF(b1); -+ int bits; -+ -+ if (!addr_attr || RTA_PAYLOAD(addr_attr) != ETH_ALEN) -+ return; -+ fprintf(f, "\n %s %s", name, ll_addr_n2a(RTA_DATA(addr_attr), ETH_ALEN, -+ 0, b1, sizeof(b1))); -+ if (!mask_attr || RTA_PAYLOAD(mask_attr) != ETH_ALEN) -+ return; -+ bits = __mask_bits(RTA_DATA(mask_attr), ETH_ALEN); -+ if (bits < 0) -+ fprintf(f, "/%s", ll_addr_n2a(RTA_DATA(mask_attr), ETH_ALEN, -+ 0, b1, sizeof(b1))); -+ else if (bits < ETH_ALEN * 8) -+ fprintf(f, "/%d", bits); -+} -+ -+static void flower_print_eth_type(FILE *f, __be16 *p_eth_type, -+ struct rtattr *eth_type_attr) -+{ -+ __be16 eth_type; -+ -+ if (!eth_type_attr) -+ return; -+ -+ eth_type = rta_getattr_u16(eth_type_attr); -+ fprintf(f, "\n eth_type "); -+ if (eth_type == htons(ETH_P_IP)) -+ fprintf(f, "ipv4"); -+ else if (eth_type == htons(ETH_P_IPV6)) -+ fprintf(f, "ipv6"); -+ else -+ fprintf(f, "%04x", ntohs(eth_type)); -+ *p_eth_type = eth_type; -+} -+ -+static void flower_print_ip_proto(FILE *f, __u8 *p_ip_proto, -+ struct rtattr *ip_proto_attr) -+{ -+ __u8 ip_proto; -+ -+ if (!ip_proto_attr) -+ return; -+ -+ ip_proto = rta_getattr_u8(ip_proto_attr); -+ fprintf(f, "\n ip_proto "); -+ if (ip_proto == IPPROTO_TCP) -+ fprintf(f, "tcp"); -+ else if (ip_proto == IPPROTO_UDP) -+ fprintf(f, "udp"); -+ else -+ fprintf(f, "%02x", ip_proto); -+ *p_ip_proto = ip_proto; -+} -+ -+static void flower_print_ip_addr(FILE *f, char *name, __be16 eth_type, -+ struct rtattr *addr4_attr, -+ struct rtattr *mask4_attr, -+ struct rtattr *addr6_attr, -+ struct rtattr *mask6_attr) -+{ -+ SPRINT_BUF(b1); -+ struct rtattr *addr_attr; -+ struct rtattr *mask_attr; -+ int family; -+ size_t len; -+ int bits; -+ -+ if (eth_type == htons(ETH_P_IP)) { -+ family = AF_INET; -+ addr_attr = addr4_attr; -+ mask_attr = mask4_attr; -+ len = 4; -+ } else if (eth_type == htons(ETH_P_IPV6)) { -+ family = AF_INET6; -+ addr_attr = addr6_attr; -+ mask_attr = mask6_attr; -+ len = 16; -+ } else { -+ return; -+ } -+ if (!addr_attr || RTA_PAYLOAD(addr_attr) != len) -+ return; -+ fprintf(f, "\n %s %s", name, rt_addr_n2a(family, -+ RTA_PAYLOAD(addr_attr), -+ RTA_DATA(addr_attr), -+ b1, sizeof(b1))); -+ if (!mask_attr || RTA_PAYLOAD(mask_attr) != len) -+ return; -+ bits = __mask_bits(RTA_DATA(mask_attr), len); -+ if (bits < 0) -+ fprintf(f, "/%s", rt_addr_n2a(family, -+ RTA_PAYLOAD(mask_attr), -+ RTA_DATA(mask_attr), -+ b1, sizeof(b1))); -+ else if (bits < len * 8) -+ fprintf(f, "/%d", bits); -+} -+ -+static void flower_print_port(FILE *f, char *name, __u8 ip_proto, -+ struct rtattr *tcp_attr, -+ struct rtattr *udp_attr) -+{ -+ struct rtattr *attr; -+ -+ if (ip_proto == IPPROTO_TCP) -+ attr = tcp_attr; -+ else if (ip_proto == IPPROTO_UDP) -+ attr = udp_attr; -+ else -+ return; -+ if (!attr) -+ return; -+ fprintf(f, "\n %s %d", name, ntohs(rta_getattr_u16(attr))); -+} -+ -+static int flower_print_opt(struct filter_util *qu, FILE *f, -+ struct rtattr *opt, __u32 handle) -+{ -+ struct rtattr *tb[TCA_FLOWER_MAX + 1]; -+ __be16 eth_type = 0; -+ __u8 ip_proto = 0xff; -+ -+ if (!opt) -+ return 0; -+ -+ parse_rtattr_nested(tb, TCA_FLOWER_MAX, opt); -+ -+ if (handle) -+ fprintf(f, "handle 0x%x ", handle); -+ -+ if (tb[TCA_FLOWER_CLASSID]) { -+ SPRINT_BUF(b1); -+ fprintf(f, "classid %s ", -+ sprint_tc_classid(rta_getattr_u32(tb[TCA_FLOWER_CLASSID]), b1)); -+ } -+ -+ if (tb[TCA_FLOWER_INDEV]) { -+ struct rtattr *attr = tb[TCA_FLOWER_INDEV]; -+ -+ fprintf(f, "\n indev %s", rta_getattr_str(attr)); -+ } -+ -+ flower_print_eth_addr(f, "dst_mac", tb[TCA_FLOWER_KEY_ETH_DST], -+ tb[TCA_FLOWER_KEY_ETH_DST_MASK]); -+ flower_print_eth_addr(f, "src_mac", tb[TCA_FLOWER_KEY_ETH_SRC], -+ tb[TCA_FLOWER_KEY_ETH_SRC_MASK]); -+ -+ flower_print_eth_type(f, ð_type, tb[TCA_FLOWER_KEY_ETH_TYPE]); -+ flower_print_ip_proto(f, &ip_proto, tb[TCA_FLOWER_KEY_IP_PROTO]); -+ -+ flower_print_ip_addr(f, "dst_ip", eth_type, -+ tb[TCA_FLOWER_KEY_IPV4_DST], -+ tb[TCA_FLOWER_KEY_IPV4_DST_MASK], -+ tb[TCA_FLOWER_KEY_IPV6_DST], -+ tb[TCA_FLOWER_KEY_IPV6_DST_MASK]); -+ -+ flower_print_ip_addr(f, "src_ip", eth_type, -+ tb[TCA_FLOWER_KEY_IPV4_SRC], -+ tb[TCA_FLOWER_KEY_IPV4_SRC_MASK], -+ tb[TCA_FLOWER_KEY_IPV6_SRC], -+ tb[TCA_FLOWER_KEY_IPV6_SRC_MASK]); -+ -+ flower_print_port(f, "dst_port", ip_proto, -+ tb[TCA_FLOWER_KEY_TCP_DST], -+ tb[TCA_FLOWER_KEY_UDP_DST]); -+ -+ flower_print_port(f, "src_port", ip_proto, -+ tb[TCA_FLOWER_KEY_TCP_SRC], -+ tb[TCA_FLOWER_KEY_UDP_SRC]); -+ -+ if (tb[TCA_FLOWER_ACT]) { -+ tc_print_action(f, tb[TCA_FLOWER_ACT]); -+ } -+ -+ return 0; -+} -+ -+struct filter_util flower_filter_util = { -+ .id = "flower", -+ .parse_fopt = flower_parse_opt, -+ .print_fopt = flower_print_opt, -+}; --- -1.8.3.1 - diff --git a/SOURCES/0099-tc-improve-filter-help-texts-a-bit.patch b/SOURCES/0099-tc-improve-filter-help-texts-a-bit.patch deleted file mode 100644 index b7dbdf4..0000000 --- a/SOURCES/0099-tc-improve-filter-help-texts-a-bit.patch +++ /dev/null @@ -1,80 +0,0 @@ -From c525e2783db452f86787f420e171c89502c9b1de Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 13:17:53 +0100 -Subject: [PATCH] tc: improve filter help texts a bit - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629 -Upstream Status: iproute2.git commit 0a83e1eaf7b3c -Conflicts: Context changes due to missing commits 863ecb04b4f7b - ("discourage use of direct policer interface") and - 287bf3a9900d1 ("route classifier support for multiple - actions") - -commit 0a83e1eaf7b3c2ed9e6d809bd7aac7946f9d8d87 -Author: Phil Sutter -Date: Fri Oct 23 19:21:17 2015 +0200 - - tc: improve filter help texts a bit - - This fixes a few syntax errors and changes route filter help text to use - classid instead of flowid to be consistent with other filters' help - texts. - - Signed-off-by: Phil Sutter ---- - tc/f_flower.c | 4 ++-- - tc/f_route.c | 2 +- - tc/f_rsvp.c | 2 +- - 3 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/tc/f_flower.c b/tc/f_flower.c -index 9a5ea06..a9b2c4d 100644 ---- a/tc/f_flower.c -+++ b/tc/f_flower.c -@@ -28,7 +28,7 @@ static void explain(void) - fprintf(stderr, " [ action ACTION-SPEC ] [ classid CLASSID ]\n"); - fprintf(stderr, "\n"); - fprintf(stderr, "Where: MATCH-LIST := [ MATCH-LIST ] MATCH\n"); -- fprintf(stderr, " MATCH := [ indev DEV-NAME | \n"); -+ fprintf(stderr, " MATCH := { indev DEV-NAME | \n"); - fprintf(stderr, " dst_mac MAC-ADDR | \n"); - fprintf(stderr, " src_mac MAC-ADDR | \n"); - fprintf(stderr, " eth_type [ipv4 | ipv6 | ETH-TYPE ] | \n"); -@@ -36,7 +36,7 @@ static void explain(void) - fprintf(stderr, " dst_ip [ IPV4-ADDR | IPV6-ADDR ] | \n"); - fprintf(stderr, " src_ip [ IPV4-ADDR | IPV6-ADDR ] | \n"); - fprintf(stderr, " dst_port PORT-NUMBER | \n"); -- fprintf(stderr, " src_port PORT-NUMBER | \n"); -+ fprintf(stderr, " src_port PORT-NUMBER }\n"); - fprintf(stderr, " FILTERID := X:Y:Z\n"); - fprintf(stderr, " ACTION-SPEC := ... look at individual actions\n"); - fprintf(stderr, "\n"); -diff --git a/tc/f_route.c b/tc/f_route.c -index 649e0ec..44361eb 100644 ---- a/tc/f_route.c -+++ b/tc/f_route.c -@@ -28,7 +28,7 @@ - static void explain(void) - { - fprintf(stderr, "Usage: ... route [ from REALM | fromif TAG ] [ to REALM ]\n"); -- fprintf(stderr, " [ flowid CLASSID ] [ police POLICE_SPEC ]\n"); -+ fprintf(stderr, " [ classid CLASSID ] [ police POLICE_SPEC ]\n"); - fprintf(stderr, " POLICE_SPEC := ... look at TBF\n"); - fprintf(stderr, " CLASSID := X:Y\n"); - fprintf(stderr, "\nNOTE: CLASSID is parsed as hexadecimal input.\n"); -diff --git a/tc/f_rsvp.c b/tc/f_rsvp.c -index 44d3bdf..71508e1 100644 ---- a/tc/f_rsvp.c -+++ b/tc/f_rsvp.c -@@ -27,7 +27,7 @@ - static void explain(void) - { - fprintf(stderr, "Usage: ... rsvp ipproto PROTOCOL session DST[/PORT | GPI ]\n"); -- fprintf(stderr, " [ sender SRC[/PORT | GPI ]\n"); -+ fprintf(stderr, " [ sender SRC[/PORT | GPI ] ]\n"); - fprintf(stderr, " [ classid CLASSID ] [ police POLICE_SPEC ]\n"); - fprintf(stderr, " [ tunnelid ID ] [ tunnel ID skip NUMBER ]\n"); - fprintf(stderr, "Where: GPI := { flowlabel NUMBER | spi/ah SPI | spi/esp SPI |\n"); --- -1.8.3.1 - diff --git a/SOURCES/0100-tc-add-a-man-page-for-flower-filter.patch b/SOURCES/0100-tc-add-a-man-page-for-flower-filter.patch deleted file mode 100644 index bb41c1d..0000000 --- a/SOURCES/0100-tc-add-a-man-page-for-flower-filter.patch +++ /dev/null @@ -1,143 +0,0 @@ -From 980b5be50cff93260780d41435e2e92e9de02744 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 13:18:52 +0100 -Subject: [PATCH] tc: add a man page for flower filter - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629 -Upstream Status: iproute2.git commit b3aa12a401d27 - -commit b3aa12a401d27911ebd48fe13f77783d471c07d2 -Author: Phil Sutter -Date: Fri Oct 23 19:47:11 2015 +0200 - - tc: add a man page for flower filter - - Cc: Jiri Pirko - Signed-off-by: Phil Sutter ---- - man/man8/tc-flower.8 | 113 +++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 113 insertions(+) - create mode 100644 man/man8/tc-flower.8 - -diff --git a/man/man8/tc-flower.8 b/man/man8/tc-flower.8 -new file mode 100644 -index 0000000..df4d8e1 ---- /dev/null -+++ b/man/man8/tc-flower.8 -@@ -0,0 +1,113 @@ -+.TH "Flower filter in tc" 8 "22 Oct 2015" "iproute2" "Linux" -+ -+.SH NAME -+flower \- flow based traffic control filter -+.SH SYNOPSIS -+.in +8 -+.ti -8 -+.BR tc " " filter " ... " flower " [ " -+.IR MATCH_LIST " ] [ " -+.B action -+.IR ACTION_SPEC " ] [ " -+.B classid -+.IR CLASSID " ]" -+ -+.ti -8 -+.IR MATCH_LIST " := [ " MATCH_LIST " ] " MATCH -+ -+.ti -8 -+.IR MATCH " := { " -+.B indev -+.IR ifname " | { " -+.BR dst_mac " | " src_mac " } " -+.IR mac_address " | " -+.BR eth_type " { " ipv4 " | " ipv6 " | " -+.IR ETH_TYPE " } | " -+.BR ip_proto " { " tcp " | " udp " | " -+.IR IP_PROTO " } | { " -+.BR dst_ip " | " src_ip " } { " -+.IR ipv4_address " | " ipv6_address " } | { " -+.BR dst_port " | " src_port " } " -+.IR port_number " }" -+.SH DESCRIPTION -+The -+.B flower -+filter matches flows to the set of keys specified and assigns an arbitrarily -+chosen class ID to packets belonging to them. Additionally (or alternatively) an -+action from the generic action framework may be called. -+.SH OPTIONS -+.TP -+.BI action " ACTION_SPEC" -+Apply an action from the generic actions framework on matching packets. -+.TP -+.BI classid " CLASSID" -+Specify a class to pass matching packets on to. -+.I CLASSID -+is in the form -+.BR X : Y ", while " X " and " Y -+are interpreted as numbers in hexadecimal format. -+.TP -+.BI indev " ifname" -+Match on incoming interface name. Obviously this makes sense only for forwarded -+flows. -+.I ifname -+is the name of an interface which must exist at the time of -+.B tc -+invocation. -+.TP -+.BI dst_mac " mac_address" -+.TQ -+.BI src_mac " mac_address" -+Match on source or destination MAC address. -+.TP -+.BI eth_type " ETH_TYPE" -+Match on layer three protocol. -+.I ETH_TYPE -+may be either -+.BR ipv4 , ipv6 -+or an unsigned 16bit value in hexadecimal format. -+.TP -+.BI ip_proto " IP_PROTO" -+Match on layer four protocol. -+.I IP_PROTO -+may be either -+.BR tcp , udp -+or an unsigned 8bit value in hexadecimal format. -+.TP -+.BI dst_ip " ADDRESS" -+.TQ -+.BI src_ip " ADDRESS" -+Match on source or destination IP address. -+.I ADDRESS -+must be a valid IPv4 or IPv6 address, depending on -+.BR ether_type , -+which has to be specified in beforehand. -+.TP -+.BI dst_port " NUMBER" -+.TQ -+.BI src_port " NUMBER" -+Match on layer 4 protocol source or destination port number. Only available for -+.BR ip_proto " values " udp " and " tcp , -+which has to be specified in beforehand. -+.SH NOTES -+As stated above where applicable, matches of a certain layer implicitly depend -+on the matches of the next lower layer. Precisely, layer one and two matches ( -+.BR indev , dst_mac , src_mac " and " eth_type ) -+have no dependency, layer three matches ( -+.BR ip_proto , dst_ip " and " src_ip ) -+require -+.B eth_type -+being set to either -+.BR ipv4 " or " ipv6 , -+and finally layer four matches ( -+.BR dst_port " and " src_port ) -+depend on -+.B ip_proto -+being set to either -+.BR tcp " or " udp . -+.P -+There can be only used one mask per one prio. If user needs to specify different -+mask, he has to use different prio. -+.SH SEE ALSO -+.BR tc (8), -+.BR tc-flow (8) --- -1.8.3.1 - diff --git a/SOURCES/0101-tc-ship-filter-man-pages-and-refer-to-them-in-tc.8.patch b/SOURCES/0101-tc-ship-filter-man-pages-and-refer-to-them-in-tc.8.patch deleted file mode 100644 index 43c1681..0000000 --- a/SOURCES/0101-tc-ship-filter-man-pages-and-refer-to-them-in-tc.8.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 86ccfa5ca33949fa5a53d423a8b352cc243bf1b5 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 13:18:52 +0100 -Subject: [PATCH] tc: ship filter man pages and refer to them in tc.8 - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629 -Upstream Status: iproute2.git commit a257bc7b4c481 -Conflicts: Just reapplying missing bits about flower from already - backported commit. - -commit a257bc7b4c481d4b2871508edfccc198d1e56c8a -Author: Phil Sutter -Date: Fri Oct 23 19:47:16 2015 +0200 - - tc: ship filter man pages and refer to them in tc.8 - - Cc: Thomas Graf - Cc: Alexey Kuznetsov - Cc: Jiri Pirko - Cc: Patrick McHardy - Cc: Werner Almesberger - Signed-off-by: Phil Sutter ---- - man/man8/Makefile | 2 +- - man/man8/tc.8 | 8 +++++--- - 2 files changed, 6 insertions(+), 4 deletions(-) - -diff --git a/man/man8/Makefile b/man/man8/Makefile -index f3a3fa5..8d73f1e 100644 ---- a/man/man8/Makefile -+++ b/man/man8/Makefile -@@ -11,7 +11,7 @@ MAN8PAGES = $(TARGETS) ip.8 arpd.8 lnstat.8 routel.8 rtacct.8 rtmon.8 rtpr.8 ss. - ip-maddress.8 ip-monitor.8 ip-mroute.8 ip-neighbour.8 \ - ip-netns.8 ip-ntable.8 ip-rule.8 ip-tunnel.8 ip-xfrm.8 \ - ip-tcp_metrics.8 ip-netconf.8 ip-token.8 \ -- tc-basic.8 tc-cgroup.8 tc-flow.8 tc-fw.8 tc-route.8 \ -+ tc-basic.8 tc-cgroup.8 tc-flow.8 tc-flower.8 tc-fw.8 tc-route.8 \ - tc-tcindex.8 tc-u32.8 \ - tc-csum.8 tc-mirred.8 tc-nat.8 tc-pedit.8 tc-police.8 \ - tc-simple.8 tc-skbedit.8 tc-xt.8 -diff --git a/man/man8/tc.8 b/man/man8/tc.8 -index 391d7c7..ee3479e 100644 ---- a/man/man8/tc.8 -+++ b/man/man8/tc.8 -@@ -158,9 +158,10 @@ Filter packets based on the control group of their process. See - . BR tc-cgroup (8) - for details. - .TP --flow --Flow-based classifier, filtering packets based on their flow (identified by selectable keys). See --.BR tc-flow (8) -+flow, flower -+Flow-based classifiers, filtering packets based on their flow (identified by selectable keys). See -+.BR tc-flow "(8) and" -+.BR tc-flower (8) - for details. - .TP - fw -@@ -635,6 +636,7 @@ was written by Alexey N. Kuznetsov and added in Linux 2.2. - .BR tc-drr (8), - .BR tc-ematch (8), - .BR tc-flow (8), -+.BR tc-flower (8), - .BR tc-fq (8), - .BR tc-fq_codel (8), - .BR tc-fw (8), --- -1.8.3.1 - diff --git a/SOURCES/0102-ip6tunnel-print-local-remote-addresses-like-iptunnel.patch b/SOURCES/0102-ip6tunnel-print-local-remote-addresses-like-iptunnel.patch deleted file mode 100644 index 54d175f..0000000 --- a/SOURCES/0102-ip6tunnel-print-local-remote-addresses-like-iptunnel.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 719beca22da7196c78202302d57e67d1c0ffc2cb Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 13:19:41 +0100 -Subject: [PATCH] ip6tunnel: print local/remote addresses like iptunnel does - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629 -Upstream Status: iproute2.git commit 9af72f819e3fa - -commit 9af72f819e3fa288fd56e74d14a1253bd49adb9d -Author: Phil Sutter -Date: Fri Nov 13 18:08:59 2015 +0100 - - ip6tunnel: print local/remote addresses like iptunnel does - - This makes output consistent with iptunnel, also supporting reverse DNS - lookup for remote address if requested. - - Signed-off-by: Phil Sutter ---- - ip/ip6tunnel.c | 15 +++++++++------ - 1 file changed, 9 insertions(+), 6 deletions(-) - -diff --git a/ip/ip6tunnel.c b/ip/ip6tunnel.c -index f37042e..97c99e2 100644 ---- a/ip/ip6tunnel.c -+++ b/ip/ip6tunnel.c -@@ -69,14 +69,17 @@ static void usage(void) - - static void print_tunnel(struct ip6_tnl_parm2 *p) - { -- char remote[64]; -- char local[64]; -- -- inet_ntop(AF_INET6, &p->raddr, remote, sizeof(remote)); -- inet_ntop(AF_INET6, &p->laddr, local, sizeof(local)); -+ char s1[1024]; -+ char s2[1024]; - -+ /* Do not use format_host() for local addr, -+ * symbolic name will not be useful. -+ */ - printf("%s: %s/ipv6 remote %s local %s", -- p->name, tnl_strproto(p->proto), remote, local); -+ p->name, -+ tnl_strproto(p->proto), -+ format_host(AF_INET6, 16, &p->raddr, s1, sizeof(s1)), -+ rt_addr_n2a(AF_INET6, 16, &p->laddr, s2, sizeof(s2))); - if (p->link) { - const char *n = ll_index_to_name(p->link); - if (n) --- -1.8.3.1 - diff --git a/SOURCES/0103-tc-flower-no-need-to-specify-the-ethertype.patch b/SOURCES/0103-tc-flower-no-need-to-specify-the-ethertype.patch deleted file mode 100644 index edeccec..0000000 --- a/SOURCES/0103-tc-flower-no-need-to-specify-the-ethertype.patch +++ /dev/null @@ -1,138 +0,0 @@ -From ba3f3f0bb68ad2057d303324ca382e29c9abdd5b Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 13:19:41 +0100 -Subject: [PATCH] tc: flower no need to specify the ethertype - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629 -Upstream Status: iproute2.git commit 488b41d020fb0 - -commit 488b41d020fb06428b90289f70a41210718f52b7 -Author: Jamal Hadi Salim -Date: Sun Jan 10 14:56:31 2016 -0500 - - tc: flower no need to specify the ethertype - - since all tc classifiers are required to specify ethertype as part of grammar - By not allowing eth_type to be specified we remove contradiction for - example when a user specifies: - tc filter add ... priority xxx protocol ip flower eth_type ipv6 - This patch removes that contradiction - - Signed-off-by: Jamal Hadi Salim ---- - tc/f_flower.c | 55 +++++++++++++++++-------------------------------------- - 1 file changed, 17 insertions(+), 38 deletions(-) - -diff --git a/tc/f_flower.c b/tc/f_flower.c -index a9b2c4d..db9cc29 100644 ---- a/tc/f_flower.c -+++ b/tc/f_flower.c -@@ -31,7 +31,7 @@ static void explain(void) - fprintf(stderr, " MATCH := { indev DEV-NAME | \n"); - fprintf(stderr, " dst_mac MAC-ADDR | \n"); - fprintf(stderr, " src_mac MAC-ADDR | \n"); -- fprintf(stderr, " eth_type [ipv4 | ipv6 | ETH-TYPE ] | \n"); -+ fprintf(stderr, " [ipv4 | ipv6 ] | \n"); - fprintf(stderr, " ip_proto [tcp | udp | IP-PROTO ] | \n"); - fprintf(stderr, " dst_ip [ IPV4-ADDR | IPV6-ADDR ] | \n"); - fprintf(stderr, " src_ip [ IPV4-ADDR | IPV6-ADDR ] | \n"); -@@ -60,29 +60,6 @@ static int flower_parse_eth_addr(char *str, int addr_type, int mask_type, - return 0; - } - --static int flower_parse_eth_type(char *str, int type, __be16 *p_eth_type, -- struct nlmsghdr *n) --{ -- int ret; -- __be16 eth_type; -- -- if (matches(str, "ipv4") == 0) { -- eth_type = htons(ETH_P_IP); -- } else if (matches(str, "ipv6") == 0) { -- eth_type = htons(ETH_P_IPV6); -- } else { -- __u16 tmp; -- -- ret = get_u16(&tmp, str, 16); -- if (ret) -- return -1; -- eth_type = htons(tmp); -- } -- addattr16(n, MAX_MSG, type, eth_type); -- *p_eth_type = eth_type; -- return 0; --} -- - static int flower_parse_ip_proto(char *str, __be16 eth_type, int type, - __u8 *p_ip_proto, struct nlmsghdr *n) - { -@@ -188,12 +165,9 @@ static int flower_parse_opt(struct filter_util *qu, char *handle, - int ret; - struct tcmsg *t = NLMSG_DATA(n); - struct rtattr *tail; -- __be16 eth_type = 0; -+ __be16 eth_type = TC_H_MIN(t->tcm_info); - __u8 ip_proto = 0xff; - -- if (argc == 0) -- return 0; -- - if (handle) { - ret = get_u32(&t->tcm_handle, handle, 0); - if (ret) { -@@ -205,6 +179,11 @@ static int flower_parse_opt(struct filter_util *qu, char *handle, - tail = (struct rtattr *) (((void *) n) + NLMSG_ALIGN(n->nlmsg_len)); - addattr_l(n, MAX_MSG, TCA_OPTIONS, NULL, 0); - -+ if (argc == 0) { -+ /*at minimal we will match all ethertype packets */ -+ goto parse_done; -+ } -+ - while (argc > 0) { - if (matches(*argv, "classid") == 0 || - matches(*argv, "flowid") == 0) { -@@ -244,15 +223,6 @@ static int flower_parse_opt(struct filter_util *qu, char *handle, - fprintf(stderr, "Illegal \"src_mac\"\n"); - return -1; - } -- } else if (matches(*argv, "eth_type") == 0) { -- NEXT_ARG(); -- ret = flower_parse_eth_type(*argv, -- TCA_FLOWER_KEY_ETH_TYPE, -- ð_type, n); -- if (ret < 0) { -- fprintf(stderr, "Illegal \"eth_type\"\n"); -- return -1; -- } - } else if (matches(*argv, "ip_proto") == 0) { - NEXT_ARG(); - ret = flower_parse_ip_proto(*argv, eth_type, -@@ -323,6 +293,14 @@ static int flower_parse_opt(struct filter_util *qu, char *handle, - argc--; argv++; - } - -+parse_done: -+ ret = addattr16(n, MAX_MSG, TCA_FLOWER_KEY_ETH_TYPE, eth_type); -+ if (ret) { -+ fprintf(stderr, "Illegal \"eth_type\"(0x%x)\n", -+ ntohs(eth_type)); -+ return -1; -+ } -+ - tail->rta_len = (((void*)n)+n->nlmsg_len) - (void*)tail; - - return 0; -@@ -489,7 +467,8 @@ static int flower_print_opt(struct filter_util *qu, FILE *f, - if (tb[TCA_FLOWER_CLASSID]) { - SPRINT_BUF(b1); - fprintf(f, "classid %s ", -- sprint_tc_classid(rta_getattr_u32(tb[TCA_FLOWER_CLASSID]), b1)); -+ sprint_tc_classid(rta_getattr_u32(tb[TCA_FLOWER_CLASSID]), -+ b1)); - } - - if (tb[TCA_FLOWER_INDEV]) { --- -1.8.3.1 - diff --git a/SOURCES/0104-make-format_host-non-reentrant-by-default.patch b/SOURCES/0104-make-format_host-non-reentrant-by-default.patch deleted file mode 100644 index ad2b740..0000000 --- a/SOURCES/0104-make-format_host-non-reentrant-by-default.patch +++ /dev/null @@ -1,689 +0,0 @@ -From 75d1640b9a77c2d5843a18774880aabf38d1062b Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 13:19:41 +0100 -Subject: [PATCH] make format_host non-reentrant by default - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629 -Upstream Status: iproute2.git commit a418e451643e7 -Conflicts: -* Parts applied manually due to big differences in changed code - between upstream and RHEL. -* Two calls in misc/ss.c converted manually. -* Drop iproute_lwtunnel hunks as we don't support it - -commit a418e451643e77fe36861e53359587ba8aa41873 -Author: Phil Sutter -Date: Tue Mar 22 19:35:15 2016 +0100 - - make format_host non-reentrant by default - - There are only three users which require it to be reentrant, the rest is - fine without. Instead, provide a reentrant format_host_r() for users - which need it. - - Signed-off-by: Phil Sutter ---- - bridge/fdb.c | 4 +--- - include/utils.h | 3 ++- - ip/ip6tunnel.c | 2 +- - ip/ipaddress.c | 13 ++++--------- - ip/ipaddrlabel.c | 4 +--- - ip/iplink_geneve.c | 5 ++--- - ip/iplink_vxlan.c | 13 ++++++------- - ip/ipmaddr.c | 5 +---- - ip/ipneigh.c | 4 +--- - ip/iproute.c | 12 ++++-------- - ip/iprule.c | 9 +++------ - ip/iptoken.c | 4 +--- - ip/iptunnel.c | 6 +++--- - ip/link_gre.c | 5 ++--- - ip/link_gre6.c | 5 ++--- - ip/link_iptnl.c | 7 +++---- - ip/link_vti.c | 5 ++--- - ip/link_vti6.c | 5 ++--- - ip/tcp_metrics.c | 4 +--- - lib/utils.c | 9 ++++++++- - misc/ss.c | 11 ++++------- - tc/m_nat.c | 4 ++-- - 23 files changed, 57 insertions(+), 86 deletions(-) - -diff --git a/bridge/fdb.c b/bridge/fdb.c -index d184f7e..4b536f9 100644 ---- a/bridge/fdb.c -+++ b/bridge/fdb.c -@@ -110,7 +110,6 @@ int print_fdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - fprintf(fp, "dev %s ", ll_index_to_name(r->ndm_ifindex)); - - if (tb[NDA_DST]) { -- SPRINT_BUF(abuf); - int family = AF_INET; - - if (RTA_PAYLOAD(tb[NDA_DST]) == sizeof(struct in6_addr)) -@@ -119,8 +118,7 @@ int print_fdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - fprintf(fp, "dst %s ", - format_host(family, - RTA_PAYLOAD(tb[NDA_DST]), -- RTA_DATA(tb[NDA_DST]), -- abuf, sizeof(abuf))); -+ RTA_DATA(tb[NDA_DST]))); - } - - if (vid) -diff --git a/include/utils.h b/include/utils.h -index 9839d9d..df6ce04 100644 ---- a/include/utils.h -+++ b/include/utils.h -@@ -109,8 +109,9 @@ int get_be16(__be16 *val, const char *arg, int base); - char *hexstring_n2a(const __u8 *str, int len, char *buf, int blen); - __u8 *hexstring_a2n(const char *str, __u8 *buf, int blen, unsigned int *len); - --const char *format_host(int af, int len, const void *addr, -+const char *format_host_r(int af, int len, const void *addr, - char *buf, int buflen); -+const char *format_host(int af, int lne, const void *addr); - const char *rt_addr_n2a(int af, int len, const void *addr, - char *buf, int buflen); - -diff --git a/ip/ip6tunnel.c b/ip/ip6tunnel.c -index 97c99e2..ab8603d 100644 ---- a/ip/ip6tunnel.c -+++ b/ip/ip6tunnel.c -@@ -78,7 +78,7 @@ static void print_tunnel(struct ip6_tnl_parm2 *p) - printf("%s: %s/ipv6 remote %s local %s", - p->name, - tnl_strproto(p->proto), -- format_host(AF_INET6, 16, &p->raddr, s1, sizeof(s1)), -+ format_host_r(AF_INET6, 16, &p->raddr, s1, sizeof(s1)), - rt_addr_n2a(AF_INET6, 16, &p->laddr, s2, sizeof(s2))); - if (p->link) { - const char *n = ll_index_to_name(p->link); -diff --git a/ip/ipaddress.c b/ip/ipaddress.c -index 147bcca..5f08cde 100644 ---- a/ip/ipaddress.c -+++ b/ip/ipaddress.c -@@ -776,7 +776,6 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n, - /* Use local copy of ifa_flags to not interfere with filtering code */ - unsigned int ifa_flags; - struct rtattr * rta_tb[IFA_MAX+1]; -- char abuf[256]; - SPRINT_BUF(b1); - - if (n->nlmsg_type != RTM_NEWADDR && n->nlmsg_type != RTM_DELADDR) -@@ -866,8 +865,7 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n, - if (rta_tb[IFA_LOCAL]) { - fprintf(fp, "%s", format_host(ifa->ifa_family, - RTA_PAYLOAD(rta_tb[IFA_LOCAL]), -- RTA_DATA(rta_tb[IFA_LOCAL]), -- abuf, sizeof(abuf))); -+ RTA_DATA(rta_tb[IFA_LOCAL]))); - - if (rta_tb[IFA_ADDRESS] == NULL || - memcmp(RTA_DATA(rta_tb[IFA_ADDRESS]), RTA_DATA(rta_tb[IFA_LOCAL]), -@@ -877,8 +875,7 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n, - fprintf(fp, " peer %s/%d ", - format_host(ifa->ifa_family, - RTA_PAYLOAD(rta_tb[IFA_ADDRESS]), -- RTA_DATA(rta_tb[IFA_ADDRESS]), -- abuf, sizeof(abuf)), -+ RTA_DATA(rta_tb[IFA_ADDRESS])), - ifa->ifa_prefixlen); - } - } -@@ -887,15 +884,13 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n, - fprintf(fp, "brd %s ", - format_host(ifa->ifa_family, - RTA_PAYLOAD(rta_tb[IFA_BROADCAST]), -- RTA_DATA(rta_tb[IFA_BROADCAST]), -- abuf, sizeof(abuf))); -+ RTA_DATA(rta_tb[IFA_BROADCAST]))); - } - if (rta_tb[IFA_ANYCAST]) { - fprintf(fp, "any %s ", - format_host(ifa->ifa_family, - RTA_PAYLOAD(rta_tb[IFA_ANYCAST]), -- RTA_DATA(rta_tb[IFA_ANYCAST]), -- abuf, sizeof(abuf))); -+ RTA_DATA(rta_tb[IFA_ANYCAST]))); - } - fprintf(fp, "scope %s ", rtnl_rtscope_n2a(ifa->ifa_scope, b1, sizeof(b1))); - if (ifa_flags & IFA_F_SECONDARY) { -diff --git a/ip/ipaddrlabel.c b/ip/ipaddrlabel.c -index a0b6e6f..e834a87 100644 ---- a/ip/ipaddrlabel.c -+++ b/ip/ipaddrlabel.c -@@ -61,7 +61,6 @@ int print_addrlabel(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg - struct ifaddrlblmsg *ifal = NLMSG_DATA(n); - int len = n->nlmsg_len; - struct rtattr *tb[IFAL_MAX+1]; -- char abuf[256]; - - if (n->nlmsg_type != RTM_NEWADDRLABEL && n->nlmsg_type != RTM_DELADDRLABEL) - return 0; -@@ -79,8 +78,7 @@ int print_addrlabel(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg - fprintf(fp, "prefix %s/%u ", - format_host(ifal->ifal_family, - RTA_PAYLOAD(tb[IFAL_ADDRESS]), -- RTA_DATA(tb[IFAL_ADDRESS]), -- abuf, sizeof(abuf)), -+ RTA_DATA(tb[IFAL_ADDRESS])), - ifal->ifal_prefixlen); - } - -diff --git a/ip/iplink_geneve.c b/ip/iplink_geneve.c -index 905c537..2e15a1d 100644 ---- a/ip/iplink_geneve.c -+++ b/ip/iplink_geneve.c -@@ -181,7 +181,6 @@ static int geneve_parse_opt(struct link_util *lu, int argc, char **argv, - static void geneve_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - { - __u32 vni; -- char s1[1024]; - __u8 tos; - - if (!tb) -@@ -198,14 +197,14 @@ static void geneve_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - __be32 addr = rta_getattr_u32(tb[IFLA_GENEVE_REMOTE]); - if (addr) - fprintf(f, "remote %s ", -- format_host(AF_INET, 4, &addr, s1, sizeof(s1))); -+ format_host(AF_INET, 4, &addr)); - } else if (tb[IFLA_GENEVE_REMOTE6]) { - struct in6_addr addr; - memcpy(&addr, RTA_DATA(tb[IFLA_GENEVE_REMOTE6]), sizeof(struct in6_addr)); - if (memcmp(&addr, &in6addr_any, sizeof(addr)) != 0) { - if (!IN6_IS_ADDR_MULTICAST(&addr)) - fprintf(f, "remote %s ", -- format_host(AF_INET6, sizeof(struct in6_addr), &addr, s1, sizeof(s1))); -+ format_host(AF_INET6, sizeof(struct in6_addr), &addr)); - } - } - -diff --git a/ip/iplink_vxlan.c b/ip/iplink_vxlan.c -index 015d7d9..6cae35b 100644 ---- a/ip/iplink_vxlan.c -+++ b/ip/iplink_vxlan.c -@@ -282,7 +282,6 @@ static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - unsigned link; - __u8 tos; - __u32 maxaddr; -- char s1[1024]; - char s2[64]; - - if (!tb) -@@ -300,10 +299,10 @@ static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - if (addr) { - if (IN_MULTICAST(ntohl(addr))) - fprintf(f, "group %s ", -- format_host(AF_INET, 4, &addr, s1, sizeof(s1))); -+ format_host(AF_INET, 4, &addr)); - else - fprintf(f, "remote %s ", -- format_host(AF_INET, 4, &addr, s1, sizeof(s1))); -+ format_host(AF_INET, 4, &addr)); - } - } else if (tb[IFLA_VXLAN_GROUP6]) { - struct in6_addr addr; -@@ -311,10 +310,10 @@ static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - if (memcmp(&addr, &in6addr_any, sizeof(addr)) != 0) { - if (IN6_IS_ADDR_MULTICAST(&addr)) - fprintf(f, "group %s ", -- format_host(AF_INET6, sizeof(struct in6_addr), &addr, s1, sizeof(s1))); -+ format_host(AF_INET6, sizeof(struct in6_addr), &addr)); - else - fprintf(f, "remote %s ", -- format_host(AF_INET6, sizeof(struct in6_addr), &addr, s1, sizeof(s1))); -+ format_host(AF_INET6, sizeof(struct in6_addr), &addr)); - } - } - -@@ -322,13 +321,13 @@ static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - __be32 addr = rta_getattr_u32(tb[IFLA_VXLAN_LOCAL]); - if (addr) - fprintf(f, "local %s ", -- format_host(AF_INET, 4, &addr, s1, sizeof(s1))); -+ format_host(AF_INET, 4, &addr)); - } else if (tb[IFLA_VXLAN_LOCAL6]) { - struct in6_addr addr; - memcpy(&addr, RTA_DATA(tb[IFLA_VXLAN_LOCAL6]), sizeof(struct in6_addr)); - if (memcmp(&addr, &in6addr_any, sizeof(addr)) != 0) - fprintf(f, "local %s ", -- format_host(AF_INET6, sizeof(struct in6_addr), &addr, s1, sizeof(s1))); -+ format_host(AF_INET6, sizeof(struct in6_addr), &addr)); - } - - if (tb[IFLA_VXLAN_LINK] && -diff --git a/ip/ipmaddr.c b/ip/ipmaddr.c -index a77a18f..5c3dc28 100644 ---- a/ip/ipmaddr.c -+++ b/ip/ipmaddr.c -@@ -204,7 +204,6 @@ static void print_maddr(FILE *fp, struct ma_info *list) - list->addr.bytelen, 0, - b1, sizeof(b1))); - } else { -- char abuf[256]; - switch(list->addr.family) { - case AF_INET: - fprintf(fp, "inet "); -@@ -218,9 +217,7 @@ static void print_maddr(FILE *fp, struct ma_info *list) - } - fprintf(fp, "%s", - format_host(list->addr.family, -- -1, -- list->addr.data, -- abuf, sizeof(abuf))); -+ -1, list->addr.data)); - } - if (list->users != 1) - fprintf(fp, " users %d", list->users); -diff --git a/ip/ipneigh.c b/ip/ipneigh.c -index 472555d..b99a120 100644 ---- a/ip/ipneigh.c -+++ b/ip/ipneigh.c -@@ -193,7 +193,6 @@ int print_neigh(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - struct ndmsg *r = NLMSG_DATA(n); - int len = n->nlmsg_len; - struct rtattr * tb[NDA_MAX+1]; -- char abuf[256]; - - if (n->nlmsg_type != RTM_NEWNEIGH && n->nlmsg_type != RTM_DELNEIGH && - n->nlmsg_type != RTM_GETNEIGH) { -@@ -264,8 +263,7 @@ int print_neigh(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - fprintf(fp, "%s ", - format_host(r->ndm_family, - RTA_PAYLOAD(tb[NDA_DST]), -- RTA_DATA(tb[NDA_DST]), -- abuf, sizeof(abuf))); -+ RTA_DATA(tb[NDA_DST]))); - } - if (!filter.index && r->ndm_ifindex) - fprintf(fp, "dev %s ", ll_index_to_name(r->ndm_ifindex)); -diff --git a/ip/iproute.c b/ip/iproute.c -index eb5d145..2bc2041 100644 ---- a/ip/iproute.c -+++ b/ip/iproute.c -@@ -366,8 +366,7 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - } else { - fprintf(fp, "%s ", format_host(r->rtm_family, - RTA_PAYLOAD(tb[RTA_DST]), -- RTA_DATA(tb[RTA_DST]), -- abuf, sizeof(abuf)) -+ RTA_DATA(tb[RTA_DST])) - ); - } - } else if (r->rtm_dst_len) { -@@ -386,8 +385,7 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - } else { - fprintf(fp, "from %s ", format_host(r->rtm_family, - RTA_PAYLOAD(tb[RTA_SRC]), -- RTA_DATA(tb[RTA_SRC]), -- abuf, sizeof(abuf)) -+ RTA_DATA(tb[RTA_SRC])) - ); - } - } else if (r->rtm_src_len) { -@@ -406,8 +404,7 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - fprintf(fp, "via %s ", - format_host(r->rtm_family, - RTA_PAYLOAD(tb[RTA_GATEWAY]), -- RTA_DATA(tb[RTA_GATEWAY]), -- abuf, sizeof(abuf))); -+ RTA_DATA(tb[RTA_GATEWAY]))); - } - if (tb[RTA_OIF] && filter.oifmask != -1) - fprintf(fp, "dev %s ", ll_index_to_name(*(int*)RTA_DATA(tb[RTA_OIF]))); -@@ -629,8 +626,7 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - fprintf(fp, " via %s ", - format_host(r->rtm_family, - RTA_PAYLOAD(tb[RTA_GATEWAY]), -- RTA_DATA(tb[RTA_GATEWAY]), -- abuf, sizeof(abuf))); -+ RTA_DATA(tb[RTA_GATEWAY]))); - } - if (tb[RTA_FLOW]) { - __u32 to = rta_getattr_u32(tb[RTA_FLOW]); -diff --git a/ip/iprule.c b/ip/iprule.c -index 63d7fcc..14eb852 100644 ---- a/ip/iprule.c -+++ b/ip/iprule.c -@@ -96,8 +96,7 @@ int print_rule(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - } else { - fprintf(fp, "from %s ", format_host(r->rtm_family, - RTA_PAYLOAD(tb[FRA_SRC]), -- RTA_DATA(tb[FRA_SRC]), -- abuf, sizeof(abuf)) -+ RTA_DATA(tb[FRA_SRC])) - ); - } - } else if (r->rtm_src_len) { -@@ -117,8 +116,7 @@ int print_rule(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - } else { - fprintf(fp, "to %s ", format_host(r->rtm_family, - RTA_PAYLOAD(tb[FRA_DST]), -- RTA_DATA(tb[FRA_DST]), -- abuf, sizeof(abuf))); -+ RTA_DATA(tb[FRA_DST]))); - } - } else if (r->rtm_dst_len) { - fprintf(fp, "to 0/%d ", r->rtm_dst_len); -@@ -175,8 +173,7 @@ int print_rule(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - fprintf(fp, "map-to %s ", - format_host(r->rtm_family, - RTA_PAYLOAD(tb[RTA_GATEWAY]), -- RTA_DATA(tb[RTA_GATEWAY]), -- abuf, sizeof(abuf))); -+ RTA_DATA(tb[RTA_GATEWAY]))); - } else - fprintf(fp, "masquerade"); - } else if (r->rtm_type == FR_ACT_GOTO) { -diff --git a/ip/iptoken.c b/ip/iptoken.c -index 0d265e6..b8b0df0 100644 ---- a/ip/iptoken.c -+++ b/ip/iptoken.c -@@ -51,7 +51,6 @@ static int print_token(const struct sockaddr_nl *who, struct nlmsghdr *n, void * - int len = n->nlmsg_len; - struct rtattr *tb[IFLA_MAX + 1]; - struct rtattr *ltb[IFLA_INET6_MAX + 1]; -- char abuf[256]; - - if (n->nlmsg_type != RTM_NEWLINK) - return -1; -@@ -82,8 +81,7 @@ static int print_token(const struct sockaddr_nl *who, struct nlmsghdr *n, void * - fprintf(fp, "token %s ", - format_host(ifi->ifi_family, - RTA_PAYLOAD(ltb[IFLA_INET6_TOKEN]), -- RTA_DATA(ltb[IFLA_INET6_TOKEN]), -- abuf, sizeof(abuf))); -+ RTA_DATA(ltb[IFLA_INET6_TOKEN]))); - fprintf(fp, "dev %s ", ll_index_to_name(ifi->ifi_index)); - fprintf(fp, "\n"); - fflush(fp); -diff --git a/ip/iptunnel.c b/ip/iptunnel.c -index b9b24e8..17b377c 100644 ---- a/ip/iptunnel.c -+++ b/ip/iptunnel.c -@@ -346,7 +346,7 @@ static void print_tunnel(struct ip_tunnel_parm *p) - printf("%s: %s/ip remote %s local %s ", - p->name, - tnl_strproto(p->iph.protocol), -- p->iph.daddr ? format_host(AF_INET, 4, &p->iph.daddr, s1, sizeof(s1)) : "any", -+ p->iph.daddr ? format_host_r(AF_INET, 4, &p->iph.daddr, s1, sizeof(s1)) : "any", - p->iph.saddr ? rt_addr_n2a(AF_INET, 4, &p->iph.saddr, s2, sizeof(s2)) : "any"); - - if (p->iph.protocol == IPPROTO_IPV6 && (p->i_flags & SIT_ISATAP)) { -@@ -363,7 +363,7 @@ static void print_tunnel(struct ip_tunnel_parm *p) - if (prl[i].addr != htonl(INADDR_ANY)) { - printf(" %s %s ", - (prl[i].flags & PRL_DEFAULT) ? "pdr" : "pr", -- format_host(AF_INET, 4, &prl[i].addr, s1, sizeof(s1))); -+ format_host(AF_INET, 4, &prl[i].addr)); - } - } - } -@@ -398,7 +398,7 @@ static void print_tunnel(struct ip_tunnel_parm *p) - ip6rd.prefixlen); - if (ip6rd.relay_prefix) { - printf("6rd-relay_prefix %s/%u ", -- format_host(AF_INET, 4, &ip6rd.relay_prefix, s1, sizeof(s1)), -+ format_host(AF_INET, 4, &ip6rd.relay_prefix), - ip6rd.relay_prefixlen); - } - } -diff --git a/ip/link_gre.c b/ip/link_gre.c -index 62acf46..25a4047 100644 ---- a/ip/link_gre.c -+++ b/ip/link_gre.c -@@ -276,7 +276,6 @@ get_failed: - - static void gre_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - { -- char s1[1024]; - char s2[64]; - const char *local = "any"; - const char *remote = "any"; -@@ -290,7 +289,7 @@ static void gre_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - unsigned addr = rta_getattr_u32(tb[IFLA_GRE_REMOTE]); - - if (addr) -- remote = format_host(AF_INET, 4, &addr, s1, sizeof(s1)); -+ remote = format_host(AF_INET, 4, &addr); - } - - fprintf(f, "remote %s ", remote); -@@ -299,7 +298,7 @@ static void gre_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - unsigned addr = rta_getattr_u32(tb[IFLA_GRE_LOCAL]); - - if (addr) -- local = format_host(AF_INET, 4, &addr, s1, sizeof(s1)); -+ local = format_host(AF_INET, 4, &addr); - } - - fprintf(f, "local %s ", local); -diff --git a/ip/link_gre6.c b/ip/link_gre6.c -index e00ea09..e07a0ad 100644 ---- a/ip/link_gre6.c -+++ b/ip/link_gre6.c -@@ -297,7 +297,6 @@ get_failed: - - static void gre_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - { -- char s1[1024]; - char s2[64]; - const char *local = "any"; - const char *remote = "any"; -@@ -321,7 +320,7 @@ static void gre_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - memcpy(&addr, RTA_DATA(tb[IFLA_GRE_REMOTE]), sizeof(addr)); - - if (memcmp(&addr, &in6_addr_any, sizeof(addr))) -- remote = format_host(AF_INET6, sizeof(addr), &addr, s1, sizeof(s1)); -+ remote = format_host(AF_INET6, sizeof(addr), &addr); - } - - fprintf(f, "remote %s ", remote); -@@ -331,7 +330,7 @@ static void gre_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - memcpy(&addr, RTA_DATA(tb[IFLA_GRE_LOCAL]), sizeof(addr)); - - if (memcmp(&addr, &in6_addr_any, sizeof(addr))) -- local = format_host(AF_INET6, sizeof(addr), &addr, s1, sizeof(s1)); -+ local = format_host(AF_INET6, sizeof(addr), &addr); - } - - fprintf(f, "local %s ", local); -diff --git a/ip/link_iptnl.c b/ip/link_iptnl.c -index 4d5422b..0d83310 100644 ---- a/ip/link_iptnl.c -+++ b/ip/link_iptnl.c -@@ -258,7 +258,7 @@ static void iptunnel_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[ - unsigned addr = rta_getattr_u32(tb[IFLA_IPTUN_REMOTE]); - - if (addr) -- remote = format_host(AF_INET, 4, &addr, s1, sizeof(s1)); -+ remote = format_host(AF_INET, 4, &addr); - } - - fprintf(f, "remote %s ", remote); -@@ -267,7 +267,7 @@ static void iptunnel_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[ - unsigned addr = rta_getattr_u32(tb[IFLA_IPTUN_LOCAL]); - - if (addr) -- local = format_host(AF_INET, 4, &addr, s1, sizeof(s1)); -+ local = format_host(AF_INET, 4, &addr); - } - - fprintf(f, "local %s ", local); -@@ -323,8 +323,7 @@ static void iptunnel_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[ - prefixlen); - if (relayprefix) { - printf("6rd-relay_prefix %s/%u ", -- format_host(AF_INET, 4, &relayprefix, s1, -- sizeof(s1)), -+ format_host(AF_INET, 4, &relayprefix), - relayprefixlen); - } - } -diff --git a/ip/link_vti.c b/ip/link_vti.c -index f3fea33..83d6187 100644 ---- a/ip/link_vti.c -+++ b/ip/link_vti.c -@@ -198,7 +198,6 @@ get_failed: - - static void vti_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - { -- char s1[1024]; - char s2[64]; - const char *local = "any"; - const char *remote = "any"; -@@ -210,7 +209,7 @@ static void vti_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - unsigned addr = *(__u32 *)RTA_DATA(tb[IFLA_VTI_REMOTE]); - - if (addr) -- remote = format_host(AF_INET, 4, &addr, s1, sizeof(s1)); -+ remote = format_host(AF_INET, 4, &addr); - } - - fprintf(f, "remote %s ", remote); -@@ -219,7 +218,7 @@ static void vti_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - unsigned addr = *(__u32 *)RTA_DATA(tb[IFLA_VTI_LOCAL]); - - if (addr) -- local = format_host(AF_INET, 4, &addr, s1, sizeof(s1)); -+ local = format_host(AF_INET, 4, &addr); - } - - fprintf(f, "local %s ", local); -diff --git a/ip/link_vti6.c b/ip/link_vti6.c -index c146f79..699a6ab 100644 ---- a/ip/link_vti6.c -+++ b/ip/link_vti6.c -@@ -195,7 +195,6 @@ get_failed: - - static void vti6_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - { -- char s1[1024]; - char s2[64]; - const char *local = "any"; - const char *remote = "any"; -@@ -208,7 +207,7 @@ static void vti6_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - if (tb[IFLA_VTI_REMOTE]) { - memcpy(&daddr, RTA_DATA(tb[IFLA_VTI_REMOTE]), sizeof(daddr)); - -- remote = format_host(AF_INET6, 16, &daddr, s1, sizeof(s1)); -+ remote = format_host(AF_INET6, 16, &daddr); - } - - fprintf(f, "remote %s ", remote); -@@ -216,7 +215,7 @@ static void vti6_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - if (tb[IFLA_VTI_LOCAL]) { - memcpy(&saddr, RTA_DATA(tb[IFLA_VTI_LOCAL]), sizeof(saddr)); - -- local = format_host(AF_INET6, 16, &saddr, s1, sizeof(s1)); -+ local = format_host(AF_INET6, 16, &saddr); - } - - fprintf(f, "local %s ", local); -diff --git a/ip/tcp_metrics.c b/ip/tcp_metrics.c -index 7e7cf27..c55d9ad 100644 ---- a/ip/tcp_metrics.c -+++ b/ip/tcp_metrics.c -@@ -94,7 +94,6 @@ static int process_msg(const struct sockaddr_nl *who, struct nlmsghdr *n, - struct genlmsghdr *ghdr; - struct rtattr *attrs[TCP_METRICS_ATTR_MAX + 1], *a; - int len = n->nlmsg_len; -- char abuf[256]; - inet_prefix addr; - int family, i, atype; - -@@ -161,8 +160,7 @@ static int process_msg(const struct sockaddr_nl *who, struct nlmsghdr *n, - fprintf(fp, "Deleted "); - - fprintf(fp, "%s", -- format_host(family, RTA_PAYLOAD(a), &addr.data, -- abuf, sizeof(abuf))); -+ format_host(family, RTA_PAYLOAD(a), &addr.data)); - - a = attrs[TCP_METRICS_ATTR_AGE]; - if (a) { -diff --git a/lib/utils.c b/lib/utils.c -index d3ed875..9764d75 100644 ---- a/lib/utils.c -+++ b/lib/utils.c -@@ -780,7 +780,7 @@ static const char *resolve_address(const void *addr, int len, int af) - #endif - - --const char *format_host(int af, int len, const void *addr, -+const char *format_host_r(int af, int len, const void *addr, - char *buf, int buflen) - { - #ifdef RESOLVE_HOSTNAMES -@@ -816,6 +816,13 @@ const char *format_host(int af, int len, const void *addr, - return rt_addr_n2a(af, len, addr, buf, buflen); - } - -+const char *format_host(int af, int len, const void *addr) -+{ -+ static char buf[256]; -+ -+ return format_host_r(af, len, addr, buf, 256); -+} -+ - - char *hexstring_n2a(const __u8 *str, int len, char *buf, int blen) - { -diff --git a/misc/ss.c b/misc/ss.c -index d438428..46b0925 100644 ---- a/misc/ss.c -+++ b/misc/ss.c -@@ -1074,10 +1074,10 @@ static void inet_addr_print(const inet_prefix *a, int port, unsigned int ifindex - buf[0] = '*'; - buf[1] = 0; - } else { -- ap = format_host(AF_INET, 4, a->data, buf, sizeof(buf)); -+ ap = format_host(AF_INET, 4, a->data); - } - } else { -- ap = format_host(a->family, 16, a->data, buf, sizeof(buf)); -+ ap = format_host(a->family, 16, a->data); - est_len = strlen(ap); - if (est_len <= addr_width) - est_len = addr_width; -@@ -2119,7 +2119,6 @@ static void tcp_show_info(const struct nlmsghdr *nlh, struct inet_diag_msg *r, - - static const char *format_host_sa(struct sockaddr_storage *sa) - { -- char buf[1024]; - union { - struct sockaddr_in sin; - struct sockaddr_in6 sin6; -@@ -2127,11 +2126,9 @@ static const char *format_host_sa(struct sockaddr_storage *sa) - - switch (sa->ss_family) { - case AF_INET: -- return format_host(AF_INET, 4, &saddr->sin.sin_addr, -- buf, sizeof(buf)); -+ return format_host(AF_INET, 4, &saddr->sin.sin_addr); - case AF_INET6: -- return format_host(AF_INET6, 16, &saddr->sin6.sin6_addr, -- buf, sizeof(buf)); -+ return format_host(AF_INET6, 16, &saddr->sin6.sin6_addr); - default: - return ""; - } -diff --git a/tc/m_nat.c b/tc/m_nat.c -index 01ec032..df5c911 100644 ---- a/tc/m_nat.c -+++ b/tc/m_nat.c -@@ -190,9 +190,9 @@ print_nat(struct action_util *au,FILE * f, struct rtattr *arg) - - fprintf(f, " nat %s %s/%d %s %s", sel->flags & TCA_NAT_FLAG_EGRESS ? - "egress" : "ingress", -- format_host(AF_INET, 4, &sel->old_addr, buf1, sizeof(buf1)), -+ format_host_r(AF_INET, 4, &sel->old_addr, buf1, sizeof(buf1)), - len, -- format_host(AF_INET, 4, &sel->new_addr, buf2, sizeof(buf2)), -+ format_host_r(AF_INET, 4, &sel->new_addr, buf2, sizeof(buf2)), - action_n2a(sel->action, buf3, sizeof (buf3))); - - if (show_stats) { --- -1.8.3.1 - diff --git a/SOURCES/0105-utils-make-rt_addr_n2a-non-reentrant-by-default.patch b/SOURCES/0105-utils-make-rt_addr_n2a-non-reentrant-by-default.patch deleted file mode 100644 index 152e472..0000000 --- a/SOURCES/0105-utils-make-rt_addr_n2a-non-reentrant-by-default.patch +++ /dev/null @@ -1,466 +0,0 @@ -From 397fcc28438965bdd9c175ebe230c47a9564527e Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 13:20:23 +0100 -Subject: [PATCH] utils: make rt_addr_n2a() non-reentrant by default - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629 -Upstream Status: iproute2.git commit 2e96d2ccd03a2 -Conflicts: Context changes due to not backported whitespace cleanup from - upstream. -* Drop iproute_lwtunnel hunks as we don't support it - -commit 2e96d2ccd03a29896fc8a2c6ee6b769c512501df -Author: Phil Sutter -Date: Tue Mar 22 19:35:16 2016 +0100 - - utils: make rt_addr_n2a() non-reentrant by default - - There is only a single user who needs it to be reentrant (not really, - but it's safer like this), add rt_addr_n2a_r() for it to use. - - Signed-off-by: Phil Sutter ---- - include/utils.h | 3 ++- - ip/ip6tunnel.c | 2 +- - ip/iplink_bond.c | 5 +---- - ip/ipmroute.c | 7 ++----- - ip/ipprefix.c | 5 +---- - ip/iproute.c | 10 +++------- - ip/iprule.c | 7 ++----- - ip/iptunnel.c | 2 +- - ip/ipxfrm.c | 29 ++++++----------------------- - ip/link_ip6tnl.c | 7 ++----- - ip/xfrm_monitor.c | 16 +++------------- - lib/utils.c | 11 +++++++++-- - tc/f_flower.c | 7 ++----- - 14 files changed, 37 insertions(+), 81 deletions(-) - -diff --git a/include/utils.h b/include/utils.h -index df6ce04..28684c5 100644 ---- a/include/utils.h -+++ b/include/utils.h -@@ -112,8 +112,9 @@ __u8 *hexstring_a2n(const char *str, __u8 *buf, int blen, unsigned int *len); - const char *format_host_r(int af, int len, const void *addr, - char *buf, int buflen); - const char *format_host(int af, int lne, const void *addr); --const char *rt_addr_n2a(int af, int len, const void *addr, -+const char *rt_addr_n2a_r(int af, int len, const void *addr, - char *buf, int buflen); -+const char *rt_addr_n2a(int af, int len, const void *addr); - - int read_family(const char *name); - const char *family_name(int family); -diff --git a/ip/ip6tunnel.c b/ip/ip6tunnel.c -index ab8603d..e99a851 100644 ---- a/ip/ip6tunnel.c -+++ b/ip/ip6tunnel.c -@@ -79,7 +79,7 @@ static void print_tunnel(struct ip6_tnl_parm2 *p) - p->name, - tnl_strproto(p->proto), - format_host_r(AF_INET6, 16, &p->raddr, s1, sizeof(s1)), -- rt_addr_n2a(AF_INET6, 16, &p->laddr, s2, sizeof(s2))); -+ rt_addr_n2a_r(AF_INET6, 16, &p->laddr, s2, sizeof(s2))); - if (p->link) { - const char *n = ll_index_to_name(p->link); - if (n) -diff --git a/ip/iplink_bond.c b/ip/iplink_bond.c -index cb2f045..6881eda 100644 ---- a/ip/iplink_bond.c -+++ b/ip/iplink_bond.c -@@ -410,7 +410,6 @@ static void bond_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - - if (tb[IFLA_BOND_ARP_IP_TARGET]) { - struct rtattr *iptb[BOND_MAX_ARP_TARGETS + 1]; -- char buf[INET_ADDRSTRLEN]; - int i; - - parse_rtattr_nested(iptb, BOND_MAX_ARP_TARGETS, -@@ -424,9 +423,7 @@ static void bond_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - fprintf(f, "%s", - rt_addr_n2a(AF_INET, - RTA_PAYLOAD(iptb[i]), -- RTA_DATA(iptb[i]), -- buf, -- INET_ADDRSTRLEN)); -+ RTA_DATA(iptb[i]))); - if (i < BOND_MAX_ARP_TARGETS-1 && iptb[i+1]) - fprintf(f, ","); - } -diff --git a/ip/ipmroute.c b/ip/ipmroute.c -index 2c08fee..2daecc0 100644 ---- a/ip/ipmroute.c -+++ b/ip/ipmroute.c -@@ -59,7 +59,6 @@ int print_mroute(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - struct rtmsg *r = NLMSG_DATA(n); - int len = n->nlmsg_len; - struct rtattr * tb[RTA_MAX+1]; -- char abuf[256]; - char obuf[256]; - SPRINT_BUF(b1); - __u32 table; -@@ -117,16 +116,14 @@ int print_mroute(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - len = snprintf(obuf, sizeof(obuf), - "(%s, ", rt_addr_n2a(family, - RTA_PAYLOAD(tb[RTA_SRC]), -- RTA_DATA(tb[RTA_SRC]), -- abuf, sizeof(abuf))); -+ RTA_DATA(tb[RTA_SRC]))); - else - len = sprintf(obuf, "(unknown, "); - if (tb[RTA_DST]) - snprintf(obuf + len, sizeof(obuf) - len, - "%s)", rt_addr_n2a(family, - RTA_PAYLOAD(tb[RTA_DST]), -- RTA_DATA(tb[RTA_DST]), -- abuf, sizeof(abuf))); -+ RTA_DATA(tb[RTA_DST]))); - else - snprintf(obuf + len, sizeof(obuf) - len, "unknown) "); - -diff --git a/ip/ipprefix.c b/ip/ipprefix.c -index 286c09b..7b0a762 100644 ---- a/ip/ipprefix.c -+++ b/ip/ipprefix.c -@@ -76,15 +76,12 @@ int print_prefix(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - - if (tb[PREFIX_ADDRESS]) { - struct in6_addr *pfx; -- char abuf[256]; - - pfx = (struct in6_addr *)RTA_DATA(tb[PREFIX_ADDRESS]); - -- memset(abuf, '\0', sizeof(abuf)); - fprintf(fp, "%s", rt_addr_n2a(family, - RTA_PAYLOAD(tb[PREFIX_ADDRESS]), -- pfx, -- abuf, sizeof(abuf))); -+ pfx)); - } - fprintf(fp, "/%u ", prefix->prefix_len); - -diff --git a/ip/iproute.c b/ip/iproute.c -index 2bc2041..c3006e4 100644 ---- a/ip/iproute.c -+++ b/ip/iproute.c -@@ -306,7 +306,6 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - struct rtmsg *r = NLMSG_DATA(n); - int len = n->nlmsg_len; - struct rtattr * tb[RTA_MAX+1]; -- char abuf[256]; - int host_len = -1; - __u32 table; - SPRINT_BUF(b1); -@@ -359,8 +358,7 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - if (r->rtm_dst_len != host_len) { - fprintf(fp, "%s/%u ", rt_addr_n2a(r->rtm_family, - RTA_PAYLOAD(tb[RTA_DST]), -- RTA_DATA(tb[RTA_DST]), -- abuf, sizeof(abuf)), -+ RTA_DATA(tb[RTA_DST])), - r->rtm_dst_len - ); - } else { -@@ -378,8 +376,7 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - if (r->rtm_src_len != host_len) { - fprintf(fp, "from %s/%u ", rt_addr_n2a(r->rtm_family, - RTA_PAYLOAD(tb[RTA_SRC]), -- RTA_DATA(tb[RTA_SRC]), -- abuf, sizeof(abuf)), -+ RTA_DATA(tb[RTA_SRC])), - r->rtm_src_len - ); - } else { -@@ -424,8 +421,7 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - fprintf(fp, "src %s ", - rt_addr_n2a(r->rtm_family, - RTA_PAYLOAD(tb[RTA_PREFSRC]), -- RTA_DATA(tb[RTA_PREFSRC]), -- abuf, sizeof(abuf))); -+ RTA_DATA(tb[RTA_PREFSRC]))); - } - if (tb[RTA_PRIORITY]) - fprintf(fp, "metric %u ", rta_getattr_u32(tb[RTA_PRIORITY])); -diff --git a/ip/iprule.c b/ip/iprule.c -index 14eb852..87adb3b 100644 ---- a/ip/iprule.c -+++ b/ip/iprule.c -@@ -53,7 +53,6 @@ int print_rule(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - int host_len = -1; - __u32 table; - struct rtattr * tb[FRA_MAX+1]; -- char abuf[256]; - SPRINT_BUF(b1); - - if (n->nlmsg_type != RTM_NEWRULE && n->nlmsg_type != RTM_DELRULE) -@@ -89,8 +88,7 @@ int print_rule(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - if (r->rtm_src_len != host_len) { - fprintf(fp, "from %s/%u ", rt_addr_n2a(r->rtm_family, - RTA_PAYLOAD(tb[FRA_SRC]), -- RTA_DATA(tb[FRA_SRC]), -- abuf, sizeof(abuf)), -+ RTA_DATA(tb[FRA_SRC])), - r->rtm_src_len - ); - } else { -@@ -109,8 +107,7 @@ int print_rule(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - if (r->rtm_dst_len != host_len) { - fprintf(fp, "to %s/%u ", rt_addr_n2a(r->rtm_family, - RTA_PAYLOAD(tb[FRA_DST]), -- RTA_DATA(tb[FRA_DST]), -- abuf, sizeof(abuf)), -+ RTA_DATA(tb[FRA_DST])), - r->rtm_dst_len - ); - } else { -diff --git a/ip/iptunnel.c b/ip/iptunnel.c -index 17b377c..c78c7f5 100644 ---- a/ip/iptunnel.c -+++ b/ip/iptunnel.c -@@ -347,7 +347,7 @@ static void print_tunnel(struct ip_tunnel_parm *p) - p->name, - tnl_strproto(p->iph.protocol), - p->iph.daddr ? format_host_r(AF_INET, 4, &p->iph.daddr, s1, sizeof(s1)) : "any", -- p->iph.saddr ? rt_addr_n2a(AF_INET, 4, &p->iph.saddr, s2, sizeof(s2)) : "any"); -+ p->iph.saddr ? rt_addr_n2a_r(AF_INET, 4, &p->iph.saddr, s2, sizeof(s2)) : "any"); - - if (p->iph.protocol == IPPROTO_IPV6 && (p->i_flags & SIT_ISATAP)) { - struct ip_tunnel_prl prl[16]; -diff --git a/ip/ipxfrm.c b/ip/ipxfrm.c -index 0344355..899ec9d 100644 ---- a/ip/ipxfrm.c -+++ b/ip/ipxfrm.c -@@ -283,17 +283,11 @@ void xfrm_id_info_print(xfrm_address_t *saddr, struct xfrm_id *id, - __u8 mode, __u32 reqid, __u16 family, int force_spi, - FILE *fp, const char *prefix, const char *title) - { -- char abuf[256]; -- - if (title) - fputs(title, fp); - -- memset(abuf, '\0', sizeof(abuf)); -- fprintf(fp, "src %s ", rt_addr_n2a(family, sizeof(*saddr), -- saddr, abuf, sizeof(abuf))); -- memset(abuf, '\0', sizeof(abuf)); -- fprintf(fp, "dst %s", rt_addr_n2a(family, sizeof(id->daddr), -- &id->daddr, abuf, sizeof(abuf))); -+ fprintf(fp, "src %s ", rt_addr_n2a(family, sizeof(*saddr), saddr)); -+ fprintf(fp, "dst %s", rt_addr_n2a(family, sizeof(id->daddr), &id->daddr)); - fprintf(fp, "%s", _SL_); - - if (prefix) -@@ -443,7 +437,6 @@ void xfrm_lifetime_print(struct xfrm_lifetime_cfg *cfg, - void xfrm_selector_print(struct xfrm_selector *sel, __u16 family, - FILE *fp, const char *prefix) - { -- char abuf[256]; - __u16 f; - - f = sel->family; -@@ -455,16 +448,12 @@ void xfrm_selector_print(struct xfrm_selector *sel, __u16 family, - if (prefix) - fputs(prefix, fp); - -- memset(abuf, '\0', sizeof(abuf)); - fprintf(fp, "src %s/%u ", -- rt_addr_n2a(f, sizeof(sel->saddr), &sel->saddr, -- abuf, sizeof(abuf)), -+ rt_addr_n2a(f, sizeof(sel->saddr), &sel->saddr), - sel->prefixlen_s); - -- memset(abuf, '\0', sizeof(abuf)); - fprintf(fp, "dst %s/%u ", -- rt_addr_n2a(f, sizeof(sel->daddr), &sel->daddr, -- abuf, sizeof(abuf)), -+ rt_addr_n2a(f, sizeof(sel->daddr), &sel->daddr), - sel->prefixlen_d); - - if (sel->proto) -@@ -729,7 +718,6 @@ void xfrm_xfrma_print(struct rtattr *tb[], __u16 family, - - if (tb[XFRMA_ENCAP]) { - struct xfrm_encap_tmpl *e; -- char abuf[256]; - - if (prefix) - fputs(prefix, fp); -@@ -757,10 +745,8 @@ void xfrm_xfrma_print(struct rtattr *tb[], __u16 family, - fprintf(fp, "sport %u ", ntohs(e->encap_sport)); - fprintf(fp, "dport %u ", ntohs(e->encap_dport)); - -- memset(abuf, '\0', sizeof(abuf)); - fprintf(fp, "addr %s", -- rt_addr_n2a(family, sizeof(e->encap_oa), &e->encap_oa, -- abuf, sizeof(abuf))); -+ rt_addr_n2a(family, sizeof(e->encap_oa), &e->encap_oa)); - fprintf(fp, "%s", _SL_); - } - -@@ -771,7 +757,6 @@ void xfrm_xfrma_print(struct rtattr *tb[], __u16 family, - } - - if (tb[XFRMA_COADDR]) { -- char abuf[256]; - xfrm_address_t *coa; - - if (prefix) -@@ -786,10 +771,8 @@ void xfrm_xfrma_print(struct rtattr *tb[], __u16 family, - return; - } - -- memset(abuf, '\0', sizeof(abuf)); - fprintf(fp, "%s", -- rt_addr_n2a(family, sizeof(*coa), coa, -- abuf, sizeof(abuf))); -+ rt_addr_n2a(family, sizeof(*coa), coa)); - fprintf(fp, "%s", _SL_); - } - -diff --git a/ip/link_ip6tnl.c b/ip/link_ip6tnl.c -index f771c75..8cd9095 100644 ---- a/ip/link_ip6tnl.c -+++ b/ip/link_ip6tnl.c -@@ -254,7 +254,6 @@ get_failed: - - static void ip6tunnel_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - { -- char s1[256]; - char s2[64]; - int flags = 0; - __u32 flowinfo = 0; -@@ -286,16 +285,14 @@ static void ip6tunnel_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb - fprintf(f, "remote %s ", - rt_addr_n2a(AF_INET6, - RTA_PAYLOAD(tb[IFLA_IPTUN_REMOTE]), -- RTA_DATA(tb[IFLA_IPTUN_REMOTE]), -- s1, sizeof(s1))); -+ RTA_DATA(tb[IFLA_IPTUN_REMOTE]))); - } - - if (tb[IFLA_IPTUN_LOCAL]) { - fprintf(f, "local %s ", - rt_addr_n2a(AF_INET6, - RTA_PAYLOAD(tb[IFLA_IPTUN_LOCAL]), -- RTA_DATA(tb[IFLA_IPTUN_LOCAL]), -- s1, sizeof(s1))); -+ RTA_DATA(tb[IFLA_IPTUN_LOCAL]))); - } - - if (tb[IFLA_IPTUN_LINK] && rta_getattr_u32(tb[IFLA_IPTUN_LINK])) { -diff --git a/ip/xfrm_monitor.c b/ip/xfrm_monitor.c -index 34bd9f4..9c588f6 100644 ---- a/ip/xfrm_monitor.c -+++ b/ip/xfrm_monitor.c -@@ -227,12 +227,8 @@ static void xfrm_ae_flags_print(__u32 flags, void *arg) - - static void xfrm_usersa_print(const struct xfrm_usersa_id *sa_id, __u32 reqid, FILE *fp) - { -- char buf[256]; -- -- buf[0] = 0; - fprintf(fp, "dst %s ", -- rt_addr_n2a(sa_id->family, sizeof(sa_id->daddr), &sa_id->daddr, -- buf, sizeof(buf))); -+ rt_addr_n2a(sa_id->family, sizeof(sa_id->daddr), &sa_id->daddr)); - - fprintf(fp, " reqid 0x%x", reqid); - -@@ -245,15 +241,12 @@ static int xfrm_ae_print(const struct sockaddr_nl *who, - { - FILE *fp = (FILE*)arg; - struct xfrm_aevent_id *id = NLMSG_DATA(n); -- char abuf[256]; - - fprintf(fp, "Async event "); - xfrm_ae_flags_print(id->flags, arg); - fprintf(fp,"\n\t"); -- memset(abuf, '\0', sizeof(abuf)); - fprintf(fp, "src %s ", rt_addr_n2a(id->sa_id.family, -- sizeof(id->saddr), &id->saddr, -- abuf, sizeof(abuf))); -+ sizeof(id->saddr), &id->saddr)); - - xfrm_usersa_print(&id->sa_id, id->reqid, fp); - -@@ -265,10 +258,7 @@ static int xfrm_ae_print(const struct sockaddr_nl *who, - - static void xfrm_print_addr(FILE *fp, int family, xfrm_address_t *a) - { -- char buf[256]; -- -- buf[0] = 0; -- fprintf(fp, "%s", rt_addr_n2a(family, sizeof(*a), a, buf, sizeof(buf))); -+ fprintf(fp, "%s", rt_addr_n2a(family, sizeof(*a), a)); - } - - static int xfrm_mapping_print(const struct sockaddr_nl *who, -diff --git a/lib/utils.c b/lib/utils.c -index 9764d75..465f254 100644 ---- a/lib/utils.c -+++ b/lib/utils.c -@@ -671,7 +671,7 @@ int __get_user_hz(void) - return sysconf(_SC_CLK_TCK); - } - --const char *rt_addr_n2a(int af, int len, const void *addr, char *buf, int buflen) -+const char *rt_addr_n2a_r(int af, int len, const void *addr, char *buf, int buflen) - { - switch (af) { - case AF_INET: -@@ -690,6 +690,13 @@ const char *rt_addr_n2a(int af, int len, const void *addr, char *buf, int buflen - } - } - -+const char *rt_addr_n2a(int af, int len, const void *addr) -+{ -+ static char buf[256]; -+ -+ return rt_addr_n2a_r(af, len, addr, buf, 256); -+} -+ - int read_family(const char *name) - { - int family = AF_UNSPEC; -@@ -813,7 +820,7 @@ const char *format_host_r(int af, int len, const void *addr, - return n; - } - #endif -- return rt_addr_n2a(af, len, addr, buf, buflen); -+ return rt_addr_n2a_r(af, len, addr, buf, buflen); - } - - const char *format_host(int af, int len, const void *addr) -diff --git a/tc/f_flower.c b/tc/f_flower.c -index db9cc29..5e2dc0d 100644 ---- a/tc/f_flower.c -+++ b/tc/f_flower.c -@@ -394,7 +394,6 @@ static void flower_print_ip_addr(FILE *f, char *name, __be16 eth_type, - struct rtattr *addr6_attr, - struct rtattr *mask6_attr) - { -- SPRINT_BUF(b1); - struct rtattr *addr_attr; - struct rtattr *mask_attr; - int family; -@@ -418,16 +417,14 @@ static void flower_print_ip_addr(FILE *f, char *name, __be16 eth_type, - return; - fprintf(f, "\n %s %s", name, rt_addr_n2a(family, - RTA_PAYLOAD(addr_attr), -- RTA_DATA(addr_attr), -- b1, sizeof(b1))); -+ RTA_DATA(addr_attr))); - if (!mask_attr || RTA_PAYLOAD(mask_attr) != len) - return; - bits = __mask_bits(RTA_DATA(mask_attr), len); - if (bits < 0) - fprintf(f, "/%s", rt_addr_n2a(family, - RTA_PAYLOAD(mask_attr), -- RTA_DATA(mask_attr), -- b1, sizeof(b1))); -+ RTA_DATA(mask_attr))); - else if (bits < len * 8) - fprintf(f, "/%d", bits); - } --- -1.8.3.1 - diff --git a/SOURCES/0106-lib-utils-introduce-rt_addr_n2a_rta.patch b/SOURCES/0106-lib-utils-introduce-rt_addr_n2a_rta.patch deleted file mode 100644 index f7fe5c5..0000000 --- a/SOURCES/0106-lib-utils-introduce-rt_addr_n2a_rta.patch +++ /dev/null @@ -1,239 +0,0 @@ -From bf7031233e6db15ed6e76b0f7efcae8355ce4cd4 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 13:20:47 +0100 -Subject: [PATCH] lib/utils: introduce rt_addr_n2a_rta() - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629 -Upstream Status: iproute2.git commit 7faf1588a755e -Conflicts: Context changed due to already backported commit - 7cc7cb8a888bf ("ip-route: Prevent some double spaces in - output"). -* Drop iproute_lwtunnel hunks as we don't support it - -commit 7faf1588a755edb9c9cabbe1d3211265e9826d28 -Author: Phil Sutter -Date: Tue Mar 22 19:35:18 2016 +0100 - - lib/utils: introduce rt_addr_n2a_rta() - - This simple macro eases calling rt_addr_n2a() with data from an rt_attr - pointer. - - Signed-off-by: Phil Sutter ---- - include/utils.h | 2 ++ - ip/iplink_bond.c | 4 +--- - ip/ipmroute.c | 8 ++------ - ip/ipprefix.c | 14 +++----------- - ip/iproute.c | 20 +++++++------------- - ip/iprule.c | 16 ++++++---------- - ip/link_ip6tnl.c | 8 ++------ - tc/f_flower.c | 8 ++------ - 9 files changed, 29 insertions(+), 70 deletions(-) - -diff --git a/include/utils.h b/include/utils.h -index 28684c5..53a631f 100644 ---- a/include/utils.h -+++ b/include/utils.h -@@ -115,6 +115,8 @@ const char *format_host(int af, int lne, const void *addr); - const char *rt_addr_n2a_r(int af, int len, const void *addr, - char *buf, int buflen); - const char *rt_addr_n2a(int af, int len, const void *addr); -+#define rt_addr_n2a_rta(af, rta) \ -+ rt_addr_n2a(af, RTA_PAYLOAD(rta), RTA_DATA(rta)) - - int read_family(const char *name); - const char *family_name(int family); -diff --git a/ip/iplink_bond.c b/ip/iplink_bond.c -index 6881eda..d4e970d 100644 ---- a/ip/iplink_bond.c -+++ b/ip/iplink_bond.c -@@ -421,9 +421,7 @@ static void bond_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - for (i = 0; i < BOND_MAX_ARP_TARGETS; i++) { - if (iptb[i]) - fprintf(f, "%s", -- rt_addr_n2a(AF_INET, -- RTA_PAYLOAD(iptb[i]), -- RTA_DATA(iptb[i]))); -+ rt_addr_n2a_rta(AF_INET, iptb[i])); - if (i < BOND_MAX_ARP_TARGETS-1 && iptb[i+1]) - fprintf(f, ","); - } -diff --git a/ip/ipmroute.c b/ip/ipmroute.c -index 2daecc0..eb480f0 100644 ---- a/ip/ipmroute.c -+++ b/ip/ipmroute.c -@@ -114,16 +114,12 @@ int print_mroute(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - - if (tb[RTA_SRC]) - len = snprintf(obuf, sizeof(obuf), -- "(%s, ", rt_addr_n2a(family, -- RTA_PAYLOAD(tb[RTA_SRC]), -- RTA_DATA(tb[RTA_SRC]))); -+ "(%s, ", rt_addr_n2a_rta(family, tb[RTA_SRC])); - else - len = sprintf(obuf, "(unknown, "); - if (tb[RTA_DST]) - snprintf(obuf + len, sizeof(obuf) - len, -- "%s)", rt_addr_n2a(family, -- RTA_PAYLOAD(tb[RTA_DST]), -- RTA_DATA(tb[RTA_DST]))); -+ "%s)", rt_addr_n2a_rta(family, tb[RTA_DST])); - else - snprintf(obuf + len, sizeof(obuf) - len, "unknown) "); - -diff --git a/ip/ipprefix.c b/ip/ipprefix.c -index 7b0a762..a1558d2 100644 ---- a/ip/ipprefix.c -+++ b/ip/ipprefix.c -@@ -72,19 +72,11 @@ int print_prefix(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - - parse_rtattr(tb, RTA_MAX, RTM_RTA(prefix), len); - -- fprintf(fp, "prefix "); -- - if (tb[PREFIX_ADDRESS]) { -- struct in6_addr *pfx; -- -- pfx = (struct in6_addr *)RTA_DATA(tb[PREFIX_ADDRESS]); -- -- fprintf(fp, "%s", rt_addr_n2a(family, -- RTA_PAYLOAD(tb[PREFIX_ADDRESS]), -- pfx)); -+ fprintf(fp, "prefix %s/%u", -+ rt_addr_n2a_rta(family, tb[PREFIX_ADDRESS]), -+ prefix->prefix_len); - } -- fprintf(fp, "/%u ", prefix->prefix_len); -- - fprintf(fp, "dev %s ", ll_index_to_name(prefix->prefix_ifindex)); - - if (prefix->prefix_flags & IF_PREFIX_ONLINK) -diff --git a/ip/iproute.c b/ip/iproute.c -index c3006e4..134b146 100644 ---- a/ip/iproute.c -+++ b/ip/iproute.c -@@ -356,11 +356,9 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - - if (tb[RTA_DST]) { - if (r->rtm_dst_len != host_len) { -- fprintf(fp, "%s/%u ", rt_addr_n2a(r->rtm_family, -- RTA_PAYLOAD(tb[RTA_DST]), -- RTA_DATA(tb[RTA_DST])), -- r->rtm_dst_len -- ); -+ fprintf(fp, "%s/%u ", -+ rt_addr_n2a_rta(r->rtm_family, tb[RTA_DST]), -+ r->rtm_dst_len); - } else { - fprintf(fp, "%s ", format_host(r->rtm_family, - RTA_PAYLOAD(tb[RTA_DST]), -@@ -374,11 +372,9 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - } - if (tb[RTA_SRC]) { - if (r->rtm_src_len != host_len) { -- fprintf(fp, "from %s/%u ", rt_addr_n2a(r->rtm_family, -- RTA_PAYLOAD(tb[RTA_SRC]), -- RTA_DATA(tb[RTA_SRC])), -- r->rtm_src_len -- ); -+ fprintf(fp, "from %s/%u ", -+ rt_addr_n2a_rta(r->rtm_family, tb[RTA_SRC]), -+ r->rtm_src_len); - } else { - fprintf(fp, "from %s ", format_host(r->rtm_family, - RTA_PAYLOAD(tb[RTA_SRC]), -@@ -419,9 +415,7 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - and symbolic name will not be useful. - */ - fprintf(fp, "src %s ", -- rt_addr_n2a(r->rtm_family, -- RTA_PAYLOAD(tb[RTA_PREFSRC]), -- RTA_DATA(tb[RTA_PREFSRC]))); -+ rt_addr_n2a_rta(r->rtm_family, tb[RTA_PREFSRC])); - } - if (tb[RTA_PRIORITY]) - fprintf(fp, "metric %u ", rta_getattr_u32(tb[RTA_PRIORITY])); -diff --git a/ip/iprule.c b/ip/iprule.c -index 87adb3b..4b7de4a 100644 ---- a/ip/iprule.c -+++ b/ip/iprule.c -@@ -86,11 +86,9 @@ int print_rule(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - - if (tb[FRA_SRC]) { - if (r->rtm_src_len != host_len) { -- fprintf(fp, "from %s/%u ", rt_addr_n2a(r->rtm_family, -- RTA_PAYLOAD(tb[FRA_SRC]), -- RTA_DATA(tb[FRA_SRC])), -- r->rtm_src_len -- ); -+ fprintf(fp, "from %s/%u ", -+ rt_addr_n2a_rta(r->rtm_family, tb[FRA_SRC]), -+ r->rtm_src_len); - } else { - fprintf(fp, "from %s ", format_host(r->rtm_family, - RTA_PAYLOAD(tb[FRA_SRC]), -@@ -105,11 +103,9 @@ int print_rule(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - - if (tb[FRA_DST]) { - if (r->rtm_dst_len != host_len) { -- fprintf(fp, "to %s/%u ", rt_addr_n2a(r->rtm_family, -- RTA_PAYLOAD(tb[FRA_DST]), -- RTA_DATA(tb[FRA_DST])), -- r->rtm_dst_len -- ); -+ fprintf(fp, "to %s/%u ", -+ rt_addr_n2a_rta(r->rtm_family, tb[FRA_DST]), -+ r->rtm_dst_len); - } else { - fprintf(fp, "to %s ", format_host(r->rtm_family, - RTA_PAYLOAD(tb[FRA_DST]), -diff --git a/ip/link_ip6tnl.c b/ip/link_ip6tnl.c -index 8cd9095..79b5cd1 100644 ---- a/ip/link_ip6tnl.c -+++ b/ip/link_ip6tnl.c -@@ -283,16 +283,12 @@ static void ip6tunnel_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb - - if (tb[IFLA_IPTUN_REMOTE]) { - fprintf(f, "remote %s ", -- rt_addr_n2a(AF_INET6, -- RTA_PAYLOAD(tb[IFLA_IPTUN_REMOTE]), -- RTA_DATA(tb[IFLA_IPTUN_REMOTE]))); -+ rt_addr_n2a_rta(AF_INET6, tb[IFLA_IPTUN_REMOTE])); - } - - if (tb[IFLA_IPTUN_LOCAL]) { - fprintf(f, "local %s ", -- rt_addr_n2a(AF_INET6, -- RTA_PAYLOAD(tb[IFLA_IPTUN_LOCAL]), -- RTA_DATA(tb[IFLA_IPTUN_LOCAL]))); -+ rt_addr_n2a_rta(AF_INET6, tb[IFLA_IPTUN_LOCAL])); - } - - if (tb[IFLA_IPTUN_LINK] && rta_getattr_u32(tb[IFLA_IPTUN_LINK])) { -diff --git a/tc/f_flower.c b/tc/f_flower.c -index 5e2dc0d..f0d146f 100644 ---- a/tc/f_flower.c -+++ b/tc/f_flower.c -@@ -415,16 +415,12 @@ static void flower_print_ip_addr(FILE *f, char *name, __be16 eth_type, - } - if (!addr_attr || RTA_PAYLOAD(addr_attr) != len) - return; -- fprintf(f, "\n %s %s", name, rt_addr_n2a(family, -- RTA_PAYLOAD(addr_attr), -- RTA_DATA(addr_attr))); -+ fprintf(f, "\n %s %s", name, rt_addr_n2a_rta(family, addr_attr)); - if (!mask_attr || RTA_PAYLOAD(mask_attr) != len) - return; - bits = __mask_bits(RTA_DATA(mask_attr), len); - if (bits < 0) -- fprintf(f, "/%s", rt_addr_n2a(family, -- RTA_PAYLOAD(mask_attr), -- RTA_DATA(mask_attr))); -+ fprintf(f, "/%s", rt_addr_n2a_rta(family, mask_attr)); - else if (bits < len * 8) - fprintf(f, "/%d", bits); - } --- -1.8.3.1 - diff --git a/SOURCES/0107-utils-add-get_be-16-32-64-use-them-where-possible.patch b/SOURCES/0107-utils-add-get_be-16-32-64-use-them-where-possible.patch deleted file mode 100644 index d5d24d8..0000000 --- a/SOURCES/0107-utils-add-get_be-16-32-64-use-them-where-possible.patch +++ /dev/null @@ -1,43 +0,0 @@ -From cd5fd1c1b943da08c683ee9bc22eed32624d2130 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 13:21:10 +0100 -Subject: [PATCH] utils: add get_be{16, 32, 64}, use them where possible - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629 -Upstream Status: iproute2.git commit 9f7401fa49671 -Conflicts: Just reapplying an already backported commit to get formerly - left out chunks in flower sources. - -commit 9f7401fa4967178a071c53498f6bdc460c7cc4ea -Author: Sabrina Dubroca -Date: Fri Jun 3 16:45:46 2016 +0200 - - utils: add get_be{16, 32, 64}, use them where possible - - Signed-off-by: Sabrina Dubroca - Acked-by: Phil Sutter ---- - tc/f_flower.c | 4 ++-- - 2 files changed, 6 insertions(+), 6 deletions(-) - -diff --git a/tc/f_flower.c b/tc/f_flower.c -index f0d146f..11e6242 100644 ---- a/tc/f_flower.c -+++ b/tc/f_flower.c -@@ -150,11 +150,11 @@ static int flower_parse_port(char *str, __u8 ip_port, - return -1; - } - -- ret = get_u16(&port, str, 10); -+ ret = get_be16(&port, str, 10); - if (ret) - return -1; - -- addattr16(n, MAX_MSG, type, htons(port)); -+ addattr16(n, MAX_MSG, type, port); - - return 0; - } --- -1.8.3.1 - diff --git a/SOURCES/0108-tc-flower-Add-skip_-hw-sw-support.patch b/SOURCES/0108-tc-flower-Add-skip_-hw-sw-support.patch deleted file mode 100644 index 72c009f..0000000 --- a/SOURCES/0108-tc-flower-Add-skip_-hw-sw-support.patch +++ /dev/null @@ -1,134 +0,0 @@ -From 080a2a99ff48cb30a5efb105dba3d1040dac6e21 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 13:21:33 +0100 -Subject: [PATCH] tc: flower: Add skip_{hw|sw} support - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629 -Upstream Status: iproute2.git commit cfcabf18d84a2 - -commit cfcabf18d84a2f4908cb5b4489f67c2cd3f70426 -Author: Amir Vadai -Date: Mon Jul 4 10:34:11 2016 +0300 - - tc: flower: Add skip_{hw|sw} support - - On devices that support TC flower offloads, these flags enable a filter to be - added only to HW or only to SW. skip_sw and skip_hw are mutually exclusive - flags. By default without any flags, the filter is added to both HW and SW, - but no error checks are done in case of failure to add to HW. - With skip-sw, failure to add to HW is treated as an error. - - Here is a sample script that adds 2 filters, one with skip_sw and the other - with skip_hw flag. - - # add ingress qdisc - tc qdisc add dev enp0s9 ingress - - # enable hw tc offload. - ethtool -K enp0s9 hw-tc-offload on - - # add a flower filter with skip-sw flag. - tc filter add dev enp0s9 protocol ip parent ffff: flower \ - ip_proto 1 indev enp0s9 skip_sw \ - action drop - - # add a flower filter with skip-hw flag. - tc filter add dev enp0s9 protocol ip parent ffff: flower \ - ip_proto 3 indev enp0s9 skip_hw \ - action drop - - Signed-off-by: Amir Vadai - Acked-by: Jiri Pirko ---- - man/man8/tc-flower.8 | 11 ++++++++++- - tc/f_flower.c | 17 +++++++++++++++++ - 2 files changed, 27 insertions(+), 1 deletion(-) - -diff --git a/man/man8/tc-flower.8 b/man/man8/tc-flower.8 -index df4d8e1..9ae10e6 100644 ---- a/man/man8/tc-flower.8 -+++ b/man/man8/tc-flower.8 -@@ -18,7 +18,9 @@ flower \- flow based traffic control filter - .ti -8 - .IR MATCH " := { " - .B indev --.IR ifname " | { " -+.IR ifname " | " -+.BR skip_sw " | " skip_hw -+.R " | { " - .BR dst_mac " | " src_mac " } " - .IR mac_address " | " - .BR eth_type " { " ipv4 " | " ipv6 " | " -@@ -55,6 +57,13 @@ is the name of an interface which must exist at the time of - .B tc - invocation. - .TP -+.BI skip_sw -+Do not process filter by software. If hardware has no offload support for this -+filter, or TC offload is not enabled for the interface, operation will fail. -+.TP -+.BI skip_hw -+Do not process filter by hardware. -+.TP - .BI dst_mac " mac_address" - .TQ - .BI src_mac " mac_address" -diff --git a/tc/f_flower.c b/tc/f_flower.c -index 11e6242..01527c8 100644 ---- a/tc/f_flower.c -+++ b/tc/f_flower.c -@@ -25,6 +25,7 @@ - static void explain(void) - { - fprintf(stderr, "Usage: ... flower [ MATCH-LIST ]\n"); -+ fprintf(stderr, " [ skip_sw | skip_hw ]\n"); - fprintf(stderr, " [ action ACTION-SPEC ] [ classid CLASSID ]\n"); - fprintf(stderr, "\n"); - fprintf(stderr, "Where: MATCH-LIST := [ MATCH-LIST ] MATCH\n"); -@@ -167,6 +168,7 @@ static int flower_parse_opt(struct filter_util *qu, char *handle, - struct rtattr *tail; - __be16 eth_type = TC_H_MIN(t->tcm_info); - __u8 ip_proto = 0xff; -+ __u32 flags = 0; - - if (handle) { - ret = get_u32(&t->tcm_handle, handle, 0); -@@ -196,6 +198,10 @@ static int flower_parse_opt(struct filter_util *qu, char *handle, - return -1; - } - addattr_l(n, MAX_MSG, TCA_FLOWER_CLASSID, &handle, 4); -+ } else if (matches(*argv, "skip_hw") == 0) { -+ flags |= TCA_CLS_FLAGS_SKIP_HW; -+ } else if (matches(*argv, "skip_sw") == 0) { -+ flags |= TCA_CLS_FLAGS_SKIP_SW; - } else if (matches(*argv, "indev") == 0) { - char ifname[IFNAMSIZ]; - -@@ -294,6 +300,8 @@ static int flower_parse_opt(struct filter_util *qu, char *handle, - } - - parse_done: -+ addattr32(n, MAX_MSG, TCA_FLOWER_FLAGS, flags); -+ - ret = addattr16(n, MAX_MSG, TCA_FLOWER_KEY_ETH_TYPE, eth_type); - if (ret) { - fprintf(stderr, "Illegal \"eth_type\"(0x%x)\n", -@@ -498,6 +506,15 @@ static int flower_print_opt(struct filter_util *qu, FILE *f, - tb[TCA_FLOWER_KEY_TCP_SRC], - tb[TCA_FLOWER_KEY_UDP_SRC]); - -+ if (tb[TCA_FLOWER_FLAGS]) { -+ __u32 flags = rta_getattr_u32(tb[TCA_FLOWER_FLAGS]); -+ -+ if (flags & TCA_CLS_FLAGS_SKIP_HW) -+ fprintf(f, "\n skip_hw"); -+ if (flags & TCA_CLS_FLAGS_SKIP_SW) -+ fprintf(f, "\n skip_sw"); -+ } -+ - if (tb[TCA_FLOWER_ACT]) { - tc_print_action(f, tb[TCA_FLOWER_ACT]); - } --- -1.8.3.1 - diff --git a/SOURCES/0109-tc-flower-Introduce-vlan-support.patch b/SOURCES/0109-tc-flower-Introduce-vlan-support.patch deleted file mode 100644 index 05c8075..0000000 --- a/SOURCES/0109-tc-flower-Introduce-vlan-support.patch +++ /dev/null @@ -1,230 +0,0 @@ -From 54549fa07c9ad748ffa9ecf6865c12641cd71329 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 13:21:33 +0100 -Subject: [PATCH] tc: flower: Introduce vlan support - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629 -Upstream Status: iproute2.git commit 745d91726006f -Conflicts: Context changes due to missing commit 32a121cba2579 - ("tc: code cleanup"). - -commit 745d91726006fcaa9006f491f9a596c4025cecf7 -Author: Hadar Hen Zion -Date: Thu Sep 1 09:45:47 2016 +0300 - - tc: flower: Introduce vlan support - - Classification according to vlan id and vlan priority. - - Example script that adds vlan filter: - - # add ingress qdisc - tc qdisc add dev ens4f0 ingress - - # add a flower filter with vlan id and priority classification - tc filter add dev ens4f0 protocol 802.1Q parent ffff: \ - flower \ - indev ens4f0 \ - vlan_ethtype ipv4 \ - vlan_id 100 \ - vlan_prio 3 \ - action vlan pop - - Signed-off-by: Hadar Hen Zion - Acked-by: Jiri Pirko ---- - man/man8/tc-flower.8 | 25 ++++++++++++++++- - tc/f_flower.c | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++-- - 2 files changed, 99 insertions(+), 4 deletions(-) - -diff --git a/man/man8/tc-flower.8 b/man/man8/tc-flower.8 -index 9ae10e6..74f7664 100644 ---- a/man/man8/tc-flower.8 -+++ b/man/man8/tc-flower.8 -@@ -23,7 +23,13 @@ flower \- flow based traffic control filter - .R " | { " - .BR dst_mac " | " src_mac " } " - .IR mac_address " | " --.BR eth_type " { " ipv4 " | " ipv6 " | " -+.BR eth_type " { " ipv4 " | " ipv6 " | " 802.1Q " | " -+.IR ETH_TYPE " } | " -+.B vlan_id -+.IR VID " | " -+.B vlan_prio -+.IR PRIORITY " | " -+.BR vlan_eth_type " { " ipv4 " | " ipv6 " | " - .IR ETH_TYPE " } | " - .BR ip_proto " { " tcp " | " udp " | " - .IR IP_PROTO " } | { " -@@ -70,6 +76,23 @@ Do not process filter by hardware. - Match on source or destination MAC address. - .TP - .BI eth_type " ETH_TYPE" -+Match on the next protocol. -+.I ETH_TYPE -+may be either -+.BR ipv4 , ipv6 , 802.1Q , -+or an unsigned 16bit value in hexadecimal format. -+.TP -+.BI vlan_id " VID" -+Match on vlan tag id. -+.I VID -+is an unsigned 12bit value in decimal format. -+.TP -+.BI vlan_prio " priority" -+Match on vlan tag priority. -+.I PRIORITY -+is an unsigned 3bit value in decimal format. -+.TP -+.BI vlan_eth_type " VLAN_ETH_TYPE" - Match on layer three protocol. - .I ETH_TYPE - may be either -diff --git a/tc/f_flower.c b/tc/f_flower.c -index 01527c8..dec7d9d 100644 ---- a/tc/f_flower.c -+++ b/tc/f_flower.c -@@ -17,6 +17,7 @@ - #include - #include - #include -+#include - - #include "utils.h" - #include "tc_util.h" -@@ -30,6 +31,9 @@ static void explain(void) - fprintf(stderr, "\n"); - fprintf(stderr, "Where: MATCH-LIST := [ MATCH-LIST ] MATCH\n"); - fprintf(stderr, " MATCH := { indev DEV-NAME | \n"); -+ fprintf(stderr, " vlan_id VID |\n"); -+ fprintf(stderr, " vlan_prio PRIORITY |\n"); -+ fprintf(stderr, " vlan_ethtype [ ipv4 | ipv6 | ETH-TYPE ] |\n"); - fprintf(stderr, " dst_mac MAC-ADDR | \n"); - fprintf(stderr, " src_mac MAC-ADDR | \n"); - fprintf(stderr, " [ipv4 | ipv6 ] | \n"); -@@ -61,6 +65,23 @@ static int flower_parse_eth_addr(char *str, int addr_type, int mask_type, - return 0; - } - -+static int flower_parse_vlan_eth_type(char *str, __be16 eth_type, int type, -+ __be16 *p_vlan_eth_type, struct nlmsghdr *n) -+{ -+ __be16 vlan_eth_type; -+ -+ if (eth_type != htons(ETH_P_8021Q)) { -+ fprintf(stderr, "Can't set \"vlan_ethtype\" if ethertype isn't 802.1Q\n"); -+ return -1; -+ } -+ -+ if (ll_proto_a2n(&vlan_eth_type, str)) -+ invarg("invalid vlan_ethtype", str); -+ addattr16(n, MAX_MSG, type, vlan_eth_type); -+ *p_vlan_eth_type = vlan_eth_type; -+ return 0; -+} -+ - static int flower_parse_ip_proto(char *str, __be16 eth_type, int type, - __u8 *p_ip_proto, struct nlmsghdr *n) - { -@@ -167,6 +188,7 @@ static int flower_parse_opt(struct filter_util *qu, char *handle, - struct tcmsg *t = NLMSG_DATA(n); - struct rtattr *tail; - __be16 eth_type = TC_H_MIN(t->tcm_info); -+ __be16 vlan_ethtype = 0; - __u8 ip_proto = 0xff; - __u32 flags = 0; - -@@ -209,6 +231,41 @@ static int flower_parse_opt(struct filter_util *qu, char *handle, - memset(ifname, 0, sizeof(ifname)); - strncpy(ifname, *argv, sizeof(ifname) - 1); - addattrstrz(n, MAX_MSG, TCA_FLOWER_INDEV, ifname); -+ } else if (matches(*argv, "vlan_id") == 0) { -+ __u16 vid; -+ -+ NEXT_ARG(); -+ if (eth_type != htons(ETH_P_8021Q)) { -+ fprintf(stderr, "Can't set \"vlan_id\" if ethertype isn't 802.1Q\n"); -+ return -1; -+ } -+ ret = get_u16(&vid, *argv, 10); -+ if (ret < 0 || vid & ~0xfff) { -+ fprintf(stderr, "Illegal \"vlan_id\"\n"); -+ return -1; -+ } -+ addattr16(n, MAX_MSG, TCA_FLOWER_KEY_VLAN_ID, vid); -+ } else if (matches(*argv, "vlan_prio") == 0) { -+ __u8 vlan_prio; -+ -+ NEXT_ARG(); -+ if (eth_type != htons(ETH_P_8021Q)) { -+ fprintf(stderr, "Can't set \"vlan_prio\" if ethertype isn't 802.1Q\n"); -+ return -1; -+ } -+ ret = get_u8(&vlan_prio, *argv, 10); -+ if (ret < 0 || vlan_prio & ~0x7) { -+ fprintf(stderr, "Illegal \"vlan_prio\"\n"); -+ return -1; -+ } -+ addattr8(n, MAX_MSG, TCA_FLOWER_KEY_VLAN_PRIO, vlan_prio); -+ } else if (matches(*argv, "vlan_ethtype") == 0) { -+ NEXT_ARG(); -+ ret = flower_parse_vlan_eth_type(*argv, eth_type, -+ TCA_FLOWER_KEY_VLAN_ETH_TYPE, -+ &vlan_ethtype, n); -+ if (ret < 0) -+ return -1; - } else if (matches(*argv, "dst_mac") == 0) { - NEXT_ARG(); - ret = flower_parse_eth_addr(*argv, -@@ -231,7 +288,8 @@ static int flower_parse_opt(struct filter_util *qu, char *handle, - } - } else if (matches(*argv, "ip_proto") == 0) { - NEXT_ARG(); -- ret = flower_parse_ip_proto(*argv, eth_type, -+ ret = flower_parse_ip_proto(*argv, vlan_ethtype ? -+ vlan_ethtype : eth_type, - TCA_FLOWER_KEY_IP_PROTO, - &ip_proto, n); - if (ret < 0) { -@@ -240,7 +298,8 @@ static int flower_parse_opt(struct filter_util *qu, char *handle, - } - } else if (matches(*argv, "dst_ip") == 0) { - NEXT_ARG(); -- ret = flower_parse_ip_addr(*argv, eth_type, -+ ret = flower_parse_ip_addr(*argv, vlan_ethtype ? -+ vlan_ethtype : eth_type, - TCA_FLOWER_KEY_IPV4_DST, - TCA_FLOWER_KEY_IPV4_DST_MASK, - TCA_FLOWER_KEY_IPV6_DST, -@@ -252,7 +311,8 @@ static int flower_parse_opt(struct filter_util *qu, char *handle, - } - } else if (matches(*argv, "src_ip") == 0) { - NEXT_ARG(); -- ret = flower_parse_ip_addr(*argv, eth_type, -+ ret = flower_parse_ip_addr(*argv, vlan_ethtype ? -+ vlan_ethtype : eth_type, - TCA_FLOWER_KEY_IPV4_SRC, - TCA_FLOWER_KEY_IPV4_SRC_MASK, - TCA_FLOWER_KEY_IPV6_SRC, -@@ -478,6 +538,18 @@ static int flower_print_opt(struct filter_util *qu, FILE *f, - fprintf(f, "\n indev %s", rta_getattr_str(attr)); - } - -+ if (tb[TCA_FLOWER_KEY_VLAN_ID]) { -+ struct rtattr *attr = tb[TCA_FLOWER_KEY_VLAN_ID]; -+ -+ fprintf(f, "\n vlan_id %d", rta_getattr_u16(attr)); -+ } -+ -+ if (tb[TCA_FLOWER_KEY_VLAN_PRIO]) { -+ struct rtattr *attr = tb[TCA_FLOWER_KEY_VLAN_PRIO]; -+ -+ fprintf(f, "\n vlan_prio %d", rta_getattr_u8(attr)); -+ } -+ - flower_print_eth_addr(f, "dst_mac", tb[TCA_FLOWER_KEY_ETH_DST], - tb[TCA_FLOWER_KEY_ETH_DST_MASK]); - flower_print_eth_addr(f, "src_mac", tb[TCA_FLOWER_KEY_ETH_SRC], --- -1.8.3.1 - diff --git a/SOURCES/0110-tc-flower-checkpatch-cleanups.patch b/SOURCES/0110-tc-flower-checkpatch-cleanups.patch deleted file mode 100644 index 9f3023c..0000000 --- a/SOURCES/0110-tc-flower-checkpatch-cleanups.patch +++ /dev/null @@ -1,155 +0,0 @@ -From a3ad974e186f36ac599e99ad324ae1790f6fdf4a Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 13:22:19 +0100 -Subject: [PATCH] tc: flower checkpatch cleanups - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629 -Upstream Status: iproute2.git commit 512caeb2737f1 -Conflicts: Whitespace changes in removed code. - -commit 512caeb2737f1657d941945cc770a95882e1c1bb -Author: Stephen Hemminger -Date: Tue Nov 29 11:48:52 2016 -0800 - - tc: flower checkpatch cleanups - - break long lines and minor whitespace changes. ---- - tc/f_flower.c | 71 ++++++++++++++++++++++++++++++++--------------------------- - 1 file changed, 38 insertions(+), 33 deletions(-) - -diff --git a/tc/f_flower.c b/tc/f_flower.c -index dec7d9d..874a7bd 100644 ---- a/tc/f_flower.c -+++ b/tc/f_flower.c -@@ -25,29 +25,30 @@ - - static void explain(void) - { -- fprintf(stderr, "Usage: ... flower [ MATCH-LIST ]\n"); -- fprintf(stderr, " [ skip_sw | skip_hw ]\n"); -- fprintf(stderr, " [ action ACTION-SPEC ] [ classid CLASSID ]\n"); -- fprintf(stderr, "\n"); -- fprintf(stderr, "Where: MATCH-LIST := [ MATCH-LIST ] MATCH\n"); -- fprintf(stderr, " MATCH := { indev DEV-NAME | \n"); -- fprintf(stderr, " vlan_id VID |\n"); -- fprintf(stderr, " vlan_prio PRIORITY |\n"); -- fprintf(stderr, " vlan_ethtype [ ipv4 | ipv6 | ETH-TYPE ] |\n"); -- fprintf(stderr, " dst_mac MAC-ADDR | \n"); -- fprintf(stderr, " src_mac MAC-ADDR | \n"); -- fprintf(stderr, " [ipv4 | ipv6 ] | \n"); -- fprintf(stderr, " ip_proto [tcp | udp | IP-PROTO ] | \n"); -- fprintf(stderr, " dst_ip [ IPV4-ADDR | IPV6-ADDR ] | \n"); -- fprintf(stderr, " src_ip [ IPV4-ADDR | IPV6-ADDR ] | \n"); -- fprintf(stderr, " dst_port PORT-NUMBER | \n"); -- fprintf(stderr, " src_port PORT-NUMBER }\n"); -- fprintf(stderr, " FILTERID := X:Y:Z\n"); -- fprintf(stderr, " ACTION-SPEC := ... look at individual actions\n"); -- fprintf(stderr, "\n"); -- fprintf(stderr, "NOTE: CLASSID, ETH-TYPE, IP-PROTO are parsed as hexadecimal input.\n"); -- fprintf(stderr, "NOTE: There can be only used one mask per one prio. If user needs\n"); -- fprintf(stderr, " to specify different mask, he has to use different prio.\n"); -+ fprintf(stderr, -+ "Usage: ... flower [ MATCH-LIST ]\n" -+ " [ skip_sw | skip_hw ]\n" -+ " [ action ACTION-SPEC ] [ classid CLASSID ]\n" -+ "\n" -+ "Where: MATCH-LIST := [ MATCH-LIST ] MATCH\n" -+ " MATCH := { indev DEV-NAME |\n" -+ " vlan_id VID |\n" -+ " vlan_prio PRIORITY |\n" -+ " vlan_ethtype [ ipv4 | ipv6 | ETH-TYPE ] |\n" -+ " dst_mac MAC-ADDR |\n" -+ " src_mac MAC-ADDR |\n" -+ " [ipv4 | ipv6 ] |\n" -+ " ip_proto [tcp | udp | IP-PROTO ] |\n" -+ " dst_ip [ IPV4-ADDR | IPV6-ADDR ] |\n" -+ " src_ip [ IPV4-ADDR | IPV6-ADDR ] |\n" -+ " dst_port PORT-NUMBER |\n" -+ " src_port PORT-NUMBER }\n" -+ " FILTERID := X:Y:Z\n" -+ " ACTION-SPEC := ... look at individual actions\n" -+ "\n" -+ "NOTE: CLASSID, ETH-TYPE, IP-PROTO are parsed as hexadecimal input.\n" -+ "NOTE: There can be only used one mask per one prio. If user needs\n" -+ " to specify different mask, he has to use different prio.\n"); - } - - static int flower_parse_eth_addr(char *str, int addr_type, int mask_type, -@@ -66,12 +67,14 @@ static int flower_parse_eth_addr(char *str, int addr_type, int mask_type, - } - - static int flower_parse_vlan_eth_type(char *str, __be16 eth_type, int type, -- __be16 *p_vlan_eth_type, struct nlmsghdr *n) -+ __be16 *p_vlan_eth_type, -+ struct nlmsghdr *n) - { - __be16 vlan_eth_type; - - if (eth_type != htons(ETH_P_8021Q)) { -- fprintf(stderr, "Can't set \"vlan_ethtype\" if ethertype isn't 802.1Q\n"); -+ fprintf(stderr, -+ "Can't set \"vlan_ethtype\" if ethertype isn't 802.1Q\n"); - return -1; - } - -@@ -236,7 +239,8 @@ static int flower_parse_opt(struct filter_util *qu, char *handle, - - NEXT_ARG(); - if (eth_type != htons(ETH_P_8021Q)) { -- fprintf(stderr, "Can't set \"vlan_id\" if ethertype isn't 802.1Q\n"); -+ fprintf(stderr, -+ "Can't set \"vlan_id\" if ethertype isn't 802.1Q\n"); - return -1; - } - ret = get_u16(&vid, *argv, 10); -@@ -250,7 +254,8 @@ static int flower_parse_opt(struct filter_util *qu, char *handle, - - NEXT_ARG(); - if (eth_type != htons(ETH_P_8021Q)) { -- fprintf(stderr, "Can't set \"vlan_prio\" if ethertype isn't 802.1Q\n"); -+ fprintf(stderr, -+ "Can't set \"vlan_prio\" if ethertype isn't 802.1Q\n"); - return -1; - } - ret = get_u8(&vlan_prio, *argv, 10); -@@ -258,12 +263,13 @@ static int flower_parse_opt(struct filter_util *qu, char *handle, - fprintf(stderr, "Illegal \"vlan_prio\"\n"); - return -1; - } -- addattr8(n, MAX_MSG, TCA_FLOWER_KEY_VLAN_PRIO, vlan_prio); -+ addattr8(n, MAX_MSG, -+ TCA_FLOWER_KEY_VLAN_PRIO, vlan_prio); - } else if (matches(*argv, "vlan_ethtype") == 0) { - NEXT_ARG(); - ret = flower_parse_vlan_eth_type(*argv, eth_type, -- TCA_FLOWER_KEY_VLAN_ETH_TYPE, -- &vlan_ethtype, n); -+ TCA_FLOWER_KEY_VLAN_ETH_TYPE, -+ &vlan_ethtype, n); - if (ret < 0) - return -1; - } else if (matches(*argv, "dst_mac") == 0) { -@@ -578,7 +584,7 @@ static int flower_print_opt(struct filter_util *qu, FILE *f, - tb[TCA_FLOWER_KEY_TCP_SRC], - tb[TCA_FLOWER_KEY_UDP_SRC]); - -- if (tb[TCA_FLOWER_FLAGS]) { -+ if (tb[TCA_FLOWER_FLAGS]) { - __u32 flags = rta_getattr_u32(tb[TCA_FLOWER_FLAGS]); - - if (flags & TCA_CLS_FLAGS_SKIP_HW) -@@ -587,9 +593,8 @@ static int flower_print_opt(struct filter_util *qu, FILE *f, - fprintf(f, "\n skip_sw"); - } - -- if (tb[TCA_FLOWER_ACT]) { -+ if (tb[TCA_FLOWER_ACT]) - tc_print_action(f, tb[TCA_FLOWER_ACT]); -- } - - return 0; - } --- -1.8.3.1 - diff --git a/SOURCES/0111-tc-flower-Fix-usage-message.patch b/SOURCES/0111-tc-flower-Fix-usage-message.patch deleted file mode 100644 index 1a2b2bf..0000000 --- a/SOURCES/0111-tc-flower-Fix-usage-message.patch +++ /dev/null @@ -1,78 +0,0 @@ -From 7bc7e80a81a32170cf1c24e6fb667d75ac6d55c7 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 13:22:39 +0100 -Subject: [PATCH] tc: flower: Fix usage message - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629 -Upstream Status: iproute2.git commit d9c3995ab7ce7 -Conflicts: Changes to flower help text applied manually as per upstream - merge commit 328374dcfea96 ("Merge branch 'master' into - net-next"). - -commit d9c3995ab7ce7fb523d50ca513283393066219ca -Author: Paul Blakey -Date: Wed Nov 2 17:09:58 2016 +0200 - - tc: flower: Fix usage message - - Remove left over usage from removal of eth_type argument. - - Fixes: 488b41d020fb ('tc: flower no need to specify the ethertype') - Signed-off-by: Paul Blakey - Reviewed-by: Simon Horman ---- - man/man8/tc-flower.8 | 9 --------- - tc/f_flower.c | 3 +-- - 2 files changed, 1 insertion(+), 11 deletions(-) - -diff --git a/man/man8/tc-flower.8 b/man/man8/tc-flower.8 -index 74f7664..16ef261 100644 ---- a/man/man8/tc-flower.8 -+++ b/man/man8/tc-flower.8 -@@ -23,8 +23,6 @@ flower \- flow based traffic control filter - .R " | { " - .BR dst_mac " | " src_mac " } " - .IR mac_address " | " --.BR eth_type " { " ipv4 " | " ipv6 " | " 802.1Q " | " --.IR ETH_TYPE " } | " - .B vlan_id - .IR VID " | " - .B vlan_prio -@@ -75,13 +73,6 @@ Do not process filter by hardware. - .BI src_mac " mac_address" - Match on source or destination MAC address. - .TP --.BI eth_type " ETH_TYPE" --Match on the next protocol. --.I ETH_TYPE --may be either --.BR ipv4 , ipv6 , 802.1Q , --or an unsigned 16bit value in hexadecimal format. --.TP - .BI vlan_id " VID" - Match on vlan tag id. - .I VID -diff --git a/tc/f_flower.c b/tc/f_flower.c -index 874a7bd..6c9bea6 100644 ---- a/tc/f_flower.c -+++ b/tc/f_flower.c -@@ -37,7 +37,6 @@ static void explain(void) - " vlan_ethtype [ ipv4 | ipv6 | ETH-TYPE ] |\n" - " dst_mac MAC-ADDR |\n" - " src_mac MAC-ADDR |\n" -- " [ipv4 | ipv6 ] |\n" - " ip_proto [tcp | udp | IP-PROTO ] |\n" - " dst_ip [ IPV4-ADDR | IPV6-ADDR ] |\n" - " src_ip [ IPV4-ADDR | IPV6-ADDR ] |\n" -@@ -46,7 +45,7 @@ static void explain(void) - " FILTERID := X:Y:Z\n" - " ACTION-SPEC := ... look at individual actions\n" - "\n" -- "NOTE: CLASSID, ETH-TYPE, IP-PROTO are parsed as hexadecimal input.\n" -+ "NOTE: CLASSID, IP-PROTO are parsed as hexadecimal input.\n" - "NOTE: There can be only used one mask per one prio. If user needs\n" - " to specify different mask, he has to use different prio.\n"); - } --- -1.8.3.1 - diff --git a/SOURCES/0112-tc-flower-Support-matching-on-SCTP-ports.patch b/SOURCES/0112-tc-flower-Support-matching-on-SCTP-ports.patch deleted file mode 100644 index 43c45da..0000000 --- a/SOURCES/0112-tc-flower-Support-matching-on-SCTP-ports.patch +++ /dev/null @@ -1,158 +0,0 @@ -From 9c00f1da75c407be7638e5dc84ce02448f3832cd Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 13:23:10 +0100 -Subject: [PATCH] tc: flower: Support matching on SCTP ports - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629 -Upstream Status: iproute2.git commit a1fb0d484237b - -commit a1fb0d484237b41f92ee17634880be80a0dcf51a -Author: Simon Horman -Date: Thu Nov 3 13:26:41 2016 +0100 - - tc: flower: Support matching on SCTP ports - - Support matching on SCTP ports in the same way that matching - on TCP and UDP ports is already supported. - - Example usage: - - tc qdisc add dev eth0 ingress - - tc filter add dev eth0 protocol ip parent ffff: \ - flower indev eth0 ip_proto sctp dst_port 80 \ - action drop - - Signed-off-by: Simon Horman ---- - tc/f_flower.c | 65 ++++++++++++++++++++++++++++------------------------------- - 1 file changed, 31 insertions(+), 34 deletions(-) - -diff --git a/tc/f_flower.c b/tc/f_flower.c -index 6c9bea6..805e841 100644 ---- a/tc/f_flower.c -+++ b/tc/f_flower.c -@@ -98,6 +98,8 @@ static int flower_parse_ip_proto(char *str, __be16 eth_type, int type, - ip_proto = IPPROTO_TCP; - } else if (matches(str, "udp") == 0) { - ip_proto = IPPROTO_UDP; -+ } else if (matches(str, "sctp") == 0) { -+ ip_proto = IPPROTO_SCTP; - } else { - ret = get_u8(&ip_proto, str, 16); - if (ret) -@@ -158,21 +160,33 @@ static int flower_parse_ip_addr(char *str, __be16 eth_type, - return 0; - } - --static int flower_parse_port(char *str, __u8 ip_port, -- int tcp_type, int udp_type, struct nlmsghdr *n) -+static int flower_port_attr_type(__u8 ip_port, bool is_src) - { -- int ret; -- int type; -- __be16 port; -- - if (ip_port == IPPROTO_TCP) { -- type = tcp_type; -+ return is_src ? TCA_FLOWER_KEY_TCP_SRC : -+ TCA_FLOWER_KEY_TCP_DST; - } else if (ip_port == IPPROTO_UDP) { -- type = udp_type; -+ return is_src ? TCA_FLOWER_KEY_UDP_SRC : -+ TCA_FLOWER_KEY_UDP_DST; -+ } else if (ip_port == IPPROTO_SCTP) { -+ return is_src ? TCA_FLOWER_KEY_SCTP_SRC : -+ TCA_FLOWER_KEY_SCTP_DST; - } else { - fprintf(stderr, "Illegal \"ip_proto\" for port\n"); - return -1; - } -+} -+ -+static int flower_parse_port(char *str, __u8 ip_port, bool is_src, -+ struct nlmsghdr *n) -+{ -+ int ret; -+ int type; -+ __be16 port; -+ -+ type = flower_port_attr_type(ip_port, is_src); -+ if (type < 0) -+ return -1; - - ret = get_be16(&port, str, 10); - if (ret) -@@ -329,18 +343,14 @@ static int flower_parse_opt(struct filter_util *qu, char *handle, - } - } else if (matches(*argv, "dst_port") == 0) { - NEXT_ARG(); -- ret = flower_parse_port(*argv, ip_proto, -- TCA_FLOWER_KEY_TCP_DST, -- TCA_FLOWER_KEY_UDP_DST, n); -+ ret = flower_parse_port(*argv, ip_proto, false, n); - if (ret < 0) { - fprintf(stderr, "Illegal \"dst_port\"\n"); - return -1; - } - } else if (matches(*argv, "src_port") == 0) { - NEXT_ARG(); -- ret = flower_parse_port(*argv, ip_proto, -- TCA_FLOWER_KEY_TCP_SRC, -- TCA_FLOWER_KEY_UDP_SRC, n); -+ ret = flower_parse_port(*argv, ip_proto, true, n); - if (ret < 0) { - fprintf(stderr, "Illegal \"src_port\"\n"); - return -1; -@@ -456,6 +466,8 @@ static void flower_print_ip_proto(FILE *f, __u8 *p_ip_proto, - fprintf(f, "tcp"); - else if (ip_proto == IPPROTO_UDP) - fprintf(f, "udp"); -+ else if (ip_proto == IPPROTO_SCTP) -+ fprintf(f, "sctp"); - else - fprintf(f, "%02x", ip_proto); - *p_ip_proto = ip_proto; -@@ -498,20 +510,8 @@ static void flower_print_ip_addr(FILE *f, char *name, __be16 eth_type, - fprintf(f, "/%d", bits); - } - --static void flower_print_port(FILE *f, char *name, __u8 ip_proto, -- struct rtattr *tcp_attr, -- struct rtattr *udp_attr) -+static void flower_print_port(FILE *f, char *name, struct rtattr *attr) - { -- struct rtattr *attr; -- -- if (ip_proto == IPPROTO_TCP) -- attr = tcp_attr; -- else if (ip_proto == IPPROTO_UDP) -- attr = udp_attr; -- else -- return; -- if (!attr) -- return; - fprintf(f, "\n %s %d", name, ntohs(rta_getattr_u16(attr))); - } - -@@ -575,13 +575,10 @@ static int flower_print_opt(struct filter_util *qu, FILE *f, - tb[TCA_FLOWER_KEY_IPV6_SRC], - tb[TCA_FLOWER_KEY_IPV6_SRC_MASK]); - -- flower_print_port(f, "dst_port", ip_proto, -- tb[TCA_FLOWER_KEY_TCP_DST], -- tb[TCA_FLOWER_KEY_UDP_DST]); -- -- flower_print_port(f, "src_port", ip_proto, -- tb[TCA_FLOWER_KEY_TCP_SRC], -- tb[TCA_FLOWER_KEY_UDP_SRC]); -+ flower_print_port(f, "dst_port", -+ tb[flower_port_attr_type(ip_proto, false)]); -+ flower_print_port(f, "src_port", -+ tb[flower_port_attr_type(ip_proto, true)]); - - if (tb[TCA_FLOWER_FLAGS]) { - __u32 flags = rta_getattr_u32(tb[TCA_FLOWER_FLAGS]); --- -1.8.3.1 - diff --git a/SOURCES/0113-libnetlink-Introduce-rta_getattr_be.patch b/SOURCES/0113-libnetlink-Introduce-rta_getattr_be.patch deleted file mode 100644 index 09f8c33..0000000 --- a/SOURCES/0113-libnetlink-Introduce-rta_getattr_be.patch +++ /dev/null @@ -1,114 +0,0 @@ -From e369a7590be342ed32b5fa241dd76f242d0f54ca Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 13:23:10 +0100 -Subject: [PATCH] libnetlink: Introduce rta_getattr_be*() - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629 -Upstream Status: iproute2.git commit aab0f61043098 -Conflicts: Changes to bridge code applied manually due to missing json - output support. - -commit aab0f61043098e1384b5161ba78f583599a87e12 -Author: Amir Vadai -Date: Fri Dec 2 13:25:13 2016 +0200 - - libnetlink: Introduce rta_getattr_be*() - - Add the utility functions rta_getattr_be16() and rta_getattr_be32(), and - change existing code to use it. - - Signed-off-by: Amir Vadai ---- - bridge/fdb.c | 2 +- - include/libnetlink.h | 9 +++++++++ - ip/iplink_geneve.c | 2 +- - ip/iplink_vxlan.c | 2 +- - tc/f_flower.c | 2 +- - 5 files changed, 13 insertions(+), 4 deletions(-) - -diff --git a/bridge/fdb.c b/bridge/fdb.c -index 4b536f9..a1bc45f 100644 ---- a/bridge/fdb.c -+++ b/bridge/fdb.c -@@ -125,7 +125,7 @@ int print_fdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - fprintf(fp, "vlan %hu ", vid); - - if (tb[NDA_PORT]) -- fprintf(fp, "port %d ", ntohs(rta_getattr_u16(tb[NDA_PORT]))); -+ fprintf(fp, "port %d ", rta_getattr_be16(tb[NDA_PORT])); - if (tb[NDA_VNI]) - fprintf(fp, "vni %d ", rta_getattr_u32(tb[NDA_VNI])); - if (tb[NDA_IFINDEX]) { -diff --git a/include/libnetlink.h b/include/libnetlink.h -index 7ea3f4a..9a25ec4 100644 ---- a/include/libnetlink.h -+++ b/include/libnetlink.h -@@ -10,6 +10,7 @@ - #include - #include - #include -+#include - - struct rtnl_handle - { -@@ -131,10 +132,18 @@ static inline __u16 rta_getattr_u16(const struct rtattr *rta) - { - return *(__u16 *)RTA_DATA(rta); - } -+static inline __be16 rta_getattr_be16(const struct rtattr *rta) -+{ -+ return ntohs(rta_getattr_u16(rta)); -+} - static inline __u32 rta_getattr_u32(const struct rtattr *rta) - { - return *(__u32 *)RTA_DATA(rta); - } -+static inline __be32 rta_getattr_be32(const struct rtattr *rta) -+{ -+ return ntohl(rta_getattr_u32(rta)); -+} - static inline __u64 rta_getattr_u64(const struct rtattr *rta) - { - __u64 tmp; -diff --git a/ip/iplink_geneve.c b/ip/iplink_geneve.c -index 2e15a1d..8f130a3 100644 ---- a/ip/iplink_geneve.c -+++ b/ip/iplink_geneve.c -@@ -231,7 +231,7 @@ static void geneve_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - - if (tb[IFLA_GENEVE_PORT]) - fprintf(f, "dstport %u ", -- ntohs(rta_getattr_u16(tb[IFLA_GENEVE_PORT]))); -+ rta_getattr_be16(tb[IFLA_GENEVE_PORT])); - - if (tb[IFLA_GENEVE_COLLECT_METADATA]) - fputs("external ", f); -diff --git a/ip/iplink_vxlan.c b/ip/iplink_vxlan.c -index 6cae35b..bf56864 100644 ---- a/ip/iplink_vxlan.c -+++ b/ip/iplink_vxlan.c -@@ -348,7 +348,7 @@ static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) - - if (tb[IFLA_VXLAN_PORT]) - fprintf(f, "dstport %u ", -- ntohs(rta_getattr_u16(tb[IFLA_VXLAN_PORT]))); -+ rta_getattr_be16(tb[IFLA_VXLAN_PORT])); - - if (tb[IFLA_VXLAN_LEARNING] && - !rta_getattr_u8(tb[IFLA_VXLAN_LEARNING])) -diff --git a/tc/f_flower.c b/tc/f_flower.c -index 805e841..75e64ae 100644 ---- a/tc/f_flower.c -+++ b/tc/f_flower.c -@@ -512,7 +512,7 @@ static void flower_print_ip_addr(FILE *f, char *name, __be16 eth_type, - - static void flower_print_port(FILE *f, char *name, struct rtattr *attr) - { -- fprintf(f, "\n %s %d", name, ntohs(rta_getattr_u16(attr))); -+ fprintf(f, "\n %s %d", name, rta_getattr_be16(attr)); - } - - static int flower_print_opt(struct filter_util *qu, FILE *f, --- -1.8.3.1 - diff --git a/SOURCES/0114-tc-cls_flower-Classify-packet-in-ip-tunnels.patch b/SOURCES/0114-tc-cls_flower-Classify-packet-in-ip-tunnels.patch deleted file mode 100644 index dfc1e18..0000000 --- a/SOURCES/0114-tc-cls_flower-Classify-packet-in-ip-tunnels.patch +++ /dev/null @@ -1,212 +0,0 @@ -From 0263aa84af6519d1dc057329e895275d34a0f595 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 13:23:32 +0100 -Subject: [PATCH] tc/cls_flower: Classify packet in ip tunnels - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629 -Upstream Status: iproute2.git commit bb9b63b18e85f - -commit bb9b63b18e85f17e618469ecb139e78ca5a4a4fc -Author: Amir Vadai -Date: Fri Dec 2 13:25:14 2016 +0200 - - tc/cls_flower: Classify packet in ip tunnels - - Introduce classifying by metadata extracted by the tunnel device. - Outer header fields - source/dest ip and tunnel id, are extracted from - the metadata when classifying. - - For example, the following will add a filter on the ingress Qdisc of shared - vxlan device named 'vxlan0'. To forward packets with outer src ip - 11.11.0.2, dst ip 11.11.0.1 and tunnel id 11. The packets will be - forwarded to tap device 'vnet0': - - $ tc filter add dev vxlan0 protocol ip parent ffff: \ - flower \ - enc_src_ip 11.11.0.2 \ - enc_dst_ip 11.11.0.1 \ - enc_key_id 11 \ - dst_ip 11.11.11.1 \ - action mirred egress redirect dev vnet0 - - Signed-off-by: Amir Vadai ---- - man/man8/tc-flower.8 | 17 ++++++++++- - tc/f_flower.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++-- - 2 files changed, 95 insertions(+), 4 deletions(-) - -diff --git a/man/man8/tc-flower.8 b/man/man8/tc-flower.8 -index 16ef261..dd35649 100644 ---- a/man/man8/tc-flower.8 -+++ b/man/man8/tc-flower.8 -@@ -34,7 +34,11 @@ flower \- flow based traffic control filter - .BR dst_ip " | " src_ip " } { " - .IR ipv4_address " | " ipv6_address " } | { " - .BR dst_port " | " src_port " } " --.IR port_number " }" -+.IR port_number " } | " -+.B enc_key_id -+.IR KEY-ID " | {" -+.BR enc_dst_ip " | " enc_src_ip " } { " -+.IR ipv4_address " | " ipv6_address " } | " - .SH DESCRIPTION - The - .B flower -@@ -112,6 +116,17 @@ which has to be specified in beforehand. - Match on layer 4 protocol source or destination port number. Only available for - .BR ip_proto " values " udp " and " tcp , - which has to be specified in beforehand. -+.TP -+.BI enc_key_id " NUMBER" -+.TQ -+.BI enc_dst_ip " ADDRESS" -+.TQ -+.BI enc_src_ip " ADDRESS" -+Match on IP tunnel metadata. Key id -+.I NUMBER -+is a 32 bit tunnel key id (e.g. VNI for VXLAN tunnel). -+.I ADDRESS -+must be a valid IPv4 or IPv6 address. - .SH NOTES - As stated above where applicable, matches of a certain layer implicitly depend - on the matches of the next lower layer. Precisely, layer one and two matches ( -diff --git a/tc/f_flower.c b/tc/f_flower.c -index 75e64ae..36963c5 100644 ---- a/tc/f_flower.c -+++ b/tc/f_flower.c -@@ -41,7 +41,10 @@ static void explain(void) - " dst_ip [ IPV4-ADDR | IPV6-ADDR ] |\n" - " src_ip [ IPV4-ADDR | IPV6-ADDR ] |\n" - " dst_port PORT-NUMBER |\n" -- " src_port PORT-NUMBER }\n" -+ " src_port PORT-NUMBER |\n" -+ " enc_dst_ip [ IPV4-ADDR | IPV6-ADDR ] |\n" -+ " enc_src_ip [ IPV4-ADDR | IPV6-ADDR ] |\n" -+ " enc_key_id [ KEY-ID ] }\n" - " FILTERID := X:Y:Z\n" - " ACTION-SPEC := ... look at individual actions\n" - "\n" -@@ -125,8 +128,9 @@ static int flower_parse_ip_addr(char *str, __be16 eth_type, - family = AF_INET; - } else if (eth_type == htons(ETH_P_IPV6)) { - family = AF_INET6; -+ } else if (!eth_type) { -+ family = AF_UNSPEC; - } else { -- fprintf(stderr, "Illegal \"eth_type\" for ip address\n"); - return -1; - } - -@@ -134,8 +138,10 @@ static int flower_parse_ip_addr(char *str, __be16 eth_type, - if (ret) - return -1; - -- if (addr.family != family) -+ if (family && (addr.family != family)) { -+ fprintf(stderr, "Illegal \"eth_type\" for ip address\n"); - return -1; -+ } - - addattr_l(n, MAX_MSG, addr.family == AF_INET ? addr4_type : addr6_type, - addr.data, addr.bytelen); -@@ -197,6 +203,18 @@ static int flower_parse_port(char *str, __u8 ip_port, bool is_src, - return 0; - } - -+static int flower_parse_key_id(const char *str, int type, struct nlmsghdr *n) -+{ -+ int ret; -+ __be32 key_id; -+ -+ ret = get_be32(&key_id, str, 10); -+ if (!ret) -+ addattr32(n, MAX_MSG, type, key_id); -+ -+ return ret; -+} -+ - static int flower_parse_opt(struct filter_util *qu, char *handle, - int argc, char **argv, struct nlmsghdr *n) - { -@@ -355,6 +373,38 @@ static int flower_parse_opt(struct filter_util *qu, char *handle, - fprintf(stderr, "Illegal \"src_port\"\n"); - return -1; - } -+ } else if (matches(*argv, "enc_dst_ip") == 0) { -+ NEXT_ARG(); -+ ret = flower_parse_ip_addr(*argv, 0, -+ TCA_FLOWER_KEY_ENC_IPV4_DST, -+ TCA_FLOWER_KEY_ENC_IPV4_DST_MASK, -+ TCA_FLOWER_KEY_ENC_IPV6_DST, -+ TCA_FLOWER_KEY_ENC_IPV6_DST_MASK, -+ n); -+ if (ret < 0) { -+ fprintf(stderr, "Illegal \"enc_dst_ip\"\n"); -+ return -1; -+ } -+ } else if (matches(*argv, "enc_src_ip") == 0) { -+ NEXT_ARG(); -+ ret = flower_parse_ip_addr(*argv, 0, -+ TCA_FLOWER_KEY_ENC_IPV4_SRC, -+ TCA_FLOWER_KEY_ENC_IPV4_SRC_MASK, -+ TCA_FLOWER_KEY_ENC_IPV6_SRC, -+ TCA_FLOWER_KEY_ENC_IPV6_SRC_MASK, -+ n); -+ if (ret < 0) { -+ fprintf(stderr, "Illegal \"enc_src_ip\"\n"); -+ return -1; -+ } -+ } else if (matches(*argv, "enc_key_id") == 0) { -+ NEXT_ARG(); -+ ret = flower_parse_key_id(*argv, -+ TCA_FLOWER_KEY_ENC_KEY_ID, n); -+ if (ret < 0) { -+ fprintf(stderr, "Illegal \"enc_key_id\"\n"); -+ return -1; -+ } - } else if (matches(*argv, "action") == 0) { - NEXT_ARG(); - ret = parse_action(&argc, &argv, TCA_FLOWER_ACT, n); -@@ -515,6 +565,13 @@ static void flower_print_port(FILE *f, char *name, struct rtattr *attr) - fprintf(f, "\n %s %d", name, rta_getattr_be16(attr)); - } - -+static void flower_print_key_id(FILE *f, const char *name, -+ struct rtattr *attr) -+{ -+ if (attr) -+ fprintf(f, "\n %s %d", name, rta_getattr_be32(attr)); -+} -+ - static int flower_print_opt(struct filter_util *qu, FILE *f, - struct rtattr *opt, __u32 handle) - { -@@ -580,6 +637,25 @@ static int flower_print_opt(struct filter_util *qu, FILE *f, - flower_print_port(f, "src_port", - tb[flower_port_attr_type(ip_proto, true)]); - -+ flower_print_ip_addr(f, "enc_dst_ip", -+ tb[TCA_FLOWER_KEY_ENC_IPV4_DST_MASK] ? -+ htons(ETH_P_IP) : htons(ETH_P_IPV6), -+ tb[TCA_FLOWER_KEY_ENC_IPV4_DST], -+ tb[TCA_FLOWER_KEY_ENC_IPV4_DST_MASK], -+ tb[TCA_FLOWER_KEY_ENC_IPV6_DST], -+ tb[TCA_FLOWER_KEY_ENC_IPV6_DST_MASK]); -+ -+ flower_print_ip_addr(f, "enc_src_ip", -+ tb[TCA_FLOWER_KEY_ENC_IPV4_SRC_MASK] ? -+ htons(ETH_P_IP) : htons(ETH_P_IPV6), -+ tb[TCA_FLOWER_KEY_ENC_IPV4_SRC], -+ tb[TCA_FLOWER_KEY_ENC_IPV4_SRC_MASK], -+ tb[TCA_FLOWER_KEY_ENC_IPV6_SRC], -+ tb[TCA_FLOWER_KEY_ENC_IPV6_SRC_MASK]); -+ -+ flower_print_key_id(f, "enc_key_id", -+ tb[TCA_FLOWER_KEY_ENC_KEY_ID]); -+ - if (tb[TCA_FLOWER_FLAGS]) { - __u32 flags = rta_getattr_u32(tb[TCA_FLOWER_FLAGS]); - --- -1.8.3.1 - diff --git a/SOURCES/0115-tc-flower-remove-references-to-eth_type-in-manpage.patch b/SOURCES/0115-tc-flower-remove-references-to-eth_type-in-manpage.patch deleted file mode 100644 index 17fadb0..0000000 --- a/SOURCES/0115-tc-flower-remove-references-to-eth_type-in-manpage.patch +++ /dev/null @@ -1,70 +0,0 @@ -From ee52b931335fdcdf32283482558008d865bdd4b5 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 13:23:33 +0100 -Subject: [PATCH] tc: flower: remove references to eth_type in manpage - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629 -Upstream Status: iproute2.git commit 730381fede498 - -commit 730381fede4989901911bc981a99079a1d84ca6a -Author: Simon Horman -Date: Fri Dec 2 14:59:43 2016 -0800 - - tc: flower: remove references to eth_type in manpage - - Remove references to eth_type and ether_type (spelling error) in - the tc flower manpage. - - Also correct formatting of boldface text with whitespace. - - Cc: Paul Blakey - Signed-off-by: Simon Horman - Signed-off-by: Stephen Hemminger ---- - man/man8/tc-flower.8 | 23 +++++++++++------------ - 1 file changed, 11 insertions(+), 12 deletions(-) - -diff --git a/man/man8/tc-flower.8 b/man/man8/tc-flower.8 -index dd35649..11cf774 100644 ---- a/man/man8/tc-flower.8 -+++ b/man/man8/tc-flower.8 -@@ -107,8 +107,8 @@ or an unsigned 8bit value in hexadecimal format. - Match on source or destination IP address. - .I ADDRESS - must be a valid IPv4 or IPv6 address, depending on --.BR ether_type , --which has to be specified in beforehand. -+.BR protocol -+option of tc filter. - .TP - .BI dst_port " NUMBER" - .TQ -@@ -129,16 +129,15 @@ is a 32 bit tunnel key id (e.g. VNI for VXLAN tunnel). - must be a valid IPv4 or IPv6 address. - .SH NOTES - As stated above where applicable, matches of a certain layer implicitly depend --on the matches of the next lower layer. Precisely, layer one and two matches ( --.BR indev , dst_mac , src_mac " and " eth_type ) --have no dependency, layer three matches ( --.BR ip_proto , dst_ip " and " src_ip ) --require --.B eth_type --being set to either --.BR ipv4 " or " ipv6 , --and finally layer four matches ( --.BR dst_port " and " src_port ) -+on the matches of the next lower layer. Precisely, layer one and two matches -+(\fBindev\fR, \fBdst_mac\fR and \fBsrc_mac\fR) -+have no dependency, layer three matches -+(\fBip_proto\fR, \fBdst_ip\fR and \fBsrc_ip\fR) -+depend on the -+.B protocol -+option of tc filter -+and finally layer four matches -+(\fBdst_port\fR and \fBsrc_port\fR) - depend on - .B ip_proto - being set to either --- -1.8.3.1 - diff --git a/SOURCES/0116-tc-flower-document-SCTP-ip_proto.patch b/SOURCES/0116-tc-flower-document-SCTP-ip_proto.patch deleted file mode 100644 index 4092619..0000000 --- a/SOURCES/0116-tc-flower-document-SCTP-ip_proto.patch +++ /dev/null @@ -1,84 +0,0 @@ -From c18577d8237ae746c4c7fa26f9be62e125248dd6 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 13:23:33 +0100 -Subject: [PATCH] tc: flower: document SCTP ip_proto - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629 -Upstream Status: iproute2.git commit 6ad7e60c1f476 - -commit 6ad7e60c1f4760580e9b2a144556315318a8f0ff -Author: Simon Horman -Date: Sat Dec 3 09:52:38 2016 +0100 - - tc: flower: document SCTP ip_proto - - Add SCTP ip_proto to help text and man page. - - Signed-off-by: Simon Horman ---- - man/man8/tc-flower.8 | 14 +++++++------- - tc/f_flower.c | 2 +- - 2 files changed, 8 insertions(+), 8 deletions(-) - -diff --git a/man/man8/tc-flower.8 b/man/man8/tc-flower.8 -index 11cf774..744c450 100644 ---- a/man/man8/tc-flower.8 -+++ b/man/man8/tc-flower.8 -@@ -29,7 +29,7 @@ flower \- flow based traffic control filter - .IR PRIORITY " | " - .BR vlan_eth_type " { " ipv4 " | " ipv6 " | " - .IR ETH_TYPE " } | " --.BR ip_proto " { " tcp " | " udp " | " -+.BR ip_proto " { " tcp " | " udp " | " sctp " | " - .IR IP_PROTO " } | { " - .BR dst_ip " | " src_ip " } { " - .IR ipv4_address " | " ipv6_address " } | { " -@@ -97,8 +97,8 @@ or an unsigned 16bit value in hexadecimal format. - .BI ip_proto " IP_PROTO" - Match on layer four protocol. - .I IP_PROTO --may be either --.BR tcp , udp -+may be -+.BR tcp ", " udp ", " sctp - or an unsigned 8bit value in hexadecimal format. - .TP - .BI dst_ip " ADDRESS" -@@ -114,8 +114,8 @@ option of tc filter. - .TQ - .BI src_port " NUMBER" - Match on layer 4 protocol source or destination port number. Only available for --.BR ip_proto " values " udp " and " tcp , --which has to be specified in beforehand. -+.BR ip_proto " values " udp ", " tcp " and " sctp -+which have to be specified in beforehand. - .TP - .BI enc_key_id " NUMBER" - .TQ -@@ -140,8 +140,8 @@ and finally layer four matches - (\fBdst_port\fR and \fBsrc_port\fR) - depend on - .B ip_proto --being set to either --.BR tcp " or " udp . -+being set to -+.BR tcp ", " udp " or " sctp. - .P - There can be only used one mask per one prio. If user needs to specify different - mask, he has to use different prio. -diff --git a/tc/f_flower.c b/tc/f_flower.c -index 36963c5..26afe73 100644 ---- a/tc/f_flower.c -+++ b/tc/f_flower.c -@@ -37,7 +37,7 @@ static void explain(void) - " vlan_ethtype [ ipv4 | ipv6 | ETH-TYPE ] |\n" - " dst_mac MAC-ADDR |\n" - " src_mac MAC-ADDR |\n" -- " ip_proto [tcp | udp | IP-PROTO ] |\n" -+ " ip_proto [tcp | udp | sctp | IP-PROTO ] |\n" - " dst_ip [ IPV4-ADDR | IPV6-ADDR ] |\n" - " src_ip [ IPV4-ADDR | IPV6-ADDR ] |\n" - " dst_port PORT-NUMBER |\n" --- -1.8.3.1 - diff --git a/SOURCES/0117-tc-flower-correct-name-of-ip_proto-parameter-to-flow.patch b/SOURCES/0117-tc-flower-correct-name-of-ip_proto-parameter-to-flow.patch deleted file mode 100644 index 886bb2d..0000000 --- a/SOURCES/0117-tc-flower-correct-name-of-ip_proto-parameter-to-flow.patch +++ /dev/null @@ -1,67 +0,0 @@ -From cca1d8a85219947ad8c0a202f41278b582c63daa Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 13:23:33 +0100 -Subject: [PATCH] tc: flower: correct name of ip_proto parameter to - flower_parse_port() - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629 -Upstream Status: iproute2.git commit 61dff9ac10cb5 - -commit 61dff9ac10cb55c4f66b7df7a003c420f6f1d430 -Author: Simon Horman -Date: Sat Dec 3 09:52:39 2016 +0100 - - tc: flower: correct name of ip_proto parameter to flower_parse_port() - - This corrects a typo. - - Fixes: a1fb0d484237 ("tc: flower: Support matching on SCTP ports") - Signed-off-by: Simon Horman ---- - tc/f_flower.c | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - -diff --git a/tc/f_flower.c b/tc/f_flower.c -index 26afe73..cac2802 100644 ---- a/tc/f_flower.c -+++ b/tc/f_flower.c -@@ -166,15 +166,15 @@ static int flower_parse_ip_addr(char *str, __be16 eth_type, - return 0; - } - --static int flower_port_attr_type(__u8 ip_port, bool is_src) -+static int flower_port_attr_type(__u8 ip_proto, bool is_src) - { -- if (ip_port == IPPROTO_TCP) { -+ if (ip_proto == IPPROTO_TCP) { - return is_src ? TCA_FLOWER_KEY_TCP_SRC : - TCA_FLOWER_KEY_TCP_DST; -- } else if (ip_port == IPPROTO_UDP) { -+ } else if (ip_proto == IPPROTO_UDP) { - return is_src ? TCA_FLOWER_KEY_UDP_SRC : - TCA_FLOWER_KEY_UDP_DST; -- } else if (ip_port == IPPROTO_SCTP) { -+ } else if (ip_proto == IPPROTO_SCTP) { - return is_src ? TCA_FLOWER_KEY_SCTP_SRC : - TCA_FLOWER_KEY_SCTP_DST; - } else { -@@ -183,14 +183,14 @@ static int flower_port_attr_type(__u8 ip_port, bool is_src) - } - } - --static int flower_parse_port(char *str, __u8 ip_port, bool is_src, -+static int flower_parse_port(char *str, __u8 ip_proto, bool is_src, - struct nlmsghdr *n) - { - int ret; - int type; - __be16 port; - -- type = flower_port_attr_type(ip_port, is_src); -+ type = flower_port_attr_type(ip_proto, is_src); - if (type < 0) - return -1; - --- -1.8.3.1 - diff --git a/SOURCES/0118-tc-flower-make-use-of-flower_port_attr_type-safe-and.patch b/SOURCES/0118-tc-flower-make-use-of-flower_port_attr_type-safe-and.patch deleted file mode 100644 index fc50110..0000000 --- a/SOURCES/0118-tc-flower-make-use-of-flower_port_attr_type-safe-and.patch +++ /dev/null @@ -1,95 +0,0 @@ -From f4fc39065e5b5f429f158744b4a4e43189b02930 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 13:23:33 +0100 -Subject: [PATCH] tc: flower: make use of flower_port_attr_type() safe and - silent - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629 -Upstream Status: iproute2.git commit 6bd5b80cdcfbe - -commit 6bd5b80cdcfbeb30b79c3ff07ce844f9e4f2c600 -Author: Simon Horman -Date: Sat Dec 3 09:52:40 2016 +0100 - - tc: flower: make use of flower_port_attr_type() safe and silent - - Make use of flower_port_attr_type() safe: - * flower_port_attr_type() may return a valid index into tb[] or -1. - Only access tb[] in the case of the former. - * Do not access null entries in tb[] - - Also make usage silent - it is valid for ip_proto to be invalid, - for example if it is not specified as part of the filter. - - Fixes: a1fb0d484237 ("tc: flower: Support matching on SCTP ports") - Signed-off-by: Simon Horman ---- - tc/f_flower.c | 24 +++++++++++++----------- - 1 file changed, 13 insertions(+), 11 deletions(-) - -diff --git a/tc/f_flower.c b/tc/f_flower.c -index cac2802..3f0190f 100644 ---- a/tc/f_flower.c -+++ b/tc/f_flower.c -@@ -168,19 +168,17 @@ static int flower_parse_ip_addr(char *str, __be16 eth_type, - - static int flower_port_attr_type(__u8 ip_proto, bool is_src) - { -- if (ip_proto == IPPROTO_TCP) { -+ if (ip_proto == IPPROTO_TCP) - return is_src ? TCA_FLOWER_KEY_TCP_SRC : - TCA_FLOWER_KEY_TCP_DST; -- } else if (ip_proto == IPPROTO_UDP) { -+ else if (ip_proto == IPPROTO_UDP) - return is_src ? TCA_FLOWER_KEY_UDP_SRC : - TCA_FLOWER_KEY_UDP_DST; -- } else if (ip_proto == IPPROTO_SCTP) { -+ else if (ip_proto == IPPROTO_SCTP) - return is_src ? TCA_FLOWER_KEY_SCTP_SRC : - TCA_FLOWER_KEY_SCTP_DST; -- } else { -- fprintf(stderr, "Illegal \"ip_proto\" for port\n"); -+ else - return -1; -- } - } - - static int flower_parse_port(char *str, __u8 ip_proto, bool is_src, -@@ -562,7 +560,8 @@ static void flower_print_ip_addr(FILE *f, char *name, __be16 eth_type, - - static void flower_print_port(FILE *f, char *name, struct rtattr *attr) - { -- fprintf(f, "\n %s %d", name, rta_getattr_be16(attr)); -+ if (attr) -+ fprintf(f, "\n %s %d", name, rta_getattr_be16(attr)); - } - - static void flower_print_key_id(FILE *f, const char *name, -@@ -578,6 +577,7 @@ static int flower_print_opt(struct filter_util *qu, FILE *f, - struct rtattr *tb[TCA_FLOWER_MAX + 1]; - __be16 eth_type = 0; - __u8 ip_proto = 0xff; -+ int nl_type; - - if (!opt) - return 0; -@@ -632,10 +632,12 @@ static int flower_print_opt(struct filter_util *qu, FILE *f, - tb[TCA_FLOWER_KEY_IPV6_SRC], - tb[TCA_FLOWER_KEY_IPV6_SRC_MASK]); - -- flower_print_port(f, "dst_port", -- tb[flower_port_attr_type(ip_proto, false)]); -- flower_print_port(f, "src_port", -- tb[flower_port_attr_type(ip_proto, true)]); -+ nl_type = flower_port_attr_type(ip_proto, false); -+ if (nl_type >= 0) -+ flower_print_port(f, "dst_port", tb[nl_type]); -+ nl_type = flower_port_attr_type(ip_proto, true); -+ if (nl_type >= 0) -+ flower_print_port(f, "src_port", tb[nl_type]); - - flower_print_ip_addr(f, "enc_dst_ip", - tb[TCA_FLOWER_KEY_ENC_IPV4_DST_MASK] ? --- -1.8.3.1 - diff --git a/SOURCES/0119-tc-flower-introduce-enum-flower_endpoint.patch b/SOURCES/0119-tc-flower-introduce-enum-flower_endpoint.patch deleted file mode 100644 index 15a5d4d..0000000 --- a/SOURCES/0119-tc-flower-introduce-enum-flower_endpoint.patch +++ /dev/null @@ -1,103 +0,0 @@ -From 404b627b261aa76de7718fb481e6bbdacbd6d869 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 13:23:33 +0100 -Subject: [PATCH] tc: flower: introduce enum flower_endpoint - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629 -Upstream Status: iproute2.git commit 6910d65661a37 - -commit 6910d65661a3718ef4b944251a0dec170027f3d5 -Author: Simon Horman -Date: Wed Dec 7 14:54:02 2016 +0100 - - tc: flower: introduce enum flower_endpoint - - Introduce enum flower_endpoint and use it instead of a bool - as the type for paramatising source and destination. - - This is intended to improve read-ability and provide some type - checking of endpoint parameters. - - Signed-off-by: Simon Horman ---- - tc/f_flower.c | 27 +++++++++++++++++++-------- - 1 file changed, 19 insertions(+), 8 deletions(-) - -diff --git a/tc/f_flower.c b/tc/f_flower.c -index 3f0190f..523b82b 100644 ---- a/tc/f_flower.c -+++ b/tc/f_flower.c -@@ -23,6 +23,11 @@ - #include "tc_util.h" - #include "rt_names.h" - -+enum flower_endpoint { -+ FLOWER_ENDPOINT_SRC, -+ FLOWER_ENDPOINT_DST -+}; -+ - static void explain(void) - { - fprintf(stderr, -@@ -166,29 +171,33 @@ static int flower_parse_ip_addr(char *str, __be16 eth_type, - return 0; - } - --static int flower_port_attr_type(__u8 ip_proto, bool is_src) -+static int flower_port_attr_type(__u8 ip_proto, enum flower_endpoint endpoint) - { - if (ip_proto == IPPROTO_TCP) -- return is_src ? TCA_FLOWER_KEY_TCP_SRC : -+ return endpoint == FLOWER_ENDPOINT_SRC ? -+ TCA_FLOWER_KEY_TCP_SRC : - TCA_FLOWER_KEY_TCP_DST; - else if (ip_proto == IPPROTO_UDP) -- return is_src ? TCA_FLOWER_KEY_UDP_SRC : -+ return endpoint == FLOWER_ENDPOINT_SRC ? -+ TCA_FLOWER_KEY_UDP_SRC : - TCA_FLOWER_KEY_UDP_DST; - else if (ip_proto == IPPROTO_SCTP) -- return is_src ? TCA_FLOWER_KEY_SCTP_SRC : -+ return endpoint == FLOWER_ENDPOINT_SRC ? -+ TCA_FLOWER_KEY_SCTP_SRC : - TCA_FLOWER_KEY_SCTP_DST; - else - return -1; - } - --static int flower_parse_port(char *str, __u8 ip_proto, bool is_src, -+static int flower_parse_port(char *str, __u8 ip_proto, -+ enum flower_endpoint endpoint, - struct nlmsghdr *n) - { - int ret; - int type; - __be16 port; - -- type = flower_port_attr_type(ip_proto, is_src); -+ type = flower_port_attr_type(ip_proto, endpoint); - if (type < 0) - return -1; - -@@ -359,14 +368,16 @@ static int flower_parse_opt(struct filter_util *qu, char *handle, - } - } else if (matches(*argv, "dst_port") == 0) { - NEXT_ARG(); -- ret = flower_parse_port(*argv, ip_proto, false, n); -+ ret = flower_parse_port(*argv, ip_proto, -+ FLOWER_ENDPOINT_DST, n); - if (ret < 0) { - fprintf(stderr, "Illegal \"dst_port\"\n"); - return -1; - } - } else if (matches(*argv, "src_port") == 0) { - NEXT_ARG(); -- ret = flower_parse_port(*argv, ip_proto, true, n); -+ ret = flower_parse_port(*argv, ip_proto, -+ FLOWER_ENDPOINT_SRC, n); - if (ret < 0) { - fprintf(stderr, "Illegal \"src_port\"\n"); - return -1; --- -1.8.3.1 - diff --git a/SOURCES/0120-tc-flower-support-matching-on-ICMP-type-and-code.patch b/SOURCES/0120-tc-flower-support-matching-on-ICMP-type-and-code.patch deleted file mode 100644 index de05d40..0000000 --- a/SOURCES/0120-tc-flower-support-matching-on-ICMP-type-and-code.patch +++ /dev/null @@ -1,264 +0,0 @@ -From e5ada6e0c92ee29337cec1117e1d6761ca6d4880 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 13:23:33 +0100 -Subject: [PATCH] tc: flower: support matching on ICMP type and code - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629 -Upstream Status: iproute2.git commit eb3b5696f1633 - -commit eb3b5696f16334b4513ad42882ca6bc35b78144d -Author: Simon Horman -Date: Wed Dec 7 14:54:03 2016 +0100 - - tc: flower: support matching on ICMP type and code - - Support matching on ICMP type and code. - - Example usage: - - tc qdisc add dev eth0 ingress - - tc filter add dev eth0 protocol ip parent ffff: flower \ - indev eth0 ip_proto icmp type 8 code 0 action drop - - tc filter add dev eth0 protocol ipv6 parent ffff: flower \ - indev eth0 ip_proto icmpv6 type 128 code 0 action drop - - Signed-off-by: Simon Horman ---- - man/man8/tc-flower.8 | 20 ++++++++--- - tc/f_flower.c | 96 +++++++++++++++++++++++++++++++++++++++++++++++++--- - 2 files changed, 106 insertions(+), 10 deletions(-) - -diff --git a/man/man8/tc-flower.8 b/man/man8/tc-flower.8 -index 744c450..90fdfba 100644 ---- a/man/man8/tc-flower.8 -+++ b/man/man8/tc-flower.8 -@@ -29,7 +29,7 @@ flower \- flow based traffic control filter - .IR PRIORITY " | " - .BR vlan_eth_type " { " ipv4 " | " ipv6 " | " - .IR ETH_TYPE " } | " --.BR ip_proto " { " tcp " | " udp " | " sctp " | " -+.BR ip_proto " { " tcp " | " udp " | " sctp " | " icmp " | " icmpv6 " | " - .IR IP_PROTO " } | { " - .BR dst_ip " | " src_ip " } { " - .IR ipv4_address " | " ipv6_address " } | { " -@@ -98,7 +98,7 @@ or an unsigned 16bit value in hexadecimal format. - Match on layer four protocol. - .I IP_PROTO - may be --.BR tcp ", " udp ", " sctp -+.BR tcp ", " udp ", " sctp ", " icmp ", " icmpv6 - or an unsigned 8bit value in hexadecimal format. - .TP - .BI dst_ip " ADDRESS" -@@ -117,6 +117,13 @@ Match on layer 4 protocol source or destination port number. Only available for - .BR ip_proto " values " udp ", " tcp " and " sctp - which have to be specified in beforehand. - .TP -+.BI type " NUMBER" -+.TQ -+.BI code " NUMBER" -+Match on ICMP type or code. Only available for -+.BR ip_proto " values " icmp " and " icmpv6 -+which have to be specified in beforehand. -+.TP - .BI enc_key_id " NUMBER" - .TQ - .BI enc_dst_ip " ADDRESS" -@@ -135,13 +142,16 @@ have no dependency, layer three matches - (\fBip_proto\fR, \fBdst_ip\fR and \fBsrc_ip\fR) - depend on the - .B protocol --option of tc filter --and finally layer four matches -+option of tc filter, layer four port matches - (\fBdst_port\fR and \fBsrc_port\fR) - depend on - .B ip_proto - being set to --.BR tcp ", " udp " or " sctp. -+.BR tcp ", " udp " or " sctp, -+and finally ICMP matches (\fBcode\fR and \fBtype\fR) depend on -+.B ip_proto -+being set to -+.BR icmp " or " icmpv6. - .P - There can be only used one mask per one prio. If user needs to specify different - mask, he has to use different prio. -diff --git a/tc/f_flower.c b/tc/f_flower.c -index 523b82b..adf7164 100644 ---- a/tc/f_flower.c -+++ b/tc/f_flower.c -@@ -28,6 +28,11 @@ enum flower_endpoint { - FLOWER_ENDPOINT_DST - }; - -+enum flower_icmp_field { -+ FLOWER_ICMP_FIELD_TYPE, -+ FLOWER_ICMP_FIELD_CODE -+}; -+ - static void explain(void) - { - fprintf(stderr, -@@ -42,11 +47,13 @@ static void explain(void) - " vlan_ethtype [ ipv4 | ipv6 | ETH-TYPE ] |\n" - " dst_mac MAC-ADDR |\n" - " src_mac MAC-ADDR |\n" -- " ip_proto [tcp | udp | sctp | IP-PROTO ] |\n" -+ " ip_proto [tcp | udp | sctp | icmp | icmpv6 | IP-PROTO ] |\n" - " dst_ip [ IPV4-ADDR | IPV6-ADDR ] |\n" - " src_ip [ IPV4-ADDR | IPV6-ADDR ] |\n" - " dst_port PORT-NUMBER |\n" - " src_port PORT-NUMBER |\n" -+ " type ICMP-TYPE |\n" -+ " code ICMP-CODE }\n" - " enc_dst_ip [ IPV4-ADDR | IPV6-ADDR ] |\n" - " enc_src_ip [ IPV4-ADDR | IPV6-ADDR ] |\n" - " enc_key_id [ KEY-ID ] }\n" -@@ -98,16 +105,23 @@ static int flower_parse_ip_proto(char *str, __be16 eth_type, int type, - int ret; - __u8 ip_proto; - -- if (eth_type != htons(ETH_P_IP) && eth_type != htons(ETH_P_IPV6)) { -- fprintf(stderr, "Illegal \"eth_type\" for ip proto\n"); -- return -1; -- } -+ if (eth_type != htons(ETH_P_IP) && eth_type != htons(ETH_P_IPV6)) -+ goto err; -+ - if (matches(str, "tcp") == 0) { - ip_proto = IPPROTO_TCP; - } else if (matches(str, "udp") == 0) { - ip_proto = IPPROTO_UDP; - } else if (matches(str, "sctp") == 0) { - ip_proto = IPPROTO_SCTP; -+ } else if (matches(str, "icmp") == 0) { -+ if (eth_type != htons(ETH_P_IP)) -+ goto err; -+ ip_proto = IPPROTO_ICMP; -+ } else if (matches(str, "icmpv6") == 0) { -+ if (eth_type != htons(ETH_P_IPV6)) -+ goto err; -+ ip_proto = IPPROTO_ICMPV6; - } else { - ret = get_u8(&ip_proto, str, 16); - if (ret) -@@ -116,6 +130,10 @@ static int flower_parse_ip_proto(char *str, __be16 eth_type, int type, - addattr8(n, MAX_MSG, type, ip_proto); - *p_ip_proto = ip_proto; - return 0; -+ -+err: -+ fprintf(stderr, "Illegal \"eth_type\" for ip proto\n"); -+ return -1; - } - - static int flower_parse_ip_addr(char *str, __be16 eth_type, -@@ -171,6 +189,41 @@ static int flower_parse_ip_addr(char *str, __be16 eth_type, - return 0; - } - -+static int flower_icmp_attr_type(__be16 eth_type, __u8 ip_proto, -+ enum flower_icmp_field field) -+{ -+ if (eth_type == htons(ETH_P_IP) && ip_proto == IPPROTO_ICMP) -+ return field == FLOWER_ICMP_FIELD_CODE ? -+ TCA_FLOWER_KEY_ICMPV4_CODE : -+ TCA_FLOWER_KEY_ICMPV4_TYPE; -+ else if (eth_type == htons(ETH_P_IPV6) && ip_proto == IPPROTO_ICMPV6) -+ return field == FLOWER_ICMP_FIELD_CODE ? -+ TCA_FLOWER_KEY_ICMPV6_CODE : -+ TCA_FLOWER_KEY_ICMPV6_TYPE; -+ -+ return -1; -+} -+ -+static int flower_parse_icmp(char *str, __u16 eth_type, __u8 ip_proto, -+ enum flower_icmp_field field, struct nlmsghdr *n) -+{ -+ int ret; -+ int type; -+ uint8_t value; -+ -+ type = flower_icmp_attr_type(eth_type, ip_proto, field); -+ if (type < 0) -+ return -1; -+ -+ ret = get_u8(&value, str, 10); -+ if (ret) -+ return -1; -+ -+ addattr8(n, MAX_MSG, type, value); -+ -+ return 0; -+} -+ - static int flower_port_attr_type(__u8 ip_proto, enum flower_endpoint endpoint) - { - if (ip_proto == IPPROTO_TCP) -@@ -382,6 +435,22 @@ static int flower_parse_opt(struct filter_util *qu, char *handle, - fprintf(stderr, "Illegal \"src_port\"\n"); - return -1; - } -+ } else if (matches(*argv, "type") == 0) { -+ NEXT_ARG(); -+ ret = flower_parse_icmp(*argv, eth_type, ip_proto, -+ FLOWER_ICMP_FIELD_TYPE, n); -+ if (ret < 0) { -+ fprintf(stderr, "Illegal \"icmp type\"\n"); -+ return -1; -+ } -+ } else if (matches(*argv, "code") == 0) { -+ NEXT_ARG(); -+ ret = flower_parse_icmp(*argv, eth_type, ip_proto, -+ FLOWER_ICMP_FIELD_CODE, n); -+ if (ret < 0) { -+ fprintf(stderr, "Illegal \"icmp code\"\n"); -+ return -1; -+ } - } else if (matches(*argv, "enc_dst_ip") == 0) { - NEXT_ARG(); - ret = flower_parse_ip_addr(*argv, 0, -@@ -527,6 +596,10 @@ static void flower_print_ip_proto(FILE *f, __u8 *p_ip_proto, - fprintf(f, "udp"); - else if (ip_proto == IPPROTO_SCTP) - fprintf(f, "sctp"); -+ else if (ip_proto == IPPROTO_ICMP) -+ fprintf(f, "icmp"); -+ else if (ip_proto == IPPROTO_ICMPV6) -+ fprintf(f, "icmpv6"); - else - fprintf(f, "%02x", ip_proto); - *p_ip_proto = ip_proto; -@@ -582,6 +655,12 @@ static void flower_print_key_id(FILE *f, const char *name, - fprintf(f, "\n %s %d", name, rta_getattr_be32(attr)); - } - -+static void flower_print_icmp(FILE *f, char *name, struct rtattr *attr) -+{ -+ if (attr) -+ fprintf(f, "\n %s %d", name, rta_getattr_u8(attr)); -+} -+ - static int flower_print_opt(struct filter_util *qu, FILE *f, - struct rtattr *opt, __u32 handle) - { -@@ -650,6 +729,13 @@ static int flower_print_opt(struct filter_util *qu, FILE *f, - if (nl_type >= 0) - flower_print_port(f, "src_port", tb[nl_type]); - -+ nl_type = flower_icmp_attr_type(eth_type, ip_proto, false); -+ if (nl_type >= 0) -+ flower_print_icmp(f, "icmp_type", tb[nl_type]); -+ nl_type = flower_icmp_attr_type(eth_type, ip_proto, true); -+ if (nl_type >= 0) -+ flower_print_icmp(f, "icmp_code", tb[nl_type]); -+ - flower_print_ip_addr(f, "enc_dst_ip", - tb[TCA_FLOWER_KEY_ENC_IPV4_DST_MASK] ? - htons(ETH_P_IP) : htons(ETH_P_IPV6), --- -1.8.3.1 - diff --git a/SOURCES/0121-tc-cls_flower-Add-dest-UDP-port-to-tunnel-params.patch b/SOURCES/0121-tc-cls_flower-Add-dest-UDP-port-to-tunnel-params.patch deleted file mode 100644 index b75621b..0000000 --- a/SOURCES/0121-tc-cls_flower-Add-dest-UDP-port-to-tunnel-params.patch +++ /dev/null @@ -1,106 +0,0 @@ -From 81c82d64697b25e8b2f7cae85cc4b931a1ad54a0 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 13:23:33 +0100 -Subject: [PATCH] tc/cls_flower: Add dest UDP port to tunnel params - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629 -Upstream Status: iproute2.git commit 41aa17ff4668c - -commit 41aa17ff4668ce97ec27e5f4cdc20db7169b549b -Author: Hadar Hen Zion -Date: Tue Dec 13 10:07:46 2016 +0200 - - tc/cls_flower: Add dest UDP port to tunnel params - - Enhance IP tunnel parameters by adding destination UDP port. - - Signed-off-by: Hadar Hen Zion - Reviewed-by: Roi Dayan ---- - man/man8/tc-flower.8 | 8 +++++++- - tc/f_flower.c | 25 +++++++++++++++++++++++++ - 2 files changed, 32 insertions(+), 1 deletion(-) - -diff --git a/man/man8/tc-flower.8 b/man/man8/tc-flower.8 -index 90fdfba..88df833 100644 ---- a/man/man8/tc-flower.8 -+++ b/man/man8/tc-flower.8 -@@ -39,6 +39,8 @@ flower \- flow based traffic control filter - .IR KEY-ID " | {" - .BR enc_dst_ip " | " enc_src_ip " } { " - .IR ipv4_address " | " ipv6_address " } | " -+.B enc_dst_port -+.IR UDP-PORT " | " - .SH DESCRIPTION - The - .B flower -@@ -129,11 +131,15 @@ which have to be specified in beforehand. - .BI enc_dst_ip " ADDRESS" - .TQ - .BI enc_src_ip " ADDRESS" -+.TQ -+.BI enc_dst_port " NUMBER" - Match on IP tunnel metadata. Key id - .I NUMBER - is a 32 bit tunnel key id (e.g. VNI for VXLAN tunnel). - .I ADDRESS --must be a valid IPv4 or IPv6 address. -+must be a valid IPv4 or IPv6 address. Dst port -+.I NUMBER -+is a 16 bit UDP dst port. - .SH NOTES - As stated above where applicable, matches of a certain layer implicitly depend - on the matches of the next lower layer. Precisely, layer one and two matches -diff --git a/tc/f_flower.c b/tc/f_flower.c -index adf7164..00e3ea6 100644 ---- a/tc/f_flower.c -+++ b/tc/f_flower.c -@@ -275,6 +275,20 @@ static int flower_parse_key_id(const char *str, int type, struct nlmsghdr *n) - return ret; - } - -+static int flower_parse_enc_port(char *str, int type, struct nlmsghdr *n) -+{ -+ int ret; -+ __be16 port; -+ -+ ret = get_be16(&port, str, 10); -+ if (ret) -+ return -1; -+ -+ addattr16(n, MAX_MSG, type, port); -+ -+ return 0; -+} -+ - static int flower_parse_opt(struct filter_util *qu, char *handle, - int argc, char **argv, struct nlmsghdr *n) - { -@@ -483,6 +497,14 @@ static int flower_parse_opt(struct filter_util *qu, char *handle, - fprintf(stderr, "Illegal \"enc_key_id\"\n"); - return -1; - } -+ } else if (matches(*argv, "enc_dst_port") == 0) { -+ NEXT_ARG(); -+ ret = flower_parse_enc_port(*argv, -+ TCA_FLOWER_KEY_ENC_UDP_DST_PORT, n); -+ if (ret < 0) { -+ fprintf(stderr, "Illegal \"enc_dst_port\"\n"); -+ return -1; -+ } - } else if (matches(*argv, "action") == 0) { - NEXT_ARG(); - ret = parse_action(&argc, &argv, TCA_FLOWER_ACT, n); -@@ -755,6 +777,9 @@ static int flower_print_opt(struct filter_util *qu, FILE *f, - flower_print_key_id(f, "enc_key_id", - tb[TCA_FLOWER_KEY_ENC_KEY_ID]); - -+ flower_print_port(f, "enc_dst_port", -+ tb[TCA_FLOWER_KEY_ENC_UDP_DST_PORT]); -+ - if (tb[TCA_FLOWER_FLAGS]) { - __u32 flags = rta_getattr_u32(tb[TCA_FLOWER_FLAGS]); - --- -1.8.3.1 - diff --git a/SOURCES/0122-tc-flower-Fix-typo-and-style-in-flower-man-page.patch b/SOURCES/0122-tc-flower-Fix-typo-and-style-in-flower-man-page.patch deleted file mode 100644 index 0810cff..0000000 --- a/SOURCES/0122-tc-flower-Fix-typo-and-style-in-flower-man-page.patch +++ /dev/null @@ -1,60 +0,0 @@ -From fb560db2ea31c64b2d78408b4a5568068038aa14 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 13:23:33 +0100 -Subject: [PATCH] tc: flower: Fix typo and style in flower man page - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629 -Upstream Status: iproute2.git commit 5c46a8fd618f2 - -commit 5c46a8fd618f2c1ae4c8454964144c3fcbd3739f -Author: Roi Dayan -Date: Tue Dec 13 14:39:01 2016 +0200 - - tc: flower: Fix typo and style in flower man page - - Replace vlan_eth_type with vlan_ethtype. - - Fixes: 745d91726006 ("tc: flower: Introduce vlan support") - Signed-off-by: Roi Dayan - Reviewed-by: Hadar Hen Zion ---- - man/man8/tc-flower.8 | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -diff --git a/man/man8/tc-flower.8 b/man/man8/tc-flower.8 -index 88df833..c5ddf3c 100644 ---- a/man/man8/tc-flower.8 -+++ b/man/man8/tc-flower.8 -@@ -27,7 +27,7 @@ flower \- flow based traffic control filter - .IR VID " | " - .B vlan_prio - .IR PRIORITY " | " --.BR vlan_eth_type " { " ipv4 " | " ipv6 " | " -+.BR vlan_ethtype " { " ipv4 " | " ipv6 " | " - .IR ETH_TYPE " } | " - .BR ip_proto " { " tcp " | " udp " | " sctp " | " icmp " | " icmpv6 " | " - .IR IP_PROTO " } | { " -@@ -84,16 +84,16 @@ Match on vlan tag id. - .I VID - is an unsigned 12bit value in decimal format. - .TP --.BI vlan_prio " priority" -+.BI vlan_prio " PRIORITY" - Match on vlan tag priority. - .I PRIORITY - is an unsigned 3bit value in decimal format. - .TP --.BI vlan_eth_type " VLAN_ETH_TYPE" -+.BI vlan_ethtype " VLAN_ETH_TYPE" - Match on layer three protocol. --.I ETH_TYPE -+.I VLAN_ETH_TYPE - may be either --.BR ipv4 , ipv6 -+.BR ipv4 ", " ipv6 - or an unsigned 16bit value in hexadecimal format. - .TP - .BI ip_proto " IP_PROTO" --- -1.8.3.1 - diff --git a/SOURCES/0123-tc-flower-document-that-_ip-parameters-take-a-PREFIX.patch b/SOURCES/0123-tc-flower-document-that-_ip-parameters-take-a-PREFIX.patch deleted file mode 100644 index 9286bda..0000000 --- a/SOURCES/0123-tc-flower-document-that-_ip-parameters-take-a-PREFIX.patch +++ /dev/null @@ -1,117 +0,0 @@ -From 86bb5cf1e2dacf9c3710e272da719149e94fcfec Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 13:23:34 +0100 -Subject: [PATCH] tc: flower: document that *_ip parameters take a PREFIX as an - argument. - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629 -Upstream Status: iproute2.git commit b2a1f740aa4d3 -Conflicts: Adjusted patch to include changes added by Stephen Hemminger - in a later merge commit. - -commit b2a1f740aa4d37b0a15a1a8ea866a29d5fab4591 -Author: Simon Horman -Date: Fri Dec 16 14:54:36 2016 +0100 - - tc: flower: document that *_ip parameters take a PREFIX as an argument. - - * The argument to src_ip, dst_ip, enc_src_ip and enc_dst_ip take an - optional prefix length which is used to provide a mask to limit the scope - of matching. - * This is documented as a PREFIX in keeping with ip-route(8). - - Example of uses of IPv4 and IPv6 prefixes - - tc qdisc add dev eth0 ingress - tc filter add dev eth0 protocol ip parent ffff: flower \ - indev eth0 dst_ip 192.168.1.1 action drop - tc filter add dev eth0 protocol ip parent ffff: flower \ - indev eth0 src_ip 10.0.0.0/8 action drop - tc filter add dev eth0 protocol ipv6 parent ffff: flower \ - indev eth0 src_ip 2001:DB8:1::/48 action drop - tc filter add dev eth0 protocol ipv6 parent ffff: flower \ - indev eth0 dst_ip 2001:DB8::1 action drop - - Signed-off-by: Simon Horman ---- - man/man8/tc-flower.8 | 28 ++++++++++++++-------------- - tc/f_flower.c | 4 ++-- - 2 files changed, 16 insertions(+), 16 deletions(-) - -diff --git a/man/man8/tc-flower.8 b/man/man8/tc-flower.8 -index c5ddf3c..3841ff2 100644 ---- a/man/man8/tc-flower.8 -+++ b/man/man8/tc-flower.8 -@@ -31,8 +31,8 @@ flower \- flow based traffic control filter - .IR ETH_TYPE " } | " - .BR ip_proto " { " tcp " | " udp " | " sctp " | " icmp " | " icmpv6 " | " - .IR IP_PROTO " } | { " --.BR dst_ip " | " src_ip " } { " --.IR ipv4_address " | " ipv6_address " } | { " -+.BR dst_ip " | " src_ip " } " -+.IR PREFIX " | { " - .BR dst_port " | " src_port " } " - .IR port_number " } | " - .B enc_key_id -@@ -103,14 +103,14 @@ may be - .BR tcp ", " udp ", " sctp ", " icmp ", " icmpv6 - or an unsigned 8bit value in hexadecimal format. - .TP --.BI dst_ip " ADDRESS" -+.BI dst_ip " PREFIX" - .TQ --.BI src_ip " ADDRESS" -+.BI src_ip " PREFIX" - Match on source or destination IP address. --.I ADDRESS --must be a valid IPv4 or IPv6 address, depending on --.BR protocol --option of tc filter. -+.I PREFIX -+must be a valid IPv4 or IPv6 address, depending on the \fBprotocol\fR -+option to tc filter, optionally followed by a slash and the prefix length. -+If the prefix is missing, \fBtc\fR assumes a full-length host match. - .TP - .BI dst_port " NUMBER" - .TQ -@@ -128,16 +128,16 @@ which have to be specified in beforehand. - .TP - .BI enc_key_id " NUMBER" - .TQ --.BI enc_dst_ip " ADDRESS" -+.BI enc_dst_ip " PREFIX" - .TQ --.BI enc_src_ip " ADDRESS" --.TQ --.BI enc_dst_port " NUMBER" -+.BI enc_src_ip " PREFIX" - Match on IP tunnel metadata. Key id - .I NUMBER - is a 32 bit tunnel key id (e.g. VNI for VXLAN tunnel). --.I ADDRESS --must be a valid IPv4 or IPv6 address. Dst port -+.I PREFIX -+must be a valid IPv4 or IPv6 address optionally followed by a slash and the -+prefix length. If the prefix is missing, \fBtc\fR assumes a full-length -+host match. Dst port - .I NUMBER - is a 16 bit UDP dst port. - .SH NOTES -diff --git a/tc/f_flower.c b/tc/f_flower.c -index 00e3ea6..5d93568 100644 ---- a/tc/f_flower.c -+++ b/tc/f_flower.c -@@ -48,8 +48,8 @@ static void explain(void) - " dst_mac MAC-ADDR |\n" - " src_mac MAC-ADDR |\n" - " ip_proto [tcp | udp | sctp | icmp | icmpv6 | IP-PROTO ] |\n" -- " dst_ip [ IPV4-ADDR | IPV6-ADDR ] |\n" -- " src_ip [ IPV4-ADDR | IPV6-ADDR ] |\n" -+ " dst_ip PREFIX |\n" -+ " src_ip PREFIX |\n" - " dst_port PORT-NUMBER |\n" - " src_port PORT-NUMBER |\n" - " type ICMP-TYPE |\n" --- -1.8.3.1 - diff --git a/SOURCES/0124-tc-flower-Allow-_mac-options-to-accept-a-mask.patch b/SOURCES/0124-tc-flower-Allow-_mac-options-to-accept-a-mask.patch deleted file mode 100644 index fcdeff5..0000000 --- a/SOURCES/0124-tc-flower-Allow-_mac-options-to-accept-a-mask.patch +++ /dev/null @@ -1,144 +0,0 @@ -From b4c8e306b3e226076d12128aae38ca94e9eb69be Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 13:23:54 +0100 -Subject: [PATCH] tc: flower: Allow *_mac options to accept a mask - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629 -Upstream Status: iproute2.git commit c2078f8dc48c5 - -commit c2078f8dc48c572a5016c79c3a2a878b6e39e8ee -Author: Simon Horman -Date: Fri Dec 16 14:54:37 2016 +0100 - - tc: flower: Allow *_mac options to accept a mask - - * The argument to src_mac and dst_mac may now take an optional mask - to limit the scope of matching. - * This address is is documented as a LLADDR in keeping with ip-link(8). - * The formats accepted match those already output when dumping flower - filters from the kernel. - - Example of use of LLADDR with and without a mask: - - tc qdisc add dev eth0 ingress - tc filter add dev eth0 protocol ip parent ffff: flower indev eth0 \ - src_mac 52:54:01:00:00:00/ff:ff:00:00:00:01 action drop - tc filter add dev eth0 protocol ip parent ffff: flower indev eth0 \ - src_mac 52:54:00:00:00:00/23 action drop - tc filter add dev eth0 protocol ip parent ffff: flower indev eth0 \ - src_mac 52:54:00:00:00:00 action drop - - Signed-off-by: Simon Horman ---- - man/man8/tc-flower.8 | 13 +++++++++---- - tc/f_flower.c | 43 ++++++++++++++++++++++++++++++++++++------- - 2 files changed, 45 insertions(+), 11 deletions(-) - -diff --git a/man/man8/tc-flower.8 b/man/man8/tc-flower.8 -index 3841ff2..3310496 100644 ---- a/man/man8/tc-flower.8 -+++ b/man/man8/tc-flower.8 -@@ -22,7 +22,7 @@ flower \- flow based traffic control filter - .BR skip_sw " | " skip_hw - .R " | { " - .BR dst_mac " | " src_mac " } " --.IR mac_address " | " -+.IR MASKED_LLADDR " | " - .B vlan_id - .IR VID " | " - .B vlan_prio -@@ -74,10 +74,15 @@ filter, or TC offload is not enabled for the interface, operation will fail. - .BI skip_hw - Do not process filter by hardware. - .TP --.BI dst_mac " mac_address" -+.BI dst_mac " MASKED_LLADDR" - .TQ --.BI src_mac " mac_address" --Match on source or destination MAC address. -+.BI src_mac " MASKED_LLADDR" -+Match on source or destination MAC address. A mask may be optionally -+provided to limit the bits of the address which are matched. A mask is -+provided by following the address with a slash and then the mask. It may be -+provided in LLADDR format, in which case it is a bitwise mask, or as a -+number of high bits to match. If the mask is missing then a match on all -+bits is assumed. - .TP - .BI vlan_id " VID" - Match on vlan tag id. -diff --git a/tc/f_flower.c b/tc/f_flower.c -index 5d93568..2774905 100644 ---- a/tc/f_flower.c -+++ b/tc/f_flower.c -@@ -45,8 +45,8 @@ static void explain(void) - " vlan_id VID |\n" - " vlan_prio PRIORITY |\n" - " vlan_ethtype [ ipv4 | ipv6 | ETH-TYPE ] |\n" -- " dst_mac MAC-ADDR |\n" -- " src_mac MAC-ADDR |\n" -+ " dst_mac MASKED-LLADDR |\n" -+ " src_mac MASKED-LLADDR |\n" - " ip_proto [tcp | udp | sctp | icmp | icmpv6 | IP-PROTO ] |\n" - " dst_ip PREFIX |\n" - " src_ip PREFIX |\n" -@@ -58,6 +58,7 @@ static void explain(void) - " enc_src_ip [ IPV4-ADDR | IPV6-ADDR ] |\n" - " enc_key_id [ KEY-ID ] }\n" - " FILTERID := X:Y:Z\n" -+ " MASKED_LLADDR := { LLADDR | LLADDR/MASK | LLADDR/BITS }\n" - " ACTION-SPEC := ... look at individual actions\n" - "\n" - "NOTE: CLASSID, IP-PROTO are parsed as hexadecimal input.\n" -@@ -68,16 +69,44 @@ static void explain(void) - static int flower_parse_eth_addr(char *str, int addr_type, int mask_type, - struct nlmsghdr *n) - { -- int ret; -- char addr[ETH_ALEN]; -+ int ret, err = -1; -+ char addr[ETH_ALEN], *slash; -+ -+ slash = strchr(str, '/'); -+ if (slash) -+ *slash = '\0'; - - ret = ll_addr_a2n(addr, sizeof(addr), str); - if (ret < 0) -- return -1; -+ goto err; - addattr_l(n, MAX_MSG, addr_type, addr, sizeof(addr)); -- memset(addr, 0xff, ETH_ALEN); -+ -+ if (slash) { -+ unsigned bits; -+ -+ if (!get_unsigned(&bits, slash + 1, 10)) { -+ uint64_t mask; -+ -+ /* Extra 16 bit shift to push mac address into -+ * high bits of uint64_t -+ */ -+ mask = htonll(0xffffffffffffULL << (16 + 48 - bits)); -+ memcpy(addr, &mask, ETH_ALEN); -+ } else { -+ ret = ll_addr_a2n(addr, sizeof(addr), slash + 1); -+ if (ret < 0) -+ goto err; -+ } -+ } else { -+ memset(addr, 0xff, ETH_ALEN); -+ } - addattr_l(n, MAX_MSG, mask_type, addr, sizeof(addr)); -- return 0; -+ -+ err = 0; -+err: -+ if (slash) -+ *slash = '/'; -+ return err; - } - - static int flower_parse_vlan_eth_type(char *str, __be16 eth_type, int type, --- -1.8.3.1 - diff --git a/SOURCES/0125-tc-cls_flower-Add-to-the-usage-encapsulation-dest-UD.patch b/SOURCES/0125-tc-cls_flower-Add-to-the-usage-encapsulation-dest-UD.patch deleted file mode 100644 index 92c7b0f..0000000 --- a/SOURCES/0125-tc-cls_flower-Add-to-the-usage-encapsulation-dest-UD.patch +++ /dev/null @@ -1,47 +0,0 @@ -From dd5789f30937ba9161c0fe4726650a5db4226164 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 13:23:54 +0100 -Subject: [PATCH] tc/cls_flower: Add to the usage encapsulation dest UDP port - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629 -Upstream Status: iproute2.git commit bf73c650ac93a -Conflicts: Changes applied manually due to context changes from previous - backports. - -commit bf73c650ac93ae673291c584fe592ea70686e37e -Author: Hadar Hen Zion -Date: Thu Dec 22 10:14:40 2016 +0200 - - tc/cls_flower: Add to the usage encapsulation dest UDP port - - Encapsulation dest UDP port is part of the classifier matching - parameters, add it to the usage. - - Fixes: 41aa17ff4668 ("tc/cls_flower: Add dest UDP port to tunnel params") - Signed-off-by: Hadar Hen Zion - Reported-by: Simon Horman ---- - tc/f_flower.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/tc/f_flower.c b/tc/f_flower.c -index 2774905..c3e0249 100644 ---- a/tc/f_flower.c -+++ b/tc/f_flower.c -@@ -53,10 +53,11 @@ static void explain(void) - " dst_port PORT-NUMBER |\n" - " src_port PORT-NUMBER |\n" - " type ICMP-TYPE |\n" -- " code ICMP-CODE }\n" -+ " code ICMP-CODE |\n" - " enc_dst_ip [ IPV4-ADDR | IPV6-ADDR ] |\n" - " enc_src_ip [ IPV4-ADDR | IPV6-ADDR ] |\n" -- " enc_key_id [ KEY-ID ] }\n" -+ " enc_key_id [ KEY-ID ] |\n" -+ " enc_dst_port [ UDP-PORT ] }\n" - " FILTERID := X:Y:Z\n" - " MASKED_LLADDR := { LLADDR | LLADDR/MASK | LLADDR/BITS }\n" - " ACTION-SPEC := ... look at individual actions\n" --- -1.8.3.1 - diff --git a/SOURCES/0126-tc-flower-support-matching-flags.patch b/SOURCES/0126-tc-flower-support-matching-flags.patch deleted file mode 100644 index e236927..0000000 --- a/SOURCES/0126-tc-flower-support-matching-flags.patch +++ /dev/null @@ -1,131 +0,0 @@ -From 092cf1937a4fcd54d189e2d7d4984d2b1969d82e Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 13:24:16 +0100 -Subject: [PATCH] tc: flower: support matching flags - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629 -Upstream Status: iproute2.git commit 22a8f019891ca - -commit 22a8f019891ca73295298384612008ff538e48fa -Author: Paul Blakey -Date: Thu Dec 29 10:42:08 2016 -0800 - - tc: flower: support matching flags - - Enhance flower to support matching on flags. - - The 1st flag allows to match on whether the packet is - an IP fragment. - - Example: - - # add a flower filter that will drop fragmented packets - # (bit 0 of control flags) - tc filter add dev ens4f0 protocol ip parent ffff: \ - flower \ - src_mac e4:1d:2d:fd:8b:01 \ - dst_mac e4:1d:2d:fd:8b:02 \ - indev ens4f0 \ - matching_flags 0x1/0x1 \ - action drop - - Signed-off-by: Paul Blakey - Signed-off-by: Or Gerlitz - Reviewed-by: Roi Dayan ---- - tc/f_flower.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 51 insertions(+) - -diff --git a/tc/f_flower.c b/tc/f_flower.c -index c3e0249..41d4da7 100644 ---- a/tc/f_flower.c -+++ b/tc/f_flower.c -@@ -57,6 +57,7 @@ static void explain(void) - " enc_dst_ip [ IPV4-ADDR | IPV6-ADDR ] |\n" - " enc_src_ip [ IPV4-ADDR | IPV6-ADDR ] |\n" - " enc_key_id [ KEY-ID ] |\n" -+ " matching_flags MATCHING-FLAGS | \n" - " enc_dst_port [ UDP-PORT ] }\n" - " FILTERID := X:Y:Z\n" - " MASKED_LLADDR := { LLADDR | LLADDR/MASK | LLADDR/BITS }\n" -@@ -129,6 +130,31 @@ static int flower_parse_vlan_eth_type(char *str, __be16 eth_type, int type, - return 0; - } - -+static int flower_parse_matching_flags(char *str, int type, int mask_type, -+ struct nlmsghdr *n) -+{ -+ __u32 mtf, mtf_mask; -+ char *c; -+ -+ c = strchr(str, '/'); -+ if (c) -+ *c = '\0'; -+ -+ if (get_u32(&mtf, str, 0)) -+ return -1; -+ -+ if (c) { -+ if (get_u32(&mtf_mask, ++c, 0)) -+ return -1; -+ } else { -+ mtf_mask = 0xffffffff; -+ } -+ -+ addattr32(n, MAX_MSG, type, htonl(mtf)); -+ addattr32(n, MAX_MSG, mask_type, htonl(mtf_mask)); -+ return 0; -+} -+ - static int flower_parse_ip_proto(char *str, __be16 eth_type, int type, - __u8 *p_ip_proto, struct nlmsghdr *n) - { -@@ -358,6 +384,16 @@ static int flower_parse_opt(struct filter_util *qu, char *handle, - return -1; - } - addattr_l(n, MAX_MSG, TCA_FLOWER_CLASSID, &handle, 4); -+ } else if (matches(*argv, "matching_flags") == 0) { -+ NEXT_ARG(); -+ ret = flower_parse_matching_flags(*argv, -+ TCA_FLOWER_KEY_FLAGS, -+ TCA_FLOWER_KEY_FLAGS_MASK, -+ n); -+ if (ret < 0) { -+ fprintf(stderr, "Illegal \"matching_flags\"\n"); -+ return -1; -+ } - } else if (matches(*argv, "skip_hw") == 0) { - flags |= TCA_CLS_FLAGS_SKIP_HW; - } else if (matches(*argv, "skip_sw") == 0) { -@@ -657,6 +693,17 @@ static void flower_print_ip_proto(FILE *f, __u8 *p_ip_proto, - *p_ip_proto = ip_proto; - } - -+static void flower_print_matching_flags(FILE *f, char *name, -+ struct rtattr *attr, -+ struct rtattr *mask_attr) -+{ -+ if (!mask_attr || RTA_PAYLOAD(mask_attr) != 4) -+ return; -+ -+ fprintf(f, "\n %s 0x%08x/0x%08x", name, ntohl(rta_getattr_u32(attr)), -+ mask_attr ? ntohl(rta_getattr_u32(mask_attr)) : 0xffffffff); -+} -+ - static void flower_print_ip_addr(FILE *f, char *name, __be16 eth_type, - struct rtattr *addr4_attr, - struct rtattr *mask4_attr, -@@ -810,6 +857,10 @@ static int flower_print_opt(struct filter_util *qu, FILE *f, - flower_print_port(f, "enc_dst_port", - tb[TCA_FLOWER_KEY_ENC_UDP_DST_PORT]); - -+ flower_print_matching_flags(f, "matching_flags", -+ tb[TCA_FLOWER_KEY_FLAGS], -+ tb[TCA_FLOWER_KEY_FLAGS_MASK]); -+ - if (tb[TCA_FLOWER_FLAGS]) { - __u32 flags = rta_getattr_u32(tb[TCA_FLOWER_FLAGS]); - --- -1.8.3.1 - diff --git a/SOURCES/0127-tc-flower-Update-dest-UDP-port-documentation.patch b/SOURCES/0127-tc-flower-Update-dest-UDP-port-documentation.patch deleted file mode 100644 index 39d5232..0000000 --- a/SOURCES/0127-tc-flower-Update-dest-UDP-port-documentation.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 45860a775736ee18ebb791a1431392ea18324f24 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 13:24:16 +0100 -Subject: [PATCH] tc: flower: Update dest UDP port documentation - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629 -Upstream Status: iproute2.git commit a5ae170ed87c6 - -commit a5ae170ed87c6a096451c7a7b94950e7befd8878 -Author: Simon Horman -Date: Wed Jan 4 12:02:18 2017 +0100 - - tc: flower: Update dest UDP port documentation - - Since 41aa17ff4668 ("tc/cls_flower: Add dest UDP port to tunnel params") - tc flower supports setting the dest UDP port. - - * Use "port_number" to be consistent with other man-page text - * Re-add "enc_dst_port" documentation to manpage which was - accidently removed by b2a1f740aa4d ("tc: flower: document that *_ip - parameters take a PREFIX as an argument.") - - Cc: Hadar Hen Zion - Signed-off-by: Simon Horman ---- - man/man8/tc-flower.8 | 4 +++- - tc/f_flower.c | 2 +- - 2 files changed, 4 insertions(+), 2 deletions(-) - -diff --git a/man/man8/tc-flower.8 b/man/man8/tc-flower.8 -index 3310496..5904a9e 100644 ---- a/man/man8/tc-flower.8 -+++ b/man/man8/tc-flower.8 -@@ -40,7 +40,7 @@ flower \- flow based traffic control filter - .BR enc_dst_ip " | " enc_src_ip " } { " - .IR ipv4_address " | " ipv6_address " } | " - .B enc_dst_port --.IR UDP-PORT " | " -+.IR port_number - .SH DESCRIPTION - The - .B flower -@@ -136,6 +136,8 @@ which have to be specified in beforehand. - .BI enc_dst_ip " PREFIX" - .TQ - .BI enc_src_ip " PREFIX" -+.TQ -+.BI enc_dst_port " NUMBER" - Match on IP tunnel metadata. Key id - .I NUMBER - is a 32 bit tunnel key id (e.g. VNI for VXLAN tunnel). -diff --git a/tc/f_flower.c b/tc/f_flower.c -index 41d4da7..0623ab6 100644 ---- a/tc/f_flower.c -+++ b/tc/f_flower.c -@@ -58,7 +58,7 @@ static void explain(void) - " enc_src_ip [ IPV4-ADDR | IPV6-ADDR ] |\n" - " enc_key_id [ KEY-ID ] |\n" - " matching_flags MATCHING-FLAGS | \n" -- " enc_dst_port [ UDP-PORT ] }\n" -+ " enc_dst_port [ port_number ] }\n" - " FILTERID := X:Y:Z\n" - " MASKED_LLADDR := { LLADDR | LLADDR/MASK | LLADDR/BITS }\n" - " ACTION-SPEC := ... look at individual actions\n" --- -1.8.3.1 - diff --git a/SOURCES/0128-tc-flower-Fix-flower-output-for-src-and-dst-ports.patch b/SOURCES/0128-tc-flower-Fix-flower-output-for-src-and-dst-ports.patch deleted file mode 100644 index 8ac5707..0000000 --- a/SOURCES/0128-tc-flower-Fix-flower-output-for-src-and-dst-ports.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 8d988174bf4f103837c0acda1ee7218b1debcbe6 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 13:24:16 +0100 -Subject: [PATCH] tc: flower: Fix flower output for src and dst ports - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629 -Upstream Status: iproute2.git commit b2141de1ad985 - -commit b2141de1ad98517ffecc1feb99800cd36a26fd22 -Author: Roi Dayan -Date: Sun Jan 15 16:23:49 2017 +0200 - - tc: flower: Fix flower output for src and dst ports - - This fix a missing use case after the introduction of enum flower_endpoint. - - Fixes: 6910d65661a3 ("tc: flower: introduce enum flower_endpoint") - Signed-off-by: Roi Dayan - Signed-off-by: Paul Blakey ---- - tc/f_flower.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/tc/f_flower.c b/tc/f_flower.c -index 0623ab6..a3178a0 100644 ---- a/tc/f_flower.c -+++ b/tc/f_flower.c -@@ -821,10 +821,10 @@ static int flower_print_opt(struct filter_util *qu, FILE *f, - tb[TCA_FLOWER_KEY_IPV6_SRC], - tb[TCA_FLOWER_KEY_IPV6_SRC_MASK]); - -- nl_type = flower_port_attr_type(ip_proto, false); -+ nl_type = flower_port_attr_type(ip_proto, FLOWER_ENDPOINT_DST); - if (nl_type >= 0) - flower_print_port(f, "dst_port", tb[nl_type]); -- nl_type = flower_port_attr_type(ip_proto, true); -+ nl_type = flower_port_attr_type(ip_proto, FLOWER_ENDPOINT_SRC); - if (nl_type >= 0) - flower_print_port(f, "src_port", tb[nl_type]); - --- -1.8.3.1 - diff --git a/SOURCES/0129-tc-flower-Add-missing-err-check-when-parsing-flower-.patch b/SOURCES/0129-tc-flower-Add-missing-err-check-when-parsing-flower-.patch deleted file mode 100644 index 6411f99..0000000 --- a/SOURCES/0129-tc-flower-Add-missing-err-check-when-parsing-flower-.patch +++ /dev/null @@ -1,41 +0,0 @@ -From e22b364d6615a03fe4c21b8c5640cabf07aa81ca Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 13:24:16 +0100 -Subject: [PATCH] tc: flower: Add missing err check when parsing flower options - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629 -Upstream Status: iproute2.git commit c85609b25faff - -commit c85609b25faff034d450b0106fac7932d6acf124 -Author: Roi Dayan -Date: Thu Jan 19 14:31:19 2017 +0200 - - tc: flower: Add missing err check when parsing flower options - - addattr32 may return an error. - - Fixes: cfcabf18d84a ("tc: flower: Add skip_{hw|sw} support") - Signed-off-by: Roi Dayan - Reviewed-by: Paul Blakey ---- - tc/f_flower.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/tc/f_flower.c b/tc/f_flower.c -index a3178a0..d210b67 100644 ---- a/tc/f_flower.c -+++ b/tc/f_flower.c -@@ -591,7 +591,9 @@ static int flower_parse_opt(struct filter_util *qu, char *handle, - } - - parse_done: -- addattr32(n, MAX_MSG, TCA_FLOWER_FLAGS, flags); -+ ret = addattr32(n, MAX_MSG, TCA_FLOWER_FLAGS, flags); -+ if (ret) -+ return ret; - - ret = addattr16(n, MAX_MSG, TCA_FLOWER_KEY_ETH_TYPE, eth_type); - if (ret) { --- -1.8.3.1 - diff --git a/SOURCES/0130-tc-flower-Fix-incorrect-error-msg-about-eth-type.patch b/SOURCES/0130-tc-flower-Fix-incorrect-error-msg-about-eth-type.patch deleted file mode 100644 index 0c8a783..0000000 --- a/SOURCES/0130-tc-flower-Fix-incorrect-error-msg-about-eth-type.patch +++ /dev/null @@ -1,45 +0,0 @@ -From ecc95046a60be0fa94e574fa41a17d01a7801516 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 13:24:16 +0100 -Subject: [PATCH] tc: flower: Fix incorrect error msg about eth type - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629 -Upstream Status: iproute2.git commit 00697ca19ae3e - -commit 00697ca19ae3e1118f2af82c3b41ac4335fe918b -Author: Roi Dayan -Date: Thu Jan 19 14:31:20 2017 +0200 - - tc: flower: Fix incorrect error msg about eth type - - addattr16 may return an error about the nl msg size - but not about incorrect eth type. - - Fixes: 488b41d020fb ("tc: flower no need to specify the ethertype") - Signed-off-by: Roi Dayan - Reviewed-by: Paul Blakey ---- - tc/f_flower.c | 7 ++----- - 1 file changed, 2 insertions(+), 5 deletions(-) - -diff --git a/tc/f_flower.c b/tc/f_flower.c -index d210b67..20f9a85 100644 ---- a/tc/f_flower.c -+++ b/tc/f_flower.c -@@ -596,11 +596,8 @@ parse_done: - return ret; - - ret = addattr16(n, MAX_MSG, TCA_FLOWER_KEY_ETH_TYPE, eth_type); -- if (ret) { -- fprintf(stderr, "Illegal \"eth_type\"(0x%x)\n", -- ntohs(eth_type)); -- return -1; -- } -+ if (ret) -+ return ret; - - tail->rta_len = (((void*)n)+n->nlmsg_len) - (void*)tail; - --- -1.8.3.1 - diff --git a/SOURCES/0131-kernel-headers-update.patch b/SOURCES/0131-kernel-headers-update.patch deleted file mode 100644 index 2baefeb..0000000 --- a/SOURCES/0131-kernel-headers-update.patch +++ /dev/null @@ -1,74 +0,0 @@ -From 12826e1deb34890a54e887c5fe3065b6386d4995 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 13:24:16 +0100 -Subject: [PATCH] kernel headers update - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629 -Upstream Status: iproute2.git commit e2ade8cefb7ff - -commit e2ade8cefb7ffe7d53b21a73b88a627d555c0371 -Author: Stephen Hemminger -Date: Thu Jan 12 17:45:30 2017 -0800 - - kernel headers update - - For flower, etc. - - Signed-off-by: Stephen Hemminger ---- - include/linux/netlink.h | 1 + - include/linux/pkt_cls.h | 11 +++++++++++ - include/linux/tc_act/tc_csum.h | 3 ++- - 3 files changed, 14 insertions(+), 1 deletion(-) - -diff --git a/include/linux/netlink.h b/include/linux/netlink.h -index 8a7ca5c..a982b3c 100644 ---- a/include/linux/netlink.h -+++ b/include/linux/netlink.h -@@ -27,6 +27,7 @@ - #define NETLINK_ECRYPTFS 19 - #define NETLINK_RDMA 20 - #define NETLINK_CRYPTO 21 /* Crypto layer */ -+#define NETLINK_SMC 22 /* SMC monitoring */ - - #define NETLINK_INET_DIAG NETLINK_SOCK_DIAG - -diff --git a/include/linux/pkt_cls.h b/include/linux/pkt_cls.h -index af17f3c..faed2e6 100644 ---- a/include/linux/pkt_cls.h -+++ b/include/linux/pkt_cls.h -@@ -417,6 +417,17 @@ enum { - TCA_FLOWER_KEY_ICMPV6_TYPE, /* u8 */ - TCA_FLOWER_KEY_ICMPV6_TYPE_MASK,/* u8 */ - -+ TCA_FLOWER_KEY_ARP_SIP, /* be32 */ -+ TCA_FLOWER_KEY_ARP_SIP_MASK, /* be32 */ -+ TCA_FLOWER_KEY_ARP_TIP, /* be32 */ -+ TCA_FLOWER_KEY_ARP_TIP_MASK, /* be32 */ -+ TCA_FLOWER_KEY_ARP_OP, /* u8 */ -+ TCA_FLOWER_KEY_ARP_OP_MASK, /* u8 */ -+ TCA_FLOWER_KEY_ARP_SHA, /* ETH_ALEN */ -+ TCA_FLOWER_KEY_ARP_SHA_MASK, /* ETH_ALEN */ -+ TCA_FLOWER_KEY_ARP_THA, /* ETH_ALEN */ -+ TCA_FLOWER_KEY_ARP_THA_MASK, /* ETH_ALEN */ -+ - __TCA_FLOWER_MAX, - }; - -diff --git a/include/linux/tc_act/tc_csum.h b/include/linux/tc_act/tc_csum.h -index 8ac8041..a11bb35 100644 ---- a/include/linux/tc_act/tc_csum.h -+++ b/include/linux/tc_act/tc_csum.h -@@ -21,7 +21,8 @@ enum { - TCA_CSUM_UPDATE_FLAG_IGMP = 4, - TCA_CSUM_UPDATE_FLAG_TCP = 8, - TCA_CSUM_UPDATE_FLAG_UDP = 16, -- TCA_CSUM_UPDATE_FLAG_UDPLITE = 32 -+ TCA_CSUM_UPDATE_FLAG_UDPLITE = 32, -+ TCA_CSUM_UPDATE_FLAG_SCTP = 64, - }; - - struct tc_csum { --- -1.8.3.1 - diff --git a/SOURCES/0132-tc-flower-Support-matching-ARP.patch b/SOURCES/0132-tc-flower-Support-matching-ARP.patch deleted file mode 100644 index 21767f8..0000000 --- a/SOURCES/0132-tc-flower-Support-matching-ARP.patch +++ /dev/null @@ -1,381 +0,0 @@ -From 8b5f12cb701561aea1e7ece9267719bde085d328 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 13:24:17 +0100 -Subject: [PATCH] tc: flower: Support matching ARP - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629 -Upstream Status: iproute2.git commit f888f4e20534a -Conflicts: Context changes due to previously backported commits. - -commit f888f4e20534ae44ec4c5a2cfc5209b105645a04 -Author: Simon Horman -Date: Thu Jan 12 09:11:59 2017 +0100 - - tc: flower: Support matching ARP - - Support matching on ARP operation, and hardware and protocol addresses - for Ethernet hardware and IPv4 protocol addresses. - - Example usage: - - tc qdisc add dev eth0 ingress - - tc filter add dev eth0 protocol arp parent ffff: flower indev eth0 \ arp_op request arp_sip 10.0.0.1 action drop - tc filter add dev eth0 protocol rarp parent ffff: flower indev eth0 \ arp_op reply arp_tha 52:54:3f:00:00:00/24 action drop - - Signed-off-by: Simon Horman ---- - man/man8/tc-flower.8 | 41 +++++++++- - tc/f_flower.c | 208 +++++++++++++++++++++++++++++++++++++++++++++++---- - 2 files changed, 232 insertions(+), 17 deletions(-) - -diff --git a/man/man8/tc-flower.8 b/man/man8/tc-flower.8 -index 5904a9e..2dd2c5e 100644 ---- a/man/man8/tc-flower.8 -+++ b/man/man8/tc-flower.8 -@@ -34,7 +34,13 @@ flower \- flow based traffic control filter - .BR dst_ip " | " src_ip " } " - .IR PREFIX " | { " - .BR dst_port " | " src_port " } " --.IR port_number " } | " -+.IR port_number " } | { " -+.BR arp_tip " | " arp_sip " } " -+.IR PREFIX " | " -+.BR arp_op " { " request " | " reply " | " -+.IR OP " } | { " -+.BR arp_tha " | " arp_sha " } " -+.IR MASKED_LLADDR " | " - .B enc_key_id - .IR KEY-ID " | {" - .BR enc_dst_ip " | " enc_src_ip " } { " -@@ -131,6 +137,36 @@ Match on ICMP type or code. Only available for - .BR ip_proto " values " icmp " and " icmpv6 - which have to be specified in beforehand. - .TP -+.BI arp_tip " PREFIX" -+.TQ -+.BI arp_sip " PREFIX" -+Match on ARP or RARP sender or target IP address. -+.I PREFIX -+must be a valid IPv4 address optionally followed by a slash and the prefix -+length. If the prefix is missing, \fBtc\fR assumes a full-length host -+match. -+.TP -+.BI arp_op " ARP_OP" -+Match on ARP or RARP operation. -+.I ARP_OP -+may be -+.BR request ", " reply -+or an integer value 0, 1 or 2. A mask may be optionally provided to limit -+the bits of the operation which are matched. A mask is provided by -+following the address with a slash and then the mask. It may be provided as -+an unsigned 8 bit value representing a bitwise mask. If the mask is missing -+then a match on all bits is assumed. -+.TP -+.BI arp_sha " MASKED_LLADDR" -+.TQ -+.BI arp_tha " MASKED_LLADDR" -+Match on ARP or RARP sender or target MAC address. A mask may be optionally -+provided to limit the bits of the address which are matched. A mask is -+provided by following the address with a slash and then the mask. It may be -+provided in LLADDR format, in which case it is a bitwise mask, or as a -+number of high bits to match. If the mask is missing then a match on all -+bits is assumed. -+.TP - .BI enc_key_id " NUMBER" - .TQ - .BI enc_dst_ip " PREFIX" -@@ -152,7 +188,8 @@ As stated above where applicable, matches of a certain layer implicitly depend - on the matches of the next lower layer. Precisely, layer one and two matches - (\fBindev\fR, \fBdst_mac\fR and \fBsrc_mac\fR) - have no dependency, layer three matches --(\fBip_proto\fR, \fBdst_ip\fR and \fBsrc_ip\fR) -+(\fBip_proto\fR, \fBdst_ip\fR, \fBsrc_ip\fR, \fBarp_tip\fR, \fBarp_sip\fR, -+\fBarp_op\fR, \fBarp_tha\fR and \fBarp_sha\fR) - depend on the - .B protocol - option of tc filter, layer four port matches -diff --git a/tc/f_flower.c b/tc/f_flower.c -index 20f9a85..2473aea 100644 ---- a/tc/f_flower.c -+++ b/tc/f_flower.c -@@ -15,6 +15,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -54,6 +55,11 @@ static void explain(void) - " src_port PORT-NUMBER |\n" - " type ICMP-TYPE |\n" - " code ICMP-CODE |\n" -+ " arp_tip PREFIX |\n" -+ " arp_sip PREFIX |\n" -+ " arp_op [ request | reply | OP ] |\n" -+ " arp_tha MASKED-LLADDR |\n" -+ " arp_sha MASKED-LLADDR |\n" - " enc_dst_ip [ IPV4-ADDR | IPV6-ADDR ] |\n" - " enc_src_ip [ IPV4-ADDR | IPV6-ADDR ] |\n" - " enc_key_id [ KEY-ID ] |\n" -@@ -192,27 +198,16 @@ err: - return -1; - } - --static int flower_parse_ip_addr(char *str, __be16 eth_type, -- int addr4_type, int mask4_type, -- int addr6_type, int mask6_type, -- struct nlmsghdr *n) -+static int __flower_parse_ip_addr(char *str, int family, -+ int addr4_type, int mask4_type, -+ int addr6_type, int mask6_type, -+ struct nlmsghdr *n) - { - int ret; - inet_prefix addr; -- int family; - int bits; - int i; - -- if (eth_type == htons(ETH_P_IP)) { -- family = AF_INET; -- } else if (eth_type == htons(ETH_P_IPV6)) { -- family = AF_INET6; -- } else if (!eth_type) { -- family = AF_UNSPEC; -- } else { -- return -1; -- } -- - ret = get_prefix(&addr, str, family); - if (ret) - return -1; -@@ -245,6 +240,89 @@ static int flower_parse_ip_addr(char *str, __be16 eth_type, - return 0; - } - -+static int flower_parse_ip_addr(char *str, __be16 eth_type, -+ int addr4_type, int mask4_type, -+ int addr6_type, int mask6_type, -+ struct nlmsghdr *n) -+{ -+ int family; -+ -+ if (eth_type == htons(ETH_P_IP)) { -+ family = AF_INET; -+ } else if (eth_type == htons(ETH_P_IPV6)) { -+ family = AF_INET6; -+ } else if (!eth_type) { -+ family = AF_UNSPEC; -+ } else { -+ return -1; -+ } -+ -+ return __flower_parse_ip_addr(str, family, addr4_type, addr6_type, -+ mask4_type, mask6_type, n); -+} -+ -+static bool flower_eth_type_arp(__be16 eth_type) -+{ -+ return eth_type == htons(ETH_P_ARP) || eth_type == htons(ETH_P_RARP); -+} -+ -+static int flower_parse_arp_ip_addr(char *str, __be16 eth_type, -+ int addr_type, int mask_type, -+ struct nlmsghdr *n) -+{ -+ if (!flower_eth_type_arp(eth_type)) -+ return -1; -+ -+ return __flower_parse_ip_addr(str, AF_INET, addr_type, mask_type, -+ TCA_FLOWER_UNSPEC, TCA_FLOWER_UNSPEC, n); -+} -+ -+static int flower_parse_arp_op(char *str, __be16 eth_type, -+ int op_type, int mask_type, -+ struct nlmsghdr *n) -+{ -+ char *slash; -+ int ret, err = -1; -+ uint8_t value, mask; -+ -+ slash = strchr(str, '/'); -+ if (slash) -+ *slash = '\0'; -+ -+ if (!flower_eth_type_arp(eth_type)) -+ goto err; -+ -+ if (!strcmp(str, "request")) { -+ value = ARPOP_REQUEST; -+ } else if (!strcmp(str, "reply")) { -+ value = ARPOP_REPLY; -+ } else { -+ ret = get_u8(&value, str, 10); -+ if (ret) -+ goto err; -+ if (value && value != ARPOP_REQUEST && value != ARPOP_REPLY) -+ goto err; -+ } -+ -+ if (slash) { -+ ret = get_u8(&mask, slash + 1, 10); -+ if (ret) -+ goto err; -+ } -+ else { -+ mask = UINT8_MAX; -+ } -+ -+ addattr8(n, MAX_MSG, op_type, value); -+ addattr8(n, MAX_MSG, mask_type, mask); -+ -+ err = 0; -+err: -+ if (slash) -+ *slash = '/'; -+ return err; -+} -+ - static int flower_icmp_attr_type(__be16 eth_type, __u8 ip_proto, - enum flower_icmp_field field) - { -@@ -531,6 +609,59 @@ static int flower_parse_opt(struct filter_util *qu, char *handle, - fprintf(stderr, "Illegal \"icmp code\"\n"); - return -1; - } -+ } else if (matches(*argv, "arp_tip") == 0) { -+ NEXT_ARG(); -+ ret = flower_parse_arp_ip_addr(*argv, vlan_ethtype ? -+ vlan_ethtype : eth_type, -+ TCA_FLOWER_KEY_ARP_TIP, -+ TCA_FLOWER_KEY_ARP_TIP_MASK, -+ n); -+ if (ret < 0) { -+ fprintf(stderr, "Illegal \"arp_tip\"\n"); -+ return -1; -+ } -+ } else if (matches(*argv, "arp_sip") == 0) { -+ NEXT_ARG(); -+ ret = flower_parse_arp_ip_addr(*argv, vlan_ethtype ? -+ vlan_ethtype : eth_type, -+ TCA_FLOWER_KEY_ARP_SIP, -+ TCA_FLOWER_KEY_ARP_SIP_MASK, -+ n); -+ if (ret < 0) { -+ fprintf(stderr, "Illegal \"arp_sip\"\n"); -+ return -1; -+ } -+ } else if (matches(*argv, "arp_op") == 0) { -+ NEXT_ARG(); -+ ret = flower_parse_arp_op(*argv, vlan_ethtype ? -+ vlan_ethtype : eth_type, -+ TCA_FLOWER_KEY_ARP_OP, -+ TCA_FLOWER_KEY_ARP_OP_MASK, -+ n); -+ if (ret < 0) { -+ fprintf(stderr, "Illegal \"arp_op\"\n"); -+ return -1; -+ } -+ } else if (matches(*argv, "arp_tha") == 0) { -+ NEXT_ARG(); -+ ret = flower_parse_eth_addr(*argv, -+ TCA_FLOWER_KEY_ARP_THA, -+ TCA_FLOWER_KEY_ARP_THA_MASK, -+ n); -+ if (ret < 0) { -+ fprintf(stderr, "Illegal \"arp_tha\"\n"); -+ return -1; -+ } -+ } else if (matches(*argv, "arp_sha") == 0) { -+ NEXT_ARG(); -+ ret = flower_parse_eth_addr(*argv, -+ TCA_FLOWER_KEY_ARP_SHA, -+ TCA_FLOWER_KEY_ARP_SHA_MASK, -+ n); -+ if (ret < 0) { -+ fprintf(stderr, "Illegal \"arp_sha\"\n"); -+ return -1; -+ } - } else if (matches(*argv, "enc_dst_ip") == 0) { - NEXT_ARG(); - ret = flower_parse_ip_addr(*argv, 0, -@@ -662,6 +793,10 @@ static void flower_print_eth_type(FILE *f, __be16 *p_eth_type, - fprintf(f, "ipv4"); - else if (eth_type == htons(ETH_P_IPV6)) - fprintf(f, "ipv6"); -+ else if (eth_type == htons(ETH_P_ARP)) -+ fprintf(f, "arp"); -+ else if (eth_type == htons(ETH_P_RARP)) -+ fprintf(f, "rarp"); - else - fprintf(f, "%04x", ntohs(eth_type)); - *p_eth_type = eth_type; -@@ -739,6 +874,13 @@ static void flower_print_ip_addr(FILE *f, char *name, __be16 eth_type, - else if (bits < len * 8) - fprintf(f, "/%d", bits); - } -+static void flower_print_ip4_addr(FILE *f, char *name, -+ struct rtattr *addr_attr, -+ struct rtattr *mask_attr) -+{ -+ return flower_print_ip_addr(f, name, htons(ETH_P_IP), -+ addr_attr, mask_attr, 0, 0); -+} - - static void flower_print_port(FILE *f, char *name, struct rtattr *attr) - { -@@ -759,6 +901,31 @@ static void flower_print_icmp(FILE *f, char *name, struct rtattr *attr) - fprintf(f, "\n %s %d", name, rta_getattr_u8(attr)); - } - -+static void flower_print_arp_op(FILE *f, char *name, -+ struct rtattr *op_attr, -+ struct rtattr *mask_attr) -+{ -+ uint8_t op, mask; -+ -+ if (!op_attr) -+ return; -+ -+ op = rta_getattr_u8(op_attr); -+ mask = mask_attr ? rta_getattr_u8(mask_attr) : UINT8_MAX; -+ -+ fprintf(f, "\n %s ", name); -+ -+ if (mask == UINT8_MAX && op == ARPOP_REQUEST) -+ fprintf(f, "request"); -+ else if (mask == UINT8_MAX && op == ARPOP_REPLY) -+ fprintf(f, "reply"); -+ else -+ fprintf(f, "%d", op); -+ -+ if (mask != UINT8_MAX) -+ fprintf(f, "/%d", mask); -+} -+ - static int flower_print_opt(struct filter_util *qu, FILE *f, - struct rtattr *opt, __u32 handle) - { -@@ -834,6 +1001,17 @@ static int flower_print_opt(struct filter_util *qu, FILE *f, - if (nl_type >= 0) - flower_print_icmp(f, "icmp_code", tb[nl_type]); - -+ flower_print_ip4_addr(f, "arp_sip", tb[TCA_FLOWER_KEY_ARP_SIP], -+ tb[TCA_FLOWER_KEY_ARP_SIP_MASK]); -+ flower_print_ip4_addr(f, "arp_tip", tb[TCA_FLOWER_KEY_ARP_TIP], -+ tb[TCA_FLOWER_KEY_ARP_TIP_MASK]); -+ flower_print_arp_op(f, "arp_op", tb[TCA_FLOWER_KEY_ARP_OP], -+ tb[TCA_FLOWER_KEY_ARP_OP_MASK]); -+ flower_print_eth_addr(f, "arp_sha", tb[TCA_FLOWER_KEY_ARP_SHA], -+ tb[TCA_FLOWER_KEY_ARP_SHA_MASK]); -+ flower_print_eth_addr(f, "arp_tha", tb[TCA_FLOWER_KEY_ARP_THA], -+ tb[TCA_FLOWER_KEY_ARP_THA_MASK]); -+ - flower_print_ip_addr(f, "enc_dst_ip", - tb[TCA_FLOWER_KEY_ENC_IPV4_DST_MASK] ? - htons(ETH_P_IP) : htons(ETH_P_IPV6), --- -1.8.3.1 - diff --git a/SOURCES/0133-tc-flower-Refactor-matching-flags-to-be-more-user-fr.patch b/SOURCES/0133-tc-flower-Refactor-matching-flags-to-be-more-user-fr.patch deleted file mode 100644 index 70fc549..0000000 --- a/SOURCES/0133-tc-flower-Refactor-matching-flags-to-be-more-user-fr.patch +++ /dev/null @@ -1,278 +0,0 @@ -From c121d1c4937a0495e917dc637fac6aa6846e8ea6 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 13:24:35 +0100 -Subject: [PATCH] tc: flower: Refactor matching flags to be more user friendly - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629 -Upstream Status: iproute2.git commit 08f66c80c094e - -commit 08f66c80c094eaa5d71abc0395fd114ff919af7a -Author: Paul Blakey -Date: Fri Jan 20 10:36:45 2017 -0800 - - tc: flower: Refactor matching flags to be more user friendly - - Instead of "magic numbers" we can now specify each flag - by name. Prefix of "no" (e.g nofrag) unsets the flag, - otherwise it wil be set. - - Example: - # add a flower filter that will drop fragmented packets - tc filter add dev ens4f0 protocol ip parent ffff: \ - flower \ - src_mac e4:1d:2d:fd:8b:01 \ - dst_mac e4:1d:2d:fd:8b:02 \ - indev ens4f0 \ - ip_flags frag \ - action drop - - # add a flower filter that will drop non-fragmented packets - tc filter add dev ens4f0 protocol ip parent ffff: \ - flower \ - src_mac e4:1d:2d:fd:8b:01 \ - dst_mac e4:1d:2d:fd:8b:02 \ - indev ens4f0 \ - ip_flags nofrag \ - action drop - - Fixes: 22a8f019891c ('tc: flower: support matching flags') - Signed-off-by: Paul Blakey - Reviewed-by: Roi Dayan - Reviewed-by: Jiri Benc - Signed-off-by: Stephen Hemminger ---- - man/man8/tc-flower.8 | 12 +++++- - tc/f_flower.c | 117 ++++++++++++++++++++++++++++++++++++++++----------- - 2 files changed, 102 insertions(+), 27 deletions(-) - -diff --git a/man/man8/tc-flower.8 b/man/man8/tc-flower.8 -index 2dd2c5e..2bdd2ef 100644 ---- a/man/man8/tc-flower.8 -+++ b/man/man8/tc-flower.8 -@@ -46,7 +46,9 @@ flower \- flow based traffic control filter - .BR enc_dst_ip " | " enc_src_ip " } { " - .IR ipv4_address " | " ipv6_address " } | " - .B enc_dst_port --.IR port_number -+.IR port_number " | " -+.BR ip_flags -+.IR IP_FLAGS - .SH DESCRIPTION - The - .B flower -@@ -183,13 +185,19 @@ prefix length. If the prefix is missing, \fBtc\fR assumes a full-length - host match. Dst port - .I NUMBER - is a 16 bit UDP dst port. -+.TP -+.BI ip_flags " IP_FLAGS" -+.I IP_FLAGS -+may be either -+.BR frag " or " nofrag -+to match on fragmented packets or not respectively. - .SH NOTES - As stated above where applicable, matches of a certain layer implicitly depend - on the matches of the next lower layer. Precisely, layer one and two matches - (\fBindev\fR, \fBdst_mac\fR and \fBsrc_mac\fR) - have no dependency, layer three matches - (\fBip_proto\fR, \fBdst_ip\fR, \fBsrc_ip\fR, \fBarp_tip\fR, \fBarp_sip\fR, --\fBarp_op\fR, \fBarp_tha\fR and \fBarp_sha\fR) -+\fBarp_op\fR, \fBarp_tha\fR, \fBarp_sha\fR and \fBip_flags\fR) - depend on the - .B protocol - option of tc filter, layer four port matches -diff --git a/tc/f_flower.c b/tc/f_flower.c -index 2473aea..ddf64c2 100644 ---- a/tc/f_flower.c -+++ b/tc/f_flower.c -@@ -24,6 +24,10 @@ - #include "tc_util.h" - #include "rt_names.h" - -+enum flower_matching_flags { -+ FLOWER_IP_FLAGS, -+}; -+ - enum flower_endpoint { - FLOWER_ENDPOINT_SRC, - FLOWER_ENDPOINT_DST -@@ -63,7 +67,7 @@ static void explain(void) - " enc_dst_ip [ IPV4-ADDR | IPV6-ADDR ] |\n" - " enc_src_ip [ IPV4-ADDR | IPV6-ADDR ] |\n" - " enc_key_id [ KEY-ID ] |\n" -- " matching_flags MATCHING-FLAGS | \n" -+ " ip_flags IP-FLAGS | \n" - " enc_dst_port [ port_number ] }\n" - " FILTERID := X:Y:Z\n" - " MASKED_LLADDR := { LLADDR | LLADDR/MASK | LLADDR/BITS }\n" -@@ -136,28 +140,56 @@ static int flower_parse_vlan_eth_type(char *str, __be16 eth_type, int type, - return 0; - } - --static int flower_parse_matching_flags(char *str, int type, int mask_type, -- struct nlmsghdr *n) --{ -- __u32 mtf, mtf_mask; -- char *c; -+struct flag_to_string { -+ int flag; -+ enum flower_matching_flags type; -+ char *string; -+}; - -- c = strchr(str, '/'); -- if (c) -- *c = '\0'; -+static struct flag_to_string flags_str[] = { -+ { TCA_FLOWER_KEY_FLAGS_IS_FRAGMENT, FLOWER_IP_FLAGS, "frag" }, -+}; - -- if (get_u32(&mtf, str, 0)) -- return -1; -+static int flower_parse_matching_flags(char *str, -+ enum flower_matching_flags type, -+ __u32 *mtf, __u32 *mtf_mask) -+{ -+ char *token; -+ bool no; -+ bool found; -+ int i; - -- if (c) { -- if (get_u32(&mtf_mask, ++c, 0)) -+ token = strtok(str, "/"); -+ -+ while (token) { -+ if (!strncmp(token, "no", 2)) { -+ no = true; -+ token += 2; -+ } else -+ no = false; -+ -+ found = false; -+ for (i = 0; i < ARRAY_SIZE(flags_str); i++) { -+ if (type != flags_str[i].type) -+ continue; -+ -+ if (!strcmp(token, flags_str[i].string)) { -+ if (no) -+ *mtf &= ~flags_str[i].flag; -+ else -+ *mtf |= flags_str[i].flag; -+ -+ *mtf_mask |= flags_str[i].flag; -+ found = true; -+ break; -+ } -+ } -+ if (!found) - return -1; -- } else { -- mtf_mask = 0xffffffff; -+ -+ token = strtok(NULL, "/"); - } - -- addattr32(n, MAX_MSG, type, htonl(mtf)); -- addattr32(n, MAX_MSG, mask_type, htonl(mtf_mask)); - return 0; - } - -@@ -433,6 +465,8 @@ static int flower_parse_opt(struct filter_util *qu, char *handle, - __be16 vlan_ethtype = 0; - __u8 ip_proto = 0xff; - __u32 flags = 0; -+ __u32 mtf = 0; -+ __u32 mtf_mask = 0; - - if (handle) { - ret = get_u32(&t->tcm_handle, handle, 0); -@@ -462,14 +496,14 @@ static int flower_parse_opt(struct filter_util *qu, char *handle, - return -1; - } - addattr_l(n, MAX_MSG, TCA_FLOWER_CLASSID, &handle, 4); -- } else if (matches(*argv, "matching_flags") == 0) { -+ } else if (matches(*argv, "ip_flags") == 0) { - NEXT_ARG(); - ret = flower_parse_matching_flags(*argv, -- TCA_FLOWER_KEY_FLAGS, -- TCA_FLOWER_KEY_FLAGS_MASK, -- n); -+ FLOWER_IP_FLAGS, -+ &mtf, -+ &mtf_mask); - if (ret < 0) { -- fprintf(stderr, "Illegal \"matching_flags\"\n"); -+ fprintf(stderr, "Illegal \"ip_flags\"\n"); - return -1; - } - } else if (matches(*argv, "skip_hw") == 0) { -@@ -726,6 +760,16 @@ parse_done: - if (ret) - return ret; - -+ if (mtf_mask) { -+ ret = addattr32(n, MAX_MSG, TCA_FLOWER_KEY_FLAGS, htonl(mtf)); -+ if (ret) -+ return ret; -+ -+ ret = addattr32(n, MAX_MSG, TCA_FLOWER_KEY_FLAGS_MASK, htonl(mtf_mask)); -+ if (ret) -+ return ret; -+ } -+ - ret = addattr16(n, MAX_MSG, TCA_FLOWER_KEY_ETH_TYPE, eth_type); - if (ret) - return ret; -@@ -828,14 +872,36 @@ static void flower_print_ip_proto(FILE *f, __u8 *p_ip_proto, - } - - static void flower_print_matching_flags(FILE *f, char *name, -+ enum flower_matching_flags type, - struct rtattr *attr, - struct rtattr *mask_attr) - { -+ int i; -+ int count = 0; -+ __u32 mtf; -+ __u32 mtf_mask; -+ - if (!mask_attr || RTA_PAYLOAD(mask_attr) != 4) - return; - -- fprintf(f, "\n %s 0x%08x/0x%08x", name, ntohl(rta_getattr_u32(attr)), -- mask_attr ? ntohl(rta_getattr_u32(mask_attr)) : 0xffffffff); -+ mtf = ntohl(rta_getattr_u32(attr)); -+ mtf_mask = ntohl(rta_getattr_u32(mask_attr)); -+ -+ for (i = 0; i < ARRAY_SIZE(flags_str); i++) { -+ if (type != flags_str[i].type) -+ continue; -+ if (mtf_mask & flags_str[i].flag) { -+ if (++count == 1) -+ fprintf(f, "\n %s ", name); -+ else -+ fprintf(f, "/"); -+ -+ if (mtf & flags_str[i].flag) -+ fprintf(f, "%s", flags_str[i].string); -+ else -+ fprintf(f, "no%s", flags_str[i].string); -+ } -+ } - } - - static void flower_print_ip_addr(FILE *f, char *name, __be16 eth_type, -@@ -1034,7 +1100,8 @@ static int flower_print_opt(struct filter_util *qu, FILE *f, - flower_print_port(f, "enc_dst_port", - tb[TCA_FLOWER_KEY_ENC_UDP_DST_PORT]); - -- flower_print_matching_flags(f, "matching_flags", -+ flower_print_matching_flags(f, "ip_flags", -+ FLOWER_IP_FLAGS, - tb[TCA_FLOWER_KEY_FLAGS], - tb[TCA_FLOWER_KEY_FLAGS_MASK]); - --- -1.8.3.1 - diff --git a/SOURCES/0134-f_flower-don-t-set-TCA_FLOWER_KEY_ETH_TYPE-for-proto.patch b/SOURCES/0134-f_flower-don-t-set-TCA_FLOWER_KEY_ETH_TYPE-for-proto.patch deleted file mode 100644 index 411991d..0000000 --- a/SOURCES/0134-f_flower-don-t-set-TCA_FLOWER_KEY_ETH_TYPE-for-proto.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 7c616155a7a86024a60cc39e9b3e6981c4c9e7e2 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 13:24:36 +0100 -Subject: [PATCH] f_flower: don't set TCA_FLOWER_KEY_ETH_TYPE for "protocol - all" - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629 -Upstream Status: iproute2.git commit 4f7d406f5dc89 -Conflicts: Context change due to already backported commit 08f66c80c094e - ("tc: flower: Refactor matching flags to be more user - friendly"). - -commit 4f7d406f5dc89229d8aec8b723015c06db343e17 -Author: Benjamin LaHaise -Date: Fri Jan 20 14:07:38 2017 -0500 - - f_flower: don't set TCA_FLOWER_KEY_ETH_TYPE for "protocol all" - - v2 - update to address changes in 00697ca19ae3e1118f2af82c3b41ac4335fe918b. - - When using the tc flower filter, rules marked with "protocol all" do not - actually match all packets. This is due to a bug in f_flower.c that passes - in ETH_P_ALL in the TCA_FLOWER_KEY_ETH_TYPE attribute when adding a rule. - Fix this by omitting TCA_FLOWER_KEY_ETH_TYPE if the protocol is set to - ETH_P_ALL. - - Fixes: 488b41d020fb ("tc: flower no need to specify the ethertype") - Cc: Jamal Hadi Salim - Signed-off-by: Benjamin LaHaise - Signed-off-by: Benjamin LaHaise - Reviewed-by: Roi Dayan ---- - tc/f_flower.c | 8 +++++--- - 1 file changed, 5 insertions(+), 3 deletions(-) - -diff --git a/tc/f_flower.c b/tc/f_flower.c -index ddf64c2..58a34ce 100644 ---- a/tc/f_flower.c -+++ b/tc/f_flower.c -@@ -770,9 +770,11 @@ parse_done: - return ret; - } - -- ret = addattr16(n, MAX_MSG, TCA_FLOWER_KEY_ETH_TYPE, eth_type); -- if (ret) -- return ret; -+ if (eth_type != htons(ETH_P_ALL)) { -+ ret = addattr16(n, MAX_MSG, TCA_FLOWER_KEY_ETH_TYPE, eth_type); -+ if (ret) -+ return ret; -+ } - - tail->rta_len = (((void*)n)+n->nlmsg_len) - (void*)tail; - --- -1.8.3.1 - diff --git a/SOURCES/0135-tc-flower-use-correct-type-when-calling-flower_icmp_.patch b/SOURCES/0135-tc-flower-use-correct-type-when-calling-flower_icmp_.patch deleted file mode 100644 index 54f59b8..0000000 --- a/SOURCES/0135-tc-flower-use-correct-type-when-calling-flower_icmp_.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 16088fc85ab012a10eee1c855d2fd1318a5e2cb2 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 13:25:13 +0100 -Subject: [PATCH] tc: flower: use correct type when calling - flower_icmp_attr_type - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629 -Upstream Status: iproute2.git commit 81f6e5a7279ea - -commit 81f6e5a7279eaab826ba8b291b98fb2e89df0572 -Author: Simon Horman -Date: Wed Feb 8 13:04:31 2017 +0100 - - tc: flower: use correct type when calling flower_icmp_attr_type - - Use enum flower_icmp_field rather than bool as type of third parameter - when calling flower_icmp_attr_type. - - Fixes: eb3b5696f163 ("tc: flower: support matching on ICMP type and code") - Signed-off-by: Simon Horman ---- - tc/f_flower.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/tc/f_flower.c b/tc/f_flower.c -index 58a34ce..b4bf886 100644 ---- a/tc/f_flower.c -+++ b/tc/f_flower.c -@@ -1062,10 +1062,12 @@ static int flower_print_opt(struct filter_util *qu, FILE *f, - if (nl_type >= 0) - flower_print_port(f, "src_port", tb[nl_type]); - -- nl_type = flower_icmp_attr_type(eth_type, ip_proto, false); -+ nl_type = flower_icmp_attr_type(eth_type, ip_proto, -+ FLOWER_ICMP_FIELD_TYPE); - if (nl_type >= 0) - flower_print_icmp(f, "icmp_type", tb[nl_type]); -- nl_type = flower_icmp_attr_type(eth_type, ip_proto, true); -+ nl_type = flower_icmp_attr_type(eth_type, ip_proto, -+ FLOWER_ICMP_FIELD_CODE); - if (nl_type >= 0) - flower_print_icmp(f, "icmp_code", tb[nl_type]); - --- -1.8.3.1 - diff --git a/SOURCES/0136-tc-flower-Update-documentation-to-indicate-ARP-takes.patch b/SOURCES/0136-tc-flower-Update-documentation-to-indicate-ARP-takes.patch deleted file mode 100644 index 9989fe1..0000000 --- a/SOURCES/0136-tc-flower-Update-documentation-to-indicate-ARP-takes.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 7a735e3018eff5df906c64bb242db236320a9583 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 13:25:13 +0100 -Subject: [PATCH] tc: flower: Update documentation to indicate ARP takes IPv4 - prefixes - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629 -Upstream Status: iproute2.git commit c7ec052bb8682 - -commit c7ec052bb8682a9889d1e71e2cb2ec780c9d5e26 -Author: Simon Horman -Date: Wed Feb 8 13:01:04 2017 +0100 - - tc: flower: Update documentation to indicate ARP takes IPv4 prefixes - - Unlike other PREFIXes documented in the usage for tc flower, which accept - both IPv4 and IPv6 prefixes, arp_sip and arp_tip only accepts IPv4 - prefixes. - - Signed-off-by: Simon Horman ---- - man/man8/tc-flower.8 | 8 ++++---- - tc/f_flower.c | 4 ++-- - 2 files changed, 6 insertions(+), 6 deletions(-) - -diff --git a/man/man8/tc-flower.8 b/man/man8/tc-flower.8 -index 2bdd2ef..b1bef8b 100644 ---- a/man/man8/tc-flower.8 -+++ b/man/man8/tc-flower.8 -@@ -36,7 +36,7 @@ flower \- flow based traffic control filter - .BR dst_port " | " src_port " } " - .IR port_number " } | { " - .BR arp_tip " | " arp_sip " } " --.IR PREFIX " | " -+.IR IPV4_PREFIX " | " - .BR arp_op " { " request " | " reply " | " - .IR OP " } | { " - .BR arp_tha " | " arp_sha " } " -@@ -139,11 +139,11 @@ Match on ICMP type or code. Only available for - .BR ip_proto " values " icmp " and " icmpv6 - which have to be specified in beforehand. - .TP --.BI arp_tip " PREFIX" -+.BI arp_tip " IPV4_PREFIX" - .TQ --.BI arp_sip " PREFIX" -+.BI arp_sip " IPV4_PREFIX" - Match on ARP or RARP sender or target IP address. --.I PREFIX -+.I IPV4_PREFIX - must be a valid IPv4 address optionally followed by a slash and the prefix - length. If the prefix is missing, \fBtc\fR assumes a full-length host - match. -diff --git a/tc/f_flower.c b/tc/f_flower.c -index b4bf886..a2b2132 100644 ---- a/tc/f_flower.c -+++ b/tc/f_flower.c -@@ -59,8 +59,8 @@ static void explain(void) - " src_port PORT-NUMBER |\n" - " type ICMP-TYPE |\n" - " code ICMP-CODE |\n" -- " arp_tip PREFIX |\n" -- " arp_sip PREFIX |\n" -+ " arp_tip IPV4-PREFIX |\n" -+ " arp_sip IPV4-PREFIX |\n" - " arp_op [ request | reply | OP ] |\n" - " arp_tha MASKED-LLADDR |\n" - " arp_sha MASKED-LLADDR |\n" --- -1.8.3.1 - diff --git a/SOURCES/0137-tc-flower-provide-generic-masked-u8-parser-helper.patch b/SOURCES/0137-tc-flower-provide-generic-masked-u8-parser-helper.patch deleted file mode 100644 index 25bbcc8..0000000 --- a/SOURCES/0137-tc-flower-provide-generic-masked-u8-parser-helper.patch +++ /dev/null @@ -1,120 +0,0 @@ -From 468bed9790e23ca37ab4e1b52b012dd8b22df800 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 13:25:13 +0100 -Subject: [PATCH] tc: flower: provide generic masked u8 parser helper - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629 -Upstream Status: iproute2.git commit 180136e540ca1 - -commit 180136e540ca16826c0069644222878ea8236f93 -Author: Simon Horman -Date: Thu Feb 9 14:48:59 2017 +0100 - - tc: flower: provide generic masked u8 parser helper - - Provide generic masked u8 paser helper and use it to parse arp operations. - - Also consistently use __u8 rather than uint8_t, in keeping with the - pervasive style in the file. - - Signed-off-by: Simon Horman ---- - tc/f_flower.c | 55 ++++++++++++++++++++++++++++++++++++++++--------------- - 1 file changed, 40 insertions(+), 15 deletions(-) - -diff --git a/tc/f_flower.c b/tc/f_flower.c -index a2b2132..b233ec1 100644 ---- a/tc/f_flower.c -+++ b/tc/f_flower.c -@@ -309,33 +309,30 @@ static int flower_parse_arp_ip_addr(char *str, __be16 eth_type, - TCA_FLOWER_UNSPEC, TCA_FLOWER_UNSPEC, n); - } - --static int flower_parse_arp_op(char *str, __be16 eth_type, -- int op_type, int mask_type, -- struct nlmsghdr *n) -+static int flower_parse_u8(char *str, int value_type, int mask_type, -+ int (*value_from_name)(const char *str, -+ __u8 *value), -+ bool (*value_validate)(__u8 value), -+ struct nlmsghdr *n) - { - char *slash; - int ret, err = -1; -- uint8_t value, mask; -+ __u8 value, mask; - - slash = strchr(str, '/'); - if (slash) - *slash = '\0'; - -- if (!flower_eth_type_arp(eth_type)) -- goto err; -- -- if (!strcmp(str, "request")) { -- value = ARPOP_REQUEST; -- } else if (!strcmp(str, "reply")) { -- value = ARPOP_REPLY; -- } else { -+ ret = value_from_name ? value_from_name(str, &value) : -1; -+ if (ret < 0) { - ret = get_u8(&value, str, 10); - if (ret) - goto err; -- if (value && value != ARPOP_REQUEST && value != ARPOP_REPLY) -- goto err; - } - -+ if (value_validate && !value_validate(value)) -+ goto err; -+ - if (slash) { - ret = get_u8(&mask, slash + 1, 10); - if (ret) -@@ -345,7 +342,7 @@ static int flower_parse_arp_op(char *str, __be16 eth_type, - mask = UINT8_MAX; - } - -- addattr8(n, MAX_MSG, op_type, value); -+ addattr8(n, MAX_MSG, value_type, value); - addattr8(n, MAX_MSG, mask_type, mask); - - err = 0; -@@ -355,6 +352,34 @@ err: - return err; - } - -+static int flower_arp_op_from_name(const char *name, __u8 *op) -+{ -+ if (!strcmp(name, "request")) -+ *op = ARPOP_REQUEST; -+ else if (!strcmp(name, "reply")) -+ *op = ARPOP_REPLY; -+ else -+ return -1; -+ -+ return 0; -+} -+ -+static bool flow_arp_op_validate(__u8 op) -+{ -+ return !op || op == ARPOP_REQUEST || op == ARPOP_REPLY; -+} -+ -+static int flower_parse_arp_op(char *str, __be16 eth_type, -+ int op_type, int mask_type, -+ struct nlmsghdr *n) -+{ -+ if (!flower_eth_type_arp(eth_type)) -+ return -1; -+ -+ return flower_parse_u8(str, op_type, mask_type, flower_arp_op_from_name, -+ flow_arp_op_validate, n); -+} -+ - static int flower_icmp_attr_type(__be16 eth_type, __u8 ip_proto, - enum flower_icmp_field field) - { --- -1.8.3.1 - diff --git a/SOURCES/0138-tc-flower-provide-generic-masked-u8-print-helper.patch b/SOURCES/0138-tc-flower-provide-generic-masked-u8-print-helper.patch deleted file mode 100644 index 0f02b92..0000000 --- a/SOURCES/0138-tc-flower-provide-generic-masked-u8-print-helper.patch +++ /dev/null @@ -1,105 +0,0 @@ -From bfbb2c88f986f3e6145cbdb213d8cd4129bb0e87 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 13:25:13 +0100 -Subject: [PATCH] tc: flower: provide generic masked u8 print helper - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629 -Upstream Status: iproute2.git commit 9d36e54f36b83 - -commit 9d36e54f36b8360766519bba79028aeb9ec3a762 -Author: Simon Horman -Date: Thu Feb 9 14:49:00 2017 +0100 - - tc: flower: provide generic masked u8 print helper - - Provide generic masked u8 print helper and use it to print arp operations. - - Also: - * Make name parameter of arp op print helper const. - * Consistently use __u8 rather than uint8_t, in keeping with the - pervasive style in the file. - - Signed-off-by: Simon Horman ---- - tc/f_flower.c | 44 +++++++++++++++++++++++++++++++++----------- - 1 file changed, 33 insertions(+), 11 deletions(-) - -diff --git a/tc/f_flower.c b/tc/f_flower.c -index b233ec1..9c13e53 100644 ---- a/tc/f_flower.c -+++ b/tc/f_flower.c -@@ -352,6 +352,18 @@ err: - return err; - } - -+static const char *flower_print_arp_op_to_name(__u8 op) -+{ -+ switch (op) { -+ case ARPOP_REQUEST: -+ return "request"; -+ case ARPOP_REPLY: -+ return "reply"; -+ default: -+ return NULL; -+ } -+} -+ - static int flower_arp_op_from_name(const char *name, __u8 *op) - { - if (!strcmp(name, "request")) -@@ -994,31 +1006,41 @@ static void flower_print_icmp(FILE *f, char *name, struct rtattr *attr) - fprintf(f, "\n %s %d", name, rta_getattr_u8(attr)); - } - --static void flower_print_arp_op(FILE *f, char *name, -- struct rtattr *op_attr, -- struct rtattr *mask_attr) -+static void flower_print_masked_u8(FILE *f, const char *name, -+ struct rtattr *attr, -+ struct rtattr *mask_attr, -+ const char *(*value_to_str)(__u8 value)) - { -- uint8_t op, mask; -+ const char *value_str = NULL; -+ __u8 value, mask; - -- if (!op_attr) -+ if (!attr) - return; - -- op = rta_getattr_u8(op_attr); -+ value = rta_getattr_u8(attr); - mask = mask_attr ? rta_getattr_u8(mask_attr) : UINT8_MAX; -+ if (mask == UINT8_MAX && value_to_str) -+ value_str = value_to_str(value); - - fprintf(f, "\n %s ", name); - -- if (mask == UINT8_MAX && op == ARPOP_REQUEST) -- fprintf(f, "request"); -- else if (mask == UINT8_MAX && op == ARPOP_REPLY) -- fprintf(f, "reply"); -+ if (value_str) -+ fputs(value_str, f); - else -- fprintf(f, "%d", op); -+ fprintf(f, "%d", value); - - if (mask != UINT8_MAX) - fprintf(f, "/%d", mask); - } - -+static void flower_print_arp_op(FILE *f, const char *name, -+ struct rtattr *op_attr, -+ struct rtattr *mask_attr) -+{ -+ flower_print_masked_u8(f, name, op_attr, mask_attr, -+ flower_print_arp_op_to_name); -+} -+ - static int flower_print_opt(struct filter_util *qu, FILE *f, - struct rtattr *opt, __u32 handle) - { --- -1.8.3.1 - diff --git a/SOURCES/0139-tc-flower-support-masked-ICMP-code-and-type-match.patch b/SOURCES/0139-tc-flower-support-masked-ICMP-code-and-type-match.patch deleted file mode 100644 index aeeaeac..0000000 --- a/SOURCES/0139-tc-flower-support-masked-ICMP-code-and-type-match.patch +++ /dev/null @@ -1,174 +0,0 @@ -From aa7beedaa4ac1371c1d08e8afc8d9b6cfd72e22e Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 13:25:13 +0100 -Subject: [PATCH] tc: flower: support masked ICMP code and type match - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629 -Upstream Status: iproute2.git commit 6374961a00d4b - -commit 6374961a00d4b862bdf87c0f22af86d3ff7d0d67 -Author: Simon Horman -Date: Thu Feb 9 14:49:01 2017 +0100 - - tc: flower: support masked ICMP code and type match - - Extend ICMP code and type match to support masks. - - Also add missing documentation to synopsis in manpage. - - tc qdisc add dev eth0 ingress - tc filter add dev eth0 protocol ipv6 parent ffff: flower \ - indev eth0 ip_proto icmpv6 type 128/240 code 0 action drop - - Signed-off-by: Simon Horman ---- - man/man8/tc-flower.8 | 16 ++++++++++---- - tc/f_flower.c | 59 ++++++++++++++++++++++++++++++---------------------- - 2 files changed, 46 insertions(+), 29 deletions(-) - -diff --git a/man/man8/tc-flower.8 b/man/man8/tc-flower.8 -index b1bef8b..fc5bac5 100644 ---- a/man/man8/tc-flower.8 -+++ b/man/man8/tc-flower.8 -@@ -34,7 +34,11 @@ flower \- flow based traffic control filter - .BR dst_ip " | " src_ip " } " - .IR PREFIX " | { " - .BR dst_port " | " src_port " } " --.IR port_number " } | { " -+.IR port_number " } | " -+.B type -+.IR MASKED_TYPE " | " -+.B code -+.IR MASKED_CODE " | { " - .BR arp_tip " | " arp_sip " } " - .IR IPV4_PREFIX " | " - .BR arp_op " { " request " | " reply " | " -@@ -132,10 +136,14 @@ Match on layer 4 protocol source or destination port number. Only available for - .BR ip_proto " values " udp ", " tcp " and " sctp - which have to be specified in beforehand. - .TP --.BI type " NUMBER" -+.BI type " MASKED_TYPE" - .TQ --.BI code " NUMBER" --Match on ICMP type or code. Only available for -+.BI code " MASKED_CODE" -+Match on ICMP type or code. A mask may be optionally provided to limit the -+bits of the address which are matched. A mask is provided by following the -+address with a slash and then the mask. The mask must be as a number which -+represents a bitwise mask If the mask is missing then a match on all bits -+is assumed. Only available for - .BR ip_proto " values " icmp " and " icmpv6 - which have to be specified in beforehand. - .TP -diff --git a/tc/f_flower.c b/tc/f_flower.c -index 9c13e53..e9d3a96 100644 ---- a/tc/f_flower.c -+++ b/tc/f_flower.c -@@ -57,8 +57,8 @@ static void explain(void) - " src_ip PREFIX |\n" - " dst_port PORT-NUMBER |\n" - " src_port PORT-NUMBER |\n" -- " type ICMP-TYPE |\n" -- " code ICMP-CODE |\n" -+ " type MASKED-ICMP-TYPE |\n" -+ " code MASKED-ICMP-CODE |\n" - " arp_tip IPV4-PREFIX |\n" - " arp_sip IPV4-PREFIX |\n" - " arp_op [ request | reply | OP ] |\n" -@@ -407,24 +407,32 @@ static int flower_icmp_attr_type(__be16 eth_type, __u8 ip_proto, - return -1; - } - -+static int flower_icmp_attr_mask_type(__be16 eth_type, __u8 ip_proto, -+ enum flower_icmp_field field) -+{ -+ if (eth_type == htons(ETH_P_IP) && ip_proto == IPPROTO_ICMP) -+ return field == FLOWER_ICMP_FIELD_CODE ? -+ TCA_FLOWER_KEY_ICMPV4_CODE_MASK : -+ TCA_FLOWER_KEY_ICMPV4_TYPE_MASK; -+ else if (eth_type == htons(ETH_P_IPV6) && ip_proto == IPPROTO_ICMPV6) -+ return field == FLOWER_ICMP_FIELD_CODE ? -+ TCA_FLOWER_KEY_ICMPV6_CODE_MASK : -+ TCA_FLOWER_KEY_ICMPV6_TYPE_MASK; -+ -+ return -1; -+} -+ - static int flower_parse_icmp(char *str, __u16 eth_type, __u8 ip_proto, - enum flower_icmp_field field, struct nlmsghdr *n) - { -- int ret; -- int type; -- uint8_t value; -- -- type = flower_icmp_attr_type(eth_type, ip_proto, field); -- if (type < 0) -- return -1; -+ int value_type, mask_type; - -- ret = get_u8(&value, str, 10); -- if (ret) -+ value_type = flower_icmp_attr_type(eth_type, ip_proto, field); -+ mask_type = flower_icmp_attr_mask_type(eth_type, ip_proto, field); -+ if (value_type < 0 || mask_type < 0) - return -1; - -- addattr8(n, MAX_MSG, type, value); -- -- return 0; -+ return flower_parse_u8(str, value_type, mask_type, NULL, NULL, n); - } - - static int flower_port_attr_type(__u8 ip_proto, enum flower_endpoint endpoint) -@@ -1000,12 +1008,6 @@ static void flower_print_key_id(FILE *f, const char *name, - fprintf(f, "\n %s %d", name, rta_getattr_be32(attr)); - } - --static void flower_print_icmp(FILE *f, char *name, struct rtattr *attr) --{ -- if (attr) -- fprintf(f, "\n %s %d", name, rta_getattr_u8(attr)); --} -- - static void flower_print_masked_u8(FILE *f, const char *name, - struct rtattr *attr, - struct rtattr *mask_attr, -@@ -1045,9 +1047,9 @@ static int flower_print_opt(struct filter_util *qu, FILE *f, - struct rtattr *opt, __u32 handle) - { - struct rtattr *tb[TCA_FLOWER_MAX + 1]; -+ int nl_type, nl_mask_type; - __be16 eth_type = 0; - __u8 ip_proto = 0xff; -- int nl_type; - - if (!opt) - return 0; -@@ -1111,12 +1113,19 @@ static int flower_print_opt(struct filter_util *qu, FILE *f, - - nl_type = flower_icmp_attr_type(eth_type, ip_proto, - FLOWER_ICMP_FIELD_TYPE); -- if (nl_type >= 0) -- flower_print_icmp(f, "icmp_type", tb[nl_type]); -+ nl_mask_type = flower_icmp_attr_mask_type(eth_type, ip_proto, -+ FLOWER_ICMP_FIELD_TYPE); -+ if (nl_type >= 0 && nl_mask_type >= 0) -+ flower_print_masked_u8(f, "icmp_type", tb[nl_type], -+ tb[nl_mask_type], NULL); -+ - nl_type = flower_icmp_attr_type(eth_type, ip_proto, - FLOWER_ICMP_FIELD_CODE); -- if (nl_type >= 0) -- flower_print_icmp(f, "icmp_code", tb[nl_type]); -+ nl_mask_type = flower_icmp_attr_mask_type(eth_type, ip_proto, -+ FLOWER_ICMP_FIELD_CODE); -+ if (nl_type >= 0 && nl_mask_type >= 0) -+ flower_print_masked_u8(f, "icmp_code", tb[nl_type], -+ tb[nl_mask_type], NULL); - - flower_print_ip4_addr(f, "arp_sip", tb[TCA_FLOWER_KEY_ARP_SIP], - tb[TCA_FLOWER_KEY_ARP_SIP_MASK]); --- -1.8.3.1 - diff --git a/SOURCES/0140-tc-flower-Fix-parsing-ip-address.patch b/SOURCES/0140-tc-flower-Fix-parsing-ip-address.patch deleted file mode 100644 index 3af9eef..0000000 --- a/SOURCES/0140-tc-flower-Fix-parsing-ip-address.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 08968eb2bfd306b4150e8531f799adee6a11966c Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 13:25:13 +0100 -Subject: [PATCH] tc: flower: Fix parsing ip address - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629 -Upstream Status: iproute2.git commit 164a9ff401e58 - -commit 164a9ff401e58ff9c0b90088a3aa96216e1d6e8a -Author: Roi Dayan -Date: Wed Feb 22 16:05:01 2017 +0200 - - tc: flower: Fix parsing ip address - - Fix order of arguments when passed to __flower_parse_ip_addr. - - Fixes: ("f888f4e20534 tc: flower: Support matching ARP") - Signed-off-by: Roi Dayan - Reviewed-by: Paul Blakey - Reviewed-by: Simon Horman ---- - tc/f_flower.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/tc/f_flower.c b/tc/f_flower.c -index e9d3a96..17e9b3a 100644 ---- a/tc/f_flower.c -+++ b/tc/f_flower.c -@@ -289,8 +289,8 @@ static int flower_parse_ip_addr(char *str, __be16 eth_type, - return -1; - } - -- return __flower_parse_ip_addr(str, family, addr4_type, addr6_type, -- mask4_type, mask6_type, n); -+ return __flower_parse_ip_addr(str, family, addr4_type, mask4_type, -+ addr6_type, mask6_type, n); - } - - static bool flower_eth_type_arp(__be16 eth_type) --- -1.8.3.1 - diff --git a/SOURCES/0141-libgenl-introduce-genl_init_handle.patch b/SOURCES/0141-libgenl-introduce-genl_init_handle.patch deleted file mode 100644 index e69e177..0000000 --- a/SOURCES/0141-libgenl-introduce-genl_init_handle.patch +++ /dev/null @@ -1,154 +0,0 @@ -From 734c47bbe6a885923d52be91e8aaddfccaa182f5 Mon Sep 17 00:00:00 2001 -From: Timothy Redaelli -Date: Fri, 10 Feb 2017 12:51:08 +0100 -Subject: [PATCH] libgenl: introduce genl_init_handle - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1367071 -Upstream Status: iproute2.git commit 2b68cb7 -Conflicts: ip/ipfou.c and ip/ipila.c files doesn't exists in our tree - -commit 2b68cb77cde32f5cba5f984e15fc402758edea76 -Author: Sabrina Dubroca -Date: Tue Aug 16 16:26:55 2016 +0200 - - libgenl: introduce genl_init_handle - - All users of genl have the same code to open a genl socket and resolve - the family for their specific protocol. Introduce a helper to initialize - the handle, and use it in all the genl code. - - Signed-off-by: Sabrina Dubroca - -Signed-off-by: Timothy Redaelli ---- - include/libgenl.h | 2 ++ - ip/ipl2tp.c | 12 ++---------- - ip/ipmacsec.c | 18 ++---------------- - ip/tcp_metrics.c | 14 +++----------- - lib/libgenl.c | 17 +++++++++++++++++ - 5 files changed, 26 insertions(+), 37 deletions(-) - -diff --git a/include/libgenl.h b/include/libgenl.h -index 9db4baf..2dbb4b3 100644 ---- a/include/libgenl.h -+++ b/include/libgenl.h -@@ -21,5 +21,7 @@ struct { \ - } - - extern int genl_resolve_family(struct rtnl_handle *grth, const char *family); -+extern int genl_init_handle(struct rtnl_handle *grth, const char *family, -+ int *genl_family); - - #endif /* __LIBGENL_H__ */ -diff --git a/ip/ipl2tp.c b/ip/ipl2tp.c -index d2c8979..ced4a8b 100644 ---- a/ip/ipl2tp.c -+++ b/ip/ipl2tp.c -@@ -711,16 +711,8 @@ int do_ipl2tp(int argc, char **argv) - if (argc < 1 || !matches(*argv, "help")) - usage(); - -- if (genl_family < 0) { -- if (rtnl_open_byproto(&genl_rth, 0, NETLINK_GENERIC) < 0) { -- fprintf(stderr, "Cannot open generic netlink socket\n"); -- exit(1); -- } -- -- genl_family = genl_resolve_family(&genl_rth, L2TP_GENL_NAME); -- if (genl_family < 0) -- exit(1); -- } -+ if (genl_init_handle(&genl_rth, L2TP_GENL_NAME, &genl_family)) -+ exit(1); - - if (matches(*argv, "add") == 0) - return do_add(argc-1, argv+1); -diff --git a/ip/ipmacsec.c b/ip/ipmacsec.c -index 0c51bfc..f05b27a 100644 ---- a/ip/ipmacsec.c -+++ b/ip/ipmacsec.c -@@ -79,21 +79,6 @@ static int genl_family = -1; - _cmd, _flags) - - --static void init_genl(void) --{ -- if (genl_family >= 0) -- return; -- -- if (rtnl_open_byproto(&genl_rth, 0, NETLINK_GENERIC) < 0) { -- fprintf(stderr, "Cannot open generic netlink socket\n"); -- exit(1); -- } -- -- genl_family = genl_resolve_family(&genl_rth, MACSEC_GENL_NAME); -- if (genl_family < 0) -- exit(1); --} -- - static void ipmacsec_usage(void) - { - fprintf(stderr, "Usage: ip macsec add DEV tx sa { 0..3 } [ OPTS ] key ID KEY\n"); -@@ -1001,7 +986,8 @@ static int do_show(int argc, char **argv) - - int do_ipmacsec(int argc, char **argv) - { -- init_genl(); -+ if (genl_init_handle(&genl_rth, MACSEC_GENL_NAME, &genl_family)) -+ exit(1); - - if (argc < 1) - ipmacsec_usage(); -diff --git a/ip/tcp_metrics.c b/ip/tcp_metrics.c -index c55d9ad..b055288 100644 ---- a/ip/tcp_metrics.c -+++ b/ip/tcp_metrics.c -@@ -320,17 +320,9 @@ static int tcpm_do_cmd(int cmd, int argc, char **argv) - ack = 0; - } - -- if (genl_family < 0) { -- if (rtnl_open_byproto(&grth, 0, NETLINK_GENERIC) < 0) { -- fprintf(stderr, "Cannot open generic netlink socket\n"); -- exit(1); -- } -- genl_family = genl_resolve_family(&grth, -- TCP_METRICS_GENL_NAME); -- if (genl_family < 0) -- exit(1); -- req.n.nlmsg_type = genl_family; -- } -+ if (genl_init_handle(&grth, TCP_METRICS_GENL_NAME, &genl_family)) -+ exit(1); -+ req.n.nlmsg_type = genl_family; - - if (!(cmd & CMD_FLUSH) && (atype >= 0 || (cmd & CMD_DEL))) { - if (ack) -diff --git a/lib/libgenl.c b/lib/libgenl.c -index acb1478..50d2d92 100644 ---- a/lib/libgenl.c -+++ b/lib/libgenl.c -@@ -61,3 +61,20 @@ int genl_resolve_family(struct rtnl_handle *grth, const char *family) - return genl_parse_getfamily(&req.n); - } - -+int genl_init_handle(struct rtnl_handle *grth, const char *family, -+ int *genl_family) -+{ -+ if (*genl_family >= 0) -+ return 0; -+ -+ if (rtnl_open_byproto(grth, 0, NETLINK_GENERIC) < 0) { -+ fprintf(stderr, "Cannot open generic netlink socket\n"); -+ return -1; -+ } -+ -+ *genl_family = genl_resolve_family(grth, family); -+ if (*genl_family < 0) -+ return -1; -+ -+ return 0; -+} --- -1.8.3.1 - diff --git a/SOURCES/0142-macsec-show-usage-even-if-the-module-is-not-availabl.patch b/SOURCES/0142-macsec-show-usage-even-if-the-module-is-not-availabl.patch deleted file mode 100644 index 03c1cfe..0000000 --- a/SOURCES/0142-macsec-show-usage-even-if-the-module-is-not-availabl.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 42a4461854ab308ebcebb99df7085e1e896f8fa5 Mon Sep 17 00:00:00 2001 -From: Timothy Redaelli -Date: Fri, 10 Feb 2017 12:51:09 +0100 -Subject: [PATCH] macsec: show usage even if the module is not available - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1367071 -Upstream Status: iproute2.git commit 688f9aa - -commit 688f9aa4f24ffac148f6b4127602f10a7837d4ba -Author: Sabrina Dubroca -Date: Tue Aug 16 16:26:56 2016 +0200 - - macsec: show usage even if the module is not available - - Currently, the `ip macsec` command tries to initialize a genl context - even when we just want to see the help for the command, which doesn't - require to talk to the kernel at all. - - Delay genl initialization, which can fail if the module isn't loaded, - until the point where we will actually need it. - - Fixes: b26fc590ce62 ("ip: add MACsec support") - Signed-off-by: Sabrina Dubroca - -Signed-off-by: Timothy Redaelli ---- - ip/ipmacsec.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/ip/ipmacsec.c b/ip/ipmacsec.c -index f05b27a..127fa1e 100644 ---- a/ip/ipmacsec.c -+++ b/ip/ipmacsec.c -@@ -986,15 +986,15 @@ static int do_show(int argc, char **argv) - - int do_ipmacsec(int argc, char **argv) - { -- if (genl_init_handle(&genl_rth, MACSEC_GENL_NAME, &genl_family)) -- exit(1); -- - if (argc < 1) - ipmacsec_usage(); - - if (matches(*argv, "help") == 0) - ipmacsec_usage(); - -+ if (genl_init_handle(&genl_rth, MACSEC_GENL_NAME, &genl_family)) -+ exit(1); -+ - if (matches(*argv, "show") == 0) - return do_show(argc-1, argv+1); - --- -1.8.3.1 - diff --git a/SOURCES/0143-tc-don-t-accept-qdisc-handle-greater-than-ffff.patch b/SOURCES/0143-tc-don-t-accept-qdisc-handle-greater-than-ffff.patch deleted file mode 100644 index d7d596c..0000000 --- a/SOURCES/0143-tc-don-t-accept-qdisc-handle-greater-than-ffff.patch +++ /dev/null @@ -1,44 +0,0 @@ -From d97d0e6a5201c5c7d5a2019bd3c3a29b3b78d7d4 Mon Sep 17 00:00:00 2001 -From: Davide Caratti -Date: Tue, 17 Jan 2017 14:40:44 +0100 -Subject: [PATCH] tc: don't accept qdisc 'handle' greater than ffff - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1375393 -Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=12376479 -Tested: on local VM (verified error message in case 'handle' is greater than ffff) -Upstream Status: iproute2.git commit 087dec7fcfb1 - -commit 087dec7fcfb18fc4e8a0ec68c9c0a84cb9f03e69 -Author: Davide Caratti -Date: Fri Sep 16 10:30:00 2016 +0200 - - tc: don't accept qdisc 'handle' greater than ffff - - since get_qdisc_handle() truncates the input value to 16 bit, return an - error and prompt "invalid qdisc ID" in case input 'handle' parameter needs - more than 16 bit to be stored. - - Signed-off-by: Davide Caratti - Acked-by: Phil Sutter - -Signed-off-by: Davide Caratti ---- - tc/tc_util.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tc/tc_util.c b/tc/tc_util.c -index 8114c97..df81c46 100644 ---- a/tc/tc_util.c -+++ b/tc/tc_util.c -@@ -48,7 +48,7 @@ int get_qdisc_handle(__u32 *h, const char *str) - if (strcmp(str, "none") == 0) - goto ok; - maj = strtoul(str, &p, 16); -- if (p == str) -+ if (p == str || maj >= (1 << 16)) - return -1; - maj <<= 16; - if (*p != ':' && *p!=0) --- -1.8.3.1 - diff --git a/SOURCES/0144-ip-address-Support-filtering-by-slave-type-too.patch b/SOURCES/0144-ip-address-Support-filtering-by-slave-type-too.patch deleted file mode 100644 index 71c191c..0000000 --- a/SOURCES/0144-ip-address-Support-filtering-by-slave-type-too.patch +++ /dev/null @@ -1,117 +0,0 @@ -From eff77a8493746b837f0a544cab5bcc87870fe9f6 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 13:38:43 +0100 -Subject: [PATCH] ip-address: Support filtering by slave type, too - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1375434 -Upstream Status: iproute2.git commit e0513807f6dbb -Conflicts: Dropped changes to non-existent print_linkinfo_brief(). - -commit e0513807f6dbbd4631fdbb27f0bd6bbce138e8cd -Author: Phil Sutter -Date: Tue Jun 28 15:07:16 2016 +0200 - - ip-address: Support filtering by slave type, too - - This patch allows to query all interfaces enslaved to a bridge or bond - using the following syntax: - - | ip addr show type bridge_slave - - Filtering has to be done in userspace since the kernel does not support - filtering on IFLA_INFO_SLAVE_KIND. - - Functionality introduced in this patch is not fully complete since it - does not allow to match on type and slave type at the same time, but it - doesn't prevent implementing a dedicated slave_type match, either. - - Signed-off-by: Phil Sutter ---- - ip/ipaddress.c | 39 ++++++++++++++++++++++++++------------- - 1 file changed, 26 insertions(+), 13 deletions(-) - -diff --git a/ip/ipaddress.c b/ip/ipaddress.c -index 5f08cde..fe04a28 100644 ---- a/ip/ipaddress.c -+++ b/ip/ipaddress.c -@@ -59,6 +59,7 @@ static struct - int group; - int master; - char *kind; -+ char *slave_kind; - } filter; - - static int do_link; -@@ -198,18 +199,27 @@ static void print_linkmode(FILE *f, struct rtattr *tb) - fprintf(f, "mode %s ", link_modes[mode]); - } - --static char *parse_link_kind(struct rtattr *tb) -+static char *parse_link_kind(struct rtattr *tb, bool slave) - { - struct rtattr *linkinfo[IFLA_INFO_MAX+1]; -+ int attr = slave ? IFLA_INFO_SLAVE_KIND : IFLA_INFO_KIND; - - parse_rtattr_nested(linkinfo, IFLA_INFO_MAX, tb); - -- if (linkinfo[IFLA_INFO_KIND]) -- return RTA_DATA(linkinfo[IFLA_INFO_KIND]); -+ if (linkinfo[attr]) -+ return RTA_DATA(linkinfo[attr]); - - return ""; - } - -+static int match_link_kind(struct rtattr **tb, char *kind, bool slave) -+{ -+ if (!tb[IFLA_LINKINFO]) -+ return -1; -+ -+ return strcmp(parse_link_kind(tb[IFLA_LINKINFO], slave), kind); -+} -+ - static void print_linktype(FILE *fp, struct rtattr *tb) - { - struct rtattr *linkinfo[IFLA_INFO_MAX+1]; -@@ -590,16 +600,11 @@ int print_linkinfo(const struct sockaddr_nl *who, - else if (filter.master > 0) - return -1; - -- if (filter.kind) { -- if (tb[IFLA_LINKINFO]) { -- char *kind = parse_link_kind(tb[IFLA_LINKINFO]); -+ if (filter.kind && match_link_kind(tb, filter.kind, 0)) -+ return -1; - -- if (strcmp(kind, filter.kind)) -- return -1; -- } else { -- return -1; -- } -- } -+ if (filter.slave_kind && match_link_kind(tb, filter.slave_kind, 1)) -+ return -1; - - if (n->nlmsg_type == RTM_DELLINK) - fprintf(fp, "Deleted "); -@@ -1357,8 +1362,16 @@ static int ipaddr_list_flush_or_save(int argc, char **argv, int action) - invarg("Device does not exist\n", *argv); - filter.master = ifindex; - } else if (strcmp(*argv, "type") == 0) { -+ int soff; -+ - NEXT_ARG(); -- filter.kind = *argv; -+ soff = strlen(*argv) - strlen("_slave"); -+ if (!strcmp(*argv + soff, "_slave")) { -+ (*argv)[soff] = '\0'; -+ filter.slave_kind = *argv; -+ } else { -+ filter.kind = *argv; -+ } - } else { - if (strcmp(*argv, "dev") == 0) { - NEXT_ARG(); --- -1.8.3.1 - diff --git a/SOURCES/0145-man-ss.8-Add-missing-protocols-to-description-of-A.patch b/SOURCES/0145-man-ss.8-Add-missing-protocols-to-description-of-A.patch deleted file mode 100644 index 726fc68..0000000 --- a/SOURCES/0145-man-ss.8-Add-missing-protocols-to-description-of-A.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 08d8450413afec2eb9772293dbe9951b1704931a Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Fri, 17 Mar 2017 16:51:07 +0100 -Subject: [PATCH] man: ss.8: Add missing protocols to description of -A - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1063934 -Upstream Status: iproute2.git commit 32b1a12713a95 - -commit 32b1a12713a95794159630d5cf67ee86d11161d9 -Author: Phil Sutter -Date: Thu Mar 9 17:07:33 2017 +0100 - - man: ss.8: Add missing protocols to description of -A - - The list was missing dccp and sctp protocols. - - Signed-off-by: Phil Sutter ---- - man/man8/ss.8 | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/man/man8/ss.8 b/man/man8/ss.8 -index b02a68c..c955a1d 100644 ---- a/man/man8/ss.8 -+++ b/man/man8/ss.8 -@@ -124,7 +124,7 @@ Currently the following families are supported: unix, inet, inet6, link, netlink - .B \-A QUERY, \-\-query=QUERY, \-\-socket=QUERY - List of socket tables to dump, separated by commas. The following identifiers - are understood: all, inet, tcp, udp, raw, unix, packet, netlink, unix_dgram, --unix_stream, unix_seqpacket, packet_raw, packet_dgram. -+unix_stream, unix_seqpacket, packet_raw, packet_dgram, dccp, sctp. - .TP - .B \-D FILE, \-\-diag=FILE - Do not display anything, just dump raw information about TCP sockets to FILE after applying filters. If FILE is - stdout is used. --- -1.8.3.1 - diff --git a/SOURCES/0146-xfrm-add-support-of-ESN-and-anti-replay-window.patch b/SOURCES/0146-xfrm-add-support-of-ESN-and-anti-replay-window.patch deleted file mode 100644 index 0b8e4d9..0000000 --- a/SOURCES/0146-xfrm-add-support-of-ESN-and-anti-replay-window.patch +++ /dev/null @@ -1,221 +0,0 @@ -From 438595db1cfbb23a85f68d2a573a9f35083bc3ee Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Mon, 27 Mar 2017 13:11:34 +0200 -Subject: [PATCH] xfrm: add support of ESN and anti-replay window - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1425059 -Upstream Status: iproute2.git commit 0151b56d10296 - -commit 0151b56d102961c1418aea3ee53428d4ca2669c9 -Author: dingzhi -Date: Mon Oct 20 11:23:04 2014 +0200 - - xfrm: add support of ESN and anti-replay window - - This patch allows to configure ESN and anti-replay window. - - Signed-off-by: dingzhi - Signed-off-by: Adrien Mazarguil - Signed-off-by: Nicolas Dichtel ---- - ip/ipxfrm.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ - ip/xfrm_state.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++------- - 2 files changed, 109 insertions(+), 7 deletions(-) - -diff --git a/ip/ipxfrm.c b/ip/ipxfrm.c -index 899ec9d..fd3e645 100644 ---- a/ip/ipxfrm.c -+++ b/ip/ipxfrm.c -@@ -795,6 +795,62 @@ void xfrm_xfrma_print(struct rtattr *tb[], __u16 family, - fprintf(fp, "%s", _SL_); - } - -+ if (tb[XFRMA_REPLAY_VAL]) { -+ struct xfrm_replay_state *replay; -+ -+ if (prefix) -+ fputs(prefix, fp); -+ fprintf(fp, "anti-replay context: "); -+ -+ if (RTA_PAYLOAD(tb[XFRMA_REPLAY_VAL]) < sizeof(*replay)) { -+ fprintf(fp, "(ERROR truncated)"); -+ fprintf(fp, "%s", _SL_); -+ return; -+ } -+ -+ replay = (struct xfrm_replay_state *)RTA_DATA(tb[XFRMA_REPLAY_VAL]); -+ fprintf(fp, "seq 0x%x, oseq 0x%x, bitmap 0x%08x", -+ replay->seq, replay->oseq, replay->bitmap); -+ fprintf(fp, "%s", _SL_); -+ } -+ -+ if (tb[XFRMA_REPLAY_ESN_VAL]) { -+ struct xfrm_replay_state_esn *replay; -+ unsigned int i, j; -+ -+ if (prefix) -+ fputs(prefix, fp); -+ fprintf(fp, "anti-replay esn context:"); -+ -+ if (RTA_PAYLOAD(tb[XFRMA_REPLAY_ESN_VAL]) < sizeof(*replay)) { -+ fprintf(fp, "(ERROR truncated)"); -+ fprintf(fp, "%s", _SL_); -+ return; -+ } -+ fprintf(fp, "%s", _SL_); -+ -+ replay = (struct xfrm_replay_state_esn *)RTA_DATA(tb[XFRMA_REPLAY_ESN_VAL]); -+ if (prefix) -+ fputs(prefix, fp); -+ fprintf(fp, " seq-hi 0x%x, seq 0x%x, oseq-hi 0x%0x, oseq 0x%0x", -+ replay->seq_hi, replay->seq, replay->oseq_hi, -+ replay->oseq); -+ fprintf(fp, "%s", _SL_); -+ if (prefix) -+ fputs(prefix, fp); -+ fprintf(fp, " replay_window %u, bitmap-length %u", -+ replay->replay_window, replay->bmp_len); -+ for (i = replay->bmp_len, j = 0; i; i--) { -+ if (j++ % 8 == 0) { -+ fprintf(fp, "%s", _SL_); -+ if (prefix) -+ fputs(prefix, fp); -+ fprintf(fp, " "); -+ } -+ fprintf(fp, "%08x ", replay->bmp[i - 1]); -+ } -+ fprintf(fp, "%s", _SL_); -+ } - } - - static int xfrm_selector_iszero(struct xfrm_selector *s) -@@ -838,6 +894,7 @@ void xfrm_state_info_print(struct xfrm_usersa_info *xsinfo, - XFRM_FLAG_PRINT(fp, flags, XFRM_STATE_ICMP, "icmp"); - XFRM_FLAG_PRINT(fp, flags, XFRM_STATE_AF_UNSPEC, "af-unspec"); - XFRM_FLAG_PRINT(fp, flags, XFRM_STATE_ALIGN4, "align4"); -+ XFRM_FLAG_PRINT(fp, flags, XFRM_STATE_ESN, "esn"); - if (flags) - fprintf(fp, "%x", flags); - } -diff --git a/ip/xfrm_state.c b/ip/xfrm_state.c -index 4dfddbc..d01f8ad 100644 ---- a/ip/xfrm_state.c -+++ b/ip/xfrm_state.c -@@ -59,6 +59,7 @@ static void usage(void) - fprintf(stderr, "Usage: ip xfrm state { add | update } ID [ ALGO-LIST ] [ mode MODE ]\n"); - fprintf(stderr, " [ mark MARK [ mask MASK ] ] [ reqid REQID ] [ seq SEQ ]\n"); - fprintf(stderr, " [ replay-window SIZE ] [ replay-seq SEQ ] [ replay-oseq SEQ ]\n"); -+ fprintf(stderr, " [ replay-seq-hi SEQ ] [ replay-oseq-hi SEQ ]\n"); - fprintf(stderr, " [ flag FLAG-LIST ] [ sel SELECTOR ] [ LIMIT-LIST ] [ encap ENCAP ]\n"); - fprintf(stderr, " [ coa ADDR[/PLEN] ] [ ctx CTX ] [ extra-flag EXTRA-FLAG-LIST ]\n"); - fprintf(stderr, "Usage: ip xfrm state allocspi ID [ mode MODE ] [ mark MARK [ mask MASK ] ]\n"); -@@ -88,7 +89,7 @@ static void usage(void) - fprintf(stderr, " ALGO-NAME\n"); - fprintf(stderr, "MODE := transport | tunnel | beet | ro | in_trigger\n"); - fprintf(stderr, "FLAG-LIST := [ FLAG-LIST ] FLAG\n"); -- fprintf(stderr, "FLAG := noecn | decap-dscp | nopmtudisc | wildrecv | icmp | af-unspec | align4\n"); -+ fprintf(stderr, "FLAG := noecn | decap-dscp | nopmtudisc | wildrecv | icmp | af-unspec | align4 | esn\n"); - fprintf(stderr, "EXTRA-FLAG-LIST := [ EXTRA-FLAG-LIST ] EXTRA-FLAG\n"); - fprintf(stderr, "EXTRA-FLAG := dont-encap-dscp\n"); - fprintf(stderr, "SELECTOR := [ src ADDR[/PLEN] ] [ dst ADDR[/PLEN] ] [ dev DEV ] [ UPSPEC ]\n"); -@@ -213,6 +214,8 @@ static int xfrm_state_flag_parse(__u8 *flags, int *argcp, char ***argvp) - *flags |= XFRM_STATE_AF_UNSPEC; - else if (strcmp(*argv, "align4") == 0) - *flags |= XFRM_STATE_ALIGN4; -+ else if (strcmp(*argv, "esn") == 0) -+ *flags |= XFRM_STATE_ESN; - else { - PREV_ARG(); /* back track */ - break; -@@ -272,6 +275,9 @@ static int xfrm_state_modify(int cmd, unsigned flags, int argc, char **argv) - char buf[RTA_BUF_SIZE]; - } req; - struct xfrm_replay_state replay; -+ struct xfrm_replay_state_esn replay_esn; -+ __u32 replay_window = 0; -+ __u32 seq = 0, oseq = 0, seq_hi = 0, oseq_hi = 0; - char *idp = NULL; - char *aeadop = NULL; - char *ealgop = NULL; -@@ -288,6 +294,7 @@ static int xfrm_state_modify(int cmd, unsigned flags, int argc, char **argv) - - memset(&req, 0, sizeof(req)); - memset(&replay, 0, sizeof(replay)); -+ memset(&replay_esn, 0, sizeof(replay_esn)); - memset(&ctx, 0, sizeof(ctx)); - - req.n.nlmsg_len = NLMSG_LENGTH(sizeof(req.xsinfo)); -@@ -314,16 +321,24 @@ static int xfrm_state_modify(int cmd, unsigned flags, int argc, char **argv) - xfrm_seq_parse(&req.xsinfo.seq, &argc, &argv); - } else if (strcmp(*argv, "replay-window") == 0) { - NEXT_ARG(); -- if (get_u8(&req.xsinfo.replay_window, *argv, 0)) -+ if (get_u32(&replay_window, *argv, 0)) - invarg("value after \"replay-window\" is invalid", *argv); - } else if (strcmp(*argv, "replay-seq") == 0) { - NEXT_ARG(); -- if (get_u32(&replay.seq, *argv, 0)) -+ if (get_u32(&seq, *argv, 0)) - invarg("value after \"replay-seq\" is invalid", *argv); -+ } else if (strcmp(*argv, "replay-seq-hi") == 0) { -+ NEXT_ARG(); -+ if (get_u32(&seq_hi, *argv, 0)) -+ invarg("value after \"replay-seq-hi\" is invalid", *argv); - } else if (strcmp(*argv, "replay-oseq") == 0) { - NEXT_ARG(); -- if (get_u32(&replay.oseq, *argv, 0)) -+ if (get_u32(&oseq, *argv, 0)) - invarg("value after \"replay-oseq\" is invalid", *argv); -+ } else if (strcmp(*argv, "replay-oseq-hi") == 0) { -+ NEXT_ARG(); -+ if (get_u32(&oseq_hi, *argv, 0)) -+ invarg("value after \"replay-oseq-hi\" is invalid", *argv); - } else if (strcmp(*argv, "flag") == 0) { - NEXT_ARG(); - xfrm_state_flag_parse(&req.xsinfo.flags, &argc, &argv); -@@ -511,9 +526,39 @@ static int xfrm_state_modify(int cmd, unsigned flags, int argc, char **argv) - argc--; argv++; - } - -- if (replay.seq || replay.oseq) -- addattr_l(&req.n, sizeof(req.buf), XFRMA_REPLAY_VAL, -- (void *)&replay, sizeof(replay)); -+ if (req.xsinfo.flags & XFRM_STATE_ESN && -+ replay_window == 0) { -+ fprintf(stderr, "Error: esn flag set without replay-window.\n"); -+ exit(-1); -+ } -+ -+ if (replay_window > XFRMA_REPLAY_ESN_MAX) { -+ fprintf(stderr, -+ "Error: replay-window (%u) > XFRMA_REPLAY_ESN_MAX (%u).\n", -+ replay_window, XFRMA_REPLAY_ESN_MAX); -+ exit(-1); -+ } -+ -+ if (req.xsinfo.flags & XFRM_STATE_ESN || -+ replay_window > (sizeof(replay.bitmap) * 8)) { -+ replay_esn.seq = seq; -+ replay_esn.oseq = oseq; -+ replay_esn.seq_hi = seq_hi; -+ replay_esn.oseq_hi = oseq_hi; -+ replay_esn.replay_window = replay_window; -+ replay_esn.bmp_len = (replay_window + sizeof(__u32) * 8 - 1) / -+ (sizeof(__u32) * 8); -+ addattr_l(&req.n, sizeof(req.buf), XFRMA_REPLAY_ESN_VAL, -+ &replay_esn, sizeof(replay_esn)); -+ } else { -+ if (seq || oseq) { -+ replay.seq = seq; -+ replay.oseq = oseq; -+ addattr_l(&req.n, sizeof(req.buf), XFRMA_REPLAY_VAL, -+ &replay, sizeof(replay)); -+ } -+ req.xsinfo.replay_window = replay_window; -+ } - - if (extra_flags) - addattr32(&req.n, sizeof(req.buf), XFRMA_SA_EXTRA_FLAGS, --- -1.8.3.1 - diff --git a/SOURCES/0147-man-update-doc-after-support-of-ESN-and-anti-replay-.patch b/SOURCES/0147-man-update-doc-after-support-of-ESN-and-anti-replay-.patch deleted file mode 100644 index 6991465..0000000 --- a/SOURCES/0147-man-update-doc-after-support-of-ESN-and-anti-replay-.patch +++ /dev/null @@ -1,56 +0,0 @@ -From ef6fe92876cf6b9a572457896bb8c420a0cceba4 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Mon, 27 Mar 2017 13:11:34 +0200 -Subject: [PATCH] man: update doc after support of ESN and anti-replay window - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1425059 -Upstream Status: iproute2.git commit eeb669a7403cb - -commit eeb669a7403cbca859070aaed6f1a55131d75627 -Author: Nicolas Dichtel -Date: Thu Oct 30 01:18:48 2014 -0700 - - man: update doc after support of ESN and anti-replay window - - Signed-off-by: Nicolas Dichtel ---- - man/man8/ip-xfrm.8 | 9 +++++++-- - 1 file changed, 7 insertions(+), 2 deletions(-) - -diff --git a/man/man8/ip-xfrm.8 b/man/man8/ip-xfrm.8 -index aa04804..11f7104 100644 ---- a/man/man8/ip-xfrm.8 -+++ b/man/man8/ip-xfrm.8 -@@ -43,6 +43,10 @@ ip-xfrm \- transform configuration - .IR SEQ " ]" - .RB "[ " replay-oseq - .IR SEQ " ]" -+.RB "[ " replay-seq-hi -+.IR SEQ " ]" -+.RB "[ " replay-oseq-hi -+.IR SEQ " ]" - .RB "[ " flag - .IR FLAG-LIST " ]" - .RB "[ " sel -@@ -140,7 +144,8 @@ ip-xfrm \- transform configuration - - .ti -8 - .IR FLAG " :=" --.BR noecn " | " decap-dscp " | " nopmtudisc " | " wildrecv " | " icmp " | " af-unspec " | " align4 -+.BR noecn " | " decap-dscp " | " nopmtudisc " | " wildrecv " | " icmp " | " -+.BR af-unspec " | " align4 " | " esn - - .ti -8 - .IR SELECTOR " :=" -@@ -498,7 +503,7 @@ and inbound trigger - .I FLAG-LIST - contains one or more of the following optional flags: - .BR noecn ", " decap-dscp ", " nopmtudisc ", " wildrecv ", " icmp ", " --.BR af-unspec ", or " align4 "." -+.BR af-unspec ", " align4 ", or " esn "." - - .TP - .IR SELECTOR --- -1.8.3.1 - diff --git a/SOURCES/0148-tc-m_xt-Prevent-segfault-with-standard-targets.patch b/SOURCES/0148-tc-m_xt-Prevent-segfault-with-standard-targets.patch deleted file mode 100644 index 7a98caa..0000000 --- a/SOURCES/0148-tc-m_xt-Prevent-segfault-with-standard-targets.patch +++ /dev/null @@ -1,49 +0,0 @@ -From cadd480c74b11f0510aa56d9ee9f58c7fd7c094d Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 4 Apr 2017 16:21:45 +0200 -Subject: [PATCH] tc: m_xt: Prevent segfault with standard targets - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1326726 -Upstream Status: iproute2.git commit 445745221a21e - -commit 445745221a21ecb4111c19cfa7f4c2cf4796337f -Author: Phil Sutter -Date: Fri Jun 10 13:42:00 2016 +0200 - - tc: m_xt: Prevent segfault with standard targets - - Iptables standard targets like DROP or REJECT don't implement the print - callback in libxtables. Hence the following command would segfault: - - | tc filter add dev d0 parent ffff: u32 match u32 0 0 action xt -j DROP - - With this patch standard targets still can't be used (and are not really - useful anyway), but at least it doesn't crash anymore. - - Signed-off-by: Phil Sutter ---- - tc/m_xt.c | 8 ++++++-- - 1 file changed, 6 insertions(+), 2 deletions(-) - -diff --git a/tc/m_xt.c b/tc/m_xt.c -index 537daf8..aa83061 100644 ---- a/tc/m_xt.c -+++ b/tc/m_xt.c -@@ -248,8 +248,12 @@ static int parse_ipt(struct action_util *a,int *argc_p, - fprintf(stdout, "tablename: %s hook: %s\n ", tname, ipthooks[hook]); - fprintf(stdout, "\ttarget: "); - -- if (m) -- m->print(NULL, m->t, 0); -+ if (m) { -+ if (m->print) -+ m->print(NULL, m->t, 0); -+ else -+ printf("%s ", m->name); -+ } - fprintf(stdout, " index %d\n", index); - - if (strlen(tname) > 16) { --- -1.8.3.1 - diff --git a/SOURCES/0149-tc-m_xt-Fix-segfault-when-adding-multiple-actions-at.patch b/SOURCES/0149-tc-m_xt-Fix-segfault-when-adding-multiple-actions-at.patch deleted file mode 100644 index fee360e..0000000 --- a/SOURCES/0149-tc-m_xt-Fix-segfault-when-adding-multiple-actions-at.patch +++ /dev/null @@ -1,81 +0,0 @@ -From cee4a40e7febe8f1b5b38b31f42f1b64f536ddb4 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 4 Apr 2017 16:21:45 +0200 -Subject: [PATCH] tc: m_xt: Fix segfault when adding multiple actions at once - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1326726 -Upstream Status: iproute2.git commit 8eee75a8358c5 - -commit 8eee75a8358c542d881d2a84e2c47cc0a9fa92ef -Author: Phil Sutter -Date: Fri Jun 10 13:42:01 2016 +0200 - - tc: m_xt: Fix segfault when adding multiple actions at once - - Without this, the following call to tc would segfault: - - | tc filter add dev d0 parent ffff: u32 match u32 0 0 \ - | action xt -j MARK --set-mark 0x1 \ - | action xt -j MARK --set-mark 0x1 - - The reason is basically the same as for 6e2e5ec28bad4 ("fix print_ipt: - segfault if more then one filter with action -j MARK.") but in - parse_ipt() instead of print_ipt(). - - Signed-off-by: Phil Sutter ---- - tc/m_xt.c | 14 ++++++++------ - 1 file changed, 8 insertions(+), 6 deletions(-) - -diff --git a/tc/m_xt.c b/tc/m_xt.c -index aa83061..f0efd28 100644 ---- a/tc/m_xt.c -+++ b/tc/m_xt.c -@@ -133,7 +133,9 @@ static int parse_ipt(struct action_util *a,int *argc_p, - __u32 hook = 0, index = 0; - struct option *opts = NULL; - -- xtables_init_all(&tcipt_globals, NFPROTO_IPV4); -+ /* copy tcipt_globals because .opts will be modified by iptables */ -+ struct xtables_globals tmp_tcipt_globals = tcipt_globals; -+ xtables_init_all(&tmp_tcipt_globals, NFPROTO_IPV4); - set_lib_dir(); - - { -@@ -152,7 +154,7 @@ static int parse_ipt(struct action_util *a,int *argc_p, - } - - while (1) { -- c = getopt_long(argc, argv, "j:", tcipt_globals.opts, NULL); -+ c = getopt_long(argc, argv, "j:", tmp_tcipt_globals.opts, NULL); - if (c == -1) - break; - switch (c) { -@@ -165,12 +167,12 @@ static int parse_ipt(struct action_util *a,int *argc_p, - return -1; - } - #if (XTABLES_VERSION_CODE >= 6) -- opts = xtables_options_xfrm(tcipt_globals.orig_opts, -- tcipt_globals.opts, -+ opts = xtables_options_xfrm(tmp_tcipt_globals.orig_opts, -+ tmp_tcipt_globals.opts, - m->x6_options, - &m->option_offset); - #else -- opts = xtables_merge_options(tcipt_globals.opts, -+ opts = xtables_merge_options(tmp_tcipt_globals.opts, - m->extra_opts, - &m->option_offset); - #endif -@@ -178,7 +180,7 @@ static int parse_ipt(struct action_util *a,int *argc_p, - fprintf(stderr, " failed to find additional options for target %s\n\n", optarg); - return -1; - } else -- tcipt_globals.opts = opts; -+ tmp_tcipt_globals.opts = opts; - } else { - fprintf(stderr," failed to find target %s\n\n", optarg); - return -1; --- -1.8.3.1 - diff --git a/SOURCES/0150-tc-m_xt-Fix-indenting.patch b/SOURCES/0150-tc-m_xt-Fix-indenting.patch deleted file mode 100644 index 7077e3f..0000000 --- a/SOURCES/0150-tc-m_xt-Fix-indenting.patch +++ /dev/null @@ -1,123 +0,0 @@ -From 23def97f419f0cc00baf8d427b83f3cf45d3f6be Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 4 Apr 2017 16:21:45 +0200 -Subject: [PATCH] tc: m_xt: Fix indenting - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1326726 -Upstream Status: iproute2.git commit f1a7c7d8301e9 -Conflicts: Changes in context and replaced code due to missing upstream - commit 32a121cba2579 ("tc: code cleanup"). - -commit f1a7c7d8301e9dcead8f8c0d28e7f1587c0cd3cc -Author: Phil Sutter -Date: Fri Jun 10 13:42:02 2016 +0200 - - tc: m_xt: Fix indenting - - By exiting early if xtables_find_target() fails, one indenting level can - be dropped. Some of the wrongly indented code then happens to sit at the - right spot by accident which is why this patch is smaller than expected. - - Signed-off-by: Phil Sutter ---- - tc/m_xt.c | 54 ++++++++++++++++++++++++++---------------------------- - 1 file changed, 26 insertions(+), 28 deletions(-) - -diff --git a/tc/m_xt.c b/tc/m_xt.c -index f0efd28..02ac4dd 100644 ---- a/tc/m_xt.c -+++ b/tc/m_xt.c -@@ -160,12 +160,15 @@ static int parse_ipt(struct action_util *a,int *argc_p, - switch (c) { - case 'j': - m = xtables_find_target(optarg, XTF_TRY_LOAD); -- if (NULL != m) { -+ if (!m) { -+ fprintf(stderr, " failed to find target %s\n\n", optarg); -+ return -1; -+ } - -- if (0 > build_st(m, NULL)) { -- printf(" %s error \n", m->name); -- return -1; -- } -+ if (build_st(m, NULL) < 0) { -+ printf(" %s error\n", m->name); -+ return -1; -+ } - #if (XTABLES_VERSION_CODE >= 6) - opts = xtables_options_xfrm(tmp_tcipt_globals.orig_opts, - tmp_tcipt_globals.opts, -@@ -181,22 +184,18 @@ static int parse_ipt(struct action_util *a,int *argc_p, - return -1; - } else - tmp_tcipt_globals.opts = opts; -- } else { -- fprintf(stderr," failed to find target %s\n\n", optarg); -- return -1; -- } - ok++; - break; - - default: - memset(&fw, 0, sizeof (fw)); - #if (XTABLES_VERSION_CODE >= 6) -- if (m != NULL && m->x6_parse != NULL ) { -- xtables_option_tpcall(c, argv, 0 , m, NULL); -+ if (m != NULL && m->x6_parse != NULL) { -+ xtables_option_tpcall(c, argv, 0, m, NULL); - #else -- if (m != NULL && m->parse != NULL ) { -- m->parse(c - m->option_offset, argv, 0, &m->tflags, -- NULL, &m->t); -+ if (m != NULL && m->parse != NULL) { -+ m->parse(c - m->option_offset, argv, 0, -+ &m->tflags, NULL, &m->t); - #endif - } else { - fprintf(stderr,"failed to find target %s\n\n", optarg); -@@ -335,11 +334,15 @@ print_ipt(struct action_util *au,FILE * f, struct rtattr *arg) - struct xtables_target *m = NULL; - t = RTA_DATA(tb[TCA_IPT_TARG]); - m = xtables_find_target(t->u.user.name, XTF_TRY_LOAD); -- if (NULL != m) { -- if (0 > build_st(m, t)) { -- fprintf(stderr, " %s error \n", m->name); -- return -1; -- } -+ if (!m) { -+ fprintf(stderr, " failed to find target %s\n\n", -+ t->u.user.name); -+ return -1; -+ } -+ if (build_st(m, t) < 0) { -+ fprintf(stderr, " %s error\n", m->name); -+ return -1; -+ } - - #if (XTABLES_VERSION_CODE >= 6) - opts = xtables_options_xfrm(tmp_tcipt_globals.orig_opts, -@@ -351,16 +354,11 @@ print_ipt(struct action_util *au,FILE * f, struct rtattr *arg) - m->extra_opts, - &m->option_offset); - #endif -- if (opts == NULL) { -- fprintf(stderr, " failed to find additional options for target %s\n\n", optarg); -- return -1; -- } else -- tmp_tcipt_globals.opts = opts; -- } else { -- fprintf(stderr, " failed to find target %s\n\n", -- t->u.user.name); -+ if (opts == NULL) { -+ fprintf(stderr, " failed to find additional options for target %s\n\n", optarg); - return -1; -- } -+ } else -+ tmp_tcipt_globals.opts = opts; - fprintf(f, "\ttarget "); - m->print(NULL, m->t, 0); - if (tb[TCA_IPT_INDEX] == NULL) { --- -1.8.3.1 - diff --git a/SOURCES/0151-tc-m_xt-Get-rid-of-one-indentation-level-in-parse_ip.patch b/SOURCES/0151-tc-m_xt-Get-rid-of-one-indentation-level-in-parse_ip.patch deleted file mode 100644 index 3f7dcc9..0000000 --- a/SOURCES/0151-tc-m_xt-Get-rid-of-one-indentation-level-in-parse_ip.patch +++ /dev/null @@ -1,142 +0,0 @@ -From afbf7fa2b6640a6d0675846459753f6e62db9704 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 4 Apr 2017 16:22:21 +0200 -Subject: [PATCH] tc: m_xt: Get rid of one indentation level in parse_ipt() - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1326726 -Upstream Status: iproute2.git commit b45f9141c2602 -Conflicts: Changes in context and replaced code due to missing upstream - commit 32a121cba2579 ("tc: code cleanup"). - -commit b45f9141c2602de790a9fc3f0f423ed72419da24 -Author: Phil Sutter -Date: Fri Jun 10 13:42:03 2016 +0200 - - tc: m_xt: Get rid of one indentation level in parse_ipt() - - Signed-off-by: Phil Sutter ---- - tc/m_xt.c | 93 ++++++++++++++++++++++++++++++++------------------------------- - 1 file changed, 48 insertions(+), 45 deletions(-) - -diff --git a/tc/m_xt.c b/tc/m_xt.c -index 02ac4dd..bb1f929 100644 ---- a/tc/m_xt.c -+++ b/tc/m_xt.c -@@ -296,6 +296,7 @@ static int parse_ipt(struct action_util *a,int *argc_p, - static int - print_ipt(struct action_util *au,FILE * f, struct rtattr *arg) - { -+ struct xtables_target *m; - struct rtattr *tb[TCA_IPT_MAX + 1]; - struct xt_entry_target *t = NULL; - struct option *opts = NULL; -@@ -330,58 +331,60 @@ print_ipt(struct action_util *au,FILE * f, struct rtattr *arg) - if (tb[TCA_IPT_TARG] == NULL) { - fprintf(f, "\t[NULL ipt target parameters ] \n"); - return -1; -- } else { -- struct xtables_target *m = NULL; -- t = RTA_DATA(tb[TCA_IPT_TARG]); -- m = xtables_find_target(t->u.user.name, XTF_TRY_LOAD); -- if (!m) { -- fprintf(stderr, " failed to find target %s\n\n", -- t->u.user.name); -- return -1; -- } -- if (build_st(m, t) < 0) { -- fprintf(stderr, " %s error\n", m->name); -- return -1; -- } -+ } -+ -+ t = RTA_DATA(tb[TCA_IPT_TARG]); -+ m = xtables_find_target(t->u.user.name, XTF_TRY_LOAD); -+ if (!m) { -+ fprintf(stderr, " failed to find target %s\n\n", -+ t->u.user.name); -+ return -1; -+ } -+ if (build_st(m, t) < 0) { -+ fprintf(stderr, " %s error\n", m->name); -+ return -1; -+ } - - #if (XTABLES_VERSION_CODE >= 6) -- opts = xtables_options_xfrm(tmp_tcipt_globals.orig_opts, -- tmp_tcipt_globals.opts, -- m->x6_options, -- &m->option_offset); -+ opts = xtables_options_xfrm(tmp_tcipt_globals.orig_opts, -+ tmp_tcipt_globals.opts, -+ m->x6_options, -+ &m->option_offset); - #else -- opts = xtables_merge_options(tmp_tcipt_globals.opts, -- m->extra_opts, -- &m->option_offset); -+ opts = xtables_merge_options(tmp_tcipt_globals.opts, -+ m->extra_opts, -+ &m->option_offset); - #endif -- if (opts == NULL) { -- fprintf(stderr, " failed to find additional options for target %s\n\n", optarg); -- return -1; -- } else -- tmp_tcipt_globals.opts = opts; -- fprintf(f, "\ttarget "); -- m->print(NULL, m->t, 0); -- if (tb[TCA_IPT_INDEX] == NULL) { -- fprintf(f, " [NULL ipt target index ]\n"); -- } else { -- __u32 index; -- index = rta_getattr_u32(tb[TCA_IPT_INDEX]); -- fprintf(f, " \n\tindex %d", index); -- } -+ if (opts == NULL) { -+ fprintf(stderr, " failed to find additional options for target %s\n\n", optarg); -+ return -1; -+ } else -+ tmp_tcipt_globals.opts = opts; -+ fprintf(f, "\ttarget "); -+ m->print(NULL, m->t, 0); -+ if (tb[TCA_IPT_INDEX] == NULL) { -+ fprintf(f, " [NULL ipt target index ]\n"); -+ } else { -+ __u32 index; - -- if (tb[TCA_IPT_CNT]) { -- struct tc_cnt *c = RTA_DATA(tb[TCA_IPT_CNT]);; -- fprintf(f, " ref %d bind %d", c->refcnt, c->bindcnt); -- } -- if (show_stats) { -- if (tb[TCA_IPT_TM]) { -- struct tcf_t *tm = RTA_DATA(tb[TCA_IPT_TM]); -- print_tm(f,tm); -- } -- } -- fprintf(f, " \n"); -+ index = rta_getattr_u32(tb[TCA_IPT_INDEX]); -+ fprintf(f, "\n\tindex %d", index); -+ } - -+ if (tb[TCA_IPT_CNT]) { -+ struct tc_cnt *c = RTA_DATA(tb[TCA_IPT_CNT]); -+ -+ fprintf(f, " ref %d bind %d", c->refcnt, c->bindcnt); - } -+ if (show_stats) { -+ if (tb[TCA_IPT_TM]) { -+ struct tcf_t *tm = RTA_DATA(tb[TCA_IPT_TM]); -+ -+ print_tm(f, tm); -+ } -+ } -+ fprintf(f, "\n"); -+ - xtables_free_opts(1); - - return 0; --- -1.8.3.1 - diff --git a/SOURCES/0152-tc-m_xt-Drop-unused-variable-fw-in-parse_ipt.patch b/SOURCES/0152-tc-m_xt-Drop-unused-variable-fw-in-parse_ipt.patch deleted file mode 100644 index b365736..0000000 --- a/SOURCES/0152-tc-m_xt-Drop-unused-variable-fw-in-parse_ipt.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 44384a7557d92a53032d8f65adcbed79a5f990e6 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 4 Apr 2017 16:22:40 +0200 -Subject: [PATCH] tc: m_xt: Drop unused variable fw in parse_ipt() - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1326726 -Upstream Status: iproute2.git commit b0ba0185763ad -Conflicts: Changes in context and replaced code due to missing upstream - commit 32a121cba2579 ("tc: code cleanup"). - -commit b0ba0185763ad2bae3335423221919ed47951885 -Author: Phil Sutter -Date: Fri Jun 10 13:42:04 2016 +0200 - - tc: m_xt: Drop unused variable fw in parse_ipt() - - Signed-off-by: Phil Sutter ---- - tc/m_xt.c | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/tc/m_xt.c b/tc/m_xt.c -index bb1f929..4e660c4 100644 ---- a/tc/m_xt.c -+++ b/tc/m_xt.c -@@ -120,7 +120,6 @@ static int parse_ipt(struct action_util *a,int *argc_p, - char ***argv_p, int tca_id, struct nlmsghdr *n) - { - struct xtables_target *m = NULL; -- struct ipt_entry fw; - struct rtattr *tail; - - int c; -@@ -188,7 +187,6 @@ static int parse_ipt(struct action_util *a,int *argc_p, - break; - - default: -- memset(&fw, 0, sizeof (fw)); - #if (XTABLES_VERSION_CODE >= 6) - if (m != NULL && m->x6_parse != NULL) { - xtables_option_tpcall(c, argv, 0, m, NULL); --- -1.8.3.1 - diff --git a/SOURCES/0153-tc-m_xt-Get-rid-of-rargc-in-parse_ipt.patch b/SOURCES/0153-tc-m_xt-Get-rid-of-rargc-in-parse_ipt.patch deleted file mode 100644 index ffd3124..0000000 --- a/SOURCES/0153-tc-m_xt-Get-rid-of-rargc-in-parse_ipt.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 1f1f1e431f8cb9c8051f4b04ee5d6b36cc27f949 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 4 Apr 2017 16:23:16 +0200 -Subject: [PATCH] tc: m_xt: Get rid of rargc in parse_ipt() - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1326726 -Upstream Status: iproute2.git commit ab8f52fc4ae11 -Conflicts: Changes in replaced code due to missing upstream commit - 32a121cba2579 ("tc: code cleanup"). - -commit ab8f52fc4ae1141ff9980d24244f2d9559e47968 -Author: Phil Sutter -Date: Fri Jun 10 13:42:05 2016 +0200 - - tc: m_xt: Get rid of rargc in parse_ipt() - - No need to copy the passed parameter, it's changed only once right - before function return. - - Signed-off-by: Phil Sutter ---- - tc/m_xt.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/tc/m_xt.c b/tc/m_xt.c -index 4e660c4..7947e5a 100644 ---- a/tc/m_xt.c -+++ b/tc/m_xt.c -@@ -123,7 +123,6 @@ static int parse_ipt(struct action_util *a,int *argc_p, - struct rtattr *tail; - - int c; -- int rargc = *argc_p; - char **argv = *argv_p; - int argc = 0, iargc = 0; - char k[16]; -@@ -139,7 +138,8 @@ static int parse_ipt(struct action_util *a,int *argc_p, - - { - int i; -- for (i = 0; i < rargc; i++) { -+ -+ for (i = 0; i < *argc_p; i++) { - if (NULL == argv[i] || 0 == strcmp(argv[i], "action")) { - break; - } -@@ -148,7 +148,7 @@ static int parse_ipt(struct action_util *a,int *argc_p, - } - - if (argc <= 2) { -- fprintf(stderr,"bad arguements to ipt %d vs %d \n", argc, rargc); -+ fprintf(stderr, "bad arguments to ipt %d vs %d\n", argc, *argc_p); - return -1; - } - -@@ -272,7 +272,7 @@ static int parse_ipt(struct action_util *a,int *argc_p, - - argc -= optind; - argv += optind; -- *argc_p = rargc - iargc; -+ *argc_p -= iargc; - *argv_p = argv; - - optind = 0; --- -1.8.3.1 - diff --git a/SOURCES/0154-tc-m_xt-Get-rid-of-iargc-variable-in-parse_ipt.patch b/SOURCES/0154-tc-m_xt-Get-rid-of-iargc-variable-in-parse_ipt.patch deleted file mode 100644 index 70c3887..0000000 --- a/SOURCES/0154-tc-m_xt-Get-rid-of-iargc-variable-in-parse_ipt.patch +++ /dev/null @@ -1,67 +0,0 @@ -From cae38feb629c7d30c53366e5b48e96b759b7963d Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 4 Apr 2017 16:23:42 +0200 -Subject: [PATCH] tc: m_xt: Get rid of iargc variable in parse_ipt() - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1326726 -Upstream Status: iproute2.git commit 28432f370e6ad - -commit 28432f370e6ad72a7eab9ba6bae67eabdd4b1c57 -Author: Phil Sutter -Date: Fri Jun 10 13:42:06 2016 +0200 - - tc: m_xt: Get rid of iargc variable in parse_ipt() - - After dropping the unused decrement of argc in the function's tail, it - can fully take over what iargc has been used for. - - Signed-off-by: Phil Sutter ---- - tc/m_xt.c | 9 ++++----- - 1 file changed, 4 insertions(+), 5 deletions(-) - -diff --git a/tc/m_xt.c b/tc/m_xt.c -index 7947e5a..e0ed8a4 100644 ---- a/tc/m_xt.c -+++ b/tc/m_xt.c -@@ -124,7 +124,7 @@ static int parse_ipt(struct action_util *a,int *argc_p, - - int c; - char **argv = *argv_p; -- int argc = 0, iargc = 0; -+ int argc = 0; - char k[16]; - int size = 0; - int iok = 0, ok = 0; -@@ -144,7 +144,7 @@ static int parse_ipt(struct action_util *a,int *argc_p, - break; - } - } -- iargc = argc = i; -+ argc = i; - } - - if (argc <= 2) { -@@ -205,7 +205,7 @@ static int parse_ipt(struct action_util *a,int *argc_p, - } - } - -- if (iargc > optind) { -+ if (argc > optind) { - if (matches(argv[optind], "index") == 0) { - if (get_u32(&index, argv[optind + 1], 10)) { - fprintf(stderr, "Illegal \"index\"\n"); -@@ -270,9 +270,8 @@ static int parse_ipt(struct action_util *a,int *argc_p, - addattr_l(n, MAX_MSG, TCA_IPT_TARG, m->t, m->t->u.target_size); - tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail; - -- argc -= optind; - argv += optind; -- *argc_p -= iargc; -+ *argc_p -= argc; - *argv_p = argv; - - optind = 0; --- -1.8.3.1 - diff --git a/SOURCES/0155-tc-m_xt-Simplify-argc-adjusting-in-parse_ipt.patch b/SOURCES/0155-tc-m_xt-Simplify-argc-adjusting-in-parse_ipt.patch deleted file mode 100644 index b5085cf..0000000 --- a/SOURCES/0155-tc-m_xt-Simplify-argc-adjusting-in-parse_ipt.patch +++ /dev/null @@ -1,63 +0,0 @@ -From e1d15d63d531aa08fd6abe021aba5e287e13d527 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 4 Apr 2017 16:23:42 +0200 -Subject: [PATCH] tc: m_xt: Simplify argc adjusting in parse_ipt() - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1326726 -Upstream Status: iproute2.git commit f6ddd9c5da4e5 - -commit f6ddd9c5da4e552322baf237075aae6db17237d4 -Author: Phil Sutter -Date: Fri Jun 10 13:42:07 2016 +0200 - - tc: m_xt: Simplify argc adjusting in parse_ipt() - - And while at it, also improve the error message in case too few - parameters have been given. - - Signed-off-by: Phil Sutter ---- - tc/m_xt.c | 17 ++++++----------- - 1 file changed, 6 insertions(+), 11 deletions(-) - -diff --git a/tc/m_xt.c b/tc/m_xt.c -index e0ed8a4..da3f7ab 100644 ---- a/tc/m_xt.c -+++ b/tc/m_xt.c -@@ -124,7 +124,7 @@ static int parse_ipt(struct action_util *a,int *argc_p, - - int c; - char **argv = *argv_p; -- int argc = 0; -+ int argc; - char k[16]; - int size = 0; - int iok = 0, ok = 0; -@@ -136,19 +136,14 @@ static int parse_ipt(struct action_util *a,int *argc_p, - xtables_init_all(&tmp_tcipt_globals, NFPROTO_IPV4); - set_lib_dir(); - -- { -- int i; -- -- for (i = 0; i < *argc_p; i++) { -- if (NULL == argv[i] || 0 == strcmp(argv[i], "action")) { -- break; -- } -- } -- argc = i; -+ /* parse only up until the next action */ -+ for (argc = 0; argc < *argc_p; argc++) { -+ if (!argv[argc] || !strcmp(argv[argc], "action")) -+ break; - } - - if (argc <= 2) { -- fprintf(stderr, "bad arguments to ipt %d vs %d\n", argc, *argc_p); -+ fprintf(stderr, "too few arguments for xt, need at least '-j '\n"); - return -1; - } - --- -1.8.3.1 - diff --git a/SOURCES/0156-tc-m_xt-Introduce-get_xtables_target_opts.patch b/SOURCES/0156-tc-m_xt-Introduce-get_xtables_target_opts.patch deleted file mode 100644 index fae4283..0000000 --- a/SOURCES/0156-tc-m_xt-Introduce-get_xtables_target_opts.patch +++ /dev/null @@ -1,132 +0,0 @@ -From 9816ef34f02ebbffece0ec7d298742f1d73e1acd Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 4 Apr 2017 16:23:42 +0200 -Subject: [PATCH] tc: m_xt: Introduce get_xtables_target_opts() - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1326726 -Upstream Status: iproute2.git commit 2ef4008585ec9 -Conflicts: Context change due to missing upstream commit 32a121cba2579 - ("tc: code cleanup"). - -commit 2ef4008585ec9184a0abf7534bf7f575ce6579d1 -Author: Phil Sutter -Date: Fri Jun 10 13:42:08 2016 +0200 - - tc: m_xt: Introduce get_xtables_target_opts() - - This pulls common code from parse_ipt() and print_ipt() functions - together. - - While here, also fix for incorrect use of the global 'optarg' variable - in print_ipt(). - - Signed-off-by: Phil Sutter ---- - tc/m_xt.c | 60 ++++++++++++++++++++++++++++++------------------------------ - 1 file changed, 30 insertions(+), 30 deletions(-) - -diff --git a/tc/m_xt.c b/tc/m_xt.c -index da3f7ab..c96d58c 100644 ---- a/tc/m_xt.c -+++ b/tc/m_xt.c -@@ -116,7 +116,28 @@ static void set_lib_dir(void) - - } - --static int parse_ipt(struct action_util *a,int *argc_p, -+static int get_xtables_target_opts(struct xtables_globals *globals, -+ struct xtables_target *m) -+{ -+ struct option *opts; -+ -+#if (XTABLES_VERSION_CODE >= 6) -+ opts = xtables_options_xfrm(globals->orig_opts, -+ globals->opts, -+ m->x6_options, -+ &m->option_offset); -+#else -+ opts = xtables_merge_options(globals->opts, -+ m->extra_opts, -+ &m->option_offset); -+#endif -+ if (!opts) -+ return -1; -+ globals->opts = opts; -+ return 0; -+} -+ -+static int parse_ipt(struct action_util *a, int *argc_p, - char ***argv_p, int tca_id, struct nlmsghdr *n) - { - struct xtables_target *m = NULL; -@@ -129,7 +150,6 @@ static int parse_ipt(struct action_util *a,int *argc_p, - int size = 0; - int iok = 0, ok = 0; - __u32 hook = 0, index = 0; -- struct option *opts = NULL; - - /* copy tcipt_globals because .opts will be modified by iptables */ - struct xtables_globals tmp_tcipt_globals = tcipt_globals; -@@ -163,21 +183,11 @@ static int parse_ipt(struct action_util *a,int *argc_p, - printf(" %s error\n", m->name); - return -1; - } --#if (XTABLES_VERSION_CODE >= 6) -- opts = xtables_options_xfrm(tmp_tcipt_globals.orig_opts, -- tmp_tcipt_globals.opts, -- m->x6_options, -- &m->option_offset); --#else -- opts = xtables_merge_options(tmp_tcipt_globals.opts, -- m->extra_opts, -- &m->option_offset); --#endif -- if (opts == NULL) { -+ -+ if (get_xtables_target_opts(&tmp_tcipt_globals, m) < 0) { - fprintf(stderr, " failed to find additional options for target %s\n\n", optarg); - return -1; -- } else -- tmp_tcipt_globals.opts = opts; -+ } - ok++; - break; - -@@ -291,7 +301,6 @@ print_ipt(struct action_util *au,FILE * f, struct rtattr *arg) - struct xtables_target *m; - struct rtattr *tb[TCA_IPT_MAX + 1]; - struct xt_entry_target *t = NULL; -- struct option *opts = NULL; - - if (arg == NULL) - return -1; -@@ -337,21 +346,12 @@ print_ipt(struct action_util *au,FILE * f, struct rtattr *arg) - return -1; - } - --#if (XTABLES_VERSION_CODE >= 6) -- opts = xtables_options_xfrm(tmp_tcipt_globals.orig_opts, -- tmp_tcipt_globals.opts, -- m->x6_options, -- &m->option_offset); --#else -- opts = xtables_merge_options(tmp_tcipt_globals.opts, -- m->extra_opts, -- &m->option_offset); --#endif -- if (opts == NULL) { -- fprintf(stderr, " failed to find additional options for target %s\n\n", optarg); -+ if (get_xtables_target_opts(&tmp_tcipt_globals, m) < 0) { -+ fprintf(stderr, -+ " failed to find additional options for target %s\n\n", -+ t->u.user.name); - return -1; -- } else -- tmp_tcipt_globals.opts = opts; -+ } - fprintf(f, "\ttarget "); - m->print(NULL, m->t, 0); - if (tb[TCA_IPT_INDEX] == NULL) { --- -1.8.3.1 - diff --git a/SOURCES/0157-m_xt-whitespace-cleanup.patch b/SOURCES/0157-m_xt-whitespace-cleanup.patch deleted file mode 100644 index 6100e78..0000000 --- a/SOURCES/0157-m_xt-whitespace-cleanup.patch +++ /dev/null @@ -1,125 +0,0 @@ -From 0401b1f92170a3c503e6dd1430b9b7cc0bcdbe47 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 4 Apr 2017 16:24:00 +0200 -Subject: [PATCH] m_xt: whitespace cleanup - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1326726 -Upstream Status: iproute2.git commit 4b83a08c280fc -Conflicts: Changes in replaced code due to missing upstream commit - 32a121cba2579 ("tc: code cleanup"). - -commit 4b83a08c280fcd14ed8e775adc7604ea13c1252f -Author: Stephen Hemminger -Date: Tue Jun 14 14:40:53 2016 -0700 - - m_xt: whitespace cleanup - - Make it 99% checkpatch clean. ---- - tc/m_xt.c | 32 +++++++++++++++++++++----------- - 1 file changed, 21 insertions(+), 11 deletions(-) - -diff --git a/tc/m_xt.c b/tc/m_xt.c -index c96d58c..8317f31 100644 ---- a/tc/m_xt.c -+++ b/tc/m_xt.c -@@ -39,8 +39,10 @@ - #endif - - #ifndef __ALIGN_KERNEL --#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1) --#define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask)) -+#define __ALIGN_KERNEL(x, a) \ -+ __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1) -+#define __ALIGN_KERNEL_MASK(x, mask) \ -+ (((x) + (mask)) & ~(mask)) - #endif - - #ifndef ALIGN -@@ -51,7 +53,7 @@ static const char *tname = "mangle"; - - char *lib_dir; - --static const char *ipthooks[] = { -+static const char * const ipthooks[] = { - "NF_IP_PRE_ROUTING", - "NF_IP_LOCAL_IN", - "NF_IP_FORWARD", -@@ -153,6 +155,7 @@ static int parse_ipt(struct action_util *a, int *argc_p, - - /* copy tcipt_globals because .opts will be modified by iptables */ - struct xtables_globals tmp_tcipt_globals = tcipt_globals; -+ - xtables_init_all(&tmp_tcipt_globals, NFPROTO_IPV4); - set_lib_dir(); - -@@ -163,7 +166,8 @@ static int parse_ipt(struct action_util *a, int *argc_p, - } - - if (argc <= 2) { -- fprintf(stderr, "too few arguments for xt, need at least '-j '\n"); -+ fprintf(stderr, -+ "too few arguments for xt, need at least '-j '\n"); - return -1; - } - -@@ -175,7 +179,9 @@ static int parse_ipt(struct action_util *a, int *argc_p, - case 'j': - m = xtables_find_target(optarg, XTF_TRY_LOAD); - if (!m) { -- fprintf(stderr, " failed to find target %s\n\n", optarg); -+ fprintf(stderr, -+ " failed to find target %s\n\n", -+ optarg); - return -1; - } - -@@ -184,8 +190,11 @@ static int parse_ipt(struct action_util *a, int *argc_p, - return -1; - } - -- if (get_xtables_target_opts(&tmp_tcipt_globals, m) < 0) { -- fprintf(stderr, " failed to find additional options for target %s\n\n", optarg); -+ if (get_xtables_target_opts(&tmp_tcipt_globals, -+ m) < 0) { -+ fprintf(stderr, -+ " failed to find additional options for target %s\n\n", -+ optarg); - return -1; - } - ok++; -@@ -198,10 +207,11 @@ static int parse_ipt(struct action_util *a, int *argc_p, - #else - if (m != NULL && m->parse != NULL) { - m->parse(c - m->option_offset, argv, 0, -- &m->tflags, NULL, &m->t); -+ &m->tflags, NULL, &m->t); - #endif - } else { -- fprintf(stderr,"failed to find target %s\n\n", optarg); -+ fprintf(stderr, -+ "failed to find target %s\n\n", optarg); - return -1; - - } -@@ -296,7 +306,7 @@ static int parse_ipt(struct action_util *a, int *argc_p, - } - - static int --print_ipt(struct action_util *au,FILE * f, struct rtattr *arg) -+print_ipt(struct action_util *au, FILE *f, struct rtattr *arg) - { - struct xtables_target *m; - struct rtattr *tb[TCA_IPT_MAX + 1]; -@@ -348,7 +358,7 @@ print_ipt(struct action_util *au,FILE * f, struct rtattr *arg) - - if (get_xtables_target_opts(&tmp_tcipt_globals, m) < 0) { - fprintf(stderr, -- " failed to find additional options for target %s\n\n", -+ " failed to find additional options for target %s\n\n", - t->u.user.name); - return -1; - } --- -1.8.3.1 - diff --git a/SOURCES/0158-tc-m_xt-Fix-segfault-with-iptables-1.6.0.patch b/SOURCES/0158-tc-m_xt-Fix-segfault-with-iptables-1.6.0.patch deleted file mode 100644 index 19ff652..0000000 --- a/SOURCES/0158-tc-m_xt-Fix-segfault-with-iptables-1.6.0.patch +++ /dev/null @@ -1,45 +0,0 @@ -From cff7ec6ee4af587761cae0819471cb28d48463d8 Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 4 Apr 2017 16:26:50 +0200 -Subject: [PATCH] tc: m_xt: Fix segfault with iptables-1.6.0 - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1326726 -Upstream Status: iproute2.git commit 97a02cabefb2e - -commit 97a02cabefb2e2dcfe27f89943709afa84be5525 -Author: Phil Sutter -Date: Thu Jan 12 15:22:49 2017 +0100 - - tc: m_xt: Fix segfault with iptables-1.6.0 - - Said iptables version introduced struct xtables_globals field - 'compat_rev', a function pointer. Initializing it is mandatory as - libxtables calls it without existence check. - - Without this, tc segfaults when using the xt action like so: - - | tc filter add dev d0 parent ffff: u32 match u32 0 0 \ - | action xt -j MARK --set-mark 20 - - Signed-off-by: Phil Sutter ---- - tc/m_xt.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/tc/m_xt.c b/tc/m_xt.c -index 8317f31..890dddd 100644 ---- a/tc/m_xt.c -+++ b/tc/m_xt.c -@@ -77,6 +77,9 @@ static struct xtables_globals tcipt_globals = { - .orig_opts = original_opts, - .opts = original_opts, - .exit_err = NULL, -+#if (XTABLES_VERSION_CODE >= 11) -+ .compat_rev = xtables_compatible_revision, -+#endif - }; - - /* --- -1.8.3.1 - diff --git a/SOURCES/0159-tc-m_xt-Drop-needless-parentheses-from-if-checks.patch b/SOURCES/0159-tc-m_xt-Drop-needless-parentheses-from-if-checks.patch deleted file mode 100644 index 71d97c0..0000000 --- a/SOURCES/0159-tc-m_xt-Drop-needless-parentheses-from-if-checks.patch +++ /dev/null @@ -1,62 +0,0 @@ -From d7885e6a737866ada8445fd86c6352ac5ba96d7d Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Tue, 4 Apr 2017 16:26:50 +0200 -Subject: [PATCH] tc: m_xt: Drop needless parentheses from #if checks - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1326726 -Upstream Status: iproute2.git commit a05b9557f48e2 - -commit a05b9557f48e23e69a4c1a597f2f288f133ef170 -Author: Phil Sutter -Date: Fri Jan 13 13:06:19 2017 +0100 - - tc: m_xt: Drop needless parentheses from #if checks - - Signed-off-by: Phil Sutter ---- - tc/m_xt.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/tc/m_xt.c b/tc/m_xt.c -index 890dddd..478523d 100644 ---- a/tc/m_xt.c -+++ b/tc/m_xt.c -@@ -77,7 +77,7 @@ static struct xtables_globals tcipt_globals = { - .orig_opts = original_opts, - .opts = original_opts, - .exit_err = NULL, --#if (XTABLES_VERSION_CODE >= 11) -+#if XTABLES_VERSION_CODE >= 11 - .compat_rev = xtables_compatible_revision, - #endif - }; -@@ -126,7 +126,7 @@ static int get_xtables_target_opts(struct xtables_globals *globals, - { - struct option *opts; - --#if (XTABLES_VERSION_CODE >= 6) -+#if XTABLES_VERSION_CODE >= 6 - opts = xtables_options_xfrm(globals->orig_opts, - globals->opts, - m->x6_options, -@@ -204,7 +204,7 @@ static int parse_ipt(struct action_util *a, int *argc_p, - break; - - default: --#if (XTABLES_VERSION_CODE >= 6) -+#if XTABLES_VERSION_CODE >= 6 - if (m != NULL && m->x6_parse != NULL) { - xtables_option_tpcall(c, argv, 0, m, NULL); - #else -@@ -242,7 +242,7 @@ static int parse_ipt(struct action_util *a, int *argc_p, - } - - /* check that we passed the correct parameters to the target */ --#if (XTABLES_VERSION_CODE >= 6) -+#if XTABLES_VERSION_CODE >= 6 - if (m) - xtables_option_tfcall(m); - #else --- -1.8.3.1 - diff --git a/SOURCES/0160-man-ip-link.8-document-bridge-options.patch b/SOURCES/0160-man-ip-link.8-document-bridge-options.patch deleted file mode 100644 index 1703975..0000000 --- a/SOURCES/0160-man-ip-link.8-document-bridge-options.patch +++ /dev/null @@ -1,263 +0,0 @@ -From 5cc1ea2216d6b9bd26ed0a90db2ec5e045834c3c Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Wed, 5 Apr 2017 15:15:36 +0200 -Subject: [PATCH] man: ip-link.8: document bridge options - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1373869 -Upstream Status: iproute2.git commit 3fbb5d43bb759 - -commit 3fbb5d43bb759c7501404d8a92ae95e058c1763a -Author: Sabrina Dubroca -Date: Tue Mar 28 17:56:48 2017 +0200 - - man: ip-link.8: document bridge options - - Signed-off-by: Phil Sutter - Signed-off-by: Sabrina Dubroca ---- - man/man8/ip-link.8.in | 229 ++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 229 insertions(+) - -diff --git a/man/man8/ip-link.8.in b/man/man8/ip-link.8.in -index 8030203..e4e95b7 100644 ---- a/man/man8/ip-link.8.in -+++ b/man/man8/ip-link.8.in -@@ -778,6 +778,235 @@ using standard tools. - .in -8 - - .TP -+BRIDGE Type Support -+For a link of type -+.I BRIDGE -+the following additional arguments are supported: -+ -+.BI "ip link add " DEVICE " type bridge " -+[ -+.BI ageing_time " AGEING_TIME " -+] [ -+.BI group_fwd_mask " MASK " -+] [ -+.BI group_address " ADDRESS " -+] [ -+.BI forward_delay " FORWARD_DELAY " -+] [ -+.BI hello_time " HELLO_TIME " -+] [ -+.BI max_age " MAX_AGE " -+] [ -+.BI stp_state " STP_STATE " -+] [ -+.BI priority " PRIORITY " -+] [ -+.BI vlan_filtering " VLAN_FILTERING " -+] [ -+.BI vlan_protocol " VLAN_PROTOCOL " -+] [ -+.BI vlan_default_pvid " VLAN_DEFAULT_PVID " -+] [ -+.BI vlan_stats_enabled " VLAN_STATS_ENABLED " -+] [ -+.BI mcast_snooping " MULTICAST_SNOOPING " -+] [ -+.BI mcast_router " MULTICAST_ROUTER " -+] [ -+.BI mcast_query_use_ifaddr " MCAST_QUERY_USE_IFADDR " -+] [ -+.BI mcast_querier " MULTICAST_QUERIER " -+] [ -+.BI mcast_hash_elasticity " HASH_ELASTICITY " -+] [ -+.BI mcast_hash_max " HASH_MAX " -+] [ -+.BI mcast_last_member_count " LAST_MEMBER_COUNT " -+] [ -+.BI mcast_startup_query_count " STARTUP_QUERY_COUNT " -+] [ -+.BI mcast_last_member_interval " LAST_MEMBER_INTERVAL " -+] [ -+.BI mcast_membership_interval " MEMBERSHIP_INTERVAL " -+] [ -+.BI mcast_querier_interval " QUERIER_INTERVAL " -+] [ -+.BI mcast_query_interval " QUERY_INTERVAL " -+] [ -+.BI mcast_query_response_interval " QUERY_RESPONSE_INTERVAL " -+] [ -+.BI mcast_startup_query_interval " STARTUP_QUERY_INTERVAL " -+] [ -+.BI mcast_stats_enabled " MCAST_STATS_ENABLED " -+] [ -+.BI mcast_igmp_version " IGMP_VERSION " -+] [ -+.BI mcast_mld_version " MLD_VERSION " -+] [ -+.BI nf_call_iptables " NF_CALL_IPTABLES " -+] [ -+.BI nf_call_ip6tables " NF_CALL_IP6TABLES " -+] [ -+.BI nf_call_arptables " NF_CALL_ARPTABLES " -+] -+ -+.in +8 -+.sp -+.BI ageing_time " AGEING_TIME " -+- configure the bridge's FDB entries ageing time, ie the number of seconds a MAC address will be kept in the FDB after a packet has been received from that address. after this time has passed, entries are cleaned up. -+ -+.BI group_fwd_mask " MASK " -+- set the group forward mask. This is the bitmask that is applied to decide whether to forward incoming frames destined to link-local addresses, ie addresses of the form 01:80:C2:00:00:0X (defaults to 0, ie the bridge does not forward any link-local frames). -+ -+.BI group_address " ADDRESS " -+- set the MAC address of the multicast group this bridge uses for STP. The address must be a link-local address in standard Ethernet MAC address format, ie an address of the form 01:80:C2:00:00:0X, with X in [0, 4..f]. -+ -+.BI forward_delay " FORWARD_DELAY " -+- set the forwarding delay in seconds, ie the time spent in LISTENING state (before moving to LEARNING) and in LEARNING state (before moving to FORWARDING). Only relevant if STP is enabled. Valid values are between 2 and 30. -+ -+.BI hello_time " HELLO_TIME " -+- set the time in seconds between hello packets sent by the bridge, when it is a root bridge or a designated bridges. Only relevant if STP is enabled. Valid values are between 1 and 10. -+ -+.BI max_age " MAX_AGE " -+- set the hello packet timeout, ie the time in seconds until another bridge in the spanning tree is assumed to be dead, after reception of its last hello message. Only relevant if STP is enabled. Valid values are between 6 and 40. -+ -+.BI stp_state " STP_STATE " -+- turn spanning tree protocol on -+.RI ( STP_STATE " > 0) " -+or off -+.RI ( STP_STATE " == 0). " -+for this bridge. -+ -+.BI priority " PRIORITY " -+- set this bridge's spanning tree priority, used during STP root bridge election. -+.I PRIORITY -+is a 16bit unsigned integer. -+ -+.BI vlan_filtering " VLAN_FILTERING " -+- turn VLAN filtering on -+.RI ( VLAN_FILTERING " > 0) " -+or off -+.RI ( VLAN_FILTERING " == 0). " -+When disabled, the bridge will not consider the VLAN tag when handling packets. -+ -+.BR vlan_protocol " { " 802.1Q " | " 802.1ad " } " -+- set the protocol used for VLAN filtering. -+ -+.BI vlan_default_pvid " VLAN_DEFAULT_PVID " -+- set the default PVID (native/untagged VLAN ID) for this bridge. -+ -+.BI vlan_stats_enabled " VLAN_STATS_ENABLED " -+- enable -+.RI ( VLAN_STATS_ENABLED " == 1) " -+or disable -+.RI ( VLAN_STATS_ENABLED " == 0) " -+per-VLAN stats accounting. -+ -+.BI mcast_snooping " MULTICAST_SNOOPING " -+- turn multicast snooping on -+.RI ( MULTICAST_SNOOPING " > 0) " -+or off -+.RI ( MULTICAST_SNOOPING " == 0). " -+ -+.BI mcast_router " MULTICAST_ROUTER " -+- set bridge's multicast router if IGMP snooping is enabled. -+.I MULTICAST_ROUTER -+is an integer value having the following meaning: -+.in +8 -+.sp -+.B 0 -+- disabled. -+ -+.B 1 -+- automatic (queried). -+ -+.B 2 -+- permanently enabled. -+.in -8 -+ -+.BI mcast_query_use_ifaddr " MCAST_QUERY_USE_IFADDR " -+- whether to use the bridge's own IP address as source address for IGMP queries -+.RI ( MCAST_QUERY_USE_IFADDR " > 0) " -+or the default of 0.0.0.0 -+.RI ( MCAST_QUERY_USE_IFADDR " == 0). " -+ -+.BI mcast_querier " MULTICAST_QUERIER " -+- enable -+.RI ( MULTICAST_QUERIER " > 0) " -+or disable -+.RI ( MULTICAST_QUERIER " == 0) " -+IGMP querier, ie sending of multicast queries by the bridge (default: disabled). -+ -+.BI mcast_querier_interval " QUERIER_INTERVAL " -+- interval between queries sent by other routers. if no queries are seen after this delay has passed, the bridge will start to send its own queries (as if -+.BI mcast_querier -+was enabled). -+ -+.BI mcast_hash_elasticity " HASH_ELASTICITY " -+- set multicast database hash elasticity, ie the maximum chain length in the multicast hash table (defaults to 4). -+ -+.BI mcast_hash_max " HASH_MAX " -+- set maximum size of multicast hash table (defaults to 512, value must be a power of 2). -+ -+.BI mcast_last_member_count " LAST_MEMBER_COUNT " -+- set multicast last member count, ie the number of queries the bridge will send before stopping forwarding a multicast group after a "leave" message has been received (defaults to 2). -+ -+.BI mcast_last_member_interval " LAST_MEMBER_INTERVAL " -+- interval between queries to find remaining members of a group, after a "leave" message is received. -+ -+.BI mcast_startup_query_count " STARTUP_QUERY_COUNT " -+- set the number of IGMP queries to send during startup phase (defaults to 2). -+ -+.BI mcast_startup_query_interval " STARTUP_QUERY_INTERVAL " -+- interval between queries in the startup phase. -+ -+.BI mcast_query_interval " QUERY_INTERVAL " -+- interval between queries sent by the bridge after the end of the startup phase. -+ -+.BI mcast_query_response_interval " QUERY_RESPONSE_INTERVAL " -+- set the Max Response Time/Maximum Response Delay for IGMP/MLD queries sent by the bridge. -+ -+.BI mcast_membership_interval " MEMBERSHIP_INTERVAL " -+- delay after which the bridge will leave a group, if no membership reports for this group are received. -+ -+.BI mcast_stats_enabled " MCAST_STATS_ENABLED " -+- enable -+.RI ( MCAST_STATS_ENABLED " > 0) " -+or disable -+.RI ( MCAST_STATS_ENABLED " == 0) " -+multicast (IGMP/MLD) stats accounting. -+ -+.BI mcast_igmp_version " IGMP_VERSION " -+- set the IGMP version. -+ -+.BI mcast_mld_version " MLD_VERSION " -+- set the MLD version. -+ -+.BI nf_call_iptables " NF_CALL_IPTABLES " -+- enable -+.RI ( NF_CALL_IPTABLES " > 0) " -+or disable -+.RI ( NF_CALL_IPTABLES " == 0) " -+iptables hooks on the bridge. -+ -+.BI nf_call_ip6tables " NF_CALL_IP6TABLES " -+- enable -+.RI ( NF_CALL_IP6TABLES " > 0) " -+or disable -+.RI ( NF_CALL_IP6TABLES " == 0) " -+ip6tables hooks on the bridge. -+ -+.BI nf_call_arptables " NF_CALL_ARPTABLES " -+- enable -+.RI ( NF_CALL_ARPTABLES " > 0) " -+or disable -+.RI ( NF_CALL_ARPTABLES " == 0) " -+arptables hooks on the bridge. -+ -+ -+.in-8 -+ -+.TP - MACsec Type Support - For a link of type - .I MACsec --- -1.8.3.1 - diff --git a/SOURCES/0161-man-ip-link-Specify-min-max-values-for-bridge-slave-.patch b/SOURCES/0161-man-ip-link-Specify-min-max-values-for-bridge-slave-.patch deleted file mode 100644 index 1cb62db..0000000 --- a/SOURCES/0161-man-ip-link-Specify-min-max-values-for-bridge-slave-.patch +++ /dev/null @@ -1,42 +0,0 @@ -From fae9e8e688591e1680a7c8da2d20770e28b75e9b Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Wed, 5 Apr 2017 15:18:12 +0200 -Subject: [PATCH] man: ip-link: Specify min/max values for bridge slave - priority and cost - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1374360 -Upstream Status: iproute2.git commit 058d28b44c6cc - -commit 058d28b44c6cc66e5cdce31e80dc7284ccb22017 -Author: Phil Sutter -Date: Tue Apr 4 17:08:43 2017 +0200 - - man: ip-link: Specify min/max values for bridge slave priority and cost - - The values are parsed as u16/u32, but kernel limits allowed values. - - Signed-off-by: Phil Sutter ---- - man/man8/ip-link.8.in | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/man/man8/ip-link.8.in b/man/man8/ip-link.8.in -index e4e95b7..5c80666 100644 ---- a/man/man8/ip-link.8.in -+++ b/man/man8/ip-link.8.in -@@ -1390,10 +1390,10 @@ is a number representing the following states: - .BR 4 " (blocking)." - - .BI priority " PRIO" --- set port priority (a 16bit unsigned value). -+- set port priority (allowed values are between 0 and 63, inclusively). - - .BI cost " COST" --- set port cost (a 32bit unsigned value). -+- set port cost (allowed values are between 1 and 65535, inclusively). - - .BR guard " { " on " | " off " }" - - block incoming BPDU packets on this port. --- -1.8.3.1 - diff --git a/SOURCES/0162-ip-route-Prevent-some-other-double-spaces-in-output.patch b/SOURCES/0162-ip-route-Prevent-some-other-double-spaces-in-output.patch deleted file mode 100644 index e558966..0000000 --- a/SOURCES/0162-ip-route-Prevent-some-other-double-spaces-in-output.patch +++ /dev/null @@ -1,216 +0,0 @@ -From db77b23a4cf4c140881e68bd1a32fb08508a918e Mon Sep 17 00:00:00 2001 -From: Phil Sutter -Date: Thu, 20 Apr 2017 13:30:19 +0200 -Subject: [PATCH] ip-route: Prevent some other double spaces in output - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1374446 -Upstream Status: iproute2.git commit 5551ed44d394f -Conflicts: Adjusted for missing upstream commits: -* 194e9b855d053 ("ip: support RFC4191 router preference") -* 528c2551cdb27 ("iproute2: add support to print 'linkdown' nexthop flag") -* ecc509f9a36be ("ip route: add mpls multipath support") -* 93ae283594094 ("add support for the RTA_VIA attribute") -* 56f5daac98da0 ("ip: code cleanup") - -commit 5551ed44d394fac6e9a035dadb259580fbda84d3 -Author: Timothy Redaelli -Date: Wed Apr 5 19:10:26 2017 +0200 - - ip-route: Prevent some other double spaces in output - - Print spaces only after text. - - CC: Phil Sutter - Signed-off-by: Timothy Redaelli - Acked-by: Phil Sutter ---- - ip/iproute.c | 69 ++++++++++++++++++++++++++++++------------------------------ - 1 file changed, 35 insertions(+), 34 deletions(-) - -diff --git a/ip/iproute.c b/ip/iproute.c -index 134b146..2b50709 100644 ---- a/ip/iproute.c -+++ b/ip/iproute.c -@@ -292,12 +292,12 @@ static void print_rtax_features(FILE *fp, unsigned int features) - unsigned int of = features; - - if (features & RTAX_FEATURE_ECN) { -- fprintf(fp, " ecn"); -+ fprintf(fp, "ecn "); - features &= ~RTAX_FEATURE_ECN; - } - - if (features) -- fprintf(fp, " 0x%x", of); -+ fprintf(fp, "0x%x ", of); - } - - int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) -@@ -483,21 +483,21 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - if (!hz) - hz = get_user_hz(); - if (ci->rta_expires != 0) -- fprintf(fp, " expires %dsec", ci->rta_expires/hz); -+ fprintf(fp, "expires %dsec ", ci->rta_expires/hz); - if (ci->rta_error != 0) -- fprintf(fp, " error %d", ci->rta_error); -+ fprintf(fp, "error %d ", ci->rta_error); - if (show_stats) { - if (ci->rta_clntref) -- fprintf(fp, " users %d", ci->rta_clntref); -+ fprintf(fp, "users %d ", ci->rta_clntref); - if (ci->rta_used != 0) -- fprintf(fp, " used %d", ci->rta_used); -+ fprintf(fp, "used %d ", ci->rta_used); - if (ci->rta_lastuse != 0) -- fprintf(fp, " age %dsec", ci->rta_lastuse/hz); -+ fprintf(fp, "age %dsec ", ci->rta_lastuse/hz); - } - if (ci->rta_id) -- fprintf(fp, " ipid 0x%04x", ci->rta_id); -+ fprintf(fp, "ipid 0x%04x ", ci->rta_id); - if (ci->rta_ts || ci->rta_tsage) -- fprintf(fp, " ts 0x%x tsage %dsec", -+ fprintf(fp, "ts 0x%x tsage %dsec ", - ci->rta_ts, ci->rta_tsage); - } - } else if (r->rtm_family == AF_INET6) { -@@ -510,20 +510,20 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - if (r->rtm_flags & RTM_F_CLONED) - fprintf(fp, "%s cache ", _SL_); - if (ci->rta_expires) -- fprintf(fp, " expires %dsec", ci->rta_expires/hz); -+ fprintf(fp, "expires %dsec ", ci->rta_expires/hz); - if (ci->rta_error != 0) -- fprintf(fp, " error %d", ci->rta_error); -+ fprintf(fp, "error %d ", ci->rta_error); - if (show_stats) { - if (ci->rta_clntref) -- fprintf(fp, " users %d", ci->rta_clntref); -+ fprintf(fp, "users %d ", ci->rta_clntref); - if (ci->rta_used != 0) -- fprintf(fp, " used %d", ci->rta_used); -+ fprintf(fp, "used %d ", ci->rta_used); - if (ci->rta_lastuse != 0) -- fprintf(fp, " age %dsec", ci->rta_lastuse/hz); -+ fprintf(fp, "age %dsec ", ci->rta_lastuse/hz); - } - } else if (ci) { - if (ci->rta_error != 0) -- fprintf(fp, " error %d", ci->rta_error); -+ fprintf(fp, "error %d ", ci->rta_error); - } - } - if (tb[RTA_METRICS]) { -@@ -549,19 +549,19 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - continue; - - if (i < sizeof(mx_names)/sizeof(char*) && mx_names[i]) -- fprintf(fp, " %s", mx_names[i]); -+ fprintf(fp, "%s ", mx_names[i]); - else -- fprintf(fp, " metric %d", i); -+ fprintf(fp, "metric %d ", i); - - if (mxlock & (1<= 1000) -- fprintf(fp, " %gs", val/1e3); -+ fprintf(fp, "%gs ", val/1e3); - else -- fprintf(fp, " %ums", val); -+ fprintf(fp, "%ums ", val); - break; - case RTAX_CC_ALGO: -- fprintf(fp, " %s", rta_getattr_str(mxrta[i])); -+ fprintf(fp, "%s ", rta_getattr_str(mxrta[i])); - break; - } - } - } - if (tb[RTA_IIF] && filter.iifmask != -1) { -- fprintf(fp, " iif %s", ll_index_to_name(*(int*)RTA_DATA(tb[RTA_IIF]))); -+ fprintf(fp, "iif %s ", ll_index_to_name(*(int*)RTA_DATA(tb[RTA_IIF]))); - } - if (tb[RTA_MULTIPATH]) { - struct rtnexthop *nh = RTA_DATA(tb[RTA_MULTIPATH]); -@@ -599,11 +599,11 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - break; - if (r->rtm_flags&RTM_F_CLONED && r->rtm_type == RTN_MULTICAST) { - if (first) -- fprintf(fp, " Oifs:"); -+ fprintf(fp, "Oifs: "); - else - fprintf(fp, " "); - } else -- fprintf(fp, "%s\tnexthop", _SL_); -+ fprintf(fp, "%s\tnexthop ", _SL_); - if (nh->rtnh_len > sizeof(*nh)) { - parse_rtattr(tb, RTA_MAX, RTNH_DATA(nh), nh->rtnh_len - sizeof(*nh)); - if (tb[RTA_GATEWAY]) { -@@ -613,7 +613,7 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - if (nh->rtnh_len > sizeof(*nh)) { - parse_rtattr(tb, RTA_MAX, RTNH_DATA(nh), nh->rtnh_len - sizeof(*nh)); - if (tb[RTA_GATEWAY]) { -- fprintf(fp, " via %s ", -+ fprintf(fp, "via %s ", - format_host(r->rtm_family, - RTA_PAYLOAD(tb[RTA_GATEWAY]), - RTA_DATA(tb[RTA_GATEWAY]))); -@@ -622,29 +622,30 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) - __u32 to = rta_getattr_u32(tb[RTA_FLOW]); - __u32 from = to>>16; - to &= 0xFFFF; -- fprintf(fp, " realm%s ", from ? "s" : ""); -+ fprintf(fp, "realm%s ", from ? "s" : ""); - if (from) { - fprintf(fp, "%s/", - rtnl_rtrealm_n2a(from, b1, sizeof(b1))); - } -- fprintf(fp, "%s", -+ fprintf(fp, "%s ", - rtnl_rtrealm_n2a(to, b1, sizeof(b1))); - } - } - if (r->rtm_flags&RTM_F_CLONED && r->rtm_type == RTN_MULTICAST) { -- fprintf(fp, " %s", ll_index_to_name(nh->rtnh_ifindex)); -+ fprintf(fp, "%s", ll_index_to_name(nh->rtnh_ifindex)); - if (nh->rtnh_hops != 1) - fprintf(fp, "(ttl>%d)", nh->rtnh_hops); -+ fprintf(fp, " "); - } else { -- fprintf(fp, " dev %s", ll_index_to_name(nh->rtnh_ifindex)); -- fprintf(fp, " weight %d", nh->rtnh_hops+1); -+ fprintf(fp, "dev %s ", ll_index_to_name(nh->rtnh_ifindex)); -+ fprintf(fp, "weight %d ", nh->rtnh_hops+1); - } - if (nh->rtnh_flags & RTNH_F_DEAD) -- fprintf(fp, " dead"); -+ fprintf(fp, "dead "); - if (nh->rtnh_flags & RTNH_F_ONLINK) -- fprintf(fp, " onlink"); -+ fprintf(fp, "onlink "); - if (nh->rtnh_flags & RTNH_F_PERVASIVE) -- fprintf(fp, " pervasive"); -+ fprintf(fp, "pervasive "); - len -= NLMSG_ALIGN(nh->rtnh_len); - nh = RTNH_NEXT(nh); - } --- -1.8.3.1 - diff --git a/SOURCES/0164-tc-Add-support-for-the-matchall-traffic-classifier.patch b/SOURCES/0164-tc-Add-support-for-the-matchall-traffic-classifier.patch deleted file mode 100644 index 8bf0fa2..0000000 --- a/SOURCES/0164-tc-Add-support-for-the-matchall-traffic-classifier.patch +++ /dev/null @@ -1,198 +0,0 @@ -From 13127e1bbe84181c259c61eb65ca2b707f3ed31b Mon Sep 17 00:00:00 2001 -From: Ivan Vecera -Date: Wed, 31 May 2017 15:38:41 +0200 -Subject: [PATCH 164/169] tc: Add support for the matchall traffic classifier. - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1435624 -Upstream status: iproute2.git commit d5cbf3ff0561b - -Upstream commit(s): -commit d5cbf3ff0561b6c8158c3538c7fe1946add9dec3 -Author: Yotam Gigi -Date: Wed Aug 31 09:28:26 2016 +0200 - - tc: Add support for the matchall traffic classifier. - - The matchall classifier matches every packet and allows the user to apply - actions on it. In addition, it supports the skip_sw and skip_hw (as can - be found on u32 and flower filter) that direct the kernel to skip the - software/hardware processing of the actions. - - This filter is very useful in usecases where every packet should be - matched. For example, packet mirroring (SPAN) can be setup very easily - using that filter. - - Signed-off-by: Yotam Gigi - Signed-off-by: Jiri Pirko - -Signed-off-by: Ivan Vecera ---- - tc/Makefile | 1 + - tc/f_matchall.c | 143 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 144 insertions(+) - create mode 100644 tc/f_matchall.c - -diff --git a/tc/Makefile b/tc/Makefile -index a6ad9aee..6967a942 100644 ---- a/tc/Makefile -+++ b/tc/Makefile -@@ -59,6 +59,7 @@ TCMODULES += q_mqprio.o - TCMODULES += q_codel.o - TCMODULES += q_fq_codel.o - TCMODULES += q_fq.o -+TCMODULES += f_matchall.o - - ifeq ($(TC_CONFIG_IPSET), y) - ifeq ($(TC_CONFIG_XT), y) -diff --git a/tc/f_matchall.c b/tc/f_matchall.c -new file mode 100644 -index 00000000..04e524e3 ---- /dev/null -+++ b/tc/f_matchall.c -@@ -0,0 +1,143 @@ -+/* -+ * f_matchall.c Match-all Classifier -+ * -+ * This program is free software; you can distribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * as published by the Free Software Foundation; either version -+ * 2 of the License, or (at your option) any later version. -+ * -+ * Authors: Jiri Pirko , Yotam Gigi -+ * -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "utils.h" -+#include "tc_util.h" -+ -+static void explain(void) -+{ -+ fprintf(stderr, "Usage: ... matchall [skip_sw | skip_hw]\n"); -+ fprintf(stderr, " [ action ACTION_SPEC ] [ classid CLASSID ]\n"); -+ fprintf(stderr, "\n"); -+ fprintf(stderr, "Where: SELECTOR := SAMPLE SAMPLE ...\n"); -+ fprintf(stderr, " FILTERID := X:Y:Z\n"); -+ fprintf(stderr, " ACTION_SPEC := ... look at individual actions\n"); -+ fprintf(stderr, "\nNOTE: CLASSID is parsed as hexadecimal input.\n"); -+} -+ -+static int matchall_parse_opt(struct filter_util *qu, char *handle, -+ int argc, char **argv, struct nlmsghdr *n) -+{ -+ struct tcmsg *t = NLMSG_DATA(n); -+ struct rtattr *tail; -+ __u32 flags = 0; -+ long h = 0; -+ -+ if (handle) { -+ h = strtol(handle, NULL, 0); -+ if (h == LONG_MIN || h == LONG_MAX) { -+ fprintf(stderr, "Illegal handle \"%s\", must be numeric.\n", -+ handle); -+ return -1; -+ } -+ } -+ t->tcm_handle = h; -+ -+ if (argc == 0) -+ return 0; -+ -+ tail = (struct rtattr *)(((void *)n)+NLMSG_ALIGN(n->nlmsg_len)); -+ addattr_l(n, MAX_MSG, TCA_OPTIONS, NULL, 0); -+ -+ while (argc > 0) { -+ if (matches(*argv, "classid") == 0 || -+ strcmp(*argv, "flowid") == 0) { -+ unsigned int handle; -+ -+ NEXT_ARG(); -+ if (get_tc_classid(&handle, *argv)) { -+ fprintf(stderr, "Illegal \"classid\"\n"); -+ return -1; -+ } -+ addattr_l(n, MAX_MSG, TCA_MATCHALL_CLASSID, &handle, 4); -+ } else if (matches(*argv, "action") == 0) { -+ NEXT_ARG(); -+ if (parse_action(&argc, &argv, TCA_MATCHALL_ACT, n)) { -+ fprintf(stderr, "Illegal \"action\"\n"); -+ return -1; -+ } -+ continue; -+ -+ } else if (strcmp(*argv, "skip_hw") == 0) { -+ NEXT_ARG(); -+ flags |= TCA_CLS_FLAGS_SKIP_HW; -+ continue; -+ } else if (strcmp(*argv, "skip_sw") == 0) { -+ NEXT_ARG(); -+ flags |= TCA_CLS_FLAGS_SKIP_SW; -+ continue; -+ } else if (strcmp(*argv, "help") == 0) { -+ explain(); -+ return -1; -+ } else { -+ fprintf(stderr, "What is \"%s\"?\n", *argv); -+ explain(); -+ return -1; -+ } -+ argc--; argv++; -+ } -+ -+ if (flags) { -+ if (!(flags ^ (TCA_CLS_FLAGS_SKIP_HW | -+ TCA_CLS_FLAGS_SKIP_SW))) { -+ fprintf(stderr, -+ "skip_hw and skip_sw are mutually exclusive\n"); -+ return -1; -+ } -+ addattr_l(n, MAX_MSG, TCA_MATCHALL_FLAGS, &flags, 4); -+ } -+ -+ tail->rta_len = (((void *)n)+n->nlmsg_len) - (void *)tail; -+ return 0; -+} -+ -+static int matchall_print_opt(struct filter_util *qu, FILE *f, -+ struct rtattr *opt, __u32 handle) -+{ -+ struct rtattr *tb[TCA_MATCHALL_MAX+1]; -+ -+ if (opt == NULL) -+ return 0; -+ -+ parse_rtattr_nested(tb, TCA_MATCHALL_MAX, opt); -+ -+ if (handle) -+ fprintf(f, "handle 0x%x ", handle); -+ -+ if (tb[TCA_MATCHALL_CLASSID]) { -+ SPRINT_BUF(b1); -+ fprintf(f, "flowid %s ", -+ sprint_tc_classid(rta_getattr_u32(tb[TCA_MATCHALL_CLASSID]), b1)); -+ } -+ -+ if (tb[TCA_MATCHALL_ACT]) -+ tc_print_action(f, tb[TCA_MATCHALL_ACT]); -+ -+ return 0; -+} -+ -+struct filter_util matchall_filter_util = { -+ .id = "matchall", -+ .parse_fopt = matchall_parse_opt, -+ .print_fopt = matchall_print_opt, -+}; --- -2.13.0 - diff --git a/SOURCES/0165-tc-man-Add-man-entry-for-the-matchall-classifier.patch b/SOURCES/0165-tc-man-Add-man-entry-for-the-matchall-classifier.patch deleted file mode 100644 index 3f9a4a8..0000000 --- a/SOURCES/0165-tc-man-Add-man-entry-for-the-matchall-classifier.patch +++ /dev/null @@ -1,143 +0,0 @@ -From 5dccfc9ce00b980b81fea7204b5764544a895f0e Mon Sep 17 00:00:00 2001 -From: Ivan Vecera -Date: Wed, 31 May 2017 15:43:43 +0200 -Subject: [PATCH 165/169] tc: man: Add man entry for the matchall classifier. - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1435624 -Upstream status: iproute2.git commit 0501294bca39a - -commit 0501294bca39a19090dae302dc491684470b1a0d -Author: Yotam Gigi -Date: Wed Aug 31 09:28:27 2016 +0200 - - tc: man: Add man entry for the matchall classifier. - - In addition to providing information about the mathcall filter and its - configurations, the man entry contains examples for creating port - mirorring entries. - - Signed-off-by: Yotam Gigi - Signed-off-by: Jiri Pirko - -Signed-off-by: Ivan Vecera ---- - man/man8/Makefile | 2 +- - man/man8/tc-matchall.8 | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++ - man/man8/tc.8 | 5 ++++ - 3 files changed, 82 insertions(+), 1 deletion(-) - create mode 100644 man/man8/tc-matchall.8 - -diff --git a/man/man8/Makefile b/man/man8/Makefile -index 8d73f1ea..93b4cdc9 100644 ---- a/man/man8/Makefile -+++ b/man/man8/Makefile -@@ -12,7 +12,7 @@ MAN8PAGES = $(TARGETS) ip.8 arpd.8 lnstat.8 routel.8 rtacct.8 rtmon.8 rtpr.8 ss. - ip-netns.8 ip-ntable.8 ip-rule.8 ip-tunnel.8 ip-xfrm.8 \ - ip-tcp_metrics.8 ip-netconf.8 ip-token.8 \ - tc-basic.8 tc-cgroup.8 tc-flow.8 tc-flower.8 tc-fw.8 tc-route.8 \ -- tc-tcindex.8 tc-u32.8 \ -+ tc-tcindex.8 tc-u32.8 tc-matchall.8 \ - tc-csum.8 tc-mirred.8 tc-nat.8 tc-pedit.8 tc-police.8 \ - tc-simple.8 tc-skbedit.8 tc-xt.8 - -diff --git a/man/man8/tc-matchall.8 b/man/man8/tc-matchall.8 -new file mode 100644 -index 00000000..f9209226 ---- /dev/null -+++ b/man/man8/tc-matchall.8 -@@ -0,0 +1,76 @@ -+.TH "Match-all classifier in tc" 8 "21 Oct 2015" "iproute2" "Linux" -+ -+.SH NAME -+matchall \- traffic control filter that matches every packet -+.SH SYNOPSIS -+.in +8 -+.ti -8 -+.BR tc " " filter " ... " matchall " [ " -+.BR skip_sw " | " skip_hw -+.R " ] [ " -+.B action -+.IR ACTION_SPEC " ] [ " -+.B classid -+.IR CLASSID " ]" -+.SH DESCRIPTION -+The -+.B matchall -+filter allows to classify every packet that flows on the port and run a -+action on it. -+.SH OPTIONS -+.TP -+.BI action " ACTION_SPEC" -+Apply an action from the generic actions framework on matching packets. -+.TP -+.BI classid " CLASSID" -+Push matching packets into the class identified by -+.IR CLASSID . -+.TP -+.BI skip_sw -+Do not process filter by software. If hardware has no offload support for this -+filter, or TC offload is not enabled for the interface, operation will fail. -+.TP -+.BI skip_hw -+Do not process filter by hardware. -+.SH EXAMPLES -+To create ingress mirroring from port eth1 to port eth2: -+.RS -+.EX -+ -+tc qdisc add dev eth1 handle ffff: ingress -+tc filter add dev eth1 parent ffff: \\ -+ matchall skip_sw \\ -+ action mirred egress mirror \\ -+ dev eth2 -+.EE -+.RE -+ -+The first command creats an ingress qdisc with handle -+.BR ffff: -+on device -+.BR eth1 -+where the second command attaches a matchall filters on it that mirrors the -+packets to device eth2. -+ -+To create egress mirroring from port eth1 to port eth2: -+.EX -+ -+tc qdisc add dev eth1 handle 1: root prio -+tc filter add dev eth1 parent 1: \\ -+ matchall skip_sw \\ -+ action mirred egress mirror \\ -+ dev eth2 -+.EE -+.RE -+ -+The first command creats an egress qdisc with handle -+.BR 1: -+that replaces the root qdisc on device -+.BR eth1 -+where the second command attaches a matchall filters on it that mirrors the -+packets to device eth2. -+ -+ -+.EE -+.SH SEE ALSO -+.BR tc (8), -diff --git a/man/man8/tc.8 b/man/man8/tc.8 -index ee3479eb..42121b0c 100644 ---- a/man/man8/tc.8 -+++ b/man/man8/tc.8 -@@ -184,6 +184,11 @@ u32 - Generic filtering on arbitrary packet data, assisted by syntax to abstract common operations. See - .BR tc-u32 (8) - for details. -+.TP -+matchall -+Traffic control filter that matches every packet. See -+.BR tc-matchall (8) -+for details. - - .SH CLASSLESS QDISCS - The classless qdiscs are: --- -2.13.0 - diff --git a/SOURCES/0166-tc-add-missing-limits.h-header.patch b/SOURCES/0166-tc-add-missing-limits.h-header.patch deleted file mode 100644 index 47fe171..0000000 --- a/SOURCES/0166-tc-add-missing-limits.h-header.patch +++ /dev/null @@ -1,50 +0,0 @@ -From c92669986eb3f899905224e8bcb78460e655bf5b Mon Sep 17 00:00:00 2001 -From: Ivan Vecera -Date: Wed, 31 May 2017 15:44:34 +0200 -Subject: [PATCH 166/169] tc: add missing limits.h header -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1435624 -Upstream status: iproute2.git commit d421bb4efea64 - -commit d421bb4efea6470c1667be3e8bfb1529e8e832d0 -Author: Baruch Siach -Date: Thu Dec 22 20:52:48 2016 +0200 - - tc: add missing limits.h header - - This fixes under musl build issues like: - - f_matchall.c: In function ‘matchall_parse_opt’: - f_matchall.c:48:12: error: ‘LONG_MIN’ undeclared (first use in this function) - if (h == LONG_MIN || h == LONG_MAX) { - ^ - f_matchall.c:48:12: note: each undeclared identifier is reported only once for each function it appears in - f_matchall.c:48:29: error: ‘LONG_MAX’ undeclared (first use in this function) - if (h == LONG_MIN || h == LONG_MAX) { - ^ - - Signed-off-by: Baruch Siach - -Signed-off-by: Ivan Vecera ---- - tc/tc_util.h | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/tc/tc_util.h b/tc/tc_util.h -index 4f544363..3e0da966 100644 ---- a/tc/tc_util.h -+++ b/tc/tc_util.h -@@ -2,6 +2,7 @@ - #define _TC_UTIL_H_ 1 - - #define MAX_MSG 16384 -+#include - #include - #include - #include --- -2.13.0 - diff --git a/SOURCES/0167-tc-man-matchall-Fix-example-indentation.patch b/SOURCES/0167-tc-man-matchall-Fix-example-indentation.patch deleted file mode 100644 index 2d90c8c..0000000 --- a/SOURCES/0167-tc-man-matchall-Fix-example-indentation.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 0fee4b1316e3be7e2c8a0f675931acf0d0d36f7a Mon Sep 17 00:00:00 2001 -From: Ivan Vecera -Date: Wed, 31 May 2017 15:45:01 +0200 -Subject: [PATCH 167/169] tc: man: matchall: Fix example indentation - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1435624 -Upstream status: iproute2.git commit d65a744cdbe97 - -commit d65a744cdbe973cf807be108c73c91c0996b9c66 -Author: Yotam Gigi -Date: Tue Jan 31 11:47:47 2017 +0200 - - tc: man: matchall: Fix example indentation - - The man page contains two examples, which have different indentation. Fix - the indentation of the two examples to match. - - Reviewed-by: Jiri Pirko - Signed-off-by: Yotam Gigi - -Signed-off-by: Ivan Vecera ---- - man/man8/tc-matchall.8 | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/man/man8/tc-matchall.8 b/man/man8/tc-matchall.8 -index f9209226..5aa11dab 100644 ---- a/man/man8/tc-matchall.8 -+++ b/man/man8/tc-matchall.8 -@@ -53,6 +53,7 @@ where the second command attaches a matchall filters on it that mirrors the - packets to device eth2. - - To create egress mirroring from port eth1 to port eth2: -+.RS - .EX - - tc qdisc add dev eth1 handle 1: root prio --- -2.13.0 - diff --git a/SOURCES/0168-tc-matchall-Print-skip-flags-when-dumping-a-filter.patch b/SOURCES/0168-tc-matchall-Print-skip-flags-when-dumping-a-filter.patch deleted file mode 100644 index 7dc7413..0000000 --- a/SOURCES/0168-tc-matchall-Print-skip-flags-when-dumping-a-filter.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 7adefadcd79a33ba625a948c42745a7ff51325f6 Mon Sep 17 00:00:00 2001 -From: Ivan Vecera -Date: Wed, 31 May 2017 15:45:26 +0200 -Subject: [PATCH 168/169] tc: matchall: Print skip flags when dumping a filter - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1435624 -Upstream status: iproute2.git commit afdc1fed243f5 - -commit afdc1fed243f5499a53f5fda202031cf4c4d4044 -Author: Or Gerlitz -Date: Thu Feb 9 15:10:14 2017 +0200 - - tc: matchall: Print skip flags when dumping a filter - - Print the skip flags when we dump a filter. - - Signed-off-by: Or Gerlitz - Acked by: Yotam Gigi - Reviewed-by: Simon Horman - -Signed-off-by: Ivan Vecera ---- - tc/f_matchall.c | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/tc/f_matchall.c b/tc/f_matchall.c -index 04e524e3..ac486308 100644 ---- a/tc/f_matchall.c -+++ b/tc/f_matchall.c -@@ -130,6 +130,15 @@ static int matchall_print_opt(struct filter_util *qu, FILE *f, - sprint_tc_classid(rta_getattr_u32(tb[TCA_MATCHALL_CLASSID]), b1)); - } - -+ if (tb[TCA_MATCHALL_FLAGS]) { -+ __u32 flags = rta_getattr_u32(tb[TCA_MATCHALL_FLAGS]); -+ -+ if (flags & TCA_CLS_FLAGS_SKIP_HW) -+ fprintf(f, "\n skip_hw"); -+ if (flags & TCA_CLS_FLAGS_SKIP_SW) -+ fprintf(f, "\n skip_sw"); -+ } -+ - if (tb[TCA_MATCHALL_ACT]) - tc_print_action(f, tb[TCA_MATCHALL_ACT]); - --- -2.13.0 - diff --git a/SOURCES/0169-tc-clsact-add-clsact-frontend.patch b/SOURCES/0169-tc-clsact-add-clsact-frontend.patch deleted file mode 100644 index a5fc0e7..0000000 --- a/SOURCES/0169-tc-clsact-add-clsact-frontend.patch +++ /dev/null @@ -1,178 +0,0 @@ -From cca177ccfd0b5ae01ed8954f36c913fd95ef4b84 Mon Sep 17 00:00:00 2001 -From: Ivan Vecera -Date: Wed, 31 May 2017 15:45:54 +0200 -Subject: [PATCH 169/169] tc, clsact: add clsact frontend - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1435624 -Upstream status: iproute2.git commit 8f9afdd531560 -Upstream divergences: Only partially backported to provide 'ingress' keyword - for 'tc filter' command. The commit itself provides support for 'clsact' - qdisc that is not supported on RHEL. - -commit 8f9afdd531560c1534be44424669add2e19deeec -Author: Daniel Borkmann -Date: Tue Jan 12 01:42:20 2016 +0100 - - tc, clsact: add clsact frontend - - Add the tc part for the kernel commit 1f211a1b929c ("net, sched: add - clsact qdisc"). Quoting example usage from that commit description: - - Example, adding qdisc: - - # tc qdisc add dev foo clsact - # tc qdisc show dev foo - qdisc mq 0: root - qdisc pfifo_fast 0: parent :1 bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1 - qdisc pfifo_fast 0: parent :2 bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1 - qdisc pfifo_fast 0: parent :3 bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1 - qdisc pfifo_fast 0: parent :4 bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1 - qdisc clsact ffff: parent ffff:fff1 - - Adding filters (deleting, etc works analogous by specifying ingress/egress): - - # tc filter add dev foo ingress bpf da obj bar.o sec ingress - # tc filter add dev foo egress bpf da obj bar.o sec egress - # tc filter show dev foo ingress - filter protocol all pref 49152 bpf - filter protocol all pref 49152 bpf handle 0x1 bar.o:[ingress] direct-action - # tc filter show dev foo egress - filter protocol all pref 49152 bpf - filter protocol all pref 49152 bpf handle 0x1 bar.o:[egress] direct-action - - The ingress parent alias can also be used with ingress qdisc. - - Signed-off-by: Daniel Borkmann - -Signed-off-by: Ivan Vecera ---- - tc/tc_filter.c | 46 ++++++++++++++++++++++++++++++++++++++-------- - tc/tc_qdisc.c | 3 --- - 2 files changed, 38 insertions(+), 11 deletions(-) - -diff --git a/tc/tc_filter.c b/tc/tc_filter.c -index e76d616f..2a303c04 100644 ---- a/tc/tc_filter.c -+++ b/tc/tc_filter.c -@@ -26,25 +26,21 @@ - #include "tc_util.h" - #include "tc_common.h" - --static void usage(void); -- - static void usage(void) - { - fprintf(stderr, "Usage: tc filter [ add | del | change | replace | show ] dev STRING\n"); - fprintf(stderr, " [ pref PRIO ] protocol PROTO\n"); - fprintf(stderr, " [ estimator INTERVAL TIME_CONSTANT ]\n"); -- fprintf(stderr, " [ root | classid CLASSID ] [ handle FILTERID ]\n"); -- fprintf(stderr, " [ [ FILTER_TYPE ] [ help | OPTIONS ] ]\n"); -+ fprintf(stderr, " [ root | ingress | egress | parent CLASSID ]\n"); -+ fprintf(stderr, " [ handle FILTERID ] [ [ FILTER_TYPE ] [ help | OPTIONS ] ]\n"); - fprintf(stderr, "\n"); -- fprintf(stderr, " tc filter show [ dev STRING ] [ root | parent CLASSID ]\n"); -+ fprintf(stderr, " tc filter show [ dev STRING ] [ root | ingress | egress | parent CLASSID ]\n"); - fprintf(stderr, "Where:\n"); - fprintf(stderr, "FILTER_TYPE := { rsvp | u32 | fw | route | etc. }\n"); - fprintf(stderr, "FILTERID := ... format depends on classifier, see there\n"); - fprintf(stderr, "OPTIONS := ... try tc filter add help\n"); -- return; - } - -- - static int tc_filter_modify(int cmd, unsigned flags, int argc, char **argv) - { - struct { -@@ -87,6 +83,20 @@ static int tc_filter_modify(int cmd, unsigned flags, int argc, char **argv) - return -1; - } - req.t.tcm_parent = TC_H_ROOT; -+ } else if (strcmp(*argv, "ingress") == 0) { -+ if (req.t.tcm_parent) { -+ fprintf(stderr, "Error: \"ingress\" is duplicate parent ID\n"); -+ return -1; -+ } -+ req.t.tcm_parent = TC_H_MAKE(TC_H_CLSACT, -+ TC_H_MIN_INGRESS); -+ } else if (strcmp(*argv, "egress") == 0) { -+ if (req.t.tcm_parent) { -+ fprintf(stderr, "Error: \"egress\" is duplicate parent ID\n"); -+ return -1; -+ } -+ req.t.tcm_parent = TC_H_MAKE(TC_H_CLSACT, -+ TC_H_MIN_EGRESS); - } else if (strcmp(*argv, "parent") == 0) { - __u32 handle; - NEXT_ARG(); -@@ -220,11 +230,16 @@ int print_filter(const struct sockaddr_nl *who, - if (!filter_parent || filter_parent != t->tcm_parent) { - if (t->tcm_parent == TC_H_ROOT) - fprintf(fp, "root "); -+ else if (t->tcm_parent == TC_H_MAKE(TC_H_CLSACT, TC_H_MIN_INGRESS)) -+ fprintf(fp, "ingress "); -+ else if (t->tcm_parent == TC_H_MAKE(TC_H_CLSACT, TC_H_MIN_EGRESS)) -+ fprintf(fp, "egress "); - else { - print_tc_classid(abuf, sizeof(abuf), t->tcm_parent); - fprintf(fp, "parent %s ", abuf); - } - } -+ - if (t->tcm_info) { - f_proto = TC_H_MIN(t->tcm_info); - __u32 prio = TC_H_MAJ(t->tcm_info)>>16; -@@ -259,7 +274,6 @@ int print_filter(const struct sockaddr_nl *who, - return 0; - } - -- - static int tc_filter_list(int argc, char **argv) - { - struct tcmsg t; -@@ -284,6 +298,22 @@ static int tc_filter_list(int argc, char **argv) - return -1; - } - filter_parent = t.tcm_parent = TC_H_ROOT; -+ } else if (strcmp(*argv, "ingress") == 0) { -+ if (t.tcm_parent) { -+ fprintf(stderr, "Error: \"ingress\" is duplicate parent ID\n"); -+ return -1; -+ } -+ filter_parent = TC_H_MAKE(TC_H_CLSACT, -+ TC_H_MIN_INGRESS); -+ t.tcm_parent = filter_parent; -+ } else if (strcmp(*argv, "egress") == 0) { -+ if (t.tcm_parent) { -+ fprintf(stderr, "Error: \"egress\" is duplicate parent ID\n"); -+ return -1; -+ } -+ filter_parent = TC_H_MAKE(TC_H_CLSACT, -+ TC_H_MIN_EGRESS); -+ t.tcm_parent = filter_parent; - } else if (strcmp(*argv, "parent") == 0) { - __u32 handle; - NEXT_ARG(); -diff --git a/tc/tc_qdisc.c b/tc/tc_qdisc.c -index c31ae8d2..61aec4f8 100644 ---- a/tc/tc_qdisc.c -+++ b/tc/tc_qdisc.c -@@ -26,8 +26,6 @@ - #include "tc_util.h" - #include "tc_common.h" - --static int usage(void); -- - static int usage(void) - { - fprintf(stderr, "Usage: tc qdisc [ add | del | replace | change | show ] dev STRING\n"); -@@ -277,7 +275,6 @@ int print_qdisc(const struct sockaddr_nl *who, - return 0; - } - -- - static int tc_qdisc_list(int argc, char **argv) - { - struct tcmsg t; --- -2.13.0 - diff --git a/SOURCES/0170-devlink-Add-e-switch-support.patch b/SOURCES/0170-devlink-Add-e-switch-support.patch deleted file mode 100644 index 8c29870..0000000 --- a/SOURCES/0170-devlink-Add-e-switch-support.patch +++ /dev/null @@ -1,288 +0,0 @@ -From b55eb737f0bf16eb25435ba84a2ff017ab804d36 Mon Sep 17 00:00:00 2001 -From: Sabrina Dubroca -Date: Fri, 9 Jun 2017 10:06:23 +0200 -Subject: [PATCH] devlink: Add e-switch support - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1459772 -Upstream Status: iproute2.git commit f57856fab2e5 - -Conflicts: in pr_out_eswitch and cmd_dev_eswitch_show, because we don't -support json output. Fix that by doing the reverse of the transformation -that commit e3d0f0c0e3d8 did to pr_out_port(). - -commit f57856fab2e51047c833f5618f2af231f3a9fb5a -Author: Or Gerlitz -Date: Sun Aug 28 16:35:21 2016 +0300 - - devlink: Add e-switch support - - Implement kernel devlink e-switch interface. Currently we allow - to get and set the device e-switch mode. - - Signed-off-by: Or Gerlitz - Signed-off-by: Roi Dayan - Acked-by: Jiri Pirko - -Signed-off-by: Sabrina Dubroca ---- - devlink/devlink.c | 121 +++++++++++++++++++++++++++++++++++++++++++++++++ - man/man8/devlink-dev.8 | 34 ++++++++++++++ - 2 files changed, 155 insertions(+) - -diff --git a/devlink/devlink.c b/devlink/devlink.c -index ffefa86d2ed2..ab55f8c73681 100644 ---- a/devlink/devlink.c -+++ b/devlink/devlink.c -@@ -25,6 +25,9 @@ - #include "list.h" - #include "mnlg.h" - -+#define ESWITCH_MODE_LEGACY "legacy" -+#define ESWITCH_MODE_SWITCHDEV "switchdev" -+ - #define pr_err(args...) fprintf(stderr, ##args) - #define pr_out(args...) fprintf(stdout, ##args) - #define pr_out_sp(num, args...) \ -@@ -127,6 +130,7 @@ static void ifname_map_free(struct ifname_map *ifname_map) - #define DL_OPT_SB_THTYPE BIT(8) - #define DL_OPT_SB_TH BIT(9) - #define DL_OPT_SB_TC BIT(10) -+#define DL_OPT_ESWITCH_MODE BIT(11) - - struct dl_opts { - uint32_t present; /* flags of present items */ -@@ -142,6 +146,7 @@ struct dl_opts { - enum devlink_sb_threshold_type sb_pool_thtype; - uint32_t sb_threshold; - uint16_t sb_tc_index; -+ enum devlink_eswitch_mode eswitch_mode; - }; - - struct dl { -@@ -287,6 +292,9 @@ static int attr_cb(const struct nlattr *attr, void *data) - if (type == DEVLINK_ATTR_SB_OCC_MAX && - mnl_attr_validate(attr, MNL_TYPE_U32) < 0) - return MNL_CB_ERROR; -+ if (type == DEVLINK_ATTR_ESWITCH_MODE && -+ mnl_attr_validate(attr, MNL_TYPE_U16) < 0) -+ return MNL_CB_ERROR; - tb[type] = attr; - return MNL_CB_OK; - } -@@ -651,6 +659,19 @@ static int threshold_type_get(const char *typestr, - return 0; - } - -+static int eswitch_mode_get(const char *typestr, enum devlink_eswitch_mode *p_mode) -+{ -+ if (strcmp(typestr, ESWITCH_MODE_LEGACY) == 0) { -+ *p_mode = DEVLINK_ESWITCH_MODE_LEGACY; -+ } else if (strcmp(typestr, ESWITCH_MODE_SWITCHDEV) == 0) { -+ *p_mode = DEVLINK_ESWITCH_MODE_SWITCHDEV; -+ } else { -+ pr_err("Unknown eswitch mode \"%s\"\n", typestr); -+ return -EINVAL; -+ } -+ return 0; -+} -+ - static int dl_argv_parse(struct dl *dl, uint32_t o_required, - uint32_t o_optional) - { -@@ -760,6 +781,17 @@ static int dl_argv_parse(struct dl *dl, uint32_t o_required, - if (err) - return err; - o_found |= DL_OPT_SB_TC; -+ } else if (dl_argv_match(dl, "mode") && -+ (o_all & DL_OPT_ESWITCH_MODE)) { -+ const char *typestr; -+ dl_arg_inc(dl); -+ err = dl_argv_str(dl, &typestr); -+ if (err) -+ return err; -+ err = eswitch_mode_get(typestr, &opts->eswitch_mode); -+ if (err) -+ return err; -+ o_found |= DL_OPT_ESWITCH_MODE; - } else { - pr_err("Unknown option \"%s\"\n", dl_argv(dl)); - return -EINVAL; -@@ -813,6 +845,12 @@ static int dl_argv_parse(struct dl *dl, uint32_t o_required, - pr_err("TC index option expected.\n"); - return -EINVAL; - } -+ -+ if ((o_required & DL_OPT_ESWITCH_MODE) && !(o_found & DL_OPT_ESWITCH_MODE)) { -+ pr_err("E-Switch mode option expected.\n"); -+ return -EINVAL; -+ } -+ - return 0; - } - -@@ -856,6 +894,9 @@ static void dl_opts_put(struct nlmsghdr *nlh, struct dl *dl) - if (opts->present & DL_OPT_SB_TC) - mnl_attr_put_u16(nlh, DEVLINK_ATTR_SB_TC_INDEX, - opts->sb_tc_index); -+ if (opts->present & DL_OPT_ESWITCH_MODE) -+ mnl_attr_put_u16(nlh, DEVLINK_ATTR_ESWITCH_MODE, -+ opts->eswitch_mode); - } - - static int dl_argv_parse_put(struct nlmsghdr *nlh, struct dl *dl, -@@ -976,6 +1017,83 @@ static void pr_out_dev(struct nlattr **tb) - pr_out("\n"); - } - -+static const char *eswitch_mode_name(uint32_t mode) -+{ -+ switch (mode) { -+ case DEVLINK_ESWITCH_MODE_LEGACY: return ESWITCH_MODE_LEGACY; -+ case DEVLINK_ESWITCH_MODE_SWITCHDEV: return ESWITCH_MODE_SWITCHDEV; -+ default: return ""; -+ } -+} -+ -+static void pr_out_eswitch(struct dl *dl, struct nlattr **tb) -+{ -+ pr_out_handle(tb); -+ pr_out(":"); -+ -+ if (tb[DEVLINK_ATTR_ESWITCH_MODE]) -+ pr_out(" mode %s", -+ eswitch_mode_name(mnl_attr_get_u16(tb[DEVLINK_ATTR_ESWITCH_MODE]))); -+ -+ pr_out("\n"); -+} -+ -+static int cmd_dev_eswitch_show_cb(const struct nlmsghdr *nlh, void *data) -+{ -+ struct dl *dl = data; -+ struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {}; -+ struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); -+ -+ mnl_attr_parse(nlh, sizeof(*genl), attr_cb, tb); -+ if (!tb[DEVLINK_ATTR_BUS_NAME] || !tb[DEVLINK_ATTR_DEV_NAME]) -+ return MNL_CB_ERROR; -+ pr_out_eswitch(dl, tb); -+ return MNL_CB_OK; -+} -+ -+static int cmd_dev_eswitch_show(struct dl *dl) -+{ -+ struct nlmsghdr *nlh; -+ int err; -+ -+ nlh = mnlg_msg_prepare(dl->nlg, DEVLINK_CMD_ESWITCH_MODE_GET, -+ NLM_F_REQUEST | NLM_F_ACK); -+ -+ err = dl_argv_parse_put(nlh, dl, DL_OPT_HANDLE, 0); -+ if (err) -+ return err; -+ -+ return _mnlg_socket_sndrcv(dl->nlg, nlh, cmd_dev_eswitch_show_cb, NULL); -+} -+ -+static int cmd_dev_eswitch_set(struct dl *dl) -+{ -+ struct nlmsghdr *nlh; -+ int err; -+ -+ nlh = mnlg_msg_prepare(dl->nlg, DEVLINK_CMD_ESWITCH_MODE_SET, -+ NLM_F_REQUEST | NLM_F_ACK); -+ -+ err = dl_argv_parse_put(nlh, dl, DL_OPT_HANDLE | DL_OPT_ESWITCH_MODE, 0); -+ if (err) -+ return err; -+ -+ return _mnlg_socket_sndrcv(dl->nlg, nlh, NULL, NULL); -+} -+ -+static int cmd_dev_eswitch(struct dl *dl) -+{ -+ if (dl_argv_match(dl, "set")) { -+ dl_arg_inc(dl); -+ return cmd_dev_eswitch_set(dl); -+ } else if (dl_argv_match(dl, "show")) { -+ dl_arg_inc(dl); -+ return cmd_dev_eswitch_show(dl); -+ } -+ pr_err("Command \"%s\" not found\n", dl_argv(dl)); -+ return -ENOENT; -+} -+ - static int cmd_dev_show_cb(const struct nlmsghdr *nlh, void *data) - { - struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {}; -@@ -1017,6 +1135,9 @@ static int cmd_dev(struct dl *dl) - dl_argv_match(dl, "list") || dl_no_arg(dl)) { - dl_arg_inc(dl); - return cmd_dev_show(dl); -+ } else if (dl_argv_match(dl, "eswitch")) { -+ dl_arg_inc(dl); -+ return cmd_dev_eswitch(dl); - } - pr_err("Command \"%s\" not found\n", dl_argv(dl)); - return -ENOENT; -diff --git a/man/man8/devlink-dev.8 b/man/man8/devlink-dev.8 -index 62bcead37e89..9ce319374551 100644 ---- a/man/man8/devlink-dev.8 -+++ b/man/man8/devlink-dev.8 -@@ -25,6 +25,17 @@ devlink-dev \- devlink device configuration - .ti -8 - .B devlink dev help - -+.ti -8 -+.BR "devlink dev eswitch set" -+.IR DEV -+.RI "[ " -+.BR mode " { " legacy " | " switchdev " } " -+.RI "]" -+ -+.ti -8 -+.BR "devlink dev eswitch show" -+.IR DEV -+ - .SH "DESCRIPTION" - .SS devlink dev show - display devlink device attributes - -@@ -38,6 +49,19 @@ Format is: - .in +2 - BUS_NAME/BUS_ADDRESS - -+.SS devlink dev eswitch show - display devlink device eswitch attributes -+.SS devlink dev eswitch set - sets devlink device eswitch attributes -+ -+.TP -+.BR mode " { " legacy " | " switchdev " } " -+set eswitch mode -+ -+.I legacy -+- Legacy SRIOV -+ -+.I switchdev -+- SRIOV switchdev offloads -+ - .SH "EXAMPLES" - .PP - devlink dev show -@@ -48,6 +72,16 @@ Shows the state of all devlink devices on the system. - devlink dev show pci/0000:01:00.0 - .RS 4 - Shows the state of specified devlink device. -+.RE -+.PP -+devlink dev eswitch show pci/0000:01:00.0 -+.RS 4 -+Shows the eswitch mode of specified devlink device. -+.RE -+.PP -+devlink dev eswitch set pci/0000:01:00.0 mode switchdev -+.RS 4 -+Sets the eswitch mode of specified devlink device to switchdev. - - .SH SEE ALSO - .BR devlink (8), --- -2.13.1 - diff --git a/SOURCES/0171-devlink-whitespace-cleanup.patch b/SOURCES/0171-devlink-whitespace-cleanup.patch deleted file mode 100644 index 3ff99ed..0000000 --- a/SOURCES/0171-devlink-whitespace-cleanup.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 39f9fe4a47b1bb564c72944b624889d48dda2c3d Mon Sep 17 00:00:00 2001 -From: Sabrina Dubroca -Date: Fri, 9 Jun 2017 10:08:00 +0200 -Subject: [PATCH] devlink: whitespace cleanup - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1459772 -Upstream Status: iproute2.git commit 7c55d7700f43 - -commit 7c55d7700f4320186784590516993a73183bc2f2 -Author: Stephen Hemminger -Date: Mon Aug 29 11:17:38 2016 -0700 - - devlink: whitespace cleanup - - Break long lines - -Signed-off-by: Sabrina Dubroca ---- - devlink/devlink.c | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) - -diff --git a/devlink/devlink.c b/devlink/devlink.c -index ab55f8c73681..52fc7f49f51c 100644 ---- a/devlink/devlink.c -+++ b/devlink/devlink.c -@@ -659,7 +659,8 @@ static int threshold_type_get(const char *typestr, - return 0; - } - --static int eswitch_mode_get(const char *typestr, enum devlink_eswitch_mode *p_mode) -+static int eswitch_mode_get(const char *typestr, -+ enum devlink_eswitch_mode *p_mode) - { - if (strcmp(typestr, ESWITCH_MODE_LEGACY) == 0) { - *p_mode = DEVLINK_ESWITCH_MODE_LEGACY; -@@ -784,6 +785,7 @@ static int dl_argv_parse(struct dl *dl, uint32_t o_required, - } else if (dl_argv_match(dl, "mode") && - (o_all & DL_OPT_ESWITCH_MODE)) { - const char *typestr; -+ - dl_arg_inc(dl); - err = dl_argv_str(dl, &typestr); - if (err) -@@ -846,7 +848,8 @@ static int dl_argv_parse(struct dl *dl, uint32_t o_required, - return -EINVAL; - } - -- if ((o_required & DL_OPT_ESWITCH_MODE) && !(o_found & DL_OPT_ESWITCH_MODE)) { -+ if ((o_required & DL_OPT_ESWITCH_MODE) && -+ !(o_found & DL_OPT_ESWITCH_MODE)) { - pr_err("E-Switch mode option expected.\n"); - return -EINVAL; - } --- -2.13.1 - diff --git a/SOURCES/0172-devlink-Convert-conditional-in-dl_argv_handle_port-t.patch b/SOURCES/0172-devlink-Convert-conditional-in-dl_argv_handle_port-t.patch deleted file mode 100644 index 945ebe0..0000000 --- a/SOURCES/0172-devlink-Convert-conditional-in-dl_argv_handle_port-t.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 78e2bc47a913408cf51b0057230cd8d61d67e305 Mon Sep 17 00:00:00 2001 -From: Sabrina Dubroca -Date: Fri, 9 Jun 2017 10:08:08 +0200 -Subject: [PATCH] devlink: Convert conditional in dl_argv_handle_port() to - switch() - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1459772 -Upstream Status: iproute2.git commit 7a34b9d098fc - -commit 7a34b9d098fce6778a02c475fd877e0b34aa7a13 -Author: Hangbin Liu -Date: Sun Oct 9 10:14:18 2016 +0800 - - devlink: Convert conditional in dl_argv_handle_port() to switch() - - Discovered by Phil's covscan. The final return statement is never reached. - This is not inherently clear from looking at the code, so change the - conditional to a switch() statement which should clarify this. - - CC: Phil Sutter - Signed-off-by: Hangbin Liu - Acked-by: Phil Sutter - -Signed-off-by: Sabrina Dubroca ---- - devlink/devlink.c | 17 ++++++++--------- - 1 file changed, 8 insertions(+), 9 deletions(-) - -diff --git a/devlink/devlink.c b/devlink/devlink.c -index 52fc7f49f51c..07c28eb95270 100644 ---- a/devlink/devlink.c -+++ b/devlink/devlink.c -@@ -514,19 +514,18 @@ static int dl_argv_handle_port(struct dl *dl, char **p_bus_name, - return -EINVAL; - } - slash_count = strslashcount(str); -- if (slash_count != 2 && slash_count != 0) { -+ switch (slash_count) { -+ case 0: -+ return __dl_argv_handle_port_ifname(dl, str, p_bus_name, -+ p_dev_name, p_port_index); -+ case 2: -+ return __dl_argv_handle_port(str, p_bus_name, -+ p_dev_name, p_port_index); -+ default: - pr_err("Wrong port identification string format.\n"); - pr_err("Expected \"bus_name/dev_name/port_index\" or \"netdev_ifname\".\n"); - return -EINVAL; - } -- if (slash_count == 2) { -- return __dl_argv_handle_port(str, p_bus_name, -- p_dev_name, p_port_index); -- } else if (slash_count == 0) { -- return __dl_argv_handle_port_ifname(dl, str, p_bus_name, -- p_dev_name, p_port_index); -- } -- return 0; - } - - static int dl_argv_handle_both(struct dl *dl, char **p_bus_name, --- -2.13.1 - diff --git a/SOURCES/0173-devlink-write-usage-help-messages-to-stderr.patch b/SOURCES/0173-devlink-write-usage-help-messages-to-stderr.patch deleted file mode 100644 index 98e8fe3..0000000 --- a/SOURCES/0173-devlink-write-usage-help-messages-to-stderr.patch +++ /dev/null @@ -1,111 +0,0 @@ -From 5ae2d3cb2d16ad5d7e193978aefba1610de26ac5 Mon Sep 17 00:00:00 2001 -From: Sabrina Dubroca -Date: Fri, 9 Jun 2017 10:31:01 +0200 -Subject: [PATCH] devlink: write usage help messages to stderr - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1459772 -Upstream Status: iproute2.git commit 7a9466dbcba1 - -commit 7a9466dbcba1918a1c93de8f93b9ff3d62418fcf -Author: Jiri Pirko -Date: Fri Jul 22 18:34:29 2016 +0200 - - devlink: write usage help messages to stderr - - In order to not confuse reader, write help messages into stderr. - - Signed-off-by: Jiri Pirko - -Signed-off-by: Sabrina Dubroca ---- - devlink/devlink.c | 46 +++++++++++++++++++++++----------------------- - 1 file changed, 23 insertions(+), 23 deletions(-) - -diff --git a/devlink/devlink.c b/devlink/devlink.c -index 07c28eb95270..bd801880c75f 100644 ---- a/devlink/devlink.c -+++ b/devlink/devlink.c -@@ -952,7 +952,7 @@ static bool dl_dump_filter(struct dl *dl, struct nlattr **tb) - - static void cmd_dev_help(void) - { -- pr_out("Usage: devlink dev show [ DEV ]\n"); -+ pr_err("Usage: devlink dev show [ DEV ]\n"); - } - - static void __pr_out_handle(const char *bus_name, const char *dev_name) -@@ -1147,10 +1147,10 @@ static int cmd_dev(struct dl *dl) - - static void cmd_port_help(void) - { -- pr_out("Usage: devlink port show [ DEV/PORT_INDEX ]\n"); -- pr_out(" devlink port set DEV/PORT_INDEX [ type { eth | ib | auto} ]\n"); -- pr_out(" devlink port split DEV/PORT_INDEX count COUNT\n"); -- pr_out(" devlink port unsplit DEV/PORT_INDEX\n"); -+ pr_err("Usage: devlink port show [ DEV/PORT_INDEX ]\n"); -+ pr_err(" devlink port set DEV/PORT_INDEX [ type { eth | ib | auto} ]\n"); -+ pr_err(" devlink port split DEV/PORT_INDEX count COUNT\n"); -+ pr_err(" devlink port unsplit DEV/PORT_INDEX\n"); - } - - static const char *port_type_name(uint32_t type) -@@ -1297,22 +1297,22 @@ static int cmd_port(struct dl *dl) - - static void cmd_sb_help(void) - { -- pr_out("Usage: devlink sb show [ DEV [ sb SB_INDEX ] ]\n"); -- pr_out(" devlink sb pool show [ DEV [ sb SB_INDEX ] pool POOL_INDEX ]\n"); -- pr_out(" devlink sb pool set DEV [ sb SB_INDEX ] pool POOL_INDEX\n"); -- pr_out(" size POOL_SIZE thtype { static | dynamic }\n"); -- pr_out(" devlink sb port pool show [ DEV/PORT_INDEX [ sb SB_INDEX ]\n"); -- pr_out(" pool POOL_INDEX ]\n"); -- pr_out(" devlink sb port pool set DEV/PORT_INDEX [ sb SB_INDEX ]\n"); -- pr_out(" pool POOL_INDEX th THRESHOLD\n"); -- pr_out(" devlink sb tc bind show [ DEV/PORT_INDEX [ sb SB_INDEX ] tc TC_INDEX\n"); -- pr_out(" type { ingress | egress } ]\n"); -- pr_out(" devlink sb tc bind set DEV/PORT_INDEX [ sb SB_INDEX ] tc TC_INDEX\n"); -- pr_out(" type { ingress | egress } pool POOL_INDEX\n"); -- pr_out(" th THRESHOLD\n"); -- pr_out(" devlink sb occupancy show { DEV | DEV/PORT_INDEX } [ sb SB_INDEX ]\n"); -- pr_out(" devlink sb occupancy snapshot DEV [ sb SB_INDEX ]\n"); -- pr_out(" devlink sb occupancy clearmax DEV [ sb SB_INDEX ]\n"); -+ pr_err("Usage: devlink sb show [ DEV [ sb SB_INDEX ] ]\n"); -+ pr_err(" devlink sb pool show [ DEV [ sb SB_INDEX ] pool POOL_INDEX ]\n"); -+ pr_err(" devlink sb pool set DEV [ sb SB_INDEX ] pool POOL_INDEX\n"); -+ pr_err(" size POOL_SIZE thtype { static | dynamic }\n"); -+ pr_err(" devlink sb port pool show [ DEV/PORT_INDEX [ sb SB_INDEX ]\n"); -+ pr_err(" pool POOL_INDEX ]\n"); -+ pr_err(" devlink sb port pool set DEV/PORT_INDEX [ sb SB_INDEX ]\n"); -+ pr_err(" pool POOL_INDEX th THRESHOLD\n"); -+ pr_err(" devlink sb tc bind show [ DEV/PORT_INDEX [ sb SB_INDEX ] tc TC_INDEX\n"); -+ pr_err(" type { ingress | egress } ]\n"); -+ pr_err(" devlink sb tc bind set DEV/PORT_INDEX [ sb SB_INDEX ] tc TC_INDEX\n"); -+ pr_err(" type { ingress | egress } pool POOL_INDEX\n"); -+ pr_err(" th THRESHOLD\n"); -+ pr_err(" devlink sb occupancy show { DEV | DEV/PORT_INDEX } [ sb SB_INDEX ]\n"); -+ pr_err(" devlink sb occupancy snapshot DEV [ sb SB_INDEX ]\n"); -+ pr_err(" devlink sb occupancy clearmax DEV [ sb SB_INDEX ]\n"); - } - - static void pr_out_sb(struct nlattr **tb) -@@ -2114,7 +2114,7 @@ static int cmd_mon_show(struct dl *dl) - - static void cmd_mon_help(void) - { -- pr_out("Usage: devlink monitor [ all | OBJECT-LIST ]\n" -+ pr_err("Usage: devlink monitor [ all | OBJECT-LIST ]\n" - "where OBJECT-LIST := { dev | port }\n"); - } - -@@ -2133,7 +2133,7 @@ static int cmd_mon(struct dl *dl) - - static void help(void) - { -- pr_out("Usage: devlink [ OPTIONS ] OBJECT { COMMAND | help }\n" -+ pr_err("Usage: devlink [ OPTIONS ] OBJECT { COMMAND | help }\n" - "where OBJECT := { dev | port | sb | monitor }\n" - " OPTIONS := { -V[ersion] | -n[no-nice-names] }\n"); - } --- -2.13.1 - diff --git a/SOURCES/0174-devlink-Add-usage-help-for-eswitch-subcommand.patch b/SOURCES/0174-devlink-Add-usage-help-for-eswitch-subcommand.patch deleted file mode 100644 index 35c7b57..0000000 --- a/SOURCES/0174-devlink-Add-usage-help-for-eswitch-subcommand.patch +++ /dev/null @@ -1,262 +0,0 @@ -From 7a4657ac620bfdac456696fb44a6d7656baf8af2 Mon Sep 17 00:00:00 2001 -From: Sabrina Dubroca -Date: Fri, 9 Jun 2017 10:31:05 +0200 -Subject: [PATCH] devlink: Add usage help for eswitch subcommand - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1459772 -Upstream Status: iproute2.git commit a93b6bb3a2e5 - -Conflicts: in pr_out_eswitch, because we don't support json output. Fix -that by doing the reverse of the transformation that commit e3d0f0c0e3d8 -did to pr_out_port(). - -commit a93b6bb3a2e50528fa20056c2fba33cbd9cf2ec7 -Author: Roi Dayan -Date: Sun Nov 27 13:21:02 2016 +0200 - - devlink: Add usage help for eswitch subcommand - - Add missing usage help for devlink dev eswitch subcommand. - - Signed-off-by: Roi Dayan - Reviewed-by: Or Gerlitz - -Signed-off-by: Sabrina Dubroca ---- - devlink/devlink.c | 88 ++++++++++++++++++++++++++++++++++++++++++++++++-- - man/man8/devlink-dev.8 | 21 +++++++++++- - 2 files changed, 106 insertions(+), 3 deletions(-) - -diff --git a/devlink/devlink.c b/devlink/devlink.c -index bd801880c75f..ce4aff871595 100644 ---- a/devlink/devlink.c -+++ b/devlink/devlink.c -@@ -27,6 +27,10 @@ - - #define ESWITCH_MODE_LEGACY "legacy" - #define ESWITCH_MODE_SWITCHDEV "switchdev" -+#define ESWITCH_INLINE_MODE_NONE "none" -+#define ESWITCH_INLINE_MODE_LINK "link" -+#define ESWITCH_INLINE_MODE_NETWORK "network" -+#define ESWITCH_INLINE_MODE_TRANSPORT "transport" - - #define pr_err(args...) fprintf(stderr, ##args) - #define pr_out(args...) fprintf(stdout, ##args) -@@ -131,6 +135,7 @@ static void ifname_map_free(struct ifname_map *ifname_map) - #define DL_OPT_SB_TH BIT(9) - #define DL_OPT_SB_TC BIT(10) - #define DL_OPT_ESWITCH_MODE BIT(11) -+#define DL_OPT_ESWITCH_INLINE_MODE BIT(12) - - struct dl_opts { - uint32_t present; /* flags of present items */ -@@ -147,6 +152,7 @@ struct dl_opts { - uint32_t sb_threshold; - uint16_t sb_tc_index; - enum devlink_eswitch_mode eswitch_mode; -+ enum devlink_eswitch_inline_mode eswitch_inline_mode; - }; - - struct dl { -@@ -295,6 +301,9 @@ static int attr_cb(const struct nlattr *attr, void *data) - if (type == DEVLINK_ATTR_ESWITCH_MODE && - mnl_attr_validate(attr, MNL_TYPE_U16) < 0) - return MNL_CB_ERROR; -+ if (type == DEVLINK_ATTR_ESWITCH_INLINE_MODE && -+ mnl_attr_validate(attr, MNL_TYPE_U8) < 0) -+ return MNL_CB_ERROR; - tb[type] = attr; - return MNL_CB_OK; - } -@@ -672,6 +681,24 @@ static int eswitch_mode_get(const char *typestr, - return 0; - } - -+static int eswitch_inline_mode_get(const char *typestr, -+ enum devlink_eswitch_inline_mode *p_mode) -+{ -+ if (strcmp(typestr, ESWITCH_INLINE_MODE_NONE) == 0) { -+ *p_mode = DEVLINK_ESWITCH_INLINE_MODE_NONE; -+ } else if (strcmp(typestr, ESWITCH_INLINE_MODE_LINK) == 0) { -+ *p_mode = DEVLINK_ESWITCH_INLINE_MODE_LINK; -+ } else if (strcmp(typestr, ESWITCH_INLINE_MODE_NETWORK) == 0) { -+ *p_mode = DEVLINK_ESWITCH_INLINE_MODE_NETWORK; -+ } else if (strcmp(typestr, ESWITCH_INLINE_MODE_TRANSPORT) == 0) { -+ *p_mode = DEVLINK_ESWITCH_INLINE_MODE_TRANSPORT; -+ } else { -+ pr_err("Unknown eswitch inline mode \"%s\"\n", typestr); -+ return -EINVAL; -+ } -+ return 0; -+} -+ - static int dl_argv_parse(struct dl *dl, uint32_t o_required, - uint32_t o_optional) - { -@@ -793,6 +820,19 @@ static int dl_argv_parse(struct dl *dl, uint32_t o_required, - if (err) - return err; - o_found |= DL_OPT_ESWITCH_MODE; -+ } else if (dl_argv_match(dl, "inline-mode") && -+ (o_all & DL_OPT_ESWITCH_INLINE_MODE)) { -+ const char *typestr; -+ -+ dl_arg_inc(dl); -+ err = dl_argv_str(dl, &typestr); -+ if (err) -+ return err; -+ err = eswitch_inline_mode_get( -+ typestr, &opts->eswitch_inline_mode); -+ if (err) -+ return err; -+ o_found |= DL_OPT_ESWITCH_INLINE_MODE; - } else { - pr_err("Unknown option \"%s\"\n", dl_argv(dl)); - return -EINVAL; -@@ -853,6 +893,12 @@ static int dl_argv_parse(struct dl *dl, uint32_t o_required, - return -EINVAL; - } - -+ if ((o_required & DL_OPT_ESWITCH_INLINE_MODE) && -+ !(o_found & DL_OPT_ESWITCH_INLINE_MODE)) { -+ pr_err("E-Switch inline-mode option expected.\n"); -+ return -EINVAL; -+ } -+ - return 0; - } - -@@ -899,6 +945,9 @@ static void dl_opts_put(struct nlmsghdr *nlh, struct dl *dl) - if (opts->present & DL_OPT_ESWITCH_MODE) - mnl_attr_put_u16(nlh, DEVLINK_ATTR_ESWITCH_MODE, - opts->eswitch_mode); -+ if (opts->present & DL_OPT_ESWITCH_INLINE_MODE) -+ mnl_attr_put_u8(nlh, DEVLINK_ATTR_ESWITCH_INLINE_MODE, -+ opts->eswitch_inline_mode); - } - - static int dl_argv_parse_put(struct nlmsghdr *nlh, struct dl *dl, -@@ -953,6 +1002,9 @@ static bool dl_dump_filter(struct dl *dl, struct nlattr **tb) - static void cmd_dev_help(void) - { - pr_err("Usage: devlink dev show [ DEV ]\n"); -+ pr_err(" devlink dev eswitch set DEV [ mode { legacy | switchdev } ]\n"); -+ pr_err(" [ inline-mode { none | link | network | transport } ]\n"); -+ pr_err(" devlink dev eswitch show DEV\n"); - } - - static void __pr_out_handle(const char *bus_name, const char *dev_name) -@@ -1028,6 +1080,22 @@ static const char *eswitch_mode_name(uint32_t mode) - } - } - -+static const char *eswitch_inline_mode_name(uint32_t mode) -+{ -+ switch (mode) { -+ case DEVLINK_ESWITCH_INLINE_MODE_NONE: -+ return ESWITCH_INLINE_MODE_NONE; -+ case DEVLINK_ESWITCH_INLINE_MODE_LINK: -+ return ESWITCH_INLINE_MODE_LINK; -+ case DEVLINK_ESWITCH_INLINE_MODE_NETWORK: -+ return ESWITCH_INLINE_MODE_NETWORK; -+ case DEVLINK_ESWITCH_INLINE_MODE_TRANSPORT: -+ return ESWITCH_INLINE_MODE_TRANSPORT; -+ default: -+ return ""; -+ } -+} -+ - static void pr_out_eswitch(struct dl *dl, struct nlattr **tb) - { - pr_out_handle(tb); -@@ -1037,6 +1105,11 @@ static void pr_out_eswitch(struct dl *dl, struct nlattr **tb) - pr_out(" mode %s", - eswitch_mode_name(mnl_attr_get_u16(tb[DEVLINK_ATTR_ESWITCH_MODE]))); - -+ if (tb[DEVLINK_ATTR_ESWITCH_INLINE_MODE]) -+ pr_out(" inline-mode %s", -+ eswitch_inline_mode_name(mnl_attr_get_u8( -+ tb[DEVLINK_ATTR_ESWITCH_INLINE_MODE]))); -+ - pr_out("\n"); - } - -@@ -1076,16 +1149,27 @@ static int cmd_dev_eswitch_set(struct dl *dl) - nlh = mnlg_msg_prepare(dl->nlg, DEVLINK_CMD_ESWITCH_MODE_SET, - NLM_F_REQUEST | NLM_F_ACK); - -- err = dl_argv_parse_put(nlh, dl, DL_OPT_HANDLE | DL_OPT_ESWITCH_MODE, 0); -+ err = dl_argv_parse_put(nlh, dl, DL_OPT_HANDLE, -+ DL_OPT_ESWITCH_MODE | -+ DL_OPT_ESWITCH_INLINE_MODE); -+ - if (err) - return err; - -+ if (dl->opts.present == 1) { -+ pr_err("Need to set at least one option\n"); -+ return -ENOENT; -+ } -+ - return _mnlg_socket_sndrcv(dl->nlg, nlh, NULL, NULL); - } - - static int cmd_dev_eswitch(struct dl *dl) - { -- if (dl_argv_match(dl, "set")) { -+ if (dl_argv_match(dl, "help") || dl_no_arg(dl)) { -+ cmd_dev_help(); -+ return 0; -+ } else if (dl_argv_match(dl, "set")) { - dl_arg_inc(dl); - return cmd_dev_eswitch_set(dl); - } else if (dl_argv_match(dl, "show")) { -diff --git a/man/man8/devlink-dev.8 b/man/man8/devlink-dev.8 -index 9ce319374551..6bfe66f87955 100644 ---- a/man/man8/devlink-dev.8 -+++ b/man/man8/devlink-dev.8 -@@ -31,6 +31,9 @@ devlink-dev \- devlink device configuration - .RI "[ " - .BR mode " { " legacy " | " switchdev " } " - .RI "]" -+.RI "[ " -+.BR inline-mode " { " none " | " link " | " network " | " transport " } " -+.RI "]" - - .ti -8 - .BR "devlink dev eswitch show" -@@ -54,7 +57,7 @@ BUS_NAME/BUS_ADDRESS - - .TP - .BR mode " { " legacy " | " switchdev " } " --set eswitch mode -+Set eswitch mode - - .I legacy - - Legacy SRIOV -@@ -62,6 +65,22 @@ set eswitch mode - .I switchdev - - SRIOV switchdev offloads - -+.TP -+.BR inline-mode " { " none " | " link " | " network " | " transport " } " -+Some HWs need the VF driver to put part of the packet headers on the TX descriptor so the e-switch can do proper matching and steering. -+ -+.I none -+- None -+ -+.I link -+- L2 mode -+ -+.I network -+- L3 mode -+ -+.I transport -+- L4 mode -+ - .SH "EXAMPLES" - .PP - devlink dev show --- -2.13.1 - diff --git a/SOURCES/0175-devlink-Call-dl_free-in-early-exit-case.patch b/SOURCES/0175-devlink-Call-dl_free-in-early-exit-case.patch deleted file mode 100644 index 0f30458..0000000 --- a/SOURCES/0175-devlink-Call-dl_free-in-early-exit-case.patch +++ /dev/null @@ -1,52 +0,0 @@ -From af98686199a4b31c19894448d3942687bbcd1905 Mon Sep 17 00:00:00 2001 -From: Sabrina Dubroca -Date: Fri, 9 Jun 2017 10:31:30 +0200 -Subject: [PATCH] devlink: Call dl_free in early exit case - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1459772 -Upstream Status: iproute2.git commit b77c77d29495 - -commit b77c77d294959bc8c8ef948fc7849d1794347f8e -Author: Leon Romanovsky -Date: Tue Feb 14 07:29:38 2017 +0200 - - devlink: Call dl_free in early exit case - - Prior to parsing command options, the devlink tool allocates memory - to store results. In case of early exit (wrong parameters or version - check), this memory wasn't freed. - - Signed-off-by: Leon Romanovsky - Acked-by: Jiri Pirko - -Signed-off-by: Sabrina Dubroca ---- - devlink/devlink.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/devlink/devlink.c b/devlink/devlink.c -index ce4aff871595..a81668b0929c 100644 ---- a/devlink/devlink.c -+++ b/devlink/devlink.c -@@ -2314,14 +2314,16 @@ int main(int argc, char **argv) - switch (opt) { - case 'V': - printf("devlink utility, iproute2-ss%s\n", SNAPSHOT); -- return EXIT_SUCCESS; -+ ret = EXIT_SUCCESS; -+ goto dl_free; - case 'n': - dl->no_nice_names = true; - break; - default: - pr_err("Unknown option.\n"); - help(); -- return EXIT_FAILURE; -+ ret = EXIT_FAILURE; -+ goto dl_free; - } - } - --- -2.13.1 - diff --git a/SOURCES/rt_dsfield.deprecated b/SOURCES/rt_dsfield.deprecated new file mode 100644 index 0000000..c8eec63 --- /dev/null +++ b/SOURCES/rt_dsfield.deprecated @@ -0,0 +1,17 @@ + +# Deprecated values dropped upstream +# Kept in RHEL for backwards-compatibility +0x00 default +0x10 lowdelay +0x08 throughput +0x04 reliability +# This value overlap with ECT, do not use it! +0x02 mincost +# These values seems do not want to die, Cisco likes them by a strange reason. +0x20 priority +0x40 immediate +0x60 flash +0x80 flash-override +0xa0 critical +0xc0 internet +0xe0 network diff --git a/SPECS/iproute.spec b/SPECS/iproute.spec index 83991ef..0521a43 100644 --- a/SPECS/iproute.spec +++ b/SPECS/iproute.spec @@ -1,8 +1,8 @@ %global cbq_version v0.7.3 -%define rpmversion 3.10.0 -%define baserelease 74.el7 -%define specrelease 87%{?dist} +%define rpmversion 4.11.0 +%define baserelease 0.el7 +%define specrelease 14%{?dist} %define pkg_release %{specrelease}%{?buildid} Summary: Advanced IP routing and network device configuration tools @@ -14,175 +14,50 @@ URL: http://kernel.org/pub/linux/utils/net/%{name}2/ Source0: %{name}-%{rpmversion}-%{baserelease}.tar.xz Source1: cbq-0000.example Source2: avpkt -Patch0: 0001-misc-ss-tcp-cwnd-should-be-unsigned.patch -Patch1: 0002-macsec-fix-input-of-port-improve-documentation-of-ad.patch -Patch2: 0003-macsec-fix-byte-ordering-on-input-display-of-sci.patch -Patch3: 0004-update-inet_diag.h-header.patch -Patch4: 0005-include-Add-linux-sctp.h.patch -Patch5: 0006-ss-Add-support-for-SCTP-protocol.patch -Patch6: 0007-remove-unnecessary-extern.patch -Patch7: 0008-utils-add-missing-return-value.patch -Patch8: 0009-libnetlink-introduce-rta_nest-and-u8-u16-u64-helpers.patch -Patch14: 0015-ip-route-Prevent-some-double-spaces-in-output.patch -Patch15: 0016-ipaddress-Simplify-vf_info-parsing.patch -Patch16: 0017-ipaddress-Print-IFLA_VF_QUERY_RSS_EN-setting.patch -Patch17: 0018-ip-vfinfo-remove-code-duplication-for-IFLA_VF_RSS_QU.patch -Patch18: 0019-macsec-fix-input-range-of-icvlen-parameter.patch -Patch19: 0020-iplink-bridge_slave-add-support-for-IFLA_BRPORT_MULT.patch -Patch20: 0021-iplink-bridge_slave-add-support-for-IFLA_BRPORT_FAST.patch -Patch21: 0022-man-ip-link-Remove-bits-about-proxy_arp-and-proxy_ar.patch -Patch22: 0023-iplink-add-missing-link-type.patch -Patch23: 0024-Revert-man-ip-link-Remove-bits-about-proxy_arp-and-p.patch -Patch24: 0025-iplink-bridge_slave-add-support-for-IFLA_BRPORT_PROX.patch -Patch25: 0026-iplink-bridge_slave-add-support-for-IFLA_BRPORT_PROX.patch -Patch26: 0027-bridge-fix-reporting-of-IPv6-addresses.patch -Patch27: 0028-iproute2-ipa-show-port-id.patch -Patch28: 0029-bridge-Add-learning-and-flood-support.patch -Patch29: 0030-bridge-Make-filter_index-match-in-signedness.patch -Patch30: 0031-link-dump-filter.patch -Patch31: 0032-iproute2-bridge-bring-to-above-par-with-brctl-show-m.patch -Patch32: 0033-bridge-fdb-fix-statistics-output-spacing.patch -Patch33: 0034-bridge-fdb-add-flag-indication-for-FDB-entry-synced-.patch -Patch34: 0035-bridge-link-add-option-self.patch -Patch35: 0036-bridge-link-add-learning_sync-policy-flag.patch -Patch36: 0037-iproute2-bridge-support-vlan-range-adds.patch -Patch37: 0038-iproute2-bridge-vlan-show-new-option-to-print-ranges.patch -Patch38: 0039-Allow-specifying-bridge-port-STP-state-by-name-rathe.patch -Patch39: 0040-bridge-link-add-support-to-specify-master.patch -Patch40: 0041-fix-ip-force-batch-to-continue-on-errors.patch -Patch41: 0042-route-label-externally-offloaded-routes.patch -Patch42: 0043-iproute2-unify-naming-for-entries-offloaded-to-hardw.patch -Patch43: 0044-ip-return-correct-exit-code-on-route-failure.patch -Patch44: 0045-iproute2-ipa-show-switch-id.patch -Patch45: 0046-ip-fix-all-the-checkpatch-warnings.patch -Patch46: 0047-bridge-mdb-add-support-for-router-add-del-notificati.patch -Patch47: 0048-ip-link-proto_down-config-and-display.patch -Patch48: 0049-bridge-mdb-add-support-for-vlans.patch -Patch49: 0050-bridge-mdb-add-deleted-when-monitoring-delmdb-event.patch -Patch50: 0051-iplink-add-support-for-IFLA_BR_VLAN_FILTERING-attrib.patch -Patch51: 0052-iplink-Add-support-for-IFLA_BR_VLAN_PROTOCOL-attribu.patch -Patch52: 0053-bridge-add-batch-command-support.patch -Patch53: 0054-ip-bridge-document-timestamp-option.patch -Patch54: 0055-bridge-add-calls-to-fflush-in-fdb-and-mdb-print-func.patch -Patch55: 0056-bridge-fdb-minor-syntax-fix-in-help-text.patch -Patch56: 0057-bridge.8-document-fdb-replace-command.patch -Patch57: 0058-bridge.8-minor-formatting-cleanup.patch -Patch58: 0059-bridge-support-for-static-fdb-entries.patch -Patch59: 0060-iplink-bridge-export-bridge_id-and-designated_root.patch -Patch60: 0061-iplink-bridge-export-root_-port-path_cost-topology_c.patch -Patch61: 0062-iplink-bridge-export-read-only-timers.patch -Patch62: 0063-iplink-bridge-add-support-for-IFLA_BR_GROUP_FWD_MASK.patch -Patch63: 0064-iplink-bridge-add-support-for-IFLA_BR_GROUP_ADDR.patch -Patch64: 0065-iplink-bridge-add-support-for-IFLA_BR_VLAN_DEFAULT_P.patch -Patch65: 0066-iplink-bridge-add-support-for-IFLA_BR_MCAST_ROUTER.patch -Patch66: 0067-iplink-bridge-add-support-for-IFLA_BR_MCAST_SNOOPING.patch -Patch67: 0068-iplink-bridge-add-support-for-IFLA_BR_MCAST_QUERY_US.patch -Patch68: 0069-iplink-bridge-add-support-for-IFLA_BR_MCAST_QUERIER.patch -Patch69: 0070-iplink-bridge-add-support-for-IFLA_BR_MCAST_HASH_ELA.patch -Patch70: 0071-iplink-bridge-add-support-for-IFLA_BR_MCAST_HASH_MAX.patch -Patch71: 0072-iplink-bridge-add-support-for-IFLA_BR_MCAST_LAST_MEM.patch -Patch72: 0073-iplink-bridge-add-support-for-IFLA_BR_MCAST_STARTUP_.patch -Patch73: 0074-iplink-bridge-add-support-for-IFLA_BR_MCAST_LAST_MEM.patch -Patch74: 0075-iplink-bridge-add-support-for-IFLA_BR_MCAST_MEMBERSH.patch -Patch75: 0076-iplink-bridge-add-support-for-IFLA_BR_MCAST_QUERIER_.patch -Patch76: 0077-iplink-bridge-add-support-for-IFLA_BR_MCAST_QUERY_IN.patch -Patch77: 0078-iplink-bridge-add-support-for-IFLA_BR_MCAST_QUERY_RE.patch -Patch78: 0079-iplink-bridge-add-support-for-IFLA_BR_MCAST_STARTUP_.patch -Patch79: 0080-iplink-bridge_slave-export-read-only-values.patch -Patch80: 0081-bridge-add-support-for-dynamic-fdb-entries.patch -Patch81: 0082-iplink-bridge-remove-unnecessary-returns.patch -Patch82: 0083-bridge-mdb-add-user-space-support-for-extended-attri.patch -Patch83: 0084-bridge-mdb-add-support-for-offloaded-mdb-entries.patch -Patch84: 0085-bridge-mdb-add-support-for-extended-router-port-info.patch -Patch85: 0086-bridge-code-cleanup.patch -Patch86: 0087-bridge-fdb-add-support-to-filter-by-vlan-id.patch -Patch87: 0088-bridge-mdb-add-support-to-filter-by-vlan-id.patch -Patch88: 0089-bridge-vlan-add-support-to-filter-by-vlan-id.patch -Patch89: 0090-bridge-vlan-fix-a-few-fdb-typos-in-vlan-doc.patch -Patch90: 0091-bridge-man-fix-brige-typo.patch -Patch91: 0092-bridge-man-fix-BPUD-typo.patch -Patch92: 0093-bridge-man-fix-STP-LISTENING-description.patch -Patch93: 0094-RH-INTERNAL-Update-kernel-headers-to-v4.10.0.patch -Patch94: 0095-bridge-add-support-for-the-multicast-flood-flag.patch -Patch95: 0096-change-of-rtnetlink-to-use-RTN_F_OFFLOAD.patch -Patch96: 0097-ip-make-resolve-addr-to-print-names-rather-than-addr.patch -Patch97: 0098-tc-add-support-for-Flower-classifier.patch -Patch98: 0099-tc-improve-filter-help-texts-a-bit.patch -Patch99: 0100-tc-add-a-man-page-for-flower-filter.patch -Patch100: 0101-tc-ship-filter-man-pages-and-refer-to-them-in-tc.8.patch -Patch101: 0102-ip6tunnel-print-local-remote-addresses-like-iptunnel.patch -Patch102: 0103-tc-flower-no-need-to-specify-the-ethertype.patch -Patch103: 0104-make-format_host-non-reentrant-by-default.patch -Patch104: 0105-utils-make-rt_addr_n2a-non-reentrant-by-default.patch -Patch105: 0106-lib-utils-introduce-rt_addr_n2a_rta.patch -Patch106: 0107-utils-add-get_be-16-32-64-use-them-where-possible.patch -Patch107: 0108-tc-flower-Add-skip_-hw-sw-support.patch -Patch108: 0109-tc-flower-Introduce-vlan-support.patch -Patch109: 0110-tc-flower-checkpatch-cleanups.patch -Patch110: 0111-tc-flower-Fix-usage-message.patch -Patch111: 0112-tc-flower-Support-matching-on-SCTP-ports.patch -Patch112: 0113-libnetlink-Introduce-rta_getattr_be.patch -Patch113: 0114-tc-cls_flower-Classify-packet-in-ip-tunnels.patch -Patch114: 0115-tc-flower-remove-references-to-eth_type-in-manpage.patch -Patch115: 0116-tc-flower-document-SCTP-ip_proto.patch -Patch116: 0117-tc-flower-correct-name-of-ip_proto-parameter-to-flow.patch -Patch117: 0118-tc-flower-make-use-of-flower_port_attr_type-safe-and.patch -Patch118: 0119-tc-flower-introduce-enum-flower_endpoint.patch -Patch119: 0120-tc-flower-support-matching-on-ICMP-type-and-code.patch -Patch120: 0121-tc-cls_flower-Add-dest-UDP-port-to-tunnel-params.patch -Patch121: 0122-tc-flower-Fix-typo-and-style-in-flower-man-page.patch -Patch122: 0123-tc-flower-document-that-_ip-parameters-take-a-PREFIX.patch -Patch123: 0124-tc-flower-Allow-_mac-options-to-accept-a-mask.patch -Patch124: 0125-tc-cls_flower-Add-to-the-usage-encapsulation-dest-UD.patch -Patch125: 0126-tc-flower-support-matching-flags.patch -Patch126: 0127-tc-flower-Update-dest-UDP-port-documentation.patch -Patch127: 0128-tc-flower-Fix-flower-output-for-src-and-dst-ports.patch -Patch128: 0129-tc-flower-Add-missing-err-check-when-parsing-flower-.patch -Patch129: 0130-tc-flower-Fix-incorrect-error-msg-about-eth-type.patch -Patch130: 0131-kernel-headers-update.patch -Patch131: 0132-tc-flower-Support-matching-ARP.patch -Patch132: 0133-tc-flower-Refactor-matching-flags-to-be-more-user-fr.patch -Patch133: 0134-f_flower-don-t-set-TCA_FLOWER_KEY_ETH_TYPE-for-proto.patch -Patch134: 0135-tc-flower-use-correct-type-when-calling-flower_icmp_.patch -Patch135: 0136-tc-flower-Update-documentation-to-indicate-ARP-takes.patch -Patch136: 0137-tc-flower-provide-generic-masked-u8-parser-helper.patch -Patch137: 0138-tc-flower-provide-generic-masked-u8-print-helper.patch -Patch138: 0139-tc-flower-support-masked-ICMP-code-and-type-match.patch -Patch139: 0140-tc-flower-Fix-parsing-ip-address.patch -Patch140: 0141-libgenl-introduce-genl_init_handle.patch -Patch141: 0142-macsec-show-usage-even-if-the-module-is-not-availabl.patch -Patch142: 0143-tc-don-t-accept-qdisc-handle-greater-than-ffff.patch -Patch143: 0144-ip-address-Support-filtering-by-slave-type-too.patch -Patch144: 0145-man-ss.8-Add-missing-protocols-to-description-of-A.patch -Patch145: 0146-xfrm-add-support-of-ESN-and-anti-replay-window.patch -Patch146: 0147-man-update-doc-after-support-of-ESN-and-anti-replay-.patch -Patch147: 0148-tc-m_xt-Prevent-segfault-with-standard-targets.patch -Patch148: 0149-tc-m_xt-Fix-segfault-when-adding-multiple-actions-at.patch -Patch149: 0150-tc-m_xt-Fix-indenting.patch -Patch150: 0151-tc-m_xt-Get-rid-of-one-indentation-level-in-parse_ip.patch -Patch151: 0152-tc-m_xt-Drop-unused-variable-fw-in-parse_ipt.patch -Patch152: 0153-tc-m_xt-Get-rid-of-rargc-in-parse_ipt.patch -Patch153: 0154-tc-m_xt-Get-rid-of-iargc-variable-in-parse_ipt.patch -Patch154: 0155-tc-m_xt-Simplify-argc-adjusting-in-parse_ipt.patch -Patch155: 0156-tc-m_xt-Introduce-get_xtables_target_opts.patch -Patch156: 0157-m_xt-whitespace-cleanup.patch -Patch157: 0158-tc-m_xt-Fix-segfault-with-iptables-1.6.0.patch -Patch158: 0159-tc-m_xt-Drop-needless-parentheses-from-if-checks.patch -Patch159: 0160-man-ip-link.8-document-bridge-options.patch -Patch160: 0161-man-ip-link-Specify-min-max-values-for-bridge-slave-.patch -Patch161: 0162-ip-route-Prevent-some-other-double-spaces-in-output.patch -Patch163: 0164-tc-Add-support-for-the-matchall-traffic-classifier.patch -Patch164: 0165-tc-man-Add-man-entry-for-the-matchall-classifier.patch -Patch165: 0166-tc-add-missing-limits.h-header.patch -Patch166: 0167-tc-man-matchall-Fix-example-indentation.patch -Patch167: 0168-tc-matchall-Print-skip-flags-when-dumping-a-filter.patch -Patch168: 0169-tc-clsact-add-clsact-frontend.patch -Patch169: 0170-devlink-Add-e-switch-support.patch -Patch170: 0171-devlink-whitespace-cleanup.patch -Patch171: 0172-devlink-Convert-conditional-in-dl_argv_handle_port-t.patch -Patch172: 0173-devlink-write-usage-help-messages-to-stderr.patch -Patch173: 0174-devlink-Add-usage-help-for-eswitch-subcommand.patch -Patch174: 0175-devlink-Call-dl_free-in-early-exit-case.patch +Source3: rt_dsfield.deprecated +Patch0: 0001-Confirm-success-for-each-tc-batch-command.patch +Patch1: 0002-Really-fix-get_addr-and-get_prefix-error-messages.patch +Patch2: 0003-tc-simple-Fix-documentation.patch +Patch3: 0004-tc-fix-m_simple-usage.patch +Patch4: 0005-bpf-Make-bytecode-file-reading-a-little-more-robust.patch +Patch5: 0006-ss-Fix-for-added-diag-support-check.patch +Patch6: 0007-tc-simple.8-Fix-reference-to-non-existing-tc-actions.patch +Patch7: 0008-lib-bpf-Fix-bytecode-file-parsing.patch +Patch8: 0009-tc-simple.8-Fix-one-more-reference-to-non-existing-t.patch +Patch9: 0010-tc-m_xt-Prevent-a-segfault-in-libipt.patch +Patch10: 0011-link_gre6-really-support-encaplimit-option.patch +Patch11: 0012-tc-fix-typo-in-manpage.patch +Patch12: 0013-ip-neigh-allow-flush-FAILED-neighbour-entry.patch +Patch13: 0014-netns-avoid-directory-traversal.patch +Patch14: 0015-utils-return-default-family-when-rtm_family-is-not-R.patch +Patch15: 0016-link_gre6-Fix-for-changing-tclass-flowlabel.patch +Patch16: 0017-netlink-Change-rtnl_dump_done-to-always-show-error.patch +Patch17: 0018-libnetlink-drop-unused-parameter-to-rtnl_dump_done.patch +Patch18: 0019-iproute-Add-support-for-extended-ack-to-rtnl_talk.patch +Patch19: 0020-iplink-check-for-message-truncation-in-iplink_get.patch +Patch20: 0021-iplink-double-the-buffer-size-also-in-iplink_get.patch +Patch21: 0022-lib-libnetlink-re-malloc-buff-if-size-is-not-enough.patch +Patch22: 0023-lib-libnetlink-update-rtnl_talk-to-support-malloc-bu.patch +Patch23: 0024-Update-linux-headers.patch +Patch24: 0025-devlink-Change-netlink-attribute-validation.patch +Patch25: 0026-devlink-Add-support-for-pipeline-debug-dpipe.patch +Patch26: 0027-tc-Reflect-HW-offload-status.patch +Patch27: 0028-pedit-Fix-a-typo-in-warning.patch +Patch28: 0029-pedit-Do-not-allow-using-retain-for-too-big-fields.patch +Patch29: 0030-pedit-Check-for-extended-capability-in-protocol-pars.patch +Patch30: 0031-pedit-Introduce-ipv6-support.patch +Patch31: 0032-devlink-Add-option-to-set-and-show-eswitch-encapsula.patch +Patch32: 0033-tc-flower-add-support-for-tcp-flags.patch +Patch33: 0034-iplink-Update-usage-in-help-message.patch +Patch34: 0035-tc-flower-add-support-for-matching-on-ip-tos-and-ttl.patch +Patch35: 0036-iproute-build-more-easily-on-Android.patch +Patch36: 0037-uapi-add-include-linux-vm_sockets_diag.h.patch +Patch37: 0038-ss-allow-AF_FAMILY-constants-32.patch +Patch38: 0039-ss-add-AF_VSOCK-support.patch +Patch39: 0040-link_gre6-Detect-invalid-encaplimit-values.patch +Patch40: 0041-man-tc-csum.8-Fix-inconsistency-in-example-descripti.patch +Patch41: 0042-tc-fix-command-tc-actions-del-hang-issue.patch +Patch42: 0043-ip-link-Fix-use-after-free-in-nl_get_ll_addr_len.patch License: GPLv2+ and Public Domain BuildRequires: bison BuildRequires: flex @@ -208,12 +83,13 @@ Provides: /sbin/ip %description The iproute package contains networking utilities (ip and rtmon, for example) which are designed to use the advanced networking capabilities of the Linux -2.4.x and 2.6.x kernel. +kernel. %package doc Summary: ip and tc documentation with examples Group: Applications/System License: GPLv2+ +Requires: %{name} = %{version}-%{release} %description doc The iproute documentation contains howtos and examples of settings. @@ -222,258 +98,50 @@ The iproute documentation contains howtos and examples of settings. Summary: iproute development files Group: Development/Libraries License: GPLv2+ +Requires: %{name} = %{version}-%{release} Provides: iproute-static = %{version}-%{release} %description devel The libnetlink static library. %prep -%setup -q -n %{name}-%{version}-%{baserelease} -%patch0 -p1 -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 -%patch4 -p1 -%patch5 -p1 -%patch6 -p1 -%patch7 -p1 -%patch8 -p1 -%patch14 -p1 -%patch15 -p1 -%patch16 -p1 -%patch17 -p1 -%patch18 -p1 -%patch19 -p1 -%patch20 -p1 -%patch21 -p1 -%patch22 -p1 -%patch23 -p1 -%patch24 -p1 -%patch25 -p1 -%patch26 -p1 -%patch27 -p1 -%patch28 -p1 -%patch29 -p1 -%patch30 -p1 -%patch31 -p1 -%patch32 -p1 -%patch33 -p1 -%patch34 -p1 -%patch35 -p1 -%patch36 -p1 -%patch37 -p1 -%patch38 -p1 -%patch39 -p1 -%patch40 -p1 -%patch41 -p1 -%patch42 -p1 -%patch43 -p1 -%patch44 -p1 -%patch45 -p1 -%patch46 -p1 -%patch47 -p1 -%patch48 -p1 -%patch49 -p1 -%patch50 -p1 -%patch51 -p1 -%patch52 -p1 -%patch53 -p1 -%patch54 -p1 -%patch55 -p1 -%patch56 -p1 -%patch57 -p1 -%patch58 -p1 -%patch59 -p1 -%patch60 -p1 -%patch61 -p1 -%patch62 -p1 -%patch63 -p1 -%patch64 -p1 -%patch65 -p1 -%patch66 -p1 -%patch67 -p1 -%patch68 -p1 -%patch69 -p1 -%patch70 -p1 -%patch71 -p1 -%patch72 -p1 -%patch73 -p1 -%patch74 -p1 -%patch75 -p1 -%patch76 -p1 -%patch77 -p1 -%patch78 -p1 -%patch79 -p1 -%patch80 -p1 -%patch81 -p1 -%patch82 -p1 -%patch83 -p1 -%patch84 -p1 -%patch85 -p1 -%patch86 -p1 -%patch87 -p1 -%patch88 -p1 -%patch89 -p1 -%patch90 -p1 -%patch91 -p1 -%patch92 -p1 -%patch93 -p1 -%patch94 -p1 -%patch95 -p1 -%patch96 -p1 -%patch97 -p1 -%patch98 -p1 -%patch99 -p1 -%patch100 -p1 -%patch101 -p1 -%patch102 -p1 -%patch103 -p1 -%patch104 -p1 -%patch105 -p1 -%patch106 -p1 -%patch107 -p1 -%patch108 -p1 -%patch109 -p1 -%patch110 -p1 -%patch111 -p1 -%patch112 -p1 -%patch113 -p1 -%patch114 -p1 -%patch115 -p1 -%patch116 -p1 -%patch117 -p1 -%patch118 -p1 -%patch119 -p1 -%patch120 -p1 -%patch121 -p1 -%patch122 -p1 -%patch123 -p1 -%patch124 -p1 -%patch125 -p1 -%patch126 -p1 -%patch127 -p1 -%patch128 -p1 -%patch129 -p1 -%patch130 -p1 -%patch131 -p1 -%patch132 -p1 -%patch133 -p1 -%patch134 -p1 -%patch135 -p1 -%patch136 -p1 -%patch137 -p1 -%patch138 -p1 -%patch139 -p1 -%patch140 -p1 -%patch141 -p1 -%patch142 -p1 -%patch143 -p1 -%patch144 -p1 -%patch145 -p1 -%patch146 -p1 -%patch147 -p1 -%patch148 -p1 -%patch149 -p1 -%patch150 -p1 -%patch151 -p1 -%patch152 -p1 -%patch153 -p1 -%patch154 -p1 -%patch155 -p1 -%patch156 -p1 -%patch157 -p1 -%patch158 -p1 -%patch159 -p1 -%patch160 -p1 -%patch161 -p1 -%patch163 -p1 -%patch164 -p1 -%patch165 -p1 -%patch166 -p1 -%patch167 -p1 -%patch168 -p1 -%patch169 -p1 -%patch170 -p1 -%patch171 -p1 -%patch172 -p1 -%patch173 -p1 -%patch174 -p1 +%autosetup -p1 -n %{name}-%{version}-%{baserelease} sed -i 's/iproute-doc/%{name}-%{version}/' man/man8/lnstat.8 %build export LIBDIR=/%{_libdir} export IPT_LIB_DIR=/%{_lib}/xtables -export CFLAGS="${CFLAGS:-%optflags}" +export CFLAGS="${CFLAGS:-%optflags} -fno-exceptions" ./configure make %{?_smp_mflags} make -C doc %install -mkdir -p \ - %{buildroot}%{_includedir} \ - %{buildroot}%{_sbindir} \ - %{buildroot}%{_mandir}/man3 \ - %{buildroot}%{_mandir}/man7 \ - %{buildroot}%{_mandir}/man8 \ - %{buildroot}%{_libdir}/tc \ - %{buildroot}%{_sysconfdir}/iproute2 \ - %{buildroot}%{_sysconfdir}/sysconfig/cbq - -for binary in \ - bridge/bridge \ - devlink/devlink \ - examples/cbq.init-%{cbq_version} \ - genl/genl \ - ip/ifcfg \ - ip/ip \ - ip/routef \ - ip/routel \ - ip/rtmon \ - ip/rtpr \ - misc/arpd \ - misc/ifstat \ - misc/lnstat \ - misc/nstat \ - misc/rtacct \ - misc/ss \ - tc/tc - do install -m755 ${binary} %{buildroot}%{_sbindir} -done -mv %{buildroot}%{_sbindir}/cbq.init-%{cbq_version} %{buildroot}%{_sbindir}/cbq -cd %{buildroot}%{_sbindir} - ln -s lnstat ctstat - ln -s lnstat rtstat -cd - - -# Libs -install -m644 netem/*.dist %{buildroot}%{_libdir}/tc -%if 0%{?fedora} -install -m755 tc/q_atm.so %{buildroot}%{_libdir}/tc -%endif -install -m755 tc/m_xt.so %{buildroot}%{_libdir}/tc -cd %{buildroot}%{_libdir}/tc - ln -s m_xt.so m_ipt.so -cd - - -# libnetlink +export SBINDIR=%{_sbindir} +export MANDIR=%{_mandir} +export LIBDIR=%{_libdir} +export CONFDIR=%{_sysconfdir}/iproute2 +export DOCDIR=%{_docdir} +%make_install +# libnetlink for iproute-devel install -m644 include/libnetlink.h %{buildroot}%{_includedir} install -m644 lib/libnetlink.a %{buildroot}%{_libdir} - -# Manpages -iconv -f latin1 -t utf8 man/man8/ss.8 > man/man8/ss.8.utf8 && - mv man/man8/ss.8.utf8 man/man8/ss.8 -install -m644 man/man3/*.3 %{buildroot}%{_mandir}/man3 -install -m644 man/man7/*.7 %{buildroot}%{_mandir}/man7 -install -m644 man/man8/*.8 %{buildroot}%{_mandir}/man8 +# RHEL7 ships cbq tool in standard location +install -m755 examples/cbq.init-%{cbq_version} %{buildroot}%{_sbindir}/cbq echo '.so man8/tc-cbq.8' > %{buildroot}%{_mandir}/man8/cbq.8 - -# Config files -install -m644 etc/iproute2/* %{buildroot}%{_sysconfdir}/iproute2 -for config in \ - %{SOURCE1} \ - %{SOURCE2} - do install -m644 ${config} %{buildroot}%{_sysconfdir}/sysconfig/cbq +install -d -m755 %{buildroot}%{_sysconfdir}/sysconfig/cbq +install -m644 %{SOURCE1} %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/cbq +# These man pages are missing in respective Makefile +for manpage in genl ifcfg ip-vrf; do + install -m644 man/man8/${manpage}.8 %{buildroot}%{_mandir}/man8 done +# files in here are extracted manually from %{_builddir} +rm -rf %{buildroot}%{_docdir} +# RHEL7 does not support TIPC so remove tipc tool and its man pages +rm -f %{buildroot}%{_sbindir}/tipc +rm -rf %{buildroot}%{_mandir}/man8/tipc* +# Append deprecated values to rt_dsfield for compatibility reasons +cat %{SOURCE3} >>%{buildroot}%{_sysconfdir}/iproute2/rt_dsfield %files %dir %{_sysconfdir}/iproute2 @@ -487,6 +155,7 @@ done %{_libdir}/tc/* %dir %{_sysconfdir}/sysconfig/cbq %config(noreplace) %{_sysconfdir}/sysconfig/cbq/* +%{_datadir}/bash-completion/completions/tc %files doc %doc COPYING @@ -498,8 +167,84 @@ done %{_mandir}/man3/* %{_libdir}/libnetlink.a %{_includedir}/libnetlink.h +%{_includedir}/iproute2/bpf_elf.h %changelog +* Tue Mar 06 2018 Phil Sutter [4.11.0-14.el7] +- ip-link: Fix use after free in nl_get_ll_addr_len() (Phil Sutter) [1550097] + +* Fri Dec 15 2017 Phil Sutter [4.11.0-13.el7] +- tc: fix command "tc actions del" hang issue (Phil Sutter) [1526394] + +* Wed Dec 06 2017 Phil Sutter [4.11.0-12.el7] +- man: tc-csum.8: Fix inconsistency in example description (Phil Sutter) [1417162] +- link_gre6: Detect invalid encaplimit values (Phil Sutter) [1459600] + +* Mon Nov 13 2017 Phil Sutter [4.11.0-11.el7] +- ss: add AF_VSOCK support (Stefano Brivio) [1472759] +- ss: allow AF_FAMILY constants >32 (Stefano Brivio) [1472759] +- uapi: add include linux/vm_sockets_diag.h (Stefano Brivio) [1472759] +- iproute: build more easily on Android (Phil Sutter) [1472759] + +* Fri Nov 10 2017 Phil Sutter [4.11.0-10.el7] +- tc: flower: add support for matching on ip tos and ttl (Kamal Heib) [1456539] +- iplink: Update usage in help message (Kamal Heib) [1456539] +- tc: flower: add support for tcp flags (Kamal Heib) [1456539] +- devlink: Add option to set and show eswitch encapsulation support (Kamal Heib) [1456539] +- pedit: Introduce ipv6 support (Kamal Heib) [1456539] +- pedit: Check for extended capability in protocol parser (Kamal Heib) [1456539] +- pedit: Do not allow using retain for too big fields (Kamal Heib) [1456539] +- pedit: Fix a typo in warning (Kamal Heib) [1456539] +- tc: Reflect HW offload status (Kamal Heib) [1456539] +- devlink: Add support for pipeline debug (dpipe) (Kamal Heib) [1456539] +- devlink: Change netlink attribute validation (Kamal Heib) [1456539] +- Update linux headers (Phil Sutter) [1456539] + +* Wed Nov 08 2017 Phil Sutter [4.11.0-9.el7] +- lib/libnetlink: update rtnl_talk to support malloc buff at run time (Hangbin Liu) [1380803] +- lib/libnetlink: re malloc buff if size is not enough (Hangbin Liu) [1380803] +- iplink: double the buffer size also in iplink_get() (Hangbin Liu) [1380803] +- iplink: check for message truncation in iplink_get() (Hangbin Liu) [1380803] +- iproute: Add support for extended ack to rtnl_talk (Hangbin Liu) [1380803] +- libnetlink: drop unused parameter to rtnl_dump_done (Hangbin Liu) [1380803] +- netlink: Change rtnl_dump_done to always show error (Hangbin Liu) [1380803] + +* Fri Oct 20 2017 Phil Sutter [4.11.0-8.el7] +- Fix subpackage dependencies (don't require base package ARCH) (Phil Sutter) [1489548] + +* Wed Oct 18 2017 Phil Sutter [4.11.0-7.el7] +- Make sub-packages depend on base package (Phil Sutter) [1489548] + +* Fri Oct 06 2017 Phil Sutter [4.11.0-6.el7] +- link_gre6: Fix for changing tclass/flowlabel (Phil Sutter) [1487486] +- utils: return default family when rtm_family is not RTNL_FAMILY_IPMR/IP6MR (Stefano Brivio) [1475762] +- netns: avoid directory traversal (Phil Sutter) [1468529] +- Disable -fexceptions CFLAG passed by build system (Phil Sutter) [1418715] + +* Thu Sep 28 2017 Phil Sutter [4.11.0-5.el7] +- ip neigh: allow flush FAILED neighbour entry (Matteo Croce) [1469945] +- tc: fix typo in manpage (Phil Sutter) [1417162] +- link_gre6: really support encaplimit option (Phil Sutter) [1459600] +- tc: m_xt: Prevent a segfault in libipt (Phil Sutter) [1465599] + +* Wed Sep 06 2017 Phil Sutter [4.11.0-4.el7] +- tc-simple.8: Fix one more reference to non-existing tc-actions.8 (Phil Sutter) [1477523] + +* Wed Sep 06 2017 Phil Sutter [4.11.0-3.el7] +- lib/bpf: Fix bytecode-file parsing (Phil Sutter) [1477491] +- tc-simple.8: Fix reference to non-existing tc-actions.8 (Phil Sutter) [1477523] +- ss: Fix for added diag support check (Phil Sutter) [1487152] + +* Fri Aug 11 2017 Phil Sutter [4.11.0-2.el7] +- rt_dsfield: Ship deprecated values for compatibility (Phil Sutter) [1480136] +- bpf: Make bytecode-file reading a little more robust (Phil Sutter) [1477491] +- tc: fix m_simple usage (Phil Sutter) [1477523] +- tc-simple: Fix documentation (Phil Sutter) [1477523] +- Really fix get_addr() and get_prefix() error messages (Phil Sutter) [1477206] + +* Tue Jun 27 2017 Phil Sutter [4.11.0-1.el7] +- Rebase onto upstream version 4.11.0 (Phil Sutter) [1418715] + * Tue Jun 13 2017 Sabrina Dubroca [3.10.0-87.el7] - devlink: Add e-switch support (Sabrina Dubroca) [1459772] - devlink: whitespace cleanup (Sabrina Dubroca) [1459772]