summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorqingli <qingli@FreeBSD.org>2008-12-15 06:10:57 +0000
committerqingli <qingli@FreeBSD.org>2008-12-15 06:10:57 +0000
commitec826ad5c7f97de814529d3b3bae7950f91d9a5d (patch)
tree281ff6a89cacadf7e72f506b037ca41229a23bf6 /usr.bin
parent664c3aeb0118ccccb068f485e30353a47923b4d0 (diff)
downloadFreeBSD-src-ec826ad5c7f97de814529d3b3bae7950f91d9a5d.zip
FreeBSD-src-ec826ad5c7f97de814529d3b3bae7950f91d9a5d.tar.gz
This main goals of this project are:
1. separating L2 tables (ARP, NDP) from the L3 routing tables 2. removing as much locking dependencies among these layers as possible to allow for some parallelism in the search operations 3. simplify the logic in the routing code, The most notable end result is the obsolescent of the route cloning (RTF_CLONING) concept, which translated into code reduction in both IPv4 ARP and IPv6 NDP related modules, and size reduction in struct rtentry{}. The change in design obsoletes the semantics of RTF_CLONING, RTF_WASCLONE and RTF_LLINFO routing flags. The userland applications such as "arp" and "ndp" have been modified to reflect those changes. The output from "netstat -r" shows only the routing entries. Quite a few developers have contributed to this project in the past: Glebius Smirnoff, Luigi Rizzo, Alessandro Cerri, and Andre Oppermann. And most recently: - Kip Macy revised the locking code completely, thus completing the last piece of the puzzle, Kip has also been conducting active functional testing - Sam Leffler has helped me improving/refactoring the code, and provided valuable reviews - Julian Elischer setup the perforce tree for me and has helped me maintaining that branch before the svn conversion
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/netstat/route.c38
1 files changed, 11 insertions, 27 deletions
diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c
index 01311e5..596fcd5 100644
--- a/usr.bin/netstat/route.c
+++ b/usr.bin/netstat/route.c
@@ -89,17 +89,23 @@ struct bits {
{ RTF_DYNAMIC, 'D' },
{ RTF_MODIFIED, 'M' },
{ RTF_DONE, 'd' }, /* Completed -- for routing messages only */
- { RTF_CLONING, 'C' },
{ RTF_XRESOLVE, 'X' },
- { RTF_LLINFO, 'L' },
{ RTF_STATIC, 'S' },
{ RTF_PROTO1, '1' },
{ RTF_PROTO2, '2' },
- { RTF_WASCLONED,'W' },
{ RTF_PRCLONING,'c' },
{ RTF_PROTO3, '3' },
{ RTF_BLACKHOLE,'B' },
{ RTF_BROADCAST,'b' },
+#ifdef RTF_LLINFO
+ { RTF_LLINFO, 'L' },
+#endif
+#ifdef RTF_WASCLONED
+ { RTF_WASCLONED,'W' },
+#endif
+#ifdef RTF_CLONING
+ { RTF_CLONING, 'C' },
+#endif
{ 0 , 0 }
};
@@ -316,23 +322,12 @@ static void
size_cols_rtentry(struct rtentry *rt)
{
static struct ifnet ifnet, *lastif;
- struct rtentry parent;
static char buffer[100];
const char *bp;
struct sockaddr *sa;
sa_u addr, mask;
int len;
- /*
- * Don't print protocol-cloned routes unless -a.
- */
- if (rt->rt_flags & RTF_WASCLONED && !aflag) {
- if (kget(rt->rt_parent, parent) != 0)
- return;
- if (parent.rt_flags & RTF_PRCLONING)
- return;
- }
-
bzero(&addr, sizeof(addr));
if ((sa = kgetsa(rt_key(rt))))
bcopy(sa, &addr, sa->sa_len);
@@ -352,7 +347,7 @@ size_cols_rtentry(struct rtentry *rt)
wid_flags = MAX(len, wid_flags);
if (addr.u_sa.sa_family == AF_INET || Wflag) {
- len = snprintf(buffer, sizeof(buffer), "%ld", rt->rt_refcnt);
+ len = snprintf(buffer, sizeof(buffer), "%d", rt->rt_refcnt);
wid_refs = MAX(len, wid_refs);
len = snprintf(buffer, sizeof(buffer), "%lu", rt->rt_use);
wid_use = MAX(len, wid_use);
@@ -761,22 +756,11 @@ static void
p_rtentry(struct rtentry *rt)
{
static struct ifnet ifnet, *lastif;
- struct rtentry parent;
static char buffer[128];
static char prettyname[128];
struct sockaddr *sa;
sa_u addr, mask;
- /*
- * Don't print protocol-cloned routes unless -a.
- */
- if (rt->rt_flags & RTF_WASCLONED && !aflag) {
- if (kget(rt->rt_parent, parent) != 0)
- return;
- if (parent.rt_flags & RTF_PRCLONING)
- return;
- }
-
bzero(&addr, sizeof(addr));
if ((sa = kgetsa(rt_key(rt))))
bcopy(sa, &addr, sa->sa_len);
@@ -788,7 +772,7 @@ p_rtentry(struct rtentry *rt)
snprintf(buffer, sizeof(buffer), "%%-%d.%ds ", wid_flags, wid_flags);
p_flags(rt->rt_flags, buffer);
if (addr.u_sa.sa_family == AF_INET || Wflag) {
- printf("%*ld %*lu ", wid_refs, rt->rt_refcnt,
+ printf("%*d %*lu ", wid_refs, rt->rt_refcnt,
wid_use, rt->rt_use);
if (Wflag) {
if (rt->rt_rmx.rmx_mtu != 0)
OpenPOWER on IntegriCloud