summaryrefslogtreecommitdiff
path: root/sys/netinet/if_ether.c
Commit message (Collapse)AuthorAgeFilesLines
* MFC Common Address Redundancy Protocol implementation.Gleb Smirnoff2005-03-211-5/+46
| | | | | | | Approved by: re Notes: svn path=/stable/5/; revision=143925
* MFC: /*- and related license changesWarner Losh2005-01-311-1/+1
| | | | Notes: svn path=/stable/5/; revision=141090
* Merge if_ether.c:1.130 from HEAD to RELENG_5:Robert Watson2004-12-251-1/+7
| | | | | | | | | | | date: 2004/10/12 17:10:40; author: rwatson; state: Exp; lines: +7 -1 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. Notes: svn path=/stable/5/; revision=139308
* MFC: in.c, rev. 1.78-1.80 and if_ether.c, rev. 1.132Max Laier2004-12-121-2/+20
| | | | | | | | | | | | | | | Change the way we automatically add prefix routes when adding a new address. This makes it possible to have more than one address with the same prefix. The first address added is used for the route. On deletion of an address with IFA_ROUTE set, we try to find a "fallback" address and hand over the route if possible. Obtained from: Open/NetBSD Discussed on: -net, -arch A lot of help: ru Notes: svn path=/stable/5/; revision=138750
* MFC rev 1.131:Bruce M Simpson2004-10-261-0/+1
| | | | | | | | | | | | Check that rt_mask(rt) is non-NULL before dereferencing it, in the RTM_ADD case, thus avoiding a panic. PR: kern/42030 Submitted by: Iasen Kostov Approved by: re@ Notes: svn path=/stable/5/; revision=136972
* MFC 1.129:Gleb Smirnoff2004-09-171-11/+5
| | | | | | | | | | Check flag do_bridge always, even if kernel was compiled without BRIDGE support. This makes dynamic bridge.ko working. Approved by: re (scottl) Notes: svn path=/stable/5/; revision=135398
* Add a new driver to support IP over firewire. This driver is intended toDoug Rabson2004-06-131-1/+2
| | | | | | | | | | | 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. Notes: svn path=/head/; revision=130407
* Another small set of changes to reduce diffs with the new arp code.Luigi Rizzo2004-04-251-31/+18
| | | | Notes: svn path=/head/; revision=128645
* remove a stale comment on the behaviour of arpresolveLuigi Rizzo2004-04-251-10/+0
| | | | Notes: svn path=/head/; revision=128642
* Start the arp timer at init time.Luigi Rizzo2004-04-251-10/+1
| | | | | | | It runs so rarely that it makes no sense to wait until the first request. Notes: svn path=/head/; revision=128641
* This commit does two things:Luigi Rizzo2004-04-251-7/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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) Notes: svn path=/head/; revision=128636
* Replace Bcopy with 'the real thing' as in the rest of the file.Luigi Rizzo2004-04-181-1/+1
| | | | Notes: svn path=/head/; revision=128398
* Remove advertising clause from University of California Regent'sWarner Losh2004-04-071-4/+0
| | | | | | | | | | license, per letter dated July 22, 1999 and email from Peter Wemm, Alan Cox and Robert Watson. Approved by: core, peter, alc, rwatson Notes: svn path=/head/; revision=128019
* + arpresolve(): remove an unused argumentLuigi Rizzo2004-04-041-7/+2
| | | | | | | | | | | | + 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 Notes: svn path=/head/; revision=127828
* - Fix indentation lost by 'diff -b'.Matthew N. Dodd2004-03-211-5/+4
| | | | | | | - Un-wrap short line. Notes: svn path=/head/; revision=127277
* Remove interface type specific code from arprequest(), and in_arpinput().Matthew N. Dodd2004-03-211-111/+19
| | | | | | | | | | The AF_ARP case in the (*if_output)() routine will handle the interface type specific bits. Obtained from: NetBSD Notes: svn path=/head/; revision=127261
* De-register.Matthew N. Dodd2004-03-141-22/+22
| | | | Notes: svn path=/head/; revision=126936
* I didn't notice it right away, but check the right length too.Ruslan Ermilov2003-12-231-1/+1
| | | | Notes: svn path=/head/; revision=123768
* Fix a problem introduced in revision 1.84: m_pullup() does notRuslan Ermilov2003-12-231-5/+7
| | | | | | | | necessarily return the same mbuf chain so we need to recompute mtod() consumers after pulling up. Notes: svn path=/head/; revision=123765
* replace explicit changes to rt_refcnt by RT_ADDREF and RT_REMREFSam Leffler2003-11-081-1/+1
| | | | | | | | | | macros that expand to include assertions when the system is built with INVARIANTS Supported by: FreeBSD Foundation Notes: svn path=/head/; revision=122334
* o add a flags parameter to netisr_register that is used to specifySam Leffler2003-11-081-1/+1
| | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=122320
* Replace the if_name and if_unit members of struct ifnet with new membersBrooks Davis2003-10-311-11/+10
| | | | | | | | | | | | | | | | 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) Notes: svn path=/head/; revision=121816
* Overhaul routing table entry cleanup by introducing a new rtexpungeSam Leffler2003-10-301-8/+3
| | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=121770
* Locking for updates to routing table entries. Each rtentry gets a mutexSam Leffler2003-10-041-32/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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) Notes: svn path=/head/; revision=120727
* Shorten 'bad gateway' AF_LINK message.Bruce M Simpson2003-10-031-1/+1
| | | | | | | Submitted by: green Notes: svn path=/head/; revision=120699
* Make arp_rtrequest()'s 'bad gateway' messages slightly more informative,Bruce M Simpson2003-10-031-1/+4
| | | | | | | | | to aid me in tracking down LLINFO inconsistencies in the routing table. Discussed with: fenner Notes: svn path=/head/; revision=120698
* Only delete the route if arplookup() tried to create it. Do not deleteBruce M Simpson2003-10-031-8/+13
| | | | | | | | | | | | 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 Notes: svn path=/head/; revision=120685
* By popular demand, added the "static ARP" per-interface option.Ruslan Ermilov2003-10-011-2/+4
| | | | Notes: svn path=/head/; revision=120626
* Fix a logic error in the check to see if arplookup() should free the route.Bruce M Simpson2003-09-241-2/+1
| | | | | | | | Noticed by: Mike Hogsett Reviewed by: ru Notes: svn path=/head/; revision=120418
* Fix a bug in arplookup(), whereby a hostile party on a locallyBruce M Simpson2003-09-231-6/+14
| | | | | | | | | | | 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> Notes: svn path=/head/; revision=120383
* Update netisr handling; Each SWI now registers its queue, and all queueJonathan Lemon2003-03-041-41/+30
| | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=111888
* Back out M_* changes, per decision of the TRB.Warner Losh2003-02-191-1/+1
| | | | | | | Approved by: trb Notes: svn path=/head/; revision=111119
* Avoid multiply for preemptive arp calculation since it hits everyOrion Hodson2003-02-081-6/+7
| | | | | | | | | ethernet packet sent. Prompted by: Jeffrey Hsu <hsu@FreeBSD.org> Notes: svn path=/head/; revision=110544
* MFS 1.64.2.22: Re-enable non pre-emptive ARP requests.Orion Hodson2003-02-041-14/+15
| | | | | | | | Submitted by: "Diomidis Spinellis" <dds@aueb.gr> PR: kern/46116 Notes: svn path=/head/; revision=110308
* Avoid lock order reversal by expanding the scope of theJeffrey Hsu2003-01-281-15/+5
| | | | | | | AF_INET radix tree lock to cover the ARP data structures. Notes: svn path=/head/; revision=109996
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.Alfred Perlstein2003-01-211-1/+1
| | | | | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT. Notes: svn path=/head/; revision=109623
* SMP locking for ARP.Jeffrey Hsu2003-01-171-6/+21
| | | | Notes: svn path=/head/; revision=109409
* Clear the target hardware address field when generating an ARP request.Thomas Moestl2003-01-101-0/+1
| | | | | | | | Reviewed by: nectar MFC after: 1 week Notes: svn path=/head/; revision=109035
* Introduce support for Mandatory Access Control and extensibleRobert Watson2002-07-311-0/+5
| | | | | | | | | | | | | kernel access control. When generating an ARP query, invoke a MAC entry point to permit the MAC framework to label its mbuf appropriately for the interface. Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs Notes: svn path=/head/; revision=101090
* Solve the 'unregistered netisr 18' information notice with a sledgehammer.Peter Wemm2002-06-201-4/+7
| | | | | | | | | Register the ISR early, but do not actually kick off the timer until we see some activity. This still saves us from running the arp timers on a system with no network cards. Notes: svn path=/head/; revision=98459
* Reset token-ring source routing control field on receipt of ethernet frameKelly Yancey2002-05-151-0/+1
| | | | | | | | without source routing information. This restores the behaviour in this scenario to that of prior to my last commit. Notes: svn path=/head/; revision=96624
* Move ISO88025 source routing information into sockaddr_dl's sdl_dataKelly Yancey2002-05-071-8/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | field. This returns the sdl_data field to a variable-length field. More importantly, this prevents a easily-reproduceable data-corruption bug when the interface name plus the hardware address exceed the sdl_data field's original 12 byte limit. However, token-ring interfaces may still overflow the new sdl_data field's 46 byte limit if the interface name exceeds 6 characters (since 6 characters for interface name plus 6 for hardware address plus 34 for source routing = the size of sdl_data). Further refinements could overcome this limitation but would break binary compatibility; this commit only addresses fixing the bug for commonly-occuring cases without breaking binary compatibility with the intention that the functionality can be MFC'ed to -stable. See message ID's (both send to -arch): 20020421013332.F87395-100000@gateway.posi.net 20020430181359.G11009-300000@gateway.posi.net for a more thorough description of the bug addressed and how to reproduce it. Approved by: silence on -arch and -net Sponsored by: NTT Multimedia Communications Labs MFC after: 1 week Notes: svn path=/head/; revision=96184
* Change callers of mtx_init() to pass in an appropriate lock type name. InJohn Baldwin2002-04-041-1/+1
| | | | | | | | | | most cases NULL is passed, but in some cases such as network driver locks (which use the MTX_NETWORK_LOCK macro) and UMA zone locks, a name is used. Tested on: i386, alpha, sparc64 Notes: svn path=/head/; revision=93818
* Send periodic ARP requests when ARP entries for hosts we are sendingOrion Hodson2002-03-201-0/+15
| | | | | | | | | | | | | to are about to expire. This prevents high packet rate flows from experiencing packet drops at the sender following ARP cache entry timeout. PR: kern/25517 Reviewed by: luigi MFC after: 7 days Notes: svn path=/head/; revision=92802
* Remove __P.Alfred Perlstein2002-03-191-9/+9
| | | | Notes: svn path=/head/; revision=92723
* Minor style fix.Jonathan Lemon2001-12-131-2/+2
| | | | Notes: svn path=/head/; revision=87776
* Fixed remotely exploitable DoS in arpresolve().Ruslan Ermilov2001-12-051-1/+3
| | | | | | | | | | | | Easily exploitable by flood pinging the target host over an interface with the IFF_NOARP flag set (all you need to know is the target host's MAC address). MFC after: 0 days Notes: svn path=/head/; revision=87410
* If we are bridging, fall back to using any inet address in the system,Jonathan Lemon2001-10-251-4/+9
| | | | | | | | | irrespective of receive interface, as a last resort. Submitted by: ru Notes: svn path=/head/; revision=85466
* Only examine inet addresses of the interface. This was broken in r1.83,Jonathan Lemon2001-10-201-2/+4
| | | | | | | with the result that the system would reply to an ARP request of 0.0.0.0 Notes: svn path=/head/; revision=85223
* Pull post-4.4BSD change to sys/net/route.c from BSD/OS 4.2.Ruslan Ermilov2001-10-171-3/+3
| | | | | | | | | | | | | | | | | | | | | | | Have sys/net/route.c:rtrequest1(), which takes ``rt_addrinfo *'' as the argument. Pass rt_addrinfo all the way down to rtrequest1 and ifa->ifa_rtrequest. 3rd argument of ifa->ifa_rtrequest is now ``rt_addrinfo *'' instead of ``sockaddr *'' (almost noone is using it anyways). Benefit: the following command now works. Previously we needed two route(8) invocations, "add" then "change". # route add -inet6 default ::1 -ifp gif0 Remove unsafe typecast in rtrequest(), from ``rtentry *'' to ``sockaddr *''. It was introduced by 4.3BSD-Reno and never corrected. Obtained from: BSD/OS, NetBSD MFC after: 1 month PR: kern/28360 Notes: svn path=/head/; revision=85074