netdev: Make netdev arguments fetchable, and implement for netdev-vport.
[sliver-openvswitch.git] / lib / dhcp.c
index 51d6ed0..62ede06 100644 (file)
 #include <stdlib.h>
 #include "dynamic-string.h"
 #include "ofpbuf.h"
-
-#define THIS_MODULE VLM_dhcp
 #include "vlog.h"
 
+VLOG_DEFINE_THIS_MODULE(dhcp);
+
 /* Information about a DHCP argument type. */
 struct arg_type {
     const char *name;           /* Name. */
@@ -561,8 +561,7 @@ parse_options(struct dhcp_msg *msg, const char *name, void *data, size_t size,
 {
     struct ofpbuf b;
 
-    b.data = data;
-    b.size = size;
+    ofpbuf_use_const(&b, data, size);
     for (;;) {
         uint8_t *code, *len;
         void *payload;
@@ -674,7 +673,7 @@ dhcp_parse(struct dhcp_msg *msg, const struct ofpbuf *b_)
     msg->giaddr = dhcp->giaddr;
     memcpy(msg->chaddr, dhcp->chaddr, ETH_ADDR_LEN);
 
-    cookie = ofpbuf_try_pull(&b, sizeof cookie);
+    cookie = ofpbuf_try_pull(&b, sizeof *cookie);
     if (cookie) {
         if (ntohl(*cookie) == DHCP_OPTS_COOKIE) {
             uint8_t overload;