Commit Graph

72 Commits

Author SHA1 Message Date
Luigi Rizzo
0b46c08590 Replace ROUNDUP/ADVANCE with SA_SIZE 2004-04-13 11:24:43 +00:00
Bruce M Simpson
25d295e1ed Fix some minor nits in netstat whereby large interface names would be
truncated. In environments where many tunnel or vlan interfaces are created,
interface names have high numbers which overflow the field width.

PRs:		bin/52349, bin/35838
Submitted by:	Mike Tancsa, Scot W. Hetzel
Approved by:	re (rwatson)
2003-11-28 17:34:23 +00:00
Brooks Davis
9bf40ede4a Replace the if_name and if_unit members of struct ifnet with new members
if_xname, if_dname, and if_dunit. if_xname is the name of the interface
and if_dname/unit are the driver name and instance.

This change paves the way for interface renaming and enhanced pseudo
device creation and configuration symantics.

Approved By:	re (in principle)
Reviewed By:	njl, imp
Tested On:	i386, amd64, sparc64
Obtained From:	NetBSD (if_xname)
2003-10-31 18:32:15 +00:00
Sam Leffler
8145952fa5 remove unneeded include of route.h
Supported by:	FreeBSD Foundation
2003-10-03 21:05:08 +00:00
Peter Wemm
ab54ea99de Kill #ifdef NS and some leftover #ifdef ISO code. Re-pack the nlist[]
array, it isn't likely to find any ARPAnet IMP drivers in FreeBSD.
2003-03-05 19:20:29 +00:00
David Malone
a01e3379df Warns cleanups for netstat:
1) Include arpa/inet.h for ntohs.
2) Constness fixes.
3) Fix shadowing except for "sin" which shouldn't be in scope.
4) Remove register keyword.
5) Add missing initialsers to user defined structs.
5) Make prototype of netname6 globally visable.
6) Use right macros for printing syncache stats (even though entrie isn't
   a word).
2002-09-05 17:06:51 +00:00
Kelly Yancey
9f8df4b468 Fix incorrect cast. 2002-07-16 05:57:21 +00:00
Kelly Yancey
ab67591303 Use calculated column widths for the routing table display when -W is
supplied rather than arbitrarily larger widths.  This (almost) guarantees
that no columns will be truncated (routing table additions between the
width calculation and display passes may create a row with column widths
larger than those calculated).

Sponsored by:	NTT Multimedia Communications Labs
2002-06-05 18:29:26 +00:00
Mike Silbersack
acc52a9a8e Use %lu instead of %ld when printing rt_use (aka rt_rmx.rmx_pksent)
Submitted by:	Andre Oppermann <oppermann@pipeline.ch>
MFC after:	5 days
2002-05-31 04:36:55 +00:00
Ruslan Ermilov
ad3253f2ff Print IFT_ETHER addresses with ether_ntoa(3) (with leading zeros). 2002-04-06 10:02:20 +00:00
Ruslan Ermilov
146db49f97 Fixed bugs from revision 1.27. Specifically:
- Restore the ability to look up network names in the networks(5)
  database by passing getnetbyaddr(3) shifted network numbers,
  but without duplicating the old bug that was fixed in 1.27 (we
  now only shift netnums with standard netmasks).  For example:

Before:

$ netstat -r
[...]
127.0.1/24         localhost          UGSc        0        0    lo0
127.0.2/24         localhost          UGSc        0        0    lo0

After:

$ netstat -r
[...]
subnet1/24         localhost          UGSc        0        0    lo0
subnet2/24         localhost          UGSc        0        0    lo0

- Only try to lookup with the forged netmask if the mask was not
  explicitly specified, like it was before 1.27.  For example:

Before:

$ netstat -r
net-44.ampr.org/25 localhost          UGSc        0        0    lo0
net-44.ampr.org/25 localhost          UGSc        0        0    lo0

After:

44.108.2/25        localhost          UGSc        0        0    lo0
44.108.2.128/25    localhost          UGSc        0        0    lo0

- Make sure to null-terminate the resulting string.

MFC after:	1 week
2001-10-11 14:30:42 +00:00
Ruslan Ermilov
70057abf2d Deprecate the -l option in favour of more natural -W.
The compatibility glue is still provided.

(This change is not yet reflected in the manpage, nor
in usage().  This will be fixed at a later time today,
with the general manpage cleanup commit.)
2001-09-07 12:00:50 +00:00
Ruslan Ermilov
1093cc3199 Make `rttrash' variable (#routes not in table but not freed) visible
through ``netstat -rs''.
2001-06-29 09:08:24 +00:00
Ruslan Ermilov
8f309b9151 Fixed bogon in revision 1.37. Don't bogusly print a radix node's
duped key marker (``=>'') for routes with non-positive rmx_expire
metric, such as ethernet interface routes.

MFC after:	1 week
2001-06-29 08:37:12 +00:00
Ruslan Ermilov
aafccd6d93 Honor -s -s (don't show zero stats) with -r, untangle SYNOPSIS further.
(usage() still is not synchronized with SYNOPSIS, intentionally.)
2001-06-23 09:18:57 +00:00
Assar Westerlund
f964d60dd3 remove warnings
remove superfluous declarations
make things more consistent
2001-06-15 23:55:45 +00:00
Assar Westerlund
5e0517186d remove K&R support 2001-06-15 23:35:13 +00:00
Assar Westerlund
e9370a2e59 revert removal of warning and K&R support
Requested by: bde
2001-06-15 23:07:59 +00:00
Ruslan Ermilov
eba04a8da9 Line up `netstat -rl' display. 2001-06-15 18:15:11 +00:00
Assar Westerlund
af7a0a2d2b remove most of the warnings 2001-06-15 01:53:05 +00:00
Assar Westerlund
65ea0024ba add the option -S for printing port numbers symbolically but addresses
numerically.  clean up the CFLAGS in Makefile.
2001-06-15 00:25:44 +00:00
Hajimu UMEMOTO
7165726d0d Add missing column for Mtu in header when -rl is specified. 2001-06-11 17:32:53 +00:00
Hajimu UMEMOTO
3384154590 Sync with recent KAME.
This work was based on kame-20010528-freebsd43-snap.tgz and some
critical problem after the snap was out were fixed.
There are many many changes since last KAME merge.

TODO:
  - The definitions of SADB_* in sys/net/pfkeyv2.h are still different
    from RFC2407/IANA assignment because of binary compatibility
    issue.  It should be fixed under 5-CURRENT.
  - ip6po_m member of struct ip6_pktopts is no longer used.  But, it
    is still there because of binary compatibility issue.  It should
    be removed under 5-CURRENT.

Reviewed by:	itojun
Obtained from:	KAME
MFC after:	3 weeks
2001-06-11 12:39:29 +00:00
Ruslan Ermilov
54f6369da3 Always print at least 2 bytes for IN_CLASSB_NET networks.
Always print at least 3 bytes for IN_CLASSC_NET networks.

The standard 193.0.0 class C network for example, will now
be displayed as "193.0.0" as opposed to the confusing 193.

PR:		bin/21546
MFC after:	1 week
2001-06-08 15:44:17 +00:00
Ruslan Ermilov
b940897514 Restore printing of routes cloned from a RTF_CLONING parent
(e.g., ARP table entries) with the default routing display.

PR:		bin/26970
Reviewed by:	wollman
MFC after:	3 days
2001-05-07 12:29:36 +00:00
Ruslan Ermilov
089cdfad78 net/route.c:
A route generated from an RTF_CLONING route had the RTF_WASCLONED flag
  set but did not have a reference to the parent route, as documented in
  the rtentry(9) manpage.  This prevented such routes from being deleted
  when their parent route is deleted.

  Now, for example, if you delete an IP address from a network interface,
  all ARP entries that were cloned from this interface route are flushed.

  This also has an impact on netstat(1) output.  Previously, dynamically
  created ARP cache entries (RTF_STATIC flag is unset) were displayed as
  part of the routing table display (-r).  Now, they are only printed if
  the -a option is given.

netinet/in.c, netinet/in_rmx.c:

  When address is removed from an interface, also delete all routes that
  point to this interface and address.  Previously, for example, if you
  changed the address on an interface, outgoing IP datagrams might still
  use the old address.  The only solution was to delete and re-add some
  routes.  (The problem is easily observed with the route(8) command.)

  Note, that if the socket was already bound to the local address before
  this address is removed, new datagrams generated from this socket will
  still be sent from the old address.

PR:		kern/20785, kern/21914
Reviewed by:	wollman (the idea)
2001-03-15 14:52:12 +00:00
Brian Somers
d121b55666 MAXHOSTNAMELEN includes space for a NUL.
Don't roll our own version of trimdomain(), use the one in libutil.

Not objected to by: freebsd-audit
2001-03-14 20:51:26 +00:00
Ruslan Ermilov
3f320c4e60 Fixed the printing of header for IPv4 routing table without -l option.
Broken in rev 1.44.
2000-09-18 11:14:40 +00:00
Jun-ichiro itojun Hagino
32cd1d9601 sync with latest kame netstat. basically, more statistics 2000-07-04 16:26:46 +00:00
Mark Murray
097c3a616c Use Garrett's new (clearer) names. 2000-04-23 14:18:18 +00:00
Yoshinobu Inoue
b1d49ce7b6 Don't suppress Flags and Refs info for IPv4 entries.
(They need to be suppressed by default for IPv6 entries to keep the column
size of each entries in 80.)
2000-03-14 17:18:43 +00:00
Rodney W. Grimes
f22f5e6ba8 Instead of reporting all 0.0.0.0 as ``default'' only report
a true default of 0.0.0.0/0 as default.

Reviewed by:	wollman
2000-01-07 19:56:57 +00:00
Yoshinobu Inoue
7d56d3747c Getaddrinfo(), getnameinfo(), and etc support in libc/net.
Several udp and raw apps IPv6 support.

Reviewed by: freebsd-arch, cvs-committers
Obtained from: KAME project
1999-12-28 02:37:14 +00:00
Yoshinobu Inoue
49302f437a Added missing declaration for argment specification at pr_rthdr(),
caused by my previous patch, sorry.
Also, changed its var name from 'af' to 'wid_af', to avoid confusion with
global var 'af'.
1999-12-21 11:25:30 +00:00
Yoshinobu Inoue
c64893b10c define WID_DST6 and WID_GW6 and use them only for IPv6, to keep IPv4 related
information in 80 columns.

TODO: IPv6 related information is not likely to be kept in 80 columns, anyway.
      Some more print modes could be added,
      but what is the priority between those modes?
	-print out all information even if they don't fit into 80 columns
	-strip off some information to fit them into 80 columns

Reviewed by: markm
1999-12-21 09:31:14 +00:00
Yoshinobu Inoue
cfa1ca9dfa udp IPv6 support, IPv6/IPv4 tunneling support in kernel,
packet divert at kernel for IPv6/IPv4 translater daemon

This includes queue related patch submitted by jburkhol@home.com.

Submitted by: queue related patch from jburkhol@home.com
Reviewed by: freebsd-arch, cvs-committers
Obtained from: KAME project
1999-12-07 17:39:16 +00:00
Matthew Dillon
f41f949d09 Cleanup missing includes, stale includes, and a few printf format
inconsistancies.
1999-10-23 17:45:11 +00:00
Julian Elischer
4cf49a4355 Whistle's Netgraph link-layer (sometimes more) networking infrastructure.
Been in production for 3 years now. Gives Instant Frame relay to if_sr
and if_ar drivers, and PPPOE support soon. See:
ftp://ftp.whistle.com/pub/archie/netgraph/index.html
for on-line manual pages.

Reviewed by: Doug Rabson (dfr@freebsd.org)
Obtained from:  Whistle CVS tree
1999-10-21 09:06:11 +00:00
Peter Wemm
c3aac50f28 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
John Birrell
acfd6b3968 Change casts from int to u_long and formats from %x to %lx.
Didn't fix the alignment of the output fields on alpha where addresses
require 16 characters to print.

Added a dummy field to the pt_u union to help the alpha compiler align
the u_sa field in a suiable way.
1998-08-18 13:41:38 +00:00
Bruce Evans
b45d09e830 Fixed type mismatches and style bugs in rev.1.30. 1998-07-06 20:52:08 +00:00
Warner Losh
9a1f6729af o Use snprintf over sprintf.
o Use strncpy correctly.
o Use enough buffer for line.

Inspired by or Obtained from: Similar changes in OpenBSD
1998-06-09 04:13:03 +00:00
Poul-Henning Kamp
384606eb2c netstat truncates info in sockaddr* between kgetsa and p_sockaddr
by dereferencing pointer to smaller structure

PR:		5256
Reviewed by:	phk
Submitted by:	Gregory D. Moncreaff <moncrg@bt340707.res.ray.com>
1998-04-22 06:54:31 +00:00
Poul-Henning Kamp
c5d1ef4169 The current version of netstat does not print the interface
name for AF_LINK routing entries. This makes debugging
network problems more difficult.
PR:		4182
Reviewed by:	phk
Submitted by:	Craig Leres <leres@ee.lbl.gov>
1998-04-19 18:18:25 +00:00
Philippe Charnier
5d422d6aa7 Remove prog, unused variables.
Cosmetic in usage string.
1997-07-29 06:51:41 +00:00
Poul-Henning Kamp
ef1f3a4fd4 Remove some quite bogus code that tried to find subnet names but instead
spammed named with bogus queries.
1997-05-25 08:36:20 +00:00
John Hay
64a0cc86b5 Add the new ipx statistics variables.
Remove the dns lookup code in the ipx functions. That is bogus and slows
things like netstat -r(f ipx) down, without gaining anything.

Remove the ipx error protocol statistics.
1997-05-10 10:03:43 +00:00
Peter Wemm
c115df18cd Revert $FreeBSD$ to $Id$ 1997-02-22 19:58:13 +00:00
Jordan K. Hubbard
1130b656e5 Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.
1997-01-14 07:20:47 +00:00
Garrett Wollman
8766942543 Update to match changes in <net/if.h> and <netinet/ip_mroute.h>. 1997-01-03 20:16:31 +00:00