Don't oops in dp_output_control() for skbs with null ->dev.

This shouldn't ordinarily happen, since normal packets are received from
a real device, but some packets can be spontaneously generated within
the switch and thus have null ->dev.  (Possibly that is itself a bug
that we should track down; not sure.)
This commit is contained in:
Ben Pfaff committed 2008-11-13 12:44:04 -08:00
1 parent ae0af9b03d
commit 42841a1a87
1 file changed
+3 -3
+3 -3
View File
@@ -670,7 +670,6 @@ dp_output_control(struct datapath *dp, struct sk_buff *skb,
* forward the whole packet? */
struct sk_buff *f_skb;
struct ofp_packet_in *opi;
struct net_bridge_port *p;
size_t fwd_len, opi_len;
int err;
@@ -686,8 +685,9 @@ dp_output_control(struct datapath *dp, struct sk_buff *skb,
}
opi->buffer_id = htonl(buffer_id);
opi->total_len = htons(skb->len);
p = skb->dev->br_port;
opi->in_port = htons(p ? p->port_no : OFPP_LOCAL);
opi->in_port = htons(skb->dev && skb->dev->br_port
? skb->dev->br_port->port_no
: OFPP_LOCAL);
opi->reason = reason;
opi->pad = 0;
memcpy(opi->data, skb_mac_header(skb), fwd_len);