diff options
-rw-r--r-- | drivers/scsi/fcoe/fcoe.c | 20 | ||||
-rw-r--r-- | include/scsi/libfcoe.h | 10 |
2 files changed, 27 insertions, 3 deletions
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c index d340cf2d857a..a120962b25b8 100644 --- a/drivers/scsi/fcoe/fcoe.c +++ b/drivers/scsi/fcoe/fcoe.c | |||
@@ -1210,6 +1210,8 @@ int fcoe_rcv(struct sk_buff *skb, struct net_device *netdev, | |||
1210 | struct fcoe_interface *fcoe; | 1210 | struct fcoe_interface *fcoe; |
1211 | struct fc_frame_header *fh; | 1211 | struct fc_frame_header *fh; |
1212 | struct fcoe_percpu_s *fps; | 1212 | struct fcoe_percpu_s *fps; |
1213 | struct fcoe_port *port; | ||
1214 | struct ethhdr *eh; | ||
1213 | unsigned int cpu; | 1215 | unsigned int cpu; |
1214 | 1216 | ||
1215 | fcoe = container_of(ptype, struct fcoe_interface, fcoe_packet_type); | 1217 | fcoe = container_of(ptype, struct fcoe_interface, fcoe_packet_type); |
@@ -1227,9 +1229,21 @@ int fcoe_rcv(struct sk_buff *skb, struct net_device *netdev, | |||
1227 | skb_tail_pointer(skb), skb_end_pointer(skb), | 1229 | skb_tail_pointer(skb), skb_end_pointer(skb), |
1228 | skb->csum, skb->dev ? skb->dev->name : "<NULL>"); | 1230 | skb->csum, skb->dev ? skb->dev->name : "<NULL>"); |
1229 | 1231 | ||
1230 | /* check for FCOE packet type */ | 1232 | /* check for mac addresses */ |
1231 | if (unlikely(eth_hdr(skb)->h_proto != htons(ETH_P_FCOE))) { | 1233 | eh = eth_hdr(skb); |
1232 | FCOE_NETDEV_DBG(netdev, "Wrong FC type frame"); | 1234 | port = lport_priv(lport); |
1235 | if (compare_ether_addr(eh->h_dest, port->data_src_addr) && | ||
1236 | compare_ether_addr(eh->h_dest, fcoe->ctlr.ctl_src_addr) && | ||
1237 | compare_ether_addr(eh->h_dest, (u8[6])FC_FCOE_FLOGI_MAC)) { | ||
1238 | FCOE_NETDEV_DBG(netdev, "wrong destination mac address:%pM\n", | ||
1239 | eh->h_dest); | ||
1240 | goto err; | ||
1241 | } | ||
1242 | |||
1243 | if (is_fip_mode(&fcoe->ctlr) && | ||
1244 | compare_ether_addr(eh->h_source, fcoe->ctlr.dest_addr)) { | ||
1245 | FCOE_NETDEV_DBG(netdev, "wrong source mac address:%pM\n", | ||
1246 | eh->h_source); | ||
1233 | goto err; | 1247 | goto err; |
1234 | } | 1248 | } |
1235 | 1249 | ||
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h index ec13f51531f8..81aee1c4c2f3 100644 --- a/include/scsi/libfcoe.h +++ b/include/scsi/libfcoe.h | |||
@@ -170,4 +170,14 @@ int fcoe_ctlr_recv_flogi(struct fcoe_ctlr *, struct fc_lport *, | |||
170 | u64 fcoe_wwn_from_mac(unsigned char mac[], unsigned int, unsigned int); | 170 | u64 fcoe_wwn_from_mac(unsigned char mac[], unsigned int, unsigned int); |
171 | int fcoe_libfc_config(struct fc_lport *, struct libfc_function_template *); | 171 | int fcoe_libfc_config(struct fc_lport *, struct libfc_function_template *); |
172 | 172 | ||
173 | /** | ||
174 | * is_fip_mode() - returns true if FIP mode selected. | ||
175 | * @fip: FCoE controller. | ||
176 | */ | ||
177 | static inline bool is_fip_mode(struct fcoe_ctlr *fip) | ||
178 | { | ||
179 | return fip->state == FIP_ST_ENABLED; | ||
180 | } | ||
181 | |||
182 | |||
173 | #endif /* _LIBFCOE_H */ | 183 | #endif /* _LIBFCOE_H */ |