summaryrefslogtreecommitdiff
path: root/sys/net/if.c
AgeCommit message (Collapse)Author
2014-11-03Do no change the gateway of local routes for p2p interfaces.Martin Pieuchot
This change was defeating the code in rtrequest1(9) checking for route entries with the same dst/gw when the same IP address was configured on multiple interfaces. As a result, multiple local routes were created for the same address and marked as multipath. But changing their gateway to 127.0.0.1 would make them similar and impossible to remove. This would leaves entries with a stall ifa pointer as soon as the address was removed. Prevent a panic reported by todd@
2014-10-08Tedu the RB-tree of addresses, thanks for all the fish!Martin Pieuchot
ok henning@, dlg@, mikeb@
2014-09-30Stop using the RB-tree in ifa_ifwithaddr() and make it lookup overMartin Pieuchot
all the per-interface lists of addresses. Teaks and ok bluhm@, ok kspillner@, claudio@
2014-08-25Move sending of router solicitations to the kernel; receiving andFlorian Obser
processing of router advertisements was already in the kernel. With this rtsol{,d}(8) is no longer necessary. The kernel starts sending solicitations with # ifconfig $IF inet6 autoconf or inet6 autoconf in /etc/hostname.$IF. input stsp@ much help & OK mpi@ tweaks & OK bluhm@
2014-08-14Compare number of allocated clusters with a low watermark, notMike Belopuhov
a magic number 4 since sometimes we can't fit a single packet (jumbo frame) into 4 clusters. OK dlg
2014-08-11Use the RTF_LOCAL flag instead of abusing the RTF_LLINFO flag whenMartin Pieuchot
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.
2014-07-12add a size argument to free. will be used soon, but for now default to 0.Ted Unangst
after discussions with beck deraadt kettenis.
2014-07-12/* this has no effect on IP, and will kill all ISO connections XXX */Henning Brauer
farewell, then. has been #ifdef notyet for the last 19 years
2014-07-11"It's not the years, honey; it's the mileage."Ted Unangst
bluetooth support doesn't work and isn't going anywhere. the current design is a dead end, and should not be the basis for any future support. general consensus says to whack it so as to not mislead the unwary.
2014-07-08pull the rx ring accounting out of the mbuf layer now that its all doneDavid Gwynne
via if_rxring things. this effectively deprecates the third argument for MCLGETI and m_clget and makes the mbuf layer no longer care about interfaces and simplifies the allocation paths. the timeout used to measure livelock has been moved to net/if.c. ok mpi@
2014-07-08introduce the if_rxr api. it is intended to pull the rx ring accountingDavid Gwynne
out of the mbuf layer, and break the assumption that an interface will only have a single ring per mbuf cluster size. mpi@ is ok with moving this forward
2014-06-26Calling in{6,}_purgeaddr() is not enough to remove an address fromMartin Pieuchot
an interface. Two other operations are performed when issuing a SIOCDIFADDR{_IN6,} ioctl: call the address hook and the per-driver ioctl function. Since carp(4) relies on an address hook to recalculate its hash, make sure to call this hook when IFXF_NOINET6 is set or when the rdomain is changed. ok henning@, mikeb@
2014-06-23turn of IPv6 for new interfaces by default. this really just means thereHenning Brauer
is no link-local address assigned by default, which - by default, since INET6 is in the GENERIC kernels - makes the machine and services on it reachable. No such thing in IPv4 land. since assigning an inet6 address manually or running rtsol(d) etc resets the NOINET6 flag and causes the link-local to be assigned, this really is a noop for all inet6 users with the exception of those ONLY using the default link-local address. These needs to run "ifconfig <if> inet6 eui64" or put the equivalent in hostname.if. discussed at length with many, ok at least by krw todd benno sthen
2014-06-07g/c unused IFT_L2VLAN, ok reyk bluhmHenning Brauer
the #define stays since it's userland visible and who knows what uses it
2014-05-16Do not put any link-layer address on the per-ifp lists or on the RB-Martin Pieuchot
Tree. Since interfaces only support one link-layer address accessible via the if_sadl member, there's no need to have it elsewhere. This improves various address lookups because the first element of the list, the link- layer address, won't necessarily be discarded. Finally remove the empty netmask associated to every link-layer address. This hack was needed to (ab)use the address & netmask comparison code to do a strcmp() on the interface name embedded in the sdl_data field. ok henning@, claudio@
2014-05-13While Rev 1.285 fixed a RB tree corruption it caused a TAILQ corruptionClaudio Jeker
in the case where the rdomain was not switched. Make sure ifa_add() is only called if ifa_del() was called previously. Hopefully we got all the corruption fixed. With and OK mpi@
2014-05-05Use a custom ifa_rtrequest function for point-to-point interfacesMartin Pieuchot
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@
2014-04-22ifa_ifwithroute() is the only magic place where an AF_LINK sockaddrMartin Pieuchot
can be given to ifa_ifwithnet(). Handle this specific case directly and let ifa_ifwithnet() do only one thing: iterate on all the addresses of all the interfaces in a given routing domain to return the most specific matching address. ok mikeb@
2014-04-20When switching rdomains the sadl needs to be removed and re-added from theClaudio Jeker
RB lookup tree because the rdomain id is part of the lookup key. Without this the RB tree gets corrupted and in the worst case a use after free can happen when the interface is destroyed. Why the sadl addresses are added to the tree in the first place is something to reconsider. OK henning@, mpi@, sthen@
2014-04-19remove the altq enable/attach and disable/detach bitsHenning Brauer
2014-04-10Retire rtinit() an use rt_ifa_add(9) and rt_ifa_del(9) to manageMartin Pieuchot
connected routes to prefixes/hosts. Since the introduction of rt_ifa_addloop(9) and rt_ifa_delloop(9), rtinit() was just a wrapper, so use the underlying functions directly and document them. Inputs from and ok mikeb@, manpage tweaks from jmc@
2014-03-20Do not pull <sys/tree.h> unconditionally in <net/if.h>, only the addressMartin Pieuchot
tree and the 80211 nodes need it. ok henning@, mikeb@
2014-03-19Since in{,6}_ifdetach() take care of removing the IPv4/6 addressesMartin Pieuchot
from the per-ifp list when an interface is destroyed/removed the only address left on the list at this point is the link-layer one. So remove the custom loop and its associated hack for the link-layer address and simply call if_free_sadl(). As a side effect, this should fix any scenario where if_alloc_sadl() is called multiple time since the first link-layer address allocated was never removed from the per-ifp list.
2014-02-04reduce the length of some pool names. ok deraadt guenther mpiTed Unangst
2013-11-28Change the way protocol multicast addresses are linked to an interface.Martin Pieuchot
Instead of linking multicast records to the first configured address of the corresponding protocol, making this address and its position in the global list special, add them to a new list directly linked to the interface descriptor. This new multicast address list is similar to the address list, all its elements contain a protocol agnostic part. This design allows us to be able to join a multicast group without necessarily having a configured address. That means IPv6 multicast kludges are no longer needed. Another benefit is to be able to add and remove an IP address from an interface without worrying about multicast records. That means that the global IPv4 list is no longer needed since the first configured address of an interface is no longer special. This new list might also be extended in the future to contain the link-layer addresses used to configure hardware filters. Tested by sthen@ and weerd@, ok mikeb@
2013-11-27Let's call a rtableid a rtableid.Martin Pieuchot
ok mikeb@, henning@, claudio@
2013-11-19Remove some FDDI/ATM leftovers.Martin Pieuchot
ok mikeb@, henning@, deraadt@, brad@, miod@
2013-11-18Convert trunk(4) to use a detachhook, discussed at b2k13 with many.Martin Pieuchot
While here add a comment explaining detach hooks' order of execution when destroying/detaching an interface.
2013-11-11Replace most of our formating functions to convert IPv4/6 addresses fromMartin Pieuchot
network to presentation format to inet_ntop(). The few remaining functions will be soon converted. ok mikeb@, deraadt@ and moral support from henning@
2013-10-23Remove the number of in_var.h inclusions by moving some functions andMartin Pieuchot
global variables to in.h. ok mikeb@, deraadt@
2013-10-21Enable IPv6 routing domain supportPeter Hessler
Started by claudio@ for IPv4, lots of heavy work by sperreault@ My part started at s2k11, continued at n2k12, g2k12, c2k12 and n2k13. Lots of help and hints from claudio and bluhm OK claudio@, bluhm@
2013-10-20rt_mpath_next() was always called with 0 in the last argument. So drop it.Claudio Jeker
OK henning@
2013-10-19in order to make our life a tad easier and prevent rogue accessesMike Belopuhov
to the routing table from the hardware interrupt context defer the if_link_state_change to the process context. a token (an interface index) is passed to the workq in order to make sure that if the interface would be gone by the time syswq goes around to run the task it would just fall through. ok henning, mpi, deraadt, claudio
2013-10-19Bring back the if_detachhook. We're going to have more users now.Reyk Floeter
ok mpi@ henning@ benno@
2013-10-19When we attach an interface, do not try to reuse the last index toMartin Pieuchot
limit the possible races related to unscheduled task, or anything else, relying on an unique index. I say "limit" here because a race can still occurs if you run out of indexes and jump back to 1. A generation number can be added later to avoid this problem. ok deraadt@, claudio@, krw@, mikeb@, "I can live with it" reyk@
2013-10-17The header file netinet/in_var.h included netinet6/in6_var.h. ThisAlexander Bluhm
created a bunch of useless dependencies. Remove this implicit inclusion and do an explicit #include <netinet6/in6_var.h> when it is needed. OK mpi@ henning@
2013-10-09Introduce in_ifdetach() a function to remove all the IPv4 addressesMartin Pieuchot
of an interface, named after its IPv6 equivalent. Make use of it instead of removing addresses by hand when detaching or destroying an interface. As a bonus, multicast records linked to the just divorced^Wdetached interface are no longer leaked. No objection from the gang, ok mikeb@
2013-09-17Change vlan(4) detach procedure to not use a hook but a list of vlansMartin Pieuchot
on the parent interface. This is similar to what bridge(4), trunk(4) or carp(4) are doing and allows us to get rid of the detachhook. ok reyk@, mikeb@
2013-09-12Revert previous diff to always increment the interface index, tun_switch()Martin Pieuchot
depends on this feature, discussed with claudio@.
2013-08-28When we attach an interface, do not try to reuse the last index to limitMartin Pieuchot
the possible races related to unscheduled task relying on an unique index. I say "limit" here because a race can still occurs if you run out of indexes and jump back to 1. ok krw@, mikeb@
2013-08-28Remove unused argument from *rtrequest()Martin Pieuchot
ok krw@, mikeb@
2013-08-20tedu netnatm and ueagle(4).Martin Pieuchot
ok mikeb@, sthen@, tedu@ (implied), doc bits ok jmc@
2013-06-20Revert previous and unbreak asr, the new include should be protected.Martin Pieuchot
Reported by naddy@
2013-06-20Allocate the various hook head descriptors as part of the ifnetMartin Pieuchot
structure rather than doing various M_WAITOK allocations during the *attach() functions, we always rely on them anyway. ok mikeb@, uebayasi@
2013-06-18Use malloc(M_WAITOK) in if_attach_common(), because this function mustMasao Uebayashi
succeed, and it's always called in sleepable context. OK mikeb@ yasuoka@
2013-04-02Instead of storing the link-level address of every interface in a globalMartin Pieuchot
array indexed by interface numbers, add a new field to the interface descriptor pointing to it. claudio@ and todd@ like it, ok mikeb@
2013-03-29Replace hand-crafted loops in if.c with the FOREACH macro.Alexander Bluhm
OK tedu@ claudio@
2013-03-28code that calls timeout functions should include timeout.hTed Unangst
slipped by on i386, but the zaurus doesn't automagically pick it up. spotted by patrick
2013-03-28no need for a lot of code to include proc.hTed Unangst
2013-03-28Replace some casts to struct in_ifaddr pointer by ifatoia() or NULL.Martin Pieuchot
ok millert@, haesbaert@, bluhm@