summaryrefslogtreecommitdiff
path: root/sys/net/rtsock.c
AgeCommit message (Collapse)Author
2020-03-24Remove redundant 'NULL' check for 'rtm'.tobhe
CID 1453252 ok claudio@ mpi@
2019-11-24If the RTM_PROPOSAL is a solicitation proposal forward the request toClaudio Jeker
all interfaces. Most handlers will ignore it but at least umb(4) will send a response back. OK florian@
2019-11-22The DNS proposal list can (soon) be empty to signal a withdraw, relaxFlorian Obser
the size constraint to allow this to pass through the kernel. Looks good to deraadt@
2019-11-22Add rtm_proposal, a function to send out RTM_PROPOSAL messages from theClaudio Jeker
kernel. Will be used to have umb(4) inform unwind(8) about DNS changes. OK bluhm@ tested by florian@ and deraadt@
2019-11-06Pull break into ifdef; noticed by bluhm who also OK'ed the previousFlorian Obser
commit.
2019-11-06Fix RTA_DNS checks:Florian Obser
Do not overwrite the address family, we need to know if this is IPv4 or IPv6 to parse the message. Nameservers are IP addresses, not NUL-terminated strings. Check that the length is a multiple of the length of an IP address. OK krw
2019-09-23Do more sanity checks when accepting socket addresses in routingAlexander Bluhm
messages from user land. Inspect length field early in rtm_xaddrs(). Strings must be NUL terminated. The socket address type and length depend on the routing message type. Currently checks are not super strict to avoid too much user land fallout. OK mpi@ Reported-by: syzbot+638dbf7851da8e255af5@syzkaller.appspotmail.com
2019-08-28Fix white spaces and wrap long lines.Alexander Bluhm
2019-08-28In rev 1.273 RTM_LOCK has been removed from net/rtsock.c. SinceAlexander Bluhm
then the big switch in rtm_output() has RTM_CHANGE as a unique case. Remove redundant checks of rtm_type within this case. OK kn@
2019-07-17Convert struct rtpcb malloc(9) to pool_get(9). PCB for routingAlexander Bluhm
socket is only used in process context, so pass PR_WAITOK to pool_init(9). The possible sleep in pool_put(9) should not hurt as route_detach() is only called by soclose(9). As both pr_attach() and pr_detach() are always called with kernel lock, PR_RWLOCK is not needed. OK mpi@
2019-06-21Prevent recursions by not deleting entries inside rtable_walk(9).Martin Pieuchot
rtable_walk(9) now passes a routing entry back to the caller when a non zero value is returned and if it asked for it. This allows us to call rtdeletemsg()/rtrequest_delete() from the caller without creating a recursion because of rtflushclone(). Multicast code hasn't been adapted and is still possibly creating recursions. However multicast route entries aren't cloned so if a recursion exists it isn't because of rtflushclone(). Fix stack exhaustion triggered by the use of "-msave-args". Issue reported by Dániel Lévai on bugs@ confirmed by and ok bluhm@.
2019-06-05Remove workaround and return EINVAL when userland sends routing messagesClaudio Jeker
with bad address flags. OK bluhm@ sthen@
2019-05-11Make rt_mpls_set() be more strict in what it accepts. Also ensure thatClaudio Jeker
the RTF_MPLS can't be toggled without rt_mpls_set() being called. While RTF_MPLS is part of RTF_FMASK it should be excluded from the flags and mask when they are applied to the route since toggling it requires a call to rt_mpls_set(). OK bluhm@ Reported-by: syzbot+86344a9e31c27aa6f15b@syzkaller.appspotmail.com
2019-04-05Broken userland software sets address bit in routing message withoutAlexander Bluhm
providing a corresponding socket address. A stricter kernel check returns EINVAL and the software does not work anymore. Relax the check for OpenBSD 6.5 release so we have more time to find and fix bugs in ports afterwards. This is a temporary workaround. analysis sthen@; OK claudio@ jca@
2019-03-31Add a more strict rtm_hdrlen size check. Make sure that at leastClaudio Jeker
struct rt_msghdr bytes are passed in. Also return a failure from rtm_xaddrs() if rti_addrs has bad flags or run out of space. Ok bluhm@ Reported-by: syzbot+18fd599cf8e14c507115@syzkaller.appspotmail.com
2019-02-08Fix kernel info leak in routing message.Alexander Bluhm
from NetBSD; OK deraadt@ visa@
2019-02-04Avoid an mbuf double free in the oob soreceive() path. In theAlexander Bluhm
usrreq functions move the mbuf m_freem() logic to the release block instead of distributing it over the switch statement. Then the goto release in the initial check, whether the pcb still exists, will not free the mbuf for the PRU_RCVD, PRU_RVCOOB, PRU_SENSE command. OK claudio@ mpi@ visa@ Reported-by: syzbot+8e7997d4036ae523c79c@syzkaller.appspotmail.com
2018-12-20Convert to timeout_add_msec instead of counting ticks.Claudio Jeker
OK visa@ bluhm@ kn@
2018-11-12Add new routing socket message RTM_80211INFO to provide details ofKenneth R Westerback
802.11 interface state changes (e.g. SSID) to interested parties. Original diff from phessler@. Many suggestions and tweaks from claudio@, stsp@, anton@. ok claudio@ stsp@ anton@ phessler@
2018-07-10Remove net/raw_cb.h from includes and replace the RAWSNDQ, RAWRCVQ withClaudio Jeker
protocol specific ones. OK mpi@
2018-07-10After removing raw_usrreq() from route and pfkey, the global sockaddrAlexander Bluhm
variables can be delared constant. OK claudio@ mpi@
2018-07-09Inline the raw_usrreq() function into route_usrreq(). This simplifies theClaudio Jeker
route code since there is no more special wrapping needed and in some places the PRU cases get easier because route(4) for example always connected. OK bluhm@ henning@ mpi@
2018-07-05fix comment: s/always send/always sent/Stuart Henderson
2018-07-05RTM_BFD route messages are also a special case. suggested by claudio@,Sebastian Benoit
ok phessler@
2018-07-05not all route messages have a priority. Move the priority filter checkSebastian Benoit
where it belongs. Problem spotted by by remi@ ok sthen@ claudio@ krw@
2018-07-01Retire support for unused RTM_LOCK messages, it's redundant w/ RTM_CHANGE.Martin Pieuchot
ok tb@, sthen@
2018-06-25Factorize MPLS setup/teardown into two functions.Martin Pieuchot
ok claudio@
2018-06-25Push the NET_LOCK() down in rtm_output().Martin Pieuchot
ok tb@, visa@
2018-06-11Rename routing & pfkey tables for coherency with other PCB tables.Martin Pieuchot
ok claudio@
2018-06-11Push the KERNEL_LOCK() inside route_input().Martin Pieuchot
ok visa@, tb@
2018-06-06Prefix fields of pfkey & routing PCBs, part 2, no functionnal change.Martin Pieuchot
ok tb@
2018-06-06Prefix fields of pfkey & routing PCBs, no functionnal change.Martin Pieuchot
ok visa@, tb@
2018-06-06Asseert that a pfkey or routing socket is referenced by a `fp' insteadMartin Pieuchot
of calling sofree(), when its PCB is detached. This is different from TCP which does not always detach `inpcb's from sockets. In the pfkey & routing case caling sofree() there is a noop whereas for TCP it's needed to free closed connections. Having fewer sofree() makes it easier to understand the code and move the locks down. ok visa@
2018-05-14Use a SRP list to protect pfkeyv2 sockets, thus removing the need toMartin Pieuchot
grab the KERNEL_LOCK() when delivering messages. This is the same solution already used by routing sockets. ok claudio@, visa@
2018-05-08Introduce rtm_sendup() a function to deliver routing messages to aMartin Pieuchot
socket receive buffer. It is modelled after pfkey_sendup() as both will need the same MP treatment. ok tb@, bluhm@, visa@
2018-04-24Remove unused rtentry parameter.Florian Obser
Input bluhm OK benno, kn, claudio
2018-02-19Remove almost unused `flags' argument of suser().Martin Pieuchot
The account flag `ASU' will no longer be set but that makes suser() mpsafe since it no longer mess with a per-process field. No objection from millert@, ok tedu@, bluhm@
2018-02-11Add a ROUTE_PRIOFILTER socket option for roueing sockets thatSebastian Benoit
allows filtering on the priority of the route. All routes up to the specified value will be passed. ok claudio, ok henning previous version, feedback and manpage from sthen.
2018-02-08Make the routing socket more MP save by using a SRPL list for the pcb list.Claudio Jeker
Still needs the big kernel lock but this is another step in the right direction. With and OK mpi@
2017-12-18Size for free(9).Martin Pieuchot
From <kshe59 at zoho.eu>
2017-12-13Spacing from kshe59@zoho.eu.Martin Pieuchot
2017-12-13Sizes for free in route_output().Martin Pieuchot
From kshe59@zoho.eu.
2017-12-10Remove outdated comment and trailing spaces.Martin Pieuchot
From kshe59@zoho.eu
2017-11-03After inlining of raw_detach we know the sizes for free; pointed outFlorian Obser
by & OK mpi, input & OK visa
2017-11-03use rop->rcb similar like in pfkeyv2_detach(); suggested by visaFlorian Obser
2017-11-03Inline trivial functions from raw_cb.c and tedu it.Florian Obser
Suggested by and OK mpi, OK visa
2017-11-02Move PRU_DETACH out of pr_usrreq into per proto pr_detachFlorian Obser
functions to pave way for more fine grained locking. Suggested by, comments & OK mpi
2017-10-09Reduces the scope of the NET_LOCK() in sysctl(2) path.Martin Pieuchot
Exposes per-CPU counters to real parrallelism. ok visa@, bluhm@, jca@
2017-09-05Replace NET_ASSERT_LOCKED() by soassertlocked() in *_usrreq().Martin Pieuchot
Not all of them need the NET_LOCK(). ok bluhm@
2017-09-01Change sosetopt() to no longer free the mbuf it receives and changeMartin Pieuchot
all the callers to call m_freem(9). Support from deraadt@ and tedu@, ok visa@, bluhm@