nla_put_string(struct nlmsghdr *n, unsigned short maxlen,
unsigned short type, const char *data)
{
- unsigned short len;
struct nlattr *nla;
- size_t sl;
+ size_t len, sl;
sl = strlen(data) + 1;
len = NLA_ALIGN(NLA_HDRLEN + sl);
nla = (struct nlattr *)NLMSG_TAIL(n);
nla->nla_type = type;
- nla->nla_len = len;
+ nla->nla_len = (unsigned short)len;
memcpy(NLA_DATA(nla), data, sl);
- n->nlmsg_len = NLMSG_ALIGN(n->nlmsg_len) + len;
+ n->nlmsg_len = NLMSG_ALIGN(n->nlmsg_len) + (unsigned short)len;
return 0;
}
size_t len, rem;
int type;
- memset(tb, 0, sizeof(*tb) * (maxtype + 1));
+ memset(tb, 0, sizeof(*tb) * ((unsigned int)maxtype + 1));
ghdr = NLMSG_DATA(nlm);
head = (struct nlattr *)((char *) ghdr + GENL_HDRLEN);
len = nlm->nlmsg_len - GENL_HDRLEN - NLMSG_HDRLEN;
out:
ifp->ssid[ifp->ssid_len] = '\0';
- return ifp->ssid_len;
+ return (int)ifp->ssid_len;
}
static int
return -1;
memset(&nlm, 0, sizeof(nlm));
nlm.hdr.nlmsg_len = NLMSG_LENGTH(sizeof(struct genlmsghdr));
- nlm.hdr.nlmsg_type = family;
+ nlm.hdr.nlmsg_type = (unsigned short)family;
nlm.hdr.nlmsg_flags = NLM_F_REQUEST;
nlm.ghdr.cmd = NL80211_CMD_GET_INTERFACE;
nla_put_32(&nlm.hdr, sizeof(nlm), NL80211_ATTR_IFINDEX, ifp->index);
r = if_getssid_wext(ifp->name, ifp->ssid);
if (r != -1)
- ifp->ssid_len = r;
+ ifp->ssid_len = (unsigned int)r;
#ifdef HAVE_NL80211_H
else if (r == -1)
r = if_getssid_nl80211(ifp);
if (ifp == NULL)
ifname = "all";
else if (own) {
- if (if_disable_autolinklocal(ctx, ifp->index) == -1)
+ if (if_disable_autolinklocal(ctx, (int)ifp->index) == -1)
syslog(LOG_DEBUG, "%s: if_disable_autolinklocal: %m",
ifp->name);
}