Changeset View
Changeset View
Standalone View
Standalone View
head/sys/netinet6/nd6.c
Show First 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | |||||
#include <sys/sdt.h> | #include <sys/sdt.h> | ||||
#include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
#include <net/if.h> | #include <net/if.h> | ||||
#include <net/if_var.h> | #include <net/if_var.h> | ||||
#include <net/if_dl.h> | #include <net/if_dl.h> | ||||
#include <net/if_types.h> | #include <net/if_types.h> | ||||
#include <net/route.h> | #include <net/route.h> | ||||
#include <net/route/route_var.h> | #include <net/route/route_ctl.h> | ||||
#include <net/route/nhop.h> | #include <net/route/nhop.h> | ||||
#include <net/vnet.h> | #include <net/vnet.h> | ||||
#include <netinet/in.h> | #include <netinet/in.h> | ||||
#include <netinet/in_kdtrace.h> | #include <netinet/in_kdtrace.h> | ||||
#include <net/if_llatbl.h> | #include <net/if_llatbl.h> | ||||
#include <netinet/if_ether.h> | #include <netinet/if_ether.h> | ||||
#include <netinet6/in6_var.h> | #include <netinet6/in6_var.h> | ||||
▲ Show 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | |||||
static void nd6_setmtu0(struct ifnet *, struct nd_ifinfo *); | static void nd6_setmtu0(struct ifnet *, struct nd_ifinfo *); | ||||
static void nd6_slowtimo(void *); | static void nd6_slowtimo(void *); | ||||
static int regen_tmpaddr(struct in6_ifaddr *); | static int regen_tmpaddr(struct in6_ifaddr *); | ||||
static void nd6_free(struct llentry **, int); | static void nd6_free(struct llentry **, int); | ||||
static void nd6_free_redirect(const struct llentry *); | static void nd6_free_redirect(const struct llentry *); | ||||
static void nd6_llinfo_timer(void *); | static void nd6_llinfo_timer(void *); | ||||
static void nd6_llinfo_settimer_locked(struct llentry *, long); | static void nd6_llinfo_settimer_locked(struct llentry *, long); | ||||
static void clear_llinfo_pqueue(struct llentry *); | static void clear_llinfo_pqueue(struct llentry *); | ||||
static void nd6_rtrequest(int, struct rtentry *, struct nhop_object *, | |||||
struct rt_addrinfo *); | |||||
static int nd6_resolve_slow(struct ifnet *, int, struct mbuf *, | static int nd6_resolve_slow(struct ifnet *, int, struct mbuf *, | ||||
const struct sockaddr_in6 *, u_char *, uint32_t *, struct llentry **); | const struct sockaddr_in6 *, u_char *, uint32_t *, struct llentry **); | ||||
static int nd6_need_cache(struct ifnet *); | static int nd6_need_cache(struct ifnet *); | ||||
VNET_DEFINE_STATIC(struct callout, nd6_slowtimo_ch); | VNET_DEFINE_STATIC(struct callout, nd6_slowtimo_ch); | ||||
#define V_nd6_slowtimo_ch VNET(nd6_slowtimo_ch) | #define V_nd6_slowtimo_ch VNET(nd6_slowtimo_ch) | ||||
▲ Show 20 Lines • Show All 1,424 Lines • ▼ Show 20 Lines | nd6_free_redirect(const struct llentry *ln) | ||||
NET_EPOCH_ENTER(et); | NET_EPOCH_ENTER(et); | ||||
for (fibnum = 0; fibnum < rt_numfibs; fibnum++) | for (fibnum = 0; fibnum < rt_numfibs; fibnum++) | ||||
rtrequest1_fib(RTM_DELETE, &info, NULL, fibnum); | rtrequest1_fib(RTM_DELETE, &info, NULL, fibnum); | ||||
NET_EPOCH_EXIT(et); | NET_EPOCH_EXIT(et); | ||||
} | } | ||||
/* | /* | ||||
* Rejuvenate this function for routing operations related | * Updates status of the default router route. | ||||
* processing. | |||||
*/ | */ | ||||
void | void | ||||
nd6_rtrequest(int req, struct rtentry *rt, struct nhop_object *nh, | nd6_subscription_cb(struct rib_head *rnh, struct rib_cmd_info *rc, void *arg) | ||||
struct rt_addrinfo *info) | |||||
{ | { | ||||
struct sockaddr_in6 *gateway; | |||||
struct nd_defrouter *dr; | struct nd_defrouter *dr; | ||||
struct nhop_object *nh; | |||||
gateway = &nh->gw6_sa; | if (rc->rc_cmd == RTM_DELETE) { | ||||
nh = rc->rc_nh_old; | |||||
switch (req) { | |||||
case RTM_ADD: | |||||
break; | |||||
case RTM_DELETE: | |||||
/* | |||||
* Only indirect routes are interesting. | |||||
*/ | |||||
if ((nh->nh_flags & NHF_GATEWAY) == 0) | |||||
return; | |||||
/* | |||||
* check for default route | |||||
*/ | |||||
if (nh->nh_flags & NHF_DEFAULT) { | if (nh->nh_flags & NHF_DEFAULT) { | ||||
dr = defrouter_lookup(&gateway->sin6_addr, nh->nh_ifp); | dr = defrouter_lookup(&nh->gw6_sa.sin6_addr, nh->nh_ifp); | ||||
if (dr != NULL) { | if (dr != NULL) { | ||||
dr->installed = 0; | dr->installed = 0; | ||||
defrouter_rele(dr); | defrouter_rele(dr); | ||||
} | } | ||||
} | } | ||||
break; | |||||
} | } | ||||
} | } | ||||
int | int | ||||
nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp) | nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp) | ||||
{ | { | ||||
struct in6_ndireq *ndi = (struct in6_ndireq *)data; | struct in6_ndireq *ndi = (struct in6_ndireq *)data; | ||||
▲ Show 20 Lines • Show All 903 Lines • ▼ Show 20 Lines | nd6_add_ifa_lle(struct in6_ifaddr *ia) | ||||
struct ifnet *ifp; | struct ifnet *ifp; | ||||
struct llentry *ln, *ln_tmp; | struct llentry *ln, *ln_tmp; | ||||
struct sockaddr *dst; | struct sockaddr *dst; | ||||
ifp = ia->ia_ifa.ifa_ifp; | ifp = ia->ia_ifa.ifa_ifp; | ||||
if (nd6_need_cache(ifp) == 0) | if (nd6_need_cache(ifp) == 0) | ||||
return (0); | return (0); | ||||
ia->ia_ifa.ifa_rtrequest = nd6_rtrequest; | |||||
dst = (struct sockaddr *)&ia->ia_addr; | dst = (struct sockaddr *)&ia->ia_addr; | ||||
ln = lltable_alloc_entry(LLTABLE6(ifp), LLE_IFADDR, dst); | ln = lltable_alloc_entry(LLTABLE6(ifp), LLE_IFADDR, dst); | ||||
if (ln == NULL) | if (ln == NULL) | ||||
return (ENOBUFS); | return (ENOBUFS); | ||||
IF_AFDATA_WLOCK(ifp); | IF_AFDATA_WLOCK(ifp); | ||||
LLE_WLOCK(ln); | LLE_WLOCK(ln); | ||||
/* Unlink any entry if exists */ | /* Unlink any entry if exists */ | ||||
▲ Show 20 Lines • Show All 134 Lines • Show Last 20 Lines |