route.c (de3cb747ffac5f2a4a6bb156e7e2fd5229e688e5) | route.c (2774c7aba6c97a2535be3309a2209770953780b3) |
---|---|
1/* 2 * Linux INET6 implementation 3 * FIB front-end. 4 * 5 * Authors: 6 * Pedro Roque <roque@di.fc.ul.pt> 7 * 8 * $Id: route.c,v 1.56 2001/10/31 21:55:55 davem Exp $ --- 207 unchanged lines hidden (view full) --- 216} 217 218static void ip6_dst_ifdown(struct dst_entry *dst, struct net_device *dev, 219 int how) 220{ 221 struct rt6_info *rt = (struct rt6_info *)dst; 222 struct inet6_dev *idev = rt->rt6i_idev; 223 | 1/* 2 * Linux INET6 implementation 3 * FIB front-end. 4 * 5 * Authors: 6 * Pedro Roque <roque@di.fc.ul.pt> 7 * 8 * $Id: route.c,v 1.56 2001/10/31 21:55:55 davem Exp $ --- 207 unchanged lines hidden (view full) --- 216} 217 218static void ip6_dst_ifdown(struct dst_entry *dst, struct net_device *dev, 219 int how) 220{ 221 struct rt6_info *rt = (struct rt6_info *)dst; 222 struct inet6_dev *idev = rt->rt6i_idev; 223 |
224 if (dev != loopback_dev && idev != NULL && idev->dev == dev) { 225 struct inet6_dev *loopback_idev = in6_dev_get(loopback_dev); | 224 if (dev != init_net.loopback_dev && idev != NULL && idev->dev == dev) { 225 struct inet6_dev *loopback_idev = in6_dev_get(init_net.loopback_dev); |
226 if (loopback_idev != NULL) { 227 rt->rt6i_idev = loopback_idev; 228 in6_dev_put(idev); 229 } 230 } 231} 232 233static __inline__ int rt6_check_expired(const struct rt6_info *rt) --- 946 unchanged lines hidden (view full) --- 1180 rt->rt6i_metric = cfg->fc_metric; 1181 1182 /* We cannot add true routes via loopback here, 1183 they would result in kernel looping; promote them to reject routes 1184 */ 1185 if ((cfg->fc_flags & RTF_REJECT) || 1186 (dev && (dev->flags&IFF_LOOPBACK) && !(addr_type&IPV6_ADDR_LOOPBACK))) { 1187 /* hold loopback dev/idev if we haven't done so. */ | 226 if (loopback_idev != NULL) { 227 rt->rt6i_idev = loopback_idev; 228 in6_dev_put(idev); 229 } 230 } 231} 232 233static __inline__ int rt6_check_expired(const struct rt6_info *rt) --- 946 unchanged lines hidden (view full) --- 1180 rt->rt6i_metric = cfg->fc_metric; 1181 1182 /* We cannot add true routes via loopback here, 1183 they would result in kernel looping; promote them to reject routes 1184 */ 1185 if ((cfg->fc_flags & RTF_REJECT) || 1186 (dev && (dev->flags&IFF_LOOPBACK) && !(addr_type&IPV6_ADDR_LOOPBACK))) { 1187 /* hold loopback dev/idev if we haven't done so. */ |
1188 if (dev != loopback_dev) { | 1188 if (dev != init_net.loopback_dev) { |
1189 if (dev) { 1190 dev_put(dev); 1191 in6_dev_put(idev); 1192 } | 1189 if (dev) { 1190 dev_put(dev); 1191 in6_dev_put(idev); 1192 } |
1193 dev = loopback_dev; | 1193 dev = init_net.loopback_dev; |
1194 dev_hold(dev); 1195 idev = in6_dev_get(dev); 1196 if (!idev) { 1197 err = -ENODEV; 1198 goto out; 1199 } 1200 } 1201 rt->u.dst.output = ip6_pkt_discard_out; --- 687 unchanged lines hidden (view full) --- 1889 const struct in6_addr *addr, 1890 int anycast) 1891{ 1892 struct rt6_info *rt = ip6_dst_alloc(); 1893 1894 if (rt == NULL) 1895 return ERR_PTR(-ENOMEM); 1896 | 1194 dev_hold(dev); 1195 idev = in6_dev_get(dev); 1196 if (!idev) { 1197 err = -ENODEV; 1198 goto out; 1199 } 1200 } 1201 rt->u.dst.output = ip6_pkt_discard_out; --- 687 unchanged lines hidden (view full) --- 1889 const struct in6_addr *addr, 1890 int anycast) 1891{ 1892 struct rt6_info *rt = ip6_dst_alloc(); 1893 1894 if (rt == NULL) 1895 return ERR_PTR(-ENOMEM); 1896 |
1897 dev_hold(loopback_dev); | 1897 dev_hold(init_net.loopback_dev); |
1898 in6_dev_hold(idev); 1899 1900 rt->u.dst.flags = DST_HOST; 1901 rt->u.dst.input = ip6_input; 1902 rt->u.dst.output = ip6_output; | 1898 in6_dev_hold(idev); 1899 1900 rt->u.dst.flags = DST_HOST; 1901 rt->u.dst.input = ip6_input; 1902 rt->u.dst.output = ip6_output; |
1903 rt->rt6i_dev = loopback_dev; | 1903 rt->rt6i_dev = init_net.loopback_dev; |
1904 rt->rt6i_idev = idev; 1905 rt->u.dst.metrics[RTAX_MTU-1] = ipv6_get_mtu(rt->rt6i_dev); 1906 rt->u.dst.metrics[RTAX_ADVMSS-1] = ipv6_advmss(dst_mtu(&rt->u.dst)); 1907 rt->u.dst.metrics[RTAX_HOPLIMIT-1] = -1; 1908 rt->u.dst.obsolete = -1; 1909 1910 rt->rt6i_flags = RTF_UP | RTF_NONEXTHOP; 1911 if (anycast) --- 684 unchanged lines hidden --- | 1904 rt->rt6i_idev = idev; 1905 rt->u.dst.metrics[RTAX_MTU-1] = ipv6_get_mtu(rt->rt6i_dev); 1906 rt->u.dst.metrics[RTAX_ADVMSS-1] = ipv6_advmss(dst_mtu(&rt->u.dst)); 1907 rt->u.dst.metrics[RTAX_HOPLIMIT-1] = -1; 1908 rt->u.dst.obsolete = -1; 1909 1910 rt->rt6i_flags = RTF_UP | RTF_NONEXTHOP; 1911 if (anycast) --- 684 unchanged lines hidden --- |