summaryrefslogtreecommitdiff
path: root/sys/net/if.c
AgeCommit message (Collapse)Author
2015-03-03Fix a regression introduced when switching from rtsold to the kernel forBrad Smith
router solicitations. Send the router soliciation right away instead of having a 60 second window between enabling SLAAC on the interface and the router solicitation being sent. ok florian@ stsp@ mpi@
2015-02-09tweak the new if_input function so it takes an mbuf_list insteadDavid Gwynne
of a single mbuf. this forces us to batch work between the hardware rx handlers and the stack. this includes a converstion of bge from ether_input to if_input. ok claudio@ pelikan@ mpi@
2015-02-09move the init of the if_input from ether_ifattach to if_attach.David Gwynne
ok mpi@
2015-02-08Introduce if_input() a function to pass packets dequeued from aMartin Pieuchot
recieving ring to the stack. if_input() is at the moment a drop-in replacement for ether_input_mbuf() but will let us stack pseudo-driver in a nice way in order to no longer call ether_input() recursively. ok pelikan@, reyk@, blambert@, henning@
2015-02-05implement SIOCIFAFATTACH and SIOCIFAFDETACH for AF_INETHenning Brauer
SIOCIFAFATTACH is a noop SIOCIFAFDETACH calls in_ifdetach(), thus removing all AF_INET addresses ok phessler theo
2015-01-27Ensure that link-local addresses are correctly configured on loopbackMartin Pieuchot
interfaces. When the kernel automagically configures IPv6 addresses on loopback interfaces, start by assigning a link-local address and then try to assign "::1". Only the first configured loopback interface per rdomain can have the "::1" address. But even if other loopback interfaces failed to get this address, because it is already taken, give them a chance to have a link-local address. While here change in6_ifattach() to return an error value and remove duplicated code. Fix a regression introduced by the NOINET6 flag removal. ok henning@, stsp@, florian@, benno@
2015-01-27remove the second void * argument on tasks.David Gwynne
when workqs were introduced, we provided a second argument so you could pass a thing and some context to work on it in. there were very few things that took advantage of the second argument, so when i introduced pools i suggested removing it. since tasks were meant to replace workqs, it was requested that we keep the second argument to make porting from workqs to tasks easier. now that workqs are gone, i had a look at the use of the second argument again and found only one good use of it (vdsp(4) on sparc64 if you're interested) and a tiny handful of questionable uses. the vast majority of tasks only used a single argument. i have since modified all tasks that used two args to only use one, so now we can remove the second argument. so this is a mechanical change. all tasks only passed NULL as their second argument, so we can just remove it. ok krw@
2015-01-21Delete option COMPAT_43: support for pre-sa_len binaries has been obsoletePhilip Guenther
for a couple decades. Keep the OSIOCGIFCONF ioctl to support COMPAT_LINUX but move the rest of the Linux-specific ioctl() handling into linux_socket.c This lets struct osockaddr finally move from sys/socket.h to protocols/talkd.h ok krw@ deraadt@ mpi@
2015-01-14It is sufficient to protect in6_ifattach() with splsoftnet().Alexander Bluhm
OK mpi@
2015-01-10Correct some comments and merge in6_if_up() into in6_ifattach() toMartin Pieuchot
reflect that IPv6 link-local addresses are no longer automagically configured the first time an interface is brought up. ok henning@, stsp@
2015-01-06Remove the NOINET6 interface flag, a left-over from the times when IPv6Stefan Sperling
was enabled by default. Add AFATTACH/AFDETACH ioctls which enable/disable an address family for an interface (currently used for IPv6 only). New kernel needs new ifconfig for IPv6 configuration (address assignment still works with old ifconfig making this easy to cross over). Committing on behalf of henning@ who is currently lebensmittelvergiftet. ok stsp, benno, mpi
2014-12-19unifdef INET in net code as a precursor to removing the pretend option.Ted Unangst
long live the one true internet. ok henning mikeb
2014-12-18Change the link state change routing message generation to a taskq.Kenneth R Westerback
One less workq to worry about. Tweaks from many. ok mpi@ mikeb@
2014-12-17Use an interface index instead of a pointer for multicast options.Martin Pieuchot
Output interface (port) selection for multicast traffic is not done via route lookups. Instead the output ifp is registred when setsockopt(2) is called with the IP{V6,}_MULTICAST_IF option. But since there is no mechanism to invalidate such pointer stored in a pcb when an interface is destroyed/removed, it might lead your kernel to fault. Prevent a fault upon resume reported by frantisek holop, thanks! ok mikeb@, claudio@
2014-12-08There's no good reason to keep into "struct ifnet" a pointer that's onlyMartin Pieuchot
used by enc(4) devices to attach their routes. ok sthen@, mikeb@
2014-12-01Make every interface with a watchdog register it's own slow timeoutMike Belopuhov
This removes the system wide if_slowtimo timeout and lets every interface with a valid if_watchdog method register it's own in order to get rid of the ifnet loop in the softclock context and avoid further complications with concurrent access to the ifnet list. ok deraadt, input and ok mpi, looked at by claudio
2014-11-23length argument for some free() calls; ok dougTheo de Raadt
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