Skip to content

Commit 3bdefdf

Browse files
Paolo Abenidavem330
authored andcommitted
udp: no need to preserve skb->dst
__ip_options_echo() does not need anymore skb->dst, so we can avoid explicitly preserving it for its own sake. This is almost a revert of commit 0ddf3fb ("udp: preserve skb->dst if required for IP options processing") plus some lifting to fit later changes. Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 61a1030 commit 3bdefdf

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

net/ipv4/udp.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,7 +1176,11 @@ static void udp_set_dev_scratch(struct sk_buff *skb)
11761176
scratch->csum_unnecessary = !!skb_csum_unnecessary(skb);
11771177
scratch->is_linear = !skb_is_nonlinear(skb);
11781178
#endif
1179-
if (likely(!skb->_skb_refdst))
1179+
/* all head states execept sp (dst, sk, nf) are always cleared by
1180+
* udp_rcv() and we need to preserve secpath, if present, to eventually
1181+
* process IP_CMSG_PASSSEC at recvmsg() time
1182+
*/
1183+
if (likely(!skb_sec_path(skb)))
11801184
scratch->_tsize_state |= UDP_SKB_IS_STATELESS;
11811185
}
11821186

@@ -1782,13 +1786,6 @@ static int __udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
17821786
sk_mark_napi_id_once(sk, skb);
17831787
}
17841788

1785-
/* At recvmsg() time we may access skb->dst or skb->sp depending on
1786-
* the IP options and the cmsg flags, elsewhere can we clear all
1787-
* pending head states while they are hot in the cache
1788-
*/
1789-
if (likely(IPCB(skb)->opt.optlen == 0 && !skb_sec_path(skb)))
1790-
skb_release_head_state(skb);
1791-
17921789
rc = __udp_enqueue_schedule_skb(sk, skb);
17931790
if (rc < 0) {
17941791
int is_udplite = IS_UDPLITE(sk);

0 commit comments

Comments
 (0)