Pull networking fixes from Jakub Kicinski: "Including fixes from wireless. No known regressions at this point. Current release - fix to a fix: - eth: Revert "net/mlx5e: Update and set Xon/Xoff upon port speed set" - wifi: iwlwifi: pcie: fix byte count table for 7000/8000 devices - net: clear sk->sk_ino in sk_set_socket(sk, NULL), fix CRIU Previous releases - regressions: - bonding: set random address only when slaves already exist - rxrpc: fix untrusted unsigned subtract - eth: - ice: fix Rx page leak on multi-buffer frames - mlx5: don't return mlx5_link_info table when speed is unknown Previous releases - always broken: - tls: make sure to abort the stream if headers are bogus - tcp: fix null-deref when using TCP-AO with TCP_REPAIR - dpll: fix skipping last entry in clock quality level reporting - eth: qed: don't collect too many protection override GRC elements, fix memory corruption" * tag 'net-6.17-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (51 commits) octeontx2-pf: Fix use-after-free bugs in otx2_sync_tstamp() cnic: Fix use-after-free bugs in cnic_delete_task devlink rate: Remove unnecessary 'static' from a couple places MAINTAINERS: update sundance entry net: liquidio: fix overflow in octeon_init_instr_queue() net: clear sk->sk_ino in sk_set_socket(sk, NULL) Revert "net/mlx5e: Update and set Xon/Xoff upon port speed set" selftests: tls: test skb copy under mem pressure and OOB tls: make sure to abort the stream if headers are bogus selftest: packetdrill: Add tcp_fastopen_server_reset-after-disconnect.pkt. tcp: Clear tcp_sk(sk)->fastopen_rsk in tcp_disconnect(). octeon_ep: fix VF MAC address lifecycle handling selftests: bonding: add vlan over bond testing bonding: don't set oif to bond dev when getting NS target destination net: rfkill: gpio: Fix crash due to dereferencering uninitialized pointer net/mlx5e: Add a miss level for ipsec crypto offload net/mlx5e: Harden uplink netdev access against device unbind MAINTAINERS: make the DPLL entry cover drivers doc/netlink: Fix typos in operation attributes igc: don't fail igc_probe() on LED setup error ...
Unified · Split
| @@ -575,8 +575,8 @@ operations: · 574 unmodified lines | ||
| 575 | 575 | - nat-dst |
| 576 | 576 | - timeout |
| 577 | 577 | - mark |
| 578 | − - counter-orig | |
| 579 | − - counter-reply | |
| 578 | + - counters-orig | |
| 579 | + - counters-reply | |
| 580 | 580 | - use |
| 581 | 581 | - id |
| 582 | 582 | - nat-dst |
| @@ -591,7 +591,6 @@ operations: · 8 unmodified lines | ||
| 591 | 591 | request: |
| 592 | 592 | value: 0x101 |
| 593 | 593 | attributes: |
| 594 | − - nfgen-family | |
| 595 | 594 | - mark |
| 596 | 595 | - filter |
| 597 | 596 | - status |
| @@ -608,8 +607,8 @@ operations: · 10 unmodified lines | ||
| 608 | 607 | - nat-dst |
| 609 | 608 | - timeout |
| 610 | 609 | - mark |
| 611 | − - counter-orig | |
| 612 | − - counter-reply | |
| 610 | + - counters-orig | |
| 611 | + - counters-reply | |
| 613 | 612 | - use |
| 614 | 613 | - id |
| 615 | 614 | - nat-dst |
| @@ -28,13 +28,13 @@ definitions: · 27 unmodified lines | ||
| 28 | 28 | traffic-patterns it can take a long time until the |
| 29 | 29 | MPTCP_EVENT_ESTABLISHED is sent. |
| 30 | 30 | Attributes: token, family, saddr4 | saddr6, daddr4 | daddr6, sport, |
| 31 | − dport, server-side. | |
| 31 | + dport, server-side, [flags]. | |
| 32 | 32 | - |
| 33 | 33 | name: established |
| 34 | 34 | doc: >- |
| 35 | 35 | A MPTCP connection is established (can start new subflows). |
| 36 | 36 | Attributes: token, family, saddr4 | saddr6, daddr4 | daddr6, sport, |
| 37 | − dport, server-side. | |
| 37 | + dport, server-side, [flags]. | |
| 38 | 38 | - |
| 39 | 39 | name: closed |
| 40 | 40 | doc: >- |
| @@ -7430,7 +7430,7 @@ S: Supported · 7429 unmodified lines | ||
| 7430 | 7430 | F: Documentation/devicetree/bindings/dpll/dpll-device.yaml |
| 7431 | 7431 | F: Documentation/devicetree/bindings/dpll/dpll-pin.yaml |
| 7432 | 7432 | F: Documentation/driver-api/dpll.rst |
| 7433 | −F: drivers/dpll/* | |
| 7433 | +F: drivers/dpll/ | |
| 7434 | 7434 | F: include/linux/dpll.h |
| 7435 | 7435 | F: include/uapi/linux/dpll.h |
| 7436 | 7436 | |
| @@ -24259,7 +24259,7 @@ F: Documentation/devicetree/bindings/input/allwinner,sun4i-a10-lradc-keys.yaml · 16822 unmodified lines | ||
| 24259 | 24259 | F: drivers/input/keyboard/sun4i-lradc-keys.c |
| 24260 | 24260 | |
| 24261 | 24261 | SUNDANCE NETWORK DRIVER |
| 24262 | −M: Denis Kirjanov <dkirjanov@suse.de> | |
| 24262 | +M: Denis Kirjanov <kirjanov@gmail.com> | |
| 24263 | 24263 | L: netdev@vger.kernel.org |
| 24264 | 24264 | S: Maintained |
| 24265 | 24265 | F: drivers/net/ethernet/dlink/sundance.c |
| @@ -211,8 +211,8 @@ static int · 210 unmodified lines | ||
| 211 | 211 | dpll_msg_add_clock_quality_level(struct sk_buff *msg, struct dpll_device *dpll, |
| 212 | 212 | struct netlink_ext_ack *extack) |
| 213 | 213 | { |
| 214 | + DECLARE_BITMAP(qls, DPLL_CLOCK_QUALITY_LEVEL_MAX + 1) = { 0 }; | |
| 214 | 215 | const struct dpll_device_ops *ops = dpll_device_ops(dpll); |
| 215 | − DECLARE_BITMAP(qls, DPLL_CLOCK_QUALITY_LEVEL_MAX) = { 0 }; | |
| 216 | 216 | enum dpll_clock_quality_level ql; |
| 217 | 217 | int ret; |
| 218 | 218 | |
| @@ -221,7 +221,7 @@ dpll_msg_add_clock_quality_level(struct sk_buff *msg, struct dpll_device *dpll, · 2 unmodified lines | ||
| 221 | 221 | ret = ops->clock_quality_level_get(dpll, dpll_priv(dpll), qls, extack); |
| 222 | 222 | if (ret) |
| 223 | 223 | return ret; |
| 224 | − for_each_set_bit(ql, qls, DPLL_CLOCK_QUALITY_LEVEL_MAX) | |
| 224 | + for_each_set_bit(ql, qls, DPLL_CLOCK_QUALITY_LEVEL_MAX + 1) | |
| 225 | 225 | if (nla_put_u32(msg, DPLL_A_CLOCK_QUALITY_LEVEL, ql)) |
| 226 | 226 | return -EMSGSIZE; |
| 227 | 227 | |
| @@ -2132,6 +2132,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev, · 2131 unmodified lines | ||
| 2132 | 2132 | memcpy(ss.__data, bond_dev->dev_addr, bond_dev->addr_len); |
| 2133 | 2133 | } else if (bond->params.fail_over_mac == BOND_FOM_FOLLOW && |
| 2134 | 2134 | BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP && |
| 2135 | + bond_has_slaves(bond) && | |
| 2135 | 2136 | memcmp(slave_dev->dev_addr, bond_dev->dev_addr, bond_dev->addr_len) == 0) { |
| 2136 | 2137 | /* Set slave to random address to avoid duplicate mac |
| 2137 | 2138 | * address in later fail over. |
| @@ -3355,7 +3356,6 @@ static void bond_ns_send_all(struct bonding *bond, struct slave *slave) · 1217 unmodified lines | ||
| 3355 | 3356 | /* Find out through which dev should the packet go */ |
| 3356 | 3357 | memset(&fl6, 0, sizeof(struct flowi6)); |
| 3357 | 3358 | fl6.daddr = targets[i]; |
| 3358 | − fl6.flowi6_oif = bond->dev->ifindex; | |
| 3359 | 3359 | |
| 3360 | 3360 | dst = ip6_route_output(dev_net(bond->dev), NULL, &fl6); |
| 3361 | 3361 | if (dst->error) { |
| @@ -4230,8 +4230,7 @@ static void cnic_cm_stop_bnx2x_hw(struct cnic_dev *dev) · 4229 unmodified lines | ||
| 4230 | 4230 | |
| 4231 | 4231 | cnic_bnx2x_delete_wait(dev, 0); |
| 4232 | 4232 | |
| 4233 | − cancel_delayed_work(&cp->delete_task); | |
| 4234 | − flush_workqueue(cnic_wq); | |
| 4233 | + cancel_delayed_work_sync(&cp->delete_task); | |
| 4235 | 4234 | |
| 4236 | 4235 | if (atomic_read(&cp->iscsi_conn) != 0) |
| 4237 | 4236 | netdev_warn(dev->netdev, "%d iSCSI connections not destroyed\n", |
| @@ -126,7 +126,7 @@ int octeon_init_instr_queue(struct octeon_device *oct, · 125 unmodified lines | ||
| 126 | 126 | oct->io_qmask.iq |= BIT_ULL(iq_no); |
| 127 | 127 | |
| 128 | 128 | /* Set the 32B/64B mode for each input queue */ |
| 129 | − oct->io_qmask.iq64B |= ((conf->instr_type == 64) << iq_no); | |
| 129 | + oct->io_qmask.iq64B |= ((u64)(conf->instr_type == 64) << iq_no); | |
| 130 | 130 | iq->iqcmd_64B = (conf->instr_type == 64); |
| 131 | 131 | |
| 132 | 132 | oct->fn_list.setup_iq_regs(oct, iq_no); |
| @@ -2736,7 +2736,7 @@ static int dpaa2_switch_setup_dpbp(struct ethsw_core *ethsw) · 2735 unmodified lines | ||
| 2736 | 2736 | dev_err(dev, "dpsw_ctrl_if_set_pools() failed\n"); |
| 2737 | 2737 | goto err_get_attr; |
| 2738 | 2738 | } |
| 2739 | − ethsw->bpid = dpbp_attrs.id; | |
| 2739 | + ethsw->bpid = dpbp_attrs.bpid; | |
| 2740 | 2740 | |
| 2741 | 2741 | return 0; |
| 2742 | 2742 | |
| @@ -948,9 +948,6 @@ static bool i40e_clean_tx_irq(struct i40e_vsi *vsi, · 947 unmodified lines | ||
| 948 | 948 | if (!eop_desc) |
| 949 | 949 | break; |
| 950 | 950 | |
| 951 | − /* prevent any other reads prior to eop_desc */ | |
| 952 | − smp_rmb(); | |
| 953 | − | |
| 954 | 951 | i40e_trace(clean_tx_irq, tx_ring, tx_desc, tx_buf); |
| 955 | 952 | /* we have caught up to head, no work left to do */ |
| 956 | 953 | if (tx_head == tx_desc) |
| @@ -894,10 +894,6 @@ ice_add_xdp_frag(struct ice_rx_ring *rx_ring, struct xdp_buff *xdp, · 893 unmodified lines | ||
| 894 | 894 | __skb_fill_page_desc_noacc(sinfo, sinfo->nr_frags++, rx_buf->page, |
| 895 | 895 | rx_buf->page_offset, size); |
| 896 | 896 | sinfo->xdp_frags_size += size; |
| 897 | − /* remember frag count before XDP prog execution; bpf_xdp_adjust_tail() | |
| 898 | − * can pop off frags but driver has to handle it on its own | |
| 899 | − */ | |
| 900 | − rx_ring->nr_frags = sinfo->nr_frags; | |
| 901 | 897 | |
| 902 | 898 | if (page_is_pfmemalloc(rx_buf->page)) |
| 903 | 899 | xdp_buff_set_frag_pfmemalloc(xdp); |
| @@ -968,20 +964,20 @@ ice_get_rx_buf(struct ice_rx_ring *rx_ring, const unsigned int size, · 64 unmodified lines | ||
| 968 | 964 | /** |
| 969 | 965 | * ice_get_pgcnts - grab page_count() for gathered fragments |
| 970 | 966 | * @rx_ring: Rx descriptor ring to store the page counts on |
| 967 | + * @ntc: the next to clean element (not included in this frame!) | |
| 971 | 968 | * |
| 972 | 969 | * This function is intended to be called right before running XDP |
| 973 | 970 | * program so that the page recycling mechanism will be able to take |
| 974 | 971 | * a correct decision regarding underlying pages; this is done in such |
| 975 | 972 | * way as XDP program can change the refcount of page |
| 976 | 973 | */ |
| 977 | −static void ice_get_pgcnts(struct ice_rx_ring *rx_ring) | |
| 974 | +static void ice_get_pgcnts(struct ice_rx_ring *rx_ring, unsigned int ntc) | |
| 978 | 975 | { |
| 979 | − u32 nr_frags = rx_ring->nr_frags + 1; | |
| 980 | 976 | u32 idx = rx_ring->first_desc; |
| 981 | 977 | struct ice_rx_buf *rx_buf; |
| 982 | 978 | u32 cnt = rx_ring->count; |
| 983 | 979 | |
| 984 | − for (int i = 0; i < nr_frags; i++) { | |
| 980 | + while (idx != ntc) { | |
| 985 | 981 | rx_buf = &rx_ring->rx_buf[idx]; |
| 986 | 982 | rx_buf->pgcnt = page_count(rx_buf->page); |
| 987 | 983 | |
| @@ -1154,62 +1150,51 @@ ice_put_rx_buf(struct ice_rx_ring *rx_ring, struct ice_rx_buf *rx_buf) · 166 unmodified lines | ||
| 1154 | 1150 | } |
| 1155 | 1151 | |
| 1156 | 1152 | /** |
| 1157 | − * ice_put_rx_mbuf - ice_put_rx_buf() caller, for all frame frags | |
| 1153 | + * ice_put_rx_mbuf - ice_put_rx_buf() caller, for all buffers in frame | |
| 1158 | 1154 | * @rx_ring: Rx ring with all the auxiliary data |
| 1159 | 1155 | * @xdp: XDP buffer carrying linear + frags part |
| 1160 | − * @xdp_xmit: XDP_TX/XDP_REDIRECT verdict storage | |
| 1161 | − * @ntc: a current next_to_clean value to be stored at rx_ring | |
| 1156 | + * @ntc: the next to clean element (not included in this frame!) | |
| 1162 | 1157 | * @verdict: return code from XDP program execution |
| 1163 | 1158 | * |
| 1164 | − * Walk through gathered fragments and satisfy internal page | |
| 1165 | − * recycle mechanism; we take here an action related to verdict | |
| 1166 | − * returned by XDP program; | |
| 1159 | + * Called after XDP program is completed, or on error with verdict set to | |
| 1160 | + * ICE_XDP_CONSUMED. | |
| 1161 | + * | |
| 1162 | + * Walk through buffers from first_desc to the end of the frame, releasing | |
| 1163 | + * buffers and satisfying internal page recycle mechanism. The action depends | |
| 1164 | + * on verdict from XDP program. | |
| 1167 | 1165 | */ |
| 1168 | 1166 | static void ice_put_rx_mbuf(struct ice_rx_ring *rx_ring, struct xdp_buff *xdp, |
| 1169 | − u32 *xdp_xmit, u32 ntc, u32 verdict) | |
| 1167 | + u32 ntc, u32 verdict) | |
| 1170 | 1168 | { |
| 1171 | − u32 nr_frags = rx_ring->nr_frags + 1; | |
| 1172 | 1169 | u32 idx = rx_ring->first_desc; |
| 1173 | 1170 | u32 cnt = rx_ring->count; |
| 1174 | − u32 post_xdp_frags = 1; | |
| 1175 | 1171 | struct ice_rx_buf *buf; |
| 1176 | − int i; | |
| 1172 | + u32 xdp_frags = 0; | |
| 1173 | + int i = 0; | |
| 1177 | 1174 | |
| 1178 | 1175 | if (unlikely(xdp_buff_has_frags(xdp))) |
| 1179 | − post_xdp_frags += xdp_get_shared_info_from_buff(xdp)->nr_frags; | |
| 1176 | + xdp_frags = xdp_get_shared_info_from_buff(xdp)->nr_frags; | |
| 1180 | 1177 | |
| 1181 | − for (i = 0; i < post_xdp_frags; i++) { | |
| 1178 | + while (idx != ntc) { | |
| 1182 | 1179 | buf = &rx_ring->rx_buf[idx]; |
| 1180 | + if (++idx == cnt) | |
| 1181 | + idx = 0; | |
| 1183 | 1182 | |
| 1184 | − if (verdict & (ICE_XDP_TX | ICE_XDP_REDIR)) { | |
| 1183 | + /* An XDP program could release fragments from the end of the | |
| 1184 | + * buffer. For these, we need to keep the pagecnt_bias as-is. | |
| 1185 | + * To do this, only adjust pagecnt_bias for fragments up to | |
| 1186 | + * the total remaining after the XDP program has run. | |
| 1187 | + */ | |
| 1188 | + if (verdict != ICE_XDP_CONSUMED) | |
| 1185 | 1189 | ice_rx_buf_adjust_pg_offset(buf, xdp->frame_sz); |
| 1186 | − *xdp_xmit |= verdict; | |
| 1187 | − } else if (verdict & ICE_XDP_CONSUMED) { | |
| 1190 | + else if (i++ <= xdp_frags) | |
| 1188 | 1191 | buf->pagecnt_bias++; |
| 1189 | − } else if (verdict == ICE_XDP_PASS) { | |
| 1190 | − ice_rx_buf_adjust_pg_offset(buf, xdp->frame_sz); | |
| 1191 | − } | |
| 1192 | 1192 | |
| 1193 | 1193 | ice_put_rx_buf(rx_ring, buf); |
| 1194 | − | |
| 1195 | − if (++idx == cnt) | |
| 1196 | − idx = 0; | |
| 1197 | − } | |
| 1198 | − /* handle buffers that represented frags released by XDP prog; | |
| 1199 | − * for these we keep pagecnt_bias as-is; refcount from struct page | |
| 1200 | − * has been decremented within XDP prog and we do not have to increase | |
| 1201 | − * the biased refcnt | |
| 1202 | − */ | |
| 1203 | − for (; i < nr_frags; i++) { | |
| 1204 | − buf = &rx_ring->rx_buf[idx]; | |
| 1205 | − ice_put_rx_buf(rx_ring, buf); | |
| 1206 | − if (++idx == cnt) | |
| 1207 | − idx = 0; | |
| 1208 | 1194 | } |
| 1209 | 1195 | |
| 1210 | 1196 | xdp->data = NULL; |
| 1211 | 1197 | rx_ring->first_desc = ntc; |
| 1212 | − rx_ring->nr_frags = 0; | |
| 1213 | 1198 | } |
| 1214 | 1199 | |
| 1215 | 1200 | /** |
| @@ -1317,6 +1302,10 @@ static int ice_clean_rx_irq(struct ice_rx_ring *rx_ring, int budget) · 101 unmodified lines | ||
| 1317 | 1302 | /* retrieve a buffer from the ring */ |
| 1318 | 1303 | rx_buf = ice_get_rx_buf(rx_ring, size, ntc); |
| 1319 | 1304 | |
| 1305 | + /* Increment ntc before calls to ice_put_rx_mbuf() */ | |
| 1306 | + if (++ntc == cnt) | |
| 1307 | + ntc = 0; | |
| 1308 | + | |
| 1320 | 1309 | if (!xdp->data) { |
| 1321 | 1310 | void *hard_start; |
| 1322 | 1311 | |
| @@ -1325,24 +1314,23 @@ static int ice_clean_rx_irq(struct ice_rx_ring *rx_ring, int budget) · 2 unmodified lines | ||
| 1325 | 1314 | xdp_prepare_buff(xdp, hard_start, offset, size, !!offset); |
| 1326 | 1315 | xdp_buff_clear_frags_flag(xdp); |
| 1327 | 1316 | } else if (ice_add_xdp_frag(rx_ring, xdp, rx_buf, size)) { |
| 1328 | − ice_put_rx_mbuf(rx_ring, xdp, NULL, ntc, ICE_XDP_CONSUMED); | |
| 1317 | + ice_put_rx_mbuf(rx_ring, xdp, ntc, ICE_XDP_CONSUMED); | |
| 1329 | 1318 | break; |
| 1330 | 1319 | } |
| 1331 | − if (++ntc == cnt) | |
| 1332 | − ntc = 0; | |
| 1333 | 1320 | |
| 1334 | 1321 | /* skip if it is NOP desc */ |
| 1335 | 1322 | if (ice_is_non_eop(rx_ring, rx_desc)) |
| 1336 | 1323 | continue; |
| 1337 | 1324 | |
| 1338 | − ice_get_pgcnts(rx_ring); | |
| 1325 | + ice_get_pgcnts(rx_ring, ntc); | |
| 1339 | 1326 | xdp_verdict = ice_run_xdp(rx_ring, xdp, xdp_prog, xdp_ring, rx_desc); |
| 1340 | 1327 | if (xdp_verdict == ICE_XDP_PASS) |
| 1341 | 1328 | goto construct_skb; |
| 1342 | 1329 | total_rx_bytes += xdp_get_buff_len(xdp); |
| 1343 | 1330 | total_rx_pkts++; |
| 1344 | 1331 | |
| 1345 | − ice_put_rx_mbuf(rx_ring, xdp, &xdp_xmit, ntc, xdp_verdict); | |
| 1332 | + ice_put_rx_mbuf(rx_ring, xdp, ntc, xdp_verdict); | |
| 1333 | + xdp_xmit |= xdp_verdict & (ICE_XDP_TX | ICE_XDP_REDIR); | |
| 1346 | 1334 | |
| 1347 | 1335 | continue; |
| 1348 | 1336 | construct_skb: |
| @@ -1355,7 +1343,7 @@ construct_skb: · 6 unmodified lines | ||
| 1355 | 1343 | rx_ring->ring_stats->rx_stats.alloc_buf_failed++; |
| 1356 | 1344 | xdp_verdict = ICE_XDP_CONSUMED; |
| 1357 | 1345 | } |
| 1358 | − ice_put_rx_mbuf(rx_ring, xdp, &xdp_xmit, ntc, xdp_verdict); | |
| 1346 | + ice_put_rx_mbuf(rx_ring, xdp, ntc, xdp_verdict); | |
| 1359 | 1347 | |
| 1360 | 1348 | if (!skb) |
| 1361 | 1349 | break; |
| @@ -358,7 +358,6 @@ struct ice_rx_ring { · 357 unmodified lines | ||
| 358 | 358 | struct ice_tx_ring *xdp_ring; |
| 359 | 359 | struct ice_rx_ring *next; /* pointer to next ring in q_vector */ |
| 360 | 360 | struct xsk_buff_pool *xsk_pool; |
| 361 | − u32 nr_frags; | |
| 362 | 361 | u16 max_frame; |
| 363 | 362 | u16 rx_buf_len; |
| 364 | 363 | dma_addr_t dma; /* physical address of ring */ |
| @@ -345,6 +345,7 @@ struct igc_adapter { · 344 unmodified lines | ||
| 345 | 345 | /* LEDs */ |
| 346 | 346 | struct mutex led_mutex; |
| 347 | 347 | struct igc_led_classdev *leds; |
| 348 | + bool leds_available; | |
| 348 | 349 | }; |
| 349 | 350 | |
| 350 | 351 | void igc_up(struct igc_adapter *adapter); |
| @@ -7335,8 +7335,14 @@ static int igc_probe(struct pci_dev *pdev, · 7334 unmodified lines | ||
| 7335 | 7335 | |
| 7336 | 7336 | if (IS_ENABLED(CONFIG_IGC_LEDS)) { |
| 7337 | 7337 | err = igc_led_setup(adapter); |
| 7338 | − if (err) | |
| 7339 | − goto err_register; | |
| 7338 | + if (err) { | |
| 7339 | + netdev_warn_once(netdev, | |
| 7340 | + "LED init failed (%d); continuing without LED support\n", | |
| 7341 | + err); | |
| 7342 | + adapter->leds_available = false; | |
| 7343 | + } else { | |
| 7344 | + adapter->leds_available = true; | |
| 7345 | + } | |
| 7340 | 7346 | } |
| 7341 | 7347 | |
| 7342 | 7348 | return 0; |
| @@ -7392,7 +7398,7 @@ static void igc_remove(struct pci_dev *pdev) · 49 unmodified lines | ||
| 7392 | 7398 | cancel_work_sync(&adapter->watchdog_task); |
| 7393 | 7399 | hrtimer_cancel(&adapter->hrtimer); |
| 7394 | 7400 | |
| 7395 | − if (IS_ENABLED(CONFIG_IGC_LEDS)) | |
| 7401 | + if (IS_ENABLED(CONFIG_IGC_LEDS) && adapter->leds_available) | |
| 7396 | 7402 | igc_led_free(adapter); |
| 7397 | 7403 | |
| 7398 | 7404 | /* Release control of h/w to f/w. If f/w is AMT enabled, this |
| @@ -6973,6 +6973,13 @@ static int ixgbe_sw_init(struct ixgbe_adapter *adapter, · 6972 unmodified lines | ||
| 6973 | 6973 | break; |
| 6974 | 6974 | } |
| 6975 | 6975 | |
| 6976 | + /* Make sure the SWFW semaphore is in a valid state */ | |
| 6977 | + if (hw->mac.ops.init_swfw_sync) | |
| 6978 | + hw->mac.ops.init_swfw_sync(hw); | |
| 6979 | + | |
| 6980 | + if (hw->mac.type == ixgbe_mac_e610) | |
| 6981 | + mutex_init(&hw->aci.lock); | |
| 6982 | + | |
| 6976 | 6983 | #ifdef IXGBE_FCOE |
| 6977 | 6984 | /* FCoE support exists, always init the FCoE lock */ |
| 6978 | 6985 | spin_lock_init(&adapter->fcoe.lock); |
| @@ -11643,10 +11650,6 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 4664 unmodified lines | ||
| 11643 | 11650 | if (err) |
| 11644 | 11651 | goto err_sw_init; |
| 11645 | 11652 | |
| 11646 | − /* Make sure the SWFW semaphore is in a valid state */ | |
| 11647 | − if (hw->mac.ops.init_swfw_sync) | |
| 11648 | − hw->mac.ops.init_swfw_sync(hw); | |
| 11649 | − | |
| 11650 | 11653 | if (ixgbe_check_fw_error(adapter)) |
| 11651 | 11654 | return ixgbe_recovery_probe(adapter); |
| 11652 | 11655 | |
| @@ -11850,8 +11853,6 @@ skip_sriov: · 197 unmodified lines | ||
| 11850 | 11853 | ether_addr_copy(hw->mac.addr, hw->mac.perm_addr); |
| 11851 | 11854 | ixgbe_mac_set_default_filter(adapter); |
| 11852 | 11855 | |
| 11853 | − if (hw->mac.type == ixgbe_mac_e610) | |
| 11854 | − mutex_init(&hw->aci.lock); | |
| 11855 | 11856 | timer_setup(&adapter->service_timer, ixgbe_service_timer, 0); |
| 11856 | 11857 | |
| 11857 | 11858 | if (ixgbe_removed(hw->hw_addr)) { |
| @@ -12007,9 +12008,9 @@ err_register: · 149 unmodified lines | ||
| 12007 | 12008 | devl_unlock(adapter->devlink); |
| 12008 | 12009 | ixgbe_release_hw_control(adapter); |
| 12009 | 12010 | ixgbe_clear_interrupt_scheme(adapter); |
| 12011 | +err_sw_init: | |
| 12010 | 12012 | if (hw->mac.type == ixgbe_mac_e610) |
| 12011 | 12013 | mutex_destroy(&adapter->hw.aci.lock); |
| 12012 | −err_sw_init: | |
| 12013 | 12014 | ixgbe_disable_sriov(adapter); |
| 12014 | 12015 | adapter->flags2 &= ~IXGBE_FLAG2_SEARCH_FOR_SFP; |
| 12015 | 12016 | iounmap(adapter->io_addr); |
| @@ -12060,10 +12061,8 @@ static void ixgbe_remove(struct pci_dev *pdev) · 44 unmodified lines | ||
| 12060 | 12061 | set_bit(__IXGBE_REMOVING, &adapter->state); |
| 12061 | 12062 | cancel_work_sync(&adapter->service_task); |
| 12062 | 12063 | |
| 12063 | − if (adapter->hw.mac.type == ixgbe_mac_e610) { | |
| 12064 | + if (adapter->hw.mac.type == ixgbe_mac_e610) | |
| 12064 | 12065 | ixgbe_disable_link_status_events(adapter); |
| 12065 | − mutex_destroy(&adapter->hw.aci.lock); | |
| 12066 | − } | |
| 12067 | 12066 | |
| 12068 | 12067 | if (adapter->mii_bus) |
| 12069 | 12068 | mdiobus_unregister(adapter->mii_bus); |
| @@ -12123,6 +12122,9 @@ static void ixgbe_remove(struct pci_dev *pdev) · 53 unmodified lines | ||
| 12123 | 12122 | disable_dev = !test_and_set_bit(__IXGBE_DISABLED, &adapter->state); |
| 12124 | 12123 | free_netdev(netdev); |
| 12125 | 12124 | |
| 12125 | + if (adapter->hw.mac.type == ixgbe_mac_e610) | |
| 12126 | + mutex_destroy(&adapter->hw.aci.lock); | |
| 12127 | + | |
| 12126 | 12128 | if (disable_dev) |
| 12127 | 12129 | pci_disable_device(pdev); |
| 12128 | 12130 | } |
| @@ -1124,11 +1124,24 @@ static int octep_set_features(struct net_device *dev, netdev_features_t features · 1123 unmodified lines | ||
| 1124 | 1124 | return err; |
| 1125 | 1125 | } |
| 1126 | 1126 | |
| 1127 | +static bool octep_is_vf_valid(struct octep_device *oct, int vf) | |
| 1128 | +{ | |
| 1129 | + if (vf >= CFG_GET_ACTIVE_VFS(oct->conf)) { | |
| 1130 | + netdev_err(oct->netdev, "Invalid VF ID %d\n", vf); | |
| 1131 | + return false; | |
| 1132 | + } | |
| 1133 | + | |
| 1134 | + return true; | |
| 1135 | +} | |
| 1136 | + | |
| 1127 | 1137 | static int octep_get_vf_config(struct net_device *dev, int vf, |
| 1128 | 1138 | struct ifla_vf_info *ivi) |
| 1129 | 1139 | { |
| 1130 | 1140 | struct octep_device *oct = netdev_priv(dev); |
| 1131 | 1141 | |
| 1142 | + if (!octep_is_vf_valid(oct, vf)) | |
| 1143 | + return -EINVAL; | |
| 1144 | + | |
| 1132 | 1145 | ivi->vf = vf; |
| 1133 | 1146 | ether_addr_copy(ivi->mac, oct->vf_info[vf].mac_addr); |
| 1134 | 1147 | ivi->spoofchk = true; |
| @@ -1143,6 +1156,9 @@ static int octep_set_vf_mac(struct net_device *dev, int vf, u8 *mac) · 8 unmodified lines | ||
| 1143 | 1156 | struct octep_device *oct = netdev_priv(dev); |
| 1144 | 1157 | int err; |
| 1145 | 1158 | |
| 1159 | + if (!octep_is_vf_valid(oct, vf)) | |
| 1160 | + return -EINVAL; | |
| 1161 | + | |
| 1146 | 1162 | if (!is_valid_ether_addr(mac)) { |
| 1147 | 1163 | dev_err(&oct->pdev->dev, "Invalid MAC Address %pM\n", mac); |
| 1148 | 1164 | return -EADDRNOTAVAIL; |
| @@ -196,6 +196,7 @@ static void octep_pfvf_get_mac_addr(struct octep_device *oct, u32 vf_id, · 195 unmodified lines | ||
| 196 | 196 | vf_id); |
| 197 | 197 | return; |
| 198 | 198 | } |
| 199 | + ether_addr_copy(oct->vf_info[vf_id].mac_addr, rsp->s_set_mac.mac_addr); | |
| 199 | 200 | rsp->s_set_mac.type = OCTEP_PFVF_MBOX_TYPE_RSP_ACK; |
| 200 | 201 | } |
| 201 | 202 | |
| @@ -205,6 +206,8 @@ static void octep_pfvf_dev_remove(struct octep_device *oct, u32 vf_id, · 3 unmodified lines | ||
| 205 | 206 | { |
| 206 | 207 | int err; |
| 207 | 208 | |
| 209 | + /* Reset VF-specific information maintained by the PF */ | |
| 210 | + memset(&oct->vf_info[vf_id], 0, sizeof(struct octep_pfvf_info)); | |
| 208 | 211 | err = octep_ctrl_net_dev_remove(oct, vf_id); |
| 209 | 212 | if (err) { |
| 210 | 213 | rsp->s.type = OCTEP_PFVF_MBOX_TYPE_RSP_NACK; |
| @@ -491,7 +491,7 @@ void otx2_ptp_destroy(struct otx2_nic *pfvf) · 490 unmodified lines | ||
| 491 | 491 | if (!ptp) |
| 492 | 492 | return; |
| 493 | 493 | |
| 494 | − cancel_delayed_work(&pfvf->ptp->synctstamp_work); | |
| 494 | + cancel_delayed_work_sync(&pfvf->ptp->synctstamp_work); | |
| 495 | 495 | |
| 496 | 496 | ptp_clock_unregister(ptp->ptp_clock); |
| 497 | 497 | kfree(ptp); |
| @@ -92,6 +92,7 @@ enum { · 91 unmodified lines | ||
| 92 | 92 | MLX5E_ACCEL_FS_ESP_FT_LEVEL = MLX5E_INNER_TTC_FT_LEVEL + 1, |
| 93 | 93 | MLX5E_ACCEL_FS_ESP_FT_ERR_LEVEL, |
| 94 | 94 | MLX5E_ACCEL_FS_POL_FT_LEVEL, |
| 95 | + MLX5E_ACCEL_FS_POL_MISS_FT_LEVEL, | |
| 95 | 96 | MLX5E_ACCEL_FS_ESP_FT_ROCE_LEVEL, |
| 96 | 97 | #endif |
| 97 | 98 | }; |
| @@ -185,6 +185,7 @@ struct mlx5e_ipsec_rx_create_attr { · 184 unmodified lines | ||
| 185 | 185 | u32 family; |
| 186 | 186 | int prio; |
| 187 | 187 | int pol_level; |
| 188 | + int pol_miss_level; | |
| 188 | 189 | int sa_level; |
| 189 | 190 | int status_level; |
| 190 | 191 | enum mlx5_flow_namespace_type chains_ns; |
| @@ -747,6 +747,7 @@ static void ipsec_rx_create_attr_set(struct mlx5e_ipsec *ipsec, · 746 unmodified lines | ||
| 747 | 747 | attr->family = family; |
| 748 | 748 | attr->prio = MLX5E_NIC_PRIO; |
| 749 | 749 | attr->pol_level = MLX5E_ACCEL_FS_POL_FT_LEVEL; |
| 750 | + attr->pol_miss_level = MLX5E_ACCEL_FS_POL_MISS_FT_LEVEL; | |
| 750 | 751 | attr->sa_level = MLX5E_ACCEL_FS_ESP_FT_LEVEL; |
| 751 | 752 | attr->status_level = MLX5E_ACCEL_FS_ESP_FT_ERR_LEVEL; |
| 752 | 753 | attr->chains_ns = MLX5_FLOW_NAMESPACE_KERNEL; |
| @@ -833,7 +834,7 @@ static int ipsec_rx_chains_create_miss(struct mlx5e_ipsec *ipsec, · 80 unmodified lines | ||
| 833 | 834 | |
| 834 | 835 | ft_attr.max_fte = 1; |
| 835 | 836 | ft_attr.autogroup.max_num_groups = 1; |
| 836 | − ft_attr.level = attr->pol_level; | |
| 837 | + ft_attr.level = attr->pol_miss_level; | |
| 837 | 838 | ft_attr.prio = attr->prio; |
| 838 | 839 | |
| 839 | 840 | ft = mlx5_create_auto_grouped_flow_table(attr->ns, &ft_attr); |
| @@ -139,8 +139,6 @@ void mlx5e_update_carrier(struct mlx5e_priv *priv) · 138 unmodified lines | ||
| 139 | 139 | if (up) { |
| 140 | 140 | netdev_info(priv->netdev, "Link up\n"); |
| 141 | 141 | netif_carrier_on(priv->netdev); |
| 142 | − mlx5e_port_manual_buffer_config(priv, 0, priv->netdev->mtu, | |
| 143 | − NULL, NULL, NULL); | |
| 144 | 142 | } else { |
| 145 | 143 | netdev_info(priv->netdev, "Link down\n"); |
| 146 | 144 | netif_carrier_off(priv->netdev); |
| @@ -1506,12 +1506,21 @@ static const struct mlx5e_profile mlx5e_uplink_rep_profile = { · 1505 unmodified lines | ||
| 1506 | 1506 | static int |
| 1507 | 1507 | mlx5e_vport_uplink_rep_load(struct mlx5_core_dev *dev, struct mlx5_eswitch_rep *rep) |
| 1508 | 1508 | { |
| 1509 | − struct mlx5e_priv *priv = netdev_priv(mlx5_uplink_netdev_get(dev)); | |
| 1510 | 1509 | struct mlx5e_rep_priv *rpriv = mlx5e_rep_to_rep_priv(rep); |
| 1510 | + struct net_device *netdev; | |
| 1511 | + struct mlx5e_priv *priv; | |
| 1512 | + int err; | |
| 1513 | + | |
| 1514 | + netdev = mlx5_uplink_netdev_get(dev); | |
| 1515 | + if (!netdev) | |
| 1516 | + return 0; | |
| 1511 | 1517 | |
| 1518 | + priv = netdev_priv(netdev); | |
| 1512 | 1519 | rpriv->netdev = priv->netdev; |
| 1513 | − return mlx5e_netdev_change_profile(priv, &mlx5e_uplink_rep_profile, | |
| 1514 | − rpriv); | |
| 1520 | + err = mlx5e_netdev_change_profile(priv, &mlx5e_uplink_rep_profile, | |
| 1521 | + rpriv); | |
| 1522 | + mlx5_uplink_netdev_put(dev, netdev); | |
| 1523 | + return err; | |
| 1515 | 1524 | } |
| 1516 | 1525 | |
| 1517 | 1526 | static void |
| @@ -1638,8 +1647,16 @@ mlx5e_vport_rep_unload(struct mlx5_eswitch_rep *rep) · 120 unmodified lines | ||
| 1638 | 1647 | { |
| 1639 | 1648 | struct mlx5e_rep_priv *rpriv = mlx5e_rep_to_rep_priv(rep); |
| 1640 | 1649 | struct net_device *netdev = rpriv->netdev; |
| 1641 | − struct mlx5e_priv *priv = netdev_priv(netdev); | |
| 1642 | − void *ppriv = priv->ppriv; | |
| 1650 | + struct mlx5e_priv *priv; | |
| 1651 | + void *ppriv; | |
| 1652 | + | |
| 1653 | + if (!netdev) { | |
| 1654 | + ppriv = rpriv; | |
| 1655 | + goto free_ppriv; | |
| 1656 | + } | |
| 1657 | + | |
| 1658 | + priv = netdev_priv(netdev); | |
| 1659 | + ppriv = priv->ppriv; | |
| 1643 | 1660 | |
| 1644 | 1661 | if (rep->vport == MLX5_VPORT_UPLINK) { |
| 1645 | 1662 | mlx5e_vport_uplink_rep_unload(rpriv); |
| @@ -1515,6 +1515,7 @@ static u32 mlx5_esw_qos_lag_link_speed_get_locked(struct mlx5_core_dev *mdev) · 1514 unmodified lines | ||
| 1515 | 1515 | speed = lksettings.base.speed; |
| 1516 | 1516 | |
| 1517 | 1517 | out: |
| 1518 | + mlx5_uplink_netdev_put(mdev, slave); | |
| 1518 | 1519 | return speed; |
| 1519 | 1520 | } |
| 1520 | 1521 | |
| @@ -114,9 +114,9 @@ · 113 unmodified lines | ||
| 114 | 114 | #define ETHTOOL_NUM_PRIOS 11 |
| 115 | 115 | #define ETHTOOL_MIN_LEVEL (KERNEL_MIN_LEVEL + ETHTOOL_NUM_PRIOS) |
| 116 | 116 | /* Vlan, mac, ttc, inner ttc, {UDP/ANY/aRFS/accel/{esp, esp_err}}, IPsec policy, |
| 117 | − * {IPsec RoCE MPV,Alias table},IPsec RoCE policy | |
| 117 | + * IPsec policy miss, {IPsec RoCE MPV,Alias table},IPsec RoCE policy | |
| 118 | 118 | */ |
| 119 | −#define KERNEL_NIC_PRIO_NUM_LEVELS 10 | |
| 119 | +#define KERNEL_NIC_PRIO_NUM_LEVELS 11 | |
| 120 | 120 | #define KERNEL_NIC_NUM_PRIOS 1 |
| 121 | 121 | /* One more level for tc, and one more for promisc */ |
| 122 | 122 | #define KERNEL_MIN_LEVEL (KERNEL_NIC_PRIO_NUM_LEVELS + 2) |
| @@ -47,7 +47,20 @@ int mlx5_crdump_collect(struct mlx5_core_dev *dev, u32 *cr_data); · 46 unmodified lines | ||
| 47 | 47 | |
| 48 | 48 | static inline struct net_device *mlx5_uplink_netdev_get(struct mlx5_core_dev *mdev) |
| 49 | 49 | { |
| 50 | − return mdev->mlx5e_res.uplink_netdev; | |
| 50 | + struct mlx5e_resources *mlx5e_res = &mdev->mlx5e_res; | |
| 51 | + struct net_device *netdev; | |
| 52 | + | |
| 53 | + mutex_lock(&mlx5e_res->uplink_netdev_lock); | |
| 54 | + netdev = mlx5e_res->uplink_netdev; | |
| 55 | + netdev_hold(netdev, &mlx5e_res->tracker, GFP_KERNEL); | |
| 56 | + mutex_unlock(&mlx5e_res->uplink_netdev_lock); | |
| 57 | + return netdev; | |
| 58 | +} | |
| 59 | + | |
| 60 | +static inline void mlx5_uplink_netdev_put(struct mlx5_core_dev *mdev, | |
| 61 | + struct net_device *netdev) | |
| 62 | +{ | |
| 63 | + netdev_put(netdev, &mdev->mlx5e_res.tracker); | |
| 51 | 64 | } |
| 52 | 65 | |
| 53 | 66 | struct mlx5_sd; |
| @@ -1170,7 +1170,11 @@ const struct mlx5_link_info *mlx5_port_ptys2info(struct mlx5_core_dev *mdev, · 1169 unmodified lines | ||
| 1170 | 1170 | mlx5e_port_get_link_mode_info_arr(mdev, &table, &max_size, |
| 1171 | 1171 | force_legacy); |
| 1172 | 1172 | i = find_first_bit(&temp, max_size); |
| 1173 | − if (i < max_size) | |
| 1173 | + | |
| 1174 | + /* mlx5e_link_info has holes. Check speed | |
| 1175 | + * is not zero as indication of one. | |
| 1176 | + */ | |
| 1177 | + if (i < max_size && table[i].speed) | |
| 1174 | 1178 | return &table[i]; |
| 1175 | 1179 | |
| 1176 | 1180 | return NULL; |
| @@ -820,7 +820,7 @@ static void rx_irq(struct net_device *ndev) · 819 unmodified lines | ||
| 820 | 820 | struct ns83820 *dev = PRIV(ndev); |
| 821 | 821 | struct rx_info *info = &dev->rx_info; |
| 822 | 822 | unsigned next_rx; |
| 823 | − int rx_rc, len; | |
| 823 | + int len; | |
| 824 | 824 | u32 cmdsts; |
| 825 | 825 | __le32 *desc; |
| 826 | 826 | unsigned long flags; |
| @@ -881,8 +881,10 @@ static void rx_irq(struct net_device *ndev) · 54 unmodified lines | ||
| 881 | 881 | if (likely(CMDSTS_OK & cmdsts)) { |
| 882 | 882 | #endif |
| 883 | 883 | skb_put(skb, len); |
| 884 | − if (unlikely(!skb)) | |
| 884 | + if (unlikely(!skb)) { | |
| 885 | + ndev->stats.rx_dropped++; | |
| 885 | 886 | goto netdev_mangle_me_harder_failed; |
| 887 | + } | |
| 886 | 888 | if (cmdsts & CMDSTS_DEST_MULTI) |
| 887 | 889 | ndev->stats.multicast++; |
| 888 | 890 | ndev->stats.rx_packets++; |
| @@ -901,15 +903,12 @@ static void rx_irq(struct net_device *ndev) · 12 unmodified lines | ||
| 901 | 903 | __vlan_hwaccel_put_tag(skb, htons(ETH_P_IPV6), tag); |
| 902 | 904 | } |
| 903 | 905 | #endif |
| 904 | − rx_rc = netif_rx(skb); | |
| 905 | − if (NET_RX_DROP == rx_rc) { | |
| 906 | −netdev_mangle_me_harder_failed: | |
| 907 | − ndev->stats.rx_dropped++; | |
| 908 | − } | |
| 906 | + netif_rx(skb); | |
| 909 | 907 | } else { |
| 910 | 908 | dev_kfree_skb_irq(skb); |
| 911 | 909 | } |
| 912 | 910 | |
| 911 | +netdev_mangle_me_harder_failed: | |
| 913 | 912 | nr++; |
| 914 | 913 | next_rx = info->next_rx; |
| 915 | 914 | desc = info->descs + (DESC_SIZE * next_rx); |
| @@ -4462,10 +4462,11 @@ static enum dbg_status qed_protection_override_dump(struct qed_hwfn *p_hwfn, · 4461 unmodified lines | ||
| 4462 | 4462 | goto out; |
| 4463 | 4463 | } |
| 4464 | 4464 | |
| 4465 | − /* Add override window info to buffer */ | |
| 4465 | + /* Add override window info to buffer, preventing buffer overflow */ | |
| 4466 | 4466 | override_window_dwords = |
| 4467 | − qed_rd(p_hwfn, p_ptt, GRC_REG_NUMBER_VALID_OVERRIDE_WINDOW) * | |
| 4468 | − PROTECTION_OVERRIDE_ELEMENT_DWORDS; | |
| 4467 | + min(qed_rd(p_hwfn, p_ptt, GRC_REG_NUMBER_VALID_OVERRIDE_WINDOW) * | |
| 4468 | + PROTECTION_OVERRIDE_ELEMENT_DWORDS, | |
| 4469 | + PROTECTION_OVERRIDE_DEPTH_DWORDS); | |
| 4469 | 4470 | if (override_window_dwords) { |
| 4470 | 4471 | addr = BYTES_TO_DWORDS(GRC_REG_PROTECTION_OVERRIDE_WINDOW); |
| 4471 | 4472 | offset += qed_grc_dump_addr_range(p_hwfn, |
| @@ -2092,7 +2092,7 @@ static void iwl_txq_gen1_update_byte_cnt_tbl(struct iwl_trans *trans, · 2091 unmodified lines | ||
| 2092 | 2092 | break; |
| 2093 | 2093 | } |
| 2094 | 2094 | |
| 2095 | − if (trans->mac_cfg->device_family >= IWL_DEVICE_FAMILY_9000 && | |
| 2095 | + if (trans->mac_cfg->device_family >= IWL_DEVICE_FAMILY_7000 && | |
| 2096 | 2096 | trans->mac_cfg->device_family < IWL_DEVICE_FAMILY_AX210) |
| 2097 | 2097 | len = DIV_ROUND_UP(len, 4); |
| 2098 | 2098 | |
| @@ -663,6 +663,7 @@ struct mlx5e_resources { · 662 unmodified lines | ||
| 663 | 663 | bool tisn_valid; |
| 664 | 664 | } hw_objs; |
| 665 | 665 | struct net_device *uplink_netdev; |
| 666 | + netdevice_tracker tracker; | |
| 666 | 667 | struct mutex uplink_netdev_lock; |
| 667 | 668 | struct mlx5_crypto_dek_priv *dek_priv; |
| 668 | 669 | }; |
| @@ -3,6 +3,7 @@ · 2 unmodified lines | ||
| 3 | 3 | #define __NET_DST_METADATA_H 1 |
| 4 | 4 | |
| 5 | 5 | #include <linux/skbuff.h> |
| 6 | +#include <net/ip.h> | |
| 6 | 7 | #include <net/ip_tunnels.h> |
| 7 | 8 | #include <net/macsec.h> |
| 8 | 9 | #include <net/dst.h> |
| @@ -220,9 +221,15 @@ static inline struct metadata_dst *ip_tun_rx_dst(struct sk_buff *skb, · 211 unmodified lines | ||
| 220 | 221 | int md_size) |
| 221 | 222 | { |
| 222 | 223 | const struct iphdr *iph = ip_hdr(skb); |
| 224 | + struct metadata_dst *tun_dst; | |
| 225 | + | |
| 226 | + tun_dst = __ip_tun_set_dst(iph->saddr, iph->daddr, iph->tos, iph->ttl, | |
| 227 | + 0, flags, tunnel_id, md_size); | |
| 223 | 228 | |
| 224 | − return __ip_tun_set_dst(iph->saddr, iph->daddr, iph->tos, iph->ttl, | |
| 225 | − 0, flags, tunnel_id, md_size); | |
| 229 | + if (tun_dst && (iph->frag_off & htons(IP_DF))) | |
| 230 | + __set_bit(IP_TUNNEL_DONT_FRAGMENT_BIT, | |
| 231 | + tun_dst->u.tun_info.key.tun_flags); | |
| 232 | + return tun_dst; | |
| 226 | 233 | } |
| 227 | 234 | |
| 228 | 235 | static inline struct metadata_dst *__ipv6_tun_set_dst(const struct in6_addr *saddr, |
| @@ -2061,6 +2061,9 @@ static inline void sk_set_socket(struct sock *sk, struct socket *sock) · 2060 unmodified lines | ||
| 2061 | 2061 | if (sock) { |
| 2062 | 2062 | WRITE_ONCE(sk->sk_uid, SOCK_INODE(sock)->i_uid); |
| 2063 | 2063 | WRITE_ONCE(sk->sk_ino, SOCK_INODE(sock)->i_ino); |
| 2064 | + } else { | |
| 2065 | + /* Note: sk_uid is unchanged. */ | |
| 2066 | + WRITE_ONCE(sk->sk_ino, 0); | |
| 2064 | 2067 | } |
| 2065 | 2068 | } |
| 2066 | 2069 | |
| @@ -2082,8 +2085,6 @@ static inline void sock_orphan(struct sock *sk) · 15 unmodified lines | ||
| 2082 | 2085 | sock_set_flag(sk, SOCK_DEAD); |
| 2083 | 2086 | sk_set_socket(sk, NULL); |
| 2084 | 2087 | sk->sk_wq = NULL; |
| 2085 | − /* Note: sk_uid is unchanged. */ | |
| 2086 | − WRITE_ONCE(sk->sk_ino, 0); | |
| 2087 | 2088 | write_unlock_bh(&sk->sk_callback_lock); |
| 2088 | 2089 | } |
| 2089 | 2090 | |
| @@ -31,6 +31,8 @@ · 30 unmodified lines | ||
| 31 | 31 | #define MPTCP_INFO_FLAG_FALLBACK _BITUL(0) |
| 32 | 32 | #define MPTCP_INFO_FLAG_REMOTE_KEY_RECEIVED _BITUL(1) |
| 33 | 33 | |
| 34 | +#define MPTCP_PM_EV_FLAG_DENY_JOIN_ID0 _BITUL(0) | |
| 35 | + | |
| 34 | 36 | #define MPTCP_PM_ADDR_FLAG_SIGNAL (1 << 0) |
| 35 | 37 | #define MPTCP_PM_ADDR_FLAG_SUBFLOW (1 << 1) |
| 36 | 38 | #define MPTCP_PM_ADDR_FLAG_BACKUP (1 << 2) |
| @@ -16,10 +16,10 @@ · 15 unmodified lines | ||
| 16 | 16 | * good time to allocate memory and send ADD_ADDR if needed. Depending on the |
| 17 | 17 | * traffic-patterns it can take a long time until the MPTCP_EVENT_ESTABLISHED |
| 18 | 18 | * is sent. Attributes: token, family, saddr4 | saddr6, daddr4 | daddr6, |
| 19 | − * sport, dport, server-side. | |
| 19 | + * sport, dport, server-side, [flags]. | |
| 20 | 20 | * @MPTCP_EVENT_ESTABLISHED: A MPTCP connection is established (can start new |
| 21 | 21 | * subflows). Attributes: token, family, saddr4 | saddr6, daddr4 | daddr6, |
| 22 | − * sport, dport, server-side. | |
| 22 | + * sport, dport, server-side, [flags]. | |
| 23 | 23 | * @MPTCP_EVENT_CLOSED: A MPTCP connection has stopped. Attribute: token. |
| 24 | 24 | * @MPTCP_EVENT_ANNOUNCED: A new address has been announced by the peer. |
| 25 | 25 | * Attributes: token, rem_id, family, daddr4 | daddr6 [, dport]. |
| @@ -6965,7 +6965,7 @@ static void napi_stop_kthread(struct napi_struct *napi) · 6964 unmodified lines | ||
| 6965 | 6965 | * the kthread. |
| 6966 | 6966 | */ |
| 6967 | 6967 | while (true) { |
| 6968 | − if (!test_bit(NAPIF_STATE_SCHED_THREADED, &napi->state)) | |
| 6968 | + if (!test_bit(NAPI_STATE_SCHED_THREADED, &napi->state)) | |
| 6969 | 6969 | break; |
| 6970 | 6970 | |
| 6971 | 6971 | msleep(20); |
| @@ -34,7 +34,7 @@ devlink_rate_leaf_get_from_info(struct devlink *devlink, struct genl_info *info) · 33 unmodified lines | ||
| 34 | 34 | static struct devlink_rate * |
| 35 | 35 | devlink_rate_node_get_by_name(struct devlink *devlink, const char *node_name) |
| 36 | 36 | { |
| 37 | − static struct devlink_rate *devlink_rate; | |
| 37 | + struct devlink_rate *devlink_rate; | |
| 38 | 38 | |
| 39 | 39 | list_for_each_entry(devlink_rate, &devlink->rate_list, list) { |
| 40 | 40 | if (devlink_rate_is_node(devlink_rate) && |
| @@ -819,8 +819,8 @@ EXPORT_SYMBOL_GPL(devl_rate_leaf_destroy); · 778 unmodified lines | ||
| 819 | 819 | */ |
| 820 | 820 | void devl_rate_nodes_destroy(struct devlink *devlink) |
| 821 | 821 | { |
| 822 | − static struct devlink_rate *devlink_rate, *tmp; | |
| 823 | 822 | const struct devlink_ops *ops = devlink->ops; |
| 823 | + struct devlink_rate *devlink_rate, *tmp; | |
| 824 | 824 | |
| 825 | 825 | devl_assert_locked(devlink); |
| 826 | 826 | |
| @@ -905,7 +905,7 @@ int ethtool_net_get_ts_info_by_phc(struct net_device *dev, · 904 unmodified lines | ||
| 905 | 905 | int err; |
| 906 | 906 | |
| 907 | 907 | if (!ops->get_ts_info) |
| 908 | − return -ENODEV; | |
| 908 | + return -EOPNOTSUPP; | |
| 909 | 909 | |
| 910 | 910 | /* Does ptp comes from netdev */ |
| 911 | 911 | ethtool_init_tsinfo(info); |
| @@ -973,7 +973,7 @@ int ethtool_get_ts_info_by_phc(struct net_device *dev, · 61 unmodified lines | ||
| 973 | 973 | int err; |
| 974 | 974 | |
| 975 | 975 | err = ethtool_net_get_ts_info_by_phc(dev, info, hwprov_desc); |
| 976 | − if (err == -ENODEV) { | |
| 976 | + if (err == -ENODEV || err == -EOPNOTSUPP) { | |
| 977 | 977 | struct phy_device *phy; |
| 978 | 978 | |
| 979 | 979 | phy = ethtool_phy_get_ts_info_by_phc(dev, info, hwprov_desc); |
| @@ -3327,6 +3327,7 @@ int tcp_disconnect(struct sock *sk, int flags) · 3326 unmodified lines | ||
| 3327 | 3327 | struct inet_connection_sock *icsk = inet_csk(sk); |
| 3328 | 3328 | struct tcp_sock *tp = tcp_sk(sk); |
| 3329 | 3329 | int old_state = sk->sk_state; |
| 3330 | + struct request_sock *req; | |
| 3330 | 3331 | u32 seq; |
| 3331 | 3332 | |
| 3332 | 3333 | if (old_state != TCP_CLOSE) |
| @@ -3442,6 +3443,10 @@ int tcp_disconnect(struct sock *sk, int flags) · 109 unmodified lines | ||
| 3442 | 3443 | |
| 3443 | 3444 | |
| 3444 | 3445 | /* Clean up fastopen related fields */ |
| 3446 | + req = rcu_dereference_protected(tp->fastopen_rsk, | |
| 3447 | + lockdep_sock_is_held(sk)); | |
| 3448 | + if (req) | |
| 3449 | + reqsk_fastopen_remove(sk, req, false); | |
| 3445 | 3450 | tcp_free_fastopen_req(tp); |
| 3446 | 3451 | inet_clear_bit(DEFER_CONNECT, sk); |
| 3447 | 3452 | tp->fastopen_client_fail = 0; |
| @@ -1178,7 +1178,9 @@ void tcp_ao_finish_connect(struct sock *sk, struct sk_buff *skb) · 1177 unmodified lines | ||
| 1178 | 1178 | if (!ao) |
| 1179 | 1179 | return; |
| 1180 | 1180 | |
| 1181 | − WRITE_ONCE(ao->risn, tcp_hdr(skb)->seq); | |
| 1181 | + /* sk with TCP_REPAIR_ON does not have skb in tcp_finish_connect */ | |
| 1182 | + if (skb) | |
| 1183 | + WRITE_ONCE(ao->risn, tcp_hdr(skb)->seq); | |
| 1182 | 1184 | ao->rcv_sne = 0; |
| 1183 | 1185 | |
| 1184 | 1186 | hlist_for_each_entry_rcu(key, &ao->head, node, lockdep_sock_is_held(sk)) |
| @@ -985,13 +985,13 @@ static bool check_fully_established(struct mptcp_sock *msk, struct sock *ssk, · 984 unmodified lines | ||
| 985 | 985 | return false; |
| 986 | 986 | } |
| 987 | 987 | |
| 988 | − if (mp_opt->deny_join_id0) | |
| 989 | − WRITE_ONCE(msk->pm.remote_deny_join_id0, true); | |
| 990 | − | |
| 991 | 988 | if (unlikely(!READ_ONCE(msk->pm.server_side))) |
| 992 | 989 | pr_warn_once("bogus mpc option on established client sk"); |
| 993 | 990 | |
| 994 | 991 | set_fully_established: |
| 992 | + if (mp_opt->deny_join_id0) | |
| 993 | + WRITE_ONCE(msk->pm.remote_deny_join_id0, true); | |
| 994 | + | |
| 995 | 995 | mptcp_data_lock((struct sock *)msk); |
| 996 | 996 | __mptcp_subflow_fully_established(msk, subflow, mp_opt); |
| 997 | 997 | mptcp_data_unlock((struct sock *)msk); |
| @@ -408,6 +408,7 @@ static int mptcp_event_created(struct sk_buff *skb, · 407 unmodified lines | ||
| 408 | 408 | const struct sock *ssk) |
| 409 | 409 | { |
| 410 | 410 | int err = nla_put_u32(skb, MPTCP_ATTR_TOKEN, READ_ONCE(msk->token)); |
| 411 | + u16 flags = 0; | |
| 411 | 412 | |
| 412 | 413 | if (err) |
| 413 | 414 | return err; |
| @@ -415,6 +416,12 @@ static int mptcp_event_created(struct sk_buff *skb, · 1 unmodified line | ||
| 415 | 416 | if (nla_put_u8(skb, MPTCP_ATTR_SERVER_SIDE, READ_ONCE(msk->pm.server_side))) |
| 416 | 417 | return -EMSGSIZE; |
| 417 | 418 | |
| 419 | + if (READ_ONCE(msk->pm.remote_deny_join_id0)) | |
| 420 | + flags |= MPTCP_PM_EV_FLAG_DENY_JOIN_ID0; | |
| 421 | + | |
| 422 | + if (flags && nla_put_u16(skb, MPTCP_ATTR_FLAGS, flags)) | |
| 423 | + return -EMSGSIZE; | |
| 424 | + | |
| 418 | 425 | return mptcp_event_add_subflow(skb, ssk); |
| 419 | 426 | } |
| 420 | 427 | |
| @@ -371,6 +371,20 @@ static void mptcp_close_wake_up(struct sock *sk) · 370 unmodified lines | ||
| 371 | 371 | sk_wake_async(sk, SOCK_WAKE_WAITD, POLL_IN); |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | +static void mptcp_shutdown_subflows(struct mptcp_sock *msk) | |
| 375 | +{ | |
| 376 | + struct mptcp_subflow_context *subflow; | |
| 377 | + | |
| 378 | + mptcp_for_each_subflow(msk, subflow) { | |
| 379 | + struct sock *ssk = mptcp_subflow_tcp_sock(subflow); | |
| 380 | + bool slow; | |
| 381 | + | |
| 382 | + slow = lock_sock_fast(ssk); | |
| 383 | + tcp_shutdown(ssk, SEND_SHUTDOWN); | |
| 384 | + unlock_sock_fast(ssk, slow); | |
| 385 | + } | |
| 386 | +} | |
| 387 | + | |
| 374 | 388 | /* called under the msk socket lock */ |
| 375 | 389 | static bool mptcp_pending_data_fin_ack(struct sock *sk) |
| 376 | 390 | { |
| @@ -395,6 +409,7 @@ static void mptcp_check_data_fin_ack(struct sock *sk) · 18 unmodified lines | ||
| 395 | 409 | break; |
| 396 | 410 | case TCP_CLOSING: |
| 397 | 411 | case TCP_LAST_ACK: |
| 412 | + mptcp_shutdown_subflows(msk); | |
| 398 | 413 | mptcp_set_state(sk, TCP_CLOSE); |
| 399 | 414 | break; |
| 400 | 415 | } |
| @@ -563,6 +578,7 @@ static bool mptcp_check_data_fin(struct sock *sk) · 162 unmodified lines | ||
| 563 | 578 | mptcp_set_state(sk, TCP_CLOSING); |
| 564 | 579 | break; |
| 565 | 580 | case TCP_FIN_WAIT2: |
| 581 | + mptcp_shutdown_subflows(msk); | |
| 566 | 582 | mptcp_set_state(sk, TCP_CLOSE); |
| 567 | 583 | break; |
| 568 | 584 | default: |
| @@ -883,6 +883,10 @@ create_child: · 882 unmodified lines | ||
| 883 | 883 | |
| 884 | 884 | ctx->subflow_id = 1; |
| 885 | 885 | owner = mptcp_sk(ctx->conn); |
| 886 | + | |
| 887 | + if (mp_opt.deny_join_id0) | |
| 888 | + WRITE_ONCE(owner->pm.remote_deny_join_id0, true); | |
| 889 | + | |
| 886 | 890 | mptcp_pm_new_connection(owner, child, 1); |
| 887 | 891 | |
| 888 | 892 | /* with OoO packets we can reach here without ingress |
| @@ -133,12 +133,15 @@ static int rds_ib_post_reg_frmr(struct rds_ib_mr *ibmr) · 132 unmodified lines | ||
| 133 | 133 | |
| 134 | 134 | ret = ib_map_mr_sg_zbva(frmr->mr, ibmr->sg, ibmr->sg_dma_len, |
| 135 | 135 | &off, PAGE_SIZE); |
| 136 | − if (unlikely(ret != ibmr->sg_dma_len)) | |
| 137 | − return ret < 0 ? ret : -EINVAL; | |
| 136 | + if (unlikely(ret != ibmr->sg_dma_len)) { | |
| 137 | + ret = ret < 0 ? ret : -EINVAL; | |
| 138 | + goto out_inc; | |
| 139 | + } | |
| 138 | 140 | |
| 139 | − if (cmpxchg(&frmr->fr_state, | |
| 140 | − FRMR_IS_FREE, FRMR_IS_INUSE) != FRMR_IS_FREE) | |
| 141 | − return -EBUSY; | |
| 141 | + if (cmpxchg(&frmr->fr_state, FRMR_IS_FREE, FRMR_IS_INUSE) != FRMR_IS_FREE) { | |
| 142 | + ret = -EBUSY; | |
| 143 | + goto out_inc; | |
| 144 | + } | |
| 142 | 145 | |
| 143 | 146 | atomic_inc(&ibmr->ic->i_fastreg_inuse_count); |
| 144 | 147 | |
| @@ -166,11 +169,10 @@ static int rds_ib_post_reg_frmr(struct rds_ib_mr *ibmr) · 21 unmodified lines | ||
| 166 | 169 | /* Failure here can be because of -ENOMEM as well */ |
| 167 | 170 | rds_transition_frwr_state(ibmr, FRMR_IS_INUSE, FRMR_IS_STALE); |
| 168 | 171 | |
| 169 | − atomic_inc(&ibmr->ic->i_fastreg_wrs); | |
| 170 | 172 | if (printk_ratelimit()) |
| 171 | 173 | pr_warn("RDS/IB: %s returned error(%d)\n", |
| 172 | 174 | __func__, ret); |
| 173 | − goto out; | |
| 175 | + goto out_inc; | |
| 174 | 176 | } |
| 175 | 177 | |
| 176 | 178 | /* Wait for the registration to complete in order to prevent an invalid |
| @@ -179,8 +181,10 @@ static int rds_ib_post_reg_frmr(struct rds_ib_mr *ibmr) · 2 unmodified lines | ||
| 179 | 181 | */ |
| 180 | 182 | wait_event(frmr->fr_reg_done, !frmr->fr_reg); |
| 181 | 183 | |
| 182 | −out: | |
| 184 | + return ret; | |
| 183 | 185 | |
| 186 | +out_inc: | |
| 187 | + atomic_inc(&ibmr->ic->i_fastreg_wrs); | |
| 184 | 188 | return ret; |
| 185 | 189 | } |
| 186 | 190 | |
| @@ -94,10 +94,10 @@ static const struct dmi_system_id rfkill_gpio_deny_table[] = { · 93 unmodified lines | ||
| 94 | 94 | static int rfkill_gpio_probe(struct platform_device *pdev) |
| 95 | 95 | { |
| 96 | 96 | struct rfkill_gpio_data *rfkill; |
| 97 | − struct gpio_desc *gpio; | |
| 97 | + const char *type_name = NULL; | |
| 98 | 98 | const char *name_property; |
| 99 | 99 | const char *type_property; |
| 100 | − const char *type_name; | |
| 100 | + struct gpio_desc *gpio; | |
| 101 | 101 | int ret; |
| 102 | 102 | |
| 103 | 103 | if (dmi_check_system(rfkill_gpio_deny_table)) |
| @@ -475,7 +475,7 @@ static int rxgk_verify_packet_integrity(struct rxrpc_call *call, · 474 unmodified lines | ||
| 475 | 475 | struct krb5_buffer metadata; |
| 476 | 476 | unsigned int offset = sp->offset, len = sp->len; |
| 477 | 477 | size_t data_offset = 0, data_len = len; |
| 478 | − u32 ac; | |
| 478 | + u32 ac = 0; | |
| 479 | 479 | int ret = -ENOMEM; |
| 480 | 480 | |
| 481 | 481 | _enter(""); |
| @@ -499,9 +499,10 @@ static int rxgk_verify_packet_integrity(struct rxrpc_call *call, · 17 unmodified lines | ||
| 499 | 499 | ret = rxgk_verify_mic_skb(gk->krb5, gk->rx_Kc, &metadata, |
| 500 | 500 | skb, &offset, &len, &ac); |
| 501 | 501 | kfree(hdr); |
| 502 | − if (ret == -EPROTO) { | |
| 503 | − rxrpc_abort_eproto(call, skb, ac, | |
| 504 | − rxgk_abort_1_verify_mic_eproto); | |
| 502 | + if (ret < 0) { | |
| 503 | + if (ret != -ENOMEM) | |
| 504 | + rxrpc_abort_eproto(call, skb, ac, | |
| 505 | + rxgk_abort_1_verify_mic_eproto); | |
| 505 | 506 | } else { |
| 506 | 507 | sp->offset = offset; |
| 507 | 508 | sp->len = len; |
| @@ -524,15 +525,16 @@ static int rxgk_verify_packet_encrypted(struct rxrpc_call *call, · 16 unmodified lines | ||
| 524 | 525 | struct rxgk_header hdr; |
| 525 | 526 | unsigned int offset = sp->offset, len = sp->len; |
| 526 | 527 | int ret; |
| 527 | − u32 ac; | |
| 528 | + u32 ac = 0; | |
| 528 | 529 | |
| 529 | 530 | _enter(""); |
| 530 | 531 | |
| 531 | 532 | ret = rxgk_decrypt_skb(gk->krb5, gk->rx_enc, skb, &offset, &len, &ac); |
| 532 | − if (ret == -EPROTO) | |
| 533 | − rxrpc_abort_eproto(call, skb, ac, rxgk_abort_2_decrypt_eproto); | |
| 534 | − if (ret < 0) | |
| 533 | + if (ret < 0) { | |
| 534 | + if (ret != -ENOMEM) | |
| 535 | + rxrpc_abort_eproto(call, skb, ac, rxgk_abort_2_decrypt_eproto); | |
| 535 | 536 | goto error; |
| 537 | + } | |
| 536 | 538 | |
| 537 | 539 | if (len < sizeof(hdr)) { |
| 538 | 540 | ret = rxrpc_abort_eproto(call, skb, RXGK_PACKETSHORT, |
| @@ -54,6 +54,10 @@ int rxgk_yfs_decode_ticket(struct rxrpc_connection *conn, struct sk_buff *skb, · 53 unmodified lines | ||
| 54 | 54 | |
| 55 | 55 | _enter(""); |
| 56 | 56 | |
| 57 | + if (ticket_len < 10 * sizeof(__be32)) | |
| 58 | + return rxrpc_abort_conn(conn, skb, RXGK_INCONSISTENCY, -EPROTO, | |
| 59 | + rxgk_abort_resp_short_yfs_tkt); | |
| 60 | + | |
| 57 | 61 | /* Get the session key length */ |
| 58 | 62 | ret = skb_copy_bits(skb, ticket_offset, tmp, sizeof(tmp)); |
| 59 | 63 | if (ret < 0) |
| @@ -187,7 +191,7 @@ int rxgk_extract_token(struct rxrpc_connection *conn, struct sk_buff *skb, · 127 unmodified lines | ||
| 187 | 191 | struct key *server_key; |
| 188 | 192 | unsigned int ticket_offset, ticket_len; |
| 189 | 193 | u32 kvno, enctype; |
| 190 | − int ret, ec; | |
| 194 | + int ret, ec = 0; | |
| 191 | 195 | |
| 192 | 196 | struct { |
| 193 | 197 | __be32 kvno; |
| @@ -195,22 +199,23 @@ int rxgk_extract_token(struct rxrpc_connection *conn, struct sk_buff *skb, · 1 unmodified line | ||
| 195 | 199 | __be32 token_len; |
| 196 | 200 | } container; |
| 197 | 201 | |
| 202 | + if (token_len < sizeof(container)) | |
| 203 | + goto short_packet; | |
| 204 | + | |
| 198 | 205 | /* Decode the RXGK_TokenContainer object. This tells us which server |
| 199 | 206 | * key we should be using. We can then fetch the key, get the secret |
| 200 | 207 | * and set up the crypto to extract the token. |
| 201 | 208 | */ |
| 202 | 209 | if (skb_copy_bits(skb, token_offset, &container, sizeof(container)) < 0) |
| 203 | − return rxrpc_abort_conn(conn, skb, RXGK_PACKETSHORT, -EPROTO, | |
| 204 | − rxgk_abort_resp_tok_short); | |
| 210 | + goto short_packet; | |
| 205 | 211 | |
| 206 | 212 | kvno = ntohl(container.kvno); |
| 207 | 213 | enctype = ntohl(container.enctype); |
| 208 | 214 | ticket_len = ntohl(container.token_len); |
| 209 | 215 | ticket_offset = token_offset + sizeof(container); |
| 210 | 216 | |
| 211 | − if (xdr_round_up(ticket_len) > token_len - 3 * 4) | |
| 212 | − return rxrpc_abort_conn(conn, skb, RXGK_PACKETSHORT, -EPROTO, | |
| 213 | − rxgk_abort_resp_tok_short); | |
| 217 | + if (xdr_round_up(ticket_len) > token_len - sizeof(container)) | |
| 218 | + goto short_packet; | |
| 214 | 219 | |
| 215 | 220 | _debug("KVNO %u", kvno); |
| 216 | 221 | _debug("ENC %u", enctype); |
| @@ -236,9 +241,11 @@ int rxgk_extract_token(struct rxrpc_connection *conn, struct sk_buff *skb, · 19 unmodified lines | ||
| 236 | 241 | &ticket_offset, &ticket_len, &ec); |
| 237 | 242 | crypto_free_aead(token_enc); |
| 238 | 243 | token_enc = NULL; |
| 239 | − if (ret < 0) | |
| 240 | − return rxrpc_abort_conn(conn, skb, ec, ret, | |
| 241 | − rxgk_abort_resp_tok_dec); | |
| 244 | + if (ret < 0) { | |
| 245 | + if (ret != -ENOMEM) | |
| 246 | + return rxrpc_abort_conn(conn, skb, ec, ret, | |
| 247 | + rxgk_abort_resp_tok_dec); | |
| 248 | + } | |
| 242 | 249 | |
| 243 | 250 | ret = conn->security->default_decode_ticket(conn, skb, ticket_offset, |
| 244 | 251 | ticket_len, _key); |
| @@ -283,4 +290,8 @@ temporary_error: · 38 unmodified lines | ||
| 283 | 290 | * also come out this way if the ticket decryption fails. |
| 284 | 291 | */ |
| 285 | 292 | return ret; |
| 293 | + | |
| 294 | +short_packet: | |
| 295 | + return rxrpc_abort_conn(conn, skb, RXGK_PACKETSHORT, -EPROTO, | |
| 296 | + rxgk_abort_resp_tok_short); | |
| 286 | 297 | } |
| @@ -88,11 +88,16 @@ int rxgk_decrypt_skb(const struct krb5_enctype *krb5, · 87 unmodified lines | ||
| 88 | 88 | *_offset += offset; |
| 89 | 89 | *_len = len; |
| 90 | 90 | break; |
| 91 | + case -EBADMSG: /* Checksum mismatch. */ | |
| 91 | 92 | case -EPROTO: |
| 92 | − case -EBADMSG: | |
| 93 | 93 | *_error_code = RXGK_SEALEDINCON; |
| 94 | 94 | break; |
| 95 | + case -EMSGSIZE: | |
| 96 | + *_error_code = RXGK_PACKETSHORT; | |
| 97 | + break; | |
| 98 | + case -ENOPKG: /* Would prefer RXGK_BADETYPE, but not available for YFS. */ | |
| 95 | 99 | default: |
| 100 | + *_error_code = RXGK_INCONSISTENCY; | |
| 96 | 101 | break; |
| 97 | 102 | } |
| 98 | 103 | |
| @@ -127,11 +132,16 @@ int rxgk_verify_mic_skb(const struct krb5_enctype *krb5, · 28 unmodified lines | ||
| 127 | 132 | *_offset += offset; |
| 128 | 133 | *_len = len; |
| 129 | 134 | break; |
| 135 | + case -EBADMSG: /* Checksum mismatch */ | |
| 130 | 136 | case -EPROTO: |
| 131 | − case -EBADMSG: | |
| 132 | 137 | *_error_code = RXGK_SEALEDINCON; |
| 133 | 138 | break; |
| 139 | + case -EMSGSIZE: | |
| 140 | + *_error_code = RXGK_PACKETSHORT; | |
| 141 | + break; | |
| 142 | + case -ENOPKG: /* Would prefer RXGK_BADETYPE, but not available for YFS. */ | |
| 134 | 143 | default: |
| 144 | + *_error_code = RXGK_INCONSISTENCY; | |
| 135 | 145 | break; |
| 136 | 146 | } |
| 137 | 147 | |
| @@ -141,6 +141,7 @@ void update_sk_prot(struct sock *sk, struct tls_context *ctx); · 140 unmodified lines | ||
| 141 | 141 | |
| 142 | 142 | int wait_on_pending_writer(struct sock *sk, long *timeo); |
| 143 | 143 | void tls_err_abort(struct sock *sk, int err); |
| 144 | +void tls_strp_abort_strp(struct tls_strparser *strp, int err); | |
| 144 | 145 | |
| 145 | 146 | int init_prot_info(struct tls_prot_info *prot, |
| 146 | 147 | const struct tls_crypto_info *crypto_info, |
| @@ -13,7 +13,7 @@ · 12 unmodified lines | ||
| 13 | 13 | |
| 14 | 14 | static struct workqueue_struct *tls_strp_wq; |
| 15 | 15 | |
| 16 | −static void tls_strp_abort_strp(struct tls_strparser *strp, int err) | |
| 16 | +void tls_strp_abort_strp(struct tls_strparser *strp, int err) | |
| 17 | 17 | { |
| 18 | 18 | if (strp->stopped) |
| 19 | 19 | return; |
| @@ -211,11 +211,17 @@ static int tls_strp_copyin_frag(struct tls_strparser *strp, struct sk_buff *skb, · 191 unmodified lines | ||
| 211 | 211 | struct sk_buff *in_skb, unsigned int offset, |
| 212 | 212 | size_t in_len) |
| 213 | 213 | { |
| 214 | + unsigned int nfrag = skb->len / PAGE_SIZE; | |
| 214 | 215 | size_t len, chunk; |
| 215 | 216 | skb_frag_t *frag; |
| 216 | 217 | int sz; |
| 217 | 218 | |
| 218 | − frag = &skb_shinfo(skb)->frags[skb->len / PAGE_SIZE]; | |
| 219 | + if (unlikely(nfrag >= skb_shinfo(skb)->nr_frags)) { | |
| 220 | + DEBUG_NET_WARN_ON_ONCE(1); | |
| 221 | + return -EMSGSIZE; | |
| 222 | + } | |
| 223 | + | |
| 224 | + frag = &skb_shinfo(skb)->frags[nfrag]; | |
| 219 | 225 | |
| 220 | 226 | len = in_len; |
| 221 | 227 | /* First make sure we got the header */ |
| @@ -520,10 +526,8 @@ static int tls_strp_read_sock(struct tls_strparser *strp) · 298 unmodified lines | ||
| 520 | 526 | tls_strp_load_anchor_with_queue(strp, inq); |
| 521 | 527 | if (!strp->stm.full_len) { |
| 522 | 528 | sz = tls_rx_msg_size(strp, strp->anchor); |
| 523 | − if (sz < 0) { | |
| 524 | − tls_strp_abort_strp(strp, sz); | |
| 529 | + if (sz < 0) | |
| 525 | 530 | return sz; |
| 526 | − } | |
| 527 | 531 | |
| 528 | 532 | strp->stm.full_len = sz; |
| 529 | 533 | |
| @@ -2474,8 +2474,7 @@ int tls_rx_msg_size(struct tls_strparser *strp, struct sk_buff *skb) · 2473 unmodified lines | ||
| 2474 | 2474 | return data_len + TLS_HEADER_SIZE; |
| 2475 | 2475 | |
| 2476 | 2476 | read_failure: |
| 2477 | − tls_err_abort(strp->sk, ret); | |
| 2478 | − | |
| 2477 | + tls_strp_abort_strp(strp, ret); | |
| 2479 | 2478 | return ret; |
| 2480 | 2479 | } |
| 2481 | 2480 | |
| @@ -7,6 +7,8 @@ ALL_TESTS=" · 6 unmodified lines | ||
| 7 | 7 | prio |
| 8 | 8 | arp_validate |
| 9 | 9 | num_grat_arp |
| 10 | + fail_over_mac | |
| 11 | + vlan_over_bond | |
| 10 | 12 | " |
| 11 | 13 | |
| 12 | 14 | lib_dir=$(dirname "$0") |
| @@ -352,8 +354,8 @@ garp_test() · 339 unmodified lines | ||
| 352 | 354 | |
| 353 | 355 | exp_num=$(echo "${param}" | cut -f6 -d ' ') |
| 354 | 356 | active_slave=$(cmd_jq "ip -n ${s_ns} -d -j link show bond0" ".[].linkinfo.info_data.active_slave") |
| 355 | − slowwait_for_counter $((exp_num + 5)) $exp_num \ | |
| 356 | − tc_rule_handle_stats_get "dev s${active_slave#eth} ingress" 101 ".packets" "-n ${g_ns}" | |
| 357 | + slowwait_for_counter $((exp_num + 5)) $exp_num tc_rule_handle_stats_get \ | |
| 358 | + "dev s${active_slave#eth} ingress" 101 ".packets" "-n ${g_ns}" &> /dev/null | |
| 357 | 359 | |
| 358 | 360 | # check result |
| 359 | 361 | real_num=$(tc_rule_handle_stats_get "dev s${active_slave#eth} ingress" 101 ".packets" "-n ${g_ns}") |
| @@ -376,6 +378,197 @@ num_grat_arp() · 16 unmodified lines | ||
| 376 | 378 | done |
| 377 | 379 | } |
| 378 | 380 | |
| 381 | +check_all_mac_same() | |
| 382 | +{ | |
| 383 | + RET=0 | |
| 384 | + # all slaves should have same mac address (with the first port's mac) | |
| 385 | + local bond_mac=$(ip -n "$s_ns" -j link show bond0 | jq -r '.[]["address"]') | |
| 386 | + local eth0_mac=$(ip -n "$s_ns" -j link show eth0 | jq -r '.[]["address"]') | |
| 387 | + local eth1_mac=$(ip -n "$s_ns" -j link show eth1 | jq -r '.[]["address"]') | |
| 388 | + local eth2_mac=$(ip -n "$s_ns" -j link show eth2 | jq -r '.[]["address"]') | |
| 389 | + if [ "$bond_mac" != "${mac[0]}" ] || [ "$eth0_mac" != "$bond_mac" ] || \ | |
| 390 | + [ "$eth1_mac" != "$bond_mac" ] || [ "$eth2_mac" != "$bond_mac" ]; then | |
| 391 | + RET=1 | |
| 392 | + fi | |
| 393 | +} | |
| 394 | + | |
| 395 | +check_bond_mac_same_with_first() | |
| 396 | +{ | |
| 397 | + RET=0 | |
| 398 | + # bond mac address should be same with the first added slave | |
| 399 | + local bond_mac=$(ip -n "$s_ns" -j link show bond0 | jq -r '.[]["address"]') | |
| 400 | + if [ "$bond_mac" != "${mac[0]}" ]; then | |
| 401 | + RET=1 | |
| 402 | + fi | |
| 403 | +} | |
| 404 | + | |
| 405 | +check_bond_mac_same_with_active() | |
| 406 | +{ | |
| 407 | + RET=0 | |
| 408 | + # bond mac address should be same with active slave | |
| 409 | + local bond_mac=$(ip -n "$s_ns" -j link show bond0 | jq -r '.[]["address"]') | |
| 410 | + local active_slave=$(cmd_jq "ip -n ${s_ns} -d -j link show bond0" ".[].linkinfo.info_data.active_slave") | |
| 411 | + local active_slave_mac=$(ip -n "$s_ns" -j link show "$active_slave" | jq -r '.[]["address"]') | |
| 412 | + if [ "$bond_mac" != "$active_slave_mac" ]; then | |
| 413 | + RET=1 | |
| 414 | + fi | |
| 415 | +} | |
| 416 | + | |
| 417 | +check_backup_slave_mac_not_change() | |
| 418 | +{ | |
| 419 | + RET=0 | |
| 420 | + # backup slave's mac address is not changed | |
| 421 | + if ip -n "$s_ns" -d -j link show type bond_slave | jq -e '.[] | |
| 422 | + | select(.linkinfo.info_slave_data.state=="BACKUP") | |
| 423 | + | select(.address != .linkinfo.info_slave_data.perm_hwaddr)' &> /dev/null; then | |
| 424 | + RET=1 | |
| 425 | + fi | |
| 426 | +} | |
| 427 | + | |
| 428 | +check_backup_slave_mac_inherit() | |
| 429 | +{ | |
| 430 | + local backup_mac | |
| 431 | + RET=0 | |
| 432 | + | |
| 433 | + # backup slaves should use mac[1] or mac[2] | |
| 434 | + local backup_macs=$(ip -n "$s_ns" -d -j link show type bond_slave | \ | |
| 435 | + jq -r '.[] | select(.linkinfo.info_slave_data.state=="BACKUP") | .address') | |
| 436 | + for backup_mac in $backup_macs; do | |
| 437 | + if [ "$backup_mac" != "${mac[1]}" ] && [ "$backup_mac" != "${mac[2]}" ]; then | |
| 438 | + RET=1 | |
| 439 | + fi | |
| 440 | + done | |
| 441 | +} | |
| 442 | + | |
| 443 | +check_first_slave_random_mac() | |
| 444 | +{ | |
| 445 | + RET=0 | |
| 446 | + # remove the first added slave and added it back | |
| 447 | + ip -n "$s_ns" link set eth0 nomaster | |
| 448 | + ip -n "$s_ns" link set eth0 master bond0 | |
| 449 | + | |
| 450 | + # the first slave should use random mac address | |
| 451 | + eth0_mac=$(ip -n "$s_ns" -j link show eth0 | jq -r '.[]["address"]') | |
| 452 | + [ "$eth0_mac" = "${mac[0]}" ] && RET=1 | |
| 453 | + log_test "bond fail_over_mac follow" "random first slave mac" | |
| 454 | + | |
| 455 | + # remove the first slave, the permanent MAC address should be restored back | |
| 456 | + ip -n "$s_ns" link set eth0 nomaster | |
| 457 | + eth0_mac=$(ip -n "$s_ns" -j link show eth0 | jq -r '.[]["address"]') | |
| 458 | + [ "$eth0_mac" != "${mac[0]}" ] && RET=1 | |
| 459 | +} | |
| 460 | + | |
| 461 | +do_active_backup_failover() | |
| 462 | +{ | |
| 463 | + local active_slave=$(cmd_jq "ip -n ${s_ns} -d -j link show bond0" ".[].linkinfo.info_data.active_slave") | |
| 464 | + ip -n ${s_ns} link set ${active_slave} down | |
| 465 | + slowwait 2 active_slave_changed $active_slave | |
| 466 | + ip -n ${s_ns} link set ${active_slave} up | |
| 467 | +} | |
| 468 | + | |
| 469 | +fail_over_mac() | |
| 470 | +{ | |
| 471 | + # Bring down the first interface on the switch to force the bond to | |
| 472 | + # select another active interface instead of the first one that joined. | |
| 473 | + ip -n "$g_ns" link set s0 down | |
| 474 | + | |
| 475 | + # fail_over_mac none | |
| 476 | + bond_reset "mode active-backup miimon 100 fail_over_mac 0" | |
| 477 | + check_all_mac_same | |
| 478 | + log_test "fail_over_mac 0" "all slaves have same mac" | |
| 479 | + do_active_backup_failover | |
| 480 | + check_all_mac_same | |
| 481 | + log_test "fail_over_mac 0" "failover: all slaves have same mac" | |
| 482 | + | |
| 483 | + # fail_over_mac active | |
| 484 | + bond_reset "mode active-backup miimon 100 fail_over_mac 1" | |
| 485 | + check_bond_mac_same_with_active | |
| 486 | + log_test "fail_over_mac 1" "bond mac is same with active slave mac" | |
| 487 | + check_backup_slave_mac_not_change | |
| 488 | + log_test "fail_over_mac 1" "backup slave mac is not changed" | |
| 489 | + do_active_backup_failover | |
| 490 | + check_bond_mac_same_with_active | |
| 491 | + log_test "fail_over_mac 1" "failover: bond mac is same with active slave mac" | |
| 492 | + check_backup_slave_mac_not_change | |
| 493 | + log_test "fail_over_mac 1" "failover: backup slave mac is not changed" | |
| 494 | + | |
| 495 | + # fail_over_mac follow | |
| 496 | + bond_reset "mode active-backup miimon 100 fail_over_mac 2" | |
| 497 | + check_bond_mac_same_with_first | |
| 498 | + log_test "fail_over_mac 2" "bond mac is same with first slave mac" | |
| 499 | + check_bond_mac_same_with_active | |
| 500 | + log_test "fail_over_mac 2" "bond mac is same with active slave mac" | |
| 501 | + check_backup_slave_mac_inherit | |
| 502 | + log_test "fail_over_mac 2" "backup slave mac inherit" | |
| 503 | + do_active_backup_failover | |
| 504 | + check_bond_mac_same_with_first | |
| 505 | + log_test "fail_over_mac 2" "failover: bond mac is same with first slave mac" | |
| 506 | + check_bond_mac_same_with_active | |
| 507 | + log_test "fail_over_mac 2" "failover: bond mac is same with active slave mac" | |
| 508 | + check_backup_slave_mac_inherit | |
| 509 | + log_test "fail_over_mac 2" "failover: backup slave mac inherit" | |
| 510 | + check_first_slave_random_mac | |
| 511 | + log_test "fail_over_mac 2" "first slave mac random" | |
| 512 | +} | |
| 513 | + | |
| 514 | +vlan_over_bond_arp() | |
| 515 | +{ | |
| 516 | + local mode="$1" | |
| 517 | + RET=0 | |
| 518 | + | |
| 519 | + bond_reset "mode $mode arp_interval 100 arp_ip_target 192.0.3.10" | |
| 520 | + ip -n "${s_ns}" link add bond0.3 link bond0 type vlan id 3 | |
| 521 | + ip -n "${s_ns}" link set bond0.3 up | |
| 522 | + ip -n "${s_ns}" addr add 192.0.3.1/24 dev bond0.3 | |
| 523 | + ip -n "${s_ns}" addr add 2001:db8::3:1/64 dev bond0.3 | |
| 524 | + | |
| 525 | + slowwait_for_counter 5 5 tc_rule_handle_stats_get \ | |
| 526 | + "dev eth0.3 ingress" 101 ".packets" "-n ${c_ns}" &> /dev/null || RET=1 | |
| 527 | + log_test "vlan over bond arp" "$mode" | |
| 528 | +} | |
| 529 | + | |
| 530 | +vlan_over_bond_ns() | |
| 531 | +{ | |
| 532 | + local mode="$1" | |
| 533 | + RET=0 | |
| 534 | + | |
| 535 | + if skip_ns; then | |
| 536 | + log_test_skip "vlan_over_bond ns" "$mode" | |
| 537 | + return 0 | |
| 538 | + fi | |
| 539 | + | |
| 540 | + bond_reset "mode $mode arp_interval 100 ns_ip6_target 2001:db8::3:10" | |
| 541 | + ip -n "${s_ns}" link add bond0.3 link bond0 type vlan id 3 | |
| 542 | + ip -n "${s_ns}" link set bond0.3 up | |
| 543 | + ip -n "${s_ns}" addr add 192.0.3.1/24 dev bond0.3 | |
| 544 | + ip -n "${s_ns}" addr add 2001:db8::3:1/64 dev bond0.3 | |
| 545 | + | |
| 546 | + slowwait_for_counter 5 5 tc_rule_handle_stats_get \ | |
| 547 | + "dev eth0.3 ingress" 102 ".packets" "-n ${c_ns}" &> /dev/null || RET=1 | |
| 548 | + log_test "vlan over bond ns" "$mode" | |
| 549 | +} | |
| 550 | + | |
| 551 | +vlan_over_bond() | |
| 552 | +{ | |
| 553 | + # add vlan 3 for client | |
| 554 | + ip -n "${c_ns}" link add eth0.3 link eth0 type vlan id 3 | |
| 555 | + ip -n "${c_ns}" link set eth0.3 up | |
| 556 | + ip -n "${c_ns}" addr add 192.0.3.10/24 dev eth0.3 | |
| 557 | + ip -n "${c_ns}" addr add 2001:db8::3:10/64 dev eth0.3 | |
| 558 | + | |
| 559 | + # Add tc rule to check the vlan pkts | |
| 560 | + tc -n "${c_ns}" qdisc add dev eth0.3 clsact | |
| 561 | + tc -n "${c_ns}" filter add dev eth0.3 ingress protocol arp \ | |
| 562 | + handle 101 flower skip_hw arp_op request \ | |
| 563 | + arp_sip 192.0.3.1 arp_tip 192.0.3.10 action pass | |
| 564 | + tc -n "${c_ns}" filter add dev eth0.3 ingress protocol ipv6 \ | |
| 565 | + handle 102 flower skip_hw ip_proto icmpv6 \ | |
| 566 | + type 135 src_ip 2001:db8::3:1 action pass | |
| 567 | + | |
| 568 | + vlan_over_bond_arp "active-backup" | |
| 569 | + vlan_over_bond_ns "active-backup" | |
| 570 | +} | |
| 571 | + | |
| 379 | 572 | trap cleanup EXIT |
| 380 | 573 | |
| 381 | 574 | setup_prepare |
| @@ -39,6 +39,8 @@ g_ip4="192.0.2.254" · 38 unmodified lines | ||
| 39 | 39 | s_ip6="2001:db8::1" |
| 40 | 40 | c_ip6="2001:db8::10" |
| 41 | 41 | g_ip6="2001:db8::254" |
| 42 | +mac[0]="00:0a:0b:0c:0d:01" | |
| 43 | +mac[1]="00:0a:0b:0c:0d:02" | |
| 42 | 44 | |
| 43 | 45 | gateway_create() |
| 44 | 46 | { |
| @@ -62,6 +64,7 @@ server_create() · 17 unmodified lines | ||
| 62 | 64 | |
| 63 | 65 | for i in $(seq 0 1); do |
| 64 | 66 | ip -n ${s_ns} link add eth${i} type veth peer name s${i} netns ${g_ns} |
| 67 | + ip -n "${s_ns}" link set "eth${i}" addr "${mac[$i]}" | |
| 65 | 68 | |
| 66 | 69 | ip -n ${g_ns} link set s${i} up |
| 67 | 70 | ip -n ${g_ns} link set s${i} master br0 |
| @@ -26,6 +26,7 @@ · 25 unmodified lines | ||
| 26 | 26 | # +-------------------------------------+ |
| 27 | 27 | |
| 28 | 28 | source bond_topo_2d1c.sh |
| 29 | +mac[2]="00:0a:0b:0c:0d:03" | |
| 29 | 30 | |
| 30 | 31 | setup_prepare() |
| 31 | 32 | { |
| @@ -36,6 +37,7 @@ setup_prepare() · 4 unmodified lines | ||
| 36 | 37 | # Add the extra device as we use 3 down links for bond0 |
| 37 | 38 | local i=2 |
| 38 | 39 | ip -n ${s_ns} link add eth${i} type veth peer name s${i} netns ${g_ns} |
| 40 | + ip -n "${s_ns}" link set "eth${i}" addr "${mac[$i]}" | |
| 39 | 41 | ip -n ${g_ns} link set s${i} up |
| 40 | 42 | ip -n ${g_ns} link set s${i} master br0 |
| 41 | 43 | ip -n ${s_ns} link set eth${i} master bond0 |
| @@ -10,3 +10,4 @@ CONFIG_NET_CLS_MATCHALL=m · 9 unmodified lines | ||
| 10 | 10 | CONFIG_NET_SCH_INGRESS=y |
| 11 | 11 | CONFIG_NLMON=y |
| 12 | 12 | CONFIG_VETH=y |
| 13 | +CONFIG_VLAN_8021Q=m | |
| @@ -1093,6 +1093,7 @@ int main_loop_s(int listensock) · 1092 unmodified lines | ||
| 1093 | 1093 | struct pollfd polls; |
| 1094 | 1094 | socklen_t salen; |
| 1095 | 1095 | int remotesock; |
| 1096 | + int err = 0; | |
| 1096 | 1097 | int fd = 0; |
| 1097 | 1098 | |
| 1098 | 1099 | again: |
| @@ -1125,7 +1126,7 @@ again: · 26 unmodified lines | ||
| 1125 | 1126 | SOCK_TEST_TCPULP(remotesock, 0); |
| 1126 | 1127 | |
| 1127 | 1128 | memset(&winfo, 0, sizeof(winfo)); |
| 1128 | − copyfd_io(fd, remotesock, 1, true, &winfo); | |
| 1129 | + err = copyfd_io(fd, remotesock, 1, true, &winfo); | |
| 1129 | 1130 | } else { |
| 1130 | 1131 | perror("accept"); |
| 1131 | 1132 | return 1; |
| @@ -1134,10 +1135,10 @@ again: · 2 unmodified lines | ||
| 1134 | 1135 | if (cfg_input) |
| 1135 | 1136 | close(fd); |
| 1136 | 1137 | |
| 1137 | − if (--cfg_repeat > 0) | |
| 1138 | + if (!err && --cfg_repeat > 0) | |
| 1138 | 1139 | goto again; |
| 1139 | 1140 | |
| 1140 | − return 0; | |
| 1141 | + return err; | |
| 1141 | 1142 | } |
| 1142 | 1143 | |
| 1143 | 1144 | static void init_rng(void) |
| @@ -1247,7 +1248,7 @@ void xdisconnect(int fd) · 103 unmodified lines | ||
| 1247 | 1248 | else |
| 1248 | 1249 | xerror("bad family"); |
| 1249 | 1250 | |
| 1250 | − strcpy(cmd, "ss -M | grep -q "); | |
| 1251 | + strcpy(cmd, "ss -Mnt | grep -q "); | |
| 1251 | 1252 | cmdlen = strlen(cmd); |
| 1252 | 1253 | if (!inet_ntop(addr.ss_family, raw_addr, &cmd[cmdlen], |
| 1253 | 1254 | sizeof(cmd) - cmdlen)) |
| @@ -1257,7 +1258,7 @@ void xdisconnect(int fd) · 3 unmodified lines | ||
| 1257 | 1258 | |
| 1258 | 1259 | /* |
| 1259 | 1260 | * wait until the pending data is completely flushed and all |
| 1260 | − * the MPTCP sockets reached the closed status. | |
| 1261 | + * the sockets reached the closed status. | |
| 1261 | 1262 | * disconnect will bypass/ignore/drop any pending data. |
| 1262 | 1263 | */ |
| 1263 | 1264 | for (i = 0; ; i += msec_sleep) { |
| @@ -211,6 +211,11 @@ if $checksum; then · 210 unmodified lines | ||
| 211 | 211 | done |
| 212 | 212 | fi |
| 213 | 213 | |
| 214 | +if $capture; then | |
| 215 | + rndh="${ns1:4}" | |
| 216 | + mptcp_lib_pr_info "Packet capture files will have this prefix: ${rndh}-" | |
| 217 | +fi | |
| 218 | + | |
| 214 | 219 | set_ethtool_flags() { |
| 215 | 220 | local ns="$1" |
| 216 | 221 | local dev="$2" |
| @@ -361,7 +366,6 @@ do_transfer() · 144 unmodified lines | ||
| 361 | 366 | |
| 362 | 367 | if $capture; then |
| 363 | 368 | local capuser |
| 364 | − local rndh="${connector_ns:4}" | |
| 365 | 369 | if [ -z $SUDO_USER ] ; then |
| 366 | 370 | capuser="" |
| 367 | 371 | else |
| @@ -384,7 +384,7 @@ mptcp_lib_make_file() { · 383 unmodified lines | ||
| 384 | 384 | mptcp_lib_print_file_err() { |
| 385 | 385 | ls -l "${1}" 1>&2 |
| 386 | 386 | echo "Trailing bytes are: " |
| 387 | − tail -c 27 "${1}" | |
| 387 | + tail -c 32 "${1}" | od -x | head -n2 | |
| 388 | 388 | } |
| 389 | 389 | |
| 390 | 390 | # $1: input file ; $2: output file ; $3: what kind of file |
| @@ -667,22 +667,26 @@ static void process_one_client(int fd, int pipefd) · 666 unmodified lines | ||
| 667 | 667 | |
| 668 | 668 | do_getsockopts(&s, fd, ret, ret2); |
| 669 | 669 | if (s.mptcpi_rcv_delta != (uint64_t)ret + 1) |
| 670 | − xerror("mptcpi_rcv_delta %" PRIu64 ", expect %" PRIu64, s.mptcpi_rcv_delta, ret + 1, s.mptcpi_rcv_delta - ret); | |
| 670 | + xerror("mptcpi_rcv_delta %" PRIu64 ", expect %" PRIu64 ", diff %" PRId64, | |
| 671 | + s.mptcpi_rcv_delta, ret + 1, s.mptcpi_rcv_delta - (ret + 1)); | |
| 671 | 672 | |
| 672 | 673 | /* be nice when running on top of older kernel */ |
| 673 | 674 | if (s.pkt_stats_avail) { |
| 674 | 675 | if (s.last_sample.mptcpi_bytes_sent != ret2) |
| 675 | − xerror("mptcpi_bytes_sent %" PRIu64 ", expect %" PRIu64, | |
| 676 | + xerror("mptcpi_bytes_sent %" PRIu64 ", expect %" PRIu64 | |
| 677 | + ", diff %" PRId64, | |
| 676 | 678 | s.last_sample.mptcpi_bytes_sent, ret2, |
| 677 | 679 | s.last_sample.mptcpi_bytes_sent - ret2); |
| 678 | 680 | if (s.last_sample.mptcpi_bytes_received != ret) |
| 679 | − xerror("mptcpi_bytes_received %" PRIu64 ", expect %" PRIu64, | |
| 681 | + xerror("mptcpi_bytes_received %" PRIu64 ", expect %" PRIu64 | |
| 682 | + ", diff %" PRId64, | |
| 680 | 683 | s.last_sample.mptcpi_bytes_received, ret, |
| 681 | 684 | s.last_sample.mptcpi_bytes_received - ret); |
| 682 | 685 | if (s.last_sample.mptcpi_bytes_acked != ret) |
| 683 | − xerror("mptcpi_bytes_acked %" PRIu64 ", expect %" PRIu64, | |
| 684 | − s.last_sample.mptcpi_bytes_acked, ret2, | |
| 685 | − s.last_sample.mptcpi_bytes_acked - ret2); | |
| 686 | + xerror("mptcpi_bytes_acked %" PRIu64 ", expect %" PRIu64 | |
| 687 | + ", diff %" PRId64, | |
| 688 | + s.last_sample.mptcpi_bytes_acked, ret, | |
| 689 | + s.last_sample.mptcpi_bytes_acked - ret); | |
| 686 | 690 | } |
| 687 | 691 | |
| 688 | 692 | close(fd); |
| @@ -188,6 +188,13 @@ static int capture_events(int fd, int event_group) · 187 unmodified lines | ||
| 188 | 188 | fprintf(stderr, ",error:%u", *(__u8 *)RTA_DATA(attrs)); |
| 189 | 189 | else if (attrs->rta_type == MPTCP_ATTR_SERVER_SIDE) |
| 190 | 190 | fprintf(stderr, ",server_side:%u", *(__u8 *)RTA_DATA(attrs)); |
| 191 | + else if (attrs->rta_type == MPTCP_ATTR_FLAGS) { | |
| 192 | + __u16 flags = *(__u16 *)RTA_DATA(attrs); | |
| 193 | + | |
| 194 | + /* only print when present, easier */ | |
| 195 | + if (flags & MPTCP_PM_EV_FLAG_DENY_JOIN_ID0) | |
| 196 | + fprintf(stderr, ",deny_join_id0:1"); | |
| 197 | + } | |
| 191 | 198 | |
| 192 | 199 | attrs = RTA_NEXT(attrs, msg_len); |
| 193 | 200 | } |
| @@ -201,6 +201,9 @@ make_connection() · 200 unmodified lines | ||
| 201 | 201 | is_v6="v4" |
| 202 | 202 | fi |
| 203 | 203 | |
| 204 | + # set this on the client side only: will not affect the rest | |
| 205 | + ip netns exec "$ns2" sysctl -q net.mptcp.allow_join_initial_addr_port=0 | |
| 206 | + | |
| 204 | 207 | :>"$client_evts" |
| 205 | 208 | :>"$server_evts" |
| 206 | 209 | |
| @@ -223,23 +226,28 @@ make_connection() · 16 unmodified lines | ||
| 223 | 226 | local client_token |
| 224 | 227 | local client_port |
| 225 | 228 | local client_serverside |
| 229 | + local client_nojoin | |
| 226 | 230 | local server_token |
| 227 | 231 | local server_serverside |
| 232 | + local server_nojoin | |
| 228 | 233 | |
| 229 | 234 | client_token=$(mptcp_lib_evts_get_info token "$client_evts") |
| 230 | 235 | client_port=$(mptcp_lib_evts_get_info sport "$client_evts") |
| 231 | 236 | client_serverside=$(mptcp_lib_evts_get_info server_side "$client_evts") |
| 237 | + client_nojoin=$(mptcp_lib_evts_get_info deny_join_id0 "$client_evts") | |
| 232 | 238 | server_token=$(mptcp_lib_evts_get_info token "$server_evts") |
| 233 | 239 | server_serverside=$(mptcp_lib_evts_get_info server_side "$server_evts") |
| 240 | + server_nojoin=$(mptcp_lib_evts_get_info deny_join_id0 "$server_evts") | |
| 234 | 241 | |
| 235 | 242 | print_test "Established IP${is_v6} MPTCP Connection ns2 => ns1" |
| 236 | − if [ "$client_token" != "" ] && [ "$server_token" != "" ] && [ "$client_serverside" = 0 ] && | |
| 237 | − [ "$server_serverside" = 1 ] | |
| 243 | + if [ "${client_token}" != "" ] && [ "${server_token}" != "" ] && | |
| 244 | + [ "${client_serverside}" = 0 ] && [ "${server_serverside}" = 1 ] && | |
| 245 | + [ "${client_nojoin:-0}" = 0 ] && [ "${server_nojoin:-0}" = 1 ] | |
| 238 | 246 | then |
| 239 | 247 | test_pass |
| 240 | 248 | print_title "Connection info: ${client_addr}:${client_port} -> ${connect_addr}:${app_port}" |
| 241 | 249 | else |
| 242 | − test_fail "Expected tokens (c:${client_token} - s:${server_token}) and server (c:${client_serverside} - s:${server_serverside})" | |
| 250 | + test_fail "Expected tokens (c:${client_token} - s:${server_token}), server (c:${client_serverside} - s:${server_serverside}), nojoin (c:${client_nojoin} - s:${server_nojoin})" | |
| 243 | 251 | mptcp_lib_result_print_all_tap |
| 244 | 252 | exit ${KSFT_FAIL} |
| 245 | 253 | fi |
| @@ -25,6 +25,7 @@ tests=" · 24 unmodified lines | ||
| 25 | 25 | nat_related_v4 ip4-nat-related: ICMP related matches work with SNAT |
| 26 | 26 | netlink_checks ovsnl: validate netlink attrs and settings |
| 27 | 27 | upcall_interfaces ovs: test the upcall interfaces |
| 28 | + tunnel_metadata ovs: test extraction of tunnel metadata | |
| 28 | 29 | drop_reason drop: test drop reasons are emitted |
| 29 | 30 | psample psample: Sampling packets with psample" |
| 30 | 31 | |
| @@ -113,13 +114,13 @@ ovs_add_dp () { · 82 unmodified lines | ||
| 113 | 114 | } |
| 114 | 115 | |
| 115 | 116 | ovs_add_if () { |
| 116 | − info "Adding IF to DP: br:$2 if:$3" | |
| 117 | − if [ "$4" != "-u" ]; then | |
| 118 | − ovs_sbx "$1" python3 $ovs_base/ovs-dpctl.py add-if "$2" "$3" \ | |
| 119 | − || return 1 | |
| 117 | + info "Adding IF to DP: br:$3 if:$4 ($2)" | |
| 118 | + if [ "$5" != "-u" ]; then | |
| 119 | + ovs_sbx "$1" python3 $ovs_base/ovs-dpctl.py add-if \ | |
| 120 | + -t "$2" "$3" "$4" || return 1 | |
| 120 | 121 | else |
| 121 | 122 | python3 $ovs_base/ovs-dpctl.py add-if \ |
| 122 | − -u "$2" "$3" >$ovs_dir/$3.out 2>$ovs_dir/$3.err & | |
| 123 | + -u -t "$2" "$3" "$4" >$ovs_dir/$4.out 2>$ovs_dir/$4.err & | |
| 123 | 124 | pid=$! |
| 124 | 125 | on_exit "ovs_sbx $1 kill -TERM $pid 2>/dev/null" |
| 125 | 126 | fi |
| @@ -166,9 +167,9 @@ ovs_add_netns_and_veths () { · 40 unmodified lines | ||
| 166 | 167 | fi |
| 167 | 168 | |
| 168 | 169 | if [ "$7" != "-u" ]; then |
| 169 | − ovs_add_if "$1" "$2" "$4" || return 1 | |
| 170 | + ovs_add_if "$1" "netdev" "$2" "$4" || return 1 | |
| 170 | 171 | else |
| 171 | − ovs_add_if "$1" "$2" "$4" -u || return 1 | |
| 172 | + ovs_add_if "$1" "netdev" "$2" "$4" -u || return 1 | |
| 172 | 173 | fi |
| 173 | 174 | |
| 174 | 175 | if [ $TRACING -eq 1 ]; then |
| @@ -756,6 +757,79 @@ test_upcall_interfaces() { · 581 unmodified lines | ||
| 756 | 757 | return 0 |
| 757 | 758 | } |
| 758 | 759 | |
| 760 | +ovs_add_kernel_tunnel() { | |
| 761 | + local sbxname=$1; shift | |
| 762 | + local ns=$1; shift | |
| 763 | + local tnl_type=$1; shift | |
| 764 | + local name=$1; shift | |
| 765 | + local addr=$1; shift | |
| 766 | + | |
| 767 | + info "setting up kernel ${tnl_type} tunnel ${name}" | |
| 768 | + ovs_sbx "${sbxname}" ip -netns ${ns} link add dev ${name} type ${tnl_type} $* || return 1 | |
| 769 | + on_exit "ovs_sbx ${sbxname} ip -netns ${ns} link del ${name} >/dev/null 2>&1" | |
| 770 | + ovs_sbx "${sbxname}" ip -netns ${ns} addr add dev ${name} ${addr} || return 1 | |
| 771 | + ovs_sbx "${sbxname}" ip -netns ${ns} link set dev ${name} mtu 1450 up || return 1 | |
| 772 | +} | |
| 773 | + | |
| 774 | +test_tunnel_metadata() { | |
| 775 | + which arping >/dev/null 2>&1 || return $ksft_skip | |
| 776 | + | |
| 777 | + sbxname="test_tunnel_metadata" | |
| 778 | + sbx_add "${sbxname}" || return 1 | |
| 779 | + | |
| 780 | + info "setting up new DP" | |
| 781 | + ovs_add_dp "${sbxname}" tdp0 -V 2:1 || return 1 | |
| 782 | + | |
| 783 | + ovs_add_netns_and_veths "${sbxname}" tdp0 tns left0 l0 \ | |
| 784 | + 172.31.110.1/24 || return 1 | |
| 785 | + | |
| 786 | + info "removing veth interface from openvswitch and setting IP" | |
| 787 | + ovs_del_if "${sbxname}" tdp0 left0 || return 1 | |
| 788 | + ovs_sbx "${sbxname}" ip addr add 172.31.110.2/24 dev left0 || return 1 | |
| 789 | + ovs_sbx "${sbxname}" ip link set left0 up || return 1 | |
| 790 | + | |
| 791 | + info "setting up tunnel port in openvswitch" | |
| 792 | + ovs_add_if "${sbxname}" "vxlan" tdp0 ovs-vxlan0 -u || return 1 | |
| 793 | + on_exit "ovs_sbx ${sbxname} ip link del ovs-vxlan0" | |
| 794 | + ovs_wait ip link show ovs-vxlan0 &>/dev/null || return 1 | |
| 795 | + ovs_sbx "${sbxname}" ip link set ovs-vxlan0 up || return 1 | |
| 796 | + | |
| 797 | + configs=$(echo ' | |
| 798 | + 1 172.31.221.1/24 1155332 32 set udpcsum flags\(df\|csum\) | |
| 799 | + 2 172.31.222.1/24 1234567 45 set noudpcsum flags\(df\) | |
| 800 | + 3 172.31.223.1/24 1020304 23 unset udpcsum flags\(csum\) | |
| 801 | + 4 172.31.224.1/24 1357986 15 unset noudpcsum' | sed '/^$/d') | |
| 802 | + | |
| 803 | + while read -r i addr id ttl df csum flags; do | |
| 804 | + ovs_add_kernel_tunnel "${sbxname}" tns vxlan vxlan${i} ${addr} \ | |
| 805 | + remote 172.31.110.2 id ${id} dstport 4789 \ | |
| 806 | + ttl ${ttl} df ${df} ${csum} || return 1 | |
| 807 | + done <<< "${configs}" | |
| 808 | + | |
| 809 | + ovs_wait grep -q 'listening on upcall packet handler' \ | |
| 810 | + ${ovs_dir}/ovs-vxlan0.out || return 1 | |
| 811 | + | |
| 812 | + info "sending arping" | |
| 813 | + for i in 1 2 3 4; do | |
| 814 | + ovs_sbx "${sbxname}" ip netns exec tns \ | |
| 815 | + arping -I vxlan${i} 172.31.22${i}.2 -c 1 \ | |
| 816 | + >${ovs_dir}/arping.stdout 2>${ovs_dir}/arping.stderr | |
| 817 | + done | |
| 818 | + | |
| 819 | + info "checking that received decapsulated packets carry correct metadata" | |
| 820 | + while read -r i addr id ttl df csum flags; do | |
| 821 | + arp_hdr="arp\\(sip=172.31.22${i}.1,tip=172.31.22${i}.2,op=1,sha=" | |
| 822 | + addrs="src=172.31.110.1,dst=172.31.110.2" | |
| 823 | + ports="tp_src=[0-9]*,tp_dst=4789" | |
| 824 | + tnl_md="tunnel\\(tun_id=${id},${addrs},ttl=${ttl},${ports},${flags}\\)" | |
| 825 | + | |
| 826 | + ovs_sbx "${sbxname}" grep -qE "MISS upcall.*${tnl_md}.*${arp_hdr}" \ | |
| 827 | + ${ovs_dir}/ovs-vxlan0.out || return 1 | |
| 828 | + done <<< "${configs}" | |
| 829 | + | |
| 830 | + return 0 | |
| 831 | +} | |
| 832 | + | |
| 759 | 833 | run_test() { |
| 760 | 834 | ( |
| 761 | 835 | tname="$1" |
| @@ -0,0 +1,26 @@ | ||
| 1 | +// SPDX-License-Identifier: GPL-2.0 | |
| 2 | +`./defaults.sh | |
| 3 | + ./set_sysctls.py /proc/sys/net/ipv4/tcp_fastopen=0x602 /proc/sys/net/ipv4/tcp_timestamps=0` | |
| 4 | + | |
| 5 | + 0 socket(..., SOCK_STREAM|SOCK_NONBLOCK, IPPROTO_TCP) = 3 | |
| 6 | + +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 | |
| 7 | + +0 bind(3, ..., ...) = 0 | |
| 8 | + +0 listen(3, 1) = 0 | |
| 9 | + | |
| 10 | + +0 < S 0:10(10) win 32792 <mss 1460,nop,nop,sackOK> | |
| 11 | + +0 > S. 0:0(0) ack 11 win 65535 <mss 1460,nop,nop,sackOK> | |
| 12 | + | |
| 13 | +// sk->sk_state is TCP_SYN_RECV | |
| 14 | + +.1 accept(3, ..., ...) = 4 | |
| 15 | + | |
| 16 | +// tcp_disconnect() sets sk->sk_state to TCP_CLOSE | |
| 17 | + +0 connect(4, AF_UNSPEC, ...) = 0 | |
| 18 | + +0 > R. 1:1(0) ack 11 win 65535 | |
| 19 | + | |
| 20 | +// connect() sets sk->sk_state to TCP_SYN_SENT | |
| 21 | + +0 fcntl(4, F_SETFL, O_RDWR|O_NONBLOCK) = 0 | |
| 22 | + +0 connect(4, ..., ...) = -1 EINPROGRESS (Operation is now in progress) | |
| 23 | + +0 > S 0:0(0) win 65535 <mss 1460,nop,nop,sackOK,nop,wscale 8> | |
| 24 | + | |
| 25 | +// tp->fastopen_rsk must be NULL | |
| 26 | + +1 > S 0:0(0) win 65535 <mss 1460,nop,nop,sackOK,nop,wscale 8> | |
| @@ -2770,6 +2770,22 @@ TEST_F(tls_err, poll_partial_rec_async) · 2769 unmodified lines | ||
| 2770 | 2770 | } |
| 2771 | 2771 | } |
| 2772 | 2772 | |
| 2773 | +/* Use OOB+large send to trigger copy mode due to memory pressure. | |
| 2774 | + * OOB causes a short read. | |
| 2775 | + */ | |
| 2776 | +TEST_F(tls_err, oob_pressure) | |
| 2777 | +{ | |
| 2778 | + char buf[1<<16]; | |
| 2779 | + int i; | |
| 2780 | + | |
| 2781 | + memrnd(buf, sizeof(buf)); | |
| 2782 | + | |
| 2783 | + EXPECT_EQ(send(self->fd2, buf, 5, MSG_OOB), 5); | |
| 2784 | + EXPECT_EQ(send(self->fd2, buf, sizeof(buf), 0), sizeof(buf)); | |
| 2785 | + for (i = 0; i < 64; i++) | |
| 2786 | + EXPECT_EQ(send(self->fd2, buf, 5, MSG_OOB), 5); | |
| 2787 | +} | |
| 2788 | + | |
| 2773 | 2789 | TEST(non_established) { |
| 2774 | 2790 | struct tls12_crypto_info_aes_gcm_256 tls12; |
| 2775 | 2791 | struct sockaddr_in addr; |