diff options
author | Sony Chacko <sony.chacko@qlogic.com> | 2010-08-19 01:08:27 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-08-19 19:52:40 -0400 |
commit | fe4d434da8e96142e36eb22fc5cf29ef2c2df9c2 (patch) | |
tree | 6e4d124efa2ecc98d025a79268c77dd46e449ef2 /drivers/net/qlcnic | |
parent | 0325d69b2a1feb72f11413dbfcc1705ccfc203c1 (diff) |
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: Sony Chacko <sony.chacko@qlogic.com>
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/qlcnic')
-rw-r--r-- | drivers/net/qlcnic/qlcnic.h | 1 | ||||
-rw-r--r-- | drivers/net/qlcnic/qlcnic_main.c | 11 |
2 files changed, 12 insertions, 0 deletions
diff --git a/drivers/net/qlcnic/qlcnic.h b/drivers/net/qlcnic/qlcnic.h index 9433a05555f1..b58c4119f279 100644 --- a/drivers/net/qlcnic/qlcnic.h +++ b/drivers/net/qlcnic/qlcnic.h | |||
@@ -900,6 +900,7 @@ struct qlcnic_mac_req { | |||
900 | #define QLCNIC_BRIDGE_ENABLED 0X10 | 900 | #define QLCNIC_BRIDGE_ENABLED 0X10 |
901 | #define QLCNIC_DIAG_ENABLED 0x20 | 901 | #define QLCNIC_DIAG_ENABLED 0x20 |
902 | #define QLCNIC_ESWITCH_ENABLED 0x40 | 902 | #define QLCNIC_ESWITCH_ENABLED 0x40 |
903 | #define QLCNIC_MACSPOOF 0x200 | ||
903 | #define QLCNIC_IS_MSI_FAMILY(adapter) \ | 904 | #define QLCNIC_IS_MSI_FAMILY(adapter) \ |
904 | ((adapter)->flags & (QLCNIC_MSI_ENABLED | QLCNIC_MSIX_ENABLED)) | 905 | ((adapter)->flags & (QLCNIC_MSI_ENABLED | QLCNIC_MSIX_ENABLED)) |
905 | 906 | ||
diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c index aa1f6b3c3b80..de4be00e31e5 100644 --- a/drivers/net/qlcnic/qlcnic_main.c +++ b/drivers/net/qlcnic/qlcnic_main.c | |||
@@ -762,6 +762,11 @@ static void | |||
762 | qlcnic_set_eswitch_port_features(struct qlcnic_adapter *adapter, | 762 | qlcnic_set_eswitch_port_features(struct qlcnic_adapter *adapter, |
763 | struct qlcnic_esw_func_cfg *esw_cfg) | 763 | struct qlcnic_esw_func_cfg *esw_cfg) |
764 | { | 764 | { |
765 | adapter->flags &= ~QLCNIC_MACSPOOF; | ||
766 | if (adapter->op_mode == QLCNIC_NON_PRIV_FUNC) | ||
767 | if (esw_cfg->mac_anti_spoof) | ||
768 | adapter->flags |= QLCNIC_MACSPOOF; | ||
769 | |||
765 | qlcnic_set_netdev_features(adapter, esw_cfg); | 770 | qlcnic_set_netdev_features(adapter, esw_cfg); |
766 | } | 771 | } |
767 | 772 | ||
@@ -1912,6 +1917,12 @@ qlcnic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
1912 | return NETDEV_TX_BUSY; | 1917 | return NETDEV_TX_BUSY; |
1913 | } | 1918 | } |
1914 | 1919 | ||
1920 | if (adapter->flags & QLCNIC_MACSPOOF) { | ||
1921 | if (compare_ether_addr(eth_hdr(skb)->h_source, | ||
1922 | adapter->mac_addr)) | ||
1923 | goto drop_packet; | ||
1924 | } | ||
1925 | |||
1915 | frag_count = skb_shinfo(skb)->nr_frags + 1; | 1926 | frag_count = skb_shinfo(skb)->nr_frags + 1; |
1916 | 1927 | ||
1917 | /* 4 fragments per cmd des */ | 1928 | /* 4 fragments per cmd des */ |