From 9d715cf65a066fe51797331d1b7057900d3162ec Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 18 Oct 2018 13:15:45 -0700 Subject: [PATCH 01/17] doc/man: spelling fixes Use ispell and codespell to find/fix spelling errors in documentation and man pages. Signed-off-by: Stephen Hemminger --- doc/actions/actions-general | 14 +++++++------- doc/actions/ifb-README | 18 +++++++++--------- doc/actions/mirred-usage | 6 +++--- man/man8/ip-link.8.in | 4 ++-- man/man8/ip-tunnel.8 | 2 +- man/man8/tc-tunnel_key.8 | 2 +- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/doc/actions/actions-general b/doc/actions/actions-general index 70f7cd65..08cc785c 100644 --- a/doc/actions/actions-general +++ b/doc/actions/actions-general @@ -21,7 +21,7 @@ we execute a policing action which rate limits its bandwidth utilization to 1.5Mbps". The new extensions allow for more than just policing actions to be added. -They are also fully backward compatible. If you have a kernel that doesnt +They are also fully backward compatible. If you have a kernel that doesn't understand them, then the effect is null i.e if you have a newer tc but older kernel, the actions are not installed. Likewise if you have a newer kernel but older tc, obviously the tc will use current @@ -31,7 +31,7 @@ right tc ;-> A side effect is that we can now get stateless firewalling to work with tc. Essentially this is now an alternative to iptables. -I wont go into details of my dislike for iptables at times, but +I won't go into details of my dislike for iptables at times, but scalability is one of the main issues; however, if you need stateful classification - use netfilter (for now). @@ -77,7 +77,7 @@ iptable target. I have only tested with mangler targets up to now. In terms of hooks: *ingress is mapped to pre-routing hook *egress is mapped to post-routing hook -I dont see much value in the other hooks, if you see it and email me good +I don't see much value in the other hooks, if you see it and email me good reasons, the addition is trivial. Example syntax for iptables targets usage becomes: @@ -111,12 +111,12 @@ The script below does the following: - an incoming packet from 10.0.0.21 is first given a firewall mark of 1. - It is then metered to make sure it does not exceed its allocated rate of -1Kbps. If it doesnt exceed rate, this is where we terminate action execution. +1Kbps. If it doesn't exceed rate, this is where we terminate action execution. - If it does exceed its rate, its "color" changes to a mark of 2 and it is then passed through a second meter. --The second meter is shared across all flows on that device [i am suprised +-The second meter is shared across all flows on that device [i am surpised that this seems to be not a well know feature of the policer; Bert was telling me that someone was writing a qdisc just to do sharing across multiple devices; it must be the summer heat again; weve had someone doing that every year around @@ -145,7 +145,7 @@ u32 match ip src 10.0.0.21/32 flowid 1:15 \ action ipt -j mark --set-mark 1 index 2 \ # # then pass it through a policer which allows 1kbps; if the flow -# doesnt exceed that rate, this is where we stop, if it exceeds we +# doesn't exceed that rate, this is where we stop, if it exceeds we # pipe the packet to the next action action police rate 1kbit burst 9k pipe \ # @@ -241,7 +241,7 @@ filter protocol ip pref 1 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:1 Neat, eh? -Wanna write an action module? +Want to write an action module? ------------------------------ Its easy. Either look at the code or send me email. I will document at some point; will also accept documentation. diff --git a/doc/actions/ifb-README b/doc/actions/ifb-README index 3d011793..63247f3c 100644 --- a/doc/actions/ifb-README +++ b/doc/actions/ifb-README @@ -17,26 +17,26 @@ dropping. I am not aware of any study that shows policing is worse than shaping in achieving the end goal of rate control. I would be interested if anyone is experimenting. -3) Very interesting use: if you are serving p2p you may wanna give -preference to your own localy originated traffic (when responses come back) +3) Very interesting use: if you are serving p2p you may want to give +preference to your own locally originated traffic (when responses come back) vs someone using your system to do bittorent. So QoSing based on state -comes in as the solution. What people did to achive this was stick +comes in as the solution. What people did to achieve this was stick the IMQ somewhere prelocal hook. I think this is a pretty neat feature to have in Linux in general. (i.e not just for IMQ). -But i wont go back to putting netfilter hooks in the device to satisfy -this. I also dont think its worth it hacking ifb some more to be +But i won't go back to putting netfilter hooks in the device to satisfy +this. I also don't think its worth it hacking ifb some more to be aware of say L3 info and play ip rule tricks to achieve this. ---> Instead the plan is to have a contrack related action. This action will -selectively either query/create contrack state on incoming packets. +--> Instead the plan is to have a conntrack related action. This action will +selectively either query/create conntrack state on incoming packets. Packets could then be redirected to ifb based on what happens -> eg on incoming packets; if we find they are of known state we could send to -a different queue than one which didnt have existing state. This +a different queue than one which didn't have existing state. This all however is dependent on whatever rules the admin enters. At the moment this 3rd function does not exist yet. I have decided that instead of sitting on the patch for another year, to release it and then -if theres pressure i will add this feature. +if there is pressure i will add this feature. An example, to provide functionality that most people use IMQ for below: diff --git a/doc/actions/mirred-usage b/doc/actions/mirred-usage index 2622c43b..e749eedc 100644 --- a/doc/actions/mirred-usage +++ b/doc/actions/mirred-usage @@ -26,13 +26,13 @@ dev ("port" in ethernet switch/bridging terminology) - redirect steals the packet and redirects to specified destination dev. -What NOT to do if you dont want your machine to crash: +What NOT to do if you don't want your machine to crash: ------------------------------------------------------ Do not create loops! Loops are not hard to create in the egress qdiscs. -Here are simple rules to follow if you dont want to get +Here are simple rules to follow if you don't want to get hurt: A) Do not have the same packet go to same netdevice twice in a single graph of policies. Your machine will just hang! @@ -129,7 +129,7 @@ so you could tcpdump them (dummy by defaults drops all packets it sees). This is a very useful debug feature. Lets say you are policing packets from alias 192.168.200.200/32 -you dont want those to exceed 100kbps going out. +you don't want those to exceed 100kbps going out. --- tc qdisc add dev eth0 handle 1:0 root prio diff --git a/man/man8/ip-link.8.in b/man/man8/ip-link.8.in index 38e4ee68..cc04dc74 100644 --- a/man/man8/ip-link.8.in +++ b/man/man8/ip-link.8.in @@ -629,7 +629,7 @@ or the internal FDB should be used. Allows to transport group policy context across VXLAN network peers. If enabled, includes the mark of a packet in the VXLAN header for outgoing packets and fills the packet mark based on the information found in the -VXLAN header for incomming packets. +VXLAN header for incoming packets. Format of upper 16 bits of packet mark (flags); @@ -880,7 +880,7 @@ discovery. - enables/disables IPv4 DF suppression on this tunnel. Normally datagrams that exceed the MTU will be fragmented; the presence of the DF flag inhibits this, resulting instead in an ICMP Unreachable -(Fragmentation Required) message. Enabling this attribute casues the +(Fragmentation Required) message. Enabling this attribute causes the DF flag to be ignored. .sp diff --git a/man/man8/ip-tunnel.8 b/man/man8/ip-tunnel.8 index 9040ddda..9a510af0 100644 --- a/man/man8/ip-tunnel.8 +++ b/man/man8/ip-tunnel.8 @@ -183,7 +183,7 @@ discovery. enable IPv4 DF suppression on this tunnel. Normally datagrams that exceed the MTU will be fragmented; the presence of the DF flag inhibits this, resulting instead in an ICMP Unreachable -(Fragmentation Required) message. Enabling this attribute casues the +(Fragmentation Required) message. Enabling this attribute causes the DF flag to be ignored. .TP diff --git a/man/man8/tc-tunnel_key.8 b/man/man8/tc-tunnel_key.8 index 1e093624..dc8421b4 100644 --- a/man/man8/tc-tunnel_key.8 +++ b/man/man8/tc-tunnel_key.8 @@ -98,7 +98,7 @@ Outer header TOS Outer header TTL .TP .RB [ no ] csum -Controlls outer UDP checksum. When set to +Controls outer UDP checksum. When set to .B csum (which is default), the outer UDP checksum is calculated and included in the packets. When set to From ab7318f9d4570ce8d7cc713d95f121242df94788 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 18 Oct 2018 13:18:56 -0700 Subject: [PATCH 02/17] examples: fix spelling errors Signed-off-by: Stephen Hemminger --- examples/cbq.init-v0.7.3 | 6 +++--- examples/diffserv/Edge2 | 2 +- examples/diffserv/Edge31-ca-u32 | 8 ++++---- examples/diffserv/Edge31-cb-chains | 4 ++-- examples/diffserv/Edge32-ca-u32 | 8 ++++---- examples/diffserv/Edge32-cb-chains | 4 ++-- examples/diffserv/Edge32-cb-u32 | 4 ++-- examples/diffserv/regression-testing | 2 +- 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/examples/cbq.init-v0.7.3 b/examples/cbq.init-v0.7.3 index 66448d88..ec783948 100644 --- a/examples/cbq.init-v0.7.3 +++ b/examples/cbq.init-v0.7.3 @@ -256,7 +256,7 @@ # class. By default, TBF is used. Note that attaching TBF to CBQ class # shapes the traffic to conform to TBF parameters and prevents the class # from borrowing bandwidth from its parent even if you have BOUNDED set -# to "no". To allow the class to borrow bandwith (provided it is not +# to "no". To allow the class to borrow bandwidth (provided it is not # bounded), you must set LEAF to "none" or "sfq". # # If you want to ensure (approximately) fair sharing of bandwidth among @@ -271,7 +271,7 @@ # # Note: Don't forget to set LEAF to "none" or "sfq", otherwise the class will # have TBF attached to itself and will not be able to borrow unused -# bandwith from its parent. +# bandwidth from its parent. # # ISOLATED=yes|no optional, default "no" # @@ -392,7 +392,7 @@ # MARK= # # These parameters make up "fw" filter rules that select traffic for -# each of the classes accoring to firewall "mark". Mark is a decimal +# each of the classes according to firewall "mark". Mark is a decimal # number packets are tagged with if firewall rules say so. You can # use multiple MARK fields per config. # diff --git a/examples/diffserv/Edge2 b/examples/diffserv/Edge2 index 2f78da24..f81f510f 100644 --- a/examples/diffserv/Edge2 +++ b/examples/diffserv/Edge2 @@ -36,7 +36,7 @@ $TC qdisc add dev $INDEV handle ffff: ingress # by ipchains to tag value 3 (The rest of the subnet packets -- not # tag 1 or 2) to not go beyond 1.5Mbps # Allow up to at least 60 packets to burst (assuming maximum packet -# size of # 1.5 KB) in the long run and upto about 6 packets in the +# size of # 1.5 KB) in the long run and up to about 6 packets in the # shot run ############################################################ diff --git a/examples/diffserv/Edge31-ca-u32 b/examples/diffserv/Edge31-ca-u32 index 25e6c0b1..7344851a 100644 --- a/examples/diffserv/Edge31-ca-u32 +++ b/examples/diffserv/Edge31-ca-u32 @@ -47,7 +47,7 @@ meter5=" police index 5 rate $CIR1 burst $CBS2 " # *********************** AF41 *************************** #AF41 (DSCP 0x22) is passed on with a tcindex value 1 -#if it doesnt exceed its CIR/CBS +#if it doesn't exceed its CIR/CBS #policer 1 is used. # $TC filter add dev $INDEV parent ffff: protocol ip prio 4 u32 \ @@ -75,7 +75,7 @@ drop flowid :3 # *********************** AF42 *************************** #AF42 (DSCP 0x24) from is passed on with a tcindex value 2 -#if it doesnt exceed its CIR/CBS +#if it doesn't exceed its CIR/CBS #policer 2 is used. Note that this is shared with the AF41 # # @@ -95,7 +95,7 @@ drop flowid :3 # *********************** AF43 *************************** # #AF43 (DSCP 0x26) from is passed on with a tcindex value 3 -#if it doesnt exceed its CIR/CBS +#if it doesn't exceed its CIR/CBS #policer 3 is used. Note that this is shared with the AF41 and AF42 # $TC filter add dev $INDEV parent ffff: protocol ip prio 6 u32 \ @@ -106,7 +106,7 @@ drop flowid :3 # *********************** BE *************************** # # Anything else (not from the AF4*) gets discarded if it -# exceeds 1Mbps and by default goes to BE if it doesnt +# exceeds 1Mbps and by default goes to BE if it doesn't # Note that the BE class is also used by the AF4* in the worst # case # diff --git a/examples/diffserv/Edge31-cb-chains b/examples/diffserv/Edge31-cb-chains index d7faae98..49c396bc 100644 --- a/examples/diffserv/Edge31-cb-chains +++ b/examples/diffserv/Edge31-cb-chains @@ -47,7 +47,7 @@ $TC qdisc add dev $INDEV handle ffff: ingress ############################################################ # # anything with fw tag of 1 is passed on with a tcindex value 1 -#if it doesnt exceed its allocated rate (CIR/CBS) +#if it doesn't exceed its allocated rate (CIR/CBS) # $TC filter add dev $INDEV parent ffff: protocol ip prio 4 handle 1 fw \ $meter1 \ @@ -68,7 +68,7 @@ $meter3 \ drop flowid 4:3 # # Anything else (not from the subnet 10.2.0.24/24) gets discarded if it -# exceeds 1Mbps and by default goes to BE if it doesnt +# exceeds 1Mbps and by default goes to BE if it doesn't # $TC filter add dev $INDEV parent ffff: protocol ip prio 6 handle 2 fw \ $meter5 \ diff --git a/examples/diffserv/Edge32-ca-u32 b/examples/diffserv/Edge32-ca-u32 index edf21e43..9d3ccd07 100644 --- a/examples/diffserv/Edge32-ca-u32 +++ b/examples/diffserv/Edge32-ca-u32 @@ -51,7 +51,7 @@ $TC qdisc add dev $INDEV handle ffff: ingress # # *********************** AF41 *************************** #AF41 (DSCP 0x22) from is passed on with a tcindex value 1 -#if it doesnt exceed its CIR/CBS + PIR/EBS +#if it doesn't exceed its CIR/CBS + PIR/EBS #policer 1 is used. # $TC filter add dev $INDEV parent ffff: protocol ip prio 1 u32 \ @@ -90,7 +90,7 @@ drop flowid :3 # # *********************** AF42 *************************** #AF42 (DSCP 0x24) from is passed on with a tcindex value 2 -#if it doesnt exceed its CIR/CBS + PIR/EBS +#if it doesn't exceed its CIR/CBS + PIR/EBS #policer 2 is used. Note that this is shared with the AF41 # # @@ -119,7 +119,7 @@ drop flowid :3 # *********************** AF43 *************************** # #AF43 (DSCP 0x26) from is passed on with a tcindex value 3 -#if it doesnt exceed its CIR/CBS + PIR/EBS +#if it doesn't exceed its CIR/CBS + PIR/EBS #policer 3 is used. Note that this is shared with the AF41 and AF42 # $TC filter add dev $INDEV parent ffff: protocol ip prio 13 u32 \ @@ -134,7 +134,7 @@ drop flowid :3 ## *********************** BE *************************** ## ## Anything else (not from the AF4*) gets discarded if it -## exceeds 1Mbps and by default goes to BE if it doesnt +## exceeds 1Mbps and by default goes to BE if it doesn't ## Note that the BE class is also used by the AF4* in the worst ## case ## diff --git a/examples/diffserv/Edge32-cb-chains b/examples/diffserv/Edge32-cb-chains index 804fad19..88ee2cea 100644 --- a/examples/diffserv/Edge32-cb-chains +++ b/examples/diffserv/Edge32-cb-chains @@ -50,7 +50,7 @@ $TC qdisc add dev $INDEV handle ffff: ingress ############################################################ # # anything with fw tag of 1 is passed on with a tcindex value 1 -#if it doesnt exceed its allocated rate (CIR/CBS) +#if it doesn't exceed its allocated rate (CIR/CBS) # $TC filter add dev $INDEV parent ffff: protocol ip prio 1 handle 1 fw \ $meter1 \ @@ -80,7 +80,7 @@ $meter3a \ drop flowid 4:3 # # Anything else (not from the subnet 10.2.0.24/24) gets discarded if it -# exceeds 1Mbps and by default goes to BE if it doesnt +# exceeds 1Mbps and by default goes to BE if it doesn't # $TC filter add dev $INDEV parent ffff: protocol ip prio 7 handle 2 fw \ $meter5 \ diff --git a/examples/diffserv/Edge32-cb-u32 b/examples/diffserv/Edge32-cb-u32 index cc2ebb40..54494137 100644 --- a/examples/diffserv/Edge32-cb-u32 +++ b/examples/diffserv/Edge32-cb-u32 @@ -50,7 +50,7 @@ $TC qdisc add dev $INDEV handle ffff: ingress # NOTE: tcindex 1 maps to AF41, 2->AF42, 3->AF43, 4->BE # #anything from subnet 10.2.0.2/24 is passed on with a tcindex value 1 -#if it doesnt exceed its CIR/CBS + PIR/EBS +#if it doesn't exceed its CIR/CBS + PIR/EBS # $TC filter add dev $INDEV parent ffff: protocol ip prio 1 u32 \ match ip src 10.2.0.0/24 $meter1 \ @@ -82,7 +82,7 @@ drop flowid :3 # # # Anything else (not from the subnet 10.2.0.24/24) gets discarded if it -# exceeds 1Mbps and by default goes to BE if it doesnt +# exceeds 1Mbps and by default goes to BE if it doesn't # $TC filter add dev $INDEV parent ffff: protocol ip prio 7 u32 \ match ip src 0/0 $meter5 \ diff --git a/examples/diffserv/regression-testing b/examples/diffserv/regression-testing index 0ec705c0..d50f4c8a 100644 --- a/examples/diffserv/regression-testing +++ b/examples/diffserv/regression-testing @@ -1,6 +1,6 @@ These were the tests done to validate the Diffserv scripts. -This document will be updated continously. If you do more +This document will be updated continuously. If you do more thorough validation testing please post the details to the diffserv mailing list. Nevertheless, these tests should serve for basic validation. From 5cc4639471411273feb0fd01dc44ad96d901061c Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 18 Oct 2018 13:22:25 -0700 Subject: [PATCH 03/17] config: spelling fixes Signed-off-by: Stephen Hemminger --- README.iproute2+tc | 2 +- configure | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.iproute2+tc b/README.iproute2+tc index 2a5638da..5979098e 100644 --- a/README.iproute2+tc +++ b/README.iproute2+tc @@ -47,7 +47,7 @@ papers. Pairs X:Y are class handles, X:0 are qdisc handles. weight should be proportional to rate for leaf classes -(I choosed it ten times less, but it is not necessary) +(I repeated it ten times less, but it is not necessary) defmap is bitmap of logical priorities served by this class. diff --git a/configure b/configure index 5ef5cd4c..744d6282 100755 --- a/configure +++ b/configure @@ -90,13 +90,13 @@ EOF check_xt_old() { - # bail if previous XT checks has already succeded. + # bail if previous XT checks has already succeeded. if grep -q TC_CONFIG_XT $CONFIG then return fi - #check if we dont need our internal header .. + #check if we don't need our internal header .. cat >$TMPDIR/ipttest.c < char *lib_dir; @@ -129,7 +129,7 @@ EOF check_xt_old_internal_h() { - # bail if previous XT checks has already succeded. + # bail if previous XT checks has already succeeded. if grep -q TC_CONFIG_XT $CONFIG then return From f5a398bf1774a1af67050015ff9cda3678880854 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 18 Oct 2018 13:22:51 -0700 Subject: [PATCH 04/17] tc: spelling fixes Signed-off-by: Stephen Hemminger --- tc/f_u32.c | 2 +- tc/p_ip.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tc/f_u32.c b/tc/f_u32.c index b6064cdb..bff4be63 100644 --- a/tc/f_u32.c +++ b/tc/f_u32.c @@ -1165,7 +1165,7 @@ static int u32_parse_opt(struct filter_util *qu, char *handle, argc--; argv++; } - /* We dont necessarily need class/flowids */ + /* We don't necessarily need class/flowids */ if (terminal_ok) sel.sel.flags |= TC_U32_TERMINAL; diff --git a/tc/p_ip.c b/tc/p_ip.c index 81ac8d95..e9fd6f83 100644 --- a/tc/p_ip.c +++ b/tc/p_ip.c @@ -51,7 +51,7 @@ parse_ip(int *argc_p, char ***argv_p, } /* jamal - look at these and make them either old or new ** scheme given diffserv - ** dont forget the CE bit + ** don't forget the CE bit */ if (strcmp(*argv, "tos") == 0 || matches(*argv, "dsfield") == 0) { NEXT_ARG(); From 94b0c90152604e76a4a275fed0098f64d2a95fc8 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 18 Oct 2018 13:23:11 -0700 Subject: [PATCH 05/17] ip: spelling fixes Signed-off-by: Stephen Hemminger --- ip/iproute.c | 6 +++--- ip/xfrm_state.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ip/iproute.c b/ip/iproute.c index 398322fd..1a68183c 100644 --- a/ip/iproute.c +++ b/ip/iproute.c @@ -923,15 +923,15 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) print_rt_pref(fp, rta_getattr_u8(tb[RTA_PREF])); if (tb[RTA_TTL_PROPAGATE]) { - bool propogate = rta_getattr_u8(tb[RTA_TTL_PROPAGATE]); + bool propagate = rta_getattr_u8(tb[RTA_TTL_PROPAGATE]); if (is_json_context()) print_bool(PRINT_JSON, "ttl-propogate", NULL, - propogate); + propagate); else print_string(PRINT_FP, NULL, "ttl-propogate %s", - propogate ? "enabled" : "disabled"); + propagate ? "enabled" : "disabled"); } print_string(PRINT_FP, NULL, "\n", NULL); diff --git a/ip/xfrm_state.c b/ip/xfrm_state.c index 913e9fa3..748f4849 100644 --- a/ip/xfrm_state.c +++ b/ip/xfrm_state.c @@ -929,7 +929,7 @@ int xfrm_state_print(const struct sockaddr_nl *who, struct nlmsghdr *n, } if (n->nlmsg_type == XFRM_MSG_DELSA) { - /* Dont blame me for this .. Herbert made me do it */ + /* Don't blame me for this .. Herbert made me do it */ xsid = NLMSG_DATA(n); len -= NLMSG_SPACE(sizeof(*xsid)); } else if (n->nlmsg_type == XFRM_MSG_EXPIRE) { From c60683e246e71509e50fda700f18f16f0a6f5610 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 18 Oct 2018 13:23:30 -0700 Subject: [PATCH 06/17] tipc: spelling fix --- tipc/link.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tipc/link.c b/tipc/link.c index afd3e68d..43e26da3 100644 --- a/tipc/link.c +++ b/tipc/link.c @@ -709,7 +709,7 @@ static void link_mon_print_applied(uint16_t applied, uint64_t up_map) close_json_array(PRINT_JSON, "applied_node_status"); } -/* print the non applied members, since we dont know +/* print the non applied members, since we don't know * the members, we print them along with the state */ static void link_mon_print_non_applied(uint16_t applied, uint16_t member_cnt, From 95debca728c3d79361eefcb64e4e2971b7c916dd Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 18 Oct 2018 13:23:38 -0700 Subject: [PATCH 07/17] util: spelling fix --- lib/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/utils.c b/lib/utils.c index 7be2d6be..ad27f78c 100644 --- a/lib/utils.c +++ b/lib/utils.c @@ -1436,7 +1436,7 @@ int makeargs(char *line, char *argv[], int maxargs) break; } - /* seperate words */ + /* separate words */ *cp++ = 0; } argv[argc] = NULL; From 92885e1973a5493980dc1341cb469504e7203cdc Mon Sep 17 00:00:00 2001 From: Petr Vorel Date: Tue, 25 Sep 2018 14:49:56 +0200 Subject: [PATCH 08/17] testsuite: Fix make check when need build generate_nlmsg make check from top level Makefile defines several flags which break building generate_nlmsg: $ make check make -C tools gcc -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wformat=2 -O2 -I../include -I../include/uapi -DRESOLVE_HOSTNAMES -DLIBDIR=\"/usr/lib\" -DCONFDIR=\"/etc/iproute2\" -DNETNS_RUN_DIR=\"/var/run/netns\" -DNETNS_ETC_DIR=\"/etc/netns\" -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -DHAVE_SETNS -DHAVE_SELINUX -DHAVE_ELF -DHAVE_LIBMNL -I/usr/include/libmnl -DNEED_STRLCPY -DHAVE_LIBCAP ../lib/libutil.a ../lib/libnetlink.a -lselinux -lelf -lmnl -lcap -I../../include -include../../include/uapi/linux/netlink.h -o generate_nlmsg generate_nlmsg.c ../../lib/libnetlink.c -lmnl gcc: error: ../lib/libutil.a: No such file or directory gcc: error: ../lib/libnetlink.a: No such file or directory make[2]: *** [Makefile:5: generate_nlmsg] Error 1 make[1]: *** [Makefile:40: generate_nlmsg] Error 2 To fix it reset CFLAGS in sub Makefile and remove LDLIBS entirely (as required -lmnl flag was specified in 5dc2204c ("testsuite: add libmnl"). Fixes: 8804a8c0 ("Makefile: Add check target") Signed-off-by: Petr Vorel Signed-off-by: Stephen Hemminger --- testsuite/tools/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/testsuite/tools/Makefile b/testsuite/tools/Makefile index 7d53d226..e1d9bfef 100644 --- a/testsuite/tools/Makefile +++ b/testsuite/tools/Makefile @@ -1,8 +1,9 @@ # SPDX-License-Identifier: GPL-2.0 +CFLAGS= include ../../config.mk generate_nlmsg: generate_nlmsg.c ../../lib/libnetlink.c - $(CC) $(CPPFLAGS) $(CFLAGS) $(LDLIBS) $(EXTRA_CFLAGS) -I../../include -include../../include/uapi/linux/netlink.h -o $@ $^ -lmnl + $(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) -I../../include -include../../include/uapi/linux/netlink.h -o $@ $^ -lmnl clean: rm -f generate_nlmsg From b1ffc1f465928706e22d585932cead8d74f021de Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Thu, 18 Oct 2018 13:28:23 +0200 Subject: [PATCH 09/17] devlink: Fix error reporting in cmd_resource_set() resource_path_parse() returns either zero or a negative error code, hence the negated value must be passed to strerror(). Fixes: 8cd644095842a ("devlink: Add support for devlink resource abstraction") Signed-off-by: Phil Sutter Acked-by: Jiri Pirko Signed-off-by: Stephen Hemminger --- devlink/devlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devlink/devlink.c b/devlink/devlink.c index 519ee257..8bb254ea 100644 --- a/devlink/devlink.c +++ b/devlink/devlink.c @@ -5127,7 +5127,7 @@ static int cmd_resource_set(struct dl *dl) &dl->opts.resource_id, &dl->opts.resource_id_valid); if (err) { - pr_err("error parsing resource path %s\n", strerror(err)); + pr_err("error parsing resource path %s\n", strerror(-err)); goto out; } From 3b0070f6b1a319b7d6a431a39270a4804cb5927e Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Thu, 18 Oct 2018 13:41:54 +0200 Subject: [PATCH 10/17] rdma: Fix for ineffective check in add_filter() With 'name' field defined as array in struct filters, it will always contain a value irrespective of whether a name was assigned or not. Fix this by turning the field into a const char pointer. Fixes: 1174be72d1b4c ("rdma: Add filtering infrastructure") Signed-off-by: Phil Sutter Signed-off-by: Stephen Hemminger --- rdma/rdma.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rdma/rdma.h b/rdma/rdma.h index d4b7ba19..c3b7530b 100644 --- a/rdma/rdma.h +++ b/rdma/rdma.h @@ -34,7 +34,7 @@ #define MAX_NUMBER_OF_FILTERS 64 struct filters { - char name[32]; + const char *name; bool is_number; }; From e5da392ff8e3979b86cad04b238ffbbc8076e005 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Thu, 18 Oct 2018 14:30:31 +0200 Subject: [PATCH 11/17] ip-route: Fix for memleak in error path If call to rta_addattr_l() failed, parse_encap_seg6() would leak memory. Fix this by making sure calls to free() are not skipped. Fixes: bd59e5b1517b0 ("ip-route: Fix segfault with many nexthops") Signed-off-by: Phil Sutter Signed-off-by: Stephen Hemminger --- ip/iproute_lwtunnel.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/ip/iproute_lwtunnel.c b/ip/iproute_lwtunnel.c index 969a4763..85045d4f 100644 --- a/ip/iproute_lwtunnel.c +++ b/ip/iproute_lwtunnel.c @@ -498,6 +498,7 @@ static int parse_encap_seg6(struct rtattr *rta, size_t len, int *argcp, int argc = *argcp; int encap = -1; __u32 hmac = 0; + int ret = 0; int srhlen; while (argc > 0) { @@ -539,16 +540,19 @@ static int parse_encap_seg6(struct rtattr *rta, size_t len, int *argcp, memcpy(tuninfo->srh, srh, srhlen); if (rta_addattr_l(rta, len, SEG6_IPTUNNEL_SRH, tuninfo, - sizeof(*tuninfo) + srhlen)) - return -1; - - free(tuninfo); - free(srh); + sizeof(*tuninfo) + srhlen)) { + ret = -1; + goto out; + } *argcp = argc + 1; *argvp = argv - 1; - return 0; +out: + free(tuninfo); + free(srh); + + return ret; } struct lwt_x { From cdefe1d8e472f3a69d5f54d90092b9b50961bf91 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Thu, 18 Oct 2018 14:35:50 +0200 Subject: [PATCH 12/17] rdma: Don't pass garbage to rd_check_is_filtered() Variables 'src_port' and 'dst_port' are initialized only if attributes RDMA_NLDEV_ATTR_RES_SRC_ADDR or RDMA_NLDEV_ATTR_RES_DST_ADDR are present. Make sure to pass them over to rd_check_is_filtered() only if that is the case. Fixes: 9a362cc71a455 ("rdma: Add CM_ID resource tracking information") Signed-off-by: Phil Sutter Signed-off-by: Stephen Hemminger --- rdma/res.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/rdma/res.c b/rdma/res.c index 074b9929..0d8c1c38 100644 --- a/rdma/res.c +++ b/rdma/res.c @@ -621,6 +621,8 @@ static int res_cm_id_parse_cb(const struct nlmsghdr *nlh, void *data) if (rd_check_is_string_filtered(rd, "src-addr", src_addr_str)) continue; + if (rd_check_is_filtered(rd, "src-port", src_port)) + continue; } if (nla_line[RDMA_NLDEV_ATTR_RES_DST_ADDR]) { @@ -630,14 +632,10 @@ static int res_cm_id_parse_cb(const struct nlmsghdr *nlh, void *data) if (rd_check_is_string_filtered(rd, "dst-addr", dst_addr_str)) continue; + if (rd_check_is_filtered(rd, "dst-port", dst_port)) + continue; } - if (rd_check_is_filtered(rd, "src-port", src_port)) - continue; - - if (rd_check_is_filtered(rd, "dst-port", dst_port)) - continue; - if (nla_line[RDMA_NLDEV_ATTR_RES_PID]) { pid = mnl_attr_get_u32( nla_line[RDMA_NLDEV_ATTR_RES_PID]); From 3b5c5ef0a75a9f685e78cd25da78706b5077bd83 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Thu, 18 Oct 2018 15:44:14 +0200 Subject: [PATCH 13/17] ip-route: Fix parse_encap_seg6() srh parsing In case caller did not specify 'segs' parameter, parse_srh() would read garbage while iterating over 'segbuf'. Avoid this by initializing 'segbuf' to an empty string. Fixes: e8493916a8ede ("iproute: add support for SR-IPv6 lwtunnel encapsulation") Signed-off-by: Phil Sutter Signed-off-by: Stephen Hemminger --- ip/iproute_lwtunnel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ip/iproute_lwtunnel.c b/ip/iproute_lwtunnel.c index 85045d4f..4ebfaa7c 100644 --- a/ip/iproute_lwtunnel.c +++ b/ip/iproute_lwtunnel.c @@ -494,7 +494,7 @@ static int parse_encap_seg6(struct rtattr *rta, size_t len, int *argcp, struct seg6_iptunnel_encap *tuninfo; struct ipv6_sr_hdr *srh; char **argv = *argvp; - char segbuf[1024]; + char segbuf[1024] = ""; int argc = *argcp; int encap = -1; __u32 hmac = 0; From 8d05f33a381a22572341204c667aafca02aabcca Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Thu, 18 Oct 2018 15:48:09 +0200 Subject: [PATCH 14/17] tipc: Drop unused variable 'genl' Although initialized by call to libmnl, the variable is used only in a call to sizeof(). Drop it and call sizeof with its type instead. Fixes: f043759dd4928 ("tipc: add new TIPC configuration tool") Signed-off-by: Phil Sutter Signed-off-by: Stephen Hemminger --- tipc/node.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tipc/node.c b/tipc/node.c index 0fa1064c..2fec6753 100644 --- a/tipc/node.c +++ b/tipc/node.c @@ -26,13 +26,12 @@ static int node_list_cb(const struct nlmsghdr *nlh, void *data) { - struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); struct nlattr *info[TIPC_NLA_MAX + 1] = {}; struct nlattr *attrs[TIPC_NLA_NODE_MAX + 1] = {}; char str[33] = {}; uint32_t addr; - mnl_attr_parse(nlh, sizeof(*genl), parse_attrs, info); + mnl_attr_parse(nlh, sizeof(struct genlmsghdr), parse_attrs, info); if (!info[TIPC_NLA_NODE]) return MNL_CB_ERROR; @@ -160,7 +159,6 @@ static int cmd_node_set_nodeid(struct nlmsghdr *nlh, const struct cmd *cmd, static int nodeid_get_cb(const struct nlmsghdr *nlh, void *data) { - struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); struct nlattr *info[TIPC_NLA_MAX + 1] = {}; struct nlattr *attrs[TIPC_NLA_NET_MAX + 1] = {}; char str[33] = {0,}; @@ -168,7 +166,7 @@ static int nodeid_get_cb(const struct nlmsghdr *nlh, void *data) uint64_t *w0 = (uint64_t *) &id[0]; uint64_t *w1 = (uint64_t *) &id[8]; - mnl_attr_parse(nlh, sizeof(*genl), parse_attrs, info); + mnl_attr_parse(nlh, sizeof(struct genlmsghdr), parse_attrs, info); if (!info[TIPC_NLA_NET]) return MNL_CB_ERROR; @@ -207,11 +205,10 @@ static int cmd_node_get_nodeid(struct nlmsghdr *nlh, const struct cmd *cmd, static int netid_get_cb(const struct nlmsghdr *nlh, void *data) { - struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); struct nlattr *info[TIPC_NLA_MAX + 1] = {}; struct nlattr *attrs[TIPC_NLA_NET_MAX + 1] = {}; - mnl_attr_parse(nlh, sizeof(*genl), parse_attrs, info); + mnl_attr_parse(nlh, sizeof(struct genlmsghdr), parse_attrs, info); if (!info[TIPC_NLA_NET]) return MNL_CB_ERROR; From 6358bbc381c6e38465838370bcbbdeb77ec3565a Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Thu, 18 Oct 2018 15:48:48 +0200 Subject: [PATCH 15/17] tc: Remove pointless assignments in batch() All these assignments are later overwritten without reading in between, so just drop them. Fixes: 485d0c6001c4a ("tc: Add batchsize feature for filter and actions") Signed-off-by: Phil Sutter Signed-off-by: Stephen Hemminger --- tc/tc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tc/tc.c b/tc/tc.c index c493d5e9..eacd5c08 100644 --- a/tc/tc.c +++ b/tc/tc.c @@ -325,11 +325,11 @@ static int batch(const char *name) struct batch_buf *head = NULL, *tail = NULL, *buf_pool = NULL; char *largv[100], *largv_next[100]; char *line, *line_next = NULL; - bool bs_enabled_next = false; bool bs_enabled = false; bool lastline = false; int largc, largc_next; bool bs_enabled_saved; + bool bs_enabled_next; int batchsize = 0; size_t len = 0; int ret = 0; @@ -358,7 +358,6 @@ static int batch(const char *name) goto Exit; largc = makeargs(line, largv, 100); bs_enabled = batchsize_enabled(largc, largv); - bs_enabled_saved = bs_enabled; do { if (getcmdline(&line_next, &len, stdin) == -1) lastline = true; @@ -394,7 +393,6 @@ static int batch(const char *name) len = 0; bs_enabled_saved = bs_enabled; bs_enabled = bs_enabled_next; - bs_enabled_next = false; if (largc == 0) { largc = largc_next; From 737b8258b35f4cc643a8153fdf955bfa0adec30f Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Tue, 23 Oct 2018 12:36:24 +0200 Subject: [PATCH 16/17] tc: htb: Print default value in hex Value of 'default' is assumed to be hexadecimal when parsing, so consequently it should be printed in hex as well. This is a regression introduced when adding JSON output. As requested, also change JSON output to print the value as hex string. Fixes: f354fa6aa5ff0 ("tc: jsonify htb qdisc") Signed-off-by: Phil Sutter Signed-off-by: Stephen Hemminger --- tc/q_htb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tc/q_htb.c b/tc/q_htb.c index c8b2941d..5fb11d28 100644 --- a/tc/q_htb.c +++ b/tc/q_htb.c @@ -332,7 +332,7 @@ static int htb_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) if (RTA_PAYLOAD(tb[TCA_HTB_INIT]) < sizeof(*gopt)) return -1; print_int(PRINT_ANY, "r2q", "r2q %d", gopt->rate2quantum); - print_uint(PRINT_ANY, "default", " default %u", gopt->defcls); + print_0xhex(PRINT_ANY, "default", " default %x", gopt->defcls); print_uint(PRINT_ANY, "direct_packets_stat", " direct_packets_stat %u", gopt->direct_pkts); if (show_details) { From 2808241af54f9584d40f5a2293ef1d36986dc8ec Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 23 Oct 2018 10:14:57 -0700 Subject: [PATCH 17/17] v4.19.0 --- include/SNAPSHOT.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/SNAPSHOT.h b/include/SNAPSHOT.h index 2714d17e..10876d4d 100644 --- a/include/SNAPSHOT.h +++ b/include/SNAPSHOT.h @@ -1 +1 @@ -static const char SNAPSHOT[] = "180813"; +static const char SNAPSHOT[] = "181023";