diff --git a/eth_interface.c b/eth_interface.c index ea2e585..a6dcf3f 100644 --- a/eth_interface.c +++ b/eth_interface.c @@ -275,9 +275,9 @@ void ethinf_print_info(const EthInterface * intf) { if (intf->dhcp != NULL) { bool on = dhcp_get_fsm_state(intf->dhcp) != DHCP_STOPPED; - MSG("DHCP is %s" ANSI_COLOR_RESET "%s.", on ? (ANSI_COLOR_BGREEN "ON") : (ANSI_COLOR_BRED "OFF"), intf->manageDhcp ? "[automanaged]" : ""); + MSG("DHCP is %s" ANSI_COLOR_RESET " %s.", on ? (ANSI_COLOR_BGREEN "RUNNING") : (ANSI_COLOR_BRED "STOPPED"), intf->manageDhcp ? "[automanaged]" : ""); } else { - MSG ("DHCP is " ANSI_COLOR_RED "absent" ANSI_COLOR_RESET "."); + MSG ("DHCP is " ANSI_COLOR_RED "ABSENT" ANSI_COLOR_RESET "."); } MSG("\n"); diff --git a/prefab/packet_parsers/dhcp.c b/prefab/packet_parsers/dhcp.c index dc9b594..77e364d 100644 --- a/prefab/packet_parsers/dhcp.c +++ b/prefab/packet_parsers/dhcp.c @@ -368,6 +368,14 @@ static int dhcp_resp_cb(const Pckt *pckt, PcktSieveLayerTag tag) { void dhcp_start(DhcpState *s) { //MSG("DHCP start!\n"); + + // clear addresses + s->intf->ip = IPv4_IF_ADDR; + s->intf->router = IPv4_IF_ADDR; + s->intf->netmask = IPv4_ANY_ADDR; + s->intf->dns = IPv4_IF_ADDR; + + // start the DHCP state machine s->enabled = true; s->state = DHCP_INIT; dhcp_process(s, NULL, NULL);