History

Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net

Merge in the fixes we had queued in case there was another -rc.

Jakub Kicinski committed 5 years ago

Commit 8a33dcc2 parents b7b98f8 6b278c019 files · +233 −39Browse files

Unified · Split

19 files
  1. drivers/net/ethernet/amd/xgbe/xgbe-common.h +8 −0
  2. drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +19 −1
  3. drivers/net/ethernet/ibm/ibmvnic.c +12 −9
  4. drivers/net/ethernet/netronome/nfp/nfp_net_common.c +2 −6
  5. drivers/net/phy/phylink.c +1 −1
  6. include/net/flow_dissector.h +1 −0
  7. include/net/sctp/sctp.h +3 −4
  8. net/bridge/br_private.h +2 −0
  9. net/core/flow_dissector.c +15 −0
  10. net/ipv6/udp.c +1 −1
  11. net/sched/cls_flower.c +2 −1
  12. net/sctp/output.c +8 −5
  13. net/sctp/transport.c +6 −5
  14. tools/testing/selftests/net/.gitignore +5 −0
  15. tools/testing/selftests/net/Makefile +2 −0
  16. tools/testing/selftests/net/cmsg_so_mark.c +67 −0
  17. tools/testing/selftests/net/cmsg_so_mark.sh +61 −0
  18. tools/testing/selftests/net/forwarding/bridge_igmp.sh +9 −3
  19. tools/testing/selftests/net/forwarding/bridge_mld.sh +9 −3
drivers/net/ethernet/amd/xgbe/xgbe-common.h+8−0
@@ -1331,6 +1331,10 @@ · 1330 unmodified lines
13311331 #define MDIO_VEND2_PMA_CDR_CONTROL 0x8056
13321332 #endif
13331333
1334+#ifndef MDIO_VEND2_PMA_MISC_CTRL0
1335+#define MDIO_VEND2_PMA_MISC_CTRL0 0x8090
1336+#endif
1337+
13341338 #ifndef MDIO_CTRL1_SPEED1G
13351339 #define MDIO_CTRL1_SPEED1G (MDIO_CTRL1_SPEED10G & ~BMCR_SPEED100)
13361340 #endif
@@ -1389,6 +1393,10 @@ · 52 unmodified lines
13891393 #define XGBE_PMA_RX_RST_0_RESET_ON 0x10
13901394 #define XGBE_PMA_RX_RST_0_RESET_OFF 0x00
13911395
1396+#define XGBE_PMA_PLL_CTRL_MASK BIT(15)
1397+#define XGBE_PMA_PLL_CTRL_ENABLE BIT(15)
1398+#define XGBE_PMA_PLL_CTRL_DISABLE 0x0000
1399+
13921400 /* Bit setting and getting macros
13931401 * The get macro will extract the current bit field value from within
13941402 * the variable
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c+19−1
@@ -1977,12 +1977,26 @@ static void xgbe_phy_rx_reset(struct xgbe_prv_data *pdata) · 1976 unmodified lines
19771977 }
19781978 }
19791979
1980+static void xgbe_phy_pll_ctrl(struct xgbe_prv_data *pdata, bool enable)
1981+{
1982+ XMDIO_WRITE_BITS(pdata, MDIO_MMD_PMAPMD, MDIO_VEND2_PMA_MISC_CTRL0,
1983+ XGBE_PMA_PLL_CTRL_MASK,
1984+ enable ? XGBE_PMA_PLL_CTRL_ENABLE
1985+ : XGBE_PMA_PLL_CTRL_DISABLE);
1986+
1987+ /* Wait for command to complete */
1988+ usleep_range(100, 200);
1989+}
1990+
19801991 static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata,
19811992 unsigned int cmd, unsigned int sub_cmd)
19821993 {
19831994 unsigned int s0 = 0;
19841995 unsigned int wait;
19851996
1997+ /* Disable PLL re-initialization during FW command processing */
1998+ xgbe_phy_pll_ctrl(pdata, false);
1999+
19862000 /* Log if a previous command did not complete */
19872001 if (XP_IOREAD_BITS(pdata, XP_DRIVER_INT_RO, STATUS)) {
19882002 netif_dbg(pdata, link, pdata->netdev,
@@ -2003,7 +2017,7 @@ static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata, · 14 unmodified lines
20032017 wait = XGBE_RATECHANGE_COUNT;
20042018 while (wait--) {
20052019 if (!XP_IOREAD_BITS(pdata, XP_DRIVER_INT_RO, STATUS))
2006− return;
2020+ goto reenable_pll;
20072021
20082022 usleep_range(1000, 2000);
20092023 }
@@ -2013,6 +2027,10 @@ static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata, · 3 unmodified lines
20132027
20142028 /* Reset on error */
20152029 xgbe_phy_rx_reset(pdata);
2030+
2031+reenable_pll:
2032+ /* Enable PLL re-initialization */
2033+ xgbe_phy_pll_ctrl(pdata, true);
20162034 }
20172035
20182036 static void xgbe_phy_rrc(struct xgbe_prv_data *pdata)
drivers/net/ethernet/ibm/ibmvnic.c+12−9
@@ -1914,8 +1914,6 @@ static netdev_tx_t ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev) · 1913 unmodified lines
19141914 ind_bufp = &tx_scrq->ind_buf;
19151915
19161916 if (test_bit(0, &adapter->resetting)) {
1917− if (!netif_subqueue_stopped(netdev, skb))
1918− netif_stop_subqueue(netdev, queue_num);
19191917 dev_kfree_skb_any(skb);
19201918
19211919 tx_send_failed++;
@@ -2757,7 +2755,7 @@ static int ibmvnic_reset(struct ibmvnic_adapter *adapter, · 835 unmodified lines
27572755
27582756 if (adapter->state == VNIC_PROBING) {
27592757 netdev_warn(netdev, "Adapter reset during probe\n");
2760− adapter->init_done_rc = EAGAIN;
2758+ adapter->init_done_rc = -EAGAIN;
27612759 ret = EAGAIN;
27622760 goto err;
27632761 }
@@ -5259,11 +5257,6 @@ static void ibmvnic_handle_crq(union ibmvnic_crq *crq, · 2495 unmodified lines
52595257 */
52605258 adapter->login_pending = false;
52615259
5262− if (!completion_done(&adapter->init_done)) {
5263− complete(&adapter->init_done);
5264− adapter->init_done_rc = -EIO;
5265− }
5266−
52675260 if (adapter->state == VNIC_DOWN)
52685261 rc = ibmvnic_reset(adapter, VNIC_RESET_PASSIVE_INIT);
52695262 else
@@ -5284,6 +5277,13 @@ static void ibmvnic_handle_crq(union ibmvnic_crq *crq, · 14 unmodified lines
52845277 rc);
52855278 adapter->failover_pending = false;
52865279 }
5280+
5281+ if (!completion_done(&adapter->init_done)) {
5282+ complete(&adapter->init_done);
5283+ if (!adapter->init_done_rc)
5284+ adapter->init_done_rc = -EAGAIN;
5285+ }
5286+
52875287 break;
52885288 case IBMVNIC_CRQ_INIT_COMPLETE:
52895289 dev_info(dev, "Partner initialization complete\n");
@@ -5604,6 +5604,9 @@ static int init_crq_queue(struct ibmvnic_adapter *adapter) · 314 unmodified lines
56045604 crq->cur = 0;
56055605 spin_lock_init(&crq->lock);
56065606
5607+ /* process any CRQs that were queued before we enabled interrupts */
5608+ tasklet_schedule(&adapter->tasklet);
5609+
56075610 return retrc;
56085611
56095612 req_irq_failed:
@@ -5753,7 +5756,7 @@ static int ibmvnic_probe(struct vio_dev *dev, const struct vio_device_id *id) · 143 unmodified lines
57535756 }
57545757
57555758 rc = ibmvnic_reset_init(adapter, false);
5756− } while (rc == EAGAIN);
5759+ } while (rc == -EAGAIN);
57575760
57585761 /* We are ignoring the error from ibmvnic_reset_init() assuming that the
57595762 * partner is not ready. CRQ is not active. When the partner becomes
drivers/net/ethernet/netronome/nfp/nfp_net_common.c+2−6
@@ -2067,7 +2067,7 @@ static int nfp_net_poll(struct napi_struct *napi, int budget) · 2066 unmodified lines
20672067 if (napi_complete_done(napi, pkts_polled))
20682068 nfp_net_irq_unmask(r_vec->nfp_net, r_vec->irq_entry);
20692069
2070− if (r_vec->nfp_net->rx_coalesce_adapt_on) {
2070+ if (r_vec->nfp_net->rx_coalesce_adapt_on && r_vec->rx_ring) {
20712071 struct dim_sample dim_sample = {};
20722072 unsigned int start;
20732073 u64 pkts, bytes;
@@ -2082,7 +2082,7 @@ static int nfp_net_poll(struct napi_struct *napi, int budget) · 8 unmodified lines
20822082 net_dim(&r_vec->rx_dim, dim_sample);
20832083 }
20842084
2085− if (r_vec->nfp_net->tx_coalesce_adapt_on) {
2085+ if (r_vec->nfp_net->tx_coalesce_adapt_on && r_vec->tx_ring) {
20862086 struct dim_sample dim_sample = {};
20872087 unsigned int start;
20882088 u64 pkts, bytes;
@@ -3016,10 +3016,8 @@ static void nfp_net_rx_dim_work(struct work_struct *work) · 927 unmodified lines
30163016
30173017 /* copy RX interrupt coalesce parameters */
30183018 value = (moder.pkts << 16) | (factor * moder.usec);
3019− rtnl_lock();
30203019 nn_writel(nn, NFP_NET_CFG_RXR_IRQ_MOD(r_vec->rx_ring->idx), value);
30213020 (void)nfp_net_reconfig(nn, NFP_NET_CFG_UPDATE_IRQMOD);
3022− rtnl_unlock();
30233021
30243022 dim->state = DIM_START_MEASURE;
30253023 }
@@ -3047,10 +3045,8 @@ static void nfp_net_tx_dim_work(struct work_struct *work) · 21 unmodified lines
30473045
30483046 /* copy TX interrupt coalesce parameters */
30493047 value = (moder.pkts << 16) | (factor * moder.usec);
3050− rtnl_lock();
30513048 nn_writel(nn, NFP_NET_CFG_TXR_IRQ_MOD(r_vec->tx_ring->idx), value);
30523049 (void)nfp_net_reconfig(nn, NFP_NET_CFG_UPDATE_IRQMOD);
3053− rtnl_unlock();
30543050
30553051 dim->state = DIM_START_MEASURE;
30563052 }
drivers/net/phy/phylink.c+1−1
@@ -1780,7 +1780,7 @@ int phylink_ethtool_set_pauseparam(struct phylink *pl, · 1779 unmodified lines
17801780 return -EOPNOTSUPP;
17811781
17821782 if (!phylink_test(pl->supported, Asym_Pause) &&
1783− !pause->autoneg && pause->rx_pause != pause->tx_pause)
1783+ pause->rx_pause != pause->tx_pause)
17841784 return -EINVAL;
17851785
17861786 pause_state = 0;
include/net/flow_dissector.h+1−0
@@ -287,6 +287,7 @@ enum flow_dissector_key_id { · 286 unmodified lines
287287 #define FLOW_DISSECTOR_F_PARSE_1ST_FRAG BIT(0)
288288 #define FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL BIT(1)
289289 #define FLOW_DISSECTOR_F_STOP_AT_ENCAP BIT(2)
290+#define FLOW_DISSECTOR_F_STOP_BEFORE_ENCAP BIT(3)
290291
291292 struct flow_dissector_key {
292293 enum flow_dissector_key_id key_id;
include/net/sctp/sctp.h+3−4
@@ -626,7 +626,8 @@ static inline __u32 sctp_min_frag_point(struct sctp_sock *sp, __u16 datasize) · 625 unmodified lines
626626
627627 static inline int sctp_transport_pl_hlen(struct sctp_transport *t)
628628 {
629− return __sctp_mtu_payload(sctp_sk(t->asoc->base.sk), t, 0, 0);
629+ return __sctp_mtu_payload(sctp_sk(t->asoc->base.sk), t, 0, 0) -
630+ sizeof(struct sctphdr);
630631 }
631632
632633 static inline void sctp_transport_pl_reset(struct sctp_transport *t)
@@ -653,12 +654,10 @@ static inline void sctp_transport_pl_update(struct sctp_transport *t) · 20 unmodified lines
653654 if (t->pl.state == SCTP_PL_DISABLED)
654655 return;
655656
656− if (del_timer(&t->probe_timer))
657− sctp_transport_put(t);
658−
659657 t->pl.state = SCTP_PL_BASE;
660658 t->pl.pmtu = SCTP_BASE_PLPMTU;
661659 t->pl.probe_size = SCTP_BASE_PLPMTU;
660+ sctp_transport_reset_probe_timer(t);
662661 }
663662
664663 static inline bool sctp_transport_pl_enabled(struct sctp_transport *t)
net/bridge/br_private.h+2−0
@@ -1893,11 +1893,13 @@ static inline int br_cfm_status_fill_info(struct sk_buff *skb, · 1892 unmodified lines
18931893
18941894 static inline int br_cfm_mep_count(struct net_bridge *br, u32 *count)
18951895 {
1896+ *count = 0;
18961897 return -EOPNOTSUPP;
18971898 }
18981899
18991900 static inline int br_cfm_peer_mep_count(struct net_bridge *br, u32 *count)
19001901 {
1902+ *count = 0;
19011903 return -EOPNOTSUPP;
19021904 }
19031905 #endif
net/core/flow_dissector.c+15−0
@@ -1306,6 +1306,11 @@ ip_proto_again: · 1305 unmodified lines
13061306
13071307 switch (ip_proto) {
13081308 case IPPROTO_GRE:
1309+ if (flags & FLOW_DISSECTOR_F_STOP_BEFORE_ENCAP) {
1310+ fdret = FLOW_DISSECT_RET_OUT_GOOD;
1311+ break;
1312+ }
1313+
13091314 fdret = __skb_flow_dissect_gre(skb, key_control, flow_dissector,
13101315 target_container, data,
13111316 &proto, &nhoff, &hlen, flags);
@@ -1363,6 +1368,11 @@ ip_proto_again: · 51 unmodified lines
13631368 break;
13641369 }
13651370 case IPPROTO_IPIP:
1371+ if (flags & FLOW_DISSECTOR_F_STOP_BEFORE_ENCAP) {
1372+ fdret = FLOW_DISSECT_RET_OUT_GOOD;
1373+ break;
1374+ }
1375+
13661376 proto = htons(ETH_P_IP);
13671377
13681378 key_control->flags |= FLOW_DIS_ENCAPSULATION;
@@ -1375,6 +1385,11 @@ ip_proto_again: · 6 unmodified lines
13751385 break;
13761386
13771387 case IPPROTO_IPV6:
1388+ if (flags & FLOW_DISSECTOR_F_STOP_BEFORE_ENCAP) {
1389+ fdret = FLOW_DISSECT_RET_OUT_GOOD;
1390+ break;
1391+ }
1392+
13781393 proto = htons(ETH_P_IPV6);
13791394
13801395 key_control->flags |= FLOW_DIS_ENCAPSULATION;
net/ipv6/udp.c+1−1
@@ -1435,7 +1435,6 @@ do_udp_sendmsg: · 1434 unmodified lines
14351435 if (!fl6.flowi6_oif)
14361436 fl6.flowi6_oif = np->sticky_pktinfo.ipi6_ifindex;
14371437
1438− fl6.flowi6_mark = ipc6.sockc.mark;
14391438 fl6.flowi6_uid = sk->sk_uid;
14401439
14411440 if (msg->msg_controllen) {
@@ -1471,6 +1470,7 @@ do_udp_sendmsg: · 29 unmodified lines
14711470 ipc6.opt = opt;
14721471
14731472 fl6.flowi6_proto = sk->sk_protocol;
1473+ fl6.flowi6_mark = ipc6.sockc.mark;
14741474 fl6.daddr = *daddr;
14751475 if (ipv6_addr_any(&fl6.saddr) && !ipv6_addr_any(&np->saddr))
14761476 fl6.saddr = np->saddr;
net/sched/cls_flower.c+2−1
@@ -329,7 +329,8 @@ static int fl_classify(struct sk_buff *skb, const struct tcf_proto *tp, · 328 unmodified lines
329329 ARRAY_SIZE(fl_ct_info_to_flower_map),
330330 post_ct);
331331 skb_flow_dissect_hash(skb, &mask->dissector, &skb_key);
332− skb_flow_dissect(skb, &mask->dissector, &skb_key, 0);
332+ skb_flow_dissect(skb, &mask->dissector, &skb_key,
333+ FLOW_DISSECTOR_F_STOP_BEFORE_ENCAP);
333334
334335 f = fl_mask_lookup(mask, &skb_key);
335336 if (f && !tc_skip_sw(f->flags)) {
net/sctp/output.c+8−5
@@ -581,13 +581,16 @@ int sctp_packet_transmit(struct sctp_packet *packet, gfp_t gfp) · 580 unmodified lines
581581 chunk = list_entry(packet->chunk_list.next, struct sctp_chunk, list);
582582 sk = chunk->skb->sk;
583583
584− /* check gso */
585584 if (packet->size > tp->pathmtu && !packet->ipfragok && !chunk->pmtu_probe) {
586− if (!sk_can_gso(sk)) {
587− pr_err_once("Trying to GSO but underlying device doesn't support it.");
588− goto out;
585+ if (tp->pl.state == SCTP_PL_ERROR) { /* do IP fragmentation if in Error state */
586+ packet->ipfragok = 1;
587+ } else {
588+ if (!sk_can_gso(sk)) { /* check gso */
589+ pr_err_once("Trying to GSO but underlying device doesn't support it.");
590+ goto out;
591+ }
592+ gso = 1;
589593 }
590− gso = 1;
591594 }
592595
593596 /* alloc head skb */
net/sctp/transport.c+6−5
@@ -269,7 +269,7 @@ bool sctp_transport_pl_send(struct sctp_transport *t) · 268 unmodified lines
269269 if (t->pl.probe_size == SCTP_BASE_PLPMTU) { /* BASE_PLPMTU Confirmation Failed */
270270 t->pl.state = SCTP_PL_ERROR; /* Base -> Error */
271271
272− t->pl.pmtu = SCTP_MIN_PLPMTU;
272+ t->pl.pmtu = SCTP_BASE_PLPMTU;
273273 t->pathmtu = t->pl.pmtu + sctp_transport_pl_hlen(t);
274274 sctp_assoc_sync_pmtu(t->asoc);
275275 }
@@ -366,8 +366,9 @@ static bool sctp_transport_pl_toobig(struct sctp_transport *t, u32 pmtu) · 90 unmodified lines
366366 if (pmtu >= SCTP_MIN_PLPMTU && pmtu < SCTP_BASE_PLPMTU) {
367367 t->pl.state = SCTP_PL_ERROR; /* Base -> Error */
368368
369− t->pl.pmtu = SCTP_MIN_PLPMTU;
369+ t->pl.pmtu = SCTP_BASE_PLPMTU;
370370 t->pathmtu = t->pl.pmtu + sctp_transport_pl_hlen(t);
371+ return true;
371372 }
372373 } else if (t->pl.state == SCTP_PL_SEARCH) {
373374 if (pmtu >= SCTP_BASE_PLPMTU && pmtu < t->pl.pmtu) {
@@ -378,11 +379,10 @@ static bool sctp_transport_pl_toobig(struct sctp_transport *t, u32 pmtu) · 4 unmodified lines
378379 t->pl.probe_high = 0;
379380 t->pl.pmtu = SCTP_BASE_PLPMTU;
380381 t->pathmtu = t->pl.pmtu + sctp_transport_pl_hlen(t);
382+ return true;
381383 } else if (pmtu > t->pl.pmtu && pmtu < t->pl.probe_size) {
382384 t->pl.probe_size = pmtu;
383385 t->pl.probe_count = 0;
384−
385− return false;
386386 }
387387 } else if (t->pl.state == SCTP_PL_COMPLETE) {
388388 if (pmtu >= SCTP_BASE_PLPMTU && pmtu < t->pl.pmtu) {
@@ -393,10 +393,11 @@ static bool sctp_transport_pl_toobig(struct sctp_transport *t, u32 pmtu) · 4 unmodified lines
393393 t->pl.probe_high = 0;
394394 t->pl.pmtu = SCTP_BASE_PLPMTU;
395395 t->pathmtu = t->pl.pmtu + sctp_transport_pl_hlen(t);
396+ return true;
396397 }
397398 }
398399
399− return true;
400+ return false;
400401 }
401402
402403 bool sctp_transport_update_pmtu(struct sctp_transport *t, u32 pmtu)
tools/testing/selftests/net/.gitignore+5−0
@@ -31,3 +31,8 @@ rxtimestamp · 30 unmodified lines
3131 timestamping
3232 txtimestamp
3333 so_netns_cookie
34+test_unix_oob
35+gro
36+ioam6_parser
37+toeplitz
38+cmsg_so_mark
tools/testing/selftests/net/Makefile+2−0
@@ -29,6 +29,7 @@ TEST_PROGS += veth.sh · 28 unmodified lines
2929 TEST_PROGS += ioam6.sh
3030 TEST_PROGS += gro.sh
3131 TEST_PROGS += gre_gso.sh
32+TEST_PROGS += cmsg_so_mark.sh
3233 TEST_PROGS_EXTENDED := in_netns.sh
3334 TEST_GEN_FILES = socket nettest
3435 TEST_GEN_FILES += psock_fanout psock_tpacket msg_zerocopy reuseport_addr_any
@@ -45,6 +46,7 @@ TEST_GEN_FILES += gro · 10 unmodified lines
4546 TEST_GEN_PROGS = reuseport_bpf reuseport_bpf_cpu reuseport_bpf_numa
4647 TEST_GEN_PROGS += reuseport_dualstack reuseaddr_conflict tls
4748 TEST_GEN_FILES += toeplitz
49+TEST_GEN_FILES += cmsg_so_mark
4850
4951 TEST_FILES := settings
5052
tools/testing/selftests/net/cmsg_so_mark.c+67−0
@@ -0,0 +1,67 @@
1+// SPDX-License-Identifier: GPL-2.0-or-later
2+#include <errno.h>
3+#include <netdb.h>
4+#include <stdio.h>
5+#include <stdlib.h>
6+#include <string.h>
7+#include <unistd.h>
8+#include <linux/types.h>
9+#include <sys/socket.h>
10+
11+int main(int argc, const char **argv)
12+{
13+ char cbuf[CMSG_SPACE(sizeof(__u32))];
14+ struct addrinfo hints, *ai;
15+ struct cmsghdr *cmsg;
16+ struct iovec iov[1];
17+ struct msghdr msg;
18+ int mark;
19+ int err;
20+ int fd;
21+
22+ if (argc != 4) {
23+ fprintf(stderr, "Usage: %s <dst_ip> <port> <mark>\n", argv[0]);
24+ return 1;
25+ }
26+ mark = atoi(argv[3]);
27+
28+ memset(&hints, 0, sizeof(hints));
29+ hints.ai_family = AF_UNSPEC;
30+ hints.ai_socktype = SOCK_DGRAM;
31+
32+ ai = NULL;
33+ err = getaddrinfo(argv[1], argv[2], &hints, &ai);
34+ if (err) {
35+ fprintf(stderr, "Can't resolve address: %s\n", strerror(errno));
36+ return 1;
37+ }
38+
39+ fd = socket(ai->ai_family, SOCK_DGRAM, IPPROTO_UDP);
40+ if (fd < 0) {
41+ fprintf(stderr, "Can't open socket: %s\n", strerror(errno));
42+ freeaddrinfo(ai);
43+ return 1;
44+ }
45+
46+ iov[0].iov_base = "bla";
47+ iov[0].iov_len = 4;
48+
49+ msg.msg_name = ai->ai_addr;
50+ msg.msg_namelen = ai->ai_addrlen;
51+ msg.msg_iov = iov;
52+ msg.msg_iovlen = 1;
53+ msg.msg_control = cbuf;
54+ msg.msg_controllen = sizeof(cbuf);
55+
56+ cmsg = CMSG_FIRSTHDR(&msg);
57+ cmsg->cmsg_level = SOL_SOCKET;
58+ cmsg->cmsg_type = SO_MARK;
59+ cmsg->cmsg_len = CMSG_LEN(sizeof(__u32));
60+ *(__u32 *)CMSG_DATA(cmsg) = mark;
61+
62+ err = sendmsg(fd, &msg, 0);
63+
64+ close(fd);
65+ freeaddrinfo(ai);
66+ return err != 4;
67+}
tools/testing/selftests/net/cmsg_so_mark.sh+61−0
@@ -0,0 +1,61 @@
1+#!/bin/bash
2+# SPDX-License-Identifier: GPL-2.0
3+
4+NS=ns
5+IP4=172.16.0.1/24
6+TGT4=172.16.0.2
7+IP6=2001:db8:1::1/64
8+TGT6=2001:db8:1::2
9+MARK=1000
10+
11+cleanup()
12+{
13+ ip netns del $NS
14+}
15+
16+trap cleanup EXIT
17+
18+# Namespaces
19+ip netns add $NS
20+
21+# Connectivity
22+ip -netns $NS link add type dummy
23+ip -netns $NS link set dev dummy0 up
24+ip -netns $NS addr add $IP4 dev dummy0
25+ip -netns $NS addr add $IP6 dev dummy0
26+
27+ip -netns $NS rule add fwmark $MARK lookup 300
28+ip -6 -netns $NS rule add fwmark $MARK lookup 300
29+ip -netns $NS route add prohibit any table 300
30+ip -6 -netns $NS route add prohibit any table 300
31+
32+# Test
33+BAD=0
34+TOTAL=0
35+
36+check_result() {
37+ ((TOTAL++))
38+ if [ $1 -ne $2 ]; then
39+ echo " Case $3 returned $1, expected $2"
40+ ((BAD++))
41+ fi
42+}
43+
44+ip netns exec $NS ./cmsg_so_mark $TGT4 1234 $((MARK + 1))
45+check_result $? 0 "IPv4 pass"
46+ip netns exec $NS ./cmsg_so_mark $TGT6 1234 $((MARK + 1))
47+check_result $? 0 "IPv6 pass"
48+
49+ip netns exec $NS ./cmsg_so_mark $TGT4 1234 $MARK
50+check_result $? 1 "IPv4 rejection"
51+ip netns exec $NS ./cmsg_so_mark $TGT6 1234 $MARK
52+check_result $? 1 "IPv6 rejection"
53+
54+# Summary
55+if [ $BAD -ne 0 ]; then
56+ echo "FAIL - $BAD/$TOTAL cases failed"
57+ exit 1
58+else
59+ echo "OK"
60+ exit 0
61+fi
tools/testing/selftests/net/forwarding/bridge_igmp.sh+9−3
@@ -482,10 +482,15 @@ v3exc_timeout_test() · 481 unmodified lines
482482 local X=("192.0.2.20" "192.0.2.30")
483483
484484 # GMI should be 3 seconds
485− ip link set dev br0 type bridge mcast_query_interval 100 mcast_query_response_interval 100
485+ ip link set dev br0 type bridge mcast_query_interval 100 \
486+ mcast_query_response_interval 100 \
487+ mcast_membership_interval 300
486488
487489 v3exclude_prepare $h1 $ALL_MAC $ALL_GROUP
488− ip link set dev br0 type bridge mcast_query_interval 500 mcast_query_response_interval 500
490+ ip link set dev br0 type bridge mcast_query_interval 500 \
491+ mcast_query_response_interval 500 \
492+ mcast_membership_interval 1500
493+
489494 $MZ $h1 -c 1 -b $ALL_MAC -B $ALL_GROUP -t ip "proto=2,p=$MZPKT_ALLOW2" -q
490495 sleep 3
491496 bridge -j -d -s mdb show dev br0 \
@@ -517,7 +522,8 @@ v3exc_timeout_test() · 25 unmodified lines
517522 log_test "IGMPv3 group $TEST_GROUP exclude timeout"
518523
519524 ip link set dev br0 type bridge mcast_query_interval 12500 \
520− mcast_query_response_interval 1000
525+ mcast_query_response_interval 1000 \
526+ mcast_membership_interval 26000
521527
522528 v3cleanup $swp1 $TEST_GROUP
523529 }
tools/testing/selftests/net/forwarding/bridge_mld.sh+9−3
@@ -479,10 +479,15 @@ mldv2exc_timeout_test() · 478 unmodified lines
479479 local X=("2001:db8:1::20" "2001:db8:1::30")
480480
481481 # GMI should be 3 seconds
482− ip link set dev br0 type bridge mcast_query_interval 100 mcast_query_response_interval 100
482+ ip link set dev br0 type bridge mcast_query_interval 100 \
483+ mcast_query_response_interval 100 \
484+ mcast_membership_interval 300
483485
484486 mldv2exclude_prepare $h1
485− ip link set dev br0 type bridge mcast_query_interval 500 mcast_query_response_interval 500
487+ ip link set dev br0 type bridge mcast_query_interval 500 \
488+ mcast_query_response_interval 500 \
489+ mcast_membership_interval 1500
490+
486491 $MZ $h1 -c 1 $MZPKT_ALLOW2 -q
487492 sleep 3
488493 bridge -j -d -s mdb show dev br0 \
@@ -514,7 +519,8 @@ mldv2exc_timeout_test() · 25 unmodified lines
514519 log_test "MLDv2 group $TEST_GROUP exclude timeout"
515520
516521 ip link set dev br0 type bridge mcast_query_interval 12500 \
517− mcast_query_response_interval 1000
522+ mcast_query_response_interval 1000 \
523+ mcast_membership_interval 26000
518524
519525 mldv2cleanup $swp1
520526 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t