Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 204253
b: refs/heads/master
c: 519e513
h: refs/heads/master
i:
  204251: 61e3b24
v: v3
  • Loading branch information
Vasu Dev authored and James Bottomley committed Jul 28, 2010
1 parent eea0089 commit 080a1a6
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9d4cbc05f32fc0a1024de2a9d5635bc9d180e4ae
refs/heads/master: 519e5135e2537c9dbc1cbcc0891b0a936ff5dcd2
20 changes: 17 additions & 3 deletions trunk/drivers/scsi/fcoe/fcoe.c
Original file line number Diff line number Diff line change
Expand Up @@ -1210,6 +1210,8 @@ int fcoe_rcv(struct sk_buff *skb, struct net_device *netdev,
struct fcoe_interface *fcoe;
struct fc_frame_header *fh;
struct fcoe_percpu_s *fps;
struct fcoe_port *port;
struct ethhdr *eh;
unsigned int cpu;

fcoe = container_of(ptype, struct fcoe_interface, fcoe_packet_type);
Expand All @@ -1227,9 +1229,21 @@ int fcoe_rcv(struct sk_buff *skb, struct net_device *netdev,
skb_tail_pointer(skb), skb_end_pointer(skb),
skb->csum, skb->dev ? skb->dev->name : "<NULL>");

/* check for FCOE packet type */
if (unlikely(eth_hdr(skb)->h_proto != htons(ETH_P_FCOE))) {
FCOE_NETDEV_DBG(netdev, "Wrong FC type frame");
/* check for mac addresses */
eh = eth_hdr(skb);
port = lport_priv(lport);
if (compare_ether_addr(eh->h_dest, port->data_src_addr) &&
compare_ether_addr(eh->h_dest, fcoe->ctlr.ctl_src_addr) &&
compare_ether_addr(eh->h_dest, (u8[6])FC_FCOE_FLOGI_MAC)) {
FCOE_NETDEV_DBG(netdev, "wrong destination mac address:%pM\n",
eh->h_dest);
goto err;
}

if (is_fip_mode(&fcoe->ctlr) &&
compare_ether_addr(eh->h_source, fcoe->ctlr.dest_addr)) {
FCOE_NETDEV_DBG(netdev, "wrong source mac address:%pM\n",
eh->h_source);
goto err;
}

Expand Down
10 changes: 10 additions & 0 deletions trunk/include/scsi/libfcoe.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,4 +170,14 @@ int fcoe_ctlr_recv_flogi(struct fcoe_ctlr *, struct fc_lport *,
u64 fcoe_wwn_from_mac(unsigned char mac[], unsigned int, unsigned int);
int fcoe_libfc_config(struct fc_lport *, struct libfc_function_template *);

/**
* is_fip_mode() - returns true if FIP mode selected.
* @fip: FCoE controller.
*/
static inline bool is_fip_mode(struct fcoe_ctlr *fip)
{
return fip->state == FIP_ST_ENABLED;
}


#endif /* _LIBFCOE_H */

0 comments on commit 080a1a6

Please sign in to comment.