From ac24dc242f6b3e4eaa81b12272a739985c3e7932 Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Thu, 14 Jul 2016 18:33:58 -0300 Subject: Review license / copyright on all files (1st round) --- src/etc/rc.banner | 252 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 138 insertions(+), 114 deletions(-) (limited to 'src/etc/rc.banner') diff --git a/src/etc/rc.banner b/src/etc/rc.banner index fbd4ba0..5be87f5 100755 --- a/src/etc/rc.banner +++ b/src/etc/rc.banner @@ -1,128 +1,152 @@ #!/usr/local/bin/php-cgi -f $friendly) { - /* point to this interface's config */ - $ifconf = $config['interfaces'][$ifname]; - /* look for 'special cases' */ - switch ($ifconf['ipaddr']) { - case "dhcp": - $class = "/DHCP4"; - break; - case "pppoe": - $class = "/PPPoE"; - break; - case "pptp": - $class = "/PPTP"; - break; - case "l2tp": - $class = "/L2TP"; - break; - default: - $class = ""; - break; - } - switch ($ifconf['ipaddrv6']) { - case "dhcp6": - $class6 = "/DHCP6"; - break; - case "slaac": - $class6 = "/SLAAC"; - break; - case "6rd": - $class6 = "/6RD"; - break; - case "6to4": - $class6 = "/6to4"; - break; - case "track6": - $class6 = "/t6"; - break; - default: - $class6 = ""; - break; - } - $ipaddr = get_interface_ip($ifname); - $subnet = get_interface_subnet($ifname); - $ipaddr6 = get_interface_ipv6($ifname); - $subnet6 = get_interface_subnetv6($ifname); - $realif = get_real_interface($ifname); - $tobanner = "{$friendly} ({$ifname})"; +$iflist = get_configured_interface_with_descr(false, true); +foreach ($iflist as $ifname => $friendly) { + /* point to this interface's config */ + $ifconf = $config['interfaces'][$ifname]; + /* look for 'special cases' */ + switch ($ifconf['ipaddr']) { + case "dhcp": + $class = "/DHCP4"; + break; + case "pppoe": + $class = "/PPPoE"; + break; + case "pptp": + $class = "/PPTP"; + break; + case "l2tp": + $class = "/L2TP"; + break; + default: + $class = ""; + break; + } + switch ($ifconf['ipaddrv6']) { + case "dhcp6": + $class6 = "/DHCP6"; + break; + case "slaac": + $class6 = "/SLAAC"; + break; + case "6rd": + $class6 = "/6RD"; + break; + case "6to4": + $class6 = "/6to4"; + break; + case "track6": + $class6 = "/t6"; + break; + default: + $class6 = ""; + break; + } + $ipaddr = get_interface_ip($ifname); + $subnet = get_interface_subnet($ifname); + $ipaddr6 = get_interface_ipv6($ifname); + $subnet6 = get_interface_subnetv6($ifname); + $realif = get_real_interface($ifname); + $tobanner = "{$friendly} ({$ifname})"; - printf("\n %-15s -> %-10s -> ", - $tobanner, - $realif + printf("\n %-15s -> %-10s -> ", + $tobanner, + $realif + ); + $v6first = false; + if (!empty($ipaddr) && !empty($subnet)) { + printf("v4%s: %s/%s", + $class, + $ipaddr, + $subnet ); - $v6first = false; - if (!empty($ipaddr) && !empty($subnet)) { - printf("v4%s: %s/%s", - $class, - $ipaddr, - $subnet - ); - } else { - $v6first = true; - } - if (!empty($ipaddr6) && !empty($subnet6)) { - if (!$v6first) { - printf("\n%s", str_repeat(" ", 34)); - } - printf("v6%s: %s/%s", - $class6, - $ipaddr6, - $subnet6 - ); + } else { + $v6first = true; + } + if (!empty($ipaddr6) && !empty($subnet6)) { + if (!$v6first) { + printf("\n%s", str_repeat(" ", 34)); } + printf("v6%s: %s/%s", + $class6, + $ipaddr6, + $subnet6 + ); } - printf("\n"); +} +printf("\n"); ?> -- cgit v1.1