File tree Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -1341,6 +1341,19 @@ static void ndisc_redirect_rcv(struct sk_buff *skb)
13411341 icmpv6_notify (skb , NDISC_REDIRECT , 0 , 0 );
13421342}
13431343
1344+ static u8 * ndisc_fill_redirect_hdr_option (u8 * opt , struct sk_buff * orig_skb ,
1345+ int rd_len )
1346+ {
1347+ memset (opt , 0 , 8 );
1348+ * (opt ++ ) = ND_OPT_REDIRECT_HDR ;
1349+ * (opt ++ ) = (rd_len >> 3 );
1350+ opt += 6 ;
1351+
1352+ memcpy (opt , ipv6_hdr (orig_skb ), rd_len - 8 );
1353+
1354+ return opt + rd_len - 8 ;
1355+ }
1356+
13441357void ndisc_send_redirect (struct sk_buff * skb , const struct in6_addr * target )
13451358{
13461359 struct net_device * dev = skb -> dev ;
@@ -1470,12 +1483,8 @@ void ndisc_send_redirect(struct sk_buff *skb, const struct in6_addr *target)
14701483 * build redirect option and copy skb over to the new packet.
14711484 */
14721485
1473- memset (opt , 0 , 8 );
1474- * (opt ++ ) = ND_OPT_REDIRECT_HDR ;
1475- * (opt ++ ) = (rd_len >> 3 );
1476- opt += 6 ;
1477-
1478- memcpy (opt , ipv6_hdr (skb ), rd_len - 8 );
1486+ if (rd_len )
1487+ opt = ndisc_fill_redirect_hdr_option (opt , skb , rd_len );
14791488
14801489 msg -> icmph .icmp6_cksum = csum_ipv6_magic (& saddr_buf , & ipv6_hdr (skb )-> saddr ,
14811490 len , IPPROTO_ICMPV6 ,
You can’t perform that action at this time.
0 commit comments