From 506fa1a73eab0c6426f68cd7784c6712898b88f3 Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Sun, 2 May 2010 22:41:40 +0200 Subject: Merge several fixes suggested by Joakim Tjernlund. --- proto/bgp/packets.c | 1 + proto/ospf/lsalib.c | 2 +- proto/ospf/lsalib.h | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) (limited to 'proto') diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c index af7ce0c..2160182 100644 --- a/proto/bgp/packets.c +++ b/proto/bgp/packets.c @@ -1050,6 +1050,7 @@ static struct { { 2, 5, "Authentication failure" }, { 2, 6, "Unacceptable hold time" }, { 2, 7, "Required capability missing" }, /* [RFC3392] */ + { 2, 8, "No supported AFI/SAFI" }, /* This error msg is nonstandard */ { 3, 0, "Invalid UPDATE message" }, { 3, 1, "Malformed attribute list" }, { 3, 2, "Unrecognized well-known attribute" }, diff --git a/proto/ospf/lsalib.c b/proto/ospf/lsalib.c index 27a0148..2f52fe9 100644 --- a/proto/ospf/lsalib.c +++ b/proto/ospf/lsalib.c @@ -240,7 +240,7 @@ lsasum_check(struct ospf_lsa_header *h, void *body) c1 %= 255; } - x = ((length - LSA_CHECKSUM_OFFSET) * c0 - c1) % 255; + x = (int)((length - LSA_CHECKSUM_OFFSET) * c0 - c1) % 255; if (x <= 0) x += 255; y = 510 - c0 - x; diff --git a/proto/ospf/lsalib.h b/proto/ospf/lsalib.h index f98a1bd..8a949d8 100644 --- a/proto/ospf/lsalib.h +++ b/proto/ospf/lsalib.h @@ -13,8 +13,8 @@ #ifdef CPU_BIG_ENDIAN static inline void htonlsah(struct ospf_lsa_header *h, struct ospf_lsa_header *n) { *n = *h; }; static inline void ntohlsah(struct ospf_lsa_header *n, struct ospf_lsa_header *h) { *h = *n; }; -static inline void htonlsab(void *h, void *n, u16 len) { memcpy(n, h, len); }; -static inline void ntohlsab(void *n, void *h, u16 len) { memcpy(h, n, len); }; +static inline void htonlsab(void *h, void *n, u16 len) { ASSERT(h != n); memcpy(n, h, len); }; +static inline void ntohlsab(void *n, void *h, u16 len) { ASSERT(n != h); memcpy(h, n, len); }; static inline void htonlsab1(void *h, u16 len) { }; static inline void ntohlsab1(void *n, u16 len) { }; #else -- cgit v1.2.3