From: Justin Pettit Date: Mon, 6 Oct 2008 22:51:06 +0000 (-0700) Subject: Unconditionally set skb->dev in dp_set_origin. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4d0a3296522f2695a6f8b769100615ada1a54315;p=openvswitch Unconditionally set skb->dev in dp_set_origin. If an invalid port index was used in dp_set_origin, the value of skb->dev was left unchanged. This change causes skb->dev to be set to NULL in those circumstances. This makes Packet Out and Add Flow messages that use a buffer id behave like Packet Out without a buffer id. --- diff --git a/datapath/datapath.c b/datapath/datapath.c index d84240bc..3fa8cdc0 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -533,17 +533,16 @@ output_all(struct datapath *dp, struct sk_buff *skb, int flood) /* Marks 'skb' as having originated from 'in_port' in 'dp'. FIXME: how are devices reference counted? */ -int dp_set_origin(struct datapath *dp, uint16_t in_port, +void dp_set_origin(struct datapath *dp, uint16_t in_port, struct sk_buff *skb) { struct net_bridge_port *p = (in_port < OFPP_MAX ? dp->ports[in_port] : in_port == OFPP_LOCAL ? dp->local_port : NULL); - if (p) { + if (p) skb->dev = p->dev; - return 0; - } - return -ENOENT; + else + skb->dev = NULL; } static int xmit_skb(struct sk_buff *skb) diff --git a/datapath/datapath.h b/datapath/datapath.h index f5225e1b..10a42c08 100644 --- a/datapath/datapath.h +++ b/datapath/datapath.h @@ -90,7 +90,7 @@ int dp_output_port(struct datapath *, struct sk_buff *, int out_port, int ignore_no_fwd); int dp_output_control(struct datapath *, struct sk_buff *, uint32_t, size_t, int); -int dp_set_origin(struct datapath *, uint16_t, struct sk_buff *); +void dp_set_origin(struct datapath *, uint16_t, struct sk_buff *); int dp_send_features_reply(struct datapath *, const struct sender *); int dp_send_config_reply(struct datapath *, const struct sender *); int dp_send_port_status(struct net_bridge_port *p, uint8_t status);