aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFranky Lin <franky.lin@broadcom.com>2017-11-08 08:36:32 -0500
committerKalle Valo <kvalo@codeaurora.org>2017-11-09 21:28:48 -0500
commit6c219b0088158da839a5be63c5b3d96c145501d2 (patch)
tree29894d65ef1d867f09c82062092e1795c4dfb398
parent2fd3877b5bb7d39782c3205a1dcda02023b8514a (diff)
brcmfmac: disable packet filtering in promiscuous mode
Disable arp and nd offload to allow all packets sending to host. Reported-by: Phil Elwell <phil@raspberrypi.org> Tested-by: Phil Elwell <phil@raspberrypi.org> Reviewed-by: Arend Van Spriel <arend.vanspriel@broadcom.com> Signed-off-by: Franky Lin <franky.lin@broadcom.com> Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
-rw-r--r--drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c41
-rw-r--r--drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c38
-rw-r--r--drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h1
3 files changed, 39 insertions, 41 deletions
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index 4bfd43a80273..051d51d7d935 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -472,47 +472,6 @@ send_key_to_dongle(struct brcmf_if *ifp, struct brcmf_wsec_key *key)
472 return err; 472 return err;
473} 473}
474 474
475static s32
476brcmf_configure_arp_nd_offload(struct brcmf_if *ifp, bool enable)
477{
478 s32 err;
479 u32 mode;
480
481 if (enable)
482 mode = BRCMF_ARP_OL_AGENT | BRCMF_ARP_OL_PEER_AUTO_REPLY;
483 else
484 mode = 0;
485
486 /* Try to set and enable ARP offload feature, this may fail, then it */
487 /* is simply not supported and err 0 will be returned */
488 err = brcmf_fil_iovar_int_set(ifp, "arp_ol", mode);
489 if (err) {
490 brcmf_dbg(TRACE, "failed to set ARP offload mode to 0x%x, err = %d\n",
491 mode, err);
492 err = 0;
493 } else {
494 err = brcmf_fil_iovar_int_set(ifp, "arpoe", enable);
495 if (err) {
496 brcmf_dbg(TRACE, "failed to configure (%d) ARP offload err = %d\n",
497 enable, err);
498 err = 0;
499 } else
500 brcmf_dbg(TRACE, "successfully configured (%d) ARP offload to 0x%x\n",
501 enable, mode);
502 }
503
504 err = brcmf_fil_iovar_int_set(ifp, "ndoe", enable);
505 if (err) {
506 brcmf_dbg(TRACE, "failed to configure (%d) ND offload err = %d\n",
507 enable, err);
508 err = 0;
509 } else
510 brcmf_dbg(TRACE, "successfully configured (%d) ND offload to 0x%x\n",
511 enable, mode);
512
513 return err;
514}
515
516static void 475static void
517brcmf_cfg80211_update_proto_addr_mode(struct wireless_dev *wdev) 476brcmf_cfg80211_update_proto_addr_mode(struct wireless_dev *wdev)
518{ 477{
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
index 5cc3a07dda9e..9c7536daf8f7 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
@@ -71,6 +71,43 @@ struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx)
71 return ifp; 71 return ifp;
72} 72}
73 73
74void brcmf_configure_arp_nd_offload(struct brcmf_if *ifp, bool enable)
75{
76 s32 err;
77 u32 mode;
78
79 if (enable)
80 mode = BRCMF_ARP_OL_AGENT | BRCMF_ARP_OL_PEER_AUTO_REPLY;
81 else
82 mode = 0;
83
84 /* Try to set and enable ARP offload feature, this may fail, then it */
85 /* is simply not supported and err 0 will be returned */
86 err = brcmf_fil_iovar_int_set(ifp, "arp_ol", mode);
87 if (err) {
88 brcmf_dbg(TRACE, "failed to set ARP offload mode to 0x%x, err = %d\n",
89 mode, err);
90 } else {
91 err = brcmf_fil_iovar_int_set(ifp, "arpoe", enable);
92 if (err) {
93 brcmf_dbg(TRACE, "failed to configure (%d) ARP offload err = %d\n",
94 enable, err);
95 } else {
96 brcmf_dbg(TRACE, "successfully configured (%d) ARP offload to 0x%x\n",
97 enable, mode);
98 }
99 }
100
101 err = brcmf_fil_iovar_int_set(ifp, "ndoe", enable);
102 if (err) {
103 brcmf_dbg(TRACE, "failed to configure (%d) ND offload err = %d\n",
104 enable, err);
105 } else {
106 brcmf_dbg(TRACE, "successfully configured (%d) ND offload to 0x%x\n",
107 enable, mode);
108 }
109}
110
74static void _brcmf_set_multicast_list(struct work_struct *work) 111static void _brcmf_set_multicast_list(struct work_struct *work)
75{ 112{
76 struct brcmf_if *ifp; 113 struct brcmf_if *ifp;
@@ -134,6 +171,7 @@ static void _brcmf_set_multicast_list(struct work_struct *work)
134 if (err < 0) 171 if (err < 0)
135 brcmf_err("Setting BRCMF_C_SET_PROMISC failed, %d\n", 172 brcmf_err("Setting BRCMF_C_SET_PROMISC failed, %d\n",
136 err); 173 err);
174 brcmf_configure_arp_nd_offload(ifp, !cmd_value);
137} 175}
138 176
139#if IS_ENABLED(CONFIG_IPV6) 177#if IS_ENABLED(CONFIG_IPV6)
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
index a4dd313140f3..17085712bae2 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
@@ -203,6 +203,7 @@ int brcmf_netdev_wait_pend8021x(struct brcmf_if *ifp);
203/* Return pointer to interface name */ 203/* Return pointer to interface name */
204char *brcmf_ifname(struct brcmf_if *ifp); 204char *brcmf_ifname(struct brcmf_if *ifp);
205struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx); 205struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx);
206void brcmf_configure_arp_nd_offload(struct brcmf_if *ifp, bool enable);
206int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked); 207int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
207struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx, 208struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,
208 bool is_p2pdev, const char *name, u8 *mac_addr); 209 bool is_p2pdev, const char *name, u8 *mac_addr);