summaryrefslogtreecommitdiff
path: root/proto
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2017-02-17 22:54:06 +0100
committerOndrej Zajicek (work) <santiago@crfreenet.org>2017-02-17 22:54:06 +0100
commit30c734fc73648e4c43af4f45e68ac2de3d7ddea1 (patch)
treec58dcf00d56bce01ec7c018fe5035fa06d3a6cab /proto
parentda65a3d898fde0ce567782d86919a66e29916ed7 (diff)
Static: Fix bug in static route filter expressions
During reconfiguration, old and new filter expressions in static routes are compared using i_same() function. When filter expressions contain function calls, it is necessary that old filter expressions are the second argument in i_same(), as it is internally modified by i_same(). Otherwise pointers to old (and freed) data appear in the config structure. Thanks to Lennert Buytenhek for tracking and reporting the bug.
Diffstat (limited to 'proto')
-rw-r--r--proto/static/static.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/proto/static/static.c b/proto/static/static.c
index 0c088cd7..849067b9 100644
--- a/proto/static/static.c
+++ b/proto/static/static.c
@@ -498,7 +498,8 @@ static_same_dest(struct static_route *x, struct static_route *y)
static inline int
static_same_rte(struct static_route *x, struct static_route *y)
{
- return static_same_dest(x, y) && i_same(x->cmds, y->cmds);
+ /* Note that i_same() requires arguments in (new, old) order */
+ return static_same_dest(x, y) && i_same(y->cmds, x->cmds);
}