OpenBSD CVS

CVS log for src/usr.sbin/bgpd/Attic/buffer.c


[BACK] Up to [local] / src / usr.sbin / bgpd

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.47, Wed May 26 16:44:32 2010 UTC (14 years ago) by nicm
Branch: MAIN
CVS Tags: HEAD
Changes since 1.46: +1 -1 lines
FILE REMOVED

Move imsg into libutil and add a man page.

Minor bump for libutil.

Previous versions of this diff and man page looked at by various people.

"you should just commit" deraadt

Revision 1.46 / (download) - annotate - [select for diffs], Wed May 26 13:56:07 2010 UTC (14 years ago) by nicm
Branch: MAIN
Changes since 1.45: +33 -33 lines
Diff to previous 1.45 (colored)

Rename some imsg bits to make namespace collisions less likely buf to
ibuf, buf_read to ibuf_read, READ_BUF_SIZE to IBUF_READ_SIZE.

ok henning gilles claudio jacekm deraadt

Revision 1.45 / (download) - annotate - [select for diffs], Tue Sep 15 10:54:59 2009 UTC (14 years, 8 months ago) by jacekm
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.44: +23 -25 lines
Diff to previous 1.44 (colored)

Enclose repeated buffer draining code in a new msgbuf_drain()
function, which is additionally exported for use by others.

It will be needed by smtpd's SSL module when the SMTP client code
is changed to replace libevent's evbuffers with our msgbuf_* API.

ok gilles@ henning@ guenther@ eric@

Revision 1.44 / (download) - annotate - [select for diffs], Thu Jul 23 18:58:42 2009 UTC (14 years, 10 months ago) by eric
Branch: MAIN
Changes since 1.43: +3 -3 lines
Diff to previous 1.43 (colored)

make buf_write() behave like msgbuf_write(): send out only the
bytes that were filled, not the whole buffer.

ok pyr@ gilles@

Revision 1.43 / (download) - annotate - [select for diffs], Sat Jun 6 06:33:15 2009 UTC (14 years, 11 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6
Changes since 1.42: +10 -13 lines
Diff to previous 1.42 (colored)

sync bgpd/bgpctl with the common imsg code, making it lib ready as well.

ok claudio@ pyr@

Revision 1.42 / (download) - annotate - [select for diffs], Fri Mar 13 06:25:04 2009 UTC (15 years, 2 months ago) by claudio
Branch: MAIN
Changes since 1.41: +28 -9 lines
Diff to previous 1.41 (colored)

Next step in mrt cleanup. Switch buf_write to a smarter version of itself.
Doing more the stuff msgbuf_write does and switch the only user -- mrt --
over to use this simpler way of writing out stuff.

Revision 1.41 / (download) - annotate - [select for diffs], Fri Mar 13 04:40:55 2009 UTC (15 years, 2 months ago) by claudio
Branch: MAIN
Changes since 1.40: +59 -13 lines
Diff to previous 1.40 (colored)

Sync buffer API with the one from ospfd. The dynamic buffers will make other
code much easier to write. OK henning@ some time ago.

Revision 1.40 / (download) - annotate - [select for diffs], Fri Oct 3 15:20:29 2008 UTC (15 years, 8 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_4_5_BASE, OPENBSD_4_5
Changes since 1.39: +4 -4 lines
Diff to previous 1.39 (colored)

Unify code between the various flavors of imsg buffer.c.
Use unsigned int for msg_iovlen.

ok henning@ claudio@

Revision 1.39 / (download) - annotate - [select for diffs], Mon Mar 24 16:11:02 2008 UTC (16 years, 2 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_4_4_BASE, OPENBSD_4_4
Changes since 1.38: +3 -3 lines
Diff to previous 1.38 (colored)

msg_controllen has to be CMSG_SPACE so that the kernel can account for
each cmsg_len (ie. msg_controllen = sum of CMSG_ALIGN(cmsg_len).  This
works now that kernel fd passing has been fixed to accept a bit of
sloppiness because of this ABI repair.
lots of discussion with kettenis

Revision 1.38 / (download) - annotate - [select for diffs], Sat Mar 15 16:19:00 2008 UTC (16 years, 2 months ago) by deraadt
Branch: MAIN
Changes since 1.37: +3 -3 lines
Diff to previous 1.37 (colored)

Repair the simple cases for msg_controllen where it should just be
CMSG_SIZE(sizeof(int)), not sizeof(buffer) which may be larger because
of alignment; ok kettenis hshoexer

Revision 1.37 / (download) - annotate - [select for diffs], Thu Mar 13 01:49:53 2008 UTC (16 years, 2 months ago) by deraadt
Branch: MAIN
Changes since 1.36: +7 -4 lines
Diff to previous 1.36 (colored)

Correct CMSG_SPACE and CMSG_LEN usage everywhere in the tree. Due to
an extensive discussion with otto, kettenis, millert, and hshoexer

Revision 1.36 / (download) - annotate - [select for diffs], Tue Sep 19 13:04:01 2006 UTC (17 years, 8 months ago) by henning
Branch: MAIN
CVS Tags: OPENBSD_4_3_BASE, OPENBSD_4_3, OPENBSD_4_2_BASE, OPENBSD_4_2, OPENBSD_4_1_BASE, OPENBSD_4_1
Changes since 1.35: +3 -2 lines
Diff to previous 1.35 (colored)

make buffer_grow always return a valid struct buf; the contained buffer
might be NULL on realloc failure tho. all users check buffer size before
using the buffer, so this is not a problem.
makes error handling much easier. ease the capabilities code big time.
claudio ok

Revision 1.35 / (download) - annotate - [select for diffs], Sun Aug 27 13:40:21 2006 UTC (17 years, 9 months ago) by henning
Branch: MAIN
CVS Tags: OPENBSD_4_0_BASE, OPENBSD_4_0
Changes since 1.34: +18 -1 lines
Diff to previous 1.34 (colored)

add buf_grow() to grow an existing buffer (realloc), claudio ok

Revision 1.34 / (download) - annotate - [select for diffs], Fri Apr 21 08:51:46 2006 UTC (18 years, 1 month ago) by claudio
Branch: MAIN
Changes since 1.33: +1 -34 lines
Diff to previous 1.33 (colored)

msgbuf_writebound() and msgbuf_bounded() are leftovers from some ancient
mrt dump code. These functions are no longer used since we switched to
filedescriptor passing. From deraadt@

Revision 1.33 / (download) - annotate - [select for diffs], Wed Nov 2 15:34:43 2005 UTC (18 years, 7 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_3_9_BASE, OPENBSD_3_9
Changes since 1.32: +2 -2 lines
Diff to previous 1.32 (colored)

Mark some additional function arguments as const.

Revision 1.32 / (download) - annotate - [select for diffs], Thu Aug 11 16:24:11 2005 UTC (18 years, 9 months ago) by henning
Branch: MAIN
CVS Tags: OPENBSD_3_8_BASE, OPENBSD_3_8
Changes since 1.31: +5 -3 lines
Diff to previous 1.31 (colored)

two missing EINTR here too

Revision 1.31 / (download) - annotate - [select for diffs], Tue Apr 26 15:18:22 2005 UTC (19 years, 1 month ago) by henning
Branch: MAIN
Changes since 1.30: +3 -4 lines
Diff to previous 1.30 (colored)

unify shared code a bit again to make future syncs easier
From: Alexander von Gernler <grunk@pestilenz.org>

Revision 1.30 / (download) - annotate - [select for diffs], Mon Mar 28 14:40:04 2005 UTC (19 years, 2 months ago) by henning
Branch: MAIN
Changes since 1.29: +2 -2 lines
Diff to previous 1.29 (colored)

KNF

Revision 1.29 / (download) - annotate - [select for diffs], Wed Mar 23 11:36:35 2005 UTC (19 years, 2 months ago) by henning
Branch: MAIN
Changes since 1.28: +1 -13 lines
Diff to previous 1.28 (colored)

remove now osolete comment, from a mail exchange with
Alexander von Gernler <grunk@pestilenz.org>

Revision 1.28 / (download) - annotate - [select for diffs], Thu Mar 17 21:51:26 2005 UTC (19 years, 2 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_3_7_BASE, OPENBSD_3_7
Changes since 1.27: +10 -8 lines
Diff to previous 1.27 (colored)

Fix fd passing. Bug introduced lately passed the first fd twice and an old
bug passed a fd twice if only part of the buffers where written by sendmsg().
Lot of discussion and help deraadt@, additional testing norby@
OK deraadt@

Revision 1.27 / (download) - annotate - [select for diffs], Mon Mar 14 11:59:13 2005 UTC (19 years, 2 months ago) by henning
Branch: MAIN
Changes since 1.26: +8 -1 lines
Diff to previous 1.26 (colored)

when a buffer has a file descriptor to pass attached, we tried to send
out all pending buffers up to and including the one with the fd attached.
the fd is sent with the data and closed after all data is sent.
when this amount of data exceeds what we can get rid of with a single
sendmsg() on our nonblocking sockets we might send the fd more than
once, leaving unused fds around.
when we see a buffer with an fd attached, send out everything up to, but
EXcluding that buffer, so that in the next round a seperate message with
just the one buffer and the associated fd is sent. if anything got
written in that sendmsg() call consider the fd sent and close it. from
a debugging session with theo hunting something else, claudio ok

Revision 1.26 / (download) - annotate - [select for diffs], Tue Feb 1 21:36:02 2005 UTC (19 years, 4 months ago) by henning
Branch: MAIN
Changes since 1.25: +6 -6 lines
Diff to previous 1.25 (colored)

switch the buffer size describing vars from ssize_t to size_t and adjust
the API appropriately. avoid singled-compare warnings by rewriting two
expressions. ok claudio

Revision 1.25 / (download) - annotate - [select for diffs], Thu Sep 16 01:33:53 2004 UTC (19 years, 8 months ago) by henning
Branch: MAIN
Changes since 1.24: +2 -2 lines
Diff to previous 1.24 (colored)

cope with ENOBUFS in buf_write()

Revision 1.24 / (download) - annotate - [select for diffs], Tue Sep 14 22:26:09 2004 UTC (19 years, 8 months ago) by henning
Branch: MAIN
Changes since 1.23: +2 -2 lines
Diff to previous 1.23 (colored)

treat ENOBUFS like EAGAIN and try later

Revision 1.23 / (download) - annotate - [select for diffs], Tue Aug 17 15:59:34 2004 UTC (19 years, 9 months ago) by henning
Branch: MAIN
CVS Tags: OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.22: +5 -4 lines
Diff to previous 1.22 (colored)

when sending a file descriptor, close it on the receiving side in
buf_dequeue() instead of in msgbuf_write(). as sendmsg() might return
without having written all data (we're on nonblocking sockets), we
might have closed the fd before it actually got send.
tracked down after (completely independent, didn't even look related at all)
bug reports from Shaun O'Neil <shaun@dma.nl> and
Arvid Grtting <arvidg@netfonds.no>, claudio ok

Revision 1.22 / (download) - annotate - [select for diffs], Sat Jul 3 17:19:59 2004 UTC (19 years, 11 months ago) by claudio
Branch: MAIN
Changes since 1.21: +1 -2 lines
Diff to previous 1.21 (colored)

Switch mrt dumping to fd passing. This gives some speed up when extensive
dumping is done. Acctually mrt dumps were broken because of the fd passing.
The nice side effect is a much cleaner code, especially in the parent process.
OK henning@

Revision 1.21 / (download) - annotate - [select for diffs], Sun Jun 20 18:35:12 2004 UTC (19 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.20: +5 -5 lines
Diff to previous 1.20 (colored)

at least somewhat consistently name the TAILQ_ENTRYs... this confused me
more than once

Revision 1.20 / (download) - annotate - [select for diffs], Sun Jun 20 18:03:26 2004 UTC (19 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.19: +2 -4 lines
Diff to previous 1.19 (colored)

argh, don't want to shutdown the socket in the parent after sending,
just plain close

Revision 1.19 / (download) - annotate - [select for diffs], Sun Jun 20 17:49:46 2004 UTC (19 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.18: +27 -2 lines
Diff to previous 1.18 (colored)

implement file descriptor passing in the imsg/msgbuf framework, and use
it to let the main process to prepare new listening sockets (socket() and
bind()) on behalf of the session engine, which of course cannot bind() to
ports < 1024 any more once it dropped privileges. with some help from theo,
claudio ok

Revision 1.18 / (download) - annotate - [select for diffs], Thu Apr 29 19:56:04 2004 UTC (20 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.17: +4 -4 lines
Diff to previous 1.17 (colored)

sock -> fd; ok henning

Revision 1.17 / (download) - annotate - [select for diffs], Thu Feb 19 13:54:58 2004 UTC (20 years, 3 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_3_5_BASE, OPENBSD_3_5
Changes since 1.16: +2 -1 lines
Diff to previous 1.16 (colored)

Make the code more portable. Add some missing header files and make the use
of the queue(3) makros more portable. OK henning@ some time ago.

Revision 1.16 / (download) - annotate - [select for diffs], Tue Feb 17 22:41:40 2004 UTC (20 years, 3 months ago) by henning
Branch: MAIN
Changes since 1.15: +3 -7 lines
Diff to previous 1.15 (colored)

little easier

Revision 1.15 / (download) - annotate - [select for diffs], Tue Feb 17 16:25:16 2004 UTC (20 years, 3 months ago) by henning
Branch: MAIN
Changes since 1.14: +2 -1 lines
Diff to previous 1.14 (colored)

missing bzero() of the iovec

Revision 1.14 / (download) - annotate - [select for diffs], Sat Jan 10 23:25:44 2004 UTC (20 years, 4 months ago) by henning
Branch: MAIN
Changes since 1.13: +36 -8 lines
Diff to previous 1.13 (colored)

use writev(2) to get as many messages out at once as possible.
should gives us a little exra performance gain

ok claudio@

Revision 1.13 / (download) - annotate - [select for diffs], Sat Jan 10 21:02:54 2004 UTC (20 years, 4 months ago) by henning
Branch: MAIN
Changes since 1.12: +8 -25 lines
Diff to previous 1.12 (colored)

we may only write after a POLLOUT, and then, we only may write once.
if we don't play by these rules the next write may block.
make us adhere.

ok claudio@

Revision 1.12 / (download) - annotate - [select for diffs], Tue Jan 6 03:43:50 2004 UTC (20 years, 5 months ago) by henning
Branch: MAIN
Changes since 1.11: +2 -2 lines
Diff to previous 1.11 (colored)

2004

Revision 1.11 / (download) - annotate - [select for diffs], Mon Jan 5 22:57:59 2004 UTC (20 years, 5 months ago) by claudio
Branch: MAIN
Changes since 1.10: +41 -2 lines
Diff to previous 1.10 (colored)

Big overhaul of the mrt code.
Dumping of incomming bgp messages is now possible and dumping the (not yet)
filtered updates works too. Per neighbor dumps are still missing.
OK henning@

Revision 1.10 / (download) - annotate - [select for diffs], Fri Dec 26 17:13:52 2003 UTC (20 years, 5 months ago) by henning
Branch: MAIN
Changes since 1.9: +4 -2 lines
Diff to previous 1.9 (colored)

need to clean errno before returning error in the custom case

Revision 1.9 / (download) - annotate - [select for diffs], Wed Dec 24 13:28:01 2003 UTC (20 years, 5 months ago) by henning
Branch: MAIN
Changes since 1.8: +10 -10 lines
Diff to previous 1.8 (colored)

handle write() returning 0 correctly, adjust the msgbuf API appropriately,
and make all callers cope.

Revision 1.8 / (download) - annotate - [select for diffs], Tue Dec 23 19:14:49 2003 UTC (20 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.7: +2 -2 lines
Diff to previous 1.7 (colored)

spacing

Revision 1.7 / (download) - annotate - [select for diffs], Sun Dec 21 23:48:46 2003 UTC (20 years, 5 months ago) by henning
Branch: MAIN
Changes since 1.6: +2 -8 lines
Diff to previous 1.6 (colored)

sync comments with reality and shorten a bit where appropriate

Revision 1.6 / (download) - annotate - [select for diffs], Sun Dec 21 22:16:53 2003 UTC (20 years, 5 months ago) by henning
Branch: MAIN
Changes since 1.5: +40 -67 lines
Diff to previous 1.5 (colored)

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@

Revision 1.5 / (download) - annotate - [select for diffs], Sun Dec 21 18:04:08 2003 UTC (20 years, 5 months ago) by claudio
Branch: MAIN
Changes since 1.4: +9 -7 lines
Diff to previous 1.4 (colored)

don't try to write out data immediately if there are queued writes.
OK henning@

Revision 1.4 / (download) - annotate - [select for diffs], Sun Dec 21 16:11:33 2003 UTC (20 years, 5 months ago) by claudio
Branch: MAIN
Changes since 1.3: +3 -3 lines
Diff to previous 1.3 (colored)

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@

Revision 1.3 / (download) - annotate - [select for diffs], Sat Dec 20 21:14:55 2003 UTC (20 years, 5 months ago) by henning
Branch: MAIN
Changes since 1.2: +2 -2 lines
Diff to previous 1.2 (colored)

let buf_add take void *data instead of u_char *data and save a zillion
evil casts

Revision 1.2 / (download) - annotate - [select for diffs], Sat Dec 20 14:33:09 2003 UTC (20 years, 5 months ago) by henning
Branch: MAIN
Changes since 1.1: +5 -5 lines
Diff to previous 1.1 (colored)

read(2)/write(2) return ssize_t, not size_t

Revision 1.1 / (download) - annotate - [select for diffs], Wed Dec 17 11:46:54 2003 UTC (20 years, 5 months ago) by henning
Branch: MAIN

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.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.