X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fdhcp-client.c;h=0abf115b025937b3d897582968fe1b6e397469f1;hb=76ce9432393df462e2030036021ea60096a734d4;hp=4f90781334f80aeaf22fb51f667e40d97ca3c65c;hpb=3f355f47f8e7343e909ccfa854454d667baf3c38;p=sliver-openvswitch.git diff --git a/lib/dhcp-client.c b/lib/dhcp-client.c index 4f9078133..0abf115b0 100644 --- a/lib/dhcp-client.c +++ b/lib/dhcp-client.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009 Nicira Networks. + * Copyright (c) 2008, 2009, 2010 Nicira Networks. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -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; @@ -768,7 +775,7 @@ dhclient_run_REBINDING(struct dhclient *cli) } static void -dhclient_run_RELEASED(struct dhclient *cli UNUSED) +dhclient_run_RELEASED(struct dhclient *cli OVS_UNUSED) { /* Nothing to do. */ } @@ -924,7 +931,7 @@ do_receive_msg(struct dhclient *cli, struct dhcp_msg *msg) goto drained; } - flow_extract(&b, 0, &flow); + flow_extract(&b, 0, 0, &flow); if (flow.dl_type != htons(ETH_TYPE_IP) || flow.nw_proto != IP_TYPE_UDP || flow.tp_dst != htons(DHCP_CLIENT_PORT)