{
if (new)
{
- log(L_ERR "Pipe collision detected when sending %F to table %s",
- log_rl(&rl_pipe, L_ERR "Pipe collision detected when sending %I/%d to table %s",
- net->n.prefix, net->n.pxlen, table->name);
++ log_rl(&rl_pipe, L_ERR "Pipe collision detected when sending %F to table %s",
+ &net->n, table->name);
rte_free_quick(new);
}
return;
else
{
port = s->sport;
+
+ int one = 1;
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one)) < 0)
ERR("SO_REUSEADDR");
+
+ #ifdef CONFIG_NO_IFACE_BIND
+ /* Workaround missing ability to bind to an iface */
+ if ((type == SK_UDP) && s->iface && ipa_zero(s->saddr))
+ {
+ if (setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &one, sizeof(one)) < 0)
+ ERR("SO_REUSEPORT");
+ }
+ #endif
}
- fill_in_sockaddr(&sa, s->saddr, s->iface, port);
- if (bind(fd, (struct sockaddr *) &sa, sizeof(sa)) < 0)
+
+ sockaddr_fill(sa, s->saddr, s->iface, port);
+ if (bind(fd, sa, sa_len) < 0)
ERR("bind");
}
- fill_in_sockaddr(&sa, s->daddr, s->iface, s->dport);
+ sockaddr_fill(sa, s->daddr, s->iface, s->dport);
if (s->password)
- {
- int rv = sk_set_md5_auth_int(s, &sa, s->password);
- if (rv < 0)
- goto bad_no_log;
- }
+ if (sk_set_md5_auth_int(s, sa, sa_len, s->password) < 0)
+ goto bad_no_log;
switch (type)
{