OpenBSD CVS

CVS log for src/usr.sbin/ntpd/Attic/imsg.c


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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.21, Wed May 26 16:44:32 2010 UTC (14 years ago) by nicm
Branch: MAIN
CVS Tags: HEAD
Changes since 1.20: +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.20 / (download) - annotate - [select for diffs], Wed May 26 13:56:08 2010 UTC (14 years ago) by nicm
Branch: MAIN
Changes since 1.19: +11 -11 lines
Diff to previous 1.19 (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.19 / (download) - annotate - [select for diffs], Wed Apr 7 18:09:39 2010 UTC (14 years, 1 month ago) by nicm
Branch: MAIN
Changes since 1.18: +2 -2 lines
Diff to previous 1.18 (colored)

Remove XXX comment and just close received fd if calloc() fails.

If this happens the imsg may no longer be usable as there may be queued
messages, but this is a) already the case with the code now, and b)
would be the case if recvmsg() fails anyway, so we can document that -1
from imsg_read() invalidates the struct imsgbuf.

discussed with and ok eric

Revision 1.18 / (download) - annotate - [select for diffs], Sat Aug 8 18:33:40 2009 UTC (14 years, 9 months ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.17: +6 -3 lines
Diff to previous 1.17 (colored)

Make imsg_clear close and free any fds in the received fd queue as well as
freeing the msgbuf.

While here also remove an unnecessary while loop.

ok eric pyr

Revision 1.17 / (download) - annotate - [select for diffs], Mon Jun 8 08:30:06 2009 UTC (14 years, 11 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6
Changes since 1.16: +4 -11 lines
Diff to previous 1.16 (colored)

revert this change by eric@:

Make the imsg protocol network-safe.


it might be network safe, but half the imsg based daemons on my firewalls
dont run anymore.

Revision 1.16 / (download) - annotate - [select for diffs], Sun Jun 7 05:56:25 2009 UTC (14 years, 11 months ago) by eric
Branch: MAIN
Changes since 1.15: +15 -3 lines
Diff to previous 1.15 (colored)

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@

Revision 1.15 / (download) - annotate - [select for diffs], Sun Jun 7 00:40:46 2009 UTC (14 years, 11 months ago) by eric
Branch: MAIN
Changes since 1.14: +11 -3 lines
Diff to previous 1.14 (colored)

Make the imsg protocol network-safe.

ok pyr@

Revision 1.14 / (download) - annotate - [select for diffs], Sat Jun 6 22:11:25 2009 UTC (14 years, 11 months ago) by eric
Branch: MAIN
Changes since 1.13: +4 -3 lines
Diff to previous 1.13 (colored)

change the imsg header fields a bit to prepare for upcoming changes.
add a flag field, use u_int32_t for pid_t and extend type to 32 bits
for padding.

ok pyr@

Revision 1.13 / (download) - annotate - [select for diffs], Sat Jun 6 18:14:25 2009 UTC (14 years, 11 months ago) by pyr
Branch: MAIN
Changes since 1.12: +121 -37 lines
Diff to previous 1.12 (colored)

make ntpd imsg-in-a-lib ready as well. extensive testing done, no
behavior change.
ok eric@

Revision 1.12 / (download) - annotate - [select for diffs], Mon Mar 19 10:03:25 2007 UTC (17 years, 2 months ago) by henning
Branch: MAIN
CVS Tags: OPENBSD_4_5_BASE, OPENBSD_4_5, OPENBSD_4_4_BASE, OPENBSD_4_4, OPENBSD_4_3_BASE, OPENBSD_4_3, OPENBSD_4_2_BASE, OPENBSD_4_2
Changes since 1.11: +2 -2 lines
Diff to previous 1.11 (colored)

when our red/recv/recvmsg in imsg_read gives EINTR or EAGAIN, do not
signal "connection closed" upstream.
spotted by Valentin Kozamernik <tin@komna.com>

Revision 1.11 / (download) - annotate - [select for diffs], Tue Apr 26 15:18:22 2005 UTC (19 years, 1 month ago) by henning
Branch: MAIN
CVS Tags: OPENBSD_4_1_BASE, OPENBSD_4_1, OPENBSD_4_0_BASE, OPENBSD_4_0, OPENBSD_3_9_BASE, OPENBSD_3_9, OPENBSD_3_8_BASE, OPENBSD_3_8
Changes since 1.10: +3 -2 lines
Diff to previous 1.10 (colored)

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

Revision 1.10 / (download) - annotate - [select for diffs], Wed Mar 23 10:42:04 2005 UTC (19 years, 2 months ago) by henning
Branch: MAIN
Changes since 1.9: +2 -3 lines
Diff to previous 1.9 (colored)

wpos in struct buf_read and datalen in imsg_get should be size_t and not
ssize_t
From: Alexander von Gernler <grunk@pestilenz.org>

Revision 1.9 / (download) - annotate - [select for diffs], Wed Mar 9 14:07:00 2005 UTC (19 years, 2 months ago) by henning
Branch: MAIN
CVS Tags: OPENBSD_3_7_BASE, OPENBSD_3_7
Changes since 1.8: +2 -2 lines
Diff to previous 1.8 (colored)

when, after processing all complete imsgs we found in the buffer,
there are some bytes left (less than an imsg header, or less than the
imsg header len field says) we copy it to the very beginning of the buffer.
use memmove instead of memcpy since it is not guaranteed that there's no
overlap. while memcpy on OpenBSD is safe, it might not elsewhere, and
we want our code to be correct anyways.
funny enough theo and I talked at length about that last week in dublin,
and I said I believe I had no memcpys with the chance of overlap in ntpd/bgpd -
well, here is one, and Alexander von Gernler <grunk@pestilenz.org> pointed
me to it.

Revision 1.8 / (download) - annotate - [select for diffs], Sun Mar 6 18:36:52 2005 UTC (19 years, 3 months ago) by henning
Branch: MAIN
Changes since 1.7: +2 -2 lines
Diff to previous 1.7 (colored)

fix error message, Benedikt Steinbusch <bsteinb@hamazone.de>

Revision 1.7 / (download) - annotate - [select for diffs], Thu Sep 16 01:13:42 2004 UTC (19 years, 8 months ago) by henning
Branch: MAIN
Changes since 1.6: +4 -4 lines
Diff to previous 1.6 (colored)

the "type" param to imsg_compose and imsg_create is really an
enum imsg_type and not an int

Revision 1.6 / (download) - annotate - [select for diffs], Thu Sep 16 01:10:05 2004 UTC (19 years, 8 months ago) by henning
Branch: MAIN
Changes since 1.5: +5 -9 lines
Diff to previous 1.5 (colored)

in imsg_compose:
-don't buf_free() on imsg_add() errors, it already does that for us
-use imsg_close() instead of buf_close(), does error handling already

Revision 1.5 / (download) - annotate - [select for diffs], Thu Sep 16 01:06:51 2004 UTC (19 years, 8 months ago) by henning
Branch: MAIN
Changes since 1.4: +4 -7 lines
Diff to previous 1.4 (colored)

use imsg_add instead of the lower level buf_add in imsg_create; it already
does the error checking for us.

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

ewps...

Revision 1.3 / (download) - annotate - [select for diffs], Wed Sep 15 19:22:55 2004 UTC (19 years, 8 months ago) by henning
Branch: MAIN
Changes since 1.2: +2 -2 lines
Diff to previous 1.2 (colored)

need buf_free() to free buf, free() is not good enough

Revision 1.2 / (download) - annotate - [select for diffs], Wed Sep 15 19:21:25 2004 UTC (19 years, 8 months ago) by henning
Branch: MAIN
Changes since 1.1: +16 -54 lines
Diff to previous 1.1 (colored)

imsg framework cleanup:
-kill the _pid flavors of imsg_create and imsg_compose, and just add pid as
argument to those
-use imsg_create in imsg_compose instead of duplicating code
-check for datalen overflow

Revision 1.1 / (download) - annotate - [select for diffs], Mon May 31 13:46:16 2004 UTC (20 years ago) by henning
Branch: MAIN
CVS Tags: OPENBSD_3_6_BASE, OPENBSD_3_6

initial cut at ntpd.
it is just capable of answering (s)ntp4 requests with the local time
for now.
imsg/buffer and logging framework from bgpd, ntp protocol hackery
with Alexander Guy

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.