diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-12-19 01:15:48 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-12-19 01:15:48 +0000 |
commit | ec1fb2912679b6814d9648c48a253a21b64a17da (patch) | |
tree | 20ef8e8dc4b1bf9b4a5744d6ff23f2cfafccb6ae | |
parent | 7f7182b97c1a62bb6ba9ded47fa72f576864ae6c (diff) |
knf & 64-bit cleanup; henning ok
-rw-r--r-- | usr.sbin/bgpd/mrt.c | 5 | ||||
-rw-r--r-- | usr.sbin/bgpd/rde.c | 14 | ||||
-rw-r--r-- | usr.sbin/bgpd/rde.h | 12 | ||||
-rw-r--r-- | usr.sbin/bgpd/rde_rib.c | 24 | ||||
-rw-r--r-- | usr.sbin/bgpd/session.c | 4 |
5 files changed, 31 insertions, 28 deletions
diff --git a/usr.sbin/bgpd/mrt.c b/usr.sbin/bgpd/mrt.c index 9ffbe386498..db4fd8aa06d 100644 --- a/usr.sbin/bgpd/mrt.c +++ b/usr.sbin/bgpd/mrt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mrt.c,v 1.1 2003/12/17 11:46:54 henning Exp $ */ +/* $OpenBSD: mrt.c,v 1.2 2003/12/19 01:15:47 deraadt Exp $ */ /* * Copyright (c) 2003 Claudio Jeker <cjeker@diehard.n-r-g.com> @@ -174,7 +174,8 @@ void mrt_dump_upcall(struct pt_entry *pt, int fd, int *wait, void *arg) { struct prefix *p; - u_int32_t id = (u_int32_t)(u_long)arg; + u_int32_t *idp = arg; + u_int32_t id = *idp; /* * dump all prefixes even the inactive ones. That is the way zebra diff --git a/usr.sbin/bgpd/rde.c b/usr.sbin/bgpd/rde.c index 1fda1e3161e..3f6c492d83c 100644 --- a/usr.sbin/bgpd/rde.c +++ b/usr.sbin/bgpd/rde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.c,v 1.5 2003/12/19 01:13:34 henning Exp $ */ +/* $OpenBSD: rde.c,v 1.6 2003/12/19 01:15:47 deraadt Exp $ */ /* * Copyright (c) 2003 Henning Brauer <henning@openbsd.org> @@ -172,7 +172,7 @@ rde_dispatch_imsg(int fd, int idx) { struct imsg imsg; struct peer_config *pconf; - struct rde_peer *p; + struct rde_peer *p; u_int32_t rid; int reconf; @@ -210,7 +210,7 @@ rde_dispatch_imsg(int fd, int idx) if (nconf == NULL) fatal("got IMSG_RECONF_DONE but no config", 0); /* Just remove deleted peers, new peers need no action - * and merged peers neither. If the SE needs to drop + * and merged peers neither. If the SE needs to drop * the current session and reopen a new one we get a * DOWN/UP request. We tag the deleted peers and * remove them in peer_down. @@ -248,7 +248,7 @@ rde_dispatch_imsg(int fd, int idx) if (idx != PFD_PIPE_MAIN) fatal("mrt request not from parent", 0); pt_dump(mrt_dump_upcall, fd, &main_queued_writes, - (void *)imsg.hdr.peerid); + &imsg.hdr.peerid); /* FALLTHROUGH */ case IMSG_MRT_END: if (idx != PFD_PIPE_MAIN) @@ -584,7 +584,7 @@ peer_add(u_int32_t id, struct peer_config *p_conf) LIST_INSERT_HEAD(head, peer, hash_l); LIST_INSERT_HEAD(&peerlist, peer, peer_l); - + return (peer); } @@ -593,10 +593,10 @@ peer_remove(struct rde_peer *peer) { ENSURE(peer_get(peer->conf.id) != NULL); ENSURE(LIST_EMPTY(&peer->path_h)); - + LIST_REMOVE(peer, hash_l); LIST_REMOVE(peer, peer_l); - + free(peer); } diff --git a/usr.sbin/bgpd/rde.h b/usr.sbin/bgpd/rde.h index fd1bce12ea4..769f18da464 100644 --- a/usr.sbin/bgpd/rde.h +++ b/usr.sbin/bgpd/rde.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.h,v 1.2 2003/12/18 22:22:22 claudio Exp $ */ +/* $OpenBSD: rde.h,v 1.3 2003/12/19 01:15:47 deraadt Exp $ */ /* * Copyright (c) 2003 Claudio Jeker <cjeker@diehard.n-r-g.com> and @@ -135,11 +135,11 @@ struct attr_flags { struct aspath *aspath; struct astags *astags; struct in_addr nexthop; - u_int32_t med; /* multi exit disc */ - u_int32_t lpref; /* local pref */ - u_int8_t aggr_atm; /* atomic aggregate */ - u_int16_t aggr_as; /* aggregator as */ - struct in_addr aggr_ip; /* aggregator ip */ + u_int32_t med; /* multi exit disc */ + u_int32_t lpref; /* local pref */ + u_int8_t aggr_atm; /* atomic aggregate */ + u_int16_t aggr_as; /* aggregator as */ + struct in_addr aggr_ip; /* aggregator ip */ }; enum nexthop_state { diff --git a/usr.sbin/bgpd/rde_rib.c b/usr.sbin/bgpd/rde_rib.c index 16e6b72e9bd..8727bdbbac6 100644 --- a/usr.sbin/bgpd/rde_rib.c +++ b/usr.sbin/bgpd/rde_rib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde_rib.c,v 1.1 2003/12/17 11:46:54 henning Exp $ */ +/* $OpenBSD: rde_rib.c,v 1.2 2003/12/19 01:15:47 deraadt Exp $ */ /* * Copyright (c) 2003 Claudio Jeker <cjeker@diehard.n-r-g.com> @@ -21,6 +21,7 @@ #include <errno.h> #include <stdlib.h> +#include <string.h> #include "bgpd.h" #include "ensure.h" @@ -79,15 +80,16 @@ struct rib_stats { int attr_equal(struct attr_flags *a, struct attr_flags *b) { - if (a->origin != b->origin) return 0; - if (aspath_equal(a->aspath, b->aspath) == 0) return 0; /* astags not yet used */ - if (a->nexthop.s_addr != b->nexthop.s_addr) return 0; - if (a->med != b->med) return 0; - if (a->lpref != b->lpref) return 0; - if (a->aggr_atm != b->aggr_atm) return 0; - if (a->aggr_as != b->aggr_as) return 0; - if (a->aggr_ip.s_addr != b->aggr_ip.s_addr) return 0; + if (a->origin != b->origin || + aspath_equal(a->aspath, b->aspath) == 0 || + a->nexthop.s_addr != b->nexthop.s_addr || + a->med != b->med || + a->lpref != b->lpref || + a->aggr_atm != b->aggr_atm || + a->aggr_as != b->aggr_as || + a->aggr_ip.s_addr != b->aggr_ip.s_addr) + return 0; return 1; } @@ -111,7 +113,7 @@ attr_length(struct attr_flags *attr) alen = 4 /* origin */ + 7 /* nexthop */ + 7 /* lpref */; plen = aspath_length(attr->aspath); - alen += 2 + plen + (plen>255?2:1); + alen += 2 + plen + (plen > 255 ? 2 : 1); if (attr->med != 0) alen += 7; if (attr->aggr_atm == 1) @@ -397,7 +399,7 @@ path_update(struct rde_peer *peer, struct attr_flags *attrs, } else { if (attr_equal(&asp->flags, attrs) == 0) { if ((p = prefix_get(asp, - prefix, prefixlen)) == NULL) { + prefix, prefixlen)) == NULL) { asp = path_add(peer, attrs); pte = prefix_add(asp, prefix, prefixlen); } else { diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c index 105ed4e44a1..457a0ded25a 100644 --- a/usr.sbin/bgpd/session.c +++ b/usr.sbin/bgpd/session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: session.c,v 1.4 2003/12/18 18:56:23 henning Exp $ */ +/* $OpenBSD: session.c,v 1.5 2003/12/19 01:15:47 deraadt Exp $ */ /* * Copyright (c) 2003 Henning Brauer <henning@openbsd.org> @@ -955,7 +955,7 @@ session_dispatch_msg(struct pollfd *pfd, struct peer *peer) session_notification(peer, ERR_HEADER, ERR_HDR_TYPE, (u_char *)&peer->rbuf->type, - 1); + 1); logit(LOG_CRIT, "received message with " "unknown type %u", |