summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd/session.c
AgeCommit message (Collapse)Author
2016-08-08Use exit(3) instead of _exit(2) in the child processes.Renato Westphal
Since recently the child processes call exec() after fork(), so they should stop using _exit(2) and use exit(3) instead when shutting down. Ok claudio@
2016-07-25Initialize the log subsytem in the SE like it is done in the RDE. WithoutClaudio Jeker
this all logging is going via stderr to /dev/null which is not helpful. OK deraadt@ phessler@
2016-07-21Remove a fatal() in peer_up when the local addrs of a peer can't be figured out.Claudio Jeker
Instead bring the session down and wait for admin help. OK henning@, benno@, phessler@
2016-06-28Use IPV6_MINHOPCOUNT to finish implementing ttl-security for IPv6.Jeremie Courreges-Anglas
ok renato@ deraadt@
2016-06-06Add format attributes to the proper functions and then fix the warning inSebastian Benoit
session.c ok mpi@
2015-11-20bgpd has been naughty. It tries to play with AF_UNIX sockets withoutFlorian Obser
pledging "unix". Move control_listen up to the main process which already has pledge("unix"). accept(2) was already allowed. (Technically no longer necessary since listen(2) is now allowed, too, but this moves it to the right place.) OK claudio@, deraadt@
2015-11-17in the SE, loosing the pipe to the main process can be handled with aSebastian Benoit
normal shutdown of sessions and exit. no need for fatal(). ok henning@ phessler@ florian@ happy deraadt@
2015-10-25Rename imsg_compose_parent and imsg_compose_rde to imsg_ctl_parent andClaudio Jeker
imsg_ctl_rde since these function should only be used by the control code. Also switch ibuf_rde to ibuf_rde_ctl so that the control imsgs don't need to queue behind all the incoming bgp UPDATES. This speeds up 'bgpctl show' from taking minutes to a few seconds. The RDE was doing this since a very long time but it seems the SE was not adjusted. Yikes
2015-10-09Change all tame callers to namechange to pledge(2).Theo de Raadt
2015-10-07use fatal() instead of err(); from bennoTheo de Raadt
2015-10-06Move from tame "cmsg" to tame "sendfd" or "recvfd", depending on whichTheo de Raadt
way the process moves fd's.
2015-10-05tame "stdio inet cmsg" should work well in the session engine.Theo de Raadt
ok benno
2015-08-04Give more precise errors, to help track when bgpd quitsPeter Hessler
OK florian@ benno@ sthen@ deraadt@
2015-07-20Make bgpd execute the RDE and session engine process instead of just forking.Claudio Jeker
This way ASLR and stack cookies are per process. With input from benno@ and deraadt@ OK benno@
2015-02-09Kill session_socket_blockmode() and replace it with SOCK_CLOEXEC orClaudio Jeker
SOCK_NONBLOCK and accept4(). OK henning@ tested & OK benno@
2014-12-04replace an overlapping memcpy with memmove, ok deraadt teduStuart Henderson
2014-10-25Remove unnecessary netinet/in_systm.h include.Lawrence Teo
ok millert@
2014-10-08Use reallocarray() throughout to spot multiplicative int overflow.Theo de Raadt
ok henning benno
2014-01-22Fix a bug where stale routes were not properly flushed on sessions announcingClaudio Jeker
the graceful restart capability. The bug is triggered when a router does not reconnect before the graceful restart timeout fires. This removes the checks for the CAPA_GR_FORWARD flag in the timeout and IMSG_SESSION_RESTARTED handler. CAPA_GR_RESTARTING is indicating that bgpd is currently doing a graceful restart for this neighbor and therefore the SE must issue a flush of stale routes in some way. CAPA_GR_FORWARD on the other hand is only indicating that the neighbor actually preserved the forwarding state which is too strict for the timeout handler. Tested by sthen@, florian@ and benno@
2013-11-13from claudioSebastian Benoit
"Let msgbuf_write return -1 with errno EAGAIN. The users then must check if this was the case and readd the event or poll again. The current handling in the imsg code is wrong for sure." ok gilles, benno
2013-07-10Change the way the RDE updates its peer list. The SE is now always sendingClaudio Jeker
a IMSG_SESSION_ADD message to the RDE when a peer comes up or when a reload happens. The IMSG_SESSION_ADD has the full current config of the peer and so the RDE should end up with correct values. This affects mostly maxprefix and the RIB settings. OK henning@
2013-05-30When removing "dump (all|updates)" from bgpd.conf and reloading, tellFlorian Obser
the session engine to actually stop logging. Found the hard way by benno@. with & ok benno@ input & ok claudio@
2013-05-30Add partial support to bgpd for the ttl hack with ipv6. This sends the correctStuart Henderson
ttl on outgoing packets so peer sessions can come up correctly if both sides use ttl-security, but the kernel side is not yet implemented so incoming packets aren't verified (note added to manual for this). ok henning@
2013-03-20less includesTheo de Raadt
2013-03-11handle ECONNABORTED errors from accept(). In many code blocks they can beTheo de Raadt
ignored silently and without aborting, much like EINTR and EWOULDBLOCK are. ok's from various maintainers of these directories...
2013-03-07Implements a few missing bits for better templates support:Claudio Jeker
- on config reload also adjust the cloned neighbors so that they get the config changes as well. - clean up sessions that are 1h idle but in state active (instead of down) - add bits to allow bgpctl to destroy cloned neighbors Tested by sthen@ some time ago, OK phessler@
2012-12-01The capability parser should only return an error in extreme cases. If aClaudio Jeker
particular capability is bad, log the fact and ignore it. This may give us a chance to bring up session that have e.g. unexpected AFI,SAFI pairs in them. Also make the error messages more user friendly. OK henning@, sthen@
2012-09-18Only allow one reload request at a time in bgpd. Needed for further work.Claudio Jeker
OK sthen@, benno@, henning@
2012-09-12Better graceful restart support (implementing more then just the EoR record).Claudio Jeker
This implements only the "Restarting Client" bits of the RFC -- in other words bgpd will keep the FIB when the client restarts but it will not do GR when restarting itself. The capability is still off by default (you need "announce restart yes" to enable it). Tested by Anders Berggren. OK sthen@
2012-07-11Limit "while(setsockopt(..SO_RCVBUF/SO_SNDBUF..))" loops to prevent themStuart Henderson
running away if the setsockopt call fails, as may happen if a peer bounces at the wrong time. OK claudio@ after tweaks to an earlier version which was OK phessler@.
2012-07-09Fix the handling of the message read buf with regard to MSG_PROCESS_LIMIT.Claudio Jeker
The read buffer was only processed when new data came in. So on quiet sessions it could take minutes until the read buffer was processed at the end of a load. Nobody realized this in the last 7.5 years. Tested by sthen@ OK henning@
2012-04-12accept() pacing for bgpd based on similar work done on other daemons.Claudio Jeker
OK henning@ sthen@
2012-01-06typo in log_peer_warnx messageStuart Henderson
2011-07-09remove that rlimit code, rc.d and login classes do it much betterer theseHenning Brauer
days. screaming bob ok claudio
2011-07-04LINK_STATE_IS_UP() cleanup userland part. There is no need to specialClaudio Jeker
case carp(4) interfaces anymore. LINK_STATE_IS_UP() almost always does the right job. OK deraadt@ henning@ This needs a -current kernel or link state may be not reported correctly.
2011-05-05ibuf_add returns 0 or -1. adding up the return values in errs and thenHenning Brauer
checking errs > 0 is not going to work... also make errs signed in 2 cases triggered by Milosz Jakubowski <milosz.jakubowski at gmail.com> pointing out a few cases, diff written from scratch to cover all of them. unsigned errs noticed by sthen. ok claudio sthen
2010-12-23Increase the DATA limit in the RDE to the max value and do the sameClaudio Jeker
for NOFILE in the session engine. OK henning, sthen@
2010-12-09The PF_KEY socket is like the routing socket. It must be polled all theClaudio Jeker
time to consume broadcasted messages or the socket gets full and own messages that are needed are lost. This fixes an infinit loop in pfkey_reply that happens when bgpd tcp md5sum is used on a system that also runs a larger IPsec setup. OK henning, lot of patience, debuging and testing by Thomas Boernert
2010-11-18Log sent notification messages as well having them in the log mayClaudio Jeker
help to figure out the cause of flapping session faster. OK henning@ sthen@
2010-11-10Make sure that the initial configuration of the child is zeroed outClaudio Jeker
by using calloc(). This fixes an issue where the RDE would start up as route-collector because uninitialized memory made the RDE switch to that mode. OK henning@, sthen@, phessler@
2010-10-15Add the FSM suberrors specified in draft-ietf-idr-fsm-subcode. ThisClaudio Jeker
should help identifying FSM errors since the state is know known. OK henning@ sthen@
2010-09-02remove trailing spaces and tabs from source code; no binary changesIgor Sobrado
(verified by both sthen@ and me). ok sthen@; "just commit it" claudio@
2010-06-27Instead of specifying the control sockets on the command line have themClaudio Jeker
in bgpd.conf. This allows to add/modify restricted control sockets on runtime. Feature request by a few people how often forgot to add -r path when restarting bgpd (including myself). NOTE: this removes the -s and -r arguments from bgpd so pay attention when updateing. jajaja sthen@, OK henning@
2010-05-26Rename some imsg bits to make namespace collisions less likely buf toNicholas Marriott
ibuf, buf_read to ibuf_read, READ_BUF_SIZE to IBUF_READ_SIZE. ok henning gilles claudio jacekm deraadt
2010-05-03Make it possible to load multiple routing tables at the same time and useClaudio Jeker
those for alternate RIBs. This allows to use "rde rib TESTIT rtable 1". NOTE: nexthop verification has changed for alternate tables. For now nexthop will only be verified against the main routing table (id 0). Because of this "nexthop qualify via bgp" may now compare the nexthops against bgpd routes from a different RIB. Tested by sthen@, OK to move on by henning@
2010-04-16Memory allocated with calloc() is initialized to zero, no need to do thatClaudio Jeker
explicitly.
2010-04-13Instead of passing AF specific struct kroutes over imsgs use a structClaudio Jeker
kroute_full structure that is AF independent and has all information in it. Simplifies the communication between processes and reduces the number of imsg types. This is another step to add FIB support to BGP MPLS VPNs.
2010-02-11Not knowing a AFI/SAFI pair in the MP capability is no reason to failClaudio Jeker
a session. Just print a warning and move on since both side need to announce a pair to use it. Found and OK sthen@
2010-01-05Make sure that all important config variables are synced on a reload inClaudio Jeker
the SE. This got more important since we use the reload all the time now. Found out the hard way and fix tested by Laurent CARON
2009-12-31Instead of passing the config via arguments to the childs on bootup issueClaudio Jeker
a config reload as first step in bootup. This allows childs to start with an empty config and a lot of special cleanup code can bite the dust. Testing by myself and sthen@ with a few configs (more testing welcome). Seems like a good idea henning@ & sthen@