snprintf(sun->sun_path, sizeof(sun->sun_path), CONTROLSOCKET,
ifname ? "-" : "", ifname ? ifname : "");
strlcpy(ctx->control_sock, sun->sun_path, sizeof(ctx->control_sock));
- return SUN_LEN(sun);
+ return (socklen_t)SUN_LEN(sun);
}
int
dhcp_envoption(struct dhcpcd_ctx *ctx, char **env, const char *prefix,
const char *ifname, struct dhcp_opt *opt,
const uint8_t *(*dgetopt)(struct dhcpcd_ctx *,
- unsigned int *, unsigned int *, unsigned int *,
- const uint8_t *, unsigned int, struct dhcp_opt **),
+ size_t *, unsigned int *, size_t *,
+ const uint8_t *, size_t, struct dhcp_opt **),
const uint8_t *od, size_t ol)
{
- size_t e, i, n;
- unsigned int eoc, eos, eol;
+ size_t e, i, n, eos, eol;
+ unsigned int eoc;
const uint8_t *eod;
int ov;
struct dhcp_opt *eopt, *oopt;
}
dhcp->op = DHCP_BOOTREQUEST;
- dhcp->hwtype = iface->family;
+ dhcp->hwtype = (uint8_t)iface->family;
switch (iface->family) {
case ARPHRD_ETHER:
case ARPHRD_IEEE802:
- dhcp->hwlen = iface->hwlen;
+ dhcp->hwlen = (uint8_t)iface->hwlen;
memcpy(&dhcp->chaddr, &iface->hwaddr, iface->hwlen);
break;
}
*p++ = 0; /* from server for PTR RR */
*p++ = 0; /* from server for A RR if S=1 */
if (hostname) {
- ul = encode_rfc1035(hostname, p);
- *lp += ul;
- p += ul;
+ i = encode_rfc1035(hostname, p);
+ *lp += i;
+ p += i;
}
} else if (ifo->options & DHCPCD_HOSTNAME && hostname) {
*p++ = DHO_HOSTNAME;
}
-static int
+static ssize_t
dhcp6_update_auth(struct interface *ifp, struct dhcp6_message *m, size_t len)
{
struct dhcp6_state *state;
return 1;
}
-static short l2addr_len(unsigned short if_type)
+static uint8_t
+l2addr_len(unsigned short if_type)
{
switch (if_type) {
return 8;
case ARPHRD_INFINIBAND:
return 20;
- default:
- return -1;
}
+
+ /* Impossible */
+ return 0;
}
static int
/* Re-read hardware address and friends */
if (!(ifi->ifi_flags & IFF_UP) && hwaddr) {
- short l;
+ uint8_t l;
l = l2addr_len(ifi->ifi_type);
if (hwaddr->rta_len == RTA_LENGTH(l))
l = strtoul(arg, &np, 0);
if (l <= (unsigned long)UINT32_MAX && errno == 0 && *np == '\0') {
if (n)
- u32 = htonl(l);
+ u32 = htonl((uint32_t)l);
else
- u32 = l;
+ u32 = (uint32_t)l;
memcpy(iaid, &u32, sizeof(u32));
return 0;
}
int opt, const char *arg, struct dhcp_opt **ldop, struct dhcp_opt **edop)
{
int i, l, t;
- unsigned int u;
+ unsigned long u;
char *p = NULL, *fp, *np, **nconf;
ssize_t s;
struct in_addr addr, addr2;
ndop->encopts_len = 0;
} else
free_dhcp_opt_embenc(ndop);
- ndop->option = u; /* could have been 0 */
+ ndop->option = (uint32_t)u; /* could have been 0 */
ndop->type = t;
ndop->len = (size_t)l;
ndop->var = np;
return -1;
}
ifo->vivco = vivco;
- ifo->vivco_en = u;
+ ifo->vivco_en = (uint32_t)u;
vivco = &ifo->vivco[ifo->vivco_len++];
vivco->len = dl;
vivco->data = (uint8_t *)np;
continue;
if (env) {
snprintf(buffer, sizeof(buffer),
- "ra%d_from", i);
+ "ra%zu_from", i);
setvar(&env, prefix, buffer, rap->sfrom);
}
l++;
}
if (env) {
snprintf(buffer, sizeof(buffer),
- "ra%d_%s", i, optn);
+ "ra%zu_%s", i, optn);
setvar(&env, prefix, buffer, rao->option);
}
}
ifname = "all";
snprintf(path, sizeof(path), "%s/%s/autoconf", prefix, ifname);
- i = check_proc_int(path);
- if (i != 1) {
+ ra = check_proc_int(path);
+ if (ra != 1) {
syslog(LOG_WARNING, "%s: IPv6 kernel autoconf disabled",
ifname);
return -1;