strncmp(arg, "ms_classless_static_routes=",
strlen("ms_classless_static_routes=")) == 0)
{
+ struct interface *ifp;
struct in_addr addr3;
+ ifp = if_find(ctx->ifaces, ifname);
+ if (ifp == NULL) {
+ logerrx("static routes require an interface");
+ return -1;
+ }
fp = np = strwhite(p);
if (np == NULL) {
logerrx("all routes need a gateway");
*fp = ' ';
return -1;
}
- if ((rt = rt_new(if_find(ctx->ifaces, ifname))) == NULL) {
+ if ((rt = rt_new(ifp)) == NULL) {
*fp = ' ';
return -1;
}
TAILQ_INSERT_TAIL(&ifo->routes, rt, rt_next);
*fp = ' ';
} else if (strncmp(arg, "routers=", strlen("routers=")) == 0) {
+ struct interface *ifp;
+
+ ifp = if_find(ctx->ifaces, ifname);
+ if (ifp == NULL) {
+ logerrx("static routes require an interface");
+ return -1;
+ }
if (parse_addr(&addr, NULL, p) == -1)
return -1;
- if ((rt = rt_new(if_find(ctx->ifaces, ifname))) == NULL)
+ if ((rt = rt_new(ifp)) == NULL)
return -1;
addr2.s_addr = INADDR_ANY;
sa_in_init(&rt->rt_dest, &addr2);