Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 309199 Details for
Bug 437410
ip tunnel can't be bound to another device
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
rebinding of IPIP, GRE, SIT tunnels
rhel4.patch (text/plain), 9.36 KB, created by
Michal Schmidt
on 2008-06-13 12:18:48 UTC
(
hide
)
Description:
rebinding of IPIP, GRE, SIT tunnels
Filename:
MIME Type:
Creator:
Michal Schmidt
Created:
2008-06-13 12:18:48 UTC
Size:
9.36 KB
patch
obsolete
>diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c >index 1c1c2e1..722fe2e 100644 >--- a/net/ipv4/ipip.c >+++ b/net/ipv4/ipip.c >@@ -655,6 +655,40 @@ tx_error: > return 0; > } > >+static void ipip_tunnel_bind_dev(struct net_device *dev) >+{ >+ struct net_device *tdev = NULL; >+ struct ip_tunnel *tunnel; >+ struct iphdr *iph; >+ >+ tunnel = netdev_priv(dev); >+ iph = &tunnel->parms.iph; >+ >+ if (iph->daddr) { >+ struct flowi fl = { .oif = tunnel->parms.link, >+ .nl_u = { .ip4_u = >+ { .daddr = iph->daddr, >+ .saddr = iph->saddr, >+ .tos = RT_TOS(iph->tos) } }, >+ .proto = IPPROTO_IPIP }; >+ struct rtable *rt; >+ if (!ip_route_output_key(&rt, &fl)) { >+ tdev = rt->u.dst.dev; >+ ip_rt_put(rt); >+ } >+ dev->flags |= IFF_POINTOPOINT; >+ } >+ >+ if (!tdev && tunnel->parms.link) >+ tdev = __dev_get_by_index(tunnel->parms.link); >+ >+ if (tdev) { >+ dev->hard_header_len = tdev->hard_header_len + sizeof(struct iphdr); >+ dev->mtu = tdev->mtu - sizeof(struct iphdr); >+ } >+ dev->iflink = tunnel->parms.link; >+} >+ > static int > ipip_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) > { >@@ -727,6 +761,11 @@ ipip_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) > t->parms.iph.ttl = p.iph.ttl; > t->parms.iph.tos = p.iph.tos; > t->parms.iph.frag_off = p.iph.frag_off; >+ if (t->parms.link != p.link) { >+ t->parms.link = p.link; >+ ipip_tunnel_bind_dev(dev); >+ netdev_state_change(dev); >+ } > } > if (copy_to_user(ifr->ifr_ifru.ifru_data, &t->parms, sizeof(p))) > err = -EFAULT; >@@ -795,12 +834,9 @@ static void ipip_tunnel_setup(struct net_device *dev) > > static int ipip_tunnel_init(struct net_device *dev) > { >- struct net_device *tdev = NULL; > struct ip_tunnel *tunnel; >- struct iphdr *iph; > > tunnel = (struct ip_tunnel*)dev->priv; >- iph = &tunnel->parms.iph; > > tunnel->dev = dev; > strcpy(tunnel->parms.name, dev->name); >@@ -808,29 +844,7 @@ static int ipip_tunnel_init(struct net_device *dev) > memcpy(dev->dev_addr, &tunnel->parms.iph.saddr, 4); > memcpy(dev->broadcast, &tunnel->parms.iph.daddr, 4); > >- if (iph->daddr) { >- struct flowi fl = { .oif = tunnel->parms.link, >- .nl_u = { .ip4_u = >- { .daddr = iph->daddr, >- .saddr = iph->saddr, >- .tos = RT_TOS(iph->tos) } }, >- .proto = IPPROTO_IPIP }; >- struct rtable *rt; >- if (!ip_route_output_key(&rt, &fl)) { >- tdev = rt->u.dst.dev; >- ip_rt_put(rt); >- } >- dev->flags |= IFF_POINTOPOINT; >- } >- >- if (!tdev && tunnel->parms.link) >- tdev = __dev_get_by_index(tunnel->parms.link); >- >- if (tdev) { >- dev->hard_header_len = tdev->hard_header_len + sizeof(struct iphdr); >- dev->mtu = tdev->mtu - sizeof(struct iphdr); >- } >- dev->iflink = tunnel->parms.link; >+ ipip_tunnel_bind_dev(dev); > > return 0; > } >feff052f18487f580c9284a36cd7688b3d8e2f6f >diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c >index 2c768ec..d35c3a8 100644 >--- a/net/ipv4/ip_gre.c >+++ b/net/ipv4/ip_gre.c >@@ -897,6 +897,59 @@ tx_error: > return 0; > } > >+static void ipgre_tunnel_bind_dev(struct net_device *dev) >+{ >+ struct net_device *tdev = NULL; >+ struct ip_tunnel *tunnel; >+ struct iphdr *iph; >+ int hlen = LL_MAX_HEADER; >+ int mtu = ETH_DATA_LEN; >+ int addend = sizeof(struct iphdr) + 4; >+ >+ tunnel = netdev_priv(dev); >+ iph = &tunnel->parms.iph; >+ >+ /* Guess output device to choose reasonable mtu and hard_header_len */ >+ >+ if (iph->daddr) { >+ struct flowi fl = { .oif = tunnel->parms.link, >+ .nl_u = { .ip4_u = >+ { .daddr = iph->daddr, >+ .saddr = iph->saddr, >+ .tos = RT_TOS(iph->tos) } }, >+ .proto = IPPROTO_GRE }; >+ struct rtable *rt; >+ if (!ip_route_output_key(&rt, &fl)) { >+ tdev = rt->u.dst.dev; >+ ip_rt_put(rt); >+ } >+ dev->flags |= IFF_POINTOPOINT; >+ } >+ >+ if (!tdev && tunnel->parms.link) >+ tdev = __dev_get_by_index(tunnel->parms.link); >+ >+ if (tdev) { >+ hlen = tdev->hard_header_len; >+ mtu = tdev->mtu; >+ } >+ dev->iflink = tunnel->parms.link; >+ >+ /* Precalculate GRE options length */ >+ if (tunnel->parms.o_flags&(GRE_CSUM|GRE_KEY|GRE_SEQ)) { >+ if (tunnel->parms.o_flags&GRE_CSUM) >+ addend += 4; >+ if (tunnel->parms.o_flags&GRE_KEY) >+ addend += 4; >+ if (tunnel->parms.o_flags&GRE_SEQ) >+ addend += 4; >+ } >+ dev->hard_header_len = hlen + addend; >+ dev->mtu = mtu - addend; >+ tunnel->hlen = addend; >+ >+} >+ > static int > ipgre_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) > { >@@ -984,6 +1037,11 @@ ipgre_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) > t->parms.iph.ttl = p.iph.ttl; > t->parms.iph.tos = p.iph.tos; > t->parms.iph.frag_off = p.iph.frag_off; >+ if (t->parms.link != p.link) { >+ t->parms.link = p.link; >+ ipgre_tunnel_bind_dev(dev); >+ netdev_state_change(dev); >+ } > } > if (copy_to_user(ifr->ifr_ifru.ifru_data, &t->parms, sizeof(p))) > err = -EFAULT; >@@ -1150,12 +1208,8 @@ static void ipgre_tunnel_setup(struct net_device *dev) > > static int ipgre_tunnel_init(struct net_device *dev) > { >- struct net_device *tdev = NULL; > struct ip_tunnel *tunnel; > struct iphdr *iph; >- int hlen = LL_MAX_HEADER; >- int mtu = 1500; >- int addend = sizeof(struct iphdr) + 4; > > tunnel = (struct ip_tunnel*)dev->priv; > iph = &tunnel->parms.iph; >@@ -1166,23 +1220,9 @@ static int ipgre_tunnel_init(struct net_device *dev) > memcpy(dev->dev_addr, &tunnel->parms.iph.saddr, 4); > memcpy(dev->broadcast, &tunnel->parms.iph.daddr, 4); > >- /* Guess output device to choose reasonable mtu and hard_header_len */ >+ ipgre_tunnel_bind_dev(dev); > > if (iph->daddr) { >- struct flowi fl = { .oif = tunnel->parms.link, >- .nl_u = { .ip4_u = >- { .daddr = iph->daddr, >- .saddr = iph->saddr, >- .tos = RT_TOS(iph->tos) } }, >- .proto = IPPROTO_GRE }; >- struct rtable *rt; >- if (!ip_route_output_key(&rt, &fl)) { >- tdev = rt->u.dst.dev; >- ip_rt_put(rt); >- } >- >- dev->flags |= IFF_POINTOPOINT; >- > #ifdef CONFIG_NET_IPGRE_BROADCAST > if (MULTICAST(iph->daddr)) { > if (!iph->saddr) >@@ -1195,27 +1235,6 @@ static int ipgre_tunnel_init(struct net_device *dev) > #endif > } > >- if (!tdev && tunnel->parms.link) >- tdev = __dev_get_by_index(tunnel->parms.link); >- >- if (tdev) { >- hlen = tdev->hard_header_len; >- mtu = tdev->mtu; >- } >- dev->iflink = tunnel->parms.link; >- >- /* Precalculate GRE options length */ >- if (tunnel->parms.o_flags&(GRE_CSUM|GRE_KEY|GRE_SEQ)) { >- if (tunnel->parms.o_flags&GRE_CSUM) >- addend += 4; >- if (tunnel->parms.o_flags&GRE_KEY) >- addend += 4; >- if (tunnel->parms.o_flags&GRE_SEQ) >- addend += 4; >- } >- dev->hard_header_len = hlen + addend; >- dev->mtu = mtu - addend; >- tunnel->hlen = addend; > return 0; > } > >94a6e83ed30be5f68e366e58c8b1cbc6f8098427 >diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c >index 3ddbd6c..ecbaa68 100644 >--- a/net/ipv6/sit.c >+++ b/net/ipv6/sit.c >@@ -590,6 +590,42 @@ tx_error: > return 0; > } > >+static void ipip6_tunnel_bind_dev(struct net_device *dev) >+{ >+ struct net_device *tdev = NULL; >+ struct ip_tunnel *tunnel; >+ struct iphdr *iph; >+ >+ tunnel = netdev_priv(dev); >+ iph = &tunnel->parms.iph; >+ >+ if (iph->daddr) { >+ struct flowi fl = { .nl_u = { .ip4_u = >+ { .daddr = iph->daddr, >+ .saddr = iph->saddr, >+ .tos = RT_TOS(iph->tos) } }, >+ .oif = tunnel->parms.link, >+ .proto = IPPROTO_IPV6 }; >+ struct rtable *rt; >+ if (!ip_route_output_key(&rt, &fl)) { >+ tdev = rt->u.dst.dev; >+ ip_rt_put(rt); >+ } >+ dev->flags |= IFF_POINTOPOINT; >+ } >+ >+ if (!tdev && tunnel->parms.link) >+ tdev = __dev_get_by_index(tunnel->parms.link); >+ >+ if (tdev) { >+ dev->hard_header_len = tdev->hard_header_len + sizeof(struct iphdr); >+ dev->mtu = tdev->mtu - sizeof(struct iphdr); >+ if (dev->mtu < IPV6_MIN_MTU) >+ dev->mtu = IPV6_MIN_MTU; >+ } >+ dev->iflink = tunnel->parms.link; >+} >+ > static int > ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) > { >@@ -661,6 +697,11 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) > if (cmd == SIOCCHGTUNNEL) { > t->parms.iph.ttl = p.iph.ttl; > t->parms.iph.tos = p.iph.tos; >+ if (t->parms.link != p.link) { >+ t->parms.link = p.link; >+ ipip6_tunnel_bind_dev(dev); >+ netdev_state_change(dev); >+ } > } > if (copy_to_user(ifr->ifr_ifru.ifru_data, &t->parms, sizeof(p))) > err = -EFAULT; >@@ -729,12 +770,9 @@ static void ipip6_tunnel_setup(struct net_device *dev) > > static int ipip6_tunnel_init(struct net_device *dev) > { >- struct net_device *tdev = NULL; > struct ip_tunnel *tunnel; >- struct iphdr *iph; > > tunnel = (struct ip_tunnel*)dev->priv; >- iph = &tunnel->parms.iph; > > tunnel->dev = dev; > strcpy(tunnel->parms.name, dev->name); >@@ -742,31 +780,7 @@ static int ipip6_tunnel_init(struct net_device *dev) > memcpy(dev->dev_addr, &tunnel->parms.iph.saddr, 4); > memcpy(dev->broadcast, &tunnel->parms.iph.daddr, 4); > >- if (iph->daddr) { >- struct flowi fl = { .nl_u = { .ip4_u = >- { .daddr = iph->daddr, >- .saddr = iph->saddr, >- .tos = RT_TOS(iph->tos) } }, >- .oif = tunnel->parms.link, >- .proto = IPPROTO_IPV6 }; >- struct rtable *rt; >- if (!ip_route_output_key(&rt, &fl)) { >- tdev = rt->u.dst.dev; >- ip_rt_put(rt); >- } >- dev->flags |= IFF_POINTOPOINT; >- } >- >- if (!tdev && tunnel->parms.link) >- tdev = __dev_get_by_index(tunnel->parms.link); >- >- if (tdev) { >- dev->hard_header_len = tdev->hard_header_len + sizeof(struct iphdr); >- dev->mtu = tdev->mtu - sizeof(struct iphdr); >- if (dev->mtu < IPV6_MIN_MTU) >- dev->mtu = IPV6_MIN_MTU; >- } >- dev->iflink = tunnel->parms.link; >+ ipip6_tunnel_bind_dev(dev); > > return 0; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 437410
: 309199 |
309200