Changeset View
Changeset View
Standalone View
Standalone View
sys/net/route.c
Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | |||||
#include <sys/systm.h> | #include <sys/systm.h> | ||||
#include <sys/malloc.h> | #include <sys/malloc.h> | ||||
#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/devctl.h> | |||||
#include <sys/domain.h> | #include <sys/domain.h> | ||||
#include <sys/eventhandler.h> | #include <sys/eventhandler.h> | ||||
#include <sys/kernel.h> | #include <sys/kernel.h> | ||||
#include <sys/lock.h> | #include <sys/lock.h> | ||||
#include <sys/rmlock.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/route_ctl.h> | #include <net/route/route_ctl.h> | ||||
#include <net/route/route_var.h> | #include <net/route/route_var.h> | ||||
#include <net/route/nhop.h> | #include <net/route/nhop.h> | ||||
#include <net/vnet.h> | #include <net/vnet.h> | ||||
#include <netinet/in.h> | #include <netinet/in.h> | ||||
#include <netinet/ip_mroute.h> | #include <netinet/ip_mroute.h> | ||||
#include <netinet6/in6_var.h> | |||||
VNET_PCPUSTAT_DEFINE(struct rtstat, rtstat); | VNET_PCPUSTAT_DEFINE(struct rtstat, rtstat); | ||||
VNET_PCPUSTAT_SYSINIT(rtstat); | VNET_PCPUSTAT_SYSINIT(rtstat); | ||||
#ifdef VIMAGE | #ifdef VIMAGE | ||||
VNET_PCPUSTAT_SYSUNINIT(rtstat); | VNET_PCPUSTAT_SYSUNINIT(rtstat); | ||||
#endif | #endif | ||||
▲ Show 20 Lines • Show All 602 Lines • ▼ Show 20 Lines | |||||
/* | /* | ||||
* Announce interface address arrival/withdraw | * Announce interface address arrival/withdraw | ||||
* Returns 0 on success. | * Returns 0 on success. | ||||
*/ | */ | ||||
int | int | ||||
rt_addrmsg(int cmd, struct ifaddr *ifa, int fibnum) | rt_addrmsg(int cmd, struct ifaddr *ifa, int fibnum) | ||||
{ | { | ||||
#if defined(INET) || defined(INET6) | |||||
struct sockaddr *sa = ifa->ifa_addr; | |||||
struct ifnet *ifp = ifa->ifa_ifp; | |||||
#endif | |||||
KASSERT(cmd == RTM_ADD || cmd == RTM_DELETE, | KASSERT(cmd == RTM_ADD || cmd == RTM_DELETE, | ||||
("unexpected cmd %d", cmd)); | ("unexpected cmd %d", cmd)); | ||||
KASSERT((fibnum >= 0 && fibnum < rt_numfibs), | KASSERT((fibnum >= 0 && fibnum < rt_numfibs), | ||||
("%s: fib out of range 0 <=%d<%d", __func__, fibnum, rt_numfibs)); | ("%s: fib out of range 0 <=%d<%d", __func__, fibnum, rt_numfibs)); | ||||
EVENTHANDLER_DIRECT_INVOKE(rt_addrmsg, ifa, cmd); | EVENTHANDLER_DIRECT_INVOKE(rt_addrmsg, ifa, cmd); | ||||
#ifdef INET | |||||
if (sa->sa_family == AF_INET) { | |||||
char addrstr[INET_ADDRSTRLEN]; | |||||
char strbuf[INET_ADDRSTRLEN + 12]; | |||||
imp: A blank line is needed before inet_ntoa_r.
Also, that can be on one line
Also, there's at least… | |||||
inet_ntoa_r(((struct sockaddr_in *)sa)->sin_addr, addrstr); | |||||
snprintf(strbuf, sizeof(strbuf), "address=%s", addrstr); | |||||
devctl_notify("IFNET", ifp->if_xname, | |||||
(cmd == RTM_ADD) ? "ADDR_ADD" : "ADDR_DEL", strbuf); | |||||
} | |||||
#endif | |||||
#ifdef INET6 | |||||
if (sa->sa_family == AF_INET6) { | |||||
char addrstr[INET6_ADDRSTRLEN]; | |||||
char strbuf[INET6_ADDRSTRLEN + 12]; | |||||
Not Done Inline Actionsa blank line is needed between the strbuf and ip6_sprintf lines. imp: a blank line is needed between the strbuf and ip6_sprintf lines. | |||||
ip6_sprintf(addrstr, IFA_IN6(ifa)); | |||||
snprintf(strbuf, sizeof(strbuf), "address=%s", addrstr); | |||||
devctl_notify("IFNET", ifp->if_xname, | |||||
(cmd == RTM_ADD) ? "ADDR_ADD" : "ADDR_DEL", strbuf); | |||||
} | |||||
#endif | |||||
if (V_rt_add_addr_allfibs) | if (V_rt_add_addr_allfibs) | ||||
fibnum = RT_ALL_FIBS; | fibnum = RT_ALL_FIBS; | ||||
return (rtsock_addrmsg(cmd, ifa, fibnum)); | return (rtsock_addrmsg(cmd, ifa, fibnum)); | ||||
} | } | ||||
/* | /* | ||||
* Announce kernel-originated route addition/removal to rtsock based on @rt data. | * Announce kernel-originated route addition/removal to rtsock based on @rt data. | ||||
▲ Show 20 Lines • Show All 45 Lines • Show Last 20 Lines |
A blank line is needed before inet_ntoa_r.
Also, that can be on one line
Also, there's at least one extra set of parens here.