Commit Graph

149 Commits

Author SHA1 Message Date
glebius
483f47f6db Partial backout. Do not use time_uptime instead of time_second, since
this change wasn't merged to other files.

Pointy hat to:	glebius
Approved by:	re (hrs)
2006-03-22 07:48:31 +00:00
thompsa
4e1f41f885 MFC r1.151
Further refine the bridge hack in the arp code. Only do the special arp
  handling for interfaces which are actually in the bridge group, ignore all
  others.

Approved by:	re (hrs)
2006-03-11 19:32:44 +00:00
thompsa
7a8d8adc25 MFC r1.150, do not send two ARP replies if the bridge has an address.
Approved by:	re (scottl)
2006-02-03 08:07:42 +00:00
thompsa
336b0354fa InstaMFC:
Back out of r1.148, it causes two arp replies to be sent with different mac
 addresses.
2006-01-29 23:22:42 +00:00
thompsa
a387d16385 MFC r1.148:
Include the bridge interface itself in the special arp handling.
2006-01-19 00:38:00 +00:00
glebius
9c2a5c3b76 MFC:
Add a knob to suppress logging of attempts to modify
  permanent ARP entries.

  Submitted by:   Andrew Alcheyev <buddy telenet.ru>
2005-12-28 13:33:41 +00:00
glebius
d0507213b8 Previous commit merged 1.145 and _a part of_ 1.142, and this part
broke ARP in RELENG_6. At this time merge 1.142 entirely.

Pointy hat to:	glebius
2005-11-26 10:51:23 +00:00
glebius
630273a7cf MFC 1.145:
Rework ARP retransmission algorythm so that ARP requests are
  retransmitted without suppression, while there is demand for
  such ARP entry. As before, retransmission is rate limited to
  one packet per second. Details:
    - Remove net.link.ether.inet.host_down_time
    - Do not set/clear RTF_REJECT flag on route, to
      avoid rt_check() returning error. We will generate error
      ourselves.
    - Return EWOULDBLOCK on first arp_maxtries failed
      requests , and return EHOSTDOWN/EHOSTUNREACH
      on further requests.
    - Retransmit ARP request always, independently from return
      code. Ratelimit to 1 pps.

MFC 1.142:
  Use monotonic 'time_uptime' instead of 'time_second' as timebase
  for rt->rt_rmx.rmx_expire.
2005-11-25 14:38:19 +00:00
thompsa
03bd7c8581 MFC r1.144
When bridging is enabled and an ARP request is recieved on a member interface,
 the arp code will search all local interfaces for a match. This triggers a
 kernel log if the bridge has been assigned an address.

 arp: ac🇩🇪48:18:83:3d is using my IP address 192.168.0.142!

 bridge0: flags=8041<UP,RUNNING,MULTICAST> mtu 1500
         inet 192.168.0.142 netmask 0xffffff00
         ether ac🇩🇪48:18:83:3d

 Silence this warning for 6.0 to stop unnecessary bug reports, the code will need
 to be reworked.

Approved by:	re (scottl)
2005-10-07 01:51:29 +00:00
glebius
173514a44a MFC 1.141:
- Do not hold route entry lock, when calling arprequest(). One such
    call was introduced by me in 1.139, the other one was present before.
  - Do all manipulations with rtentry and la before dropping the lock.
  - Copy interface address from route into local variable before dropping
    the lock. Supply this copy as argument to arprequest().

  (LOR Ids in original commit message.)

Approved by:	re (scottl)
2005-09-13 14:37:58 +00:00
glebius
24a6a04f7f MFC 1.140:
When we have a published ARP entry for some IP address, do reply on
  ARP requests only on the network where this IP address belong, to.

  Before this change we did replied on all interfaces. This could
  lead to an IP address conflict with host we are doing ARP proxy
  for.

  PR:		kern/75634
  Reviewed by:	andre

Approved by:	re (scottl)
2005-08-29 09:06:30 +00:00
glebius
c6a0e452c9 MFC 1.139, that closes several races in ARP code. See original
commit log for more information.

Approved by:	re (kensmith)
2005-08-18 10:14:22 +00:00
thompsa
6c5bdda300 Add hooks into the networking layer to support if_bridge. This changes struct
ifnet so a buildworld is necessary.

Approved by:	mlaier (mentor)
Obtained from:	NetBSD
2005-06-05 03:13:13 +00:00
glebius
7884851ca9 Embrace with #ifdef DEV_CARP carp-related code. 2005-03-13 11:23:22 +00:00
glebius
41e08b3800 Make ARP do not complain about wrong interface if correct interface
is a carp one and address matched it.

Reviewed by:	brooks
2005-03-09 10:00:01 +00:00
glebius
e1d22638d0 Add CARP (Common Address Redundancy Protocol), which allows multiple
hosts to share an IP address, providing high availability and load
balancing.

Original work on CARP done by Michael Shalayeff, with many
additions by Marco Pfatschbacher and Ryan McBride.

FreeBSD port done solely by Max Laier.

Patch by:	mlaier
Obtained from:	OpenBSD (mickey, mcbride)
2005-02-22 13:04:05 +00:00
imp
a50ffc2912 /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
mlaier
489aa3c57e More fixing of multiple addresses in the same prefix. This time do not try
to arp resolve "secondary" local addresses.

Found and submitted by:	ru
With additions from:	OpenBSD (rev. 1.47)
Reviewed by:		ru
2004-12-09 00:12:41 +00:00
bms
53c873427a Check that rt_mask(rt) is non-NULL before dereferencing it, in the
RTM_ADD case, thus avoiding a panic.

Submitted by:	Iasen Kostov
2004-10-26 03:31:58 +00:00
rwatson
338d307146 Modify the thrilling "%D is using my IP address %s!" message so that
it isn't printed if the IP address in question is '0.0.0.0', which is
used by nodes performing DHCP lookup, and so constitute a false
positive as a report of misconfiguration.
2004-10-12 17:10:40 +00:00
glebius
c887bf2814 Check flag do_bridge always, even if kernel was compiled without
BRIDGE support. This makes dynamic bridge.ko working.

Reviewed by:	sam
Approved by:	julian (mentor)
MFC after:	1 week
2004-09-09 12:34:07 +00:00
dfr
a1fa8042f5 Add a new driver to support IP over firewire. This driver is intended to
conform to the rfc2734 and rfc3146 standard for IP over firewire and
should eventually supercede the fwe driver. Right now the broadcast
channel number is hardwired and we don't support MCAP for multicast
channel allocation - more infrastructure is required in the firewire
code itself to fix these problems.
2004-06-13 10:54:36 +00:00
luigi
53bd42643d Another small set of changes to reduce diffs with the new arp code. 2004-04-25 15:00:17 +00:00
luigi
93066eb95b remove a stale comment on the behaviour of arpresolve 2004-04-25 14:06:23 +00:00
luigi
131ad9c351 Start the arp timer at init time.
It runs so rarely that it makes no sense to wait until the first request.
2004-04-25 12:50:14 +00:00
luigi
59063f7a08 This commit does two things:
1. rt_check() cleanup:
    rt_check() is only necessary for some address families to gain access
    to the corresponding arp entry, so call it only in/near the *resolve()
    routines where it is actually used -- at the moment this is
    arpresolve(), nd6_storelladdr() (the call is embedded here),
    and atmresolve() (the call is just before atmresolve to reduce
    the number of changes).
    This change will make it a lot easier to decouple the arp table
    from the routing table.

    There is an extra call to rt_check() in if_iso88025subr.c to
    determine the routing info length. I have left it alone for
    the time being.

    The interface of arpresolve() and nd6_storelladdr() now changes slightly:
     + the 'rtentry' parameter (really a hint from the upper level layer)
       is now passed unchanged from *_output(), so it becomes the route
       to the final destination and not to the gateway.
     + the routines will return 0 if resolution is possible, non-zero
       otherwise.
     + arpresolve() returns EWOULDBLOCK in case the mbuf is being held
       waiting for an arp reply -- in this case the error code is masked
       in the caller so the upper layer protocol will not see a failure.

2. arpcom untangling
    Where possible, use 'struct ifnet' instead of 'struct arpcom' variables,
    and use the IFP2AC macro to access arpcom fields.
    This mostly affects the netatalk code.

=== Detailed changes: ===
net/if_arcsubr.c
   rt_check() cleanup, remove a useless variable

net/if_atmsubr.c
   rt_check() cleanup

net/if_ethersubr.c
   rt_check() cleanup, arpcom untangling

net/if_fddisubr.c
   rt_check() cleanup, arpcom untangling

net/if_iso88025subr.c
   rt_check() cleanup

netatalk/aarp.c
   arpcom untangling, remove a block of duplicated code

netatalk/at_extern.h
   arpcom untangling

netinet/if_ether.c
   rt_check() cleanup (change arpresolve)

netinet6/nd6.c
   rt_check() cleanup (change nd6_storelladdr)
2004-04-25 09:24:52 +00:00
luigi
eb6b02962a Replace Bcopy with 'the real thing' as in the rest of the file. 2004-04-18 11:45:49 +00:00
imp
b49b7fe799 Remove advertising clause from University of California Regent's
license, per letter dated July 22, 1999 and email from Peter Wemm,
Alan Cox and Robert Watson.

Approved by: core, peter, alc, rwatson
2004-04-07 20:46:16 +00:00
luigi
c54de1f76f + arpresolve(): remove an unused argument
+ struct ifnet: remove unused fields, move ipv6-related field close
  to each other, add a pointer to l3<->l2 translation tables (arp,nd6,
  etc.) for future use.

+ struct route: remove an unused field, move close to each
  other some fields that might likely go away in the future
2004-04-04 06:14:55 +00:00
mdodd
97af430ce1 - Fix indentation lost by 'diff -b'.
- Un-wrap short line.
2004-03-21 18:51:26 +00:00
mdodd
3092080960 Remove interface type specific code from arprequest(), and in_arpinput().
The AF_ARP case in the (*if_output)() routine will handle the interface type
specific bits.

Obtained from:	NetBSD
2004-03-21 06:36:05 +00:00
mdodd
90eb7f448e De-register. 2004-03-14 00:44:11 +00:00
ru
fc90128bf7 I didn't notice it right away, but check the right length too. 2003-12-23 14:08:50 +00:00
ru
0b3fdbfa52 Fix a problem introduced in revision 1.84: m_pullup() does not
necessarily return the same mbuf chain so we need to recompute
mtod() consumers after pulling up.
2003-12-23 13:33:23 +00:00
sam
c997776d7c replace explicit changes to rt_refcnt by RT_ADDREF and RT_REMREF
macros that expand to include assertions when the system is built
with INVARIANTS

Supported by:	FreeBSD Foundation
2003-11-08 23:36:32 +00:00
sam
7f3b205cb8 o add a flags parameter to netisr_register that is used to specify
whether or not the isr needs to hold Giant when running; Giant-less
  operation is also controlled by the setting of debug_mpsafenet
o mark all netisr's except NETISR_IP as needing Giant
o add a GIANT_REQUIRED assertion to the top of netisr's that need Giant
o pickup Giant (when debug_mpsafenet is 1) inside ip_input before
  calling up with a packet
o change netisr handling so swi_net runs w/o Giant; instead we grab
  Giant before invoking handlers based on whether the handler needs Giant
o change netisr handling so that netisr's that are marked MPSAFE may
  have multiple instances active at a time
o add netisr statistics for packets dropped because the isr is inactive

Supported by:	FreeBSD Foundation
2003-11-08 22:28:40 +00:00
brooks
f1e94c6f29 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
9183d53dd7 Overhaul routing table entry cleanup by introducing a new rtexpunge
routine that takes a locked routing table reference and removes all
references to the entry in the various data structures. This
eliminates instances of recursive locking and also closes races
where the lock on the entry had to be dropped prior to calling
rtrequest(RTM_DELETE).  This also cleans up confusion where the
caller held a reference to an entry that might have been reclaimed
(and in some cases used that reference).

Supported by:	FreeBSD Foundation
2003-10-30 23:02:51 +00:00
sam
9d93fce265 Locking for updates to routing table entries. Each rtentry gets a mutex
that covers updates to the contents.  Note this is separate from holding
a reference and/or locking the routing table itself.

Other/related changes:

o rtredirect loses the final parameter by which an rtentry reference
  may be returned; this was never used and added unwarranted complexity
  for locking.
o minor style cleanups to routing code (e.g. ansi-fy function decls)
o remove the logic to bump the refcnt on the parent of cloned routes,
  we assume the parent will remain as long as the clone; doing this avoids
  a circularity in locking during delete
o convert some timeouts to MPSAFE callouts

Notes:

1. rt_mtx in struct rtentry is guarded by #ifdef _KERNEL as user-level
   applications cannot/do-no know about mutex's.  Doing this requires
   that the mutex be the last element in the structure.  A better solution
   is to introduce an externalized version of struct rtentry but this is
   a major task because of the intertwining of rtentry and other data
   structures that are visible to user applications.
2. There are known LOR's that are expected to go away with forthcoming
   work to eliminate many held references.  If not these will be resolved
   prior to release.
3. ATM changes are untested.

Sponsored by:	FreeBSD Foundation
Obtained from:	BSD/OS (partly)
2003-10-04 03:44:50 +00:00
bms
2e29f8c188 Shorten 'bad gateway' AF_LINK message.
Submitted by:	green
2003-10-03 17:22:14 +00:00
bms
0a71157b43 Make arp_rtrequest()'s 'bad gateway' messages slightly more informative,
to aid me in tracking down LLINFO inconsistencies in the routing table.

Discussed with:	fenner
2003-10-03 17:21:17 +00:00
bms
f4dc9f80e3 Only delete the route if arplookup() tried to create it. Do not delete
RTF_STATIC routes. Do not check for RTF_HOST so as to avoid being DoSed
when an RTF_GENMASK route exists in the table.

Add a more verbose comment about exactly what this code does.

Submitted by:	ru
2003-10-03 09:19:23 +00:00
ru
e7ebf2c29a By popular demand, added the "static ARP" per-interface option. 2003-10-01 08:32:37 +00:00
bms
c4d2292202 Fix a logic error in the check to see if arplookup() should free the route.
Noticed by:	Mike Hogsett
Reviewed by:	ru
2003-09-24 20:52:25 +00:00
bms
3d68723716 Fix a bug in arplookup(), whereby a hostile party on a locally
attached network could exhaust kernel memory, and cause a system
panic, by sending a flood of spoofed ARP requests.

Approved by:	jake (mentor)
Reported by:	Apple Product Security <product-security@apple.com>
2003-09-23 16:39:31 +00:00
jlemon
04e28d5a81 Update netisr handling; Each SWI now registers its queue, and all queue
drain routines are done by swi_net, which allows for better queue control
at some future point.  Packets may also be directly dispatched to a netisr
instead of queued, this may be of interest at some installations, but
currently defaults to off.

Reviewed by: hsu, silby, jayanth, sam
Sponsored by: DARPA, NAI Labs
2003-03-04 23:19:55 +00:00
imp
cf874b345d Back out M_* changes, per decision of the TRB.
Approved by: trb
2003-02-19 05:47:46 +00:00
orion
7d33afda11 Avoid multiply for preemptive arp calculation since it hits every
ethernet packet sent.

Prompted by: Jeffrey Hsu <hsu@FreeBSD.org>
2003-02-08 15:05:15 +00:00
orion
946aecb3fe MFS 1.64.2.22: Re-enable non pre-emptive ARP requests.
Submitted by: "Diomidis Spinellis" <dds@aueb.gr>
PR:           kern/46116
2003-02-04 05:28:08 +00:00
hsu
251a68e729 Avoid lock order reversal by expanding the scope of the
AF_INET radix tree lock to cover the ARP data structures.
2003-01-28 20:22:19 +00:00