aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorIlpo Järvinen <ilpo.jarvinen@helsinki.fi>2009-02-07 02:48:01 -0500
committerDavid S. Miller <davem@davemloft.net>2009-02-07 02:48:01 -0500
commitb5f348e5a41b39543c1c5efd661d7fd296dd5281 (patch)
treeb089d169aa873204d3945d2d6f4d395cfce08f49 /net
parentd73f08011bc30c03a2bcb1ccd880e4be84aea269 (diff)
ipv6/addrconf: common code located
$ codiff net/ipv6/addrconf.o net/ipv6/addrconf.o.new net/ipv6/addrconf.c: addrconf_notify | -267 1 function changed, 267 bytes removed net/ipv6/addrconf.c: add_addr | +86 1 function changed, 86 bytes added net/ipv6/addrconf.o.new: 2 functions changed, 86 bytes added, 267 bytes removed, diff: -181 Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv6/addrconf.c45
1 files changed, 18 insertions, 27 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index f9afb452249c..03e2a1ad71e9 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -2224,10 +2224,24 @@ int addrconf_del_ifaddr(struct net *net, void __user *arg)
2224 return err; 2224 return err;
2225} 2225}
2226 2226
2227static void add_addr(struct inet6_dev *idev, const struct in6_addr *addr,
2228 int plen, int scope)
2229{
2230 struct inet6_ifaddr *ifp;
2231
2232 ifp = ipv6_add_addr(idev, addr, plen, scope, IFA_F_PERMANENT);
2233 if (!IS_ERR(ifp)) {
2234 spin_lock_bh(&ifp->lock);
2235 ifp->flags &= ~IFA_F_TENTATIVE;
2236 spin_unlock_bh(&ifp->lock);
2237 ipv6_ifa_notify(RTM_NEWADDR, ifp);
2238 in6_ifa_put(ifp);
2239 }
2240}
2241
2227#if defined(CONFIG_IPV6_SIT) || defined(CONFIG_IPV6_SIT_MODULE) 2242#if defined(CONFIG_IPV6_SIT) || defined(CONFIG_IPV6_SIT_MODULE)
2228static void sit_add_v4_addrs(struct inet6_dev *idev) 2243static void sit_add_v4_addrs(struct inet6_dev *idev)
2229{ 2244{
2230 struct inet6_ifaddr * ifp;
2231 struct in6_addr addr; 2245 struct in6_addr addr;
2232 struct net_device *dev; 2246 struct net_device *dev;
2233 struct net *net = dev_net(idev->dev); 2247 struct net *net = dev_net(idev->dev);
@@ -2246,14 +2260,7 @@ static void sit_add_v4_addrs(struct inet6_dev *idev)
2246 } 2260 }
2247 2261
2248 if (addr.s6_addr32[3]) { 2262 if (addr.s6_addr32[3]) {
2249 ifp = ipv6_add_addr(idev, &addr, 128, scope, IFA_F_PERMANENT); 2263 add_addr(idev, &addr, 128, scope);
2250 if (!IS_ERR(ifp)) {
2251 spin_lock_bh(&ifp->lock);
2252 ifp->flags &= ~IFA_F_TENTATIVE;
2253 spin_unlock_bh(&ifp->lock);
2254 ipv6_ifa_notify(RTM_NEWADDR, ifp);
2255 in6_ifa_put(ifp);
2256 }
2257 return; 2264 return;
2258 } 2265 }
2259 2266
@@ -2281,15 +2288,7 @@ static void sit_add_v4_addrs(struct inet6_dev *idev)
2281 else 2288 else
2282 plen = 96; 2289 plen = 96;
2283 2290
2284 ifp = ipv6_add_addr(idev, &addr, plen, flag, 2291 add_addr(idev, &addr, plen, flag);
2285 IFA_F_PERMANENT);
2286 if (!IS_ERR(ifp)) {
2287 spin_lock_bh(&ifp->lock);
2288 ifp->flags &= ~IFA_F_TENTATIVE;
2289 spin_unlock_bh(&ifp->lock);
2290 ipv6_ifa_notify(RTM_NEWADDR, ifp);
2291 in6_ifa_put(ifp);
2292 }
2293 } 2292 }
2294 } 2293 }
2295 } 2294 }
@@ -2299,7 +2298,6 @@ static void sit_add_v4_addrs(struct inet6_dev *idev)
2299static void init_loopback(struct net_device *dev) 2298static void init_loopback(struct net_device *dev)
2300{ 2299{
2301 struct inet6_dev *idev; 2300 struct inet6_dev *idev;
2302 struct inet6_ifaddr * ifp;
2303 2301
2304 /* ::1 */ 2302 /* ::1 */
2305 2303
@@ -2310,14 +2308,7 @@ static void init_loopback(struct net_device *dev)
2310 return; 2308 return;
2311 } 2309 }
2312 2310
2313 ifp = ipv6_add_addr(idev, &in6addr_loopback, 128, IFA_HOST, IFA_F_PERMANENT); 2311 add_addr(idev, &in6addr_loopback, 128, IFA_HOST);
2314 if (!IS_ERR(ifp)) {
2315 spin_lock_bh(&ifp->lock);
2316 ifp->flags &= ~IFA_F_TENTATIVE;
2317 spin_unlock_bh(&ifp->lock);
2318 ipv6_ifa_notify(RTM_NEWADDR, ifp);
2319 in6_ifa_put(ifp);
2320 }
2321} 2312}
2322 2313
2323static void addrconf_add_linklocal(struct inet6_dev *idev, struct in6_addr *addr) 2314static void addrconf_add_linklocal(struct inet6_dev *idev, struct in6_addr *addr)