if (blobmsg_type(cur) != BLOBMSG_TYPE_STRING)
continue;
- if (!blobmsg_check_attr(cur, false))
- continue;
+ if (!blobmsg_check_attr(cur, false))
+ continue;
for (i = 0; ra_flags[i].name; i++) {
if (!strcmp(ra_flags[i].name, blobmsg_get_string(cur))) {
goto err;
if (!iface->ifindex &&
- (iface->ifindex = if_nametoindex(iface->ifname)) <= 0)
+ (iface->ifindex = if_nametoindex(iface->ifname)) <= 0)
goto err;
if ((iface->ifflags = odhcpd_get_flags(iface)) < 0)
iface->dhcp_leasetime = time;
else
syslog(LOG_ERR, "Invalid %s value configured for interface '%s'",
- iface_attrs[IFACE_ATTR_LEASETIME].name, iface->name);
+ iface_attrs[IFACE_ATTR_LEASETIME].name, iface->name);
}
iface->preferred_lifetime = time;
else
syslog(LOG_ERR, "Invalid %s value configured for interface '%s'",
- iface_attrs[IFACE_ATTR_PREFERRED_LIFETIME].name, iface->name);
+ iface_attrs[IFACE_ATTR_PREFERRED_LIFETIME].name, iface->name);
}
iface->ignore = false;
} else
syslog(LOG_ERR, "Invalid %s mode configured for interface '%s'",
- iface_attrs[IFACE_ATTR_RA].name, iface->name);
+ iface_attrs[IFACE_ATTR_RA].name, iface->name);
}
if ((c = tb[IFACE_ATTR_DHCPV4])) {
}
} else
syslog(LOG_ERR, "Invalid %s mode configured for interface %s",
- iface_attrs[IFACE_ATTR_DHCPV4].name, iface->name);
+ iface_attrs[IFACE_ATTR_DHCPV4].name, iface->name);
}
if ((c = tb[IFACE_ATTR_DHCPV6])) {
iface->ignore = false;
} else
syslog(LOG_ERR, "Invalid %s mode configured for interface '%s'",
- iface_attrs[IFACE_ATTR_DHCPV6].name, iface->name);
+ iface_attrs[IFACE_ATTR_DHCPV6].name, iface->name);
}
if ((c = tb[IFACE_ATTR_NDP])) {
iface->ignore = false;
} else
syslog(LOG_ERR, "Invalid %s mode configured for interface '%s'",
- iface_attrs[IFACE_ATTR_NDP].name, iface->name);
+ iface_attrs[IFACE_ATTR_NDP].name, iface->name);
}
if ((c = tb[IFACE_ATTR_ROUTER])) {
iface->dhcpv4_router[iface->dhcpv4_router_cnt - 1] = addr4;
} else
syslog(LOG_ERR, "Invalid %s value configured for interface '%s'",
- iface_attrs[IFACE_ATTR_ROUTER].name, iface->name);
+ iface_attrs[IFACE_ATTR_ROUTER].name, iface->name);
}
}
if (inet_pton(AF_INET, blobmsg_get_string(cur), &addr4) == 1) {
if (addr4.s_addr == INADDR_ANY) {
syslog(LOG_ERR, "Invalid %s value configured for interface '%s'",
- iface_attrs[IFACE_ATTR_DNS].name, iface->name);
+ iface_attrs[IFACE_ATTR_DNS].name, iface->name);
continue;
}
} else if (inet_pton(AF_INET6, blobmsg_get_string(cur), &addr6) == 1) {
if (IN6_IS_ADDR_UNSPECIFIED(&addr6)) {
syslog(LOG_ERR, "Invalid %s value configured for interface '%s'",
- iface_attrs[IFACE_ATTR_DNS].name, iface->name);
+ iface_attrs[IFACE_ATTR_DNS].name, iface->name);
continue;
}
iface->dns[iface->dns_cnt - 1] = addr6;
} else
syslog(LOG_ERR, "Invalid %s value configured for interface '%s'",
- iface_attrs[IFACE_ATTR_DNS].name, iface->name);
+ iface_attrs[IFACE_ATTR_DNS].name, iface->name);
}
}
len = dn_comp(domain, buf, sizeof(buf), NULL, NULL);
if (len <= 0) {
syslog(LOG_ERR, "Invalid %s value configured for interface '%s'",
- iface_attrs[IFACE_ATTR_DOMAIN].name, iface->name);
+ iface_attrs[IFACE_ATTR_DOMAIN].name, iface->name);
continue;
}
iface->dhcpv6_pd_min_len = pd_min_len;
else
syslog(LOG_ERR, "Invalid %s value configured for interface '%s'",
- iface_attrs[IFACE_ATTR_DHCPV6_PD_MIN_LEN].name, iface->name);
+ iface_attrs[IFACE_ATTR_DHCPV6_PD_MIN_LEN].name, iface->name);
}
if ((c = tb[IFACE_ATTR_DHCPV6_NA]))
/* IFACE_ATTR_RA_MANAGEMENT aka ra_management is deprecated since 2019 */
if (!tb[IFACE_ATTR_RA_FLAGS] && !tb[IFACE_ATTR_RA_SLAAC] &&
- (c = tb[IFACE_ATTR_RA_MANAGEMENT])) {
+ (c = tb[IFACE_ATTR_RA_MANAGEMENT])) {
switch (blobmsg_get_u32(c)) {
case 0:
iface->ra_flags = ND_RA_FLAG_OTHER;
if (parse_ra_flags(&iface->ra_flags, c) < 0)
syslog(LOG_ERR, "Invalid %s value configured for interface '%s'",
- iface_attrs[IFACE_ATTR_RA_FLAGS].name, iface->name);
+ iface_attrs[IFACE_ATTR_RA_FLAGS].name, iface->name);
}
if ((c = tb[IFACE_ATTR_RA_REACHABLETIME])) {
iface->ra_reachabletime = ra_reachabletime;
else
syslog(LOG_ERR, "Invalid %s value configured for interface '%s'",
- iface_attrs[IFACE_ATTR_RA_REACHABLETIME].name, iface->name);
+ iface_attrs[IFACE_ATTR_RA_REACHABLETIME].name, iface->name);
}
if ((c = tb[IFACE_ATTR_RA_RETRANSTIME])) {
iface->ra_retranstime = ra_retranstime;
else
syslog(LOG_ERR, "Invalid %s value configured for interface '%s'",
- iface_attrs[IFACE_ATTR_RA_RETRANSTIME].name, iface->name);
+ iface_attrs[IFACE_ATTR_RA_RETRANSTIME].name, iface->name);
}
if ((c = tb[IFACE_ATTR_RA_HOPLIMIT])) {
iface->ra_hoplimit = ra_hoplimit;
else
syslog(LOG_ERR, "Invalid %s value configured for interface '%s'",
- iface_attrs[IFACE_ATTR_RA_HOPLIMIT].name, iface->name);
+ iface_attrs[IFACE_ATTR_RA_HOPLIMIT].name, iface->name);
}
if ((c = tb[IFACE_ATTR_RA_MTU])) {
iface->ra_mtu = ra_mtu;
else
syslog(LOG_ERR, "Invalid %s value configured for interface '%s'",
- iface_attrs[IFACE_ATTR_RA_MTU].name, iface->name);
+ iface_attrs[IFACE_ATTR_RA_MTU].name, iface->name);
}
if ((c = tb[IFACE_ATTR_RA_SLAAC]))
iface->route_preference = 0;
else
syslog(LOG_ERR, "Invalid %s mode configured for interface '%s'",
- iface_attrs[IFACE_ATTR_RA_PREFERENCE].name, iface->name);
+ iface_attrs[IFACE_ATTR_RA_PREFERENCE].name, iface->name);
}
if ((c = tb[IFACE_ATTR_PD_MANAGER]))
if ((c = tb[IFACE_ATTR_PD_CER]) &&
inet_pton(AF_INET6, blobmsg_get_string(c), &iface->dhcpv6_pd_cer) < 1)
syslog(LOG_ERR, "Invalid %s value configured for interface '%s'",
- iface_attrs[IFACE_ATTR_PD_CER].name, iface->name);
+ iface_attrs[IFACE_ATTR_PD_CER].name, iface->name);
if ((c = tb[IFACE_ATTR_NDPROXY_ROUTING]))
iface->learn_routes = blobmsg_get_bool(c);
return cmp;
return memcmp(l1->mac.ether_addr_octet, l2->mac.ether_addr_octet,
- sizeof(l1->mac.ether_addr_octet));
+ sizeof(l1->mac.ether_addr_octet));
}
static void lease_change_config(struct lease *l_old, struct lease *l_new)
bool update = false;
if ((!!l_new->hostname != !!l_old->hostname) ||
- (l_new->hostname && strcmp(l_new->hostname, l_old->hostname))) {
+ (l_new->hostname && strcmp(l_new->hostname, l_old->hostname))) {
free(l_old->hostname);
l_old->hostname = NULL;
vlist_for_each_element(&leases, l, node) {
if (!memcmp(l->mac.ether_addr_octet, mac,
- sizeof(l->mac.ether_addr_octet)))
+ sizeof(l->mac.ether_addr_octet)))
return l;
}
if (iface->router_event.uloop.fd < 0) {
/* Open ICMPv6 socket */
iface->router_event.uloop.fd = socket(AF_INET6, SOCK_RAW | SOCK_CLOEXEC,
- IPPROTO_ICMPV6);
+ IPPROTO_ICMPV6);
if (iface->router_event.uloop.fd < 0) {
syslog(LOG_ERR, "socket(AF_INET6): %m");
ret = -1;
}
if (setsockopt(iface->router_event.uloop.fd, SOL_SOCKET, SO_BINDTODEVICE,
- iface->ifname, strlen(iface->ifname)) < 0) {
+ iface->ifname, strlen(iface->ifname)) < 0) {
syslog(LOG_ERR, "setsockopt(SO_BINDTODEVICE): %m");
ret = -1;
goto out;
/* Let the kernel compute our checksums */
if (setsockopt(iface->router_event.uloop.fd, IPPROTO_RAW, IPV6_CHECKSUM,
- &val, sizeof(val)) < 0) {
+ &val, sizeof(val)) < 0) {
syslog(LOG_ERR, "setsockopt(IPV6_CHECKSUM): %m");
ret = -1;
goto out;
/* This is required by RFC 4861 */
val = 255;
if (setsockopt(iface->router_event.uloop.fd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS,
- &val, sizeof(val)) < 0) {
+ &val, sizeof(val)) < 0) {
syslog(LOG_ERR, "setsockopt(IPV6_MULTICAST_HOPS): %m");
ret = -1;
goto out;
}
if (setsockopt(iface->router_event.uloop.fd, IPPROTO_IPV6, IPV6_UNICAST_HOPS,
- &val, sizeof(val)) < 0) {
+ &val, sizeof(val)) < 0) {
syslog(LOG_ERR, "setsockopt(IPV6_UNICAST_HOPS): %m");
ret = -1;
goto out;
/* We need to know the source interface */
val = 1;
if (setsockopt(iface->router_event.uloop.fd, IPPROTO_IPV6, IPV6_RECVPKTINFO,
- &val, sizeof(val)) < 0) {
+ &val, sizeof(val)) < 0) {
syslog(LOG_ERR, "setsockopt(IPV6_RECVPKTINFO): %m");
ret = -1;
goto out;
}
if (setsockopt(iface->router_event.uloop.fd, IPPROTO_IPV6, IPV6_RECVHOPLIMIT,
- &val, sizeof(val)) < 0) {
+ &val, sizeof(val)) < 0) {
syslog(LOG_ERR, "setsockopt(IPV6_RECVHOPLIMIT): %m");
ret = -1;
goto out;
/* Don't loop back */
val = 0;
if (setsockopt(iface->router_event.uloop.fd, IPPROTO_IPV6, IPV6_MULTICAST_LOOP,
- &val, sizeof(val)) < 0) {
+ &val, sizeof(val)) < 0) {
syslog(LOG_ERR, "setsockopt(IPV6_MULTICAST_LOOP): %m");
ret = -1;
goto out;
ICMP6_FILTER_SETPASS(ND_ROUTER_ADVERT, &filt);
ICMP6_FILTER_SETPASS(ND_ROUTER_SOLICIT, &filt);
if (setsockopt(iface->router_event.uloop.fd, IPPROTO_ICMPV6, ICMP6_FILTER,
- &filt, sizeof(filt)) < 0) {
+ &filt, sizeof(filt)) < 0) {
syslog(LOG_ERR, "setsockopt(ICMP6_FILTER): %m");
ret = -1;
goto out;
}
if (setsockopt(iface->router_event.uloop.fd, IPPROTO_IPV6,
- IPV6_ADD_MEMBERSHIP, &mreq, sizeof(mreq)) < 0) {
+ IPV6_ADD_MEMBERSHIP, &mreq, sizeof(mreq)) < 0) {
ret = -1;
syslog(LOG_ERR, "setsockopt(IPV6_ADD_MEMBERSHIP): %m");
goto out;
}
static int calc_adv_interval(struct interface *iface, uint32_t minvalid,
- uint32_t *maxival)
+ uint32_t *maxival)
{
uint32_t minival = iface->ra_mininterval;
int msecs;
if (ADDR_MATCH_PIO_FILTER(addr, iface)) {
syslog(LOG_INFO, "Address %s filtered out as RA prefix on %s",
- inet_ntop(AF_INET6, &addr->addr.in6, buf, sizeof(buf)),
- iface->name);
+ inet_ntop(AF_INET6, &addr->addr.in6, buf, sizeof(buf)),
+ iface->name);
continue; /* PIO filtered out of this RA */
}
if (default_route) {
syslog(LOG_WARNING, "A default route is present but there is no public prefix "
- "on %s thus we don't announce a default route by overriding ra_lifetime!", iface->name);
+ "on %s thus we don't announce a default route by overriding ra_lifetime!", iface->name);
} else {
syslog(LOG_WARNING, "No default route present, overriding ra_lifetime!");
}
if (ADDR_MATCH_PIO_FILTER(addr, iface)) {
syslog(LOG_INFO, "Address %s filtered out as RA route on %s",
- inet_ntop(AF_INET6, &addr->addr.in6, buf, sizeof(buf)),
- iface->name);
+ inet_ntop(AF_INET6, &addr->addr.in6, buf, sizeof(buf)),
+ iface->name);
continue; /* PIO filtered out of this RA */
}