Skip to content

Commit ed0de45

Browse files
ssuryaextrdavem330
authored andcommitted
ipv4: recompile ip options in ipv4_link_failure
Recompile IP options since IPCB may not be valid anymore when ipv4_link_failure is called from arp_error_report. Refer to the commit 3da1ed7 ("net: avoid use IPCB in cipso_v4_error") and the commit before that (9ef6b42) for a similar issue. Signed-off-by: Stephen Suryaputra <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9e550f0 commit ed0de45

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

net/ipv4/route.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1186,8 +1186,16 @@ static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie)
11861186
static void ipv4_link_failure(struct sk_buff *skb)
11871187
{
11881188
struct rtable *rt;
1189+
struct ip_options opt;
11891190

1190-
icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_UNREACH, 0);
1191+
/* Recompile ip options since IPCB may not be valid anymore.
1192+
*/
1193+
memset(&opt, 0, sizeof(opt));
1194+
opt.optlen = ip_hdr(skb)->ihl*4 - sizeof(struct iphdr);
1195+
if (__ip_options_compile(dev_net(skb->dev), &opt, skb, NULL))
1196+
return;
1197+
1198+
__icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_UNREACH, 0, &opt);
11911199

11921200
rt = skb_rtable(skb);
11931201
if (rt)

0 commit comments

Comments
 (0)