diff options
Diffstat (limited to 'usr.sbin/ospfd/auth.c')
-rw-r--r-- | usr.sbin/ospfd/auth.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/usr.sbin/ospfd/auth.c b/usr.sbin/ospfd/auth.c index cbb439ea43b..4e92a50b029 100644 --- a/usr.sbin/ospfd/auth.c +++ b/usr.sbin/ospfd/auth.c @@ -1,4 +1,4 @@ -/* $OpenBSD: auth.c,v 1.14 2008/07/24 18:46:59 claudio Exp $ */ +/* $OpenBSD: auth.c,v 1.15 2009/03/04 12:51:01 claudio Exp $ */ /* * Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org> @@ -148,18 +148,18 @@ auth_gen(struct buf *buf, struct iface *iface) fatalx("auth_gen: buf_seek failed"); /* update length */ - if (buf->wpos > USHRT_MAX) + if (buf_size(buf) > USHRT_MAX) fatalx("auth_gen: resulting ospf packet too big"); - ospf_hdr->len = htons((u_int16_t)buf->wpos); + ospf_hdr->len = htons(buf_size(buf)); /* clear auth_key field */ bzero(ospf_hdr->auth_key.simple, sizeof(ospf_hdr->auth_key.simple)); switch (iface->auth_type) { case AUTH_NONE: - ospf_hdr->chksum = in_cksum(buf->buf, buf->wpos); + ospf_hdr->chksum = in_cksum(buf->buf, buf_size(buf)); break; case AUTH_SIMPLE: - ospf_hdr->chksum = in_cksum(buf->buf, buf->wpos); + ospf_hdr->chksum = in_cksum(buf->buf, buf_size(buf)); strncpy(ospf_hdr->auth_key.simple, iface->auth_key, sizeof(ospf_hdr->auth_key.simple)); @@ -184,7 +184,7 @@ auth_gen(struct buf *buf, struct iface *iface) /* calculate MD5 digest */ MD5Init(&hash); - MD5Update(&hash, buf->buf, buf->wpos); + MD5Update(&hash, buf->buf, buf_size(buf)); MD5Update(&hash, digest, MD5_DIGEST_LENGTH); MD5Final(digest, &hash); |