History

ipv4: Fix ip_skb_dst_mtu to use the sk passed by ip_finish_output

ip_skb_dst_mtu uses skb->sk, assuming it is an AF_INET socket (e.g. it calls ip_sk_use_pmtu which casts sk as an inet_sk). However, in the case of UDP tunneling, the skb->sk is not necessarily an inet socket (could be AF_PACKET socket, or AF_UNSPEC if arriving from tun/tap). OTOH, the sk passed as an argument throughout IP stack's output path is the one which is of PMTU interest: - In case of local sockets, sk is same as skb->sk; - In case of a udp tunnel, sk is the tunneling socket. Fix, by passing ip_finish_output's sk to ip_skb_dst_mtu. This augments 7026b1ddb6 'netfilter: Pass socket pointer down through okfn().'

Shmulik Ladkani committed 10 years ago

Commit fedbb6b1 parent 5ab0d6a3 files · +5 −6Browse files

Showing the changes to include/net (1 of 3 files). Show all

Unified · Split

include/net/ip.h+2−3
@@ -313,10 +313,9 @@ static inline unsigned int ip_dst_mtu_maybe_forward(const struct dst_entry *dst, · 312 unmodified lines
313 return min(dst->dev->mtu, IP_MAX_MTU);313 return min(dst->dev->mtu, IP_MAX_MTU);
314}314}
315 315
316static inline unsigned int ip_skb_dst_mtu(const struct sk_buff *skb)316static inline unsigned int ip_skb_dst_mtu(struct sock *sk,
317 const struct sk_buff *skb)
317{318{
318 struct sock *sk = skb->sk;
319
320 if (!sk || !sk_fullsock(sk) || ip_sk_use_pmtu(sk)) {319 if (!sk || !sk_fullsock(sk) || ip_sk_use_pmtu(sk)) {
321 bool forwarding = IPCB(skb)->flags & IPSKB_FORWARDED;320 bool forwarding = IPCB(skb)->flags & IPSKB_FORWARDED;
322 321

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