Changeset View
Changeset View
Standalone View
Standalone View
sys/net/rtsock.c
Show First 20 Lines • Show All 201 Lines • ▼ Show 20 Lines | |||||
static int sysctl_dumpentry(struct rtentry *rt, void *vw); | static int sysctl_dumpentry(struct rtentry *rt, void *vw); | ||||
static int sysctl_dumpnhop(struct rtentry *rt, struct nhop_object *nh, | static int sysctl_dumpnhop(struct rtentry *rt, struct nhop_object *nh, | ||||
uint32_t weight, struct walkarg *w); | uint32_t weight, struct walkarg *w); | ||||
static int sysctl_iflist(int af, struct walkarg *w); | static int sysctl_iflist(int af, struct walkarg *w); | ||||
static int sysctl_ifmalist(int af, struct walkarg *w); | static int sysctl_ifmalist(int af, struct walkarg *w); | ||||
static void rt_getmetrics(const struct rtentry *rt, | static void rt_getmetrics(const struct rtentry *rt, | ||||
const struct nhop_object *nh, struct rt_metrics *out); | const struct nhop_object *nh, struct rt_metrics *out); | ||||
static void rt_dispatch(struct mbuf *, sa_family_t); | static void rt_dispatch(struct mbuf *, sa_family_t); | ||||
static void rt_ifannouncemsg(struct ifnet *ifp, int what); | |||||
static int handle_rtm_get(struct rt_addrinfo *info, u_int fibnum, | static int handle_rtm_get(struct rt_addrinfo *info, u_int fibnum, | ||||
struct rt_msghdr *rtm, struct rib_cmd_info *rc); | struct rt_msghdr *rtm, struct rib_cmd_info *rc); | ||||
static int update_rtm_from_rc(struct rt_addrinfo *info, | static int update_rtm_from_rc(struct rt_addrinfo *info, | ||||
struct rt_msghdr **prtm, int alloc_len, | struct rt_msghdr **prtm, int alloc_len, | ||||
struct rib_cmd_info *rc, struct nhop_object *nh); | struct rib_cmd_info *rc, struct nhop_object *nh); | ||||
static void send_rtm_reply(struct socket *so, struct rt_msghdr *rtm, | static void send_rtm_reply(struct socket *so, struct rt_msghdr *rtm, | ||||
struct mbuf *m, sa_family_t saf, u_int fibnum, | struct mbuf *m, sa_family_t saf, u_int fibnum, | ||||
int rtm_errno); | int rtm_errno); | ||||
▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | vnet_rts_uninit(void) | ||||
netisr_unregister_vnet(&rtsock_nh); | netisr_unregister_vnet(&rtsock_nh); | ||||
} | } | ||||
VNET_SYSUNINIT(vnet_rts_uninit, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, | VNET_SYSUNINIT(vnet_rts_uninit, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, | ||||
vnet_rts_uninit, 0); | vnet_rts_uninit, 0); | ||||
#endif | #endif | ||||
static void | static void | ||||
rts_handle_ifnet_arrival(void *arg __unused, struct ifnet *ifp) | |||||
{ | |||||
rt_ifannouncemsg(ifp, IFAN_ARRIVAL); | |||||
} | |||||
EVENTHANDLER_DEFINE(ifnet_arrival_event, rts_handle_ifnet_arrival, NULL, 0); | |||||
static void | |||||
rts_handle_ifnet_departure(void *arg __unused, struct ifnet *ifp) | |||||
{ | |||||
rt_ifannouncemsg(ifp, IFAN_DEPARTURE); | |||||
} | |||||
EVENTHANDLER_DEFINE(ifnet_departure_event, rts_handle_ifnet_departure, NULL, 0); | |||||
static void | |||||
rts_append_data(struct socket *so, struct mbuf *m) | rts_append_data(struct socket *so, struct mbuf *m) | ||||
{ | { | ||||
if (sbappendaddr(&so->so_rcv, &route_src, m, NULL) == 0) { | if (sbappendaddr(&so->so_rcv, &route_src, m, NULL) == 0) { | ||||
soroverflow(so); | soroverflow(so); | ||||
m_freem(m); | m_freem(m); | ||||
} else | } else | ||||
glebius: Just following our today conversation. Here we should either use EVENTHANDLER_DEFINE() or… | |||||
sorwakeup(so); | sorwakeup(so); | ||||
} | } | ||||
static void | static void | ||||
rts_input(struct mbuf *m) | rts_input(struct mbuf *m) | ||||
{ | { | ||||
struct rcb *rcb; | struct rcb *rcb; | ||||
struct socket *last; | struct socket *last; | ||||
▲ Show 20 Lines • Show All 1,816 Lines • ▼ Show 20 Lines | if (m != NULL) { | ||||
rt_dispatch(m, AF_UNSPEC); | rt_dispatch(m, AF_UNSPEC); | ||||
} | } | ||||
} | } | ||||
/* | /* | ||||
* This is called to generate routing socket messages indicating | * This is called to generate routing socket messages indicating | ||||
* network interface arrival and departure. | * network interface arrival and departure. | ||||
*/ | */ | ||||
void | static void | ||||
rt_ifannouncemsg(struct ifnet *ifp, int what) | rt_ifannouncemsg(struct ifnet *ifp, int what) | ||||
{ | { | ||||
struct mbuf *m; | struct mbuf *m; | ||||
struct rt_addrinfo info; | struct rt_addrinfo info; | ||||
m = rt_makeifannouncemsg(ifp, RTM_IFANNOUNCE, what, &info); | m = rt_makeifannouncemsg(ifp, RTM_IFANNOUNCE, what, &info); | ||||
if (m != NULL) | if (m != NULL) | ||||
rt_dispatch(m, AF_UNSPEC); | rt_dispatch(m, AF_UNSPEC); | ||||
▲ Show 20 Lines • Show All 548 Lines • Show Last 20 Lines |
Just following our today conversation. Here we should either use EVENTHANDLER_DEFINE() or actually implement proper EVENTHANDLER_SYSINIT(). Did you check that EVENTHANDLER_DEFINE() will or will not work here?