1 From 6c219b0088158da839a5be63c5b3d96c145501d2 Mon Sep 17 00:00:00 2001
2 From: Franky Lin <franky.lin@broadcom.com>
3 Date: Wed, 8 Nov 2017 14:36:32 +0100
4 Subject: [PATCH] brcmfmac: disable packet filtering in promiscuous mode
6 Disable arp and nd offload to allow all packets sending to host.
8 Reported-by: Phil Elwell <phil@raspberrypi.org>
9 Tested-by: Phil Elwell <phil@raspberrypi.org>
10 Reviewed-by: Arend Van Spriel <arend.vanspriel@broadcom.com>
11 Signed-off-by: Franky Lin <franky.lin@broadcom.com>
12 Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
13 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
15 .../broadcom/brcm80211/brcmfmac/cfg80211.c | 41 ----------------------
16 .../wireless/broadcom/brcm80211/brcmfmac/core.c | 38 ++++++++++++++++++++
17 .../wireless/broadcom/brcm80211/brcmfmac/core.h | 1 +
18 3 files changed, 39 insertions(+), 41 deletions(-)
20 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
21 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
22 @@ -472,47 +472,6 @@ send_key_to_dongle(struct brcmf_if *ifp,
27 -brcmf_configure_arp_nd_offload(struct brcmf_if *ifp, bool enable)
33 - mode = BRCMF_ARP_OL_AGENT | BRCMF_ARP_OL_PEER_AUTO_REPLY;
37 - /* Try to set and enable ARP offload feature, this may fail, then it */
38 - /* is simply not supported and err 0 will be returned */
39 - err = brcmf_fil_iovar_int_set(ifp, "arp_ol", mode);
41 - brcmf_dbg(TRACE, "failed to set ARP offload mode to 0x%x, err = %d\n",
45 - err = brcmf_fil_iovar_int_set(ifp, "arpoe", enable);
47 - brcmf_dbg(TRACE, "failed to configure (%d) ARP offload err = %d\n",
51 - brcmf_dbg(TRACE, "successfully configured (%d) ARP offload to 0x%x\n",
55 - err = brcmf_fil_iovar_int_set(ifp, "ndoe", enable);
57 - brcmf_dbg(TRACE, "failed to configure (%d) ND offload err = %d\n",
61 - brcmf_dbg(TRACE, "successfully configured (%d) ND offload to 0x%x\n",
68 brcmf_cfg80211_update_proto_addr_mode(struct wireless_dev *wdev)
70 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
71 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
72 @@ -71,6 +71,43 @@ struct brcmf_if *brcmf_get_ifp(struct br
76 +void brcmf_configure_arp_nd_offload(struct brcmf_if *ifp, bool enable)
82 + mode = BRCMF_ARP_OL_AGENT | BRCMF_ARP_OL_PEER_AUTO_REPLY;
86 + /* Try to set and enable ARP offload feature, this may fail, then it */
87 + /* is simply not supported and err 0 will be returned */
88 + err = brcmf_fil_iovar_int_set(ifp, "arp_ol", mode);
90 + brcmf_dbg(TRACE, "failed to set ARP offload mode to 0x%x, err = %d\n",
93 + err = brcmf_fil_iovar_int_set(ifp, "arpoe", enable);
95 + brcmf_dbg(TRACE, "failed to configure (%d) ARP offload err = %d\n",
98 + brcmf_dbg(TRACE, "successfully configured (%d) ARP offload to 0x%x\n",
103 + err = brcmf_fil_iovar_int_set(ifp, "ndoe", enable);
105 + brcmf_dbg(TRACE, "failed to configure (%d) ND offload err = %d\n",
108 + brcmf_dbg(TRACE, "successfully configured (%d) ND offload to 0x%x\n",
113 static void _brcmf_set_multicast_list(struct work_struct *work)
115 struct brcmf_if *ifp;
116 @@ -134,6 +171,7 @@ static void _brcmf_set_multicast_list(st
118 brcmf_err("Setting BRCMF_C_SET_PROMISC failed, %d\n",
120 + brcmf_configure_arp_nd_offload(ifp, !cmd_value);
123 #if IS_ENABLED(CONFIG_IPV6)
124 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
125 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
126 @@ -203,6 +203,7 @@ int brcmf_netdev_wait_pend8021x(struct b
127 /* Return pointer to interface name */
128 char *brcmf_ifname(struct brcmf_if *ifp);
129 struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx);
130 +void brcmf_configure_arp_nd_offload(struct brcmf_if *ifp, bool enable);
131 int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
132 struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,
133 bool is_p2pdev, const char *name, u8 *mac_addr);