Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/netstat Pay attention to the netmask of routes to 0....
details: https://anonhg.NetBSD.org/src/rev/b4e9a0945c65
branches: trunk
changeset: 480228:b4e9a0945c65
user: sommerfeld <sommerfeld%NetBSD.org@localhost>
date: Fri Jan 07 04:49:11 2000 +0000
description:
Pay attention to the netmask of routes to 0.0.0.0;
e.g., a route to 0.0.0.0/1 is *not* a default route.
Inspired by a patch by Rodney Grimes sent to the zebra list.
diffstat:
usr.bin/netstat/route.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diffs (29 lines):
diff -r 2073644ea66d -r b4e9a0945c65 usr.bin/netstat/route.c
--- a/usr.bin/netstat/route.c Fri Jan 07 04:47:23 2000 +0000
+++ b/usr.bin/netstat/route.c Fri Jan 07 04:49:11 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: route.c,v 1.44 1999/12/13 15:22:55 itojun Exp $ */
+/* $NetBSD: route.c,v 1.45 2000/01/07 04:49:11 sommerfeld Exp $ */
/*
* Copyright (c) 1983, 1988, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "from: @(#)route.c 8.3 (Berkeley) 3/9/94";
#else
-__RCSID("$NetBSD: route.c,v 1.44 1999/12/13 15:22:55 itojun Exp $");
+__RCSID("$NetBSD: route.c,v 1.45 2000/01/07 04:49:11 sommerfeld Exp $");
#endif
#endif /* not lint */
@@ -423,7 +423,9 @@
{
struct sockaddr_in *sin = (struct sockaddr_in *)sa;
- if (sin->sin_addr.s_addr == INADDR_ANY)
+ if ((sin->sin_addr.s_addr == INADDR_ANY) &&
+ (mask != NULL) &&
+ (((struct sockaddr_in *)mask)->sin_addr.s_addr == 0))
cp = "default";
else if (flags & RTF_HOST)
cp = routename(sin->sin_addr.s_addr);
Home |
Main Index |
Thread Index |
Old Index