diff options
author | Esben Norby <norby@cvs.openbsd.org> | 2006-06-17 16:53:34 +0000 |
---|---|---|
committer | Esben Norby <norby@cvs.openbsd.org> | 2006-06-17 16:53:34 +0000 |
commit | 15293dcfac00606b3265dbb7492b8303e2b0e048 (patch) | |
tree | 05bec10bf7225abdb5256a4932d9fb4c8126d6ba | |
parent | cd7957aff14a5d33d9b7ce0e3862dc6020686d60 (diff) |
make dvmrpd(8) behave correctly on sparc64 when generating and parsing
route reports.
help from claudio@
-rw-r--r-- | usr.sbin/dvmrpd/report.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.sbin/dvmrpd/report.c b/usr.sbin/dvmrpd/report.c index b034c26658c..9aef66217f9 100644 --- a/usr.sbin/dvmrpd/report.c +++ b/usr.sbin/dvmrpd/report.c @@ -1,4 +1,4 @@ -/* $OpenBSD: report.c,v 1.2 2006/06/02 15:43:16 norby Exp $ */ +/* $OpenBSD: report.c,v 1.3 2006/06/17 16:53:33 norby Exp $ */ /* * Copyright (c) 2005, 2006 Esben Norby <norby@openbsd.org> @@ -107,7 +107,9 @@ recv_report(struct nbr *nbr, char *buf, u_int16_t len) /* read four bytes */ memcpy(&netmask, buf, sizeof(netmask)); /* ditch one byte, since we only need three */ - netmask = netmask << 8; + netmask = ntohl(netmask) >> 8; + netmask = htonl(netmask); + /* set the highest byte to 255 */ netmask = netmask | htonl(0xff000000); buf += 3; @@ -245,7 +247,8 @@ rr_list_send(struct rr_head *rr_list, struct iface *xiface, struct nbr *nbr) netmask = le->re->mask.s_addr; if (prefixlen != mask2prefixlen(netmask)) { prefixlen = mask2prefixlen(netmask); - netmask = netmask >> 8; + netmask = ntohl(netmask) << 8; + netmask = htonl(netmask); buf_add(buf, &netmask, 3); } netid_len = PREFIX_SIZE(prefixlen); |