summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ripd
diff options
context:
space:
mode:
authorremi <remi@openbsd.org>2019-12-15 20:51:39 +0000
committerremi <remi@openbsd.org>2019-12-15 20:51:39 +0000
commit44f2793a9da4e456f6ad5445a60f819009a20035 (patch)
tree677b5d2ad417babc629d12c6a958fbc6b7f89f97 /usr.sbin/ripd
parentallow ssh-keyscan to find security key hostkeys (diff)
downloadwireguard-openbsd-44f2793a9da4e456f6ad5445a60f819009a20035.tar.xz
wireguard-openbsd-44f2793a9da4e456f6ad5445a60f819009a20035.zip
Clear r_list if the interface is passive. Additionaly move the check
for passive interface a bit further up so that the function can return earlier. Memory leak observed and reported by Jason Tubnor. OK benno@
Diffstat (limited to 'usr.sbin/ripd')
-rw-r--r--usr.sbin/ripd/message.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/usr.sbin/ripd/message.c b/usr.sbin/ripd/message.c
index 62d2fc33578..be56650f6fd 100644
--- a/usr.sbin/ripd/message.c
+++ b/usr.sbin/ripd/message.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: message.c,v 1.14 2019/12/09 20:49:40 remi Exp $ */
+/* $OpenBSD: message.c,v 1.15 2019/12/15 20:51:39 remi Exp $ */
/*
* Copyright (c) 2006 Michele Marchetto <mydecay@openbeer.it>
@@ -105,15 +105,15 @@ send_triggered_update(struct iface *iface, struct rip_route *rr)
u_int16_t afi, route_tag;
u_int32_t address, netmask, nexthop, metric;
+ if (iface->passive)
+ return (0);
+
inet_aton(ALL_RIP_ROUTERS, &dst.sin_addr);
dst.sin_port = htons(RIP_PORT);
dst.sin_family = AF_INET;
dst.sin_len = sizeof(struct sockaddr_in);
- if (iface->passive)
- return (0);
-
if ((buf = ibuf_open(iface->mtu - sizeof(struct ip) -
sizeof(struct udphdr))) == NULL)
fatal("send_triggered_update");
@@ -166,13 +166,15 @@ send_request(struct packet_head *r_list, struct iface *i, struct nbr *nbr)
port = htons(RIP_PORT);
}
+ if (iface->passive) {
+ clear_list(r_list);
+ return (0);
+ }
+
dst.sin_port = port;
dst.sin_family = AF_INET;
dst.sin_len = sizeof(struct sockaddr_in);
- if (iface->passive)
- return (0);
-
while (!TAILQ_EMPTY(r_list)) {
if ((buf = ibuf_open(iface->mtu - sizeof(struct ip) -
sizeof(struct udphdr))) == NULL)
@@ -240,13 +242,15 @@ send_response(struct packet_head *r_list, struct iface *i, struct nbr *nbr)
port = htons(RIP_PORT);
}
+ if (iface->passive) {
+ clear_list(r_list);
+ return (0);
+ }
+
dst.sin_port = port;
dst.sin_family = AF_INET;
dst.sin_len = sizeof(struct sockaddr_in);
- if (iface->passive)
- return (0);
-
while (!TAILQ_EMPTY(r_list)) {
if ((buf = ibuf_open(iface->mtu - sizeof(struct ip) -
sizeof(struct udphdr))) == NULL)