diff options
author | Darren Embry <dse@webonastick.com> | 2012-06-07 15:16:09 -0400 |
---|---|---|
committer | Darren Embry <dse@webonastick.com> | 2012-06-07 15:16:35 -0400 |
commit | 0098aa734eae36d44943a212b7dd766232381ecd (patch) | |
tree | f32b4b2a245b561ebacc880947248550488f6525 /etc/rc.initial.setlanip | |
parent | 6499a7d5d906251cabc48244e7a66e5ccf82bccb (diff) | |
download | pfsense-0098aa734eae36d44943a212b7dd766232381ecd.zip pfsense-0098aa734eae36d44943a212b7dd766232381ecd.tar.gz |
show dhcp/dhcp6/static/staticv6 along with descriptions in console
Diffstat (limited to 'etc/rc.initial.setlanip')
-rwxr-xr-x | etc/rc.initial.setlanip | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/etc/rc.initial.setlanip b/etc/rc.initial.setlanip index 75276f3..3aef9c6 100755 --- a/etc/rc.initial.setlanip +++ b/etc/rc.initial.setlanip @@ -79,6 +79,31 @@ function prompt_for_enable_dhcp_server($version = 4) { return $yn; } +function get_interface_config_description($iface) { + global $config; + $c = $config['interfaces'][$iface]; + if (!$c) { return null; } + $if = $c['if']; + $result = $if; + $result2 = array(); + $ipaddr = $c['ipaddr']; + $ipaddrv6 = $c['ipaddrv6']; + if (is_ipaddr($ipaddr)) { + $result2[] = "static"; + } else if ($ipaddr == "dhcp") { + $result2[] = "dhcp"; + } + if (is_ipaddr($ipaddrv6)) { + $result2[] = "staticv6"; + } else if ($ipaddrv6 == "dhcp6") { + $result2[] = "dhcp6"; + } + if (count($result2)) { + $result .= " - " . implode(", ", $result2); + } + return $result; +} + $fp = fopen('php://stdin', 'r'); /* build an interface collection */ @@ -91,8 +116,8 @@ if ($count > 1) { echo "Available interfaces:\n\n"; $x=1; foreach($ifdescrs as $iface => $ifdescr) { - $realif = $config['interfaces'][$iface]['if']; - echo "{$x} - {$ifdescr} ({$realif})\n"; + $config_descr = get_interface_config_description($iface); + echo "{$x} - {$ifdescr} ({$config_descr})\n"; $x++; } echo "\nEnter the number of the interface you wish to configure: "; |