version 1.32, 2000/04/27 16:44:19 |
version 1.32.4.3, 2000/10/06 07:00:37 |
|
|
/* $NetBSD$ */ |
/* $NetBSD$ */ |
/* $KAME: in6.c,v 1.75 2000/04/12 03:51:29 itojun Exp $ */ |
/* $KAME: in6.c,v 1.107 2000/10/06 04:58:30 itojun Exp $ */ |
|
|
/* |
/* |
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. |
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. |
|
|
#include <net/if.h> |
#include <net/if.h> |
#include <net/if_types.h> |
#include <net/if_types.h> |
#include <net/route.h> |
#include <net/route.h> |
#include "gif.h" |
|
#if NGIF > 0 |
|
#include <net/if_gif.h> |
|
#endif |
|
#include <net/if_dl.h> |
#include <net/if_dl.h> |
|
|
#include <netinet/in.h> |
#include <netinet/in.h> |
Line 174 in6_ifloop_request(int cmd, struct ifadd |
|
Line 170 in6_ifloop_request(int cmd, struct ifadd |
|
{ |
{ |
struct sockaddr_in6 lo_sa; |
struct sockaddr_in6 lo_sa; |
struct sockaddr_in6 all1_sa; |
struct sockaddr_in6 all1_sa; |
struct rtentry *nrt = NULL; |
struct rtentry *nrt = NULL, **nrtp = NULL; |
|
|
bzero(&lo_sa, sizeof(lo_sa)); |
bzero(&lo_sa, sizeof(lo_sa)); |
bzero(&all1_sa, sizeof(all1_sa)); |
bzero(&all1_sa, sizeof(all1_sa)); |
Line 184 in6_ifloop_request(int cmd, struct ifadd |
|
Line 180 in6_ifloop_request(int cmd, struct ifadd |
|
lo_sa.sin6_addr = in6addr_loopback; |
lo_sa.sin6_addr = in6addr_loopback; |
all1_sa.sin6_addr = in6mask128; |
all1_sa.sin6_addr = in6mask128; |
|
|
/* So we add or remove static loopback entry, here. */ |
/* |
|
* So we add or remove static loopback entry, here. |
|
* This request for deletion could fail, e.g. when we remove |
|
* an address right after adding it. |
|
*/ |
|
if (cmd == RTM_ADD) |
|
nrtp = &nrt; |
rtrequest(cmd, ifa->ifa_addr, |
rtrequest(cmd, ifa->ifa_addr, |
(struct sockaddr *)&lo_sa, |
(struct sockaddr *)&lo_sa, |
(struct sockaddr *)&all1_sa, |
(struct sockaddr *)&all1_sa, |
RTF_UP|RTF_HOST, &nrt); |
RTF_UP|RTF_HOST, nrtp); |
|
|
/* |
/* |
* Make sure rt_ifa be equal to IFA, the second argument of the |
* Make sure rt_ifa be equal to IFA, the second argument of the |
Line 336 in6_control(so, cmd, data, ifp, p) |
|
Line 338 in6_control(so, cmd, data, ifp, p) |
|
if (p && !suser(p->p_ucred, &p->p_acflag)) |
if (p && !suser(p->p_ucred, &p->p_acflag)) |
privileged++; |
privileged++; |
|
|
/* |
|
* xxx should prevent processes for link-local addresses? |
|
*/ |
|
#if NGIF > 0 |
|
if (ifp && ifp->if_type == IFT_GIF) { |
|
switch (cmd) { |
|
case SIOCSIFPHYADDR_IN6: |
|
if (!privileged) |
|
return(EPERM); |
|
/*fall through*/ |
|
case SIOCGIFPSRCADDR_IN6: |
|
case SIOCGIFPDSTADDR_IN6: |
|
return gif_ioctl(ifp, cmd, data); |
|
} |
|
} |
|
#endif |
|
switch (cmd) { |
switch (cmd) { |
case SIOCGETSGCNT_IN6: |
case SIOCGETSGCNT_IN6: |
case SIOCGETMIFCNT_IN6: |
case SIOCGETMIFCNT_IN6: |
Line 1258 in6_ifinit(ifp, ia, sin6, scrub) |
|
Line 1244 in6_ifinit(ifp, ia, sin6, scrub) |
|
} |
} |
if ((error = rtinit(&(ia->ia_ifa), (int)RTM_ADD, flags)) == 0) |
if ((error = rtinit(&(ia->ia_ifa), (int)RTM_ADD, flags)) == 0) |
ia->ia_flags |= IFA_ROUTE; |
ia->ia_flags |= IFA_ROUTE; |
|
/* XXX check if the subnet route points to the same interface */ |
|
if (error == EEXIST) |
|
error = 0; |
|
|
/* Add ownaddr as loopback rtentry, if necessary(ex. on p2p link). */ |
/* Add ownaddr as loopback rtentry, if necessary(ex. on p2p link). */ |
in6_ifaddloop(&(ia->ia_ifa)); |
in6_ifaddloop(&(ia->ia_ifa)); |