gid_t gid; /* -1 to leave unchanged */
mode_t mode; /* 0 to leave unchanged */
} ux;
+ char *interface; /* interface name or NULL */
} settings; /* all the settings needed for the listening socket */
};
unsigned int analysers; /* bitmap of required protocol analysers */
int maxseg; /* for TCP, advertised MSS */
int tcp_ut; /* for TCP, user timeout */
- char *interface; /* interface name or NULL */
char *name; /* listener's name */
__decl_thread(HA_SPINLOCK_T lock);
/* parse the "interface" bind keyword */
static int bind_parse_interface(char **args, int cur_arg, struct proxy *px, struct bind_conf *conf, char **err)
{
- struct listener *l;
-
if (!*args[cur_arg + 1]) {
memprintf(err, "'%s' : missing interface name", args[cur_arg]);
return ERR_ALERT | ERR_FATAL;
}
- list_for_each_entry(l, &conf->listeners, by_bind) {
- if (l->addr.ss_family == AF_INET || l->addr.ss_family == AF_INET6)
- l->interface = strdup(args[cur_arg + 1]);
- }
-
+ conf->settings.interface = strdup(args[cur_arg + 1]);
return 0;
}
#endif
if (fdtab[cur_fd].iocb == listener_accept) {
const struct listener *l = fdtab[cur_fd].owner;
- if (l->interface) {
- if_name = l->interface;
+ if (l->bind_conf->settings.interface) {
+ if_name = l->bind_conf->settings.interface;
if_nlen = strlen(if_name);
}
#ifdef SO_BINDTODEVICE
/* Note: this might fail if not CAP_NET_RAW */
- if (!ext && listener->interface) {
+ if (!ext && listener->bind_conf->settings.interface) {
if (setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE,
- listener->interface, strlen(listener->interface) + 1) == -1) {
+ listener->bind_conf->settings.interface,
+ strlen(listener->bind_conf->settings.interface) + 1) == -1) {
msg = "cannot bind listener to device";
err |= ERR_WARN;
}
#ifdef SO_BINDTODEVICE
/* Note: this might fail if not CAP_NET_RAW */
- if (listener->interface) {
+ if (listener->bind_conf->settings.interface) {
if (setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE,
- listener->interface, strlen(listener->interface) + 1) == -1) {
+ listener->bind_conf->settings.interface,
+ strlen(listener->bind_conf->settings.interface) + 1) == -1) {
msg = "cannot bind listener to device";
err |= ERR_WARN;
}
options |= SOCK_XFER_OPT_V6ONLY;
}
- if (l->interface)
- if_namelen = strlen(l->interface);
+ if (l->bind_conf->settings.interface)
+ if_namelen = strlen(l->bind_conf->settings.interface);
#ifdef USE_NS
if (l->netns)
ns_namelen = l->netns->name_len;
if ((options == xfer_sock->options) &&
(if_namelen == xfer_sock->if_namelen) &&
(ns_namelen == xfer_sock->ns_namelen) &&
- (!if_namelen || strcmp(l->interface, xfer_sock->iface) == 0) &&
+ (!if_namelen || strcmp(l->bind_conf->settings.interface, xfer_sock->iface) == 0) &&
#ifdef USE_NS
(!ns_namelen || strcmp(l->netns->node.key, xfer_sock->namespace) == 0) &&
#endif