Commit Graph

72 Commits

Author SHA1 Message Date
Remko Lodder
c5047621f0 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

Approved by:	re (rwatson), imp (mentor, implicit)
2009-08-14 19:30:59 +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
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
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
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
f6385e481e Sync utility's usage() with manpage's SYNOPSIS. 2006-09-29 16:07:44 +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
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
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
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
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
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
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
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
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
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
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
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
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