errno = EINVAL;
return -1;
}
- ocets = (cidr + 7) / 8;
+ ocets = (cidr + 7) / NBBY;
if (!out) {
p += 4 + ocets;
bytes += ((4 * 4) * 2) + 4;
}
TAILQ_INSERT_TAIL(routes, rt, next);
- ocets = (cidr + 7) / 8;
+ ocets = (cidr + 7) / NBBY;
/* If we have ocets then we have a destination and netmask */
if (ocets > 0) {
memcpy(&rt->dest.s_addr, p, ocets);
if (sla)
len += sizeof(*o) + 1 +
((sla->prefix_len -
- ap->prefix_len - 1) / 8) +
- 1;
+ ap->prefix_len - 1) / NBBY)
+ + 1;
}
} else if (!(ifo->options & DHCPCD_PFXDLGONLY))
uint8_t *pp;
el = ((sla->prefix_len -
- ap->prefix_len - 1) / 8) + 1;
+ ap->prefix_len - 1) / NBBY) + 1;
eo = D6_NEXT_OPTION(so);
eo->code = htons(D6_OPTION_PD_EXCLUDE);
eo->len = el + 1;
p = D6_OPTION_DATA(eo);
*p++ = (uint8_t)sla->prefix_len;
pp = addr.s6_addr;
- pp += (ap->prefix_len - 1) / 8;
- u8 = ap->prefix_len % 8;
- if (u8 % 8 == 0)
+ pp += (ap->prefix_len - 1) / NBBY;
+ u8 = ap->prefix_len % NBBY;
+ if (u8 % NBBY == 0)
pp++;
else {
*p = (uint8_t)(*pp++ << u8);
if (ex) {
off = ntohs(ex->len);
if (off < 2) {
- syslog(LOG_ERR, "%s: trunaced PD Exclude",
+ syslog(LOG_ERR, "%s: truncated PD Exclude",
ifp->name);
ex = NULL;
}
#ifndef IF_OPTIONS_H
#define IF_OPTIONS_H
+#include <sys/param.h>
#include <sys/socket.h>
#include <net/if.h>
#include <netinet/in.h>
struct if_options {
uint8_t iaid[4];
int metric;
- uint8_t requestmask[256 / 8];
- uint8_t requiremask[256 / 8];
- uint8_t nomask[256 / 8];
- uint8_t requestmask6[(UINT16_MAX + 1) / 8];
- uint8_t requiremask6[(UINT16_MAX + 1) / 8];
- uint8_t nomask6[(UINT16_MAX + 1) / 8];
- uint8_t dstmask[256 / 8];
+ uint8_t requestmask[256 / NBBY];
+ uint8_t requiremask[256 / NBBY];
+ uint8_t nomask[256 / NBBY];
+ uint8_t requestmask6[(UINT16_MAX + 1) / NBBY];
+ uint8_t requiremask6[(UINT16_MAX + 1) / NBBY];
+ uint8_t nomask6[(UINT16_MAX + 1) / NBBY];
+ uint8_t dstmask[256 / NBBY];
uint32_t leasetime;
time_t timeout;
time_t reboot;
errno = EINVAL;
return -1;
}
- ocets = (cidr + 7) / 8;
+ ocets = (cidr + 7) / NBBY;
addr->s_addr = 0;
if (ocets > 0) {
memset(&addr->s_addr, 255, (size_t)ocets - 1);
memset((unsigned char *)&addr->s_addr + (ocets - 1),
- (256 - (1 << (32 - cidr) % 8)), 1);
+ (256 - (1 << (32 - cidr) % NBBY)), 1);
}
return 0;