diff options
Diffstat (limited to 'net/ipv6/ip6_tunnel.c')
-rw-r--r-- | net/ipv6/ip6_tunnel.c | 125 |
1 files changed, 65 insertions, 60 deletions
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index 4f4483e697bd..36c2842a86b2 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c | |||
@@ -57,6 +57,7 @@ | |||
57 | MODULE_AUTHOR("Ville Nuorvala"); | 57 | MODULE_AUTHOR("Ville Nuorvala"); |
58 | MODULE_DESCRIPTION("IPv6 tunneling device"); | 58 | MODULE_DESCRIPTION("IPv6 tunneling device"); |
59 | MODULE_LICENSE("GPL"); | 59 | MODULE_LICENSE("GPL"); |
60 | MODULE_ALIAS_NETDEV("ip6tnl0"); | ||
60 | 61 | ||
61 | #ifdef IP6_TNL_DEBUG | 62 | #ifdef IP6_TNL_DEBUG |
62 | #define IP6_TNL_TRACE(x...) printk(KERN_DEBUG "%s:" x "\n", __func__) | 63 | #define IP6_TNL_TRACE(x...) printk(KERN_DEBUG "%s:" x "\n", __func__) |
@@ -161,7 +162,7 @@ static inline void ip6_tnl_dst_store(struct ip6_tnl *t, struct dst_entry *dst) | |||
161 | for (t = rcu_dereference(start); t; t = rcu_dereference(t->next)) | 162 | for (t = rcu_dereference(start); t; t = rcu_dereference(t->next)) |
162 | 163 | ||
163 | static struct ip6_tnl * | 164 | static struct ip6_tnl * |
164 | ip6_tnl_lookup(struct net *net, struct in6_addr *remote, struct in6_addr *local) | 165 | ip6_tnl_lookup(struct net *net, const struct in6_addr *remote, const struct in6_addr *local) |
165 | { | 166 | { |
166 | unsigned int h0 = HASH(remote); | 167 | unsigned int h0 = HASH(remote); |
167 | unsigned int h1 = HASH(local); | 168 | unsigned int h1 = HASH(local); |
@@ -193,10 +194,10 @@ ip6_tnl_lookup(struct net *net, struct in6_addr *remote, struct in6_addr *local) | |||
193 | **/ | 194 | **/ |
194 | 195 | ||
195 | static struct ip6_tnl __rcu ** | 196 | static struct ip6_tnl __rcu ** |
196 | ip6_tnl_bucket(struct ip6_tnl_net *ip6n, struct ip6_tnl_parm *p) | 197 | ip6_tnl_bucket(struct ip6_tnl_net *ip6n, const struct ip6_tnl_parm *p) |
197 | { | 198 | { |
198 | struct in6_addr *remote = &p->raddr; | 199 | const struct in6_addr *remote = &p->raddr; |
199 | struct in6_addr *local = &p->laddr; | 200 | const struct in6_addr *local = &p->laddr; |
200 | unsigned h = 0; | 201 | unsigned h = 0; |
201 | int prio = 0; | 202 | int prio = 0; |
202 | 203 | ||
@@ -279,11 +280,6 @@ static struct ip6_tnl *ip6_tnl_create(struct net *net, struct ip6_tnl_parm *p) | |||
279 | 280 | ||
280 | dev_net_set(dev, net); | 281 | dev_net_set(dev, net); |
281 | 282 | ||
282 | if (strchr(name, '%')) { | ||
283 | if (dev_alloc_name(dev, name) < 0) | ||
284 | goto failed_free; | ||
285 | } | ||
286 | |||
287 | t = netdev_priv(dev); | 283 | t = netdev_priv(dev); |
288 | t->parms = *p; | 284 | t->parms = *p; |
289 | err = ip6_tnl_dev_init(dev); | 285 | err = ip6_tnl_dev_init(dev); |
@@ -320,8 +316,8 @@ failed: | |||
320 | static struct ip6_tnl *ip6_tnl_locate(struct net *net, | 316 | static struct ip6_tnl *ip6_tnl_locate(struct net *net, |
321 | struct ip6_tnl_parm *p, int create) | 317 | struct ip6_tnl_parm *p, int create) |
322 | { | 318 | { |
323 | struct in6_addr *remote = &p->raddr; | 319 | const struct in6_addr *remote = &p->raddr; |
324 | struct in6_addr *local = &p->laddr; | 320 | const struct in6_addr *local = &p->laddr; |
325 | struct ip6_tnl __rcu **tp; | 321 | struct ip6_tnl __rcu **tp; |
326 | struct ip6_tnl *t; | 322 | struct ip6_tnl *t; |
327 | struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id); | 323 | struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id); |
@@ -373,7 +369,7 @@ ip6_tnl_dev_uninit(struct net_device *dev) | |||
373 | static __u16 | 369 | static __u16 |
374 | parse_tlv_tnl_enc_lim(struct sk_buff *skb, __u8 * raw) | 370 | parse_tlv_tnl_enc_lim(struct sk_buff *skb, __u8 * raw) |
375 | { | 371 | { |
376 | struct ipv6hdr *ipv6h = (struct ipv6hdr *) raw; | 372 | const struct ipv6hdr *ipv6h = (const struct ipv6hdr *) raw; |
377 | __u8 nexthdr = ipv6h->nexthdr; | 373 | __u8 nexthdr = ipv6h->nexthdr; |
378 | __u16 off = sizeof (*ipv6h); | 374 | __u16 off = sizeof (*ipv6h); |
379 | 375 | ||
@@ -434,7 +430,7 @@ static int | |||
434 | ip6_tnl_err(struct sk_buff *skb, __u8 ipproto, struct inet6_skb_parm *opt, | 430 | ip6_tnl_err(struct sk_buff *skb, __u8 ipproto, struct inet6_skb_parm *opt, |
435 | u8 *type, u8 *code, int *msg, __u32 *info, int offset) | 431 | u8 *type, u8 *code, int *msg, __u32 *info, int offset) |
436 | { | 432 | { |
437 | struct ipv6hdr *ipv6h = (struct ipv6hdr *) skb->data; | 433 | const struct ipv6hdr *ipv6h = (const struct ipv6hdr *) skb->data; |
438 | struct ip6_tnl *t; | 434 | struct ip6_tnl *t; |
439 | int rel_msg = 0; | 435 | int rel_msg = 0; |
440 | u8 rel_type = ICMPV6_DEST_UNREACH; | 436 | u8 rel_type = ICMPV6_DEST_UNREACH; |
@@ -534,9 +530,9 @@ ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
534 | __u32 rel_info = ntohl(info); | 530 | __u32 rel_info = ntohl(info); |
535 | int err; | 531 | int err; |
536 | struct sk_buff *skb2; | 532 | struct sk_buff *skb2; |
537 | struct iphdr *eiph; | 533 | const struct iphdr *eiph; |
538 | struct flowi fl; | ||
539 | struct rtable *rt; | 534 | struct rtable *rt; |
535 | struct flowi4 fl4; | ||
540 | 536 | ||
541 | err = ip6_tnl_err(skb, IPPROTO_IPIP, opt, &rel_type, &rel_code, | 537 | err = ip6_tnl_err(skb, IPPROTO_IPIP, opt, &rel_type, &rel_code, |
542 | &rel_msg, &rel_info, offset); | 538 | &rel_msg, &rel_info, offset); |
@@ -577,11 +573,11 @@ ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
577 | eiph = ip_hdr(skb2); | 573 | eiph = ip_hdr(skb2); |
578 | 574 | ||
579 | /* Try to guess incoming interface */ | 575 | /* Try to guess incoming interface */ |
580 | memset(&fl, 0, sizeof(fl)); | 576 | rt = ip_route_output_ports(dev_net(skb->dev), &fl4, NULL, |
581 | fl.fl4_dst = eiph->saddr; | 577 | eiph->saddr, 0, |
582 | fl.fl4_tos = RT_TOS(eiph->tos); | 578 | 0, 0, |
583 | fl.proto = IPPROTO_IPIP; | 579 | IPPROTO_IPIP, RT_TOS(eiph->tos), 0); |
584 | if (ip_route_output_key(dev_net(skb->dev), &rt, &fl)) | 580 | if (IS_ERR(rt)) |
585 | goto out; | 581 | goto out; |
586 | 582 | ||
587 | skb2->dev = rt->dst.dev; | 583 | skb2->dev = rt->dst.dev; |
@@ -590,15 +586,18 @@ ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
590 | if (rt->rt_flags & RTCF_LOCAL) { | 586 | if (rt->rt_flags & RTCF_LOCAL) { |
591 | ip_rt_put(rt); | 587 | ip_rt_put(rt); |
592 | rt = NULL; | 588 | rt = NULL; |
593 | fl.fl4_dst = eiph->daddr; | 589 | rt = ip_route_output_ports(dev_net(skb->dev), &fl4, NULL, |
594 | fl.fl4_src = eiph->saddr; | 590 | eiph->daddr, eiph->saddr, |
595 | fl.fl4_tos = eiph->tos; | 591 | 0, 0, |
596 | if (ip_route_output_key(dev_net(skb->dev), &rt, &fl) || | 592 | IPPROTO_IPIP, |
593 | RT_TOS(eiph->tos), 0); | ||
594 | if (IS_ERR(rt) || | ||
597 | rt->dst.dev->type != ARPHRD_TUNNEL) { | 595 | rt->dst.dev->type != ARPHRD_TUNNEL) { |
598 | ip_rt_put(rt); | 596 | if (!IS_ERR(rt)) |
597 | ip_rt_put(rt); | ||
599 | goto out; | 598 | goto out; |
600 | } | 599 | } |
601 | skb_dst_set(skb2, (struct dst_entry *)rt); | 600 | skb_dst_set(skb2, &rt->dst); |
602 | } else { | 601 | } else { |
603 | ip_rt_put(rt); | 602 | ip_rt_put(rt); |
604 | if (ip_route_input(skb2, eiph->daddr, eiph->saddr, eiph->tos, | 603 | if (ip_route_input(skb2, eiph->daddr, eiph->saddr, eiph->tos, |
@@ -666,8 +665,8 @@ ip6ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
666 | return 0; | 665 | return 0; |
667 | } | 666 | } |
668 | 667 | ||
669 | static void ip4ip6_dscp_ecn_decapsulate(struct ip6_tnl *t, | 668 | static void ip4ip6_dscp_ecn_decapsulate(const struct ip6_tnl *t, |
670 | struct ipv6hdr *ipv6h, | 669 | const struct ipv6hdr *ipv6h, |
671 | struct sk_buff *skb) | 670 | struct sk_buff *skb) |
672 | { | 671 | { |
673 | __u8 dsfield = ipv6_get_dsfield(ipv6h) & ~INET_ECN_MASK; | 672 | __u8 dsfield = ipv6_get_dsfield(ipv6h) & ~INET_ECN_MASK; |
@@ -679,8 +678,8 @@ static void ip4ip6_dscp_ecn_decapsulate(struct ip6_tnl *t, | |||
679 | IP_ECN_set_ce(ip_hdr(skb)); | 678 | IP_ECN_set_ce(ip_hdr(skb)); |
680 | } | 679 | } |
681 | 680 | ||
682 | static void ip6ip6_dscp_ecn_decapsulate(struct ip6_tnl *t, | 681 | static void ip6ip6_dscp_ecn_decapsulate(const struct ip6_tnl *t, |
683 | struct ipv6hdr *ipv6h, | 682 | const struct ipv6hdr *ipv6h, |
684 | struct sk_buff *skb) | 683 | struct sk_buff *skb) |
685 | { | 684 | { |
686 | if (t->parms.flags & IP6_TNL_F_RCV_DSCP_COPY) | 685 | if (t->parms.flags & IP6_TNL_F_RCV_DSCP_COPY) |
@@ -723,12 +722,12 @@ static inline int ip6_tnl_rcv_ctl(struct ip6_tnl *t) | |||
723 | 722 | ||
724 | static int ip6_tnl_rcv(struct sk_buff *skb, __u16 protocol, | 723 | static int ip6_tnl_rcv(struct sk_buff *skb, __u16 protocol, |
725 | __u8 ipproto, | 724 | __u8 ipproto, |
726 | void (*dscp_ecn_decapsulate)(struct ip6_tnl *t, | 725 | void (*dscp_ecn_decapsulate)(const struct ip6_tnl *t, |
727 | struct ipv6hdr *ipv6h, | 726 | const struct ipv6hdr *ipv6h, |
728 | struct sk_buff *skb)) | 727 | struct sk_buff *skb)) |
729 | { | 728 | { |
730 | struct ip6_tnl *t; | 729 | struct ip6_tnl *t; |
731 | struct ipv6hdr *ipv6h = ipv6_hdr(skb); | 730 | const struct ipv6hdr *ipv6h = ipv6_hdr(skb); |
732 | 731 | ||
733 | rcu_read_lock(); | 732 | rcu_read_lock(); |
734 | 733 | ||
@@ -825,7 +824,7 @@ static void init_tel_txopt(struct ipv6_tel_txoption *opt, __u8 encap_limit) | |||
825 | **/ | 824 | **/ |
826 | 825 | ||
827 | static inline int | 826 | static inline int |
828 | ip6_tnl_addr_conflict(struct ip6_tnl *t, struct ipv6hdr *hdr) | 827 | ip6_tnl_addr_conflict(const struct ip6_tnl *t, const struct ipv6hdr *hdr) |
829 | { | 828 | { |
830 | return ipv6_addr_equal(&t->parms.raddr, &hdr->saddr); | 829 | return ipv6_addr_equal(&t->parms.raddr, &hdr->saddr); |
831 | } | 830 | } |
@@ -881,7 +880,7 @@ static inline int ip6_tnl_xmit_ctl(struct ip6_tnl *t) | |||
881 | static int ip6_tnl_xmit2(struct sk_buff *skb, | 880 | static int ip6_tnl_xmit2(struct sk_buff *skb, |
882 | struct net_device *dev, | 881 | struct net_device *dev, |
883 | __u8 dsfield, | 882 | __u8 dsfield, |
884 | struct flowi *fl, | 883 | struct flowi6 *fl6, |
885 | int encap_limit, | 884 | int encap_limit, |
886 | __u32 *pmtu) | 885 | __u32 *pmtu) |
887 | { | 886 | { |
@@ -901,10 +900,16 @@ static int ip6_tnl_xmit2(struct sk_buff *skb, | |||
901 | if ((dst = ip6_tnl_dst_check(t)) != NULL) | 900 | if ((dst = ip6_tnl_dst_check(t)) != NULL) |
902 | dst_hold(dst); | 901 | dst_hold(dst); |
903 | else { | 902 | else { |
904 | dst = ip6_route_output(net, NULL, fl); | 903 | dst = ip6_route_output(net, NULL, fl6); |
905 | 904 | ||
906 | if (dst->error || xfrm_lookup(net, &dst, fl, NULL, 0) < 0) | 905 | if (dst->error) |
907 | goto tx_err_link_failure; | 906 | goto tx_err_link_failure; |
907 | dst = xfrm_lookup(net, dst, flowi6_to_flowi(fl6), NULL, 0); | ||
908 | if (IS_ERR(dst)) { | ||
909 | err = PTR_ERR(dst); | ||
910 | dst = NULL; | ||
911 | goto tx_err_link_failure; | ||
912 | } | ||
908 | } | 913 | } |
909 | 914 | ||
910 | tdev = dst->dev; | 915 | tdev = dst->dev; |
@@ -954,7 +959,7 @@ static int ip6_tnl_xmit2(struct sk_buff *skb, | |||
954 | 959 | ||
955 | skb->transport_header = skb->network_header; | 960 | skb->transport_header = skb->network_header; |
956 | 961 | ||
957 | proto = fl->proto; | 962 | proto = fl6->flowi6_proto; |
958 | if (encap_limit >= 0) { | 963 | if (encap_limit >= 0) { |
959 | init_tel_txopt(&opt, encap_limit); | 964 | init_tel_txopt(&opt, encap_limit); |
960 | ipv6_push_nfrag_opts(skb, &opt.ops, &proto, NULL); | 965 | ipv6_push_nfrag_opts(skb, &opt.ops, &proto, NULL); |
@@ -962,13 +967,13 @@ static int ip6_tnl_xmit2(struct sk_buff *skb, | |||
962 | skb_push(skb, sizeof(struct ipv6hdr)); | 967 | skb_push(skb, sizeof(struct ipv6hdr)); |
963 | skb_reset_network_header(skb); | 968 | skb_reset_network_header(skb); |
964 | ipv6h = ipv6_hdr(skb); | 969 | ipv6h = ipv6_hdr(skb); |
965 | *(__be32*)ipv6h = fl->fl6_flowlabel | htonl(0x60000000); | 970 | *(__be32*)ipv6h = fl6->flowlabel | htonl(0x60000000); |
966 | dsfield = INET_ECN_encapsulate(0, dsfield); | 971 | dsfield = INET_ECN_encapsulate(0, dsfield); |
967 | ipv6_change_dsfield(ipv6h, ~INET_ECN_MASK, dsfield); | 972 | ipv6_change_dsfield(ipv6h, ~INET_ECN_MASK, dsfield); |
968 | ipv6h->hop_limit = t->parms.hop_limit; | 973 | ipv6h->hop_limit = t->parms.hop_limit; |
969 | ipv6h->nexthdr = proto; | 974 | ipv6h->nexthdr = proto; |
970 | ipv6_addr_copy(&ipv6h->saddr, &fl->fl6_src); | 975 | ipv6_addr_copy(&ipv6h->saddr, &fl6->saddr); |
971 | ipv6_addr_copy(&ipv6h->daddr, &fl->fl6_dst); | 976 | ipv6_addr_copy(&ipv6h->daddr, &fl6->daddr); |
972 | nf_reset(skb); | 977 | nf_reset(skb); |
973 | pkt_len = skb->len; | 978 | pkt_len = skb->len; |
974 | err = ip6_local_out(skb); | 979 | err = ip6_local_out(skb); |
@@ -996,9 +1001,9 @@ static inline int | |||
996 | ip4ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) | 1001 | ip4ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) |
997 | { | 1002 | { |
998 | struct ip6_tnl *t = netdev_priv(dev); | 1003 | struct ip6_tnl *t = netdev_priv(dev); |
999 | struct iphdr *iph = ip_hdr(skb); | 1004 | const struct iphdr *iph = ip_hdr(skb); |
1000 | int encap_limit = -1; | 1005 | int encap_limit = -1; |
1001 | struct flowi fl; | 1006 | struct flowi6 fl6; |
1002 | __u8 dsfield; | 1007 | __u8 dsfield; |
1003 | __u32 mtu; | 1008 | __u32 mtu; |
1004 | int err; | 1009 | int err; |
@@ -1010,16 +1015,16 @@ ip4ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1010 | if (!(t->parms.flags & IP6_TNL_F_IGN_ENCAP_LIMIT)) | 1015 | if (!(t->parms.flags & IP6_TNL_F_IGN_ENCAP_LIMIT)) |
1011 | encap_limit = t->parms.encap_limit; | 1016 | encap_limit = t->parms.encap_limit; |
1012 | 1017 | ||
1013 | memcpy(&fl, &t->fl, sizeof (fl)); | 1018 | memcpy(&fl6, &t->fl.u.ip6, sizeof (fl6)); |
1014 | fl.proto = IPPROTO_IPIP; | 1019 | fl6.flowi6_proto = IPPROTO_IPIP; |
1015 | 1020 | ||
1016 | dsfield = ipv4_get_dsfield(iph); | 1021 | dsfield = ipv4_get_dsfield(iph); |
1017 | 1022 | ||
1018 | if ((t->parms.flags & IP6_TNL_F_USE_ORIG_TCLASS)) | 1023 | if ((t->parms.flags & IP6_TNL_F_USE_ORIG_TCLASS)) |
1019 | fl.fl6_flowlabel |= htonl((__u32)iph->tos << IPV6_TCLASS_SHIFT) | 1024 | fl6.flowlabel |= htonl((__u32)iph->tos << IPV6_TCLASS_SHIFT) |
1020 | & IPV6_TCLASS_MASK; | 1025 | & IPV6_TCLASS_MASK; |
1021 | 1026 | ||
1022 | err = ip6_tnl_xmit2(skb, dev, dsfield, &fl, encap_limit, &mtu); | 1027 | err = ip6_tnl_xmit2(skb, dev, dsfield, &fl6, encap_limit, &mtu); |
1023 | if (err != 0) { | 1028 | if (err != 0) { |
1024 | /* XXX: send ICMP error even if DF is not set. */ | 1029 | /* XXX: send ICMP error even if DF is not set. */ |
1025 | if (err == -EMSGSIZE) | 1030 | if (err == -EMSGSIZE) |
@@ -1038,7 +1043,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1038 | struct ipv6hdr *ipv6h = ipv6_hdr(skb); | 1043 | struct ipv6hdr *ipv6h = ipv6_hdr(skb); |
1039 | int encap_limit = -1; | 1044 | int encap_limit = -1; |
1040 | __u16 offset; | 1045 | __u16 offset; |
1041 | struct flowi fl; | 1046 | struct flowi6 fl6; |
1042 | __u8 dsfield; | 1047 | __u8 dsfield; |
1043 | __u32 mtu; | 1048 | __u32 mtu; |
1044 | int err; | 1049 | int err; |
@@ -1060,16 +1065,16 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1060 | } else if (!(t->parms.flags & IP6_TNL_F_IGN_ENCAP_LIMIT)) | 1065 | } else if (!(t->parms.flags & IP6_TNL_F_IGN_ENCAP_LIMIT)) |
1061 | encap_limit = t->parms.encap_limit; | 1066 | encap_limit = t->parms.encap_limit; |
1062 | 1067 | ||
1063 | memcpy(&fl, &t->fl, sizeof (fl)); | 1068 | memcpy(&fl6, &t->fl.u.ip6, sizeof (fl6)); |
1064 | fl.proto = IPPROTO_IPV6; | 1069 | fl6.flowi6_proto = IPPROTO_IPV6; |
1065 | 1070 | ||
1066 | dsfield = ipv6_get_dsfield(ipv6h); | 1071 | dsfield = ipv6_get_dsfield(ipv6h); |
1067 | if ((t->parms.flags & IP6_TNL_F_USE_ORIG_TCLASS)) | 1072 | if ((t->parms.flags & IP6_TNL_F_USE_ORIG_TCLASS)) |
1068 | fl.fl6_flowlabel |= (*(__be32 *) ipv6h & IPV6_TCLASS_MASK); | 1073 | fl6.flowlabel |= (*(__be32 *) ipv6h & IPV6_TCLASS_MASK); |
1069 | if ((t->parms.flags & IP6_TNL_F_USE_ORIG_FLOWLABEL)) | 1074 | if ((t->parms.flags & IP6_TNL_F_USE_ORIG_FLOWLABEL)) |
1070 | fl.fl6_flowlabel |= (*(__be32 *) ipv6h & IPV6_FLOWLABEL_MASK); | 1075 | fl6.flowlabel |= (*(__be32 *) ipv6h & IPV6_FLOWLABEL_MASK); |
1071 | 1076 | ||
1072 | err = ip6_tnl_xmit2(skb, dev, dsfield, &fl, encap_limit, &mtu); | 1077 | err = ip6_tnl_xmit2(skb, dev, dsfield, &fl6, encap_limit, &mtu); |
1073 | if (err != 0) { | 1078 | if (err != 0) { |
1074 | if (err == -EMSGSIZE) | 1079 | if (err == -EMSGSIZE) |
1075 | icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu); | 1080 | icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu); |
@@ -1132,21 +1137,21 @@ static void ip6_tnl_link_config(struct ip6_tnl *t) | |||
1132 | { | 1137 | { |
1133 | struct net_device *dev = t->dev; | 1138 | struct net_device *dev = t->dev; |
1134 | struct ip6_tnl_parm *p = &t->parms; | 1139 | struct ip6_tnl_parm *p = &t->parms; |
1135 | struct flowi *fl = &t->fl; | 1140 | struct flowi6 *fl6 = &t->fl.u.ip6; |
1136 | 1141 | ||
1137 | memcpy(dev->dev_addr, &p->laddr, sizeof(struct in6_addr)); | 1142 | memcpy(dev->dev_addr, &p->laddr, sizeof(struct in6_addr)); |
1138 | memcpy(dev->broadcast, &p->raddr, sizeof(struct in6_addr)); | 1143 | memcpy(dev->broadcast, &p->raddr, sizeof(struct in6_addr)); |
1139 | 1144 | ||
1140 | /* Set up flowi template */ | 1145 | /* Set up flowi template */ |
1141 | ipv6_addr_copy(&fl->fl6_src, &p->laddr); | 1146 | ipv6_addr_copy(&fl6->saddr, &p->laddr); |
1142 | ipv6_addr_copy(&fl->fl6_dst, &p->raddr); | 1147 | ipv6_addr_copy(&fl6->daddr, &p->raddr); |
1143 | fl->oif = p->link; | 1148 | fl6->flowi6_oif = p->link; |
1144 | fl->fl6_flowlabel = 0; | 1149 | fl6->flowlabel = 0; |
1145 | 1150 | ||
1146 | if (!(p->flags&IP6_TNL_F_USE_ORIG_TCLASS)) | 1151 | if (!(p->flags&IP6_TNL_F_USE_ORIG_TCLASS)) |
1147 | fl->fl6_flowlabel |= IPV6_TCLASS_MASK & p->flowinfo; | 1152 | fl6->flowlabel |= IPV6_TCLASS_MASK & p->flowinfo; |
1148 | if (!(p->flags&IP6_TNL_F_USE_ORIG_FLOWLABEL)) | 1153 | if (!(p->flags&IP6_TNL_F_USE_ORIG_FLOWLABEL)) |
1149 | fl->fl6_flowlabel |= IPV6_FLOWLABEL_MASK & p->flowinfo; | 1154 | fl6->flowlabel |= IPV6_FLOWLABEL_MASK & p->flowinfo; |
1150 | 1155 | ||
1151 | ip6_tnl_set_cap(t); | 1156 | ip6_tnl_set_cap(t); |
1152 | 1157 | ||