[PATCHv2 21/21] VLAN: use hostapd_logger
Michael Braun
michael-dev
Tue Jun 4 05:58:42 PDT 2013
The VLAN code is only used by hostapd and should use
hostapd_logger instead of wpa_printf in order to
have its messages in syslog on APs.
Signed-hostap: Michael Braun <michael-dev at fami-braun.de>
diff --git a/hostapd/main.c b/hostapd/main.c
index 90e5966..ec3ac2b 100644
--- a/hostapd/main.c
+++ b/hostapd/main.c
@@ -91,6 +91,9 @@ static void hostapd_logger_cb(void *ctx, const u8 *addr, unsigned int module,
case HOSTAPD_MODULE_MLME:
module_str = "MLME";
break;
+ case HOSTAPD_MODULE_VLAN:
+ module_str = "VLAN";
+ break;
default:
module_str = NULL;
break;
diff --git a/src/ap/vlan_init.c b/src/ap/vlan_init.c
index 1842aef..a2e98ee 100644
--- a/src/ap/vlan_init.c
+++ b/src/ap/vlan_init.c
@@ -51,7 +51,9 @@ static int ifconfig_helper(const char *if_name, int up)
struct ifreq ifr;
if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
- wpa_printf(MSG_ERROR, "VLAN: %s: socket(AF_INET,SOCK_STREAM) "
+ hostapd_logger(NULL, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_WARNING,
+ "%s: socket(AF_INET,SOCK_STREAM) "
"failed: %s", __func__, strerror(errno));
return -1;
}
@@ -60,7 +62,9 @@ static int ifconfig_helper(const char *if_name, int up)
os_strlcpy(ifr.ifr_name, if_name, IFNAMSIZ);
if (ioctl(fd, SIOCGIFFLAGS, &ifr) != 0) {
- wpa_printf(MSG_ERROR, "VLAN: %s: ioctl(SIOCGIFFLAGS) failed "
+ hostapd_logger(NULL, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_WARNING,
+ "%s: ioctl(SIOCGIFFLAGS) failed "
"for interface %s: %s",
__func__, if_name, strerror(errno));
close(fd);
@@ -73,7 +77,9 @@ static int ifconfig_helper(const char *if_name, int up)
ifr.ifr_flags &= ~IFF_UP;
if (ioctl(fd, SIOCSIFFLAGS, &ifr) != 0) {
- wpa_printf(MSG_ERROR, "VLAN: %s: ioctl(SIOCSIFFLAGS) failed "
+ hostapd_logger(NULL, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_WARNING,
+ "%s: ioctl(SIOCSIFFLAGS) failed "
"for interface %s (up=%d): %s",
__func__, if_name, up, strerror(errno));
close(fd);
@@ -87,14 +93,18 @@ static int ifconfig_helper(const char *if_name, int up)
static int ifconfig_up(const char *if_name)
{
- wpa_printf(MSG_DEBUG, "VLAN: Set interface %s up", if_name);
+ hostapd_logger(NULL, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_DEBUG,
+ "Set interface %s up", if_name);
return ifconfig_helper(if_name, 1);
}
static int ifconfig_down(const char *if_name)
{
- wpa_printf(MSG_DEBUG, "VLAN: Set interface %s down", if_name);
+ hostapd_logger(NULL, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_DEBUG,
+ "Set interface %s down", if_name);
return ifconfig_helper(if_name, 0);
}
@@ -119,9 +129,13 @@ static int br_delif(const char *br_name, const char *if_name)
unsigned long args[2];
int if_index;
- wpa_printf(MSG_DEBUG, "VLAN: br_delif(%s, %s)", br_name, if_name);
+ hostapd_logger(NULL, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_DEBUG,
+ "br_delif(%s, %s)", br_name, if_name);
if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
- wpa_printf(MSG_ERROR, "VLAN: %s: socket(AF_INET,SOCK_STREAM) "
+ hostapd_logger(NULL, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_WARNING,
+ "%s: socket(AF_INET,SOCK_STREAM) "
"failed: %s", __func__, strerror(errno));
return -1;
}
@@ -129,7 +143,9 @@ static int br_delif(const char *br_name, const char *if_name)
if_index = if_nametoindex(if_name);
if (if_index == 0) {
- wpa_printf(MSG_ERROR, "VLAN: %s: Failure determining "
+ hostapd_logger(NULL, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_WARNING,
+ "%s: Failure determining "
"interface index for '%s'",
__func__, if_name);
close(fd);
@@ -144,7 +160,9 @@ static int br_delif(const char *br_name, const char *if_name)
if (ioctl(fd, SIOCDEVPRIVATE, &ifr) < 0 && errno != EINVAL) {
/* No error if interface already removed. */
- wpa_printf(MSG_ERROR, "VLAN: %s: ioctl[SIOCDEVPRIVATE,"
+ hostapd_logger(NULL, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_WARNING,
+ "%s: ioctl[SIOCDEVPRIVATE,"
"BRCTL_DEL_IF] failed for br_name=%s if_name=%s: "
"%s", __func__, br_name, if_name, strerror(errno));
close(fd);
@@ -170,9 +188,13 @@ static int br_addif(const char *br_name, const char *if_name)
unsigned long args[2];
int if_index;
- wpa_printf(MSG_DEBUG, "VLAN: br_addif(%s, %s)", br_name, if_name);
+ hostapd_logger(NULL, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_DEBUG,
+ "br_addif(%s, %s)", br_name, if_name);
if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
- wpa_printf(MSG_ERROR, "VLAN: %s: socket(AF_INET,SOCK_STREAM) "
+ hostapd_logger(NULL, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_WARNING,
+ "%s: socket(AF_INET,SOCK_STREAM) "
"failed: %s", __func__, strerror(errno));
return -1;
}
@@ -180,7 +202,9 @@ static int br_addif(const char *br_name, const char *if_name)
if_index = if_nametoindex(if_name);
if (if_index == 0) {
- wpa_printf(MSG_ERROR, "VLAN: %s: Failure determining "
+ hostapd_logger(NULL, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_WARNING,
+ "%s: Failure determining "
"interface index for '%s'",
__func__, if_name);
close(fd);
@@ -200,7 +224,9 @@ static int br_addif(const char *br_name, const char *if_name)
return 1;
}
- wpa_printf(MSG_ERROR, "VLAN: %s: ioctl[SIOCDEVPRIVATE,"
+ hostapd_logger(NULL, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_WARNING,
+ "%s: ioctl[SIOCDEVPRIVATE,"
"BRCTL_ADD_IF] failed for br_name=%s if_name=%s: "
"%s", __func__, br_name, if_name, strerror(errno));
close(fd);
@@ -217,9 +243,13 @@ static int br_delbr(const char *br_name)
int fd;
unsigned long arg[2];
- wpa_printf(MSG_DEBUG, "VLAN: br_delbr(%s)", br_name);
+ hostapd_logger(NULL, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_DEBUG,
+ "br_delbr(%s)", br_name);
if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
- wpa_printf(MSG_ERROR, "VLAN: %s: socket(AF_INET,SOCK_STREAM) "
+ hostapd_logger(NULL, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_WARNING,
+ "%s: socket(AF_INET,SOCK_STREAM) "
"failed: %s", __func__, strerror(errno));
return -1;
}
@@ -229,7 +259,9 @@ static int br_delbr(const char *br_name)
if (ioctl(fd, SIOCGIFBR, arg) < 0 && errno != ENXIO) {
/* No error if bridge already removed. */
- wpa_printf(MSG_ERROR, "VLAN: %s: BRCTL_DEL_BRIDGE failed for "
+ hostapd_logger(NULL, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_WARNING,
+ "%s: BRCTL_DEL_BRIDGE failed for "
"%s: %s", __func__, br_name, strerror(errno));
close(fd);
return -1;
@@ -253,9 +285,13 @@ static int br_addbr(const char *br_name)
unsigned long arg[4];
struct ifreq ifr;
- wpa_printf(MSG_DEBUG, "VLAN: br_addbr(%s)", br_name);
+ hostapd_logger(NULL, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_DEBUG,
+ "br_addbr(%s)", br_name);
if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
- wpa_printf(MSG_ERROR, "VLAN: %s: socket(AF_INET,SOCK_STREAM) "
+ hostapd_logger(NULL, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_WARNING,
+ "%s: socket(AF_INET,SOCK_STREAM) "
"failed: %s", __func__, strerror(errno));
return -1;
}
@@ -269,7 +305,9 @@ static int br_addbr(const char *br_name)
close(fd);
return 1;
} else {
- wpa_printf(MSG_ERROR, "VLAN: %s: BRCTL_ADD_BRIDGE "
+ hostapd_logger(NULL, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_WARNING,
+ "%s: BRCTL_ADD_BRIDGE "
"failed for %s: %s",
__func__, br_name, strerror(errno));
close(fd);
@@ -286,7 +324,9 @@ static int br_addbr(const char *br_name)
arg[3] = 0;
ifr.ifr_data = (char *) &arg;
if (ioctl(fd, SIOCDEVPRIVATE, &ifr) < 0) {
- wpa_printf(MSG_ERROR, "VLAN: %s: "
+ hostapd_logger(NULL, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_WARNING,
+ "%s: "
"BRCTL_SET_BRIDGE_FORWARD_DELAY (1 sec) failed for "
"%s: %s", __func__, br_name, strerror(errno));
/* Continue anyway */
@@ -307,7 +347,9 @@ static int br_getnumports(const char *br_name)
struct ifreq ifr;
if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
- wpa_printf(MSG_ERROR, "VLAN: %s: socket(AF_INET,SOCK_STREAM) "
+ hostapd_logger(NULL, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_WARNING,
+ "%s: socket(AF_INET,SOCK_STREAM) "
"failed: %s", __func__, strerror(errno));
return -1;
}
@@ -322,7 +364,9 @@ static int br_getnumports(const char *br_name)
ifr.ifr_data = (__caddr_t) arg;
if (ioctl(fd, SIOCDEVPRIVATE, &ifr) < 0) {
- wpa_printf(MSG_ERROR, "VLAN: %s: BRCTL_GET_PORT_LIST "
+ hostapd_logger(NULL, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_WARNING,
+ "%s: BRCTL_GET_PORT_LIST "
"failed for %s: %s",
__func__, br_name, strerror(errno));
close(fd);
@@ -347,15 +391,21 @@ int vlan_rem(const char *if_name)
int fd;
struct vlan_ioctl_args if_request;
- wpa_printf(MSG_DEBUG, "VLAN: vlan_rem(%s)", if_name);
+ hostapd_logger(NULL, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_DEBUG,
+ "vlan_rem(%s)", if_name);
if ((os_strlen(if_name) + 1) > sizeof(if_request.device1)) {
- wpa_printf(MSG_ERROR, "VLAN: Interface name too long: '%s'",
+ hostapd_logger(NULL, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_WARNING,
+ "Interface name too long: '%s'",
if_name);
return -1;
}
if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
- wpa_printf(MSG_ERROR, "VLAN: %s: socket(AF_INET,SOCK_STREAM) "
+ hostapd_logger(NULL, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_WARNING,
+ "%s: socket(AF_INET,SOCK_STREAM) "
"failed: %s", __func__, strerror(errno));
return -1;
}
@@ -366,7 +416,9 @@ int vlan_rem(const char *if_name)
if_request.cmd = DEL_VLAN_CMD;
if (ioctl(fd, SIOCSIFVLAN, &if_request) < 0) {
- wpa_printf(MSG_ERROR, "VLAN: %s: DEL_VLAN_CMD failed for %s: "
+ hostapd_logger(NULL, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_WARNING,
+ "%s: DEL_VLAN_CMD failed for %s: "
"%s", __func__, if_name, strerror(errno));
close(fd);
return -1;
@@ -390,18 +442,24 @@ int vlan_add(const char *if_name, int vid, const char *vlan_if_name)
int fd;
struct vlan_ioctl_args if_request;
- wpa_printf(MSG_DEBUG, "VLAN: vlan_add(if_name=%s, vid=%d)",
+ hostapd_logger(NULL, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_DEBUG,
+ "vlan_add(if_name=%s, vid=%d)",
if_name, vid);
ifconfig_up(if_name);
if ((os_strlen(if_name) + 1) > sizeof(if_request.device1)) {
- wpa_printf(MSG_ERROR, "VLAN: Interface name too long: '%s'",
+ hostapd_logger(NULL, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_WARNING,
+ "Interface name too long: '%s'",
if_name);
return -1;
}
if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
- wpa_printf(MSG_ERROR, "VLAN: %s: socket(AF_INET,SOCK_STREAM) "
+ hostapd_logger(NULL, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_WARNING,
+ "%s: socket(AF_INET,SOCK_STREAM) "
"failed: %s", __func__, strerror(errno));
return -1;
}
@@ -424,9 +482,10 @@ int vlan_add(const char *if_name, int vid, const char *vlan_if_name)
os_strncmp(if_request.u.device2, if_name,
sizeof(if_request.u.device2)) == 0) {
close(fd);
- wpa_printf(MSG_DEBUG, "VLAN: vlan_add: "
- "if_name %s exists already",
- if_request.device1);
+ hostapd_logger(NULL, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_DEBUG,
+ "vlan_add: if_name %s exists "
+ "already", if_request.device1);
return 1;
}
}
@@ -440,7 +499,9 @@ int vlan_add(const char *if_name, int vid, const char *vlan_if_name)
if_request.cmd = ADD_VLAN_CMD;
if (ioctl(fd, SIOCSIFVLAN, &if_request) < 0) {
- wpa_printf(MSG_ERROR, "VLAN: %s: ADD_VLAN_CMD failed for %s: "
+ hostapd_logger(NULL, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_WARNING,
+ "%s: ADD_VLAN_CMD failed for %s: "
"%s",
__func__, if_request.device1, strerror(errno));
close(fd);
@@ -457,10 +518,14 @@ static int vlan_set_name_type(unsigned int name_type)
int fd;
struct vlan_ioctl_args if_request;
- wpa_printf(MSG_DEBUG, "VLAN: vlan_set_name_type(name_type=%u)",
+ hostapd_logger(NULL, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_DEBUG,
+ "vlan_set_name_type(name_type=%u)",
name_type);
if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
- wpa_printf(MSG_ERROR, "VLAN: %s: socket(AF_INET,SOCK_STREAM) "
+ hostapd_logger(NULL, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_WARNING,
+ "%s: socket(AF_INET,SOCK_STREAM) "
"failed: %s", __func__, strerror(errno));
return -1;
}
@@ -470,7 +535,9 @@ static int vlan_set_name_type(unsigned int name_type)
if_request.u.name_type = name_type;
if_request.cmd = SET_VLAN_NAME_TYPE_CMD;
if (ioctl(fd, SIOCSIFVLAN, &if_request) < 0) {
- wpa_printf(MSG_ERROR, "VLAN: %s: SET_VLAN_NAME_TYPE_CMD "
+ hostapd_logger(NULL, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_WARNING,
+ "%s: SET_VLAN_NAME_TYPE_CMD "
"name_type=%u failed: %s",
__func__, name_type, strerror(errno));
close(fd);
@@ -589,8 +656,10 @@ static int hapd_put_dynamic_iface(char *parent, char *ifname,
hapd_glob->count_dynamic,
sizeof(*hapd_glob->dynamic_iface));
if (!tmp) {
- wpa_printf(MSG_ERROR, "VLAN: failed to release memory in %s",
- __FUNCTION__);
+ hostapd_logger(hapd, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_WARNING,
+ "failed to release memory in %s",
+ __FUNCTION__);
return -1;
}
hapd_glob->dynamic_iface = tmp;
@@ -665,7 +734,9 @@ static void vlan_newlink(char *ifname, int ifidx, struct hostapd_data *hapd)
(vlan->ifidx > 0 && ifidx > 0 && vlan->ifidx != ifidx))
continue;
- wpa_printf(MSG_DEBUG, "VLAN: vlan_newlink(%s)", ifname);
+ hostapd_logger(hapd, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_DEBUG,
+ "vlan_newlink(%s)", ifname);
int untagged, num_tagged, *tagged;
num_tagged = vlan_tagged(&vlan->vlan_id, &tagged);
@@ -686,7 +757,9 @@ static void vlan_newlink(char *ifname, int ifidx, struct hostapd_data *hapd)
ret = os_snprintf(vlan_ifname, sizeof(vlan_ifname),
"%s.%d", ifname, tagged_vlan_id);
if (ret >= sizeof(vlan_ifname) || ret < 0) {
- wpa_printf(MSG_ERROR, "VLAN: length limit for "
+ hostapd_logger(hapd, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_WARNING,
+ "length limit for "
"interfaces names reached.");
continue;
}
@@ -772,8 +845,9 @@ static void vlan_dellink(char *ifname, int ifidx, struct hostapd_data *hapd)
(vlan->ifidx > 0 && ifidx > 0 && vlan->ifidx != ifidx))
continue;
- wpa_printf(MSG_DEBUG, "VLAN:%s: vlan_dellink(%s)",
- hapd->conf->iface, ifname);
+ hostapd_logger(hapd, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_DEBUG, "%s: vlan_dellink(%s)",
+ hapd->conf->iface, ifname);
int untagged = vlan_untagged(&vlan->vlan_id);
if (untagged > 0) {
@@ -788,8 +862,10 @@ static void vlan_dellink(char *ifname, int ifidx, struct hostapd_data *hapd)
ret = os_snprintf(vlan_ifname, sizeof(vlan_ifname),
"%s.%d", ifname, tagged_vlan_id);
if (ret >= sizeof(vlan_ifname) || ret < 0) {
- wpa_printf(MSG_ERROR, "VLAN: length limit for "
- "interfaces names reached.");
+ hostapd_logger(hapd, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_WARNING,
+ "length limit for interfaces "
+ "names reached.");
continue;
}
int *clean = NULL;
@@ -878,7 +954,9 @@ static void vlan_event_receive(int sock, void *eloop_ctx, void *sock_ctx)
(struct sockaddr *) &from, &fromlen);
if (left < 0) {
if (errno != EINTR && errno != EAGAIN)
- wpa_printf(MSG_ERROR, "VLAN: %s: recvfrom failed: %s",
+ hostapd_logger(hapd, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_WARNING,
+ "%s: recvfrom failed: %s",
__func__, strerror(errno));
return;
}
@@ -890,7 +968,9 @@ static void vlan_event_receive(int sock, void *eloop_ctx, void *sock_ctx)
len = h->nlmsg_len;
plen = len - sizeof(*h);
if (len > left || plen < 0) {
- wpa_printf(MSG_DEBUG, "VLAN: Malformed netlink "
+ hostapd_logger(hapd, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_DEBUG,
+ "Malformed netlink "
"message: len=%d left=%d plen=%d",
len, left, plen);
break;
@@ -911,7 +991,9 @@ static void vlan_event_receive(int sock, void *eloop_ctx, void *sock_ctx)
}
if (left > 0) {
- wpa_printf(MSG_DEBUG, "VLAN: %s: %d extra bytes in the end of "
+ hostapd_logger(hapd, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_DEBUG,
+ "%s: %d extra bytes in the end of "
"netlink message", __func__, left);
}
}
@@ -936,7 +1018,9 @@ full_dynamic_vlan_init(struct hostapd_data *hapd)
priv->s = socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
if (priv->s < 0) {
- wpa_printf(MSG_ERROR, "VLAN: %s: socket(PF_NETLINK,SOCK_RAW,"
+ hostapd_logger(hapd, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_WARNING,
+ "%s: socket(PF_NETLINK,SOCK_RAW,"
"NETLINK_ROUTE) failed: %s",
__func__, strerror(errno));
os_free(priv);
@@ -947,7 +1031,9 @@ full_dynamic_vlan_init(struct hostapd_data *hapd)
local.nl_family = AF_NETLINK;
local.nl_groups = RTMGRP_LINK;
if (bind(priv->s, (struct sockaddr *) &local, sizeof(local)) < 0) {
- wpa_printf(MSG_ERROR, "VLAN: %s: bind(netlink) failed: %s",
+ hostapd_logger(hapd, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_WARNING,
+ "%s: bind(netlink) failed: %s",
__func__, strerror(errno));
close(priv->s);
os_free(priv);
@@ -992,7 +1078,9 @@ int vlan_setup_encryption_dyn(struct hostapd_data *hapd,
i == mssid->wep.idx, NULL, 0,
mssid->wep.key[i], mssid->wep.len[i]))
{
- wpa_printf(MSG_ERROR, "VLAN: Could not set WEP "
+ hostapd_logger(hapd, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_WARNING,
+ "Could not set WEP "
"encryption for dynamic VLAN");
return -1;
}
@@ -1009,10 +1097,12 @@ static int vlan_dynamic_add(struct hostapd_data *hapd,
if (vlan_untagged(&vlan->vlan_id) != VLAN_ID_WILDCARD) {
if (hostapd_vlan_if_add(hapd, vlan->ifname)) {
if (errno != EEXIST) {
- wpa_printf(MSG_ERROR, "VLAN: Could "
- "not add VLAN %s: %s",
- vlan->ifname,
- strerror(errno));
+ hostapd_logger(hapd, NULL,
+ HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_WARNING,
+ "Could not add VLAN %s:"
+ " %s", vlan->ifname,
+ strerror(errno));
return -1;
}
}
@@ -1048,7 +1138,9 @@ static void vlan_dynamic_remove(struct hostapd_data *hapd,
if (vlan_untagged(&vlan_id) != VLAN_ID_WILDCARD &&
hostapd_vlan_if_remove(hapd, buf)) {
- wpa_printf(MSG_ERROR, "VLAN: Could not remove VLAN "
+ hostapd_logger(hapd, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_WARNING,
+ "Could not remove VLAN "
"iface: %s: %s",
buf, strerror(errno));
}
@@ -1072,7 +1164,9 @@ int vlan_init(struct hostapd_data *hapd)
struct hostapd_vlan *vlan;
vlan = os_zalloc(sizeof(*vlan));
if (vlan == NULL) {
- wpa_printf(MSG_ERROR, "Out of memory while assigning "
+ hostapd_logger(hapd, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_WARNING,
+ "Out of memory while assigning "
"VLAN interfaces");
return -1;
}
@@ -1116,7 +1210,9 @@ struct hostapd_vlan * vlan_add_dynamic(struct hostapd_data *hapd,
|| vlan_untagged(&vlan->vlan_id) != VLAN_ID_WILDCARD)
return NULL;
- wpa_printf(MSG_DEBUG, "VLAN: %s(vlan_id=%s ifname=%s)",
+ hostapd_logger(hapd, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_DEBUG,
+ "%s(vlan_id=%s ifname=%s)",
__func__, vlan2str(&vlan_id), vlan->ifname);
ifname = os_strdup(vlan->ifname);
if (ifname == NULL)
@@ -1211,7 +1307,9 @@ void vlan_remove_timer(void *eloop_ctx, void *timeout_ctx)
struct hostapd_data *hapd = eloop_ctx;
struct vlan_removal_info *ctx = timeout_ctx;
- wpa_printf(MSG_DEBUG, "VLAN: %s(ifname=%s, ifidx=%d)", __func__, ctx->ifname, ctx->ifidx);
+ hostapd_logger(hapd, NULL, HOSTAPD_MODULE_VLAN, HOSTAPD_LEVEL_DEBUG,
+ "%s(ifname=%s, ifidx=%d)", __func__, ctx->ifname,
+ ctx->ifidx);
if (hapd_put_dynamic_iface(NULL, ctx->ifname, hapd) != 1)
goto out;
@@ -1240,8 +1338,9 @@ int vlan_remove_dynamic(struct hostapd_data *hapd, vlan_t vlan_id)
|| !vlan_notempty(&vlan_id))
return 1;
- wpa_printf(MSG_DEBUG, "VLAN: %s(vlan_id=%s)", __func__,
- vlan2str(&vlan_id));
+ hostapd_logger(hapd, NULL, HOSTAPD_MODULE_VLAN,
+ HOSTAPD_LEVEL_DEBUG,
+ "%s(vlan_id=%s)", __func__, vlan2str(&vlan_id));
vlan = hapd->conf->vlan;
while (vlan) {
diff --git a/src/utils/wpa_debug.h b/src/utils/wpa_debug.h
index 2ed1bd8..51e8419 100644
--- a/src/utils/wpa_debug.h
+++ b/src/utils/wpa_debug.h
@@ -260,6 +260,7 @@ void hostapd_logger_register_cb(hostapd_logger_cb_func func);
#define HOSTAPD_MODULE_DRIVER 0x00000010
#define HOSTAPD_MODULE_IAPP 0x00000020
#define HOSTAPD_MODULE_MLME 0x00000040
+#define HOSTAPD_MODULE_VLAN 0x00000080
enum hostapd_logger_level {
HOSTAPD_LEVEL_DEBUG_VERBOSE = 0,
More information about the Hostap
mailing list