From 5464049b4781eae2f664009a217fbcfd6a7b13c1 Mon Sep 17 00:00:00 2001 From: Thomas Richter Date: Tue, 30 Jul 2013 08:16:41 +0200 Subject: [PATCH 01/16] iproute vxlan add support for fdb replace command Add support for the bridge fdb replace command to replace an existing entry in the vxlan device driver forwarding data base. The entry is identified with its unicast mac address and its corresponding remote destination information is updated. This is useful for virtual machine migration and replaces the bridge fdb del and bridge fdb add commands. It follows the same interface as ip neigh replace commands. Signed-off-by: Thomas Richter --- bridge/fdb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bridge/fdb.c b/bridge/fdb.c index 591fbbed..e2e53f1f 100644 --- a/bridge/fdb.c +++ b/bridge/fdb.c @@ -30,7 +30,7 @@ int filter_index; static void usage(void) { - fprintf(stderr, "Usage: bridge fdb { add | append | del } ADDR dev DEV {self|master} [ temp ]\n" + fprintf(stderr, "Usage: bridge fdb { add | append | del | replace } ADDR dev DEV {self|master} [ temp ]\n" " [router] [ dst IPADDR] [ vlan VID ]\n" " [ port PORT] [ vni VNI ] [via DEV]\n"); fprintf(stderr, " bridge fdb {show} [ dev DEV ]\n"); @@ -334,6 +334,8 @@ int do_fdb(int argc, char **argv) return fdb_modify(RTM_NEWNEIGH, NLM_F_CREATE|NLM_F_EXCL, argc-1, argv+1); if (matches(*argv, "append") == 0) return fdb_modify(RTM_NEWNEIGH, NLM_F_CREATE|NLM_F_APPEND, argc-1, argv+1); + if (matches(*argv, "replace") == 0) + return fdb_modify(RTM_NEWNEIGH, NLM_F_CREATE|NLM_F_REPLACE, argc-1, argv+1); if (matches(*argv, "delete") == 0) return fdb_modify(RTM_DELNEIGH, 0, argc-1, argv+1); if (matches(*argv, "show") == 0 || From ac3ff7203206aae04831901c9dd831e32209fc94 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Sun, 4 Aug 2013 15:00:42 -0700 Subject: [PATCH 02/16] cleanup help message Split it naturally --- ip/link_veth.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ip/link_veth.c b/ip/link_veth.c index 3d19b01f..7730f394 100644 --- a/ip/link_veth.c +++ b/ip/link_veth.c @@ -19,9 +19,8 @@ static void usage(void) { - printf("Usage: ip link type veth " - "[peer ]\nTo get type " - "'ip link add help'\n"); + printf("Usage: ip link type veth [peer ]\n" + "To get type 'ip link add help'\n"); } static int veth_parse_opt(struct link_util *lu, int argc, char **argv, From d259f0302f02206d7eb448da2673487fe1e0f8f6 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Sun, 4 Aug 2013 15:00:56 -0700 Subject: [PATCH 03/16] Fix spelling errors Minor errors found by codespell --- ip/ipnetns.c | 6 +++--- ip/ipntable.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ip/ipnetns.c b/ip/ipnetns.c index 794a4988..c8a47920 100644 --- a/ip/ipnetns.c +++ b/ip/ipnetns.c @@ -167,7 +167,7 @@ static int netns_exec(int argc, char **argv) fprintf(stderr, "unshare failed: %s\n", strerror(errno)); return -1; } - /* Don't let any mounts propogate back to the parent */ + /* Don't let any mounts propagate back to the parent */ if (mount("", "/", "none", MS_SLAVE | MS_REC, NULL)) { fprintf(stderr, "\"mount --make-rslave /\" failed: %s\n", strerror(errno)); @@ -205,7 +205,7 @@ static int netns_exec(int argc, char **argv) exit(1); } - /* If child failed, propogate status */ + /* If child failed, propagate status */ if (WIFEXITED(status)) exit(WEXITSTATUS(status)); @@ -405,7 +405,7 @@ static int netns_add(int argc, char **argv) /* Create the base netns directory if it doesn't exist */ mkdir(NETNS_RUN_DIR, S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH); - /* Make it possible for network namespace mounts to propogate between + /* Make it possible for network namespace mounts to propagate between * mount namespaces. This makes it likely that a unmounting a network * namespace file in one namespace will unmount the network namespace * file in all namespaces allowing the network namespace to be freed diff --git a/ip/ipntable.c b/ip/ipntable.c index 67b199e4..193e50cf 100644 --- a/ip/ipntable.c +++ b/ip/ipntable.c @@ -305,7 +305,7 @@ static int ipntable_modify(int cmd, int flags, int argc, char **argv) if (!namep) missarg("NAME"); if (!threshsp && !gc_intp && !parms_change) { - fprintf(stderr, "Not enough information: changable attributes required.\n"); + fprintf(stderr, "Not enough information: changeable attributes required.\n"); exit(-1); } From b8a45897b9029ac38ee829b3a7eb8551fddebd51 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Sun, 4 Aug 2013 15:10:05 -0700 Subject: [PATCH 04/16] More minor spelling fixes --- tc/m_ipt.c | 2 +- tc/m_mirred.c | 8 ++++---- tc/m_xt.c | 2 +- tc/m_xt_old.c | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tc/m_ipt.c b/tc/m_ipt.c index dc2dedc0..bb016f17 100644 --- a/tc/m_ipt.c +++ b/tc/m_ipt.c @@ -415,7 +415,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, rargc); return -1; } diff --git a/tc/m_mirred.c b/tc/m_mirred.c index 1ef9f2bd..dc231d7c 100644 --- a/tc/m_mirred.c +++ b/tc/m_mirred.c @@ -105,7 +105,7 @@ parse_egress(struct action_util *a, int *argc_p, char ***argv_p, } else if (!mirror && matches(*argv, "mirror") == 0) { mirror=1; if (redir) { - fprintf(stderr, "Cant have both mirror and redir\n"); + fprintf(stderr, "Can't have both mirror and redir\n"); return -1; } p.eaction = TCA_EGRESS_MIRROR; @@ -114,7 +114,7 @@ parse_egress(struct action_util *a, int *argc_p, char ***argv_p, } else if (!redir && matches(*argv, "redirect") == 0) { redir=1; if (mirror) { - fprintf(stderr, "Cant have both mirror and redir\n"); + fprintf(stderr, "Can't have both mirror and redir\n"); return -1; } p.eaction = TCA_EGRESS_REDIR; @@ -215,14 +215,14 @@ parse_mirred(struct action_util *a, int *argc_p, char ***argv_p, char **argv = *argv_p; if (argc < 0) { - fprintf(stderr,"mirred bad arguement count %d\n", argc); + fprintf(stderr,"mirred bad argument count %d\n", argc); return -1; } if (matches(*argv, "mirred") == 0) { NEXT_ARG(); } else { - fprintf(stderr,"mirred bad arguement %s\n", *argv); + fprintf(stderr,"mirred bad argument %s\n", *argv); return -1; } diff --git a/tc/m_xt.c b/tc/m_xt.c index e9186709..27029c1b 100644 --- a/tc/m_xt.c +++ b/tc/m_xt.c @@ -147,7 +147,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, rargc); return -1; } diff --git a/tc/m_xt_old.c b/tc/m_xt_old.c index 554e4ed4..4d61a5ab 100644 --- a/tc/m_xt_old.c +++ b/tc/m_xt_old.c @@ -232,7 +232,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, rargc); return -1; } From 488c41d21678744ea56332333853ca4ab0827ac9 Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Mon, 19 Aug 2013 15:43:30 +1000 Subject: [PATCH 05/16] ip: Add label option to ip monitor Prefix labelling is currently only activated when monitoring "all" objects. However, the output can still be confusing when monitoring more than 1 object, so add an option to always print prefix labels. Signed-off-by: Martin Schwenke --- doc/ip-cref.tex | 14 ++++++++------ ip/ipmonitor.c | 4 +++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/doc/ip-cref.tex b/doc/ip-cref.tex index d8fed66e..f062b3af 100644 --- a/doc/ip-cref.tex +++ b/doc/ip-cref.tex @@ -2542,13 +2542,15 @@ Namely, the \verb|monitor| command is the first in the command line and then the object list follows: \begin{verbatim} - ip monitor [ file FILE ] [ all | OBJECT-LIST ] + ip monitor [ file FILE ] [ all | OBJECT-LIST ] [ label ] \end{verbatim} -\verb|OBJECT-LIST| is the list of object types that we want to monitor. -It may contain \verb|link|, \verb|address| and \verb|route|. -If no \verb|file| argument is given, \verb|ip| opens RTNETLINK, -listens on it and dumps state changes in the format described -in previous sections. +\verb|OBJECT-LIST| is the list of object types that we want to +monitor. It may contain \verb|link|, \verb|address| and \verb|route|. +Specifying \verb|label| indicates that output lines should be labelled +with the type of object being printed --- this happens by default if +\verb|all| is specified. If no \verb|file| argument is given, +\verb|ip| opens RTNETLINK, listens on it and dumps state changes in +the format described in previous sections. If a file name is given, it does not listen on RTNETLINK, but opens the file containing RTNETLINK messages saved in binary format diff --git a/ip/ipmonitor.c b/ip/ipmonitor.c index 86c473e9..48953904 100644 --- a/ip/ipmonitor.c +++ b/ip/ipmonitor.c @@ -29,7 +29,7 @@ int prefix_banner; static void usage(void) { - fprintf(stderr, "Usage: ip monitor [ all | LISTofOBJECTS ] [ FILE ]\n"); + fprintf(stderr, "Usage: ip monitor [ all | LISTofOBJECTS ] [ FILE ] [ label ]\n"); fprintf(stderr, "LISTofOBJECTS := link | address | route | mroute | prefix |\n"); fprintf(stderr, " neigh | netconf\n"); fprintf(stderr, "FILE := file FILENAME\n"); @@ -157,6 +157,8 @@ int do_ipmonitor(int argc, char **argv) if (matches(*argv, "file") == 0) { NEXT_ARG(); file = *argv; + } else if (matches(*argv, "label") == 0) { + prefix_banner = 1; } else if (matches(*argv, "link") == 0) { llink=1; groups = 0; From e9e78b0db0e023035e346ba67de838be851eb665 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 26 Aug 2013 08:41:19 -0700 Subject: [PATCH 06/16] tc: allow qdisc without options Pfifo_fast needs no options. So don't force it to have parsing code. --- tc/tc_qdisc.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tc/tc_qdisc.c b/tc/tc_qdisc.c index f3bf5b57..3002a56c 100644 --- a/tc/tc_qdisc.c +++ b/tc/tc_qdisc.c @@ -137,15 +137,15 @@ static int tc_qdisc_modify(int cmd, unsigned flags, int argc, char **argv) if (est.ewma_log) addattr_l(&req.n, sizeof(req), TCA_RATE, &est, sizeof(est)); - if (q) { - if (!q->parse_qopt) { - fprintf(stderr, "qdisc '%s' does not support option parsing\n", k); - return -1; - } - if (q->parse_qopt(q, argc, argv, &req.n)) - return 1; - } else { - if (argc) { + if (argc) { + if (q) { + if (!q->parse_qopt) { + fprintf(stderr, "qdisc '%s' does not support option parsing\n", k); + return -1; + } + if (q->parse_qopt(q, argc, argv, &req.n)) + return 1; + } else { if (matches(*argv, "help") == 0) usage(); From 001856532f4983ae886052e88dc5c1d5a084bcd6 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 29 Aug 2013 12:18:52 -0700 Subject: [PATCH 07/16] add ability to filter neighbour discovery by protocol Useful to be able to monitor arp and IPv6 nd seperately. Default is both. --- ip/ipmonitor.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ip/ipmonitor.c b/ip/ipmonitor.c index 48953904..70f2a7ad 100644 --- a/ip/ipmonitor.c +++ b/ip/ipmonitor.c @@ -36,7 +36,6 @@ static void usage(void) exit(-1); } - static int accept_msg(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) { @@ -88,6 +87,13 @@ static int accept_msg(const struct sockaddr_nl *who, } if (n->nlmsg_type == RTM_NEWNEIGH || n->nlmsg_type == RTM_DELNEIGH || n->nlmsg_type == RTM_GETNEIGH) { + if (preferred_family) { + struct ndmsg *r = NLMSG_DATA(n); + + if (r->ndm_family != preferred_family) + return 0; + } + if (prefix_banner) fprintf(fp, "[NEIGH]"); print_neigh(who, n, arg); From 8f48063721881c9304f214754162e4712a2d6c88 Mon Sep 17 00:00:00 2001 From: Richard Godbee Date: Sun, 25 Aug 2013 22:19:11 -0400 Subject: [PATCH 08/16] iproute2: iproute.c: fix usage() spacing problems Fix two spacing problems around square brackets in usage text. Signed-off-by: Richard Godbee --- ip/iproute.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ip/iproute.c b/ip/iproute.c index b069f1e0..25a56d1f 100644 --- a/ip/iproute.c +++ b/ip/iproute.c @@ -63,7 +63,7 @@ static void usage(void) fprintf(stderr, " ip route restore\n"); fprintf(stderr, " ip route showdump\n"); fprintf(stderr, " ip route get ADDRESS [ from ADDRESS iif STRING ]\n"); - fprintf(stderr, " [ oif STRING ] [ tos TOS ]\n"); + fprintf(stderr, " [ oif STRING ] [ tos TOS ]\n"); fprintf(stderr, " [ mark NUMBER ]\n"); fprintf(stderr, " ip route { add | del | change | append | replace } ROUTE\n"); fprintf(stderr, "SELECTOR := [ root PREFIX ] [ match PREFIX ] [ exact PREFIX ]\n"); @@ -76,7 +76,7 @@ static void usage(void) fprintf(stderr, "INFO_SPEC := NH OPTIONS FLAGS [ nexthop NH ]...\n"); fprintf(stderr, "NH := [ via ADDRESS ] [ dev STRING ] [ weight NUMBER ] NHFLAGS\n"); fprintf(stderr, "OPTIONS := FLAGS [ mtu NUMBER ] [ advmss NUMBER ]\n"); - fprintf(stderr, " [ rtt TIME ] [ rttvar TIME ] [reordering NUMBER ]\n"); + fprintf(stderr, " [ rtt TIME ] [ rttvar TIME ] [ reordering NUMBER ]\n"); 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"); From 30d07e9e36a4fd1044ed10b36e91dc6a124c6c3c Mon Sep 17 00:00:00 2001 From: Richard Godbee Date: Sun, 25 Aug 2013 22:40:18 -0400 Subject: [PATCH 09/16] iproute2: spelling: noptmudisc -> nopmtudisc Signed-off-by: Richard Godbee --- ip/iptunnel.c | 2 +- ip/link_iptnl.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ip/iptunnel.c b/ip/iptunnel.c index 43f85855..40186d3d 100644 --- a/ip/iptunnel.c +++ b/ip/iptunnel.c @@ -280,7 +280,7 @@ static int do_add(int cmd, int argc, char **argv) return -1; if (p.iph.ttl && p.iph.frag_off == 0) { - fprintf(stderr, "ttl != 0 and noptmudisc are incompatible\n"); + fprintf(stderr, "ttl != 0 and nopmtudisc are incompatible\n"); return -1; } diff --git a/ip/link_iptnl.c b/ip/link_iptnl.c index 394254d8..d5324f8e 100644 --- a/ip/link_iptnl.c +++ b/ip/link_iptnl.c @@ -233,7 +233,7 @@ get_failed: } if (ttl && pmtudisc == 0) { - fprintf(stderr, "ttl != 0 and noptmudisc are incompatible\n"); + fprintf(stderr, "ttl != 0 and nopmtudisc are incompatible\n"); exit(-1); } From 4b8000f37ad5efe65c5dec0a1ea37192a9e05ae2 Mon Sep 17 00:00:00 2001 From: Richard Godbee Date: Sun, 25 Aug 2013 22:40:19 -0400 Subject: [PATCH 10/16] iproute2: ip-route.8.in: minor fixes In SYNOPSIS section: - Add 'reordering' - Add missing '[' before 'quickack' Signed-off-by: Richard Godbee --- man/man8/ip-route.8.in | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/man/man8/ip-route.8.in b/man/man8/ip-route.8.in index 7191bce4..79bc7f10 100644 --- a/man/man8/ip-route.8.in +++ b/man/man8/ip-route.8.in @@ -97,6 +97,8 @@ replace " } " .IR TIME " ] [ " .B rttvar .IR TIME " ] [ " +.B reordering +.IR NUMBER " ] [ " .B window .IR NUMBER " ] [ " .B cwnd @@ -110,7 +112,7 @@ replace " } " .B initcwnd .IR NUMBER " ] [ " .B initrwnd -.IR NUMBER " ]" +.IR NUMBER " ] [ " .B quickack .IR BOOL " ]" From 7dc0481aa15c96f78079144c52c530c4b8a17f9e Mon Sep 17 00:00:00 2001 From: Lutz Jaenicke Date: Thu, 29 Aug 2013 09:50:28 +0200 Subject: [PATCH 11/16] macvlan: fix typo in macvlan_print_opt() The mode information is contained in IFLA_MACVLAN_MODE instead of IFLA_VLAN_ID (both evaluating to "1" in their enums). Signed-off-by: Lutz Jaenicke --- ip/iplink_macvlan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ip/iplink_macvlan.c b/ip/iplink_macvlan.c index 5b4b868b..ec511065 100644 --- a/ip/iplink_macvlan.c +++ b/ip/iplink_macvlan.c @@ -79,7 +79,7 @@ static void macvlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[] RTA_PAYLOAD(tb[IFLA_MACVLAN_MODE]) < sizeof(__u32)) return; - mode = rta_getattr_u32(tb[IFLA_VLAN_ID]); + mode = rta_getattr_u32(tb[IFLA_MACVLAN_MODE]); fprintf(f, " mode %s ", mode == MACVLAN_MODE_PRIVATE ? "private" : mode == MACVLAN_MODE_VEPA ? "vepa" From 1ed509bb522225050edfa1ed7ddc7255e9a18bd5 Mon Sep 17 00:00:00 2001 From: Thomas Egerer Date: Thu, 29 Aug 2013 14:00:36 +0200 Subject: [PATCH 12/16] ip/xfrm: Fix potential SIGSEGV when printing extra flags The git-commit dc8867d0, that added support for displaying the extra-flags of a state, introduced a potential segfault. Trying to show a state without the extra-flag attribute and show_stats enabled, would cause the NULL pointer in tb[XFRMA_SA_EXTRA_FLAGS] to be dereferenced. Signed-off-by: Thomas Egerer --- ip/ipxfrm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ip/ipxfrm.c b/ip/ipxfrm.c index 0a3a9fb6..411d9d53 100644 --- a/ip/ipxfrm.c +++ b/ip/ipxfrm.c @@ -856,7 +856,7 @@ void xfrm_state_info_print(struct xfrm_usersa_info *xsinfo, if (flags) fprintf(fp, "%x", flags); } - if (show_stats > 0 || tb[XFRMA_SA_EXTRA_FLAGS]) { + if (show_stats > 0 && tb[XFRMA_SA_EXTRA_FLAGS]) { __u32 extra_flags = *(__u32 *)RTA_DATA(tb[XFRMA_SA_EXTRA_FLAGS]); fprintf(fp, "extra_flag "); From efa4dde4c7fe7e0fd4a7172b1222816f419e8cd8 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 3 Sep 2013 08:18:25 -0700 Subject: [PATCH 13/16] Update kernel headers to 3.11 Last minute addition to pkt_sched.h --- include/linux/pkt_sched.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h index dbd71b0c..09d62b92 100644 --- a/include/linux/pkt_sched.h +++ b/include/linux/pkt_sched.h @@ -73,9 +73,17 @@ struct tc_estimator { #define TC_H_ROOT (0xFFFFFFFFU) #define TC_H_INGRESS (0xFFFFFFF1U) +/* 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; - unsigned char __reserved; + __u8 linklayer; /* lower 4 bits */ unsigned short overhead; short cell_align; unsigned short mpu; From 3c61c01a666d9f4dbb871305ab6791e19ede7d4a Mon Sep 17 00:00:00 2001 From: Nicolas Dichtel Date: Thu, 29 Aug 2013 14:29:07 +0200 Subject: [PATCH 14/16] ipnetns: fix ip batch mode when using 'netns exec' Since commit a05f6511f543, ip batch mode is broken when using 'netns exec' cmd. When WIFEXITED() returns true, it means that the child exited normally, hence we must not call exit() but just returns the status. If we call exit, the next commands in the file file are not executed. If WIFEXITED() returns false, we can call exit() because it means that the child failed. This patch partially reverts commit a05f6511f543. Signed-off-by: Nicolas Dichtel --- ip/ipnetns.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ip/ipnetns.c b/ip/ipnetns.c index c8a47920..89dda3ff 100644 --- a/ip/ipnetns.c +++ b/ip/ipnetns.c @@ -205,11 +205,15 @@ static int netns_exec(int argc, char **argv) exit(1); } - /* If child failed, propagate status */ - if (WIFEXITED(status)) - exit(WEXITSTATUS(status)); + if (WIFEXITED(status)) { + /* ip must return the status of the child, + * but do_cmd() will add a minus to this, + * so let's add another one here to cancel it. + */ + return -WEXITSTATUS(status); + } - return 0; + exit(1); } } From 3e92ff522ac2d634b21a3cd9c4d1de278532f0ad Mon Sep 17 00:00:00 2001 From: Jesper Dangaard Brouer Date: Fri, 30 Aug 2013 14:02:10 +0200 Subject: [PATCH 15/16] linklayer interface between kernel and tc/userspace This iproute2 tc patch is connected to the kernel - commit 8a8e3d84b17 (net_sched: restore "linklayer atm" handling) The rate table calculated by tc, have gotten replaced in the kernel and is no-longer used for lookups. This happened in kernel release v3.8 caused by kernel - commit 56b765b79 ("htb: improved accuracy at high rates"). This change unfortunately caused breakage of tc overhead and linklayer parameters. Kernel overhead handling got fixed in kernel v3.10 by - commit 01cb71d2d47 (net_sched: restore "overhead xxx" handling) Kernel linklayer handling got fixed in kernel v3.11 by - commit 8a8e3d84b17 (net_sched: restore "linklayer atm" handling) The linklayer fix introduced a struct change, that allow the linklayer attribute to be transferred between tc and kernel. This patch make use of this linklayer attribute. The linklayer setting is transfer to the kernel. And linklayer setting received from the kernel is printed with a prefixed "linklayer" when listing current configuration. The default TC_LINKLAYER_ETHERNET is only printed in detailed output mode. Signed-off-by: Jesper Dangaard Brouer --- tc/m_police.c | 5 +++++ tc/q_cbq.c | 5 +++++ tc/q_htb.c | 5 +++++ tc/q_tbf.c | 5 +++++ tc/tc_core.c | 16 ++++++++++++++++ 5 files changed, 36 insertions(+) diff --git a/tc/m_police.c b/tc/m_police.c index 53cbefcf..300287e9 100644 --- a/tc/m_police.c +++ b/tc/m_police.c @@ -322,9 +322,11 @@ int print_police(struct action_util *a, FILE *f, struct rtattr *arg) { SPRINT_BUF(b1); + SPRINT_BUF(b2); struct tc_police *p; struct rtattr *tb[TCA_POLICE_MAX+1]; unsigned buffer; + unsigned int linklayer; if (arg == NULL) return 0; @@ -360,6 +362,9 @@ print_police(struct action_util *a, FILE *f, struct rtattr *arg) } else fprintf(f, " "); fprintf(f, "overhead %ub ", p->rate.overhead); + linklayer = (p->rate.linklayer & TC_LINKLAYER_MASK); + if (linklayer > TC_LINKLAYER_ETHERNET || show_details) + fprintf(f, "linklayer %s ", sprint_linklayer(linklayer, b2)); fprintf(f, "\nref %d bind %d\n",p->refcnt, p->bindcnt); return 0; diff --git a/tc/q_cbq.c b/tc/q_cbq.c index 3c5e72c1..d76600cc 100644 --- a/tc/q_cbq.c +++ b/tc/q_cbq.c @@ -442,7 +442,9 @@ static int cbq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) struct tc_cbq_wrropt *wrr = NULL; struct tc_cbq_fopt *fopt = NULL; struct tc_cbq_ovl *ovl = NULL; + unsigned int linklayer; SPRINT_BUF(b1); + SPRINT_BUF(b2); if (opt == NULL) return 0; @@ -486,6 +488,9 @@ static int cbq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) char buf[64]; print_rate(buf, sizeof(buf), r->rate); fprintf(f, "rate %s ", buf); + linklayer = (r->linklayer & TC_LINKLAYER_MASK); + if (linklayer > TC_LINKLAYER_ETHERNET || show_details) + fprintf(f, "linklayer %s ", sprint_linklayer(linklayer, b2)); if (show_details) { fprintf(f, "cell %ub ", 1<cell_log); if (r->mpu) diff --git a/tc/q_htb.c b/tc/q_htb.c index 9321c0ad..7b6f9082 100644 --- a/tc/q_htb.c +++ b/tc/q_htb.c @@ -244,9 +244,11 @@ static int htb_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) struct tc_htb_opt *hopt; struct tc_htb_glob *gopt; double buffer,cbuffer; + unsigned int linklayer; SPRINT_BUF(b1); SPRINT_BUF(b2); SPRINT_BUF(b3); + SPRINT_BUF(b4); if (opt == NULL) return 0; @@ -268,6 +270,9 @@ static int htb_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) buffer = tc_calc_xmitsize(hopt->rate.rate, hopt->buffer); fprintf(f, "ceil %s ", sprint_rate(hopt->ceil.rate, b1)); cbuffer = tc_calc_xmitsize(hopt->ceil.rate, hopt->cbuffer); + linklayer = (hopt->rate.linklayer & TC_LINKLAYER_MASK); + if (linklayer > TC_LINKLAYER_ETHERNET || show_details) + fprintf(f, "linklayer %s ", sprint_linklayer(linklayer, b4)); if (show_details) { fprintf(f, "burst %s/%u mpu %s overhead %s ", sprint_size(buffer, b1), diff --git a/tc/q_tbf.c b/tc/q_tbf.c index 72cfff66..34784a41 100644 --- a/tc/q_tbf.c +++ b/tc/q_tbf.c @@ -239,10 +239,12 @@ static int tbf_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) { struct rtattr *tb[TCA_TBF_PTAB+1]; struct tc_tbf_qopt *qopt; + unsigned int linklayer; double buffer, mtu; double latency; SPRINT_BUF(b1); SPRINT_BUF(b2); + SPRINT_BUF(b3); if (opt == NULL) return 0; @@ -294,6 +296,9 @@ static int tbf_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) if (qopt->rate.overhead) { fprintf(f, "overhead %d", qopt->rate.overhead); } + linklayer = (qopt->rate.linklayer & TC_LINKLAYER_MASK); + if (linklayer > TC_LINKLAYER_ETHERNET || show_details) + fprintf(f, "linklayer %s ", sprint_linklayer(linklayer, b3)); return 0; } diff --git a/tc/tc_core.c b/tc/tc_core.c index 85b072ef..a5243370 100644 --- a/tc/tc_core.c +++ b/tc/tc_core.c @@ -102,6 +102,21 @@ static unsigned tc_adjust_size(unsigned sz, unsigned mpu, enum link_layer linkla } } +/* Notice, the rate table calculated here, have gotten replaced in the + * kernel and is no-longer used for lookups. + * + * This happened in kernel release v3.8 caused by kernel + * - commit 56b765b79 ("htb: improved accuracy at high rates"). + * This change unfortunately caused breakage of tc overhead and + * linklayer parameters. + * + * Kernel overhead handling got fixed in kernel v3.10 by + * - commit 01cb71d2d47 (net_sched: restore "overhead xxx" handling) + * + * Kernel linklayer handling got fixed in kernel v3.11 by + * - commit 8a8e3d84b17 (net_sched: restore "linklayer atm" handling) + */ + /* rtab[pkt_len>>cell_log] = pkt_xmit_time */ @@ -131,6 +146,7 @@ int tc_calc_rtable(struct tc_ratespec *r, __u32 *rtab, r->cell_align=-1; // Due to the sz calc r->cell_log=cell_log; + r->linklayer = (linklayer & TC_LINKLAYER_MASK); return cell_log; } From d3c77c46cdaf25f34a5f31df333c69de7f157f73 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 3 Sep 2013 08:23:03 -0700 Subject: [PATCH 16/16] v3.11.0 --- include/SNAPSHOT.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/SNAPSHOT.h b/include/SNAPSHOT.h index 63b857de..8f896b78 100644 --- a/include/SNAPSHOT.h +++ b/include/SNAPSHOT.h @@ -1 +1 @@ -static const char SNAPSHOT[] = "130716"; +static const char SNAPSHOT[] = "130903";