summaryrefslogtreecommitdiff
path: root/sys/net/rtsock.c
AgeCommit message (Collapse)Author
2014-08-12route_cb is internal to rtsock.cMartin Pieuchot
2014-08-11Put back the checks about RTF_LOCAL routes now that userland tools areMartin Pieuchot
aware of them. Original commit message was: Reserve the highest route priority for kernel-managed routes and prevent userland from playing with the local and broadcast flags. ok claudio@
2014-07-29Revert the checks about RTF_LOCAL routes.Martin Pieuchot
Even if in the end we would like to be more strict about what userland can do with kernel-managed route entries, most of the tools out there are not yet ready for this. Since RTF_LOCAL routes are for the moment just like RTF_LLINFO routes without expire timer, allow userland tools to remove/modify them. In case they are missing, the good old cloning mechanism will recreate what you need. bluhm@ and deraadt@ agree.
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-08decouple struct uvmexp into a new file, so that uvm_extern.h and sysctl.hTheo de Raadt
don't need to be married. ok guenther miod beck jsing kettenis
2014-05-31Unbreak RTM_CHANGE. Unlike RTM_LOCK or RTM_GET it is OK to pass in aClaudio Jeker
new gateway for RTM_CHANGE if the route is not a multipath route. Fixes issues found by benno@, OK benno@
2014-05-27Big refactoring of the radix code (mainly rn_addroute but also partClaudio Jeker
of rn_delete was changed). The mpath code gets a much better rn_mpath_next() function that allows looping through the dupedkey list based on prio, any or only active routes. This solves the issues seen with failed deletes of down routes. Commit this now so that it gets tested. Both sthen@ and blambert@ agree.
2014-05-27Reserve the highest route priority for kernel-managed routes and preventMartin Pieuchot
userland from playing with the local and broadcast flags. ok claudio@
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-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-03-18Rename rt_gettable() into rtable_get(), swap its arguments to beMartin Pieuchot
coherent with the existing rtable_* functions and document it. While here fix some other manpage glitches pointed out by jmc@.
2014-03-17Remove pre-rt_getifa() code to find the address descriptor (ifa) relatedMartin Pieuchot
to a route entry, no need to do the work twice. This chunk should have been deleted when post-4.4BSD changes from BSD/OS 4.2 were merged more than 10 years ago. While here properly indent the following block. tested by chris@, ok krw@
2014-03-12RTAX_IFP points to the "struct sockaddr_dl" corresponding to theMartin Pieuchot
link-layer address of an interface. This ugly structure is used to export the interface's name and index, not only the link-layer address as its name might suggest. So instead reaching this descriptor by forcing and abusing the position of the link-layer "struct ifaddr" in the per-interface list, use the if_sadl pointer directly. ok mikeb@, henning@
2014-02-13Replace hand crafted routing label code with the rtlabel_id2sa()Alexander Bluhm
function call. Name sockaddr_rtlabel variable sa_rl everywhere. OK mpi@ claudio@
2014-02-12Add rtlabel to rt_newaddrmsg, From: Florian Riehm <mail at friehm dot de>Henning Brauer
ok bluhm claudio
2014-01-22Remove genmask support from the kernel. rtmsgs with RTA_GENMASK set willClaudio Jeker
now cause a EINVAL. The RTA_GENMASK and RTAX_GENMASK defines are kept for compatibility reasons. OK benno@ and agreed by dlg@
2014-01-21Substitute crazy defines and convert some 0 to NULL.Martin Pieuchot
ok claudio@, henning@
2014-01-20Get rid of the old routing message version 4 transition code beforeAlexander Bluhm
5.5 release. OK claudio@
2014-01-19RTF_MPATH is a flag userland needs to be able to pass in since it is usedClaudio Jeker
to set multipath routes. So since more then 2 month multipath was broken.
2014-01-10replace the rest of the obsolete radix macrosTed Unangst
sprinkle 0 -> NULL where obvious ok millert mpi
2014-01-09replace Bcopy macro with memmove and memcpy. ok mpiTed Unangst
2013-11-01The old routing messages compatibility code did not work on strictAlexander Bluhm
alignment architectures. Use m_copydata() instead of mtod(). OK deraadt@
2013-10-31Convert the route expire timestamp in kernel and routing messageAlexander Bluhm
to 64 bit. Increase the routing message version from 4 to 5. Add a small compatibility layer that allows to set routes with old user land and new kernel. Old kernel with new user land does not work. The compatibility layer ist not perfect, but it allows to configure addresses with old ifconfig and new kernel. Route get also works in this setup. dhclient hangs as messages for interface address changes with old version are not generated. OK claudio@
2013-10-20rt_mpath_next() was always called with 0 in the last argument. So drop it.Claudio Jeker
OK henning@
2013-10-20Make sure that the RTM_DESYNC message is not filtered out. Also ensure thatClaudio Jeker
rtm_flags and rtm_fmask do not change flags that are kernel specific (e.g. RTF_CLONED). OK henning@
2013-08-28Remove unused argument from *rtrequest()Martin Pieuchot
ok krw@, mikeb@
2013-05-17Do not attempt to delete the undeletable RNF_ROOT route.Kenneth R Westerback
Discovered & fix tested by Peter J Philip. ok claudio@ blambert@
2013-03-15change LIST_END to literal NULL for clarity.Ted Unangst
ok claudio mpi
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-09-20Fix a pair of typos in comments.Bret Lambert
ok claudio@
2012-09-19Make rt_lookup return a pointer to an rtentry struct instead ofBret Lambert
to a radix_node struct. The radix tree pushdown continues. ok claudio@
2012-09-19More radix internals pushdown; place rn_mpath_next, which accepts andBret Lambert
returns radix_node pointers, inside a new rt_mpath_next, which accepts and returns rtentry pointers, and start using that instead. ok claudio@
2012-09-17Whitespace change (excess indentation).Bret Lambert
ok claudio@
2012-03-28Use p_p->ps_pid as pid in the route header instead of the thread pid. GiveClaudio Jeker
userland a chance to compare the value against getpid(). This unbreaks transmission for me. OK deraadt@, guenther@
2011-04-07Do not use NULL in integer comparisons. No functional change.Miod Vallat
ok matthew@ tedu@, also eyeballed by at least krw@ oga@ kettenis@ jsg@
2011-04-04m_copyback is no longer a void function, so start using its error returnBret Lambert
instead of coming at it sideways to detect failure. ok claudio@
2011-04-03Always reserve space in the routing socket for a desync mbuf. This allowsJoel Sing
a desync to be appended when the socket buffer becomes full, rather than continuall retrying until space becomes available (which may be never). ok claudio@
2011-03-31- use nitems(); no binary changeJasper Lievisse Adriaanse
ok claudio@
2011-02-14free mbuf in failure case. fix for pr6562. ok claudio.Ted Unangst
2011-01-06dst my point to memory inside rt so move the check up before theClaudio Jeker
rtfree(rt). Without this the sp_protocol on RTM_DELETE is garbage and rtsocket user that restrict the AF of the socket (like ospfd) will not see a single one of the RTM_DELETE. OK henning@, dlg@
2011-01-06Minor style nitClaudio Jeker
2010-10-28Do not send route messages to userland processes that the kernelClaudio Jeker
rejects because of bad encoding. Userland processes trust that the messages on the rtsock are correctly encoded. Moved some checks up to do the suser() check as soon as possible. After discussion with deraadt@, OK deraadt@ and sthen@ (earlier version)
2010-10-11Implement an rtsocket filter for rtableids. A process will initiallyClaudio Jeker
only get messages that are for the rtable the process is bound to. Depending on the rtm_type the rdomain or rtable id are used for comparison. It is possible to change the filter with a setsockopt(s, AF_ROUTE, ROUTE_TABLEFILTER,...) and if set to RTABLE_ANY the filter is deactivated. Additionally set the tableid in struct if_msghdr to the rdomain id and use the process rtableid in the sysctl if no table was specified. OK henning@
2010-09-08Switch the MPLS blocks for RTM_CHANGE. Do not always remove the MPLSClaudio Jeker
information if the gateway changes, since real MPLS routes need to change gateway and outgoing label on topology changes. So if there is MPLS information and an outgoing label do a proper change but if the gateway of a non-MPLS route is changed remove the MPLS path since it is no longer valid. OK michele@
2010-09-02don't attempt to enqueue routing messages on sockets marked SS_CANTRCVMOREBret Lambert
ok claudio@
2010-08-25Let rtable_add() return usefull errnos so that the ioctl handler and theClaudio Jeker
rtsock code can return a more reasonable error to the user. OK henning
2010-08-24last is a pointer so initialize to NULL and not 0. Also move initializationClaudio Jeker
up to the declaration.
2010-07-14The append side of a socketbuffer is not allowed to call sbflush().Claudio Jeker
Learned the hard way. dlg@ confirmed that it is save to just remove them, the desync will still work but the reader needs to dequeue all packets first.
2010-07-14if we produce a lot of rtsock messages it is possible we will hit aDavid Gwynne
condition that prevents us from queuing it, which in turn means that processes listening on the routing socket for changes to the kernel state will get out of sync. currently this is handled by the following comment: /* should notify about lost packet */ this change introduces a new rtsock message called RTM_DESYNC that notifies about lost packets and uses it instead of this comment. when we detect loss we flush all the message in the routing socket and attempt to queue an RTM_DESYNC message instead. to guarantee that we will enqueue DESYNC we keep trying it when an attempt to enqueue or dequeue any messages is made, and in the worst case a timeout tries to guarantee that desync is added to the socket. ive been running this in production for 2 or 3 weeks. tested by sthen@ ok sthen@ claudio@ deraadt@ code written by andrew sallaway at the univeristy of queensland.
2010-07-09When protocol filtering is used on the rtsocket filter only messages thatClaudio Jeker
actually have a protocol/address family set. Messages like RTM_IFINFO or RTM_IFANNOUNCE are family independent and should not be filtered but it is possible to use a ROUTE_MSGFILTER to filter these messages. This allows to reduce the messages sent to AF_INET or AF_INET6 only daemons. OK henning@, deraadt@