From 28bf462793fc9c15e70b73d3eb2223f6328abb84 Mon Sep 17 00:00:00 2001 From: Guillaume Mazoyer Date: Sun, 12 Jun 2016 23:21:48 +0200 Subject: Add new configuration options to enable/disable IPv6 or IPv4. When disabling IPv6 or IPv4, the looking glass will not try to use both IP protocol versions when looking for an AS routes or when pinging or tracerouting. If an IP address of a disabling IP version is used, the user will have an error in return of its command. This error will tell him that the IP version he is trying to use is disabled. Please note that when trying to ping or traceroute a hostname from a Cisco or a Juniper device, this looking glass will not prevent the device to use a disabled IP version when executing its command. This commit also contains some small changes with HTML tags. --- index.php | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'index.php') diff --git a/index.php b/index.php index 1936a4b..5cef958 100644 --- a/index.php +++ b/index.php @@ -2,7 +2,7 @@ /* * Looking Glass - An easy to deploy Looking Glass - * Copyright (C) 2014-2015 Guillaume Mazoyer + * Copyright (C) 2014-2016 Guillaume Mazoyer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -100,7 +100,7 @@ final class LookingGlass { } print('
'); if ($this->frontpage['show_title']) { - print('

'.htmlentities($this->frontpage['title']).'


'); + print('

'.htmlentities($this->frontpage['title']).'


'); } if ($this->frontpage['image']) { print('Logo'); @@ -112,6 +112,17 @@ final class LookingGlass { } private function render_content() { + if ($this->misc['disable_ipv6'] && $this->misc['disable_ipv4']) { + print('
'); + print('Configuration error!
'); + print('It looks like you have disabled IPv6 and IPv4. Do you want to do any networking someday?
'); + print('Please enable IPv6 or IPv4 (or even both) by using the following lines in your configuration:

'); + print('
$config[\'misc\'][\'disable_ipv6\'] = false;
'); + print('
$config[\'misc\'][\'disable_ipv4\'] = false;
'); + print('
'); + return; + } + print('
'); print(''); print('Error! '); @@ -165,20 +176,20 @@ final class LookingGlass { if ($this->frontpage['show_visitor_ip']) { if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { - print('Your IP address: '.htmlentities($_SERVER['HTTP_X_FORWARDED_FOR']).'
'); + print('Your IP address: '.htmlentities($_SERVER['HTTP_X_FORWARDED_FOR']).'
'); } else { - print('Your IP address: '.htmlentities($_SERVER['REMOTE_ADDR']).'
'); + print('Your IP address: '.htmlentities($_SERVER['REMOTE_ADDR']).'
'); } } if ($this->frontpage['disclaimer']) { print($this->frontpage['disclaimer']); - print('

'); + print('

'); } if ($this->frontpage['peering_policy_file']) { print(''); - print('

'); + print('

'); } if ($this->contact['name'] && $this->contact['mail']) { @@ -187,7 +198,7 @@ final class LookingGlass { htmlentities($this->contact['name']).''); } - print('

'); + print('

'); print('Powered by Looking Glass '.$this->release['version'].''); print('

'); print('
'); -- cgit v1.2.3