Commit fe4d434d authored by Sony Chacko's avatar Sony Chacko Committed by David S. Miller

qlcnic: support anti mac spoofing

Administrator can configure to drop packet in transmit,
if it doesn't match interface mac address, in case of virtual function.
Signed-off-by: default avatarSony Chacko <sony.chacko@qlogic.com>
Signed-off-by: default avatarAmit Kumar Salecha <amit.salecha@qlogic.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0325d69b
...@@ -900,6 +900,7 @@ struct qlcnic_mac_req { ...@@ -900,6 +900,7 @@ struct qlcnic_mac_req {
#define QLCNIC_BRIDGE_ENABLED 0X10 #define QLCNIC_BRIDGE_ENABLED 0X10
#define QLCNIC_DIAG_ENABLED 0x20 #define QLCNIC_DIAG_ENABLED 0x20
#define QLCNIC_ESWITCH_ENABLED 0x40 #define QLCNIC_ESWITCH_ENABLED 0x40
#define QLCNIC_MACSPOOF 0x200
#define QLCNIC_IS_MSI_FAMILY(adapter) \ #define QLCNIC_IS_MSI_FAMILY(adapter) \
((adapter)->flags & (QLCNIC_MSI_ENABLED | QLCNIC_MSIX_ENABLED)) ((adapter)->flags & (QLCNIC_MSI_ENABLED | QLCNIC_MSIX_ENABLED))
......
...@@ -762,6 +762,11 @@ static void ...@@ -762,6 +762,11 @@ static void
qlcnic_set_eswitch_port_features(struct qlcnic_adapter *adapter, qlcnic_set_eswitch_port_features(struct qlcnic_adapter *adapter,
struct qlcnic_esw_func_cfg *esw_cfg) struct qlcnic_esw_func_cfg *esw_cfg)
{ {
adapter->flags &= ~QLCNIC_MACSPOOF;
if (adapter->op_mode == QLCNIC_NON_PRIV_FUNC)
if (esw_cfg->mac_anti_spoof)
adapter->flags |= QLCNIC_MACSPOOF;
qlcnic_set_netdev_features(adapter, esw_cfg); qlcnic_set_netdev_features(adapter, esw_cfg);
} }
...@@ -1912,6 +1917,12 @@ qlcnic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) ...@@ -1912,6 +1917,12 @@ qlcnic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
return NETDEV_TX_BUSY; return NETDEV_TX_BUSY;
} }
if (adapter->flags & QLCNIC_MACSPOOF) {
if (compare_ether_addr(eth_hdr(skb)->h_source,
adapter->mac_addr))
goto drop_packet;
}
frag_count = skb_shinfo(skb)->nr_frags + 1; frag_count = skb_shinfo(skb)->nr_frags + 1;
/* 4 fragments per cmd des */ /* 4 fragments per cmd des */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment