summaryrefslogtreecommitdiffstats
path: root/src/read_config_yy.y
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2009-03-20 14:05:31 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2009-03-20 14:05:31 +0100
commitf7b4b7bd19b16d11491f18891942f6d48c2fcf7e (patch)
tree800729577e679355b073709e35baaf094e6623a3 /src/read_config_yy.y
parent28255df51433846bad67cccb69bb285660ef1667 (diff)
udp: fix missing scope_id in the socket creation
This patch fixes an EINVAL error returned by bind() when opening an UDP server socket to propagate state-changes over the dedicated link. This patch also includes the change of the example configuration files in case that you want to use UDP over IPv6. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/read_config_yy.y')
-rw-r--r--src/read_config_yy.y13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/read_config_yy.y b/src/read_config_yy.y
index cfcd574..7b62cf3 100644
--- a/src/read_config_yy.y
+++ b/src/read_config_yy.y
@@ -464,7 +464,7 @@ udp_option : T_IPV4_ADDR T_IP
{
__max_dedicated_links_reached();
- if (!inet_aton($2, &conf.channel[conf.channel_num].u.udp.server)) {
+ if (!inet_aton($2, &conf.channel[conf.channel_num].u.udp.server.ipv4)) {
fprintf(stderr, "%s is not a valid IPv4 address\n", $2);
break;
}
@@ -477,7 +477,7 @@ udp_option : T_IPV6_ADDR T_IP
#ifdef HAVE_INET_PTON_IPV6
if (inet_pton(AF_INET6, $2,
- &conf.channel[conf.channel_num].u.udp.server) <= 0) {
+ &conf.channel[conf.channel_num].u.udp.server.ipv6) <= 0) {
fprintf(stderr, "%s is not a valid IPv6 address\n", $2);
break;
}
@@ -518,8 +518,17 @@ udp_option : T_IPV6_DEST_ADDR T_IP
udp_option : T_IFACE T_STRING
{
+ int idx;
+
__max_dedicated_links_reached();
strncpy(conf.channel[conf.channel_num].channel_ifname, $2, IFNAMSIZ);
+
+ idx = if_nametoindex($2);
+ if (!idx) {
+ fprintf(stderr, "%s is an invalid interface.\n", $2);
+ break;
+ }
+ conf.channel[conf.channel_num].u.udp.server.ipv6.scope_id = idx;
};
udp_option : T_PORT T_NUMBER