35#include <sys/kernel.h>
36#include <sys/sysctl.h>
37#include <sys/socket.h>
41#include <net/if_var.h>
43#include <net/route/route_ctl.h>
44#include <net/route/route_var.h>
45#include <net/route/nhop.h>
55rib4_preadd(u_int fibnum,
const struct sockaddr *addr,
const struct sockaddr *mask,
56 struct nhop_object *nh)
64 rt_flags = nhop_get_rtflags(nh);
66 if (rt_flags & RTF_HOST) {
80 rt_flags |= RTF_BROADCAST;
81 nhop_set_rtflags(nh, rt_flags);
82 nh->nh_flags |= NHF_BROADCAST;
91 if (nh->nh_mtu == 0) {
92 nh->nh_mtu = nh->nh_ifp->if_mtu;
93 }
else if (nh->nh_mtu > nh->nh_ifp->if_mtu)
94 nh->nh_mtu = nh->nh_ifp->if_mtu;
98 if ((rt_flags & RTF_HOST) == 0 && mask4 != NULL &&
100 nh->nh_flags |= NHF_DEFAULT;
103 if (nhop_get_type(nh) == 0) {
104 if (nh->nh_flags & NHF_GATEWAY)
105 nh_type = NH_TYPE_IPV4_ETHER_NHOP;
107 nh_type = NH_TYPE_IPV4_ETHER_RSLV;
109 nhop_set_type(nh, nh_type);
123 rh = rt_table_init(32, AF_INET, fibnum);
134in_detachhead(
struct rib_head *rh)
137 rt_table_destroy(rh);
161 if (nh->nh_ifa != ap->
ifa)
164 if ((nhop_get_rtflags(nh) & RTF_STATIC) != 0 && ap->
del == 0)
175 KASSERT(
ifa->ifa_addr->sa_family == AF_INET,
176 (
"%s: wrong family", __func__));
182 ifa->ifa_flags &= ~IFA_ROUTE;
int in_broadcast(struct in_addr in, struct ifnet *ifp)
static int in_ifadownkill(const struct rtentry *rt, const struct nhop_object *nh, void *xap)
struct rib_head * in_inithead(uint32_t fibnum)
static int rib4_preadd(u_int fibnum, const struct sockaddr *addr, const struct sockaddr *mask, struct nhop_object *nh)
void in_ifadown(struct ifaddr *ifa, int delete)