Commit Graph

165 Commits

Author SHA1 Message Date
Remko Lodder
eac295c9a0 Remove bogus char cast.
PR:		118014
Submitted by:	Gardner Bell <gbell72 at rogers dot com>
Approved by:	re (rwatson), imp (mentor, implicit)
MFC after:	immediate
2009-08-14 18:18:51 +00:00
Dag-Erling Smørgrav
aebbf030e5 Lower WARNS due to alignment issues on sparc64. 2009-06-11 10:30:30 +00:00
Dag-Erling Smørgrav
be5d11dcb0 As of sam's r175206, arp builds cleanly at WARNS level 6, but the Makefile
was never updated.  Also, clean up the macro that caused the warning in the
first place (no functional changes, just wrapped and reindented).
2009-06-11 07:50:36 +00:00
Daniel Gerzo
113eaf9bda - xref ndp(8)
PR:		docs/134053
Submitted by:	Bob Van Zant <bob@veznat.com>
MFC after:	1 week
2009-04-28 20:23:58 +00:00
Qing Li
8eca593c5a This checkin addresses a couple of issues:
1. The "route" command allows route insertion through the interface-direct
   option "-iface". During if_attach(), an sockaddr_dl{} entry is created
   for the interface and is part of the interface address list. This
   sockaddr_dl{} entry describes the interface in detail. The "route"
   command selects this entry as the "gateway" object when the "-iface"
   option is present. The "arp" and "ndp" commands also interact with the
   kernel through the routing socket when adding and removing static L2
   entries. The static L2 information is also provided through the
   "gateway" object with an AF_LINK family type, similar to what is
   provided by the "route" command. In order to differentiate between
   these two types of operations, a RTF_LLDATA flag is introduced. This
   flag is set by the "arp" and "ndp" commands when issuing the add and
   delete commands. This flag is also set in each L2 entry returned by the
   kernel. The "arp" and "ndp" command follows a convention where a RTM_GET
   is issued first followed by a RTM_ADD/DELETE. This RTM_GET request fills
   in the fields for a "rtm" object, which is reinjected into the kernel by
   a subsequent RTM_ADD/DELETE command. The entry returend from RTM_GET
   is a prefix route, so the RTF_LLDATA flag must be specified when issuing
   the RTM_ADD/DELETE messages.

2. Enforce the convention that NET_RT_FLAGS with a 0 w_arg is the
   specification for retrieving L2 information. Also optimized the
   code logic.

Reviewed by:   julian
2008-12-26 19:45:24 +00:00
Tom Rhodes
2293dac2ac Print a warning when blackhole and reject are used together.
Update arp.8 manual page syntax.

PR:		125896
Submitted by:	Marc Olzheim <marcolz@stack.nl>
Approved by:	sam
2008-12-25 06:44:19 +00:00
Qing Li
6e6b3f7cbc 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
2008-12-15 06:10:57 +00:00
Ruslan Ermilov
3d172894a5 Spell "blackhole" correctly and fix one grammar nit. 2008-03-24 22:57:55 +00:00
Sam Leffler
e653f1f0f4 add reject+blackhole keywords to install entries with RTF_BLACKHOLE
and RTF_REJECT, respectively

PR:		bin/79228
Submitted by:	Dan Lukes <dan@obluda.cz>
MFC after:	2 weeks
2008-03-18 21:45:27 +00:00
Sam Leffler
0c80179c55 quiet compiler complaint about comparing &v against NULL 2008-01-10 04:26:44 +00:00
John Birrell
13959da95c Reduce the WARNS levels in a couple of places so that we can enable
-Werror at higher WARNS levels like we did before gcc4 was imported.
2007-11-18 00:29:36 +00:00
Gleb Smirnoff
a090f21663 net.link.ether.inet.prune_intvl no longer exists. 2007-03-28 11:06:50 +00:00
Kevin Lo
d069140339 Use sizeof() for calculating the buffer size instead of hard-coded values. 2007-03-06 09:32:41 +00:00
Gleb Smirnoff
06274cee44 - Before doing ioctl(SIOCGIFNETMASK) put the proper IP address into the ifreq,
to obtain correct netmask in case of interface with multiple aliases.
- While here, remove a comment with a bad idea.

PR:		bin/42120
Submitted by:	Dmitry Frolov <frolov riss-telecom.ru>
2006-10-13 12:38:43 +00:00
Ruslan Ermilov
bc84aa4ba3 Markup fixes. 2006-09-29 17:57:04 +00:00
Ruslan Ermilov
f6385e481e Sync utility's usage() with manpage's SYNOPSIS. 2006-09-29 16:07:44 +00:00
Yaroslav Tykhiy
81cd89bd43 Enumerate all cases where -i is applicable.
MFC after:	3 days
2006-08-17 07:14:01 +00:00
Gleb Smirnoff
a47c388cce Refuse to install invalid ARP entries.
Submitted by:	Vitaliy Ovsyannikov <V.Ovsyannikov kr.ru>
2006-02-09 12:49:39 +00:00
Brooks Davis
582fa422ec Update usage to reflect the fact that the -d -a now accepts -i <interface>.
Reminded by:	ru
Pointy hat:	brooks
2006-01-10 16:15:58 +00:00
Brooks Davis
0836985219 Allow the -i <interface> option with -d -a to allow all arp entries for
a given interface to be removed.
2006-01-10 05:17:16 +00:00
Gleb Smirnoff
3939390679 Add a knob to suppress logging of attempts to modify
permanent ARP entries.

Submitted by:	Andrew Alcheyev <buddy telenet.ru>
2005-12-18 19:11:56 +00:00
Ruslan Ermilov
34c96b563e Improve the documentation of "proxyall" knob, somewhat: we do not
proxy for hosts that are reachable through the same interface the
request came in from.  This feature is mainly for hosts reachable
through some P2P link, e.g. the gif(4) tunnel.
2005-11-24 13:44:42 +00:00
Gleb Smirnoff
44ec3c8c44 Some fixes for last commit.
Submitted by:	ru
2005-11-11 09:31:23 +00:00
Gleb Smirnoff
1a5d3a92f2 - Document last change to ARP behavior.
- Document several undocumented sysctl variables.
- Fix spelling of few diagnostics.
2005-11-10 11:35:53 +00:00
Andrew Thompson
9af9b983e1 List IFT_BRIDGE as a valid type so that arp entries can be properly deleted.
Submitted by:	Michal Mertl <mime^traveller.cz>
2005-11-03 00:56:43 +00:00
Ruslan Ermilov
f3f8b226ef Commit some cosmetic fixes I developed some time ago, mostly style but
one functional change (fixed exit status from the "get" operation).
2005-06-09 15:27:46 +00:00
Gleb Smirnoff
cf77958920 Fix exit status. In rev. 1.48 return logic of rtmsg() was confused. This
made arp(8) command exit status reversed for -s and -S.

Reported by:	sem
MFC after:	2 weeks
2005-06-09 15:00:31 +00:00
Maxim Konovalov
19beed5e2e o Reorganize the previous delta to make it more style(9) compliant.
Submitted by:	ru

o Reduce an amount of memory we ask in advance.
2005-01-24 17:01:48 +00:00
Maxim Konovalov
66658902ed o Try hard to guess a buffer size for a fast growing routing table.
An approach taken from killall/killall.c.

PR:		bin/76075
Submitted by:	Dmitrij Tejblum
MFC after:	3 weeks
2005-01-24 13:27:24 +00:00
Ruslan Ermilov
596e374dac For VLAN interfaces, print MAC addresses properly.
(Broken in rev. 1.52.)

PR:		75471
Submitted by:	Jon Simola
MFC after:	3 days
2004-12-24 22:16:38 +00:00
Warner Losh
23717fc46a Per letter dated July 22, 1999, delete clause 3 from code directly
from Berkeley.
2004-08-07 04:19:37 +00:00
Ruslan Ermilov
07bfccd71e Mechanically kill hard sentence breaks. 2004-07-02 23:13:00 +00:00
Bruce M Simpson
6311b38fee mdoc(7) police
Submitted by:	ru
2004-06-16 07:03:54 +00:00
Bruce M Simpson
cc090be082 Document the behaviour of the net.link.ether.inet.proxyall sysctl MIB
variable.

PR:		docs/21826
Reviewed by:	ru
Requested by:	Bernd Luevelsmeyer
2004-06-16 06:16:29 +00:00
Doug Rabson
21816de34f Be smarter about printing non-ethernet link-level addresses. 2004-06-13 10:57:10 +00:00
Stefan Farfeleder
1a5ff9285a Avoid assignments to cast expressions.
Reviewed by:	md5
Approved by:	das (mentor)
2004-06-08 13:08:19 +00:00
Luigi Rizzo
68839124b6 Massive cleanup of the code removing global variables to
pass function arguments and results.

Hopefully no functional changes except fixing a couple of
bugs which could cause endless loops if an ioctl() on an
interface would fail.
2004-04-13 14:16:37 +00:00
Luigi Rizzo
a7a0612913 Back out previous commit, it was unintentional.
Keep WARNS at 3 though the code does compile with WARNS=5 at least on i386

Noticed by: ru
2004-04-13 11:45:28 +00:00
Luigi Rizzo
0b46c08590 Replace ROUNDUP/ADVANCE with SA_SIZE 2004-04-13 11:24:43 +00:00
Luigi Rizzo
bdf932ae27 Make functions and variables static.
Remove global variables in favour of local ones.
Fix indentation of a couple of switch statements.

Overall, this program badly need cleaning up, as it relies
on information passed around through global variables.
2004-04-13 08:34:52 +00:00
Maxime Henrion
e2416749bf - Change several errx() calls that should have been err() calls.
- Handle empty ARP tables properly.
- Remove register keyword.
- arp(8) is WARNS?=4 clean, so mark it as such to avoid regressions.
2004-04-09 14:27:28 +00:00
Bruce M Simpson
43039b7df5 mdoc(7) cleanups (use .Va, not .Dv, for sysctls.)
Reviewed by:	ru
2003-10-03 07:48:56 +00:00
Bruce M Simpson
0cc7c160e2 mdoc(7) cleanup: Break up sentences so that they start on new lines. 2003-10-03 01:20:33 +00:00
Bruce M Simpson
1e709b6f23 Point out the existence of net.link.ether.inet.log_arp_movements.
Add sysctl(8) to the list of cross-referenced manual pages.
2003-10-03 01:18:21 +00:00
Bruce M Simpson
4cd8d8d59c Update arp(4) to document the 'arp: foo is on if0 but got reply from
bar on if1' message.

PR:		bin/48489
Requested by:	ru
2003-10-03 01:15:40 +00:00
Yaroslav Tykhiy
b9de94e9eb Implement a new option: -i, which will allow to limit
the scope of operation to the ARP entries on a particular
interface.  It should be useful on machines with numerous
network interfaces, e.g., on inter-VLAN routers.

PR:		bin/54151
Submitted by:	Dmitry Morozovsky <marck at rinet.ru>
Discussed on:	-net
MFC after:	2 weeks
2003-07-18 13:48:06 +00:00
David E. O'Brien
b728350ee6 Use __FBSDID over rcsid[]. Protect copyright[] where needed. 2003-05-03 21:06:42 +00:00
David E. O'Brien
052238b16c style.Makefile(5) 2003-04-04 17:49:21 +00:00
Ruslan Ermilov
4bfc36240e Further fix the syntax by ignoring empty and whitespace-only lines.
Prompted by:	Eugene Grosbein <eugen@kuzbass.ru>
2003-03-05 15:53:18 +00:00
Ruslan Ermilov
3adcd04299 Don't hide global `s'. 2003-01-17 08:10:43 +00:00
Ruslan Ermilov
44acbc1adc POLA dictates that in the file designated with the -f option
argument, leading whitespace and empty lines be ignored, and
the `#' character marks the rest of the line as a comment.

PR:		bin/45958
MFC after:	3 days
2002-12-27 10:09:04 +00:00
Ruslan Ermilov
2dab76f7d1 s/pseudo-device/device/ 2002-12-26 19:56:29 +00:00
Juli Mallett
42f3352b5c Change 'int pid' to 'pid_t pid'
Submitted by:	Bruce "Allah" Dang <bruce@research.teamxor.org>
2002-07-25 01:48:19 +00:00
Philippe Charnier
490d5836b5 The .Nm utility 2002-07-14 14:47:15 +00:00
Bill Paul
2ab778e1d3 Unbreak this file after the last drive-by committing. We have to
#include route.h before iso88025.h, and we have to dereference
the trld_route array correctly. (NOTE: I'm not altogether sure
that this is really the correct way to traverse this array. This
just eliminates the build warning/error. It may not work right at
runtime, and I have no way to test it since I lack the necessary
hardware.)

Broken by: kbyanc, who gets to wear the pointy hat
2002-05-09 00:37:57 +00:00
Kelly Yancey
97fe20b4d0 Update ARP to access token-ring source routing information at it's new
location.

Not tested by:	me (sorry!)
Sponsored by:	NTT Multimedia Communications Labs
2002-05-08 00:55:29 +00:00
Murray Stokely
123b2d4a74 GCC 3.1 cleanup - add a break after default: at the end of a switch
statement.
2002-04-07 12:05:05 +00:00
Ruslan Ermilov
a03b1b7ced Don't reinvent the wheel now that ether_ntoa(3) has been fixed
to print leading zeros in libc_net/ether_addr.c,v 1.13.

MFC after:	3 days
2002-04-06 09:01:44 +00:00
Jeroen Ruigrok van der Werven
8a4e484995 Correct old wording of the arp functionality.
We are long past the stage where we only had ARP working for 10 Mb/s.

PR:		35604
Submitted by:	Gary W. Swearingen <swear@blarg.net>
Additional comments by:	Mike DeGraw-Bertsch <mbertsch@radioactivedata.org>
2002-04-05 21:59:13 +00:00
Mike Barcroft
467a0b0647 Include <string.h> for some prototypes, rather than depending on
pollution from <strings.h>.
2002-04-01 21:13:17 +00:00
Mike Heffner
9cc7cb5818 Fix bugs from previous commit: initialize the correct field and use
the correct local variable.

Caught by: Joachim Isaksson <Joachim.Isaksson@algitech.com>
Pointy hat to: mikeh
2002-03-20 01:31:15 +00:00
Ruslan Ermilov
3c1fa5310f Fix a typo. 2002-03-15 16:53:32 +00:00
Giorgos Keramidas
7dfa118267 - Misc grammar fixes.
- Add `Ar filename' to the description of the -f option.
2002-03-08 12:50:41 +00:00
Mike Heffner
28644e448a Reorder WARNS line for style.
Pointed out by:	bde
2001-12-10 21:13:36 +00:00
Mike Heffner
9d34414bc2 WARNS=2 cleanup.
Submitted by:	Maxime Henrion <mux@qualys.com>
MFC after:	2 weeks
2001-12-10 06:42:56 +00:00
Matthew N. Dodd
0442747236 Print [fddi] or [atm] tags for ARP addresses on interfaces of that type. 2001-10-19 00:33:26 +00:00
Ruslan Ermilov
e87a372b7f Print interface name for each ARP entry.
Prodded by:	Igor Podlesny <poige@morning.ru>
MFC after:	1 week
2001-10-08 11:52:23 +00:00
David E. O'Brien
ac24b049cc Remove GCC'isms in CFLAGS. 2001-07-20 04:23:13 +00:00
Dima Dorfman
f247324df7 Remove whitespace at EOL. 2001-07-15 08:06:20 +00:00
Ruslan Ermilov
a4c37c816b mdoc(7) police: removed HISTORY info from the .Os call. 2001-07-10 15:12:08 +00:00
Ruslan Ermilov
3f844a2221 - Renamed the `proxy'' modifier of the -d flag to `pub'',
to be consistent with the -s flag.  Updated documentation
  on what this modifier does.

- Added the ``only'' keyword to the -s and -S flags, that
  could be used to created "proxy-only" published entries.
  Previously, arp(8) created an entry of this type only
  in the absence of the route to a destination.

PR:		bin/12357
MFC after:	1 week
2001-06-07 12:35:53 +00:00
Yaroslav Tykhiy
ae14be2007 Add a missing free(3).
PR:		bin/27001
Submitted by:	alex <ml-freebsd-net@phobgate.de>,
		Matthew Emmerton <matt@gsicomp.on.ca>
2001-05-02 19:07:46 +00:00
Yaroslav Tykhiy
88d5b61358 Add the VLAN interface type to the list of ARP-capable interface types. 2001-04-04 15:14:06 +00:00
Ruslan Ermilov
345e52e742 - Backout botched attempt to introduce MANSECT feature.
- MAN[1-9] -> MAN.
2001-03-26 14:42:20 +00:00
Bill Fumerola
5651a03692 zeropad mac address ouput
PR:		bin/25584
Submitted by:	David Xu <davidx@viasoft.com.cn>
Reviewed by:	wollman, billf
2001-03-08 01:52:49 +00:00
Warner Losh
59aadf9385 h_errno is declared in netdb.h. 2001-03-01 06:41:43 +00:00
Ruslan Ermilov
eec827b042 Print a diagnostic message if no interface could be determined
when attempting to create a published ARP entry.  For example:

# arp -s 1.1.1.1 auto pub

PR:		bin/7753
Submitted by:	Jonathan Hanna <pangolin@home.com>
2001-02-27 09:02:10 +00:00
Ruslan Ermilov
46eea498da mdoc(7) police: Change -filled displays (which just happen
to be the same as -ragged in the current implementation) to
-ragged.  With mdocNG, -filled displays produce the correct
output, formatted and justified to both margins.
2001-02-07 13:45:30 +00:00
Ruslan Ermilov
3054b08899 mdoc(7) police: modifiers should be marked with .Cm, not .Ar. 2001-02-05 17:01:07 +00:00
Ruslan Ermilov
9ea1ba64dd Make the ``arp -d hostname proxy'' really do something useful.
Specifically, ``proxy'' modifier tells the code to delete only
Proxy ARP entry for the ``hostname''; the usual ARP entry will
be unaffected by this operation.
2001-02-05 16:57:56 +00:00
Archie Cobbs
e03bb411ee Revert previous checkin ("proxy" is required in some instances).
Add a note to that effect to the man page.
2001-02-01 21:23:16 +00:00
Archie Cobbs
bceb4f5a60 Fix documentation: "proxy" is not a keyword for the arp(8) command line. 2001-01-31 00:03:31 +00:00
Ruslan Ermilov
b92a189eb9 mdoc(7) police: Er macro usage cleanup. 2000-11-22 16:11:48 +00:00
Ruslan Ermilov
e97407b4f2 mdoc(7) police: use the new features of the Nm macro. 2000-11-20 20:10:44 +00:00
Ruslan Ermilov
726b61ab5f Avoid use of direct troff requests in mdoc(7) manual pages. 2000-11-10 17:46:15 +00:00
Yoshinobu Inoue
1fece1a6b6 Change type of vars which hold in_addr.s_addr from u_long to u_int32_t,
for more safety on alpha.

Approved by: jkh
2000-03-03 13:01:57 +00:00
Jordan K. Hubbard
135adb1eda Fix syntax error in previous commit. 2000-01-17 01:44:16 +00:00
Kris Kennaway
0cecd500a4 Don't overflow buffers.
Reviewed by:	audit@freebsd.org
2000-01-16 21:15:50 +00:00
Ruslan Ermilov
08e13cdfa7 Yet another align.
It will be required if sizeof(struct sockaddr_in) changes in the future.

Not objected to by:	wollman
1999-09-20 09:10:46 +00:00
Ruslan Ermilov
3a6a5ebeb6 Align sockaddrs passed to/from the routing socket as supposed by kernel.
PR:		12847
Spotted by:	Key Teck Sin <ktsin@acm.org>
Reviewed by:	wollman
1999-09-13 23:32:53 +00:00
Peter Wemm
97d92980a9 $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
Nik Clayton
414a35e60a Add $Id$, to make it simpler for members of the translation teams to
track.

The Id line is normally at the bottom of the main comment block in the
man page, separated from the rest of the manpage by an empty comment,
like so;

     .\"    $Id$
     .\"

If the immediately preceding comment is a @(#) format ID marker than the
the $Id$ will line up underneath it with no intervening blank lines.
Otherwise, an additional blank line is inserted.

Approved by:            bde
1999-07-12 20:12:29 +00:00
Archie Cobbs
3816c56cc1 When incrementing through a SIOCGIFCONF list, enforce a lower limit of
sizeof(ifr->ifr_addr) for the variable length field ifr->ifr_addr.sa_len.
Otherwise the increment will be wrong in certain cases.

Obtained from:	Whistle source tree
For the record:	Garrett Wollman <wollman@khavrinen.lcs.mit.edu> suggests
		SIOCGIFCONF should be dropped in favor of a sysctl mechanism.
1999-06-05 05:52:52 +00:00
Guy Helmer
479c5c7692 Use Cd macro instead of Em for SYNOPSIS, as do other section 4 pages.
Added $Id$.

PR:		docs/10494
1999-05-04 20:42:26 +00:00
Julian Elischer
fda82fc2b9 Submitted by: Larry Lile
Move the Olicom token ring driver to the officially sanctionned location of
/sys/contrib. Also fix some brokenness in the generic token ring support.

Be warned that if_dl.h has been changed and SOME programs might
like recompilation.
1999-03-10 10:11:43 +00:00
Bruce Evans
cc03533c8d Removed most unused includes of <net/if_var.h> outside the kernel. 1998-01-16 17:38:56 +00:00
Julian Elischer
8dc4b495b3 Submitted by: Archie@Whistle.com (Archie Cobbs)
allow teh -a option to work with the  -d option
thus:
arp -d -a now flushes your arp cache.
also fix the -n option so that -an now works correctly.
1997-11-13 01:16:57 +00:00
Philippe Charnier
c72049e448 Use err(3). Document -n flag from OpenBSD.
Obtained from: OpenBSD.
1997-09-03 06:32:31 +00:00
Steve Price
cf90bd0cbb Balance single quotes.
PR:		docs/4161
Submitted by:	Kazuo Horikawa <k-horik@yk.rim.or.jp>
1997-08-23 15:55:58 +00:00
Bruce Evans
f4c1975c26 Removed inconsistent declaration of malloc(). `make world' with DESTDIR
set to something other than "/" now actually works.
1997-04-23 10:16:58 +00:00