summaryrefslogtreecommitdiffstats
path: root/sys/netinet/if_ether.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Simplify arptfree() to no longer look at the route entry's refcounter.mpi2015-10-131-17/+8
| | | | | | | | ARP entries with an expired timeout are now removed from the tree even if they are cached somehwere else. This also reduces differences with NDP. ok bluhm@
* Move route entry debug helpers where they belong.mpi2015-10-071-107/+1
|
* Do not manually decrement rt's refcounter in arplookup() and let thempi2015-09-281-25/+35
| | | | | | callers rtfree(9) it. ok bluhm@
* Fix uninitalized use of variable.claudio2015-09-161-2/+3
| | | | | Issue _17 found by Maxime Villard Brainy scanner. OK bluhm@
* There's no point in abstracting ifp->if_output() as long as pf_test()mpi2015-09-131-5/+5
| | | | | | needs to see lo0 in the output path. ok claudio@
* queue revarps to softnet so we can defer processing to a context withdlg2015-09-131-1/+7
| | | | | | the kernel lock. "do it" claudio@ mpi@
* Stop overwriting the rt_ifp pointer of RTF_LOCAL routes with lo0ifp.mpi2015-09-121-12/+5
| | | | | | | | | Use instead the RTF_LOCAL flag to loop local traffic back to the corresponding protocol queue. With this change rt_ifp is now always the same as rt_ifa->ifa_ifp. ok claudio@
* correctly hold and put a reference to the revarp ifp while tryingdlg2015-09-101-14/+13
| | | | | | to get nfs working. ok claudio@
* Rewrite arpproxy() to no longer iterate on the global list of interfaces.mpi2015-09-091-15/+11
| | | | ok claudio@
* Fix English in comment. OK dlg@claudio2015-09-091-2/+2
|
* KNFmpi2015-08-191-31/+32
|
* Make arplookup() return a pointer to a "struct rtentry".mpi2015-08-191-15/+17
| | | | | | | This is needed for proper refcounting of rtentries and reduce differences with nd6_lookup(). Tweak and ok bluhm@
* Use __func__ rather than the function name in log(9) calls to removempi2015-08-171-8/+8
| | | | some grep output noise.
* Abstract the routing table internals behind an rtable_* API.mpi2015-07-181-13/+5
| | | | | | | | | | Code abusing the radix internals for the routing table should now includes <net/rtable.h> and only deal with "struct rtentry". Code using a radix tree for another purpose can still include <net/radix.h>. Inputs from and ok claudio@, mikeb@
* Announce an IP address after inserting its corresponding RTF_LOCALmpi2015-07-171-9/+6
| | | | | | | route and not during the SIOCSIFADDR ioctl. This way addresses are not announced when an error occurs. ok chris@, claudio@
* Always use "ifp" instead of mixing it with "ac->ac_if" in in_arpinput().mpi2015-07-071-14/+14
|
* Pass a "struct ifnet *" instead of a "struct arpcom *" to arpresolve().mpi2015-06-231-6/+7
| | | | | | | | Most of the ARP layer already take an ifp pointer and this makes clear wich chunks of code are messing with ac_enaddr. Note that our Ethernet code assume that these pointer are interchangeable since the first element of the "struct arpcom" is a "struct ifnet".
* Store a unique ID, an interface index, rather than a pointer to thempi2015-06-161-4/+9
| | | | | | | | | | | | | | | receiving interface in the packet header of every mbuf. The interface pointer should now be retrieved when necessary with if_get(). If a NULL pointer is returned by if_get(), the interface has probably been destroy/removed and the mbuf should be freed. Such mechanism will simplify garbage collection of mbufs and limit problems with dangling ifp pointers. Tested by jmatthew@ and krw@, discussed with many. ok mikeb@, bluhm@, dlg@
* Replace a bunch of == 0 with == NULL in pointer tests. Nuke somekrw2015-06-071-11/+11
| | | | | | | annoying trailing, leading and embedded whitespace. No change to .o files. ok deraadt@
* Do not create ARP entries for RTF_BROADCAST routes.mpi2015-05-261-15/+3
| | | | | | | | | | | | | | | | | This has been done because historically routes to broadcast addresses were cloned like any ARP entry. But for obvious reasons, no matching Ethernet address could ever be resolved. That's why we played tricks with the expire timer. Now that a RTF_BROADCAST route is created per configured IPv4 address, we need to differenciate duplicated one. And by not creating an ARP entry we are allowed to write the IP address in the rt_gateway field, which prevents MPATH conflicts. This change is part of a fix to unbreak aliases since the kernel support multiple connected routes for a subnet. Found the hardway by djm@, ok claudio@
* Allow multiple connected/interface routes to exist at the same time.claudio2015-05-151-15/+1
| | | | | | | | | | | Use the existing multipath code. Switch away from using the ifa address when making the cloning route and instead put a dummy sockaddr_dl route in. With this it is possible to use the same network on multiple interfaces at the same time. So if wireless and ethernet share the same network the system will use the wired connection as long as there is link. Still missing is builtin proxy-arp for the other interface IPs to allow hitless failover. OK mpi@
* Init rt to NULL in arpresolve(). Not a problem in practicejsg2015-04-221-2/+2
| | | | | | | as la will be NULL when rt is uninitialised which should cause the function to return, but makes the code easier to follow. ok mpi@ miod@
* replace the use of ifqueues for most input queues serviced by netisrdlg2015-04-101-10/+6
| | | | | | | | | | | | | | | | | with niqueues. this change is so big because there's a lot of code that takes pointers to different input queues (eg, ether_input picks between ipv4, ipv6, pppoe, arp, and mpls input queues) and falls through to code to enqueue packets against the pointer. if i changed only one of the input queues id have to add sepearate code paths, one for ifqueues and one for niqueues in each of these places by flipping all these input queues at once i can keep the currently common code common. testing by mpi@ sthen@ and rafael zalamena ok mpi@ sthen@ claudio@ henning@
* Convert hand-rolled mbuf list used to store packets until ARPmpi2015-03-241-44/+29
| | | | | | resolution is completed to ml_init(9) API. Tested by kspillner@, inputs & ok dlg@
* Check for the size of the supposed destination address when constructingmpi2015-03-141-1/+8
| | | | | the Ethernet frame. Prevent an overflow reported by Henk Jan Agteresch on bugs@.
* Remove some includes include-what-you-use claims don'tjsg2015-03-141-2/+1
| | | | | | | have any direct symbols used. Tested for indirect use by compiling amd64/i386/sparc64 kernels. ok tedu@ deraadt@
* Do not store the key and the gateway of a route entry in the same chunkmpi2015-02-111-2/+2
| | | | | | | | | | of memory. The key (destination) is only set once, when the route is inserted in the routing table, and does not need to change afterward. The gateway might change and rt_setgate() will do all the checks for you. ok claudio@
* Print a different error message if the route entry supposed to containmpi2015-02-071-1/+10
| | | | | | ARP information is of a different kind. ok sthen@, claudio@
* Convert various rtrequest1(RTM_DELETE,...) calls to rtdeletemsg(9).mpi2015-02-051-10/+2
| | | | | | This unify some code and notify userland for free. blambert@ agrees, ok bluhm@
* Revert rtdeletemsg conversion. It was not ok'd, I misunderstood bluhm@'smpi2015-01-281-9/+2
| | | | email.
* Do not always try to rtfree(9) route entries inside rtdeletemsg(9).mpi2015-01-261-2/+9
| | | | | | | Instead check the error code returned by this function and let the caller free the route entry when appropriate. ok bluhm@
* Only notify userland about resolved ARP entries if the Ethernet addressmpi2015-01-131-3/+6
| | | | | | | | changed or if we asked for it. Should reduce the RTM_RESOLVE storm seeing by claudio@ With inputs from and ok mikeb@
* Factorize various duplicated chunks of (old and horrible) code, checkingmpi2015-01-081-13/+23
| | | | | | | | | | | | | | | | | | | | | | | | | for the validity of a given outgoing route entry into a single function. This change is inspired from FreeBSD r111767. The function introduced here, rt_checkgate(), should hopefully die in a near future. Why should it die? Well, it is way too late to do such validity checks: if your kernel can ends up in ether_output() with an invalid route, please do not let it try to find a new one that might do the job. Go read this function if you're wondering why you're getting messages like: "arpresolve: X.X.X.X: route without link local address" Since this horrible logic has survived 20 years of copy & past and small modifications for workarounds without a single clear commit message, let's assume it is full of dragons and try to play safe. This factorization is not intended to change any behavior. With much inputs from bluhm@, tested by weerd@ and florian@ on setups with p2p IPv6 interfaces. ok bluhm@, benno@, florian@
* unifdef INET in net code as a precursor to removing the pretend option.tedu2014-12-191-3/+1
| | | | | long live the one true internet. ok henning mikeb
* Explicitly include <net/if_var.h> instead of pulling it in <net/if.h>.mpi2014-12-051-1/+2
| | | | ok mikeb@, krw@, bluhm@, tedu@
* Rename rtalloc1() into rtalloc(9) and convert its flags to only enablempi2014-11-011-3/+6
| | | | | | functionnality instead of a mix of enable/disable. ok bluhm@, jca@
* Make sure broadcast entries won't be freed by the arp timer so we canmpi2014-09-031-2/+15
| | | | | | | | use them for address lookups. While here do let in_arpinput() overwrite local or broadcast entries. ok mikeb@, florian@
* Revert the addition of broadcast addresses, it apparently also corruptsmpi2014-08-261-13/+1
| | | | the tree. Found by millert@.
* When a local route entry is added for an ifa having a broadcast address,mpi2014-08-191-1/+13
| | | | | | | | | | | | | | | also adds a broadcast entry flagged with RTF_BROADCAST. Prior to this change broadcast entries were simple clonned ARP entries, that would be deleted once their timer expired since they would always be incomplete. With this change they are now persistant and identifiable with a new flag. Committing early to be able to deal with any potential fallout before we start relying on this. ok florian@, mikeb@, henning@
* Use the RTF_LOCAL flag instead of abusing the RTF_LLINFO flag whenmpi2014-08-111-2/+2
| | | | | | | adding local route entries. This hack made sense when we didn't have the RTF_LOCAL flag, but since some months it is set on every local route.
* Convert ARP llinfo allocation to pool(9).mpi2014-08-111-3/+8
| | | | ok henning@, dlg@
* add a size argument to free. will be used soon, but for now default to 0.tedu2014-07-121-2/+2
| | | | after discussions with beck deraadt kettenis.
* Always create a local route for every configured IPv4 address on thempi2014-07-121-3/+5
| | | | | | | | | | | | | | | | machine and restore the original behavior of RTM_ADD and RTM_DELETE by always generating one message per locally configured address. This time, make sure the local route is removed during an address change, since at least pppoe(4) do some funky magics with wildcard addresses that might corrupt the routing tree, as found by naddy@ Also do not add a local route if the specified address is 0.0.0.0, to prevent a tree corruption, as found by guenther@. Putting this in now so that it gets tested, claudio@ agrees. Please contact me if you find any route-related regression caused by this change.
* Revert "Always create a local route for every configured IPv4 address",mpi2014-06-161-5/+3
| | | | | | it introduces a regression with default routes & p2p interfaces. Problem reported by naddy@
* Always create a local route for every configured IPv4 address on thempi2014-06-111-3/+5
| | | | | | | machine and restore the original behavior of RTM_ADD and RTM_DELETE by always generating one message per locally configured address. Tested by krw@, jca@ and florian@
* Kill the {nd6_,}useloopback buttons, using the loopback interface formpi2014-05-071-21/+3
| | | | | | local traffic is not optional. ok mikeb@, stsp@, jca@
* Use a custom ifa_rtrequest function for point-to-point interfacesmpi2014-05-051-1/+7
| | | | | | | | | | instead of relying on hacks in nd6_rtrequest() to add a route to loopback for each address configured on such interfaces. While here document that abusing lo0 for local traffic is not safe for interfaces in a non-default rdomain. Tested by claudio@, jca@ and sthen@, ok sthen@
* "struct pkthdr" holds a routing table ID, not a routing domain one.mpi2014-04-141-4/+4
| | | | | | | | | | | | | | Avoid the confusion by using an appropriate name for the variable. Note that since routing domain IDs are a subset of the set of routing table IDs, the following idiom is correct: rtableid = rdomain But to get the routing domain ID corresponding to a given routing table ID, you must call rtable_l2(9). claudio@ likes it, ok mikeb@
* notify userland when arp entry is removed; ok mpimikeb2014-04-101-6/+2
|
* Stop mixing interface address flags with routing entry ones.mpi2014-03-271-2/+1
| | | | | | | | | | Instead of always copying ifa_flags to the routing entry flags when creating a route by calling rtinit(), explicitly pass the RTF_CLONING flag when required. This means ifa_flags are now *only* used to check if an address has an associated route that was created by the kernel auto-magically. ok benno@