summaryrefslogtreecommitdiff
path: root/common/discover.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/discover.c')
-rw-r--r--common/discover.c86
1 files changed, 43 insertions, 43 deletions
diff --git a/common/discover.c b/common/discover.c
index 6288850e..1220b061 100644
--- a/common/discover.c
+++ b/common/discover.c
@@ -102,7 +102,7 @@ isc_result_t interface_setup ()
dhcp_interface_destroy,
dhcp_interface_signal_handler,
dhcp_interface_stuff_values,
- dhcp_interface_lookup,
+ dhcp_interface_lookup,
dhcp_interface_create,
dhcp_interface_remove,
0, 0, 0,
@@ -139,11 +139,11 @@ isc_result_t interface_initialize (omapi_object_t *ipo,
}
-/*
+/*
* Scanning for Interfaces
* -----------------------
*
- * To find interfaces, we create an iterator that abstracts out most
+ * To find interfaces, we create an iterator that abstracts out most
* of the platform specifics. Use is fairly straightforward:
*
* - begin_iface_scan() starts the process.
@@ -213,7 +213,7 @@ isc_result_t interface_initialize (omapi_object_t *ipo,
#endif
#if defined(SIOCGLIFCONF) && defined(SIOCGLIFFLAGS)
-/*
+/*
* Solaris support
* ---------------
*
@@ -223,7 +223,7 @@ isc_result_t interface_initialize (omapi_object_t *ipo,
* Solaris' extended interface is documented in the if_tcp man page.
*/
-/*
+/*
* Structure holding state about the scan.
*/
struct iface_conf_list {
@@ -233,7 +233,7 @@ struct iface_conf_list {
int next; /* next interface to retrieve when iterating */
};
-/*
+/*
* Structure used to return information about a specific interface.
*/
struct iface_info {
@@ -242,12 +242,12 @@ struct iface_info {
isc_uint64_t flags; /* interface flags, e.g. IFF_LOOPBACK */
};
-/*
+/*
* Start a scan of interfaces.
*
* The iface_conf_list structure maintains state for this process.
*/
-int
+int
begin_iface_scan(struct iface_conf_list *ifaces) {
#ifdef ISC_PLATFORM_HAVELIFNUM
struct lifnum lifnum;
@@ -308,7 +308,7 @@ begin_iface_scan(struct iface_conf_list *ifaces) {
/*
* Retrieve the next interface.
*
- * Returns information in the info structure.
+ * Returns information in the info structure.
* Sets err to 1 if there is an error, otherwise 0.
*/
int
@@ -359,11 +359,11 @@ next_iface(struct iface_info *info, int *err, struct iface_conf_list *ifaces) {
foundif = ISC_TRUE;
} while ((foundif == ISC_FALSE) ||
(strncmp(info->name, "dummy", 5) == 0));
-
+
memset(&tmp, 0, sizeof(tmp));
strncpy(tmp.lifr_name, info->name, sizeof(tmp.lifr_name) - 1);
if (ioctl(ifaces->sock, SIOCGLIFFLAGS, &tmp) < 0) {
- log_error("Error getting interface flags for '%s'; %m",
+ log_error("Error getting interface flags for '%s'; %m",
p->lifr_name);
*err = 1;
return 0;
@@ -387,11 +387,11 @@ end_iface_scan(struct iface_conf_list *ifaces) {
#else
-/*
+/*
* BSD/Linux support
* -----------
*
- * FreeBSD, NetBSD, OpenBSD, OS X/macOS and Linux all have the getifaddrs()
+ * FreeBSD, NetBSD, OpenBSD, OS X/macOS and Linux all have the getifaddrs()
* function.
*
* The getifaddrs() man page describes the use.
@@ -399,7 +399,7 @@ end_iface_scan(struct iface_conf_list *ifaces) {
#include <ifaddrs.h>
-/*
+/*
* Structure holding state about the scan.
*/
struct iface_conf_list {
@@ -407,7 +407,7 @@ struct iface_conf_list {
struct ifaddrs *next; /* current position in the list */
};
-/*
+/*
* Structure used to return information about a specific interface.
*/
struct iface_info {
@@ -416,12 +416,12 @@ struct iface_info {
isc_uint64_t flags; /* interface flags, e.g. IFF_LOOPBACK */
};
-/*
+/*
* Start a scan of interfaces.
*
* The iface_conf_list structure maintains state for this process.
*/
-int
+int
begin_iface_scan(struct iface_conf_list *ifaces) {
if (getifaddrs(&ifaces->head) != 0) {
log_error("Error getting interfaces; %m");
@@ -434,7 +434,7 @@ begin_iface_scan(struct iface_conf_list *ifaces) {
/*
* Retrieve the next interface.
*
- * Returns information in the info structure.
+ * Returns information in the info structure.
* Sets err to 1 if there is an error, otherwise 0.
*/
int
@@ -446,7 +446,7 @@ next_iface(struct iface_info *info, int *err, struct iface_conf_list *ifaces) {
return 0;
}
if (strlen(ifaces->next->ifa_name) >= sizeof(info->name)) {
- log_error("Interface name '%s' too long",
+ log_error("Interface name '%s' too long",
ifaces->next->ifa_name);
*err = 1;
return 0;
@@ -485,11 +485,11 @@ end_iface_scan(struct iface_conf_list *ifaces) {
ifaces->head = NULL;
ifaces->next = NULL;
}
-#endif
+#endif
/* XXX: perhaps create drealloc() rather than do it manually */
void
-add_ipv4_addr_to_interface(struct interface_info *iface,
+add_ipv4_addr_to_interface(struct interface_info *iface,
const struct in_addr *addr) {
/*
* We don't expect a lot of addresses per IPv4 interface, so
@@ -513,8 +513,8 @@ add_ipv4_addr_to_interface(struct interface_info *iface,
log_fatal("Out of memory saving IPv4 address "
"on interface.");
}
- memcpy(tmp,
- iface->addresses,
+ memcpy(tmp,
+ iface->addresses,
iface->address_max * sizeof(struct in_addr));
dfree(iface->addresses, MDL);
iface->addresses = tmp;
@@ -526,7 +526,7 @@ add_ipv4_addr_to_interface(struct interface_info *iface,
#ifdef DHCPv6
/* XXX: perhaps create drealloc() rather than do it manually */
void
-add_ipv6_addr_to_interface(struct interface_info *iface,
+add_ipv6_addr_to_interface(struct interface_info *iface,
const struct in6_addr *addr) {
/*
* Each IPv6 interface will have at least two IPv6 addresses,
@@ -551,8 +551,8 @@ add_ipv6_addr_to_interface(struct interface_info *iface,
log_fatal("Out of memory saving IPv6 address "
"on interface.");
}
- memcpy(tmp,
- iface->v6addresses,
+ memcpy(tmp,
+ iface->v6addresses,
iface->v6address_max * sizeof(struct in6_addr));
dfree(iface->v6addresses, MDL);
iface->v6addresses = tmp;
@@ -567,7 +567,7 @@ add_ipv6_addr_to_interface(struct interface_info *iface,
register that interface with the network I/O software, figure out what
subnet it's on, and add it to the list of interfaces. */
-void
+void
discover_interfaces(int state) {
struct iface_conf_list ifaces;
struct iface_info info;
@@ -637,7 +637,7 @@ discover_interfaces(int state) {
(!(info.flags & IFF_UP) &&
state != DISCOVER_UNCONFIGURED))
continue;
-
+
/* If there isn't already an interface by this name,
allocate one. */
if (tmp == NULL) {
@@ -658,7 +658,7 @@ discover_interfaces(int state) {
(*dhcp_interface_discovery_hook)(tmp);
}
- if ((info.addr.ss_family == AF_INET) &&
+ if ((info.addr.ss_family == AF_INET) &&
(local_family == AF_INET)) {
struct sockaddr_in *a = (struct sockaddr_in*)&info.addr;
struct iaddr addr;
@@ -685,14 +685,14 @@ discover_interfaces(int state) {
}
}
#ifdef DHCPv6
- else if ((info.addr.ss_family == AF_INET6) &&
+ else if ((info.addr.ss_family == AF_INET6) &&
(local_family == AF_INET6)) {
- struct sockaddr_in6 *a =
+ struct sockaddr_in6 *a =
(struct sockaddr_in6*)&info.addr;
struct iaddr addr;
/* We don't want the loopback interface. */
- if (IN6_IS_ADDR_LOOPBACK(&a->sin6_addr) &&
+ if (IN6_IS_ADDR_LOOPBACK(&a->sin6_addr) &&
((tmp->flags & INTERFACE_AUTOMATIC) &&
((state == DISCOVER_SERVER) ||
(state == DISCOVER_SERVER46))))
@@ -809,14 +809,14 @@ discover_interfaces(int state) {
log_error("%s", "");
if (local_family == AF_INET) {
log_error("No subnet declaration for %s (%s).",
- tmp->name,
+ tmp->name,
(tmp->addresses == NULL) ?
"no IPv4 addresses" :
inet_ntoa(tmp->addresses[0]));
#ifdef DHCPv6
} else {
if (tmp->v6addresses != NULL) {
- inet_ntop(AF_INET6,
+ inet_ntop(AF_INET6,
&tmp->v6addresses[0],
abuf,
sizeof(abuf));
@@ -876,7 +876,7 @@ discover_interfaces(int state) {
} else if (tmp->v6address_count > 0) {
subnet->interface_address.len = 16;
memcpy(subnet->interface_address.iabuf,
- &tmp->v6addresses[0].s6_addr,
+ &tmp->v6addresses[0].s6_addr,
16);
} else {
/* XXX: should be one */
@@ -954,7 +954,7 @@ discover_interfaces(int state) {
if (tmp -> rfdesc == -1)
continue;
switch (local_family) {
-#ifdef DHCPv6
+#ifdef DHCPv6
case AF_INET6:
#ifdef RELAY_PORT
#define UPSTREAM(ifp) \
@@ -981,7 +981,7 @@ discover_interfaces(int state) {
}
#endif
status = omapi_register_io_object((omapi_object_t *)tmp,
- if_readsocket,
+ if_readsocket,
0, got_one_v6, 0, 0);
#ifdef RELAY_PORT
if (UPSTREAM(tmp))
@@ -994,7 +994,7 @@ discover_interfaces(int state) {
case AF_INET:
default:
status = omapi_register_io_object((omapi_object_t *)tmp,
- if_readsocket,
+ if_readsocket,
0, got_one, 0, 0);
break;
}
@@ -1194,7 +1194,7 @@ got_one_v6(omapi_object_t *h) {
/*
* If a packet is not multicast, we assume it is unicast.
*/
- if (IN6_IS_ADDR_MULTICAST(&to)) {
+ if (IN6_IS_ADDR_MULTICAST(&to)) {
is_unicast = ISC_FALSE;
} else {
is_unicast = ISC_TRUE;
@@ -1211,8 +1211,8 @@ got_one_v6(omapi_object_t *h) {
if (ip == NULL)
return ISC_R_NOTFOUND;
- (*dhcpv6_packet_handler)(ip, buf,
- result, from.sin6_port,
+ (*dhcpv6_packet_handler)(ip, buf,
+ result, from.sin6_port,
&ifrom, is_unicast);
}
@@ -1252,7 +1252,7 @@ isc_result_t dhcp_interface_set_value (omapi_object_t *h,
if (status == ISC_R_SUCCESS || status == DHCP_R_UNCHANGED)
return status;
}
-
+
return ISC_R_NOTFOUND;
}
@@ -1453,7 +1453,7 @@ isc_result_t dhcp_interface_create (omapi_object_t **lp,
{
struct interface_info *hp;
isc_result_t status;
-
+
hp = (struct interface_info *)0;
status = interface_allocate (&hp, MDL);
if (status != ISC_R_SUCCESS)