Merge remote-tracking branch 'stevee/wlan-client' into next
authorArne Fitzenreiter <arne_f@ipfire.org>
Sat, 6 Jul 2013 09:50:01 +0000 (11:50 +0200)
committerArne Fitzenreiter <arne_f@ipfire.org>
Sat, 6 Jul 2013 11:43:51 +0000 (13:43 +0200)
Conflicts:
config/cfgroot/general-functions.pl

1  2 
config/cfgroot/general-functions.pl
config/rootfiles/common/armv5tel/initscripts
config/rootfiles/common/i586/initscripts

index 90eacbdb011487e2f4af8e60eb8cc42e249f3620,3a04369e357a652b13985afd2dc9a91a996d3367..3cdb36fbd4709229edd93b2f39893a145a17425f
@@@ -857,14 -857,13 +857,14 @@@ sub FetchPublicIp 
          my ($peer, $peerport) = (/^(?:[a-zA-Z ]+\:\/\/)?(?:[A-Za-z0-9\_\.\-]*?(?:\:[A-Za-z0-9\_\.\-]*?)?\@)?([a-zA-Z0-9\.\_\-]*?)(?:\:([0-9]{1,5}))?(?:\/.*?)?$/);
          Net::SSLeay::set_proxy($peer,$peerport,$proxysettings{'UPSTREAM_USER'},$proxysettings{'UPSTREAM_PASSWORD'} );
      }
 -    my ($out, $response) = Net::SSLeay::get_http(  'checkip.dyndns.org',
 +    my $user_agent = &MakeUserAgent();
 +    my ($out, $response) = Net::SSLeay::get_http(  'checkip4.dns.lightningwirelabs.com',
                                                    80,
                                                    "/",
 -                                                  Net::SSLeay::make_headers('User-Agent' => 'IPFire' )
 +                                                  Net::SSLeay::make_headers('User-Agent' => $user_agent )
                                                );
      if ($response =~ m%HTTP/1\.. 200 OK%) {
 -      $out =~ /Current IP Address: (\d+.\d+.\d+.\d+)/;
 +      $out =~ /Your IP address is: (\d+.\d+.\d+.\d+)/;
        return $1;
      }
      return '';
@@@ -920,11 -919,9 +920,11 @@@ sub GetDyndnsRedIP 
      close(IP);
      chomp $ip;
  
 +    # 100.64.0.0/10 is reserved for dual-stack lite (http://tools.ietf.org/html/rfc6598).
      if (&General::IpInSubnet ($ip,'10.0.0.0','255.0.0.0') ||
          &General::IpInSubnet ($ip,'172.16.0.0.','255.240.0.0') ||
 -        &General::IpInSubnet ($ip,'192.168.0.0','255.255.0.0'))
 +        &General::IpInSubnet ($ip,'192.168.0.0','255.255.0.0') ||
 +        &General::IpInSubnet ($ip,'100.64.0.0', '255.192.0.0'))
      {
        if ($settings{'BEHINDROUTER'} eq 'FETCH_IP') {
            my $RealIP = &General::FetchPublicIp;
@@@ -984,28 -981,26 +984,50 @@@ sub GetIcmpDescription ($) 
      if ($index>41) {return 'unknown'} else {return @icmp_description[$index]};
  }
  
 +sub GetCoreUpdateVersion() {
 +      my $core_update;
 +
 +      open(FILE, "/opt/pakfire/db/core/mine");
 +      while (<FILE>) {
 +              $core_update = $_;
 +              last;
 +      }
 +      close(FILE);
 +
 +      return $core_update;
 +}
 +
 +sub MakeUserAgent() {
 +      my $user_agent = "IPFire/$General::version";
 +
 +      my $core_update = &GetCoreUpdateVersion();
 +      if ($core_update ne "") {
 +              $user_agent .= "/$core_update";
 +      }
 +
 +      return $user_agent;
 +}
 +
+ sub RedIsWireless() {
+       # This function checks if a network device is a wireless device.
+       my %settings = ();
+       &readhash("${General::swroot}/ethernet/settings", \%settings);
+       # Find the name of the network device.
+       my $device = $settings{'RED_DEV'};
+       # Exit, if no device is configured.
+       return 0 if ($device eq "");
+       # Return 1 if the device is a wireless one.
+       my $path = "/sys/class/net/$device/wireless";
+       if (-d $path) {
+               return 1;
+       }
+       # Otherwise return zero.
+       return 0;
+ }
  1;
index a4fa8a76e5e2f9648e2c570d44cac798475fdd98,a8f35e4676e3cd405d2a564670af7012f5076e5f..17bbdb776a6ee8b22a3cc38df0624334c05ca2c9
@@@ -37,9 -37,7 +37,9 @@@ etc/rc.d/init.d/hal
  #etc/rc.d/init.d/icecream
  #etc/rc.d/init.d/imspector
  etc/rc.d/init.d/ipsec
 +#etc/rc.d/init.d/keepalived
  #etc/rc.d/init.d/lcd4linux
 +#etc/rc.d/init.d/lcdproc
  #etc/rc.d/init.d/lcr
  etc/rc.d/init.d/leds
  etc/rc.d/init.d/localnet
@@@ -132,6 -130,7 +132,7 @@@ etc/rc.d/init.d/upnp
  #etc/rc.d/init.d/vsftpd
  #etc/rc.d/init.d/watchdog
  #etc/rc.d/init.d/winbind
+ etc/rc.d/init.d/wlanclient
  #etc/rc.d/init.d/xinetd
  #etc/rc.d/rc0.d
  #etc/rc.d/rc0.d/K01imspetor
index 606f8ea8e1306491ad2a41a6be60f77f60e7de83,c7546e00d891684b508ba0f62c42feeb9881a7c4..55cee863dbfbb58d3472e0600be6a47efd392fc5
@@@ -39,9 -39,7 +39,9 @@@ etc/rc.d/init.d/hal
  #etc/rc.d/init.d/icecream
  #etc/rc.d/init.d/imspector
  etc/rc.d/init.d/ipsec
 +#etc/rc.d/init.d/keepalived
  #etc/rc.d/init.d/lcd4linux
 +#etc/rc.d/init.d/lcdproc
  #etc/rc.d/init.d/lcr
  etc/rc.d/init.d/leds
  etc/rc.d/init.d/localnet
@@@ -66,6 -64,7 +66,7 @@@ etc/rc.d/init.d/network-vlan
  etc/rc.d/init.d/networking/any
  etc/rc.d/init.d/networking/blue
  etc/rc.d/init.d/networking/dhcpcd.exe
+ etc/rc.d/init.d/networking/functions.network
  etc/rc.d/init.d/networking/green
  etc/rc.d/init.d/networking/orange
  etc/rc.d/init.d/networking/red
@@@ -96,6 -95,7 +97,7 @@@ etc/rc.d/init.d/networking/red.up/98-le
  etc/rc.d/init.d/networking/red.up/99-U-dialctrl.pl
  etc/rc.d/init.d/networking/red.up/99-fireinfo
  etc/rc.d/init.d/networking/red.up/99-pakfire-update
+ etc/rc.d/init.d/networking/wpa_supplicant.exe
  #etc/rc.d/init.d/nfs-server
  etc/rc.d/init.d/ntp
  #etc/rc.d/init.d/nut
@@@ -135,6 -135,7 +137,7 @@@ etc/rc.d/init.d/upnp
  #etc/rc.d/init.d/vsftpd
  #etc/rc.d/init.d/watchdog
  #etc/rc.d/init.d/winbind
+ etc/rc.d/init.d/wlanclient
  #etc/rc.d/init.d/xinetd
  #etc/rc.d/rc0.d
  #etc/rc.d/rc0.d/K01imspetor
@@@ -152,6 -153,7 +155,7 @@@ etc/rc.d/rc0.d/K49cyrus-sas
  etc/rc.d/rc0.d/K78snort
  etc/rc.d/rc0.d/K79leds
  etc/rc.d/rc0.d/K80network
+ etc/rc.d/rc0.d/K82wlanclient
  #etc/rc.d/rc0.d/K84bluetooth
  #etc/rc.d/rc0.d/K85messagebus
  etc/rc.d/rc0.d/K85tmpfs
@@@ -170,6 -172,7 +174,7 @@@ etc/rc.d/rc3.d/S12acpi
  #etc/rc.d/rc3.d/S16bluetooth
  #etc/rc.d/rc3.d/S18cpufreq
  etc/rc.d/rc3.d/S19smartenabler
+ etc/rc.d/rc3.d/S19wlanclient
  etc/rc.d/rc3.d/S20network
  etc/rc.d/rc3.d/S21leds
  etc/rc.d/rc3.d/S24cyrus-sasl
@@@ -200,6 -203,7 +205,7 @@@ etc/rc.d/rc6.d/K49cyrus-sas
  etc/rc.d/rc6.d/K78snort
  etc/rc.d/rc6.d/K79leds
  etc/rc.d/rc6.d/K80network
+ etc/rc.d/rc6.d/K82wlanclient
  #etc/rc.d/rc6.d/K84bluetooth
  #etc/rc.d/rc6.d/K85messagebus
  etc/rc.d/rc6.d/K85tmpfs