a->fr_timer.cb = NULL;
}
-// Handler for DHCPv4 messages
+/* Handler for DHCPv4 messages */
static void handle_dhcpv4(void *addr, void *data, size_t len,
struct interface *iface, _unused void *dest_addr)
{
uint32_t end = ntohl(iface->dhcpv4_end_ip.s_addr);
uint32_t count = end - start + 1;
- // try to assign the IP the client asked for
+ /* try to assign the IP the client asked for */
if (start <= ntohl(raddr) && ntohl(raddr) <= end &&
!find_assignment_by_addr(iface, raddr)) {
assign->addr = raddr;
return true;
}
- // Seed RNG with checksum of hwaddress
+ /* Seed RNG with checksum of hwaddress */
uint32_t seed = 0;
for (size_t i = 0; i < sizeof(assign->hwaddr); ++i) {
- // Knuth's multiplicative method
+ /* Knuth's multiplicative method */
uint8_t o = assign->hwaddr[i];
seed += (o*2654435761) % UINT32_MAX;
}
struct interface *iface, void *dest_addr);
-// Create socket and register events
+/* Create socket and register events */
int dhcpv6_init(void)
{
dhcpv6_ia_init();
iface->dhcpv6_event.uloop.fd = -1;
}
- // Configure multicast settings
+ /* Configure multicast settings */
if (enable && iface->dhcpv6) {
struct sockaddr_in6 bind_addr = {AF_INET6, htons(DHCPV6_SERVER_PORT),
0, IN6ADDR_ANY_INIT, 0};
goto out;
}
- // Basic IPv6 configuration
+ /* Basic IPv6 configuration */
if (setsockopt(iface->dhcpv6_event.uloop.fd, SOL_SOCKET, SO_BINDTODEVICE,
iface->ifname, strlen(iface->ifname)) < 0) {
syslog(LOG_ERR, "setsockopt(SO_BINDTODEVICE): %m");
}
}
-// Simple DHCPv6-server for information requests
+/* Simple DHCPv6-server for information requests */
static void handle_client_request(void *addr, void *data, size_t len,
struct interface *iface, void *dest_addr)
{
syslog(LOG_NOTICE, "Got DHCPv6 request");
- // Construct reply message
+ /* Construct reply message */
struct __attribute__((packed)) {
uint8_t msg_type;
uint8_t tr_id[3];
- // DNS Search options
+ /* DNS Search options */
uint8_t search_buf[256], *search_domain = iface->search;
size_t search_len = iface->search_len;
iov[IOV_REFRESH].iov_base = &refresh;
iov[IOV_REFRESH].iov_len = sizeof(refresh);
- // Return inf max rt option in reply to information request
+ /* Return inf max rt option in reply to information request */
maxrt.type = htons(DHCPV6_OPT_INF_MAX_RT);
}
- // Go through options and find what we need
+ /* Go through options and find what we need */
uint16_t otype, olen;
uint8_t *odata;
dhcpv6_for_each_option(opts, opts_end, otype, olen, odata) {
} else if (otype == DHCPV6_OPT_SERVERID) {
if (olen != ntohs(dest.serverid_length) ||
memcmp(odata, &dest.duid_type, olen))
- return; // Not for us
+ return; /* Not for us */
} else if (iface->filter_class && otype == DHCPV6_OPT_USER_CLASS) {
uint8_t *c = odata, *cend = &odata[olen];
for (; &c[2] <= cend && &c[2 + (c[0] << 8) + c[1]] <= cend; c = &c[2 + (c[0] << 8) + c[1]]) {
size_t elen = strlen(iface->filter_class);
if (((((size_t)c[0]) << 8) | c[1]) == elen && !memcmp(&c[2], iface->filter_class, elen))
- return; // Ignore from homenet
+ return; /* Ignore from homenet */
}
} else if (otype == DHCPV6_OPT_IA_PD) {
#ifdef EXT_CER_ID
return;
}
- if (iov[IOV_NESTED].iov_len > 0) // Update length
+ if (iov[IOV_NESTED].iov_len > 0) /* Update length */
update_nested_message(data, len, iov[IOV_DEST].iov_len + iov[IOV_MAXRT].iov_len +
iov[IOV_DNS].iov_len + iov[IOV_DNS_ADDR].iov_len +
iov[IOV_SEARCH].iov_len + iov[IOV_SEARCH_DOMAIN].iov_len +
}
-// Central DHCPv6-relay handler
+/* Central DHCPv6-relay handler */
static void handle_dhcpv6(void *addr, void *data, size_t len,
struct interface *iface, void *dest_addr)
{
}
-// Relay server response (regular relay server handling)
+/* Relay server response (regular relay server handling) */
static void relay_server_response(uint8_t *data, size_t len)
{
- // Information we need to gather
+ /* Information we need to gather */
uint8_t *payload_data = NULL;
size_t payload_len = 0;
int32_t ifaceidx = 0;
int otype, olen;
uint8_t *odata, *end = data + len;
- // Relay DHCPv6 reply from server to client
+ /* Relay DHCPv6 reply from server to client */
struct dhcpv6_relay_header *h = (void*)data;
if (len < sizeof(*h) || h->msg_type != DHCPV6_MSG_RELAY_REPL)
return;
memcpy(&target.sin6_addr, &h->peer_address,
sizeof(struct in6_addr));
- // Go through options and find what we need
+ /* Go through options and find what we need */
dhcpv6_for_each_option(h->options, end, otype, olen, odata) {
if (otype == DHCPV6_OPT_INTERFACE_ID
&& olen == sizeof(ifaceidx)) {
}
}
- // Invalid interface-id or basic payload
+ /* Invalid interface-id or basic payload */
struct interface *iface = odhcpd_get_interface_by_index(ifaceidx);
if (!iface || iface->master || !payload_data || payload_len < 4)
return;
struct in6_addr *dns_ptr = NULL;
size_t dns_count = 0;
- // If the payload is relay-reply we have to send to the server port
+ /* If the payload is relay-reply we have to send to the server port */
if (payload_data[0] == DHCPV6_MSG_RELAY_REPL) {
target.sin6_port = htons(DHCPV6_SERVER_PORT);
- } else { // Go through the payload data
+ } else { /* Go through the payload data */
struct dhcpv6_client_header *h = (void*)payload_data;
end = payload_data + payload_len;
}
}
- // Rewrite DNS servers if requested
+ /* Rewrite DNS servers if requested */
if (iface->always_rewrite_dns && dns_ptr && dns_count > 0) {
if (is_authenticated)
- return; // Impossible to rewrite
+ return; /* Impossible to rewrite */
const struct in6_addr *rewrite = iface->dns;
struct in6_addr addr;
rewrite_cnt = 1;
}
- // Copy over any other addresses
+ /* Copy over any other addresses */
for (size_t i = 0; i < dns_count; ++i) {
size_t j = (i < rewrite_cnt) ? i : rewrite_cnt - 1;
memcpy(&dns_ptr[i], &rewrite[j], sizeof(*rewrite));
return addr;
}
-// Relay client request (regular DHCPv6-relay)
+/* Relay client request (regular DHCPv6-relay) */
static void relay_client_request(struct sockaddr_in6 *source,
const void *data, size_t len, struct interface *iface)
{
h->msg_type == DHCPV6_MSG_RECONFIGURE ||
h->msg_type == DHCPV6_MSG_REPLY ||
h->msg_type == DHCPV6_MSG_ADVERTISE)
- return; // Invalid message types for client
+ return; /* Invalid message types for client */
syslog(LOG_NOTICE, "Got a DHCPv6-request");
- // Construct our forwarding envelope
+ /* Construct our forwarding envelope */
struct dhcpv6_relay_forward_envelope hdr = {
.msg_type = DHCPV6_MSG_RELAY_FORW,
.hop_count = 0,
.relay_message_len = htons(len),
};
- if (h->msg_type == DHCPV6_MSG_RELAY_FORW) { // handle relay-forward
+ if (h->msg_type == DHCPV6_MSG_RELAY_FORW) { /* handle relay-forward */
if (h->hop_count >= DHCPV6_HOP_COUNT_LIMIT)
return; // Invalid hop count
else
hdr.hop_count = h->hop_count + 1;
}
- // use memcpy here as the destination fields are unaligned
+ /* use memcpy here as the destination fields are unaligned */
uint32_t ifindex = iface->ifindex;
memcpy(&hdr.peer_address, &source->sin6_addr, sizeof(struct in6_addr));
memcpy(&hdr.interface_id_data, &ifindex, sizeof(ifindex));
- // Detect public IP of slave interface to use as link-address
+ /* Detect public IP of slave interface to use as link-address */
struct odhcpd_ipaddr *ip = relay_link_address(iface);
if (!ip) {
- // No suitable address! Is the slave not configured yet?
- // Detect public IP of master interface and use it instead
- // This is WRONG and probably violates the RFC. However
- // otherwise we have a hen and egg problem because the
- // slave-interface cannot be auto-configured.
+ /* No suitable address! Is the slave not configured yet?
+ * Detect public IP of master interface and use it instead
+ * This is WRONG and probably violates the RFC. However
+ * otherwise we have a hen and egg problem because the
+ * slave-interface cannot be auto-configured. */
ip = relay_link_address(master);
if (!ip)
- return; // Could not obtain a suitable address
+ return; /* Could not obtain a suitable address */
}
memcpy(&hdr.link_address, &ip->addr.in6, sizeof(hdr.link_address));
static int ping_socket = -1;
-// Filter ICMPv6 messages of type neighbor soliciation
+/* Filter ICMPv6 messages of type neighbor soliciation */
static struct sock_filter bpf[] = {
BPF_STMT(BPF_LD | BPF_B | BPF_ABS, offsetof(struct ip6_hdr, ip6_nxt)),
BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, IPPROTO_ICMPV6, 0, 3),
static const struct sock_fprog bpf_prog = {sizeof(bpf) / sizeof(*bpf), bpf};
static struct netevent_handler ndp_netevent_handler = { .cb = ndp_netevent_cb, };
-// Initialize NDP-proxy
+/* Initialize NDP-proxy */
int ndp_init(void)
{
struct icmp6_filter filt;
int val = 2, ret = 0;
- // Open ICMPv6 socket
+ /* Open ICMPv6 socket */
ping_socket = socket(AF_INET6, SOCK_RAW | SOCK_CLOEXEC, IPPROTO_ICMPV6);
if (ping_socket < 0) {
syslog(LOG_ERR, "socket(AF_INET6): %m");
goto out;
}
- // This is required by RFC 4861
+ /* This is required by RFC 4861 */
val = 255;
if (setsockopt(ping_socket, IPPROTO_IPV6, IPV6_MULTICAST_HOPS,
&val, sizeof(val)) < 0) {
goto out;
}
- // Filter all packages, we only want to send
+ /* Filter all packages, we only want to send */
ICMP6_FILTER_SETBLOCKALL(&filt);
if (setsockopt(ping_socket, IPPROTO_ICMPV6, ICMP6_FILTER,
&filt, sizeof(filt)) < 0) {
iface->ndp_event.handle_dgram = handle_solicit;
odhcpd_register(&iface->ndp_event);
- // If we already were enabled dump is unnecessary, if not do dump
+ /* If we already were enabled dump is unnecessary, if not do dump */
if (!dump_neigh)
netlink_dump_neigh_table(false);
else
}
}
-// Send an ICMP-ECHO. This is less for actually pinging but for the
-// neighbor cache to be kept up-to-date.
+/* Send an ICMP-ECHO. This is less for actually pinging but for the
+ * neighbor cache to be kept up-to-date. */
static void ping6(struct in6_addr *addr,
const struct interface *iface)
{
netlink_setup_route(addr, 128, iface->ifindex, NULL, 128, false);
}
-// Handle solicitations
+/* Handle solicitations */
static void handle_solicit(void *addr, void *data, size_t len,
struct interface *iface, _unused void *dest)
{
char ipbuf[INET6_ADDRSTRLEN];
uint8_t mac[6];
- // Solicitation is for duplicate address detection
+ /* Solicitation is for duplicate address detection */
bool ns_is_dad = IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_src);
- // Don't process solicit messages on non relay interfaces
- // Don't forward any non-DAD solicitation for external ifaces
- // TODO: check if we should even forward DADs for them
+ /* Don't process solicit messages on non relay interfaces
+ * Don't forward any non-DAD solicitation for external ifaces
+ * TODO: check if we should even forward DADs for them */
if (iface->ndp != MODE_RELAY || (iface->external && !ns_is_dad))
return;
if (IN6_IS_ADDR_LINKLOCAL(&req->nd_ns_target) ||
IN6_IS_ADDR_LOOPBACK(&req->nd_ns_target) ||
IN6_IS_ADDR_MULTICAST(&req->nd_ns_target))
- return; // Invalid target
+ return; /* Invalid target */
inet_ntop(AF_INET6, &req->nd_ns_target, ipbuf, sizeof(ipbuf));
syslog(LOG_DEBUG, "Got a NS for %s%%%s", ipbuf, iface->ifname);
odhcpd_get_mac(iface, mac);
if (!memcmp(ll->sll_addr, mac, sizeof(mac)))
- return; // Looped back
+ return; /* Looped back */
struct interface *c;
list_for_each_entry(c, &interfaces, head)
ping6(&req->nd_ns_target, c);
}
-// Use rtnetlink to modify kernel routes
+/* Use rtnetlink to modify kernel routes */
static void setup_route(struct in6_addr *addr, struct interface *iface, bool add)
{
char ipbuf[INET6_ADDRSTRLEN];
nl_socket_modify_cb(rtnl_event.sock, NL_CB_VALID, NL_CB_CUSTOM,
cb_rtnl_valid, NULL);
- // Receive IPv4 address, IPv6 address, IPv6 routes and neighbor events
+ /* Receive IPv4 address, IPv6 address, IPv6 routes and neighbor events */
if (nl_socket_add_memberships(rtnl_event.sock, RTNLGRP_IPV4_IFADDR,
RTNLGRP_IPV6_IFADDR, RTNLGRP_IPV6_ROUTE,
RTNLGRP_NEIGH, RTNLGRP_LINK, 0))
free(event_info->addrs_old.addrs);
}
-// Handler for neighbor cache entries from the kernel. This is our source
-// to learn and unlearn hosts on interfaces.
+/* Handler for neighbor cache entries from the kernel. This is our source
+ * to learn and unlearn hosts on interfaces. */
static int cb_rtnl_valid(struct nl_msg *msg, _unused void *arg)
{
struct nlmsghdr *hdr = nlmsg_hdr(msg);
}
-// compare IPv6 prefixes
+/* compare IPv6 prefixes */
static int prefix6_cmp(const void *va, const void *vb)
{
const struct odhcpd_ipaddr *a = va, *b = vb;
}
-// Detect an IPV6-address currently assigned to the given interface
+/* Detect an IPV6-address currently assigned to the given interface */
ssize_t netlink_get_interface_addrs(int ifindex, bool v6, struct odhcpd_ipaddr **addrs)
{
struct nl_msg *msg;
}
-// Read IPv6 MTU for interface
+/* Read IPv6 MTU for interface */
int odhcpd_get_interface_config(const char *ifname, const char *what)
{
char buf[64];
}
-// Read IPv6 MAC for interface
+/* Read IPv6 MAC for interface */
int odhcpd_get_mac(const struct interface *iface, uint8_t mac[6])
{
struct ifreq ifr;
}
-// Forwards a packet on a specific interface
+/* Forwards a packet on a specific interface */
ssize_t odhcpd_send(int socket, struct sockaddr_in6 *dest,
struct iovec *iov, size_t iov_len,
const struct interface *iface)
{
- // Construct headers
+ /* Construct headers */
uint8_t cmsg_buf[CMSG_SPACE(sizeof(struct in6_pktinfo))] = {0};
struct msghdr msg = {
.msg_name = (void *) dest,
.msg_flags = 0
};
- // Set control data (define destination interface)
+ /* Set control data (define destination interface) */
struct cmsghdr *chdr = CMSG_FIRSTHDR(&msg);
chdr->cmsg_level = IPPROTO_IPV6;
chdr->cmsg_type = IPV6_PKTINFO;
struct in6_pktinfo *pktinfo = (struct in6_pktinfo*)CMSG_DATA(chdr);
pktinfo->ipi6_ifindex = iface->ifindex;
- // Also set scope ID if link-local
+ /* Also set scope ID if link-local */
if (IN6_IS_ADDR_LINKLOCAL(&dest->sin6_addr)
|| IN6_IS_ADDR_MC_LINKLOCAL(&dest->sin6_addr))
dest->sin6_scope_id = iface->ifindex;
}
-// Convenience function to receive and do basic validation of packets
+/* Convenience function to receive and do basic validation of packets */
static void odhcpd_receive_packets(struct uloop_fd *u, _unused unsigned int events)
{
struct odhcpd_event *e = container_of(u, struct odhcpd_event, uloop);
}
- // Extract destination interface
+ /* Extract destination interface */
int destiface = 0;
int *hlim = NULL;
void *dest = NULL;
}
}
- // Check hoplimit if received
+ /* Check hoplimit if received */
if (hlim && *hlim != 255)
continue;
- // Detect interface for packet sockets
+ /* Detect interface for packet sockets */
if (addr.ll.sll_family == AF_PACKET)
destiface = addr.ll.sll_ifindex;
else if (addr.in.sin_family == AF_INET)
inet_ntop(AF_INET, &addr.in.sin_addr, ipbuf, sizeof(ipbuf));
- // From netlink
+ /* From netlink */
if (addr.nl.nl_family == AF_NETLINK) {
syslog(LOG_DEBUG, "Received %li Bytes from %s%%%s", (long)len,
ipbuf, "netlink");
}
}
-// Register events for the multiplexer
+/* Register events for the multiplexer */
int odhcpd_register(struct odhcpd_event *event)
{
event->uloop.cb = odhcpd_receive_packets;
struct icmp6_filter filt;
int ret = 0;
- // Open ICMPv6 socket
+ /* Open ICMPv6 socket */
router_event.uloop.fd = socket(AF_INET6, SOCK_RAW | SOCK_CLOEXEC, IPPROTO_ICMPV6);
if (router_event.uloop.fd < 0) {
syslog(LOG_ERR, "socket(AF_INET6): %m");
goto out;
}
- // Let the kernel compute our checksums
+ /* Let the kernel compute our checksums */
int val = 2;
if (setsockopt(router_event.uloop.fd, IPPROTO_RAW, IPV6_CHECKSUM,
&val, sizeof(val)) < 0) {
goto out;
}
- // This is required by RFC 4861
+ /* This is required by RFC 4861 */
val = 255;
if (setsockopt(router_event.uloop.fd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS,
&val, sizeof(val)) < 0) {
goto out;
}
- // We need to know the source interface
+ /* We need to know the source interface */
val = 1;
if (setsockopt(router_event.uloop.fd, IPPROTO_IPV6, IPV6_RECVPKTINFO,
&val, sizeof(val)) < 0) {
goto out;
}
- // Don't loop back
+ /* Don't loop back */
val = 0;
if (setsockopt(router_event.uloop.fd, IPPROTO_IPV6, IPV6_MULTICAST_LOOP,
&val, sizeof(val)) < 0) {
goto out;
}
- // Filter ICMPv6 package types
+ /* Filter ICMPv6 package types */
ICMP6_FILTER_SETBLOCKALL(&filt);
ICMP6_FILTER_SETPASS(ND_ROUTER_ADVERT, &filt);
ICMP6_FILTER_SETPASS(ND_ROUTER_SOLICIT, &filt);
goto out;
}
- // Register socket
+ /* Register socket */
odhcpd_register(&router_event);
out:
if (ret < 0) {
hdr->icmp6_type == ND_ROUTER_SOLICIT)
return false;
- // Check all options parsed successfully
+ /* Check all options parsed successfully */
return opt == end;
}
-// Detect whether a default route exists, also find the source prefixes
+/* Detect whether a default route exists, also find the source prefixes */
static bool parse_routes(struct odhcpd_ipaddr *n, ssize_t len)
{
rewind(fp_route);
IOV_RA_TOTAL,
};
-// Router Advert server mode
+/* Router Advert server mode */
static uint64_t send_router_advert(struct interface *iface, const struct in6_addr *from)
{
time_t now = odhcpd_time();
odhcpd_get_mac(iface, adv.lladdr.data);
- // If not currently shutting down
+ /* If not currently shutting down */
struct odhcpd_ipaddr *addrs = NULL;
ssize_t ipcnt = 0;
uint32_t minvalid = UINT32_MAX;
bool default_route = false;
bool valid_prefix = false;
- // If not shutdown
+ /* If not shutdown */
if (iface->timer_rs.cb) {
size_t size = sizeof(*addrs) * iface->addr6_len;
addrs = alloca(size);
ipcnt = iface->addr6_len;
- // Check default route
+ /* Check default route */
if (iface->default_router) {
default_route = true;
odhcpd_get_interface_dns_addr(iface, &dns_pref);
- // Construct Prefix Information options
+ /* Construct Prefix Information options */
size_t pfxs_cnt = 0;
struct nd_opt_prefix_info *pfxs = NULL;
p->nd_opt_pi_valid_time = htonl(valid);
}
- // Calculate periodic transmit
+ /* Calculate periodic transmit */
uint32_t maxival;
int msecs = calc_adv_interval(iface, minvalid, &maxival);
syslog(LOG_INFO, "Using a RA lifetime of %d seconds on %s", ntohs(adv.h.nd_ra_router_lifetime), iface->ifname);
- // DNS Recursive DNS
+ /* DNS Recursive DNS */
if (iface->dns_cnt > 0) {
dns_addr = iface->dns;
dns_cnt = iface->dns_cnt;
uint32_t lifetime;
} dns = {ND_OPT_RECURSIVE_DNS, (1 + (2 * dns_cnt)), 0, 0, 0};
- // DNS Search options
+ /* DNS Search options */
uint8_t search_buf[256], *search_domain = iface->search;
size_t search_len = iface->search_len, search_padded = 0;
struct interface *iface = container_of(event, struct interface, timer_rs);
int msecs = send_router_advert(iface, NULL);
- // Rearm timer if not shut down
+ /* Rearm timer if not shut down */
if (event->cb)
uloop_timeout_set(event, msecs);
}
-// Event handler for incoming ICMPv6 packets
+/* Event handler for incoming ICMPv6 packets */
static void handle_icmpv6(void *addr, void *data, size_t len,
struct interface *iface, _unused void *dest)
{
if (!router_icmpv6_valid(addr, data, len))
return;
- if ((iface->ra == MODE_SERVER && !iface->master)) { // Server mode
+ if ((iface->ra == MODE_SERVER && !iface->master)) { /* Server mode */
if (hdr->icmp6_type == ND_ROUTER_SOLICIT)
send_router_advert(iface, &from->sin6_addr);
- } else if (iface->ra == MODE_RELAY) { // Relay mode
+ } else if (iface->ra == MODE_RELAY) { /* Relay mode */
if (hdr->icmp6_type == ND_ROUTER_ADVERT && iface->master)
forward_router_advertisement(data, len);
else if (hdr->icmp6_type == ND_ROUTER_SOLICIT && !iface->master)
}
-// Forward router solicitation
+/* Forward router solicitation */
static void forward_router_solicitation(const struct interface *iface)
{
struct icmp6_hdr rs = {ND_ROUTER_SOLICIT, 0, 0, {{0}}};
}
-// Handler for incoming router solicitations on slave interfaces
+/* Handler for incoming router solicitations on slave interfaces */
static void forward_router_advertisement(uint8_t *data, size_t len)
{
struct nd_router_advert *adv = (struct nd_router_advert *)data;
struct sockaddr_in6 all_nodes;
- // Rewrite options
+ /* Rewrite options */
uint8_t *end = data + len;
uint8_t *mac_ptr = NULL;
struct in6_addr *dns_ptr = NULL;
struct icmpv6_opt *opt;
icmpv6_for_each_option(opt, &adv[1], end) {
if (opt->type == ND_OPT_SOURCE_LINKADDR) {
- // Store address of source MAC-address
+ /* Store address of source MAC-address */
mac_ptr = opt->data;
} else if (opt->type == ND_OPT_RECURSIVE_DNS && opt->len > 1) {
- // Check if we have to rewrite DNS
+ /* Check if we have to rewrite DNS */
dns_ptr = (struct in6_addr*)&opt->data[6];
dns_count = (opt->len - 1) / 2;
}
syslog(LOG_NOTICE, "Got a RA");
- // Indicate a proxy, however we don't follow the rest of RFC 4389 yet
+ /* Indicate a proxy, however we don't follow the rest of RFC 4389 yet */
adv->nd_ra_flags_reserved |= ND_RA_FLAG_PROXY;
- // Forward advertisement to all slave interfaces
+ /* Forward advertisement to all slave interfaces */
memset(&all_nodes, 0, sizeof(all_nodes));
all_nodes.sin6_family = AF_INET6;
inet_pton(AF_INET6, ALL_IPV6_NODES, &all_nodes.sin6_addr);
if (iface->ra != MODE_RELAY || iface->master)
continue;
- // Fixup source hardware address option
+ /* Fixup source hardware address option */
if (mac_ptr)
odhcpd_get_mac(iface, mac_ptr);
- // If we have to rewrite DNS entries
+ /* If we have to rewrite DNS entries */
if (iface->always_rewrite_dns && dns_ptr && dns_count > 0) {
const struct in6_addr *rewrite = iface->dns;
struct in6_addr addr;
if (rewrite_cnt == 0) {
if (odhcpd_get_interface_dns_addr(iface, &addr))
- continue; // Unable to comply
+ continue; /* Unable to comply */
rewrite = &addr;
rewrite_cnt = 1;
}
- // Copy over any other addresses
+ /* Copy over any other addresses */
for (size_t i = 0; i < dns_count; ++i) {
size_t j = (i < rewrite_cnt) ? i : rewrite_cnt - 1;
dns_ptr[i] = rewrite[j];