summaryrefslogtreecommitdiff
path: root/sys/net/if.h
AgeCommit message (Collapse)Author
2016-03-02provide generic ioctls for managing an interfaces parentDavid Gwynne
in the future this will subsume the individual vlandev, carpdev, pppoedev, foodev options for things like vlan, carp, pppoe, etc. inspired by vnetid ok mpi@ jmatthew@
2015-12-05avoid an ugly wrap in a commentTheo de Raadt
2015-12-03rework if_start to allow nics to provide an mpsafe start routine.David Gwynne
existing start routines will still be called under the kernel lock and at IPL_NET. mpsafe start routines will be serialised so only one instance of each interfaces function will be running in the kernel at any point in time. this guarantees packets will be dequeued in order, and the start routines dont have to lock against themselves because if_start does it for them. the code to do that is based on the scsi runqueue code. this also provides an if_start_barrier() function that should wait until any currently running instances of if_start have finished. a driver can opt in to the mpsafe if_start call by doing the following: 1. setting ifp->if_xflags = IFXF_MPSAFE 2. only calling if_start() instead of its own start routine 3. clearing IFF_RUNNING before calling if_start_barrier() on its way down 4. only using IFQ_DEQUEUE (not ifq_deq_begin/commit/rollback) to simplify the implementation the tx mitigation code has been removed. tested by several ok mpi@ jmatthew@
2015-11-20Keep if_ref() private, if_get() is what you want to use before if_put().Martin Pieuchot
The thread detaching an interface will sleep until all references to this interface have been released. So we decided to only keep references for a short period of time. Keeping if_ref() private will hopefully help preserve this goal as long as it makes sense. Calling if_get()/if_put() in the same function also allows us to make use of static analysis tools (thanks jsg@!) to catch our errors. ok dlg@
2015-10-24Add pair(4), a vether-based virtual Ethernet driver to interconnectReyk Floeter
rdomains and bridges on the local system. This can be used to route through local rdomains, to create L2 devices (like trunks) between them, and many other things. Discussed with many, with input from mpi@ OK sthen@ phessler@ yasuoka@ mikeb@
2015-10-23Introduce a new sysctl NET_RT_IFNAMES that returns only ifnames to ifindexClaudio Jeker
mappings. This will be used by if_nameindex(3), if_nametoindex(3) and if_indextoname(3) soon to fix the issues in pledge because of inet6 link local addressing. OK mpi@ benno@ deraadt@ The libc version will follow soon so better start updating your kernels
2015-10-23tweak the vnetid so it can be optional and therefore cleared/deleted.David Gwynne
the abstract vnetid is promoted to a uin32_t, and adds a SIOCDVNETID ioctl so it can be cleared. this is all because i set an assignment on implementing a virtual network interface and the students got confused when vnetid 0 didnt show up in ifconfig output. the vnetid in the vxlan(4) protocol is optional, but the current code confuses 0 with no vnetid being set. this makes it clear. ok reyk@ who also simplified my diff
2015-10-05Add ifi_oqdrops and its alias to struct if_data.Masao Uebayashi
Necessary bumps in Ports will be handled by sthen@. OK mpi@ dlg@
2015-09-27Add if_setlladdr(), factored out from ifioctl(). Will be used by iwm(4) soon.Stefan Sperling
With suggestions from tedu@ and guenther@ ok kettenis@
2015-09-11Make room for media types of the future. Extend the ifmedia word to 64 bits.Stefan Sperling
This changes numbers of the SIOCSIFMEDIA and SIOCGIFMEDIA ioctls and grows struct ifmediareq. Old ifconfig and dhclient binaries can still assign addresses, however the 'media' subcommand stops working. Recompiling ifconfig and dhclient with new headers before a reboot should not be necessary unless in very special circumstances where non-default media settings must be used to get link and console access is not available. There may be some MD fallout but that will be cleared up later. ok deraadt miod with help and suggestions from several sharks attending l2k15
2015-09-09introduce reference counts for interfaces (ie, struct ifnet *ifp).David Gwynne
if_get can get a reference to an ifp, but it never releases that reference. this provides an if_put function that can be used to decrement the refcount. we cannot come up with a scheme for letting the network stack run on one (or many) cpus while ioctls are pulling interfaces down on another cpu without refcounts for the interfaces. if_put is going in now so we can go through the stack and put the necessary calls to it in, and then we'll backfill this implementation to actually check the refcounts when the interface detaches. ok mpi@ mikeb@ claudio@
2015-08-30Use a global table for domains instead of building a list at run time.Martin Pieuchot
As a side effect there's no need to run if_attachdomain() after the list of domains has been built. ok claudio@, reyk@
2015-06-07Introduce unhandled_af() for cases where code conditionally doesJonathan Gray
something based on an address family and later assumes one of the paths was taken. This was initially just calls to panic until guenther suggested a function to reduce the amount of strings needed. This reduces the amount of noise with static analysers and acts as a sanity check. ok guenther@ bluhm@
2015-05-18Move the rdomain from struct ifnet into struct if_data. This way itReyk Floeter
will be exported to userland with the existing sysctl, getifaddrs() and routing socket (if_msghdr.ifm_data) interfaces that expose if_data. All programs and daemons - Apps - that call the SIOCGIFRDOMAIN ioctl in a getifaddrs() loop or after receiving an interface message on the routing socket can now remove the pointless additional ioctl. In base, that could be: dhclient, isakmpd, dhcpd, dhcrelay, ntpd, ospfd, ripd, ifconfig. No ABI breakage because it uses a previously unused pad field in if_data. OK mpi@ deraadt@
2015-04-10Run detach hook and similar before cleaning up any other resource whenMartin Pieuchot
an interface is destroyed/removed. This way we can ensure pseudo-driver changes done after attaching an interface are undone before detaching it. Note: it is safe to call if_deactivate() multiple times as the interface should not have any attached pseudo-interface after the first call. ok deraadt@, dlg@
2015-03-18remove the congestion handling from struct ifqueue.David Gwynne
its only used for the ip and ip6 network stack input queues, so it seems unfair that every instance of ifqueue has to carry a pointer around for this specific use case. this moves the congestion marker to a kernel global. if we detect that we're congested, we assume the whole system is busy and punish all input queues. marking a system as congested is done by setting the global to the current value of ticks. as the system moves away from that value, it moves away from being congested until the comparison fails. written at s2k15 ok henning@ beck@ bluhm@ claudio@
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-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-05Explicitly include <net/if_var.h> instead of pulling it in <net/if.h>.Martin Pieuchot
ok mikeb@, krw@, bluhm@, tedu@
2014-07-14now that receive ring accounting has been pulled out of the mbuf layer,David Gwynne
we can pull the space the mbuf layer used to do per interface accounting out of struct if_data. saves a hundredish bytes on every interface. ok deraadt@ claudio@
2014-07-11introduce the IFXF_AUTOCONF6 interface flag which controls wether weHenning Brauer
accept rtadvs on that interface. the global net.inet6.ip6.accept_rtadv sysctl just doesn't cut it, even tho the spec wants that - but in their little absurd world, a host just has one interface by definition anyway... the sysctlgoes away. lots of head scratching, brain cell elemination etc from bluhm benno stsp florian, excitement from simon and todd, ok bluhm stsp benno florian
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-13Instead of updating all the cluster allocation water marks of all theMartin Pieuchot
interfaces when the kernel is livelocked, only do it for the current pool and defer the other updates. This allow us to get rid of an interface list iteration in a critical path. Ridding the libc crank since this change introduce an ABI break. ok claudio@
2013-11-21split kernel parts of the if.h into a separate header file if_var.hMike Belopuhov
which allows us to modify ifnet structure in a relatively safe way; discussed with deraadt, ok mpi
2013-11-09ticks is compared against mcl_grown to see if time has elapsed sinceDavid Gwynne
the rx ring was last allowed to grow and then assigned to it. it is erroneous to do this because mcl_grown is a u_int and ticks is an int. this makes mcl_grown an int, and follows the idiom in kern_timeout.c of going "thing - ticks < diff", which better copes with ticks wrapping around and being used to calculate relative intervals. ok pirofti@ guenther@
2013-11-01keep net/hfsc.h away from userspace, except in pfctlpelikan
tested by naddy, ok deraadt
2013-10-21nuke comment. How soon is now?Sebastian Benoit
"do it" deraadt@
2013-10-19Bring back the if_detachhook. We're going to have more users now.Reyk Floeter
ok mpi@ henning@ benno@
2013-10-13Import vxlan(4), the virtual extensible local area network tunnelReyk Floeter
interface. VXLAN is a UDP-based tunnelling protocol for overlaying virtualized layer 2 networks over layer 3 networks. The implementation is based on draft-mahalingam-dutt-dcops-vxlan-04 and has been tested with other implementations in the wild. put it in deraadt@
2013-10-12new bandwidth shaping subsystem, kernel sideHenning Brauer
uses hfsc behind the scenes; altq stays in parallel for a migration phase. if.h even more messy for the transition, but eventuelly it should become readable... looked over & tested by many, ok phessler sthen
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-08-28Remove unused argument from *rtrequest()Martin Pieuchot
ok krw@, mikeb@
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-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-26Remove various read-only *maxlen variables and use IFQ_MAXLEN directly.Martin Pieuchot
ok beck@, mikeb@
2013-03-20Introduce if_get() to retrieve an interface descriptor pointer givenMartin Pieuchot
an interface index and replace all the redondant checks and accesses to a global array by a call to this function. With imputs from and ok bluhm@, mikeb@
2013-03-07Remove unused ifa_ifwithaf() function.Martin Pieuchot
ok mikeb@, miod@
2013-03-07Remove the IFAFREE() macro, the ifafree() function it was calling alreadyMartin Pieuchot
check for the reference counter. ok mikeb@, miod@, pelikan@, kettenis@, krw@
2012-11-23Add SIOCGIFHARDMTU to allow retrieving the driver's maximum supported MTUStuart Henderson
looks fine reyk@ ok mikeb@
2012-11-11align ifaliasreq.ifra_addr similar to the way that ifreq is fixed --Theo de Raadt
a gruesome union, to block the compiler from placing the struct incorrectly aligned on stack frames ok guenther
2012-10-05Point an interface directly to its bridgeport configuration, insteadCamiel Dobbelaar
of to the bridge itself. This is ok, since an interface can only be part of one bridge, and the parent bridge is easy to find from the bridgeport. This way we can get rid of a lot of list walks, improving performance and shortening the code. ok henning stsp sthen reyk
2012-09-19defina an IFCAP_CSUM_MASK, covering IFCAP_CSUM_*, and use it in if_vlan.cHenning Brauer
to replace the list of them. this actually makes vlan inherit the IPv6 CSUM flags from it's parent, that had been commented out since this code was committed back in 2001. ok benno mpf
2012-09-10Bring into compliance with POSIX, exposing just the specified bits.Philip Guenthe
Requested by jasper@, ok kettenis@
2012-08-21Reverse the name and meaning of the IFXF_INET6_PRIVACY interfaceAlexander Bluhm
flag. It is now called IFXF_INET6_NOPRIVACY. So IPv6 privacy addresses are on by default without resetting the flag during ifconfig down/up. OK stsp@, sperreault@ (who wrote the same diff)
2011-12-02Kill unused IFCAP_IPSEC and IFCAP_IPCOMP.Christiano F. Haesbaert
ok claudio@ henning@ mikeb@
2011-11-02Expose if_capabilities to userland so that ifconfig can display theChristiano F. Haesbaert
device hardware features. Tune ifconfig to show them with 'hwfeatures' argument. While here, kill some old unused capabilities and respect 80 columns in brconfig.h. ok mcbride@, henning@, mpf@.
2011-10-07rename some vars and functionsHenning Brauer
unfortunately altq is one giant namespace violation. rename just those that conflict with new stuff for now only to be found on my laptop. reduce pain, the diff is huge already. ok ryan
2011-07-08new priority queueing implementation, extremely low overhead, thus fast.Henning Brauer
unconditional, always on. 8 priority levels, as every better switch, the vlan header etc etc. ok ryan mpf sthen, pea tested as well
2011-07-07provide IF_LEN and IFQ_LEN to access ifq_len on an ifqueue, ryan okHenning Brauer