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;
|
||||
}
|
||||
} else if (strcmp(argv[1], "station") == 0) {
|
||||
if (argc < 7 || strcmp(argv[3], "if") != 0 || strcmp(argv[5], "path") != 0) {
|
||||
patty_error_fmt(&ctx->e, "line %d: Invalid station route declaration",
|
||||
int hopc = 0;
|
||||
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);
|
||||
|
||||
goto error_invalid_route;
|
||||
}
|
||||
|
||||
hopc = argc - 6;
|
||||
hops = &argv[6];
|
||||
}
|
||||
|
||||
if (patty_daemon_route_add(ctx->daemon,
|
||||
argv[4],
|
||||
argv[2],
|
||||
(const char **)&argv[6],
|
||||
argc - 6) < 0) {
|
||||
(const char **)hops,
|
||||
hopc) < 0) {
|
||||
patty_error_fmt(&ctx->e, "line %d: Unable to add route for interface %s: %s",
|
||||
lineno, argv[4], strerror(errno));
|
||||
|
||||
|
|
|
@ -58,6 +58,11 @@ must be provided:
|
|||
.It Li pass Ar 12345
|
||||
.It Li filter Ar spec
|
||||
.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 ...
|
||||
Add a static route to reach
|
||||
.Ar CALLSGN
|
||||
|
|
Loading…
Add table
Reference in a new issue