fou: Allowing configuring IPv6 listener
Signed-off-by: Tom Herbert <tom@herbertland.com>
This commit is contained in:
parent
0b2fbb7358
commit
8bd31d8db5
|
|
@ -25,8 +25,9 @@
|
||||||
|
|
||||||
static void usage(void)
|
static void usage(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Usage: ip fou add port PORT { ipproto PROTO | gue }\n");
|
fprintf(stderr, "Usage: ip fou add port PORT "
|
||||||
fprintf(stderr, " ip fou del port PORT\n");
|
"{ ipproto PROTO | gue } [ -6 ]\n");
|
||||||
|
fprintf(stderr, " ip fou del port PORT [ -6 ]\n");
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
fprintf(stderr, "Where: PROTO { ipproto-name | 1..255 }\n");
|
fprintf(stderr, "Where: PROTO { ipproto-name | 1..255 }\n");
|
||||||
fprintf(stderr, " PORT { 1..65535 }\n");
|
fprintf(stderr, " PORT { 1..65535 }\n");
|
||||||
|
|
@ -50,6 +51,7 @@ static int fou_parse_opt(int argc, char **argv, struct nlmsghdr *n,
|
||||||
__u8 ipproto, type;
|
__u8 ipproto, type;
|
||||||
bool gue_set = false;
|
bool gue_set = false;
|
||||||
int ipproto_set = 0;
|
int ipproto_set = 0;
|
||||||
|
unsigned short family = AF_INET;
|
||||||
|
|
||||||
while (argc > 0) {
|
while (argc > 0) {
|
||||||
if (!matches(*argv, "port")) {
|
if (!matches(*argv, "port")) {
|
||||||
|
|
@ -71,6 +73,8 @@ static int fou_parse_opt(int argc, char **argv, struct nlmsghdr *n,
|
||||||
ipproto_set = 1;
|
ipproto_set = 1;
|
||||||
} else if (!matches(*argv, "gue")) {
|
} else if (!matches(*argv, "gue")) {
|
||||||
gue_set = true;
|
gue_set = true;
|
||||||
|
} else if (!matches(*argv, "-6")) {
|
||||||
|
family = AF_INET6;
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "fou: unknown command \"%s\"?\n", *argv);
|
fprintf(stderr, "fou: unknown command \"%s\"?\n", *argv);
|
||||||
usage();
|
usage();
|
||||||
|
|
@ -98,6 +102,7 @@ static int fou_parse_opt(int argc, char **argv, struct nlmsghdr *n,
|
||||||
|
|
||||||
addattr16(n, 1024, FOU_ATTR_PORT, port);
|
addattr16(n, 1024, FOU_ATTR_PORT, port);
|
||||||
addattr8(n, 1024, FOU_ATTR_TYPE, type);
|
addattr8(n, 1024, FOU_ATTR_TYPE, type);
|
||||||
|
addattr16(n, 1024, FOU_ATTR_AF, family);
|
||||||
|
|
||||||
if (ipproto_set)
|
if (ipproto_set)
|
||||||
addattr8(n, 1024, FOU_ATTR_IPPROTO, ipproto);
|
addattr8(n, 1024, FOU_ATTR_IPPROTO, ipproto);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue