summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bgpd
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2019-10-04 11:40:42 +0000
committerclaudio <claudio@openbsd.org>2019-10-04 11:40:42 +0000
commit1bba8e9b9f475ef5d058ebc9d4d3c7632ecd6cda (patch)
tree812a2bfcdf8564d14b99f3ced0779bc356571412 /usr.sbin/bgpd
parentAvoid a path traversal bug in s_server on Windows. (diff)
downloadwireguard-openbsd-1bba8e9b9f475ef5d058ebc9d4d3c7632ecd6cda.tar.xz
wireguard-openbsd-1bba8e9b9f475ef5d058ebc9d4d3c7632ecd6cda.zip
Instead of calling fatal() when pftable additions and deletions mix
commit the pending work and therefore start a new worklist. The delayed commits can cause such situations to happen and there is no reason to panic because of this. Problem found by jmc@ OK benno@
Diffstat (limited to 'usr.sbin/bgpd')
-rw-r--r--usr.sbin/bgpd/pftable.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.sbin/bgpd/pftable.c b/usr.sbin/bgpd/pftable.c
index d880e5eeb3d..df98267402e 100644
--- a/usr.sbin/bgpd/pftable.c
+++ b/usr.sbin/bgpd/pftable.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pftable.c,v 1.14 2019/08/08 20:06:29 claudio Exp $ */
+/* $OpenBSD: pftable.c,v 1.15 2019/10/04 11:40:42 claudio Exp $ */
/*
* Copyright (c) 2004 Damien Miller <djm@openbsd.org>
@@ -191,10 +191,13 @@ pftable_add_work(const char *table, struct bgpd_addr *addr,
return (-1);
}
- /* Only one type of work on the list at a time */
+ /*
+ * Only one type of work on the list at a time,
+ * commit pending work first before adding new work
+ */
what = del ? DIOCRDELADDRS : DIOCRADDADDRS;
if (pft->naddrs != 0 && pft->what != what)
- fatal("attempt to mix pf table additions/deletions");
+ pftable_commit();
if (pft->nalloc <= pft->naddrs)
pft->nalloc = pft->nalloc == 0 ? 1 : pft->nalloc * 2;