Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: m-labs/flickernoise
base: 0e6cf55
...
head fork: m-labs/flickernoise
compare: c28ce44
  • 2 commits
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Showing with 40 additions and 22 deletions.
  1. +40 −22 src/sysconfig.c
View
62 src/sysconfig.c
@@ -138,8 +138,11 @@ static struct sysconfig sysconfig = {
.language = SC_LANGUAGE_ENGLISH,
.keyboard_layout = SC_KEYBOARD_LAYOUT_US,
.dhcp_enable = 1,
- .ip = 0xc0a8002a,
- .netmask = 0xffffff00,
+ .ip = 0xc0a8002a, /* 192.168.0.42 */
+ .netmask = 0xffffff00, /* 255.255.255.0 */
+ .gateway = 0xc0a80001, /* 192.168.0.1 */
+ .dns1 = 0xd043dede, /* 208.67.222.222 */
+ .dns2 = 0xd043dedc, /* 208.67.222.220 */
.autostart_as = 1
};
@@ -358,16 +361,29 @@ void sysconfig_get_ipconfig(int *dhcp_enable, unsigned int *ip, unsigned int *ne
{
*dhcp_enable = sysconfig.dhcp_enable;
- if(ip != NULL)
- *ip = ifconfig_get_ip(SIOCGIFADDR);
- if(netmask != NULL)
- *netmask = ifconfig_get_ip(SIOCGIFNETMASK);
- if(gateway != NULL)
- *gateway = route_get_gateway();
- if(dns1 != NULL)
- *dns1 = rtems_bsdnet_nameserver_count > 0 ? rtems_bsdnet_nameserver[0].s_addr : 0;
- if(dns2 != NULL)
- *dns2 = rtems_bsdnet_nameserver_count > 1 ? rtems_bsdnet_nameserver[1].s_addr : 0;
+ if(*dhcp_enable) {
+ if(ip != NULL)
+ *ip = ifconfig_get_ip(SIOCGIFADDR);
+ if(netmask != NULL)
+ *netmask = ifconfig_get_ip(SIOCGIFNETMASK);
+ if(gateway != NULL)
+ *gateway = route_get_gateway();
+ if(dns1 != NULL)
+ *dns1 = rtems_bsdnet_nameserver_count > 0 ? rtems_bsdnet_nameserver[0].s_addr : 0;
+ if(dns2 != NULL)
+ *dns2 = rtems_bsdnet_nameserver_count > 1 ? rtems_bsdnet_nameserver[1].s_addr : 0;
+ } else {
+ if(ip != NULL)
+ *ip = sysconfig.ip;
+ if(netmask != NULL)
+ *netmask = sysconfig.netmask;
+ if(gateway != NULL)
+ *gateway = sysconfig.gateway;
+ if(dns1 != NULL)
+ *dns1 = sysconfig.dns1;
+ if(dns2 != NULL)
+ *dns2 = sysconfig.dns2;
+ }
}
void sysconfig_get_credentials(char *login, char *password)
@@ -523,16 +539,18 @@ void sysconfig_set_ipconfig(int dhcp_enable, unsigned int ip, unsigned int netma
}
sysconfig.dhcp_enable = dhcp_enable;
- if(ip != 0)
- sysconfig.ip = ip;
- if(netmask != 0)
- sysconfig.netmask = netmask;
- if(gateway != 0)
- sysconfig.gateway = gateway;
- if(dns1 != 0)
- sysconfig.dns1 = dns1;
- if(dns2 != 0)
- sysconfig.dns2 = dns2;
+ if(!dhcp_enable) {
+ if(ip != 0)
+ sysconfig.ip = ip;
+ if(netmask != 0)
+ sysconfig.netmask = netmask;
+ if(gateway != 0)
+ sysconfig.gateway = gateway;
+ if(dns1 != 0)
+ sysconfig.dns1 = dns1;
+ if(dns2 != 0)
+ sysconfig.dns2 = dns2;
+ }
}
void sysconfig_set_credentials(char *login, char *password)

No commit comments for this range

Something went wrong with that request. Please try again.