summaryrefslogtreecommitdiff
path: root/sys/net
AgeCommit message (Collapse)Author
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-14improve style - basically, what my fingers did at Marrakesh airport whenHenning Brauer
waiting for the flight home from m2k14. ok reyk
2014-05-14There is no reason why one needs to have a lo(4) MTU that is arch specific.Claudio Jeker
Also making the size 32k + some extra is not very helpful since we don't do something like zerocopy or sendfile. Just go back to 32768 and we can bikeshed over the right value later on once we have features that benefit from it. OK mpi@
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-09We should use the highest possible priority for routes to local addresses.Martin Pieuchot
Requested by claudio@
2014-05-08Introduce two new route flags: RTF_LOCAL and RTF_BROADCAST.Martin Pieuchot
Nothing use them for the moment, but here is the plan: Since a route lookup is always necessary to output a packet it makes sense to store all the information regarding how the packet should be sent in the routing entry. This will save us some expensive lookups on address lists. But once we have all the information about our addresses in the routing table, we can even use it in the input path with the hope that the number of lookups in the forwarding case can be reduce to one. ok henning@, chris@
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-05-05remove dead code: calling ether_attach which sets if_type to IFT_ETHER,Henning Brauer
just to set it to IFT_L2VLAN right afterwards, just to set if_type to the parent's if_type which can be anything as long as it is IFT_ETHER at config time doesn't make any sense and has zero effect. stop fiddling with if_type alltogether. also remove a question in a comment that has been answered by the last 14 years. from Marrakesh airport, ok reyk
2014-05-02Kill annoying and useless emacs local variable. ok mikeb@Jeremie Courreges-Anglas
The variable would have no effect unless you use hilit19.el from emacs21, and even there the specified value has not been kept up to date with the file growth.
2014-04-29If you plan to write an obfuscated-by-design kernel / userlandMartin Pieuchot
interface, I suggest you have a look at the link-layer sockaddr interface: /* * A Link-Level Sockaddr may specify the interface in one of two * ways: either by means of a system-provided index number (computed * anew and possibly differently on every reboot), or by a human-readable * string such as "il0" (for managerial convenience). [...] */ ifa_ifwithnet() was not only checking for the sdl_index in order to get the corresponding ifp for AF_LINK sockaddr, it was also iterating over all the addresses on your system! But in this case, the `address' field of "struct sockaddr_dl" is an interface name set by link_addr(3). How can this work? Well because the kernel allocates an empty `netmask' field for each interface's lladdr, so that you can abuse a network comparison function to reimplement strcmp(3)... So when the userland does not specify an interface index, try harder to see if it passed an ifp name, but at least be explicit and use ifunit(). Found the hard way by/ok sthen@
2014-04-25Remove rti_ifp from rt_addrinfo, one less ifp pointer, say yay!Martin Pieuchot
This pointer was only needed by rt_getifa() to find an address, so turn it into a local variable. ok henning@, bluhm@
2014-04-24ewps... repair qid assignmentHenning Brauer
2014-04-23Don't attempt to deal with link types supported by no drivers in theJeremie Courreges-Anglas
tree. ok henning@
2014-04-23You don't want to use ifa_ifwithroute(), it exists for to the routingMartin Pieuchot
crazyness only.
2014-04-22Remove some altq tentacles.Martin Pieuchot
ok pelikan@, henning@
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-22NULL is cooler than 0 when pointers are concernedHenning Brauer
ok gcc & md5 (aka no binary change)
2014-04-22we used to handle the vlan tag etc insertion very very very late,Henning Brauer
on al already ass embed ethernet frame, which meant: -copy (most of) the existing ethernet header into a ether_vlan_header on the stack -fill the extra fields in ether_vlan_header -set the ether type -m_adj() to make room for the extra space ether_vlan_header needs -m_copyback the ether_vlan_header into the mbuf that involves moving data around, which isn't all that cheap. cleaner & easier to have ether_output prepend the ether_vlan_header instead of the regular ethernet header, which makes the vlan tagging essentially free in most cases. help & ok reyk, naddy; waste of time bikeshedding tech@
2014-04-21g/c hdrcmplt var, we can just set the esrc ptr earlier and re-set it inHenning Brauer
the pseudo_AF_HDRCMPLT case, ok claudio reyk
2014-04-21__inline -> inlineHenning Brauer
2014-04-21ip_output() using varargs always struck me as bizarre, esp since it's onlyHenning Brauer
ever used to pass on uint32 (for ipsec). stop that madness and just pass the uint32, 0 in all cases but the two that pass the ipsec flowinfo. ok deraadt reyk guenther
2014-04-21we'll do fine without casting NULL to struct foo * / void *Henning Brauer
ok gcc & md5 (alas, no binary change)
2014-04-20factor our ether_addheader for readability; there's more to come thereHenning Brauer
ok claudio reyk
2014-04-20ether_output: instead of assembling the ethernet header and then callingHenning Brauer
carp_rewrite_lladdr to overwrite the src lladdr, get the intended src lladdr before assembling the ethernet header. carp_rewrite_lladdr -> carp_get_srclladdr ok reyk claudio
2014-04-20ether_output: instead of using an esrc buffer in which we copy the intendedHenning Brauer
src lladdr just to copy it from the esrc buffer into the ethernet header a few lines later, use an esrc pointer to figure out where to copy the src lladdr from. ok claudio reyk
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-19disgusting altq compat hack goes awayHenning Brauer
2014-04-19now that if_snd is a proper ifqueue, this cast diesHenning Brauer
2014-04-19ifnet's if_snd becomes a regular ifqueue instead of ifaltq, the need toHenning Brauer
keep ifqueue and ifaltq in sync is gone and thus the comment obsolete, and finally there is no more need to include if_altq.h either
2014-04-19minus altq tentacles, plus missing IF_DROP here as wellHenning Brauer
2014-04-19kill altq bits here as wellHenning Brauer
2014-04-19shrink pf by 445 lines.Henning Brauer
while there, get rid of the altq ioctls and assciated now obsolete code
2014-04-19remove the altq enable/attach and disable/detach bitsHenning Brauer
2014-04-19remove very questionable altq "optimization" - claudio and I can'tHenning Brauer
convince ourselves that that was right to begin with. anyway, begone.
2014-04-19all I wanted to do is removing the altq special casing, but then it turnedHenning Brauer
out the entire codepath is unreachable. glad I'm not our ppp maintainer, he has work to do. kill that unreachable code, with & ok claudio
2014-04-19remove altq special casing.Henning Brauer
big WTF regarding the fastq use there while verifying w/ claudio, but that's for the ppp maintainer and unrelated
2014-04-19the altq versions of the IFQ_* macros can finally go. chances of thisHenning Brauer
file becoming readable increase.
2014-04-19 /*Henning Brauer
* altq for loop is just for debugging. * only used when called for loop interface (not for * a simplex interface). */ bye bye!
2014-04-18There is no need to initialize globals to 0.Claudio Jeker
2014-04-18reaching into altq outside #ifdef ALTQ is bad, mmkay? ok claudioHenning Brauer
2014-04-18pf_send_tcp: ask the stack to do the cksum instead of doing it manuallyHenning Brauer
ok benno lteo naddy (back in january)
2014-04-14"struct pkthdr" holds a routing table ID, not a routing domain one.Martin Pieuchot
Avoid the confusion by using an appropriate name for the variable. Note that since routing domain IDs are a subset of the set of routing table IDs, the following idiom is correct: rtableid = rdomain But to get the routing domain ID corresponding to a given routing table ID, you must call rtable_l2(9). claudio@ likes it, ok mikeb@
2014-04-11Interfaces are associated to rdomains, make it clear by renamingMartin Pieuchot
`sc_rtableid' into `sc_rdomain'. No functional change. ok reyk@
2014-04-11Fix tree breakage.Kenneth R Westerback
With r1.160 route.c needs #include <net/if_dl.h> because bsd.rd and friends don't pull in netmpls/mpls.h which is how bsd[.mp] get it. ok deraadt@ guenther@
2014-04-10Don't use ifa_ifwithnet() with obvious sockaddr_dl argument. ThisMartin Pieuchot
function should not deal with link-layer addresses and here there's no reason to do it. ok mikeb@
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-04-08Revert 1.27 and 1.28, but make sure to initialize the pxd_unit field correctlyMiod Vallat
in pppxopen(). ok dlg@ yasuoka@
2014-04-05Be sure to release rwlock when returning error in pppxclose().Miod Vallat
2014-04-04Paul B. Henson discovered it was possible to hit a kernelJonathan Gray
panic with pppx when using npppd with multiple pppx devices. This is triggered when pppxclose() is called on device that hasn't been opened causing a NULL dereference and panic. Avoid this by returning ENXIO if the device has not been opened. ok yasuoka@
2014-04-03Introduce rt_ifa_{add,del}loop() to replace in6_{add,rem}loop().Martin Pieuchot
Move these functions to a more generic place and make them reuse existing code, they'll be soon used in IPv4 too. Tested by André Lucas, Vigdis and sthen@, thanks! ok sthen@