summaryrefslogtreecommitdiff
path: root/sys/net
AgeCommit message (Collapse)Author
2015-09-29make the bpf filters a bpf_program instead of an array of bpf_insn.David Gwynne
bpf_program contains a pointer to that same array, but also the number of elements in it. this allows us to know the size when we want to free them. ok deraadt@
2015-09-29add sizes to some of the simpler free callsTheo de Raadt
ok mpi
2015-09-28Use the radix-tree API instead of function pointers.Martin Pieuchot
2015-09-28Factors ou the route hashing code to implement Equal-Cost Multi-PathMartin Pieuchot
for ART. While here sync the two remaining mix() macros. ok chris@, dlg@
2015-09-28Merge gif(4)'s tentacles in a single file.Martin Pieuchot
Tested by <mxb AT alumni DOT chalmers DOT se>. ok dlg@
2015-09-28Remove "if_tp" from the "struct ifnet".Martin Pieuchot
Instead of violating a layer of abstraction by keeping per pseudo-driver informations in "struct ifnet", the port trunk is now passed as a cookie to the interface input handler (ifih). The time of per pseudo-driver hack in the network stack is over! ok mikeb@
2015-09-27Welcome etheranyaddr, cousin of etherbroadcastaddr.Stefan Sperling
Can be used to check if a MAC address is all zeros. Will be used by iwm(4) soon. ok kettenis@
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-27pull the m_freem calls out of hfsc_enqueue by having IFQ_ENQUEUE freeDavid Gwynne
the mbuf in both the hfsc and priq error paths. ok mikeb@ mpi@ claudio@ henning@
2015-09-25Ensure that RTF_LOCAL route entries always stay UP.Martin Pieuchot
Local route entries, being now attached to their corresponding interface, are susceptible to be brought DOWN when a link state change occurs. When this happens locally configured addresses are no longer reachable. So keep the previous (original) behavior by forcing such route entries to always be UP. ok sthen@, claudio@
2015-09-24add a comment explaining how we serialize when switching trunkproto;Mike Belopuhov
requested by mpi@
2015-09-24Avoid a theoretical m_pullup(9) mishandling by delegating the mbufMike Belopuhov
reclaiming to the PDU and marker input routines. m_pullup may return a pointer to the newly allocated mbuf. In this case m_freem is called by the trunk_input, not by the proto specific code and pointer to the mbuf is not passed by reference. Therefore m_freem will either be called on the middle element of the chain (when the m_pullup call succeeds) or on the stale pointer (when it frees the chain in the failure case). Fortunately we should never hit this case as the receive path uniformly uses contiguous chunks of memory. Verified with and ok blambert, ok mpi
2015-09-23Serialize trunk changes with input handler insertion and removal.Mike Belopuhov
This moves around calls to if_ih_insert and if_ih_remove to ensure that we either have completed port initialization or are going to tear the port configuration down and don't want any input processes to get hold of the port. When trunk_port_destroy is called from the ioctl this would wait for all input processes to finish and release their references to be able to disestablish the input handler and ensure full control of the port. When switching trunkproto it is required for the ioctl context to be able to touch all trunk ports and the protocol (tr_psc). The easiest way do this is to disestablish all input handlers (while making sure they all complete) and then reestablish them after the trunk reconfiguration is completed. This avoids getting trunk a separate locking protocol of its own. ok mpi, suggested by and ok dlg
2015-09-23Removes locking macros that we've inherited from NetBSD/FreeBSD.Mike Belopuhov
ok dlg, mpi
2015-09-23Keep track of an active port in the failover trunk to avoid listMike Belopuhov
iterations and additional locking protection in the future. Suggested by and ok mpi
2015-09-23Remove trunk watchdog code since it doesn't do anything usefulMike Belopuhov
and we want to limit the number of different places where we access trunk port pointers. trunk_watchdog should be never called as we don't set up it's if_timer and trunk_port_watchdog just calls the if_watchdog from the underlying interface. It's possible that this is no longer needed due to if_slowtimo/ if_watchdog changes done earlier. ok mpi
2015-09-23Always increment rt_use inside rtalloc(9) instead of doing it in someMartin Pieuchot
specific places. ok claudio@, benno@
2015-09-22Use the radix-tree API instead of function pointers.Martin Pieuchot
ok yasuoka@
2015-09-22When a connected route is deleted, pass the corresponding priority toMartin Pieuchot
rtrequest1(9) otherwise the route will remain attached to a stale ifa. Found by matthieu@
2015-09-21Pass the correct variable to free(9) and while here add the size.Martin Pieuchot
From David Hill, ok sthen@
2015-09-21Set the correct priority for connected routes.Martin Pieuchot
Found by benno@. ok phessler@, claudio@, benno@
2015-09-17instead of leaking rarp packets, break from the switch statementDavid Gwynne
so packets can get enqueued for the arp netisr to process. fixes jsgs nfs mountroot problem.
2015-09-15link_addr() is gonePhilip Guenther
ok mpi@
2015-09-13Fix double rtfree(9) in non-INET6 kernel.Martin Pieuchot
With and ok claudio@
2015-09-13There's no point in abstracting ifp->if_output() as long as pf_test()Martin Pieuchot
needs to see lo0 in the output path. ok claudio@
2015-09-13queue revarps to softnet so we can defer processing to a context withDavid Gwynne
the kernel lock. "do it" claudio@ mpi@
2015-09-13replace hand rolled refcounts and sleep_setup/finish with refcnts andDavid Gwynne
refcnt_finalize.
2015-09-13replace hand rolled reference counting with refcnts.David Gwynne
2015-09-13Run the interface watchdog timer routine as a task such that we have processMark Kettenis
context. ok mpi@, claudio@
2015-09-13reintroduce mpsafe vlan_input.David Gwynne
the last commit was missing SRPL_INITs of the vlan_tagh buckets, which was in a different tree to the one i committed from. apologise to naddy@ again
2015-09-13back out mpsafe vlans while i chase down a panic when operationsDavid Gwynne
are done in a certain order. panic found by naddy@
2015-09-12Call socreate(9) only when we have a destination ip and port.Florian Obser
Call sobind(9) only when we have a source ip. With this we can treat sc->so != NULL as a flag if the interface is in state IFF_RUNNING. Input & OK bluhm@, OK benno@
2015-09-12Now that rtrequest1(9) properly sets RTF_UP for newly added route,Martin Pieuchot
stop passing it in every rt_ifa_add(9) calls. ok claudio@
2015-09-12make vlan_input mpsafe by using srp lists in the vlan tag hash buckets.David Gwynne
ok mpi@ claudio@
2015-09-12Stop overwriting the rt_ifp pointer of RTF_LOCAL routes with lo0ifp.Martin Pieuchot
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@
2015-09-12introduce SRPs to the interface index maps to make if_get() mpsafe.David Gwynne
each index in the ifidx map is now an SRP that points at each interfaces struct ifnet. because the map needs to be grown at run time as interfaces are added to the system, we now use an SRP to gain access to the map. if_get enters the idx map and follows it to the ifnet pointer. if an interface exists at that index it gets adds a refcount before leaving the ifp SRP. modifications to the map pointer and the interface pointers are serialised by the kernel lock. ok mpi@ claudio@
2015-09-12If M_PREPEND() fails, it frees the mbuf. In this case pf_translate_af()Alexander Bluhm
must reset pd->m to avoid a use after free. OK sashan@ mikeb@
2015-09-12Introduce if_input_local() a function to feed local traffic back toMartin Pieuchot
the protocol queues. It basically does what looutput() was doing but having a generic function will allow us to get rid of the loopback hack overwwritting the rt_ifp field of RTF_LOCAL routes. ok mikeb@, dlg@, claudio@
2015-09-12Use rtref(9) in rtable_match() before returning a route entry.Martin Pieuchot
ok bluhm@, claudio@
2015-09-11Now that the port tree is clean, RTF_XRESOLVE disapear.Martin Pieuchot
ok sthen@, claudio@
2015-09-11Stop supporting RTF_XRESOLVE, no daemon is doing resolution theseMartin Pieuchot
days. ok claudio@
2015-09-11Introduce rtref(9) use it in rtable_lookup() before returning a routeMartin Pieuchot
entry. ok bluhm@, claudio@
2015-09-11Apply the link state change hook to RTF_LOCAL routes.Martin Pieuchot
Checking for rt_ifp is currently not enough because RTF_LOCAL routes still use a hack introduced in 1991 and have lo0ifp as rt_ifp pointer. So also check for rt_ifa->ifa_ifp in this case. ok claudio@
2015-09-11rtfree(9) accepts NULL now.Martin Pieuchot
2015-09-11Increment the reference count of CLONING routes before flushing allMartin Pieuchot
their children to make sure they are still alive after rtfree(9)ing rt->rt_parent. Fix a use-after-fruit reported by stsp@ ok claudio@
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-11remove some more trailing whitespaceDavid Gwynne
2015-09-11whitespacesMartin Pieuchot
2015-09-11FOREACH macro is not safe to use when removing elements on a list.Martin Pieuchot
Should fix a NULL dereference reported by guenther@. ok dlg@
2015-09-11iterate over the new half of the if idx map rather than loop on the oneDavid Gwynne
entry forever. this will fix hangs when you have more than 7 interfaces. ok mpi@