diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2017-01-23 11:33:42 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2017-01-23 11:33:42 +0000 |
commit | 9fe6fad4fe28032c58a94b8bc3d8cf94e5171903 (patch) | |
tree | e79a80494c9f7f68ef00834af551b64bcdc1d7f1 /usr.sbin | |
parent | 90781c53581317e6775688f3953c30e3eca80001 (diff) |
Refactor a bit to make it look a bit more like the rde_update_update code.
No functional change, less recursion and indents.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/bgpd/rde_update.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/usr.sbin/bgpd/rde_update.c b/usr.sbin/bgpd/rde_update.c index b215f987fce..0d045550371 100644 --- a/usr.sbin/bgpd/rde_update.c +++ b/usr.sbin/bgpd/rde_update.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde_update.c,v 1.82 2014/12/18 19:28:44 tedu Exp $ */ +/* $OpenBSD: rde_update.c,v 1.83 2017/01/23 11:33:41 claudio Exp $ */ /* * Copyright (c) 2004 Claudio Jeker <claudio@openbsd.org> @@ -412,6 +412,7 @@ up_generate_updates(struct filter_head *rules, struct rde_peer *peer, return; if (new == NULL) { +withdraw: if (up_test_update(peer, old) != 1) return; @@ -427,8 +428,7 @@ up_generate_updates(struct filter_head *rules, struct rde_peer *peer, case 1: break; case 0: - up_generate_updates(rules, peer, NULL, old); - return; + goto withdraw; case -1: return; } @@ -437,17 +437,16 @@ up_generate_updates(struct filter_head *rules, struct rde_peer *peer, if (rde_filter(rules, &asp, peer, new->aspath, &addr, new->prefix->prefixlen, new->aspath->peer) == ACTION_DENY) { path_put(asp); - up_generate_updates(rules, peer, NULL, old); - return; + goto withdraw; } + if (asp == NULL) + asp = new->aspath; - /* generate update */ - if (asp != NULL) { - up_generate(peer, asp, &addr, new->prefix->prefixlen); + up_generate(peer, asp, &addr, new->prefix->prefixlen); + + /* free modified aspath */ + if (asp != new->aspath) path_put(asp); - } else - up_generate(peer, new->aspath, &addr, - new->prefix->prefixlen); } } |