Changeset View
Changeset View
Standalone View
Standalone View
sys/net/route.c
Show First 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | |||||
#include <sys/mbuf.h> | #include <sys/mbuf.h> | ||||
#include <sys/socket.h> | #include <sys/socket.h> | ||||
#include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
#include <sys/syslog.h> | #include <sys/syslog.h> | ||||
#include <sys/sysproto.h> | #include <sys/sysproto.h> | ||||
#include <sys/proc.h> | #include <sys/proc.h> | ||||
#include <sys/domain.h> | #include <sys/domain.h> | ||||
#include <sys/kernel.h> | #include <sys/kernel.h> | ||||
#include <sys/lock.h> | |||||
#include <sys/rmlock.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/route.h> | #include <net/route.h> | ||||
#include <net/route_var.h> | #include <net/route_var.h> | ||||
#include <net/vnet.h> | #include <net/vnet.h> | ||||
▲ Show 20 Lines • Show All 370 Lines • ▼ Show 20 Lines | rtalloc1(struct sockaddr *dst, int report, u_long ignflags) | ||||
return (rtalloc1_fib(dst, report, ignflags, RT_DEFAULT_FIB)); | return (rtalloc1_fib(dst, report, ignflags, RT_DEFAULT_FIB)); | ||||
} | } | ||||
struct rtentry * | struct rtentry * | ||||
rtalloc1_fib(struct sockaddr *dst, int report, u_long ignflags, | rtalloc1_fib(struct sockaddr *dst, int report, u_long ignflags, | ||||
u_int fibnum) | u_int fibnum) | ||||
{ | { | ||||
RIB_RLOCK_TRACKER; | |||||
struct rib_head *rh; | struct rib_head *rh; | ||||
struct radix_node *rn; | struct radix_node *rn; | ||||
struct rtentry *newrt; | struct rtentry *newrt; | ||||
struct rt_addrinfo info; | struct rt_addrinfo info; | ||||
int err = 0, msgtype = RTM_MISS; | int err = 0, msgtype = RTM_MISS; | ||||
KASSERT((fibnum < rt_numfibs), ("rtalloc1_fib: bad fibnum")); | KASSERT((fibnum < rt_numfibs), ("rtalloc1_fib: bad fibnum")); | ||||
rh = rt_tables_get_rnh(fibnum, dst->sa_family); | rh = rt_tables_get_rnh(fibnum, dst->sa_family); | ||||
▲ Show 20 Lines • Show All 467 Lines • ▼ Show 20 Lines | |||||
* | * | ||||
* Returns 0 on success. | * Returns 0 on success. | ||||
* Returns ENOENT for lookup failure, ENOMEM for export failure. | * Returns ENOENT for lookup failure, ENOMEM for export failure. | ||||
*/ | */ | ||||
int | int | ||||
rib_lookup_info(uint32_t fibnum, const struct sockaddr *dst, uint32_t flags, | rib_lookup_info(uint32_t fibnum, const struct sockaddr *dst, uint32_t flags, | ||||
uint32_t flowid, struct rt_addrinfo *info) | uint32_t flowid, struct rt_addrinfo *info) | ||||
{ | { | ||||
RIB_RLOCK_TRACKER; | |||||
struct rib_head *rh; | struct rib_head *rh; | ||||
struct radix_node *rn; | struct radix_node *rn; | ||||
struct rtentry *rt; | struct rtentry *rt; | ||||
int error; | int error; | ||||
KASSERT((fibnum < rt_numfibs), ("rib_lookup_rte: bad fibnum")); | KASSERT((fibnum < rt_numfibs), ("rib_lookup_rte: bad fibnum")); | ||||
rh = rt_tables_get_rnh(fibnum, dst->sa_family); | rh = rt_tables_get_rnh(fibnum, dst->sa_family); | ||||
if (rh == NULL) | if (rh == NULL) | ||||
▲ Show 20 Lines • Show All 1,005 Lines • ▼ Show 20 Lines | |||||
/* | /* | ||||
* Set up a routing table entry, normally | * Set up a routing table entry, normally | ||||
* for an interface. | * for an interface. | ||||
*/ | */ | ||||
#define _SOCKADDR_TMPSIZE 128 /* Not too big.. kernel stack size is limited */ | #define _SOCKADDR_TMPSIZE 128 /* Not too big.. kernel stack size is limited */ | ||||
static inline int | static inline int | ||||
rtinit1(struct ifaddr *ifa, int cmd, int flags, int fibnum) | rtinit1(struct ifaddr *ifa, int cmd, int flags, int fibnum) | ||||
{ | { | ||||
RIB_RLOCK_TRACKER; | |||||
struct sockaddr *dst; | struct sockaddr *dst; | ||||
struct sockaddr *netmask; | struct sockaddr *netmask; | ||||
struct rtentry *rt = NULL; | struct rtentry *rt = NULL; | ||||
struct rt_addrinfo info; | struct rt_addrinfo info; | ||||
int error = 0; | int error = 0; | ||||
int startfib, endfib; | int startfib, endfib; | ||||
char tempbuf[_SOCKADDR_TMPSIZE]; | char tempbuf[_SOCKADDR_TMPSIZE]; | ||||
int didwork = 0; | int didwork = 0; | ||||
▲ Show 20 Lines • Show All 307 Lines • Show Last 20 Lines |