]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/ipv6/xfrm6_policy.c
netdevice hdlc: Convert directly reference of netdev->priv
[linux-2.6-omap-h63xx.git] / net / ipv6 / xfrm6_policy.c
index 8f1e0543b3c4f114539e288d12ac273c5fbe127d..3b67ce7786ecba68e0c46168aa1510e78abe56ae 100644 (file)
@@ -52,12 +52,14 @@ static struct dst_entry *xfrm6_dst_lookup(int tos, xfrm_address_t *saddr,
 static int xfrm6_get_saddr(xfrm_address_t *saddr, xfrm_address_t *daddr)
 {
        struct dst_entry *dst;
+       struct net_device *dev;
 
        dst = xfrm6_dst_lookup(0, NULL, daddr);
        if (IS_ERR(dst))
                return -EHOSTUNREACH;
 
-       ipv6_dev_get_saddr(ip6_dst_idev(dst)->dev,
+       dev = ip6_dst_idev(dst)->dev;
+       ipv6_dev_get_saddr(dev_net(dev), dev,
                           (struct in6_addr *)&daddr->a6, 0,
                           (struct in6_addr *)&saddr->a6);
        dst_release(dst);
@@ -142,6 +144,7 @@ static int xfrm6_fill_dst(struct xfrm_dst *xdst, struct net_device *dev)
 static inline void
 _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse)
 {
+       int onlyproto = 0;
        u16 offset = skb_network_header_len(skb);
        struct ipv6hdr *hdr = ipv6_hdr(skb);
        struct ipv6_opt_hdr *exthdr;
@@ -157,6 +160,8 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse)
                exthdr = (struct ipv6_opt_hdr *)(nh + offset);
 
                switch (nexthdr) {
+               case NEXTHDR_FRAGMENT:
+                       onlyproto = 1;
                case NEXTHDR_ROUTING:
                case NEXTHDR_HOP:
                case NEXTHDR_DEST:
@@ -170,7 +175,7 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse)
                case IPPROTO_TCP:
                case IPPROTO_SCTP:
                case IPPROTO_DCCP:
-                       if (pskb_may_pull(skb, nh + offset + 4 - skb->data)) {
+                       if (!onlyproto && pskb_may_pull(skb, nh + offset + 4 - skb->data)) {
                                __be16 *ports = (__be16 *)exthdr;
 
                                fl->fl_ip_sport = ports[!!reverse];
@@ -180,7 +185,7 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse)
                        return;
 
                case IPPROTO_ICMPV6:
-                       if (pskb_may_pull(skb, nh + offset + 2 - skb->data)) {
+                       if (!onlyproto && pskb_may_pull(skb, nh + offset + 2 - skb->data)) {
                                u8 *icmp = (u8 *)exthdr;
 
                                fl->fl_icmp_type = icmp[0];
@@ -191,7 +196,7 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse)
 
 #if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE)
                case IPPROTO_MH:
-                       if (pskb_may_pull(skb, nh + offset + 3 - skb->data)) {
+                       if (!onlyproto && pskb_may_pull(skb, nh + offset + 3 - skb->data)) {
                                struct ip6_mh *mh;
                                mh = (struct ip6_mh *)exthdr;
 
@@ -272,7 +277,6 @@ static struct dst_ops xfrm6_dst_ops = {
        .ifdown =               xfrm6_dst_ifdown,
        .local_out =            __ip6_local_out,
        .gc_thresh =            1024,
-       .entry_size =           sizeof(struct xfrm_dst),
        .entries =              ATOMIC_INIT(0),
 };