X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fdhcp-client.c;h=e59dc34c0ad460157d1e95e9ddffa4354709aefe;hb=6aa09313722406629133b375871547fb426800ef;hp=74fa44c53b66c986862729f5e104be29450d89fb;hpb=d98e60075528c3065ad453f7add4b30f22edcde3;p=openvswitch diff --git a/lib/dhcp-client.c b/lib/dhcp-client.c index 74fa44c5..e59dc34c 100644 --- a/lib/dhcp-client.c +++ b/lib/dhcp-client.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2010 Nicira Networks. + * Copyright (c) 2008, 2009, 2010, 2011 Nicira Networks. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -934,10 +934,8 @@ do_receive_msg(struct dhclient *cli, struct dhcp_msg *msg) const char *cli_name = dhclient_get_name(cli); uint8_t cli_mac[ETH_ADDR_LEN]; struct ofpbuf b; - int mtu; - netdev_get_mtu(cli->netdev, &mtu); - ofpbuf_init(&b, mtu + VLAN_ETH_HEADER_LEN); + ofpbuf_init(&b, ETH_TOTAL_MAX + VLAN_ETH_HEADER_LEN); netdev_get_etheraddr(cli->netdev, cli_mac); for (; cli->received < 50; cli->received++) { const struct ip_header *ip; @@ -953,7 +951,7 @@ do_receive_msg(struct dhclient *cli, struct dhcp_msg *msg) flow_extract(&b, 0, 0, &flow); if (flow.dl_type != htons(ETH_TYPE_IP) - || flow.nw_proto != IP_TYPE_UDP + || flow.nw_proto != IPPROTO_UDP || flow.tp_dst != htons(DHCP_CLIENT_PORT) || !(eth_addr_is_broadcast(flow.dl_dst) || eth_addr_equals(flow.dl_dst, cli_mac))) { @@ -1025,7 +1023,7 @@ do_send_msg(struct dhclient *cli, const struct dhcp_msg *msg) nh.ip_id = 0; nh.ip_frag_off = htons(IP_DONT_FRAGMENT); nh.ip_ttl = 64; - nh.ip_proto = IP_TYPE_UDP; + nh.ip_proto = IPPROTO_UDP; nh.ip_csum = 0; nh.ip_src = dhclient_get_ip(cli); /* XXX need to use UDP socket for nonzero server IPs so that we can get @@ -1046,7 +1044,7 @@ do_send_msg(struct dhclient *cli, const struct dhcp_msg *msg) th.udp_csum = 0; udp_csum = csum_add32(0, nh.ip_src); udp_csum = csum_add32(udp_csum, nh.ip_dst); - udp_csum = csum_add16(udp_csum, IP_TYPE_UDP << 8); + udp_csum = csum_add16(udp_csum, IPPROTO_UDP << 8); udp_csum = csum_add16(udp_csum, th.udp_len); udp_csum = csum_continue(udp_csum, &th, sizeof th); th.udp_csum = csum_finish(csum_continue(udp_csum, b.data, b.size));