route.c (de3cb747ffac5f2a4a6bb156e7e2fd5229e688e5) | route.c (2774c7aba6c97a2535be3309a2209770953780b3) |
---|---|
1/* 2 * INET An implementation of the TCP/IP protocol suite for the LINUX 3 * operating system. INET is implemented using the BSD Socket 4 * interface as the means of communication with the user level. 5 * 6 * ROUTE - implementation of the IP router. 7 * 8 * Version: $Id: route.c,v 1.103 2002/01/12 07:44:09 davem Exp $ --- 1388 unchanged lines hidden (view full) --- 1397 } 1398} 1399 1400static void ipv4_dst_ifdown(struct dst_entry *dst, struct net_device *dev, 1401 int how) 1402{ 1403 struct rtable *rt = (struct rtable *) dst; 1404 struct in_device *idev = rt->idev; | 1/* 2 * INET An implementation of the TCP/IP protocol suite for the LINUX 3 * operating system. INET is implemented using the BSD Socket 4 * interface as the means of communication with the user level. 5 * 6 * ROUTE - implementation of the IP router. 7 * 8 * Version: $Id: route.c,v 1.103 2002/01/12 07:44:09 davem Exp $ --- 1388 unchanged lines hidden (view full) --- 1397 } 1398} 1399 1400static void ipv4_dst_ifdown(struct dst_entry *dst, struct net_device *dev, 1401 int how) 1402{ 1403 struct rtable *rt = (struct rtable *) dst; 1404 struct in_device *idev = rt->idev; |
1405 if (dev != loopback_dev && idev && idev->dev == dev) { 1406 struct in_device *loopback_idev = in_dev_get(loopback_dev); | 1405 if (dev != init_net.loopback_dev && idev && idev->dev == dev) { 1406 struct in_device *loopback_idev = in_dev_get(init_net.loopback_dev); |
1407 if (loopback_idev) { 1408 rt->idev = loopback_idev; 1409 in_dev_put(idev); 1410 } 1411 } 1412} 1413 1414static void ipv4_link_failure(struct sk_buff *skb) --- 135 unchanged lines hidden (view full) --- 1550 rth->fl.mark = skb->mark; 1551 rth->fl.fl4_src = saddr; 1552 rth->rt_src = saddr; 1553#ifdef CONFIG_NET_CLS_ROUTE 1554 rth->u.dst.tclassid = itag; 1555#endif 1556 rth->rt_iif = 1557 rth->fl.iif = dev->ifindex; | 1407 if (loopback_idev) { 1408 rt->idev = loopback_idev; 1409 in_dev_put(idev); 1410 } 1411 } 1412} 1413 1414static void ipv4_link_failure(struct sk_buff *skb) --- 135 unchanged lines hidden (view full) --- 1550 rth->fl.mark = skb->mark; 1551 rth->fl.fl4_src = saddr; 1552 rth->rt_src = saddr; 1553#ifdef CONFIG_NET_CLS_ROUTE 1554 rth->u.dst.tclassid = itag; 1555#endif 1556 rth->rt_iif = 1557 rth->fl.iif = dev->ifindex; |
1558 rth->u.dst.dev = loopback_dev; | 1558 rth->u.dst.dev = init_net.loopback_dev; |
1559 dev_hold(rth->u.dst.dev); 1560 rth->idev = in_dev_get(rth->u.dst.dev); 1561 rth->fl.oif = 0; 1562 rth->rt_gateway = daddr; 1563 rth->rt_spec_dst= spec_dst; 1564 rth->rt_type = RTN_MULTICAST; 1565 rth->rt_flags = RTCF_MULTICAST; 1566 if (our) { --- 240 unchanged lines hidden (view full) --- 1807 RT_CACHE_STAT_INC(in_slow_tot); 1808 1809 if (res.type == RTN_BROADCAST) 1810 goto brd_input; 1811 1812 if (res.type == RTN_LOCAL) { 1813 int result; 1814 result = fib_validate_source(saddr, daddr, tos, | 1559 dev_hold(rth->u.dst.dev); 1560 rth->idev = in_dev_get(rth->u.dst.dev); 1561 rth->fl.oif = 0; 1562 rth->rt_gateway = daddr; 1563 rth->rt_spec_dst= spec_dst; 1564 rth->rt_type = RTN_MULTICAST; 1565 rth->rt_flags = RTCF_MULTICAST; 1566 if (our) { --- 240 unchanged lines hidden (view full) --- 1807 RT_CACHE_STAT_INC(in_slow_tot); 1808 1809 if (res.type == RTN_BROADCAST) 1810 goto brd_input; 1811 1812 if (res.type == RTN_LOCAL) { 1813 int result; 1814 result = fib_validate_source(saddr, daddr, tos, |
1815 loopback_dev->ifindex, | 1815 init_net.loopback_dev->ifindex, |
1816 dev, &spec_dst, &itag); 1817 if (result < 0) 1818 goto martian_source; 1819 if (result) 1820 flags |= RTCF_DIRECTSRC; 1821 spec_dst = daddr; 1822 goto local_input; 1823 } --- 50 unchanged lines hidden (view full) --- 1874 rth->fl.mark = skb->mark; 1875 rth->fl.fl4_src = saddr; 1876 rth->rt_src = saddr; 1877#ifdef CONFIG_NET_CLS_ROUTE 1878 rth->u.dst.tclassid = itag; 1879#endif 1880 rth->rt_iif = 1881 rth->fl.iif = dev->ifindex; | 1816 dev, &spec_dst, &itag); 1817 if (result < 0) 1818 goto martian_source; 1819 if (result) 1820 flags |= RTCF_DIRECTSRC; 1821 spec_dst = daddr; 1822 goto local_input; 1823 } --- 50 unchanged lines hidden (view full) --- 1874 rth->fl.mark = skb->mark; 1875 rth->fl.fl4_src = saddr; 1876 rth->rt_src = saddr; 1877#ifdef CONFIG_NET_CLS_ROUTE 1878 rth->u.dst.tclassid = itag; 1879#endif 1880 rth->rt_iif = 1881 rth->fl.iif = dev->ifindex; |
1882 rth->u.dst.dev = loopback_dev; | 1882 rth->u.dst.dev = init_net.loopback_dev; |
1883 dev_hold(rth->u.dst.dev); 1884 rth->idev = in_dev_get(rth->u.dst.dev); 1885 rth->rt_gateway = daddr; 1886 rth->rt_spec_dst= spec_dst; 1887 rth->u.dst.input= ip_local_deliver; 1888 rth->rt_flags = flags|RTCF_LOCAL; 1889 if (res.type == RTN_UNREACHABLE) { 1890 rth->u.dst.input= ip_error; --- 253 unchanged lines hidden (view full) --- 2144 { .daddr = oldflp->fl4_dst, 2145 .saddr = oldflp->fl4_src, 2146 .tos = tos & IPTOS_RT_MASK, 2147 .scope = ((tos & RTO_ONLINK) ? 2148 RT_SCOPE_LINK : 2149 RT_SCOPE_UNIVERSE), 2150 } }, 2151 .mark = oldflp->mark, | 1883 dev_hold(rth->u.dst.dev); 1884 rth->idev = in_dev_get(rth->u.dst.dev); 1885 rth->rt_gateway = daddr; 1886 rth->rt_spec_dst= spec_dst; 1887 rth->u.dst.input= ip_local_deliver; 1888 rth->rt_flags = flags|RTCF_LOCAL; 1889 if (res.type == RTN_UNREACHABLE) { 1890 rth->u.dst.input= ip_error; --- 253 unchanged lines hidden (view full) --- 2144 { .daddr = oldflp->fl4_dst, 2145 .saddr = oldflp->fl4_src, 2146 .tos = tos & IPTOS_RT_MASK, 2147 .scope = ((tos & RTO_ONLINK) ? 2148 RT_SCOPE_LINK : 2149 RT_SCOPE_UNIVERSE), 2150 } }, 2151 .mark = oldflp->mark, |
2152 .iif = loopback_dev->ifindex, | 2152 .iif = init_net.loopback_dev->ifindex, |
2153 .oif = oldflp->oif }; 2154 struct fib_result res; 2155 unsigned flags = 0; 2156 struct net_device *dev_out = NULL; 2157 int free_res = 0; 2158 int err; 2159 2160 --- 77 unchanged lines hidden (view full) --- 2238 } 2239 2240 if (!fl.fl4_dst) { 2241 fl.fl4_dst = fl.fl4_src; 2242 if (!fl.fl4_dst) 2243 fl.fl4_dst = fl.fl4_src = htonl(INADDR_LOOPBACK); 2244 if (dev_out) 2245 dev_put(dev_out); | 2153 .oif = oldflp->oif }; 2154 struct fib_result res; 2155 unsigned flags = 0; 2156 struct net_device *dev_out = NULL; 2157 int free_res = 0; 2158 int err; 2159 2160 --- 77 unchanged lines hidden (view full) --- 2238 } 2239 2240 if (!fl.fl4_dst) { 2241 fl.fl4_dst = fl.fl4_src; 2242 if (!fl.fl4_dst) 2243 fl.fl4_dst = fl.fl4_src = htonl(INADDR_LOOPBACK); 2244 if (dev_out) 2245 dev_put(dev_out); |
2246 dev_out = loopback_dev; | 2246 dev_out = init_net.loopback_dev; |
2247 dev_hold(dev_out); | 2247 dev_hold(dev_out); |
2248 fl.oif = loopback_dev->ifindex; | 2248 fl.oif = init_net.loopback_dev->ifindex; |
2249 res.type = RTN_LOCAL; 2250 flags |= RTCF_LOCAL; 2251 goto make_route; 2252 } 2253 2254 if (fib_lookup(&fl, &res)) { 2255 res.fi = NULL; 2256 if (oldflp->oif) { --- 28 unchanged lines hidden (view full) --- 2285 } 2286 free_res = 1; 2287 2288 if (res.type == RTN_LOCAL) { 2289 if (!fl.fl4_src) 2290 fl.fl4_src = fl.fl4_dst; 2291 if (dev_out) 2292 dev_put(dev_out); | 2249 res.type = RTN_LOCAL; 2250 flags |= RTCF_LOCAL; 2251 goto make_route; 2252 } 2253 2254 if (fib_lookup(&fl, &res)) { 2255 res.fi = NULL; 2256 if (oldflp->oif) { --- 28 unchanged lines hidden (view full) --- 2285 } 2286 free_res = 1; 2287 2288 if (res.type == RTN_LOCAL) { 2289 if (!fl.fl4_src) 2290 fl.fl4_src = fl.fl4_dst; 2291 if (dev_out) 2292 dev_put(dev_out); |
2293 dev_out = loopback_dev; | 2293 dev_out = init_net.loopback_dev; |
2294 dev_hold(dev_out); 2295 fl.oif = dev_out->ifindex; 2296 if (res.fi) 2297 fib_info_put(res.fi); 2298 res.fi = NULL; 2299 flags |= RTCF_LOCAL; 2300 goto make_route; 2301 } --- 730 unchanged lines hidden --- | 2294 dev_hold(dev_out); 2295 fl.oif = dev_out->ifindex; 2296 if (res.fi) 2297 fib_info_put(res.fi); 2298 res.fi = NULL; 2299 flags |= RTCF_LOCAL; 2300 goto make_route; 2301 } --- 730 unchanged lines hidden --- |