Changeset View
Changeset View
Standalone View
Standalone View
sbin/ifconfig/af_inet.c
Show First 20 Lines • Show All 170 Lines • ▼ Show 20 Lines | bcopy(hp->h_addr, (char *)&sin->sin_addr, | ||||
MIN((size_t)hp->h_length, sizeof(sin->sin_addr))); | MIN((size_t)hp->h_length, sizeof(sin->sin_addr))); | ||||
else if ((np = getnetbyname(s)) != NULL) | else if ((np = getnetbyname(s)) != NULL) | ||||
sin->sin_addr = inet_makeaddr(np->n_net, INADDR_ANY); | sin->sin_addr = inet_makeaddr(np->n_net, INADDR_ANY); | ||||
else | else | ||||
errx(1, "%s: bad value", s); | errx(1, "%s: bad value", s); | ||||
} | } | ||||
static void | static void | ||||
in_postproc(int s, const struct afswtch *afp, int newaddr, int ifflags) | |||||
{ | |||||
if (sintab[ADDR]->sin_len != 0 && sintab[MASK]->sin_len == 0 && | |||||
newaddr && (ifflags & (IFF_POINTOPOINT | IFF_LOOPBACK)) == 0) { | |||||
warnx("WARNING: setting interface address without mask " | |||||
"is deprecated,\ndefault mask may not be correct."); | |||||
} | |||||
} | |||||
static void | |||||
in_status_tunnel(int s) | in_status_tunnel(int s) | ||||
{ | { | ||||
char src[NI_MAXHOST]; | char src[NI_MAXHOST]; | ||||
char dst[NI_MAXHOST]; | char dst[NI_MAXHOST]; | ||||
struct ifreq ifr; | struct ifreq ifr; | ||||
const struct sockaddr *sa = (const struct sockaddr *) &ifr.ifr_addr; | const struct sockaddr *sa = (const struct sockaddr *) &ifr.ifr_addr; | ||||
memset(&ifr, 0, sizeof(ifr)); | memset(&ifr, 0, sizeof(ifr)); | ||||
Show All 30 Lines | if (ioctl(s, SIOCSIFPHYADDR, &addreq) < 0) | ||||
warn("SIOCSIFPHYADDR"); | warn("SIOCSIFPHYADDR"); | ||||
} | } | ||||
static struct afswtch af_inet = { | static struct afswtch af_inet = { | ||||
.af_name = "inet", | .af_name = "inet", | ||||
.af_af = AF_INET, | .af_af = AF_INET, | ||||
.af_status = in_status, | .af_status = in_status, | ||||
.af_getaddr = in_getaddr, | .af_getaddr = in_getaddr, | ||||
.af_postproc = in_postproc, | |||||
.af_status_tunnel = in_status_tunnel, | .af_status_tunnel = in_status_tunnel, | ||||
.af_settunnel = in_set_tunnel, | .af_settunnel = in_set_tunnel, | ||||
.af_difaddr = SIOCDIFADDR, | .af_difaddr = SIOCDIFADDR, | ||||
.af_aifaddr = SIOCAIFADDR, | .af_aifaddr = SIOCAIFADDR, | ||||
.af_ridreq = &in_ridreq, | .af_ridreq = &in_ridreq, | ||||
.af_addreq = &in_addreq, | .af_addreq = &in_addreq, | ||||
}; | }; | ||||
Show All 10 Lines |