Upgrade ahcpd to 0.5 (#3480)
authorFlorian Fainelli <florian@openwrt.org>
Thu, 29 May 2008 20:57:34 +0000 (20:57 +0000)
committerFlorian Fainelli <florian@openwrt.org>
Thu, 29 May 2008 20:57:34 +0000 (20:57 +0000)
SVN-Revision: 11291

ipv6/ahcpd/Makefile
ipv6/ahcpd/files/ahcpd.config [changed mode: 0644->0755]
ipv6/ahcpd/files/ahcpd.init

index 729962fb7744630f1199839d48229085958f2eef..18cd6e2c70e5a850eccddba8a69324a805478336 100644 (file)
@@ -9,12 +9,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ahcpd
-PKG_VERSION:=0.4
+PKG_VERSION:=0.5
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://www.pps.jussieu.fr/~jch/software/files/
-PKG_MD5SUM:=25a4e415ff9b18964acfb5a322e290bb
+PKG_MD5SUM:=0e5fe1199161eeef214c43eca7eec9a1
 
 include $(INCLUDE_DIR)/package.mk
 
old mode 100644 (file)
new mode 100755 (executable)
index a66cc52..2cc985d
@@ -1,16 +1,4 @@
 config ahcpd
-       option enabled          0
-       option interface       'lo'
-       #option address         'MULTICAST-LINK-LOCAL-ADDRESS'
-       #option port            'UDP-PORT'
-       #option config_script   '/usr/lib/ahcp/dummy-config.sh'
-       #option pid_file        '/var/run/ahcpd-INTERFACE.pid'
-       #option authoritative    0
-       #option authority_file  '/var/run/ahcpd-INTERFACE.dat'
-       #option expire          'SECONDS'
-       #option prefix          'fde6:20f5:c9ac:358::'
-       #option protocol        'static|Babel|OLSR'
-       #option gateway         'fde6:20f5:c9ac:358::1'
-       #option dns_server      'fde6:20f5:c9ac:358::2'
-       #option ntp_server      'fde6:20f5:c9ac:358::3'
-
+       option interfaces "wl0 alpha-beta huponomos"
+       option no_dns true
+       option no_ipv4 true
index 1d92871c9cf417f878cf1ac0101a6e44e529b49f..c87b291f7012e79580dbcc05da9c78e47fec7934 100644 (file)
 #!/bin/sh /etc/rc.common
-# Copyright (C) 2007 OpenWrt.org
 
-START=99
+START=71
 
-NAME=ahcpd
-BIN_F=/usr/sbin/$NAME
-SSD=start-stop-daemon
+pidfile=/var/run/ahcpd.pid
 
-is_enabled() {
+ahcpd_config() {
        local cfg="$1"
-
-       config_get_bool enabled "$cfg" enabled '1'
-       [ $enabled -ne 0 ] || {
-               echo "$initscript: not enabled"
-               return 1
-       }
-}
-
-get_interface() {
-       local cfg="$1"
-
-       config_get interface "$cfg" interface
-       [ -n "$interface" ] || {
-               echo "$initscript: not 'interface' option specified"
-               return 1
-       }
-}
-
-get_pid_file() {
-       local cfg="$1"
-
-       config_get pid_file "$cfg" pid_file
-       [ -n "$pid_file" ] || pid_file="/var/run/$NAME-$interface.pid"
-}
-
-get_options() {
-       local cfg="$1"
-       local address
-       local port
-       local authoritative
-
-       config_get options "$cfg" options
-
-       config_get config_script "$cfg" config_script
-       [ -n "$config_script" ] && append options "-c $config_script"
-
-       config_get address "$cfg" address
-       [ -n "$adress" ] && append options "-m $address"
-
-       config_get port "$cfg" port
-       [ -n "$port" ] && append options "-p $port"
-
-       config_get_bool authoritative "$cfg" authoritative '0'
-       [ $authoritative -ne 0 ] && {
-               local dat_file
-               local gen_options
-
-               config_get dat_file "$cfg" authority_file
-               [ -n "$dat_file" ] || dat_file="/var/run/$NAME-$interface.dat"
-
-               [ -f "$dat_file" ] || {
-                       local expire
-                       local prefix
-                       local prototocol
-                       local dns_server
-                       local ntp_server
-
-                       config_get prefix "$cfg" prefix
-                       [ -n "$prefix" ] || prefix=`ahcp-generate-address -p -s -r`
-                       append gen_options "-p $prefix"
-
-                       config_get expire "$cfg" expire
-                       [ -n "$expire" ] && append gen_options "-e $expire"
-
-                       config_get protocol "$cfg" protocol
-                       [ -n "$protocol" ] && append gen_options "-P $protocol"
-
-                       [ "$protocol" = "static" ] && {
-                               local gateway
-
-                               config_get gateway "$cfg" gateway
-                               [ -n "$gateway" ] && append gen_options "-g $gateway"
-                       }
-
-                       config_get dns_server "$cfg" dns_server
-                       [ -n "$dns_server" ] && append gen_options "-n $dns_server"
-
-                       config_get ntp_server "$cfg" ntp_server
-                       [ -n "$ntp_server" ] && append gen_options "-N $ntp_server"
-
-                       ahcp-generate $gen_options > $dat_file
-               }
-               append options "-a $dat_file"
-       }
-       append options "$interface"
-}
-
-start_service() {
-       local cfg="$1"
-
-       is_enabled "$cfg" || return
-       get_interface "$cfg" || return
-       get_pid_file $cfg
-       get_options $cfg
-
-       $SSD -S -p $pid_file -b -m -x $BIN_F -- $options &>/dev/null
-}
-
-stop_service() {
-       local cfg="$1"
-
-       is_enabled "$cfg" || return
-       get_interface "$cfg" || return
-       get_pid_file $cfg
-
-       $SSD -K -p $pid_file &>/dev/null
+       config_get interfaces "$cfg" interfaces
+       config_get no_ipv4 "$cfg" no_ipv4
+       config_get no_dns "$cfg" no_dns
 }
 
 start() {
-       config_load $NAME
-       config_foreach start_service $NAME
+       config_load ahcpd
+       config_foreach ahcpd_config ahcpd
+       mkdir -p /var/lib
+       [ -r /usr/lib/ahcp/ahcp.dat ] && authority="-a /usr/lib/ahcp/ahcp.dat"
+       if [ -e $pidfile ] ; then
+               echo "$pidfile exists -- not starting ahcpd." >&2
+       else
+               /usr/bin/ahcpd -D -I $pidfile ${no_ipv4:+-s} ${no_dns:+-N} $authority $interfaces
+       fi
 }
 
 stop() {
-       config_load $NAME
-       config_foreach stop_service $NAME
+       [ -e $pidfile ] && kill $(cat $pidfile)
+       [ -e $pidfile ] && sleep 2
+       [ -e $pidfile ] && sleep 4
+       [ -e $pidfile ] && echo "Failed to stop ahcpd ($pidfile still exists)."
 }
-