Page MenuHomeFreeBSD

D39148.diff
No OneTemporary

D39148.diff

diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk
--- a/share/mk/src.opts.mk
+++ b/share/mk/src.opts.mk
@@ -145,6 +145,7 @@
MLX5TOOL \
NETCAT \
NETGRAPH \
+ NETLINK \
NLS_CATALOGS \
NS_CACHING \
NTP \
@@ -233,6 +234,7 @@
KERBEROS \
KVM \
NETGRAPH \
+ NETLINK \
PAM \
TESTS \
WIRELESS
diff --git a/tools/build/options/WITHOUT_NETLINK_SUPPORT b/tools/build/options/WITHOUT_NETLINK_SUPPORT
new file mode 100644
--- /dev/null
+++ b/tools/build/options/WITHOUT_NETLINK_SUPPORT
@@ -0,0 +1,5 @@
+.\" $FreeBSD$
+Make libraries and programs use rtsock and
+.Xr sysctl 3
+interfaces instead of
+.Xr snl 3 .
diff --git a/usr.bin/netstat/Makefile b/usr.bin/netstat/Makefile
--- a/usr.bin/netstat/Makefile
+++ b/usr.bin/netstat/Makefile
@@ -6,7 +6,6 @@
PROG= netstat
SRCS= if.c inet.c main.c mbuf.c mroute.c netisr.c nl_symbols.c route.c \
unix.c mroute6.c ipsec.c bpf.c pfkey.c sctp.c common.c nhops.c nhgrp.c \
- route_netlink.c \
nl_defs.h
nl_symbols.c: nlist_symbols
@@ -64,4 +63,10 @@
CFLAGS+=-DNETGRAPH
.endif
+.if ${MK_NETLINK_SUPPORT} != "no"
+SRCS+= route_netlink.c
+.else
+CFLAGS+=-DWITHOUT_NETLINK
+.endif
+
.include <bsd.prog.mk>
diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c
--- a/usr.bin/netstat/route.c
+++ b/usr.bin/netstat/route.c
@@ -96,16 +96,20 @@
{ 0 , 0, NULL }
};
+#ifdef WITHOUT_NETLINK
static struct ifmap_entry *ifmap;
static size_t ifmap_size;
+#endif
static struct timespec uptime;
static const char *netname4(in_addr_t, in_addr_t);
#ifdef INET6
static const char *netname6(struct sockaddr_in6 *, struct sockaddr_in6 *);
#endif
+#ifdef WITHOUT_NETLINK
static void p_rtable_sysctl(int, int);
static void p_rtentry_sysctl(const char *name, struct rt_msghdr *);
+#endif
static void domask(char *, size_t, u_long);
const uint32_t rt_default_weight = RT_DEFAULT_WEIGHT;
@@ -143,8 +147,11 @@
if (fibnum)
xo_emit(" ({L:fib}: {:fib/%d})", fibnum);
xo_emit("\n");
- if (!p_rtable_netlink(fibnum, af))
- p_rtable_sysctl(fibnum, af);
+#ifdef WITHOUT_NETLINK
+ p_rtable_sysctl(fibnum, af);
+#else
+ p_rtable_netlink(fibnum, af);
+#endif
xo_close_container("route-information");
}
@@ -240,6 +247,7 @@
wid.expire = 6;
}
+#ifdef WITHOUT_NETLINK
static void
p_rtable_sysctl(int fibnum, int af)
{
@@ -365,6 +373,7 @@
xo_emit("\n");
xo_close_instance(name);
}
+#endif
int
p_sockaddr(const char *name, struct sockaddr *sa, struct sockaddr *mask,

File Metadata

Mime Type
text/plain
Expires
Tue, Apr 29, 4:02 PM (12 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
17842581
Default Alt Text
D39148.diff (2 KB)

Event Timeline