summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2019-06-18 17:35:23 +0100
committerRoy Marples <roy@marples.name>2019-06-18 17:35:23 +0100
commite8511fba290d72445467ee87fa4cf982df1aeff3 (patch)
treebbe60c97b47e0335ae112e69ff1af1e05ebcc28c
parent6da1356363264bcfb6237797965ef59c234fa795 (diff)
route: Build list of static routes and routers correctly.HEADmaster
They they need to be inserted by rt_proto_add().
-rw-r--r--src/dhcp.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/dhcp.c b/src/dhcp.c
index 25a9e72c..e73a900f 100644
--- a/src/dhcp.c
+++ b/src/dhcp.c
@@ -656,9 +656,7 @@ get_option_routes(rb_tree_t *routes, struct interface *ifp,
sa_in_init(&rt->rt_dest, &dest);
sa_in_init(&rt->rt_netmask, &netmask);
sa_in_init(&rt->rt_gateway, &gateway);
- if (rb_tree_insert_node(routes, rt) != rt)
- rt_free(rt);
- else
+ if (rt_proto_add(routes, rt))
n++;
}
}
@@ -668,7 +666,7 @@ get_option_routes(rb_tree_t *routes, struct interface *ifp,
p = get_option(ifp->ctx, bootp, bootp_len, DHO_ROUTER, &len);
else
p = NULL;
- if (p) {
+ if (p && len % 4 == 0) {
e = p + len;
dest.s_addr = INADDR_ANY;
netmask.s_addr = INADDR_ANY;
@@ -680,9 +678,7 @@ get_option_routes(rb_tree_t *routes, struct interface *ifp,
sa_in_init(&rt->rt_dest, &dest);
sa_in_init(&rt->rt_netmask, &netmask);
sa_in_init(&rt->rt_gateway, &gateway);
- if (rb_tree_insert_node(routes, rt) != rt)
- rt_free(rt);
- else
+ if (rt_proto_add(routes, rt))
n++;
}
}