summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2004-04-27 04:38:13 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2004-04-27 04:38:13 +0000
commit138245b770337f4f15b26500be09ccf841f293b2 (patch)
tree7860ee5498fe878b97b62da62c0b2300726f7103 /usr.sbin/bgpd
parent4298542c4bf89c4aaca4f684dc82477579541fbe (diff)
crud stripping; henning ok
Diffstat (limited to 'usr.sbin/bgpd')
-rw-r--r--usr.sbin/bgpd/bgpd.c10
-rw-r--r--usr.sbin/bgpd/kroute.c5
-rw-r--r--usr.sbin/bgpd/parse.y6
-rw-r--r--usr.sbin/bgpd/pfkey.c4
-rw-r--r--usr.sbin/bgpd/rde.c8
-rw-r--r--usr.sbin/bgpd/session.c30
6 files changed, 31 insertions, 32 deletions
diff --git a/usr.sbin/bgpd/bgpd.c b/usr.sbin/bgpd/bgpd.c
index 97cd853048d..7805c0a71de 100644
--- a/usr.sbin/bgpd/bgpd.c
+++ b/usr.sbin/bgpd/bgpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpd.c,v 1.89 2004/04/25 17:34:39 claudio Exp $ */
+/* $OpenBSD: bgpd.c,v 1.90 2004/04/27 04:38:12 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -104,7 +104,7 @@ main(int argc, char *argv[])
pid_t io_pid = 0, rde_pid = 0, pid;
char *conffile;
int debug = 0;
- int ch, i, j, n, nfds, timeout;
+ int ch, i, j, nfds, timeout;
int pipe_m2s[2];
int pipe_m2r[2];
int pipe_s2r[2];
@@ -247,13 +247,13 @@ main(int argc, char *argv[])
}
if (nfds > 0 && (pfd[PFD_PIPE_SESSION].revents & POLLOUT))
- if ((n = msgbuf_write(&ibuf_se.w)) < 0) {
+ if (msgbuf_write(&ibuf_se.w) < 0) {
log_warn("pipe write error (to SE)");
quit = 1;
}
if (nfds > 0 && (pfd[PFD_PIPE_ROUTE].revents & POLLOUT))
- if ((n = msgbuf_write(&ibuf_rde.w)) < 0) {
+ if (msgbuf_write(&ibuf_rde.w) < 0) {
log_warn("pipe write error (to RDE)");
quit = 1;
}
@@ -280,7 +280,7 @@ main(int argc, char *argv[])
for (j = PFD_MRT_START; j < i && nfds > 0 ; j++) {
if (pfd[j].revents & POLLOUT) {
- if ((n = mrt_write(mrt[j])) < 0) {
+ if (mrt_write(mrt[j]) < 0) {
log_warn("mrt write error");
}
}
diff --git a/usr.sbin/bgpd/kroute.c b/usr.sbin/bgpd/kroute.c
index 652176e7edf..420c15c8867 100644
--- a/usr.sbin/bgpd/kroute.c
+++ b/usr.sbin/bgpd/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.92 2004/03/10 13:00:42 henning Exp $ */
+/* $OpenBSD: kroute.c,v 1.93 2004/04/27 04:38:12 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -922,7 +922,6 @@ send_rtmsg(int fd, int action, struct kroute *kroute)
struct sockaddr_in nexthop;
struct sockaddr_in mask;
} r;
- ssize_t n;
if (kr_state.fib_sync == 0)
return (0);
@@ -945,7 +944,7 @@ send_rtmsg(int fd, int action, struct kroute *kroute)
r.mask.sin_addr.s_addr = htonl(0xffffffff << (32 - kroute->prefixlen));
retry:
- if ((n = write(fd, &r, sizeof(r))) == -1) {
+ if (write(fd, &r, sizeof(r)) == -1) { /* XXX never partial? */
switch (errno) {
case ESRCH:
if (r.hdr.rtm_type == RTM_CHANGE) {
diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y
index 84681966635..4083a9bd81d 100644
--- a/usr.sbin/bgpd/parse.y
+++ b/usr.sbin/bgpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.87 2004/04/27 02:35:24 henning Exp $ */
+/* $OpenBSD: parse.y,v 1.88 2004/04/27 04:38:12 deraadt Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -318,7 +318,7 @@ address : STRING {
if (!host($1, &$$, &len)) {
yyerror("could not parse address spec \"%s\"",
- $1);
+ $1);
free($1);
YYERROR;
}
@@ -342,7 +342,7 @@ prefix : STRING '/' number {
if (!host(s, &$$.prefix, &$$.len)) {
yyerror("could not parse address \"%s/%u\"",
- $1, $3);
+ $1, $3);
free(s);
free($1);
YYERROR;
diff --git a/usr.sbin/bgpd/pfkey.c b/usr.sbin/bgpd/pfkey.c
index dc74a65bf2c..46947a4983c 100644
--- a/usr.sbin/bgpd/pfkey.c
+++ b/usr.sbin/bgpd/pfkey.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfkey.c,v 1.16 2004/04/26 09:35:39 markus Exp $ */
+/* $OpenBSD: pfkey.c,v 1.17 2004/04/27 04:38:12 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -61,7 +61,7 @@ pfkey_send(int sd, uint8_t satype, uint8_t mtype, uint8_t dir,
struct sadb_address sa_src, sa_dst, sa_peer, sa_smask, sa_dmask;
struct sadb_key sa_akey, sa_ekey;
struct sadb_spirange sa_spirange;
- struct sadb_protocol sa_protocol;
+ struct sadb_protocol sa_protocol;
struct iovec iov[IOV_CNT];
ssize_t n;
int len = 0;
diff --git a/usr.sbin/bgpd/rde.c b/usr.sbin/bgpd/rde.c
index 52be39ccf6b..d43677f2cce 100644
--- a/usr.sbin/bgpd/rde.c
+++ b/usr.sbin/bgpd/rde.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde.c,v 1.104 2004/04/25 17:34:39 claudio Exp $ */
+/* $OpenBSD: rde.c,v 1.105 2004/04/27 04:38:12 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -102,7 +102,7 @@ rde_main(struct bgpd_config *config, struct network_head *net_l,
struct passwd *pw;
struct mrt *m;
struct pollfd pfd[2];
- int n, nfds;
+ int nfds;
switch (pid = fork()) {
case -1:
@@ -177,7 +177,7 @@ rde_main(struct bgpd_config *config, struct network_head *net_l,
if (nfds > 0 && (pfd[PFD_PIPE_MAIN].revents & POLLOUT) &&
ibuf_main.w.queued)
- if ((n = msgbuf_write(&ibuf_main.w)) < 0)
+ if (msgbuf_write(&ibuf_main.w) < 0)
fatal("pipe write error");
if (nfds > 0 && pfd[PFD_PIPE_MAIN].revents & POLLIN) {
@@ -187,7 +187,7 @@ rde_main(struct bgpd_config *config, struct network_head *net_l,
if (nfds > 0 && (pfd[PFD_PIPE_SESSION].revents & POLLOUT) &&
ibuf_se.w.queued)
- if ((n = msgbuf_write(&ibuf_se.w)) < 0)
+ if (msgbuf_write(&ibuf_se.w) < 0)
fatal("pipe write error");
if (nfds > 0 && pfd[PFD_PIPE_SESSION].revents & POLLIN) {
diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c
index d00069e1026..b6f949b5a16 100644
--- a/usr.sbin/bgpd/session.c
+++ b/usr.sbin/bgpd/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.154 2004/04/27 04:06:58 henning Exp $ */
+/* $OpenBSD: session.c,v 1.155 2004/04/27 04:38:12 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -455,7 +455,7 @@ bgp_fsm(struct peer *peer, enum session_events event)
log_peer_warnx(&peer->conf,
"pfkey setup failed");
return;
- }
+ }
if (peer->conf.passive || peer->conf.template) {
change_state(peer, STATE_ACTIVE, event);
@@ -826,7 +826,7 @@ session_accept(int listenfd)
int
session_connect(struct peer *peer)
{
- int n, opt = 1;
+ int opt = 1;
struct sockaddr *sa;
/*
@@ -872,15 +872,15 @@ session_connect(struct peer *peer)
session_socket_blockmode(peer->sock, BM_NONBLOCK);
sa = addr2sa(&peer->conf.remote_addr, BGP_PORT);
- if ((n = connect(peer->sock, sa, sa->sa_len)) == -1)
+ if (connect(peer->sock, sa, sa->sa_len) == -1) {
if (errno != EINPROGRESS) {
log_peer_warn(&peer->conf, "connect");
bgp_fsm(peer, EVNT_CON_OPENFAIL);
return (-1);
}
+ }
- if (n == 0)
- bgp_fsm(peer, EVNT_CON_OPEN);
+ bgp_fsm(peer, EVNT_CON_OPEN);
return (0);
}
@@ -968,7 +968,7 @@ session_open(struct peer *p)
struct buf *buf;
struct mrt_config *mrt;
u_int16_t len;
- int errs = 0, n;
+ int errs = 0;
u_int8_t op_type, op_len = 0, optparamlen = 0;
u_int8_t capa_code, capa_len;
struct capa_mp capa_mp_v4;
@@ -1045,7 +1045,7 @@ session_open(struct peer *p)
&p->conf, conf);
}
- if ((n = buf_close(&p->wbuf, buf)) == -1) {
+ if (buf_close(&p->wbuf, buf) == -1) {
log_peer_warn(&p->conf, "session_open buf_close");
buf_free(buf);
bgp_fsm(p, EVNT_CON_FATAL);
@@ -1067,7 +1067,7 @@ session_keepalive(struct peer *peer)
struct buf *buf;
struct mrt_config *mrt;
ssize_t len;
- int errs = 0, n;
+ int errs = 0;
len = MSGSIZE_KEEPALIVE;
@@ -1098,7 +1098,7 @@ session_keepalive(struct peer *peer)
mrt_dump_bgp_msg(mrt, buf->buf, len, &peer->conf, conf);
}
- if ((n = buf_close(&peer->wbuf, buf)) == -1) {
+ if (buf_close(&peer->wbuf, buf) == -1) {
log_peer_warn(&peer->conf, "session_keepalive buf_close");
buf_free(buf);
bgp_fsm(peer, EVNT_CON_FATAL);
@@ -1117,7 +1117,7 @@ session_update(u_int32_t peerid, void *data, size_t datalen)
struct buf *buf;
struct mrt_config *mrt;
ssize_t len;
- int errs = 0, n;
+ int errs = 0;
if ((p = getpeerbyid(peerid)) == NULL) {
log_warnx("no such peer: id=%u", peerid);
@@ -1154,7 +1154,7 @@ session_update(u_int32_t peerid, void *data, size_t datalen)
mrt_dump_bgp_msg(mrt, buf->buf, len, &p->conf, conf);
}
- if ((n = buf_close(&p->wbuf, buf)) == -1) {
+ if (buf_close(&p->wbuf, buf) == -1) {
log_peer_warn(&p->conf, "session_update: buf_close");
buf_free(buf);
bgp_fsm(p, EVNT_CON_FATAL);
@@ -1173,7 +1173,7 @@ session_notification(struct peer *peer, u_int8_t errcode, u_int8_t subcode,
struct buf *buf;
struct mrt_config *mrt;
ssize_t len;
- int errs = 0, n;
+ int errs = 0;
len = MSGSIZE_NOTIFICATION_MIN + datalen;
@@ -1209,7 +1209,7 @@ session_notification(struct peer *peer, u_int8_t errcode, u_int8_t subcode,
mrt_dump_bgp_msg(mrt, buf->buf, len, &peer->conf, conf);
}
- if ((n = buf_close(&peer->wbuf, buf)) == -1) {
+ if (buf_close(&peer->wbuf, buf) == -1) {
log_peer_warn(&peer->conf, "session_notification: buf_close");
buf_free(buf);
bgp_fsm(peer, EVNT_CON_FATAL);
@@ -1609,7 +1609,7 @@ parse_open(struct peer *peer)
peer->IdleHoldTimer = time(NULL); /* no punish */
peer->IdleHoldTime /= 2;
return (-1);
- /* not reached */
+ /* not reached */
}
}