···16811681MODULE_AUTHOR("Claudio Lanconelli <lanconelli.claudio@eptar.com>");16821682MODULE_LICENSE("GPL");16831683module_param_named(debug, debug.msg_enable, int, 0);16841684-MODULE_PARM_DESC(debug, "Debug verbosity level (0=none, ..., ffff=all)");16841684+MODULE_PARM_DESC(debug, "Debug verbosity level in amount of bits set (0=none, ..., 31=all)");16851685MODULE_ALIAS("spi:" DRV_NAME);
+12-4
drivers/net/ethernet/microchip/lan743x_main.c
···14001400}1401140114021402static void lan743x_tx_frame_add_lso(struct lan743x_tx *tx,14031403- unsigned int frame_length)14031403+ unsigned int frame_length,14041404+ int nr_frags)14041405{14051406 /* called only from within lan743x_tx_xmit_frame.14061407 * assuming tx->ring_lock has already been acquired.···1411141014121411 /* wrap up previous descriptor */14131412 tx->frame_data0 |= TX_DESC_DATA0_EXT_;14131413+ if (nr_frags <= 0) {14141414+ tx->frame_data0 |= TX_DESC_DATA0_LS_;14151415+ tx->frame_data0 |= TX_DESC_DATA0_IOC_;14161416+ }14141417 tx_descriptor = &tx->ring_cpu_ptr[tx->frame_tail];14151418 tx_descriptor->data0 = tx->frame_data0;14161419···15191514 u32 tx_tail_flags = 0;1520151515211516 /* wrap up previous descriptor */15221522- tx->frame_data0 |= TX_DESC_DATA0_LS_;15231523- tx->frame_data0 |= TX_DESC_DATA0_IOC_;15171517+ if ((tx->frame_data0 & TX_DESC_DATA0_DTYPE_MASK_) ==15181518+ TX_DESC_DATA0_DTYPE_DATA_) {15191519+ tx->frame_data0 |= TX_DESC_DATA0_LS_;15201520+ tx->frame_data0 |= TX_DESC_DATA0_IOC_;15211521+ }1524152215251523 tx_descriptor = &tx->ring_cpu_ptr[tx->frame_tail];15261524 buffer_info = &tx->buffer_info[tx->frame_tail];···16081600 }1609160116101602 if (gso)16111611- lan743x_tx_frame_add_lso(tx, frame_length);16031603+ lan743x_tx_frame_add_lso(tx, frame_length, nr_frags);1612160416131605 if (nr_frags <= 0)16141606 goto finish;
+8-3
drivers/net/geneve.c
···692692static int geneve_open(struct net_device *dev)693693{694694 struct geneve_dev *geneve = netdev_priv(dev);695695- bool ipv6 = !!(geneve->info.mode & IP_TUNNEL_INFO_IPV6);696695 bool metadata = geneve->collect_md;696696+ bool ipv4, ipv6;697697 int ret = 0;698698699699+ ipv6 = geneve->info.mode & IP_TUNNEL_INFO_IPV6 || metadata;700700+ ipv4 = !ipv6 || metadata;699701#if IS_ENABLED(CONFIG_IPV6)700700- if (ipv6 || metadata)702702+ if (ipv6) {701703 ret = geneve_sock_add(geneve, true);704704+ if (ret < 0 && ret != -EAFNOSUPPORT)705705+ ipv4 = false;706706+ }702707#endif703703- if (!ret && (!ipv6 || metadata))708708+ if (ipv4)704709 ret = geneve_sock_add(geneve, false);705710 if (ret < 0)706711 geneve_sock_release(geneve);
+19-3
drivers/net/hyperv/netvsc_drv.c
···744744 schedule_delayed_work(&ndev_ctx->dwork, 0);745745}746746747747+static void netvsc_comp_ipcsum(struct sk_buff *skb)748748+{749749+ struct iphdr *iph = (struct iphdr *)skb->data;750750+751751+ iph->check = 0;752752+ iph->check = ip_fast_csum(iph, iph->ihl);753753+}754754+747755static struct sk_buff *netvsc_alloc_recv_skb(struct net_device *net,748756 struct netvsc_channel *nvchan)749757{···778770 /* skb is already created with CHECKSUM_NONE */779771 skb_checksum_none_assert(skb);780772781781- /*782782- * In Linux, the IP checksum is always checked.783783- * Do L4 checksum offload if enabled and present.773773+ /* Incoming packets may have IP header checksum verified by the host.774774+ * They may not have IP header checksum computed after coalescing.775775+ * We compute it here if the flags are set, because on Linux, the IP776776+ * checksum is always checked.777777+ */778778+ if (csum_info && csum_info->receive.ip_checksum_value_invalid &&779779+ csum_info->receive.ip_checksum_succeeded &&780780+ skb->protocol == htons(ETH_P_IP))781781+ netvsc_comp_ipcsum(skb);782782+783783+ /* Do L4 checksum offload if enabled and present.784784 */785785 if (csum_info && (net->features & NETIF_F_RXCSUM)) {786786 if (csum_info->receive.tcp_checksum_succeeded ||
···454454 if (xenvif_hash_cache_size == 0)455455 return;456456457457+ BUG_ON(vif->hash.cache.count);458458+457459 spin_lock_init(&vif->hash.cache.lock);458460 INIT_LIST_HEAD(&vif->hash.cache.list);459461}
+7
drivers/net/xen-netback/interface.c
···153153{154154 struct xenvif *vif = netdev_priv(dev);155155 unsigned int size = vif->hash.size;156156+ unsigned int num_queues;157157+158158+ /* If queues are not set up internally - always return 0159159+ * as the packet going to be dropped anyway */160160+ num_queues = READ_ONCE(vif->num_queues);161161+ if (num_queues < 1)162162+ return 0;156163157164 if (vif->hash.alg == XEN_NETIF_CTRL_HASH_ALGORITHM_NONE)158165 return fallback(dev, skb, NULL) % dev->real_num_tx_queues;
+5-5
drivers/net/xen-netback/netback.c
···10721072 skb_frag_size_set(&frags[i], len);10731073 }1074107410751075- /* Copied all the bits from the frag list -- free it. */10761076- skb_frag_list_init(skb);10771077- xenvif_skb_zerocopy_prepare(queue, nskb);10781078- kfree_skb(nskb);10791079-10801075 /* Release all the original (foreign) frags. */10811076 for (f = 0; f < skb_shinfo(skb)->nr_frags; f++)10821077 skb_frag_unref(skb, f);···11401145 xenvif_fill_frags(queue, skb);1141114611421147 if (unlikely(skb_has_frag_list(skb))) {11481148+ struct sk_buff *nskb = skb_shinfo(skb)->frag_list;11491149+ xenvif_skb_zerocopy_prepare(queue, nskb);11431150 if (xenvif_handle_frag_list(queue, skb)) {11441151 if (net_ratelimit())11451152 netdev_err(queue->vif->dev,···11501153 kfree_skb(skb);11511154 continue;11521155 }11561156+ /* Copied all the bits from the frag list -- free it. */11571157+ skb_frag_list_init(skb);11581158+ kfree_skb(nskb);11531159 }1154116011551161 skb->dev = queue->vif->dev;
+1-1
include/linux/netdevice.h
···38873887 if (debug_value == 0) /* no output */38883888 return 0;38893889 /* set low N bits */38903890- return (1 << debug_value) - 1;38903890+ return (1U << debug_value) - 1;38913891}3892389238933893static inline void __netif_tx_lock(struct netdev_queue *txq, int cpu)
+8-1
include/net/icmp.h
···22222323#include <net/inet_sock.h>2424#include <net/snmp.h>2525+#include <net/ip.h>25262627struct icmp_err {2728 int errno;···4039struct sk_buff;4140struct net;42414343-void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info);4242+void __icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info,4343+ const struct ip_options *opt);4444+static inline void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)4545+{4646+ __icmp_send(skb_in, type, code, info, &IPCB(skb_in)->opt);4747+}4848+4449int icmp_rcv(struct sk_buff *skb);4550int icmp_err(struct sk_buff *skb, u32 info);4651int icmp_init(void);
···577577 err = bpf_map_new_fd(map, f_flags);578578 if (err < 0) {579579 /* failed to allocate fd.580580- * bpf_map_put() is needed because the above580580+ * bpf_map_put_with_uref() is needed because the above581581 * bpf_map_alloc_id() has published the map582582 * to the userspace and the userspace may583583 * have refcnt-ed it through BPF_MAP_GET_FD_BY_ID.584584 */585585- bpf_map_put(map);585585+ bpf_map_put_with_uref(map);586586 return err;587587 }588588···2025202520262026 fd = bpf_map_new_fd(map, f_flags);20272027 if (fd < 0)20282028- bpf_map_put(map);20282028+ bpf_map_put_with_uref(map);2029202920302030 return fd;20312031}
+2-1
kernel/bpf/verifier.c
···75597559 u32 off_reg;7560756075617561 aux = &env->insn_aux_data[i + delta];75627562- if (!aux->alu_state)75627562+ if (!aux->alu_state ||75637563+ aux->alu_state == BPF_ALU_NON_POINTER)75637564 continue;7564756575657566 isneg = aux->alu_state & BPF_ALU_NEG_VALUE;
+10-6
net/dsa/dsa2.c
···612612{613613 struct device_node *ports, *port;614614 struct dsa_port *dp;615615+ int err = 0;615616 u32 reg;616616- int err;617617618618 ports = of_get_child_by_name(dn, "ports");619619 if (!ports) {···624624 for_each_available_child_of_node(ports, port) {625625 err = of_property_read_u32(port, "reg", ®);626626 if (err)627627- return err;627627+ goto out_put_node;628628629629- if (reg >= ds->num_ports)630630- return -EINVAL;629629+ if (reg >= ds->num_ports) {630630+ err = -EINVAL;631631+ goto out_put_node;632632+ }631633632634 dp = &ds->ports[reg];633635634636 err = dsa_port_parse_of(dp, port);635637 if (err)636636- return err;638638+ goto out_put_node;637639 }638640639639- return 0;641641+out_put_node:642642+ of_node_put(ports);643643+ return err;640644}641645642646static int dsa_switch_parse_member_of(struct dsa_switch *ds,
···667667 case CIPSO_V4_MAP_PASS:668668 return 0;669669 case CIPSO_V4_MAP_TRANS:670670- if (doi_def->map.std->lvl.cipso[level] < CIPSO_V4_INV_LVL)670670+ if ((level < doi_def->map.std->lvl.cipso_size) &&671671+ (doi_def->map.std->lvl.cipso[level] < CIPSO_V4_INV_LVL))671672 return 0;672673 break;673674 }···17361735 */17371736void cipso_v4_error(struct sk_buff *skb, int error, u32 gateway)17381737{17381738+ unsigned char optbuf[sizeof(struct ip_options) + 40];17391739+ struct ip_options *opt = (struct ip_options *)optbuf;17401740+17391741 if (ip_hdr(skb)->protocol == IPPROTO_ICMP || error != -EACCES)17401742 return;1741174317441744+ /*17451745+ * We might be called above the IP layer,17461746+ * so we can not use icmp_send and IPCB here.17471747+ */17481748+17491749+ memset(opt, 0, sizeof(struct ip_options));17501750+ opt->optlen = ip_hdr(skb)->ihl*4 - sizeof(struct iphdr);17511751+ if (__ip_options_compile(dev_net(skb->dev), opt, skb, NULL))17521752+ return;17531753+17421754 if (gateway)17431743- icmp_send(skb, ICMP_DEST_UNREACH, ICMP_NET_ANO, 0);17551755+ __icmp_send(skb, ICMP_DEST_UNREACH, ICMP_NET_ANO, 0, opt);17441756 else17451745- icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_ANO, 0);17571757+ __icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_ANO, 0, opt);17461758}1747175917481760/**
+4
net/ipv4/fib_frontend.c
···710710 case RTA_GATEWAY:711711 cfg->fc_gw = nla_get_be32(attr);712712 break;713713+ case RTA_VIA:714714+ NL_SET_ERR_MSG(extack, "IPv4 does not support RTA_VIA attribute");715715+ err = -EINVAL;716716+ goto errout;713717 case RTA_PRIORITY:714718 cfg->fc_priority = nla_get_u32(attr);715719 break;
+4-3
net/ipv4/icmp.c
···570570 * MUST reply to only the first fragment.571571 */572572573573-void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)573573+void __icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info,574574+ const struct ip_options *opt)574575{575576 struct iphdr *iph;576577 int room;···692691 iph->tos;693692 mark = IP4_REPLY_MARK(net, skb_in->mark);694693695695- if (ip_options_echo(net, &icmp_param.replyopts.opt.opt, skb_in))694694+ if (__ip_options_echo(net, &icmp_param.replyopts.opt.opt, skb_in, opt))696695 goto out_unlock;697696698697···743742 local_bh_enable();744743out:;745744}746746-EXPORT_SYMBOL(icmp_send);745745+EXPORT_SYMBOL(__icmp_send);747746748747749748static void icmp_socket_deliver(struct sk_buff *skb, u32 info)
+5-4
net/ipv4/ip_input.c
···307307}308308309309static int ip_rcv_finish_core(struct net *net, struct sock *sk,310310- struct sk_buff *skb)310310+ struct sk_buff *skb, struct net_device *dev)311311{312312 const struct iphdr *iph = ip_hdr(skb);313313 int (*edemux)(struct sk_buff *skb);314314- struct net_device *dev = skb->dev;315314 struct rtable *rt;316315 int err;317316···399400400401static int ip_rcv_finish(struct net *net, struct sock *sk, struct sk_buff *skb)401402{403403+ struct net_device *dev = skb->dev;402404 int ret;403405404406 /* if ingress device is enslaved to an L3 master device pass the···409409 if (!skb)410410 return NET_RX_SUCCESS;411411412412- ret = ip_rcv_finish_core(net, sk, skb);412412+ ret = ip_rcv_finish_core(net, sk, skb, dev);413413 if (ret != NET_RX_DROP)414414 ret = dst_input(skb);415415 return ret;···545545546546 INIT_LIST_HEAD(&sublist);547547 list_for_each_entry_safe(skb, next, head, list) {548548+ struct net_device *dev = skb->dev;548549 struct dst_entry *dst;549550550551 skb_list_del_init(skb);···555554 skb = l3mdev_ip_rcv(skb);556555 if (!skb)557556 continue;558558- if (ip_rcv_finish_core(net, sk, skb) == NET_RX_DROP)557557+ if (ip_rcv_finish_core(net, sk, skb, dev) == NET_RX_DROP)559558 continue;560559561560 dst = skb_dst(skb);
+17-5
net/ipv4/ip_options.c
···251251 * If opt == NULL, then skb->data should point to IP header.252252 */253253254254-int ip_options_compile(struct net *net,255255- struct ip_options *opt, struct sk_buff *skb)254254+int __ip_options_compile(struct net *net,255255+ struct ip_options *opt, struct sk_buff *skb,256256+ __be32 *info)256257{257258 __be32 spec_dst = htonl(INADDR_ANY);258259 unsigned char *pp_ptr = NULL;···469468 return 0;470469471470error:472472- if (skb) {473473- icmp_send(skb, ICMP_PARAMETERPROB, 0, htonl((pp_ptr-iph)<<24));474474- }471471+ if (info)472472+ *info = htonl((pp_ptr-iph)<<24);475473 return -EINVAL;474474+}475475+476476+int ip_options_compile(struct net *net,477477+ struct ip_options *opt, struct sk_buff *skb)478478+{479479+ int ret;480480+ __be32 info;481481+482482+ ret = __ip_options_compile(net, opt, skb, &info);483483+ if (ret != 0 && skb)484484+ icmp_send(skb, ICMP_PARAMETERPROB, 0, info);485485+ return ret;476486}477487EXPORT_SYMBOL(ip_options_compile);478488
+14-5
net/ipv4/netlink.c
···33#include <linux/types.h>44#include <net/net_namespace.h>55#include <net/netlink.h>66+#include <linux/in6.h>67#include <net/ip.h>7888-int rtm_getroute_parse_ip_proto(struct nlattr *attr, u8 *ip_proto,99+int rtm_getroute_parse_ip_proto(struct nlattr *attr, u8 *ip_proto, u8 family,910 struct netlink_ext_ack *extack)1011{1112 *ip_proto = nla_get_u8(attr);···1413 switch (*ip_proto) {1514 case IPPROTO_TCP:1615 case IPPROTO_UDP:1717- case IPPROTO_ICMP:1816 return 0;1919- default:2020- NL_SET_ERR_MSG(extack, "Unsupported ip proto");2121- return -EOPNOTSUPP;1717+ case IPPROTO_ICMP:1818+ if (family != AF_INET)1919+ break;2020+ return 0;2121+#if IS_ENABLED(CONFIG_IPV6)2222+ case IPPROTO_ICMPV6:2323+ if (family != AF_INET6)2424+ break;2525+ return 0;2626+#endif2227 }2828+ NL_SET_ERR_MSG(extack, "Unsupported ip proto");2929+ return -EOPNOTSUPP;2330}2431EXPORT_SYMBOL_GPL(rtm_getroute_parse_ip_proto);
···18741874 goto errout;18751875 break;18761876 }18771877+ case RTA_GATEWAY:18781878+ NL_SET_ERR_MSG(extack, "MPLS does not support RTA_GATEWAY attribute");18791879+ goto errout;18771880 case RTA_VIA:18781881 {18791882 if (nla_get_via(nla, &cfg->rc_via_alen,
···189189190190 params_new = kzalloc(sizeof(*params_new), GFP_KERNEL);191191 if (unlikely(!params_new)) {192192- if (ret == ACT_P_CREATED)193193- tcf_idr_release(*a, bind);192192+ tcf_idr_release(*a, bind);194193 return -ENOMEM;195194 }196195
+2-1
net/sched/act_tunnel_key.c
···394394 dst_cache_destroy(&metadata->u.tun_info.dst_cache);395395#endif396396release_tun_meta:397397- dst_release(&metadata->dst);397397+ if (metadata)398398+ dst_release(&metadata->dst);398399399400err_out:400401 if (exists)
+7-3
net/sched/sch_netem.c
···447447 int nb = 0;448448 int count = 1;449449 int rc = NET_XMIT_SUCCESS;450450+ int rc_drop = NET_XMIT_DROP;450451451452 /* Do not fool qdisc_drop_all() */452453 skb->prev = NULL;···487486 q->duplicate = 0;488487 rootq->enqueue(skb2, rootq, to_free);489488 q->duplicate = dupsave;489489+ rc_drop = NET_XMIT_SUCCESS;490490 }491491492492 /*···500498 if (skb_is_gso(skb)) {501499 segs = netem_segment(skb, sch, to_free);502500 if (!segs)503503- return NET_XMIT_DROP;501501+ return rc_drop;504502 } else {505503 segs = skb;506504 }···523521 1<<(prandom_u32() % 8);524522 }525523526526- if (unlikely(sch->q.qlen >= sch->limit))527527- return qdisc_drop_all(skb, sch, to_free);524524+ if (unlikely(sch->q.qlen >= sch->limit)) {525525+ qdisc_drop_all(skb, sch, to_free);526526+ return rc_drop;527527+ }528528529529 qdisc_qstats_backlog_inc(sch, skb);530530
+1-1
net/sctp/chunk.c
···192192 if (unlikely(!max_data)) {193193 max_data = sctp_min_frag_point(sctp_sk(asoc->base.sk),194194 sctp_datachk_len(&asoc->stream));195195- pr_warn_ratelimited("%s: asoc:%p frag_point is zero, forcing max_data to default minimum (%Zu)",195195+ pr_warn_ratelimited("%s: asoc:%p frag_point is zero, forcing max_data to default minimum (%zu)",196196 __func__, asoc, max_data);197197 }198198
+1
net/socket.c
···577577 if (inode)578578 inode_lock(inode);579579 sock->ops->release(sock);580580+ sock->sk = NULL;580581 if (inode)581582 inode_unlock(inode);582583 sock->ops = NULL;
+5-1
net/tipc/socket.c
···379379380380#define tipc_wait_for_cond(sock_, timeo_, condition_) \381381({ \382382+ DEFINE_WAIT_FUNC(wait_, woken_wake_function); \382383 struct sock *sk_; \383384 int rc_; \384385 \385386 while ((rc_ = !(condition_))) { \386386- DEFINE_WAIT_FUNC(wait_, woken_wake_function); \387387+ /* coupled with smp_wmb() in tipc_sk_proto_rcv() */ \388388+ smp_rmb(); \387389 sk_ = (sock_)->sk; \388390 rc_ = tipc_sk_sock_err((sock_), timeo_); \389391 if (rc_) \···19851983 return;19861984 case SOCK_WAKEUP:19871985 tipc_dest_del(&tsk->cong_links, msg_orignode(hdr), 0);19861986+ /* coupled with smp_rmb() in tipc_wait_for_cond() */19871987+ smp_wmb();19881988 tsk->cong_link_cnt--;19891989 wakeup = true;19901990 break;
+80-16
tools/testing/selftests/net/pmtu.sh
···103103# and check that configured MTU is used on link creation and changes, and104104# that MTU is properly calculated instead when MTU is not configured from105105# userspace106106+#107107+# - cleanup_ipv4_exception108108+# Similar to pmtu_ipv4_vxlan4_exception, but explicitly generate PMTU109109+# exceptions on multiple CPUs and check that the veth device tear-down110110+# happens in a timely manner111111+#112112+# - cleanup_ipv6_exception113113+# Same as above, but use IPv6 transport from A to B114114+106115107116# Kselftest framework requirement - SKIP code is 4.108117ksft_skip=4···144135 pmtu_vti6_default_mtu vti6: default MTU assignment145136 pmtu_vti4_link_add_mtu vti4: MTU setting on link creation146137 pmtu_vti6_link_add_mtu vti6: MTU setting on link creation147147- pmtu_vti6_link_change_mtu vti6: MTU changes on link changes"138138+ pmtu_vti6_link_change_mtu vti6: MTU changes on link changes139139+ cleanup_ipv4_exception ipv4: cleanup of cached exceptions140140+ cleanup_ipv6_exception ipv6: cleanup of cached exceptions"148141149142NS_A="ns-$(mktemp -u XXXXXX)"150143NS_B="ns-$(mktemp -u XXXXXX)"···274263275264 ${ns_a} ip link set ${encap}_a up276265 ${ns_b} ip link set ${encap}_b up277277-278278- sleep 1279266}280267281268setup_fou44() {···311302setup_namespaces() {312303 for n in ${NS_A} ${NS_B} ${NS_R1} ${NS_R2}; do313304 ip netns add ${n} || return 1305305+306306+ # Disable DAD, so that we don't have to wait to use the307307+ # configured IPv6 addresses308308+ ip netns exec ${n} sysctl -q net/ipv6/conf/default/accept_dad=0314309 done315310}316311···350337351338 ${ns_a} ip link set vti${proto}_a up352339 ${ns_b} ip link set vti${proto}_b up353353-354354- sleep 1355340}356341357342setup_vti4() {···386375387376 ${ns_a} ip link set ${type}_a up388377 ${ns_b} ip link set ${type}_b up389389-390390- sleep 1391378}392379393380setup_geneve4() {···597588 mtu "${ns_b}" veth_B-R2 1500598589599590 # Create route exceptions600600- ${ns_a} ${ping} -q -M want -i 0.1 -w 2 -s 1800 ${dst1} > /dev/null601601- ${ns_a} ${ping} -q -M want -i 0.1 -w 2 -s 1800 ${dst2} > /dev/null591591+ ${ns_a} ${ping} -q -M want -i 0.1 -w 1 -s 1800 ${dst1} > /dev/null592592+ ${ns_a} ${ping} -q -M want -i 0.1 -w 1 -s 1800 ${dst2} > /dev/null602593603594 # Check that exceptions have been created with the correct PMTU604595 pmtu_1="$(route_get_dst_pmtu_from_exception "${ns_a}" ${dst1})"···630621 # Decrease remote MTU on path via R2, get new exception631622 mtu "${ns_r2}" veth_R2-B 400632623 mtu "${ns_b}" veth_B-R2 400633633- ${ns_a} ${ping} -q -M want -i 0.1 -w 2 -s 1400 ${dst2} > /dev/null624624+ ${ns_a} ${ping} -q -M want -i 0.1 -w 1 -s 1400 ${dst2} > /dev/null634625 pmtu_2="$(route_get_dst_pmtu_from_exception "${ns_a}" ${dst2})"635626 check_pmtu_value "lock 552" "${pmtu_2}" "exceeding MTU, with MTU < min_pmtu" || return 1636627···647638 check_pmtu_value "1500" "${pmtu_2}" "increasing local MTU" || return 1648639649640 # Get new exception650650- ${ns_a} ${ping} -q -M want -i 0.1 -w 2 -s 1400 ${dst2} > /dev/null641641+ ${ns_a} ${ping} -q -M want -i 0.1 -w 1 -s 1400 ${dst2} > /dev/null651642 pmtu_2="$(route_get_dst_pmtu_from_exception "${ns_a}" ${dst2})"652643 check_pmtu_value "lock 552" "${pmtu_2}" "exceeding MTU, with MTU < min_pmtu" || return 1653644}···696687697688 mtu "${ns_a}" ${type}_a $((${ll_mtu} + 1000))698689 mtu "${ns_b}" ${type}_b $((${ll_mtu} + 1000))699699- ${ns_a} ${ping} -q -M want -i 0.1 -w 2 -s $((${ll_mtu} + 500)) ${dst} > /dev/null690690+ ${ns_a} ${ping} -q -M want -i 0.1 -w 1 -s $((${ll_mtu} + 500)) ${dst} > /dev/null700691701692 # Check that exception was created702693 pmtu="$(route_get_dst_pmtu_from_exception "${ns_a}" ${dst})"···776767777768 mtu "${ns_a}" ${encap}_a $((${ll_mtu} + 1000))778769 mtu "${ns_b}" ${encap}_b $((${ll_mtu} + 1000))779779- ${ns_a} ${ping} -q -M want -i 0.1 -w 2 -s $((${ll_mtu} + 500)) ${dst} > /dev/null770770+ ${ns_a} ${ping} -q -M want -i 0.1 -w 1 -s $((${ll_mtu} + 500)) ${dst} > /dev/null780771781772 # Check that exception was created782773 pmtu="$(route_get_dst_pmtu_from_exception "${ns_a}" ${dst})"···834825835826 # Send DF packet without exceeding link layer MTU, check that no836827 # exception is created837837- ${ns_a} ping -q -M want -i 0.1 -w 2 -s ${ping_payload} ${tunnel4_b_addr} > /dev/null828828+ ${ns_a} ping -q -M want -i 0.1 -w 1 -s ${ping_payload} ${tunnel4_b_addr} > /dev/null838829 pmtu="$(route_get_dst_pmtu_from_exception "${ns_a}" ${tunnel4_b_addr})"839830 check_pmtu_value "" "${pmtu}" "sending packet smaller than PMTU (IP payload length ${esp_payload_rfc4106})" || return 1840831841832 # Now exceed link layer MTU by one byte, check that exception is created842833 # with the right PMTU value843843- ${ns_a} ping -q -M want -i 0.1 -w 2 -s $((ping_payload + 1)) ${tunnel4_b_addr} > /dev/null834834+ ${ns_a} ping -q -M want -i 0.1 -w 1 -s $((ping_payload + 1)) ${tunnel4_b_addr} > /dev/null844835 pmtu="$(route_get_dst_pmtu_from_exception "${ns_a}" ${tunnel4_b_addr})"845836 check_pmtu_value "${esp_payload_rfc4106}" "${pmtu}" "exceeding PMTU (IP payload length $((esp_payload_rfc4106 + 1)))"846837}···856847 mtu "${ns_b}" veth_b 4000857848 mtu "${ns_a}" vti6_a 5000858849 mtu "${ns_b}" vti6_b 5000859859- ${ns_a} ${ping6} -q -i 0.1 -w 2 -s 60000 ${tunnel6_b_addr} > /dev/null850850+ ${ns_a} ${ping6} -q -i 0.1 -w 1 -s 60000 ${tunnel6_b_addr} > /dev/null860851861852 # Check that exception was created862853 pmtu="$(route_get_dst_pmtu_from_exception "${ns_a}" ${tunnel6_b_addr})"···10151006 fi1016100710171008 return ${fail}10091009+}10101010+10111011+check_command() {10121012+ cmd=${1}10131013+10141014+ if ! which ${cmd} > /dev/null 2>&1; then10151015+ err " missing required command: '${cmd}'"10161016+ return 110171017+ fi10181018+ return 010191019+}10201020+10211021+test_cleanup_vxlanX_exception() {10221022+ outer="${1}"10231023+ encap="vxlan"10241024+ ll_mtu=400010251025+10261026+ check_command taskset || return 210271027+ cpu_list=$(grep -m 2 processor /proc/cpuinfo | cut -d ' ' -f 2)10281028+10291029+ setup namespaces routing ${encap}${outer} || return 210301030+ trace "${ns_a}" ${encap}_a "${ns_b}" ${encap}_b \10311031+ "${ns_a}" veth_A-R1 "${ns_r1}" veth_R1-A \10321032+ "${ns_b}" veth_B-R1 "${ns_r1}" veth_R1-B10331033+10341034+ # Create route exception by exceeding link layer MTU10351035+ mtu "${ns_a}" veth_A-R1 $((${ll_mtu} + 1000))10361036+ mtu "${ns_r1}" veth_R1-A $((${ll_mtu} + 1000))10371037+ mtu "${ns_b}" veth_B-R1 ${ll_mtu}10381038+ mtu "${ns_r1}" veth_R1-B ${ll_mtu}10391039+10401040+ mtu "${ns_a}" ${encap}_a $((${ll_mtu} + 1000))10411041+ mtu "${ns_b}" ${encap}_b $((${ll_mtu} + 1000))10421042+10431043+ # Fill exception cache for multiple CPUs (2)10441044+ # we can always use inner IPv4 for that10451045+ for cpu in ${cpu_list}; do10461046+ taskset --cpu-list ${cpu} ${ns_a} ping -q -M want -i 0.1 -w 1 -s $((${ll_mtu} + 500)) ${tunnel4_b_addr} > /dev/null10471047+ done10481048+10491049+ ${ns_a} ip link del dev veth_A-R1 &10501050+ iplink_pid=$!10511051+ sleep 110521052+ if [ "$(cat /proc/${iplink_pid}/cmdline 2>/dev/null | tr -d '\0')" = "iplinkdeldevveth_A-R1" ]; then10531053+ err " can't delete veth device in a timely manner, PMTU dst likely leaked"10541054+ return 110551055+ fi10561056+}10571057+10581058+test_cleanup_ipv6_exception() {10591059+ test_cleanup_vxlanX_exception 610601060+}10611061+10621062+test_cleanup_ipv4_exception() {10631063+ test_cleanup_vxlanX_exception 410181064}1019106510201066usage() {