dhcpcd.conf and generate more accurate stable private addresses.
dhcpcd_selectprofile(struct interface *ifp, const char *profile)
{
struct if_options *ifo;
-
- ifo = read_config(ifp->ctx, ifp->name, ifp->ssid, profile);
+ char pssid[PROFILE_LEN];
+
+ if (ifp->ssid_len) {
+ ssize_t r;
+ r =print_string(pssid, sizeof(pssid), ifp->ssid, ifp->ssid_len);
+ if (r == -1) {
+ syslog(LOG_ERR, "%s: %s: %m", ifp->name, __func__);
+ pssid[0] = '\0';
+ }
+ } else
+ pssid[0] = '\0';
+ ifo = read_config(ifp->ctx, ifp->name, pssid, profile);
if (ifo == NULL) {
syslog(LOG_DEBUG, "%s: no profile %s", ifp->name, profile);
return -1;
unsigned int metric;
int carrier;
int wireless;
- char ssid[IF_SSIDSIZE];
+ uint8_t ssid[IF_SSIDSIZE];
unsigned int ssid_len;
char profile[PROFILE_LEN];
}
static int
-if_getssid1(const char *ifname, char *ssid)
+if_getssid1(const char *ifname, uint8_t *ssid)
{
int s, retval = -1;
#if defined(SIOCG80211NWID)
/* We can't include if.h or dhcpcd.h because
* they would pull in net/if.h, which defeats the purpose of this hack. */
#define IF_SSIDSIZE 33
-int if_getssid_wext(const char *ifname, char *ssid);
+int if_getssid_wext(const char *ifname, uint8_t *ssid);
int
-if_getssid_wext(const char *ifname, char *ssid)
+if_getssid_wext(const char *ifname, uint8_t *ssid)
{
#ifdef SIOCGIWESSID
int s, retval;
#include <linux/genetlink.h>
#include <linux/nl80211.h>
#else
-int if_getssid_wext(const char *ifname, char *ssid);
+int if_getssid_wext(const char *ifname, uint8_t *ssid);
#endif
#define bpf_insn sock_filter
nlm.ghdr.version = 1;
if (nla_put_string(&nlm.hdr, sizeof(nlm), CTRL_ATTR_FAMILY_NAME, name)
== -1)
- return -1;
+ return -1;
return send_netlink(ctx, NULL, NETLINK_GENERIC, &nlm.hdr,
&_gnl_getfamily);
}
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);
-
+
return send_netlink(ifp->ctx, ifp, NETLINK_GENERIC, &nlm.hdr,
&_if_getssid);
}
add_attr_nest(struct nlmsghdr *n, unsigned short maxlen, unsigned short type)
{
struct rtattr *nest;
-
+
nest = NLMSG_TAIL(n);
add_attr_l(n, maxlen, type, NULL, 0);
return nest;
IN6_ADDR_GEN_MODE_NONE);
add_attr_nest_end(&nlm.hdr, afs6);
add_attr_nest_end(&nlm.hdr, afs);
-
+
return send_netlink(ctx, NULL, NETLINK_ROUTE, &nlm.hdr, NULL);
}
ipv6_makestableprivate1(struct in6_addr *addr,
const struct in6_addr *prefix, int prefix_len,
const unsigned char *netiface, size_t netiface_len,
- const char *netid, size_t netid_len,
+ const unsigned char *netid, size_t netid_len,
uint32_t *dad_counter,
const unsigned char *secret, size_t secret_len)
{
* as the interface identifier */
r = ipv6_makestableprivate1(addr, prefix, prefix_len,
ifp->hwaddr, ifp->hwlen,
- ifp->ssid, strlen(ifp->ssid),
+ ifp->ssid, ifp->ssid_len,
&dad,
ifp->ctx->secret, ifp->ctx->secret_len);