From 2f021fd3e127da7ef80106e8e09c6fbb75be56c2 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 29 Oct 2012 22:48:06 +0100 Subject: Allow setting bind interface --- src/config.y | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/config.y b/src/config.y index d87c151..0693294 100644 --- a/src/config.y +++ b/src/config.y @@ -192,22 +192,23 @@ bind_new: { addr->next = conf->bind_addrs; conf->bind_addrs = addr; } + ; -bind: bind_new TOK_ADDR maybe_port { +bind: bind_new TOK_ADDR maybe_port maybe_bind_to_device { conf->bind_addrs->addr.in.sin_family = AF_INET; conf->bind_addrs->addr.in.sin_addr = $2; conf->bind_addrs->addr.in.sin_port = htons($3); if (!conf->bind_addr_default_v4) conf->bind_addr_default_v4 = conf->bind_addrs; } - | bind_new TOK_ADDR6 maybe_port { + | bind_new TOK_ADDR6 maybe_port maybe_bind_to_device { conf->bind_addrs->addr.in6.sin6_family = AF_INET6; conf->bind_addrs->addr.in6.sin6_addr = $2; conf->bind_addrs->addr.in6.sin6_port = htons($3); if (!conf->bind_addr_default_v6) conf->bind_addr_default_v6 = conf->bind_addrs; } - | bind_new TOK_ANY maybe_port { + | bind_new TOK_ANY maybe_port maybe_bind_to_device { conf->bind_addrs->addr.in.sin_port = htons($3); if (!conf->bind_addr_default_v4) conf->bind_addr_default_v4 = conf->bind_addrs; @@ -216,6 +217,13 @@ bind: bind_new TOK_ADDR maybe_port { } ; +maybe_bind_to_device: + TOK_INTERFACE TOK_STRING { + conf->bind_addrs->bindtodev = strdup($2->str); + } + | {} + ; + mtu: TOK_INTEGER { conf->mtu = $1; } ; -- cgit v1.2.3