vlog: Add comment describing the purpose of each log level.
[openvswitch] / lib / packets.c
index c1e1cdbb967370daac1febf58023b43dc17ca37f..60ee3903d9e34aeab3cec63479e42d39ed877899 100644 (file)
@@ -204,25 +204,32 @@ ipv6_is_cidr(const struct in6_addr *netmask)
     return true;
 }
 
-/* Fills 'b' with a LACP packet whose source address is 'eth_src', LACP actor
- * information is 'actor', and LACP partner information is 'partner'. */
+/* Populates 'b' with a LACP packet containing 'pdu' with source address
+ * 'eth_src'. */
 void
-compose_lacp_packet(struct ofpbuf *b, struct lacp_info *actor,
-                    struct lacp_info *partner,
-                    const uint8_t eth_src[ETH_ADDR_LEN])
+compose_lacp_packet(struct ofpbuf *b, const uint8_t eth_src[ETH_ADDR_LEN],
+                    const struct lacp_pdu *pdu)
 {
     struct eth_header *eth;
-    struct lacp_pdu *pdu;
+    struct lacp_pdu *eth_pdu;
 
     ofpbuf_clear(b);
 
     ofpbuf_prealloc_tailroom(b, ETH_HEADER_LEN + LACP_PDU_LEN);
     eth = ofpbuf_put_zeros(b, ETH_HEADER_LEN);
-    pdu = ofpbuf_put_zeros(b, LACP_PDU_LEN);
+    eth_pdu = ofpbuf_put(b, pdu, LACP_PDU_LEN);
 
     memcpy(eth->eth_dst, eth_addr_lacp, ETH_ADDR_LEN);
     memcpy(eth->eth_src, eth_src, ETH_ADDR_LEN);
     eth->eth_type = htons(ETH_TYPE_LACP);
+}
+
+/* Populates 'pdu' with a LACP PDU comprised of 'actor' and 'partner'. */
+void
+compose_lacp_pdu(const struct lacp_info *actor,
+                 const struct lacp_info *partner, struct lacp_pdu *pdu)
+{
+    memset(pdu, 0, sizeof *pdu);
 
     pdu->subtype = 1;
     pdu->version = 1;
@@ -237,7 +244,7 @@ compose_lacp_packet(struct ofpbuf *b, struct lacp_info *actor,
 
     pdu->collector_type = 3;
     pdu->collector_len = 16;
-    pdu->collector_delay = htons(UINT16_MAX);
+    pdu->collector_delay = htons(0);
 }
 
 /* Parses 'b' which represents a packet containing a LACP PDU.  This function