summaryrefslogtreecommitdiff
path: root/sys/net/rtsock.c
AgeCommit message (Collapse)Author
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.
2008-08-01force route priority to RTP_DEFAULT unconditionally, effectively disablingHenning Brauer
route prios. playing safe for 4.4-release, as not all parts of the system deal correctly with route prios yet. ok claudio
2008-07-28Align the route message length to the next natural boundary via ALIGN() toClaudio Jeker
ensure that the next message is nicely aligned as well. Some archs (sparc, m88k)have strict alignement issues since the inclusion of 64bit counters in the messages because those values could end up on non aligned addresses. Found and fix tested by miod@, OK deraadt@
2008-06-13Change the logic when selecting routes on RTM_CHANGE & RTM_GET. RTM_CHANGEClaudio Jeker
can not supply the correct nexthop if the nexthop is changed. So if the route we want to change is a non-multipath one allow the change to succeed. This unbreaks RTM_CHANGE in most situations. Found by jsing@ Ok henning@
2008-06-13Cleanup a bit. Instead of doing dst = 0 in every error handling block initClaudio Jeker
it once at start instead.
2008-05-23Deal with the situation when TCP nfs mounts timeout and processesThordur I. Bjornsson
get hung in nfs_reconnect() because they do not have the proper privilages to bind to a socket, by adding a struct proc * argument to sobind() (and the *_usrreq() routines, and finally in{6}_pcbbind) and do the sobind() with proc0 in nfs_connect. OK markus@, blambert@. "go ahead" deraadt@. Fixes an issue reported by bernd@ (Tested by bernd@). Fixes PR5135 too.
2008-05-07Implement routing priorities. Every route inserted has a priority assignedClaudio Jeker
and the one route with the lowest number wins. This will be used by the routing daemons to resolve the synchronisations issue in case of conflicts. The nasty bits of this are in the multipath code. If no priority is specified the kernel will choose an appropriate priority. Looked at by a few people at n2k8 code is much older
2008-04-23Import MPLS (Multi Protocol Label Switching)Esben Norby
MPLS support partly based on the (abandoned?) AYAME project. Basic LSR (Label Switch Router) functionality is present, but not fully functional yet. It is currently possible to insert entries in the LIB (Label Information Base) with route(8), but setting the operation type is not supported yet. Imported to allow more people to work on this in the coming weeks. ok claudio@ laurent@ dlg@
2007-09-15malloc sweep:Henning Brauer
-remove useless casts -MALLOC/FREE -> malloc/free -use M_ZERO where appropriate instead of seperate bzero feedback & ok krw, hshoexer
2007-09-09Only clear the message header if it is called from a sysctl walk. ThisClaudio Jeker
unbreaks RTM_GET. Problem reported by fkr@
2007-09-08Clear the message header (and only the message header) in rt_msg2.Claudio Jeker
By doing so we ensure that all the memory is initialised and we no longer have to ensure that none of the structure elements is forgotten in sysctl_iflist() and sysctl_dumpentry(). This solves the route flush issues seen by aanriot@ OK henning@
2007-09-07Check if rtm_hdrlen is smaller then the passed message or it would be possibleClaudio Jeker
to access uninitialised memory. Set dst to 0 on error, the error path tries to access dst but dst is inited later down the code. This fixes a kernel panic seen by aanriot@ OK henning@
2007-09-03Bump RTM_VERSION to 4 and start a new aera of routing in OpenBSD :)Claudio Jeker
Changes include 64bit counters instead of u_long, routing table id in the header of most messages, reserved routing priority field, added a hdrlen field to skip over the header so that binary compatibility becomes easier. A minimal backward support for old binaries is included to ease upgrades but don't expect anything more than ifconfig, route and dhclient to correctly work. OK henning@ mglocker@
2007-02-14Consistently spell FALLTHROUGH to appease lint.Jonathan Gray
ok kettenis@ cloder@ tom@ henning@
2006-06-16support passing the desired routing table ID via the sysctl interfaceHenning Brauer
(NET_RT_DUMP & friends) too. keep supporting the old form (and imply id 0) of course. claudio ok
2006-06-16pass the routing table ID over the routing socket, so we can start toHenning Brauer
manipulate alternate tables from userland. new tables are created implicitely when an RTM_ADD for that table is seen. ok norby claudio hshoexer
2006-06-16adjust functions dealing with the routing table to take a table ID asHenning Brauer
parameter so they can work on alternate tables. table 0 hardcoded for many callers yet, that will be adapted step by step. input + ok claudio norby hshoexer
2006-05-30Export the route labels via sysctl interface not only via RTM_GET.Claudio Jeker
OK henning@ norby@
2006-04-22Routes announced via rt_missmsg() do not have rtm_index set. While in mostClaudio Jeker
cases harmless it is used by the IPv6 code. The result is that bgpd is unable to assigning link local addresses to the correct interface. OK henning@ Fix for PR 5063.
2006-03-31Add sysctl to retrieve the routing table statisitcs. Will be used by netstatClaudio Jeker
instead of kvm access. OK henning@
2006-03-30In sysctl_dumpentry() pass the rt_refcnt by overloading rmx_rttvar.Claudio Jeker
This new rmx_refcnt can be used by route(8) to produce the same output as netstat(1). OK henning@
2006-03-30Spelling in comment.Claudio Jeker
2006-03-22prevent anything outside rote.c from accessing the routing table headsHenning Brauer
directly. rather provide a rt_lookup function for regular lookups, and a rt_gettable for those that need access to the head for some reason. the latter cases should be revisted later probably so that nothing outside the routing core code accesses the heads at all... tested claudio jolan me, ok claudio markus
2006-02-23Until now it was only possible to unset the RTF_JUMBO flag on a RTM_CHANGEClaudio Jeker
request. Extend the "hack" to include more flags (RTF_PROTO[123] flags, RTF_BLACKHOLE, RTF_REJECT and RTF_STATIC). Because rtm_use is "abused" -- rtm_use was replaced long time ago with rtm_rmx->rmx_pksent -- it is now forced to 0 in RTM_GET requests and sysctl_dumpentry(). This is done to prevent false changes because of a reused RTM_GET message. OK henning@, mcbride@, makes sense markus@
2006-02-02Set rtm_index to the correct interface index for RTM_ADD and RTM_CHANGE.Claudio Jeker
bgpd and ospfd use this information to track the availability of a route. Discussed with dlg@, OK henning@
2005-11-29something in the eurobsdcon route-a-thon broke my simple home networkJolan Luff
router so back out the routing stuff to pre-eurobsdcon where my machine doesn't crash immediately. i am happy to test diffs and report success/failures but i am not happy to have instantaneous crashes when i reboot with a new kernel that was compiled from pristine sources. if you are going to be an elitist asshole then you could at least make sure your code works. ok and "be crass towards them" deraadt@
2005-11-27repair builds. ramdisk kernels forgotten about again.Theo de Raadt
2005-11-27don't let anything outside route.c access the routing table heads directly,Henning Brauer
but go through a provided wrapper. also provide rt_lookup() instead of doing the lookup manually in many places. ryan ok
2005-06-08kill some leftover bits from netns and iso routingHenning Brauer
2005-06-07introduce a default "external" interface group, containing the interface(s)Henning Brauer
the the default route(s) point to. handles IPv4 and IPv6 as well as multipath routes. follows default route changes, of course. eases writing pf rulesets especially on laptops etc. that use different interfaces depending on the environment (wired, wireless, ...) ok theo ryan
2005-05-27Use rtm_fmask instead of rtm_use.Ryan Thomas McBride
ok marius@ claudio@
2005-05-27Allow us to clear the RTM_JUMBO flag as well as set it.Ryan Thomas McBride
Reported by Cedric Berger
2005-05-27Experimental support for opportunitic use of jumbograms where only some hostsRyan Thomas McBride
on the local network support them. This adds a new socket option, SO_JUMBO, and a new route flag, RTF_JUMBO. If _both_ the socket option is set and the route for the host has RTF_JUMBO set, ip_output will fragment the packet to the largest possible size for the link, ignoring the card's MTU. The semantics of this feature will be evolving rapidly; talk to us if you intend to use it. ok deraadt@ marius@
2004-09-16handle route labels on RTM_CHANGE, ok mcbride, prodded my markus some time agoHenning Brauer
2004-08-03introduce route labels, allowing for up to 32 bytes of info to be attachedHenning Brauer
to a route. the label is sent over the routing socket wrapped into a new struct sockaddr_rtlabel, allowing for handling it like any other sockaddr. struct rtentry only contains a (16 bit) label-ID, with the actual labels kept outside the routing table. ID allocator code inspired by my own code for altq and pf tags. mostly hacked at the c2k4 hackathon, markus ok
2004-06-24KNF, cleanup, readability fixes... this hurtHenning Brauer
ok itojun claudio
2004-06-22Pull the plug on source-based routing until remaining bugs are eradicated.Cedric Berger
No need to reconfig kernel or rebuild userland stuff. requested deraadt@, help beck@
2004-06-06extend routing table to be able to match and route packets based onCedric Berger
their *source* IP address in addition to their destination address. routing table "destination" now contains a "struct sockaddr_rtin" for IPv4 instead of a "struct sockaddr_in". the routing socket has been extended in a backward-compatible way. todo: PMTU enhancements, IPv6. ok deraadt@ mcbride@
2004-05-12Rework a block readded by the multipath commit that should ensure thatClaudio Jeker
RTM_CHANGE/LOCK only work on perfect matching routes. ppp and bgpd got broken because of this. Most of the code in the "grotty" block is already done by rn_lookup() only host routes need some special treatment. OK cedric@
2004-05-04The tcp specific routing metrics are almost never used so reduce the routingClaudio Jeker
table from these metrics. struct rt_msghdr used by the routing socket is not affected and so most userland apps don't need to be changed. some man page polishing by jmc@ OK henning@ markus@ theo@
2004-04-25radix tree with multipath support. from kame. deraadt okJun-ichiro itojun Hagino
user visible changes: - you can add multiple routes with same key (route add A B then route add A C) - you have to specify gateway address if there are multiple entries on the table (route delete A B, instead of route delete A) kernel change: - radix_node_head has an extra entry - rnh_deladdr takes extra argument TODO: - actually take advantage of multipath (rtalloc -> rtalloc_mpath)
2004-01-15add a RTM_IFANNOUNCE message; from netbsd; ok itojun, henningMarkus Friedl
2004-01-03put an mi wrapper around stdarg.h/varargs.h. gcc3 moved stdarg/varargs macrosMarc Espie
to built-ins, so eventually we will have one version of these files. Special adjustments for the kernel to cope: machine/stdarg.h -> sys/stdarg.h and machine/ansi.h needs to have a _BSD_VA_LIST_ for syslog* prototypes. okay millert@, drahn@, miod@.
2003-12-10de-register. deraadt okJun-ichiro itojun Hagino
2003-08-15change arguments to suser. suser now takes the process, and a flagsTed Unangst
argument. old cred only calls user suser_ucred. this will allow future work to more flexibly implement the idea of a root process. looks like something i saw in freebsd, but a little different. use of suser_ucred vs suser in file system code should be looked at again, for the moment semantics remain unchanged. review and input from art@ testing and further review miod@
2003-08-14m_copyback()'s 4th arg is const void *, nuke (caddr_t) casts.Jason Wright
2003-07-05backout 1.29; problem reported by Rukh w/ userland ppp.Jun-ichiro itojun Hagino