reported by Ted Percival <ted@midg3t.net>.
Jeremy.
void setup_linklocal_scope_id(struct sockaddr_storage *pss);
bool is_local_net_v4(struct in_addr from);
int iface_count(void);
-int iface_count_v4(void);
+int iface_count_v4_nl(void);
const struct in_addr *first_ipv4_iface(void);
struct interface *get_interface(int n);
const struct sockaddr_storage *iface_n_sockaddr_storage(int n);
}
/****************************************************************************
- How many interfaces do we have (v4 only) ?
+ How many non-loopback IPv4 interfaces do we have ?
**************************************************************************/
-int iface_count_v4(void)
+int iface_count_v4_nl(void)
{
int ret = 0;
struct interface *i;
for (i=local_interfaces;i;i=i->next) {
+ if (is_loopback_addr(&i->ip)) {
+ continue;
+ }
if (i->ip.ss_family == AF_INET) {
ret++;
}
BlockSignals(false, SIGTERM);
- /* We only count IPv4 interfaces here. */
- while (iface_count_v4() == 0 && !got_sig_term) {
+ /* We only count IPv4, non-loopback interfaces here. */
+ while (iface_count_v4_nl() == 0 && !got_sig_term) {
sleep(5);
load_interfaces();
}
bool create_subnets(void)
{
/* We only count IPv4 interfaces whilst we're waiting. */
- int num_interfaces = iface_count_v4();
+ int num_interfaces;
int i;
struct in_addr unicast_ip, ipzero;
try_interfaces_again:
- if (iface_count_v4() == 0) {
- DEBUG(0,("create_subnets: No local interfaces !\n"));
+ /* Only count IPv4, non-loopback interfaces. */
+ if (iface_count_v4_nl() == 0) {
+ DEBUG(0,("create_subnets: No local IPv4 non-loopback interfaces !\n"));
DEBUG(0,("create_subnets: Waiting for an interface to appear ...\n"));
}
- /* We only count IPv4 interfaces here. */
- while (iface_count_v4() == 0) {
+ /* We only count IPv4, non-loopback interfaces here. */
+ while (iface_count_v4_nl() == 0) {
void (*saved_handler)(int);
/*