Changeset View
Changeset View
Standalone View
Standalone View
head/sys/netinet6/in6_rmx.c
Show First 20 Lines • Show All 76 Lines • ▼ Show 20 Lines | |||||
#include <sys/rwlock.h> | #include <sys/rwlock.h> | ||||
#include <sys/syslog.h> | #include <sys/syslog.h> | ||||
#include <sys/callout.h> | #include <sys/callout.h> | ||||
#include <net/if.h> | #include <net/if.h> | ||||
#include <net/if_var.h> | #include <net/if_var.h> | ||||
#include <net/route.h> | #include <net/route.h> | ||||
#include <net/route_var.h> | #include <net/route_var.h> | ||||
#include <net/route/nhop.h> | |||||
#include <net/route/shared.h> | |||||
#include <netinet/in.h> | #include <netinet/in.h> | ||||
#include <netinet/ip_var.h> | #include <netinet/ip_var.h> | ||||
#include <netinet/in_var.h> | #include <netinet/in_var.h> | ||||
#include <netinet/ip6.h> | #include <netinet/ip6.h> | ||||
#include <netinet6/ip6_var.h> | #include <netinet6/ip6_var.h> | ||||
#include <netinet/icmp6.h> | #include <netinet/icmp6.h> | ||||
#include <netinet6/nd6.h> | #include <netinet6/nd6.h> | ||||
#include <netinet/tcp.h> | #include <netinet/tcp.h> | ||||
#include <netinet/tcp_seq.h> | #include <netinet/tcp_seq.h> | ||||
#include <netinet/tcp_timer.h> | #include <netinet/tcp_timer.h> | ||||
#include <netinet/tcp_var.h> | #include <netinet/tcp_var.h> | ||||
extern int in6_inithead(void **head, int off, u_int fibnum); | extern int in6_inithead(void **head, int off, u_int fibnum); | ||||
#ifdef VIMAGE | #ifdef VIMAGE | ||||
extern int in6_detachhead(void **head, int off); | extern int in6_detachhead(void **head, int off); | ||||
#endif | #endif | ||||
static int | |||||
rib6_preadd(u_int fibnum, const struct sockaddr *addr, const struct sockaddr *mask, | |||||
struct nhop_object *nh) | |||||
{ | |||||
uint16_t nh_type; | |||||
/* XXX: RTF_LOCAL */ | |||||
/* | /* | ||||
* Check route MTU: | |||||
* inherit interface MTU if not set or | |||||
* check if MTU is too large. | |||||
*/ | |||||
if (nh->nh_mtu == 0) { | |||||
nh->nh_mtu = IN6_LINKMTU(nh->nh_ifp); | |||||
} else if (nh->nh_mtu > IN6_LINKMTU(nh->nh_ifp)) | |||||
nh->nh_mtu = IN6_LINKMTU(nh->nh_ifp); | |||||
/* Ensure that default route nhop has special flag */ | |||||
const struct sockaddr_in6 *mask6 = (const struct sockaddr_in6 *)mask; | |||||
if ((nhop_get_rtflags(nh) & RTF_HOST) == 0 && | |||||
IN6_IS_ADDR_UNSPECIFIED(&mask6->sin6_addr)) | |||||
nh->nh_flags |= NHF_DEFAULT; | |||||
/* Set nexthop type */ | |||||
if (nhop_get_type(nh) == 0) { | |||||
if (nh->nh_flags & NHF_GATEWAY) | |||||
nh_type = NH_TYPE_IPV6_ETHER_NHOP; | |||||
else | |||||
nh_type = NH_TYPE_IPV6_ETHER_RSLV; | |||||
nhop_set_type(nh, nh_type); | |||||
} | |||||
return (0); | |||||
} | |||||
/* | |||||
* Do what we need to do when inserting a route. | * Do what we need to do when inserting a route. | ||||
*/ | */ | ||||
static struct radix_node * | static struct radix_node * | ||||
in6_addroute(void *v_arg, void *n_arg, struct radix_head *head, | in6_addroute(void *v_arg, void *n_arg, struct radix_head *head, | ||||
struct radix_node *treenodes) | struct radix_node *treenodes) | ||||
{ | { | ||||
struct rtentry *rt = (struct rtentry *)treenodes; | struct rtentry *rt = (struct rtentry *)treenodes; | ||||
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)rt_key(rt); | struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)rt_key(rt); | ||||
▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | in6_inithead(void **head, int off, u_int fibnum) | ||||
struct rib_head *rh; | struct rib_head *rh; | ||||
rh = rt_table_init(offsetof(struct sockaddr_in6, sin6_addr) << 3, | rh = rt_table_init(offsetof(struct sockaddr_in6, sin6_addr) << 3, | ||||
AF_INET6, fibnum); | AF_INET6, fibnum); | ||||
if (rh == NULL) | if (rh == NULL) | ||||
return (0); | return (0); | ||||
rh->rnh_addaddr = in6_addroute; | rh->rnh_addaddr = in6_addroute; | ||||
rh->rnh_preadd = rib6_preadd; | |||||
#ifdef RADIX_MPATH | #ifdef RADIX_MPATH | ||||
rt_mpath_init_rnh(rh); | rt_mpath_init_rnh(rh); | ||||
#endif | #endif | ||||
*head = (void *)rh; | *head = (void *)rh; | ||||
return (1); | return (1); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |