summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd/rde_filter.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2019-05-09 22:27:34 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2019-05-09 22:27:34 +0000
commite73c09fe7c679e61038a76d9d621f9f7862ca605 (patch)
treeffce0a2141a2db47de1f6694084c064dedfb1e6c /usr.sbin/bgpd/rde_filter.c
parent694dfd854041af07f6e9c055393403a3dce0c14d (diff)
Neither rde_apply_set() nor rde_filter() are called with a NULL state so
remove some unneeded == NULL checks. OK benno@
Diffstat (limited to 'usr.sbin/bgpd/rde_filter.c')
-rw-r--r--usr.sbin/bgpd/rde_filter.c23
1 files changed, 6 insertions, 17 deletions
diff --git a/usr.sbin/bgpd/rde_filter.c b/usr.sbin/bgpd/rde_filter.c
index 2a55772ba60..6e26185b80b 100644
--- a/usr.sbin/bgpd/rde_filter.c
+++ b/usr.sbin/bgpd/rde_filter.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde_filter.c,v 1.117 2019/02/04 18:53:10 claudio Exp $ */
+/* $OpenBSD: rde_filter.c,v 1.118 2019/05/09 22:27:33 claudio Exp $ */
/*
* Copyright (c) 2004 Claudio Jeker <claudio@openbsd.org>
@@ -44,9 +44,6 @@ rde_apply_set(struct filter_set_head *sh, struct filterstate *state,
u_int16_t nl;
u_int8_t prepend;
- if (state == NULL)
- return;
-
TAILQ_FOREACH(set, sh, entry) {
switch (set->type) {
case ACTION_SET_LOCALPREF:
@@ -208,12 +205,9 @@ int
rde_filter_match(struct filter_rule *f, struct rde_peer *peer,
struct filterstate *state, struct prefix *p)
{
- struct rde_aspath *asp = NULL;
+ struct rde_aspath *asp = &state->aspath;
int i;
- if (state != NULL)
- asp = &state->aspath;
-
if (f->peer.ebgp && !peer->conf.ebgp)
return (0);
if (f->peer.ibgp && peer->conf.ebgp)
@@ -257,7 +251,7 @@ rde_filter_match(struct filter_rule *f, struct rde_peer *peer,
}
}
- if (state != NULL && f->match.nexthop.flags != 0) {
+ if (f->match.nexthop.flags != 0) {
struct bgpd_addr *nexthop, *cmpaddr;
if (state->nexthop == NULL)
/* no nexthop, skip */
@@ -798,10 +792,7 @@ rde_filter(struct filter_head *rules, struct rde_peer *peer,
struct filter_rule *f;
enum filter_actions action = ACTION_DENY; /* default deny */
- if (state == NULL) /* withdraw should be accepted by default */
- action = ACTION_ALLOW;
-
- if (state && state->aspath.flags & F_ATTR_PARSE_ERR)
+ if (state->aspath.flags & F_ATTR_PARSE_ERR)
/*
* don't try to filter bad updates just deny them
* so they act as implicit withdraws
@@ -827,10 +818,8 @@ rde_filter(struct filter_head *rules, struct rde_peer *peer,
f->skip[RDE_FILTER_SKIP_PEERID]);
if (rde_filter_match(f, peer, state, p)) {
- if (state != NULL) {
- rde_apply_set(&f->set, state,
- p->re->prefix->aid, prefix_peer(p), peer);
- }
+ rde_apply_set(&f->set, state, p->re->prefix->aid,
+ prefix_peer(p), peer);
if (f->action != ACTION_NONE)
action = f->action;
if (f->quick)