diff options
author | Eric Faurot <eric@cvs.openbsd.org> | 2009-06-07 05:56:26 +0000 |
---|---|---|
committer | Eric Faurot <eric@cvs.openbsd.org> | 2009-06-07 05:56:26 +0000 |
commit | 703b56a3f22756eac55e0bd7b17d1538de6c8000 (patch) | |
tree | 40f35f3c5bceaefa5fe710539018fdc22722309a /usr.sbin/bgpd/session.c | |
parent | a09824e75d2192dc4f1a42afe21653e1f153c241 (diff) |
Change the way fds passed over a socket are retreived on the receiving side.
Currently the receiver fetches an imsg via imsg_get() and if he expects
an fd, he then calls imsg_get_fd() to fetch the next fd queued on the
imsgbuf from which the imsg came.
This changes hides the fd queueing mechanism to the API user. When closing
an imsg with an fd, the message is flagged so that the receiving end knows
it must dequeue the fd in imsg_get() and return it with the imsg structure.
This way there is no (less) possible screw up from imsg_get_fd() not being
called directly after imsg_get() by the user. The retreived imsg is
self-contained.
ok pyr@, "I like that" henning@
Diffstat (limited to 'usr.sbin/bgpd/session.c')
-rw-r--r-- | usr.sbin/bgpd/session.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c index c8bd5e36c2d..4f7f787272c 100644 --- a/usr.sbin/bgpd/session.c +++ b/usr.sbin/bgpd/session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: session.c,v 1.292 2009/06/06 06:33:15 eric Exp $ */ +/* $OpenBSD: session.c,v 1.293 2009/06/07 05:56:24 eric Exp $ */ /* * Copyright (c) 2003, 2004, 2005 Henning Brauer <henning@openbsd.org> @@ -2310,7 +2310,7 @@ session_dispatch_imsg(struct imsgbuf *ibuf, int idx, u_int *listener_cnt) fatalx("king bula sez: " "expected REINIT"); - if ((nla->fd = imsg_get_fd(ibuf)) == -1) + if ((nla->fd = imsg.fd) == -1) log_warnx("expected to receive fd for " "%s but didn't receive any", log_sockaddr((struct sockaddr *) @@ -2421,7 +2421,7 @@ session_dispatch_imsg(struct imsgbuf *ibuf, int idx, u_int *listener_cnt) } memcpy(&xmrt, imsg.data, sizeof(struct mrt)); - if ((xmrt.wbuf.fd = imsg_get_fd(ibuf)) == -1) + if ((xmrt.wbuf.fd = imsg.fd) == -1) log_warnx("expected to receive fd for mrt dump " "but didn't receive any"); |