1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-10 06:47:55 -08:00
Commit Graph

500 Commits

Author SHA1 Message Date
henning
9d3ea28673 move some session specific stuff to session.h and make the few files
that need it include that
2004-01-03 20:37:34 +00:00
henning
65fdbd1163 decouple the peer list from bgpd_config.
so many parts of bgpd are not at all interested in the session specific peer
structs... allows for some further cleaning
2004-01-03 20:22:07 +00:00
henning
86a29015aa send an imsg as list end indicator 2004-01-03 13:54:27 +00:00
henning
8c40ad0db4 move the socket name #define to bgpd.h and get rid of bgpdctl* 2004-01-02 02:27:57 +00:00
henning
2715768351 listen on a AF_LOCAL socket for imsgs too.
only implemented type yet is IMSG_CTL_SHOW_NEIGHBOR which sends back
the struct peer for all neighbors.
will be used by bgpdctl
2004-01-01 23:46:47 +00:00
henning
9a03ff3197 now that imsg_get uses bigger buffers, one read call can put more than one
imsg into the buffer. since imsg_get by definition only returns one imsg we
missed the next imsg(s) until the next poll event on the socket in question,
building up a queue on that socket. didn't show up as a problem yet...
factor out imsg_read, which reads into the buffer. imsg_get now entirely
operates on the buffers and does not read(2) itself.
make all callers cope by calling imsg_read on poll events and calling
imsg_get in a loop until all imsgs are processed.
2004-01-01 23:09:08 +00:00
henning
24396d69e6 redo the imsg readers to use bigger buffers and less read(2)s. should increase
performance even further.
gets rif od struct imsg_readbuf; rename peer_read_buf to read_buf as that
is more appropriate now.
2003-12-28 14:34:30 +00:00
henning
fcf3b3f4d3 keep a copy of the fd locally instead of passing it around all time 2003-12-27 14:24:42 +00:00
henning
ae2d867974 provide kroute_fib_couple and _decouple, pumping all bgp routes from the
internal view to the kernel routing table respectively removing them all from
the kernel routing table
kroute_shutdown is now a simple wrapper to kroute_fib_decouple
2003-12-27 01:30:00 +00:00
henning
29241eb5b3 implement "no fib-update" much cooler 2003-12-27 00:53:51 +00:00
jakob
0b3c839be6 add option 'log updates' to log updates. ok henning@ 2003-12-26 20:52:14 +00:00
jakob
4404fcbe1c constify; ok henning@ 2003-12-26 20:06:01 +00:00
henning
f87a5020e8 when this project started and i added the fatal() function, I made it take
the error number as parameter instead of accessing errno, because in one
place the error number was not in errno but fetched from a socket.
now, of course it makes much more sense to just set errno to the error number
just fecthed in this one place instead of having hundreds of fatal() calls
all transfer the errno round and round and round...
fix this, and also provide a fatalx, which does not care for errno and doesn't
invoke strerror.
oh, btw, in the place where we fetch the err # from the socket, we don't
call fatal anymore anyway...
2003-12-26 18:07:32 +00:00
henning
72e080bde3 by making kroute_dispatch_msg() and kroute_nexthop_add() return int instead
of void they can now report errors upstream and do not need to panic any
more. so do that and handle the errors in bgpd.c in the vein that we at least
can clean up before exit.
there are no direct fatal() call in kroute.c now any more, nor any in bgpd.c
after forking.
2003-12-26 17:47:04 +00:00
henning
c3187f2e51 provide a real log_err 2003-12-26 16:48:07 +00:00
henning
898157a765 log_err -> log_peer_err
log_errx -> log_peer_errx

because that is what they really are, peer specific.
2003-12-26 16:37:04 +00:00
henning
6e43c8e401 log nexthop status changes 2003-12-26 14:38:58 +00:00
henning
749ffe23f1 + log_ntoa, a simple helper funtion that doesn't require a struct in_addr... 2003-12-26 14:27:58 +00:00
henning
1c3bd6b510 remove he pathetic log_kroute()
not used anywhere anyway
2003-12-26 14:26:02 +00:00
henning
f846e12af8 handle IMSG_NEXTHOP_DELETE as well 2003-12-26 00:49:52 +00:00
henning
0482f79626 kroute_nexthop_check -> kroute_nexthop_add
kroute_validate_nexthop -> kroute_nexthop_insert
2003-12-26 00:27:23 +00:00
henning
40c8d8dc11 kroute_validate_nexthop is a private function 2003-12-26 00:23:48 +00:00
henning
d54e22ba46 finally marry rde and kroute parts of the nexthop verification:
handle IMSG_NEXTHOP_ADD and send IMSG_NEXTHOP_UPDATE when appropriate
2003-12-26 00:14:04 +00:00
claudio
6b713a0ba9 RDE part of the nexthop verification puzzle.
The RDE just tracks the nexthop IPs and reacts on nexthop messages
from the parent.

ok henning@
2003-12-25 23:22:13 +00:00
henning
82d4885628 bring us closer to a complete nexthop verification that does NOT need
periodic scans:
-keep a tree of nexthops with valid/invalid flags
-provide kroute_match, which takes an IP address and gives the kernel route
 for that
-find the kernel route for a given nexthop with that
-keep a marker on the kernel route that a nexthop depends on it
-on removal of the kernel route, re-evaluate the affected nexthops for
 validity.

ok claudio@
2003-12-25 23:15:58 +00:00
henning
405b6500af track routing table changes that are _not_ caused by bgpd itself
ok claudio@
2003-12-25 17:07:24 +00:00
henning
021b6e7741 implement "passive": do not attempt to open a tcp connection to the
neighbor system
2003-12-25 14:28:49 +00:00
henning
8976e495bb kill IMSG_KROUTE_ADD as well. just send KROUTE_CHANGE requests. 2003-12-25 02:24:26 +00:00
henning
5f378d2225 it actually makes more sense to call the merged function kroute_change 2003-12-25 02:09:19 +00:00
henning
49dd3ea9fa kroute_change is obsolete, long live kroute_add 2003-12-25 02:04:46 +00:00
henning
cf39f0c48d following up on a discussion with theo, read(2) as much as possible at once
and process the bgp messages after each other out of that big buffer.
gives a nice speedup, easier code and earlier connection close detection.
2003-12-24 23:14:23 +00:00
henning
0e5579dbf0 now that the main process can cleanup without RDE's help, we do not need the
somewhat fragile IMSG_SHUTDOWN_* stuff any more. speeds shutdown up
enourmously.

ok claudio@
2003-12-24 20:09:56 +00:00
henning
29f5f95429 now that we keep track of the routes we added to the kernel we can remove
them easily on shutdown without the RDE's help
2003-12-24 19:59:24 +00:00
henning
7421424a63 add log_kroute() 2003-12-24 19:21:20 +00:00
henning
6387b754b5 add option to not touch the kernel routing table 2003-12-24 13:49:21 +00:00
henning
1926ab97c4 send shutdown requests to the child processes and wait for a ackmessage from
them when shutting down.
the rde needs the main process to clean up the routing table on exit so the
parent process needs to be in service until the RDE is done.
ok claudio@
2003-12-23 18:28:05 +00:00
henning
096179b262 allow the listening address to be specified, default to INADDR_ANY
should make jose@ happy
2003-12-23 01:06:21 +00:00
henning
3eef66be41 o add low-level functions for adding/chaining/removing kernel routes
o define new imsg types for this
o process these imsgs in the parent process

now "only" debugging and the rde sending these messages is missing.

ok claudio@
2003-12-22 15:22:13 +00:00
henning
ea5db23956 add a configtest mode 2003-12-22 15:07:05 +00:00
henning
43271d6626 rename get_imsg() to imsg_get(); that's more consistent 2003-12-21 23:28:39 +00:00
henning
85de38448b wrap read & write buffers for imsgs into a struct.
finally gives us read buffers per pipe instead of per process, eleminating
a possible race.
also gets us a real imsg_init() that does all the boring init work
2003-12-21 23:26:37 +00:00
henning
dc5dffce25 overhaul the write buffering code.
introduce msgbuf API and bundle all info needed for the write buffers in a
struct msgbuf.
also switch to a write queue per handled connection (each bgp session, each
pipe) instead of one big one.
fixes some subtle problems and is overall nicer.

ok claudio@
2003-12-21 22:16:53 +00:00
henning
578c88913c queued_reads in struct peer was not ever used exept for an initialization to 0 2003-12-21 18:21:24 +00:00
claudio
f1a6b182e5 yet more from the castathon; most aspath functions where accessing non-
aligned memory (u_int16_t) therefor crashed the RDE on my sparc64. All
buffer specific functions use now void * instead of u_char * so most cast
are now history. Tested on sparc64 and i386. OK henning@
2003-12-21 16:11:33 +00:00
claudio
69e1dc43c7 more cast cleanup imsg_compose takes now a void * argument. OK henning@ 2003-12-20 21:19:40 +00:00
henning
c21e2e9bac let buf_add take void *data instead of u_char *data and save a zillion
evil casts
2003-12-20 21:14:55 +00:00
henning
cc210e5e6c make imsg.data void *, theo 2003-12-20 20:25:20 +00:00
henning
2e09f5e303 keep track which process we are so fatal() can log in which proc the
condition happened. fatal()s from subsystems used by all 3 processes like
the imsg subsystem were hard to track down without knowing in which process
the condition happened.
2003-12-20 18:32:22 +00:00
henning
09919172ad read(2)/write(2) return ssize_t, not size_t 2003-12-20 14:33:09 +00:00
henning
a16c099288 welcome, bgpd
started by me some time ago with moral support from theo, the proceeded up to
the point where the session engine worked correctly. claudio jeker joined
then and did a lot of work in the RDE.
it is not particulary usefull as application right now as parts are still
missing but is imported to enable more people to work on it.
status:
BGP sessions get established fine, OPEN messages and then KEEPALIVEs
exchanged etc. session FSM works fine; NOTIFICATIONs are handled fine, and
all connection drops etc I provoked get handled fine.
Incoming UPDATE messgages are parsed well and the data entered to the RIB,
the decision process is not yet there, neither is outgoing UPDATEs or sync
to the kernel routing table.

not connected to the builds yet.
2003-12-17 11:46:54 +00:00