Support routes via interfaces without hops
This commit is contained in:
parent
595a58f32a
commit
b5f31264ac
2 changed files with 33 additions and 6 deletions
30
bin/pattyd.c
30
bin/pattyd.c
|
@ -175,18 +175,40 @@ static int handle_route(struct context *ctx,
|
||||||
goto error_daemon_route_add;
|
goto error_daemon_route_add;
|
||||||
}
|
}
|
||||||
} else if (strcmp(argv[1], "station") == 0) {
|
} else if (strcmp(argv[1], "station") == 0) {
|
||||||
if (argc < 7 || strcmp(argv[3], "if") != 0 || strcmp(argv[5], "path") != 0) {
|
int hopc = 0;
|
||||||
patty_error_fmt(&ctx->e, "line %d: Invalid station route declaration",
|
char **hops = NULL;
|
||||||
|
|
||||||
|
if (argc < 5) {
|
||||||
|
if (strcmp(argv[3], "if") != 0) {
|
||||||
|
patty_error_fmt(&ctx->e, "line %d: Invalid station route declaration: Unexpected keyword '%s'",
|
||||||
|
lineno, argv[3]);
|
||||||
|
|
||||||
|
goto error_invalid_route;
|
||||||
|
}
|
||||||
|
} else if (argc > 6) {
|
||||||
|
if (strcmp(argv[5], "path") != 0) {
|
||||||
|
patty_error_fmt(&ctx->e, "line %d: Invalid station route declaration: Unexpected keyword '%s'",
|
||||||
|
lineno, argv[5]);
|
||||||
|
|
||||||
|
goto error_invalid_route;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (argc < 7) {
|
||||||
|
patty_error_fmt(&ctx->e, "line %d: Invalid station route declaration: No route path provided",
|
||||||
lineno);
|
lineno);
|
||||||
|
|
||||||
goto error_invalid_route;
|
goto error_invalid_route;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hopc = argc - 6;
|
||||||
|
hops = &argv[6];
|
||||||
|
}
|
||||||
|
|
||||||
if (patty_daemon_route_add(ctx->daemon,
|
if (patty_daemon_route_add(ctx->daemon,
|
||||||
argv[4],
|
argv[4],
|
||||||
argv[2],
|
argv[2],
|
||||||
(const char **)&argv[6],
|
(const char **)hops,
|
||||||
argc - 6) < 0) {
|
hopc) < 0) {
|
||||||
patty_error_fmt(&ctx->e, "line %d: Unable to add route for interface %s: %s",
|
patty_error_fmt(&ctx->e, "line %d: Unable to add route for interface %s: %s",
|
||||||
lineno, argv[4], strerror(errno));
|
lineno, argv[4], strerror(errno));
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,11 @@ must be provided:
|
||||||
.It Li pass Ar 12345
|
.It Li pass Ar 12345
|
||||||
.It Li filter Ar spec
|
.It Li filter Ar spec
|
||||||
.El
|
.El
|
||||||
|
.It Li route station Ar CALLSGN Li if Ar ifname Li
|
||||||
|
Add a static route to reach
|
||||||
|
.Ar CALLSGN
|
||||||
|
via interface
|
||||||
|
.Ar ifname .
|
||||||
.It Li route station Ar CALLSGN Li if Ar ifname Li path Ar HOP1 Op ...
|
.It Li route station Ar CALLSGN Li if Ar ifname Li path Ar HOP1 Op ...
|
||||||
Add a static route to reach
|
Add a static route to reach
|
||||||
.Ar CALLSGN
|
.Ar CALLSGN
|
||||||
|
|
Loading…
Add table
Reference in a new issue