diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2009-01-31 11:44:50 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2009-01-31 11:44:50 +0000 |
commit | aab8bd8146ab6ed527a15237258b32eea04587ab (patch) | |
tree | 48d81fe534d0fc5c7f36bd2ebea50d0de2f90692 /usr.sbin/ospfd/lsreq.c | |
parent | eb527a8af6bced89a36bf8d8a2c6417207e3bdf0 (diff) |
Implement buf_left() to make some some more buffer handling easier.
buf_left() returns the bytes left in a buffer. This makes the check to
keep MD5_DIGEST_LENGTH bytes unallocated in some messages easier.
From the buf cleanup diff that was OK norby@ and henning@
Diffstat (limited to 'usr.sbin/ospfd/lsreq.c')
-rw-r--r-- | usr.sbin/ospfd/lsreq.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.sbin/ospfd/lsreq.c b/usr.sbin/ospfd/lsreq.c index a7cc9358c43..757e1f0ca4f 100644 --- a/usr.sbin/ospfd/lsreq.c +++ b/usr.sbin/ospfd/lsreq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lsreq.c,v 1.15 2009/01/31 08:55:00 claudio Exp $ */ +/* $OpenBSD: lsreq.c,v 1.16 2009/01/31 11:44:49 claudio Exp $ */ /* * Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org> @@ -66,8 +66,8 @@ send_ls_req(struct nbr *nbr) /* LSA header(s), keep space for a possible md5 sum */ for (le = TAILQ_FIRST(&nbr->ls_req_list); le != NULL && - buf->wpos + sizeof(struct ls_req_hdr) < buf->max - - MD5_DIGEST_LENGTH; le = nle) { + buf_left(buf) >= sizeof(struct ls_req_hdr) + MD5_DIGEST_LENGTH; + le = nle) { nbr->ls_req = nle = TAILQ_NEXT(le, entry); ls_req_hdr.type = htonl(le->le_lsa->type); ls_req_hdr.ls_id = le->le_lsa->ls_id; |