summaryrefslogtreecommitdiff
path: root/sys/net/if.c
AgeCommit message (Collapse)Author
2009-07-09unsigned -> unsigned intBret Lambert
ok claudio@, henning@
2009-06-06when xflags got changed, tell the userland by routing socketsRainer Giedat
ok henning@
2009-06-05Add missing #ifdef INET6 ... #endifAlexander Hall
Makes non-IPv6 kernels build again blame and ok henning@
2009-06-05Initial support for routing domains. This allows to bind interfaces toClaudio Jeker
alternate routing table and separate them from other interfaces in distinct routing tables. The same network can now be used in any doamin at the same time without causing conflicts. This diff is mostly mechanical and adds the necessary rdomain checks accross net and netinet. L2 and IPv4 are mostly covered still missing pf and IPv6. input and tested by jsg@, phessler@ and reyk@. "put it in" deraadt@
2009-06-04allow IPvShit to be turned off completely per-interface.Henning Brauer
ifconfig em0 -inet6 deletes all v6 addresses including link-local and prevents new ones from being added. ifconfig em0 inet6 <addr> re-enables v6, brings the link local back and adds optional <addr> ok theo reyk
2009-06-01There is no need to use a variable just for sizeof(). Garbage collect ifa.Claudio Jeker
No binary change.
2009-05-31Consolidate common code for interface attachment into single functionBret Lambert
to save some space in the kernel. Although there are deeper issues with interface attachment, this diff was not meant to address those, just to shave some space ;) ok henning@, claudio@
2009-05-31Reenable interface state tracking now that I found and fixed the cause ofClaudio Jeker
the rtfree panic seen by some people.
2009-03-15Introduce splsoftassert(), similar to splassert() but for soft interruptMiod Vallat
levels. This will allow for platforms where soft interrupt levels do not map to real hardware interrupt levels to have soft ipl values overlapping hard ipl values without breaking spl asserts.
2009-02-24Disable rt_if_track() for now. This causes the rtfree panic seen in PR6043Claudio Jeker
and I'm currently unable to find the cause of this. Time is running out so workaround it for now. OK deraadt.
2009-01-31No need to invent another _offset, just use the one from param.h.Alexander Yurchenko
As a bonus it eliminates casting from pointer to int. ok miod@ tedu@ millert@
2009-01-09fix egress group matching for IPv6; ok claudio@David Krause
2008-12-12Introduce a if_priority that will be added to RTP_STATIC when routes areClaudio Jeker
added without an expilict priority. This allows to specify less prefered interfaces that will only take over if the primary interface loses link. OK deraadt@
2008-12-11export per-interface mbuf cluster pool use statistics out to userlandTheo de Raadt
inside if_data, so that netstat(1) and systat(1) can see them ok dlg
2008-11-26Avoid network livelock.Theo de Raadt
Use a 1 tick timeout() to determine if the kernel even manages to get below softclock (from an old diff by mpf). If our timeout comes late, reduce the high water marks (to half) for all network interfaces, thus starving them of future packet allocations for their RX rings. For a few ticks longer, also block the high water marks from rising even if RX ring empty conditions would prod us to do so. Cards may start dropping some packets off the end of their smaller RX rings, but we were not able to do the work required in any case. With less interrupt time and mbuf movement, the system finds time to make progress at the network queues. Userland even gets to run. A x40 tuned to 600MHz shows no real reduction in performance. But a soekris has a working console now. ok dlg claudio, and art liked it too
2008-11-26provide m_clsetlwm, an interface for an interface to raise its lowDavid Gwynne
watermark for mbuf cluster allocations. this is necessary for things like bge which cannot cope with less than a certain number of pkts on the ring. ok deraadt@
2008-11-25expect if_flags to have IFF_RUNNING rather than IFF_UP before modifyingDavid Gwynne
the per ifp cluster allocator. should prevent the hwm being raised innapropriately when a driver fills its rx ring for the first time.
2008-11-25art says he doesnt suck anymore, so enable the really big clusterDavid Gwynne
allocators again.
2008-11-25Factor increases are not needed, +1 appears to work as well.Theo de Raadt
ok dlg
2008-11-25m_cluncount() needs to walk the mbuf chain to correctly uncount all clustersClaudio Jeker
but don't do that in m_free() as that will cause a double loop behaviour when called via m_freem(). OK dlg@, deraadt@
2008-11-24add several backend pools to allocate mbufs clusters of various sizes outDavid Gwynne
of. currently limited to MCLBYTES (2048 bytes) and 4096 bytes until pools can allocate objects of sizes greater than PAGESIZE. this allows drivers to ask for "jumbo" packets to fill rx rings with. the second half of this change is per interface mbuf cluster allocator statistics. drivers can use the new interface (MCLGETI), which will use these stats to selectively fail allocations based on demand for mbufs. if the driver isnt rapidly consuming rx mbufs, we dont allow it to allocate many to put on its rx ring. drivers require modifications to take advantage of both the new allocation semantic and large clusters. this was written and developed with deraadt@ over the last two days ok deraadt@ claudio@
2008-11-24Implement link-state tracking on the routing table. Routes to interfacesClaudio Jeker
which are considered down will no be marked ~RTF_UP and so multipath routing will start to work as expected and not pump 50% of the traffic to nirvana. Most of the magic happens in rn_mpath_reprio() which fiddles with the routing table internals. The rest is more straight forward. get it in deraadt@
2008-11-21Change rn_mpath_next() to be able to walk over the full multipath listClaudio Jeker
not only over routes of the same prio. This makes it possible to modify rt_mpath_matchgate() so that if only gateway is specified without a specific priority it will scan the full list and not only the first routes. This is also needed for upcoming link state tracking.
2008-11-10Clear ifindex2ifnet[] in if_detach() this is needed because link localClaudio Jeker
addressing in IPv6 likes to do ifp = ifindex2ifnet[ifindex] without properly checking if the ifindex is valid. As a side-effect this solves parts of PR 5981. Debugged by jsing@. OK jsing@, deraadt@
2008-06-12Fix the egress group matching for IPv4. There are to ways to define a /0Claudio Jeker
network mask. For some reasons some parts set sa->sa_len to 0 to specify a /0 netmask so check fot that too. tested by david@ OK henning@
2008-06-08The default route is 0.0.0.0/0 so it is necessary to check the mask as well.Claudio Jeker
OK henning@
2008-05-23Deal with the situation when TCP nfs mounts timeout and processesThordur I. Bjornsson
get hung in nfs_reconnect() because they do not have the proper privilages to bind to a socket, by adding a struct proc * argument to sobind() (and the *_usrreq() routines, and finally in{6}_pcbbind) and do the sobind() with proc0 in nfs_connect. OK markus@, blambert@. "go ahead" deraadt@. Fixes an issue reported by bernd@ (Tested by bernd@). Fixes PR5135 too.
2008-05-07Prevent virtual interfaces from adding to the random pool.Marco Pfatschbacher
Also move the sampling into ether_input() where it can happen at the interrupt and not within splnet() processing, which might be less random. Discussed with mickey. OK markus@, mcbride@
2008-04-10introduce mitigation for the calling of an interfaces start routine.David Gwynne
decent drivers prefer to have a lot of packets on the send queue so they can queue a lot of them up on the tx ring and then post them all in one big chunk. unfortunately our stack queues one packet onto the send queue and then calls the start handler immediately. this mitigates against that queue, send, queue, send behaviour by trying to call the start routine only once per softnet. now its queue, queue, queue, send. this is the result of a lot of discussion with claudio@ tested by many.
2008-01-05make sure all callers of rtlabel_id2name check for a null return value.Henning Brauer
all the original ones did, the recently added ones for labels per interface didn't. no cookie for reyk ;( ok deraadt
2008-01-05rtlabel_id2name() can return NULL if there is no route label..Theo de Raadt
from chris@nmedia.net
2007-09-15malloc sweep:Henning Brauer
-remove useless casts -MALLOC/FREE -> malloc/free -use M_ZERO where appropriate instead of seperate bzero feedback & ok krw, hshoexer
2007-07-06btintrq has been removed from bt_input.c, don't reference it here.Christian Weisgerber
Makes bluetooth build again. ok uwe@
2007-07-04Fix a use after free crash in in_delmulti(). If a interface is detachedClaudio Jeker
before it is removed from the multicast group in_delmulti() will try to access the no longer available ifp. We invalidate the ifa_ifp back pointer in the ifa in if_detach() now and use the ifa_ifp in in_delmulti() instead of the internal inm_ifp. By doing it this way we know if the interface was removed. This fixes a kernel panic triggered by ospfd and gif(4) tunnels. looks good henning@ reyk@
2007-06-17add back missing bcopy & break, got lost when removing arcnet.Henning Brauer
spotted by Mike Belopuhov <mkb@crypt.org.ru>
2007-06-14Add a new "rtlabel" option to ifconfig. It allows to specify a route labelReyk Floeter
which will be used for new interface routes. For example, ifconfig em0 10.1.1.0 255.255.255.0 rtlabel RING_1 will set the new interface address and attach the route label RING_1 to the corresponding route. manpage bits from jmc@ ok claudio@ henning@
2007-06-08kill arcnet leftovers, some pt out by Mike Belopuhov <mkb@crypt.org.ru>,Henning Brauer
some I found afterwards, ok dlg
2007-06-06remove remaining IPX hooks. all inside #ifdef IPX, so no actual changeHenning Brauer
2007-05-29Spaces, no binary changes.Claudio Jeker
2007-05-28Only call add_net_randomness() once per interrupt instead of once per ↵Ryan Thomas McBride
packet. If multiple packets come in on a single interrupt the times mixed into the randomness pool will be identical or predictably close anyways, and nanotime() is expensive. ok toby jason miod claudio
2007-03-25Synchronise carp advertisements on group demotion.Marco Pfatschbacher
This reduces group failover time to a few milliseconds. Diff from Nathanael. OK henning@
2007-03-18Add IP load balancing support for carp(4).Marco Pfatschbacher
This provides a similar functionality as ARP balancing, but also works for traffic that comes across routers. IPv6 is supported as well. The configuration scheme will change as soon we have sth better. Also add support for changing the MAC address on carp(4) interfaces. (code from mcbride) Tested by pyr@ and reyk@ OK mcbride@
2007-02-14Consistently spell FALLTHROUGH to appease lint.Jonathan Gray
ok kettenis@ cloder@ tom@ henning@
2007-02-12Don't pass random flags to SIOIFFLAGS when changing the lladdr.Marco Pfatschbacher
OK tedu@
2006-12-03Add Rapid Spanning Tree Protocol support (802.1d-2004) based on workReyk Floeter
by Andrew Thompson (thompsa@freebsd.org). The local changes include adoption to our bridge code, reduced stack usage and many other bits. If stp is enabled, RSTP will now be used by default. Thanks for help from Andrew. This code has been in snaps for while now, commit encouraged by deraadt@
2006-11-24Check the reference count for interface addresses when detachingCan Erkin Acar
an interface. Fixes a double free panic. ok claudio@, looks fine henning@
2006-11-16introduce if_creategroup() to create an empty interface group.Henning Brauer
code factored out from if_addgroup(), previously a group always had to have members. ok mpf mcbride
2006-10-21the create and destroy functions for clonable interfaces return 0 onHenning Brauer
success, not -1 on error. fix check in 2 cases. ok mpf mcbride
2006-08-29allow the carp demotion counter to be changed by arbitary values as longHenning Brauer
as the resulting demotion counter value is in range. previously, we only allowed +/- 1. ok mpf mcbride deraadt
2006-07-18typoMichael Shalayeff