diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2005-02-08 12:56:49 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2005-02-08 12:56:49 +0000 |
commit | 5b3ed4f761de8749a1b214cf758da3fa41004bde (patch) | |
tree | 752d3dffbd971bf883c9c3a80604addbb47b5746 /usr.sbin/ospfd/rde_lsdb.c | |
parent | b446f1a72b19951eed072490294f1706b8d57e66 (diff) |
The LSA seq_num should be unsigned as it is expected by ntohl/htonl() even
though the seq_num needs to be compared as signed number.
No idea how IETF came up with such a stupid idea especially because the
seq_num is not allowed to wrap.
requested by henning@ OK henning@
Diffstat (limited to 'usr.sbin/ospfd/rde_lsdb.c')
-rw-r--r-- | usr.sbin/ospfd/rde_lsdb.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.sbin/ospfd/rde_lsdb.c b/usr.sbin/ospfd/rde_lsdb.c index 90935138e51..eafb5ed0502 100644 --- a/usr.sbin/ospfd/rde_lsdb.c +++ b/usr.sbin/ospfd/rde_lsdb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde_lsdb.c,v 1.5 2005/02/07 05:51:00 david Exp $ */ +/* $OpenBSD: rde_lsdb.c,v 1.6 2005/02/08 12:56:48 claudio Exp $ */ /* * Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org> @@ -110,6 +110,10 @@ lsa_newer(struct lsa_hdr *a, struct lsa_hdr *b) if (b == NULL) return (1); + /* + * The sequnece number is defined as signed 32-bit integer, + * no idea how IETF came up with such a stupid idea. + */ a32 = (int32_t)ntohl(a->seq_num); b32 = (int32_t)ntohl(b->seq_num); @@ -169,7 +173,7 @@ lsa_check(struct rde_nbr *nbr, struct lsa *lsa, u_int16_t len) } /* invalid sequence number */ - if (ntohl(lsa->hdr.seq_num) == 0x80000000) { + if (ntohl(lsa->hdr.seq_num) == RESV_SEQ_NUM) { log_debug("ls_check: bad seq num"); return (0); } |