summaryrefslogtreecommitdiff
path: root/sys/net/rtsock.c
AgeCommit message (Collapse)Author
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@
2010-07-02m_copyback can fail to allocate memory, but is a void fucntion so gymnasticsBret Lambert
are required to detect that. Change the function to take a wait argument (used in nfs server, but M_NOWAIT everywhere else for now) and to return an error ok claudio@ henning@ krw@
2010-06-28Add the rtable id as an argument to rn_walktree(). Functions likeClaudio Jeker
rt_if_remove_rtdelete() need to know the table id to be able to correctly remove nodes. Problem found by Andrea Parazzini and analyzed by Martin Pelikán. OK henning@
2010-05-19Require RTF_MPLS to be set when a mpls route is added or changed. To removeClaudio Jeker
only the MPLS bits from a route set rtm_fmask to RTF_MPLS. Additionally check if the nexthop is modified and in that case always remove the MPLS info since the path changed. This change makes life in userland a lot easier since the routing daemons normaly don't know about MPLS and until now they destroyed MPLS information when issuing RTM_CHANGEs. OK michele@
2010-04-21Implement a way to get information about a rtable. Currently only the rtableidClaudio Jeker
and rdomainid are returned. This is necessary to know where L2 information of a table is stored (which will be needed soon by bgpd). Also while there change the errno for non-existing routing tables to ENOENT. 'Fine' deraadt@
2010-03-23Set rtm_mpls on RTM_GET so that we get the correct options on mpls routes.Claudio Jeker
OK michele@
2010-02-09Set the rtm_priority when sending RTM_ADD/RTM_DELETE messages out inClaudio Jeker
rt_newaddrmsg(). Makes the routing daemons a bit less confused when interfaces are reconfigured.
2010-02-09Correctly track RTF_UP on RTM_CHANGE. Since the interface can changeClaudio Jeker
rt_if_linkstate_change() needs to be rerun for this route and the resulting rt_flags need to copied to the rtm_flags for userland. Problem found and diagnosed by Doran Mori. OK henning@, jsing@
2009-11-03rtables are stacked on rdomains (it is possible to have multiple routingClaudio Jeker
tables on top of a rdomain) but until now our code was a crazy mix so that it was impossible to correctly use rtables in that case. Additionally pf(4) only knows about rtables and not about rdomains. This is especially bad when tracking (possibly conflicting) states in various domains. This diff fixes all or most of these issues. It adds a lookup function to get the rdomain id based on a rtable id. Makes pf understand rdomains and allows pf to move packets between rdomains (it is similar to NAT). Because pf states now track the rdomain id as well it is necessary to modify the pfsync wire format. So old and new systems will not sync up. A lot of help by dlg@, tested by sthen@, jsg@ and probably more OK dlg@, mpf@, deraadt@
2009-09-17Remove the comaptibility structures for routing socket version 3.Claudio Jeker
The RTM_VERSION bump is 2 years ago and so there is no need for this. Diff made by tedu@ some time ago but got never commited so I do it now.
2009-07-07When adding or changing a MPLS route, add RTF_MPLS flag toMichele Marchetto
routing message. We can then rely on that flag to spot out MPLS routes coming from routing socket. ok claudio@
2009-06-26the pr_usrreq implementation for routing sockets shares exactly one lineBret Lambert
of code between cases, so stop pretending otherwise, and move the if() dance to a switch, as is done in every other pr_usrreq I'm aware of. ok claudio@ michele@
2009-06-22Remove unneeded sotorawpcb() call, as the PCB is unmolested betweenBret Lambert
malloc()ing it and calling that macro. No functional change, just tightening things up a bit. ok claudio@ michele@
2009-06-20Decrement routing socket count in MPLS detach caseBret Lambert
While here, fix whitespace (spaces -> tabs) issue spotted by michele@ ok michele@, claudio@
2009-06-06when xflags got changed, tell the userland by routing socketsRainer Giedat
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-05-31Hide RTP_DOWN in the kernel and don't expose it to userland. Userland isClaudio Jeker
not smart enough to handle it in a sensible way. Make sure the kernel selected routing priority is actually exported to userland or to help daemons like bgpd to keep correctly track of the routes. This should fix some of the rather strange errors seen by people having multipath routes on their bgpd boxes. While there make the interface priority inheritance on static routes work again. OK henning@
2009-05-31Fix for the rtfree 2 panic seen by some people before the release. A missingClaudio Jeker
refcnt bump caused the panic to be triggered. While there also make the priority so that the compare is working a bit better. henning@ cries in agony (I already gave up)
2009-04-18Make "route(8) change" aware of MPLS.Michele Marchetto
It is now possible to change routes' MPLS parameters via route change. ok laurent@, ok and input claudio@
2009-02-03Use our own flags to set the operations and not RTF_PROTOX.Michele Marchetto
Switch the padding field into a MPLS one in rt_msghdr to store relevant informations. OK claudio@ laurent@
2009-01-28Get rid of the ugly rtentry hack.Michele Marchetto
We can now act as edge node and allow ipv4 packets to enter a Label Switched Path and not just forwarding MPLS packets. OK claudio@
2009-01-28Implement basic routing socket filtering. It is possible to give a list --Claudio Jeker
actually a bitfield -- of routing messages a listener is interested in. This list can be changed with a setsockopt(s, AF_ROUTE, ROUTE_MSGFILTER, ...) call. OK henning@, dlg@
2009-01-08Fix sockaddr_mpls structure.Michele Marchetto
Now it contains just the label as it must be. This introduces a ugly hack in rtentry that will be removed as soon as possible. OK claudio@
2009-01-03Write back the priority the kernel used. Fixes a problem seen in ospfd whenClaudio Jeker
routes are added via route(8) -- those where added with the wrong priority and so where not correctly tracked later on. Found and tested by gollo@
2008-12-12Make sure that incomming routing messages don't have RTP_DOWN set. MaskClaudio Jeker
the rtm_priority with RTP_MASK so that userland (e.g. arp) can issue a RTM_GET and reissue the message as RTM_DELETE.
2008-11-22Allow rt_msg1() to get a NULL as struct rt_addrinfo this simplifies a fewClaudio Jeker
callers (plus an upcomming one). OK henning@, dlg@
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-08-07Remove workaround used for the 4.4 release. More route prio stuff is commingClaudio Jeker
soon.