addrconf.c (dfc47ef8639facd77210e74be831943c2fdd9c74) addrconf.c (af31f412c7c7a3c0fda4bf4beaf0c85af1f263c8)
1/*
2 * IPv6 Address [auto]configuration
3 * Linux INET6 implementation
4 *
5 * Authors:
6 * Pedro Roque <roque@di.fc.ul.pt>
7 * Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
8 *

--- 2399 unchanged lines hidden (view full) ---

2408}
2409
2410
2411int addrconf_add_ifaddr(struct net *net, void __user *arg)
2412{
2413 struct in6_ifreq ireq;
2414 int err;
2415
1/*
2 * IPv6 Address [auto]configuration
3 * Linux INET6 implementation
4 *
5 * Authors:
6 * Pedro Roque <roque@di.fc.ul.pt>
7 * Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
8 *

--- 2399 unchanged lines hidden (view full) ---

2408}
2409
2410
2411int addrconf_add_ifaddr(struct net *net, void __user *arg)
2412{
2413 struct in6_ifreq ireq;
2414 int err;
2415
2416 if (!capable(CAP_NET_ADMIN))
2416 if (!ns_capable(net->user_ns, CAP_NET_ADMIN))
2417 return -EPERM;
2418
2419 if (copy_from_user(&ireq, arg, sizeof(struct in6_ifreq)))
2420 return -EFAULT;
2421
2422 rtnl_lock();
2423 err = inet6_addr_add(net, ireq.ifr6_ifindex, &ireq.ifr6_addr,
2424 ireq.ifr6_prefixlen, IFA_F_PERMANENT,
2425 INFINITY_LIFE_TIME, INFINITY_LIFE_TIME);
2426 rtnl_unlock();
2427 return err;
2428}
2429
2430int addrconf_del_ifaddr(struct net *net, void __user *arg)
2431{
2432 struct in6_ifreq ireq;
2433 int err;
2434
2417 return -EPERM;
2418
2419 if (copy_from_user(&ireq, arg, sizeof(struct in6_ifreq)))
2420 return -EFAULT;
2421
2422 rtnl_lock();
2423 err = inet6_addr_add(net, ireq.ifr6_ifindex, &ireq.ifr6_addr,
2424 ireq.ifr6_prefixlen, IFA_F_PERMANENT,
2425 INFINITY_LIFE_TIME, INFINITY_LIFE_TIME);
2426 rtnl_unlock();
2427 return err;
2428}
2429
2430int addrconf_del_ifaddr(struct net *net, void __user *arg)
2431{
2432 struct in6_ifreq ireq;
2433 int err;
2434
2435 if (!capable(CAP_NET_ADMIN))
2435 if (!ns_capable(net->user_ns, CAP_NET_ADMIN))
2436 return -EPERM;
2437
2438 if (copy_from_user(&ireq, arg, sizeof(struct in6_ifreq)))
2439 return -EFAULT;
2440
2441 rtnl_lock();
2442 err = inet6_addr_del(net, ireq.ifr6_ifindex, &ireq.ifr6_addr,
2443 ireq.ifr6_prefixlen);

--- 2556 unchanged lines hidden ---
2436 return -EPERM;
2437
2438 if (copy_from_user(&ireq, arg, sizeof(struct in6_ifreq)))
2439 return -EFAULT;
2440
2441 rtnl_lock();
2442 err = inet6_addr_del(net, ireq.ifr6_ifindex, &ireq.ifr6_addr,
2443 ireq.ifr6_prefixlen);

--- 2556 unchanged lines hidden ---