X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fdhcp-client.c;h=30ac56c930dae95dd9abe1b4b217ce4e80a5f73b;hb=c69ee87c10818267f991236201150b1fa51ae519;hp=bb331288e8d13f6db4a9ce0540a42a7037e5308e;hpb=67a4917b07031b387beafaedce413b4207214059;p=sliver-openvswitch.git diff --git a/lib/dhcp-client.c b/lib/dhcp-client.c index bb331288e..30ac56c93 100644 --- a/lib/dhcp-client.c +++ b/lib/dhcp-client.c @@ -151,12 +151,19 @@ dhclient_create(const char *netdev_name, void *aux, struct dhclient **cli_) { struct dhclient *cli; + struct netdev_options netdev_options; struct netdev *netdev; int error; *cli_ = NULL; - error = netdev_open(netdev_name, ETH_TYPE_IP, &netdev); + memset(&netdev_options, 0, sizeof netdev_options); + netdev_options.name = netdev_name; + netdev_options.ethertype = ETH_TYPE_IP; + netdev_options.may_create = true; + netdev_options.may_open = true; + + error = netdev_open(&netdev_options, &netdev); /* XXX install socket filter to catch only DHCP packets. */ if (error) { VLOG_ERR("could not open %s network device: %s", @@ -172,7 +179,7 @@ dhclient_create(const char *netdev_name, return error; } - cli = xcalloc(1, sizeof *cli); + cli = xzalloc(sizeof *cli); cli->modify_request = modify_request; cli->validate_offer = validate_offer; cli->aux = aux;