Update:
authorms <ms@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Sun, 23 Jul 2006 17:15:05 +0000 (17:15 +0000)
committerms <ms@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Sun, 23 Jul 2006 17:15:05 +0000 (17:15 +0000)
  * QoS-Script ist so gut wie funktionsfähig.

git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@220 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8

config/qos/makeqosscripts.pl
src/scripts/setddns.pl
src/scripts/settime

index 334bebe..a097456 100644 (file)
@@ -93,24 +93,39 @@ print <<END
 case "\$1" in
 
   status)
-       echo "[qdisc]"
-       tc -s qdisc show dev $qossettings{'RED_DEV'}
-       tc -s qdisc show dev $qossettings{'IMQ_DEV'}
-       echo "[class]"
-       tc -s class show dev $qossettings{'RED_DEV'}
-       tc -s class show dev $qossettings{'IMQ_DEV'}
-       echo "[filter]"
-       tc -s filter show dev $qossettings{'RED_DEV'}
-       tc -s filter show dev $qossettings{'IMQ_DEV'}
-       echo "[iptables]"
-       iptables -t mangle -L QOS-OUT -v -x 2> /dev/null
-       iptables -t mangle -L QOS-INC -v -x 2> /dev/null
+       case "\$2" in
+         qdisc)
+               echo "[qdisc]"
+               tc -s qdisc show dev $qossettings{'RED_DEV'}
+               tc -s qdisc show dev $qossettings{'IMQ_DEV'}
+               exit 0
+         ;;
+         class)
+               echo "[class]"
+               tc -s class show dev $qossettings{'RED_DEV'}
+               tc -s class show dev $qossettings{'IMQ_DEV'}
+               exit 0
+         ;;
+         filter)
+               echo "[filter]"
+               tc -s filter show dev $qossettings{'RED_DEV'}
+               tc -s filter show dev $qossettings{'IMQ_DEV'}
+               exit 0
+         ;;
+         iptables)
+               echo "[iptables]"
+               iptables -t mangle -L QOS-OUT -v -x 2> /dev/null
+               iptables -t mangle -L QOS-INC -v -x 2> /dev/null
+               exit 0
+         ;;
+       esac
+       \$0 \$1 qdisc
+       \$0 \$1 class
+       \$0 \$1 filter
+       \$0 \$1 iptables
        exit 0
   ;;
   start)
-       ### FIRST CLEAR EVERYTHING
-       \$0 clear
-
        ###
        ### $qossettings{'RED_DEV'}
        ###
@@ -143,7 +158,7 @@ foreach $classentry (sort @classes)
                $qossettings{'BURST'} = $classline[5];
                $qossettings{'CBURST'} = $classline[6];
                print "\ttc class add dev $qossettings{'DEVICE'} parent 1:1 classid 1:$qossettings{'CLASS'} htb rate $qossettings{'RATE'}kbit ceil $qossettings{'CEIL'}kbit prio $qossettings{'PRIO'} ";
-               if ($qossettings{'BURST'} > 0) {
+               if (($qossettings{'BURST'} ne '') && ($qossettings{'BURST'} ne 0)) {
                        print "burst $qossettings{'BURST'}k ";
                }
                if (($qossettings{'CBURST'} ne '') && ($qossettings{'CBURST'} ne 0)) {
@@ -260,7 +275,7 @@ END
                        $qossettings{'L7PROT'} = $l7ruleline[2];
                        $qossettings{'QIP'} = $l7ruleline[3];
                        $qossettings{'DIP'} = $l7ruleline[4];
-                       print "\tiptables -t mangle -A QOS-OUT -o $qossettings{'DEVICE'} ";
+                       print "\tiptables -t mangle -A QOS-OUT -o $qossettings{'RED_DEV'} ";
                        if ($qossettings{'QIP'} ne ''){
                                print "-s $qossettings{'QIP'} ";
                        }
@@ -268,7 +283,7 @@ END
                                print "-d $qossettings{'DIP'} ";
                        }
                        print "-m layer7 --l7dir /etc/l7-protocols/protocols --l7proto $qossettings{'L7PROT'} -j MARK --set-mark $qossettings{'CLASS'}\n";
-                       print "\tiptables -t mangle -A QOS-OUT -o $qossettings{'DEVICE'} ";
+                       print "\tiptables -t mangle -A QOS-OUT -o $qossettings{'RED_DEV'} ";
                        if ($qossettings{'QIP'} ne ''){
                                print "-s $qossettings{'QIP'} ";
                        }
@@ -292,7 +307,7 @@ print "\n\t### SET PORT-RULES\n";
                        $qossettings{'QPORT'} = $portruleline[4];
                        $qossettings{'DIP'} = $portruleline[5];
                        $qossettings{'DPORT'} = $portruleline[6];
-                       print "\tiptables -t mangle -A QOS-OUT -o $qossettings{'DEVICE'} ";
+                       print "\tiptables -t mangle -A QOS-OUT -o $qossettings{'RED_DEV'} ";
                        if ($qossettings{'QIP'} ne ''){
                                print "-s $qossettings{'QIP'} ";
                        }
@@ -310,7 +325,7 @@ print "\n\t### SET PORT-RULES\n";
                                print "--dport $qossettings{'DPORT'} ";
                        }
                        print "-j MARK --set-mark $qossettings{'CLASS'}\n";
-                       print "\tiptables -t mangle -A QOS-OUT -o $qossettings{'DEVICE'} ";
+                       print "\tiptables -t mangle -A QOS-OUT -o $qossettings{'RED_DEV'} ";
                        if ($qossettings{'QIP'} ne ''){
                                print "-s $qossettings{'QIP'} ";
                        }
@@ -350,7 +365,7 @@ print <<END
 
        ### SET QUEUE LENGTH & MTU - has just to be tested!!! IMPORTANT
        ip link set dev $qossettings{'IMQ_DEV'} qlen $qossettings{'QLENGTH'}
-       ip link set dev $qossettings{'IMQ_DEV'} mtu $qossettings{'MTU'}
+       ip link set dev $qossettings{'IMQ_DEV'} mtu $qossettings{'MTU'}
 
        ### ADD HTB QDISC FOR $qossettings{'IMQ_DEV'}
        tc qdisc add dev $qossettings{'IMQ_DEV'} root handle 2: htb default $qossettings{'DEFCLASS_INC'}
@@ -373,10 +388,10 @@ foreach $classentry (sort @classes)
                $qossettings{'BURST'} = $classline[5];
                $qossettings{'CBURST'} = $classline[6];
                print "\ttc class add dev $qossettings{'DEVICE'} parent 2:1 classid 2:$qossettings{'CLASS'} htb rate $qossettings{'RATE'}kbit ceil $qossettings{'CEIL'}kbit prio $qossettings{'PRIO'} ";
-               if ($qossettings{'BURST'} > 0) {
+               if (($qossettings{'BURST'} ne '') && ($qossettings{'BURST'} ne 0)) {
                        print "burst $qossettings{'BURST'}k ";
                }
-               if (($qossettings{'CBURST'} ne '') || ($qossettings{'CBURST'} ne 0)) {
+               if (($qossettings{'CBURST'} ne '') && ($qossettings{'CBURST'} ne 0)) {
                        print "cburst $qossettings{'CBURST'}k";
                }
                print "\n";
@@ -397,7 +412,7 @@ foreach $subclassentry (sort @subclasses) {
                if ($qossettings{'SBURST'} > 0) {
                        print "burst $qossettings{'SBURST'}k ";
                }
-               if (($qossettings{'SCBURST'} ne '') || ($qossettings{'SCBURST'} ne 0)) {
+               if (($qossettings{'SCBURST'} ne '') && ($qossettings{'SCBURST'} ne 0)) {
                        print "cburst $qossettings{'CBURST'}k";
                }
                print "\n";
@@ -443,12 +458,11 @@ foreach $subclassentry (sort @subclasses) {
 }
 print <<END
 
-       ### ADD QOS-OUT CHAIN TO THE MANGLE TABLE IN IPTABLES
+       ### ADD QOS-INC CHAIN TO THE MANGLE TABLE IN IPTABLES
        iptables -t mangle -N QOS-INC
        iptables -t mangle -A PREROUTING -i $qossettings{'RED_DEV'} -j IMQ --todev 0
        iptables -t mangle -I PREROUTING -i $qossettings{'RED_DEV'} -j QOS-INC
 
-
        ### SET LEVEL7-RULES
 END
 ;
@@ -462,7 +476,7 @@ END
                        $qossettings{'L7PROT'} = $l7ruleline[2];
                        $qossettings{'QIP'} = $l7ruleline[3];
                        $qossettings{'DIP'} = $l7ruleline[4];
-                       print "\tiptables -t mangle -A QOS-INC -i $qossettings{'DEVICE'} ";
+                       print "\tiptables -t mangle -A QOS-INC -i $qossettings{'RED_DEV'} ";
                        if ($qossettings{'QIP'} ne ''){
                                print "-s $qossettings{'QIP'} ";
                        }
@@ -470,7 +484,7 @@ END
                                print "-d $qossettings{'DIP'} ";
                        }
                        print "-m layer7 --l7dir /etc/l7-protocols/protocols --l7proto $qossettings{'L7PROT'} -j MARK --set-mark $qossettings{'CLASS'}\n";
-                       print "\tiptables -t mangle -A QOS-INC -i $qossettings{'DEVICE'} ";
+                       print "\tiptables -t mangle -A QOS-INC -i $qossettings{'RED_DEV'} ";
                        if ($qossettings{'QIP'} ne ''){
                                print "-s $qossettings{'QIP'} ";
                        }
@@ -494,7 +508,7 @@ print "\n\t### SET PORT-RULES\n";
                        $qossettings{'QPORT'} = $portruleline[4];
                        $qossettings{'DIP'} = $portruleline[5];
                        $qossettings{'DPORT'} = $portruleline[6];
-                       print "\tiptables -t mangle -A QOS-INC -i $qossettings{'DEVICE'} ";
+                       print "\tiptables -t mangle -A QOS-INC -i $qossettings{'RED_DEV'} ";
                        if ($qossettings{'QIP'} ne ''){
                                print "-s $qossettings{'QIP'} ";
                        }
@@ -512,7 +526,7 @@ print "\n\t### SET PORT-RULES\n";
                                print "--dport $qossettings{'DPORT'} ";
                        }
                        print "-j MARK --set-mark $qossettings{'CLASS'}\n";
-                       print "\tiptables -t mangle -A QOS-INC -i $qossettings{'DEVICE'} ";
+                       print "\tiptables -t mangle -A QOS-INC -i $qossettings{'RED_DEV'} ";
                        if ($qossettings{'QIP'} ne ''){
                                print "-s $qossettings{'QIP'} ";
                        }
@@ -534,39 +548,44 @@ print "\n\t### SET PORT-RULES\n";
        }
 
 print <<END
-
        ### REDUNDANT: SET ALL NONMARKED PACKETS TO DEFAULT CLASS
-       iptables -t mangle -A QOS-INC -i $qossettings{'IMQ_DEV'} -m mark --mark 0 -j MARK --set-mark $qossettings{'DEFCLASS_INC'}
+       iptables -t mangle -A QOS-INC -i $qossettings{'RED_DEV'} -m mark --mark 0 -j MARK --set-mark $qossettings{'DEFCLASS_INC'}
 
        echo "Quality of Service was successfully started!"
        exit 0
   ;;
-  clear)
+  clear|stop)
        ### RESET EVERYTHING TO A KNOWN STATE
        # DELETE QDISCS
        tc qdisc del dev $qossettings{'RED_DEV'} root
        tc qdisc del dev $qossettings{'IMQ_DEV'} root
+       # STOP IMQ-DEVICE
+       ip link set $qossettings{'IMQ_DEV'} down
+       iptables -t mangle --delete PREROUTING -i $qossettings{'RED_DEV'} -j IMQ --todev 0
+       rmmod imq
        # REMOVE & FLUSH CHAINS
        iptables -t mangle --delete POSTROUTING -o $qossettings{'RED_DEV'} -j QOS-OUT
        iptables -t mangle --flush  QOS-OUT
        iptables -t mangle --delete-chain QOS-OUT
-       iptables -t mangle --delete PREROUTING -i $qossettings{'IMQ_DEV'} -j QOS-INC
+       iptables -t mangle --delete PREROUTING -i $qossettings{'RED_DEV'} -j QOS-INC
        iptables -t mangle --flush  QOS-INC
        iptables -t mangle --delete-chain QOS-INC
-       # STOP IMQ-DEVICE
-       ip link set $qossettings{'IMQ_DEV'} down
-       iptables -t mangle --delete PREROUTING -i $qossettings{'RED_DEV'} -j IMQ --todev 0
-       rmmod imq
        rmmod sch_htb
-       ## rmmod ipt_IMQ # Doesn't work :(
        echo "Quality of Service was successfully cleared!"
   ;;
-  gen)
+  gen|generate)
        echo -n "Generateing the QoS-Scripts..."
        /usr/bin/perl /var/ipfire/qos/bin/makeqosscripts.pl > /var/ipfire/qos/bin/qos.sh
        echo ".Done!"
        exit 0
        ;;
+  restart)
+       ### FIRST CLEAR EVERYTHING
+       \$0 clear
+
+       ### THEN START
+       \$0 start
+       ;;
 esac
 ### EOF
 END
index 6fec966..775c6ed 100644 (file)
@@ -161,7 +161,7 @@ if ($ip ne $ipcache) {
                            my ($out, $response) = Net::SSLeay::get_http(  'www.cjb.net',
                                                                            80,
                                                                            "/cgi-bin/dynip.cgi?username=$settings{'LOGIN'}&password=$settings{'PASSWORD'}&ip=$ip",
-                                                                           Net::SSLeay::make_headers('User-Agent' => 'Ipcop' )
+                                                                           Net::SSLeay::make_headers('User-Agent' => 'IPFire' )
                                                                         );
 
                            if ($response =~ m%HTTP/1\.. 200 OK%) {
@@ -187,7 +187,7 @@ if ($ip ne $ipcache) {
                            my ($out, $response) = Net::SSLeay::get_https(  'carol.selfhost.de',
                                                                            443,
                                                                            "/update?username=$settings{'LOGIN'}&password=$settings{'PASSWORD'}&textmodi=1",
-                                                                           Net::SSLeay::make_headers('User-Agent' => 'Ipcop' )
+                                                                           Net::SSLeay::make_headers('User-Agent' => 'IPFire' )
                                                                         );
 
                            if ($response =~ m%HTTP/1\.. 200 OK%) {
@@ -220,7 +220,7 @@ if ($ip ne $ipcache) {
                            my ($out, $response) = Net::SSLeay::get_https(  "www.dnspark.net",
                                                                            443,
                                                                            "/api/dynamic/update.php?hostname=$settings{'HOSTDOMAIN'}&ip=$ip",
-                                                                           Net::SSLeay::make_headers('User-Agent' => 'Ipcop',
+                                                                           Net::SSLeay::make_headers('User-Agent' => 'IPFire',
                                                                                                      'Authorization' => 'Basic ' . encode_base64("$settings{'LOGIN'}:$settings{'PASSWORD'}")
                                                                             )
                                                                         );
@@ -254,7 +254,7 @@ if ($ip ne $ipcache) {
                            my ($out, $response) = Net::SSLeay::get_http(  'dynamic.name-services.com',
                                                                            80,
                                                                            "/interface.asp?Command=SetDNSHost&Zone=$settings{'DOMAIN'}&DomainPassword=$settings{'PASSWORD'}&Address=$ip",
-                                                                           Net::SSLeay::make_headers('User-Agent' => 'Ipcop' )
+                                                                           Net::SSLeay::make_headers('User-Agent' => 'IPFire' )
                                                                         );
 
                            if ($response =~ m%HTTP/1\.. 200 OK%) {
@@ -347,7 +347,7 @@ if ($ip ne $ipcache) {
                            my ($out, $response) = Net::SSLeay::get_https(  'freedns.afraid.org',
                                                                            443,
                                                                            "/dynamic/update.php?$settings{'LOGIN'}",
-                                                                           Net::SSLeay::make_headers('User-Agent' => 'Ipcop' )
+                                                                           Net::SSLeay::make_headers('User-Agent' => 'IPFire' )
                                                                         );
                            #Valid responses from service are:
                             #Updated n host(s) <domain>
@@ -377,7 +377,7 @@ if ($ip ne $ipcache) {
                            my ($out, $response) = Net::SSLeay::get_https(  'www.regfish.com',
                                                                            443,
                                                                            "/dyndns/2/?fqdn=$settings{'DOMAIN'}&ipv4=$ip&forcehost=1&authtype=secure&token=$settings{'LOGIN'}",
-                                                                           Net::SSLeay::make_headers('User-Agent' => 'Ipcop' )
+                                                                           Net::SSLeay::make_headers('User-Agent' => 'IPFire' )
                                                                         );
                            #Valid responses from service are:
                            #success|100|update succeeded!
@@ -421,7 +421,7 @@ if ($ip ne $ipcache) {
                                $GET_CMD .= "Host: www.ovh.com\r\n";
                                chomp($code64 = encode_base64("$settings{'LOGIN'}:$settings{'PASSWORD'}"));
                                $GET_CMD .= "Authorization: Basic $code64\r\n";
-                               $GET_CMD .= "User-Agent: ipcop\r\n";
+                               $GET_CMD .= "User-Agent: ipfire\r\n";
                               #$GET_CMD .= "Content-Type: application/x-www-form-urlencoded\r\n";
                                $GET_CMD .= "\r\n";
                                print $sock "$GET_CMD";
@@ -465,7 +465,7 @@ if ($ip ne $ipcache) {
                            my ($out, $response) = Net::SSLeay::get_http(  'www.dtdns.com',
                                                                            80,
                                                                            "/api/autodns.cfm?id=$settings{'HOSTDOMAIN'}&pw=$settings{'PASSWORD'}",
-                                                                           Net::SSLeay::make_headers('User-Agent' => 'Ipcop' )
+                                                                           Net::SSLeay::make_headers('User-Agent' => 'IPFire' )
                                                                         );
                            #Valid responses from service are:
                            #   now points to
@@ -499,7 +499,7 @@ if ($ip ne $ipcache) {
                            my ($out, $response) = Net::SSLeay::get_http(  'dynserv.ca',
                                                                            80,
                                                                            "/dyn/dynengine.cgi?func=set&name=$settings{'LOGIN'}&pass=$settings{'PASSWORD'}&ip=$ip&domain=$settings{'DOMAIN'}",
-                                                                           Net::SSLeay::make_headers('User-Agent' => 'Ipcop' )
+                                                                           Net::SSLeay::make_headers('User-Agent' => 'IPFire' )
                                                                         );
                            #Valid responses from service are:
                            # 02 == Domain already exists, refreshing data for ... => xxx.xxx.xxx.xxx
@@ -601,7 +601,7 @@ old code for selfhost.de
                                my $GET_CMD;
                                $GET_CMD  = "GET https://carol.selfhost.de/update?username=$settings{'LOGIN'}&password=$settings{'PASSWORD'}&myip=$ip&textmodi=1 HTTP/1.1\r\n";
                                $GET_CMD .= "Host: carol.selfhost.de\r\n";
-                               $GET_CMD .= "User-Agent: ipcop\r\n";
+                               $GET_CMD .= "User-Agent: ipfire\r\n";
                                $GET_CMD .= "Connection: close\r\n\r\n";
                                print $sock "$GET_CMD";
 
index bd6d095..24db42a 100644 (file)
@@ -45,25 +45,25 @@ if [ -n "$1" ]; then
                if [ "$ntpdatetest" -eq 0 ]; then
                        case $tlanguage in
                                en ) date "+%X %Z on %d %B %Y" > /var/ipfire/time/lastset ;
-                                       logger -t ipcop "NTP synchronisation event" ;;
+                                       logger -t ipfire "NTP synchronisation event" ;;
                                da ) date "+%k:%M:%S på %d/%m/%y" > /var/ipfire/time/lastset ;
-                                       logger -t ipcop "NTP synkronisering" ;;
+                                       logger -t ipfire "NTP synkronisering" ;;
                                de ) date "+%X Uhr am %d.%m.%Y" > /var/ipfire/time/lastset ;
-                                       logger -t ipcop "NTP Synchronisierung" ;;
+                                       logger -t ipfire "NTP Synchronisierung" ;;
                                fr ) date "+%X le %e/%m/%y" > /var/ipfire/time/lastset ;
-                                       logger -t ipcop "synchronisation NTP" ;;
+                                       logger -t ipfire "synchronisation NTP" ;;
                                it ) date "+%X il %d-%m-%Y" > /var/ipfire/time/lastset ;
-                                       logger -t ipcop "sincronizzazione NTP" ;;
+                                       logger -t ipfire "sincronizzazione NTP" ;;
                                nl ) date "+%X %e-%m-%Y" > /var/ipfire/time/lastset ;
-                                       logger -t ipcop "NTP synchronisatie" ;;
+                                       logger -t ipfire "NTP synchronisatie" ;;
                                no ) date "+%X på %d-%m-%y" > /var/ipfire/time/lastset ;
-                                       logger -t ipcop "NTP synkronisering" ;;
+                                       logger -t ipfire "NTP synkronisering" ;;
                                sv ) date "+%H.%M.%S på %y-%m-%d" > /var/ipfire/time/lastset ;
-                                       logger -t ipcop "NTP synkronisering" ;;
+                                       logger -t ipfire "NTP synkronisering" ;;
                                es ) date "+%X %e/%-m/%y" > /var/ipfire/time/lastset ;
-                                       logger -t ipcop "NTP sincronizado" ;;
+                                       logger -t ipfire "NTP sincronizado" ;;
                                *  ) date "+%X %Z, %Y-%m-%d" > /var/ipfire/time/lastset ;
-                                       logger -t ipcop "NTP synchronisation" ;;
+                                       logger -t ipfire "NTP synchronisation" ;;
                        esac
 
                        /sbin/hwclock --systohc
@@ -72,10 +72,10 @@ if [ -n "$1" ]; then
                        cp /var/ipfire/time/counter.conf /var/ipfire/time/counter
                else
                        case $tlanguage in
-                               de ) logger -t ipcop "ntpdate fehlerhaft" ;;
-                               fr ) logger -t ipcop "ntpdate erreur" ;;
-                               it ) logger -t ipcop "ntpdate errato" ;;
-                               *  ) logger -t ipcop "ntpdate error" ;;
+                               de ) logger -t ipfire "ntpdate fehlerhaft" ;;
+                               fr ) logger -t ipfire "ntpdate erreur" ;;
+                               it ) logger -t ipfire "ntpdate errato" ;;
+                               *  ) logger -t ipfire "ntpdate error" ;;
                        esac
                fi
        fi