projects
/
openvswitch
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
New utility ovs-vsctl.
[openvswitch]
/
lib
/
dhcp-client.c
diff --git
a/lib/dhcp-client.c
b/lib/dhcp-client.c
index 06937ec6aa63952a623857ecc92e7e76e96c5605..4f90781334f80aeaf22fb51f667e40d97ca3c65c 100644
(file)
--- a/
lib/dhcp-client.c
+++ b/
lib/dhcp-client.c
@@
-411,7
+411,7
@@
dhclient_configure_netdev(struct dhclient *cli)
}
if (!error && router.s_addr) {
}
if (!error && router.s_addr) {
- error = netdev_add_router(router);
+ error = netdev_add_router(
cli->netdev,
router);
if (error) {
VLOG_ERR("failed to add default route to "IP_FMT" on %s: %s",
IP_ARGS(&router), netdev_get_name(cli->netdev),
if (error) {
VLOG_ERR("failed to add default route to "IP_FMT" on %s: %s",
IP_ARGS(&router), netdev_get_name(cli->netdev),
@@
-882,7
+882,7
@@
dhclient_msg_init(struct dhclient *cli, enum dhcp_msg_type type,
msg->xid = cli->xid;
msg->secs = cli->secs;
msg->type = type;
msg->xid = cli->xid;
msg->secs = cli->secs;
msg->type = type;
-
memcpy(msg->chaddr, netdev_get_etheraddr(cli->netdev), ETH_ADDR_LEN
);
+
netdev_get_etheraddr(cli->netdev, msg->chaddr
);
}
/* If time goes backward this returns a large number, which makes it look like
}
/* If time goes backward this returns a large number, which makes it look like
@@
-905,9
+905,13
@@
timeout(struct dhclient *cli, unsigned int secs)
static bool
do_receive_msg(struct dhclient *cli, struct dhcp_msg *msg)
{
static bool
do_receive_msg(struct dhclient *cli, struct dhcp_msg *msg)
{
+ uint8_t cli_mac[ETH_ADDR_LEN];
struct ofpbuf b;
struct ofpbuf b;
+ int mtu;
- ofpbuf_init(&b, netdev_get_mtu(cli->netdev) + VLAN_ETH_HEADER_LEN);
+ netdev_get_mtu(cli->netdev, &mtu);
+ ofpbuf_init(&b, mtu + VLAN_ETH_HEADER_LEN);
+ netdev_get_etheraddr(cli->netdev, cli_mac);
for (; cli->received < 50; cli->received++) {
const struct ip_header *ip;
const struct dhcp_header *dhcp;
for (; cli->received < 50; cli->received++) {
const struct ip_header *ip;
const struct dhcp_header *dhcp;
@@
-923,10
+927,9
@@
do_receive_msg(struct dhclient *cli, struct dhcp_msg *msg)
flow_extract(&b, 0, &flow);
if (flow.dl_type != htons(ETH_TYPE_IP)
|| flow.nw_proto != IP_TYPE_UDP
flow_extract(&b, 0, &flow);
if (flow.dl_type != htons(ETH_TYPE_IP)
|| flow.nw_proto != IP_TYPE_UDP
- || flow.tp_dst != htons(
68
)
+ || flow.tp_dst != htons(
DHCP_CLIENT_PORT
)
|| !(eth_addr_is_broadcast(flow.dl_dst)
|| !(eth_addr_is_broadcast(flow.dl_dst)
- || eth_addr_equals(flow.dl_dst,
- netdev_get_etheraddr(cli->netdev)))) {
+ || eth_addr_equals(flow.dl_dst, cli_mac))) {
continue;
}
continue;
}
@@
-977,7
+980,7
@@
do_send_msg(struct dhclient *cli, const struct dhcp_msg *msg)
dhcp_assemble(msg, &b);
dhcp_assemble(msg, &b);
-
memcpy(eh.eth_src, netdev_get_etheraddr(cli->netdev), ETH_ADDR_LEN
);
+
netdev_get_etheraddr(cli->netdev, eh.eth_src
);
memcpy(eh.eth_dst, eth_addr_broadcast, ETH_ADDR_LEN);
eh.eth_type = htons(ETH_TYPE_IP);
memcpy(eh.eth_dst, eth_addr_broadcast, ETH_ADDR_LEN);
eh.eth_type = htons(ETH_TYPE_IP);
@@
-1006,8
+1009,8
@@
do_send_msg(struct dhclient *cli, const struct dhcp_msg *msg)
nh.ip_dst = INADDR_BROADCAST;
nh.ip_csum = csum(&nh, sizeof nh);
nh.ip_dst = INADDR_BROADCAST;
nh.ip_csum = csum(&nh, sizeof nh);
- th.udp_src = htons(
66
);
- th.udp_dst = htons(
67
);
+ th.udp_src = htons(
DHCP_CLIENT_PORT
);
+ th.udp_dst = htons(
DHCP_SERVER_PORT
);
th.udp_len = htons(UDP_HEADER_LEN + b.size);
th.udp_csum = 0;
udp_csum = csum_add32(0, nh.ip_src);
th.udp_len = htons(UDP_HEADER_LEN + b.size);
th.udp_csum = 0;
udp_csum = csum_add32(0, nh.ip_src);