Changeset View
Changeset View
Standalone View
Standalone View
net/if.c
Show First 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | |||||
#include <net/if_clone.h> | #include <net/if_clone.h> | ||||
#include <net/if_dl.h> | #include <net/if_dl.h> | ||||
#include <net/if_types.h> | #include <net/if_types.h> | ||||
#include <net/if_var.h> | #include <net/if_var.h> | ||||
#include <net/if_media.h> | #include <net/if_media.h> | ||||
#include <net/if_vlan_var.h> | #include <net/if_vlan_var.h> | ||||
#include <net/radix.h> | #include <net/radix.h> | ||||
#include <net/route.h> | #include <net/route.h> | ||||
#include <net/route/route_ctl.h> | |||||
#include <net/vnet.h> | #include <net/vnet.h> | ||||
#if defined(INET) || defined(INET6) | #if defined(INET) || defined(INET6) | ||||
#include <net/ethernet.h> | #include <net/ethernet.h> | ||||
#include <netinet/in.h> | #include <netinet/in.h> | ||||
#include <netinet/in_var.h> | #include <netinet/in_var.h> | ||||
#include <netinet/ip.h> | #include <netinet/ip.h> | ||||
#include <netinet/ip_carp.h> | #include <netinet/ip_carp.h> | ||||
▲ Show 20 Lines • Show All 1,749 Lines • ▼ Show 20 Lines | if (refcount_release(&ifa->ifa_refcnt)) | ||||
NET_EPOCH_CALL(ifa_destroy, &ifa->ifa_epoch_ctx); | NET_EPOCH_CALL(ifa_destroy, &ifa->ifa_epoch_ctx); | ||||
} | } | ||||
static int | static int | ||||
ifa_maintain_loopback_route(int cmd, const char *otype, struct ifaddr *ifa, | ifa_maintain_loopback_route(int cmd, const char *otype, struct ifaddr *ifa, | ||||
struct sockaddr *ia) | struct sockaddr *ia) | ||||
{ | { | ||||
struct rib_cmd_info rc; | |||||
struct epoch_tracker et; | struct epoch_tracker et; | ||||
int error; | int error; | ||||
struct rt_addrinfo info; | struct rt_addrinfo info; | ||||
struct sockaddr_dl null_sdl; | struct sockaddr_dl null_sdl; | ||||
struct ifnet *ifp; | struct ifnet *ifp; | ||||
struct ifaddr *rti_ifa = NULL; | struct ifaddr *rti_ifa = NULL; | ||||
ifp = ifa->ifa_ifp; | ifp = ifa->ifa_ifp; | ||||
Show All 11 Lines | if (info.rti_ifp != NULL) { | ||||
info.rti_ifa = rti_ifa; | info.rti_ifa = rti_ifa; | ||||
} | } | ||||
} | } | ||||
info.rti_flags = ifa->ifa_flags | RTF_HOST | RTF_STATIC | RTF_PINNED; | info.rti_flags = ifa->ifa_flags | RTF_HOST | RTF_STATIC | RTF_PINNED; | ||||
info.rti_info[RTAX_DST] = ia; | info.rti_info[RTAX_DST] = ia; | ||||
info.rti_info[RTAX_GATEWAY] = (struct sockaddr *)&null_sdl; | info.rti_info[RTAX_GATEWAY] = (struct sockaddr *)&null_sdl; | ||||
link_init_sdl(ifp, (struct sockaddr *)&null_sdl, ifp->if_type); | link_init_sdl(ifp, (struct sockaddr *)&null_sdl, ifp->if_type); | ||||
error = rtrequest1_fib(cmd, &info, NULL, ifp->if_fib); | error = rib_action(ifp->if_fib, cmd, &info, &rc); | ||||
NET_EPOCH_EXIT(et); | NET_EPOCH_EXIT(et); | ||||
if (rti_ifa != NULL) | if (rti_ifa != NULL) | ||||
ifa_free(rti_ifa); | ifa_free(rti_ifa); | ||||
if (error == 0 || | if (error == 0 || | ||||
(cmd == RTM_ADD && error == EEXIST) || | (cmd == RTM_ADD && error == EEXIST) || | ||||
(cmd == RTM_DELETE && (error == ENOENT || error == ESRCH))) | (cmd == RTM_DELETE && (error == ENOENT || error == ESRCH))) | ||||
▲ Show 20 Lines • Show All 2,692 Lines • Show Last 20 Lines |