Refactored packet API to support struct layer (using union to contain different types of encapsulation headers)
This commit is contained in:
@@ -58,21 +58,21 @@ static int parse_cmd(int argc, char **argv)
|
||||
|
||||
if (host)
|
||||
{
|
||||
if (inet_pton(AF_INET, host, &rule.addr.data.v4) != 1)
|
||||
if (inet_pton(AF_INET, host, &rule.addr4) != 1)
|
||||
{
|
||||
if (inet_pton(AF_INET6, host, &rule.addr.data.v6) != 1)
|
||||
if (inet_pton(AF_INET6, host, &rule.addr6) != 1)
|
||||
{
|
||||
printf("unable to convert host %s to IPv4 / IPv6\n", host);
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
rule.addr.family = AF_INET6;
|
||||
rule.family = AF_INET6;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rule.addr.family = AF_INET;
|
||||
rule.family = AF_INET;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user