Forum Discussion
Altera_Forum
Honored Contributor
20 years agoAllowing user to choose DHCP or static IP
Hi, I would like the users of my product to be able to choose whether they want to use DHCP or use a static IP address. The idea is to allow users to adjust the IP configuration using the front...
Altera_Forum
Honored Contributor
19 years agoMy understanding is that your interface now has both IP addresses assigned to it, which is fine if that's what you want. You need to delete the old one with something like:
strcpy(ifr.ifr_name, intf); if (ioctl(s, SIOCDIFADDR, &ifr)) { /* delete IF addr */ perror("SIOCDIFADDR1"); } which I just grabbed from dhcp_prot.c Would be nice if there was an ecos config that was smart enough to fall back to static or link local ip address if dhcp failed. We all need this.