22 #include <linux/errno.h>
23 #include <linux/types.h>
24 #include <linux/socket.h>
26 #include <linux/net.h>
27 #include <linux/netdevice.h>
28 #include <linux/in6.h>
29 #include <linux/icmpv6.h>
30 #include <linux/mroute6.h>
31 #include <linux/slab.h>
33 #include <linux/netfilter.h>
34 #include <linux/netfilter_ipv6.h>
53 const struct inet6_protocol *ipprot;
56 if (ipprot && ipprot->early_demux)
57 ipprot->early_demux(skb);
62 return dst_input(skb);
79 idev = __in6_dev_get(skb->
dev);
102 IP6CB(skb)->iif = skb_dst(skb) ? ip6_dst_idev(skb_dst(skb))->dev->ifindex : dev->
ifindex;
104 if (
unlikely(!pskb_may_pull(skb,
sizeof(*hdr))))
109 if (hdr->version != 6)
118 ipv6_addr_loopback(&hdr->
daddr))
126 if (ipv6_addr_is_multicast(&hdr->
saddr))
136 if (pkt_len +
sizeof(
struct ipv6hdr) > skb->
len) {
141 if (pskb_trim_rcsum(skb, pkt_len +
sizeof(
struct ipv6hdr))) {
176 static int ip6_input_finish(
struct sk_buff *
skb)
178 struct net *
net = dev_net(skb_dst(skb)->
dev);
179 const struct inet6_protocol *ipprot;
191 idev = ip6_dst_idev(skb_dst(skb));
192 if (!pskb_pull(skb, skb_transport_offset(skb)))
194 nhoff =
IP6CB(skb)->nhoff;
195 nexthdr = skb_network_header(skb)[nhoff];
201 if (ipprot->flags & INET6_PROTO_FINAL) {
209 skb_postpull_rcsum(skb, skb_network_header(skb),
210 skb_network_header_len(skb));
212 if (ipv6_addr_is_multicast(&hdr->
daddr) &&
218 if (!(ipprot->flags & INET6_PROTO_NOPOLICY) &&
222 ret = ipprot->handler(skb);
262 ip6_dst_idev(skb_dst(skb)), IPSTATS_MIB_INMCAST,
268 #ifdef CONFIG_IPV6_MROUTE
272 if (dev_net(skb->
dev)->ipv6.devconf_all->mc_forwarding &&
285 u8 *
ptr = skb_network_header(skb) + opt->
ra;
294 if ((ptr[2] | ptr[3]) == 0) {
302 &nexthdr, &frag_off);
309 if (!pskb_may_pull(skb, (skb_network_header(skb) +
310 offset + 1 - skb->
data)))