From 1c0986873ea8475e1866c6baaa455ab850801f5a Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 3 Dec 2014 09:27:43 -0800 Subject: [PATCH 1/7] update kernel headers to net-next (3.18-rc6) Early merge of upstream headers --- include/linux/if_bridge.h | 1 + include/linux/if_link.h | 18 ++++++++++++++++++ include/linux/if_tunnel.h | 1 + include/linux/neighbour.h | 6 +++--- include/linux/rtnetlink.h | 1 - 5 files changed, 23 insertions(+), 4 deletions(-) diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h index ed6868ec..6b4eb66d 100644 --- a/include/linux/if_bridge.h +++ b/include/linux/if_bridge.h @@ -105,6 +105,7 @@ struct __fdb_entry { #define BRIDGE_MODE_VEB 0 /* Default loopback mode */ #define BRIDGE_MODE_VEPA 1 /* 802.1Qbg defined VEPA mode */ +#define BRIDGE_MODE_SWDEV 2 /* Full switch device offload */ /* Bridge management nested attributes * [IFLA_AF_SPEC] = { diff --git a/include/linux/if_link.h b/include/linux/if_link.h index 47320636..167ec34b 100644 --- a/include/linux/if_link.h +++ b/include/linux/if_link.h @@ -145,6 +145,7 @@ enum { IFLA_CARRIER, IFLA_PHYS_PORT_ID, IFLA_CARRIER_CHANGES, + IFLA_PHYS_SWITCH_ID, __IFLA_MAX }; @@ -241,6 +242,8 @@ enum { 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_MAX }; #define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1) @@ -327,6 +330,21 @@ enum macvlan_macaddr_mode { #define MACVLAN_FLAG_NOPROMISC 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_MAX +}; + /* VXLAN section */ enum { IFLA_VXLAN_UNSPEC, diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h index 8b04f328..102ce7aa 100644 --- a/include/linux/if_tunnel.h +++ b/include/linux/if_tunnel.h @@ -69,6 +69,7 @@ enum tunnel_encap_types { #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 diff --git a/include/linux/neighbour.h b/include/linux/neighbour.h index 4a1d7e96..f3d77f9f 100644 --- a/include/linux/neighbour.h +++ b/include/linux/neighbour.h @@ -35,11 +35,11 @@ enum { */ #define NTF_USE 0x01 -#define NTF_PROXY 0x08 /* == ATF_PUBL */ -#define NTF_ROUTER 0x80 - #define NTF_SELF 0x02 #define NTF_MASTER 0x04 +#define NTF_PROXY 0x08 /* == ATF_PUBL */ +#define NTF_EXT_LEARNED 0x10 +#define NTF_ROUTER 0x80 /* * Neighbor Cache Entry States. diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h index ae23d94f..9aa5c2f9 100644 --- a/include/linux/rtnetlink.h +++ b/include/linux/rtnetlink.h @@ -237,7 +237,6 @@ enum { #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. From 8b1c0216d8dc559d0add4fc683735f280c77f678 Mon Sep 17 00:00:00 2001 From: Jiri Pirko Date: Fri, 21 Nov 2014 12:31:30 +0100 Subject: [PATCH 2/7] tc: add support for vlan tc action Signed-off-by: Jamal Hadi Salim Signed-off-by: Jiri Pirko Reviewed-by: Cong Wang --- include/linux/tc_act/tc_vlan.h | 35 ++++++ tc/Makefile | 1 + tc/m_vlan.c | 221 +++++++++++++++++++++++++++++++++ 3 files changed, 257 insertions(+) create mode 100644 include/linux/tc_act/tc_vlan.h create mode 100644 tc/m_vlan.c diff --git a/include/linux/tc_act/tc_vlan.h b/include/linux/tc_act/tc_vlan.h new file mode 100644 index 00000000..f7b8d448 --- /dev/null +++ b/include/linux/tc_act/tc_vlan.h @@ -0,0 +1,35 @@ +/* + * 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 + +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_MAX, +}; +#define TCA_VLAN_MAX (__TCA_VLAN_MAX - 1) + +#endif diff --git a/tc/Makefile b/tc/Makefile index 1ab36c67..830c97db 100644 --- a/tc/Makefile +++ b/tc/Makefile @@ -40,6 +40,7 @@ TCMODULES += m_pedit.o TCMODULES += m_skbedit.o TCMODULES += m_csum.o TCMODULES += m_simple.o +TCMODULES += m_vlan.o TCMODULES += p_ip.o TCMODULES += p_icmp.o TCMODULES += p_tcp.o diff --git a/tc/m_vlan.c b/tc/m_vlan.c new file mode 100644 index 00000000..171d2683 --- /dev/null +++ b/tc/m_vlan.c @@ -0,0 +1,221 @@ +/* + * m_vlan.c vlan manipulation module + * + * 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. + * + * Authors: Jiri Pirko + */ + +#include +#include +#include +#include +#include +#include "utils.h" +#include "rt_names.h" +#include "tc_util.h" +#include + +static void explain(void) +{ + fprintf(stderr, "Usage: vlan pop\n"); + fprintf(stderr, " vlan push [ protocol VLANPROTO ] id VLANID\n"); + fprintf(stderr, " VLANPROTO is one of 802.1Q or 802.1AD\n"); + fprintf(stderr, " with default: 802.1Q\n"); +} + +static void usage(void) +{ + explain(); + exit(-1); +} + +static int parse_vlan(struct action_util *a, int *argc_p, char ***argv_p, + int tca_id, struct nlmsghdr *n) +{ + int argc = *argc_p; + char **argv = *argv_p; + struct rtattr *tail; + int action = 0; + __u16 id; + int id_set = 0; + __u16 proto; + int proto_set = 0; + struct tc_vlan parm = { 0 }; + + if (matches(*argv, "vlan") != 0) + return -1; + + NEXT_ARG(); + + while (argc > 0) { + if (matches(*argv, "pop") == 0) { + if (action) { + fprintf(stderr, "unexpected \"%s\" - action already specified\n", + *argv); + explain(); + return -1; + } + action = TCA_VLAN_ACT_POP; + } else if (matches(*argv, "push") == 0) { + if (action) { + fprintf(stderr, "unexpected \"%s\" - action already specified\n", + *argv); + explain(); + return -1; + } + action = TCA_VLAN_ACT_PUSH; + } else if (matches(*argv, "id") == 0) { + if (action != TCA_VLAN_ACT_PUSH) { + fprintf(stderr, "\"%s\" is only valid for push\n", + *argv); + explain(); + return -1; + } + NEXT_ARG(); + if (get_u16(&id, *argv, 0)) + invarg("id is invalid", *argv); + id_set = 1; + } else if (matches(*argv, "protocol") == 0) { + if (action != TCA_VLAN_ACT_PUSH) { + fprintf(stderr, "\"%s\" is only valid for push\n", + *argv); + explain(); + return -1; + } + NEXT_ARG(); + if (ll_proto_a2n(&proto, *argv)) + invarg("protocol is invalid", *argv); + proto_set = 1; + } else if (matches(*argv, "help") == 0) { + usage(); + } else { + break; + } + argc--; + argv++; + } + + parm.action = TC_ACT_PIPE; + if (argc) { + if (matches(*argv, "reclassify") == 0) { + parm.action = TC_ACT_RECLASSIFY; + NEXT_ARG(); + } else if (matches(*argv, "pipe") == 0) { + parm.action = TC_ACT_PIPE; + NEXT_ARG(); + } else if (matches(*argv, "drop") == 0 || + matches(*argv, "shot") == 0) { + parm.action = TC_ACT_SHOT; + NEXT_ARG(); + } else if (matches(*argv, "continue") == 0) { + parm.action = TC_ACT_UNSPEC; + NEXT_ARG(); + } else if (matches(*argv, "pass") == 0) { + parm.action = TC_ACT_OK; + NEXT_ARG(); + } + } + + if (argc) { + if (matches(*argv, "index") == 0) { + NEXT_ARG(); + if (get_u32(&parm.index, *argv, 10)) { + fprintf(stderr, "vlan: Illegal \"index\"\n"); + return -1; + } + argc--; + argv++; + } + } + + if (action == TCA_VLAN_ACT_PUSH && !id_set) { + fprintf(stderr, "id needs to be set for push\n"); + explain(); + return -1; + } + + parm.v_action = action; + tail = NLMSG_TAIL(n); + addattr_l(n, MAX_MSG, tca_id, NULL, 0); + addattr_l(n, MAX_MSG, TCA_VLAN_PARMS, &parm, sizeof(parm)); + if (id_set) + addattr_l(n, MAX_MSG, TCA_VLAN_PUSH_VLAN_ID, &id, 2); + if (proto_set) { + if (proto != htons(ETH_P_8021Q) && + proto != htons(ETH_P_8021AD)) { + fprintf(stderr, "protocol not supported\n"); + explain(); + return -1; + } + + addattr_l(n, MAX_MSG, TCA_VLAN_PUSH_VLAN_PROTOCOL, &proto, 2); + } + tail->rta_len = (char *)NLMSG_TAIL(n) - (char *)tail; + + *argc_p = argc; + *argv_p = argv; + return 0; +} + +static int print_vlan(struct action_util *au, FILE *f, struct rtattr *arg) +{ + SPRINT_BUF(b1); + struct rtattr *tb[TCA_VLAN_MAX + 1]; + __u16 val; + struct tc_vlan *parm; + + if (arg == NULL) + return -1; + + parse_rtattr_nested(tb, TCA_VLAN_MAX, arg); + + if (!tb[TCA_VLAN_PARMS]) { + fprintf(f, "[NULL vlan parameters]"); + return -1; + } + parm = RTA_DATA(tb[TCA_VLAN_PARMS]); + + fprintf(f, " vlan"); + + switch(parm->v_action) { + case TCA_VLAN_ACT_POP: + fprintf(f, " pop"); + break; + case TCA_VLAN_ACT_PUSH: + fprintf(f, " push"); + if (tb[TCA_VLAN_PUSH_VLAN_ID]) { + val = rta_getattr_u16(tb[TCA_VLAN_PUSH_VLAN_ID]); + fprintf(f, " id %u", val); + } + if (tb[TCA_VLAN_PUSH_VLAN_PROTOCOL]) { + fprintf(f, " protocol %s", + ll_proto_n2a(rta_getattr_u16(tb[TCA_VLAN_PUSH_VLAN_PROTOCOL]), + b1, sizeof(b1))); + } + break; + } + + fprintf(f, "\n\t index %d ref %d bind %d", parm->index, parm->refcnt, + parm->bindcnt); + + if (show_stats) { + if (tb[TCA_VLAN_TM]) { + struct tcf_t *tm = RTA_DATA(tb[TCA_VLAN_TM]); + print_tm(f, tm); + } + } + + fprintf(f, "\n "); + + return 0; +} + +struct action_util vlan_action_util = { + .id = "vlan", + .parse_aopt = parse_vlan, + .print_aopt = print_vlan, +}; From 81eaf677f91b53873871f66b8b549f99fb4b9cf5 Mon Sep 17 00:00:00 2001 From: Mahesh Bandewar Date: Sun, 23 Nov 2014 18:06:11 -0800 Subject: [PATCH 3/7] ip link: Add ipvlan support to the iproute2/ip util MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adding basic support to create virtual devices using 'ip' utility. Following is the syntax - ip link add link type ipvlan mode [ l2 | l3 ] e.g. ip link add link eth0 ipvl0 type ipvlan mode l3 Signed-off-by: Mahesh Bandewar Cc: Stephen Hemminger Cc: Eric Dumazet Cc: Maciej Żenczykowski Cc: Laurent Chavey Cc: Tim Hockin Cc: Brandon Philips Cc: Pavel Emelianov --- ip/Makefile | 2 +- ip/iplink.c | 2 +- ip/iplink_ipvlan.c | 98 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 100 insertions(+), 2 deletions(-) create mode 100644 ip/iplink_ipvlan.c diff --git a/ip/Makefile b/ip/Makefile index 1f50848a..2c742f30 100644 --- a/ip/Makefile +++ b/ip/Makefile @@ -6,7 +6,7 @@ IPOBJ=ip.o ipaddress.o ipaddrlabel.o iproute.o iprule.o ipnetns.o \ iplink_macvlan.o iplink_macvtap.o ipl2tp.o link_vti.o link_vti6.o \ iplink_vxlan.o tcp_metrics.o iplink_ipoib.o ipnetconf.o link_ip6tnl.o \ link_iptnl.o link_gre6.o iplink_bond.o iplink_bond_slave.o iplink_hsr.o \ - iplink_bridge.o iplink_bridge_slave.o ipfou.o + iplink_bridge.o iplink_bridge_slave.o ipfou.o iplink_ipvlan.o RTMONOBJ=rtmon.o diff --git a/ip/iplink.c b/ip/iplink.c index ce6eb3e1..1a967d1e 100644 --- a/ip/iplink.c +++ b/ip/iplink.c @@ -90,7 +90,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 }\n"); + fprintf(stderr, " bond_slave | ipvlan }\n"); } exit(-1); } diff --git a/ip/iplink_ipvlan.c b/ip/iplink_ipvlan.c new file mode 100644 index 00000000..e08fc397 --- /dev/null +++ b/ip/iplink_ipvlan.c @@ -0,0 +1,98 @@ +/* iplink_ipvlan.c IPVLAN device support + * + * 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. + * + * Authors: Mahesh Bandewar + */ + +#include +#include +#include +#include +#include + +#include "rt_names.h" +#include "utils.h" +#include "ip_common.h" + +static void ipvlan_explain(FILE *f) +{ + fprintf(f, "Usage: ... ipvlan [ mode { l2 | l3 } ]\n"); +} + +static void explain(void) +{ + ipvlan_explain(stderr); +} + +static int mode_arg(void) +{ + fprintf(stderr, "Error: argument of \"mode\" must be either \"l2\", " + "or \"l3\"\n"); + return -1; +} + +static int ipvlan_parse_opt(struct link_util *lu, int argc, char **argv, + struct nlmsghdr *n) +{ + while (argc > 0) { + if (matches(*argv, "mode") == 0) { + __u16 mode = 0; + NEXT_ARG(); + + if (strcmp(*argv, "l2") == 0) + mode = IPVLAN_MODE_L2; + else if (strcmp(*argv, "l3") == 0) + mode = IPVLAN_MODE_L3; + else + return mode_arg(); + + addattr16(n, 1024, IFLA_IPVLAN_MODE, mode); + } else if (matches(*argv, "help") == 0) { + explain(); + return -1; + } else { + fprintf(stderr, "ipvlan: unknown option \"%s\"?\n", + *argv); + explain(); + return -1; + } + argc--, argv++; + } + + return 0; +} + +static void ipvlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) +{ + + if (!tb) + return; + + if (tb[IFLA_IPVLAN_MODE]) { + if (RTA_PAYLOAD(tb[IFLA_IPVLAN_MODE]) == sizeof(__u16)) { + __u16 mode = rta_getattr_u16(tb[IFLA_IPVLAN_MODE]); + + fprintf(f, " mode %s ", + mode == IPVLAN_MODE_L2 ? "l2" : + mode == IPVLAN_MODE_L3 ? "l3" : "unknown"); + } + } +} + +static void ipvlan_print_help(struct link_util *lu, int argc, char **argv, + FILE *f) +{ + ipvlan_explain(f); +} + +struct link_util ipvlan_link_util = { + .id = "ipvlan", + .maxattr = IFLA_IPVLAN_MAX, + .parse_opt = ipvlan_parse_opt, + .print_opt = ipvlan_print_opt, + .print_help = ipvlan_print_help, +}; From 29d1f730b87572a4e8165859dc04b0c89533ea4e Mon Sep 17 00:00:00 2001 From: Florian Westphal Date: Thu, 6 Nov 2014 22:15:32 +0100 Subject: [PATCH 4/7] ip route: enable per-route ecn settings via 'features' option This permits to selectively enable explicit congestion notification via the routing table. If this ecn feature is not set, the kernel will use the tcp_ecn sysctl to decide wheter to use ECN when establising a TCP connection. At the time of this writing, the kernel supports ecn and allfrags, but allfrags is of dubious value and not implemented here. Example: ip route change 192.168.2.0/24 dev eth0 features ecn Signed-off-by: Florian Westphal --- ip/iproute.c | 32 ++++++++++++++++++++++++++++++++ man/man8/ip-route.8.in | 18 ++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/ip/iproute.c b/ip/iproute.c index 32847c69..5a496a91 100644 --- a/ip/iproute.c +++ b/ip/iproute.c @@ -80,6 +80,7 @@ static void usage(void) fprintf(stderr, " [ window NUMBER] [ cwnd NUMBER ] [ initcwnd NUMBER ]\n"); fprintf(stderr, " [ ssthresh NUMBER ] [ realms REALM ] [ src ADDRESS ]\n"); fprintf(stderr, " [ rto_min TIME ] [ hoplimit NUMBER ] [ initrwnd NUMBER ]\n"); + fprintf(stderr, " [ features FEATURES ]\n"); fprintf(stderr, " [ quickack BOOL ]\n"); fprintf(stderr, "TYPE := [ unicast | local | broadcast | multicast | throw |\n"); fprintf(stderr, " unreachable | prohibit | blackhole | nat ]\n"); @@ -89,6 +90,7 @@ static void usage(void) fprintf(stderr, "RTPROTO := [ kernel | boot | static | NUMBER ]\n"); fprintf(stderr, "TIME := NUMBER[s|ms]\n"); fprintf(stderr, "BOOL := [1|0]\n"); + fprintf(stderr, "FEATURES := ecn\n"); exit(-1); } @@ -280,6 +282,19 @@ static int calc_host_len(const struct rtmsg *r) return -1; } +static void print_rtax_features(FILE *fp, unsigned int features) +{ + unsigned int of = features; + + if (features & RTAX_FEATURE_ECN) { + fprintf(fp, " ecn"); + features &= ~RTAX_FEATURE_ECN; + } + + if (features) + fprintf(fp, " 0x%x", of); +} + int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) { FILE *fp = (FILE*)arg; @@ -535,6 +550,9 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) val = *(unsigned*)RTA_DATA(mxrta[i]); switch (i) { + case RTAX_FEATURES: + print_rtax_features(fp, val); + break; case RTAX_HOPLIMIT: if ((int)val == -1) val = 0; @@ -885,6 +903,20 @@ static int iproute_modify(int cmd, unsigned flags, int argc, char **argv) if (get_unsigned(&win, *argv, 0)) invarg("\"initrwnd\" value is invalid\n", *argv); rta_addattr32(mxrta, sizeof(mxbuf), RTAX_INITRWND, win); + } else if (matches(*argv, "features") == 0) { + unsigned int features = 0; + + while (argc > 0) { + NEXT_ARG(); + + if (strcmp(*argv, "ecn") == 0) + features |= RTAX_FEATURE_ECN; + else + invarg("\"features\" value not valid\n", *argv); + break; + } + + rta_addattr32(mxrta, sizeof(mxbuf), RTAX_FEATURES, features); } else if (matches(*argv, "quickack") == 0) { unsigned quickack; NEXT_ARG(); diff --git a/man/man8/ip-route.8.in b/man/man8/ip-route.8.in index 79bc7f10..89960c14 100644 --- a/man/man8/ip-route.8.in +++ b/man/man8/ip-route.8.in @@ -113,6 +113,8 @@ replace " } " .IR NUMBER " ] [ " .B initrwnd .IR NUMBER " ] [ " +.B features +.IR FEATURES " ] [ " .B quickack .IR BOOL " ]" @@ -140,6 +142,10 @@ throw " | " unreachable " | " prohibit " | " blackhole " | " nat " ]" .BR kernel " | " boot " | " static " |" .IR NUMBER " ]" +.ti -8 +.IR FEATURES " := [ " +.BR ecn " | ]" + .SH DESCRIPTION .B ip route @@ -410,6 +416,18 @@ the initial receive window size for connections to this destination. Actual window size is this value multiplied by the MSS of the connection. The default value is zero, meaning to use Slow Start value. +.TP +.BI features " FEATURES " (3.18+ only) +Enable or disable per-route features. Only available feature at this +time is +.B ecn +to enable explicit congestion notification when initiating connections to the +given destination network. +When responding to a connection request from the given network, ecn will +also be used even if the +.B net.ipv4.tcp_ecn +sysctl is set to 0. + .TP .BI quickack " BOOL " "(3.11+ only)" Enable or disable quick ack for connections to this destination. From 28467b7f3facd6114b2fbe0c9fecf57adbd52e12 Mon Sep 17 00:00:00 2001 From: Scott Feldman Date: Thu, 4 Dec 2014 09:57:15 +0100 Subject: [PATCH 5/7] 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 d678342c..c01a5020 100644 --- a/bridge/fdb.c +++ b/bridge/fdb.c @@ -154,6 +154,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; From 2ea49a3804bd969dfcfe0af24b78287660ab19e6 Mon Sep 17 00:00:00 2001 From: Nicolas Dichtel Date: Thu, 4 Dec 2014 17:41:07 +0100 Subject: [PATCH 6/7] ipaddress: enable -details option This option was used only for 'ip link', but it can be useful to have it for 'ip address'. Thus it is possible to display link details and addresses with one command. Example: $ ip -d a ls dev gre1 9: gre1@NONE: mtu 1468 qdisc noqueue state UNKNOWN group default link/gre 10.16.0.249 peer 10.16.0.121 promiscuity 0 gre remote 10.16.0.121 local 10.16.0.249 ttl inherit ikey 0.0.0.10 okey 0.0.0.10 icsum ocsum inet 192.168.0.249 peer 192.168.0.121/32 scope global gre1 valid_lft forever preferred_lft forever inet6 fe80::5efe:a10:f9/64 scope link valid_lft forever preferred_lft forever Suggested-by: Christophe Gouault Signed-off-by: Nicolas Dichtel --- ip/ipaddress.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ip/ipaddress.c b/ip/ipaddress.c index 4d993243..221ae1fc 100644 --- a/ip/ipaddress.c +++ b/ip/ipaddress.c @@ -604,7 +604,7 @@ int print_linkinfo(const struct sockaddr_nl *who, if (filter.showqueue) print_queuelen(fp, tb); - if (!filter.family || filter.family == AF_PACKET) { + if (!filter.family || filter.family == AF_PACKET || show_details) { SPRINT_BUF(b1); fprintf(fp, "%s", _SL_); fprintf(fp, " link/%s ", ll_type_n2a(ifi->ifi_type, b1, sizeof(b1))); @@ -627,14 +627,14 @@ int print_linkinfo(const struct sockaddr_nl *who, } } - if (do_link && tb[IFLA_PROMISCUITY] && show_details) + if (tb[IFLA_PROMISCUITY] && show_details) fprintf(fp, " promiscuity %u ", *(int*)RTA_DATA(tb[IFLA_PROMISCUITY])); - if (do_link && tb[IFLA_LINKINFO] && show_details) + if (tb[IFLA_LINKINFO] && show_details) print_linktype(fp, tb[IFLA_LINKINFO]); - if (do_link && tb[IFLA_IFALIAS]) { + if ((do_link || show_details) && tb[IFLA_IFALIAS]) { fprintf(fp, "%s alias %s", _SL_, rta_getattr_str(tb[IFLA_IFALIAS])); } @@ -644,7 +644,7 @@ int print_linkinfo(const struct sockaddr_nl *who, __print_link_stats(fp, tb); } - if (do_link && tb[IFLA_VFINFO_LIST] && tb[IFLA_NUM_VF]) { + if ((do_link || show_details) && tb[IFLA_VFINFO_LIST] && tb[IFLA_NUM_VF]) { struct rtattr *i, *vflist = tb[IFLA_VFINFO_LIST]; int rem = RTA_PAYLOAD(vflist); for (i = RTA_DATA(vflist); RTA_OK(i, rem); i = RTA_NEXT(i, rem)) From 093f18fd7a880c1cd76d8ce78ca6cacd9bc7d054 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Sat, 20 Dec 2014 12:22:01 -0800 Subject: [PATCH 7/7] update kernel headers to 3.19-rc1 --- include/linux/if_bridge.h | 2 +- include/linux/if_tun.h | 18 +++++------------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h index 6b4eb66d..19ff22af 100644 --- a/include/linux/if_bridge.h +++ b/include/linux/if_bridge.h @@ -105,7 +105,7 @@ struct __fdb_entry { #define BRIDGE_MODE_VEB 0 /* Default loopback mode */ #define BRIDGE_MODE_VEPA 1 /* 802.1Qbg defined VEPA mode */ -#define BRIDGE_MODE_SWDEV 2 /* Full switch device offload */ +#define BRIDGE_MODE_UNDEF 0xFFFF /* mode undefined */ /* Bridge management nested attributes * [IFLA_AF_SPEC] = { diff --git a/include/linux/if_tun.h b/include/linux/if_tun.h index 75cc8ace..ffee5839 100644 --- a/include/linux/if_tun.h +++ b/include/linux/if_tun.h @@ -22,21 +22,11 @@ /* Read queue size */ #define TUN_READQ_SIZE 500 - -/* TUN device flags */ -#define TUN_TUN_DEV 0x0001 -#define TUN_TAP_DEV 0x0002 +/* 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 -#define TUN_FASYNC 0x0010 -#define TUN_NOCHECKSUM 0x0020 -#define TUN_NO_PI 0x0040 -/* This flag has no real effect */ -#define TUN_ONE_QUEUE 0x0080 -#define TUN_PERSIST 0x0100 -#define TUN_VNET_HDR 0x0200 -#define TUN_TAP_MQ 0x0400 - /* Ioctl defines */ #define TUNSETNOCSUM _IOW('T', 200, int) #define TUNSETDEBUG _IOW('T', 201, int) @@ -58,6 +48,8 @@ #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) /* TUNSETIFF ifr flags */ #define IFF_TUN 0x0001