X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=ofproto%2Fpktbuf.c;h=fc4c66ca102e48e2dad99c71ac32d83ac4665a09;hb=80740385d2700b1a03d28a02338d02509fd0b697;hp=02c590cf61375861a5d49481db87fac515eb3d9d;hpb=b2fda3effc787f265b5ad5dfa967ac00627bd075;p=openvswitch diff --git a/ofproto/pktbuf.c b/ofproto/pktbuf.c index 02c590cf..fc4c66ca 100644 --- a/ofproto/pktbuf.c +++ b/ofproto/pktbuf.c @@ -161,6 +161,8 @@ pktbuf_get_null(void) * identifies a "null" packet buffer (created with pktbuf_get_null()), stores * NULL in '*bufferp' and UINT16_max in '*in_port'. * + * 'in_port' may be NULL if the input port is not of interest. + * * A returned packet will have at least sizeof(struct ofp_packet_in) bytes of * headroom. * @@ -189,7 +191,9 @@ pktbuf_retrieve(struct pktbuf *pb, uint32_t id, struct ofpbuf **bufferp, struct ofpbuf *buffer = p->buffer; if (buffer) { *bufferp = buffer; - *in_port = p->in_port; + if (in_port) { + *in_port = p->in_port; + } p->buffer = NULL; COVERAGE_INC(pktbuf_retrieved); return 0; @@ -211,7 +215,9 @@ pktbuf_retrieve(struct pktbuf *pb, uint32_t id, struct ofpbuf **bufferp, } error: *bufferp = NULL; - *in_port = UINT16_MAX; + if (in_port) { + *in_port = UINT16_MAX; + } return error; }