Changeset View
Changeset View
Standalone View
Standalone View
sys/net/if.c
Show First 20 Lines • Show All 4,321 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
int | int | ||||
if_getidxgen(const if_t ifp) | if_getidxgen(const if_t ifp) | ||||
{ | { | ||||
return (ifp->if_idxgen); | return (ifp->if_idxgen); | ||||
} | } | ||||
const char * | |||||
if_getdescr(if_t ifp) | |||||
{ | |||||
return (ifp->if_description); | |||||
} | |||||
void | void | ||||
if_setdescr(if_t ifp, char *descrbuf) | if_setdescr(if_t ifp, char *descrbuf) | ||||
{ | { | ||||
sx_xlock(&ifdescr_sx); | sx_xlock(&ifdescr_sx); | ||||
char *odescrbuf = ifp->if_description; | char *odescrbuf = ifp->if_description; | ||||
ifp->if_description = descrbuf; | ifp->if_description = descrbuf; | ||||
sx_xunlock(&ifdescr_sx); | sx_xunlock(&ifdescr_sx); | ||||
Show All 14 Lines | |||||
} | } | ||||
int | int | ||||
if_getalloctype(const if_t ifp) | if_getalloctype(const if_t ifp) | ||||
{ | { | ||||
return (ifp->if_alloctype); | return (ifp->if_alloctype); | ||||
} | } | ||||
void | |||||
if_setlastchange(if_t ifp) | |||||
{ | |||||
getmicrotime(&ifp->if_lastchange); | |||||
} | |||||
/* | /* | ||||
* This is largely undesirable because it ties ifnet to a device, but does | * This is largely undesirable because it ties ifnet to a device, but does | ||||
* provide flexiblity for an embedded product vendor. Should be used with | * provide flexiblity for an embedded product vendor. Should be used with | ||||
* the understanding that it violates the interface boundaries, and should be | * the understanding that it violates the interface boundaries, and should be | ||||
* a last resort only. | * a last resort only. | ||||
*/ | */ | ||||
int | int | ||||
if_setdev(if_t ifp, void *dev) | if_setdev(if_t ifp, void *dev) | ||||
▲ Show 20 Lines • Show All 341 Lines • ▼ Show 20 Lines | if (ifa->ifa_addr->sa_family != type) | ||||
continue; | continue; | ||||
count += (*cb)(cb_arg, ifa, count); | count += (*cb)(cb_arg, ifa, count); | ||||
} | } | ||||
NET_EPOCH_EXIT(et); | NET_EPOCH_EXIT(et); | ||||
return (count); | return (count); | ||||
} | } | ||||
struct ifaddr * | |||||
ifa_iter_start(if_t ifp, struct ifa_iter *iter) | |||||
{ | |||||
struct ifaddr *ifa; | |||||
NET_EPOCH_ASSERT(); | |||||
bzero(iter, sizeof(*iter)); | |||||
ifa = CK_STAILQ_FIRST(&ifp->if_addrhead); | |||||
if (ifa != NULL) | |||||
iter->context[0] = CK_STAILQ_NEXT(ifa, ifa_link); | |||||
else | |||||
iter->context[0] = NULL; | |||||
return (ifa); | |||||
} | |||||
struct ifaddr * | |||||
ifa_iter_next(struct ifa_iter *iter) | |||||
{ | |||||
struct ifaddr *ifa = iter->context[0]; | |||||
if (ifa != NULL) | |||||
iter->context[0] = CK_STAILQ_NEXT(ifa, ifa_link); | |||||
return (ifa); | |||||
} | |||||
void | |||||
ifa_iter_finish(struct ifa_iter *iter) | |||||
{ | |||||
/* Nothing to do here for now. */ | |||||
} | |||||
int | int | ||||
if_setsoftc(if_t ifp, void *softc) | if_setsoftc(if_t ifp, void *softc) | ||||
{ | { | ||||
ifp->if_softc = softc; | ifp->if_softc = softc; | ||||
return (0); | return (0); | ||||
} | } | ||||
void * | void * | ||||
▲ Show 20 Lines • Show All 93 Lines • ▼ Show 20 Lines | |||||
int | int | ||||
if_resolvemulti(if_t ifp, struct sockaddr **srcs, struct sockaddr *dst) | if_resolvemulti(if_t ifp, struct sockaddr **srcs, struct sockaddr *dst) | ||||
{ | { | ||||
if (ifp->if_resolvemulti == NULL) | if (ifp->if_resolvemulti == NULL) | ||||
return (EOPNOTSUPP); | return (EOPNOTSUPP); | ||||
return (ifp->if_resolvemulti(ifp, srcs, dst)); | return (ifp->if_resolvemulti(ifp, srcs, dst)); | ||||
} | |||||
int | |||||
if_ioctl(if_t ifp, u_long cmd, void *data) | |||||
{ | |||||
return (ifp->if_ioctl(ifp, cmd, data)); | |||||
} | } | ||||
struct mbuf * | struct mbuf * | ||||
if_dequeue(if_t ifp) | if_dequeue(if_t ifp) | ||||
{ | { | ||||
struct mbuf *m; | struct mbuf *m; | ||||
IFQ_DRV_DEQUEUE(&ifp->if_snd, m); | IFQ_DRV_DEQUEUE(&ifp->if_snd, m); | ||||
▲ Show 20 Lines • Show All 375 Lines • Show Last 20 Lines |