aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/sit.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-05-20 16:43:21 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-05-20 16:43:21 -0400
commit06f4e926d256d902dd9a53dcb400fd74974ce087 (patch)
tree0b438b67f5f0eff6fd617bc497a9dace6164a488 /net/ipv6/sit.c
parent8e7bfcbab3825d1b404d615cb1b54f44ff81f981 (diff)
parentd93515611bbc70c2fe4db232e5feb448ed8e4cc9 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6: (1446 commits) macvlan: fix panic if lowerdev in a bond tg3: Add braces around 5906 workaround. tg3: Fix NETIF_F_LOOPBACK error macvlan: remove one synchronize_rcu() call networking: NET_CLS_ROUTE4 depends on INET irda: Fix error propagation in ircomm_lmp_connect_response() irda: Kill set but unused variable 'bytes' in irlan_check_command_param() irda: Kill set but unused variable 'clen' in ircomm_connect_indication() rxrpc: Fix set but unused variable 'usage' in rxrpc_get_transport() be2net: Kill set but unused variable 'req' in lancer_fw_download() irda: Kill set but unused vars 'saddr' and 'daddr' in irlan_provider_connect_indication() atl1c: atl1c_resume() is only used when CONFIG_PM_SLEEP is defined. rxrpc: Fix set but unused variable 'usage' in rxrpc_get_peer(). rxrpc: Kill set but unused variable 'local' in rxrpc_UDP_error_handler() rxrpc: Kill set but unused variable 'sp' in rxrpc_process_connection() rxrpc: Kill set but unused variable 'sp' in rxrpc_rotate_tx_window() pkt_sched: Kill set but unused variable 'protocol' in tc_classify() isdn: capi: Use pr_debug() instead of ifdefs. tg3: Update version to 3.119 tg3: Apply rx_discards fix to 5719/5720 ... Fix up trivial conflicts in arch/x86/Kconfig and net/mac80211/agg-tx.c as per Davem.
Diffstat (limited to 'net/ipv6/sit.c')
-rw-r--r--net/ipv6/sit.c40
1 files changed, 19 insertions, 21 deletions
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 5f35d595e4a5..1cca5761aea9 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -250,11 +250,6 @@ static struct ip_tunnel *ipip6_tunnel_locate(struct net *net,
250 250
251 dev_net_set(dev, net); 251 dev_net_set(dev, net);
252 252
253 if (strchr(name, '%')) {
254 if (dev_alloc_name(dev, name) < 0)
255 goto failed_free;
256 }
257
258 nt = netdev_priv(dev); 253 nt = netdev_priv(dev);
259 254
260 nt->parms = *parms; 255 nt->parms = *parms;
@@ -447,7 +442,7 @@ out:
447} 442}
448 443
449static int 444static int
450isatap_chksrc(struct sk_buff *skb, struct iphdr *iph, struct ip_tunnel *t) 445isatap_chksrc(struct sk_buff *skb, const struct iphdr *iph, struct ip_tunnel *t)
451{ 446{
452 struct ip_tunnel_prl_entry *p; 447 struct ip_tunnel_prl_entry *p;
453 int ok = 1; 448 int ok = 1;
@@ -460,7 +455,8 @@ isatap_chksrc(struct sk_buff *skb, struct iphdr *iph, struct ip_tunnel *t)
460 else 455 else
461 skb->ndisc_nodetype = NDISC_NODETYPE_NODEFAULT; 456 skb->ndisc_nodetype = NDISC_NODETYPE_NODEFAULT;
462 } else { 457 } else {
463 struct in6_addr *addr6 = &ipv6_hdr(skb)->saddr; 458 const struct in6_addr *addr6 = &ipv6_hdr(skb)->saddr;
459
464 if (ipv6_addr_is_isatap(addr6) && 460 if (ipv6_addr_is_isatap(addr6) &&
465 (addr6->s6_addr32[3] == iph->saddr) && 461 (addr6->s6_addr32[3] == iph->saddr) &&
466 ipv6_chk_prefix(addr6, t->dev)) 462 ipv6_chk_prefix(addr6, t->dev))
@@ -494,7 +490,7 @@ static int ipip6_err(struct sk_buff *skb, u32 info)
494 8 bytes of packet payload. It means, that precise relaying of 490 8 bytes of packet payload. It means, that precise relaying of
495 ICMP in the real Internet is absolutely infeasible. 491 ICMP in the real Internet is absolutely infeasible.
496 */ 492 */
497 struct iphdr *iph = (struct iphdr*)skb->data; 493 const struct iphdr *iph = (const struct iphdr *)skb->data;
498 const int type = icmp_hdr(skb)->type; 494 const int type = icmp_hdr(skb)->type;
499 const int code = icmp_hdr(skb)->code; 495 const int code = icmp_hdr(skb)->code;
500 struct ip_tunnel *t; 496 struct ip_tunnel *t;
@@ -552,7 +548,7 @@ out:
552 return err; 548 return err;
553} 549}
554 550
555static inline void ipip6_ecn_decapsulate(struct iphdr *iph, struct sk_buff *skb) 551static inline void ipip6_ecn_decapsulate(const struct iphdr *iph, struct sk_buff *skb)
556{ 552{
557 if (INET_ECN_is_ce(iph->tos)) 553 if (INET_ECN_is_ce(iph->tos))
558 IP6_ECN_set_ce(ipv6_hdr(skb)); 554 IP6_ECN_set_ce(ipv6_hdr(skb));
@@ -560,7 +556,7 @@ static inline void ipip6_ecn_decapsulate(struct iphdr *iph, struct sk_buff *skb)
560 556
561static int ipip6_rcv(struct sk_buff *skb) 557static int ipip6_rcv(struct sk_buff *skb)
562{ 558{
563 struct iphdr *iph; 559 const struct iphdr *iph;
564 struct ip_tunnel *tunnel; 560 struct ip_tunnel *tunnel;
565 561
566 if (!pskb_may_pull(skb, sizeof(struct ipv6hdr))) 562 if (!pskb_may_pull(skb, sizeof(struct ipv6hdr)))
@@ -616,7 +612,7 @@ out:
616 * comes from 6rd / 6to4 (RFC 3056) addr space. 612 * comes from 6rd / 6to4 (RFC 3056) addr space.
617 */ 613 */
618static inline 614static inline
619__be32 try_6rd(struct in6_addr *v6dst, struct ip_tunnel *tunnel) 615__be32 try_6rd(const struct in6_addr *v6dst, struct ip_tunnel *tunnel)
620{ 616{
621 __be32 dst = 0; 617 __be32 dst = 0;
622 618
@@ -659,8 +655,8 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb,
659{ 655{
660 struct ip_tunnel *tunnel = netdev_priv(dev); 656 struct ip_tunnel *tunnel = netdev_priv(dev);
661 struct pcpu_tstats *tstats; 657 struct pcpu_tstats *tstats;
662 struct iphdr *tiph = &tunnel->parms.iph; 658 const struct iphdr *tiph = &tunnel->parms.iph;
663 struct ipv6hdr *iph6 = ipv6_hdr(skb); 659 const struct ipv6hdr *iph6 = ipv6_hdr(skb);
664 u8 tos = tunnel->parms.iph.tos; 660 u8 tos = tunnel->parms.iph.tos;
665 __be16 df = tiph->frag_off; 661 __be16 df = tiph->frag_off;
666 struct rtable *rt; /* Route to the other host */ 662 struct rtable *rt; /* Route to the other host */
@@ -668,8 +664,9 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb,
668 struct iphdr *iph; /* Our new IP header */ 664 struct iphdr *iph; /* Our new IP header */
669 unsigned int max_headroom; /* The extra header space needed */ 665 unsigned int max_headroom; /* The extra header space needed */
670 __be32 dst = tiph->daddr; 666 __be32 dst = tiph->daddr;
667 struct flowi4 fl4;
671 int mtu; 668 int mtu;
672 struct in6_addr *addr6; 669 const struct in6_addr *addr6;
673 int addr_type; 670 int addr_type;
674 671
675 if (skb->protocol != htons(ETH_P_IPV6)) 672 if (skb->protocol != htons(ETH_P_IPV6))
@@ -688,7 +685,7 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb,
688 goto tx_error; 685 goto tx_error;
689 } 686 }
690 687
691 addr6 = (struct in6_addr*)&neigh->primary_key; 688 addr6 = (const struct in6_addr*)&neigh->primary_key;
692 addr_type = ipv6_addr_type(addr6); 689 addr_type = ipv6_addr_type(addr6);
693 690
694 if ((addr_type & IPV6_ADDR_UNICAST) && 691 if ((addr_type & IPV6_ADDR_UNICAST) &&
@@ -713,7 +710,7 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb,
713 goto tx_error; 710 goto tx_error;
714 } 711 }
715 712
716 addr6 = (struct in6_addr*)&neigh->primary_key; 713 addr6 = (const struct in6_addr*)&neigh->primary_key;
717 addr_type = ipv6_addr_type(addr6); 714 addr_type = ipv6_addr_type(addr6);
718 715
719 if (addr_type == IPV6_ADDR_ANY) { 716 if (addr_type == IPV6_ADDR_ANY) {
@@ -727,7 +724,7 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb,
727 dst = addr6->s6_addr32[3]; 724 dst = addr6->s6_addr32[3];
728 } 725 }
729 726
730 rt = ip_route_output_ports(dev_net(dev), NULL, 727 rt = ip_route_output_ports(dev_net(dev), &fl4, NULL,
731 dst, tiph->saddr, 728 dst, tiph->saddr,
732 0, 0, 729 0, 0,
733 IPPROTO_IPV6, RT_TOS(tos), 730 IPPROTO_IPV6, RT_TOS(tos),
@@ -821,8 +818,8 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb,
821 iph->frag_off = df; 818 iph->frag_off = df;
822 iph->protocol = IPPROTO_IPV6; 819 iph->protocol = IPPROTO_IPV6;
823 iph->tos = INET_ECN_encapsulate(tos, ipv6_get_dsfield(iph6)); 820 iph->tos = INET_ECN_encapsulate(tos, ipv6_get_dsfield(iph6));
824 iph->daddr = rt->rt_dst; 821 iph->daddr = fl4.daddr;
825 iph->saddr = rt->rt_src; 822 iph->saddr = fl4.saddr;
826 823
827 if ((iph->ttl = tiph->ttl) == 0) 824 if ((iph->ttl = tiph->ttl) == 0)
828 iph->ttl = iph6->hop_limit; 825 iph->ttl = iph6->hop_limit;
@@ -844,13 +841,14 @@ static void ipip6_tunnel_bind_dev(struct net_device *dev)
844{ 841{
845 struct net_device *tdev = NULL; 842 struct net_device *tdev = NULL;
846 struct ip_tunnel *tunnel; 843 struct ip_tunnel *tunnel;
847 struct iphdr *iph; 844 const struct iphdr *iph;
845 struct flowi4 fl4;
848 846
849 tunnel = netdev_priv(dev); 847 tunnel = netdev_priv(dev);
850 iph = &tunnel->parms.iph; 848 iph = &tunnel->parms.iph;
851 849
852 if (iph->daddr) { 850 if (iph->daddr) {
853 struct rtable *rt = ip_route_output_ports(dev_net(dev), NULL, 851 struct rtable *rt = ip_route_output_ports(dev_net(dev), &fl4, NULL,
854 iph->daddr, iph->saddr, 852 iph->daddr, iph->saddr,
855 0, 0, 853 0, 0,
856 IPPROTO_IPV6, 854 IPPROTO_IPV6,