Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet6/in6_rmx.c
Show First 20 Lines • Show All 74 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 <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_request *req) | |||||
{ | |||||
/* XXX: RTF_LOCAL */ | |||||
/* | /* | ||||
* Check route MTU: | |||||
* inherit interface MTU if not set or | |||||
* check if MTU is too large. | |||||
*/ | |||||
if (req->mtu == 0) { | |||||
req->mtu = IN6_LINKMTU(req->ifp); | |||||
} else if (req->mtu > IN6_LINKMTU(req->ifp)) | |||||
req->mtu = IN6_LINKMTU(req->ifp); | |||||
/* Ensure that default route nhop has special flag */ | |||||
const struct sockaddr_in6 *mask6 = (const struct sockaddr_in6 *)mask; | |||||
if ((req->rt_flags & RTF_HOST) == 0 && IN6_IS_ADDR_UNSPECIFIED(&mask6->sin6_addr)) | |||||
req->nh_flags_additional |= NHF_DEFAULT; | |||||
/* Set nexthop type */ | |||||
if (req->nh_type == 0) { | |||||
if (req->rt_flags & RTF_GATEWAY) | |||||
req->nh_type = NH_TYPE_IPV6_ETHER_NHOP; | |||||
else | |||||
req->nh_type = NH_TYPE_IPV6_ETHER_RSLV; | |||||
} | |||||
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; | |||||
*head = (void *)rh; | *head = (void *)rh; | ||||
return (1); | return (1); | ||||
} | } | ||||
#ifdef VIMAGE | #ifdef VIMAGE | ||||
int | int | ||||
in6_detachhead(void **head, int off) | in6_detachhead(void **head, int off) | ||||
Show All 39 Lines |