File tree Expand file tree Collapse file tree 4 files changed +18
-8
lines changed Expand file tree Collapse file tree 4 files changed +18
-8
lines changed Original file line number Diff line number Diff line change 7373 FN(FRAG_TOO_FAR) \
7474 FN(TCP_MINTTL) \
7575 FN(IPV6_BAD_EXTHDR) \
76+ FN(IPV6_NDISC_FRAG) \
77+ FN(IPV6_NDISC_HOP_LIMIT) \
78+ FN(IPV6_NDISC_BAD_CODE) \
7679 FNe(MAX)
7780
7881/**
@@ -321,6 +324,12 @@ enum skb_drop_reason {
321324 SKB_DROP_REASON_TCP_MINTTL ,
322325 /** @SKB_DROP_REASON_IPV6_BAD_EXTHDR: Bad IPv6 extension header. */
323326 SKB_DROP_REASON_IPV6_BAD_EXTHDR ,
327+ /** @SKB_DROP_REASON_IPV6_NDISC_FRAG: invalid frag (suppress_frag_ndisc). */
328+ SKB_DROP_REASON_IPV6_NDISC_FRAG ,
329+ /** @SKB_DROP_REASON_IPV6_NDISC_HOP_LIMIT: invalid hop limit. */
330+ SKB_DROP_REASON_IPV6_NDISC_HOP_LIMIT ,
331+ /** @SKB_DROP_REASON_IPV6_NDISC_BAD_CODE: invalid NDISC icmp6 code. */
332+ SKB_DROP_REASON_IPV6_NDISC_BAD_CODE ,
324333 /**
325334 * @SKB_DROP_REASON_MAX: the maximum of drop reason, which shouldn't be
326335 * used as a real 'reason'
Original file line number Diff line number Diff line change @@ -445,7 +445,7 @@ int ndisc_late_init(void);
445445void ndisc_late_cleanup (void );
446446void ndisc_cleanup (void );
447447
448- int ndisc_rcv (struct sk_buff * skb );
448+ enum skb_drop_reason ndisc_rcv (struct sk_buff * skb );
449449
450450struct sk_buff * ndisc_ns_create (struct net_device * dev , const struct in6_addr * solicit ,
451451 const struct in6_addr * saddr , u64 nonce );
Original file line number Diff line number Diff line change @@ -969,7 +969,7 @@ static int icmpv6_rcv(struct sk_buff *skb)
969969 case NDISC_NEIGHBOUR_SOLICITATION :
970970 case NDISC_NEIGHBOUR_ADVERTISEMENT :
971971 case NDISC_REDIRECT :
972- ndisc_rcv (skb );
972+ reason = ndisc_rcv (skb );
973973 break ;
974974
975975 case ICMPV6_MGM_QUERY :
Original file line number Diff line number Diff line change @@ -1804,15 +1804,16 @@ static bool ndisc_suppress_frag_ndisc(struct sk_buff *skb)
18041804 return false;
18051805}
18061806
1807- int ndisc_rcv (struct sk_buff * skb )
1807+ enum skb_drop_reason ndisc_rcv (struct sk_buff * skb )
18081808{
18091809 struct nd_msg * msg ;
1810+ SKB_DR (reason );
18101811
18111812 if (ndisc_suppress_frag_ndisc (skb ))
1812- return 0 ;
1813+ return SKB_DROP_REASON_IPV6_NDISC_FRAG ;
18131814
18141815 if (skb_linearize (skb ))
1815- return 0 ;
1816+ return SKB_DROP_REASON_NOMEM ;
18161817
18171818 msg = (struct nd_msg * )skb_transport_header (skb );
18181819
@@ -1821,13 +1822,13 @@ int ndisc_rcv(struct sk_buff *skb)
18211822 if (ipv6_hdr (skb )-> hop_limit != 255 ) {
18221823 ND_PRINTK (2 , warn , "NDISC: invalid hop-limit: %d\n" ,
18231824 ipv6_hdr (skb )-> hop_limit );
1824- return 0 ;
1825+ return SKB_DROP_REASON_IPV6_NDISC_HOP_LIMIT ;
18251826 }
18261827
18271828 if (msg -> icmph .icmp6_code != 0 ) {
18281829 ND_PRINTK (2 , warn , "NDISC: invalid ICMPv6 code: %d\n" ,
18291830 msg -> icmph .icmp6_code );
1830- return 0 ;
1831+ return SKB_DROP_REASON_IPV6_NDISC_BAD_CODE ;
18311832 }
18321833
18331834 switch (msg -> icmph .icmp6_type ) {
@@ -1853,7 +1854,7 @@ int ndisc_rcv(struct sk_buff *skb)
18531854 break ;
18541855 }
18551856
1856- return 0 ;
1857+ return reason ;
18571858}
18581859
18591860static int ndisc_netdev_event (struct notifier_block * this , unsigned long event , void * ptr )
You can’t perform that action at this time.
0 commit comments