AP: Add multicast-to-unicast conversion send for "x_snoop"
Multicast-to-unicast conversion send will be needed in various part of Proxy ARP and DGAF Disable. Signed-off-by: Kyeyoon Park <kyeyoonp@qca.qualcomm.com>
This commit is contained in:
parent
ed4ddb6d77
commit
5c58944d08
2 changed files with 38 additions and 0 deletions
|
@ -10,6 +10,7 @@
|
|||
|
||||
#include "utils/common.h"
|
||||
#include "hostapd.h"
|
||||
#include "sta_info.h"
|
||||
#include "ap_drv_ops.h"
|
||||
#include "x_snoop.h"
|
||||
|
||||
|
@ -83,6 +84,33 @@ x_snoop_get_l2_packet(struct hostapd_data *hapd,
|
|||
}
|
||||
|
||||
|
||||
void x_snoop_mcast_to_ucast_convert_send(struct hostapd_data *hapd,
|
||||
struct sta_info *sta, u8 *buf,
|
||||
size_t len)
|
||||
{
|
||||
int res;
|
||||
u8 addr[ETH_ALEN];
|
||||
u8 *dst_addr = buf;
|
||||
|
||||
if (!(dst_addr[0] & 0x01))
|
||||
return;
|
||||
|
||||
/* save the multicast destination address for restoring it later */
|
||||
os_memcpy(addr, buf, ETH_ALEN);
|
||||
|
||||
os_memcpy(buf, sta->addr, ETH_ALEN);
|
||||
res = l2_packet_send(hapd->sock_dhcp, NULL, 0, buf, len);
|
||||
if (res) {
|
||||
wpa_printf(MSG_DEBUG,
|
||||
"x_snoop: Failed to send mcast to ucast converted packet to "
|
||||
MACSTR, MAC2STR(sta->addr));
|
||||
}
|
||||
|
||||
/* restore the multicast destination address */
|
||||
os_memcpy(buf, addr, ETH_ALEN);
|
||||
}
|
||||
|
||||
|
||||
void x_snoop_deinit(struct hostapd_data *hapd)
|
||||
{
|
||||
hostapd_drv_br_set_net_param(hapd, DRV_BR_NET_PARAM_GARP_ACCEPT, 0);
|
||||
|
|
|
@ -19,6 +19,9 @@ x_snoop_get_l2_packet(struct hostapd_data *hapd,
|
|||
void (*handler)(void *ctx, const u8 *src_addr,
|
||||
const u8 *buf, size_t len),
|
||||
enum l2_packet_filter_type type);
|
||||
void x_snoop_mcast_to_ucast_convert_send(struct hostapd_data *hapd,
|
||||
struct sta_info *sta, u8 *buf,
|
||||
size_t len);
|
||||
void x_snoop_deinit(struct hostapd_data *hapd);
|
||||
|
||||
#else /* CONFIG_PROXYARP */
|
||||
|
@ -37,6 +40,13 @@ x_snoop_get_l2_packet(struct hostapd_data *hapd,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static inline void
|
||||
x_snoop_mcast_to_ucast_convert_send(struct hostapd_data *hapd,
|
||||
struct sta_info *sta, void *buf,
|
||||
size_t len)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void x_snoop_deinit(struct hostapd_data *hapd)
|
||||
{
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue