Provide independent control over which interfaces get TFTP.
diff --git a/src/tftp.c b/src/tftp.c
index 088fb92..d611dea 100644
--- a/src/tftp.c
+++ b/src/tftp.c
@@ -198,22 +198,36 @@
addra.addr.addr6 = addr.in6.sin6_addr;
#endif
- if (!iface_check(listen->family, &addra, name, NULL))
+ if (daemon->tftp_interfaces)
{
- if (!option_bool(OPT_CLEVERBIND))
- enumerate_interfaces(0);
- if (!loopback_exception(listen->tftpfd, listen->family, &addra, name) &&
- !label_exception(if_index, listen->family, &addra) )
+ /* dedicated tftp interface list */
+ for (tmp = daemon->tftp_interfaces; tmp; tmp = tmp->next)
+ if (tmp->name && wildcard_match(tmp->name, name))
+ break;
+
+ if (!tmp)
return;
}
-
+ else
+ {
+ /* Do the same as DHCP */
+ if (!iface_check(listen->family, &addra, name, NULL))
+ {
+ if (!option_bool(OPT_CLEVERBIND))
+ enumerate_interfaces(0);
+ if (!loopback_exception(listen->tftpfd, listen->family, &addra, name) &&
+ !label_exception(if_index, listen->family, &addra) )
+ return;
+ }
+
#ifdef HAVE_DHCP
- /* allowed interfaces are the same as for DHCP */
- for (tmp = daemon->dhcp_except; tmp; tmp = tmp->next)
- if (tmp->name && wildcard_match(tmp->name, name))
- return;
+ /* allowed interfaces are the same as for DHCP */
+ for (tmp = daemon->dhcp_except; tmp; tmp = tmp->next)
+ if (tmp->name && wildcard_match(tmp->name, name))
+ return;
#endif
-
+ }
+
strncpy(ifr.ifr_name, name, IF_NAMESIZE);
if (ioctl(listen->tftpfd, SIOCGIFMTU, &ifr) != -1)
mtu = ifr.ifr_mtu;