Re: switchd(8): set the pktbuf for packet_in messages

2016-09-23 Thread Reyk Floeter
On Thu, Sep 22, 2016 at 09:48:48PM +0200, Rafael Zalamena wrote:
> The pkt_buf variable is never set in incoming packet_in messages and this
> diff fixes it.
> 
> ok?
> 

I wonder how this happened, thanks.

Skip the space before the cast,

> + pkt->pkt_buf = (uint8_t *) eh;

pkt->pkt_buf = (uint8_t *)eh;

otherwise OK.

Reyk

> 
> Index: packet.c
> ===
> RCS file: /home/obsdcvs/src/usr.sbin/switchd/packet.c,v
> retrieving revision 1.3
> diff -u -p -r1.3 packet.c
> --- packet.c  21 Jul 2016 08:39:23 -  1.3
> +++ packet.c  21 Sep 2016 11:33:44 -
> @@ -63,7 +63,7 @@ packet_input(struct switchd *sc, struct 
>   return (-1);
>  
>   pkt->pkt_len = ibuf_dataleft(ibuf);
> - if ((pkt->pkt_eh = eh = ibuf_getdata(ibuf, sizeof(*eh))) == NULL) {
> + if ((eh = ibuf_getdata(ibuf, sizeof(*eh))) == NULL) {
>   log_debug("short packet");
>   return (-1);
>   }
> @@ -86,6 +86,9 @@ packet_input(struct switchd *sc, struct 
>  
>   if (dstport)
>   *dstport = dst == NULL ? OFP_PORT_ANY : dst->mac_port;
> +
> + pkt->pkt_eh = eh;
> + pkt->pkt_buf = (uint8_t *) eh;
>  
>   return (0);
>  }

-- 



switchd(8): set the pktbuf for packet_in messages

2016-09-23 Thread Rafael Zalamena
The pkt_buf variable is never set in incoming packet_in messages and this
diff fixes it.

ok?


Index: packet.c
===
RCS file: /home/obsdcvs/src/usr.sbin/switchd/packet.c,v
retrieving revision 1.3
diff -u -p -r1.3 packet.c
--- packet.c21 Jul 2016 08:39:23 -  1.3
+++ packet.c21 Sep 2016 11:33:44 -
@@ -63,7 +63,7 @@ packet_input(struct switchd *sc, struct 
return (-1);
 
pkt->pkt_len = ibuf_dataleft(ibuf);
-   if ((pkt->pkt_eh = eh = ibuf_getdata(ibuf, sizeof(*eh))) == NULL) {
+   if ((eh = ibuf_getdata(ibuf, sizeof(*eh))) == NULL) {
log_debug("short packet");
return (-1);
}
@@ -86,6 +86,9 @@ packet_input(struct switchd *sc, struct 
 
if (dstport)
*dstport = dst == NULL ? OFP_PORT_ANY : dst->mac_port;
+
+   pkt->pkt_eh = eh;
+   pkt->pkt_buf = (uint8_t *) eh;
 
return (0);
 }