Changeset View
Changeset View
Standalone View
Standalone View
head/usr.sbin/ppp/iface.c
Show First 20 Lines • Show All 139 Lines • ▼ Show 20 Lines | while (ptr < end && iface == NULL) { | ||||
ifm = (struct if_msghdr *)ptr; /* On if_msghdr */ | ifm = (struct if_msghdr *)ptr; /* On if_msghdr */ | ||||
if (ifm->ifm_type != RTM_IFINFO) | if (ifm->ifm_type != RTM_IFINFO) | ||||
break; | break; | ||||
dl = (struct sockaddr_dl *)(ifm + 1); /* Single _dl at end */ | dl = (struct sockaddr_dl *)(ifm + 1); /* Single _dl at end */ | ||||
if (dl->sdl_nlen == namelen && !strncmp(name, dl->sdl_data, namelen)) { | if (dl->sdl_nlen == namelen && !strncmp(name, dl->sdl_data, namelen)) { | ||||
iface = (struct iface *)malloc(sizeof *iface); | iface = (struct iface *)malloc(sizeof *iface); | ||||
if (iface == NULL) { | if (iface == NULL) { | ||||
fprintf(stderr, "iface_Create: malloc: %s\n", strerror(errno)); | fprintf(stderr, "iface_Create: malloc: %s\n", strerror(errno)); | ||||
free(buf); | |||||
return NULL; | return NULL; | ||||
} | } | ||||
iface->name = strdup(name); | iface->name = strdup(name); | ||||
iface->descr = NULL; | iface->descr = NULL; | ||||
iface->index = ifm->ifm_index; | iface->index = ifm->ifm_index; | ||||
iface->flags = ifm->ifm_flags; | iface->flags = ifm->ifm_flags; | ||||
iface->mtu = 0; | iface->mtu = 0; | ||||
iface->addrs = 0; | iface->addrs = 0; | ||||
▲ Show 20 Lines • Show All 681 Lines • Show Last 20 Lines |