diff options
Diffstat (limited to 'package')
378 files changed, 112813 insertions, 0 deletions
diff --git a/package/Makefile b/package/Makefile new file mode 100644 index 0000000000..e94c181ba0 --- /dev/null +++ b/package/Makefile @@ -0,0 +1,69 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk +include $(TOPDIR)/.config +include $(TOPDIR)/.pkgdeps +include $(TOPDIR)/host.mk + +PREREQ_PACKAGES:=$(patsubst %,%-prereq,$(prereq-y) $(prereq-m)) +DOWNLOAD_PACKAGES:=$(patsubst %,%-download,$(package-y) $(package-m)) +COMPILE_PACKAGES:=$(patsubst %,%-compile,$(package-y) $(package-m)) +INSTALL_PACKAGES:=$(patsubst %,%-install,$(package-y)) + +$(STAMP_DIR) $(TARGET_DIR): + mkdir -p $@ + +%-prereq: $(STAMP_DIR) $(TARGET_DIR) + $(MAKE) -C $(patsubst %-prereq,%,$@) prereq + +%-download: $(STAMP_DIR) $(TARGET_DIR) + $(MAKE) -C $(patsubst %-download,%,$@) download + +%-prepare: $(STAMP_DIR) $(TARGET_DIR) + $(MAKE) -C $(patsubst %-prepare,%,$@) prepare + +%-compile: $(STAMP_DIR) $(TARGET_DIR) + $(MAKE) -C $(patsubst %-compile,%,$@) compile + +%-install: $(STAMP_DIR) $(TARGET_DIR) + $(MAKE) -C $(patsubst %-install,%,$@) install + +%-clean: $(STAMP_DIR) $(TARGET_DIR) + $(MAKE) -C $(patsubst %-clean,%,$@) clean + +ifeq ($(SDK),1) +GENDEP_OPTS := -s +endif + +$(TOPDIR)/.pkgdeps: $(TOPDIR)/.pkginfo + @$(TOPDIR)/scripts/gen_deps.pl $(GENDEP_OPTS) < $< > $@ || rm -f $@ + +all: compile +clean: $(patsubst %,%-clean,$(package-) $(package-y) $(package-m)) +prereq: $(PREREQ_PACKAGES) +download: $(DOWNLOAD_PACKAGES) +compile-targets: $(COMPILE_PACKAGES) +compile: + $(MAKE) compile-targets +install-targets: base-files-install $(INSTALL_PACKAGES) +install: + rm -rf $(BUILD_DIR)/root + $(MAKE) install-targets + +index: $(PACKAGE_DIR)/Packages + +$(PACKAGE_DIR)/Packages: $(PACKAGE_DIR)/*.ipk + (cd $(PACKAGE_DIR); $(SCRIPT_DIR)/ipkg-make-index.sh . > Packages) + + +ifeq ($(MAKECMDGOALS),compile-targets) +MAKEFLAGS:=$(MAKEFLAGS) -j$(CONFIG_JLEVEL) +else +.NOTPARALLEL: +endif diff --git a/package/alsa/Makefile b/package/alsa/Makefile new file mode 100644 index 0000000000..47ad4456bf --- /dev/null +++ b/package/alsa/Makefile @@ -0,0 +1,81 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=alsa-driver +PKG_VERSION:=1.0.11 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=ftp://ftp.alsa-project.org/pub/driver/ +PKG_MD5SUM:=57534e4297cd683371402220e3753885 +PKG_CAT:=bzcat + +PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/kmod-alsa + SECTION:=kernel + CATEGORY:=Kernel drivers + DEPENDS:=@USB_SUPPORT + TITLE:=Advanced Linux Sound Architecture + URL:=http://alsa-project.org/ + VERSION:=$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE) +endef + +ifeq ($(KERNEL),2.4) + ifeq ($(LINUX_KARCH),i386) + KERNEL_C_OPTS:= -Os -mpreferred-stack-boundary=2 -march=i486 -fno-unit-at-a-time + endif + ifeq ($(LINUX_KARCH),mips) + KERNEL_C_OPTS:= -Os -G 0 -mno-abicalls -fno-pic -finline-limit=100000 -mabi=32 -march=mips32 -Wa,-32 -Wa,-march=mips32 -Wa,-mips32 -Wa,--trap + endif +endif +ifeq ($(LINUX_KARCH),i386) + KERNEL_C_INCS:= -I$(LINUX_DIR)/include/asm-i386/mach-generic -I$(LINUX_DIR)/include/asm-i386/mach-default +endif +ifeq ($(LINUX_KARCH),mips) + KERNEL_C_INCS:= -I$(LINUX_DIR)/include/asm-mips/mach-generic +endif + +define Build/Configure + (cd $(PKG_BUILD_DIR); \ + CFLAGS="$(KERNEL_C_INCS)" \ + ./configure \ + --with-build="$(LINUX_DIR)" \ + --with-kernel="$(LINUX_DIR)" \ + --with-cross="$(KERNEL_CROSS)" \ + --with-redhat=no \ + --with-suse=no \ + --with-oss=yes \ + --with-isapnp=no \ + --with-sequencer=no \ + --with-cards=usb-audio \ + ); +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + ARCH="$(LINUX_KARCH)" \ + CROSS_COMPILE="$(TARGET_CROSS)" \ + c_opts="$(KERNEL_C_OPTS)" \ + all +endef + +define Package/kmod-alsa/install + install -d -m0755 $(1)/lib/modules/$(LINUX_VERSION) + install -m0644 $(PKG_BUILD_DIR)/modules/*.$(LINUX_KMOD_SUFFIX) \ + $(1)/lib/modules/$(LINUX_VERSION)/ + install -d -m0755 $(1)/etc/modules.d + install -m0644 ./files/alsa.modules $(1)/etc/modules.d/70-alsa +endef + +$(eval $(call BuildPackage,kmod-alsa)) diff --git a/package/alsa/files/alsa.modules b/package/alsa/files/alsa.modules new file mode 100644 index 0000000000..6b16c8c586 --- /dev/null +++ b/package/alsa/files/alsa.modules @@ -0,0 +1,10 @@ +snd-page-alloc +snd +snd-timer +snd-pcm +snd-rawmidi +snd-usb-lib +snd-hwdep +snd-usb-audio +snd-mixer-oss +snd-pcm-oss diff --git a/package/alsa/patches/100-compile_fix.patch b/package/alsa/patches/100-compile_fix.patch new file mode 100644 index 0000000000..2e2a3df79a --- /dev/null +++ b/package/alsa/patches/100-compile_fix.patch @@ -0,0 +1,18 @@ +diff -urN alsa.old/include/adriver.h alsa.dev/include/adriver.h +--- alsa.old/include/adriver.h 2006-04-19 08:24:30.000000000 +0200 ++++ alsa.dev/include/adriver.h 2006-05-31 17:24:49.000000000 +0200 +@@ -451,7 +451,7 @@ + #endif /* < 2.6.0 */ + + /* workarounds for USB API */ +-#if defined(SND_NEED_USB_WRAPPER) && (defined(CONFIG_USB) || defined(CONFIG_USB_MODULE)) ++#if 1 + + #include <linux/usb.h> + +@@ -1174,4 +1174,5 @@ + */ + #define OPL3_HW_OPL3_PC98 0x0305 /* PC9800 */ + ++#undef info /* used in several structs */ + #endif /* __SOUND_LOCAL_DRIVER_H */ diff --git a/package/arptables/Makefile b/package/arptables/Makefile new file mode 100644 index 0000000000..0518e8ea36 --- /dev/null +++ b/package/arptables/Makefile @@ -0,0 +1,42 @@ +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=arptables +PKG_VERSION:=0.0.3 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-v$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/ebtables +PKG_MD5SUM:=1672244603c8979577aa4738be35a759 +PKG_CAT:=zcat + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-v$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/arptables + SECTION:=net + CATEGORY:=Network + TITLE:=ARP firewalling software + URL:=http://ebtables.sourceforge.net +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + $(TARGET_CONFIGURE_OPTS) \ + COPT_FLAGS="$(TARGET_CFLAGS)" \ + KERNEL_DIR="./include/linux" +endef + +define Package/arptables/install + install -m0755 -d $(1)/usr/sbin + $(CP) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,arptables)) diff --git a/package/base-files/Makefile b/package/base-files/Makefile new file mode 100644 index 0000000000..9f6da3bc7c --- /dev/null +++ b/package/base-files/Makefile @@ -0,0 +1,191 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=base-files +PKG_RELEASE:=8 + +PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME) + +REV:=$(shell LANG=C svn info | awk '/^Revision:/ { print$$2 }' ) +ifeq ($(REV),) + REV:=0 +endif + +include $(INCLUDE_DIR)/package.mk + +ifneq ($(DUMP),1) + TARGET:=-$(BOARD)-$(KERNEL) + UCLIBC_VERSION:=${shell cat $(STAGING_DIR)/uclibc_version 2>/dev/null} + LIBGCC_VERSION:=${shell cat $(STAGING_DIR)/gcc_version 2>/dev/null} +else + UCLIBC_VERSION:=<UCLIBC_VERSION> + LIBGCC_VERSION:=<LIBGCC_VERSION> +endif + +CONFIG_PACKAGE_base-files$(TARGET):=$(CONFIG_PACKAGE_base-files) + +define Package/base-files$(TARGET) + SECTION:=base + CATEGORY:=Base system + DEFAULT:=y + TITLE:=Base filesystem for OpenWrt + DESCRIPTION:=\ + This package contains a base filesystem and system scripts for OpenWrt. + URL:=http://openwrt.org/ + VERSION:=$(PKG_RELEASE)-$(REV) +endef + +define -ar7-2.4/conffiles +/etc/config/network +endef + +define -aruba-2.6/conffiles +/etc/config/network +endef + +define -au1000-2.6/conffiles +/etc/config/network +endef + +define -rb532-2.6/conffiles +/etc/config/network +endef + +define -sibyte-2.6/conffiles +/etc/config/network +endef + +define -x86-2.6/conffiles +/etc/config/network +endef + +define -xscale-2.6/conffiles +/etc/config/network +endef + +define Package/base-files$(TARGET)/conffiles +/etc/banner +/etc/hosts +/etc/inittab +/etc/group +/etc/passwd +/etc/profile +/etc/shells +/etc/ipkg.conf +/etc/sysctl.conf +$(call $(TARGET)/conffiles) +endef + +define Package/libgcc + SECTION:=libs + CATEGORY:=Base system + DEFAULT:=y + DEPENDS:=@!NATIVE_TOOLCHAIN + TITLE:=GCC support library + URL:=http://gcc.gnu.org/ + VERSION:=$(LIBGCC_VERSION)-$(PKG_RELEASE) +endef + +define Package/libpthread + SECTION:=libs + CATEGORY:=Libraries + DEPENDS:=@!NATIVE_TOOLCHAIN + TITLE:=POSIX thread library + URL:=http://uclibc.org/ + VERSION:=$(UCLIBC_VERSION)-$(PKG_RELEASE) +endef + +define Package/uclibc + SECTION:=libs + CATEGORY:=Base system + DEFAULT:=y + DEPENDS:=@!NATIVE_TOOLCHAIN + TITLE:=C library embedded systems + URL:=http://uclibc.org/ + VERSION:=$(UCLIBC_VERSION)-$(PKG_RELEASE) +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) +endef + +define Build/Compile/ar7 + $(TARGET_CC) -o $(PKG_BUILD_DIR)/adam2patcher src/adam2patcher.c +endef + +define Build/Compile/brcm + $(TARGET_CC) -o $(PKG_BUILD_DIR)/jffs2root src/jffs2root.c +endef + +define Build/Compile + $(call Build/Compile/$(BOARD)) +endef + + +define Package/base-files$(TARGET)/install-ar7 + mkdir -p $(1)/sbin + $(CP) $(PKG_BUILD_DIR)/adam2patcher $(1)/sbin +endef + +define Package/base-files$(TARGET)/install-brcm + rm -f $(1)/etc/config/network + mkdir -p $(1)/sbin + $(CP) $(PKG_BUILD_DIR)/jffs2root $(1)/sbin +endef + +define Package/base-files$(TARGET)/install + $(CP) ./default/* $(1)/ + if [ -d $(BOARD)-$(KERNEL) ]; then \ + $(CP) $(BOARD)-$(KERNEL)/* $(1)/; \ + fi + $(SED) 's,$$$$R,r$(REV),g' $(1)/etc/banner + $(SED) 's,$$$$S,$(BOARD)-$(KERNEL),g' $(1)/etc/ipkg.conf + mkdir -p $(1)/dev + mkdir -p $(1)/etc/crontabs + mkdir -p $(1)/jffs + mkdir -p $(1)/lib + mkdir -p $(1)/mnt + mkdir -p $(1)/proc + mkdir -p $(1)/tmp + mkdir -p $(1)/usr/lib + mkdir -p $(1)/usr/bin + mkdir -p $(1)/sys + mkdir -p $(1)/www + ln -sf /proc/mounts $(1)/etc/mtab + rm -f $(1)/var + ln -sf /tmp $(1)/var + mkdir -p $(1)/etc +$(call Package/base-files$(TARGET)/install-$(BOARD),$(1)) +endef + +define Package/libgcc/install + install -m0755 -d $(1)/lib + $(CP) $(STAGING_DIR)/lib/libgcc_s.so.* $(1)/lib/ +endef + +define Package/libpthread/install + install -m0755 -d $(1)/lib + $(CP) $(STAGING_DIR)/lib/libpthread.so.* $(1)/lib/ + $(CP) $(STAGING_DIR)/lib/libpthread-$(UCLIBC_VERSION).so $(1)/lib/ +endef + +define Package/uclibc/install + install -m0755 -d $(1)/lib + for file in ld-uClibc libc libcrypt libdl libm libnsl libresolv librt libuClibc libutil; do \ + $(CP) $(STAGING_DIR)/lib/$$$$file.so.* $(1)/lib/; \ + $(CP) $(STAGING_DIR)/lib/$$$$file-$(UCLIBC_VERSION).so $(1)/lib/; \ + done +endef + +$(eval $(call BuildPackage,base-files$(TARGET))) +$(eval $(call BuildPackage,libgcc)) +$(eval $(call BuildPackage,libpthread)) +$(eval $(call BuildPackage,uclibc)) diff --git a/package/base-files/ar7-2.4/bin/firstboot b/package/base-files/ar7-2.4/bin/firstboot new file mode 100755 index 0000000000..774bbc754b --- /dev/null +++ b/package/base-files/ar7-2.4/bin/firstboot @@ -0,0 +1,89 @@ +#!/bin/sh +# Copyright (C) 2006 OpenWrt.org + +rom=$(awk '/squashfs/ {print $2}' /proc/mounts) +jffs=$(awk '/jffs2/ {print $2}' /proc/mounts) + +dupe() { # <new_root> <old_root> + cd $1 + echo -n "creating directories... " + { + cd $2 + find . -xdev -type d + echo "./dev ./jffs ./mnt ./proc ./tmp ./sys" + # xdev skips mounted directories + cd $1 + } | xargs mkdir -p + echo "done" + + echo -n "setting up symlinks... " + for file in $(cd $2; find . -xdev -type f;); do + case "$file" in + ./rom/note) ;; #nothing + ./etc/config*|\ + ./etc/resolv.conf|\ + ./usr/lib/ipkg/info) cp -af $2/$file $file;; + *) ln -sf /rom/${file#./*} $file;; + esac + done + for file in $(cd $2; find . -xdev -type l;); do + cp -af $2/${file#./*} $file + done + echo "done" +} + +pivot() { # <new_root> <old_root> + mount -o move /proc $1/proc && \ + pivot_root $1 $1$2 && { + mount -o move $2/dev /dev + mount -o move $2/tmp /tmp + mount -o move $2/sys /sys + return 0 + } +} + +mountdp() { # <device> <mount_point> <ignored> <fs> + dev=$1; mnt=$2; shift 2; opt=$* + mount $dev $mnt $opt + dupe $mnt $rom + pivot $mnt /rom +} + +ramoverlay() { + mkdir -p /tmp/root + mountdp /tmp/root /mnt -o bind +} + +[ "${0##*/}" = "firstboot" ] && { + [ -z "$rom" ] && { + echo "You do not have a squashfs partition; aborting" + echo "(firstboot cannot be run on jffs2 based firmwares)" + exit 1 + } + + [ "$1" = "switch2jffs" ] && { + mtd erase OpenWrt + mount -o remount,ro none / # try to avoid fs changing while copying + mount -o bind / /mnt + mount /dev/mtdblock/4 /rom/jffs -t jffs2 + echo -n "copying files ... " + cp -a /mnt/* /rom/jffs + umount /mnt + echo "done" + pivot /rom /mnt + mount -o move /mnt /tmp/root + pivot /jffs /rom + exit 0 + } + + # script run manually + [ \! -z "$jffs" ] && { + echo "firstboot has already been run" + echo "jffs2 partition is mounted, only resetting files" + dupe $jffs $rom + exit 0 + } + + mtd erase OpenWrt + mountdp /dev/mtdblock/4 /jffs -t jffs2 +} diff --git a/package/base-files/ar7-2.4/etc/config/network b/package/base-files/ar7-2.4/etc/config/network new file mode 100644 index 0000000000..911134bb0d --- /dev/null +++ b/package/base-files/ar7-2.4/etc/config/network @@ -0,0 +1,14 @@ +# Network configuration file + +config interface loopback + option ifname lo + option proto static + option ipaddr 127.0.0.1 + option netmask 255.0.0.0 + +config interface lan + option ifname eth0 + option proto static + option ipaddr 192.168.1.1 + option netmask 255.255.255.0 + diff --git a/package/base-files/ar7-2.4/etc/init.d/S00adam2 b/package/base-files/ar7-2.4/etc/init.d/S00adam2 new file mode 100755 index 0000000000..5f5b3504c2 --- /dev/null +++ b/package/base-files/ar7-2.4/etc/init.d/S00adam2 @@ -0,0 +1,12 @@ +#!/bin/sh /etc/rc.common +# ADAM2 patcher for Netgear DG834 and compatible +# Copyright (C) 2006 OpenWrt.org + +start() { + MD5="$(md5sum /dev/mtdblock/0 | awk '{print $1}')" + [ "$MD5" = "0530bfdf00ec155f4182afd70da028c1" ] && { + mtd unlock adam2 + /sbin/adam2patcher /dev/mtdblock/0 + } + rm -f /etc/init.d/S00adam2 /sbin/adam2patcher >&- 2>&- +} diff --git a/package/base-files/ar7-2.4/etc/preinit b/package/base-files/ar7-2.4/etc/preinit new file mode 100755 index 0000000000..5b676ca3ac --- /dev/null +++ b/package/base-files/ar7-2.4/etc/preinit @@ -0,0 +1,11 @@ +#!/bin/sh +export PATH=/bin:/sbin:/usr/bin:/usr/sbin +mount none /proc -t proc + +[ -f /etc/preinit.arch ] && . /etc/preinit.arch +[ -z "$FAILSAFE" ] || { + echo /bin/true > /proc/sys/kernel/hotplug + telnetd -l /bin/login <> /dev/null 2>&1 +} +mount_root ${FAILSAFE:+failsafe} +exec /sbin/init diff --git a/package/base-files/ar7-2.4/sbin/mount_root b/package/base-files/ar7-2.4/sbin/mount_root new file mode 100755 index 0000000000..6b90bdc9cc --- /dev/null +++ b/package/base-files/ar7-2.4/sbin/mount_root @@ -0,0 +1,28 @@ +#!/bin/sh +size=$(awk '/Mem:/ {l=5242880;print((s=$2/2)<l)?$2-l:s}' /proc/meminfo) +mount none /tmp -t tmpfs -o size=$size + +if [ "$1" != "failsafe" ]; then + mtd unlock linux + mount | grep jffs2 >&- + if [ $? = 0 ] ; then + if [ $(cat /proc/mtd | wc -l) = 6 ]; then + mtd erase OpenWrt + else + mount -o remount,rw /dev/root / + fi + else + . /bin/firstboot + echo "switching to jffs2" + mount /dev/mtdblock/4 /jffs -t jffs2 + pivot /jffs /rom || { + echo "jffs2 unusable; using ramdisk" + ramoverlay + } + fi +fi + +mount none /tmp -t tmpfs -o remount,nosuid,nodev,mode=1777 +mkdir -p /dev/pts +mount none /dev/pts -t devpts +mount -t sysfs none /sys 2>&- diff --git a/package/base-files/aruba-2.6/etc/config/network b/package/base-files/aruba-2.6/etc/config/network new file mode 100644 index 0000000000..1d9b55b2d3 --- /dev/null +++ b/package/base-files/aruba-2.6/etc/config/network @@ -0,0 +1,11 @@ +# Network configuration file + +config interface loopback + option ifname lo + option proto static + option ipaddr 127.0.0.1 + option netmask 255.0.0.0 + +config interface lan + option ifname eth0 + option proto dhcp diff --git a/package/base-files/au1000-2.6/etc/config/network b/package/base-files/au1000-2.6/etc/config/network new file mode 100644 index 0000000000..9b65652f06 --- /dev/null +++ b/package/base-files/au1000-2.6/etc/config/network @@ -0,0 +1,14 @@ +# Copyright (C) 2006 OpenWrt.org + +config interface loopback + option ifname lo + option proto static + option ipaddr 127.0.0.1 + option netmask 255.0.0.0 + +config interface lan + option type bridge + option ifname "eth0 ath0" + option proto static + option ipaddr 192.168.1.1 + option netmask 255.255.255.0 diff --git a/package/base-files/au1000-2.6/sbin/mount_root b/package/base-files/au1000-2.6/sbin/mount_root new file mode 100755 index 0000000000..718394ca4c --- /dev/null +++ b/package/base-files/au1000-2.6/sbin/mount_root @@ -0,0 +1,26 @@ +#!/bin/sh +# Copyright (C) 2006 OpenWrt.org + +mount none /proc -t proc +size=$(awk '/Mem:/ {l=5242880;print((s=$2/2)<l)?$2-l:s}' /proc/meminfo) +mount none /tmp -t tmpfs -o size=$size + +if [ "$1" != "failsafe" ]; then + mtd unlock filesystem + mount | grep jffs2 >&- + if [ $? = 0 ] ; then + if [ $(cat /proc/mtd | wc -l) = 6 ]; then + mtd erase filesystem + jffs2root --move + else + mount -o remount,rw /dev/root / + fi + else + . /bin/firstboot + fi +fi + +mount none /tmp -t tmpfs -o remount,nosuid,nodev,mode=1777 +mkdir -p /dev/pts +mount none /dev/pts -t devpts +mount -t sysfs none /sys 2>&- diff --git a/package/base-files/brcm-2.4/bin/firstboot b/package/base-files/brcm-2.4/bin/firstboot new file mode 100755 index 0000000000..b65d3ee98b --- /dev/null +++ b/package/base-files/brcm-2.4/bin/firstboot @@ -0,0 +1,90 @@ +#!/bin/sh +# Copyright (C) 2006 OpenWrt.org + +rom=$(awk '/squashfs/ {print $2}' /proc/mounts) +jffs=$(awk '/jffs2/ {print $2}' /proc/mounts) + +dupe() { # <new_root> <old_root> + cd $1 + echo -n "creating directories... " + { + cd $2 + find . -xdev -type d + echo "./dev ./jffs ./mnt ./proc ./tmp ./sys" + # xdev skips mounted directories + cd $1 + } | xargs mkdir -p + echo "done" + + echo -n "setting up symlinks... " + for file in $(cd $2; find . -xdev -type f;); do + case "$file" in + ./rom/note) ;; #nothing + ./etc/config*|\ + ./etc/resolv.conf|\ + ./usr/lib/ipkg/info/*) cp -af $2/$file $file;; + *) ln -sf /rom/${file#./*} $file;; + esac + done + for file in $(cd $2; find . -xdev -type l;); do + cp -af $2/${file#./*} $file + done + echo "done" +} + +pivot() { # <new_root> <old_root> + mount -o move /proc $1/proc && \ + pivot_root $1 $1$2 && { + mount -o move $2/dev /dev + mount -o move $2/tmp /tmp + mount -o move $2/sys /sys + return 0 + } +} + +mountdp() { # <device> <mount_point> <ignored> <fs> + dev=$1; mnt=$2; shift 2; opt=$* + mount $dev $mnt $opt + dupe $mnt $rom + pivot $mnt /rom +} + +ramoverlay() { + mkdir -p /tmp/root + mountdp /tmp/root /mnt -o bind +} + +[ "${0##*/}" = "firstboot" ] && { + [ -z "$rom" ] && { + echo "You do not have a squashfs partition; aborting" + echo "(firstboot cannot be run on jffs2 based firmwares)" + exit 1 + } + + [ "$1" = "switch2jffs" ] && { + mtd erase OpenWrt + mount -o remount,ro none / # try to avoid fs changing while copying + mount -o bind / /mnt + mount /dev/mtdblock/4 /rom/jffs -t jffs2 + echo -n "copying files ... " + cp -a /mnt/* /rom/jffs + umount /mnt + echo "done" + pivot /rom /mnt + mount -o move /mnt /tmp/root + pivot /jffs /rom + jffs2root --clean + exit 0 + } + + # script run manually + [ \! -z "$jffs" ] && { + echo "firstboot has already been run" + echo "jffs2 partition is mounted, only resetting files" + dupe $jffs $rom + exit 0 + } + + mtd erase OpenWrt + mountdp /dev/mtdblock/4 /jffs -t jffs2 +} diff --git a/package/base-files/brcm-2.4/etc/config/wireless b/package/base-files/brcm-2.4/etc/config/wireless new file mode 100644 index 0000000000..9dc4945e07 --- /dev/null +++ b/package/base-files/brcm-2.4/etc/config/wireless @@ -0,0 +1,14 @@ +# Copyright (C) 2006 OpenWrt.org + +config wifi-device wl0 + option type broadcom + option channel 5 + +config wifi-iface + option device wl0 + option mode ap + option ssid OpenWrt + option hidden 0 + option encryption none + + diff --git a/package/base-files/brcm-2.4/etc/init.d/S05netconfig b/package/base-files/brcm-2.4/etc/init.d/S05netconfig new file mode 100755 index 0000000000..71092da559 --- /dev/null +++ b/package/base-files/brcm-2.4/etc/init.d/S05netconfig @@ -0,0 +1,87 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org + +start() { + [ -e /etc/config/network ] && exit 0 + + mkdir -p /etc/config + + ( + if grep -E 'mtd0: 000(6|a)0000' /proc/mtd 2>&- >&-; then + # WGT634u + echo boardtype=wgt634u + else + strings /dev/mtdblock/3 + fi + ) | awk ' + function p(cfgname, name) { + if (c[name] != "") print " option " cfgname " \"" c[name] "\"" + } + + BEGIN { + FS="=" + c["lan_ifname"]="eth0.0 wl0" + c["wan_ifname"]="eth0.1" + c["vlan0ports"]="1 2 3 4 5*" + c["vlan1ports"]="0 5" + } + + ($1 == "boardnum") || ($1 == "boardtype") || ($1 == "boardflags") { + nvram[$1] = $2 + } + + END { + # v1 hardware + if (nvram["boardtype"] == "bcm94710dev") { + # Asus WL-500g + if (nvram["boardnum"] == "asusX") { + c["lan_ifname"]="eth0 eth1 wl0" # FIXME + c["wan_ifname"]="" + } + } + if (nvram["boardtype"] == "wgt634u") { + c["vlan0ports"] = "0 1 2 3 5*" + c["vlan1ports"] = "4 5" + c["lan_ifname"] = "eth0.0 ath0" + } + if ((nvram["boardtype"] == "0x0467") || (nvram["boardtype"] == "0x042f")) { + c["vlan0ports"] = "0 1 2 3 5*" + c["vlan1ports"] = "4 5" + } + + # WAP54G + if ((nvram["boardnum"] == "2") || \ + (nvram["boardnum"] == "1024")) { + c["lan_ifname"]="eth0 wl0" + c["wan_ifname"]="" + } + + print "#### VLAN configuration " + print "config switch eth0" + p("vlan0", "vlan0ports") + p("vlan1", "vlan1ports") + print "" + print "" + print "#### Loopback configuration" + print "config interface loopback" + print " option ifname \"lo\"" + print " option proto static" + print " option ipaddr 127.0.0.1" + print " option netmask 255.0.0.0" + print "" + print "" + print "#### LAN configuration" + print "config interface lan" + print " option type bridge" + p("ifname", "lan_ifname") + print " option proto static" + print " option ipaddr 192.168.1.1" + print " option netmask 255.255.255.0" + print "" + print "" + print "#### WAN configuration" + print "config interface wan" + p("ifname", "wan_ifname") + print " option proto dhcp" + }' > /etc/config/network +} diff --git a/package/base-files/brcm-2.4/etc/preinit b/package/base-files/brcm-2.4/etc/preinit new file mode 100755 index 0000000000..fb13e107e5 --- /dev/null +++ b/package/base-files/brcm-2.4/etc/preinit @@ -0,0 +1,13 @@ +#!/bin/sh +# Copyright (C) 2006 OpenWrt.org + +export PATH=/bin:/sbin:/usr/bin:/usr/sbin +mount none /proc -t proc + +[ -f /etc/preinit.arch ] && . /etc/preinit.arch +[ -z "$FAILSAFE" ] || { + echo /bin/true > /proc/sys/kernel/hotplug + telnetd -l /bin/login <> /dev/null 2>&1 +} +mount_root ${FAILSAFE:+failsafe} +exec /sbin/init diff --git a/package/base-files/brcm-2.4/sbin/mount_root b/package/base-files/brcm-2.4/sbin/mount_root new file mode 100755 index 0000000000..ec82cd40fb --- /dev/null +++ b/package/base-files/brcm-2.4/sbin/mount_root @@ -0,0 +1,34 @@ +#!/bin/sh +# Copyright (C) 2006 OpenWrt.org + +is_dirty() { + grep Broadcom /proc/cpuinfo >&- || return 1 + OFFSET="$(($(hexdump -v /dev/mtdblock/1 -s 20 -n 2 -e '"%d"')-1))" + return $(hexdump -v /dev/mtdblock/1 -s $OFFSET -n 1 -e '"%d"') +} + +size=$(awk '/Mem:/ {l=5242880;print((s=$2/2)<l)?$2-l:s}' /proc/meminfo) +mount none /tmp -t tmpfs -o size=$size + +if [ "$1" != "failsafe" ]; then + mtd unlock linux + mount | grep jffs2 >&- + if [ $? = 0 ] ; then + mount -o remount,rw /dev/root / + else + . /bin/firstboot + is_dirty + [ $? != 0 ] && { + echo "switching to jffs2" + mount /dev/mtdblock/4 /jffs -t jffs2 + pivot /jffs /rom + } || { + echo "jffs2 unusable; using ramdisk" + ramoverlay + } + fi +fi + +mount none /tmp -t tmpfs -o remount,nosuid,nodev,mode=1777 +mkdir -p /dev/pts +mount none /dev/pts -t devpts diff --git a/package/base-files/brcm-2.6/bin/firstboot b/package/base-files/brcm-2.6/bin/firstboot new file mode 100755 index 0000000000..d37ce4f90b --- /dev/null +++ b/package/base-files/brcm-2.6/bin/firstboot @@ -0,0 +1,90 @@ +#!/bin/sh +# Copyright (C) 2006 OpenWrt.org + +rom=$(awk '/squashfs/ {print $2}' /proc/mounts) +jffs=$(awk '/jffs2/ {print $2}' /proc/mounts) + +dupe() { # <new_root> <old_root> + cd $1 + echo -n "creating directories... " + { + cd $2 + find . -xdev -type d + echo "./dev ./jffs ./mnt ./proc ./tmp ./sys" + # xdev skips mounted directories + cd $1 + } | xargs mkdir -p + echo "done" + + echo -n "setting up symlinks... " + for file in $(cd $2; find . -xdev -type f;); do + case "$file" in + ./rom/note) ;; #nothing + ./etc/config*|\ + ./etc/resolv.conf|\ + ./usr/lib/ipkg/info) cp -af $2/$file $file;; + *) ln -sf /rom/${file#./*} $file;; + esac + done + for file in $(cd $2; find . -xdev -type l;); do + cp -af $2/${file#./*} $file + done + echo "done" +} + +pivot() { # <new_root> <old_root> + mount -o move /proc $1/proc && \ + pivot_root $1 $1$2 && { + mount -o move $2/dev /dev + mount -o move $2/tmp /tmp + mount -o move $2/sys /sys + return 0 + } +} + +mountdp() { # <device> <mount_point> <ignored> <fs> + dev=$1; mnt=$2; shift 2; opt=$* + mount $dev $mnt $opt + dupe $mnt $rom + pivot $mnt /rom +} + +ramoverlay() { + mkdir -p /tmp/root + mountdp /tmp/root /mnt -o bind +} + +[ "${0##*/}" = "firstboot" ] && { + [ -z "$rom" ] && { + echo "You do not have a squashfs partition; aborting" + echo "(firstboot cannot be run on jffs2 based firmwares)" + exit 1 + } + + [ "$1" = "switch2jffs" ] && { + mtd erase OpenWrt + mount -o remount,ro none / # try to avoid fs changing while copying + mount -o bind / /mnt + mount /dev/mtdblock/4 /rom/jffs -t jffs2 + echo -n "copying files ... " + cp -a /mnt/* /rom/jffs + umount /mnt + echo "done" + pivot /rom /mnt + mount -o move /mnt /tmp/root + pivot /jffs /rom + jffs2root --clean + exit 0 + } + + # script run manually + [ \! -z "$jffs" ] && { + echo "firstboot has already been run" + echo "jffs2 partition is mounted, only resetting files" + dupe $jffs $rom + exit 0 + } + + mtd erase OpenWrt + mountdp /dev/mtdblock/4 /jffs -t jffs2 +} diff --git a/package/base-files/brcm-2.6/etc/init.d/S05netconfig b/package/base-files/brcm-2.6/etc/init.d/S05netconfig new file mode 100755 index 0000000000..e37633e18f --- /dev/null +++ b/package/base-files/brcm-2.6/etc/init.d/S05netconfig @@ -0,0 +1,87 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org + +start() { + [ -e /etc/config/network ] && exit 0 + + mkdir -p /etc/config + + ( + if grep -E 'mtd0: 000(6|a)0000' /proc/mtd 2>&- >&-; then + # WGT634u + echo boardtype=wgt634u + else + strings /dev/mtdblock/3 + fi + ) | awk ' + function p(cfgname, name) { + if (c[name] != "") print " option " cfgname " \"" c[name] "\"" + } + + BEGIN { + FS="=" + c["lan_ifname"]="eth0.0 wl0" + c["wan_ifname"]="eth0.1" + c["vlan0ports"]="1 2 3 4 5*" + c["vlan1ports"]="0 5" + } + + ($1 == "boardnum") || ($1 == "boardtype") || ($1 == "boardflags") { + nvram[$1] = $2 + } + + END { + # v1 hardware + if (nvram["boardtype"] == "bcm94710dev") { + # Asus WL-500g + if (nvram["boardnum"] == "asusX") { + c["lan_ifname"]="eth0 eth1 wl0" # FIXME + c["wan_ifname"]="" + } + } + if (nvram["boardtype"] == "wgt634u") { + c["vlan0ports"] = "0 1 2 3 5*" + c["vlan1ports"] = "4 5" + c["lan_ifname"] = "eth0.0 ath0" + } + if ((nvram["boardtype"] == "0x0467") || (nvram["boardtype"] == "0x042f")) { + c["vlan0ports"] = "0 1 2 3 5*" + c["vlan1ports"] = "4 5" + } + + # WAP54G + if ((nvram["boardnum"] == "2") || \ + (nvram["boardnum"] == "1024")) { + c["lan_ifname"]="eth0 wl0" + c["wan_ifname"]="" + } + + print "#### VLAN configuration " + print "config switch eth0" + p("vlan0", "vlan0ports") + p("vlan1", "vlan1ports") + print "" + print "" + print "#### Loopback configuration" + print "config interface loopback" + print " option ifname \"lo\"" + print " option proto static" + print " option ipaddr 127.0.0.1" + print " option netmask 255.0.0.0" + print "" + print "" + print "#### LAN configuration" + print "config interface lan" + print " option type bridge" + p("ifname", "lan_ifname") + print " option proto static" + print " option ipaddr 192.168.1.1" + print " option netmask 255.255.255.0" + print "" + print "" + print "#### WAN configuration" + print "config interface wan" + p("ifname", "wan_ifname") + print " option proto dhcp" + }' > /etc/config/network +} diff --git a/package/base-files/brcm-2.6/etc/preinit b/package/base-files/brcm-2.6/etc/preinit new file mode 100755 index 0000000000..fb13e107e5 --- /dev/null +++ b/package/base-files/brcm-2.6/etc/preinit @@ -0,0 +1,13 @@ +#!/bin/sh +# Copyright (C) 2006 OpenWrt.org + +export PATH=/bin:/sbin:/usr/bin:/usr/sbin +mount none /proc -t proc + +[ -f /etc/preinit.arch ] && . /etc/preinit.arch +[ -z "$FAILSAFE" ] || { + echo /bin/true > /proc/sys/kernel/hotplug + telnetd -l /bin/login <> /dev/null 2>&1 +} +mount_root ${FAILSAFE:+failsafe} +exec /sbin/init diff --git a/package/base-files/brcm-2.6/sbin/mount_root b/package/base-files/brcm-2.6/sbin/mount_root new file mode 100755 index 0000000000..e3bdd3655c --- /dev/null +++ b/package/base-files/brcm-2.6/sbin/mount_root @@ -0,0 +1,35 @@ +#!/bin/sh +# Copyright (C) 2006 OpenWrt.org + +is_dirty() { + grep Broadcom /proc/cpuinfo >&- || return 1 + OFFSET="$(($(hexdump -v /dev/mtdblock/1 -s 20 -n 2 -e '"%d"')-1))" + return $(hexdump -v /dev/mtdblock/1 -s $OFFSET -n 1 -e '"%d"') +} + +size=$(awk '/Mem:/ {l=5242880;print((s=$2/2)<l)?$2-l:s}' /proc/meminfo) +mount none /tmp -t tmpfs -o size=$size + +if [ "$1" != "failsafe" ]; then + mtd unlock linux + mount | grep jffs2 >&- + if [ $? = 0 ] ; then + mount -o remount,rw /dev/root / + else + . /bin/firstboot + is_dirty + [ $? != 0 ] && { + echo "switching to jffs2" + mount /dev/mtdblock/4 /jffs -t jffs2 + pivot /jffs /rom + } || { + echo "jffs2 unusable; using ramdisk" + ramoverlay + } + fi +fi + +mount none /tmp -t tmpfs -o remount,nosuid,nodev,mode=1777 +mkdir -p /dev/pts +mount none /dev/pts -t devpts +mount -t sysfs none /sys 2>&- diff --git a/package/base-files/default/bin/ipcalc b/package/base-files/default/bin/ipcalc new file mode 100755 index 0000000000..e8efa6b96c --- /dev/null +++ b/package/base-files/default/bin/ipcalc @@ -0,0 +1,32 @@ +#!/bin/sh + +awk -f /usr/lib/common.awk -f - $* <<EOF +BEGIN { + ipaddr=ip2int(ARGV[1]) + netmask=ip2int(ARGV[2]) + network=and(ipaddr,netmask) + broadcast=or(network,compl(netmask)) + + start=or(network,and(ip2int(ARGV[3]),compl(netmask))) + limit=network+1 + if (start<limit) start=limit + + end=start+ARGV[4] + limit=or(network,compl(netmask))-1 + if (end>limit) end=limit + + print "IP="int2ip(ipaddr) + print "NETMASK="int2ip(netmask) + print "BROADCAST="int2ip(broadcast) + print "NETWORK="int2ip(network) + print "PREFIX="32-bitcount(compl(netmask)) + + # range calculations: + # ipcalc <ip> <netmask> <start> <num> + + if (ARGC > 3) { + print "START="int2ip(start) + print "END="int2ip(end-1) + } +} +EOF diff --git a/package/base-files/default/bin/login b/package/base-files/default/bin/login new file mode 100755 index 0000000000..ff5d3660e4 --- /dev/null +++ b/package/base-files/default/bin/login @@ -0,0 +1,18 @@ +#!/bin/sh +# Copyright (C) 2006 OpenWrt.org + +grep '^root:[^!]' /etc/passwd >&- 2>&- +[ "$?" = "0" -a -z "$FAILSAFE" ] && +{ + echo "Login failed." + exit 0 +} || { +cat << EOF + === IMPORTANT ============================ + Use 'passwd' to set your login password + this will disable telnet and enable SSH + ------------------------------------------ +EOF +} + +exec /bin/ash --login diff --git a/package/base-files/default/bin/uci b/package/base-files/default/bin/uci new file mode 100755 index 0000000000..7f43549471 --- /dev/null +++ b/package/base-files/default/bin/uci @@ -0,0 +1,159 @@ +#!/bin/sh +# Shell script for interacting with config files +# +# Copyright (C) 2006 by Fokus Fraunhofer <carsten.tittel@fokus.fraumhofer.de> +# Copyright (C) 2006 by Felix Fietkau <nbd@openwrt.org> +# +# 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 +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +. /etc/functions.sh +include /lib/config + +do_get() { + [ $# -ne 3 ] && { + uci_usage get + exit 1 + } + local PACKAGE="$1" + local CONFIG="$2" + local OPTION="$3" + + uci_load "$PACAKGE" + config_get "$CONFIG" "$OPTION" +} + +do_set() { + [ $# -ne 4 ] && { + uci_usage set + exit 1 + } + uci_set "$@" +} + +do_add() { + [ $# -ne 3 ] && { + uci_usage add + exit 1 + } + uci_add "$@" +} + +do_rename() { + [ $# -ne 3 ] && { + uci_usage rename + exit 1 + } + uci_rename "$@" +} + +do_remove() { + [ $# -ne 3 -a $# -ne 2 ] && { + uci_usage rename + exit 1 + } + uci_remove "$@" +} + +do_commit() { + [ $# -ne 1 ] && { + uci_usage commit + exit 1 + } + uci_commit "$1" +} + +do_show() { + [ $# -gt 2 -o $# -lt 1 ] && { + uci_usage show + exit 1 + } + + PACKAGE="$1" + CONFIG="$2" + SECTION="" + + config_cb() { + if [ -z "$CONFIG" -o "$CONFIG" = "$2" ]; then + append SECTION "$2" + option_cb() { + append "${CONFIG_SECTION}_VARS" "$1" + } + else + option_cb() { + return 0 + } + fi + } + + uci_load "$PACKAGE" + + for section in $SECTION; do + config_get type "$section" TYPE + [ -z "$type" ] && continue + echo "@$section=$type" + eval "VARS=\"\${${section}_VARS}\"" + for var in $VARS; do + config_get val "$section" "$var" + [ -n "$val" ] && { + echo "${section}.${var}=${val}" + config_set "$section" "$var" "" + } + done + config_set "$section" TYPE "" + done +} + +uci_usage() { + case "$1" in + show) echo "$0 show <package> [<config>]";; + get) echo "$0 get <package> <config> <option>";; + set) echo "$0 set <package> <config> <option> <value>";; + add) echo "$0 add <package> <type> <config>";; + del) echo "$0 del <package> <config> [<option>]";; + rename) echo "$0 rename <package> <config> <name>";; + commit) echo "$0 commit <package>";; + *) + echo "Syntax: $0 <command> <arguments...>" + echo + uci_usage show + uci_usage get + uci_usage set + uci_usage add + uci_usage del + uci_usage rename + uci_usage commit + echo + exit 1 + ;; + esac +} + +if [ $# -eq 0 ] ; then + uci_usage + exit 0 +fi +CMD="$1" +shift +case "$CMD" in + set) do_set "$@";; + add) do_add "$@";; + del) do_remove "$@";; + rename) do_rename "$@";; + get) do_get "$@";; + show) do_show "$@";; + commit) do_commit "$@";; + *) uci_usage;; +esac +exit 0 diff --git a/package/base-files/default/etc/banner b/package/base-files/default/etc/banner new file mode 100644 index 0000000000..c2fbc12680 --- /dev/null +++ b/package/base-files/default/etc/banner @@ -0,0 +1,10 @@ + _______ ________ __ + | |.-----.-----.-----.| | | |.----.| |_ + | - || _ | -__| || | | || _|| _| + |_______|| __|_____|__|__||________||__| |____| + |__| W I R E L E S S F R E E D O M + KAMIKAZE (bleeding edge, $R) ------------------- + * 10 oz Vodka Shake well with ice and strain + * 10 oz Triple sec mixture into 10 shot glasses. + * 10 oz lime juice Salute! + --------------------------------------------------- diff --git a/package/base-files/default/etc/config/network b/package/base-files/default/etc/config/network new file mode 100644 index 0000000000..1d5ded3728 --- /dev/null +++ b/package/base-files/default/etc/config/network @@ -0,0 +1,13 @@ +# Copyright (C) 2006 OpenWrt.org + +config interface loopback + option ifname lo + option proto static + option ipaddr 127.0.0.1 + option netmask 255.0.0.0 + +config interface lan + option ifname eth0 + option proto static + option ipaddr 192.168.1.1 + option netmask 255.255.255.0 diff --git a/package/base-files/default/etc/functions.sh b/package/base-files/default/etc/functions.sh new file mode 100755 index 0000000000..9c3057ed00 --- /dev/null +++ b/package/base-files/default/etc/functions.sh @@ -0,0 +1,119 @@ +#!/bin/sh +# Copyright (C) 2006 OpenWrt.org +# Copyright (C) 2006 Fokus Fraunhofer <carsten.tittel@fokus.fraunhofer.de> + +alias debug=${DEBUG:-:} + +# newline +N=" +" + +_C=0 + +# valid interface? +if_valid () ( + ifconfig "$1" >&- 2>&- || + [ "${1%%[0-9]}" = "br" ] || + { debug "# missing interface '$1' ignored"; false; } +) + +hotplug_dev() { + env -i ACTION=$1 INTERFACE=$2 /sbin/hotplug net +} + +append() { + local var="$1" + local value="$2" + local sep="${3:- }" + eval "export ${var}=\"\${${var}:+\${${var}}${value:+$sep}}\$value\"" +} + +reset_cb() { + config_cb() { + return 0 + } + option_cb() { + return 0 + } +} +reset_cb + +config () { + local cfgtype="$1" + local name="$2" + _C=$(($_C + 1)) + name="${name:-cfg${_C}}" + config_cb "$cfgtype" "$name" + export CONFIG_SECTION="$name" + export CONFIG_${CONFIG_SECTION}_TYPE="$cfgtype" +} + +option () { + local varname="$1"; shift + export CONFIG_${CONFIG_SECTION}_${varname}="$*" + option_cb "$varname" "$*" +} + +config_rename() { + local OLD="$1" + local NEW="$2" + local oldsetting + local newvar + + [ -z "$OLD" -o -z "$NEW" ] && return + for oldsetting in `set | grep ^CONFIG_${OLD}_ | \ + sed -e 's/\(.*\)=.*$/\1/'` ; do + newvar="CONFIG_${NEW}_${oldsetting##CONFIG_${OLD}_}" + eval "${newvar}=\${$oldsetting}" + unset "$oldsetting" + done + [ "$CONFIG_SECTION" = "$OLD" ] && CONFIG_SECTION="$NEW" +} + +config_unset() { + config_set "$1" "$2" "" +} + +config_clear() { + [ -z "$CONFIG_SECTION" ] && return + for oldsetting in `set | grep ^CONFIG_${CONFIG_SECTION}_ | \ + sed -e 's/\(.*\)=.*$/\1/'` ; do + unset $oldsetting + done + unset CONFIG_SECTION +} + +config_load() { + local DIR="./" + _C=0 + [ \! -e "$1" -a -e "/etc/config/$1" ] && { + DIR="/etc/config/" + } + [ -e "$DIR$1" ] && { + CONFIG_FILENAME="$DIR$1" + . ${CONFIG_FILENAME} + } || return 1 + ${CD:+cd -} >/dev/null + ${CONFIG_SECTION:+config_cb} +} + +config_get() { + case "$3" in + "") eval "echo \"\${CONFIG_${1}_${2}}\"";; + *) eval "$1=\"\${CONFIG_${2}_${3}}\"";; + esac +} + +config_set() { + export CONFIG_${1}_${2}="${3}" +} + +load_modules() { + sed 's/^[^#]/insmod &/' $* | ash 2>&- || : +} + +include() { + for file in $(ls $1/*.sh 2>/dev/null); do + . $file + done +} diff --git a/package/base-files/default/etc/group b/package/base-files/default/etc/group new file mode 100644 index 0000000000..c4e77f316a --- /dev/null +++ b/package/base-files/default/etc/group @@ -0,0 +1,2 @@ +root:x:0: +nogroup:x:65534: diff --git a/package/base-files/default/etc/hosts b/package/base-files/default/etc/hosts new file mode 100644 index 0000000000..ce138ec1e6 --- /dev/null +++ b/package/base-files/default/etc/hosts @@ -0,0 +1 @@ +127.0.0.1 localhost OpenWrt diff --git a/package/base-files/default/etc/hotplug.d/block/01-mount b/package/base-files/default/etc/hotplug.d/block/01-mount new file mode 100755 index 0000000000..b6275e5a28 --- /dev/null +++ b/package/base-files/default/etc/hotplug.d/block/01-mount @@ -0,0 +1,26 @@ +#!/bin/sh +# Copyright (C) 2006 OpenWrt.org + +DEV=${DEVPATH##*/} +{ +echo "ACTION=$ACTION DEVPATH=$DEVPATH $0 $*" +case "$ACTION" in +add) + echo -ne "waiting for $DEV" + while [ ! -b /dev/$DEV ]; do { + echo -ne "." + sleep 1 + time=$((time+1)); [ $time -gt 10 ] && break + }; done + + [ ${DEV%%[0-9]} != ${DEV} ] && { + mkdir -p /tmp/$DEV + mount /dev/$DEV /tmp/$DEV -t auto -o sync + } + ;; +remove) + umount /tmp/$DEV + rm -rf /dev/$DEV /tmp/$DEV + ;; +esac +} 2>&1 | logger diff --git a/package/base-files/default/etc/hotplug.d/net/10-net b/package/base-files/default/etc/hotplug.d/net/10-net new file mode 100644 index 0000000000..4e5c3041b5 --- /dev/null +++ b/package/base-files/default/etc/hotplug.d/net/10-net @@ -0,0 +1,28 @@ +# Copyright (C) 2006 OpenWrt.org + +include /lib/network + +addif() { + scan_interfaces + setup_interface "$INTERFACE" + + # find all vlan configurations for this interface and set them up as well + for ifc in $interfaces; do + config_get iftype "$ifc" type + config_get ifs "$ifc" device + for dev in $ifs; do + [ "${dev%%\.*}" = "$INTERFACE" -a "$dev" != "$INTERFACE" ] && { + add_vlan "$dev" + } + done + done +} + +case "$ACTION" in + add|register) + case "$PHYSDEVDRIVER" in + natsemi) sleep 1;; + esac + addif + ;; +esac diff --git a/package/base-files/default/etc/hotplug.d/usb/01-ln b/package/base-files/default/etc/hotplug.d/usb/01-ln new file mode 100755 index 0000000000..f9eda02988 --- /dev/null +++ b/package/base-files/default/etc/hotplug.d/usb/01-ln @@ -0,0 +1,33 @@ +#!/bin/sh +# Copyright (C) 2006 OpenWrt.org + +case "$ACTION" in +add) + [ -f /sys/${DEVPATH}/idVendor -a "$(cat /sys/${DEVPATH}/idVendor)" -ne "0000" ] && { + cd /sys/${DEVPATH} + + NUM=${DEVPATH##*/} + HOST=$(find ${NUM}:*/host* -type d) + HOST=${HOST##*/host} + + echo -ne "waiting for disk" + + while [ ! -d "/dev/scsi/host${HOST}/bus0/target0/lun0" ]; do { + echo -ne "." + sleep 1; + time=$((time+1)); [ $time -gt 10 ] && break + }; done + echo + + cd /sys/bus/scsi/devices/${HOST}\:0\:0\:0 + for BLOCK in block:* ; do { + cd ${BLOCK} + BLOCK=${BLOCK##block\:} + ln -sf /dev/scsi/host${HOST}/bus0/target0/lun0/disc /dev/${BLOCK} + for DEV in ${BLOCK}*; do { + ln -sf /dev/scsi/host${HOST}/bus0/target0/lun0/part${DEV##$BLOCK} /dev/$DEV + }; done + }; done + } 2>&1 | logger + ;; +esac diff --git a/package/base-files/default/etc/init.d/S10boot b/package/base-files/default/etc/init.d/S10boot new file mode 100755 index 0000000000..77b5ca72d5 --- /dev/null +++ b/package/base-files/default/etc/init.d/S10boot @@ -0,0 +1,25 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org + +start() { + [ -f /proc/mounts ] || /sbin/mount_root + [ -f /proc/jffs2_bbc ] && echo "S" > /proc/jffs2_bbc + vconfig set_name_type DEV_PLUS_VID_NO_PAD + + HOSTNAME=${wan_hostname%%.*} + echo ${HOSTNAME:=OpenWrt}>/proc/sys/kernel/hostname + + mkdir -p /var/run + mkdir -p /var/log + mkdir -p /var/lock + touch /var/log/wtmp + touch /var/log/lastlog + [ "$FAILSAFE" = "true" ] && touch /tmp/.failsafe + + # manually trigger hotplug before loading modules + for iface in $(awk -F: '/:/ {print $1}' /proc/net/dev); do + /usr/bin/env -i ACTION=add INTERFACE="$iface" /sbin/hotplug net + done + + load_modules /etc/modules /etc/modules.d/* +} diff --git a/package/base-files/default/etc/init.d/S40network b/package/base-files/default/etc/init.d/S40network new file mode 100755 index 0000000000..be045045e7 --- /dev/null +++ b/package/base-files/default/etc/init.d/S40network @@ -0,0 +1,11 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org + +start() { + setup_switch() { return 0; } + + include /lib/network + setup_switch + /sbin/wifi +} + diff --git a/package/base-files/default/etc/init.d/S50httpd b/package/base-files/default/etc/init.d/S50httpd new file mode 100755 index 0000000000..a05b10c094 --- /dev/null +++ b/package/base-files/default/etc/init.d/S50httpd @@ -0,0 +1,10 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org + +start() { + [ -d /www ] && httpd -p 80 -h /www -r OpenWrt +} + +stop() { + killall httpd +} diff --git a/package/base-files/default/etc/init.d/S50telnet b/package/base-files/default/etc/init.d/S50telnet new file mode 100755 index 0000000000..228eac2b62 --- /dev/null +++ b/package/base-files/default/etc/init.d/S50telnet @@ -0,0 +1,10 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org + +start() { + if awk -F: '/^root:/ && $2 !~ /\!/ {exit 1}' /etc/passwd 2>/dev/null; then telnetd -l /bin/login; fi +} + +stop() { + killall telnetd +} diff --git a/package/base-files/default/etc/init.d/S60cron b/package/base-files/default/etc/init.d/S60cron new file mode 100755 index 0000000000..a450c36dd2 --- /dev/null +++ b/package/base-files/default/etc/init.d/S60cron @@ -0,0 +1,12 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org + +start () { + mkdir -p /var/spool/cron + ln -s /etc/crontabs /var/spool/cron/crontabs + crond -c /etc/crontabs +} + +stop() { + killall crond +} diff --git a/package/base-files/default/etc/init.d/rcS b/package/base-files/default/etc/init.d/rcS new file mode 100755 index 0000000000..7fae7f5b05 --- /dev/null +++ b/package/base-files/default/etc/init.d/rcS @@ -0,0 +1,26 @@ +#!/bin/sh +# Copyright (C) 2006 OpenWrt.org + +${FAILSAFE:+exit} + +# FIXME: add logging configuration +#[ -f /etc/config/network ] && . /etc/config/network +#eval $(ipcalc "$log_ipaddr") +#[ "$log_ipaddr" = "$IP" ] || log_ipaddr="" +syslogd -C 16 #${log_ipaddr:+-L -R $log_ipaddr} +klogd + +( + for i in /etc/init.d/S*; do + $i start 2>&1 + done + + sysctl -p >&- + + # automagically run firstboot + { mount|grep "on / type tmpfs" 1>&-; } && { + lock /tmp/.switch2jffs + firstboot switch2jffs + lock -u /tmp/.switch2jffs + } +) | logger -s -p 6 -t '' & diff --git a/package/base-files/default/etc/inittab b/package/base-files/default/etc/inittab new file mode 100644 index 0000000000..39e134cb16 --- /dev/null +++ b/package/base-files/default/etc/inittab @@ -0,0 +1,3 @@ +::sysinit:/etc/init.d/rcS +tts/0::askfirst:/bin/ash --login +#tts/1::askfirst:/bin/ash --login diff --git a/package/base-files/default/etc/ipkg.conf b/package/base-files/default/etc/ipkg.conf new file mode 100644 index 0000000000..2931d2cf80 --- /dev/null +++ b/package/base-files/default/etc/ipkg.conf @@ -0,0 +1,3 @@ +src snapshots http://openwrt.org/downloads/snapshots/$S/packages +dest root / +dest ram /tmp diff --git a/package/base-files/default/etc/nvram.sh b/package/base-files/default/etc/nvram.sh new file mode 100644 index 0000000000..ddbd88b52f --- /dev/null +++ b/package/base-files/default/etc/nvram.sh @@ -0,0 +1,19 @@ +#!/bin/ash +# Copyright (C) 2006 OpenWrt.org + + +# allow env to override nvram +nvram () { + if [ -x /usr/sbin/nvram ]; then + case $1 in + get) eval "echo \${$2:-\$(/usr/sbin/nvram get $2)}";; + *) /usr/sbin/nvram $*;; + esac + else + case $1 in + get) eval "echo \${$2:-\${DEFAULT_$2}}";; + *);; + esac + fi +} + diff --git a/package/base-files/default/etc/passwd b/package/base-files/default/etc/passwd new file mode 100644 index 0000000000..3b660a0d4e --- /dev/null +++ b/package/base-files/default/etc/passwd @@ -0,0 +1,2 @@ +root:!:0:0:root:/tmp:/bin/ash +nobody:*:65534:65534:nobody:/var:/bin/false diff --git a/package/base-files/default/etc/profile b/package/base-files/default/etc/profile new file mode 100644 index 0000000000..ae514b0924 --- /dev/null +++ b/package/base-files/default/etc/profile @@ -0,0 +1,12 @@ +#!/bin/sh +[ -f /etc/banner ] && cat /etc/banner + +export PATH=/bin:/sbin:/usr/bin:/usr/sbin +export PS1='\u@\h:\w\$ ' + +alias more=less +[ -x /usr/bin/vim ] || alias vim=vi + +arp() { cat /proc/net/arp; } +ldd() { LD_TRACE_LOADED_OBJECTS=1 $*; } +reboot() { ifdown wan 2>&1 >/dev/null ; /sbin/reboot; } diff --git a/package/base-files/default/etc/protocols b/package/base-files/default/etc/protocols new file mode 100644 index 0000000000..53fecb6d3c --- /dev/null +++ b/package/base-files/default/etc/protocols @@ -0,0 +1,56 @@ +# Internet (IP) protocols +# +# Updated from http://www.iana.org/assignments/protocol-numbers and other +# sources. +# New protocols will be added on request if they have been officially +# assigned by IANA and are not historical. +# If you need a huge list of used numbers please install the nmap package. + +ip 0 IP # internet protocol, pseudo protocol number +#hopopt 0 HOPOPT # IPv6 Hop-by-Hop Option [RFC1883] +icmp 1 ICMP # internet control message protocol +igmp 2 IGMP # Internet Group Management +ggp 3 GGP # gateway-gateway protocol +ipencap 4 IP-ENCAP # IP encapsulated in IP (officially ``IP'') +st 5 ST # ST datagram mode +tcp 6 TCP # transmission control protocol +egp 8 EGP # exterior gateway protocol +igp 9 IGP # any private interior gateway (Cisco) +pup 12 PUP # PARC universal packet protocol +udp 17 UDP # user datagram protocol +hmp 20 HMP # host monitoring protocol +xns-idp 22 XNS-IDP # Xerox NS IDP +rdp 27 RDP # "reliable datagram" protocol +iso-tp4 29 ISO-TP4 # ISO Transport Protocol class 4 [RFC905] +xtp 36 XTP # Xpress Transfer Protocol +ddp 37 DDP # Datagram Delivery Protocol +idpr-cmtp 38 IDPR-CMTP # IDPR Control Message Transport +ipv6 41 IPv6 # Internet Protocol, version 6 +ipv6-route 43 IPv6-Route # Routing Header for IPv6 +ipv6-frag 44 IPv6-Frag # Fragment Header for IPv6 +idrp 45 IDRP # Inter-Domain Routing Protocol +rsvp 46 RSVP # Reservation Protocol +gre 47 GRE # General Routing Encapsulation +esp 50 IPSEC-ESP # Encap Security Payload [RFC2046] +ah 51 IPSEC-AH # Authentication Header [RFC2402] +skip 57 SKIP # SKIP +ipv6-icmp 58 IPv6-ICMP # ICMP for IPv6 +ipv6-nonxt 59 IPv6-NoNxt # No Next Header for IPv6 +ipv6-opts 60 IPv6-Opts # Destination Options for IPv6 +rspf 73 RSPF CPHB # Radio Shortest Path First (officially CPHB) +vmtp 81 VMTP # Versatile Message Transport +eigrp 88 EIGRP # Enhanced Interior Routing Protocol (Cisco) +ospf 89 OSPFIGP # Open Shortest Path First IGP +ax.25 93 AX.25 # AX.25 frames +ipip 94 IPIP # IP-within-IP Encapsulation Protocol +etherip 97 ETHERIP # Ethernet-within-IP Encapsulation [RFC3378] +encap 98 ENCAP # Yet Another IP encapsulation [RFC1241] +# 99 # any private encryption scheme +pim 103 PIM # Protocol Independent Multicast +ipcomp 108 IPCOMP # IP Payload Compression Protocol +vrrp 112 VRRP # Virtual Router Redundancy Protocol +l2tp 115 L2TP # Layer Two Tunneling Protocol [RFC2661] +isis 124 ISIS # IS-IS over IPv4 +sctp 132 SCTP # Stream Control Transmission Protocol +fc 133 FC # Fibre Channel + diff --git a/package/base-files/default/etc/rc.common b/package/base-files/default/etc/rc.common new file mode 100755 index 0000000000..20d1efa402 --- /dev/null +++ b/package/base-files/default/etc/rc.common @@ -0,0 +1,73 @@ +#!/bin/sh +. /etc/functions.sh + +start() { + return 0 +} + +stop() { + return 0 +} + +reload() { + return 1 +} + +restart() { + stop + start +} + +boot() { + start +} + +shutdown() { + return 0 +} + +disable() { + rm -f /etc/rc.d/${initscript##*/} +} + +enable() { + disable + ln -s /etc/init.d/${initscript##*/} /etc/rc.d/${initscript##*/} +} + +depends() { + return 0 +} + +help() { + cat <<EOF +Syntax: $initscript [command] + +Available commands: + start Start the service + stop Stop the service + restart Restart the service + reload Reload configuration files (or restart if that fails) +$EXTRA_HELP +EOF +} + +initscript="$1" +action="$2" + +. "$initscript" + +cmds= +for cmd in $EXTRA_COMMANDS; do + cmds="$cmd) $cmd;;" +done +eval "case \"\$action\" in + start) start;; + stop) stop;; + reload) reload || restart;; + restart) restart;; + boot) boot;; + shutdown) shutdown;; + $cmds + *) help;; +esac" diff --git a/package/base-files/default/etc/resolv.conf b/package/base-files/default/etc/resolv.conf new file mode 100644 index 0000000000..9617eacda7 --- /dev/null +++ b/package/base-files/default/etc/resolv.conf @@ -0,0 +1,2 @@ +nameserver 127.0.0.1 +search lan diff --git a/package/base-files/default/etc/shells b/package/base-files/default/etc/shells new file mode 100644 index 0000000000..006aa38ced --- /dev/null +++ b/package/base-files/default/etc/shells @@ -0,0 +1 @@ +/bin/ash diff --git a/package/base-files/default/etc/sysctl.conf b/package/base-files/default/etc/sysctl.conf new file mode 100644 index 0000000000..e60038cf35 --- /dev/null +++ b/package/base-files/default/etc/sysctl.conf @@ -0,0 +1,12 @@ +kernel.panic=3 +net.ipv4.conf.default.arp_ignore=1 +net.ipv4.conf.all.arp_ignore=1 +net.ipv4.ip_forward=1 +net.ipv4.icmp_echo_ignore_broadcasts=1 +net.ipv4.icmp_ignore_bogus_error_responses=1 +net.ipv4.tcp_fin_timeout=30 +net.ipv4.tcp_keepalive_time=120 +net.ipv4.tcp_syncookies=1 +net.ipv4.tcp_timestamps=0 +net.ipv4.ip_conntrack_tcp_timeouts="300 43200 120 60 120 120 10 60 30 120" +net.ipv4.ip_conntrack_udp_timeouts="60 180" diff --git a/package/base-files/default/lib/config/uci-update.awk b/package/base-files/default/lib/config/uci-update.awk new file mode 100644 index 0000000000..efa8758507 --- /dev/null +++ b/package/base-files/default/lib/config/uci-update.awk @@ -0,0 +1,160 @@ +# Configuration update functions +# +# Copyright (C) 2006 by Fokus Fraunhofer <carsten.tittel@fokus.fraunhofer.de> +# Copyright (C) 2006 by Felix Fietkau <nbd@openwrt.org> +# +# 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 +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +function read_file(filename, result) { + while ((getline <filename) == 1) { + result = result $0 "\n" + } + gsub(/\n*$/, "", result) + return result +} + +function cmd2option(str, tmp) { + if (match(str,"=")!=0) { + res = "\toption " substr(str,1,RSTART-1) "\t'" substr(str,RSTART+1) "'" + } else { + res= "" + } + return res +} + +function cmd2config(atype, aname) { + return "config \"" atype "\" \"" aname "\"" +} + +function update_config(cfg, update, \ + lines, line, l, n, i, i2, section, scnt, remove, tmp, aidx, rest) { + scnt = 1 + linecnt=split(cfg "\n", lines, "\n") + + cfg = "" + for (n = 1; n < linecnt; n++) { + # stupid parser for quoted arguments (e.g. for the type string). + # not to be used to gather variable values (backslash escaping doesn't work) + line = lines[n] + gsub(/^[ \t]*/, "", line) + gsub(/#.*$/, "", line) + i2 = 1 + delete l + rest = line + while (length(rest)) { + if (match(rest, /[ \t\"]+/)) { + if (RSTART>1) { + l[i2] = substr(rest,1,RSTART-1) + i2++ + } + aidx=index(rest,"\"") + if (aidx>=RSTART && aidx<=RSTART+RLENGTH) { + rest=substr(rest,aidx+1) + # find the end of the string + match(rest,/\"/) + l[i2]=substr(rest,1,RSTART-1) + i2++ + } + rest=substr(rest,RSTART+RLENGTH) + } else { + l[i2] = rest + i2++ + rest = "" + } + } + line = lines[n] + + # when a command wants to set a config value for the current + # section and a blank line is encountered before an option with + # the same name, insert it here to maintain some coherency between + # manually and automatically created option lines + # if an option with the same name appears after this point, simply + # ignore it, because it is already set. + if ((section != "") && (l[1] != "option")) { + if (line ~ /^[ \t]*$/) { + if (update ~ "^" section "\\.") { + gsub("^" section ".", "", update) + cfg = cfg cmd2option(update) "\n" + gsub(/=.*$/, "", update) + update = "-" section "." update + } + } + } + + if (l[1] == "config") { + # look for all unset values + if (section != "") { + flag=0 + if (update ~ "^" section "\\.") { + flag=1 + gsub("^" section ".", "", update) + cfg = cfg cmd2option(update) "\n" + + update = "-" section "." update + } + if (flag!=0) cfg = cfg "\n" + } + + remove = "" + section = l[3] + if (!length(section)) { + section = "cfg" scnt + } + scnt++ + if (update == "-" section) { + remove = "section" + update = "" + } else if (update ~ "^@" section "=") { + update = "" + } else if (update ~ "^&" section "=") { + gsub("^&" section "=", "", update) + line = cmd2config(l[2],update) + update = "" + } + } + if (remove == "option") remove = "" + if (l[1] == "option") { + if (update ~ "^-" section "\\." l[2] "$") remove = "option" + # if a supplied config value already exists, replace the whole line + if (match(update, "^" section "." l[2] "=")) { + gsub("^" section ".", "", update) + line = cmd2option(update) + update = "" + } + } + if (remove == "") cfg = cfg line "\n" + } + + # any new options for the last section?? + if (section != "") { + if (update ~ "^" section "\\.") { + gsub("^" section ".", "", update) + cfg = cfg cmd2option(update) "\n" + + update = "-" section "." update + } + } + + if (update ~ "^@") { + # new section + section = stype = substr(update,2) + gsub(/=.*$/,"",section) + gsub(/^.*=/,"",stype) + cfg = cfg "\nconfig \"" stype "\" \"" section "\"\n" + } + + return cfg +} diff --git a/package/base-files/default/lib/config/uci.sh b/package/base-files/default/lib/config/uci.sh new file mode 100755 index 0000000000..ccd6ee57ba --- /dev/null +++ b/package/base-files/default/lib/config/uci.sh @@ -0,0 +1,138 @@ +#!/bin/sh +# Shell script defining macros for manipulating config files +# +# Copyright (C) 2006 by Fokus Fraunhofer <carsten.tittel@fokus.fraumhofer.de> +# Copyright (C) 2006 by Felix Fietkau <nbd@openwrt.org> +# +# 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 +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +uci_load() { + config_load "$PACKAGE" + local PACKAGE_BASE="$(basename "$PACKAGE")" + [ -f "/tmp/.uci/${PACKAGE_BASE}" ] && { + . "/tmp/.uci/${PACKAGE_BASE}" + config_cb + } +} + +uci_do_update() { + local FILENAME="$1" + local UPDATE="$2" + awk -f /lib/config/uci-update.awk -f - <<EOF +BEGIN { + config = read_file("$FILENAME") + $UPDATE + print config +} +EOF +} + +uci_add_update() { + local PACKAGE="$1" + local UPDATE="$2" + local PACKAGE_BASE="$(basename "$PACKAGE")" + + # FIXME: add locking? + mkdir -p "/tmp/.uci" + echo "$UPDATE" >> "/tmp/.uci/${PACKAGE_BASE}" +} + +uci_set() { + local PACKAGE="$1" + local CONFIG="$2" + local OPTION="$3" + local VALUE="$4" + + ( # spawn a subshell so you don't mess up the current environment + uci_load "$PACKAGE" + config_get type "$CONFIG" TYPE + [ -z "$type" ] + ) || uci_add_update "$PACKAGE" "CONFIG_SECTION='$CONFIG'${N}option '$OPTION' '$VALUE'" +} + +uci_add() { + local PACKAGE="$1" + local TYPE="$2" + local CONFIG="$3" + + uci_add_update "$PACKAGE" "config '$TYPE' '$CONFIG'" +} + +uci_rename() { + local PACKAGE="$1" + local CONFIG="$2" + local VALUE="$3" + + uci_add_update "$PACKAGE" "config_rename '$CONFIG' '$VALUE'" +} + +uci_remove() { + local PACKAGE="$1" + local CONFIG="$2" + local OPTION="$3" + + if [ -z "$OPTION" ]; then + uci_add_update "$PACKAGE" "config_clear '$CONFIG'" + else + uci_add_update "$PACKAGE" "config_unset '$CONFIG' '$OPTION'" + fi +} + +uci_commit() { + local PACKAGE="$1" + local PACKAGE_BASE="$(basename "$PACKAGE")" + + mkdir -p /tmp/.uci + lock "/tmp/.uci/$PACKAGE_BASE.lock" + [ -f "/tmp/.uci/$PACKAGE_BASE" ] && ( + updatestr="" + + # replace handlers + config() { + append updatestr "config = update_config(config, \"@$2=$1\")" "$N" + } + option() { + append updatestr "config = update_config(config, \"$CONFIG_SECTION.$1=$2\")" "$N" + } + config_rename() { + append updatestr "config = update_config(config, \"&$1=$2\")" "$N" + } + config_unset() { + append updatestr "config = update_config(config, \"-$1.$2\")" "$N" + } + config_clear() { + append updatestr "config = update_config(config, \"-$1\")" "$N" + } + + . "/tmp/.uci/$PACKAGE_BASE" + + # completely disable handlers so that they don't get in the way + config() { + return 0 + } + option() { + return 0 + } + + config_load "$PACKAGE" || CONFIG_FILENAME="$ROOT/etc/config/$PACKAGE_BASE" + uci_do_update "$CONFIG_FILENAME" "$updatestr" > "/tmp/.uci/$PACKAGE_BASE.new" && { + mv -f "/tmp/.uci/$PACKAGE_BASE.new" "$CONFIG_FILENAME" && \ + rm -f "/tmp/.uci/$PACKAGE_BASE" + } + ) + lock -u "/tmp/.uci/$PACKAGE_BASE.lock" +} + + diff --git a/package/base-files/default/lib/network/config.sh b/package/base-files/default/lib/network/config.sh new file mode 100755 index 0000000000..18f794a31b --- /dev/null +++ b/package/base-files/default/lib/network/config.sh @@ -0,0 +1,143 @@ +#!/bin/sh +# Copyright (C) 2006 OpenWrt.org + +# DEBUG="echo" + +find_config() { + local iftype device iface ifaces ifn + for ifn in $interfaces; do + config_get iftype "$ifn" type + config_get iface "$ifn" ifname + case "$iftype" in + bridge) config_get ifaces "$ifn" ifnames;; + esac + config_get device "$ifn" device + for ifc in $device $iface $ifaces; do + [ "$ifc" = "$1" ] && { + echo "$ifn" + return 0 + } + done + done + + return 1; +} + +scan_interfaces() { + local mode iftype iface ifname device + interfaces= + config_cb() { + config_get iftype "$CONFIG_SECTION" TYPE + case "$iftype" in + interface) + config_get proto "$CONFIG_SECTION" proto + append interfaces "$CONFIG_SECTION" + config_get iftype "$CONFIG_SECTION" type + config_get ifname "$CONFIG_SECTION" ifname + config_set "$CONFIG_SECTION" device "$ifname" + case "$iftype" in + bridge) + config_set "$CONFIG_SECTION" ifnames "$ifname" + config_set "$CONFIG_SECTION" ifname br-"$CONFIG_SECTION" + ;; + esac + ( type "scan_$proto" ) >/dev/null 2>/dev/null && eval "scan_$proto '$CONFIG_SECTION'" + ;; + esac + } + config_load network +} + +add_vlan() { + local vif="${1%\.*}" + + [ "$1" = "$vif" ] || ifconfig "$1" >/dev/null 2>/dev/null || { + ifconfig "$vif" up 2>/dev/null >/dev/null || add_vlan "$vif" + $DEBUG vconfig add "$vif" "${1##*\.}" + } +} + +setup_interface() { + local iface="$1" + local config="$2" + local proto + + [ -n "$config" ] || { + config=$(find_config "$iface") + [ "$?" = 0 ] || return 1 + } + + proto="${3:-$(config_get "$config" proto)}" + config_get iftype "$config" type + + # Setup VLAN interfaces + add_vlan "$iface" + + # Setup bridging + case "$iftype" in + bridge) + ifconfig "$iface" up 2>/dev/null >/dev/null + ifconfig "br-$config" 2>/dev/null >/dev/null && { + $DEBUG brctl addif "br-$config" "$iface" + return 0 + } || { + $DEBUG brctl addbr "br-$config" + $DEBUG brctl setfd "br-$config" 0 + $DEBUG brctl addif "br-$config" "$iface" + iface="br-$config" + } + ;; + esac + + # Interface settings + config_get mtu "$config" mtu + $DEBUG ifconfig "$iface" ${mtu:+mtu $mtu} up + + pidfile="/var/run/$iface.pid" + case "$proto" in + static) + config_get ipaddr "$config" ipaddr + config_get netmask "$config" netmask + [ -z "$ipaddr" -o -z "$netmask" ] && return 1 + + config_get ip6addr "$config" ip6addr + config_get gateway "$config" gateway + config_get dns "$config" dns + + $DEBUG ifconfig "$iface" "$ipaddr" netmask "$netmask" + [ -z "$gateway" ] || route add default gw "$gateway" + [ -z "$dns" -o -f /tmp/resolv.conf ] || { + for ns in $dns; do + echo "nameserver $ns" >> /tmp/resolv.conf + done + } + + env -i ACTION="ifup" INTERFACE="config" DEVICE="$iface" PROTO=static /sbin/hotplug "iface" & + ;; + dhcp) + pid="$(cat "$pidfile" 2>/dev/null)" + [ -n "$pid" -a -d "/proc/$pid" ] && kill -9 "$pid" + + config_get ipaddr "$config" ipaddr + config_get netmask "$config" netmask + config_get hostname "$config" hostname + config_get proto1 "$config" proto + + [ -z "$ipaddr" ] || \ + $DEBUG ifconfig "$iface" "$ipaddr" ${netmask:+netmask "$netmask"} + + # don't stay running in background if dhcp is not the main proto on the interface (e.g. when using pptp) + [ "$proto1" != "$proto" ] && dhcpopts="-n -q" + $DEBUG udhcpc -i "$iface" ${ipaddr:+-r $ipaddr} ${hostname:+-H $hostname} -b -p "$pidfile" ${dhcpopts:- -R &} + ;; + *) + if ( eval "type setup_interface_$proto" ) >/dev/null 2>/dev/null; then + eval "setup_interface_$proto '$iface' '$config' '$proto'" + else + echo "Interface type $proto not supported." + return 1 + fi + ;; + esac +} + diff --git a/package/base-files/default/rom/note b/package/base-files/default/rom/note new file mode 100644 index 0000000000..1746eb0509 --- /dev/null +++ b/package/base-files/default/rom/note @@ -0,0 +1,3 @@ +SQUASHFS USERS: +After firstboot has been run, / will be jffs2 and /rom will be squashfs +(* except when in failsafe) diff --git a/package/base-files/default/sbin/hotplug b/package/base-files/default/sbin/hotplug new file mode 100755 index 0000000000..b1b6f97b23 --- /dev/null +++ b/package/base-files/default/sbin/hotplug @@ -0,0 +1,26 @@ +#!/bin/sh +# Copyright (C) 2006 OpenWrt.org + +# bypass the normal hotplug path for firmware loading +# would otherwise cause problems with drivers like bcm43xx +[ "$1" = "firmware" -a "$ACTION" = "add" ] && { + [ -f "/lib/firmware/$FIRMWARE" ] && { + echo 1 > "/sys$DEVPATH/loading" + cp "/lib/firmware/$FIRMWARE" "/sys$DEVPATH/data" + echo 0 > "/sys$DEVPATH/loading" + } + exit 0 +} + +. /etc/functions.sh + +PATH=/bin:/sbin:/usr/bin:/usr/sbin +LOGNAME=root +USER=root +export PATH LOGNAME USER + +[ \! -z "$1" -a -d /etc/hotplug.d/$1 ] && { + for script in $(ls /etc/hotplug.d/$1/* 2>&-); do ( + [ -f $script ] && . $script + ); done +} diff --git a/package/base-files/default/sbin/ifdown b/package/base-files/default/sbin/ifdown new file mode 100755 index 0000000000..073e80d2da --- /dev/null +++ b/package/base-files/default/sbin/ifdown @@ -0,0 +1,34 @@ +#!/bin/sh +# Copyright (C) 2006 OpenWrt.org + +[ $# = 0 ] && { echo " $0 <group>"; exit; } +. /etc/functions.sh +include /lib/network +scan_interfaces + +cfg=$1 +debug "### ifdown $cfg ###" + +config_get proto "$cfg" proto +[ -z "$proto" ] && { echo "interface not found."; exit; } + +# kill active ppp daemon +pid="$(cat /var/run/ppp-${cfg}.pid 2>/dev/null)" +[ -n "$pid" -a -d "/proc/$pid" ] && { + kill $pid + sleep 1 + [ -d "/proc/$pid" ] && kill -9 $pid +} + +# kill any other process associated with the interface +config_get ifname "$cfg" ifname +pid="$(cat /var/run/${ifname}.pid 2>/dev/null)" +[ -n "$pid" -a -d "/proc/$pid" ] && kill -9 $pid + +config_get ifname "$cfg" ifname +ifconfig "$ifname" >/dev/null 2>/dev/null && { + ifconfig "$ifname" 0.0.0.0 down + + config_get iftype "$cfg" type + [ "$iftype" = "bridge" ] && brctl delbr "$ifname" +} diff --git a/package/base-files/default/sbin/ifup b/package/base-files/default/sbin/ifup new file mode 100755 index 0000000000..c7055d4807 --- /dev/null +++ b/package/base-files/default/sbin/ifup @@ -0,0 +1,14 @@ +#!/bin/sh +# Copyright (C) 2006 OpenWrt.org + +. /sbin/ifdown "$@" + +config_get iftype "$1" type +case "$iftype" in + bridge) config_get ifname "$1" ifnames;; + *) config_get ifname "$1" ifname;; +esac + +for dev in $ifname; do + setup_interface "$dev" "$1" +done diff --git a/package/base-files/default/sbin/mount_root b/package/base-files/default/sbin/mount_root new file mode 100755 index 0000000000..81660f0067 --- /dev/null +++ b/package/base-files/default/sbin/mount_root @@ -0,0 +1,10 @@ +#!/bin/sh +# Copyright (C) 2006 OpenWrt.org + +mount none /proc -t proc +size=$(awk '/Mem:/ {l=5242880;print((s=$2/2)<l)?$2-l:s}' /proc/meminfo) +mount none /tmp -t tmpfs -o size=$size,nosuid,nodev,mode=1777 +mkdir -p /dev/pts +mount none /dev/pts -t devpts +mount -t sysfs none /sys 2>&- +mount -o remount,rw /dev/root / diff --git a/package/base-files/default/sbin/wifi b/package/base-files/default/sbin/wifi new file mode 100755 index 0000000000..4a3ec8cfef --- /dev/null +++ b/package/base-files/default/sbin/wifi @@ -0,0 +1,44 @@ +#!/bin/sh +# Copyright (C) 2006 OpenWrt.org + +. /etc/functions.sh + +config_get_bool() { + local _tmp + config_get "$1" "$2" "$3" + eval "_tmp=\$$1" + case "$_tmp" in + 1|on|enabled) eval "$1=1";; + 0|off|disabled) eval "$1=0";; + *) eval "$1=${4:-0}";; + esac +} + +config_cb() { + config_get TYPE "$CONFIG_SECTION" TYPE + case "$TYPE" in + wifi-device) + append DEVICES "$CONFIG_SECTION" + ;; + wifi-iface) + config_get device "$CONFIG_SECTION" device + config_get vifs "$device" vifs + append vifs "$CONFIG_SECTION" + config_set "$device" vifs "$vifs" + ;; + esac +} + +config_load wireless +include /lib/wifi + +for device in $DEVICES; do ( + config_get iftype "$device" type + eval "type setup_$iftype" 2>/dev/null >/dev/null && { + eval "scan_$iftype '$device'" + eval "setup_$iftype '$device'" && { + # TODO: set up network settings + /bin/true + } || echo "$device($iftype): Setup failed" || true + } || echo "$device($iftype): Interface type not supported" +); done diff --git a/package/base-files/default/usr/lib/common.awk b/package/base-files/default/usr/lib/common.awk new file mode 100644 index 0000000000..c5ce680fa6 --- /dev/null +++ b/package/base-files/default/usr/lib/common.awk @@ -0,0 +1,68 @@ +# Copyright (C) 2006 OpenWrt.org + +function portstr(type, str) { + gsub(/-/, ":", str) + if (insmod_mport != 1) { + print "insmod ipt_multiport >&- 2>&-" + insmod_mport = 1 + } + if (type == "src") return " -m multiport --sports " str + else return " -m multiport --dports " str +} + +function str2ipt(str) { + str2data(str) + _cmd = "" + if (_l["src"] != "") _cmd = _cmd " -s " _l["src"] + if (_l["dest"] != "") _cmd = _cmd " -d " _l["dest"] + if (_l["proto"] != "") { + _cmd = _cmd " -p " _l["proto"] + } + # scripts need to check for proto="" and emit two rules in that case + if ((_l["proto"] == "") || (_l["proto"] == "tcp") || (_l["proto"] == "udp")) { + if (_l["sport"] != "") _cmd = _cmd portstr("src", _l["sport"]) + if (_l["dport"] != "") _cmd = _cmd portstr("dest", _l["dport"]) + } + if (_l["layer7"] != "") { + if (insmod_l7 != 1) { + print "insmod ipt_layer7 >&- 2>&-" + insmod_l7 = 1 + } + _cmd = _cmd " -m layer7 --l7proto " _l["layer7"] + } + return _cmd +} + +function str2data(str) { + delete _l + _n = split(str, _o, "[\t ]") + for (_i = 1; _i <= _n; _i++) { + _n2 = split(_o[_i], _c, "=") + if (_n2 == 2) _l[_c[1]] = _c[2] + } +} + +function bitcount(c) { + c=and(rshift(c, 1),0x55555555)+and(c,0x55555555) + c=and(rshift(c, 2),0x33333333)+and(c,0x33333333) + c=and(rshift(c, 4),0x0f0f0f0f)+and(c,0x0f0f0f0f) + c=and(rshift(c, 8),0x00ff00ff)+and(c,0x00ff00ff) + c=and(rshift(c,16),0x0000ffff)+and(c,0x0000ffff) + return c +} + +function validate_netmask(nm) { + return and(-nm,compl(nm)) +} + +function ip2int(ip) { + for (ret=0,n=split(ip,a,"\."),x=1;x<=n;x++) ret=or(lshift(ret,8),a[x]) + return ret +} + +function int2ip(ip,ret,x) { + ret=and(ip,255) + ip=rshift(ip,8) + for(;x<3;ret=and(ip,255)"."ret,ip=rshift(ip,8),x++); + return ret +} diff --git a/package/base-files/default/usr/lib/parse-config.awk b/package/base-files/default/usr/lib/parse-config.awk new file mode 100644 index 0000000000..9ce32b74ff --- /dev/null +++ b/package/base-files/default/usr/lib/parse-config.awk @@ -0,0 +1,42 @@ +# Copyright (C) 2006 OpenWrt.org + +{ + line=$0 + gsub(/^[ \t]*/, "") + gsub(/[ \t]*$/, "") +} + +$1 == "@define" { + v[$2] = $3 +} + +$1 == "@ifdef" { + if_open = 1 + if (v[$2] != "") noprint = 0 + else noprint = 1 +} + +$1 == "@ifndef" { + if_open = 1 + if (v[$2] != "") noprint = 1 + else noprint = 0 +} + +$1 == "@else" { + if (noprint == 1) noprint = 0 + else noprint = 1 +} + +($1 !~ /^@[a-zA-Z]/) && (noprint != 1) { + n=split(line "@@", a, /@@/) + for (i=1; i<=n; i++) { + if ((i % 2) == 1) printf a[i] + else printf v[a[i]] + } + print "" +} + +$1 == "@endif" { + if_open = 0 + noprint = 0 +} diff --git a/package/base-files/default/usr/share/udhcpc/default.script b/package/base-files/default/usr/share/udhcpc/default.script new file mode 100755 index 0000000000..74e703715b --- /dev/null +++ b/package/base-files/default/usr/share/udhcpc/default.script @@ -0,0 +1,57 @@ +#!/bin/sh +[ -z "$1" ] && echo "Error: should be run by udhcpc" && exit 1 +. /etc/functions.sh +include /lib/network + +RESOLV_CONF="/tmp/resolv.conf" + +hotplug_event() { + scan_interfaces + for ifc in $interfaces; do + config_get ifname $ifc ifname + [ "$ifname" = "$interface" ] || continue + + config_get proto $ifc proto + [ "$proto" = "dhcp" ] || continue + + env -i ACTION="$1" INTERFACE="$ifname" PROTO=dhcp /sbin/hotplug iface + done +} + +case "$1" in + deconfig) + ifconfig $interface 0.0.0.0 + hotplug_event ifdown + ;; + renew|bound) + ifconfig $interface $ip \ + netmask ${subnet:-255.255.255.0} \ + broadcast ${broadcast:-+} + + if [ -n "$router" ] ; then + echo "deleting routers" + while route del default gw 0.0.0.0 dev $interface >&- 2>&- ; do :; done + + for i in $router ; do + echo "adding router $i" + route add default gw $i dev $interface + done + fi + + [ -n "$dns" ] && { + echo -n > $RESOLV_CONF + ${domain:+echo search $domain} >> $RESOLV_CONF + for i in $dns ; do + echo "adding dns $i" + echo "nameserver $i" >> $RESOLV_CONF + done + } + + hotplug_event ifup + + # user rules + [ -f /etc/udhcpc.user ] && . /etc/udhcpc.user + ;; +esac + +exit 0 diff --git a/package/base-files/rb532-2.6/etc/config/network b/package/base-files/rb532-2.6/etc/config/network new file mode 100644 index 0000000000..8279690574 --- /dev/null +++ b/package/base-files/rb532-2.6/etc/config/network @@ -0,0 +1,12 @@ +# Copyright (C) 2006 OpenWrt.org + +config interface loopback + option ifname lo + option proto static + option ipaddr 127.0.0.1 + option netmask 255.0.0.0 + +config interface lan + option ifname eth0 + option proto dhcp + diff --git a/package/base-files/sibyte-2.6/etc/config/network b/package/base-files/sibyte-2.6/etc/config/network new file mode 100644 index 0000000000..9b65652f06 --- /dev/null +++ b/package/base-files/sibyte-2.6/etc/config/network @@ -0,0 +1,14 @@ +# Copyright (C) 2006 OpenWrt.org + +config interface loopback + option ifname lo + option proto static + option ipaddr 127.0.0.1 + option netmask 255.0.0.0 + +config interface lan + option type bridge + option ifname "eth0 ath0" + option proto static + option ipaddr 192.168.1.1 + option netmask 255.255.255.0 diff --git a/package/base-files/sibyte-2.6/etc/inittab b/package/base-files/sibyte-2.6/etc/inittab new file mode 100644 index 0000000000..a6f4e17f01 --- /dev/null +++ b/package/base-files/sibyte-2.6/etc/inittab @@ -0,0 +1,5 @@ +# Copyright (C) 2006 OpenWrt.org + +::sysinit:/etc/init.d/rcS +duart/0::askfirst:/bin/ash --login +#tts/1::askfirst:/bin/ash --login diff --git a/package/base-files/src/adam2patcher.c b/package/base-files/src/adam2patcher.c new file mode 100644 index 0000000000..25a78074a6 --- /dev/null +++ b/package/base-files/src/adam2patcher.c @@ -0,0 +1,59 @@ +/* + * patcher.c - ADAM2 patcher for Netgear DG834 (and compatible) + * + * Copyright (C) 2006 Felix Fietkau + * + * 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 the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <stddef.h> +#include <unistd.h> +#include <fcntl.h> +#include <stdint.h> +#include <sys/mman.h> +#include <sys/stat.h> +#include <string.h> + +#include <sys/ioctl.h> + +int main(int argc, char **argv) +{ + int fd; + char *ptr; + uint32_t *i; + + if (argc != 2) { + fprintf(stderr, "Usage: %s <filename>\n", argv[0]); + exit(1); + } + + if (((fd = open(argv[1], O_RDWR)) < 0) + || ((ptr = mmap(0, 128 * 1024, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0)) == (void *) (-1))) { + fprintf(stderr, "Can't open file\n"); + exit(1); + } + + i = (uint32_t *) &ptr[0x3944]; + if (*i == 0x0c000944) { + fprintf(stderr, "Unpatched ADAM2 detected. Patching... "); + *i = 0x00000000; + msync(i, sizeof(*i), MS_SYNC|MS_INVALIDATE); + fprintf(stderr, "done!\n"); + } else if (*i == 0x00000000) { + fprintf(stderr, "Patched ADAM2 detected.\n"); + } else { + fprintf(stderr, "Unknown ADAM2 detected. Can't patch!\n"); + } + + close(fd); +} diff --git a/package/base-files/src/jffs2root.c b/package/base-files/src/jffs2root.c new file mode 100644 index 0000000000..14662fc945 --- /dev/null +++ b/package/base-files/src/jffs2root.c @@ -0,0 +1,133 @@ +/* + * jffs2root.c + * + * Copyright (C) 2005 Mike Baker + * + * 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 the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <stddef.h> +#include <unistd.h> +#include <fcntl.h> +#include <sys/mman.h> +#include <sys/stat.h> +#include <string.h> + +#include <sys/ioctl.h> +#include <linux/mtd/mtd.h> + +#define FILENAME "/dev/mtdblock/1" + +struct trx_header { + unsigned magic; /* "HDR0" */ + unsigned len; /* Length of file including header */ + unsigned crc32; /* 32-bit CRC from flag_version to end of file */ + unsigned flag_version; /* 0:15 flags, 16:31 version */ + unsigned offsets[3]; /* Offsets of partitions from start of header */ +}; + +unsigned long *crc32; + +void init_crc32() +{ + unsigned long crc; + unsigned long poly = 0xEDB88320L; + int n, bit; + if ((crc32 = (unsigned long *) malloc(256 * sizeof(unsigned long))) == (void *)-1) { + perror("malloc"); + exit(1); + } + for (n = 0; n < 256; n++) { + crc = (unsigned long) n; + for (bit = 0; bit < 8; bit++) + crc = (crc & 1) ? (poly ^ (crc >> 1)) : (crc >> 1); + crc32[n] = crc; + } +} + +unsigned int crc32buf(char *buf, size_t len) +{ + unsigned int crc = 0xFFFFFFFF; + for (; len; len--, buf++) + crc = crc32[(crc ^ *buf) & 0xff] ^ (crc >> 8); + return crc; +} + +int main(int argc, char **argv) +{ + int fd; + struct mtd_info_user mtdInfo; + unsigned long len; + struct trx_header *ptr; + char *buf; + + if (((fd = open(FILENAME, O_RDWR)) < 0) + || ((len = lseek(fd, 0, SEEK_END)) < 0) + || ((ptr = (struct trx_header *) mmap(0, len, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0)) == (void *) (-1)) + || (ptr->magic != 0x30524448)) { + printf("Error reading trx info\n"); + exit(-1); + } + close (fd); + + if (((fd = open("/dev/mtd/1", O_RDWR)) < 0) + || (ioctl(fd, MEMGETINFO, &mtdInfo))) { + fprintf(stderr, "Could not get MTD device info from %s\n", FILENAME); + close(fd); + exit(1); + } + close(fd); + + if (argc > 1 && !strcmp(argv[1],"--move")) { + if (ptr->offsets[2] >= ptr->len) { + printf("Partition already moved outside trx\n"); + } else { + init_crc32(); + ptr->offsets[2] += (mtdInfo.erasesize - 1); + ptr->offsets[2] &= ~(mtdInfo.erasesize - 1); + ptr->len = ptr->offsets[2]; + ptr->crc32 = crc32buf((void *) &(ptr->flag_version), ptr->len - offsetof(struct trx_header, flag_version)); + msync(ptr,sizeof(struct trx_header),MS_SYNC|MS_INVALIDATE); + printf("Partition moved; please reboot\n"); + } + } else if (argc > 1 && !strcmp(argv[1], "--clean")) { + buf = (char *) ptr; + if (buf[ptr->offsets[1] - 1] == 0) { + init_crc32(); + buf[ptr->offsets[1] - 1] = 1; + ptr->crc32 = crc32buf((void *) &(ptr->flag_version), ptr->len - offsetof(struct trx_header, flag_version)); + msync(ptr,sizeof(struct trx_header),MS_SYNC|MS_INVALIDATE); + printf("Partition marked as clean\n"); + } + } else { + int x; + printf(" erase: 0x%08x\n",mtdInfo.erasesize); + printf("=== trx ===\n"); + printf("mapped: 0x%08x\n", (unsigned)ptr); + printf(" magic: 0x%08x\n", ptr->magic); + printf(" len: 0x%08x\n", ptr->len); + printf(" crc: 0x%08x\n", ptr->crc32); + for (x = 0; x < 3; x++) + printf(" offset[%d]: 0x%08x\n", x, ptr->offsets[x]); + } + + munmap((void *) ptr, len); + return 0; +} diff --git a/package/base-files/x86-2.4/etc/config/network b/package/base-files/x86-2.4/etc/config/network new file mode 100644 index 0000000000..68d8e4240e --- /dev/null +++ b/package/base-files/x86-2.4/etc/config/network @@ -0,0 +1,19 @@ +# Copyright (C) 2006 OpenWrt.org + +config interface loopback + option ifname lo + option proto static + option ipaddr 127.0.0.1 + option netmask 255.0.0.0 + +config interface lan + option type bridge + option ifname "eth1 eth2" + option proto static + option ipaddr 192.168.1.1 + option netmask 255.255.255.0 + +config interface wan + option ifname eth0 + option proto dhcp + diff --git a/package/base-files/x86-2.6/etc/config/network b/package/base-files/x86-2.6/etc/config/network new file mode 100644 index 0000000000..68d8e4240e --- /dev/null +++ b/package/base-files/x86-2.6/etc/config/network @@ -0,0 +1,19 @@ +# Copyright (C) 2006 OpenWrt.org + +config interface loopback + option ifname lo + option proto static + option ipaddr 127.0.0.1 + option netmask 255.0.0.0 + +config interface lan + option type bridge + option ifname "eth1 eth2" + option proto static + option ipaddr 192.168.1.1 + option netmask 255.255.255.0 + +config interface wan + option ifname eth0 + option proto dhcp + diff --git a/package/base-files/xscale-2.6/etc/config/network b/package/base-files/xscale-2.6/etc/config/network new file mode 100644 index 0000000000..1d9b55b2d3 --- /dev/null +++ b/package/base-files/xscale-2.6/etc/config/network @@ -0,0 +1,11 @@ +# Network configuration file + +config interface loopback + option ifname lo + option proto static + option ipaddr 127.0.0.1 + option netmask 255.0.0.0 + +config interface lan + option ifname eth0 + option proto dhcp diff --git a/package/bridge/Makefile b/package/bridge/Makefile new file mode 100644 index 0000000000..c186c8e701 --- /dev/null +++ b/package/bridge/Makefile @@ -0,0 +1,46 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=bridge +PKG_VERSION:=1.0.6 +PKG_RELEASE:=1 + +PKG_SOURCE:=bridge-utils-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/bridge +PKG_MD5SUM:=9b7dc52656f5cbec846a7ba3299f73bd +PKG_CAT:=zcat + +PKG_BUILD_DIR:=$(BUILD_DIR)/bridge-utils-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/bridge + SECTION:=net + CATEGORY:=Base system + DEFAULT:=y + TITLE:=Ethernet bridging configuration utility + DESCRIPTION:=\ + Manage ethernet bridging: a way to connect networks together to \\\ + form a larger network. + URL:=http://bridge.sourceforge.net/ +endef + +define Build/Configure + $(call Build/Configure/Default, \ + --with-linux-headers="$(LINUX_DIR)" \ + ) +endef + +define Package/bridge/install + install -m0755 -d $(1)/usr/sbin + install -m0755 $(PKG_BUILD_DIR)/brctl/brctl $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,bridge)) diff --git a/package/bridge/patches/patch-libbridge_Makefile_in b/package/bridge/patches/patch-libbridge_Makefile_in new file mode 100644 index 0000000000..f44737750b --- /dev/null +++ b/package/bridge/patches/patch-libbridge_Makefile_in @@ -0,0 +1,11 @@ +--- bridge-utils-0.9.6/libbridge/Makefile.in.dist 2004-03-01 20:55:52.000000000 -0600 ++++ bridge-utils-0.9.6/libbridge/Makefile.in 2004-03-01 20:56:23.000000000 -0600 +@@ -5,7 +5,7 @@ + RANLIB=@RANLIB@ + + CC=@CC@ +-CFLAGS = -Wall -g $(KERNEL_HEADERS) ++CFLAGS = -Wall -g @CFLAGS@ $(KERNEL_HEADERS) + + prefix=@prefix@ + exec_prefix=@exec_prefix@ diff --git a/package/broadcom-wl/Makefile b/package/broadcom-wl/Makefile new file mode 100644 index 0000000000..3ef4bcf081 --- /dev/null +++ b/package/broadcom-wl/Makefile @@ -0,0 +1,148 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id: Makefile 2480 2005-11-14 02:07:33Z nbd $ + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=broadcom-wl +PKG_VERSION:=4.80.17.0 +PKG_RELEASE:=1 +WLC_VERSION:=0.1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=http://downloads.openwrt.org/sources +PKG_MD5SUM:=3183ddb60e3e882b41df1776c89b614c +PKG_CAT:=bzcat + +PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/broadcom-wl/Default + SECTION:=net + CATEGORY:=Kernel drivers + DEPENDS:=@PACKAGE_kmod-brcm-wl||PACKAGE_kmod-brcm-wl-mimo + SUBMENU:=Proprietary BCM43xx WiFi driver + SUBMENUDEP:=@LINUX_2_4_BRCM +endef + +define Package/kmod-brcm-wl/Default + $(call Package/broadcom-wl/Default) + SECTION:=kernel + DEPENDS:=@LINUX_2_4_BRCM + TITLE:=Kernel driver for BCM43xx chipsets + DESCRIPTION:=\ + This package contains the proprietary wireless driver for the Broadcom \\\ + BCM43xx chipset + VERSION:=$(LINUX_VERSION)+$(PKG_VERSION)-$(PKG_RELEASE) +endef + +define Package/kmod-brcm-wl + $(call Package/kmod-brcm-wl/Default) + DEFAULT:=y + TITLE+= (normal version) + DESCRIPTION+= (normal version). +endef + +define Package/kmod-brcm-wl-mimo + $(call Package/kmod-brcm-wl/Default) + TITLE+= (MIMO version) + DESCRIPTION+= (MIMO version). +endef + +define Package/wlc + $(call Package/broadcom-wl/Default) + DEFAULT:=y + TITLE:=Proprietary Broadcom wl driver setup utility + DESCRIPTION:=\ + This package contains an utility for initializing the proprietary Broadcom \\\ + wl driver. +endef + +define Package/wl + $(call Package/broadcom-wl/Default) + TITLE:=Proprietary Broadcom wl driver config utility + DESCRIPTION:=\ + This package contains the proprietary utility (wl) for configuring the \\\ + proprietary Broadcom wl driver. +endef + +define Package/nas + $(call Package/broadcom-wl/Default) + DEPENDS+= +nvram + TITLE:=Proprietary Broadcom WPA/WPA2 authenticator + DESCRIPTION:=\ + This package contains the proprietary WPA/WPA2 authenticator (nas) for the \\\ + proprietary Broadcom wl driver. +endef + +MAKEFLAGS_KMOD:= -C "$(LINUX_DIR)" \ + CROSS_COMPILE="$(TARGET_CROSS)" \ + ARCH="$(LINUX_KARCH)" \ + PATH="$(TARGET_PATH)" \ + SUBDIRS="$(PKG_BUILD_DIR)/kmod" + +define Build/Prepare + $(call Build/Prepare/Default) + $(CP) src/* $(PKG_BUILD_DIR)/ +endef + +define Build/Compile + # Compile the kernel part + $(MAKE) $(MAKEFLAGS_KMOD) \ + modules + $(MAKE) $(MAKEFLAGS_KMOD) MOD_NAME="_mimo" \ + modules + + # Compile wlc + $(MAKE) -C $(PKG_BUILD_DIR)/wlc \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="-I$(PKG_BUILD_DIR)/wlc/include $(TARGET_CFLAGS)" \ + all +endef + +define wl_template + install -d -m0755 $(1)/etc/modules.d + echo "wl$(2)" > $(1)/etc/modules.d/20-wl$(2) + install -d -m0755 $(1)/lib/modules/$(LINUX_VERSION) + install -m0644 $(PKG_BUILD_DIR)/kmod/wl$(2).o $(PKG_BUILD_DIR)/kmod/wl$(2).o.patch $(1)/lib/modules/$(LINUX_VERSION)/ +endef + +define Package/kmod-brcm-wl/install + $(call wl_template,$(1)) +endef + +define Package/kmod-brcm-wl-mimo/install + $(call wl_template,$(1),_mimo) +endef + +define Package/wlc/install + $(CP) ./files/* $(1)/ + install -d -m0755 $(1)/sbin + install -m0755 $(PKG_BUILD_DIR)/wlc/wlc $(1)/sbin/ +endef + +define Package/wl/install + install -d -m0755 $(1)/usr/sbin + install -m0755 $(PKG_BUILD_DIR)/wl $(1)/usr/sbin/ +endef + +define Package/nas/install + install -d -m0755 $(1)/usr/lib + install -m0755 $(PKG_BUILD_DIR)/libbcmcrypto.so $(1)/usr/lib/ + install -d -m0755 $(1)/usr/sbin + install -m0755 $(PKG_BUILD_DIR)/nas $(1)/usr/sbin/ + ln -sf nas $(1)/usr/sbin/nas4not + ln -sf nas $(1)/usr/sbin/nas4wds +endef + +$(eval $(call BuildPackage,kmod-brcm-wl)) +$(eval $(call BuildPackage,kmod-brcm-wl-mimo)) +$(eval $(call BuildPackage,wlc)) +$(eval $(call BuildPackage,wl)) +$(eval $(call BuildPackage,nas)) diff --git a/package/broadcom-wl/files/lib/wifi/broadcom.sh b/package/broadcom-wl/files/lib/wifi/broadcom.sh new file mode 100644 index 0000000000..435c440e2e --- /dev/null +++ b/package/broadcom-wl/files/lib/wifi/broadcom.sh @@ -0,0 +1,177 @@ +bridge_interface() { + ( + . /etc/functions.sh + include network + scan_interfaces + cfg="$(find_config "$1")" + [ -z "$cfg" ] && return 0 + config_get iftype "$cfg" type + [ "$iftype" = bridge ] && config_get "$iftype" bridge + ) +} + +scan_broadcom() { + local device="$1" + + config_get vifs "$device" vifs + for vif in $vifs; do + config_get mode "$vif" mode + case "$mode" in + adhoc) + adhoc=1 + adhoc_if="$vif" + ;; + sta) + sta=1 + sta_if="$vif" + ;; + ap) + ap=1 + ap_if="${ap_if:+$ap_if }$vif" + ;; + *) echo "$device($vif): Invalid mode";; + esac + done + + local _c= + for vif in ${adhoc_if:-$sta_if $ap_if}; do + config_set "$vif" ifname "wl0${_c:+.$_c}" + _c=$((${_c:-0} + 1)) + done + + ifdown="down" + for vif in 0 1 2 3; do + append ifdown "vif $vif" "$N" + append ifdown "enabled 0" "$N" + done + + ap=1 + infra=1 + mssid=1 + apsta=0 + radio=1 + case "$adhoc:$sta:$ap" in + 1*) + ap=0 + mssid=0 + infra=0 + ;; + :1:1) + apsta=1 + wet=1 + ;; + :1:) + wet=1 + ap=0 + mssid=0 + ;; + ::) + radio=0 + ;; + esac +} + + +setup_broadcom() { + local _c + config_get channel "$device" channel + config_get country "$device" country + config_get maxassoc "$device" maxassoc + + _c=0 + nas="$(which nas)" + nas_cmd= + if_up= + for vif in ${adhoc_if:-$sta_if $ap_if}; do + append vif_pre_up "vif $_c" "$N" + append vif_post_up "vif $_c" "$N" + + [ "$vif" = "$sta_if" ] || { + config_get_bool hidden "$vif" hidden 1 + append vif_pre_up "closed $hidden" "$N" + config_get_bool isolate "$vif" isolate + append vif_pre_up "ap_isolate $hidden" "$N" + } + + wsec_r=0 + eap_r=0 + wsec=0 + auth=0 + nasopts= + config_get enc "$vif" encryption + case "$enc" in + WEP|wep) + wsec_r=1 + ;; + *psk*|*PSK*) + wsec_r=1 + config_get key "$vif" key + case "$enc" in + wpa2*|WPA2*|PSK2*|psk2*) auth=128; wsec=4;; + *) auth=4; crypto=2;; + esac + eval "${vif}_key=\"\$key\"" + nasopts="-k \"\$${vif}_key\"" + ;; + *wpa*|*WPA*) + wsec_r=1 + eap_r=1 + config_get key "$vif" key + config_get server "$vif" server + config_get port "$vif" port + case "$enc" in + wpa2*|WPA2*) auth=64; wsec=4;; + *) auth=2; crypto=2;; + esac + eval "${vif}_key=\"\$key\"" + nasopts="-r \"\$${vif}_key\" -h $server -p $port" + ;; + esac + append vif_post_up "wsec $wsec" "$N" + append vif_post_up "wpa_auth $auth" "$N" + append vif_post_up "wsec_restrict $wsec_r" "$N" + append vif_post_up "eap_restrict $eap_r" "$N" + + config_get ssid "$vif" ssid + append vif_post_up "vlan_mode 0" + append vif_post_up "ssid $ssid" "$N" + append vif_post_up "enabled 1" "$N" + + config_get ifname "$vif" ifname + append if_up "ifconfig $ifname up" ";$N" + [ -z "$nasopts" ] || { + bridge="$(bridge_interface "$ifname")" + eval "${vif}_ssid=\"\$ssid\"" + mode="-A" + [ "$vif" = "$sta_if" ] && mode="-S" + [ -z "$nas" ] || nas_cmd="${nas_cmd:+$nas_cmd$N}$nas -P /var/run/nas.$ifname.pid -H 34954 ${bridge:+ -l $bridge} -i $ifname $mode -m $auth -w $crypto -s \"\$${vif}_ssid\" -g 3600 $nasopts &" + } + _c=$(($_c + 1)) + done + killall -KILL nas >&- 2>&- + wlc stdin <<EOF +$ifdown + +mssid $mssid +ap $ap +apsta $apsta +infra $infra +${wet:+wet 1} + +radio ${radio:-1} +macfilter 0 +maclist none +wds none +channel ${channel:-0} +country ${country:-IL0} +maxassoc ${maxassoc:-128} + +$vif_pre_up +up +$vif_post_up +EOF + eval "$nas_cmd" + eval "$if_up" +} + + diff --git a/package/broadcom-wl/src/kmod/Makefile b/package/broadcom-wl/src/kmod/Makefile new file mode 100644 index 0000000000..450700f5ce --- /dev/null +++ b/package/broadcom-wl/src/kmod/Makefile @@ -0,0 +1,31 @@ +# +# Makefile for the Broadcom wl driver +# +# Copyright 2004, Broadcom Corporation +# All Rights Reserved. +# +# THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY +# KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM +# SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS +# FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. +# +# $Id: Makefile,v 1.2 2005/03/29 03:32:18 mbm Exp $ + +EXTRA_CFLAGS += -I$(TOPDIR)/arch/mips/bcm947xx/include -DBCMDRIVER + +O_TARGET := wl$(MOD_NAME).o + +obj-y := wl_mod$(MOD_NAME).o +obj-y += bcmutils.o hnddma.o linux_osl.o + +obj-m := $(O_TARGET) + +wl_mod$(MOD_NAME).o: wl_apsta$(MOD_NAME).o + perl -ne 's,eth%d,wl%d\x00,g,print' < $< > $@ + +wl$(MOD_NAME).o.patch: wl$(MOD_NAME).o + $(OBJDUMP) -d $< | perl patchtable.pl > $@ + +modules: wl$(MOD_NAME).o.patch + +include $(TOPDIR)/Rules.make diff --git a/package/broadcom-wl/src/kmod/bcmip.h b/package/broadcom-wl/src/kmod/bcmip.h new file mode 100644 index 0000000000..423a0e5c5c --- /dev/null +++ b/package/broadcom-wl/src/kmod/bcmip.h @@ -0,0 +1,101 @@ +/* + * Copyright 2006, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * + * Fundamental constants relating to IP Protocol + * + * $Id: bcmip.h,v 1.1.1.3 2006/02/27 03:43:16 honor Exp $ + */ + +#ifndef _bcmip_h_ +#define _bcmip_h_ + +/* IPV4 and IPV6 common */ +#define IP_VER_OFFSET 0x0 /* offset to version field */ +#define IP_VER_MASK 0xf0 /* version mask */ +#define IP_VER_SHIFT 4 /* version shift */ +#define IP_VER_4 4 /* version number for IPV4 */ +#define IP_VER_6 6 /* version number for IPV6 */ + +#define IP_VER(ip_body) \ + ((((uint8 *)(ip_body))[IP_VER_OFFSET] & IP_VER_MASK) >> IP_VER_SHIFT) + +#define IP_PROT_ICMP 0x1 /* ICMP protocol */ +#define IP_PROT_TCP 0x6 /* TCP protocol */ +#define IP_PROT_UDP 0x11 /* UDP protocol type */ + +/* IPV4 field offsets */ +#define IPV4_VER_HL_OFFSET 0 /* version and ihl byte offset */ +#define IPV4_TOS_OFFSET 1 /* type of service offset */ +#define IPV4_PROT_OFFSET 9 /* protocol type offset */ +#define IPV4_CHKSUM_OFFSET 10 /* IP header checksum offset */ +#define IPV4_SRC_IP_OFFSET 12 /* src IP addr offset */ +#define IPV4_DEST_IP_OFFSET 16 /* dest IP addr offset */ + +/* IPV4 field decodes */ +#define IPV4_VER_MASK 0xf0 /* IPV4 version mask */ +#define IPV4_VER_SHIFT 4 /* IPV4 version shift */ + +#define IPV4_HLEN_MASK 0x0f /* IPV4 header length mask */ +#define IPV4_HLEN(ipv4_body) (4 * (((uint8 *)(ipv4_body))[IPV4_VER_HL_OFFSET] & IPV4_HLEN_MASK)) + +#define IPV4_ADDR_LEN 4 /* IPV4 address length */ + +#define IPV4_ADDR_NULL(a) ((((uint8 *)(a))[0] | ((uint8 *)(a))[1] | \ + ((uint8 *)(a))[2] | ((uint8 *)(a))[3]) == 0) + +#define IPV4_TOS_DSCP_MASK 0xfc /* DiffServ codepoint mask */ +#define IPV4_TOS_DSCP_SHIFT 2 /* DiffServ codepoint shift */ + +#define IPV4_TOS(ipv4_body) (((uint8 *)(ipv4_body))[IPV4_TOS_OFFSET]) + +#define IPV4_TOS_PREC_MASK 0xe0 /* Historical precedence mask */ +#define IPV4_TOS_PREC_SHIFT 5 /* Historical precedence shift */ + +#define IPV4_TOS_LOWDELAY 0x10 /* Lowest delay requested */ +#define IPV4_TOS_THROUGHPUT 0x8 /* Best throughput requested */ +#define IPV4_TOS_RELIABILITY 0x4 /* Most reliable delivery requested */ + +#define IPV4_PROT(ipv4_body) (((uint8 *)(ipv4_body))[IPV4_PROT_OFFSET]) + +#define IPV4_ADDR_STR_LEN 16 /* Max IP address length in string format */ + +/* IPV6 field offsets */ +#define IPV6_PAYLOAD_LEN_OFFSET 4 /* payload length offset */ +#define IPV6_NEXT_HDR_OFFSET 6 /* next header/protocol offset */ +#define IPV6_HOP_LIMIT_OFFSET 7 /* hop limit offset */ +#define IPV6_SRC_IP_OFFSET 8 /* src IP addr offset */ +#define IPV6_DEST_IP_OFFSET 24 /* dst IP addr offset */ + +/* IPV6 field decodes */ +#define IPV6_TRAFFIC_CLASS(ipv6_body) \ + (((((uint8 *)(ipv6_body))[0] & 0x0f) << 4) | \ + ((((uint8 *)(ipv6_body))[1] & 0xf0) >> 4)) + +#define IPV6_FLOW_LABEL(ipv6_body) \ + (((((uint8 *)(ipv6_body))[1] & 0x0f) << 16) | \ + (((uint8 *)(ipv6_body))[2] << 8) | \ + (((uint8 *)(ipv6_body))[3])) + +#define IPV6_PAYLOAD_LEN(ipv6_body) \ + ((((uint8 *)(ipv6_body))[IPV6_PAYLOAD_LEN_OFFSET + 0] << 8) | \ + ((uint8 *)(ipv6_body))[IPV6_PAYLOAD_LEN_OFFSET + 1]) + +#define IPV6_NEXT_HDR(ipv6_body) \ + (((uint8 *)(ipv6_body))[IPV6_NEXT_HDR_OFFSET]) + +#define IPV6_PROT(ipv6_body) IPV6_NEXT_HDR(ipv6_body) + +#define IPV6_ADDR_LEN 16 /* IPV6 address length */ + +/* IPV4 TOS or IPV6 Traffic Classifier or 0 */ +#define IP_TOS(ip_body) \ + (IP_VER(ip_body) == IP_VER_4 ? IPV4_TOS(ip_body) : \ + IP_VER(ip_body) == IP_VER_6 ? IPV6_TRAFFIC_CLASS(ip_body) : 0) + +#endif /* _bcmip_h_ */ diff --git a/package/broadcom-wl/src/kmod/bcmutils.c b/package/broadcom-wl/src/kmod/bcmutils.c new file mode 100644 index 0000000000..c264ea500b --- /dev/null +++ b/package/broadcom-wl/src/kmod/bcmutils.c @@ -0,0 +1,857 @@ +/* + * Misc useful OS-independent routines. + * + * Copyright 2006, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * $Id: bcmutils.c,v 1.1.1.12 2006/02/27 03:43:16 honor Exp $ + */ + +#include <typedefs.h> +#include <bcmdefs.h> +#include <stdarg.h> +#include <osl.h> +#include "linux_osl.h" +#include "pktq.h" +#include <bcmutils.h> +#include <sbutils.h> +#include <bcmnvram.h> +#include <bcmendian.h> +#include <bcmdevs.h> +#include "bcmip.h" + +#define ETHER_TYPE_8021Q 0x8100 +#define ETHER_TYPE_IP 0x0800 +#define VLAN_PRI_SHIFT 13 +#define VLAN_PRI_MASK 7 + + +struct ether_header { + uint8 ether_dhost[6]; + uint8 ether_shost[6]; + uint16 ether_type; +} __attribute__((packed)); + + +struct ethervlan_header { + uint8 ether_dhost[6]; + uint8 ether_shost[6]; + uint16 vlan_type; /* 0x8100 */ + uint16 vlan_tag; /* priority, cfi and vid */ + uint16 ether_type; +}; + +/* copy a pkt buffer chain into a buffer */ +uint +pktcopy(osl_t *osh, void *p, uint offset, int len, uchar *buf) +{ + uint n, ret = 0; + + if (len < 0) + len = 4096; /* "infinite" */ + + /* skip 'offset' bytes */ + for (; p && offset; p = PKTNEXT(osh, p)) { + if (offset < (uint)PKTLEN(osh, p)) + break; + offset -= PKTLEN(osh, p); + } + + if (!p) + return 0; + + /* copy the data */ + for (; p && len; p = PKTNEXT(osh, p)) { + n = MIN((uint)PKTLEN(osh, p) - offset, (uint)len); + bcopy(PKTDATA(osh, p) + offset, buf, n); + buf += n; + len -= n; + ret += n; + offset = 0; + } + + return ret; +} + +/* return total length of buffer chain */ +uint +pkttotlen(osl_t *osh, void *p) +{ + uint total; + + total = 0; + for (; p; p = PKTNEXT(osh, p)) + total += PKTLEN(osh, p); + return (total); +} + +/* return the last buffer of chained pkt */ +void * +pktlast(osl_t *osh, void *p) +{ + for (; PKTNEXT(osh, p); p = PKTNEXT(osh, p)) + ; + + return (p); +} + + +/* + * osl multiple-precedence packet queue + * hi_prec is always >= the number of the highest non-empty queue + */ +void * +pktq_penq(struct pktq *pq, int prec, void *p) +{ + struct pktq_prec *q; + + ASSERT(prec >= 0 && prec < pq->num_prec); + ASSERT(PKTLINK(p) == NULL); /* queueing chains not allowed */ + + ASSERT(!pktq_full(pq)); + ASSERT(!pktq_pfull(pq, prec)); + + q = &pq->q[prec]; + + if (q->head) + PKTSETLINK(q->tail, p); + else + q->head = p; + + q->tail = p; + q->len++; + + pq->len++; + + if (pq->hi_prec < prec) + pq->hi_prec = (uint8)prec; + + return p; +} + +void * +pktq_penq_head(struct pktq *pq, int prec, void *p) +{ + struct pktq_prec *q; + + ASSERT(prec >= 0 && prec < pq->num_prec); + ASSERT(PKTLINK(p) == NULL); /* queueing chains not allowed */ + + ASSERT(!pktq_full(pq)); + ASSERT(!pktq_pfull(pq, prec)); + + q = &pq->q[prec]; + + if (q->head == NULL) + q->tail = p; + + PKTSETLINK(p, q->head); + q->head = p; + q->len++; + + pq->len++; + + if (pq->hi_prec < prec) + pq->hi_prec = (uint8)prec; + + return p; +} + +void * +pktq_pdeq(struct pktq *pq, int prec) +{ + struct pktq_prec *q; + void *p; + + ASSERT(prec >= 0 && prec < pq->num_prec); + + q = &pq->q[prec]; + + if ((p = q->head) == NULL) + return NULL; + + if ((q->head = PKTLINK(p)) == NULL) + q->tail = NULL; + + q->len--; + + pq->len--; + + PKTSETLINK(p, NULL); + + return p; +} + +void * +pktq_pdeq_tail(struct pktq *pq, int prec) +{ + struct pktq_prec *q; + void *p, *prev; + + ASSERT(prec >= 0 && prec < pq->num_prec); + + q = &pq->q[prec]; + + if ((p = q->head) == NULL) + return NULL; + + for (prev = NULL; p != q->tail; p = PKTLINK(p)) + prev = p; + + if (prev) + PKTSETLINK(prev, NULL); + else + q->head = NULL; + + q->tail = prev; + q->len--; + + pq->len--; + + return p; +} + +void +pktq_pflush(osl_t *osh, struct pktq *pq, int prec, bool dir) +{ + struct pktq_prec *q; + void *p; + + q = &pq->q[prec]; + p = q->head; + while (p) { + q->head = PKTLINK(p); + PKTSETLINK(p, NULL); + PKTFREE(osh, p, dir); + q->len--; + pq->len--; + p = q->head; + } + ASSERT(q->len == 0); + q->tail = NULL; +} + +bool +pktq_pdel(struct pktq *pq, void *pktbuf, int prec) +{ + struct pktq_prec *q; + void *p; + + ASSERT(prec >= 0 && prec < pq->num_prec); + + if (!pktbuf) + return FALSE; + + q = &pq->q[prec]; + + if (q->head == pktbuf) { + if ((q->head = PKTLINK(pktbuf)) == NULL) + q->tail = NULL; + } else { + for (p = q->head; p && PKTLINK(p) != pktbuf; p = PKTLINK(p)) + ; + if (p == NULL) + return FALSE; + + PKTSETLINK(p, PKTLINK(pktbuf)); + if (q->tail == pktbuf) + q->tail = p; + } + + q->len--; + pq->len--; + PKTSETLINK(pktbuf, NULL); + return TRUE; +} + +void +pktq_init(struct pktq *pq, int num_prec, int max_len) +{ + int prec; + + ASSERT(num_prec > 0 && num_prec <= PKTQ_MAX_PREC); + + bzero(pq, sizeof(*pq)); + + pq->num_prec = (uint16)num_prec; + + pq->max = (uint16)max_len; + + for (prec = 0; prec < num_prec; prec++) + pq->q[prec].max = pq->max; +} + +void * +pktq_deq(struct pktq *pq, int *prec_out) +{ + struct pktq_prec *q; + void *p; + int prec; + + if (pq->len == 0) + return NULL; + + while ((prec = pq->hi_prec) > 0 && pq->q[prec].head == NULL) + pq->hi_prec--; + + q = &pq->q[prec]; + + if ((p = q->head) == NULL) + return NULL; + + if ((q->head = PKTLINK(p)) == NULL) + q->tail = NULL; + + q->len--; + + pq->len--; + + if (prec_out) + *prec_out = prec; + + PKTSETLINK(p, NULL); + + return p; +} + +void * +pktq_deq_tail(struct pktq *pq, int *prec_out) +{ + struct pktq_prec *q; + void *p, *prev; + int prec; + + if (pq->len == 0) + return NULL; + + for (prec = 0; prec < pq->hi_prec; prec++) + if (pq->q[prec].head) + break; + + q = &pq->q[prec]; + + if ((p = q->head) == NULL) + return NULL; + + for (prev = NULL; p != q->tail; p = PKTLINK(p)) + prev = p; + + if (prev) + PKTSETLINK(prev, NULL); + else + q->head = NULL; + + q->tail = prev; + q->len--; + + pq->len--; + + if (prec_out) + *prec_out = prec; + + PKTSETLINK(p, NULL); + + return p; +} + +void * +pktq_peek(struct pktq *pq, int *prec_out) +{ + int prec; + + if (pq->len == 0) + return NULL; + + while ((prec = pq->hi_prec) > 0 && pq->q[prec].head == NULL) + pq->hi_prec--; + + if (prec_out) + *prec_out = prec; + + return (pq->q[prec].head); +} + +void * +pktq_peek_tail(struct pktq *pq, int *prec_out) +{ + int prec; + + if (pq->len == 0) + return NULL; + + for (prec = 0; prec < pq->hi_prec; prec++) + if (pq->q[prec].head) + break; + + if (prec_out) + *prec_out = prec; + + return (pq->q[prec].tail); +} + +void +pktq_flush(osl_t *osh, struct pktq *pq, bool dir) +{ + int prec; + for (prec = 0; prec < pq->num_prec; prec++) + pktq_pflush(osh, pq, prec, dir); + ASSERT(pq->len == 0); +} + +/* Return sum of lengths of a specific set of precedences */ +int +pktq_mlen(struct pktq *pq, uint prec_bmp) +{ + int prec, len; + + len = 0; + + for (prec = 0; prec <= pq->hi_prec; prec++) + if (prec_bmp & (1 << prec)) + len += pq->q[prec].len; + + return len; +} + +/* Priority dequeue from a specific set of precedences */ +void * +pktq_mdeq(struct pktq *pq, uint prec_bmp, int *prec_out) +{ + struct pktq_prec *q; + void *p; + int prec; + + if (pq->len == 0) + return NULL; + + while ((prec = pq->hi_prec) > 0 && pq->q[prec].head == NULL) + pq->hi_prec--; + + while ((prec_bmp & (1 << prec)) == 0 || pq->q[prec].head == NULL) + if (prec-- == 0) + return NULL; + + q = &pq->q[prec]; + + if ((p = q->head) == NULL) + return NULL; + + if ((q->head = PKTLINK(p)) == NULL) + q->tail = NULL; + + q->len--; + + if (prec_out) + *prec_out = prec; + + pq->len--; + + PKTSETLINK(p, NULL); + + return p; +} + +char* +bcmstrcat(char *dest, const char *src) +{ + strcpy(&dest[strlen(dest)], src); + return (dest); +} + +char* +bcm_ether_ntoa(struct ether_addr *ea, char *buf) +{ + sprintf(buf, "%02x:%02x:%02x:%02x:%02x:%02x", + ea->octet[0]&0xff, ea->octet[1]&0xff, ea->octet[2]&0xff, + ea->octet[3]&0xff, ea->octet[4]&0xff, ea->octet[5]&0xff); + return (buf); +} + +/* parse a xx:xx:xx:xx:xx:xx format ethernet address */ +int +bcm_ether_atoe(char *p, struct ether_addr *ea) +{ + int i = 0; + + for (;;) { + ea->octet[i++] = (char) bcm_strtoul(p, &p, 16); + if (!*p++ || i == 6) + break; + } + + return (i == 6); +} + +/* Takes an Ethernet frame and sets out-of-bound PKTPRIO + * Also updates the inplace vlan tag if requested + */ +void +pktsetprio(void *pkt, bool update_vtag) +{ + struct ether_header *eh; + struct ethervlan_header *evh; + uint8 *pktdata; + int priority = 0; + + pktdata = (uint8 *) PKTDATA(NULL, pkt); + ASSERT(ISALIGNED((uintptr)pktdata, sizeof(uint16))); + + eh = (struct ether_header *) pktdata; + + if (ntoh16(eh->ether_type) == ETHER_TYPE_8021Q) { + uint16 vlan_tag; + int vlan_prio, dscp_prio = 0; + + evh = (struct ethervlan_header *)eh; + + vlan_tag = ntoh16(evh->vlan_tag); + vlan_prio = (int) (vlan_tag >> VLAN_PRI_SHIFT) & VLAN_PRI_MASK; + + if (ntoh16(evh->ether_type) == ETHER_TYPE_IP) { + uint8 *ip_body = pktdata + sizeof(struct ethervlan_header); + uint8 tos_tc = IP_TOS(ip_body); + dscp_prio = (int)(tos_tc >> IPV4_TOS_PREC_SHIFT); + } + + /* DSCP priority gets precedence over 802.1P (vlan tag) */ + priority = (dscp_prio != 0) ? dscp_prio : vlan_prio; + + /* + * If the DSCP priority is not the same as the VLAN priority, + * then overwrite the priority field in the vlan tag, with the + * DSCP priority value. This is required for Linux APs because + * the VLAN driver on Linux, overwrites the skb->priority field + * with the priority value in the vlan tag + */ + if (update_vtag && (priority != vlan_prio)) { + vlan_tag &= ~(VLAN_PRI_MASK << VLAN_PRI_SHIFT); + vlan_tag |= (uint16)priority << VLAN_PRI_SHIFT; + evh->vlan_tag = hton16(vlan_tag); + } + } else if (ntoh16(eh->ether_type) == ETHER_TYPE_IP) { + uint8 *ip_body = pktdata + sizeof(struct ether_header); + uint8 tos_tc = IP_TOS(ip_body); + priority = (int)(tos_tc >> IPV4_TOS_PREC_SHIFT); + } + + ASSERT(priority >= 0 && priority <= MAXPRIO); + PKTSETPRIO(pkt, priority); +} + +static char bcm_undeferrstr[BCME_STRLEN]; + +static const char *bcmerrorstrtable[] = BCMERRSTRINGTABLE; + +/* Convert the Error codes into related Error strings */ +const char * +bcmerrorstr(int bcmerror) +{ + int abs_bcmerror; + + abs_bcmerror = ABS(bcmerror); + + /* check if someone added a bcmerror code but forgot to add errorstring */ + ASSERT(ABS(BCME_LAST) == (ARRAYSIZE(bcmerrorstrtable) - 1)); + if ((bcmerror > 0) || (abs_bcmerror > ABS(BCME_LAST))) { + sprintf(bcm_undeferrstr, "undefined Error %d", bcmerror); + return bcm_undeferrstr; + } + + ASSERT((strlen((char*)bcmerrorstrtable[abs_bcmerror])) < BCME_STRLEN); + + return bcmerrorstrtable[abs_bcmerror]; +} + + +int +bcm_iovar_lencheck(const bcm_iovar_t *vi, void *arg, int len, bool set) +{ + int bcmerror = 0; + + /* length check on io buf */ + switch (vi->type) { + case IOVT_BOOL: + case IOVT_INT8: + case IOVT_INT16: + case IOVT_INT32: + case IOVT_UINT8: + case IOVT_UINT16: + case IOVT_UINT32: + /* all integers are int32 sized args at the ioctl interface */ + if (len < (int)sizeof(int)) { + bcmerror = BCME_BUFTOOSHORT; + } + break; + + case IOVT_BUFFER: + /* buffer must meet minimum length requirement */ + if (len < vi->minlen) { + bcmerror = BCME_BUFTOOSHORT; + } + break; + + case IOVT_VOID: + if (!set) { + /* Cannot return nil... */ + bcmerror = BCME_UNSUPPORTED; + } else if (len) { + /* Set is an action w/o parameters */ + bcmerror = BCME_BUFTOOLONG; + } + break; + + default: + /* unknown type for length check in iovar info */ + ASSERT(0); + bcmerror = BCME_UNSUPPORTED; + } + + return bcmerror; +} + +#define CRC_INNER_LOOP(n, c, x) \ + (c) = ((c) >> 8) ^ crc##n##_table[((c) ^ (x)) & 0xff] + +static uint32 crc32_table[256] = { + 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, + 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, + 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, + 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, + 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, + 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, + 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, + 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, + 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, + 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, + 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, + 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, + 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, + 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, + 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, + 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, + 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, + 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, + 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, + 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, + 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, + 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, + 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, + 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, + 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, + 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, + 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, + 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, + 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, + 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, + 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, + 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, + 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, + 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, + 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, + 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, + 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, + 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, + 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, + 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, + 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, + 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, + 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, + 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, + 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, + 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, + 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, + 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, + 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, + 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, + 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, + 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, + 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, + 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, + 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, + 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, + 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, + 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, + 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, + 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, + 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, + 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, + 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, + 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D +}; + +uint32 +hndcrc32( + uint8 *pdata, /* pointer to array of data to process */ + uint nbytes, /* number of input data bytes to process */ + uint32 crc /* either CRC32_INIT_VALUE or previous return value */ +) +{ + uint8 *pend; +#ifdef __mips__ + uint8 tmp[4]; + ulong *tptr = (ulong *)tmp; + + /* in case the beginning of the buffer isn't aligned */ + pend = (uint8 *)((uint)(pdata + 3) & 0xfffffffc); + nbytes -= (pend - pdata); + while (pdata < pend) + CRC_INNER_LOOP(32, crc, *pdata++); + + /* handle bulk of data as 32-bit words */ + pend = pdata + (nbytes & 0xfffffffc); + while (pdata < pend) { + *tptr = *(ulong *)pdata; + pdata += sizeof(ulong *); + CRC_INNER_LOOP(32, crc, tmp[0]); + CRC_INNER_LOOP(32, crc, tmp[1]); + CRC_INNER_LOOP(32, crc, tmp[2]); + CRC_INNER_LOOP(32, crc, tmp[3]); + } + + /* 1-3 bytes at end of buffer */ + pend = pdata + (nbytes & 0x03); + while (pdata < pend) + CRC_INNER_LOOP(32, crc, *pdata++); +#else + pend = pdata + nbytes; + while (pdata < pend) + CRC_INNER_LOOP(32, crc, *pdata++); +#endif /* __mips__ */ + + return crc; +} + + +/* + * Advance from the current 1-byte tag/1-byte length/variable-length value + * triple, to the next, returning a pointer to the next. + * If the current or next TLV is invalid (does not fit in given buffer length), + * NULL is returned. + * *buflen is not modified if the TLV elt parameter is invalid, or is decremented + * by the TLV paramter's length if it is valid. + */ +bcm_tlv_t * +bcm_next_tlv(bcm_tlv_t *elt, int *buflen) +{ + int len; + + /* validate current elt */ + if (!bcm_valid_tlv(elt, *buflen)) + return NULL; + + /* advance to next elt */ + len = elt->len; + elt = (bcm_tlv_t*)(elt->data + len); + *buflen -= (2 + len); + + /* validate next elt */ + if (!bcm_valid_tlv(elt, *buflen)) + return NULL; + + return elt; +} + +/* + * Traverse a string of 1-byte tag/1-byte length/variable-length value + * triples, returning a pointer to the substring whose first element + * matches tag + */ +bcm_tlv_t * +bcm_parse_tlvs(void *buf, int buflen, uint key) +{ + bcm_tlv_t *elt; + int totlen; + + elt = (bcm_tlv_t*)buf; + totlen = buflen; + + /* find tagged parameter */ + while (totlen >= 2) { + int len = elt->len; + + /* validate remaining totlen */ + if ((elt->id == key) && (totlen >= (len + 2))) + return (elt); + + elt = (bcm_tlv_t*)((uint8*)elt + (len + 2)); + totlen -= (len + 2); + } + + return NULL; +} + +/* + * Traverse a string of 1-byte tag/1-byte length/variable-length value + * triples, returning a pointer to the substring whose first element + * matches tag. Stop parsing when we see an element whose ID is greater + * than the target key. + */ +bcm_tlv_t * +bcm_parse_ordered_tlvs(void *buf, int buflen, uint key) +{ + bcm_tlv_t *elt; + int totlen; + + elt = (bcm_tlv_t*)buf; + totlen = buflen; + + /* find tagged parameter */ + while (totlen >= 2) { + uint id = elt->id; + int len = elt->len; + + /* Punt if we start seeing IDs > than target key */ + if (id > key) + return (NULL); + + /* validate remaining totlen */ + if ((id == key) && (totlen >= (len + 2))) + return (elt); + + elt = (bcm_tlv_t*)((uint8*)elt + (len + 2)); + totlen -= (len + 2); + } + return NULL; +} + + +/* Initialization of bcmstrbuf structure */ +void +bcm_binit(struct bcmstrbuf *b, char *buf, uint size) +{ + b->origsize = b->size = size; + b->origbuf = b->buf = buf; +} + +/* Buffer sprintf wrapper to guard against buffer overflow */ +int +bcm_bprintf(struct bcmstrbuf *b, const char *fmt, ...) +{ + va_list ap; + int r; + + va_start(ap, fmt); + r = vsnprintf(b->buf, b->size, fmt, ap); + + /* Non Ansi C99 compliant returns -1, + * Ansi compliant return r >= b->size, + * bcmstdlib returns 0, handle all + */ + if ((r == -1) || (r >= (int)b->size) || (r == 0)) + { + b->size = 0; + } + else + { + b->size -= r; + b->buf += r; + } + + va_end(ap); + + return r; +} diff --git a/package/broadcom-wl/src/kmod/hnddma.c b/package/broadcom-wl/src/kmod/hnddma.c new file mode 100644 index 0000000000..4336560888 --- /dev/null +++ b/package/broadcom-wl/src/kmod/hnddma.c @@ -0,0 +1,1157 @@ +/* + * Generic Broadcom Home Networking Division (HND) DMA module. + * This supports the following chips: BCM42xx, 44xx, 47xx . + * + * Copyright 2006, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * + * $Id: hnddma.c,v 1.11 2006/04/08 07:12:42 honor Exp $ + */ + +#include <typedefs.h> +#include <bcmdefs.h> +#include <osl.h> +#include "linux_osl.h" +#include <bcmendian.h> +#include <sbconfig.h> +#include <bcmutils.h> +#include <bcmdevs.h> +#include <sbutils.h> + +#include "sbhnddma.h" +#include "hnddma.h" + +/* debug/trace */ +#define DMA_ERROR(args) +#define DMA_TRACE(args) + +/* default dma message level (if input msg_level pointer is null in dma_attach()) */ +static uint dma_msg_level = + 0; + +#define MAXNAMEL 8 /* 8 char names */ + +#define DI_INFO(dmah) (dma_info_t *)dmah + +/* dma engine software state */ +typedef struct dma_info { + struct hnddma_pub hnddma; /* exported structure, don't use hnddma_t, + * which could be const + */ + uint *msg_level; /* message level pointer */ + char name[MAXNAMEL]; /* callers name for diag msgs */ + + void *osh; /* os handle */ + sb_t *sbh; /* sb handle */ + + bool dma64; /* dma64 enabled */ + bool addrext; /* this dma engine supports DmaExtendedAddrChanges */ + + dma32regs_t *d32txregs; /* 32 bits dma tx engine registers */ + dma32regs_t *d32rxregs; /* 32 bits dma rx engine registers */ + dma64regs_t *d64txregs; /* 64 bits dma tx engine registers */ + dma64regs_t *d64rxregs; /* 64 bits dma rx engine registers */ + + uint32 dma64align; /* either 8k or 4k depends on number of dd */ + dma32dd_t *txd32; /* pointer to dma32 tx descriptor ring */ + dma64dd_t *txd64; /* pointer to dma64 tx descriptor ring */ + uint ntxd; /* # tx descriptors tunable */ + uint txin; /* index of next descriptor to reclaim */ + uint txout; /* index of next descriptor to post */ + void **txp; /* pointer to parallel array of pointers to packets */ + osldma_t *tx_dmah; /* DMA TX descriptor ring handle */ + osldma_t **txp_dmah; /* DMA TX packet data handle */ + ulong txdpa; /* physical address of descriptor ring */ + uint txdalign; /* #bytes added to alloc'd mem to align txd */ + uint txdalloc; /* #bytes allocated for the ring */ + + dma32dd_t *rxd32; /* pointer to dma32 rx descriptor ring */ + dma64dd_t *rxd64; /* pointer to dma64 rx descriptor ring */ + uint nrxd; /* # rx descriptors tunable */ + uint rxin; /* index of next descriptor to reclaim */ + uint rxout; /* index of next descriptor to post */ + void **rxp; /* pointer to parallel array of pointers to packets */ + osldma_t *rx_dmah; /* DMA RX descriptor ring handle */ + osldma_t **rxp_dmah; /* DMA RX packet data handle */ + ulong rxdpa; /* physical address of descriptor ring */ + uint rxdalign; /* #bytes added to alloc'd mem to align rxd */ + uint rxdalloc; /* #bytes allocated for the ring */ + + /* tunables */ + uint rxbufsize; /* rx buffer size in bytes, + not including the extra headroom + */ + uint nrxpost; /* # rx buffers to keep posted */ + uint rxoffset; /* rxcontrol offset */ + uint ddoffsetlow; /* add to get dma address of descriptor ring, low 32 bits */ + uint ddoffsethigh; /* high 32 bits */ + uint dataoffsetlow; /* add to get dma address of data buffer, low 32 bits */ + uint dataoffsethigh; /* high 32 bits */ +} dma_info_t; + +/* descriptor bumping macros */ +#define XXD(x, n) ((x) & ((n) - 1)) /* faster than %, but n must be power of 2 */ +#define TXD(x) XXD((x), di->ntxd) +#define RXD(x) XXD((x), di->nrxd) +#define NEXTTXD(i) TXD(i + 1) +#define PREVTXD(i) TXD(i - 1) +#define NEXTRXD(i) RXD(i + 1) +#define NTXDACTIVE(h, t) TXD(t - h) +#define NRXDACTIVE(h, t) RXD(t - h) + +/* macros to convert between byte offsets and indexes */ +#define B2I(bytes, type) ((bytes) / sizeof(type)) +#define I2B(index, type) ((index) * sizeof(type)) + +#define PCI32ADDR_HIGH 0xc0000000 /* address[31:30] */ +#define PCI32ADDR_HIGH_SHIFT 30 /* address[31:30] */ + + +/* common prototypes */ +static bool _dma_isaddrext(dma_info_t *di); +static bool dma32_alloc(dma_info_t *di, uint direction); +static void _dma_detach(dma_info_t *di); +static void _dma_ddtable_init(dma_info_t *di, uint direction, ulong pa); +static void _dma_rxinit(dma_info_t *di); +static void *_dma_rx(dma_info_t *di); +static void _dma_rxfill(dma_info_t *di); +static void _dma_rxreclaim(dma_info_t *di); +static void _dma_rxenable(dma_info_t *di); +static void * _dma_getnextrxp(dma_info_t *di, bool forceall); + +static void _dma_txblock(dma_info_t *di); +static void _dma_txunblock(dma_info_t *di); +static uint _dma_txactive(dma_info_t *di); + +static void* _dma_peeknexttxp(dma_info_t *di); +static uintptr _dma_getvar(dma_info_t *di, char *name); +static void _dma_counterreset(dma_info_t *di); +static void _dma_fifoloopbackenable(dma_info_t *di); + +/* ** 32 bit DMA prototypes */ +static bool dma32_alloc(dma_info_t *di, uint direction); +static bool dma32_txreset(dma_info_t *di); +static bool dma32_rxreset(dma_info_t *di); +static bool dma32_txsuspendedidle(dma_info_t *di); +static int dma32_txfast(dma_info_t *di, void *p0, bool commit); +static void *dma32_getnexttxp(dma_info_t *di, bool forceall); +static void *dma32_getnextrxp(dma_info_t *di, bool forceall); +static void dma32_txrotate(dma_info_t *di); +static bool dma32_rxidle(dma_info_t *di); +static void dma32_txinit(dma_info_t *di); +static bool dma32_txenabled(dma_info_t *di); +static void dma32_txsuspend(dma_info_t *di); +static void dma32_txresume(dma_info_t *di); +static bool dma32_txsuspended(dma_info_t *di); +static void dma32_txreclaim(dma_info_t *di, bool forceall); +static bool dma32_txstopped(dma_info_t *di); +static bool dma32_rxstopped(dma_info_t *di); +static bool dma32_rxenabled(dma_info_t *di); +static bool _dma32_addrext(osl_t *osh, dma32regs_t *dma32regs); + + +static di_fcn_t dma32proc = { + (di_detach_t)_dma_detach, + (di_txinit_t)dma32_txinit, + (di_txreset_t)dma32_txreset, + (di_txenabled_t)dma32_txenabled, + (di_txsuspend_t)dma32_txsuspend, + (di_txresume_t)dma32_txresume, + (di_txsuspended_t)dma32_txsuspended, + (di_txsuspendedidle_t)dma32_txsuspendedidle, + (di_txfast_t)dma32_txfast, + (di_txstopped_t)dma32_txstopped, + (di_txreclaim_t)dma32_txreclaim, + (di_getnexttxp_t)dma32_getnexttxp, + (di_peeknexttxp_t)_dma_peeknexttxp, + (di_txblock_t)_dma_txblock, + (di_txunblock_t)_dma_txunblock, + (di_txactive_t)_dma_txactive, + (di_txrotate_t)dma32_txrotate, + + (di_rxinit_t)_dma_rxinit, + (di_rxreset_t)dma32_rxreset, + (di_rxidle_t)dma32_rxidle, + (di_rxstopped_t)dma32_rxstopped, + (di_rxenable_t)_dma_rxenable, + (di_rxenabled_t)dma32_rxenabled, + (di_rx_t)_dma_rx, + (di_rxfill_t)_dma_rxfill, + (di_rxreclaim_t)_dma_rxreclaim, + (di_getnextrxp_t)_dma_getnextrxp, + + (di_fifoloopbackenable_t)_dma_fifoloopbackenable, + (di_getvar_t)_dma_getvar, + (di_counterreset_t)_dma_counterreset, + + NULL, + NULL, + NULL, + 34 +}; + +hnddma_t * +dma_attach(osl_t *osh, char *name, sb_t *sbh, void *dmaregstx, void *dmaregsrx, + uint ntxd, uint nrxd, uint rxbufsize, uint nrxpost, uint rxoffset, uint *msg_level) +{ + dma_info_t *di; + uint size; + + /* allocate private info structure */ + if ((di = MALLOC(osh, sizeof (dma_info_t))) == NULL) { + return (NULL); + } + bzero((char *)di, sizeof(dma_info_t)); + + di->msg_level = msg_level ? msg_level : &dma_msg_level; + + /* old chips w/o sb is no longer supported */ + ASSERT(sbh != NULL); + + /* check arguments */ + ASSERT(ISPOWEROF2(ntxd)); + ASSERT(ISPOWEROF2(nrxd)); + if (nrxd == 0) + ASSERT(dmaregsrx == NULL); + if (ntxd == 0) + ASSERT(dmaregstx == NULL); + + + /* init dma reg pointer */ + ASSERT(ntxd <= D32MAXDD); + ASSERT(nrxd <= D32MAXDD); + di->d32txregs = (dma32regs_t *)dmaregstx; + di->d32rxregs = (dma32regs_t *)dmaregsrx; + + DMA_TRACE(("%s: dma_attach: %s osh %p ntxd %d nrxd %d rxbufsize %d nrxpost %d " + "rxoffset %d dmaregstx %p dmaregsrx %p\n", + name, "DMA32", osh, ntxd, nrxd, rxbufsize, + nrxpost, rxoffset, dmaregstx, dmaregsrx)); + + /* make a private copy of our callers name */ + strncpy(di->name, name, MAXNAMEL); + di->name[MAXNAMEL-1] = '\0'; + + di->osh = osh; + di->sbh = sbh; + + /* save tunables */ + di->ntxd = ntxd; + di->nrxd = nrxd; + + /* the actual dma size doesn't include the extra headroom */ + if (rxbufsize > BCMEXTRAHDROOM) + di->rxbufsize = rxbufsize - BCMEXTRAHDROOM; + else + di->rxbufsize = rxbufsize; + + di->nrxpost = nrxpost; + di->rxoffset = rxoffset; + + /* + * figure out the DMA physical address offset for dd and data + * for old chips w/o sb, use zero + * for new chips w sb, + * PCI/PCIE: they map silicon backplace address to zero based memory, need offset + * Other bus: use zero + * SB_BUS BIGENDIAN kludge: use sdram swapped region for data buffer, not descriptor + */ + di->ddoffsetlow = 0; + di->dataoffsetlow = 0; + /* for pci bus, add offset */ + if (sbh->bustype == PCI_BUS) { + di->ddoffsetlow = SB_PCI_DMA; + di->ddoffsethigh = 0; + di->dataoffsetlow = di->ddoffsetlow; + di->dataoffsethigh = di->ddoffsethigh; + } + +#if defined(__mips__) && defined(IL_BIGENDIAN) + di->dataoffsetlow = di->dataoffsetlow + SB_SDRAM_SWAPPED; +#endif + + di->addrext = _dma_isaddrext(di); + + /* allocate tx packet pointer vector */ + if (ntxd) { + size = ntxd * sizeof(void *); + if ((di->txp = MALLOC(osh, size)) == NULL) { + DMA_ERROR(("%s: dma_attach: out of tx memory, malloced %d bytes\n", + di->name, MALLOCED(osh))); + goto fail; + } + bzero((char *)di->txp, size); + } + + /* allocate rx packet pointer vector */ + if (nrxd) { + size = nrxd * sizeof(void *); + if ((di->rxp = MALLOC(osh, size)) == NULL) { + DMA_ERROR(("%s: dma_attach: out of rx memory, malloced %d bytes\n", + di->name, MALLOCED(osh))); + goto fail; + } + bzero((char *)di->rxp, size); + } + + /* allocate transmit descriptor ring, only need ntxd descriptors but it must be aligned */ + if (ntxd) { + if (!dma32_alloc(di, DMA_TX)) + goto fail; + } + + /* allocate receive descriptor ring, only need nrxd descriptors but it must be aligned */ + if (nrxd) { + if (!dma32_alloc(di, DMA_RX)) + goto fail; + } + + if ((di->ddoffsetlow == SB_PCI_DMA) && (di->txdpa > SB_PCI_DMA_SZ) && !di->addrext) { + DMA_ERROR(("%s: dma_attach: txdpa 0x%lx: addrext not supported\n", + di->name, di->txdpa)); + goto fail; + } + if ((di->ddoffsetlow == SB_PCI_DMA) && (di->rxdpa > SB_PCI_DMA_SZ) && !di->addrext) { + DMA_ERROR(("%s: dma_attach: rxdpa 0x%lx: addrext not supported\n", + di->name, di->rxdpa)); + goto fail; + } + + DMA_TRACE(("ddoffsetlow 0x%x ddoffsethigh 0x%x dataoffsetlow 0x%x dataoffsethigh " + "0x%x addrext %d\n", di->ddoffsetlow, di->ddoffsethigh, di->dataoffsetlow, + di->dataoffsethigh, di->addrext)); + + /* allocate tx packet pointer vector and DMA mapping vectors */ + if (ntxd) { + + size = ntxd * sizeof(osldma_t **); + if ((di->txp_dmah = (osldma_t **)MALLOC(osh, size)) == NULL) + goto fail; + bzero((char*)di->txp_dmah, size); + }else + di->txp_dmah = NULL; + + /* allocate rx packet pointer vector and DMA mapping vectors */ + if (nrxd) { + + size = nrxd * sizeof(osldma_t **); + if ((di->rxp_dmah = (osldma_t **)MALLOC(osh, size)) == NULL) + goto fail; + bzero((char*)di->rxp_dmah, size); + + } else + di->rxp_dmah = NULL; + + /* initialize opsvec of function pointers */ + di->hnddma.di_fn = dma32proc; + + return ((hnddma_t *)di); + +fail: + _dma_detach(di); + return (NULL); +} + +/* init the tx or rx descriptor */ +static INLINE void +dma32_dd_upd(dma_info_t *di, dma32dd_t *ddring, ulong pa, uint outidx, uint32 *flags, + uint32 bufcount) +{ + /* dma32 uses 32 bits control to fit both flags and bufcounter */ + *flags = *flags | (bufcount & CTRL_BC_MASK); + + if ((di->dataoffsetlow != SB_PCI_DMA) || !(pa & PCI32ADDR_HIGH)) { + W_SM(&ddring[outidx].addr, BUS_SWAP32(pa + di->dataoffsetlow)); + W_SM(&ddring[outidx].ctrl, BUS_SWAP32(*flags)); + } else { + /* address extension */ + uint32 ae; + ASSERT(di->addrext); + ae = (pa & PCI32ADDR_HIGH) >> PCI32ADDR_HIGH_SHIFT; + pa &= ~PCI32ADDR_HIGH; + + *flags |= (ae << CTRL_AE_SHIFT); + W_SM(&ddring[outidx].addr, BUS_SWAP32(pa + di->dataoffsetlow)); + W_SM(&ddring[outidx].ctrl, BUS_SWAP32(*flags)); + } +} + +static bool +_dma32_addrext(osl_t *osh, dma32regs_t *dma32regs) +{ + uint32 w; + + OR_REG(osh, &dma32regs->control, XC_AE); + w = R_REG(osh, &dma32regs->control); + AND_REG(osh, &dma32regs->control, ~XC_AE); + return ((w & XC_AE) == XC_AE); +} + +/* !! may be called with core in reset */ +static void +_dma_detach(dma_info_t *di) +{ + if (di == NULL) + return; + + DMA_TRACE(("%s: dma_detach\n", di->name)); + + /* shouldn't be here if descriptors are unreclaimed */ + ASSERT(di->txin == di->txout); + ASSERT(di->rxin == di->rxout); + + /* free dma descriptor rings */ + if (di->txd32) + DMA_FREE_CONSISTENT(di->osh, ((int8*)di->txd32 - di->txdalign), + di->txdalloc, (di->txdpa - di->txdalign), &di->tx_dmah); + if (di->rxd32) + DMA_FREE_CONSISTENT(di->osh, ((int8*)di->rxd32 - di->rxdalign), + di->rxdalloc, (di->rxdpa - di->rxdalign), &di->rx_dmah); + + /* free packet pointer vectors */ + if (di->txp) + MFREE(di->osh, (void *)di->txp, (di->ntxd * sizeof(void *))); + if (di->rxp) + MFREE(di->osh, (void *)di->rxp, (di->nrxd * sizeof(void *))); + + /* free tx packet DMA handles */ + if (di->txp_dmah) + MFREE(di->osh, (void *)di->txp_dmah, di->ntxd * sizeof(osldma_t **)); + + /* free rx packet DMA handles */ + if (di->rxp_dmah) + MFREE(di->osh, (void *)di->rxp_dmah, di->nrxd * sizeof(osldma_t **)); + + /* free our private info structure */ + MFREE(di->osh, (void *)di, sizeof(dma_info_t)); + +} + +/* return TRUE if this dma engine supports DmaExtendedAddrChanges, otherwise FALSE */ +static bool +_dma_isaddrext(dma_info_t *di) +{ + if (di->d32txregs) + return (_dma32_addrext(di->osh, di->d32txregs)); + else if (di->d32rxregs) + return (_dma32_addrext(di->osh, di->d32rxregs)); + return FALSE; +} + +/* initialize descriptor table base address */ +static void +_dma_ddtable_init(dma_info_t *di, uint direction, ulong pa) +{ + if ((di->ddoffsetlow != SB_PCI_DMA) || !(pa & PCI32ADDR_HIGH)) { + if (direction == DMA_TX) + W_REG(di->osh, &di->d32txregs->addr, (pa + di->ddoffsetlow)); + else + W_REG(di->osh, &di->d32rxregs->addr, (pa + di->ddoffsetlow)); + } else { + /* dma32 address extension */ + uint32 ae; + ASSERT(di->addrext); + + /* shift the high bit(s) from pa to ae */ + ae = (pa & PCI32ADDR_HIGH) >> PCI32ADDR_HIGH_SHIFT; + pa &= ~PCI32ADDR_HIGH; + + if (direction == DMA_TX) { + W_REG(di->osh, &di->d32txregs->addr, (pa + di->ddoffsetlow)); + SET_REG(di->osh, &di->d32txregs->control, XC_AE, ae <<XC_AE_SHIFT); + } else { + W_REG(di->osh, &di->d32rxregs->addr, (pa + di->ddoffsetlow)); + SET_REG(di->osh, &di->d32rxregs->control, RC_AE, ae <<RC_AE_SHIFT); + } + } +} + +static void +_dma_fifoloopbackenable(dma_info_t *di) +{ + DMA_TRACE(("%s: dma_fifoloopbackenable\n", di->name)); + OR_REG(di->osh, &di->d32txregs->control, XC_LE); +} + +static void +_dma_rxinit(dma_info_t *di) +{ + DMA_TRACE(("%s: dma_rxinit\n", di->name)); + + if (di->nrxd == 0) + return; + + di->rxin = di->rxout = 0; + + /* clear rx descriptor ring */ + BZERO_SM((void *)di->rxd32, (di->nrxd * sizeof(dma32dd_t))); + _dma_rxenable(di); + _dma_ddtable_init(di, DMA_RX, di->rxdpa); +} + +static void +_dma_rxenable(dma_info_t *di) +{ + DMA_TRACE(("%s: dma_rxenable\n", di->name)); + + W_REG(di->osh, &di->d32rxregs->control, ((di->rxoffset << RC_RO_SHIFT) | RC_RE)); +} + +/* !! rx entry routine, returns a pointer to the next frame received, + * or NULL if there are no more + */ +static void * +_dma_rx(dma_info_t *di) +{ + void *p; + uint len; + int skiplen = 0; + + while ((p = _dma_getnextrxp(di, FALSE))) { + /* skip giant packets which span multiple rx descriptors */ + if (skiplen > 0) { + skiplen -= di->rxbufsize; + if (skiplen < 0) + skiplen = 0; + PKTFREE(di->osh, p, FALSE); + continue; + } + + len = ltoh16(*(uint16*)(PKTDATA(di->osh, p))); + DMA_TRACE(("%s: dma_rx len %d\n", di->name, len)); + + /* bad frame length check */ + if (len > (di->rxbufsize - di->rxoffset)) { + DMA_ERROR(("%s: dma_rx: bad frame length (%d)\n", di->name, len)); + if (len > 0) + skiplen = len - (di->rxbufsize - di->rxoffset); + PKTFREE(di->osh, p, FALSE); + di->hnddma.rxgiants++; + continue; + } + + /* set actual length */ + PKTSETLEN(di->osh, p, (di->rxoffset + len)); + + break; + } + + return (p); +} + +/* post receive buffers */ +static void +_dma_rxfill(dma_info_t *di) +{ + void *p; + uint rxin, rxout; + uint32 flags = 0; + uint n; + uint i; + uint32 pa; + uint extra_offset = 0; + + /* + * Determine how many receive buffers we're lacking + * from the full complement, allocate, initialize, + * and post them, then update the chip rx lastdscr. + */ + + rxin = di->rxin; + rxout = di->rxout; + + n = di->nrxpost - NRXDACTIVE(rxin, rxout); + + DMA_TRACE(("%s: dma_rxfill: post %d\n", di->name, n)); + + if (di->rxbufsize > BCMEXTRAHDROOM) + extra_offset = BCMEXTRAHDROOM; + + for (i = 0; i < n; i++) { + /* the di->rxbufsize doesn't include the extra headroom, we need to add it to the + size to be allocated + */ + if ((p = PKTGET(di->osh, di->rxbufsize + extra_offset, + FALSE)) == NULL) { + DMA_ERROR(("%s: dma_rxfill: out of rxbufs\n", di->name)); + di->hnddma.rxnobuf++; + break; + } + /* reserve an extra headroom, if applicable */ + if (extra_offset) + PKTPULL(di->osh, p, extra_offset); + + /* Do a cached write instead of uncached write since DMA_MAP + * will flush the cache. + */ + *(uint32*)(PKTDATA(di->osh, p)) = 0; + + pa = (uint32) DMA_MAP(di->osh, PKTDATA(di->osh, p), + di->rxbufsize, DMA_RX, p); + + ASSERT(ISALIGNED(pa, 4)); + + /* save the free packet pointer */ + ASSERT(di->rxp[rxout] == NULL); + di->rxp[rxout] = p; + + /* reset flags for each descriptor */ + flags = 0; + if (rxout == (di->nrxd - 1)) + flags = CTRL_EOT; + dma32_dd_upd(di, di->rxd32, pa, rxout, &flags, di->rxbufsize); + rxout = NEXTRXD(rxout); + } + + di->rxout = rxout; + + /* update the chip lastdscr pointer */ + W_REG(di->osh, &di->d32rxregs->ptr, I2B(rxout, dma32dd_t)); +} + +/* like getnexttxp but no reclaim */ +static void * +_dma_peeknexttxp(dma_info_t *di) +{ + uint end, i; + + if (di->ntxd == 0) + return (NULL); + + end = B2I(R_REG(di->osh, &di->d32txregs->status) & XS_CD_MASK, dma32dd_t); + + for (i = di->txin; i != end; i = NEXTTXD(i)) + if (di->txp[i]) + return (di->txp[i]); + + return (NULL); +} + +static void +_dma_rxreclaim(dma_info_t *di) +{ + void *p; + + /* "unused local" warning suppression for OSLs that + * define PKTFREE() without using the di->osh arg + */ + di = di; + + DMA_TRACE(("%s: dma_rxreclaim\n", di->name)); + + while ((p = _dma_getnextrxp(di, TRUE))) + PKTFREE(di->osh, p, FALSE); +} + +static void * +_dma_getnextrxp(dma_info_t *di, bool forceall) +{ + if (di->nrxd == 0) + return (NULL); + + return dma32_getnextrxp(di, forceall); +} + +static void +_dma_txblock(dma_info_t *di) +{ + di->hnddma.txavail = 0; +} + +static void +_dma_txunblock(dma_info_t *di) +{ + di->hnddma.txavail = di->ntxd - NTXDACTIVE(di->txin, di->txout) - 1; +} + +static uint +_dma_txactive(dma_info_t *di) +{ + return (NTXDACTIVE(di->txin, di->txout)); +} + +static void +_dma_counterreset(dma_info_t *di) +{ + /* reset all software counter */ + di->hnddma.rxgiants = 0; + di->hnddma.rxnobuf = 0; + di->hnddma.txnobuf = 0; +} + +/* get the address of the var in order to change later */ +static uintptr +_dma_getvar(dma_info_t *di, char *name) +{ + if (!strcmp(name, "&txavail")) + return ((uintptr) &(di->hnddma.txavail)); + else { + ASSERT(0); + } + return (0); +} + +void +dma_txpioloopback(osl_t *osh, dma32regs_t *regs) +{ + OR_REG(osh, ®s->control, XC_LE); +} + + + +/* 32 bits DMA functions */ +static void +dma32_txinit(dma_info_t *di) +{ + DMA_TRACE(("%s: dma_txinit\n", di->name)); + + if (di->ntxd == 0) + return; + + di->txin = di->txout = 0; + di->hnddma.txavail = di->ntxd - 1; + + /* clear tx descriptor ring */ + BZERO_SM((void *)di->txd32, (di->ntxd * sizeof(dma32dd_t))); + W_REG(di->osh, &di->d32txregs->control, XC_XE); + _dma_ddtable_init(di, DMA_TX, di->txdpa); +} + +static bool +dma32_txenabled(dma_info_t *di) +{ + uint32 xc; + + /* If the chip is dead, it is not enabled :-) */ + xc = R_REG(di->osh, &di->d32txregs->control); + return ((xc != 0xffffffff) && (xc & XC_XE)); +} + +static void +dma32_txsuspend(dma_info_t *di) +{ + DMA_TRACE(("%s: dma_txsuspend\n", di->name)); + + if (di->ntxd == 0) + return; + + OR_REG(di->osh, &di->d32txregs->control, XC_SE); +} + +static void +dma32_txresume(dma_info_t *di) +{ + DMA_TRACE(("%s: dma_txresume\n", di->name)); + + if (di->ntxd == 0) + return; + + AND_REG(di->osh, &di->d32txregs->control, ~XC_SE); +} + +static bool +dma32_txsuspended(dma_info_t *di) +{ + return (di->ntxd == 0) || ((R_REG(di->osh, &di->d32txregs->control) & XC_SE) == XC_SE); +} + +static void +dma32_txreclaim(dma_info_t *di, bool forceall) +{ + void *p; + + DMA_TRACE(("%s: dma_txreclaim %s\n", di->name, forceall ? "all" : "")); + + while ((p = dma32_getnexttxp(di, forceall))) + PKTFREE(di->osh, p, TRUE); +} + +static bool +dma32_txstopped(dma_info_t *di) +{ + return ((R_REG(di->osh, &di->d32txregs->status) & XS_XS_MASK) == XS_XS_STOPPED); +} + +static bool +dma32_rxstopped(dma_info_t *di) +{ + return ((R_REG(di->osh, &di->d32rxregs->status) & RS_RS_MASK) == RS_RS_STOPPED); +} + +static bool +dma32_alloc(dma_info_t *di, uint direction) +{ + uint size; + uint ddlen; + void *va; + + ddlen = sizeof(dma32dd_t); + + size = (direction == DMA_TX) ? (di->ntxd * ddlen) : (di->nrxd * ddlen); + + if (!ISALIGNED(DMA_CONSISTENT_ALIGN, D32RINGALIGN)) + size += D32RINGALIGN; + + + if (direction == DMA_TX) { + if ((va = DMA_ALLOC_CONSISTENT(di->osh, size, &di->txdpa, &di->tx_dmah)) == NULL) { + DMA_ERROR(("%s: dma_attach: DMA_ALLOC_CONSISTENT(ntxd) failed\n", + di->name)); + return FALSE; + } + + di->txd32 = (dma32dd_t *) ROUNDUP((uintptr)va, D32RINGALIGN); + di->txdalign = (uint)((int8*)di->txd32 - (int8*)va); + di->txdpa += di->txdalign; + di->txdalloc = size; + ASSERT(ISALIGNED((uintptr)di->txd32, D32RINGALIGN)); + } else { + if ((va = DMA_ALLOC_CONSISTENT(di->osh, size, &di->rxdpa, &di->rx_dmah)) == NULL) { + DMA_ERROR(("%s: dma_attach: DMA_ALLOC_CONSISTENT(nrxd) failed\n", + di->name)); + return FALSE; + } + di->rxd32 = (dma32dd_t *) ROUNDUP((uintptr)va, D32RINGALIGN); + di->rxdalign = (uint)((int8*)di->rxd32 - (int8*)va); + di->rxdpa += di->rxdalign; + di->rxdalloc = size; + ASSERT(ISALIGNED((uintptr)di->rxd32, D32RINGALIGN)); + } + + return TRUE; +} + +static bool +dma32_txreset(dma_info_t *di) +{ + uint32 status; + + if (di->ntxd == 0) + return TRUE; + + /* suspend tx DMA first */ + W_REG(di->osh, &di->d32txregs->control, XC_SE); + SPINWAIT(((status = (R_REG(di->osh, &di->d32txregs->status) & XS_XS_MASK)) + != XS_XS_DISABLED) && + (status != XS_XS_IDLE) && + (status != XS_XS_STOPPED), + (10000)); + + W_REG(di->osh, &di->d32txregs->control, 0); + SPINWAIT(((status = (R_REG(di->osh, + &di->d32txregs->status) & XS_XS_MASK)) != XS_XS_DISABLED), + 10000); + + /* wait for the last transaction to complete */ + OSL_DELAY(300); + + return (status == XS_XS_DISABLED); +} + +static bool +dma32_rxidle(dma_info_t *di) +{ + DMA_TRACE(("%s: dma_rxidle\n", di->name)); + + if (di->nrxd == 0) + return TRUE; + + return ((R_REG(di->osh, &di->d32rxregs->status) & RS_CD_MASK) == + R_REG(di->osh, &di->d32rxregs->ptr)); +} + +static bool +dma32_rxreset(dma_info_t *di) +{ + uint32 status; + + if (di->nrxd == 0) + return TRUE; + + W_REG(di->osh, &di->d32rxregs->control, 0); + SPINWAIT(((status = (R_REG(di->osh, + &di->d32rxregs->status) & RS_RS_MASK)) != RS_RS_DISABLED), + 10000); + + return (status == RS_RS_DISABLED); +} + +static bool +dma32_rxenabled(dma_info_t *di) +{ + uint32 rc; + + rc = R_REG(di->osh, &di->d32rxregs->control); + return ((rc != 0xffffffff) && (rc & RC_RE)); +} + +static bool +dma32_txsuspendedidle(dma_info_t *di) +{ + if (di->ntxd == 0) + return TRUE; + + if (!(R_REG(di->osh, &di->d32txregs->control) & XC_SE)) + return 0; + + if ((R_REG(di->osh, &di->d32txregs->status) & XS_XS_MASK) != XS_XS_IDLE) + return 0; + + OSL_DELAY(2); + return ((R_REG(di->osh, &di->d32txregs->status) & XS_XS_MASK) == XS_XS_IDLE); +} + +/* !! tx entry routine + * supports full 32bit dma engine buffer addressing so + * dma buffers can cross 4 Kbyte page boundaries. + */ +static int +dma32_txfast(dma_info_t *di, void *p0, bool commit) +{ + void *p, *next; + uchar *data; + uint len; + uint txout; + uint32 flags = 0; + uint32 pa; + + DMA_TRACE(("%s: dma_txfast\n", di->name)); + + txout = di->txout; + + /* + * Walk the chain of packet buffers + * allocating and initializing transmit descriptor entries. + */ + for (p = p0; p; p = next) { + data = PKTDATA(di->osh, p); + len = PKTLEN(di->osh, p); + next = PKTNEXT(di->osh, p); + + /* return nonzero if out of tx descriptors */ + if (NEXTTXD(txout) == di->txin) + goto outoftxd; + + if (len == 0) + continue; + + /* get physical address of buffer start */ + pa = (uint32) DMA_MAP(di->osh, data, len, DMA_TX, p); + + flags = 0; + if (p == p0) + flags |= CTRL_SOF; + if (next == NULL) + flags |= (CTRL_IOC | CTRL_EOF); + if (txout == (di->ntxd - 1)) + flags |= CTRL_EOT; + + dma32_dd_upd(di, di->txd32, pa, txout, &flags, len); + ASSERT(di->txp[txout] == NULL); + + txout = NEXTTXD(txout); + } + + /* if last txd eof not set, fix it */ + if (!(flags & CTRL_EOF)) + W_SM(&di->txd32[PREVTXD(txout)].ctrl, BUS_SWAP32(flags | CTRL_IOC | CTRL_EOF)); + + /* save the packet */ + di->txp[PREVTXD(txout)] = p0; + + /* bump the tx descriptor index */ + di->txout = txout; + + /* kick the chip */ + if (commit) + W_REG(di->osh, &di->d32txregs->ptr, I2B(txout, dma32dd_t)); + + /* tx flow control */ + di->hnddma.txavail = di->ntxd - NTXDACTIVE(di->txin, di->txout) - 1; + + return (0); + +outoftxd: + DMA_ERROR(("%s: dma_txfast: out of txds\n", di->name)); + PKTFREE(di->osh, p0, TRUE); + di->hnddma.txavail = 0; + di->hnddma.txnobuf++; + return (-1); +} + +/* + * Reclaim next completed txd (txds if using chained buffers) and + * return associated packet. + * If 'force' is true, reclaim txd(s) and return associated packet + * regardless of the value of the hardware "curr" pointer. + */ +static void * +dma32_getnexttxp(dma_info_t *di, bool forceall) +{ + uint start, end, i; + void *txp; + + DMA_TRACE(("%s: dma_getnexttxp %s\n", di->name, forceall ? "all" : "")); + + if (di->ntxd == 0) + return (NULL); + + txp = NULL; + + start = di->txin; + if (forceall) + end = di->txout; + else + end = B2I(R_REG(di->osh, &di->d32txregs->status) & XS_CD_MASK, dma32dd_t); + + if ((start == 0) && (end > di->txout)) + goto bogus; + + for (i = start; i != end && !txp; i = NEXTTXD(i)) { + DMA_UNMAP(di->osh, (BUS_SWAP32(R_SM(&di->txd32[i].addr)) - di->dataoffsetlow), + (BUS_SWAP32(R_SM(&di->txd32[i].ctrl)) & CTRL_BC_MASK), + DMA_TX, di->txp[i]); + + W_SM(&di->txd32[i].addr, 0xdeadbeef); + txp = di->txp[i]; + di->txp[i] = NULL; + } + + di->txin = i; + + /* tx flow control */ + di->hnddma.txavail = di->ntxd - NTXDACTIVE(di->txin, di->txout) - 1; + + return (txp); + +bogus: +/* + DMA_ERROR(("dma_getnexttxp: bogus curr: start %d end %d txout %d force %d\n", + start, end, di->txout, forceall)); +*/ + return (NULL); +} + +static void * +dma32_getnextrxp(dma_info_t *di, bool forceall) +{ + uint i; + void *rxp; + + /* if forcing, dma engine must be disabled */ + ASSERT(!forceall || !dma32_rxenabled(di)); + + i = di->rxin; + + /* return if no packets posted */ + if (i == di->rxout) + return (NULL); + + /* ignore curr if forceall */ + if (!forceall && (i == B2I(R_REG(di->osh, &di->d32rxregs->status) & RS_CD_MASK, dma32dd_t))) + return (NULL); + + /* get the packet pointer that corresponds to the rx descriptor */ + rxp = di->rxp[i]; + ASSERT(rxp); + di->rxp[i] = NULL; + + /* clear this packet from the descriptor ring */ + DMA_UNMAP(di->osh, (BUS_SWAP32(R_SM(&di->rxd32[i].addr)) - di->dataoffsetlow), + di->rxbufsize, DMA_RX, rxp); + + W_SM(&di->rxd32[i].addr, 0xdeadbeef); + + di->rxin = NEXTRXD(i); + + return (rxp); +} + +/* + * Rotate all active tx dma ring entries "forward" by (ActiveDescriptor - txin). + */ +static void +dma32_txrotate(dma_info_t *di) +{ + uint ad; + uint nactive; + uint rot; + uint old, new; + uint32 w; + uint first, last; + + ASSERT(dma32_txsuspendedidle(di)); + + nactive = _dma_txactive(di); + ad = B2I(((R_REG(di->osh, &di->d32txregs->status) & XS_AD_MASK) >> XS_AD_SHIFT), dma32dd_t); + rot = TXD(ad - di->txin); + + ASSERT(rot < di->ntxd); + + /* full-ring case is a lot harder - don't worry about this */ + if (rot >= (di->ntxd - nactive)) { + DMA_ERROR(("%s: dma_txrotate: ring full - punt\n", di->name)); + return; + } + + first = di->txin; + last = PREVTXD(di->txout); + + /* move entries starting at last and moving backwards to first */ + for (old = last; old != PREVTXD(first); old = PREVTXD(old)) { + new = TXD(old + rot); + + /* + * Move the tx dma descriptor. + * EOT is set only in the last entry in the ring. + */ + w = BUS_SWAP32(R_SM(&di->txd32[old].ctrl)) & ~CTRL_EOT; + if (new == (di->ntxd - 1)) + w |= CTRL_EOT; + W_SM(&di->txd32[new].ctrl, BUS_SWAP32(w)); + W_SM(&di->txd32[new].addr, R_SM(&di->txd32[old].addr)); + + /* zap the old tx dma descriptor address field */ + W_SM(&di->txd32[old].addr, BUS_SWAP32(0xdeadbeef)); + + /* move the corresponding txp[] entry */ + ASSERT(di->txp[new] == NULL); + di->txp[new] = di->txp[old]; + di->txp[old] = NULL; + } + + /* update txin and txout */ + di->txin = ad; + di->txout = TXD(di->txout + rot); + di->hnddma.txavail = di->ntxd - NTXDACTIVE(di->txin, di->txout) - 1; + + /* kick the chip */ + W_REG(di->osh, &di->d32txregs->ptr, I2B(di->txout, dma32dd_t)); +} + + +uint +dma_addrwidth(sb_t *sbh, void *dmaregs) +{ + dma32regs_t *dma32regs; + osl_t *osh; + + osh = sb_osh(sbh); + + /* Start checking for 32-bit / 30-bit addressing */ + dma32regs = (dma32regs_t *)dmaregs; + + /* For System Backplane, PCIE bus or addrext feature, 32-bits ok */ + if ((BUSTYPE(sbh->bustype) == SB_BUS) || + ((BUSTYPE(sbh->bustype) == PCI_BUS) && sbh->buscoretype == SB_PCIE) || + (_dma32_addrext(osh, dma32regs))) + return (DMADDRWIDTH_32); + + /* Fallthru */ + return (DMADDRWIDTH_30); +} diff --git a/package/broadcom-wl/src/kmod/hnddma.h b/package/broadcom-wl/src/kmod/hnddma.h new file mode 100644 index 0000000000..de74c067b2 --- /dev/null +++ b/package/broadcom-wl/src/kmod/hnddma.h @@ -0,0 +1,156 @@ +/* + * Generic Broadcom Home Networking Division (HND) DMA engine SW interface + * This supports the following chips: BCM42xx, 44xx, 47xx . + * + * Copyright 2006, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * $Id: hnddma.h,v 1.1.1.13 2006/04/08 06:13:39 honor Exp $ + */ + +#ifndef _hnddma_h_ +#define _hnddma_h_ + +typedef const struct hnddma_pub hnddma_t; + +/* dma function type */ +typedef void (*di_detach_t)(hnddma_t *dmah); +typedef bool (*di_txreset_t)(hnddma_t *dmah); +typedef bool (*di_rxreset_t)(hnddma_t *dmah); +typedef bool (*di_rxidle_t)(hnddma_t *dmah); +typedef void (*di_txinit_t)(hnddma_t *dmah); +typedef bool (*di_txenabled_t)(hnddma_t *dmah); +typedef void (*di_rxinit_t)(hnddma_t *dmah); +typedef void (*di_txsuspend_t)(hnddma_t *dmah); +typedef void (*di_txresume_t)(hnddma_t *dmah); +typedef bool (*di_txsuspended_t)(hnddma_t *dmah); +typedef bool (*di_txsuspendedidle_t)(hnddma_t *dmah); +typedef int (*di_txfast_t)(hnddma_t *dmah, void *p, bool commit); +typedef void (*di_fifoloopbackenable_t)(hnddma_t *dmah); +typedef bool (*di_txstopped_t)(hnddma_t *dmah); +typedef bool (*di_rxstopped_t)(hnddma_t *dmah); +typedef bool (*di_rxenable_t)(hnddma_t *dmah); +typedef bool (*di_rxenabled_t)(hnddma_t *dmah); +typedef void* (*di_rx_t)(hnddma_t *dmah); +typedef void (*di_rxfill_t)(hnddma_t *dmah); +typedef void (*di_txreclaim_t)(hnddma_t *dmah, bool forceall); +typedef void (*di_rxreclaim_t)(hnddma_t *dmah); +typedef uintptr (*di_getvar_t)(hnddma_t *dmah, char *name); +typedef void* (*di_getnexttxp_t)(hnddma_t *dmah, bool forceall); +typedef void* (*di_getnextrxp_t)(hnddma_t *dmah, bool forceall); +typedef void* (*di_peeknexttxp_t)(hnddma_t *dmah); +typedef void (*di_txblock_t)(hnddma_t *dmah); +typedef void (*di_txunblock_t)(hnddma_t *dmah); +typedef uint (*di_txactive_t)(hnddma_t *dmah); +typedef void (*di_txrotate_t)(hnddma_t *dmah); +typedef void (*di_counterreset_t)(hnddma_t *dmah); +typedef char* (*di_dump_t)(hnddma_t *dmah, struct bcmstrbuf *b, bool dumpring); +typedef char* (*di_dumptx_t)(hnddma_t *dmah, struct bcmstrbuf *b, bool dumpring); +typedef char* (*di_dumprx_t)(hnddma_t *dmah, struct bcmstrbuf *b, bool dumpring); + +/* dma opsvec */ +typedef struct di_fcn_s { + di_detach_t detach; + di_txinit_t txinit; + di_txreset_t txreset; + di_txenabled_t txenabled; + di_txsuspend_t txsuspend; + di_txresume_t txresume; + di_txsuspended_t txsuspended; + di_txsuspendedidle_t txsuspendedidle; + di_txfast_t txfast; + di_txstopped_t txstopped; + di_txreclaim_t txreclaim; + di_getnexttxp_t getnexttxp; + di_peeknexttxp_t peeknexttxp; + di_txblock_t txblock; + di_txunblock_t txunblock; + di_txactive_t txactive; + di_txrotate_t txrotate; + + di_rxinit_t rxinit; + di_rxreset_t rxreset; + di_rxidle_t rxidle; + di_rxstopped_t rxstopped; + di_rxenable_t rxenable; + di_rxenabled_t rxenabled; + di_rx_t rx; + di_rxfill_t rxfill; + di_rxreclaim_t rxreclaim; + di_getnextrxp_t getnextrxp; + + di_fifoloopbackenable_t fifoloopbackenable; + di_getvar_t d_getvar; + di_counterreset_t counterreset; + di_dump_t dump; + di_dumptx_t dumptx; + di_dumprx_t dumprx; + uint endnum; +} di_fcn_t; + +/* + * Exported data structure (read-only) + */ +/* export structure */ +struct hnddma_pub { + di_fcn_t di_fn; /* DMA function pointers */ + uint txavail; /* # free tx descriptors */ + + /* rx error counters */ + uint rxgiants; /* rx giant frames */ + uint rxnobuf; /* rx out of dma descriptors */ + /* tx error counters */ + uint txnobuf; /* tx out of dma descriptors */ +}; + + +extern hnddma_t * dma_attach(osl_t *osh, char *name, sb_t *sbh, void *dmaregstx, void *dmaregsrx, + uint ntxd, uint nrxd, uint rxbufsize, uint nrxpost, uint rxoffset, + uint *msg_level); +#define dma_detach(di) ((di)->di_fn.detach(di)) +#define dma_txreset(di) ((di)->di_fn.txreset(di)) +#define dma_rxreset(di) ((di)->di_fn.rxreset(di)) +#define dma_rxidle(di) ((di)->di_fn.rxidle(di)) +#define dma_txinit(di) ((di)->di_fn.txinit(di)) +#define dma_txenabled(di) ((di)->di_fn.txenabled(di)) +#define dma_rxinit(di) ((di)->di_fn.rxinit(di)) +#define dma_txsuspend(di) ((di)->di_fn.txsuspend(di)) +#define dma_txresume(di) ((di)->di_fn.txresume(di)) +#define dma_txsuspended(di) ((di)->di_fn.txsuspended(di)) +#define dma_txsuspendedidle(di) ((di)->di_fn.txsuspendedidle(di)) +#define dma_txfast(di, p, commit) ((di)->di_fn.txfast(di, p, commit)) +#define dma_fifoloopbackenable(di) ((di)->di_fn.fifoloopbackenable(di)) +#define dma_txstopped(di) ((di)->di_fn.txstopped(di)) +#define dma_rxstopped(di) ((di)->di_fn.rxstopped(di)) +#define dma_rxenable(di) ((di)->di_fn.rxenable(di)) +#define dma_rxenabled(di) ((di)->di_fn.rxenabled(di)) +#define dma_rx(di) ((di)->di_fn.rx(di)) +#define dma_rxfill(di) ((di)->di_fn.rxfill(di)) +#define dma_txreclaim(di, forceall) ((di)->di_fn.txreclaim(di, forceall)) +#define dma_rxreclaim(di) ((di)->di_fn.rxreclaim(di)) +#define dma_getvar(di, name) ((di)->di_fn.d_getvar(di, name)) +#define dma_getnexttxp(di, forceall) ((di)->di_fn.getnexttxp(di, forceall)) +#define dma_getnextrxp(di, forceall) ((di)->di_fn.getnextrxp(di, forceall)) +#define dma_peeknexttxp(di) ((di)->di_fn.peeknexttxp(di)) +#define dma_txblock(di) ((di)->di_fn.txblock(di)) +#define dma_txunblock(di) ((di)->di_fn.txunblock(di)) +#define dma_txactive(di) ((di)->di_fn.txactive(di)) +#define dma_txrotate(di) ((di)->di_fn.txrotate(di)) +#define dma_counterreset(di) ((di)->di_fn.counterreset(di)) + +#define DMA_DUMP_SIZE 2048 +/* return addresswidth allowed + * This needs to be done after SB attach but before dma attach. + * SB attach provides ability to probe backplane and dma core capabilities + * This info is needed by DMA_ALLOC_CONSISTENT in dma attach + */ +extern uint dma_addrwidth(sb_t *sbh, void *dmaregs); + +/* pio helpers */ +void dma_txpioloopback(osl_t *osh, dma32regs_t *); + +#endif /* _hnddma_h_ */ diff --git a/package/broadcom-wl/src/kmod/linux_osl.c b/package/broadcom-wl/src/kmod/linux_osl.c new file mode 100644 index 0000000000..d702961032 --- /dev/null +++ b/package/broadcom-wl/src/kmod/linux_osl.c @@ -0,0 +1,269 @@ +/* + * Linux OS Independent Layer + * + * Copyright 2006, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * + * $Id: linux_osl.c,v 1.1.1.14 2006/04/08 06:13:39 honor Exp $ + */ + +#define LINUX_OSL + +#include <typedefs.h> +#include <bcmendian.h> +#include <linux/module.h> +#include <linuxver.h> +#include <bcmdefs.h> +#include <osl.h> +#include "linux_osl.h" +#include <bcmutils.h> +#include <linux/delay.h> +#ifdef mips +#include <asm/paccess.h> +#endif /* mips */ +#include <pcicfg.h> + +#define PCI_CFG_RETRY 10 + +#define OS_HANDLE_MAGIC 0x1234abcd /* Magic # to recognise osh */ +#define BCM_MEM_FILENAME_LEN 24 /* Mem. filename length */ + +typedef struct bcm_mem_link { + struct bcm_mem_link *prev; + struct bcm_mem_link *next; + uint size; + int line; + char file[BCM_MEM_FILENAME_LEN]; +} bcm_mem_link_t; + +static int16 linuxbcmerrormap[] = \ +{ 0, /* 0 */ + -EINVAL, /* BCME_ERROR */ + -EINVAL, /* BCME_BADARG */ + -EINVAL, /* BCME_BADOPTION */ + -EINVAL, /* BCME_NOTUP */ + -EINVAL, /* BCME_NOTDOWN */ + -EINVAL, /* BCME_NOTAP */ + -EINVAL, /* BCME_NOTSTA */ + -EINVAL, /* BCME_BADKEYIDX */ + -EINVAL, /* BCME_RADIOOFF */ + -EINVAL, /* BCME_NOTBANDLOCKED */ + -EINVAL, /* BCME_NOCLK */ + -EINVAL, /* BCME_BADRATESET */ + -EINVAL, /* BCME_BADBAND */ + -E2BIG, /* BCME_BUFTOOSHORT */ + -E2BIG, /* BCME_BUFTOOLONG */ + -EBUSY, /* BCME_BUSY */ + -EINVAL, /* BCME_NOTASSOCIATED */ + -EINVAL, /* BCME_BADSSIDLEN */ + -EINVAL, /* BCME_OUTOFRANGECHAN */ + -EINVAL, /* BCME_BADCHAN */ + -EFAULT, /* BCME_BADADDR */ + -ENOMEM, /* BCME_NORESOURCE */ + -EOPNOTSUPP, /* BCME_UNSUPPORTED */ + -EMSGSIZE, /* BCME_BADLENGTH */ + -EINVAL, /* BCME_NOTREADY */ + -EPERM, /* BCME_NOTPERMITTED */ + -ENOMEM, /* BCME_NOMEM */ + -EINVAL, /* BCME_ASSOCIATED */ + -ERANGE, /* BCME_RANGE */ + -EINVAL, /* BCME_NOTFOUND */ + -EINVAL, /* BCME_WME_NOT_ENABLED */ + -EINVAL, /* BCME_TSPEC_NOTFOUND */ + -EINVAL, /* BCME_ACM_NOTSUPPORTED */ + -EINVAL, /* BCME_NOT_WME_ASSOCIATION */ + -EIO, /* BCME_SDIO_ERROR */ + -ENODEV /* BCME_DONGLE_DOWN */ +}; + +/* translate bcmerrors into linux errors */ +int +osl_error(int bcmerror) +{ + int abs_bcmerror; + int array_size = ARRAYSIZE(linuxbcmerrormap); + + abs_bcmerror = ABS(bcmerror); + + if (bcmerror > 0) + abs_bcmerror = 0; + + else if (abs_bcmerror >= array_size) + abs_bcmerror = BCME_ERROR; + + return linuxbcmerrormap[abs_bcmerror]; +} + +osl_t * +osl_attach(void *pdev, bool pkttag) +{ + osl_t *osh; + + osh = kmalloc(sizeof(osl_t), GFP_ATOMIC); + ASSERT(osh); + + bzero(osh, sizeof(osl_t)); + + /* + * check the cases where + * 1.Error code Added to bcmerror table, but forgot to add it to the OS + * dependent error code + * 2. Error code is added to the bcmerror table, but forgot to add the + * corresponding errorstring(dummy call to bcmerrorstr) + */ + bcmerrorstr(0); + ASSERT(ABS(BCME_LAST) == (ARRAYSIZE(linuxbcmerrormap) - 1)); + + osh->magic = OS_HANDLE_MAGIC; + osh->malloced = 0; + osh->failed = 0; + osh->dbgmem_list = NULL; + osh->pdev = pdev; + osh->pub.pkttag = pkttag; + + return osh; +} + +void +osl_detach(osl_t *osh) +{ + if (osh == NULL) + return; + + ASSERT(osh->magic == OS_HANDLE_MAGIC); + kfree(osh); +} + +/* Return a new packet. zero out pkttag */ +void* +osl_pktget(osl_t *osh, uint len, bool send) +{ + struct sk_buff *skb; + + if ((skb = dev_alloc_skb(len))) { + skb_put(skb, len); + skb->priority = 0; + +#ifdef BCMDBG_PKT + pktlist_add(&(osh->pktlist), (void *) skb); +#endif /* BCMDBG_PKT */ + + osh->pub.pktalloced++; + } + + return ((void*) skb); +} + +/* Free the driver packet. Free the tag if present */ +void +osl_pktfree(osl_t *osh, void *p) +{ + struct sk_buff *skb, *nskb; + + skb = (struct sk_buff*) p; + + /* perversion: we use skb->next to chain multi-skb packets */ + while (skb) { + nskb = skb->next; + skb->next = NULL; + +#ifdef BCMDBG_PKT + pktlist_remove(&(osh->pktlist), (void *) skb); +#endif /* BCMDBG_PKT */ + + if (skb->destructor) { + /* cannot kfree_skb() on hard IRQ (net/core/skbuff.c) if destructor exists + */ + dev_kfree_skb_any(skb); + } else { + /* can free immediately (even in_irq()) if destructor does not exist */ + dev_kfree_skb(skb); + } + + osh->pub.pktalloced--; + + skb = nskb; + } +} + +void* +osl_malloc(osl_t *osh, uint size) +{ + void *addr; + + /* only ASSERT if osh is defined */ + if (osh) + ASSERT(osh->magic == OS_HANDLE_MAGIC); + + if ((addr = kmalloc(size, GFP_ATOMIC)) == NULL) { + if (osh) + osh->failed++; + return (NULL); + } + if (osh) + osh->malloced += size; + + return (addr); +} + +void +osl_mfree(osl_t *osh, void *addr, uint size) +{ + if (osh) { + ASSERT(osh->magic == OS_HANDLE_MAGIC); + osh->malloced -= size; + } + kfree(addr); +} + +uint +osl_malloced(osl_t *osh) +{ + ASSERT((osh && (osh->magic == OS_HANDLE_MAGIC))); + return (osh->malloced); +} + +uint osl_malloc_failed(osl_t *osh) +{ + ASSERT((osh && (osh->magic == OS_HANDLE_MAGIC))); + return (osh->failed); +} + +#undef osl_delay +void +osl_delay(uint usec) +{ + OSL_DELAY(usec); +} + +/* Clone a packet. + * The pkttag contents are NOT cloned. + */ +void * +osl_pktdup(osl_t *osh, void *skb) +{ + void * p; + + if ((p = skb_clone((struct sk_buff*)skb, GFP_ATOMIC)) == NULL) + return NULL; + + /* skb_clone copies skb->cb.. we don't want that */ + if (osh->pub.pkttag) + bzero((void*)((struct sk_buff *)p)->cb, OSL_PKTTAG_SZ); + + /* Increment the packet counter */ + osh->pub.pktalloced++; + return (p); +} + +uint +osl_pktalloced(osl_t *osh) +{ + return (osh->pub.pktalloced); +} + diff --git a/package/broadcom-wl/src/kmod/linux_osl.h b/package/broadcom-wl/src/kmod/linux_osl.h new file mode 100644 index 0000000000..f6af6124c6 --- /dev/null +++ b/package/broadcom-wl/src/kmod/linux_osl.h @@ -0,0 +1,171 @@ +/* + * Linux OS Independent Layer + * + * Copyright 2006, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * + * $Id: linux_osl.h,v 1.1.1.13 2006/04/08 06:13:39 honor Exp $ + */ + +#ifndef _linux_osl_h_ +#define _linux_osl_h_ + +#include <typedefs.h> +#include <linuxver.h> +#include <osl.h> + +#define OSL_PKTTAG_SZ 32 /* Size of PktTag */ + +/* osl handle type forward declaration */ +typedef struct osl_dmainfo osldma_t; + +/* OSL initialization */ +extern osl_t *osl_attach(void *pdev, bool pkttag); +extern void osl_detach(osl_t *osh); + +/* host/bus architecture-specific byte swap */ +#define BUS_SWAP32(v) (v) +#define MALLOC_FAILED(osh) osl_malloc_failed((osh)) + +extern void *osl_malloc(osl_t *osh, uint size); +extern void osl_mfree(osl_t *osh, void *addr, uint size); +extern uint osl_malloced(osl_t *osh); +extern uint osl_malloc_failed(osl_t *osh); + +/* API for DMA addressing capability */ +#define DMA_MAP(osh, va, size, direction, p) \ + osl_dma_map((osh), (va), (size), (direction)) +#define DMA_UNMAP(osh, pa, size, direction, p) \ + osl_dma_unmap((osh), (pa), (size), (direction)) +static inline uint +osl_dma_map(void *osh, void *va, uint size, int direction) +{ + int dir; + struct pci_dev *dev; + + dev = (osh == NULL ? NULL : ((osl_t *)osh)->pdev); + dir = (direction == DMA_TX)? PCI_DMA_TODEVICE: PCI_DMA_FROMDEVICE; + return (pci_map_single(dev, va, size, dir)); +} + +static inline void +osl_dma_unmap(void *osh, uint pa, uint size, int direction) +{ + int dir; + struct pci_dev *dev; + + dev = (osh == NULL ? NULL : ((osl_t *)osh)->pdev); + dir = (direction == DMA_TX)? PCI_DMA_TODEVICE: PCI_DMA_FROMDEVICE; + pci_unmap_single(dev, (uint32)pa, size, dir); +} + +#define OSL_DMADDRWIDTH(osh, addrwidth) do {} while (0) +#define DMA_CONSISTENT_ALIGN PAGE_SIZE +#define DMA_ALLOC_CONSISTENT(osh, size, pap, dmah) \ + osl_dma_alloc_consistent((osh), (size), (pap)) +#define DMA_FREE_CONSISTENT(osh, va, size, pa, dmah) \ + osl_dma_free_consistent((osh), (void*)(va), (size), (pa)) +static inline void* +osl_dma_alloc_consistent(osl_t *osh, uint size, ulong *pap) +{ + return (pci_alloc_consistent(osh->pdev, size, (dma_addr_t*)pap)); +} + +static inline void +osl_dma_free_consistent(osl_t *osh, void *va, uint size, ulong pa) +{ + pci_free_consistent(osh->pdev, size, va, (dma_addr_t)pa); +} + + +/* register access macros */ +#if defined(BCMJTAG) +#include <bcmjtag.h> +#define R_REG(osh, r) bcmjtag_read(NULL, (uint32)(r), sizeof(*(r))) +#define W_REG(osh, r, v) bcmjtag_write(NULL, (uint32)(r), (uint32)(v), sizeof(*(r))) +#endif /* defined(BCMSDIO) */ + +/* packet primitives */ +#define PKTGET(osh, len, send) osl_pktget((osh), (len), (send)) +#define PKTFREE(osh, skb, send) osl_pktfree((osh), (skb)) +#define PKTDATA(osh, skb) (((struct sk_buff*)(skb))->data) +#define PKTLEN(osh, skb) (((struct sk_buff*)(skb))->len) +#define PKTHEADROOM(osh, skb) (PKTDATA(osh, skb)-(((struct sk_buff*)(skb))->head)) +#define PKTTAILROOM(osh, skb) ((((struct sk_buff*)(skb))->end)-(((struct sk_buff*)(skb))->tail)) +#define PKTNEXT(osh, skb) (((struct sk_buff*)(skb))->next) +#define PKTSETNEXT(osh, skb, x) (((struct sk_buff*)(skb))->next = (struct sk_buff*)(x)) +#define PKTSETLEN(osh, skb, len) __skb_trim((struct sk_buff*)(skb), (len)) +#define PKTPUSH(osh, skb, bytes) skb_push((struct sk_buff*)(skb), (bytes)) +#define PKTPULL(osh, skb, bytes) skb_pull((struct sk_buff*)(skb), (bytes)) +#define PKTDUP(osh, skb) osl_pktdup((osh), (skb)) +#define PKTTAG(skb) ((void*)(((struct sk_buff*)(skb))->cb)) +#define PKTALLOCED(osh) osl_pktalloced((osh)) +#define PKTLIST_DUMP(osh, buf) + +/* Convert a native(OS) packet to driver packet. + * In the process, native packet is destroyed, there is no copying + * Also, a packettag is zeroed out + */ +static INLINE void * +osl_pkt_frmnative(struct osl_pubinfo *osh, struct sk_buff *skb) +{ + struct sk_buff *nskb; + + if (osh->pkttag) + bzero((void*)skb->cb, OSL_PKTTAG_SZ); + + /* Increment the packet counter */ + for (nskb = skb; nskb; nskb = nskb->next) { + osh->pktalloced++; + } + + return (void *)skb; +} +#define PKTFRMNATIVE(osh, skb) osl_pkt_frmnative(((struct osl_pubinfo *)osh), \ + (struct sk_buff*)(skb)) + +/* Convert a driver packet to native(OS) packet + * In the process, packettag is zeroed out before sending up + * IP code depends on skb->cb to be setup correctly with various options + * In our case, that means it should be 0 + */ +static INLINE struct sk_buff * +osl_pkt_tonative(struct osl_pubinfo *osh, void *pkt) +{ + struct sk_buff *nskb; + + if (osh->pkttag) + bzero(((struct sk_buff*)pkt)->cb, OSL_PKTTAG_SZ); + + /* Decrement the packet counter */ + for (nskb = (struct sk_buff *)pkt; nskb; nskb = nskb->next) { + osh->pktalloced--; + } + + return (struct sk_buff *)pkt; +} +#define PKTTONATIVE(osh, pkt) osl_pkt_tonative((struct osl_pubinfo *)(osh), (pkt)) + +#define PKTLINK(skb) (((struct sk_buff*)(skb))->prev) +#define PKTSETLINK(skb, x) (((struct sk_buff*)(skb))->prev = (struct sk_buff*)(x)) +#define PKTPRIO(skb) (((struct sk_buff*)(skb))->priority) +#define PKTSETPRIO(skb, x) (((struct sk_buff*)(skb))->priority = (x)) +#define PKTSHARED(skb) (((struct sk_buff*)(skb))->cloned) + +extern void *osl_pktget(osl_t *osh, uint len, bool send); +extern void osl_pktfree(osl_t *osh, void *skb); +extern void *osl_pktdup(osl_t *osh, void *skb); +extern uint osl_pktalloced(osl_t *osh); + +#define OSL_ERROR(bcmerror) osl_error(bcmerror) +extern int osl_error(int bcmerror); + +/* the largest reasonable packet buffer driver uses for ethernet MTU in bytes */ +#define PKTBUFSZ 2048 /* largest reasonable packet buffer, driver uses for ethernet MTU */ + +#endif /* _linux_osl_h_ */ diff --git a/package/broadcom-wl/src/kmod/patchtable.pl b/package/broadcom-wl/src/kmod/patchtable.pl new file mode 100644 index 0000000000..6999735125 --- /dev/null +++ b/package/broadcom-wl/src/kmod/patchtable.pl @@ -0,0 +1,61 @@ +#!/usr/bin/perl +# +# Copyright (C) 2006 OpenWrt.org +# Copyright (C) 2006 Felix Fietkau +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +use strict; + +my $TABLE = pack("V", 0xbadc0ded); +my $TABLE_SIZE = 512; +my $SLT1 = "\x01\x00\x00\x00"; +my $SLT2 = "\x02\x00\x00\x00"; +my $ACKW = "\x03\x00\x00\x00"; +my $PTABLE_END = "\xff\xff\xff\xff"; + +my $addr = ""; +my $opcode = ""; +my $function = ""; + +sub add_entry { + my $key = shift; + my $value = shift; + my $default = shift; + + $TABLE .= $key; + $TABLE .= pack("V", $value); + $TABLE .= pack("V", $default); +} + +while (<>) { + $addr = $opcode = ""; + /^\w{8}\s*<(.*)>:$/ and $function = $1; + /^\s*(\w+):\s*(\w{8})\s*/ and do { + $addr = $1; + $opcode = $2; + }; + + ($function eq 'wlc_update_slot_timing') and do { + # li a2,9 -- short slot time + ($opcode eq '24060009') and add_entry($SLT1, hex($addr), hex($opcode)); + # li v0,519 -- 510 + short slot time + ($opcode eq '24020207') and add_entry($SLT2, hex($addr), hex($opcode)); + + # li a2,20 -- long slot time + ($opcode eq '24060014') and add_entry($SLT1, hex($addr), hex($opcode)); + # li v0,530 -- 510 + long slot time + ($opcode eq '24020212') and add_entry($SLT2, hex($addr), hex($opcode)); + }; + ($function eq 'wlc_d11hdrs') and do { + # ori s6,s6,0x1 -- ack flag (new) + ($opcode eq '36d60001') and add_entry($ACKW, hex($addr), hex($opcode)); + # ori s3,s3,0x1 -- ack flag (old) + ($opcode eq '36730001') and add_entry($ACKW, hex($addr), hex($opcode)); + } +} + +$TABLE .= $PTABLE_END; +$TABLE .= ("\x00" x ($TABLE_SIZE - length($TABLE))); +print $TABLE; diff --git a/package/broadcom-wl/src/kmod/pktq.h b/package/broadcom-wl/src/kmod/pktq.h new file mode 100644 index 0000000000..7fe21815e8 --- /dev/null +++ b/package/broadcom-wl/src/kmod/pktq.h @@ -0,0 +1,97 @@ +/* + * Misc useful os-independent macros and functions. + * + * Copyright 2006, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * $Id: bcmutils.h,v 1.1.1.16 2006/04/08 06:13:39 honor Exp $ + */ + +#ifndef _pktq_h_ +#define _pktq_h_ +#include <osl.h> + +/* osl multi-precedence packet queue */ + +#define PKTQ_LEN_DEFAULT 128 /* Max 128 packets */ +#define PKTQ_MAX_PREC 16 /* Maximum precedence levels */ + +struct pktq { + struct pktq_prec { + void *head; /* first packet to dequeue */ + void *tail; /* last packet to dequeue */ + uint16 len; /* number of queued packets */ + uint16 max; /* maximum number of queued packets */ + } q[PKTQ_MAX_PREC]; + uint16 num_prec; /* number of precedences in use */ + uint16 hi_prec; /* rapid dequeue hint (>= highest non-empty prec) */ + uint16 max; /* total max packets */ + uint16 len; /* total number of packets */ +}; + +#define PKTQ_PREC_ITER(pq, prec) for (prec = (pq)->num_prec - 1; prec >= 0; prec--) + +/* forward definition of ether_addr structure used by some function prototypes */ + +struct ether_addr; + +/* operations on a specific precedence in packet queue */ + +#define pktq_psetmax(pq, prec, _max) ((pq)->q[prec].max = (_max)) +#define pktq_plen(pq, prec) ((pq)->q[prec].len) +#define pktq_pavail(pq, prec) ((pq)->q[prec].max - (pq)->q[prec].len) +#define pktq_pfull(pq, prec) ((pq)->q[prec].len >= (pq)->q[prec].max) +#define pktq_pempty(pq, prec) ((pq)->q[prec].len == 0) + +#define pktq_ppeek(pq, prec) ((pq)->q[prec].head) +#define pktq_ppeek_tail(pq, prec) ((pq)->q[prec].tail) + +extern void *pktq_penq(struct pktq *pq, int prec, void *p); +extern void *pktq_penq_head(struct pktq *pq, int prec, void *p); +extern void *pktq_pdeq(struct pktq *pq, int prec); +extern void *pktq_pdeq_tail(struct pktq *pq, int prec); +/* Empty the queue at particular precedence level */ +extern void pktq_pflush(osl_t *osh, struct pktq *pq, int prec, bool dir); +/* Remove a specified packet from its queue */ +extern bool pktq_pdel(struct pktq *pq, void *p, int prec); + +/* operations on a set of precedences in packet queue */ + +extern int pktq_mlen(struct pktq *pq, uint prec_bmp); +extern void *pktq_mdeq(struct pktq *pq, uint prec_bmp, int *prec_out); + +/* operations on packet queue as a whole */ + +#define pktq_len(pq) ((int)(pq)->len) +#define pktq_max(pq) ((int)(pq)->max) +#define pktq_avail(pq) ((int)((pq)->max - (pq)->len)) +#define pktq_full(pq) ((pq)->len >= (pq)->max) +#define pktq_empty(pq) ((pq)->len == 0) + +/* operations for single precedence queues */ +#define pktenq(pq, p) pktq_penq((pq), 0, (p)) +#define pktenq_head(pq, p) pktq_penq_head((pq), 0, (p)) +#define pktdeq(pq) pktq_pdeq((pq), 0) +#define pktdeq_tail(pq) pktq_pdeq_tail((pq), 0) + +extern void pktq_init(struct pktq *pq, int num_prec, int max_len); +/* prec_out may be NULL if caller is not interested in return value */ +extern void *pktq_deq(struct pktq *pq, int *prec_out); +extern void *pktq_deq_tail(struct pktq *pq, int *prec_out); +extern void *pktq_peek(struct pktq *pq, int *prec_out); +extern void *pktq_peek_tail(struct pktq *pq, int *prec_out); +extern void pktq_flush(osl_t *osh, struct pktq *pq, bool dir); /* Empty the entire queue */ + +/* externs */ +/* packet */ +extern uint pktcopy(osl_t *osh, void *p, uint offset, int len, uchar *buf); +extern uint pkttotlen(osl_t *osh, void *p); +extern void *pktlast(osl_t *osh, void *p); + +extern void pktsetprio(void *pkt, bool update_vtag); + +#endif /* _pktq_h_ */ diff --git a/package/broadcom-wl/src/kmod/sbhnddma.h b/package/broadcom-wl/src/kmod/sbhnddma.h new file mode 100644 index 0000000000..a26db7395e --- /dev/null +++ b/package/broadcom-wl/src/kmod/sbhnddma.h @@ -0,0 +1,284 @@ +/* + * Generic Broadcom Home Networking Division (HND) DMA engine HW interface + * This supports the following chips: BCM42xx, 44xx, 47xx . + * + * Copyright 2006, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * + * $Id: sbhnddma.h,v 1.1.1.2 2006/02/27 03:43:16 honor Exp $ + */ + +#ifndef _sbhnddma_h_ +#define _sbhnddma_h_ + +/* DMA structure: + * support two DMA engines: 32 bits address or 64 bit addressing + * basic DMA register set is per channel(transmit or receive) + * a pair of channels is defined for convenience + */ + + +/* 32 bits addressing */ + +/* dma registers per channel(xmt or rcv) */ +typedef volatile struct { + uint32 control; /* enable, et al */ + uint32 addr; /* descriptor ring base address (4K aligned) */ + uint32 ptr; /* last descriptor posted to chip */ + uint32 status; /* current active descriptor, et al */ +} dma32regs_t; + +typedef volatile struct { + dma32regs_t xmt; /* dma tx channel */ + dma32regs_t rcv; /* dma rx channel */ +} dma32regp_t; + +typedef volatile struct { /* diag access */ + uint32 fifoaddr; /* diag address */ + uint32 fifodatalow; /* low 32bits of data */ + uint32 fifodatahigh; /* high 32bits of data */ + uint32 pad; /* reserved */ +} dma32diag_t; + +/* + * DMA Descriptor + * Descriptors are only read by the hardware, never written back. + */ +typedef volatile struct { + uint32 ctrl; /* misc control bits & bufcount */ + uint32 addr; /* data buffer address */ +} dma32dd_t; + +/* + * Each descriptor ring must be 4096byte aligned, and fit within a single 4096byte page. + */ +#define D32MAXRINGSZ 4096 +#define D32RINGALIGN 4096 +#define D32MAXDD (D32MAXRINGSZ / sizeof (dma32dd_t)) + +/* transmit channel control */ +#define XC_XE ((uint32)1 << 0) /* transmit enable */ +#define XC_SE ((uint32)1 << 1) /* transmit suspend request */ +#define XC_LE ((uint32)1 << 2) /* loopback enable */ +#define XC_FL ((uint32)1 << 4) /* flush request */ +#define XC_AE ((uint32)3 << 16) /* address extension bits */ +#define XC_AE_SHIFT 16 + +/* transmit descriptor table pointer */ +#define XP_LD_MASK 0xfff /* last valid descriptor */ + +/* transmit channel status */ +#define XS_CD_MASK 0x0fff /* current descriptor pointer */ +#define XS_XS_MASK 0xf000 /* transmit state */ +#define XS_XS_SHIFT 12 +#define XS_XS_DISABLED 0x0000 /* disabled */ +#define XS_XS_ACTIVE 0x1000 /* active */ +#define XS_XS_IDLE 0x2000 /* idle wait */ +#define XS_XS_STOPPED 0x3000 /* stopped */ +#define XS_XS_SUSP 0x4000 /* suspend pending */ +#define XS_XE_MASK 0xf0000 /* transmit errors */ +#define XS_XE_SHIFT 16 +#define XS_XE_NOERR 0x00000 /* no error */ +#define XS_XE_DPE 0x10000 /* descriptor protocol error */ +#define XS_XE_DFU 0x20000 /* data fifo underrun */ +#define XS_XE_BEBR 0x30000 /* bus error on buffer read */ +#define XS_XE_BEDA 0x40000 /* bus error on descriptor access */ +#define XS_AD_MASK 0xfff00000 /* active descriptor */ +#define XS_AD_SHIFT 20 + +/* receive channel control */ +#define RC_RE ((uint32)1 << 0) /* receive enable */ +#define RC_RO_MASK 0xfe /* receive frame offset */ +#define RC_RO_SHIFT 1 +#define RC_FM ((uint32)1 << 8) /* direct fifo receive (pio) mode */ +#define RC_AE ((uint32)3 << 16) /* address extension bits */ +#define RC_AE_SHIFT 16 + +/* receive descriptor table pointer */ +#define RP_LD_MASK 0xfff /* last valid descriptor */ + +/* receive channel status */ +#define RS_CD_MASK 0x0fff /* current descriptor pointer */ +#define RS_RS_MASK 0xf000 /* receive state */ +#define RS_RS_SHIFT 12 +#define RS_RS_DISABLED 0x0000 /* disabled */ +#define RS_RS_ACTIVE 0x1000 /* active */ +#define RS_RS_IDLE 0x2000 /* idle wait */ +#define RS_RS_STOPPED 0x3000 /* reserved */ +#define RS_RE_MASK 0xf0000 /* receive errors */ +#define RS_RE_SHIFT 16 +#define RS_RE_NOERR 0x00000 /* no error */ +#define RS_RE_DPE 0x10000 /* descriptor protocol error */ +#define RS_RE_DFO 0x20000 /* data fifo overflow */ +#define RS_RE_BEBW 0x30000 /* bus error on buffer write */ +#define RS_RE_BEDA 0x40000 /* bus error on descriptor access */ +#define RS_AD_MASK 0xfff00000 /* active descriptor */ +#define RS_AD_SHIFT 20 + +/* fifoaddr */ +#define FA_OFF_MASK 0xffff /* offset */ +#define FA_SEL_MASK 0xf0000 /* select */ +#define FA_SEL_SHIFT 16 +#define FA_SEL_XDD 0x00000 /* transmit dma data */ +#define FA_SEL_XDP 0x10000 /* transmit dma pointers */ +#define FA_SEL_RDD 0x40000 /* receive dma data */ +#define FA_SEL_RDP 0x50000 /* receive dma pointers */ +#define FA_SEL_XFD 0x80000 /* transmit fifo data */ +#define FA_SEL_XFP 0x90000 /* transmit fifo pointers */ +#define FA_SEL_RFD 0xc0000 /* receive fifo data */ +#define FA_SEL_RFP 0xd0000 /* receive fifo pointers */ +#define FA_SEL_RSD 0xe0000 /* receive frame status data */ +#define FA_SEL_RSP 0xf0000 /* receive frame status pointers */ + +/* descriptor control flags */ +#define CTRL_BC_MASK 0x1fff /* buffer byte count */ +#define CTRL_AE ((uint32)3 << 16) /* address extension bits */ +#define CTRL_AE_SHIFT 16 +#define CTRL_EOT ((uint32)1 << 28) /* end of descriptor table */ +#define CTRL_IOC ((uint32)1 << 29) /* interrupt on completion */ +#define CTRL_EOF ((uint32)1 << 30) /* end of frame */ +#define CTRL_SOF ((uint32)1 << 31) /* start of frame */ + +/* control flags in the range [27:20] are core-specific and not defined here */ +#define CTRL_CORE_MASK 0x0ff00000 + +/* 64 bits addressing */ + +/* dma registers per channel(xmt or rcv) */ +typedef volatile struct { + uint32 control; /* enable, et al */ + uint32 ptr; /* last descriptor posted to chip */ + uint32 addrlow; /* descriptor ring base address low 32-bits (8K aligned) */ + uint32 addrhigh; /* descriptor ring base address bits 63:32 (8K aligned) */ + uint32 status0; /* current descriptor, xmt state */ + uint32 status1; /* active descriptor, xmt error */ +} dma64regs_t; + +typedef volatile struct { + dma64regs_t tx; /* dma64 tx channel */ + dma64regs_t rx; /* dma64 rx channel */ +} dma64regp_t; + +typedef volatile struct { /* diag access */ + uint32 fifoaddr; /* diag address */ + uint32 fifodatalow; /* low 32bits of data */ + uint32 fifodatahigh; /* high 32bits of data */ + uint32 pad; /* reserved */ +} dma64diag_t; + +/* + * DMA Descriptor + * Descriptors are only read by the hardware, never written back. + */ +typedef volatile struct { + uint32 ctrl1; /* misc control bits & bufcount */ + uint32 ctrl2; /* buffer count and address extension */ + uint32 addrlow; /* memory address of the date buffer, bits 31:0 */ + uint32 addrhigh; /* memory address of the date buffer, bits 63:32 */ +} dma64dd_t; + +/* + * Each descriptor ring must be 8kB aligned, and fit within a contiguous 8kB physical addresss. + */ +#define D64MAXRINGSZ 8192 +#define D64RINGALIGN 8192 +#define D64MAXDD (D64MAXRINGSZ / sizeof (dma64dd_t)) + +/* transmit channel control */ +#define D64_XC_XE 0x00000001 /* transmit enable */ +#define D64_XC_SE 0x00000002 /* transmit suspend request */ +#define D64_XC_LE 0x00000004 /* loopback enable */ +#define D64_XC_FL 0x00000010 /* flush request */ +#define D64_XC_AE 0x00030000 /* address extension bits */ +#define D64_XC_AE_SHIFT 16 + +/* transmit descriptor table pointer */ +#define D64_XP_LD_MASK 0x00000fff /* last valid descriptor */ + +/* transmit channel status */ +#define D64_XS0_CD_MASK 0x00001fff /* current descriptor pointer */ +#define D64_XS0_XS_MASK 0xf0000000 /* transmit state */ +#define D64_XS0_XS_SHIFT 28 +#define D64_XS0_XS_DISABLED 0x00000000 /* disabled */ +#define D64_XS0_XS_ACTIVE 0x10000000 /* active */ +#define D64_XS0_XS_IDLE 0x20000000 /* idle wait */ +#define D64_XS0_XS_STOPPED 0x30000000 /* stopped */ +#define D64_XS0_XS_SUSP 0x40000000 /* suspend pending */ + +#define D64_XS1_AD_MASK 0x0001ffff /* active descriptor */ +#define D64_XS1_XE_MASK 0xf0000000 /* transmit errors */ +#define D64_XS1_XE_SHIFT 28 +#define D64_XS1_XE_NOERR 0x00000000 /* no error */ +#define D64_XS1_XE_DPE 0x10000000 /* descriptor protocol error */ +#define D64_XS1_XE_DFU 0x20000000 /* data fifo underrun */ +#define D64_XS1_XE_DTE 0x30000000 /* data transfer error */ +#define D64_XS1_XE_DESRE 0x40000000 /* descriptor read error */ +#define D64_XS1_XE_COREE 0x50000000 /* core error */ + +/* receive channel control */ +#define D64_RC_RE 0x00000001 /* receive enable */ +#define D64_RC_RO_MASK 0x000000fe /* receive frame offset */ +#define D64_RC_RO_SHIFT 1 +#define D64_RC_FM 0x00000100 /* direct fifo receive (pio) mode */ +#define D64_RC_AE 0x00030000 /* address extension bits */ +#define D64_RC_AE_SHIFT 16 + +/* receive descriptor table pointer */ +#define D64_RP_LD_MASK 0x00000fff /* last valid descriptor */ + +/* receive channel status */ +#define D64_RS0_CD_MASK 0x00001fff /* current descriptor pointer */ +#define D64_RS0_RS_MASK 0xf0000000 /* receive state */ +#define D64_RS0_RS_SHIFT 28 +#define D64_RS0_RS_DISABLED 0x00000000 /* disabled */ +#define D64_RS0_RS_ACTIVE 0x10000000 /* active */ +#define D64_RS0_RS_IDLE 0x20000000 /* idle wait */ +#define D64_RS0_RS_STOPPED 0x30000000 /* stopped */ +#define D64_RS0_RS_SUSP 0x40000000 /* suspend pending */ + +#define D64_RS1_AD_MASK 0x0001ffff /* active descriptor */ +#define D64_RS1_RE_MASK 0xf0000000 /* receive errors */ +#define D64_RS1_RE_SHIFT 28 +#define D64_RS1_RE_NOERR 0x00000000 /* no error */ +#define D64_RS1_RE_DPO 0x10000000 /* descriptor protocol error */ +#define D64_RS1_RE_DFU 0x20000000 /* data fifo overflow */ +#define D64_RS1_RE_DTE 0x30000000 /* data transfer error */ +#define D64_RS1_RE_DESRE 0x40000000 /* descriptor read error */ +#define D64_RS1_RE_COREE 0x50000000 /* core error */ + +/* fifoaddr */ +#define D64_FA_OFF_MASK 0xffff /* offset */ +#define D64_FA_SEL_MASK 0xf0000 /* select */ +#define D64_FA_SEL_SHIFT 16 +#define D64_FA_SEL_XDD 0x00000 /* transmit dma data */ +#define D64_FA_SEL_XDP 0x10000 /* transmit dma pointers */ +#define D64_FA_SEL_RDD 0x40000 /* receive dma data */ +#define D64_FA_SEL_RDP 0x50000 /* receive dma pointers */ +#define D64_FA_SEL_XFD 0x80000 /* transmit fifo data */ +#define D64_FA_SEL_XFP 0x90000 /* transmit fifo pointers */ +#define D64_FA_SEL_RFD 0xc0000 /* receive fifo data */ +#define D64_FA_SEL_RFP 0xd0000 /* receive fifo pointers */ +#define D64_FA_SEL_RSD 0xe0000 /* receive frame status data */ +#define D64_FA_SEL_RSP 0xf0000 /* receive frame status pointers */ + +/* descriptor control flags 1 */ +#define D64_CTRL1_EOT ((uint32)1 << 28) /* end of descriptor table */ +#define D64_CTRL1_IOC ((uint32)1 << 29) /* interrupt on completion */ +#define D64_CTRL1_EOF ((uint32)1 << 30) /* end of frame */ +#define D64_CTRL1_SOF ((uint32)1 << 31) /* start of frame */ + +/* descriptor control flags 2 */ +#define D64_CTRL2_BC_MASK 0x00007fff /* buffer byte count mask */ +#define D64_CTRL2_AE 0x00030000 /* address extension bits */ +#define D64_CTRL2_AE_SHIFT 16 + +/* control flags in the range [27:20] are core-specific and not defined here */ +#define D64_CTRL_CORE_MASK 0x0ff00000 + + +#endif /* _sbhnddma_h_ */ diff --git a/package/broadcom-wl/src/wlc/Makefile b/package/broadcom-wl/src/wlc/Makefile new file mode 100644 index 0000000000..ffe1649515 --- /dev/null +++ b/package/broadcom-wl/src/wlc/Makefile @@ -0,0 +1,9 @@ +all: wlc +clean: + rm -f *.o wlc + +wlc: wlc.o ioctl.o +%.o: %.c + $(CC) $(CFLAGS) -Wall -c -o $@ $< + +.PHONY: all clean diff --git a/package/broadcom-wl/src/wlc/include/bcmdefs.h b/package/broadcom-wl/src/wlc/include/bcmdefs.h new file mode 100644 index 0000000000..8b5abe5d26 --- /dev/null +++ b/package/broadcom-wl/src/wlc/include/bcmdefs.h @@ -0,0 +1,106 @@ +/* + * Misc system wide definitions + * + * Copyright 2006, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * $Id: bcmdefs.h,v 1.1.1.3 2006/04/08 06:13:39 honor Exp $ + */ + +#ifndef _bcmdefs_h_ +#define _bcmdefs_h_ + +/* + * One doesn't need to include this file explicitly, gets included automatically if + * typedefs.h is included. + */ + +/* Reclaiming text and data : + * The following macros specify special linker sections that can be reclaimed + * after a system is considered 'up'. + */ +#if defined(__GNUC__) && defined(BCMRECLAIM) +extern bool bcmreclaimed; +#define BCMINITDATA(_data) __attribute__ ((__section__ (".dataini." #_data))) _data +#define BCMINITFN(_fn) __attribute__ ((__section__ (".textini." #_fn))) _fn +#else /* #if defined(__GNUC__) && defined(BCMRECLAIM) */ +#define BCMINITDATA(_data) _data +#define BCMINITFN(_fn) _fn +#define bcmreclaimed 0 +#endif /* #if defined(__GNUC__) && defined(BCMRECLAIM) */ + +/* Reclaim uninit functions if BCMNODOWN is defined */ +/* and if they are not already removed by -gc-sections */ +#ifdef BCMNODOWN +#define BCMUNINITFN(_fn) BCMINITFN(_fn) +#else +#define BCMUNINITFN(_fn) _fn +#endif + +#ifdef BCMRECLAIM +#define CONST +#else +#define CONST const +#endif /* BCMRECLAIM */ + +/* Compatibility with old-style BCMRECLAIM */ +#define BCMINIT(_id) _id + + +/* Put some library data/code into ROM to reduce RAM requirements */ +#if defined(__GNUC__) && defined(BCMROMOFFLOAD) +#define BCMROMDATA(_data) __attribute__ ((__section__ (".datarom." #_data))) _data +#define BCMROMFN(_fn) __attribute__ ((__section__ (".textrom." #_fn))) _fn +#else +#define BCMROMDATA(_data) _data +#define BCMROMFN(_fn) _fn +#endif + +/* Bus types */ +#define SB_BUS 0 /* Silicon Backplane */ +#define PCI_BUS 1 /* PCI target */ +#define PCMCIA_BUS 2 /* PCMCIA target */ +#define SDIO_BUS 3 /* SDIO target */ +#define JTAG_BUS 4 /* JTAG */ +#define NO_BUS 0xFF /* Bus that does not support R/W REG */ + +/* Allows optimization for single-bus support */ +#ifdef BCMBUSTYPE +#define BUSTYPE(bus) (BCMBUSTYPE) +#else +#define BUSTYPE(bus) (bus) +#endif + +/* Defines for DMA Address Width - Shared between OSL and HNDDMA */ +#define DMADDR_MASK_32 0x0 /* Address mask for 32-bits */ +#define DMADDR_MASK_30 0xc0000000 /* Address mask for 30-bits */ +#define DMADDR_MASK_0 0xffffffff /* Address mask for 0-bits (hi-part) */ + +#define DMADDRWIDTH_30 30 /* 30-bit addressing capability */ +#define DMADDRWIDTH_32 32 /* 32-bit addressing capability */ +#define DMADDRWIDTH_63 63 /* 64-bit addressing capability */ +#define DMADDRWIDTH_64 64 /* 64-bit addressing capability */ + +/* packet headroom necessary to accomodate the largest header in the system, (i.e TXOFF). + * By doing, we avoid the need to allocate an extra buffer for the header when bridging to WL. + * There is a compile time check in wlc.c which ensure that this value is at least as big + * as TXOFF. This value is used in dma_rxfill (hnddma.c). + */ +#define BCMEXTRAHDROOM 160 + +/* Headroom required for dongle-to-host communication. Packets allocated + * locally in the dongle (e.g. for CDC ioctls or RNDIS messages) should + * leave this much room in front for low-level message headers which may + * be needed to get across the dongle bus to the host. (These messages + * don't go over the network, so room for the full WL header above would + * be a waste.) + */ +#define BCMDONGLEHDRSZ 8 + + + +#endif /* _bcmdefs_h_ */ diff --git a/package/broadcom-wl/src/wlc/include/bcmutils.h b/package/broadcom-wl/src/wlc/include/bcmutils.h new file mode 100644 index 0000000000..b6e7b0542b --- /dev/null +++ b/package/broadcom-wl/src/wlc/include/bcmutils.h @@ -0,0 +1,258 @@ +/* + * Misc useful os-independent macros and functions. + * + * Copyright 2006, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * $Id: bcmutils.h,v 1.1.1.16 2006/04/08 06:13:39 honor Exp $ + */ + +#ifndef _bcmutils_h_ +#define _bcmutils_h_ + +/* ** driver/apps-shared section ** */ + +#define BCME_STRLEN 64 /* Max string length for BCM errors */ +#define VALID_BCMERROR(e) ((e <= 0) && (e >= BCME_LAST)) + + +/* + * error codes could be added but the defined ones shouldn't be changed/deleted + * these error codes are exposed to the user code + * when ever a new error code is added to this list + * please update errorstring table with the related error string and + * update osl files with os specific errorcode map +*/ + +#define BCME_OK 0 /* Success */ +#define BCME_ERROR -1 /* Error generic */ +#define BCME_BADARG -2 /* Bad Argument */ +#define BCME_BADOPTION -3 /* Bad option */ +#define BCME_NOTUP -4 /* Not up */ +#define BCME_NOTDOWN -5 /* Not down */ +#define BCME_NOTAP -6 /* Not AP */ +#define BCME_NOTSTA -7 /* Not STA */ +#define BCME_BADKEYIDX -8 /* BAD Key Index */ +#define BCME_RADIOOFF -9 /* Radio Off */ +#define BCME_NOTBANDLOCKED -10 /* Not band locked */ +#define BCME_NOCLK -11 /* No Clock */ +#define BCME_BADRATESET -12 /* BAD Rate valueset */ +#define BCME_BADBAND -13 /* BAD Band */ +#define BCME_BUFTOOSHORT -14 /* Buffer too short */ +#define BCME_BUFTOOLONG -15 /* Buffer too long */ +#define BCME_BUSY -16 /* Busy */ +#define BCME_NOTASSOCIATED -17 /* Not Associated */ +#define BCME_BADSSIDLEN -18 /* Bad SSID len */ +#define BCME_OUTOFRANGECHAN -19 /* Out of Range Channel */ +#define BCME_BADCHAN -20 /* Bad Channel */ +#define BCME_BADADDR -21 /* Bad Address */ +#define BCME_NORESOURCE -22 /* Not Enough Resources */ +#define BCME_UNSUPPORTED -23 /* Unsupported */ +#define BCME_BADLEN -24 /* Bad length */ +#define BCME_NOTREADY -25 /* Not Ready */ +#define BCME_EPERM -26 /* Not Permitted */ +#define BCME_NOMEM -27 /* No Memory */ +#define BCME_ASSOCIATED -28 /* Associated */ +#define BCME_RANGE -29 /* Not In Range */ +#define BCME_NOTFOUND -30 /* Not Found */ +#define BCME_WME_NOT_ENABLED -31 /* WME Not Enabled */ +#define BCME_TSPEC_NOTFOUND -32 /* TSPEC Not Found */ +#define BCME_ACM_NOTSUPPORTED -33 /* ACM Not Supported */ +#define BCME_NOT_WME_ASSOCIATION -34 /* Not WME Association */ +#define BCME_SDIO_ERROR -35 /* SDIO Bus Error */ +#define BCME_DONGLE_DOWN -36 /* Dongle Not Accessible */ +#define BCME_LAST BCME_DONGLE_DOWN + +/* These are collection of BCME Error strings */ +#define BCMERRSTRINGTABLE { \ + "OK", \ + "Undefined error", \ + "Bad Argument", \ + "Bad Option", \ + "Not up", \ + "Not down", \ + "Not AP", \ + "Not STA", \ + "Bad Key Index", \ + "Radio Off", \ + "Not band locked", \ + "No clock", \ + "Bad Rate valueset", \ + "Bad Band", \ + "Buffer too short", \ + "Buffer too long", \ + "Busy", \ + "Not Associated", \ + "Bad SSID len", \ + "Out of Range Channel", \ + "Bad Channel", \ + "Bad Address", \ + "Not Enough Resources", \ + "Unsupported", \ + "Bad length", \ + "Not Ready", \ + "Not Permitted", \ + "No Memory", \ + "Associated", \ + "Not In Range", \ + "Not Found", \ + "WME Not Enabled", \ + "TSPEC Not Found", \ + "ACM Not Supported", \ + "Not WME Association", \ + "SDIO Bus Error", \ + "Dongle Not Accessible" \ +} + +#ifndef ABS +#define ABS(a) (((a) < 0)?-(a):(a)) +#endif /* ABS */ + +#ifndef MIN +#define MIN(a, b) (((a) < (b))?(a):(b)) +#endif /* MIN */ + +#ifndef MAX +#define MAX(a, b) (((a) > (b))?(a):(b)) +#endif /* MAX */ + +#define CEIL(x, y) (((x) + ((y)-1)) / (y)) +#define ROUNDUP(x, y) ((((x)+((y)-1))/(y))*(y)) +#define ISALIGNED(a, x) (((a) & ((x)-1)) == 0) +#define ISPOWEROF2(x) ((((x)-1)&(x)) == 0) +#define VALID_MASK(mask) !((mask) & ((mask) + 1)) +#define OFFSETOF(type, member) ((uint)(uintptr)&((type *)0)->member) +#define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0])) + +/* bit map related macros */ +#ifndef setbit +#ifndef NBBY /* the BSD family defines NBBY */ +#define NBBY 8 /* 8 bits per byte */ +#endif /* #ifndef NBBY */ +#define setbit(a, i) (((uint8 *)a)[(i)/NBBY] |= 1<<((i)%NBBY)) +#define clrbit(a, i) (((uint8 *)a)[(i)/NBBY] &= ~(1<<((i)%NBBY))) +#define isset(a, i) (((uint8 *)a)[(i)/NBBY] & (1<<((i)%NBBY))) +#define isclr(a, i) ((((uint8 *)a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) +#endif /* setbit */ + +#define NBITS(type) (sizeof(type) * 8) +#define NBITVAL(nbits) (1 << (nbits)) +#define MAXBITVAL(nbits) ((1 << (nbits)) - 1) +#define NBITMASK(nbits) MAXBITVAL(nbits) +#define MAXNBVAL(nbyte) MAXBITVAL((nbyte) * 8) + +/* basic mux operation - can be optimized on several architectures */ +#define MUX(pred, true, false) ((pred) ? (true) : (false)) + +/* modulo inc/dec - assumes x E [0, bound - 1] */ +#define MODDEC(x, bound) MUX((x) == 0, (bound) - 1, (x) - 1) +#define MODINC(x, bound) MUX((x) == (bound) - 1, 0, (x) + 1) + +/* modulo inc/dec, bound = 2^k */ +#define MODDEC_POW2(x, bound) (((x) - 1) & ((bound) - 1)) +#define MODINC_POW2(x, bound) (((x) + 1) & ((bound) - 1)) + +/* modulo add/sub - assumes x, y E [0, bound - 1] */ +#define MODADD(x, y, bound) \ + MUX((x) + (y) >= (bound), (x) + (y) - (bound), (x) + (y)) +#define MODSUB(x, y, bound) \ + MUX(((int)(x)) - ((int)(y)) < 0, (x) - (y) + (bound), (x) - (y)) + +/* module add/sub, bound = 2^k */ +#define MODADD_POW2(x, y, bound) (((x) + (y)) & ((bound) - 1)) +#define MODSUB_POW2(x, y, bound) (((x) - (y)) & ((bound) - 1)) + +/* crc defines */ +#define CRC8_INIT_VALUE 0xff /* Initial CRC8 checksum value */ +#define CRC8_GOOD_VALUE 0x9f /* Good final CRC8 checksum value */ +#define CRC16_INIT_VALUE 0xffff /* Initial CRC16 checksum value */ +#define CRC16_GOOD_VALUE 0xf0b8 /* Good final CRC16 checksum value */ +#define CRC32_INIT_VALUE 0xffffffff /* Initial CRC32 checksum value */ +#define CRC32_GOOD_VALUE 0xdebb20e3 /* Good final CRC32 checksum value */ + +/* bcm_format_flags() bit description structure */ +typedef struct bcm_bit_desc { + uint32 bit; + char* name; +} bcm_bit_desc_t; + +/* tag_ID/length/value_buffer tuple */ +typedef struct bcm_tlv { + uint8 id; + uint8 len; + uint8 data[1]; +} bcm_tlv_t; + +/* Check that bcm_tlv_t fits into the given buflen */ +#define bcm_valid_tlv(elt, buflen) ((buflen) >= 2 && (int)(buflen) >= (int)(2 + (elt)->len)) + +/* buffer length for ethernet address from bcm_ether_ntoa() */ +#define ETHER_ADDR_STR_LEN 18 /* 18-bytes of Ethernet address buffer length */ + +/* unaligned load and store macros */ +#ifdef IL_BIGENDIAN +static INLINE uint32 +load32_ua(uint8 *a) +{ + return ((a[0] << 24) | (a[1] << 16) | (a[2] << 8) | a[3]); +} + +static INLINE void +store32_ua(uint8 *a, uint32 v) +{ + a[0] = (v >> 24) & 0xff; + a[1] = (v >> 16) & 0xff; + a[2] = (v >> 8) & 0xff; + a[3] = v & 0xff; +} + +static INLINE uint16 +load16_ua(uint8 *a) +{ + return ((a[0] << 8) | a[1]); +} + +static INLINE void +store16_ua(uint8 *a, uint16 v) +{ + a[0] = (v >> 8) & 0xff; + a[1] = v & 0xff; +} + +#else + +static INLINE uint32 +load32_ua(uint8 *a) +{ + return ((a[3] << 24) | (a[2] << 16) | (a[1] << 8) | a[0]); +} + +static INLINE void +store32_ua(uint8 *a, uint32 v) +{ + a[3] = (v >> 24) & 0xff; + a[2] = (v >> 16) & 0xff; + a[1] = (v >> 8) & 0xff; + a[0] = v & 0xff; +} + +static INLINE uint16 +load16_ua(uint8 *a) +{ + return ((a[1] << 8) | a[0]); +} + +static INLINE void +store16_ua(uint8 *a, uint16 v) +{ + a[1] = (v >> 8) & 0xff; + a[0] = v & 0xff; +} + +#endif /* IL_BIGENDIAN */ + +#endif /* _bcmutils_h_ */ diff --git a/package/broadcom-wl/src/wlc/include/proto/802.11.h b/package/broadcom-wl/src/wlc/include/proto/802.11.h new file mode 100644 index 0000000000..2b1c4ee111 --- /dev/null +++ b/package/broadcom-wl/src/wlc/include/proto/802.11.h @@ -0,0 +1,1258 @@ +/* + * Copyright 2006, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * + * Fundamental types and constants relating to 802.11 + * + * $Id: 802.11.h,v 1.1.1.17 2006/04/15 01:29:08 michael Exp $ + */ + +#ifndef _802_11_H_ +#define _802_11_H_ + +#ifndef _TYPEDEFS_H_ +#include <typedefs.h> +#endif + +#ifndef _NET_ETHERNET_H_ +#include <proto/ethernet.h> +#endif + +#include <proto/wpa.h> + +/* enable structure packing */ +#if defined(__GNUC__) +#define PACKED __attribute__((packed)) +#else +#pragma pack(1) +#define PACKED +#endif + +#define DOT11_TU_TO_US 1024 /* 802.11 Time Unit is 1024 microseconds */ + +/* Generic 802.11 frame constants */ +#define DOT11_A3_HDR_LEN 24 /* d11 header length with A3 */ +#define DOT11_A4_HDR_LEN 30 /* d11 header length with A4 */ +#define DOT11_MAC_HDR_LEN DOT11_A3_HDR_LEN /* MAC header length */ +#define DOT11_FCS_LEN 4 /* d11 FCS length */ +#define DOT11_ICV_LEN 4 /* d11 ICV length */ +#define DOT11_ICV_AES_LEN 8 /* d11 ICV/AES length */ +#define DOT11_QOS_LEN 2 /* d11 QoS length */ +#define DOT11_HTC_LEN 4 /* d11 HT Control field length */ + +#define DOT11_KEY_INDEX_SHIFT 6 /* d11 key index shift */ +#define DOT11_IV_LEN 4 /* d11 IV length */ +#define DOT11_IV_TKIP_LEN 8 /* d11 IV TKIP length */ +#define DOT11_IV_AES_OCB_LEN 4 /* d11 IV/AES/OCB length */ +#define DOT11_IV_AES_CCM_LEN 8 /* d11 IV/AES/CCM length */ +#define DOT11_IV_MAX_LEN 8 /* maximum iv len for any encryption */ + +/* Includes MIC */ +#define DOT11_MAX_MPDU_BODY_LEN 2304 /* max MPDU body length */ +/* A4 header + QoS + CCMP + PDU + ICV + FCS = 2352 */ +#define DOT11_MAX_MPDU_LEN (DOT11_A4_HDR_LEN + \ + DOT11_QOS_LEN + \ + DOT11_IV_AES_CCM_LEN + \ + DOT11_MAX_MPDU_BODY_LEN + \ + DOT11_ICV_LEN + \ + DOT11_FCS_LEN) /* d11 max MPDU length */ + +#define DOT11_MAX_SSID_LEN 32 /* d11 max ssid length */ + +/* dot11RTSThreshold */ +#define DOT11_DEFAULT_RTS_LEN 2347 /* d11 default RTS length */ +#define DOT11_MAX_RTS_LEN 2347 /* d11 max RTS length */ + +/* dot11FragmentationThreshold */ +#define DOT11_MIN_FRAG_LEN 256 /* d11 min fragmentation length */ +#define DOT11_MAX_FRAG_LEN 2346 /* Max frag is also limited by aMPDUMaxLength + * of the attached PHY + */ +#define DOT11_DEFAULT_FRAG_LEN 2346 /* d11 default fragmentation length */ + +/* dot11BeaconPeriod */ +#define DOT11_MIN_BEACON_PERIOD 1 /* d11 min beacon period */ +#define DOT11_MAX_BEACON_PERIOD 0xFFFF /* d11 max beacon period */ + +/* dot11DTIMPeriod */ +#define DOT11_MIN_DTIM_PERIOD 1 /* d11 min DTIM period */ +#define DOT11_MAX_DTIM_PERIOD 0xFF /* d11 max DTIM period */ + +/* 802.2 LLC/SNAP header used by 802.11 per 802.1H */ +#define DOT11_LLC_SNAP_HDR_LEN 8 /* d11 LLC/SNAP header length */ +#define DOT11_OUI_LEN 3 /* d11 OUI length */ +struct dot11_llc_snap_header { + uint8 dsap; /* always 0xAA */ + uint8 ssap; /* always 0xAA */ + uint8 ctl; /* always 0x03 */ + uint8 oui[DOT11_OUI_LEN]; /* RFC1042: 0x00 0x00 0x00 + * Bridge-Tunnel: 0x00 0x00 0xF8 + */ + uint16 type; /* ethertype */ +} PACKED; + +/* RFC1042 header used by 802.11 per 802.1H */ +#define RFC1042_HDR_LEN (ETHER_HDR_LEN + DOT11_LLC_SNAP_HDR_LEN) /* RCF1042 header length */ + +/* Generic 802.11 MAC header */ +/* + * N.B.: This struct reflects the full 4 address 802.11 MAC header. + * The fields are defined such that the shorter 1, 2, and 3 + * address headers just use the first k fields. + */ +struct dot11_header { + uint16 fc; /* frame control */ + uint16 durid; /* duration/ID */ + struct ether_addr a1; /* address 1 */ + struct ether_addr a2; /* address 2 */ + struct ether_addr a3; /* address 3 */ + uint16 seq; /* sequence control */ + struct ether_addr a4; /* address 4 */ +} PACKED; + +/* Control frames */ + +struct dot11_rts_frame { + uint16 fc; /* frame control */ + uint16 durid; /* duration/ID */ + struct ether_addr ra; /* receiver address */ + struct ether_addr ta; /* transmitter address */ +} PACKED; +#define DOT11_RTS_LEN 16 /* d11 RTS frame length */ + +struct dot11_cts_frame { + uint16 fc; /* frame control */ + uint16 durid; /* duration/ID */ + struct ether_addr ra; /* receiver address */ +} PACKED; +#define DOT11_CTS_LEN 10 /* d11 CTS frame length */ + +struct dot11_ack_frame { + uint16 fc; /* frame control */ + uint16 durid; /* duration/ID */ + struct ether_addr ra; /* receiver address */ +} PACKED; +#define DOT11_ACK_LEN 10 /* d11 ACK frame length */ + +struct dot11_ps_poll_frame { + uint16 fc; /* frame control */ + uint16 durid; /* AID */ + struct ether_addr bssid; /* receiver address, STA in AP */ + struct ether_addr ta; /* transmitter address */ +} PACKED; +#define DOT11_PS_POLL_LEN 16 /* d11 PS poll frame length */ + +struct dot11_cf_end_frame { + uint16 fc; /* frame control */ + uint16 durid; /* duration/ID */ + struct ether_addr ra; /* receiver address */ + struct ether_addr bssid; /* transmitter address, STA in AP */ +} PACKED; +#define DOT11_CS_END_LEN 16 /* d11 CF-END frame length */ + +/* BA/BAR Control parameters */ +#define DOT11_BA_CTL_POLICY_NORMAL 0x0000 /* normal ack */ +#define DOT11_BA_CTL_POLICY_NOACK 0x0001 /* no ack */ +#define DOT11_BA_CTL_POLICY_MASK 0x0001 /* ack policy mask */ + +#define DOT11_BA_CTL_MTID 0x0002 /* multi tid BA */ +#define DOT11_BA_CTL_COMPRESSED 0x0004 /* compressed bitmap */ + +#define DOT11_BA_CTL_NUMMSDU_MASK 0x0FC0 /* num msdu in bitmap mask */ +#define DOT11_BA_CTL_NUMMSDU_SHIFT 6 /* num msdu in bitmap shift */ + +#define DOT11_BA_CTL_TID_MASK 0xF000 /* tid mask */ +#define DOT11_BA_CTL_TID_SHIFT 12 /* tid shift */ + +struct dot11_ba_req_frame { + uint16 fc; /* frame control */ + uint16 durid; /* duration/ID */ + struct ether_addr ra; /* receiver address */ + struct ether_addr ta; /* transmitter address */ + uint16 bar_control; /* BAR Control */ + uint16 seqnum; /* Starting Sequence control */ +} PACKED; +#define DOT11_BA_REQ_LEN 20 /* BAR frame length */ + +#define DOT11_BA_BITMAP_LEN 128 /* bitmap length */ +#define DOT11_BA_CMP_BITMAP_LEN 8 /* compressed bitmap length */ +struct dot11_ba_frame { + uint16 fc; /* frame control */ + uint16 durid; /* duration/ID */ + struct ether_addr ra; /* receiver address */ + struct ether_addr ta; /* transmitter address */ + uint16 ba_control; /* BA Control */ + uint16 seqnum; /* Starting Sequence control */ + uint8 bitmap[DOT11_BA_BITMAP_LEN]; /* Block Ack Bitmap */ +} PACKED; +#define DOT11_BA_LEN 20 /* BA frame length (without bitmap) */ + +/* Management frame header */ +struct dot11_management_header { + uint16 fc; /* frame control */ + uint16 durid; /* duration/ID */ + struct ether_addr da; /* receiver address */ + struct ether_addr sa; /* transmitter address */ + struct ether_addr bssid; /* BSS ID */ + uint16 seq; /* sequence control */ +} PACKED; +#define DOT11_MGMT_HDR_LEN 24 /* d11 management header length */ + +/* Management frame payloads */ + +struct dot11_bcn_prb { + uint32 timestamp[2]; + uint16 beacon_interval; + uint16 capability; +} PACKED; +#define DOT11_BCN_PRB_LEN 12 /* d11 beacon probe frame length */ + +struct dot11_auth { + uint16 alg; /* algorithm */ + uint16 seq; /* sequence control */ + uint16 status; /* status code */ +} PACKED; +#define DOT11_AUTH_FIXED_LEN 6 /* length of auth frame without challenge info + * elt + */ + +struct dot11_assoc_req { + uint16 capability; /* capability information */ + uint16 listen; /* listen interval */ +} PACKED; +#define DOT11_ASSOC_REQ_FIXED_LEN 4 /* length of assoc frame without info elts */ + +struct dot11_reassoc_req { + uint16 capability; /* capability information */ + uint16 listen; /* listen interval */ + struct ether_addr ap; /* Current AP address */ +} PACKED; +#define DOT11_REASSOC_REQ_FIXED_LEN 10 /* length of assoc frame without info elts */ + +struct dot11_assoc_resp { + uint16 capability; /* capability information */ + uint16 status; /* status code */ + uint16 aid; /* association ID */ +} PACKED; + +struct dot11_action_measure { + uint8 category; + uint8 action; + uint8 token; + uint8 data[1]; +} PACKED; +#define DOT11_ACTION_MEASURE_LEN 3 /* d11 action measurement header length */ + +struct dot11_action_switch_channel { + uint8 category; + uint8 action; + uint8 data[5]; /* for switch IE */ +} PACKED; + +struct dot11_action_ht_ch_width { + uint8 category; + uint8 action; + uint8 ch_width; +} PACKED; + +struct dot11_action_ht_mimops { + uint8 category; + uint8 action; + uint8 enable; + uint8 psmode; +} PACKED; + +/* ************* 802.11h related definitions. ************* */ +typedef struct { + uint8 id; + uint8 len; + uint8 power; +} dot11_power_cnst_t; + +typedef struct { + uint8 min; + uint8 max; +} dot11_power_cap_t; + +typedef struct { + uint8 id; + uint8 len; + uint8 tx_pwr; + uint8 margin; +} dot11_tpc_rep_t; +#define DOT11_MNG_IE_TPC_REPORT_LEN 2 /* length of IE data, not including 2 byte header */ + +typedef struct { + uint8 id; + uint8 len; + uint8 first_channel; + uint8 num_channels; +} dot11_supp_channels_t; + +/* channel switch announcement (CSA) mode type - 802.11h-2003 $7.3.2.20 */ +#define DOT11_CSA_MODE_ADVISORY 0 /* no DOT11_CSA_MODE_NO_TX restriction imposed */ +#define DOT11_CSA_MODE_NO_TX 1 /* no transmission upon receiving CSA frame. */ + +/* CSA IE data structure */ +struct dot11_channel_switch { + uint8 id; + uint8 len; + uint8 mode; + uint8 channel; + uint8 count; +} PACKED; +typedef struct dot11_channel_switch dot11_channel_switch_t; + +#define DOT11_SWITCH_IE_LEN 3 /* length of IE data, not including 2 byte header */ + +/* 802.11h Measurement Request/Report IEs */ +/* Measurement Type field */ +#define DOT11_MEASURE_TYPE_BASIC 0 /* d11 measurement basic type */ +#define DOT11_MEASURE_TYPE_CCA 1 /* d11 measurement CCA type */ +#define DOT11_MEASURE_TYPE_RPI 2 /* d11 measurement PRI type */ + +/* Measurement Mode field */ + +/* Measurement Request Modes */ +#define DOT11_MEASURE_MODE_ENABLE (1<<1) /* d11 measurement enable */ +#define DOT11_MEASURE_MODE_REQUEST (1<<2) /* d11 measurement request */ +#define DOT11_MEASURE_MODE_REPORT (1<<3) /* d11 measurement report */ +/* Measurement Report Modes */ +#define DOT11_MEASURE_MODE_LATE (1<<0) /* d11 measurement late */ +#define DOT11_MEASURE_MODE_INCAPABLE (1<<1) /* d11 measurement incapable */ +#define DOT11_MEASURE_MODE_REFUSED (1<<2) /* d11 measurement refuse */ +/* Basic Measurement Map bits */ +#define DOT11_MEASURE_BASIC_MAP_BSS ((uint8)(1<<0)) /* d11 measurement basic map BSS */ +#define DOT11_MEASURE_BASIC_MAP_OFDM ((uint8)(1<<1)) /* d11 measurement map OFDM */ +#define DOT11_MEASURE_BASIC_MAP_UKNOWN ((uint8)(1<<2)) /* d11 measurement map unknown */ +#define DOT11_MEASURE_BASIC_MAP_RADAR ((uint8)(1<<3)) /* d11 measurement map radar */ +#define DOT11_MEASURE_BASIC_MAP_UNMEAS ((uint8)(1<<4)) /* d11 measurement map unmeasuremnt */ + +typedef struct { + uint8 id; + uint8 len; + uint8 token; + uint8 mode; + uint8 type; + uint8 channel; + uint8 start_time[8]; + uint16 duration; +} dot11_meas_req_t; +#define DOT11_MNG_IE_MREQ_LEN 14 /* d11 measurement request IE length */ +/* length of Measure Request IE data not including variable len */ +#define DOT11_MNG_IE_MREQ_FIXED_LEN 3 /* d11 measurement request IE fixed length */ + +struct dot11_meas_rep { + uint8 id; + uint8 len; + uint8 token; + uint8 mode; + uint8 type; + union + { + struct { + uint8 channel; + uint8 start_time[8]; + uint16 duration; + uint8 map; + } PACKED basic; + uint8 data[1]; + } PACKED rep; +} PACKED; +typedef struct dot11_meas_rep dot11_meas_rep_t; + +/* length of Measure Report IE data not including variable len */ +#define DOT11_MNG_IE_MREP_FIXED_LEN 3 /* d11 measurement response IE fixed length */ + +struct dot11_meas_rep_basic { + uint8 channel; + uint8 start_time[8]; + uint16 duration; + uint8 map; +} PACKED; +typedef struct dot11_meas_rep_basic dot11_meas_rep_basic_t; +#define DOT11_MEASURE_BASIC_REP_LEN 12 /* d11 measurement basic report length */ + +struct dot11_quiet { + uint8 id; + uint8 len; + uint8 count; /* TBTTs until beacon interval in quiet starts */ + uint8 period; /* Beacon intervals between periodic quiet periods ? */ + uint16 duration; /* Length of quiet period, in TU's */ + uint16 offset; /* TU's offset from TBTT in Count field */ +} PACKED; +typedef struct dot11_quiet dot11_quiet_t; + +typedef struct { + uint8 channel; + uint8 map; +} chan_map_tuple_t; + +typedef struct { + uint8 id; + uint8 len; + uint8 eaddr[ETHER_ADDR_LEN]; + uint8 interval; + chan_map_tuple_t map[1]; +} dot11_ibss_dfs_t; + +/* WME Elements */ +#define WME_OUI "\x00\x50\xf2" /* WME OUI */ +#define WME_VER 1 /* WME version */ +#define WME_TYPE 2 /* WME type */ +#define WME_SUBTYPE_IE 0 /* Information Element */ +#define WME_SUBTYPE_PARAM_IE 1 /* Parameter Element */ +#define WME_SUBTYPE_TSPEC 2 /* Traffic Specification */ + +/* WME Access Category Indices (ACIs) */ +#define AC_BE 0 /* Best Effort */ +#define AC_BK 1 /* Background */ +#define AC_VI 2 /* Video */ +#define AC_VO 3 /* Voice */ +#define AC_COUNT 4 /* number of ACs */ + +typedef uint8 ac_bitmap_t; /* AC bitmap of (1 << AC_xx) */ + +#define AC_BITMAP_NONE 0x0 /* No ACs */ +#define AC_BITMAP_ALL 0xf /* All ACs */ +#define AC_BITMAP_TST(ab, ac) (((ab) & (1 << (ac))) != 0) + +/* WME Information Element (IE) */ +struct wme_ie { + uint8 oui[3]; + uint8 type; + uint8 subtype; + uint8 version; + uint8 qosinfo; +} PACKED; +typedef struct wme_ie wme_ie_t; +#define WME_IE_LEN 7 /* WME IE length */ + +struct edcf_acparam { + uint8 ACI; + uint8 ECW; + uint16 TXOP; /* stored in network order (ls octet first) */ +} PACKED; +typedef struct edcf_acparam edcf_acparam_t; + +/* WME Parameter Element (PE) */ +struct wme_param_ie { + uint8 oui[3]; + uint8 type; + uint8 subtype; + uint8 version; + uint8 qosinfo; + uint8 rsvd; + edcf_acparam_t acparam[AC_COUNT]; +} PACKED; +typedef struct wme_param_ie wme_param_ie_t; +#define WME_PARAM_IE_LEN 24 /* WME Parameter IE length */ + +/* QoS Info field for IE as sent from AP */ +#define WME_QI_AP_APSD_MASK 0x80 /* U-APSD Supported mask */ +#define WME_QI_AP_APSD_SHIFT 7 /* U-APSD Supported shift */ +#define WME_QI_AP_COUNT_MASK 0x0f /* Parameter set count mask */ +#define WME_QI_AP_COUNT_SHIFT 0 /* Parameter set count shift */ + +/* QoS Info field for IE as sent from STA */ +#define WME_QI_STA_MAXSPLEN_MASK 0x60 /* Max Service Period Length mask */ +#define WME_QI_STA_MAXSPLEN_SHIFT 5 /* Max Service Period Length shift */ +#define WME_QI_STA_APSD_ALL_MASK 0xf /* APSD all AC bits mask */ +#define WME_QI_STA_APSD_ALL_SHIFT 0 /* APSD all AC bits shift */ +#define WME_QI_STA_APSD_BE_MASK 0x8 /* APSD AC_BE mask */ +#define WME_QI_STA_APSD_BE_SHIFT 3 /* APSD AC_BE shift */ +#define WME_QI_STA_APSD_BK_MASK 0x4 /* APSD AC_BK mask */ +#define WME_QI_STA_APSD_BK_SHIFT 2 /* APSD AC_BK shift */ +#define WME_QI_STA_APSD_VI_MASK 0x2 /* APSD AC_VI mask */ +#define WME_QI_STA_APSD_VI_SHIFT 1 /* APSD AC_VI shift */ +#define WME_QI_STA_APSD_VO_MASK 0x1 /* APSD AC_VO mask */ +#define WME_QI_STA_APSD_VO_SHIFT 0 /* APSD AC_VO shift */ + +/* ACI */ +#define EDCF_AIFSN_MIN 1 /* AIFSN minimum value */ +#define EDCF_AIFSN_MAX 15 /* AIFSN maximum value */ +#define EDCF_AIFSN_MASK 0x0f /* AIFSN mask */ +#define EDCF_ACM_MASK 0x10 /* ACM mask */ +#define EDCF_ACI_MASK 0x60 /* ACI mask */ +#define EDCF_ACI_SHIFT 5 /* ACI shift */ + +/* ECW */ +#define EDCF_ECW_MIN 0 /* cwmin/cwmax exponent minimum value */ +#define EDCF_ECW_MAX 15 /* cwmin/cwmax exponent maximum value */ +#define EDCF_ECW2CW(exp) ((1 << (exp)) - 1) +#define EDCF_ECWMIN_MASK 0x0f /* cwmin exponent form mask */ +#define EDCF_ECWMAX_MASK 0xf0 /* cwmax exponent form mask */ +#define EDCF_ECWMAX_SHIFT 4 /* cwmax exponent form shift */ + +/* TXOP */ +#define EDCF_TXOP_MIN 0 /* TXOP minimum value */ +#define EDCF_TXOP_MAX 65535 /* TXOP maximum value */ +#define EDCF_TXOP2USEC(txop) ((txop) << 5) + +/* Default EDCF parameters that AP advertises for STA to use; WMM draft Table 12 */ +#define EDCF_AC_BE_ACI_STA 0x03 /* STA ACI value for best effort AC */ +#define EDCF_AC_BE_ECW_STA 0xA4 /* STA ECW value for best effort AC */ +#define EDCF_AC_BE_TXOP_STA 0x0000 /* STA TXOP value for best effort AC */ +#define EDCF_AC_BK_ACI_STA 0x27 /* STA ACI value for background AC */ +#define EDCF_AC_BK_ECW_STA 0xA4 /* STA ECW value for background AC */ +#define EDCF_AC_BK_TXOP_STA 0x0000 /* STA TXOP value for background AC */ +#define EDCF_AC_VI_ACI_STA 0x42 /* STA ACI value for video AC */ +#define EDCF_AC_VI_ECW_STA 0x43 /* STA ECW value for video AC */ +#define EDCF_AC_VI_TXOP_STA 0x005e /* STA TXOP value for video AC */ +#define EDCF_AC_VO_ACI_STA 0x62 /* STA ACI value for audio AC */ +#define EDCF_AC_VO_ECW_STA 0x32 /* STA ECW value for audio AC */ +#define EDCF_AC_VO_TXOP_STA 0x002f /* STA TXOP value for audio AC */ + +/* Default EDCF parameters that AP uses; WMM draft Table 14 */ +#define EDCF_AC_BE_ACI_AP 0x03 /* AP ACI value for best effort AC */ +#define EDCF_AC_BE_ECW_AP 0x64 /* AP ECW value for best effort AC */ +#define EDCF_AC_BE_TXOP_AP 0x0000 /* AP TXOP value for best effort AC */ +#define EDCF_AC_BK_ACI_AP 0x27 /* AP ACI value for background AC */ +#define EDCF_AC_BK_ECW_AP 0xA4 /* AP ECW value for background AC */ +#define EDCF_AC_BK_TXOP_AP 0x0000 /* AP TXOP value for background AC */ +#define EDCF_AC_VI_ACI_AP 0x41 /* AP ACI value for video AC */ +#define EDCF_AC_VI_ECW_AP 0x43 /* AP ECW value for video AC */ +#define EDCF_AC_VI_TXOP_AP 0x005e /* AP TXOP value for video AC */ +#define EDCF_AC_VO_ACI_AP 0x61 /* AP ACI value for audio AC */ +#define EDCF_AC_VO_ECW_AP 0x32 /* AP ECW value for audio AC */ +#define EDCF_AC_VO_TXOP_AP 0x002f /* AP TXOP value for audio AC */ + +struct dot11_qbss_load_ie { + uint8 id; /* 11, DOT11_MNG_QBSS_LOAD_ID */ + uint8 length; + uint16 station_count; /* total number of STAs associated */ + uint8 channel_utilization; /* % of time, normalized to 255, QAP sensed medium busy */ + uint16 aac; /* available admission capacity */ +} PACKED; +typedef struct dot11_qbss_load_ie dot11_qbss_load_ie_t; + +/* nom_msdu_size */ +#define FIXED_MSDU_SIZE 0x8000 /* MSDU size is fixed */ +#define MSDU_SIZE_MASK 0x7fff /* (Nominal or fixed) MSDU size */ + +/* surplus_bandwidth */ +/* Represented as 3 bits of integer, binary point, 13 bits fraction */ +#define INTEGER_SHIFT 13 /* integer shift */ +#define FRACTION_MASK 0x1FFF /* fraction mask */ + +/* Management Notification Frame */ +struct dot11_management_notification { + uint8 category; /* DOT11_ACTION_NOTIFICATION */ + uint8 action; + uint8 token; + uint8 status; + uint8 data[1]; /* Elements */ +} PACKED; +#define DOT11_MGMT_NOTIFICATION_LEN 4 /* Fixed length */ + +/* WME Action Codes */ +#define WME_ADDTS_REQUEST 0 /* WME ADDTS request */ +#define WME_ADDTS_RESPONSE 1 /* WME ADDTS response */ +#define WME_DELTS_REQUEST 2 /* WME DELTS request */ + +/* WME Setup Response Status Codes */ +#define WME_ADMISSION_ACCEPTED 0 /* WME admission accepted */ +#define WME_INVALID_PARAMETERS 1 /* WME invalide parameters */ +#define WME_ADMISSION_REFUSED 3 /* WME admission refused */ + +/* Macro to take a pointer to a beacon or probe response + * header and return the char* pointer to the SSID info element + */ +#define BCN_PRB_SSID(hdr) ((char*)(hdr) + DOT11_MGMT_HDR_LEN + DOT11_BCN_PRB_LEN) + +/* Authentication frame payload constants */ +#define DOT11_OPEN_SYSTEM 0 /* d11 open authentication */ +#define DOT11_SHARED_KEY 1 /* d11 shared authentication */ +#define DOT11_CHALLENGE_LEN 128 /* d11 chanllenge text length */ + +/* Frame control macros */ +#define FC_PVER_MASK 0x3 /* PVER mask */ +#define FC_PVER_SHIFT 0 /* PVER shift */ +#define FC_TYPE_MASK 0xC /* type mask */ +#define FC_TYPE_SHIFT 2 /* type shift */ +#define FC_SUBTYPE_MASK 0xF0 /* subtype mask */ +#define FC_SUBTYPE_SHIFT 4 /* subtype shift */ +#define FC_TODS 0x100 /* to DS */ +#define FC_TODS_SHIFT 8 /* to DS shift */ +#define FC_FROMDS 0x200 /* from DS */ +#define FC_FROMDS_SHIFT 9 /* from DS shift */ +#define FC_MOREFRAG 0x400 /* more frag. */ +#define FC_MOREFRAG_SHIFT 10 /* more frag. shift */ +#define FC_RETRY 0x800 /* retry */ +#define FC_RETRY_SHIFT 11 /* retry shift */ +#define FC_PM 0x1000 /* PM */ +#define FC_PM_SHIFT 12 /* PM shift */ +#define FC_MOREDATA 0x2000 /* more data */ +#define FC_MOREDATA_SHIFT 13 /* more data shift */ +#define FC_WEP 0x4000 /* WEP */ +#define FC_WEP_SHIFT 14 /* WEP shift */ +#define FC_ORDER 0x8000 /* order */ +#define FC_ORDER_SHIFT 15 /* order shift */ + +/* sequence control macros */ +#define SEQNUM_SHIFT 4 /* seq. number shift */ +#define SEQNUM_MAX 0x1000 /* max seqnum + 1 */ +#define FRAGNUM_MASK 0xF /* frag. number mask */ + +/* Frame Control type/subtype defs */ + +/* FC Types */ +#define FC_TYPE_MNG 0 /* management type */ +#define FC_TYPE_CTL 1 /* control type */ +#define FC_TYPE_DATA 2 /* data type */ + +/* Management Subtypes */ +#define FC_SUBTYPE_ASSOC_REQ 0 /* assoc. request */ +#define FC_SUBTYPE_ASSOC_RESP 1 /* assoc. response */ +#define FC_SUBTYPE_REASSOC_REQ 2 /* reassoc. request */ +#define FC_SUBTYPE_REASSOC_RESP 3 /* reassoc. response */ +#define FC_SUBTYPE_PROBE_REQ 4 /* probe request */ +#define FC_SUBTYPE_PROBE_RESP 5 /* probe response */ +#define FC_SUBTYPE_BEACON 8 /* beacon */ +#define FC_SUBTYPE_ATIM 9 /* ATIM */ +#define FC_SUBTYPE_DISASSOC 10 /* disassoc. */ +#define FC_SUBTYPE_AUTH 11 /* authentication */ +#define FC_SUBTYPE_DEAUTH 12 /* de-authentication */ +#define FC_SUBTYPE_ACTION 13 /* action */ + +/* Control Subtypes */ +#define FC_SUBTYPE_BLOCKACK_REQ 8 /* Block Ack Req */ +#define FC_SUBTYPE_BLOCKACK 9 /* Block Ack */ +#define FC_SUBTYPE_PS_POLL 10 /* PS poll */ +#define FC_SUBTYPE_RTS 11 /* RTS */ +#define FC_SUBTYPE_CTS 12 /* CTS */ +#define FC_SUBTYPE_ACK 13 /* ACK */ +#define FC_SUBTYPE_CF_END 14 /* CF-END */ +#define FC_SUBTYPE_CF_END_ACK 15 /* CF-END ACK */ + +/* Data Subtypes */ +#define FC_SUBTYPE_DATA 0 /* Data */ +#define FC_SUBTYPE_DATA_CF_ACK 1 /* Data + CF-ACK */ +#define FC_SUBTYPE_DATA_CF_POLL 2 /* Data + CF-Poll */ +#define FC_SUBTYPE_DATA_CF_ACK_POLL 3 /* Data + CF-Ack + CF-Poll */ +#define FC_SUBTYPE_NULL 4 /* Null */ +#define FC_SUBTYPE_CF_ACK 5 /* CF-Ack */ +#define FC_SUBTYPE_CF_POLL 6 /* CF-Poll */ +#define FC_SUBTYPE_CF_ACK_POLL 7 /* CF-Ack + CF-Poll */ +#define FC_SUBTYPE_QOS_DATA 8 /* QoS Data */ +#define FC_SUBTYPE_QOS_DATA_CF_ACK 9 /* QoS Data + CF-Ack */ +#define FC_SUBTYPE_QOS_DATA_CF_POLL 10 /* QoS Data + CF-Poll */ +#define FC_SUBTYPE_QOS_DATA_CF_ACK_POLL 11 /* QoS Data + CF-Ack + CF-Poll */ +#define FC_SUBTYPE_QOS_NULL 12 /* QoS Null */ +#define FC_SUBTYPE_QOS_CF_POLL 14 /* QoS CF-Poll */ +#define FC_SUBTYPE_QOS_CF_ACK_POLL 15 /* QoS CF-Ack + CF-Poll */ + +/* Data Subtype Groups */ +#define FC_SUBTYPE_ANY_QOS(s) (((s) & 8) != 0) +#define FC_SUBTYPE_ANY_NULL(s) (((s) & 4) != 0) +#define FC_SUBTYPE_ANY_CF_POLL(s) (((s) & 2) != 0) +#define FC_SUBTYPE_ANY_CF_ACK(s) (((s) & 1) != 0) + +/* Type/Subtype Combos */ +#define FC_KIND_MASK (FC_TYPE_MASK | FC_SUBTYPE_MASK) /* FC kind mask */ + +#define FC_KIND(t, s) (((t) << FC_TYPE_SHIFT) | ((s) << FC_SUBTYPE_SHIFT)) /* FC kind */ + +#define FC_SUBTYPE(fc) (((fc) & FC_SUBTYPE_MASK) >> FC_SUBTYPE_SHIFT) /* Subtype from FC */ +#define FC_TYPE(fc) (((fc) & FC_TYPE_MASK) >> FC_TYPE_SHIFT) /* Type from FC */ + +#define FC_ASSOC_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ASSOC_REQ) /* assoc. request */ +#define FC_ASSOC_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ASSOC_RESP) /* assoc. response */ +#define FC_REASSOC_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_REASSOC_REQ) /* reassoc. request */ +#define FC_REASSOC_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_REASSOC_RESP) /* reassoc. response */ +#define FC_PROBE_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_PROBE_REQ) /* probe request */ +#define FC_PROBE_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_PROBE_RESP) /* probe response */ +#define FC_BEACON FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_BEACON) /* beacon */ +#define FC_DISASSOC FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_DISASSOC) /* disassoc */ +#define FC_AUTH FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_AUTH) /* authentication */ +#define FC_DEAUTH FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_DEAUTH) /* deauthentication */ +#define FC_ACTION FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ACTION) /* action */ + +#define FC_BLOCKACK_REQ FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_BLOCKACK_REQ) /* Block Ack Req */ +#define FC_BLOCKACK FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_BLOCKACK) /* Block Ack */ +#define FC_PS_POLL FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_PS_POLL) /* PS poll */ +#define FC_RTS FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_RTS) /* RTS */ +#define FC_CTS FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CTS) /* CTS */ +#define FC_ACK FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_ACK) /* ACK */ +#define FC_CF_END FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CF_END) /* CF-END */ +#define FC_CF_END_ACK FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CF_END_ACK) /* CF-END ACK */ + +#define FC_DATA FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_DATA) /* data */ +#define FC_NULL_DATA FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_NULL) /* null data */ +#define FC_DATA_CF_ACK FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_DATA_CF_ACK) /* data CF ACK */ +#define FC_QOS_DATA FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_QOS_DATA) /* QoS data */ +#define FC_QOS_NULL FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_QOS_NULL) /* QoS null */ + +/* QoS Control Field */ + +/* 802.1D Priority */ +#define QOS_PRIO_SHIFT 0 /* QoS priority shift */ +#define QOS_PRIO_MASK 0x0007 /* QoS priority mask */ +#define QOS_PRIO(qos) (((qos) & QOS_PRIO_MASK) >> QOS_PRIO_SHIFT) /* QoS priority */ + +/* Traffic Identifier */ +#define QOS_TID_SHIFT 0 /* QoS TID shift */ +#define QOS_TID_MASK 0x000f /* QoS TID mask */ +#define QOS_TID(qos) (((qos) & QOS_TID_MASK) >> QOS_TID_SHIFT) /* QoS TID */ + +/* End of Service Period (U-APSD) */ +#define QOS_EOSP_SHIFT 4 /* QoS End of Service Period shift */ +#define QOS_EOSP_MASK 0x0010 /* QoS End of Service Period mask */ +#define QOS_EOSP(qos) (((qos) & QOS_EOSP_MASK) >> QOS_EOSP_SHIFT) /* Qos EOSP */ + +/* Ack Policy */ +#define QOS_ACK_NORMAL_ACK 0 /* Normal Ack */ +#define QOS_ACK_NO_ACK 1 /* No Ack (eg mcast) */ +#define QOS_ACK_NO_EXP_ACK 2 /* No Explicit Ack */ +#define QOS_ACK_BLOCK_ACK 3 /* Block Ack */ +#define QOS_ACK_SHIFT 5 /* QoS ACK shift */ +#define QOS_ACK_MASK 0x0060 /* QoS ACK mask */ +#define QOS_ACK(qos) (((qos) & QOS_ACK_MASK) >> QOS_ACK_SHIFT) /* QoS ACK */ + +/* A-MSDU flag */ +#define QOS_AMSDU_SHIFT 7 /* AMSDU shift */ +#define QOS_AMSDU_MASK 0x0080 /* AMSDU mask */ + +/* Management Frames */ + +/* Management Frame Constants */ + +/* Fixed fields */ +#define DOT11_MNG_AUTH_ALGO_LEN 2 /* d11 management auth. algo. length */ +#define DOT11_MNG_AUTH_SEQ_LEN 2 /* d11 management auth. seq. length */ +#define DOT11_MNG_BEACON_INT_LEN 2 /* d11 management beacon interval length */ +#define DOT11_MNG_CAP_LEN 2 /* d11 management cap. length */ +#define DOT11_MNG_AP_ADDR_LEN 6 /* d11 management AP address length */ +#define DOT11_MNG_LISTEN_INT_LEN 2 /* d11 management listen interval length */ +#define DOT11_MNG_REASON_LEN 2 /* d11 management reason length */ +#define DOT11_MNG_AID_LEN 2 /* d11 management AID length */ +#define DOT11_MNG_STATUS_LEN 2 /* d11 management status length */ +#define DOT11_MNG_TIMESTAMP_LEN 8 /* d11 management timestamp length */ + +/* DUR/ID field in assoc resp is 0xc000 | AID */ +#define DOT11_AID_MASK 0x3fff /* d11 AID mask */ + +/* Reason Codes */ +#define DOT11_RC_RESERVED 0 /* d11 RC reserved */ +#define DOT11_RC_UNSPECIFIED 1 /* Unspecified reason */ +#define DOT11_RC_AUTH_INVAL 2 /* Previous authentication no longer + * valid + */ +#define DOT11_RC_DEAUTH_LEAVING 3 /* Deauthenticated because sending station + * is leaving (or has left) IBSS or ESS + */ +#define DOT11_RC_INACTIVITY 4 /* Disassociated due to inactivity */ +#define DOT11_RC_BUSY 5 /* Disassociated because AP is unable + * to handle all currently associated + * stations + */ +#define DOT11_RC_INVAL_CLASS_2 6 /* Class 2 frame received from + * nonauthenticated station + */ +#define DOT11_RC_INVAL_CLASS_3 7 /* Class 3 frame received from + * nonassociated station + */ +#define DOT11_RC_DISASSOC_LEAVING 8 /* Disassociated because sending station is + * leaving (or has left) BSS + */ +#define DOT11_RC_NOT_AUTH 9 /* Station requesting (re)association is + * not authenticated with responding + * station + */ +#define DOT11_RC_MAX 23 /* Reason codes > 23 are reserved */ + +/* Status Codes */ +#define DOT11_STATUS_SUCCESS 0 /* Successful */ +#define DOT11_STATUS_FAILURE 1 /* Unspecified failure */ +#define DOT11_STATUS_CAP_MISMATCH 10 /* Cannot support all requested + * capabilities in the Capability + * Information field + */ +#define DOT11_STATUS_REASSOC_FAIL 11 /* Reassociation denied due to inability + * to confirm that association exists + */ +#define DOT11_STATUS_ASSOC_FAIL 12 /* Association denied due to reason + * outside the scope of this standard + */ +#define DOT11_STATUS_AUTH_MISMATCH 13 /* Responding station does not support + * the specified authentication + * algorithm + */ +#define DOT11_STATUS_AUTH_SEQ 14 /* Received an Authentication frame + * with authentication transaction + * sequence number out of expected + * sequence + */ +#define DOT11_STATUS_AUTH_CHALLENGE_FAIL 15 /* Authentication rejected because of + * challenge failure + */ +#define DOT11_STATUS_AUTH_TIMEOUT 16 /* Authentication rejected due to timeout + * waiting for next frame in sequence + */ +#define DOT11_STATUS_ASSOC_BUSY_FAIL 17 /* Association denied because AP is + * unable to handle additional + * associated stations + */ +#define DOT11_STATUS_ASSOC_RATE_MISMATCH 18 /* Association denied due to requesting + * station not supporting all of the + * data rates in the BSSBasicRateSet + * parameter + */ +#define DOT11_STATUS_ASSOC_SHORT_REQUIRED 19 /* Association denied due to requesting + * station not supporting the Short + * Preamble option + */ +#define DOT11_STATUS_ASSOC_PBCC_REQUIRED 20 /* Association denied due to requesting + * station not supporting the PBCC + * Modulation option + */ +#define DOT11_STATUS_ASSOC_AGILITY_REQUIRED 21 /* Association denied due to requesting + * station not supporting the Channel + * Agility option + */ +#define DOT11_STATUS_ASSOC_SPECTRUM_REQUIRED 22 /* Association denied because Spectrum + * Management capability is required. + */ +#define DOT11_STATUS_ASSOC_BAD_POWER_CAP 23 /* Association denied because the info + * in the Power Cap element is + * unacceptable. + */ +#define DOT11_STATUS_ASSOC_BAD_SUP_CHANNELS 24 /* Association denied because the info + * in the Supported Channel element is + * unacceptable + */ +#define DOT11_STATUS_ASSOC_SHORTSLOT_REQUIRED 25 /* Association denied due to requesting + * station not supporting the Short Slot + * Time option + */ +#define DOT11_STATUS_ASSOC_ERPBCC_REQUIRED 26 /* Association denied due to requesting + * station not supporting the ER-PBCC + * Modulation option + */ +#define DOT11_STATUS_ASSOC_DSSOFDM_REQUIRED 27 /* Association denied due to requesting + * station not supporting the DSS-OFDM + * option + */ + +/* Info Elts, length of INFORMATION portion of Info Elts */ +#define DOT11_MNG_DS_PARAM_LEN 1 /* d11 management DS parameter length */ +#define DOT11_MNG_IBSS_PARAM_LEN 2 /* d11 management IBSS parameter length */ + +/* TIM Info element has 3 bytes fixed info in INFORMATION field, + * followed by 1 to 251 bytes of Partial Virtual Bitmap + */ +#define DOT11_MNG_TIM_FIXED_LEN 3 /* d11 management TIM fixed length */ +#define DOT11_MNG_TIM_DTIM_COUNT 0 /* d11 management DTIM count */ +#define DOT11_MNG_TIM_DTIM_PERIOD 1 /* d11 management DTIM period */ +#define DOT11_MNG_TIM_BITMAP_CTL 2 /* d11 management TIM BITMAP control */ +#define DOT11_MNG_TIM_PVB 3 /* d11 management TIM PVB */ + +/* TLV defines */ +#define TLV_TAG_OFF 0 /* tag offset */ +#define TLV_LEN_OFF 1 /* length offset */ +#define TLV_HDR_LEN 2 /* header length */ +#define TLV_BODY_OFF 2 /* body offset */ + +/* Management Frame Information Element IDs */ +#define DOT11_MNG_SSID_ID 0 /* d11 management SSID id */ +#define DOT11_MNG_RATES_ID 1 /* d11 management rates id */ +#define DOT11_MNG_FH_PARMS_ID 2 /* d11 management FH parameter id */ +#define DOT11_MNG_DS_PARMS_ID 3 /* d11 management DS parameter id */ +#define DOT11_MNG_CF_PARMS_ID 4 /* d11 management CF parameter id */ +#define DOT11_MNG_TIM_ID 5 /* d11 management TIM id */ +#define DOT11_MNG_IBSS_PARMS_ID 6 /* d11 management IBSS parameter id */ +#define DOT11_MNG_COUNTRY_ID 7 /* d11 management country id */ +#define DOT11_MNG_HOPPING_PARMS_ID 8 /* d11 management hopping parameter id */ +#define DOT11_MNG_HOPPING_TABLE_ID 9 /* d11 management hopping table id */ +#define DOT11_MNG_REQUEST_ID 10 /* d11 management request id */ +#define DOT11_MNG_QBSS_LOAD_ID 11 /* d11 management QBSS Load id */ +#define DOT11_MNG_CHALLENGE_ID 16 /* d11 management chanllenge id */ +#define DOT11_MNG_PWR_CONSTRAINT_ID 32 /* 11H PowerConstraint */ +#define DOT11_MNG_PWR_CAP_ID 33 /* 11H PowerCapability */ +#define DOT11_MNG_TPC_REQUEST_ID 34 /* 11H TPC Request */ +#define DOT11_MNG_TPC_REPORT_ID 35 /* 11H TPC Report */ +#define DOT11_MNG_SUPP_CHANNELS_ID 36 /* 11H Supported Channels */ +#define DOT11_MNG_CHANNEL_SWITCH_ID 37 /* 11H ChannelSwitch Announcement */ +#define DOT11_MNG_MEASURE_REQUEST_ID 38 /* 11H MeasurementRequest */ +#define DOT11_MNG_MEASURE_REPORT_ID 39 /* 11H MeasurementReport */ +#define DOT11_MNG_QUIET_ID 40 /* 11H Quiet */ +#define DOT11_MNG_IBSS_DFS_ID 41 /* 11H IBSS_DFS */ +#define DOT11_MNG_ERP_ID 42 /* d11 management ERP id */ +#define DOT11_MNG_TS_DELAY_ID 43 /* d11 management TS Delay id */ +#define DOT11_MNG_NONERP_ID 47 /* d11 management NON-ERP id */ +#define DOT11_MNG_RSN_ID 48 /* d11 management RSN id */ +#define DOT11_MNG_EXT_RATES_ID 50 /* d11 management ext. rates id */ +#define DOT11_MNG_WPA_ID 221 /* d11 management WPA id */ +#define DOT11_MNG_PROPR_ID 221 /* d11 management proprietary id */ + +/* Rate element Basic flag and rate mask */ +#define DOT11_RATE_BASIC 0x80 /* flag for a Basic Rate */ +#define DOT11_RATE_MASK 0x7F /* mask for numeric part of rate */ + +/* ERP info element bit values */ +#define DOT11_MNG_ERP_LEN 1 /* ERP is currently 1 byte long */ +#define DOT11_MNG_NONERP_PRESENT 0x01 /* NonERP (802.11b) STAs are present + *in the BSS + */ +#define DOT11_MNG_USE_PROTECTION 0x02 /* Use protection mechanisms for + *ERP-OFDM frames + */ +#define DOT11_MNG_BARKER_PREAMBLE 0x04 /* Short Preambles: 0 == allowed, + * 1 == not allowed + */ +/* TS Delay element offset & size */ +#define DOT11_MGN_TS_DELAY_LEN 4 /* length of TS DELAY IE */ +#define TS_DELAY_FIELD_SIZE 4 /* TS DELAY field size */ + +/* Capability Information Field */ +#define DOT11_CAP_ESS 0x0001 /* d11 cap. ESS */ +#define DOT11_CAP_IBSS 0x0002 /* d11 cap. IBSS */ +#define DOT11_CAP_POLLABLE 0x0004 /* d11 cap. pollable */ +#define DOT11_CAP_POLL_RQ 0x0008 /* d11 cap. poll request */ +#define DOT11_CAP_PRIVACY 0x0010 /* d11 cap. privacy */ +#define DOT11_CAP_SHORT 0x0020 /* d11 cap. short */ +#define DOT11_CAP_PBCC 0x0040 /* d11 cap. PBCC */ +#define DOT11_CAP_AGILITY 0x0080 /* d11 cap. agility */ +#define DOT11_CAP_SPECTRUM 0x0100 /* d11 cap. spectrum */ +#define DOT11_CAP_SHORTSLOT 0x0400 /* d11 cap. shortslot */ +#define DOT11_CAP_CCK_OFDM 0x2000 /* d11 cap. CCK/OFDM */ + +/* Action Frame Constants */ +#define DOT11_ACTION_CAT_ERR_MASK 0x80 /* d11 action category error mask */ +#define DOT11_ACTION_CAT_MASK 0x7F /* d11 action category mask */ +#define DOT11_ACTION_CAT_SPECT_MNG 0x00 /* d11 action category spectrum management */ +#define DOT11_ACTION_CAT_BLOCKACK 0x03 /* d11 action category block ack */ +#define DOT11_ACTION_NOTIFICATION 0x11 /* 17 */ + +#define DOT11_ACTION_ID_M_REQ 0 /* d11 action measurement request */ +#define DOT11_ACTION_ID_M_REP 1 /* d11 action measurement response */ +#define DOT11_ACTION_ID_TPC_REQ 2 /* d11 action TPC request */ +#define DOT11_ACTION_ID_TPC_REP 3 /* d11 action TPC response */ +#define DOT11_ACTION_ID_CHANNEL_SWITCH 4 /* d11 action channel switch */ + +/* HT (EWC) action ids */ +#define DOT11_ACTION_ID_HT_CH_WIDTH 0 /* mimo ps action frame id */ +#define DOT11_ACTION_ID_HT_MIMO_PS 1 /* mimo ps action frame id */ + +/* Block Ack action types */ +#define DOT11_BA_ACTION_ADDBA_REQ 0 /* ADDBA Req action frame type */ +#define DOT11_BA_ACTION_ADDBA_RESP 1 /* ADDBA Resp action frame type */ +#define DOT11_BA_ACTION_DELBA 2 /* DELBA action frame type */ + +/* ADDBA action parameters */ +#define DOT11_ADDBA_PARAM_POLICY_MASK 0x0002 /* policy mask(ack vs delayed) */ +#define DOT11_ADDBA_PARAM_POLICY_SHIFT 1 /* policy shift */ +#define DOT11_ADDBA_PARAM_TID_MASK 0x003c /* tid mask */ +#define DOT11_ADDBA_PARAM_TID_SHIFT 2 /* tid shift */ +#define DOT11_ADDBA_PARAM_BSIZE_MASK 0xffc0 /* buffer size mask */ +#define DOT11_ADDBA_PARAM_BSIZE_SHIFT 6 /* buffer size shift */ + +#define DOT11_ADDBA_POLICY_DELAYED 0 /* delayed BA policy */ +#define DOT11_ADDBA_POLICY_IMMEDIATE 1 /* immediate BA policy */ + +struct dot11_addba_req { + uint8 category; /* category of action frame (3) */ + uint8 action; /* action: addba req */ + uint8 token; /* identifier */ + uint16 addba_param_set; /* parameter set */ + uint16 timeout; /* timeout in seconds */ + uint16 start_seqnum; /* starting sequence number */ +}PACKED; +typedef struct dot11_addba_req dot11_addba_req_t; +#define DOT11_ADDBA_REQ_LEN 9 /* length of addba req frame */ + +struct dot11_addba_resp { + uint8 category; /* category of action frame (3) */ + uint8 action; /* action: addba resp */ + uint8 token; /* identifier */ + uint16 status; /* status of add request */ + uint16 addba_param_set; /* negotiated parameter set */ + uint16 timeout; /* negotiated timeout in seconds */ +}PACKED; +typedef struct dot11_addba_resp dot11_addba_resp_t; +#define DOT11_ADDBA_RESP_LEN 9 /* length of addba resp frame */ + +/* DELBA action parameters */ +#define DOT11_DELBA_PARAM_INIT_MASK 0x0800 /* initiator mask */ +#define DOT11_DELBA_PARAM_INIT_SHIFT 11 /* initiator shift */ +#define DOT11_DELBA_PARAM_TID_MASK 0xf000 /* tid mask */ +#define DOT11_DELBA_PARAM_TID_SHIFT 12 /* tid shift */ + +struct dot11_delba { + uint8 category; /* category of action frame (3) */ + uint8 action; /* action: addba req */ + uint16 delba_param_set; /* paarmeter set */ + uint16 reason; /* reason for dellba */ +}PACKED; +typedef struct dot11_delba dot11_delba_t; +#define DOT11_DELBA_LEN 6 /* length of delba frame */ + +/* MLME Enumerations */ +#define DOT11_BSSTYPE_INFRASTRUCTURE 0 /* d11 infrastructure */ +#define DOT11_BSSTYPE_INDEPENDENT 1 /* d11 independent */ +#define DOT11_BSSTYPE_ANY 2 /* d11 any BSS type */ +#define DOT11_SCANTYPE_ACTIVE 0 /* d11 scan active */ +#define DOT11_SCANTYPE_PASSIVE 1 /* d11 scan passive */ + +/* 802.11 BRCM "Compromise" Pre N constants */ +#define PREN_PREAMBLE 24 /* green field preamble time */ +#define PREN_MM_EXT 16 /* extra mixed mode preamble time */ +#define PREN_PREAMBLE_EXT 4 /* extra preamble (multiply by unique_streams-1) */ + +/* 802.11 A PHY constants */ +#define APHY_SLOT_TIME 9 /* APHY slot time */ +#define APHY_SIFS_TIME 16 /* APHY SIFS time */ +#define APHY_DIFS_TIME (APHY_SIFS_TIME + (2 * APHY_SLOT_TIME)) /* APHY DIFS time */ +#define APHY_PREAMBLE_TIME 16 /* APHY preamble time */ +#define APHY_SIGNAL_TIME 4 /* APHY signal time */ +#define APHY_SYMBOL_TIME 4 /* APHY symbol time */ +#define APHY_SERVICE_NBITS 16 /* APHY service nbits */ +#define APHY_TAIL_NBITS 6 /* APHY tail nbits */ +#define APHY_CWMIN 15 /* APHY cwmin */ + +/* 802.11 B PHY constants */ +#define BPHY_SLOT_TIME 20 /* BPHY slot time */ +#define BPHY_SIFS_TIME 10 /* BPHY SIFS time */ +#define BPHY_DIFS_TIME 50 /* BPHY DIFS time */ +#define BPHY_PLCP_TIME 192 /* BPHY PLCP time */ +#define BPHY_PLCP_SHORT_TIME 96 /* BPHY PLCP short time */ +#define BPHY_CWMIN 31 /* BPHY cwmin */ + +/* 802.11 G constants */ +#define DOT11_OFDM_SIGNAL_EXTENSION 6 /* d11 OFDM signal extension */ + +#define PHY_CWMAX 1023 /* PHY cwmax */ + +#define DOT11_MAXNUMFRAGS 16 /* max # fragments per MSDU */ + +/* dot11Counters Table - 802.11 spec., Annex D */ +typedef struct d11cnt { + uint32 txfrag; /* dot11TransmittedFragmentCount */ + uint32 txmulti; /* dot11MulticastTransmittedFrameCount */ + uint32 txfail; /* dot11FailedCount */ + uint32 txretry; /* dot11RetryCount */ + uint32 txretrie; /* dot11MultipleRetryCount */ + uint32 rxdup; /* dot11FrameduplicateCount */ + uint32 txrts; /* dot11RTSSuccessCount */ + uint32 txnocts; /* dot11RTSFailureCount */ + uint32 txnoack; /* dot11ACKFailureCount */ + uint32 rxfrag; /* dot11ReceivedFragmentCount */ + uint32 rxmulti; /* dot11MulticastReceivedFrameCount */ + uint32 rxcrc; /* dot11FCSErrorCount */ + uint32 txfrmsnt; /* dot11TransmittedFrameCount */ + uint32 rxundec; /* dot11WEPUndecryptableCount */ +} d11cnt_t; + +/* BRCM OUI */ +#define BRCM_OUI "\x00\x10\x18" /* Broadcom OUI */ + +/* OUI for BRCM proprietary IE */ +#define BRCM_PROP_OUI "\x00\x90\x4C" /* Broadcom proprietary OUI */ + +/* BRCM info element */ +struct brcm_ie { + uint8 id; /* IE ID, 221, DOT11_MNG_PROPR_ID */ + uint8 len; /* IE length */ + uint8 oui[3]; /* Proprietary OUI, BRCM_OUI */ + uint8 ver; /* type/ver of this IE */ + uint8 assoc; /* # of assoc STAs */ + uint8 flags; /* misc flags */ + uint8 flags1; /* misc flags */ + uint16 amsdu_mtu_pref; /* preferred A-MSDU MTU */ +} PACKED; +typedef struct brcm_ie brcm_ie_t; +#define BRCM_IE_LEN 11 /* BRCM IE length */ +#define BRCM_IE_VER 2 /* BRCM IE version */ +#define BRCM_IE_LEGACY_AES_VER 1 /* BRCM IE legacy AES version */ + +/* brcm_ie flags */ +#define BRF_ABCAP 0x1 /* afterburner capable */ +#define BRF_ABRQRD 0x2 /* afterburner requested */ +#define BRF_LZWDS 0x4 /* lazy wds enabled */ +#define BRF_BLOCKACK 0x8 /* BlockACK capable */ +#define BRF_ABCOUNTER_MASK 0xf0 /* afterburner wds "state" counter */ +#define BRF_ABCOUNTER_SHIFT 4 /* offset of afterburner wds "state" counter */ + +/* brcm_ie flags1 */ +#define BRF1_AMSDU 0x1 /* A-MSDU capable */ + +#define AB_WDS_TIMEOUT_MAX 15 /* afterburner wds Max count indicating not + * locally capable + */ +#define AB_WDS_TIMEOUT_MIN 1 /* afterburner wds, use zero count as indicating + * "downrev" + */ + +/* EWC definitions */ +#define MCSSET_LEN 16 /* 16-bits per 8-bit set to give 128-bits bitmap of MCS Index */ + +struct ewc_cap { + uint16 cap; + uint8 params; + uint8 supp_mcs[MCSSET_LEN]; + uint16 ext_htcap; + uint32 txbf_cap; + uint8 as_cap; +} PACKED; +typedef struct ewc_cap ewc_cap_t; + +/* CAP IE: EWC 1.0 spec. simply stole a 802.11 IE, we use our prop. IE until this is resolved */ +/* the capability IE is primarily used to convey this nodes abilities */ +struct ewc_cap_ie { + uint8 id; /* IE ID, 221, DOT11_MNG_PROPR_ID */ + uint8 len; /* IE length */ + uint8 oui[3]; /* Proprietary OUI, BRCM_PROP_OUI */ + uint8 type; /* type inidicates what follows */ + ewc_cap_t cap; +} PACKED; +typedef struct ewc_cap_ie ewc_cap_ie_t; + +#define EWC_CAP_IE_LEN (26+4) +#define EWC_CAP_IE_TYPE 51 + +#define EWC_CAP_ADC_CODING 0x0001 /* Advance coding support */ +#define EWC_CAP_40MHZ 0x0002 /* FALSE:20Mhz, TRUE: 20 and 40MHZ supported */ +#define EWC_CAP_MIMO_PS_MASK 0x000C /* Mimo PS mask */ +#define EWC_CAP_MIMO_PS_SHIFT 0x0002 /* Mimo PS shift */ +#define EWC_CAP_MIMO_PS_OFF 0x0003 /* Mimo PS, no restriction */ +#define EWC_CAP_MIMO_PS_RTS 0x0001 /* Mimo PS, send RTS/CTS around MIMO frames */ +#define EWC_CAP_MIMO_PS_ON 0x0000 /* Mimo PS, MIMO disallowed */ +#define EWC_CAP_GF 0x0010 /* Greenfield preamble support */ +#define EWC_CAP_SHORT_GI_20 0x0020 /* 20MHZ short guard interval support */ +#define EWC_CAP_SHORT_GI_40 0x0040 /* 40Mhz short guard interval support */ +#define EWC_CAP_TX_STBC 0x0080 /* Tx STBC support */ +#define EWC_CAP_RX_STBC_MASK 0x0300 /* Rx STBC mask */ +#define EWC_CAP_RX_STBC_SHIFT 8 /* Rx STBC shift */ +#define EWC_CAP_DELAYED_BA 0x0400 /* delayed BA support */ +#define EWC_CAP_MAX_AMSDU 0x0800 /* Max AMSDU size in bytes , 0=3839, 1=7935 */ +#define EWC_CAP_DSSS_CCK 0x1000 /* DSSS/CCK supported by the BSS */ +#define EWC_CAP_PSMP 0x2000 /* Power Save Multi Poll support */ +#define EWC_CAP_STBC_CTL 0x4000 /* STBC control frame support */ +#define EWC_CAP_LSIG_TXOP 0x8000 /* L-SIG TXOP protection support */ + +#define EWC_MAX_AMSDU 7935 /* max amsdu size (bytes) per the EWC spec */ +#define EWC_MIN_AMSDU 3835 /* min amsdu size (bytes) per the EWC spec */ + +#define EWC_PARAMS_RX_FACTOR_MASK 0x03 /* ampdu rcv factor mask */ +#define EWC_PARAMS_DENSITY_MASK 0x1C /* ampdu density mask */ +#define EWC_PARAMS_DENSITY_SHIFT 2 /* ampdu density shift */ + +/* EWC/AMPDU specific define */ +#define AMPDU_MAX_MPDU_DENSITY 7 /* max mpdu density; in 1/8 usec units */ +#define AMPDU_MAX_RX_FACTOR 3 /* max rcv ampdu len (64kb) */ +#define AMPDU_RX_FACTOR_BASE 8*1024 /* ampdu factor base for rx len */ +#define AMPDU_DELIMITER_LEN 4 /* length of ampdu delimiter */ + +struct ewc_add { + uint8 ctl_ch; /* control channel number */ + uint8 byte1; /* ext ch,rec. ch. width, RIFS support */ + uint16 opmode; /* operation mode */ + uint16 misc_bits; /* misc bits */ + uint8 basic_mcs[MCSSET_LEN]; /* required MCS set */ +} PACKED; +typedef struct ewc_add ewc_add_t; + +/* ADD IE: EWC 1.0 spec. simply stole a 802.11 IE, we use our prop. IE until this is resolved */ +/* the additional IE is primarily used to convey the current BSS configuration */ +struct ewc_add_ie { + uint8 id; /* IE ID, 221, DOT11_MNG_PROPR_ID */ + uint8 len; /* IE length */ + uint8 oui[3]; /* Proprietary OUI, BRCM_PROP_OUI */ + uint8 type; /* indicates what follows */ + ewc_add_t add; +} PACKED; +typedef struct ewc_add_ie ewc_add_ie_t; + +#define EWC_ADD_IE_LEN (22+4) +#define EWC_ADD_IE_TYPE 52 + +/* byte1 defn's */ +#define EWC_EXT_CH_MASK 0x03 /* extension channel mask */ +#define EWC_EXT_CH_UPPER 0x01 /* ext. ch. on upper sb */ +#define EWC_EXT_CH_LOWER 0x03 /* ext. ch. on lower sb */ +#define EWC_EXT_CH_NONE 0x00 /* extension channel mask */ +#define EWC_BW_ANY 0x04 /* set, STA can use 20 or 40MHz */ +#define EWC_RIFS_PERMITTED 0x08 /* RIFS allowed */ + +/* opmode defn's */ +#define EWC_OPMODE_MASK 0x0003 /* protection mode mask */ +#define EWC_OPMODE_PURE 0x0000 /* protection mode PURE */ +#define EWC_OPMODE_HT20IN40 0x0002 /* protection mode 20MHz HT in 40MHz BSS */ +#define EWC_OPMODE_MIXED 0x0003 /* protection mode Mixed Mode */ +#define EWC_NONGF_PRESENT 0x0004 /* protection mode non-GF */ + +/* misc_bites defn's */ +#define EWC_BASIC_STBC_MCS 0x007f /* basic STBC MCS */ +#define EWC_DUAL_STBC_PROT 0x0080 /* Dual STBC Protection */ +#define EWC_SECOND_BCN 0x0100 /* Secondary beacon support */ +#define EWC_LSIG_TXOP 0x0200 /* L-SIG TXOP Protection full support */ +#define EWC_PCO_ACTIVE 0x0400 /* PCO active */ +#define EWC_PCO_PHASE 0x0800 /* PCO phase */ + +/* Macros for opmode */ +#define EWC_MIXEDMODE_PRESENT(add) ((ltoh16_ua(&add.opmode) & EWC_OPMODE_MASK) \ + == EWC_OPMODE_MIXED) /* mixed mode present */ +#define EWC_HT20_PRESENT(add) ((ltoh16_ua(&add.opmode) & EWC_OPMODE_MASK) \ + == EWC_OPMODE_HT20IN40) /* 20MHz HT present */ +#define EWC_USE_PROTECTION(add) (EWC_HT20_PRESENT((add)) || \ + EWC_MIXEDMODE_PRESENT((add))) /* use protection */ + +/* Vendor IE structure */ +struct vndr_ie { + uchar id; + uchar len; + uchar oui [3]; + uchar data [1]; /* Variable size data */ +}PACKED; +typedef struct vndr_ie vndr_ie_t; + +#define VNDR_IE_HDR_LEN 2 /* id + len field */ +#define VNDR_IE_MIN_LEN 3 /* size of the oui field */ +#define VNDR_IE_MAX_LEN 256 /* verdor IE max length */ + +/* WPA definitions */ +#define WPA_VERSION 1 /* WPA version */ +#define WPA_OUI "\x00\x50\xF2" /* WPA OUI */ + +#define WPA2_VERSION 1 /* WPA2 version */ +#define WPA2_VERSION_LEN 2 /* WAP2 version length */ +#define WPA2_OUI "\x00\x0F\xAC" /* WPA2 OUI */ + +#define WPA_OUI_LEN 3 /* WPA OUI length */ + +/* RSN authenticated key managment suite */ +#define RSN_AKM_NONE 0 /* None (IBSS) */ +#define RSN_AKM_UNSPECIFIED 1 /* Over 802.1x */ +#define RSN_AKM_PSK 2 /* Pre-shared Key */ + +/* Key related defines */ +#define DOT11_MAX_DEFAULT_KEYS 4 /* number of default keys */ +#define DOT11_MAX_KEY_SIZE 32 /* max size of any key */ +#define DOT11_MAX_IV_SIZE 16 /* max size of any IV */ +#define DOT11_EXT_IV_FLAG (1<<5) /* flag to indicate IV is > 4 bytes */ + +#define WEP1_KEY_SIZE 5 /* max size of any WEP key */ +#define WEP1_KEY_HEX_SIZE 10 /* size of WEP key in hex. */ +#define WEP128_KEY_SIZE 13 /* max size of any WEP key */ +#define WEP128_KEY_HEX_SIZE 26 /* size of WEP key in hex. */ +#define TKIP_MIC_SIZE 8 /* size of TKIP MIC */ +#define TKIP_EOM_SIZE 7 /* max size of TKIP EOM */ +#define TKIP_EOM_FLAG 0x5a /* TKIP EOM flag byte */ +#define TKIP_KEY_SIZE 32 /* size of any TKIP key */ +#define TKIP_MIC_AUTH_TX 16 /* offset to Authenticator MIC TX key */ +#define TKIP_MIC_AUTH_RX 24 /* offset to Authenticator MIC RX key */ +#define TKIP_MIC_SUP_RX TKIP_MIC_AUTH_TX /* offset to Supplicant MIC RX key */ +#define TKIP_MIC_SUP_TX TKIP_MIC_AUTH_RX /* offset to Supplicant MIC TX key */ +#define AES_KEY_SIZE 16 /* size of AES key */ + +#undef PACKED +#if !defined(__GNUC__) +#pragma pack() +#endif + +#endif /* _802_11_H_ */ diff --git a/package/broadcom-wl/src/wlc/include/proto/bcmeth.h b/package/broadcom-wl/src/wlc/include/proto/bcmeth.h new file mode 100644 index 0000000000..7b3295389a --- /dev/null +++ b/package/broadcom-wl/src/wlc/include/proto/bcmeth.h @@ -0,0 +1,101 @@ +/* + * Broadcom Ethernettype protocol definitions + * + * Copyright 2006, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * + * $Id: bcmeth.h,v 1.1.1.4 2006/02/27 03:43:16 honor Exp $ + */ + +/* + * Broadcom Ethernet protocol defines + */ + +#ifndef _BCMETH_H_ +#define _BCMETH_H_ + +/* enable structure packing */ +#if defined(__GNUC__) +#define PACKED __attribute__((packed)) +#else +#pragma pack(1) +#define PACKED +#endif + +/* ETHER_TYPE_BRCM is defined in ethernet.h */ + +/* + * Following the 2byte BRCM ether_type is a 16bit BRCM subtype field + * in one of two formats: (only subtypes 32768-65535 are in use now) + * + * subtypes 0-32767: + * 8 bit subtype (0-127) + * 8 bit length in bytes (0-255) + * + * subtypes 32768-65535: + * 16 bit big-endian subtype + * 16 bit big-endian length in bytes (0-65535) + * + * length is the number of additional bytes beyond the 4 or 6 byte header + * + * Reserved values: + * 0 reserved + * 5-15 reserved for iLine protocol assignments + * 17-126 reserved, assignable + * 127 reserved + * 32768 reserved + * 32769-65534 reserved, assignable + * 65535 reserved + */ + +/* + * While adding the subtypes and their specific processing code make sure + * bcmeth_bcm_hdr_t is the first data structure in the user specific data structure definition + */ + +#define BCMILCP_SUBTYPE_RATE 1 +#define BCMILCP_SUBTYPE_LINK 2 +#define BCMILCP_SUBTYPE_CSA 3 +#define BCMILCP_SUBTYPE_LARQ 4 +#define BCMILCP_SUBTYPE_VENDOR 5 +#define BCMILCP_SUBTYPE_FLH 17 + +#define BCMILCP_SUBTYPE_VENDOR_LONG 32769 +#define BCMILCP_SUBTYPE_CERT 32770 +#define BCMILCP_SUBTYPE_SES 32771 + + +#define BCMILCP_BCM_SUBTYPE_RESERVED 0 +#define BCMILCP_BCM_SUBTYPE_EVENT 1 +#define BCMILCP_BCM_SUBTYPE_SES 2 +/* + * The EAPOL type is not used anymore. Instead EAPOL messages are now embedded + * within BCMILCP_BCM_SUBTYPE_EVENT type messages + */ +/* #define BCMILCP_BCM_SUBTYPE_EAPOL 3 */ + +#define BCMILCP_BCM_SUBTYPEHDR_MINLENGTH 8 +#define BCMILCP_BCM_SUBTYPEHDR_VERSION 0 + +/* These fields are stored in network order */ +typedef struct bcmeth_hdr +{ + uint16 subtype; /* Vendor specific..32769 */ + uint16 length; + uint8 version; /* Version is 0 */ + uint8 oui[3]; /* Broadcom OUI */ + /* user specific Data */ + uint16 usr_subtype; +} PACKED bcmeth_hdr_t; + +#undef PACKED +#if !defined(__GNUC__) +#pragma pack() +#endif + +#endif /* _BCMETH_H_ */ diff --git a/package/broadcom-wl/src/wlc/include/proto/bcmevent.h b/package/broadcom-wl/src/wlc/include/proto/bcmevent.h new file mode 100644 index 0000000000..d922a5d215 --- /dev/null +++ b/package/broadcom-wl/src/wlc/include/proto/bcmevent.h @@ -0,0 +1,152 @@ +/* + * Broadcom Event protocol definitions + * + * Copyright 2006, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * + * + * Dependencies: proto/bcmeth.h + * + * $Id: bcmevent.h,v 1.1.1.3 2006/02/27 03:43:16 honor Exp $ + * + */ + +/* + * Broadcom Ethernet Events protocol defines + * + */ + +#ifndef _BCMEVENT_H_ +#define _BCMEVENT_H_ + +/* enable structure packing */ +#if defined(__GNUC__) +#define PACKED __attribute__((packed)) +#else +#pragma pack(1) +#define PACKED +#endif /* defined(__GNUC__) */ + +#define BCM_EVENT_MSG_VERSION 1 /* wl_event_msg_t struct version */ +#define BCM_MSG_IFNAME_MAX 16 /* max length of interface name */ + +/* flags */ +#define WLC_EVENT_MSG_LINK 0x01 /* link is up */ +#define WLC_EVENT_MSG_FLUSHTXQ 0x02 /* flush tx queue on MIC error */ +#define WLC_EVENT_MSG_GROUP 0x04 /* group MIC error */ + +/* theses fields are stored in network order */ +typedef struct +{ + uint16 version; + uint16 flags; /* see flags below */ + uint32 event_type; /* Message (see below) */ + uint32 status; /* Status code (see below) */ + uint32 reason; /* Reason code (if applicable) */ + uint32 auth_type; /* WLC_E_AUTH */ + uint32 datalen; /* data buf */ + struct ether_addr addr; /* Station address (if applicable) */ + char ifname[BCM_MSG_IFNAME_MAX]; /* name of the packet incoming interface */ +} PACKED wl_event_msg_t; + +/* used by driver msgs */ +typedef struct bcm_event { + struct ether_header eth; + bcmeth_hdr_t bcm_hdr; + wl_event_msg_t event; + /* data portion follows */ +} PACKED bcm_event_t; + +#define BCM_MSG_LEN (sizeof(bcm_event_t) - sizeof(bcmeth_hdr_t) - sizeof(struct ether_header)) + +/* Event messages */ +#define WLC_E_SET_SSID 0 /* indicates status of set SSID */ +#define WLC_E_JOIN 1 /* differentiates join IBSS from found (WLC_E_START) IBSS */ +#define WLC_E_START 2 /* STA founded an IBSS or AP started a BSS */ +#define WLC_E_AUTH 3 /* 802.11 AUTH request */ +#define WLC_E_AUTH_IND 4 /* 802.11 AUTH indication */ +#define WLC_E_DEAUTH 5 /* 802.11 DEAUTH request */ +#define WLC_E_DEAUTH_IND 6 /* 802.11 DEAUTH indication */ +#define WLC_E_ASSOC 7 /* 802.11 ASSOC request */ +#define WLC_E_ASSOC_IND 8 /* 802.11 ASSOC indication */ +#define WLC_E_REASSOC 9 /* 802.11 REASSOC request */ +#define WLC_E_REASSOC_IND 10 /* 802.11 REASSOC indication */ +#define WLC_E_DISASSOC 11 /* 802.11 DISASSOC request */ +#define WLC_E_DISASSOC_IND 12 /* 802.11 DISASSOC indication */ +#define WLC_E_QUIET_START 13 /* 802.11h Quiet period started */ +#define WLC_E_QUIET_END 14 /* 802.11h Quiet period ended */ +#define WLC_E_BEACON_RX 15 /* BEACONS received/lost indication */ +#define WLC_E_LINK 16 /* generic link indication */ +#define WLC_E_MIC_ERROR 17 /* TKIP MIC error occurred */ +#define WLC_E_NDIS_LINK 18 /* NDIS style link indication */ +#define WLC_E_ROAM 19 /* roam attempt occurred: indicate status & reason */ +#define WLC_E_TXFAIL 20 /* change in dot11FailedCount (txfail) */ +#define WLC_E_PMKID_CACHE 21 /* WPA2 pmkid cache indication */ +#define WLC_E_RETROGRADE_TSF 22 /* current AP's TSF value went backward */ +#define WLC_E_PRUNE 23 /* AP was pruned from join list for reason */ +#define WLC_E_AUTOAUTH 24 /* report AutoAuth table entry match for join attempt */ +#define WLC_E_EAPOL_MSG 25 /* Event encapsulating an EAPOL message */ +#define WLC_E_SCAN_COMPLETE 26 /* Scan results are ready or scan was aborted */ +#define WLC_E_ADDTS_IND 27 /* indicate to host addts fail/success */ +#define WLC_E_DELTS_IND 28 /* indicate to host delts fail/success */ +#define WLC_E_BCNSENT_IND 29 /* indicate to host of beacon transmit */ +#define WLC_E_BCNRX_MSG 30 /* Send the received beacon up to the host */ +#define WLC_E_LAST 31 /* highest val + 1 for range checking */ + +/* Event status codes */ +#define WLC_E_STATUS_SUCCESS 0 /* operation was successful */ +#define WLC_E_STATUS_FAIL 1 /* operation failed */ +#define WLC_E_STATUS_TIMEOUT 2 /* operation timed out */ +#define WLC_E_STATUS_NO_NETWORKS 3 /* failed due to no matching network found */ +#define WLC_E_STATUS_ABORT 4 /* operation was aborted */ +#define WLC_E_STATUS_NO_ACK 5 /* protocol failure: packet not ack'd */ +#define WLC_E_STATUS_UNSOLICITED 6 /* AUTH or ASSOC packet was unsolicited */ +#define WLC_E_STATUS_ATTEMPT 7 /* attempt to assoc to an auto auth configuration */ + +/* roam reason codes */ +#define WLC_E_REASON_INITIAL_ASSOC 0 /* initial assoc */ +#define WLC_E_REASON_LOW_RSSI 1 /* roamed due to low RSSI */ +#define WLC_E_REASON_DEAUTH 2 /* roamed due to DEAUTH indication */ +#define WLC_E_REASON_DISASSOC 3 /* roamed due to DISASSOC indication */ +#define WLC_E_REASON_BCNS_LOST 4 /* roamed due to lost beacons */ +#define WLC_E_REASON_FAST_ROAM_FAILED 5 /* roamed due to fast roam failure */ +#define WLC_E_REASON_DIRECTED_ROAM 6 /* roamed due to request by AP */ +#define WLC_E_REASON_TSPEC_REJECTED 7 /* roamed due to TSPEC rejection */ +#define WLC_E_REASON_BETTER_AP 8 /* roamed due to finding better AP */ + +/* prune reason codes */ +#define WLC_E_PRUNE_ENCR_MISMATCH 1 /* ecryption mismatch */ +#define WLC_E_PRUNE_BCAST_BSSID 2 /* AP uses a broadcast BSSID */ +#define WLC_E_PRUNE_MAC_DENY 3 /* STA's MAC addr is in AP's MAC deny list */ +#define WLC_E_PRUNE_MAC_NA 4 /* STA's MAC addr is not in AP's MAC allow list */ +#define WLC_E_PRUNE_REG_PASSV 5 /* AP not allowed due to regulatory restriction */ +#define WLC_E_PRUNE_SPCT_MGMT 6 /* AP does not support STA locale spectrum mgmt */ +#define WLC_E_PRUNE_RADAR 7 /* AP is on a radar channel of STA locale */ +#define WLC_E_RSN_MISMATCH 8 /* STA does not support AP's RSN */ +#define WLC_E_PRUNE_NO_COMMON_RATES 9 /* No rates in common with AP */ +#define WLC_E_PRUNE_BASIC_RATES 10 /* STA does not support all basic rates of BSS */ +#define WLC_E_PRUNE_CCXFAST_PREVAP 11 /* CCX FAST ROAM: prune previous AP */ +#define WLC_E_PRUNE_CIPHER_NA 12 /* BSS's cipher not supported */ +#define WLC_E_PRUNE_KNOWN_STA 13 /* AP is already known to us as a STA */ +#define WLC_E_PRUNE_CCXFAST_DROAM 14 /* CCX FAST ROAM: prune unqulified AP */ +#define WLC_E_PRUNE_WDS_PEER 15 /* AP is already known to us as a WDS peer */ +#define WLC_E_PRUNE_QBSS_LOAD 16 /* QBSS LOAD - AAC is too low */ +#define WLC_E_PRUNE_HOME_AP 17 /* prune home AP */ + +/* WLC_SET_CALLBACK data type */ +typedef struct wlc_event_cb { + void (*fn)(void *, bcm_event_t *); /* Callback function */ + void *context; /* Passed to callback function */ +} wlc_event_cb_t; + +#undef PACKED +#if !defined(__GNUC__) +#pragma pack() +#endif /* PACKED */ + +#endif /* _BCMEVENT_H_ */ diff --git a/package/broadcom-wl/src/wlc/include/proto/ethernet.h b/package/broadcom-wl/src/wlc/include/proto/ethernet.h new file mode 100644 index 0000000000..03fd4f654c --- /dev/null +++ b/package/broadcom-wl/src/wlc/include/proto/ethernet.h @@ -0,0 +1,165 @@ +/* + * From FreeBSD 2.2.7: Fundamental constants relating to ethernet. + * + * Copyright 2006, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * + * $Id: ethernet.h,v 1.1.1.14 2006/02/27 03:43:16 honor Exp $ + */ + +#ifndef _NET_ETHERNET_H_ /* use native BSD ethernet.h when available */ +#define _NET_ETHERNET_H_ + +#ifndef _TYPEDEFS_H_ +#include "typedefs.h" +#endif + +/* enable structure packing */ +#if defined(__GNUC__) +#define PACKED __attribute__((packed)) +#else +#pragma pack(1) +#define PACKED +#endif + +/* + * The number of bytes in an ethernet (MAC) address. + */ +#define ETHER_ADDR_LEN 6 + +/* + * The number of bytes in the type field. + */ +#define ETHER_TYPE_LEN 2 + +/* + * The number of bytes in the trailing CRC field. + */ +#define ETHER_CRC_LEN 4 + +/* + * The length of the combined header. + */ +#define ETHER_HDR_LEN (ETHER_ADDR_LEN*2+ETHER_TYPE_LEN) + +/* + * The minimum packet length. + */ +#define ETHER_MIN_LEN 64 + +/* + * The minimum packet user data length. + */ +#define ETHER_MIN_DATA 46 + +/* + * The maximum packet length. + */ +#define ETHER_MAX_LEN 1518 + +/* + * The maximum packet user data length. + */ +#define ETHER_MAX_DATA 1500 + +/* ether types */ +#define ETHER_TYPE_IP 0x0800 /* IP */ +#define ETHER_TYPE_ARP 0x0806 /* ARP */ +#define ETHER_TYPE_8021Q 0x8100 /* 802.1Q */ +#define ETHER_TYPE_BRCM 0x886c /* Broadcom Corp. */ +#define ETHER_TYPE_802_1X 0x888e /* 802.1x */ +#ifdef BCMWPA2 +#define ETHER_TYPE_802_1X_PREAUTH 0x88c7 /* 802.1x preauthentication */ +#endif + +/* Broadcom subtype follows ethertype; First 2 bytes are reserved; Next 2 are subtype; */ +#define ETHER_BRCM_SUBTYPE_LEN 4 /* Broadcom 4 byte subtype */ +#define ETHER_BRCM_CRAM 0x1 /* Broadcom subtype cram protocol */ + +/* ether header */ +#define ETHER_DEST_OFFSET 0 /* dest address offset */ +#define ETHER_SRC_OFFSET 6 /* src address offset */ +#define ETHER_TYPE_OFFSET 12 /* ether type offset */ + +/* + * A macro to validate a length with + */ +#define ETHER_IS_VALID_LEN(foo) \ + ((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN) + + +#ifndef __INCif_etherh /* Quick and ugly hack for VxWorks */ +/* + * Structure of a 10Mb/s Ethernet header. + */ +struct ether_header { + uint8 ether_dhost[ETHER_ADDR_LEN]; + uint8 ether_shost[ETHER_ADDR_LEN]; + uint16 ether_type; +} PACKED; + +/* + * Structure of a 48-bit Ethernet address. + */ +struct ether_addr { + uint8 octet[ETHER_ADDR_LEN]; +} PACKED; +#endif /* !__INCif_etherh Quick and ugly hack for VxWorks */ + +/* + * Takes a pointer, sets locally admininistered + * address bit in the 48-bit Ethernet address. + */ +#define ETHER_SET_LOCALADDR(ea) (((uint8 *)(ea))[0] = (((uint8 *)(ea))[0] | 2)) + +/* + * Takes a pointer, returns true if a 48-bit multicast address + * (including broadcast, since it is all ones) + */ +#define ETHER_ISMULTI(ea) (((uint8 *)(ea))[0] & 1) + + +/* compare two ethernet addresses - assumes the pointers can be referenced as shorts */ +#define ether_cmp(a, b) (!(((short*)a)[0] == ((short*)b)[0]) | \ + !(((short*)a)[1] == ((short*)b)[1]) | \ + !(((short*)a)[2] == ((short*)b)[2])) + +/* copy an ethernet address - assumes the pointers can be referenced as shorts */ +#define ether_copy(s, d) { \ + ((short*)d)[0] = ((short*)s)[0]; \ + ((short*)d)[1] = ((short*)s)[1]; \ + ((short*)d)[2] = ((short*)s)[2]; } + +/* + * Takes a pointer, returns true if a 48-bit broadcast (all ones) + */ +#define ETHER_ISBCAST(ea) ((((uint8 *)(ea))[0] & \ + ((uint8 *)(ea))[1] & \ + ((uint8 *)(ea))[2] & \ + ((uint8 *)(ea))[3] & \ + ((uint8 *)(ea))[4] & \ + ((uint8 *)(ea))[5]) == 0xff) + +static const struct ether_addr ether_bcast = {{255, 255, 255, 255, 255, 255}}; + +/* + * Takes a pointer, returns true if a 48-bit null address (all zeros) + */ +#define ETHER_ISNULLADDR(ea) ((((uint8 *)(ea))[0] | \ + ((uint8 *)(ea))[1] | \ + ((uint8 *)(ea))[2] | \ + ((uint8 *)(ea))[3] | \ + ((uint8 *)(ea))[4] | \ + ((uint8 *)(ea))[5]) == 0) + +#undef PACKED +#if !defined(__GNUC__) +#pragma pack() +#endif + +#endif /* _NET_ETHERNET_H_ */ diff --git a/package/broadcom-wl/src/wlc/include/proto/wpa.h b/package/broadcom-wl/src/wlc/include/proto/wpa.h new file mode 100644 index 0000000000..dd35dbef02 --- /dev/null +++ b/package/broadcom-wl/src/wlc/include/proto/wpa.h @@ -0,0 +1,148 @@ +/* + * Fundamental types and constants relating to WPA + * + * Copyright 2006, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * + * $Id: wpa.h,v 1.1.1.4 2006/02/27 03:43:16 honor Exp $ + */ + +#ifndef _proto_wpa_h_ +#define _proto_wpa_h_ + +#include <typedefs.h> +#include <proto/ethernet.h> + +/* enable structure packing */ +#if defined(__GNUC__) +#define PACKED __attribute__((packed)) +#else +#pragma pack(1) +#define PACKED +#endif + +/* Reason Codes */ + +/* 10 and 11 are from TGh. */ +#define DOT11_RC_BAD_PC 10 /* Unacceptable power capability element */ +#define DOT11_RC_BAD_CHANNELS 11 /* Unacceptable supported channels element */ +/* 12 is unused */ +/* 13 through 23 taken from P802.11i/D3.0, November 2002 */ +#define DOT11_RC_INVALID_WPA_IE 13 /* Invalid info. element */ +#define DOT11_RC_MIC_FAILURE 14 /* Michael failure */ +#define DOT11_RC_4WH_TIMEOUT 15 /* 4-way handshake timeout */ +#define DOT11_RC_GTK_UPDATE_TIMEOUT 16 /* Group key update timeout */ +#define DOT11_RC_WPA_IE_MISMATCH 17 /* WPA IE in 4-way handshake differs from + * (re-)assoc. request/probe response + */ +#define DOT11_RC_INVALID_MC_CIPHER 18 /* Invalid multicast cipher */ +#define DOT11_RC_INVALID_UC_CIPHER 19 /* Invalid unicast cipher */ +#define DOT11_RC_INVALID_AKMP 20 /* Invalid authenticated key management protocol */ +#define DOT11_RC_BAD_WPA_VERSION 21 /* Unsupported WPA version */ +#define DOT11_RC_INVALID_WPA_CAP 22 /* Invalid WPA IE capabilities */ +#define DOT11_RC_8021X_AUTH_FAIL 23 /* 802.1X authentication failure */ + +#define WPA2_PMKID_LEN 16 + +/* WPA IE fixed portion */ +typedef struct +{ + uint8 tag; /* TAG */ + uint8 length; /* TAG length */ + uint8 oui[3]; /* IE OUI */ + uint8 oui_type; /* OUI type */ + struct { + uint8 low; + uint8 high; + } PACKED version; /* IE version */ +} PACKED wpa_ie_fixed_t; +#define WPA_IE_OUITYPE_LEN 4 +#define WPA_IE_FIXED_LEN 8 +#define WPA_IE_TAG_FIXED_LEN 6 + +#ifdef BCMWPA2 +typedef struct { + uint8 tag; /* TAG */ + uint8 length; /* TAG length */ + struct { + uint8 low; + uint8 high; + } PACKED version; /* IE version */ +} PACKED wpa_rsn_ie_fixed_t; +#define WPA_RSN_IE_FIXED_LEN 4 +#define WPA_RSN_IE_TAG_FIXED_LEN 2 +typedef uint8 wpa_pmkid_t[WPA2_PMKID_LEN]; +#endif + +/* WPA suite/multicast suite */ +typedef struct +{ + uint8 oui[3]; + uint8 type; +} PACKED wpa_suite_t, wpa_suite_mcast_t; +#define WPA_SUITE_LEN 4 + +/* WPA unicast suite list/key management suite list */ +typedef struct +{ + struct { + uint8 low; + uint8 high; + } PACKED count; + wpa_suite_t list[1]; +} PACKED wpa_suite_ucast_t, wpa_suite_auth_key_mgmt_t; +#define WPA_IE_SUITE_COUNT_LEN 2 +#ifdef BCMWPA2 +typedef struct +{ + struct { + uint8 low; + uint8 high; + } PACKED count; + wpa_pmkid_t list[1]; +} PACKED wpa_pmkid_list_t; +#endif + +/* WPA cipher suites */ +#define WPA_CIPHER_NONE 0 /* None */ +#define WPA_CIPHER_WEP_40 1 /* WEP (40-bit) */ +#define WPA_CIPHER_TKIP 2 /* TKIP: default for WPA */ +#define WPA_CIPHER_AES_OCB 3 /* AES (OCB) */ +#define WPA_CIPHER_AES_CCM 4 /* AES (CCM) */ +#define WPA_CIPHER_WEP_104 5 /* WEP (104-bit) */ + +#define IS_WPA_CIPHER(cipher) ((cipher) == WPA_CIPHER_NONE || \ + (cipher) == WPA_CIPHER_WEP_40 || \ + (cipher) == WPA_CIPHER_WEP_104 || \ + (cipher) == WPA_CIPHER_TKIP || \ + (cipher) == WPA_CIPHER_AES_OCB || \ + (cipher) == WPA_CIPHER_AES_CCM) + +/* WPA TKIP countermeasures parameters */ +#define WPA_TKIP_CM_DETECT 60 /* multiple MIC failure window (seconds) */ +#define WPA_TKIP_CM_BLOCK 60 /* countermeasures active window (seconds) */ + +/* WPA capabilities defined in 802.11i */ +#define WPA_CAP_4_REPLAY_CNTRS 2 +#define WPA_CAP_16_REPLAY_CNTRS 3 +#define WPA_CAP_REPLAY_CNTR_SHIFT 2 +#define WPA_CAP_REPLAY_CNTR_MASK 0x000c + +/* WPA Specific defines */ +#define WPA_CAP_LEN 2 /* Length of RSN capabilities in RSN IE (2 octets) */ + +#ifdef BCMWPA2 +#define WPA_CAP_WPA2_PREAUTH 1 +#endif /* BCMWPA2 */ + +#undef PACKED +#if !defined(__GNUC__) +#pragma pack() +#endif + +#endif /* _proto_wpa_h_ */ diff --git a/package/broadcom-wl/src/wlc/include/typedefs.h b/package/broadcom-wl/src/wlc/include/typedefs.h new file mode 100644 index 0000000000..6c498bbcb2 --- /dev/null +++ b/package/broadcom-wl/src/wlc/include/typedefs.h @@ -0,0 +1,230 @@ +/* + * Copyright 2006, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * $Id: typedefs.h,v 1.1.1.12 2006/04/08 06:13:40 honor Exp $ + */ + +#ifndef _TYPEDEFS_H_ +#define _TYPEDEFS_H_ + +/* + * Inferred Typedefs + * + */ + +/* Infer the compile environment based on preprocessor symbols and pramas. + * Override type definitions as needed, and include configuration dependent + * header files to define types. + */ + +#ifdef __cplusplus + +#define TYPEDEF_BOOL +#ifndef FALSE +#define FALSE false +#endif +#ifndef TRUE +#define TRUE true +#endif + +#endif /* __cplusplus */ + +#if defined(_NEED_SIZE_T_) +typedef long unsigned int size_t; +#endif + +#define TYPEDEF_UINT +#define TYPEDEF_USHORT +#define TYPEDEF_ULONG + + +/* Do not support the (u)int64 types with strict ansi for GNU C */ +#if defined(__GNUC__) && defined(__STRICT_ANSI__) +#define TYPEDEF_INT64 +#define TYPEDEF_UINT64 +#endif + +/* pick up ushort & uint from standard types.h */ +#if defined(linux) && defined(__KERNEL__) +#include <linux/types.h> /* sys/types.h and linux/types.h are oil and water */ +#else +#include <sys/types.h> +#endif + +/* use the default typedefs in the next section of this file */ +#define USE_TYPEDEF_DEFAULTS + +/* + * Default Typedefs + * + */ + +#ifdef USE_TYPEDEF_DEFAULTS +#undef USE_TYPEDEF_DEFAULTS + +#ifndef TYPEDEF_BOOL +typedef /* @abstract@ */ unsigned char bool; +#endif + +/* define uchar, ushort, uint, ulong */ + +#ifndef TYPEDEF_UCHAR +typedef unsigned char uchar; +#endif + +#ifndef TYPEDEF_USHORT +typedef unsigned short ushort; +#endif + +#ifndef TYPEDEF_UINT +typedef unsigned int uint; +#endif + +#ifndef TYPEDEF_ULONG +typedef unsigned long ulong; +#endif + +/* define [u]int8/16/32/64, uintptr */ + +#ifndef TYPEDEF_UINT8 +typedef unsigned char uint8; +#endif + +#ifndef TYPEDEF_UINT16 +typedef unsigned short uint16; +#endif + +#ifndef TYPEDEF_UINT32 +typedef unsigned int uint32; +#endif + +#ifndef TYPEDEF_UINT64 +typedef unsigned long long uint64; +#endif + +#ifndef TYPEDEF_UINTPTR +typedef unsigned int uintptr; +#endif + +#ifndef TYPEDEF_INT8 +typedef signed char int8; +#endif + +#ifndef TYPEDEF_INT16 +typedef signed short int16; +#endif + +#ifndef TYPEDEF_INT32 +typedef signed int int32; +#endif + +#ifndef TYPEDEF_INT64 +typedef signed long long int64; +#endif + +/* define float32/64, float_t */ + +#ifndef TYPEDEF_FLOAT32 +typedef float float32; +#endif + +#ifndef TYPEDEF_FLOAT64 +typedef double float64; +#endif + +/* + * abstracted floating point type allows for compile time selection of + * single or double precision arithmetic. Compiling with -DFLOAT32 + * selects single precision; the default is double precision. + */ + +#ifndef TYPEDEF_FLOAT_T + +#if defined(FLOAT32) +typedef float32 float_t; +#else /* default to double precision floating point */ +typedef float64 float_t; +#endif + +#endif /* TYPEDEF_FLOAT_T */ + +/* define macro values */ + +#ifndef FALSE +#define FALSE 0 +#endif + +#ifndef TRUE +#define TRUE 1 /* TRUE */ +#endif + +#ifndef NULL +#define NULL 0 +#endif + +#ifndef OFF +#define OFF 0 +#endif + +#ifndef ON +#define ON 1 /* ON = 1 */ +#endif + +#define AUTO (-1) /* Auto = -1 */ + +/* define PTRSZ, INLINE */ + +#ifndef PTRSZ +#define PTRSZ sizeof(char*) +#endif + +#ifndef INLINE + +#ifdef _MSC_VER + +#define INLINE __inline + +#elif __GNUC__ + +#define INLINE __inline__ + +#else + +#define INLINE + +#endif /* _MSC_VER */ + +#endif /* INLINE */ + +#undef TYPEDEF_BOOL +#undef TYPEDEF_UCHAR +#undef TYPEDEF_USHORT +#undef TYPEDEF_UINT +#undef TYPEDEF_ULONG +#undef TYPEDEF_UINT8 +#undef TYPEDEF_UINT16 +#undef TYPEDEF_UINT32 +#undef TYPEDEF_UINT64 +#undef TYPEDEF_UINTPTR +#undef TYPEDEF_INT8 +#undef TYPEDEF_INT16 +#undef TYPEDEF_INT32 +#undef TYPEDEF_INT64 +#undef TYPEDEF_FLOAT32 +#undef TYPEDEF_FLOAT64 +#undef TYPEDEF_FLOAT_T + +#endif /* USE_TYPEDEF_DEFAULTS */ + +/* + * Including the bcmdefs.h here, to make sure everyone including typedefs.h + * gets this automatically +*/ +#include <bcmdefs.h> + +#endif /* _TYPEDEFS_H_ */ diff --git a/package/broadcom-wl/src/wlc/include/wlioctl.h b/package/broadcom-wl/src/wlc/include/wlioctl.h new file mode 100644 index 0000000000..0558415d33 --- /dev/null +++ b/package/broadcom-wl/src/wlc/include/wlioctl.h @@ -0,0 +1,1384 @@ +/* + * Custom OID/ioctl definitions for + * Broadcom 802.11abg Networking Device Driver + * + * Definitions subject to change without notice. + * + * Copyright 2006, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * + * $Id: wlioctl.h,v 1.1.1.22 2006/04/15 01:29:08 michael Exp $ + */ + +#ifndef _wlioctl_h_ +#define _wlioctl_h_ + +#include <typedefs.h> +#include <proto/ethernet.h> +#include <proto/bcmeth.h> +#include <proto/bcmevent.h> +#include <proto/802.11.h> + +#ifdef __NetBSD__ +/* NetBSD 2.0 does not have SIOCDEVPRIVATE. This is NetBSD 2.0 specific */ +#define SIOCDEVPRIVATE _IOWR('i', 139, struct ifreq) +#endif + +/* require default structure packing */ +#if !defined(__GNUC__) +#pragma pack(push, 8) +#endif + +/* A chanspec holds the channel number, band, bandwidth and control sideband */ +typedef uint16 chanspec_t; +#define WL_CHANSPEC_CHAN_MASK 0x00ff + +#define WL_CHANSPEC_CTL_SB_MASK 0x0300 +#define WL_CHANSPEC_CTL_SB_SHIFT 8 +#define WL_CHANSPEC_CTL_SB_LOWER 0x0100 +#define WL_CHANSPEC_CTL_SB_UPPER 0x0200 +#define WL_CHANSPEC_CTL_SB_NONE 0x0300 + +#define WL_CHANSPEC_BW_MASK 0x0C00 +#define WL_CHANSPEC_BW_SHIFT 10 +#define WL_CHANSPEC_BW_10 0x0400 +#define WL_CHANSPEC_BW_20 0x0800 +#define WL_CHANSPEC_BW_40 0x0C00 + +#define WL_CHANSPEC_BAND_MASK 0xf000 +#define WL_CHANSPEC_BAND_SHIFT 12 +#define WL_CHANSPEC_BAND_5G 0x1000 +#define WL_CHANSPEC_BAND_2G 0x2000 +#define INVCHANSPEC 255 + +/* Legacy structure to help keep backward compatible wl tool and tray app */ + +#define LEGACY_WL_BSS_INFO_VERSION 107 /* older version of wl_bss_info struct */ + +typedef struct wl_bss_info_107 { + uint32 version; /* version field */ + uint32 length; /* byte length of data in this record, + * starting at version and including IEs + */ + struct ether_addr BSSID; + uint16 beacon_period; /* units are Kusec */ + uint16 capability; /* Capability information */ + uint8 SSID_len; + uint8 SSID[32]; + struct { + uint count; /* # rates in this set */ + uint8 rates[16]; /* rates in 500kbps units w/hi bit set if basic */ + } rateset; /* supported rates */ + uint8 channel; /* Channel no. */ + uint16 atim_window; /* units are Kusec */ + uint8 dtim_period; /* DTIM period */ + int16 RSSI; /* receive signal strength (in dBm) */ + int8 phy_noise; /* noise (in dBm) */ + uint32 ie_length; /* byte length of Information Elements */ + /* variable length Information Elements */ +} wl_bss_info_107_t; + +/* + * Per-bss information structure. + */ + +#define WL_BSS_INFO_VERSION 108 /* current version of wl_bss_info struct */ + +/* BSS info structure + * Applications MUST CHECK ie_offset field and length field to access IEs and + * next bss_info structure in a vector (in wl_scan_results_t) + */ +typedef struct wl_bss_info { + uint32 version; /* version field */ + uint32 length; /* byte length of data in this record, + * starting at version and including IEs + */ + struct ether_addr BSSID; + uint16 beacon_period; /* units are Kusec */ + uint16 capability; /* Capability information */ + uint8 SSID_len; + uint8 SSID[32]; + struct { + uint count; /* # rates in this set */ + uint8 rates[16]; /* rates in 500kbps units w/hi bit set if basic */ + } rateset; /* supported rates */ + chanspec_t chanspec; /* chanspec for bss */ + uint16 atim_window; /* units are Kusec */ + uint8 dtim_period; /* DTIM period */ + int16 RSSI; /* receive signal strength (in dBm) */ + int8 phy_noise; /* noise (in dBm) */ + + bool n_cap; /* BSS is 802.11N Capable */ + uint32 nbss_cap; /* 802.11N BSS Capabilities (based on EWC_CAP_*) */ + uint8 ctl_ch; /* 802.11N BSS control channel number */ + uint32 reserved[2]; /* Reserved for expansion of BSS properties */ + uint8 basic_mcs[MCSSET_LEN]; /* 802.11N BSS required MCS set */ + + uint16 ie_offset; /* offset at which IEs start, from beginning */ + uint32 ie_length; /* byte length of Information Elements */ + /* Add new fields here */ + /* variable length Information Elements */ +} wl_bss_info_t; + +typedef struct wlc_ssid { + uint32 SSID_len; + uchar SSID[32]; +} wlc_ssid_t; + +typedef struct wl_scan_params { + wlc_ssid_t ssid; /* default: {0, ""} */ + struct ether_addr bssid; /* default: bcast */ + int8 bss_type; /* default: any, + * DOT11_BSSTYPE_ANY/INFRASTRUCTURE/INDEPENDENT + */ + int8 scan_type; /* -1 use default, DOT11_SCANTYPE_ACTIVE/PASSIVE */ + int32 nprobes; /* -1 use default, number of probes per channel */ + int32 active_time; /* -1 use default, dwell time per channel for + * active scanning + */ + int32 passive_time; /* -1 use default, dwell time per channel + * for passive scanning + */ + int32 home_time; /* -1 use default, dwell time for the home channel + * between channel scans + */ + int32 channel_num; /* 0 use default (all available channels), count of + * channels in channel_list + */ + uint16 channel_list[1]; /* list of chanspecs */ +} wl_scan_params_t; +/* size of wl_scan_params not including variable length array */ +#define WL_SCAN_PARAMS_FIXED_SIZE 64 + +typedef struct wl_scan_results { + uint32 buflen; + uint32 version; + uint32 count; + wl_bss_info_t bss_info[1]; +} wl_scan_results_t; +/* size of wl_scan_results not including variable length array */ +#define WL_SCAN_RESULTS_FIXED_SIZE 12 + + +#define WL_NUMRATES 255 /* max # of rates in a rateset */ +typedef struct wl_rateset { + uint32 count; /* # rates in this set */ + uint8 rates[WL_NUMRATES]; /* rates in 500kbps units w/hi bit set if basic */ +} wl_rateset_t; + +/* uint32 list */ +typedef struct wl_uint32_list { + /* in - # of elements, out - # of entries */ + uint32 count; + /* variable length uint32 list */ + uint32 element[1]; +} wl_uint32_list_t; + +#define WLC_CNTRY_BUF_SZ 4 /* Country string is 3 bytes + NULL */ + +/* defines used by the nrate iovar */ +#define NRATE_MCS_INUSE 0x00000080 /* MSC in use,indicates b0-6 holds an mcs */ +#define NRATE_RATE_MASK 0x0000007f /* rate/mcs value */ +#define NRATE_STF_MASK 0x0000ff00 /* stf mode mask: siso, cdd, stbc, sdm */ +#define NRATE_STF_SHIFT 8 /* stf mode shift */ + +#define ANTENNA_NUM_1 1 /* total number of antennas to be used */ +#define ANTENNA_NUM_2 2 +#define ANTENNA_NUM_3 3 +#define ANTENNA_NUM_4 4 + +typedef struct wl_channels_in_country { + uint32 buflen; + uint32 band; + char country_abbrev[WLC_CNTRY_BUF_SZ]; + uint32 count; + uint32 channel[1]; +} wl_channels_in_country_t; + +typedef struct wl_country_list { + uint32 buflen; + uint32 band_set; + uint32 band; + uint32 count; + char country_abbrev[1]; +} wl_country_list_t; + +#define WL_RM_TYPE_BASIC 1 +#define WL_RM_TYPE_CCA 2 +#define WL_RM_TYPE_RPI 3 + +#define WL_RM_FLAG_PARALLEL (1<<0) + +#define WL_RM_FLAG_LATE (1<<1) +#define WL_RM_FLAG_INCAPABLE (1<<2) +#define WL_RM_FLAG_REFUSED (1<<3) + +typedef struct wl_rm_req_elt { + int8 type; + int8 flags; + chanspec_t chanspec; + uint32 token; /* token for this measurement */ + uint32 tsf_h; /* TSF high 32-bits of Measurement start time */ + uint32 tsf_l; /* TSF low 32-bits */ + uint32 dur; /* TUs */ +} wl_rm_req_elt_t; + +typedef struct wl_rm_req { + uint32 token; /* overall measurement set token */ + uint32 count; /* number of measurement requests */ + wl_rm_req_elt_t req[1]; /* variable length block of requests */ +} wl_rm_req_t; +#define WL_RM_REQ_FIXED_LEN 8 + +typedef struct wl_rm_rep_elt { + int8 type; + int8 flags; + chanspec_t chanspec; + uint32 token; /* token for this measurement */ + uint32 tsf_h; /* TSF high 32-bits of Measurement start time */ + uint32 tsf_l; /* TSF low 32-bits */ + uint32 dur; /* TUs */ + uint32 len; /* byte length of data block */ + uint8 data[1]; /* variable length data block */ +} wl_rm_rep_elt_t; +#define WL_RM_REP_ELT_FIXED_LEN 24 /* length excluding data block */ + +#define WL_RPI_REP_BIN_NUM 8 +typedef struct wl_rm_rpi_rep { + uint8 rpi[WL_RPI_REP_BIN_NUM]; + int8 rpi_max[WL_RPI_REP_BIN_NUM]; +} wl_rm_rpi_rep_t; + +typedef struct wl_rm_rep { + uint32 token; /* overall measurement set token */ + uint32 len; /* length of measurement report block */ + wl_rm_rep_elt_t rep[1]; /* variable length block of reports */ +} wl_rm_rep_t; +#define WL_RM_REP_FIXED_LEN 8 + + +#if defined(BCMSUP_PSK) +typedef enum sup_auth_status { + WLC_SUP_DISCONNECTED = 0, + WLC_SUP_CONNECTING, + WLC_SUP_IDREQUIRED, + WLC_SUP_AUTHENTICATING, + WLC_SUP_AUTHENTICATED, + WLC_SUP_KEYXCHANGE, + WLC_SUP_KEYED, + WLC_SUP_TIMEOUT +} sup_auth_status_t; +#endif /* BCMCCX | BCMSUP_PSK */ + +/* Enumerate crypto algorithms */ +#define CRYPTO_ALGO_OFF 0 +#define CRYPTO_ALGO_WEP1 1 +#define CRYPTO_ALGO_TKIP 2 +#define CRYPTO_ALGO_WEP128 3 +#define CRYPTO_ALGO_AES_CCM 4 +#define CRYPTO_ALGO_AES_OCB_MSDU 5 +#define CRYPTO_ALGO_AES_OCB_MPDU 6 +#define CRYPTO_ALGO_NALG 7 + +#define WSEC_GEN_MIC_ERROR 0x0001 +#define WSEC_GEN_REPLAY 0x0002 + +#define WL_SOFT_KEY (1 << 0) /* Indicates this key is using soft encrypt */ +#define WL_PRIMARY_KEY (1 << 1) /* Indicates this key is the primary (ie tx) key */ +#define WL_KF_RES_4 (1 << 4) /* Reserved for backward compat */ +#define WL_KF_RES_5 (1 << 5) /* Reserved for backward compat */ + +typedef struct wl_wsec_key { + uint32 index; /* key index */ + uint32 len; /* key length */ + uint8 data[DOT11_MAX_KEY_SIZE]; /* key data */ + uint32 pad_1[18]; + uint32 algo; /* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */ + uint32 flags; /* misc flags */ + uint32 pad_2[2]; + int pad_3; + int iv_initialized; /* has IV been initialized already? */ + int pad_4; + /* Rx IV */ + struct { + uint32 hi; /* upper 32 bits of IV */ + uint16 lo; /* lower 16 bits of IV */ + } rxiv; + uint32 pad_5[2]; + struct ether_addr ea; /* per station */ +} wl_wsec_key_t; + +#define WSEC_MIN_PSK_LEN 8 +#define WSEC_MAX_PSK_LEN 64 + +/* Flag for key material needing passhash'ing */ +#define WSEC_PASSPHRASE (1<<0) + +/* receptacle for WLC_SET_WSEC_PMK parameter */ +typedef struct { + ushort key_len; /* octets in key material */ + ushort flags; /* key handling qualification */ + uint8 key[WSEC_MAX_PSK_LEN]; /* PMK material */ +} wsec_pmk_t; + +/* wireless security bitvec */ +#define WEP_ENABLED 0x0001 +#define TKIP_ENABLED 0x0002 +#define AES_ENABLED 0x0004 +#define WSEC_SWFLAG 0x0008 +#define SES_OW_ENABLED 0x0040 /* to go into transition mode without setting wep */ +#define FIPS_ENABLED 0x0080 + +/* WPA authentication mode bitvec */ +#define WPA_AUTH_DISABLED 0x0000 /* Legacy (i.e., non-WPA) */ +#define WPA_AUTH_NONE 0x0001 /* none (IBSS) */ +#define WPA_AUTH_UNSPECIFIED 0x0002 /* over 802.1x */ +#define WPA_AUTH_PSK 0x0004 /* Pre-shared key */ +/* #define WPA_AUTH_8021X 0x0020 */ /* 802.1x, reserved */ +#ifdef BCMWPA2 +#define WPA2_AUTH_UNSPECIFIED 0x0040 /* over 802.1x */ +#define WPA2_AUTH_PSK 0x0080 /* Pre-shared key */ +#endif /* BCMWPA2 */ + +#ifdef BCMWPA2 +/* pmkid */ +#define MAXPMKID 16 + +typedef struct _pmkid +{ + struct ether_addr BSSID; + uint8 PMKID[WPA2_PMKID_LEN]; +} pmkid_t; + +typedef struct _pmkid_list +{ + uint32 npmkid; + pmkid_t pmkid[1]; +} pmkid_list_t; + +typedef struct _pmkid_cand { + struct ether_addr BSSID; + uint8 preauth; +} pmkid_cand_t; + +typedef struct _pmkid_cand_list { + uint32 npmkid_cand; + pmkid_cand_t pmkid_cand[1]; +} pmkid_cand_list_t; +#endif /* BCMWPA2 */ + +typedef struct wl_led_info { + uint32 index; /* led index */ + uint32 behavior; + bool activehi; +} wl_led_info_t; + +typedef struct wlc_assoc_info { + uint32 req_len; + uint32 resp_len; + uint32 flags; + struct dot11_assoc_req req; + struct ether_addr reassoc_bssid; /* used in reassoc's */ + struct dot11_assoc_resp resp; +} wl_assoc_info_t; +/* flags */ +#define WLC_ASSOC_REQ_IS_REASSOC 0x01 /* assoc req was actually a reassoc */ +/* srom read/write struct passed through ioctl */ +typedef struct { + uint byteoff; /* byte offset */ + uint nbytes; /* number of bytes */ + uint16 buf[1]; +} srom_rw_t; + +/* R_REG and W_REG struct passed through ioctl */ +typedef struct { + uint32 byteoff; /* byte offset of the field in d11regs_t */ + uint32 val; /* read/write value of the field */ + uint32 size; /* sizeof the field */ + uint band; /* band (optional) */ +} rw_reg_t; + +/* Structure used by GET/SET_ATTEN ioctls - it controls power in b/g-band */ +/* PCL - Power Control Loop */ +/* current gain setting is replaced by user input */ +#define WL_ATTEN_APP_INPUT_PCL_OFF 0 /* turn off PCL, apply supplied input */ +#define WL_ATTEN_PCL_ON 1 /* turn on PCL */ +/* current gain setting is maintained */ +#define WL_ATTEN_PCL_OFF 2 /* turn off PCL. */ +typedef struct { + uint16 auto_ctrl; /* WL_ATTEN_XX */ + uint16 bb; /* Baseband attenuation */ + uint16 radio; /* Radio attenuation */ + uint16 txctl1; /* Radio TX_CTL1 value */ +} atten_t; + +/* defines used by poweridx iovar - it controls power in a-band */ +/* current gain setting is maintained */ +#define WL_PWRIDX_PCL_OFF -2 /* turn off PCL. */ +#define WL_PWRIDX_PCL_ON -1 /* turn on PCL */ +#define WL_PWRIDX_LOWER_LIMIT -2 /* lower limit */ +#define WL_PWRIDX_UPPER_LIMIT 63 /* upper limit */ +/* value >= 0 causes + * - input to be set to that value + * - PCL to be off + */ + +/* Used to get specific STA parameters */ +typedef struct { + uint32 val; + struct ether_addr ea; +} scb_val_t; + + +/* Event data type */ +typedef struct wlc_event { + wl_event_msg_t event; /* encapsulated event */ + struct ether_addr *addr; /* used to keep a trace of the potential present of + * an address in wlc_event_msg_t + */ + void *data; /* used to hang additional data on an event */ + struct wlc_event *next; /* enables ordered list of pending events */ +} wlc_event_t; + +#define BCM_MAC_STATUS_INDICATION (0x40010200L) + +/* Please update the following when modifying this structure: + * StaInfo Twiki page flags section - description of the sta_info_t struct + * src/wl/exe/wlu.c - print of sta_info_t + * Pay attention to version if structure changes. + */ +typedef struct { + uint16 ver; /* version of this struct */ + uint16 len; /* length in bytes of this structure */ + uint16 cap; /* sta's advertised capabilities */ + uint32 flags; /* flags defined below */ + uint32 idle; /* time since data pkt rx'd from sta */ + struct ether_addr ea; /* Station address */ + wl_rateset_t rateset; /* rateset in use */ + uint32 in; /* seconds elapsed since associated */ + uint32 listen_interval_inms; /* Min Listen interval in ms for this STA */ +} sta_info_t; + +#define WL_STA_VER 2 + +/* Flags for sta_info_t indicating properties of STA */ +#define WL_STA_BRCM 0x1 /* Running a Broadcom driver */ +#define WL_STA_WME 0x2 /* WMM association */ +#define WL_STA_ABCAP 0x4 /* Afterburner-capable */ +#define WL_STA_AUTHE 0x8 /* Authenticated */ +#define WL_STA_ASSOC 0x10 /* Associated */ +#define WL_STA_AUTHO 0x20 /* Authorized */ +#define WL_STA_WDS 0x40 /* Wireless Distribution System */ +#define WL_STA_WDS_LINKUP 0x80 /* WDS traffic/probes flowing properly */ +#define WL_STA_PS 0x100 /* STA is in power save mode from AP's viewpoint */ +#define WL_STA_APSD_BE 0x200 /* APSD delv/trigger for AC_BE is default enabled */ +#define WL_STA_APSD_BK 0x400 /* APSD delv/trigger for AC_BK is default enabled */ +#define WL_STA_APSD_VI 0x800 /* APSD delv/trigger for AC_VI is default enabled */ +#define WL_STA_APSD_VO 0x1000 /* APSD delv/trigger for AC_VO is default enabled */ +#define WL_STA_N_CAP 0x2000 /* STA 802.11n capable */ + +#define WL_WDS_LINKUP WL_STA_WDS_LINKUP /* deprecated */ + +/* + * Country locale determines which channels are available to us. + */ +typedef enum _wlc_locale { + WLC_WW = 0, /* Worldwide */ + WLC_THA, /* Thailand */ + WLC_ISR, /* Israel */ + WLC_JDN, /* Jordan */ + WLC_PRC, /* China */ + WLC_JPN, /* Japan */ + WLC_FCC, /* USA */ + WLC_EUR, /* Europe */ + WLC_USL, /* US Low Band only */ + WLC_JPH, /* Japan High Band only */ + WLC_ALL, /* All the channels in this band */ + WLC_11D, /* Represents locale received by 11d beacons */ + WLC_LAST_LOCALE, + WLC_UNDEFINED_LOCALE = 0xf +} wlc_locale_t; + +/* channel encoding */ +typedef struct channel_info { + int hw_channel; + int target_channel; + int scan_channel; +} channel_info_t; + +/* For ioctls that take a list of MAC addresses */ +struct maclist { + uint count; /* number of MAC addresses */ + struct ether_addr ea[1]; /* variable length array of MAC addresses */ +}; + +/* get pkt count struct passed through ioctl */ +typedef struct get_pktcnt { + uint rx_good_pkt; + uint rx_bad_pkt; + uint tx_good_pkt; + uint tx_bad_pkt; +} get_pktcnt_t; + +/* Linux network driver ioctl encoding */ +typedef struct wl_ioctl { + uint cmd; /* common ioctl definition */ + void *buf; /* pointer to user buffer */ + uint len; /* length of user buffer */ + bool set; /* get or set request (optional) */ + uint used; /* bytes read or written (optional) */ + uint needed; /* bytes needed (optional) */ +} wl_ioctl_t; + +/* + * Structure for passing hardware and software + * revision info up from the driver. + */ +typedef struct wlc_rev_info { + uint vendorid; /* PCI vendor id */ + uint deviceid; /* device id of chip */ + uint radiorev; /* radio revision */ + uint chiprev; /* chip revision */ + uint corerev; /* core revision */ + uint boardid; /* board identifier (usu. PCI sub-device id) */ + uint boardvendor; /* board vendor (usu. PCI sub-vendor id) */ + uint boardrev; /* board revision */ + uint driverrev; /* driver version */ + uint ucoderev; /* microcode version */ + uint bus; /* bus type */ + uint chipnum; /* chip number */ +} wlc_rev_info_t; + +#define WL_BRAND_MAX 10 +typedef struct wl_instance_info { + uint instance; + char brand[WL_BRAND_MAX]; +} wl_instance_info_t; + +/* check this magic number */ +#define WLC_IOCTL_MAGIC 0x14e46c77 + +/* bump this number if you change the ioctl interface */ +#define WLC_IOCTL_VERSION 1 + +#define WLC_IOCTL_MAXLEN 8192 /* max length ioctl buffer required */ +#define WLC_IOCTL_SMLEN 256 /* "small" length ioctl buffer required */ + +/* common ioctl definitions */ +#define WLC_GET_MAGIC 0 +#define WLC_GET_VERSION 1 +#define WLC_UP 2 +#define WLC_DOWN 3 +#define WLC_DUMP 6 +#define WLC_GET_MSGLEVEL 7 +#define WLC_SET_MSGLEVEL 8 +#define WLC_GET_PROMISC 9 +#define WLC_SET_PROMISC 10 +#define WLC_GET_RATE 12 +/* #define WLC_SET_RATE 13 */ /* no longer supported */ +#define WLC_GET_INSTANCE 14 +/* #define WLC_GET_FRAG 15 */ /* no longer supported */ +/* #define WLC_SET_FRAG 16 */ /* no longer supported */ +/* #define WLC_GET_RTS 17 */ /* no longer supported */ +/* #define WLC_SET_RTS 18 */ /* no longer supported */ +#define WLC_GET_INFRA 19 +#define WLC_SET_INFRA 20 +#define WLC_GET_AUTH 21 +#define WLC_SET_AUTH 22 +#define WLC_GET_BSSID 23 +#define WLC_SET_BSSID 24 +#define WLC_GET_SSID 25 +#define WLC_SET_SSID 26 +#define WLC_RESTART 27 +#define WLC_GET_CHANNEL 29 +#define WLC_SET_CHANNEL 30 +#define WLC_GET_SRL 31 +#define WLC_SET_SRL 32 +#define WLC_GET_LRL 33 +#define WLC_SET_LRL 34 +#define WLC_GET_PLCPHDR 35 +#define WLC_SET_PLCPHDR 36 +#define WLC_GET_RADIO 37 +#define WLC_SET_RADIO 38 +#define WLC_GET_PHYTYPE 39 +/* #define WLC_GET_WEP 42 */ /* no longer supported */ +/* #define WLC_SET_WEP 43 */ /* no longer supported */ +#define WLC_GET_KEY 44 +#define WLC_SET_KEY 45 +#define WLC_GET_REGULATORY 46 +#define WLC_SET_REGULATORY 47 +#define WLC_GET_PASSIVE 48 +#define WLC_SET_PASSIVE 49 +#define WLC_SCAN 50 +#define WLC_SCAN_RESULTS 51 +#define WLC_DISASSOC 52 +#define WLC_REASSOC 53 +#define WLC_GET_ROAM_TRIGGER 54 +#define WLC_SET_ROAM_TRIGGER 55 +#define WLC_GET_TXANT 61 +#define WLC_SET_TXANT 62 +#define WLC_GET_ANTDIV 63 +#define WLC_SET_ANTDIV 64 +/* #define WLC_GET_TXPWR 65 */ /* no longer supported */ +/* #define WLC_SET_TXPWR 66 */ /* no longer supported */ +#define WLC_GET_CLOSED 67 +#define WLC_SET_CLOSED 68 +#define WLC_GET_MACLIST 69 +#define WLC_SET_MACLIST 70 +#define WLC_GET_RATESET 71 +#define WLC_SET_RATESET 72 +#define WLC_GET_LOCALE 73 +#define WLC_LONGTRAIN 74 +#define WLC_GET_BCNPRD 75 +#define WLC_SET_BCNPRD 76 +#define WLC_GET_DTIMPRD 77 +#define WLC_SET_DTIMPRD 78 +#define WLC_GET_SROM 79 +#define WLC_SET_SROM 80 +#define WLC_GET_WEP_RESTRICT 81 +#define WLC_SET_WEP_RESTRICT 82 +#define WLC_GET_COUNTRY 83 +#define WLC_SET_COUNTRY 84 +#define WLC_GET_PM 85 +#define WLC_SET_PM 86 +#define WLC_GET_WAKE 87 +#define WLC_SET_WAKE 88 +#define WLC_GET_D11CNTS 89 +#define WLC_GET_FORCELINK 90 /* ndis only */ +#define WLC_SET_FORCELINK 91 /* ndis only */ +#define WLC_FREQ_ACCURACY 92 +#define WLC_CARRIER_SUPPRESS 93 +#define WLC_GET_PHYREG 94 +#define WLC_SET_PHYREG 95 +#define WLC_GET_RADIOREG 96 +#define WLC_SET_RADIOREG 97 +#define WLC_GET_REVINFO 98 +#define WLC_GET_UCANTDIV 99 +#define WLC_SET_UCANTDIV 100 +#define WLC_R_REG 101 +#define WLC_W_REG 102 +#define WLC_DIAG_LOOPBACK 103 +#define WLC_RESET_D11CNTS 104 +#define WLC_GET_MACMODE 105 +#define WLC_SET_MACMODE 106 +#define WLC_GET_MONITOR 107 +#define WLC_SET_MONITOR 108 +#define WLC_GET_GMODE 109 +#define WLC_SET_GMODE 110 +#define WLC_GET_LEGACY_ERP 111 +#define WLC_SET_LEGACY_ERP 112 +#define WLC_GET_RX_ANT 113 +#define WLC_GET_CURR_RATESET 114 /* current rateset */ +#define WLC_GET_SCANSUPPRESS 115 +#define WLC_SET_SCANSUPPRESS 116 +#define WLC_GET_AP 117 +#define WLC_SET_AP 118 +#define WLC_GET_EAP_RESTRICT 119 +#define WLC_SET_EAP_RESTRICT 120 +#define WLC_SCB_AUTHORIZE 121 +#define WLC_SCB_DEAUTHORIZE 122 +#define WLC_GET_WDSLIST 123 +#define WLC_SET_WDSLIST 124 +#define WLC_GET_ATIM 125 +#define WLC_SET_ATIM 126 +#define WLC_GET_RSSI 127 +#define WLC_GET_PHYANTDIV 128 +#define WLC_SET_PHYANTDIV 129 +#define WLC_AP_RX_ONLY 130 +#define WLC_GET_TX_PATH_PWR 131 +#define WLC_SET_TX_PATH_PWR 132 +#define WLC_GET_WSEC 133 +#define WLC_SET_WSEC 134 +#define WLC_GET_PHY_NOISE 135 +#define WLC_GET_BSS_INFO 136 +#define WLC_GET_PKTCNTS 137 +#define WLC_GET_LAZYWDS 138 +#define WLC_SET_LAZYWDS 139 +#define WLC_GET_BANDLIST 140 +#define WLC_GET_BAND 141 +#define WLC_SET_BAND 142 +#define WLC_SCB_DEAUTHENTICATE 143 +#define WLC_GET_SHORTSLOT 144 +#define WLC_GET_SHORTSLOT_OVERRIDE 145 +#define WLC_SET_SHORTSLOT_OVERRIDE 146 +#define WLC_GET_SHORTSLOT_RESTRICT 147 +#define WLC_SET_SHORTSLOT_RESTRICT 148 +#define WLC_GET_GMODE_PROTECTION 149 +#define WLC_GET_GMODE_PROTECTION_OVERRIDE 150 +#define WLC_SET_GMODE_PROTECTION_OVERRIDE 151 +#define WLC_UPGRADE 152 +/* #define WLC_GET_MRATE 153 */ /* no longer supported */ +/* #define WLC_SET_MRATE 154 */ /* no longer supported */ +#define WLC_GET_ASSOCLIST 159 +#define WLC_GET_CLK 160 +#define WLC_SET_CLK 161 +#define WLC_GET_UP 162 +#define WLC_OUT 163 +#define WLC_GET_WPA_AUTH 164 +#define WLC_SET_WPA_AUTH 165 +#define WLC_GET_PROTECTION_CONTROL 178 +#define WLC_SET_PROTECTION_CONTROL 179 +#define WLC_GET_PHYLIST 180 +#define WLC_GET_KEY_SEQ 183 +/* #define WLC_GET_GMODE_PROTECTION_CTS 198 */ /* no longer supported */ +/* #define WLC_SET_GMODE_PROTECTION_CTS 199 */ /* no longer supported */ +#define WLC_GET_PIOMODE 203 +#define WLC_SET_PIOMODE 204 +#define WLC_SET_LED 209 +#define WLC_GET_LED 210 +#define WLC_GET_CHANNEL_SEL 215 +#define WLC_START_CHANNEL_SEL 216 +#define WLC_GET_VALID_CHANNELS 217 +#define WLC_GET_FAKEFRAG 218 +#define WLC_SET_FAKEFRAG 219 +#define WLC_GET_WET 230 +#define WLC_SET_WET 231 +#define WLC_GET_KEY_PRIMARY 235 +#define WLC_SET_KEY_PRIMARY 236 +#define WLC_GET_RADAR 242 +#define WLC_SET_RADAR 243 +#define WLC_SET_SPECT_MANAGMENT 244 +#define WLC_GET_SPECT_MANAGMENT 245 +#define WLC_WDS_GET_REMOTE_HWADDR 246 /* handled in wl_linux.c/wl_vx.c */ +#define WLC_SET_CS_SCAN_TIMER 248 +#define WLC_GET_CS_SCAN_TIMER 249 +#define WLC_SEND_PWR_CONSTRAINT 254 +#define WLC_CURRENT_PWR 256 +#define WLC_GET_CHANNELS_IN_COUNTRY 260 +#define WLC_GET_COUNTRY_LIST 261 +#define WLC_GET_VAR 262 /* get value of named variable */ +#define WLC_SET_VAR 263 /* set named variable to value */ +#define WLC_NVRAM_GET 264 /* deprecated */ +#define WLC_NVRAM_SET 265 +#define WLC_SET_WSEC_PMK 268 +#define WLC_GET_AUTH_MODE 269 +#define WLC_SET_AUTH_MODE 270 +#define WLC_NDCONFIG_ITEM 273 /* currently handled in wl_oid.c */ +#define WLC_NVOTPW 274 +#define WLC_OTPW 275 +#define WLC_SET_LOCALE 278 +#define WLC_LAST 279 /* do not change - use get_var/set_var */ + +/* + * Minor kludge alert: + * Duplicate a few definitions that irelay requires from epiioctl.h here + * so caller doesn't have to include this file and epiioctl.h . + * If this grows any more, it would be time to move these irelay-specific + * definitions out of the epiioctl.h and into a separate driver common file. + */ +#ifndef EPICTRL_COOKIE +#define EPICTRL_COOKIE 0xABADCEDE +#endif + +/* vx wlc ioctl's offset */ +#define CMN_IOCTL_OFF 0x180 + +/* + * custom OID support + * + * 0xFF - implementation specific OID + * 0xE4 - first byte of Broadcom PCI vendor ID + * 0x14 - second byte of Broadcom PCI vendor ID + * 0xXX - the custom OID number + */ + +/* begin 0x1f values beyond the start of the ET driver range. */ +#define WL_OID_BASE 0xFFE41420 + +/* NDIS overrides */ +#define OID_WL_GETINSTANCE (WL_OID_BASE + WLC_GET_INSTANCE) +#define OID_WL_NDCONFIG_ITEM (WL_OID_BASE + WLC_NDCONFIG_ITEM) + +#define WL_DECRYPT_STATUS_SUCCESS 1 +#define WL_DECRYPT_STATUS_FAILURE 2 +#define WL_DECRYPT_STATUS_UNKNOWN 3 + +/* allows user-mode app to poll the status of USB image upgrade */ +#define WLC_UPGRADE_SUCCESS 0 +#define WLC_UPGRADE_PENDING 1 + +#ifdef CONFIG_USBRNDIS_RETAIL +/* struct passed in for WLC_NDCONFIG_ITEM */ +typedef struct { + char *name; + void *param; +} ndconfig_item_t; +#endif + +/* Bit masks for radio disabled status - returned by WL_GET_RADIO */ +#define WL_RADIO_SW_DISABLE (1<<0) +#define WL_RADIO_HW_DISABLE (1<<1) +#define WL_RADIO_MPC_DISABLE (1<<2) +#define WL_RADIO_COUNTRY_DISABLE (1<<3) /* some countries don't support any channel */ + +/* Override bit for WLC_SET_TXPWR. if set, ignore other level limits */ +#define WL_TXPWR_OVERRIDE (1<<31) + +/* "diag" iovar argument and error code */ +#define WL_DIAG_INTERRUPT 1 /* d11 loopback interrupt test */ +#define WL_DIAG_MEMORY 3 /* d11 memory test */ +#define WL_DIAG_LED 4 /* LED test */ +#define WL_DIAG_REG 5 /* d11/phy register test */ +#define WL_DIAG_SROM 6 /* srom read/crc test */ +#define WL_DIAG_DMA 7 /* DMA test */ + +#define WL_DIAGERR_SUCCESS 0 +#define WL_DIAGERR_FAIL_TO_RUN 1 /* unable to run requested diag */ +#define WL_DIAGERR_NOT_SUPPORTED 2 /* diag requested is not supported */ +#define WL_DIAGERR_INTERRUPT_FAIL 3 /* loopback interrupt test failed */ +#define WL_DIAGERR_LOOPBACK_FAIL 4 /* loopback data test failed */ +#define WL_DIAGERR_SROM_FAIL 5 /* srom read failed */ +#define WL_DIAGERR_SROM_BADCRC 6 /* srom crc failed */ +#define WL_DIAGERR_REG_FAIL 7 /* d11/phy register test failed */ +#define WL_DIAGERR_MEMORY_FAIL 8 /* d11 memory test failed */ +#define WL_DIAGERR_NOMEM 9 /* diag test failed due to no memory */ +#define WL_DIAGERR_DMA_FAIL 10 /* DMA test failed */ + +/* band types */ +#define WLC_BAND_AUTO 0 /* auto-select */ +#define WLC_BAND_5G 1 /* 5 Ghz */ +#define WLC_BAND_2G 2 /* 2.4 Ghz */ +#define WLC_BAND_ALL 3 /* all bands */ + +/* phy types (returned by WLC_GET_PHYTPE) */ +#define WLC_PHY_TYPE_A 0 +#define WLC_PHY_TYPE_B 1 +#define WLC_PHY_TYPE_G 2 +#define WLC_PHY_TYPE_N 4 +#define WLC_PHY_TYPE_NULL 0xf + +/* MAC list modes */ +#define WLC_MACMODE_DISABLED 0 /* MAC list disabled */ +#define WLC_MACMODE_DENY 1 /* Deny specified (i.e. allow unspecified) */ +#define WLC_MACMODE_ALLOW 2 /* Allow specified (i.e. deny unspecified) */ + +/* + * + */ +#define GMODE_LEGACY_B 0 +#define GMODE_AUTO 1 +#define GMODE_ONLY 2 +#define GMODE_B_DEFERRED 3 +#define GMODE_PERFORMANCE 4 +#define GMODE_LRS 5 +#define GMODE_MAX 6 + +/* values for PLCPHdr_override */ +#define WLC_PLCP_AUTO -1 +#define WLC_PLCP_SHORT 0 +#define WLC_PLCP_LONG 1 + +/* values for g_protection_override and n_protection_override */ +#define WLC_PROTECTION_AUTO -1 +#define WLC_PROTECTION_OFF 0 +#define WLC_PROTECTION_ON 1 + +/* values for g_protection_control and n_protection_control */ +#define WLC_PROTECTION_CTL_OFF 0 +#define WLC_PROTECTION_CTL_LOCAL 1 +#define WLC_PROTECTION_CTL_OVERLAP 2 + +/* deprecated const names for g_protection_override */ +#define WLC_G_PROTECTION_AUTO WLC_PROTECTION_AUTO +#define WLC_G_PROTECTION_OFF WLC_PROTECTION_OFF +#define WLC_G_PROTECTION_ON WLC_PROTECTION_ON + +/* deprecated const names for g_protection_control */ +#define WLC_G_PROTECTION_CTL_OFF WLC_PROTECTION_CTL_OFF +#define WLC_G_PROTECTION_CTL_LOCAL WLC_PROTECTION_CTL_LOCAL +#define WLC_G_PROTECTION_CTL_OVERLAP WLC_PROTECTION_CTL_OVERLAP + +/* deprecated const names for get/set g_protection_control */ +#define WLC_GET_GMODE_PROTECTION_CONTROL WLC_GET_PROTECTION_CONTROL +#define WLC_SET_GMODE_PROTECTION_CONTROL WLC_SET_PROTECTION_CONTROL + +/* values for n_protection */ +#define WLC_N_PROTECTION_OFF 0 +#define WLC_N_PROTECTION_MIXEDMODE 1 +#define WLC_N_PROTECTION_CTS 2 + +/* values for n_preamble_type */ +#define WLC_N_PREAMBLE_MIXEDMODE 0 +#define WLC_N_PREAMBLE_GF 1 + +/* Values for PM */ +#define PM_OFF 0 +#define PM_MAX 1 +#define PM_FAST 2 + + + +typedef struct { + int npulses; /* required number of pulses at n * t_int */ + int ncontig; /* required number of pulses at t_int */ + int min_pw; /* minimum pulse width (20 MHz clocks) */ + int max_pw; /* maximum pulse width (20 MHz clocks) */ + uint16 thresh0; /* Radar detection, thresh 0 */ + uint16 thresh1; /* Radar detection, thresh 1 */ + int npulses_lp; /* Radar detection, minimum long pulses */ + int min_pw_lp; /* Minimum pulsewidth for long pulses */ + int max_pw_lp; /* Maximum pulsewidth for long pulses */ + int min_fm_lp; /* Minimum fm for long pulses */ + int max_deltat_lp; /* Maximum deltat for long pulses */ + int min_deltat; /* Minimum spacing between pulses */ +} wl_radar_args_t; + +/* radar iovar SET defines */ +#define WL_RADAR_DETECTOR_OFF 0 /* radar detector off */ +#define WL_RADAR_DETECTOR_ON 1 /* radar detector on */ +#define WL_RADAR_SIMULATED 2 /* force radar detector to declare + * detection once + */ + +/* dfs_status iovar-related defines */ + +/* cac - channel availability check, + * ism - in-service monitoring + * csa - channel switching announcement + */ + +/* cac state values */ +#define WL_DFS_CACSTATE_IDLE 0 /* state for operating in non-radar channel */ +#define WL_DFS_CACSTATE_PREISM_CAC 1 /* CAC in progress */ +#define WL_DFS_CACSTATE_ISM 2 /* ISM in progress */ +#define WL_DFS_CACSTATE_CSA 3 /* csa */ +#define WL_DFS_CACSTATE_POSTISM_CAC 4 /* ISM CAC */ +#define WL_DFS_CACSTATE_PREISM_OOC 5 /* PREISM OOC */ +#define WL_DFS_CACSTATE_POSTISM_OOC 6 /* POSTISM OOC */ +#define WL_DFS_CACSTATES 7 /* this many states exist */ + +/* data structure used in 'dfs_status' wl interface, which is used to query dfs status */ +typedef struct { + uint state; /* noted by WL_DFS_CACSTATE_XX. */ + uint duration; /* time spent in ms in state. */ + /* as dfs enters ISM state, it removes the operational channel from quiet channel + * list and notes the channel in channel_cleared. set to 0 if no channel is cleared + */ + chanspec_t chanspec_cleared; + /* chanspec cleared used to be a uint, add another to uint16 to maintain size */ + uint16 pad; +} wl_dfs_status_t; + +#define NUM_PWRCTRL_RATES 12 + +typedef struct tx_inst_power { +} tx_inst_power_t; + + +/* regulatory enforcement levels */ +#define SPECT_MNGMT_OFF 0 /* both 11h and 11d disabled */ +#define SPECT_MNGMT_LOOSE_11H 1 /* allow non-11h APs in scan lists */ +#define SPECT_MNGMT_STRICT_11H 2 /* prune out non-11h APs from scan list */ +#define SPECT_MNGMT_STRICT_11D 3 /* switch to 802.11D mode */ +/* SPECT_MNGMT_LOOSE_11H_D - same as SPECT_MNGMT_LOOSE with the exception that Country IE + * adoption is done irregardless of capability-spectrum_management + */ +#define SPECT_MNGMT_LOOSE_11H_D 4 /* operation defined above */ + +#define WL_CHAN_VALID_HW (1 << 0) /* valid with current HW */ +#define WL_CHAN_VALID_SW (1 << 1) /* valid with current country setting */ +#define WL_CHAN_BAND_5G (1 << 2) /* 5GHz-band channel */ +#define WL_CHAN_RADAR (1 << 3) /* radar sensitive channel */ +#define WL_CHAN_INACTIVE (1 << 4) /* temporarily inactive due to radar */ +#define WL_CHAN_PASSIVE (1 << 5) /* channel is in passive mode */ +#define WL_CHAN_RESTRICTED (1 << 6) /* restricted use channel */ + +/* BTC mode used by "btc_mode" iovar */ +#define WL_BTC_DISABLE 0 /* disable BT coexistance */ +#define WL_BTC_ENABLE 1 /* enable BT coexistance */ +#define WL_BTC_PREMPT 2 /* enable BT coexistance and BT pre-emption */ + +#define WL_MPC_VAL 0x00400000 +#define WL_APSTA_VAL 0x00800000 +#define WL_DFS_VAL 0x01000000 +#define WL_BA_VAL 0x02000000 +#define WL_NITRO_VAL 0x04000000 +#define WL_CAC_VAL 0x08000000 +#define WL_AMSDU_VAL 0x10000000 +#define WL_AMPDU_VAL 0x20000000 + +/* max # of leds supported by GPIO (gpio pin# == led index#) */ +#define WL_LED_NUMGPIO 16 /* gpio 0-15 */ + +/* led per-pin behaviors */ +#define WL_LED_OFF 0 /* always off */ +#define WL_LED_ON 1 /* always on */ +#define WL_LED_ACTIVITY 2 /* activity */ +#define WL_LED_RADIO 3 /* radio enabled */ +#define WL_LED_ARADIO 4 /* 5 Ghz radio enabled */ +#define WL_LED_BRADIO 5 /* 2.4Ghz radio enabled */ +#define WL_LED_BGMODE 6 /* on if gmode, off if bmode */ +#define WL_LED_WI1 7 +#define WL_LED_WI2 8 +#define WL_LED_WI3 9 +#define WL_LED_ASSOC 10 /* associated state indicator */ +#define WL_LED_INACTIVE 11 /* null behavior (clears default behavior) */ +#define WL_LED_NUMBEHAVIOR 12 + +/* led behavior numeric value format */ +#define WL_LED_BEH_MASK 0x7f /* behavior mask */ +#define WL_LED_AL_MASK 0x80 /* activelow (polarity) bit */ + +/* max # of channels returnd by the get valid channels iovar */ +#define WL_NUMCHANSPECS 100 + +/* WDS link local endpoint WPA role */ +#define WL_WDS_WPA_ROLE_AUTH 0 /* authenticator */ +#define WL_WDS_WPA_ROLE_SUP 1 /* supplicant */ +#define WL_WDS_WPA_ROLE_AUTO 255 /* auto, based on mac addr value */ + +/* number of bytes needed to define a 128-bit mask for MAC event reporting */ +#define WL_EVENTING_MASK_LEN 16 + +/* Structures and constants used for "vndr_ie" IOVar interface */ +#define VNDR_IE_CMD_LEN 4 /* length of the set command string: + * "add", "del" (+ NULL) + */ + +/* 802.11 Mgmt Packet flags */ +#define VNDR_IE_BEACON_FLAG 0x1 +#define VNDR_IE_PRBRSP_FLAG 0x2 +#define VNDR_IE_ASSOCRSP_FLAG 0x4 +#define VNDR_IE_AUTHRSP_FLAG 0x8 + +#define VNDR_IE_INFO_HDR_LEN (sizeof(uint32)) + +typedef struct { + uint32 pktflag; /* bitmask indicating which packet(s) contain this IE */ + vndr_ie_t vndr_ie_data; /* vendor IE data */ +} vndr_ie_info_t; + +typedef struct { + int iecount; /* number of entries in the vndr_ie_list[] array */ + vndr_ie_info_t vndr_ie_list[1]; /* variable size list of vndr_ie_info_t structs */ +} vndr_ie_buf_t; + +typedef struct { + char cmd[VNDR_IE_CMD_LEN]; /* vndr_ie IOVar set command : "add", "del" + NULL */ + vndr_ie_buf_t vndr_ie_buffer; /* buffer containing Vendor IE list information */ +} vndr_ie_setbuf_t; + +/* join target preference types */ +#define WL_JOIN_PREF_RSSI 1 /* by RSSI, mandatory */ +#define WL_JOIN_PREF_WPA 2 /* by akm and ciphers, optional, RSN and WPA as values */ +#define WL_JOIN_PREF_BAND 3 /* by 802.11 band, optional, WLC_BAND_XXXX as values */ + +/* band preference */ +#define WLJP_BAND_ASSOC_PREF 255 /* use assoc preference settings */ + /* others use WLC_BAND_XXXX as values */ + +/* any multicast cipher suite */ +#define WL_WPA_ACP_MCS_ANY "\x00\x00\x00\x00" + +struct tsinfo_arg { + uint8 octets[3]; +}; + +#if !defined(__GNUC__) +#pragma pack(pop) +#endif + +#define NFIFO 6 /* # tx/rx fifopairs */ + +#define WL_CNT_T_VERSION 1 /* current version of wl_cnt_t struct */ + +typedef struct { + uint16 version; /* see definition of WL_CNT_T_VERSION */ + uint16 length; /* length of entire structure */ + + /* transmit stat counters */ + uint32 txframe; /* tx data frames */ + uint32 txbyte; /* tx data bytes */ + uint32 txretrans; /* tx mac retransmits */ + uint32 txerror; /* tx data errors (derived: sum of others) */ + uint32 txctl; /* tx management frames */ + uint32 txprshort; /* tx short preamble frames */ + uint32 txserr; /* tx status errors */ + uint32 txnobuf; /* tx out of buffers errors */ + uint32 txnoassoc; /* tx discard because we're not associated */ + uint32 txrunt; /* tx runt frames */ + uint32 txchit; /* tx header cache hit (fastpath) */ + uint32 txcmiss; /* tx header cache miss (slowpath) */ + + /* transmit chip error counters */ + uint32 txuflo; /* tx fifo underflows */ + uint32 txphyerr; /* tx phy errors (indicated in tx status) */ + uint32 txphycrs; + + /* receive stat counters */ + uint32 rxframe; /* rx data frames */ + uint32 rxbyte; /* rx data bytes */ + uint32 rxerror; /* rx data errors (derived: sum of others) */ + uint32 rxctl; /* rx management frames */ + uint32 rxnobuf; /* rx out of buffers errors */ + uint32 rxnondata; /* rx non data frames in the data channel errors */ + uint32 rxbadds; /* rx bad DS errors */ + uint32 rxbadcm; /* rx bad control or management frames */ + uint32 rxfragerr; /* rx fragmentation errors */ + uint32 rxrunt; /* rx runt frames */ + uint32 rxgiant; /* rx giant frames */ + uint32 rxnoscb; /* rx no scb error */ + uint32 rxbadproto; /* rx invalid frames */ + uint32 rxbadsrcmac; /* rx frames with Invalid Src Mac */ + uint32 rxbadda; /* rx frames tossed for invalid da */ + uint32 rxfilter; /* rx frames filtered out */ + + /* receive chip error counters */ + uint32 rxoflo; /* rx fifo overflow errors */ + uint32 rxuflo[NFIFO]; /* rx dma descriptor underflow errors */ + + uint32 d11cnt_txrts_off; /* d11cnt txrts value when reset d11cnt */ + uint32 d11cnt_rxcrc_off; /* d11cnt rxcrc value when reset d11cnt */ + uint32 d11cnt_txnocts_off; /* d11cnt txnocts value when reset d11cnt */ + + /* misc counters */ + uint32 dmade; /* tx/rx dma descriptor errors */ + uint32 dmada; /* tx/rx dma data errors */ + uint32 dmape; /* tx/rx dma descriptor protocol errors */ + uint32 reset; /* reset count */ + uint32 tbtt; /* cnts the TBTT int's */ + uint32 txdmawar; + uint32 pkt_callback_reg_fail; /* callbacks register failure */ + + /* MAC counters: 32-bit version of d11.h's macstat_t */ + uint32 txallfrm; /* total number of frames sent, incl. Data, ACK, RTS, CTS, + * Control Management (includes retransmissions) + */ + uint32 txrtsfrm; /* number of RTS sent out by the MAC */ + uint32 txctsfrm; /* number of CTS sent out by the MAC */ + uint32 txackfrm; /* number of ACK frames sent out */ + uint32 txdnlfrm; /* Not used */ + uint32 txbcnfrm; /* beacons transmitted */ + uint32 txfunfl[8]; /* per-fifo tx underflows */ + uint32 txtplunfl; /* Template underflows (mac was too slow to transmit ACK/CTS + * or BCN) + */ + uint32 txphyerror; /* Transmit phy error, type of error is reported in tx-status for + * driver enqueued frames + */ + uint32 rxfrmtoolong; /* Received frame longer than legal limit (2346 bytes) */ + uint32 rxfrmtooshrt; /* Received frame did not contain enough bytes for its frame type */ + uint32 rxinvmachdr; /* Either the protocol version != 0 or frame type not + * data/control/management + */ + uint32 rxbadfcs; /* number of frames for which the CRC check failed in the MAC */ + uint32 rxbadplcp; /* parity check of the PLCP header failed */ + uint32 rxcrsglitch; /* PHY was able to correlate the preamble but not the header */ + uint32 rxstrt; /* Number of received frames with a good PLCP + * (i.e. passing parity check) + */ + uint32 rxdfrmucastmbss; /* Number of received DATA frames with good FCS and matching RA */ + uint32 rxmfrmucastmbss; /* number of received mgmt frames with good FCS and matching RA */ + uint32 rxcfrmucast; /* number of received CNTRL frames with good FCS and matching RA */ + uint32 rxrtsucast; /* number of unicast RTS addressed to the MAC (good FCS) */ + uint32 rxctsucast; /* number of unicast CTS addressed to the MAC (good FCS) */ + uint32 rxackucast; /* number of ucast ACKS received (good FCS) */ + uint32 rxdfrmocast; /* number of received DATA frames (good FCS and not matching RA) */ + uint32 rxmfrmocast; /* number of received MGMT frames (good FCS and not matching RA) */ + uint32 rxcfrmocast; /* number of received CNTRL frame (good FCS and not matching RA) */ + uint32 rxrtsocast; /* number of received RTS not addressed to the MAC */ + uint32 rxctsocast; /* number of received CTS not addressed to the MAC */ + uint32 rxdfrmmcast; /* number of RX Data multicast frames received by the MAC */ + uint32 rxmfrmmcast; /* number of RX Management multicast frames received by the MAC */ + uint32 rxcfrmmcast; /* number of RX Control multicast frames received by the MAC + * (unlikely to see these) + */ + uint32 rxbeaconmbss; /* beacons received from member of BSS */ + uint32 rxdfrmucastobss; /* number of unicast frames addressed to the MAC from + * other BSS (WDS FRAME) + */ + uint32 rxbeaconobss; /* beacons received from other BSS */ + uint32 rxrsptmout; /* Number of response timeouts for transmitted frames + * expecting a response + */ + uint32 bcntxcancl; /* transmit beacons canceled due to receipt of beacon (IBSS) */ + uint32 rxf0ovfl; /* Number of receive fifo 0 overflows */ + uint32 rxf1ovfl; /* Number of receive fifo 1 overflows (obsolete) */ + uint32 rxf2ovfl; /* Number of receive fifo 2 overflows (obsolete) */ + uint32 txsfovfl; /* Number of transmit status fifo overflows (obsolete) */ + uint32 pmqovfl; /* Number of PMQ overflows */ + uint32 rxcgprqfrm; /* Number of received Probe requests that made it into + * the PRQ fifo + */ + uint32 rxcgprsqovfl; /* Rx Probe Request Que overflow in the AP */ + uint32 txcgprsfail; /* Tx Probe Response Fail. AP sent probe response but did + * not get ACK + */ + uint32 txcgprssuc; /* Tx Probe Response Success (ACK was received) */ + uint32 prs_timeout; /* Number of probe requests that were dropped from the PRQ + * fifo because a probe response could not be sent out within + * the time limit defined in M_PRS_MAXTIME + */ + uint32 rxnack; /* Number of NACKS received (Afterburner) */ + uint32 frmscons; /* Number of frames completed without transmission because of an + * Afterburner re-queue + */ + uint32 txnack; /* Number of NACKs transmitted (Afterburner) */ + uint32 txglitch_nack; /* obsolete */ + uint32 txburst; /* obsolete */ + + /* 802.11 MIB counters, pp. 614 of 802.11 reaff doc. */ + uint32 txfrag; /* dot11TransmittedFragmentCount */ + uint32 txmulti; /* dot11MulticastTransmittedFrameCount */ + uint32 txfail; /* dot11FailedCount */ + uint32 txretry; /* dot11RetryCount */ + uint32 txretrie; /* dot11MultipleRetryCount */ + uint32 rxdup; /* dot11FrameduplicateCount */ + uint32 txrts; /* dot11RTSSuccessCount */ + uint32 txnocts; /* dot11RTSFailureCount */ + uint32 txnoack; /* dot11ACKFailureCount */ + uint32 rxfrag; /* dot11ReceivedFragmentCount */ + uint32 rxmulti; /* dot11MulticastReceivedFrameCount */ + uint32 rxcrc; /* dot11FCSErrorCount */ + uint32 txfrmsnt; /* dot11TransmittedFrameCount (bogus MIB?) */ + uint32 rxundec; /* dot11WEPUndecryptableCount */ + + /* WPA2 counters (see rxundec for DecryptFailureCount) */ + uint32 tkipmicfaill; /* TKIPLocalMICFailures */ + uint32 tkipcntrmsr; /* TKIPCounterMeasuresInvoked */ + uint32 tkipreplay; /* TKIPReplays */ + uint32 ccmpfmterr; /* CCMPFormatErrors */ + uint32 ccmpreplay; /* CCMPReplays */ + uint32 ccmpundec; /* CCMPDecryptErrors */ + uint32 fourwayfail; /* FourWayHandshakeFailures */ + uint32 wepundec; /* dot11WEPUndecryptableCount */ + uint32 wepicverr; /* dot11WEPICVErrorCount */ + uint32 decsuccess; /* DecryptSuccessCount */ + uint32 tkipicverr; /* TKIPICVErrorCount */ + uint32 wepexcluded; /* dot11WEPExcludedCount */ + + uint32 txchanrej; /* Tx frames suppressed due to channel rejection */ + uint32 psmwds; /* Count PSM watchdogs */ + uint32 phywatchdog; /* Count Phy lockups */ +} wl_cnt_t; + +#define WL_WME_CNT_VERSION 1 /* current version of wl_wme_cnt_t */ + +typedef struct { + uint32 packets; + uint32 bytes; +} wl_traffic_stats_t; + +typedef struct { + uint16 version; /* see definition of WL_CNT_T_VERSION */ + uint16 length; /* length of entire structure */ + + wl_traffic_stats_t tx[AC_COUNT]; /* Packets transmitted */ + wl_traffic_stats_t tx_failed[AC_COUNT]; /* Packets dropped or failed to transmit */ + wl_traffic_stats_t rx[AC_COUNT]; /* Packets received */ + wl_traffic_stats_t rx_failed[AC_COUNT]; /* Packets failed to receive */ + + wl_traffic_stats_t forward[AC_COUNT]; /* Packets forwarded by AP */ + + wl_traffic_stats_t tx_expired[AC_COUNT]; /* packets dropped due to lifetime expiry */ + +} wl_wme_cnt_t; + +#ifdef WLBA + +#define WLC_BA_CNT_VERSION 1 /* current version of wlc_ba_cnt_t */ + +/* block ack related stats */ +typedef struct wlc_ba_cnt { + uint16 version; /* WLC_BA_CNT_VERSION */ + uint16 length; /* length of entire structure */ + + /* transmit stat counters */ + uint32 txpdu; /* pdus sent */ + uint32 txsdu; /* sdus sent */ + uint32 txfc; /* tx side flow controlled packets */ + uint32 txfci; /* tx side flow control initiated */ + uint32 txretrans; /* retransmitted pdus */ + uint32 txbatimer; /* ba resend due to timer */ + uint32 txdrop; /* dropped packets */ + uint32 txaddbareq; /* addba req sent */ + uint32 txaddbaresp; /* addba resp sent */ + uint32 txdelba; /* delba sent */ + uint32 txba; /* ba sent */ + uint32 txbar; /* bar sent */ + uint32 txpad[4]; /* future */ + + /* receive side counters */ + uint32 rxpdu; /* pdus recd */ + uint32 rxqed; /* pdus buffered before sending up */ + uint32 rxdup; /* duplicate pdus */ + uint32 rxnobuf; /* pdus discarded due to no buf */ + uint32 rxaddbareq; /* addba req recd */ + uint32 rxaddbaresp; /* addba resp recd */ + uint32 rxdelba; /* delba recd */ + uint32 rxba; /* ba recd */ + uint32 rxbar; /* bar recd */ + uint32 rxinvba; /* invalid ba recd */ + uint32 rxbaholes; /* ba recd with holes */ + uint32 rxunexp; /* unexpected packets */ + uint32 rxpad[4]; /* future */ +} wlc_ba_cnt_t; +#endif /* WLBA */ + +/* structure for per-tid ampdu control */ +struct ampdu_tid_control { + uint8 tid; /* tid */ + uint8 enable; /* enable/disable */ +}; + +/* structure for addts arguments */ +/* For ioctls that take a list of TSPEC */ +struct tslist { + int count; /* number of tspecs */ + struct tsinfo_arg tsinfo[1]; /* variable length array of tsinfo */ +}; + +/* structure for addts/delts arguments */ +typedef struct tspec_arg { + uint16 version; /* see definition of TSPEC_ARG_VERSION */ + uint16 length; /* length of entire structure */ + uint flag; /* bit field */ + /* TSPEC Arguments */ + struct tsinfo_arg tsinfo; /* TS Info bit field */ + uint16 nom_msdu_size; /* (Nominal or fixed) MSDU Size (bytes) */ + uint16 max_msdu_size; /* Maximum MSDU Size (bytes) */ + uint min_srv_interval; /* Minimum Service Interval (us) */ + uint max_srv_interval; /* Maximum Service Interval (us) */ + uint inactivity_interval; /* Inactivity Interval (us) */ + uint suspension_interval; /* Suspension Interval (us) */ + uint srv_start_time; /* Service Start Time (us) */ + uint min_data_rate; /* Minimum Data Rate (bps) */ + uint mean_data_rate; /* Mean Data Rate (bps) */ + uint peak_data_rate; /* Peak Data Rate (bps) */ + uint max_burst_size; /* Maximum Burst Size (bytes) */ + uint delay_bound; /* Delay Bound (us) */ + uint min_phy_rate; /* Minimum PHY Rate (bps) */ + uint16 surplus_bw; /* Surplus Bandwidth Allowance Factor */ + uint16 medium_time; /* Medium Time (32 us/s periods) */ +} tspec_arg_t; + +/* current version of wl_tspec_arg_t struct */ +#define TSPEC_ARG_VERSION 1 /* current version of wl_tspec_arg_t struct */ +#define TSPEC_ARG_LENGTH 55 /* argment length from tsinfo to medium_time */ + +/* define for flag */ +#define TSPEC_PENDING 0 /* TSPEC pending */ +#define TSPEC_ACCEPTED 1 /* TSPEC accepted */ +#define TSPEC_REJECTED 2 /* TSPEC rejected */ +#define TSPEC_UNKNOWN 3 /* TSPEC unknown */ +#define TSPEC_STATUS_MASK 7 /* TSPEC status mask */ + + +/* Software feature flag defines used by wlfeatureflag */ +#define WL_SWFL_ABBFL 0x0001 /* Allow Afterburner on systems w/o hardware BFL */ +#define WL_SWFL_ABENCORE 0x0002 /* Allow AB on non-4318E chips */ + +#define WL_LIFETIME_MAX 0xFFFF /* Max value in ms */ + +/* Packet lifetime configuration per ac */ +typedef struct wl_lifetime { + uint32 ac; /* access class */ + uint32 lifetime; /* Packet lifetime value in ms */ +} wl_lifetime_t; + +#endif /* _wlioctl_h_ */ diff --git a/package/broadcom-wl/src/wlc/include/wlutils.h b/package/broadcom-wl/src/wlc/include/wlutils.h new file mode 100644 index 0000000000..a5aa1fd663 --- /dev/null +++ b/package/broadcom-wl/src/wlc/include/wlutils.h @@ -0,0 +1,102 @@ +/* + * Broadcom wireless network adapter utility functions + * + * Copyright 2006, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * + * $Id: wlutils.h,v 1.1.1.12 2006/02/27 03:43:20 honor Exp $ + */ + +#ifndef _wlutils_h_ +#define _wlutils_h_ + +#include <typedefs.h> +#include <wlioctl.h> + +/* + * Pass a wlioctl request to the specified interface. + * @param name interface name + * @param cmd WLC_GET_MAGIC <= cmd < WLC_LAST + * @param buf buffer for passing in and/or receiving data + * @param len length of buf + * @return >= 0 if successful or < 0 otherwise + */ +extern int wl_ioctl(char *name, int cmd, void *buf, int len); + +/* + * Probe the specified interface. + * @param name interface name + * @return >= 0 if a Broadcom wireless device or < 0 otherwise + */ +extern int wl_probe(char *name); + +extern int wl_iovar_set(char *ifname, char *iovar, void *param, int paramlen); +extern int wl_iovar_get(char *ifname, char *iovar, void *bufptr, int buflen); +/* + * Set/Get named variable. + * @param ifname interface name + * @param iovar variable name + * @param param input param value/buffer + * @param paramlen input param value/buffer length + * @param bufptr io buffer + * @param buflen io buffer length + * @param val val or val pointer for int routines + * @return success == 0, failure != 0 + */ +/* + * set named driver variable to int value + * calling example: wl_iovar_setint(ifname, "arate", rate) +*/ +static inline int +wl_iovar_setint(char *ifname, char *iovar, int val) +{ + return wl_iovar_set(ifname, iovar, &val, sizeof(val)); +} + +/* + * get named driver variable to int value and return error indication + * calling example: wl_iovar_getint(ifname, "arate", &rate) + */ +static inline int +wl_iovar_getint(char *ifname, char *iovar, int *val) +{ + return wl_iovar_get(ifname, iovar, val, sizeof(int)); +} + +/* + * Set/Get named variable indexed by BSS Configuration + * @param ifname interface name + * @param iovar variable name + * @param bssidx bsscfg index + * @param param input param value/buffer + * @param paramlen input param value/buffer length + * @param bufptr io buffer + * @param buflen io buffer length + * @param val val or val pointer for int routines + * @return success == 0, failure != 0 + */ +extern int wl_bssiovar_get(char *ifname, char *iovar, int bssidx, void *outbuf, int len); +extern int wl_bssiovar_set(char *ifname, char *iovar, int bssidx, void *param, int paramlen); +/* + * set named & bss indexed driver variable to int value + */ +static inline int +wl_bssiovar_setint(char *ifname, char *iovar, int bssidx, int val) +{ + return wl_bssiovar_set(ifname, iovar, bssidx, &val, sizeof(int)); +} + +static inline int +wl_bssiovar_getint(char *ifname, char *iovar, int bssidx, int *val) +{ + return wl_bssiovar_get(ifname, iovar, bssidx, val, sizeof(int)); +} + +extern int wl_bssiovar_setint(char *ifname, char *iovar, int bssidx, int val); + +#endif /* _wlutils_h_ */ diff --git a/package/broadcom-wl/src/wlc/ioctl.c b/package/broadcom-wl/src/wlc/ioctl.c new file mode 100644 index 0000000000..6c676c7c9b --- /dev/null +++ b/package/broadcom-wl/src/wlc/ioctl.c @@ -0,0 +1,298 @@ +/* + * Wireless network adapter utilities + * + * Copyright 2006, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * + * $Id: wl.c,v 1.1.1.11 2006/02/27 03:43:20 honor Exp $ + */ +#include <stdio.h> +#include <unistd.h> +#include <string.h> +#include <errno.h> +#include <sys/ioctl.h> +#include <net/if.h> +#include <linux/types.h> + +typedef u_int64_t u64; +typedef u_int32_t u32; +typedef u_int16_t u16; +typedef u_int8_t u8; +#include <linux/sockios.h> +#include <linux/ethtool.h> + +#include <typedefs.h> +#include <wlioctl.h> +#include <bcmutils.h> +#include <wlutils.h> + +int +wl_ioctl(char *name, int cmd, void *buf, int len) +{ + struct ifreq ifr; + wl_ioctl_t ioc; + int ret = 0; + int s; + + /* open socket to kernel */ + if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { + perror("socket"); + return errno; + } + + /* do it */ + ioc.cmd = cmd; + ioc.buf = buf; + ioc.len = len; + strncpy(ifr.ifr_name, name, IFNAMSIZ); + ifr.ifr_data = (caddr_t) &ioc; + if ((ret = ioctl(s, SIOCDEVPRIVATE, &ifr)) < 0) + + /* cleanup */ + close(s); + return ret; +} + +static inline int +wl_get_dev_type(char *name, void *buf, int len) +{ + int s; + int ret; + struct ifreq ifr; + struct ethtool_drvinfo info; + + /* open socket to kernel */ + if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { + perror("socket"); + return -1; + } + + /* get device type */ + memset(&info, 0, sizeof(info)); + info.cmd = ETHTOOL_GDRVINFO; + ifr.ifr_data = (caddr_t)&info; + strncpy(ifr.ifr_name, name, IFNAMSIZ); + if ((ret = ioctl(s, SIOCETHTOOL, &ifr)) < 0) { + *(char *)buf = '\0'; + } else + strncpy(buf, info.driver, len); + + close(s); + return ret; +} + +int +wl_probe(char *name) +{ + int ret, val; + char buf[3]; + if ((ret = wl_get_dev_type(name, buf, 3)) < 0) + return ret; + /* Check interface */ + if (strncmp(buf, "wl", 2)) + return -1; + if ((ret = wl_ioctl(name, WLC_GET_VERSION, &val, sizeof(val)))) + return ret; + if (val > WLC_IOCTL_VERSION) + return -1; + + return ret; +} + +static int +wl_iovar_getbuf(char *ifname, char *iovar, void *param, int paramlen, void *bufptr, int buflen) +{ + int err; + uint namelen; + uint iolen; + + namelen = strlen(iovar) + 1; /* length of iovar name plus null */ + iolen = namelen + paramlen; + + /* check for overflow */ + if (iolen > buflen) + return (BCME_BUFTOOSHORT); + + memcpy(bufptr, iovar, namelen); /* copy iovar name including null */ + memcpy((int8*)bufptr + namelen, param, paramlen); + + err = wl_ioctl(ifname, WLC_GET_VAR, bufptr, buflen); + + return (err); +} + +static int +wl_iovar_setbuf(char *ifname, char *iovar, void *param, int paramlen, void *bufptr, int buflen) +{ + uint namelen; + uint iolen; + + namelen = strlen(iovar) + 1; /* length of iovar name plus null */ + iolen = namelen + paramlen; + + /* check for overflow */ + if (iolen > buflen) + return (BCME_BUFTOOSHORT); + + memcpy(bufptr, iovar, namelen); /* copy iovar name including null */ + memcpy((int8*)bufptr + namelen, param, paramlen); + + return wl_ioctl(ifname, WLC_SET_VAR, bufptr, iolen); +} + +int +wl_iovar_set(char *ifname, char *iovar, void *param, int paramlen) +{ + char smbuf[WLC_IOCTL_SMLEN]; + + return wl_iovar_setbuf(ifname, iovar, param, paramlen, smbuf, sizeof(smbuf)); +} + +int +wl_iovar_get(char *ifname, char *iovar, void *bufptr, int buflen) +{ + char smbuf[WLC_IOCTL_SMLEN]; + int ret; + + /* use the return buffer if it is bigger than what we have on the stack */ + if (buflen > sizeof(smbuf)) { + ret = wl_iovar_getbuf(ifname, iovar, NULL, 0, bufptr, buflen); + } else { + ret = wl_iovar_getbuf(ifname, iovar, NULL, 0, smbuf, sizeof(smbuf)); + if (ret == 0) + memcpy(bufptr, smbuf, buflen); + } + + return ret; +} + + +/* + * format a bsscfg indexed iovar buffer + */ +static int +wl_bssiovar_mkbuf(char *iovar, int bssidx, void *param, int paramlen, void *bufptr, int buflen, + int *plen) +{ + char *prefix = "bsscfg:"; + int8* p; + uint prefixlen; + uint namelen; + uint iolen; + + prefixlen = strlen(prefix); /* length of bsscfg prefix */ + namelen = strlen(iovar) + 1; /* length of iovar name + null */ + iolen = prefixlen + namelen + sizeof(int) + paramlen; + + /* check for overflow */ + if (buflen < 0 || iolen > (uint)buflen) { + *plen = 0; + return BCME_BUFTOOSHORT; + } + + p = (int8*)bufptr; + + /* copy prefix, no null */ + memcpy(p, prefix, prefixlen); + p += prefixlen; + + /* copy iovar name including null */ + memcpy(p, iovar, namelen); + p += namelen; + + /* bss config index as first param */ + memcpy(p, &bssidx, sizeof(int32)); + p += sizeof(int32); + + /* parameter buffer follows */ + if (paramlen) + memcpy(p, param, paramlen); + + *plen = iolen; + return 0; +} + +/* + * set named & bss indexed driver variable to buffer value + */ +static int +wl_bssiovar_setbuf(char *ifname, char *iovar, int bssidx, void *param, int paramlen, void *bufptr, + int buflen) +{ + int err; + int iolen; + + err = wl_bssiovar_mkbuf(iovar, bssidx, param, paramlen, bufptr, buflen, &iolen); + if (err) + return err; + + return wl_ioctl(ifname, WLC_SET_VAR, bufptr, iolen); +} + +/* + * get named & bss indexed driver variable buffer value + */ +static int +wl_bssiovar_getbuf(char *ifname, char *iovar, int bssidx, void *param, int paramlen, void *bufptr, + int buflen) +{ + int err; + int iolen; + + err = wl_bssiovar_mkbuf(iovar, bssidx, param, paramlen, bufptr, buflen, &iolen); + if (err) + return err; + + return wl_ioctl(ifname, WLC_GET_VAR, bufptr, buflen); +} + +/* + * set named & bss indexed driver variable to buffer value + */ +int +wl_bssiovar_set(char *ifname, char *iovar, int bssidx, void *param, int paramlen) +{ + char smbuf[WLC_IOCTL_SMLEN]; + + return wl_bssiovar_setbuf(ifname, iovar, bssidx, param, paramlen, smbuf, sizeof(smbuf)); +} + +/* + * get named & bss indexed driver variable buffer value + */ +int +wl_bssiovar_get(char *ifname, char *iovar, int bssidx, void *outbuf, int len) +{ + char smbuf[WLC_IOCTL_SMLEN]; + int err; + + /* use the return buffer if it is bigger than what we have on the stack */ + if (len > (int)sizeof(smbuf)) { + err = wl_bssiovar_getbuf(ifname, iovar, bssidx, NULL, 0, outbuf, len); + } else { + memset(smbuf, 0, sizeof(smbuf)); + err = wl_bssiovar_getbuf(ifname, iovar, bssidx, NULL, 0, smbuf, sizeof(smbuf)); + if (err == 0) + memcpy(outbuf, smbuf, len); + } + + return err; +} + +void +wl_printlasterror(char *name) +{ + char err_buf[WLC_IOCTL_SMLEN]; + strcpy(err_buf, "bcmerrstr"); + + fprintf(stderr, "Error: "); + if ( wl_ioctl(name, WLC_GET_VAR, err_buf, sizeof (err_buf)) != 0) + fprintf(stderr, "Error getting the Errorstring from driver\n"); + else + fprintf(stderr, err_buf); +} diff --git a/package/broadcom-wl/src/wlc/wlc.c b/package/broadcom-wl/src/wlc/wlc.c new file mode 100644 index 0000000000..09cbb84538 --- /dev/null +++ b/package/broadcom-wl/src/wlc/wlc.c @@ -0,0 +1,1140 @@ +/* + * wlc - Broadcom Wireless Driver Control Utility + * + * Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org> + * + * 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 the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <fcntl.h> +#include <glob.h> +#include <ctype.h> + +#include <typedefs.h> +#include <wlutils.h> +#include <proto/802.11.h> + +#define VERSION "0.1" +#define BUFSIZE 8192 +#define PTABLE_MAGIC 0xbadc0ded +#define PTABLE_SLT1 1 +#define PTABLE_SLT2 2 +#define PTABLE_ACKW 3 +#define PTABLE_ADHM 4 +#define PTABLE_END 0xffffffff + +/* + * Copy each token in wordlist delimited by space into word + * Taken from Broadcom shutils.h + */ +#define foreach(word, wordlist, next) \ + for (next = &wordlist[strspn(wordlist, " ")], \ + strncpy(word, next, sizeof(word)), \ + word[strcspn(word, " ")] = '\0', \ + word[sizeof(word) - 1] = '\0', \ + next = strchr(next, ' '); \ + strlen(word); \ + next = next ? &next[strspn(next, " ")] : "", \ + strncpy(word, next, sizeof(word)), \ + word[strcspn(word, " ")] = '\0', \ + word[sizeof(word) - 1] = '\0', \ + next = strchr(next, ' ')) + +static char wlbuf[8192]; +static char interface[16] = "wl0"; +static unsigned long ptable[128]; +static unsigned long kmem_offset = 0; +static int vif = 0, debug = 1, fromstdin = 0; + +typedef enum { + NONE = 0x00, + + /* types */ + PARAM_TYPE = 0x00f, + INT = 0x001, + STRING = 0x002, + + /* options */ + PARAM_OPTIONS = 0x0f0, + NOARG = 0x010, + + /* modes */ + PARAM_MODE = 0xf00, + GET = 0x100, + SET = 0x200, +} wlc_param; + +struct wlc_call { + const char *name; + wlc_param param; + int (*handler)(wlc_param param, void *data, void *value); + union { + int num; + char *str; + void *ptr; + } data; + const char *desc; +}; + +/* can't use the system include because of the stupid broadcom header files */ +extern struct ether_addr *ether_aton(const char *asc); +extern char *ether_ntoa(const struct ether_addr *addr); + +/* + * find the starting point of wl.o in memory + * by reading /proc/ksyms + */ +static inline void wlc_get_mem_offset(void) +{ + FILE *f; + char s[64]; + + /* yes, i'm lazy ;) */ + f = popen("grep '\\[wl]' /proc/ksyms | sort", "r"); + if (fgets(s, 64, f) == 0) + return; + + pclose(f); + + s[8] = 0; + kmem_offset = strtoul(s, NULL, 16); + + /* sanity check */ + if (kmem_offset < 0xc0000000) + kmem_offset = 0; +} + + +static int ptable_init(void) +{ + glob_t globbuf; + struct stat statbuf; + int fd; + + if (ptable[0] == PTABLE_MAGIC) + return 0; + + glob("/lib/modules/2.4.*/wl.o.patch", 0, NULL, &globbuf); + + if (globbuf.gl_pathv[0] == NULL) + return -1; + + if ((fd = open(globbuf.gl_pathv[0], O_RDONLY)) < 0) + return -1; + + if (fstat(fd, &statbuf) < 0) + goto failed; + + if (statbuf.st_size < 512) + goto failed; + + if (read(fd, ptable, 512) < 512) + goto failed; + + if (ptable[0] != PTABLE_MAGIC) + goto failed; + + close(fd); + + wlc_get_mem_offset(); + if (kmem_offset == 0) + return -1; + + return 0; + +failed: + close(fd); + + return -1; +} + +static inline unsigned long wlc_kmem_read(unsigned long offset) +{ + int fd; + unsigned long ret; + + if ((fd = open("/dev/kmem", O_RDONLY )) < 0) + return -1; + + lseek(fd, 0x70000000, SEEK_SET); + lseek(fd, (kmem_offset - 0x70000000) + offset, SEEK_CUR); + read(fd, &ret, 4); + close(fd); + + return ret; +} + +static inline void wlc_kmem_write(unsigned long offset, unsigned long value) +{ + int fd; + + if ((fd = open("/dev/kmem", O_WRONLY )) < 0) + return; + + lseek(fd, 0x70000000, SEEK_SET); + lseek(fd, (kmem_offset - 0x70000000) + offset, SEEK_CUR); + write(fd, &value, 4); + close(fd); +} + +static int wlc_patcher_getval(unsigned long key, unsigned long *val) +{ + unsigned long *pt = &ptable[1]; + unsigned long tmp; + + if (ptable_init() < 0) { + fprintf(stderr, "Could not load the ptable\n"); + return -1; + } + + while (*pt != PTABLE_END) { + if (*pt == key) { + tmp = wlc_kmem_read(pt[1]); + + if (tmp == pt[2]) + *val = 0xffffffff; + else + *val = tmp; + + return 0; + } + pt += 3; + } + + return -1; +} + +static int wlc_patcher_setval(unsigned long key, unsigned long val) +{ + unsigned long *pt = &ptable[1]; + + if (ptable_init() < 0) { + fprintf(stderr, "Could not load the ptable\n"); + return -1; + } + + if (val != 0xffffffff) + val = (pt[2] & ~(0xffff)) | (val & 0xffff); + + while (*pt != PTABLE_END) { + if (*pt == key) { + if (val == 0xffffffff) /* default */ + val = pt[2]; + + wlc_kmem_write(pt[1], val); + } + pt += 3; + } + + return 0; +} + +static int wlc_slottime(wlc_param param, void *data, void *value) +{ + int *val = (int *) value; + int ret = 0; + + if ((param & PARAM_MODE) == SET) { + wlc_patcher_setval(PTABLE_SLT1, *val); + wlc_patcher_setval(PTABLE_SLT2, ((*val == -1) ? *val : *val + 510)); + } else if ((param & PARAM_MODE) == GET) { + ret = wlc_patcher_getval(PTABLE_SLT1, (unsigned long *) val); + if (*val != 0xffffffff) + *val &= 0xffff; + } + + return ret; +} + +static int wlc_noack(wlc_param param, void *data, void *value) +{ + int *val = (int *) value; + int ret = 0; + + if ((param & PARAM_MODE) == SET) { + wlc_patcher_setval(PTABLE_ACKW, ((*val) ? 1 : 0)); + } else if ((param & PARAM_MODE) == GET) { + ret = wlc_patcher_getval(PTABLE_ACKW, (unsigned long *) val); + *val &= 0xffff; + *val = (*val ? 1 : 0); + } + + return ret; +} + +static int wlc_ibss_merge(wlc_param param, void *data, void *value) +{ + int *val = (int *) value; + int ret = 0; + + if ((param & PARAM_MODE) == SET) { + /* overwrite the instruction with 'lui v0,0x0' - fake a return + * status of 0 for wlc_bcn_tsf_later */ + wlc_patcher_setval(PTABLE_ACKW, ((*val) ? -1 : 0x3c020000)); + } else if ((param & PARAM_MODE) == GET) { + ret = wlc_patcher_getval(PTABLE_ACKW, (unsigned long *) val); + *val = ((*val == -1) ? 1 : 0); + } + + return ret; +} + +static int wlc_ioctl(wlc_param param, void *data, void *value) +{ + unsigned int *var = ((unsigned int *) data); + unsigned int ioc = *var; + + if (param & NOARG) { + return wl_ioctl(interface, ioc, NULL, 0); + } + switch(param & PARAM_TYPE) { + case INT: + return wl_ioctl(interface, ((param & SET) ? (ioc) : (ioc >> 16)) & 0xffff, value, sizeof(int)); + case STRING: + return wl_ioctl(interface, ((param & SET) ? (ioc) : (ioc >> 16)) & 0xffff, value, BUFSIZE); + } + return 0; +} + +static int wlc_iovar(wlc_param param, void *data, void *value) +{ + int *val = (int *) value; + char *iov = *((char **) data); + int ret = 0; + + if (param & SET) { + switch(param & PARAM_TYPE) { + case INT: + ret = wl_iovar_setint(interface, iov, *val); + } + } + if (param & GET) { + switch(param & PARAM_TYPE) { + case INT: + ret = wl_iovar_getint(interface, iov, val); + } + } + + return ret; +} + +static int wlc_bssiovar(wlc_param param, void *data, void *value) +{ + int *val = (int *) value; + char *iov = *((char **) data); + int ret = 0; + + if (param & SET) { + switch(param & PARAM_TYPE) { + case INT: + ret = wl_bssiovar_setint(interface, iov, vif, *val); + } + } + if (param & GET) { + switch(param & PARAM_TYPE) { + case INT: + ret = wl_bssiovar_getint(interface, iov, vif, val); + } + } + + return ret; +} + +static int wlc_vif_enabled(wlc_param param, void *data, void *value) +{ + int *val = (int *) value; + int buf[3]; + int ret = 0; + + sprintf((char *) buf, "bss"); + buf[1] = vif; + if (param & SET) { + buf[2] = (*val ? 1 : 0); + ret = wl_ioctl(interface, WLC_SET_VAR, buf, sizeof(buf)); + } else if (param & GET) { + ret = wl_ioctl(interface, WLC_GET_VAR, buf, sizeof(buf)); + *val = buf[0]; + } + + return ret; +} + +static int wlc_ssid(wlc_param param, void *data, void *value) +{ + int ret = -1, ret2 = -1; + char *dest = (char *) value; + wlc_ssid_t ssid; + + if ((param & PARAM_MODE) == GET) { + ret = wl_bssiovar_get(interface, "ssid", vif, &ssid, sizeof(ssid)); + + if (ret) + /* if we can't get the ssid through the bssiovar, try WLC_GET_SSID */ + ret = wl_ioctl(interface, WLC_GET_SSID, &ssid, sizeof(ssid)); + + if (!ret) { + memcpy(dest, ssid.SSID, ssid.SSID_len); + dest[ssid.SSID_len] = 0; + } + } else if ((param & PARAM_MODE) == SET) { + strncpy(ssid.SSID, value, 32); + ssid.SSID_len = strlen(value); + + if (ssid.SSID_len > 32) + ssid.SSID_len = 32; + + if (vif == 0) { + /* for the main interface, also try the WLC_SET_SSID call */ + ret2 = wl_ioctl(interface, WLC_SET_SSID, &ssid, sizeof(ssid)); + } + + ret = wl_bssiovar_set(interface, "ssid", vif, &ssid, sizeof(ssid)); + ret = (!ret2 ? 0 : ret); + } + + return ret; +} + +static int wlc_int(wlc_param param, void *data, void *value) +{ + int *var = *((int **) data); + int *val = (int *) value; + + if ((param & PARAM_MODE) == SET) { + *var = *val; + } else if ((param & PARAM_MODE) == GET) { + *val = *var; + } + + return 0; +} + +static int wlc_flag(wlc_param param, void *data, void *value) +{ + int *var = *((int **) data); + + *var = 1; + + return 0; +} + +static int wlc_string(wlc_param param, void *data, void *value) +{ + char *var = *((char **) data); + + if ((param & PARAM_MODE) == GET) { + strcpy(value, var); + } + + return 0; +} + +static int wlc_afterburner(wlc_param param, void *data, void *value) +{ + int *val = (int *) value; + int ret = 0; + + if ((param & PARAM_MODE) == GET) { + ret = wl_iovar_getint(interface, "afterburner", val); + } else { + wl_iovar_setint(interface, "wlfeatureflag", (*val ? 3 : 0)); + ret = wl_iovar_setint(interface, "afterburner", (*val ? 1 : 0)); + wl_iovar_setint(interface, "afterburner_override", *val); + } + + return ret; +} + +static int wlc_maclist(wlc_param param, void *data, void *value) +{ + unsigned int *var = ((unsigned int *) data); + unsigned int ioc = *var; + int limit = (sizeof(wlbuf) - 4) / sizeof(struct ether_addr); + struct maclist *list = (struct maclist *) wlbuf; + char *str = (char *) value; + char astr[30], *p; + struct ether_addr *addr; + int isset = 0; + int ret; + + if ((param & PARAM_MODE) == GET) { + list->count = limit; + ret = wl_ioctl(interface, (ioc >> 16) & 0xffff, wlbuf, sizeof(wlbuf)); + + if (!ret) + while (list->count) + str += sprintf(str, "%s%s", ((((char *) value) == str) ? "" : " "), ether_ntoa(&list->ea[list->count-- - 1])); + + return ret; + } else { + while (*str && isspace(*str)) + *str++; + + if (*str == '+') { + str++; + + list->count = limit; + if (wl_ioctl(interface, (ioc >> 16) & 0xffff, wlbuf, sizeof(wlbuf)) == 0) + isset = 1; + + while (*str && isspace(*str)) + str++; + } + + if (!isset) + memset(wlbuf, 0, sizeof(wlbuf)); + + foreach(astr, str, p) { + if (list->count >= limit) + break; + + if ((addr = ether_aton(astr)) != NULL) + memcpy(&list->ea[list->count++], addr, sizeof(struct ether_addr)); + } + + return wl_ioctl(interface, ioc & 0xffff, wlbuf, sizeof(wlbuf)); + } +} + +static int wlc_radio(wlc_param param, void *data, void *value) +{ + int *val = (int *) value; + int ret; + + if ((param & PARAM_MODE) == GET) { + ret = wl_ioctl(interface, WLC_GET_RADIO, val, sizeof(int)); + *val = ((*val & 1) ? 0 : 1); + } else { + *val = (1 << 16) | (*val ? 0 : 1); + ret = wl_ioctl(interface, WLC_SET_RADIO, val, sizeof(int)); + } + + return ret; +} + +static int wlc_wsec_key(wlc_param param, void *null, void *value) +{ + wl_wsec_key_t wsec_key; + unsigned char *index = value; + unsigned char *key; + unsigned char *data; + unsigned char hex[3]; + + if ((param & PARAM_MODE) != SET) + return 0; + + memset(&wsec_key, 0, sizeof(wsec_key)); + if (index[0] == '=') { + wsec_key.flags = WL_PRIMARY_KEY; + index++; + } + + if ((index[0] < '1') || (index[0] > '4') || (index[1] != ',')) + return -1; + + key = index + 2; + if (strncmp(key, "d:", 2) == 0) { /* delete key */ + } else if (strncmp(key, "s:", 2) == 0) { /* ascii key */ + key += 2; + wsec_key.len = strlen(key); + + if ((wsec_key.len != 5) && (wsec_key.len != 13)) + return -1; + + strcpy(wsec_key.data, key); + } else { /* hex key */ + wsec_key.len = strlen(key); + if ((wsec_key.len != 10) && (wsec_key.len != 26)) + return -1; + + wsec_key.len /= 2; + data = wsec_key.data; + hex[2] = 0; + do { + hex[0] = *(key++); + hex[1] = *(key++); + *(data++) = (unsigned char) strtoul(hex, NULL, 16); + } while (*key != 0); + } + + return wl_bssiovar_set(interface, "wsec_key", vif, &wsec_key, sizeof(wsec_key)); +} + +static inline int cw2ecw(int cw) +{ + int i; + for (cw++, i = 0; cw; i++) cw >>=1; + return i - 1; +} + +static int wlc_wme_ac(wlc_param param, void *data, void *value) +{ + char *type = *((char **) data); + char *settings = (char *) value; + char cmd[100], *p, *val; + edcf_acparam_t params[AC_COUNT]; + int ret; + int intval; + int cur = -1; + char *buf = wlbuf; + + if ((param & PARAM_MODE) != SET) + return -1; + + memset(params, 0, sizeof(params)); + ret = wl_iovar_get(interface, type, params, sizeof(params)); + memset(buf, 0, BUFSIZE); + strcpy(buf, type); + buf += strlen(buf) + 1; + + foreach(cmd, settings, p) { + val = strchr(cmd, '='); + if (val == NULL) { + if (strcmp(cmd, "be") == 0) + cur = AC_BE; + else if (strcmp(cmd, "bk") == 0) + cur = AC_BK; + else if (strcmp(cmd, "vi") == 0) + cur = AC_VI; + else if (strcmp(cmd, "vo") == 0) + cur = AC_VO; + else + return -1; + + /* just in case */ + params[cur].ACI = (params[cur].ACI & (0x3 << 5)) | (cur << 5); + } else { + *(val++) = 0; + + intval = strtoul(val, NULL, 10); + if (strcmp(cmd, "cwmin") == 0) + params[cur].ECW = (params[cur].ECW & ~(0xf)) | cw2ecw(intval); + else if (strcmp(cmd, "ecwmin") == 0) + params[cur].ECW = (params[cur].ECW & ~(0xf)) | (intval & 0xf); + else if (strcmp(cmd, "cwmax") == 0) + params[cur].ECW = (params[cur].ECW & ~(0xf << 4)) | (cw2ecw(intval) << 4); + else if (strcmp(cmd, "ecwmax") == 0) + params[cur].ECW = (params[cur].ECW & ~(0xf << 4)) | ((intval & 0xf) << 4); + else if (strcmp(cmd, "aifsn") == 0) + params[cur].ACI = (params[cur].ACI & ~(0xf)) | (intval & 0xf); + else if (strcmp(cmd, "txop") == 0) + params[cur].TXOP = intval >> 5; + else if (strcmp(cmd, "force") == 0) + params[cur].ACI = (params[cur].ACI & ~(1 << 4)) | ((intval) ? (1 << 4) : 0); + else return -1; + + memcpy(buf, ¶ms[cur], sizeof(edcf_acparam_t)); + wl_ioctl(interface, WLC_SET_VAR, wlbuf, BUFSIZE); + } + } + return ret; +} + +static const struct wlc_call wlc_calls[] = { + { + .name = "version", + .param = STRING|NOARG, + .handler = wlc_string, + .data.str = VERSION, + .desc = "Version of this program" + }, + { + .name = "debug", + .param = INT, + .handler = wlc_int, + .data.ptr = &debug, + .desc = "wlc debug level" + }, + { + .name = "stdin", + .param = NOARG, + .handler = wlc_flag, + .data.ptr = &fromstdin, + .desc = "Accept input from stdin" + }, + { + .name = "up", + .param = NOARG, + .handler = wlc_ioctl, + .data.num = WLC_UP, + .desc = "Bring the interface up" + }, + { + .name = "down", + .param = NOARG, + .handler = wlc_ioctl, + .data.num = WLC_DOWN, + .desc = "Bring the interface down" + }, + { + .name = "radio", + .param = INT, + .handler = wlc_radio, + .desc = "Radio enabled flag" + }, + { + .name = "ap", + .param = INT, + .handler = wlc_ioctl, + .data.num = ((WLC_GET_AP << 16) | WLC_SET_AP), + .desc = "Access Point mode" + }, + { + .name = "mssid", + .param = INT, + .handler = wlc_iovar, + .data.str = "mssid", + .desc = "Multi-ssid mode" + }, + { + .name = "apsta", + .param = INT, + .handler = wlc_iovar, + .data.str = "apsta", + .desc = "AP+STA mode" + }, + { + .name = "infra", + .param = INT, + .handler = wlc_ioctl, + .data.num = ((WLC_GET_INFRA << 16) | WLC_SET_INFRA), + .desc = "Infrastructure mode" + }, + { + .name = "wet", + .param = INT, + .handler = wlc_ioctl, + .data.num = ((WLC_GET_WET << 16) | WLC_SET_WET), + .desc = "Wireless repeater mode", + }, + { + .name = "statimeout", + .param = INT, + .handler = wlc_iovar, + .data.str = "sta_retry_time", + .desc = "STA connection timeout" + }, + { + .name = "country", + .param = STRING, + .handler = wlc_ioctl, + .data.num = ((WLC_GET_COUNTRY << 16) | WLC_SET_COUNTRY), + .desc = "Country code" + }, + { + .name = "channel", + .param = INT, + .handler = wlc_ioctl, + .data.num = ((WLC_GET_CHANNEL << 16) | WLC_SET_CHANNEL), + .desc = "Channel", + }, + { + .name = "vlan_mode", + .param = INT, + .handler = wlc_bssiovar, + .data.str = "vlan_mode", + .desc = "Parse 802.1Q tags", + }, + { + .name = "vif", + .param = INT, + .handler = wlc_int, + .data.ptr = &vif, + .desc = "Current vif index" + }, + { + .name = "enabled", + .param = INT, + .handler = wlc_vif_enabled, + .desc = "vif enabled flag" + }, + { + .name = "ssid", + .param = STRING, + .handler = wlc_ssid, + .desc = "Interface ESSID" + }, + { + .name = "closed", + .param = INT, + .handler = wlc_bssiovar, + .data.str = "closednet", + .desc = "Hidden ESSID flag" + }, + { + .name = "wsec", + .param = INT, + .handler = wlc_bssiovar, + .data.str = "wsec", + .desc = "Security mode flags" + }, + { + .name = "wepkey", + .param = STRING, + .handler = wlc_wsec_key, + .desc = "Set/Remove WEP keys" + }, + { + .name = "wsec_restrict", + .param = INT, + .handler = wlc_bssiovar, + .data.str = "wsec_restrict", + .desc = "Drop unencrypted traffic" + }, + { + .name = "eap_restrict", + .param = INT, + .handler = wlc_bssiovar, + .data.str = "eap_restrict", + .desc = "Only allow 802.1X traffic until 802.1X authorized" + }, + { + .name = "wpa_auth", + .param = INT, + .handler = wlc_bssiovar, + .data.str = "wpa_auth", + .desc = "WPA authentication modes" + }, + { + .name = "ap_isolate", + .param = INT, + .handler = wlc_bssiovar, + .data.str = "ap_isolate", + .desc = "Isolate connected clients" + }, + { + .name = "supplicant", + .param = INT, + .handler = wlc_iovar, + .data.str = "sup_wpa", + .desc = "Built-in WPA supplicant" + }, + { + .name = "maxassoc", + .param = INT, + .handler = wlc_iovar, + .data.str = "maxassoc", + .desc = "Max. number of associated clients", + }, + { + .name = "wme", + .param = INT, + .handler = wlc_iovar, + .data.str = "wme", + .desc = "WME enabled" + }, + { + .name = "wme_ac_ap", + .param = STRING, + .handler = wlc_wme_ac, + .data.str = "wme_ac_ap", + .desc = "Set WME AC options for AP mode", + }, + { + .name = "wme_ac_sta", + .param = STRING, + .handler = wlc_wme_ac, + .data.str = "wme_ac_sta", + .desc = "Set WME AC options for STA mode", + }, + { + .name = "wme_noack", + .param = INT, + .handler = wlc_iovar, + .data.str = "wme_noack", + .desc = "WME ACK disable request", + }, + { + .name = "fragthresh", + .param = INT, + .handler = wlc_iovar, + .data.str = "fragthresh", + .desc = "Fragmentation threshold", + }, + { + .name = "rtsthresh", + .param = INT, + .handler = wlc_iovar, + .data.str = "rtsthresh", + .desc = "RTS threshold" + }, + { + .name = "rxant", + .param = INT, + .handler = wlc_ioctl, + .data.num = ((WLC_GET_ANTDIV << 16) | WLC_SET_ANTDIV), + .desc = "Rx antenna selection" + }, + { + .name = "txant", + .param = INT, + .handler = wlc_ioctl, + .data.num = ((WLC_GET_TXANT << 16) | WLC_SET_TXANT), + .desc = "Tx antenna selection" + }, + { + .name = "dtim", + .param = INT, + .handler = wlc_ioctl, + .data.num = ((WLC_GET_DTIMPRD << 16) | WLC_SET_DTIMPRD), + .desc = "DTIM period", + }, + { + .name = "bcn", + .param = INT, + .handler = wlc_ioctl, + .data.num = ((WLC_GET_BCNPRD << 16) | WLC_SET_BCNPRD), + .desc = "Beacon interval" + }, + { + .name = "frameburst", + .param = INT, + .handler = wlc_ioctl, + .data.num = ((WLC_GET_FAKEFRAG << 16) | WLC_SET_FAKEFRAG), + .desc = "Framebursting" + }, + { + .name = "monitor", + .param = INT, + .handler = wlc_ioctl, + .data.num = ((WLC_GET_MONITOR << 16) | WLC_SET_MONITOR), + .desc = "Monitor mode" + }, + { + .name = "passive", + .param = INT, + .handler = wlc_ioctl, + .data.num = ((WLC_GET_PASSIVE << 16) | WLC_SET_PASSIVE), + .desc = "Passive mode" + }, + { + .name = "macfilter", + .param = INT, + .handler = wlc_ioctl, + .data.num = ((WLC_GET_MACMODE << 16) | WLC_SET_MACMODE), + .desc = "MAC filter mode (0:disabled, 1:deny, 2:allow)" + }, + { + .name = "maclist", + .param = STRING, + .data.num = ((WLC_GET_MACLIST << 16) | WLC_SET_MACLIST), + .handler = wlc_maclist, + .desc = "MAC filter list" + }, + { + .name = "autowds", + .param = INT, + .handler = wlc_ioctl, + .data.num = ((WLC_GET_LAZYWDS << 16) | WLC_SET_LAZYWDS), + .desc = "Automatic WDS" + }, + { + .name = "wds", + .param = STRING, + .data.num = ((WLC_GET_WDSLIST << 16) | WLC_SET_WDSLIST), + .handler = wlc_maclist, + .desc = "WDS connection list" + }, + { + .name = "wdstimeout", + .param = INT, + .handler = wlc_iovar, + .data.str = "wdstimeout", + .desc = "WDS link detection timeout" + }, + { + .name = "afterburner", + .param = INT, + .handler = wlc_afterburner, + .desc = "Broadcom Afterburner" + }, + { + .name = "slottime", + .param = INT, + .handler = wlc_slottime, + .desc = "Slot time (-1 = auto)" + }, + { + .name = "txack", + .param = INT, + .handler = wlc_noack, + .desc = "Tx ACK enabled flag" + }, + { + .name = "ibss_merge", + .param = INT, + .handler = wlc_ibss_merge, + .desc = "Allow IBSS merge in Ad-Hoc mode" + } +}; +#define wlc_calls_size (sizeof(wlc_calls) / sizeof(struct wlc_call)) + +static void usage(char *cmd) +{ + int i; + fprintf(stderr, "Usage: %s <command> [<argument> ...]\n" + "\n" + "Available commands:\n", cmd); + for (i = 0; i < wlc_calls_size; i++) { + fprintf(stderr, "\t%-16s\t%s\n", wlc_calls[i].name ?: "", wlc_calls[i].desc ?: ""); + } + fprintf(stderr, "\n"); + exit(1); +} + +static int do_command(const struct wlc_call *cmd, char *arg) +{ + static char buf[BUFSIZE]; + int set; + int ret = 0; + char *format, *end; + int intval; + + if (debug >= 10) { + fprintf(stderr, "do_command %-16s\t'%s'\n", cmd->name, arg); + } + + if ((arg == NULL) && ((cmd->param & PARAM_TYPE) != NONE)) { + set = 0; + ret = cmd->handler(cmd->param | GET, (void *) &cmd->data, (void *) buf); + if (ret == 0) { + switch(cmd->param & PARAM_TYPE) { + case INT: + intval = *((int *) buf); + + if (intval > 65535) + format = "0x%08x\n"; + else if (intval > 255) + format = "0x%04x\n"; + else + format = "%d\n"; + + fprintf(stdout, format, intval); + break; + case STRING: + fprintf(stdout, "%s\n", buf); + } + } + } else { /* SET */ + set = 1; + switch(cmd->param & PARAM_TYPE) { + case INT: + intval = strtoul(arg, &end, 10); + if (end && !(*end)) { + memcpy(buf, &intval, sizeof(intval)); + } else { + fprintf(stderr, "%s: Invalid argument\n", cmd->name); + return -1; + } + break; + case STRING: + strncpy(buf, arg, BUFSIZE); + buf[BUFSIZE - 1] = 0; + } + + ret = cmd->handler(cmd->param | SET, (void *) &cmd->data, (void *) buf); + } + + if ((debug > 0) && (ret != 0)) + fprintf(stderr, "Command '%s %s' failed: %d\n", (set == 1 ? "set" : "get"), cmd->name, ret); + + return ret; +} + +static struct wlc_call *find_cmd(char *name) +{ + int found = 0, i = 0; + + while (!found && (i < wlc_calls_size)) { + if (strcmp(name, wlc_calls[i].name) == 0) + found = 1; + else + i++; + } + + return (struct wlc_call *) (found ? &wlc_calls[i] : NULL); +} + +int main(int argc, char **argv) +{ + static char buf[BUFSIZE]; + char *s, *s2; + char *cmd = argv[0]; + struct wlc_call *call; + int ret = 0; + + if (argc < 2) + usage(argv[0]); + + for(interface[2] = '0'; (interface[2] < '3') && (wl_probe(interface) != 0); interface[2]++); + if (interface[2] == '3') { + fprintf(stderr, "No Broadcom wl interface found!\n"); + return -1; + } + + argv++; + argc--; + while ((argc > 0) && (argv[0] != NULL)) { + if ((call = find_cmd(argv[0])) == NULL) { + fprintf(stderr, "Invalid command: %s\n\n", argv[0]); + usage(cmd); + } + if ((argc > 1) && (!(call->param & NOARG))) { + ret = do_command(call, argv[1]); + argv += 2; + argc -= 2; + } else { + ret = do_command(call, NULL); + argv++; + argc--; + } + } + + while (fromstdin && !feof(stdin)) { + *buf = 0; + fgets(buf, BUFSIZE - 1, stdin); + + if (*buf == 0) + continue; + + if ((s = strchr(buf, '\r')) != NULL) + *s = 0; + if ((s = strchr(buf, '\n')) != NULL) + *s = 0; + + s = buf; + while (isspace(*s)) + s++; + + if (!*s) + continue; + + if ((s2 = strchr(buf, ' ')) != NULL) + *(s2++) = 0; + + while (s2 && isspace(*s2)) + s2++; + + if ((call = find_cmd(buf)) == NULL) { + fprintf(stderr, "Invalid command: %s\n", buf); + ret = -1; + } else + ret = do_command(call, ((call->param & NOARG) ? NULL : s2)); + } + + return ret; +} diff --git a/package/busybox/Makefile b/package/busybox/Makefile new file mode 100644 index 0000000000..05174a32bd --- /dev/null +++ b/package/busybox/Makefile @@ -0,0 +1,73 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=busybox +PKG_VERSION:=1.2.1 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=http://www.busybox.net/downloads +PKG_MD5SUM:=362b3dc0f2023ddfda901dc1f1a74391 +PKG_CAT:=bzcat + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/busybox + SECTION:=base + CATEGORY:=Base system + DEFAULT:=y + TITLE:=Core utilities for embedded Linux + URL:=http://busybox.net/ + MENU:=1 +endef + +define Package/busybox/description +The Swiss Army Knife of embedded Linux. + It slices, it dices, it makes Julian Fries. +endef + +define Package/busybox/config + menu "Configuration" + depends on PACKAGE_busybox + source "$(SOURCE)/config/Config.in" + endmenu +endef + +define Build/Configure + $(SCRIPT_DIR)/gen_busybox_config.pl $(TOPDIR)/.config > $(PKG_BUILD_DIR)/.config + yes '' | $(MAKE) -C $(PKG_BUILD_DIR) \ + CC="$(TARGET_CC)" \ + CROSS="$(TARGET_CROSS)" \ + oldconfig +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + CC="$(TARGET_CC)" \ + CROSS="$(TARGET_CROSS)" \ + EXTRA_CFLAGS="$(TARGET_CFLAGS)" \ + IPKG_ARCH="$(ARCH)" \ + all +endef + +define Package/busybox/install + $(MAKE) -C $(PKG_BUILD_DIR) \ + CC="$(TARGET_CC)" \ + CROSS="$(TARGET_CROSS)" \ + EXTRA_CFLAGS="$(TARGET_CFLAGS)" \ + IPKG_ARCH="$(ARCH)" \ + PREFIX="$(1)" \ + install + -rm -rf $(1)/lib64 +endef + +$(eval $(call BuildPackage,busybox)) diff --git a/package/busybox/config/Config.in b/package/busybox/config/Config.in new file mode 100644 index 0000000000..6a5d6a74d1 --- /dev/null +++ b/package/busybox/config/Config.in @@ -0,0 +1,474 @@ +# +# For a description of the syntax of this configuration file, +# see scripts/kbuild/config-language.txt. +# + + +config BUSYBOX_HAVE_DOT_CONFIG + bool + default y + +menu "Busybox Settings" + +menu "General Configuration" + +config BUSYBOX_CONFIG_NITPICK + bool "See lots more (probably unnecessary) configuration options." + default n + help + Some BusyBox applets have more configuration options than anyone + will ever care about. To avoid drowining people in complexity, most + of the applet features that can be set to a sane default value are + hidden, unless you hit the above switch. + + This is better than to telling people to edit the busybox source + code, but not by much. + + See http://en.wikipedia.org/wiki/Fibber_McGee_and_Molly#The_Closet + + You have been warned. + +choice + prompt "Buffer allocation policy" + default BUSYBOX_CONFIG_FEATURE_BUFFERS_GO_ON_STACK + depends on BUSYBOX_CONFIG_NITPICK + help + There are 3 ways BusyBox can handle buffer allocations: + - Use malloc. This costs code size for the call to xmalloc. + - Put them on stack. For some very small machines with limited stack + space, this can be deadly. For most folks, this works just fine. + - Put them in BSS. This works beautifully for computers with a real + MMU (and OS support), but wastes runtime RAM for uCLinux. This + behavior was the only one available for BusyBox versions 0.48 and + earlier. + +config BUSYBOX_CONFIG_FEATURE_BUFFERS_USE_MALLOC + bool "Allocate with Malloc" + +config BUSYBOX_CONFIG_FEATURE_BUFFERS_GO_ON_STACK + bool "Allocate on the Stack" + +config BUSYBOX_CONFIG_FEATURE_BUFFERS_GO_IN_BSS + bool "Allocate in the .bss section" + +endchoice + +config BUSYBOX_CONFIG_SHOW_USAGE + bool "Show terse applet usage messages" + default y + help + All BusyBox applets will show help messages when invoked with + wrong arguments. You can turn off printing these terse usage + messages if you say no here. + This will save you up to 7k. + +config BUSYBOX_CONFIG_FEATURE_VERBOSE_USAGE + bool "Show verbose applet usage messages" + default y + select BUSYBOX_CONFIG_SHOW_USAGE + help + All BusyBox applets will show more verbose help messages when + busybox is invoked with --help. This will add a lot of text to the + busybox binary. In the default configuration, this will add about + 13k, but it can add much more depending on your configuration. + +config BUSYBOX_CONFIG_FEATURE_COMPRESS_USAGE + bool "Store applet usage messages in compressed form" + default n + depends on BUSYBOX_CONFIG_SHOW_USAGE && BUSYBOX_CONFIG_NITPICK + help + Store usage messages in compressed form, uncompress them on-the-fly + when <applet> --help is called. + + If you have a really tiny busybox with few applets enabled (and + bunzip2 isn't one of them), the overhead of the decompressor might + be noticeable. Also, if you run executables directly from ROM + and have very little memory, this might not be a win. Otherwise, + you probably want this. + +config BUSYBOX_CONFIG_FEATURE_INSTALLER + bool "Support --install [-s] to install applet links at runtime" + default n + help + Enable 'busybox --install [-s]' support. This will allow you to use + busybox at runtime to create hard links or symlinks for all the + applets that are compiled into busybox. This feature requires the + /proc filesystem. + +config BUSYBOX_CONFIG_LOCALE_SUPPORT + bool "Enable locale support (system needs locale for this to work)" + default n + help + Enable this if your system has locale support and you would like + busybox to support locale settings. + +config BUSYBOX_CONFIG_GETOPT_LONG + bool + default y +# bool "Enable support for --long-options" +# default n +# help +# Enable this if you want busybox applets to use the gnu --long-option +# style, in addition to single character -a -b -c style options. + +config BUSYBOX_CONFIG_FEATURE_DEVPTS + bool "Use the devpts filesystem for Unix98 PTYs" + default y + help + Enable if you want BusyBox to use Unix98 PTY support. If enabled, + busybox will use /dev/ptmx for the master side of the pseudoterminal + and /dev/pts/<number> for the slave side. Otherwise, BSD style + /dev/ttyp<number> will be used. To use this option, you should have + devpts mounted. + +config BUSYBOX_CONFIG_FEATURE_CLEAN_UP + bool "Clean up all memory before exiting (usually not needed)" + default n + depends on BUSYBOX_CONFIG_NITPICK + help + As a size optimization, busybox normally exits without explicitly + freeing dynamically allocated memory or closing files. This saves + space since the OS will clean up for us, but it can confuse debuggers + like valgrind, which report tons of memory and resource leaks. + + Don't enable this unless you have a really good reason to clean + things up manually. + +config BUSYBOX_CONFIG_FEATURE_SUID + bool "Support for SUID/SGID handling" + default y + help + With this option you can install the busybox binary belonging + to root with the suid bit set, and it'll and it'll automatically drop + priviledges for applets that don't need root access. + + If you're really paranoid and don't want to do this, build two + busybox binaries with different applets in them (and the appropriate + symlinks pointing to each binary), and only set the suid bit on the + one that needs it. The applets currently marked to need the suid bit + are login, passwd, su, ping, traceroute, crontab, dnsd, ipcrm, ipcs, + and vlock. + +config BUSYBOX_CONFIG_FEATURE_SUID_CONFIG + bool "Runtime SUID/SGID configuration via /etc/busybox.conf" + default n if BUSYBOX_CONFIG_FEATURE_SUID + depends on BUSYBOX_CONFIG_FEATURE_SUID + help + Allow the SUID / SGID state of an applet to be determined at runtime + by checking /etc/busybox.conf. (This is sort of a poor man's sudo.) + The format of this file is as follows: + + <applet> = [Ssx-][Ssx-][x-] (<username>|<uid>).(<groupname>|<gid>) + + An example might help: + + [SUID] + su = ssx root.0 # applet su can be run by anyone and runs with euid=0/egid=0 + su = ssx # exactly the same + + mount = sx- root.disk # applet mount can be run by root and members of group disk + # and runs with euid=0 + + cp = --- # disable applet cp for everyone + + The file has to be owned by user root, group root and has to be + writeable only by root: + (chown 0.0 /etc/busybox.conf; chmod 600 /etc/busybox.conf) + The busybox executable has to be owned by user root, group + root and has to be setuid root for this to work: + (chown 0.0 /bin/busybox; chmod 4755 /bin/busybox) + + Robert 'sandman' Griebl has more information here: + <url: http://www.softforge.de/bb/suid.html >. + +config BUSYBOX_CONFIG_FEATURE_SUID_CONFIG_QUIET + bool "Suppress warning message if /etc/busybox.conf is not readable" + default n + depends on BUSYBOX_CONFIG_FEATURE_SUID_CONFIG + help + /etc/busybox.conf should be readable by the user needing the SUID, check + this option to avoid users to be notified about missing permissions. + +config BUSYBOX_CONFIG_SELINUX + bool "Support NSA Security Enhanced Linux" + default n + help + Enable support for SELinux in applets ls, ps, and id. Also provide + the option of compiling in SELinux applets. + + If you do not have a complete SELinux userland installed, this stuff + will not compile. Go visit + http://www.nsa.gov/selinux/index.html + to download the necessary stuff to allow busybox to compile with + this option enabled. Specifially, libselinux 1.28 or better is + directly required by busybox. If the installation is located in a + non-standard directory, provide it by invoking make as follows: + CFLAGS=-I<libselinux-include-path> \ + LDFLAGS=-L<libselinux-lib-path> \ + make + + Most people will leave this set to 'N'. + +config BUSYBOX_CONFIG_BUSYBOX_EXEC_PATH + string "Path to BusyBox executable" + default "/proc/self/exe" + help + When Busybox applets need to run other busybox applets, BusyBox + sometimes needs to exec() itself. When the /proc filesystem is + mounted, /proc/self/exe always points to the currently running + executable. If you haven't got /proc, set this to wherever you + want to run BusyBox from. + +endmenu + +menu 'Build Options' + +config BUSYBOX_CONFIG_STATIC + bool "Build BusyBox as a static binary (no shared libs)" + default n + help + If you want to build a static BusyBox binary, which does not + use or require any shared libraries, then enable this option. + This can cause BusyBox to be considerably larger, so you should + leave this option false unless you have a good reason (i.e. + your target platform does not support shared libraries, or + you are building an initrd which doesn't need anything but + BusyBox, etc). + + Most people will leave this set to 'N'. + +config BUSYBOX_CONFIG_BUILD_LIBBUSYBOX + bool "Build shared libbusybox" + default n + help + Build a shared library libbusybox.so which contains all + libraries used inside busybox. + + This is an experimental feature intended to support the upcoming + "make standalone" mode. Enabling it against the one big busybox + binary serves no purpose (and increases the size). You should + almost certainly say "no" to this right now. + +config BUSYBOX_CONFIG_FEATURE_FULL_LIBBUSYBOX + bool "Feature-complete libbusybox" + default n if !CONFIG_FEATURE_SHARED_BUSYBOX + depends on BUSYBOX_CONFIG_BUILD_LIBBUSYBOX + help + Build a libbusybox with the complete feature-set, disregarding + the actually selected config. + + Normally, libbusybox will only contain the features which are + used by busybox itself. If you plan to write a separate + standalone application which uses libbusybox say 'Y'. + + Note: libbusybox is GPL, not LGPL, and exports no stable API that + might act as a copyright barrier. We can and will modify the + exported function set between releases (even minor version number + changes), and happily break out-of-tree features. + + Say 'N' if in doubt. + +config BUSYBOX_CONFIG_FEATURE_SHARED_BUSYBOX + bool "Use shared libbusybox for busybox" + default n if BUSYBOX_CONFIG_BUILD_LIBBUSYBOX + depends on !CONFIG_STATIC && BUSYBOX_CONFIG_BUILD_LIBBUSYBOX + help + Use libbusybox.so also for busybox itself. + You need to have a working dynamic linker to use this variant. + +config BUSYBOX_CONFIG_LFS + bool + default y + select BUSYBOX_FDISK_SUPPORT_LARGE_DISKS + help + If you want to build BusyBox with large file support, then enable + this option. This will have no effect if your kernel or your C + library lacks large file support for large files. Some of the + programs that can benefit from large file support include dd, gzip, + cp, mount, tar, and many others. If you want to access files larger + than 2 Gigabytes, enable this option. Otherwise, leave it set to 'N'. + +config BUSYBOX_USING_CROSS_COMPILER + bool + default y + help + Do you want to build BusyBox with a Cross Compiler? If so, + then enable this option. Otherwise leave it set to 'N'. + +config BUSYBOX_CROSS_COMPILER_PREFIX + string + default "mipsel-uclibc-" + depends on BUSYBOX_USING_CROSS_COMPILER + help + If you want to build BusyBox with a cross compiler, then you + will need to set this to the cross-compiler prefix. For example, + if my cross-compiler is /usr/i386-linux-uclibc/bin/i386-uclibc-gcc + then I would enter '/usr/i386-linux-uclibc/bin/i386-uclibc-' here, + which will ensure the correct compiler is used. + +config BUSYBOX_CONFIG_BUILD_AT_ONCE + bool "Compile all sources at once" + default n + help + Normally each source-file is compiled with one invocation of + the compiler. + If you set this option, all sources are compiled at once. + This gives the compiler more opportunities to optimize which can + result in smaller and/or faster binaries. + + Setting this option will consume alot of memory, e.g. if you + enable all applets with all features, gcc uses more than 300MB + RAM during compilation of busybox. + + This option is most likely only beneficial for newer compilers + such as gcc-4.1 and above. + + Say 'N' unless you know what you are doing. + +endmenu + +menu 'Debugging Options' + +config BUSYBOX_CONFIG_DEBUG + bool "Build BusyBox with extra Debugging symbols" + default n + help + Say Y here if you wish to examine BusyBox internals while applets are + running. This increases the size of the binary considerably, and + should only be used when doing development. If you are doing + development and want to debug BusyBox, answer Y. + + Most people should answer N. + +config BUSYBOX_CONFIG_DEBUG_PESSIMIZE + bool "Disable compiler optimizations." + default n + depends on BUSYBOX_CONFIG_DEBUG + help + The compiler's optimization of source code can eliminate and reorder + code, resulting in an executable that's hard to understand when + stepping through it with a debugger. This switches it off, resulting + in a much bigger executable that more closely matches the source + code. + +choice + prompt "Additional debugging library" + default BUSYBOX_CONFIG_NO_DEBUG_LIB + depends on BUSYBOX_CONFIG_DEBUG + help + Using an additional debugging library will make BusyBox become + considerable larger and will cause it to run more slowly. You + should always leave this option disabled for production use. + + dmalloc support: + ---------------- + This enables compiling with dmalloc ( http://dmalloc.com/ ) + which is an excellent public domain mem leak and malloc problem + detector. To enable dmalloc, before running busybox you will + want to properly set your environment, for example: + export DMALLOC_OPTIONS=debug=0x34f47d83,inter=100,log=logfile + The 'debug=' value is generated using the following command + dmalloc -p log-stats -p log-non-free -p log-bad-space -p log-elapsed-time \ + -p check-fence -p check-heap -p check-lists -p check-blank \ + -p check-funcs -p realloc-copy -p allow-free-null + + Electric-fence support: + ----------------------- + This enables compiling with Electric-fence support. Electric + fence is another very useful malloc debugging library which uses + your computer's virtual memory hardware to detect illegal memory + accesses. This support will make BusyBox be considerable larger + and run slower, so you should leave this option disabled unless + you are hunting a hard to find memory problem. + + +config BUSYBOX_CONFIG_NO_DEBUG_LIB + bool "None" + +config BUSYBOX_CONFIG_DMALLOC + bool "Dmalloc" + +config BUSYBOX_CONFIG_EFENCE + bool "Electric-fence" + +endchoice + +config BUSYBOX_CONFIG_DEBUG_YANK_SUSv2 + bool "Disable obsolete features removed before SUSv3?" + default y + help + This option will disable backwards compatibility with SuSv2, + specifically, old-style numeric options ('command -1 <file>') + will not be supported in head, tail, and fold. (Note: should + yank from renice too.) + +endmenu + +menu 'Installation Options' + +config BUSYBOX_CONFIG_INSTALL_NO_USR + bool "Don't use /usr" + default n + help + Disable use of /usr. Don't activate this option if you don't know + that you really want this behaviour. + +choice + prompt "Applets links" + default BUSYBOX_CONFIG_INSTALL_APPLET_SYMLINKS + help + Choose how you install applets links. + +config BUSYBOX_CONFIG_INSTALL_APPLET_SYMLINKS + bool "as soft-links" + help + Install applets as soft-links to the busybox binary. This needs some + free inodes on the filesystem, but might help with filesystem + generators that can't cope with hard-links. + +config BUSYBOX_CONFIG_INSTALL_APPLET_HARDLINKS + bool "as hard-links" + help + Install applets as hard-links to the busybox binary. This might count + on a filesystem with few inodes. + +config BUSYBOX_CONFIG_INSTALL_APPLET_DONT + bool + prompt "not installed" + depends on BUSYBOX_CONFIG_FEATURE_INSTALLER || BUSYBOX_CONFIG_FEATURE_SH_STANDALONE_SHELL + help + Do not install applets links. Usefull when using the -install feature + or a standalone shell for rescue pruposes. + +endchoice + +config BUSYBOX_PREFIX + string + default "./_install" + help + Define your directory to install BusyBox files/subdirs in. + +endmenu + +source package/busybox/config/libbb/Config.in + +endmenu + +comment "Applets" + +source package/busybox/config/archival/Config.in +source package/busybox/config/coreutils/Config.in +source package/busybox/config/console-tools/Config.in +source package/busybox/config/debianutils/Config.in +source package/busybox/config/editors/Config.in +source package/busybox/config/findutils/Config.in +source package/busybox/config/init/Config.in +source package/busybox/config/loginutils/Config.in +source package/busybox/config/e2fsprogs/Config.in +source package/busybox/config/modutils/Config.in +source package/busybox/config/util-linux/Config.in +source package/busybox/config/miscutils/Config.in +source package/busybox/config/networking/Config.in +source package/busybox/config/procps/Config.in +source package/busybox/config/shell/Config.in +source package/busybox/config/sysklogd/Config.in diff --git a/package/busybox/config/archival/Config.in b/package/busybox/config/archival/Config.in new file mode 100644 index 0000000000..ac71d753a2 --- /dev/null +++ b/package/busybox/config/archival/Config.in @@ -0,0 +1,308 @@ +# +# For a description of the syntax of this configuration file, +# see scripts/kbuild/config-language.txt. +# + +menu "Archival Utilities" + +config BUSYBOX_CONFIG_AR + bool "ar" + default n + help + ar is an archival utility program used to create, modify, and + extract contents from archives. An archive is a single file holding + a collection of other files in a structure that makes it possible to + retrieve the original individual files (called archive members). + The original files' contents, mode (permissions), timestamp, owner, + and group are preserved in the archive, and can be restored on + extraction. + + The stored filename is limited to 15 characters. (for more information + see long filename support). + ar has 60 bytes of overheads for every stored file. + + This implementation of ar can extract archives, it cannot create or + modify them. + On an x86 system, the ar applet adds about 1K. + + Unless you have a specific application which requires ar, you should + probably say N here. + +config BUSYBOX_CONFIG_FEATURE_AR_LONG_FILENAMES + bool "Enable support for long filenames (not need for debs)" + default n + depends on BUSYBOX_CONFIG_AR + help + By default the ar format can only store the first 15 characters of the + filename, this option removes that limitation. + It supports the GNU ar long filename method which moves multiple long + filenames into a the data section of a new ar entry. + +config BUSYBOX_CONFIG_BUNZIP2 + bool "bunzip2" + default y + help + bunzip2 is a compression utility using the Burrows-Wheeler block + sorting text compression algorithm, and Huffman coding. Compression + is generally considerably better than that achieved by more + conventional LZ77/LZ78-based compressors, and approaches the + performance of the PPM family of statistical compressors. + + The BusyBox bunzip2 applet is limited to de-compression only. + On an x86 system, this applet adds about 11K. + + Unless you have a specific application which requires bunzip2, you + should probably say N here. + +config BUSYBOX_CONFIG_CPIO + bool "cpio" + default n + help + cpio is an archival utility program used to create, modify, and extract + contents from archives. + cpio has 110 bytes of overheads for every stored file. + + This implementation of cpio can extract cpio archives created in the + "newc" or "crc" format, it cannot create or modify them. + + Unless you have a specific application which requires cpio, you should + probably say N here. + +config BUSYBOX_CONFIG_DPKG + bool "dpkg" + default n + help + dpkg is a medium-level tool to install, build, remove and manage Debian packages. + + This implementation of dpkg has a number of limitations, you should use the + official dpkg if possible. + +config BUSYBOX_CONFIG_DPKG_DEB + bool "dpkg_deb" + default n + help + dpkg-deb packs, unpacks and provides information about Debian archives. + + This implementation of dpkg-deb cannot pack archives. + + Unless you have a specific application which requires dpkg-deb, you should + probably say N here. + +config BUSYBOX_CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY + bool "extract only (-x)" + default n + depends on BUSYBOX_CONFIG_DPKG_DEB + help + This reduces dpkg-deb to the equivalent of "ar -p <deb> data.tar.gz | tar -zx". + However it saves space as none of the extra dpkg-deb, ar or tar options are + needed, they are linked to internally. + +config BUSYBOX_CONFIG_GUNZIP + bool "gunzip" + default y + help + gunzip is used to decompress archives created by gzip. + You can use the `-t' option to test the integrity of + an archive, without decompressing it. + +config BUSYBOX_CONFIG_FEATURE_GUNZIP_UNCOMPRESS + bool "Uncompress support" + default y + depends on BUSYBOX_CONFIG_GUNZIP + help + Enable if you want gunzip to have the ability to decompress + archives created by the program compress (not much + used anymore). + +config BUSYBOX_CONFIG_GZIP + bool "gzip" + default y + help + gzip is used to compress files. + It's probably the most widely used UNIX compression program. + +config BUSYBOX_CONFIG_IPKG + bool "ipkg" + default y + select BUSYBOX_CONFIG_MD5SUM + select BUSYBOX_CONFIG_WGET + help + ipkg is the itsy package management system. + +config BUSYBOX_CONFIG_RPM2CPIO + bool "rpm2cpio" + default n + help + Converts an RPM file into a CPIO archive. + +config BUSYBOX_CONFIG_RPM + bool "rpm" + default n + help + Mini RPM applet - queries and extracts + +config BUSYBOX_CONFIG_TAR + bool "tar" + default y + help + tar is an archiving program. It's commonly used with gzip to + create compressed archives. It's probably the most widely used + UNIX archive program. + +config BUSYBOX_CONFIG_FEATURE_TAR_CREATE + bool "Enable archive creation" + default y + depends on BUSYBOX_CONFIG_TAR + help + If you enable this option you'll be able to create + tar archives using the `-c' option. + +config BUSYBOX_CONFIG_FEATURE_TAR_BZIP2 + bool "Enable -j option to handle .tar.bz2 files" + default y + depends on BUSYBOX_CONFIG_TAR + help + If you enable this option you'll be able to extract + archives compressed with bzip2. + +config BUSYBOX_CONFIG_FEATURE_TAR_LZMA + bool "Enable -a option to handle .tar.lzma files" + default n + depends on BUSYBOX_CONFIG_TAR + help + If you enable this option you'll be able to extract + archives compressed with lzma. + +config BUSYBOX_CONFIG_FEATURE_TAR_FROM + bool "Enable -X (exclude from) and -T (include from) options)" + default y + depends on BUSYBOX_CONFIG_TAR + help + If you enable this option you'll be able to specify + a list of files to include or exclude from an archive. + +config BUSYBOX_CONFIG_FEATURE_TAR_GZIP + bool "Enable -z option" + default y + depends on BUSYBOX_CONFIG_TAR + help + If you enable this option tar will be able to call gzip, + when creating or extracting tar gziped archives. + +config BUSYBOX_CONFIG_FEATURE_TAR_COMPRESS + bool "Enable -Z option" + default n + depends on BUSYBOX_CONFIG_TAR + help + If you enable this option tar will be able to call uncompress, + when extracting .tar.Z archives. + +config BUSYBOX_CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY + bool "Enable support for old tar header format" + default n + depends on BUSYBOX_CONFIG_TAR + help + This option is required to unpack archives created in + the old GNU format; help to kill this old format by + repacking your ancient archives with the new format. + +config BUSYBOX_CONFIG_FEATURE_TAR_GNU_EXTENSIONS + bool "Enable support for some GNU tar extensions" + default y + depends on BUSYBOX_CONFIG_TAR + help + With this option busybox supports GNU long filenames and + linknames. + +config BUSYBOX_CONFIG_FEATURE_TAR_LONG_OPTIONS + bool "Enable long options" + default n + depends on BUSYBOX_CONFIG_TAR && BUSYBOX_CONFIG_GETOPT_LONG + help + Enable use of long options, increases size by about 400 Bytes + +config BUSYBOX_CONFIG_UNCOMPRESS + bool "uncompress" + default n + help + uncompress is used to decompress archives created by compress. + Not much used anymore, replaced by gzip/gunzip. + +config BUSYBOX_CONFIG_UNLZMA + bool "unlzma" + default n + help + unlzma is a compression utility using the Lempel-Ziv-Markov chain + compression algorithm, and range coding. Compression + is generally considerably better than that achieved by the bzip2 + compressors. + + The BusyBox unlzma applet is limited to de-compression only. + On an x86 system, this applet adds about 4K. + + Unless you have a specific application which requires unlzma, you + should probably say N here. + +config BUSYBOX_CONFIG_FEATURE_LZMA_FAST + bool "Optimze unlzma for speed" + default n + depends on BUSYBOX_CONFIG_UNLZMA + help + This option reduces decompression time by about 33% at the cost of + a 2K bigger binary. + +config BUSYBOX_CONFIG_UNZIP + bool "unzip" + default n + help + unzip will list or extract files from a ZIP archive, + commonly found on DOS/WIN systems. The default behavior + (with no options) is to extract the archive into the + current directory. Use the `-d' option to extract to a + directory of your choice. + +comment "Common options for cpio and tar" + depends on BUSYBOX_CONFIG_CPIO || BUSYBOX_CONFIG_TAR + +config BUSYBOX_CONFIG_FEATURE_UNARCHIVE_TAPE + bool "Enable tape drive support" + default n + depends on BUSYBOX_CONFIG_CPIO || BUSYBOX_CONFIG_TAR + help + I don't think this is needed anymore. + +comment "Common options for dpkg and dpkg_deb" + depends on BUSYBOX_CONFIG_DPKG || BUSYBOX_CONFIG_DPKG_DEB + +config BUSYBOX_CONFIG_FEATURE_DEB_TAR_GZ + bool "gzip debian packages (normal)" + default n if BUSYBOX_CONFIG_DPKG || BUSYBOX_CONFIG_DPKG_DEB + depends on BUSYBOX_CONFIG_DPKG || BUSYBOX_CONFIG_DPKG_DEB + help + This is the default compression method inside the debian ar file. + + If you want compatibility with standard .deb's you should say yes here. + +config BUSYBOX_CONFIG_FEATURE_DEB_TAR_BZ2 + bool "bzip2 debian packages" + default n + depends on BUSYBOX_CONFIG_DPKG || BUSYBOX_CONFIG_DPKG_DEB + help + This allows dpkg and dpkg-deb to extract deb's that are compressed internally + with bzip2 instead of gzip. + + You only want this if you are creating your own custom debian packages that + use an internal control.tar.bz2 or data.tar.bz2. + +config BUSYBOX_CONFIG_FEATURE_DEB_TAR_LZMA + bool "lzma debian packages" + default n + depends on BUSYBOX_CONFIG_DPKG || BUSYBOX_CONFIG_DPKG_DEB + help + This allows dpkg and dpkg-deb to extract deb's that are compressed + internally with lzma instead of gzip. + + You only want this if you are creating your own custom debian + packages that use an internal control.tar.lzma or data.tar.lzma. + +endmenu diff --git a/package/busybox/config/console-tools/Config.in b/package/busybox/config/console-tools/Config.in new file mode 100644 index 0000000000..1efe300982 --- /dev/null +++ b/package/busybox/config/console-tools/Config.in @@ -0,0 +1,88 @@ +# +# For a description of the syntax of this configuration file, +# see scripts/kbuild/config-language.txt. +# + +menu "Console Utilities" + +config BUSYBOX_CONFIG_CHVT + bool "chvt" + default n + help + This program is used to change to another terminal. + Example: chvt 4 (change to terminal /dev/tty4) + +config BUSYBOX_CONFIG_CLEAR + bool "clear" + default y + help + This program clears the terminal screen. + +config BUSYBOX_CONFIG_DEALLOCVT + bool "deallocvt" + default n + help + This program deallocates unused virtual consoles. + +config BUSYBOX_CONFIG_DUMPKMAP + bool "dumpkmap" + default n + help + This program dumps the kernel's keyboard translation table to + stdout, in binary format. You can then use loadkmap to load it. + +config BUSYBOX_CONFIG_LOADFONT + bool "loadfont" + default n + help + This program loads a console font from standard input. + +config BUSYBOX_CONFIG_LOADKMAP + bool "loadkmap" + default n + help + This program loads a keyboard translation table from + standard input. + +config BUSYBOX_CONFIG_OPENVT + bool "openvt" + default n + help + This program is used to start a command on an unused + virtual terminal. + +config BUSYBOX_CONFIG_RESET + bool "reset" + default y + help + This program is used to reset the terminal screen, if it + gets messed up. + +config BUSYBOX_CONFIG_SETCONSOLE + bool "setconsole" + default n + help + This program redirects the system console to another device, + like the current tty while logged in via telnet. + +config BUSYBOX_CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS + bool "Enable long options" + default n + depends on BUSYBOX_CONFIG_SET_CONSOLE && BUSYBOX_CONFIG_GETOPT_LONG + help + Support long options for the setconsole applet. + +config BUSYBOX_CONFIG_SETKEYCODES + bool "setkeycodes" + default n + help + This program loads entries into the kernel's scancode-to-keycode + map, allowing unusual keyboards to generate usable keycodes. + +config BUSYBOX_CONFIG_SETLOGCONS + bool "setlogcons" + default n + help + This program redirects the output console of kernel messages. + +endmenu diff --git a/package/busybox/config/coreutils/Config.in b/package/busybox/config/coreutils/Config.in new file mode 100644 index 0000000000..3487fc742c --- /dev/null +++ b/package/busybox/config/coreutils/Config.in @@ -0,0 +1,775 @@ +# +# For a description of the syntax of this configuration file, +# see scripts/kbuild/config-language.txt. +# + +menu "Coreutils" + +config BUSYBOX_CONFIG_BASENAME + bool "basename" + default y + help + basename is used to strip the directory and suffix from filenames, + leaving just the filename itself. Enable this option if you wish + to enable the 'basename' utility. + +config BUSYBOX_CONFIG_CAL + bool "cal" + default n + help + cal is used to display a monthly calender. + +config BUSYBOX_CONFIG_CAT + bool "cat" + default y + help + cat is used to concatenate files and print them to the standard + output. Enable this option if you wish to enable the 'cat' utility. + +config BUSYBOX_CONFIG_CATV + bool "catv" + default n + help + Display nonprinting characters as escape sequences (like some + implementations' cat -v option). + +config BUSYBOX_CONFIG_CHGRP + bool "chgrp" + default y + help + chgrp is used to change the group ownership of files. + +config BUSYBOX_CONFIG_CHMOD + bool "chmod" + default y + help + chmod is used to change the access permission of files. + +config BUSYBOX_CONFIG_CHOWN + bool "chown" + default y + help + chown is used to change the user and/or group ownership + of files. + +config BUSYBOX_CONFIG_CHROOT + bool "chroot" + default y + help + chroot is used to change the root directory and run a command. + The default command is `/bin/sh'. + +config BUSYBOX_CONFIG_CKSUM + bool "cksum" + default n + help + cksum is used to calculate the CRC32 checksum of a file. + +config BUSYBOX_CONFIG_CMP + bool "cmp" + default n + help + cmp is used to compare two files and returns the result + to standard output. + +config BUSYBOX_CONFIG_COMM + bool "comm" + default n + help + comm is used to compare two files line by line and return + a three-column output. + +config BUSYBOX_CONFIG_CP + bool "cp" + default y + help + cp is used to copy files and directories. + +config BUSYBOX_CONFIG_CUT + bool "cut" + default y + help + cut is used to print selected parts of lines from + each file to stdout. + +config BUSYBOX_CONFIG_DATE + bool "date" + default y + help + date is used to set the system date or display the + current time in the given format. + +config BUSYBOX_CONFIG_FEATURE_DATE_ISOFMT + bool "Enable ISO date format output (-I)" + default y + depends on BUSYBOX_CONFIG_DATE + help + Enable option (-I) to output an ISO-8601 compliant + date/time string. + +config BUSYBOX_CONFIG_DD + bool "dd" + default y + help + dd copies a file (from standard input to standard output, + by default) using specific input and output blocksizes, + while optionally performing conversions on it. + +config BUSYBOX_CONFIG_FEATURE_DD_SIGNAL_HANDLING + bool "Enable DD signal handling for status reporting" + default y + depends on BUSYBOX_CONFIG_DD + help + sending a SIGUSR1 signal to a running `dd' process makes it + print to standard error the number of records read and written + so far, then to resume copying. + + $ dd if=/dev/zero of=/dev/null& pid=$! $ kill -USR1 $pid; sleep 1; kill $pid + 10899206+0 records in 10899206+0 records out + +config BUSYBOX_CONFIG_FEATURE_DD_IBS_OBS + bool "Enable ibs, obs and conv options" + default n + depends on BUSYBOX_CONFIG_DD + help + Enables support for writing a certain number of bytes in and out, + at a time, and performing conversions on the data stream. + +config BUSYBOX_CONFIG_DF + bool "df" + default y + help + df reports the amount of disk space used and available + on filesystems. + +config BUSYBOX_CONFIG_DIFF + bool "diff" + default n + help + diff compares two files or directories and outputs the + differences between them in a form that can be given to + the patch command. + +config BUSYBOX_CONFIG_FEATURE_DIFF_BINARY + bool "Enable checks for binary files" + default n + depends on BUSYBOX_CONFIG_DIFF + help + This option enables support for checking for binary files + before a comparison is carried out. + +config BUSYBOX_CONFIG_FEATURE_DIFF_DIR + bool "Enable directory support" + default n + depends on BUSYBOX_CONFIG_DIFF + help + This option enables support for directory and subdirectory + comparison. + +config BUSYBOX_CONFIG_FEATURE_DIFF_MINIMAL + bool "Enable -d option to find smaller sets of changes" + default n + depends on BUSYBOX_CONFIG_DIFF + help + Enabling this option allows the use of -d to make diff + try hard to find the smallest possible set of changes. + +config BUSYBOX_CONFIG_DIRNAME + bool "dirname" + default y + help + dirname is used to strip a non-directory suffix from + a file name. + +config BUSYBOX_CONFIG_DOS2UNIX + bool "dos2unix/unix2dos" + default n + help + dos2unix is used to convert a text file from DOS format to + UNIX format, and vice versa. + +config BUSYBOX_CONFIG_UNIX2DOS + bool + default n + depends on BUSYBOX_CONFIG_DOS2UNIX + help + unix2dos is used to convert a text file from UNIX format to + DOS format, and vice versa. + +config BUSYBOX_CONFIG_DU + bool "du (default blocksize of 512 bytes)" + default y + help + du is used to report the amount of disk space used + for specified files. + +config BUSYBOX_CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K + bool "Use a default blocksize of 1024 bytes (1K)" + default y + depends on BUSYBOX_CONFIG_DU + help + Use a blocksize of (1K) instead of the default 512b. + +config BUSYBOX_CONFIG_ECHO + bool "echo (basic SuSv3 version taking no options)" + default y + help + echo is used to print a specified string to stdout. + +# this entry also appears in shell/Config.in, next to the echo builtin +config BUSYBOX_CONFIG_FEATURE_FANCY_ECHO + bool "Enable echo options (-n and -e)" + default y + depends on BUSYBOX_CONFIG_ECHO + help + This adds options (-n and -e) to echo. + +config BUSYBOX_CONFIG_ENV + bool "env" + default y + help + env is used to set an environment variable and run + a command; without options it displays the current + environment. + +config BUSYBOX_CONFIG_FEATURE_ENV_LONG_OPTIONS + bool "Enable long options" + default n + depends on BUSYBOX_CONFIG_ENV && BUSYBOX_CONFIG_GETOPT_LONG + help + Support long options for the env applet. + +config BUSYBOX_CONFIG_EXPR + bool "expr" + default y + help + expr is used to calculate numbers and print the result + to standard output. + +config BUSYBOX_CONFIG_EXPR_MATH_SUPPORT_64 + bool "Extend Posix numbers support to 64 bit" + default n + depends on BUSYBOX_CONFIG_EXPR + help + Enable 64-bit math support in the expr applet. This will make + the applet slightly larger, but will allow computation with very + large numbers. + +config BUSYBOX_CONFIG_FALSE + bool "false" + default y + help + false returns an exit code of FALSE (1). + +config BUSYBOX_CONFIG_FOLD + bool "fold" + default n + help + Wrap text to fit a specific width. + +config BUSYBOX_CONFIG_HEAD + bool "head" + default y + help + head is used to print the first specified number of lines + from files. + +config BUSYBOX_CONFIG_FEATURE_FANCY_HEAD + bool "Enable head options (-c, -q, and -v)" + default y + depends on BUSYBOX_CONFIG_HEAD + help + This enables the head options (-c, -q, and -v). + +config BUSYBOX_CONFIG_HOSTID + bool "hostid" + default y + help + hostid prints the numeric identifier (in hexadecimal) for + the current host. + +config BUSYBOX_CONFIG_ID + bool "id" + default y + help + id displays the current user and group ID names. + +config BUSYBOX_CONFIG_INSTALL + bool "install" + default n + help + Copy files and set attributes. + +config BUSYBOX_CONFIG_FEATURE_INSTALL_LONG_OPTIONS + bool "Enable long options" + default n + depends on BUSYBOX_CONFIG_INSTALL && BUSYBOX_CONFIG_GETOPT_LONG + help + Support long options for the install applet. + +config BUSYBOX_CONFIG_LENGTH + bool "length" + default y + help + length is used to print out the length of a specified string. + +config BUSYBOX_CONFIG_LN + bool "ln" + default y + help + ln is used to create hard or soft links between files. + +config BUSYBOX_CONFIG_LOGNAME + bool "logname" + default n + help + logname is used to print the current user's login name. + +config BUSYBOX_CONFIG_LS + bool "ls" + default y + help + ls is used to list the contents of directories. + +config BUSYBOX_CONFIG_FEATURE_LS_FILETYPES + bool "Enable filetyping options (-p and -F)" + default y + depends on BUSYBOX_CONFIG_LS + help + Enable the ls options (-p and -F). + +config BUSYBOX_CONFIG_FEATURE_LS_FOLLOWLINKS + bool "Enable symlinks dereferencing (-L)" + default y + depends on BUSYBOX_CONFIG_LS + help + Enable the ls option (-L). + +config BUSYBOX_CONFIG_FEATURE_LS_RECURSIVE + bool "Enable recursion (-R)" + default y + depends on BUSYBOX_CONFIG_LS + help + Enable the ls option (-R). + +config BUSYBOX_CONFIG_FEATURE_LS_SORTFILES + bool "Sort the file names" + default y + depends on BUSYBOX_CONFIG_LS + help + Allow ls to sort file names alphabetically. + +config BUSYBOX_CONFIG_FEATURE_LS_TIMESTAMPS + bool "Show file timestamps" + default y + depends on BUSYBOX_CONFIG_LS + help + Allow ls to display timestamps for files. + +config BUSYBOX_CONFIG_FEATURE_LS_USERNAME + bool "Show username/groupnames" + default y + depends on BUSYBOX_CONFIG_LS + help + Allow ls to display username/groupname for files. + +config BUSYBOX_CONFIG_FEATURE_LS_COLOR + bool "Allow use of color to identify file types" + default y + depends on BUSYBOX_CONFIG_LS && BUSYBOX_CONFIG_GETOPT_LONG + help + This enables the --color option to ls. + +config BUSYBOX_CONFIG_FEATURE_LS_COLOR_IS_DEFAULT + bool "Produce colored ls output by default" + default y + depends on BUSYBOX_CONFIG_FEATURE_LS_COLOR + help + Saying yes here will turn coloring on by default, + even if no "--color" option is given to the ls command. + This is not recommended, since the colors are not + configurable, and the output may not be legible on + many output screens. + +config BUSYBOX_CONFIG_MD5SUM + bool "md5sum" + default y + help + md5sum is used to print or check MD5 checksums. + +config BUSYBOX_CONFIG_MKDIR + bool "mkdir" + default y + help + mkdir is used to create directories with the specified names. + +config BUSYBOX_CONFIG_FEATURE_MKDIR_LONG_OPTIONS + bool "Enable long options" + default n + depends on BUSYBOX_CONFIG_MKDIR && BUSYBOX_CONFIG_GETOPT_LONG + help + Support long options for the mkdir applet. + +config BUSYBOX_CONFIG_MKFIFO + bool "mkfifo" + default y + help + mkfifo is used to create FIFOs (named pipes). + The `mknod' program can also create FIFOs. + +config BUSYBOX_CONFIG_MKNOD + bool "mknod" + default y + help + mknod is used to create FIFOs or block/character special + files with the specified names. + +config BUSYBOX_CONFIG_MV + bool "mv" + default y + help + mv is used to move or rename files or directories. + +config BUSYBOX_CONFIG_FEATURE_MV_LONG_OPTIONS + bool "Enable long options" + default n + depends on BUSYBOX_CONFIG_MV && BUSYBOX_CONFIG_GETOPT_LONG + help + Support long options for the mv applet. + +config BUSYBOX_CONFIG_NICE + bool "nice" + default n + help + nice runs a program with modified scheduling priority. + +config BUSYBOX_CONFIG_NOHUP + bool "nohup" + default n + help + run a command immune to hangups, with output to a non-tty. + +config BUSYBOX_CONFIG_OD + bool "od" + default n + help + od is used to dump binary files in octal and other formats. + +config BUSYBOX_CONFIG_PRINTENV + bool "printenv" + default n + help + printenv is used to print all or part of environment. + +config BUSYBOX_CONFIG_PRINTF + bool "printf" + default y + help + printf is used to format and print specified strings. + It's similar to `echo' except it has more options. + +config BUSYBOX_CONFIG_PWD + bool "pwd" + default y + help + pwd is used to print the current directory. + +config BUSYBOX_CONFIG_REALPATH + bool "realpath" + default n + help + Return the canonicalized absolute pathname. + This isn't provided by GNU shellutils, but where else does it belong. + +config BUSYBOX_CONFIG_RM + bool "rm" + default y + help + rm is used to remove files or directories. + +config BUSYBOX_CONFIG_RMDIR + bool "rmdir" + default y + help + rmdir is used to remove empty directories. + +config BUSYBOX_CONFIG_SEQ + bool "seq" + default y + help + print a sequence of numbers + +config BUSYBOX_CONFIG_SHA1SUM + bool "sha1sum" + default n + help + Compute and check SHA1 message digest + +config BUSYBOX_CONFIG_SLEEP + bool "sleep (single integer arg with no suffix)" + default y + help + sleep is used to pause for a specified number of seconds, + +config BUSYBOX_CONFIG_FEATURE_FANCY_SLEEP + bool "Enable multiple integer args and optional time suffixes" + default y + depends on BUSYBOX_CONFIG_SLEEP + help + Allow sleep to pause for specified minutes, hours, and days. + +config BUSYBOX_CONFIG_SORT + bool "sort" + default y + help + sort is used to sort lines of text in specified files. + +config BUSYBOX_CONFIG_FEATURE_SORT_BIG + bool "full SuSv3 compliant sort (Support -ktcsbdfiozgM)" + default n + depends on BUSYBOX_CONFIG_SORT + help + Without this, sort only supports -r, -u, and an integer version + of -n. Selecting this adds sort keys, floating point support, and + more. This adds a little over 3k to a nonstatic build on x86. + + The SuSv3 sort standard is available at: + http://www.opengroup.org/onlinepubs/007904975/utilities/sort.html + +config BUSYBOX_CONFIG_STAT + bool "stat" + default n + help + display file or filesystem status. + +config BUSYBOX_CONFIG_FEATURE_STAT_FORMAT + bool "Enable custom formats (-c)" + default n + depends on BUSYBOX_CONFIG_STAT + help + Without this, stat will not support the '-c format' option where + users can pass a custom format string for output. This adds about + 7k to a nonstatic build on amd64. + +config BUSYBOX_CONFIG_STTY + bool "stty" + default n + help + stty is used to change and print terminal line settings. + +config BUSYBOX_CONFIG_SUM + bool "sum" + default n + help + checksum and count the blocks in a file + +config BUSYBOX_CONFIG_SYNC + bool "sync" + default y + help + sync is used to flush filesystem buffers. + +config BUSYBOX_CONFIG_TAIL + bool "tail" + default y + help + tail is used to print the last specified number of lines + from files. + +config BUSYBOX_CONFIG_FEATURE_FANCY_TAIL + bool "Enable extra tail options (-q, -s, and -v)" + default y + depends on BUSYBOX_CONFIG_TAIL + help + The options (-q, -s, and -v) are provided by GNU tail, but + are not specific in the SUSv3 standard. + +config BUSYBOX_CONFIG_TEE + bool "tee" + default y + help + tee is used to read from standard input and write + to standard output and files. + +config BUSYBOX_CONFIG_FEATURE_TEE_USE_BLOCK_IO + bool "Enable block i/o (larger/faster) instead of byte i/o." + default y + depends on BUSYBOX_CONFIG_TEE + help + Enable this option for a faster tee, at expense of size. + +config BUSYBOX_CONFIG_TEST + bool "test" + default y + help + test is used to check file types and compare values, + returning an appropriate exit code. The bash shell + has test built in, ash can build it in optionally. + +config BUSYBOX_CONFIG_FEATURE_TEST_64 + bool "Extend test to 64 bit" + default n + depends on BUSYBOX_CONFIG_TEST + help + Enable 64-bit support in test. + +config BUSYBOX_CONFIG_TOUCH + bool "touch" + default y + help + touch is used to create or change the access and/or + modification timestamp of specified files. + +config BUSYBOX_CONFIG_TR + bool "tr" + default y + help + tr is used to squeeze, and/or delete characters from standard + input, writing to standard output. + +config BUSYBOX_CONFIG_FEATURE_TR_CLASSES + bool "Enable character classes (such as [:upper:])" + default n + depends on BUSYBOX_CONFIG_TR + help + Enable character classes, enabling commands such as: + tr [:upper:] [:lower:] to convert input into lowercase. + +config BUSYBOX_CONFIG_FEATURE_TR_EQUIV + bool "Enable equivalence classes" + default n + depends on BUSYBOX_CONFIG_TR + help + Enable equivalence classes, which essentially add the enclosed + character to the current set. For instance, tr [=a=] xyz would + replace all instances of 'a' with 'xyz'. This option is mainly + useful for cases when no other way of expressing a character + is possible. + +config BUSYBOX_CONFIG_TRUE + bool "true" + default y + help + true returns an exit code of TRUE (0). + +config BUSYBOX_CONFIG_TTY + bool "tty" + default n + help + tty is used to print the name of the current terminal to + standard output. + +config BUSYBOX_CONFIG_UNAME + bool "uname" + default y + help + uname is used to print system information. + +config BUSYBOX_CONFIG_UNIQ + bool "uniq" + default y + help + uniq is used to remove duplicate lines from a sorted file. + +config BUSYBOX_CONFIG_USLEEP + bool "usleep" + default n + help + usleep is used to pause for a specified number of microseconds. + +config BUSYBOX_CONFIG_UUDECODE + bool "uudecode" + default n + help + uudecode is used to decode a uuencoded file. + +config BUSYBOX_CONFIG_UUENCODE + bool "uuencode" + default n + help + uuencode is used to uuencode a file. + +config BUSYBOX_CONFIG_WATCH + bool "watch" + default n + select BUSYBOX_CONFIG_DATE + help + watch is used to execute a program periodically, showing + output to the screen. + +config BUSYBOX_CONFIG_WC + bool "wc" + default y + help + wc is used to print the number of bytes, words, and lines, + in specified files. + +config BUSYBOX_CONFIG_WHO + bool "who" + default n + select BUSYBOX_CONFIG_FEATURE_UTMP + help + who is used to show who is logged on. + +config BUSYBOX_CONFIG_WHOAMI + bool "whoami" + default n + help + whoami is used to print the username of the current + user id (same as id -un). + +config BUSYBOX_CONFIG_YES + bool "yes" + default y + help + yes is used to repeatedly output a specific string, or + the default string `y'. + +comment "Common options for cp and mv" + depends on BUSYBOX_CONFIG_CP || BUSYBOX_CONFIG_MV + +config BUSYBOX_CONFIG_FEATURE_PRESERVE_HARDLINKS + bool "Preserve hard links" + default y + depends on BUSYBOX_CONFIG_CP || BUSYBOX_CONFIG_MV + help + Allow cp and mv to preserve hard links. + +comment "Common options for ls, more and telnet" + depends on BUSYBOX_CONFIG_LS || BUSYBOX_CONFIG_MORE || BUSYBOX_CONFIG_TELNET + +config BUSYBOX_CONFIG_FEATURE_AUTOWIDTH + bool "Calculate terminal & column widths" + default y + depends on BUSYBOX_CONFIG_LS || BUSYBOX_CONFIG_MORE || BUSYBOX_CONFIG_TELNET + help + This option allows utilities such as 'ls', 'more' and 'telnet' + to determine the width of the screen, which can allow them to + display additional text or avoid wrapping text onto the next line. + If you leave this disabled, your utilities will be especially + primitive and will be unable to determine the current screen width. + +comment "Common options for df, du, ls" + depends on BUSYBOX_CONFIG_DF || BUSYBOX_CONFIG_DU || BUSYBOX_CONFIG_LS + +config BUSYBOX_CONFIG_FEATURE_HUMAN_READABLE + bool "Support for human readable output (example 13k, 23M, 235G)" + default y + depends on BUSYBOX_CONFIG_DF || BUSYBOX_CONFIG_DU || BUSYBOX_CONFIG_LS + help + Allow df, du, and ls to have human readable output. + +comment "Common options for md5sum, sha1sum" + depends on BUSYBOX_CONFIG_MD5SUM || BUSYBOX_CONFIG_SHA1SUM + +config BUSYBOX_CONFIG_FEATURE_MD5_SHA1_SUM_CHECK + bool "Enable -c, -s and -w options" + default y + depends on BUSYBOX_CONFIG_MD5SUM || BUSYBOX_CONFIG_SHA1SUM + help + Enabling the -c options allows files to be checked + against pre-calculated hash values. + + -s and -w are useful options when verifying checksums. + +endmenu diff --git a/package/busybox/config/debianutils/Config.in b/package/busybox/config/debianutils/Config.in new file mode 100644 index 0000000000..bc98103c72 --- /dev/null +++ b/package/busybox/config/debianutils/Config.in @@ -0,0 +1,88 @@ +# +# For a description of the syntax of this configuration file, +# see scripts/kbuild/config-language.txt. +# + +menu "Debian Utilities" + +config BUSYBOX_CONFIG_MKTEMP + bool "mktemp" + default y + help + mktemp is used to create unique temporary files + +config BUSYBOX_CONFIG_PIPE_PROGRESS + bool "pipe_progress" + default n + help + Display a dot to indicate pipe activity. + +config BUSYBOX_CONFIG_READLINK + bool "readlink" + default n + help + This program reads a symbolic link and returns the name + of the file it points to + +config BUSYBOX_CONFIG_FEATURE_READLINK_FOLLOW + bool "Enable canonicalization by following all symlinks (-f)" + default n + depends on BUSYBOX_CONFIG_READLINK + help + Enable the readlink option (-f). + +config BUSYBOX_CONFIG_RUN_PARTS + bool "run-parts" + default n + help + run-parts is a utility designed to run all the scripts in a directory. + + It is useful to set up a directory like cron.daily, where you need to + execute all the scripts in that directory. + + In this implementation of run-parts some features (such as report mode) + are not implemented. + + Unless you know that run-parts is used in some of your scripts + you can safely say N here. + +config BUSYBOX_CONFIG_FEATURE_RUN_PARTS_LONG_OPTIONS + bool "Enable long options" + default n + depends on BUSYBOX_CONFIG_RUN_PARTS && BUSYBOX_CONFIG_GETOPT_LONG + help + Support long options for the run-parts applet. + +config BUSYBOX_CONFIG_START_STOP_DAEMON + bool "start-stop-daemon" + default n + help + start-stop-daemon is used to control the creation and + termination of system-level processes, usually the ones + started during the startup of the system. + +config BUSYBOX_CONFIG_FEATURE_START_STOP_DAEMON_FANCY + bool "Support additional arguments" + default n + depends on BUSYBOX_CONFIG_START_STOP_DAEMON + help + Support additional arguments. + -o|--oknodo ignored since we exit with 0 anyway + -v|--verbose + +config BUSYBOX_CONFIG_FEATURE_START_STOP_DAEMON_LONG_OPTIONS + bool "Enable long options" + default n + depends on BUSYBOX_CONFIG_START_STOP_DAEMON && BUSYBOX_CONFIG_GETOPT_LONG + help + Support long options for the start-stop-daemon applet. + +config BUSYBOX_CONFIG_WHICH + bool "which" + default y + help + which is used to find programs in your PATH and + print out their pathnames. + +endmenu + diff --git a/package/busybox/config/e2fsprogs/Config.in b/package/busybox/config/e2fsprogs/Config.in new file mode 100644 index 0000000000..e9ef3dc041 --- /dev/null +++ b/package/busybox/config/e2fsprogs/Config.in @@ -0,0 +1,67 @@ +# +# For a description of the syntax of this configuration file, +# see scripts/kbuild/config-language.txt. +# + +menu "Linux Ext2 FS Progs" + +config BUSYBOX_CONFIG_CHATTR + bool "chattr" + default n + help + chattr changes the file attributes on a second extended file system. + +config BUSYBOX_CONFIG_E2FSCK + bool "e2fsck" + default n + help + e2fsck is used to check Linux second extended file systems (ext2fs). + e2fsck also supports ext2 filesystems countaining a journal (ext3). + The normal compat symlinks 'fsck.ext2' and 'fsck.ext3' are also + provided. + +config BUSYBOX_CONFIG_FSCK + bool "fsck" + default n + help + fsck is used to check and optionally repair one or more filesystems. + In actuality, fsck is simply a front-end for the various file system + checkers (fsck.fstype) available under Linux. + +config BUSYBOX_CONFIG_LSATTR + bool "lsattr" + default n + help + lsattr lists the file attributes on a second extended file system. + +config BUSYBOX_CONFIG_MKE2FS + bool "mke2fs" + default n + help + mke2fs is used to create an ext2/ext3 filesystem. The normal compat + symlinks 'mkfs.ext2' and 'mkfs.ext3' are also provided. + +config BUSYBOX_CONFIG_TUNE2FS + bool "tune2fs" + default n + help + tune2fs allows the system administrator to adjust various tunable + filesystem parameters on Linux ext2/ext3 filesystems. + +config BUSYBOX_CONFIG_E2LABEL + bool "e2label" + default n + depends on BUSYBOX_CONFIG_TUNE2FS + help + e2label will display or change the filesystem label on the ext2 + filesystem located on device. + +config BUSYBOX_CONFIG_FINDFS + bool "findfs" + default n + depends on BUSYBOX_CONFIG_TUNE2FS + help + findfs will search the disks in the system looking for a filesystem + which has a label matching label or a UUID equal to uuid. + +endmenu diff --git a/package/busybox/config/editors/Config.in b/package/busybox/config/editors/Config.in new file mode 100644 index 0000000000..3c1a320bc3 --- /dev/null +++ b/package/busybox/config/editors/Config.in @@ -0,0 +1,131 @@ +# +# For a description of the syntax of this configuration file, +# see scripts/kbuild/config-language.txt. +# + +menu "Editors" + +config BUSYBOX_CONFIG_AWK + bool "awk" + default y + help + Awk is used as a pattern scanning and processing language. This is + the BusyBox implementation of that programming language. + +config BUSYBOX_CONFIG_FEATURE_AWK_MATH + bool "Enable math functions (requires libm)" + default y + depends on BUSYBOX_CONFIG_AWK + help + Enable math functions of the Awk programming language. + NOTE: This will require libm to be present for linking. + +config BUSYBOX_CONFIG_ED + bool "ed" + default n + help + The original 1970's Unix text editor, from the days of teletypes. + Small, simple, evil. Part of SUSv3. If you're not already using + this, you don't need it. + +config BUSYBOX_CONFIG_PATCH + bool "patch" + default n + help + Apply a unified diff formatted patch. + +config BUSYBOX_CONFIG_SED + bool "sed" + default y + help + sed is used to perform text transformations on a file + or input from a pipeline. + +config BUSYBOX_CONFIG_VI + bool "vi" + default y + help + 'vi' is a text editor. More specifically, it is the One True + text editor <grin>. It does, however, have a rather steep + learning curve. If you are not already comfortable with 'vi' + you may wish to use something else. + +config BUSYBOX_CONFIG_FEATURE_VI_COLON + bool "Enable \":\" colon commands (no \"ex\" mode)" + default y + depends on BUSYBOX_CONFIG_VI + help + Enable a limited set of colon commands for vi. This does not + provide an "ex" mode. + +config BUSYBOX_CONFIG_FEATURE_VI_YANKMARK + bool "Enable yank/put commands and mark cmds" + default y + depends on BUSYBOX_CONFIG_VI + help + This will enable you to use yank and put, as well as mark in + busybox vi. + +config BUSYBOX_CONFIG_FEATURE_VI_SEARCH + bool "Enable search and replace cmds" + default y + depends on BUSYBOX_CONFIG_VI + help + Select this if you wish to be able to do search and replace in + busybox vi. + +config BUSYBOX_CONFIG_FEATURE_VI_USE_SIGNALS + bool "Catch signals" + default y + depends on BUSYBOX_CONFIG_VI + help + Selecting this option will make busybox vi signal aware. This will + make busybox vi support SIGWINCH to deal with Window Changes, catch + Ctrl-Z and Ctrl-C and alarms. + +config BUSYBOX_CONFIG_FEATURE_VI_DOT_CMD + bool "Remember previous cmd and \".\" cmd" + default y + depends on BUSYBOX_CONFIG_VI + help + Make busybox vi remember the last command and be able to repeat it. + +config BUSYBOX_CONFIG_FEATURE_VI_READONLY + bool "Enable -R option and \"view\" mode" + default y + depends on BUSYBOX_CONFIG_VI + help + Enable the read-only command line option, which allows the user to + open a file in read-only mode. + +config BUSYBOX_CONFIG_FEATURE_VI_SETOPTS + bool "Enable set-able options, ai ic showmatch" + default y + depends on BUSYBOX_CONFIG_VI + help + Enable the editor to set some (ai, ic, showmatch) options. + +config BUSYBOX_CONFIG_FEATURE_VI_SET + bool "Support for :set" + default y + depends on BUSYBOX_CONFIG_VI + help + Support for ":set". + +config BUSYBOX_CONFIG_FEATURE_VI_WIN_RESIZE + bool "Handle window resize" + default y + depends on BUSYBOX_CONFIG_VI + help + Make busybox vi behave nicely with terminals that get resized. + +config BUSYBOX_CONFIG_FEATURE_VI_OPTIMIZE_CURSOR + bool "Optimize cursor movement" + default y + depends on BUSYBOX_CONFIG_VI + help + This will make the cursor movement faster, but requires more memory + and it makes the applet a tiny bit larger. + +endmenu + diff --git a/package/busybox/config/findutils/Config.in b/package/busybox/config/findutils/Config.in new file mode 100644 index 0000000000..e708259888 --- /dev/null +++ b/package/busybox/config/findutils/Config.in @@ -0,0 +1,159 @@ +# +# For a description of the syntax of this configuration file, +# see scripts/kbuild/config-language.txt. +# + +menu "Finding Utilities" + +config BUSYBOX_CONFIG_FIND + bool "find" + default y + help + find is used to search your system to find specified files. + +config BUSYBOX_CONFIG_FEATURE_FIND_PRINT0 + bool "Enable -print0 option" + default y + depends on BUSYBOX_CONFIG_FIND + help + Causes output names to be separated by a null character + rather than a newline. This allows names that contain + newlines and other whitespace to be more easily + interpreted by other programs. + +config BUSYBOX_CONFIG_FEATURE_FIND_MTIME + bool "Enable modified time matching (-mtime) option" + default n + depends on BUSYBOX_CONFIG_FIND + help + Allow searching based on the modification time of + files, in days. + +config BUSYBOX_CONFIG_FEATURE_FIND_MMIN + bool "Enable modified time matching (-min) option" + default n + depends on BUSYBOX_CONFIG_FIND + help + Allow searching based on the modification time of + files, in minutes. + +config BUSYBOX_CONFIG_FEATURE_FIND_PERM + bool "Enable permissions matching (-perm) option" + default y + depends on BUSYBOX_CONFIG_FIND + help + Enable searching based on file permissions. + +config BUSYBOX_CONFIG_FEATURE_FIND_TYPE + bool "Enable filetype matching (-type) option" + default y + depends on BUSYBOX_CONFIG_FIND + help + Enable searching based on file type (file, + directory, socket, device, etc.). + +config BUSYBOX_CONFIG_FEATURE_FIND_XDEV + bool "Enable stay in filesystem (-xdev) option" + default y + depends on BUSYBOX_CONFIG_FIND + help + This option will allow find to restrict searches to a single + filesystem. + +config BUSYBOX_CONFIG_FEATURE_FIND_NEWER + bool "Enable -newer option for comparing file mtimes" + default n + depends on BUSYBOX_CONFIG_FIND + help + Support the 'find -newer' option for finding any files which have + a modified time that is more recent than the specified FILE. + +config BUSYBOX_CONFIG_FEATURE_FIND_INUM + bool "Enable inode number matching (-inum) option" + default n + depends on BUSYBOX_CONFIG_FIND + help + Support the 'find -inum' option for searching by inode number. + +config BUSYBOX_CONFIG_FEATURE_FIND_EXEC + bool "Enable (-exec) option allowing execution of commands" + default y + depends on BUSYBOX_CONFIG_FIND + help + Support the 'find -exec' option for executing commands based upon + the files matched. + +config BUSYBOX_CONFIG_GREP + bool "grep" + default y + help + grep is used to search files for a specified pattern. + +config BUSYBOX_CONFIG_FEATURE_GREP_EGREP_ALIAS + bool "Support extended regular expressions (egrep & grep -E)" + default y + depends on BUSYBOX_CONFIG_GREP + help + Enabled support for extended regular expressions. Extended + regular expressions allow for alternation (foo|bar), grouping, + and various repetition operators. + +config BUSYBOX_CONFIG_FEATURE_GREP_FGREP_ALIAS + bool "Alias fgrep to grep -F" + default y + depends on BUSYBOX_CONFIG_GREP + help + fgrep sees the search pattern as a normal string rather than + regular expressions. + grep -F is always builtin, this just creates the fgrep alias. + +config BUSYBOX_CONFIG_FEATURE_GREP_CONTEXT + bool "Enable before and after context flags (-A, -B and -C)" + default y + depends on BUSYBOX_CONFIG_GREP + help + Print the specified number of leading (-B) and/or trailing (-A) + context surrounding our matching lines. + Print the specified number of context lines (-C). + +config BUSYBOX_CONFIG_XARGS + bool "xargs" + default y + help + xargs is used to execute a specified command on + every item from standard input. + +config BUSYBOX_CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION + bool "Enable prompt and confirmation option -p" + default y + depends on BUSYBOX_CONFIG_XARGS + help + Support prompt the user about whether to run each command + line and read a line from the terminal. + +config BUSYBOX_CONFIG_FEATURE_XARGS_SUPPORT_QUOTES + bool "Enable support single and double quotes and backslash" + default y + depends on BUSYBOX_CONFIG_XARGS + help + Default xargs unsupport single and double quotes + and backslash for can use aruments with spaces. + +config BUSYBOX_CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT + bool "Enable support options -x" + default y + depends on BUSYBOX_CONFIG_XARGS + help + Enable support exit if the size (see the -s or -n option) + is exceeded. + +config BUSYBOX_CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM + bool "Enable options -0" + default y + depends on BUSYBOX_CONFIG_XARGS + help + Enable input filenames are terminated by a null character + instead of by whitespace, and the quotes and backslash + are not special. + +endmenu diff --git a/package/busybox/config/init/Config.in b/package/busybox/config/init/Config.in new file mode 100644 index 0000000000..3696f7017f --- /dev/null +++ b/package/busybox/config/init/Config.in @@ -0,0 +1,83 @@ +# +# For a description of the syntax of this configuration file, +# see scripts/kbuild/config-language.txt. +# + +menu "Init Utilities" + +config BUSYBOX_CONFIG_INIT + bool "init" + default y + help + init is the first program run when the system boots. + +config BUSYBOX_CONFIG_DEBUG_INIT + bool "debugging aid" + default n + depends on BUSYBOX_CONFIG_INIT + help + Turn this on to disable all the dangerous + rebooting stuff when debugging. + +config BUSYBOX_CONFIG_FEATURE_USE_INITTAB + bool "Support reading an inittab file" + default y + depends on BUSYBOX_CONFIG_INIT + help + Allow init to read an inittab file when the system boot. + +config BUSYBOX_CONFIG_FEATURE_INIT_SCTTY + bool "Support running commands with a controlling-tty" + default n + depends on BUSYBOX_CONFIG_INIT + help + If this option is enabled a command starting with hyphen (-) + is run in its own session (setsid(2)) and possibly with a + controlling tty (TIOCSCTTY). This is not the traditional init + behavour, but is often what you want in an embedded system where + the console is only accessed during development or for maintenance. + +config BUSYBOX_CONFIG_FEATURE_EXTRA_QUIET + bool "Be _extra_ quiet on boot" + default n + depends on BUSYBOX_CONFIG_INIT + help + Prevent init from logging some messages to the console during boot. + +config BUSYBOX_CONFIG_FEATURE_INIT_COREDUMPS + bool "Support dumping core for child processes (debugging only)" + default n + depends on BUSYBOX_CONFIG_INIT + help + If this option is enabled and the file /.init_enable_core + exists, then init will call setrlimit() to allow unlimited + core file sizes. If this option is disabled, processes + will not generate any core files. + + + +config BUSYBOX_CONFIG_FEATURE_INITRD + bool "Support running init from within an initrd (not initramfs)" + default n + depends on BUSYBOX_CONFIG_INIT + help + Legacy support for running init under the old-style initrd. Allows + the name linuxrc to act as init, and it doesn't assume init is PID 1. + + This does not apply to initramfs, which runs /init as PID 1 and + requires no special support. + +config BUSYBOX_CONFIG_HALT + bool "poweroff, halt, and reboot" + default y + help + Stop all processes and either halt, reboot, or power off the system. + +config BUSYBOX_CONFIG_MESG + bool "mesg" + default y + help + Mesg controls access to your terminal by others. It is typically + used to allow or disallow other users to write to your terminal + +endmenu diff --git a/package/busybox/config/libbb/Config.in b/package/busybox/config/libbb/Config.in new file mode 100644 index 0000000000..7d84a75962 --- /dev/null +++ b/package/busybox/config/libbb/Config.in @@ -0,0 +1,22 @@ +# +# For a description of the syntax of this configuration file, +# see scripts/kbuild/config-language.txt. +# + +menu "Busybox Library Tuning" + +config BUSYBOX_CONFIG_MD5_SIZE_VS_SPEED + int " MD5: Trade Bytes for Speed" + default 2 + range 0 3 + help + Trade binary size versus speed for the md5sum algorithm. + Approximate values running uClibc and hashing + linux-2.4.4.tar.bz2 were: + user times (sec) text size (386) + 0 (fastest) 1.1 6144 + 1 1.4 5392 + 2 3.0 5088 + 3 (smallest) 5.1 4912 + +endmenu diff --git a/package/busybox/config/loginutils/Config.in b/package/busybox/config/loginutils/Config.in new file mode 100644 index 0000000000..33a764e35c --- /dev/null +++ b/package/busybox/config/loginutils/Config.in @@ -0,0 +1,163 @@ +# +# For a description of the syntax of this configuration file, +# see scripts/kbuild/config-language.txt. +# + +menu "Login/Password Management Utilities" + +config BUSYBOX_CONFIG_FEATURE_SHADOWPASSWDS + bool "Support for shadow passwords" + default n + help + Build support for shadow password in /etc/shadow. This file is only + readable by root and thus the encrypted passwords are no longer + publicly readable. + +config BUSYBOX_CONFIG_USE_BB_SHADOW + bool #" Use busybox shadow password functions" + default n + depends on BUSYBOX_CONFIG_USE_BB_PWD_GRP && BUSYBOX_CONFIG_FEATURE_SHADOWPASSWDS + help + If you leave this disabled, busybox will use the system's shadow + password handling functions. And if you are using the GNU C library + (glibc), you will then need to install the /etc/nsswitch.conf + configuration file and the required /lib/libnss_* libraries in + order for the shadow password functions to work. This generally + makes your embedded system quite a bit larger. + + Enabling this option will cause busybox to directly access the + system's /etc/shadow file when handling shadow passwords. This + makes your system smaller and I will get fewer emails asking about + how glibc NSS works). When this option is enabled, you will not be + able to use PAM to access shadow passwords from remote LDAP + password servers and whatnot. + +config BUSYBOX_CONFIG_USE_BB_PWD_GRP + bool "Use internal password and group functions rather than system functions" + default n + help + If you leave this disabled, busybox will use the system's password + and group functions. And if you are using the GNU C library + (glibc), you will then need to install the /etc/nsswitch.conf + configuration file and the required /lib/libnss_* libraries in + order for the password and group functions to work. This generally + makes your embedded system quite a bit larger. + + Enabling this option will cause busybox to directly access the + system's /etc/password, /etc/group files (and your system will be + smaller, and I will get fewer emails asking about how glibc NSS + works). When this option is enabled, you will not be able to use + PAM to access remote LDAP password servers and whatnot. And if you + want hostname resolution to work with glibc, you still need the + /lib/libnss_* libraries. + + If you enable this option, it will add about 1.5k to busybox. + +config BUSYBOX_CONFIG_ADDGROUP + bool "addgroup" + default n + help + Utility for creating a new group account. + +config BUSYBOX_CONFIG_DELGROUP + bool "delgroup" + default n + help + Utility for deleting a group account. + +config BUSYBOX_CONFIG_ADDUSER + bool "adduser" + default n + help + Utility for creating a new user account. + +config BUSYBOX_CONFIG_DELUSER + bool "deluser" + default n + help + Utility for deleting a user account. + +config BUSYBOX_CONFIG_GETTY + bool "getty" + default n + help + getty lets you log in on a tty, it is normally invoked by init. + +config BUSYBOX_CONFIG_FEATURE_UTMP + bool "Support utmp file" + depends on BUSYBOX_CONFIG_GETTY || BUSYBOX_CONFIG_LOGIN || BUSYBOX_CONFIG_SU || BUSYBOX_CONFIG_WHO + default n + help + The file /var/run/utmp is used to track who is currently logged in. + +config BUSYBOX_CONFIG_FEATURE_WTMP + bool "Support wtmp file" + depends on BUSYBOX_CONFIG_GETTY || BUSYBOX_CONFIG_LOGIN || BUSYBOX_CONFIG_SU || BUSYBOX_CONFIG_LAST + default n + select BUSYBOX_CONFIG_FEATURE_UTMP + help + The file /var/run/wtmp is used to track when user's have logged into + and logged out of the system. + +config BUSYBOX_CONFIG_LOGIN + bool "login" + default n + select BUSYBOX_CONFIG_FEATURE_SUID + help + login is used when signing onto a system. + + Note that Busybox binary must be setuid root for this applet to + work properly. + +config BUSYBOX_CONFIG_FEATURE_SECURETTY + bool "Support for /etc/securetty" + default n + depends on BUSYBOX_CONFIG_LOGIN + help + The file /etc/securetty is used by (some versions of) login(1). + The file contains the device names of tty lines (one per line, + without leading /dev/) on which root is allowed to login. + +config BUSYBOX_CONFIG_PASSWD + bool "passwd" + default y + select BUSYBOX_CONFIG_FEATURE_SUID + help + passwd changes passwords for user and group accounts. A normal user + may only change the password for his/her own account, the super user + may change the password for any account. The administrator of a group + may change the password for the group. + + Note that Busybox binary must be setuid root for this applet to + work properly. + +config BUSYBOX_CONFIG_SU + bool "su" + default n + select BUSYBOX_CONFIG_FEATURE_SUID + help + su is used to become another user during a login session. + Invoked without a username, su defaults to becoming the super user. + + Note that Busybox binary must be setuid root for this applet to + work properly. + +config BUSYBOX_CONFIG_SULOGIN + bool "sulogin" + default n + help + sulogin is invoked when the system goes into single user + mode (this is done through an entry in inittab). + +config BUSYBOX_CONFIG_VLOCK + bool "vlock" + default n + select BUSYBOX_CONFIG_FEATURE_SUID + help + Build the "vlock" applet which allows you to lock (virtual) terminals. + + Note that Busybox binary must be setuid root for this applet to + work properly. + +endmenu + diff --git a/package/busybox/config/miscutils/Config.in b/package/busybox/config/miscutils/Config.in new file mode 100644 index 0000000000..407503dc40 --- /dev/null +++ b/package/busybox/config/miscutils/Config.in @@ -0,0 +1,346 @@ +# +# For a description of the syntax of this configuration file, +# see scripts/kbuild/config-language.txt. +# + +menu "Miscellaneous Utilities" + +config BUSYBOX_CONFIG_ADJTIMEX + bool "adjtimex" + default n + help + Adjtimex reads and optionally sets adjustment parameters for + the Linux clock adjustment algorithm. + +config BUSYBOX_CONFIG_BBCONFIG + bool "bbconfig" + default n + help + The bbconfig applet will print the config file with which + busybox was built. + +config BUSYBOX_CONFIG_CROND + bool "crond" + default y + select BUSYBOX_CONFIG_FEATURE_SUID + help + Crond is a background daemon that parses individual crontab + files and executes commands on behalf of the users in question. + This is a port of dcron from slackware. It uses files of the + format /var/spool/cron/crontabs/<username> files, for example: + $ cat /var/spool/cron/crontabs/root + # Run daily cron jobs at 4:40 every day: + 40 4 * * * /etc/cron/daily > /dev/null 2>&1 + Note that Busybox binary must be setuid root for this applet to + work properly. + +config BUSYBOX_CONFIG_DEBUG_CROND_OPTION + bool "Support debug option -d" + depends on BUSYBOX_CONFIG_CROND + default n + help + Support option -d to enter debug mode. + +config BUSYBOX_CONFIG_FEATURE_CROND_CALL_SENDMAIL + bool "Using /usr/sbin/sendmail?" + default n + depends on BUSYBOX_CONFIG_CROND + help + Support calling /usr/sbin/sendmail for send cmd outputs. + +config BUSYBOX_CONFIG_CRONTAB + bool "crontab" + default y + select BUSYBOX_CONFIG_FEATURE_SUID + help + Crontab manipulates the crontab for a particular user. Only + the superuser may specify a different user and/or crontab directory. + +config BUSYBOX_CONFIG_DC + bool "dc" + default n + help + Dc is a reverse-polish desk calculator which supports unlimited + precision arithmetic. + +config BUSYBOX_CONFIG_DEVFSD + bool "devfsd (obsolete)" + default n + help + This is deprecated, and will be going away in a future release. + + Provides compatibility with old device names on a devfs systems. + You should set it to true if you have devfs enabled. + The following keywords in devsfd.conf are supported: + "CLEAR_CONFIG", "INCLUDE", "OPTIONAL_INCLUDE", "RESTORE", + "PERMISSIONS", "EXECUTE", "COPY", "IGNORE", + "MKOLDCOMPAT", "MKNEWCOMPAT","RMOLDCOMPAT", "RMNEWCOMPAT". + + But only if they are written UPPERCASE!!!!!!!! + +config BUSYBOX_CONFIG_DEVFSD_MODLOAD + bool "Adds support for MODLOAD keyword in devsfd.conf" + default n + depends on BUSYBOX_CONFIG_DEVFSD + help + This actually doesn't work with busybox modutils but needs + the external modutils. + +config BUSYBOX_CONFIG_DEVFSD_FG_NP + bool "Enables the -fg and -np options" + default n + depends on BUSYBOX_CONFIG_DEVFSD + help + -fg Run the daemon in the foreground. + -np Exit after parsing the configuration file. Do not poll for events. + +config BUSYBOX_CONFIG_DEVFSD_VERBOSE + bool "Increases logging (and size)" + default n + depends on BUSYBOX_CONFIG_DEVFSD + help + Increases logging to stderr or syslog. + +config BUSYBOX_CONFIG_FEATURE_DEVFS + bool " Use devfs names for all devices (obsolete)" + default y + help + This tells busybox to look for names like /dev/loop/0 instead of + /dev/loop0. If your /dev directory has normal names instead of + devfs names, you don't want this. + + This is obsolete and will be going away someday. Consider it + deprecated. + +config BUSYBOX_CONFIG_EJECT + bool "eject" + default n + help + Used to eject cdroms. (defaults to /dev/cdrom) + +config BUSYBOX_CONFIG_LAST + bool "last" + default n + select BUSYBOX_CONFIG_FEATURE_WTMP + help + 'last' displays a list of the last users that logged into the system. + +config BUSYBOX_CONFIG_LESS + bool "less" + default y + help + 'less' is a pager, meaning that it displays text files. It possesses + a wide array of features, and is an improvement over 'more'. + +config BUSYBOX_CONFIG_FEATURE_LESS_BRACKETS + bool "Enable bracket searching" + default n + depends on BUSYBOX_CONFIG_LESS + help + This option adds the capability to search for matching left and right + brackets, facilitating programming. + +config BUSYBOX_CONFIG_FEATURE_LESS_FLAGS + bool "Enable extra flags" + default n + depends on BUSYBOX_CONFIG_LESS + help + The extra flags provided do the following: + + The -M flag enables a more sophisticated status line. + The -m flag enables a simpler status line with a percentage. + +config BUSYBOX_CONFIG_FEATURE_LESS_FLAGCS + bool "Enable flag changes" + default n + depends on BUSYBOX_CONFIG_LESS + help + This enables the ability to change command-line flags within + less itself. + +config BUSYBOX_CONFIG_FEATURE_LESS_MARKS + bool "Enable marks" + default n + depends on BUSYBOX_CONFIG_LESS + help + Marks enable positions in a file to be stored for easy reference. + +config BUSYBOX_CONFIG_FEATURE_LESS_REGEXP + bool "Enable regular expressions" + default n + depends on BUSYBOX_CONFIG_LESS + help + Enable regular expressions, allowing complex file searches. + +config BUSYBOX_CONFIG_HDPARM + bool "hdparm" + default n + help + Get/Set hard drive parameters. Primarily intended for ATA + drives. Adds about 13k (or around 30k if you enable the + BUSYBOX_CONFIG_FEATURE_HDPARM_GET_IDENTITY option).... + +config BUSYBOX_CONFIG_FEATURE_HDPARM_GET_IDENTITY + bool "Support obtaining detailed information directly from drives" + default n + depends on BUSYBOX_CONFIG_HDPARM + help + Enables the -I and -i options to obtain detailed information + directly from drives about their capabilities and supported ATA + feature set. If no device name is specified, hdparm will read + identify data from stdin. Enabling this option will add about 16k... + +config BUSYBOX_CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF + bool "Register an IDE interface (DANGEROUS)" + default n + depends on BUSYBOX_CONFIG_HDPARM + help + Enables the 'hdparm -R' option to register an IDE interface. + This is dangerous stuff, so you should probably say N. + +config BUSYBOX_CONFIG_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF + bool "Un-register an IDE interface (DANGEROUS)" + default n + depends on BUSYBOX_CONFIG_HDPARM + help + Enables the 'hdparm -U' option to un-register an IDE interface. + This is dangerous stuff, so you should probably say N. + +config BUSYBOX_CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET + bool "perform device reset (DANGEROUS)" + default n + depends on BUSYBOX_CONFIG_HDPARM + help + Enables the 'hdparm -w' option to perform a device reset. + This is dangerous stuff, so you should probably say N. + +config BUSYBOX_CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF + bool "tristate device for hotswap (DANGEROUS)" + default n + depends on BUSYBOX_CONFIG_HDPARM + help + Enables the 'hdparm -x' option to tristate device for hotswap, + and the '-b' option to get/set bus state. This is dangerous + stuff, so you should probably say N. + +config BUSYBOX_CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA + bool "get/set using_dma flag (DANGEROUS)" + default n + depends on BUSYBOX_CONFIG_HDPARM + help + Enables the 'hdparm -d' option to get/set using_dma flag. + This is dangerous stuff, so you should probably say N. + +config BUSYBOX_CONFIG_LOCK + bool "lock" + default y + help + Small utility for using locks in scripts + +config BUSYBOX_CONFIG_MAKEDEVS + bool "makedevs" + default n + help + 'makedevs' is a utility used to create a batch of devices with + one command. + . + There are two choices for command line behaviour, the interface + as used by LEAF/Linux Router Project, or a device table file. + . + 'leaf' is traditionally what busybox follows, it allows multiple + devices of a particluar type to be created per command. + e.g. /dev/hda[0-9] + Device properties are passed as command line arguments. + . + 'table' reads device properties from a file or stdin, allowing + a batch of unrelated devices to be made with one command. + User/group names are allowed as an alternative to uid/gid. + +choice + prompt "Choose makedevs behaviour" + depends BUSYBOX_CONFIG_MAKEDEVS + default BUSYBOX_CONFIG_FEATURE_MAKEDEVS_TABLE + +config BUSYBOX_CONFIG_FEATURE_MAKEDEVS_LEAF + bool "leaf" + +config BUSYBOX_CONFIG_FEATURE_MAKEDEVS_TABLE + bool "table" + +endchoice + +config BUSYBOX_CONFIG_MOUNTPOINT + bool "mountpoint" + default n + help + mountpoint checks if the directory is a mountpoint. + +config BUSYBOX_CONFIG_MT + bool "mt" + default n + help + mt is used to control tape devices. You can use the mt utility + to advance or rewind a tape past a specified number of archive + files on the tape. + +config BUSYBOX_CONFIG_RUNLEVEL + bool "runlevel" + default n + help + find the current and previous system runlevel. + + This applet uses utmp but does not rely on busybox supporing + utmp on purpose. It is used by e.g. emdebian via /etc/init.d/rc. + +config BUSYBOX_CONFIG_RX + bool "rx" + default n + help + Receive files using the Xmodem protocol. + +config BUSYBOX_CONFIG_STRINGS + bool "strings" + default y + help + strings prints the printable character sequences for each file + specified. + +config BUSYBOX_CONFIG_SETSID + bool "setsid" + default n + help + setsid runs a program in a new session + +config BUSYBOX_CONFIG_TASKSET + bool "taskset" + default n + help + Retrieve or set a processes's CPU affinity + +config BUSYBOX_CONFIG_TASKSET + bool "taskset" + default n + help + Retrieve or set a processes's CPU affinity (on linux) + +config BUSYBOX_CONFIG_TIME + bool "time" + default y + help + The time command runs the specified program with the given arguments. + When the command finishes, time writes a message to standard output + giving timing statistics about this program run. + +config BUSYBOX_CONFIG_WATCHDOG + bool "watchdog" + default y + help + The watchdog utility is used with hardware or software watchdog + device drivers. It opens the specified watchdog device special file + and periodically writes a magic character to the device. If the + watchdog applet ever fails to write the magic character within a + certain amount of time, the watchdog device assumes the system has + hung, and will cause the hardware to reboot. + +endmenu + diff --git a/package/busybox/config/modutils/Config.in b/package/busybox/config/modutils/Config.in new file mode 100644 index 0000000000..4441632e85 --- /dev/null +++ b/package/busybox/config/modutils/Config.in @@ -0,0 +1,147 @@ +# +# For a description of the syntax of this configuration file, +# see scripts/kbuild/config-language.txt. +# + +menu "Linux Module Utilities" + +config BUSYBOX_CONFIG_INSMOD + bool "insmod" + default y + help + insmod is used to load specified modules in the running kernel. + +config BUSYBOX_CONFIG_FEATURE_INSMOD_VERSION_CHECKING + bool "Module version checking" + default n + depends on BUSYBOX_CONFIG_INSMOD && BUSYBOX_CONFIG_FEATURE_2_4_MODULES + help + Support checking of versions for modules. This is used to + ensure that the kernel and module are made for each other. + +config BUSYBOX_CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS + bool "Add module symbols to kernel symbol table" + default n + depends on BUSYBOX_CONFIG_INSMOD && BUSYBOX_CONFIG_FEATURE_2_4_MODULES + help + By adding module symbols to the kernel symbol table, Oops messages + occuring within kernel modules can be properly debugged. By enabling + this feature, module symbols will always be added to the kernel symbol + table for properly debugging support. If you are not interested in + Oops messages from kernel modules, say N. + +config BUSYBOX_CONFIG_FEATURE_INSMOD_LOADINKMEM + bool "In kernel memory optimization (uClinux only)" + default n + depends on BUSYBOX_CONFIG_INSMOD && BUSYBOX_CONFIG_FEATURE_2_4_MODULES + help + This is a special uClinux only memory optimization that lets insmod + load the specified kernel module directly into kernel space, reducing + memory usage by preventing the need for two copies of the module + being loaded into memory. + +config BUSYBOX_CONFIG_FEATURE_INSMOD_LOAD_MAP + bool "Enable load map (-m) option" + default n + depends on BUSYBOX_CONFIG_INSMOD && BUSYBOX_CONFIG_FEATURE_2_4_MODULES + help + Enabling this, one would be able to get a load map + output on stdout. This makes kernel module debugging + easier. + If you don't plan to debug kernel modules, you + don't need this option. + +config BUSYBOX_CONFIG_FEATURE_INSMOD_LOAD_MAP_FULL + bool "Symbols in load map" + default n + depends on BUSYBOX_CONFIG_FEATURE_INSMOD_LOAD_MAP + help + Without this option, -m will only output section + load map. With this option, -m will also output + symbols load map. + +config BUSYBOX_CONFIG_RMMOD + bool "rmmod" + default y + help + rmmod is used to unload specified modules from the kernel. + +config BUSYBOX_CONFIG_LSMOD + bool "lsmod" + default y + help + lsmod is used to display a list of loaded modules. + +config BUSYBOX_CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT + bool "lsmod pretty output for 2.6.x Linux kernels " + default n + depends on BUSYBOX_CONFIG_LSMOD + help + This option makes output format of lsmod adjusted to + the format of module-init-tools for Linux kernel 2.6. + +config BUSYBOX_CONFIG_MODPROBE + bool "modprobe" + default n + help + Handle the loading of modules, and their dependencies on a high + level. + + Note that in the state, modprobe does not understand multiple + module options from the configuration file. See option below. + +config BUSYBOX_CONFIG_FEATURE_MODPROBE_MULTIPLE_OPTIONS + bool "Multiple options parsing" + default n + depends on BUSYBOX_CONFIG_MODPROBE + help + Allow modprobe to understand more than one option to pass to + modules. + + This is a WIP, while waiting for a common argument parsing + common amongst all BB applets (shell, modprobe, etc...) and + adds around 600 bytes on x86, 700 bytes on ARM. The code is + biggish and uggly, but just works. + + Saying Y here is not a bad idea if you're not that short + on storage capacity. + +comment "Options common to multiple modutils" + depends on BUSYBOX_CONFIG_INSMOD || BUSYBOX_CONFIG_RMMOD || BUSYBOX_CONFIG_MODPROBE || BUSYBOX_CONFIG_LSMOD + +config BUSYBOX_CONFIG_FEATURE_CHECK_TAINTED_MODULE + # Simulate indentation + bool "Support tainted module checking with new kernels" + default y + depends on BUSYBOX_CONFIG_INSMOD || BUSYBOX_CONFIG_LSMOD + help + Support checking for tainted modules. These are usually binary + only modules that will make the linux-kernel list ignore your + support request. + This option is required to support GPLONLY modules. + +config BUSYBOX_CONFIG_FEATURE_2_4_MODULES + # Simulate indentation + bool "Support version 2.2.x to 2.4.x Linux kernels" + default y + depends on BUSYBOX_CONFIG_INSMOD || BUSYBOX_CONFIG_RMMOD + help + Support module loading for 2.2.x and 2.4.x Linux kernels. + +config BUSYBOX_CONFIG_FEATURE_2_6_MODULES + # Simulate indentation + bool "Support version 2.6.x Linux kernels" + default y + depends on BUSYBOX_CONFIG_INSMOD || BUSYBOX_CONFIG_RMMOD || BUSYBOX_CONFIG_MODPROBE + help + Support module loading for newer 2.6.x Linux kernels. + + +config BUSYBOX_CONFIG_FEATURE_QUERY_MODULE_INTERFACE + bool + default n + depends on BUSYBOX_CONFIG_FEATURE_2_4_MODULES && !CONFIG_FEATURE_2_6_MODULES + + +endmenu + diff --git a/package/busybox/config/networking/Config.in b/package/busybox/config/networking/Config.in new file mode 100644 index 0000000000..3e0cbc95d4 --- /dev/null +++ b/package/busybox/config/networking/Config.in @@ -0,0 +1,710 @@ +# +# For a description of the syntax of this configuration file, +# see scripts/kbuild/config-language.txt. +# + +menu "Networking Utilities" + +config BUSYBOX_CONFIG_FEATURE_IPV6 + bool "Enable IPv6 support" + default y + help + Enable IPv6 support in busybox. + This adds IPv6 support in the networking applets. + +config BUSYBOX_CONFIG_ARPING + bool "arping" + default y + help + Ping hosts by ARP packets + +config BUSYBOX_CONFIG_DNSD + bool "dnsd" + default n + help + Small and static DNS server daemon. + +config BUSYBOX_CONFIG_ETHER_WAKE + bool "ether-wake" + default n + help + Send a magic packet to wake up sleeping machines. + +config BUSYBOX_CONFIG_FAKEIDENTD + bool "fakeidentd" + default n + help + fakeidentd listens on the ident port and returns a predefined + fake value on any query. + +config BUSYBOX_CONFIG_FTPGET + bool "ftpget" + default n + help + Retrieve a remote file via FTP. + +config BUSYBOX_CONFIG_FTPPUT + bool "ftpput" + default n + help + Store a remote file via FTP. + +config BUSYBOX_CONFIG_FEATURE_FTPGETPUT_LONG_OPTIONS + bool "Enable long options in ftpget/ftpput" + default n + depends on BUSYBOX_CONFIG_GETOPT_LONG && (CONFIG_FTPGET || BUSYBOX_CONFIG_FTPPUT) + help + Support long options for the ftpget/ftpput applet. + +config BUSYBOX_CONFIG_HOSTNAME + bool "hostname" + default n + help + Show or set the system's host name + +config BUSYBOX_CONFIG_HTTPD + bool "httpd" + default y + help + Serve web pages via an HTTP server. + +config BUSYBOX_CONFIG_FEATURE_HTTPD_WITHOUT_INETD + bool "Support using httpd as a daemon (not from inetd)" + default y + depends on BUSYBOX_CONFIG_HTTPD + help + This option enables uid and port options for the httpd applet, + and eliminates the need to be called from the inetd server daemon. + +config BUSYBOX_CONFIG_FEATURE_HTTPD_RELOAD_CONFIG_SIGHUP + bool "Support reloading the global config file using hup signal" + default n + depends on BUSYBOX_CONFIG_HTTPD && BUSYBOX_CONFIG_FEATURE_HTTPD_WITHOUT_INETD + help + This option enables processing of SIGHUP to reload cached + configuration settings. + +config BUSYBOX_CONFIG_FEATURE_HTTPD_SETUID + bool "Enable support -u <user> option" + default n + depends on BUSYBOX_CONFIG_HTTPD && BUSYBOX_CONFIG_FEATURE_HTTPD_WITHOUT_INETD + help + This option allows the server to run as a specific user + rather than defaulting to the user that starts the server. + Use of this option requires special privileges to change to a + different user. + +config BUSYBOX_CONFIG_FEATURE_HTTPD_BASIC_AUTH + bool "Enable Basic http Authentication" + default y + depends on BUSYBOX_CONFIG_HTTPD + help + Utilizes password settings from /etc/httpd.conf for basic + authentication on a per url basis. + +config BUSYBOX_CONFIG_FEATURE_HTTPD_AUTH_MD5 + bool "Support MD5 crypted passwords for http Authentication" + default y + depends on BUSYBOX_CONFIG_FEATURE_HTTPD_BASIC_AUTH + help + Enables basic per URL authentication from /etc/httpd.conf + using md5 passwords. + +config BUSYBOX_CONFIG_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES + bool "Support loading additional MIME types at run-time" + default y + depends on BUSYBOX_CONFIG_HTTPD + help + This option enables support for additional MIME types at + run-time to be specified in the configuration file. + +config BUSYBOX_CONFIG_FEATURE_HTTPD_CGI + bool "Support Common Gateway Interface (CGI)" + default y + depends on BUSYBOX_CONFIG_HTTPD + help + This option allows scripts and executables to be invoked + when specific URLs are requested. + +config BUSYBOX_CONFIG_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR + bool "Enable support for running scripts through an interpreter" + default n + depends on BUSYBOX_CONFIG_FEATURE_HTTPD_CGI + help + This option enables support for running scripts through an + interpreter. Turn this on if you want PHP scripts to work + properly. You need to supply an addition line in your httpd + config file: + *.php:/path/to/your/php + +config BUSYBOX_CONFIG_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV + bool "Support the REMOTE_PORT environment variable for CGI" + default y + depends on BUSYBOX_CONFIG_FEATURE_HTTPD_CGI + help + Use of this option can assist scripts in generating + references that contain a unique port number. + +config BUSYBOX_CONFIG_FEATURE_HTTPD_ENCODE_URL_STR + bool "Enable the -e option for shell script CGI simplification." + default y + depends on BUSYBOX_CONFIG_HTTPD + help + This option allows html encoding arbitrary + strings for display of the browser. Output goes to stdout. + For example, httpd -e "<Hello World>" as + "<Hello World>". + +config BUSYBOX_CONFIG_IFCONFIG + bool "ifconfig" + default y + help + Ifconfig is used to configure the kernel-resident network interfaces. + +config BUSYBOX_CONFIG_FEATURE_IFCONFIG_STATUS + bool "Enable status reporting output (+7k)" + default y + depends on BUSYBOX_CONFIG_IFCONFIG + help + If ifconfig is called with no arguments it will display the status + of the currently active interfaces. + +config BUSYBOX_CONFIG_FEATURE_IFCONFIG_SLIP + bool "Enable slip-specific options \"keepalive\" and \"outfill\"" + default n + depends on BUSYBOX_CONFIG_IFCONFIG + help + Allow "keepalive" and "outfill" support for SLIP. If you're not + planning on using serial lines, leave this unchecked. + +config BUSYBOX_CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ + bool "Enable options \"mem_start\", \"io_addr\", and \"irq\"" + default n + depends on BUSYBOX_CONFIG_IFCONFIG + help + Allow the start address for shared memory, start address for I/O, + and/or the interrupt line used by the specified device. + +config BUSYBOX_CONFIG_FEATURE_IFCONFIG_HW + bool "Enable option \"hw\" (ether only)" + default y + depends on BUSYBOX_CONFIG_IFCONFIG + help + Set the hardware address of this interface, if the device driver + supports this operation. Currently, we only support the 'ether' + class. + +config BUSYBOX_CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS + bool "Set the broadcast automatically" + default y + depends on BUSYBOX_CONFIG_IFCONFIG + help + Setting this will make ifconfig attempt to find the broadcast + automatically if the value '+' is used. + +config BUSYBOX_CONFIG_IFUPDOWN + bool "ifupdown" + default n + select BUSYBOX_CONFIG_RUN_PARTS + help + Activate or deactivate the specified interfaces. This applet makes + use of either "ifconfig" and "route" or the "ip" command to actually + configure network interfaces. Therefore, you will probably also want + to enable either BUSYBOX_CONFIG_IFCONFIG and BUSYBOX_CONFIG_ROUTE, or enable + BUSYBOX_CONFIG_FEATURE_IFUPDOWN_IP and the various BUSYBOX_CONFIG_IP options. Of + course you could use non-busybox versions of these programs, so + against my better judgement (since this will surely result in plenty + of support questions on the mailing list), I do not force you to + enable these additional options. It is up to you to supply either + "ifconfig" and "route" or the "ip" command, either via busybox or via + standalone utilities. + +config BUSYBOX_CONFIG_FEATURE_IFUPDOWN_IP + bool "Use ip applet" + default n + depends on BUSYBOX_CONFIG_IFUPDOWN + help + Use the iproute "ip" command to implement "ifup" and "ifdown", rather + than the default of using the older 'ifconfig' and 'route' utilities. + +config BUSYBOX_CONFIG_FEATURE_IFUPDOWN_IP_BUILTIN + bool "Use busybox ip applet" + default n + depends on BUSYBOX_CONFIG_FEATURE_IFUPDOWN_IP + select BUSYBOX_CONFIG_IP + select BUSYBOX_CONFIG_FEATURE_IP_ADDRESS + select BUSYBOX_CONFIG_FEATURE_IP_LINK + select BUSYBOX_CONFIG_FEATURE_IP_ROUTE + help + Use the busybox iproute "ip" applet to implement "ifupdown". + + If leave this disabled, you must install the full-blown iproute2 + utility or the "ifup" and "ifdown" applets will not work. + +config BUSYBOX_CONFIG_FEATURE_IFUPDOWN_IP_BUILTIN + bool "Use busybox ifconfig and route applets" + default n + depends on BUSYBOX_CONFIG_IFUPDOWN && !CONFIG_FEATURE_IFUPDOWN_IP + select BUSYBOX_CONFIG_IFCONFIG + select BUSYBOX_CONFIG_ROUTE + help + Use the busybox iproute "ifconfig" and "route" applets to + implement the "ifup" and "ifdown" utilities. + + If leave this disabled, you must install the full-blown ifconfig + and route utilities, or the "ifup" and "ifdown" applets will not + work. + +config BUSYBOX_CONFIG_FEATURE_IFUPDOWN_IPV4 + bool "Enable support for IPv4" + default n + depends on BUSYBOX_CONFIG_IFUPDOWN + help + If you want busybox to talk IPv4, leave this on. + +config BUSYBOX_CONFIG_FEATURE_IFUPDOWN_IPV6 + bool "Enable support for IPv6" + default n + depends on BUSYBOX_CONFIG_IFUPDOWN && BUSYBOX_CONFIG_FEATURE_IPV6 + help + If you need support for IPv6, turn this option on. + +config BUSYBOX_CONFIG_FEATURE_IFUPDOWN_IPX + bool "Enable support for IPX" + default n + depends on BUSYBOX_CONFIG_IFUPDOWN + help + If this option is selected you can use busybox to work with IPX + networks. + +config BUSYBOX_CONFIG_FEATURE_IFUPDOWN_MAPPING + bool "Enable mapping support" + default n + depends on BUSYBOX_CONFIG_IFUPDOWN + help + This enables support for the "mapping" stanza, unless you have + a weird network setup you don't need it. + +config BUSYBOX_CONFIG_INETD + bool "inetd" + default n + help + Internet superserver daemon + +config BUSYBOX_CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_ECHO + bool "Support echo service" + default n + depends on BUSYBOX_CONFIG_INETD + help + Echo received data internal inetd service + +config BUSYBOX_CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DISCARD + bool "Support discard service" + default n + depends on BUSYBOX_CONFIG_INETD + help + Internet /dev/null internal inetd service + +config BUSYBOX_CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_TIME + bool "Support time service" + default n + depends on BUSYBOX_CONFIG_INETD + help + Return 32 bit time since 1900 internal inetd service + +config BUSYBOX_CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DAYTIME + bool "Support daytime service" + default n + depends on BUSYBOX_CONFIG_INETD + help + Return human-readable time internal inetd service + +config BUSYBOX_CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN + bool "Support chargen service" + default n + depends on BUSYBOX_CONFIG_INETD + help + Familiar character generator internal inetd service + +config BUSYBOX_CONFIG_FEATURE_INETD_RPC + bool "Support RPC services" + default n + depends on BUSYBOX_CONFIG_INETD + help + Suuport Sun-RPC based services + + +config BUSYBOX_CONFIG_IP + bool "ip" + default n + help + The "ip" applet is a TCP/IP interface configuration and routing + utility. You generally don't need "ip" to use busybox with + TCP/IP. + +config BUSYBOX_CONFIG_FEATURE_IP_ADDRESS + bool "ip address" + default n + depends on BUSYBOX_CONFIG_IP + help + Address manipulation support for the "ip" applet. + +config BUSYBOX_CONFIG_FEATURE_IP_LINK + bool "ip link" + default n + depends on BUSYBOX_CONFIG_IP + help + Configure network devices with "ip". + +config BUSYBOX_CONFIG_FEATURE_IP_ROUTE + bool "ip route" + default n + depends on BUSYBOX_CONFIG_IP + help + Add support for routing table management to "ip". + +config BUSYBOX_CONFIG_FEATURE_IP_TUNNEL + bool "ip tunnel" + default n + depends on BUSYBOX_CONFIG_IP + help + Add support for tunneling commands to "ip". + +config BUSYBOX_CONFIG_FEATURE_IP_SHORT_FORMS + bool "Support short forms of ip commands." + default n + depends on BUSYBOX_CONFIG_IP + help + Also support short-form of ip <OBJECT> commands: + ip addr -> ipaddr + ip link -> iplink + ip route -> iproute + ip tunnel -> iptunnel + + Say N unless you desparately need the short form of the ip + object commands. + +config BUSYBOX_CONFIG_IPADDR + bool + default n + depends on BUSYBOX_CONFIG_FEATURE_IP_SHORT_FORMS && BUSYBOX_CONFIG_FEATURE_IP_ADDRESS + +config BUSYBOX_CONFIG_IPLINK + bool + default n + depends on BUSYBOX_CONFIG_FEATURE_IP_SHORT_FORMS && BUSYBOX_CONFIG_FEATURE_IP_LINK + +config BUSYBOX_CONFIG_IPROUTE + bool + default n + depends on BUSYBOX_CONFIG_FEATURE_IP_SHORT_FORMS && BUSYBOX_CONFIG_FEATURE_IP_ROUTE + +config BUSYBOX_CONFIG_IPTUNNEL + bool + default n + depends on BUSYBOX_CONFIG_FEATURE_IP_SHORT_FORMS && BUSYBOX_CONFIG_FEATURE_IP_TUNNEL + +config BUSYBOX_CONFIG_IPCALC + bool "ipcalc" + default n + help + ipcalc takes an IP address and netmask and calculates the + resulting broadcast, network, and host range. + +config BUSYBOX_CONFIG_FEATURE_IPCALC_FANCY + bool "Fancy IPCALC, more options, adds 1 kbyte" + default n + depends on BUSYBOX_CONFIG_IPCALC + help + Adds the options hostname, prefix and silent to the output of "ipcalc". + +config BUSYBOX_CONFIG_FEATURE_IPCALC_LONG_OPTIONS + bool "Enable long options" + default n + depends on BUSYBOX_CONFIG_IPCALC && BUSYBOX_CONFIG_GETOPT_LONG + help + Support long options for the ipcalc applet. + +config BUSYBOX_CONFIG_NAMEIF + bool "nameif" + default n + help + nameif is used to rename network interface by its MAC address. + Renamed interfaces MUST be in the down state. + It is possible to use a file (default: /etc/mactab) + with list of new interface names and MACs. + Maximum interface name length: IF_NAMESIZE = 16 + File fields are separated by space or tab. + File format: + # Comment + new_interface_name XX:XX:XX:XX:XX:XX + +config BUSYBOX_CONFIG_NC + bool "nc" + default y + help + A simple Unix utility which reads and writes data across network + connections. + +config BUSYBOX_CONFIG_NETMSG + bool "netmsg" + default y + help + simple program for sending udp broadcast messages + +config BUSYBOX_CONFIG_NC_GAPING_SECURITY_HOLE + bool "gaping security hole" + default n + depends on BUSYBOX_CONFIG_NC + help + Add support for executing a program after making or receiving a + successful connection (-e option). + +config BUSYBOX_CONFIG_NETSTAT + bool "netstat" + default y + help + netstat prints information about the Linux networking subsystem. + +config BUSYBOX_CONFIG_NSLOOKUP + bool "nslookup" + default y + help + nslookup is a tool to query Internet name servers. + +config BUSYBOX_CONFIG_PING + bool "ping" + default y + help + ping uses the ICMP protocol's mandatory ECHO_REQUEST datagram to + elicit an ICMP ECHO_RESPONSE from a host or gateway. + +config BUSYBOX_CONFIG_FEATURE_FANCY_PING + bool "Enable fancy ping output" + default y + depends on BUSYBOX_CONFIG_PING + help + Make the output from the ping applet include statistics, and at the + same time provide full support for ICMP packets. + +config BUSYBOX_CONFIG_PING6 + bool "ping6" + default y + depends on BUSYBOX_CONFIG_FEATURE_IPV6 + help + This will give you a ping that can talk IPv6. + +config BUSYBOX_CONFIG_FEATURE_FANCY_PING6 + bool "Enable fancy ping6 output" + default y + depends on BUSYBOX_CONFIG_PING6 + help + Make the output from the ping6 applet include statistics, and at the + same time provide full support for ICMP packets. + +config BUSYBOX_CONFIG_ROUTE + bool "route" + default y + help + Route displays or manipulates the kernel's IP routing tables. + +config BUSYBOX_CONFIG_TELNET + bool "telnet" + default y + help + Telnet is an interface to the TELNET protocol, but is also commonly + used to test other simple protocols. + +config BUSYBOX_CONFIG_FEATURE_TELNET_TTYPE + bool "Pass TERM type to remote host" + default y + depends on BUSYBOX_CONFIG_TELNET + help + Setting this option will forward the TERM environment variable to the + remote host you are connecting to. This is useful to make sure that + things like ANSI colors and other control sequences behave. + +config BUSYBOX_CONFIG_FEATURE_TELNET_AUTOLOGIN + bool "Pass USER type to remote host" + default n + depends on BUSYBOX_CONFIG_TELNET + help + Setting this option will forward the USER environment variable to the + remote host you are connecting to. This is useful when you need to + log into a machine without telling the username (autologin). This + option enables `-a' and `-l USER' arguments. + +config BUSYBOX_CONFIG_TELNETD + bool "telnetd" + default y + help + A daemon for the TELNET protocol, allowing you to log onto the host + running the daemon. Please keep in mind that the TELNET protocol + sends passwords in plain text. If you can't afford the space for an + SSH daemon and you trust your network, you may say 'y' here. As a + more secure alternative, you should seriously consider installing the + very small Dropbear SSH daemon instead: + http://matt.ucc.asn.au/dropbear/dropbear.html + + Note that for busybox telnetd to work you need several things: + First of all, your kernel needs: + BUSYBOX_CONFIG_UNIX98_PTYS=y + BUSYBOX_CONFIG_DEVPTS_FS=y + + Next, you need a /dev/pts directory on your root filesystem: + + $ ls -ld /dev/pts + drwxr-xr-x 2 root root 0 Sep 23 13:21 /dev/pts/ + + Next you need the pseudo terminal master multiplexer /dev/ptmx: + + $ ls -la /dev/ptmx + crw-rw-rw- 1 root tty 5, 2 Sep 23 13:55 /dev/ptmx + + Any /dev/ttyp[0-9]* files you may have can be removed. + Next, you need to mount the devpts filesystem on /dev/pts using: + + mount -t devpts devpts /dev/pts + + You need to be sure that Busybox has BUSYBOX_CONFIG_LOGIN and + BUSYBOX_CONFIG_FEATURE_SUID enabled. And finally, you should make + certain that Busybox has been installed setuid root: + + chown root.root /bin/busybox + chmod 4755 /bin/busybox + + with all that done, telnetd _should_ work.... + + +config BUSYBOX_CONFIG_FEATURE_TELNETD_INETD + bool "Support call from inetd only" + default n + depends on BUSYBOX_CONFIG_TELNETD + help + Selecting this will make telnetd only callable from inetd, + removing the standalone support. + +config BUSYBOX_CONFIG_TFTP + bool "tftp" + default n + help + This enables the Trivial File Transfer Protocol client program. TFTP + is usually used for simple, small transfers such as a root image + for a network-enabled bootloader. + +config BUSYBOX_CONFIG_FEATURE_TFTP_GET + bool "Enable \"get\" command" + default n + depends on BUSYBOX_CONFIG_TFTP + help + Add support for the GET command within the TFTP client. This allows + a client to retrieve a file from a TFTP server. + +config BUSYBOX_CONFIG_FEATURE_TFTP_PUT + bool "Enable \"put\" command" + default n + depends on BUSYBOX_CONFIG_TFTP + help + Add support for the PUT command within the TFTP client. This allows + a client to transfer a file to a TFTP server. + +config BUSYBOX_CONFIG_FEATURE_TFTP_BLOCKSIZE + bool "Enable \"blocksize\" command" + default n + depends on BUSYBOX_CONFIG_TFTP + help + Allow the client to specify the desired block size for transfers. + +config BUSYBOX_CONFIG_DEBUG_TFTP + bool "Enable debug" + default n + depends on BUSYBOX_CONFIG_TFTP + help + Enable debug settings for tftp. This is useful if you're running + into problems with tftp as the protocol doesn't help you much when + you run into problems. + +config BUSYBOX_CONFIG_TRACEROUTE + bool "traceroute" + default y + help + Utility to trace the route of IP packets + +config BUSYBOX_CONFIG_FEATURE_TRACEROUTE_VERBOSE + bool "Enable verbose output" + default y + depends on BUSYBOX_CONFIG_TRACEROUTE + help + Add some verbosity to traceroute. This includes amongst other things + hostnames and ICMP response types. + +config BUSYBOX_CONFIG_FEATURE_TRACEROUTE_SOURCE_ROUTE + bool "Enable loose source route" + default n + depends on BUSYBOX_CONFIG_TRACEROUTE + help + Add option to specify a loose source route gateway + (8 maximum). + +config BUSYBOX_CONFIG_FEATURE_TRACEROUTE_USE_ICMP + bool "Use ICMP instead of UDP" + default n + depends on BUSYBOX_CONFIG_TRACEROUTE + help + Add feature to allow for ICMP ECHO instead of UDP datagrams. + +source package/busybox/config/networking/udhcp/Config.in + +config BUSYBOX_CONFIG_VCONFIG + bool "vconfig" + default y + help + Creates, removes, and configures VLAN interfaces + +config BUSYBOX_CONFIG_WGET + bool "wget" + default y + help + wget is a utility for non-interactive download of files from HTTP, + HTTPS, and FTP servers. + +config BUSYBOX_CONFIG_FEATURE_WGET_STATUSBAR + bool "Enable a nifty process meter (+2k)" + default y + depends on BUSYBOX_CONFIG_WGET + help + Enable the transfer progress bar for wget transfers. + +config BUSYBOX_CONFIG_FEATURE_WGET_AUTHENTICATION + bool "Enable HTTP authentication" + default y + depends on BUSYBOX_CONFIG_WGET + help + Support authenticated HTTP transfers. + +config BUSYBOX_CONFIG_FEATURE_WGET_IP6_LITERAL + bool "Enable IPv6 literal addresses" + default y + depends on BUSYBOX_CONFIG_WGET && BUSYBOX_CONFIG_FEATURE_IPV6 + help + Support IPv6 address literal notation in URLs. + +config BUSYBOX_CONFIG_FEATURE_WGET_LONG_OPTIONS + bool "Enable long options" + default y + depends on BUSYBOX_CONFIG_WGET && BUSYBOX_CONFIG_GETOPT_LONG + help + Support long options for the wget applet. + +config BUSYBOX_CONFIG_ZCIP + bool "zcip" + default n + help + ZCIP provides ZeroConf IPv4 address selection, according to RFC 3927. + It's a daemon that allocates and defends a dynamically assigned + address on the 169.254/16 network, requiring no system administrator. + + See http://www.zeroconf.org for further details, and "zcip.script" + in the busybox examples. + +endmenu diff --git a/package/busybox/config/networking/udhcp/Config.in b/package/busybox/config/networking/udhcp/Config.in new file mode 100644 index 0000000000..741afa3279 --- /dev/null +++ b/package/busybox/config/networking/udhcp/Config.in @@ -0,0 +1,62 @@ +# +# For a description of the syntax of this configuration file, +# see scripts/kbuild/config-language.txt. +# + +menu "udhcp Server/Client" + +config BUSYBOX_CONFIG_APP_UDHCPD + bool "udhcp Server (udhcpd)" + default n + help + uDHCPd is a DHCP server geared primarily toward embedded systems, + while striving to be fully functional and RFC compliant. + + See http://udhcp.busybox.net for further details. + +config BUSYBOX_CONFIG_APP_UDHCPC + bool "udhcp Client (udhcpc)" + default y + help + uDHCPc is a DHCP client geared primarily toward embedded systems, + while striving to be fully functional and RFC compliant. + + The udhcp client negotiates a lease with the DHCP server and + notifies a set of scripts when a lease is obtained or lost. + + See http://udhcp.busybox.net for further details. + +config BUSYBOX_CONFIG_APP_DUMPLEASES + bool "Lease display utility (dumpleases)" + default n + depends on BUSYBOX_CONFIG_APP_UDHCPD + help + dumpleases displays the leases written out by the udhcpd server. + Lease times are stored in the file by time remaining in lease, or + by the absolute time that it expires in seconds from epoch. + + See http://udhcp.busybox.net for further details. + +config BUSYBOX_CONFIG_FEATURE_UDHCP_SYSLOG + bool " Log udhcp messages to syslog (instead of stdout)" + default n + depends on BUSYBOX_CONFIG_APP_UDHCPD || BUSYBOX_CONFIG_APP_UDHCPC + help + If selected, udhcpd will log all its messages to syslog, otherwise, + it will attempt to log them to stdout. + + See http://udhcp.busybox.net for further details. + +config BUSYBOX_CONFIG_FEATURE_UDHCP_DEBUG + bool " Compile udhcp with noisy debugging messages" + default n + depends on BUSYBOX_CONFIG_APP_UDHCPD || BUSYBOX_CONFIG_APP_UDHCPC + help + If selected, udhcpd will output extra debugging output. If using + this option, compile uDHCP with "-g", and do not fork the daemon to + the background. + + See http://udhcp.busybox.net for further details. + +endmenu + diff --git a/package/busybox/config/procps/Config.in b/package/busybox/config/procps/Config.in new file mode 100644 index 0000000000..34d1ace087 --- /dev/null +++ b/package/busybox/config/procps/Config.in @@ -0,0 +1,121 @@ +# +# For a description of the syntax of this configuration file, +# see scripts/kbuild/config-language.txt. +# + +menu "Process Utilities" + +config BUSYBOX_CONFIG_FREE + bool "free" + default y + help + free displays the total amount of free and used physical and swap + memory in the system, as well as the buffers used by the kernel. + The shared memory column should be ignored; it is obsolete. + +config BUSYBOX_CONFIG_FUSER + bool "fuser" + default n + help + fuser lists all PIDs (Process IDs) that currently have a given + file open. fuser can also list all PIDs that have a given network + (TCP or UDP) port open. + +config BUSYBOX_CONFIG_KILL + bool "kill" + default y + help + The command kill sends the specified signal to the specified + process or process group. If no signal is specified, the TERM + signal is sent. + +config BUSYBOX_CONFIG_KILLALL + bool "killall" + default y + depends on BUSYBOX_CONFIG_KILL + help + killall sends a signal to all processes running any of the + specified commands. If no signal name is specified, SIGTERM is + sent. + +config BUSYBOX_CONFIG_KILLALL5 + bool "killall5" + default y + depends on BUSYBOX_CONFIG_KILL + +config BUSYBOX_CONFIG_PIDOF + bool "pidof" + default y + help + Pidof finds the process id's (pids) of the named programs. It prints + those id's on the standard output. + +config BUSYBOX_CONFIG_FEATURE_PIDOF_SINGLE + bool "Enable argument for single shot (-s)" + default n + depends on BUSYBOX_CONFIG_PIDOF + help + Support argument '-s' for returning only the first pid found. + +config BUSYBOX_CONFIG_FEATURE_PIDOF_OMIT + bool "Enable argument for omitting pids (-o)" + default n + depends on BUSYBOX_CONFIG_PIDOF + help + Support argument '-o' for omitting the given pids in output. + The special pid %PPID can be used to name the parent process + of the pidof, in other words the calling shell or shell script. + +config BUSYBOX_CONFIG_PS + bool "ps" + default y + help + ps gives a snapshot of the current processes. + +config BUSYBOX_CONFIG_FEATURE_PS_WIDE + bool "Enable argument for wide output (-w)" + default n + depends on BUSYBOX_CONFIG_PS + help + Support argument 'w' for wide output. + If given once, 132 chars are printed and given more than + one, the length is unlimited. + +config BUSYBOX_CONFIG_RENICE + bool "renice" + default n + help + Renice alters the scheduling priority of one or more running + processes. + +config BUSYBOX_CONFIG_BB_SYSCTL + bool "sysctl" + default y + help + Configure kernel parameters at runtime. + +config BUSYBOX_CONFIG_TOP + bool "top" + default y + help + The top program provides a dynamic real-time view of a running + system. + +config BUSYBOX_CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE + bool "Support showing CPU usage percentage (add 2k bytes)" + default y + depends on BUSYBOX_CONFIG_TOP + help + Make top display CPU usage. + +config BUSYBOX_CONFIG_UPTIME + bool "uptime" + default y + help + uptime gives a one line display of the current time, how long + the system has been running, how many users are currently logged + on, and the system load averages for the past 1, 5, and 15 minutes. + + +endmenu + diff --git a/package/busybox/config/shell/Config.in b/package/busybox/config/shell/Config.in new file mode 100644 index 0000000000..373c7461a4 --- /dev/null +++ b/package/busybox/config/shell/Config.in @@ -0,0 +1,294 @@ +# +# For a description of the syntax of this configuration file, +# see scripts/kbuild/config-language.txt. +# + +menu "Shells" + +choice + prompt "Choose your default shell" + default BUSYBOX_CONFIG_FEATURE_SH_IS_ASH + help + Choose a shell. The ash shell is the most bash compatible + and full featured one. + +config BUSYBOX_CONFIG_FEATURE_SH_IS_ASH + select BUSYBOX_CONFIG_ASH + bool "ash" + +config BUSYBOX_CONFIG_FEATURE_SH_IS_HUSH + select BUSYBOX_CONFIG_HUSH + bool "hush" + +config BUSYBOX_CONFIG_FEATURE_SH_IS_LASH + select BUSYBOX_CONFIG_LASH + bool "lash" + +config BUSYBOX_CONFIG_FEATURE_SH_IS_MSH + select BUSYBOX_CONFIG_MSH + bool "msh" + +config BUSYBOX_CONFIG_FEATURE_SH_IS_NONE + bool "none" + +endchoice + +config BUSYBOX_CONFIG_ASH + bool "ash" + default y + select BUSYBOX_CONFIG_TEST + help + Tha 'ash' shell adds about 60k in the default configuration and is + the most complete and most pedantically correct shell included with + busybox. This shell is actually a derivative of the Debian 'dash' + shell (by Herbert Xu), which was created by porting the 'ash' shell + (written by Kenneth Almquist) from NetBSD. + +comment "Ash Shell Options" + depends on BUSYBOX_CONFIG_ASH + +config BUSYBOX_CONFIG_ASH_JOB_CONTROL + bool "Job control" + default y + depends on BUSYBOX_CONFIG_ASH + help + Enable job control in the ash shell. + +config BUSYBOX_CONFIG_ASH_READ_NCHARS + bool "'read -n N' and 'read -s' support" + default n + depends on BUSYBOX_CONFIG_ASH + help + 'read -n N' will return a value after N characters have been read. + 'read -s' will read without echoing the user's input. + +config BUSYBOX_CONFIG_ASH_READ_TIMEOUT + bool "'read -t S' support." + default y + depends on BUSYBOX_CONFIG_ASH + help + 'read -t S' will return a value after S seconds have passed. + This implementation will allow fractional seconds, expressed + as a decimal fraction, e.g. 'read -t 2.5 foo'. + +config BUSYBOX_CONFIG_ASH_ALIAS + bool "alias support" + default y + depends on BUSYBOX_CONFIG_ASH + help + Enable alias support in the ash shell. + +config BUSYBOX_CONFIG_ASH_MATH_SUPPORT + bool "Posix math support" + default y + depends on BUSYBOX_CONFIG_ASH + help + Enable math support in the ash shell. + +config BUSYBOX_CONFIG_ASH_MATH_SUPPORT_64 + bool "Extend Posix math support to 64 bit" + default n + depends on BUSYBOX_CONFIG_ASH_MATH_SUPPORT + help + Enable 64-bit math support in the ash shell. This will make + the shell slightly larger, but will allow computation with very + large numbers. + +config BUSYBOX_CONFIG_ASH_GETOPTS + bool "Builtin getopt to parse positional parameters" + default y + depends on BUSYBOX_CONFIG_ASH + help + Enable getopts builtin in the ash shell. + +config BUSYBOX_CONFIG_ASH_BUILTIN_ECHO + bool "Builtin version of 'echo'" + default y + select BUSYBOX_CONFIG_ECHO + depends on BUSYBOX_CONFIG_ASH + help + Enable support for echo, built in to ash. + +config BUSYBOX_CONFIG_ASH_BUILTIN_TEST + bool "Builtin version of 'test'" + default y + select BUSYBOX_CONFIG_TEST + depends on BUSYBOX_CONFIG_ASH + help + Enable support for test, built in to ash. + +config BUSYBOX_CONFIG_ASH_CMDCMD + bool "'command' command to override shell builtins" + default y + depends on BUSYBOX_CONFIG_ASH + help + Enable support for the ash 'command' builtin, which allows + you to run the specified command with the specified arguments, + even when there is an ash builtin command with the same name. + +config BUSYBOX_CONFIG_ASH_MAIL + bool "Check for new mail on interactive shells" + default n + depends on BUSYBOX_CONFIG_ASH + help + Enable "check for new mail" in the ash shell. + +config BUSYBOX_CONFIG_ASH_OPTIMIZE_FOR_SIZE + bool "Optimize for size instead of speed" + default y + depends on BUSYBOX_CONFIG_ASH + help + Compile ash for reduced size at the price of speed. + +config BUSYBOX_CONFIG_ASH_RANDOM_SUPPORT + bool "Pseudorandom generator and variable $RANDOM" + default n + depends on BUSYBOX_CONFIG_ASH + help + Enable pseudorandom generator and dynamic variable "$RANDOM". + Each read of "$RANDOM" will generate a new pseudorandom value. + You can reset the generator by using a specified start value. + After "unset RANDOM" then generator will switch off and this + variable will no longer have special treatment. + +config BUSYBOX_CONFIG_ASH_EXPAND_PRMT + bool "Expand prompt string" + default n + depends on BUSYBOX_CONFIG_ASH + help + "PS#" may be contain volatile content, such as backquote commands. + This option recreates the prompt string from the environment + variable each time it is displayed. + +config BUSYBOX_CONFIG_HUSH + bool "hush" + default n + select BUSYBOX_CONFIG_TRUE + select BUSYBOX_CONFIG_FALSE + select BUSYBOX_CONFIG_TEST + help + hush is a very small shell (just 18k) and it has fairly complete + Bourne shell grammar. It even handles all the normal flow control + options such as if/then/elif/else/fi, for/in/do/done, while loops, + etc. + + It does not handle case/esac, select, function, here documents ( << + word ), arithmetic expansion, aliases, brace expansion, tilde + expansion, &> and >& redirection of stdout+stderr, etc. + + +config BUSYBOX_CONFIG_LASH + bool "lash" + default n + select BUSYBOX_CONFIG_TRUE + select BUSYBOX_CONFIG_FALSE + select BUSYBOX_CONFIG_TEST + help + lash is the very smallest shell (adds just 10k) and it is quite + usable as a command prompt, but it is not suitable for any but the + most trivial scripting (such as an initrd that calls insmod a few + times) since it does not understand any Bourne shell grammar. It + does handle pipes, redirects, and job control though. Adding in + command editing makes it a very nice lightweight command prompt. + + +config BUSYBOX_CONFIG_MSH + bool "msh" + default n + select BUSYBOX_CONFIG_TRUE + select BUSYBOX_CONFIG_FALSE + select BUSYBOX_CONFIG_TEST + help + The minix shell (adds just 30k) is quite complete and handles things + like for/do/done, case/esac and all the things you expect a Bourne + shell to do. It is not always pedantically correct about Bourne + shell grammar (try running the shell testscript "tests/sh.testcases" + on it and compare vs bash) but for most things it works quite well. + It also uses only vfork, so it can be used on uClinux systems. + +comment "Bourne Shell Options" + depends on BUSYBOX_CONFIG_MSH || BUSYBOX_CONFIG_LASH || BUSYBOX_CONFIG_HUSH || BUSYBOX_CONFIG_ASH + +config BUSYBOX_CONFIG_FEATURE_SH_EXTRA_QUIET + bool "Hide message on interactive shell startup" + default n + depends on BUSYBOX_CONFIG_MSH || BUSYBOX_CONFIG_LASH || BUSYBOX_CONFIG_HUSH || BUSYBOX_CONFIG_ASH + help + Remove the busybox introduction when starting a shell. + +config BUSYBOX_CONFIG_FEATURE_SH_STANDALONE_SHELL + bool "Standalone shell" + default n + depends on BUSYBOX_CONFIG_MSH || BUSYBOX_CONFIG_LASH || BUSYBOX_CONFIG_HUSH || BUSYBOX_CONFIG_ASH + help + This option causes the selected busybox shell to use busybox applets + in preference to executables in the PATH whenever possible. For + example, entering the command 'ifconfig' into the shell would cause + busybox to use the ifconfig busybox applet. Specifying the fully + qualified executable name, such as '/sbin/ifconfig' will still + execute the /sbin/ifconfig executable on the filesystem. This option + is generally used when creating a statically linked version of busybox + for use as a rescue shell, in the event that you screw up your system. + + Note that this will *also* cause applets to take precedence + over shell builtins of the same name. So turning this on will + eliminate any performance gained by turning on the builtin "echo" + and "test" commands in ash. + + Note that when using this option, the shell will attempt to directly + run '/bin/busybox'. If you do not have the busybox binary sitting in + that exact location with that exact name, this option will not work at + all. + +config BUSYBOX_CONFIG_FEATURE_COMMAND_EDITING + bool "Command line editing" + default y + depends on BUSYBOX_CONFIG_MSH || BUSYBOX_CONFIG_LASH || BUSYBOX_CONFIG_HUSH || BUSYBOX_CONFIG_ASH + help + Enable command editing in shell. + +config BUSYBOX_CONFIG_FEATURE_COMMAND_EDITING_VI + bool "vi-style line editing commands" + default n + depends on BUSYBOX_CONFIG_FEATURE_COMMAND_EDITING + help + Enable vi-style line editing in the shell. This mode can be + turned on and off with "set -o vi" and "set +o vi". + +config BUSYBOX_CONFIG_FEATURE_COMMAND_HISTORY + int "History size" + default 15 + depends on BUSYBOX_CONFIG_FEATURE_COMMAND_EDITING + help + Specify command history size in shell. + +config BUSYBOX_CONFIG_FEATURE_COMMAND_SAVEHISTORY + bool "History saving" + default n + depends on BUSYBOX_CONFIG_ASH && BUSYBOX_CONFIG_FEATURE_COMMAND_EDITING + help + Enable history saving in ash shell. + +config BUSYBOX_CONFIG_FEATURE_COMMAND_TAB_COMPLETION + bool "Tab completion" + default y + depends on BUSYBOX_CONFIG_FEATURE_COMMAND_EDITING + help + Enable tab completion in shell. + +config BUSYBOX_CONFIG_FEATURE_COMMAND_USERNAME_COMPLETION + bool "Username completion" + default n + depends on BUSYBOX_CONFIG_FEATURE_COMMAND_TAB_COMPLETION + help + Enable username completion in shell. + +config BUSYBOX_CONFIG_FEATURE_SH_FANCY_PROMPT + bool "Fancy shell prompts" + default y + depends on BUSYBOX_CONFIG_FEATURE_COMMAND_EDITING + help + Setting this option allows for prompts to use things like \w and + \$ and also using escape codes. + +endmenu diff --git a/package/busybox/config/sysklogd/Config.in b/package/busybox/config/sysklogd/Config.in new file mode 100644 index 0000000000..f120695664 --- /dev/null +++ b/package/busybox/config/sysklogd/Config.in @@ -0,0 +1,109 @@ +# +# For a description of the syntax of this configuration file, +# see scripts/kbuild/config-language.txt. +# + +menu "System Logging Utilities" + +config BUSYBOX_CONFIG_SYSLOGD + bool "syslogd" + default y + help + The syslogd utility is used to record logs of all the + significant events that occur on a system. Every + message that is logged records the date and time of the + event, and will generally also record the name of the + application that generated the message. When used in + conjunction with klogd, messages from the Linux kernel + can also be recorded. This is terribly useful, + especially for finding what happened when something goes + wrong. And something almost always will go wrong if + you wait long enough.... + +config BUSYBOX_CONFIG_FEATURE_ROTATE_LOGFILE + bool "Rotate message files" + default y + depends on BUSYBOX_CONFIG_SYSLOGD + help + This enables syslogd to rotate the message files + on his own. No need to use an external rotatescript. + +config BUSYBOX_CONFIG_FEATURE_REMOTE_LOG + bool "Remote Log support" + default y + depends on BUSYBOX_CONFIG_SYSLOGD + help + When you enable this feature, the syslogd utility can + be used to send system log messages to another system + connected via a network. This allows the remote + machine to log all the system messages, which can be + terribly useful for reducing the number of serial + cables you use. It can also be a very good security + measure to prevent system logs from being tampered with + by an intruder. + +config BUSYBOX_CONFIG_FEATURE_IPC_SYSLOG + bool "Circular Buffer support" + default y + depends on BUSYBOX_CONFIG_SYSLOGD + help + When you enable this feature, the syslogd utility will + use a circular buffer to record system log messages. + When the buffer is filled it will continue to overwrite + the oldest messages. This can be very useful for + systems with little or no permanent storage, since + otherwise system logs can eventually fill up your + entire filesystem, which may cause your system to + break badly. + +config BUSYBOX_CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE + int " Circular buffer size in Kbytes (minimum 4KB)" + default 16 + depends on BUSYBOX_CONFIG_FEATURE_IPC_SYSLOG + help + This option sets the size of the circular buffer + used to record system log messages. + +config BUSYBOX_CONFIG_LOGREAD + bool "logread" + default y + depends on BUSYBOX_CONFIG_FEATURE_IPC_SYSLOG + help + If you enabled Circular Buffer support, you almost + certainly want to enable this feature as well. This + utility will allow you to read the messages that are + stored in the syslogd circular buffer. + +config BUSYBOX_CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING + bool "logread double buffering" + default n + depends on BUSYBOX_CONFIG_LOGREAD + help + 'logread' ouput to slow serial terminals can have + side effects on syslog because of the semaphore. + This option make logread to double buffer copy + from circular buffer, minimizing semaphore + contention at some minor memory expense. + +config BUSYBOX_CONFIG_KLOGD + bool "klogd" + default y + depends on BUSYBOX_CONFIG_SYSLOGD + help + klogd is a utility which intercepts and logs all + messages from the Linux kernel and sends the messages + out to the 'syslogd' utility so they can be logged. If + you wish to record the messages produced by the kernel, + you should enable this option. + +config BUSYBOX_CONFIG_LOGGER + bool "logger" + default y + help + The logger utility allows you to send arbitrary text + messages to the system log (i.e. the 'syslogd' utility) so + they can be logged. This is generally used to help locate + problems that occur within programs and scripts. + +endmenu + diff --git a/package/busybox/config/util-linux/Config.in b/package/busybox/config/util-linux/Config.in new file mode 100644 index 0000000000..b7a8ae91f5 --- /dev/null +++ b/package/busybox/config/util-linux/Config.in @@ -0,0 +1,480 @@ +# +# For a description of the syntax of this configuration file, +# see scripts/kbuild/config-language.txt. +# + +menu "Linux System Utilities" + +config BUSYBOX_CONFIG_DMESG + bool "dmesg" + default y + help + dmesg is used to examine or control the kernel ring buffer. When the + Linux kernel prints messages to the system log, they are stored in + the kernel ring buffer. You can use dmesg to print the kernel's ring + buffer, clear the kernel ring buffer, change the size of the kernel + ring buffer, and change the priority level at which kernel messages + are also logged to the system console. Enable this option if you + wish to enable the 'dmesg' utility. + +config BUSYBOX_CONFIG_FBSET + bool "fbset" + default n + help + fbset is used to show or change the settings of a Linux frame buffer + device. The frame buffer device provides a simple and unique + interface to access a graphics display. Enable this option + if you wish to enable the 'fbset' utility. + +config BUSYBOX_CONFIG_FEATURE_FBSET_FANCY + bool "Turn on extra fbset options" + default n + depends on BUSYBOX_CONFIG_FBSET + help + This option enables extended fbset options, allowing one to set the + framebuffer size, color depth, etc. interface to access a graphics + display. Enable this option if you wish to enable extended fbset + options. + +config BUSYBOX_CONFIG_FEATURE_FBSET_READMODE + bool "Turn on fbset readmode support" + default n + depends on BUSYBOX_CONFIG_FBSET + help + This option allows fbset to read the video mode database stored by + default n /etc/fb.modes, which can be used to set frame buffer + device to pre-defined video modes. + +config BUSYBOX_CONFIG_FDFLUSH + bool "fdflush" + default n + help + fdflush is only needed when changing media on slightly-broken + removable media drives. It is used to make Linux believe that a + hardware disk-change switch has been actuated, which causes Linux to + forget anything it has cached from the previous media. If you have + such a slightly-broken drive, you will need to run fdflush every time + you change a disk. Most people have working hardware and can safely + leave this disabled. + +config BUSYBOX_CONFIG_FDFORMAT + bool "fdformat" + default n + help + fdformat is used to low-level format a floppy disk. + +config BUSYBOX_CONFIG_FDISK + bool "fdisk" + default n + help + The fdisk utility is used to divide hard disks into one or more + logical disks, which are generally called partitions. This utility + can be used to list and edit the set of partitions or BSD style + 'disk slices' that are defined on a hard drive. + +config BUSYBOX_FDISK_SUPPORT_LARGE_DISKS + bool + default y + depends on BUSYBOX_CONFIG_FDISK + help + Enable this option to support large disks > 4GB. + +config BUSYBOX_CONFIG_FEATURE_FDISK_WRITABLE + bool "Write support" + default n + depends on BUSYBOX_CONFIG_FDISK + help + Enabling this option allows you to create or change a partition table + and write those changes out to disk. If you leave this option + disabled, you will only be able to view the partition table. + +config BUSYBOX_CONFIG_FEATURE_AIX_LABEL + bool "Support AIX disklabels" + default n + depends on BUSYBOX_CONFIG_FDISK && BUSYBOX_CONFIG_FEATURE_FDISK_WRITABLE + help + Enabling this option allows you to create or change AIX disklabels. + Most people can safely leave this option disabled. + +config BUSYBOX_CONFIG_FEATURE_SGI_LABEL + bool "Support SGI disklabels" + default n + depends on BUSYBOX_CONFIG_FDISK && BUSYBOX_CONFIG_FEATURE_FDISK_WRITABLE + help + Enabling this option allows you to create or change SGI disklabels. + Most people can safely leave this option disabled. + +config BUSYBOX_CONFIG_FEATURE_SUN_LABEL + bool "Support SUN disklabels" + default n + depends on BUSYBOX_CONFIG_FDISK && BUSYBOX_CONFIG_FEATURE_FDISK_WRITABLE + help + Enabling this option allows you to create or change SUN disklabels. + Most people can safely leave this option disabled. + +config BUSYBOX_CONFIG_FEATURE_OSF_LABEL + bool "Support BSD disklabels" + default n + depends on BUSYBOX_CONFIG_FDISK && BUSYBOX_CONFIG_FEATURE_FDISK_WRITABLE + help + Enabling this option allows you to create or change BSD disklabels + and define and edit BSD disk slices. + +config BUSYBOX_CONFIG_FEATURE_FDISK_ADVANCED + bool "Support expert mode" + default n + depends on BUSYBOX_CONFIG_FDISK && BUSYBOX_CONFIG_FEATURE_FDISK_WRITABLE + help + Enabling this option allows you to do terribly unsafe things like + define arbitrary drive geometry, move the beginning of data in a + partition, and similarly evil things. Unless you have a very good + reason you would be wise to leave this disabled. + +config BUSYBOX_CONFIG_FREERAMDISK + bool "freeramdisk" + default n + help + Linux allows you to create ramdisks. This utility allows you to + delete them and completely free all memory that was used for the + ramdisk. For example, if you boot Linux into a ramdisk and later + pivot_root, you may want to free the memory that is allocated to the + ramdisk. If you have no use for freeing memory from a ramdisk, leave + this disabled. + +config BUSYBOX_CONFIG_FSCK_MINIX + bool "fsck_minix" + default n + help + The minix filesystem is a nice, small, compact, read-write filesystem + with little overhead. It is not a journaling filesystem however and + can experience corruption if it is not properly unmounted or if the + power goes off in the middle of a write. This utility allows you to + check for and attempt to repair any corruption that occurs to a minix + filesystem. + +config BUSYBOX_CONFIG_MKFS_MINIX + bool "mkfs_minix" + default n + help + The minix filesystem is a nice, small, compact, read-write filesystem + with little overhead. If you wish to be able to create minix filesystems + this utility will do the job for you. + +comment "Minix filesystem support" + depends on BUSYBOX_CONFIG_FSCK_MINIX || BUSYBOX_CONFIG_MKFS_MINIX + +config BUSYBOX_CONFIG_FEATURE_MINIX2 + bool "Support Minix fs v2 (fsck_minix/mkfs_minix)" + default n + depends on BUSYBOX_CONFIG_FSCK_MINIX || BUSYBOX_CONFIG_MKFS_MINIX + help + If you wish to be able to create version 2 minix filesystems, enable this. + If you enabled 'mkfs_minix' then you almost certainly want to be using the + version 2 filesystem support. + +config BUSYBOX_CONFIG_GETOPT + bool "getopt" + default n + help + The getopt utility is used to break up (parse) options in command + lines to make it easy to write complex shell scripts that also check + for legal (and illegal) options. If you want to write horribly + complex shell scripts, or use some horribly complex shell script + written by others, this utility may be for you. Most people will + wisely leave this disabled. + +config BUSYBOX_CONFIG_HEXDUMP + bool "hexdump" + default y + help + The hexdump utility is used to display binary data in a readable + way that is comparable to the output from most hex editors. + +config BUSYBOX_CONFIG_HWCLOCK + bool "hwclock" + default n + help + The hwclock utility is used to read and set the hardware clock + on a system. This is primarily used to set the current time on + shutdown in the hardware clock, so the hardware will keep the + correct time when Linux is _not_ running. + +config BUSYBOX_CONFIG_FEATURE_HWCLOCK_LONG_OPTIONS + bool "Support long options (--hctosys,...)" + default n + depends on BUSYBOX_CONFIG_HWCLOCK && BUSYBOX_CONFIG_GETOPT_LONG + help + By default, the hwclock utility only uses short options. If you + are overly fond of its long options, such as --hctosys, --utc, etc) + then enable this option. + +config BUSYBOX_CONFIG_FEATURE_HWCLOCK_ADJTIME_FHS + bool "Use FHS /var/lib/hwclock/adjtime" + default n + depends on BUSYBOX_CONFIG_HWCLOCK + help + Starting with FHS 2.3, the adjtime state file is supposed to exist + at /var/lib/hwclock/adjtime instead of /etc/adjtime. If you wish + to use the FHS behavior, answer Y here, otherwise answer N for the + classic /etc/adjtime path. + + http://www.pathname.com/fhs/pub/fhs-2.3.html#VARLIBHWCLOCKSTATEDIRECTORYFORHWCLO + +config BUSYBOX_CONFIG_IPCRM + bool "ipcrm" + default n + select BUSYBOX_CONFIG_FEATURE_SUID + help + The ipcrm utility allows the removal of System V interprocess + communication (IPC) objects and the associated data structures + from the system. + +config BUSYBOX_CONFIG_IPCS + bool "ipcs" + default n + select BUSYBOX_CONFIG_FEATURE_SUID + help + The ipcs utility is used to provide information on the currently + allocated System V interprocess (IPC) objects in the system. + +config BUSYBOX_CONFIG_LOSETUP + bool "losetup" + default n + help + losetup is used to associate or detach a loop device with a regular + file or block device, and to query the status of a loop device. This + version does not currently support enabling data encryption. + +config BUSYBOX_CONFIG_MDEV + bool "mdev" + default n + help + mdev is a mini-udev implementation: call it with -s to populate + /dev from /sys, then "echo /sbin/mdev > /proc/sys/kernel/hotplug" to + have it handle hotplug events afterwards. Device names are taken + from sysfs. + +config BUSYBOX_CONFIG_FEATURE_MDEV_CONF + bool "Support /etc/mdev.conf" + default n + depends on BUSYBOX_CONFIG_MDEV + help + The mdev config file contains lines that look like: + + hd[a-z][0-9]* 0:3 660 + + That's device name (with regex match), uid:gid, and permissions. + + Config file parsing stops on the first matching line. If no config + entry is matched, devices are created with default 0:0 660. (Make + the last line match .* to override this.) + +config BUSYBOX_CONFIG_FEATURE_MDEV_EXEC + bool "Support command execution at device addition/removal" + default n + depends on BUSYBOX_CONFIG_FEATURE_MDEV_CONF + help + This adds support for an optional field to /etc/mdev.conf, consisting + of a special character and a command line to run after creating the + corresponding device(s) and before removing, ala: + + hdc root:cdrom 660 *ln -s $MDEV cdrom + + The $MDEV environment variable is set to the name of the device. + + The special characters and their meanings are: + @ Run after creating the device. + $ Run before removing the device. + * Run both after creating and before removing the device. + + Commands are executed via system() so you need /bin/sh, meaning you + probably want to select a default shell in the Shells menu. + +config BUSYBOX_CONFIG_MKSWAP + bool "mkswap" + default n + help + The mkswap utility is used to configure a file or disk partition as + Linux swap space. This allows Linux to use the entire file or + partition as if it were additional RAM, which can greatly increase + the capability of low-memory machines. This additional memory is + much slower than real RAM, but can be very helpful at preventing your + applications being killed by the Linux out of memory (OOM) killer. + Once you have created swap space using 'mkswap' you need to enable + the swap space using the 'swapon' utility. + +config BUSYBOX_CONFIG_FEATURE_MKSWAP_V0 + bool "version 0 support" + default n + depends on BUSYBOX_CONFIG_MKSWAP +# depends on BUSYBOX_CONFIG_MKSWAP && BUSYBOX_CONFIG_DEPRECATED + help + Enable support for the old v0 style. + If your kernel is older than 2.1.117, then v0 support is the + only option. + +config BUSYBOX_CONFIG_MORE + bool "more" + default n + help + more is a simple utility which allows you to read text one screen + sized page at a time. If you want to read text that is larger than + the screen, and you are using anything faster than a 300 baud modem, + you will probably find this utility very helpful. If you don't have + any need to reading text files, you can leave this disabled. + +config BUSYBOX_CONFIG_FEATURE_USE_TERMIOS + bool "Use termios to manipulate the screen" + default y + depends on BUSYBOX_CONFIG_MORE + help + This option allows utilities such as 'more' and 'top' to determine + the size of the screen. If you leave this disabled, your utilities + that display things on the screen will be especially primitive and + will be unable to determine the current screen size, and will be + unable to move the cursor. + +config BUSYBOX_CONFIG_MOUNT + bool "mount" + default y + help + All files and filesystems in Unix are arranged into one big directory + tree. The 'mount' utility is used to graft a filesystem onto a + particular part of the tree. A filesystem can either live on a block + device, or it can be accessible over the network, as is the case with + NFS filesystems. Most people using BusyBox will also want to enable + the 'mount' utility. + +config BUSYBOX_CONFIG_FEATURE_MOUNT_NFS + bool "Support mounting NFS file systems" + default y + depends on BUSYBOX_CONFIG_MOUNT + help + Enable mounting of NFS file systems. + +config BUSYBOX_CONFIG_PIVOT_ROOT + bool "pivot_root" + default y + help + The pivot_root utility swaps the mount points for the root filesystem + with some other mounted filesystem. This allows you to do all sorts + of wild and crazy things with your Linux system and is far more + powerful than 'chroot'. + + Note: This is for initrd in linux 2.4. Under initramfs (introduced + in linux 2.6) use switch_root instead. + +config BUSYBOX_CONFIG_RDATE + bool "rdate" + default y + help + The rdate utility allows you to synchronize the date and time of your + system clock with the date and time of a remote networked system using + the RFC868 protocol, which is built into the inetd daemon on most + systems. + +config BUSYBOX_CONFIG_READPROFILE + bool "readprofile" + default n + help + This allows you to parse /proc/profile for basic profiling. + +config BUSYBOX_CONFIG_SETARCH + bool "setarch" + default n + help + The linux32 utility is used to create a 32bit environment for the + specified program (usually a shell). It only makes sense to have + this util on a system that supports both 64bit and 32bit userland + (like amd64/x86, ppc64/ppc, sparc64/sparc, etc...). + +config BUSYBOX_CONFIG_SWAPONOFF + bool "swaponoff" + default n + help + This option enables both the 'swapon' and the 'swapoff' utilities. + Once you have created some swap space using 'mkswap', you also need + to enable your swap space with the 'swapon' utility. The 'swapoff' + utility is used, typically at system shutdown, to disable any swap + space. If you are not using any swap space, you can leave this + option disabled. + +config BUSYBOX_CONFIG_SWITCH_ROOT + bool "switch_root" + default y + help + The switch_root utility is used from initramfs to select a new + root device. Under initramfs, you have to use this instead of + pivot_root. (Stop reading here if you don't care why.) + + Booting with initramfs extracts a gzipped cpio archive into rootfs + (which is a variant of ramfs/tmpfs). Because rootfs can't be moved + or unmounted*, pivot_root will not work from initramfs. Instead, + switch_root deletes everything out of rootfs (including itself), + does a mount --move that overmounts rootfs with the new root, and + then execs the specified init program. + + * Because the Linux kernel uses rootfs internally as the starting + and ending point for searching through the kernel's doubly linked + list of active mount points. That's why. + +config BUSYBOX_CONFIG_UMOUNT + bool "umount" + default y + help + When you want to remove a mounted filesystem from its current mount point, + for example when you are shutting down the system, the 'umount' utility is + the tool to use. If you enabled the 'mount' utility, you almost certainly + also want to enable 'umount'. + +config BUSYBOX_CONFIG_FEATURE_UMOUNT_ALL + bool "umount -a option" + default y + depends on BUSYBOX_CONFIG_UMOUNT + help + Support -a option to unmount all currently mounted filesystems. + +comment "Common options for mount/umount" + depends on BUSYBOX_CONFIG_MOUNT || BUSYBOX_CONFIG_UMOUNT + +config BUSYBOX_CONFIG_FEATURE_MOUNT_LOOP + bool "Support loopback mounts" + default y + depends on BUSYBOX_CONFIG_MOUNT || BUSYBOX_CONFIG_UMOUNT + help + Enabling this feature allows automatic mounting of files (containing + filesystem images) via the linux kernel's loopback devices. The mount + command will detect you are trying to mount a file instead of a block + device, and transparently associate the file with a loopback device. + The umount command will also free that loopback device. + + You can still use the 'losetup' utility (to manually associate files + with loop devices) if you need to do something advanced, such as + specify an offset or cryptographic options to the loopback device. + (If you don't want umount to free the loop device, use "umount -D".) + +config BUSYBOX_CONFIG_FEATURE_MTAB_SUPPORT + bool "Support for the old /etc/mtab file" + default n + depends on BUSYBOX_CONFIG_MOUNT || BUSYBOX_CONFIG_UMOUNT + help + Historically, Unix systems kept track of the currently mounted + partitions in the file "/etc/mtab". These days, the kernel exports + the list of currently mounted partitions in "/proc/mounts", rendering + the old mtab file obsolete. (In modern systems, /etc/mtab should be + a symlink to /proc/mounts.) + + The only reason to have mount maintain an /etc/mtab file itself is if + your stripped-down embedded system does not have a /proc directory. + If you must use this, keep in mind it's inherently brittle (for + example a mount under chroot won't update it), can't handle modern + features like separate per-process filesystem namespaces, requires + that your /etc directory be writeable, tends to get easily confused + by --bind or --move mounts, won't update if you rename a directory + that contains a mount point, and so on. (In brief: avoid.) + + About the only reason to use this is if you've removed /proc from + your kernel. + +endmenu + diff --git a/package/busybox/patches/001-wget_long_options.patch b/package/busybox/patches/001-wget_long_options.patch new file mode 100644 index 0000000000..9538427e3e --- /dev/null +++ b/package/busybox/patches/001-wget_long_options.patch @@ -0,0 +1,22 @@ +Index: busybox-CURRENT/networking/wget.c +=================================================================== +--- busybox-CURRENT/networking/wget.c (revision 15806) ++++ busybox-CURRENT/networking/wget.c (working copy) +@@ -133,7 +133,7 @@ + #define WGET_OPT_PREFIX 32 + #define WGET_OPT_PROXY 64 + +-#if ENABLE_WGET_LONG_OPTIONS ++#if CONFIG_FEATURE_WGET_LONG_OPTIONS + static const struct option wget_long_options[] = { + { "continue", 0, NULL, 'c' }, + { "quiet", 0, NULL, 'q' }, +@@ -177,7 +177,7 @@ + * Crack command line. + */ + bb_opt_complementally = "-1:\203::"; +-#if ENABLE_WGET_LONG_OPTIONS ++#if CONFIG_FEATURE_WGET_LONG_OPTIONS + bb_applet_long_options = wget_long_options; + #endif + opt = bb_getopt_ulflags(argc, argv, "cq\213O:\203:P:Y:", diff --git a/package/busybox/patches/100-killall5.patch b/package/busybox/patches/100-killall5.patch new file mode 100644 index 0000000000..9828224800 --- /dev/null +++ b/package/busybox/patches/100-killall5.patch @@ -0,0 +1,85 @@ +diff -ruN busybox-1.2.0-old/include/applets.h busybox-1.2.0-new/include/applets.h +--- busybox-1.2.0-old/include/applets.h 2006-07-01 00:42:10.000000000 +0200 ++++ busybox-1.2.0-new/include/applets.h 2006-07-31 00:29:34.000000000 +0200 +@@ -157,6 +157,7 @@ + USE_IPTUNNEL(APPLET(iptunnel, _BB_DIR_BIN, _BB_SUID_NEVER)) + USE_KILL(APPLET(kill, _BB_DIR_BIN, _BB_SUID_NEVER)) + USE_KILLALL(APPLET_ODDNAME(killall, kill, _BB_DIR_USR_BIN, _BB_SUID_NEVER, killall)) ++USE_KILLALL5(APPLET_ODDNAME(killall5, kill, _BB_DIR_USR_BIN, _BB_SUID_NEVER, killall5)) + USE_KLOGD(APPLET(klogd, _BB_DIR_SBIN, _BB_SUID_NEVER)) + USE_LASH(APPLET(lash, _BB_DIR_BIN, _BB_SUID_NEVER)) + USE_LAST(APPLET(last, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) +diff -ruN busybox-1.2.0-old/include/usage.h busybox-1.2.0-new/include/usage.h +--- busybox-1.2.0-old/include/usage.h 2006-07-01 00:42:10.000000000 +0200 ++++ busybox-1.2.0-new/include/usage.h 2006-07-31 00:25:57.000000000 +0200 +@@ -1503,6 +1503,13 @@ + #define killall_example_usage \ + "$ killall apache\n" + ++#define killall5_trivial_usage \ ++ "" ++#define killall5_full_usage \ ++ "" ++#define killall5_example_usage \ ++ "" ++ + #define klogd_trivial_usage \ + "[-c n] [-n]" + #define klogd_full_usage \ +diff -ruN busybox-1.2.0-old/procps/Config.in busybox-1.2.0-new/procps/Config.in +--- busybox-1.2.0-old/procps/Config.in 2006-07-01 00:42:12.000000000 +0200 ++++ busybox-1.2.0-new/procps/Config.in 2006-07-31 00:25:57.000000000 +0200 +@@ -38,6 +38,11 @@ + specified commands. If no signal name is specified, SIGTERM is + sent. + ++config CONFIG_KILLALL5 ++ bool "killall5" ++ default n ++ depends on CONFIG_KILL ++ + config CONFIG_PIDOF + bool "pidof" + default n +diff -ruN busybox-1.2.0-old/procps/kill.c busybox-1.2.0-new/procps/kill.c +--- busybox-1.2.0-old/procps/kill.c 2006-07-01 00:42:12.000000000 +0200 ++++ busybox-1.2.0-new/procps/kill.c 2006-07-31 00:25:57.000000000 +0200 +@@ -20,6 +20,7 @@ + + #define KILL 0 + #define KILLALL 1 ++#define KILLALL5 2 + + int kill_main(int argc, char **argv) + { +@@ -34,6 +35,9 @@ + #else + whichApp = KILL; + #endif ++#ifdef CONFIG_KILLALL5 ++ whichApp = (strcmp(bb_applet_name, "killall5") == 0)? KILLALL5 : whichApp; ++#endif + + /* Parse any options */ + if (argc < 2) +@@ -112,6 +116,20 @@ + } + + } ++#ifdef CONFIG_KILLALL5 ++ else if (whichApp == KILLALL5) { ++ procps_status_t * p; ++ pid_t myPid=getpid(); ++ while ((p = procps_scan(0)) != 0) { ++ if (p->pid != 1 && p->pid != myPid && p->pid != p->ppid) { ++ if (kill(p->pid, signo) != 0) { ++ bb_perror_msg( "Could not kill pid '%d'", p->pid); ++ errors++; ++ } ++ } ++ } ++ } ++#endif + #ifdef CONFIG_KILLALL + else { + pid_t myPid=getpid(); diff --git a/package/busybox/patches/110-telnetd.patch b/package/busybox/patches/110-telnetd.patch new file mode 100644 index 0000000000..8ebb6de645 --- /dev/null +++ b/package/busybox/patches/110-telnetd.patch @@ -0,0 +1,51 @@ +diff -ruN busybox-1.2.0-old/networking/telnetd.c busybox-1.2.0-new/networking/telnetd.c +--- busybox-1.2.0-old/networking/telnetd.c 2006-07-01 00:42:02.000000000 +0200 ++++ busybox-1.2.0-new/networking/telnetd.c 2006-07-31 10:52:30.000000000 +0200 +@@ -44,6 +44,7 @@ + #include <arpa/telnet.h> + #include <ctype.h> + #include <sys/syslog.h> ++#include <net/if.h> + + #include "busybox.h" + +@@ -391,11 +392,13 @@ + struct in_addr bind_addr = { .s_addr = 0x0 }; + #endif /* CONFIG_FEATURE_TELNETD_INETD */ + int c; ++ char *interface_name = NULL; ++ struct ifreq interface; + static const char options[] = + #ifdef CONFIG_FEATURE_TELNETD_INETD +- "f:l:"; ++ "i:f:l:"; + #else /* CONFIG_EATURE_TELNETD_INETD */ +- "f:l:p:b:"; ++ "i:f:l:p:b:"; + #endif /* CONFIG_FEATURE_TELNETD_INETD */ + int maxlen, w, r; + +@@ -410,6 +413,9 @@ + case 'f': + issuefile = optarg; + break; ++ case 'i': ++ interface_name = strdup(optarg); ++ break; + case 'l': + loginpath = optarg; + break; +@@ -459,6 +465,13 @@ + sa.sin_addr = bind_addr; + #endif + ++ /* Set it to listen on the specified interface */ ++ if (interface_name) { ++ strncpy(interface.ifr_ifrn.ifrn_name, interface_name, IFNAMSIZ); ++ (void)setsockopt(master_fd, SOL_SOCKET, ++ SO_BINDTODEVICE, &interface, sizeof(interface)); ++ } ++ + bb_xbind(master_fd, (struct sockaddr *) &sa, sizeof(sa)); + bb_xlisten(master_fd, 1); + bb_xdaemon(0, 0); diff --git a/package/busybox/patches/140-unlink-passwd.patch b/package/busybox/patches/140-unlink-passwd.patch new file mode 100644 index 0000000000..07b6767e6e --- /dev/null +++ b/package/busybox/patches/140-unlink-passwd.patch @@ -0,0 +1,32 @@ +--- busybox-1.00.old/loginutils/passwd.c 2004-09-15 04:39:09.000000000 +0200 ++++ busybox-1.00/loginutils/passwd.c 2005-03-23 15:31:07.000000000 +0100 +@@ -54,11 +54,12 @@ + snprintf(filename, sizeof filename, "%s", bb_path_passwd_file); + } + +- if (((fp = fopen(filename, "r+")) == 0) || (fstat(fileno(fp), &sb))) { ++ if (((fp = fopen(filename, "r")) == 0) || (fstat(fileno(fp), &sb))) { + /* return 0; */ + return 1; + } + ++#if 0 + /* Lock the password file before updating */ + lock.l_type = F_WRLCK; + lock.l_whence = SEEK_SET; +@@ -69,6 +70,7 @@ + return 1; + } + lock.l_type = F_UNLCK; ++#endif + + snprintf(buf, sizeof buf, "%s-", filename); + if (create_backup(buf, fp)) { +@@ -119,6 +121,7 @@ + fclose(fp); + return 1; + } ++ unlink(filename); + if (rename(buf, filename) < 0) { + fcntl(fileno(fp), F_SETLK, &lock); + fclose(fp); diff --git a/package/busybox/patches/150-udhcp-release.patch b/package/busybox/patches/150-udhcp-release.patch new file mode 100644 index 0000000000..1e1c00ef29 --- /dev/null +++ b/package/busybox/patches/150-udhcp-release.patch @@ -0,0 +1,90 @@ +diff -ruN busybox-1.2.0-old/include/usage.h busybox-1.2.0-new/include/usage.h +--- busybox-1.2.0-old/include/usage.h 2006-07-31 10:47:56.000000000 +0200 ++++ busybox-1.2.0-new/include/usage.h 2006-07-31 11:08:49.000000000 +0200 +@@ -3190,6 +3190,7 @@ + "\t-n,\t--now\tExit with failure if lease cannot be immediately negotiated\n" \ + "\t-p,\t--pidfile=file\tStore process ID of daemon in file\n" \ + "\t-q,\t--quit\tQuit after obtaining lease\n" \ ++ "\t-R,\t--release\tRelease IP on quit\n" \ + "\t-r,\t--request=IP\tIP address to request (default: none)\n" \ + "\t-s,\t--script=file\tRun file at dhcp events (default: /usr/share/udhcpc/default.script)\n" \ + "\t-t,\t--retries=NUM\tSend up to NUM request packets\n"\ +diff -ruN busybox-1.2.0-old/networking/udhcp/dhcpc.c busybox-1.2.0-new/networking/udhcp/dhcpc.c +--- busybox-1.2.0-old/networking/udhcp/dhcpc.c 2006-07-01 00:42:02.000000000 +0200 ++++ busybox-1.2.0-new/networking/udhcp/dhcpc.c 2006-07-31 11:08:49.000000000 +0200 +@@ -47,6 +47,7 @@ + .abort_if_no_lease = 0, + .foreground = 0, + .quit_after_lease = 0, ++ .release_on_quit = 0, + .background_if_no_lease = 0, + .interface = "eth0", + .pidfile = NULL, +@@ -163,6 +164,7 @@ + {"now", no_argument, 0, 'n'}, + {"pidfile", required_argument, 0, 'p'}, + {"quit", no_argument, 0, 'q'}, ++ {"release", no_argument, 0, 'R'}, + {"request", required_argument, 0, 'r'}, + {"script", required_argument, 0, 's'}, + {"timeout", required_argument, 0, 'T'}, +@@ -174,7 +176,7 @@ + /* get options */ + while (1) { + int option_index = 0; +- c = getopt_long(argc, argv, "c:CV:fbH:h:F:i:np:qr:s:T:t:v", arg_options, &option_index); ++ c = getopt_long(argc, argv, "c:CV:fbH:h:F:i:np:qRr:s:T:t:v", arg_options, &option_index); + if (c == -1) break; + + switch (c) { +@@ -244,6 +246,9 @@ + case 'q': + client_config.quit_after_lease = 1; + break; ++ case 'R': ++ client_config.release_on_quit = 1; ++ break; + case 'r': + requested_ip = inet_addr(optarg); + break; +@@ -488,8 +493,11 @@ + + state = BOUND; + change_mode(LISTEN_NONE); +- if (client_config.quit_after_lease) ++ if (client_config.quit_after_lease) { ++ if (client_config.release_on_quit) ++ perform_release(); + return 0; ++ } + if (!client_config.foreground) + client_background(); + +@@ -514,12 +522,13 @@ + case SIGUSR1: + perform_renew(); + break; +- case SIGUSR2: +- perform_release(); +- break; + case SIGTERM: + LOG(LOG_INFO, "Received SIGTERM"); ++ if (!client_config.release_on_quit) + return 0; ++ case SIGUSR2: ++ perform_release(); ++ break; + } + } else if (retval == -1 && errno == EINTR) { + /* a signal was caught */ +diff -ruN busybox-1.2.0-old/networking/udhcp/dhcpc.h busybox-1.2.0-new/networking/udhcp/dhcpc.h +--- busybox-1.2.0-old/networking/udhcp/dhcpc.h 2006-07-01 00:42:02.000000000 +0200 ++++ busybox-1.2.0-new/networking/udhcp/dhcpc.h 2006-07-31 11:08:49.000000000 +0200 +@@ -18,6 +18,7 @@ + struct client_config_t { + char foreground; /* Do not fork */ + char quit_after_lease; /* Quit after obtaining lease */ ++ char release_on_quit; /* perform release on quit */ + char abort_if_no_lease; /* Abort if no lease */ + char background_if_no_lease; /* Fork to background if no lease */ + char *interface; /* The name of the interface to use */ diff --git a/package/busybox/patches/170-udhcp-options.patch b/package/busybox/patches/170-udhcp-options.patch new file mode 100644 index 0000000000..b03810adf5 --- /dev/null +++ b/package/busybox/patches/170-udhcp-options.patch @@ -0,0 +1,15 @@ +diff -Nur busybox-1.00.orig/networking/udhcp/options.c busybox-1.00/networking/udhcp/options.c +--- busybox-1.00.orig/networking/udhcp/options.c 2004-03-15 09:29:01.000000000 +0100 ++++ busybox-1.00/networking/udhcp/options.c 2005-09-14 13:27:23.792609800 +0200 +@@ -39,8 +39,11 @@ + {"dhcptype", OPTION_U8, 0x35}, + {"serverid", OPTION_IP, 0x36}, + {"message", OPTION_STRING, 0x38}, ++ {"vendorclass", OPTION_STRING, 0x3C}, ++ {"clientid", OPTION_STRING, 0x3D}, + {"tftp", OPTION_STRING, 0x42}, + {"bootfile", OPTION_STRING, 0x43}, ++ {"userclass", OPTION_STRING, 0x4D}, + {"", 0x00, 0x00} + }; + diff --git a/package/busybox/patches/180-telnetd_ipv6.patch b/package/busybox/patches/180-telnetd_ipv6.patch new file mode 100644 index 0000000000..fb8df6fa92 --- /dev/null +++ b/package/busybox/patches/180-telnetd_ipv6.patch @@ -0,0 +1,12 @@ +diff -urN busybox.old/networking/telnetd.c busybox.dev/networking/telnetd.c +--- busybox.old/networking/telnetd.c 2005-08-17 03:29:10.000000000 +0200 ++++ busybox.dev/networking/telnetd.c 2005-10-22 19:37:49.976396000 +0200 +@@ -49,6 +49,8 @@ + + #define BUFSIZE 4000 + ++#undef CONFIG_FEATURE_IPV6 ++ + #ifdef CONFIG_FEATURE_IPV6 + #define SOCKET_TYPE AF_INET6 + typedef struct sockaddr_in6 sockaddr_type; diff --git a/package/busybox/patches/190-ash_performance.patch b/package/busybox/patches/190-ash_performance.patch new file mode 100644 index 0000000000..0931931419 --- /dev/null +++ b/package/busybox/patches/190-ash_performance.patch @@ -0,0 +1,80 @@ + + Copyright (C) 2006 OpenWrt.org + +diff -urN busybox.old/shell/ash.c busybox.dev/shell/ash.c +--- busybox.old/shell/ash.c 2005-11-12 22:39:19.853826250 +0100 ++++ busybox.dev/shell/ash.c 2005-11-12 22:39:42.771258500 +0100 +@@ -1414,6 +1414,13 @@ + + #define NUMBUILTINS (sizeof (builtincmd) / sizeof (struct builtincmd) ) + ++static const char *safe_applets[] = { ++ "[", "test", "echo", "cat", ++ "ln", "cp", "touch", "mkdir", "rm", ++ "cut", "hexdump", "awk", "sort", ++ "find", "xargs", "ls", "dd", ++ "chown", "chmod" ++}; + + + struct cmdentry { +@@ -2050,6 +2057,19 @@ + static void exitshell(void) __attribute__((__noreturn__)); + static int decode_signal(const char *, int); + ++ ++static int is_safe_applet(char *name) ++{ ++ int n = sizeof(safe_applets) / sizeof(char *); ++ int i; ++ for (i = 0; i < n; i++) ++ if (strcmp(safe_applets[i], name) == 0) ++ return 1; ++ ++ return 0; ++} ++ ++ + /* + * This routine is called when an error or an interrupt occurs in an + * interactive shell and control is returned to the main command loop. +@@ -3680,6 +3700,7 @@ + clearredir(1); + envp = environment(); + if (strchr(argv[0], '/') != NULL ++ || is_safe_applet(argv[0]) + #ifdef CONFIG_FEATURE_SH_STANDALONE_SHELL + || find_applet_by_name(argv[0]) + #endif +@@ -3721,6 +3742,18 @@ + tryexec(char *cmd, char **argv, char **envp) + { + int repeated = 0; ++ struct BB_applet *a; ++ int argc = 0; ++ char **c; ++ ++ if(strchr(cmd, '/') == NULL && is_safe_applet(cmd) && (a = find_applet_by_name(cmd)) != NULL) { ++ c = argv; ++ while (*c != NULL) { ++ c++; argc++; ++ } ++ bb_applet_name = cmd; ++ exit(a->main(argc, argv)); ++ } + #ifdef CONFIG_FEATURE_SH_STANDALONE_SHELL + int flg_bb = 0; + char *name = cmd; +@@ -3919,6 +3952,12 @@ + } + #endif + ++ if (is_safe_applet(name)) { ++ entry->cmdtype = CMDNORMAL; ++ entry->u.index = -1; ++ return; ++ } ++ + updatetbl = (path == pathval()); + if (!updatetbl) { + act |= DO_ALTPATH; diff --git a/package/busybox/patches/200-etc_crontabs.patch b/package/busybox/patches/200-etc_crontabs.patch new file mode 100644 index 0000000000..5ec01c1eb0 --- /dev/null +++ b/package/busybox/patches/200-etc_crontabs.patch @@ -0,0 +1,24 @@ +diff -urN busybox.old/miscutils/crond.c busybox.dev/miscutils/crond.c +--- busybox.old/miscutils/crond.c 2004-04-14 19:51:21.000000000 +0200 ++++ busybox.dev/miscutils/crond.c 2005-12-11 22:54:07.878256250 +0100 +@@ -36,7 +36,7 @@ + #define arysize(ary) (sizeof(ary)/sizeof((ary)[0])) + + #ifndef CRONTABS +-#define CRONTABS "/var/spool/cron/crontabs" ++#define CRONTABS "/etc/crontabs" + #endif + #ifndef TMPDIR + #define TMPDIR "/var/spool/cron" +diff -urN busybox.old/miscutils/crontab.c busybox.dev/miscutils/crontab.c +--- busybox.old/miscutils/crontab.c 2004-04-14 19:51:21.000000000 +0200 ++++ busybox.dev/miscutils/crontab.c 2005-12-11 22:54:28.647554250 +0100 +@@ -28,7 +28,7 @@ + #include <sys/resource.h> + + #ifndef CRONTABS +-#define CRONTABS "/var/spool/cron/crontabs" ++#define CRONTABS "/etc/crontabs" + #endif + #ifndef TMPDIR + #define TMPDIR "/var/spool/cron" diff --git a/package/busybox/patches/210-passwd_limit.patch b/package/busybox/patches/210-passwd_limit.patch new file mode 100644 index 0000000000..6c10916b4a --- /dev/null +++ b/package/busybox/patches/210-passwd_limit.patch @@ -0,0 +1,15 @@ + + Copyright (C) 2006 OpenWrt.org + +diff -urN busybox.old/loginutils/passwd.c busybox.dev/loginutils/passwd.c +--- busybox.old/loginutils/passwd.c 2005-12-11 22:52:46.185150000 +0100 ++++ busybox.dev/loginutils/passwd.c 2005-12-11 23:19:15.276596500 +0100 +@@ -353,7 +353,7 @@ + } else { + orig[0] = '\0'; + } +- if (! (cp=bb_askpass(0, "Enter the new password (minimum of 5, maximum of 8 characters)\n" ++ if (! (cp=bb_askpass(0, "Enter the new password (minimum of 5 characters)\n" + "Please use a combination of upper and lower case letters and numbers.\n" + "Enter new password: "))) + { diff --git a/package/busybox/patches/220-awk_bitops.patch b/package/busybox/patches/220-awk_bitops.patch new file mode 100644 index 0000000000..1567583d2a --- /dev/null +++ b/package/busybox/patches/220-awk_bitops.patch @@ -0,0 +1,64 @@ + + Copyright (C) 2006 OpenWrt.org + +--- busybox-1.00/editors/awk.c.orig 2004-09-24 05:24:27 -04:00 ++++ busybox-1.00/editors/awk.c 2006-03-08 02:16:52 -05:00 +@@ -271,7 +271,8 @@ + /* builtins */ + enum { + B_a2=0, B_ix, B_ma, B_sp, B_ss, B_ti, B_lo, B_up, +- B_ge, B_gs, B_su ++ B_ge, B_gs, B_su, ++ B_an, B_co, B_ls, B_or, B_rs, B_xo, + }; + + /* tokens and their corresponding info values */ +@@ -311,6 +312,8 @@ + "\5while" NTC + "\4else" NTC + ++ "\3and" "\5compl" "\6lshift" "\2or" ++ "\6rshift" "\3xor" + "\5close" "\6system" "\6fflush" "\5atan2" /* BUILTIN */ + "\3cos" "\3exp" "\3int" "\3log" + "\4rand" "\3sin" "\4sqrt" "\5srand" +@@ -364,6 +367,8 @@ + ST_WHILE, + 0, + ++ OC_B|B_an|P(0x83), OC_B|B_co|P(0x41), OC_B|B_ls|P(0x83), OC_B|B_or|P(0x83), ++ OC_B|B_rs|P(0x83), OC_B|B_xo|P(0x83), + OC_FBLTIN|Sx|F_cl, OC_FBLTIN|Sx|F_sy, OC_FBLTIN|Sx|F_ff, OC_B|B_a2|P(0x83), + OC_FBLTIN|Nx|F_co, OC_FBLTIN|Nx|F_ex, OC_FBLTIN|Nx|F_in, OC_FBLTIN|Nx|F_lg, + OC_FBLTIN|F_rn, OC_FBLTIN|Nx|F_si, OC_FBLTIN|Nx|F_sq, OC_FBLTIN|Nx|F_sr, +@@ -1942,6 +1947,30 @@ + strncpy(s, as[0]+i, n); + s[n] = '\0'; + setvar_p(res, s); ++ break; ++ ++ case B_an: ++ setvar_i(res, (long)getvar_i(av[0]) & (long)getvar_i(av[1])); ++ break; ++ ++ case B_co: ++ setvar_i(res, ~(long)getvar_i(av[0])); ++ break; ++ ++ case B_ls: ++ setvar_i(res, (long)getvar_i(av[0]) << (long)getvar_i(av[1])); ++ break; ++ ++ case B_or: ++ setvar_i(res, (long)getvar_i(av[0]) | (long)getvar_i(av[1])); ++ break; ++ ++ case B_rs: ++ setvar_i(res, (long)((unsigned long)getvar_i(av[0]) >> (unsigned long)getvar_i(av[1]))); ++ break; ++ ++ case B_xo: ++ setvar_i(res, (long)getvar_i(av[0]) ^ (long)getvar_i(av[1])); + break; + + case B_lo: diff --git a/package/busybox/patches/230-grep_C.patch b/package/busybox/patches/230-grep_C.patch new file mode 100644 index 0000000000..08d76738b3 --- /dev/null +++ b/package/busybox/patches/230-grep_C.patch @@ -0,0 +1,12 @@ +diff -Nur busybox-1.2.1/findutils/grep.c busybox-1.2.1/findutils/grep.c +--- busybox-1.2.1/findutils/grep.c 2006-09-25 14:47:51.000000000 -0700 ++++ busybox-1.2.1/findutils/grep.c 2006-09-25 14:39:39.000000000 -0700 +@@ -51,7 +51,7 @@ + #define GREP_OPT_L (1<<12) + #define PRINT_FILES_WITHOUT_MATCHES ((opt & GREP_OPT_L) != 0) + #if ENABLE_FEATURE_GREP_CONTEXT +-#define GREP_OPT_CONTEXT "A:B:C" ++#define GREP_OPT_CONTEXT "A:B:C:" + #define GREP_OPT_A (1<<13) + #define GREP_OPT_B (1<<14) + #define GREP_OPT_C (1<<15) diff --git a/package/busybox/patches/300-netmsg.patch b/package/busybox/patches/300-netmsg.patch new file mode 100644 index 0000000000..428e321390 --- /dev/null +++ b/package/busybox/patches/300-netmsg.patch @@ -0,0 +1,110 @@ +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +diff -ruN busybox-1.2.0-old/include/applets.h busybox-1.2.0-new/include/applets.h +--- busybox-1.2.0-old/include/applets.h 2006-07-31 10:47:56.000000000 +0200 ++++ busybox-1.2.0-new/include/applets.h 2006-07-31 11:21:00.000000000 +0200 +@@ -200,6 +200,7 @@ + USE_MV(APPLET(mv, _BB_DIR_BIN, _BB_SUID_NEVER)) + USE_NAMEIF(APPLET(nameif, _BB_DIR_SBIN, _BB_SUID_NEVER)) + USE_NC(APPLET(nc, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) ++USE_NETMSG(APPLET_NOUSAGE(netmsg, netmsg, _BB_DIR_BIN, _BB_SUID_ALWAYS)) + USE_NETSTAT(APPLET(netstat, _BB_DIR_BIN, _BB_SUID_NEVER)) + USE_NICE(APPLET(nice, _BB_DIR_BIN, _BB_SUID_NEVER)) + USE_NOHUP(APPLET(nohup, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) +diff -ruN busybox-1.2.0-old/networking/Config.in busybox-1.2.0-new/networking/Config.in +--- busybox-1.2.0-old/networking/Config.in 2006-07-01 00:42:02.000000000 +0200 ++++ busybox-1.2.0-new/networking/Config.in 2006-07-31 11:18:01.000000000 +0200 +@@ -445,6 +445,12 @@ + help + A simple Unix utility which reads and writes data across network + connections. ++ ++config CONFIG_NETMSG ++ bool "netmsg" ++ default n ++ help ++ simple program for sending udp broadcast messages + + config CONFIG_NC_GAPING_SECURITY_HOLE + bool "gaping security hole" +diff -ruN busybox-1.2.0-old/networking/Makefile.in busybox-1.2.0-new/networking/Makefile.in +--- busybox-1.2.0-old/networking/Makefile.in 2006-07-01 00:42:02.000000000 +0200 ++++ busybox-1.2.0-new/networking/Makefile.in 2006-07-31 11:18:01.000000000 +0200 +@@ -30,6 +30,7 @@ + NETWORKING-$(CONFIG_IPTUNNEL) += iptunnel.o + NETWORKING-$(CONFIG_NAMEIF) += nameif.o + NETWORKING-$(CONFIG_NC) += nc.o ++NETWORKING-$(CONFIG_NETMSG) += netmsg.o + NETWORKING-$(CONFIG_NETSTAT) += netstat.o + NETWORKING-$(CONFIG_NSLOOKUP) += nslookup.o + NETWORKING-$(CONFIG_PING) += ping.o +diff -ruN busybox-1.2.0-old/networking/netmsg.c busybox-1.2.0-new/networking/netmsg.c +--- busybox-1.2.0-old/networking/netmsg.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0-new/networking/netmsg.c 2006-07-31 11:18:01.000000000 +0200 +@@ -0,0 +1,63 @@ ++/* ++ * Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org> ++ * ++ * This is free software, licensed under the GNU General Public License v2. ++ */ ++#include <sys/types.h> ++#include <sys/socket.h> ++#include <netinet/in.h> ++#include <netdb.h> ++#include <stdio.h> ++#include <stdlib.h> ++#include <string.h> ++#include "busybox.h" ++ ++ ++#ifndef CONFIG_NETMSG ++int main(int argc, char **argv) ++#else ++int netmsg_main(int argc, char **argv) ++#endif ++{ ++ int s, i; ++ struct sockaddr_in addr; ++ int optval = 1; ++ unsigned char buf[1001]; ++ ++ if (argc != 3) { ++ fprintf(stderr, "usage: %s <ip> \"<message>\"\n", argv[0]); ++ exit(1); ++ } ++ ++ if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { ++ perror("Opening socket"); ++ exit(1); ++ } ++ ++ memset(&addr, 0, sizeof(addr)); ++ addr.sin_family = AF_INET; ++ addr.sin_addr.s_addr = inet_addr(argv[1]); ++ addr.sin_port = htons(0x1337); ++ ++ memset(buf, 0, 1001); ++ buf[0] = 0xde; ++ buf[1] = 0xad; ++ ++ strncpy(buf + 2, argv[2], 998); ++ ++ if (setsockopt (s, SOL_SOCKET, SO_BROADCAST, (caddr_t) &optval, sizeof (optval)) < 0) { ++ perror("setsockopt()"); ++ goto fail; ++ } ++ ++ if (sendto(s, buf, 1001, 0, (struct sockaddr *) &addr, sizeof(addr)) < 0) { ++ perror("sendto()"); ++ goto fail; ++ } ++ ++ return 0; ++ ++fail: ++ close(s); ++ exit(1); ++} diff --git a/package/busybox/patches/310-passwd_access.patch b/package/busybox/patches/310-passwd_access.patch new file mode 100644 index 0000000000..868abfcd06 --- /dev/null +++ b/package/busybox/patches/310-passwd_access.patch @@ -0,0 +1,44 @@ + + Copyright (C) 2006 OpenWrt.org + +diff -urN busybox.old/networking/httpd.c busybox.dev/networking/httpd.c +--- busybox.old/networking/httpd.c 2004-10-08 10:03:29.000000000 +0200 ++++ busybox.dev/networking/httpd.c 2006-02-04 01:54:19.688016250 +0100 +@@ -1467,12 +1467,26 @@ + { + char *cipher; + char *pp; ++ char *ppnew = NULL; ++ struct passwd *pwd = NULL; + + if(strncmp(p, request, u-request) != 0) { + /* user uncompared */ + continue; + } + pp = strchr(p, ':'); ++ if(pp && pp[1] == '$' && pp[2] == 'p' && ++ pp[3] == '$' && pp[4] && ++ (pwd = getpwnam(&pp[4])) != NULL) { ++ if(pwd->pw_passwd && pwd->pw_passwd[0] == '!') { ++ prev = NULL; ++ continue; ++ } ++ ppnew = malloc(5 + strlen(pwd->pw_passwd)); ++ ppnew[0] = ':'; ++ strcpy(ppnew + 1, pwd->pw_passwd); ++ pp = ppnew; ++ } + if(pp && pp[1] == '$' && pp[2] == '1' && + pp[3] == '$' && pp[4]) { + pp++; +@@ -1482,6 +1492,10 @@ + /* unauthorized */ + continue; + } ++ if (ppnew) { ++ free(ppnew); ++ ppnew = NULL; ++ } + } + #endif + if (strcmp(p, request) == 0) { diff --git a/package/busybox/patches/320-httpd_address_binding.patch b/package/busybox/patches/320-httpd_address_binding.patch new file mode 100644 index 0000000000..68487b88c7 --- /dev/null +++ b/package/busybox/patches/320-httpd_address_binding.patch @@ -0,0 +1,95 @@ +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +diff -ruN busybox-1.2.0-old/networking/httpd.c busybox-1.2.0-new/networking/httpd.c +--- busybox-1.2.0-old/networking/httpd.c 2006-07-01 00:42:02.000000000 +0200 ++++ busybox-1.2.0-new/networking/httpd.c 2006-08-01 10:06:58.000000000 +0200 +@@ -99,6 +99,7 @@ + #include <sys/types.h> + #include <sys/socket.h> /* for connect and socket*/ + #include <netinet/in.h> /* for sockaddr_in */ ++#include <arpa/inet.h> + #include <sys/stat.h> + #include <sys/wait.h> + #include <fcntl.h> /* for open modes */ +@@ -165,6 +166,7 @@ + #endif + unsigned port; /* server initial port and for + set env REMOTE_PORT */ ++ char *address; + union HTTPD_FOUND { + const char *found_mime_type; + const char *found_moved_temporarily; +@@ -868,7 +870,10 @@ + /* inet_addr() returns a value that is already in network order */ + memset(&lsocket, 0, sizeof(lsocket)); + lsocket.sin_family = AF_INET; +- lsocket.sin_addr.s_addr = INADDR_ANY; ++ if (inet_aton(config->address, &(lsocket.sin_addr)) == 1) { ++ if (config->address != NULL) lsocket.sin_addr.s_addr = ((struct in_addr *) ((gethostbyname(config->address))->h_addr))->s_addr; ++ else lsocket.sin_addr.s_addr = htons(INADDR_ANY); ++ } + lsocket.sin_port = htons(config->port); + fd = bb_xsocket(AF_INET, SOCK_STREAM, 0); + /* tell the OS it's OK to reuse a previous address even though */ +@@ -1899,6 +1904,7 @@ + USE_FEATURE_HTTPD_AUTH_MD5(m_opt_md5,) + USE_FEATURE_HTTPD_SETUID(u_opt_setuid,) + USE_FEATURE_HTTPD_WITHOUT_INETD(p_opt_port,) ++ USE_FEATURE_HTTPD_WITHOUT_INETD(l_opt_addr,) + }; + + static const char httpd_opts[]="c:d:h:" +@@ -1906,7 +1912,7 @@ + USE_FEATURE_HTTPD_BASIC_AUTH("r:") + USE_FEATURE_HTTPD_AUTH_MD5("m:") + USE_FEATURE_HTTPD_SETUID("u:") +- USE_FEATURE_HTTPD_WITHOUT_INETD("p:"); ++ USE_FEATURE_HTTPD_WITHOUT_INETD("p:l:"); + + #define OPT_CONFIG_FILE (1<<c_opt_config_file) + #define OPT_DECODE_URL (1<<d_opt_decode_url) +@@ -1927,6 +1933,8 @@ + #define OPT_PORT USE_FEATURE_HTTPD_WITHOUT_INETD((1<<p_opt_port)) \ + SKIP_FEATURE_HTTPD_WITHOUT_INETD(0) + ++#define OPT_ADDRESS USE_FEATURE_HTTPD_WITHOUT_INETD((1<<l_opt_addr)) \ ++ SKIP_FEATURE_HTTPD_WITHOUT_INETD(0) + + int httpd_main(int argc, char *argv[]) + { +@@ -1935,6 +1943,7 @@ + char *url_for_decode; + USE_FEATURE_HTTPD_ENCODE_URL_STR(const char *url_for_encode;) + USE_FEATURE_HTTPD_WITHOUT_INETD(const char *s_port;) ++ USE_FEATURE_HTTPD_WITHOUT_INETD(const char *s_addr;) + USE_FEATURE_HTTPD_WITHOUT_INETD(int server;) + + USE_FEATURE_HTTPD_SETUID(const char *s_uid;) +@@ -1949,6 +1958,7 @@ + + #ifdef CONFIG_FEATURE_HTTPD_WITHOUT_INETD + config->port = 80; ++ config->address = ""; + #endif + + config->ContentLength = -1; +@@ -1960,6 +1970,7 @@ + USE_FEATURE_HTTPD_AUTH_MD5(, &pass) + USE_FEATURE_HTTPD_SETUID(, &s_uid) + USE_FEATURE_HTTPD_WITHOUT_INETD(, &s_port) ++ USE_FEATURE_HTTPD_WITHOUT_INETD(, &s_addr) + ); + + if(opt & OPT_DECODE_URL) { +@@ -1981,6 +1992,8 @@ + #ifdef CONFIG_FEATURE_HTTPD_WITHOUT_INETD + if(opt & OPT_PORT) + config->port = bb_xgetlarg(s_port, 10, 1, 0xffff); ++ if (opt & OPT_ADDRESS) ++ if (s_addr) config->address = (char *) s_addr; + #ifdef CONFIG_FEATURE_HTTPD_SETUID + if(opt & OPT_SETUID) { + char *e; diff --git a/package/busybox/patches/330-httpd_user_agent.patch b/package/busybox/patches/330-httpd_user_agent.patch new file mode 100644 index 0000000000..bbe01f7826 --- /dev/null +++ b/package/busybox/patches/330-httpd_user_agent.patch @@ -0,0 +1,30 @@ +diff -Nur busybox-1.1.1/networking/httpd.c busybox-1.1.1-owrt/networking/httpd.c +--- busybox-1.1.1/networking/httpd.c 2006-04-01 19:42:36.000000000 +0200 ++++ busybox-1.1.1-owrt/networking/httpd.c 2006-04-01 19:43:59.000000000 +0200 +@@ -247,6 +247,7 @@ + const char *query; + + USE_FEATURE_HTTPD_CGI(char *referer;) ++ USE_FEATURE_HTTPD_CGI(char *user_agent;) + + const char *configFile; + +@@ -1208,6 +1209,7 @@ + addEnv("SERVER", "PROTOCOL", "HTTP/1.0"); + addEnv("GATEWAY_INTERFACE", "", "CGI/1.1"); + addEnv("REMOTE", "ADDR", config->rmt_ip_str); ++ addEnv("HTTP","USER_AGENT", config->user_agent); + #ifdef CONFIG_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV + addEnvPort("REMOTE"); + #endif +@@ -1771,6 +1773,10 @@ + for(test = buf + 8; isspace(*test); test++) + ; + config->referer = strdup(test); ++ } else if ((strncasecmp(buf, "User-Agent:",11) ==0)) { ++ for(test = buf + 11; isspace(*test); test++) ++ ; ++ config->user_agent = strdup(test); + } + #endif + diff --git a/package/busybox/patches/340-lock_util.patch b/package/busybox/patches/340-lock_util.patch new file mode 100644 index 0000000000..a86948d597 --- /dev/null +++ b/package/busybox/patches/340-lock_util.patch @@ -0,0 +1,180 @@ +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +diff -ruN busybox-1.2.0-old/include/applets.h busybox-1.2.0-new/include/applets.h +--- busybox-1.2.0-old/include/applets.h 2006-07-31 11:21:00.000000000 +0200 ++++ busybox-1.2.0-new/include/applets.h 2006-08-01 10:21:15.000000000 +0200 +@@ -169,6 +169,7 @@ + USE_LN(APPLET(ln, _BB_DIR_BIN, _BB_SUID_NEVER)) + USE_LOADFONT(APPLET(loadfont, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) + USE_LOADKMAP(APPLET(loadkmap, _BB_DIR_SBIN, _BB_SUID_NEVER)) ++USE_LOCK(APPLET_NOUSAGE(lock, lock, _BB_DIR_BIN, _BB_SUID_NEVER)) + USE_LOGGER(APPLET(logger, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) + USE_LOGIN(APPLET(login, _BB_DIR_BIN, _BB_SUID_ALWAYS)) + USE_LOGNAME(APPLET(logname, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) +diff -ruN busybox-1.2.0-old/miscutils/Config.in busybox-1.2.0-new/miscutils/Config.in +--- busybox-1.2.0-old/miscutils/Config.in 2006-07-01 00:42:09.000000000 +0200 ++++ busybox-1.2.0-new/miscutils/Config.in 2006-08-01 10:21:15.000000000 +0200 +@@ -231,6 +231,12 @@ + Enables the 'hdparm -d' option to get/set using_dma flag. + This is dangerous stuff, so you should probably say N. + ++config CONFIG_LOCK ++ bool "lock" ++ default y ++ help ++ Small utility for using locks in scripts ++ + config CONFIG_MAKEDEVS + bool "makedevs" + default n +diff -ruN busybox-1.2.0-old/miscutils/lock.c busybox-1.2.0-new/miscutils/lock.c +--- busybox-1.2.0-old/miscutils/lock.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0-new/miscutils/lock.c 2006-08-01 10:21:15.000000000 +0200 +@@ -0,0 +1,133 @@ ++/* ++ * Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org> ++ * ++ * This is free software, licensed under the GNU General Public License v2. ++ */ ++#include <sys/types.h> ++#include <sys/file.h> ++#include <sys/stat.h> ++#include <signal.h> ++#include <fcntl.h> ++#include <unistd.h> ++#include <stdio.h> ++#include "busybox.h" ++ ++static int unlock = 0; ++static int shared = 0; ++static int waitonly = 0; ++static int fd; ++static char *file; ++ ++static void usage(char *name) ++{ ++ fprintf(stderr, "Usage: %s [-suw] <filename>\n" ++ " -s Use shared locking\n" ++ " -u Unlock\n" ++ " -w Wait for the lock to become free, don't acquire lock\n" ++ "\n", name); ++ exit(1); ++} ++ ++static void exit_unlock(int sig) ++{ ++ flock(fd, LOCK_UN); ++ unlink(file); ++ exit(0); ++} ++ ++static int do_unlock(void) ++{ ++ FILE *f; ++ int i; ++ ++ if ((f = fopen(file, "r")) == NULL) ++ return 0; ++ ++ fscanf(f, "%d", &i); ++ if (i > 0) ++ kill(i, SIGTERM); ++ ++ fclose(f); ++ ++ return 0; ++} ++ ++static int do_lock(void) ++{ ++ int pid; ++ char pidstr[8]; ++ ++ if ((fd = open(file, O_RDWR | O_CREAT, 0700)) < 0) { ++ fprintf(stderr, "Can't open %s\n", file); ++ return 1; ++ } ++ ++ if (flock(fd, (shared ? LOCK_SH : LOCK_EX)) < 0) { ++ fprintf(stderr, "Can't lock %s\n", file); ++ return 1; ++ } ++ ++ pid = fork(); ++ ++ if (pid < 0) ++ return -1; ++ ++ if (pid == 0) { ++ signal(SIGKILL, exit_unlock); ++ signal(SIGTERM, exit_unlock); ++ signal(SIGINT, exit_unlock); ++ if (waitonly) ++ exit_unlock(0); ++ else ++ while (1) ++ sleep(1); ++ } else { ++ if (!waitonly) { ++ lseek(fd, 0, SEEK_SET); ++ ftruncate(fd, 0); ++ sprintf(pidstr, "%d\n", pid); ++ write(fd, pidstr, strlen(pidstr)); ++ close(fd); ++ } ++ ++ return 0; ++ } ++} ++ ++#ifndef CONFIG_LOCK ++int main(int argc, char **argv) ++#else ++int lock_main(int argc, char **argv) ++#endif ++{ ++ char **args = &argv[1]; ++ int c = argc - 1; ++ ++ while ((*args != NULL) && (*args)[0] == '-') { ++ char *ch = *args; ++ while (*(++ch) > 0) { ++ switch(*ch) { ++ case 'w': ++ waitonly = 1; ++ break; ++ case 's': ++ shared = 1; ++ break; ++ case 'u': ++ unlock = 1; ++ break; ++ } ++ } ++ c--; ++ args++; ++ } ++ ++ if (c != 1) ++ usage(argv[0]); ++ ++ file = *args; ++ if (unlock) ++ return do_unlock(); ++ else ++ return do_lock(); ++} +diff -ruN busybox-1.2.0-old/miscutils/Makefile.in busybox-1.2.0-new/miscutils/Makefile.in +--- busybox-1.2.0-old/miscutils/Makefile.in 2006-07-01 00:42:09.000000000 +0200 ++++ busybox-1.2.0-new/miscutils/Makefile.in 2006-08-01 10:21:15.000000000 +0200 +@@ -20,6 +20,7 @@ + MISCUTILS-$(CONFIG_EJECT) += eject.o + MISCUTILS-$(CONFIG_HDPARM) += hdparm.o + MISCUTILS-$(CONFIG_LAST) += last.o ++MISCUTILS-$(CONFIG_LOCK) += lock.o + MISCUTILS-${CONFIG_LESS} += less.o + MISCUTILS-$(CONFIG_MAKEDEVS) += makedevs.o + MISCUTILS-$(CONFIG_MOUNTPOINT) += mountpoint.o diff --git a/package/busybox/patches/911-ipkg.patch b/package/busybox/patches/911-ipkg.patch new file mode 100644 index 0000000000..fdb790ad59 --- /dev/null +++ b/package/busybox/patches/911-ipkg.patch @@ -0,0 +1,13896 @@ +diff -ruN busybox-1.2.0-orig/archival/Config.in busybox-1.2.0+ipkg-0.99.162/archival/Config.in +--- busybox-1.2.0-orig/archival/Config.in 2006-07-01 00:42:04.000000000 +0200 ++++ busybox-1.2.0+ipkg-0.99.162/archival/Config.in 2006-07-22 16:31:25.000000000 +0200 +@@ -121,6 +121,14 @@ + gzip is used to compress files. + It's probably the most widely used UNIX compression program. + ++config CONFIG_IPKG ++ bool "ipkg" ++ default n ++ select CONFIG_MD5SUM ++ select CONFIG_WGET ++ help ++ ipkg is the itsy package management system. ++ + config CONFIG_RPM2CPIO + bool "rpm2cpio" + default n +diff -ruN busybox-1.2.0-orig/archival/dpkg.c busybox-1.2.0+ipkg-0.99.162/archival/dpkg.c +--- busybox-1.2.0-orig/archival/dpkg.c 2006-07-01 00:42:04.000000000 +0200 ++++ busybox-1.2.0+ipkg-0.99.162/archival/dpkg.c 2006-07-22 16:31:25.000000000 +0200 +@@ -1430,6 +1430,10 @@ + return(ar_handle->sub_archive->buffer); + } + ++/* ++ ++// moved to data_extract_all.c ++ + static void data_extract_all_prefix(archive_handle_t *archive_handle) + { + char *name_ptr = archive_handle->file_header->name; +@@ -1442,6 +1446,8 @@ + return; + } + ++*/ ++ + static void unpack_package(deb_file_t *deb_file) + { + const char *package_name = name_hashtable[package_hashtable[deb_file->package]->name]; +diff -ruN busybox-1.2.0-orig/archival/ipkg.c busybox-1.2.0+ipkg-0.99.162/archival/ipkg.c +--- busybox-1.2.0-orig/archival/ipkg.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/ipkg.c 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,26 @@ ++/* ipkg.c - the itsy package management system ++ ++ Florina Boor ++ ++ Copyright (C) 2003 kernel concepts ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++ ++ ipkg command line frontend using libipkg ++ ++*/ ++ ++#include "libipkg/libipkg.h" ++ ++int ipkg_main(int argc, char **argv) ++{ ++ return ipkg_op(argc, argv); ++} +diff -ruN busybox-1.2.0-orig/archival/libipkg/args.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/args.c +--- busybox-1.2.0-orig/archival/libipkg/args.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/args.c 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,242 @@ ++/* args.c - parse command-line args ++ ++ Carl D. Worth ++ ++ Copyright 2001 University of Southern California ++ ++ 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 ++ the Free Software Foundation; either version 2, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ */ ++ ++#include <getopt.h> ++#include <stdlib.h> ++#include <string.h> ++#include <unistd.h> ++ ++#include "ipkg.h" ++#include "ipkg_message.h" ++ ++#include "args.h" ++#include "sprintf_alloc.h" ++ ++#include "libbb.h" ++ ++ ++static void print_version(void); ++ ++enum long_args_opt ++{ ++ ARGS_OPT_FORCE_DEFAULTS = 129, ++ ARGS_OPT_FORCE_DEPENDS, ++ ARGS_OPT_FORCE_OVERWRITE, ++ ARGS_OPT_FORCE_DOWNGRADE, ++ ARGS_OPT_FORCE_REINSTALL, ++ ARGS_OPT_FORCE_REMOVAL_OF_DEPENDENT_PACKAGES, ++ ARGS_OPT_FORCE_REMOVAL_OF_ESSENTIAL_PACKAGES, ++ ARGS_OPT_FORCE_SPACE, ++ ARGS_OPT_NOACTION, ++ ARGS_OPT_NODEPS, ++ ARGS_OPT_VERBOSE_WGET, ++ ARGS_OPT_VERBOSITY, ++ ARGS_OPT_MULTIPLE_PROVIDERS ++}; ++ ++int args_init(args_t *args) ++{ ++ char *conf_file_dir; ++ ++ memset(args, 0, sizeof(args_t)); ++ ++ args->dest = ARGS_DEFAULT_DEST; ++ ++ conf_file_dir = getenv("IPKG_CONF_DIR"); ++ if (conf_file_dir == NULL || conf_file_dir[0] == '\0') { ++ conf_file_dir = ARGS_DEFAULT_CONF_FILE_DIR; ++ } ++ sprintf_alloc(&args->conf_file, "%s/%s", conf_file_dir, ++ ARGS_DEFAULT_CONF_FILE_NAME); ++ ++ args->force_defaults = ARGS_DEFAULT_FORCE_DEFAULTS; ++ args->force_depends = ARGS_DEFAULT_FORCE_DEPENDS; ++ args->force_overwrite = ARGS_DEFAULT_FORCE_OVERWRITE; ++ args->force_downgrade = ARGS_DEFAULT_FORCE_DOWNGRADE; ++ args->force_reinstall = ARGS_DEFAULT_FORCE_REINSTALL; ++ args->force_removal_of_dependent_packages = ARGS_DEFAULT_FORCE_REMOVAL_OF_DEPENDENT_PACKAGES; ++ args->force_removal_of_essential_packages = ARGS_DEFAULT_FORCE_REMOVAL_OF_ESSENTIAL_PACKAGES; ++ args->noaction = ARGS_DEFAULT_NOACTION; ++ args->nodeps = ARGS_DEFAULT_NODEPS; ++ args->verbose_wget = ARGS_DEFAULT_VERBOSE_WGET; ++ args->verbosity = ARGS_DEFAULT_VERBOSITY; ++ args->offline_root = ARGS_DEFAULT_OFFLINE_ROOT; ++ args->offline_root_pre_script_cmd = ARGS_DEFAULT_OFFLINE_ROOT_PRE_SCRIPT_CMD; ++ args->offline_root_post_script_cmd = ARGS_DEFAULT_OFFLINE_ROOT_POST_SCRIPT_CMD; ++ args->multiple_providers = 0; ++ args->nocheckfordirorfile = 0; ++ args->noreadfeedsfile = 0; ++ ++ return 1; ++} ++ ++void args_deinit(args_t *args) ++{ ++ free(args->conf_file); ++ args->conf_file = NULL; ++} ++ ++int args_parse(args_t *args, int argc, char *argv[]) ++{ ++ int c; ++ int option_index = 0; ++ int parse_err = 0; ++ static struct option long_options[] = { ++ {"query-all", 0, 0, 'A'}, ++ {"conf-file", 1, 0, 'f'}, ++ {"conf", 1, 0, 'f'}, ++ {"dest", 1, 0, 'd'}, ++ {"force-defaults", 0, 0, ARGS_OPT_FORCE_DEFAULTS}, ++ {"force_defaults", 0, 0, ARGS_OPT_FORCE_DEFAULTS}, ++ {"force-depends", 0, 0, ARGS_OPT_FORCE_DEPENDS}, ++ {"force_depends", 0, 0, ARGS_OPT_FORCE_DEPENDS}, ++ {"force-overwrite", 0, 0, ARGS_OPT_FORCE_OVERWRITE}, ++ {"force_overwrite", 0, 0, ARGS_OPT_FORCE_OVERWRITE}, ++ {"force_downgrade", 0, 0, ARGS_OPT_FORCE_DOWNGRADE}, ++ {"force-downgrade", 0, 0, ARGS_OPT_FORCE_DOWNGRADE}, ++ {"force-reinstall", 0, 0, ARGS_OPT_FORCE_REINSTALL}, ++ {"force_reinstall", 0, 0, ARGS_OPT_FORCE_REINSTALL}, ++ {"force-space", 0, 0, ARGS_OPT_FORCE_SPACE}, ++ {"force_space", 0, 0, ARGS_OPT_FORCE_SPACE}, ++ {"recursive", 0, 0, ++ ARGS_OPT_FORCE_REMOVAL_OF_DEPENDENT_PACKAGES}, ++ {"force-removal-of-dependent-packages", 0, 0, ++ ARGS_OPT_FORCE_REMOVAL_OF_DEPENDENT_PACKAGES}, ++ {"force_removal_of_dependent_packages", 0, 0, ++ ARGS_OPT_FORCE_REMOVAL_OF_DEPENDENT_PACKAGES}, ++ {"force-removal-of-essential-packages", 0, 0, ++ ARGS_OPT_FORCE_REMOVAL_OF_ESSENTIAL_PACKAGES}, ++ {"force_removal_of_essential_packages", 0, 0, ++ ARGS_OPT_FORCE_REMOVAL_OF_ESSENTIAL_PACKAGES}, ++ {"multiple-providers", 0, 0, ARGS_OPT_MULTIPLE_PROVIDERS}, ++ {"multiple_providers", 0, 0, ARGS_OPT_MULTIPLE_PROVIDERS}, ++ {"noaction", 0, 0, ARGS_OPT_NOACTION}, ++ {"nodeps", 0, 0, ARGS_OPT_NODEPS}, ++ {"offline", 1, 0, 'o'}, ++ {"offline-root", 1, 0, 'o'}, ++ {"test", 0, 0, ARGS_OPT_NOACTION}, ++ {"tmp-dir", 1, 0, 't'}, ++ {"verbose-wget", 0, 0, ARGS_OPT_VERBOSE_WGET}, ++ {"verbose_wget", 0, 0, ARGS_OPT_VERBOSE_WGET}, ++ {"verbosity", 2, 0, 'V'}, ++ {"version", 0, 0, 'v'}, ++ {0, 0, 0, 0} ++ }; ++ ++ while (1) { ++ c = getopt_long_only(argc, argv, "Ad:f:no:t:vV:", long_options, &option_index); ++ if (c == -1) ++ break; ++ ++ switch (c) { ++ case 'A': ++ args->query_all = 1; ++ break; ++ case 'd': ++ args->dest = optarg; ++ break; ++ case 'f': ++ free(args->conf_file); ++ args->conf_file = strdup(optarg); ++ break; ++ case 'o': ++ args->offline_root = optarg; ++ break; ++ case 'n': ++ args->noaction = 1; ++ break; ++ case 't': ++ args->tmp_dir = strdup(optarg); ++ break; ++ case 'v': ++ print_version(); ++ exit(0); ++ case 'V': ++ case ARGS_OPT_VERBOSITY: ++ if (optarg) ++ args->verbosity = atoi(optarg); ++ else ++ args->verbosity += 1; ++ break; ++ case ARGS_OPT_FORCE_DEFAULTS: ++ args->force_defaults = 1; ++ break; ++ case ARGS_OPT_FORCE_DEPENDS: ++ args->force_depends = 1; ++ break; ++ case ARGS_OPT_FORCE_OVERWRITE: ++ args->force_overwrite = 1; ++ break; ++ case ARGS_OPT_FORCE_DOWNGRADE: ++ args->force_downgrade = 1; ++ break; ++ case ARGS_OPT_FORCE_REINSTALL: ++ args->force_reinstall = 1; ++ break; ++ case ARGS_OPT_FORCE_REMOVAL_OF_ESSENTIAL_PACKAGES: ++ args->force_removal_of_essential_packages = 1; ++ break; ++ case ARGS_OPT_FORCE_REMOVAL_OF_DEPENDENT_PACKAGES: ++ args->force_removal_of_dependent_packages = 1; ++ break; ++ case ARGS_OPT_FORCE_SPACE: ++ args->force_space = 1; ++ break; ++ case ARGS_OPT_VERBOSE_WGET: ++ args->verbose_wget = 1; ++ break; ++ case ARGS_OPT_MULTIPLE_PROVIDERS: ++ args->multiple_providers = 1; ++ break; ++ case ARGS_OPT_NODEPS: ++ args->nodeps = 1; ++ break; ++ case ARGS_OPT_NOACTION: ++ args->noaction = 1; ++ break; ++ case ':': ++ parse_err++; ++ break; ++ case '?': ++ parse_err++; ++ break; ++ default: ++ bb_error_msg("Confusion: getopt_long returned %d\n", c); ++ } ++ } ++ ++ if (parse_err) { ++ return -parse_err; ++ } else { ++ return optind; ++ } ++} ++ ++void args_usage(char *complaint) ++{ ++ if (complaint) { ++ bb_error_msg("%s\n", complaint); ++ } ++ print_version(); ++ bb_show_usage(); ++ exit(1); ++} ++ ++static void print_version(void) ++{ ++ bb_error_msg("version %s\n", IPKG_VERSION); ++} +diff -ruN busybox-1.2.0-orig/archival/libipkg/args.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/args.h +--- busybox-1.2.0-orig/archival/libipkg/args.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/args.h 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,72 @@ ++/* args.h - parse command-line args ++ ++ Carl D. Worth ++ ++ Copyright 2001 University of Southern California ++ ++ 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 ++ the Free Software Foundation; either version 2, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++*/ ++ ++#ifndef ARGS_H ++#define ARGS_H ++ ++struct args ++{ ++ char *conf_file; ++ char *dest; ++ char *tmp_dir; ++ int force_defaults; ++ int force_depends; ++ int force_overwrite; ++ int force_downgrade; ++ int force_reinstall; ++ int force_removal_of_essential_packages; ++ int force_removal_of_dependent_packages; ++ int force_space; ++ int noaction; ++ int nodeps; ++ int multiple_providers; ++ int query_all; ++ int verbose_wget; ++ int verbosity; ++ int nocheckfordirorfile; ++ int noreadfeedsfile; ++ char *offline_root; ++ char *offline_root_pre_script_cmd; ++ char *offline_root_post_script_cmd; ++}; ++typedef struct args args_t; ++ ++#define ARGS_DEFAULT_CONF_FILE_DIR "/etc" ++#define ARGS_DEFAULT_CONF_FILE_NAME "ipkg.conf" ++#define ARGS_DEFAULT_DEST NULL ++#define ARGS_DEFAULT_FORCE_DEFAULTS 0 ++#define ARGS_DEFAULT_FORCE_DEPENDS 0 ++#define ARGS_DEFAULT_FORCE_OVERWRITE 0 ++#define ARGS_DEFAULT_FORCE_DOWNGRADE 0 ++#define ARGS_DEFAULT_FORCE_REINSTALL 0 ++#define ARGS_DEFAULT_FORCE_REMOVAL_OF_ESSENTIAL_PACKAGES 0 ++#define ARGS_DEFAULT_FORCE_REMOVAL_OF_DEPENDENT_PACKAGES 0 ++#define ARGS_DEFAULT_FORCE_SPACE 0 ++#define ARGS_DEFAULT_OFFLINE_ROOT NULL ++#define ARGS_DEFAULT_OFFLINE_ROOT_PRE_SCRIPT_CMD NULL ++#define ARGS_DEFAULT_OFFLINE_ROOT_POST_SCRIPT_CMD NULL ++#define ARGS_DEFAULT_NOACTION 0 ++#define ARGS_DEFAULT_NODEPS 0 ++#define ARGS_DEFAULT_VERBOSE_WGET 0 ++#define ARGS_DEFAULT_VERBOSITY 1 ++ ++int args_init(args_t *args); ++void args_deinit(args_t *args); ++int args_parse(args_t *args, int argc, char *argv[]); ++void args_usage(char *complaint); ++ ++#endif +diff -ruN busybox-1.2.0-orig/archival/libipkg/conffile.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/conffile.c +--- busybox-1.2.0-orig/archival/libipkg/conffile.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/conffile.c 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,64 @@ ++/* conffile.c - the itsy package management system ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#include <string.h> ++#include <stdlib.h> ++ ++#include "ipkg.h" ++#include "ipkg_message.h" ++ ++#include "conffile.h" ++#include "file_util.h" ++#include "sprintf_alloc.h" ++ ++int conffile_init(conffile_t *conffile, const char *file_name, const char *md5sum) ++{ ++ return nv_pair_init(conffile, file_name, md5sum); ++} ++ ++void conffile_deinit(conffile_t *conffile) ++{ ++ nv_pair_deinit(conffile); ++} ++ ++int conffile_has_been_modified(ipkg_conf_t *conf, conffile_t *conffile) ++{ ++ char *md5sum; ++ char *filename = conffile->name; ++ char *root_filename; ++ int ret; ++ ++ if (conffile->value == NULL) { ++ ipkg_message(conf, IPKG_NOTICE, "%s: conffile %s has no md5sum\n", __FUNCTION__, conffile->name); ++ return 1; ++ } ++ ++ root_filename = root_filename_alloc(conf, filename); ++ ++ md5sum = file_md5sum_alloc(root_filename); ++ ++ ret = strcmp(md5sum, conffile->value); ++ if (ret) { ++ ipkg_message(conf, IPKG_NOTICE, "%s: conffile %s: \t\nold md5=%s \t\nnew md5=%s\n", __FUNCTION__, ++ conffile->name, md5sum, conffile->value); ++ } ++ ++ free(root_filename); ++ free(md5sum); ++ ++ return ret; ++} +diff -ruN busybox-1.2.0-orig/archival/libipkg/conffile.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/conffile.h +--- busybox-1.2.0-orig/archival/libipkg/conffile.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/conffile.h 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,30 @@ ++/* conffile.h - the itsy package management system ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#ifndef CONFFILE_H ++#define CONFFILE_H ++ ++#include "nv_pair.h" ++ ++typedef struct nv_pair conffile_t; ++ ++int conffile_init(conffile_t *conffile, const char *file_name, const char *md5sum); ++void conffile_deinit(conffile_t *conffile); ++int conffile_has_been_modified(struct ipkg_conf *conf, conffile_t *conffile); ++ ++#endif ++ +diff -ruN busybox-1.2.0-orig/archival/libipkg/conffile_list.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/conffile_list.c +--- busybox-1.2.0-orig/archival/libipkg/conffile_list.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/conffile_list.c 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,47 @@ ++/* conffile_list.c - the itsy package management system ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#include "ipkg.h" ++ ++#include "conffile_list.h" ++ ++int conffile_list_init(conffile_list_t *list) ++{ ++ return nv_pair_list_init(list); ++} ++ ++void conffile_list_deinit(conffile_list_t *list) ++{ ++ nv_pair_list_deinit(list); ++} ++ ++conffile_t *conffile_list_append(conffile_list_t *list, const char *file_name, ++ const char *md5sum) ++{ ++ return nv_pair_list_append(list, file_name, md5sum); ++} ++ ++int conffile_list_push(conffile_list_t *list, conffile_t *data) ++{ ++ return nv_pair_list_push(list, data); ++} ++ ++conffile_list_elt_t *conffile_list_pop(conffile_list_t *list) ++{ ++ return nv_pair_list_pop(list); ++} ++ +diff -ruN busybox-1.2.0-orig/archival/libipkg/conffile_list.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/conffile_list.h +--- busybox-1.2.0-orig/archival/libipkg/conffile_list.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/conffile_list.h 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,36 @@ ++/* conffile_list.h - the itsy package management system ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#ifndef CONFFILE_LIST_H ++#define CONFFILE_LIST_H ++ ++#include "conffile.h" ++#include "nv_pair_list.h" ++ ++typedef struct nv_pair_list_elt conffile_list_elt_t; ++typedef struct nv_pair_list conffile_list_t; ++ ++int conffile_list_init(conffile_list_t *list); ++void conffile_list_deinit(conffile_list_t *list); ++ ++conffile_t *conffile_list_append(conffile_list_t *list, const char *name, ++ const char *root_dir); ++int conffile_list_push(conffile_list_t *list, conffile_t *data); ++conffile_list_elt_t *conffile_list_pop(conffile_list_t *list); ++ ++#endif ++ +diff -ruN busybox-1.2.0-orig/archival/libipkg/file_util.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/file_util.c +--- busybox-1.2.0-orig/archival/libipkg/file_util.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/file_util.c 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,177 @@ ++/* file_util.c - convenience routines for common stat operations ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#include "ipkg.h" ++#include <sys/types.h> ++#include <sys/stat.h> ++ ++#include "sprintf_alloc.h" ++#include "file_util.h" ++#include "md5.h" ++#include "libbb.h" ++#undef strlen ++ ++int file_exists(const char *file_name) ++{ ++ int err; ++ struct stat stat_buf; ++ ++ err = stat(file_name, &stat_buf); ++ if (err == 0) { ++ return 1; ++ } else { ++ return 0; ++ } ++} ++ ++int file_is_dir(const char *file_name) ++{ ++ int err; ++ struct stat stat_buf; ++ ++ err = stat(file_name, &stat_buf); ++ if (err) { ++ return 0; ++ } ++ ++ return S_ISDIR(stat_buf.st_mode); ++} ++ ++/* read a single line from a file, stopping at a newline or EOF. ++ If a newline is read, it will appear in the resulting string. ++ Return value is a malloc'ed char * which should be freed at ++ some point by the caller. ++ ++ Return value is NULL if the file is at EOF when called. ++*/ ++#define FILE_READ_LINE_BUF_SIZE 1024 ++char *file_read_line_alloc(FILE *file) ++{ ++ char buf[FILE_READ_LINE_BUF_SIZE]; ++ int buf_len; ++ char *line = NULL; ++ int line_size = 0; ++ ++ memset(buf, 0, FILE_READ_LINE_BUF_SIZE); ++ while (fgets(buf, FILE_READ_LINE_BUF_SIZE, file)) { ++ buf_len = strlen(buf); ++ if (line) { ++ line_size += buf_len; ++ line = realloc(line, line_size); ++ if (line == NULL) { ++ fprintf(stderr, "%s: out of memory\n", __FUNCTION__); ++ break; ++ } ++ strcat(line, buf); ++ } else { ++ line_size = buf_len + 1; ++ line = strdup(buf); ++ } ++ if (buf[buf_len - 1] == '\n') { ++ break; ++ } ++ } ++ ++ return line; ++} ++ ++int file_move(const char *src, const char *dest) ++{ ++ int err; ++ ++ err = rename(src, dest); ++ ++ if (err && errno == EXDEV) { ++ err = file_copy(src, dest); ++ unlink(src); ++ } else if (err) { ++ fprintf(stderr, "%s: ERROR: failed to rename %s to %s: %s\n", ++ __FUNCTION__, src, dest, strerror(errno)); ++ } ++ ++ return err; ++} ++ ++/* I put these here to keep libbb dependencies from creeping all over ++ the ipkg code */ ++int file_copy(const char *src, const char *dest) ++{ ++ int err; ++ ++ err = copy_file(src, dest, FILEUTILS_FORCE | FILEUTILS_PRESERVE_STATUS); ++ if (err) { ++ fprintf(stderr, "%s: ERROR: failed to copy %s to %s\n", ++ __FUNCTION__, src, dest); ++ } ++ ++ return err; ++} ++ ++int file_mkdir_hier(const char *path, long mode) ++{ ++ return bb_make_directory(path, mode, FILEUTILS_RECUR); ++} ++ ++char *file_md5sum_alloc(const char *file_name) ++{ ++ static const int md5sum_bin_len = 16; ++ static const int md5sum_hex_len = 32; ++ ++ static const unsigned char bin2hex[16] = { ++ '0', '1', '2', '3', ++ '4', '5', '6', '7', ++ '8', '9', 'a', 'b', ++ 'c', 'd', 'e', 'f' ++ }; ++ ++ int i, err; ++ FILE *file; ++ unsigned char *md5sum_hex; ++ unsigned char md5sum_bin[md5sum_bin_len]; ++ ++ md5sum_hex = malloc(md5sum_hex_len + 1); ++ if (md5sum_hex == NULL) { ++ fprintf(stderr, "%s: out of memory\n", __FUNCTION__); ++ return strdup(""); ++ } ++ ++ file = fopen(file_name, "r"); ++ if (file == NULL) { ++ fprintf(stderr, "%s: Failed to open file %s: %s\n", ++ __FUNCTION__, file_name, strerror(errno)); ++ return strdup(""); ++ } ++ ++ err = md5_stream(file, md5sum_bin); ++ if (err) { ++ fprintf(stderr, "%s: ERROR computing md5sum for %s: %s\n", ++ __FUNCTION__, file_name, strerror(err)); ++ return strdup(""); ++ } ++ ++ fclose(file); ++ ++ for (i=0; i < md5sum_bin_len; i++) { ++ md5sum_hex[i*2] = bin2hex[md5sum_bin[i] >> 4]; ++ md5sum_hex[i*2+1] = bin2hex[md5sum_bin[i] & 0xf]; ++ } ++ ++ md5sum_hex[md5sum_hex_len] = '\0'; ++ ++ return md5sum_hex; ++} ++ +diff -ruN busybox-1.2.0-orig/archival/libipkg/file_util.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/file_util.h +--- busybox-1.2.0-orig/archival/libipkg/file_util.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/file_util.h 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,29 @@ ++/* file_util.h - convenience routines for common file operations ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#ifndef FILE_UTIL_H ++#define FILE_UTIL_H ++ ++int file_exists(const char *file_name); ++int file_is_dir(const char *file_name); ++char *file_read_line_alloc(FILE *file); ++int file_move(const char *src, const char *dest); ++int file_copy(const char *src, const char *dest); ++int file_mkdir_hier(const char *path, long mode); ++char *file_md5sum_alloc(const char *file_name); ++ ++#endif +diff -ruN busybox-1.2.0-orig/archival/libipkg/hash_table.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/hash_table.c +--- busybox-1.2.0-orig/archival/libipkg/hash_table.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/hash_table.c 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,155 @@ ++/* hash.c - hash tables for ipkg ++ ++ Steven M. Ayer, Jamey Hicks ++ ++ Copyright (C) 2002 Compaq Computer Corporation ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#include <errno.h> ++#include <stdio.h> ++#include <stdlib.h> ++#include <string.h> ++#include "hash_table.h" ++#include "ipkg_message.h" ++ ++ ++static int hash_index(hash_table_t *hash, const char *pkg_name); ++static int rotating(const char *key, int len, int prime); ++ ++static int hash_index(hash_table_t *hash, const char *pkg_name) ++{ ++ return rotating(pkg_name, strlen(pkg_name), hash->n_entries); ++} ++ ++static int rotating(const char *key, int len, int prime) ++{ ++ unsigned int hash, i; ++ for (hash=len, i=0; i<len; ++i) ++ hash = (hash<<4)^(hash>>28)^key[i]; ++ return (hash % prime); ++} ++ ++ ++/* ++ * this is an open table keyed by strings ++ */ ++int hash_table_init(const char *name, hash_table_t *hash, int len) ++{ ++ static int primes_table[] = { ++ 379, 761, 983, 1423, 2711, 3361, 3931, 4679, 5519, 6701, 9587, ++ 19471, 23143, 33961, 46499, 49727, 99529, 0 ++ }; ++ int *picker; ++ ++ if (hash->entries != NULL) { ++ /* we have been here already */ ++ return 0; ++ } ++ ++ hash->name = name; ++ hash->entries = NULL; ++ hash->n_entries = 0; ++ hash->hash_entry_key = NULL; ++ ++ picker = primes_table; ++ while(*picker && (*picker++ < len)); ++ if(!*picker) ++ fprintf(stderr, "%s: primes table might not be big enough (! << %d)\n", __FUNCTION__, len); ++ --picker; ++ ++ hash->n_entries = *picker; ++ hash->entries = (hash_entry_t *)calloc(hash->n_entries, sizeof(hash_entry_t)); ++ if (hash->entries == NULL) { ++ fprintf(stderr, "%s: Out of memory.\n", __FUNCTION__); ++ return ENOMEM; ++ } ++ return 0; ++} ++ ++void hash_table_deinit(hash_table_t *hash) ++{ ++ free(hash->entries); ++ hash->entries = NULL; ++ hash->n_entries = 0; ++} ++ ++void *hash_table_get(hash_table_t *hash, const char *key) ++{ ++ int ndx= hash_index(hash, key); ++ hash_entry_t *hash_entry = hash->entries + ndx; ++ while (hash_entry) ++ { ++ if (hash_entry->key) ++ { ++ if (strcmp(key, hash_entry->key) == 0) { ++ // ipkg_message(NULL, IPKG_DEBUG, "Function: %s. Key found for '%s' \n", __FUNCTION__, key); ++ return hash_entry->data; ++ } ++ } ++ hash_entry = hash_entry->next; ++ } ++ return NULL; ++} ++ ++int hash_table_insert(hash_table_t *hash, const char *key, void *value) ++{ ++ int ndx= hash_index(hash, key); ++ hash_entry_t *hash_entry = hash->entries + ndx; ++ if (0) ipkg_message(NULL, IPKG_DEBUG2, "Function: %s. Inserting in hash for '%s' \n", __FUNCTION__, key); ++ if (hash_entry->key) { ++ if (strcmp(hash_entry->key, key) == 0) { ++ /* alread in table, update the value */ ++ if (0) ipkg_message(NULL, IPKG_DEBUG2, "Function: %s. Value already in hash for '%s' \n", __FUNCTION__, key); ++ hash_entry->data = value; ++ return 0; ++ } else { ++ /* ++ * if this is a collision, we have to go to the end of the ll, ++ * then add a new entry ++ * before we can hook up the value ++ */ ++ if (0) ipkg_message(NULL, IPKG_DEBUG2, "Function: %s. Value already in hash by collision for '%s' \n", __FUNCTION__, key); ++ while (hash_entry->next) ++ hash_entry = hash_entry->next; ++ hash_entry->next = (hash_entry_t *)malloc(sizeof(hash_entry_t)); ++ if (!hash_entry->next) { ++ return -ENOMEM; ++ } ++ hash_entry = hash_entry->next; ++ hash_entry->next = NULL; ++ } ++ } ++ hash->n_elements++; ++ hash_entry->key = strdup(key); ++ hash_entry->data = value; ++ ++ return 0; ++} ++ ++ ++void hash_table_foreach(hash_table_t *hash, void (*f)(const char *key, void *entry, void *data), void *data) ++{ ++ int i; ++ if (!hash || !f) ++ return; ++ ++ for (i = 0; i < hash->n_entries; i++) { ++ hash_entry_t *hash_entry = (hash->entries + i); ++ do { ++ if(hash_entry->key) { ++ f(hash_entry->key, hash_entry->data, data); ++ } ++ } while((hash_entry = hash_entry->next)); ++ } ++} ++ +diff -ruN busybox-1.2.0-orig/archival/libipkg/hash_table.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/hash_table.h +--- busybox-1.2.0-orig/archival/libipkg/hash_table.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/hash_table.h 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,44 @@ ++/* hash.h - hash tables for ipkg ++ ++ Steven M. Ayer, Jamey Hicks ++ ++ Copyright (C) 2002 Compaq Computer Corporation ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#ifndef _HASH_TABLE_H_ ++#define _HASH_TABLE_H_ ++ ++typedef struct hash_entry hash_entry_t; ++typedef struct hash_table hash_table_t; ++ ++struct hash_entry { ++ const char * key; ++ void * data; ++ struct hash_entry * next; ++}; ++ ++struct hash_table { ++ const char *name; ++ hash_entry_t * entries; ++ int n_entries; /* number of buckets */ ++ int n_elements; ++ const char * (*hash_entry_key)(void * data); ++}; ++ ++int hash_table_init(const char *name, hash_table_t *hash, int len); ++void hash_table_deinit(hash_table_t *hash); ++void *hash_table_get(hash_table_t *hash, const char *key); ++int hash_table_insert(hash_table_t *hash, const char *key, void *value); ++void hash_table_foreach(hash_table_t *hash, void (*f)(const char *key, void *entry, void *data), void *data); ++ ++#endif /* _HASH_TABLE_H_ */ +diff -ruN busybox-1.2.0-orig/archival/libipkg/ipkg_cmd.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_cmd.c +--- busybox-1.2.0-orig/archival/libipkg/ipkg_cmd.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_cmd.c 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,1431 @@ ++/* ipkg_cmd.c - the itsy package management system ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#include <string.h> ++ ++#include "ipkg.h" ++#include <libgen.h> ++#include <glob.h> ++#include <errno.h> ++#include <stdlib.h> ++#include <unistd.h> ++#include <signal.h> ++#include <stdio.h> ++#include <dirent.h> ++ ++#include "ipkg_conf.h" ++#include "ipkg_cmd.h" ++#include "ipkg_message.h" ++#include "pkg.h" ++#include "pkg_dest.h" ++#include "pkg_parse.h" ++#include "sprintf_alloc.h" ++#include "pkg.h" ++#include "file_util.h" ++#include "str_util.h" ++#include "libbb.h" ++#include "unarchive.h" ++ ++#include <fnmatch.h> ++ ++ ++#include "ipkg_download.h" ++#include "ipkg_install.h" ++#include "ipkg_upgrade.h" ++#include "ipkg_remove.h" ++#include "ipkg_configure.h" ++#include "ipkg_message.h" ++ ++#ifdef IPKG_LIB ++#include "libipkg.h" ++static void *p_userdata = NULL; ++#endif ++ ++static int ipkg_update_cmd(ipkg_conf_t *conf, int argc, char **argv); ++static int ipkg_upgrade_cmd(ipkg_conf_t *conf, int argc, char **argv); ++static int ipkg_list_cmd(ipkg_conf_t *conf, int argc, char **argv); ++static int ipkg_info_cmd(ipkg_conf_t *conf, int argc, char **argv); ++static int ipkg_status_cmd(ipkg_conf_t *conf, int argc, char **argv); ++static int ipkg_install_pending_cmd(ipkg_conf_t *conf, int argc, char **argv); ++static int ipkg_install_cmd(ipkg_conf_t *conf, int argc, char **argv); ++static int ipkg_list_installed_cmd(ipkg_conf_t *conf, int argc, char **argv); ++static int ipkg_remove_cmd(ipkg_conf_t *conf, int argc, char **argv); ++static int ipkg_purge_cmd(ipkg_conf_t *conf, int argc, char **argv); ++static int ipkg_flag_cmd(ipkg_conf_t *conf, int argc, char **argv); ++static int ipkg_files_cmd(ipkg_conf_t *conf, int argc, char **argv); ++static int ipkg_search_cmd(ipkg_conf_t *conf, int argc, char **argv); ++static int ipkg_download_cmd(ipkg_conf_t *conf, int argc, char **argv); ++static int ipkg_depends_cmd(ipkg_conf_t *conf, int argc, char **argv); ++static int ipkg_whatdepends_cmd(ipkg_conf_t *conf, int argc, char **argv); ++static int ipkg_whatdepends_recursively_cmd(ipkg_conf_t *conf, int argc, char **argv); ++static int ipkg_whatsuggests_cmd(ipkg_conf_t *conf, int argc, char **argv); ++static int ipkg_whatrecommends_cmd(ipkg_conf_t *conf, int argc, char **argv); ++static int ipkg_whatprovides_cmd(ipkg_conf_t *conf, int argc, char **argv); ++static int ipkg_whatconflicts_cmd(ipkg_conf_t *conf, int argc, char **argv); ++static int ipkg_whatreplaces_cmd(ipkg_conf_t *conf, int argc, char **argv); ++static int ipkg_compare_versions_cmd(ipkg_conf_t *conf, int argc, char **argv); ++static int ipkg_print_architecture_cmd(ipkg_conf_t *conf, int argc, char **argv); ++static int ipkg_configure_cmd(ipkg_conf_t *conf, int argc, char **argv); ++ ++/* XXX: CLEANUP: The usage strings should be incorporated into this ++ array for easier maintenance */ ++static ipkg_cmd_t cmds[] = { ++ {"update", 0, (ipkg_cmd_fun_t)ipkg_update_cmd}, ++ {"upgrade", 0, (ipkg_cmd_fun_t)ipkg_upgrade_cmd}, ++ {"list", 0, (ipkg_cmd_fun_t)ipkg_list_cmd}, ++ {"list_installed", 0, (ipkg_cmd_fun_t)ipkg_list_installed_cmd}, ++ {"info", 0, (ipkg_cmd_fun_t)ipkg_info_cmd}, ++ {"flag", 1, (ipkg_cmd_fun_t)ipkg_flag_cmd}, ++ {"status", 0, (ipkg_cmd_fun_t)ipkg_status_cmd}, ++ {"install_pending", 0, (ipkg_cmd_fun_t)ipkg_install_pending_cmd}, ++ {"install", 1, (ipkg_cmd_fun_t)ipkg_install_cmd}, ++ {"remove", 1, (ipkg_cmd_fun_t)ipkg_remove_cmd}, ++ {"purge", 1, (ipkg_cmd_fun_t)ipkg_purge_cmd}, ++ {"configure", 0, (ipkg_cmd_fun_t)ipkg_configure_cmd}, ++ {"files", 1, (ipkg_cmd_fun_t)ipkg_files_cmd}, ++ {"search", 1, (ipkg_cmd_fun_t)ipkg_search_cmd}, ++ {"download", 1, (ipkg_cmd_fun_t)ipkg_download_cmd}, ++ {"compare_versions", 1, (ipkg_cmd_fun_t)ipkg_compare_versions_cmd}, ++ {"compare-versions", 1, (ipkg_cmd_fun_t)ipkg_compare_versions_cmd}, ++ {"print-architecture", 0, (ipkg_cmd_fun_t)ipkg_print_architecture_cmd}, ++ {"print_architecture", 0, (ipkg_cmd_fun_t)ipkg_print_architecture_cmd}, ++ {"print-installation-architecture", 0, (ipkg_cmd_fun_t)ipkg_print_architecture_cmd}, ++ {"print_installation_architecture", 0, (ipkg_cmd_fun_t)ipkg_print_architecture_cmd}, ++ {"depends", 1, (ipkg_cmd_fun_t)ipkg_depends_cmd}, ++ {"whatdepends", 1, (ipkg_cmd_fun_t)ipkg_whatdepends_cmd}, ++ {"whatdependsrec", 1, (ipkg_cmd_fun_t)ipkg_whatdepends_recursively_cmd}, ++ {"whatrecommends", 1, (ipkg_cmd_fun_t)ipkg_whatrecommends_cmd}, ++ {"whatsuggests", 1, (ipkg_cmd_fun_t)ipkg_whatsuggests_cmd}, ++ {"whatprovides", 1, (ipkg_cmd_fun_t)ipkg_whatprovides_cmd}, ++ {"whatreplaces", 1, (ipkg_cmd_fun_t)ipkg_whatreplaces_cmd}, ++ {"whatconflicts", 1, (ipkg_cmd_fun_t)ipkg_whatconflicts_cmd}, ++}; ++ ++int ipkg_state_changed; ++static void write_status_files_if_changed(ipkg_conf_t *conf) ++{ ++ if (ipkg_state_changed && !conf->noaction) { ++ ipkg_message(conf, IPKG_INFO, ++ " writing status file\n"); ++ ipkg_conf_write_status_files(conf); ++ pkg_write_changed_filelists(conf); ++ } else { ++ ipkg_message(conf, IPKG_NOTICE, "Nothing to be done\n"); ++ } ++} ++ ++ ++static int num_cmds = sizeof(cmds) / sizeof(ipkg_cmd_t); ++ ++ipkg_cmd_t *ipkg_cmd_find(const char *name) ++{ ++ int i; ++ ipkg_cmd_t *cmd; ++ ++ for (i=0; i < num_cmds; i++) { ++ cmd = &cmds[i]; ++ if (strcmp(name, cmd->name) == 0) { ++ return cmd; ++ } ++ } ++ ++ return NULL; ++} ++ ++#ifdef IPKG_LIB ++int ipkg_cmd_exec(ipkg_cmd_t *cmd, ipkg_conf_t *conf, int argc, const char **argv, void *userdata) ++{ ++ int result; ++ p_userdata = userdata; ++ ++ ++ result = (cmd->fun)(conf, argc, argv); ++ if ( result == 0 ) { ++ ipkg_message(conf, IPKG_NOTICE, "Done.\n"); ++ } else { ++ ipkg_message(conf, IPKG_NOTICE, "An error ocurred, return value: %d.\n", result); ++ ++ } ++ if ( error_list ) { ++ reverse_error_list(&error_list); ++ ++ ipkg_message(conf, IPKG_NOTICE, "Collected errors:\n"); ++ /* Here we print the errors collected and free the list */ ++ while (error_list != NULL) { ++ ipkg_message(conf, IPKG_NOTICE, "%s",error_list->errmsg); ++ error_list = error_list->next; ++ ++ } ++ free_error_list(&error_list); ++ ++ } ++ ++ p_userdata = NULL; ++ return result; ++} ++#else ++int ipkg_cmd_exec(ipkg_cmd_t *cmd, ipkg_conf_t *conf, int argc, const char **argv) ++{ ++ return (cmd->fun)(conf, argc, argv); ++} ++#endif ++ ++static int ipkg_update_cmd(ipkg_conf_t *conf, int argc, char **argv) ++{ ++ int err; ++ int failures; ++ char *lists_dir; ++ pkg_src_list_elt_t *iter; ++ pkg_src_t *src; ++ ++ ++ sprintf_alloc(&lists_dir, "%s", conf->restrict_to_default_dest ? conf->default_dest->lists_dir : conf->lists_dir); ++ ++ if (! file_is_dir(lists_dir)) { ++ if (file_exists(lists_dir)) { ++ ipkg_message(conf, IPKG_ERROR, ++ "%s: ERROR: %s exists, but is not a directory\n", ++ __FUNCTION__, lists_dir); ++ free(lists_dir); ++ return EINVAL; ++ } ++ err = file_mkdir_hier(lists_dir, 0755); ++ if (err) { ++ ipkg_message(conf, IPKG_ERROR, ++ "%s: ERROR: failed to make directory %s: %s\n", ++ __FUNCTION__, lists_dir, strerror(errno)); ++ free(lists_dir); ++ return EINVAL; ++ } ++ } ++ ++ failures = 0; ++ for (iter = conf->pkg_src_list.head; iter; iter = iter->next) { ++ char *url, *list_file_name; ++ ++ src = iter->data; ++ ++ if (src->extra_data) /* debian style? */ ++ sprintf_alloc(&url, "%s/%s/%s", src->value, src->extra_data, ++ src->gzip ? "Packages.gz" : "Packages"); ++ else ++ sprintf_alloc(&url, "%s/%s", src->value, src->gzip ? "Packages.gz" : "Packages"); ++ ++ sprintf_alloc(&list_file_name, "%s/%s", lists_dir, src->name); ++ if (src->gzip) { ++ char *tmp; ++ char *tmp_file_name; ++ FILE *in, *out; ++ ++ tmp = strdup ("/tmp/ipkg.XXXXXX"); ++ ++ if (mkdtemp (tmp) == NULL) { ++ perror ("mkdtemp"); ++ failures++; ++ continue; ++ } ++ ++ sprintf_alloc (&tmp_file_name, "%s/%s.gz", tmp, src->name); ++ err = ipkg_download(conf, url, tmp_file_name); ++ if (err == 0) { ++ ipkg_message (conf, IPKG_NOTICE, "Inflating %s\n", url); ++ in = fopen (tmp_file_name, "r"); ++ out = fopen (list_file_name, "w"); ++ if (in && out) ++ inflate_unzip (in, out); ++ else ++ err = 1; ++ if (in) ++ fclose (in); ++ if (out) ++ fclose (out); ++ unlink (tmp_file_name); ++ rmdir (tmp); ++ free (tmp); ++ } ++ } else ++ err = ipkg_download(conf, url, list_file_name); ++ if (err) { ++ failures++; ++ } else { ++ ipkg_message(conf, IPKG_NOTICE, ++ "Updated list of available packages in %s\n", ++ list_file_name); ++ } ++ free(url); ++ free(list_file_name); ++ } ++ free(lists_dir); ++ ++#ifdef CONFIG_CLEAR_SW_INSTALL_FLAG ++#warning here ++ /* clear SW_INSTALL on any package where state is SS_NOT_INSTALLED. ++ * this is a hack to work around poor bookkeeping in old ipkg upgrade code ++ * -Jamey 3/1/03 ++ */ ++ { ++ int i; ++ int changed = 0; ++ pkg_vec_t *available = pkg_vec_alloc(); ++ pkg_hash_fetch_available(&conf->pkg_hash, available); ++ ipkg_message(conf, IPKG_DEBUG, "Clearing SW_INSTALL for SS_NOT_INSTALLED packages.\n"); ++ for (i = 0; i < available->len; i++) { ++ pkg_t *pkg = available->pkgs[i]; ++ if (pkg->state_want == SW_INSTALL && pkg->state_status == SS_NOT_INSTALLED) { ++ ipkg_message(conf, IPKG_DEBUG, "Clearing SW_INSTALL on package %s.\n", pkg->name); ++ pkg->state_want = SW_UNKNOWN; ++ changed = 1; ++ } ++ } ++ pkg_vec_free(available); ++ if (changed) { ++ write_status_files_if_changed(conf); ++ } ++ } ++#endif ++ ++ return failures; ++} ++ ++ ++/* scan the args passed and cache the local filenames of the packages */ ++int ipkg_multiple_files_scan(ipkg_conf_t *conf, int argc, char **argv) ++{ ++ int i; ++ int err; ++ ++ /* ++ * First scan through package names/urls ++ * For any urls, download the packages and install in database. ++ * For any files, install package info in database. ++ */ ++ for (i = 0; i < argc; i ++) { ++ char *filename = argv [i]; ++ //char *tmp = basename (tmp); ++ //int tmplen = strlen (tmp); ++ ++ //if (strcmp (tmp + (tmplen - strlen (IPKG_PKG_EXTENSION)), IPKG_PKG_EXTENSION) != 0) ++ // continue; ++ //if (strcmp (tmp + (tmplen - strlen (DPKG_PKG_EXTENSION)), DPKG_PKG_EXTENSION) != 0) ++ // continue; ++ ++ ipkg_message(conf, IPKG_DEBUG2, "Debug mfs: %s \n",filename ); ++ ++ err = ipkg_prepare_url_for_install(conf, filename, &argv[i]); ++ if (err) ++ return err; ++ } ++ return 0; ++} ++ ++struct ipkg_intercept ++{ ++ char *oldpath; ++ char *statedir; ++}; ++ ++typedef struct ipkg_intercept *ipkg_intercept_t; ++ ++ipkg_intercept_t ipkg_prep_intercepts(ipkg_conf_t *conf) ++{ ++ ipkg_intercept_t ctx; ++ char *newpath; ++ int gen; ++ ++ ctx = malloc (sizeof (*ctx)); ++ ctx->oldpath = strdup (getenv ("PATH")); ++ ++ sprintf_alloc (&newpath, "%s/ipkg/intercept:%s", IPKGLIBDIR, ctx->oldpath); ++ setenv ("PATH", newpath, 1); ++ free (newpath); ++ ++ gen = 0; ++ retry: ++ sprintf_alloc (&ctx->statedir, "/tmp/ipkg-intercept-%d-%d", getpid (), gen); ++ if (mkdir (ctx->statedir, 0770) < 0) { ++ if (errno == EEXIST) { ++ free (ctx->statedir); ++ gen++; ++ goto retry; ++ } ++ perror (ctx->statedir); ++ return NULL; ++ } ++ setenv ("IPKG_INTERCEPT_DIR", ctx->statedir, 1); ++ return ctx; ++} ++ ++int ipkg_finalize_intercepts(ipkg_intercept_t ctx) ++{ ++ char *cmd; ++ DIR *dir; ++ int err = 0; ++ ++ setenv ("PATH", ctx->oldpath, 1); ++ free (ctx->oldpath); ++ ++ dir = opendir (ctx->statedir); ++ if (dir) { ++ struct dirent *de; ++ while (de = readdir (dir), de != NULL) { ++ char *path; ++ ++ if (de->d_name[0] == '.') ++ continue; ++ ++ sprintf_alloc (&path, "%s/%s", ctx->statedir, de->d_name); ++ if (access (path, X_OK) == 0) { ++ if (system (path)) { ++ err = errno; ++ perror (de->d_name); ++ } ++ } ++ free (path); ++ } ++ } else ++ perror (ctx->statedir); ++ ++ sprintf_alloc (&cmd, "rm -rf %s", ctx->statedir); ++ system (cmd); ++ free (cmd); ++ ++ free (ctx->statedir); ++ free (ctx); ++ ++ return err; ++} ++ ++int ipkg_configure_packages(ipkg_conf_t *conf, char *pkg_name) ++{ ++ pkg_vec_t *all; ++ int i; ++ pkg_t *pkg; ++ ipkg_intercept_t ic; ++ int r, err = 0; ++ ++ ipkg_message(conf, IPKG_INFO, ++ "Configuring unpacked packages\n"); ++ fflush( stdout ); ++ ++ all = pkg_vec_alloc(); ++ pkg_hash_fetch_available(&conf->pkg_hash, all); ++ ++ ic = ipkg_prep_intercepts (conf); ++ ++ for(i = 0; i < all->len; i++) { ++ pkg = all->pkgs[i]; ++ ++ if (pkg_name && fnmatch(pkg_name, pkg->name, 0)) ++ continue; ++ ++ if (pkg->state_status == SS_UNPACKED) { ++ ipkg_message(conf, IPKG_NOTICE, ++ "Configuring %s\n", pkg->name); ++ fflush( stdout ); ++ r = ipkg_configure(conf, pkg); ++ if (r == 0) { ++ pkg->state_status = SS_INSTALLED; ++ pkg->parent->state_status = SS_INSTALLED; ++ pkg->state_flag &= ~SF_PREFER; ++ } else { ++ if (!err) ++ err = r; ++ } ++ } ++ } ++ ++ r = ipkg_finalize_intercepts (ic); ++ if (r && !err) ++ err = r; ++ ++ pkg_vec_free(all); ++ return err; ++} ++ ++static void sigint_handler(int sig) ++{ ++ signal(sig, SIG_DFL); ++ ipkg_message(NULL, IPKG_NOTICE, ++ "ipkg: interrupted. writing out status database\n"); ++ write_status_files_if_changed(global_conf); ++ exit(128 + sig); ++} ++ ++static int ipkg_install_cmd(ipkg_conf_t *conf, int argc, char **argv) ++{ ++ int i; ++ char *arg; ++ int err=0; ++ ++ global_conf = conf; ++ signal(SIGINT, sigint_handler); ++ ++ /* ++ * Now scan through package names and install ++ */ ++ for (i=0; i < argc; i++) { ++ arg = argv[i]; ++ ++ ipkg_message(conf, IPKG_DEBUG2, "Debug install_cmd: %s \n",arg ); ++ err = ipkg_prepare_url_for_install(conf, arg, &argv[i]); ++ if (err != EINVAL && err != 0) ++ return err; ++ } ++ pkg_info_preinstall_check(conf); ++ ++ for (i=0; i < argc; i++) { ++ arg = argv[i]; ++ if (conf->multiple_providers) ++ err = ipkg_install_multi_by_name(conf, arg); ++ else{ ++ err = ipkg_install_by_name(conf, arg); ++ } ++ if (err == IPKG_PKG_HAS_NO_CANDIDATE) { ++ ipkg_message(conf, IPKG_ERROR, ++ "Cannot find package %s.\n" ++ "Check the spelling or perhaps run 'ipkg update'\n", ++ arg); ++ } ++ } ++ ++ /* recheck to verify that all dependences are satisfied */ ++ if (0) ipkg_satisfy_all_dependences(conf); ++ ++ ipkg_configure_packages(conf, NULL); ++ ++ write_status_files_if_changed(conf); ++ ++ return err; ++} ++ ++static int ipkg_upgrade_cmd(ipkg_conf_t *conf, int argc, char **argv) ++{ ++ int i; ++ pkg_t *pkg; ++ int err; ++ ++ global_conf = conf; ++ signal(SIGINT, sigint_handler); ++ ++ if (argc) { ++ for (i=0; i < argc; i++) { ++ char *arg = argv[i]; ++ ++ err = ipkg_prepare_url_for_install(conf, arg, &arg); ++ if (err != EINVAL && err != 0) ++ return err; ++ } ++ pkg_info_preinstall_check(conf); ++ ++ for (i=0; i < argc; i++) { ++ char *arg = argv[i]; ++ if (conf->restrict_to_default_dest) { ++ pkg = pkg_hash_fetch_installed_by_name_dest(&conf->pkg_hash, ++ argv[i], ++ conf->default_dest); ++ if (pkg == NULL) { ++ ipkg_message(conf, IPKG_NOTICE, ++ "Package %s not installed in %s\n", ++ argv[i], conf->default_dest->name); ++ continue; ++ } ++ } else { ++ pkg = pkg_hash_fetch_installed_by_name(&conf->pkg_hash, ++ argv[i]); ++ } ++ if (pkg) ++ ipkg_upgrade_pkg(conf, pkg); ++ else { ++ ipkg_install_by_name(conf, arg); ++ } ++ } ++ } else { ++ pkg_vec_t *installed = pkg_vec_alloc(); ++ ++ pkg_info_preinstall_check(conf); ++ ++ pkg_hash_fetch_all_installed(&conf->pkg_hash, installed); ++ for (i = 0; i < installed->len; i++) { ++ pkg = installed->pkgs[i]; ++ ipkg_upgrade_pkg(conf, pkg); ++ } ++ pkg_vec_free(installed); ++ } ++ ++ /* recheck to verify that all dependences are satisfied */ ++ if (0) ipkg_satisfy_all_dependences(conf); ++ ++ ipkg_configure_packages(conf, NULL); ++ ++ write_status_files_if_changed(conf); ++ ++ return 0; ++} ++ ++static int ipkg_download_cmd(ipkg_conf_t *conf, int argc, char **argv) ++{ ++ int i, err; ++ char *arg; ++ pkg_t *pkg; ++ ++ pkg_info_preinstall_check(conf); ++ for (i = 0; i < argc; i++) { ++ arg = argv[i]; ++ ++ pkg = pkg_hash_fetch_best_installation_candidate_by_name(conf, arg); ++ if (pkg == NULL) { ++ ipkg_message(conf, IPKG_ERROR, ++ "Cannot find package %s.\n" ++ "Check the spelling or perhaps run 'ipkg update'\n", ++ arg); ++ continue; ++ } ++ ++ err = ipkg_download_pkg(conf, pkg, "."); ++ ++ if (err) { ++ ipkg_message(conf, IPKG_ERROR, ++ "Failed to download %s\n", pkg->name); ++ } else { ++ ipkg_message(conf, IPKG_NOTICE, ++ "Downloaded %s as %s\n", ++ pkg->name, pkg->local_filename); ++ } ++ } ++ ++ return 0; ++} ++ ++ ++static int ipkg_list_cmd(ipkg_conf_t *conf, int argc, char **argv) ++{ ++ int i ; ++ pkg_vec_t *available; ++ pkg_t *pkg; ++ char desc_short[IPKG_LIST_DESCRIPTION_LENGTH]; ++ char *newline; ++ char *pkg_name = NULL; ++ char *version_str; ++ ++ if (argc > 0) { ++ pkg_name = argv[0]; ++ } ++ available = pkg_vec_alloc(); ++ pkg_hash_fetch_available(&conf->pkg_hash, available); ++ for (i=0; i < available->len; i++) { ++ pkg = available->pkgs[i]; ++ /* if we have package name or pattern and pkg does not match, then skip it */ ++ if (pkg_name && fnmatch(pkg_name, pkg->name, 0)) ++ continue; ++ if (pkg->description) { ++ strncpy(desc_short, pkg->description, IPKG_LIST_DESCRIPTION_LENGTH); ++ } else { ++ desc_short[0] = '\0'; ++ } ++ desc_short[IPKG_LIST_DESCRIPTION_LENGTH - 1] = '\0'; ++ newline = strchr(desc_short, '\n'); ++ if (newline) { ++ *newline = '\0'; ++ } ++#ifndef IPKG_LIB ++ printf("%s - %s\n", pkg->name, desc_short); ++#else ++ if (ipkg_cb_list) { ++ version_str = pkg_version_str_alloc(pkg); ++ ipkg_cb_list(pkg->name,desc_short, ++ version_str, ++ pkg->state_status, ++ p_userdata); ++ free(version_str); ++ } ++#endif ++ } ++ pkg_vec_free(available); ++ ++ return 0; ++} ++ ++ ++static int ipkg_list_installed_cmd(ipkg_conf_t *conf, int argc, char **argv) ++{ ++ int i ; ++ pkg_vec_t *available; ++ pkg_t *pkg; ++ char desc_short[IPKG_LIST_DESCRIPTION_LENGTH]; ++ char *newline; ++ char *pkg_name = NULL; ++ char *version_str; ++ ++ if (argc > 0) { ++ pkg_name = argv[0]; ++ } ++ available = pkg_vec_alloc(); ++ pkg_hash_fetch_all_installed(&conf->pkg_hash, available); ++ for (i=0; i < available->len; i++) { ++ pkg = available->pkgs[i]; ++ /* if we have package name or pattern and pkg does not match, then skip it */ ++ if (pkg_name && fnmatch(pkg_name, pkg->name, 0)) ++ continue; ++ if (pkg->description) { ++ strncpy(desc_short, pkg->description, IPKG_LIST_DESCRIPTION_LENGTH); ++ } else { ++ desc_short[0] = '\0'; ++ } ++ desc_short[IPKG_LIST_DESCRIPTION_LENGTH - 1] = '\0'; ++ newline = strchr(desc_short, '\n'); ++ if (newline) { ++ *newline = '\0'; ++ } ++#ifndef IPKG_LIB ++ printf("%s - %s\n", pkg->name, desc_short); ++#else ++ if (ipkg_cb_list) { ++ version_str = pkg_version_str_alloc(pkg); ++ ipkg_cb_list(pkg->name,desc_short, ++ version_str, ++ pkg->state_status, ++ p_userdata); ++ free(version_str); ++ } ++#endif ++ } ++ ++ return 0; ++} ++ ++static int ipkg_info_status_cmd(ipkg_conf_t *conf, int argc, char **argv, int installed_only) ++{ ++ int i; ++ pkg_vec_t *available; ++ pkg_t *pkg; ++ char *pkg_name = NULL; ++ char **pkg_fields = NULL; ++ int n_fields = 0; ++ char *buff ; // = (char *)malloc(1); ++ ++ if (argc > 0) { ++ pkg_name = argv[0]; ++ } ++ if (argc > 1) { ++ pkg_fields = &argv[1]; ++ n_fields = argc - 1; ++ } ++ ++ available = pkg_vec_alloc(); ++ if (installed_only) ++ pkg_hash_fetch_all_installed(&conf->pkg_hash, available); ++ else ++ pkg_hash_fetch_available(&conf->pkg_hash, available); ++ for (i=0; i < available->len; i++) { ++ pkg = available->pkgs[i]; ++ if (pkg_name && fnmatch(pkg_name, pkg->name, 0)) { ++ continue; ++ } ++#ifndef IPKG_LIB ++ if (n_fields) { ++ for (j = 0; j < n_fields; j++) ++ pkg_print_field(pkg, stdout, pkg_fields[j]); ++ } else { ++ pkg_print_info(pkg, stdout); ++ } ++#else ++ ++ buff = pkg_formatted_info(pkg); ++ if ( buff ) { ++ if (ipkg_cb_status) ipkg_cb_status(pkg->name, ++ pkg->state_status, ++ buff, ++ p_userdata); ++/* ++ We should not forget that actually the pointer is allocated. ++ We need to free it :) ( Thanks florian for seeing the error ) ++*/ ++ free(buff); ++ } ++#endif ++ if (conf->verbosity > 1) { ++ conffile_list_elt_t *iter; ++ for (iter = pkg->conffiles.head; iter; iter = iter->next) { ++ conffile_t *cf = iter->data; ++ int modified = conffile_has_been_modified(conf, cf); ++ ipkg_message(conf, IPKG_NOTICE, "conffile=%s md5sum=%s modified=%d\n", ++ cf->name, cf->value, modified); ++ } ++ } ++ } ++#ifndef IPKG_LIB ++ if (buff) ++ free(buff); ++#endif ++ pkg_vec_free(available); ++ ++ return 0; ++} ++ ++static int ipkg_info_cmd(ipkg_conf_t *conf, int argc, char **argv) ++{ ++ return ipkg_info_status_cmd(conf, argc, argv, 0); ++} ++ ++static int ipkg_status_cmd(ipkg_conf_t *conf, int argc, char **argv) ++{ ++ return ipkg_info_status_cmd(conf, argc, argv, 1); ++} ++ ++static int ipkg_configure_cmd(ipkg_conf_t *conf, int argc, char **argv) ++{ ++ ++ int err; ++ if (argc > 0) { ++ char *pkg_name = NULL; ++ ++ pkg_name = argv[0]; ++ ++ err = ipkg_configure_packages (conf, pkg_name); ++ ++ } else { ++ err = ipkg_configure_packages (conf, NULL); ++ } ++ ++ write_status_files_if_changed(conf); ++ ++ return err; ++} ++ ++static int ipkg_install_pending_cmd(ipkg_conf_t *conf, int argc, char **argv) ++{ ++ int i, err; ++ char *globpattern; ++ glob_t globbuf; ++ ++ sprintf_alloc(&globpattern, "%s/*" IPKG_PKG_EXTENSION, conf->pending_dir); ++ err = glob(globpattern, 0, NULL, &globbuf); ++ free(globpattern); ++ if (err) { ++ return 0; ++ } ++ ++ ipkg_message(conf, IPKG_NOTICE, ++ "The following packages in %s will now be installed.\n", ++ conf->pending_dir); ++ for (i = 0; i < globbuf.gl_pathc; i++) { ++ ipkg_message(conf, IPKG_NOTICE, ++ "%s%s", i == 0 ? "" : " ", globbuf.gl_pathv[i]); ++ } ++ ipkg_message(conf, IPKG_NOTICE, "\n"); ++ for (i = 0; i < globbuf.gl_pathc; i++) { ++ err = ipkg_install_from_file(conf, globbuf.gl_pathv[i]); ++ if (err == 0) { ++ err = unlink(globbuf.gl_pathv[i]); ++ if (err) { ++ ipkg_message(conf, IPKG_ERROR, ++ "%s: ERROR: failed to unlink %s: %s\n", ++ __FUNCTION__, globbuf.gl_pathv[i], strerror(err)); ++ return err; ++ } ++ } ++ } ++ globfree(&globbuf); ++ ++ return err; ++} ++ ++static int ipkg_remove_cmd(ipkg_conf_t *conf, int argc, char **argv) ++{ ++ int i,a,done; ++ pkg_t *pkg; ++ pkg_t *pkg_to_remove; ++ pkg_vec_t *available; ++ char *pkg_name = NULL; ++ global_conf = conf; ++ signal(SIGINT, sigint_handler); ++ ++// ENH: Add the "no pkg removed" just in case. ++ ++ done = 0; ++ ++ available = pkg_vec_alloc(); ++ pkg_info_preinstall_check(conf); ++ if ( argc > 0 ) { ++ pkg_hash_fetch_all_installed(&conf->pkg_hash, available); ++ for (i=0; i < argc; i++) { ++ pkg_name = malloc(strlen(argv[i])+2); ++ strcpy(pkg_name,argv[i]); ++ for (a=0; a < available->len; a++) { ++ pkg = available->pkgs[a]; ++ if (pkg_name && fnmatch(pkg_name, pkg->name, 0)) { ++ continue; ++ } ++ if (conf->restrict_to_default_dest) { ++ pkg_to_remove = pkg_hash_fetch_installed_by_name_dest(&conf->pkg_hash, ++ pkg->name, ++ conf->default_dest); ++ } else { ++ pkg_to_remove = pkg_hash_fetch_installed_by_name(&conf->pkg_hash, pkg->name ); ++ } ++ ++ if (pkg == NULL) { ++ ipkg_message(conf, IPKG_ERROR, "Package %s is not installed.\n", pkg->name); ++ continue; ++ } ++ if (pkg->state_status == SS_NOT_INSTALLED) { // Added the control, so every already removed package could be skipped ++ ipkg_message(conf, IPKG_ERROR, "Package seems to be %s not installed (STATUS = NOT_INSTALLED).\n", pkg->name); ++ continue; ++ } ++ ipkg_remove_pkg(conf, pkg_to_remove,0); ++ done = 1; ++ } ++ free (pkg_name); ++ } ++ pkg_vec_free(available); ++ } else { ++ pkg_vec_t *installed_pkgs = pkg_vec_alloc(); ++ int i; ++ int flagged_pkg_count = 0; ++ int removed; ++ ++ pkg_hash_fetch_all_installed(&conf->pkg_hash, installed_pkgs); ++ ++ for (i = 0; i < installed_pkgs->len; i++) { ++ pkg_t *pkg = installed_pkgs->pkgs[i]; ++ if (pkg->state_flag & SF_USER) { ++ flagged_pkg_count++; ++ } else { ++ if (!pkg_has_installed_dependents(conf, pkg->parent, pkg, NULL)) ++ ipkg_message(conf, IPKG_NOTICE, "Non-user leaf package: %s\n", pkg->name); ++ } ++ } ++ if (!flagged_pkg_count) { ++ ipkg_message(conf, IPKG_NOTICE, "No packages flagged as installed by user, \n" ++ "so refusing to uninstall unflagged non-leaf packages\n"); ++ return 0; ++ } ++ ++ /* find packages not flagged SF_USER (i.e., installed to ++ * satisfy a dependence) and not having any dependents, and ++ * remove them */ ++ do { ++ removed = 0; ++ for (i = 0; i < installed_pkgs->len; i++) { ++ pkg_t *pkg = installed_pkgs->pkgs[i]; ++ if (!(pkg->state_flag & SF_USER) ++ && !pkg_has_installed_dependents(conf, pkg->parent, pkg, NULL)) { ++ removed++; ++ ipkg_message(conf, IPKG_NOTICE, "Removing non-user leaf package %s\n"); ++ ipkg_remove_pkg(conf, pkg,0); ++ done = 1; ++ } ++ } ++ } while (removed); ++ pkg_vec_free(installed_pkgs); ++ } ++ ++ if ( done == 0 ) ++ ipkg_message(conf, IPKG_NOTICE, "No packages removed.\n"); ++ ++ write_status_files_if_changed(conf); ++ return 0; ++} ++ ++static int ipkg_purge_cmd(ipkg_conf_t *conf, int argc, char **argv) ++{ ++ int i; ++ pkg_t *pkg; ++ ++ global_conf = conf; ++ signal(SIGINT, sigint_handler); ++ ++ pkg_info_preinstall_check(conf); ++ ++ for (i=0; i < argc; i++) { ++ if (conf->restrict_to_default_dest) { ++ pkg = pkg_hash_fetch_installed_by_name_dest(&conf->pkg_hash, ++ argv[i], ++ conf->default_dest); ++ } else { ++ pkg = pkg_hash_fetch_installed_by_name(&conf->pkg_hash, argv[i]); ++ } ++ ++ if (pkg == NULL) { ++ ipkg_message(conf, IPKG_ERROR, ++ "Package %s is not installed.\n", argv[i]); ++ continue; ++ } ++ ipkg_purge_pkg(conf, pkg); ++ } ++ ++ write_status_files_if_changed(conf); ++ return 0; ++} ++ ++static int ipkg_flag_cmd(ipkg_conf_t *conf, int argc, char **argv) ++{ ++ int i; ++ pkg_t *pkg; ++ const char *flags = argv[0]; ++ ++ global_conf = conf; ++ signal(SIGINT, sigint_handler); ++ ++ for (i=1; i < argc; i++) { ++ if (conf->restrict_to_default_dest) { ++ pkg = pkg_hash_fetch_installed_by_name_dest(&conf->pkg_hash, ++ argv[i], ++ conf->default_dest); ++ } else { ++ pkg = pkg_hash_fetch_installed_by_name(&conf->pkg_hash, argv[i]); ++ } ++ ++ if (pkg == NULL) { ++ ipkg_message(conf, IPKG_ERROR, ++ "Package %s is not installed.\n", argv[i]); ++ continue; ++ } ++ if (( strcmp(flags,"hold")==0)||( strcmp(flags,"noprune")==0)|| ++ ( strcmp(flags,"user")==0)||( strcmp(flags,"ok")==0)) { ++ pkg->state_flag = pkg_state_flag_from_str(flags); ++ } ++/* pb_ asked this feature 03292004 */ ++/* Actually I will use only this two, but this is an open for various status */ ++ if (( strcmp(flags,"installed")==0)||( strcmp(flags,"unpacked")==0)){ ++ pkg->state_status = pkg_state_status_from_str(flags); ++ } ++ ipkg_state_changed++; ++ ipkg_message(conf, IPKG_NOTICE, ++ "Setting flags for package %s to %s\n", ++ pkg->name, flags); ++ } ++ ++ write_status_files_if_changed(conf); ++ return 0; ++} ++ ++static int ipkg_files_cmd(ipkg_conf_t *conf, int argc, char **argv) ++{ ++ pkg_t *pkg; ++ str_list_t *installed_files; ++ str_list_elt_t *iter; ++ char *pkg_version; ++ size_t buff_len = 8192; ++ size_t used_len; ++ char *buff ; ++ ++ buff = (char *)malloc(buff_len); ++ if ( buff == NULL ) { ++ fprintf( stderr,"%s: Unable to allocate memory \n",__FUNCTION__); ++ return ENOMEM; ++ } ++ ++ if (argc < 1) { ++ return EINVAL; ++ } ++ ++ pkg = pkg_hash_fetch_installed_by_name(&conf->pkg_hash, ++ argv[0]); ++ if (pkg == NULL) { ++ ipkg_message(conf, IPKG_ERROR, ++ "Package %s not installed.\n", argv[0]); ++ return 0; ++ } ++ ++ installed_files = pkg_get_installed_files(pkg); ++ pkg_version = pkg_version_str_alloc(pkg); ++ ++#ifndef IPKG_LIB ++ printf("Package %s (%s) is installed on %s and has the following files:\n", ++ pkg->name, pkg_version, pkg->dest->name); ++ for (iter = installed_files->head; iter; iter = iter->next) { ++ puts(iter->data); ++ } ++#else ++ if (buff) { ++ try_again: ++ used_len = snprintf(buff, buff_len, "Package %s (%s) is installed on %s and has the following files:\n", ++ pkg->name, pkg_version, pkg->dest->name) + 1; ++ if (used_len > buff_len) { ++ buff_len *= 2; ++ buff = realloc (buff, buff_len); ++ goto try_again; ++ } ++ for (iter = installed_files->head; iter; iter = iter->next) { ++ used_len += strlen (iter->data) + 1; ++ while (buff_len <= used_len) { ++ buff_len *= 2; ++ buff = realloc (buff, buff_len); ++ } ++ strncat(buff, iter->data, buff_len); ++ strncat(buff, "\n", buff_len); ++ } ++ if (ipkg_cb_list) ipkg_cb_list(pkg->name, ++ buff, ++ pkg_version_str_alloc(pkg), ++ pkg->state_status, ++ p_userdata); ++ free(buff); ++ } ++#endif ++ ++ free(pkg_version); ++ pkg_free_installed_files(pkg); ++ ++ return 0; ++} ++ ++static int ipkg_depends_cmd(ipkg_conf_t *conf, int argc, char **argv) ++{ ++ ++ if (argc > 0) { ++ pkg_vec_t *available_pkgs = pkg_vec_alloc(); ++ const char *rel_str = "depends on"; ++ int i; ++ ++ pkg_info_preinstall_check(conf); ++ ++ if (conf->query_all) ++ pkg_hash_fetch_available(&conf->pkg_hash, available_pkgs); ++ else ++ pkg_hash_fetch_all_installed(&conf->pkg_hash, available_pkgs); ++ for (i = 0; i < argc; i++) { ++ const char *target = argv[i]; ++ int j; ++ ++ ipkg_message(conf, IPKG_ERROR, "target=%s\n", target); ++ ++ for (j = 0; j < available_pkgs->len; j++) { ++ pkg_t *pkg = available_pkgs->pkgs[j]; ++ if (fnmatch(target, pkg->name, 0) == 0) { ++ int k; ++ int count = pkg->depends_count + pkg->pre_depends_count; ++ ipkg_message(conf, IPKG_ERROR, "What %s (arch=%s) %s\n", ++ target, pkg->architecture, rel_str); ++ for (k = 0; k < count; k++) { ++ compound_depend_t *cdepend = &pkg->depends[k]; ++ int l; ++ for (l = 0; l < cdepend->possibility_count; l++) { ++ depend_t *possibility = cdepend->possibilities[l]; ++ ipkg_message(conf, IPKG_ERROR, " %s", possibility->pkg->name); ++ if (conf->verbosity > 0) { ++ // char *ver = abstract_pkg_version_str_alloc(possibility->pkg); ++ ipkg_message(conf, IPKG_NOTICE, " %s", possibility->version); ++ if (possibility->version) { ++ char *typestr = NULL; ++ switch (possibility->constraint) { ++ case NONE: typestr = "none"; break; ++ case EARLIER: typestr = "<"; break; ++ case EARLIER_EQUAL: typestr = "<="; break; ++ case EQUAL: typestr = "="; break; ++ case LATER_EQUAL: typestr = ">="; break; ++ case LATER: typestr = ">"; break; ++ } ++ ipkg_message(conf, IPKG_NOTICE, " (%s %s)", typestr, possibility->version); ++ } ++ // free(ver); ++ } ++ ipkg_message(conf, IPKG_ERROR, "\n"); ++ } ++ } ++ } ++ } ++ } ++ pkg_vec_free(available_pkgs); ++ } ++ return 0; ++} ++ ++enum what_field_type { ++ WHATDEPENDS, ++ WHATCONFLICTS, ++ WHATPROVIDES, ++ WHATREPLACES, ++ WHATRECOMMENDS, ++ WHATSUGGESTS ++}; ++ ++static int ipkg_what_depends_conflicts_cmd(ipkg_conf_t *conf, enum what_field_type what_field_type, int recursive, int argc, char **argv) ++{ ++ ++ if (argc > 0) { ++ pkg_vec_t *available_pkgs = pkg_vec_alloc(); ++ const char *rel_str = NULL; ++ int i; ++ int changed; ++ ++ switch (what_field_type) { ++ case WHATDEPENDS: rel_str = "depends on"; break; ++ case WHATCONFLICTS: rel_str = "conflicts with"; break; ++ case WHATSUGGESTS: rel_str = "suggests"; break; ++ case WHATRECOMMENDS: rel_str = "recommends"; break; ++ case WHATPROVIDES: rel_str = "provides"; break; ++ case WHATREPLACES: rel_str = "replaces"; break; ++ } ++ ++ if (conf->query_all) ++ pkg_hash_fetch_available(&conf->pkg_hash, available_pkgs); ++ else ++ pkg_hash_fetch_all_installed(&conf->pkg_hash, available_pkgs); ++ ++ /* mark the root set */ ++ pkg_vec_clear_marks(available_pkgs); ++ ipkg_message(conf, IPKG_NOTICE, "Root set:\n"); ++ for (i = 0; i < argc; i++) { ++ const char *dependee_pattern = argv[i]; ++ pkg_vec_mark_if_matches(available_pkgs, dependee_pattern); ++ } ++ for (i = 0; i < available_pkgs->len; i++) { ++ pkg_t *pkg = available_pkgs->pkgs[i]; ++ if (pkg->state_flag & SF_MARKED) { ++ /* mark the parent (abstract) package */ ++ pkg_mark_provides(pkg); ++ ipkg_message(conf, IPKG_NOTICE, " %s\n", pkg->name); ++ } ++ } ++ ++ ipkg_message(conf, IPKG_NOTICE, "What %s root set\n", rel_str); ++ do { ++ int j; ++ changed = 0; ++ ++ for (j = 0; j < available_pkgs->len; j++) { ++ pkg_t *pkg = available_pkgs->pkgs[j]; ++ int k; ++ int count = ((what_field_type == WHATCONFLICTS) ++ ? pkg->conflicts_count ++ : pkg->pre_depends_count + pkg->depends_count + pkg->recommends_count + pkg->suggests_count); ++ /* skip this package if it is already marked */ ++ if (pkg->parent->state_flag & SF_MARKED) { ++ continue; ++ } ++ for (k = 0; k < count; k++) { ++ compound_depend_t *cdepend = ++ (what_field_type == WHATCONFLICTS) ? &pkg->conflicts[k] : &pkg->depends[k]; ++ int l; ++ for (l = 0; l < cdepend->possibility_count; l++) { ++ depend_t *possibility = cdepend->possibilities[l]; ++ if (possibility->pkg->state_flag & SF_MARKED) { ++ /* mark the depending package so we won't visit it again */ ++ pkg->state_flag |= SF_MARKED; ++ pkg_mark_provides(pkg); ++ changed++; ++ ++ ipkg_message(conf, IPKG_NOTICE, " %s", pkg->name); ++ if (conf->verbosity > 0) { ++ char *ver = pkg_version_str_alloc(pkg); ++ ipkg_message(conf, IPKG_NOTICE, " %s", ver); ++ ipkg_message(conf, IPKG_NOTICE, "\t%s %s", rel_str, possibility->pkg->name); ++ if (possibility->version) { ++ char *typestr = NULL; ++ switch (possibility->constraint) { ++ case NONE: typestr = "none"; break; ++ case EARLIER: typestr = "<"; break; ++ case EARLIER_EQUAL: typestr = "<="; break; ++ case EQUAL: typestr = "="; break; ++ case LATER_EQUAL: typestr = ">="; break; ++ case LATER: typestr = ">"; break; ++ } ++ ipkg_message(conf, IPKG_NOTICE, " (%s %s)", typestr, possibility->version); ++ } ++ free(ver); ++ if (!pkg_dependence_satisfiable(conf, possibility)) ++ ipkg_message(conf, IPKG_NOTICE, " unsatisfiable"); ++ } ++ ipkg_message(conf, IPKG_NOTICE, "\n"); ++ goto next_package; ++ } ++ } ++ } ++ next_package: ++ ; ++ } ++ } while (changed && recursive); ++ pkg_vec_free(available_pkgs); ++ } ++ ++ return 0; ++} ++ ++int pkg_mark_provides(pkg_t *pkg) ++{ ++ int provides_count = pkg->provides_count; ++ abstract_pkg_t **provides = pkg->provides; ++ int i; ++ pkg->parent->state_flag |= SF_MARKED; ++ for (i = 0; i < provides_count; i++) { ++ provides[i]->state_flag |= SF_MARKED; ++ } ++ return 0; ++} ++ ++static int ipkg_whatdepends_recursively_cmd(ipkg_conf_t *conf, int argc, char **argv) ++{ ++ return ipkg_what_depends_conflicts_cmd(conf, WHATDEPENDS, 1, argc, argv); ++} ++static int ipkg_whatdepends_cmd(ipkg_conf_t *conf, int argc, char **argv) ++{ ++ return ipkg_what_depends_conflicts_cmd(conf, WHATDEPENDS, 0, argc, argv); ++} ++ ++static int ipkg_whatsuggests_cmd(ipkg_conf_t *conf, int argc, char **argv) ++{ ++ return ipkg_what_depends_conflicts_cmd(conf, WHATSUGGESTS, 0, argc, argv); ++} ++ ++static int ipkg_whatrecommends_cmd(ipkg_conf_t *conf, int argc, char **argv) ++{ ++ return ipkg_what_depends_conflicts_cmd(conf, WHATRECOMMENDS, 0, argc, argv); ++} ++ ++static int ipkg_whatconflicts_cmd(ipkg_conf_t *conf, int argc, char **argv) ++{ ++ return ipkg_what_depends_conflicts_cmd(conf, WHATCONFLICTS, 0, argc, argv); ++} ++ ++static int ipkg_what_provides_replaces_cmd(ipkg_conf_t *conf, enum what_field_type what_field_type, int argc, char **argv) ++{ ++ ++ if (argc > 0) { ++ pkg_vec_t *available_pkgs = pkg_vec_alloc(); ++ const char *rel_str = (what_field_type == WHATPROVIDES ? "provides" : "replaces"); ++ int i; ++ ++ pkg_info_preinstall_check(conf); ++ ++ if (conf->query_all) ++ pkg_hash_fetch_available(&conf->pkg_hash, available_pkgs); ++ else ++ pkg_hash_fetch_all_installed(&conf->pkg_hash, available_pkgs); ++ for (i = 0; i < argc; i++) { ++ const char *target = argv[i]; ++ int j; ++ ++ ipkg_message(conf, IPKG_ERROR, "What %s %s\n", ++ rel_str, target); ++ for (j = 0; j < available_pkgs->len; j++) { ++ pkg_t *pkg = available_pkgs->pkgs[j]; ++ int k; ++ int count = (what_field_type == WHATPROVIDES) ? pkg->provides_count : pkg->replaces_count; ++ for (k = 0; k < count; k++) { ++ abstract_pkg_t *apkg = ++ ((what_field_type == WHATPROVIDES) ++ ? pkg->provides[k] ++ : pkg->replaces[k]); ++ if (fnmatch(target, apkg->name, 0) == 0) { ++ ipkg_message(conf, IPKG_ERROR, " %s", pkg->name); ++ if (strcmp(target, apkg->name) != 0) ++ ipkg_message(conf, IPKG_ERROR, "\t%s %s\n", rel_str, apkg->name); ++ ipkg_message(conf, IPKG_ERROR, "\n"); ++ } ++ } ++ } ++ } ++ pkg_vec_free(available_pkgs); ++ } ++ return 0; ++} ++ ++static int ipkg_whatprovides_cmd(ipkg_conf_t *conf, int argc, char **argv) ++{ ++ return ipkg_what_provides_replaces_cmd(conf, WHATPROVIDES, argc, argv); ++} ++ ++static int ipkg_whatreplaces_cmd(ipkg_conf_t *conf, int argc, char **argv) ++{ ++ return ipkg_what_provides_replaces_cmd(conf, WHATREPLACES, argc, argv); ++} ++ ++static int ipkg_search_cmd(ipkg_conf_t *conf, int argc, char **argv) ++{ ++ int i; ++ ++ pkg_vec_t *installed; ++ pkg_t *pkg; ++ str_list_t *installed_files; ++ str_list_elt_t *iter; ++ char *installed_file; ++ ++ if (argc < 1) { ++ return EINVAL; ++ } ++ ++ installed = pkg_vec_alloc(); ++ pkg_hash_fetch_all_installed(&conf->pkg_hash, installed); ++ ++ for (i=0; i < installed->len; i++) { ++ pkg = installed->pkgs[i]; ++ ++ installed_files = pkg_get_installed_files(pkg); ++ ++ for (iter = installed_files->head; iter; iter = iter->next) { ++ installed_file = iter->data; ++ if (fnmatch(argv[0], installed_file, 0)==0) { ++#ifndef IPKG_LIB ++ printf("%s: %s\n", pkg->name, installed_file); ++#else ++ if (ipkg_cb_list) ipkg_cb_list(pkg->name, ++ installed_file, ++ pkg_version_str_alloc(pkg), ++ pkg->state_status, p_userdata); ++#endif ++ } ++ } ++ ++ pkg_free_installed_files(pkg); ++ } ++ ++ /* XXX: CLEANUP: It's not obvious from the name of ++ pkg_hash_fetch_all_installed that we need to call ++ pkg_vec_free to avoid a memory leak. */ ++ pkg_vec_free(installed); ++ ++ return 0; ++} ++ ++static int ipkg_compare_versions_cmd(ipkg_conf_t *conf, int argc, char **argv) ++{ ++ if (argc == 3) { ++ /* this is a bit gross */ ++ struct pkg p1, p2; ++ parseVersion(&p1, argv[0]); ++ parseVersion(&p2, argv[2]); ++ return pkg_version_satisfied(&p1, &p2, argv[1]); ++ } else { ++ ipkg_message(conf, IPKG_ERROR, ++ "ipkg compare_versions <v1> <op> <v2>\n" ++ "<op> is one of <= >= << >> =\n"); ++ return -1; ++ } ++} ++ ++#ifndef HOST_CPU_STR ++#define HOST_CPU_STR__(X) #X ++#define HOST_CPU_STR_(X) HOST_CPU_STR__(X) ++#define HOST_CPU_STR HOST_CPU_STR_(HOST_CPU_FOO) ++#endif ++ ++static int ipkg_print_architecture_cmd(ipkg_conf_t *conf, int argc, char **argv) ++{ ++ nv_pair_list_elt_t *l; ++ ++ l = conf->arch_list.head; ++ while (l) { ++ nv_pair_t *nv = l->data; ++ printf("arch %s %s\n", nv->name, nv->value); ++ l = l->next; ++ } ++ return 0; ++} ++ ++ +diff -ruN busybox-1.2.0-orig/archival/libipkg/ipkg_cmd.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_cmd.h +--- busybox-1.2.0-orig/archival/libipkg/ipkg_cmd.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_cmd.h 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,46 @@ ++/* ipkg_cmd.h - the itsy package management system ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#ifndef IPKG_CMD_H ++#define IPKG_CMD_H ++ ++typedef int (*ipkg_cmd_fun_t)(ipkg_conf_t *conf, int argc, const char **argv); ++ ++struct ipkg_cmd ++{ ++ char *name; ++ int requires_args; ++ ipkg_cmd_fun_t fun; ++}; ++typedef struct ipkg_cmd ipkg_cmd_t; ++ ++ipkg_cmd_t *ipkg_cmd_find(const char *name); ++#ifdef IPKG_LIB ++int ipkg_cmd_exec(ipkg_cmd_t *cmd, ipkg_conf_t *conf, int argc, ++ const char **argv, void *userdata); ++#else ++int ipkg_cmd_exec(ipkg_cmd_t *cmd, ipkg_conf_t *conf, int argc, const char **argv); ++#endif ++int ipkg_multiple_files_scan (ipkg_conf_t *conf, int argc, char *argv[]); ++/* install any packges with state_want == SW_INSTALL */ ++int ipkg_install_wanted_packages(ipkg_conf_t *conf); ++/* ensure that all dependences are satisfied */ ++int ipkg_configure_packages(ipkg_conf_t *conf, char *pkg_name); ++ ++int pkg_mark_provides(pkg_t *pkg); ++ ++#endif +diff -ruN busybox-1.2.0-orig/archival/libipkg/ipkg_conf.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_conf.c +--- busybox-1.2.0-orig/archival/libipkg/ipkg_conf.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_conf.c 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,711 @@ ++/* ipkg_conf.c - the itsy package management system ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#include <glob.h> ++ ++#include "ipkg.h" ++#include "ipkg_conf.h" ++ ++#include "xregex.h" ++#include "sprintf_alloc.h" ++#include "ipkg_conf.h" ++#include "ipkg_message.h" ++#include "file_util.h" ++#include "str_util.h" ++#include "xsystem.h" ++ ++ ++ipkg_conf_t *global_conf; ++ ++static int ipkg_conf_parse_file(ipkg_conf_t *conf, const char *filename, ++ pkg_src_list_t *pkg_src_list, ++ nv_pair_list_t *tmp_dest_nv_pair_list, ++ char **tmp_lists_dir); ++static int ipkg_init_options_array(const ipkg_conf_t *conf, ipkg_option_t **options); ++static int ipkg_conf_set_option(const ipkg_option_t *options, ++ const char *name, const char *value); ++static int ipkg_conf_set_default_dest(ipkg_conf_t *conf, ++ const char *default_dest_name); ++static int set_and_load_pkg_src_list(ipkg_conf_t *conf, ++ pkg_src_list_t *nv_pair_list); ++static int set_and_load_pkg_dest_list(ipkg_conf_t *conf, ++ nv_pair_list_t *nv_pair_list, char * lists_dir); ++ ++int ipkg_init_options_array(const ipkg_conf_t *conf, ipkg_option_t **options) ++{ ++ ipkg_option_t tmp[] = { ++ { "force_defaults", IPKG_OPT_TYPE_BOOL, &conf->force_defaults }, ++ { "force_depends", IPKG_OPT_TYPE_BOOL, &conf->force_depends }, ++ { "force_overwrite", IPKG_OPT_TYPE_BOOL, &conf->force_overwrite }, ++ { "force_downgrade", IPKG_OPT_TYPE_BOOL, &conf->force_downgrade }, ++ { "force_reinstall", IPKG_OPT_TYPE_BOOL, &conf->force_reinstall }, ++ { "force_space", IPKG_OPT_TYPE_BOOL, &conf->force_space }, ++ { "ftp_proxy", IPKG_OPT_TYPE_STRING, &conf->ftp_proxy }, ++ { "http_proxy", IPKG_OPT_TYPE_STRING, &conf->http_proxy }, ++ { "multiple_providers", IPKG_OPT_TYPE_BOOL, &conf->multiple_providers }, ++ { "no_proxy", IPKG_OPT_TYPE_STRING, &conf->no_proxy }, ++ { "test", IPKG_OPT_TYPE_INT, &conf->noaction }, ++ { "noaction", IPKG_OPT_TYPE_INT, &conf->noaction }, ++ { "nodeps", IPKG_OPT_TYPE_BOOL, &conf->nodeps }, ++ { "offline_root", IPKG_OPT_TYPE_STRING, &conf->offline_root }, ++ { "offline_root_post_script_cmd", IPKG_OPT_TYPE_STRING, &conf->offline_root_post_script_cmd }, ++ { "offline_root_pre_script_cmd", IPKG_OPT_TYPE_STRING, &conf->offline_root_pre_script_cmd }, ++ { "proxy_passwd", IPKG_OPT_TYPE_STRING, &conf->proxy_passwd }, ++ { "proxy_user", IPKG_OPT_TYPE_STRING, &conf->proxy_user }, ++ { "query-all", IPKG_OPT_TYPE_BOOL, &conf->query_all }, ++ { "verbose-wget", IPKG_OPT_TYPE_BOOL, &conf->verbose_wget }, ++ { "verbosity", IPKG_OPT_TYPE_BOOL, &conf->verbosity }, ++ { NULL } ++ }; ++ ++ *options = (ipkg_option_t *)malloc(sizeof(tmp)); ++ if ( options == NULL ){ ++ fprintf(stderr,"%s: Unable to allocate memory\n",__FUNCTION__); ++ return -1; ++ } ++ ++ memcpy(*options, tmp, sizeof(tmp)); ++ return 0; ++}; ++ ++static void ipkg_conf_override_string(char **conf_str, char *arg_str) ++{ ++ if (arg_str) { ++ if (*conf_str) { ++ free(*conf_str); ++ } ++ *conf_str = strdup(arg_str); ++ } ++} ++ ++static void ipkg_conf_free_string(char **conf_str) ++{ ++ if (*conf_str) { ++ free(*conf_str); ++ *conf_str = NULL; ++ } ++} ++ ++int ipkg_conf_init(ipkg_conf_t *conf, const args_t *args) ++{ ++ int err; ++ char *tmp_dir_base; ++ nv_pair_list_t tmp_dest_nv_pair_list; ++ char * lists_dir =NULL; ++ glob_t globbuf; ++ char *etc_ipkg_conf_pattern = "/etc/ipkg/*.conf"; ++ char *pending_dir =NULL; ++ ++ memset(conf, 0, sizeof(ipkg_conf_t)); ++ ++ pkg_src_list_init(&conf->pkg_src_list); ++ ++ nv_pair_list_init(&tmp_dest_nv_pair_list); ++ pkg_dest_list_init(&conf->pkg_dest_list); ++ ++ nv_pair_list_init(&conf->arch_list); ++ ++ conf->restrict_to_default_dest = 0; ++ conf->default_dest = NULL; ++ ++ ++ if (args->tmp_dir) ++ tmp_dir_base = args->tmp_dir; ++ else ++ tmp_dir_base = getenv("TMPDIR"); ++ sprintf_alloc(&conf->tmp_dir, "%s/%s", ++ tmp_dir_base ? tmp_dir_base : IPKG_CONF_DEFAULT_TMP_DIR_BASE, ++ IPKG_CONF_TMP_DIR_SUFFIX); ++ conf->tmp_dir = mkdtemp(conf->tmp_dir); ++ if (conf->tmp_dir == NULL) { ++ fprintf(stderr, "%s: Failed to create temporary directory `%s': %s\n", ++ __FUNCTION__, conf->tmp_dir, strerror(errno)); ++ return errno; ++ } ++ ++ conf->force_depends = 0; ++ conf->force_defaults = 0; ++ conf->force_overwrite = 0; ++ conf->force_downgrade = 0; ++ conf->force_reinstall = 0; ++ conf->force_space = 0; ++ conf->force_removal_of_essential_packages = 0; ++ conf->force_removal_of_dependent_packages = 0; ++ conf->nodeps = 0; ++ conf->verbose_wget = 0; ++ conf->offline_root = NULL; ++ conf->offline_root_pre_script_cmd = NULL; ++ conf->offline_root_post_script_cmd = NULL; ++ conf->multiple_providers = 0; ++ conf->verbosity = 1; ++ conf->noaction = 0; ++ ++ conf->http_proxy = NULL; ++ conf->ftp_proxy = NULL; ++ conf->no_proxy = NULL; ++ conf->proxy_user = NULL; ++ conf->proxy_passwd = NULL; ++ ++ pkg_hash_init("pkg-hash", &conf->pkg_hash, IPKG_CONF_DEFAULT_HASH_LEN); ++ hash_table_init("file-hash", &conf->file_hash, IPKG_CONF_DEFAULT_HASH_LEN); ++ hash_table_init("obs-file-hash", &conf->obs_file_hash, IPKG_CONF_DEFAULT_HASH_LEN); ++ lists_dir=(char *)malloc(1); ++ lists_dir[0]='\0'; ++ if (args->conf_file) { ++ struct stat stat_buf; ++ err = stat(args->conf_file, &stat_buf); ++ if (err == 0) ++ if (ipkg_conf_parse_file(conf, args->conf_file, ++ &conf->pkg_src_list, &tmp_dest_nv_pair_list,&lists_dir)<0) { ++ /* Memory leakage from ipkg_conf_parse-file */ ++ return -1; ++ } ++ ++ } ++ ++ /* if (!lists_dir ){*/ ++ if (strlen(lists_dir)<=1 ){ ++ lists_dir = realloc(lists_dir,strlen(IPKG_CONF_LISTS_DIR)+2); ++ sprintf (lists_dir,"%s",IPKG_CONF_LISTS_DIR); ++ } ++ ++ if (args->offline_root) { ++ char *tmp = malloc(strlen(lists_dir) + strlen(args->offline_root) + 1); ++ sprintf_alloc(&tmp, "%s/%s",args->offline_root,lists_dir); ++ free(lists_dir); ++ lists_dir = tmp; ++ } ++ ++ pending_dir = malloc(strlen(lists_dir)+strlen("/pending")+5); ++ snprintf(pending_dir,strlen(lists_dir)+strlen("/pending") ,"%s%s",lists_dir,"/pending"); ++ ++ conf->lists_dir = strdup(lists_dir); ++ conf->pending_dir = strdup(pending_dir); ++ ++ if (args->offline_root) ++ sprintf_alloc(&etc_ipkg_conf_pattern, "%s/etc/ipkg/*.conf", args->offline_root); ++ memset(&globbuf, 0, sizeof(globbuf)); ++ err = glob(etc_ipkg_conf_pattern, 0, NULL, &globbuf); ++ if (!err) { ++ int i; ++ for (i = 0; i < globbuf.gl_pathc; i++) { ++ if (globbuf.gl_pathv[i]) ++ if ( ipkg_conf_parse_file(conf, globbuf.gl_pathv[i], ++ &conf->pkg_src_list, &tmp_dest_nv_pair_list,&lists_dir)<0) { ++ /* Memory leakage from ipkg_conf_parse-file */ ++ return -1; ++ } ++ } ++ } ++ globfree(&globbuf); ++ ++ /* if no architectures were defined, then default all, noarch, and host architecture */ ++ if (nv_pair_list_empty(&conf->arch_list)) { ++ nv_pair_list_append(&conf->arch_list, "all", "1"); ++ nv_pair_list_append(&conf->arch_list, "noarch", "1"); ++ nv_pair_list_append(&conf->arch_list, HOST_CPU_STR, "10"); ++ } ++ ++ /* Even if there is no conf file, we'll need at least one dest. */ ++ if (tmp_dest_nv_pair_list.head == NULL) { ++ nv_pair_list_append(&tmp_dest_nv_pair_list, ++ IPKG_CONF_DEFAULT_DEST_NAME, ++ IPKG_CONF_DEFAULT_DEST_ROOT_DIR); ++ } ++ ++ /* After parsing the file, set options from command-line, (so that ++ command-line arguments take precedence) */ ++ /* XXX: CLEANUP: The interaction between args.c and ipkg_conf.c ++ really needs to be cleaned up. There is so much duplication ++ right now it is ridiculous. Maybe ipkg_conf_t should just save ++ a pointer to args_t (which could then not be freed), rather ++ than duplicating every field here? */ ++ if (args->force_depends) { ++ conf->force_depends = 1; ++ } ++ if (args->force_defaults) { ++ conf->force_defaults = 1; ++ } ++ if (args->force_overwrite) { ++ conf->force_overwrite = 1; ++ } ++ if (args->force_downgrade) { ++ conf->force_downgrade = 1; ++ } ++ if (args->force_reinstall) { ++ conf->force_reinstall = 1; ++ } ++ if (args->force_removal_of_dependent_packages) { ++ conf->force_removal_of_dependent_packages = 1; ++ } ++ if (args->force_removal_of_essential_packages) { ++ conf->force_removal_of_essential_packages = 1; ++ } ++ if (args->nodeps) { ++ conf->nodeps = 1; ++ } ++ if (args->noaction) { ++ conf->noaction = 1; ++ } ++ if (args->query_all) { ++ conf->query_all = 1; ++ } ++ if (args->verbose_wget) { ++ conf->verbose_wget = 1; ++ } ++ if (args->multiple_providers) { ++ conf->multiple_providers = 1; ++ } ++ if (args->verbosity != conf->verbosity) { ++ conf->verbosity = args->verbosity; ++ } ++ ++ ipkg_conf_override_string(&conf->offline_root, ++ args->offline_root); ++ ipkg_conf_override_string(&conf->offline_root_pre_script_cmd, ++ args->offline_root_pre_script_cmd); ++ ipkg_conf_override_string(&conf->offline_root_post_script_cmd, ++ args->offline_root_post_script_cmd); ++ ++/* Pigi: added a flag to disable the checking of structures if the command does not need to ++ read anything from there. ++*/ ++ if ( !(args->nocheckfordirorfile)){ ++ /* need to run load the source list before dest list -Jamey */ ++ if ( !(args->noreadfeedsfile)) ++ set_and_load_pkg_src_list(conf, &conf->pkg_src_list); ++ ++ /* Now that we have resolved conf->offline_root, we can commit to ++ the directory names for the dests and load in all the package ++ lists. */ ++ set_and_load_pkg_dest_list(conf, &tmp_dest_nv_pair_list,lists_dir); ++ ++ if (args->dest) { ++ err = ipkg_conf_set_default_dest(conf, args->dest); ++ if (err) { ++ return err; ++ } ++ } ++ } ++ nv_pair_list_deinit(&tmp_dest_nv_pair_list); ++ free(lists_dir); ++ free(pending_dir); ++ ++ return 0; ++} ++ ++void ipkg_conf_deinit(ipkg_conf_t *conf) ++{ ++#ifdef IPKG_DEBUG_NO_TMP_CLEANUP ++#error ++ fprintf(stderr, "%s: Not cleaning up %s since ipkg compiled " ++ "with IPKG_DEBUG_NO_TMP_CLEANUP\n", ++ __FUNCTION__, conf->tmp_dir); ++#else ++ int err; ++ ++ err = rmdir(conf->tmp_dir); ++ if (err) { ++ if (errno == ENOTEMPTY) { ++ char *cmd; ++ sprintf_alloc(&cmd, "rm -fr %s\n", conf->tmp_dir); ++ err = xsystem(cmd); ++ free(cmd); ++ } ++ if (err) ++ fprintf(stderr, "WARNING: Unable to remove temporary directory: %s: %s\n", conf->tmp_dir, strerror(errno)); ++ } ++#endif /* IPKG_DEBUG_NO_TMP_CLEANUP */ ++ ++ free(conf->tmp_dir); /*XXX*/ ++ ++ pkg_src_list_deinit(&conf->pkg_src_list); ++ pkg_dest_list_deinit(&conf->pkg_dest_list); ++ nv_pair_list_deinit(&conf->arch_list); ++ if (&conf->pkg_hash) ++ pkg_hash_deinit(&conf->pkg_hash); ++ if (&conf->file_hash) ++ hash_table_deinit(&conf->file_hash); ++ if (&conf->obs_file_hash) ++ hash_table_deinit(&conf->obs_file_hash); ++ ++ ipkg_conf_free_string(&conf->offline_root); ++ ipkg_conf_free_string(&conf->offline_root_pre_script_cmd); ++ ipkg_conf_free_string(&conf->offline_root_post_script_cmd); ++ ++ if (conf->verbosity > 1) { ++ int i; ++ hash_table_t *hashes[] = { ++ &conf->pkg_hash, ++ &conf->file_hash, ++ &conf->obs_file_hash }; ++ for (i = 0; i < 3; i++) { ++ hash_table_t *hash = hashes[i]; ++ int c = 0; ++ int n_conflicts = 0; ++ int j; ++ for (j = 0; j < hash->n_entries; j++) { ++ int len = 0; ++ hash_entry_t *e = &hash->entries[j]; ++ if (e->next) ++ n_conflicts++; ++ while (e && e->key) { ++ len++; ++ e = e->next; ++ } ++ if (len > c) ++ c = len; ++ } ++ ipkg_message(conf, IPKG_DEBUG, "hash_table[%s] n_buckets=%d n_elements=%d max_conflicts=%d n_conflicts=%d\n", ++ hash->name, hash->n_entries, hash->n_elements, c, n_conflicts); ++ hash_table_deinit(hash); ++ } ++ } ++} ++ ++static int ipkg_conf_set_default_dest(ipkg_conf_t *conf, ++ const char *default_dest_name) ++{ ++ pkg_dest_list_elt_t *iter; ++ pkg_dest_t *dest; ++ ++ for (iter = conf->pkg_dest_list.head; iter; iter = iter->next) { ++ dest = iter->data; ++ if (strcmp(dest->name, default_dest_name) == 0) { ++ conf->default_dest = dest; ++ conf->restrict_to_default_dest = 1; ++ return 0; ++ } ++ } ++ ++ fprintf(stderr, "ERROR: Unknown dest name: `%s'\n", default_dest_name); ++ ++ return 1; ++} ++ ++static int set_and_load_pkg_src_list(ipkg_conf_t *conf, pkg_src_list_t *pkg_src_list) ++{ ++ pkg_src_list_elt_t *iter; ++ pkg_src_t *src; ++ char *list_file; ++ ++ for (iter = pkg_src_list->head; iter; iter = iter->next) { ++ src = iter->data; ++ if (src == NULL) { ++ continue; ++ } ++ ++ sprintf_alloc(&list_file, "%s/%s", ++ conf->restrict_to_default_dest ? conf->default_dest->lists_dir : conf->lists_dir, ++ src->name); ++ ++ if (file_exists(list_file)) { ++ pkg_hash_add_from_file(conf, list_file, src, NULL, 0); ++ } ++ free(list_file); ++ } ++ ++ return 0; ++} ++ ++static int set_and_load_pkg_dest_list(ipkg_conf_t *conf, nv_pair_list_t *nv_pair_list, char *lists_dir ) ++{ ++ nv_pair_list_elt_t *iter; ++ nv_pair_t *nv_pair; ++ pkg_dest_t *dest; ++ char *root_dir; ++ ++ for (iter = nv_pair_list->head; iter; iter = iter->next) { ++ nv_pair = iter->data; ++ ++ if (conf->offline_root) { ++ sprintf_alloc(&root_dir, "%s%s", conf->offline_root, nv_pair->value); ++ } else { ++ root_dir = strdup(nv_pair->value); ++ } ++ dest = pkg_dest_list_append(&conf->pkg_dest_list, nv_pair->name, root_dir, lists_dir); ++ free(root_dir); ++ if (dest == NULL) { ++ continue; ++ } ++ if (conf->default_dest == NULL) { ++ conf->default_dest = dest; ++ } ++ if (file_exists(dest->status_file_name)) { ++ pkg_hash_add_from_file(conf, dest->status_file_name, ++ NULL, dest, 1); ++ } ++ } ++ ++ return 0; ++} ++ ++static int ipkg_conf_parse_file(ipkg_conf_t *conf, const char *filename, ++ pkg_src_list_t *pkg_src_list, ++ nv_pair_list_t *tmp_dest_nv_pair_list, ++ char **lists_dir) ++{ ++ ipkg_option_t * options; ++ FILE *file = fopen(filename, "r"); ++ regex_t valid_line_re, comment_re; ++#define regmatch_size 12 ++ regmatch_t regmatch[regmatch_size]; ++ ++ if (ipkg_init_options_array(conf, &options)<0) ++ return ENOMEM; ++ ++ if (file == NULL) { ++ fprintf(stderr, "%s: failed to open %s: %s\n", ++ __FUNCTION__, filename, strerror(errno)); ++ free(options); ++ return errno; ++ } ++ ipkg_message(conf, IPKG_NOTICE, "loading conf file %s\n", filename); ++ ++ xregcomp(&comment_re, ++ "^[[:space:]]*(#.*|[[:space:]]*)$", ++ REG_EXTENDED); ++ xregcomp(&valid_line_re, "^[[:space:]]*(\"([^\"]*)\"|([^[:space:]]*))[[:space:]]*(\"([^\"]*)\"|([^[:space:]]*))[[:space:]]*(\"([^\"]*)\"|([^[:space:]]*))([[:space:]]+([^[:space:]]+))?[[:space:]]*$", REG_EXTENDED); ++ ++ while(1) { ++ int line_num = 0; ++ char *line; ++ char *type, *name, *value, *extra; ++ ++ line = file_read_line_alloc(file); ++ line_num++; ++ if (line == NULL) { ++ break; ++ } ++ ++ str_chomp(line); ++ ++ if (regexec(&comment_re, line, 0, 0, 0) == 0) { ++ goto NEXT_LINE; ++ } ++ ++ if (regexec(&valid_line_re, line, regmatch_size, regmatch, 0) == REG_NOMATCH) { ++ str_chomp(line); ++ fprintf(stderr, "%s:%d: Ignoring invalid line: `%s'\n", ++ filename, line_num, line); ++ goto NEXT_LINE; ++ } ++ ++ /* This has to be so ugly to deal with optional quotation marks */ ++ if (regmatch[2].rm_so > 0) { ++ type = strndup(line + regmatch[2].rm_so, ++ regmatch[2].rm_eo - regmatch[2].rm_so); ++ } else { ++ type = strndup(line + regmatch[3].rm_so, ++ regmatch[3].rm_eo - regmatch[3].rm_so); ++ } ++ if (regmatch[5].rm_so > 0) { ++ name = strndup(line + regmatch[5].rm_so, ++ regmatch[5].rm_eo - regmatch[5].rm_so); ++ } else { ++ name = strndup(line + regmatch[6].rm_so, ++ regmatch[6].rm_eo - regmatch[6].rm_so); ++ } ++ if (regmatch[8].rm_so > 0) { ++ value = strndup(line + regmatch[8].rm_so, ++ regmatch[8].rm_eo - regmatch[8].rm_so); ++ } else { ++ value = strndup(line + regmatch[9].rm_so, ++ regmatch[9].rm_eo - regmatch[9].rm_so); ++ } ++ extra = NULL; ++ if (regmatch[11].rm_so > 0) { ++ extra = strndup (line + regmatch[11].rm_so, ++ regmatch[11].rm_eo - regmatch[11].rm_so); ++ } ++ ++ /* We use the tmp_dest_nv_pair_list below instead of ++ conf->pkg_dest_list because we might encounter an ++ offline_root option later and that would invalidate the ++ directories we would have computed in ++ pkg_dest_list_init. (We do a similar thing with ++ tmp_src_nv_pair_list for sake of symmetry.) */ ++ if (strcmp(type, "option") == 0) { ++ ipkg_conf_set_option(options, name, value); ++ } else if (strcmp(type, "src") == 0) { ++ if (!nv_pair_list_find(pkg_src_list, name)) { ++ pkg_src_list_append (pkg_src_list, name, value, extra, 0); ++ } else { ++ ipkg_message(conf, IPKG_ERROR, "ERROR: duplicate src declaration. Skipping:\n\t src %s %s\n", ++ name, value); ++ } ++ } else if (strcmp(type, "src/gz") == 0) { ++ if (!nv_pair_list_find(pkg_src_list, name)) { ++ pkg_src_list_append (pkg_src_list, name, value, extra, 1); ++ } else { ++ ipkg_message(conf, IPKG_ERROR, "ERROR: duplicate src declaration. Skipping:\n\t src %s %s\n", ++ name, value); ++ } ++ } else if (strcmp(type, "dest") == 0) { ++ nv_pair_list_append(tmp_dest_nv_pair_list, name, value); ++ } else if (strcmp(type, "lists_dir") == 0) { ++ *lists_dir = realloc(*lists_dir,strlen(value)+1); ++ if (*lists_dir == NULL) { ++ ipkg_message(conf, IPKG_ERROR, "ERROR: Not enough memory\n"); ++ free(options); ++ return EINVAL; ++ } ++ sprintf (*lists_dir,"%s",value); ++ } else if (strcmp(type, "arch") == 0) { ++ ipkg_message(conf, IPKG_INFO, "supported arch %s priority (%s)\n", name, value); ++ if (!value) { ++ ipkg_message(conf, IPKG_NOTICE, "defaulting architecture %s priority to 10\n", name); ++ value = strdup("10"); ++ } ++ nv_pair_list_append(&conf->arch_list, strdup(name), strdup(value)); ++ } else { ++ fprintf(stderr, "WARNING: Ignoring unknown configuration " ++ "parameter: %s %s %s\n", type, name, value); ++ free(options); ++ return EINVAL; ++ } ++ ++ free(type); ++ free(name); ++ free(value); ++ if (extra) ++ free (extra); ++ ++ NEXT_LINE: ++ free(line); ++ } ++ ++ free(options); ++ regfree(&comment_re); ++ regfree(&valid_line_re); ++ fclose(file); ++ ++ return 0; ++} ++ ++static int ipkg_conf_set_option(const ipkg_option_t *options, ++ const char *name, const char *value) ++{ ++ int i = 0; ++ while (options[i].name) { ++ if (strcmp(options[i].name, name) == 0) { ++ switch (options[i].type) { ++ case IPKG_OPT_TYPE_BOOL: ++ *((int *)options[i].value) = 1; ++ return 0; ++ case IPKG_OPT_TYPE_INT: ++ if (value) { ++ *((int *)options[i].value) = atoi(value); ++ return 0; ++ } else { ++ printf("%s: Option %s need an argument\n", ++ __FUNCTION__, name); ++ return EINVAL; ++ } ++ case IPKG_OPT_TYPE_STRING: ++ if (value) { ++ *((char **)options[i].value) = strdup(value); ++ return 0; ++ } else { ++ printf("%s: Option %s need an argument\n", ++ __FUNCTION__, name); ++ return EINVAL; ++ } ++ } ++ } ++ i++; ++ } ++ ++ fprintf(stderr, "%s: Unrecognized option: %s=%s\n", ++ __FUNCTION__, name, value); ++ return EINVAL; ++} ++ ++int ipkg_conf_write_status_files(ipkg_conf_t *conf) ++{ ++ pkg_dest_list_elt_t *iter; ++ pkg_dest_t *dest; ++ pkg_vec_t *all; ++ pkg_t *pkg; ++ register int i; ++ int err; ++ ++ if (conf->noaction) ++ return 0; ++ for (iter = conf->pkg_dest_list.head; iter; iter = iter->next) { ++ dest = iter->data; ++ dest->status_file = fopen(dest->status_file_tmp_name, "w"); ++ if (dest->status_file == NULL) { ++ fprintf(stderr, "%s: Can't open status file: %s for writing: %s\n", ++ __FUNCTION__, dest->status_file_name, strerror(errno)); ++ } ++ } ++ ++ all = pkg_vec_alloc(); ++ pkg_hash_fetch_available(&conf->pkg_hash, all); ++ ++ for(i = 0; i < all->len; i++) { ++ pkg = all->pkgs[i]; ++ /* We don't need most uninstalled packages in the status file */ ++ if (pkg->state_status == SS_NOT_INSTALLED ++ && (pkg->state_want == SW_UNKNOWN ++ || pkg->state_want == SW_DEINSTALL ++ || pkg->state_want == SW_PURGE)) { ++ continue; ++ } ++ if (!pkg) { ++ fprintf(stderr, "Null package\n"); ++ } ++ if (pkg->dest == NULL) { ++ fprintf(stderr, "%s: ERROR: Can't write status for " ++ "package %s since it has a NULL dest\n", ++ __FUNCTION__, pkg->name); ++ continue; ++ } ++ if (pkg->dest->status_file) { ++ pkg_print_status(pkg, pkg->dest->status_file); ++ } ++ } ++ ++ pkg_vec_free(all); ++ ++ for (iter = conf->pkg_dest_list.head; iter; iter = iter->next) { ++ dest = iter->data; ++ if (dest->status_file) { ++ err = ferror(dest->status_file); ++ fclose(dest->status_file); ++ dest->status_file = NULL; ++ if (!err) { ++ file_move(dest->status_file_tmp_name, dest->status_file_name); ++ } else { ++ fprintf(stderr, "%s: ERROR: An error has occurred writing %s, " ++ "retaining old %s\n", __FUNCTION__, ++ dest->status_file_tmp_name, dest->status_file_name); ++ } ++ } ++ } ++ ++ return 0; ++} ++ ++ ++char *root_filename_alloc(ipkg_conf_t *conf, char *filename) ++{ ++ char *root_filename; ++ sprintf_alloc(&root_filename, "%s%s", (conf->offline_root ? conf->offline_root : ""), filename); ++ return root_filename; ++} +diff -ruN busybox-1.2.0-orig/archival/libipkg/ipkg_conf.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_conf.h +--- busybox-1.2.0-orig/archival/libipkg/ipkg_conf.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_conf.h 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,107 @@ ++/* ipkg_conf.h - the itsy package management system ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#ifndef IPKG_CONF_H ++#define IPKG_CONF_H ++ ++typedef struct ipkg_conf ipkg_conf_t; ++ ++#include "hash_table.h" ++#include "ipkg.h" ++#include "args.h" ++#include "pkg.h" ++#include "pkg_hash.h" ++#include "pkg_src_list.h" ++#include "pkg_dest_list.h" ++#include "nv_pair_list.h" ++ ++#define IPKG_CONF_DEFAULT_TMP_DIR_BASE "/tmp" ++#define IPKG_CONF_TMP_DIR_SUFFIX "ipkg-XXXXXX" ++#define IPKG_CONF_LISTS_DIR IPKG_STATE_DIR_PREFIX "/lists" ++#define IPKG_CONF_PENDING_DIR IPKG_STATE_DIR_PREFIX "/pending" ++ ++/* In case the config file defines no dest */ ++#define IPKG_CONF_DEFAULT_DEST_NAME "root" ++#define IPKG_CONF_DEFAULT_DEST_ROOT_DIR "/" ++ ++#define IPKG_CONF_DEFAULT_HASH_LEN 1024 ++ ++struct ipkg_conf ++{ ++ pkg_src_list_t pkg_src_list; ++ pkg_dest_list_t pkg_dest_list; ++ nv_pair_list_t arch_list; ++ ++ int restrict_to_default_dest; ++ pkg_dest_t *default_dest; ++ ++ char *tmp_dir; ++ const char *lists_dir; ++ const char *pending_dir; ++ ++ /* options */ ++ int force_depends; ++ int force_defaults; ++ int force_overwrite; ++ int force_downgrade; ++ int force_reinstall; ++ int force_space; ++ int force_removal_of_dependent_packages; ++ int force_removal_of_essential_packages; ++ int nodeps; /* do not follow dependences */ ++ int verbose_wget; ++ int multiple_providers; ++ char *offline_root; ++ char *offline_root_pre_script_cmd; ++ char *offline_root_post_script_cmd; ++ int query_all; ++ int verbosity; ++ int noaction; ++ ++ /* proxy options */ ++ char *http_proxy; ++ char *ftp_proxy; ++ char *no_proxy; ++ char *proxy_user; ++ char *proxy_passwd; ++ ++ hash_table_t pkg_hash; ++ hash_table_t file_hash; ++ hash_table_t obs_file_hash; ++}; ++ ++enum ipkg_option_type { ++ IPKG_OPT_TYPE_BOOL, ++ IPKG_OPT_TYPE_INT, ++ IPKG_OPT_TYPE_STRING ++}; ++typedef enum ipkg_option_type ipkg_option_type_t; ++ ++typedef struct ipkg_option ipkg_option_t; ++struct ipkg_option { ++ const char *name; ++ const ipkg_option_type_t type; ++ const void *value; ++}; ++ ++int ipkg_conf_init(ipkg_conf_t *conf, const args_t *args); ++void ipkg_conf_deinit(ipkg_conf_t *conf); ++ ++int ipkg_conf_write_status_files(ipkg_conf_t *conf); ++char *root_filename_alloc(ipkg_conf_t *conf, char *filename); ++ ++#endif +diff -ruN busybox-1.2.0-orig/archival/libipkg/ipkg_configure.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_configure.c +--- busybox-1.2.0-orig/archival/libipkg/ipkg_configure.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_configure.c 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,40 @@ ++/* ipkg_configure.c - the itsy package management system ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#include "ipkg.h" ++ ++#include "ipkg_configure.h" ++ ++int ipkg_configure(ipkg_conf_t *conf, pkg_t *pkg) ++{ ++ int err; ++ ++ /* DPKG_INCOMPATIBILITY: ++ dpkg actually does some conffile handling here, rather than at the ++ end of ipkg_install(). Do we care? */ ++ /* DPKG_INCOMPATIBILITY: ++ dpkg actually includes a version number to this script call */ ++ err = pkg_run_script(conf, pkg, "postinst", "configure"); ++ if (err) { ++ printf("ERROR: %s.postinst returned %d\n", pkg->name, err); ++ return err; ++ } ++ ++ ipkg_state_changed++; ++ return 0; ++} ++ +diff -ruN busybox-1.2.0-orig/archival/libipkg/ipkg_configure.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_configure.h +--- busybox-1.2.0-orig/archival/libipkg/ipkg_configure.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_configure.h 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,25 @@ ++/* ipkg_configure.h - the itsy package management system ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#ifndef IPKG_CONFIGURE_H ++#define IPKG_CONFIGURE_H ++ ++#include "ipkg_conf.h" ++ ++int ipkg_configure(ipkg_conf_t *ipkg_conf, pkg_t *pkg); ++ ++#endif +diff -ruN busybox-1.2.0-orig/archival/libipkg/ipkg_download.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_download.c +--- busybox-1.2.0-orig/archival/libipkg/ipkg_download.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_download.c 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,195 @@ ++/* ipkg_download.c - the itsy package management system ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#include "ipkg.h" ++#include "ipkg_download.h" ++#include "ipkg_message.h" ++ ++#include "sprintf_alloc.h" ++#include "xsystem.h" ++#include "file_util.h" ++#include "str_util.h" ++ ++int ipkg_download(ipkg_conf_t *conf, const char *src, const char *dest_file_name) ++{ ++ int err = 0; ++ ++ char *src_basec = strdup(src); ++ char *src_base = basename(src_basec); ++ char *tmp_file_location; ++ char *cmd; ++ ++ ipkg_message(conf,IPKG_NOTICE,"Downloading %s\n", src); ++ ++ fflush(stdout); ++ ++ if (str_starts_with(src, "file:")) { ++ int ret; ++ const char *file_src = src + 5; ++ ipkg_message(conf,IPKG_INFO,"Copying %s to %s...", file_src, dest_file_name); ++ ret = file_copy(src + 5, dest_file_name); ++ ipkg_message(conf,IPKG_INFO,"Done.\n"); ++ return ret; ++ } ++ ++ sprintf_alloc(&tmp_file_location, "%s/%s", conf->tmp_dir, src_base); ++ err = unlink(tmp_file_location); ++ if (err && errno != ENOENT) { ++ ipkg_message(conf,IPKG_ERROR, "%s: ERROR: failed to unlink %s: %s\n", ++ __FUNCTION__, tmp_file_location, strerror(errno)); ++ free(tmp_file_location); ++ return errno; ++ } ++ ++ if (conf->http_proxy) { ++ ipkg_message(conf,IPKG_DEBUG,"Setting environment variable: http_proxy = %s\n", conf->http_proxy); ++ setenv("http_proxy", conf->http_proxy, 1); ++ } ++ if (conf->ftp_proxy) { ++ ipkg_message(conf,IPKG_DEBUG,"Setting environment variable: ftp_proxy = %s\n", conf->ftp_proxy); ++ setenv("ftp_proxy", conf->ftp_proxy, 1); ++ } ++ if (conf->no_proxy) { ++ ipkg_message(conf,IPKG_DEBUG,"Setting environment variable: no_proxy = %s\n", conf->no_proxy); ++ setenv("no_proxy", conf->no_proxy, 1); ++ } ++ ++ /* XXX: BUG rewrite to use execvp or else busybox's internal wget -Jamey 7/23/2002 */ ++ sprintf_alloc(&cmd, "wget --passive-ftp %s %s%s %s%s %s -P %s %s", ++ (conf->http_proxy || conf->ftp_proxy) ? "--proxy=on" : "", ++ conf->proxy_user ? "--proxy-user=" : "", ++ conf->proxy_user ? conf->proxy_user : "", ++ conf->proxy_passwd ? "--proxy-passwd=" : "", ++ conf->proxy_passwd ? conf->proxy_passwd : "", ++ conf->verbose_wget ? "" : "-q", ++ conf->tmp_dir, ++ src); ++ err = xsystem(cmd); ++ if (err) { ++ if (err != -1) { ++ ipkg_message(conf,IPKG_ERROR, "%s: ERROR: Command failed with return value %d: `%s'\n", ++ __FUNCTION__, err, cmd); ++ } ++ unlink(tmp_file_location); ++ free(tmp_file_location); ++ free(src_basec); ++ free(cmd); ++ return EINVAL; ++ } ++ free(cmd); ++ ++ err = file_move(tmp_file_location, dest_file_name); ++ ++ free(tmp_file_location); ++ free(src_basec); ++ ++ if (err) { ++ return err; ++ } ++ ++ return 0; ++} ++ ++int ipkg_download_pkg(ipkg_conf_t *conf, pkg_t *pkg, const char *dir) ++{ ++ int err; ++ char *url; ++ ++ if (pkg->src == NULL) { ++ ipkg_message(conf,IPKG_ERROR, "ERROR: Package %s (parent %s) is not available from any configured src.\n", ++ pkg->name, pkg->parent->name); ++ return -1; ++ } ++ ++ sprintf_alloc(&url, "%s/%s", pkg->src->value, pkg->filename); ++ ++ /* XXX: BUG: The pkg->filename might be something like ++ "../../foo.ipk". While this is correct, and exactly what we ++ want to use to construct url above, here we actually need to ++ use just the filename part, without any directory. */ ++ sprintf_alloc(&pkg->local_filename, "%s/%s", dir, pkg->filename); ++ ++ err = ipkg_download(conf, url, pkg->local_filename); ++ free(url); ++ ++ return err; ++} ++ ++/* ++ * Downloads file from url, installs in package database, return package name. ++ */ ++int ipkg_prepare_url_for_install(ipkg_conf_t *conf, const char *url, char **namep) ++{ ++ int err = 0; ++ pkg_t *pkg; ++ pkg = pkg_new(); ++ if (pkg == NULL) ++ return ENOMEM; ++ ++ if (str_starts_with(url, "http://") ++ || str_starts_with(url, "ftp://")) { ++ char *tmp_file; ++ char *file_basec = strdup(url); ++ char *file_base = basename(file_basec); ++ ++ sprintf_alloc(&tmp_file, "%s/%s", conf->tmp_dir, file_base); ++ err = ipkg_download(conf, url, tmp_file); ++ if (err) ++ return err; ++ ++ err = pkg_init_from_file(pkg, tmp_file); ++ if (err) ++ return err; ++ pkg->local_filename = strdup(tmp_file); ++ ++ free(tmp_file); ++ free(file_basec); ++ ++ } else if (strcmp(&url[strlen(url) - 4], IPKG_PKG_EXTENSION) == 0 ++ || strcmp(&url[strlen(url) - 4], DPKG_PKG_EXTENSION) == 0) { ++ ++ err = pkg_init_from_file(pkg, url); ++ if (err) ++ return err; ++ pkg->local_filename = strdup(url); ++ ipkg_message(conf, IPKG_DEBUG2, "Package %s provided by hand \(%s\).\n", pkg->name,pkg->local_filename); ++ pkg->provided_by_hand = 1; ++ ++ } else { ++ pkg_deinit(pkg); ++ free(pkg); ++ return 0; ++ } ++ ++ if (!pkg->architecture) { ++ ipkg_message(conf, IPKG_ERROR, "Package %s has no Architecture defined.\n", pkg->name); ++ return -EINVAL; ++ } ++ ++ pkg->dest = conf->default_dest; ++ pkg->state_want = SW_INSTALL; ++ pkg->state_flag |= SF_PREFER; ++ pkg = hash_insert_pkg(&conf->pkg_hash, pkg, 1,conf); ++ if ( pkg == NULL ){ ++ fprintf(stderr, "%s : This should never happen. Report this Bug in bugzilla please \n ",__FUNCTION__); ++ return 0; ++ } ++ if (namep) { ++ *namep = strdup(pkg->name); ++ } ++ return 0; ++} +diff -ruN busybox-1.2.0-orig/archival/libipkg/ipkg_download.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_download.h +--- busybox-1.2.0-orig/archival/libipkg/ipkg_download.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_download.h 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,30 @@ ++/* ipkg_download.h - the itsy package management system ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#ifndef IPKG_DOWNLOAD_H ++#define IPKG_DOWNLOAD_H ++ ++#include "ipkg_conf.h" ++ ++int ipkg_download(ipkg_conf_t *conf, const char *src, const char *dest_file_name); ++int ipkg_download_pkg(ipkg_conf_t *conf, pkg_t *pkg, const char *dir); ++/* ++ * Downloads file from url, installs in package database, return package name. ++ */ ++int ipkg_prepare_url_for_install(ipkg_conf_t *conf, const char *url, char **namep); ++ ++#endif +diff -ruN busybox-1.2.0-orig/archival/libipkg/ipkg.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg.h +--- busybox-1.2.0-orig/archival/libipkg/ipkg.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg.h 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,74 @@ ++/* ipkg.h - the itsy package management system ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#ifndef IPKG_H ++#define IPKG_H ++ ++/* ++#ifdef HAVE_CONFIG_H ++#include "config.h" ++#endif ++*/ ++ ++#if 0 ++#define IPKG_DEBUG_NO_TMP_CLEANUP ++#endif ++ ++#include "ipkg_includes.h" ++#include "ipkg_conf.h" ++#include "ipkg_message.h" ++ ++#define IPKG_PKG_EXTENSION ".ipk" ++#define DPKG_PKG_EXTENSION ".deb" ++ ++#define IPKG_LEGAL_PKG_NAME_CHARS "abcdefghijklmnopqrstuvwxyz0123456789.+-" ++#define IPKG_PKG_VERSION_SEP_CHAR '_' ++ ++#define IPKG_STATE_DIR_PREFIX IPKGLIBDIR"/ipkg" ++#define IPKG_LISTS_DIR_SUFFIX "lists" ++#define IPKG_INFO_DIR_SUFFIX "info" ++#define IPKG_STATUS_FILE_SUFFIX "status" ++ ++#define IPKG_BACKUP_SUFFIX "-ipkg.backup" ++ ++#define IPKG_LIST_DESCRIPTION_LENGTH 128 ++ ++#define IPKG_VERSION "0.99.162" ++ ++ ++enum ipkg_error { ++ IPKG_SUCCESS = 0, ++ IPKG_PKG_DEPS_UNSATISFIED, ++ IPKG_PKG_IS_ESSENTIAL, ++ IPKG_PKG_HAS_DEPENDENTS, ++ IPKG_PKG_HAS_NO_CANDIDATE ++}; ++typedef enum ipkg_error ipkg_error_t; ++ ++extern int ipkg_state_changed; ++ ++ ++struct errlist { ++ char * errmsg; ++ struct errlist * next; ++} ; ++ ++extern struct errlist* error_list; ++ ++extern ipkg_conf_t *global_conf; ++ ++#endif +diff -ruN busybox-1.2.0-orig/archival/libipkg/ipkg_includes.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_includes.h +--- busybox-1.2.0-orig/archival/libipkg/ipkg_includes.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_includes.h 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,79 @@ ++#ifndef IPKG_INCLUDES_H ++#define IPKG_INCLUDES_H ++ ++/* Define to 1 if you have the <memory.h> header file. */ ++#define HAVE_MEMORY_H 1 ++ ++/* Define to 1 if you have the <regex.h> header file. */ ++#define HAVE_REGEX_H 1 ++ ++/* Define to 1 if you have the <stdlib.h> header file. */ ++#define HAVE_STDLIB_H 1 ++ ++/* Define to 1 if you have the <strings.h> header file. */ ++#define HAVE_STRINGS_H 1 ++ ++/* Define to 1 if you have the <string.h> header file. */ ++#define HAVE_STRING_H 1 ++ ++/* Define to 1 if you have the <sys/stat.h> header file. */ ++#define HAVE_SYS_STAT_H 1 ++ ++/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */ ++#define HAVE_SYS_WAIT_H 1 ++ ++/* Define to 1 if you have the <unistd.h> header file. */ ++#define HAVE_UNISTD_H 1 ++ ++/* Define to 1 if you have the ANSI C header files. */ ++#define STDC_HEADERS 1 ++ ++ ++#include <stdio.h> ++ ++#if STDC_HEADERS ++# include <stdlib.h> ++# include <stdarg.h> ++# include <stddef.h> ++# include <ctype.h> ++# include <errno.h> ++#else ++# if HAVE_STDLIB_H ++# include <stdlib.h> ++# endif ++#endif ++ ++#if HAVE_REGEX_H ++# include <regex.h> ++#endif ++ ++#if HAVE_STRING_H ++# if !STDC_HEADERS && HAVE_MEMORY_H ++# include <memory.h> ++# endif ++/* XXX: What's the right way to pick up GNU's strndup declaration? */ ++# if __GNUC__ ++# define __USE_GNU 1 ++# endif ++# include <string.h> ++# undef __USE_GNU ++#endif ++ ++#if HAVE_STRINGS_H ++# include <strings.h> ++#endif ++ ++#if HAVE_SYS_STAT_H ++# include <sys/stat.h> ++#endif ++ ++#if HAVE_SYS_WAIT_H ++# include <sys/wait.h> ++#endif ++ ++#if HAVE_UNISTD_H ++# include <sys/types.h> ++# include <unistd.h> ++#endif ++ ++#endif /* IPKG_INCLUDES_H */ +diff -ruN busybox-1.2.0-orig/archival/libipkg/ipkg_install.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_install.c +--- busybox-1.2.0-orig/archival/libipkg/ipkg_install.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_install.c 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,1942 @@ ++/* ipkg_install.c - the itsy package management system ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#include "ipkg.h" ++#include <errno.h> ++#include <dirent.h> ++#include <glob.h> ++#include <time.h> ++#include <signal.h> ++typedef void (*sighandler_t)(int); ++ ++#include "pkg.h" ++#include "pkg_hash.h" ++#include "pkg_extract.h" ++ ++#include "ipkg_install.h" ++#include "ipkg_configure.h" ++#include "ipkg_download.h" ++#include "ipkg_remove.h" ++ ++#include "ipkg_utils.h" ++#include "ipkg_message.h" ++ ++#include "sprintf_alloc.h" ++#include "file_util.h" ++#include "str_util.h" ++#include "xsystem.h" ++#include "user.h" ++ ++int satisfy_dependencies_for(ipkg_conf_t *conf, pkg_t *pkg); ++static int verify_pkg_installable(ipkg_conf_t *conf, pkg_t *pkg); ++static int unpack_pkg_control_files(ipkg_conf_t *conf, pkg_t *pkg); ++ ++static int prerm_upgrade_old_pkg(ipkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg); ++static int prerm_upgrade_old_pkg_unwind(ipkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg); ++static int prerm_deconfigure_conflictors(ipkg_conf_t *conf, pkg_t *pkg, pkg_vec_t *conflictors); ++static int prerm_deconfigure_conflictors_unwind(ipkg_conf_t *conf, pkg_t *pkg, pkg_vec_t *conflictors); ++static int preinst_configure(ipkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg); ++static int preinst_configure_unwind(ipkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg); ++static int check_data_file_clashes(ipkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg); ++static int check_data_file_clashes_change(ipkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg); ++static int check_data_file_clashes_unwind(ipkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg); ++static int backup_modified_conffiles(ipkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg); ++static int backup_modified_conffiles_unwind(ipkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg); ++static int postrm_upgrade_old_pkg(ipkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg); ++static int postrm_upgrade_old_pkg_unwind(ipkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg); ++ ++static int remove_obsolesced_files(ipkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg); ++static int install_maintainer_scripts(ipkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg); ++static int remove_disappeared(ipkg_conf_t *conf, pkg_t *pkg); ++static int install_data_files(ipkg_conf_t *conf, pkg_t *pkg); ++static int resolve_conffiles(ipkg_conf_t *conf, pkg_t *pkg); ++ ++static int cleanup_temporary_files(ipkg_conf_t *conf, pkg_t *pkg); ++ ++static int user_prefers_old_conffile(const char *file, const char *backup); ++ ++static char *backup_filename_alloc(const char *file_name); ++static int backup_make_backup(ipkg_conf_t *conf, const char *file_name); ++static int backup_exists_for(const char *file_name); ++static int backup_remove(const char *file_name); ++ ++ ++int ipkg_install_from_file(ipkg_conf_t *conf, const char *filename) ++{ ++ int err, cmp; ++ pkg_t *pkg, *old; ++ char *old_version, *new_version; ++ ++ pkg = pkg_new(); ++ if (pkg == NULL) { ++ return ENOMEM; ++ } ++ ++ err = pkg_init_from_file(pkg, filename); ++ if (err) { ++ return err; ++ } ++ ++ if (!pkg->architecture) { ++ ipkg_message(conf, IPKG_ERROR, "Package %s has no Architecture defined.\n", pkg->name); ++ return -EINVAL; ++ } ++ ++ /* XXX: CLEANUP: hash_insert_pkg has a nasty side effect of possibly ++ freeing the pkg that we pass in. It might be nice to clean this up ++ if possible. */ ++ pkg = hash_insert_pkg(&conf->pkg_hash, pkg, 1,conf); ++ old = pkg_hash_fetch_installed_by_name(&conf->pkg_hash, pkg->name); ++ ++ pkg->local_filename = strdup(filename); ++ ++ if (old) { ++ old_version = pkg_version_str_alloc(old); ++ new_version = pkg_version_str_alloc(pkg); ++ ++ cmp = pkg_compare_versions(old, pkg); ++ if ( (conf->force_downgrade==1) && (cmp > 0) ){ /* We've been asked to allow downgrade and version is precedent */ ++ cmp = -1 ; /* then we force ipkg to downgrade */ ++ /* We need to use a value < 0 because in the 0 case we are asking to */ ++ /* reinstall, and some check could fail asking the "force-reinstall" option */ ++ } ++ if (cmp > 0) { ++ ipkg_message(conf, IPKG_NOTICE, ++ "Not downgrading package %s on %s from %s to %s.\n", ++ old->name, old->dest->name, old_version, new_version); ++ pkg->state_want = SW_DEINSTALL; ++ pkg->state_flag |= SF_OBSOLETE; ++ free(old_version); ++ free(new_version); ++ return 0; ++ } else { ++ free(old_version); ++ free(new_version); ++ } ++ } ++ ++ ipkg_message(conf, IPKG_DEBUG2,"Function: %s calling ipkg_install_pkg \n",__FUNCTION__); ++ return ipkg_install_pkg(conf, pkg,0); ++} ++ ++ipkg_error_t ipkg_install_by_name(ipkg_conf_t *conf, const char *pkg_name) ++{ ++ int cmp; ++ pkg_t *old, *new; ++ char *old_version, *new_version; ++ ++ ipkg_message(conf, IPKG_DEBUG2, " Getting old from pkg_hash_fetch \n" ); ++ old = pkg_hash_fetch_installed_by_name(&conf->pkg_hash, pkg_name); ++ if ( old ) ++ ipkg_message(conf, IPKG_DEBUG2, " Old versions from pkg_hash_fetch %s \n", old->version ); ++ ++ ipkg_message(conf, IPKG_DEBUG2, " Getting new from pkg_hash_fetch \n" ); ++ new = pkg_hash_fetch_best_installation_candidate_by_name(conf, pkg_name); ++ if ( new ) ++ ipkg_message(conf, IPKG_DEBUG2, " New versions from pkg_hash_fetch %s \n", new->version ); ++ ++/* Pigi Basically here is broken the version stuff. ++ What's happening is that nothing provide the version to differents ++ functions, so the returned struct is always the latest. ++ That's why the install by name don't work. ++*/ ++ ipkg_message(conf, IPKG_DEBUG2, " Versions from pkg_hash_fetch in %s ", __FUNCTION__ ); ++ ++ if ( old ) ++ ipkg_message(conf, IPKG_DEBUG2, " old %s ", old->version ); ++ if ( new ) ++ ipkg_message(conf, IPKG_DEBUG2, " new %s ", new->version ); ++ ipkg_message(conf, IPKG_DEBUG2, " \n"); ++ ++ if (new == NULL) { ++ return IPKG_PKG_HAS_NO_CANDIDATE; ++ } ++ ++ new->state_flag |= SF_USER; ++ if (old) { ++ old_version = pkg_version_str_alloc(old); ++ new_version = pkg_version_str_alloc(new); ++ ++ cmp = pkg_compare_versions(old, new); ++ if ( (conf->force_downgrade==1) && (cmp > 0) ){ /* We've been asked to allow downgrade and version is precedent */ ++ ipkg_message(conf, IPKG_DEBUG, " Forcing downgrade \n"); ++ cmp = -1 ; /* then we force ipkg to downgrade */ ++ /* We need to use a value < 0 because in the 0 case we are asking to */ ++ /* reinstall, and some check could fail asking the "force-reinstall" option */ ++ } ++ ipkg_message(conf, IPKG_DEBUG, ++ "Comparing visible versions of pkg %s:" ++ "\n\t%s is installed " ++ "\n\t%s is available " ++ "\n\t%d was comparison result\n", ++ pkg_name, old_version, new_version, cmp); ++ if (cmp == 0 && !conf->force_reinstall) { ++ ipkg_message(conf, IPKG_NOTICE, ++ "Package %s (%s) installed in %s is up to date.\n", ++ old->name, old_version, old->dest->name); ++ free(old_version); ++ free(new_version); ++ return 0; ++ } else if (cmp > 0) { ++ ipkg_message(conf, IPKG_NOTICE, ++ "Not downgrading package %s on %s from %s to %s.\n", ++ old->name, old->dest->name, old_version, new_version); ++ free(old_version); ++ free(new_version); ++ return 0; ++ } else if (cmp < 0) { ++ new->dest = old->dest; ++ old->state_want = SW_DEINSTALL; /* Here probably the problem for bug 1277 */ ++ } ++ } ++ ++ /* XXX: CLEANUP: The error code of ipkg_install_by_name is really ++ supposed to be an ipkg_error_t, but ipkg_install_pkg could ++ return any kind of integer, (might be errno from a syscall, ++ etc.). This is a real mess and will need to be cleaned up if ++ anyone ever wants to make a nice libipkg. */ ++ ++ ipkg_message(conf, IPKG_DEBUG2,"Function: %s calling ipkg_install_pkg \n",__FUNCTION__); ++ return ipkg_install_pkg(conf, new,0); ++} ++ ++ipkg_error_t ipkg_install_multi_by_name(ipkg_conf_t *conf, const char *pkg_name) ++{ ++ abstract_pkg_vec_t *providers = pkg_hash_fetch_all_installation_candidates (&conf->pkg_hash, pkg_name); ++ int i; ++ ipkg_error_t err; ++ abstract_pkg_t *ppkg ; ++ ++ if (providers == NULL) ++ return IPKG_PKG_HAS_NO_CANDIDATE; ++ ++ for (i = 0; i < providers->len; i++) { ++ ppkg = abstract_pkg_vec_get(providers, i); ++ ipkg_message(conf, IPKG_DEBUG2,"Function: %s calling ipkg_install_by_name %d \n",__FUNCTION__, i); ++ err = ipkg_install_by_name(conf, ppkg->name); ++ if (err) ++ return err; ++/* XXX Maybe ppkg should be freed ? */ ++ } ++ return 0; ++} ++ ++/* ++ * Walk dependence graph starting with pkg, collect packages to be ++ * installed into pkgs_needed, in dependence order. ++ */ ++int pkg_mark_dependencies_for_installation(ipkg_conf_t *conf, pkg_t *pkg, pkg_vec_t *pkgs_needed) ++{ ++ int i, err; ++ pkg_vec_t *depends = pkg_vec_alloc(); ++ char **unresolved = NULL; ++ int ndepends; ++ ++ ndepends = pkg_hash_fetch_unsatisfied_dependencies(conf, ++ pkg, depends, ++ &unresolved); ++ ++ if (unresolved) { ++ ipkg_message(conf, IPKG_ERROR, ++ "%s: Cannot satisfy the following dependencies for %s:\n\t", ++ conf->force_depends ? "Warning" : "ERROR", pkg->name); ++ while (*unresolved) { ++ ipkg_message(conf, IPKG_ERROR, " %s", *unresolved); ++ unresolved++; ++ } ++ ipkg_message(conf, IPKG_ERROR, "\n"); ++ if (! conf->force_depends) { ++ ipkg_message(conf, IPKG_INFO, ++ "This could mean that your package list is out of date or that the packages\n" ++ "mentioned above do not yet exist (try 'ipkg update'). To proceed in spite\n" ++ "of this problem try again with the '-force-depends' option.\n"); ++ pkg_vec_free(depends); ++ return IPKG_PKG_DEPS_UNSATISFIED; ++ } ++ } ++ ++ if (ndepends <= 0) { ++ pkg_vec_free(depends); ++ return 0; ++ } ++ ++ for (i = 0; i < depends->len; i++) { ++ pkg_t *dep = depends->pkgs[i]; ++ /* The package was uninstalled when we started, but another ++ dep earlier in this loop may have depended on it and pulled ++ it in, so check first. */ ++ if ((dep->state_status != SS_INSTALLED) ++ && (dep->state_status != SS_UNPACKED) ++ && (dep->state_want != SW_INSTALL)) { ++ ++ /* Mark packages as to-be-installed */ ++ dep->state_want = SW_INSTALL; ++ ++ /* Dependencies should be installed the same place as pkg */ ++ if (dep->dest == NULL) { ++ dep->dest = pkg->dest; ++ } ++ ++ err = pkg_mark_dependencies_for_installation(conf, dep, pkgs_needed); ++ if (err) { ++ pkg_vec_free(depends); ++ return err; ++ } ++ } ++ } ++ if (pkgs_needed) ++ pkg_vec_insert(pkgs_needed, pkg); ++ ++ pkg_vec_free(depends); ++ ++ return 0; ++} ++ ++int name_mark_dependencies_for_installation(ipkg_conf_t *conf, const char *pkg_name, pkg_vec_t *pkgs_needed) ++{ ++ int cmp; ++ pkg_t *old, *new; ++ char *old_version, *new_version; ++ ++ old = pkg_hash_fetch_installed_by_name(&conf->pkg_hash, pkg_name); ++ ++ new = pkg_hash_fetch_best_installation_candidate_by_name(conf, pkg_name); ++ if (new == NULL) { ++ return IPKG_PKG_HAS_NO_CANDIDATE; ++ } ++ if (old) { ++ old_version = pkg_version_str_alloc(old); ++ new_version = pkg_version_str_alloc(new); ++ ++ cmp = pkg_compare_versions(old, new); ++ if ( (conf->force_downgrade==1) && (cmp > 0) ){ /* We've been asked to allow downgrade and version is precedent */ ++ ipkg_message(conf, IPKG_DEBUG, " Forcing downgrade "); ++ cmp = -1 ; /* then we force ipkg to downgrade */ ++ /* We need to use a value < 0 because in the 0 case we are asking to */ ++ /* reinstall, and some check could fail asking the "force-reinstall" option */ ++ } ++ ipkg_message(conf, IPKG_DEBUG, ++ "comparing visible versions of pkg %s:" ++ "\n\t%s is installed " ++ "\n\t%s is available " ++ "\n\t%d was comparison result\n", ++ pkg_name, old_version, new_version, cmp); ++ if (cmp == 0 && !conf->force_reinstall) { ++ ipkg_message(conf, IPKG_NOTICE, ++ "Package %s (%s) installed in %s is up to date.\n", ++ old->name, old_version, old->dest->name); ++ free(old_version); ++ free(new_version); ++ return 0; ++ } else if (cmp > 0) { ++ ipkg_message(conf, IPKG_NOTICE, ++ "Not downgrading package %s on %s from %s to %s.\n", ++ old->name, old->dest->name, old_version, new_version); ++ free(old_version); ++ free(new_version); ++ return 0; ++ } else if (cmp < 0) { ++ new->dest = old->dest; ++ old->state_want = SW_DEINSTALL; ++ old->state_flag |= SF_OBSOLETE; ++ } ++ } ++ return pkg_mark_dependencies_for_installation(conf, new, pkgs_needed); ++} ++ ++ ++ ++int satisfy_dependencies_for(ipkg_conf_t *conf, pkg_t *pkg) ++{ ++ int i, err; ++ pkg_vec_t *depends = pkg_vec_alloc(); ++ pkg_t *dep; ++ char **unresolved = NULL; ++ int ndepends; ++ ++ ndepends = pkg_hash_fetch_unsatisfied_dependencies(conf, ++ pkg, depends, ++ &unresolved); ++ ++ if (unresolved) { ++ ipkg_message(conf, IPKG_ERROR, ++ "%s: Cannot satisfy the following dependencies for %s:\n\t", ++ conf->force_depends ? "Warning" : "ERROR", pkg->name); ++ while (*unresolved) { ++ ipkg_message(conf, IPKG_ERROR, " %s", *unresolved); ++ unresolved++; ++ } ++ ipkg_message(conf, IPKG_ERROR, "\n"); ++ if (! conf->force_depends) { ++ ipkg_message(conf, IPKG_INFO, ++ "This could mean that your package list is out of date or that the packages\n" ++ "mentioned above do not yet exist (try 'ipkg update'). To proceed in spite\n" ++ "of this problem try again with the '-force-depends' option.\n"); ++ pkg_vec_free(depends); ++ return IPKG_PKG_DEPS_UNSATISFIED; ++ } ++ } ++ ++ if (ndepends <= 0) { ++ return 0; ++ } ++ ++ /* Mark packages as to-be-installed */ ++ for (i=0; i < depends->len; i++) { ++ /* Dependencies should be installed the same place as pkg */ ++ if (depends->pkgs[i]->dest == NULL) { ++ depends->pkgs[i]->dest = pkg->dest; ++ } ++ depends->pkgs[i]->state_want = SW_INSTALL; ++ } ++ ++ for (i = 0; i < depends->len; i++) { ++ dep = depends->pkgs[i]; ++ /* The package was uninstalled when we started, but another ++ dep earlier in this loop may have depended on it and pulled ++ it in, so check first. */ ++ if ((dep->state_status != SS_INSTALLED) ++ && (dep->state_status != SS_UNPACKED)) { ++ ipkg_message(conf, IPKG_DEBUG2,"Function: %s calling ipkg_install_pkg \n",__FUNCTION__); ++ err = ipkg_install_pkg(conf, dep,0); ++ if (err) { ++ pkg_vec_free(depends); ++ return err; ++ } ++ } ++ } ++ ++ pkg_vec_free(depends); ++ ++ return 0; ++} ++ ++ ++/* check all packages have their dependences satisfied, e.g., in case an upgraded package split */ ++int ipkg_satisfy_all_dependences(ipkg_conf_t *conf) ++{ ++ if (conf->nodeps == 0) { ++ int i; ++ pkg_vec_t *installed = pkg_vec_alloc(); ++ pkg_hash_fetch_all_installed(&conf->pkg_hash, installed); ++ for (i = 0; i < installed->len; i++) { ++ pkg_t *pkg = installed->pkgs[i]; ++ satisfy_dependencies_for(conf, pkg); ++ } ++ pkg_vec_free(installed); ++ } ++ return 0; ++} ++ ++ ++ ++static int check_conflicts_for(ipkg_conf_t *conf, pkg_t *pkg) ++{ ++ int i; ++ pkg_vec_t *conflicts = NULL; ++ int level; ++ const char *prefix; ++ if (conf->force_depends) { ++ level = IPKG_NOTICE; ++ prefix = "Warning"; ++ } else { ++ level = IPKG_ERROR; ++ prefix = "ERROR"; ++ } ++ ++ if (!conf->force_depends) ++ conflicts = (pkg_vec_t *)pkg_hash_fetch_conflicts(&conf->pkg_hash, pkg); ++ ++ if (conflicts) { ++ ipkg_message(conf, level, ++ "%s: The following packages conflict with %s:\n\t", prefix, pkg->name); ++ i = 0; ++ while (i < conflicts->len) ++ ipkg_message(conf, level, " %s", conflicts->pkgs[i++]->name); ++ ipkg_message(conf, level, "\n"); ++ pkg_vec_free(conflicts); ++ return IPKG_PKG_DEPS_UNSATISFIED; ++ } ++ return 0; ++} ++ ++static int update_file_ownership(ipkg_conf_t *conf, pkg_t *new_pkg, pkg_t *old_pkg) ++{ ++ str_list_t *new_list = pkg_get_installed_files(new_pkg); ++ str_list_elt_t *iter; ++ ++ for (iter = new_list->head; iter; iter = iter->next) { ++ char *new_file = iter->data; ++ pkg_t *owner = file_hash_get_file_owner(conf, new_file); ++ if (!new_file) ++ ipkg_message(conf, IPKG_ERROR, "Null new_file for new_pkg=%s\n", new_pkg->name); ++ if (!owner || (owner == old_pkg)) ++ file_hash_set_file_owner(conf, new_file, new_pkg); ++ } ++ if (old_pkg) { ++ str_list_t *old_list = pkg_get_installed_files(old_pkg); ++ for (iter = old_list->head; iter; iter = iter->next) { ++ char *old_file = iter->data; ++ pkg_t *owner = file_hash_get_file_owner(conf, old_file); ++ if (owner == old_pkg) { ++ /* obsolete */ ++ hash_table_insert(&conf->obs_file_hash, old_file, old_pkg); ++ } ++ } ++ } ++ return 0; ++} ++ ++static int verify_pkg_installable(ipkg_conf_t *conf, pkg_t *pkg) ++{ ++ /* XXX: FEATURE: Anything else needed here? Maybe a check on free space? */ ++ ++ /* sma 6.20.02: yup; here's the first bit */ ++ /* ++ * XXX: BUG easy for cworth ++ * 1) please point the call below to the correct current root destination ++ * 2) we need to resolve how to check the required space for a pending pkg, ++ * my diddling with the .ipk file size below isn't going to cut it. ++ * 3) return a proper error code instead of 1 ++ */ ++ int comp_size, blocks_available; ++ ++ if (!conf->force_space && pkg->installed_size != NULL) { ++ blocks_available = get_available_blocks(conf->default_dest->root_dir); ++ ++ comp_size = strtoul(pkg->installed_size, NULL, 0); ++ /* round up a blocks count without doing fancy-but-slow casting jazz */ ++ comp_size = (int)((comp_size + 1023) / 1024); ++ ++ if (comp_size >= blocks_available) { ++ ipkg_message(conf, IPKG_ERROR, ++ "Only have %d available blocks on filesystem %s, pkg %s needs %d\n", ++ blocks_available, conf->default_dest->root_dir, pkg->name, comp_size); ++ return ENOSPC; ++ } ++ } ++ return 0; ++} ++ ++static int unpack_pkg_control_files(ipkg_conf_t *conf, pkg_t *pkg) ++{ ++ int err; ++ char *conffiles_file_name; ++ char *root_dir; ++ FILE *conffiles_file; ++ ++ sprintf_alloc(&pkg->tmp_unpack_dir, "%s/%s-XXXXXX", conf->tmp_dir, pkg->name); ++ ++ pkg->tmp_unpack_dir = mkdtemp(pkg->tmp_unpack_dir); ++ if (pkg->tmp_unpack_dir == NULL) { ++ ipkg_message(conf, IPKG_ERROR, ++ "%s: Failed to create temporary directory '%s': %s\n", ++ __FUNCTION__, pkg->tmp_unpack_dir, strerror(errno)); ++ return errno; ++ } ++ ++ err = pkg_extract_control_files_to_dir(pkg, pkg->tmp_unpack_dir); ++ if (err) { ++ return err; ++ } ++ ++ /* XXX: CLEANUP: There might be a cleaner place to read in the ++ conffiles. Seems like I should be able to get everything to go ++ through pkg_init_from_file. If so, maybe it would make sense to ++ move all of unpack_pkg_control_files to that function. */ ++ ++ /* Don't need to re-read conffiles if we already have it */ ++ if (pkg->conffiles.head) { ++ return 0; ++ } ++ ++ sprintf_alloc(&conffiles_file_name, "%s/conffiles", pkg->tmp_unpack_dir); ++ if (! file_exists(conffiles_file_name)) { ++ free(conffiles_file_name); ++ return 0; ++ } ++ ++ conffiles_file = fopen(conffiles_file_name, "r"); ++ if (conffiles_file == NULL) { ++ fprintf(stderr, "%s: failed to open %s: %s\n", ++ __FUNCTION__, conffiles_file_name, strerror(errno)); ++ free(conffiles_file_name); ++ return errno; ++ } ++ free(conffiles_file_name); ++ ++ while (1) { ++ char *cf_name; ++ char *cf_name_in_dest; ++ ++ cf_name = file_read_line_alloc(conffiles_file); ++ if (cf_name == NULL) { ++ break; ++ } ++ str_chomp(cf_name); ++ if (cf_name[0] == '\0') { ++ continue; ++ } ++ ++ /* Prepend dest->root_dir to conffile name. ++ Take pains to avoid multiple slashes. */ ++ root_dir = pkg->dest->root_dir; ++ if (conf->offline_root) ++ /* skip the offline_root prefix */ ++ root_dir = pkg->dest->root_dir + strlen(conf->offline_root); ++ sprintf_alloc(&cf_name_in_dest, "%s%s", root_dir, ++ cf_name[0] == '/' ? (cf_name + 1) : cf_name); ++ ++ /* Can't get an md5sum now, (file isn't extracted yet). ++ We'll wait until resolve_conffiles */ ++ conffile_list_append(&pkg->conffiles, cf_name_in_dest, NULL); ++ ++ free(cf_name); ++ free(cf_name_in_dest); ++ } ++ ++ fclose(conffiles_file); ++ ++ return 0; ++} ++ ++/* returns number of installed replacees */ ++int pkg_get_installed_replacees(ipkg_conf_t *conf, pkg_t *pkg, pkg_vec_t *installed_replacees) ++{ ++ abstract_pkg_t **replaces = pkg->replaces; ++ int replaces_count = pkg->replaces_count; ++ int i, j; ++ for (i = 0; i < replaces_count; i++) { ++ abstract_pkg_t *ab_pkg = replaces[i]; ++ pkg_vec_t *pkg_vec = ab_pkg->pkgs; ++ if (pkg_vec) { ++ for (j = 0; j < pkg_vec->len; j++) { ++ pkg_t *replacee = pkg_vec->pkgs[j]; ++ if (!pkg_conflicts(pkg, replacee)) ++ continue; ++ if (replacee->state_status == SS_INSTALLED) { ++ pkg_vec_insert(installed_replacees, replacee); ++ } ++ } ++ } ++ } ++ return installed_replacees->len; ++} ++ ++int pkg_remove_installed_replacees(ipkg_conf_t *conf, pkg_vec_t *replacees) ++{ ++ int i; ++ int replaces_count = replacees->len; ++ for (i = 0; i < replaces_count; i++) { ++ pkg_t *replacee = replacees->pkgs[i]; ++ int err; ++ replacee->state_flag |= SF_REPLACE; /* flag it so remove won't complain */ ++ err = ipkg_remove_pkg(conf, replacee,0); ++ if (err) ++ return err; ++ } ++ return 0; ++} ++ ++/* to unwind the removal: make sure they are installed */ ++int pkg_remove_installed_replacees_unwind(ipkg_conf_t *conf, pkg_vec_t *replacees) ++{ ++ int i, err; ++ int replaces_count = replacees->len; ++ for (i = 0; i < replaces_count; i++) { ++ pkg_t *replacee = replacees->pkgs[i]; ++ if (replacee->state_status != SS_INSTALLED) { ++ ipkg_message(conf, IPKG_DEBUG2,"Function: %s calling ipkg_install_pkg \n",__FUNCTION__); ++ err = ipkg_install_pkg(conf, replacee,0); ++ if (err) ++ return err; ++ } ++ } ++ return 0; ++} ++ ++int caught_sigint = 0; ++static void ipkg_install_pkg_sigint_handler(int sig) ++{ ++ caught_sigint = sig; ++} ++ ++/* compares versions of pkg and old_pkg, returns 0 if OK to proceed with installation of pkg, 1 otherwise */ ++static int ipkg_install_check_downgrade(ipkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg, int message) ++{ ++ if (old_pkg) { ++ char message_out[15]; ++ char *old_version = pkg_version_str_alloc(old_pkg); ++ char *new_version = pkg_version_str_alloc(pkg); ++ int cmp = pkg_compare_versions(old_pkg, pkg); ++ int rc = 0; ++ ++ memset(message_out,'\x0',15); ++ strncpy (message_out,"Upgrading ",strlen("Upgrading ")); ++ if ( (conf->force_downgrade==1) && (cmp > 0) ){ /* We've been asked to allow downgrade and version is precedent */ ++ cmp = -1 ; /* then we force ipkg to downgrade */ ++ strncpy (message_out,"Downgrading ",strlen("Downgrading ")); /* We need to use a value < 0 because in the 0 case we are asking to */ ++ /* reinstall, and some check could fail asking the "force-reinstall" option */ ++ } ++ ++ if (cmp > 0) { ++ ipkg_message(conf, IPKG_NOTICE, ++ "Not downgrading package %s on %s from %s to %s.\n", ++ old_pkg->name, old_pkg->dest->name, old_version, new_version); ++ rc = 1; ++ } else if (cmp < 0) { ++ ipkg_message(conf, IPKG_NOTICE, ++ "%s%s on %s from %s to %s...\n", ++ message_out, pkg->name, old_pkg->dest->name, old_version, new_version); ++ pkg->dest = old_pkg->dest; ++ rc = 0; ++ } else /* cmp == 0 */ { ++ if (conf->force_reinstall) { ++ ipkg_message(conf, IPKG_NOTICE, ++ "Reinstalling %s (%s) on %s...\n", ++ pkg->name, new_version, old_pkg->dest->name); ++ pkg->dest = old_pkg->dest; ++ rc = 0; ++ } else { ++ ipkg_message(conf, IPKG_NOTICE, ++ "Not installing %s (%s) on %s -- already installed.\n", ++ pkg->name, new_version, old_pkg->dest->name); ++ rc = 1; ++ } ++ } ++ free(old_version); ++ free(new_version); ++ return rc; ++ } else { ++ char message_out[15] ; ++ memset(message_out,'\x0',15); ++ if ( message ) ++ strncpy( message_out,"Upgrading ",strlen("Upgrading ") ); ++ else ++ strncpy( message_out,"Installing ",strlen("Installing ") ); ++ char *version = pkg_version_str_alloc(pkg); ++ ++ ipkg_message(conf, IPKG_NOTICE, ++ "%s%s (%s) to %s...\n", message_out, ++ pkg->name, version, pkg->dest->name); ++ free(version); ++ return 0; ++ } ++} ++ ++/* and now the meat... */ ++int ipkg_install_pkg(ipkg_conf_t *conf, pkg_t *pkg, int from_upgrade) ++{ ++ int err = 0; ++ int message = 0; ++ pkg_t *old_pkg = NULL; ++ pkg_vec_t *replacees; ++ abstract_pkg_t *ab_pkg = NULL; ++ int old_state_flag; ++ char* file_md5; ++ ++ ++ if ( from_upgrade ) ++ message = 1; /* Coming from an upgrade, and should change the output message */ ++ ++ if (!pkg) { ++ ipkg_message(conf, IPKG_ERROR, ++ "INTERNAL ERROR: null pkg passed to ipkg_install_pkg\n"); ++ return -EINVAL; ++ } ++ ++ ipkg_message(conf, IPKG_DEBUG2, "Function: %s calling pkg_arch_supported %s \n", __FUNCTION__, __FUNCTION__); ++ ++ if (!pkg_arch_supported(conf, pkg)) { ++ ipkg_message(conf, IPKG_ERROR, "INTERNAL ERROR: architecture %s for pkg %s is unsupported.\n", ++ pkg->architecture, pkg->name); ++ return -EINVAL; ++ } ++ if (pkg->state_status == SS_INSTALLED && conf->force_reinstall == 0 && conf->nodeps == 0) { ++ err = satisfy_dependencies_for(conf, pkg); ++ if (err) { return err; } ++ ++ ipkg_message(conf, IPKG_NOTICE, ++ "Package %s is already installed in %s.\n", ++ pkg->name, pkg->dest->name); ++ return 0; ++ } ++ ++ if (pkg->dest == NULL) { ++ pkg->dest = conf->default_dest; ++ } ++ ++ old_pkg = pkg_hash_fetch_installed_by_name(&conf->pkg_hash, pkg->name); ++ ++ err = ipkg_install_check_downgrade(conf, pkg, old_pkg, message); ++ if (err) { return err; } ++ ++ pkg->state_want = SW_INSTALL; ++ if (old_pkg){ ++ old_pkg->state_want = SW_DEINSTALL; /* needed for check_data_file_clashes of dependences */ ++ } ++ ++ ++ /* Abhaya: conflicts check */ ++ err = check_conflicts_for(conf, pkg); ++ if (err) { return err; } ++ ++ /* this setup is to remove the upgrade scenario in the end when ++ installing pkg A, A deps B & B deps on A. So both B and A are ++ installed. Then A's installation is started resulting in an ++ uncecessary upgrade */ ++ if (pkg->state_status == SS_INSTALLED ++ && conf->force_reinstall == 0) return 0; ++ ++ err = verify_pkg_installable(conf, pkg); ++ if (err) { return err; } ++ ++ if (pkg->local_filename == NULL) { ++ err = ipkg_download_pkg(conf, pkg, conf->tmp_dir); ++ if (err) { ++ ipkg_message(conf, IPKG_ERROR, ++ "Failed to download %s. Perhaps you need to run 'ipkg update'?\n", ++ pkg->name); ++ return err; ++ } ++ } ++ ++/* Check for md5 values */ ++ if (pkg->md5sum) ++ { ++ file_md5 = file_md5sum_alloc(pkg->local_filename); ++ if (strcmp(file_md5, pkg->md5sum)) ++ { ++ ipkg_message(conf, IPKG_ERROR, ++ "Package %s md5sum mismatch. Either the ipkg or the package index are corrupt. Try 'ipkg update'.\n", ++ pkg->name); ++ free(file_md5); ++ return err; ++ } ++ free(file_md5); ++ } ++ ++ if (pkg->tmp_unpack_dir == NULL) { ++ unpack_pkg_control_files(conf, pkg); ++ } ++ ++ /* We should update the filelist here, so that upgrades of packages that split will not fail. -Jamey 27-MAR-03 */ ++/* Pigi: check if it will pass from here when replacing. It seems to fail */ ++/* That's rather strange that files don't change owner. Investigate !!!!!!*/ ++ err = update_file_ownership(conf, pkg, old_pkg); ++ if (err) { return err; } ++ ++ if (conf->nodeps == 0) { ++ err = satisfy_dependencies_for(conf, pkg); ++ if (err) { return err; } ++ } ++ ++ replacees = pkg_vec_alloc(); ++ pkg_get_installed_replacees(conf, pkg, replacees); ++ ++ /* this next section we do with SIGINT blocked to prevent inconsistency between ipkg database and filesystem */ ++ { ++ sigset_t newset, oldset; ++ sighandler_t old_handler = NULL; ++ int use_signal = 0; ++ caught_sigint = 0; ++ if (use_signal) { ++ old_handler = signal(SIGINT, ipkg_install_pkg_sigint_handler); ++ } else { ++ sigemptyset(&newset); ++ sigaddset(&newset, SIGINT); ++ sigprocmask(SIG_BLOCK, &newset, &oldset); ++ } ++ ++ ipkg_state_changed++; ++ pkg->state_flag |= SF_FILELIST_CHANGED; ++ ++ /* XXX: BUG: we really should treat replacement more like an upgrade ++ * Instead, we're going to remove the replacees ++ */ ++ err = pkg_remove_installed_replacees(conf, replacees); ++ if (err) goto UNWIND_REMOVE_INSTALLED_REPLACEES; ++ ++ err = prerm_upgrade_old_pkg(conf, pkg, old_pkg); ++ if (err) goto UNWIND_PRERM_UPGRADE_OLD_PKG; ++ ++ err = prerm_deconfigure_conflictors(conf, pkg, replacees); ++ if (err) goto UNWIND_PRERM_DECONFIGURE_CONFLICTORS; ++ ++ err = preinst_configure(conf, pkg, old_pkg); ++ if (err) goto UNWIND_PREINST_CONFIGURE; ++ ++ err = backup_modified_conffiles(conf, pkg, old_pkg); ++ if (err) goto UNWIND_BACKUP_MODIFIED_CONFFILES; ++ ++ err = check_data_file_clashes(conf, pkg, old_pkg); ++ if (err) goto UNWIND_CHECK_DATA_FILE_CLASHES; ++ ++ err = postrm_upgrade_old_pkg(conf, pkg, old_pkg); ++ if (err) goto UNWIND_POSTRM_UPGRADE_OLD_PKG; ++ ++ if (conf->noaction) return 0; ++ ++ /* point of no return: no unwinding after this */ ++ if (old_pkg && !conf->force_reinstall) { ++ old_pkg->state_want = SW_DEINSTALL; ++ ++ if (old_pkg->state_flag & SF_NOPRUNE) { ++ ipkg_message(conf, IPKG_INFO, ++ " not removing obsolesced files because package marked noprune\n"); ++ } else { ++ ipkg_message(conf, IPKG_INFO, ++ " removing obsolesced files\n"); ++ remove_obsolesced_files(conf, pkg, old_pkg); ++ } ++ /* removing files from old package, to avoid ghost files */ ++ remove_data_files_and_list(conf, old_pkg); ++/* Pigi : It should be better to remove also maintainer and postrem scripts here, just in case*/ ++ remove_maintainer_scripts_except_postrm(conf, old_pkg); ++ remove_postrm(conf, old_pkg); ++/* Pigi */ ++ ++ } ++ ++ ++ ipkg_message(conf, IPKG_INFO, ++ " installing maintainer scripts\n"); ++ install_maintainer_scripts(conf, pkg, old_pkg); ++ ++ /* the following just returns 0 */ ++ remove_disappeared(conf, pkg); ++ ++ ipkg_message(conf, IPKG_INFO, ++ " installing data files\n"); ++ install_data_files(conf, pkg); ++ ++/* read comments from function for detail but I will execute this here as all other tests are ok.*/ ++ err = check_data_file_clashes_change(conf, pkg, old_pkg); ++ ++ ipkg_message(conf, IPKG_INFO, ++ " resolving conf files\n"); ++ resolve_conffiles(conf, pkg); ++ ++ pkg->state_status = SS_UNPACKED; ++ old_state_flag = pkg->state_flag; ++ pkg->state_flag &= ~SF_PREFER; ++ ipkg_message(conf, IPKG_DEBUG, " pkg=%s old_state_flag=%x state_flag=%x\n", pkg->name, old_state_flag, pkg->state_flag); ++ ++ if (old_pkg && !conf->force_reinstall) { ++ old_pkg->state_status = SS_NOT_INSTALLED; ++ } ++ ++ time(&pkg->installed_time); ++ ++ ipkg_message(conf, IPKG_INFO, ++ " cleanup temp files\n"); ++ cleanup_temporary_files(conf, pkg); ++ ++ ab_pkg = pkg->parent; ++ if (ab_pkg) ++ ab_pkg->state_status = pkg->state_status; ++ ++ ipkg_message(conf, IPKG_INFO, "Done.\n"); ++ ++ if (use_signal) ++ signal(SIGINT, old_handler); ++ else ++ sigprocmask(SIG_UNBLOCK, &newset, &oldset); ++ ++ return 0; ++ ++ ++ UNWIND_POSTRM_UPGRADE_OLD_PKG: ++ postrm_upgrade_old_pkg_unwind(conf, pkg, old_pkg); ++ UNWIND_CHECK_DATA_FILE_CLASHES: ++ check_data_file_clashes_unwind(conf, pkg, old_pkg); ++ UNWIND_BACKUP_MODIFIED_CONFFILES: ++ backup_modified_conffiles_unwind(conf, pkg, old_pkg); ++ UNWIND_PREINST_CONFIGURE: ++ preinst_configure_unwind(conf, pkg, old_pkg); ++ UNWIND_PRERM_DECONFIGURE_CONFLICTORS: ++ prerm_deconfigure_conflictors_unwind(conf, pkg, replacees); ++ UNWIND_PRERM_UPGRADE_OLD_PKG: ++ prerm_upgrade_old_pkg_unwind(conf, pkg, old_pkg); ++ UNWIND_REMOVE_INSTALLED_REPLACEES: ++ pkg_remove_installed_replacees_unwind(conf, replacees); ++ ++ ipkg_message(conf, IPKG_INFO, ++ " cleanup temp files\n"); ++ cleanup_temporary_files(conf, pkg); ++ ++ ipkg_message(conf, IPKG_INFO, ++ "Failed.\n"); ++ if (use_signal) ++ signal(SIGINT, old_handler); ++ else ++ sigprocmask(SIG_UNBLOCK, &newset, &oldset); ++ ++ return err; ++ } ++} ++ ++static int prerm_upgrade_old_pkg(ipkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg) ++{ ++ /* DPKG_INCOMPATIBILITY: ++ dpkg does some things here that we don't do yet. Do we care? ++ ++ 1. If a version of the package is already installed, call ++ old-prerm upgrade new-version ++ 2. If the script runs but exits with a non-zero exit status ++ new-prerm failed-upgrade old-version ++ Error unwind, for both the above cases: ++ old-postinst abort-upgrade new-version ++ */ ++ return 0; ++} ++ ++static int prerm_upgrade_old_pkg_unwind(ipkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg) ++{ ++ /* DPKG_INCOMPATIBILITY: ++ dpkg does some things here that we don't do yet. Do we care? ++ (See prerm_upgrade_old_package for details) ++ */ ++ return 0; ++} ++ ++static int prerm_deconfigure_conflictors(ipkg_conf_t *conf, pkg_t *pkg, pkg_vec_t *conflictors) ++{ ++ /* DPKG_INCOMPATIBILITY: ++ dpkg does some things here that we don't do yet. Do we care? ++ 2. If a 'conflicting' package is being removed at the same time: ++ 1. If any packages depended on that conflicting package and ++ --auto-deconfigure is specified, call, for each such package: ++ deconfigured's-prerm deconfigure \ ++ in-favour package-being-installed version \ ++ removing conflicting-package version ++ Error unwind: ++ deconfigured's-postinst abort-deconfigure \ ++ in-favour package-being-installed-but-failed version \ ++ removing conflicting-package version ++ ++ The deconfigured packages are marked as requiring ++ configuration, so that if --install is used they will be ++ configured again if possible. ++ 2. To prepare for removal of the conflicting package, call: ++ conflictor's-prerm remove in-favour package new-version ++ Error unwind: ++ conflictor's-postinst abort-remove in-favour package new-version ++ */ ++ return 0; ++} ++ ++static int prerm_deconfigure_conflictors_unwind(ipkg_conf_t *conf, pkg_t *pkg, pkg_vec_t *conflictors) ++{ ++ /* DPKG_INCOMPATIBILITY: dpkg does some things here that we don't ++ do yet. Do we care? (See prerm_deconfigure_conflictors for ++ details) */ ++ return 0; ++} ++ ++static int preinst_configure(ipkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg) ++{ ++ int err; ++ char *preinst_args; ++ ++ if (old_pkg) { ++ char *old_version = pkg_version_str_alloc(old_pkg); ++ sprintf_alloc(&preinst_args, "upgrade %s", old_version); ++ free(old_version); ++ } else if (pkg->state_status == SS_CONFIG_FILES) { ++ char *pkg_version = pkg_version_str_alloc(pkg); ++ sprintf_alloc(&preinst_args, "install %s", pkg_version); ++ free(pkg_version); ++ } else { ++ preinst_args = strdup("install"); ++ } ++ ++ err = pkg_run_script(conf, pkg, "preinst", preinst_args); ++ if (err) { ++ ipkg_message(conf, IPKG_ERROR, ++ "Aborting installation of %s\n", pkg->name); ++ return 1; ++ } ++ ++ free(preinst_args); ++ ++ return 0; ++} ++ ++static int preinst_configure_unwind(ipkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg) ++{ ++ /* DPKG_INCOMPATIBILITY: ++ dpkg does the following error unwind, should we? ++ pkg->postrm abort-upgrade old-version ++ OR pkg->postrm abort-install old-version ++ OR pkg->postrm abort-install ++ */ ++ return 0; ++} ++ ++static int backup_modified_conffiles(ipkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg) ++{ ++ int err; ++ conffile_list_elt_t *iter; ++ conffile_t *cf; ++ ++ if (conf->noaction) return 0; ++ ++ /* Backup all modified conffiles */ ++ if (old_pkg) { ++ for (iter = old_pkg->conffiles.head; iter; iter = iter->next) { ++ char *cf_name; ++ ++ cf = iter->data; ++ cf_name = root_filename_alloc(conf, cf->name); ++ ++ /* Don't worry if the conffile is just plain gone */ ++ if (file_exists(cf_name) && conffile_has_been_modified(conf, cf)) { ++ err = backup_make_backup(conf, cf_name); ++ if (err) { ++ return err; ++ } ++ } ++ free(cf_name); ++ } ++ } ++ ++ /* Backup all conffiles that were not conffiles in old_pkg */ ++ for (iter = pkg->conffiles.head; iter; iter = iter->next) { ++ char *cf_name; ++ cf = iter->data; ++ cf_name = root_filename_alloc(conf, cf->name); ++ /* Ignore if this was a conffile in old_pkg as well */ ++ if (pkg_get_conffile(old_pkg, cf->name)) { ++ continue; ++ } ++ ++ if (file_exists(cf_name) && (! backup_exists_for(cf_name))) { ++ err = backup_make_backup(conf, cf_name); ++ if (err) { ++ return err; ++ } ++ } ++ free(cf_name); ++ } ++ ++ return 0; ++} ++ ++static int backup_modified_conffiles_unwind(ipkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg) ++{ ++ conffile_list_elt_t *iter; ++ ++ if (old_pkg) { ++ for (iter = old_pkg->conffiles.head; iter; iter = iter->next) { ++ backup_remove(iter->data->name); ++ } ++ } ++ ++ for (iter = pkg->conffiles.head; iter; iter = iter->next) { ++ backup_remove(iter->data->name); ++ } ++ ++ return 0; ++} ++ ++ ++static int check_data_file_clashes(ipkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg) ++{ ++ /* DPKG_INCOMPATIBILITY: ++ ipkg takes a slightly different approach than dpkg at this ++ point. dpkg installs each file in the new package while ++ creating a backup for any file that is replaced, (so that it ++ can unwind if necessary). To avoid complexity and redundant ++ storage, ipkg doesn't do any installation until later, (at the ++ point at which dpkg removes the backups. ++ ++ But, we do have to check for data file clashes, since after ++ installing a package with a file clash, removing either of the ++ packages involved in the clash has the potential to break the ++ other package. ++ */ ++ str_list_t *files_list; ++ str_list_elt_t *iter; ++ ++ int clashes = 0; ++ ++ files_list = pkg_get_installed_files(pkg); ++ for (iter = files_list->head; iter; iter = iter->next) { ++ char *root_filename; ++ char *filename = iter->data; ++ root_filename = root_filename_alloc(conf, filename); ++ if (file_exists(root_filename) && (! file_is_dir(root_filename))) { ++ pkg_t *owner; ++ pkg_t *obs; ++ /* Pre-existing conffiles are OK */ ++ /* @@@@ should have way to check that it is a conffile -Jamey */ ++ if (backup_exists_for(root_filename)) { ++ continue; ++ } ++ ++ /* Pre-existing files are OK if force-overwrite was asserted. */ ++ if (conf->force_overwrite) { ++ /* but we need to change who owns this file */ ++ file_hash_set_file_owner(conf, filename, pkg); ++ continue; ++ } ++ ++ owner = file_hash_get_file_owner(conf, filename); ++ ++ /* Pre-existing files are OK if owned by the pkg being upgraded. */ ++ if (owner && old_pkg) { ++ if (strcmp(owner->name, old_pkg->name) == 0) { ++ continue; ++ } ++ } ++ ++ /* Pre-existing files are OK if owned by a package replaced by new pkg. */ ++ if (owner) { ++ ipkg_message(conf, IPKG_DEBUG2, "Checking for replaces for %s in package %s\n", filename, owner->name); ++ if (pkg_replaces(pkg, owner)) { ++ continue; ++ } ++/* If the file that would be installed is owned by the same package, ( as per a reinstall or similar ) ++ then it's ok to overwrite. */ ++ if (strcmp(owner->name,pkg->name)==0){ ++ ipkg_message(conf, IPKG_INFO, "Replacing pre-existing file %s owned by package %s\n", filename, owner->name); ++ continue; ++ } ++ } ++ ++ /* Pre-existing files are OK if they are obsolete */ ++ obs = hash_table_get(&conf->obs_file_hash, filename); ++ if (obs) { ++ ipkg_message(conf, IPKG_INFO, "Pre-exiting file %s is obsolete. obs_pkg=%s\n", filename, obs->name); ++ continue; ++ } ++ ++ /* We have found a clash. */ ++ ipkg_message(conf, IPKG_ERROR, ++ "Package %s wants to install file %s\n" ++ "\tBut that file is already provided by package ", ++ pkg->name, filename); ++ if (owner) { ++ ipkg_message(conf, IPKG_ERROR, ++ "%s\n", owner->name); ++ } else { ++ ipkg_message(conf, IPKG_ERROR, ++ "<no package>\nPlease move this file out of the way and try again.\n"); ++ } ++ clashes++; ++ } ++ free(root_filename); ++ } ++ pkg_free_installed_files(pkg); ++ ++ return clashes; ++} ++ ++static int check_data_file_clashes_change(ipkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg) ++{ ++ /* Basically that's the worst hack I could do to be able to change ownership of ++ file list, but, being that we have no way to unwind the mods, due to structure ++ of hash table, probably is the quickest hack too, whishing it would not slow-up thing too much. ++ What we do here is change the ownership of file in hash if a replace ( or similar events ++ happens ) ++ Only the action that are needed to change name should be considered. ++ @@@ To change after 1.0 release. ++ */ ++ str_list_t *files_list; ++ str_list_elt_t *iter; ++ ++ int clashes = 0; ++ ++ files_list = pkg_get_installed_files(pkg); ++ for (iter = files_list->head; iter; iter = iter->next) { ++ char *root_filename; ++ char *filename = iter->data; ++ root_filename = root_filename_alloc(conf, filename); ++ if (file_exists(root_filename) && (! file_is_dir(root_filename))) { ++ pkg_t *owner; ++ ++ if (conf->force_overwrite) { ++ /* but we need to change who owns this file */ ++ file_hash_set_file_owner(conf, filename, pkg); ++ continue; ++ } ++ ++ owner = file_hash_get_file_owner(conf, filename); ++ ++ /* Pre-existing files are OK if owned by a package replaced by new pkg. */ ++ if (owner) { ++ if (pkg_replaces(pkg, owner)) { ++/* It's now time to change the owner of that file. ++ It has been "replaced" from the new "Replaces", then I need to inform lists file about that. */ ++ ipkg_message(conf, IPKG_INFO, "Replacing pre-existing file %s owned by package %s\n", filename, owner->name); ++ file_hash_set_file_owner(conf, filename, pkg); ++ continue; ++ } ++ } ++ ++ } ++ free(root_filename); ++ } ++ pkg_free_installed_files(pkg); ++ ++ return clashes; ++} ++ ++static int check_data_file_clashes_unwind(ipkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg) ++{ ++ /* Nothing to do since check_data_file_clashes doesn't change state */ ++ return 0; ++} ++ ++static int postrm_upgrade_old_pkg(ipkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg) ++{ ++ /* DPKG_INCOMPATIBILITY: dpkg does the following here, should we? ++ 1. If the package is being upgraded, call ++ old-postrm upgrade new-version ++ 2. If this fails, attempt: ++ new-postrm failed-upgrade old-version ++ Error unwind, for both cases: ++ old-preinst abort-upgrade new-version */ ++ return 0; ++} ++ ++static int postrm_upgrade_old_pkg_unwind(ipkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg) ++{ ++ /* DPKG_INCOMPATIBILITY: ++ dpkg does some things here that we don't do yet. Do we care? ++ (See postrm_upgrade_old_pkg for details) ++ */ ++ return 0; ++} ++ ++static int remove_obsolesced_files(ipkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg) ++{ ++ int err; ++ str_list_t *old_files; ++ str_list_elt_t *of; ++ str_list_t *new_files; ++ str_list_elt_t *nf; ++ ++ if (old_pkg == NULL) { ++ return 0; ++ } ++ ++ old_files = pkg_get_installed_files(old_pkg); ++ new_files = pkg_get_installed_files(pkg); ++ ++ for (of = old_files->head; of; of = of->next) { ++ pkg_t *owner; ++ char *old, *new; ++ old = of->data; ++ for (nf = new_files->head; nf; nf = nf->next) { ++ new = nf->data; ++ if (strcmp(old, new) == 0) { ++ goto NOT_OBSOLETE; ++ } ++ } ++ if (file_is_dir(old)) { ++ continue; ++ } ++ owner = file_hash_get_file_owner(conf, old); ++ if (owner != old_pkg) { ++ /* in case obsolete file no longer belongs to old_pkg */ ++ continue; ++ } ++ ++ /* old file is obsolete */ ++ ipkg_message(conf, IPKG_INFO, ++ " removing obsolete file %s\n", old); ++ if (!conf->noaction) { ++ err = unlink(old); ++ if (err) { ++ ipkg_message(conf, IPKG_ERROR, " Warning: remove %s failed: %s\n", old, ++ strerror(errno)); ++ } ++ } ++ ++ NOT_OBSOLETE: ++ ; ++ } ++ ++ pkg_free_installed_files(old_pkg); ++ pkg_free_installed_files(pkg); ++ ++ return 0; ++} ++ ++static int remove_obsolete_maintainer_scripts(ipkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg) ++{ ++ int i; ++ int err = 0; ++ char *globpattern; ++ glob_t globbuf; ++ if (0) { ++ if (!pkg->dest) { ++ ipkg_message(conf, IPKG_ERROR, "%s: no dest for package %s\n", __FUNCTION__, pkg->name); ++ return -1; ++ } ++ sprintf_alloc(&globpattern, "%s/%s.*", pkg->dest->info_dir, pkg->name); ++ err = glob(globpattern, 0, NULL, &globbuf); ++ free(globpattern); ++ if (err) { ++ return err; ++ } ++ /* XXXX this should perhaps only remove the ones that are not overwritten in new package. Jamey 11/11/2003 */ ++ for (i = 0; i < globbuf.gl_pathc; i++) { ++ ipkg_message(conf, IPKG_DEBUG, "Removing control file %s from old_pkg %s\n", ++ globbuf.gl_pathv[i], old_pkg->name); ++ if (!conf->noaction) ++ unlink(globbuf.gl_pathv[i]); ++ } ++ globfree(&globbuf); ++ } ++ return err; ++} ++ ++static int install_maintainer_scripts(ipkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg) ++{ ++ int ret; ++ char *prefix; ++ ++ if (old_pkg) ++ remove_obsolete_maintainer_scripts(conf, pkg, old_pkg); ++ sprintf_alloc(&prefix, "%s.", pkg->name); ++ ret = pkg_extract_control_files_to_dir_with_prefix(pkg, ++ pkg->dest->info_dir, ++ prefix); ++ free(prefix); ++ return ret; ++} ++ ++static int remove_disappeared(ipkg_conf_t *conf, pkg_t *pkg) ++{ ++ /* DPKG_INCOMPATIBILITY: ++ This is a fairly sophisticated dpkg operation. Shall we ++ skip it? */ ++ ++ /* Any packages all of whose files have been overwritten during the ++ installation, and which aren't required for dependencies, are ++ considered to have been removed. For each such package ++ 1. disappearer's-postrm disappear overwriter overwriter-version ++ 2. The package's maintainer scripts are removed ++ 3. It is noted in the status database as being in a sane state, ++ namely not installed (any conffiles it may have are ignored, ++ rather than being removed by dpkg). Note that disappearing ++ packages do not have their prerm called, because dpkg doesn't ++ know in advance that the package is going to vanish. ++ */ ++ return 0; ++} ++ ++static int install_data_files(ipkg_conf_t *conf, pkg_t *pkg) ++{ ++ int err; ++ ++ /* ipkg takes a slightly different approach to data file backups ++ than dpkg. Rather than removing backups at this point, we ++ actually do the data file installation now. See comments in ++ check_data_file_clashes() for more details. */ ++ ++ ipkg_message(conf, IPKG_INFO, ++ " extracting data files to %s\n", pkg->dest->root_dir); ++ err = pkg_extract_data_files_to_dir(pkg, pkg->dest->root_dir); ++ if (err) { ++ return err; ++ } ++ ++ /* XXX: BUG or FEATURE : We are actually loosing the Essential flag, ++ so we can't save ourself from removing important packages ++ At this point we (should) have extracted the .control file, so it ++ would be a good idea to reload the data in it, and set the Essential ++ state in *pkg. From now on the Essential is back in status file and ++ we can protect again. ++ We should operate this way: ++ fopen the file ( pkg->dest->root_dir/pkg->name.control ) ++ check for "Essential" in it ++ set the value in pkg->essential. ++ This new routine could be useful also for every other flag ++ Pigi: 16/03/2004 */ ++ set_flags_from_control(conf, pkg) ; ++ ++ ipkg_message(conf, IPKG_DEBUG, " Calling pkg_write_filelist from %s\n", __FUNCTION__); ++ err = pkg_write_filelist(conf, pkg); ++ if (err) ++ return err; ++ ++ /* XXX: FEATURE: ipkg should identify any files which existed ++ before installation and which were overwritten, (see ++ check_data_file_clashes()). What it must do is remove any such ++ files from the filelist of the old package which provided the ++ file. Otherwise, if the old package were removed at some point ++ it would break the new package. Removing the new package will ++ also break the old one, but this cannot be helped since the old ++ package's file has already been deleted. This is the importance ++ of check_data_file_clashes(), and only allowing ipkg to install ++ a clashing package with a user force. */ ++ ++ return 0; ++} ++ ++static int resolve_conffiles(ipkg_conf_t *conf, pkg_t *pkg) ++{ ++ conffile_list_elt_t *iter; ++ conffile_t *cf; ++ char *cf_backup; ++ ++ char *md5sum; ++ ++ ++ if (conf->noaction) return 0; ++ ++ for (iter = pkg->conffiles.head; iter; iter = iter->next) { ++ char *root_filename; ++ cf = iter->data; ++ root_filename = root_filename_alloc(conf, cf->name); ++ ++ /* Might need to initialize the md5sum for each conffile */ ++ if (cf->value == NULL) { ++ cf->value = file_md5sum_alloc(root_filename); ++ } ++ ++ if (!file_exists(root_filename)) { ++ free(root_filename); ++ continue; ++ } ++ ++ cf_backup = backup_filename_alloc(root_filename); ++ ++ ++ if (file_exists(cf_backup)) { ++ /* Let's compute md5 to test if files are changed */ ++ md5sum = file_md5sum_alloc(cf_backup); ++ if (strcmp( cf->value,md5sum) != 0 ) { ++ if (conf->force_defaults ++ || user_prefers_old_conffile(cf->name, cf_backup) ) { ++ rename(cf_backup, root_filename); ++ } ++ } ++ unlink(cf_backup); ++ free(md5sum); ++ } ++ ++ free(cf_backup); ++ free(root_filename); ++ } ++ ++ return 0; ++} ++ ++static int user_prefers_old_conffile(const char *file_name, const char *backup) ++{ ++ char *response; ++ const char *short_file_name; ++ ++ short_file_name = strrchr(file_name, '/'); ++ if (short_file_name) { ++ short_file_name++; ++ } else { ++ short_file_name = file_name; ++ } ++ ++ while (1) { ++ response = get_user_response(" Configuration file '%s'\n" ++ " ==> File on system created by you or by a script.\n" ++ " ==> File also in package provided by package maintainer.\n" ++ " What would you like to do about it ? Your options are:\n" ++ " Y or I : install the package maintainer's version\n" ++ " N or O : keep your currently-installed version\n" ++ " D : show the differences between the versions (if diff is installed)\n" ++ " The default action is to keep your current version.\n" ++ " *** %s (Y/I/N/O/D) [default=N] ? ", file_name, short_file_name); ++ if (strcmp(response, "y") == 0 ++ || strcmp(response, "i") == 0 ++ || strcmp(response, "yes") == 0) { ++ free(response); ++ return 0; ++ } ++ ++ if (strcmp(response, "d") == 0) { ++ char *cmd; ++ ++ free(response); ++ /* XXX: BUG rewrite to use exec or busybox's internal diff */ ++ sprintf_alloc(&cmd, "diff -u %s %s", backup, file_name); ++ xsystem(cmd); ++ free(cmd); ++ printf(" [Press ENTER to continue]\n"); ++ response = file_read_line_alloc(stdin); ++ free(response); ++ continue; ++ } ++ ++ free(response); ++ return 1; ++ } ++} ++ ++/* XXX: CLEANUP: I'd like to move all of the code for ++ creating/cleaning pkg->tmp_unpack_dir directly into pkg.c. (Then, ++ it would make sense to cleanup pkg->tmp_unpack_dir directly from ++ pkg_deinit for example). */ ++static int cleanup_temporary_files(ipkg_conf_t *conf, pkg_t *pkg) ++{ ++ DIR *tmp_dir; ++ struct dirent *dirent; ++ char *tmp_file; ++ ++#ifdef IPKG_DEBUG_NO_TMP_CLEANUP ++#error ++ ipkg_message(conf, IPKG_DEBUG, ++ "%s: Not cleaning up %s since ipkg compiled with IPKG_DEBUG_NO_TMP_CLEANUP\n", ++ __FUNCTION__, pkg->tmp_unpack_dir); ++ return 0; ++#endif ++ ++ if (pkg->tmp_unpack_dir && file_is_dir(pkg->tmp_unpack_dir)) { ++ tmp_dir = opendir(pkg->tmp_unpack_dir); ++ if (tmp_dir) { ++ while (1) { ++ dirent = readdir(tmp_dir); ++ if (dirent == NULL) { ++ break; ++ } ++ sprintf_alloc(&tmp_file, "%s/%s", ++ pkg->tmp_unpack_dir, dirent->d_name); ++ if (! file_is_dir(tmp_file)) { ++ unlink(tmp_file); ++ } ++ free(tmp_file); ++ } ++ closedir(tmp_dir); ++ rmdir(pkg->tmp_unpack_dir); ++ free(pkg->tmp_unpack_dir); ++ pkg->tmp_unpack_dir = NULL; ++ } ++ } ++ ++ ipkg_message(conf, IPKG_INFO, "cleanup_temporary_files: pkg=%s local_filename=%s tmp_dir=%s\n", ++ pkg->name, pkg->local_filename, conf->tmp_dir); ++ if (pkg->local_filename && strncmp(pkg->local_filename, conf->tmp_dir, strlen(conf->tmp_dir)) == 0) { ++ unlink(pkg->local_filename); ++ free(pkg->local_filename); ++ pkg->local_filename = NULL; ++ } ++ ++ return 0; ++} ++ ++static char *backup_filename_alloc(const char *file_name) ++{ ++ char *backup; ++ ++ sprintf_alloc(&backup, "%s%s", file_name, IPKG_BACKUP_SUFFIX); ++ ++ return backup; ++} ++ ++int backup_make_backup(ipkg_conf_t *conf, const char *file_name) ++{ ++ int err; ++ char *backup; ++ ++ backup = backup_filename_alloc(file_name); ++ err = file_copy(file_name, backup); ++ if (err) { ++ ipkg_message(conf, IPKG_ERROR, ++ "%s: Failed to copy %s to %s\n", ++ __FUNCTION__, file_name, backup); ++ } ++ ++ free(backup); ++ ++ return err; ++} ++ ++static int backup_exists_for(const char *file_name) ++{ ++ int ret; ++ char *backup; ++ ++ backup = backup_filename_alloc(file_name); ++ ++ ret = file_exists(backup); ++ ++ free(backup); ++ ++ return ret; ++} ++ ++static int backup_remove(const char *file_name) ++{ ++ char *backup; ++ ++ backup = backup_filename_alloc(file_name); ++ unlink(backup); ++ free(backup); ++ ++ return 0; ++} ++ ++ ++ ++#ifdef CONFIG_IPKG_PROCESS_ACTIONS ++ ++int ipkg_remove_packages(ipkg_conf_t *conf, pkg_vec_t *pkgs_to_remove) ++{ ++ /* first, remove the packages that need removing */ ++ for (i = 0 ; i < pkgs_to_remove->len; i++ ) { ++ pkg_t *pkg = pkgs_to_remove->pkgs[i]; ++ err = ipkg_remove_pkg(conf, pkg,0); ++ if (err) return err; ++ } ++ return 0; ++} ++ ++int ipkg_process_actions_sanity_check(ipkg_conf_t *conf, pkg_vec_t *pkgs_to_remove, pkg_vec_t *pkgs_superseded, pkg_vec_t *pkgs_to_install) ++{ ++ int i; ++ /* now one more pass checking on the ones that need to be installed */ ++ for (i = 0 ; i < pkgs_to_install->len; i++ ) { ++ pkg_t *pkg = pkgs_to_install->pkgs[i]; ++ if (pkg->dest == NULL) ++ pkg->dest = conf->default_dest; ++ ++ pkg->state_want = SW_INSTALL; ++ ++ /* Abhaya: conflicts check */ ++ err = check_conflicts_for(conf, pkg); ++ if (err) { return err; } ++ } ++ return 0; ++} ++ ++int ipkg_process_actions_unpack_packages(ipkg_conf_t *conf, pkg_vec_t *pkgs_to_remove, pkg_vec_t *pkgs_to_install) ++{ ++ int i; ++ /* now one more pass checking on the ones that need to be installed */ ++ for (i = 0 ; i < pkgs_to_install->len; i++ ) { ++ pkg_t *pkg = pkgs_to_install->pkgs[i]; ++ ++ /* XXX: FEATURE: Need to really support Provides/Replaces: here at some point */ ++ pkg_vec_t *replacees = pkg_vec_alloc(); ++ pkg_get_installed_replacees(conf, pkg, replacees); ++ ++ /* XXX: BUG: we really should treat replacement more like an upgrade ++ * Instead, we're going to remove the replacees ++ */ ++ err = pkg_remove_installed_replacees(conf, replacees); ++ if (err) return err; ++ pkg->state_flag |= SF_REMOVED_REPLACEES; ++ } ++ return 0; ++} ++ ++int ipkg_process_actions_unpack_packages(ipkg_conf_t *conf, pkg_vec_t *pkgs_to_remove, pkg_vec_t *pkgs_to_install) ++{ ++ int i; ++ /* now one more pass checking on the ones that need to be installed */ ++ for (i = 0 ; i < pkgs_to_install->len; i++ ) { ++ pkg_t *pkg = pkgs_to_install->pkgs[i]; ++ if (pkg->local_filename == NULL) { ++ err = ipkg_download_pkg(conf, pkg, conf->tmp_dir); ++ if (err) { ++ ipkg_message(conf, IPKG_ERROR, ++ "Failed to download %s. Perhaps you need to run 'ipkg update'?\n", ++ pkg->name); ++ return err; ++ } ++ } ++ if (pkg->tmp_unpack_dir == NULL) { ++ err = unpack_pkg_control_files(conf, pkg); ++ if (err) return err; ++ } ++ } ++ return 0; ++} ++ ++int ipkg_process_actions_prerm(ipkg_conf_t *conf, pkg_vec_t *pkgs_to_install) ++{ ++ int i; ++ /* now one more pass checking on the ones that need to be installed */ ++ for (i = 0 ; i < pkgs_to_install->len; i++ ) { ++ pkg_t *pkg = pkgs_to_install->pkgs[i]; ++ pkg_t *old_pkg = pkg->old_pkg; ++ ++ err = prerm_upgrade_old_pkg(conf, pkg, old_pkg); ++ if (err) return err; ++ ++ err = prerm_deconfigure_conflictors(conf, pkg, replacees); ++ if (err) return err; ++ ++ err = preinst_configure(conf, pkg, old_pkg); ++ if (err) return err; ++ ++ err = backup_modified_conffiles(conf, pkg, old_pkg); ++ if (err) return err; ++ ++ err = postrm_upgrade_old_pkg(conf, pkg, old_pkg); ++ if (err) return err; ++ } ++ return 0; ++} ++ ++int ipkg_process_actions_install(ipkg_conf_t *conf, pkg_vec_t *pkgs_to_install) ++{ ++ int i; ++ /* now one more pass checking on the ones that need to be installed */ ++ for (i = 0 ; i < pkgs_to_install->len; i++ ) { ++ pkg_t *pkg = pkgs_to_install->pkgs[i]; ++ pkg_t *old_pkg = pkg->old_pkg; ++ ++ if (old_pkg) { ++ old_pkg->state_want = SW_DEINSTALL; ++ ++ if (old_pkg->state_flag & SF_NOPRUNE) { ++ ipkg_message(conf, IPKG_INFO, ++ " not removing obsolesced files because package marked noprune\n"); ++ } else { ++ ipkg_message(conf, IPKG_INFO, ++ " removing obsolesced files\n"); ++ remove_obsolesced_files(conf, pkg, old_pkg); ++ } ++ } ++ ++ ipkg_message(conf, IPKG_INFO, ++ " installing maintainer scripts\n"); ++ install_maintainer_scripts(conf, pkg, old_pkg); ++ ++ /* the following just returns 0 */ ++ remove_disappeared(conf, pkg); ++ ++ ipkg_message(conf, IPKG_INFO, ++ " installing data files\n"); ++ install_data_files(conf, pkg); ++ ++ ipkg_message(conf, IPKG_INFO, ++ " resolving conf files\n"); ++ resolve_conffiles(conf, pkg); ++ ++ pkg->state_status = SS_UNPACKED; ++ ++ if (old_pkg) { ++ old_pkg->state_status = SS_NOT_INSTALLED; ++ } ++ ++ time(&pkg->installed_time); ++ ++ ipkg_message(conf, IPKG_INFO, ++ " cleanup temp files\n"); ++ cleanup_temporary_files(conf, pkg); ++ ++ if (pkg->parent) ++ pkg->parent->state_status = pkg->state_status; ++ } ++ return 0; ++} ++ ++int ipkg_process_actions_unwind_prerm(ipkg_conf_t *conf, pkg_vec_t *pkgs_to_install) ++{ ++ int i; ++ /* now one more pass checking on the ones that need to be installed */ ++ for (i = 0 ; i < pkgs_to_install->len; i++ ) { ++ pkg_t *pkg = pkgs_to_install->pkgs[i]; ++ pkg_t *old_pkg = pkg->old_pkg; ++ ++ if (old_pkg) { ++ if (old_pkg->state_flags & SF_POSTRM_UPGRADE) ++ postrm_upgrade_old_pkg_unwind(conf, pkg, old_pkg); ++ if (old_pkg->state_flags & SF_CHECK_DATA_FILE_CLASHES) ++ check_data_file_clashes_unwind(conf, pkg, old_pkg); ++ if (old_pkg->state_flags & SF_BACKUP_MODIFIED_CONFFILES) ++ backup_modified_conffiles_unwind(conf, pkg, old_pkg); ++ if (old_pkg->state_flags & SF_PREINST_CONFIGURE) ++ preinst_configure_unwind(conf, pkg, old_pkg); ++ if (old_pkg->state_flags & SF_DECONFIGURE_CONFLICTORS) ++ prerm_deconfigure_conflictors_unwind(conf, pkg, replacees); ++ if (old_pkg->state_flags & SF_PRERM_UPGRADE) ++ prerm_upgrade_old_pkg_unwind(conf, pkg, old_pkg); ++ ++ if (old_pkg->state_flags & SF_REMOVED_REPLACEES) ++ remove_installed_replacees_unwind(conf, pkg, old_pkg); ++ ++ } ++ } ++ return 0; ++} ++ ++/* ++ * Perform all the actions. ++ * ++ * pkgs_to_remove are packages marked for removal. ++ * pkgs_superseded are the old packages being replaced by upgrades. ++ * ++ * Assumes pkgs_to_install includes all dependences, recursively, sorted in installable order. ++ */ ++int ipkg_process_actions(ipkg_conf_t *conf, pkg_vec_t *pkgs_to_remove, pkg_vec_t *pkgs_superseded, pkg_vec_t *pkgs_to_install) ++{ ++ int err; ++ int i; ++ ++ err = ipkg_remove_packages(conf, pkgs_to_remove); ++ if (err) return err; ++ ++ err = ipkg_process_actions_sanity_check(conf, pkgs_superseded, pkgs_to_install); ++ if (err) return err; ++ ++ err = ipkg_process_actions_remove_replacees(conf, pkgs_to_install); ++ if (err) goto UNWIND; ++ ++ /* @@@@ look at ipkg_install_pkg for handling replacements */ ++ err = ipkg_process_actions_unpack_packages(conf, pkgs_to_install); ++ if (err) goto UNWIND; ++ ++ /* ++ * Now that we have the packages unpacked, we can look for data ++ * file clashes. First, we mark the files from the superseded ++ * packages as obsolete. Then we scan the files in ++ * pkgs_to_install, and only complain about clashes with ++ * non-obsolete files. ++ */ ++ ++ err = ipkg_process_actions_check_data_file_clashes(conf, pkgs_superseded, pkgs_to_install); ++ if (err) goto UNWIND; ++ ++ /* this was before checking data file clashes */ ++ err = ipkg_process_actions_prerm(conf, pkgs_superseded, pkgs_to_install); ++ if (err) goto UNWIND; ++ ++ /* point of no return: no unwinding after this */ ++ err = ipkg_process_actions_install(conf, pkgs_to_install); ++ if (err) return err; ++ ++ ipkg_message(conf, IPKG_INFO, "Done.\n"); ++ return 0; ++ ++ UNWIND: ++ ipkg_process_actions_unwind(conf, pkgs_to_install); ++ ++ ipkg_message(conf, IPKG_INFO, ++ " cleanup temp files\n"); ++ cleanup_temporary_files(conf, pkg); ++ ++ ipkg_message(conf, IPKG_INFO, ++ "Failed.\n"); ++ return err; ++} ++ ++#endif +diff -ruN busybox-1.2.0-orig/archival/libipkg/ipkg_install.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_install.h +--- busybox-1.2.0-orig/archival/libipkg/ipkg_install.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_install.h 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,35 @@ ++/* ipkg_install.h - the itsy package management system ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#ifndef IPKG_INSTALL_H ++#define IPKG_INSTALL_H ++ ++#include "pkg.h" ++#include "ipkg_conf.h" ++ ++ipkg_error_t ipkg_install_by_name(ipkg_conf_t *conf, const char *pkg_name); ++ipkg_error_t ipkg_install_multi_by_name(ipkg_conf_t *conf, const char *pkg_name); ++int ipkg_install_from_file(ipkg_conf_t *conf, const char *filename); ++int ipkg_install_pkg(ipkg_conf_t *conf, pkg_t *pkg,int from_upgrading); ++int satisfy_dependencies_for(ipkg_conf_t *conf, pkg_t *pkg); ++ ++int ipkg_satisfy_all_dependences(ipkg_conf_t *conf); ++ ++int pkg_mark_dependencies_for_installation(ipkg_conf_t *conf, pkg_t *pkg_name, pkg_vec_t *pkgs_needed); ++int name_mark_dependencies_for_installation(ipkg_conf_t *conf, const char *pkg_name, pkg_vec_t *pkgs_needed); ++ ++#endif +diff -ruN busybox-1.2.0-orig/archival/libipkg/ipkg_message.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_message.c +--- busybox-1.2.0-orig/archival/libipkg/ipkg_message.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_message.c 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,61 @@ ++/* ipkg_message.c - the itsy package management system ++ ++ Copyright (C) 2003 Daniele Nicolodi <daniele@grinta.net> ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++ ++#include "ipkg.h" ++#include "ipkg_conf.h" ++#include "ipkg_message.h" ++ ++#ifndef IPKG_LIB ++ ++void ++ipkg_message (ipkg_conf_t * conf, message_level_t level, char *fmt, ...) ++{ ++ va_list ap; ++ ++ if (conf && (conf->verbosity < level)) ++ { ++ return; ++ } ++ else ++ { ++ ++ va_start (ap, fmt); ++ vprintf (fmt, ap); ++ va_end (ap); ++ } ++} ++ ++#else ++ ++#include "libipkg.h" ++ ++//#define ipkg_message(conf, level, fmt, arg...) ipkg_cb_message(conf, level, fmt, ## arg) ++ ++void ++ipkg_message (ipkg_conf_t * conf, message_level_t level, char *fmt, ...) ++{ ++ va_list ap; ++ char ts[256]; ++ ++ if (ipkg_cb_message) ++ { ++ va_start (ap, fmt); ++ vsnprintf (ts,256,fmt, ap); ++ va_end (ap); ++ ipkg_cb_message(conf,level,ts); ++ } ++} ++#endif +diff -ruN busybox-1.2.0-orig/archival/libipkg/ipkg_message.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_message.h +--- busybox-1.2.0-orig/archival/libipkg/ipkg_message.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_message.h 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,32 @@ ++/* ipkg_message.h - the itsy package management system ++ ++ Copyright (C) 2003 Daniele Nicolodi <daniele@grinta.net> ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#ifndef _IPKG_MESSAGE_H_ ++#define _IPKG_MESSAGE_H_ ++ ++#include "ipkg.h" ++#include "ipkg_conf.h" ++ ++typedef enum { ++ IPKG_ERROR, /* error conditions */ ++ IPKG_NOTICE, /* normal but significant condition */ ++ IPKG_INFO, /* informational message */ ++ IPKG_DEBUG, /* debug level message */ ++ IPKG_DEBUG2, /* more debug level message */ ++} message_level_t; ++ ++extern void ipkg_message(ipkg_conf_t *conf, message_level_t level, char *fmt, ...); ++ ++#endif /* _IPKG_MESSAGE_H_ */ +diff -ruN busybox-1.2.0-orig/archival/libipkg/ipkg_remove.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_remove.c +--- busybox-1.2.0-orig/archival/libipkg/ipkg_remove.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_remove.c 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,383 @@ ++/* ipkg_remove.c - the itsy package management system ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#include "ipkg.h" ++#include "ipkg_message.h" ++ ++#include <glob.h> ++ ++#include "ipkg_remove.h" ++ ++#include "file_util.h" ++#include "sprintf_alloc.h" ++#include "str_util.h" ++ ++#include "ipkg_cmd.h" ++ ++/* ++ * Returns number of the number of packages depending on the packages provided by this package. ++ * Every package implicitly provides itself. ++ */ ++int pkg_has_installed_dependents(ipkg_conf_t *conf, abstract_pkg_t *parent_apkg, pkg_t *pkg, abstract_pkg_t *** pdependents) ++{ ++ int nprovides = pkg->provides_count; ++ abstract_pkg_t **provides = pkg->provides; ++ int n_installed_dependents = 0; ++ int i; ++ for (i = 0; i <= nprovides; i++) { ++ abstract_pkg_t *providee = provides[i]; ++ abstract_pkg_t **dependers = providee->depended_upon_by; ++ abstract_pkg_t *dep_ab_pkg; ++ if (dependers == NULL) ++ continue; ++ while ((dep_ab_pkg = *dependers++) != NULL) { ++ if (dep_ab_pkg->state_status == SS_INSTALLED){ ++ n_installed_dependents++; ++ } ++ } ++ ++ } ++ /* if caller requested the set of installed dependents */ ++ if (pdependents) { ++ int p = 0; ++ abstract_pkg_t **dependents = (abstract_pkg_t **)malloc((n_installed_dependents+1)*sizeof(abstract_pkg_t *)); ++ ++ if ( dependents == NULL ){ ++ fprintf(stderr,"%s Unable to allocate memory. REPORT THIS BUG IN BUGZILLA PLEASE\n", __FUNCTION__); ++ return -1; ++ } ++ ++ *pdependents = dependents; ++ for (i = 0; i <= nprovides; i++) { ++ abstract_pkg_t *providee = provides[i]; ++ abstract_pkg_t **dependers = providee->depended_upon_by; ++ abstract_pkg_t *dep_ab_pkg; ++ if (dependers == NULL) ++ continue; ++ while ((dep_ab_pkg = *dependers++) != NULL) { ++ if (dep_ab_pkg->state_status == SS_INSTALLED && !(dep_ab_pkg->state_flag & SF_MARKED)) { ++ dependents[p++] = dep_ab_pkg; ++ dep_ab_pkg->state_flag |= SF_MARKED; ++ } ++ } ++ } ++ dependents[p] = NULL; ++ /* now clear the marks */ ++ for (i = 0; i < p; i++) { ++ abstract_pkg_t *dep_ab_pkg = dependents[i]; ++ dep_ab_pkg->state_flag &= ~SF_MARKED; ++ } ++ } ++ return n_installed_dependents; ++} ++ ++int ipkg_remove_dependent_pkgs (ipkg_conf_t *conf, pkg_t *pkg, abstract_pkg_t **dependents) ++{ ++ int i; ++ int a; ++ int count; ++ pkg_vec_t *dependent_pkgs = pkg_vec_alloc(); ++ abstract_pkg_t * ab_pkg; ++ ++ if((ab_pkg = pkg->parent) == NULL){ ++ fprintf(stderr, "%s: unable to get dependent pkgs. pkg %s isn't in hash table\n", ++ __FUNCTION__, pkg->name); ++ return 0; ++ } ++ ++ if (dependents == NULL) ++ return 0; ++ ++ // here i am using the dependencies_checked ++ if (ab_pkg->dependencies_checked == 2) // variable to make out whether this package ++ return 0; // has already been encountered in the process ++ // of marking packages for removal - Karthik ++ ab_pkg->dependencies_checked = 2; ++ ++ i = 0; ++ count = 1; ++ while (dependents [i] != NULL) { ++ abstract_pkg_t *dep_ab_pkg = dependents[i]; ++ ++ if (dep_ab_pkg->dependencies_checked == 2){ ++ i++; ++ continue; ++ } ++ if (dep_ab_pkg->state_status == SS_INSTALLED) { ++ for (a = 0; a < dep_ab_pkg->pkgs->len; a++) { ++ pkg_t *dep_pkg = dep_ab_pkg->pkgs->pkgs[a]; ++ if (dep_pkg->state_status == SS_INSTALLED) { ++ pkg_vec_insert(dependent_pkgs, dep_pkg); ++ count++; ++ } ++ } ++ } ++ i++; ++ /* 1 - to keep track of visited ab_pkgs when checking for possiblility of a broken removal of pkgs. ++ * 2 - to keep track of pkgs whose deps have been checked alrdy - Karthik */ ++ } ++ ++ if (count == 1) ++ return 0; ++ ++ ++ for (i = 0; i < dependent_pkgs->len; i++) { ++ int err = ipkg_remove_pkg(conf, dependent_pkgs->pkgs[i],0); ++ if (err) ++ return err; ++ } ++ return 0; ++} ++ ++static int user_prefers_removing_dependents(ipkg_conf_t *conf, abstract_pkg_t *abpkg, pkg_t *pkg, abstract_pkg_t **dependents) ++{ ++ abstract_pkg_t *dep_ab_pkg; ++ ipkg_message(conf, IPKG_ERROR, "Package %s is depended upon by packages:\n", pkg->name); ++ while ((dep_ab_pkg = *dependents++) != NULL) { ++ if (dep_ab_pkg->state_status == SS_INSTALLED) ++ ipkg_message(conf, IPKG_ERROR, "\t%s\n", dep_ab_pkg->name); ++ } ++ ipkg_message(conf, IPKG_ERROR, "These might cease to work if package %s is removed.\n\n", pkg->name); ++ ipkg_message(conf, IPKG_ERROR, ""); ++ ipkg_message(conf, IPKG_ERROR, "You can force removal of this package with -force-depends.\n"); ++ ipkg_message(conf, IPKG_ERROR, "You can force removal of this package and its dependents\n"); ++ ipkg_message(conf, IPKG_ERROR, "with -force-removal-of-dependent-packages or -recursive\n"); ++ ipkg_message(conf, IPKG_ERROR, "or by setting option force_removal_of_dependent_packages\n"); ++ ipkg_message(conf, IPKG_ERROR, "in ipkg.conf.\n"); ++ return 0; ++} ++ ++int ipkg_remove_pkg(ipkg_conf_t *conf, pkg_t *pkg,int message) ++{ ++/* Actually, when "message == 1" I have been called from an upgrade, and not from a normal remove ++ thus I wan't check for essential, as I'm upgrading. ++ I hope it won't break anything :) ++*/ ++ int err; ++ abstract_pkg_t *parent_pkg = NULL; ++ ++ if (pkg->essential && !message) { ++ if (conf->force_removal_of_essential_packages) { ++ fprintf(stderr, "WARNING: Removing essential package %s under your coercion.\n" ++ "\tIf your system breaks, you get to keep both pieces\n", ++ pkg->name); ++ } else { ++ fprintf(stderr, "ERROR: Refusing to remove essential package %s.\n" ++ "\tRemoving an essential package may lead to an unusable system, but if\n" ++ "\tyou enjoy that kind of pain, you can force ipkg to proceed against\n" ++ "\tits will with the option: -force-removal-of-essential-packages\n", ++ pkg->name); ++ return IPKG_PKG_IS_ESSENTIAL; ++ } ++ } ++ ++ if ((parent_pkg = pkg->parent) == NULL) ++ return 0; ++ ++ /* only attempt to remove dependent installed packages if ++ * force_depends is not specified or the package is being ++ * replaced. ++ */ ++ if (!conf->force_depends ++ && !(pkg->state_flag & SF_REPLACE)) { ++ abstract_pkg_t **dependents; ++ int has_installed_dependents = ++ pkg_has_installed_dependents(conf, parent_pkg, pkg, &dependents); ++ ++ if (has_installed_dependents) { ++ /* ++ * if this package is depended up by others, then either we should ++ * not remove it or we should remove it and all of its dependents ++ */ ++ ++ if (!conf->force_removal_of_dependent_packages ++ && !user_prefers_removing_dependents(conf, parent_pkg, pkg, dependents)) { ++ return IPKG_PKG_HAS_DEPENDENTS; ++ } ++ ++ /* remove packages depending on this package - Karthik */ ++ err = ipkg_remove_dependent_pkgs (conf, pkg, dependents); ++ free(dependents); ++ if (err) return err; ++ } ++ } ++ ++ if ( message==0 ){ ++ printf("Removing package %s from %s...\n", pkg->name, pkg->dest->name); ++ fflush(stdout); ++ } ++ pkg->state_flag |= SF_FILELIST_CHANGED; ++ ++ pkg->state_want = SW_DEINSTALL; ++ ipkg_state_changed++; ++ ++ pkg_run_script(conf, pkg, "prerm", "remove"); ++ ++ /* DPKG_INCOMPATIBILITY: dpkg is slightly different here. It ++ maintains an empty filelist rather than deleting it. That seems ++ like a big pain, and I don't see that that should make a big ++ difference, but for anyone who wants tighter compatibility, ++ feel free to fix this. */ ++ remove_data_files_and_list(conf, pkg); ++ ++ pkg_run_script(conf, pkg, "postrm", "remove"); ++ ++ remove_maintainer_scripts_except_postrm(conf, pkg); ++ ++ /* Aman Gupta - Since ipkg is made for handheld devices with limited ++ * space, it doesn't make sense to leave extra configurations, files, ++ * and maintainer scripts left around. So, we make remove like purge, ++ * and take out all the crap :) */ ++ ++ remove_postrm(conf, pkg); ++ pkg->state_status = SS_NOT_INSTALLED; ++ ++ if (parent_pkg) ++ parent_pkg->state_status = SS_NOT_INSTALLED; ++ ++ return 0; ++} ++ ++int ipkg_purge_pkg(ipkg_conf_t *conf, pkg_t *pkg) ++{ ++ ipkg_remove_pkg(conf, pkg,0); ++ return 0; ++} ++ ++int remove_data_files_and_list(ipkg_conf_t *conf, pkg_t *pkg) ++{ ++ str_list_t installed_dirs; ++ str_list_t *installed_files; ++ str_list_elt_t *iter; ++ char *file_name; ++ conffile_t *conffile; ++ int removed_a_dir; ++ pkg_t *owner; ++ ++ str_list_init(&installed_dirs); ++ installed_files = pkg_get_installed_files(pkg); ++ ++ for (iter = installed_files->head; iter; iter = iter->next) { ++ file_name = iter->data; ++ ++ if (file_is_dir(file_name)) { ++ str_list_append(&installed_dirs, strdup(file_name)); ++ continue; ++ } ++ ++ conffile = pkg_get_conffile(pkg, file_name); ++ if (conffile) { ++ /* XXX: QUESTION: Is this right? I figure we only need to ++ save the conffile if it has been modified. Is that what ++ dpkg does? Or does dpkg preserve all conffiles? If so, ++ this seems like a better thing to do to conserve ++ space. */ ++ if (conffile_has_been_modified(conf, conffile)) { ++ printf(" not deleting modified conffile %s\n", file_name); ++ fflush(stdout); ++ continue; ++ } ++ } ++ ++ ipkg_message(conf, IPKG_INFO, " deleting %s (noaction=%d)\n", file_name, conf->noaction); ++ if (!conf->noaction) ++ unlink(file_name); ++ } ++ ++ if (!conf->noaction) { ++ do { ++ removed_a_dir = 0; ++ for (iter = installed_dirs.head; iter; iter = iter->next) { ++ file_name = iter->data; ++ ++ if (rmdir(file_name) == 0) { ++ ipkg_message(conf, IPKG_INFO, " deleting %s\n", file_name); ++ removed_a_dir = 1; ++ str_list_remove(&installed_dirs, &iter); ++ } ++ } ++ } while (removed_a_dir); ++ } ++ ++ pkg_free_installed_files(pkg); ++ /* We have to remove the file list now, so that ++ find_pkg_owning_file does not always just report this package */ ++ pkg_remove_installed_files_list(conf, pkg); ++ ++ /* Don't print warning for dirs that are provided by other packages */ ++ for (iter = installed_dirs.head; iter; iter = iter->next) { ++ file_name = iter->data; ++ ++ owner = file_hash_get_file_owner(conf, file_name); ++ if (owner) { ++ free(iter->data); ++ iter->data = NULL; ++ str_list_remove(&installed_dirs, &iter); ++ } ++ } ++ ++ /* cleanup */ ++ for (iter = installed_dirs.head; iter; iter = iter->next) { ++ free(iter->data); ++ iter->data = NULL; ++ } ++ str_list_deinit(&installed_dirs); ++ ++ return 0; ++} ++ ++int remove_maintainer_scripts_except_postrm(ipkg_conf_t *conf, pkg_t *pkg) ++{ ++ int i, err; ++ char *globpattern; ++ glob_t globbuf; ++ ++ if (conf->noaction) return 0; ++ ++ sprintf_alloc(&globpattern, "%s/%s.*", ++ pkg->dest->info_dir, pkg->name); ++ err = glob(globpattern, 0, NULL, &globbuf); ++ free(globpattern); ++ if (err) { ++ return 0; ++ } ++ ++ for (i = 0; i < globbuf.gl_pathc; i++) { ++ if (str_ends_with(globbuf.gl_pathv[i], ".postrm")) { ++ continue; ++ } ++ ipkg_message(conf, IPKG_INFO, " deleting %s\n", globbuf.gl_pathv[i]); ++ unlink(globbuf.gl_pathv[i]); ++ } ++ globfree(&globbuf); ++ ++ return 0; ++} ++ ++int remove_postrm(ipkg_conf_t *conf, pkg_t *pkg) ++{ ++ char *postrm_file_name; ++ ++ if (conf->noaction) return 0; ++ ++ sprintf_alloc(&postrm_file_name, "%s/%s.postrm", ++ pkg->dest->info_dir, pkg->name); ++ unlink(postrm_file_name); ++ free(postrm_file_name); ++ ++ return 0; ++} +diff -ruN busybox-1.2.0-orig/archival/libipkg/ipkg_remove.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_remove.h +--- busybox-1.2.0-orig/archival/libipkg/ipkg_remove.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_remove.h 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,33 @@ ++/* ipkg_remove.h - the itsy package management system ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#ifndef IPKG_REMOVE_H ++#define IPKG_REMOVE_H ++ ++#include "pkg.h" ++#include "ipkg_conf.h" ++ ++int ipkg_remove_pkg(ipkg_conf_t *conf, pkg_t *pkg,int message); ++int ipkg_purge_pkg(ipkg_conf_t *conf, pkg_t *pkg); ++int possible_broken_removal_of_packages (ipkg_conf_t *conf, pkg_t *pkg); ++int pkg_has_installed_dependents(ipkg_conf_t *conf, abstract_pkg_t *parent_apkg, pkg_t *pkg, abstract_pkg_t *** pdependents); ++int remove_data_files_and_list(ipkg_conf_t *conf, pkg_t *pkg); ++int remove_maintainer_scripts_except_postrm (ipkg_conf_t *conf, pkg_t *pkg); ++int remove_postrm (ipkg_conf_t *conf, pkg_t *pkg); ++ ++ ++#endif +diff -ruN busybox-1.2.0-orig/archival/libipkg/ipkg_upgrade.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_upgrade.c +--- busybox-1.2.0-orig/archival/libipkg/ipkg_upgrade.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_upgrade.c 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,77 @@ ++/* ipkg_upgrade.c - the itsy package management system ++ ++ Carl D. Worth ++ Copyright (C) 2001 University of Southern California ++ ++ Copyright (C) 2003 Daniele Nicolodi <daniele@grinta.net> ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#include "ipkg.h" ++#include "ipkg_install.h" ++#include "ipkg_message.h" ++ ++int ipkg_upgrade_pkg(ipkg_conf_t *conf, pkg_t *old) ++{ ++ pkg_t *new; ++ int cmp; ++ char *old_version, *new_version; ++ ++ if (old->state_flag & SF_HOLD) { ++ ipkg_message(conf, IPKG_NOTICE, ++ "Not upgrading package %s which is marked " ++ "hold (flags=%#x)\n", old->name, old->state_flag); ++ return 0; ++ } ++ ++ new = pkg_hash_fetch_best_installation_candidate_by_name(conf, old->name); ++ if (new == NULL) { ++ old_version = pkg_version_str_alloc(old); ++ ipkg_message(conf, IPKG_NOTICE, ++ "Assuming locally installed package %s (%s) " ++ "is up to date.\n", old->name, old_version); ++ free(old_version); ++ return 0; ++ } ++ ++ old_version = pkg_version_str_alloc(old); ++ new_version = pkg_version_str_alloc(new); ++ ++ cmp = pkg_compare_versions(old, new); ++ ipkg_message(conf, IPKG_DEBUG, ++ "comparing visible versions of pkg %s:" ++ "\n\t%s is installed " ++ "\n\t%s is available " ++ "\n\t%d was comparison result\n", ++ old->name, old_version, new_version, cmp); ++ if (cmp == 0) { ++ ipkg_message(conf, IPKG_INFO, ++ "Package %s (%s) installed in %s is up to date.\n", ++ old->name, old_version, old->dest->name); ++ free(old_version); ++ free(new_version); ++ return 0; ++ } else if (cmp > 0) { ++ ipkg_message(conf, IPKG_NOTICE, ++ "Not downgrading package %s on %s from %s to %s.\n", ++ old->name, old->dest->name, old_version, new_version); ++ free(old_version); ++ free(new_version); ++ return 0; ++ } else if (cmp < 0) { ++ new->dest = old->dest; ++ old->state_want = SW_DEINSTALL; ++ } ++ ++ new->state_flag |= SF_USER; ++ return ipkg_install_pkg(conf, new,1); ++} +diff -ruN busybox-1.2.0-orig/archival/libipkg/ipkg_upgrade.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_upgrade.h +--- busybox-1.2.0-orig/archival/libipkg/ipkg_upgrade.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_upgrade.h 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,18 @@ ++/* ipkg_upgrade.c - the itsy package management system ++ ++ Copyright (C) 2003 Daniele Nicolodi <daniele@grinta.net> ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#include "ipkg.h" ++ ++int ipkg_upgrade_pkg(ipkg_conf_t *conf, pkg_t *old); +diff -ruN busybox-1.2.0-orig/archival/libipkg/ipkg_utils.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_utils.c +--- busybox-1.2.0-orig/archival/libipkg/ipkg_utils.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_utils.c 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,181 @@ ++/* ipkg_utils.c - the itsy package management system ++ ++ Steven M. Ayer ++ ++ Copyright (C) 2002 Compaq Computer Corporation ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#include "ipkg.h" ++#include <errno.h> ++#include <ctype.h> ++#include <sys/vfs.h> ++ ++#include "ipkg_utils.h" ++#include "pkg.h" ++#include "pkg_hash.h" ++ ++struct errlist* error_list; ++ ++int get_available_blocks(char * filesystem) ++{ ++ struct statfs sfs; ++ ++ if(statfs(filesystem, &sfs)){ ++ fprintf(stderr, "bad statfs\n"); ++ return 0; ++ } ++ /* fprintf(stderr, "reported fs type %x\n", sfs.f_type); */ ++ return ((sfs.f_bavail * sfs.f_bsize) / 1024); ++} ++ ++char **read_raw_pkgs_from_file(const char *file_name) ++{ ++ FILE *fp; ++ char **ret; ++ ++ if(!(fp = fopen(file_name, "r"))){ ++ fprintf(stderr, "can't get %s open for read\n", file_name); ++ return NULL; ++ } ++ ++ ret = read_raw_pkgs_from_stream(fp); ++ ++ fclose(fp); ++ ++ return ret; ++} ++ ++char **read_raw_pkgs_from_stream(FILE *fp) ++{ ++ char **raw = NULL, *buf, *scout; ++ int count = 0; ++ size_t size = 512; ++ ++ buf = malloc (size); ++ ++ while (fgets(buf, size, fp)) { ++ while (strlen (buf) == (size - 1) ++ && buf[size-2] != '\n') { ++ size_t o = size - 1; ++ size *= 2; ++ buf = realloc (buf, size); ++ if (fgets (buf + o, size - o, fp) == NULL) ++ break; ++ } ++ ++ if(!(count % 50)) ++ raw = realloc(raw, (count + 50) * sizeof(char *)); ++ ++ if((scout = strchr(buf, '\n'))) ++ *scout = '\0'; ++ ++ raw[count++] = strdup(buf); ++ } ++ ++ raw = realloc(raw, (count + 1) * sizeof(char *)); ++ raw[count] = NULL; ++ ++ free (buf); ++ ++ return raw; ++} ++ ++/* something to remove whitespace, a hash pooper */ ++char *trim_alloc(char *line) ++{ ++ char *new; ++ char *dest, *src, *end; ++ ++ new = malloc(strlen(line) + 1); ++ if ( new == NULL ){ ++ fprintf(stderr,"%s: Unable to allocate memory\n",__FUNCTION__); ++ return NULL; ++ } ++ dest = new, src = line, end = line + (strlen(line) - 1); ++ ++ /* remove it from the front */ ++ while(src && ++ isspace(*src) && ++ *src) ++ src++; ++ /* and now from the back */ ++ while((end > src) && ++ isspace(*end)) ++ end--; ++ end++; ++ *end = '\0'; ++ strcpy(new, src); ++ /* this does from the first space ++ * blasting away any versions stuff in depends ++ while(src && ++ !isspace(*src) && ++ *src) ++ *dest++ = *src++; ++ *dest = '\0'; ++ */ ++ ++ return new; ++} ++ ++int line_is_blank(const char *line) ++{ ++ const char *s; ++ ++ for (s = line; *s; s++) { ++ if (!isspace(*s)) ++ return 0; ++ } ++ return 1; ++} ++ ++void push_error_list(struct errlist ** errors, char * msg){ ++ struct errlist *err_lst_tmp; ++ ++ ++ err_lst_tmp = malloc ( sizeof (err_lst_tmp) ); ++ err_lst_tmp->errmsg=strdup(msg) ; ++ err_lst_tmp->next = *errors; ++ *errors = err_lst_tmp; ++} ++ ++ ++void reverse_error_list(struct errlist **errors){ ++ struct errlist *result=NULL; ++ struct errlist *current= *errors; ++ struct errlist *next; ++ ++ while ( current != NULL ) { ++ next = current->next; ++ current->next=result; ++ result=current; ++ current=next; ++ } ++ *errors=result; ++ ++} ++ ++ ++void free_error_list(struct errlist **errors){ ++ struct errlist *current = *errors; ++ ++ while (current != NULL) { ++ free(current->errmsg); ++ current = (*errors)->next; ++ free(*errors); ++ *errors = current; ++ } ++ ++ ++} ++ ++ +diff -ruN busybox-1.2.0-orig/archival/libipkg/ipkg_utils.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_utils.h +--- busybox-1.2.0-orig/archival/libipkg/ipkg_utils.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_utils.h 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,29 @@ ++/* ipkg_utils.h - the itsy package management system ++ ++ Steven M. Ayer ++ ++ Copyright (C) 2002 Compaq Computer Corporation ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#ifndef IPKG_UTILS_H ++#define IPKG_UTILS_H ++ ++#include "pkg.h" ++ ++int get_available_blocks(char * filesystem); ++char **read_raw_pkgs_from_file(const char *file_name); ++char **read_raw_pkgs_from_stream(FILE *fp); ++char *trim_alloc(char * line); ++int line_is_blank(const char *line); ++ ++#endif +diff -ruN busybox-1.2.0-orig/archival/libipkg/libipkg.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/libipkg.c +--- busybox-1.2.0-orig/archival/libipkg/libipkg.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/libipkg.c 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,527 @@ ++/* ipkglib.c - the itsy package management system ++ ++ Florina Boor ++ ++ Copyright (C) 2003 kernel concepts ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#ifdef IPKG_LIB ++ ++#include "ipkg.h" ++#include "ipkg_includes.h" ++#include "libipkg.h" ++ ++#include "args.h" ++#include "ipkg_conf.h" ++#include "ipkg_cmd.h" ++#include "file_util.h" ++ ++ ++ ++ipkg_message_callback ipkg_cb_message = NULL; ++ipkg_response_callback ipkg_cb_response = NULL; ++ipkg_status_callback ipkg_cb_status = NULL; ++ipkg_list_callback ipkg_cb_list = NULL; ++ ++ ++int ++ipkg_init (ipkg_message_callback mcall, ++ ipkg_response_callback rcall, ++ args_t * args) ++{ ++ ipkg_cb_message = mcall; ++ ipkg_cb_response = rcall; ++ ++ args_init (args); ++ ++ return 0; ++} ++ ++ ++int ++ipkg_deinit (args_t * args) ++{ ++ args_deinit (args); ++ ipkg_cb_message = NULL; ++ ipkg_cb_response = NULL; ++ ++ /* place other cleanup stuff here */ ++ ++ return 0; ++} ++ ++ ++int ++ipkg_packages_list(args_t *args, ++ const char *packages, ++ ipkg_list_callback cblist, ++ void *userdata) ++{ ++ ipkg_cmd_t *cmd; ++ ipkg_conf_t ipkg_conf; ++ int err; ++ ++ err = ipkg_conf_init (&ipkg_conf, args); ++ if (err) ++ { ++ return err; ++ } ++ ++ ipkg_cb_list = cblist; ++ /* we need to do this because of static declarations, ++ * maybe a good idea to change */ ++ cmd = ipkg_cmd_find ("list"); ++ if (packages) ++ err = ipkg_cmd_exec (cmd, &ipkg_conf, 1, &packages, userdata); ++ else ++ err = ipkg_cmd_exec (cmd, &ipkg_conf, 0, NULL, userdata); ++ ipkg_cb_list = NULL; ++ ipkg_conf_deinit (&ipkg_conf); ++ return (err); ++} ++ ++ ++int ++ipkg_packages_status(args_t *args, ++ const char *packages, ++ ipkg_status_callback cbstatus, ++ void *userdata) ++{ ++ ipkg_cmd_t *cmd; ++ ipkg_conf_t ipkg_conf; ++ int err; ++ ++ err = ipkg_conf_init (&ipkg_conf, args); ++ if (err) ++ { ++ return err; ++ } ++ ++ ipkg_cb_status = cbstatus; ++ ++ /* we need to do this because of static declarations, ++ * maybe a good idea to change */ ++ cmd = ipkg_cmd_find ("status"); ++ if (packages) ++ err = ipkg_cmd_exec (cmd, &ipkg_conf, 1, &packages, userdata); ++ else ++ err = ipkg_cmd_exec (cmd, &ipkg_conf, 0, NULL, userdata); ++ ++ ipkg_cb_status = NULL; ++ ipkg_conf_deinit (&ipkg_conf); ++ return (err); ++} ++ ++ ++int ++ipkg_packages_info(args_t *args, ++ const char *packages, ++ ipkg_status_callback cbstatus, ++ void *userdata) ++{ ++ ipkg_cmd_t *cmd; ++ ipkg_conf_t ipkg_conf; ++ int err; ++ ++ err = ipkg_conf_init (&ipkg_conf, args); ++ if (err) ++ { ++ return err; ++ } ++ ++ ipkg_cb_status = cbstatus; ++ ++ /* we need to do this because of static declarations, ++ * maybe a good idea to change */ ++ cmd = ipkg_cmd_find ("info"); ++ if (packages) ++ err = ipkg_cmd_exec (cmd, &ipkg_conf, 1, &packages, userdata); ++ else ++ err = ipkg_cmd_exec (cmd, &ipkg_conf, 0, NULL, userdata); ++ ++ ipkg_cb_status = NULL; ++ ipkg_conf_deinit (&ipkg_conf); ++ return (err); ++} ++ ++ ++int ++ipkg_packages_install (args_t * args, const char *name) ++{ ++ ipkg_cmd_t *cmd; ++ ipkg_conf_t ipkg_conf; ++ int err; ++ ++ /* this error should be handled in application */ ++ if (!name || !strlen (name)) ++ return (-1); ++ ++ err = ipkg_conf_init (&ipkg_conf, args); ++ if (err) ++ { ++ return err; ++ } ++ ++ /* we need to do this because of static declarations, ++ * maybe a good idea to change */ ++ cmd = ipkg_cmd_find ("install"); ++ err = ipkg_cmd_exec (cmd, &ipkg_conf, 1, &name, NULL); ++ ++ ipkg_conf_deinit(&ipkg_conf); ++ return (err); ++} ++ ++ ++int ++ipkg_packages_remove(args_t *args, const char *name, int purge) ++{ ++ ipkg_cmd_t *cmd; ++ ipkg_conf_t ipkg_conf; ++ int err; ++ ++ /* this error should be handled in application */ ++ if (!name || !strlen (name)) ++ return (-1); ++ ++ err = ipkg_conf_init (&ipkg_conf, args); ++ if (err) ++ { ++ return err; ++ } ++ ++ /* we need to do this because of static declarations, ++ * maybe a good idea to change */ ++ if (purge) ++ cmd = ipkg_cmd_find ("purge"); ++ else ++ cmd = ipkg_cmd_find ("remove"); ++ ++ err = ipkg_cmd_exec (cmd, &ipkg_conf, 1, &name, NULL); ++ ++ ipkg_conf_deinit(&ipkg_conf); ++ return (err); ++} ++ ++ ++int ++ipkg_lists_update(args_t *args) ++{ ++ ipkg_cmd_t *cmd; ++ ipkg_conf_t ipkg_conf; ++ int err; ++ ++ err = ipkg_conf_init (&ipkg_conf, args); ++ if (err) ++ { ++ return err; ++ } ++ ++ /* we need to do this because of static declarations, ++ * maybe a good idea to change */ ++ cmd = ipkg_cmd_find ("update"); ++ ++ err = ipkg_cmd_exec (cmd, &ipkg_conf, 0, NULL, NULL); ++ ++ ipkg_conf_deinit(&ipkg_conf); ++ return (err); ++} ++ ++ ++int ++ipkg_packages_upgrade(args_t *args) ++{ ++ ipkg_cmd_t *cmd; ++ ipkg_conf_t ipkg_conf; ++ int err; ++ ++ err = ipkg_conf_init (&ipkg_conf, args); ++ if (err) ++ { ++ return err; ++ } ++ ++ /* we need to do this because of static declarations, ++ * maybe a good idea to change */ ++ cmd = ipkg_cmd_find ("upgrade"); ++ ++ err = ipkg_cmd_exec (cmd, &ipkg_conf, 0, NULL, NULL); ++ ++ ipkg_conf_deinit(&ipkg_conf); ++ return (err); ++} ++ ++ ++int ++ipkg_packages_download (args_t * args, const char *name) ++{ ++ ipkg_cmd_t *cmd; ++ ipkg_conf_t ipkg_conf; ++ int err; ++ ++ /* this error should be handled in application */ ++ if (!name || !strlen (name)) ++ return (-1); ++ ++ err = ipkg_conf_init (&ipkg_conf, args); ++ if (err) ++ { ++ return err; ++ } ++ ++ /* we need to do this because of static declarations, ++ * maybe a good idea to change */ ++ cmd = ipkg_cmd_find ("download"); ++ err = ipkg_cmd_exec (cmd, &ipkg_conf, 1, &name, NULL); ++ ++ ipkg_conf_deinit(&ipkg_conf); ++ return (err); ++} ++ ++ ++int ++ipkg_package_files(args_t *args, ++ const char *name, ++ ipkg_list_callback cblist, ++ void *userdata) ++{ ++ ipkg_cmd_t *cmd; ++ ipkg_conf_t ipkg_conf; ++ int err; ++ ++ /* this error should be handled in application */ ++ if (!name || !strlen (name)) ++ return (-1); ++ ++ err = ipkg_conf_init (&ipkg_conf, args); ++ if (err) ++ { ++ return err; ++ } ++ ++ ipkg_cb_list = cblist; ++ ++ /* we need to do this because of static declarations, ++ * maybe a good idea to change */ ++ cmd = ipkg_cmd_find ("files"); ++ ++ err = ipkg_cmd_exec (cmd, &ipkg_conf, 1, &name, userdata); ++ ++ ipkg_cb_list = NULL; ++ ipkg_conf_deinit(&ipkg_conf); ++ return (err); ++} ++ ++ ++int ++ipkg_file_search(args_t *args, ++ const char *file, ++ ipkg_list_callback cblist, ++ void *userdata) ++{ ++ ipkg_cmd_t *cmd; ++ ipkg_conf_t ipkg_conf; ++ int err; ++ ++ /* this error should be handled in application */ ++ if (!file || !strlen (file)) ++ return (-1); ++ ++ err = ipkg_conf_init (&ipkg_conf, args); ++ if (err) ++ { ++ return err; ++ } ++ ++ ipkg_cb_list = cblist; ++ ++ /* we need to do this because of static declarations, ++ * maybe a good idea to change */ ++ cmd = ipkg_cmd_find ("search"); ++ err = ipkg_cmd_exec (cmd, &ipkg_conf, 1, &file, userdata); ++ ++ ipkg_cb_list = NULL; ++ ipkg_conf_deinit(&ipkg_conf); ++ return(err); ++} ++ ++ ++int ++ipkg_file_what(args_t *args, const char *file, const char* command) ++{ ++ ipkg_cmd_t *cmd; ++ ipkg_conf_t ipkg_conf; ++ int err; ++ ++ /* this error should be handled in application */ ++ if (!file || !strlen (file)) ++ return (-1); ++ ++ err = ipkg_conf_init (&ipkg_conf, args); ++ if (err) ++ { ++ return err; ++ } ++ ++ /* we need to do this because of static declarations, ++ * maybe a good idea to change */ ++ cmd = ipkg_cmd_find (command); ++ err = ipkg_cmd_exec (cmd, &ipkg_conf, 1, &file, NULL); ++ ++ ipkg_conf_deinit(&ipkg_conf); ++ return(err); ++} ++ ++#define ipkg_package_whatdepends(args,file) ipkg_file_what(args,file,"whatdepends") ++#define ipkg_package_whatrecommends(args, file) ipkg_file_what(args,file,"whatrecommends") ++#define ipkg_package_whatprovides(args, file) ipkg_file_what(args,file,"whatprovides") ++#define ipkg_package_whatconflicts(args, file) ipkg_file_what(args,file,"whatconflicts") ++#define ipkg_package_whatreplaces(args, file) ipkg_file_what(args,file,"whatreplaces") ++ ++ ++int default_ipkg_message_callback(ipkg_conf_t *conf, message_level_t level, ++ char *msg) ++{ ++ if (conf && (conf->verbosity < level)) { ++ return 0; ++ } else { ++#ifdef IPKG_LIB ++ if ( level == IPKG_ERROR ){ ++ push_error_list(&error_list, msg); ++// printf(msg); ++ } else ++#endif ++ printf(msg); ++ } ++ return 0; ++} ++ ++int default_ipkg_list_callback(char *name, char *desc, char *version, ++ pkg_state_status_t status, void *userdata) ++{ ++ if (desc) ++ printf("%s - %s - %s\n", name, version, desc); ++ else ++ printf("%s - %s\n", name, version); ++ return 0; ++} ++ ++int default_ipkg_files_callback(char *name, char *desc, char *version, ++ pkg_state_status_t status, void *userdata) ++{ ++ if (desc) ++ printf("%s\n", desc); ++ return 0; ++} ++ ++int default_ipkg_status_callback(char *name, int istatus, char *desc, ++ void *userdata) ++{ ++ printf("%s\n", desc); ++ return 0; ++} ++ ++char* default_ipkg_response_callback(char *question) ++{ ++ char *response = NULL; ++ printf(question); ++ fflush(stdout); ++ do { ++ response = (char *)file_read_line_alloc(stdin); ++ } while (response == NULL); ++ return response; ++} ++ ++/* This is used for backward compatibility */ ++int ++ipkg_op (int argc, char *argv[]) ++{ ++ int err, optind; ++ args_t args; ++ char *cmd_name; ++ ipkg_cmd_t *cmd; ++ ipkg_conf_t ipkg_conf; ++ ++ args_init (&args); ++ ++ optind = args_parse (&args, argc, argv); ++ if (optind == argc || optind < 0) ++ { ++ args_usage ("ipkg must have one sub-command argument"); ++ } ++ ++ cmd_name = argv[optind++]; ++/* Pigi: added a flag to disable the checking of structures if the command does not need to ++ read anything from there. ++*/ ++ if ( !strcmp(cmd_name,"print-architecture") || ++ !strcmp(cmd_name,"print_architecture") || ++ !strcmp(cmd_name,"print-installation-architecture") || ++ !strcmp(cmd_name,"print_installation_architecture") ) ++ args.nocheckfordirorfile = 1; ++ ++/* Pigi: added a flag to disable the reading of feed files if the command does not need to ++ read anything from there. ++*/ ++ if ( !strcmp(cmd_name,"flag") || ++ !strcmp(cmd_name,"configure") || ++ !strcmp(cmd_name,"remove") || ++ !strcmp(cmd_name,"files") || ++ !strcmp(cmd_name,"search") || ++ !strcmp(cmd_name,"compare_versions") || ++ !strcmp(cmd_name,"compare-versions") || ++ !strcmp(cmd_name,"list_installed") || ++ !strcmp(cmd_name,"list-installed") || ++ !strcmp(cmd_name,"status") ) ++ args.noreadfeedsfile = 1; ++ ++ ++ err = ipkg_conf_init (&ipkg_conf, &args); ++ if (err) ++ { ++ return err; ++ } ++ ++ args_deinit (&args); ++ ++ ipkg_cb_message = default_ipkg_message_callback; ++ ipkg_cb_response = default_ipkg_response_callback; ++ ipkg_cb_status = default_ipkg_status_callback; ++ if ( strcmp(cmd_name, "files")==0) ++ ipkg_cb_list = default_ipkg_files_callback; ++ else ++ ipkg_cb_list = default_ipkg_list_callback; ++ ++ cmd = ipkg_cmd_find (cmd_name); ++ if (cmd == NULL) ++ { ++ fprintf (stderr, "%s: unknown sub-command %s\n", argv[0], ++ cmd_name); ++ args_usage (NULL); ++ } ++ ++ if (cmd->requires_args && optind == argc) ++ { ++ fprintf (stderr, ++ "%s: the ``%s'' command requires at least one argument\n", ++ __FUNCTION__, cmd_name); ++ args_usage (NULL); ++ } ++ ++ err = ipkg_cmd_exec (cmd, &ipkg_conf, argc - optind, (const char **) (argv + optind), NULL); ++ ++ ipkg_conf_deinit (&ipkg_conf); ++ ++ return err; ++} ++ ++#endif /* IPKG_LIB */ +diff -ruN busybox-1.2.0-orig/archival/libipkg/libipkg.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/libipkg.h +--- busybox-1.2.0-orig/archival/libipkg/libipkg.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/libipkg.h 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,87 @@ ++/* ipkglib.h - the itsy package management system ++ ++ Florian Boor <florian.boor@kernelconcepts.de> ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#ifndef IPKGLIB_H ++#define IPKGLIB_H ++ ++#ifdef IPKG_LIB ++ ++#include "ipkg_conf.h" ++#include "ipkg_message.h" ++ ++#include "args.h" ++#include "pkg.h" ++ ++typedef int (*ipkg_message_callback)(ipkg_conf_t *conf, message_level_t level, ++ char *msg); ++typedef int (*ipkg_list_callback)(char *name, char *desc, char *version, ++ pkg_state_status_t status, void *userdata); ++typedef int (*ipkg_status_callback)(char *name, int istatus, char *desc, ++ void *userdata); ++typedef char* (*ipkg_response_callback)(char *question); ++ ++extern int ipkg_op(int argc, char *argv[]); /* ipkglib.c */ ++extern int ipkg_init (ipkg_message_callback mcall, ++ ipkg_response_callback rcall, ++ args_t * args); ++ ++extern int ipkg_deinit (args_t *args); ++extern int ipkg_packages_list(args_t *args, ++ const char *packages, ++ ipkg_list_callback cblist, ++ void *userdata); ++extern int ipkg_packages_status(args_t *args, ++ const char *packages, ++ ipkg_status_callback cbstatus, ++ void *userdata); ++extern int ipkg_packages_info(args_t *args, ++ const char *packages, ++ ipkg_status_callback cbstatus, ++ void *userdata); ++extern int ipkg_packages_install(args_t *args, const char *name); ++extern int ipkg_packages_remove(args_t *args, const char *name, int purge); ++extern int ipkg_lists_update(args_t *args); ++extern int ipkg_packages_upgrade(args_t *args); ++extern int ipkg_packages_download(args_t *args, const char *name); ++extern int ipkg_package_files(args_t *args, ++ const char *name, ++ ipkg_list_callback cblist, ++ void *userdata); ++extern int ipkg_file_search(args_t *args, ++ const char *file, ++ ipkg_list_callback cblist, ++ void *userdata); ++extern int ipkg_package_whatdepends(args_t *args, const char *file); ++extern int ipkg_package_whatrecommends(args_t *args, const char *file); ++extern int ipkg_package_whatprovides(args_t *args, const char *file); ++extern int ipkg_package_whatconflicts(args_t *args, const char *file); ++extern int ipkg_package_whatreplaces(args_t *args, const char *file); ++ ++extern ipkg_message_callback ipkg_cb_message; /* ipkglib.c */ ++extern ipkg_response_callback ipkg_cb_response; ++extern ipkg_status_callback ipkg_cb_status; ++extern ipkg_list_callback ipkg_cb_list; ++extern void push_error_list(struct errlist **errors,char * msg); ++extern void reverse_error_list(struct errlist **errors); ++extern void free_error_list(struct errlist **errors); ++ ++#else ++ ++extern int ipkg_op(int argc, char *argv[]); ++ ++#endif ++ ++ ++#endif +diff -ruN busybox-1.2.0-orig/archival/libipkg/Makefile busybox-1.2.0+ipkg-0.99.162/archival/libipkg/Makefile +--- busybox-1.2.0-orig/archival/libipkg/Makefile 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/Makefile 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,32 @@ ++# Makefile for busybox ++# ++# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> ++# ++# 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 ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++# General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++# ++ ++top_srcdir=../.. ++top_builddir=../.. ++srcdir=$(top_srcdir)/archival/libipkg ++LIBIPKG_DIR:=./ ++include $(top_builddir)/Rules.mak ++include $(top_builddir)/.config ++include $(srcdir)/Makefile.in ++all: $(libraries-y) ++-include $(top_builddir)/.depend ++ ++clean: ++ rm -f *.o *.a $(AR_TARGET) ++ +diff -ruN busybox-1.2.0-orig/archival/libipkg/Makefile.in busybox-1.2.0+ipkg-0.99.162/archival/libipkg/Makefile.in +--- busybox-1.2.0-orig/archival/libipkg/Makefile.in 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/Makefile.in 2006-10-08 12:29:39.000000000 +0200 +@@ -0,0 +1,88 @@ ++# Makefile for busybox ++# ++# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> ++# ++# 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 ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++# General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++# ++ ++LIBIPKG_AR:=libipkg.a ++ifndef $(LIBIPKG_DIR) ++LIBIPKG_DIR:=$(top_builddir)/archival/libipkg/ ++endif ++srcdir=$(top_srcdir)/archival/libipkg ++ ++LIBIPKG_CORE_SOURCES:= \ ++ args.c \ ++ libipkg.c \ ++ user.c \ ++ ++LIBIPKG_CMD_SOURCES:= \ ++ ipkg_cmd.c \ ++ ipkg_configure.c \ ++ ipkg_download.c \ ++ ipkg_install.c \ ++ ipkg_remove.c \ ++ ipkg_upgrade.c \ ++ ++LIBIPKG_DB_SOURCES:= \ ++ hash_table.c \ ++ ipkg_conf.c \ ++ ipkg_utils.c \ ++ pkg.c \ ++ pkg_depends.c \ ++ pkg_extract.c \ ++ pkg_hash.c \ ++ pkg_parse.c \ ++ pkg_vec.c \ ++ ++LIBIPKG_LIST_SOURCES:= \ ++ conffile.c \ ++ conffile_list.c \ ++ nv_pair.c \ ++ nv_pair_list.c \ ++ pkg_dest.c \ ++ pkg_dest_list.c \ ++ pkg_src.c \ ++ pkg_src_list.c \ ++ str_list.c \ ++ void_list.c \ ++ ++LIBIPKG_UTIL_SOURCES:= \ ++ file_util.c \ ++ ipkg_message.c \ ++ md5.c \ ++ str_util.c \ ++ xsystem.c \ ++ ++LIBIPKG-$(CONFIG_IPKG) += $(LIBIPKG_CORE_SOURCES) ++LIBIPKG-$(CONFIG_IPKG) += $(LIBIPKG_CMD_SOURCES) ++LIBIPKG-$(CONFIG_IPKG) += $(LIBIPKG_DB_SOURCES) ++LIBIPKG-$(CONFIG_IPKG) += $(LIBIPKG_LIST_SOURCES) ++LIBIPKG-$(CONFIG_IPKG) += $(LIBIPKG_UTIL_SOURCES) ++LIBIPKG_OBJS=$(patsubst %.c,$(LIBIPKG_DIR)%.o, $(LIBIPKG-y)) ++ ++ifeq ($(strip $(IPKG_ARCH)),) ++IPKG_ARCH:=$(TARGET_ARCH) ++endif ++CFLAGS += -DIPKG_LIB -DIPKGLIBDIR="\"/usr/lib\"" -DHOST_CPU_STR="\"$(IPKG_ARCH)\"" ++ ++libraries-$(CONFIG_IPKG) += $(LIBIPKG_DIR)$(LIBIPKG_AR) ++ ++$(LIBIPKG_DIR)$(LIBIPKG_AR): $(LIBIPKG_OBJS) ++ $(do_ar) ++ ++$(LIBIPKG_OBJS): $(LIBIPKG_DIR)%.o : $(srcdir)/%.c ++ $(compile.c) ++ +diff -ruN busybox-1.2.0-orig/archival/libipkg/md5.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/md5.c +--- busybox-1.2.0-orig/archival/libipkg/md5.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/md5.c 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,48 @@ ++/* md5.c - wrappers to busybox md5 functions ++ * ++ * Copyright (C) 1995-1999 Free Software Foundation, Inc. ++ * ++ * 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 ++ * the Free Software Foundation; either version 2, or (at your option) ++ * any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software Foundation, ++ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ */ ++ ++#include <stdio.h> ++#include "libbb.h" ++ ++#include "md5.h" ++ ++int md5_stream(FILE *stream, void *resblock) ++{ ++ int fd; ++ int sum; ++ ++ if( (fd = fileno(stream)) == -1 ) { ++ bb_error_msg("bad file descriptor"); ++ return 1; ++ } ++ ++ hash_fd(fd, HASH_MD5, (uint8_t *)resblock); ++ ++ return 0; ++} ++ ++void *md5_buffer(const char *buffer, size_t len, void *resblock) ++{ ++ md5_ctx_t md5_cx; ++ ++ md5_begin(&md5_cx); ++ md5_hash(buffer, len, &md5_cx); ++ return md5_end(resblock, &md5_cx); ++} ++ +diff -ruN busybox-1.2.0-orig/archival/libipkg/md5.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/md5.h +--- busybox-1.2.0-orig/archival/libipkg/md5.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/md5.h 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,35 @@ ++/* md5.h - Compute MD5 checksum of files or strings according to the ++ * definition of MD5 in RFC 1321 from April 1992. ++ * Copyright (C) 1995-1999 Free Software Foundation, Inc. ++ * ++ * 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 ++ * the Free Software Foundation; either version 2, or (at your option) ++ * any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software Foundation, ++ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ */ ++ ++#ifndef MD5_H ++#define MD5_H ++ ++/* Compute MD5 message digest for bytes read from STREAM. The ++ resulting message digest number will be written into the 16 bytes ++ beginning at RESBLOCK. */ ++int md5_stream(FILE *stream, void *resblock); ++ ++/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The ++ result is always in little endian byte order, so that a byte-wise ++ output yields to the wanted ASCII representation of the message ++ digest. */ ++void *md5_buffer(const char *buffer, size_t len, void *resblock); ++ ++#endif ++ +diff -ruN busybox-1.2.0-orig/archival/libipkg/nv_pair.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/nv_pair.c +--- busybox-1.2.0-orig/archival/libipkg/nv_pair.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/nv_pair.c 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,40 @@ ++/* nv_pair.c - the itsy package management system ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#include "ipkg.h" ++ ++#include "nv_pair.h" ++#include "str_util.h" ++ ++int nv_pair_init(nv_pair_t *nv_pair, const char *name, const char *value) ++{ ++ nv_pair->name = str_dup_safe(name); ++ nv_pair->value = str_dup_safe(value); ++ ++ return 0; ++} ++ ++void nv_pair_deinit(nv_pair_t *nv_pair) ++{ ++ free(nv_pair->name); ++ nv_pair->name = NULL; ++ ++ free(nv_pair->value); ++ nv_pair->value = NULL; ++} ++ ++ +diff -ruN busybox-1.2.0-orig/archival/libipkg/nv_pair.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/nv_pair.h +--- busybox-1.2.0-orig/archival/libipkg/nv_pair.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/nv_pair.h 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,32 @@ ++/* nv_pair.h - the itsy package management system ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#ifndef NV_PAIR_H ++#define NV_PAIR_H ++ ++typedef struct nv_pair nv_pair_t; ++struct nv_pair ++{ ++ char *name; ++ char *value; ++}; ++ ++int nv_pair_init(nv_pair_t *nv_pair, const char *name, const char *value); ++void nv_pair_deinit(nv_pair_t *nv_pair); ++ ++#endif ++ +diff -ruN busybox-1.2.0-orig/archival/libipkg/nv_pair_list.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/nv_pair_list.c +--- busybox-1.2.0-orig/archival/libipkg/nv_pair_list.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/nv_pair_list.c 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,98 @@ ++/* nv_pair_list.c - the itsy package management system ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#include "ipkg.h" ++ ++#include "nv_pair.h" ++#include "void_list.h" ++#include "nv_pair_list.h" ++ ++int nv_pair_list_elt_init(nv_pair_list_elt_t *elt, nv_pair_t *data) ++{ ++ return void_list_elt_init((void_list_elt_t *) elt, data); ++} ++ ++void nv_pair_list_elt_deinit(nv_pair_list_elt_t *elt) ++{ ++ void_list_elt_deinit((void_list_elt_t *) elt); ++} ++ ++int nv_pair_list_init(nv_pair_list_t *list) ++{ ++ return void_list_init((void_list_t *) list); ++} ++ ++void nv_pair_list_deinit(nv_pair_list_t *list) ++{ ++ nv_pair_list_elt_t *iter; ++ nv_pair_t *nv_pair; ++ ++ for (iter = list->head; iter; iter = iter->next) { ++ nv_pair = iter->data; ++ nv_pair_deinit(nv_pair); ++ ++ /* malloced in nv_pair_list_append */ ++ free(nv_pair); ++ iter->data = NULL; ++ } ++ void_list_deinit((void_list_t *) list); ++} ++ ++nv_pair_t *nv_pair_list_append(nv_pair_list_t *list, const char *name, const char *value) ++{ ++ int err; ++ ++ /* freed in nv_pair_list_deinit */ ++ nv_pair_t *nv_pair = malloc(sizeof(nv_pair_t)); ++ ++ if (nv_pair == NULL) { ++ fprintf(stderr, "%s: out of memory\n", __FUNCTION__); ++ return NULL; ++ } ++ nv_pair_init(nv_pair, name, value); ++ ++ err = void_list_append((void_list_t *) list, nv_pair); ++ if (err) { ++ return NULL; ++ } ++ ++ return nv_pair; ++} ++ ++int nv_pair_list_push(nv_pair_list_t *list, nv_pair_t *data) ++{ ++ return void_list_push((void_list_t *) list, data); ++} ++ ++nv_pair_list_elt_t *nv_pair_list_pop(nv_pair_list_t *list) ++{ ++ return (nv_pair_list_elt_t *) void_list_pop((void_list_t *) list); ++} ++ ++char *nv_pair_list_find(nv_pair_list_t *list, char *name) ++{ ++ nv_pair_list_elt_t *iter; ++ nv_pair_t *nv_pair; ++ ++ for (iter = list->head; iter; iter = iter->next) { ++ nv_pair = iter->data; ++ if (strcmp(nv_pair->name, name) == 0) { ++ return nv_pair->value; ++ } ++ } ++ return NULL; ++} +diff -ruN busybox-1.2.0-orig/archival/libipkg/nv_pair_list.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/nv_pair_list.h +--- busybox-1.2.0-orig/archival/libipkg/nv_pair_list.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/nv_pair_list.h 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,60 @@ ++/* nv_pair_list.h - the itsy package management system ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#ifndef NV_PAIR_LIST_H ++#define NV_PAIR_LIST_H ++ ++#include "nv_pair.h" ++#include "void_list.h" ++ ++typedef struct nv_pair_list_elt nv_pair_list_elt_t; ++struct nv_pair_list_elt ++{ ++ nv_pair_list_elt_t *next; ++ nv_pair_t *data; ++}; ++ ++typedef struct nv_pair_list nv_pair_list_t; ++struct nv_pair_list ++{ ++ nv_pair_list_elt_t pre_head; ++ nv_pair_list_elt_t *head; ++ nv_pair_list_elt_t *tail; ++}; ++ ++static inline int nv_pair_list_empty(nv_pair_list_t *list) ++{ ++ if (list->head == NULL) ++ return 1; ++ else ++ return 0; ++} ++ ++int nv_pair_list_elt_init(nv_pair_list_elt_t *elt, nv_pair_t *data); ++void nv_pair_list_elt_deinit(nv_pair_list_elt_t *elt); ++ ++int nv_pair_list_init(nv_pair_list_t *list); ++void nv_pair_list_deinit(nv_pair_list_t *list); ++ ++nv_pair_t *nv_pair_list_append(nv_pair_list_t *list, ++ const char *name, const char *value); ++int nv_pair_list_push(nv_pair_list_t *list, nv_pair_t *data); ++nv_pair_list_elt_t *nv_pair_list_pop(nv_pair_list_t *list); ++char *nv_pair_list_find(nv_pair_list_t *list, char *name); ++ ++#endif ++ +diff -ruN busybox-1.2.0-orig/archival/libipkg/pkg.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg.c +--- busybox-1.2.0-orig/archival/libipkg/pkg.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg.c 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,1754 @@ ++/* pkg.c - the itsy package management system ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#include "ipkg.h" ++#include <ctype.h> ++#include <string.h> ++#include <errno.h> ++ ++#include "pkg.h" ++ ++#include "pkg_parse.h" ++#include "pkg_extract.h" ++#include "ipkg_message.h" ++#include "ipkg_utils.h" ++ ++#include "sprintf_alloc.h" ++#include "file_util.h" ++#include "str_util.h" ++#include "xsystem.h" ++#include "ipkg_conf.h" ++ ++typedef struct enum_map enum_map_t; ++struct enum_map ++{ ++ int value; ++ char *str; ++}; ++ ++static const enum_map_t pkg_state_want_map[] = { ++ { SW_UNKNOWN, "unknown"}, ++ { SW_INSTALL, "install"}, ++ { SW_DEINSTALL, "deinstall"}, ++ { SW_PURGE, "purge"} ++}; ++ ++static const enum_map_t pkg_state_flag_map[] = { ++ { SF_OK, "ok"}, ++ { SF_REINSTREQ, "reinstreq"}, ++ { SF_HOLD, "hold"}, ++ { SF_REPLACE, "replace"}, ++ { SF_NOPRUNE, "noprune"}, ++ { SF_PREFER, "prefer"}, ++ { SF_OBSOLETE, "obsolete"}, ++ { SF_USER, "user"}, ++}; ++ ++static const enum_map_t pkg_state_status_map[] = { ++ { SS_NOT_INSTALLED, "not-installed" }, ++ { SS_UNPACKED, "unpacked" }, ++ { SS_HALF_CONFIGURED, "half-configured" }, ++ { SS_INSTALLED, "installed" }, ++ { SS_HALF_INSTALLED, "half-installed" }, ++ { SS_CONFIG_FILES, "config-files" }, ++ { SS_POST_INST_FAILED, "post-inst-failed" }, ++ { SS_REMOVAL_FAILED, "removal-failed" } ++}; ++ ++static int verrevcmp(const char *val, const char *ref); ++ ++ ++pkg_t *pkg_new(void) ++{ ++ pkg_t *pkg; ++ ++ pkg = malloc(sizeof(pkg_t)); ++ if (pkg == NULL) { ++ fprintf(stderr, "%s: out of memory\n", __FUNCTION__); ++ return NULL; ++ } ++ ++ pkg_init(pkg); ++ ++ return pkg; ++} ++ ++int pkg_init(pkg_t *pkg) ++{ ++ memset(pkg, 0, sizeof(pkg_t)); ++ pkg->name = NULL; ++ pkg->epoch = 0; ++ pkg->version = NULL; ++ pkg->revision = NULL; ++ pkg->familiar_revision = NULL; ++ pkg->dest = NULL; ++ pkg->src = NULL; ++ pkg->architecture = NULL; ++ pkg->maintainer = NULL; ++ pkg->section = NULL; ++ pkg->description = NULL; ++ pkg->state_want = SW_UNKNOWN; ++ pkg->state_flag = SF_OK; ++ pkg->state_status = SS_NOT_INSTALLED; ++ pkg->depends_str = NULL; ++ pkg->provides_str = NULL; ++ pkg->depends_count = 0; ++ pkg->depends = NULL; ++ pkg->suggests_str = NULL; ++ pkg->recommends_str = NULL; ++ pkg->suggests_count = 0; ++ pkg->recommends_count = 0; ++ ++ /* Abhaya: added init for conflicts fields */ ++ pkg->conflicts = NULL; ++ pkg->conflicts_count = 0; ++ ++ /* added for replaces. Jamey 7/23/2002 */ ++ pkg->replaces = NULL; ++ pkg->replaces_count = 0; ++ ++ pkg->pre_depends_count = 0; ++ pkg->pre_depends_str = NULL; ++ pkg->provides_count = 0; ++ pkg->provides = NULL; ++ pkg->filename = NULL; ++ pkg->local_filename = NULL; ++ pkg->tmp_unpack_dir = NULL; ++ pkg->md5sum = NULL; ++ pkg->size = NULL; ++ pkg->installed_size = NULL; ++ pkg->priority = NULL; ++ pkg->source = NULL; ++ conffile_list_init(&pkg->conffiles); ++ pkg->installed_files = NULL; ++ pkg->installed_files_ref_cnt = 0; ++ pkg->essential = 0; ++ pkg->provided_by_hand = 0; ++ ++ return 0; ++} ++ ++void pkg_deinit(pkg_t *pkg) ++{ ++ free(pkg->name); ++ pkg->name = NULL; ++ pkg->epoch = 0; ++ free(pkg->version); ++ pkg->version = NULL; ++ /* revision and familiar_revision share storage with version, so ++ don't free */ ++ pkg->revision = NULL; ++ pkg->familiar_revision = NULL; ++ /* owned by ipkg_conf_t */ ++ pkg->dest = NULL; ++ /* owned by ipkg_conf_t */ ++ pkg->src = NULL; ++ free(pkg->architecture); ++ pkg->architecture = NULL; ++ free(pkg->maintainer); ++ pkg->maintainer = NULL; ++ free(pkg->section); ++ pkg->section = NULL; ++ free(pkg->description); ++ pkg->description = NULL; ++ pkg->state_want = SW_UNKNOWN; ++ pkg->state_flag = SF_OK; ++ pkg->state_status = SS_NOT_INSTALLED; ++ free(pkg->depends_str); ++ pkg->depends_str = NULL; ++ free(pkg->provides_str); ++ pkg->provides_str = NULL; ++ pkg->depends_count = 0; ++ /* XXX: CLEANUP: MEMORY_LEAK: how to free up pkg->depends ? */ ++ pkg->pre_depends_count = 0; ++ free(pkg->pre_depends_str); ++ pkg->pre_depends_str = NULL; ++ pkg->provides_count = 0; ++ /* XXX: CLEANUP: MEMORY_LEAK: how to free up pkg->provides ? */ ++ /* XXX: CLEANUP: MEMORY_LEAK: how to free up pkg->suggests ? */ ++ free(pkg->filename); ++ pkg->filename = NULL; ++ free(pkg->local_filename); ++ pkg->local_filename = NULL; ++ /* CLEANUP: It'd be nice to pullin the cleanup function from ++ ipkg_install.c here. See comment in ++ ipkg_install.c:cleanup_temporary_files */ ++ free(pkg->tmp_unpack_dir); ++ pkg->tmp_unpack_dir = NULL; ++ free(pkg->md5sum); ++ pkg->md5sum = NULL; ++ free(pkg->size); ++ pkg->size = NULL; ++ free(pkg->installed_size); ++ pkg->installed_size = NULL; ++ free(pkg->priority); ++ pkg->priority = NULL; ++ free(pkg->source); ++ pkg->source = NULL; ++ conffile_list_deinit(&pkg->conffiles); ++ /* XXX: QUESTION: Is forcing this to 1 correct? I suppose so, ++ since if they are calling deinit, they should know. Maybe do an ++ assertion here instead? */ ++ pkg->installed_files_ref_cnt = 1; ++ pkg_free_installed_files(pkg); ++ pkg->essential = 0; ++} ++ ++int pkg_init_from_file(pkg_t *pkg, const char *filename) ++{ ++ int err; ++ char **raw; ++ FILE *control_file; ++ ++ err = pkg_init(pkg); ++ if (err) { return err; } ++ ++ pkg->local_filename = strdup(filename); ++ ++ control_file = tmpfile(); ++ err = pkg_extract_control_file_to_stream(pkg, control_file); ++ if (err) { return err; } ++ ++ rewind(control_file); ++ raw = read_raw_pkgs_from_stream(control_file); ++ pkg_parse_raw(pkg, &raw, NULL, NULL); ++ ++ fclose(control_file); ++ ++ return 0; ++} ++ ++/* Merge any new information in newpkg into oldpkg */ ++/* XXX: CLEANUP: This function shouldn't actually modify anything in ++ newpkg, but should leave it usable. This rework is so that ++ pkg_hash_insert doesn't clobber the pkg that you pass into it. */ ++/* ++ * uh, i thought that i had originally written this so that it took ++ * two pkgs and returned a new one? we can do that again... -sma ++ */ ++int pkg_merge(pkg_t *oldpkg, pkg_t *newpkg, int set_status) ++{ ++ if (oldpkg == newpkg) { ++ return 0; ++ } ++ ++ if (!oldpkg->src) ++ oldpkg->src = newpkg->src; ++ if (!oldpkg->dest) ++ oldpkg->dest = newpkg->dest; ++ if (!oldpkg->architecture) ++ oldpkg->architecture = str_dup_safe(newpkg->architecture); ++ if (!oldpkg->arch_priority) ++ oldpkg->arch_priority = newpkg->arch_priority; ++ if (!oldpkg->section) ++ oldpkg->section = str_dup_safe(newpkg->section); ++ if(!oldpkg->maintainer) ++ oldpkg->maintainer = str_dup_safe(newpkg->maintainer); ++ if(!oldpkg->description) ++ oldpkg->description = str_dup_safe(newpkg->description); ++ if (set_status) { ++ /* merge the state_flags from the new package */ ++ oldpkg->state_want = newpkg->state_want; ++ oldpkg->state_status = newpkg->state_status; ++ oldpkg->state_flag = newpkg->state_flag; ++ } else { ++ if (oldpkg->state_want == SW_UNKNOWN) ++ oldpkg->state_want = newpkg->state_want; ++ if (oldpkg->state_status == SS_NOT_INSTALLED) ++ oldpkg->state_status = newpkg->state_status; ++ oldpkg->state_flag |= newpkg->state_flag; ++ } ++ ++ if (!oldpkg->depends_str && !oldpkg->pre_depends_str && !oldpkg->recommends_str && !oldpkg->suggests_str) { ++ oldpkg->depends_str = newpkg->depends_str; ++ newpkg->depends_str = NULL; ++ oldpkg->depends_count = newpkg->depends_count; ++ newpkg->depends_count = 0; ++ ++ oldpkg->depends = newpkg->depends; ++ newpkg->depends = NULL; ++ ++ oldpkg->pre_depends_str = newpkg->pre_depends_str; ++ newpkg->pre_depends_str = NULL; ++ oldpkg->pre_depends_count = newpkg->pre_depends_count; ++ newpkg->pre_depends_count = 0; ++ ++ oldpkg->recommends_str = newpkg->recommends_str; ++ newpkg->recommends_str = NULL; ++ oldpkg->recommends_count = newpkg->recommends_count; ++ newpkg->recommends_count = 0; ++ ++ oldpkg->suggests_str = newpkg->suggests_str; ++ newpkg->suggests_str = NULL; ++ oldpkg->suggests_count = newpkg->suggests_count; ++ newpkg->suggests_count = 0; ++ } ++ ++ if (!oldpkg->provides_str) { ++ oldpkg->provides_str = newpkg->provides_str; ++ newpkg->provides_str = NULL; ++ oldpkg->provides_count = newpkg->provides_count; ++ newpkg->provides_count = 0; ++ ++ oldpkg->provides = newpkg->provides; ++ newpkg->provides = NULL; ++ } ++ ++ if (!oldpkg->conflicts_str) { ++ oldpkg->conflicts_str = newpkg->conflicts_str; ++ newpkg->conflicts_str = NULL; ++ oldpkg->conflicts_count = newpkg->conflicts_count; ++ newpkg->conflicts_count = 0; ++ ++ oldpkg->conflicts = newpkg->conflicts; ++ newpkg->conflicts = NULL; ++ } ++ ++ if (!oldpkg->replaces_str) { ++ oldpkg->replaces_str = newpkg->replaces_str; ++ newpkg->replaces_str = NULL; ++ oldpkg->replaces_count = newpkg->replaces_count; ++ newpkg->replaces_count = 0; ++ ++ oldpkg->replaces = newpkg->replaces; ++ newpkg->replaces = NULL; ++ } ++ ++ if (!oldpkg->filename) ++ oldpkg->filename = str_dup_safe(newpkg->filename); ++ if (0) ++ fprintf(stdout, "pkg=%s old local_filename=%s new local_filename=%s\n", ++ oldpkg->name, oldpkg->local_filename, newpkg->local_filename); ++ if (!oldpkg->local_filename) ++ oldpkg->local_filename = str_dup_safe(newpkg->local_filename); ++ if (!oldpkg->tmp_unpack_dir) ++ oldpkg->tmp_unpack_dir = str_dup_safe(newpkg->tmp_unpack_dir); ++ if (!oldpkg->md5sum) ++ oldpkg->md5sum = str_dup_safe(newpkg->md5sum); ++ if (!oldpkg->size) ++ oldpkg->size = str_dup_safe(newpkg->size); ++ if (!oldpkg->installed_size) ++ oldpkg->installed_size = str_dup_safe(newpkg->installed_size); ++ if (!oldpkg->priority) ++ oldpkg->priority = str_dup_safe(newpkg->priority); ++ if (!oldpkg->source) ++ oldpkg->source = str_dup_safe(newpkg->source); ++ if (oldpkg->conffiles.head == NULL){ ++ oldpkg->conffiles = newpkg->conffiles; ++ conffile_list_init(&newpkg->conffiles); ++ } ++ if (!oldpkg->installed_files){ ++ oldpkg->installed_files = newpkg->installed_files; ++ oldpkg->installed_files_ref_cnt = newpkg->installed_files_ref_cnt; ++ newpkg->installed_files = NULL; ++ } ++ if (!oldpkg->essential) ++ oldpkg->essential = newpkg->essential; ++ ++ return 0; ++} ++ ++abstract_pkg_t *abstract_pkg_new(void) ++{ ++ abstract_pkg_t * ab_pkg; ++ ++ ab_pkg = malloc(sizeof(abstract_pkg_t)); ++ ++ if (ab_pkg == NULL) { ++ fprintf(stderr, "%s: out of memory\n", __FUNCTION__); ++ return NULL; ++ } ++ ++ if ( abstract_pkg_init(ab_pkg) < 0 ) ++ return NULL; ++ ++ return ab_pkg; ++} ++ ++int abstract_pkg_init(abstract_pkg_t *ab_pkg) ++{ ++ memset(ab_pkg, 0, sizeof(abstract_pkg_t)); ++ ++ ab_pkg->provided_by = abstract_pkg_vec_alloc(); ++ if (ab_pkg->provided_by==NULL){ ++ return -1; ++ } ++ ab_pkg->dependencies_checked = 0; ++ ab_pkg->state_status = SS_NOT_INSTALLED; ++ ++ return 0; ++} ++ ++void set_flags_from_control(ipkg_conf_t *conf, pkg_t *pkg){ ++ char * temp_str; ++ char **raw =NULL; ++ char **raw_start=NULL; ++ ++ temp_str = (char *) malloc (strlen(pkg->dest->info_dir)+strlen(pkg->name)+12); ++ if (temp_str == NULL ){ ++ ipkg_message(conf, IPKG_INFO, "Out of memory in %s\n", __FUNCTION__); ++ return; ++ } ++ sprintf( temp_str,"%s/%s.control",pkg->dest->info_dir,pkg->name); ++ ++ raw = raw_start = read_raw_pkgs_from_file(temp_str); ++ if (raw == NULL ){ ++ ipkg_message(conf, IPKG_ERROR, "Unable to open the control file in %s\n", __FUNCTION__); ++ return; ++ } ++ ++ while(*raw){ ++ if (!pkg_valorize_other_field(pkg, &raw ) == 0) { ++ ipkg_message(conf, IPKG_DEBUG, "unable to read control file for %s. May be empty\n", pkg->name); ++ } ++ } ++ raw = raw_start; ++ while (*raw) { ++ if (raw!=NULL) ++ free(*raw++); ++ } ++ ++ free(raw_start); ++ free(temp_str); ++ ++ return ; ++ ++} ++ ++char * pkg_formatted_info(pkg_t *pkg ) ++{ ++ char *line; ++ char * buff; ++ ++ buff = malloc(8192); ++ if (buff == NULL) { ++ fprintf(stderr, "%s: out of memory\n", __FUNCTION__); ++ return NULL; ++ } ++ ++ buff[0] = '\0'; ++ ++ line = pkg_formatted_field(pkg, "Package"); ++ strncat(buff ,line, strlen(line)); ++ free(line); ++ ++ line = pkg_formatted_field(pkg, "Version"); ++ strncat(buff ,line, strlen(line)); ++ free(line); ++ ++ line = pkg_formatted_field(pkg, "Depends"); ++ strncat(buff ,line, strlen(line)); ++ free(line); ++ ++ line = pkg_formatted_field(pkg, "Recommends"); ++ strncat(buff ,line, strlen(line)); ++ free(line); ++ ++ line = pkg_formatted_field(pkg, "Suggests"); ++ strncat(buff ,line, strlen(line)); ++ free(line); ++ ++ line = pkg_formatted_field(pkg, "Provides"); ++ strncat(buff ,line, strlen(line)); ++ free(line); ++ ++ line = pkg_formatted_field(pkg, "Replaces"); ++ strncat(buff ,line, strlen(line)); ++ free(line); ++ ++ line = pkg_formatted_field(pkg, "Conflicts"); ++ strncat(buff ,line, strlen(line)); ++ free(line); ++ ++ line = pkg_formatted_field(pkg, "Status"); ++ strncat(buff ,line, strlen(line)); ++ free(line); ++ ++ line = pkg_formatted_field(pkg, "Section"); ++ strncat(buff ,line, strlen(line)); ++ free(line); ++ ++ line = pkg_formatted_field(pkg, "Essential"); /* @@@@ should be removed in future release. *//* I do not agree with this Pigi*/ ++ strncat(buff ,line, strlen(line)); ++ free(line); ++ ++ line = pkg_formatted_field(pkg, "Architecture"); ++ strncat(buff ,line, strlen(line)); ++ free(line); ++ ++ line = pkg_formatted_field(pkg, "Maintainer"); ++ strncat(buff ,line, strlen(line)); ++ free(line); ++ ++ line = pkg_formatted_field(pkg, "MD5sum"); ++ strncat(buff ,line, strlen(line)); ++ free(line); ++ ++ line = pkg_formatted_field(pkg, "Size"); ++ strncat(buff ,line, strlen(line)); ++ free(line); ++ ++ line = pkg_formatted_field(pkg, "Filename"); ++ strncat(buff ,line, strlen(line)); ++ free(line); ++ ++ line = pkg_formatted_field(pkg, "Conffiles"); ++ strncat(buff ,line, strlen(line)); ++ free(line); ++ ++ line = pkg_formatted_field(pkg, "Source"); ++ strncat(buff ,line, strlen(line)); ++ free(line); ++ ++ line = pkg_formatted_field(pkg, "Description"); ++ strncat(buff ,line, strlen(line)); ++ free(line); ++ ++ line = pkg_formatted_field(pkg, "Installed-Time"); ++ strncat(buff ,line, strlen(line)); ++ free(line); ++ ++ return buff; ++} ++ ++char * pkg_formatted_field(pkg_t *pkg, const char *field ) ++{ ++ static size_t LINE_LEN = 128; ++ char * temp = (char *)malloc(1); ++ int len = 0; ++ int flag_provide_false = 0; ++ ++/* ++ Pigi: After some discussion with Florian we decided to modify the full procedure in ++ dynamic memory allocation. This should avoid any other segv in this area ( except for bugs ) ++*/ ++ ++ if (strlen(field) < PKG_MINIMUM_FIELD_NAME_LEN) { ++ goto UNKNOWN_FMT_FIELD; ++ } ++ ++ temp[0]='\0'; ++ ++ switch (field[0]) ++ { ++ case 'a': ++ case 'A': ++ if (strcasecmp(field, "Architecture") == 0) { ++ /* Architecture */ ++ if (pkg->architecture) { ++ temp = (char *)realloc(temp,strlen(pkg->architecture)+17); ++ if ( temp == NULL ){ ++ fprintf(stderr, "%s: out of memory\n", __FUNCTION__); ++ return NULL; ++ } ++ temp[0]='\0'; ++ snprintf(temp, (strlen(pkg->architecture)+17), "Architecture: %s\n", pkg->architecture); ++ } ++ } else { ++ goto UNKNOWN_FMT_FIELD; ++ } ++ break; ++ case 'c': ++ case 'C': ++ if (strcasecmp(field, "Conffiles") == 0) { ++ /* Conffiles */ ++ conffile_list_elt_t *iter; ++ char confstr[LINE_LEN]; ++ ++ if (pkg->conffiles.head == NULL) { ++ return temp; ++ } ++ ++ len = 14 ; ++ for (iter = pkg->conffiles.head; iter; iter = iter->next) { ++ if (iter->data->name && iter->data->value) { ++ len = len + (strlen(iter->data->name)+strlen(iter->data->value)+5); ++ } ++ } ++ temp = (char *)realloc(temp,len); ++ if ( temp == NULL ){ ++ fprintf(stderr, "%s: out of memory\n", __FUNCTION__); ++ return NULL; ++ } ++ temp[0]='\0'; ++ strncpy(temp, "Conffiles:\n", 12); ++ for (iter = pkg->conffiles.head; iter; iter = iter->next) { ++ if (iter->data->name && iter->data->value) { ++ snprintf(confstr, LINE_LEN, "%s %s\n", iter->data->name, iter->data->value); ++ strncat(temp, confstr, strlen(confstr)); ++ } ++ } ++ } else if (strcasecmp(field, "Conflicts") == 0) { ++ int i; ++ ++ if (pkg->conflicts_count) { ++ char conflictstr[LINE_LEN]; ++ len = 14 ; ++ for(i = 0; i < pkg->conflicts_count; i++) { ++ len = len + (strlen(pkg->conflicts_str[i])+5); ++ } ++ temp = (char *)realloc(temp,len); ++ if ( temp == NULL ){ ++ fprintf(stderr, "%s: out of memory\n", __FUNCTION__); ++ return NULL; ++ } ++ temp[0]='\0'; ++ strncpy(temp, "Conflicts:", 11); ++ for(i = 0; i < pkg->conflicts_count; i++) { ++ snprintf(conflictstr, LINE_LEN, "%s %s", i == 0 ? "" : ",", pkg->conflicts_str[i]); ++ strncat(temp, conflictstr, strlen(conflictstr)); ++ } ++ strncat(temp, "\n", strlen("\n")); ++ } ++ } else { ++ goto UNKNOWN_FMT_FIELD; ++ } ++ break; ++ case 'd': ++ case 'D': ++ if (strcasecmp(field, "Depends") == 0) { ++ /* Depends */ ++ int i; ++ ++ if (pkg->depends_count) { ++ char depstr[LINE_LEN]; ++ len = 14 ; ++ for(i = 0; i < pkg->depends_count; i++) { ++ len = len + (strlen(pkg->depends_str[i])+4); ++ } ++ temp = (char *)realloc(temp,len); ++ if ( temp == NULL ){ ++ fprintf(stderr, "%s: out of memory\n", __FUNCTION__); ++ return NULL; ++ } ++ temp[0]='\0'; ++ strncpy(temp, "Depends:", 10); ++ for(i = 0; i < pkg->depends_count; i++) { ++ snprintf(depstr, LINE_LEN, "%s %s", i == 0 ? "" : ",", pkg->depends_str[i]); ++ strncat(temp, depstr, strlen(depstr)); ++ } ++ strncat(temp, "\n", strlen("\n")); ++ } ++ } else if (strcasecmp(field, "Description") == 0) { ++ /* Description */ ++ if (pkg->description) { ++ temp = (char *)realloc(temp,strlen(pkg->description)+16); ++ if ( temp == NULL ){ ++ fprintf(stderr, "%s: out of memory\n", __FUNCTION__); ++ return NULL; ++ } ++ temp[0]='\0'; ++ snprintf(temp, (strlen(pkg->description)+16), "Description: %s\n", pkg->description); ++ } ++ } else { ++ goto UNKNOWN_FMT_FIELD; ++ } ++ break; ++ case 'e': ++ case 'E': { ++ /* Essential */ ++ if (pkg->essential) { ++ temp = (char *)realloc(temp,16); ++ if ( temp == NULL ){ ++ fprintf(stderr, "%s: out of memory\n", __FUNCTION__); ++ return NULL; ++ } ++ temp[0]='\0'; ++ snprintf(temp, (16), "Essential: yes\n"); ++ } ++ } ++ break; ++ case 'f': ++ case 'F': { ++ /* Filename */ ++ if (pkg->filename) { ++ temp = (char *)realloc(temp,strlen(pkg->filename)+12); ++ if ( temp == NULL ){ ++ fprintf(stderr, "%s: out of memory\n", __FUNCTION__); ++ return NULL; ++ } ++ temp[0]='\0'; ++ snprintf(temp, (strlen(pkg->filename)+12), "Filename: %s\n", pkg->filename); ++ } ++ } ++ break; ++ case 'i': ++ case 'I': { ++ if (strcasecmp(field, "Installed-Size") == 0) { ++ /* Installed-Size */ ++ temp = (char *)realloc(temp,strlen(pkg->installed_size)+17); ++ if ( temp == NULL ){ ++ fprintf(stderr, "%s: out of memory\n", __FUNCTION__); ++ return NULL; ++ } ++ temp[0]='\0'; ++ snprintf(temp, (strlen(pkg->installed_size)+17), "Installed-Size: %s\n", pkg->installed_size); ++ } else if (strcasecmp(field, "Installed-Time") == 0 && pkg->installed_time) { ++ temp = (char *)realloc(temp,29); ++ if ( temp == NULL ){ ++ fprintf(stderr, "%s: out of memory\n", __FUNCTION__); ++ return NULL; ++ } ++ temp[0]='\0'; ++ snprintf(temp, 29, "Installed-Time: %lu\n", pkg->installed_time); ++ } ++ } ++ break; ++ case 'm': ++ case 'M': { ++ /* Maintainer | MD5sum */ ++ if (strcasecmp(field, "Maintainer") == 0) { ++ /* Maintainer */ ++ if (pkg->maintainer) { ++ temp = (char *)realloc(temp,strlen(pkg->maintainer)+14); ++ if ( temp == NULL ){ ++ fprintf(stderr, "%s: out of memory\n", __FUNCTION__); ++ return NULL; ++ } ++ temp[0]='\0'; ++ snprintf(temp, (strlen(pkg->maintainer)+14), "maintainer: %s\n", pkg->maintainer); ++ } ++ } else if (strcasecmp(field, "MD5sum") == 0) { ++ /* MD5sum */ ++ if (pkg->md5sum) { ++ temp = (char *)realloc(temp,strlen(pkg->md5sum)+11); ++ if ( temp == NULL ){ ++ fprintf(stderr, "%s: out of memory\n", __FUNCTION__); ++ return NULL; ++ } ++ temp[0]='\0'; ++ snprintf(temp, (strlen(pkg->md5sum)+11), "MD5Sum: %s\n", pkg->md5sum); ++ } ++ } else { ++ goto UNKNOWN_FMT_FIELD; ++ } ++ } ++ break; ++ case 'p': ++ case 'P': { ++ if (strcasecmp(field, "Package") == 0) { ++ /* Package */ ++ temp = (char *)realloc(temp,strlen(pkg->name)+11); ++ if ( temp == NULL ){ ++ fprintf(stderr, "%s: out of memory\n", __FUNCTION__); ++ return NULL; ++ } ++ temp[0]='\0'; ++ snprintf(temp, (strlen(pkg->name)+11), "Package: %s\n", pkg->name); ++ } else if (strcasecmp(field, "Priority") == 0) { ++ /* Priority */ ++ temp = (char *)realloc(temp,strlen(pkg->priority)+12); ++ if ( temp == NULL ){ ++ fprintf(stderr, "%s: out of memory\n", __FUNCTION__); ++ return NULL; ++ } ++ temp[0]='\0'; ++ snprintf(temp, (strlen(pkg->priority)+12), "Priority: %s\n", pkg->priority); ++ } else if (strcasecmp(field, "Provides") == 0) { ++ /* Provides */ ++ int i; ++ ++ if (pkg->provides_count) { ++ /* Here we check if the ipkg_internal_use_only is used, and we discard it.*/ ++ for ( i=0; i < pkg->provides_count; i++ ){ ++ if (strstr(pkg->provides_str[i],"ipkg_internal_use_only")!=NULL) { ++ memset (pkg->provides_str[i],'\x0',strlen(pkg->provides_str[i])); /* Pigi clear my trick flag, just in case */ ++ flag_provide_false = 1; ++ } ++ } ++ if ( !flag_provide_false || /* Pigi there is not my trick flag */ ++ ((flag_provide_false) && (pkg->provides_count > 1))){ /* Pigi There is, but we also have others Provides */ ++ char provstr[LINE_LEN]; ++ len = 15; ++ for(i = 0; i < pkg->provides_count; i++) { ++ len = len + (strlen(pkg->provides_str[i])+5); ++ } ++ temp = (char *)realloc(temp,len); ++ if ( temp == NULL ){ ++ fprintf(stderr, "%s: out of memory\n", __FUNCTION__); ++ return NULL; ++ } ++ temp[0]='\0'; ++ strncpy(temp, "Provides:", 12); ++ for(i = 0; i < pkg->provides_count; i++) { ++ if (strlen(pkg->provides_str[i])>0){; ++ snprintf(provstr, LINE_LEN, "%s %s", i == 1 ? "" : ",", pkg->provides_str[i]); ++ strncat(temp, provstr, strlen(provstr)); ++ } ++ } ++ strncat(temp, "\n", strlen("\n")); ++ } ++ } ++ } else { ++ goto UNKNOWN_FMT_FIELD; ++ } ++ } ++ break; ++ case 'r': ++ case 'R': { ++ int i; ++ /* Replaces | Recommends*/ ++ if (strcasecmp (field, "Replaces") == 0) { ++ if (pkg->replaces_count) { ++ char replstr[LINE_LEN]; ++ len = 14; ++ for (i = 0; i < pkg->replaces_count; i++) { ++ len = len + (strlen(pkg->replaces_str[i])+5); ++ } ++ temp = (char *)realloc(temp,len); ++ if ( temp == NULL ){ ++ fprintf(stderr, "%s: out of memory\n", __FUNCTION__); ++ return NULL; ++ } ++ temp[0]='\0'; ++ strncpy(temp, "Replaces:", 12); ++ for (i = 0; i < pkg->replaces_count; i++) { ++ snprintf(replstr, LINE_LEN, "%s %s", i == 0 ? "" : ",", pkg->replaces_str[i]); ++ strncat(temp, replstr, strlen(replstr)); ++ } ++ strncat(temp, "\n", strlen("\n")); ++ } ++ } else if (strcasecmp (field, "Recommends") == 0) { ++ if (pkg->recommends_count) { ++ char recstr[LINE_LEN]; ++ len = 15; ++ for(i = 0; i < pkg->recommends_count; i++) { ++ len = len + (strlen( pkg->recommends_str[i])+5); ++ } ++ temp = (char *)realloc(temp,len); ++ if ( temp == NULL ){ ++ fprintf(stderr, "%s: out of memory\n", __FUNCTION__); ++ return NULL; ++ } ++ temp[0]='\0'; ++ strncpy(temp, "Recommends:", 13); ++ for(i = 0; i < pkg->recommends_count; i++) { ++ snprintf(recstr, LINE_LEN, "%s %s", i == 0 ? "" : ",", pkg->recommends_str[i]); ++ strncat(temp, recstr, strlen(recstr)); ++ } ++ strncat(temp, "\n", strlen("\n")); ++ } ++ } else { ++ goto UNKNOWN_FMT_FIELD; ++ } ++ } ++ break; ++ case 's': ++ case 'S': { ++ /* Section | Size | Source | Status | Suggests */ ++ if (strcasecmp(field, "Section") == 0) { ++ /* Section */ ++ if (pkg->section) { ++ temp = (char *)realloc(temp,strlen(pkg->section)+11); ++ if ( temp == NULL ){ ++ fprintf(stderr, "%s: out of memory\n", __FUNCTION__); ++ return NULL; ++ } ++ temp[0]='\0'; ++ snprintf(temp, (strlen(pkg->section)+11), "Section: %s\n", pkg->section); ++ } ++ } else if (strcasecmp(field, "Size") == 0) { ++ /* Size */ ++ if (pkg->size) { ++ temp = (char *)realloc(temp,strlen(pkg->size)+8); ++ if ( temp == NULL ){ ++ fprintf(stderr, "%s: out of memory\n", __FUNCTION__); ++ return NULL; ++ } ++ temp[0]='\0'; ++ snprintf(temp, (strlen(pkg->size)+8), "Size: %s\n", pkg->size); ++ } ++ } else if (strcasecmp(field, "Source") == 0) { ++ /* Source */ ++ if (pkg->source) { ++ temp = (char *)realloc(temp,strlen(pkg->source)+10); ++ if ( temp == NULL ){ ++ fprintf(stderr, "%s: out of memory\n", __FUNCTION__); ++ return NULL; ++ } ++ temp[0]='\0'; ++ snprintf(temp, (strlen(pkg->source)+10), "Source: %s\n", pkg->source); ++ } ++ } else if (strcasecmp(field, "Status") == 0) { ++ /* Status */ ++ /* Benjamin Pineau note: we should avoid direct usage of ++ * strlen(arg) without keeping "arg" for later free() ++ */ ++ char *pflag=pkg_state_flag_to_str(pkg->state_flag); ++ char *pstat=pkg_state_status_to_str(pkg->state_status); ++ char *pwant=pkg_state_want_to_str(pkg->state_want); ++ ++ size_t sum_of_sizes = (size_t) ( strlen(pwant)+ strlen(pflag)+ strlen(pstat) + 12 ); ++ temp = (char *)realloc(temp,sum_of_sizes); ++ if ( temp == NULL ){ ++ fprintf(stderr, "%s: out of memory\n", __FUNCTION__); ++ return NULL; ++ } ++ temp[0]='\0'; ++ snprintf(temp, sum_of_sizes , "Status: %s %s %s\n", pwant, pflag, pstat); ++ free(pflag); ++ free(pwant); ++ if(pstat) /* pfstat can be NULL if ENOMEM */ ++ free(pstat); ++ } else if (strcasecmp(field, "Suggests") == 0) { ++ if (pkg->suggests_count) { ++ int i; ++ char sugstr[LINE_LEN]; ++ len = 13; ++ for(i = 0; i < pkg->suggests_count; i++) { ++ len = len + (strlen(pkg->suggests_str[i])+5); ++ } ++ temp = (char *)realloc(temp,len); ++ if ( temp == NULL ){ ++ fprintf(stderr, "%s: out of memory\n", __FUNCTION__); ++ return NULL; ++ } ++ temp[0]='\0'; ++ strncpy(temp, "Suggests:", 10); ++ for(i = 0; i < pkg->suggests_count; i++) { ++ snprintf(sugstr, LINE_LEN, "%s %s", i == 0 ? "" : ",", pkg->suggests_str[i]); ++ strncat(temp, sugstr, strlen(sugstr)); ++ } ++ strncat(temp, "\n", strlen("\n")); ++ } ++ } else { ++ goto UNKNOWN_FMT_FIELD; ++ } ++ } ++ break; ++ case 'v': ++ case 'V': { ++ /* Version */ ++ char *version = pkg_version_str_alloc(pkg); ++ temp = (char *)realloc(temp,strlen(version)+14); ++ if ( temp == NULL ){ ++ fprintf(stderr, "%s: out of memory\n", __FUNCTION__); ++ return NULL; ++ } ++ temp[0]='\0'; ++ snprintf(temp, (strlen(version)+12), "Version: %s\n", version); ++ free(version); ++ } ++ break; ++ default: ++ goto UNKNOWN_FMT_FIELD; ++ } ++ ++ if ( strlen(temp)<2 ) { ++ temp[0]='\0'; ++ } ++ return temp; ++ ++ UNKNOWN_FMT_FIELD: ++ fprintf(stderr, "%s: ERROR: Unknown field name: %s\n", __FUNCTION__, field); ++ if ( strlen(temp)<2 ) { ++ temp[0]='\0'; ++ } ++ ++ return temp; ++} ++ ++void pkg_print_info(pkg_t *pkg, FILE *file) ++{ ++ char * buff; ++ if (pkg == NULL) { ++ return; ++ } ++ ++ buff = pkg_formatted_info(pkg); ++ if ( buff == NULL ) ++ return; ++ if (strlen(buff)>2){ ++ fwrite(buff, 1, strlen(buff), file); ++ } ++ free(buff); ++} ++ ++void pkg_print_status(pkg_t * pkg, FILE * file) ++{ ++ if (pkg == NULL) { ++ return; ++ } ++ ++ /* XXX: QUESTION: Do we actually want more fields here? The ++ original idea was to save space by installing only what was ++ needed for actual computation, (package, version, status, ++ essential, conffiles). The assumption is that all other fields ++ can be found in th available file. ++ ++ But, someone proposed the idea to make it possible to ++ reconstruct a .ipk from an installed package, (ie. for beaming ++ from one handheld to another). So, maybe we actually want a few ++ more fields here, (depends, suggests, etc.), so that that would ++ be guaranteed to work even in the absence of more information ++ from the available file. ++ ++ 28-MAR-03: kergoth and I discussed this yesterday. We think ++ the essential info needs to be here for all installed packages ++ because they may not appear in the Packages files on various ++ feeds. Furthermore, one should be able to install from URL or ++ local storage without requiring a Packages file from any feed. ++ -Jamey ++ */ ++ pkg_print_field(pkg, file, "Package"); ++ pkg_print_field(pkg, file, "Version"); ++ pkg_print_field(pkg, file, "Depends"); ++ pkg_print_field(pkg, file, "Recommends"); ++ pkg_print_field(pkg, file, "Suggests"); ++ pkg_print_field(pkg, file, "Provides"); ++ pkg_print_field(pkg, file, "Replaces"); ++ pkg_print_field(pkg, file, "Conflicts"); ++ pkg_print_field(pkg, file, "Status"); ++ pkg_print_field(pkg, file, "Essential"); /* @@@@ should be removed in future release. */ ++ pkg_print_field(pkg, file, "Architecture"); ++ pkg_print_field(pkg, file, "Conffiles"); ++ pkg_print_field(pkg, file, "Installed-Time"); ++ fputs("\n", file); ++} ++ ++void pkg_print_field(pkg_t *pkg, FILE *file, const char *field) ++{ ++ char *buff; ++ if (strlen(field) < PKG_MINIMUM_FIELD_NAME_LEN) { ++ fprintf(stderr, "%s: ERROR: Unknown field name: %s\n", ++ __FUNCTION__, field); ++ } ++ buff = pkg_formatted_field(pkg, field); ++ if (strlen(buff)>2) { ++ fprintf(file, "%s", buff); ++ fflush(file); ++ } ++ free(buff); ++ return; ++} ++ ++/* ++ * libdpkg - Debian packaging suite library routines ++ * vercmp.c - comparison of version numbers ++ * ++ * Copyright (C) 1995 Ian Jackson <iwj10@cus.cam.ac.uk> ++ */ ++int pkg_compare_versions(const pkg_t *pkg, const pkg_t *ref_pkg) ++{ ++ int r; ++ ++ if (pkg->epoch > ref_pkg->epoch) { ++ return 1; ++ } ++ ++ if (pkg->epoch < ref_pkg->epoch) { ++ return -1; ++ } ++ ++ r = verrevcmp(pkg->version, ref_pkg->version); ++ if (r) { ++ return r; ++ } ++ ++#ifdef USE_DEBVERSION ++ r = verrevcmp(pkg->revision, ref_pkg->revision); ++ if (r) { ++ return r; ++ } ++ ++ r = verrevcmp(pkg->familiar_revision, ref_pkg->familiar_revision); ++#endif ++ ++ return r; ++} ++ ++int verrevcmp(const char *val, const char *ref) ++{ ++ int vc, rc; ++ long vl, rl; ++ const char *vp, *rp; ++ const char *vsep, *rsep; ++ ++ if (!val) val= ""; ++ if (!ref) ref= ""; ++ for (;;) { ++ vp= val; while (*vp && !isdigit(*vp)) vp++; ++ rp= ref; while (*rp && !isdigit(*rp)) rp++; ++ for (;;) { ++ vc= (val == vp) ? 0 : *val++; ++ rc= (ref == rp) ? 0 : *ref++; ++ if (!rc && !vc) break; ++ if (vc && !isalpha(vc)) vc += 256; /* assumes ASCII character set */ ++ if (rc && !isalpha(rc)) rc += 256; ++ if (vc != rc) return vc - rc; ++ } ++ val= vp; ++ ref= rp; ++ vl=0; if (isdigit(*vp)) vl= strtol(val,(char**)&val,10); ++ rl=0; if (isdigit(*rp)) rl= strtol(ref,(char**)&ref,10); ++ if (vl != rl) return vl - rl; ++ ++ vc = *val; ++ rc = *ref; ++ vsep = strchr(".-", vc); ++ rsep = strchr(".-", rc); ++ if (vsep && !rsep) return -1; ++ if (!vsep && rsep) return +1; ++ ++ if (!*val && !*ref) return 0; ++ if (!*val) return -1; ++ if (!*ref) return +1; ++ } ++} ++ ++int pkg_version_satisfied(pkg_t *it, pkg_t *ref, const char *op) ++{ ++ int r; ++ ++ r = pkg_compare_versions(it, ref); ++ ++ if (strcmp(op, "<=") == 0 || strcmp(op, "<") == 0) { ++ return r <= 0; ++ } ++ ++ if (strcmp(op, ">=") == 0 || strcmp(op, ">") == 0) { ++ return r >= 0; ++ } ++ ++ if (strcmp(op, "<<") == 0) { ++ return r < 0; ++ } ++ ++ if (strcmp(op, ">>") == 0) { ++ return r > 0; ++ } ++ ++ if (strcmp(op, "=") == 0) { ++ return r == 0; ++ } ++ ++ fprintf(stderr, "unknown operator: %s", op); ++ return 0; ++} ++ ++int pkg_name_version_and_architecture_compare(void *p1, void *p2) ++{ ++ const pkg_t *a = *(const pkg_t **)p1; ++ const pkg_t *b = *(const pkg_t **)p2; ++ int namecmp; ++ int vercmp; ++ if (!a->name || !b->name) { ++ fprintf(stderr, "pkg_name_version_and_architecture_compare: a=%p a->name=%p b=%p b->name=%p\n", ++ a, a->name, b, b->name); ++ return 0; ++ } ++ ++ namecmp = strcmp(a->name, b->name); ++ if (namecmp) ++ return namecmp; ++ vercmp = pkg_compare_versions(a, b); ++ if (vercmp) ++ return vercmp; ++ if (!a->arch_priority || !b->arch_priority) { ++ fprintf(stderr, "pkg_name_version_and_architecture_compare: a=%p a->arch_priority=%i b=%p b->arch_priority=%i\n", ++ a, a->arch_priority, b, b->arch_priority); ++ return 0; ++ } ++ if (a->arch_priority > b->arch_priority) ++ return 1; ++ if (a->arch_priority < b->arch_priority) ++ return -1; ++ return 0; ++} ++ ++int abstract_pkg_name_compare(void *p1, void *p2) ++{ ++ const abstract_pkg_t *a = *(const abstract_pkg_t **)p1; ++ const abstract_pkg_t *b = *(const abstract_pkg_t **)p2; ++ if (!a->name || !b->name) { ++ fprintf(stderr, "abstract_pkg_name_compare: a=%p a->name=%p b=%p b->name=%p\n", ++ a, a->name, b, b->name); ++ return 0; ++ } ++ return strcmp(a->name, b->name); ++} ++ ++ ++char *pkg_version_str_alloc(pkg_t *pkg) ++{ ++ char *complete_version; ++ char *epoch_str; ++#ifdef USE_DEBVERSION ++ char *revision_str; ++ char *familiar_revision_str; ++#endif ++ ++ if (pkg->epoch) { ++ sprintf_alloc(&epoch_str, "%d:", pkg->epoch); ++ } else { ++ epoch_str = strdup(""); ++ } ++ ++#ifdef USE_DEBVERSION ++ if (pkg->revision && strlen(pkg->revision)) { ++ sprintf_alloc(&revision_str, "-%s", pkg->revision); ++ } else { ++ revision_str = strdup(""); ++ } ++ ++ if (pkg->familiar_revision && strlen(pkg->familiar_revision)) { ++ sprintf_alloc(&familiar_revision_str, "-fam%s", pkg->familiar_revision); ++ } else { ++ familiar_revision_str = strdup(""); ++ } ++#endif ++ ++#ifdef USE_DEBVERSION ++ sprintf_alloc(&complete_version, "%s%s%s%s", ++ epoch_str, pkg->version, revision_str, familiar_revision_str); ++#else ++ sprintf_alloc(&complete_version, "%s%s", ++ epoch_str, pkg->version); ++#endif ++ ++ free(epoch_str); ++#ifdef USE_DEBVERSION ++ free(revision_str); ++ free(familiar_revision_str); ++#endif ++ ++ return complete_version; ++} ++ ++str_list_t *pkg_get_installed_files(pkg_t *pkg) ++{ ++ int err; ++ char *list_file_name = NULL; ++ FILE *list_file = NULL; ++ char *line; ++ char *installed_file_name; ++ int rootdirlen; ++ ++ pkg->installed_files_ref_cnt++; ++ ++ if (pkg->installed_files) { ++ return pkg->installed_files; ++ } ++ ++ pkg->installed_files = str_list_alloc(); ++ if (pkg->installed_files == NULL) { ++ fprintf(stderr, "%s: out of memory\n", __FUNCTION__); ++ return NULL; ++ } ++ ++ /* For uninstalled packages, get the file list firectly from the package. ++ For installed packages, look at the package.list file in the database. ++ */ ++ if (pkg->state_status == SS_NOT_INSTALLED || pkg->dest == NULL) { ++ if (pkg->local_filename == NULL) { ++ return pkg->installed_files; ++ } ++ /* XXX: CLEANUP: Maybe rewrite this to avoid using a temporary ++ file. In other words, change deb_extract so that it can ++ simply return the file list as a char *[] rather than ++ insisting on writing in to a FILE * as it does now. */ ++ list_file = tmpfile(); ++ err = pkg_extract_data_file_names_to_stream(pkg, list_file); ++ if (err) { ++ fclose(list_file); ++ fprintf(stderr, "%s: Error extracting file list from %s: %s\n", ++ __FUNCTION__, pkg->local_filename, strerror(err)); ++ return pkg->installed_files; ++ } ++ rewind(list_file); ++ } else { ++ sprintf_alloc(&list_file_name, "%s/%s.list", ++ pkg->dest->info_dir, pkg->name); ++ if (! file_exists(list_file_name)) { ++ free(list_file_name); ++ return pkg->installed_files; ++ } ++ ++ list_file = fopen(list_file_name, "r"); ++ if (list_file == NULL) { ++ fprintf(stderr, "WARNING: Cannot open %s: %s\n", ++ list_file_name, strerror(errno)); ++ free(list_file_name); ++ return pkg->installed_files; ++ } ++ free(list_file_name); ++ } ++ ++ rootdirlen = strlen( pkg->dest->root_dir ); ++ while (1) { ++ char *file_name; ++ ++ line = file_read_line_alloc(list_file); ++ if (line == NULL) { ++ break; ++ } ++ str_chomp(line); ++ file_name = line; ++ ++ /* Take pains to avoid uglies like "/./" in the middle of file_name. */ ++ if( strncmp( pkg->dest->root_dir, ++ file_name, ++ rootdirlen ) ) { ++ if (*file_name == '.') { ++ file_name++; ++ } ++ if (*file_name == '/') { ++ file_name++; ++ } ++ ++ /* Freed in pkg_free_installed_files */ ++ sprintf_alloc(&installed_file_name, "%s%s", pkg->dest->root_dir, file_name); ++ } else { ++ // already contains root_dir as header -> ABSOLUTE ++ sprintf_alloc(&installed_file_name, "%s", file_name); ++ } ++ str_list_append(pkg->installed_files, installed_file_name); ++ free(line); ++ } ++ ++ fclose(list_file); ++ ++ return pkg->installed_files; ++} ++ ++/* XXX: CLEANUP: This function and it's counterpart, ++ (pkg_get_installed_files), do not match our init/deinit naming ++ convention. Nor the alloc/free convention. But, then again, neither ++ of these conventions currrently fit the way these two functions ++ work. */ ++int pkg_free_installed_files(pkg_t *pkg) ++{ ++ str_list_elt_t *iter; ++ ++ pkg->installed_files_ref_cnt--; ++ if (pkg->installed_files_ref_cnt > 0) { ++ return 0; ++ } ++ ++ if (pkg->installed_files) { ++ ++ for (iter = pkg->installed_files->head; iter; iter = iter->next) { ++ /* malloced in pkg_get_installed_files */ ++ free (iter->data); ++ iter->data = NULL; ++ } ++ ++ str_list_deinit(pkg->installed_files); ++ } ++ ++ pkg->installed_files = NULL; ++ ++ return 0; ++} ++ ++int pkg_remove_installed_files_list(ipkg_conf_t *conf, pkg_t *pkg) ++{ ++ int err; ++ char *list_file_name; ++ ++ //I don't think pkg_free_installed_files should be called here. Jamey ++ //pkg_free_installed_files(pkg); ++ ++ sprintf_alloc(&list_file_name, "%s/%s.list", ++ pkg->dest->info_dir, pkg->name); ++ if (!conf->noaction) { ++ err = unlink(list_file_name); ++ free(list_file_name); ++ ++ if (err) { ++ return errno; ++ } ++ } ++ return 0; ++} ++ ++conffile_t *pkg_get_conffile(pkg_t *pkg, const char *file_name) ++{ ++ conffile_list_elt_t *iter; ++ conffile_t *conffile; ++ ++ if (pkg == NULL) { ++ return NULL; ++ } ++ ++ for (iter = pkg->conffiles.head; iter; iter = iter->next) { ++ conffile = iter->data; ++ ++ if (strcmp(conffile->name, file_name) == 0) { ++ return conffile; ++ } ++ } ++ ++ return NULL; ++} ++ ++int pkg_run_script(ipkg_conf_t *conf, pkg_t *pkg, ++ const char *script, const char *args) ++{ ++ int err; ++ char *path; ++ char *cmd; ++ ++ /* XXX: FEATURE: When conf->offline_root is set, we should run the ++ maintainer script within a chroot environment. */ ++ ++ /* Installed packages have scripts in pkg->dest->info_dir, uninstalled packages ++ have scripts in pkg->tmp_unpack_dir. */ ++ if (pkg->state_status == SS_INSTALLED || pkg->state_status == SS_UNPACKED) { ++ if (pkg->dest == NULL) { ++ fprintf(stderr, "%s: ERROR: installed package %s has a NULL dest\n", ++ __FUNCTION__, pkg->name); ++ return EINVAL; ++ } ++ sprintf_alloc(&path, "%s/%s.%s", pkg->dest->info_dir, pkg->name, script); ++ } else { ++ if (pkg->tmp_unpack_dir == NULL) { ++ fprintf(stderr, "%s: ERROR: uninstalled package %s has a NULL tmp_unpack_dir\n", ++ __FUNCTION__, pkg->name); ++ return EINVAL; ++ } ++ sprintf_alloc(&path, "%s/%s", pkg->tmp_unpack_dir, script); ++ } ++ ++ ipkg_message(conf, IPKG_INFO, "Running script %s\n", path); ++ if (conf->noaction) return 0; ++ ++ /* XXX: CLEANUP: There must be a better way to handle maintainer ++ scripts when running with offline_root mode and/or a dest other ++ than '/'. I've been playing around with some clever chroot ++ tricks and I might come up with something workable. */ ++ if (conf->offline_root) { ++ setenv("IPKG_OFFLINE_ROOT", conf->offline_root, 1); ++ } ++ ++ setenv("PKG_ROOT", ++ pkg->dest ? pkg->dest->root_dir : conf->default_dest->root_dir, 1); ++ ++ if (! file_exists(path)) { ++ free(path); ++ return 0; ++ } ++ ++ if (conf->offline_root) { ++ fprintf(stderr, "(offline root mode: not running %s.%s)\n", pkg->name, script); ++ free(path); ++ return 0; ++ } ++ ++ sprintf_alloc(&cmd, "%s %s", path, args); ++ free(path); ++ ++ err = xsystem(cmd); ++ free(cmd); ++ ++ if (err) { ++ fprintf(stderr, "%s script returned status %d\n", script, err); ++ return err; ++ } ++ ++ return 0; ++} ++ ++char *pkg_state_want_to_str(pkg_state_want_t sw) ++{ ++ int i; ++ ++ for (i=0; i < ARRAY_SIZE(pkg_state_want_map); i++) { ++ if (pkg_state_want_map[i].value == sw) { ++ return strdup(pkg_state_want_map[i].str); ++ } ++ } ++ ++ fprintf(stderr, "%s: ERROR: Illegal value for state_want: %d\n", ++ __FUNCTION__, sw); ++ return strdup("<STATE_WANT_UNKNOWN>"); ++} ++ ++pkg_state_want_t pkg_state_want_from_str(char *str) ++{ ++ int i; ++ ++ for (i=0; i < ARRAY_SIZE(pkg_state_want_map); i++) { ++ if (strcmp(str, pkg_state_want_map[i].str) == 0) { ++ return pkg_state_want_map[i].value; ++ } ++ } ++ ++ fprintf(stderr, "%s: ERROR: Illegal value for state_want string: %s\n", ++ __FUNCTION__, str); ++ return SW_UNKNOWN; ++} ++ ++char *pkg_state_flag_to_str(pkg_state_flag_t sf) ++{ ++ int i; ++ int len = 3; /* ok\000 is minimum */ ++ char *str = NULL; ++ ++ /* clear the temporary flags before converting to string */ ++ sf &= SF_NONVOLATILE_FLAGS; ++ ++ if (sf == 0) { ++ return strdup("ok"); ++ } else { ++ ++ for (i=0; i < ARRAY_SIZE(pkg_state_flag_map); i++) { ++ if (sf & pkg_state_flag_map[i].value) { ++ len += strlen(pkg_state_flag_map[i].str) + 1; ++ } ++ } ++ str = malloc(len); ++ if ( str == NULL ) { ++ fprintf(stderr, "%s: out of memory\n", __FUNCTION__); ++ return NULL; ++ } ++ str[0] = 0; ++ for (i=0; i < ARRAY_SIZE(pkg_state_flag_map); i++) { ++ if (sf & pkg_state_flag_map[i].value) { ++ strcat(str, pkg_state_flag_map[i].str); ++ strcat(str, ","); ++ } ++ } ++ len = strlen(str); ++ str[len-1] = 0; /* squash last comma */ ++ return str; ++ } ++} ++ ++pkg_state_flag_t pkg_state_flag_from_str(char *str) ++{ ++ int i; ++ int sf = SF_OK; ++ ++ if (strcmp(str, "ok") == 0) { ++ return SF_OK; ++ } ++ for (i=0; i < ARRAY_SIZE(pkg_state_flag_map); i++) { ++ const char *sfname = pkg_state_flag_map[i].str; ++ int sfname_len = strlen(sfname); ++ if (strncmp(str, sfname, sfname_len) == 0) { ++ sf |= pkg_state_flag_map[i].value; ++ str += sfname_len; ++ if (str[0] == ',') { ++ str++; ++ } else { ++ break; ++ } ++ } ++ } ++ ++ return sf; ++} ++ ++char *pkg_state_status_to_str(pkg_state_status_t ss) ++{ ++ int i; ++ ++ for (i=0; i < ARRAY_SIZE(pkg_state_status_map); i++) { ++ if (pkg_state_status_map[i].value == ss) { ++ return strdup(pkg_state_status_map[i].str); ++ } ++ } ++ ++ fprintf(stderr, "%s: ERROR: Illegal value for state_status: %d\n", ++ __FUNCTION__, ss); ++ return strdup("<STATE_STATUS_UNKNOWN>"); ++} ++ ++pkg_state_status_t pkg_state_status_from_str(char *str) ++{ ++ int i; ++ ++ for (i=0; i < ARRAY_SIZE(pkg_state_status_map); i++) { ++ if (strcmp(str, pkg_state_status_map[i].str) == 0) { ++ return pkg_state_status_map[i].value; ++ } ++ } ++ ++ fprintf(stderr, "%s: ERROR: Illegal value for state_status string: %s\n", ++ __FUNCTION__, str); ++ return SS_NOT_INSTALLED; ++} ++ ++int pkg_arch_supported(ipkg_conf_t *conf, pkg_t *pkg) ++{ ++ nv_pair_list_elt_t *l; ++ ++ if (!pkg->architecture) ++ return 1; ++ ++ l = conf->arch_list.head; ++ ++ while (l) { ++ nv_pair_t *nv = l->data; ++ if (strcmp(nv->name, pkg->architecture) == 0) { ++ ipkg_message(conf, IPKG_DEBUG, "arch %s (priority %s) supported for pkg %s\n", nv->name, nv->value, pkg->name); ++ return 1; ++ } ++ l = l->next; ++ } ++ ++ ipkg_message(conf, IPKG_DEBUG, "arch %s unsupported for pkg %s\n", pkg->architecture, pkg->name); ++ return 0; ++} ++ ++int pkg_get_arch_priority(ipkg_conf_t *conf, const char *archname) ++{ ++ nv_pair_list_elt_t *l; ++ ++ l = conf->arch_list.head; ++ ++ while (l) { ++ nv_pair_t *nv = l->data; ++ if (strcmp(nv->name, archname) == 0) { ++ int priority = strtol(nv->value, NULL, 0); ++ return priority; ++ } ++ l = l->next; ++ } ++ return 0; ++} ++ ++int pkg_info_preinstall_check(ipkg_conf_t *conf) ++{ ++ int i; ++ hash_table_t *pkg_hash = &conf->pkg_hash; ++ pkg_vec_t *available_pkgs = pkg_vec_alloc(); ++ pkg_vec_t *installed_pkgs = pkg_vec_alloc(); ++ ++ ipkg_message(conf, IPKG_INFO, "pkg_info_preinstall_check: updating arch priority for each package\n"); ++ pkg_hash_fetch_available(pkg_hash, available_pkgs); ++ /* update arch_priority for each package */ ++ for (i = 0; i < available_pkgs->len; i++) { ++ pkg_t *pkg = available_pkgs->pkgs[i]; ++ int arch_priority = 1; ++ if (!pkg) ++ continue; ++ // ipkg_message(conf, IPKG_DEBUG2, " package %s version=%s arch=%p:", pkg->name, pkg->version, pkg->architecture); ++ if (pkg->architecture) ++ arch_priority = pkg_get_arch_priority(conf, pkg->architecture); ++ else ++ ipkg_message(conf, IPKG_ERROR, "pkg_info_preinstall_check: no architecture for package %s\n", pkg->name); ++ // ipkg_message(conf, IPKG_DEBUG2, "%s arch_priority=%d\n", pkg->architecture, arch_priority); ++ pkg->arch_priority = arch_priority; ++ } ++ ++ for (i = 0; i < available_pkgs->len; i++) { ++ pkg_t *pkg = available_pkgs->pkgs[i]; ++ if (!pkg->arch_priority && (pkg->state_flag || (pkg->state_want != SW_UNKNOWN))) { ++ /* clear flags and want for any uninstallable package */ ++ ipkg_message(conf, IPKG_NOTICE, "Clearing state_want and state_flag for pkg=%s (arch_priority=%d flag=%d want=%d)\n", ++ pkg->name, pkg->arch_priority, pkg->state_flag, pkg->state_want); ++ pkg->state_want = SW_UNKNOWN; ++ pkg->state_flag = 0; ++ } ++ } ++ pkg_vec_free(available_pkgs); ++ ++ /* update the file owner data structure */ ++ ipkg_message(conf, IPKG_INFO, "pkg_info_preinstall_check: update file owner list\n"); ++ pkg_hash_fetch_all_installed(pkg_hash, installed_pkgs); ++ for (i = 0; i < installed_pkgs->len; i++) { ++ pkg_t *pkg = installed_pkgs->pkgs[i]; ++ str_list_t *installed_files = pkg_get_installed_files(pkg); /* this causes installed_files to be cached */ ++ str_list_elt_t *iter; ++ if (installed_files == NULL) { ++ ipkg_message(conf, IPKG_ERROR, "No installed files for pkg %s\n", pkg->name); ++ break; ++ } ++ for (iter = installed_files->head; iter; iter = iter->next) { ++ char *installed_file = iter->data; ++ // ipkg_message(conf, IPKG_DEBUG2, "pkg %s: file=%s\n", pkg->name, installed_file); ++ file_hash_set_file_owner(conf, installed_file, pkg); ++ } ++ } ++ pkg_vec_free(installed_pkgs); ++ ++ return 0; ++} ++ ++struct pkg_write_filelist_data { ++ ipkg_conf_t *conf; ++ pkg_t *pkg; ++ FILE *stream; ++}; ++ ++void pkg_write_filelist_helper(const char *key, void *entry_, void *data_) ++{ ++ struct pkg_write_filelist_data *data = data_; ++ pkg_t *entry = entry_; ++ if (entry == data->pkg) { ++ fprintf(data->stream, "%s\n", key); ++ } ++} ++ ++int pkg_write_filelist(ipkg_conf_t *conf, pkg_t *pkg) ++{ ++ struct pkg_write_filelist_data data; ++ char *list_file_name = NULL; ++ int err = 0; ++ ++ if (!pkg) { ++ ipkg_message(conf, IPKG_ERROR, "Null pkg\n"); ++ return -EINVAL; ++ } ++ ipkg_message(conf, IPKG_INFO, ++ " creating %s.list file\n", pkg->name); ++ sprintf_alloc(&list_file_name, "%s/%s.list", pkg->dest->info_dir, pkg->name); ++ if (!list_file_name) { ++ ipkg_message(conf, IPKG_ERROR, "Failed to alloc list_file_name\n"); ++ return -ENOMEM; ++ } ++ ipkg_message(conf, IPKG_INFO, ++ " creating %s file for pkg %s\n", list_file_name, pkg->name); ++ data.stream = fopen(list_file_name, "w"); ++ if (!data.stream) { ++ ipkg_message(conf, IPKG_ERROR, "Could not open %s for writing: %s\n", ++ list_file_name, strerror(errno)); ++ return errno; ++ } ++ data.pkg = pkg; ++ data.conf = conf; ++ hash_table_foreach(&conf->file_hash, pkg_write_filelist_helper, &data); ++ fclose(data.stream); ++ free(list_file_name); ++ ++ return err; ++} ++ ++int pkg_write_changed_filelists(ipkg_conf_t *conf) ++{ ++ pkg_vec_t *installed_pkgs = pkg_vec_alloc(); ++ hash_table_t *pkg_hash = &conf->pkg_hash; ++ int i; ++ int err; ++ if (conf->noaction) ++ return 0; ++ ++ ipkg_message(conf, IPKG_INFO, "%s: saving changed filelists\n", __FUNCTION__); ++ pkg_hash_fetch_all_installed(pkg_hash, installed_pkgs); ++ for (i = 0; i < installed_pkgs->len; i++) { ++ pkg_t *pkg = installed_pkgs->pkgs[i]; ++ if (pkg->state_flag & SF_FILELIST_CHANGED) { ++ ipkg_message(conf, IPKG_DEBUG, "Calling pkg_write_filelist for pkg=%s from %s\n", pkg->name, __FUNCTION__); ++ err = pkg_write_filelist(conf, pkg); ++ if (err) ++ ipkg_message(conf, IPKG_NOTICE, "pkg_write_filelist pkg=%s returned %d\n", pkg->name, err); ++ } ++ } ++ return 0; ++} +diff -ruN busybox-1.2.0-orig/archival/libipkg/pkg_depends.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_depends.c +--- busybox-1.2.0-orig/archival/libipkg/pkg_depends.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_depends.c 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,1033 @@ ++/* pkg_depends.c - the itsy package management system ++ ++ Steven M. Ayer ++ ++ Copyright (C) 2002 Compaq Computer Corporation ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#include "ipkg.h" ++#include <errno.h> ++#include <ctype.h> ++ ++#include "pkg.h" ++#include "ipkg_utils.h" ++#include "pkg_hash.h" ++#include "ipkg_message.h" ++#include "pkg_parse.h" ++#include "hash_table.h" ++ ++static int parseDepends(compound_depend_t *compound_depend, hash_table_t * hash, char * depend_str); ++static depend_t * depend_init(void); ++static void depend_deinit(depend_t *d); ++static char ** add_unresolved_dep(pkg_t * pkg, char ** the_lost, int ref_ndx); ++static char ** merge_unresolved(char ** oldstuff, char ** newstuff); ++static int is_pkg_in_pkg_vec(pkg_vec_t * vec, pkg_t * pkg); ++ ++static int pkg_installed_and_constraint_satisfied(pkg_t *pkg, void *cdata) ++{ ++ depend_t *depend = (depend_t *)cdata; ++ if ((pkg->state_status == SS_INSTALLED || pkg->state_status == SS_UNPACKED) && version_constraints_satisfied(depend, pkg)) ++ return 1; ++ else ++ return 0; ++} ++ ++static int pkg_constraint_satisfied(pkg_t *pkg, void *cdata) ++{ ++ depend_t *depend = (depend_t *)cdata; ++#if 0 ++ pkg_t * temp = pkg_new(); ++ int comparison; ++ parseVersion(temp, depend->version); ++ comparison = pkg_compare_versions(pkg, temp); ++ free(temp); ++ ++ fprintf(stderr, "%s: pkg=%s pkg->version=%s constraint=%p type=%d version=%s comparison=%d satisfied=%d\n", ++ __FUNCTION__, pkg->name, pkg->version, ++ depend, depend->constraint, depend->version, ++ comparison, version_constraints_satisfied(depend, pkg)); ++#endif ++ if (version_constraints_satisfied(depend, pkg)) ++ return 1; ++ else ++ return 0; ++} ++ ++/* returns ndependences or negative error value */ ++int pkg_hash_fetch_unsatisfied_dependencies(ipkg_conf_t *conf, pkg_t * pkg, ++ pkg_vec_t *unsatisfied, char *** unresolved) ++{ ++ pkg_t * satisfier_entry_pkg; ++ register int i, j, k; ++ int count, found; ++ char ** the_lost; ++ abstract_pkg_t * ab_pkg; ++ ++ /* ++ * this is a setup to check for redundant/cyclic dependency checks, ++ * which are marked at the abstract_pkg level ++ */ ++ if (!(ab_pkg = pkg->parent)) { ++ fprintf(stderr, "%s:%d: something terribly wrong with pkg %s\n", __FUNCTION__, __LINE__, pkg->name); ++ *unresolved = NULL; ++ return 0; ++ } ++ if (ab_pkg->dependencies_checked) { /* avoid duplicate or cyclic checks */ ++ *unresolved = NULL; ++ return 0; ++ } else { ++ ab_pkg->dependencies_checked = 1; /* mark it for subsequent visits */ ++ } ++ /**/ ++ ++ count = pkg->pre_depends_count + pkg->depends_count + pkg->recommends_count + pkg->suggests_count; ++ if (!count){ ++ *unresolved = NULL; ++ return 0; ++ } ++ ++ the_lost = NULL; ++ ++ /* foreach dependency */ ++ for (i = 0; i < count; i++) { ++ compound_depend_t * compound_depend = &pkg->depends[i]; ++ depend_t ** possible_satisfiers = compound_depend->possibilities;; ++ found = 0; ++ satisfier_entry_pkg = NULL; ++ ++ if (compound_depend->type == GREEDY_DEPEND) { ++ /* foreach possible satisfier */ ++ for (j = 0; j < compound_depend->possibility_count; j++) { ++ /* foreach provided_by, which includes the abstract_pkg itself */ ++ abstract_pkg_t *abpkg = possible_satisfiers[j]->pkg; ++ abstract_pkg_vec_t *ab_provider_vec = abpkg->provided_by; ++ int nposs = ab_provider_vec->len; ++ abstract_pkg_t **ab_providers = ab_provider_vec->pkgs; ++ int l; ++ for (l = 0; l < nposs; l++) { ++ pkg_vec_t *test_vec = ab_providers[l]->pkgs; ++ /* if no depends on this one, try the first package that Provides this one */ ++ if (!test_vec){ /* no pkg_vec hooked up to the abstract_pkg! (need another feed?) */ ++ continue; ++ } ++ ++ /* cruise this possiblity's pkg_vec looking for an installed version */ ++ for (k = 0; k < test_vec->len; k++) { ++ pkg_t *pkg_scout = test_vec->pkgs[k]; ++ /* not installed, and not already known about? */ ++ if ((pkg_scout->state_want != SW_INSTALL) ++ && !pkg_scout->parent->dependencies_checked ++ && !is_pkg_in_pkg_vec(unsatisfied, pkg_scout)) { ++ char ** newstuff = NULL; ++ int rc; ++ pkg_vec_t *tmp_vec = pkg_vec_alloc (); ++ /* check for not-already-installed dependencies */ ++ rc = pkg_hash_fetch_unsatisfied_dependencies(conf, ++ pkg_scout, ++ tmp_vec, ++ &newstuff); ++ if (newstuff == NULL) { ++ int i; ++ int ok = 1; ++ for (i = 0; i < rc; i++) { ++ pkg_t *p = tmp_vec->pkgs[i]; ++ if (p->state_want == SW_INSTALL) ++ continue; ++ ipkg_message(conf, IPKG_DEBUG, "not installing %s due to requirement for %s\n", pkg_scout->name, p->name); ++ ok = 0; ++ break; ++ } ++ pkg_vec_free (tmp_vec); ++ if (ok) { ++ /* mark this one for installation */ ++ ipkg_message(conf, IPKG_NOTICE, "Adding satisfier for greedy dependence: %s\n", pkg_scout->name); ++ pkg_vec_insert(unsatisfied, pkg_scout); ++ } ++ } else { ++ ipkg_message(conf, IPKG_DEBUG, "not installing %s due to broken depends \n", pkg_scout->name); ++ free (newstuff); ++ } ++ } ++ } ++ } ++ } ++ ++ continue; ++ } ++ ++ /* foreach possible satisfier, look for installed package */ ++ for (j = 0; j < compound_depend->possibility_count; j++) { ++ /* foreach provided_by, which includes the abstract_pkg itself */ ++ depend_t *dependence_to_satisfy = possible_satisfiers[j]; ++ abstract_pkg_t *satisfying_apkg = possible_satisfiers[j]->pkg; ++ pkg_t *satisfying_pkg = ++ pkg_hash_fetch_best_installation_candidate(conf, satisfying_apkg, ++ pkg_installed_and_constraint_satisfied, ++ dependence_to_satisfy, 1); ++ /* Being that I can't test constraing in pkg_hash, I will test it here */ ++ if (satisfying_pkg != NULL) { ++ if (!pkg_installed_and_constraint_satisfied ( satisfying_pkg,dependence_to_satisfy)) { ++ satisfying_pkg = NULL; ++ } ++ } ++ ipkg_message(conf, IPKG_DEBUG, "%s:%d: satisfying_pkg=%p \n", __FILE__, __LINE__, satisfying_pkg); ++ if (satisfying_pkg != NULL) { ++ found = 1; ++ break; ++ } ++ ++ } ++ /* if nothing installed matches, then look for uninstalled satisfier */ ++ if (!found) { ++ /* foreach possible satisfier, look for installed package */ ++ for (j = 0; j < compound_depend->possibility_count; j++) { ++ /* foreach provided_by, which includes the abstract_pkg itself */ ++ depend_t *dependence_to_satisfy = possible_satisfiers[j]; ++ abstract_pkg_t *satisfying_apkg = possible_satisfiers[j]->pkg; ++ pkg_t *satisfying_pkg = ++ pkg_hash_fetch_best_installation_candidate(conf, satisfying_apkg, ++ pkg_constraint_satisfied, ++ dependence_to_satisfy, 1); ++ /* Being that I can't test constraing in pkg_hash, I will test it here too */ ++ if (satisfying_pkg != NULL) { ++ if (!pkg_constraint_satisfied ( satisfying_pkg,dependence_to_satisfy)) { ++ satisfying_pkg = NULL; ++ } ++ } ++ ++ /* user request overrides package recommendation */ ++ if (satisfying_pkg != NULL ++ && (compound_depend->type == RECOMMEND || compound_depend->type == SUGGEST) ++ && (satisfying_pkg->state_want == SW_DEINSTALL || satisfying_pkg->state_want == SW_PURGE)) { ++ ipkg_message (conf, IPKG_NOTICE, "%s: ignoring recommendation for %s at user request\n", ++ pkg->name, satisfying_pkg->name); ++ continue; ++ } ++ ++ ipkg_message(conf, IPKG_DEBUG, "%s:%d: satisfying_pkg=%p\n", __FILE__, __LINE__, satisfying_pkg); ++ if (satisfying_pkg != NULL) { ++ satisfier_entry_pkg = satisfying_pkg; ++ break; ++ } ++ } ++ } ++ ++ /* we didn't find one, add something to the unsatisfied vector */ ++ if (!found) { ++ if (!satisfier_entry_pkg) { ++ /* failure to meet recommendations is not an error */ ++ if (compound_depend->type != RECOMMEND && compound_depend->type != SUGGEST) ++ the_lost = add_unresolved_dep(pkg, the_lost, i); ++ else ++ ipkg_message (conf, IPKG_NOTICE, "%s: unsatisfied recommendation for %s\n", ++ pkg->name, compound_depend->possibilities[0]->pkg->name); ++ } ++ else { ++ if (compound_depend->type == SUGGEST) { ++ /* just mention it politely */ ++ ipkg_message (conf, IPKG_NOTICE, "package %s suggests installing %s\n", ++ pkg->name, satisfier_entry_pkg->name); ++ } else { ++ char ** newstuff = NULL; ++ ++ if (satisfier_entry_pkg != pkg && ++ !is_pkg_in_pkg_vec(unsatisfied, satisfier_entry_pkg)) { ++ pkg_vec_insert(unsatisfied, satisfier_entry_pkg); ++ pkg_hash_fetch_unsatisfied_dependencies(conf, ++ satisfier_entry_pkg, ++ unsatisfied, ++ &newstuff); ++ the_lost = merge_unresolved(the_lost, newstuff); ++ } ++ } ++ } ++ } ++ } ++ *unresolved = the_lost; ++ ++ return unsatisfied->len; ++} ++ ++/*checking for conflicts !in replaces ++ If a packages conflicts with another but is also replacing it, I should not consider it a ++ really conflicts ++ returns 0 if conflicts <> replaces or 1 if conflicts == replaces ++*/ ++int is_pkg_a_replaces(pkg_t *pkg_scout,pkg_t *pkg) ++{ ++ int i ; ++ int replaces_count = pkg->replaces_count; ++ abstract_pkg_t **replaces; ++ ++ if (pkg->replaces_count==0) // No replaces, it's surely a conflict ++ return 0; ++ ++ replaces = pkg->replaces; ++ ++ for (i = 0; i < replaces_count; i++) { ++ if (strcmp(pkg_scout->name,pkg->replaces[i]->name)==0) { // Found ++ ipkg_message(NULL, IPKG_DEBUG2, "Seems I've found a replace %s %s \n",pkg_scout->name,pkg->replaces[i]->name); ++ return 1; ++ } ++ } ++ return 0; ++ ++} ++ ++ ++/* Abhaya: added support for conflicts */ ++pkg_vec_t * pkg_hash_fetch_conflicts(hash_table_t * hash, pkg_t * pkg) ++{ ++ pkg_vec_t * installed_conflicts, * test_vec; ++ compound_depend_t * conflicts; ++ depend_t ** possible_satisfiers; ++ depend_t * possible_satisfier; ++ register int i, j, k; ++ int count; ++ abstract_pkg_t * ab_pkg; ++ pkg_t **pkg_scouts; ++ pkg_t *pkg_scout; ++ ++ /* ++ * this is a setup to check for redundant/cyclic dependency checks, ++ * which are marked at the abstract_pkg level ++ */ ++ if(!(ab_pkg = pkg->parent)){ ++ fprintf(stderr, "dependency check error. pkg %s isn't in hash table\n", pkg->name); ++ return (pkg_vec_t *)NULL; ++ } ++ ++ conflicts = pkg->conflicts; ++ if(!conflicts){ ++ return (pkg_vec_t *)NULL; ++ } ++ installed_conflicts = pkg_vec_alloc(); ++ ++ count = pkg->conflicts_count; ++ ++ ++ ++ /* foreach conflict */ ++ for(i = 0; i < pkg->conflicts_count; i++){ ++ ++ possible_satisfiers = conflicts->possibilities; ++ ++ /* foreach possible satisfier */ ++ for(j = 0; j < conflicts->possibility_count; j++){ ++ possible_satisfier = possible_satisfiers[j]; ++ if (!possible_satisfier) ++ fprintf(stderr, "%s:%d: possible_satisfier is null\n", __FUNCTION__, __LINE__); ++ if (!possible_satisfier->pkg) ++ fprintf(stderr, "%s:%d: possible_satisfier->pkg is null\n", __FUNCTION__, __LINE__); ++ test_vec = possible_satisfier->pkg->pkgs; ++ if (test_vec) { ++ /* pkg_vec found, it is an actual package conflict ++ * cruise this possiblity's pkg_vec looking for an installed version */ ++ pkg_scouts = test_vec->pkgs; ++ for(k = 0; k < test_vec->len; k++){ ++ pkg_scout = pkg_scouts[k]; ++ if (!pkg_scout) { ++ fprintf(stderr, "%s: null pkg scout\n", __FUNCTION__); ++ continue; ++ } ++ if ((pkg_scout->state_status == SS_INSTALLED || pkg_scout->state_want == SW_INSTALL) && ++ version_constraints_satisfied(possible_satisfier, pkg_scout) && !is_pkg_a_replaces(pkg_scout,pkg)){ ++ if (!is_pkg_in_pkg_vec(installed_conflicts, pkg_scout)){ ++ pkg_vec_insert(installed_conflicts, pkg_scout); ++ } ++ } ++ } ++ } ++ } ++ conflicts++; ++ } ++ ++ if (installed_conflicts->len) ++ return installed_conflicts; ++ pkg_vec_free(installed_conflicts); ++ return (pkg_vec_t *)NULL; ++} ++ ++int version_constraints_satisfied(depend_t * depends, pkg_t * pkg) ++{ ++ pkg_t * temp; ++ int comparison; ++ ++ if(depends->constraint == NONE) ++ return 1; ++ ++ temp = pkg_new(); ++ ++ parseVersion(temp, depends->version); ++ ++ comparison = pkg_compare_versions(pkg, temp); ++ ++ free(temp); ++ ++ if((depends->constraint == EARLIER) && ++ (comparison < 0)) ++ return 1; ++ else if((depends->constraint == LATER) && ++ (comparison > 0)) ++ return 1; ++ else if(comparison == 0) ++ return 1; ++ else if((depends->constraint == LATER_EQUAL) && ++ (comparison >= 0)) ++ return 1; ++ else if((depends->constraint == EARLIER_EQUAL) && ++ (comparison <= 0)) ++ return 1; ++ ++ return 0; ++} ++ ++int pkg_dependence_satisfiable(ipkg_conf_t *conf, depend_t *depend) ++{ ++ abstract_pkg_t *apkg = depend->pkg; ++ abstract_pkg_vec_t *provider_apkgs = apkg->provided_by; ++ int n_providers = provider_apkgs->len; ++ abstract_pkg_t **apkgs = provider_apkgs->pkgs; ++ pkg_vec_t *pkg_vec; ++ int n_pkgs ; ++ int i; ++ int j; ++ ++ for (i = 0; i < n_providers; i++) { ++ abstract_pkg_t *papkg = apkgs[i]; ++ pkg_vec = papkg->pkgs; ++ if (pkg_vec) { ++ n_pkgs = pkg_vec->len; ++ for (j = 0; j < n_pkgs; j++) { ++ pkg_t *pkg = pkg_vec->pkgs[j]; ++ if (version_constraints_satisfied(depend, pkg)) { ++ return 1; ++ } ++ } ++ } ++ } ++ return 0; ++} ++ ++int pkg_dependence_satisfied(ipkg_conf_t *conf, depend_t *depend) ++{ ++ abstract_pkg_t *apkg = depend->pkg; ++ abstract_pkg_vec_t *provider_apkgs = apkg->provided_by; ++ int n_providers = provider_apkgs->len; ++ abstract_pkg_t **apkgs = provider_apkgs->pkgs; ++ int i; ++ int n_pkgs; ++ int j; ++ ++ for (i = 0; i < n_providers; i++) { ++ abstract_pkg_t *papkg = apkgs[i]; ++ pkg_vec_t *pkg_vec = papkg->pkgs; ++ if (pkg_vec) { ++ n_pkgs = pkg_vec->len; ++ for (j = 0; j < n_pkgs; j++) { ++ pkg_t *pkg = pkg_vec->pkgs[j]; ++ if (version_constraints_satisfied(depend, pkg)) { ++ if (pkg->state_status == SS_INSTALLED || pkg->state_status == SS_UNPACKED) ++ return 1; ++ } ++ } ++ } ++ } ++ return 0; ++} ++ ++static int is_pkg_in_pkg_vec(pkg_vec_t * vec, pkg_t * pkg) ++{ ++ register int i; ++ pkg_t ** pkgs = vec->pkgs; ++ ++ for(i = 0; i < vec->len; i++) ++ if((strcmp(pkg->name, (*(pkgs + i))->name) == 0) ++ && (pkg_compare_versions(pkg, *(pkgs + i)) == 0) ++ && (strcmp(pkg->architecture, (*(pkgs + i))->architecture) == 0)) ++ return 1; ++ return 0; ++} ++ ++ ++#ifdef DeadCode ++/** ++ * pkg_has_common_provides returns 1 if pkg and replacee both provide ++ * the same abstract package and 0 otherwise. ++ */ ++int pkg_has_common_provides(pkg_t *pkg, pkg_t *replacee) ++{ ++ abstract_pkg_t **provides = pkg->provides; ++ int provides_count = pkg->provides_count; ++ abstract_pkg_t **replacee_provides = replacee->provides; ++ int replacee_provides_count = replacee->provides_count; ++ int i, j; ++ for (i = 0; i < provides_count; i++) { ++ abstract_pkg_t *apkg = provides[i]; ++ for (j = 0; j < replacee_provides_count; j++) { ++ abstract_pkg_t *replacee_apkg = replacee_provides[i]; ++ if (apkg == replacee_apkg) ++ return 1; ++ } ++ } ++ return 0; ++} ++#endif ++ ++/** ++ * pkg_provides_abstract returns 1 if pkg->provides contains providee ++ * and 0 otherwise. ++ */ ++int pkg_provides_abstract(pkg_t *pkg, abstract_pkg_t *providee) ++{ ++ abstract_pkg_t **provides = pkg->provides; ++ int provides_count = pkg->provides_count; ++ int i; ++ for (i = 0; i < provides_count; i++) { ++ if (provides[i] == providee) ++ return 1; ++ } ++ return 0; ++} ++ ++/** ++ * pkg_replaces returns 1 if pkg->replaces contains one of replacee's provides and 0 ++ * otherwise. ++ */ ++int pkg_replaces(pkg_t *pkg, pkg_t *replacee) ++{ ++ abstract_pkg_t **replaces = pkg->replaces; ++ int replaces_count = pkg->replaces_count; ++ /* abstract_pkg_t **replacee_provides = pkg->provides; ++ int replacee_provides_count = pkg->provides_count; */ ++ int i, j; ++ for (i = 0; i < replaces_count; i++) { ++ abstract_pkg_t *abstract_replacee = replaces[i]; ++ for (j = 0; j < replaces_count; j++) { ++ /* ipkg_message(NULL, IPKG_DEBUG2, "Searching pkg-name %s repprovname %s absrepname %s \n", ++ pkg->name,replacee->provides[j]->name, abstract_replacee->name); */ ++ if (replacee->provides[j] == abstract_replacee) ++ return 1; ++ } ++ } ++ return 0; ++} ++ ++ ++/** ++ * pkg_conflicts_abstract returns 1 if pkg->conflicts contains conflictee and 0 ++ * otherwise. ++ */ ++int pkg_conflicts_abstract(pkg_t *pkg, abstract_pkg_t *conflictee) ++{ ++ compound_depend_t *conflicts = pkg->conflicts; ++ int conflicts_count = pkg->conflicts_count; ++ int i, j; ++ for (i = 0; i < conflicts_count; i++) { ++ int possibility_count = conflicts[i].possibility_count; ++ struct depend **possibilities = conflicts[i].possibilities; ++ for (j = 0; j < possibility_count; j++) { ++ if (possibilities[j]->pkg == conflictee) { ++ return 1; ++ } ++ } ++ } ++ return 0; ++} ++ ++/** ++ * pkg_conflicts returns 1 if pkg->conflicts contains one of ++ * conflictee's provides and 0 otherwise. ++ */ ++int pkg_conflicts(pkg_t *pkg, pkg_t *conflictee) ++{ ++ compound_depend_t *conflicts = pkg->conflicts; ++ int conflicts_count = pkg->conflicts_count; ++ abstract_pkg_t **conflictee_provides = conflictee->provides; ++ int conflictee_provides_count = conflictee->provides_count; ++ int i, j, k; ++ int possibility_count; ++ struct depend **possibilities; ++ abstract_pkg_t *possibility ; ++ ++ for (i = 0; i < conflicts_count; i++) { ++ possibility_count = conflicts[i].possibility_count; ++ possibilities = conflicts[i].possibilities; ++ for (j = 0; j < possibility_count; j++) { ++ possibility = possibilities[j]->pkg; ++ for (k = 0; k < conflictee_provides_count; k++) { ++ if (possibility == conflictee_provides[k]) { ++ return 1; ++ } ++ } ++ } ++ } ++ return 0; ++} ++ ++static char ** merge_unresolved(char ** oldstuff, char ** newstuff) ++{ ++ int oldlen = 0, newlen = 0; ++ char ** result; ++ register int i, j; ++ ++ if(!newstuff) ++ return oldstuff; ++ ++ while(oldstuff && oldstuff[oldlen]) oldlen++; ++ while(newstuff && newstuff[newlen]) newlen++; ++ ++ result = (char **)realloc(oldstuff, sizeof(char *) * (oldlen + newlen + 1)); ++ if (result == NULL) { ++ fprintf(stderr, "%s: out of memory\n", __FUNCTION__); ++ return NULL; ++ } ++ ++ for(i = oldlen, j = 0; i < (oldlen + newlen); i++, j++) ++ *(result + i) = *(newstuff + j); ++ ++ *(result + i) = NULL; ++ ++ return result; ++} ++ ++/* ++ * a kinda kludgy way to back out depends str from two different arrays (reg'l'r 'n pre) ++ * this is null terminated, no count is carried around ++ */ ++char ** add_unresolved_dep(pkg_t * pkg, char ** the_lost, int ref_ndx) ++{ ++ int count; ++ char ** resized; ++ char *depend_str = pkg_depend_str(pkg, ref_ndx); ++ ++ count = 0; ++ while(the_lost && the_lost[count]) count++; ++ ++ count++; /* need one to hold the null */ ++ resized = (char **)realloc(the_lost, sizeof(char *) * (count + 1)); ++ if (resized == NULL) { ++ fprintf(stderr, "%s: out of memory\n", __FUNCTION__); ++ return NULL; ++ } ++ resized[count - 1] = strdup(depend_str); ++ resized[count] = NULL; ++ ++ return resized; ++} ++ ++void printDepends(pkg_t * pkg) ++{ ++ register int i, j; ++ compound_depend_t * depend; ++ int count; ++ ++ count = pkg->pre_depends_count + pkg->depends_count; ++ ++ depend = pkg->depends; ++ if(!depend){ ++ fprintf(stderr, "Depends pointer is NULL\n"); ++ return; ++ } ++ for(i = 0; i < count; i++){ ++ fprintf(stderr, "%s has %d possibilities:\n", ++ (depend->type == GREEDY_DEPEND) ? "Greedy-Depend" : ((depend->type == DEPEND) ? "Depend" : "Pre-Depend"), ++ depend->possibility_count); ++ for(j = 0; j < depend->possibility_count; j++) ++ fprintf(stderr, "\t%s version %s (%d)\n", ++ depend->possibilities[j]->pkg->name, ++ depend->possibilities[j]->version, ++ depend->possibilities[j]->constraint); ++ depend++; ++ } ++} ++ ++int buildProvides(hash_table_t * hash, abstract_pkg_t * ab_pkg, pkg_t * pkg) ++{ ++ register int i, j; ++ ++ /* every pkg provides itself */ ++ abstract_pkg_vec_insert(ab_pkg->provided_by, ab_pkg); ++ ++ if (!pkg->provides_count) ++ return 0; ++ ++ pkg->provides = (abstract_pkg_t **)malloc(sizeof(abstract_pkg_t *) * (pkg->provides_count + 1)); ++ if (pkg->provides == NULL) { ++ fprintf(stderr, "%s: out of memory\n", __FUNCTION__); ++ return -1 ; ++ } ++ pkg->provides[0] = ab_pkg; ++ ++ // if (strcmp(ab_pkg->name, pkg->name)) ++ // fprintf(stderr, __FUNCTION__ ": ab_pkg=%s pkg=%s\n", ab_pkg->name, pkg->name); ++ ++ for(i = 0; i < pkg->provides_count; i++){ ++ abstract_pkg_t *provided_abpkg = ensure_abstract_pkg_by_name(hash, pkg->provides_str[i]); ++ ++ pkg->provides[i+1] = provided_abpkg; ++ ++ j = 0; ++ abstract_pkg_vec_insert(provided_abpkg->provided_by, ab_pkg); ++ } ++ return 0; ++} ++ ++/* Abhaya: added conflicts support */ ++int buildConflicts(hash_table_t * hash, abstract_pkg_t * ab_pkg, pkg_t * pkg) ++{ ++ register int i; ++ compound_depend_t * conflicts; ++ ++ if (!pkg->conflicts_count) ++ return 0; ++ ++ conflicts = pkg->conflicts = malloc(sizeof(compound_depend_t) * ++ pkg->conflicts_count); ++ if (conflicts == NULL) { ++ fprintf(stderr, "%s: out of memory\n", __FUNCTION__); ++ return -1; ++ } ++ for (i = 0; i < pkg->conflicts_count; i++) { ++ conflicts->type = CONFLICTS; ++ parseDepends(conflicts, hash, ++ pkg->conflicts_str[i]); ++#if 0 ++ for (j = 0; j < conflicts->possibility_count; j++) { ++ depend_t *possibility = conflicts->possibilities[j]; ++ abstract_pkg_t *conflicting_apkg = possibility->pkg; ++ pkg_add_conflict_pair(ab_pkg, conflicting_apkg); ++ } ++#endif ++ conflicts++; ++ } ++ return 0; ++} ++ ++int buildReplaces(hash_table_t * hash, abstract_pkg_t * ab_pkg, pkg_t * pkg) ++{ ++ register int i, j; ++ ++ if (!pkg->replaces_count) ++ return 0; ++ ++ pkg->replaces = (abstract_pkg_t **)malloc(sizeof(abstract_pkg_t *) * pkg->replaces_count); ++ if (pkg->replaces == NULL) { ++ fprintf(stderr, "%s: out of memory\n", __FUNCTION__); ++ return -1; ++ } ++ ++ // if (strcmp(ab_pkg->name, pkg->name)) ++ // fprintf(stderr, __FUNCTION__ ": ab_pkg=%s pkg=%s\n", ab_pkg->name, pkg->name); ++ ++ for(i = 0; i < pkg->replaces_count; i++){ ++ abstract_pkg_t *old_abpkg = ensure_abstract_pkg_by_name(hash, pkg->replaces_str[i]); ++ ++ pkg->replaces[i] = old_abpkg; ++ ++ j = 0; ++ if (!old_abpkg->replaced_by) ++ old_abpkg->replaced_by = abstract_pkg_vec_alloc(); ++ if ( old_abpkg->replaced_by == NULL ){ ++ return -1; ++ } ++ /* if a package pkg both replaces and conflicts old_abpkg, ++ * then add it to the replaced_by vector so that old_abpkg ++ * will be upgraded to ab_pkg automatically */ ++ if (pkg_conflicts_abstract(pkg, old_abpkg)) ++ abstract_pkg_vec_insert(old_abpkg->replaced_by, ab_pkg); ++ } ++ return 0; ++} ++ ++int buildDepends(hash_table_t * hash, pkg_t * pkg) ++{ ++ int count; ++ register int i; ++ compound_depend_t * depends; ++ ++ if(!(count = pkg->pre_depends_count + pkg->depends_count + pkg->recommends_count + pkg->suggests_count)) ++ return 0; ++ ++ if (0 && pkg->pre_depends_count) ++ fprintf(stderr, "pkg=%s pre_depends_count=%d depends_count=%d\n", ++ pkg->name, pkg->pre_depends_count, pkg->depends_count); ++ depends = pkg->depends = malloc(sizeof(compound_depend_t) * count); ++ if (depends == NULL) { ++ fprintf(stderr, "%s: out of memory\n", __FUNCTION__); ++ return -1; ++ } ++ ++ ++ for(i = 0; i < pkg->pre_depends_count; i++){ ++ parseDepends(depends, hash, pkg->pre_depends_str[i]); ++ if (0 && pkg->pre_depends_count) ++ fprintf(stderr, " pre_depends_str=%s depends=%p possibility_count=%x\n", ++ pkg->pre_depends_str[i], depends, depends->possibility_count); ++ depends->type = PREDEPEND; ++ depends++; ++ } ++ ++ for(i = 0; i < pkg->recommends_count; i++){ ++ parseDepends(depends, hash, pkg->recommends_str[i]); ++ if (0 && pkg->recommends_count) ++ fprintf(stderr, " recommends_str=%s depends=%p possibility_count=%x\n", ++ pkg->recommends_str[i], depends, depends->possibility_count); ++ depends->type = RECOMMEND; ++ depends++; ++ } ++ ++ for(i = 0; i < pkg->suggests_count; i++){ ++ parseDepends(depends, hash, pkg->suggests_str[i]); ++ if (0 && pkg->suggests_count) ++ fprintf(stderr, " suggests_str=%s depends=%p possibility_count=%x\n", ++ pkg->suggests_str[i], depends, depends->possibility_count); ++ depends->type = SUGGEST; ++ depends++; ++ } ++ ++ for(i = 0; i < pkg->depends_count; i++){ ++ parseDepends(depends, hash, pkg->depends_str[i]); ++ if (0 && pkg->depends_count) ++ fprintf(stderr, " depends_str=%s depends=%p possibility_count=%x\n", ++ pkg->depends_str[i], depends, depends->possibility_count); ++ depends++; ++ } ++ return 0; ++} ++ ++/* ++ * pkg_depend_string: returns the depends string specified by index. ++ * All 4 kinds of dependences: dependence, pre-dependence, recommend, and suggest are number starting from 0. ++ * [0,npredepends) -> returns pre_depends_str[index] ++ * [npredepends,npredepends+nrecommends) -> returns recommends_str[index] ++ * [npredepends+nrecommends,npredepends+nrecommends+nsuggests) -> returns recommends_str[index] ++ * [npredepends+nrecommends+nsuggests,npredepends+nrecommends+nsuggests+ndepends) -> returns depends_str[index] ++ */ ++char *pkg_depend_str(pkg_t *pkg, int index) ++{ ++ if (index < pkg->pre_depends_count) { ++ return pkg->pre_depends_str[index]; ++ } ++ index -= pkg->pre_depends_count; ++ ++ if (index < pkg->recommends_count) { ++ return pkg->recommends_str[index]; ++ } ++ index -= pkg->recommends_count; ++ ++ if (index < pkg->suggests_count) { ++ return pkg->suggests_str[index]; ++ } ++ index -= pkg->suggests_count; ++ ++ if (index < pkg->depends_count) { ++ return pkg->depends_str[index]; ++ } ++ fprintf(stderr, "pkg_depend_str: index %d out of range for pkg=%s\n", index, pkg->name); ++ return NULL; ++} ++ ++void freeDepends(pkg_t *pkg) ++{ ++ int i; ++ ++ if (pkg == NULL || pkg->depends == NULL) { ++ return; ++ } ++ ++ fprintf(stderr, "Freeing depends=%p\n", pkg->depends); ++ for (i=0; i < pkg->depends->possibility_count; i++) { ++ depend_deinit(pkg->depends->possibilities[i]); ++ } ++ free(pkg->depends->possibilities); ++ free(pkg->depends); ++ pkg->depends = NULL; ++} ++ ++void buildDependedUponBy(pkg_t * pkg, abstract_pkg_t * ab_pkg) ++{ ++ compound_depend_t * depends; ++ int count, othercount; ++ register int i, j; ++ abstract_pkg_t * ab_depend; ++ abstract_pkg_t ** temp; ++ ++ count = pkg->pre_depends_count + pkg->depends_count; ++ depends = pkg->depends; ++ ++ if (0 && pkg->pre_depends_count) ++ fprintf(stderr, "pkg=%s pre_depends_count=%d depends_count=%d\n", ++ pkg->name, pkg->pre_depends_count, pkg->depends_count); ++ for (i = 0; i < count; i++) { ++ if (0 && pkg->pre_depends_count) ++ fprintf(stderr, " i=%d possibility_count=%x depends=%p\n", i, depends->possibility_count, depends); ++ for (j = 0; j < depends->possibility_count; j++){ ++ ab_depend = depends->possibilities[j]->pkg; ++ if(!ab_depend->depended_upon_by) ++ ab_depend->depended_upon_by = (abstract_pkg_t **)calloc(1, sizeof(abstract_pkg_t *)); ++ ++ temp = ab_depend->depended_upon_by; ++ othercount = 1; ++ while(*temp){ ++ temp++; ++ othercount++; ++ } ++ *temp = ab_pkg; ++ ++ ab_depend->depended_upon_by = (abstract_pkg_t **)realloc(ab_depend->depended_upon_by, ++ (othercount + 1) * sizeof(abstract_pkg_t *)); ++ /* the array may have moved */ ++ temp = ab_depend->depended_upon_by + othercount; ++ *temp = NULL; ++ } ++ depends++; ++ } ++} ++ ++static depend_t * depend_init(void) ++{ ++ depend_t * d = (depend_t *)malloc(sizeof(depend_t)); ++ if ( d==NULL ){ ++ fprintf(stderr, "%s: out of memory\n", __FUNCTION__); ++ return NULL; ++ } ++ d->constraint = NONE; ++ d->version = NULL; ++ d->pkg = NULL; ++ ++ return d; ++} ++ ++static void depend_deinit(depend_t *d) ++{ ++ free(d); ++} ++ ++static int parseDepends(compound_depend_t *compound_depend, ++ hash_table_t * hash, char * depend_str) ++{ ++ char * pkg_name, buffer[2048]; ++ int num_of_ors = 0; ++ register int i; ++ register char * src, * dest; ++ depend_t ** possibilities; ++ ++ /* first count the number of ored possibilities for satisfying dependency */ ++ src = depend_str; ++ while(*src) ++ if(*src++ == '|') ++ num_of_ors++; ++ ++ compound_depend->type = DEPEND; ++ ++ compound_depend->possibility_count = num_of_ors + 1; ++ possibilities = (depend_t **)malloc(sizeof(depend_t *) * (num_of_ors + 1)); ++ if (!possibilities) ++ return -ENOMEM; ++ compound_depend->possibilities = possibilities; ++ ++ src = depend_str; ++ for(i = 0; i < num_of_ors + 1; i++){ ++ possibilities[i] = depend_init(); ++ if (!possibilities[i]) ++ return -ENOMEM; ++ /* gobble up just the name first */ ++ dest = buffer; ++ while(*src && ++ !isspace(*src) && ++ (*src != '(') && ++ (*src != '*') && ++ (*src != '|')) ++ *dest++ = *src++; ++ *dest = '\0'; ++ pkg_name = trim_alloc(buffer); ++ if (pkg_name == NULL ) ++ return -ENOMEM; ++ ++ /* now look at possible version info */ ++ ++ /* skip to next chars */ ++ if(isspace(*src)) ++ while(*src && isspace(*src)) src++; ++ ++ /* extract constraint and version */ ++ if(*src == '('){ ++ src++; ++ if(!strncmp(src, "<<", 2)){ ++ possibilities[i]->constraint = EARLIER; ++ src += 2; ++ } ++ else if(!strncmp(src, "<=", 2)){ ++ possibilities[i]->constraint = EARLIER_EQUAL; ++ src += 2; ++ } ++ else if(!strncmp(src, ">=", 2)){ ++ possibilities[i]->constraint = LATER_EQUAL; ++ src += 2; ++ } ++ else if(!strncmp(src, ">>", 2)){ ++ possibilities[i]->constraint = LATER; ++ src += 2; ++ } ++ else if(!strncmp(src, "=", 1)){ ++ possibilities[i]->constraint = EQUAL; ++ src++; ++ } ++ /* should these be here to support deprecated designations; dpkg does */ ++ else if(!strncmp(src, "<", 1)){ ++ possibilities[i]->constraint = EARLIER_EQUAL; ++ src++; ++ } ++ else if(!strncmp(src, ">", 1)){ ++ possibilities[i]->constraint = LATER_EQUAL; ++ src++; ++ } ++ ++ /* now we have any constraint, pass space to version string */ ++ while(isspace(*src)) src++; ++ ++ /* this would be the version string */ ++ dest = buffer; ++ while(*src && *src != ')') ++ *dest++ = *src++; ++ *dest = '\0'; ++ ++ possibilities[i]->version = trim_alloc(buffer); ++ /* fprintf(stderr, "let's print the depends version string:"); ++ fprintf(stderr, "version %s\n", possibilities[i]->version);*/ ++ if (possibilities[i]->version == NULL ) ++ return -ENOMEM; ++ ++ ++ } ++ /* hook up the dependency to its abstract pkg */ ++ possibilities[i]->pkg = ensure_abstract_pkg_by_name(hash, pkg_name); ++ ++ free(pkg_name); ++ ++ /* now get past the ) and any possible | chars */ ++ while(*src && ++ (isspace(*src) || ++ (*src == ')') || ++ (*src == '|'))) ++ src++; ++ if (*src == '*') ++ { ++ compound_depend->type = GREEDY_DEPEND; ++ src++; ++ } ++ } ++ ++ return 0; ++} +diff -ruN busybox-1.2.0-orig/archival/libipkg/pkg_depends.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_depends.h +--- busybox-1.2.0-orig/archival/libipkg/pkg_depends.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_depends.h 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,105 @@ ++/* pkg_depends.h - the itsy package management system ++ ++ Steven M. Ayer ++ ++ Copyright (C) 2002 Compaq Computer Corporation ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#ifndef PKG_DEPENDS_H ++#define PKG_DEPENDS_H ++ ++#include "pkg.h" ++#include "pkg_hash.h" ++ ++enum depend_type { ++ PREDEPEND, ++ DEPEND, ++ CONFLICTS, ++ GREEDY_DEPEND, ++ RECOMMEND, ++ SUGGEST ++}; ++typedef enum depend_type depend_type_t; ++ ++enum version_constraint { ++ NONE, ++ EARLIER, ++ EARLIER_EQUAL, ++ EQUAL, ++ LATER_EQUAL, ++ LATER ++}; ++typedef enum version_constraint version_constraint_t; ++ ++struct depend{ ++ version_constraint_t constraint; ++ char * version; ++ abstract_pkg_t * pkg; ++}; ++typedef struct depend depend_t; ++ ++struct compound_depend{ ++ depend_type_t type; ++ int possibility_count; ++ struct depend ** possibilities; ++}; ++typedef struct compound_depend compound_depend_t; ++ ++#include "hash_table.h" ++ ++int buildProvides(hash_table_t * hash, abstract_pkg_t * ab_pkg, pkg_t * pkg); ++int buildConflicts(hash_table_t * hash, abstract_pkg_t * ab_pkg, pkg_t * pkg); ++int buildReplaces(hash_table_t * hash, abstract_pkg_t * ab_pkg, pkg_t * pkg); ++int buildDepends(hash_table_t * hash, pkg_t * pkg); ++ ++/** ++ * pkg_has_common_provides returns 1 if pkg and replacee both provide ++ * the same abstract package and 0 otherwise. ++ */ ++int pkg_has_common_provides(pkg_t *pkg, pkg_t *replacee); ++ ++/** ++ * pkg_provides returns 1 if pkg->provides contains providee and 0 ++ * otherwise. ++ */ ++int pkg_provides_abstract(pkg_t *pkg, abstract_pkg_t *providee); ++ ++/** ++ * pkg_replaces returns 1 if pkg->replaces contains one of replacee's provides and 0 ++ * otherwise. ++ */ ++int pkg_replaces(pkg_t *pkg, pkg_t *replacee); ++ ++/** ++ * pkg_conflicts_abstract returns 1 if pkg->conflicts contains conflictee provides and 0 ++ * otherwise. ++ */ ++int pkg_conflicts_abstract(pkg_t *pkg, abstract_pkg_t *conflicts); ++ ++/** ++ * pkg_conflicts returns 1 if pkg->conflicts contains one of conflictee's provides and 0 ++ * otherwise. ++ */ ++int pkg_conflicts(pkg_t *pkg, pkg_t *conflicts); ++ ++char *pkg_depend_str(pkg_t *pkg, int index); ++void buildDependedUponBy(pkg_t * pkg, abstract_pkg_t * ab_pkg); ++void freeDepends(pkg_t *pkg); ++void printDepends(pkg_t * pkg); ++int version_constraints_satisfied(depend_t * depends, pkg_t * pkg); ++int pkg_hash_fetch_unsatisfied_dependencies(ipkg_conf_t *conf, pkg_t * pkg, pkg_vec_t *depends, char *** unresolved); ++pkg_vec_t * pkg_hash_fetch_conflicts(hash_table_t * hash, pkg_t * pkg); ++int pkg_dependence_satisfiable(ipkg_conf_t *conf, depend_t *depend); ++int pkg_dependence_satisfied(ipkg_conf_t *conf, depend_t *depend); ++ ++#endif +diff -ruN busybox-1.2.0-orig/archival/libipkg/pkg_dest.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_dest.c +--- busybox-1.2.0-orig/archival/libipkg/pkg_dest.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_dest.c 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,92 @@ ++/* pkg_dest.c - the itsy package management system ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#include "ipkg.h" ++ ++#include "pkg_dest.h" ++#include "file_util.h" ++#include "str_util.h" ++#include "sprintf_alloc.h" ++ ++int pkg_dest_init(pkg_dest_t *dest, const char *name, const char *root_dir,const char * lists_dir) ++{ ++ dest->name = strdup(name); ++ ++ /* Guarantee that dest->root_dir ends with a '/' */ ++ if (str_ends_with(root_dir, "/")) { ++ dest->root_dir = strdup(root_dir); ++ } else { ++ sprintf_alloc(&dest->root_dir, "%s/", root_dir); ++ } ++ file_mkdir_hier(dest->root_dir, 0755); ++ ++ sprintf_alloc(&dest->ipkg_dir, "%s%s", ++ dest->root_dir, IPKG_STATE_DIR_PREFIX); ++ file_mkdir_hier(dest->ipkg_dir, 0755); ++ ++ if (str_starts_with (lists_dir, "/")) ++ sprintf_alloc(&dest->lists_dir, "%s", lists_dir); ++ else ++ sprintf_alloc(&dest->lists_dir, "/%s", lists_dir); ++ ++ file_mkdir_hier(dest->lists_dir, 0755); ++ ++ sprintf_alloc(&dest->info_dir, "%s/%s", ++ dest->ipkg_dir, IPKG_INFO_DIR_SUFFIX); ++ file_mkdir_hier(dest->info_dir, 0755); ++ ++ sprintf_alloc(&dest->status_file_name, "%s/%s", ++ dest->ipkg_dir, IPKG_STATUS_FILE_SUFFIX); ++ ++ sprintf_alloc(&dest->status_file_tmp_name, "%s/%s.tmp", ++ dest->ipkg_dir, IPKG_STATUS_FILE_SUFFIX); ++ ++ dest->status_file = NULL; ++ ++ return 0; ++} ++ ++void pkg_dest_deinit(pkg_dest_t *dest) ++{ ++ free(dest->name); ++ dest->name = NULL; ++ ++ free(dest->root_dir); ++ dest->root_dir = NULL; ++ ++ free(dest->ipkg_dir); ++ dest->ipkg_dir = NULL; ++ ++ free(dest->lists_dir); ++ dest->lists_dir = NULL; ++ ++ free(dest->info_dir); ++ dest->info_dir = NULL; ++ ++ free(dest->status_file_name); ++ dest->status_file_name = NULL; ++ ++ free(dest->status_file_tmp_name); ++ dest->status_file_tmp_name = NULL; ++ ++ if (dest->status_file) { ++ fclose(dest->status_file); ++ } ++ dest->status_file = NULL; ++ ++ dest->root_dir = NULL; ++} +diff -ruN busybox-1.2.0-orig/archival/libipkg/pkg_dest.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_dest.h +--- busybox-1.2.0-orig/archival/libipkg/pkg_dest.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_dest.h 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,38 @@ ++/* pkg_dest.h - the itsy package management system ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#ifndef PKG_DEST_H ++#define PKG_DEST_H ++ ++typedef struct pkg_dest pkg_dest_t; ++struct pkg_dest ++{ ++ char *name; ++ char *root_dir; ++ char *ipkg_dir; ++ char *lists_dir; ++ char *info_dir; ++ char *status_file_name; ++ char *status_file_tmp_name; ++ FILE *status_file; ++}; ++ ++int pkg_dest_init(pkg_dest_t *dest, const char *name, const char *root_dir,const char *lists_dir); ++void pkg_dest_deinit(pkg_dest_t *dest); ++ ++#endif ++ +diff -ruN busybox-1.2.0-orig/archival/libipkg/pkg_dest_list.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_dest_list.c +--- busybox-1.2.0-orig/archival/libipkg/pkg_dest_list.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_dest_list.c 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,85 @@ ++/* pkg_dest_list.c - the itsy package management system ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#include "ipkg.h" ++ ++#include "pkg_dest.h" ++#include "void_list.h" ++#include "pkg_dest_list.h" ++ ++int pkg_dest_list_elt_init(pkg_dest_list_elt_t *elt, pkg_dest_t *data) ++{ ++ return void_list_elt_init((void_list_elt_t *) elt, data); ++} ++ ++void pkg_dest_list_elt_deinit(pkg_dest_list_elt_t *elt) ++{ ++ void_list_elt_deinit((void_list_elt_t *) elt); ++} ++ ++int pkg_dest_list_init(pkg_dest_list_t *list) ++{ ++ return void_list_init((void_list_t *) list); ++} ++ ++void pkg_dest_list_deinit(pkg_dest_list_t *list) ++{ ++ pkg_dest_list_elt_t *iter; ++ pkg_dest_t *pkg_dest; ++ ++ for (iter = list->head; iter; iter = iter->next) { ++ pkg_dest = iter->data; ++ pkg_dest_deinit(pkg_dest); ++ ++ /* malloced in pkg_dest_list_append */ ++ free(pkg_dest); ++ iter->data = NULL; ++ } ++ void_list_deinit((void_list_t *) list); ++} ++ ++pkg_dest_t *pkg_dest_list_append(pkg_dest_list_t *list, const char *name, ++ const char *root_dir,const char *lists_dir) ++{ ++ int err; ++ pkg_dest_t *pkg_dest; ++ ++ /* freed in plg_dest_list_deinit */ ++ pkg_dest = malloc(sizeof(pkg_dest_t)); ++ if (pkg_dest == NULL) { ++ fprintf(stderr, "%s: out of memory\n", __FUNCTION__); ++ return NULL; ++ } ++ ++ pkg_dest_init(pkg_dest, name, root_dir,lists_dir); ++ err = void_list_append((void_list_t *) list, pkg_dest); ++ if (err) { ++ return NULL; ++ } ++ ++ return pkg_dest; ++} ++ ++int pkg_dest_list_push(pkg_dest_list_t *list, pkg_dest_t *data) ++{ ++ return void_list_push((void_list_t *) list, data); ++} ++ ++pkg_dest_list_elt_t *pkg_dest_list_pop(pkg_dest_list_t *list) ++{ ++ return (pkg_dest_list_elt_t *) void_list_pop((void_list_t *) list); ++} +diff -ruN busybox-1.2.0-orig/archival/libipkg/pkg_dest_list.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_dest_list.h +--- busybox-1.2.0-orig/archival/libipkg/pkg_dest_list.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_dest_list.h 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,50 @@ ++/* pkg_dest_list.h - the itsy package management system ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#ifndef PKG_DEST_LIST_H ++#define PKG_DEST_LIST_H ++ ++#include "pkg_dest.h" ++ ++typedef struct pkg_dest_list_elt pkg_dest_list_elt_t; ++struct pkg_dest_list_elt ++{ ++ pkg_dest_list_elt_t *next; ++ pkg_dest_t *data; ++}; ++ ++typedef struct pkg_dest_list pkg_dest_list_t; ++struct pkg_dest_list ++{ ++ pkg_dest_list_elt_t pre_head; ++ pkg_dest_list_elt_t *head; ++ pkg_dest_list_elt_t *tail; ++}; ++ ++int pkg_dest_list_elt_init(pkg_dest_list_elt_t *elt, pkg_dest_t *data); ++void pkg_dest_list_elt_deinit(pkg_dest_list_elt_t *elt); ++ ++int pkg_dest_list_init(pkg_dest_list_t *list); ++void pkg_dest_list_deinit(pkg_dest_list_t *list); ++ ++pkg_dest_t *pkg_dest_list_append(pkg_dest_list_t *list, const char *name, ++ const char *root_dir,const char* lists_dir); ++int pkg_dest_list_push(pkg_dest_list_t *list, pkg_dest_t *data); ++pkg_dest_list_elt_t *pkg_dest_list_pop(pkg_dest_list_t *list); ++ ++#endif ++ +diff -ruN busybox-1.2.0-orig/archival/libipkg/pkg_extract.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_extract.c +--- busybox-1.2.0-orig/archival/libipkg/pkg_extract.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_extract.c 2006-07-30 22:47:49.000000000 +0200 +@@ -0,0 +1,224 @@ ++/* pkg_extract.c - the itsy package management system ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#include "ipkg.h" ++#include <errno.h> ++#include <fcntl.h> ++#include <stdio.h> ++ ++#include "pkg_extract.h" ++ ++#include "libbb.h" ++#include "file_util.h" ++#include "sprintf_alloc.h" ++#include "unarchive.h" ++ ++#define IPKG_CONTROL_ARCHIVE "control.tar.gz" ++#define IPKG_DATA_ARCHIVE "data.tar.gz" ++#define IPKG_CONTROL_FILE "control" ++ ++static void extract_ipkg_file_to_dir(pkg_t *pkg, const char *dir, const char *filename) ++{ ++ archive_handle_t *archive; ++ char *path; ++ ++ sprintf_alloc(&path, "%s/", dir); ++ archive = init_handle(); ++ archive->src_fd = bb_xopen(pkg->local_filename, O_RDONLY); ++ archive->filter = filter_accept_list; ++ llist_add_to(&(archive->accept), (char *)filename); ++ archive->buffer = path; ++ archive->action_data = data_extract_all_prefix; ++ archive->flags |= ARCHIVE_EXTRACT_UNCONDITIONAL; ++ while( get_header_tar_gz(archive) == EXIT_SUCCESS ); ++ close(archive->src_fd); ++ free(archive->accept); ++ free(archive); ++ free(path); ++} ++ ++static void data_extract_file_name_to_buffer(archive_handle_t *archive) ++{ ++ unsigned int size = strlen(archive->file_header->name) + 2; ++ ++ if (archive->buffer == NULL) { ++ archive->buffer = xmalloc(size); ++ strcpy(archive->buffer, archive->file_header->name); ++ } else { ++ size += strlen(archive->buffer); ++ archive->buffer = xrealloc(archive->buffer, size); ++ strcat(archive->buffer, archive->file_header->name); ++ } ++ strcat(archive->buffer, "\n"); ++ data_skip(archive); ++} ++ ++int pkg_extract_control_file_to_stream(pkg_t *pkg, FILE *stream) ++{ ++ archive_handle_t *archive; ++ char *name; ++ ++ extract_ipkg_file_to_dir(pkg, global_conf->tmp_dir, "./" IPKG_CONTROL_ARCHIVE); ++ sprintf_alloc(&name, "%s/%s", global_conf->tmp_dir, IPKG_CONTROL_ARCHIVE); ++ archive = init_handle(); ++ archive->src_fd = bb_xopen(name, O_RDONLY); ++ archive->filter = filter_accept_list; ++ llist_add_to(&(archive->accept), "./" IPKG_CONTROL_FILE); ++ archive->action_data = data_extract_to_buffer; ++ while( get_header_tar_gz(archive) == EXIT_SUCCESS ); ++ close(archive->src_fd); ++ fputs(archive->buffer, stream); ++ free(archive->buffer); ++ free(archive->accept); ++ free(archive); ++ free(name); ++ ++ return 0; ++} ++ ++int pkg_extract_control_files_to_dir(pkg_t *pkg, const char *dir) ++{ ++ return pkg_extract_control_files_to_dir_with_prefix(pkg, dir, ""); ++} ++ ++int pkg_extract_control_files_to_dir_with_prefix(pkg_t *pkg, const char *dir, const char *prefix) ++{ ++ archive_handle_t *archive; ++ char *name; ++ char *path; ++ ++ extract_ipkg_file_to_dir(pkg, global_conf->tmp_dir, "./" IPKG_CONTROL_ARCHIVE); ++ sprintf_alloc(&name, "%s/%s", global_conf->tmp_dir, IPKG_CONTROL_ARCHIVE); ++ sprintf_alloc(&path, "%s/%s", dir, prefix); ++ archive = init_handle(); ++ archive->src_fd = bb_xopen(name, O_RDONLY); ++ archive->filter = filter_accept_all; ++ archive->buffer = path; ++ archive->action_data = data_extract_all_prefix; ++ archive->flags |= ARCHIVE_CREATE_LEADING_DIRS | ARCHIVE_PRESERVE_DATE | ARCHIVE_EXTRACT_UNCONDITIONAL; ++ while( get_header_tar_gz(archive) == EXIT_SUCCESS ); ++ close(archive->src_fd); ++ free(archive); ++ free(path); ++ free(name); ++ ++ return 0; ++} ++ ++int pkg_extract_data_files_to_dir(pkg_t *pkg, const char *dir) ++{ ++ archive_handle_t *archive; ++ char *name; ++ char *path; ++ ++ extract_ipkg_file_to_dir(pkg, global_conf->tmp_dir, "./" IPKG_DATA_ARCHIVE); ++ sprintf_alloc(&name, "%s/%s", global_conf->tmp_dir, IPKG_DATA_ARCHIVE); ++ sprintf_alloc(&path, "%s/", dir); ++ archive = init_handle(); ++ archive->src_fd = bb_xopen(name, O_RDONLY); ++ archive->filter = filter_accept_all; ++ archive->buffer = path; ++ archive->action_data = data_extract_all_prefix; ++ archive->flags |= ARCHIVE_CREATE_LEADING_DIRS | ARCHIVE_PRESERVE_DATE | ARCHIVE_EXTRACT_UNCONDITIONAL; ++ while( get_header_tar_gz(archive) == EXIT_SUCCESS ); ++ close(archive->src_fd); ++ free(archive); ++ free(path); ++ free(name); ++ ++ return 0; ++} ++ ++int pkg_extract_data_file_names_to_file(pkg_t *pkg, const char *file_name) ++{ ++ int err=0; ++ char *line, *data_file; ++ FILE *file; ++ FILE *tmp; ++ ++ file = fopen(file_name, "w"); ++ if (file == NULL) { ++ fprintf(stderr, "%s: ERROR: Failed to open %s for writing.\n", ++ __FUNCTION__, file_name); ++ return EINVAL; ++ } ++ ++ tmp = tmpfile(); ++ if (pkg->installed_files) { ++ str_list_elt_t *elt; ++ for (elt = pkg->installed_files->head; elt; elt = elt->next) { ++ fprintf(file, "%s\n", elt->data); ++ } ++ } else { ++ err = pkg_extract_data_file_names_to_stream(pkg, tmp); ++ if (err) { ++ fclose(file); ++ fclose(tmp); ++ return err; ++ } ++ ++ /* Fixup data file names by removing the initial '.' */ ++ rewind(tmp); ++ while (1) { ++ line = file_read_line_alloc(tmp); ++ if (line == NULL) { ++ break; ++ } ++ ++ data_file = line; ++ if (*data_file == '.') { ++ data_file++; ++ } ++ ++ if (*data_file != '/') { ++ fputs("/", file); ++ } ++ ++ /* I have no idea why, but this is what dpkg does */ ++ if (strcmp(data_file, "/\n") == 0) { ++ fputs("/.\n", file); ++ } else { ++ fputs(data_file, file); ++ } ++ } ++ } ++ fclose(tmp); ++ fclose(file); ++ ++ return err; ++} ++ ++int pkg_extract_data_file_names_to_stream(pkg_t *pkg, FILE *file) ++{ ++ archive_handle_t *archive; ++ char *name; ++ ++ extract_ipkg_file_to_dir(pkg, global_conf->tmp_dir, "./" IPKG_DATA_ARCHIVE); ++ sprintf_alloc(&name, "%s/%s", global_conf->tmp_dir, IPKG_DATA_ARCHIVE); ++ archive = init_handle(); ++ archive->src_fd = bb_xopen(name, O_RDONLY); ++ archive->filter = filter_accept_all; ++ archive->action_data = data_extract_file_name_to_buffer; ++ while( get_header_tar_gz(archive) == EXIT_SUCCESS ); ++ close(archive->src_fd); ++ fputs(archive->buffer, file); ++ free(archive->buffer); ++ free(archive); ++ free(name); ++ ++ return 0; ++} +diff -ruN busybox-1.2.0-orig/archival/libipkg/pkg_extract.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_extract.h +--- busybox-1.2.0-orig/archival/libipkg/pkg_extract.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_extract.h 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,32 @@ ++/* pkg_extract.c - the itsy package management system ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#ifndef PKG_EXTRACT_H ++#define PKG_EXTRACT_H ++ ++#include "pkg.h" ++ ++int pkg_extract_control_file_to_stream(pkg_t *pkg, FILE *stream); ++int pkg_extract_control_files_to_dir(pkg_t *pkg, const char *dir); ++int pkg_extract_control_files_to_dir_with_prefix(pkg_t *pkg, ++ const char *dir, ++ const char *prefix); ++int pkg_extract_data_files_to_dir(pkg_t *pkg, const char *dir); ++int pkg_extract_data_file_names_to_file(pkg_t *pkg, const char *file_name); ++int pkg_extract_data_file_names_to_stream(pkg_t *pkg, FILE *file); ++ ++#endif +diff -ruN busybox-1.2.0-orig/archival/libipkg/pkg.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg.h +--- busybox-1.2.0-orig/archival/libipkg/pkg.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg.h 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,232 @@ ++/* pkg.h - the itsy package management system ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#ifndef PKG_H ++#define PKG_H ++ ++#include <sys/types.h> ++#include <sys/stat.h> ++#include <unistd.h> ++ ++#include "pkg_vec.h" ++#include "str_list.h" ++#include "pkg_src.h" ++#include "pkg_dest.h" ++#include "ipkg_conf.h" ++#include "conffile_list.h" ++ ++struct ipkg_conf; ++ ++ ++#define ARRAY_SIZE(array) sizeof(array) / sizeof((array)[0]) ++ ++/* I think "Size" is currently the shortest field name */ ++#define PKG_MINIMUM_FIELD_NAME_LEN 4 ++ ++enum pkg_state_want ++{ ++ SW_UNKNOWN = 1, ++ SW_INSTALL, ++ SW_DEINSTALL, ++ SW_PURGE, ++ SW_LAST_STATE_WANT ++}; ++typedef enum pkg_state_want pkg_state_want_t; ++ ++enum pkg_state_flag ++{ ++ SF_OK = 0, ++ SF_REINSTREQ = 1, ++ SF_HOLD = 2, /* do not upgrade version */ ++ SF_REPLACE = 4, /* replace this package */ ++ SF_NOPRUNE = 8, /* do not remove obsolete files */ ++ SF_PREFER = 16, /* prefer this version */ ++ SF_OBSOLETE = 32, /* old package in upgrade pair */ ++ SF_MARKED = 64, /* temporary mark */ ++ SF_FILELIST_CHANGED = 128, /* needs filelist written */ ++ SF_USER = 256, ++ SF_LAST_STATE_FLAG ++}; ++typedef enum pkg_state_flag pkg_state_flag_t; ++#define SF_NONVOLATILE_FLAGS (SF_HOLD|SF_NOPRUNE|SF_PREFER|SF_OBSOLETE|SF_USER) ++ ++enum pkg_state_status ++{ ++ SS_NOT_INSTALLED = 1, ++ SS_UNPACKED, ++ SS_HALF_CONFIGURED, ++ SS_INSTALLED, ++ SS_HALF_INSTALLED, ++ SS_CONFIG_FILES, ++ SS_POST_INST_FAILED, ++ SS_REMOVAL_FAILED, ++ SS_LAST_STATE_STATUS ++}; ++typedef enum pkg_state_status pkg_state_status_t; ++ ++struct abstract_pkg{ ++ char * name; ++ int dependencies_checked; ++ pkg_vec_t * pkgs; ++ pkg_state_status_t state_status; ++ pkg_state_flag_t state_flag; ++ struct abstract_pkg ** depended_upon_by; /* @@@@ this should be abstract_pkg_vec_t -Jamey */ ++ abstract_pkg_vec_t * provided_by; ++ abstract_pkg_vec_t * replaced_by; ++}; ++ ++#include "pkg_depends.h" ++ ++/* XXX: CLEANUP: I'd like to clean up pkg_t in several ways: ++ ++ The 3 version fields should go into a single version struct. (This ++ is especially important since, currently, pkg->version can easily ++ be mistaken for pkg_verson_str_alloc(pkg) although they are very ++ distinct. This has been the source of multiple bugs. ++ ++ The 3 state fields could possibly also go into their own struct. ++ ++ All fields which deal with lists of packages, (Depends, ++ Pre-Depends, Provides, Suggests, Recommends, Enhances), should each ++ be handled by a single struct in pkg_t ++ ++ All string fields for which there is a small set of possible ++ values, (section, maintainer, architecture, maybe version?), that ++ are reused among different packages -- for all such packages we ++ should move from "char *"s to some atom datatype to share data ++ storage and use less memory. We might even do reference counting, ++ but probably not since most often we only create new pkg_t structs, ++ we don't often free them. */ ++struct pkg ++{ ++ char *name; ++ unsigned long epoch; ++ char *version; ++ char *revision; ++ char *familiar_revision; ++ pkg_src_t *src; ++ pkg_dest_t *dest; ++ char *architecture; ++ char *section; ++ char *maintainer; ++ char *description; ++ pkg_state_want_t state_want; ++ pkg_state_flag_t state_flag; ++ pkg_state_status_t state_status; ++ char **depends_str; ++ int depends_count; ++ char **pre_depends_str; ++ int pre_depends_count; ++ char **recommends_str; ++ int recommends_count; ++ char **suggests_str; ++ int suggests_count; ++ compound_depend_t * depends; ++ ++ /* Abhaya: new conflicts */ ++ char **conflicts_str; ++ compound_depend_t * conflicts; ++ int conflicts_count; ++ ++ char **replaces_str; ++ int replaces_count; ++ abstract_pkg_t ** replaces; ++ ++ char **provides_str; ++ int provides_count; ++ abstract_pkg_t ** provides; ++ ++ abstract_pkg_t *parent; ++ ++ pkg_t *old_pkg; /* during upgrade, points from installee to previously installed */ ++ ++ char *filename; ++ char *local_filename; ++ char *url; ++ char *tmp_unpack_dir; ++ char *md5sum; ++ char *size; ++ char *installed_size; ++ char *priority; ++ char *source; ++ conffile_list_t conffiles; ++ time_t installed_time; ++ /* As pointer for lazy evaluation */ ++ str_list_t *installed_files; ++ /* XXX: CLEANUP: I'd like to perhaps come up with a better ++ mechanism to avoid the problem here, (which is that the ++ installed_files list was being freed from an inner loop while ++ still being used within an outer loop. */ ++ int installed_files_ref_cnt; ++ int essential; ++ int arch_priority; ++/* Adding this flag, to "force" ipkg to choose a "provided_by_hand" package, if there are multiple choice */ ++ int provided_by_hand; ++}; ++ ++pkg_t *pkg_new(void); ++int pkg_init(pkg_t *pkg); ++void pkg_deinit(pkg_t *pkg); ++int pkg_init_from_file(pkg_t *pkg, const char *filename); ++abstract_pkg_t *abstract_pkg_new(void); ++int abstract_pkg_init(abstract_pkg_t *ab_pkg); ++ ++/* ++ * merges fields from newpkg into oldpkg. ++ * Forcibly sets oldpkg state_status, state_want and state_flags if set_status is nonzero ++ */ ++int pkg_merge(pkg_t *oldpkg, pkg_t *newpkg, int set_status); ++ ++char *pkg_version_str_alloc(pkg_t *pkg); ++ ++int pkg_compare_versions(const pkg_t *pkg, const pkg_t *ref_pkg); ++int pkg_name_version_and_architecture_compare(void *a, void *b); ++int abstract_pkg_name_compare(void *a, void *b); ++ ++char * pkg_formatted_info(pkg_t *pkg ); ++char * pkg_formatted_field(pkg_t *pkg, const char *field ); ++ ++void set_flags_from_control(ipkg_conf_t *conf, pkg_t *pkg); ++ ++void pkg_print_info(pkg_t *pkg, FILE *file); ++void pkg_print_status(pkg_t * pkg, FILE * file); ++void pkg_print_field(pkg_t *pkg, FILE *file, const char *field); ++str_list_t *pkg_get_installed_files(pkg_t *pkg); ++int pkg_free_installed_files(pkg_t *pkg); ++int pkg_remove_installed_files_list(ipkg_conf_t *conf, pkg_t *pkg); ++conffile_t *pkg_get_conffile(pkg_t *pkg, const char *file_name); ++int pkg_run_script(struct ipkg_conf *conf, pkg_t *pkg, ++ const char *script, const char *args); ++ ++/* enum mappings */ ++char *pkg_state_want_to_str(pkg_state_want_t sw); ++pkg_state_want_t pkg_state_want_from_str(char *str); ++char *pkg_state_flag_to_str(pkg_state_flag_t sf); ++pkg_state_flag_t pkg_state_flag_from_str(char *str); ++char *pkg_state_status_to_str(pkg_state_status_t ss); ++pkg_state_status_t pkg_state_status_from_str(char *str); ++ ++int pkg_version_satisfied(pkg_t *it, pkg_t *ref, const char *op); ++ ++int pkg_arch_supported(ipkg_conf_t *conf, pkg_t *pkg); ++int pkg_info_preinstall_check(ipkg_conf_t *conf); ++int pkg_free_installed_files(pkg_t *pkg); ++ ++int pkg_write_filelist(ipkg_conf_t *conf, pkg_t *pkg); ++int pkg_write_changed_filelists(ipkg_conf_t *conf); ++ ++#endif +diff -ruN busybox-1.2.0-orig/archival/libipkg/pkg_hash.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_hash.c +--- busybox-1.2.0-orig/archival/libipkg/pkg_hash.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_hash.c 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,617 @@ ++/* ipkg_hash.c - the itsy package management system ++ ++ Steven M. Ayer ++ ++ Copyright (C) 2002 Compaq Computer Corporation ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#include "ipkg.h" ++#include <errno.h> ++#include <ctype.h> ++#include <stdlib.h> ++#include <string.h> ++ ++#include "hash_table.h" ++#include "pkg.h" ++#include "ipkg_message.h" ++#include "pkg_vec.h" ++#include "pkg_hash.h" ++#include "pkg_parse.h" ++#include "ipkg_utils.h" ++ ++static abstract_pkg_t * add_new_abstract_pkg_by_name(hash_table_t * hash, const char * pkg_name); ++ ++/* ++ * this will talk to both feeds-lists files and installed status files ++ * example api: ++ * ++ * hash_table_t hash; ++ * pkg_hash_init(name, &hash, 1000); ++ * pkg_hash_add_from_file(<feed filename>); ++ * ++ * the query function is just there as a shell to prove to me that this ++ * sort of works, but isn't far from doing something useful ++ * ++ * -sma, 12/21/01 ++ * modified: CDW 3 Jan. 2002 ++ */ ++ ++ ++ ++int pkg_hash_init(const char *name, hash_table_t *hash, int len) ++{ ++ return hash_table_init(name, hash, len); ++} ++ ++void pkg_hash_deinit(hash_table_t *hash) ++{ ++ hash_table_deinit(hash); ++} ++ ++ ++/* Find the default arch for a given package status file if none is given. */ ++static char *pkg_get_default_arch(ipkg_conf_t *conf) ++{ ++ nv_pair_list_elt_t *l; ++ char *def_arch = HOST_CPU_STR; /* Default arch */ ++ int def_prio = 0; /* Other archs override this */ ++ ++ l = conf->arch_list.head; ++ ++ while (l) { ++ nv_pair_t *nv = l->data; ++ int priority = strtol(nv->value, NULL, 0); ++ ++ /* Check if this arch has higher priority, and is valid */ ++ if ((priority > def_prio) && ++ (strcmp(nv->name, "all")) && (strcmp(nv->name, "noarch"))) { ++ /* Our new default */ ++ def_prio = priority; ++ def_arch = nv->name; ++ } ++ l = l->next; ++ } ++ ++ return strdup(def_arch); ++} ++ ++int pkg_hash_add_from_file(ipkg_conf_t *conf, const char *file_name, ++ pkg_src_t *src, pkg_dest_t *dest, int is_status_file) ++{ ++ hash_table_t *hash = &conf->pkg_hash; ++ char **raw; ++ char **raw_start; ++ pkg_t *pkg; ++ ++ raw = raw_start = read_raw_pkgs_from_file(file_name); ++ if (!raw) ++ return -ENOMEM; ++ ++ while(*raw){ /* don't worry, we'll increment raw in the parsing function */ ++ pkg = pkg_new(); ++ if (!pkg) ++ return -ENOMEM; ++ ++ if (pkg_parse_raw(pkg, &raw, src, dest) == 0) { ++ if (!pkg->architecture) { ++ char *version_str = pkg_version_str_alloc(pkg); ++ pkg->architecture = pkg_get_default_arch(conf); ++ ipkg_message(conf, IPKG_ERROR, "Package %s version %s has no architecture specified, defaulting to %s.\n", ++ pkg->name, version_str, pkg->architecture); ++ free(version_str); ++ } ++ hash_insert_pkg(hash, pkg, is_status_file,conf); ++ } else { ++ free(pkg); ++ } ++ } ++ ++ /* XXX: CLEANUP: I'd like a cleaner interface for cleaning up ++ memory after read_raw_pkgs_from_file */ ++ raw = raw_start; ++ while (*raw) { ++ free(*raw++); ++ } ++ free(raw_start); ++ return 0; ++} ++ ++abstract_pkg_t * abstract_pkg_fetch_by_name(hash_table_t * hash, const char * pkg_name) ++{ ++ return (abstract_pkg_t *)hash_table_get(hash, pkg_name); ++} ++ ++abstract_pkg_vec_t *pkg_hash_fetch_all_installation_candidates(hash_table_t *hash, const char *name) ++{ ++ abstract_pkg_t *apkg = abstract_pkg_fetch_by_name(hash, name); ++ if (apkg) ++ return NULL; ++ return apkg->provided_by; ++} ++ ++ ++pkg_t *pkg_hash_fetch_best_installation_candidate(ipkg_conf_t *conf, abstract_pkg_t *apkg, ++ int (*constraint_fcn)(pkg_t *pkg, void *cdata), void *cdata, int quiet) ++{ ++ int i; ++ int nprovides = 0; ++ int nmatching = 0; ++ pkg_vec_t *matching_pkgs = pkg_vec_alloc(); ++ abstract_pkg_vec_t *matching_apkgs = abstract_pkg_vec_alloc(); ++ abstract_pkg_vec_t *provided_apkg_vec; ++ abstract_pkg_t **provided_apkgs; ++ abstract_pkg_vec_t *providers = abstract_pkg_vec_alloc(); ++ pkg_t *latest_installed_parent = NULL; ++ pkg_t *latest_matching = NULL; ++ pkg_t *held_pkg = NULL; ++ pkg_t *good_pkg_by_name = NULL; ++ ++ if (matching_apkgs == NULL || providers == NULL || ++ apkg == NULL || apkg->provided_by == NULL || (apkg->provided_by->len == 0)) ++ return NULL; ++ ++ ipkg_message(conf, IPKG_DEBUG, "best installation candidate for %s\n", apkg->name); ++ ++ provided_apkg_vec = apkg->provided_by; ++ nprovides = provided_apkg_vec->len; ++ provided_apkgs = provided_apkg_vec->pkgs; ++ if (nprovides > 1) ++ ipkg_message(conf, IPKG_DEBUG, " apkg=%s nprovides=%d\n", apkg->name, nprovides); ++ ++ /* accumulate all the providers */ ++ for (i = 0; i < nprovides; i++) { ++ abstract_pkg_t *provider_apkg = provided_apkgs[i]; ++ ipkg_message(conf, IPKG_DEBUG, " adding %s to providers\n", provider_apkg->name); ++ abstract_pkg_vec_insert(providers, provider_apkg); ++ } ++ nprovides = providers->len; ++ ++ for (i = 0; i < nprovides; i++) { ++ abstract_pkg_t *provider_apkg = abstract_pkg_vec_get(providers, i); ++ abstract_pkg_t *replacement_apkg = NULL; ++ pkg_vec_t *vec; ++ ++ if (provider_apkg->replaced_by && provider_apkg->replaced_by->len) { ++ replacement_apkg = provider_apkg->replaced_by->pkgs[0]; ++ if (provider_apkg->replaced_by->len > 1) { ++ ipkg_message(conf, IPKG_NOTICE, "Multiple replacers for %s, using first one (%s)\n", ++ provider_apkg->name, replacement_apkg->name); ++ } ++ } ++ ++ if (replacement_apkg) ++ ipkg_message(conf, IPKG_DEBUG, " replacement_apkg=%s for provider_apkg=%s\n", ++ replacement_apkg->name, provider_apkg->name); ++ ++ if (replacement_apkg && (replacement_apkg != provider_apkg)) { ++ if (abstract_pkg_vec_contains(providers, replacement_apkg)) ++ continue; ++ else ++ provider_apkg = replacement_apkg; ++ } ++ ++ if (!(vec = provider_apkg->pkgs)) { ++ ipkg_message(conf, IPKG_DEBUG, " no pkgs for provider_apkg %s\n", provider_apkg->name); ++ continue; ++ } ++ ++ ++ /* now check for supported architecture */ ++ { ++ int max_count = 0; ++ int i; ++ ++ /* count packages matching max arch priority and keep track of last one */ ++ for (i = 0; i < vec->len; i++) { ++ pkg_t *maybe = vec->pkgs[i]; ++ ipkg_message(conf, IPKG_DEBUG, " %s arch=%s arch_priority=%d version=%s \n", ++ maybe->name, maybe->architecture, maybe->arch_priority, maybe->version); ++ if (maybe->arch_priority > 0) { ++ max_count++; ++ abstract_pkg_vec_insert(matching_apkgs, maybe->parent); ++ pkg_vec_insert(matching_pkgs, maybe); ++ } ++ } ++ } ++ } ++ ++ if (matching_pkgs->len > 1) ++ pkg_vec_sort(matching_pkgs, pkg_name_version_and_architecture_compare); ++ if (matching_apkgs->len > 1) ++ abstract_pkg_vec_sort(matching_pkgs, abstract_pkg_name_compare); ++ ++/* Here it is usefull, if ( matching_apkgs->len > 1 ), to test if one of this matching packages has the same name of the ++ needed package. In this case, I would return it for install, otherwise I will continue with the procedure */ ++/* The problem is what to do when there are more than a mathing package, with the same name and several version ? ++ Until now I always got the latest, but that breaks the downgrade option. ++ If I stop at the first one, I would probably miss the new ones ++ Maybe the way is to have some kind of flag somewhere, to see if the package been asked to install is from a file, ++ or from a Packages feed. ++ It it is from a file it always need to be checked whatever version I have in feeds or everywhere, according to force-down or whatever options*/ ++/*Pigi*/ ++ ++ for (i = 0; i < matching_pkgs->len; i++) { ++ pkg_t *matching = matching_pkgs->pkgs[i]; ++ if (constraint_fcn(matching, cdata)) { /* We found it */ ++ ipkg_message(conf, IPKG_DEBUG, " Found a valid candidate for the install: %s %s \n", matching->name, matching->version) ; ++ good_pkg_by_name = matching; ++ if ( matching->provided_by_hand == 1 ) /* It has been provided by hand, so it is what user want */ ++ break; ++ } ++ } ++ ++ ++ for (i = 0; i < matching_pkgs->len; i++) { ++ pkg_t *matching = matching_pkgs->pkgs[i]; ++ latest_matching = matching; ++ if (matching->parent->state_status == SS_INSTALLED || matching->parent->state_status == SS_UNPACKED) ++ latest_installed_parent = matching; ++ if (matching->state_flag & (SF_HOLD|SF_PREFER)) { ++ if (held_pkg) ++ ipkg_message(conf, IPKG_ERROR, "Multiple packages (%s and %s) providing same name marked HOLD or PREFER. Using latest.\n", ++ held_pkg->name, matching->name); ++ held_pkg = matching; ++ } ++ } ++ ++ if (!good_pkg_by_name && !held_pkg && !latest_installed_parent && matching_apkgs->len > 1 && !quiet) { ++ ipkg_message(conf, IPKG_ERROR, "Package=%s, %d matching providers\n", ++ apkg->name, matching_apkgs->len); ++ for (i = 0; i < matching_apkgs->len; i++) { ++ abstract_pkg_t *matching = matching_apkgs->pkgs[i]; ++ ipkg_message(conf, IPKG_ERROR, " %s\n", matching->name); ++ } ++ ipkg_message(conf, IPKG_ERROR, "Please select one with ipkg install or ipkg flag prefer\n"); ++ } ++ ++ if (matching_apkgs->len > 1 && conf->verbosity > 1) { ++ ipkg_message(conf, IPKG_NOTICE, "%s: for apkg=%s, %d matching pkgs\n", ++ __FUNCTION__, apkg->name, matching_pkgs->len); ++ for (i = 0; i < matching_pkgs->len; i++) { ++ pkg_t *matching = matching_pkgs->pkgs[i]; ++ ipkg_message(conf, IPKG_INFO, " %s %s %s\n", ++ matching->name, matching->version, matching->architecture); ++ } ++ } ++ ++ nmatching = matching_apkgs->len; ++ ++ pkg_vec_free(matching_pkgs); ++ abstract_pkg_vec_free(matching_apkgs); ++ abstract_pkg_vec_free(providers); ++ ++ if (good_pkg_by_name) { /* We found a good candidate, we will install it */ ++ return good_pkg_by_name; ++ } ++ if (held_pkg) { ++ ipkg_message(conf, IPKG_INFO, " using held package %s\n", held_pkg->name); ++ return held_pkg; ++ } ++ if (latest_installed_parent) { ++ ipkg_message(conf, IPKG_INFO, " using latest version of installed package %s\n", latest_installed_parent->name); ++ return latest_installed_parent; ++ } ++ if (nmatching > 1) { ++ ipkg_message(conf, IPKG_INFO, " no matching pkg out of matching_apkgs=%d\n", nmatching); ++ return NULL; ++ } ++ if (latest_matching) { ++ ipkg_message(conf, IPKG_INFO, " using latest matching %s %s %s\n", ++ latest_matching->name, latest_matching->version, latest_matching->architecture); ++ return latest_matching; ++ } ++ return NULL; ++} ++ ++static int pkg_name_constraint_fcn(pkg_t *pkg, void *cdata) ++{ ++ const char *name = (const char *)cdata; ++ if (strcmp(pkg->name, name) == 0) ++ return 1; ++ else ++ return 0; ++} ++ ++pkg_t *pkg_hash_fetch_best_installation_candidate_by_name(ipkg_conf_t *conf, const char *name) ++{ ++ hash_table_t *hash = &conf->pkg_hash; ++ abstract_pkg_t *apkg = NULL; ++ ++ if (!(apkg = abstract_pkg_fetch_by_name(hash, name))) ++ return NULL; ++ ++ return pkg_hash_fetch_best_installation_candidate(conf, apkg, pkg_name_constraint_fcn, apkg->name, 0); ++} ++ ++ ++pkg_t * pkg_hash_fetch_by_name_version(hash_table_t *hash, ++ const char *pkg_name, ++ const char * version) ++{ ++ pkg_vec_t * vec; ++ register int i; ++ char *version_str = NULL; ++ ++ if(!(vec = pkg_vec_fetch_by_name(hash, pkg_name))) ++ return NULL; ++ ++ for(i = 0; i < vec->len; i++) { ++ version_str = pkg_version_str_alloc(vec->pkgs[i]); ++ if(!strcmp(version_str, version)) { ++ free(version_str); ++ break; ++ } ++ free(version_str); ++ } ++ ++ if(i == vec->len) ++ return NULL; ++ ++ return vec->pkgs[i]; ++} ++ ++pkg_t *pkg_hash_fetch_installed_by_name_dest(hash_table_t *hash, ++ const char *pkg_name, ++ pkg_dest_t *dest) ++{ ++ pkg_vec_t * vec; ++ register int i; ++ ++ if(!(vec = pkg_vec_fetch_by_name(hash, pkg_name))) { ++ return NULL; ++ } ++ ++ for(i = 0; i < vec->len; i++) ++ if((vec->pkgs[i]->state_status == SS_INSTALLED || vec->pkgs[i]->state_status == SS_UNPACKED) && vec->pkgs[i]->dest == dest) { ++ return vec->pkgs[i]; ++ } ++ return NULL; ++} ++ ++pkg_t *pkg_hash_fetch_installed_by_name(hash_table_t *hash, ++ const char *pkg_name) ++{ ++ pkg_vec_t * vec; ++ register int i; ++ ++ if(!(vec = pkg_vec_fetch_by_name(hash, pkg_name))){ ++ return NULL; ++ } ++ ++ for(i = 0; i < vec->len; i++) ++ if (vec->pkgs[i]->state_status == SS_INSTALLED || vec->pkgs[i]->state_status == SS_UNPACKED){ ++ return vec->pkgs[i]; ++ } ++ ++ return NULL; ++} ++ ++pkg_vec_t *pkg_vec_fetch_by_name(hash_table_t *hash, const char *pkg_name) ++{ ++ abstract_pkg_t * ab_pkg; ++ ++ if(!(ab_pkg = abstract_pkg_fetch_by_name(hash, pkg_name))){ ++ return NULL; ++ } ++ ++ if (ab_pkg->pkgs) { ++ return ab_pkg->pkgs; ++ } else if (ab_pkg->provided_by) { ++ abstract_pkg_t *abpkg = abstract_pkg_vec_get(ab_pkg->provided_by, 0); ++ if (abpkg != NULL){ ++ return abpkg->pkgs; ++ } else { ++ return ab_pkg->pkgs; ++ } ++ } else { ++ return NULL; ++ } ++} ++ ++static int pkg_compare_names(const void *p1, const void *p2) ++{ ++ const pkg_t *pkg1 = *(const pkg_t **)p1; ++ const pkg_t *pkg2 = *(const pkg_t **)p2; ++ if (pkg1->name == NULL) ++ return 1; ++ if (pkg2->name == NULL) ++ return -1; ++ return(strcmp(pkg1->name, pkg2->name)); ++} ++ ++ ++static void pkg_hash_fetch_available_helper(const char *pkg_name, void *entry, void *data) ++{ ++ int j; ++ abstract_pkg_t *ab_pkg = (abstract_pkg_t *)entry; ++ pkg_vec_t *all = (pkg_vec_t *)data; ++ pkg_vec_t *pkg_vec = ab_pkg->pkgs; ++ if (pkg_vec) { ++ for (j = 0; j < pkg_vec->len; j++) { ++ pkg_t *pkg = pkg_vec->pkgs[j]; ++ pkg_vec_insert(all, pkg); ++ } ++ } ++} ++ ++void pkg_hash_fetch_available(hash_table_t *hash, pkg_vec_t *all) ++{ ++ hash_table_foreach(hash, pkg_hash_fetch_available_helper, all); ++ qsort(all->pkgs, all->len, sizeof(pkg_t *), pkg_compare_names); ++} ++ ++static void pkg_hash_fetch_all_installed_helper(const char *pkg_name, void *entry, void *data) ++{ ++ abstract_pkg_t *ab_pkg = (abstract_pkg_t *)entry; ++ pkg_vec_t *all = (pkg_vec_t *)data; ++ pkg_vec_t *pkg_vec = ab_pkg->pkgs; ++ int j; ++ if (pkg_vec) { ++ for (j = 0; j < pkg_vec->len; j++) { ++ pkg_t *pkg = pkg_vec->pkgs[j]; ++ if (pkg->state_status == SS_INSTALLED || pkg->state_status == SS_UNPACKED) { ++ pkg_vec_insert(all, pkg); ++ } ++ } ++ } ++} ++void pkg_hash_fetch_all_installed(hash_table_t *hash, pkg_vec_t *all) ++{ ++ hash_table_foreach(hash, pkg_hash_fetch_all_installed_helper, all); ++ qsort(all->pkgs, all->len, sizeof(void*), pkg_compare_names); ++} ++ ++static void pkg_hash_dump_helper(const char *pkg_name, void *entry, void *data) ++{ ++ int i; ++ pkg_t *pkg; ++ abstract_pkg_t *ab_pkg = (abstract_pkg_t *)entry; ++ ipkg_conf_t *conf = (ipkg_conf_t *)data; ++ abstract_pkg_t ** dependents = ab_pkg->depended_upon_by; ++ fprintf(stdout, "%s\n", ab_pkg->name); ++ i = 0; ++ if (dependents != NULL) ++ while (dependents [i] != NULL) ++ printf ("\tdepended upon by - %s\n", dependents [i ++]->name); ++ dependents = ab_pkg->provided_by->pkgs; ++ i = 0; ++ if (dependents != NULL) ++ while (dependents [i] != NULL && i < ab_pkg->provided_by->len) ++ printf ("\tprovided by - %s\n", dependents [i ++]->name); ++ pkg = pkg_hash_fetch_best_installation_candidate_by_name (conf, ab_pkg->name); ++ if (pkg) { ++ i = 0; ++ while (i < pkg->depends_count) ++ printf ("\tdepends on - %s\n", pkg->depends_str [i ++]); ++ } ++} ++void pkg_hash_dump(hash_table_t *hash, void *data) ++{ ++ ++ printf ("\n\n+=+%s+=+\n\n", __FUNCTION__); ++ hash_table_foreach(hash, pkg_hash_dump_helper, data); ++ printf ("\n+=+%s+=+\n\n", __FUNCTION__); ++} ++ ++abstract_pkg_t * ensure_abstract_pkg_by_name(hash_table_t * hash, const char * pkg_name) ++{ ++ abstract_pkg_t * ab_pkg; ++ ++ if(!(ab_pkg = abstract_pkg_fetch_by_name(hash, pkg_name))) ++ ab_pkg = add_new_abstract_pkg_by_name(hash, pkg_name); ++ ++ return ab_pkg; ++} ++ ++pkg_t *hash_insert_pkg(hash_table_t *hash, pkg_t *pkg, int set_status,ipkg_conf_t *conf) ++{ ++ abstract_pkg_t * ab_pkg; ++ int arch_priority; ++ ++ if(!pkg) ++ return pkg; ++ ++ arch_priority = pkg->arch_priority; ++ ++ if (buildDepends(hash, pkg)<0){ ++ fprintf(stderr, "%s : This should never happen. Report this Bug in bugzilla please \n ",__FUNCTION__); ++ return NULL; ++ } ++ ab_pkg = ensure_abstract_pkg_by_name(hash, pkg->name); ++ ++ if (set_status) { ++ if (pkg->state_status == SS_INSTALLED) { ++ ab_pkg->state_status = SS_INSTALLED; ++ } else if (pkg->state_status == SS_UNPACKED) { ++ ab_pkg->state_status = SS_UNPACKED; ++ } ++ } ++ ++ if(!ab_pkg->pkgs) ++ ab_pkg->pkgs = pkg_vec_alloc(); ++ ++ /* pkg_vec_insert_merge might munge package, but it returns an unmunged pkg */ ++ pkg = pkg_vec_insert_merge(ab_pkg->pkgs, pkg, set_status,conf ); ++ pkg->parent = ab_pkg; ++ ++ if (buildProvides(hash, ab_pkg, pkg)<0){ ++ fprintf(stderr, "%s : This should never happen. Report this Bug in bugzilla please \n ",__FUNCTION__); ++ return NULL; ++ } ++ /* need to build the conflicts graph before replaces for correct calculation of replaced_by relation */ ++ if (buildConflicts(hash, ab_pkg, pkg)<0){ ++ fprintf(stderr, "%s : This should never happen. Report this Bug in bugzilla please \n ",__FUNCTION__); ++ return NULL; ++ } ++ if (buildReplaces(hash, ab_pkg, pkg)<0) { ++ fprintf(stderr, "%s : This should never happen. Report this Bug in bugzilla please \n ",__FUNCTION__); ++ return NULL; ++ } ++ ++ buildDependedUponBy(pkg, ab_pkg); ++ return pkg; ++} ++ ++/* ++ * this will assume that we've already determined that ++ * the abstract pkg doesn't exist, 'cause we should know these things... ++ */ ++static abstract_pkg_t * add_new_abstract_pkg_by_name(hash_table_t * hash, const char * pkg_name) ++{ ++ abstract_pkg_t * ab_pkg; ++ ++ ab_pkg = abstract_pkg_new(); ++ if (ab_pkg == NULL) { return NULL; } ++ ++ ab_pkg->name = strdup(pkg_name); ++ hash_table_insert(hash, pkg_name, ab_pkg); ++ ++ return ab_pkg; ++} ++ ++ ++pkg_t *file_hash_get_file_owner(ipkg_conf_t *conf, const char *file_name) ++{ ++ hash_table_t *file_hash = &conf->file_hash; ++ ++ return hash_table_get(file_hash, file_name); ++} ++ ++int file_hash_set_file_owner(ipkg_conf_t *conf, const char *file_name, pkg_t *owning_pkg) ++{ ++ hash_table_t *file_hash = &conf->file_hash; ++ pkg_t *old_owning_pkg = hash_table_get(file_hash, file_name); ++ int file_name_len = strlen(file_name); ++ ++ if (file_name[file_name_len -1] == '/') ++ return 0; ++ ++ if (conf->offline_root) { ++ int len = strlen(conf->offline_root); ++ if (strncmp(file_name, conf->offline_root, len) == 0) { ++ file_name += len; ++ } ++ } ++ ++ // ipkg_message(conf, IPKG_DEBUG2, "owning_pkg=%s filename=%s\n", owning_pkg->name, file_name); ++ hash_table_insert(file_hash, file_name, owning_pkg); ++ if (old_owning_pkg) { ++ str_list_remove_elt(old_owning_pkg->installed_files, file_name); ++ /* mark this package to have its filelist written */ ++ old_owning_pkg->state_flag |= SF_FILELIST_CHANGED; ++ owning_pkg->state_flag |= SF_FILELIST_CHANGED; ++ } ++ return 0; ++} ++ ++ +diff -ruN busybox-1.2.0-orig/archival/libipkg/pkg_hash.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_hash.h +--- busybox-1.2.0-orig/archival/libipkg/pkg_hash.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_hash.h 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,61 @@ ++/* pkg_hash.h - the itsy package management system ++ ++ Steven M. Ayer ++ ++ Copyright (C) 2002 Compaq Computer Corporation ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#ifndef PKG_HASH_H ++#define PKG_HASH_H ++ ++#include "pkg.h" ++#include "pkg_vec.h" ++#include "hash_table.h" ++ ++ ++int pkg_hash_init(const char *name, hash_table_t *hash, int len); ++void pkg_hash_deinit(hash_table_t *hash); ++void pkg_hash_map(hash_table_t *hash, void (*f)(void *data, void *entry), void *data); ++ ++void pkg_hash_dump(hash_table_t *hash, void *data); ++void pkg_hash_fetch_available(hash_table_t *hash, pkg_vec_t *available); ++ ++int pkg_hash_add_from_file(ipkg_conf_t *conf, const char *file_name, ++ pkg_src_t *src, pkg_dest_t *dest, int is_status_file); ++pkg_t *hash_insert_pkg(hash_table_t *hash, pkg_t *pkg, int set_status,ipkg_conf_t *conf); ++ ++abstract_pkg_t * ensure_abstract_pkg_by_name(hash_table_t * hash, const char * pkg_name); ++abstract_pkg_t * abstract_pkg_fetch_by_name(hash_table_t * hash, const char * pkg_name); ++pkg_vec_t *pkg_hash_fetch_by_name(hash_table_t *hash, const char *pkg_name); ++void pkg_hash_fetch_all_installed(hash_table_t *hash, pkg_vec_t *installed); ++pkg_t * pkg_hash_fetch_by_name_version(hash_table_t *hash, ++ const char *pkg_name, ++ const char * version); ++abstract_pkg_vec_t *pkg_hash_fetch_all_installation_candidates(hash_table_t *hash, const char *name); ++pkg_t *pkg_hash_fetch_best_installation_candidate(ipkg_conf_t *conf, abstract_pkg_t *apkg, ++ int (*constraint_fcn)(pkg_t *pkg, void *data), void *cdata, int quiet); ++pkg_t *pkg_hash_fetch_best_installation_candidate_by_name(ipkg_conf_t *conf, const char *name); ++pkg_t *pkg_hash_fetch_installed_by_name(hash_table_t *hash, ++ const char *pkg_name); ++pkg_t *pkg_hash_fetch_installed_by_name_dest(hash_table_t *hash, ++ const char *pkg_name, ++ pkg_dest_t *dest); ++ ++pkg_t *file_hash_get_file_owner(ipkg_conf_t *conf, const char *file_name); ++int file_hash_set_file_owner(ipkg_conf_t *conf, const char *file_name, pkg_t *pkg); ++ ++/* XXX: shouldn't this go in pkg_vec.[ch]? */ ++pkg_vec_t *pkg_vec_fetch_by_name(hash_table_t *hash, const char *pkg_name); ++ ++#endif ++ +diff -ruN busybox-1.2.0-orig/archival/libipkg/pkg_parse.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_parse.c +--- busybox-1.2.0-orig/archival/libipkg/pkg_parse.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_parse.c 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,366 @@ ++/* pkg_parse.c - the itsy package management system ++ ++ Steven M. Ayer ++ ++ Copyright (C) 2002 Compaq Computer Corporation ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#include "ipkg.h" ++#include <errno.h> ++#include <ctype.h> ++ ++#include "pkg.h" ++#include "ipkg_utils.h" ++#include "pkg_parse.h" ++ ++int isGenericFieldType(char * type, char * line) ++{ ++ if(!strncmp(line, type, strlen(type))) ++ return 1; ++ return 0; ++} ++ ++char * parseGenericFieldType(char * type, char * raw) ++{ ++ char * field_value = raw + (strlen(type) + 1); ++ return trim_alloc(field_value); ++} ++ ++void parseStatus(pkg_t *pkg, char * raw) ++{ ++ char sw_str[64], sf_str[64], ss_str[64]; ++ ++ sscanf(raw, "Status: %s %s %s", sw_str, sf_str, ss_str); ++ pkg->state_want = pkg_state_want_from_str(sw_str); ++ pkg->state_flag = pkg_state_flag_from_str(sf_str); ++ pkg->state_status = pkg_state_status_from_str(ss_str); ++} ++ ++char ** parseDependsString(char * raw, int * depends_count) ++{ ++ char ** depends = NULL; ++ int line_count = 0; ++ char buff[2048], * dest; ++ ++ while(raw && *raw && !isspace(*raw)) { ++ raw++; ++ } ++ ++ if(line_is_blank(raw)){ ++ *depends_count = line_count; ++ return NULL; ++ } ++ while(raw && *raw){ ++ depends = (char **)realloc(depends, sizeof(char *) * (line_count + 1)); ++ ++ while(isspace(*raw)) raw++; ++ ++ dest = buff; ++ while((*raw != ',') && *raw) ++ *dest++ = *raw++; ++ ++ *dest = '\0'; ++ depends[line_count] = trim_alloc(buff); ++ if(depends[line_count] ==NULL) ++ return NULL; ++ line_count++; ++ if(*raw == ',') ++ raw++; ++ } ++ *depends_count = line_count; ++ return depends; ++} ++ ++void parseConffiles(pkg_t * pkg, char * raw) ++{ ++ char file_name[1048], md5sum[1048]; /* please tell me there aren't any longer that 1k */ ++ ++ if(!strncmp(raw, "Conffiles:", 10)) ++ raw += strlen("Conffiles:"); ++ ++ while(*raw && (sscanf(raw, "%s%s", file_name, md5sum) == 2)){ ++ conffile_list_append(&pkg->conffiles, file_name, md5sum); ++ /* fprintf(stderr, "%s %s ", file_name, md5sum);*/ ++ while (*raw && isspace(*raw)) { ++ raw++; ++ } ++ raw += strlen(file_name); ++ while (*raw && isspace(*raw)) { ++ raw++; ++ } ++ raw += strlen(md5sum); ++ } ++} ++ ++int parseVersion(pkg_t *pkg, char *raw) ++{ ++ char *colon, *eepochcolon; ++#ifdef USE_DEBVERSION ++ char *hyphen; ++#endif ++ unsigned long epoch; ++ ++ if (!*raw) { ++ fprintf(stderr, "%s: ERROR: version string is empty", __FUNCTION__); ++ return EINVAL; ++ } ++ ++ if (strncmp(raw, "Version:", 8) == 0) { ++ raw += 8; ++ } ++ while (*raw && isspace(*raw)) { ++ raw++; ++ } ++ ++ colon= strchr(raw,':'); ++ if (colon) { ++ epoch= strtoul(raw,&eepochcolon,10); ++ if (colon != eepochcolon) { ++ fprintf(stderr, "%s: ERROR: epoch in version is not number", __FUNCTION__); ++ return EINVAL; ++ } ++ if (!*++colon) { ++ fprintf(stderr, "%s: ERROR: nothing after colon in version number", __FUNCTION__); ++ return EINVAL; ++ } ++ raw= colon; ++ pkg->epoch= epoch; ++ } else { ++ pkg->epoch= 0; ++ } ++ ++ pkg->revision = ""; ++ pkg->familiar_revision = ""; ++ ++ pkg->version= malloc(strlen(raw)+1); ++ if ( pkg->version == NULL ) { ++ fprintf(stderr, "%s: out of memory \n", __FUNCTION__); ++ return ENOMEM; ++ } ++ strcpy(pkg->version, raw); ++ ++#ifdef USE_DEBVERSION ++ hyphen= strrchr(pkg->version,'-'); ++ ++ if (hyphen) { ++ *hyphen++= 0; ++ if (strncmp("fam", hyphen, 3) == 0) { ++ pkg->familiar_revision=hyphen+3; ++ hyphen= strrchr(pkg->version,'-'); ++ if (hyphen) { ++ *hyphen++= 0; ++ pkg->revision = hyphen; ++ } ++ } else { ++ pkg->revision = hyphen; ++ } ++ } ++#endif ++ ++/* ++ fprintf(stderr,"Parsed version: %lu, %s, %s, %s\n", ++ pkg->epoch, ++ pkg->version, ++ pkg->revision, ++ pkg->familiar_revision); ++*/ ++ ++ return 0; ++} ++ ++ ++/* This code is needed to insert in first position the keyword for the aligning bug */ ++ ++int alterProvidesLine(char *raw, char *temp) ++{ ++ ++ ++ if (!*raw) { ++ fprintf(stderr, "%s: ERROR: Provides string is empty", __FUNCTION__); ++ return -EINVAL; ++ } ++ ++ if ( temp == NULL ) { ++ fprintf(stderr, "%s: out of memory \n", __FUNCTION__); ++ return -ENOMEM; ++ } ++ ++ if (strncmp(raw, "Provides:", 9) == 0) { ++ raw += 9; ++ } ++ while (*raw && isspace(*raw)) { ++ raw++; ++ } ++ ++ snprintf ( temp, 35, "Provides: ipkg_internal_use_only, "); /* First part of the line */ ++ while (*raw) { ++ strncat( temp, raw++, 1); ++ } ++ return 0; ++ ++} ++ ++/* Some random thoughts from Carl: ++ ++ This function could be considerably simplified if we just kept ++ an array of all the generic string-valued field names, and looped ++ through those looking for a match. Also, these fields could perhaps ++ be stored in the package as an array as well, (or, probably better, ++ as an nv_pair_list_t). ++ ++ Fields which require special parsing or storage, (such as Depends: ++ and Status:) could be handled as they are now. ++*/ ++/* XXX: FEATURE: The Suggests: field needs to be changed from a string ++ to a dependency list. And, since we already have ++ Depends/Pre-Depends and need to add Conflicts, Recommends, and ++ Enhances, perhaps we could generalize all of these and save some ++ code duplication. ++*/ ++int pkg_parse_raw(pkg_t *pkg, char ***raw, pkg_src_t *src, pkg_dest_t *dest) ++{ ++ int reading_conffiles, reading_description; ++ int pkg_false_provides=1; ++ char ** lines; ++ char * provide=NULL; ++ ++ pkg->src = src; ++ pkg->dest = dest; ++ ++ reading_conffiles = reading_description = 0; ++ ++ for (lines = *raw; *lines; lines++) { ++ /* fprintf(stderr, "PARSING %s\n", *lines);*/ ++ if(isGenericFieldType("Package:", *lines)) ++ pkg->name = parseGenericFieldType("Package", *lines); ++ else if(isGenericFieldType("Architecture:", *lines)) ++ pkg->architecture = parseGenericFieldType("Architecture", *lines); ++ else if(isGenericFieldType("Filename:", *lines)) ++ pkg->filename = parseGenericFieldType("Filename", *lines); ++ else if(isGenericFieldType("Section:", *lines)) ++ pkg->section = parseGenericFieldType("Section", *lines); ++ else if(isGenericFieldType("MD5sum:", *lines)) ++ pkg->md5sum = parseGenericFieldType("MD5sum", *lines); ++ /* The old ipkg wrote out status files with the wrong case for MD5sum, ++ let's parse it either way */ ++ else if(isGenericFieldType("MD5Sum:", *lines)) ++ pkg->md5sum = parseGenericFieldType("MD5Sum", *lines); ++ else if(isGenericFieldType("Size:", *lines)) ++ pkg->size = parseGenericFieldType("Size", *lines); ++ else if(isGenericFieldType("Source:", *lines)) ++ pkg->source = parseGenericFieldType("Source", *lines); ++ else if(isGenericFieldType("Installed-Size:", *lines)) ++ pkg->installed_size = parseGenericFieldType("Installed-Size", *lines); ++ else if(isGenericFieldType("Installed-Time:", *lines)) { ++ char *time_str = parseGenericFieldType("Installed-Time", *lines); ++ pkg->installed_time = strtoul(time_str, NULL, 0); ++ } else if(isGenericFieldType("Priority:", *lines)) ++ pkg->priority = parseGenericFieldType("Priority", *lines); ++ else if(isGenericFieldType("Essential:", *lines)) { ++ char *essential_value; ++ essential_value = parseGenericFieldType("Essential", *lines); ++ if (strcmp(essential_value, "yes") == 0) { ++ pkg->essential = 1; ++ } ++ free(essential_value); ++ } ++ else if(isGenericFieldType("Status", *lines)) ++ parseStatus(pkg, *lines); ++ else if(isGenericFieldType("Version", *lines)) ++ parseVersion(pkg, *lines); ++ else if(isGenericFieldType("Maintainer", *lines)) ++ pkg->maintainer = parseGenericFieldType("Maintainer", *lines); ++ else if(isGenericFieldType("Conffiles", *lines)){ ++ parseConffiles(pkg, *lines); ++ reading_conffiles = 1; ++ } ++ else if(isGenericFieldType("Description", *lines)) { ++ pkg->description = parseGenericFieldType("Description", *lines); ++ reading_conffiles = 0; ++ reading_description = 1; ++ } ++ ++ else if(isGenericFieldType("Provides", *lines)){ ++/* Here we add the internal_use to align the off by one problem between provides_str and provides */ ++ provide = (char * ) malloc(strlen(*lines)+ 35 ); /* Preparing the space for the new ipkg_internal_use_only */ ++ if ( alterProvidesLine(*lines,provide) ){ ++ return EINVAL; ++ } ++ pkg->provides_str = parseDependsString( provide, &pkg->provides_count); ++/* Let's try to hack a bit here. ++ The idea is that if a package has no Provides, we would add one generic, to permit the check of dependencies ++ in alot of other places. We will remove it before writing down the status database */ ++ pkg_false_provides=0; ++ free(provide); ++ } ++ ++ else if(isGenericFieldType("Depends", *lines)) ++ pkg->depends_str = parseDependsString(*lines, &pkg->depends_count); ++ else if(isGenericFieldType("Pre-Depends", *lines)) ++ pkg->pre_depends_str = parseDependsString(*lines, &pkg->pre_depends_count); ++ else if(isGenericFieldType("Recommends", *lines)) ++ pkg->recommends_str = parseDependsString(*lines, &pkg->recommends_count); ++ else if(isGenericFieldType("Suggests", *lines)) ++ pkg->suggests_str = parseDependsString(*lines, &pkg->suggests_count); ++ /* Abhaya: support for conflicts */ ++ else if(isGenericFieldType("Conflicts", *lines)) ++ pkg->conflicts_str = parseDependsString(*lines, &pkg->conflicts_count); ++ else if(isGenericFieldType("Replaces", *lines)) ++ pkg->replaces_str = parseDependsString(*lines, &pkg->replaces_count); ++ else if(line_is_blank(*lines)) { ++ lines++; ++ break; ++ } ++ else if(**lines == ' '){ ++ if(reading_description) { ++ /* we already know it's not blank, so the rest of description */ ++ pkg->description = realloc(pkg->description, ++ strlen(pkg->description) ++ + 1 + strlen(*lines) + 1); ++ strcat(pkg->description, "\n"); ++ strcat(pkg->description, (*lines)); ++ } ++ else if(reading_conffiles) ++ parseConffiles(pkg, *lines); ++ } ++ } ++ *raw = lines; ++/* If the ipk has not a Provides line, we insert our false line */ ++ if ( pkg_false_provides==1) ++ pkg->provides_str = parseDependsString ((char *)"Provides: ipkg_internal_use_only ", &pkg->provides_count); ++ ++ if (pkg->name) { ++ return 0; ++ } else { ++ return EINVAL; ++ } ++} ++ ++int pkg_valorize_other_field(pkg_t *pkg, char ***raw) ++{ ++ char ** lines; ++ ++ for (lines = *raw; *lines; lines++) { ++ if(isGenericFieldType("Essential:", *lines)) { ++ char *essential_value; ++ essential_value = parseGenericFieldType("Essential", *lines); ++ if (strcmp(essential_value, "yes") == 0) { ++ pkg->essential = 1; ++ } ++ free(essential_value); ++ } ++ } ++ *raw = lines; ++ ++ return 0; ++} +diff -ruN busybox-1.2.0-orig/archival/libipkg/pkg_parse.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_parse.h +--- busybox-1.2.0-orig/archival/libipkg/pkg_parse.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_parse.h 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,31 @@ ++/* pkg_parse.h - the itsy package management system ++ ++ Steven M. Ayer ++ ++ Copyright (C) 2002 Compaq Computer Corporation ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#ifndef PKG_PARSE_H ++#define PKG_PARSE_H ++ ++int isGenericFieldType(char * type, char * line); ++char * parseGenericFieldType(char * type, char * raw); ++void parseStatus(pkg_t *pkg, char * raw); ++int parseVersion(pkg_t *pkg, char *raw); ++char ** parseDependsString(char * raw, int * depends_count); ++int parseVersion(pkg_t *pkg, char *raw); ++void parseConffiles(pkg_t * pkg, char * raw); ++int pkg_parse_raw(pkg_t *pkg, char ***raw, pkg_src_t *src, pkg_dest_t *dest); ++int pkg_valorize_other_field(pkg_t *pkg, char ***raw); ++ ++#endif +diff -ruN busybox-1.2.0-orig/archival/libipkg/pkg_src.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_src.c +--- busybox-1.2.0-orig/archival/libipkg/pkg_src.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_src.c 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,43 @@ ++/* pkg_src.c - the itsy package management system ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#include "ipkg.h" ++ ++#include "pkg_src.h" ++#include "str_util.h" ++ ++int pkg_src_init(pkg_src_t *src, const char *name, const char *base_url, const char *extra_data, int gzip) ++{ ++ src->gzip = gzip; ++ src->name = str_dup_safe (name); ++ src->value = str_dup_safe (base_url); ++ if (extra_data) ++ src->extra_data = str_dup_safe (extra_data); ++ else ++ src->extra_data = NULL; ++ return 0; ++} ++ ++void pkg_src_deinit(pkg_src_t *src) ++{ ++ free (src->name); ++ free (src->value); ++ if (src->extra_data) ++ free (src->extra_data); ++} ++ ++ +diff -ruN busybox-1.2.0-orig/archival/libipkg/pkg_src.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_src.h +--- busybox-1.2.0-orig/archival/libipkg/pkg_src.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_src.h 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,34 @@ ++/* pkg_src.h - the itsy package management system ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#ifndef PKG_SRC_H ++#define PKG_SRC_H ++ ++#include "nv_pair.h" ++ ++typedef struct ++{ ++ char *name; ++ char *value; ++ char *extra_data; ++ int gzip; ++} pkg_src_t; ++ ++int pkg_src_init(pkg_src_t *src, const char *name, const char *base_url, const char *extra_data, int gzip); ++void pkg_src_deinit(pkg_src_t *src); ++ ++#endif +diff -ruN busybox-1.2.0-orig/archival/libipkg/pkg_src_list.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_src_list.c +--- busybox-1.2.0-orig/archival/libipkg/pkg_src_list.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_src_list.c 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,75 @@ ++/* pkg_src_list.c - the itsy package management system ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#include "ipkg.h" ++ ++#include "pkg_src_list.h" ++#include "void_list.h" ++ ++int pkg_src_list_init(pkg_src_list_t *list) ++{ ++ return void_list_init((void_list_t *) list); ++} ++ ++void pkg_src_list_deinit(pkg_src_list_t *list) ++{ ++ pkg_src_list_elt_t *iter; ++ pkg_src_t *pkg_src; ++ ++ for (iter = list->head; iter; iter = iter->next) { ++ pkg_src = iter->data; ++ pkg_src_deinit(pkg_src); ++ ++ /* malloced in pkg_src_list_append */ ++ free(pkg_src); ++ iter->data = NULL; ++ } ++ void_list_deinit((void_list_t *) list); ++} ++ ++pkg_src_t *pkg_src_list_append(pkg_src_list_t *list, ++ const char *name, const char *base_url, const char *extra_data, ++ int gzip) ++{ ++ int err; ++ ++ /* freed in pkg_src_list_deinit */ ++ pkg_src_t *pkg_src = malloc(sizeof(pkg_src_t)); ++ ++ if (pkg_src == NULL) { ++ fprintf(stderr, "%s: out of memory\n", __FUNCTION__); ++ return NULL; ++ } ++ pkg_src_init(pkg_src, name, base_url, extra_data, gzip); ++ ++ err = void_list_append((void_list_t *) list, pkg_src); ++ if (err) { ++ return NULL; ++ } ++ ++ return pkg_src; ++} ++ ++int pkg_src_list_push(pkg_src_list_t *list, pkg_src_t *data) ++{ ++ return void_list_push((void_list_t *) list, data); ++} ++ ++pkg_src_list_elt_t *pkg_src_list_pop(pkg_src_list_t *list) ++{ ++ return (pkg_src_list_elt_t *) void_list_pop((void_list_t *) list); ++} +diff -ruN busybox-1.2.0-orig/archival/libipkg/pkg_src_list.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_src_list.h +--- busybox-1.2.0-orig/archival/libipkg/pkg_src_list.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_src_list.h 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,57 @@ ++/* pkg_src_list.h - the itsy package management system ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#ifndef PKG_SRC_LIST_H ++#define PKG_SRC_LIST_H ++ ++#include "pkg_src.h" ++ ++typedef struct pkg_src_list_elt pkg_src_list_elt_t; ++struct pkg_src_list_elt ++{ ++ pkg_src_list_elt_t *next; ++ pkg_src_t *data; ++}; ++ ++typedef struct pkg_src_list pkg_src_list_t; ++struct pkg_src_list ++{ ++ pkg_src_list_elt_t pre_head; ++ pkg_src_list_elt_t *head; ++ pkg_src_list_elt_t *tail; ++}; ++ ++static inline int pkg_src_list_empty(pkg_src_list_t *list) ++{ ++ if (list->head == NULL) ++ return 1; ++ else ++ return 0; ++} ++ ++int pkg_src_list_elt_init(pkg_src_list_elt_t *elt, nv_pair_t *data); ++void pkg_src_list_elt_deinit(pkg_src_list_elt_t *elt); ++ ++int pkg_src_list_init(pkg_src_list_t *list); ++void pkg_src_list_deinit(pkg_src_list_t *list); ++ ++pkg_src_t *pkg_src_list_append(pkg_src_list_t *list, const char *name, const char *root_dir, const char *extra_data, int gzip); ++int pkg_src_list_push(pkg_src_list_t *list, pkg_src_t *data); ++pkg_src_list_elt_t *pkg_src_list_pop(pkg_src_list_t *list); ++ ++#endif ++ +diff -ruN busybox-1.2.0-orig/archival/libipkg/pkg_vec.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_vec.c +--- busybox-1.2.0-orig/archival/libipkg/pkg_vec.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_vec.c 2006-07-22 16:31:26.000000000 +0200 +@@ -0,0 +1,230 @@ ++/* pkg_vec.c - the itsy package management system ++ ++ Steven M. Ayer ++ ++ Copyright (C) 2002 Compaq Computer Corporation ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#include <stdlib.h> ++#include <fnmatch.h> ++#include "xregex.h" ++#include "ipkg.h" ++#include "pkg.h" ++ ++pkg_vec_t * pkg_vec_alloc(void) ++{ ++ pkg_vec_t * vec = (pkg_vec_t *)malloc(sizeof(pkg_vec_t)); ++ if (!vec) { ++ fprintf(stderr, "%s: out of memory\n", __FUNCTION__); ++ return NULL; ++ } ++ vec->pkgs = NULL; ++ vec->len = 0; ++ ++ return vec; ++} ++ ++void pkg_vec_free(pkg_vec_t *vec) ++{ ++ free(vec->pkgs); ++ free(vec); ++} ++ ++/* ++ * assumption: all names in a vector are identical ++ * assumption: all version strings are trimmed, ++ * so identical versions have identical version strings, ++ * implying identical packages; let's marry these ++ */ ++pkg_t *pkg_vec_insert_merge(pkg_vec_t *vec, pkg_t *pkg, int set_status,ipkg_conf_t *conf) ++{ ++ int i; ++ int found = 0; ++ ++ /* look for a duplicate pkg by name, version, and architecture */ ++ for (i = 0; i < vec->len; i++){ ++ ipkg_message(conf, IPKG_DEBUG2, "Function: %s. Found pkg=%s version=%s arch=%s cmp=%s version=%s arch=%s \n", ++ __FUNCTION__, pkg->name, pkg->version, pkg->architecture, ++ vec->pkgs[i]->name, vec->pkgs[i]->version,vec->pkgs[i]->architecture ); ++ if ((strcmp(pkg->name, vec->pkgs[i]->name) == 0) ++ && (pkg_compare_versions(pkg, vec->pkgs[i]) == 0) ++ && (strcmp(pkg->architecture, vec->pkgs[i]->architecture) == 0)) { ++ found = 1; ++ ipkg_message(conf, IPKG_DEBUG2, "Function: %s. Found duplicate for pkg=%s version=%s arch=%s\n", ++ __FUNCTION__, pkg->name, pkg->version, pkg->architecture); ++ break; ++ } ++ } ++ ++ /* we didn't find one, add it */ ++ if (!found){ ++ ipkg_message(conf, IPKG_DEBUG2, "Function: %s. Adding new pkg=%s version=%s arch=%s\n", ++ __FUNCTION__, pkg->name, pkg->version, pkg->architecture); ++ ++ vec->pkgs = (pkg_t **)realloc(vec->pkgs, (vec->len + 1) * sizeof(pkg_t *)); ++ vec->pkgs[vec->len] = pkg; ++ vec->len++; ++ return pkg; ++ } ++ /* update the one that we have */ ++ else { ++ ipkg_message(conf, IPKG_DEBUG2, "Function: %s. calling pkg_merge for pkg=%s version=%s arch=%s", ++ __FUNCTION__, pkg->name, pkg->version, pkg->architecture); ++ if (set_status) { ++ /* this is from the status file, so need to merge with existing database */ ++ ipkg_message(conf, IPKG_DEBUG2, " with set_status\n"); ++ pkg_merge(vec->pkgs[i], pkg, set_status); ++ /* XXX: CLEANUP: It's not so polite to free something here ++ that was passed in from above. */ ++ pkg_deinit(pkg); ++ free(pkg); ++ } else { ++ ipkg_message(conf, IPKG_DEBUG2, " WITHOUT set_status\n"); ++ /* just overwrite the old one */ ++ pkg_deinit(vec->pkgs[i]); ++ free(vec->pkgs[i]); ++ vec->pkgs[i] = pkg; ++ } ++ return vec->pkgs[i]; ++ } ++} ++ ++void pkg_vec_insert(pkg_vec_t *vec, const pkg_t *pkg) ++{ ++ int i; ++ int found = 0; ++ ++ /* look for a duplicate pkg by name, version, and architecture */ ++ for (i = 0; i < vec->len; i++) ++ if ((strcmp(pkg->name, vec->pkgs[i]->name) == 0) ++ && (pkg_compare_versions(pkg, vec->pkgs[i]) == 0) ++ && (strcmp(pkg->architecture, vec->pkgs[i]->name) == 0)) { ++ found = 1; ++ break; ++ } ++ ++ /* we didn't find one, add it */ ++ if(!found){ ++ vec->pkgs = (pkg_t **)realloc(vec->pkgs, (vec->len + 1) * sizeof(pkg_t *)); ++ *(const pkg_t **)&vec->pkgs[vec->len] = pkg; ++ vec->len++; ++ } ++} ++ ++int pkg_vec_contains(pkg_vec_t *vec, pkg_t *apkg) ++{ ++ int i; ++ for (i = 0; i < vec->len; i++) ++ if (vec->pkgs[i] == apkg) ++ return 1; ++ return 0; ++} ++ ++typedef int (*compare_fcn_t)(const void *, const void *); ++void pkg_vec_sort(pkg_vec_t *vec, int (*compar)(pkg_t *, pkg_t *)) ++{ ++ qsort(vec->pkgs, vec->len, sizeof(pkg_t *), (compare_fcn_t)compar); ++} ++ ++int pkg_vec_clear_marks(pkg_vec_t *vec) ++{ ++ int npkgs = vec->len; ++ int i; ++ for (i = 0; i < npkgs; i++) { ++ pkg_t *pkg = vec->pkgs[i]; ++ pkg->state_flag &= ~SF_MARKED; ++ } ++ return 0; ++} ++ ++int pkg_vec_mark_if_matches(pkg_vec_t *vec, const char *pattern) ++{ ++ int matching_count = 0; ++ pkg_t **pkgs = vec->pkgs; ++ int npkgs = vec->len; ++ int i; ++ for (i = 0; i < npkgs; i++) { ++ pkg_t *pkg = pkgs[i]; ++ if (fnmatch(pattern, pkg->name, 0)==0) { ++ pkg->state_flag |= SF_MARKED; ++ matching_count++; ++ } ++ } ++ return matching_count; ++} ++ ++ ++abstract_pkg_vec_t * abstract_pkg_vec_alloc(void) ++{ ++ abstract_pkg_vec_t * vec ; ++ vec = (abstract_pkg_vec_t *)malloc(sizeof(abstract_pkg_vec_t)); ++ if (!vec) { ++ fprintf(stderr, "%s: out of memory\n", __FUNCTION__); ++ return NULL; ++ } ++ vec->pkgs = NULL; ++ vec->len = 0; ++ ++ return vec; ++} ++ ++void abstract_pkg_vec_free(abstract_pkg_vec_t *vec) ++{ ++ free(vec->pkgs); ++ free(vec); ++} ++ ++/* ++ * assumption: all names in a vector are unique ++ */ ++void abstract_pkg_vec_insert(abstract_pkg_vec_t *vec, abstract_pkg_t *pkg) ++{ ++ int i; ++ ++ /* look for a duplicate pkg by name */ ++ for(i = 0; i < vec->len; i++) ++ if (strcmp(pkg->name, vec->pkgs[i]->name) == 0) ++ break; ++ ++ /* we didn't find one, add it */ ++ if(i == vec->len){ ++ vec->pkgs = ++ (abstract_pkg_t **) ++ realloc(vec->pkgs, (vec->len + 1) * sizeof(abstract_pkg_t *)); ++ vec->pkgs[vec->len] = pkg; ++ vec->len++; ++ } ++} ++ ++abstract_pkg_t * abstract_pkg_vec_get(abstract_pkg_vec_t *vec, int i) ++{ ++ if (vec->len > i) ++ return vec->pkgs[i]; ++ else ++ return NULL; ++} ++ ++int abstract_pkg_vec_contains(abstract_pkg_vec_t *vec, abstract_pkg_t *apkg) ++{ ++ int i; ++ for (i = 0; i < vec->len; i++) ++ if (vec->pkgs[i] == apkg) ++ return 1; ++ return 0; ++} ++ ++void abstract_pkg_vec_sort(pkg_vec_t *vec, int (*compar)(abstract_pkg_t *, abstract_pkg_t *)) ++{ ++ qsort(vec->pkgs, vec->len, sizeof(pkg_t *), (compare_fcn_t)compar); ++} ++ +diff -ruN busybox-1.2.0-orig/archival/libipkg/pkg_vec.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_vec.h +--- busybox-1.2.0-orig/archival/libipkg/pkg_vec.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_vec.h 2006-07-22 16:31:26.000000000 +0200 +@@ -0,0 +1,62 @@ ++/* pkg_vec.h - the itsy package management system ++ ++ Steven M. Ayer ++ ++ Copyright (C) 2002 Compaq Computer Corporation ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#ifndef PKG_VEC_H ++#define PKG_VEC_H ++ ++typedef struct pkg pkg_t; ++typedef struct abstract_pkg abstract_pkg_t; ++ ++struct pkg_vec ++{ ++ pkg_t **pkgs; ++ int len; ++}; ++typedef struct pkg_vec pkg_vec_t; ++ ++struct abstract_pkg_vec ++{ ++ abstract_pkg_t **pkgs; ++ int len; ++}; ++typedef struct abstract_pkg_vec abstract_pkg_vec_t; ++ ++ ++pkg_vec_t * pkg_vec_alloc(void); ++void pkg_vec_free(pkg_vec_t *vec); ++void marry_two_packages(pkg_t * newpkg, pkg_t * oldpkg); ++ ++void pkg_vec_add(pkg_vec_t *vec, pkg_t *pkg); ++/* pkg_vec_insert_merge: might munge pkg. ++* returns the pkg that is in the pkg graph */ ++pkg_t *pkg_vec_insert_merge(pkg_vec_t *vec, pkg_t *pkg, int set_status, ipkg_conf_t *conf); ++/* this one never munges pkg */ ++void pkg_vec_insert(pkg_vec_t *vec, const pkg_t *pkg); ++int pkg_vec_contains(pkg_vec_t *vec, pkg_t *apkg); ++void pkg_vec_sort(pkg_vec_t *vec, int (*compar)(pkg_t *, pkg_t *)); ++ ++int pkg_vec_clear_marks(pkg_vec_t *vec); ++int pkg_vec_mark_if_matches(pkg_vec_t *vec, const char *pattern); ++ ++abstract_pkg_vec_t * abstract_pkg_vec_alloc(void); ++void abstract_pkg_vec_free(abstract_pkg_vec_t *vec); ++void abstract_pkg_vec_insert(abstract_pkg_vec_t *vec, abstract_pkg_t *pkg); ++abstract_pkg_t * abstract_pkg_vec_get(abstract_pkg_vec_t *vec, int i); ++int abstract_pkg_vec_contains(abstract_pkg_vec_t *vec, abstract_pkg_t *apkg); ++void abstract_pkg_vec_sort(pkg_vec_t *vec, int (*compar)(abstract_pkg_t *, abstract_pkg_t *)); ++#endif ++ +diff -ruN busybox-1.2.0-orig/archival/libipkg/sprintf_alloc.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/sprintf_alloc.h +--- busybox-1.2.0-orig/archival/libipkg/sprintf_alloc.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/sprintf_alloc.h 2006-07-22 16:31:26.000000000 +0200 +@@ -0,0 +1,25 @@ ++/* sprintf_alloca.c -- like sprintf with memory allocation ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ 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 ++ the Free Software Foundation; either version 2, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++*/ ++ ++#ifndef SPRINTF_ALLOC_H ++#define SPRINTF_ALLOC_H ++ ++#include "libbb.h" ++ ++#define sprintf_alloc(str, fmt, args...) *str = bb_xasprintf(fmt, ## args) ++ ++#endif +diff -ruN busybox-1.2.0-orig/archival/libipkg/str_list.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/str_list.c +--- busybox-1.2.0-orig/archival/libipkg/str_list.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/str_list.c 2006-07-22 16:31:26.000000000 +0200 +@@ -0,0 +1,76 @@ ++/* str_list.c - the itsy package management system ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#include "ipkg.h" ++ ++#include "str_list.h" ++ ++int str_list_elt_init(str_list_elt_t *elt, char *data) ++{ ++ return void_list_elt_init((void_list_elt_t *) elt, data); ++} ++ ++void str_list_elt_deinit(str_list_elt_t *elt) ++{ ++ void_list_elt_deinit((void_list_elt_t *) elt); ++} ++ ++str_list_t *str_list_alloc() ++{ ++ str_list_t *list = (str_list_t *)malloc(sizeof(str_list_t)); ++ if (list) ++ str_list_init(list); ++ return list; ++} ++ ++int str_list_init(str_list_t *list) ++{ ++ return void_list_init((void_list_t *) list); ++} ++ ++void str_list_deinit(str_list_t *list) ++{ ++ void_list_deinit((void_list_t *) list); ++} ++ ++int str_list_append(str_list_t *list, char *data) ++{ ++ return void_list_append((void_list_t *) list, data); ++} ++ ++int str_list_push(str_list_t *list, char *data) ++{ ++ return void_list_push((void_list_t *) list, data); ++} ++ ++str_list_elt_t *str_list_pop(str_list_t *list) ++{ ++ return (str_list_elt_t *) void_list_pop((void_list_t *) list); ++} ++ ++str_list_elt_t *str_list_remove(str_list_t *list, str_list_elt_t **iter) ++{ ++ return (str_list_elt_t *) void_list_remove((void_list_t *) list, ++ (void_list_elt_t **) iter); ++} ++ ++char *str_list_remove_elt(str_list_t *list, const char *target_str) ++{ ++ return (char *)void_list_remove_elt((void_list_t *) list, ++ (void *)target_str, ++ (void_list_cmp_t)strcmp); ++} +diff -ruN busybox-1.2.0-orig/archival/libipkg/str_list.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/str_list.h +--- busybox-1.2.0-orig/archival/libipkg/str_list.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/str_list.h 2006-07-22 16:31:26.000000000 +0200 +@@ -0,0 +1,51 @@ ++/* str_list.h - the itsy package management system ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#ifndef STR_LIST_H ++#define STR_LIST_H ++ ++#include "void_list.h" ++ ++typedef struct str_list_elt str_list_elt_t; ++struct str_list_elt ++{ ++ str_list_elt_t *next; ++ char *data; ++}; ++ ++typedef struct xstr_list str_list_t; ++struct xstr_list ++{ ++ str_list_elt_t pre_head; ++ str_list_elt_t *head; ++ str_list_elt_t *tail; ++}; ++ ++int str_list_elt_init(str_list_elt_t *elt, char *data); ++void str_list_elt_deinit(str_list_elt_t *elt); ++ ++str_list_t *str_list_alloc(void); ++int str_list_init(str_list_t *list); ++void str_list_deinit(str_list_t *list); ++ ++int str_list_append(str_list_t *list, char *data); ++int str_list_push(str_list_t *list, char *data); ++str_list_elt_t *str_list_pop(str_list_t *list); ++str_list_elt_t *str_list_remove(str_list_t *list, str_list_elt_t **iter); ++char *str_list_remove_elt(str_list_t *list, const char *target_str); ++ ++#endif +diff -ruN busybox-1.2.0-orig/archival/libipkg/str_util.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/str_util.c +--- busybox-1.2.0-orig/archival/libipkg/str_util.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/str_util.c 2006-07-22 16:31:26.000000000 +0200 +@@ -0,0 +1,73 @@ ++/* str_utils.c - the itsy package management system ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#include "ipkg.h" ++ ++int str_starts_with(const char *str, const char *prefix) ++{ ++ return (strncmp(str, prefix, strlen(prefix)) == 0); ++} ++ ++int str_ends_with(const char *str, const char *suffix) ++{ ++ int suffix_len; ++ int str_len; ++ ++ str_len = strlen(str); ++ suffix_len = strlen(suffix); ++ ++ if (str_len < suffix_len) { ++ return 0; ++ } ++ ++ return (strcmp(str + str_len - suffix_len, suffix) == 0); ++} ++ ++int str_chomp(char *str) ++{ ++ if (str[strlen(str) - 1] == '\n') { ++ str[strlen(str) - 1] = '\0'; ++ return 1; ++ } ++ return 0; ++} ++ ++int str_tolower(char *str) ++{ ++ while (*str) { ++ *str = tolower(*str); ++ str++; ++ } ++ ++ return 0; ++} ++ ++int str_toupper(char *str) ++{ ++ while (*str) { ++ *str = toupper(*str); ++ str++; ++ } ++ ++ return 0; ++} ++ ++char *str_dup_safe(const char *str) ++{ ++ return str ? strdup(str) : NULL; ++} ++ +diff -ruN busybox-1.2.0-orig/archival/libipkg/str_util.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/str_util.h +--- busybox-1.2.0-orig/archival/libipkg/str_util.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/str_util.h 2006-07-22 16:31:26.000000000 +0200 +@@ -0,0 +1,28 @@ ++/* str_utils.h - the itsy package management system ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#ifndef STR_UTILS_H ++#define STR_UTILS_H ++ ++int str_starts_with(const char *str, const char *prefix); ++int str_ends_with(const char *str, const char *suffix); ++int str_chomp(char *str); ++int str_tolower(char *str); ++int str_toupper(char *str); ++char *str_dup_safe(const char *str); ++ ++#endif +diff -ruN busybox-1.2.0-orig/archival/libipkg/user.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/user.c +--- busybox-1.2.0-orig/archival/libipkg/user.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/user.c 2006-07-22 16:31:26.000000000 +0200 +@@ -0,0 +1,58 @@ ++/* user.c - the itsy package management system ++ ++ Jamey Hicks ++ ++ Copyright (C) 2002 Hewlett Packard Company ++ Copyright (C) 2001 University of Southern California ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#include <stdio.h> ++#include <stdarg.h> ++#include "file_util.h" ++#include "str_util.h" ++#ifdef IPKG_LIB ++#include "libipkg.h" ++#endif ++ ++ ++#ifdef IPKG_LIB ++static char *question = NULL; ++static int question_len = 255; ++#endif ++char *get_user_response(const char *format, ...) ++{ ++ int len = question_len; ++ va_list ap; ++ char *response; ++ va_start(ap, format); ++ ++#ifndef IPKG_LIB ++ vprintf(format, ap); ++ do { ++ response = file_read_line_alloc(stdin); ++ } while (response == NULL); ++#else ++ do { ++ if (question == NULL || len > question_len) { ++ question = realloc(question, len + 1); ++ question_len = len; ++ } ++ len = vsnprintf(question,question_len,format,ap); ++ } while (len > question_len); ++ response = strdup(ipkg_cb_response(question)); ++#endif ++ str_chomp(response); ++ str_tolower(response); ++ ++ return response; ++} +diff -ruN busybox-1.2.0-orig/archival/libipkg/user.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/user.h +--- busybox-1.2.0-orig/archival/libipkg/user.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/user.h 2006-07-22 16:31:26.000000000 +0200 +@@ -0,0 +1,23 @@ ++/* user.c - the itsy package management system ++ ++ Jamey Hicks ++ ++ Copyright (C) 2002 Hewlett Packard Company ++ Copyright (C) 2001 University of Southern California ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#include <stdio.h> ++#include <stdarg.h> ++ ++char *get_user_response(const char *format, ...); ++ +diff -ruN busybox-1.2.0-orig/archival/libipkg/void_list.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/void_list.c +--- busybox-1.2.0-orig/archival/libipkg/void_list.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/void_list.c 2006-07-22 16:31:26.000000000 +0200 +@@ -0,0 +1,194 @@ ++/* void_list.c - the itsy package management system ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#include "ipkg.h" ++#include <errno.h> ++ ++#include "void_list.h" ++ ++int void_list_elt_init(void_list_elt_t *elt, void *data) ++{ ++ elt->next = NULL; ++ elt->data = data; ++ ++ return 0; ++} ++ ++void void_list_elt_deinit(void_list_elt_t *elt) ++{ ++ void_list_elt_init(elt, NULL); ++} ++ ++int void_list_init(void_list_t *list) ++{ ++ void_list_elt_init(&list->pre_head, NULL); ++ list->head = NULL; ++ list->pre_head.next = list->head; ++ list->tail = NULL; ++ ++ return 0; ++} ++ ++void void_list_deinit(void_list_t *list) ++{ ++ void_list_elt_t *elt; ++ ++ while (list->head) { ++ elt = void_list_pop(list); ++ void_list_elt_deinit(elt); ++ /* malloced in void_list_append */ ++ free(elt); ++ } ++} ++ ++int void_list_append(void_list_t *list, void *data) ++{ ++ void_list_elt_t *elt; ++ ++ /* freed in void_list_deinit */ ++ elt = malloc(sizeof(void_list_elt_t)); ++ if (elt == NULL) { ++ fprintf(stderr, "%s: out of memory\n", __FUNCTION__); ++ return ENOMEM; ++ } ++ ++ void_list_elt_init(elt, data); ++ ++ if (list->tail) { ++ list->tail->next = elt; ++ list->tail = elt; ++ } else { ++ list->head = elt; ++ list->pre_head.next = list->head; ++ list->tail = elt; ++ } ++ ++ return 0; ++} ++ ++int void_list_push(void_list_t *list, void *data) ++{ ++ void_list_elt_t *elt; ++ ++ elt = malloc(sizeof(void_list_elt_t)); ++ if (elt == NULL) { ++ fprintf(stderr, "%s: out of memory\n", __FUNCTION__); ++ return ENOMEM; ++ } ++ ++ void_list_elt_init(elt, data); ++ ++ elt->next = list->head; ++ list->head->next = elt; ++ if (list->tail == NULL) { ++ list->tail = list->head; ++ } ++ ++ return 0; ++} ++ ++void_list_elt_t *void_list_pop(void_list_t *list) ++{ ++ void_list_elt_t *elt; ++ ++ elt = list->head; ++ ++ if (list->head) { ++ list->head = list->head->next; ++ list->pre_head.next = list->head; ++ if (list->head == NULL) { ++ list->tail = NULL; ++ } ++ } ++ ++ return elt; ++} ++ ++void *void_list_remove(void_list_t *list, void_list_elt_t **iter) ++{ ++ void_list_elt_t *prior; ++ void_list_elt_t *old_elt; ++ void *old_data; ++ ++ old_elt = *iter; ++ old_data = old_elt->data; ++ ++ if (old_elt == list->head) { ++ prior = &list->pre_head; ++ void_list_pop(list); ++ } else { ++ for (prior = list->head; prior; prior = prior->next) { ++ if (prior->next == old_elt) { ++ break; ++ } ++ } ++ if (prior == NULL || prior->next != old_elt) { ++ fprintf(stderr, "%s: ERROR: element not found in list\n", __FUNCTION__); ++ return NULL; ++ } ++ prior->next = old_elt->next; ++ ++ if (old_elt == list->tail) { ++ list->tail = prior; ++ } ++ } ++ ++ void_list_elt_deinit(old_elt); ++ *iter = prior; ++ ++ return old_data; ++} ++ ++/* remove element containing elt data, using cmp(elt->data, target_data) == 0. */ ++void *void_list_remove_elt(void_list_t *list, const void *target_data, void_list_cmp_t cmp) ++{ ++ void_list_elt_t *prior; ++ void_list_elt_t *old_elt = NULL; ++ void *old_data = NULL; ++ ++ /* first element */ ++ if (list->head && list->head->data && (cmp(list->head->data, target_data) == 0)) { ++ old_elt = list->head; ++ old_data = list->head->data; ++ void_list_pop(list); ++ } else { ++ int found = 0; ++ for (prior = list->head; prior && prior->next; prior = prior->next) { ++ if (prior->next->data && (cmp(prior->next->data, target_data) == 0)) { ++ old_elt = prior->next; ++ old_data = old_elt->data; ++ found = 1; ++ break; ++ } ++ } ++ if (!found) { ++ return NULL; ++ } ++ prior->next = old_elt->next; ++ ++ if (old_elt == list->tail) { ++ list->tail = prior; ++ } ++ } ++ if (old_elt) ++ void_list_elt_deinit(old_elt); ++ ++ if (old_data) ++ return old_data; ++ else ++ return NULL; ++} +diff -ruN busybox-1.2.0-orig/archival/libipkg/void_list.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/void_list.h +--- busybox-1.2.0-orig/archival/libipkg/void_list.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/void_list.h 2006-07-22 16:31:26.000000000 +0200 +@@ -0,0 +1,59 @@ ++/* void_list.h - the itsy package management system ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#ifndef VOID_LIST_H ++#define VOID_LIST_H ++ ++typedef struct void_list_elt void_list_elt_t; ++struct void_list_elt ++{ ++ void_list_elt_t *next; ++ void *data; ++}; ++ ++typedef struct void_list void_list_t; ++struct void_list ++{ ++ void_list_elt_t pre_head; ++ void_list_elt_t *head; ++ void_list_elt_t *tail; ++}; ++ ++static inline int void_list_empty(void_list_t *list) ++{ ++ if (list->head == NULL) ++ return 1; ++ else ++ return 0; ++} ++ ++int void_list_elt_init(void_list_elt_t *elt, void *data); ++void void_list_elt_deinit(void_list_elt_t *elt); ++ ++int void_list_init(void_list_t *list); ++void void_list_deinit(void_list_t *list); ++ ++int void_list_append(void_list_t *list, void *data); ++int void_list_push(void_list_t *list, void *data); ++void_list_elt_t *void_list_pop(void_list_t *list); ++ ++void *void_list_remove(void_list_t *list, void_list_elt_t **iter); ++/* remove element containing elt data, using cmp(elt->data, target_data) == 0. */ ++typedef int (*void_list_cmp_t)(const void *, const void *); ++void *void_list_remove_elt(void_list_t *list, const void *target_data, void_list_cmp_t cmp); ++ ++#endif +diff -ruN busybox-1.2.0-orig/archival/libipkg/xsystem.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/xsystem.c +--- busybox-1.2.0-orig/archival/libipkg/xsystem.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/xsystem.c 2006-07-22 16:31:26.000000000 +0200 +@@ -0,0 +1,64 @@ ++/* xsystem.c - system(3) with error messages ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#include "ipkg.h" ++#include <sys/wait.h> ++ ++#include "xsystem.h" ++ ++/* XXX: FEATURE: I shouldn't actually use system(3) at all. I don't ++ really need the /bin/sh invocation which takes resources and ++ introduces security problems. I should switch all of this to a sort ++ of execl() or execv() interface/implementation. ++*/ ++ ++/* Like system(3), but with error messages printed if the fork fails ++ or if the child process dies due to an uncaught signal. Also, the ++ return value is a bit simpler: ++ ++ -1 if there was any problem ++ Otherwise, the 8-bit return value of the program ala WEXITSTATUS ++ as defined in <sys/wait.h>. ++*/ ++int xsystem(const char *cmd) ++{ ++ int err; ++ ++ err = system(cmd); ++ ++ if (err == -1) { ++ fprintf(stderr, "%s: ERROR: fork failed before execution: `%s'\n", ++ __FUNCTION__, cmd); ++ return -1; ++ } ++ ++ if (WIFSIGNALED(err)) { ++ fprintf(stderr, "%s: ERROR: Child process died due to signal %d: `%s'\n", ++ __FUNCTION__, WTERMSIG(err), cmd); ++ return -1; ++ } ++ ++ if (WIFEXITED(err)) { ++ /* Normal child exit */ ++ return WEXITSTATUS(err); ++ } ++ ++ fprintf(stderr, "%s: ERROR: Received unintelligible return value from system: %d", ++ __FUNCTION__, err); ++ return -1; ++} ++ +diff -ruN busybox-1.2.0-orig/archival/libipkg/xsystem.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/xsystem.h +--- busybox-1.2.0-orig/archival/libipkg/xsystem.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/xsystem.h 2006-07-22 16:31:26.000000000 +0200 +@@ -0,0 +1,34 @@ ++/* xsystem.h - system(3) with error messages ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ 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 the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#ifndef XSYSTEM_H ++#define XSYSTEM_H ++ ++#include <stdlib.h> ++ ++/* Like system(3), but with error messages printed if the fork fails ++ or if the child process dies due to an uncaught signal. Also, the ++ return value is a bit simpler: ++ ++ -1 if there was any problem ++ Otherwise, the 8-bit return value of the program ala WEXITSTATUS ++ as defined in <sys/wait.h>. ++*/ ++int xsystem(const char *cmd); ++ ++#endif ++ +diff -ruN busybox-1.2.0-orig/archival/libunarchive/data_extract_all.c busybox-1.2.0+ipkg-0.99.162/archival/libunarchive/data_extract_all.c +--- busybox-1.2.0-orig/archival/libunarchive/data_extract_all.c 2006-07-01 00:42:04.000000000 +0200 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libunarchive/data_extract_all.c 2006-07-22 16:31:26.000000000 +0200 +@@ -126,3 +126,17 @@ + utime(file_header->name, &t); + } + } ++ ++extern void data_extract_all_prefix(archive_handle_t *archive_handle) ++{ ++ char *name_ptr = archive_handle->file_header->name; ++ ++ name_ptr += strspn(name_ptr, "./"); ++ if (name_ptr[0] != '\0') { ++ archive_handle->file_header->name = xmalloc(strlen(archive_handle->buffer) + 1 + strlen(name_ptr) + 1); ++ strcpy(archive_handle->file_header->name, archive_handle->buffer); ++ strcat(archive_handle->file_header->name, name_ptr); ++ data_extract_all(archive_handle); ++ } ++} ++ +diff -ruN busybox-1.2.0-orig/archival/libunarchive/Makefile.in busybox-1.2.0+ipkg-0.99.162/archival/libunarchive/Makefile.in +--- busybox-1.2.0-orig/archival/libunarchive/Makefile.in 2006-07-01 00:42:03.000000000 +0200 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libunarchive/Makefile.in 2006-07-22 16:31:26.000000000 +0200 +@@ -58,6 +58,7 @@ + LIBUNARCHIVE-$(CONFIG_FEATURE_DEB_TAR_LZMA) += decompress_unlzma.o get_header_tar_lzma.o + LIBUNARCHIVE-$(CONFIG_GUNZIP) += $(GUNZIP_FILES) + LIBUNARCHIVE-$(CONFIG_FEATURE_GUNZIP_UNCOMPRESS) += decompress_uncompress.o ++LIBUNARCHIVE-$(CONFIG_IPKG) += $(GUNZIP_FILES) get_header_tar.o get_header_tar_gz.o + LIBUNARCHIVE-$(CONFIG_RPM2CPIO) += $(GUNZIP_FILES) get_header_cpio.o + LIBUNARCHIVE-$(CONFIG_RPM) += $(GUNZIP_FILES) get_header_cpio.o + LIBUNARCHIVE-$(CONFIG_TAR) += get_header_tar.o +diff -ruN busybox-1.2.0-orig/archival/Makefile.in busybox-1.2.0+ipkg-0.99.162/archival/Makefile.in +--- busybox-1.2.0-orig/archival/Makefile.in 2006-07-01 00:42:04.000000000 +0200 ++++ busybox-1.2.0+ipkg-0.99.162/archival/Makefile.in 2006-07-22 16:31:25.000000000 +0200 +@@ -20,6 +20,7 @@ + ARCHIVAL-$(CONFIG_DPKG_DEB) += dpkg_deb.o + ARCHIVAL-$(CONFIG_GUNZIP) += gunzip.o + ARCHIVAL-$(CONFIG_GZIP) += gzip.o ++ARCHIVAL-$(CONFIG_IPKG) += ipkg.o + ARCHIVAL-$(CONFIG_RPM2CPIO) += rpm2cpio.o + ARCHIVAL-$(CONFIG_RPM) += rpm.o + ARCHIVAL-$(CONFIG_TAR) += tar.o +diff -ruN busybox-1.2.0-orig/include/applets.h busybox-1.2.0+ipkg-0.99.162/include/applets.h +--- busybox-1.2.0-orig/include/applets.h 2006-07-01 00:42:10.000000000 +0200 ++++ busybox-1.2.0+ipkg-0.99.162/include/applets.h 2006-07-22 16:35:35.000000000 +0200 +@@ -152,6 +152,7 @@ + USE_IPCALC(APPLET(ipcalc, _BB_DIR_BIN, _BB_SUID_NEVER)) + USE_IPCRM(APPLET(ipcrm, _BB_DIR_USR_BIN, _BB_SUID_ALWAYS)) + USE_IPCS(APPLET(ipcs, _BB_DIR_USR_BIN, _BB_SUID_ALWAYS)) ++USE_IPKG(APPLET(ipkg, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) + USE_IPLINK(APPLET(iplink, _BB_DIR_BIN, _BB_SUID_NEVER)) + USE_IPROUTE(APPLET(iproute, _BB_DIR_BIN, _BB_SUID_NEVER)) + USE_IPTUNNEL(APPLET(iptunnel, _BB_DIR_BIN, _BB_SUID_NEVER)) +diff -ruN busybox-1.2.0-orig/include/unarchive.h busybox-1.2.0+ipkg-0.99.162/include/unarchive.h +--- busybox-1.2.0-orig/include/unarchive.h 2006-07-01 00:42:10.000000000 +0200 ++++ busybox-1.2.0+ipkg-0.99.162/include/unarchive.h 2006-07-22 16:31:26.000000000 +0200 +@@ -77,6 +77,7 @@ + + extern void data_skip(archive_handle_t *archive_handle); + extern void data_extract_all(archive_handle_t *archive_handle); ++extern void data_extract_all_prefix(archive_handle_t *archive_handle); + extern void data_extract_to_stdout(archive_handle_t *archive_handle); + extern void data_extract_to_buffer(archive_handle_t *archive_handle); + +diff -ruN busybox-1.2.0-orig/include/usage.h busybox-1.2.0+ipkg-0.99.162/include/usage.h +--- busybox-1.2.0-orig/include/usage.h 2006-07-01 00:42:10.000000000 +0200 ++++ busybox-1.2.0+ipkg-0.99.162/include/usage.h 2006-07-22 16:31:26.000000000 +0200 +@@ -982,6 +982,82 @@ + "$ ls -la /tmp/busybox*\n" \ + "-rw-rw-r-- 1 andersen andersen 554058 Apr 14 17:49 /tmp/busybox.tar.gz\n" + ++#define ipkg_trivial_usage \ ++ "[options]... sub-command [arguments]..." ++#define ipkg_full_usage \ ++ "ipkg is an utility to install, remove and manage .ipk packages.\n" \ ++ "\n" \ ++ "Sub-commands:\n" \ ++ "\nPackage Manipulation:\n" \ ++ "\tupdate Update list of available packages\n" \ ++ "\tupgrade Upgrade all installed packages to latest version\n" \ ++ "\tinstall <pkg> Download and install <pkg> (and dependencies)\n" \ ++ "\tinstall <file.ipk> Install package <file.ipk>\n" \ ++ "\tconfigure [<pkg>] Configure unpacked packages\n" \ ++ "\tremove <pkg|regexp> Remove package <pkg|packages following regexp>\n" \ ++ "\tflag <flag> <pkg> ... Flag package(s) <pkg>\n" \ ++ "\t <flag>=hold|noprune|user|ok|installed|unpacked (one per invocation) \n" \ ++ "\n" \ ++ "Informational Commands:\n" \ ++ "\tlist List available packages and descriptions\n" \ ++ "\tlist_installed List all and only the installed packages and description \n" \ ++ "\tfiles <pkg> List all files belonging to <pkg>\n" \ ++ "\tsearch <file|regexp> Search for a package providing <file>\n" \ ++ "\tinfo [pkg|regexp [<field>]] Display all/some info fields for <pkg> or all\n" \ ++ "\tstatus [pkg|regexp [<field>]] Display all/some status fields for <pkg> or all\n" \ ++ "\tdownload <pkg> Download <pkg> to current directory.\n" \ ++ "\tcompare_versions <v1> <op> <v2>\n" \ ++ "\t compare versions using <= < > >= = << >>\n" \ ++ "\tprint_architecture prints the architecture.\n" \ ++ "\tprint_installation_architecture\n" \ ++ "\twhatdepends [-A] [pkgname|pat]+\n" \ ++ "\twhatdependsrec [-A] [pkgname|pat]+\n" \ ++ "\twhatprovides [-A] [pkgname|pat]+\n" \ ++ "\twhatconflicts [-A] [pkgname|pat]+\n" \ ++ "\twhatreplaces [-A] [pkgname|pat]+\n" \ ++ "\t prints the installation architecture.\n" \ ++ "\n" \ ++ "\nOptions:\n" \ ++ "\t-A Query all packages with whatdepends, whatprovides, whatreplaces, whatconflicts\n" \ ++ "\t-V <level> Set verbosity level to <level>. If no value is\n" \ ++ "\t--verbosity <level> provided increase verbosity by one. Verbosity levels:\n" \ ++ "\t 0 errors only\n" \ ++ "\t 1 normal messages (default)\n" \ ++ "\t 2 informative messages\n" \ ++ "\t 3 debug output\n" \ ++ "\t-f <conf_file> Use <conf_file> as the ipkg configuration file\n" \ ++ "\t-conf <conf_file> Default configuration file location\n" \ ++ " is /etc/ipkg.conf\n" \ ++ "\t-d <dest_name> Use <dest_name> as the the root directory for\n" \ ++ "\t-dest <dest_name> package installation, removal, upgrading.\n" \ ++ " <dest_name> should be a defined dest name from\n" \ ++ " the configuration file, (but can also be a\n" \ ++ " directory name in a pinch).\n" \ ++ "\t-o <offline_root> Use <offline_root> as the root directory for\n" \ ++ "\t-offline <offline_root> offline installation of packages.\n" \ ++ "\t-verbose_wget more wget messages\n" \ ++ "\n" \ ++ "Force Options (use when ipkg is too smart for its own good):\n" \ ++ "\t-force-depends Make dependency checks warnings instead of errors\n" \ ++ "\t Install/remove package in spite of failed dependences\n" \ ++ "\t-force-defaults Use default options for questions asked by ipkg.\n" \ ++ " (no prompts). Note that this will not prevent\n" \ ++ " package installation scripts from prompting.\n" \ ++ "\t-force-reinstall Allow ipkg to reinstall a package.\n" \ ++ "\t-force-overwrite Allow ipkg to overwrite files from another package during an install.\n" \ ++ "\t-force-downgrade Allow ipkg to downgrade packages.\n" \ ++ "\t-force_space Install even if there does not seem to be enough space.\n" \ ++ "\t-noaction No action -- test only\n" \ ++ "\t-nodeps Do not follow dependences\n" \ ++ "\t-force-removal-of-dependent-packages\n" \ ++ "\t-recursive Allow ipkg to remove package and all that depend on it.\n" \ ++ "\t-test No action -- test only\n" \ ++ "\t-t Specify tmp-dir.\n" \ ++ "\t--tmp-dir Specify tmp-dir.\n" \ ++ "\n" \ ++ "\tregexp could be something like 'pkgname*' '*file*' or similar\n" \ ++ "\teg: ipkg info 'libstd*' or ipkg search '*libop*' or ipkg remove 'libncur*'\n" ++ + #define halt_trivial_usage \ + "[-d<delay>] [-n<nosync>] [-f<force>]" + #define halt_full_usage \ +diff -ruN busybox-1.2.0-orig/Makefile busybox-1.2.0+ipkg-0.99.162/Makefile +--- busybox-1.2.0-orig/Makefile 2006-07-01 00:42:13.000000000 +0200 ++++ busybox-1.2.0+ipkg-0.99.162/Makefile 2006-07-22 16:31:25.000000000 +0200 +@@ -31,7 +31,7 @@ + export srctree=$(top_srcdir) + vpath %/Config.in $(srctree) + +-DIRS:=applets archival archival/libunarchive coreutils console-tools \ ++DIRS:=applets archival archival/libipkg archival/libunarchive coreutils console-tools \ + debianutils editors findutils init miscutils modutils networking \ + networking/libiproute networking/udhcp procps loginutils shell \ + sysklogd util-linux e2fsprogs libpwdgrp coreutils/libcoreutils libbb diff --git a/package/busybox/patches/912-ipkg-no_warnings.patch b/package/busybox/patches/912-ipkg-no_warnings.patch new file mode 100644 index 0000000000..b5ba7705fb --- /dev/null +++ b/package/busybox/patches/912-ipkg-no_warnings.patch @@ -0,0 +1,448 @@ +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# remove (numerous) compile warnings +# +diff -ruN busybox-1.1.2+ipkg-0.99.162/archival/libipkg/file_util.c busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/file_util.c +--- busybox-1.1.2+ipkg-0.99.162/archival/libipkg/file_util.c 2006-05-09 02:06:48.000000000 +0200 ++++ busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/file_util.c 2006-05-09 02:16:48.000000000 +0200 +@@ -123,7 +123,7 @@ + + int file_mkdir_hier(const char *path, long mode) + { +- return bb_make_directory(path, mode, FILEUTILS_RECUR); ++ return bb_make_directory((char *)path, mode, FILEUTILS_RECUR); + } + + char *file_md5sum_alloc(const char *file_name) +diff -ruN busybox-1.1.2+ipkg-0.99.162/archival/libipkg/ipkg_cmd.c busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/ipkg_cmd.c +--- busybox-1.1.2+ipkg-0.99.162/archival/libipkg/ipkg_cmd.c 2006-05-09 02:23:37.000000000 +0200 ++++ busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/ipkg_cmd.c 2006-05-09 02:23:17.000000000 +0200 +@@ -246,7 +246,7 @@ + in = fopen (tmp_file_name, "r"); + out = fopen (list_file_name, "w"); + if (in && out) +- inflate_unzip (in, out); ++ inflate_unzip (fileno(in), fileno(out)); + else + err = 1; + if (in) +@@ -894,14 +894,13 @@ + pkg_vec_free(available); + } else { + pkg_vec_t *installed_pkgs = pkg_vec_alloc(); +- int i; + int flagged_pkg_count = 0; + int removed; + + pkg_hash_fetch_all_installed(&conf->pkg_hash, installed_pkgs); + + for (i = 0; i < installed_pkgs->len; i++) { +- pkg_t *pkg = installed_pkgs->pkgs[i]; ++ pkg = installed_pkgs->pkgs[i]; + if (pkg->state_flag & SF_USER) { + flagged_pkg_count++; + } else { +@@ -921,7 +920,7 @@ + do { + removed = 0; + for (i = 0; i < installed_pkgs->len; i++) { +- pkg_t *pkg = installed_pkgs->pkgs[i]; ++ pkg = installed_pkgs->pkgs[i]; + if (!(pkg->state_flag & SF_USER) + && !pkg_has_installed_dependents(conf, pkg->parent, pkg, NULL)) { + removed++; +@@ -976,7 +975,7 @@ + { + int i; + pkg_t *pkg; +- const char *flags = argv[0]; ++ char *flags = argv[0]; + + global_conf = conf; + signal(SIGINT, sigint_handler); +diff -ruN busybox-1.1.2+ipkg-0.99.162/archival/libipkg/ipkg_conf.c busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/ipkg_conf.c +--- busybox-1.1.2+ipkg-0.99.162/archival/libipkg/ipkg_conf.c 2006-05-09 02:12:04.000000000 +0200 ++++ busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/ipkg_conf.c 2006-05-09 02:16:48.000000000 +0200 +@@ -542,14 +542,14 @@ + if (strcmp(type, "option") == 0) { + ipkg_conf_set_option(options, name, value); + } else if (strcmp(type, "src") == 0) { +- if (!nv_pair_list_find(pkg_src_list, name)) { ++ if (!nv_pair_list_find((nv_pair_list_t *)pkg_src_list, name)) { + pkg_src_list_append (pkg_src_list, name, value, extra, 0); + } else { + ipkg_message(conf, IPKG_ERROR, "ERROR: duplicate src declaration. Skipping:\n\t src %s %s\n", + name, value); + } + } else if (strcmp(type, "src/gz") == 0) { +- if (!nv_pair_list_find(pkg_src_list, name)) { ++ if (!nv_pair_list_find((nv_pair_list_t *)pkg_src_list, name)) { + pkg_src_list_append (pkg_src_list, name, value, extra, 1); + } else { + ipkg_message(conf, IPKG_ERROR, "ERROR: duplicate src declaration. Skipping:\n\t src %s %s\n", +diff -ruN busybox-1.1.2+ipkg-0.99.162/archival/libipkg/ipkg_download.c busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/ipkg_download.c +--- busybox-1.1.2+ipkg-0.99.162/archival/libipkg/ipkg_download.c 2006-05-09 02:12:04.000000000 +0200 ++++ busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/ipkg_download.c 2006-05-09 02:22:51.000000000 +0200 +@@ -166,7 +166,7 @@ + if (err) + return err; + pkg->local_filename = strdup(url); +- ipkg_message(conf, IPKG_DEBUG2, "Package %s provided by hand \(%s\).\n", pkg->name,pkg->local_filename); ++ ipkg_message(conf, IPKG_DEBUG2, "Package %s provided by hand (%s).\n", pkg->name,pkg->local_filename); + pkg->provided_by_hand = 1; + + } else { +diff -ruN busybox-1.1.2+ipkg-0.99.162/archival/libipkg/libipkg.c busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/libipkg.c +--- busybox-1.1.2+ipkg-0.99.162/archival/libipkg/libipkg.c 2006-05-09 02:12:05.000000000 +0200 ++++ busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/libipkg.c 2006-05-09 02:16:48.000000000 +0200 +@@ -445,7 +445,7 @@ + int + ipkg_op (int argc, char *argv[]) + { +- int err, optind; ++ int err, opt_index; + args_t args; + char *cmd_name; + ipkg_cmd_t *cmd; +@@ -453,13 +453,13 @@ + + args_init (&args); + +- optind = args_parse (&args, argc, argv); +- if (optind == argc || optind < 0) ++ opt_index = args_parse (&args, argc, argv); ++ if (opt_index == argc || opt_index < 0) + { + args_usage ("ipkg must have one sub-command argument"); + } + +- cmd_name = argv[optind++]; ++ cmd_name = argv[opt_index++]; + /* Pigi: added a flag to disable the checking of structures if the command does not need to + read anything from there. + */ +@@ -509,7 +509,7 @@ + args_usage (NULL); + } + +- if (cmd->requires_args && optind == argc) ++ if (cmd->requires_args && opt_index == argc) + { + fprintf (stderr, + "%s: the ``%s'' command requires at least one argument\n", +@@ -517,7 +517,7 @@ + args_usage (NULL); + } + +- err = ipkg_cmd_exec (cmd, &ipkg_conf, argc - optind, (const char **) (argv + optind), NULL); ++ err = ipkg_cmd_exec (cmd, &ipkg_conf, argc - opt_index, (const char **) (argv + opt_index), NULL); + + ipkg_conf_deinit (&ipkg_conf); + +diff -ruN busybox-1.1.2+ipkg-0.99.162/archival/libipkg/md5.c busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/md5.c +--- busybox-1.1.2+ipkg-0.99.162/archival/libipkg/md5.c 2006-05-09 02:06:48.000000000 +0200 ++++ busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/md5.c 2006-05-09 02:16:48.000000000 +0200 +@@ -25,7 +25,6 @@ + int md5_stream(FILE *stream, void *resblock) + { + int fd; +- int sum; + + if( (fd = fileno(stream)) == -1 ) { + bb_error_msg("bad file descriptor"); +diff -ruN busybox-1.1.2+ipkg-0.99.162/archival/libipkg/pkg.c busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/pkg.c +--- busybox-1.1.2+ipkg-0.99.162/archival/libipkg/pkg.c 2006-05-09 02:12:05.000000000 +0200 ++++ busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/pkg.c 2006-05-09 02:16:48.000000000 +0200 +@@ -528,6 +528,7 @@ + char * pkg_formatted_field(pkg_t *pkg, const char *field ) + { + static size_t LINE_LEN = 128; ++ char line_str[LINE_LEN]; + char * temp = (char *)malloc(1); + int len = 0; + int flag_provide_false = 0; +@@ -567,7 +568,6 @@ + if (strcasecmp(field, "Conffiles") == 0) { + /* Conffiles */ + conffile_list_elt_t *iter; +- char confstr[LINE_LEN]; + + if (pkg->conffiles.head == NULL) { + return temp; +@@ -588,15 +588,14 @@ + strncpy(temp, "Conffiles:\n", 12); + for (iter = pkg->conffiles.head; iter; iter = iter->next) { + if (iter->data->name && iter->data->value) { +- snprintf(confstr, LINE_LEN, "%s %s\n", iter->data->name, iter->data->value); +- strncat(temp, confstr, strlen(confstr)); ++ snprintf(line_str, LINE_LEN, "%s %s\n", iter->data->name, iter->data->value); ++ strncat(temp, line_str, strlen(line_str)); + } + } + } else if (strcasecmp(field, "Conflicts") == 0) { + int i; + + if (pkg->conflicts_count) { +- char conflictstr[LINE_LEN]; + len = 14 ; + for(i = 0; i < pkg->conflicts_count; i++) { + len = len + (strlen(pkg->conflicts_str[i])+5); +@@ -609,8 +608,8 @@ + temp[0]='\0'; + strncpy(temp, "Conflicts:", 11); + for(i = 0; i < pkg->conflicts_count; i++) { +- snprintf(conflictstr, LINE_LEN, "%s %s", i == 0 ? "" : ",", pkg->conflicts_str[i]); +- strncat(temp, conflictstr, strlen(conflictstr)); ++ snprintf(line_str, LINE_LEN, "%s %s", i == 0 ? "" : ",", pkg->conflicts_str[i]); ++ strncat(temp, line_str, strlen(line_str)); + } + strncat(temp, "\n", strlen("\n")); + } +@@ -625,7 +624,6 @@ + int i; + + if (pkg->depends_count) { +- char depstr[LINE_LEN]; + len = 14 ; + for(i = 0; i < pkg->depends_count; i++) { + len = len + (strlen(pkg->depends_str[i])+4); +@@ -638,8 +636,8 @@ + temp[0]='\0'; + strncpy(temp, "Depends:", 10); + for(i = 0; i < pkg->depends_count; i++) { +- snprintf(depstr, LINE_LEN, "%s %s", i == 0 ? "" : ",", pkg->depends_str[i]); +- strncat(temp, depstr, strlen(depstr)); ++ snprintf(line_str, LINE_LEN, "%s %s", i == 0 ? "" : ",", pkg->depends_str[i]); ++ strncat(temp, line_str, strlen(line_str)); + } + strncat(temp, "\n", strlen("\n")); + } +@@ -804,7 +802,6 @@ + /* Replaces | Recommends*/ + if (strcasecmp (field, "Replaces") == 0) { + if (pkg->replaces_count) { +- char replstr[LINE_LEN]; + len = 14; + for (i = 0; i < pkg->replaces_count; i++) { + len = len + (strlen(pkg->replaces_str[i])+5); +@@ -817,14 +814,13 @@ + temp[0]='\0'; + strncpy(temp, "Replaces:", 12); + for (i = 0; i < pkg->replaces_count; i++) { +- snprintf(replstr, LINE_LEN, "%s %s", i == 0 ? "" : ",", pkg->replaces_str[i]); +- strncat(temp, replstr, strlen(replstr)); ++ snprintf(line_str, LINE_LEN, "%s %s", i == 0 ? "" : ",", pkg->replaces_str[i]); ++ strncat(temp, line_str, strlen(line_str)); + } + strncat(temp, "\n", strlen("\n")); + } + } else if (strcasecmp (field, "Recommends") == 0) { + if (pkg->recommends_count) { +- char recstr[LINE_LEN]; + len = 15; + for(i = 0; i < pkg->recommends_count; i++) { + len = len + (strlen( pkg->recommends_str[i])+5); +@@ -837,8 +833,8 @@ + temp[0]='\0'; + strncpy(temp, "Recommends:", 13); + for(i = 0; i < pkg->recommends_count; i++) { +- snprintf(recstr, LINE_LEN, "%s %s", i == 0 ? "" : ",", pkg->recommends_str[i]); +- strncat(temp, recstr, strlen(recstr)); ++ snprintf(line_str, LINE_LEN, "%s %s", i == 0 ? "" : ",", pkg->recommends_str[i]); ++ strncat(temp, line_str, strlen(line_str)); + } + strncat(temp, "\n", strlen("\n")); + } +@@ -907,7 +903,6 @@ + } else if (strcasecmp(field, "Suggests") == 0) { + if (pkg->suggests_count) { + int i; +- char sugstr[LINE_LEN]; + len = 13; + for(i = 0; i < pkg->suggests_count; i++) { + len = len + (strlen(pkg->suggests_str[i])+5); +@@ -920,8 +915,8 @@ + temp[0]='\0'; + strncpy(temp, "Suggests:", 10); + for(i = 0; i < pkg->suggests_count; i++) { +- snprintf(sugstr, LINE_LEN, "%s %s", i == 0 ? "" : ",", pkg->suggests_str[i]); +- strncat(temp, sugstr, strlen(sugstr)); ++ snprintf(line_str, LINE_LEN, "%s %s", i == 0 ? "" : ",", pkg->suggests_str[i]); ++ strncat(temp, line_str, strlen(line_str)); + } + strncat(temp, "\n", strlen("\n")); + } +@@ -1140,10 +1135,8 @@ + return 0; + } + +-int pkg_name_version_and_architecture_compare(void *p1, void *p2) ++int pkg_name_version_and_architecture_compare(pkg_t *a, pkg_t *b) + { +- const pkg_t *a = *(const pkg_t **)p1; +- const pkg_t *b = *(const pkg_t **)p2; + int namecmp; + int vercmp; + if (!a->name || !b->name) { +@@ -1170,10 +1163,8 @@ + return 0; + } + +-int abstract_pkg_name_compare(void *p1, void *p2) ++int abstract_pkg_name_compare(abstract_pkg_t *a, abstract_pkg_t *b) + { +- const abstract_pkg_t *a = *(const abstract_pkg_t **)p1; +- const abstract_pkg_t *b = *(const abstract_pkg_t **)p2; + if (!a->name || !b->name) { + fprintf(stderr, "abstract_pkg_name_compare: a=%p a->name=%p b=%p b->name=%p\n", + a, a->name, b, b->name); +@@ -1193,7 +1184,7 @@ + #endif + + if (pkg->epoch) { +- sprintf_alloc(&epoch_str, "%d:", pkg->epoch); ++ sprintf_alloc(&epoch_str, "%d:", (int)(pkg->epoch)); + } else { + epoch_str = strdup(""); + } +diff -ruN busybox-1.1.2+ipkg-0.99.162/archival/libipkg/pkg.h busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/pkg.h +--- busybox-1.1.2+ipkg-0.99.162/archival/libipkg/pkg.h 2006-05-09 02:12:05.000000000 +0200 ++++ busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/pkg.h 2006-05-09 02:16:48.000000000 +0200 +@@ -194,8 +194,8 @@ + char *pkg_version_str_alloc(pkg_t *pkg); + + int pkg_compare_versions(const pkg_t *pkg, const pkg_t *ref_pkg); +-int pkg_name_version_and_architecture_compare(void *a, void *b); +-int abstract_pkg_name_compare(void *a, void *b); ++int pkg_name_version_and_architecture_compare(pkg_t *a, pkg_t *b); ++int abstract_pkg_name_compare(abstract_pkg_t *a, abstract_pkg_t *b); + + char * pkg_formatted_info(pkg_t *pkg ); + char * pkg_formatted_field(pkg_t *pkg, const char *field ); +diff -ruN busybox-1.1.2+ipkg-0.99.162/archival/libipkg/pkg_depends.c busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/pkg_depends.c +--- busybox-1.1.2+ipkg-0.99.162/archival/libipkg/pkg_depends.c 2006-05-09 02:12:05.000000000 +0200 ++++ busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/pkg_depends.c 2006-05-09 02:16:48.000000000 +0200 +@@ -68,7 +68,7 @@ + pkg_vec_t *unsatisfied, char *** unresolved) + { + pkg_t * satisfier_entry_pkg; +- register int i, j, k; ++ register int i, j, k, l; + int count, found; + char ** the_lost; + abstract_pkg_t * ab_pkg; +@@ -113,7 +113,6 @@ + abstract_pkg_vec_t *ab_provider_vec = abpkg->provided_by; + int nposs = ab_provider_vec->len; + abstract_pkg_t **ab_providers = ab_provider_vec->pkgs; +- int l; + for (l = 0; l < nposs; l++) { + pkg_vec_t *test_vec = ab_providers[l]->pkgs; + /* if no depends on this one, try the first package that Provides this one */ +@@ -137,10 +136,9 @@ + tmp_vec, + &newstuff); + if (newstuff == NULL) { +- int i; + int ok = 1; +- for (i = 0; i < rc; i++) { +- pkg_t *p = tmp_vec->pkgs[i]; ++ for (l = 0; l < rc; l++) { ++ pkg_t *p = tmp_vec->pkgs[l]; + if (p->state_want == SW_INSTALL) + continue; + ipkg_message(conf, IPKG_DEBUG, "not installing %s due to requirement for %s\n", pkg_scout->name, p->name); +@@ -814,27 +812,27 @@ + * [npredepends+nrecommends,npredepends+nrecommends+nsuggests) -> returns recommends_str[index] + * [npredepends+nrecommends+nsuggests,npredepends+nrecommends+nsuggests+ndepends) -> returns depends_str[index] + */ +-char *pkg_depend_str(pkg_t *pkg, int index) ++char *pkg_depend_str(pkg_t *pkg, int pkg_index) + { +- if (index < pkg->pre_depends_count) { +- return pkg->pre_depends_str[index]; ++ if (pkg_index < pkg->pre_depends_count) { ++ return pkg->pre_depends_str[pkg_index]; + } +- index -= pkg->pre_depends_count; ++ pkg_index -= pkg->pre_depends_count; + +- if (index < pkg->recommends_count) { +- return pkg->recommends_str[index]; ++ if (pkg_index < pkg->recommends_count) { ++ return pkg->recommends_str[pkg_index]; + } +- index -= pkg->recommends_count; ++ pkg_index -= pkg->recommends_count; + +- if (index < pkg->suggests_count) { +- return pkg->suggests_str[index]; ++ if (pkg_index < pkg->suggests_count) { ++ return pkg->suggests_str[pkg_index]; + } +- index -= pkg->suggests_count; ++ pkg_index -= pkg->suggests_count; + +- if (index < pkg->depends_count) { +- return pkg->depends_str[index]; ++ if (pkg_index < pkg->depends_count) { ++ return pkg->depends_str[pkg_index]; + } +- fprintf(stderr, "pkg_depend_str: index %d out of range for pkg=%s\n", index, pkg->name); ++ fprintf(stderr, "pkg_depend_str: index %d out of range for pkg=%s\n", pkg_index, pkg->name); + return NULL; + } + +diff -ruN busybox-1.1.2+ipkg-0.99.162/archival/libipkg/pkg_depends.h busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/pkg_depends.h +--- busybox-1.1.2+ipkg-0.99.162/archival/libipkg/pkg_depends.h 2006-05-09 02:06:48.000000000 +0200 ++++ busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/pkg_depends.h 2006-05-09 02:16:48.000000000 +0200 +@@ -92,7 +92,7 @@ + */ + int pkg_conflicts(pkg_t *pkg, pkg_t *conflicts); + +-char *pkg_depend_str(pkg_t *pkg, int index); ++char *pkg_depend_str(pkg_t *pkg, int pkg_index); + void buildDependedUponBy(pkg_t * pkg, abstract_pkg_t * ab_pkg); + void freeDepends(pkg_t *pkg); + void printDepends(pkg_t * pkg); +diff -ruN busybox-1.1.2+ipkg-0.99.162/archival/libipkg/pkg_hash.c busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/pkg_hash.c +--- busybox-1.1.2+ipkg-0.99.162/archival/libipkg/pkg_hash.c 2006-05-09 02:12:05.000000000 +0200 ++++ busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/pkg_hash.c 2006-05-09 02:17:35.000000000 +0200 +@@ -143,7 +143,7 @@ + pkg_t *pkg_hash_fetch_best_installation_candidate(ipkg_conf_t *conf, abstract_pkg_t *apkg, + int (*constraint_fcn)(pkg_t *pkg, void *cdata), void *cdata, int quiet) + { +- int i; ++ int i, j; + int nprovides = 0; + int nmatching = 0; + pkg_vec_t *matching_pkgs = pkg_vec_alloc(); +@@ -209,11 +209,10 @@ + /* now check for supported architecture */ + { + int max_count = 0; +- int i; + + /* count packages matching max arch priority and keep track of last one */ +- for (i = 0; i < vec->len; i++) { +- pkg_t *maybe = vec->pkgs[i]; ++ for (j = 0; j < vec->len; j++) { ++ pkg_t *maybe = vec->pkgs[j]; + ipkg_message(conf, IPKG_DEBUG, " %s arch=%s arch_priority=%d version=%s \n", + maybe->name, maybe->architecture, maybe->arch_priority, maybe->version); + if (maybe->arch_priority > 0) { +diff -ruN busybox-1.1.2+ipkg-0.99.162/archival/libipkg/pkg_vec.h busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/pkg_vec.h +--- busybox-1.1.2+ipkg-0.99.162/archival/libipkg/pkg_vec.h 2006-05-09 02:06:48.000000000 +0200 ++++ busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/pkg_vec.h 2006-05-09 02:16:48.000000000 +0200 +@@ -35,6 +35,8 @@ + }; + typedef struct abstract_pkg_vec abstract_pkg_vec_t; + ++typedef int (*pkg_compar_t)(pkg_t *, pkg_t *); ++typedef int (*abstract_pkg_compar_t)(abstract_pkg_t *, abstract_pkg_t *); + + pkg_vec_t * pkg_vec_alloc(void); + void pkg_vec_free(pkg_vec_t *vec); diff --git a/package/busybox/patches/913-libbb_hash.patch b/package/busybox/patches/913-libbb_hash.patch new file mode 100644 index 0000000000..a7c2291caa --- /dev/null +++ b/package/busybox/patches/913-libbb_hash.patch @@ -0,0 +1,228 @@ +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# expose (again) an hash_fd function (used in 911-ipkg.patch) +# +diff -ruN busybox-1.2.0-orig/coreutils/md5_sha1_sum.c busybox-1.2.0-libbb_hash/coreutils/md5_sha1_sum.c +--- busybox-1.2.0-orig/coreutils/md5_sha1_sum.c 2006-07-01 00:42:07.000000000 +0200 ++++ busybox-1.2.0-libbb_hash/coreutils/md5_sha1_sum.c 2006-07-22 17:08:02.000000000 +0200 +@@ -16,79 +16,10 @@ + + #include "busybox.h" + +-typedef enum { HASH_SHA1, HASH_MD5 } hash_algo_t; +- + #define FLAG_SILENT 1 + #define FLAG_CHECK 2 + #define FLAG_WARN 4 + +-/* This might be useful elsewhere */ +-static unsigned char *hash_bin_to_hex(unsigned char *hash_value, +- unsigned char hash_length) +-{ +- int x, len, max; +- unsigned char *hex_value; +- +- max = (hash_length * 2) + 2; +- hex_value = xmalloc(max); +- for (x = len = 0; x < hash_length; x++) { +- len += snprintf((char*)(hex_value + len), max - len, "%02x", hash_value[x]); +- } +- return (hex_value); +-} +- +-static uint8_t *hash_file(const char *filename, hash_algo_t hash_algo) +-{ +- int src_fd, hash_len, count; +- union _ctx_ { +- sha1_ctx_t sha1; +- md5_ctx_t md5; +- } context; +- uint8_t *hash_value = NULL; +- RESERVE_CONFIG_UBUFFER(in_buf, 4096); +- void (*update)(const void*, size_t, void*); +- void (*final)(void*, void*); +- +- if (strcmp(filename, "-") == 0) { +- src_fd = STDIN_FILENO; +- } else if(0 > (src_fd = open(filename, O_RDONLY))) { +- bb_perror_msg("%s", filename); +- return NULL; +- } +- +- /* figure specific hash algorithims */ +- if (ENABLE_MD5SUM && hash_algo==HASH_MD5) { +- md5_begin(&context.md5); +- update = (void (*)(const void*, size_t, void*))md5_hash; +- final = (void (*)(void*, void*))md5_end; +- hash_len = 16; +- } else if (ENABLE_SHA1SUM && hash_algo==HASH_SHA1) { +- sha1_begin(&context.sha1); +- update = (void (*)(const void*, size_t, void*))sha1_hash; +- final = (void (*)(void*, void*))sha1_end; +- hash_len = 20; +- } else { +- bb_error_msg_and_die("algorithm not supported"); +- } +- +- while (0 < (count = read(src_fd, in_buf, 4096))) { +- update(in_buf, count, &context); +- } +- +- if (count == 0) { +- final(in_buf, &context); +- hash_value = hash_bin_to_hex(in_buf, hash_len); +- } +- +- RELEASE_CONFIG_BUFFER(in_buf); +- +- if (src_fd != STDIN_FILENO) { +- close(src_fd); +- } +- +- return hash_value; +-} +- + /* This could become a common function for md5 as well, by using md5_stream */ + static int hash_files(int argc, char **argv, hash_algo_t hash_algo) + { +diff -ruN busybox-1.2.0-orig/include/libbb.h busybox-1.2.0-libbb_hash/include/libbb.h +--- busybox-1.2.0-orig/include/libbb.h 2006-07-01 00:42:10.000000000 +0200 ++++ busybox-1.2.0-libbb_hash/include/libbb.h 2006-07-22 17:01:06.000000000 +0200 +@@ -518,6 +518,8 @@ + extern int get_terminal_width_height(int fd, int *width, int *height); + extern unsigned long get_ug_id(const char *s, long (*__bb_getxxnam)(const char *)); + ++typedef enum { HASH_SHA1, HASH_MD5 } hash_algo_t; ++ + typedef struct _sha1_ctx_t_ { + uint32_t count[2]; + uint32_t hash[5]; +@@ -542,6 +544,10 @@ + void md5_hash(const void *data, size_t length, md5_ctx_t *ctx); + void *md5_end(void *resbuf, md5_ctx_t *ctx); + ++unsigned char *hash_bin_to_hex(unsigned char *hash_value, unsigned char hash_length); ++int hash_fd(int fd, hash_algo_t hash_algo, uint8_t *hash_value); ++uint8_t *hash_file(const char *filename, hash_algo_t hash_algo); ++ + extern uint32_t *bb_crc32_filltable (int endian); + + #ifndef RB_POWER_OFF +diff -ruN busybox-1.2.0-orig/libbb/hash.c busybox-1.2.0-libbb_hash/libbb/hash.c +--- busybox-1.2.0-orig/libbb/hash.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0-libbb_hash/libbb/hash.c 2006-07-22 17:07:34.000000000 +0200 +@@ -0,0 +1,100 @@ ++/* ++ * Copyright (C) 2003 Glenn L. McGrath ++ * Copyright (C) 2003-2004 Erik Andersen ++ * ++ * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. ++ */ ++ ++#include <fcntl.h> ++#include <limits.h> ++#include <stdio.h> ++#include <stdint.h> ++#include <stdlib.h> ++#include <string.h> ++#include <unistd.h> ++ ++#include "busybox.h" ++ ++unsigned char *hash_bin_to_hex(unsigned char *hash_value, unsigned char hash_length) ++{ ++ int x, len, max; ++ unsigned char *hex_value; ++ ++ max = (hash_length * 2) + 2; ++ hex_value = xmalloc(max); ++ for (x = len = 0; x < hash_length; x++) { ++ len += snprintf((char*)(hex_value + len), max - len, "%02x", hash_value[x]); ++ } ++ return (hex_value); ++} ++ ++int hash_fd(int fd, hash_algo_t hash_algo, uint8_t *hash_value) ++{ ++ int count, result = 0; ++ union _ctx_ { ++ sha1_ctx_t sha1; ++ md5_ctx_t md5; ++ } context; ++ RESERVE_CONFIG_UBUFFER(in_buf, 4096); ++ void (*update)(const void*, size_t, void*) = NULL; ++ void (*final)(void*, void*) = NULL; ++ ++ // figure specific hash algorithims ++ if (hash_algo==HASH_MD5) { ++ md5_begin(&context.md5); ++ update = (void (*)(const void*, size_t, void*))md5_hash; ++ final = (void (*)(void*, void*))md5_end; ++ } else if (hash_algo==HASH_SHA1) { ++ sha1_begin(&context.sha1); ++ update = (void (*)(const void*, size_t, void*))sha1_hash; ++ final = (void (*)(void*, void*))sha1_end; ++ } ++ ++ ++ while (0 < (count = read(fd, in_buf, sizeof in_buf))) { ++ update(in_buf, count, &context); ++ result += count; ++ } ++ ++ if (count == 0) { ++ final(hash_value, &context); ++ } ++ ++ RELEASE_CONFIG_BUFFER(in_buf); ++ ++ return result; ++} ++ ++uint8_t *hash_file(const char *filename, hash_algo_t hash_algo) ++{ ++ int src_fd, hash_len; ++ RESERVE_CONFIG_UBUFFER(hash_buf, 20); ++ uint8_t *hash_value = NULL; ++ ++ if (ENABLE_MD5SUM && hash_algo==HASH_MD5) { ++ hash_len = 16; ++ } else if (ENABLE_SHA1SUM && hash_algo==HASH_SHA1) { ++ hash_len = 20; ++ } else { ++ bb_error_msg_and_die("algotithm not supported"); ++ } ++ ++ if (strcmp(filename, "-") == 0) { ++ src_fd = STDIN_FILENO; ++ } else if (0 > (src_fd = open(filename, O_RDONLY))) { ++ bb_perror_msg("%s", filename); ++ return NULL; ++ } ++ ++ if (hash_fd(src_fd, hash_algo, hash_buf) > 0) { ++ hash_value = hash_bin_to_hex(hash_buf, hash_len); ++ } ++ ++ if (src_fd != STDIN_FILENO) { ++ close(src_fd); ++ } ++ ++ RELEASE_CONFIG_BUFFER(hash_buf); ++ ++ return hash_value; ++} +diff -ruN busybox-1.2.0-orig/libbb/Makefile.in busybox-1.2.0-libbb_hash/libbb/Makefile.in +--- busybox-1.2.0-orig/libbb/Makefile.in 2006-07-01 00:42:08.000000000 +0200 ++++ busybox-1.2.0-libbb_hash/libbb/Makefile.in 2006-07-22 16:51:47.000000000 +0200 +@@ -11,6 +11,7 @@ + + LIBBB-n:= + LIBBB-y:= \ ++ hash.c \ + bb_asprintf.c ask_confirmation.c change_identity.c chomp.c \ + compare_string_array.c concat_path_file.c copy_file.c copyfd.c \ + crc32.c create_icmp_socket.c create_icmp6_socket.c \ diff --git a/package/busybox/patches/914-ipkg-fixes.patch b/package/busybox/patches/914-ipkg-fixes.patch new file mode 100644 index 0000000000..72375bc5b7 --- /dev/null +++ b/package/busybox/patches/914-ipkg-fixes.patch @@ -0,0 +1,19 @@ +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# fix ipkg bugs +# +diff -ruN busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/pkg.c busybox-1.1.2+ipkg-0.99.162-fixes/archival/libipkg/pkg.c +--- busybox-1.1.2+ipkg-0.99.162-no_warnings/archival/libipkg/pkg.c 2006-05-09 02:16:48.000000000 +0200 ++++ busybox-1.1.2+ipkg-0.99.162-fixes/archival/libipkg/pkg.c 2006-05-09 05:15:29.000000000 +0200 +@@ -359,6 +359,8 @@ + if (!oldpkg->essential) + oldpkg->essential = newpkg->essential; + ++ oldpkg->provided_by_hand |= newpkg->provided_by_hand; ++ + return 0; + } + diff --git a/package/diag/Makefile b/package/diag/Makefile new file mode 100644 index 0000000000..c182321cc1 --- /dev/null +++ b/package/diag/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=kmod-diag +PKG_RELEASE:=1 + +PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/kmod-diag + SECTION:=kernel + CATEGORY:=Kernel drivers + DEFAULT:=y + DEPENDS:=@LINUX_2_4_BRCM + TITLE:=Driver for router LEDs and Buttons + VERSION:=$(LINUX_VERSION)-$(BOARD)-$(PKG_RELEASE) +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) + $(CP) ./src/* $(PKG_BUILD_DIR)/ +endef + +define Build/Compile + $(MAKE) -C "$(LINUX_DIR)" \ + CROSS_COMPILE="$(TARGET_CROSS)" \ + ARCH="$(LINUX_KARCH)" \ + SUBDIRS="$(PKG_BUILD_DIR)" \ + EXTRA_CFLAGS="-DBCMDRIVER -I$(LINUX_DIR)/arch/mips/bcm947xx/include" \ + modules +endef + +define Package/kmod-diag/install + install -d -m0755 $(1)/lib/modules/$(LINUX_VERSION) + $(CP) $(PKG_BUILD_DIR)/diag.$(LINUX_KMOD_SUFFIX) \ + $(1)/lib/modules/$(LINUX_VERSION)/ +endef + +$(eval $(call BuildPackage,kmod-diag)) diff --git a/package/diag/src/Makefile b/package/diag/src/Makefile new file mode 100644 index 0000000000..169f2e9725 --- /dev/null +++ b/package/diag/src/Makefile @@ -0,0 +1,19 @@ +# $Id$ +# +# Makefile for diag driver +# +# Copyright (C) 2005 Felix Fietkau <nbd@openwrt.org> +# +# 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 the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# + +obj-m := diag.o + +ifeq ($(MAKING_MODULES),1) +export-objs := diag.o + +-include $(TOPDIR)/Rules.make +endif diff --git a/package/diag/src/diag.c b/package/diag/src/diag.c new file mode 100644 index 0000000000..d25f749df5 --- /dev/null +++ b/package/diag/src/diag.c @@ -0,0 +1,284 @@ +/* + * diag_led.c - replacement diag module + * + * Copyright (C) 2004 Mike Baker, + * Imre Kaloz <kaloz@dune.hu> + * + * 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 the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + */ + +/* + * ChangeLog: + * 2004/03/28 initial release + * 2004/08/26 asus & buffalo support added + * 2005/03/14 asus wl-500g deluxe and buffalo v2 support added + * 2005/04/13 added licensing informations + * 2005/04/18 base reset polarity off initial readings + * 2006/02/07 motorola wa840g/we800g support added + * 2006/08/18 asus power led support added + */ + +#include <linux/module.h> +#include <linux/init.h> +#include <linux/kernel.h> +#include <linux/sysctl.h> +#include <asm/io.h> +#include <typedefs.h> +#include <osl.h> +#include <bcmdevs.h> +#include <sbutils.h> + +extern char * nvram_get(const char *name); +static void *sbh; + +// v2.x - - - - - +#define DIAG_GPIO (1<<1) +#define DMZ_GPIO (1<<7) + +static void set_gpio(uint32 mask, uint32 value) { + sb_gpiocontrol(sbh,mask, 0, GPIO_DRV_PRIORITY); + sb_gpioouten(sbh,mask,mask,GPIO_DRV_PRIORITY); + sb_gpioout(sbh,mask,value,GPIO_DRV_PRIORITY); +} + +static void v2_set_diag(u8 state) { + set_gpio(DIAG_GPIO,state); +} +static void v2_set_dmz(u8 state) { + set_gpio(DMZ_GPIO,state); +} + +// asus wl-500g (+deluxe) +#define ASUS_PWR_GPIO (1<<0) + +static void asus_set_pwr(u8 state) { + set_gpio(ASUS_PWR_GPIO,state); +} + +// v1.x - - - - - +#define LED_DIAG 0x13 +#define LED_DMZ 0x12 + +static void v1_set_diag(u8 state) { + if (!state) { + *(volatile u8*)(KSEG1ADDR(BCM4710_EUART)+LED_DIAG)=0xFF; + } else { + *(volatile u8*)(KSEG1ADDR(BCM4710_EUART)+LED_DIAG); + } +} +static void v1_set_dmz(u8 state) { + if (!state) { + *(volatile u8*)(KSEG1ADDR(BCM4710_EUART)+LED_DMZ)=0xFF; + } else { + *(volatile u8*)(KSEG1ADDR(BCM4710_EUART)+LED_DMZ); + } +} + +static void wap1_set_diag(u8 state) { + set_gpio(1<<3,state); +} +static void wap1_set_dmz(u8 state) { + set_gpio(1<<4,state); +} + +// - - - - - +static void ignore(u8 ignored) {}; + +// - - - - - +#define BIT_DMZ 0x01 +#define BIT_PWR 0x02 +#define BIT_DIAG 0x04 + +void (*set_diag)(u8 state); +void (*set_dmz)(u8 state); +void (*set_pwr)(u8 state); + +static unsigned int diag = 0x02; // default: diag off, pwr on, dmz off + +static void diag_change(void) +{ + set_diag(0xFF); // off + set_dmz(0xFF); // off + set_pwr(0xFF); // off + + if(diag & BIT_DIAG) + set_diag(0x00); // on + if(diag & BIT_DMZ) + set_dmz(0x00); // on + if (diag & BIT_PWR) + set_pwr(0x00); //on +} + +static int proc_diag(ctl_table *table, int write, struct file *filp, + void *buffer, size_t *lenp) +{ + int r; + r = proc_dointvec(table, write, filp, buffer, lenp); + if (write && !r) { + diag_change(); + } + return r; +} + +// - - - - - +static unsigned char reset_gpio = 0; +static unsigned char reset_polarity = 0; +static unsigned int reset = 0; + +static int proc_reset(ctl_table *table, int write, struct file *filp, + void *buffer, size_t *lenp) +{ + + if (reset_gpio) { + sb_gpiocontrol(sbh,reset_gpio,reset_gpio,GPIO_DRV_PRIORITY); + sb_gpioouten(sbh,reset_gpio,0,GPIO_DRV_PRIORITY); + reset=!(sb_gpioin(sbh)&reset_gpio); + + if (reset_polarity) reset=!reset; + } else { + reset=0; + } + + return proc_dointvec(table, write, filp, buffer, lenp); +} + +// - - - - - +static struct ctl_table_header *diag_sysctl_header; + +static ctl_table sys_diag[] = { + { + ctl_name: 2000, + procname: "diag", + data: &diag, + maxlen: sizeof(diag), + mode: 0644, + proc_handler: proc_diag + }, + { + ctl_name: 2001, + procname: "reset", + data: &reset, + maxlen: sizeof(reset), + mode: 0444, + proc_handler: proc_reset + }, + { 0 } +}; + +static int __init diag_init(void) +{ + char *buf; + u32 board_type; + sbh = (void *)sb_kattach(); + sb_gpiosetcore(sbh); + + board_type = sb_boardtype(sbh); + printk(KERN_INFO "diag boardtype: %08x\n",board_type); + + set_diag=ignore; + set_dmz=ignore; + set_pwr=ignore; + + buf=nvram_get("pmon_ver") ?: ""; + if (((board_type & 0xf00) == 0x400) && (strncmp(buf, "CFE", 3) != 0)) { + buf=nvram_get("boardtype")?:""; + if (!strncmp(buf,"bcm94710dev",11)) { + buf=nvram_get("boardnum")?:""; + if (!strcmp(buf,"42")) { + // wrt54g v1.x + set_diag=v1_set_diag; + set_dmz=v1_set_dmz; + reset_gpio=(1<<6); + } + if (simple_strtoul(buf, NULL, 0) == 2) { + // wap54g v1.0 + // do not use strcmp as PMON v5.3.22 has some built-in nvram + // defaults with trailing \r + set_diag=wap1_set_diag; + // no dmz led on wap54g, used green led + // labeled "WLAN Link" instead + set_dmz=wap1_set_dmz; + reset_gpio=(1<<0); + } + if (!strcmp(buf,"asusX")) { + //asus wl-500g + set_pwr=asus_set_pwr; + reset_gpio=(1<<6); + } + if (!strcmp(buf,"2")) { + //wa840g v1 / we800g v1 + reset_gpio=(1<<0); + } + } + if (!strcmp(buf,"bcm94710ap")) { + buf=nvram_get("boardnum")?:""; + if (!strcmp(buf,"42")) { + // buffalo + set_dmz=v2_set_dmz; + reset_gpio=(1<<4); + } + if (!strcmp(buf,"44")) { + //dell truemobile + set_dmz=v2_set_dmz; + reset_gpio=(1<<0); + } + } + } else { + buf=nvram_get("boardnum")?:""; + if (!strcmp(buf,"42")) { + //linksys + set_diag=v2_set_diag; + set_dmz=v2_set_dmz; + reset_gpio=(1<<6); + } + if (!strcmp(buf,"44")) { + //motorola + reset_gpio=(1<<5); + } + if (!strcmp(buf,"00")) { + //buffalo + reset_gpio=(1<<7); + } + if (!strcmp(buf,"45")) { + //wl-500g deluxe + set_pwr=asus_set_pwr; + reset_gpio=(1<<6); + } + } + + + sb_gpiocontrol(sbh,reset_gpio,reset_gpio,GPIO_DRV_PRIORITY); + sb_gpioouten(sbh,reset_gpio,0,GPIO_DRV_PRIORITY); + reset_polarity=!(sb_gpioin(sbh)&reset_gpio); + + diag_sysctl_header = register_sysctl_table(sys_diag, 0); + diag_change(); + + return 0; +} + +static void __exit diag_exit(void) +{ + unregister_sysctl_table(diag_sysctl_header); +} + +EXPORT_NO_SYMBOLS; +MODULE_AUTHOR("openwrt.org"); +MODULE_LICENSE("GPL"); + +module_init(diag_init); +module_exit(diag_exit); diff --git a/package/dnsmasq/Makefile b/package/dnsmasq/Makefile new file mode 100644 index 0000000000..6283fdc898 --- /dev/null +++ b/package/dnsmasq/Makefile @@ -0,0 +1,55 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=dnsmasq +PKG_VERSION:=2.33 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq +PKG_MD5SUM:=45696461b6e6bc929273b1191ca50447 +PKG_CAT:=zcat + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/dnsmasq + SECTION:=net + CATEGORY:=Base system + DEFAULT:=y + TITLE:=A lightweight DNS and DHCP server + DESCRIPTION:=\ + It is intended to provide coupled DNS and DHCP service to a LAN. + URL:=http://www.thekelleys.org.uk/dnsmasq/ +endef + +define Package/dnsmasq/conffiles +/etc/dnsmasq.conf +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS) -DHAVE_ISC_READER=1" \ + BINDIR="/usr/sbin" MANDIR="/usr/man" \ + all +endef + +define Package/dnsmasq/install + install -m0755 -d $(1)/usr/sbin + install -m0755 $(PKG_BUILD_DIR)/src/dnsmasq $(1)/usr/sbin/ + install -m0755 -d $(1)/etc + install -m0644 ./files/dnsmasq.conf $(1)/etc/dnsmasq.conf + install -m0755 -d $(1)/etc/init.d + install -m0755 ./files/dnsmasq.init $(1)/etc/init.d/S50dnsmasq +endef + +$(eval $(call BuildPackage,dnsmasq)) diff --git a/package/dnsmasq/files/dnsmasq.conf b/package/dnsmasq/files/dnsmasq.conf new file mode 100644 index 0000000000..8a51f8445d --- /dev/null +++ b/package/dnsmasq/files/dnsmasq.conf @@ -0,0 +1,28 @@ +# filter what we send upstream +domain-needed +bogus-priv +filterwin2k +localise-queries + +# allow /etc/hosts and dhcp lookups via *.lan +local=/lan/ +domain=lan +expand-hosts +resolv-file=/tmp/resolv.conf + +@ifdef dhcp_enable +dhcp-range=@@start@@,@@end@@,@@netmask@@,@@lease@@ +dhcp-authoritative +dhcp-leasefile=/tmp/dhcp.leases +@endif +@ifdef wan_ifname +except-interface=@@wan_ifname@@ +@endif + +# use /etc/ethers for static hosts; same format as --dhcp-host +# <hwaddr> <ipaddr> +read-ethers + +# other useful options: +# default route(s): dhcp-option=3,192.168.1.1,192.168.1.2 +# dns server(s): dhcp-option=6,192.168.1.1,192.168.1.2 diff --git a/package/dnsmasq/files/dnsmasq.init b/package/dnsmasq/files/dnsmasq.init new file mode 100644 index 0000000000..8ac0ab638d --- /dev/null +++ b/package/dnsmasq/files/dnsmasq.init @@ -0,0 +1,57 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org + +start() { + include /lib/network + scan_interfaces + + # The following is to automatically configure the DHCP settings + # based on config settings. Feel free to replace all this crap + # with a simple "dnsmasq" and manage everything via the + # /etc/dnsmasq.conf config file + + [ -f /etc/dnsmasq.conf ] || exit + + args="" + iface=lan + config_get ifname "$iface" ifname + config_get proto "$iface" proto + + [ "$proto" = static ] && dhcp_enable="${dhcp_enable:-1}" + dhcp_start="${dhcp_start:-100}" + dhcp_num="${dhcp_num:-50}" + dhcp_lease="${dhcp_lease:-12h}" + + # if dhcp_enable is unset and there is a dhcp server on the network already, default to dhcp_enable=0 + [ -z "$dhcp_enable" ] && udhcpc -n -q -R -s /bin/true -i $ifname >&- && dhcp_enable="${dhcp_enable:-0}" + + # dhcp_enable=0 disables the dhcp server + ( + [ -z "$dhcp_enable" -o "$dhcp_enable" -eq 1 ] && { + # no existing DHCP server? + + # calculate settings + config_get ipaddr "$iface" ipaddr + config_get netmask "$iface" netmask + eval $(ipcalc $ipaddr $netmask ${dhcp_start:-100} ${dhcp_num:-150}) + + # and pass the args via config parser defines + echo "${dhcp_enable:+@define dhcp_enable 1}" + echo "@define netmask $NETMASK" + echo "@define start $START" + echo "@define end $END" + echo "@define lease ${dhcp_lease:-12h}" + } + + # ignore requests from wan interface + config_get wan_proto wan proto + config_get wan_ifname wan ifname + [ -z "$wan_proto" -o "$wan_proto" = "none" ] || echo "@define wan_ifname $wan_ifname" + + cat /etc/dnsmasq.conf + ) | awk -f /usr/lib/parse-config.awk | dnsmasq -C /proc/self/fd/0 +} + +stop() { + killall dnsmasq +} diff --git a/package/dnsmasq/patches/101-ipv6.patch b/package/dnsmasq/patches/101-ipv6.patch new file mode 100644 index 0000000000..5cbf781744 --- /dev/null +++ b/package/dnsmasq/patches/101-ipv6.patch @@ -0,0 +1,13 @@ +--- dnsmasq-2.15.orig/src/config.h 2004-09-20 15:47:57.000000000 +0200 ++++ dnsmasq-2.15/src/config.h 2004-09-20 23:21:10.000000000 +0200 +@@ -78,8 +78,9 @@ + /* We assume that systems which don't have IPv6 + headers don't have ntop and pton either */ + +-#if defined(INET6_ADDRSTRLEN) && defined(IPV6_V6ONLY) && !defined(NO_IPV6) ++#if defined(INET6_ADDRSTRLEN) && !defined(NO_IPV6) + # define HAVE_IPV6 ++# define IPV6_V6ONLY 26 + # define ADDRSTRLEN INET6_ADDRSTRLEN + # if defined(SOL_IPV6) + # define IPV6_LEVEL SOL_IPV6 diff --git a/package/dropbear/Makefile b/package/dropbear/Makefile new file mode 100644 index 0000000000..b28b44ef9e --- /dev/null +++ b/package/dropbear/Makefile @@ -0,0 +1,120 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=dropbear +PKG_VERSION:=0.48.1 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://matt.ucc.asn.au/dropbear/releases/ +PKG_MD5SUM:=ca8e53a766faec831882831364568421 +PKG_CAT:=zcat + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/dropbear/Default + URL:=http://matt.ucc.asn.au/dropbear/ +endef + +define Package/dropbear + $(call Package/dropbear/Default) + SECTION:=net + CATEGORY:=Base system + DEFAULT:=y + TITLE:=Small SSH2 client/server + DESCRIPTION:=\ + A small SSH2 server/client designed for small memory environments. +endef + +define Package/dropbearconvert + $(call Package/dropbear/Default) + SECTION:=utils + CATEGORY:=Utilities + TITLE:=Utility for converting SSH keys +endef + +define Build/Configure + $(SED) 's,^/\* #define PKG_MULTI.*,#define PKG_MULTI,g' $(PKG_BUILD_DIR)/options.h + $(SED) 's,^#define DO_HOST_LOOKUP,/* & */,g' $(PKG_BUILD_DIR)/options.h + (cd $(PKG_BUILD_DIR); rm -rf config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS)" \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --program-prefix="" \ + --program-suffix="" \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --datadir=/usr/share \ + --includedir=/usr/include \ + --infodir=/usr/share/info \ + --libdir=/usr/lib \ + --libexecdir=/usr/lib \ + --localstatedir=/var \ + --mandir=/usr/share/man \ + --sbindir=/usr/sbin \ + --sysconfdir=/etc \ + $(DISABLE_LARGEFILE) \ + $(DISABLE_NLS) \ + --with-shared \ + --disable-pam \ + --enable-openpty \ + --enable-syslog \ + --disable-shadow \ + --disable-lastlog \ + --disable-utmp \ + --disable-utmpx \ + --disable-wtmp \ + --disable-wtmpx \ + --disable-loginfunc \ + --disable-pututline \ + --disable-pututxline \ + --disable-zlib \ + ); +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + $(TARGET_CONFIGURE_OPTS) \ + LD="$(TARGET_CC)" \ + PROGRAMS="dropbear dbclient dropbearkey scp" \ + MULTI=1 SCPPROGRESS=1 + $(MAKE) -C $(PKG_BUILD_DIR) \ + $(TARGET_CONFIGURE_OPTS) \ + LD="$(TARGET_CC)" \ + PROGRAMS="dropbearconvert" +endef + +define Package/dropbear/install + install -d -m0755 $(1)/usr/sbin + install -m0755 $(PKG_BUILD_DIR)/dropbearmulti \ + $(1)/usr/sbin/dropbear + install -d -m0755 $(1)/usr/bin + ln -sf ../sbin/dropbear $(1)/usr/bin/scp + ln -sf ../sbin/dropbear $(1)/usr/bin/ssh + ln -sf ../sbin/dropbear $(1)/usr/bin/dbclient + ln -sf ../sbin/dropbear $(1)/usr/bin/dropbearkey + install -d -m0755 $(1)/etc/init.d + install -m0755 ./files/dropbear.init $(1)/etc/init.d/S50dropbear +endef + +define Package/dropbearconvert/install + install -d -m0755 $(1)/usr/bin + install -m0755 $(PKG_BUILD_DIR)/dropbearconvert \ + $(1)/usr/bin/dropbearconvert +endef + +$(eval $(call BuildPackage,dropbear)) +$(eval $(call BuildPackage,dropbearconvert)) diff --git a/package/dropbear/files/dropbear.init b/package/dropbear/files/dropbear.init new file mode 100755 index 0000000000..a5822e4f2b --- /dev/null +++ b/package/dropbear/files/dropbear.init @@ -0,0 +1,23 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org + +start() { + for type in rsa dss; do { + # check for keys + key=/etc/dropbear/dropbear_${type}_host_key + [ ! -f $key ] && { + # generate missing keys + mkdir -p /etc/dropbear + [ -x /usr/bin/dropbearkey ] && { + /usr/bin/dropbearkey -t $type -f $key 2>&- >&- && exec $0 $* + } & + exit 0 + } + }; done + + /usr/sbin/dropbear +} + +stop() { + killall dropbear +} diff --git a/package/dropbear/patches/100-pubkey_path.patch b/package/dropbear/patches/100-pubkey_path.patch new file mode 100644 index 0000000000..cbe525bcc3 --- /dev/null +++ b/package/dropbear/patches/100-pubkey_path.patch @@ -0,0 +1,45 @@ +--- dropbear.old/svr-authpubkey.c.orig 2006-06-03 14:54:43.000000000 +0000 ++++ dropbear.dev/svr-authpubkey.c 2006-06-03 15:03:19.000000000 +0000 +@@ -176,6 +176,8 @@ + goto out; + } + ++ if (ses.authstate.pw->pw_uid != 0) { ++ + /* we don't need to check pw and pw_dir for validity, since + * its been done in checkpubkeyperms. */ + len = strlen(ses.authstate.pw->pw_dir); +@@ -187,6 +189,9 @@ + + /* open the file */ + authfile = fopen(filename, "r"); ++ } else { ++ authfile = fopen("/etc/dropbear/authorized_keys","r"); ++ } + if (authfile == NULL) { + goto out; + } +@@ -274,6 +279,8 @@ + goto out; + } + ++ if (ses.authstate.pw->pw_uid != 0) { ++ + /* allocate max required pathname storage, + * = path + "/.ssh/authorized_keys" + '\0' = pathlen + 22 */ + filename = m_malloc(len + 22); +@@ -295,6 +302,14 @@ + if (checkfileperm(filename) != DROPBEAR_SUCCESS) { + goto out; + } ++ } else { ++ if (checkfileperm("/etc/dropbear") != DROPBEAR_SUCCESS) { ++ goto out; ++ } ++ if (checkfileperm("/etc/dropbear/authorized_keys") != DROPBEAR_SUCCESS) { ++ goto out; ++ } ++ } + + /* file looks ok, return success */ + ret = DROPBEAR_SUCCESS; diff --git a/package/dropbear/patches/110-change_user.patch b/package/dropbear/patches/110-change_user.patch new file mode 100644 index 0000000000..ac617e2806 --- /dev/null +++ b/package/dropbear/patches/110-change_user.patch @@ -0,0 +1,19 @@ +diff -urN dropbear.old/svr-chansession.c dropbear.dev/svr-chansession.c +--- dropbear.old/svr-chansession.c 2005-12-09 06:42:33.000000000 +0100 ++++ dropbear.dev/svr-chansession.c 2005-12-12 01:42:38.982034750 +0100 +@@ -860,12 +860,12 @@ + /* We can only change uid/gid as root ... */ + if (getuid() == 0) { + +- if ((setgid(ses.authstate.pw->pw_gid) < 0) || ++ if ((ses.authstate.pw->pw_gid != 0) && ((setgid(ses.authstate.pw->pw_gid) < 0) || + (initgroups(ses.authstate.pw->pw_name, +- ses.authstate.pw->pw_gid) < 0)) { ++ ses.authstate.pw->pw_gid) < 0))) { + dropbear_exit("error changing user group"); + } +- if (setuid(ses.authstate.pw->pw_uid) < 0) { ++ if ((ses.authstate.pw->pw_uid != 0) && (setuid(ses.authstate.pw->pw_uid) < 0)) { + dropbear_exit("error changing user"); + } + } else { diff --git a/package/dropbear/patches/120-hostkey_prompt.patch b/package/dropbear/patches/120-hostkey_prompt.patch new file mode 100644 index 0000000000..59639e7b97 --- /dev/null +++ b/package/dropbear/patches/120-hostkey_prompt.patch @@ -0,0 +1,12 @@ +diff -urN dropbear-0.45.old/cli-kex.c dropbear-0.45/cli-kex.c +--- dropbear-0.45.old/cli-kex.c 2005-03-07 05:27:01.000000000 +0100 ++++ dropbear-0.45/cli-kex.c 2005-03-25 11:13:57.000000000 +0100 +@@ -119,7 +119,7 @@ + char response = 'z'; + + fp = sign_key_fingerprint(keyblob, keybloblen); +- fprintf(stderr, "\nHost '%s' is not in the trusted hosts file.\n(fingerprint %s)\nDo you want to continue connecting? (y/n)\n", ++ fprintf(stderr, "\nHost '%s' is not in the trusted hosts file.\n(fingerprint %s)\nDo you want to continue connecting? (y/n) ", + cli_opts.remotehost, + fp); + diff --git a/package/dropbear/patches/130-ssh_ignore_o_and_x_args.patch b/package/dropbear/patches/130-ssh_ignore_o_and_x_args.patch new file mode 100644 index 0000000000..9b79e4864e --- /dev/null +++ b/package/dropbear/patches/130-ssh_ignore_o_and_x_args.patch @@ -0,0 +1,22 @@ +diff -ruN dropbear-0.48-old/cli-runopts.c dropbear-0.48-new/cli-runopts.c +--- dropbear-0.48-old/cli-runopts.c 2006-03-09 16:06:03.000000000 +0100 ++++ dropbear-0.48-new/cli-runopts.c 2006-03-11 12:28:54.000000000 +0100 +@@ -188,6 +188,10 @@ + debug_trace = 1; + break; + #endif ++ case 'o': ++ next = &dummy; ++ case 'x': ++ break; + case 'F': + case 'e': + case 'c': +@@ -199,7 +203,6 @@ + #ifndef ENABLE_CLI_LOCALTCPFWD + case 'L': + #endif +- case 'o': + case 'b': + next = &dummy; + default: diff --git a/package/dropbear/patches/140-use_dev_urandom.patch b/package/dropbear/patches/140-use_dev_urandom.patch new file mode 100644 index 0000000000..e1424f59a3 --- /dev/null +++ b/package/dropbear/patches/140-use_dev_urandom.patch @@ -0,0 +1,12 @@ +diff -urN dropbear-0.45.old/options.h dropbear-0.45/options.h +--- dropbear-0.45.old/options.h 2005-03-14 17:12:22.000000000 +0100 ++++ dropbear-0.45/options.h 2005-03-14 17:13:49.000000000 +0100 +@@ -143,7 +143,7 @@ + * however significantly reduce the security of your ssh connections + * if the PRNG state becomes guessable - make sure you know what you are + * doing if you change this. */ +-#define DROPBEAR_RANDOM_DEV "/dev/random" ++#define DROPBEAR_RANDOM_DEV "/dev/urandom" + + /* prngd must be manually set up to produce output */ + /*#define DROPBEAR_PRNGD_SOCKET "/var/run/dropbear-rng"*/ diff --git a/package/dropbear/patches/150-dbconvert_standalone.patch b/package/dropbear/patches/150-dbconvert_standalone.patch new file mode 100644 index 0000000000..50c035ae8c --- /dev/null +++ b/package/dropbear/patches/150-dbconvert_standalone.patch @@ -0,0 +1,14 @@ +--- dropbear-0.47.old/options.h 2006-01-31 13:36:25.301562500 +0100 ++++ dropbear-0.47.dev/options.h 2006-01-31 13:37:41.846346250 +0100 +@@ -5,6 +5,11 @@ + #ifndef _OPTIONS_H_ + #define _OPTIONS_H_ + ++#if !defined(DROPBEAR_CLIENT) && !defined(DROPBEAR_SERVER) ++#define DROPBEAR_SERVER ++#define DROPBEAR_CLIENT ++#endif ++ + /****************************************************************** + * Define compile-time options below - the "#ifndef DROPBEAR_XXX .... #endif" + * parts are to allow for commandline -DDROPBEAR_XXX options etc. diff --git a/package/ebtables/Makefile b/package/ebtables/Makefile new file mode 100644 index 0000000000..a0e53a48d3 --- /dev/null +++ b/package/ebtables/Makefile @@ -0,0 +1,43 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=ebtables +PKG_VERSION:=2.0.8-rc2 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-v$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/ebtables +PKG_MD5SUM:=f07111fcc1966be669278433c35dcc28 +PKG_CAT:=zcat + +PKG_BUILD_DIR:=$(BUILD_DIR)/ebtables-v$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/ebtables + SECTION:=net + CATEGORY:=Network + TITLE:=Ethernet bridge firewall administration utility + URL:=http://ebtables.sourceforge.net/ +endef + +define Package/ebtables/install + install -d -m0755 $(1)/etc + install -m0644 $(PKG_BUILD_DIR)/ethertypes $(1)/etc/ + install -d -m0755 $(1)/usr/lib/ebtables + install -m0755 $(PKG_BUILD_DIR)/lib*.so $(1)/usr/lib/ + install -m0755 $(PKG_BUILD_DIR)/extensions/*.so $(1)/usr/lib/ebtables/ + install -d -m0755 $(1)/usr/sbin + install -m0755 $(PKG_BUILD_DIR)/ebtables $(1)/usr/sbin/ + install -m0755 $(PKG_BUILD_DIR)/ebtables-save $(1)/usr/sbin/ + install -m0755 $(PKG_BUILD_DIR)/ebtables-restore $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,ebtables)) diff --git a/package/fuse/Makefile b/package/fuse/Makefile new file mode 100644 index 0000000000..8c6b2ce564 --- /dev/null +++ b/package/fuse/Makefile @@ -0,0 +1,153 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=fuse +PKG_VERSION:=2.5.3 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/$(PKG_NAME) +PKG_MD5SUM:=9c7e8b6606b9f158ae20b8521ba2867c +PKG_CAT:=zcat + +PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install + +include $(INCLUDE_DIR)/package.mk + +define Package/fuse/Default + TITLE:=FUSE + DESCRIPTION:=\ + FUSE (Filesystem in UserSpacE) + URL:=http://fuse.sourceforge.net/ +endef + +define Package/fuse-utils + $(call Package/fuse/Default) + SECTION:=utils + CATEGORY:=Utilities + TITLE+= (utilities) + DESCRIPTION+=\\\ + \\\ + This package contains the FUSE utilities. +endef + +define Package/kmod-fuse + $(call Package/fuse/Default) + SECTION:=kernel + CATEGORY:=Kernel drivers + TITLE+= (kernel module) + DESCRIPTION+=\\\ + \\\ + This package contains the FUSE kernel module. + VERSION:=$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE) +endef + +define Package/libfuse + $(call Package/fuse/Default) + SECTION:=libs + CATEGORY:=Libraries + TITLE+= (library) + DESCRIPTION+=\\\ + \\\ + This package contains the FUSE shared library, needed by other programs. +endef + +define Build/Configure + (cd $(PKG_BUILD_DIR); rm -f config.cache; \ + touch configure.in ; \ + touch aclocal.m4 ; \ + touch Makefile.in ; \ + touch include/config.h.in ; \ + touch configure ; \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS)" \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --program-prefix="" \ + --program-suffix="" \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --datadir=/usr/share \ + --includedir=/usr/include \ + --infodir=/usr/share/info \ + --libdir=/usr/lib \ + --libexecdir=/usr/lib \ + --localstatedir=/var \ + --mandir=/usr/share/man \ + --sbindir=/usr/sbin \ + --sysconfdir=/etc \ + $(DISABLE_LARGEFILE) \ + $(DISABLE_NLS) \ + --enable-shared \ + --enable-static \ + --disable-rpath \ + --enable-kernel-module \ + --enable-lib \ + --enable-util \ + --disable-example \ + --disable-auto-modprobe \ + --with-kernel="$(LINUX_DIR)" \ + --disable-mtab \ + ); +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + ARCH="$(LINUX_KARCH)" \ + CROSS_COMPILE="$(TARGET_CROSS)" \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + all install +endef + +define Build/InstallDev + mkdir -p $(STAGING_DIR)/usr/include + $(CP) $(PKG_INSTALL_DIR)/usr/include/fuse{,.h} $(STAGING_DIR)/usr/include/ + mkdir -p $(STAGING_DIR)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libfuse.{a,so*} $(STAGING_DIR)/usr/lib/ + mkdir -p $(STAGING_DIR)/usr/lib/pkgconfig + $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/fuse.pc $(STAGING_DIR)/usr/lib/pkgconfig/ + $(SED) 's,-I$$$${includedir}/fuse,,g' $(STAGING_DIR)/usr/lib/pkgconfig/fuse.pc + $(SED) 's,-L$$$${libdir},,g' $(STAGING_DIR)/usr/lib/pkgconfig/fuse.pc +endef + +define Build/UninstallDev + rm -rf $(STAGING_DIR)/usr/include/fuse{,.h} \ + $(STAGING_DIR)/usr/lib/libfuse.{a,so*} \ + $(STAGING_DIR)/usr/lib/pkgconfig/fuse.pc +endef + +define Package/fuse-utils/install + install -d -m0755 $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/fusermount $(1)/usr/bin/ +endef + +define Package/kmod-fuse/install + install -d -m0755 $(1)/lib/modules/$(LINUX_VERSION) + $(CP) $(PKG_INSTALL_DIR)/lib/modules/$(LINUX_VERSION)/kernel/fs/fuse/fuse.$(LINUX_KMOD_SUFFIX) \ + $(1)/lib/modules/$(LINUX_VERSION)/ + install -d -m0755 $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libfuse.so.* $(1)/usr/lib/ + install -d -m0755 $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/fusermount $(1)/usr/bin/ +endef + +define Package/libfuse/install + install -d -m0755 $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libfuse.so.* $(1)/usr/lib/ +endef + +$(eval $(call BuildPackage,fuse-utils)) +$(eval $(call BuildPackage,kmod-fuse)) +$(eval $(call BuildPackage,libfuse)) diff --git a/package/fuse/patches/101-kmod_build.patch b/package/fuse/patches/101-kmod_build.patch new file mode 100644 index 0000000000..e541d47142 --- /dev/null +++ b/package/fuse/patches/101-kmod_build.patch @@ -0,0 +1,46 @@ +diff -Nur fuse-2.5.2/kernel/Makefile.in fuse-2.5.2.patched/kernel/Makefile.in +--- fuse-2.5.2/kernel/Makefile.in 2006-02-02 18:04:52.000000000 +0100 ++++ fuse-2.5.2.patched/kernel/Makefile.in 2006-03-28 20:17:13.000000000 +0200 +@@ -54,23 +54,8 @@ + + ifeq ($(majver), 2.4) + +-CC = gcc +-LD = ld +-CFLAGS = -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -pipe @KERNELCFLAGS@ +-CPPFLAGS = -I@kernelsrc@/include -I. -D__KERNEL__ -DMODULE -D_LOOSE_KERNEL_NAMES -DFUSE_VERSION=\"$(VERSION)\" @KERNELCPPFLAGS@ +- + fuse_objs = dev.o dir.o file.o inode.o compat/parser.o + +-SUFFIXES = .c .o .s +- +-all-spec: fuse.o +- +-.c.o: +- $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ +- +-fuse.o: $(fuse_objs) +- $(LD) -r -o fuse.o $(fuse_objs) +- + fuse_headers = fuse_i.h fuse_kernel.h + + dev.o: $(fuse_headers) +@@ -78,6 +63,18 @@ + file.o: $(fuse_headers) + inode.o: $(fuse_headers) + ++EXTRA_CFLAGS += -DFUSE_VERSION=\"$(VERSION)\" ++ ++O_TARGET := fuse.o ++ ++obj-y := $(fuse_objs) ++obj-m := $(O_TARGET) ++ ++-include $(TOPDIR)/Rules.make ++ ++all-spec: ++ $(MAKE) -C @kernelsrc@ TOPDIR=@kernelsrc@ SUBDIRS=$(PWD) modules ++ + else + + EXTRA_CFLAGS += -DFUSE_VERSION=\"$(VERSION)\" diff --git a/package/fuse/patches/102-no_depmod.patch b/package/fuse/patches/102-no_depmod.patch new file mode 100644 index 0000000000..ea9539a200 --- /dev/null +++ b/package/fuse/patches/102-no_depmod.patch @@ -0,0 +1,15 @@ +diff -ruN fuse-2.5.3-old/kernel/Makefile.in fuse-2.5.3-new/kernel/Makefile.in +--- fuse-2.5.3-old/kernel/Makefile.in 2006-06-17 00:04:06.000000000 +0200 ++++ fuse-2.5.3-new/kernel/Makefile.in 2006-06-17 00:08:44.000000000 +0200 +@@ -31,11 +31,9 @@ + install-y: all + $(mkdir_p) $(DESTDIR)$(fusemoduledir) + $(INSTALL) -m 644 $(fusemodule) $(DESTDIR)$(fusemoduledir)/$(fusemodule) +- -/sbin/depmod -a + + uninstall-y: + rm -f $(DESTDIR)$(fusemoduledir)/$(fusemodule) +- -/sbin/depmod -a + + clean: + -rm -f $(fusemodule) *.o .*.cmd *.mod.c *.ko *.s */*.o diff --git a/package/fuse/patches/111-uclibc_changes.patch b/package/fuse/patches/111-uclibc_changes.patch new file mode 100644 index 0000000000..69730758e6 --- /dev/null +++ b/package/fuse/patches/111-uclibc_changes.patch @@ -0,0 +1,16 @@ +diff -ruw fuse-2.4.0/util/fusermount.c.org fuse-2.4.0/util/fusermount.c +--- fuse-2.4.0/util/fusermount.c.org 2005-10-14 11:34:06.000000000 +0200 ++++ fuse-2.4.0/util/fusermount.c 2005-10-14 11:56:26.000000000 +0200 +@@ -42,7 +42,12 @@ + #define FUSE_COMMFD_ENV "_FUSE_COMMFD" + + #define FUSE_DEV_OLD "/proc/fs/fuse/dev" ++#ifdef __UCLIBC__ ++/* /dev is mounted as devfs in OpenWRT, and device is created here */ ++#define FUSE_DEV_NEW "/dev/misc/fuse" ++#else + #define FUSE_DEV_NEW "/dev/fuse" ++#endif + #define FUSE_VERSION_FILE_OLD "/proc/fs/fuse/version" + #define FUSE_CONF "/etc/fuse.conf" + diff --git a/package/fuse/patches/112-no_break_on_mknod.patch b/package/fuse/patches/112-no_break_on_mknod.patch new file mode 100644 index 0000000000..96ed70f291 --- /dev/null +++ b/package/fuse/patches/112-no_break_on_mknod.patch @@ -0,0 +1,12 @@ +diff -ruN fuse-2.4.1-old/util/Makefile.in fuse-2.4.1-new/util/Makefile.in +--- fuse-2.4.1-old/util/Makefile.in 2005-10-17 12:29:20.000000000 +0200 ++++ fuse-2.4.1-new/util/Makefile.in 2005-10-19 17:11:13.000000000 +0200 +@@ -445,7 +445,7 @@ + install-exec-hook: + -chown root $(DESTDIR)$(bindir)/fusermount + -chmod u+s $(DESTDIR)$(bindir)/fusermount +- @if test ! -e $(DESTDIR)/dev/fuse; then \ ++ -@if test ! -e $(DESTDIR)/dev/fuse; then \ + $(mkdir_p) $(DESTDIR)/dev; \ + echo "mknod $(DESTDIR)/dev/fuse -m 0666 c 10 229"; \ + mknod $(DESTDIR)/dev/fuse -m 0666 c 10 229; \ diff --git a/package/gdbserver/Makefile b/package/gdbserver/Makefile new file mode 100644 index 0000000000..c07eaf9927 --- /dev/null +++ b/package/gdbserver/Makefile @@ -0,0 +1,69 @@ +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=gdbserver +PKG_VERSION:=6.3 +PKG_RELEASE:=1 + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install + +GDB_DIR:=$(TOOLCHAIN_BUILD_DIR)/gdb-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/gdbserver + SECTION:=utils + CATEGORY:=Utilities + DEPENDS:=@GDB@ + TITLE:=Remote Server for the GNU Debugger + DESCRIPTION:=GDBSERVER is a program that allows you to run GDB on a different machine\\\ +than the one which is running the program being debugged. +endef + +define Build/Configure + (cd $(PKG_BUILD_DIR); rm -rf config.{cache,status}; \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS)" \ + $(GDB_DIR)/gdb/gdbserver/configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --program-prefix="" \ + --program-suffix="" \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib \ + --sysconfdir=/etc \ + --datadir=/usr/share \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + $(DISABLE_NLS) \ + $(DISABLE_LARGEFILE) \ + ); +endef + +define Build/Compile + rm -rf $(PKG_INSTALL_DIR) + mkdir -p $(PKG_INSTALL_DIR) + $(MAKE) -C $(PKG_BUILD_DIR) \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + install +endef + +define Package/gdbserver/install + install -m0755 -d $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/gdbserver $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,gdbserver)) + diff --git a/package/gmp/Makefile b/package/gmp/Makefile new file mode 100644 index 0000000000..1470ead89a --- /dev/null +++ b/package/gmp/Makefile @@ -0,0 +1,65 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=gmp +PKG_VERSION:=4.1.4 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=@GNU/gmp +PKG_MD5SUM:=0aa7d3b3f5b5ec5951e7dddd6f65e891 +PKG_CAT:=bzcat + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install + +include $(INCLUDE_DIR)/package.mk + +define Package/libgmp + SECTION:=libs + CATEGORY:=Libraries + TITLE:=GNU multiprecision arithmetic library + URL:=http://www.swox.com/gmp/ +endef + +define Build/Configure + $(call Build/Configure/Default, \ + --enable-shared \ + --enable-static, \ + CC="$(TARGET_CROSS)gcc" \ + ) +endef + +define Build/Compile + $(call Build/Compile/Default, \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + CC="$(TARGET_CC)" \ + all install \ + ) +endef + +define Build/InstallDev + mkdir -p $(STAGING_DIR)/usr/include + $(CP) $(PKG_INSTALL_DIR)/usr/include/gmp* $(STAGING_DIR)/usr/include/ + mkdir -p $(STAGING_DIR)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgmp.{a,so*} $(STAGING_DIR)/usr/lib/ +endef + +define Build/UninstallDev + rm -rf $(STAGING_DIR)/usr/include/gmp* \ + $(STAGING_DIR)/usr/lib/libgmp.{a,so*} +endef + +define Package/libgmp/install + install -m0755 -d $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgmp.so.* $(1)/usr/lib/ +endef + +$(eval $(call BuildPackage,libgmp)) diff --git a/package/haserl/Makefile b/package/haserl/Makefile new file mode 100644 index 0000000000..83a7d848f8 --- /dev/null +++ b/package/haserl/Makefile @@ -0,0 +1,36 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=haserl +PKG_VERSION:=0.8.0 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/haserl +PKG_MD5SUM:=bd9195d086566f56634c0bcbbbcbebea +PKG_CAT:=zcat + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/haserl + SECTION:=utils + CATEGORY:=Utilities + TITLE:=A CGI wrapper to embed shell scripts in HTML documents + URL:=http://haserl.sourceforge.net/ +endef + +define Package/haserl/install + install -m0755 -d $(1)/usr/bin + install -m0755 $(PKG_BUILD_DIR)/src/haserl $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,haserl)) diff --git a/package/hostap-utils/Makefile b/package/hostap-utils/Makefile new file mode 100644 index 0000000000..ad142f33d2 --- /dev/null +++ b/package/hostap-utils/Makefile @@ -0,0 +1,48 @@ +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=hostap-utils +PKG_VERSION:=0.4.7 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://hostap.epitest.fi/releases/ +PKG_MD5SUM:=afe041581b8f01666e353bec20917c85 +PKG_CAT:=zcat + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/hostap-utils + SECTION:=utils + CATEGORY:=Kernel drivers + DEPENDS:=kmod-hostap + TITLE:=Host AP driver utility programs + URL:=http://hostap.epitest.fi/ +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include -Wall" \ + all +endef + +define Package/hostap-utils/install + install -m0755 -d $(1)/usr/sbin + install -m0755 $(PKG_BUILD_DIR)/hostap_crypt_conf $(1)/usr/sbin/ + install -m0755 $(PKG_BUILD_DIR)/hostap_diag $(1)/usr/sbin/ + install -m0755 $(PKG_BUILD_DIR)/hostap_io_debug $(1)/usr/sbin/ + install -m0755 $(PKG_BUILD_DIR)/hostap_rid $(1)/usr/sbin/ + install -m0755 $(PKG_BUILD_DIR)/prism2_srec $(1)/usr/sbin/ + install -m0755 $(PKG_BUILD_DIR)/split_combined_hex $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,hostap-utils)) diff --git a/package/hostap/Makefile b/package/hostap/Makefile new file mode 100644 index 0000000000..82e7475a0e --- /dev/null +++ b/package/hostap/Makefile @@ -0,0 +1,139 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=hostap-driver +PKG_VERSION:=0.4.9 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://hostap.epitest.fi/releases/ +PKG_MD5SUM:=c7534dc040ab90218257a78488ecd378 +PKG_CAT:=zcat + +PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install + +include $(INCLUDE_DIR)/package.mk + +define Package/kmod-hostap/Default + SECTION:=kernel + CATEGORY:=Kernel drivers + DESCRIPTION:=\ + Host AP is a driver for 802.11b wireless cards based on Intersil \\\ + Prism2/2.5/3 chipset. It supports so called Host AP mode that allows the \\\ + card to act as an IEEE 802.11 access point. + URL:=http://hostap.epitest.fi/ + ifeq ($(KERNEL),2.6) + VERSION:=$(LINUX_VERSION)-$(BOARD)-$(PKG_RELEASE) + else + VERSION:=$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE) + endif +endef + +define Package/kmod-hostap + $(call Package/kmod-hostap/Default) + DEPENDS:=@PCI_SUPPORT||PCMCIA_SUPPORT + TITLE:=Host AP support for Prism2/2.5/3 + DESCRIPTION+=\\\ + \\\ + This package contains the base Host AP driver code that is shared by \\\ + different hardware models. You will also need to enable support for \\\ + PLX/PCI/CS version of the driver to actually use the driver. +endef + +define Package/kmod-hostap-pci + $(call Package/kmod-hostap/Default) + DEPENDS:=kmod-hostap + TITLE:=Host AP driver for PCI adaptors + DESCRIPTION+=\\\ + \\\ + This package contains the Host AP driver for Prism2.5 PCI adaptors. +endef + +define Package/kmod-hostap-plx + $(call Package/kmod-hostap/Default) + DEPENDS:=kmod-hostap + TITLE:=Host AP driver for PLX9052 based PCI adaptors + DESCRIPTION+=\\\ + \\\ + This package contains the Host AP driver for Prism2/2.5/3 in PLX9052 \\\ + based PCI adaptors. +endef + +ifeq ($(KERNEL),2.4) + define Build/Compile + $(MAKE) -C $(LINUX_DIR)/ \ + ARCH="$(LINUX_KARCH)" \ + CROSS_COMPILE="$(TARGET_CROSS)" \ + SUBDIRS="$(PKG_BUILD_DIR)/driver/modules" \ + modules + endef + + define Package/kmod-hostap/install + install -m0755 -d $(1)/lib/modules/$(LINUX_VERSION) + $(CP) \ + $(PKG_BUILD_DIR)/driver/modules/hostap.$(LINUX_KMOD_SUFFIX) \ + $(PKG_BUILD_DIR)/driver/modules/hostap_crypt_ccmp.$(LINUX_KMOD_SUFFIX) \ + $(PKG_BUILD_DIR)/driver/modules/hostap_crypt_tkip.$(LINUX_KMOD_SUFFIX) \ + $(PKG_BUILD_DIR)/driver/modules/hostap_crypt_wep.$(LINUX_KMOD_SUFFIX) \ + $(1)/lib/modules/$(LINUX_VERSION)/ + endef + + define Package/kmod-hostap-pci/install + install -m0755 -d $(1)/lib/modules/$(LINUX_VERSION) + $(CP) \ + $(PKG_BUILD_DIR)/driver/modules/hostap_pci.$(LINUX_KMOD_SUFFIX) \ + $(1)/lib/modules/$(LINUX_VERSION)/ + endef + + define Package/kmod-hostap-plx/install + install -m0755 -d $(1)/lib/modules/$(LINUX_VERSION) + $(CP) \ + $(PKG_BUILD_DIR)/driver/modules/hostap_plx.$(LINUX_KMOD_SUFFIX) \ + $(1)/lib/modules/$(LINUX_VERSION)/ + endef +endif + +ifeq ($(KERNEL),2.6) + define Build/Compile + endef + +ifeq ($(CONFIG_HOSTAP),m) + define Package/kmod-hostap/install + install -m0755 -d $(1)/lib/modules/$(LINUX_VERSION) + $(CP) \ + $(MODULES_DIR)/kernel/drivers/net/wireless/hostap/hostap.$(LINUX_KMOD_SUFFIX) \ + $(1)/lib/modules/$(LINUX_VERSION)/ + endef +endif + +ifeq ($(CONFIG_HOSTAP_PCI),m) + define Package/kmod-hostap-pci/install + install -m0755 -d $(1)/lib/modules/$(LINUX_VERSION) + $(CP) \ + $(MODULES_DIR)/kernel/drivers/net/wireless/hostap/hostap_pci.$(LINUX_KMOD_SUFFIX) \ + $(1)/lib/modules/$(LINUX_VERSION)/ + endef +endif + +ifeq ($(CONFIG_HOSTAP_PLX),m) + define Package/kmod-hostap-plx/install + install -m0755 -d $(1)/lib/modules/$(LINUX_VERSION) + $(CP) \ + $(MODULES_DIR)/kernel/drivers/net/wireless/hostap/hostap_plx.$(LINUX_KMOD_SUFFIX) \ + $(1)/lib/modules/$(LINUX_VERSION)/ + endef +endif +endif + +$(eval $(call BuildPackage,kmod-hostap)) +$(eval $(call BuildPackage,kmod-hostap-pci)) +$(eval $(call BuildPackage,kmod-hostap-plx)) diff --git a/package/hostapd/Makefile b/package/hostapd/Makefile new file mode 100644 index 0000000000..ba16193daf --- /dev/null +++ b/package/hostapd/Makefile @@ -0,0 +1,132 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=hostapd +PKG_VERSION:=0.5.3 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://hostap.epitest.fi/releases/ +PKG_MD5SUM:=4e3134e8b0d86e831230f8c620fd81bb +PKG_CAT:=zcat + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) + +PKG_BUILDDEP:=madwifi + +include $(INCLUDE_DIR)/package.mk + +define Package/hostapd/Default + SECTION:=net + CATEGORY:=Network + TITLE:=IEEE 802.1x Authenticator + URL:=http://hostap.epitest.fi/ +endef + +define Package/hostapd + $(call Package/hostapd/Default) + DEPENDS:=+libopenssl + TITLE+= (full) + DESCRIPTION:=\ + This package contains a full featured IEEE 802.1x/WPA/EAP/RADIUS \\\ + Authenticator. +endef + +define Package/hostapd/conffiles +/etc/hostapd.conf +endef + +define Package/hostapd-mini + $(call Package/hostapd/Default) + TITLE+= (WPA-PSK only) + DESCRIPTION:=\ + This package contains a minimal IEEE 802.1x/WPA/EAP/RADIUS Authenticator \\\ + (WPA-PSK only). +endef + +define Package/hostapd-mini/conffiles +/etc/hostapd.conf +endef + +define Package/hostapd-utils + $(call Package/hostapd/Default) + DEPENDS:=@PACKAGE_hostapd||PACKAGE_hostapd-mini + TITLE+= (utils) + DESCRIPTION:=\ + This package contains a command line utility to control the \\\ + IEEE 802.1x/WPA/EAP/RADIUS Authenticator. +endef + +define Build/ConfigureTarget + $(CP) $(PKG_BUILD_DIR) $(PKG_BUILD_DIR)_$(1) + $(CP) ./files/$(1).config $(PKG_BUILD_DIR)_$(1)/.config +endef + +define Build/CompileTarget + $(MAKE) -C $(PKG_BUILD_DIR)_$(1) \ + $(TARGET_CONFIGURE_OPTS) \ + OPTFLAGS="$(TARGET_CFLAGS)" \ + CPPFLAGS="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include -I$(STAGING_DIR)/usr/include/madwifi" \ + LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \ + hostapd hostapd_cli + $(CP) $(PKG_BUILD_DIR)_$(1)/hostapd_cli $(PKG_BUILD_DIR)/ +endef + +define Package/InstallTemplate + if [ \! -f "$(PKG_BUILD_DIR)_$(2)/hostapd" ]; then \ + rm -f $(PKG_BUILD_DIR)/.built; \ + $(MAKE) $(PKG_BUILD_DIR)/.built; \ + fi + install -m0755 -d $$(1)/etc + install -m0600 $(PKG_BUILD_DIR)_$(2)/madwifi.conf $$(1)/etc/hostapd.conf + install -m0755 -d $$(1)/usr/sbin + install -m0755 $(PKG_BUILD_DIR)_$(2)/hostapd $$(1)/usr/sbin/ +endef + +define Package/Template + ifneq ($(CONFIG_PACKAGE_$(1)),) + define Build/Configure/$(2) + $(call Build/ConfigureTarget,$(2)) + endef + define Build/Compile/$(2) + $(call Build/CompileTarget,$(2)) + endef + define Package/$(1)/install + $(call Package/InstallTemplate,$(1),$(2)) + endef + endif +endef + +define Build/Configure + $(call Build/Configure/default) + $(call Build/Configure/mini) +endef + +define Build/Compile + $(call Build/Compile/default) + $(call Build/Compile/mini) +endef + +define Build/Clean + rm -rf $(PKG_BUILD_DIR)_default + rm -rf $(PKG_BUILD_DIR)_mini +endef + +define Package/hostapd-utils/install + install -m0755 -d $(1)/usr/sbin + install -m0755 $(PKG_BUILD_DIR)/hostapd_cli $(1)/usr/sbin/ +endef + +$(eval $(call Package/Template,hostapd,default)) +$(eval $(call Package/Template,hostapd-mini,mini)) + +$(eval $(call BuildPackage,hostapd)) +$(eval $(call BuildPackage,hostapd-mini)) +$(eval $(call BuildPackage,hostapd-utils)) diff --git a/package/hostapd/files/default.config b/package/hostapd/files/default.config new file mode 100644 index 0000000000..e2237d6d8d --- /dev/null +++ b/package/hostapd/files/default.config @@ -0,0 +1,69 @@ +# Example hostapd build time configuration +# +# This file lists the configuration options that are used when building the +# hostapd binary. All lines starting with # are ignored. Configuration option +# lines must be commented out complete, if they are not to be included, i.e., +# just setting VARIABLE=n is not disabling that variable. +# +# This file is included in Makefile, so variables like CFLAGS and LIBS can also +# be modified from here. In most cass, these lines should use += in order not +# to override previous values of the variables. + +# Driver interface for Host AP driver +CONFIG_DRIVER_HOSTAP=y + +# Driver interface for wired authenticator +#CONFIG_DRIVER_WIRED=y + +# Driver interface for madwifi driver +CONFIG_DRIVER_MADWIFI=y +#CFLAGS += -I../head # change to reflect local setup; directory for madwifi src + +# Driver interface for Prism54 driver +#CONFIG_DRIVER_PRISM54=y + +# Driver interface for FreeBSD net80211 layer (e.g., Atheros driver) +#CONFIG_DRIVER_BSD=y +#CFLAGS += -I/usr/local/include +#LIBS += -L/usr/local/lib + +# IEEE 802.11F/IAPP +CONFIG_IAPP=y + +# WPA2/IEEE 802.11i RSN pre-authentication +CONFIG_RSN_PREAUTH=y + +# Integrated EAP authenticator +CONFIG_EAP=y + +# EAP-MD5 for the integrated EAP authenticator +CONFIG_EAP_MD5=y + +# EAP-TLS for the integrated EAP authenticator +CONFIG_EAP_TLS=y + +# EAP-MSCHAPv2 for the integrated EAP authenticator +CONFIG_EAP_MSCHAPV2=y + +# EAP-PEAP for the integrated EAP authenticator +CONFIG_EAP_PEAP=y + +# EAP-PSK for the integrated EAP authenticator +CONFIG_EAP_PSK=y + +# EAP-GTC for the integrated EAP authenticator +CONFIG_EAP_GTC=y + +# EAP-TTLS for the integrated EAP authenticator +CONFIG_EAP_TTLS=y + +# EAP-SIM for the integrated EAP authenticator +#CONFIG_EAP_SIM=y + +# PKCS#12 (PFX) support (used to read private key and certificate file from +# a file that usually has extension .p12 or .pfx) +CONFIG_PKCS12=y + +# RADIUS authentication server. This provides access to the integrated EAP +# authenticator from external hosts using RADIUS. +#CONFIG_RADIUS_SERVER=y diff --git a/package/hostapd/files/mini.config b/package/hostapd/files/mini.config new file mode 100644 index 0000000000..912bee8d7f --- /dev/null +++ b/package/hostapd/files/mini.config @@ -0,0 +1,69 @@ +# Example hostapd build time configuration +# +# This file lists the configuration options that are used when building the +# hostapd binary. All lines starting with # are ignored. Configuration option +# lines must be commented out complete, if they are not to be included, i.e., +# just setting VARIABLE=n is not disabling that variable. +# +# This file is included in Makefile, so variables like CFLAGS and LIBS can also +# be modified from here. In most cass, these lines should use += in order not +# to override previous values of the variables. + +# Driver interface for Host AP driver +CONFIG_DRIVER_HOSTAP=y + +# Driver interface for wired authenticator +#CONFIG_DRIVER_WIRED=y + +# Driver interface for madwifi driver +CONFIG_DRIVER_MADWIFI=y +#CFLAGS += -I../head # change to reflect local setup; directory for madwifi src + +# Driver interface for Prism54 driver +#CONFIG_DRIVER_PRISM54=y + +# Driver interface for FreeBSD net80211 layer (e.g., Atheros driver) +#CONFIG_DRIVER_BSD=y +#CFLAGS += -I/usr/local/include +#LIBS += -L/usr/local/lib + +# IEEE 802.11F/IAPP +CONFIG_IAPP=y + +# WPA2/IEEE 802.11i RSN pre-authentication +CONFIG_RSN_PREAUTH=y + +# Integrated EAP authenticator +CONFIG_EAP=y + +# EAP-MD5 for the integrated EAP authenticator +#CONFIG_EAP_MD5=y + +# EAP-TLS for the integrated EAP authenticator +#CONFIG_EAP_TLS=y + +# EAP-MSCHAPv2 for the integrated EAP authenticator +#CONFIG_EAP_MSCHAPV2=y + +# EAP-PEAP for the integrated EAP authenticator +#CONFIG_EAP_PEAP=y + +# EAP-PSK for the integrated EAP authenticator +CONFIG_EAP_PSK=y + +# EAP-GTC for the integrated EAP authenticator +#CONFIG_EAP_GTC=y + +# EAP-TTLS for the integrated EAP authenticator +#CONFIG_EAP_TTLS=y + +# EAP-SIM for the integrated EAP authenticator +#CONFIG_EAP_SIM=y + +# PKCS#12 (PFX) support (used to read private key and certificate file from +# a file that usually has extension .p12 or .pfx) +#CONFIG_PKCS12=y + +# RADIUS authentication server. This provides access to the integrated EAP +# authenticator from external hosts using RADIUS. +#CONFIG_RADIUS_SERVER=y diff --git a/package/hostapd/patches/001-cross_compile_fix.patch b/package/hostapd/patches/001-cross_compile_fix.patch new file mode 100644 index 0000000000..8b5ca681d2 --- /dev/null +++ b/package/hostapd/patches/001-cross_compile_fix.patch @@ -0,0 +1,35 @@ +Common subdirectories: hostapd-0.5.2/logwatch and hostapd-0.5.2.new/logwatch +diff -u hostapd-0.5.2/Makefile hostapd-0.5.2.new/Makefile +--- hostapd-0.5.2/Makefile 2006-03-20 03:20:09.000000000 +0000 ++++ hostapd-0.5.2.new/Makefile 2006-03-21 22:25:23.803473592 +0000 +@@ -3,7 +3,7 @@ + DIR_HOSTAP=. + + ifndef CFLAGS +-CFLAGS = -MMD -O2 -Wall -g ++CFLAGS = -MMD $(OPTFLAGS) $(CPPFLAGS) + endif + + # define HOSTAPD_DUMP_STATE to include SIGUSR1 handler for dumping state to +@@ -266,7 +266,7 @@ + for i in $(ALL); do cp $$i /usr/local/bin/$$i; done + + hostapd: $(OBJS) +- $(CC) -o hostapd $(OBJS) $(LIBS) ++ $(CC) -o hostapd $(OBJS) $(LDFLAGS) $(LIBS) + + driver_conf.c: Makefile .config + rm -f driver_conf.c +@@ -330,10 +330,10 @@ + endif + + nt_password_hash: $(NOBJS) +- $(CC) -o nt_password_hash $(NOBJS) $(LIBS_n) ++ $(CC) -o nt_password_hash $(NOBJS) $(LDFLAGS) $(LIBS_n) + + hlr_auc_gw: $(HOBJS) +- $(CC) -o hlr_auc_gw $(HOBJS) $(LIBS_h) ++ $(CC) -o hlr_auc_gw $(HOBJS) $(LDFLAGS) $(LIBS_h) + + clean: + rm -f core *~ *.o hostapd hostapd_cli nt_password_hash hlr_auc_gw diff --git a/package/hostapd/patches/100-madwifi_fixes.patch b/package/hostapd/patches/100-madwifi_fixes.patch new file mode 100644 index 0000000000..eb7299b41a --- /dev/null +++ b/package/hostapd/patches/100-madwifi_fixes.patch @@ -0,0 +1,52 @@ +diff -ur hostapd.old/driver_madwifi.c hostapd.dev/driver_madwifi.c +--- hostapd.old/driver_madwifi.c 2006-03-25 20:55:18.000000000 +0100 ++++ hostapd.dev/driver_madwifi.c 2006-06-12 21:54:22.000000000 +0200 +@@ -20,11 +20,6 @@ + + #include <include/compat.h> + #include <net80211/ieee80211.h> +-#ifdef WME_NUM_AC +-/* Assume this is built against BSD branch of madwifi driver. */ +-#define MADWIFI_BSD +-#include <net80211/_ieee80211.h> +-#endif /* WME_NUM_AC */ + #include <net80211/ieee80211_crypto.h> + #include <net80211/ieee80211_ioctl.h> + +@@ -168,7 +164,10 @@ + } + return 0; + } +- ++static int madwifi_get_inact_sec(void *priv, const u8 *addr) ++{ ++return 0; ++} + static int + set80211param(struct madwifi_driver_data *drv, int op, int arg) + { +@@ -1204,8 +1203,6 @@ + goto bad; + } + +- madwifi_set_iface_flags(drv, 0); /* mark down during setup */ +- + hapd->driver = &drv->ops; + return 0; + bad: +@@ -1226,7 +1223,6 @@ + + drv->hapd->driver = NULL; + +- (void) madwifi_set_iface_flags(drv, 0); + if (drv->ioctl_sock >= 0) + close(drv->ioctl_sock); + if (drv->sock_recv != NULL && drv->sock_recv != drv->sock_xmit) +@@ -1306,6 +1452,7 @@ + .get_ssid = madwifi_get_ssid, + .set_countermeasures = madwifi_set_countermeasures, + .sta_clear_stats = madwifi_sta_clear_stats, ++ .get_inact_sec = madwifi_get_inact_sec, + }; + + void madwifi_driver_register(void) diff --git a/package/iproute2/Makefile b/package/iproute2/Makefile new file mode 100644 index 0000000000..01097c88b9 --- /dev/null +++ b/package/iproute2/Makefile @@ -0,0 +1,68 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=iproute2 +PKG_VERSION:=2.6.15-060110 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://developer.osdl.org/dev/iproute2/download/ +PKG_MD5SUM:=04f57a6d366d36426d276178b600f5c5 +PKG_CAT:=zcat + +PKG_BUILD_DIR:=$(BUILD_DIR)/iproute2-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/iproute2/Default + SECTION:=net + CATEGORY:=Network + URL:=http://linux-net.osdl.org/index.php/Iproute2 +endef + +define Package/ip + $(call Package/iproute2/Default) + TITLE:=Routing control utility +endef + +define Package/tc + $(call Package/iproute2/Default) + TITLE:=Traffic control utility +endef + +define Build/Configure + $(SED) "s:-O2:${TARGET_CFLAGS}:g" $(PKG_BUILD_DIR)/Makefile + $(SED) "s,-I/usr/include/db3,," $(PKG_BUILD_DIR)/Makefile + $(SED) "s,^KERNEL_INCLUDE.*,KERNEL_INCLUDE=$(LINUX_DIR)/include," \ + $(PKG_BUILD_DIR)/Makefile + $(SED) "s,^LIBC_INCLUDE.*,LIBC_INCLUDE=$(STAGING_DIR)/include," \ + $(PKG_BUILD_DIR)/Makefile + # For now disable compiling of the misc directory because it seems to fail + rm -rf $(PKG_BUILD_DIR)/misc + $(SED) "s, misc,," $(PKG_BUILD_DIR)/Makefile +endef + +define Build/Compile + $(MAKE) -j1 -C $(PKG_BUILD_DIR)/netem HOSTCC="$(HOSTCC)" CFLAGS="-D_GNU_SOURCE -O2 -Wstrict-prototypes -Wall -I ../include -DRESOLVE_HOSTNAMES" + $(MAKE) -j1 -C $(PKG_BUILD_DIR) $(TARGET_CONFIGURE_OPTS) KERNEL_INCLUDE=$(LINUX_DIR)/include all tc/tc ip/ip +endef + +define Package/ip/install + install -d -m0755 $(1)/usr/sbin + install -m0755 $(PKG_BUILD_DIR)/ip/ip $(1)/usr/sbin/ +endef + +define Package/tc/install + install -d -m0755 $(1)/usr/sbin + install -m0755 $(PKG_BUILD_DIR)/tc/tc $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,ip)) +$(eval $(call BuildPackage,tc)) diff --git a/package/iproute2/patches/000-debian_patches_3.patch b/package/iproute2/patches/000-debian_patches_3.patch new file mode 100644 index 0000000000..c6b1bd6bb7 --- /dev/null +++ b/package/iproute2/patches/000-debian_patches_3.patch @@ -0,0 +1,1425 @@ +diff -Nur iproute2-2.6.15-060110/doc/ip-cref.tex iproute2-2.6.15-060110-owrt/doc/ip-cref.tex +--- iproute2-2.6.15-060110/doc/ip-cref.tex 2004-04-15 22:56:59.000000000 +0200 ++++ iproute2-2.6.15-060110-owrt/doc/ip-cref.tex 2006-03-22 12:49:35.000000000 +0100 +@@ -1322,6 +1322,19 @@ + If it is not given, Linux uses the value selected with \verb|sysctl| + variable \verb|net/ipv4/tcp_reordering|. + ++\item \verb|hoplimit NUMBER| ++ ++--- [2.5.74+ only] Hop limit on the path to this destination. If it is not ++ given, Linux uses the value selected with \verb|sysctl| variable ++ \verb|net/ipv4/ip_default_ttl|. ++ ++\item \verb|initcwnd NUMBER| ++ ++--- [2.5.70+ only] Initial congestion window size when establishing ++ connections to this destination. This value is multiplied with the ++ MSS (``Maximal Segment Size'') for the connection to get the actual ++ window size. If it is not given (or set to zero), Linux uses the ++ values specified in~\cite{RFC2414}. + + + \item \verb|nexthop NEXTHOP| +@@ -2651,6 +2664,9 @@ + \bibitem{RFC-DHCP} R.~Droms. + ``Dynamic Host Configuration Protocol.'', RFC-2131 + ++\bibitem{RFC2414} M.~Allman, S.~Floyd, C.~Partridge. ++``Increasing TCP's Initial Window'', RFC-2414. ++ + \end{thebibliography} + + +diff -Nur iproute2-2.6.15-060110/doc/Makefile iproute2-2.6.15-060110-owrt/doc/Makefile +--- iproute2-2.6.15-060110/doc/Makefile 2005-03-10 20:01:36.000000000 +0100 ++++ iproute2-2.6.15-060110-owrt/doc/Makefile 2006-03-22 12:49:35.000000000 +0100 +@@ -14,6 +14,7 @@ + PAGESPERPAGE=2 + + HTMLFILES=$(subst .sgml,.html,$(shell echo *.sgml)) ++TXTFILES=$(subst .sgml,.txt,$(shell echo *.sgml)) + DVIFILES=$(subst .ps,.dvi,$(PSFILES)) + + +@@ -23,6 +24,8 @@ + + html: $(HTMLFILES) + ++txt: $(TXTFILES) ++ + dvi: $(DVIFILES) + + print: $(PSFILES) +@@ -47,9 +50,12 @@ + %.html: %.sgml + $(SGML2HTML) $< + ++%.txt: %.html ++ lynx -nolist -dump $< > $@ ++ + install: + install -m 0644 $(shell echo *.tex) $(DESTDIR)$(DOCDIR) + install -m 0644 $(shell echo *.sgml) $(DESTDIR)$(DOCDIR) + + clean: +- rm -f *.aux *.log *.toc $(PSFILES) $(DVIFILES) *.html ++ rm -f *.aux *.log *.toc $(PSFILES) $(DVIFILES) *.html $(TXTFILES) +diff -Nur iproute2-2.6.15-060110/include/linux/pkt_sched.h iproute2-2.6.15-060110-owrt/include/linux/pkt_sched.h +--- iproute2-2.6.15-060110/include/linux/pkt_sched.h 2005-12-10 00:27:44.000000000 +0100 ++++ iproute2-2.6.15-060110-owrt/include/linux/pkt_sched.h 2006-03-22 12:49:35.000000000 +0100 +@@ -1,3 +1,409 @@ ++#if 0 ++#ifndef __LINUX_PKT_SCHED_H ++#define __LINUX_PKT_SCHED_H ++ ++/* Logical priority bands not depending on specific packet scheduler. ++ Every scheduler will map them to real traffic classes, if it has ++ no more precise mechanism to classify packets. ++ ++ These numbers have no special meaning, though their coincidence ++ with obsolete IPv6 values is not occasional :-). New IPv6 drafts ++ preferred full anarchy inspired by diffserv group. ++ ++ Note: TC_PRIO_BESTEFFORT does not mean that it is the most unhappy ++ class, actually, as rule it will be handled with more care than ++ filler or even bulk. ++ */ ++ ++#define TC_PRIO_BESTEFFORT 0 ++#define TC_PRIO_FILLER 1 ++#define TC_PRIO_BULK 2 ++#define TC_PRIO_INTERACTIVE_BULK 4 ++#define TC_PRIO_INTERACTIVE 6 ++#define TC_PRIO_CONTROL 7 ++ ++#define TC_PRIO_MAX 15 ++ ++/* Generic queue statistics, available for all the elements. ++ Particular schedulers may have also their private records. ++ */ ++ ++struct tc_stats ++{ ++ __u64 bytes; /* NUmber of enqueues bytes */ ++ __u32 packets; /* Number of enqueued packets */ ++ __u32 drops; /* Packets dropped because of lack of resources */ ++ __u32 overlimits; /* Number of throttle events when this ++ * flow goes out of allocated bandwidth */ ++ __u32 bps; /* Current flow byte rate */ ++ __u32 pps; /* Current flow packet rate */ ++ __u32 qlen; ++ __u32 backlog; ++#ifdef __KERNEL__ ++ spinlock_t *lock; ++#endif ++}; ++ ++struct tc_estimator ++{ ++ char interval; ++ unsigned char ewma_log; ++}; ++ ++/* "Handles" ++ --------- ++ ++ All the traffic control objects have 32bit identifiers, or "handles". ++ ++ They can be considered as opaque numbers from user API viewpoint, ++ but actually they always consist of two fields: major and ++ minor numbers, which are interpreted by kernel specially, ++ that may be used by applications, though not recommended. ++ ++ F.e. qdisc handles always have minor number equal to zero, ++ classes (or flows) have major equal to parent qdisc major, and ++ minor uniquely identifying class inside qdisc. ++ ++ Macros to manipulate handles: ++ */ ++ ++#define TC_H_MAJ_MASK (0xFFFF0000U) ++#define TC_H_MIN_MASK (0x0000FFFFU) ++#define TC_H_MAJ(h) ((h)&TC_H_MAJ_MASK) ++#define TC_H_MIN(h) ((h)&TC_H_MIN_MASK) ++#define TC_H_MAKE(maj,min) (((maj)&TC_H_MAJ_MASK)|((min)&TC_H_MIN_MASK)) ++ ++#define TC_H_UNSPEC (0U) ++#define TC_H_ROOT (0xFFFFFFFFU) ++#define TC_H_INGRESS (0xFFFFFFF1U) ++ ++struct tc_ratespec ++{ ++ unsigned char cell_log; ++ unsigned char __reserved; ++ unsigned short feature; ++ short addend; ++ unsigned short mpu; ++ __u32 rate; ++}; ++ ++/* FIFO section */ ++ ++struct tc_fifo_qopt ++{ ++ __u32 limit; /* Queue length: bytes for bfifo, packets for pfifo */ ++}; ++ ++/* PRIO section */ ++ ++#define TCQ_PRIO_BANDS 16 ++ ++struct tc_prio_qopt ++{ ++ int bands; /* Number of bands */ ++ __u8 priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> PRIO band */ ++}; ++ ++/* CSZ section */ ++ ++struct tc_csz_qopt ++{ ++ int flows; /* Maximal number of guaranteed flows */ ++ unsigned char R_log; /* Fixed point position for round number */ ++ unsigned char delta_log; /* Log of maximal managed time interval */ ++ __u8 priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> CSZ band */ ++}; ++ ++struct tc_csz_copt ++{ ++ struct tc_ratespec slice; ++ struct tc_ratespec rate; ++ struct tc_ratespec peakrate; ++ __u32 limit; ++ __u32 buffer; ++ __u32 mtu; ++}; ++ ++enum ++{ ++ TCA_CSZ_UNSPEC, ++ TCA_CSZ_PARMS, ++ TCA_CSZ_RTAB, ++ TCA_CSZ_PTAB, ++}; ++ ++/* TBF section */ ++ ++struct tc_tbf_qopt ++{ ++ struct tc_ratespec rate; ++ struct tc_ratespec peakrate; ++ __u32 limit; ++ __u32 buffer; ++ __u32 mtu; ++}; ++ ++enum ++{ ++ TCA_TBF_UNSPEC, ++ TCA_TBF_PARMS, ++ TCA_TBF_RTAB, ++ TCA_TBF_PTAB, ++}; ++ ++ ++/* TEQL section */ ++ ++/* TEQL does not require any parameters */ ++ ++/* SFQ section */ ++ ++struct tc_sfq_qopt ++{ ++ unsigned quantum; /* Bytes per round allocated to flow */ ++ int perturb_period; /* Period of hash perturbation */ ++ __u32 limit; /* Maximal packets in queue */ ++ unsigned divisor; /* Hash divisor */ ++ unsigned flows; /* Maximal number of flows */ ++}; ++ ++/* ++ * NOTE: limit, divisor and flows are hardwired to code at the moment. ++ * ++ * limit=flows=128, divisor=1024; ++ * ++ * The only reason for this is efficiency, it is possible ++ * to change these parameters in compile time. ++ */ ++ ++/* RED section */ ++ ++enum ++{ ++ TCA_RED_UNSPEC, ++ TCA_RED_PARMS, ++ TCA_RED_STAB, ++}; ++ ++struct tc_red_qopt ++{ ++ __u32 limit; /* HARD maximal queue length (bytes) */ ++ __u32 qth_min; /* Min average length threshold (bytes) */ ++ __u32 qth_max; /* Max average length threshold (bytes) */ ++ unsigned char Wlog; /* log(W) */ ++ unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */ ++ unsigned char Scell_log; /* cell size for idle damping */ ++ unsigned char flags; ++#define TC_RED_ECN 1 ++}; ++ ++struct tc_red_xstats ++{ ++ __u32 early; /* Early drops */ ++ __u32 pdrop; /* Drops due to queue limits */ ++ __u32 other; /* Drops due to drop() calls */ ++ __u32 marked; /* Marked packets */ ++}; ++ ++/* GRED section */ ++ ++#define MAX_DPs 16 ++ ++enum ++{ ++ TCA_GRED_UNSPEC, ++ TCA_GRED_PARMS, ++ TCA_GRED_STAB, ++ TCA_GRED_DPS, ++}; ++ ++#define TCA_SET_OFF TCA_GRED_PARMS ++struct tc_gred_qopt ++{ ++ __u32 limit; /* HARD maximal queue length (bytes) ++*/ ++ __u32 qth_min; /* Min average length threshold (bytes) ++*/ ++ __u32 qth_max; /* Max average length threshold (bytes) ++*/ ++ __u32 DP; /* upto 2^32 DPs */ ++ __u32 backlog; ++ __u32 qave; ++ __u32 forced; ++ __u32 early; ++ __u32 other; ++ __u32 pdrop; ++ ++ unsigned char Wlog; /* log(W) */ ++ unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */ ++ unsigned char Scell_log; /* cell size for idle damping */ ++ __u8 prio; /* prio of this VQ */ ++ __u32 packets; ++ __u32 bytesin; ++}; ++/* gred setup */ ++struct tc_gred_sopt ++{ ++ __u32 DPs; ++ __u32 def_DP; ++ __u8 grio; ++}; ++ ++/* HTB section */ ++#define TC_HTB_NUMPRIO 8 ++#define TC_HTB_MAXDEPTH 8 ++#define TC_HTB_PROTOVER 3 /* the same as HTB and TC's major */ ++ ++struct tc_htb_opt ++{ ++ struct tc_ratespec rate; ++ struct tc_ratespec ceil; ++ __u32 buffer; ++ __u32 cbuffer; ++ __u32 quantum; ++ __u32 level; /* out only */ ++ __u32 prio; ++}; ++struct tc_htb_glob ++{ ++ __u32 version; /* to match HTB/TC */ ++ __u32 rate2quantum; /* bps->quantum divisor */ ++ __u32 defcls; /* default class number */ ++ __u32 debug; /* debug flags */ ++ ++ /* stats */ ++ __u32 direct_pkts; /* count of non shapped packets */ ++}; ++enum ++{ ++ TCA_HTB_UNSPEC, ++ TCA_HTB_PARMS, ++ TCA_HTB_INIT, ++ TCA_HTB_CTAB, ++ TCA_HTB_RTAB, ++}; ++struct tc_htb_xstats ++{ ++ __u32 lends; ++ __u32 borrows; ++ __u32 giants; /* too big packets (rate will not be accurate) */ ++ __u32 tokens; ++ __u32 ctokens; ++}; ++ ++/* CBQ section */ ++ ++#define TC_CBQ_MAXPRIO 8 ++#define TC_CBQ_MAXLEVEL 8 ++#define TC_CBQ_DEF_EWMA 5 ++ ++struct tc_cbq_lssopt ++{ ++ unsigned char change; ++ unsigned char flags; ++#define TCF_CBQ_LSS_BOUNDED 1 ++#define TCF_CBQ_LSS_ISOLATED 2 ++ unsigned char ewma_log; ++ unsigned char level; ++#define TCF_CBQ_LSS_FLAGS 1 ++#define TCF_CBQ_LSS_EWMA 2 ++#define TCF_CBQ_LSS_MAXIDLE 4 ++#define TCF_CBQ_LSS_MINIDLE 8 ++#define TCF_CBQ_LSS_OFFTIME 0x10 ++#define TCF_CBQ_LSS_AVPKT 0x20 ++ __u32 maxidle; ++ __u32 minidle; ++ __u32 offtime; ++ __u32 avpkt; ++}; ++ ++struct tc_cbq_wrropt ++{ ++ unsigned char flags; ++ unsigned char priority; ++ unsigned char cpriority; ++ unsigned char __reserved; ++ __u32 allot; ++ __u32 weight; ++}; ++ ++struct tc_cbq_ovl ++{ ++ unsigned char strategy; ++#define TC_CBQ_OVL_CLASSIC 0 ++#define TC_CBQ_OVL_DELAY 1 ++#define TC_CBQ_OVL_LOWPRIO 2 ++#define TC_CBQ_OVL_DROP 3 ++#define TC_CBQ_OVL_RCLASSIC 4 ++ unsigned char priority2; ++ __u32 penalty; ++}; ++ ++struct tc_cbq_police ++{ ++ unsigned char police; ++ unsigned char __res1; ++ unsigned short __res2; ++}; ++ ++struct tc_cbq_fopt ++{ ++ __u32 split; ++ __u32 defmap; ++ __u32 defchange; ++}; ++ ++struct tc_cbq_xstats ++{ ++ __u32 borrows; ++ __u32 overactions; ++ __s32 avgidle; ++ __s32 undertime; ++}; ++ ++enum ++{ ++ TCA_CBQ_UNSPEC, ++ TCA_CBQ_LSSOPT, ++ TCA_CBQ_WRROPT, ++ TCA_CBQ_FOPT, ++ TCA_CBQ_OVL_STRATEGY, ++ TCA_CBQ_RATE, ++ TCA_CBQ_RTAB, ++ TCA_CBQ_POLICE, ++}; ++ ++#define TCA_CBQ_MAX TCA_CBQ_POLICE ++ ++/* dsmark section */ ++ ++enum { ++ TCA_DSMARK_UNSPEC, ++ TCA_DSMARK_INDICES, ++ TCA_DSMARK_DEFAULT_INDEX, ++ TCA_DSMARK_SET_TC_INDEX, ++ TCA_DSMARK_MASK, ++ TCA_DSMARK_VALUE ++}; ++ ++#define TCA_DSMARK_MAX TCA_DSMARK_VALUE ++ ++/* ATM section */ ++ ++enum { ++ TCA_ATM_UNSPEC, ++ TCA_ATM_FD, /* file/socket descriptor */ ++ TCA_ATM_PTR, /* pointer to descriptor - later */ ++ TCA_ATM_HDR, /* LL header */ ++ TCA_ATM_EXCESS, /* excess traffic class (0 for CLP) */ ++ TCA_ATM_ADDR, /* PVC address (for output only) */ ++ TCA_ATM_STATE /* VC state (ATM_VS_*; for output only) */ ++}; ++ ++#define TCA_ATM_MAX TCA_ATM_STATE ++ ++#endif ++#endif + #ifndef __LINUX_PKT_SCHED_H + #define __LINUX_PKT_SCHED_H + +@@ -466,4 +872,116 @@ + + #define NETEM_DIST_SCALE 8192 + ++/* WRR section */ ++ ++/* Other includes */ ++#include <linux/if_ether.h> ++ ++// A sub weight and of a class ++// All numbers are represented as parts of (2^64-1). ++struct tc_wrr_class_weight { ++ __u64 val; // Current value (0 is not valid) ++ __u64 decr; // Value pr bytes (2^64-1 is not valid) ++ __u64 incr; // Value pr seconds (2^64-1 is not valid) ++ __u64 min; // Minimal value (0 is not valid) ++ __u64 max; // Minimal value (0 is not valid) ++ ++// The time where the above information was correct: ++ time_t tim; ++}; ++ ++// Packet send when modifying a class: ++struct tc_wrr_class_modf { ++ // Not-valid values are ignored. ++ struct tc_wrr_class_weight weight1; ++ struct tc_wrr_class_weight weight2; ++}; ++ ++// Packet returned when quering a class: ++struct tc_wrr_class_stats { ++ char used; // If this is false the information below is invalid ++ ++ struct tc_wrr_class_modf class_modf; ++ ++ unsigned char addr[ETH_ALEN]; ++ char usemac; // True if addr is a MAC address, else it is an IP address ++ // (this value is only for convience, it is always the same ++ // value as in the qdisc) ++ int heappos; // Current heap position or 0 if not in heap ++ __u64 penal_ls; // Penalty value in heap (ls) ++ __u64 penal_ms; // Penalty value in heap (ms) ++}; ++ ++// Qdisc-wide penalty information (boolean values - 2 not valid) ++struct tc_wrr_qdisc_weight { ++ char weight_mode; // 0=No automatic change to weight ++ // 1=Decrease normally ++ // 2=Also multiply with number of machines ++ // 3=Instead multiply with priority divided ++ // with priority of the other. ++ // -1=no change ++}; ++ ++// Packet send when modifing a qdisc: ++struct tc_wrr_qdisc_modf { ++ // Not-valid values are ignored: ++ struct tc_wrr_qdisc_weight weight1; ++ struct tc_wrr_qdisc_weight weight2; ++}; ++ ++// Packet send when creating a qdisc: ++struct tc_wrr_qdisc_crt { ++ struct tc_wrr_qdisc_modf qdisc_modf; ++ ++ char srcaddr; // 1=lookup source, 0=lookup destination ++ char usemac; // 1=Classify on MAC addresses, 0=classify on IP ++ char usemasq; // 1=Classify based on masqgrading - only valid ++ // if usemac is zero ++ int bands_max; // Maximal number of bands (i.e.: classes) ++ int proxy_maxconn;// If differnt from 0 then we support proxy remapping ++ // of packets. And this is the number of maximal ++ // concurrent proxy connections. ++}; ++ ++// Packet returned when quering a qdisc: ++struct tc_wrr_qdisc_stats { ++ struct tc_wrr_qdisc_crt qdisc_crt; ++ int proxy_curconn; ++ int nodes_in_heap; // Current number of bands wanting to send something ++ int bands_cur; // Current number of bands used (i.e.: MAC/IP addresses seen) ++ int bands_reused; // Number of times this band has been reused. ++ int packets_requed; // Number of times packets have been requeued. ++ __u64 priosum; // Sum of priorities in heap where 1 is 2^32 ++}; ++ ++struct tc_wrr_qdisc_modf_std { ++ // This indicates which of the tc_wrr_qdisc_modf structers this is: ++ char proxy; // 0=This struct ++ ++ // Should we also change a class? ++ char change_class; ++ ++ // Only valid if change_class is false ++ struct tc_wrr_qdisc_modf qdisc_modf; ++ ++ // Only valid if change_class is true: ++ unsigned char addr[ETH_ALEN]; // Class to change (non-used bytes should be 0) ++ struct tc_wrr_class_modf class_modf; // The change ++}; ++ ++// Used for proxyrempping: ++struct tc_wrr_qdisc_modf_proxy { ++ // This indicates which of the tc_wrr_qdisc_modf structers this is: ++ char proxy; // 1=This struct ++ ++ // This is 1 if the proxyremap information should be reset ++ char reset; ++ ++ // changec is the number of elements in changes. ++ int changec; ++ ++ // This is an array of type ProxyRemapBlock: ++ long changes[0]; ++}; ++ + #endif +diff -Nur iproute2-2.6.15-060110/ip/iproute.c iproute2-2.6.15-060110-owrt/ip/iproute.c +--- iproute2-2.6.15-060110/ip/iproute.c 2005-10-13 00:49:50.000000000 +0200 ++++ iproute2-2.6.15-060110-owrt/ip/iproute.c 2006-03-22 12:49:35.000000000 +0100 +@@ -60,7 +60,7 @@ + fprintf(stderr, "OPTIONS := FLAGS [ mtu NUMBER ] [ advmss NUMBER ]\n"); + fprintf(stderr, " [ rtt NUMBER ] [ rttvar NUMBER ]\n"); + fprintf(stderr, " [ window NUMBER] [ cwnd NUMBER ] [ ssthresh NUMBER ]\n"); +- fprintf(stderr, " [ realms REALM ]\n"); ++ fprintf(stderr, " [ realms REALM ] [ hoplimit NUMBER ] [ initcwnd NUMBER ]\n"); + fprintf(stderr, "TYPE := [ unicast | local | broadcast | multicast | throw |\n"); + fprintf(stderr, " unreachable | prohibit | blackhole | nat ]\n"); + fprintf(stderr, "TABLE_ID := [ local | main | default | all | NUMBER ]\n"); +@@ -497,6 +497,8 @@ + "cwnd", + "advmss", + "reordering", ++ "hoplimit", ++ "initcwnd", + }; + static int hz; + if (mxrta[i] == NULL) +@@ -764,6 +766,30 @@ + invarg("\"reordering\" value is invalid\n", *argv); + rta_addattr32(mxrta, sizeof(mxbuf), RTAX_REORDERING, reord); + #endif ++#ifdef RTAX_HOPLIMIT ++ } else if (strcmp(*argv, "hoplimit") == 0) { ++ unsigned hoplim; ++ NEXT_ARG(); ++ if (strcmp(*argv, "lock") == 0) { ++ mxlock |= (1<<RTAX_HOPLIMIT); ++ NEXT_ARG(); ++ } ++ if (get_unsigned(&hoplim, *argv, 0)) ++ invarg("\"hoplimit\" value is invalid\n", *argv); ++ rta_addattr32(mxrta, sizeof(mxbuf), RTAX_HOPLIMIT, hoplim); ++#endif ++#ifdef RTAX_INITCWND ++ } else if (strcmp(*argv, "initcwnd") == 0) { ++ unsigned initcwnd; ++ NEXT_ARG(); ++ if (strcmp(*argv, "lock") == 0) { ++ mxlock |= (1<<RTAX_HOPLIMIT); ++ NEXT_ARG(); ++ } ++ if (get_unsigned(&initcwnd, *argv, 0)) ++ invarg("\"initcwnd\" value is invalid\n", *argv); ++ rta_addattr32(mxrta, sizeof(mxbuf), RTAX_INITCWND, initcwnd); ++#endif + } else if (strcmp(*argv, "rtt") == 0) { + unsigned rtt; + NEXT_ARG(); +diff -Nur iproute2-2.6.15-060110/ip/iptunnel.c iproute2-2.6.15-060110-owrt/ip/iptunnel.c +--- iproute2-2.6.15-060110/ip/iptunnel.c 2005-02-10 19:31:18.000000000 +0100 ++++ iproute2-2.6.15-060110-owrt/ip/iptunnel.c 2006-03-22 12:49:35.000000000 +0100 +@@ -225,7 +225,7 @@ + NEXT_ARG(); + p->i_flags |= GRE_KEY; + if (strchr(*argv, '.')) +- p->o_key = get_addr32(*argv); ++ p->i_key = get_addr32(*argv); + else { + if (get_unsigned(&uval, *argv, 0)<0) { + fprintf(stderr, "invalid value of \"ikey\"\n"); +diff -Nur iproute2-2.6.15-060110/Makefile iproute2-2.6.15-060110-owrt/Makefile +--- iproute2-2.6.15-060110/Makefile 2005-07-09 00:08:47.000000000 +0200 ++++ iproute2-2.6.15-060110-owrt/Makefile 2006-03-22 12:51:29.000000000 +0100 +@@ -32,7 +32,7 @@ + LIBNETLINK=../lib/libnetlink.a ../lib/libutil.a + + all: Config +- @for i in $(SUBDIRS); \ ++ @set -e; for i in $(SUBDIRS); \ + do $(MAKE) $(MFLAGS) -C $$i; done + + Config: +@@ -47,7 +47,7 @@ + $(DESTDIR)$(DOCDIR)/examples + install -m 0644 $(shell find examples/diffserv -maxdepth 1 -type f) \ + $(DESTDIR)$(DOCDIR)/examples/diffserv +- @for i in $(SUBDIRS) doc; do $(MAKE) -C $$i install; done ++ @set -e; for i in $(SUBDIRS) doc; do $(MAKE) -C $$i install; done + install -m 0644 $(shell find etc/iproute2 -maxdepth 1 -type f) $(DESTDIR)$(CONFDIR) + install -m 0755 -d $(DESTDIR)$(MANDIR)/man8 + install -m 0644 $(shell find man/man8 -maxdepth 1 -type f) $(DESTDIR)$(MANDIR)/man8 +@@ -58,7 +58,7 @@ + + clean: + rm -f cscope.* +- @for i in $(SUBDIRS) doc; \ ++ @set -e; for i in $(SUBDIRS) doc; \ + do $(MAKE) $(MFLAGS) -C $$i clean; done + + clobber: clean +diff -Nur iproute2-2.6.15-060110/man/man8/ip.8 iproute2-2.6.15-060110-owrt/man/man8/ip.8 +--- iproute2-2.6.15-060110/man/man8/ip.8 2006-01-03 20:25:29.000000000 +0100 ++++ iproute2-2.6.15-060110-owrt/man/man8/ip.8 2006-03-22 12:49:35.000000000 +0100 +@@ -1808,6 +1808,8 @@ + .RB "IP Command reference " ip-cref.ps + .br + .RB "IP tunnels " ip-cref.ps ++.br ++.RB http://lartc.org/ + + .SH AUTHOR + Original Manpage by Michail Litvak <mci@owl.openwall.com> +diff -Nur iproute2-2.6.15-060110/man/man8/tc.8 iproute2-2.6.15-060110-owrt/man/man8/tc.8 +--- iproute2-2.6.15-060110/man/man8/tc.8 2004-06-08 22:34:17.000000000 +0200 ++++ iproute2-2.6.15-060110-owrt/man/man8/tc.8 2006-03-22 12:49:35.000000000 +0100 +@@ -341,7 +341,7 @@ + .BR tc-pfifo (8), + .BR tc-bfifo (8), + .BR tc-pfifo_fast (8), +-.BR tc-filters (8) ++.BR http://lartc.org/ + + .SH AUTHOR + Manpage maintained by bert hubert (ahu@ds9a.nl) +diff -Nur iproute2-2.6.15-060110/misc/Makefile iproute2-2.6.15-060110-owrt/misc/Makefile +--- iproute2-2.6.15-060110/misc/Makefile 2005-06-23 19:39:57.000000000 +0200 ++++ iproute2-2.6.15-060110-owrt/misc/Makefile 2006-03-22 12:49:35.000000000 +0100 +@@ -1,7 +1,8 @@ + SSOBJ=ss.o ssfilter.o + LNSTATOBJ=lnstat.o lnstat_util.o + +-TARGETS=ss nstat ifstat rtacct arpd lnstat ++#TARGETS=ss nstat ifstat rtacct arpd lnstat ++TARGETS=ss nstat rtacct lnstat + + include ../Config + +diff -Nur iproute2-2.6.15-060110/misc/netbug iproute2-2.6.15-060110-owrt/misc/netbug +--- iproute2-2.6.15-060110/misc/netbug 2004-04-15 22:56:59.000000000 +0200 ++++ iproute2-2.6.15-060110-owrt/misc/netbug 2006-03-22 12:49:35.000000000 +0100 +@@ -1,23 +1,16 @@ + #! /bin/bash + ++set -e ++ + echo -n "Send network configuration summary to [ENTER means kuznet@ms2.inr.ac.ru] " + IFS="" read mail || exit 1 + [ -z "$mail" ] && mail=kuznet@ms2.inr.ac.ru + ++netbug=`mktemp -d -t netbug.XXXXXX` || {echo "$0: Cannot create temporary directory" >&2; exit 1; } ++netbugtar=`tempfile -d $netbug --suffix=tar.gz` || {echo "$0: Cannot create temporary file" >&2; exit 1; } ++tmppath=$netbug ++trap "/bin/rm -rf $netbug $netbugtar" 0 1 2 3 13 15 + +-netbug="" +-while [ "$netbug" = "" ]; do +- netbug=`echo netbug.$$.$RANDOM` +- if [ -e /tmp/$netbug ]; then +- netbug="" +- fi +-done +- +-tmppath=/tmp/$netbug +- +-trap "rm -rf $tmppath $tmppath.tar.gz" 0 SIGINT +- +-mkdir $tmppath + mkdir $tmppath/net + + cat /proc/slabinfo > $tmppath/slabinfo +@@ -44,9 +37,8 @@ + fi + + cd /tmp +-tar c $netbug | gzip -9c > $netbug.tar.gz +- +-uuencode $netbug.tar.gz $netbug.tar.gz | mail -s $netbug "$mail" ++tar c $tmppath | gzip -9c > $netbugtar ++uuencode $netbugtar $netbugtar | mail -s $netbug "$mail" + + echo "Sending to <$mail>; subject is $netbug" + +diff -Nur iproute2-2.6.15-060110/tc/Makefile iproute2-2.6.15-060110-owrt/tc/Makefile +--- iproute2-2.6.15-060110/tc/Makefile 2005-07-06 00:11:37.000000000 +0200 ++++ iproute2-2.6.15-060110-owrt/tc/Makefile 2006-03-22 12:49:35.000000000 +0100 +@@ -11,6 +11,7 @@ + TCMODULES += q_prio.o + TCMODULES += q_tbf.o + TCMODULES += q_cbq.o ++TCMODULES += q_wrr.o + TCMODULES += f_rsvp.o + TCMODULES += f_u32.o + TCMODULES += f_route.o +diff -Nur iproute2-2.6.15-060110/tc/q_htb.c iproute2-2.6.15-060110-owrt/tc/q_htb.c +--- iproute2-2.6.15-060110/tc/q_htb.c 2005-01-18 23:11:58.000000000 +0100 ++++ iproute2-2.6.15-060110-owrt/tc/q_htb.c 2006-03-22 12:49:35.000000000 +0100 +@@ -1,3 +1,311 @@ ++#if 0 ++/* ++ * q_htb.c HTB. ++ * ++ * 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 the Free Software Foundation; either version ++ * 2 of the License, or (at your option) any later version. ++ * ++ * Authors: Martin Devera, devik@cdi.cz ++ * ++ */ ++ ++#include <stdio.h> ++#include <stdlib.h> ++#include <unistd.h> ++#include <syslog.h> ++#include <fcntl.h> ++#include <sys/socket.h> ++#include <netinet/in.h> ++#include <arpa/inet.h> ++#include <string.h> ++ ++#include "utils.h" ++#include "tc_util.h" ++ ++#define HTB_TC_VER 0x30003 ++#if HTB_TC_VER >> 16 != TC_HTB_PROTOVER ++#error "Different kernel and TC HTB versions" ++#endif ++ ++static void explain(void) ++{ ++ fprintf(stderr, "Usage: ... qdisc add ... htb [default N] [r2q N]\n" ++ " default minor id of class to which unclassified packets are sent {0}\n" ++ " r2q DRR quantums are computed as rate in Bps/r2q {10}\n" ++ " debug string of 16 numbers each 0-3 {0}\n\n" ++ "... class add ... htb rate R1 burst B1 [prio P] [slot S] [pslot PS]\n" ++ " [ceil R2] [cburst B2] [mtu MTU] [quantum Q]\n" ++ " rate rate allocated to this class (class can still borrow)\n" ++ " burst max bytes burst which can be accumulated during idle period {computed}\n" ++ " ceil definite upper class rate (no borrows) {rate}\n" ++ " cburst burst but for ceil {computed}\n" ++ " mtu max packet size we create rate map for {1600}\n" ++ " prio priority of leaf; lower are served first {0}\n" ++ " quantum how much bytes to serve from leaf at once {use r2q}\n" ++ "\nTC HTB version %d.%d\n",HTB_TC_VER>>16,HTB_TC_VER&0xffff ++ ); ++} ++ ++static void explain1(char *arg) ++{ ++ fprintf(stderr, "Illegal \"%s\"\n", arg); ++ explain(); ++} ++ ++ ++#define usage() return(-1) ++ ++static int htb_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) ++{ ++ struct tc_htb_glob opt; ++ struct rtattr *tail; ++ unsigned i; char *p; ++ memset(&opt,0,sizeof(opt)); ++ opt.rate2quantum = 10; ++ opt.version = 3; ++ ++ while (argc > 0) { ++ if (matches(*argv, "r2q") == 0) { ++ NEXT_ARG(); ++ if (get_u32(&opt.rate2quantum, *argv, 10)) { ++ explain1("r2q"); return -1; ++ } ++ } else if (matches(*argv, "default") == 0) { ++ NEXT_ARG(); ++ if (get_u32(&opt.defcls, *argv, 16)) { ++ explain1("default"); return -1; ++ } ++ } else if (matches(*argv, "debug") == 0) { ++ NEXT_ARG(); p = *argv; ++ for (i=0; i<16; i++,p++) { ++ if (*p<'0' || *p>'3') break; ++ opt.debug |= (*p-'0')<<(2*i); ++ } ++ } else { ++ fprintf(stderr, "What is \"%s\"?\n", *argv); ++ explain(); ++ return -1; ++ } ++ argc--; argv++; ++ } ++ tail = (struct rtattr*)(((void*)n)+NLMSG_ALIGN(n->nlmsg_len)); ++ addattr_l(n, 1024, TCA_OPTIONS, NULL, 0); ++ addattr_l(n, 2024, TCA_HTB_INIT, &opt, NLMSG_ALIGN(sizeof(opt))); ++ tail->rta_len = (((void*)n)+NLMSG_ALIGN(n->nlmsg_len)) - (void*)tail; ++ return 0; ++} ++ ++static int htb_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) ++{ ++ int ok=0; ++ struct tc_htb_opt opt; ++ __u32 rtab[256],ctab[256]; ++ unsigned buffer=0,cbuffer=0; ++ int cell_log=-1,ccell_log = -1,mtu; ++ struct rtattr *tail; ++ ++ memset(&opt, 0, sizeof(opt)); mtu = 1600; /* eth packet len */ ++ ++ while (argc > 0) { ++ if (matches(*argv, "prio") == 0) { ++ NEXT_ARG(); ++ if (get_u32(&opt.prio, *argv, 10)) { ++ explain1("prio"); return -1; ++ } ++ ok++; ++ } else if (matches(*argv, "mtu") == 0) { ++ NEXT_ARG(); ++ if (get_u32(&mtu, *argv, 10)) { ++ explain1("mtu"); return -1; ++ } ++ } else if (matches(*argv, "quantum") == 0) { ++ NEXT_ARG(); ++ if (get_u32(&opt.quantum, *argv, 10)) { ++ explain1("quantum"); return -1; ++ } ++ } else if (matches(*argv, "burst") == 0 || ++ strcmp(*argv, "buffer") == 0 || ++ strcmp(*argv, "maxburst") == 0) { ++ NEXT_ARG(); ++ if (get_size_and_cell(&buffer, &cell_log, *argv) < 0) { ++ explain1("buffer"); ++ return -1; ++ } ++ ok++; ++ } else if (matches(*argv, "cburst") == 0 || ++ strcmp(*argv, "cbuffer") == 0 || ++ strcmp(*argv, "cmaxburst") == 0) { ++ NEXT_ARG(); ++ if (get_size_and_cell(&cbuffer, &ccell_log, *argv) < 0) { ++ explain1("cbuffer"); ++ return -1; ++ } ++ ok++; ++ } else if (strcmp(*argv, "ceil") == 0) { ++ NEXT_ARG(); ++ if (opt.ceil.rate) { ++ fprintf(stderr, "Double \"ceil\" spec\n"); ++ return -1; ++ } ++ if (get_rate(&opt.ceil.rate, *argv)) { ++ explain1("ceil"); ++ return -1; ++ } ++ ok++; ++ } else if (strcmp(*argv, "rate") == 0) { ++ NEXT_ARG(); ++ if (opt.rate.rate) { ++ fprintf(stderr, "Double \"rate\" spec\n"); ++ return -1; ++ } ++ if (get_rate(&opt.rate.rate, *argv)) { ++ explain1("rate"); ++ return -1; ++ } ++ ok++; ++ } else if (strcmp(*argv, "help") == 0) { ++ explain(); ++ return -1; ++ } else { ++ fprintf(stderr, "What is \"%s\"?\n", *argv); ++ explain(); ++ return -1; ++ } ++ argc--; argv++; ++ } ++ ++/* if (!ok) ++ return 0;*/ ++ ++ if (opt.rate.rate == 0) { ++ fprintf(stderr, "\"rate\" is required.\n"); ++ return -1; ++ } ++ /* if ceil params are missing, use the same as rate */ ++ if (!opt.ceil.rate) opt.ceil = opt.rate; ++ ++ /* compute minimal allowed burst from rate; mtu is added here to make ++ sute that buffer is larger than mtu and to have some safeguard space */ ++ if (!buffer) buffer = opt.rate.rate / HZ + mtu; ++ if (!cbuffer) cbuffer = opt.ceil.rate / HZ + mtu; ++ ++ if ((cell_log = tc_calc_rtable(opt.rate.rate, rtab, cell_log, mtu, 0)) < 0) { ++ fprintf(stderr, "htb: failed to calculate rate table.\n"); ++ return -1; ++ } ++ opt.buffer = tc_calc_xmittime(opt.rate.rate, buffer); ++ opt.rate.cell_log = cell_log; ++ ++ if ((ccell_log = tc_calc_rtable(opt.ceil.rate, ctab, cell_log, mtu, 0)) < 0) { ++ fprintf(stderr, "htb: failed to calculate ceil rate table.\n"); ++ return -1; ++ } ++ opt.cbuffer = tc_calc_xmittime(opt.ceil.rate, cbuffer); ++ opt.ceil.cell_log = ccell_log; ++ ++ tail = (struct rtattr*)(((void*)n)+NLMSG_ALIGN(n->nlmsg_len)); ++ addattr_l(n, 1024, TCA_OPTIONS, NULL, 0); ++ addattr_l(n, 2024, TCA_HTB_PARMS, &opt, sizeof(opt)); ++ addattr_l(n, 3024, TCA_HTB_RTAB, rtab, 1024); ++ addattr_l(n, 4024, TCA_HTB_CTAB, ctab, 1024); ++ tail->rta_len = (((void*)n)+NLMSG_ALIGN(n->nlmsg_len)) - (void*)tail; ++ return 0; ++} ++ ++static int htb_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) ++{ ++ struct rtattr *tb[TCA_HTB_RTAB+1]; ++ struct tc_htb_opt *hopt; ++ struct tc_htb_glob *gopt; ++ double buffer,cbuffer; ++ SPRINT_BUF(b1); ++ SPRINT_BUF(b2); ++ ++ if (opt == NULL) ++ return 0; ++ ++ memset(tb, 0, sizeof(tb)); ++ parse_rtattr(tb, TCA_HTB_RTAB, RTA_DATA(opt), RTA_PAYLOAD(opt)); ++ ++ if (tb[TCA_HTB_PARMS]) { ++ ++ hopt = RTA_DATA(tb[TCA_HTB_PARMS]); ++ if (RTA_PAYLOAD(tb[TCA_HTB_PARMS]) < sizeof(*hopt)) return -1; ++ ++ if (!hopt->level) { ++ fprintf(f, "prio %d ", (int)hopt->prio); ++ if (show_details) ++ fprintf(f, "quantum %d ", (int)hopt->quantum); ++ } ++ fprintf(f, "rate %s ", sprint_rate(hopt->rate.rate, b1)); ++ buffer = ((double)hopt->rate.rate*tc_core_tick2usec(hopt->buffer))/1000000; ++ fprintf(f, "ceil %s ", sprint_rate(hopt->ceil.rate, b1)); ++ cbuffer = ((double)hopt->ceil.rate*tc_core_tick2usec(hopt->cbuffer))/1000000; ++ if (show_details) { ++ fprintf(f, "burst %s/%u mpu %s ", sprint_size(buffer, b1), ++ 1<<hopt->rate.cell_log, sprint_size(hopt->rate.mpu, b2)); ++ fprintf(f, "cburst %s/%u mpu %s ", sprint_size(cbuffer, b1), ++ 1<<hopt->ceil.cell_log, sprint_size(hopt->ceil.mpu, b2)); ++ fprintf(f, "level %d ", (int)hopt->level); ++ } else { ++ fprintf(f, "burst %s ", sprint_size(buffer, b1)); ++ fprintf(f, "cburst %s ", sprint_size(cbuffer, b1)); ++ } ++ if (show_raw) ++ fprintf(f, "buffer [%08x] cbuffer [%08x] ", ++ hopt->buffer,hopt->cbuffer); ++ } ++ if (tb[TCA_HTB_INIT]) { ++ gopt = RTA_DATA(tb[TCA_HTB_INIT]); ++ if (RTA_PAYLOAD(tb[TCA_HTB_INIT]) < sizeof(*gopt)) return -1; ++ ++ fprintf(f, "r2q %d default %x direct_packets_stat %u", ++ gopt->rate2quantum,gopt->defcls,gopt->direct_pkts); ++ if (show_details) ++ fprintf(f," ver %d.%d",gopt->version >> 16,gopt->version & 0xffff); ++ } ++ return 0; ++} ++ ++static int htb_print_xstats(struct qdisc_util *qu, FILE *f, struct rtattr *xstats) ++{ ++ struct tc_htb_xstats *st; ++ if (xstats == NULL) ++ return 0; ++ ++ if (RTA_PAYLOAD(xstats) < sizeof(*st)) ++ return -1; ++ ++ st = RTA_DATA(xstats); ++ fprintf(f, " lended: %u borrowed: %u giants: %u\n", ++ st->lends,st->borrows,st->giants); ++ fprintf(f, " tokens: %d ctokens: %d\n", st->tokens,st->ctokens); ++ return 0; ++} ++ ++struct qdisc_util htb_util = { ++ NULL, ++ "htb", ++ htb_parse_opt, ++ htb_print_opt, ++ htb_print_xstats, ++ htb_parse_class_opt, ++ htb_print_opt, ++}; ++ ++/* for testing of old one */ ++struct qdisc_util htb2_util = { ++ NULL, ++ "htb2", ++ htb_parse_opt, ++ htb_print_opt, ++ htb_print_xstats, ++ htb_parse_class_opt, ++ htb_print_opt, ++}; ++#endif + /* + * q_htb.c HTB. + * +diff -Nur iproute2-2.6.15-060110/tc/q_wrr.c iproute2-2.6.15-060110-owrt/tc/q_wrr.c +--- iproute2-2.6.15-060110/tc/q_wrr.c 1970-01-01 01:00:00.000000000 +0100 ++++ iproute2-2.6.15-060110-owrt/tc/q_wrr.c 2006-03-22 12:49:35.000000000 +0100 +@@ -0,0 +1,322 @@ ++#include <stdio.h> ++#include <stdlib.h> ++#include <unistd.h> ++#include <syslog.h> ++#include <fcntl.h> ++#include <sys/socket.h> ++#include <netinet/in.h> ++#include <arpa/inet.h> ++#include <string.h> ++#include <math.h> ++ ++#include "utils.h" ++#include "tc_util.h" ++ ++#define usage() return(-1) ++ ++// Returns -1 on error ++static int wrr_parse_qdisc_weight(int argc, char** argv, ++ struct tc_wrr_qdisc_modf* opt) { ++ int i; ++ ++ opt->weight1.weight_mode=-1; ++ opt->weight2.weight_mode=-1; ++ ++ for(i=0; i<argc; i++) { ++ if(!memcmp(argv[i],"wmode1=",7)) { ++ opt->weight1.weight_mode=atoi(argv[i]+7); ++ } else if(!memcmp(argv[i],"wmode2=",7)) { ++ opt->weight2.weight_mode=atoi(argv[i]+7); ++ } else { ++ printf("Usage: ... [wmode1=0|1|2|3] [wmode2=0|1|2|3]\n"); ++ return -1; ++ } ++ } ++ return 0; ++} ++ ++static int wrr_parse_class_modf(int argc, char** argv, ++ struct tc_wrr_class_modf* modf) { ++ int i; ++ ++ if(argc<1) { ++ fprintf(stderr, "Usage: ... [weight1=val] [decr1=val] [incr1=val] [min1=val] [max1=val] [val2=val] ...\n"); ++ fprintf(stderr, " The values can be floating point like 0.42 or divisions like 42/100\n"); ++ return -1; ++ } ++ ++ // Set meaningless values: ++ modf->weight1.val=0; ++ modf->weight1.decr=(__u64)-1; ++ modf->weight1.incr=(__u64)-1; ++ modf->weight1.min=0; ++ modf->weight1.max=0; ++ modf->weight2.val=0; ++ modf->weight2.decr=(__u64)-1; ++ modf->weight2.incr=(__u64)-1; ++ modf->weight2.min=0; ++ modf->weight2.max=0; ++ ++ // And read values: ++ for(i=0; i<argc; i++) { ++ char arg[80]; ++ char* name,*value1=0,*value2=0; ++ long double f_val1,f_val2=1,value; ++ if(strlen(argv[i])>=sizeof(arg)) { ++ fprintf(stderr,"Argument too long: %s\n",argv[i]); ++ return -1; ++ } ++ strcpy(arg,argv[i]); ++ ++ name=strtok(arg,"="); ++ if(name) value1=strtok(0,"/"); ++ if(value1) value2=strtok(0,""); ++ ++ if(!value1) { ++ fprintf(stderr,"No = found in argument: %s\n",argv[i]); ++ return -1; ++ } ++ ++ f_val1=atof(value1); ++ if(value2) f_val2=atof(value2); ++ ++ if(f_val2==0) { ++ fprintf(stderr,"Division by 0\n"); ++ return -1; ++ } ++ ++ value=f_val1/f_val2; ++ if(value>1) value=1; ++ if(value<0) value=0; ++ value*=((__u64)-1); ++ ++ // And find the value set ++ if(!strcmp(name,"weight1")) modf->weight1.val=value; ++ else if(!strcmp(name,"decr1")) modf->weight1.decr=value; ++ else if(!strcmp(name,"incr1")) modf->weight1.incr=value; ++ else if(!strcmp(name,"min1")) modf->weight1.min=value; ++ else if(!strcmp(name,"max1")) modf->weight1.max=value; ++ else if(!strcmp(name,"weight2")) modf->weight2.val=value; ++ else if(!strcmp(name,"decr2")) modf->weight2.decr=value; ++ else if(!strcmp(name,"incr2")) modf->weight2.incr=value; ++ else if(!strcmp(name,"min2")) modf->weight2.min=value; ++ else if(!strcmp(name,"max2")) modf->weight2.max=value; ++ else { ++ fprintf(stderr,"illegal value: %s\n",name); ++ return -1; ++ } ++ } ++ ++ return 0; ++} ++ ++static int wrr_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) ++{ ++ if(n->nlmsg_flags & NLM_F_CREATE) { ++ // This is a create request: ++ struct tc_wrr_qdisc_crt opt; ++ ++ int sour,dest,ip,mac,masq; ++ ++ if(argc<4) { ++ fprintf(stderr, "Usage: ... wrr sour|dest ip|masq|mac maxclasses proxymaxcon [penalty-setup]\n"); ++ return -1; ++ } ++ ++ // Read sour/dest: ++ memset(&opt,0,sizeof(opt)); ++ sour=!strcmp(argv[0],"sour"); ++ dest=!strcmp(argv[0],"dest"); ++ ++ if(!sour && !dest) { ++ fprintf(stderr,"sour or dest must be specified\n"); ++ return -1; ++ } ++ ++ // Read ip/mac ++ ip=!strcmp(argv[1],"ip"); ++ mac=!strcmp(argv[1],"mac"); ++ masq=!strcmp(argv[1],"masq"); ++ ++ if(!ip && !mac && !masq) { ++ fprintf(stderr,"ip, masq or mac must be specified\n"); ++ return -1; ++ } ++ ++ opt.srcaddr=sour; ++ opt.usemac=mac; ++ opt.usemasq=masq; ++ opt.bands_max=atoi(argv[2]); ++ ++ opt.proxy_maxconn=atoi(argv[3]); ++ ++ // Read weights: ++ if(wrr_parse_qdisc_weight(argc-4,argv+4,&opt.qdisc_modf)<0) return -1; ++ if(opt.qdisc_modf.weight1.weight_mode==-1) opt.qdisc_modf.weight1.weight_mode=0; ++ if(opt.qdisc_modf.weight2.weight_mode==-1) opt.qdisc_modf.weight2.weight_mode=0; ++ ++ addattr_l(n, 1024, TCA_OPTIONS, &opt, sizeof(opt)); ++ } else { ++ struct tc_wrr_qdisc_modf_std opt; ++ char qdisc,class; ++ ++ // This is a modify request: ++ if(argc<1) { ++ fprintf(stderr,"... qdisc ... or ... class ...\n"); ++ return -1; ++ } ++ ++ qdisc=!strcmp(argv[0],"qdisc"); ++ class=!strcmp(argv[0],"class"); ++ ++ if(!qdisc && !class) { ++ fprintf(stderr,"qdisc or class must be specified\n"); ++ return -1; ++ } ++ ++ argc--; ++ argv++; ++ ++ opt.proxy=0; ++ ++ if(qdisc) { ++ opt.change_class=0; ++ if(wrr_parse_qdisc_weight(argc, argv, &opt.qdisc_modf)<0) return -1; ++ } else { ++ int a0,a1,a2,a3,a4=0,a5=0; ++ ++ opt.change_class=1; ++ ++ if(argc<1) { ++ fprintf(stderr,"... <mac>|<ip>|<masq> ...\n"); ++ return -1; ++ } ++ memset(opt.addr,0,sizeof(opt.addr)); ++ ++ if((sscanf(argv[0],"%i.%i.%i.%i",&a0,&a1,&a2,&a3)!=4) && ++ (sscanf(argv[0],"%x:%x:%x:%x:%x:%x",&a0,&a1,&a2,&a3,&a4,&a5)!=6)) { ++ fprintf(stderr,"Wrong format of mac or ip address\n"); ++ return -1; ++ } ++ ++ opt.addr[0]=a0; opt.addr[1]=a1; opt.addr[2]=a2; ++ opt.addr[3]=a3; opt.addr[4]=a4; opt.addr[5]=a5; ++ ++ if(wrr_parse_class_modf(argc-1, argv+1, &opt.class_modf)<0) return -1; ++ } ++ ++ addattr_l(n, 1024, TCA_OPTIONS, &opt, sizeof(opt)); ++ } ++ return 0; ++} ++ ++static int wrr_parse_copt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) { ++ struct tc_wrr_class_modf opt; ++ ++ memset(&opt,0,sizeof(opt)); ++ if(wrr_parse_class_modf(argc,argv,&opt)<0) return -1; ++ ++ addattr_l(n, 1024, TCA_OPTIONS, &opt, sizeof(opt)); ++ return 0; ++} ++ ++static int wrr_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) ++{ ++ struct tc_wrr_qdisc_stats *qopt; ++ ++ if (opt == NULL) ++ return 0; ++ ++ if (RTA_PAYLOAD(opt) < sizeof(*qopt)) ++ return -1; ++ qopt = RTA_DATA(opt); ++ ++ fprintf(f,"\n (%s/%s) (maxclasses %i) (usedclasses %i) (reused classes %i)\n", ++ qopt->qdisc_crt.srcaddr ? "sour" : "dest", ++ qopt->qdisc_crt.usemac ? "mac" : (qopt->qdisc_crt.usemasq ? "masq" : "ip"), ++ qopt->qdisc_crt.bands_max, ++ qopt->bands_cur, ++ qopt->bands_reused ++ ); ++ ++ if(qopt->qdisc_crt.proxy_maxconn) { ++ fprintf(f," (proxy maxcon %i) (proxy curcon %i)\n", ++ qopt->qdisc_crt.proxy_maxconn,qopt->proxy_curconn); ++ } ++ ++ fprintf(f," (waiting classes %i) (packets requeued %i) (priosum: %Lg)\n", ++ qopt->nodes_in_heap, ++ qopt->packets_requed, ++ qopt->priosum/((long double)((__u32)-1)) ++ ); ++ ++ fprintf(f," (wmode1 %i) (wmode2 %i) \n", ++ qopt->qdisc_crt.qdisc_modf.weight1.weight_mode, ++ qopt->qdisc_crt.qdisc_modf.weight2.weight_mode); ++ ++ return 0; ++} ++ ++static int wrr_print_copt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) { ++ struct tc_wrr_class_stats *copt; ++ long double d=(__u64)-1; ++ ++ if (opt == NULL) return 0; ++ ++ if (RTA_PAYLOAD(opt) < sizeof(*copt)) ++ return -1; ++ copt = RTA_DATA(opt); ++ ++ if(!copt->used) { ++ fprintf(f,"(unused)"); ++ return 0; ++ } ++ ++ if(copt->usemac) { ++ fprintf(f,"\n (address: %.2X:%.2X:%.2X:%.2X:%.2X:%.2X)\n", ++ copt->addr[0],copt->addr[1],copt->addr[2], ++ copt->addr[3],copt->addr[4],copt->addr[5]); ++ } else { ++ fprintf(f,"\n (address: %i.%i.%i.%i)\n",copt->addr[0],copt->addr[1],copt->addr[2],copt->addr[3]); ++ } ++ ++ fprintf(f," (total weight: %Lg) (current position: %i) (counters: %u %u : %u %u)\n", ++ (copt->class_modf.weight1.val/d)*(copt->class_modf.weight2.val/d), ++ copt->heappos, ++ (unsigned)(copt->penal_ms>>32), ++ (unsigned)(copt->penal_ms & 0xffffffffU), ++ (unsigned)(copt->penal_ls>>32), ++ (unsigned)(copt->penal_ls & 0xffffffffU) ++ ); ++ ++ fprintf(f," Pars 1: (weight %Lg) (decr: %Lg) (incr: %Lg) (min: %Lg) (max: %Lg)\n", ++ copt->class_modf.weight1.val/d, ++ copt->class_modf.weight1.decr/d, ++ copt->class_modf.weight1.incr/d, ++ copt->class_modf.weight1.min/d, ++ copt->class_modf.weight1.max/d); ++ ++ fprintf(f," Pars 2: (weight %Lg) (decr: %Lg) (incr: %Lg) (min: %Lg) (max: %Lg)", ++ copt->class_modf.weight2.val/d, ++ copt->class_modf.weight2.decr/d, ++ copt->class_modf.weight2.incr/d, ++ copt->class_modf.weight2.min/d, ++ copt->class_modf.weight2.max/d); ++ ++ return 0; ++} ++ ++static int wrr_print_xstats(struct qdisc_util *qu, FILE *f, struct rtattr *xstats) ++{ ++ return 0; ++} ++ ++ ++struct qdisc_util wrr_qdisc_util = { ++ .id = "wrr", ++ .parse_qopt = wrr_parse_opt, ++ .print_qopt = wrr_print_opt, ++ .print_xstats = wrr_print_xstats, ++ .parse_copt = wrr_parse_copt, ++ .print_copt = wrr_print_copt ++}; diff --git a/package/iproute2/patches/001-iproute2-2.6.11_Config.patch b/package/iproute2/patches/001-iproute2-2.6.11_Config.patch new file mode 100644 index 0000000000..c1491f455f --- /dev/null +++ b/package/iproute2/patches/001-iproute2-2.6.11_Config.patch @@ -0,0 +1,8 @@ +diff -ruN iproute2-2.6.9-old/Config iproute2-2.6.9-new/Config +--- iproute2-2.6.9-old/Config 1970-01-01 01:00:00.000000000 +0100 ++++ iproute2-2.6.9-new/Config 2005-03-22 23:56:56.000000000 +0100 +@@ -0,0 +1,4 @@ ++# Fixed config to disable ATM support even if present on host system ++TC_CONFIG_ATM:=n ++TC_CONFIG_ACTION_GACT=y ++TC_CONFIG_ACTION_PROB=y diff --git a/package/iproute2/patches/002-iproute2-ipxfrm_no_sctp.patch b/package/iproute2/patches/002-iproute2-ipxfrm_no_sctp.patch new file mode 100644 index 0000000000..34eaeb0553 --- /dev/null +++ b/package/iproute2/patches/002-iproute2-ipxfrm_no_sctp.patch @@ -0,0 +1,19 @@ +diff -Nur iproute2-2.6.11-050330/ip/ipxfrm.c iproute2-2.6.11-050330.new/ip/ipxfrm.c +--- iproute2-2.6.11-050330/ip/ipxfrm.c 2005-04-01 21:58:11.000000000 +0200 ++++ iproute2-2.6.11-050330.new/ip/ipxfrm.c 2005-05-27 12:27:44.000000000 +0200 +@@ -444,7 +444,6 @@ + switch (sel->proto) { + case IPPROTO_TCP: + case IPPROTO_UDP: +- case IPPROTO_SCTP: + default: /* XXX */ + if (sel->sport_mask) + fprintf(fp, "sport %u ", ntohs(sel->sport)); +@@ -998,7 +997,6 @@ + switch (sel->proto) { + case IPPROTO_TCP: + case IPPROTO_UDP: +- case IPPROTO_SCTP: + break; + default: + fprintf(stderr, "\"sport\" and \"dport\" are invalid with proto=%s\n", strxf_proto(sel->proto)); diff --git a/package/iproute2/patches/003-iproute2-htb_overhead.patch b/package/iproute2/patches/003-iproute2-htb_overhead.patch new file mode 100644 index 0000000000..77ab983835 --- /dev/null +++ b/package/iproute2/patches/003-iproute2-htb_overhead.patch @@ -0,0 +1,96 @@ +--- iproute2-2.6.11-050330.new/tc/q_htb.c Sun May 12 22:18:27 2002 ++++ iproute2-2.6.11-050330.new/tc/q_htb.c Sat Oct 18 00:05:18 2003 +@@ -34,10 +34,14 @@ + " default minor id of class to which unclassified packets are sent {0}\n" + " r2q DRR quantums are computed as rate in Bps/r2q {10}\n" + " debug string of 16 numbers each 0-3 {0}\n\n" +- "... class add ... htb rate R1 burst B1 [prio P] [slot S] [pslot PS]\n" ++ "... class add ... htb rate R1 [burst B1] [mpu B] [overhead O]\n" ++ " [prio P] [slot S] [pslot PS]\n" + " [ceil R2] [cburst B2] [mtu MTU] [quantum Q]\n" + " rate rate allocated to this class (class can still borrow)\n" + " burst max bytes burst which can be accumulated during idle period {computed}\n" ++ " mpu minimum packet size used in rate computations\n" ++ " overhead per-packet size overhead used in rate computations\n" ++ + " ceil definite upper class rate (no borrows) {rate}\n" + " cburst burst but for ceil {computed}\n" + " mtu max packet size we create rate map for {1600}\n" +@@ -102,7 +106,9 @@ + struct tc_htb_opt opt; + __u32 rtab[256],ctab[256]; + unsigned buffer=0,cbuffer=0; +- int cell_log=-1,ccell_log = -1,mtu; ++ int cell_log=-1,ccell_log = -1; ++ unsigned mtu, mpu; ++ unsigned char mpu8 = 0, overhead = 0; + struct rtattr *tail; + + memset(&opt, 0, sizeof(opt)); mtu = 1600; /* eth packet len */ +@@ -119,6 +125,16 @@ + if (get_u32(&mtu, *argv, 10)) { + explain1("mtu"); return -1; + } ++ } else if (matches(*argv, "mpu") == 0) { ++ NEXT_ARG(); ++ if (get_u8(&mpu8, *argv, 10)) { ++ explain1("mpu"); return -1; ++ } ++ } else if (matches(*argv, "overhead") == 0) { ++ NEXT_ARG(); ++ if (get_u8(&overhead, *argv, 10)) { ++ explain1("overhead"); return -1; ++ } + } else if (matches(*argv, "quantum") == 0) { + NEXT_ARG(); + if (get_u32(&opt.quantum, *argv, 10)) { +@@ -190,14 +206,18 @@ + if (!buffer) buffer = opt.rate.rate / HZ + mtu; + if (!cbuffer) cbuffer = opt.ceil.rate / HZ + mtu; + +- if ((cell_log = tc_calc_rtable(opt.rate.rate, rtab, cell_log, mtu, 0)) < 0) { ++/* encode overhead and mpu, 8 bits each, into lower 16 bits */ ++ mpu = (unsigned)mpu8 | (unsigned)overhead << 8; ++ opt.ceil.mpu = mpu; opt.rate.mpu = mpu; ++ ++ if ((cell_log = tc_calc_rtable(opt.rate.rate, rtab, cell_log, mtu, mpu)) < 0) { + fprintf(stderr, "htb: failed to calculate rate table.\n"); + return -1; + } + opt.buffer = tc_calc_xmittime(opt.rate.rate, buffer); + opt.rate.cell_log = cell_log; + +- if ((ccell_log = tc_calc_rtable(opt.ceil.rate, ctab, cell_log, mtu, 0)) < 0) { ++ if ((ccell_log = tc_calc_rtable(opt.ceil.rate, ctab, cell_log, mtu, mpu)) < 0) { + fprintf(stderr, "htb: failed to calculate ceil rate table.\n"); + return -1; + } +@@ -221,6 +241,7 @@ + double buffer,cbuffer; + SPRINT_BUF(b1); + SPRINT_BUF(b2); ++ SPRINT_BUF(b3); + + if (opt == NULL) + return 0; +@@ -243,10 +264,16 @@ + fprintf(f, "ceil %s ", sprint_rate(hopt->ceil.rate, b1)); + cbuffer = ((double)hopt->ceil.rate*tc_core_tick2usec(hopt->cbuffer))/1000000; + if (show_details) { +- fprintf(f, "burst %s/%u mpu %s ", sprint_size(buffer, b1), +- 1<<hopt->rate.cell_log, sprint_size(hopt->rate.mpu, b2)); +- fprintf(f, "cburst %s/%u mpu %s ", sprint_size(cbuffer, b1), +- 1<<hopt->ceil.cell_log, sprint_size(hopt->ceil.mpu, b2)); ++ fprintf(f, "burst %s/%u mpu %s overhead %s ", ++ sprint_size(buffer, b1), ++ 1<<hopt->rate.cell_log, ++ sprint_size(hopt->rate.mpu&0xFF, b2), ++ sprint_size((hopt->rate.mpu>>8)&0xFF, b3)); ++ fprintf(f, "cburst %s/%u mpu %s overhead %s ", ++ sprint_size(cbuffer, b1), ++ 1<<hopt->ceil.cell_log, ++ sprint_size(hopt->ceil.mpu&0xFF, b2), ++ sprint_size((hopt->ceil.mpu>>8)&0xFF, b3)); + fprintf(f, "level %d ", (int)hopt->level); + } else { + fprintf(f, "burst %s ", sprint_size(buffer, b1)); diff --git a/package/ipsec-tools/Makefile b/package/ipsec-tools/Makefile new file mode 100644 index 0000000000..2ae6b27eb5 --- /dev/null +++ b/package/ipsec-tools/Makefile @@ -0,0 +1,99 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=ipsec-tools +PKG_VERSION:=0.6.4 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=@SF/ipsec-tools +PKG_MD5SUM:=d0242a943c82c0cbf28005966ff35e21 +PKG_CAT:=bzcat + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/kernel.mk + +define Package/ipsec-tools + SECTION:=net + CATEGORY:=Network + DEPENDS:=@LINUX_2_6 +libopenssl + TITLE:=IPsec management tools + URL:=http://ipsec-tools.sourceforge.net/ +endef + +define Build/Configure + (cd $(PKG_BUILD_DIR); rm -f config.cache; \ + touch configure.ac; \ + touch aclocal.m4; \ + touch Makefile.in; \ + touch config.h.in; \ + touch configure; \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS)" \ + CPPFLAGS="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \ + LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --program-prefix="" \ + --program-suffix="" \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --datadir=/usr/share \ + --includedir=/usr/include \ + --infodir=/usr/share/info \ + --libdir=/usr/lib \ + --libexecdir=/usr/lib \ + --localstatedir=/var \ + --mandir=/usr/share/man \ + --sbindir=/usr/sbin \ + --sysconfdir=/etc \ + $(DISABLE_LARGEFILE) \ + $(DISABLE_NLS) \ + --enable-shared \ + --enable-static \ + --disable-rpath \ + --with-gnu-ld \ + --with-kernel-headers="$(LINUX_DIR)/include" \ + --without-readline \ + --with-openssl="$(STAGING_DIR)/usr" \ + --without-libradius \ + --without-libpam \ + --enable-dpd \ + --enable-natt \ + ); +endef + +define Build/Compile + $(call Build/Compile/Default, \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + all install \ + ) +endef + +define Package/ipsec-tools/install + install -d -m0755 $(1)/etc + install -m0600 $(PKG_BUILD_DIR)/src/racoon/samples/racoon.conf $(1)/etc/ + install -d -m0755 $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libipsec.so.* $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libracoon.so.* $(1)/usr/lib/ + install -d -m0755 $(1)/usr/sbin + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/plainrsa-gen $(1)/usr/sbin/ + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/racoon $(1)/usr/sbin/ + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/racoonctl $(1)/usr/sbin/ + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/setkey $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,ipsec-tools)) diff --git a/package/ipsec-tools/patches/01-no_libfl.patch b/package/ipsec-tools/patches/01-no_libfl.patch new file mode 100644 index 0000000000..c842e229ed --- /dev/null +++ b/package/ipsec-tools/patches/01-no_libfl.patch @@ -0,0 +1,24 @@ +diff -ruN ipsec-tools-0.6.3-old/src/racoon/cftoken.l ipsec-tools-0.6.3-new/src/racoon/cftoken.l +--- ipsec-tools-0.6.3-old/src/racoon/cftoken.l 2005-11-06 18:18:26.000000000 +0100 ++++ ipsec-tools-0.6.3-new/src/racoon/cftoken.l 2005-12-09 01:27:27.000000000 +0100 +@@ -105,6 +105,8 @@ + static int incstackp = 0; + + static int yy_first_time = 1; ++ ++int yywrap(void) { return 1; } + %} + + /* common seciton */ +diff -ruN ipsec-tools-0.6.3-old/src/setkey/token.l ipsec-tools-0.6.3-new/src/setkey/token.l +--- ipsec-tools-0.6.3-old/src/setkey/token.l 2005-06-29 15:01:30.000000000 +0200 ++++ ipsec-tools-0.6.3-new/src/setkey/token.l 2005-12-09 01:27:31.000000000 +0100 +@@ -84,6 +84,8 @@ + #ifndef SADB_X_EALG_AESCTR + #define SADB_X_EALG_AESCTR (-1) + #endif ++ ++int yywrap(void) { return 1; } + %} + + /* common section */ diff --git a/package/ipsec-tools/patches/02-configure_cppflags_typo.patch b/package/ipsec-tools/patches/02-configure_cppflags_typo.patch new file mode 100644 index 0000000000..f725ebdeed --- /dev/null +++ b/package/ipsec-tools/patches/02-configure_cppflags_typo.patch @@ -0,0 +1,24 @@ +diff -ruN ipsec-tools-0.6.3-old/configure.ac ipsec-tools-0.6.3-new/configure.ac +--- ipsec-tools-0.6.3-old/configure.ac 2005-11-21 12:11:41.000000000 +0100 ++++ ipsec-tools-0.6.3-new/configure.ac 2005-12-09 02:09:06.000000000 +0100 +@@ -180,7 +180,7 @@ + + if test "x$crypto_dir" != "x"; then + LIBS="$LIBS -L${crypto_dir}/lib" +- CPPFLAGS="-I${crypto_dir}/include $CPPLAGS" ++ CPPFLAGS="-I${crypto_dir}/include $CPPFLAGS" + fi + AC_MSG_CHECKING(openssl version) + +diff -ruN ipsec-tools-0.6.3-old/configure ipsec-tools-0.6.3-new/configure +--- ipsec-tools-0.6.3-old/configure 2005-11-21 12:15:12.000000000 +0100 ++++ ipsec-tools-0.6.3-new/configure 2005-12-09 02:09:13.000000000 +0100 +@@ -23680,7 +23680,7 @@ + + if test "x$crypto_dir" != "x"; then + LIBS="$LIBS -L${crypto_dir}/lib" +- CPPFLAGS="-I${crypto_dir}/include $CPPLAGS" ++ CPPFLAGS="-I${crypto_dir}/include $CPPFLAGS" + fi + echo "$as_me:$LINENO: checking openssl version" >&5 + echo $ECHO_N "checking openssl version... $ECHO_C" >&6 diff --git a/package/ipset/Makefile b/package/ipset/Makefile new file mode 100644 index 0000000000..f78ab77a05 --- /dev/null +++ b/package/ipset/Makefile @@ -0,0 +1,45 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ +# +include $(TOPDIR)/rules.mk + +PKG_NAME:=ipset +PKG_VERSION:=2.2.3 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-20050914.tar.bz2 +PKG_SOURCE_URL:=http://ipset.netfilter.org +PKG_MD5SUM:=1709424cc2cdb925d4fb6fd5fcaefc26 +PKG_CAT:=bzcat + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/ipset + SECTION:=net + CATEGORY:=Network + TITLE:=Netfilter ip sets administration utility + URL:=http://ipset.netfilter.org/ +endef + +define Build/Compile + $(call Build/Compile/Default, \ + KERNEL_DIR="$(LINUX_DIR)" \ + ) +endef + +define Package/ipset/install + $(MAKE) -C $(PKG_BUILD_DIR) \ + DESTDIR="$(1)" \ + PREFIX="/usr" \ + install + rm -rf $(1)/usr/man +endef + +$(eval $(call BuildPackage,ipset)) diff --git a/package/ipset/patches/kernel26.patch b/package/ipset/patches/kernel26.patch new file mode 100644 index 0000000000..46112ab25f --- /dev/null +++ b/package/ipset/patches/kernel26.patch @@ -0,0 +1,66 @@ +diff -Nur ipset-2.2.3.orig/ipset.c ipset-2.2.3/ipset.c +--- ipset-2.2.3.orig/ipset.c 2005-04-05 09:56:02.000000000 +0200 ++++ ipset-2.2.3/ipset.c 2005-09-29 13:07:07.446923250 +0200 +@@ -21,7 +21,6 @@ + #include <stdarg.h> + #include <netdb.h> + #include <dlfcn.h> +-#include <asm/bitops.h> + + #include "ipset.h" + +diff -Nur ipset-2.2.3.orig/ipset_iphash.c ipset-2.2.3/ipset_iphash.c +--- ipset-2.2.3.orig/ipset_iphash.c 2005-01-19 14:38:57.000000000 +0100 ++++ ipset-2.2.3/ipset_iphash.c 2005-09-29 13:07:26.308102000 +0200 +@@ -25,7 +25,6 @@ + #include <sys/types.h> + #include <netinet/in.h> + #include <arpa/inet.h> +-#include <asm/bitops.h> + #include <asm/types.h> + + #include <linux/netfilter_ipv4/ip_set_iphash.h> +diff -Nur ipset-2.2.3.orig/ipset_ipmap.c ipset-2.2.3/ipset_ipmap.c +--- ipset-2.2.3.orig/ipset_ipmap.c 2005-01-19 14:38:57.000000000 +0100 ++++ ipset-2.2.3/ipset_ipmap.c 2005-09-29 13:07:07.446923250 +0200 +@@ -22,7 +22,6 @@ + #include <sys/socket.h> + #include <netinet/in.h> + #include <arpa/inet.h> +-#include <asm/bitops.h> + + #include <linux/netfilter_ipv4/ip_set_ipmap.h> + #include "ipset.h" +diff -Nur ipset-2.2.3.orig/ipset_macipmap.c ipset-2.2.3/ipset_macipmap.c +--- ipset-2.2.3.orig/ipset_macipmap.c 2005-01-19 14:38:57.000000000 +0100 ++++ ipset-2.2.3/ipset_macipmap.c 2005-09-29 13:07:07.446923250 +0200 +@@ -24,7 +24,6 @@ + #include <sys/socket.h> + #include <netinet/in.h> + #include <arpa/inet.h> +-#include <asm/bitops.h> + #include <linux/if_ether.h> + + #include <linux/netfilter_ipv4/ip_set_macipmap.h> +diff -Nur ipset-2.2.3.orig/ipset_nethash.c ipset-2.2.3/ipset_nethash.c +--- ipset-2.2.3.orig/ipset_nethash.c 2005-05-09 07:44:25.000000000 +0200 ++++ ipset-2.2.3/ipset_nethash.c 2005-09-29 13:07:07.446923250 +0200 +@@ -25,7 +25,6 @@ + #include <sys/types.h> + #include <netinet/in.h> + #include <arpa/inet.h> +-#include <asm/bitops.h> + #include <asm/types.h> + + #include <linux/netfilter_ipv4/ip_set_nethash.h> +diff -Nur ipset-2.2.3.orig/ipset_portmap.c ipset-2.2.3/ipset_portmap.c +--- ipset-2.2.3.orig/ipset_portmap.c 2005-01-19 14:38:57.000000000 +0100 ++++ ipset-2.2.3/ipset_portmap.c 2005-09-29 13:07:07.446923250 +0200 +@@ -21,7 +21,6 @@ + #include <sys/socket.h> + #include <netinet/in.h> + #include <arpa/inet.h> +-#include <asm/bitops.h> + + #include <linux/netfilter_ipv4/ip_set_portmap.h> + #include "ipset.h" diff --git a/package/iptables/Makefile b/package/iptables/Makefile new file mode 100644 index 0000000000..d198a9271a --- /dev/null +++ b/package/iptables/Makefile @@ -0,0 +1,249 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=iptables +PKG_VERSION:=1.3.5 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=http://www.netfilter.org/projects/iptables/files \ + ftp://ftp.be.netfilter.org/pub/netfilter/iptables/ \ + ftp://ftp.de.netfilter.org/pub/netfilter/iptables/ \ + ftp://ftp.no.netfilter.org/pub/netfilter/iptables/ +PKG_MD5SUM:=00fb916fa8040ca992a5ace56d905ea5 +PKG_CAT:=bzcat + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install + +include $(INCLUDE_DIR)/package.mk +ifeq ($(DUMP),) + -include $(LINUX_DIR)/.config + include $(INCLUDE_DIR)/netfilter.mk +endif + +define Package/iptables/Default + SECTION:=net + CATEGORY:=Base system + URL:=http://netfilter.org/ +endef + +define Package/iptables + $(call Package/iptables/Default) + DEFAULT:=y + TITLE:=IPv4 firewall administration tool + MENU:=1 +endef + +define Package/iptables/conffiles +/etc/config/firewall +/etc/firewall.user +endef + +define Package/iptables-mod-conntrack + $(call Package/iptables/Default) + DEPENDS:=iptables +kmod-ipt-conntrack + TITLE:=connection tracking modules + DESCRIPTION:=\ + iptables extensions for connection tracking.\\\ + \\\ + Includes: \\\ + - libipt_conntrack \\\ + - libipt_helper \\\ + - libipt_connmark/CONNMARK +endef + +define Package/iptables-mod-filter + $(call Package/iptables/Default) + DEPENDS:=iptables +kmod-ipt-filter + TITLE:=filter modules + DESCRIPTION:=\ + iptables extensions for packet content inspection.\\\ + \\\ + Includes: \\\ + - libipt_ipp2p \\\ + - libipt_layer7 +endef + +define Package/iptables-mod-imq + $(call Package/iptables/Default) + DEPENDS:=iptables + TITLE:=IMQ support + DESCRIPTION:=\ + iptables extension for IMQ support.\\\ + \\\ + Includes: \\\ + - libipt_IMQ +endef + +define Package/iptables-mod-ipopt + $(call Package/iptables/Default) + DEPENDS:=iptables +kmod-ipt-ipopt + TITLE:=IP/Packet option modules + DESCRIPTION:=\ + iptables extensions for matching/changing IP packet options.\\\ + \\\ + Includes: \\\ + - libipt_dscp/DSCP \\\ + - libipt_ecn/ECN \\\ + - libipt_length \\\ + - libipt_mac \\\ + - libipt_tos/TOS \\\ + - libipt_tcpmms \\\ + - libipt_ttl/TTL \\\ + - libipt_unclean +endef + +define Package/iptables-mod-ipsec + $(call Package/iptables/Default) + DEPENDS:=iptables +kmod-ipt-ipsec + TITLE:=IPSec extensions + DESCRIPTION:=\ + iptables extensions for matching ipsec traffic.\\\ + \\\ + Includes: \\\ + - libipt_ah \\\ + - libipt_esp +endef + +define Package/iptables-mod-nat + $(call Package/iptables/Default) + DEPENDS:=iptables +kmod-ipt-nat + TITLE:=extra NAT targets + DESCRIPTION:=\ + iptables extensions for different NAT targets.\\\ + \\\ + Includes: \\\ + - libipt_REDIRECT +endef + +define Package/iptables-mod-ulog + $(call Package/iptables/Default) + DEPENDS:=iptables +kmod-ipt-ulog + TITLE:=user-space packet logging + DESCRIPTION:=\ + iptables extensions for user-space packet logging.\\\ + \\\ + Includes: \\\ + - libipt_ULOG +endef + +define Package/iptables-mod-extra + $(call Package/iptables/Default) + DEPENDS:=iptables +kmod-ipt-extra + TITLE:=other extra iptables extensions + DESCRIPTION:=\ + other extra iptables extensions.\\\ + \\\ + Includes: \\\ + - libipt_limit \\\ + - libipt_owner \\\ + - libipt_physdev \\\ + - libipt_pkttype \\\ + - libipt_recent +endef + +define Package/iptables-utils + $(call Package/iptables/Default) + DEPENDS:=iptables + TITLE:=iptables save and restore utilities +endef + +define Package/ip6tables + $(call Package/iptables/Default) + CATEGORY:=Network + TITLE:=IPv6 firewall administration tool +endef + +define Build/Configure +endef + +define Build/Compile + chmod a+x $(PKG_BUILD_DIR)/extensions/.*-test* + mkdir -p $(PKG_INSTALL_DIR) + $(MAKE) -C $(PKG_BUILD_DIR) \ + $(TARGET_CONFIGURE_OPTS) \ + COPT_FLAGS="$(TARGET_CFLAGS)" \ + KERNEL_DIR="$(LINUX_DIR)" PREFIX=/usr \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + all install install-devel +endef + +define Build/InstallDev + $(MAKE) -C $(PKG_BUILD_DIR) \ + $(TARGET_CONFIGURE_OPTS) \ + COPT_FLAGS="$(TARGET_CFLAGS)" \ + KERNEL_DIR="$(LINUX_DIR)" PREFIX=/usr \ + DESTDIR="$(STAGING_DIR)" \ + install install-devel +endef + +define Build/UninstallDev + rm -rf $(STAGING_DIR)/usr/include/libipq.h + rm -rf $(STAGING_DIR)/usr/lib/libipq.a +endef + +define Package/iptables/install + install -d -m0755 $(1)/etc/config + install -m0644 ./files/firewall.config $(1)/etc/config/firewall + install -d -m0755 $(1)/etc/init.d + install -m0755 ./files/firewall.init $(1)/etc/init.d/S45firewall + install -m0755 ./files/firewall.user $(1)/etc/ + install -d -m0755 $(1)/usr/lib + install -m0644 ./files/firewall.awk $(1)/usr/lib + install -d -m0755 $(1)/usr/sbin + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/iptables $(1)/usr/sbin/ + install -d -m0755 $(1)/usr/lib/iptables + (cd $(PKG_INSTALL_DIR)/usr/lib/iptables ; \ + $(CP) $(patsubst %,lib%.so,$(IPT_BUILTIN:xt_%=ipt_%)) $(1)/usr/lib/iptables/ \ + ) +endef + +define Package/iptables-utils/install + install -d -m0755 $(1)/usr/sbin + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/iptables-{save,restore} $(1)/usr/sbin/ +endef + +define Package/ip6tables/install + install -d -m0755 $(1)/usr/sbin + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ip6tables $(1)/usr/sbin/ + install -d -m0755 $(1)/usr/lib/iptables + (cd $(PKG_INSTALL_DIR)/usr/lib/iptables ; \ + $(CP) libip6t_*.so $(1)/usr/lib/iptables/ \ + ) +endef + +define BuildPlugin + define Package/$(1)/install + install -m0755 -d $$(1)/usr/lib/iptables + for m in $$(patsubst xt_%,ipt_%,$(2)); do \ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$$$$$${m}.so $$(1)/usr/lib/iptables/ ; \ + done + $(3) + endef + + $$(eval $$(call BuildPackage,$(1))) +endef + +L7_INSTALL:=mkdir -p $$(1)/etc/l7-protocols; \ + $(CP) files/l7/*.pat $$(1)/etc/l7-protocols/ + +$(eval $(call BuildPackage,iptables)) +$(eval $(call BuildPackage,iptables-utils)) +$(eval $(call BuildPlugin,iptables-mod-conntrack,$(IPT_CONNTRACK-m))) +$(eval $(call BuildPlugin,iptables-mod-extra,$(IPT_EXTRA-m))) +$(eval $(call BuildPlugin,iptables-mod-filter,$(IPT_FILTER-m),$(L7_INSTALL))) +$(eval $(call BuildPlugin,iptables-mod-imq,$(IPT_IMQ-m))) +$(eval $(call BuildPlugin,iptables-mod-ipopt,$(IPT_IPOPT-m))) +$(eval $(call BuildPlugin,iptables-mod-ipsec,$(IPT_IPSEC-m))) +$(eval $(call BuildPlugin,iptables-mod-nat,$(IPT_NAT-m))) +$(eval $(call BuildPlugin,iptables-mod-ulog,$(IPT_ULOG-m))) +$(eval $(call BuildPackage,ip6tables)) diff --git a/package/iptables/files/firewall.awk b/package/iptables/files/firewall.awk new file mode 100644 index 0000000000..902c7b1888 --- /dev/null +++ b/package/iptables/files/firewall.awk @@ -0,0 +1,64 @@ +# Copyright (C) 2006 OpenWrt.org + +BEGIN { + print "ifname=\"$WAN\"" + print "[ -z \"$ifname\" ] && exit" + print "" + print "iptables -X input_$ifname 2>&- >&-" + print "iptables -N input_$ifname" + print "iptables -X forward_$ifname 2>&- >&-" + print "iptables -N forward_$ifname" + print "iptables -t nat -X prerouting_$ifname 2>&- >&-" + print "iptables -t nat -N prerouting_$ifname" + print "" + print "iptables -A input_rule -i \"$ifname\" -j input_$ifname" + print "iptables -A forwarding_rule -i \"$ifname\" -j forward_$ifname" + print "iptables -t nat -A prerouting_rule -i \"$ifname\" -j prerouting_$ifname" + print "" + FS=":" +} + +($1 == "accept") || ($1 == "drop") || ($1 == "forward") { + delete _opt + str2data($2) + if ((_l["proto"] == "") && (_l["sport"] _l["dport"] != "")) { + _opt[0] = " -p tcp" + _opt[1] = " -p udp" + } else { + _opt[0] = "" + } +} + +($1 == "accept") { + target = " -j ACCEPT" + for (o in _opt) { + print "iptables -t nat -A prerouting_$ifname" _opt[o] str2ipt($2) target + print "iptables -A input_$ifname " _opt[o] str2ipt($2) target + print "" + } +} + +($1 == "drop") { + for (o in _opt) { + print "iptables -t nat -A prerouting_$ifname" _opt[o] str2ipt($2) " -j DROP" + print "" + } +} + +($1 == "forward") { + target = " -j DNAT --to " $3 + fwopts = "" + if ($4 != "") { + if ((_l["proto"] == "tcp") || (_l["proto"] == "udp") || (_l["proto"] == "")) { + if (_l["proto"] != "") fwopts = " -p " _l["proto"] + fwopts = fwopts " --dport " $4 + target = target ":" $4 + } + else fwopts = "" + } + for (o in _opt) { + print "iptables -t nat -A prerouting_$ifname" _opt[o] str2ipt($2) target + print "iptables -A forward_$ifname " _opt[o] " -d " $3 fwopts " -j ACCEPT" + print "" + } +} diff --git a/package/iptables/files/firewall.config b/package/iptables/files/firewall.config new file mode 100644 index 0000000000..1b92954c93 --- /dev/null +++ b/package/iptables/files/firewall.config @@ -0,0 +1,48 @@ +# Copyright (C) 2006 OpenWrt.org + +# RULE SYNTAX: +# +# forward:<match>:<target>[:<port>] +# - forwards all packets matched by <match> to <target>, +# optionally changing the port to <port> +# +# accept:<match> +# - accepts all traffic matched by <match> +# +# drop:<match> +# - drops all traffic matched by <match> +# +# +# MATCHING OPTIONS: +# +# src=<ip> +# - match the source ip <ip> +# +# dest=<ip> +# - match the destination ip <ip> +# +# proto=<proto> +# - match the protocol by name or number +# +# sport=<port(s)> +# - match the source port(s), see below for syntax +# +# dport=<port(s)> +# - match the destination port(s), see below for syntax +# +# +# +# PORT SYNTAX: +# +# You can enter an arbitrary list of ports and port ranges in the following format: +# - 22,53,993,1000-1024 +# +# If you don't set the protocol to tcp or udp, it will apply to both +# +# +# +# EXAMPLES: +# +# drop:dport=22 src=1.3.3.7 +# accept:proto=tcp dport=22 +# forward:dport=60168:192.168.1.2:60169 diff --git a/package/iptables/files/firewall.init b/package/iptables/files/firewall.init new file mode 100755 index 0000000000..731485bcdd --- /dev/null +++ b/package/iptables/files/firewall.init @@ -0,0 +1,115 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org + +## Please make changes in /etc/firewall.user + +start() { + include /lib/network + scan_interfaces + + config_get WAN wan ifname + config_get LAN lan ifname + + ## CLEAR TABLES + for T in filter nat; do + iptables -t $T -F + iptables -t $T -X + done + + iptables -N input_rule + iptables -N output_rule + iptables -N forwarding_rule + + iptables -t nat -N prerouting_rule + iptables -t nat -N postrouting_rule + + iptables -N LAN_ACCEPT + [ -z "$WAN" ] || iptables -A LAN_ACCEPT -i "$WAN" -j RETURN + iptables -A LAN_ACCEPT -j ACCEPT + + ### INPUT + ### (connections with the router as destination) + + # base case + iptables -P INPUT DROP + iptables -A INPUT -m state --state INVALID -j DROP + iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT + iptables -A INPUT -p tcp --tcp-flags SYN SYN --tcp-option \! 2 -j DROP + + # + # insert accept rule or to jump to new accept-check table here + # + iptables -A INPUT -j input_rule + + # allow + iptables -A INPUT -j LAN_ACCEPT # allow from lan/wifi interfaces + iptables -A INPUT -p icmp -j ACCEPT # allow ICMP + iptables -A INPUT -p gre -j ACCEPT # allow GRE + + # reject (what to do with anything not allowed earlier) + iptables -A INPUT -p tcp -j REJECT --reject-with tcp-reset + iptables -A INPUT -j REJECT --reject-with icmp-port-unreachable + + ### OUTPUT + ### (connections with the router as source) + + # base case + iptables -P OUTPUT DROP + iptables -A OUTPUT -m state --state INVALID -j DROP + iptables -A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT + + # + # insert accept rule or to jump to new accept-check table here + # + iptables -A OUTPUT -j output_rule + + # allow + iptables -A OUTPUT -j ACCEPT #allow everything out + + # reject (what to do with anything not allowed earlier) + iptables -A OUTPUT -p tcp -j REJECT --reject-with tcp-reset + iptables -A OUTPUT -j REJECT --reject-with icmp-port-unreachable + + ### FORWARDING + ### (connections routed through the router) + + # base case + iptables -P FORWARD DROP + iptables -A FORWARD -m state --state INVALID -j DROP + iptables -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu + iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT + + # + # insert accept rule or to jump to new accept-check table here + # + iptables -A FORWARD -j forwarding_rule + + # allow + iptables -A FORWARD -i br0 -o br0 -j ACCEPT + [ -z "$WAN" ] || iptables -A FORWARD -i $LAN -o $WAN -j ACCEPT + + # reject (what to do with anything not allowed earlier) + # uses the default -P DROP + + ### MASQ + iptables -t nat -A PREROUTING -j prerouting_rule + iptables -t nat -A POSTROUTING -j postrouting_rule + [ -z "$WAN" ] || iptables -t nat -A POSTROUTING -o $WAN -j MASQUERADE + + ## USER RULES + [ -f /etc/firewall.user ] && . /etc/firewall.user + [ -n "$WAN" -a -e /etc/config/firewall ] && { + awk -f /usr/lib/common.awk -f /usr/lib/firewall.awk /etc/config/firewall | ash + } +} + +stop() { + iptables -P INPUT ACCEPT + iptables -P OUTPUT ACCEPT + iptables -P FORWARD ACCEPT + iptables -F + iptables -t nat -P PREROUTING ACCEPT + iptables -t nat -P POSTROUTING ACCEPT + iptables -t nat -P OUTPUT ACCEPT + iptables -t nat -F +} diff --git a/package/iptables/files/firewall.user b/package/iptables/files/firewall.user new file mode 100644 index 0000000000..5f295babf2 --- /dev/null +++ b/package/iptables/files/firewall.user @@ -0,0 +1,28 @@ +#!/bin/sh +# Copyright (C) 2006 OpenWrt.org + +iptables -F input_rule +iptables -F output_rule +iptables -F forwarding_rule +iptables -t nat -F prerouting_rule +iptables -t nat -F postrouting_rule + +### BIG FAT DISCLAIMER +## The "-i $WAN" is used to match packets that come in via the $WAN interface. +## it WILL NOT MATCH packets sent from the $WAN ip address -- you won't be able +## to see the effects from within the LAN. + +### Open port to WAN +## -- This allows port 22 to be answered by (dropbear on) the router +# iptables -t nat -A prerouting_rule -i $WAN -p tcp --dport 22 -j ACCEPT +# iptables -A input_rule -i $WAN -p tcp --dport 22 -j ACCEPT + +### Port forwarding +## -- This forwards port 8080 on the WAN to port 80 on 192.168.1.2 +# iptables -t nat -A prerouting_rule -i $WAN -p tcp --dport 8080 -j DNAT --to 192.168.1.2:80 +# iptables -A forwarding_rule -i $WAN -p tcp --dport 80 -d 192.168.1.2 -j ACCEPT + +### DMZ +## -- Connections to ports not handled above will be forwarded to 192.168.1.2 +# iptables -t nat -A prerouting_rule -i $WAN -j DNAT --to 192.168.1.2 +# iptables -A forwarding_rule -i $WAN -d 192.168.1.2 -j ACCEPT diff --git a/package/iptables/files/l7/aim.pat b/package/iptables/files/l7/aim.pat new file mode 100644 index 0000000000..9768dbbdc8 --- /dev/null +++ b/package/iptables/files/l7/aim.pat @@ -0,0 +1,27 @@ +# AIM - AOL instant messenger (OSCAR and TOC) +# Pattern quality: good notsofast +# Usually runs on port 5190 +# +# This may also match ICQ traffic. +# +# This pattern has been tested and is believed to work well. If it does not +# work for you, or you believe it could be improved, please post to +# l7-filter-developers@lists.sf.net . This list may be subscribed to at +# http://lists.sourceforge.net/lists/listinfo/l7-filter-developers + +aim +# See http://gridley.acns.carleton.edu/~straitm/final (and various other places) +# The first bit matches OSCAR signon and data commands, but not sure what +# \x03\x0b matches, but it works apparently. +# The next three bits match various parts of the TOC signon process. +# The third one is the magic number "*", then 0x01 for "signon", then up to four +# bytes ("up to" because l7-filter strips out nulls) which contain a sequence +# number (2 bytes) the data length (2 more) and 3 nulls (which don't count), +# then 0x01 for the version number (not sure if there ever has been another +# version) +# The fourth one is a command string, followed by some stuff, then the +# beginning of the "roasted" password + +# This pattern is too slow! + +^(\*[\x01\x02].*\x03\x0b|\*\x01.?.?.?.?\x01)|flapon|toc_signon.*0x diff --git a/package/iptables/files/l7/bittorrent.pat b/package/iptables/files/l7/bittorrent.pat new file mode 100644 index 0000000000..c1804ee4ba --- /dev/null +++ b/package/iptables/files/l7/bittorrent.pat @@ -0,0 +1,14 @@ +# Bittorrent - P2P filesharing / publishing tool - http://www.bittorrent.com +# Pattern quality: great veryfast +# +# This pattern has been tested and is believed to work well. If it does not +# work for you, or you believe it could be improved, please post to +# l7-filter-developers@lists.sf.net . This list may be subscribed to at +# http://lists.sourceforge.net/lists/listinfo/l7-filter-developers +bittorrent + +# Does not attempt to match the HTTP download of the tracker +# 0x13 is the length of "bittorrent protocol" +# Second two bits match UDP wierdness, commented out until it's tested +#^(\x13bittorrent protocol|d1:ad2:id20:|\x08'7P\)[RP]) +^\x13bittorrent protocol diff --git a/package/iptables/files/l7/edonkey-dl.pat b/package/iptables/files/l7/edonkey-dl.pat new file mode 100644 index 0000000000..d344d169d0 --- /dev/null +++ b/package/iptables/files/l7/edonkey-dl.pat @@ -0,0 +1,8 @@ +# eDonkey2000 - P2P filesharing (download part) - http://edonkey2000.com +# Pattern quality: good veryfast overmatch usepacket + +edonkey-dl + +^[\xe3\xe4\xc5\xe5\xd4](....)?[\x01\x0a\x0e\x0f\x10\x18\x19\x1b\x1c\x47\x4a\x4f\x51\x53\x54\x58\x60\x81\x90\x96\x9a\x9c\xa2] + + diff --git a/package/iptables/files/l7/edonkey.pat b/package/iptables/files/l7/edonkey.pat new file mode 100644 index 0000000000..efbc3f361e --- /dev/null +++ b/package/iptables/files/l7/edonkey.pat @@ -0,0 +1,29 @@ +# eDonkey2000 - P2P filesharing - http://edonkey2000.com +# Pattern quality: good veryfast overmatch +# +# Please post to l7-filter-developers@lists.sf.net as to whether this pattern +# works for you or not. If you believe it could be improved please post your +# suggestions to that list as well. You may subscribe to this list at +# http://lists.sourceforge.net/lists/listinfo/l7-filter-developers + +# Thanks to Matt Skidmore <fox AT woozle.org> + +edonkey + +# http://gd.tuwien.ac.at/opsys/linux/sf/p/pdonkey/eDonkey-protocol-0.6 +# +# In addition to \xe3, \xc5 and \xd4, I see a lot of \xe5 +# +# God this is a mess. What an irritating protocol. +# This will match about 1% of streams with random data in them! + +^[\xe3\xc5\xe5\xd4](....)?([\x01\x02\x05\x14\x15\x16\x18\x19\x1a\x1b\x1c\x20\x21\x32\x33\x34\x35\x36\x38\x40\x41\x42\x43\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54\x55\x56\x57\x58\x5b\x5c\x60\x81\x82\x90\x91\x93\x96\x97\x98\x99\x9a\x9b\x9c\x9e\xa0\xa1\xa2\xa3\xa4]|\x59................?[ -~]|\x96....$) + +# matches everything and too much +# ^(\xe3|\xc5|\xd4) + +# ipp2p essentially uses "\xe3....\x47", which doesn't seem at all right to me. + +# bandwidtharbitrator uses +# e0.*@.*6[a-z].*p$|e0.*@.*[a-z]6[a-z].*p0$|e.*@.*[0-9]6.*p$|emule|edonkey +# no comments to explain what all the mush is, of course... diff --git a/package/iptables/files/l7/fasttrack.pat b/package/iptables/files/l7/fasttrack.pat new file mode 100644 index 0000000000..46295c6bbe --- /dev/null +++ b/package/iptables/files/l7/fasttrack.pat @@ -0,0 +1,25 @@ +# FastTrack - P2P filesharing (Kazaa, Morpheus, iMesh, Grokster, etc) +# Pattern quality: good notsofast +# +# Tested with Kazaa Lite Resurrection 0.0.7.6F +# +# This appears to match the download connections well, but not the search +# connections (I think they are encrypted :-( ). +# +# Please post to l7-filter-developers@lists.sf.net as to whether it works +# for you or not. If you believe it could be improved please post your +# suggestions to that list as well. You may subscribe to this list at +# http://lists.sourceforge.net/lists/listinfo/l7-filter-developers + +fasttrack +# while this is a valid http request, this will be caught because +# the http pattern matches the response (and therefore the next packet) +# Even so, it's best to put this match earlier in the chain. +# http://cvs.berlios.de/cgi-bin/viewcvs.cgi/gift-fasttrack/giFT-FastTrack/PROTOCOL?rev=HEAD&content-type=text/vnd.viewcvs-markup + +# This pattern is kinda slow, but not too bad. +^get (/.download/[ -~]*|/.supernode[ -~]|/.status[ -~]|/.network[ -~]*|/.files|/.hash=[0-9a-f]*/[ -~]*) http/1.1|user-agent: kazaa|x-kazaa(-username|-network|-ip|-supernodeip|-xferid|-xferuid|tag)|^give [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]?[0-9]?[0-9]? + +# This isn't much faster: +#^get (/.download/.*|/.supernode.|/.status.|/.network.*|/.files|/.hash=[0-9a-f]*/.*) http/1.1|user-agent: kazaa|x-kazaa(-username|-network|-ip|-supernodeip|-xferid|-xferuid|tag)|^give [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]?[0-9]?[0-9]? + diff --git a/package/iptables/files/l7/ftp.pat b/package/iptables/files/l7/ftp.pat new file mode 100644 index 0000000000..9593ffd1bd --- /dev/null +++ b/package/iptables/files/l7/ftp.pat @@ -0,0 +1,34 @@ +# FTP - File Transfer Protocol - RFC 959 +# Pattern quality: great fast +# +# Usually runs on port 21. Note that the data stream is on a dynamically +# assigned port, which means that you will need the FTP connection +# tracking module in your kernel to usefully match FTP data transfers. +# +# This pattern is well tested. If it does not +# work for you, or you believe it could be improved, please post to +# l7-filter-developers@lists.sf.net . This list may be subscribed to at +# http://lists.sourceforge.net/lists/listinfo/l7-filter-developers +# +# Matches the first two things a server should say. Most servers say +# something after 220, even though they don't have to, and it usually +# includes the string "ftp" (l7-filter is case insensitive). +# This includes proftpd, vsftpd, wuftpd, warftpd, pureftpd, Bulletproof +# FTP Server, and whatever ftp.microsoft.com uses. Just in case, the next +# thing the server sends is a 331. All the above servers also send +# something including "password" after this code. +ftp +# actually, let's just do the first for now, it's faster +^220[\x09-\x0d -~]*ftp + +# This is ~10x faster if the stream starts with "220" +#^220.*ftp + +# This will match more, but much slower +#^220[\x09-\x0d -~]*ftp|331[\x09-\x0d -~]*password + +# This pattern is more precise, but takes longer to match. (3 packets vs. 1) +#^220[\x09-\x0d -~]*\x0d\x0aUSER[\x09-\x0d -~]*\x0d\x0a331 + +# same as above, but slightly less precise and only takes 2 packets. +#^220[\x09-\x0d -~]*\x0d\x0aUSER[\x09-\x0d -~]*\x0d\x0a diff --git a/package/iptables/files/l7/gnutella.pat b/package/iptables/files/l7/gnutella.pat new file mode 100644 index 0000000000..ebbd5c621d --- /dev/null +++ b/package/iptables/files/l7/gnutella.pat @@ -0,0 +1,36 @@ +# Gnutella - P2P filesharing +# Pattern quality: good fast +# +# This should match both Gnutella and "Gnutella2" ("Mike's protocol") +# +# Various clients use this protocol including Mactella, Shareaza, +# GTK-gnutella, Gnucleus, Gnotella, LimeWire, BearShare, and iMesh. +# +# This is tested with gtk-gnutella and Shareaza. +# +# Please report on how this pattern works for you at +# l7-filter-developers@lists.sf.net . If you can improve on this +# pattern, please also post to that list. You may subscribe at +# http://lists.sourceforge.net/lists/listinfo/l7-filter-developers + +# http://www.gnutella2.com/tiki-index.php?page=UDP%20Transceiver +# http://rfc-gnutella.sf.net/ +# http://www.gnutella2.com/tiki-index.php?page=Gnutella2%20Specification +# http://en.wikipedia.org/wiki/Shareaza + +gnutella + +# The first part matches UDP messages - All start with "GND", then have +# a flag byte which is either \x00, \x01 or \x02, then two sequence bytes +# that can be anything, then a fragment number, which must start at 1. +# The rest matches TCP first client message or first server message (in case +# we can't see client messages). Some parts of this are empirical rather than +# document based. Assumes version is between 0.0 and 2.9. (usually is +# 0.4 or 0.6). I'm guessing at many of the user-agents. +# The last bit is emprical and probably only matches Limewire. +^(gnd[\x01\x02]?.?.?\x01|gnutella connect/[012]\.[0-9]\x0d\x0a|get /uri-res/n2r\?urn:sha1:|get /.*user-agent: (gtk-gnutella|bearshare|mactella|gnucleus|gnotella|limewire|imesh)|get /.*content-type: application/x-gnutella-packets|giv [0-9]*:[0-9a-f]*/|queue [0-9a-f]* [1-9][0-9]?[0-9]?\.[1-9][0-9]?[0-9]?\.[1-9][0-9]?[0-9]?\.[1-9][0-9]?[0-9]?:[1-9][0-9]?[0-9]?[0-9]?|gnutella.*content-type: application/x-gnutella|..................lime) + +# Needlessly precise, at the expense of time +#^(gnd[\x01\x02]?.?.?\x01|gnutella connect/[012]\.[0-9]\x0d\x0a|get /uri-res/n2r\?urn:sha1:|get /[\x09-\x0d -~]*user-agent: (gtk-gnutella|bearshare|mactella|gnucleus|gnotella|limewire|imesh)|get /[\x09-\x0d -~]*content-type: application/x-gnutella-packets|giv [0-9]*:[0-9a-f]*/|queue [0-9a-f]* [1-9][0-9]?[0-9]?\.[1-9][0-9]?[0-9]?\.[1-9][0-9]?[0-9]?\.[1-9][0-9]?[0-9]?:[1-9][0-9]?[0-9]?[0-9]?|gnutella[\x09-\x0d -~]*content-type: application/x-gnutella|..................lime) + + diff --git a/package/iptables/files/l7/http.pat b/package/iptables/files/l7/http.pat new file mode 100644 index 0000000000..520e7fe212 --- /dev/null +++ b/package/iptables/files/l7/http.pat @@ -0,0 +1,28 @@ +# HTTP - HyperText Transfer Protocol - RFC 2616 +# Pattern quality: great notsofast +# Usually runs on port 80 +# +# This pattern has been tested and is believed to work well. If it does not +# work for you, or you believe it could be improved, please post to +# l7-filter-developers@lists.sf.net . This list may be subscribed to at +# http://lists.sourceforge.net/lists/listinfo/l7-filter-developers +# +# this intentionally catches the response from the server +# rather than the request so that other protocols which use +# http (like kazaa) can be caught based on specific http requests +# regardless of the ordering of filters... +# also matches posts + +# Sites that serve really long cookies may break this by pushing the +# server response too far away from the beginning of the connection. To +# fix this, increase the kernel's data buffer length. + +http +# Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF (rfc 2616) +# As specified in rfc 2616 a status code is preceeded and followed by a +# space. +http/(0\.9|1\.0|1\.1) [1-5][0-9][0-9] [\x09-\x0d -~]*(connection:|content-type:|content-length:|date:)|post [\x09-\x0d -~]* http/[01]\.[019] +# A slightly faster version that might be good enough: +#http/(0\.9|1\.0|1\.1) [1-5][0-9][0-9]|post [\x09-\x0d -~]* http/[01]\.[019] +# old pattern(s): +#(http[\x09-\x0d -~]*(200 ok|302 |304 )[\x09-\x0d -~]*(connection:|content-type:|content-length:))|^(post [\x09-\x0d -~]* http/) diff --git a/package/iptables/files/l7/ident.pat b/package/iptables/files/l7/ident.pat new file mode 100644 index 0000000000..672b0753ce --- /dev/null +++ b/package/iptables/files/l7/ident.pat @@ -0,0 +1,14 @@ +# Ident - Identification Protocol - RFC 1413 +# Pattern quality: good veryfast +# Usually runs on port 113 +# +# This pattern is believed to work. If it does not +# work for you, or you believe it could be improved, please post to +# l7-filter-developers@lists.sf.net . This list may be subscribed to at +# http://lists.sourceforge.net/lists/listinfo/l7-filter-developers + +ident +# "number , numberCRLF" possibly without the CR and/or LF. +# ^$ is appropriate because the first packet should never have anything +# else in it. +^[1-9][0-9]?[0-9]?[0-9]?[0-9]?[\x09-\x0d]*,[\x09-\x0d]*[1-9][0-9]?[0-9]?[0-9]?[0-9]?(\x0d\x0a|[\x0d\x0a])?$ diff --git a/package/iptables/files/l7/irc.pat b/package/iptables/files/l7/irc.pat new file mode 100644 index 0000000000..6643f6c2f7 --- /dev/null +++ b/package/iptables/files/l7/irc.pat @@ -0,0 +1,20 @@ +# IRC - Internet Relay Chat - RFC 1459 +# Pattern quality: good veryfast +# +# Usually runs on port 6666 or 6667 +# Note that chat traffic runs on these ports, but IRC-DCC traffic (which +# can use much more bandwidth) uses a dynamically assigned port, so you +# must have the IRC connection tracking module in your kernel to classify +# this. +# +# This pattern has been tested and is believed to work well. If it does not +# work for you, or you believe it could be improved, please post to +# l7-filter-developers@lists.sf.net . This list may be subscribed to at +# http://lists.sourceforge.net/lists/listinfo/l7-filter-developers + +irc +# First thing that happens is that the client sends NICK and USER, in +# either order. This allows MIRC color codes (\x02-\x0d instead of +# \x09-\x0d). +^(nick[\x09-\x0d -~]*user[\x09-\x0d -~]*:|user[\x09-\x0d -~]*:[\x02-\x0d -~]*nick[\x09-\x0d -~]*\x0d\x0a) + diff --git a/package/iptables/files/l7/jabber.pat b/package/iptables/files/l7/jabber.pat new file mode 100644 index 0000000000..7a0c6840e1 --- /dev/null +++ b/package/iptables/files/l7/jabber.pat @@ -0,0 +1,24 @@ +# Jabber (XMPP) - an open instant messenger protocol - http://jabber.org +# Pattern quality: good fast +# +# This pattern has been tested with Gaim and Gabber. It is only tested +# with non-SSL mode Jabber with no proxies. If it does not +# work for you, or you believe it could be improved, please post to +# l7-filter-developers@lists.sf.net . This list may be subscribed to at +# http://lists.sourceforge.net/lists/listinfo/l7-filter-developers + +# Thanks to Jan Hudec for some improvements. + +# Jabber seems to take a long time to set up a connection. I'm +# connecting with Gabber 0.8.8 to 12jabber.org and the first 8 packets +# is this: +# <stream:stream to='12jabber.com' xmlns='jabber:client' +# xmlns:stream='http://etherx.jabber.org/streams'><?xml +# version='1.0'?><stream:stream +# xmlns:stream='http://etherx.jabber.org/streams' id='3f73e951' +# xmlns='jabber:client' from='12jabber.com'> +# +# No mention of my username or password yet, you'll note. + +jabber +<stream:stream[\x09-\x0d ][ -~]*[\x09-\x0d ]xmlns=['"]jabber diff --git a/package/iptables/files/l7/msnmessenger.pat b/package/iptables/files/l7/msnmessenger.pat new file mode 100644 index 0000000000..e07f71f311 --- /dev/null +++ b/package/iptables/files/l7/msnmessenger.pat @@ -0,0 +1,15 @@ +# MSN Messenger - Microsoft Network chat client +# Pattern quality: good veryfast +# +# Usually uses port 1863 +# http://www.hypothetic.org/docs/msn/index.php +# +# This pattern has been tested and is believed to work well. If it does not +# work for you, or you believe it could be improved, please post to +# l7-filter-developers@lists.sf.net . This list may be subscribed to at +# http://lists.sourceforge.net/lists/listinfo/l7-filter-developers + +msnmessenger +# ver: allow versions up to 99. +# usr (in case ver didn't work): +^(ver [0-9]+ msnp[1-9][0-9]? [\x09-\x0d -~]* cvr|usr md5 i [ -~]*) diff --git a/package/iptables/files/l7/ntp.pat b/package/iptables/files/l7/ntp.pat new file mode 100644 index 0000000000..b7e443e21f --- /dev/null +++ b/package/iptables/files/l7/ntp.pat @@ -0,0 +1,17 @@ +# (S)NTP - (Simple) Network Time Protocol - RFCs 1305 and 2030 +# Pattern quality: good veryfast overmatch +# +# This pattern is tested and is believed to work. If this does not work +# for you, or you believe it could be improved, please post to +# l7-filter-developers@lists.sf.net . Subscribe at +# http://lists.sourceforge.net/lists/listinfo/l7-filter-developers + +# client|server +# Requires the server's timestamp to be in the present or future (of 2005). +# Tested with ntpdate on Linux. +# Assumes version 2, 3 or 4. + +# Note that ntp packets are always 48 bytes, so you should match on that too. + +ntp +^([\x13\x1b\x23\xd3\xdb\xe3]|[\x14\x1c$].......?.?.?.?.?.?.?.?.?[\xc6-\xff]) diff --git a/package/iptables/files/l7/pop3.pat b/package/iptables/files/l7/pop3.pat new file mode 100644 index 0000000000..f6bb630614 --- /dev/null +++ b/package/iptables/files/l7/pop3.pat @@ -0,0 +1,50 @@ +# POP3 - Post Office Protocol version 3 (popular e-mail protocol) - RFC 1939 +# Pattern quality: good veryfast +# +# This pattern has been tested somewhat. If it does not +# work for you, or you believe it could be improved, please post to +# l7-filter-developers@lists.sf.net . This list may be subscribed to at +# http://lists.sourceforge.net/lists/listinfo/l7-filter-developers + +# this is a difficult protocol to match because of the relative lack of +# distinguishing information. Read on. +pop3 + +# this the most conservative pattern. It should definitely work. +#^(\+ok|-err) + +# this pattern assumes that the server says _something_ after +ok or -err +# I think this is probably the way to go. +^(\+ok |-err ) + +# more that 90% of servers seem to say "pop" after "+ok", but not all. +#^(\+ok .*pop) + +# Here's another tack. I think this is my second favorite. +#^(\+ok [\x09-\x0d -~]*(ready|hello|pop|starting)|-err [\x09-\x0d -~]*(invalid|unknown|unimplemented|unrecognized|command)) + +# this matches the server saying "you have N messages that are M bytes", +# which the client probably asks for early in the session (not tested) +#\+ok [0-9]+ [0-9]+ + +# some sample servers: +# RFC example: +OK POP3 server ready <1896.697170952@dbc.mtview.ca.us> +# mail.dreamhost.com: +OK Hello there. +# pop.carleton.edu: +OK POP3D(*) Server PMDFV6.2.2 at Fri, 12 Sep 2003 19:28:10 -0500 (CDT) (APOP disabled) +# mail.earthlink.net: +OK NGPopper vEL_4_38 at earthlink.net ready <25509.1063412951@falcon> +# *.email.umn.edu: +OK Cubic Circle's v1.22 1998/04/11 POP3 ready <7d1e0000da67623f@aquamarine.tc.umn.edu> +# mail.yale.edu: +OK POP3 pantheon-po01 v2002.81 server ready +# mail.gustavus.edu: +OK POP3 solen v2001.78 server ready +# mail.reed.edu: +OK POP3 letra.reed.edu v2002.81 server ready +# mail.bowdoin.edu: +OK mail.bowdoin.edu POP3 service (iPlanet Messaging Server 5.2 HotFix 1.15 (built Apr 28 2003)) +# pop.colby.edu: +OK Qpopper (version 4.0.5) at basalt starting. +# mail.mac.com: +OK Netscape Messaging Multiplexor ready + +# various error strings: +#-ERR Invalid command. +#-ERR invalid command +#-ERR unimplemented +#-ERR Invalid command, try one of: USER name, PASS string, QUIT +#-ERR Unknown AUTHORIZATION state command +#-ERR Unrecognized command +#-ERR Unknown command: "sadf'". diff --git a/package/iptables/files/l7/smtp.pat b/package/iptables/files/l7/smtp.pat new file mode 100644 index 0000000000..1bab7a1df4 --- /dev/null +++ b/package/iptables/files/l7/smtp.pat @@ -0,0 +1,39 @@ +# SMTP - Simple Mail Transfer Protocol - RFC 2821 (See also RFC 1869) +# Pattern quality: great fast +# usually runs on port 25 +# +# This pattern has been tested and is believed to work well. If it does not +# work for you, or you believe it could be improved, please post to +# l7-filter-developers@lists.sf.net . This list may be subscribed to at +# http://lists.sourceforge.net/lists/listinfo/l7-filter-developers + +smtp +# As usual, no text is required after "220", but all known servers have some +# there. It (almost?) always has string "smtp" in it. The RFC examples +# does not, so we match those too, just in case anyone has copied them +# literally. +^220[\x09-\x0d -~]* (e?smtp|simple mail) + +# This is ~3x faster if the stream starts with "220" +#^220.* (e?smtp|simple mail) + +# Some examples: +# 220 mail.stalker.com ESMTP CommuniGate Pro 4.1.3 +# 220 mail.vieodata.com ESMTP Merak 6.1.0; Mon, 15 Sep 2003 13:48:11 -0400 +# 220 mail.ut.caldera.com ESMTP +# 220 persephone.pmail.gen.nz ESMTP server ready. +# 220 smtp1.superb.net ESMTP +# 220 mail.kerio.com Kerio MailServer 5.6.7 ESMTP ready +# 220-mail.deerfield.com ESMTP VisNetic.MailServer.v6.0.9.0; Mon, 15 Sep 2003 13:4 +# 220 altn.com ESMTP MDaemon 6.8.5; Mon, 15 Sep 2003 12:46:42 -0500 +# 220 X1 NT-ESMTP Server ipsmin0165atl2.interland.net (IMail 6.06 73062-3) +# 220 mail.icewarp.com ESMTP Merak 6.1.1; Mon, 15 Sep 2003 19:43:23 +0200 +# 220-mail.email-scan.com ESMTP +# 220 smaug.dreamhost.com ESMTP +# 220 kona.carleton.edu -- Server ESMTP (PMDF V6.2#30648) +# 220 letra.reed.edu ESMTP Sendmail 8.12.9/8.12.9; Mon, 15 Sep 2003 10:35:57 -0700 (PDT) +# 220-swan.mail.pas.earthlink.net ESMTP Exim 3.33 #1 Mon, 15 Sep 2003 10:32:15 -0700 +# +# RFC examples: +# 220 xyz.com Simple Mail Transfer Service Ready (RFC example) +# 220 dbc.mtview.ca.us SMTP service ready diff --git a/package/iptables/files/l7/ssl.pat b/package/iptables/files/l7/ssl.pat new file mode 100644 index 0000000000..ab5f62caa7 --- /dev/null +++ b/package/iptables/files/l7/ssl.pat @@ -0,0 +1,15 @@ +# SSL and TLS - Secure Socket Layer / Transport Layer Security - RFC 2246 +# Pattern quality: good fast +# Usually runs on port 443 +# +# This is a superset validcertssl. For it to match, it must be first. +# +# This pattern has been tested and is believed to work well. If it does not +# work for you, or you believe it could be improved, please post to +# l7-filter-developers@lists.sf.net . This list may be subscribed to at +# http://lists.sourceforge.net/lists/listinfo/l7-filter-developers + +ssl +# Client Hello | Server Hello with certificate +# This allows SSL 3.X, which includes TLS 1.0, known internally as SSL 3.1 +^(.?.?\x16\x03.*\x16\x03|.?.?\x01\x03\x01?.*\x0b) diff --git a/package/iptables/files/l7/vnc.pat b/package/iptables/files/l7/vnc.pat new file mode 100644 index 0000000000..35bfbd4bad --- /dev/null +++ b/package/iptables/files/l7/vnc.pat @@ -0,0 +1,23 @@ +# VNC - Virtual Network Computing. Also known as RFB - Remote Frame Buffer +# Pattern quality: good fast +# http://www.realvnc.com/documentation.html +# +# This pattern has been verified with vnc v3.3.7 on WinXP and Linux +# Please report on how this pattern works for you at +# l7-filter-developers@lists.sf.net . If you can improve on this pattern, +# please also post to that list. You may subscribe at +# http://lists.sourceforge.net/lists/listinfo/l7-filter-developers +# +# Thanks to Trevor Paskett <tpaskett AT cymphonix.com> for this pattern. + +vnc +# Assumes single digit major and minor version numbers +# This message should be all alone in the first packet, so ^$ is appropriate +^rfb 00[1-9]\.00[0-9]\x0a$ + +# This is a more restrictive version which assumes the version numbers +# are ones actually in existance at the time of this writing, i.e. 3.3, +# 3.7 and 3.8 (with some clients wrongly reporting 3.5). It should be +# slightly faster, but probably not worth the extra maintenance. +# ^rfb 003\.00[3578]\x0a$ + diff --git a/package/iptables/patches/01-ipp2p-0.8.1rc1.patch b/package/iptables/patches/01-ipp2p-0.8.1rc1.patch new file mode 100644 index 0000000000..f7129b4560 --- /dev/null +++ b/package/iptables/patches/01-ipp2p-0.8.1rc1.patch @@ -0,0 +1,454 @@ +diff -urN iptables.old/extensions/Makefile iptables.dev/extensions/Makefile +--- iptables.old/extensions/Makefile 2005-07-20 04:22:56.000000000 +0200 ++++ iptables.dev/extensions/Makefile 2006-03-23 14:42:28.000000000 +0100 +@@ -8,6 +8,10 @@ + PF_EXT_SLIB:=ah addrtype comment connlimit connmark conntrack dscp ecn esp hashlimit helper icmp iprange length limit mac mark multiport owner physdev pkttype realm rpc sctp standard state tcp tcpmss tos ttl udp unclean CLASSIFY CONNMARK DNAT DSCP ECN LOG MARK MASQUERADE MIRROR NETMAP NFQUEUE NOTRACK REDIRECT REJECT SAME SNAT TARPIT TCPMSS TOS TRACE TTL ULOG + PF6_EXT_SLIB:=eui64 hl icmpv6 length limit mac mark multiport owner physdev standard tcp udp HL LOG NFQUEUE MARK TRACE + ++ ++# ipp2p ++PF_EXT_SLIB += ipp2p ++ + # Optionals + PF_EXT_SLIB_OPTS:=$(foreach T,$(wildcard extensions/.*-test),$(shell KERNEL_DIR=$(KERNEL_DIR) $(T))) + PF6_EXT_SLIB_OPTS:=$(foreach T,$(wildcard extensions/.*-test6),$(shell KERNEL_DIR=$(KERNEL_DIR) $(T))) +diff -urN iptables.old/extensions/libipt_ipp2p.c iptables.dev/extensions/libipt_ipp2p.c +--- iptables.old/extensions/libipt_ipp2p.c 1970-01-01 01:00:00.000000000 +0100 ++++ iptables.dev/extensions/libipt_ipp2p.c 2006-03-23 14:43:26.000000000 +0100 +@@ -0,0 +1,401 @@ ++ ++#include <stdio.h> ++#include <netdb.h> ++#include <string.h> ++#include <stdlib.h> ++#include <getopt.h> ++#include <ctype.h> ++ ++#include <iptables.h> ++ ++#include <linux/netfilter_ipv4/ipt_ipp2p.h> ++ ++static void ++help(void) ++{ ++ printf( ++ "IPP2P v%s options:\n" ++ " --ipp2p Grab all known p2p packets\n" ++ " --edk [TCP&UDP] All known eDonkey/eMule/Overnet packets\n" ++ " --dc [TCP] All known Direct Connect packets\n" ++ " --kazaa [TCP&UDP] All known KaZaA packets\n" ++ " --gnu [TCP&UDP] All known Gnutella packets\n" ++ " --bit [TCP&UDP] All known BitTorrent packets\n" ++ " --apple [TCP] All known AppleJuice packets\n" ++ " --winmx [TCP] All known WinMX\n" ++ " --soul [TCP] All known SoulSeek\n" ++ " --ares [TCP] All known Ares\n\n" ++ " EXPERIMENTAL protocols (please send feedback to: ipp2p@ipp2p.org) :\n" ++ " --mute [TCP] All known Mute packets\n" ++ " --waste [TCP] All known Waste packets\n" ++ " --xdcc [TCP] All known XDCC packets (only xdcc login)\n\n" ++ " DEBUG SUPPPORT, use only if you know why\n" ++ " --debug Generate kernel debug output, THIS WILL SLOW DOWN THE FILTER\n" ++ "\nNote that the follwing options will have the same meaning:\n" ++ " '--ipp2p' is equal to '--edk --dc --kazaa --gnu --bit --apple --winmx --soul --ares'\n" ++ "\nIPP2P was intended for TCP only. Due to increasing usage of UDP we needed to change this.\n" ++ "You can now use -p udp to search UDP packets only or without -p switch to search UDP and TCP packets.\n" ++ "\nSee README included with this package for more details or visit http://www.ipp2p.org\n" ++ "\nExamples:\n" ++ " iptables -A FORWARD -m ipp2p --ipp2p -j MARK --set-mark 0x01\n" ++ " iptables -A FORWARD -p udp -m ipp2p --kazaa --bit -j DROP\n" ++ " iptables -A FORWARD -p tcp -m ipp2p --edk --soul -j DROP\n\n" ++ , IPP2P_VERSION); ++} ++ ++static struct option opts[] = { ++ { "ipp2p", 0, 0, '1' }, ++ { "edk", 0, 0, '2' }, ++ { "dc", 0, 0, '7' }, ++ { "gnu", 0, 0, '9' }, ++ { "kazaa", 0, 0, 'a' }, ++ { "bit", 0, 0, 'b' }, ++ { "apple", 0, 0, 'c' }, ++ { "soul", 0, 0, 'd' }, ++ { "winmx", 0, 0, 'e' }, ++ { "ares", 0, 0, 'f' }, ++ { "mute", 0, 0, 'g' }, ++ { "waste", 0, 0, 'h' }, ++ { "xdcc", 0, 0, 'i' }, ++ { "debug", 0, 0, 'j' }, ++ {0} ++}; ++ ++ ++ ++static void ++init(struct ipt_entry_match *m, unsigned int *nfcache) ++{ ++ struct ipt_p2p_info *info = (struct ipt_p2p_info *)m->data; ++ ++ *nfcache |= NFC_UNKNOWN; ++ ++ /*init the module with default values*/ ++ info->cmd = 0; ++ info->debug = 0; ++ ++} ++ ++ ++static int ++parse(int c, char **argv, int invert, unsigned int *flags, ++ const struct ipt_entry *entry, ++ unsigned int *nfcache, ++ struct ipt_entry_match **match) ++{ ++ struct ipt_p2p_info *info = (struct ipt_p2p_info *)(*match)->data; ++ ++ switch (c) { ++ case '1': /*cmd: ipp2p*/ ++ if ((*flags & SHORT_HAND_IPP2P) == SHORT_HAND_IPP2P) ++ exit_error(PARAMETER_PROBLEM, ++ "ipp2p: `--ipp2p' may only be " ++ "specified once!"); ++/* if ((*flags & SHORT_HAND_DATA) == SHORT_HAND_DATA) ++ exit_error(PARAMETER_PROBLEM, ++ "ipp2p: `--ipp2p-data' may only be " ++ "specified alone!");*/ ++ if ((*flags) != 0) ++ exit_error(PARAMETER_PROBLEM, ++ "ipp2p: `--ipp2p' may only be " ++ "specified alone!"); ++ if (invert) exit_error(PARAMETER_PROBLEM, "ipp2p: invert [!] is not allowed!"); ++ *flags += SHORT_HAND_IPP2P; ++ info->cmd = *flags; ++ break; ++ ++ case '2': /*cmd: edk*/ ++ if ((*flags & IPP2P_EDK) == IPP2P_EDK) ++ exit_error(PARAMETER_PROBLEM, ++ "ipp2p: `--edk' may only be " ++ "specified once"); ++ if ((*flags & SHORT_HAND_IPP2P) == SHORT_HAND_IPP2P) ++ exit_error(PARAMETER_PROBLEM, ++ "ipp2p: `--ipp2p' may only be " ++ "specified alone!"); ++/* if ((*flags & SHORT_HAND_DATA) == SHORT_HAND_DATA) ++ exit_error(PARAMETER_PROBLEM, ++ "ipp2p: `--ipp2p-data' may only be " ++ "specified alone!");*/ ++ if ((*flags & IPP2P_DATA_EDK) == IPP2P_DATA_EDK) ++ exit_error(PARAMETER_PROBLEM, ++ "ipp2p: use `--edk' OR `--edk-data' but not both of them!"); ++ if (invert) exit_error(PARAMETER_PROBLEM, "ipp2p: invert [!] is not allowed!"); ++ *flags += IPP2P_EDK; ++ info->cmd = *flags; ++ break; ++ ++ ++ case '7': /*cmd: dc*/ ++ if ((*flags & IPP2P_DC) == IPP2P_DC) ++ exit_error(PARAMETER_PROBLEM, ++ "ipp2p: `--dc' may only be " ++ "specified once!"); ++ if ((*flags & SHORT_HAND_IPP2P) == SHORT_HAND_IPP2P) ++ exit_error(PARAMETER_PROBLEM, ++ "ipp2p: `--ipp2p' may only be " ++ "specified alone!"); ++/* if ((*flags & SHORT_HAND_DATA) == SHORT_HAND_DATA) ++ exit_error(PARAMETER_PROBLEM, ++ "ipp2p: `--ipp2p-data' may only be " ++ "specified alone!");*/ ++ if ((*flags & IPP2P_DATA_DC) == IPP2P_DATA_DC) ++ exit_error(PARAMETER_PROBLEM, ++ "ipp2p: use `--dc' OR `--dc-data' but not both of them!"); ++ if (invert) exit_error(PARAMETER_PROBLEM, "ipp2p: invert [!] is not allowed!"); ++ *flags += IPP2P_DC; ++ info->cmd = *flags; ++ break; ++ ++ ++ case '9': /*cmd: gnu*/ ++ if ((*flags & IPP2P_GNU) == IPP2P_GNU) ++ exit_error(PARAMETER_PROBLEM, ++ "ipp2p: `--gnu' may only be " ++ "specified once!"); ++/* if ((*flags & SHORT_HAND_DATA) == SHORT_HAND_DATA) ++ exit_error(PARAMETER_PROBLEM, ++ "ipp2p: `--ipp2p-data' may only be " ++ "specified alone!");*/ ++ if ((*flags & SHORT_HAND_IPP2P) == SHORT_HAND_IPP2P) ++ exit_error(PARAMETER_PROBLEM, ++ "ipp2p: `--ipp2p' may only be " ++ "specified alone!"); ++ if ((*flags & IPP2P_DATA_GNU) == IPP2P_DATA_GNU) ++ exit_error(PARAMETER_PROBLEM, ++ "ipp2p: use `--gnu' OR `--gnu-data' but not both of them!"); ++ if (invert) exit_error(PARAMETER_PROBLEM, "ipp2p: invert [!] is not allowed!"); ++ *flags += IPP2P_GNU; ++ info->cmd = *flags; ++ break; ++ ++ case 'a': /*cmd: kazaa*/ ++ if ((*flags & IPP2P_KAZAA) == IPP2P_KAZAA) ++ exit_error(PARAMETER_PROBLEM, ++ "ipp2p: `--kazaa' may only be " ++ "specified once!"); ++/* if ((*flags & SHORT_HAND_DATA) == SHORT_HAND_DATA) ++ exit_error(PARAMETER_PROBLEM, ++ "ipp2p: `--ipp2p-data' may only be " ++ "specified alone!");*/ ++ if ((*flags & SHORT_HAND_IPP2P) == SHORT_HAND_IPP2P) ++ exit_error(PARAMETER_PROBLEM, ++ "ipp2p: `--ipp2p' may only be " ++ "specified alone!"); ++ if ((*flags & IPP2P_DATA_KAZAA) == IPP2P_DATA_KAZAA) ++ exit_error(PARAMETER_PROBLEM, ++ "ipp2p: use `--kazaa' OR `--kazaa-data' but not both of them!"); ++ if (invert) exit_error(PARAMETER_PROBLEM, "ipp2p: invert [!] is not allowed!"); ++ *flags += IPP2P_KAZAA; ++ info->cmd = *flags; ++ break; ++ ++ case 'b': /*cmd: bit*/ ++ if ((*flags & IPP2P_BIT) == IPP2P_BIT) ++ exit_error(PARAMETER_PROBLEM, ++ "ipp2p: `--bit' may only be " ++ "specified once!"); ++ if ((*flags & SHORT_HAND_IPP2P) == SHORT_HAND_IPP2P) ++ exit_error(PARAMETER_PROBLEM, ++ "ipp2p: `--ipp2p' may only be " ++ "specified alone!"); ++ if (invert) exit_error(PARAMETER_PROBLEM, "ipp2p: invert [!] is not allowed!"); ++ *flags += IPP2P_BIT; ++ info->cmd = *flags; ++ break; ++ ++ case 'c': /*cmd: apple*/ ++ if ((*flags & IPP2P_APPLE) == IPP2P_APPLE) ++ exit_error(PARAMETER_PROBLEM, ++ "ipp2p: `--apple' may only be " ++ "specified once!"); ++ if ((*flags & SHORT_HAND_IPP2P) == SHORT_HAND_IPP2P) ++ exit_error(PARAMETER_PROBLEM, ++ "ipp2p: `--ipp2p' may only be " ++ "specified alone!"); ++ if (invert) exit_error(PARAMETER_PROBLEM, "ipp2p: invert [!] is not allowed!"); ++ *flags += IPP2P_APPLE; ++ info->cmd = *flags; ++ break; ++ ++ ++ case 'd': /*cmd: soul*/ ++ if ((*flags & IPP2P_SOUL) == IPP2P_SOUL) ++ exit_error(PARAMETER_PROBLEM, ++ "ipp2p: `--soul' may only be " ++ "specified once!"); ++ if ((*flags & SHORT_HAND_IPP2P) == SHORT_HAND_IPP2P) ++ exit_error(PARAMETER_PROBLEM, ++ "ipp2p: `--ipp2p' may only be " ++ "specified alone!"); ++ if (invert) exit_error(PARAMETER_PROBLEM, "ipp2p: invert [!] is not allowed!"); ++ *flags += IPP2P_SOUL; ++ info->cmd = *flags; ++ break; ++ ++ ++ case 'e': /*cmd: winmx*/ ++ if ((*flags & IPP2P_WINMX) == IPP2P_WINMX) ++ exit_error(PARAMETER_PROBLEM, ++ "ipp2p: `--winmx' may only be " ++ "specified once!"); ++ if ((*flags & SHORT_HAND_IPP2P) == SHORT_HAND_IPP2P) ++ exit_error(PARAMETER_PROBLEM, ++ "ipp2p: `--ipp2p' may only be " ++ "specified alone!"); ++ if (invert) exit_error(PARAMETER_PROBLEM, "ipp2p: invert [!] is not allowed!"); ++ *flags += IPP2P_WINMX; ++ info->cmd = *flags; ++ break; ++ ++ case 'f': /*cmd: ares*/ ++ if ((*flags & IPP2P_ARES) == IPP2P_ARES) ++ exit_error(PARAMETER_PROBLEM, ++ "ipp2p: `--ares' may only be " ++ "specified once!"); ++ if ((*flags & SHORT_HAND_IPP2P) == SHORT_HAND_IPP2P) ++ exit_error(PARAMETER_PROBLEM, ++ "ipp2p: `--ipp2p' may only be " ++ "specified alone!"); ++ if (invert) exit_error(PARAMETER_PROBLEM, "ipp2p: invert [!] is not allowed!"); ++ *flags += IPP2P_ARES; ++ info->cmd = *flags; ++ break; ++ ++ case 'g': /*cmd: mute*/ ++ if ((*flags & IPP2P_MUTE) == IPP2P_MUTE) ++ exit_error(PARAMETER_PROBLEM, ++ "ipp2p: `--mute' may only be " ++ "specified once!"); ++ if (invert) exit_error(PARAMETER_PROBLEM, "ipp2p: invert [!] is not allowed!"); ++ *flags += IPP2P_MUTE; ++ info->cmd = *flags; ++ break; ++ case 'h': /*cmd: waste*/ ++ if ((*flags & IPP2P_WASTE) == IPP2P_WASTE) ++ exit_error(PARAMETER_PROBLEM, ++ "ipp2p: `--waste' may only be " ++ "specified once!"); ++ if (invert) exit_error(PARAMETER_PROBLEM, "ipp2p: invert [!] is not allowed!"); ++ *flags += IPP2P_WASTE; ++ info->cmd = *flags; ++ break; ++ case 'i': /*cmd: xdcc*/ ++ if ((*flags & IPP2P_XDCC) == IPP2P_XDCC) ++ exit_error(PARAMETER_PROBLEM, ++ "ipp2p: `--ares' may only be " ++ "specified once!"); ++ if (invert) exit_error(PARAMETER_PROBLEM, "ipp2p: invert [!] is not allowed!"); ++ *flags += IPP2P_XDCC; ++ info->cmd = *flags; ++ break; ++ ++ case 'j': /*cmd: debug*/ ++ if (invert) exit_error(PARAMETER_PROBLEM, "ipp2p: invert [!] is not allowed!"); ++ info->debug = 1; ++ break; ++ ++ default: ++// exit_error(PARAMETER_PROBLEM, ++// "\nipp2p-parameter problem: for ipp2p usage type: iptables -m ipp2p --help\n"); ++ return 0; ++ } ++ return 1; ++} ++ ++ ++static void ++final_check(unsigned int flags) ++{ ++ if (!flags) ++ exit_error(PARAMETER_PROBLEM, ++ "\nipp2p-parameter problem: for ipp2p usage type: iptables -m ipp2p --help\n"); ++} ++ ++ ++ ++static void ++print(const struct ipt_ip *ip, ++ const struct ipt_entry_match *match, ++ int numeric) ++{ ++ struct ipt_p2p_info *info = (struct ipt_p2p_info *)match->data; ++ ++ printf("ipp2p v%s", IPP2P_VERSION); ++ if ((info->cmd & SHORT_HAND_IPP2P) == SHORT_HAND_IPP2P) printf(" --ipp2p"); ++// if ((info->cmd & SHORT_HAND_DATA) == SHORT_HAND_DATA) printf(" --ipp2p-data"); ++ if ((info->cmd & IPP2P_KAZAA) == IPP2P_KAZAA) printf(" --kazaa"); ++// if ((info->cmd & IPP2P_DATA_KAZAA) == IPP2P_DATA_KAZAA) printf(" --kazaa-data"); ++// if ((info->cmd & IPP2P_DATA_GNU) == IPP2P_DATA_GNU) printf(" --gnu-data"); ++ if ((info->cmd & IPP2P_GNU) == IPP2P_GNU) printf(" --gnu"); ++ if ((info->cmd & IPP2P_EDK) == IPP2P_EDK) printf(" --edk"); ++// if ((info->cmd & IPP2P_DATA_EDK) == IPP2P_DATA_EDK) printf(" --edk-data"); ++// if ((info->cmd & IPP2P_DATA_DC) == IPP2P_DATA_DC) printf(" --dc-data"); ++ if ((info->cmd & IPP2P_DC) == IPP2P_DC) printf(" --dc"); ++ if ((info->cmd & IPP2P_BIT) == IPP2P_BIT) printf(" --bit"); ++ if ((info->cmd & IPP2P_APPLE) == IPP2P_APPLE) printf(" --apple"); ++ if ((info->cmd & IPP2P_SOUL) == IPP2P_SOUL) printf(" --soul"); ++ if ((info->cmd & IPP2P_WINMX) == IPP2P_WINMX) printf(" --winmx"); ++ if ((info->cmd & IPP2P_ARES) == IPP2P_ARES) printf(" --ares"); ++ if ((info->cmd & IPP2P_MUTE) == IPP2P_MUTE) printf(" --mute"); ++ if ((info->cmd & IPP2P_WASTE) == IPP2P_WASTE) printf(" --waste"); ++ if ((info->cmd & IPP2P_XDCC) == IPP2P_XDCC) printf(" --xdcc"); ++ if (info->debug != 0) printf(" --debug"); ++ printf(" "); ++} ++ ++ ++ ++static void ++save(const struct ipt_ip *ip, const struct ipt_entry_match *match) ++{ ++ struct ipt_p2p_info *info = (struct ipt_p2p_info *)match->data; ++ ++ if ((info->cmd & SHORT_HAND_IPP2P) == SHORT_HAND_IPP2P) printf("--ipp2p "); ++// if ((info->cmd & SHORT_HAND_DATA) == SHORT_HAND_DATA) printf("--ipp2p-data "); ++ if ((info->cmd & IPP2P_KAZAA) == IPP2P_KAZAA) printf("--kazaa "); ++// if ((info->cmd & IPP2P_DATA_KAZAA) == IPP2P_DATA_KAZAA) printf("--kazaa-data "); ++// if ((info->cmd & IPP2P_DATA_GNU) == IPP2P_DATA_GNU) printf("--gnu-data "); ++ if ((info->cmd & IPP2P_GNU) == IPP2P_GNU) printf("--gnu "); ++ if ((info->cmd & IPP2P_EDK) == IPP2P_EDK) printf("--edk "); ++// if ((info->cmd & IPP2P_DATA_EDK) == IPP2P_DATA_EDK) printf("--edk-data "); ++// if ((info->cmd & IPP2P_DATA_DC) == IPP2P_DATA_DC) printf("--dc-data "); ++ if ((info->cmd & IPP2P_DC) == IPP2P_DC) printf("--dc "); ++ if ((info->cmd & IPP2P_BIT) == IPP2P_BIT) printf("--bit "); ++ if ((info->cmd & IPP2P_APPLE) == IPP2P_APPLE) printf("--apple "); ++ if ((info->cmd & IPP2P_SOUL) == IPP2P_SOUL) printf("--soul "); ++ if ((info->cmd & IPP2P_WINMX) == IPP2P_WINMX) printf("--winmx "); ++ if ((info->cmd & IPP2P_ARES) == IPP2P_ARES) printf("--ares "); ++ if ((info->cmd & IPP2P_MUTE) == IPP2P_MUTE) printf(" --mute"); ++ if ((info->cmd & IPP2P_WASTE) == IPP2P_WASTE) printf(" --waste"); ++ if ((info->cmd & IPP2P_XDCC) == IPP2P_XDCC) printf(" --xdcc"); ++ if (info->debug != 0) printf("--debug "); ++} ++ ++ ++ ++ ++static ++struct iptables_match ipp2p= ++{ ++ .next = NULL, ++ .name = "ipp2p", ++ .version = IPTABLES_VERSION, ++ .size = IPT_ALIGN(sizeof(struct ipt_p2p_info)), ++ .userspacesize = IPT_ALIGN(sizeof(struct ipt_p2p_info)), ++ .help = &help, ++ .init = &init, ++ .parse = &parse, ++ .final_check = &final_check, ++ .print = &print, ++ .save = &save, ++ .extra_opts = opts ++}; ++ ++ ++ ++void _init(void) ++{ ++ register_match(&ipp2p); ++} ++ +diff -urN iptables.old/include/linux/netfilter_ipv4/ipt_ipp2p.h iptables.dev/include/linux/netfilter_ipv4/ipt_ipp2p.h +--- iptables.old/include/linux/netfilter_ipv4/ipt_ipp2p.h 1970-01-01 01:00:00.000000000 +0100 ++++ iptables.dev/include/linux/netfilter_ipv4/ipt_ipp2p.h 2006-03-23 14:44:26.000000000 +0100 +@@ -0,0 +1,31 @@ ++#ifndef __IPT_IPP2P_H ++#define __IPT_IPP2P_H ++#define IPP2P_VERSION "0.8.1_rc1" ++ ++struct ipt_p2p_info { ++ int cmd; ++ int debug; ++}; ++ ++#endif //__IPT_IPP2P_H ++ ++#define SHORT_HAND_IPP2P 1 /* --ipp2p switch*/ ++//#define SHORT_HAND_DATA 4 /* --ipp2p-data switch*/ ++#define SHORT_HAND_NONE 5 /* no short hand*/ ++ ++#define IPP2P_EDK (1 << 1) ++#define IPP2P_DATA_KAZAA (1 << 2) ++#define IPP2P_DATA_EDK (1 << 3) ++#define IPP2P_DATA_DC (1 << 4) ++#define IPP2P_DC (1 << 5) ++#define IPP2P_DATA_GNU (1 << 6) ++#define IPP2P_GNU (1 << 7) ++#define IPP2P_KAZAA (1 << 8) ++#define IPP2P_BIT (1 << 9) ++#define IPP2P_APPLE (1 << 10) ++#define IPP2P_SOUL (1 << 11) ++#define IPP2P_WINMX (1 << 12) ++#define IPP2P_ARES (1 << 13) ++#define IPP2P_MUTE (1 << 14) ++#define IPP2P_WASTE (1 << 15) ++#define IPP2P_XDCC (1 << 16) diff --git a/package/iptables/patches/02-layer7-1.5nbd.patch b/package/iptables/patches/02-layer7-1.5nbd.patch new file mode 100644 index 0000000000..95c62a860a --- /dev/null +++ b/package/iptables/patches/02-layer7-1.5nbd.patch @@ -0,0 +1,416 @@ +diff -urN iptables.old/extensions/.layer7-test iptables.dev/extensions/.layer7-test +--- iptables.old/extensions/.layer7-test 1970-01-01 01:00:00.000000000 +0100 ++++ iptables.dev/extensions/.layer7-test 2005-11-10 16:57:51.819381000 +0100 +@@ -0,0 +1,2 @@ ++#! /bin/sh ++[ -f $KERNEL_DIR/include/linux/netfilter_ipv4/ipt_layer7.h ] && echo layer7 +diff -urN iptables.old/extensions/ipt_layer7.h iptables.dev/extensions/ipt_layer7.h +--- iptables.old/extensions/ipt_layer7.h 1970-01-01 01:00:00.000000000 +0100 ++++ iptables.dev/extensions/ipt_layer7.h 2005-11-10 17:46:32.933599750 +0100 +@@ -0,0 +1,27 @@ ++/* ++ By Matthew Strait <quadong@users.sf.net>, Dec 2003. ++ http://l7-filter.sf.net ++ ++ 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 the Free Software Foundation; either version ++ 2 of the License, or (at your option) any later version. ++ http://www.gnu.org/licenses/gpl.txt ++*/ ++ ++#ifndef _IPT_LAYER7_H ++#define _IPT_LAYER7_H ++ ++#define MAX_PATTERN_LEN 8192 ++#define MAX_PROTOCOL_LEN 256 ++ ++typedef char *(*proc_ipt_search) (char *, char, char *); ++ ++struct ipt_layer7_info { ++ char protocol[MAX_PROTOCOL_LEN]; ++ char invert:1; ++ char pattern[MAX_PATTERN_LEN]; ++ char pkt; ++}; ++ ++#endif /* _IPT_LAYER7_H */ +diff -urN iptables.old/extensions/libipt_layer7.c iptables.dev/extensions/libipt_layer7.c +--- iptables.old/extensions/libipt_layer7.c 1970-01-01 01:00:00.000000000 +0100 ++++ iptables.dev/extensions/libipt_layer7.c 2005-11-10 17:47:01.399378750 +0100 +@@ -0,0 +1,358 @@ ++/* ++ Shared library add-on to iptables to add layer 7 matching support. ++ ++ By Matthew Strait <quadong@users.sf.net>, Oct 2003. ++ ++ http://l7-filter.sf.net ++ ++ 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 the Free Software Foundation; either version ++ 2 of the License, or (at your option) any later version. ++ http://www.gnu.org/licenses/gpl.txt ++ ++ Based on libipt_string.c (C) 2000 Emmanuel Roger <winfield@freegates.be> ++*/ ++ ++#define _GNU_SOURCE ++#include <stdio.h> ++#include <netdb.h> ++#include <string.h> ++#include <stdlib.h> ++#include <getopt.h> ++#include <ctype.h> ++#include <dirent.h> ++ ++#include <iptables.h> ++#include "ipt_layer7.h" ++ ++#define MAX_FN_LEN 256 ++ ++static char l7dir[MAX_FN_LEN] = "\0"; ++ ++/* Function which prints out usage message. */ ++static void help(void) ++{ ++ printf( ++ "LAYER7 match v%s options:\n" ++ "--l7dir <directory> : Look for patterns here instead of /etc/l7-protocols/\n" ++ " (--l7dir must be specified before --l7proto if used!)\n" ++ "--l7proto [!] <name> : Match the protocol defined in /etc/l7-protocols/name.pat\n" ++ "--l7pkt : Skip connection tracking and match individual packets\n", ++ IPTABLES_VERSION); ++ fputc('\n', stdout); ++} ++ ++static struct option opts[] = { ++ { .name = "l7proto", .has_arg = 1, .flag = 0, .val = '1' }, ++ { .name = "l7dir", .has_arg = 1, .flag = 0, .val = '2' }, ++ { .name = "l7pkt", .has_arg = 0, .flag = 0, .val = '3' }, ++ { .name = 0 } ++}; ++ ++/* reads filename, puts protocol info into layer7_protocol_info, number of protocols to numprotos */ ++int parse_protocol_file(char * filename, const unsigned char * protoname, struct ipt_layer7_info *info) ++{ ++ FILE * f; ++ char * line = NULL; ++ size_t len = 0; ++ ++ enum { protocol, pattern, done } datatype = protocol; ++ ++ f = fopen(filename, "r"); ++ ++ if(!f) ++ return 0; ++ ++ while(getline(&line, &len, f) != -1) ++ { ++ if(strlen(line) < 2 || line[0] == '#') ++ continue; ++ ++ /* strip the pesky newline... */ ++ if(line[strlen(line) - 1] == '\n') ++ line[strlen(line) - 1] = '\0'; ++ ++ if(datatype == protocol) ++ { ++ if(strcmp(line, protoname)) ++ exit_error(OTHER_PROBLEM, ++ "Protocol name (%s) doesn't match file name (%s). Bailing out\n", ++ protoname, filename); ++ ++ if(strlen(line) >= MAX_PROTOCOL_LEN) ++ exit_error(PARAMETER_PROBLEM, ++ "Protocol name in %s too long!", filename); ++ strncpy(info->protocol, line, MAX_PROTOCOL_LEN); ++ ++ datatype = pattern; ++ } ++ else if(datatype == pattern) ++ { ++ if(strlen(line) >= MAX_PATTERN_LEN) ++ exit_error(PARAMETER_PROBLEM, "Pattern in %s too long!", filename); ++ strncpy(info->pattern, line, MAX_PATTERN_LEN); ++ ++ datatype = done; ++ break; ++ } ++ else ++ exit_error(OTHER_PROBLEM, "Internal error"); ++ } ++ ++ if(datatype != done) ++ exit_error(OTHER_PROBLEM, "Failed to get all needed data from %s", filename); ++ ++ if(line) free(line); ++ fclose(f); ++ ++ return 1; ++ ++/* ++ fprintf(stderr, "protocol: %s\npattern: %s\n\n", ++ info->protocol, ++ info->pattern); ++*/ ++} ++ ++static int hex2dec(char c) ++{ ++ switch (c) ++ { ++ case '0' ... '9': ++ return c - '0'; ++ case 'a' ... 'f': ++ return c - 'a' + 10; ++ case 'A' ... 'F': ++ return c - 'A' + 10; ++ default: ++ exit_error(OTHER_PROBLEM, "hex2dec: bad value!\n"); ++ return 0; ++ } ++} ++ ++/* takes a string with \xHH escapes and returns one with the characters ++they stand for */ ++static char * pre_process(char * s) ++{ ++ char * result = malloc(strlen(s) + 1); ++ int sindex = 0, rindex = 0; ++ while( sindex < strlen(s) ) ++ { ++ if( sindex + 3 < strlen(s) && ++ s[sindex] == '\\' && s[sindex+1] == 'x' && ++ isxdigit(s[sindex + 2]) && isxdigit(s[sindex + 3]) ) ++ { ++ /* carefully remember to call tolower here... */ ++ result[rindex] = tolower( hex2dec(s[sindex + 2])*16 + ++ hex2dec(s[sindex + 3] ) ); ++ sindex += 3; /* 4 total */ ++ } ++ else ++ result[rindex] = tolower(s[sindex]); ++ ++ sindex++; ++ rindex++; ++ } ++ result[rindex] = '\0'; ++ ++ return result; ++} ++ ++#define MAX_SUBDIRS 128 ++char ** readl7dir(char * dirname) ++{ ++ DIR * scratchdir; ++ struct dirent ** namelist; ++ char ** subdirs = malloc(MAX_SUBDIRS * sizeof(char *)); ++ ++ int n, d = 1; ++ subdirs[0] = ""; ++ ++ n = scandir(dirname, &namelist, 0, alphasort); ++ ++ if (n < 0) ++ { ++ perror("scandir"); ++ exit_error(OTHER_PROBLEM, "Couldn't open %s\n", dirname); ++ } ++ else ++ { ++ while(n--) ++ { ++ char fulldirname[MAX_FN_LEN]; ++ ++ snprintf(fulldirname, MAX_FN_LEN, "%s/%s", dirname, namelist[n]->d_name); ++ ++ if((scratchdir = opendir(fulldirname)) != NULL) ++ { ++ closedir(scratchdir); ++ ++ if(!strcmp(namelist[n]->d_name, ".") || ++ !strcmp(namelist[n]->d_name, "..")) ++ /* do nothing */ ; ++ else ++ { ++ subdirs[d] = malloc(strlen(namelist[n]->d_name) + 1); ++ strcpy(subdirs[d], namelist[n]->d_name); ++ d++; ++ if(d >= MAX_SUBDIRS - 1) ++ { ++ fprintf(stderr, ++ "Too many subdirectories, skipping the rest!\n"); ++ break; ++ } ++ } ++ } ++ free(namelist[n]); ++ } ++ free(namelist); ++ } ++ ++ subdirs[d] = NULL; ++ ++ return subdirs; ++} ++ ++static void ++parse_layer7_protocol(const unsigned char *s, struct ipt_layer7_info *info) ++{ ++ char filename[MAX_FN_LEN]; ++ char * dir = NULL; ++ char ** subdirs; ++ int n = 0, done = 0; ++ ++ if(strlen(l7dir) > 0) ++ dir = l7dir; ++ else ++ dir = "/etc/l7-protocols"; ++ ++ subdirs = readl7dir(dir); ++ ++ while(subdirs[n] != NULL) ++ { ++ int c = snprintf(filename, MAX_FN_LEN, "%s/%s/%s.pat", dir, subdirs[n], s); ++ ++ //fprintf(stderr, "Trying to find pattern in %s ... ", filename); ++ ++ if(c > MAX_FN_LEN) ++ { ++ exit_error(OTHER_PROBLEM, ++ "Filename beginning with %s is too long!\n", filename); ++ } ++ ++ /* read in the pattern from the file */ ++ if(parse_protocol_file(filename, s, info)) ++ { ++ //fprintf(stderr, "found\n"); ++ done = 1; ++ break; ++ } ++ ++ //fprintf(stderr, "not found\n"); ++ ++ n++; ++ } ++ ++ if(!done) ++ exit_error(OTHER_PROBLEM, ++ "Couldn't find a pattern definition file for %s.\n", s); ++ ++ /* process \xHH escapes and tolower everything. (our regex lib has no ++ case insensitivity option.) */ ++ strncpy(info->pattern, pre_process(info->pattern), MAX_PATTERN_LEN); ++} ++ ++/* Function which parses command options; returns true if it ate an option */ ++static int parse(int c, char **argv, int invert, unsigned int *flags, ++ const struct ipt_entry *entry, unsigned int *nfcache, ++ struct ipt_entry_match **match) ++{ ++ struct ipt_layer7_info *layer7info = ++ (struct ipt_layer7_info *)(*match)->data; ++ ++ switch (c) { ++ case '1': ++ check_inverse(optarg, &invert, &optind, 0); ++ parse_layer7_protocol(argv[optind-1], layer7info); ++ if (invert) ++ layer7info->invert = 1; ++ *flags = 1; ++ break; ++ ++ case '2': ++ /* not going to use this, but maybe we need to strip a ! anyway (?) */ ++ check_inverse(optarg, &invert, &optind, 0); ++ ++ if(strlen(argv[optind-1]) >= MAX_FN_LEN) ++ exit_error(PARAMETER_PROBLEM, "directory name too long\n"); ++ ++ strncpy(l7dir, argv[optind-1], MAX_FN_LEN); ++ ++ *flags = 1; ++ break; ++ case '3': ++ layer7info->pkt = 1; ++ break; ++ ++ default: ++ return 0; ++ } ++ ++ return 1; ++} ++ ++/* Final check; must have specified --pattern. */ ++static void final_check(unsigned int flags) ++{ ++ if (!flags) ++ exit_error(PARAMETER_PROBLEM, ++ "LAYER7 match: You must specify `--pattern'"); ++} ++ ++static void print_protocol(char s[], int invert, int numeric) ++{ ++ fputs("l7proto ", stdout); ++ if (invert) fputc('!', stdout); ++ printf("%s ", s); ++} ++ ++/* Prints out the matchinfo. */ ++static void print(const struct ipt_ip *ip, ++ const struct ipt_entry_match *match, ++ int numeric) ++{ ++ printf("LAYER7 "); ++ ++ print_protocol(((struct ipt_layer7_info *)match->data)->protocol, ++ ((struct ipt_layer7_info *)match->data)->invert, numeric); ++ ++ if (((struct ipt_layer7_info *)match->data)->pkt) ++ printf("l7pkt "); ++} ++/* Saves the union ipt_matchinfo in parsable form to stdout. */ ++static void save(const struct ipt_ip *ip, const struct ipt_entry_match *match) ++{ ++ const struct ipt_layer7_info *info = ++ (const struct ipt_layer7_info*) match->data; ++ ++ printf("--l7proto %s%s ", (info->invert) ? "! ": "", info->protocol); ++} ++ ++static struct iptables_match layer7 = { ++ .name = "layer7", ++ .version = IPTABLES_VERSION, ++ .size = IPT_ALIGN(sizeof(struct ipt_layer7_info)), ++ .userspacesize = IPT_ALIGN(sizeof(struct ipt_layer7_info)), ++ .help = &help, ++ .parse = &parse, ++ .final_check = &final_check, ++ .print = &print, ++ .save = &save, ++ .extra_opts = opts ++}; ++ ++void _init(void) ++{ ++ register_match(&layer7); ++} +diff -urN iptables.old/extensions/libipt_layer7.man iptables.dev/extensions/libipt_layer7.man +--- iptables.old/extensions/libipt_layer7.man 1970-01-01 01:00:00.000000000 +0100 ++++ iptables.dev/extensions/libipt_layer7.man 2005-11-10 16:57:51.823381250 +0100 +@@ -0,0 +1,13 @@ ++This module matches packets based on the application layer data of ++their connections. It uses regular expression matching to compare ++the application layer data to regular expressions found it the layer7 ++configuration files. This is an experimental module which can be found at ++http://l7-filter.sf.net. It takes two options. ++.TP ++.BI "--l7proto " "\fIprotocol\fP" ++Match the specified protocol. The protocol name must match a file ++name in /etc/l7-protocols/ ++.TP ++.BI "--l7dir " "\fIdirectory\fP" ++Use \fIdirectory\fP instead of /etc/l7-protocols/ ++ diff --git a/package/iptables/patches/04-multiport_v1.patch b/package/iptables/patches/04-multiport_v1.patch new file mode 100644 index 0000000000..90b5144c75 --- /dev/null +++ b/package/iptables/patches/04-multiport_v1.patch @@ -0,0 +1,221 @@ +diff -urN iptables.old/extensions/libipt_multiport.c iptables.dev/extensions/libipt_multiport.c +--- iptables.old/extensions/libipt_multiport.c 2005-02-19 20:19:17.000000000 +0100 ++++ iptables.dev/extensions/libipt_multiport.c 2006-02-04 05:46:12.154127750 +0100 +@@ -8,24 +8,6 @@ + /* To ensure that iptables compiles with an old kernel */ + #include "../include/linux/netfilter_ipv4/ipt_multiport.h" + +-/* Function which prints out usage message. */ +-static void +-help(void) +-{ +- printf( +-"multiport v%s options:\n" +-" --source-ports port[,port,port...]\n" +-" --sports ...\n" +-" match source port(s)\n" +-" --destination-ports port[,port,port...]\n" +-" --dports ...\n" +-" match destination port(s)\n" +-" --ports port[,port,port]\n" +-" match both source and destination port(s)\n" +-" NOTE: this kernel does not support port ranges in multiport.\n", +-IPTABLES_VERSION); +-} +- + static void + help_v1(void) + { +@@ -75,26 +57,6 @@ + "invalid port/service `%s' specified", port); + } + +-static unsigned int +-parse_multi_ports(const char *portstring, u_int16_t *ports, const char *proto) +-{ +- char *buffer, *cp, *next; +- unsigned int i; +- +- buffer = strdup(portstring); +- if (!buffer) exit_error(OTHER_PROBLEM, "strdup failed"); +- +- for (cp=buffer, i=0; cp && i<IPT_MULTI_PORTS; cp=next,i++) +- { +- next=strchr(cp, ','); +- if (next) *next++='\0'; +- ports[i] = parse_port(cp, proto); +- } +- if (cp) exit_error(PARAMETER_PROBLEM, "too many ports specified"); +- free(buffer); +- return i; +-} +- + static void + parse_multi_ports_v1(const char *portstring, + struct ipt_multiport_v1 *multiinfo, +@@ -160,58 +122,6 @@ + "multiport only works with TCP or UDP"); + } + +-/* Function which parses command options; returns true if it +- ate an option */ +-static int +-parse(int c, char **argv, int invert, unsigned int *flags, +- const struct ipt_entry *entry, +- unsigned int *nfcache, +- struct ipt_entry_match **match) +-{ +- const char *proto; +- struct ipt_multiport *multiinfo +- = (struct ipt_multiport *)(*match)->data; +- +- switch (c) { +- case '1': +- check_inverse(argv[optind-1], &invert, &optind, 0); +- proto = check_proto(entry); +- multiinfo->count = parse_multi_ports(argv[optind-1], +- multiinfo->ports, proto); +- multiinfo->flags = IPT_MULTIPORT_SOURCE; +- break; +- +- case '2': +- check_inverse(argv[optind-1], &invert, &optind, 0); +- proto = check_proto(entry); +- multiinfo->count = parse_multi_ports(argv[optind-1], +- multiinfo->ports, proto); +- multiinfo->flags = IPT_MULTIPORT_DESTINATION; +- break; +- +- case '3': +- check_inverse(argv[optind-1], &invert, &optind, 0); +- proto = check_proto(entry); +- multiinfo->count = parse_multi_ports(argv[optind-1], +- multiinfo->ports, proto); +- multiinfo->flags = IPT_MULTIPORT_EITHER; +- break; +- +- default: +- return 0; +- } +- +- if (invert) +- exit_error(PARAMETER_PROBLEM, +- "multiport does not support invert"); +- +- if (*flags) +- exit_error(PARAMETER_PROBLEM, +- "multiport can only have one option"); +- *flags = 1; +- return 1; +-} +- + static int + parse_v1(int c, char **argv, int invert, unsigned int *flags, + const struct ipt_entry *entry, +@@ -289,43 +199,6 @@ + printf("%s", service); + } + +-/* Prints out the matchinfo. */ +-static void +-print(const struct ipt_ip *ip, +- const struct ipt_entry_match *match, +- int numeric) +-{ +- const struct ipt_multiport *multiinfo +- = (const struct ipt_multiport *)match->data; +- unsigned int i; +- +- printf("multiport "); +- +- switch (multiinfo->flags) { +- case IPT_MULTIPORT_SOURCE: +- printf("sports "); +- break; +- +- case IPT_MULTIPORT_DESTINATION: +- printf("dports "); +- break; +- +- case IPT_MULTIPORT_EITHER: +- printf("ports "); +- break; +- +- default: +- printf("ERROR "); +- break; +- } +- +- for (i=0; i < multiinfo->count; i++) { +- printf("%s", i ? "," : ""); +- print_port(multiinfo->ports[i], ip->proto, numeric); +- } +- printf(" "); +-} +- + static void + print_v1(const struct ipt_ip *ip, + const struct ipt_entry_match *match, +@@ -369,34 +242,6 @@ + printf(" "); + } + +-/* Saves the union ipt_matchinfo in parsable form to stdout. */ +-static void save(const struct ipt_ip *ip, const struct ipt_entry_match *match) +-{ +- const struct ipt_multiport *multiinfo +- = (const struct ipt_multiport *)match->data; +- unsigned int i; +- +- switch (multiinfo->flags) { +- case IPT_MULTIPORT_SOURCE: +- printf("--sports "); +- break; +- +- case IPT_MULTIPORT_DESTINATION: +- printf("--dports "); +- break; +- +- case IPT_MULTIPORT_EITHER: +- printf("--ports "); +- break; +- } +- +- for (i=0; i < multiinfo->count; i++) { +- printf("%s", i ? "," : ""); +- print_port(multiinfo->ports[i], ip->proto, 1); +- } +- printf(" "); +-} +- + static void save_v1(const struct ipt_ip *ip, + const struct ipt_entry_match *match) + { +@@ -432,19 +277,20 @@ + printf(" "); + } + ++ + static struct iptables_match multiport = { + .next = NULL, + .name = "multiport", +- .revision = 0, + .version = IPTABLES_VERSION, +- .size = IPT_ALIGN(sizeof(struct ipt_multiport)), +- .userspacesize = IPT_ALIGN(sizeof(struct ipt_multiport)), +- .help = &help, ++ .revision = 0, ++ .size = IPT_ALIGN(sizeof(struct ipt_multiport_v1)), ++ .userspacesize = IPT_ALIGN(sizeof(struct ipt_multiport_v1)), ++ .help = &help_v1, + .init = &init, +- .parse = &parse, ++ .parse = &parse_v1, + .final_check = &final_check, +- .print = &print, +- .save = &save, ++ .print = &print_v1, ++ .save = &save_v1, + .extra_opts = opts + }; + diff --git a/package/iptables/patches/05-imq1.patch b/package/iptables/patches/05-imq1.patch new file mode 100644 index 0000000000..4591890304 --- /dev/null +++ b/package/iptables/patches/05-imq1.patch @@ -0,0 +1,224 @@ +diff -urN iptables.old/extensions/.IMQ-test iptables.dev/extensions/.IMQ-test +--- iptables.old/extensions/.IMQ-test 1970-01-01 01:00:00.000000000 +0100 ++++ iptables.dev/extensions/.IMQ-test 2005-10-09 01:00:36.358959750 +0200 +@@ -0,0 +1,3 @@ ++#!/bin/sh ++# True if IMQ target patch is applied. ++[ -f $KERNEL_DIR/net/ipv4/netfilter/ipt_IMQ.c ] && echo IMQ +diff -urN iptables.old/extensions/.IMQ-test6 iptables.dev/extensions/.IMQ-test6 +--- iptables.old/extensions/.IMQ-test6 1970-01-01 01:00:00.000000000 +0100 ++++ iptables.dev/extensions/.IMQ-test6 2005-10-09 01:00:36.358959750 +0200 +@@ -0,0 +1,3 @@ ++#!/bin/sh ++# True if IMQ target patch is applied. ++[ -f $KERNEL_DIR/net/ipv6/netfilter/ip6t_IMQ.c ] && echo IMQ +diff -urN iptables.old/extensions/libip6t_IMQ.c iptables.dev/extensions/libip6t_IMQ.c +--- iptables.old/extensions/libip6t_IMQ.c 1970-01-01 01:00:00.000000000 +0100 ++++ iptables.dev/extensions/libip6t_IMQ.c 2005-10-09 01:00:36.358959750 +0200 +@@ -0,0 +1,101 @@ ++/* Shared library add-on to iptables to add IMQ target support. */ ++#include <stdio.h> ++#include <string.h> ++#include <stdlib.h> ++#include <getopt.h> ++ ++#include <ip6tables.h> ++#include <linux/netfilter_ipv6/ip6_tables.h> ++#include <linux/netfilter_ipv6/ip6t_IMQ.h> ++ ++/* Function which prints out usage message. */ ++static void ++help(void) ++{ ++ printf( ++"IMQ target v%s options:\n" ++" --todev <N> enqueue to imq<N>, defaults to 0\n", ++IPTABLES_VERSION); ++} ++ ++static struct option opts[] = { ++ { "todev", 1, 0, '1' }, ++ { 0 } ++}; ++ ++/* Initialize the target. */ ++static void ++init(struct ip6t_entry_target *t, unsigned int *nfcache) ++{ ++ struct ip6t_imq_info *mr = (struct ip6t_imq_info*)t->data; ++ ++ mr->todev = 0; ++ *nfcache |= NFC_UNKNOWN; ++} ++ ++/* Function which parses command options; returns true if it ++ ate an option */ ++static int ++parse(int c, char **argv, int invert, unsigned int *flags, ++ const struct ip6t_entry *entry, ++ struct ip6t_entry_target **target) ++{ ++ struct ip6t_imq_info *mr = (struct ip6t_imq_info*)(*target)->data; ++ ++ switch(c) { ++ case '1': ++ if (check_inverse(optarg, &invert, NULL, 0)) ++ exit_error(PARAMETER_PROBLEM, ++ "Unexpected `!' after --todev"); ++ mr->todev=atoi(optarg); ++ break; ++ default: ++ return 0; ++ } ++ return 1; ++} ++ ++static void ++final_check(unsigned int flags) ++{ ++} ++ ++/* Prints out the targinfo. */ ++static void ++print(const struct ip6t_ip6 *ip, ++ const struct ip6t_entry_target *target, ++ int numeric) ++{ ++ struct ip6t_imq_info *mr = (struct ip6t_imq_info*)target->data; ++ ++ printf("IMQ: todev %u ", mr->todev); ++} ++ ++/* Saves the union ipt_targinfo in parsable form to stdout. */ ++static void ++save(const struct ip6t_ip6 *ip, const struct ip6t_entry_target *target) ++{ ++ struct ip6t_imq_info *mr = (struct ip6t_imq_info*)target->data; ++ ++ printf("--todev %u", mr->todev); ++} ++ ++static struct ip6tables_target imq = { ++ .next = NULL, ++ .name = "IMQ", ++ .version = IPTABLES_VERSION, ++ .size = IP6T_ALIGN(sizeof(struct ip6t_imq_info)), ++ .userspacesize = IP6T_ALIGN(sizeof(struct ip6t_imq_info)), ++ .help = &help, ++ .init = &init, ++ .parse = &parse, ++ .final_check = &final_check, ++ .print = &print, ++ .save = &save, ++ .extra_opts = opts ++}; ++ ++void _init(void) ++{ ++ register_target6(&imq); ++} +diff -urN iptables.old/extensions/libipt_IMQ.c iptables.dev/extensions/libipt_IMQ.c +--- iptables.old/extensions/libipt_IMQ.c 1970-01-01 01:00:00.000000000 +0100 ++++ iptables.dev/extensions/libipt_IMQ.c 2005-10-09 01:00:36.358959750 +0200 +@@ -0,0 +1,101 @@ ++/* Shared library add-on to iptables to add IMQ target support. */ ++#include <stdio.h> ++#include <string.h> ++#include <stdlib.h> ++#include <getopt.h> ++ ++#include <iptables.h> ++#include <linux/netfilter_ipv4/ip_tables.h> ++#include <linux/netfilter_ipv4/ipt_IMQ.h> ++ ++/* Function which prints out usage message. */ ++static void ++help(void) ++{ ++ printf( ++"IMQ target v%s options:\n" ++" --todev <N> enqueue to imq<N>, defaults to 0\n", ++IPTABLES_VERSION); ++} ++ ++static struct option opts[] = { ++ { "todev", 1, 0, '1' }, ++ { 0 } ++}; ++ ++/* Initialize the target. */ ++static void ++init(struct ipt_entry_target *t, unsigned int *nfcache) ++{ ++ struct ipt_imq_info *mr = (struct ipt_imq_info*)t->data; ++ ++ mr->todev = 0; ++ *nfcache |= NFC_UNKNOWN; ++} ++ ++/* Function which parses command options; returns true if it ++ ate an option */ ++static int ++parse(int c, char **argv, int invert, unsigned int *flags, ++ const struct ipt_entry *entry, ++ struct ipt_entry_target **target) ++{ ++ struct ipt_imq_info *mr = (struct ipt_imq_info*)(*target)->data; ++ ++ switch(c) { ++ case '1': ++ if (check_inverse(optarg, &invert, NULL, 0)) ++ exit_error(PARAMETER_PROBLEM, ++ "Unexpected `!' after --todev"); ++ mr->todev=atoi(optarg); ++ break; ++ default: ++ return 0; ++ } ++ return 1; ++} ++ ++static void ++final_check(unsigned int flags) ++{ ++} ++ ++/* Prints out the targinfo. */ ++static void ++print(const struct ipt_ip *ip, ++ const struct ipt_entry_target *target, ++ int numeric) ++{ ++ struct ipt_imq_info *mr = (struct ipt_imq_info*)target->data; ++ ++ printf("IMQ: todev %u ", mr->todev); ++} ++ ++/* Saves the union ipt_targinfo in parsable form to stdout. */ ++static void ++save(const struct ipt_ip *ip, const struct ipt_entry_target *target) ++{ ++ struct ipt_imq_info *mr = (struct ipt_imq_info*)target->data; ++ ++ printf("--todev %u", mr->todev); ++} ++ ++static struct iptables_target imq = { ++ .next = NULL, ++ .name = "IMQ", ++ .version = IPTABLES_VERSION, ++ .size = IPT_ALIGN(sizeof(struct ipt_imq_info)), ++ .userspacesize = IPT_ALIGN(sizeof(struct ipt_imq_info)), ++ .help = &help, ++ .init = &init, ++ .parse = &parse, ++ .final_check = &final_check, ++ .print = &print, ++ .save = &save, ++ .extra_opts = opts ++}; ++ ++void _init(void) ++{ ++ register_target(&imq); ++} diff --git a/package/isakmpd/Makefile b/package/isakmpd/Makefile new file mode 100644 index 0000000000..a4e7ff7b03 --- /dev/null +++ b/package/isakmpd/Makefile @@ -0,0 +1,51 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id: Makefile 4619 2006-08-22 09:50:02Z florian $ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=isakmpd +PKG_VERSION:=20041012 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).orig.tar.gz +PKG_SOURCE_URL:=http://ftp.debian.org/debian/pool/main/i/isakmpd/ +PKG_MD5SUM:=e6d25a9e232fb186e1a48dc06453bd57 +PKG_CAT:=zcat + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION).orig +PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/kernel.mk + +define Package/isakmpd + SECTION:=net + CATEGORY:=Network + DEPENDS:=@BROKEN @LINUX_2_6 +libopenssl +keynote +libgmp + TITLE:=IPsec management tools + URL:=http://isakmpd.sourceforge.net/ +endef + +define Build/Compile + $(call Build/Compile/Default,LINUX_DIR="$(LINUX_DIR)" \ + STAGING_DIR="$(STAGING_DIR)" \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + ) + $(MAKE) -C $(PKG_BUILD_DIR) \ + STAGING_DIR="$(STAGING_DIR)" \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + INSTALL="install -c" \ + install-bin +endef + +define Package/isakmpd/install + install -d -m0755 $(1)/usr/sbin + $(CP) $(PKG_INSTALL_DIR)/* $(1)/ +endef + +$(eval $(call BuildPackage,isakmpd)) diff --git a/package/isakmpd/patches/010-debian_3.patch b/package/isakmpd/patches/010-debian_3.patch new file mode 100644 index 0000000000..551ae1ffcd --- /dev/null +++ b/package/isakmpd/patches/010-debian_3.patch @@ -0,0 +1,1706 @@ +--- isakmpd-20041012.orig/dpd.c ++++ isakmpd-20041012/dpd.c +@@ -26,6 +26,7 @@ + + #include <sys/types.h> + #include <stdlib.h> ++#include <memory.h> + + #include "sysdep.h" + +@@ -174,6 +175,7 @@ + } + break; + default: ++ ; + } + + /* Mark handled. */ +@@ -223,6 +225,7 @@ + dpd_check_event, sa, &tv); + break; + default: ++ ; + } + if (!sa->dpd_event) + log_print("dpd_timer_reset: timer_add_event failed"); +--- isakmpd-20041012.orig/ipsec.c ++++ isakmpd-20041012/ipsec.c +@@ -1020,6 +1020,52 @@ + } + } + ++/* ++ * deal with a NOTIFY of INVALID_SPI ++ */ ++static void ++ipsec_invalid_spi (struct message *msg, struct payload *p) ++{ ++ struct sockaddr *dst; ++ int invspisz, off; ++ u_int32_t spi; ++ u_int16_t totsiz; ++ u_int8_t spisz; ++ ++ /* Any notification that make us do something should be protected */ ++ if(!TAILQ_FIRST (&msg->payload[ISAKMP_PAYLOAD_HASH])) ++ { ++ LOG_DBG ((LOG_SA, 40, ++ "ipsec_invalid_spi: missing HASH payload in INVALID_SPI" ++ " notification")); ++ return; ++ } ++ ++ /* ++ * get the invalid spi out of the variable sized notification data ++ * field, which is after the variable sized SPI field [which specifies ++ * the receiving entity's phase-1 SPI, not the invalid spi] ++ */ ++ totsiz = GET_ISAKMP_GEN_LENGTH (p->p); ++ spisz = GET_ISAKMP_NOTIFY_SPI_SZ (p->p); ++ off = ISAKMP_NOTIFY_SPI_OFF + spisz; ++ invspisz = totsiz - off; ++ ++ if (invspisz != sizeof spi) ++ { ++ LOG_DBG ((LOG_SA, 40, ++ "ipsec_invalid_spi: SPI size %d in INVALID_SPI " ++ "payload unsupported", spisz)); ++ return; ++ } ++ memcpy (&spi, p->p + off, sizeof spi); ++ ++ msg->transport->vtbl->get_dst (msg->transport, &dst); ++ ++ /* delete matching SPI's from this peer */ ++ ipsec_delete_spi_list (dst, 0, (u_int8_t *)&spi, 1, "INVALID_SPI"); ++} ++ + static int + ipsec_responder(struct message *msg) + { +@@ -1205,7 +1251,9 @@ + return dv != IPSEC_ENCAP_TUNNEL + && dv != IPSEC_ENCAP_TRANSPORT + && dv != IPSEC_ENCAP_UDP_ENCAP_TUNNEL +- && dv != IPSEC_ENCAP_UDP_ENCAP_TRANSPORT; ++ && dv != IPSEC_ENCAP_UDP_ENCAP_TRANSPORT ++ && dv != IPSEC_ENCAP_UDP_ENCAP_TUNNEL_DRAFT ++ && dv != IPSEC_ENCAP_UDP_ENCAP_TRANSPORT_DRAFT; + #else + return dv < IPSEC_ENCAP_TUNNEL + || dv > IPSEC_ENCAP_TRANSPORT; +@@ -1837,7 +1885,7 @@ + ipsec_get_id(char *section, int *id, struct sockaddr **addr, + struct sockaddr **mask, u_int8_t *tproto, u_int16_t *port) + { +- char *type, *address, *netmask; ++ char *type, *address, *netmask; + + type = conf_get_str(section, "ID-type"); + if (!type) { +--- isakmpd-20041012.orig/GNUmakefile ++++ isakmpd-20041012/GNUmakefile +@@ -40,12 +40,12 @@ + # integrated, freebsd/netbsd means FreeBSD/NetBSD with KAME IPsec. + # darwin means MacOS X 10.2 and later with KAME IPsec. linux means Linux-2.5 + # and later with native IPSec support. +-OS= openbsd ++#OS= openbsd + #OS= netbsd + #OS= freebsd + #OS= freeswan + #OS= darwin +-#OS= linux ++OS= linux + + .CURDIR:= $(shell pwd) + VPATH= ${.CURDIR}/sysdep/${OS} +@@ -55,9 +55,10 @@ + ifndef BINDIR + BINDIR= /sbin + endif +-ifndef LDSTATIC +-LDSTATIC= -static +-endif ++ ++#ifndef LDSTATIC ++#LDSTATIC= -static ++#endif + + SRCS= app.c attribute.c cert.c connection.c \ + constants.c conf.c cookie.c crypto.c dh.c doi.c exchange.c \ +@@ -131,11 +132,14 @@ + ifneq ($(findstring install,$(MAKECMDGOALS)),install) + # Skip 'regress' until the regress/ structure has gmake makefiles for it. + #SUBDIR:= regress +-SUBDIR:= ++#SUBDIR:= apps/certpatch + mksubdirs: + $(foreach DIR, ${SUBDIR}, \ +- cd ${DIR}; ${MAKE} ${MAKEFLAGS} CFLAGS="${CFLAGS}" \ +- MKDEP="${MKDEP}" ${MAKECMDGOALS}) ++ cd ${.CURDIR}/${DIR}; ${MAKE} ${MAKECMDGOALS};) ++ ++# $(foreach DIR, ${SUBDIR}, \ ++# cd ${DIR}; ${MAKE} CFLAGS="${CFLAGS}" \ ++# MKDEP="${MKDEP}" ${MAKECMDGOALS}) + else + mksubdirs: + endif +@@ -173,7 +177,7 @@ + endif + + SRCS+= ${IPSEC_SRCS} ${X509} ${POLICY} ${EC} ${AGGRESSIVE} ${DNSSEC} \ +- $(ISAKMP_CFG) ++ $(ISAKMP_CFG) ${DPD} ${NAT_TRAVERSAL} + CFLAGS+= ${IPSEC_CFLAGS} + LDADD+= ${DESLIB} + DPADD+= ${DESLIBDEP} +--- isakmpd-20041012.orig/exchange.h ++++ isakmpd-20041012/exchange.h +@@ -221,6 +221,8 @@ + #define EXCHANGE_FLAG_NAT_T_ENABLE 0x10 /* We are doing NAT-T. */ + #define EXCHANGE_FLAG_NAT_T_KEEPALIVE 0x20 /* We are the NAT:ed peer. */ + #define EXCHANGE_FLAG_DPD_CAP_PEER 0x40 /* Peer is DPD capable. */ ++#define EXCHANGE_FLAG_NAT_T_RFC 0x0080 /* Peer does RFC NAT-T. */ ++#define EXCHANGE_FLAG_NAT_T_DRAFT 0x0100 /* Peer does draft NAT-T.*/ + + extern int exchange_add_certs(struct message *); + extern void exchange_finalize(struct message *); +--- isakmpd-20041012.orig/log.c ++++ isakmpd-20041012/log.c +@@ -79,7 +79,6 @@ + + struct packhdr { + struct pcap_pkthdr pcap;/* pcap file packet header */ +- u_int32_t sa_family; /* address family */ + union { + struct ip ip4; /* IPv4 header (w/o options) */ + struct ip6_hdr ip6; /* IPv6 header */ +@@ -97,7 +96,7 @@ + static u_int8_t *packet_buf = NULL; + + static int udp_cksum(struct packhdr *, const struct udphdr *, +- u_int16_t *); ++ u_int16_t *, int); + static u_int16_t in_cksum(const u_int16_t *, int); + #endif /* USE_DEBUG */ + +@@ -539,11 +538,9 @@ + udp.uh_ulen = htons(datalen); + + /* ip */ +- hdr.sa_family = htonl(src->sa_family); + switch (src->sa_family) { + default: + /* Assume IPv4. XXX Can 'default' ever happen here? */ +- hdr.sa_family = htonl(AF_INET); + hdr.ip.ip4.ip_src.s_addr = 0x02020202; + hdr.ip.ip4.ip_dst.s_addr = 0x01010101; + /* The rest of the setup is common to AF_INET. */ +@@ -584,9 +581,7 @@ + } + + /* Calculate UDP checksum. */ +- udp.uh_sum = udp_cksum(&hdr, &udp, (u_int16_t *) packet_buf); +- hdrlen += sizeof hdr.sa_family; +- ++ udp.uh_sum = udp_cksum(&hdr, &udp, (u_int16_t *) packet_buf, src->sa_family); + /* pcap file packet header */ + gettimeofday(&tv, 0); + hdr.pcap.ts.tv_sec = tv.tv_sec; +@@ -610,7 +605,7 @@ + + /* Copied from tcpdump/print-udp.c, mostly rewritten. */ + static int +-udp_cksum(struct packhdr *hdr, const struct udphdr *u, u_int16_t *d) ++udp_cksum(struct packhdr *hdr, const struct udphdr *u, u_int16_t *d, int af) + { + struct ip *ip4; + struct ip6_hdr *ip6; +@@ -639,7 +634,7 @@ + + /* Setup pseudoheader. */ + memset(phu.pa, 0, sizeof phu); +- switch (ntohl(hdr->sa_family)) { ++ switch (af) { + case AF_INET: + ip4 = &hdr->ip.ip4; + memcpy(&phu.ip4p.src, &ip4->ip_src, sizeof(struct in_addr)); +@@ -664,7 +659,7 @@ + + /* IPv6 wants a 0xFFFF checksum "on error", not 0x0. */ + if (tlen < 0) +- return (ntohl(hdr->sa_family) == AF_INET ? 0 : 0xFFFF); ++ return (af == AF_INET ? 0 : 0xFFFF); + + sum = 0; + for (i = 0; i < hdrlen; i += 2) +--- isakmpd-20041012.orig/nat_traversal.c ++++ isakmpd-20041012/nat_traversal.c +@@ -1,4 +1,4 @@ +-/* $OpenBSD: nat_traversal.c,v 1.7 2004/08/08 19:11:06 deraadt Exp $ */ ++/* $OpenBSD: nat_traversal.c,v 1.17 2006/06/14 14:03:33 hshoexer Exp $ */ + + /* + * Copyright (c) 2004 Håkan Olsson. All rights reserved. +@@ -48,40 +48,40 @@ + #include "util.h" + #include "virtual.h" + ++int disable_nat_t = 0; ++ + /* +- * XXX According to draft-ietf-ipsec-nat-t-ike-07.txt, the NAT-T +- * capability of the other peer is determined by a particular vendor ID +- * sent as the first message. This vendor ID string is supposed to be a +- * MD5 hash of "RFC XXXX", where XXXX is the future RFC number. ++ * NAT-T capability of the other peer is determined by a particular vendor ++ * ID sent in the first message. This vendor ID string is supposed to be a ++ * MD5 hash of "RFC 3947". + * + * These seem to be the "well" known variants of this string in use by + * products today. + */ +-static const char *isakmp_nat_t_cap_text[] = { +- "draft-ietf-ipsec-nat-t-ike-00", /* V1 (XXX: may be obsolete) */ +- "draft-ietf-ipsec-nat-t-ike-02\n", /* V2 */ +- "draft-ietf-ipsec-nat-t-ike-03", /* V3 */ +-#ifdef notyet +- "RFC XXXX", +-#endif ++ ++static struct nat_t_cap isakmp_nat_t_cap[] = { ++ { VID_DRAFT_V2_N, EXCHANGE_FLAG_NAT_T_DRAFT, ++ "draft-ietf-ipsec-nat-t-ike-02\n", NULL, 0 }, ++ { VID_DRAFT_V3, EXCHANGE_FLAG_NAT_T_DRAFT, ++ "draft-ietf-ipsec-nat-t-ike-03", NULL, 0 }, ++ { VID_RFC3947, EXCHANGE_FLAG_NAT_T_RFC, ++ "RFC 3947", NULL, 0 }, + }; + ++#define NUMNATTCAP (sizeof isakmp_nat_t_cap / sizeof isakmp_nat_t_cap[0]) ++ + /* In seconds. Recommended in draft-ietf-ipsec-udp-encaps-09. */ + #define NAT_T_KEEPALIVE_INTERVAL 20 + +-/* The MD5 hashes of the above strings is put in this array. */ +-static char **nat_t_hashes; +-static size_t nat_t_hashsize; +- + static int nat_t_setup_hashes(void); +-static int nat_t_add_vendor_payload(struct message *, char *); ++static int nat_t_add_vendor_payload(struct message *, struct nat_t_cap *); + static int nat_t_add_nat_d(struct message *, struct sockaddr *); + static int nat_t_match_nat_d_payload(struct message *, struct sockaddr *); + + void + nat_t_init(void) + { +- nat_t_hashes = (char **)NULL; ++ nat_t_setup_hashes(); + } + + /* Generate the NAT-T capability marker hashes. Executed only once. */ +@@ -89,7 +89,7 @@ + nat_t_setup_hashes(void) + { + struct hash *hash; +- int n = sizeof isakmp_nat_t_cap_text / sizeof isakmp_nat_t_cap_text[0]; ++ int n = NUMNATTCAP; + int i; + + /* The draft says to use MD5. */ +@@ -100,56 +100,49 @@ + "could not find MD5 hash structure!"); + return -1; + } +- nat_t_hashsize = hash->hashsize; + +- /* Allocate one more than is necessary, i.e NULL terminated. */ +- nat_t_hashes = (char **)calloc((size_t)(n + 1), sizeof(char *)); +- if (!nat_t_hashes) { +- log_error("nat_t_setup_hashes: calloc (%lu,%lu) failed", +- (unsigned long)n, (unsigned long)sizeof(char *)); +- return -1; +- } +- +- /* Populate with hashes. */ ++ /* Populate isakmp_nat_t_cap with hashes. */ + for (i = 0; i < n; i++) { +- nat_t_hashes[i] = (char *)malloc(nat_t_hashsize); +- if (!nat_t_hashes[i]) { ++ isakmp_nat_t_cap[i].hashsize = hash->hashsize; ++ isakmp_nat_t_cap[i].hash = (char *)malloc(hash->hashsize); ++ if (!isakmp_nat_t_cap[i].hash) { + log_error("nat_t_setup_hashes: malloc (%lu) failed", +- (unsigned long)nat_t_hashsize); ++ (unsigned long)hash->hashsize); + goto errout; + } + + hash->Init(hash->ctx); + hash->Update(hash->ctx, +- (unsigned char *)isakmp_nat_t_cap_text[i], +- strlen(isakmp_nat_t_cap_text[i])); +- hash->Final(nat_t_hashes[i], hash->ctx); ++ (unsigned char *)isakmp_nat_t_cap[i].text, ++ strlen(isakmp_nat_t_cap[i].text)); ++ hash->Final(isakmp_nat_t_cap[i].hash, hash->ctx); + + LOG_DBG((LOG_EXCHANGE, 50, "nat_t_setup_hashes: " +- "MD5(\"%s\") (%lu bytes)", isakmp_nat_t_cap_text[i], +- (unsigned long)nat_t_hashsize)); ++ "MD5(\"%s\") (%lu bytes)", isakmp_nat_t_cap[i].text, ++ (unsigned long)hash->hashsize)); + LOG_DBG_BUF((LOG_EXCHANGE, 50, "nat_t_setup_hashes", +- nat_t_hashes[i], nat_t_hashsize)); ++ isakmp_nat_t_cap[i].hash, hash->hashsize)); + } + + return 0; + +- errout: ++errout: + for (i = 0; i < n; i++) +- if (nat_t_hashes[i]) +- free(nat_t_hashes[i]); +- free(nat_t_hashes); +- nat_t_hashes = NULL; ++ if (isakmp_nat_t_cap[i].hash) ++ free(isakmp_nat_t_cap[i].hash); + return -1; + } + + /* Add one NAT-T VENDOR payload. */ + static int +-nat_t_add_vendor_payload(struct message *msg, char *hash) ++nat_t_add_vendor_payload(struct message *msg, struct nat_t_cap *cap) + { +- size_t buflen = nat_t_hashsize + ISAKMP_GEN_SZ; ++ size_t buflen = cap->hashsize + ISAKMP_GEN_SZ; + u_int8_t *buf; + ++ if (disable_nat_t) ++ return 0; ++ + buf = malloc(buflen); + if (!buf) { + log_error("nat_t_add_vendor_payload: malloc (%lu) failed", +@@ -158,12 +151,11 @@ + } + + SET_ISAKMP_GEN_LENGTH(buf, buflen); +- memcpy(buf + ISAKMP_VENDOR_ID_OFF, hash, nat_t_hashsize); ++ memcpy(buf + ISAKMP_VENDOR_ID_OFF, cap->hash, cap->hashsize); + if (message_add_payload(msg, ISAKMP_PAYLOAD_VENDOR, buf, buflen, 1)) { + free(buf); + return -1; + } +- + return 0; + } + +@@ -171,16 +163,14 @@ + int + nat_t_add_vendor_payloads(struct message *msg) + { +- int i = 0; ++ int i; + +- if (!nat_t_hashes) +- if (nat_t_setup_hashes()) +- return 0; /* XXX should this be an error? */ ++ if (disable_nat_t) ++ return 0; + +- while (nat_t_hashes[i]) +- if (nat_t_add_vendor_payload(msg, nat_t_hashes[i++])) ++ for (i = 0; i < NUMNATTCAP; i++) ++ if (nat_t_add_vendor_payload(msg, &isakmp_nat_t_cap[i])) + return -1; +- + return 0; + } + +@@ -192,36 +182,31 @@ + { + u_int8_t *pbuf = p->p; + size_t vlen; +- int i = 0; ++ int i; + +- /* Already checked? */ +- if (p->flags & PL_MARK || +- msg->exchange->flags & EXCHANGE_FLAG_NAT_T_CAP_PEER) ++ if (disable_nat_t) + return; + +- if (!nat_t_hashes) +- if (nat_t_setup_hashes()) +- return; +- + vlen = GET_ISAKMP_GEN_LENGTH(pbuf) - ISAKMP_GEN_SZ; +- if (vlen != nat_t_hashsize) { +- LOG_DBG((LOG_EXCHANGE, 50, "nat_t_check_vendor_payload: " +- "bad size %lu != %lu", (unsigned long)vlen, +- (unsigned long)nat_t_hashsize)); +- return; +- } + +- while (nat_t_hashes[i]) +- if (memcmp(nat_t_hashes[i++], pbuf + ISAKMP_GEN_SZ, ++ for (i = 0; i < NUMNATTCAP; i++) { ++ if (vlen != isakmp_nat_t_cap[i].hashsize) { ++ LOG_DBG((LOG_EXCHANGE, 50, "nat_t_check_vendor_payload: " ++ "bad size %lu != %lu", (unsigned long)vlen, ++ (unsigned long)isakmp_nat_t_cap[i].hashsize)); ++ continue; ++ } ++ if (memcmp(isakmp_nat_t_cap[i].hash, pbuf + ISAKMP_GEN_SZ, + vlen) == 0) { + /* This peer is NAT-T capable. */ + msg->exchange->flags |= EXCHANGE_FLAG_NAT_T_CAP_PEER; ++ msg->exchange->flags |= isakmp_nat_t_cap[i].flags; + LOG_DBG((LOG_EXCHANGE, 10, + "nat_t_check_vendor_payload: " + "NAT-T capable peer detected")); + p->flags |= PL_MARK; +- return; + } ++ } + + return; + } +@@ -233,10 +218,8 @@ + { + struct ipsec_exch *ie = (struct ipsec_exch *)msg->exchange->data; + struct hash *hash; +- struct prf *prf; + u_int8_t *res; + in_port_t port; +- int prf_type = PRF_HMAC; /* XXX */ + + hash = hash_get(ie->hash->type); + if (hash == NULL) { +@@ -244,31 +227,25 @@ + return NULL; + } + +- prf = prf_alloc(prf_type, hash->type, msg->exchange->cookies, +- ISAKMP_HDR_COOKIES_LEN); +- if(!prf) { +- log_print("nat_t_generate_nat_d_hash: prf_alloc failed"); +- return NULL; +- } ++ *hashlen = hash->hashsize; + +- *hashlen = prf->blocksize; + res = (u_int8_t *)malloc((unsigned long)*hashlen); + if (!res) { + log_print("nat_t_generate_nat_d_hash: malloc (%lu) failed", + (unsigned long)*hashlen); +- prf_free(prf); + *hashlen = 0; + return NULL; + } + + port = sockaddr_port(sa); +- memset(res, 0, *hashlen); +- +- prf->Update(prf->prfctx, sockaddr_addrdata(sa), sockaddr_addrlen(sa)); +- prf->Update(prf->prfctx, (unsigned char *)&port, sizeof port); +- prf->Final(res, prf->prfctx); +- prf_free (prf); ++ bzero(res, *hashlen); + ++ hash->Init(hash->ctx); ++ hash->Update(hash->ctx, msg->exchange->cookies, ++ sizeof msg->exchange->cookies); ++ hash->Update(hash->ctx, sockaddr_addrdata(sa), sockaddr_addrlen(sa)); ++ hash->Update(hash->ctx, (unsigned char *)&port, sizeof port); ++ hash->Final(res, hash->ctx); + return res; + } + +@@ -276,6 +253,7 @@ + static int + nat_t_add_nat_d(struct message *msg, struct sockaddr *sa) + { ++ int ret; + u_int8_t *hbuf, *buf; + size_t hbuflen, buflen; + +@@ -298,11 +276,19 @@ + memcpy(buf + ISAKMP_NAT_D_DATA_OFF, hbuf, hbuflen); + free(hbuf); + +- if (message_add_payload(msg, ISAKMP_PAYLOAD_NAT_D, buf, buflen, 1)) { ++ if (msg->exchange->flags & EXCHANGE_FLAG_NAT_T_RFC) ++ ret = message_add_payload(msg, ISAKMP_PAYLOAD_NAT_D, buf, ++ buflen, 1); ++ else if (msg->exchange->flags & EXCHANGE_FLAG_NAT_T_DRAFT) ++ ret = message_add_payload(msg, ISAKMP_PAYLOAD_NAT_D_DRAFT, ++ buf, buflen, 1); ++ else ++ ret = -1; ++ ++ if (ret) { + free(buf); + return -1; + } +- + return 0; + } + +@@ -312,14 +298,14 @@ + { + struct sockaddr *sa; + +- msg->transport->vtbl->get_src(msg->transport, &sa); ++ /* Remote address first. */ ++ msg->transport->vtbl->get_dst(msg->transport, &sa); + if (nat_t_add_nat_d(msg, sa)) + return -1; + +- msg->transport->vtbl->get_dst(msg->transport, &sa); ++ msg->transport->vtbl->get_src(msg->transport, &sa); + if (nat_t_add_nat_d(msg, sa)) + return -1; +- + return 0; + } + +@@ -336,8 +322,8 @@ + * If there are no NAT-D payloads in the message, return "found" + * as this will avoid NAT-T (see nat_t_exchange_check_nat_d()). + */ +- p = payload_first(msg, ISAKMP_PAYLOAD_NAT_D); +- if (!p) ++ if ((p = payload_first(msg, ISAKMP_PAYLOAD_NAT_D_DRAFT)) == NULL && ++ (p = payload_first(msg, ISAKMP_PAYLOAD_NAT_D)) == NULL) + return 1; + + hbuf = nat_t_generate_nat_d_hash(msg, sa, &hbuflen); +--- isakmpd-20041012.orig/udp_encap.c ++++ isakmpd-20041012/udp_encap.c +@@ -61,6 +61,11 @@ + + #define UDP_SIZE 65536 + ++#if defined(USE_NAT_TRAVERSAL) && defined (LINUX_IPSEC) ++#include <linux/socket.h> ++#include <linux/udp.h> ++#endif ++ + /* If a system doesn't have SO_REUSEPORT, SO_REUSEADDR will have to do. */ + #ifndef SO_REUSEPORT + #define SO_REUSEPORT SO_REUSEADDR +@@ -134,6 +139,18 @@ + if (sysdep_cleartext(s, laddr->sa_family) == -1) + goto err; + ++#if defined(USE_NAT_TRAVERSAL) && defined (LINUX_IPSEC) ++ { ++#ifndef SOL_UDP ++#define SOL_UDP 17 ++#endif ++ int option = UDP_ENCAP_ESPINUDP; ++ if(setsockopt(s, SOL_UDP, UDP_ENCAP, &option, ++ sizeof (option)) < 0) ++ goto err; ++ } ++#endif ++ + /* Wildcard address ? */ + switch (laddr->sa_family) { + case AF_INET: +--- isakmpd-20041012.orig/apps/Makefile ++++ isakmpd-20041012/apps/Makefile +@@ -31,4 +31,4 @@ + + SUBDIR= certpatch + +-.include <bsd.subdir.mk> ++#.include <bsd.subdir.mk> +--- isakmpd-20041012.orig/apps/certpatch/GNUmakefile ++++ isakmpd-20041012/apps/certpatch/GNUmakefile +@@ -0,0 +1,55 @@ ++# $OpenBSD: Makefile,v 1.7 2003/06/03 14:35:00 ho Exp $ ++# $EOM: Makefile,v 1.6 2000/03/28 21:22:06 ho Exp $ ++ ++# ++# Copyright (c) 1999 Niels Provos. All rights reserved. ++# Copyright (c) 2001 Niklas Hallqvist. All rights reserved. ++# ++# Redistribution and use in source and binary forms, with or without ++# modification, are permitted provided that the following conditions ++# are met: ++# 1. Redistributions of source code must retain the above copyright ++# notice, this list of conditions and the following disclaimer. ++# 2. Redistributions in binary form must reproduce the above copyright ++# notice, this list of conditions and the following disclaimer in the ++# documentation and/or other materials provided with the distribution. ++# ++# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR ++# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES ++# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ++# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, ++# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT ++# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ++# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ++# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF ++# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++# ++ ++# ++# This code was written under funding by Ericsson Radio Systems. ++# ++ ++PROG= certpatch ++SRCS= certpatch.c ++BINDIR?= /usr/sbin ++TOPSRC= ${.CURDIR}../.. ++TOPOBJ!= cd ${TOPSRC}; printf "all:\n\t@pwd\n" |${MAKE} -f- ++OS= linux ++FEATURES!= awk '/^FEATURES=/ { print $$0 }' ${.CURDIR}/../../Makefile | sed 's/FEATURES=.//' ++.PATH: ${TOPSRC} ${TOPSRC}/sysdep/${OS} ${TOPOBJ} ++CFLAGS+= -I${TOPSRC} -I${TOPSRC}/sysdep/${OS} -I${TOPOBJ} -Wall ++LDFLAGS+= -lcrypto -lssl -lgmp ++MAN= certpatch.8 ++ ++CFLAGS+= -DMP_FLAVOUR=MP_FLAVOUR_GMP ++LDADD+= -lgmp ++DPADD+= ${LIBGMP} ++ ++# Override LIBSYSDEPDIR definition from Makefile.sysdep ++LIBSYSDEPDIR= ${TOPSRC}/sysdep/common/libsysdep ++ ++all: ${PROG} ++ ++clean: ++ rm -f ${PROG} +--- isakmpd-20041012.orig/pf_key_v2.c ++++ isakmpd-20041012/pf_key_v2.c +@@ -1055,6 +1055,10 @@ + #endif + #if defined (USE_NAT_TRAVERSAL) && defined (SADB_X_EXT_UDPENCAP) + struct sadb_x_udpencap udpencap; ++#elif defined (USE_NAT_TRAVERSAL) && defined (SADB_X_EXT_NAT_T_TYPE) ++ struct sadb_x_nat_t_type nat_t_type; ++ struct sadb_x_nat_t_port nat_t_sport; ++ struct sadb_x_nat_t_port nat_t_dport; + #endif + #ifdef USE_DEBUG + char *addr_str; +@@ -1273,10 +1277,15 @@ + log_print("pf_key_v2_set_spi: invalid proto %d", proto->proto); + goto cleanup; + } +- if (incoming) ++ if (incoming) { + sa->transport->vtbl->get_src(sa->transport, &dst); +- else ++ sa->transport->vtbl->get_dst(sa->transport, &src); ++ } ++ else { + sa->transport->vtbl->get_dst(sa->transport, &dst); ++ sa->transport->vtbl->get_src(sa->transport, &src); ++ } ++ + #ifdef KAME + msg.sadb_msg_seq = (incoming ? + pf_key_v2_seq_by_sa(proto->spi[incoming], sizeof ssa.sadb_sa_spi, +@@ -1319,12 +1328,13 @@ + ssa.sadb_sa_flags = 0; + #ifdef SADB_X_SAFLAGS_TUNNEL + if (iproto->encap_mode == IPSEC_ENCAP_TUNNEL || +- iproto->encap_mode == IPSEC_ENCAP_UDP_ENCAP_TUNNEL) ++ iproto->encap_mode == IPSEC_ENCAP_UDP_ENCAP_TUNNEL || ++ iproto->encap_mode == IPSEC_ENCAP_UDP_ENCAP_TUNNEL_DRAFT) + ssa.sadb_sa_flags = SADB_X_SAFLAGS_TUNNEL; + #endif + +-#if defined (USE_NAT_TRAVERSAL) && defined (SADB_X_EXT_UDPENCAP) + if (isakmp_sa->flags & SA_FLAG_NAT_T_ENABLE) { ++#if defined (USE_NAT_TRAVERSAL) && defined (SADB_X_EXT_UDPENCAP) + memset(&udpencap, 0, sizeof udpencap); + ssa.sadb_sa_flags |= SADB_X_SAFLAGS_UDPENCAP; + udpencap.sadb_x_udpencap_exttype = SADB_X_EXT_UDPENCAP; +@@ -1334,8 +1344,40 @@ + if (pf_key_v2_msg_add(update, (struct sadb_ext *)&udpencap, 0) + == -1) + goto cleanup; +- } ++#elif defined (USE_NAT_TRAVERSAL) && defined (SADB_X_EXT_NAT_T_TYPE) ++#ifndef UDP_ENCAP_ESPINUDP ++#define UDP_ENCAP_ESPINUDP 2 ++#endif ++ memset(&nat_t_type, 0, sizeof nat_t_type); ++ memset(&nat_t_sport, 0, sizeof nat_t_sport); ++ memset(&nat_t_dport, 0, sizeof nat_t_dport); ++ ++ /* type = draft-udp-encap-06 */ ++ nat_t_type.sadb_x_nat_t_type_len = sizeof nat_t_type / PF_KEY_V2_CHUNK; ++ nat_t_type.sadb_x_nat_t_type_exttype = SADB_X_EXT_NAT_T_TYPE; ++ nat_t_type.sadb_x_nat_t_type_type = UDP_ENCAP_ESPINUDP; ++ if(pf_key_v2_msg_add(update, (struct sadb_ext *)&nat_t_type, 0) == -1) ++ goto cleanup; ++ ++ /* source port */ ++ nat_t_sport.sadb_x_nat_t_port_len = sizeof nat_t_sport / ++ PF_KEY_V2_CHUNK; ++ nat_t_sport.sadb_x_nat_t_port_exttype = SADB_X_EXT_NAT_T_SPORT; ++ nat_t_sport.sadb_x_nat_t_port_port = sockaddr_port(src); ++ if(pf_key_v2_msg_add(update, (struct sadb_ext *)&nat_t_sport, 0) == -1) ++ goto cleanup; ++ ++ /* destination port */ ++ nat_t_dport.sadb_x_nat_t_port_len = sizeof nat_t_dport / ++ PF_KEY_V2_CHUNK; ++ nat_t_dport.sadb_x_nat_t_port_exttype = SADB_X_EXT_NAT_T_DPORT; ++ nat_t_dport.sadb_x_nat_t_port_port = sockaddr_port(dst); ++ if(pf_key_v2_msg_add(update, (struct sadb_ext *)&nat_t_dport, 0) == -1) ++ goto cleanup; ++ ++ /* original address (transport mode checksum missing info) goes here */ + #endif ++ } + + if (pf_key_v2_msg_add(update, (struct sadb_ext *)&ssa, 0) == -1) + goto cleanup; +@@ -1395,10 +1437,6 @@ + /* + * Setup the ADDRESS extensions. + */ +- if (incoming) +- sa->transport->vtbl->get_dst(sa->transport, &src); +- else +- sa->transport->vtbl->get_src(sa->transport, &src); + len = sizeof *addr + PF_KEY_V2_ROUND(sysdep_sa_len(src)); + addr = calloc(1, len); + if (!addr) +@@ -2167,7 +2205,7 @@ + pf_key_v2_msg_free(ret); + return -1; + +-#elif defined (SADB_X_SPDADD) && defined (SADB_X_SPDDELETE) ++#elif defined (SADB_X_SPDUPDATE) && defined (SADB_X_SPDDELETE) + struct sadb_msg msg; + struct sadb_x_policy *policy = 0; + struct sadb_x_ipsecrequest *ipsecrequest; +@@ -2181,7 +2219,7 @@ + struct sockaddr_in *ip4_sa; + struct sockaddr_in6 *ip6_sa; + +- msg.sadb_msg_type = delete ? SADB_X_SPDDELETE : SADB_X_SPDADD; ++ msg.sadb_msg_type = delete ? SADB_X_SPDDELETE : SADB_X_SPDUPDATE; + msg.sadb_msg_satype = SADB_SATYPE_UNSPEC; + msg.sadb_msg_seq = 0; + flow = pf_key_v2_msg_new(&msg, 0); +--- isakmpd-20041012.orig/isakmp_num.cst ++++ isakmpd-20041012/isakmp_num.cst +@@ -57,15 +57,18 @@ + KD 17 # RFC 3547, Key Download + SEQ 18 # RFC 3547, Sequence Number + POP 19 # RFC 3547, Proof of possession +- RESERVED_MIN 20 ++ NAT_D 20 # RFC 3947, NAT Discovery payload ++ NAT_OA 21 # RFC 3947, NAT Original Address payload ++ RESERVED_MIN 22 + RESERVED_MAX 127 + PRIVATE_MIN 128 + # XXX values from draft-ietf-ipsec-nat-t-ike-01,02,03. Later drafts specify + # XXX NAT_D as payload 15 and NAT_OA as 16, but these are allocated by RFC + # XXX 3547 as seen above. +- NAT_D 130 # NAT Discovery payload +- NAT_OA 131 # NAT Original Address payload ++ NAT_D_DRAFT 130 # NAT Discovery payload ++ NAT_OA_DRAFT 131 # NAT Original Address payload + PRIVATE_MAX 255 ++ MAX 255 + . + + # ISAKMP exchange types. +--- isakmpd-20041012.orig/ipsec_num.cst ++++ isakmpd-20041012/ipsec_num.cst +@@ -62,10 +62,10 @@ + IPSEC_ENCAP + TUNNEL 1 + TRANSPORT 2 +- FUTURE_UDP_ENCAP_TUNNEL 3 # XXX Not yet assigned +- FUTURE_UDP_ENCAP_TRANSPORT 4 # XXX Not yet assigned +- UDP_ENCAP_TUNNEL 61443 # draft-ietf-ipsec-nat-t-ike +- UDP_ENCAP_TRANSPORT 61443 # draft-ietf-ipsec-nat-t-ike ++ UDP_ENCAP_TUNNEL 3 ++ UDP_ENCAP_TRANSPORT 4 ++ UDP_ENCAP_TUNNEL_DRAFT 61443 # draft-ietf-ipsec-nat-t-ike ++ UDP_ENCAP_TRANSPORT_DRAFT 61443 # draft-ietf-ipsec-nat-t-ike + . + + # IPSEC authentication algorithm. +--- isakmpd-20041012.orig/nat_traversal.h ++++ isakmpd-20041012/nat_traversal.h +@@ -1,4 +1,4 @@ +-/* $OpenBSD: nat_traversal.h,v 1.2 2004/06/21 23:27:10 ho Exp $ */ ++/* $OpenBSD: nat_traversal.h,v 1.4 2005/07/25 15:03:47 hshoexer Exp $ */ + + /* + * Copyright (c) 2004 Håkan Olsson. All rights reserved. +@@ -27,6 +27,24 @@ + #ifndef _NAT_TRAVERSAL_H_ + #define _NAT_TRAVERSAL_H_ + ++#define VID_DRAFT_V2 0 ++#define VID_DRAFT_V2_N 1 ++#define VID_DRAFT_V3 2 ++#define VID_RFC3947 3 ++ ++struct nat_t_cap { ++ int id; ++ u_int32_t flags; ++ const char *text; ++ char *hash; ++ size_t hashsize; ++}; ++ ++/* ++ * Set if -T is given on the command line to disable NAT-T support. ++ */ ++extern int disable_nat_t; ++ + void nat_t_init(void); + int nat_t_add_vendor_payloads(struct message *); + void nat_t_check_vendor_payload(struct message *, struct payload *); +--- isakmpd-20041012.orig/message.c ++++ isakmpd-20041012/message.c +@@ -112,6 +112,7 @@ + message_validate_hash, message_validate_sig, message_validate_nonce, + message_validate_notify, message_validate_delete, + message_validate_vendor, message_validate_attribute, ++ message_validate_nat_d, message_validate_nat_oa, + message_validate_nat_d, message_validate_nat_oa + }; + +@@ -120,7 +121,7 @@ + isakmp_id_fld, isakmp_cert_fld, isakmp_certreq_fld, isakmp_hash_fld, + isakmp_sig_fld, isakmp_nonce_fld, isakmp_notify_fld, isakmp_delete_fld, + isakmp_vendor_fld, isakmp_attribute_fld, isakmp_nat_d_fld, +- isakmp_nat_oa_fld ++ isakmp_nat_oa_fld, isakmp_nat_d_fld, isakmp_nat_oa_fld + }; + + /* +@@ -138,7 +139,8 @@ + ISAKMP_PAYLOAD_SAK, ISAKMP_PAYLOAD_SAT, ISAKMP_PAYLOAD_KD, + ISAKMP_PAYLOAD_SEQ, ISAKMP_PAYLOAD_POP + #endif +- ISAKMP_PAYLOAD_NAT_D, ISAKMP_PAYLOAD_NAT_OA ++ ISAKMP_PAYLOAD_NAT_D, ISAKMP_PAYLOAD_NAT_OA, ++ ISAKMP_PAYLOAD_NAT_D_DRAFT, ISAKMP_PAYLOAD_NAT_OA_DRAFT + }; + + static u_int8_t payload_map[256]; +@@ -347,8 +349,8 @@ + } + /* Ignore most private payloads. */ + if (next >= ISAKMP_PAYLOAD_PRIVATE_MIN && +- next != ISAKMP_PAYLOAD_NAT_D && +- next != ISAKMP_PAYLOAD_NAT_OA) { ++ next != ISAKMP_PAYLOAD_NAT_D_DRAFT && ++ next != ISAKMP_PAYLOAD_NAT_OA_DRAFT) { + LOG_DBG((LOG_MESSAGE, 30, "message_parse_payloads: " + "private next payload type %s in payload of " + "type %d ignored", +@@ -460,8 +462,10 @@ + return ISAKMP_ATTRIBUTE_SZ; + #if defined (USE_NAT_TRAVERSAL) + case ISAKMP_PAYLOAD_NAT_D: ++ case ISAKMP_PAYLOAD_NAT_D_DRAFT: + return ISAKMP_NAT_D_SZ; + case ISAKMP_PAYLOAD_NAT_OA: ++ case ISAKMP_PAYLOAD_NAT_OA_DRAFT: + return ISAKMP_NAT_OA_SZ; + #endif + /* Not yet supported and any other unknown payloads. */ +--- isakmpd-20041012.orig/policy.c ++++ isakmpd-20041012/policy.c +@@ -511,7 +511,10 @@ + break; + } + #if defined (USE_NAT_TRAVERSAL) +- else if (decode_16(value) == IPSEC_ENCAP_UDP_ENCAP_TUNNEL) ++ else if (decode_16(value) == ++ IPSEC_ENCAP_UDP_ENCAP_TUNNEL || ++ decode_16(value) == ++ IPSEC_ENCAP_UDP_ENCAP_TUNNEL_DRAFT) + switch (proto->proto) { + case IPSEC_PROTO_IPSEC_AH: + ah_encapsulation = "udp-encap-tunnel"; +@@ -1932,7 +1935,7 @@ + void + policy_init(void) + { +- char *ptr, *policy_file; ++ char *ptr, *policy_file, *use_keynote; + char **asserts; + size_t sz, len; + int fd, i; +@@ -1940,10 +1943,11 @@ + LOG_DBG((LOG_POLICY, 30, "policy_init: initializing")); + + /* Do we want to use the policy modules? */ +- if (ignore_policy || +- strncmp("yes", conf_get_str("General", "Use-Keynote"), 3)) +- return; +- ++ use_keynote = conf_get_str("General", "Use-Keynote"); ++ if (ignore_policy || ++ (use_keynote && strncmp("yes", use_keynote, 3))) ++ return; ++ + /* Get policy file from configuration. */ + policy_file = conf_get_str("General", "Policy-file"); + if (!policy_file) +--- isakmpd-20041012.orig/ike_phase_1.c ++++ isakmpd-20041012/ike_phase_1.c +@@ -1040,9 +1040,9 @@ + + /* Compare expected/desired and received remote ID */ + if (bcmp(rid, payload->p + ISAKMP_ID_DATA_OFF, sz)) { +- free(rid); + log_print("ike_phase_1_recv_ID: " +- "received remote ID other than expected %s", p); ++ "received remote ID other than expected %s - %s", p, payload->p); ++ free(rid); + return -1; + } + free(rid); +--- isakmpd-20041012.orig/x509.c ++++ isakmpd-20041012/x509.c +@@ -910,7 +910,11 @@ + X509_STORE_CTX_init(&csc, x509_cas, cert, NULL); + #if OPENSSL_VERSION_NUMBER >= 0x00907000L + /* XXX See comment in x509_read_crls_from_dir. */ ++#if OPENSSL_VERSION_NUMBER >= 0x00908000L ++ if (x509_cas->param->flags & X509_V_FLAG_CRL_CHECK) { ++#else + if (x509_cas->flags & X509_V_FLAG_CRL_CHECK) { ++#endif + X509_STORE_CTX_set_flags(&csc, X509_V_FLAG_CRL_CHECK); + X509_STORE_CTX_set_flags(&csc, X509_V_FLAG_CRL_CHECK_ALL); + } +--- isakmpd-20041012.orig/sysdep/linux/sysdep.c ++++ isakmpd-20041012/sysdep/linux/sysdep.c +@@ -169,22 +169,22 @@ + return 0; + + if (!(af == AF_INET || af == AF_INET6)) +- { ++ { + log_print ("sysdep_cleartext: unsupported protocol family %d", af); + return -1; + } + + if (setsockopt (fd, af == AF_INET ? IPPROTO_IP : IPPROTO_IPV6, +- af == AF_INET ? IP_IPSEC_POLICY : IPV6_IPSEC_POLICY, +- &pol_in, sizeof pol_in) < 0 || ++ af == AF_INET ? IP_IPSEC_POLICY : IPV6_IPSEC_POLICY, ++ &pol_in, sizeof pol_in) < 0 || + setsockopt (fd, af == AF_INET ? IPPROTO_IP : IPPROTO_IPV6, +- af == AF_INET ? IP_IPSEC_POLICY : IPV6_IPSEC_POLICY, +- &pol_out, sizeof pol_out) < 0) +- { ++ af == AF_INET ? IP_IPSEC_POLICY : IPV6_IPSEC_POLICY, ++ &pol_out, sizeof pol_out) < 0) ++ { + log_error ("sysdep_cleartext: " +- "setsockopt (%d, IPPROTO_IP%s, IP%s_IPSEC_POLICY, ...) " +- "failed", fd, af == AF_INET ? "" : "V6", +- af == AF_INET ? "" : "V6"); ++ "setsockopt (%d, IPPROTO_IP%s, IP%s_IPSEC_POLICY, ...) " ++ "failed", fd, af == AF_INET ? "" : "V6", ++ af == AF_INET ? "" : "V6"); + return -1; + } + return 0; +--- isakmpd-20041012.orig/sysdep/linux/GNUmakefile.sysdep ++++ isakmpd-20041012/sysdep/linux/GNUmakefile.sysdep +@@ -33,13 +33,13 @@ + LDADD+= -lgmp ${LIBSYSDEP} ${LIBCRYPTO} + DPADD+= ${LIBGMP} ${LIBSYSDEP} + +-CFLAGS+= -DUSE_OLD_SOCKADDR -DHAVE_PCAP \ +- -DNEED_SYSDEP_APP -DMP_FLAVOUR=MP_FLAVOUR_GMP \ +- -I/usr/src/linux/include -I${.CURDIR}/sysdep/common \ ++CFLAGS+= -DHAVE_GETNAMEINFO -DUSE_OLD_SOCKADDR -DHAVE_PCAP \ ++ -DNEED_SYSDEP_APP -DMP_FLAVOUR=MP_FLAVOUR_GMP -DUSE_AES \ ++ -I${.CURDIR}/sysdep/linux/include -I${.CURDIR}/sysdep/common \ + -I/usr/include/openssl + + FEATURES= debug tripledes blowfish cast ec aggressive x509 policy +-FEATURES+= des aes ++FEATURES+= dpd nat_traversal isakmp_cfg des aes + + IPSEC_SRCS= pf_key_v2.c + IPSEC_CFLAGS= -DUSE_PF_KEY_V2 +@@ -51,7 +51,7 @@ + # hack libsysdep.a dependenc + ${LIBSYSDEPDIR}/.depend ${LIBSYSDEP}: + cd ${LIBSYSDEPDIR} && \ +- ${MAKE} --no-print-directory ${MAKEFLAGS} \ ++ ${MAKE} --no-print-directory \ + CFLAGS="${CFLAGS}" MKDEP="${MKDEP}" ${MAKECMDGOALS} + + ifeq ($(findstring clean,$(MAKECMDGOALS)),clean) +--- isakmpd-20041012.orig/sysdep/linux/include/bitstring.h ++++ isakmpd-20041012/sysdep/linux/include/bitstring.h +@@ -0,0 +1,132 @@ ++/* $OpenBSD: bitstring.h,v 1.4 2002/06/19 02:50:10 millert Exp $ */ ++/* $NetBSD: bitstring.h,v 1.5 1997/05/14 15:49:55 pk Exp $ */ ++ ++/* ++ * Copyright (c) 1989, 1993 ++ * The Regents of the University of California. All rights reserved. ++ * ++ * This code is derived from software contributed to Berkeley by ++ * Paul Vixie. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * 1. Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * 2. Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * 3. All advertising materials mentioning features or use of this software ++ * must display the following acknowledgement: ++ * This product includes software developed by the University of ++ * California, Berkeley and its contributors. ++ * 4. Neither the name of the University nor the names of its contributors ++ * may be used to endorse or promote products derived from this software ++ * without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE ++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS ++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT ++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY ++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ++ * SUCH DAMAGE. ++ * ++ * @(#)bitstring.h 8.1 (Berkeley) 7/19/93 ++ */ ++ ++#ifndef _BITSTRING_H_ ++#define _BITSTRING_H_ ++ ++/* modified for SV/AT and bitstring bugfix by M.R.Murphy, 11oct91 ++ * bitstr_size changed gratuitously, but shorter ++ * bit_alloc spelling error fixed ++ * the following were efficient, but didn't work, they've been made to ++ * work, but are no longer as efficient :-) ++ * bit_nclear, bit_nset, bit_ffc, bit_ffs ++ */ ++typedef unsigned char bitstr_t; ++ ++/* internal macros */ ++ /* byte of the bitstring bit is in */ ++#define _bit_byte(bit) \ ++ ((bit) >> 3) ++ ++ /* mask for the bit within its byte */ ++#define _bit_mask(bit) \ ++ (1 << ((bit)&0x7)) ++ ++/* external macros */ ++ /* bytes in a bitstring of nbits bits */ ++#define bitstr_size(nbits) \ ++ (((nbits) + 7) >> 3) ++ ++ /* allocate a bitstring */ ++#define bit_alloc(nbits) \ ++ (bitstr_t *)calloc((size_t)bitstr_size(nbits), sizeof(bitstr_t)) ++ ++ /* allocate a bitstring on the stack */ ++#define bit_decl(name, nbits) \ ++ ((name)[bitstr_size(nbits)]) ++ ++ /* is bit N of bitstring name set? */ ++#define bit_test(name, bit) \ ++ ((name)[_bit_byte(bit)] & _bit_mask(bit)) ++ ++ /* set bit N of bitstring name */ ++#define bit_set(name, bit) \ ++ ((name)[_bit_byte(bit)] |= _bit_mask(bit)) ++ ++ /* clear bit N of bitstring name */ ++#define bit_clear(name, bit) \ ++ ((name)[_bit_byte(bit)] &= ~_bit_mask(bit)) ++ ++ /* clear bits start ... stop in bitstring */ ++#define bit_nclear(name, start, stop) do { \ ++ register bitstr_t *_name = name; \ ++ register int _start = start, _stop = stop; \ ++ while (_start <= _stop) { \ ++ bit_clear(_name, _start); \ ++ _start++; \ ++ } \ ++} while(0) ++ ++ /* set bits start ... stop in bitstring */ ++#define bit_nset(name, start, stop) do { \ ++ register bitstr_t *_name = name; \ ++ register int _start = start, _stop = stop; \ ++ while (_start <= _stop) { \ ++ bit_set(_name, _start); \ ++ _start++; \ ++ } \ ++} while(0) ++ ++ /* find first bit clear in name */ ++#define bit_ffc(name, nbits, value) do { \ ++ register bitstr_t *_name = name; \ ++ register int _bit, _nbits = nbits, _value = -1; \ ++ for (_bit = 0; _bit < _nbits; ++_bit) \ ++ if (!bit_test(_name, _bit)) { \ ++ _value = _bit; \ ++ break; \ ++ } \ ++ *(value) = _value; \ ++} while(0) ++ ++ /* find first bit set in name */ ++#define bit_ffs(name, nbits, value) do { \ ++ register bitstr_t *_name = name; \ ++ register int _bit, _nbits = nbits, _value = -1; \ ++ for (_bit = 0; _bit < _nbits; ++_bit) \ ++ if (bit_test(_name, _bit)) { \ ++ _value = _bit; \ ++ break; \ ++ } \ ++ *(value) = _value; \ ++} while(0) ++ ++#endif /* !_BITSTRING_H_ */ +--- isakmpd-20041012.orig/sysdep/linux/include/sys/queue.h ++++ isakmpd-20041012/sysdep/linux/include/sys/queue.h +@@ -0,0 +1,453 @@ ++/* ++ * Copyright (c) 1991, 1993 ++ * The Regents of the University of California. All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * 1. Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * 2. Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * 3. All advertising materials mentioning features or use of this software ++ * must display the following acknowledgement: ++ * This product includes software developed by the University of ++ * California, Berkeley and its contributors. ++ * 4. Neither the name of the University nor the names of its contributors ++ * may be used to endorse or promote products derived from this software ++ * without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE ++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS ++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT ++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY ++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ++ * SUCH DAMAGE. ++ * ++ * @(#)queue.h 8.5 (Berkeley) 8/20/94 ++ * $FreeBSD: src/sys/sys/queue.h,v 1.45 2001/12/11 11:49:58 sheldonh Exp $ ++ */ ++ ++#ifndef _SYS_QUEUE_H_ ++#define _SYS_QUEUE_H_ ++ ++//#include <machine/ansi.h> /* for __offsetof */ ++ ++/* ++ * This file defines four types of data structures: singly-linked lists, ++ * singly-linked tail queues, lists and tail queues. ++ * ++ * A singly-linked list is headed by a single forward pointer. The elements ++ * are singly linked for minimum space and pointer manipulation overhead at ++ * the expense of O(n) removal for arbitrary elements. New elements can be ++ * added to the list after an existing element or at the head of the list. ++ * Elements being removed from the head of the list should use the explicit ++ * macro for this purpose for optimum efficiency. A singly-linked list may ++ * only be traversed in the forward direction. Singly-linked lists are ideal ++ * for applications with large datasets and few or no removals or for ++ * implementing a LIFO queue. ++ * ++ * A singly-linked tail queue is headed by a pair of pointers, one to the ++ * head of the list and the other to the tail of the list. The elements are ++ * singly linked for minimum space and pointer manipulation overhead at the ++ * expense of O(n) removal for arbitrary elements. New elements can be added ++ * to the list after an existing element, at the head of the list, or at the ++ * end of the list. Elements being removed from the head of the tail queue ++ * should use the explicit macro for this purpose for optimum efficiency. ++ * A singly-linked tail queue may only be traversed in the forward direction. ++ * Singly-linked tail queues are ideal for applications with large datasets ++ * and few or no removals or for implementing a FIFO queue. ++ * ++ * A list is headed by a single forward pointer (or an array of forward ++ * pointers for a hash table header). The elements are doubly linked ++ * so that an arbitrary element can be removed without a need to ++ * traverse the list. New elements can be added to the list before ++ * or after an existing element or at the head of the list. A list ++ * may only be traversed in the forward direction. ++ * ++ * A tail queue is headed by a pair of pointers, one to the head of the ++ * list and the other to the tail of the list. The elements are doubly ++ * linked so that an arbitrary element can be removed without a need to ++ * traverse the list. New elements can be added to the list before or ++ * after an existing element, at the head of the list, or at the end of ++ * the list. A tail queue may be traversed in either direction. ++ * ++ * For details on the use of these macros, see the queue(3) manual page. ++ * ++ * ++ * SLIST LIST STAILQ TAILQ ++ * _HEAD + + + + ++ * _HEAD_INITIALIZER + + + + ++ * _ENTRY + + + + ++ * _INIT + + + + ++ * _EMPTY + + + + ++ * _FIRST + + + + ++ * _NEXT + + + + ++ * _PREV - - - + ++ * _LAST - - + + ++ * _FOREACH + + + + ++ * _FOREACH_REVERSE - - - + ++ * _INSERT_HEAD + + + + ++ * _INSERT_BEFORE - + - + ++ * _INSERT_AFTER + + + + ++ * _INSERT_TAIL - - + + ++ * _REMOVE_HEAD + - + - ++ * _REMOVE + + + + ++ * ++ */ ++ ++/* ++ * Singly-linked List declarations. ++ */ ++#define SLIST_HEAD(name, type) \ ++struct name { \ ++ struct type *slh_first; /* first element */ \ ++} ++ ++#define SLIST_HEAD_INITIALIZER(head) \ ++ { NULL } ++ ++#define SLIST_ENTRY(type) \ ++struct { \ ++ struct type *sle_next; /* next element */ \ ++} ++ ++/* ++ * Singly-linked List functions. ++ */ ++#define SLIST_EMPTY(head) ((head)->slh_first == NULL) ++ ++#define SLIST_FIRST(head) ((head)->slh_first) ++ ++#define SLIST_FOREACH(var, head, field) \ ++ for ((var) = SLIST_FIRST((head)); \ ++ (var); \ ++ (var) = SLIST_NEXT((var), field)) ++ ++#define SLIST_INIT(head) do { \ ++ SLIST_FIRST((head)) = NULL; \ ++} while (0) ++ ++#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \ ++ SLIST_NEXT((elm), field) = SLIST_NEXT((slistelm), field); \ ++ SLIST_NEXT((slistelm), field) = (elm); \ ++} while (0) ++ ++#define SLIST_INSERT_HEAD(head, elm, field) do { \ ++ SLIST_NEXT((elm), field) = SLIST_FIRST((head)); \ ++ SLIST_FIRST((head)) = (elm); \ ++} while (0) ++ ++#define SLIST_NEXT(elm, field) ((elm)->field.sle_next) ++ ++#define SLIST_REMOVE(head, elm, type, field) do { \ ++ if (SLIST_FIRST((head)) == (elm)) { \ ++ SLIST_REMOVE_HEAD((head), field); \ ++ } \ ++ else { \ ++ struct type *curelm = SLIST_FIRST((head)); \ ++ while (SLIST_NEXT(curelm, field) != (elm)) \ ++ curelm = SLIST_NEXT(curelm, field); \ ++ SLIST_NEXT(curelm, field) = \ ++ SLIST_NEXT(SLIST_NEXT(curelm, field), field); \ ++ } \ ++} while (0) ++ ++#define SLIST_REMOVE_HEAD(head, field) do { \ ++ SLIST_FIRST((head)) = SLIST_NEXT(SLIST_FIRST((head)), field); \ ++} while (0) ++ ++/* ++ * Singly-linked Tail queue declarations. ++ */ ++#define STAILQ_HEAD(name, type) \ ++struct name { \ ++ struct type *stqh_first;/* first element */ \ ++ struct type **stqh_last;/* addr of last next element */ \ ++} ++ ++#define STAILQ_HEAD_INITIALIZER(head) \ ++ { NULL, &(head).stqh_first } ++ ++#define STAILQ_ENTRY(type) \ ++struct { \ ++ struct type *stqe_next; /* next element */ \ ++} ++ ++/* ++ * Singly-linked Tail queue functions. ++ */ ++#define STAILQ_EMPTY(head) ((head)->stqh_first == NULL) ++ ++#define STAILQ_FIRST(head) ((head)->stqh_first) ++ ++#define STAILQ_FOREACH(var, head, field) \ ++ for((var) = STAILQ_FIRST((head)); \ ++ (var); \ ++ (var) = STAILQ_NEXT((var), field)) ++ ++#define STAILQ_INIT(head) do { \ ++ STAILQ_FIRST((head)) = NULL; \ ++ (head)->stqh_last = &STAILQ_FIRST((head)); \ ++} while (0) ++ ++#define STAILQ_INSERT_AFTER(head, tqelm, elm, field) do { \ ++ if ((STAILQ_NEXT((elm), field) = STAILQ_NEXT((tqelm), field)) == NULL)\ ++ (head)->stqh_last = &STAILQ_NEXT((elm), field); \ ++ STAILQ_NEXT((tqelm), field) = (elm); \ ++} while (0) ++ ++#define STAILQ_INSERT_HEAD(head, elm, field) do { \ ++ if ((STAILQ_NEXT((elm), field) = STAILQ_FIRST((head))) == NULL) \ ++ (head)->stqh_last = &STAILQ_NEXT((elm), field); \ ++ STAILQ_FIRST((head)) = (elm); \ ++} while (0) ++ ++#define STAILQ_INSERT_TAIL(head, elm, field) do { \ ++ STAILQ_NEXT((elm), field) = NULL; \ ++ *(head)->stqh_last = (elm); \ ++ (head)->stqh_last = &STAILQ_NEXT((elm), field); \ ++} while (0) ++ ++#define STAILQ_LAST(head, type, field) \ ++ (STAILQ_EMPTY(head) ? \ ++ NULL : \ ++ ((struct type *) \ ++ ((char *)((head)->stqh_last) - __offsetof(struct type, field)))) ++ ++#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next) ++ ++#define STAILQ_REMOVE(head, elm, type, field) do { \ ++ if (STAILQ_FIRST((head)) == (elm)) { \ ++ STAILQ_REMOVE_HEAD(head, field); \ ++ } \ ++ else { \ ++ struct type *curelm = STAILQ_FIRST((head)); \ ++ while (STAILQ_NEXT(curelm, field) != (elm)) \ ++ curelm = STAILQ_NEXT(curelm, field); \ ++ if ((STAILQ_NEXT(curelm, field) = \ ++ STAILQ_NEXT(STAILQ_NEXT(curelm, field), field)) == NULL)\ ++ (head)->stqh_last = &STAILQ_NEXT((curelm), field);\ ++ } \ ++} while (0) ++ ++#define STAILQ_REMOVE_HEAD(head, field) do { \ ++ if ((STAILQ_FIRST((head)) = \ ++ STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL) \ ++ (head)->stqh_last = &STAILQ_FIRST((head)); \ ++} while (0) ++ ++#define STAILQ_REMOVE_HEAD_UNTIL(head, elm, field) do { \ ++ if ((STAILQ_FIRST((head)) = STAILQ_NEXT((elm), field)) == NULL) \ ++ (head)->stqh_last = &STAILQ_FIRST((head)); \ ++} while (0) ++ ++/* ++ * List declarations. ++ */ ++#define LIST_HEAD(name, type) \ ++struct name { \ ++ struct type *lh_first; /* first element */ \ ++} ++ ++#define LIST_HEAD_INITIALIZER(head) \ ++ { NULL } ++ ++#define LIST_ENTRY(type) \ ++struct { \ ++ struct type *le_next; /* next element */ \ ++ struct type **le_prev; /* address of previous next element */ \ ++} ++ ++/* ++ * List functions. ++ */ ++ ++#define LIST_EMPTY(head) ((head)->lh_first == NULL) ++ ++#define LIST_FIRST(head) ((head)->lh_first) ++ ++#define LIST_FOREACH(var, head, field) \ ++ for ((var) = LIST_FIRST((head)); \ ++ (var); \ ++ (var) = LIST_NEXT((var), field)) ++ ++#define LIST_INIT(head) do { \ ++ LIST_FIRST((head)) = NULL; \ ++} while (0) ++ ++#define LIST_INSERT_AFTER(listelm, elm, field) do { \ ++ if ((LIST_NEXT((elm), field) = LIST_NEXT((listelm), field)) != NULL)\ ++ LIST_NEXT((listelm), field)->field.le_prev = \ ++ &LIST_NEXT((elm), field); \ ++ LIST_NEXT((listelm), field) = (elm); \ ++ (elm)->field.le_prev = &LIST_NEXT((listelm), field); \ ++} while (0) ++ ++#define LIST_INSERT_BEFORE(listelm, elm, field) do { \ ++ (elm)->field.le_prev = (listelm)->field.le_prev; \ ++ LIST_NEXT((elm), field) = (listelm); \ ++ *(listelm)->field.le_prev = (elm); \ ++ (listelm)->field.le_prev = &LIST_NEXT((elm), field); \ ++} while (0) ++ ++#define LIST_INSERT_HEAD(head, elm, field) do { \ ++ if ((LIST_NEXT((elm), field) = LIST_FIRST((head))) != NULL) \ ++ LIST_FIRST((head))->field.le_prev = &LIST_NEXT((elm), field);\ ++ LIST_FIRST((head)) = (elm); \ ++ (elm)->field.le_prev = &LIST_FIRST((head)); \ ++} while (0) ++ ++#define LIST_NEXT(elm, field) ((elm)->field.le_next) ++ ++#define LIST_REMOVE(elm, field) do { \ ++ if (LIST_NEXT((elm), field) != NULL) \ ++ LIST_NEXT((elm), field)->field.le_prev = \ ++ (elm)->field.le_prev; \ ++ *(elm)->field.le_prev = LIST_NEXT((elm), field); \ ++} while (0) ++ ++/* ++ * Tail queue declarations. ++ */ ++#define TAILQ_HEAD(name, type) \ ++struct name { \ ++ struct type *tqh_first; /* first element */ \ ++ struct type **tqh_last; /* addr of last next element */ \ ++} ++ ++#define TAILQ_HEAD_INITIALIZER(head) \ ++ { NULL, &(head).tqh_first } ++ ++#define TAILQ_ENTRY(type) \ ++struct { \ ++ struct type *tqe_next; /* next element */ \ ++ struct type **tqe_prev; /* address of previous next element */ \ ++} ++ ++/* ++ * Tail queue functions. ++ */ ++#define TAILQ_EMPTY(head) ((head)->tqh_first == NULL) ++ ++#define TAILQ_FIRST(head) ((head)->tqh_first) ++ ++#define TAILQ_FOREACH(var, head, field) \ ++ for ((var) = TAILQ_FIRST((head)); \ ++ (var); \ ++ (var) = TAILQ_NEXT((var), field)) ++ ++#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \ ++ for ((var) = TAILQ_LAST((head), headname); \ ++ (var); \ ++ (var) = TAILQ_PREV((var), headname, field)) ++ ++#define TAILQ_INIT(head) do { \ ++ TAILQ_FIRST((head)) = NULL; \ ++ (head)->tqh_last = &TAILQ_FIRST((head)); \ ++} while (0) ++ ++#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ ++ if ((TAILQ_NEXT((elm), field) = TAILQ_NEXT((listelm), field)) != NULL)\ ++ TAILQ_NEXT((elm), field)->field.tqe_prev = \ ++ &TAILQ_NEXT((elm), field); \ ++ else \ ++ (head)->tqh_last = &TAILQ_NEXT((elm), field); \ ++ TAILQ_NEXT((listelm), field) = (elm); \ ++ (elm)->field.tqe_prev = &TAILQ_NEXT((listelm), field); \ ++} while (0) ++ ++#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \ ++ (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ ++ TAILQ_NEXT((elm), field) = (listelm); \ ++ *(listelm)->field.tqe_prev = (elm); \ ++ (listelm)->field.tqe_prev = &TAILQ_NEXT((elm), field); \ ++} while (0) ++ ++#define TAILQ_INSERT_HEAD(head, elm, field) do { \ ++ if ((TAILQ_NEXT((elm), field) = TAILQ_FIRST((head))) != NULL) \ ++ TAILQ_FIRST((head))->field.tqe_prev = \ ++ &TAILQ_NEXT((elm), field); \ ++ else \ ++ (head)->tqh_last = &TAILQ_NEXT((elm), field); \ ++ TAILQ_FIRST((head)) = (elm); \ ++ (elm)->field.tqe_prev = &TAILQ_FIRST((head)); \ ++} while (0) ++ ++#define TAILQ_INSERT_TAIL(head, elm, field) do { \ ++ TAILQ_NEXT((elm), field) = NULL; \ ++ (elm)->field.tqe_prev = (head)->tqh_last; \ ++ *(head)->tqh_last = (elm); \ ++ (head)->tqh_last = &TAILQ_NEXT((elm), field); \ ++} while (0) ++ ++#define TAILQ_LAST(head, headname) \ ++ (*(((struct headname *)((head)->tqh_last))->tqh_last)) ++ ++#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) ++ ++#define TAILQ_PREV(elm, headname, field) \ ++ (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) ++ ++#define TAILQ_REMOVE(head, elm, field) do { \ ++ if ((TAILQ_NEXT((elm), field)) != NULL) \ ++ TAILQ_NEXT((elm), field)->field.tqe_prev = \ ++ (elm)->field.tqe_prev; \ ++ else \ ++ (head)->tqh_last = (elm)->field.tqe_prev; \ ++ *(elm)->field.tqe_prev = TAILQ_NEXT((elm), field); \ ++} while (0) ++ ++ ++#ifdef _KERNEL ++ ++/* ++ * XXX insque() and remque() are an old way of handling certain queues. ++ * They bogusly assumes that all queue heads look alike. ++ */ ++ ++struct quehead { ++ struct quehead *qh_link; ++ struct quehead *qh_rlink; ++}; ++ ++#ifdef __GNUC__ ++ ++static __inline void ++insque(void *a, void *b) ++{ ++ struct quehead *element = (struct quehead *)a, ++ *head = (struct quehead *)b; ++ ++ element->qh_link = head->qh_link; ++ element->qh_rlink = head; ++ head->qh_link = element; ++ element->qh_link->qh_rlink = element; ++} ++ ++static __inline void ++remque(void *a) ++{ ++ struct quehead *element = (struct quehead *)a; ++ ++ element->qh_link->qh_rlink = element->qh_rlink; ++ element->qh_rlink->qh_link = element->qh_link; ++ element->qh_rlink = 0; ++} ++ ++#else /* !__GNUC__ */ ++ ++void insque __P((void *a, void *b)); ++void remque __P((void *a)); ++ ++#endif /* __GNUC__ */ ++ ++#endif /* _KERNEL */ ++ ++#endif /* !_SYS_QUEUE_H_ */ +--- isakmpd-20041012.orig/sysdep/common/pcap.h ++++ isakmpd-20041012/sysdep/common/pcap.h +@@ -55,8 +55,13 @@ + u_int32_t linktype; /* data link type (DLT_*) */ + }; + ++struct pcap_timeval { ++ int32_t tv_sec; /* seconds */ ++ int32_t tv_usec; /* microseconds */ ++}; ++ + struct pcap_pkthdr { +- struct timeval ts; /* time stamp */ ++ struct pcap_timeval ts; /* time stamp */ + u_int32_t caplen; /* length of portion present */ + u_int32_t len; /* length this packet (off wire) */ + }; +--- isakmpd-20041012.orig/sysdep/common/libsysdep/arc4random.c ++++ isakmpd-20041012/sysdep/common/libsysdep/arc4random.c +@@ -78,7 +78,7 @@ + static void + arc4_stir(struct arc4_stream *as) + { +- int fd; ++ int fd, i; + struct { + struct timeval tv; + u_int8_t rnd[128 - sizeof(struct timeval)]; +--- isakmpd-20041012.orig/x509v3.cnf ++++ isakmpd-20041012/x509v3.cnf +@@ -0,0 +1,26 @@ ++# default settings ++CERTPATHLEN = 1 ++CERTUSAGE = digitalSignature,keyCertSign ++CERTIP = 0.0.0.0 ++CERTFQDN = nohost.nodomain ++ ++# This section should be referenced when building an x509v3 CA ++# Certificate. ++# The default path length and the key usage can be overriden ++# modified by setting the CERTPATHLEN and CERTUSAGE environment ++# variables. ++[x509v3_CA] ++basicConstraints=critical,CA:true,pathlen:$ENV::CERTPATHLEN ++keyUsage=$ENV::CERTUSAGE ++ ++# This section should be referenced to add an IP Address ++# as an alternate subject name, needed by isakmpd ++# The address must be provided in the CERTIP environment variable ++[x509v3_IPAddr] ++subjectAltName=IP:$ENV::CERTIP ++ ++# This section should be referenced to add a FQDN hostname ++# as an alternate subject name, needed by isakmpd ++# The address must be provided in the CERTFQDN environment variable ++[x509v3_FQDN] ++subjectAltName=DNS:$ENV::CERTFQDN + diff --git a/package/isakmpd/patches/020-standardize.patch b/package/isakmpd/patches/020-standardize.patch new file mode 100644 index 0000000000..d3dfabf349 --- /dev/null +++ b/package/isakmpd/patches/020-standardize.patch @@ -0,0 +1,59 @@ +diff -urN isakmpd/GNUmakefile isakmpd.new/GNUmakefile +--- isakmpd/GNUmakefile 2004-01-16 13:36:32.000000000 +0100 ++++ isakmpd.new/GNUmakefile 2006-09-03 17:33:03.000000000 +0200 +@@ -238,3 +238,16 @@ + + realcleandepend: + rm -f .depend tags ++ ++# Install rules ++install: install-bin install-man ++ ++install-bin: isakmpd ++ -mkdir -p $(DESTDIR)$(BINDIR) ++ $(INSTALL) $(INSTALL_OPTS) -m 755 isakmpd $(DESTDIR)$(BINDIR) ++ ++install-man: ++ -mkdir -p $(DESTDIR)$(MANDIR)/man8 ++ $(INSTALL) $(INSTALL_OPTS) -m 444 isakmpd.8 $(DESTDIR)$(MANDIR)/man8 ++ -mkdir -p $(DESTDIR)$(MANDIR)/man5 ++ $(INSTALL) $(INSTALL_OPTS) -m 444 isakmpd.conf.5 isakmpd.policy.5 $(DESTDIR)$(MANDIR)/man5 +diff -urN isakmpd/samples/Makefile isakmpd.new/samples/Makefile +--- isakmpd/samples/Makefile 2003-06-03 16:39:50.000000000 +0200 ++++ isakmpd.new/samples/Makefile 2006-09-03 17:07:24.000000000 +0200 +@@ -26,7 +26,7 @@ + # + + FILES= VPN-* policy singlehost-* +-TARGETDIR= /usr/share/ipsec/isakmpd ++TARGETDIR= /usr/share/isakmpd/samples + + # The mkdir below is for installation on OpenBSD pre 2.7 + install: + +diff -urN isakmp.old/sysdep/linux/GNUmakefile.sysdep isakmp.dev/sysdep/linux/GNUmakefile.sysdep +--- isakmp.old/sysdep/linux/GNUmakefile.sysdep 2006-09-07 13:49:20.000000000 +0200 ++++ isakmp.dev/sysdep/linux/GNUmakefile.sysdep 2006-09-07 13:51:41.000000000 +0200 +@@ -25,18 +25,18 @@ + # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + # + +-LIBGMP:= /usr/lib/libgmp.a +-LIBCRYPTO:= /usr/lib/libcrypto.a ++LIBGMP:= ++LIBCRYPTO:= -lcrypto + LIBSYSDEPDIR:= ${.CURDIR}/sysdep/common/libsysdep + LIBSYSDEP:= ${LIBSYSDEPDIR}/libsysdep.a + +-LDADD+= -lgmp ${LIBSYSDEP} ${LIBCRYPTO} ++LDADD+= -L$(STAGING_DIR)/usr/lib -lgmp ${LIBSYSDEP} ${LIBCRYPTO} + DPADD+= ${LIBGMP} ${LIBSYSDEP} + + CFLAGS+= -DHAVE_GETNAMEINFO -DUSE_OLD_SOCKADDR -DHAVE_PCAP \ + -DNEED_SYSDEP_APP -DMP_FLAVOUR=MP_FLAVOUR_GMP -DUSE_AES \ + -I${.CURDIR}/sysdep/linux/include -I${.CURDIR}/sysdep/common \ +- -I/usr/include/openssl ++ -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/usr/include/openssl -I$(LINUX_DIR)/include + + FEATURES= debug tripledes blowfish cast ec aggressive x509 policy + FEATURES+= dpd nat_traversal isakmp_cfg des aes diff --git a/package/isakmpd/patches/030-openssl_hashes.patch b/package/isakmpd/patches/030-openssl_hashes.patch new file mode 100644 index 0000000000..680db86a31 --- /dev/null +++ b/package/isakmpd/patches/030-openssl_hashes.patch @@ -0,0 +1,154 @@ +diff -urN isakmpd/GNUmakefile isakmpd.new/GNUmakefile +--- isakmpd/GNUmakefile 2006-09-01 19:29:05.000000000 +0200 ++++ isakmpd.new/GNUmakefile 2006-09-01 19:29:28.000000000 +0200 +@@ -75,13 +75,14 @@ + isakmp_fld.c isakmp_fld.h + MAN= isakmpd.8 isakmpd.conf.5 isakmpd.policy.5 + +-CFLAGS+= -O2 ${DEBUG} -Wall -DNEED_SYSDEP_APP \ ++CFLAGS+= ${DEBUG} -Wall -DNEED_SYSDEP_APP \ + -I${.CURDIR} -I${.CURDIR}/sysdep/${OS} -I. \ + + # Different debugging & profiling suggestions + + # Include symbolic debugging info + DEBUG= -g ++CFLAGS+= -g + + # Do execution time profiles + #CFLAGS+= -pg +@@ -172,6 +173,14 @@ + CFLAGS+= -DUSE_RAWKEY + endif + ++ifdef USE_OPENSSL_MD5 ++CFLAGS+= -DUSE_OPENSSL_MD5 ++endif ++ ++ifdef USE_OPENSSL_SHA1 ++CFLAGS+= -DUSE_OPENSSL_SHA1 ++endif ++ + SRCS+= ${IPSEC_SRCS} ${X509} ${POLICY} ${EC} ${AGGRESSIVE} ${DNSSEC} \ + $(ISAKMP_CFG) + CFLAGS+= ${IPSEC_CFLAGS} +diff -urN isakmpd/sysdep/common/libsysdep/GNUmakefile isakmpd.new/sysdep/common/libsysdep/GNUmakefile +--- isakmpd/sysdep/common/libsysdep/GNUmakefile 2003-06-03 16:52:06.000000000 +0200 ++++ isakmpd.new/sysdep/common/libsysdep/GNUmakefile 2006-09-01 19:29:28.000000000 +0200 +@@ -31,10 +31,18 @@ + .CURDIR:= $(shell pwd) + + LIB= sysdep +-SRCS= arc4random.c blowfish.c cast.c md5.c sha1.c strlcat.c strlcpy.c ++SRCS= arc4random.c blowfish.c cast.c strlcat.c strlcpy.c + NOMAN= + CFLAGS+= -I${.CURDIR}/.. -I/usr/include/machine + ++ifeq (,$(findstring USE_OPENSSL_MD5,$(CFLAGS))) ++SRCS+=md5.c ++endif ++ ++ifeq (,$(findstring USE_OPENSSL_SHA1,$(CFLAGS))) ++SRCS+=sha1.c ++endif ++ + lib${LIB}.a: ${SRCS:%.c=%.o} + ar cq $@ ${SRCS:%.c=%.o} + +diff -urN isakmpd/sysdep/common/libsysdep/md5.c isakmpd.new/sysdep/common/libsysdep/md5.c +--- isakmpd/sysdep/common/libsysdep/md5.c 2002-06-14 23:34:58.000000000 +0200 ++++ isakmpd.new/sysdep/common/libsysdep/md5.c 2006-09-01 19:29:28.000000000 +0200 +@@ -5,6 +5,8 @@ + * changes to accommodate it in the kernel by ji. + */ + ++#ifndef USE_OPENSSL_MD5 ++ + /* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm + */ + +@@ -390,3 +392,4 @@ + #endif + #endif + ++#endif /* USE_OPENSSL_MD5 */ +diff -urN isakmpd/sysdep/common/libsysdep/sha1.c isakmpd.new/sysdep/common/libsysdep/sha1.c +--- isakmpd/sysdep/common/libsysdep/sha1.c 2001-01-28 23:38:48.000000000 +0100 ++++ isakmpd.new/sysdep/common/libsysdep/sha1.c 2006-09-01 19:29:28.000000000 +0200 +@@ -1,5 +1,7 @@ + /* $OpenBSD: sha1.c,v 1.2 2001/01/28 22:38:48 niklas Exp $ */ + ++#ifndef USE_OPENSSL_SHA1 ++ + /* + SHA-1 in C + By Steve Reid <steve@edmweb.com> +@@ -171,3 +173,5 @@ + SHA1Transform(context->state, context->buffer); + #endif + } ++ ++#endif /* USE_OPENSSL_SHA1 */ +diff -urN isakmpd/sysdep/common/md5.h isakmpd.new/sysdep/common/md5.h +--- isakmpd/sysdep/common/md5.h 2001-01-28 23:38:47.000000000 +0100 ++++ isakmpd.new/sysdep/common/md5.h 2006-09-01 19:29:28.000000000 +0200 +@@ -1,5 +1,15 @@ + /* $OpenBSD: md5.h,v 1.2 2001/01/28 22:38:47 niklas Exp $ */ + ++#ifdef USE_OPENSSL_MD5 ++ ++#include <openssl/md5.h> ++ ++#define MD5Init MD5_Init ++#define MD5Update MD5_Update ++#define MD5Final MD5_Final ++ ++#else /* USE_OPENSSL_MD5 */ ++ + /* GLOBAL.H - RSAREF types and constants + */ + +@@ -71,3 +81,5 @@ + void MD5Final PROTO_LIST ((unsigned char [16], MD5_CTX *)); + + #define _MD5_H_ ++ ++#endif /* USE_OPENSSL_MD5 */ +diff -urN isakmpd/sysdep/common/sha1.h isakmpd.new/sysdep/common/sha1.h +--- isakmpd/sysdep/common/sha1.h 2001-01-28 23:38:47.000000000 +0100 ++++ isakmpd.new/sysdep/common/sha1.h 2006-09-01 19:29:28.000000000 +0200 +@@ -1,5 +1,16 @@ + /* $OpenBSD: sha1.h,v 1.2 2001/01/28 22:38:47 niklas Exp $ */ + ++#ifdef USE_OPENSSL_SHA1 ++ ++#include <openssl/sha.h> ++ ++typedef SHA_CTX SHA1_CTX; ++#define SHA1Init SHA1_Init ++#define SHA1Update SHA1_Update ++#define SHA1Final SHA1_Final ++ ++#else /* USE_OPENSSL_SHA1 */ ++ + /* + SHA-1 in C + By Steve Reid <steve@edmweb.com> +@@ -16,3 +27,5 @@ + void SHA1Init(SHA1_CTX* context); + void SHA1Update(SHA1_CTX* context, unsigned char* data, unsigned int len); + void SHA1Final(unsigned char digest[20], SHA1_CTX* context); ++ ++#endif /* USE_OPENSSL_SHA1 */ +diff -urN isakmpd/sysdep/linux/GNUmakefile.sysdep isakmpd.new/sysdep/linux/GNUmakefile.sysdep +--- isakmpd/sysdep/linux/GNUmakefile.sysdep 2006-09-01 19:29:05.000000000 +0200 ++++ isakmpd.new/sysdep/linux/GNUmakefile.sysdep 2006-09-01 19:29:29.000000000 +0200 +@@ -48,6 +48,8 @@ + USE_LIBCRYPO= defined + HAVE_DLOPEN= defined + USE_KEYNOTE= defined ++USE_OPENSSL_MD5= defined ++USE_OPENSSL_SHA1= defined + + # hack libsysdep.a dependenc + ${LIBSYSDEPDIR}/.depend ${LIBSYSDEP}: diff --git a/package/isakmpd/patches/040-security_fix.patch b/package/isakmpd/patches/040-security_fix.patch new file mode 100644 index 0000000000..9128880107 --- /dev/null +++ b/package/isakmpd/patches/040-security_fix.patch @@ -0,0 +1,22 @@ +Index: sbin/isakmpd/ipsec.c +=================================================================== +RCS file: /cvs/src/sbin/isakmpd/ipsec.c,v +retrieving revision 1.122 +retrieving revision 1.122.2.1 +diff -u -p -r1.122 -r1.122.2.1 +--- isakmpd/ipsec.c 23 Sep 2005 14:44:03 -0000 1.122 ++++ isakmpd/ipsec.c 19 Aug 2006 20:23:28 -0000 1.122.2.1 +@@ -2076,9 +2076,10 @@ ipsec_proto_init(struct proto *proto, ch + { + struct ipsec_proto *iproto = proto->data; + +- if (proto->sa->phase == 2 && section) +- iproto->replay_window = conf_get_num(section, "ReplayWindow", +- DEFAULT_REPLAY_WINDOW); ++ if (proto->sa->phase == 2) ++ iproto->replay_window = section ? conf_get_num(section, ++ "ReplayWindow", DEFAULT_REPLAY_WINDOW) : ++ DEFAULT_REPLAY_WINDOW; + } + + /* diff --git a/package/kernel/Makefile b/package/kernel/Makefile new file mode 100644 index 0000000000..bb9fd4f70f --- /dev/null +++ b/package/kernel/Makefile @@ -0,0 +1,90 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=kernel +PKG_VERSION:=$(LINUX_VERSION)-$(BOARD) +PKG_RELEASE:=$(LINUX_RELEASE) + +PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/packages + +include $(INCLUDE_DIR)/package.mk +ifeq ($(DUMP),) + -include $(LINUX_DIR)/.config + NF_KMOD:=1 + include $(INCLUDE_DIR)/netfilter.mk +endif + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) +endef + +define Build/Compile +endef + +define KernelPackage/Defaults + FILES:= + KCONFIG:=m + AUTOLOAD:= +endef + +define ModuleAutoLoad + export modules=; \ + add_module() { \ + mkdir -p $(2)/etc/modules.d; \ + echo "$$$$$$$$2" > $(2)/etc/modules.d/$$$$$$$$1-$(1); \ + modules="$$$$$$$${modules:+$$$$$$$$modules }$$$$$$$$1-$(1)"; \ + }; \ + $(3) \ + if [ -n "$$$$$$$$modules" ]; then \ + mkdir -p $(2)/etc/modules.d; \ + echo "#!/bin/sh" > $(2)/CONTROL/postinst; \ + echo "[ -z \"\$$$$$$$$IPKG_INSTROOT\" ] || exit 0" >> $(2)/CONTROL/postinst; \ + echo ". /etc/functions.sh" >> $(2)/CONTROL/postinst; \ + echo "load_modules $$$$$$$$modules" >> $(2)/CONTROL/postinst; \ + chmod 0755 $(2)/CONTROL/postinst; \ + fi +endef + + +define KernelPackage + NAME:=$(1) + $(eval $(call KernelPackage/Defaults)) + $(eval $(call KernelPackage/$(1))) + $(eval $(call KernelPackage/$(1)/$(KERNEL))) + + define Package/kmod-$(1) + TITLE:=$(TITLE) + SECTION:=kernel + CATEGORY:=Kernel modules + DEFAULT:=m + DESCRIPTION:=$(DESCRIPTION) + EXTRA_DEPENDS:='kernel (=$(PKG_VERSION)-$(PKG_RELEASE))' + $(call KernelPackage/$(1)) + $(call KernelPackage/$(1)/$(KERNEL)) + endef + + ifeq ($(findstring m,$(KCONFIG)),m) + ifneq ($(strip $(FILES)),) + define Package/kmod-$(1)/install + mkdir -p $$(1)/lib/modules/$(LINUX_VERSION) + $(CP) $$(FILES) $$(1)/lib/modules/$(LINUX_VERSION)/ + $(call ModuleAutoLoad,$(1),$$(1),$(AUTOLOAD)) + endef + endif + endif + $$(eval $$(call BuildPackage,kmod-$(1))) +endef + +define AutoLoad + add_module $(1) "$(2)"; +endef + +include ./modules.mk diff --git a/package/kernel/modules.mk b/package/kernel/modules.mk new file mode 100644 index 0000000000..7449cb3e1b --- /dev/null +++ b/package/kernel/modules.mk @@ -0,0 +1,506 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + + +define KernelPackage/crypto + TITLE:=CryptoAPI modules + KCONFIG:= \ + $(CONFIG_CRYPTO_HMAC) \ + $(CONFIG_CRYPTO_NULL) \ + $(CONFIG_CRYPTO_MD4) \ + $(CONFIG_CRYPTO_MD5) \ + $(CONFIG_CRYPTO_SHA1) \ + $(CONFIG_CRYPTO_SHA256) \ + $(CONFIG_CRYPTO_SHA512) \ + $(CONFIG_CRYPTO_WP512) \ + $(CONFIG_CRYPTO_TGR192) \ + $(CONFIG_CRYPTO_DES) \ + $(CONFIG_CRYPTO_BLOWFISH) \ + $(CONFIG_CRYPTO_TWOFISH) \ + $(CONFIG_CRYPTO_SERPENT) \ + $(CONFIG_CRYPTO_AES) \ + $(CONFIG_CRYPTO_CAST5) \ + $(CONFIG_CRYPTO_CAST6) \ + $(CONFIG_CRYPTO_TEA) \ + $(CONFIG_CRYPTO_ARC4) \ + $(CONFIG_CRYPTO_KHAZAD) \ + $(CONFIG_CRYPTO_ANUBIS) \ + $(CONFIG_CRYPTO_DEFLATE) \ + $(CONFIG_CRYPTO_MICHAEL_MIC) \ + $(CONFIG_CRYPTO_CRC32C) + FILES:=$(MODULES_DIR)/kernel/crypto/*.$(LINUX_KMOD_SUFFIX) +endef +$(eval $(call KernelPackage,crypto)) + +define KernelPackage/ide-core + TITLE:=Kernel support for IDE + DESCRIPTION:=\ + Useful for usb mass storage devices (e.g. on WL-HDD)\\\ + \\\ + Includes: \\\ + - ide-core \\\ + - ide-detect \\\ + - ide-disk + KCONFIG:=$(CONFIG_IDE) + FILES:=$(MODULES_DIR)/kernel/drivers/ide/*.$(LINUX_KMOD_SUFFIX) + AUTOLOAD:=$(call AutoLoad,20,ide-core) $(call AutoLoad,90,ide-detect ide-disk) +endef +$(eval $(call KernelPackage,ide-core)) + +define KernelPackage/ide-pdc202xx + TITLE:=PDC202xx IDE driver + KCONFIG:=$(CONFIG_BLK_DEV_PDC202XX_OLD) + FILES:=$(MODULES_DIR)/kernel/drivers/ide/pci/pdc202xx_old.$(LINUX_KMOD_SUFFIX) + AUTOLOAD:=$(call AutoLoad,30,pdc202xx_old) +endef +$(eval $(call KernelPackage,ide-pdc202xx)) + + +define KernelPackage/lp + TITLE:=Parallel port and line printer support + KCONFIG:=$(CONFIG_PARPORT) + FILES:= \ + $(MODULES_DIR)/kernel/drivers/parport/parport.o \ + $(MODULES_DIR)/kernel/drivers/parport/parport_splink.o \ + $(MODULES_DIR)/kernel/drivers/char/lp.o \ + $(MODULES_DIR)/kernel/drivers/char/ppdev.o + AUTOLOAD:=$(call AutoLoad,50, \ + parport \ + parport_splink \ + lp \ + ) +endef +$(eval $(call KernelPackage,lp)) + + +define KernelPackage/ieee80211softmac + TITLE:=802.11 Networking stack + DESCRIPTION:=\\\ + \\\ + Includes: \\\ + - ieee80211_crypt \\\ + - ieee80211 \\\ + - ieee80211_crypt_wep \\\ + - ieee80211_crypt_tkip \\\ + - ieee80211_crytp_ccmp \\\ + - ieee80211softmac + KCONFIG:=$(CONFIG_IEEE80211_SOFTMAC) + FILES:=$(MODULES_DIR)/kernel/net/ieee80211/*.$(LINUX_KMOD_SUFFIX) $(MODULES_DIR)/kernel/net/ieee80211/softmac/*.$(LINUX_KMOD_SUFFIX) + AUTOLOAD:=$(call AutoLoad,10, \ + ieee80211_crypt \ + ieee80211 \ + ieee80211_crypt_wep \ + ieee80211_crypt_tkip \ + ieee80211_crypt_ccmp \ + ieee80211softmac \ + ) +endef +$(eval $(call KernelPackage,ieee80211softmac)) + + +WIMENU:=Wireless drivers + +define KernelPackage/bcm43xx + TITLE:=Broadcom BCM43xx driver + DESCRIPTION:=\\\ + \\\ + Includes: \\\ + - bcm43xx + KCONFIG:=$(CONFIG_BCM43XX) + FILES:=$(MODULES_DIR)/kernel/drivers/net/wireless/bcm43xx/bcm43xx.$(LINUX_KMOD_SUFFIX) + AUTOLOAD:=$(call Autoload,50,bcm43xx) + SUBMENU:=$(WIMENU) +endef +$(eval $(call KernelPackage,bcm43xx)) + +define KernelPackage/ipw2100 + TITLE:=Intel IPw2100 driver + DESCRIPTION:=\\\ + \\\ + Includes: \\\ + - ipw2100 + KCONFIG:=$(CONFIG_IPW2100) + FILES:=$(MODULES_DIR)/kernel/drivers/net/wireless/ipw2100.$(LINUX_KMOD_SUFFIX) + AUTOLOAD:=$(call Autoload,50,ipw2100) + SUBMENU:=$(WIMENU) +endef +$(eval $(call KernelPackage,ipw2100)) + +define KernelPackage/ipw2200 + TITLE:=Intel IPw2200 driver + DESCRIPTION:=\\\ + \\\ + Includes: \\\ + - ipw2200 + KCONFIG:=$(CONFIG_IPW2200) + FILES:=$(MODULES_DIR)/kernel/drivers/net/wireless/ipw2200.$(LINUX_KMOD_SUFFIX) + AUTOLOAD:=$(call Autoload,50,ipw2200) + SUBMENU:=$(WIMENU) +endef +$(eval $(call KernelPackage,ipw2200)) + + +NFMENU:=Netfilter Extensions + +define KernelPackage/ipt-conntrack + TITLE:=Modules for connection tracking + DESCRIPTION:=\ + Netfilter (IPv4) kernel modules for connection tracking\\\ + \\\ + Includes: \\\ + - ipt_conntrack \\\ + - ipt_helper \\\ + - ipt_connmark/CONNMARK + FILES:=$(foreach mod,$(IPT_CONNTRACK-m),$(MODULES_DIR)/kernel/net/$(mod).$(LINUX_KMOD_SUFFIX)) + SUBMENU:=$(NFMENU) +endef +$(eval $(call KernelPackage,ipt-conntrack)) + +define KernelPackage/ipt-filter + TITLE:=Modules for packet content inspection + DESCRIPTION:=\ + Netfilter (IPv4) kernel modules for packet content inspection \\\ + \\\ + Includes: \\\ + - ipt_ipp2p \\\ + - ipt_layer7 + FILES:=$(foreach mod,$(IPT_FILTER-m),$(MODULES_DIR)/kernel/net/$(mod).$(LINUX_KMOD_SUFFIX)) + SUBMENU:=$(NFMENU) +endef +$(eval $(call KernelPackage,ipt-filter)) + +define KernelPackage/ipt-ipopt + TITLE:=Modules for matching/changing IP packet options + DESCRIPTION:=\ + Netfilter (IPv4) modules for matching/changing IP packet options \\\ + \\\ + Includes: \\\ + - ipt_dscp/DSCP \\\ + - ipt_ecn/ECN \\\ + - ipt_length \\\ + - ipt_mac \\\ + - ipt_tos/TOS \\\ + - ipt_tcpmms \\\ + - ipt_ttl/TTL \\\ + - ipt_unclean + FILES:=$(foreach mod,$(IPT_IPOPT-m),$(MODULES_DIR)/kernel/net/$(mod).$(LINUX_KMOD_SUFFIX)) + SUBMENU:=$(NFMENU) +endef +$(eval $(call KernelPackage,ipt-ipopt)) + +define KernelPackage/ipt-ipsec + TITLE:=Modules for matching IPSec packets + DESCRIPTION:=\ + Netfilter (IPv4) modules for matching IPSec packets \\\ + \\\ + Includes: \\\ + - ipt_ah \\\ + - ipt_esp + FILES:=$(foreach mod,$(IPT_IPSEC-m),$(MODULES_DIR)/kernel/net/$(mod).$(LINUX_KMOD_SUFFIX)) + SUBMENU:=$(NFMENU) +endef +$(eval $(call KernelPackage,ipt-ipsec)) + +define KernelPackage/ipt-nat + TITLE:=Modules for extra NAT targets + DESCRIPTION:=\ + Netfilter (IPv4) modules for extra NAT targets \\\ + \\\ + Includes: \\\ + - ipt_REDIRECT \\\ + - ipt_NETMAP + FILES:=$(foreach mod,$(IPT_NAT-m),$(MODULES_DIR)/kernel/net/$(mod).$(LINUX_KMOD_SUFFIX)) + SUBMENU:=$(NFMENU) +endef +$(eval $(call KernelPackage,ipt-nat)) + +define KernelPackage/ipt-nathelper + TITLE:=Extra Conntrack and NAT helpers + DESCRIPTION:=\ + Extra Netfilter (IPv4) Conntrack and NAT helpers \\\ + \\\ + Includes: \\\ + - ip_conntrack_amanda \\\ + - ip_conntrack_proto_gre \\\ + - ip_nat_proto_gre \\\ + - ip_conntrack_pptp \\\ + - ip_nat_pptp \\\ + - ip_conntrack_sip \\\ + - ip_nat_sip \\\ + - ip_nat_snmp_basic \\\ + - ip_conntrack_tftp + FILES:=$(foreach mod,$(IPT_NAT_EXTRA-m),$(MODULES_DIR)/kernel/net/$(mod).$(LINUX_KMOD_SUFFIX)) + SUBMENU:=$(NFMENU) +endef +$(eval $(call KernelPackage,ipt-nathelper)) + +define KernelPackage/ipt-imq + TITLE:=Intermediate Queueing support + DESCRIPTION:=\ + Kernel support for Intermediate Queueing devices + KCONFIG:=$(CONFIG_IP_NF_TARGET_IMQ) + FILES:=$(MODULES_DIR)/kernel/net/ipv4/netfilter/*IMQ*.$(LINUX_KMOD_SUFFIX) $(MODULES_DIR)/kernel/drivers/net/imq.$(LINUX_KMOD_SUFFIX) + SUBMENU:=$(NFMENU) +endef +$(eval $(call KernelPackage,ipt-imq)) + + +define KernelPackage/ipt-queue + TITLE:=Module for user-space packet queueing + DESCRIPTION:=\ + Netfilter (IPv4) module for user-space packet queueing \\\ + \\\ + Includes: \\\ + - ipt_QUEUE + FILES:=$(foreach mod,$(IPT_QUEUE-m),$(MODULES_DIR)/kernel/net/$(mod).$(LINUX_KMOD_SUFFIX)) + SUBMENU:=$(NFMENU) +endef +$(eval $(call KernelPackage,ipt-queue)) + +define KernelPackage/ipt-ulog + TITLE:=Module for user-space packet logging + DESCRIPTION:=\ + Netfilter (IPv4) module for user-space packet logging \\\ + \\\ + Includes: \\\ + - ipt_ULOG + FILES:=$(foreach mod,$(IPT_ULOG-m),$(MODULES_DIR)/kernel/net/$(mod).$(LINUX_KMOD_SUFFIX)) + SUBMENU:=$(NFMENU) +endef +$(eval $(call KernelPackage,ipt-ulog)) + +define KernelPackage/ipt-extra + TITLE:=Extra modules + DESCRIPTION:=\ + Other Netfilter (IPv4) kernel modules\\\ + Includes: \\\ + - ipt_limit \\\ + - ipt_owner \\\ + - ipt_physdev \\\ + - ipt_pkttype \\\ + - ipt_recent + FILES:=$(foreach mod,$(IPT_EXTRA-m),$(MODULES_DIR)/kernel/net/$(mod).$(LINUX_KMOD_SUFFIX)) + SUBMENU:=$(NFMENU) +endef +$(eval $(call KernelPackage,ipt-extra)) + +define KernelPackage/ip6tables + TITLE:=IPv6 modules + DESCRIPTION:=\ + Netfilter IPv6 firewalling support + KCONFIG:=$(CONFIG_IP6_NF_IPTABLES) + FILES:=$(MODULES_DIR)/kernel/net/ipv6/netfilter/ip*.$(LINUX_KMOD_SUFFIX) + SUBMENU:=$(NFMENU) +endef +$(eval $(call KernelPackage,ip6tables)) + + +define KernelPackage/arptables + TITLE:=ARP firewalling modules + DESCRIPTION:=\ + Kernel modules for ARP firewalling + FILES:=$(MODULES_DIR)/kernel/net/ipv4/netfilter/arp*.$(LINUX_KMOD_SUFFIX) + KCONFIG:=$(CONFIG_IP_NF_ARPTABLES) + SUBMENU:=$(NFMENU) +endef +$(eval $(call KernelPackage,arptables)) + + +define KernelPackage/ebtables + TITLE:=Bridge firewalling modules + DESCRIPTION:=\ + Kernel modules for Ethernet Bridge firewalling + FILES:=$(MODULES_DIR)/kernel/net/bridge/netfilter/*.$(LINUX_KMOD_SUFFIX) + KCONFIG:=$(CONFIG_BRIDGE_NF_EBTABLES) + SUBMENU:=$(NFMENU) +endef +$(eval $(call KernelPackage,ebtables)) + +define KernelPackage/ipip + TITLE:=IP in IP encapsulation support + DESCRIPTION:=\ + Kernel modules for IP in IP encapsulation + FILES:=$(MODULES_DIR)/kernel/net/ipv4/ipip.$(LINUX_KMOD_SUFFIX) + KCONFIG:=$(CONFIG_NET_IPIP) +endef +$(eval $(call KernelPackage,ipip)) + + +define KernelPackage/ipv6 + TITLE:=IPv6 support + DESCRIPTION:=\ + Kernel modules for IPv6 support + KCONFIG:=$(CONFIG_IPV6) + FILES:=$(MODULES_DIR)/kernel/net/ipv6/ipv6.$(LINUX_KMOD_SUFFIX) +endef +$(eval $(call KernelPackage,ipv6)) + + +define KernelPackage/gre + TITLE:=GRE support + DESCRIPTION:=\ + Generic Routing Encapsulation support + KCONFIG=$(CONFIG_NET_IPGRE) + FILES=$(MODULES_DIR)/kernel/net/ipv4/ip_gre.$(LINUX_KMOD_SUFFIX) +endef +$(eval $(call KernelPackage,gre)) + + +define KernelPackage/tun + TITLE:=Universal TUN/TAP driver + DESCRIPTION:=\ + Kernel support for the TUN/TAP tunneling device + KCONFIG:=$(CONFIG_TUN) + FILES:=$(MODULES_DIR)/kernel/drivers/net/tun.$(LINUX_KMOD_SUFFIX) +endef +$(eval $(call KernelPackage,tun)) + + +define KernelPackage/ppp + TITLE:=PPP modules + DESCRIPTION:=\ + Kernel modules for PPP support + KCONFIG:=$(CONFIG_PPP) +endef + +define KernelPackage/ppp/2.6 + FILES:=$(MODULES_DIR)/kernel/drivers/net/ppp_async.ko $(MODULES_DIR)/kernel/drivers/net/ppp_generic.ko $(MODULES_DIR)/kernel/drivers/net/slhc.ko $(MODULES_DIR)/kernel/lib/crc-ccitt.ko + AUTOLOAD:=$(call AutoLoad,30,crc-ccitt) +endef + +define KernelPackage/ppp/2.4 + FILES:=$(MODULES_DIR)/kernel/drivers/net/ppp_async.o $(MODULES_DIR)/kernel/drivers/net/ppp_generic.o $(MODULES_DIR)/kernel/drivers/net/slhc.o +endef +$(eval $(call KernelPackage,ppp)) + + +define KernelPackage/pppoe + TITLE:=PPPoE support + DESCRIPTION:=\ + Kernel modules for PPPoE (PPP over Ethernet) support + DEPENDS:=kmod-ppp + KCONFIG:=$(CONFIG_PPPOE) + FILES:=$(MODULES_DIR)/kernel/drivers/net/pppoe.$(LINUX_KMOD_SUFFIX) $(MODULES_DIR)/kernel/drivers/net/pppox.$(LINUX_KMOD_SUFFIX) +endef +$(eval $(call KernelPackage,pppoe)) + + +define KernelPackage/pppoa + TITLE:=PPPoA support + DESCRIPTION:=\ + Kernel modules for PPPoA (PPP over ATM) support + DEPENDS:=kmod-ppp + KCONFIG:=$(CONFIG_PPPOATM) + FILES:=$(MODULES_DIR)/kernel/net/atm/pppoatm.$(LINUX_KMOD_SUFFIX) +endef +$(eval $(call KernelPackage,pppoa)) + + +define KernelPackage/mppe + TITLE:=Microsoft PPP compression/encryption + DESCRIPTION:=Kernel modules for Microsoft PPP compression/encryption + DEPENDS:=kmod-ppp + KCONFIG:=$(CONFIG_PPP_MPPE) +endef + +define KernelPackage/mppe/2.4 + FILES:=$(MODULES_DIR)/kernel/drivers/net/ppp_mppe_mppc.$(LINUX_KMOD_SUFFIX) +endef + +define KernelPackage/mppe/2.6 + FILES:=$(MODULES_DIR)/kernel/drivers/net/ppp_mppe.$(LINUX_KMOD_SUFFIX) +endef +$(eval $(call KernelPackage,mppe)) + + +define KernelPackage/sched + TITLE:=Traffic schedulers + DESCRIPTION:=\ + Kernel schedulers for IP traffic + FILES:=$(MODULES_DIR)/kernel/net/sched/*.$(LINUX_KMOD_SUFFIX) +endef +$(eval $(call KernelPackage,sched)) + + + +NDMENU:=Network Devices + +define KernelPackage/natsemi + TITLE:=National Semiconductor DP8381x series + DESCRIPTION:=\ + Kernel modules for National Semiconductor DP8381x series PCI Ethernet \\\ + adapters. + FILES:=$(MODULES_DIR)/kernel/drivers/net/natsemi.$(LINUX_KMOD_SUFFIX) + KCONFIG:=$(CONFIG_NATSEMI) + DEPENDS:=@LINUX_2_6_X86 + DEFAULT:=y + SUBMENU:=$(NDMENU) + AUTOLOAD:=$(call AutoLoad,20,natsemi) +endef +$(eval $(call KernelPackage,natsemi)) + +define KernelPackage/sis900 + TITLE:=SiS 900 Ethernet support + DESCRIPTION:=\ + Kernel modules for Sis 900 Ethernet adapters. + FILES:=$(MODULES_DIR)/kernel/drivers/net/sis900.$(LINUX_KMOD_SUFFIX) + KCONFIG:=$(CONFIG_SIS900) + DEPENDS:=@LINUX_2_6_X86||LINUX_2_4_X86 + SUBMENU:=$(NDMENU) +endef +$(eval $(call KernelPackage,sis900)) + +define KernelPackage/via-rhine + TITLE:=Via Rhine ethernet support + DESCRIPTION:=\ + Kernel modules for Via Rhine Ethernet chipsets. + FILES:=$(MODULES_DIR)/kernel/drivers/net/via-rhine.$(LINUX_KMOD_SUFFIX) + KCONFIG:=$(CONFIG_VIA_RHINE) + DEPENDS:=@LINUX_2_6_X86||LINUX_2_4_X86 + SUBMENU:=$(NDMENU) +endef +$(eval $(call KernelPackage,via-rhine)) + +define KernelPackage/8139too + TITLE:=RealTek RTL-8139 PCI Fast Ethernet Adapter kernel support + DESCRIPTION:=\ + Kernel modules for RealTek RTL-8139 PCI Fast Ethernet adapters. + FILES:=$(MODULES_DIR)/kernel/drivers/net/8139too.$(LINUX_KMOD_SUFFIX) + KCONFIG:=$(CONFIG_8139TOO) + DEPENDS:=@LINUX_2_6_X86||LINUX_2_4_X86 + SUBMENU:=$(NDMENU) +endef +$(eval $(call KernelPackage,8139too)) + +define KernelPackage/e100 + TITLE:=Intel(R) PRO/100+ cards kernel support + DESCRIPTION:=\ + Kernel modules for Intel(R) PRO/100+ Ethernet adapters. + FILES:=$(MODULES_DIR)/kernel/drivers/net/e100.$(LINUX_KMOD_SUFFIX) + KCONFIG:=$(CONFIG_E100) + DEPENDS:=@LINUX_2_6_X86||LINUX_2_4_X86 + SUBMENU:=$(NDMENU) +endef +$(eval $(call KernelPackage,e100)) + +define KernelPackage/3c59x + TITLE:=3Com 3c590/3c900 series (592/595/597) Vortex/Boomerang + DESCRIPTION:=\ + This option enables driver support for a large number of 10mbps and \\\ + 10/100mbps EISA, PCI and PCMCIA 3Com Ethernet adapters: \\\ + - "Vortex" (Fast EtherLink 3c590/3c592/3c595/3c597) EISA and PCI \\\ + - "Boomerang" (EtherLink XL 3c900 or 3c905) PCI \\\ + - "Cyclone" (3c540/3c900/3c905/3c980/3c575/3c656) PCI and Cardbus \\\ + - "Tornado" (3c905) PCI \\\ + - "Hurricane" (3c555/3cSOHO) PCI + FILES:=$(MODULES_DIR)/kernel/drivers/net/3c59x.$(LINUX_KMOD_SUFFIX) + KCONFIG:=$(CONFIG_3C59X) + DEPENDS:=@LINUX_2_6_X86||LINUX_2_4_X86 + SUBMENU:=$(NDMENU) +endef +$(eval $(call KernelPackage,3c59x)) diff --git a/package/keynote/Makefile b/package/keynote/Makefile new file mode 100644 index 0000000000..38f1f6901d --- /dev/null +++ b/package/keynote/Makefile @@ -0,0 +1,68 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id: Makefile 4619 2006-08-22 09:50:02Z florian $ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=keynote +PKG_VERSION:=2.3 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=http://downloads.openwrt.org/sources/ +PKG_MD5SUM:=b569066ac2ba1356c2112b118a7d74d0 +PKG_CAT:=bzcat + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/kernel.mk + +define Package/keynote + SECTION:=net + CATEGORY:=Network + DEPENDS:=@LINUX_2_6 +libopenssl + TITLE:=Simple and flexible trust-management system + DESCRIPTION:=\ + KeyNote is a simple and flexible trust-management system designed to work \\\ + well for a variety of large- and small- scale Internet-based applications.\\\ + It provides a single, unified language for both local policies and \\\ + credentials. + URL:=http://www1.cs.columbia.edu/~angelos/keynote.html +endef + +define Build/Configure + $(call Build/Configure/Default, \ + --enable-static \ + --enable-shared \ + ) +endef + +define Build/Compile + $(call Build/Compile/Default, \ + CFLAGS="\$$$$(EXTRA_CFLAGS) \$$$$(EXTRA_LDFLAGS)" \ + ) +endef + +define Build/InstallDev + mkdir -p $(STAGING_DIR)/usr/include + $(CP) $(PKG_BUILD_DIR)/{assertion,header,keynote,signature}.h $(STAGING_DIR)/usr/include/ + mkdir -p $(STAGING_DIR)/usr/lib + $(CP) $(PKG_BUILD_DIR)/libkeynote.a $(STAGING_DIR)/usr/lib/ +endef + +define Build/UninstallDev + rm -rf $(STAGING_DIR)/usr/include/keynote \ + $(STAGING_DIR)/usr/lib/libkeynote.a +endef + +define Package/keynote/install + install -d -m0755 $(1)/usr/sbin + $(CP) $(PKG_BUILD_DIR)/keynote $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,keynote)) diff --git a/package/keynote/patches/01-build.patch b/package/keynote/patches/01-build.patch new file mode 100644 index 0000000000..05351f714c --- /dev/null +++ b/package/keynote/patches/01-build.patch @@ -0,0 +1,327 @@ +diff -ru keynote-2.3/configure.in keynote-2.3.new/configure.in +--- keynote-2.3/configure.in 2000-09-27 01:16:28.000000000 +0200 ++++ keynote-2.3.new/configure.in 2004-01-16 11:34:03.991537404 +0100 +@@ -21,19 +21,13 @@ + AC_PATH_PROG(ECHO, echo, /bin/echo) + AC_PATH_PROG(SED, sed, /usr/bin/sed) + +-dnl Checks for libraries. +-LIBS="-L/usr/lib -L/usr/local/lib -L/usr/ssl/lib -L/usr/openssl/lib\ +- -L/usr/local/ssl/lib -L/usr/local/openssl/lib -L/usr/pkg/lib -L/pkg/lib" +- + AC_CHECK_LIB(m, floor, LIBS="$LIBS -lm") + AC_CHECK_LIB(rsaref, RSAPrivateDecrypt, LIBS="$LIBS -lrsaref") + AC_CHECK_LIB(crypto, i2a_ASN1_STRING, LIBS="$LIBS -lcrypto") + AC_CHECK_LIB(RSAglue, RSA_ref_private_encrypt, LIBS="$LIBS -lRSAglue") + + dnl Checks for header files. +-CPPFLAGS="-I/usr/include -I/usr/local/include -I/usr/ssl/include\ +- -I/usr/local/ssl/include -I/usr/openssl/include -I/usr/pkg/include\ +- -I/usr/local/openssl/include -I/pkg/include" ++CPPFLAGS="-I/usr/include/openssl" + + AC_HEADER_STDC + AC_HEADER_TIME +diff -ru keynote-2.3/keynote-keygen.c keynote-2.3.new/keynote-keygen.c +--- keynote-2.3/keynote-keygen.c 2000-09-27 02:09:13.000000000 +0200 ++++ keynote-2.3.new/keynote-keygen.c 2004-01-16 11:32:06.652242269 +0100 +@@ -161,7 +161,7 @@ + if (strlen(algname) + 2 > prlen) + { + fprintf(stderr, "Parameter ``print-length'' should be larger " +- "than the length of AlgorithmName (%d)\n", strlen(algname)); ++ "than the length of AlgorithmName (%lu)\n", strlen(algname)); + exit(-1); + } + +diff -ru keynote-2.3/keynote.l keynote-2.3.new/keynote.l +--- keynote-2.3/keynote.l 2000-08-11 22:49:13.000000000 +0200 ++++ keynote-2.3.new/keynote.l 2004-01-16 11:17:29.910430978 +0100 +@@ -61,7 +61,8 @@ struct lex_list + static struct lex_list *keynote_lex_list = (struct lex_list *) NULL; + static int keynote_max_lex_list = 32; + static int keynote_lex_counter = 0; +-static int first_tok = 0; ++extern int first_tok; ++int first_tok = 0; + %} + digit [0-9] + specnumber [1-9][0-9]* +@@ -766,7 +767,7 @@ + if (0) + { + yyunput(0, NULL); +- yy_flex_realloc(0, NULL); ++ yy_flex_realloc(NULL, 0); + } + + return en; +diff -ru keynote-2.3/keynote-ver.l keynote-2.3.new/keynote-ver.l +--- keynote-2.3/keynote-ver.l 2000-08-11 22:49:13.000000000 +0200 ++++ keynote-2.3.new/keynote-ver.l 2004-01-16 11:31:14.667107044 +0100 +@@ -267,7 +267,7 @@ + if (0) + { + yyunput(0, NULL); +- yy_flex_realloc(0, NULL); ++ yy_flex_realloc(NULL, 0); + } + } + +diff -ru keynote-2.3/keynote-ver.y keynote-2.3.new/keynote-ver.y +--- keynote-2.3/keynote-ver.y 1999-10-12 00:34:29.000000000 +0200 ++++ keynote-2.3.new/keynote-ver.y 2004-01-16 11:07:19.709634736 +0100 +@@ -49,7 +49,7 @@ + return keynote_errno; + free($1); + } +- ++ ; + expr: VSTRING EQ STRING { int i = kn_add_action(sessid, $1, $3, 0); + + if (i != 0) +@@ -64,6 +64,7 @@ + free($1); + free($3); + } expr ++ ; + %% + void + kverror(char *s) +diff -ru keynote-2.3/keynote.y keynote-2.3.new/keynote.y +--- keynote-2.3/keynote.y 2000-06-14 08:28:23.000000000 +0200 ++++ keynote-2.3.new/keynote.y 2004-01-16 11:14:55.365898229 +0100 +@@ -73,8 +73,7 @@ + %} + %% + +-grammarswitch: LOCINI { keynote_exceptionflag = keynote_donteval = 0; } +- localinit ++grammarswitch: LOCINI { keynote_exceptionflag = keynote_donteval = 0; } localinit + | ACTSTR { keynote_exceptionflag = keynote_donteval = 0; } program + | KEYPRE { keynote_exceptionflag = keynote_donteval = 0; } + keypredicate +@@ -91,17 +90,17 @@ + STRING { keynote_lex_remove($3); + keynote_privkey = $3; + } +- ++ ; + keypredicate: /* Nothing */ { keynote_returnvalue = 0; + return 0; + } + | notemptykeypredicate { keynote_returnvalue = $1; + return 0; + } +- ++ ; + notemptykeypredicate: key { $$ = $1; } + | keyexp { $$ = $1; } +- ++ ; + keyexp: notemptykeypredicate AND { if (($1 == 0) && !keynote_justrecord) + keynote_donteval = 1; + } notemptykeypredicate +@@ -138,7 +137,7 @@ + else + $$ = 0; + } /* K-th */ +- ++ ; + keylist: key + { /* Don't do anything if we're just recording */ + if (!keynote_justrecord && !keynote_donteval) +@@ -155,7 +154,7 @@ + + keylistcount++; + } +- ++ ; + key: str { + if (keynote_donteval) + $$ = 0; +@@ -193,10 +192,10 @@ + } + } + } +- ++ ; + localinit: /* Nothing */ + | localconstants +- ++ ; + localconstants: VARIABLE EQQ STRING + { + int i; +@@ -265,12 +264,12 @@ + if (i != RESULT_TRUE) + return -1; + } localconstants +- ++ ; + program: prog { + keynote_returnvalue = $1; + return 0; + } +- ++ ; + prog: /* Nada */ { $$ = 0; } + | notemptyprog { + /* +@@ -285,7 +284,7 @@ + else + $$ = $4; + } +- ++ ; + notemptyprog: expr HINT afterhint + { + if (checkexception($1)) +@@ -300,7 +299,7 @@ + else + $$ = 0; + } +- ++ ; + afterhint: str { if (keynote_exceptionflag || keynote_donteval) + $$ = 0; + else +@@ -315,7 +314,7 @@ + } + } + | OPENBLOCK prog CLOSEBLOCK { $$ = $2; } +- ++ ; + + expr: OPENPAREN expr CLOSEPAREN { $$ = $2; } + | expr AND { if ($1 == 0) +@@ -334,19 +333,19 @@ + | stringexp { $$ = $1; } + | TRUE { $$ = 1; } + | FALSE { $$ = 0; } +- ++ ; + numexp: numex LT numex { $$ = $1 < $3; } + | numex GT numex { $$ = $1 > $3; } + | numex EQ numex { $$ = $1 == $3; } + | numex LE numex { $$ = $1 <= $3; } + | numex GE numex { $$ = $1 >= $3; } + | numex NE numex { $$ = $1 != $3; } +- ++ ; + floatexp: floatex LT floatex { $$ = $1 < $3; } + | floatex GT floatex { $$ = $1 > $3; } + | floatex LE floatex { $$ = $1 <= $3; } + | floatex GE floatex { $$ = $1 >= $3; } +- ++ ; + numex: numex PLUS numex { $$ = $1 + $3; } + | numex MINUS numex { $$ = $1 - $3; } + | numex MULT numex { $$ = $1 * $3; } +@@ -384,7 +383,7 @@ + free($2); + } + } +- ++ ; + floatex: floatex PLUS floatex { $$ = ($1 + $3); } + | floatex MINUS floatex { $$ = ($1 - $3); } + | floatex MULT floatex { $$ = ($1 * $3); } +@@ -418,7 +417,7 @@ + free($2); + } + } +- ++ ; + stringexp: str EQ str { + if (keynote_exceptionflag || keynote_donteval) + $$ = 0; +@@ -529,9 +528,9 @@ + if (i == 0) + { + #if !defined(HAVE_SNPRINTF) +- sprintf(grp, "%d", preg.re_nsub); ++ sprintf(grp, "%d", (int)preg.re_nsub); + #else /* !HAVE_SNPRINTF */ +- snprintf(grp, 3, "%d", preg.re_nsub); ++ snprintf(grp, 3, "%d", (int)preg.re_nsub); + #endif /* !HAVE_SNPRINTF */ + if (keynote_env_add("_0", grp, &keynote_temp_list, + 1, 0) != RESULT_TRUE) +@@ -579,7 +578,7 @@ + } + } + } +- ++ ; + str: str DOTT str { if (keynote_exceptionflag || keynote_donteval) + $$ = (char *) NULL; + else +@@ -605,7 +604,7 @@ + } + } + | strnotconcat { $$ = $1; } +- ++ ; + strnotconcat: STRING { $$ = $1; } + | OPENPAREN str CLOSEPAREN { $$ = $2; } + | VARIABLE { if (keynote_exceptionflag || keynote_donteval) +@@ -660,6 +659,7 @@ + return -1; + } + } ++ ; + %% + + /* +diff -ru keynote-2.3/Makefile.in keynote-2.3.new/Makefile.in +--- keynote-2.3/Makefile.in 2000-09-27 01:16:27.000000000 +0200 ++++ keynote-2.3.new/Makefile.in 2004-01-16 11:35:38.841528129 +0100 +@@ -41,7 +41,7 @@ + YACCFLAGS = -d -p kn -b k + LEXFLAGS2 = -Pkv -s -i + LEXFLAGS = -Cr -Pkn -s -i +-CFLAGS = -O2 -Wall # -g ++CFLAGS = -O2 -Wall -fno-strict-aliasing # -g + RMFLAGS2 = -rf + RMFLAGS = -f + NROFFFLAGS = -mandoc +diff -ru keynote-2.3/signature.c keynote-2.3.new/signature.c +--- keynote-2.3/signature.c 1999-10-12 00:34:31.000000000 +0200 ++++ keynote-2.3.new/signature.c 2004-01-16 11:30:48.062084986 +0100 +@@ -515,7 +515,7 @@ + kk = dc->dec_key; + if (keytype == KEYNOTE_PRIVATE_KEY) + { +- if (d2i_DSAPrivateKey((DSA **) &kk, &decoded, len) == (DSA *) NULL) ++ if (d2i_DSAPrivateKey((DSA **) &kk, (const unsigned char **) &decoded, len) == (DSA *) NULL) + { + if (ptr != (unsigned char *) NULL) + free(ptr); +@@ -526,7 +526,7 @@ + } + else + { +- if (d2i_DSAPublicKey((DSA **) &kk, &decoded, len) == (DSA *) NULL) ++ if (d2i_DSAPublicKey((DSA **) &kk, (const unsigned char **) &decoded, len) == (DSA *) NULL) + { + if (ptr != (unsigned char *) NULL) + free(ptr); +@@ -556,7 +556,7 @@ + kk = dc->dec_key; + if (keytype == KEYNOTE_PRIVATE_KEY) + { +- if (d2i_RSAPrivateKey((RSA **) &kk, &decoded, len) == (RSA *) NULL) ++ if (d2i_RSAPrivateKey((RSA **) &kk, (const unsigned char **) &decoded, len) == (RSA *) NULL) + { + if (ptr != (unsigned char *) NULL) + free(ptr); +@@ -567,7 +567,7 @@ + } + else + { +- if (d2i_RSAPublicKey((RSA **) &kk, &decoded, len) == (RSA *) NULL) ++ if (d2i_RSAPublicKey((RSA **) &kk, (const unsigned char **) &decoded, len) == (RSA *) NULL) + { + if (ptr != (unsigned char *) NULL) + free(ptr); diff --git a/package/keynote/patches/02-cross_compile.patch b/package/keynote/patches/02-cross_compile.patch new file mode 100644 index 0000000000..c6d5365507 --- /dev/null +++ b/package/keynote/patches/02-cross_compile.patch @@ -0,0 +1,586 @@ +diff -urN keynote-2.3/configure keynote-2.3.new/configure +--- keynote-2.3/configure 2000-09-27 01:16:28.000000000 +0200 ++++ keynote-2.3.new/configure 2006-09-01 19:16:35.000000000 +0200 +@@ -889,52 +889,10 @@ + done + test -n "$YACC" || YACC="yacc" + +-for ac_prog in openssl ssleay +-do +-# Extract the first word of "$ac_prog", so it can be a program name with args. +-set dummy $ac_prog; ac_word=$2 +-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +-echo "configure:898: checking for $ac_word" >&5 +-if eval "test \"`echo '$''{'ac_cv_path_SSLEAY'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 +-else +- case "$SSLEAY" in +- /*) +- ac_cv_path_SSLEAY="$SSLEAY" # Let the user override the test with a path. +- ;; +- ?:/*) +- ac_cv_path_SSLEAY="$SSLEAY" # Let the user override the test with a dos path. +- ;; +- *) +- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" +- ac_dummy="\ +- $PATH:/usr/local/bin:/usr/local/ssl/sbin:/usr/local/ssl/bin:/usr/ssl/bin:/usr/ssl/sbin:/usr/sbin:/usr/openssl/bin:/usr/openssl/bin:/usr/local/openssl/bin:/usr/local/openssl/sbin" +- for ac_dir in $ac_dummy; do +- test -z "$ac_dir" && ac_dir=. +- if test -f $ac_dir/$ac_word; then +- ac_cv_path_SSLEAY="$ac_dir/$ac_word" +- break +- fi +- done +- IFS="$ac_save_ifs" +- ;; +-esac +-fi +-SSLEAY="$ac_cv_path_SSLEAY" +-if test -n "$SSLEAY"; then +- echo "$ac_t""$SSLEAY" 1>&6 +-else +- echo "$ac_t""no" 1>&6 +-fi +- +-test -n "$SSLEAY" && break +-done +-test -n "$SSLEAY" || SSLEAY="/usr/local/bin/ssleay" +- + # Extract the first word of "rm", so it can be a program name with args. + set dummy rm; ac_word=$2 + echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +-echo "configure:938: checking for $ac_word" >&5 ++echo "configure:896: checking for $ac_word" >&5 + if eval "test \"`echo '$''{'ac_cv_path_RM'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else +@@ -970,7 +928,7 @@ + # Extract the first word of "ar", so it can be a program name with args. + set dummy ar; ac_word=$2 + echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +-echo "configure:974: checking for $ac_word" >&5 ++echo "configure:932: checking for $ac_word" >&5 + if eval "test \"`echo '$''{'ac_cv_path_AR'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else +@@ -1006,7 +964,7 @@ + # Extract the first word of "nroff", so it can be a program name with args. + set dummy nroff; ac_word=$2 + echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +-echo "configure:1010: checking for $ac_word" >&5 ++echo "configure:968: checking for $ac_word" >&5 + if eval "test \"`echo '$''{'ac_cv_path_NROFF'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else +@@ -1042,7 +1000,7 @@ + # Extract the first word of "tar", so it can be a program name with args. + set dummy tar; ac_word=$2 + echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +-echo "configure:1046: checking for $ac_word" >&5 ++echo "configure:1004: checking for $ac_word" >&5 + if eval "test \"`echo '$''{'ac_cv_path_TAR'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else +@@ -1078,7 +1036,7 @@ + # Extract the first word of "true", so it can be a program name with args. + set dummy true; ac_word=$2 + echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +-echo "configure:1082: checking for $ac_word" >&5 ++echo "configure:1040: checking for $ac_word" >&5 + if eval "test \"`echo '$''{'ac_cv_path_TRUE'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else +@@ -1114,7 +1072,7 @@ + # Extract the first word of "mkdir", so it can be a program name with args. + set dummy mkdir; ac_word=$2 + echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +-echo "configure:1118: checking for $ac_word" >&5 ++echo "configure:1076: checking for $ac_word" >&5 + if eval "test \"`echo '$''{'ac_cv_path_MKDIR'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else +@@ -1150,7 +1108,7 @@ + # Extract the first word of "tr", so it can be a program name with args. + set dummy tr; ac_word=$2 + echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +-echo "configure:1154: checking for $ac_word" >&5 ++echo "configure:1112: checking for $ac_word" >&5 + if eval "test \"`echo '$''{'ac_cv_path_TR'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else +@@ -1186,7 +1144,7 @@ + # Extract the first word of "echo", so it can be a program name with args. + set dummy echo; ac_word=$2 + echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +-echo "configure:1190: checking for $ac_word" >&5 ++echo "configure:1148: checking for $ac_word" >&5 + if eval "test \"`echo '$''{'ac_cv_path_ECHO'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else +@@ -1222,7 +1180,7 @@ + # Extract the first word of "sed", so it can be a program name with args. + set dummy sed; ac_word=$2 + echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +-echo "configure:1226: checking for $ac_word" >&5 ++echo "configure:1184: checking for $ac_word" >&5 + if eval "test \"`echo '$''{'ac_cv_path_SED'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else +@@ -1256,11 +1214,8 @@ + fi + + +-LIBS="-L/usr/lib -L/usr/local/lib -L/usr/ssl/lib -L/usr/openssl/lib\ +- -L/usr/local/ssl/lib -L/usr/local/openssl/lib -L/usr/pkg/lib -L/pkg/lib" +- + echo $ac_n "checking for floor in -lm""... $ac_c" 1>&6 +-echo "configure:1264: checking for floor in -lm" >&5 ++echo "configure:1219: checking for floor in -lm" >&5 + ac_lib_var=`echo m'_'floor | sed 'y%./+-%__p_%'` + if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +@@ -1268,7 +1223,7 @@ + ac_save_LIBS="$LIBS" + LIBS="-lm $LIBS" + cat > conftest.$ac_ext <<EOF +-#line 1272 "configure" ++#line 1227 "configure" + #include "confdefs.h" + /* Override any gcc2 internal prototype to avoid an error. */ + /* We use char because int might match the return type of a gcc2 +@@ -1279,7 +1234,7 @@ + floor() + ; return 0; } + EOF +-if { (eval echo configure:1283: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ++if { (eval echo configure:1238: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" + else +@@ -1300,7 +1255,7 @@ + fi + + echo $ac_n "checking for RSAPrivateDecrypt in -lrsaref""... $ac_c" 1>&6 +-echo "configure:1304: checking for RSAPrivateDecrypt in -lrsaref" >&5 ++echo "configure:1259: checking for RSAPrivateDecrypt in -lrsaref" >&5 + ac_lib_var=`echo rsaref'_'RSAPrivateDecrypt | sed 'y%./+-%__p_%'` + if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +@@ -1308,7 +1263,7 @@ + ac_save_LIBS="$LIBS" + LIBS="-lrsaref $LIBS" + cat > conftest.$ac_ext <<EOF +-#line 1312 "configure" ++#line 1267 "configure" + #include "confdefs.h" + /* Override any gcc2 internal prototype to avoid an error. */ + /* We use char because int might match the return type of a gcc2 +@@ -1319,7 +1274,7 @@ + RSAPrivateDecrypt() + ; return 0; } + EOF +-if { (eval echo configure:1323: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ++if { (eval echo configure:1278: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" + else +@@ -1340,7 +1295,7 @@ + fi + + echo $ac_n "checking for i2a_ASN1_STRING in -lcrypto""... $ac_c" 1>&6 +-echo "configure:1344: checking for i2a_ASN1_STRING in -lcrypto" >&5 ++echo "configure:1299: checking for i2a_ASN1_STRING in -lcrypto" >&5 + ac_lib_var=`echo crypto'_'i2a_ASN1_STRING | sed 'y%./+-%__p_%'` + if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +@@ -1348,7 +1303,7 @@ + ac_save_LIBS="$LIBS" + LIBS="-lcrypto $LIBS" + cat > conftest.$ac_ext <<EOF +-#line 1352 "configure" ++#line 1307 "configure" + #include "confdefs.h" + /* Override any gcc2 internal prototype to avoid an error. */ + /* We use char because int might match the return type of a gcc2 +@@ -1359,7 +1314,7 @@ + i2a_ASN1_STRING() + ; return 0; } + EOF +-if { (eval echo configure:1363: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ++if { (eval echo configure:1318: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" + else +@@ -1380,7 +1335,7 @@ + fi + + echo $ac_n "checking for RSA_ref_private_encrypt in -lRSAglue""... $ac_c" 1>&6 +-echo "configure:1384: checking for RSA_ref_private_encrypt in -lRSAglue" >&5 ++echo "configure:1339: checking for RSA_ref_private_encrypt in -lRSAglue" >&5 + ac_lib_var=`echo RSAglue'_'RSA_ref_private_encrypt | sed 'y%./+-%__p_%'` + if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +@@ -1388,7 +1343,7 @@ + ac_save_LIBS="$LIBS" + LIBS="-lRSAglue $LIBS" + cat > conftest.$ac_ext <<EOF +-#line 1392 "configure" ++#line 1347 "configure" + #include "confdefs.h" + /* Override any gcc2 internal prototype to avoid an error. */ + /* We use char because int might match the return type of a gcc2 +@@ -1399,7 +1354,7 @@ + RSA_ref_private_encrypt() + ; return 0; } + EOF +-if { (eval echo configure:1403: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ++if { (eval echo configure:1358: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" + else +@@ -1420,12 +1375,9 @@ + fi + + +-CPPFLAGS="-I/usr/include -I/usr/local/include -I/usr/ssl/include\ +- -I/usr/local/ssl/include -I/usr/openssl/include -I/usr/pkg/include\ +- -I/usr/local/openssl/include -I/pkg/include" + + echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +-echo "configure:1429: checking how to run the C preprocessor" >&5 ++echo "configure:1381: checking how to run the C preprocessor" >&5 + # On Suns, sometimes $CPP names a directory. + if test -n "$CPP" && test -d "$CPP"; then + CPP= +@@ -1440,13 +1392,13 @@ + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. + cat > conftest.$ac_ext <<EOF +-#line 1444 "configure" ++#line 1396 "configure" + #include "confdefs.h" + #include <assert.h> + Syntax Error + EOF + ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +-{ (eval echo configure:1450: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ++{ (eval echo configure:1402: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } + ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` + if test -z "$ac_err"; then + : +@@ -1457,13 +1409,13 @@ + rm -rf conftest* + CPP="${CC-cc} -E -traditional-cpp" + cat > conftest.$ac_ext <<EOF +-#line 1461 "configure" ++#line 1413 "configure" + #include "confdefs.h" + #include <assert.h> + Syntax Error + EOF + ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +-{ (eval echo configure:1467: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ++{ (eval echo configure:1419: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } + ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` + if test -z "$ac_err"; then + : +@@ -1474,13 +1426,13 @@ + rm -rf conftest* + CPP="${CC-cc} -nologo -E" + cat > conftest.$ac_ext <<EOF +-#line 1478 "configure" ++#line 1430 "configure" + #include "confdefs.h" + #include <assert.h> + Syntax Error + EOF + ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +-{ (eval echo configure:1484: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ++{ (eval echo configure:1436: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } + ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` + if test -z "$ac_err"; then + : +@@ -1505,12 +1457,12 @@ + echo "$ac_t""$CPP" 1>&6 + + echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 +-echo "configure:1509: checking for ANSI C header files" >&5 ++echo "configure:1461: checking for ANSI C header files" >&5 + if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext <<EOF +-#line 1514 "configure" ++#line 1466 "configure" + #include "confdefs.h" + #include <stdlib.h> + #include <stdarg.h> +@@ -1518,7 +1470,7 @@ + #include <float.h> + EOF + ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +-{ (eval echo configure:1522: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ++{ (eval echo configure:1474: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } + ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` + if test -z "$ac_err"; then + rm -rf conftest* +@@ -1535,7 +1487,7 @@ + if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat > conftest.$ac_ext <<EOF +-#line 1539 "configure" ++#line 1491 "configure" + #include "confdefs.h" + #include <string.h> + EOF +@@ -1553,7 +1505,7 @@ + if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat > conftest.$ac_ext <<EOF +-#line 1557 "configure" ++#line 1509 "configure" + #include "confdefs.h" + #include <stdlib.h> + EOF +@@ -1574,7 +1526,7 @@ + : + else + cat > conftest.$ac_ext <<EOF +-#line 1578 "configure" ++#line 1530 "configure" + #include "confdefs.h" + #include <ctype.h> + #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +@@ -1585,7 +1537,7 @@ + exit (0); } + + EOF +-if { (eval echo configure:1589: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null ++if { (eval echo configure:1541: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null + then + : + else +@@ -1609,12 +1561,12 @@ + fi + + echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 +-echo "configure:1613: checking whether time.h and sys/time.h may both be included" >&5 ++echo "configure:1565: checking whether time.h and sys/time.h may both be included" >&5 + if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext <<EOF +-#line 1618 "configure" ++#line 1570 "configure" + #include "confdefs.h" + #include <sys/types.h> + #include <sys/time.h> +@@ -1623,7 +1575,7 @@ + struct tm *tp; + ; return 0; } + EOF +-if { (eval echo configure:1627: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then ++if { (eval echo configure:1579: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_header_time=yes + else +@@ -1647,17 +1599,17 @@ + do + ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` + echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +-echo "configure:1651: checking for $ac_hdr" >&5 ++echo "configure:1603: checking for $ac_hdr" >&5 + if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext <<EOF +-#line 1656 "configure" ++#line 1608 "configure" + #include "confdefs.h" + #include <$ac_hdr> + EOF + ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +-{ (eval echo configure:1661: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ++{ (eval echo configure:1613: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } + ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` + if test -z "$ac_err"; then + rm -rf conftest* +@@ -1687,17 +1639,17 @@ + do + ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` + echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +-echo "configure:1691: checking for $ac_hdr" >&5 ++echo "configure:1643: checking for $ac_hdr" >&5 + if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext <<EOF +-#line 1696 "configure" ++#line 1648 "configure" + #include "confdefs.h" + #include <$ac_hdr> + EOF + ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +-{ (eval echo configure:1701: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ++{ (eval echo configure:1653: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } + ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` + if test -z "$ac_err"; then + rm -rf conftest* +@@ -1726,12 +1678,12 @@ + + + echo $ac_n "checking for working const""... $ac_c" 1>&6 +-echo "configure:1730: checking for working const" >&5 ++echo "configure:1682: checking for working const" >&5 + if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext <<EOF +-#line 1735 "configure" ++#line 1687 "configure" + #include "confdefs.h" + + int main() { +@@ -1780,7 +1732,7 @@ + + ; return 0; } + EOF +-if { (eval echo configure:1784: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then ++if { (eval echo configure:1736: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_c_const=yes + else +@@ -1801,12 +1753,12 @@ + fi + + echo $ac_n "checking for u_int""... $ac_c" 1>&6 +-echo "configure:1805: checking for u_int" >&5 ++echo "configure:1757: checking for u_int" >&5 + if eval "test \"`echo '$''{'ac_cv_type_u_int'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext <<EOF +-#line 1810 "configure" ++#line 1762 "configure" + #include "confdefs.h" + #include <sys/types.h> + #if STDC_HEADERS +@@ -1834,12 +1786,12 @@ + fi + + echo $ac_n "checking for u_char""... $ac_c" 1>&6 +-echo "configure:1838: checking for u_char" >&5 ++echo "configure:1790: checking for u_char" >&5 + if eval "test \"`echo '$''{'ac_cv_type_u_char'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext <<EOF +-#line 1843 "configure" ++#line 1795 "configure" + #include "confdefs.h" + #include <sys/types.h> + #if STDC_HEADERS +@@ -1870,12 +1822,12 @@ + for ac_func in regcomp open close read _open _close _read strchr memcpy + do + echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +-echo "configure:1874: checking for $ac_func" >&5 ++echo "configure:1826: checking for $ac_func" >&5 + if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext <<EOF +-#line 1879 "configure" ++#line 1831 "configure" + #include "confdefs.h" + /* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +@@ -1898,7 +1850,7 @@ + + ; return 0; } + EOF +-if { (eval echo configure:1902: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ++if { (eval echo configure:1854: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" + else +@@ -1925,12 +1877,12 @@ + for ac_func in strcasecmp strncasecmp stricmp strnicmp snprintf __b64_ntop + do + echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +-echo "configure:1929: checking for $ac_func" >&5 ++echo "configure:1881: checking for $ac_func" >&5 + if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext <<EOF +-#line 1934 "configure" ++#line 1886 "configure" + #include "confdefs.h" + /* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +@@ -1953,7 +1905,7 @@ + + ; return 0; } + EOF +-if { (eval echo configure:1957: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ++if { (eval echo configure:1909: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" + else +@@ -1980,12 +1932,12 @@ + for ac_func in getopt + do + echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +-echo "configure:1984: checking for $ac_func" >&5 ++echo "configure:1936: checking for $ac_func" >&5 + if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext <<EOF +-#line 1989 "configure" ++#line 1941 "configure" + #include "confdefs.h" + /* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +@@ -2008,7 +1960,7 @@ + + ; return 0; } + EOF +-if { (eval echo configure:2012: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ++if { (eval echo configure:1964: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" + else +@@ -2172,7 +2124,6 @@ + s%@CC@%$CC%g + s%@RANLIB@%$RANLIB%g + s%@YACC@%$YACC%g +-s%@SSLEAY@%$SSLEAY%g + s%@RM@%$RM%g + s%@AR@%$AR%g + s%@NROFF@%$NROFF%g +diff -urN keynote-2.3/configure.in keynote-2.3.new/configure.in +--- keynote-2.3/configure.in 2006-09-01 19:08:13.000000000 +0200 ++++ keynote-2.3.new/configure.in 2006-09-01 19:16:05.000000000 +0200 +@@ -9,8 +9,8 @@ + AC_PROG_CC + AC_PROG_RANLIB + AC_PROG_YACC +-AC_PATH_PROGS(SSLEAY, openssl ssleay, /usr/local/bin/ssleay, \ +- $PATH:/usr/local/bin:/usr/local/ssl/sbin:/usr/local/ssl/bin:/usr/ssl/bin:/usr/ssl/sbin:/usr/sbin:/usr/openssl/bin:/usr/openssl/bin:/usr/local/openssl/bin:/usr/local/openssl/sbin) ++dnl AC_PATH_PROGS(SSLEAY, openssl ssleay, /usr/local/bin/ssleay, \ ++dnl $PATH:/usr/local/bin:/usr/local/ssl/sbin:/usr/local/ssl/bin:/usr/ssl/bin:/usr/ssl/sbin:/usr/sbin:/usr/openssl/bin:/usr/openssl/bin:/usr/local/openssl/bin:/usr/local/openssl/sbin) + AC_PATH_PROG(RM, rm, /bin/rm) + AC_PATH_PROG(AR, ar, /usr/bin/ar) + AC_PATH_PROG(NROFF, nroff, /usr/bin/nroff) +@@ -27,7 +27,7 @@ + AC_CHECK_LIB(RSAglue, RSA_ref_private_encrypt, LIBS="$LIBS -lRSAglue") + + dnl Checks for header files. +-CPPFLAGS="-I/usr/include/openssl" ++dnl CPPFLAGS="-I/usr/include/openssl" + + AC_HEADER_STDC + AC_HEADER_TIME diff --git a/package/libpcap/Makefile b/package/libpcap/Makefile new file mode 100644 index 0000000000..f8de02d559 --- /dev/null +++ b/package/libpcap/Makefile @@ -0,0 +1,97 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=libpcap +PKG_VERSION:=0.9.4 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://www.tcpdump.org/release/ +PKG_MD5SUM:=79025766e8027df154cb1f32de8a7974 +PKG_CAT:=zcat + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/$(PKG_NAME)-$(PKG_VERSION) +PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install + +include $(INCLUDE_DIR)/package.mk + +define Package/libpcap + SECTION:=libs + CATEGORY:=Libraries + TITLE:=Low-level packet capture library + DESCRIPTION:=\ + This package contains a system-independent library for user-level \\\ + network packet capture. + URL:=http://www.tcpdump.org/ +endef + +define Build/Configure + (cd $(PKG_BUILD_DIR); rm -f config.cache; \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS)" \ + CPPFLAGS="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \ + LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \ + ac_cv_linux_vers= \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --program-prefix="" \ + --program-suffix="" \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --datadir=/usr/share \ + --includedir=/usr/include \ + --infodir=/usr/share/info \ + --libdir=/usr/lib \ + --libexecdir=/usr/lib \ + --localstatedir=/var \ + --mandir=/usr/share/man \ + --sbindir=/usr/sbin \ + --sysconfdir=/etc \ + $(DISABLE_NLS) \ + $(DISABLE_LARGEFILE) \ + --enable-shared \ + --enable-static \ + --disable-yydebug \ + --enable-ipv6 \ + --with-build-cc="$(HOSTCC)" \ + --with-pcap=linux \ + ); +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + CCOPT="$(TARGET_CFLAGS) -I$(BUILD_DIR)/linux/include" \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + all install +endef + +define Build/InstallDev + mkdir -p $(STAGING_DIR)/usr/include + $(CP) $(PKG_INSTALL_DIR)/usr/include/pcap{,-bpf,-namedb}.h \ + $(STAGING_DIR)/usr/include/ + mkdir -p $(STAGING_DIR)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpcap.{a,so*} \ + $(STAGING_DIR)/usr/lib/ +endef + +define Build/UninstallDev + rm -rf $(STAGING_DIR)/usr/include/pcap{,-bpf,-named}.h \ + $(STAGING_DIR)/usr/lib/libpcap.{a,so*} +endef + +define Package/libpcap/install + install -m0755 -d $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpcap.so.* $(1)/usr/lib/ +endef + +$(eval $(call BuildPackage,libpcap)) diff --git a/package/libpcap/patches/100-shared-lib.patch b/package/libpcap/patches/100-shared-lib.patch new file mode 100644 index 0000000000..54cc774a37 --- /dev/null +++ b/package/libpcap/patches/100-shared-lib.patch @@ -0,0 +1,120 @@ +diff -urN libpcap-0.9.4.orig/Makefile.in libpcap-0.9.4/Makefile.in +--- libpcap-0.9.4.orig/Makefile.in 2003-12-15 02:35:03.000000000 +0100 ++++ libpcap-0.9.4/Makefile.in 2006-02-05 16:56:18.000000000 +0100 +@@ -37,6 +37,15 @@ + srcdir = @srcdir@ + VPATH = @srcdir@ + ++# some defines for shared library compilation ++MAJ=0.9 ++MIN=4 ++VERSION=$(MAJ).$(MIN) ++LIBNAME=pcap ++LIBRARY=lib$(LIBNAME).a ++SOLIBRARY=lib$(LIBNAME).so ++SHAREDLIB=$(SOLIBRARY).$(VERSION) ++ + # + # You shouldn't need to edit anything below. + # +@@ -50,6 +59,7 @@ + + # Standard CFLAGS + CFLAGS = $(CCOPT) $(INCLS) $(DEFS) ++CFLAGS_SHARED = -shared -Wl,-soname,$(SOLIBRARY).$(MAJ) + + INSTALL = @INSTALL@ + INSTALL_PROGRAM = @INSTALL_PROGRAM@ +@@ -70,7 +80,12 @@ + .c.o: + @rm -f $@ + $(CC) $(CFLAGS) -c $(srcdir)/$*.c ++ $(CC) $(CFLAGS) -c -o $@ $(srcdir)/$*.c + ++%_pic.o: %.c ++ @rm -f $@ ++ $(CC) -fPIC $(CFLAGS) -c -o $@ $(srcdir)/$*.c ++ + PSRC = pcap-@V_PCAP@.c + FSRC = fad-@V_FINDALLDEVS@.c + SSRC = @SSRC@ +@@ -84,6 +99,7 @@ + # We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot + # hack the extra indirection + OBJ = $(PSRC:.c=.o) $(FSRC:.c=.o) $(CSRC:.c=.o) $(SSRC:.c=.o) $(GENSRC:.c=.o) $(LIBOBJS) ++OBJ_PIC = $(PSRC:.c=_pic.o) $(FSRC:.c=_pic.o) $(CSRC:.c=_pic.o) $(SSRC:.c=_pic.o) $(GENSRC:.c=_pic.o) + HDR = pcap.h pcap-int.h pcap-namedb.h pcap-nit.h pcap-pf.h \ + ethertype.h gencode.h gnuc.h + GENHDR = \ +@@ -95,15 +111,23 @@ + TAGFILES = \ + $(SRC) $(HDR) $(TAGHDR) + +-CLEANFILES = $(OBJ) libpcap.a $(GENSRC) $(GENHDR) lex.yy.c ++CLEANFILES = $(OBJ) $(OBJ_PIC) libpcap.a $(GENSRC) $(GENHDR) lex.yy.c libpcap.so* + +-all: libpcap.a ++all: libpcap.a $(SHAREDLIB) + + libpcap.a: $(OBJ) + @rm -f $@ + ar rc $@ $(OBJ) $(LIBS) + $(RANLIB) $@ + ++$(SHAREDLIB): $(OBJ_PIC) ++ -@rm -f $@ ++ -@rm -f $(SOLIBRARY) $(SOLIBRARY).$(MAJ) ++ $(CC) $(CFLAGS_SHARED) -o $(SHAREDLIB) $(OBJ_PIC) -lc ++ ln -s $(SHAREDLIB) $(SOLIBRARY).$(MAJ) ++ ln -s $(SOLIBRARY).$(MAJ) $(SOLIBRARY) ++ ++ + shared: libpcap.$(DYEXT) + + # +@@ -129,6 +153,10 @@ + scanner.o: scanner.c tokdefs.h + $(CC) $(CFLAGS) -c scanner.c + ++scanner_pic.o: scanner.c tokdefs.h ++ $(CC) -fPIC $(CFLAGS) -o $@ -c scanner.c ++ ++ + pcap.o: version.h + + tokdefs.h: grammar.c +@@ -142,9 +170,16 @@ + @rm -f $@ + $(CC) $(CFLAGS) -Dyylval=pcap_lval -c grammar.c + ++grammar_pic.o: grammar.c ++ @rm -f $@ ++ $(CC) -fPIC $(CFLAGS) -Dyylval=pcap_lval -o $@ -c grammar.c ++ + version.o: version.c + $(CC) $(CFLAGS) -c version.c + ++version_pic.o: version.c ++ $(CC) -fPIC $(CFLAGS) -c version.c -o $@ ++ + snprintf.o: $(srcdir)/missing/snprintf.c + $(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c + +@@ -170,10 +205,17 @@ + bpf_filter.o: bpf_filter.c + $(CC) $(CFLAGS) -c bpf_filter.c + ++bpf_filter_pic.o: bpf_filter.c ++ $(CC) -fPIC $(CFLAGS) -c bpf_filter.c -o $@ ++ ++ + install: libpcap.a + [ -d $(DESTDIR)$(libdir) ] || \ + (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir)) + $(INSTALL_DATA) libpcap.a $(DESTDIR)$(libdir)/libpcap.a ++ $(INSTALL_DATA) $(SHAREDLIB) $(DESTDIR)$(libdir)/ ++ ln -sf $(SHAREDLIB) $(DESTDIR)$(libdir)/$(SOLIBRARY).$(MAJ) ++ ln -sf $(SOLIBRARY).$(MAJ) $(DESTDIR)$(libdir)/$(SOLIBRARY) + $(RANLIB) $(DESTDIR)$(libdir)/libpcap.a + [ -d $(DESTDIR)$(includedir) ] || \ + (mkdir -p $(DESTDIR)$(includedir); chmod 755 $(DESTDIR)$(includedir)) diff --git a/package/libpcap/patches/101-cross-compile-fix.patch b/package/libpcap/patches/101-cross-compile-fix.patch new file mode 100644 index 0000000000..5ba78adaef --- /dev/null +++ b/package/libpcap/patches/101-cross-compile-fix.patch @@ -0,0 +1,12 @@ +diff -urN libpcap-0.9.4.orig/Makefile.in libpcap-0.9.4/Makefile.in +--- libpcap-0.9.4.orig/Makefile.in 2006-02-05 16:57:16.000000000 +0100 ++++ libpcap-0.9.4/Makefile.in 2006-02-05 16:57:03.000000000 +0100 +@@ -117,7 +117,7 @@ + + libpcap.a: $(OBJ) + @rm -f $@ +- ar rc $@ $(OBJ) $(LIBS) ++ $(AR) rc $@ $(OBJ) $(LIBS) + $(RANLIB) $@ + + $(SHAREDLIB): $(OBJ_PIC) diff --git a/package/libpcap/patches/102-alt-ether.patch b/package/libpcap/patches/102-alt-ether.patch new file mode 100644 index 0000000000..347265d6e9 --- /dev/null +++ b/package/libpcap/patches/102-alt-ether.patch @@ -0,0 +1,40 @@ +diff -urN libpcap-0.9.4.orig/nametoaddr.c libpcap-0.9.4/nametoaddr.c +--- libpcap-0.9.4.orig/nametoaddr.c 2005-04-20 13:13:51.000000000 +0200 ++++ libpcap-0.9.4/nametoaddr.c 2006-02-05 16:58:46.000000000 +0100 +@@ -410,7 +410,7 @@ + e = ep = (u_char *)malloc(6); + + while (*s) { +- if (*s == ':') ++ if (*s == ':' || *s == '.') + s += 1; + d = xdtoi(*s++); + if (isxdigit((unsigned char)*s)) { +diff -urN libpcap-0.9.4.orig/scanner.l libpcap-0.9.4/scanner.l +--- libpcap-0.9.4.orig/scanner.l 2005-09-05 11:08:07.000000000 +0200 ++++ libpcap-0.9.4/scanner.l 2006-02-05 17:00:13.000000000 +0100 +@@ -80,6 +80,7 @@ + N ([0-9]+|(0X|0x)[0-9A-Fa-f]+) + B ([0-9A-Fa-f][0-9A-Fa-f]?) + W ([0-9A-Fa-f][0-9A-Fa-f]?[0-9A-Fa-f]?[0-9A-Fa-f]?) ++X [0-9A-Fa-f] + + %a 16000 + %o 19000 +@@ -306,7 +307,7 @@ + {N} { yylval.i = stoi((char *)yytext); return NUM; } + ({N}\.{N})|({N}\.{N}\.{N})|({N}\.{N}\.{N}\.{N}) { + yylval.s = sdup((char *)yytext); return HID; } +-{B}:{B}:{B}:{B}:{B}:{B} { yylval.e = pcap_ether_aton((char *)yytext); ++({B}:{B}:{B}:{B}:{B}:{B})|({B}\.{B}\.{B}\.{B}\.{B}\.{B}) { yylval.e = pcap_ether_aton((char *)yytext); + return EID; } + {V6} { + #ifdef INET6 +@@ -324,6 +325,7 @@ + #endif /*INET6*/ + } + {B}:+({B}:+)+ { bpf_error("bogus ethernet address %s", yytext); } ++{X}{12} { yylval.e = pcap_ether_aton((char *)yytext); return EID;} + icmptype { yylval.i = 0; return NUM; } + icmpcode { yylval.i = 1; return NUM; } + icmp-echoreply { yylval.i = 0; return NUM; } diff --git a/package/libpcap/patches/103-flex_workaround.patch b/package/libpcap/patches/103-flex_workaround.patch new file mode 100644 index 0000000000..5b6d0db0cb --- /dev/null +++ b/package/libpcap/patches/103-flex_workaround.patch @@ -0,0 +1,14 @@ + + Copyright (C) 2006 Markus Wigge + +diff -urN libpcap-0.9.4.orig/Makefile.in libpcap-0.9.4/Makefile.in +--- libpcap-0.9.4.orig/Makefile.in 2006-07-19 09:27:47.000000000 +0200 ++++ libpcap-0.9.4/Makefile.in 2006-07-19 09:34:48.000000000 +0200 +@@ -53,7 +53,7 @@ + CC = @CC@ + CCOPT = @V_CCOPT@ + INCLS = -I. @V_INCLS@ +-DEFS = @DEFS@ @V_DEFS@ ++DEFS = -D_BSD_SOURCE @DEFS@ @V_DEFS@ + LIBS = @V_LIBS@ + DYEXT = @DYEXT@ diff --git a/package/linux-atm/Makefile b/package/linux-atm/Makefile new file mode 100644 index 0000000000..24a914a71c --- /dev/null +++ b/package/linux-atm/Makefile @@ -0,0 +1,88 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=linux-atm +PKG_VERSION:=2.4.1 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).orig.tar.gz +PKG_SOURCE_URL:=http://ftp.debian.org/debian/pool/main/l/linux-atm/ +PKG_MD5SUM:=84fef49cc39ff2605204246666f65864 +PKG_CAT:=zcat + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install + +include $(INCLUDE_DIR)/package.mk + +define Package/linux-atm/Default + URL:=http://linux-atm.sourceforge.net/ +endef + +define Package/linux-atm + $(call Package/linux-atm/Default) + SECTION:=libs + CATEGORY:=Libraries + TITLE:=Linux ATM Library + DESCRIPTION:=\ + This package contains a library for accessing the Linux ATM subsystem. +endef + +define Package/br2684ctl + $(call Package/linux-atm/Default) + SECTION:=net + CATEGORY:=Network + DEPENDS:=+linux-atm + TITLE:=RFC2684 bridging utility + DESCRIPTION:=\ + This package contains an ATM RFC2684 bridging utility. +endef + +define Build/Configure + $(call Build/Configure/Default) + # prevent autoheader invocation + touch $(PKG_BUILD_DIR)/stamp-h.in +endef + +define Build/Compile + $(call Build/Compile/Default, \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + all install \ + ) +endef + +define Build/InstallDev + mkdir -p $(STAGING_DIR)/usr/include + $(CP) $(PKG_INSTALL_DIR)/usr/include/atm{,d,sap}.h \ + $(STAGING_DIR)/usr/include/ + mkdir -p $(STAGING_DIR)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libatm.{a,so*} \ + $(STAGING_DIR)/usr/lib/ +endef + +define Build/UninstallDev + rm -rf $(STAGING_DIR)/usr/include/atm{,d,sap}.h \ + $(STAGING_DIR)/usr/lib/libatm.{a,so*} +endef + +define Package/linux-atm/install + install -d -m0755 $(1)/usr/lib + cp -f $(PKG_INSTALL_DIR)/usr/lib/libatm.so.1 $(1)/usr/lib +endef + +define Package/br2684ctl/install + install -d -m0755 $(1)/usr/sbin + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/br2684ctl $(1)/usr/sbin/ + install -d -m0755 $(1)/etc/hotplug.d/net + install -m0644 ./files/br2684.hotplug $(1)/etc/hotplug.d/net/30-br2684 +endef + +$(eval $(call BuildPackage,linux-atm)) +$(eval $(call BuildPackage,br2684ctl)) diff --git a/package/linux-atm/files/br2684.hotplug b/package/linux-atm/files/br2684.hotplug new file mode 100644 index 0000000000..242e7e5152 --- /dev/null +++ b/package/linux-atm/files/br2684.hotplug @@ -0,0 +1,19 @@ +[ "${INTERFACE%%[0-9]*}" = "atm" ] && { + case "$ACTION" in + register) + [ "$pppoe_atm" = 1 ] && { + case "$atm_encaps" in + 0|vc) ENCAPS=0 ;; + 1|llc) ENCAPS=1 ;; + *) ENCAPS=0 ;; + esac + insmod br2684 2>&- >&- + br2684ctl -c0 -e${ENCAPS} -a${atm_vpi:-8}.${atm_vci:-35} & + } + ;; + unregister) + killall br2684ctl 2>&- >&- + rmmod br2684 + ;; + esac +} diff --git a/package/linux-atm/patches/000-debian_16.patch b/package/linux-atm/patches/000-debian_16.patch new file mode 100644 index 0000000000..41dc437ca4 --- /dev/null +++ b/package/linux-atm/patches/000-debian_16.patch @@ -0,0 +1,35073 @@ +--- linux-atm-2.4.1.orig/Makefile.in ++++ linux-atm-2.4.1/Makefile.in +@@ -1,4 +1,4 @@ +-# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am ++# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am + + # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation +@@ -100,14 +100,14 @@ + + DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +-TAR = gtar ++TAR = tar + GZIP_ENV = --best + all: all-redirect + .SUFFIXES: + $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +- cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps Makefile ++ cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile + +-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status + +@@ -225,7 +225,7 @@ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \ +- || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP) -o $$here/TAGS) ++ || (cd $(srcdir) && etags -o $$here/TAGS $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP)) + + mostlyclean-tags: + +@@ -274,6 +274,11 @@ + -rm -rf $(distdir) + mkdir $(distdir) + -chmod 777 $(distdir) ++ here=`cd $(top_builddir) && pwd`; \ ++ top_distdir=`cd $(distdir) && pwd`; \ ++ distdir=`cd $(distdir) && pwd`; \ ++ cd $(top_srcdir) \ ++ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ +--- linux-atm-2.4.1.orig/aclocal.m4 ++++ linux-atm-2.4.1/aclocal.m4 +@@ -1,4 +1,4 @@ +-dnl aclocal.m4 generated automatically by aclocal 1.4-p5 ++dnl aclocal.m4 generated automatically by aclocal 1.4-p6 + + dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. + dnl This file is free software; the Free Software Foundation +@@ -43,7 +43,8 @@ + dnl AM_INIT_AUTOMAKE(package,version, [no-define]) + + AC_DEFUN([AM_INIT_AUTOMAKE], +-[AC_REQUIRE([AC_PROG_INSTALL]) ++[AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl ++AC_REQUIRE([AC_PROG_INSTALL]) + PACKAGE=[$1] + AC_SUBST(PACKAGE) + VERSION=[$2] +@@ -59,13 +60,42 @@ + AC_REQUIRE([AC_ARG_PROGRAM]) + dnl FIXME This is truly gross. + missing_dir=`cd $ac_aux_dir && pwd` +-AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) ++AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}, $missing_dir) + AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) +-AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) ++AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}, $missing_dir) + AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) + AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) + AC_REQUIRE([AC_PROG_MAKE_SET])]) + ++# Copyright 2002 Free Software Foundation, Inc. ++ ++# 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 ++# the Free Software Foundation; either version 2, or (at your option) ++# any later version. ++ ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++ ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA ++ ++# AM_AUTOMAKE_VERSION(VERSION) ++# ---------------------------- ++# Automake X.Y traces this macro to ensure aclocal.m4 has been ++# generated from the m4 files accompanying Automake X.Y. ++AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.4"]) ++ ++# AM_SET_CURRENT_AUTOMAKE_VERSION ++# ------------------------------- ++# Call AM_AUTOMAKE_VERSION so it can be traced. ++# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. ++AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], ++ [AM_AUTOMAKE_VERSION([1.4-p6])]) ++ + # + # Check to make sure that the build environment is sane. + # +@@ -130,13 +160,14 @@ + dnl Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT + AC_DEFUN([AM_PROG_LEX], + [missing_dir=ifelse([$1],,`cd $ac_aux_dir && pwd`,$1) +-AC_CHECK_PROGS(LEX, flex lex, "$missing_dir/missing flex") ++AC_CHECK_PROGS(LEX, flex lex, $missing_dir/missing flex) + AC_PROG_LEX + AC_DECL_YYTEXT]) + + # libtool.m4 - Configure libtool for the host system. -*-Shell-script-*- + + # serial 46 AC_PROG_LIBTOOL ++ + AC_DEFUN([AC_PROG_LIBTOOL], + [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl + +@@ -162,6 +193,8 @@ + AC_REQUIRE([AC_PROG_LD])dnl + AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl + AC_REQUIRE([AC_PROG_NM])dnl ++AC_REQUIRE([LT_AC_PROG_SED])dnl ++ + AC_REQUIRE([AC_PROG_LN_S])dnl + AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl + AC_REQUIRE([AC_OBJEXT])dnl +@@ -262,9 +295,30 @@ + + ]) + ++# AC_LIBTOOL_HEADER_ASSERT ++# ------------------------ ++AC_DEFUN([AC_LIBTOOL_HEADER_ASSERT], ++[AC_CACHE_CHECK([whether $CC supports assert without backlinking], ++ [lt_cv_func_assert_works], ++ [case $host in ++ *-*-solaris*) ++ if test "$GCC" = yes && test "$with_gnu_ld" != yes; then ++ case `$CC --version 2>/dev/null` in ++ [[12]].*) lt_cv_func_assert_works=no ;; ++ *) lt_cv_func_assert_works=yes ;; ++ esac ++ fi ++ ;; ++ esac]) ++ ++if test "x$lt_cv_func_assert_works" = xyes; then ++ AC_CHECK_HEADERS(assert.h) ++fi ++])# AC_LIBTOOL_HEADER_ASSERT ++ + # _LT_AC_CHECK_DLFCN + # -------------------- +-AC_DEFUN(_LT_AC_CHECK_DLFCN, ++AC_DEFUN([_LT_AC_CHECK_DLFCN], + [AC_CHECK_HEADERS(dlfcn.h) + ])# _LT_AC_CHECK_DLFCN + +@@ -282,10 +336,10 @@ + # [They come from Ultrix. What could be older than Ultrix?!! ;)] + + # Character class describing NM global symbol codes. +-[symcode='[BCDEGRST]'] ++symcode='[[BCDEGRST]]' + + # Regexp to match symbols that can be accessed directly from C. +-[sympat='\([_A-Za-z][_A-Za-z0-9]*\)'] ++sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + + # Transform the above into a raw symbol and a C symbol. + symxfrm='\1 \2\3 \3' +@@ -293,25 +347,32 @@ + # Transform an extracted symbol line into a proper C declaration + lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" + ++# Transform an extracted symbol line into symbol name and symbol address ++lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" ++ + # Define system-specific variables. + case $host_os in + aix*) +- [symcode='[BCDT]'] ++ symcode='[[BCDT]]' + ;; + cygwin* | mingw* | pw32*) +- [symcode='[ABCDGISTW]'] ++ symcode='[[ABCDGISTW]]' + ;; + hpux*) # Its linker distinguishes data from code symbols + lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" ++ lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" ++ ;; ++irix* | nonstopux*) ++ symcode='[[BCDEGRST]]' + ;; +-irix*) +- [symcode='[BCDEGRST]'] ++osf*) ++ symcode='[[BCDEGQRST]]' + ;; + solaris* | sysv5*) +- [symcode='[BDT]'] ++ symcode='[[BDT]]' + ;; + sysv4) +- [symcode='[DFNSTU]'] ++ symcode='[[DFNSTU]]' + ;; + esac + +@@ -325,14 +386,14 @@ + + # If we're using GNU nm, then use its standard symbol codes. + if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then +- [symcode='[ABCDGISTW]'] ++ symcode='[[ABCDGISTW]]' + fi + + # Try without a prefix undercore, then with it. + for ac_symprfx in "" "_"; do + + # Write the raw and C identifiers. +-[lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'"] ++lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no +@@ -374,23 +435,23 @@ + + cat <<EOF >> conftest.$ac_ext + #if defined (__STDC__) && __STDC__ +-# define lt_ptr_t void * ++# define lt_ptr void * + #else +-# define lt_ptr_t char * ++# define lt_ptr char * + # define const + #endif + + /* The mapping between symbol names and symbols. */ + const struct { + const char *name; +- lt_ptr_t address; ++ lt_ptr address; + } +-[lt_preloaded_symbols[] =] ++lt_preloaded_symbols[[]] = + { + EOF +- sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" >> conftest.$ac_ext ++ sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext +- {0, (lt_ptr_t) 0} ++ {0, (lt_ptr) 0} + }; + + #ifdef __cplusplus +@@ -403,7 +464,7 @@ + save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$no_builtin_flag" +- if AC_TRY_EVAL(ac_link) && test -s conftest; then ++ if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then + pipe_works=yes + fi + LIBS="$save_LIBS" +@@ -434,10 +495,13 @@ + global_symbol_pipe="$lt_cv_sys_global_symbol_pipe" + if test -z "$lt_cv_sys_global_symbol_pipe"; then + global_symbol_to_cdecl= ++ global_symbol_to_c_name_address= + else + global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl" ++ global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address" + fi +-if test -z "$global_symbol_pipe$global_symbol_to_cdecl"; then ++if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address"; ++then + AC_MSG_RESULT(failed) + else + AC_MSG_RESULT(ok) +@@ -455,16 +519,17 @@ + *-DOS) lt_cv_sys_path_separator=';' ;; + *) lt_cv_sys_path_separator=':' ;; + esac ++ PATH_SEPARATOR=$lt_cv_sys_path_separator + fi + ])# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR + + # _LT_AC_PROG_ECHO_BACKSLASH + # -------------------------- + # Add some code to the start of the generated configure script which +-# will find an echo command which doesn;t interpret backslashes. ++# will find an echo command which doesn't interpret backslashes. + AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], + [ifdef([AC_DIVERSION_NOTICE], [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], +- [AC_DIVERT_PUSH(NOTICE)]) ++ [AC_DIVERT_PUSH(NOTICE)]) + _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR + + # Check that we are running under the correct shell. +@@ -530,7 +595,7 @@ + # + # So, first we look for a working echo in the user's PATH. + +- IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" ++ IFS="${IFS= }"; save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && +@@ -619,7 +684,7 @@ + # _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, + # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) + # ------------------------------------------------------------------ +-AC_DEFUN(_LT_AC_TRY_DLOPEN_SELF, ++AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], + [if test "$cross_compiling" = yes; then : + [$4] + else +@@ -706,7 +771,7 @@ + + # AC_LIBTOOL_DLOPEN_SELF + # ------------------- +-AC_DEFUN(AC_LIBTOOL_DLOPEN_SELF, ++AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], + [if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown +@@ -728,16 +793,22 @@ + ;; + + *) +- AC_CHECK_LIB(dl, dlopen, [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], +- [AC_CHECK_FUNC(dlopen, lt_cv_dlopen="dlopen", +- [AC_CHECK_FUNC(shl_load, lt_cv_dlopen="shl_load", +- [AC_CHECK_LIB(svld, dlopen, +- [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], +- [AC_CHECK_LIB(dld, shl_load, +- [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) ++ AC_CHECK_FUNC([shl_load], ++ [lt_cv_dlopen="shl_load"], ++ [AC_CHECK_LIB([dld], [shl_load], ++ [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], ++ [AC_CHECK_FUNC([dlopen], ++ [lt_cv_dlopen="dlopen"], ++ [AC_CHECK_LIB([dl], [dlopen], ++ [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], ++ [AC_CHECK_LIB([svld], [dlopen], ++ [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], ++ [AC_CHECK_LIB([dld], [dld_link], ++ [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) ++ ]) + ]) +- ]) +- ]) ++ ]) ++ ]) + ]) + ;; + esac +@@ -800,10 +871,10 @@ + # Sed substitution that helps us do robust quoting. It backslashifies + # metacharacters that are still active within double-quoted strings. + Xsed='sed -e s/^X//' +-[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] ++sed_quote_subst='s/\([[\\"\\`$\\\\]]\)/\\\1/g' + + # Same as above, but do not quote variable references. +-[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'] ++double_quote_subst='s/\([[\\"\\`\\\\]]\)/\\\1/g' + + # Sed substitution to delay expansion of an escaped shell variable in a + # double_quote_subst'ed string. +@@ -872,8 +943,15 @@ + old_postuninstall_cmds= + + if test -n "$RANLIB"; then ++ case $host_os in ++ openbsd*) ++ old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" ++ ;; ++ *) ++ old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" ++ ;; ++ esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +- old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" + fi + + # Allow CC to be a program name with arguments. +@@ -893,7 +971,7 @@ + AC_MSG_RESULT($objdir) + + +-AC_ARG_WITH(pic, ++AC_ARG_WITH(pic, + [ --with-pic try to use only PIC/non-PIC objects [default=use both]], + pic_mode="$withval", pic_mode=default) + test -z "$pic_mode" && pic_mode=default +@@ -921,7 +999,7 @@ + # libC (AIX C++ library), which obviously doesn't included in libraries + # list by gcc. This cause undefined symbols with -static flags. + # This hack allows C programs to be linked with "-static -ldl", but +- # we not sure about C++ programs. ++ # not sure about C++ programs. + lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC" + ;; + amigaos*) +@@ -930,7 +1008,7 @@ + # like `-m68040'. + lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' + ;; +- beos* | irix5* | irix6* | osf3* | osf4* | osf5*) ++ beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + darwin* | rhapsody*) +@@ -956,13 +1034,13 @@ + # PORTME Check for PIC flags for the system compiler. + case $host_os in + aix3* | aix4* | aix5*) ++ lt_cv_prog_cc_wl='-Wl,' + # All AIX code is PIC. + if test "$host_cpu" = ia64; then +- # AIX 5 now supports IA64 processor +- lt_cv_prog_cc_static='-Bstatic' +- lt_cv_prog_cc_wl='-Wl,' ++ # AIX 5 now supports IA64 processor ++ lt_cv_prog_cc_static='-Bstatic' + else +- lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' ++ lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + +@@ -973,7 +1051,7 @@ + lt_cv_prog_cc_pic='+Z' + ;; + +- irix5* | irix6*) ++ irix5* | irix6* | nonstopux*) + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-non_shared' + # PIC (with -KPIC) is the default. +@@ -1017,11 +1095,7 @@ + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' +- if test "x$host_vendor" = xsni; then +- lt_cv_prog_cc_wl='-LD' +- else +- lt_cv_prog_cc_wl='-Wl,' +- fi ++ lt_cv_prog_cc_wl='-Wl,' + ;; + + uts4*) +@@ -1087,7 +1161,7 @@ + # Check for any special shared library compilation flags. + if test -n "$lt_cv_prog_cc_shlib"; then + AC_MSG_WARN([\`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries]) +- if echo "$old_CC $old_CFLAGS " | [egrep -e "[ ]$lt_cv_prog_cc_shlib[ ]"] >/dev/null; then : ++ if echo "$old_CC $old_CFLAGS " | egrep -e "[[ ]]$lt_cv_prog_cc_shlib[[ ]]" >/dev/null; then : + else + AC_MSG_WARN([add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure]) + lt_cv_prog_cc_can_build_shared=no +@@ -1163,6 +1237,8 @@ + lt_cv_compiler_o_lo=no + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -c -o conftest.lo" ++ save_objext="$ac_objext" ++ ac_objext=lo + AC_TRY_COMPILE([], [int some_variable = 0;], [dnl + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings +@@ -1172,6 +1248,7 @@ + lt_cv_compiler_o_lo=yes + fi + ]) ++ ac_objext="$save_objext" + CFLAGS="$save_CFLAGS" + ]) + compiler_o_lo=$lt_cv_compiler_o_lo +@@ -1268,7 +1345,7 @@ + extract_expsyms_cmds= + + case $host_os in +-cygwin* | mingw* | pw32* ) ++cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. +@@ -1276,7 +1353,9 @@ + with_gnu_ld=no + fi + ;; +- ++openbsd*) ++ with_gnu_ld=no ++ ;; + esac + + ld_shlibs=yes +@@ -1363,7 +1442,7 @@ + # can override, but on older systems we have to supply one (in ltdll.c) + if test "x$lt_cv_need_dllmain" = "xyes"; then + ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext " +- ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < [$]0 > $output_objdir/$soname-ltdll.c~ ++ ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~ + test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~' + else + ltdll_obj= +@@ -1376,24 +1455,25 @@ + # Be careful not to strip the DATA tag left be newer dlltools. + export_symbols_cmds="$ltdll_cmds"' + $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~ +- [sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//"] < $output_objdir/$soname-def > $export_symbols' ++ sed -e "1,/EXPORTS/d" -e "s/ @ [[0-9]]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols' + + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is. + # If DATA tags from a recent dlltool are present, honour them! +- archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then +- cp $export_symbols $output_objdir/$soname-def; ++ archive_expsym_cmds='if test "x`sed 1q $export_symbols`" = xEXPORTS; then ++ cp $export_symbols $output_objdir/$soname-def; + else +- echo EXPORTS > $output_objdir/$soname-def; +- _lt_hint=1; +- cat $export_symbols | while read symbol; do +- set dummy \$symbol; +- case \[$]# in +- 2) echo " \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; +- *) echo " \[$]2 @ \$_lt_hint \[$]3 ; " >> $output_objdir/$soname-def;; +- esac; +- _lt_hint=`expr 1 + \$_lt_hint`; +- done; ++ echo EXPORTS > $output_objdir/$soname-def; ++ _lt_hint=1; ++ cat $export_symbols | while read symbol; do ++ set dummy \$symbol; ++ case \[$]# in ++ 2) echo " \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; ++ 4) echo " \[$]2 \[$]3 \[$]4 ; " >> $output_objdir/$soname-def; _lt_hint=`expr \$_lt_hint - 1`;; ++ *) echo " \[$]2 @ \$_lt_hint \[$]3 ; " >> $output_objdir/$soname-def;; ++ esac; ++ _lt_hint=`expr 1 + \$_lt_hint`; ++ done; + fi~ + '"$ltdll_cmds"' + $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ +@@ -1488,80 +1568,98 @@ + ;; + + aix4* | aix5*) ++ if test "$host_cpu" = ia64; then ++ # On IA64, the linker does run time linking by default, so we don't ++ # have to do anything special. ++ aix_use_runtimelinking=no ++ exp_sym_flag='-Bexport' ++ no_entry_flag="" ++ else ++ aix_use_runtimelinking=no ++ ++ # Test if we are trying to use run time linking or normal ++ # AIX style linking. If -brtl is somewhere in LDFLAGS, we ++ # need to do runtime linking. ++ case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) ++ for ld_flag in $LDFLAGS; do ++ case $ld_flag in ++ *-brtl*) ++ aix_use_runtimelinking=yes ++ break ++ ;; ++ esac ++ done ++ esac ++ ++ exp_sym_flag='-bexport' ++ no_entry_flag='-bnoentry' ++ fi ++ + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + ++ hardcode_direct=yes + archive_cmds='' + hardcode_libdir_separator=':' + if test "$GCC" = yes; then +- collect2name=`${CC} -print-prog-name=collect2` +- if test -f "$collect2name" && \ +- strings "$collect2name" | grep resolve_lib_name >/dev/null +- then +- # We have reworked collect2 +- hardcode_direct=yes +- else +- # We have old collect2 +- hardcode_direct=unsupported +- # It fails to find uninstalled libraries when the uninstalled +- # path is not listed in the libpath. Setting hardcode_minus_L +- # to unsupported forces relinking +- hardcode_minus_L=yes +- hardcode_libdir_flag_spec='-L$libdir' +- hardcode_libdir_separator= +- fi ++ case $host_os in aix4.[[012]]|aix4.[[012]].*) ++ collect2name=`${CC} -print-prog-name=collect2` ++ if test -f "$collect2name" && \ ++ strings "$collect2name" | grep resolve_lib_name >/dev/null ++ then ++ # We have reworked collect2 ++ hardcode_direct=yes ++ else ++ # We have old collect2 ++ hardcode_direct=unsupported ++ # It fails to find uninstalled libraries when the uninstalled ++ # path is not listed in the libpath. Setting hardcode_minus_L ++ # to unsupported forces relinking ++ hardcode_minus_L=yes ++ hardcode_libdir_flag_spec='-L$libdir' ++ hardcode_libdir_separator= ++ fi ++ esac ++ + shared_flag='-shared' + else ++ # not using gcc + if test "$host_cpu" = ia64; then +- shared_flag='-G' ++ shared_flag='${wl}-G' + else +- shared_flag='${wl}-bM:SRE' ++ if test "$aix_use_runtimelinking" = yes; then ++ shared_flag='${wl}-G' ++ else ++ shared_flag='${wl}-bM:SRE' ++ fi + fi +- hardcode_direct=yes + fi + +- if test "$host_cpu" = ia64; then +- # On IA64, the linker does run time linking by default, so we don't +- # have to do anything special. +- aix_use_runtimelinking=no +- exp_sym_flag='-Bexport' +- no_entry_flag="" +- else +- # Test if we are trying to use run time linking, or normal AIX style linking. +- # If -brtl is somewhere in LDFLAGS, we need to do run time linking. +- aix_use_runtimelinking=no +- for ld_flag in $LDFLAGS; do +- if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl" ); then +- aix_use_runtimelinking=yes +- break +- fi +- done +- exp_sym_flag='-bexport' +- no_entry_flag='-bnoentry' +- fi + # It seems that -bexpall can do strange things, so it is better to + # generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then ++ # Warning - without using the other runtime loading flags (-brtl), ++ # -berok will link without error, but may produce a broken library. ++ allow_undefined_flag='-berok' + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' +- allow_undefined_flag=' -Wl,-G' +- archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" ++ archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then +- hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' +- allow_undefined_flag="-znodefs" +- archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" ++ hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' ++ allow_undefined_flag="-z nodefs" ++ archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else +- hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' +- # Warning - without using the other run time loading flags, -berok will +- # link without error, but may produce a broken library. +- allow_undefined_flag='${wl}-berok' +- # This is a bit strange, but is similar to how AIX traditionally builds +- # it's shared libraries. +- archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname' ++ hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' ++ # Warning - without using the other run time loading flags, ++ # -berok will link without error, but may produce a broken library. ++ allow_undefined_flag='${wl}-berok' ++ # This is a bit strange, but is similar to how AIX traditionally builds ++ # it's shared libraries. ++ archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; +@@ -1593,11 +1691,19 @@ + ;; + + darwin* | rhapsody*) +- allow_undefined_flag='-undefined suppress' ++ case "$host_os" in ++ rhapsody* | darwin1.[[012]]) ++ allow_undefined_flag='-undefined suppress' ++ ;; ++ *) # Darwin 1.3 on ++ allow_undefined_flag='-flat_namespace -undefined suppress' ++ ;; ++ esac + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not +- # yet detect zsh echo's removal of \ escapes. +- archive_cmds='$CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib $libobjs $deplibs$linkopts -install_name $rpath/$soname $(test -n "$verstring" -a x$verstring != x0.0 && echo $verstring)' ++ # yet detect zsh echo's removal of \ escapes. Also zsh mangles ++ # `"' quotes if we put them in here... so don't! ++ archive_cmds='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib ${lib}-master.o $deplibs$linker_flags $(test .$module != .yes && echo -install_name $rpath/$soname $verstring)' + # We need to add '_' to the symbols in $export_symbols first + #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols' + hardcode_direct=yes +@@ -1649,13 +1755,14 @@ + export_dynamic_flag_spec='${wl}-E' + ;; + +- irix5* | irix6*) ++ irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ++ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' ++ hardcode_libdir_flag_spec='-rpath $libdir' + fi +- hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + link_all_deplibs=yes + ;; +@@ -1672,7 +1779,7 @@ + ;; + + newsos6) +- archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' ++ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: +@@ -1680,10 +1787,24 @@ + ;; + + openbsd*) +- archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' +- hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no ++ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then ++ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' ++ hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ++ export_dynamic_flag_spec='${wl}-E' ++ else ++ case "$host_os" in ++ openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) ++ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' ++ hardcode_libdir_flag_spec='-R$libdir' ++ ;; ++ *) ++ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' ++ hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ++ ;; ++ esac ++ fi + ;; + + os2*) +@@ -1728,10 +1849,39 @@ + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes ++ export_dynamic_flag_spec='${wl}-Bexport' + ;; + + solaris*) ++ # gcc --version < 3.0 without binutils cannot create self contained ++ # shared libraries reliably, requiring libgcc.a to resolve some of ++ # the object symbols generated in some cases. Libraries that use ++ # assert need libgcc.a to resolve __eprintf, for example. Linking ++ # a copy of libgcc.a into every shared library to guarantee resolving ++ # such symbols causes other problems: According to Tim Van Holder ++ # <tim.van.holder@pandora.be>, C++ libraries end up with a separate ++ # (to the application) exception stack for one thing. + no_undefined_flag=' -z defs' ++ if test "$GCC" = yes; then ++ case `$CC --version 2>/dev/null` in ++ [[12]].*) ++ cat <<EOF 1>&2 ++ ++*** Warning: Releases of GCC earlier than version 3.0 cannot reliably ++*** create self contained shared libraries on Solaris systems, without ++*** introducing a dependency on libgcc.a. Therefore, libtool is disabling ++*** -no-undefined support, which will at least allow you to build shared ++*** libraries. However, you may find that when you link such libraries ++*** into an application without using GCC, you have to manually add ++*** \`gcc --print-libgcc-file-name\` to the link command. We urge you to ++*** upgrade to a newer version of GCC. Another option is to rebuild your ++*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer. ++ ++EOF ++ no_undefined_flag= ++ ;; ++ esac ++ fi + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' +@@ -1740,7 +1890,7 @@ + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in +- [solaris2.[0-5] | solaris2.[0-5].*]) ;; ++ solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + esac +@@ -1762,13 +1912,23 @@ + ;; + + sysv4) +- if test "x$host_vendor" = xsno; then +- archive_cmds='$LD -G -Bsymbolic -h $soname -o $lib $libobjs $deplibs $linkopts' +- hardcode_direct=yes # is this really true??? +- else +- archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' +- hardcode_direct=no #Motorola manual says yes, but my tests say they lie +- fi ++ case $host_vendor in ++ sni) ++ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' ++ hardcode_direct=yes # is this really true??? ++ ;; ++ siemens) ++ ## LD is ld it makes a PLAMLIB ++ ## CC just makes a GrossModule. ++ archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' ++ reload_cmds='$CC -r -o $output$reload_objs' ++ hardcode_direct=no ++ ;; ++ motorola) ++ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' ++ hardcode_direct=no #Motorola manual says yes, but my tests say they lie ++ ;; ++ esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; +@@ -1909,6 +2069,9 @@ + + aix4* | aix5*) + version_type=linux ++ need_lib_prefix=no ++ need_version=no ++ hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so' +@@ -1920,22 +2083,24 @@ + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in +- [ aix4 | aix4.[01] | aix4.[01].*)] +- if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' +- echo ' yes ' +- echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then +- : +- else +- can_build_shared=no +- fi +- ;; ++ aix4 | aix4.[[01]] | aix4.[[01]].*) ++ if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' ++ echo ' yes ' ++ echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then ++ : ++ else ++ can_build_shared=no ++ fi ++ ;; + esac +- # AIX (on Power*) has no versioning support, so currently we can not hardcode correct +- # soname into executable. Probably we can add versioning support to +- # collect2, so additional links can be useful in future. ++ # AIX (on Power*) has no versioning support, so currently we can ++ # not hardcode correct soname into executable. Probably we can ++ # add versioning support to collect2, so additional links can ++ # be useful in future. + if test "$aix_use_runtimelinking" = yes; then +- # If using run time linking (on AIX 4.2 or later) use lib<name>.so instead of +- # lib<name>.a to let people know that these are not typical AIX shared libraries. ++ # If using run time linking (on AIX 4.2 or later) use lib<name>.so ++ # instead of lib<name>.a to let people know that these are not ++ # typical AIX shared libraries. + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + else + # We preserve .a as extension for shared libraries through AIX4.2 +@@ -1944,14 +2109,14 @@ + soname_spec='${libname}${release}.so$major' + fi + shlibpath_var=LIBPATH +- deplibs_check_method=pass_all + fi ++ hardcode_into_libs=yes + ;; + + amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. +- finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | [$Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\'']`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' ++ finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + ;; + + beos*) +@@ -1982,7 +2147,7 @@ + case $GCC,$host_os in + yes,cygwin*) + library_names_spec='$libname.dll.a' +- soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | [sed -e 's/[.]/-/g']`${versuffix}.dll' ++ soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll' + postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ +@@ -1992,14 +2157,14 @@ + $rm \$dlpath' + ;; + yes,mingw*) +- library_names_spec='${libname}`echo ${release} | [sed -e 's/[.]/-/g']`${versuffix}.dll' +- sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g"` ++ library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll' ++ sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g" -e "s,=/,/,g"` + ;; + yes,pw32*) + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' + ;; + *) +- library_names_spec='${libname}`echo ${release} | [sed -e 's/[.]/-/g']`${versuffix}.dll $libname.lib' ++ library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' +@@ -2025,6 +2190,18 @@ + dynamic_linker=no + ;; + ++freebsd*-gnu*) ++ version_type=linux ++ need_lib_prefix=no ++ need_version=no ++ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' ++ soname_spec='${libname}${release}.so$major' ++ shlibpath_var=LD_LIBRARY_PATH ++ shlibpath_overrides_runpath=no ++ hardcode_into_libs=yes ++ dynamic_linker='GNU/FreeBSD ld.so' ++ ;; ++ + freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat +@@ -2076,14 +2253,17 @@ + postinstall_cmds='chmod 555 $lib' + ;; + +-irix5* | irix6*) +- version_type=irix ++irix5* | irix6* | nonstopux*) ++ case $host_os in ++ nonstopux*) version_type=nonstopux ;; ++ *) version_type=irix ;; ++ esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so' + case $host_os in +- irix5*) ++ irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) +@@ -2157,9 +2337,19 @@ + + openbsd*) + version_type=sunos +- if test "$with_gnu_ld" = yes; then +- need_lib_prefix=no +- need_version=no ++ need_lib_prefix=no ++ need_version=no ++ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then ++ case "$host_os" in ++ openbsd2.[[89]] | openbsd2.[[89]].*) ++ shlibpath_overrides_runpath=no ++ ;; ++ *) ++ shlibpath_overrides_runpath=yes ++ ;; ++ esac ++ else ++ shlibpath_overrides_runpath=yes + fi + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' +@@ -2177,11 +2367,13 @@ + osf3* | osf4* | osf5*) + version_type=osf + need_version=no +- soname_spec='${libname}${release}.so' +- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' ++ need_lib_prefix=no ++ soname_spec='${libname}${release}.so$major' ++ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ++ hardcode_into_libs=yes + ;; + + sco3.2v5*) +@@ -2224,6 +2416,12 @@ + case $host_vendor in + sni) + shlibpath_overrides_runpath=no ++ need_lib_prefix=no ++ export_dynamic_flag_spec='${wl}-Blargedynsym' ++ runpath_var=LD_RUN_PATH ++ ;; ++ siemens) ++ need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no +@@ -2270,6 +2468,33 @@ + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + ++AC_MSG_CHECKING([whether to build shared libraries]) ++test "$can_build_shared" = "no" && enable_shared=no ++ ++# On AIX, shared libraries and static libraries use the same namespace, and ++# are all built from PIC. ++case "$host_os" in ++aix3*) ++ test "$enable_shared" = yes && enable_static=no ++ if test -n "$RANLIB"; then ++ archive_cmds="$archive_cmds~\$RANLIB \$lib" ++ postinstall_cmds='$RANLIB $lib' ++ fi ++ ;; ++ ++aix4*) ++ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then ++ test "$enable_shared" = yes && enable_static=no ++ fi ++ ;; ++esac ++AC_MSG_RESULT([$enable_shared]) ++ ++AC_MSG_CHECKING([whether to build static libraries]) ++# Make sure either enable_shared or enable_static is yes. ++test "$enable_shared" = yes || enable_static=yes ++AC_MSG_RESULT([$enable_static]) ++ + if test "$hardcode_action" = relink; then + # Fast installation is not supported + enable_fast_install=no +@@ -2351,7 +2576,7 @@ + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. +- for var in echo old_CC old_CFLAGS \ ++ for var in echo old_CC old_CFLAGS SED \ + AR AR_FLAGS CC LD LN_S NM SHELL \ + reload_flag reload_cmds wl \ + pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ +@@ -2363,6 +2588,7 @@ + old_striplib striplib file_magic_cmd export_symbols_cmds \ + deplibs_check_method allow_undefined_flag no_undefined_flag \ + finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ ++ global_symbol_to_c_name_address \ + hardcode_libdir_flag_spec hardcode_libdir_separator \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do +@@ -2412,8 +2638,11 @@ + # configuration script generated by Autoconf, you may include it under + # the same distribution terms that you use for the rest of that program. + ++# A sed that does not truncate output. ++SED=$lt_SED ++ + # Sed that helps us avoid accidentally triggering echo(1) options like -n. +-Xsed="sed -e s/^X//" ++Xsed="${SED} -e s/^X//" + + # The HP-UX ksh and POSIX shell print the target directory to stdout + # if CDPATH is set. +@@ -2429,12 +2658,12 @@ + # Whether or not to build shared libraries. + build_libtool_libs=$enable_shared + +-# Whether or not to add -lc for building shared libraries. +-build_libtool_need_lc=$need_lc +- + # Whether or not to build static libraries. + build_old_libs=$enable_static + ++# Whether or not to add -lc for building shared libraries. ++build_libtool_need_lc=$need_lc ++ + # Whether or not to optimize for fast installation. + fast_install=$enable_fast_install + +@@ -2600,6 +2829,9 @@ + # Transform the output of nm in a proper C declaration + global_symbol_to_cdecl=$lt_global_symbol_to_cdecl + ++# Transform the output of nm in a C name address pair ++global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address ++ + # This is the shared library runtime path variable. + runpath_var=$runpath_var + +@@ -2722,9 +2954,9 @@ + # return TRUE; + # } + # /* ltdll.c ends here */ +- # This is a source program that is used to create import libraries +- # on Windows for dlls which lack them. Don't remove nor modify the +- # starting and closing comments ++ # This is a source program that is used to create import libraries ++ # on Windows for dlls which lack them. Don't remove nor modify the ++ # starting and closing comments + # /* impgen.c starts here */ + # /* Copyright (C) 1999-2000 Free Software Foundation, Inc. + # +@@ -3079,6 +3311,7 @@ + AC_REQUIRE([AC_PROG_CC])dnl + AC_REQUIRE([AC_CANONICAL_HOST])dnl + AC_REQUIRE([AC_CANONICAL_BUILD])dnl ++AC_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])dnl + ac_prog=ld + if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. +@@ -3092,8 +3325,8 @@ + esac + case $ac_prog in + # Accept absolute paths. +- [[\\/]* | [A-Za-z]:[\\/]*)] +- [re_direlt='/[^/][^/]*/\.\./'] ++ [[\\/]]* | [[A-Za-z]]:[[\\/]]*) ++ re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do +@@ -3117,7 +3350,7 @@ + fi + AC_CACHE_VAL(lt_cv_path_LD, + [if test -z "$LD"; then +- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" ++ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then +@@ -3170,7 +3403,7 @@ + # AC_DEPLIBS_CHECK_METHOD - how to check for library dependencies + # -- PORTME fill in with the dynamic library characteristics + AC_DEFUN([AC_DEPLIBS_CHECK_METHOD], +-[AC_CACHE_CHECK([how to recognise dependant libraries], ++[AC_CACHE_CHECK([how to recognise dependent libraries], + lt_cv_deplibs_check_method, + [lt_cv_file_magic_cmd='$MAGIC_CMD' + lt_cv_file_magic_test_file= +@@ -3181,7 +3414,7 @@ + # `unknown' -- same as none, but documents that we really don't know. + # 'pass_all' -- all dependencies passed with no checks. + # 'test_compile' -- check by making test program. +-# ['file_magic [regex]'] -- check by looking for files in library path ++# 'file_magic [[regex]]' -- check by looking for files in library path + # which responds to the $file_magic_cmd with a given egrep regex. + # If you have `file' or equivalent on your system and you're not sure + # whether `pass_all' will *always* work, you probably want this one. +@@ -3196,7 +3429,7 @@ + ;; + + bsdi4*) +- [lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'] ++ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; +@@ -3210,7 +3443,7 @@ + lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' + lt_cv_file_magic_cmd='/usr/bin/file -L' + case "$host_os" in +- rhapsody* | darwin1.[012]) ++ rhapsody* | darwin1.[[012]]) + lt_cv_file_magic_test_file=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1` + ;; + *) # Darwin 1.3 on +@@ -3225,7 +3458,7 @@ + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. +- [lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library'] ++ lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[[3-9]]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; +@@ -3240,14 +3473,14 @@ + ;; + + hpux10.20*|hpux11*) +- [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'] ++ lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + +-irix5* | irix6*) ++irix5* | irix6* | nonstopux*) + case $host_os in +- irix5*) ++ irix5* | nonstopux*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" + ;; +@@ -3259,7 +3492,7 @@ + *) libmagic=never-match;; + esac + # this will be overridden with pass_all, but let us keep it just in case +- [lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1"] ++ lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[[1234]] dynamic lib MIPS - version 1" + ;; + esac + lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` +@@ -3269,29 +3502,39 @@ + # This must be Linux ELF. + linux-gnu*) + case $host_cpu in +- alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* | s390* ) ++ alpha* | hppa* | i*86 | mips | mipsel | powerpc* | sparc* | ia64* | arm* | m68k) + lt_cv_deplibs_check_method=pass_all ;; + *) + # glibc up to 2.1.1 does not perform some relocations on ARM +- [lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;;] ++ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; + esac + lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then +- [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'] ++ lt_cv_deplibs_check_method='match_pattern /lib[[^/\.]]+\.so\.[[0-9]]+\.[[0-9]]+$' + else +- [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$'] ++ lt_cv_deplibs_check_method='match_pattern /lib[[^/\.]]+\.so$' + fi + ;; + + newos6*) +- [lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'] ++ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + ++openbsd*) ++ lt_cv_file_magic_cmd=/usr/bin/file ++ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ++ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then ++ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' ++ else ++ lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' ++ fi ++ ;; ++ + osf3* | osf4* | osf5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' +@@ -3308,14 +3551,14 @@ + lt_cv_file_magic_test_file=/lib/libc.so + ;; + +-[sysv5uw[78]* | sysv4*uw2*)] ++sysv5uw[[78]]* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + case $host_vendor in + motorola) +- [lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'] ++ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) +@@ -3323,13 +3566,16 @@ + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' +- [lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'] ++ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' +- [lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib"] ++ lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; ++ siemens) ++ lt_cv_deplibs_check_method=pass_all ++ ;; + esac + ;; + esac +@@ -3341,13 +3587,14 @@ + + # AC_PROG_NM - find the path to a BSD-compatible name lister + AC_DEFUN([AC_PROG_NM], +-[AC_MSG_CHECKING([for BSD-compatible nm]) ++[AC_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])dnl ++AC_MSG_CHECKING([for BSD-compatible nm]) + AC_CACHE_VAL(lt_cv_path_NM, + [if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" + else +- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" ++ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + test -z "$ac_dir" && ac_dir=. + tmp_nm=$ac_dir/${ac_tool_prefix}nm +@@ -3394,12 +3641,12 @@ + ]) + + # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for +-# the libltdl convenience library and INCLTDL to the include flags for ++# the libltdl convenience library and LTDLINCL to the include flags for + # the libltdl header and adds --enable-ltdl-convenience to the +-# configure arguments. Note that LIBLTDL and INCLTDL are not ++# configure arguments. Note that LIBLTDL and LTDLINCL are not + # AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not + # provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed +-# with '${top_builddir}/' and INCLTDL will be prefixed with ++# with '${top_builddir}/' and LTDLINCL will be prefixed with + # '${top_srcdir}/' (note the single quotes!). If your package is not + # flat and you're not using automake, define top_builddir and + # top_srcdir appropriately in the Makefiles. +@@ -3411,16 +3658,18 @@ + ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; + esac + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la +- INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) ++ LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) ++ # For backwards non-gettext consistent compatibility... ++ INCLTDL="$LTDLINCL" + ]) + + # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for +-# the libltdl installable library and INCLTDL to the include flags for ++# the libltdl installable library and LTDLINCL to the include flags for + # the libltdl header and adds --enable-ltdl-install to the configure +-# arguments. Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is ++# arguments. Note that LIBLTDL and LTDLINCL are not AC_SUBSTed, nor is + # AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed + # libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will +-# be prefixed with '${top_builddir}/' and INCLTDL will be prefixed ++# be prefixed with '${top_builddir}/' and LTDLINCL will be prefixed + # with '${top_srcdir}/' (note the single quotes!). If your package is + # not flat and you're not using automake, define top_builddir and + # top_srcdir appropriately in the Makefiles. +@@ -3438,12 +3687,14 @@ + if test x"$enable_ltdl_install" = x"yes"; then + ac_configure_args="$ac_configure_args --enable-ltdl-install" + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la +- INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) ++ LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + else + ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" +- INCLTDL= ++ LTDLINCL= + fi ++ # For backwards non-gettext consistent compatibility... ++ INCLTDL="$LTDLINCL" + ]) + + # old names +@@ -3458,3 +3709,92 @@ + # This is just to silence aclocal about the macro not being used + ifelse([AC_DISABLE_FAST_INSTALL]) + ++# NOTE: This macro has been submitted for inclusion into # ++# GNU Autoconf as AC_PROG_SED. When it is available in # ++# a released version of Autoconf we should remove this # ++# macro and use it instead. # ++# LT_AC_PROG_SED ++# -------------- ++# Check for a fully-functional sed program, that truncates ++# as few characters as possible. Prefer GNU sed if found. ++AC_DEFUN([LT_AC_PROG_SED], ++[AC_MSG_CHECKING([for a sed that does not truncate output]) ++AC_CACHE_VAL(lt_cv_path_SED, ++[# Loop through the user's path and test for sed and gsed. ++# Then use that list of sed's as ones to test for truncation. ++as_executable_p="test -f" ++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_prog in sed gsed; do ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then ++ _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext" ++ fi ++ done ++ done ++done ++ ++ # Create a temporary directory, and hook for its removal unless debugging. ++$debug || ++{ ++ trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 ++ trap '{ (exit 1); exit 1; }' 1 2 13 15 ++} ++ ++# Create a (secure) tmp directory for tmp files. ++: ${TMPDIR=/tmp} ++{ ++ tmp=`(umask 077 && mktemp -d -q "$TMPDIR/sedXXXXXX") 2>/dev/null` && ++ test -n "$tmp" && test -d "$tmp" ++} || ++{ ++ tmp=$TMPDIR/sed$$-$RANDOM ++ (umask 077 && mkdir $tmp) ++} || ++{ ++ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ++ { (exit 1); exit 1; } ++} ++ _max=0 ++ _count=0 ++ # Add /usr/xpg4/bin/sed as it is typically found on Solaris ++ # along with /bin/sed that truncates output. ++ for _sed in $_sed_list /usr/xpg4/bin/sed; do ++ test ! -f ${_sed} && break ++ cat /dev/null > "$tmp/sed.in" ++ _count=0 ++ echo ${ECHO_N-$ac_n} "0123456789${ECHO_C-$ac_c}" >"$tmp/sed.in" ++ # Check for GNU sed and select it if it is found. ++ if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; then ++ lt_cv_path_SED=${_sed} ++ break ++ fi ++ while true; do ++ cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp" ++ mv "$tmp/sed.tmp" "$tmp/sed.in" ++ cp "$tmp/sed.in" "$tmp/sed.nl" ++ echo >>"$tmp/sed.nl" ++ ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break ++ cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break ++ # 40000 chars as input seems more than enough ++ test $_count -gt 10 && break ++ _count=`expr $_count + 1` ++ if test $_count -gt $_max; then ++ _max=$_count ++ lt_cv_path_SED=$_sed ++ fi ++ done ++ done ++ rm -rf "$tmp" ++]) ++if test "X$SED" != "X"; then ++ lt_cv_path_SED=$SED ++else ++ SED=$lt_cv_path_SED ++fi ++AC_MSG_RESULT([$SED]) ++]) ++ +--- linux-atm-2.4.1.orig/config.guess ++++ linux-atm-2.4.1/config.guess +@@ -1,9 +1,9 @@ + #! /bin/sh + # Attempt to guess a canonical system name. +-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +-# Free Software Foundation, Inc. ++# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, ++# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + +-timestamp='2001-04-20' ++timestamp='2003-05-19' + + # This file is free software; you can redistribute it and/or modify it + # under the terms of the GNU General Public License as published by +@@ -24,8 +24,9 @@ + # configuration script generated by Autoconf, you may include it under + # the same distribution terms that you use for the rest of that program. + +-# Written by Per Bothner <bothner@cygnus.com>. +-# Please send patches to <config-patches@gnu.org>. ++# Originally written by Per Bothner <per@bothner.com>. ++# Please send patches to <config-patches@gnu.org>. Submit a context ++# diff and a properly formatted ChangeLog entry. + # + # This script attempts to guess a canonical system name similar to + # config.sub. If it succeeds, it prints the system name on stdout, and +@@ -52,7 +53,7 @@ + GNU config.guess ($timestamp) + + Originally written by Per Bothner. +-Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 99, 2000 ++Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 + Free Software Foundation, Inc. + + This is free software; see the source for copying conditions. There is NO +@@ -87,33 +88,44 @@ + exit 1 + fi + ++trap 'exit 1' 1 2 15 + +-dummy=dummy-$$ +-trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 ++# CC_FOR_BUILD -- compiler used by this script. Note that the use of a ++# compiler to aid in system detection is discouraged as it requires ++# temporary files to be created and, as you can see below, it is a ++# headache to deal with in a portable fashion. + +-# CC_FOR_BUILD -- compiler used by this script. + # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still + # use `HOST_CC' if defined, but it is deprecated. + ++# Portable tmp directory creation inspired by the Autoconf team. ++ ++set_cc_for_build=' ++trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; ++trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; ++: ${TMPDIR=/tmp} ; ++ { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || ++ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || ++ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; ++dummy=$tmp/dummy ; ++tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; + case $CC_FOR_BUILD,$HOST_CC,$CC in +- ,,) echo "int dummy(){}" > $dummy.c +- for c in cc gcc c89 ; do +- ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 +- if test $? = 0 ; then +- CC_FOR_BUILD="$c"; break +- fi +- done +- rm -f $dummy.c $dummy.o $dummy.rel ++ ,,) echo "int x;" > $dummy.c ; ++ for c in cc gcc c89 c99 ; do ++ if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then ++ CC_FOR_BUILD="$c"; break ; ++ fi ; ++ done ; + if test x"$CC_FOR_BUILD" = x ; then +- CC_FOR_BUILD=no_compiler_found ++ CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +-esac ++esac ;' + + # This is needed to find uname on a Pyramid OSx when run in the BSD universe. +-# (ghazi@noc.rutgers.edu 8/24/94.) ++# (ghazi@noc.rutgers.edu 1994-08-24) + if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH + fi +@@ -127,29 +139,31 @@ + + case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) +- # Netbsd (nbsd) targets should (where applicable) match one or ++ # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. +- # Determine the machine/vendor (is the vendor relevant). +- case "${UNAME_MACHINE}" in +- amiga) machine=m68k-unknown ;; +- arm32) machine=arm-unknown ;; +- atari*) machine=m68k-atari ;; +- sun3*) machine=m68k-sun ;; +- mac68k) machine=m68k-apple ;; +- macppc) machine=powerpc-apple ;; +- hp3[0-9][05]) machine=m68k-hp ;; +- ibmrt|romp-ibm) machine=romp-ibm ;; +- *) machine=${UNAME_MACHINE}-unknown ;; ++ # ++ # Note: NetBSD doesn't particularly care about the vendor ++ # portion of the name. We always set it to "unknown". ++ sysctl="sysctl -n hw.machine_arch" ++ UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ ++ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` ++ case "${UNAME_MACHINE_ARCH}" in ++ armeb) machine=armeb-unknown ;; ++ arm*) machine=arm-unknown ;; ++ sh3el) machine=shl-unknown ;; ++ sh3eb) machine=sh-unknown ;; ++ *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. +- case "${UNAME_MACHINE}" in +- i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k) ++ case "${UNAME_MACHINE_ARCH}" in ++ arm*|i386|m68k|ns32k|sh3*|sparc|vax) ++ eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then +@@ -165,69 +179,107 @@ + ;; + esac + # The OS release +- release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ++ # Debian GNU/NetBSD machines have a different userland, and ++ # thus, need a distinct triplet. However, they do not need ++ # kernel version information, so it can be replaced with a ++ # suitable tag, in the style of linux-gnu. ++ case "${UNAME_VERSION}" in ++ Debian*) ++ release='-gnu' ++ ;; ++ *) ++ release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ++ ;; ++ esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit 0 ;; ++ amiga:OpenBSD:*:*) ++ echo m68k-unknown-openbsd${UNAME_RELEASE} ++ exit 0 ;; ++ arc:OpenBSD:*:*) ++ echo mipsel-unknown-openbsd${UNAME_RELEASE} ++ exit 0 ;; ++ hp300:OpenBSD:*:*) ++ echo m68k-unknown-openbsd${UNAME_RELEASE} ++ exit 0 ;; ++ mac68k:OpenBSD:*:*) ++ echo m68k-unknown-openbsd${UNAME_RELEASE} ++ exit 0 ;; ++ macppc:OpenBSD:*:*) ++ echo powerpc-unknown-openbsd${UNAME_RELEASE} ++ exit 0 ;; ++ mvme68k:OpenBSD:*:*) ++ echo m68k-unknown-openbsd${UNAME_RELEASE} ++ exit 0 ;; ++ mvme88k:OpenBSD:*:*) ++ echo m88k-unknown-openbsd${UNAME_RELEASE} ++ exit 0 ;; ++ mvmeppc:OpenBSD:*:*) ++ echo powerpc-unknown-openbsd${UNAME_RELEASE} ++ exit 0 ;; ++ pmax:OpenBSD:*:*) ++ echo mipsel-unknown-openbsd${UNAME_RELEASE} ++ exit 0 ;; ++ sgi:OpenBSD:*:*) ++ echo mipseb-unknown-openbsd${UNAME_RELEASE} ++ exit 0 ;; ++ sun3:OpenBSD:*:*) ++ echo m68k-unknown-openbsd${UNAME_RELEASE} ++ exit 0 ;; ++ wgrisc:OpenBSD:*:*) ++ echo mipsel-unknown-openbsd${UNAME_RELEASE} ++ exit 0 ;; ++ *:OpenBSD:*:*) ++ echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} ++ exit 0 ;; + alpha:OSF1:*:*) + if test $UNAME_RELEASE = "V4.0"; then + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + fi ++ # According to Compaq, /usr/sbin/psrinfo has been available on ++ # OSF/1 and Tru64 systems produced since 1995. I hope that ++ # covers most systems running today. This code pipes the CPU ++ # types through head -n 1, so we only detect the type of CPU 0. ++ ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` ++ case "$ALPHA_CPU_TYPE" in ++ "EV4 (21064)") ++ UNAME_MACHINE="alpha" ;; ++ "EV4.5 (21064)") ++ UNAME_MACHINE="alpha" ;; ++ "LCA4 (21066/21068)") ++ UNAME_MACHINE="alpha" ;; ++ "EV5 (21164)") ++ UNAME_MACHINE="alphaev5" ;; ++ "EV5.6 (21164A)") ++ UNAME_MACHINE="alphaev56" ;; ++ "EV5.6 (21164PC)") ++ UNAME_MACHINE="alphapca56" ;; ++ "EV5.7 (21164PC)") ++ UNAME_MACHINE="alphapca57" ;; ++ "EV6 (21264)") ++ UNAME_MACHINE="alphaev6" ;; ++ "EV6.7 (21264A)") ++ UNAME_MACHINE="alphaev67" ;; ++ "EV6.8CB (21264C)") ++ UNAME_MACHINE="alphaev68" ;; ++ "EV6.8AL (21264B)") ++ UNAME_MACHINE="alphaev68" ;; ++ "EV6.8CX (21264D)") ++ UNAME_MACHINE="alphaev68" ;; ++ "EV6.9A (21264/EV69A)") ++ UNAME_MACHINE="alphaev69" ;; ++ "EV7 (21364)") ++ UNAME_MACHINE="alphaev7" ;; ++ "EV7.9 (21364A)") ++ UNAME_MACHINE="alphaev79" ;; ++ esac + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. +- cat <<EOF >$dummy.s +- .data +-\$Lformat: +- .byte 37,100,45,37,120,10,0 # "%d-%x\n" +- +- .text +- .globl main +- .align 4 +- .ent main +-main: +- .frame \$30,16,\$26,0 +- ldgp \$29,0(\$27) +- .prologue 1 +- .long 0x47e03d80 # implver \$0 +- lda \$2,-1 +- .long 0x47e20c21 # amask \$2,\$1 +- lda \$16,\$Lformat +- mov \$0,\$17 +- not \$1,\$18 +- jsr \$26,printf +- ldgp \$29,0(\$26) +- mov 0,\$16 +- jsr \$26,exit +- .end main +-EOF +- $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null +- if test "$?" = 0 ; then +- case `./$dummy` in +- 0-0) +- UNAME_MACHINE="alpha" +- ;; +- 1-0) +- UNAME_MACHINE="alphaev5" +- ;; +- 1-1) +- UNAME_MACHINE="alphaev56" +- ;; +- 1-101) +- UNAME_MACHINE="alphapca56" +- ;; +- 2-303) +- UNAME_MACHINE="alphaev6" +- ;; +- 2-307) +- UNAME_MACHINE="alphaev67" +- ;; +- esac +- fi +- rm -f $dummy.s $dummy + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit 0 ;; + Alpha\ *:Windows_NT*:*) +@@ -242,29 +294,11 @@ + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit 0;; +- amiga:OpenBSD:*:*) +- echo m68k-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit 0 ;; +- arc64:OpenBSD:*:*) +- echo mips64el-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; +- arc:OpenBSD:*:*) +- echo mipsel-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; +- hkmips:OpenBSD:*:*) +- echo mips-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; +- pmax:OpenBSD:*:*) +- echo mipsel-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; +- sgi:OpenBSD:*:*) +- echo mips-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; +- wgrisc:OpenBSD:*:*) +- echo mipsel-unknown-openbsd${UNAME_RELEASE} ++ *:[Mm]orph[Oo][Ss]:*:*) ++ echo ${UNAME_MACHINE}-unknown-morphos + exit 0 ;; + *:OS/390:*:*) + echo i370-ibm-openedition +@@ -286,6 +320,10 @@ + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit 0 ;; ++ DRS?6000:UNIX_SV:4.2*:7*) ++ case `/usr/bin/uname -p` in ++ sparc) echo sparc-icl-nx7 && exit 0 ;; ++ esac ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; +@@ -314,7 +352,7 @@ + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + sun*:*:4.2BSD:*) +- UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` ++ UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) +@@ -328,9 +366,6 @@ + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit 0 ;; +- atari*:OpenBSD:*:*) +- echo m68k-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor +@@ -357,18 +392,6 @@ + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit 0 ;; +- sun3*:OpenBSD:*:*) +- echo m68k-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; +- mac68k:OpenBSD:*:*) +- echo m68k-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; +- mvme68k:OpenBSD:*:*) +- echo m68k-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; +- mvme88k:OpenBSD:*:*) +- echo m88k-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit 0 ;; +@@ -385,6 +408,7 @@ + echo clipper-intergraph-clix${UNAME_RELEASE} + exit 0 ;; + mips:*:*:UMIPS | mips:*:*:RISCos) ++ eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #ifdef __cplusplus + #include <stdio.h> /* for printf() prototype */ +@@ -406,15 +430,20 @@ + exit (-1); + } + EOF +- $CC_FOR_BUILD $dummy.c -o $dummy \ +- && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ +- && rm -f $dummy.c $dummy && exit 0 +- rm -f $dummy.c $dummy ++ $CC_FOR_BUILD -o $dummy $dummy.c \ ++ && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ ++ && exit 0 + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit 0 ;; ++ Motorola:*:4.3:PL8-*) ++ echo powerpc-harris-powermax ++ exit 0 ;; ++ Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) ++ echo powerpc-harris-powermax ++ exit 0 ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit 0 ;; +@@ -475,6 +504,7 @@ + exit 0 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then ++ eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include <sys/systemcfg.h> + +@@ -486,8 +516,7 @@ + exit(0); + } + EOF +- $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 +- rm -f $dummy.c $dummy ++ $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 + echo rs6000-ibm-aix3.2.5 + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 +@@ -496,7 +525,7 @@ + fi + exit 0 ;; + *:AIX:*:[45]) +- IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` ++ IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else +@@ -536,10 +565,8 @@ + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) +- case "${HPUX_REV}" in +- 11.[0-9][0-9]) +- if [ -x /usr/bin/getconf ]; then +- sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` ++ if [ -x /usr/bin/getconf ]; then ++ sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 +@@ -548,12 +575,13 @@ + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; ++ '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac +- fi ;; +- esac +- if [ "${HP_ARCH}" = "" ]; then +- sed 's/^ //' << EOF >$dummy.c ++ fi ++ if [ "${HP_ARCH}" = "" ]; then ++ eval $set_cc_for_build ++ sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include <stdlib.h> +@@ -586,11 +614,21 @@ + exit (0); + } + EOF +- (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` +- if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi +- rm -f $dummy.c $dummy +- fi ;; ++ (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` ++ test -z "$HP_ARCH" && HP_ARCH=hppa ++ fi ;; + esac ++ if [ ${HP_ARCH} = "hppa2.0w" ] ++ then ++ # avoid double evaluation of $set_cc_for_build ++ test -n "$CC_FOR_BUILD" || eval $set_cc_for_build ++ if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null ++ then ++ HP_ARCH="hppa2.0w" ++ else ++ HP_ARCH="hppa64" ++ fi ++ fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + ia64:HP-UX:*:*) +@@ -598,6 +636,7 @@ + echo ia64-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) ++ eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include <unistd.h> + int +@@ -623,8 +662,7 @@ + exit (0); + } + EOF +- $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 +- rm -f $dummy.c $dummy ++ $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) +@@ -633,7 +671,7 @@ + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; +- *9??*:MPE/iX:*:*) ++ *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit 0 ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) +@@ -652,9 +690,6 @@ + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit 0 ;; +- hppa*:OpenBSD:*:*) +- echo hppa-unknown-openbsd +- exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit 0 ;; +@@ -673,41 +708,33 @@ + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit 0 ;; +- CRAY*X-MP:*:*:*) +- echo xmp-cray-unicos +- exit 0 ;; + CRAY*Y-MP:*:*:*) +- echo ymp-cray-unicos${UNAME_RELEASE} ++ echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ +- -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ ++ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ ++ -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; +- CRAY*T3D:*:*:*) +- echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' +- exit 0 ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; +- CRAY-2:*:*:*) +- echo cray2-cray-unicos +- exit 0 ;; ++ *:UNICOS/mp:*:*) ++ echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' ++ exit 0 ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; +- hp300:OpenBSD:*:*) +- echo m68k-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; +@@ -717,11 +744,19 @@ + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; +- *:FreeBSD:*:*) +- echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` +- exit 0 ;; +- *:OpenBSD:*:*) +- echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ++ *:FreeBSD:*:*|*:GNU/FreeBSD:*:*) ++ # Determine whether the default compiler uses glibc. ++ eval $set_cc_for_build ++ sed 's/^ //' << EOF >$dummy.c ++ #include <features.h> ++ #if __GLIBC__ >= 2 ++ LIBC=gnu ++ #else ++ LIBC= ++ #endif ++EOF ++ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` ++ echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} + exit 0 ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin +@@ -732,11 +767,17 @@ + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit 0 ;; ++ x86:Interix*:3*) ++ echo i586-pc-interix3 ++ exit 0 ;; ++ [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) ++ echo i${UNAME_MACHINE}-pc-mks ++ exit 0 ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? +- echo i386-pc-interix ++ echo i586-pc-interix + exit 0 ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin +@@ -756,104 +797,71 @@ + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; ++ cris:Linux:*:*) ++ echo cris-axis-linux-gnu ++ exit 0 ;; + ia64:Linux:*:*) +- echo ${UNAME_MACHINE}-unknown-linux ++ echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + mips:Linux:*:*) +- cat >$dummy.c <<EOF +-#ifdef __cplusplus +-#include <stdio.h> /* for printf() prototype */ +-int main (int argc, char *argv[]) { +-#else +-int main (argc, argv) int argc; char *argv[]; { +-#endif +-#ifdef __MIPSEB__ +- printf ("%s-unknown-linux-gnu\n", argv[1]); +-#endif +-#ifdef __MIPSEL__ +- printf ("%sel-unknown-linux-gnu\n", argv[1]); +-#endif +- return 0; +-} ++ eval $set_cc_for_build ++ sed 's/^ //' << EOF >$dummy.c ++ #undef CPU ++ #undef mips ++ #undef mipsel ++ #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) ++ CPU=mipsel ++ #else ++ #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) ++ CPU=mips ++ #else ++ CPU= ++ #endif ++ #endif + EOF +- $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 +- rm -f $dummy.c $dummy ++ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` ++ test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + ;; +- ppc:Linux:*:*) +- # Determine Lib Version +- cat >$dummy.c <<EOF +-#include <features.h> +-#if defined(__GLIBC__) +-extern char __libc_version[]; +-extern char __libc_release[]; +-#endif +-main(argc, argv) +- int argc; +- char *argv[]; +-{ +-#if defined(__GLIBC__) +- printf("%s %s\n", __libc_version, __libc_release); +-#else +- printf("unknown\n"); +-#endif +- return 0; +-} ++ mips64:Linux:*:*) ++ eval $set_cc_for_build ++ sed 's/^ //' << EOF >$dummy.c ++ #undef CPU ++ #undef mips64 ++ #undef mips64el ++ #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) ++ CPU=mips64el ++ #else ++ #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) ++ CPU=mips64 ++ #else ++ CPU= ++ #endif ++ #endif + EOF +- LIBC="" +- $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null +- if test "$?" = 0 ; then +- ./$dummy | grep 1\.99 > /dev/null +- if test "$?" = 0 ; then LIBC="libc1" ; fi +- fi +- rm -f $dummy.c $dummy +- echo powerpc-unknown-linux-gnu${LIBC} ++ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` ++ test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ++ ;; ++ ppc:Linux:*:*) ++ echo powerpc-unknown-linux-gnu ++ exit 0 ;; ++ ppc64:Linux:*:*) ++ echo powerpc64-unknown-linux-gnu + exit 0 ;; + alpha:Linux:*:*) +- cat <<EOF >$dummy.s +- .data +- \$Lformat: +- .byte 37,100,45,37,120,10,0 # "%d-%x\n" +- .text +- .globl main +- .align 4 +- .ent main +- main: +- .frame \$30,16,\$26,0 +- ldgp \$29,0(\$27) +- .prologue 1 +- .long 0x47e03d80 # implver \$0 +- lda \$2,-1 +- .long 0x47e20c21 # amask \$2,\$1 +- lda \$16,\$Lformat +- mov \$0,\$17 +- not \$1,\$18 +- jsr \$26,printf +- ldgp \$29,0(\$26) +- mov 0,\$16 +- jsr \$26,exit +- .end main +-EOF +- LIBC="" +- $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null +- if test "$?" = 0 ; then +- case `./$dummy` in +- 0-0) UNAME_MACHINE="alpha" ;; +- 1-0) UNAME_MACHINE="alphaev5" ;; +- 1-1) UNAME_MACHINE="alphaev56" ;; +- 1-101) UNAME_MACHINE="alphapca56" ;; +- 2-303) UNAME_MACHINE="alphaev6" ;; +- 2-307) UNAME_MACHINE="alphaev67" ;; +- esac +- objdump --private-headers $dummy | \ +- grep ld.so.1 > /dev/null +- if test "$?" = 0 ; then +- LIBC="libc1" +- fi +- fi +- rm -f $dummy.s $dummy ++ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in ++ EV5) UNAME_MACHINE=alphaev5 ;; ++ EV56) UNAME_MACHINE=alphaev56 ;; ++ PCA56) UNAME_MACHINE=alphapca56 ;; ++ PCA57) UNAME_MACHINE=alphapca56 ;; ++ EV6) UNAME_MACHINE=alphaev6 ;; ++ EV67) UNAME_MACHINE=alphaev67 ;; ++ EV68*) UNAME_MACHINE=alphaev68 ;; ++ esac ++ objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null ++ if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit 0 ;; + parisc:Linux:*:* | hppa:Linux:*:*) +@@ -883,71 +891,59 @@ + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. +- ld_supported_emulations=`cd /; ld --help 2>&1 \ +- | sed -ne '/supported emulations:/!d ++ # Set LC_ALL=C to ensure ld outputs messages in English. ++ ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ ++ | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g +- s/.*supported emulations: *// ++ s/.*supported targets: *// + s/ .*// + p'` +- case "$ld_supported_emulations" in +- i*86linux) +- echo "${UNAME_MACHINE}-pc-linux-gnuaout" +- exit 0 +- ;; +- elf_i*86) ++ case "$ld_supported_targets" in ++ elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; +- i*86coff) ++ a.out-i386-linux) ++ echo "${UNAME_MACHINE}-pc-linux-gnuaout" ++ exit 0 ;; ++ coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" +- exit 0 +- ;; +- esac +- # Either a pre-BFD a.out linker (linux-gnuoldld) +- # or one that does not give us useful --help. +- # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout. +- # If ld does not provide *any* "supported emulations:" +- # that means it is gnuoldld. +- test -z "$ld_supported_emulations" && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 +- case "${UNAME_MACHINE}" in +- i*86) +- VENDOR=pc; +- ;; +- *) +- VENDOR=unknown; +- ;; ++ exit 0 ;; ++ "") ++ # Either a pre-BFD a.out linker (linux-gnuoldld) or ++ # one that does not give us useful --help. ++ echo "${UNAME_MACHINE}-pc-linux-gnuoldld" ++ exit 0 ;; + esac + # Determine whether the default compiler is a.out or elf +- cat >$dummy.c <<EOF +-#include <features.h> +-#ifdef __cplusplus +-#include <stdio.h> /* for printf() prototype */ +- int main (int argc, char *argv[]) { +-#else +- int main (argc, argv) int argc; char *argv[]; { +-#endif +-#ifdef __ELF__ +-# ifdef __GLIBC__ +-# if __GLIBC__ >= 2 +- printf ("%s-${VENDOR}-linux-gnu\n", argv[1]); +-# else +- printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); +-# endif +-# else +- printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); +-# endif +-#else +- printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]); +-#endif +- return 0; +-} ++ eval $set_cc_for_build ++ sed 's/^ //' << EOF >$dummy.c ++ #include <features.h> ++ #ifdef __ELF__ ++ # ifdef __GLIBC__ ++ # if __GLIBC__ >= 2 ++ LIBC=gnu ++ # else ++ LIBC=gnulibc1 ++ # endif ++ # else ++ LIBC=gnulibc1 ++ # endif ++ #else ++ #ifdef __INTEL_COMPILER ++ LIBC=gnu ++ #else ++ LIBC=gnuaout ++ #endif ++ #endif + EOF +- $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 +- rm -f $dummy.c $dummy ++ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` ++ test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 + test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + ;; +-# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions +-# are messed up and put the nodename in both sysname and nodename. + i*86:DYNIX/ptx:4*:*) ++ # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. ++ # earlier versions are messed up and put the nodename in both ++ # sysname and nodename. + echo i386-sequent-sysv4 + exit 0 ;; + i*86:UNIX_SV:4.2MP:2.*) +@@ -958,6 +954,23 @@ + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit 0 ;; ++ i*86:OS/2:*:*) ++ # If we were able to find `uname', then EMX Unix compatibility ++ # is probably installed. ++ echo ${UNAME_MACHINE}-pc-os2-emx ++ exit 0 ;; ++ i*86:XTS-300:*:STOP) ++ echo ${UNAME_MACHINE}-unknown-stop ++ exit 0 ;; ++ i*86:atheos:*:*) ++ echo ${UNAME_MACHINE}-unknown-atheos ++ exit 0 ;; ++ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) ++ echo i386-unknown-lynxos${UNAME_RELEASE} ++ exit 0 ;; ++ i*86:*DOS:*:*) ++ echo ${UNAME_MACHINE}-pc-msdosdjgpp ++ exit 0 ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then +@@ -966,36 +979,32 @@ + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit 0 ;; +- i*86:*:5:7*) +- # Fixed at (any) Pentium or better +- UNAME_MACHINE=i586 +- if [ ${UNAME_SYSTEM} = "UnixWare" ] ; then +- echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}uw${UNAME_VERSION} +- else +- echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} +- fi ++ i*86:*:5:[78]*) ++ case `/bin/uname -X | grep "^Machine"` in ++ *486*) UNAME_MACHINE=i486 ;; ++ *Pentium) UNAME_MACHINE=i586 ;; ++ *Pent*|*Celeron) UNAME_MACHINE=i686 ;; ++ esac ++ echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit 0 ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` + echo ${UNAME_MACHINE}-pc-isc$UNAME_REL + elif /bin/uname -X 2>/dev/null >/dev/null ; then +- UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` +- (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 +- (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ ++ UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` ++ (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 ++ (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 +- (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ ++ (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 +- (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ ++ (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit 0 ;; +- i*86:*DOS:*:*) +- echo ${UNAME_MACHINE}-pc-msdosdjgpp +- exit 0 ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about +@@ -1019,9 +1028,15 @@ + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; ++ mc68k:UNIX:SYSTEM5:3.51m) ++ echo m68k-convergent-sysv ++ exit 0 ;; ++ M680?0:D-NIX:5.3:*) ++ echo m68k-diab-dnix ++ exit 0 ;; + M68*:*:R3V[567]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; +- 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) ++ 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` +@@ -1038,9 +1053,6 @@ + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; +- i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) +- echo i386-unknown-lynxos${UNAME_RELEASE} +- exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; +@@ -1067,8 +1079,8 @@ + echo ns32k-sni-sysv + fi + exit 0 ;; +- PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort +- # says <Richard.M.Bartel@ccMail.Census.GOV> ++ PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort ++ # says <Richard.M.Bartel@ccMail.Census.GOV> + echo i586-unisys-sysv4 + exit 0 ;; + *:UNIX_System_V:4*:FTX*) +@@ -1080,6 +1092,10 @@ + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit 0 ;; ++ *:VOS:*:*) ++ # From Paul.Green@stratus.com. ++ echo hppa1.1-stratus-vos ++ exit 0 ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit 0 ;; +@@ -1108,6 +1124,9 @@ + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit 0 ;; ++ SX-6:SUPER-UX:*:*) ++ echo sx6-nec-superux${UNAME_RELEASE} ++ exit 0 ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; +@@ -1115,18 +1134,24 @@ + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Darwin:*:*) +- echo `uname -p`-apple-darwin${UNAME_RELEASE} ++ case `uname -p` in ++ *86) UNAME_PROCESSOR=i686 ;; ++ powerpc) UNAME_PROCESSOR=powerpc ;; ++ esac ++ echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit 0 ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) +- if test "${UNAME_MACHINE}" = "x86pc"; then ++ UNAME_PROCESSOR=`uname -p` ++ if test "$UNAME_PROCESSOR" = "x86"; then ++ UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi +- echo `uname -p`-${UNAME_MACHINE}-nto-qnx ++ echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit 0 ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit 0 ;; +- NSR-[KW]:NONSTOP_KERNEL:*:*) ++ NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit 0 ;; + *:NonStop-UX:*:*) +@@ -1149,11 +1174,6 @@ + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit 0 ;; +- i*86:OS/2:*:*) +- # If we were able to find `uname', then EMX Unix compatibility +- # is probably installed. +- echo ${UNAME_MACHINE}-pc-os2-emx +- exit 0 ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit 0 ;; +@@ -1177,6 +1197,7 @@ + #echo '(No uname command or uname output not recognized.)' 1>&2 + #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + ++eval $set_cc_for_build + cat >$dummy.c <<EOF + #ifdef _SEQUENT_ + # include <sys/types.h> +@@ -1291,8 +1312,7 @@ + } + EOF + +-$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0 +-rm -f $dummy.c $dummy ++$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 + + # Apollos put the system type in the environment. + +--- linux-atm-2.4.1.orig/config.h.in ++++ linux-atm-2.4.1/config.h.in +@@ -1,4 +1,4 @@ +-/* config.h.in. Generated automatically from configure.in by autoheader. */ ++/* config.h.in. Generated automatically from configure.in by autoheader 2.13. */ + #ifndef _ATM_CONFIG_H + #define _ATM_CONFIG_H + +--- linux-atm-2.4.1.orig/config.sub ++++ linux-atm-2.4.1/config.sub +@@ -1,9 +1,9 @@ + #! /bin/sh + # Configuration validation subroutine script. +-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +-# Free Software Foundation, Inc. ++# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, ++# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + +-timestamp='2001-04-20' ++timestamp='2003-05-09' + + # This file is (in principle) common to ALL GNU software. + # The presence of a machine in this file suggests that SOME GNU software +@@ -29,7 +29,8 @@ + # configuration script generated by Autoconf, you may include it under + # the same distribution terms that you use for the rest of that program. + +-# Please send patches to <config-patches@gnu.org>. ++# Please send patches to <config-patches@gnu.org>. Submit a context ++# diff and a properly formatted ChangeLog entry. + # + # Configuration subroutine to validate and canonicalize a configuration type. + # Supply the specified configuration type as an argument. +@@ -117,7 +118,7 @@ + # Here we must recognize all the valid KERNEL-OS combinations. + maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` + case $maybe_os in +- nto-qnx* | linux-gnu* | storm-chaos* | os2-emx*) ++ nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; +@@ -157,6 +158,14 @@ + os=-vxworks + basic_machine=$1 + ;; ++ -chorusos*) ++ os=-chorusos ++ basic_machine=$1 ++ ;; ++ -chorusrdb) ++ os=-chorusrdb ++ basic_machine=$1 ++ ;; + -hiux*) + os=-hiuxwe2 + ;; +@@ -215,26 +224,48 @@ + case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. +- tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc \ +- | arm | arme[lb] | arm[bl]e | armv[2345] | armv[345][lb] | strongarm | xscale \ +- | pyramid | mn10200 | mn10300 | tron | a29k \ +- | 580 | i960 | h8300 \ +- | x86 | ppcbe | mipsbe | mipsle | shbe | shle \ +- | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \ +- | hppa64 \ +- | alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \ +- | alphaev6[78] \ +- | we32k | ns16k | clipper | i370 | sh | sh[34] \ +- | powerpc | powerpcle \ +- | 1750a | dsp16xx | pdp10 | pdp11 \ +- | mips16 | mips64 | mipsel | mips64el \ +- | mips64orion | mips64orionel | mipstx39 | mipstx39el \ +- | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \ +- | mips64vr5000 | miprs64vr5000el | mcore | s390 | s390x \ +- | sparc | sparclet | sparclite | sparc64 | sparcv9 | sparcv9b \ +- | v850 | c4x \ +- | thumb | d10v | d30v | fr30 | avr | openrisc | tic80 \ +- | pj | pjl | h8500) ++ 1750a | 580 \ ++ | a29k \ ++ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ ++ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ ++ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ ++ | clipper \ ++ | d10v | d30v | dlx | dsp16xx \ ++ | fr30 | frv \ ++ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ ++ | i370 | i860 | i960 | ia64 \ ++ | ip2k \ ++ | m32r | m68000 | m68k | m88k | mcore \ ++ | mips | mipsbe | mipseb | mipsel | mipsle \ ++ | mips16 \ ++ | mips64 | mips64el \ ++ | mips64vr | mips64vrel \ ++ | mips64orion | mips64orionel \ ++ | mips64vr4100 | mips64vr4100el \ ++ | mips64vr4300 | mips64vr4300el \ ++ | mips64vr5000 | mips64vr5000el \ ++ | mipsisa32 | mipsisa32el \ ++ | mipsisa32r2 | mipsisa32r2el \ ++ | mipsisa64 | mipsisa64el \ ++ | mipsisa64sb1 | mipsisa64sb1el \ ++ | mipsisa64sr71k | mipsisa64sr71kel \ ++ | mipstx39 | mipstx39el \ ++ | mn10200 | mn10300 \ ++ | msp430 \ ++ | ns16k | ns32k \ ++ | openrisc | or32 \ ++ | pdp10 | pdp11 | pj | pjl \ ++ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ ++ | pyramid \ ++ | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ ++ | sh64 | sh64le \ ++ | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ ++ | strongarm \ ++ | tahoe | thumb | tic80 | tron \ ++ | v850 | v850e \ ++ | we32k \ ++ | x86 | xscale | xstormy16 | xtensa \ ++ | z8k) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) +@@ -242,7 +273,7 @@ + basic_machine=$basic_machine-unknown + os=-none + ;; +- m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | w65) ++ m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + + # We use `pc' rather than `unknown' +@@ -257,31 +288,60 @@ + exit 1 + ;; + # Recognize the basic CPU types with company name. +- # FIXME: clean up the formatting here. +- vax-* | tahoe-* | i*86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \ +- | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | c[123]* \ +- | arm-* | armbe-* | armle-* | armv*-* | strongarm-* | xscale-* \ +- | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ +- | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \ +- | xmp-* | ymp-* \ +- | x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* \ +- | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \ +- | hppa2.0n-* | hppa64-* \ +- | alpha-* | alphaev[4-8]-* | alphaev56-* | alphapca5[67]-* \ +- | alphaev6[78]-* \ +- | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \ +- | clipper-* | orion-* \ +- | sparclite-* | pdp10-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ +- | sparc64-* | sparcv9-* | sparcv9b-* | sparc86x-* \ +- | mips16-* | mips64-* | mipsel-* \ +- | mips64el-* | mips64orion-* | mips64orionel-* \ +- | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \ +- | mipstx39-* | mipstx39el-* | mcore-* \ +- | f30[01]-* | f700-* | s390-* | s390x-* | sv1-* | t3e-* \ +- | [cjt]90-* \ +- | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \ +- | thumb-* | v850-* | d30v-* | tic30-* | tic80-* | c30-* | fr30-* \ +- | bs2000-* | tic54x-* | c54x-* | x86_64-* | pj-* | pjl-*) ++ 580-* \ ++ | a29k-* \ ++ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ ++ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ ++ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ ++ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ ++ | avr-* \ ++ | bs2000-* \ ++ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ ++ | clipper-* | cydra-* \ ++ | d10v-* | d30v-* | dlx-* \ ++ | elxsi-* \ ++ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ ++ | h8300-* | h8500-* \ ++ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ ++ | i*86-* | i860-* | i960-* | ia64-* \ ++ | ip2k-* \ ++ | m32r-* \ ++ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ ++ | m88110-* | m88k-* | mcore-* \ ++ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ ++ | mips16-* \ ++ | mips64-* | mips64el-* \ ++ | mips64vr-* | mips64vrel-* \ ++ | mips64orion-* | mips64orionel-* \ ++ | mips64vr4100-* | mips64vr4100el-* \ ++ | mips64vr4300-* | mips64vr4300el-* \ ++ | mips64vr5000-* | mips64vr5000el-* \ ++ | mipsisa32-* | mipsisa32el-* \ ++ | mipsisa32r2-* | mipsisa32r2el-* \ ++ | mipsisa64-* | mipsisa64el-* \ ++ | mipsisa64sb1-* | mipsisa64sb1el-* \ ++ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ ++ | mipstx39-* | mipstx39el-* \ ++ | msp430-* \ ++ | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ ++ | orion-* \ ++ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ ++ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ ++ | pyramid-* \ ++ | romp-* | rs6000-* \ ++ | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ ++ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ ++ | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ ++ | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ ++ | tahoe-* | thumb-* \ ++ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ ++ | tron-* \ ++ | v850-* | v850e-* | vax-* \ ++ | we32k-* \ ++ | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ ++ | xtensa-* \ ++ | ymp-* \ ++ | z8k-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. +@@ -313,6 +373,9 @@ + basic_machine=a29k-none + os=-bsd + ;; ++ amd64) ++ basic_machine=x86_64-pc ++ ;; + amdahl) + basic_machine=580-amdahl + os=-sysv +@@ -344,6 +407,10 @@ + basic_machine=ns32k-sequent + os=-dynix + ;; ++ c90) ++ basic_machine=c90-cray ++ os=-unicos ++ ;; + convex-c1) + basic_machine=c1-convex + os=-bsd +@@ -364,16 +431,8 @@ + basic_machine=c38-convex + os=-bsd + ;; +- cray | ymp) +- basic_machine=ymp-cray +- os=-unicos +- ;; +- cray2) +- basic_machine=cray2-cray +- os=-unicos +- ;; +- [cjt]90) +- basic_machine=${basic_machine}-cray ++ cray | j90) ++ basic_machine=j90-cray + os=-unicos + ;; + crds | unos) +@@ -388,6 +447,14 @@ + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; ++ decsystem10* | dec10*) ++ basic_machine=pdp10-dec ++ os=-tops10 ++ ;; ++ decsystem20* | dec20*) ++ basic_machine=pdp10-dec ++ os=-tops20 ++ ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola +@@ -568,14 +635,6 @@ + basic_machine=m68k-atari + os=-mint + ;; +- mipsel*-linux*) +- basic_machine=mipsel-unknown +- os=-linux-gnu +- ;; +- mips*-linux*) +- basic_machine=mips-unknown +- os=-linux-gnu +- ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; +@@ -590,6 +649,10 @@ + basic_machine=m68k-rom68k + os=-coff + ;; ++ morphos) ++ basic_machine=powerpc-unknown ++ os=-morphos ++ ;; + msdos) + basic_machine=i386-pc + os=-msdos +@@ -662,6 +725,10 @@ + np1) + basic_machine=np1-gould + ;; ++ nv1) ++ basic_machine=nv1-cray ++ os=-unicosmp ++ ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; +@@ -669,6 +736,10 @@ + basic_machine=hppa1.1-oki + os=-proelf + ;; ++ or32 | or32-*) ++ basic_machine=or32-unknown ++ os=-coff ++ ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose +@@ -691,19 +762,19 @@ + pbb) + basic_machine=m68k-tti + ;; +- pc532 | pc532-*) ++ pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; +- pentium | p5 | k5 | k6 | nexgen) ++ pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; +- pentiumpro | p6 | 6x86 | athlon) ++ pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2) + basic_machine=i686-pc + ;; +- pentium-* | p5-* | k5-* | k6-* | nexgen-*) ++ pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) +@@ -718,15 +789,25 @@ + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown +- ;; ++ ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown +- ;; ++ ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; ++ ppc64) basic_machine=powerpc64-unknown ++ ;; ++ ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ++ ;; ++ ppc64le | powerpc64little | ppc64-le | powerpc64-little) ++ basic_machine=powerpc64le-unknown ++ ;; ++ ppc64le-* | powerpc64little-*) ++ basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ++ ;; + ps2) + basic_machine=i386-ibm + ;; +@@ -744,10 +825,22 @@ + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; ++ s390 | s390-*) ++ basic_machine=s390-ibm ++ ;; ++ s390x | s390x-*) ++ basic_machine=s390x-ibm ++ ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; ++ sb1) ++ basic_machine=mipsisa64sb1-unknown ++ ;; ++ sb1el) ++ basic_machine=mipsisa64sb1el-unknown ++ ;; + sequent) + basic_machine=i386-sequent + ;; +@@ -755,7 +848,7 @@ + basic_machine=sh-hitachi + os=-hms + ;; +- sparclite-wrs) ++ sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; +@@ -822,19 +915,39 @@ + os=-dynix + ;; + t3e) +- basic_machine=t3e-cray ++ basic_machine=alphaev5-cray + os=-unicos + ;; ++ t90) ++ basic_machine=t90-cray ++ os=-unicos ++ ;; ++ tic4x | c4x*) ++ basic_machine=tic4x-unknown ++ os=-coff ++ ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; ++ tic55x | c55x*) ++ basic_machine=tic55x-unknown ++ os=-coff ++ ;; ++ tic6x | c6x*) ++ basic_machine=tic6x-unknown ++ os=-coff ++ ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; ++ toad1) ++ basic_machine=pdp10-xkl ++ os=-tops20 ++ ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; +@@ -859,8 +972,8 @@ + os=-vms + ;; + vpp*|vx|vx-*) +- basic_machine=f301-fujitsu +- ;; ++ basic_machine=f301-fujitsu ++ ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks +@@ -881,13 +994,13 @@ + basic_machine=hppa1.1-winbond + os=-proelf + ;; +- xmp) +- basic_machine=xmp-cray +- os=-unicos +- ;; +- xps | xps100) ++ xps | xps100) + basic_machine=xps100-honeywell + ;; ++ ymp) ++ basic_machine=ymp-cray ++ os=-unicos ++ ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim +@@ -908,13 +1021,6 @@ + op60c) + basic_machine=hppa1.1-oki + ;; +- mips) +- if [ x$os = x-linux-gnu ]; then +- basic_machine=mips-unknown +- else +- basic_machine=mips-mips +- fi +- ;; + romp) + basic_machine=romp-ibm + ;; +@@ -934,13 +1040,16 @@ + we32k) + basic_machine=we32k-att + ;; +- sh3 | sh4) ++ sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; ++ sh64) ++ basic_machine=sh64-unknown ++ ;; + sparc | sparcv9 | sparcv9b) + basic_machine=sparc-sun + ;; +- cydra) ++ cydra) + basic_machine=cydra-cydrome + ;; + orion) +@@ -955,10 +1064,6 @@ + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; +- c4x*) +- basic_machine=c4x-none +- os=-coff +- ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; +@@ -1018,11 +1123,15 @@ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ ++ | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ +- | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ ++ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ +- | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* | -os2*) ++ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ ++ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ ++ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ ++ | -powermax* | -dnix*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) +@@ -1034,8 +1143,10 @@ + ;; + esac + ;; ++ -nto-qnx*) ++ ;; + -nto*) +- os=-nto-qnx ++ os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ +@@ -1074,14 +1185,20 @@ + -acis*) + os=-aos + ;; ++ -atheos*) ++ os=-atheos ++ ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; ++ -nova*) ++ os=-rtmk-nova ++ ;; + -ns2 ) +- os=-nextstep2 ++ os=-nextstep2 + ;; + -nsk*) + os=-nsk +@@ -1120,8 +1237,14 @@ + -xenix) + os=-xenix + ;; +- -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) +- os=-mint ++ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) ++ os=-mint ++ ;; ++ -aros*) ++ os=-aros ++ ;; ++ -kaos*) ++ os=-kaos + ;; + -none) + ;; +@@ -1154,10 +1277,11 @@ + arm*-semi) + os=-aout + ;; ++ # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; +- pdp11-*) ++ pdp11-*) + os=-none + ;; + *-dec | vax-*) +@@ -1184,6 +1308,9 @@ + mips*-*) + os=-elf + ;; ++ or32-*) ++ os=-coff ++ ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; +@@ -1247,19 +1374,19 @@ + *-next) + os=-nextstep3 + ;; +- *-gould) ++ *-gould) + os=-sysv + ;; +- *-highlevel) ++ *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; +- *-sgi) ++ *-sgi) + os=-irix + ;; +- *-siemens) ++ *-siemens) + os=-sysv4 + ;; + *-masscomp) +@@ -1331,7 +1458,7 @@ + -ptx*) + vendor=sequent + ;; +- -vxsim* | -vxworks*) ++ -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) +@@ -1346,6 +1473,9 @@ + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; ++ -vos*) ++ vendor=stratus ++ ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +--- linux-atm-2.4.1.orig/configure ++++ linux-atm-2.4.1/configure +@@ -1,24 +1,244 @@ + #! /bin/sh +- + # Guess values for system-dependent variables and create Makefiles. +-# Generated automatically using autoconf version 2.13 +-# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. ++# Generated by GNU Autoconf 2.57. + # ++# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 ++# Free Software Foundation, Inc. + # This configure script is free software; the Free Software Foundation + # gives unlimited permission to copy, distribute and modify it. ++## --------------------- ## ++## M4sh Initialization. ## ++## --------------------- ## ++ ++# Be Bourne compatible ++if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then ++ emulate sh ++ NULLCMD=: ++ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which ++ # is contrary to our usage. Disable this feature. ++ alias -g '${1+"$@"}'='"$@"' ++elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then ++ set -o posix ++fi ++ ++# Support unset when possible. ++if (FOO=FOO; unset FOO) >/dev/null 2>&1; then ++ as_unset=unset ++else ++ as_unset=false ++fi ++ ++ ++# Work around bugs in pre-3.0 UWIN ksh. ++$as_unset ENV MAIL MAILPATH ++PS1='$ ' ++PS2='> ' ++PS4='+ ' ++ ++# NLS nuisances. ++for as_var in \ ++ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ ++ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ ++ LC_TELEPHONE LC_TIME ++do ++ if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then ++ eval $as_var=C; export $as_var ++ else ++ $as_unset $as_var ++ fi ++done ++ ++# Required to use basename. ++if expr a : '\(a\)' >/dev/null 2>&1; then ++ as_expr=expr ++else ++ as_expr=false ++fi ++ ++if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then ++ as_basename=basename ++else ++ as_basename=false ++fi ++ ++ ++# Name of the executable. ++as_me=`$as_basename "$0" || ++$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ ++ X"$0" : 'X\(//\)$' \| \ ++ X"$0" : 'X\(/\)$' \| \ ++ . : '\(.\)' 2>/dev/null || ++echo X/"$0" | ++ sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } ++ /^X\/\(\/\/\)$/{ s//\1/; q; } ++ /^X\/\(\/\).*/{ s//\1/; q; } ++ s/.*/./; q'` ++ ++ ++# PATH needs CR, and LINENO needs CR and PATH. ++# Avoid depending upon Character Ranges. ++as_cr_letters='abcdefghijklmnopqrstuvwxyz' ++as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' ++as_cr_Letters=$as_cr_letters$as_cr_LETTERS ++as_cr_digits='0123456789' ++as_cr_alnum=$as_cr_Letters$as_cr_digits ++ ++# The user is always right. ++if test "${PATH_SEPARATOR+set}" != set; then ++ echo "#! /bin/sh" >conf$$.sh ++ echo "exit 0" >>conf$$.sh ++ chmod +x conf$$.sh ++ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then ++ PATH_SEPARATOR=';' ++ else ++ PATH_SEPARATOR=: ++ fi ++ rm -f conf$$.sh ++fi ++ ++ ++ as_lineno_1=$LINENO ++ as_lineno_2=$LINENO ++ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` ++ test "x$as_lineno_1" != "x$as_lineno_2" && ++ test "x$as_lineno_3" = "x$as_lineno_2" || { ++ # Find who we are. Look in the path if we contain no path at all ++ # relative or not. ++ case $0 in ++ *[\\/]* ) as_myself=$0 ;; ++ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break ++done ++ ++ ;; ++ esac ++ # We did not find ourselves, most probably we were run as `sh COMMAND' ++ # in which case we are not to be found in the path. ++ if test "x$as_myself" = x; then ++ as_myself=$0 ++ fi ++ if test ! -f "$as_myself"; then ++ { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 ++ { (exit 1); exit 1; }; } ++ fi ++ case $CONFIG_SHELL in ++ '') ++ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for as_base in sh bash ksh sh5; do ++ case $as_dir in ++ /*) ++ if ("$as_dir/$as_base" -c ' ++ as_lineno_1=$LINENO ++ as_lineno_2=$LINENO ++ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` ++ test "x$as_lineno_1" != "x$as_lineno_2" && ++ test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then ++ $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } ++ $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } ++ CONFIG_SHELL=$as_dir/$as_base ++ export CONFIG_SHELL ++ exec "$CONFIG_SHELL" "$0" ${1+"$@"} ++ fi;; ++ esac ++ done ++done ++;; ++ esac ++ ++ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO ++ # uniformly replaced by the line number. The first 'sed' inserts a ++ # line-number line before each line; the second 'sed' does the real ++ # work. The second script uses 'N' to pair each line-number line ++ # with the numbered line, and appends trailing '-' during ++ # substitution so that $LINENO is not a special case at line end. ++ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the ++ # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) ++ sed '=' <$as_myself | ++ sed ' ++ N ++ s,$,-, ++ : loop ++ s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, ++ t loop ++ s,-$,, ++ s,^['$as_cr_digits']*\n,, ++ ' >$as_me.lineno && ++ chmod +x $as_me.lineno || ++ { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 ++ { (exit 1); exit 1; }; } ++ ++ # Don't try to exec as it changes $[0], causing all sort of problems ++ # (the dirname of $[0] is not the place where we might find the ++ # original and so on. Autoconf is especially sensible to this). ++ . ./$as_me.lineno ++ # Exit status is that of the last command. ++ exit ++} ++ ++ ++case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in ++ *c*,-n*) ECHO_N= ECHO_C=' ++' ECHO_T=' ' ;; ++ *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; ++ *) ECHO_N= ECHO_C='\c' ECHO_T= ;; ++esac ++ ++if expr a : '\(a\)' >/dev/null 2>&1; then ++ as_expr=expr ++else ++ as_expr=false ++fi ++ ++rm -f conf$$ conf$$.exe conf$$.file ++echo >conf$$.file ++if ln -s conf$$.file conf$$ 2>/dev/null; then ++ # We could just check for DJGPP; but this test a) works b) is more generic ++ # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). ++ if test -f conf$$.exe; then ++ # Don't use ln at all; we don't have any links ++ as_ln_s='cp -p' ++ else ++ as_ln_s='ln -s' ++ fi ++elif ln conf$$.file conf$$ 2>/dev/null; then ++ as_ln_s=ln ++else ++ as_ln_s='cp -p' ++fi ++rm -f conf$$ conf$$.exe conf$$.file ++ ++if mkdir -p . 2>/dev/null; then ++ as_mkdir_p=: ++else ++ as_mkdir_p=false ++fi ++ ++as_executable_p="test -f" ++ ++# Sed expression to map a string onto a valid CPP name. ++as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" ++ ++# Sed expression to map a string onto a valid variable name. ++as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" ++ ++ ++# IFS ++# We need space, tab and new line, in precisely that order. ++as_nl=' ++' ++IFS=" $as_nl" ++ ++# CDPATH. ++$as_unset CDPATH + +-# Defaults: +-ac_help= +-ac_default_prefix=/usr/local +-# Any additions from configure.in: +-ac_help="$ac_help +- --enable-shared[=PKGS] build shared libraries [default=yes]" +-ac_help="$ac_help +- --enable-static[=PKGS] build static libraries [default=yes]" +-ac_help="$ac_help +- --enable-fast-install[=PKGS] optimize for fast installation [default=yes]" +-ac_help="$ac_help +- --with-gnu-ld assume the C compiler uses GNU ld [default=no]" + + # Find the correct PATH separator. Usually this is `:', but + # DJGPP uses `;' like DOS. +@@ -28,6 +248,7 @@ + *-DOS) lt_cv_sys_path_separator=';' ;; + *) lt_cv_sys_path_separator=':' ;; + esac ++ PATH_SEPARATOR=$lt_cv_sys_path_separator + fi + + +@@ -94,7 +315,7 @@ + # + # So, first we look for a working echo in the user's PATH. + +- IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" ++ IFS="${IFS= }"; save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && +@@ -177,34 +398,86 @@ + fi + + +-ac_help="$ac_help +- --disable-libtool-lock avoid locking (might break parallel builds)" +-ac_help="$ac_help +- --with-pic try to use only PIC/non-PIC objects [default=use both]" +-ac_help="$ac_help +- --with-uni=VERSION UNI version to use (3.0,3.1,4.0) [default=dynamic]" +-ac_help="$ac_help +- --enable-allow_uni30 Allow UNI 3.0 backwards-compatible extensions (if using UNI 3.1)" +-ac_help="$ac_help +- --enable-q2963_1 Enable peak cell rate modification as specified in Q.2963.1 (if using UNI 4.0)" +-ac_help="$ac_help +- --enable-cisco Enable work around for point-to-multipoint signaling bug in Cisco LS100 or LS7010 switches" +-ac_help="$ac_help +- --enable-thomflex Some versions of the Thomson Thomflex 5000 won't do any signaling before they get a RESTART. Enable sending of a RESTART whenever SAAL comes up." +-ac_help="$ac_help +- --enable-mpoa_1_1 Enable proposed MPOA 1.1 features" +-ac_help="$ac_help +- --enable-mpr Enable memory debugging (if MPR is installed)" ++ ++# Name of the host. ++# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, ++# so uname gets run too. ++ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` ++ ++exec 6>&1 ++ ++# ++# Initializations. ++# ++ac_default_prefix=/usr/local ++ac_config_libobj_dir=. ++cross_compiling=no ++subdirs= ++MFLAGS= ++MAKEFLAGS= ++SHELL=${CONFIG_SHELL-/bin/sh} ++ ++# Maximum number of lines to put in a shell here document. ++# This variable seems obsolete. It should probably be removed, and ++# only ac_max_sed_lines should be used. ++: ${ac_max_here_lines=38} ++ ++# Identity of this package. ++PACKAGE_NAME= ++PACKAGE_TARNAME= ++PACKAGE_VERSION= ++PACKAGE_STRING= ++PACKAGE_BUGREPORT= ++ ++ac_unique_file="src/include/atm.h" ++# Factoring default headers for most tests. ++ac_includes_default="\ ++#include <stdio.h> ++#if HAVE_SYS_TYPES_H ++# include <sys/types.h> ++#endif ++#if HAVE_SYS_STAT_H ++# include <sys/stat.h> ++#endif ++#if STDC_HEADERS ++# include <stdlib.h> ++# include <stddef.h> ++#else ++# if HAVE_STDLIB_H ++# include <stdlib.h> ++# endif ++#endif ++#if HAVE_STRING_H ++# if !STDC_HEADERS && HAVE_MEMORY_H ++# include <memory.h> ++# endif ++# include <string.h> ++#endif ++#if HAVE_STRINGS_H ++# include <strings.h> ++#endif ++#if HAVE_INTTYPES_H ++# include <inttypes.h> ++#else ++# if HAVE_STDINT_H ++# include <stdint.h> ++# endif ++#endif ++#if HAVE_UNISTD_H ++# include <unistd.h> ++#endif" ++ ++ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO SET_MAKE LIBVER_CURRENT LIBVER_REVISION LIBVER_AGE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT LEX LEXLIB LEX_OUTPUT_ROOT YACC LN_S ECHO RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP CPP EGREP LIBTOOL LIBTOOL_DEPS PERL LIBOBJS LTLIBOBJS' ++ac_subst_files='' + + # Initialize some variables set by options. ++ac_init_help= ++ac_init_version=false + # The variables have the same names as the options, with + # dashes changed to underlines. +-build=NONE +-cache_file=./config.cache ++cache_file=/dev/null + exec_prefix=NONE +-host=NONE + no_create= +-nonopt=NONE + no_recursion= + prefix=NONE + program_prefix=NONE +@@ -213,10 +486,15 @@ + silent= + site= + srcdir= +-target=NONE + verbose= + x_includes=NONE + x_libraries=NONE ++ ++# Installation directory options. ++# These are left unexpanded so users can "make install exec_prefix=/foo" ++# and all the variables that are supposed to be based on exec_prefix ++# by default will actually change. ++# Use braces instead of parens because sh, perl, etc. also accept them. + bindir='${exec_prefix}/bin' + sbindir='${exec_prefix}/sbin' + libexecdir='${exec_prefix}/libexec' +@@ -230,17 +508,9 @@ + infodir='${prefix}/info' + mandir='${prefix}/man' + +-# Initialize some other variables. +-subdirs= +-MFLAGS= MAKEFLAGS= +-SHELL=${CONFIG_SHELL-/bin/sh} +-# Maximum number of lines to put in a shell here document. +-ac_max_here_lines=12 +- + ac_prev= + for ac_option + do +- + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" +@@ -248,59 +518,59 @@ + continue + fi + +- case "$ac_option" in +- -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; +- *) ac_optarg= ;; +- esac ++ ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + + # Accept the important Cygnus configure options, so we can diagnose typos. + +- case "$ac_option" in ++ case $ac_option in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) +- bindir="$ac_optarg" ;; ++ bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) +- ac_prev=build ;; ++ ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) +- build="$ac_optarg" ;; ++ build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) +- cache_file="$ac_optarg" ;; ++ cache_file=$ac_optarg ;; ++ ++ --config-cache | -C) ++ cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) +- datadir="$ac_optarg" ;; ++ datadir=$ac_optarg ;; + + -disable-* | --disable-*) +- ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` ++ ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. +- if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then +- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } +- fi +- ac_feature=`echo $ac_feature| sed 's/-/_/g'` +- eval "enable_${ac_feature}=no" ;; ++ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && ++ { echo "$as_me: error: invalid feature name: $ac_feature" >&2 ++ { (exit 1); exit 1; }; } ++ ac_feature=`echo $ac_feature | sed 's/-/_/g'` ++ eval "enable_$ac_feature=no" ;; + + -enable-* | --enable-*) +- ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` ++ ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. +- if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then +- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } +- fi +- ac_feature=`echo $ac_feature| sed 's/-/_/g'` +- case "$ac_option" in +- *=*) ;; ++ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && ++ { echo "$as_me: error: invalid feature name: $ac_feature" >&2 ++ { (exit 1); exit 1; }; } ++ ac_feature=`echo $ac_feature | sed 's/-/_/g'` ++ case $ac_option in ++ *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac +- eval "enable_${ac_feature}='$ac_optarg'" ;; ++ eval "enable_$ac_feature='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ +@@ -309,95 +579,47 @@ + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) +- exec_prefix="$ac_optarg" ;; ++ exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + +- -help | --help | --hel | --he) +- # Omit some internal or obsolete options to make the list less imposing. +- # This message is too long to be a string in the A/UX 3.1 sh. +- cat << EOF +-Usage: configure [options] [host] +-Options: [defaults in brackets after descriptions] +-Configuration: +- --cache-file=FILE cache test results in FILE +- --help print this message +- --no-create do not create output files +- --quiet, --silent do not print \`checking...' messages +- --version print the version of autoconf that created configure +-Directory and file names: +- --prefix=PREFIX install architecture-independent files in PREFIX +- [$ac_default_prefix] +- --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX +- [same as prefix] +- --bindir=DIR user executables in DIR [EPREFIX/bin] +- --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] +- --libexecdir=DIR program executables in DIR [EPREFIX/libexec] +- --datadir=DIR read-only architecture-independent data in DIR +- [PREFIX/share] +- --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] +- --sharedstatedir=DIR modifiable architecture-independent data in DIR +- [PREFIX/com] +- --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] +- --libdir=DIR object code libraries in DIR [EPREFIX/lib] +- --includedir=DIR C header files in DIR [PREFIX/include] +- --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] +- --infodir=DIR info documentation in DIR [PREFIX/info] +- --mandir=DIR man documentation in DIR [PREFIX/man] +- --srcdir=DIR find the sources in DIR [configure dir or ..] +- --program-prefix=PREFIX prepend PREFIX to installed program names +- --program-suffix=SUFFIX append SUFFIX to installed program names +- --program-transform-name=PROGRAM +- run sed PROGRAM on installed program names +-EOF +- cat << EOF +-Host type: +- --build=BUILD configure for building on BUILD [BUILD=HOST] +- --host=HOST configure for HOST [guessed] +- --target=TARGET configure for TARGET [TARGET=HOST] +-Features and packages: +- --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) +- --enable-FEATURE[=ARG] include FEATURE [ARG=yes] +- --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] +- --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) +- --x-includes=DIR X include files are in DIR +- --x-libraries=DIR X library files are in DIR +-EOF +- if test -n "$ac_help"; then +- echo "--enable and --with options recognized:$ac_help" +- fi +- exit 0 ;; ++ -help | --help | --hel | --he | -h) ++ ac_init_help=long ;; ++ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ++ ac_init_help=recursive ;; ++ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ++ ac_init_help=short ;; + + -host | --host | --hos | --ho) +- ac_prev=host ;; ++ ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) +- host="$ac_optarg" ;; ++ host_alias=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) +- includedir="$ac_optarg" ;; ++ includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) +- infodir="$ac_optarg" ;; ++ infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) +- libdir="$ac_optarg" ;; ++ libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) +- libexecdir="$ac_optarg" ;; ++ libexecdir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ +@@ -406,19 +628,19 @@ + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) +- localstatedir="$ac_optarg" ;; ++ localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) +- mandir="$ac_optarg" ;; ++ mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ +- | --no-cr | --no-c) ++ | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ +@@ -432,26 +654,26 @@ + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) +- oldincludedir="$ac_optarg" ;; ++ oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) +- prefix="$ac_optarg" ;; ++ prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) +- program_prefix="$ac_optarg" ;; ++ program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) +- program_suffix="$ac_optarg" ;; ++ program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ +@@ -468,7 +690,7 @@ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) +- program_transform_name="$ac_optarg" ;; ++ program_transform_name=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) +@@ -478,7 +700,7 @@ + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) +- sbindir="$ac_optarg" ;; ++ sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ +@@ -489,58 +711,57 @@ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) +- sharedstatedir="$ac_optarg" ;; ++ sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) +- site="$ac_optarg" ;; ++ site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) +- srcdir="$ac_optarg" ;; ++ srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) +- sysconfdir="$ac_optarg" ;; ++ sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) +- ac_prev=target ;; ++ ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) +- target="$ac_optarg" ;; ++ target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + +- -version | --version | --versio | --versi | --vers) +- echo "configure generated by autoconf version 2.13" +- exit 0 ;; ++ -version | --version | --versio | --versi | --vers | -V) ++ ac_init_version=: ;; + + -with-* | --with-*) +- ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` ++ ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. +- if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then +- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } +- fi ++ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && ++ { echo "$as_me: error: invalid package name: $ac_package" >&2 ++ { (exit 1); exit 1; }; } + ac_package=`echo $ac_package| sed 's/-/_/g'` +- case "$ac_option" in +- *=*) ;; ++ case $ac_option in ++ *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac +- eval "with_${ac_package}='$ac_optarg'" ;; ++ eval "with_$ac_package='$ac_optarg'" ;; + + -without-* | --without-*) +- ac_package=`echo $ac_option|sed -e 's/-*without-//'` ++ ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. +- if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then +- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } +- fi +- ac_package=`echo $ac_package| sed 's/-/_/g'` +- eval "with_${ac_package}=no" ;; ++ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && ++ { echo "$as_me: error: invalid package name: $ac_package" >&2 ++ { (exit 1); exit 1; }; } ++ ac_package=`echo $ac_package | sed 's/-/_/g'` ++ eval "with_$ac_package=no" ;; + + --x) + # Obsolete; use --with-x. +@@ -551,99 +772,110 @@ + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) +- x_includes="$ac_optarg" ;; ++ x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) +- x_libraries="$ac_optarg" ;; ++ x_libraries=$ac_optarg ;; + +- -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } ++ -*) { echo "$as_me: error: unrecognized option: $ac_option ++Try \`$0 --help' for more information." >&2 ++ { (exit 1); exit 1; }; } + ;; + ++ *=*) ++ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` ++ # Reject names that are not valid shell variable names. ++ expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && ++ { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 ++ { (exit 1); exit 1; }; } ++ ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ++ eval "$ac_envvar='$ac_optarg'" ++ export $ac_envvar ;; ++ + *) +- if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then +- echo "configure: warning: $ac_option: invalid host type" 1>&2 +- fi +- if test "x$nonopt" != xNONE; then +- { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } +- fi +- nonopt="$ac_option" ++ # FIXME: should be removed in autoconf 3.0. ++ echo "$as_me: WARNING: you should use --build, --host, --target" >&2 ++ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && ++ echo "$as_me: WARNING: invalid host type: $ac_option" >&2 ++ : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac + done + + if test -n "$ac_prev"; then +- { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +-fi +- +-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 +- +-# File descriptor usage: +-# 0 standard input +-# 1 file creation +-# 2 errors and warnings +-# 3 some systems may open it to /dev/tty +-# 4 used on the Kubota Titan +-# 6 checking for... messages and results +-# 5 compiler messages saved in config.log +-if test "$silent" = yes; then +- exec 6>/dev/null +-else +- exec 6>&1 ++ ac_option=--`echo $ac_prev | sed 's/_/-/g'` ++ { echo "$as_me: error: missing argument to $ac_option" >&2 ++ { (exit 1); exit 1; }; } + fi +-exec 5>./config.log + +-echo "\ +-This file contains any messages produced by compilers while +-running configure, to aid debugging if configure makes a mistake. +-" 1>&5 ++# Be sure to have absolute paths. ++for ac_var in exec_prefix prefix ++do ++ eval ac_val=$`echo $ac_var` ++ case $ac_val in ++ [\\/$]* | ?:[\\/]* | NONE | '' ) ;; ++ *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 ++ { (exit 1); exit 1; }; };; ++ esac ++done + +-# Strip out --no-create and --no-recursion so they do not pile up. +-# Also quote any args containing shell metacharacters. +-ac_configure_args= +-for ac_arg ++# Be sure to have absolute paths. ++for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ ++ localstatedir libdir includedir oldincludedir infodir mandir + do +- case "$ac_arg" in +- -no-create | --no-create | --no-creat | --no-crea | --no-cre \ +- | --no-cr | --no-c) ;; +- -no-recursion | --no-recursion | --no-recursio | --no-recursi \ +- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; +- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) +- ac_configure_args="$ac_configure_args '$ac_arg'" ;; +- *) ac_configure_args="$ac_configure_args $ac_arg" ;; ++ eval ac_val=$`echo $ac_var` ++ case $ac_val in ++ [\\/$]* | ?:[\\/]* ) ;; ++ *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 ++ { (exit 1); exit 1; }; };; + esac + done + +-# NLS nuisances. +-# Only set these to C if already set. These must not be set unconditionally +-# because not all systems understand e.g. LANG=C (notably SCO). +-# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +-# Non-C LC_CTYPE values break the ctype check. +-if test "${LANG+set}" = set; then LANG=C; export LANG; fi +-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +-if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +-if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi ++# There might be people who depend on the old broken behavior: `$host' ++# used to hold the argument of --host etc. ++# FIXME: To remove some day. ++build=$build_alias ++host=$host_alias ++target=$target_alias ++ ++# FIXME: To remove some day. ++if test "x$host_alias" != x; then ++ if test "x$build_alias" = x; then ++ cross_compiling=maybe ++ echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. ++ If a cross compiler is detected then cross compile mode will be used." >&2 ++ elif test "x$build_alias" != "x$host_alias"; then ++ cross_compiling=yes ++ fi ++fi + +-# confdefs.h avoids OS command line length limits that DEFS can exceed. +-rm -rf conftest* confdefs.h +-# AIX cpp loses on an empty file, so make sure it contains at least a newline. +-echo > confdefs.h ++ac_tool_prefix= ++test -n "$host_alias" && ac_tool_prefix=$host_alias- ++ ++test "$silent" = yes && exec 6>/dev/null + +-# A filename unique to this package, relative to the directory that +-# configure is in, which we can look for to find out if srcdir is correct. +-ac_unique_file=src/include/atm.h + + # Find the source files, if location was not specified. + if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. +- ac_prog=$0 +- ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` +- test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. ++ ac_confdir=`(dirname "$0") 2>/dev/null || ++$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ ++ X"$0" : 'X\(//\)[^/]' \| \ ++ X"$0" : 'X\(//\)$' \| \ ++ X"$0" : 'X\(/\)' \| \ ++ . : '\(.\)' 2>/dev/null || ++echo X"$0" | ++ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } ++ /^X\(\/\/\)[^/].*/{ s//\1/; q; } ++ /^X\(\/\/\)$/{ s//\1/; q; } ++ /^X\(\/\).*/{ s//\1/; q; } ++ s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. +@@ -653,13 +885,453 @@ + fi + if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then +- { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } ++ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 ++ { (exit 1); exit 1; }; } + else +- { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } ++ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 ++ { (exit 1); exit 1; }; } + fi + fi +-srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` ++(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || ++ { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 ++ { (exit 1); exit 1; }; } ++srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ++ac_env_build_alias_set=${build_alias+set} ++ac_env_build_alias_value=$build_alias ++ac_cv_env_build_alias_set=${build_alias+set} ++ac_cv_env_build_alias_value=$build_alias ++ac_env_host_alias_set=${host_alias+set} ++ac_env_host_alias_value=$host_alias ++ac_cv_env_host_alias_set=${host_alias+set} ++ac_cv_env_host_alias_value=$host_alias ++ac_env_target_alias_set=${target_alias+set} ++ac_env_target_alias_value=$target_alias ++ac_cv_env_target_alias_set=${target_alias+set} ++ac_cv_env_target_alias_value=$target_alias ++ac_env_CC_set=${CC+set} ++ac_env_CC_value=$CC ++ac_cv_env_CC_set=${CC+set} ++ac_cv_env_CC_value=$CC ++ac_env_CFLAGS_set=${CFLAGS+set} ++ac_env_CFLAGS_value=$CFLAGS ++ac_cv_env_CFLAGS_set=${CFLAGS+set} ++ac_cv_env_CFLAGS_value=$CFLAGS ++ac_env_LDFLAGS_set=${LDFLAGS+set} ++ac_env_LDFLAGS_value=$LDFLAGS ++ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ++ac_cv_env_LDFLAGS_value=$LDFLAGS ++ac_env_CPPFLAGS_set=${CPPFLAGS+set} ++ac_env_CPPFLAGS_value=$CPPFLAGS ++ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ++ac_cv_env_CPPFLAGS_value=$CPPFLAGS ++ac_env_CPP_set=${CPP+set} ++ac_env_CPP_value=$CPP ++ac_cv_env_CPP_set=${CPP+set} ++ac_cv_env_CPP_value=$CPP ++ ++# ++# Report the --help message. ++# ++if test "$ac_init_help" = "long"; then ++ # Omit some internal or obsolete options to make the list less imposing. ++ # This message is too long to be a string in the A/UX 3.1 sh. ++ cat <<_ACEOF ++\`configure' configures this package to adapt to many kinds of systems. ++ ++Usage: $0 [OPTION]... [VAR=VALUE]... ++ ++To assign environment variables (e.g., CC, CFLAGS...), specify them as ++VAR=VALUE. See below for descriptions of some of the useful variables. ++ ++Defaults for the options are specified in brackets. ++ ++Configuration: ++ -h, --help display this help and exit ++ --help=short display options specific to this package ++ --help=recursive display the short help of all the included packages ++ -V, --version display version information and exit ++ -q, --quiet, --silent do not print \`checking...' messages ++ --cache-file=FILE cache test results in FILE [disabled] ++ -C, --config-cache alias for \`--cache-file=config.cache' ++ -n, --no-create do not create output files ++ --srcdir=DIR find the sources in DIR [configure dir or \`..'] ++ ++_ACEOF ++ ++ cat <<_ACEOF ++Installation directories: ++ --prefix=PREFIX install architecture-independent files in PREFIX ++ [$ac_default_prefix] ++ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX ++ [PREFIX] ++ ++By default, \`make install' will install all the files in ++\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify ++an installation prefix other than \`$ac_default_prefix' using \`--prefix', ++for instance \`--prefix=\$HOME'. ++ ++For better control, use the options below. ++ ++Fine tuning of the installation directories: ++ --bindir=DIR user executables [EPREFIX/bin] ++ --sbindir=DIR system admin executables [EPREFIX/sbin] ++ --libexecdir=DIR program executables [EPREFIX/libexec] ++ --datadir=DIR read-only architecture-independent data [PREFIX/share] ++ --sysconfdir=DIR read-only single-machine data [PREFIX/etc] ++ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] ++ --localstatedir=DIR modifiable single-machine data [PREFIX/var] ++ --libdir=DIR object code libraries [EPREFIX/lib] ++ --includedir=DIR C header files [PREFIX/include] ++ --oldincludedir=DIR C header files for non-gcc [/usr/include] ++ --infodir=DIR info documentation [PREFIX/info] ++ --mandir=DIR man documentation [PREFIX/man] ++_ACEOF ++ ++ cat <<\_ACEOF ++ ++Program names: ++ --program-prefix=PREFIX prepend PREFIX to installed program names ++ --program-suffix=SUFFIX append SUFFIX to installed program names ++ --program-transform-name=PROGRAM run sed PROGRAM on installed program names ++ ++System types: ++ --build=BUILD configure for building on BUILD [guessed] ++ --host=HOST cross-compile to build programs to run on HOST [BUILD] ++ --target=TARGET configure for building compilers for TARGET [HOST] ++_ACEOF ++fi ++ ++if test -n "$ac_init_help"; then ++ ++ cat <<\_ACEOF ++ ++Optional Features: ++ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) ++ --enable-FEATURE[=ARG] include FEATURE [ARG=yes] ++ --enable-shared=PKGS build shared libraries default=yes ++ --enable-static=PKGS build static libraries default=yes ++ --enable-fast-install=PKGS optimize for fast installation default=yes ++ --disable-libtool-lock avoid locking (might break parallel builds) ++ --enable-allow_uni30 Allow UNI 3.0 backwards-compatible extensions (if using UNI 3.1) ++ --enable-q2963_1 Enable peak cell rate modification as specified in Q.2963.1 (if using UNI 4.0) ++ --enable-cisco Enable work around for point-to-multipoint signaling bug in Cisco LS100 or LS7010 switches ++ --enable-thomflex Some versions of the Thomson Thomflex 5000 won't do any signaling before they get a RESTART. Enable sending of a RESTART whenever SAAL comes up. ++ --enable-mpoa_1_1 Enable proposed MPOA 1.1 features ++ --enable-mpr Enable memory debugging (if MPR is installed) ++ ++Optional Packages: ++ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] ++ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) ++ --with-gnu-ld assume the C compiler uses GNU ld default=no ++ --with-pic try to use only PIC/non-PIC objects default=use both ++ --with-uni=VERSION UNI version to use (3.0,3.1,4.0) default=dynamic ++ ++Some influential environment variables: ++ CC C compiler command ++ CFLAGS C compiler flags ++ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a ++ nonstandard directory <lib dir> ++ CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have ++ headers in a nonstandard directory <include dir> ++ CPP C preprocessor ++ ++Use these variables to override the choices made by `configure' or to help ++it to find libraries and programs with nonstandard names/locations. ++ ++_ACEOF ++fi ++ ++if test "$ac_init_help" = "recursive"; then ++ # If there are subdirs, report their specific --help. ++ ac_popdir=`pwd` ++ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue ++ test -d $ac_dir || continue ++ ac_builddir=. ++ ++if test "$ac_dir" != .; then ++ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` ++ # A "../" for each directory in $ac_dir_suffix. ++ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` ++else ++ ac_dir_suffix= ac_top_builddir= ++fi ++ ++case $srcdir in ++ .) # No --srcdir option. We are building in place. ++ ac_srcdir=. ++ if test -z "$ac_top_builddir"; then ++ ac_top_srcdir=. ++ else ++ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` ++ fi ;; ++ [\\/]* | ?:[\\/]* ) # Absolute path. ++ ac_srcdir=$srcdir$ac_dir_suffix; ++ ac_top_srcdir=$srcdir ;; ++ *) # Relative path. ++ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ++ ac_top_srcdir=$ac_top_builddir$srcdir ;; ++esac ++# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be ++# absolute. ++ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ++ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ++ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ++ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` ++ ++ cd $ac_dir ++ # Check for guested configure; otherwise get Cygnus style configure. ++ if test -f $ac_srcdir/configure.gnu; then ++ echo ++ $SHELL $ac_srcdir/configure.gnu --help=recursive ++ elif test -f $ac_srcdir/configure; then ++ echo ++ $SHELL $ac_srcdir/configure --help=recursive ++ elif test -f $ac_srcdir/configure.ac || ++ test -f $ac_srcdir/configure.in; then ++ echo ++ $ac_configure --help ++ else ++ echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 ++ fi ++ cd $ac_popdir ++ done ++fi ++ ++test -n "$ac_init_help" && exit 0 ++if $ac_init_version; then ++ cat <<\_ACEOF ++ ++Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 ++Free Software Foundation, Inc. ++This configure script is free software; the Free Software Foundation ++gives unlimited permission to copy, distribute and modify it. ++_ACEOF ++ exit 0 ++fi ++exec 5>config.log ++cat >&5 <<_ACEOF ++This file contains any messages produced by compilers while ++running configure, to aid debugging if configure makes a mistake. ++ ++It was created by $as_me, which was ++generated by GNU Autoconf 2.57. Invocation command line was ++ ++ $ $0 $@ ++ ++_ACEOF ++{ ++cat <<_ASUNAME ++## --------- ## ++## Platform. ## ++## --------- ## ++ ++hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` ++uname -m = `(uname -m) 2>/dev/null || echo unknown` ++uname -r = `(uname -r) 2>/dev/null || echo unknown` ++uname -s = `(uname -s) 2>/dev/null || echo unknown` ++uname -v = `(uname -v) 2>/dev/null || echo unknown` ++ ++/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` ++/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` ++ ++/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` ++/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` ++/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` ++hostinfo = `(hostinfo) 2>/dev/null || echo unknown` ++/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` ++/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` ++/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` ++ ++_ASUNAME ++ ++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ echo "PATH: $as_dir" ++done ++ ++} >&5 ++ ++cat >&5 <<_ACEOF ++ ++ ++## ----------- ## ++## Core tests. ## ++## ----------- ## ++ ++_ACEOF ++ ++ ++# Keep a trace of the command line. ++# Strip out --no-create and --no-recursion so they do not pile up. ++# Strip out --silent because we don't want to record it for future runs. ++# Also quote any args containing shell meta-characters. ++# Make two passes to allow for proper duplicate-argument suppression. ++ac_configure_args= ++ac_configure_args0= ++ac_configure_args1= ++ac_sep= ++ac_must_keep_next=false ++for ac_pass in 1 2 ++do ++ for ac_arg ++ do ++ case $ac_arg in ++ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; ++ -q | -quiet | --quiet | --quie | --qui | --qu | --q \ ++ | -silent | --silent | --silen | --sile | --sil) ++ continue ;; ++ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ++ ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; ++ esac ++ case $ac_pass in ++ 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; ++ 2) ++ ac_configure_args1="$ac_configure_args1 '$ac_arg'" ++ if test $ac_must_keep_next = true; then ++ ac_must_keep_next=false # Got value, back to normal. ++ else ++ case $ac_arg in ++ *=* | --config-cache | -C | -disable-* | --disable-* \ ++ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ ++ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ ++ | -with-* | --with-* | -without-* | --without-* | --x) ++ case "$ac_configure_args0 " in ++ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; ++ esac ++ ;; ++ -* ) ac_must_keep_next=true ;; ++ esac ++ fi ++ ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" ++ # Get rid of the leading space. ++ ac_sep=" " ++ ;; ++ esac ++ done ++done ++$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } ++$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } ++ ++# When interrupted or exit'd, cleanup temporary files, and complete ++# config.log. We remove comments because anyway the quotes in there ++# would cause problems or look ugly. ++# WARNING: Be sure not to use single quotes in there, as some shells, ++# such as our DU 5.0 friend, will then `close' the trap. ++trap 'exit_status=$? ++ # Save into config.log some information that might help in debugging. ++ { ++ echo ++ ++ cat <<\_ASBOX ++## ---------------- ## ++## Cache variables. ## ++## ---------------- ## ++_ASBOX ++ echo ++ # The following way of writing the cache mishandles newlines in values, ++{ ++ (set) 2>&1 | ++ case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in ++ *ac_space=\ *) ++ sed -n \ ++ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; ++ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ++ ;; ++ *) ++ sed -n \ ++ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ++ ;; ++ esac; ++} ++ echo ++ ++ cat <<\_ASBOX ++## ----------------- ## ++## Output variables. ## ++## ----------------- ## ++_ASBOX ++ echo ++ for ac_var in $ac_subst_vars ++ do ++ eval ac_val=$`echo $ac_var` ++ echo "$ac_var='"'"'$ac_val'"'"'" ++ done | sort ++ echo ++ ++ if test -n "$ac_subst_files"; then ++ cat <<\_ASBOX ++## ------------- ## ++## Output files. ## ++## ------------- ## ++_ASBOX ++ echo ++ for ac_var in $ac_subst_files ++ do ++ eval ac_val=$`echo $ac_var` ++ echo "$ac_var='"'"'$ac_val'"'"'" ++ done | sort ++ echo ++ fi ++ ++ if test -s confdefs.h; then ++ cat <<\_ASBOX ++## ----------- ## ++## confdefs.h. ## ++## ----------- ## ++_ASBOX ++ echo ++ sed "/^$/d" confdefs.h | sort ++ echo ++ fi ++ test "$ac_signal" != 0 && ++ echo "$as_me: caught signal $ac_signal" ++ echo "$as_me: exit $exit_status" ++ } >&5 ++ rm -f core *.core && ++ rm -rf conftest* confdefs* conf$$* $ac_clean_files && ++ exit $exit_status ++ ' 0 ++for ac_signal in 1 2 13 15; do ++ trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal ++done ++ac_signal=0 ++ ++# confdefs.h avoids OS command line length limits that DEFS can exceed. ++rm -rf conftest* confdefs.h ++# AIX cpp loses on an empty file, so make sure it contains at least a newline. ++echo >confdefs.h ++ ++# Predefined preprocessor variables. + ++cat >>confdefs.h <<_ACEOF ++#define PACKAGE_NAME "$PACKAGE_NAME" ++_ACEOF ++ ++ ++cat >>confdefs.h <<_ACEOF ++#define PACKAGE_TARNAME "$PACKAGE_TARNAME" ++_ACEOF ++ ++ ++cat >>confdefs.h <<_ACEOF ++#define PACKAGE_VERSION "$PACKAGE_VERSION" ++_ACEOF ++ ++ ++cat >>confdefs.h <<_ACEOF ++#define PACKAGE_STRING "$PACKAGE_STRING" ++_ACEOF ++ ++ ++cat >>confdefs.h <<_ACEOF ++#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" ++_ACEOF ++ ++ ++# Let the site file select an alternate cache file if it wants to. + # Prefer explicitly selected file to automatically selected ones. + if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then +@@ -670,45 +1342,111 @@ + fi + for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then +- echo "loading site script $ac_site_file" ++ { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 ++echo "$as_me: loading site script $ac_site_file" >&6;} ++ sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + fi + done + + if test -r "$cache_file"; then +- echo "loading cache $cache_file" +- . $cache_file ++ # Some versions of bash will fail to source /dev/null (special ++ # files actually), so we avoid doing that. ++ if test -f "$cache_file"; then ++ { echo "$as_me:$LINENO: loading cache $cache_file" >&5 ++echo "$as_me: loading cache $cache_file" >&6;} ++ case $cache_file in ++ [\\/]* | ?:[\\/]* ) . $cache_file;; ++ *) . ./$cache_file;; ++ esac ++ fi + else +- echo "creating cache $cache_file" +- > $cache_file ++ { echo "$as_me:$LINENO: creating cache $cache_file" >&5 ++echo "$as_me: creating cache $cache_file" >&6;} ++ >$cache_file ++fi ++ ++# Check that the precious variables saved in the cache have kept the same ++# value. ++ac_cache_corrupted=false ++for ac_var in `(set) 2>&1 | ++ sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do ++ eval ac_old_set=\$ac_cv_env_${ac_var}_set ++ eval ac_new_set=\$ac_env_${ac_var}_set ++ eval ac_old_val="\$ac_cv_env_${ac_var}_value" ++ eval ac_new_val="\$ac_env_${ac_var}_value" ++ case $ac_old_set,$ac_new_set in ++ set,) ++ { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 ++echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ++ ac_cache_corrupted=: ;; ++ ,set) ++ { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 ++echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ++ ac_cache_corrupted=: ;; ++ ,);; ++ *) ++ if test "x$ac_old_val" != "x$ac_new_val"; then ++ { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 ++echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ++ { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 ++echo "$as_me: former value: $ac_old_val" >&2;} ++ { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 ++echo "$as_me: current value: $ac_new_val" >&2;} ++ ac_cache_corrupted=: ++ fi;; ++ esac ++ # Pass precious variables to config.status. ++ if test "$ac_new_set" = set; then ++ case $ac_new_val in ++ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ++ ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; ++ *) ac_arg=$ac_var=$ac_new_val ;; ++ esac ++ case " $ac_configure_args " in ++ *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. ++ *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; ++ esac ++ fi ++done ++if $ac_cache_corrupted; then ++ { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 ++echo "$as_me: error: changes in the environment can compromise the build" >&2;} ++ { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 ++echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} ++ { (exit 1); exit 1; }; } + fi + + ac_ext=c +-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. + ac_cpp='$CPP $CPPFLAGS' +-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +-cross_compiling=$ac_cv_prog_cc_cross +- +-ac_exeext= +-ac_objext=o +-if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then +- # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. +- if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then +- ac_n= ac_c=' +-' ac_t=' ' +- else +- ac_n=-n ac_c= ac_t= +- fi +-else +- ac_n= ac_c='\c' ac_t= +-fi ++ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ++ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ++ac_compiler_gnu=$ac_cv_c_compiler_gnu ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + + + + + + ++ ++ ++ ++ ++ ac_config_headers="$ac_config_headers config.h" ++ ++ ac_config_commands="$ac_config_commands default-1" ++ ++ + ac_aux_dir= + for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then +@@ -719,105 +1457,105 @@ + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break ++ elif test -f $ac_dir/shtool; then ++ ac_aux_dir=$ac_dir ++ ac_install_sh="$ac_aux_dir/shtool install -c" ++ break + fi + done + if test -z "$ac_aux_dir"; then +- { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } +-fi +-ac_config_guess=$ac_aux_dir/config.guess +-ac_config_sub=$ac_aux_dir/config.sub +-ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. +- +- +-# Do some error checking and defaulting for the host and target type. +-# The inputs are: +-# configure --host=HOST --target=TARGET --build=BUILD NONOPT +-# +-# The rules are: +-# 1. You are not allowed to specify --host, --target, and nonopt at the +-# same time. +-# 2. Host defaults to nonopt. +-# 3. If nonopt is not specified, then host defaults to the current host, +-# as determined by config.guess. +-# 4. Target and build default to nonopt. +-# 5. If nonopt is not specified, then target and build default to host. +- +-# The aliases save the names the user supplied, while $host etc. +-# will get canonicalized. +-case $host---$target---$nonopt in +-NONE---*---* | *---NONE---* | *---*---NONE) ;; +-*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;; +-esac +- ++ { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 ++echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} ++ { (exit 1); exit 1; }; } ++fi ++ac_config_guess="$SHELL $ac_aux_dir/config.guess" ++ac_config_sub="$SHELL $ac_aux_dir/config.sub" ++ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + + # Make sure we can run config.sub. +-if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : +-else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +-fi ++$ac_config_sub sun4 >/dev/null 2>&1 || ++ { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 ++echo "$as_me: error: cannot run $ac_config_sub" >&2;} ++ { (exit 1); exit 1; }; } ++ ++echo "$as_me:$LINENO: checking build system type" >&5 ++echo $ECHO_N "checking build system type... $ECHO_C" >&6 ++if test "${ac_cv_build+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ ac_cv_build_alias=$build_alias ++test -z "$ac_cv_build_alias" && ++ ac_cv_build_alias=`$ac_config_guess` ++test -z "$ac_cv_build_alias" && ++ { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 ++echo "$as_me: error: cannot guess build type; you must specify one" >&2;} ++ { (exit 1); exit 1; }; } ++ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || ++ { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 ++echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} ++ { (exit 1); exit 1; }; } ++ ++fi ++echo "$as_me:$LINENO: result: $ac_cv_build" >&5 ++echo "${ECHO_T}$ac_cv_build" >&6 ++build=$ac_cv_build ++build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` ++build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` ++build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` ++ ++ ++echo "$as_me:$LINENO: checking host system type" >&5 ++echo $ECHO_N "checking host system type... $ECHO_C" >&6 ++if test "${ac_cv_host+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ ac_cv_host_alias=$host_alias ++test -z "$ac_cv_host_alias" && ++ ac_cv_host_alias=$ac_cv_build_alias ++ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || ++ { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 ++echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} ++ { (exit 1); exit 1; }; } ++ ++fi ++echo "$as_me:$LINENO: result: $ac_cv_host" >&5 ++echo "${ECHO_T}$ac_cv_host" >&6 ++host=$ac_cv_host ++host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` ++host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` ++host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` ++ ++ ++echo "$as_me:$LINENO: checking target system type" >&5 ++echo $ECHO_N "checking target system type... $ECHO_C" >&6 ++if test "${ac_cv_target+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ ac_cv_target_alias=$target_alias ++test "x$ac_cv_target_alias" = "x" && ++ ac_cv_target_alias=$ac_cv_host_alias ++ac_cv_target=`$ac_config_sub $ac_cv_target_alias` || ++ { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_target_alias failed" >&5 ++echo "$as_me: error: $ac_config_sub $ac_cv_target_alias failed" >&2;} ++ { (exit 1); exit 1; }; } ++ ++fi ++echo "$as_me:$LINENO: result: $ac_cv_target" >&5 ++echo "${ECHO_T}$ac_cv_target" >&6 ++target=$ac_cv_target ++target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` ++target_vendor=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` ++target_os=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + +-echo $ac_n "checking host system type""... $ac_c" 1>&6 +-echo "configure:760: checking host system type" >&5 + +-host_alias=$host +-case "$host_alias" in +-NONE) +- case $nonopt in +- NONE) +- if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : +- else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } +- fi ;; +- *) host_alias=$nonopt ;; +- esac ;; +-esac +- +-host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` +-host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +-host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +-host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +-echo "$ac_t""$host" 1>&6 +- +-echo $ac_n "checking target system type""... $ac_c" 1>&6 +-echo "configure:781: checking target system type" >&5 +- +-target_alias=$target +-case "$target_alias" in +-NONE) +- case $nonopt in +- NONE) target_alias=$host_alias ;; +- *) target_alias=$nonopt ;; +- esac ;; +-esac +- +-target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias` +-target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +-target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +-target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +-echo "$ac_t""$target" 1>&6 +- +-echo $ac_n "checking build system type""... $ac_c" 1>&6 +-echo "configure:799: checking build system type" >&5 +- +-build_alias=$build +-case "$build_alias" in +-NONE) +- case $nonopt in +- NONE) build_alias=$host_alias ;; +- *) build_alias=$nonopt ;; +- esac ;; +-esac +- +-build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` +-build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +-build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +-build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +-echo "$ac_t""$build" 1>&6 +- +-test "$host_alias" != "$target_alias" && ++# The aliases save the names the user supplied, while $host etc. ++# will get canonicalized. ++test -n "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + +- ++am__api_version="1.4" + # Find a good install program. We prefer a C program (faster), + # so one script is as good as another. But avoid the broken or + # incompatible versions: +@@ -825,65 +1563,78 @@ + # SunOS /usr/etc/install + # IRIX /sbin/install + # AIX /bin/install ++# AmigaOS /C/install, which installs bootblocks on floppy discs + # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag + # AFS /usr/afsws/bin/install, which mishandles nonexistent args + # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" + # ./install, which can be erroneously created by make from ./install.sh. +-echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +-echo "configure:834: checking for a BSD compatible install" >&5 ++echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 ++echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 + if test -z "$INSTALL"; then +-if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 ++if test "${ac_cv_path_install+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 + else +- IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" +- for ac_dir in $PATH; do +- # Account for people who put trailing slashes in PATH elements. +- case "$ac_dir/" in +- /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; +- *) +- # OSF1 and SCO ODT 3.0 have their own names for install. +- # Don't use installbsd from OSF since it installs stuff as root +- # by default. +- for ac_prog in ginstall scoinst install; do +- if test -f $ac_dir/$ac_prog; then +- if test $ac_prog = install && +- grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then +- # AIX install. It has an incompatible calling convention. +- : +- else +- ac_cv_path_install="$ac_dir/$ac_prog -c" +- break 2 +- fi +- fi ++ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ # Account for people who put trailing slashes in PATH elements. ++case $as_dir/ in ++ ./ | .// | /cC/* | \ ++ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ++ /usr/ucb/* ) ;; ++ *) ++ # OSF1 and SCO ODT 3.0 have their own names for install. ++ # Don't use installbsd from OSF since it installs stuff as root ++ # by default. ++ for ac_prog in ginstall scoinst install; do ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then ++ if test $ac_prog = install && ++ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then ++ # AIX install. It has an incompatible calling convention. ++ : ++ elif test $ac_prog = install && ++ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then ++ # program-specific install script used by HP pwplus--don't use. ++ : ++ else ++ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" ++ break 3 ++ fi ++ fi + done +- ;; +- esac +- done +- IFS="$ac_save_IFS" ++ done ++ ;; ++esac ++done ++ + + fi + if test "${ac_cv_path_install+set}" = set; then +- INSTALL="$ac_cv_path_install" ++ INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. +- INSTALL="$ac_install_sh" ++ INSTALL=$ac_install_sh + fi + fi +-echo "$ac_t""$INSTALL" 1>&6 ++echo "$as_me:$LINENO: result: $INSTALL" >&5 ++echo "${ECHO_T}$INSTALL" >&6 + + # Use test -z because SunOS4 sh mishandles braces in ${var-val}. + # It thinks the first close brace ends the variable substitution. + test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +-test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' ++test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + + test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +-echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 +-echo "configure:887: checking whether build environment is sane" >&5 ++echo "$as_me:$LINENO: checking whether build environment is sane" >&5 ++echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 + # Just in case + sleep 1 + echo timestamp > conftestfile +@@ -905,8 +1656,11 @@ + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". +- { echo "configure: error: ls -t appears to fail. Make sure there is not a broken +-alias in your environment" 1>&2; exit 1; } ++ { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken ++alias in your environment" >&5 ++echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken ++alias in your environment" >&2;} ++ { (exit 1); exit 1; }; } + fi + + test "$2" = conftestfile +@@ -915,54 +1669,54 @@ + # Ok. + : + else +- { echo "configure: error: newly created file is older than distributed files! +-Check your system clock" 1>&2; exit 1; } ++ { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! ++Check your system clock" >&5 ++echo "$as_me: error: newly created file is older than distributed files! ++Check your system clock" >&2;} ++ { (exit 1); exit 1; }; } + fi + rm -f conftest* +-echo "$ac_t""yes" 1>&6 +-if test "$program_transform_name" = s,x,x,; then +- program_transform_name= +-else +- # Double any \ or $. echo might interpret backslashes. +- cat <<\EOF_SED > conftestsed +-s,\\,\\\\,g; s,\$,$$,g +-EOF_SED +- program_transform_name="`echo $program_transform_name|sed -f conftestsed`" +- rm -f conftestsed +-fi ++echo "$as_me:$LINENO: result: yes" >&5 ++echo "${ECHO_T}yes" >&6 + test "$program_prefix" != NONE && +- program_transform_name="s,^,${program_prefix},; $program_transform_name" ++ program_transform_name="s,^,$program_prefix,;$program_transform_name" + # Use a double $ so make ignores it. + test "$program_suffix" != NONE && +- program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" +- +-# sed with no file args requires a program. +-test "$program_transform_name" = "" && program_transform_name="s,x,x," +- +-echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +-echo "configure:944: checking whether ${MAKE-make} sets \${MAKE}" >&5 +-set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` +-if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 ++ program_transform_name="s,\$,$program_suffix,;$program_transform_name" ++# Double any \ or $. echo might interpret backslashes. ++# By default was `s,x,x', remove it if useless. ++cat <<\_ACEOF >conftest.sed ++s/[\\$]/&&/g;s/;s,x,x,$// ++_ACEOF ++program_transform_name=`echo $program_transform_name | sed -f conftest.sed` ++rm conftest.sed ++ ++echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 ++echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 ++set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` ++if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 + else +- cat > conftestmake <<\EOF ++ cat >conftest.make <<\_ACEOF + all: +- @echo 'ac_maketemp="${MAKE}"' +-EOF ++ @echo 'ac_maketemp="$(MAKE)"' ++_ACEOF + # GNU make sometimes prints "make[1]: Entering...", which would confuse us. +-eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` ++eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` + if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes + else + eval ac_cv_prog_make_${ac_make}_set=no + fi +-rm -f conftestmake ++rm -f conftest.make + fi + if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then +- echo "$ac_t""yes" 1>&6 ++ echo "$as_me:$LINENO: result: yes" >&5 ++echo "${ECHO_T}yes" >&6 + SET_MAKE= + else +- echo "$ac_t""no" 1>&6 ++ echo "$as_me:$LINENO: result: no" >&5 ++echo "${ECHO_T}no" >&6 + SET_MAKE="MAKE=${MAKE-make}" + fi + +@@ -972,82 +1726,96 @@ + VERSION=2.4.1 + + if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then +- { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } ++ { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 ++echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} ++ { (exit 1); exit 1; }; } + fi +-cat >> confdefs.h <<EOF ++ ++cat >>confdefs.h <<_ACEOF + #define PACKAGE "$PACKAGE" +-EOF ++_ACEOF + +-cat >> confdefs.h <<EOF ++ ++cat >>confdefs.h <<_ACEOF + #define VERSION "$VERSION" +-EOF ++_ACEOF + + + + missing_dir=`cd $ac_aux_dir && pwd` +-echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 +-echo "configure:990: checking for working aclocal" >&5 ++echo "$as_me:$LINENO: checking for working aclocal-${am__api_version}" >&5 ++echo $ECHO_N "checking for working aclocal-${am__api_version}... $ECHO_C" >&6 + # Run test in a subshell; some versions of sh will print an error if + # an executable is not found, even if stderr is redirected. + # Redirect stdin to placate older versions of autoconf. Sigh. +-if (aclocal --version) < /dev/null > /dev/null 2>&1; then +- ACLOCAL=aclocal +- echo "$ac_t""found" 1>&6 +-else +- ACLOCAL="$missing_dir/missing aclocal" +- echo "$ac_t""missing" 1>&6 ++if (aclocal-${am__api_version} --version) < /dev/null > /dev/null 2>&1; then ++ ACLOCAL=aclocal-${am__api_version} ++ echo "$as_me:$LINENO: result: found" >&5 ++echo "${ECHO_T}found" >&6 ++else ++ ACLOCAL="$missing_dir/missing aclocal-${am__api_version}" ++ echo "$as_me:$LINENO: result: missing" >&5 ++echo "${ECHO_T}missing" >&6 + fi + +-echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 +-echo "configure:1003: checking for working autoconf" >&5 ++echo "$as_me:$LINENO: checking for working autoconf" >&5 ++echo $ECHO_N "checking for working autoconf... $ECHO_C" >&6 + # Run test in a subshell; some versions of sh will print an error if + # an executable is not found, even if stderr is redirected. + # Redirect stdin to placate older versions of autoconf. Sigh. + if (autoconf --version) < /dev/null > /dev/null 2>&1; then + AUTOCONF=autoconf +- echo "$ac_t""found" 1>&6 ++ echo "$as_me:$LINENO: result: found" >&5 ++echo "${ECHO_T}found" >&6 + else + AUTOCONF="$missing_dir/missing autoconf" +- echo "$ac_t""missing" 1>&6 ++ echo "$as_me:$LINENO: result: missing" >&5 ++echo "${ECHO_T}missing" >&6 + fi + +-echo $ac_n "checking for working automake""... $ac_c" 1>&6 +-echo "configure:1016: checking for working automake" >&5 ++echo "$as_me:$LINENO: checking for working automake-${am__api_version}" >&5 ++echo $ECHO_N "checking for working automake-${am__api_version}... $ECHO_C" >&6 + # Run test in a subshell; some versions of sh will print an error if + # an executable is not found, even if stderr is redirected. + # Redirect stdin to placate older versions of autoconf. Sigh. +-if (automake --version) < /dev/null > /dev/null 2>&1; then +- AUTOMAKE=automake +- echo "$ac_t""found" 1>&6 +-else +- AUTOMAKE="$missing_dir/missing automake" +- echo "$ac_t""missing" 1>&6 ++if (automake-${am__api_version} --version) < /dev/null > /dev/null 2>&1; then ++ AUTOMAKE=automake-${am__api_version} ++ echo "$as_me:$LINENO: result: found" >&5 ++echo "${ECHO_T}found" >&6 ++else ++ AUTOMAKE="$missing_dir/missing automake-${am__api_version}" ++ echo "$as_me:$LINENO: result: missing" >&5 ++echo "${ECHO_T}missing" >&6 + fi + +-echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 +-echo "configure:1029: checking for working autoheader" >&5 ++echo "$as_me:$LINENO: checking for working autoheader" >&5 ++echo $ECHO_N "checking for working autoheader... $ECHO_C" >&6 + # Run test in a subshell; some versions of sh will print an error if + # an executable is not found, even if stderr is redirected. + # Redirect stdin to placate older versions of autoconf. Sigh. + if (autoheader --version) < /dev/null > /dev/null 2>&1; then + AUTOHEADER=autoheader +- echo "$ac_t""found" 1>&6 ++ echo "$as_me:$LINENO: result: found" >&5 ++echo "${ECHO_T}found" >&6 + else + AUTOHEADER="$missing_dir/missing autoheader" +- echo "$ac_t""missing" 1>&6 ++ echo "$as_me:$LINENO: result: missing" >&5 ++echo "${ECHO_T}missing" >&6 + fi + +-echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 +-echo "configure:1042: checking for working makeinfo" >&5 ++echo "$as_me:$LINENO: checking for working makeinfo" >&5 ++echo $ECHO_N "checking for working makeinfo... $ECHO_C" >&6 + # Run test in a subshell; some versions of sh will print an error if + # an executable is not found, even if stderr is redirected. + # Redirect stdin to placate older versions of autoconf. Sigh. + if (makeinfo --version) < /dev/null > /dev/null 2>&1; then + MAKEINFO=makeinfo +- echo "$ac_t""found" 1>&6 ++ echo "$as_me:$LINENO: result: found" >&5 ++echo "${ECHO_T}found" >&6 + else + MAKEINFO="$missing_dir/missing makeinfo" +- echo "$ac_t""missing" 1>&6 ++ echo "$as_me:$LINENO: result: missing" >&5 ++echo "${ECHO_T}missing" >&6 + fi + + +@@ -1059,214 +1827,643 @@ + + + +-# Extract the first word of "gcc", so it can be a program name with args. ++ac_ext=c ++ac_cpp='$CPP $CPPFLAGS' ++ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ++ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ++ac_compiler_gnu=$ac_cv_c_compiler_gnu ++if test -n "$ac_tool_prefix"; then ++ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. ++set dummy ${ac_tool_prefix}gcc; ac_word=$2 ++echo "$as_me:$LINENO: checking for $ac_word" >&5 ++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 ++if test "${ac_cv_prog_CC+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ if test -n "$CC"; then ++ ac_cv_prog_CC="$CC" # Let the user override the test. ++else ++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ ac_cv_prog_CC="${ac_tool_prefix}gcc" ++ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++done ++ ++fi ++fi ++CC=$ac_cv_prog_CC ++if test -n "$CC"; then ++ echo "$as_me:$LINENO: result: $CC" >&5 ++echo "${ECHO_T}$CC" >&6 ++else ++ echo "$as_me:$LINENO: result: no" >&5 ++echo "${ECHO_T}no" >&6 ++fi ++ ++fi ++if test -z "$ac_cv_prog_CC"; then ++ ac_ct_CC=$CC ++ # Extract the first word of "gcc", so it can be a program name with args. + set dummy gcc; ac_word=$2 +-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +-echo "configure:1066: checking for $ac_word" >&5 +-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 ++echo "$as_me:$LINENO: checking for $ac_word" >&5 ++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 ++if test "${ac_cv_prog_ac_ct_CC+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ if test -n "$ac_ct_CC"; then ++ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. ++else ++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ ac_cv_prog_ac_ct_CC="gcc" ++ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++done ++ ++fi ++fi ++ac_ct_CC=$ac_cv_prog_ac_ct_CC ++if test -n "$ac_ct_CC"; then ++ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 ++echo "${ECHO_T}$ac_ct_CC" >&6 ++else ++ echo "$as_me:$LINENO: result: no" >&5 ++echo "${ECHO_T}no" >&6 ++fi ++ ++ CC=$ac_ct_CC ++else ++ CC="$ac_cv_prog_CC" ++fi ++ ++if test -z "$CC"; then ++ if test -n "$ac_tool_prefix"; then ++ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. ++set dummy ${ac_tool_prefix}cc; ac_word=$2 ++echo "$as_me:$LINENO: checking for $ac_word" >&5 ++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 ++if test "${ac_cv_prog_CC+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 + else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. + else +- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" +- ac_dummy="$PATH" +- for ac_dir in $ac_dummy; do +- test -z "$ac_dir" && ac_dir=. +- if test -f $ac_dir/$ac_word; then +- ac_cv_prog_CC="gcc" +- break +- fi +- done +- IFS="$ac_save_ifs" ++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ ac_cv_prog_CC="${ac_tool_prefix}cc" ++ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++done ++ + fi + fi +-CC="$ac_cv_prog_CC" ++CC=$ac_cv_prog_CC + if test -n "$CC"; then +- echo "$ac_t""$CC" 1>&6 ++ echo "$as_me:$LINENO: result: $CC" >&5 ++echo "${ECHO_T}$CC" >&6 ++else ++ echo "$as_me:$LINENO: result: no" >&5 ++echo "${ECHO_T}no" >&6 ++fi ++ ++fi ++if test -z "$ac_cv_prog_CC"; then ++ ac_ct_CC=$CC ++ # Extract the first word of "cc", so it can be a program name with args. ++set dummy cc; ac_word=$2 ++echo "$as_me:$LINENO: checking for $ac_word" >&5 ++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 ++if test "${ac_cv_prog_ac_ct_CC+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ if test -n "$ac_ct_CC"; then ++ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. ++else ++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ ac_cv_prog_ac_ct_CC="cc" ++ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++done ++ ++fi ++fi ++ac_ct_CC=$ac_cv_prog_ac_ct_CC ++if test -n "$ac_ct_CC"; then ++ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 ++echo "${ECHO_T}$ac_ct_CC" >&6 + else +- echo "$ac_t""no" 1>&6 ++ echo "$as_me:$LINENO: result: no" >&5 ++echo "${ECHO_T}no" >&6 + fi + ++ CC=$ac_ct_CC ++else ++ CC="$ac_cv_prog_CC" ++fi ++ ++fi + if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. + set dummy cc; ac_word=$2 +-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +-echo "configure:1096: checking for $ac_word" >&5 +-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 ++echo "$as_me:$LINENO: checking for $ac_word" >&5 ++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 ++if test "${ac_cv_prog_CC+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 + else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. + else +- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no +- ac_dummy="$PATH" +- for ac_dir in $ac_dummy; do +- test -z "$ac_dir" && ac_dir=. +- if test -f $ac_dir/$ac_word; then +- if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then +- ac_prog_rejected=yes +- continue +- fi +- ac_cv_prog_CC="cc" +- break +- fi +- done +- IFS="$ac_save_ifs" ++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ++ ac_prog_rejected=yes ++ continue ++ fi ++ ac_cv_prog_CC="cc" ++ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++done ++ + if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift +- if test $# -gt 0; then ++ if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift +- set dummy "$ac_dir/$ac_word" "$@" +- shift +- ac_cv_prog_CC="$@" ++ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi + fi + fi + fi +-CC="$ac_cv_prog_CC" ++CC=$ac_cv_prog_CC + if test -n "$CC"; then +- echo "$ac_t""$CC" 1>&6 ++ echo "$as_me:$LINENO: result: $CC" >&5 ++echo "${ECHO_T}$CC" >&6 + else +- echo "$ac_t""no" 1>&6 ++ echo "$as_me:$LINENO: result: no" >&5 ++echo "${ECHO_T}no" >&6 + fi + +- if test -z "$CC"; then +- case "`uname -s`" in +- *win32* | *WIN32*) +- # Extract the first word of "cl", so it can be a program name with args. +-set dummy cl; ac_word=$2 +-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +-echo "configure:1147: checking for $ac_word" >&5 +-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 ++fi ++if test -z "$CC"; then ++ if test -n "$ac_tool_prefix"; then ++ for ac_prog in cl ++ do ++ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. ++set dummy $ac_tool_prefix$ac_prog; ac_word=$2 ++echo "$as_me:$LINENO: checking for $ac_word" >&5 ++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 ++if test "${ac_cv_prog_CC+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 + else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. + else +- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" +- ac_dummy="$PATH" +- for ac_dir in $ac_dummy; do +- test -z "$ac_dir" && ac_dir=. +- if test -f $ac_dir/$ac_word; then +- ac_cv_prog_CC="cl" +- break +- fi +- done +- IFS="$ac_save_ifs" ++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ ac_cv_prog_CC="$ac_tool_prefix$ac_prog" ++ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++done ++ + fi + fi +-CC="$ac_cv_prog_CC" ++CC=$ac_cv_prog_CC + if test -n "$CC"; then +- echo "$ac_t""$CC" 1>&6 ++ echo "$as_me:$LINENO: result: $CC" >&5 ++echo "${ECHO_T}$CC" >&6 + else +- echo "$ac_t""no" 1>&6 ++ echo "$as_me:$LINENO: result: no" >&5 ++echo "${ECHO_T}no" >&6 + fi +- ;; +- esac ++ ++ test -n "$CC" && break ++ done ++fi ++if test -z "$CC"; then ++ ac_ct_CC=$CC ++ for ac_prog in cl ++do ++ # Extract the first word of "$ac_prog", so it can be a program name with args. ++set dummy $ac_prog; ac_word=$2 ++echo "$as_me:$LINENO: checking for $ac_word" >&5 ++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 ++if test "${ac_cv_prog_ac_ct_CC+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ if test -n "$ac_ct_CC"; then ++ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. ++else ++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ ac_cv_prog_ac_ct_CC="$ac_prog" ++ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 + fi +- test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } ++done ++done ++ + fi ++fi ++ac_ct_CC=$ac_cv_prog_ac_ct_CC ++if test -n "$ac_ct_CC"; then ++ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 ++echo "${ECHO_T}$ac_ct_CC" >&6 ++else ++ echo "$as_me:$LINENO: result: no" >&5 ++echo "${ECHO_T}no" >&6 ++fi ++ ++ test -n "$ac_ct_CC" && break ++done + +-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +-echo "configure:1179: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ++ CC=$ac_ct_CC ++fi + +-ac_ext=c +-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +-ac_cpp='$CPP $CPPFLAGS' +-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +-cross_compiling=$ac_cv_prog_cc_cross ++fi + +-cat > conftest.$ac_ext << EOF + +-#line 1190 "configure" +-#include "confdefs.h" ++test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH ++See \`config.log' for more details." >&5 ++echo "$as_me: error: no acceptable C compiler found in \$PATH ++See \`config.log' for more details." >&2;} ++ { (exit 1); exit 1; }; } ++ ++# Provide some information about the compiler. ++echo "$as_me:$LINENO:" \ ++ "checking for C compiler version" >&5 ++ac_compiler=`set X $ac_compile; echo $2` ++{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5 ++ (eval $ac_compiler --version </dev/null >&5) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } ++{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5 ++ (eval $ac_compiler -v </dev/null >&5) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } ++{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5 ++ (eval $ac_compiler -V </dev/null >&5) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } ++ ++cat >conftest.$ac_ext <<_ACEOF ++#line $LINENO "configure" ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ + +-main(){return(0);} +-EOF +-if { (eval echo configure:1195: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +- ac_cv_prog_cc_works=yes +- # If we can't run a trivial program, we are probably using a cross compiler. +- if (./conftest; exit) 2>/dev/null; then +- ac_cv_prog_cc_cross=no +- else +- ac_cv_prog_cc_cross=yes +- fi ++int ++main () ++{ ++ ++ ; ++ return 0; ++} ++_ACEOF ++ac_clean_files_save=$ac_clean_files ++ac_clean_files="$ac_clean_files a.out a.exe b.out" ++# Try to create an executable without -o first, disregard a.out. ++# It will help us diagnose broken compilers, and finding out an intuition ++# of exeext. ++echo "$as_me:$LINENO: checking for C compiler default output" >&5 ++echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 ++ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` ++if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 ++ (eval $ac_link_default) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; then ++ # Find the output, starting from the most likely. This scheme is ++# not robust to junk in `.', hence go to wildcards (a.*) only as a last ++# resort. ++ ++# Be careful to initialize this variable, since it used to be cached. ++# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. ++ac_cv_exeext= ++# b.out is created by i960 compilers. ++for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out ++do ++ test -f "$ac_file" || continue ++ case $ac_file in ++ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ++ ;; ++ conftest.$ac_ext ) ++ # This is the source file. ++ ;; ++ [ab].out ) ++ # We found the default executable, but exeext='' is most ++ # certainly right. ++ break;; ++ *.* ) ++ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` ++ # FIXME: I believe we export ac_cv_exeext for Libtool, ++ # but it would be cool to find out if it's true. Does anybody ++ # maintain Libtool? --akim. ++ export ac_cv_exeext ++ break;; ++ * ) ++ break;; ++ esac ++done + else +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 +- ac_cv_prog_cc_works=no ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++{ { echo "$as_me:$LINENO: error: C compiler cannot create executables ++See \`config.log' for more details." >&5 ++echo "$as_me: error: C compiler cannot create executables ++See \`config.log' for more details." >&2;} ++ { (exit 77); exit 77; }; } ++fi ++ ++ac_exeext=$ac_cv_exeext ++echo "$as_me:$LINENO: result: $ac_file" >&5 ++echo "${ECHO_T}$ac_file" >&6 ++ ++# Check the compiler produces executables we can run. If not, either ++# the compiler is broken, or we cross compile. ++echo "$as_me:$LINENO: checking whether the C compiler works" >&5 ++echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 ++# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 ++# If not cross compiling, check that we can run a simple program. ++if test "$cross_compiling" != yes; then ++ if { ac_try='./$ac_file' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ cross_compiling=no ++ else ++ if test "$cross_compiling" = maybe; then ++ cross_compiling=yes ++ else ++ { { echo "$as_me:$LINENO: error: cannot run C compiled programs. ++If you meant to cross compile, use \`--host'. ++See \`config.log' for more details." >&5 ++echo "$as_me: error: cannot run C compiled programs. ++If you meant to cross compile, use \`--host'. ++See \`config.log' for more details." >&2;} ++ { (exit 1); exit 1; }; } ++ fi ++ fi + fi +-rm -fr conftest* +-ac_ext=c +-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +-ac_cpp='$CPP $CPPFLAGS' +-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +-cross_compiling=$ac_cv_prog_cc_cross +- +-echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +-if test $ac_cv_prog_cc_works = no; then +- { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } +-fi +-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +-echo "configure:1221: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +-echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 +-cross_compiling=$ac_cv_prog_cc_cross +- +-echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +-echo "configure:1226: checking whether we are using GNU C" >&5 +-if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 +-else +- cat > conftest.c <<EOF +-#ifdef __GNUC__ +- yes; +-#endif +-EOF +-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1235: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +- ac_cv_prog_gcc=yes ++echo "$as_me:$LINENO: result: yes" >&5 ++echo "${ECHO_T}yes" >&6 ++ ++rm -f a.out a.exe conftest$ac_cv_exeext b.out ++ac_clean_files=$ac_clean_files_save ++# Check the compiler produces executables we can run. If not, either ++# the compiler is broken, or we cross compile. ++echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 ++echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 ++echo "$as_me:$LINENO: result: $cross_compiling" >&5 ++echo "${ECHO_T}$cross_compiling" >&6 ++ ++echo "$as_me:$LINENO: checking for suffix of executables" >&5 ++echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 ++if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ++ (eval $ac_link) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; then ++ # If both `conftest.exe' and `conftest' are `present' (well, observable) ++# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will ++# work properly (i.e., refer to `conftest.exe'), while it won't with ++# `rm'. ++for ac_file in conftest.exe conftest conftest.*; do ++ test -f "$ac_file" || continue ++ case $ac_file in ++ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; ++ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` ++ export ac_cv_exeext ++ break;; ++ * ) break;; ++ esac ++done + else +- ac_cv_prog_gcc=no +-fi ++ { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link ++See \`config.log' for more details." >&5 ++echo "$as_me: error: cannot compute suffix of executables: cannot compile and link ++See \`config.log' for more details." >&2;} ++ { (exit 1); exit 1; }; } + fi + +-echo "$ac_t""$ac_cv_prog_gcc" 1>&6 ++rm -f conftest$ac_cv_exeext ++echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 ++echo "${ECHO_T}$ac_cv_exeext" >&6 ++ ++rm -f conftest.$ac_ext ++EXEEXT=$ac_cv_exeext ++ac_exeext=$EXEEXT ++echo "$as_me:$LINENO: checking for suffix of object files" >&5 ++echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 ++if test "${ac_cv_objext+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ cat >conftest.$ac_ext <<_ACEOF ++#line $LINENO "configure" ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++ ++int ++main () ++{ + +-if test $ac_cv_prog_gcc = yes; then +- GCC=yes ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.o conftest.obj ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; then ++ for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do ++ case $ac_file in ++ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; ++ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` ++ break;; ++ esac ++done + else +- GCC= ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile ++See \`config.log' for more details." >&5 ++echo "$as_me: error: cannot compute suffix of object files: cannot compile ++See \`config.log' for more details." >&2;} ++ { (exit 1); exit 1; }; } + fi + +-ac_test_CFLAGS="${CFLAGS+set}" +-ac_save_CFLAGS="$CFLAGS" +-CFLAGS= +-echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +-echo "configure:1254: checking whether ${CC-cc} accepts -g" >&5 +-if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 +-else +- echo 'void f(){}' > conftest.c +-if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then ++rm -f conftest.$ac_cv_objext conftest.$ac_ext ++fi ++echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 ++echo "${ECHO_T}$ac_cv_objext" >&6 ++OBJEXT=$ac_cv_objext ++ac_objext=$OBJEXT ++echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 ++echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 ++if test "${ac_cv_c_compiler_gnu+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ cat >conftest.$ac_ext <<_ACEOF ++#line $LINENO "configure" ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++ ++int ++main () ++{ ++#ifndef __GNUC__ ++ choke me ++#endif ++ ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_compiler_gnu=yes ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ac_compiler_gnu=no ++fi ++rm -f conftest.$ac_objext conftest.$ac_ext ++ac_cv_c_compiler_gnu=$ac_compiler_gnu ++ ++fi ++echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 ++echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 ++GCC=`test $ac_compiler_gnu = yes && echo yes` ++ac_test_CFLAGS=${CFLAGS+set} ++ac_save_CFLAGS=$CFLAGS ++CFLAGS="-g" ++echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 ++echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 ++if test "${ac_cv_prog_cc_g+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ cat >conftest.$ac_ext <<_ACEOF ++#line $LINENO "configure" ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++ ++int ++main () ++{ ++ ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes + else +- ac_cv_prog_cc_g=no +-fi +-rm -f conftest* ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 + ++ac_cv_prog_cc_g=no + fi +- +-echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 ++rm -f conftest.$ac_objext conftest.$ac_ext ++fi ++echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 ++echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 + if test "$ac_test_CFLAGS" = set; then +- CFLAGS="$ac_save_CFLAGS" ++ CFLAGS=$ac_save_CFLAGS + elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" +@@ -1280,295 +2477,548 @@ + CFLAGS= + fi + fi ++echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 ++echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 ++if test "${ac_cv_prog_cc_stdc+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ ac_cv_prog_cc_stdc=no ++ac_save_CC=$CC ++cat >conftest.$ac_ext <<_ACEOF ++#line $LINENO "configure" ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++#include <stdarg.h> ++#include <stdio.h> ++#include <sys/types.h> ++#include <sys/stat.h> ++/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ ++struct buf { int x; }; ++FILE * (*rcsopen) (struct buf *, struct stat *, int); ++static char *e (p, i) ++ char **p; ++ int i; ++{ ++ return p[i]; ++} ++static char *f (char * (*g) (char **, int), char **p, ...) ++{ ++ char *s; ++ va_list v; ++ va_start (v,p); ++ s = g (p, va_arg (v,int)); ++ va_end (v); ++ return s; ++} ++int test (int i, double x); ++struct s1 {int (*f) (int a);}; ++struct s2 {int (*f) (double a);}; ++int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); ++int argc; ++char **argv; ++int ++main () ++{ ++return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ++ ; ++ return 0; ++} ++_ACEOF ++# Don't try gcc -ansi; that turns off useful extensions and ++# breaks some systems' header files. ++# AIX -qlanglvl=ansi ++# Ultrix and OSF/1 -std1 ++# HP-UX 10.20 and later -Ae ++# HP-UX older versions -Aa -D_HPUX_SOURCE ++# SVR4 -Xc -D__EXTENSIONS__ ++for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" ++do ++ CC="$ac_save_CC $ac_arg" ++ rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_cv_prog_cc_stdc=$ac_arg ++break ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++fi ++rm -f conftest.$ac_objext ++done ++rm -f conftest.$ac_ext conftest.$ac_objext ++CC=$ac_save_CC + +-echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +-echo "configure:1286: checking how to run the C preprocessor" >&5 +-# On Suns, sometimes $CPP names a directory. +-if test -n "$CPP" && test -d "$CPP"; then +- CPP= + fi +-if test -z "$CPP"; then +-if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 +-else +- # This must be in double quotes, not single quotes, because CPP may get +- # substituted into the Makefile and "${CC-cc}" will confuse make. +- CPP="${CC-cc} -E" +- # On the NeXT, cc -E runs the code through the compiler's parser, +- # not just through cpp. +- cat > conftest.$ac_ext <<EOF +-#line 1301 "configure" +-#include "confdefs.h" +-#include <assert.h> +-Syntax Error +-EOF +-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +-{ (eval echo configure:1307: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +-if test -z "$ac_err"; then +- : +-else +- echo "$ac_err" >&5 +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 +- rm -rf conftest* +- CPP="${CC-cc} -E -traditional-cpp" +- cat > conftest.$ac_ext <<EOF +-#line 1318 "configure" +-#include "confdefs.h" +-#include <assert.h> +-Syntax Error +-EOF +-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +-{ (eval echo configure:1324: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +-if test -z "$ac_err"; then +- : +-else +- echo "$ac_err" >&5 +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 +- rm -rf conftest* +- CPP="${CC-cc} -nologo -E" +- cat > conftest.$ac_ext <<EOF +-#line 1335 "configure" +-#include "confdefs.h" +-#include <assert.h> +-Syntax Error +-EOF +-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +-{ (eval echo configure:1341: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +-if test -z "$ac_err"; then ++ ++case "x$ac_cv_prog_cc_stdc" in ++ x|xno) ++ echo "$as_me:$LINENO: result: none needed" >&5 ++echo "${ECHO_T}none needed" >&6 ;; ++ *) ++ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 ++echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 ++ CC="$CC $ac_cv_prog_cc_stdc" ;; ++esac ++ ++# Some people use a C++ compiler to compile C. Since we use `exit', ++# in C++ we need to declare it. In case someone uses the same compiler ++# for both compiling C and C++ we need to have the C++ compiler decide ++# the declaration of exit, since it's the most demanding environment. ++cat >conftest.$ac_ext <<_ACEOF ++#ifndef __cplusplus ++ choke me ++#endif ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ for ac_declaration in \ ++ '' \ ++ 'extern "C" void std::exit (int) throw (); using std::exit;' \ ++ 'extern "C" void std::exit (int); using std::exit;' \ ++ 'extern "C" void exit (int) throw ();' \ ++ 'extern "C" void exit (int);' \ ++ 'void exit (int);' ++do ++ cat >conftest.$ac_ext <<_ACEOF ++#line $LINENO "configure" ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++$ac_declaration ++#include <stdlib.h> ++int ++main () ++{ ++exit (42); ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then + : + else +- echo "$ac_err" >&5 +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 +- rm -rf conftest* +- CPP=/lib/cpp +-fi +-rm -f conftest* ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++continue + fi +-rm -f conftest* ++rm -f conftest.$ac_objext conftest.$ac_ext ++ cat >conftest.$ac_ext <<_ACEOF ++#line $LINENO "configure" ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++$ac_declaration ++int ++main () ++{ ++exit (42); ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ break ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ + fi ++rm -f conftest.$ac_objext conftest.$ac_ext ++done + rm -f conftest* +- ac_cv_prog_CPP="$CPP" ++if test -n "$ac_declaration"; then ++ echo '#ifdef __cplusplus' >>confdefs.h ++ echo $ac_declaration >>confdefs.h ++ echo '#endif' >>confdefs.h + fi +- CPP="$ac_cv_prog_CPP" ++ + else +- ac_cv_prog_CPP="$CPP" ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ + fi +-echo "$ac_t""$CPP" 1>&6 ++rm -f conftest.$ac_objext conftest.$ac_ext ++ac_ext=c ++ac_cpp='$CPP $CPPFLAGS' ++ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ++ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ++ac_compiler_gnu=$ac_cv_c_compiler_gnu ++ + + missing_dir=`cd $ac_aux_dir && pwd` + for ac_prog in flex lex + do +-# Extract the first word of "$ac_prog", so it can be a program name with args. ++ # Extract the first word of "$ac_prog", so it can be a program name with args. + set dummy $ac_prog; ac_word=$2 +-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +-echo "configure:1371: checking for $ac_word" >&5 +-if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 ++echo "$as_me:$LINENO: checking for $ac_word" >&5 ++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 ++if test "${ac_cv_prog_LEX+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 + else + if test -n "$LEX"; then + ac_cv_prog_LEX="$LEX" # Let the user override the test. + else +- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" +- ac_dummy="$PATH" +- for ac_dir in $ac_dummy; do +- test -z "$ac_dir" && ac_dir=. +- if test -f $ac_dir/$ac_word; then +- ac_cv_prog_LEX="$ac_prog" +- break +- fi +- done +- IFS="$ac_save_ifs" ++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ ac_cv_prog_LEX="$ac_prog" ++ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++done ++ + fi + fi +-LEX="$ac_cv_prog_LEX" ++LEX=$ac_cv_prog_LEX + if test -n "$LEX"; then +- echo "$ac_t""$LEX" 1>&6 ++ echo "$as_me:$LINENO: result: $LEX" >&5 ++echo "${ECHO_T}$LEX" >&6 + else +- echo "$ac_t""no" 1>&6 ++ echo "$as_me:$LINENO: result: no" >&5 ++echo "${ECHO_T}no" >&6 + fi + +-test -n "$LEX" && break ++ test -n "$LEX" && break + done +-test -n "$LEX" || LEX=""$missing_dir/missing flex"" ++test -n "$LEX" || LEX="$missing_dir/missing flex" + +-# Extract the first word of "flex", so it can be a program name with args. +-set dummy flex; ac_word=$2 +-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +-echo "configure:1404: checking for $ac_word" >&5 +-if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 ++for ac_prog in flex lex ++do ++ # Extract the first word of "$ac_prog", so it can be a program name with args. ++set dummy $ac_prog; ac_word=$2 ++echo "$as_me:$LINENO: checking for $ac_word" >&5 ++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 ++if test "${ac_cv_prog_LEX+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 + else + if test -n "$LEX"; then + ac_cv_prog_LEX="$LEX" # Let the user override the test. + else +- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" +- ac_dummy="$PATH" +- for ac_dir in $ac_dummy; do +- test -z "$ac_dir" && ac_dir=. +- if test -f $ac_dir/$ac_word; then +- ac_cv_prog_LEX="flex" +- break +- fi +- done +- IFS="$ac_save_ifs" +- test -z "$ac_cv_prog_LEX" && ac_cv_prog_LEX="lex" ++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ ac_cv_prog_LEX="$ac_prog" ++ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++done ++ + fi + fi +-LEX="$ac_cv_prog_LEX" ++LEX=$ac_cv_prog_LEX + if test -n "$LEX"; then +- echo "$ac_t""$LEX" 1>&6 ++ echo "$as_me:$LINENO: result: $LEX" >&5 ++echo "${ECHO_T}$LEX" >&6 + else +- echo "$ac_t""no" 1>&6 ++ echo "$as_me:$LINENO: result: no" >&5 ++echo "${ECHO_T}no" >&6 + fi + ++ test -n "$LEX" && break ++done ++test -n "$LEX" || LEX=":" ++ + if test -z "$LEXLIB" + then +- case "$LEX" in +- flex*) ac_lib=fl ;; +- *) ac_lib=l ;; +- esac +- echo $ac_n "checking for yywrap in -l$ac_lib""... $ac_c" 1>&6 +-echo "configure:1438: checking for yywrap in -l$ac_lib" >&5 +-ac_lib_var=`echo $ac_lib'_'yywrap | sed 'y%./+-%__p_%'` +-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 +-else +- ac_save_LIBS="$LIBS" +-LIBS="-l$ac_lib $LIBS" +-cat > conftest.$ac_ext <<EOF +-#line 1446 "configure" +-#include "confdefs.h" ++ echo "$as_me:$LINENO: checking for yywrap in -lfl" >&5 ++echo $ECHO_N "checking for yywrap in -lfl... $ECHO_C" >&6 ++if test "${ac_cv_lib_fl_yywrap+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ ac_check_lib_save_LIBS=$LIBS ++LIBS="-lfl $LIBS" ++cat >conftest.$ac_ext <<_ACEOF ++#line $LINENO "configure" ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++ + /* Override any gcc2 internal prototype to avoid an error. */ ++#ifdef __cplusplus ++extern "C" ++#endif + /* We use char because int might match the return type of a gcc2 +- builtin and then its argument prototype would still apply. */ +-char yywrap(); ++ builtin and then its argument prototype would still apply. */ ++char yywrap (); ++int ++main () ++{ ++yywrap (); ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext conftest$ac_exeext ++if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ++ (eval $ac_link) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -s conftest$ac_exeext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_cv_lib_fl_yywrap=yes ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ac_cv_lib_fl_yywrap=no ++fi ++rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext ++LIBS=$ac_check_lib_save_LIBS ++fi ++echo "$as_me:$LINENO: result: $ac_cv_lib_fl_yywrap" >&5 ++echo "${ECHO_T}$ac_cv_lib_fl_yywrap" >&6 ++if test $ac_cv_lib_fl_yywrap = yes; then ++ LEXLIB="-lfl" ++else ++ echo "$as_me:$LINENO: checking for yywrap in -ll" >&5 ++echo $ECHO_N "checking for yywrap in -ll... $ECHO_C" >&6 ++if test "${ac_cv_lib_l_yywrap+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ ac_check_lib_save_LIBS=$LIBS ++LIBS="-ll $LIBS" ++cat >conftest.$ac_ext <<_ACEOF ++#line $LINENO "configure" ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ + +-int main() { +-yywrap() +-; return 0; } +-EOF +-if { (eval echo configure:1457: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +- rm -rf conftest* +- eval "ac_cv_lib_$ac_lib_var=yes" ++/* Override any gcc2 internal prototype to avoid an error. */ ++#ifdef __cplusplus ++extern "C" ++#endif ++/* We use char because int might match the return type of a gcc2 ++ builtin and then its argument prototype would still apply. */ ++char yywrap (); ++int ++main () ++{ ++yywrap (); ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext conftest$ac_exeext ++if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ++ (eval $ac_link) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -s conftest$ac_exeext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_cv_lib_l_yywrap=yes + else +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 +- rm -rf conftest* +- eval "ac_cv_lib_$ac_lib_var=no" +-fi +-rm -f conftest* +-LIBS="$ac_save_LIBS" ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 + ++ac_cv_lib_l_yywrap=no + fi +-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then +- echo "$ac_t""yes" 1>&6 +- LEXLIB="-l$ac_lib" +-else +- echo "$ac_t""no" 1>&6 ++rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext ++LIBS=$ac_check_lib_save_LIBS ++fi ++echo "$as_me:$LINENO: result: $ac_cv_lib_l_yywrap" >&5 ++echo "${ECHO_T}$ac_cv_lib_l_yywrap" >&6 ++if test $ac_cv_lib_l_yywrap = yes; then ++ LEXLIB="-ll" ++fi ++ + fi + + fi + +-echo $ac_n "checking lex output file root""... $ac_c" 1>&6 +-echo "configure:1480: checking lex output file root" >&5 +-if eval "test \"`echo '$''{'ac_cv_prog_lex_root'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 ++if test "x$LEX" != "x:"; then ++ echo "$as_me:$LINENO: checking lex output file root" >&5 ++echo $ECHO_N "checking lex output file root... $ECHO_C" >&6 ++if test "${ac_cv_prog_lex_root+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 + else + # The minimal lex program is just a single line: %%. But some broken lexes + # (Solaris, I think it was) want two %% lines, so accommodate them. +-echo '%% +-%%' | $LEX ++cat >conftest.l <<_ACEOF ++%% ++%% ++_ACEOF ++{ (eval echo "$as_me:$LINENO: \"$LEX conftest.l\"") >&5 ++ (eval $LEX conftest.l) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } + if test -f lex.yy.c; then + ac_cv_prog_lex_root=lex.yy + elif test -f lexyy.c; then + ac_cv_prog_lex_root=lexyy + else +- { echo "configure: error: cannot find output from $LEX; giving up" 1>&2; exit 1; } ++ { { echo "$as_me:$LINENO: error: cannot find output from $LEX; giving up" >&5 ++echo "$as_me: error: cannot find output from $LEX; giving up" >&2;} ++ { (exit 1); exit 1; }; } + fi + fi +- +-echo "$ac_t""$ac_cv_prog_lex_root" 1>&6 ++echo "$as_me:$LINENO: result: $ac_cv_prog_lex_root" >&5 ++echo "${ECHO_T}$ac_cv_prog_lex_root" >&6 ++rm -f conftest.l + LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root + +-echo $ac_n "checking whether yytext is a pointer""... $ac_c" 1>&6 +-echo "configure:1501: checking whether yytext is a pointer" >&5 +-if eval "test \"`echo '$''{'ac_cv_prog_lex_yytext_pointer'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 ++echo "$as_me:$LINENO: checking whether yytext is a pointer" >&5 ++echo $ECHO_N "checking whether yytext is a pointer... $ECHO_C" >&6 ++if test "${ac_cv_prog_lex_yytext_pointer+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 + else + # POSIX says lex can declare yytext either as a pointer or an array; the + # default is implementation-dependent. Figure out which it is, since + # not all implementations provide the %pointer and %array declarations. + ac_cv_prog_lex_yytext_pointer=no + echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c +-ac_save_LIBS="$LIBS" ++ac_save_LIBS=$LIBS + LIBS="$LIBS $LEXLIB" +-cat > conftest.$ac_ext <<EOF +-#line 1513 "configure" +-#include "confdefs.h" ++cat >conftest.$ac_ext <<_ACEOF + `cat $LEX_OUTPUT_ROOT.c` +-int main() { +- +-; return 0; } +-EOF +-if { (eval echo configure:1520: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +- rm -rf conftest* ++_ACEOF ++rm -f conftest.$ac_objext conftest$ac_exeext ++if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ++ (eval $ac_link) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -s conftest$ac_exeext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then + ac_cv_prog_lex_yytext_pointer=yes + else +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ + fi +-rm -f conftest* +-LIBS="$ac_save_LIBS" ++rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext ++LIBS=$ac_save_LIBS + rm -f "${LEX_OUTPUT_ROOT}.c" + + fi +- +-echo "$ac_t""$ac_cv_prog_lex_yytext_pointer" 1>&6 ++echo "$as_me:$LINENO: result: $ac_cv_prog_lex_yytext_pointer" >&5 ++echo "${ECHO_T}$ac_cv_prog_lex_yytext_pointer" >&6 + if test $ac_cv_prog_lex_yytext_pointer = yes; then +- cat >> confdefs.h <<\EOF ++ ++cat >>confdefs.h <<\_ACEOF + #define YYTEXT_POINTER 1 +-EOF ++_ACEOF ++ ++fi + + fi + + for ac_prog in 'bison -y' byacc + do +-# Extract the first word of "$ac_prog", so it can be a program name with args. ++ # Extract the first word of "$ac_prog", so it can be a program name with args. + set dummy $ac_prog; ac_word=$2 +-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +-echo "configure:1546: checking for $ac_word" >&5 +-if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 ++echo "$as_me:$LINENO: checking for $ac_word" >&5 ++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 ++if test "${ac_cv_prog_YACC+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 + else + if test -n "$YACC"; then + ac_cv_prog_YACC="$YACC" # Let the user override the test. + else +- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" +- ac_dummy="$PATH" +- for ac_dir in $ac_dummy; do +- test -z "$ac_dir" && ac_dir=. +- if test -f $ac_dir/$ac_word; then +- ac_cv_prog_YACC="$ac_prog" +- break +- fi +- done +- IFS="$ac_save_ifs" ++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ ac_cv_prog_YACC="$ac_prog" ++ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++done ++ + fi + fi +-YACC="$ac_cv_prog_YACC" ++YACC=$ac_cv_prog_YACC + if test -n "$YACC"; then +- echo "$ac_t""$YACC" 1>&6 ++ echo "$as_me:$LINENO: result: $YACC" >&5 ++echo "${ECHO_T}$YACC" >&6 + else +- echo "$ac_t""no" 1>&6 ++ echo "$as_me:$LINENO: result: no" >&5 ++echo "${ECHO_T}no" >&6 + fi + +-test -n "$YACC" && break ++ test -n "$YACC" && break + done + test -n "$YACC" || YACC="yacc" + +@@ -1579,126 +3029,77 @@ + # SunOS /usr/etc/install + # IRIX /sbin/install + # AIX /bin/install ++# AmigaOS /C/install, which installs bootblocks on floppy discs + # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag + # AFS /usr/afsws/bin/install, which mishandles nonexistent args + # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" + # ./install, which can be erroneously created by make from ./install.sh. +-echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +-echo "configure:1588: checking for a BSD compatible install" >&5 ++echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 ++echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 + if test -z "$INSTALL"; then +-if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 ++if test "${ac_cv_path_install+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 + else +- IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" +- for ac_dir in $PATH; do +- # Account for people who put trailing slashes in PATH elements. +- case "$ac_dir/" in +- /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; +- *) +- # OSF1 and SCO ODT 3.0 have their own names for install. +- # Don't use installbsd from OSF since it installs stuff as root +- # by default. +- for ac_prog in ginstall scoinst install; do +- if test -f $ac_dir/$ac_prog; then +- if test $ac_prog = install && +- grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then +- # AIX install. It has an incompatible calling convention. +- : +- else +- ac_cv_path_install="$ac_dir/$ac_prog -c" +- break 2 +- fi +- fi ++ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ # Account for people who put trailing slashes in PATH elements. ++case $as_dir/ in ++ ./ | .// | /cC/* | \ ++ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ++ /usr/ucb/* ) ;; ++ *) ++ # OSF1 and SCO ODT 3.0 have their own names for install. ++ # Don't use installbsd from OSF since it installs stuff as root ++ # by default. ++ for ac_prog in ginstall scoinst install; do ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then ++ if test $ac_prog = install && ++ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then ++ # AIX install. It has an incompatible calling convention. ++ : ++ elif test $ac_prog = install && ++ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then ++ # program-specific install script used by HP pwplus--don't use. ++ : ++ else ++ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" ++ break 3 ++ fi ++ fi + done +- ;; +- esac +- done +- IFS="$ac_save_IFS" ++ done ++ ;; ++esac ++done ++ + + fi + if test "${ac_cv_path_install+set}" = set; then +- INSTALL="$ac_cv_path_install" ++ INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. +- INSTALL="$ac_install_sh" ++ INSTALL=$ac_install_sh + fi + fi +-echo "$ac_t""$INSTALL" 1>&6 ++echo "$as_me:$LINENO: result: $INSTALL" >&5 ++echo "${ECHO_T}$INSTALL" >&6 + + # Use test -z because SunOS4 sh mishandles braces in ${var-val}. + # It thinks the first close brace ends the variable substitution. + test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +-test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' ++test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + + test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +-echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 +-echo "configure:1642: checking for Cygwin environment" >&5 +-if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 +-else +- cat > conftest.$ac_ext <<EOF +-#line 1647 "configure" +-#include "confdefs.h" +- +-int main() { +- +-#ifndef __CYGWIN__ +-#define __CYGWIN__ __CYGWIN32__ +-#endif +-return __CYGWIN__; +-; return 0; } +-EOF +-if { (eval echo configure:1658: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +- rm -rf conftest* +- ac_cv_cygwin=yes +-else +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 +- rm -rf conftest* +- ac_cv_cygwin=no +-fi +-rm -f conftest* +-rm -f conftest* +-fi +- +-echo "$ac_t""$ac_cv_cygwin" 1>&6 +-CYGWIN= +-test "$ac_cv_cygwin" = yes && CYGWIN=yes +-echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 +-echo "configure:1675: checking for mingw32 environment" >&5 +-if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 +-else +- cat > conftest.$ac_ext <<EOF +-#line 1680 "configure" +-#include "confdefs.h" +- +-int main() { +-return __MINGW32__; +-; return 0; } +-EOF +-if { (eval echo configure:1687: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +- rm -rf conftest* +- ac_cv_mingw32=yes +-else +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 +- rm -rf conftest* +- ac_cv_mingw32=no +-fi +-rm -f conftest* +-rm -f conftest* +-fi +- +-echo "$ac_t""$ac_cv_mingw32" 1>&6 +-MINGW32= +-test "$ac_cv_mingw32" = yes && MINGW32=yes + # Check whether --enable-shared or --disable-shared was given. + if test "${enable_shared+set}" = set; then + enableval="$enable_shared" +@@ -1720,8 +3121,7 @@ + esac + else + enable_shared=yes +-fi +- ++fi; + # Check whether --enable-static or --disable-static was given. + if test "${enable_static+set}" = set; then + enableval="$enable_static" +@@ -1743,8 +3143,7 @@ + esac + else + enable_static=yes +-fi +- ++fi; + # Check whether --enable-fast-install or --disable-fast-install was given. + if test "${enable_fast_install+set}" = set; then + enableval="$enable_fast_install" +@@ -1766,21 +3165,31 @@ + esac + else + enable_fast_install=yes ++fi; ++# Find the correct PATH separator. Usually this is `:', but ++# DJGPP uses `;' like DOS. ++if test "X${PATH_SEPARATOR+set}" != Xset; then ++ UNAME=${UNAME-`uname 2>/dev/null`} ++ case X$UNAME in ++ *-DOS) lt_cv_sys_path_separator=';' ;; ++ *) lt_cv_sys_path_separator=':' ;; ++ esac ++ PATH_SEPARATOR=$lt_cv_sys_path_separator + fi + ++ + # Check whether --with-gnu-ld or --without-gnu-ld was given. + if test "${with_gnu_ld+set}" = set; then + withval="$with_gnu_ld" + test "$withval" = no || with_gnu_ld=yes + else + with_gnu_ld=no +-fi +- ++fi; + ac_prog=ld + if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. +- echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6 +-echo "configure:1784: checking for ld used by GCC" >&5 ++ echo "$as_me:$LINENO: checking for ld used by GCC" >&5 ++echo $ECHO_N "checking for ld used by GCC... $ECHO_C" >&6 + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw +@@ -1809,17 +3218,17 @@ + ;; + esac + elif test "$with_gnu_ld" = yes; then +- echo $ac_n "checking for GNU ld""... $ac_c" 1>&6 +-echo "configure:1814: checking for GNU ld" >&5 ++ echo "$as_me:$LINENO: checking for GNU ld" >&5 ++echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 + else +- echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 +-echo "configure:1817: checking for non-GNU ld" >&5 ++ echo "$as_me:$LINENO: checking for non-GNU ld" >&5 ++echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 + fi +-if eval "test \"`echo '$''{'lt_cv_path_LD'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 ++if test "${lt_cv_path_LD+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 + else + if test -z "$LD"; then +- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" ++ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then +@@ -1842,15 +3251,19 @@ + + LD="$lt_cv_path_LD" + if test -n "$LD"; then +- echo "$ac_t""$LD" 1>&6 ++ echo "$as_me:$LINENO: result: $LD" >&5 ++echo "${ECHO_T}$LD" >&6 + else +- echo "$ac_t""no" 1>&6 ++ echo "$as_me:$LINENO: result: no" >&5 ++echo "${ECHO_T}no" >&6 + fi +-test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; } +-echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6 +-echo "configure:1852: checking if the linker ($LD) is GNU ld" >&5 +-if eval "test \"`echo '$''{'lt_cv_prog_gnu_ld'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 ++test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 ++echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} ++ { (exit 1); exit 1; }; } ++echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 ++echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 ++if test "${lt_cv_prog_gnu_ld+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 + else + # I'd rather use --version here, but apparently some GNU ld's only accept -v. + if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then +@@ -1859,33 +3272,33 @@ + lt_cv_prog_gnu_ld=no + fi + fi +- +-echo "$ac_t""$lt_cv_prog_gnu_ld" 1>&6 ++echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5 ++echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 + with_gnu_ld=$lt_cv_prog_gnu_ld + + +-echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6 +-echo "configure:1869: checking for $LD option to reload object files" >&5 +-if eval "test \"`echo '$''{'lt_cv_ld_reload_flag'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 ++echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5 ++echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6 ++if test "${lt_cv_ld_reload_flag+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 + else + lt_cv_ld_reload_flag='-r' + fi +- +-echo "$ac_t""$lt_cv_ld_reload_flag" 1>&6 ++echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5 ++echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6 + reload_flag=$lt_cv_ld_reload_flag + test -n "$reload_flag" && reload_flag=" $reload_flag" + +-echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6 +-echo "configure:1881: checking for BSD-compatible nm" >&5 +-if eval "test \"`echo '$''{'lt_cv_path_NM'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 ++echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5 ++echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6 ++if test "${lt_cv_path_NM+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 + else + if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" + else +- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" ++ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + test -z "$ac_dir" && ac_dir=. + tmp_nm=$ac_dir/${ac_tool_prefix}nm +@@ -1912,33 +3325,109 @@ + fi + + NM="$lt_cv_path_NM" +-echo "$ac_t""$NM" 1>&6 ++echo "$as_me:$LINENO: result: $NM" >&5 ++echo "${ECHO_T}$NM" >&6 ++ ++echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 ++echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6 ++if test "${lt_cv_path_SED+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ # Loop through the user's path and test for sed and gsed. ++# Then use that list of sed's as ones to test for truncation. ++as_executable_p="test -f" ++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_prog in sed gsed; do ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then ++ _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext" ++ fi ++ done ++ done ++done ++ ++ # Create a temporary directory, and hook for its removal unless debugging. ++$debug || ++{ ++ trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 ++ trap '{ (exit 1); exit 1; }' 1 2 13 15 ++} ++ ++# Create a (secure) tmp directory for tmp files. ++: ${TMPDIR=/tmp} ++{ ++ tmp=`(umask 077 && mktemp -d -q "$TMPDIR/sedXXXXXX") 2>/dev/null` && ++ test -n "$tmp" && test -d "$tmp" ++} || ++{ ++ tmp=$TMPDIR/sed$$-$RANDOM ++ (umask 077 && mkdir $tmp) ++} || ++{ ++ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ++ { (exit 1); exit 1; } ++} ++ _max=0 ++ _count=0 ++ # Add /usr/xpg4/bin/sed as it is typically found on Solaris ++ # along with /bin/sed that truncates output. ++ for _sed in $_sed_list /usr/xpg4/bin/sed; do ++ test ! -f ${_sed} && break ++ cat /dev/null > "$tmp/sed.in" ++ _count=0 ++ echo ${ECHO_N-$ac_n} "0123456789${ECHO_C-$ac_c}" >"$tmp/sed.in" ++ # Check for GNU sed and select it if it is found. ++ if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; then ++ lt_cv_path_SED=${_sed} ++ break ++ fi ++ while true; do ++ cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp" ++ mv "$tmp/sed.tmp" "$tmp/sed.in" ++ cp "$tmp/sed.in" "$tmp/sed.nl" ++ echo >>"$tmp/sed.nl" ++ ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break ++ cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break ++ # 40000 chars as input seems more than enough ++ test $_count -gt 10 && break ++ _count=`expr $_count + 1` ++ if test $_count -gt $_max; then ++ _max=$_count ++ lt_cv_path_SED=$_sed ++ fi ++ done ++ done ++ rm -rf "$tmp" + +-echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 +-echo "configure:1919: checking whether ln -s works" >&5 +-if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 +-else +- rm -f conftestdata +-if ln -s X conftestdata 2>/dev/null +-then +- rm -f conftestdata +- ac_cv_prog_LN_S="ln -s" +-else +- ac_cv_prog_LN_S=ln + fi ++ ++if test "X$SED" != "X"; then ++ lt_cv_path_SED=$SED ++else ++ SED=$lt_cv_path_SED + fi +-LN_S="$ac_cv_prog_LN_S" +-if test "$ac_cv_prog_LN_S" = "ln -s"; then +- echo "$ac_t""yes" 1>&6 ++echo "$as_me:$LINENO: result: $SED" >&5 ++echo "${ECHO_T}$SED" >&6 ++ ++echo "$as_me:$LINENO: checking whether ln -s works" >&5 ++echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6 ++LN_S=$as_ln_s ++if test "$LN_S" = "ln -s"; then ++ echo "$as_me:$LINENO: result: yes" >&5 ++echo "${ECHO_T}yes" >&6 + else +- echo "$ac_t""no" 1>&6 ++ echo "$as_me:$LINENO: result: no, using $LN_S" >&5 ++echo "${ECHO_T}no, using $LN_S" >&6 + fi + +-echo $ac_n "checking how to recognise dependant libraries""... $ac_c" 1>&6 +-echo "configure:1940: checking how to recognise dependant libraries" >&5 +-if eval "test \"`echo '$''{'lt_cv_deplibs_check_method'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 ++echo "$as_me:$LINENO: checking how to recognise dependent libraries" >&5 ++echo $ECHO_N "checking how to recognise dependent libraries... $ECHO_C" >&6 ++if test "${lt_cv_deplibs_check_method+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 + else + lt_cv_file_magic_cmd='$MAGIC_CMD' + lt_cv_file_magic_test_file= +@@ -1949,7 +3438,7 @@ + # `unknown' -- same as none, but documents that we really don't know. + # 'pass_all' -- all dependencies passed with no checks. + # 'test_compile' -- check by making test program. +-# ['file_magic [regex]'] -- check by looking for files in library path ++# 'file_magic [[regex]]' -- check by looking for files in library path + # which responds to the $file_magic_cmd with a given egrep regex. + # If you have `file' or equivalent on your system and you're not sure + # whether `pass_all' will *always* work, you probably want this one. +@@ -1978,7 +3467,7 @@ + lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' + lt_cv_file_magic_cmd='/usr/bin/file -L' + case "$host_os" in +- rhapsody* | darwin1.012) ++ rhapsody* | darwin1.[012]) + lt_cv_file_magic_test_file=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1` + ;; + *) # Darwin 1.3 on +@@ -2013,9 +3502,9 @@ + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + +-irix5* | irix6*) ++irix5* | irix6* | nonstopux*) + case $host_os in +- irix5*) ++ irix5* | nonstopux*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" + ;; +@@ -2037,7 +3526,7 @@ + # This must be Linux ELF. + linux-gnu*) + case $host_cpu in +- alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* | s390* ) ++ alpha* | hppa* | i*86 | mips | mipsel | powerpc* | sparc* | ia64* | arm* | m68k) + lt_cv_deplibs_check_method=pass_all ;; + *) + # glibc up to 2.1.1 does not perform some relocations on ARM +@@ -2060,6 +3549,16 @@ + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + ++openbsd*) ++ lt_cv_file_magic_cmd=/usr/bin/file ++ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ++ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then ++ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object' ++ else ++ lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' ++ fi ++ ;; ++ + osf3* | osf4* | osf5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' +@@ -2098,89 +3597,32 @@ + lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; ++ siemens) ++ lt_cv_deplibs_check_method=pass_all ++ ;; + esac + ;; + esac + + fi +- +-echo "$ac_t""$lt_cv_deplibs_check_method" 1>&6 ++echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5 ++echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6 + file_magic_cmd=$lt_cv_file_magic_cmd + deplibs_check_method=$lt_cv_deplibs_check_method + +-echo $ac_n "checking for object suffix""... $ac_c" 1>&6 +-echo "configure:2113: checking for object suffix" >&5 +-if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 +-else +- rm -f conftest* +-echo 'int i = 1;' > conftest.$ac_ext +-if { (eval echo configure:2119: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +- for ac_file in conftest.*; do +- case $ac_file in +- *.c) ;; +- *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;; +- esac +- done +-else +- { echo "configure: error: installation or configuration problem; compiler does not work" 1>&2; exit 1; } +-fi +-rm -f conftest* +-fi +- +-echo "$ac_t""$ac_cv_objext" 1>&6 +-OBJEXT=$ac_cv_objext +-ac_objext=$ac_cv_objext +- +- +- +-echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 +-echo "configure:2139: checking for executable suffix" >&5 +-if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 +-else +- if test "$CYGWIN" = yes || test "$MINGW32" = yes; then +- ac_cv_exeext=.exe +-else +- rm -f conftest* +- echo 'int main () { return 0; }' > conftest.$ac_ext +- ac_cv_exeext= +- if { (eval echo configure:2149: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then +- for file in conftest.*; do +- case $file in +- *.c | *.o | *.obj) ;; +- *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; +- esac +- done +- else +- { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; } +- fi +- rm -f conftest* +- test x"${ac_cv_exeext}" = x && ac_cv_exeext=no +-fi +-fi + +-EXEEXT="" +-test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext} +-echo "$ac_t""${ac_cv_exeext}" 1>&6 +-ac_exeext=$EXEEXT + +-if test $host != $build; then +- ac_tool_prefix=${host_alias}- +-else +- ac_tool_prefix= +-fi + + + + + # Check for command to grab the raw symbol name followed by C symbol from nm. +-echo $ac_n "checking command to parse $NM output""... $ac_c" 1>&6 +-echo "configure:2180: checking command to parse $NM output" >&5 +-if eval "test \"`echo '$''{'lt_cv_sys_global_symbol_pipe'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 ++echo "$as_me:$LINENO: checking command to parse $NM output" >&5 ++echo $ECHO_N "checking command to parse $NM output... $ECHO_C" >&6 ++if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 + else +- ++ + # These are sane defaults that work on at least a few old systems. + # [They come from Ultrix. What could be older than Ultrix?!! ;)] + +@@ -2196,6 +3638,9 @@ + # Transform an extracted symbol line into a proper C declaration + lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" + ++# Transform an extracted symbol line into symbol name and symbol address ++lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" ++ + # Define system-specific variables. + case $host_os in + aix*) +@@ -2206,10 +3651,14 @@ + ;; + hpux*) # Its linker distinguishes data from code symbols + lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" ++ lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +-irix*) ++irix* | nonstopux*) + symcode='[BCDEGRST]' + ;; ++osf*) ++ symcode='[BCDEGQRST]' ++ ;; + solaris* | sysv5*) + symcode='[BDT]' + ;; +@@ -2252,10 +3701,18 @@ + int main(){nm_test_var='a';nm_test_func();return(0);} + EOF + +- if { (eval echo configure:2256: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then ++ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; then + # Now try to grab the symbols. + nlist=conftest.nm +- if { (eval echo configure:2259: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\") 1>&5; (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5; } && test -s "$nlist"; then ++ if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 ++ (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" +@@ -2277,23 +3734,23 @@ + + cat <<EOF >> conftest.$ac_ext + #if defined (__STDC__) && __STDC__ +-# define lt_ptr_t void * ++# define lt_ptr void * + #else +-# define lt_ptr_t char * ++# define lt_ptr char * + # define const + #endif + + /* The mapping between symbol names and symbols. */ + const struct { + const char *name; +- lt_ptr_t address; ++ lt_ptr address; + } + lt_preloaded_symbols[] = + { + EOF +- sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" >> conftest.$ac_ext ++ sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext +- {0, (lt_ptr_t) 0} ++ {0, (lt_ptr) 0} + }; + + #ifdef __cplusplus +@@ -2306,7 +3763,11 @@ + save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$no_builtin_flag" +- if { (eval echo configure:2310: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then ++ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ++ (eval $ac_link) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && test -s conftest$ac_exeext; then + pipe_works=yes + fi + LIBS="$save_LIBS" +@@ -2339,84 +3800,665 @@ + global_symbol_pipe="$lt_cv_sys_global_symbol_pipe" + if test -z "$lt_cv_sys_global_symbol_pipe"; then + global_symbol_to_cdecl= ++ global_symbol_to_c_name_address= + else + global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl" ++ global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address" + fi +-if test -z "$global_symbol_pipe$global_symbol_to_cdecl"; then +- echo "$ac_t""failed" 1>&6 ++if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address"; ++then ++ echo "$as_me:$LINENO: result: failed" >&5 ++echo "${ECHO_T}failed" >&6 + else +- echo "$ac_t""ok" 1>&6 ++ echo "$as_me:$LINENO: result: ok" >&5 ++echo "${ECHO_T}ok" >&6 + fi + +-for ac_hdr in dlfcn.h ++ac_ext=c ++ac_cpp='$CPP $CPPFLAGS' ++ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ++ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ++ac_compiler_gnu=$ac_cv_c_compiler_gnu ++echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 ++echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 ++# On Suns, sometimes $CPP names a directory. ++if test -n "$CPP" && test -d "$CPP"; then ++ CPP= ++fi ++if test -z "$CPP"; then ++ if test "${ac_cv_prog_CPP+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ # Double quotes because CPP needs to be expanded ++ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" ++ do ++ ac_preproc_ok=false ++for ac_c_preproc_warn_flag in '' yes + do +-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +-echo "configure:2356: checking for $ac_hdr" >&5 +-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 ++ # Use a header file that comes with gcc, so configuring glibc ++ # with a fresh cross-compiler works. ++ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since ++ # <limits.h> exists even on freestanding compilers. ++ # On the NeXT, cc -E runs the code through the compiler's parser, ++ # not just through cpp. "Syntax error" is here to catch this case. ++ cat >conftest.$ac_ext <<_ACEOF ++#line $LINENO "configure" ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++#ifdef __STDC__ ++# include <limits.h> ++#else ++# include <assert.h> ++#endif ++ Syntax error ++_ACEOF ++if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 ++ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } >/dev/null; then ++ if test -s conftest.err; then ++ ac_cpp_err=$ac_c_preproc_warn_flag ++ else ++ ac_cpp_err= ++ fi + else +- cat > conftest.$ac_ext <<EOF +-#line 2361 "configure" +-#include "confdefs.h" +-#include <$ac_hdr> +-EOF +-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +-{ (eval echo configure:2366: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +-if test -z "$ac_err"; then +- rm -rf conftest* +- eval "ac_cv_header_$ac_safe=yes" ++ ac_cpp_err=yes ++fi ++if test -z "$ac_cpp_err"; then ++ : + else +- echo "$ac_err" >&5 +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 +- rm -rf conftest* +- eval "ac_cv_header_$ac_safe=no" ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ # Broken: fails on valid input. ++continue + fi +-rm -f conftest* ++rm -f conftest.err conftest.$ac_ext ++ ++ # OK, works on sane cases. Now check whether non-existent headers ++ # can be detected and how. ++ cat >conftest.$ac_ext <<_ACEOF ++#line $LINENO "configure" ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++#include <ac_nonexistent.h> ++_ACEOF ++if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 ++ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } >/dev/null; then ++ if test -s conftest.err; then ++ ac_cpp_err=$ac_c_preproc_warn_flag ++ else ++ ac_cpp_err= ++ fi ++else ++ ac_cpp_err=yes + fi +-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then +- echo "$ac_t""yes" 1>&6 +- ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` +- cat >> confdefs.h <<EOF +-#define $ac_tr_hdr 1 +-EOF +- ++if test -z "$ac_cpp_err"; then ++ # Broken: success on invalid input. ++continue + else +- echo "$ac_t""no" 1>&6 ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ # Passes both tests. ++ac_preproc_ok=: ++break + fi ++rm -f conftest.err conftest.$ac_ext ++ + done ++# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. ++rm -f conftest.err conftest.$ac_ext ++if $ac_preproc_ok; then ++ break ++fi + ++ done ++ ac_cv_prog_CPP=$CPP ++ ++fi ++ CPP=$ac_cv_prog_CPP ++else ++ ac_cv_prog_CPP=$CPP ++fi ++echo "$as_me:$LINENO: result: $CPP" >&5 ++echo "${ECHO_T}$CPP" >&6 ++ac_preproc_ok=false ++for ac_c_preproc_warn_flag in '' yes ++do ++ # Use a header file that comes with gcc, so configuring glibc ++ # with a fresh cross-compiler works. ++ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since ++ # <limits.h> exists even on freestanding compilers. ++ # On the NeXT, cc -E runs the code through the compiler's parser, ++ # not just through cpp. "Syntax error" is here to catch this case. ++ cat >conftest.$ac_ext <<_ACEOF ++#line $LINENO "configure" ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++#ifdef __STDC__ ++# include <limits.h> ++#else ++# include <assert.h> ++#endif ++ Syntax error ++_ACEOF ++if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 ++ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } >/dev/null; then ++ if test -s conftest.err; then ++ ac_cpp_err=$ac_c_preproc_warn_flag ++ else ++ ac_cpp_err= ++ fi ++else ++ ac_cpp_err=yes ++fi ++if test -z "$ac_cpp_err"; then ++ : ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 + ++ # Broken: fails on valid input. ++continue ++fi ++rm -f conftest.err conftest.$ac_ext + ++ # OK, works on sane cases. Now check whether non-existent headers ++ # can be detected and how. ++ cat >conftest.$ac_ext <<_ACEOF ++#line $LINENO "configure" ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++#include <ac_nonexistent.h> ++_ACEOF ++if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 ++ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } >/dev/null; then ++ if test -s conftest.err; then ++ ac_cpp_err=$ac_c_preproc_warn_flag ++ else ++ ac_cpp_err= ++ fi ++else ++ ac_cpp_err=yes ++fi ++if test -z "$ac_cpp_err"; then ++ # Broken: success on invalid input. ++continue ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 + ++ # Passes both tests. ++ac_preproc_ok=: ++break ++fi ++rm -f conftest.err conftest.$ac_ext + +-# Only perform the check for file, if the check method requires it +-case $deplibs_check_method in +-file_magic*) +- if test "$file_magic_cmd" = '$MAGIC_CMD'; then +- echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6 +-echo "configure:2401: checking for ${ac_tool_prefix}file" >&5 +-if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 ++done ++# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. ++rm -f conftest.err conftest.$ac_ext ++if $ac_preproc_ok; then ++ : + else +- case $MAGIC_CMD in +- /*) +- lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. +- ;; +- ?:/*) +- lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. +- ;; +- *) +- ac_save_MAGIC_CMD="$MAGIC_CMD" +- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" +- ac_dummy="/usr/bin:$PATH" +- for ac_dir in $ac_dummy; do +- test -z "$ac_dir" && ac_dir=. +- if test -f $ac_dir/${ac_tool_prefix}file; then +- lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" +- if test -n "$file_magic_test_file"; then ++ { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check ++See \`config.log' for more details." >&5 ++echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check ++See \`config.log' for more details." >&2;} ++ { (exit 1); exit 1; }; } ++fi ++ ++ac_ext=c ++ac_cpp='$CPP $CPPFLAGS' ++ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ++ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ++ac_compiler_gnu=$ac_cv_c_compiler_gnu ++ ++ ++echo "$as_me:$LINENO: checking for egrep" >&5 ++echo $ECHO_N "checking for egrep... $ECHO_C" >&6 ++if test "${ac_cv_prog_egrep+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ if echo a | (grep -E '(a|b)') >/dev/null 2>&1 ++ then ac_cv_prog_egrep='grep -E' ++ else ac_cv_prog_egrep='egrep' ++ fi ++fi ++echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 ++echo "${ECHO_T}$ac_cv_prog_egrep" >&6 ++ EGREP=$ac_cv_prog_egrep ++ ++ ++echo "$as_me:$LINENO: checking for ANSI C header files" >&5 ++echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 ++if test "${ac_cv_header_stdc+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ cat >conftest.$ac_ext <<_ACEOF ++#line $LINENO "configure" ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++#include <stdlib.h> ++#include <stdarg.h> ++#include <string.h> ++#include <float.h> ++ ++int ++main () ++{ ++ ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_cv_header_stdc=yes ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ac_cv_header_stdc=no ++fi ++rm -f conftest.$ac_objext conftest.$ac_ext ++ ++if test $ac_cv_header_stdc = yes; then ++ # SunOS 4.x string.h does not declare mem*, contrary to ANSI. ++ cat >conftest.$ac_ext <<_ACEOF ++#line $LINENO "configure" ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++#include <string.h> ++ ++_ACEOF ++if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | ++ $EGREP "memchr" >/dev/null 2>&1; then ++ : ++else ++ ac_cv_header_stdc=no ++fi ++rm -f conftest* ++ ++fi ++ ++if test $ac_cv_header_stdc = yes; then ++ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. ++ cat >conftest.$ac_ext <<_ACEOF ++#line $LINENO "configure" ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++#include <stdlib.h> ++ ++_ACEOF ++if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | ++ $EGREP "free" >/dev/null 2>&1; then ++ : ++else ++ ac_cv_header_stdc=no ++fi ++rm -f conftest* ++ ++fi ++ ++if test $ac_cv_header_stdc = yes; then ++ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. ++ if test "$cross_compiling" = yes; then ++ : ++else ++ cat >conftest.$ac_ext <<_ACEOF ++#line $LINENO "configure" ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++#include <ctype.h> ++#if ((' ' & 0x0FF) == 0x020) ++# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') ++# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) ++#else ++# define ISLOWER(c) \ ++ (('a' <= (c) && (c) <= 'i') \ ++ || ('j' <= (c) && (c) <= 'r') \ ++ || ('s' <= (c) && (c) <= 'z')) ++# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) ++#endif ++ ++#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) ++int ++main () ++{ ++ int i; ++ for (i = 0; i < 256; i++) ++ if (XOR (islower (i), ISLOWER (i)) ++ || toupper (i) != TOUPPER (i)) ++ exit(2); ++ exit (0); ++} ++_ACEOF ++rm -f conftest$ac_exeext ++if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ++ (eval $ac_link) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && { ac_try='./conftest$ac_exeext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ : ++else ++ echo "$as_me: program exited with status $ac_status" >&5 ++echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++( exit $ac_status ) ++ac_cv_header_stdc=no ++fi ++rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext ++fi ++fi ++fi ++echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 ++echo "${ECHO_T}$ac_cv_header_stdc" >&6 ++if test $ac_cv_header_stdc = yes; then ++ ++cat >>confdefs.h <<\_ACEOF ++#define STDC_HEADERS 1 ++_ACEOF ++ ++fi ++ ++# On IRIX 5.3, sys/types and inttypes.h are conflicting. ++ ++ ++ ++ ++ ++ ++ ++ ++ ++for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ ++ inttypes.h stdint.h unistd.h ++do ++as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` ++echo "$as_me:$LINENO: checking for $ac_header" >&5 ++echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 ++if eval "test \"\${$as_ac_Header+set}\" = set"; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ cat >conftest.$ac_ext <<_ACEOF ++#line $LINENO "configure" ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++$ac_includes_default ++ ++#include <$ac_header> ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ eval "$as_ac_Header=yes" ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++eval "$as_ac_Header=no" ++fi ++rm -f conftest.$ac_objext conftest.$ac_ext ++fi ++echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 ++echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 ++if test `eval echo '${'$as_ac_Header'}'` = yes; then ++ cat >>confdefs.h <<_ACEOF ++#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 ++_ACEOF ++ ++fi ++ ++done ++ ++ ++ ++for ac_header in dlfcn.h ++do ++as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` ++if eval "test \"\${$as_ac_Header+set}\" = set"; then ++ echo "$as_me:$LINENO: checking for $ac_header" >&5 ++echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 ++if eval "test \"\${$as_ac_Header+set}\" = set"; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++fi ++echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 ++echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 ++else ++ # Is the header compilable? ++echo "$as_me:$LINENO: checking $ac_header usability" >&5 ++echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 ++cat >conftest.$ac_ext <<_ACEOF ++#line $LINENO "configure" ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++$ac_includes_default ++#include <$ac_header> ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_header_compiler=yes ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ac_header_compiler=no ++fi ++rm -f conftest.$ac_objext conftest.$ac_ext ++echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 ++echo "${ECHO_T}$ac_header_compiler" >&6 ++ ++# Is the header present? ++echo "$as_me:$LINENO: checking $ac_header presence" >&5 ++echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 ++cat >conftest.$ac_ext <<_ACEOF ++#line $LINENO "configure" ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++#include <$ac_header> ++_ACEOF ++if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 ++ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } >/dev/null; then ++ if test -s conftest.err; then ++ ac_cpp_err=$ac_c_preproc_warn_flag ++ else ++ ac_cpp_err= ++ fi ++else ++ ac_cpp_err=yes ++fi ++if test -z "$ac_cpp_err"; then ++ ac_header_preproc=yes ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ ac_header_preproc=no ++fi ++rm -f conftest.err conftest.$ac_ext ++echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 ++echo "${ECHO_T}$ac_header_preproc" >&6 ++ ++# So? What about this header? ++case $ac_header_compiler:$ac_header_preproc in ++ yes:no ) ++ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 ++echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} ++ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 ++echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} ++ ( ++ cat <<\_ASBOX ++## ------------------------------------ ## ++## Report this to bug-autoconf@gnu.org. ## ++## ------------------------------------ ## ++_ASBOX ++ ) | ++ sed "s/^/$as_me: WARNING: /" >&2 ++ ;; ++ no:yes ) ++ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 ++echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} ++ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 ++echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} ++ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 ++echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} ++ ( ++ cat <<\_ASBOX ++## ------------------------------------ ## ++## Report this to bug-autoconf@gnu.org. ## ++## ------------------------------------ ## ++_ASBOX ++ ) | ++ sed "s/^/$as_me: WARNING: /" >&2 ++ ;; ++esac ++echo "$as_me:$LINENO: checking for $ac_header" >&5 ++echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 ++if eval "test \"\${$as_ac_Header+set}\" = set"; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ eval "$as_ac_Header=$ac_header_preproc" ++fi ++echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 ++echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 ++ ++fi ++if test `eval echo '${'$as_ac_Header'}'` = yes; then ++ cat >>confdefs.h <<_ACEOF ++#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 ++_ACEOF ++ ++fi ++ ++done ++ ++ ++ ++ ++ ++ ++# Only perform the check for file, if the check method requires it ++case $deplibs_check_method in ++file_magic*) ++ if test "$file_magic_cmd" = '$MAGIC_CMD'; then ++ echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5 ++echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6 ++if test "${lt_cv_path_MAGIC_CMD+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ case $MAGIC_CMD in ++ /*) ++ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ++ ;; ++ ?:/*) ++ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. ++ ;; ++ *) ++ ac_save_MAGIC_CMD="$MAGIC_CMD" ++ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ++ ac_dummy="/usr/bin:$PATH" ++ for ac_dir in $ac_dummy; do ++ test -z "$ac_dir" && ac_dir=. ++ if test -f $ac_dir/${ac_tool_prefix}file; then ++ lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" ++ if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" +@@ -2451,17 +4493,19 @@ + + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if test -n "$MAGIC_CMD"; then +- echo "$ac_t""$MAGIC_CMD" 1>&6 ++ echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 ++echo "${ECHO_T}$MAGIC_CMD" >&6 + else +- echo "$ac_t""no" 1>&6 ++ echo "$as_me:$LINENO: result: no" >&5 ++echo "${ECHO_T}no" >&6 + fi + + if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then +- echo $ac_n "checking for file""... $ac_c" 1>&6 +-echo "configure:2463: checking for file" >&5 +-if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 ++ echo "$as_me:$LINENO: checking for file" >&5 ++echo $ECHO_N "checking for file... $ECHO_C" >&6 ++if test "${lt_cv_path_MAGIC_CMD+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 + else + case $MAGIC_CMD in + /*) +@@ -2513,9 +4557,11 @@ + + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if test -n "$MAGIC_CMD"; then +- echo "$ac_t""$MAGIC_CMD" 1>&6 ++ echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 ++echo "${ECHO_T}$MAGIC_CMD" >&6 + else +- echo "$ac_t""no" 1>&6 ++ echo "$as_me:$LINENO: result: no" >&5 ++echo "${ECHO_T}no" >&6 + fi + + else +@@ -2527,138 +4573,164 @@ + ;; + esac + +-# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. ++if test -n "$ac_tool_prefix"; then ++ # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. + set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +-echo "configure:2534: checking for $ac_word" >&5 +-if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 ++echo "$as_me:$LINENO: checking for $ac_word" >&5 ++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 ++if test "${ac_cv_prog_RANLIB+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 + else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. + else +- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" +- ac_dummy="$PATH" +- for ac_dir in $ac_dummy; do +- test -z "$ac_dir" && ac_dir=. +- if test -f $ac_dir/$ac_word; then +- ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" +- break +- fi +- done +- IFS="$ac_save_ifs" ++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" ++ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++done ++ + fi + fi +-RANLIB="$ac_cv_prog_RANLIB" ++RANLIB=$ac_cv_prog_RANLIB + if test -n "$RANLIB"; then +- echo "$ac_t""$RANLIB" 1>&6 ++ echo "$as_me:$LINENO: result: $RANLIB" >&5 ++echo "${ECHO_T}$RANLIB" >&6 + else +- echo "$ac_t""no" 1>&6 ++ echo "$as_me:$LINENO: result: no" >&5 ++echo "${ECHO_T}no" >&6 + fi + +- ++fi + if test -z "$ac_cv_prog_RANLIB"; then +-if test -n "$ac_tool_prefix"; then ++ ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. + set dummy ranlib; ac_word=$2 +-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +-echo "configure:2566: checking for $ac_word" >&5 +-if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 ++echo "$as_me:$LINENO: checking for $ac_word" >&5 ++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 ++if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 + else +- if test -n "$RANLIB"; then +- ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. ++ if test -n "$ac_ct_RANLIB"; then ++ ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. + else +- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" +- ac_dummy="$PATH" +- for ac_dir in $ac_dummy; do +- test -z "$ac_dir" && ac_dir=. +- if test -f $ac_dir/$ac_word; then +- ac_cv_prog_RANLIB="ranlib" +- break +- fi +- done +- IFS="$ac_save_ifs" +- test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" ++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ ac_cv_prog_ac_ct_RANLIB="ranlib" ++ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++done ++ ++ test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" + fi + fi +-RANLIB="$ac_cv_prog_RANLIB" +-if test -n "$RANLIB"; then +- echo "$ac_t""$RANLIB" 1>&6 ++ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB ++if test -n "$ac_ct_RANLIB"; then ++ echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 ++echo "${ECHO_T}$ac_ct_RANLIB" >&6 + else +- echo "$ac_t""no" 1>&6 ++ echo "$as_me:$LINENO: result: no" >&5 ++echo "${ECHO_T}no" >&6 + fi + ++ RANLIB=$ac_ct_RANLIB + else +- RANLIB=":" +-fi ++ RANLIB="$ac_cv_prog_RANLIB" + fi + +-# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. ++if test -n "$ac_tool_prefix"; then ++ # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. + set dummy ${ac_tool_prefix}strip; ac_word=$2 +-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +-echo "configure:2601: checking for $ac_word" >&5 +-if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 ++echo "$as_me:$LINENO: checking for $ac_word" >&5 ++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 ++if test "${ac_cv_prog_STRIP+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 + else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. + else +- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" +- ac_dummy="$PATH" +- for ac_dir in $ac_dummy; do +- test -z "$ac_dir" && ac_dir=. +- if test -f $ac_dir/$ac_word; then +- ac_cv_prog_STRIP="${ac_tool_prefix}strip" +- break +- fi +- done +- IFS="$ac_save_ifs" ++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ ac_cv_prog_STRIP="${ac_tool_prefix}strip" ++ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++done ++ + fi + fi +-STRIP="$ac_cv_prog_STRIP" ++STRIP=$ac_cv_prog_STRIP + if test -n "$STRIP"; then +- echo "$ac_t""$STRIP" 1>&6 ++ echo "$as_me:$LINENO: result: $STRIP" >&5 ++echo "${ECHO_T}$STRIP" >&6 + else +- echo "$ac_t""no" 1>&6 ++ echo "$as_me:$LINENO: result: no" >&5 ++echo "${ECHO_T}no" >&6 + fi + +- ++fi + if test -z "$ac_cv_prog_STRIP"; then +-if test -n "$ac_tool_prefix"; then ++ ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. + set dummy strip; ac_word=$2 +-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +-echo "configure:2633: checking for $ac_word" >&5 +-if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 ++echo "$as_me:$LINENO: checking for $ac_word" >&5 ++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 ++if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 + else +- if test -n "$STRIP"; then +- ac_cv_prog_STRIP="$STRIP" # Let the user override the test. ++ if test -n "$ac_ct_STRIP"; then ++ ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. + else +- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" +- ac_dummy="$PATH" +- for ac_dir in $ac_dummy; do +- test -z "$ac_dir" && ac_dir=. +- if test -f $ac_dir/$ac_word; then +- ac_cv_prog_STRIP="strip" +- break +- fi +- done +- IFS="$ac_save_ifs" +- test -z "$ac_cv_prog_STRIP" && ac_cv_prog_STRIP=":" ++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ ac_cv_prog_ac_ct_STRIP="strip" ++ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++done ++ ++ test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" + fi + fi +-STRIP="$ac_cv_prog_STRIP" +-if test -n "$STRIP"; then +- echo "$ac_t""$STRIP" 1>&6 ++ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP ++if test -n "$ac_ct_STRIP"; then ++ echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 ++echo "${ECHO_T}$ac_ct_STRIP" >&6 + else +- echo "$ac_t""no" 1>&6 ++ echo "$as_me:$LINENO: result: no" >&5 ++echo "${ECHO_T}no" >&6 + fi + ++ STRIP=$ac_ct_STRIP + else +- STRIP=":" +-fi ++ STRIP="$ac_cv_prog_STRIP" + fi + + +@@ -2668,9 +4740,8 @@ + # Check whether --enable-libtool-lock or --disable-libtool-lock was given. + if test "${enable_libtool_lock+set}" = set; then + enableval="$enable_libtool_lock" +- : +-fi + ++fi; + test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + + # Some flags need to be propagated to the compiler or linker for good +@@ -2678,8 +4749,12 @@ + case $host in + *-*-irix6*) + # Find out which ABI we are using. +- echo '#line 2682 "configure"' > conftest.$ac_ext +- if { (eval echo configure:2683: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then ++ echo '#line 4752 "configure"' > conftest.$ac_ext ++ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" +@@ -2699,47 +4774,64 @@ + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" +- echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6 +-echo "configure:2704: checking whether the C compiler needs -belf" >&5 +-if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 ++ echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5 ++echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6 ++if test "${lt_cv_cc_needs_belf+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 + else +- ++ ++ + ac_ext=c +-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. + ac_cpp='$CPP $CPPFLAGS' +-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +-cross_compiling=$ac_cv_prog_cc_cross ++ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ++ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ++ac_compiler_gnu=$ac_cv_c_compiler_gnu ++ ++ cat >conftest.$ac_ext <<_ACEOF ++#line $LINENO "configure" ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ + +- cat > conftest.$ac_ext <<EOF +-#line 2717 "configure" +-#include "confdefs.h" +- +-int main() { ++int ++main () ++{ + +-; return 0; } +-EOF +-if { (eval echo configure:2724: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +- rm -rf conftest* ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext conftest$ac_exeext ++if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ++ (eval $ac_link) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -s conftest$ac_exeext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then + lt_cv_cc_needs_belf=yes + else +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 +- rm -rf conftest* +- lt_cv_cc_needs_belf=no ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++lt_cv_cc_needs_belf=no + fi +-rm -f conftest* ++rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + ac_ext=c +-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. + ac_cpp='$CPP $CPPFLAGS' +-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +-cross_compiling=$ac_cv_prog_cc_cross ++ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ++ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ++ac_compiler_gnu=$ac_cv_c_compiler_gnu + + fi +- +-echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6 ++echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5 ++echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6 + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" +@@ -2824,16 +4916,23 @@ + old_postuninstall_cmds= + + if test -n "$RANLIB"; then ++ case $host_os in ++ openbsd*) ++ old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" ++ ;; ++ *) ++ old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" ++ ;; ++ esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +- old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" + fi + + # Allow CC to be a program name with arguments. + set dummy $CC + compiler="$2" + +-echo $ac_n "checking for objdir""... $ac_c" 1>&6 +-echo "configure:2837: checking for objdir" >&5 ++echo "$as_me:$LINENO: checking for objdir" >&5 ++echo $ECHO_N "checking for objdir... $ECHO_C" >&6 + rm -f .libs 2>/dev/null + mkdir .libs 2>/dev/null + if test -d .libs; then +@@ -2843,7 +4942,9 @@ + objdir=_libs + fi + rmdir .libs 2>/dev/null +-echo "$ac_t""$objdir" 1>&6 ++echo "$as_me:$LINENO: result: $objdir" >&5 ++echo "${ECHO_T}$objdir" >&6 ++ + + + # Check whether --with-pic or --without-pic was given. +@@ -2852,17 +4953,16 @@ + pic_mode="$withval" + else + pic_mode=default +-fi +- ++fi; + test -z "$pic_mode" && pic_mode=default + + # We assume here that the value for lt_cv_prog_cc_pic will not be cached + # in isolation, and that seeing it set (from the cache) indicates that + # the associated values are set (in the cache) correctly too. +-echo $ac_n "checking for $compiler option to produce PIC""... $ac_c" 1>&6 +-echo "configure:2864: checking for $compiler option to produce PIC" >&5 +-if eval "test \"`echo '$''{'lt_cv_prog_cc_pic'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 ++echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 ++echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ++if test "${lt_cv_prog_cc_pic+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 + else + lt_cv_prog_cc_pic= + lt_cv_prog_cc_shlib= +@@ -2882,7 +4982,7 @@ + # libC (AIX C++ library), which obviously doesn't included in libraries + # list by gcc. This cause undefined symbols with -static flags. + # This hack allows C programs to be linked with "-static -ldl", but +- # we not sure about C++ programs. ++ # not sure about C++ programs. + lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC" + ;; + amigaos*) +@@ -2891,7 +4991,7 @@ + # like `-m68040'. + lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' + ;; +- beos* | irix5* | irix6* | osf3* | osf4* | osf5*) ++ beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + darwin* | rhapsody*) +@@ -2917,13 +5017,13 @@ + # PORTME Check for PIC flags for the system compiler. + case $host_os in + aix3* | aix4* | aix5*) ++ lt_cv_prog_cc_wl='-Wl,' + # All AIX code is PIC. + if test "$host_cpu" = ia64; then +- # AIX 5 now supports IA64 processor +- lt_cv_prog_cc_static='-Bstatic' +- lt_cv_prog_cc_wl='-Wl,' ++ # AIX 5 now supports IA64 processor ++ lt_cv_prog_cc_static='-Bstatic' + else +- lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' ++ lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + +@@ -2934,7 +5034,7 @@ + lt_cv_prog_cc_pic='+Z' + ;; + +- irix5* | irix6*) ++ irix5* | irix6* | nonstopux*) + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-non_shared' + # PIC (with -KPIC) is the default. +@@ -2978,11 +5078,7 @@ + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' +- if test "x$host_vendor" = xsni; then +- lt_cv_prog_cc_wl='-LD' +- else +- lt_cv_prog_cc_wl='-Wl,' +- fi ++ lt_cv_prog_cc_wl='-Wl,' + ;; + + uts4*) +@@ -3006,28 +5102,48 @@ + fi + + if test -z "$lt_cv_prog_cc_pic"; then +- echo "$ac_t""none" 1>&6 ++ echo "$as_me:$LINENO: result: none" >&5 ++echo "${ECHO_T}none" >&6 + else +- echo "$ac_t""$lt_cv_prog_cc_pic" 1>&6 ++ echo "$as_me:$LINENO: result: $lt_cv_prog_cc_pic" >&5 ++echo "${ECHO_T}$lt_cv_prog_cc_pic" >&6 + + # Check to make sure the pic_flag actually works. +- echo $ac_n "checking if $compiler PIC flag $lt_cv_prog_cc_pic works""... $ac_c" 1>&6 +-echo "configure:3016: checking if $compiler PIC flag $lt_cv_prog_cc_pic works" >&5 +- if eval "test \"`echo '$''{'lt_cv_prog_cc_pic_works'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 ++ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_cv_prog_cc_pic works" >&5 ++echo $ECHO_N "checking if $compiler PIC flag $lt_cv_prog_cc_pic works... $ECHO_C" >&6 ++ if test "${lt_cv_prog_cc_pic_works+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 + else + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC" +- cat > conftest.$ac_ext <<EOF +-#line 3023 "configure" +-#include "confdefs.h" ++ cat >conftest.$ac_ext <<_ACEOF ++#line $LINENO "configure" ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ + +-int main() { ++int ++main () ++{ + +-; return 0; } +-EOF +-if { (eval echo configure:3030: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +- rm -rf conftest* ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then + case $host_os in + hpux9* | hpux10* | hpux11*) + # On HP-UX, both CC and GCC only warn that PIC is supported... then +@@ -3043,17 +5159,17 @@ + lt_cv_prog_cc_pic_works=yes + ;; + esac +- ++ + else +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 +- rm -rf conftest* +- lt_cv_prog_cc_pic_works=no +- ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ lt_cv_prog_cc_pic_works=no ++ + fi +-rm -f conftest* ++rm -f conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" +- ++ + fi + + +@@ -3064,43 +5180,65 @@ + lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic" + fi + +- echo "$ac_t""$lt_cv_prog_cc_pic_works" 1>&6 ++ echo "$as_me:$LINENO: result: $lt_cv_prog_cc_pic_works" >&5 ++echo "${ECHO_T}$lt_cv_prog_cc_pic_works" >&6 + fi + + # Check for any special shared library compilation flags. + if test -n "$lt_cv_prog_cc_shlib"; then +- echo "configure: warning: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" 1>&2 ++ { echo "$as_me:$LINENO: WARNING: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" >&5 ++echo "$as_me: WARNING: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" >&2;} + if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$lt_cv_prog_cc_shlib[ ]" >/dev/null; then : + else +- echo "configure: warning: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" 1>&2 ++ { echo "$as_me:$LINENO: WARNING: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&5 ++echo "$as_me: WARNING: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&2;} + lt_cv_prog_cc_can_build_shared=no + fi + fi + +-echo $ac_n "checking if $compiler static flag $lt_cv_prog_cc_static works""... $ac_c" 1>&6 +-echo "configure:3082: checking if $compiler static flag $lt_cv_prog_cc_static works" >&5 +-if eval "test \"`echo '$''{'lt_cv_prog_cc_static_works'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 ++echo "$as_me:$LINENO: checking if $compiler static flag $lt_cv_prog_cc_static works" >&5 ++echo $ECHO_N "checking if $compiler static flag $lt_cv_prog_cc_static works... $ECHO_C" >&6 ++if test "${lt_cv_prog_cc_static_works+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 + else + lt_cv_prog_cc_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static" +- cat > conftest.$ac_ext <<EOF +-#line 3090 "configure" +-#include "confdefs.h" ++ cat >conftest.$ac_ext <<_ACEOF ++#line $LINENO "configure" ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ + +-int main() { ++int ++main () ++{ + +-; return 0; } +-EOF +-if { (eval echo configure:3097: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +- rm -rf conftest* ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext conftest$ac_exeext ++if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ++ (eval $ac_link) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -s conftest$ac_exeext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then + lt_cv_prog_cc_static_works=yes + else +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ + fi +-rm -f conftest* ++rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" + + fi +@@ -3108,7 +5246,8 @@ + + # Belt *and* braces to stop my trousers falling down: + test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static= +-echo "$ac_t""$lt_cv_prog_cc_static_works" 1>&6 ++echo "$as_me:$LINENO: result: $lt_cv_prog_cc_static_works" >&5 ++echo "${ECHO_T}$lt_cv_prog_cc_static_works" >&6 + + pic_flag="$lt_cv_prog_cc_pic" + special_shlib_compile_flags="$lt_cv_prog_cc_shlib" +@@ -3119,12 +5258,12 @@ + + + # Check to see if options -o and -c are simultaneously supported by compiler +-echo $ac_n "checking if $compiler supports -c -o file.$ac_objext""... $ac_c" 1>&6 +-echo "configure:3124: checking if $compiler supports -c -o file.$ac_objext" >&5 +-if eval "test \"`echo '$''{'lt_cv_compiler_c_o'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 ++echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 ++echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 ++if test "${lt_cv_compiler_c_o+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 + else +- ++ + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest +@@ -3139,7 +5278,7 @@ + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" + compiler_c_o=no +-if { (eval echo configure:3143: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then ++if { (eval echo configure:5281: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s out/conftest.err; then +@@ -3163,29 +5302,50 @@ + fi + + compiler_c_o=$lt_cv_compiler_c_o +-echo "$ac_t""$compiler_c_o" 1>&6 ++echo "$as_me:$LINENO: result: $compiler_c_o" >&5 ++echo "${ECHO_T}$compiler_c_o" >&6 + + if test x"$compiler_c_o" = x"yes"; then + # Check to see if we can write to a .lo +- echo $ac_n "checking if $compiler supports -c -o file.lo""... $ac_c" 1>&6 +-echo "configure:3172: checking if $compiler supports -c -o file.lo" >&5 +- if eval "test \"`echo '$''{'lt_cv_compiler_o_lo'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 ++ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.lo" >&5 ++echo $ECHO_N "checking if $compiler supports -c -o file.lo... $ECHO_C" >&6 ++ if test "${lt_cv_compiler_o_lo+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 + else +- ++ + lt_cv_compiler_o_lo=no + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -c -o conftest.lo" +- cat > conftest.$ac_ext <<EOF +-#line 3181 "configure" +-#include "confdefs.h" ++ save_objext="$ac_objext" ++ ac_objext=lo ++ cat >conftest.$ac_ext <<_ACEOF ++#line $LINENO "configure" ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ + +-int main() { ++int ++main () ++{ + int some_variable = 0; +-; return 0; } +-EOF +-if { (eval echo configure:3188: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +- rm -rf conftest* ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then +@@ -3193,18 +5353,21 @@ + else + lt_cv_compiler_o_lo=yes + fi +- ++ + else +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ + fi +-rm -f conftest* ++rm -f conftest.$ac_objext conftest.$ac_ext ++ ac_objext="$save_objext" + CFLAGS="$save_CFLAGS" +- ++ + fi + + compiler_o_lo=$lt_cv_compiler_o_lo +- echo "$ac_t""$compiler_o_lo" 1>&6 ++ echo "$as_me:$LINENO: result: $compiler_o_lo" >&5 ++echo "${ECHO_T}$compiler_o_lo" >&6 + else + compiler_o_lo=no + fi +@@ -3213,17 +5376,19 @@ + hard_links="nottested" + if test "$compiler_c_o" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user +- echo $ac_n "checking if we can lock with hard links""... $ac_c" 1>&6 +-echo "configure:3218: checking if we can lock with hard links" >&5 ++ echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 ++echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no +- echo "$ac_t""$hard_links" 1>&6 ++ echo "$as_me:$LINENO: result: $hard_links" >&5 ++echo "${ECHO_T}$hard_links" >&6 + if test "$hard_links" = no; then +- echo "configure: warning: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" 1>&2 ++ { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 ++echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi + else +@@ -3232,22 +5397,40 @@ + + if test "$GCC" = yes; then + # Check to see if options -fno-rtti -fno-exceptions are supported by compiler +- echo $ac_n "checking if $compiler supports -fno-rtti -fno-exceptions""... $ac_c" 1>&6 +-echo "configure:3237: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 ++ echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 ++echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 + echo "int some_variable = 0;" > conftest.$ac_ext + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext" + compiler_rtti_exceptions=no +- cat > conftest.$ac_ext <<EOF +-#line 3243 "configure" +-#include "confdefs.h" ++ cat >conftest.$ac_ext <<_ACEOF ++#line $LINENO "configure" ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ + +-int main() { ++int ++main () ++{ + int some_variable = 0; +-; return 0; } +-EOF +-if { (eval echo configure:3250: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +- rm -rf conftest* ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then +@@ -3255,14 +5438,16 @@ + else + compiler_rtti_exceptions=yes + fi +- ++ + else +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ + fi +-rm -f conftest* ++rm -f conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" +- echo "$ac_t""$compiler_rtti_exceptions" 1>&6 ++ echo "$as_me:$LINENO: result: $compiler_rtti_exceptions" >&5 ++echo "${ECHO_T}$compiler_rtti_exceptions" >&6 + + if test "$compiler_rtti_exceptions" = "yes"; then + no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' +@@ -3272,8 +5457,8 @@ + fi + + # See if the linker supports building shared libraries. +-echo $ac_n "checking whether the linker ($LD) supports shared libraries""... $ac_c" 1>&6 +-echo "configure:3277: checking whether the linker ($LD) supports shared libraries" >&5 ++echo "$as_me:$LINENO: checking whether the linker ($LD) supports shared libraries" >&5 ++echo $ECHO_N "checking whether the linker ($LD) supports shared libraries... $ECHO_C" >&6 + + allow_undefined_flag= + no_undefined_flag= +@@ -3314,7 +5499,7 @@ + extract_expsyms_cmds= + + case $host_os in +-cygwin* | mingw* | pw32* ) ++cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. +@@ -3322,7 +5507,9 @@ + with_gnu_ld=no + fi + ;; +- ++openbsd*) ++ with_gnu_ld=no ++ ;; + esac + + ld_shlibs=yes +@@ -3409,7 +5596,7 @@ + # can override, but on older systems we have to supply one (in ltdll.c) + if test "x$lt_cv_need_dllmain" = "xyes"; then + ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext " +- ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < [$]0 > $output_objdir/$soname-ltdll.c~ ++ ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~ + test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~' + else + ltdll_obj= +@@ -3427,19 +5614,20 @@ + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is. + # If DATA tags from a recent dlltool are present, honour them! +- archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then +- cp $export_symbols $output_objdir/$soname-def; ++ archive_expsym_cmds='if test "x`sed 1q $export_symbols`" = xEXPORTS; then ++ cp $export_symbols $output_objdir/$soname-def; + else +- echo EXPORTS > $output_objdir/$soname-def; +- _lt_hint=1; +- cat $export_symbols | while read symbol; do +- set dummy \$symbol; +- case \$# in +- 2) echo " \$2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; +- *) echo " \$2 @ \$_lt_hint \$3 ; " >> $output_objdir/$soname-def;; +- esac; +- _lt_hint=`expr 1 + \$_lt_hint`; +- done; ++ echo EXPORTS > $output_objdir/$soname-def; ++ _lt_hint=1; ++ cat $export_symbols | while read symbol; do ++ set dummy \$symbol; ++ case \$# in ++ 2) echo " \$2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; ++ 4) echo " \$2 \$3 \$4 ; " >> $output_objdir/$soname-def; _lt_hint=`expr \$_lt_hint - 1`;; ++ *) echo " \$2 @ \$_lt_hint \$3 ; " >> $output_objdir/$soname-def;; ++ esac; ++ _lt_hint=`expr 1 + \$_lt_hint`; ++ done; + fi~ + '"$ltdll_cmds"' + $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ +@@ -3534,80 +5722,98 @@ + ;; + + aix4* | aix5*) ++ if test "$host_cpu" = ia64; then ++ # On IA64, the linker does run time linking by default, so we don't ++ # have to do anything special. ++ aix_use_runtimelinking=no ++ exp_sym_flag='-Bexport' ++ no_entry_flag="" ++ else ++ aix_use_runtimelinking=no ++ ++ # Test if we are trying to use run time linking or normal ++ # AIX style linking. If -brtl is somewhere in LDFLAGS, we ++ # need to do runtime linking. ++ case $host_os in aix4.[23]|aix4.[23].*|aix5*) ++ for ld_flag in $LDFLAGS; do ++ case $ld_flag in ++ *-brtl*) ++ aix_use_runtimelinking=yes ++ break ++ ;; ++ esac ++ done ++ esac ++ ++ exp_sym_flag='-bexport' ++ no_entry_flag='-bnoentry' ++ fi ++ + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + ++ hardcode_direct=yes + archive_cmds='' + hardcode_libdir_separator=':' + if test "$GCC" = yes; then +- collect2name=`${CC} -print-prog-name=collect2` +- if test -f "$collect2name" && \ +- strings "$collect2name" | grep resolve_lib_name >/dev/null +- then +- # We have reworked collect2 +- hardcode_direct=yes +- else +- # We have old collect2 +- hardcode_direct=unsupported +- # It fails to find uninstalled libraries when the uninstalled +- # path is not listed in the libpath. Setting hardcode_minus_L +- # to unsupported forces relinking +- hardcode_minus_L=yes +- hardcode_libdir_flag_spec='-L$libdir' +- hardcode_libdir_separator= +- fi +- shared_flag='-shared' +- else ++ case $host_os in aix4.[012]|aix4.[012].*) ++ collect2name=`${CC} -print-prog-name=collect2` ++ if test -f "$collect2name" && \ ++ strings "$collect2name" | grep resolve_lib_name >/dev/null ++ then ++ # We have reworked collect2 ++ hardcode_direct=yes ++ else ++ # We have old collect2 ++ hardcode_direct=unsupported ++ # It fails to find uninstalled libraries when the uninstalled ++ # path is not listed in the libpath. Setting hardcode_minus_L ++ # to unsupported forces relinking ++ hardcode_minus_L=yes ++ hardcode_libdir_flag_spec='-L$libdir' ++ hardcode_libdir_separator= ++ fi ++ esac ++ ++ shared_flag='-shared' ++ else ++ # not using gcc + if test "$host_cpu" = ia64; then +- shared_flag='-G' ++ shared_flag='${wl}-G' + else +- shared_flag='${wl}-bM:SRE' ++ if test "$aix_use_runtimelinking" = yes; then ++ shared_flag='${wl}-G' ++ else ++ shared_flag='${wl}-bM:SRE' ++ fi + fi +- hardcode_direct=yes + fi + +- if test "$host_cpu" = ia64; then +- # On IA64, the linker does run time linking by default, so we don't +- # have to do anything special. +- aix_use_runtimelinking=no +- exp_sym_flag='-Bexport' +- no_entry_flag="" +- else +- # Test if we are trying to use run time linking, or normal AIX style linking. +- # If -brtl is somewhere in LDFLAGS, we need to do run time linking. +- aix_use_runtimelinking=no +- for ld_flag in $LDFLAGS; do +- if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl" ); then +- aix_use_runtimelinking=yes +- break +- fi +- done +- exp_sym_flag='-bexport' +- no_entry_flag='-bnoentry' +- fi + # It seems that -bexpall can do strange things, so it is better to + # generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then ++ # Warning - without using the other runtime loading flags (-brtl), ++ # -berok will link without error, but may produce a broken library. ++ allow_undefined_flag='-berok' + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' +- allow_undefined_flag=' -Wl,-G' +- archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" ++ archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then +- hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' +- allow_undefined_flag="-znodefs" +- archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" ++ hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' ++ allow_undefined_flag="-z nodefs" ++ archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else +- hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' +- # Warning - without using the other run time loading flags, -berok will +- # link without error, but may produce a broken library. +- allow_undefined_flag='${wl}-berok' +- # This is a bit strange, but is similar to how AIX traditionally builds +- # it's shared libraries. +- archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname' ++ hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' ++ # Warning - without using the other run time loading flags, ++ # -berok will link without error, but may produce a broken library. ++ allow_undefined_flag='${wl}-berok' ++ # This is a bit strange, but is similar to how AIX traditionally builds ++ # it's shared libraries. ++ archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; +@@ -3639,11 +5845,19 @@ + ;; + + darwin* | rhapsody*) +- allow_undefined_flag='-undefined suppress' ++ case "$host_os" in ++ rhapsody* | darwin1.[012]) ++ allow_undefined_flag='-undefined suppress' ++ ;; ++ *) # Darwin 1.3 on ++ allow_undefined_flag='-flat_namespace -undefined suppress' ++ ;; ++ esac + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not +- # yet detect zsh echo's removal of \ escapes. +- archive_cmds='$CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib $libobjs $deplibs$linkopts -install_name $rpath/$soname $(test -n "$verstring" -a x$verstring != x0.0 && echo $verstring)' ++ # yet detect zsh echo's removal of \ escapes. Also zsh mangles ++ # `"' quotes if we put them in here... so don't! ++ archive_cmds='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib ${lib}-master.o $deplibs$linker_flags $(test .$module != .yes && echo -install_name $rpath/$soname $verstring)' + # We need to add '_' to the symbols in $export_symbols first + #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols' + hardcode_direct=yes +@@ -3695,13 +5909,14 @@ + export_dynamic_flag_spec='${wl}-E' + ;; + +- irix5* | irix6*) ++ irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ++ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' ++ hardcode_libdir_flag_spec='-rpath $libdir' + fi +- hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + link_all_deplibs=yes + ;; +@@ -3718,7 +5933,7 @@ + ;; + + newsos6) +- archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' ++ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: +@@ -3726,10 +5941,24 @@ + ;; + + openbsd*) +- archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' +- hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no ++ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then ++ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' ++ hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ++ export_dynamic_flag_spec='${wl}-E' ++ else ++ case "$host_os" in ++ openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) ++ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' ++ hardcode_libdir_flag_spec='-R$libdir' ++ ;; ++ *) ++ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' ++ hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ++ ;; ++ esac ++ fi + ;; + + os2*) +@@ -3774,10 +6003,39 @@ + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes ++ export_dynamic_flag_spec='${wl}-Bexport' + ;; + + solaris*) ++ # gcc --version < 3.0 without binutils cannot create self contained ++ # shared libraries reliably, requiring libgcc.a to resolve some of ++ # the object symbols generated in some cases. Libraries that use ++ # assert need libgcc.a to resolve __eprintf, for example. Linking ++ # a copy of libgcc.a into every shared library to guarantee resolving ++ # such symbols causes other problems: According to Tim Van Holder ++ # <tim.van.holder@pandora.be>, C++ libraries end up with a separate ++ # (to the application) exception stack for one thing. + no_undefined_flag=' -z defs' ++ if test "$GCC" = yes; then ++ case `$CC --version 2>/dev/null` in ++ [12].*) ++ cat <<EOF 1>&2 ++ ++*** Warning: Releases of GCC earlier than version 3.0 cannot reliably ++*** create self contained shared libraries on Solaris systems, without ++*** introducing a dependency on libgcc.a. Therefore, libtool is disabling ++*** -no-undefined support, which will at least allow you to build shared ++*** libraries. However, you may find that when you link such libraries ++*** into an application without using GCC, you have to manually add ++*** \`gcc --print-libgcc-file-name\` to the link command. We urge you to ++*** upgrade to a newer version of GCC. Another option is to rebuild your ++*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer. ++ ++EOF ++ no_undefined_flag= ++ ;; ++ esac ++ fi + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' +@@ -3808,13 +6066,23 @@ + ;; + + sysv4) +- if test "x$host_vendor" = xsno; then +- archive_cmds='$LD -G -Bsymbolic -h $soname -o $lib $libobjs $deplibs $linkopts' +- hardcode_direct=yes # is this really true??? +- else +- archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' +- hardcode_direct=no #Motorola manual says yes, but my tests say they lie +- fi ++ case $host_vendor in ++ sni) ++ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' ++ hardcode_direct=yes # is this really true??? ++ ;; ++ siemens) ++ ## LD is ld it makes a PLAMLIB ++ ## CC just makes a GrossModule. ++ archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' ++ reload_cmds='$CC -r -o $output$reload_objs' ++ hardcode_direct=no ++ ;; ++ motorola) ++ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' ++ hardcode_direct=no #Motorola manual says yes, but my tests say they lie ++ ;; ++ esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; +@@ -3884,12 +6152,13 @@ + ;; + esac + fi +-echo "$ac_t""$ld_shlibs" 1>&6 ++echo "$as_me:$LINENO: result: $ld_shlibs" >&5 ++echo "${ECHO_T}$ld_shlibs" >&6 + test "$ld_shlibs" = no && can_build_shared=no + + # Check hardcoding attributes. +-echo $ac_n "checking how to hardcode library paths into programs""... $ac_c" 1>&6 +-echo "configure:3893: checking how to hardcode library paths into programs" >&5 ++echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 ++echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 + hardcode_action= + if test -n "$hardcode_libdir_flag_spec" || \ + test -n "$runpath_var"; then +@@ -3912,26 +6181,29 @@ + # directories. + hardcode_action=unsupported + fi +-echo "$ac_t""$hardcode_action" 1>&6 ++echo "$as_me:$LINENO: result: $hardcode_action" >&5 ++echo "${ECHO_T}$hardcode_action" >&6 + + striplib= + old_striplib= +-echo $ac_n "checking whether stripping libraries is possible""... $ac_c" 1>&6 +-echo "configure:3921: checking whether stripping libraries is possible" >&5 ++echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 ++echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 + if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" +- echo "$ac_t""yes" 1>&6 ++ echo "$as_me:$LINENO: result: yes" >&5 ++echo "${ECHO_T}yes" >&6 + else +- echo "$ac_t""no" 1>&6 ++ echo "$as_me:$LINENO: result: no" >&5 ++echo "${ECHO_T}no" >&6 + fi + + reload_cmds='$LD$reload_flag -o $output$reload_objs' + test -z "$deplibs_check_method" && deplibs_check_method=unknown + + # PORTME Fill in your ld.so characteristics +-echo $ac_n "checking dynamic linker characteristics""... $ac_c" 1>&6 +-echo "configure:3935: checking dynamic linker characteristics" >&5 ++echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 ++echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 + library_names_spec= + libname_spec='lib$name' + soname_spec= +@@ -3958,6 +6230,9 @@ + + aix4* | aix5*) + version_type=linux ++ need_lib_prefix=no ++ need_version=no ++ hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so' +@@ -3969,22 +6244,24 @@ + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in +- aix4 | aix4.[01] | aix4.[01].*) +- if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' +- echo ' yes ' +- echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then +- : +- else +- can_build_shared=no +- fi +- ;; ++ aix4 | aix4.[01] | aix4.[01].*) ++ if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' ++ echo ' yes ' ++ echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then ++ : ++ else ++ can_build_shared=no ++ fi ++ ;; + esac +- # AIX (on Power*) has no versioning support, so currently we can not hardcode correct +- # soname into executable. Probably we can add versioning support to +- # collect2, so additional links can be useful in future. ++ # AIX (on Power*) has no versioning support, so currently we can ++ # not hardcode correct soname into executable. Probably we can ++ # add versioning support to collect2, so additional links can ++ # be useful in future. + if test "$aix_use_runtimelinking" = yes; then +- # If using run time linking (on AIX 4.2 or later) use lib<name>.so instead of +- # lib<name>.a to let people know that these are not typical AIX shared libraries. ++ # If using run time linking (on AIX 4.2 or later) use lib<name>.so ++ # instead of lib<name>.a to let people know that these are not ++ # typical AIX shared libraries. + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + else + # We preserve .a as extension for shared libraries through AIX4.2 +@@ -3993,8 +6270,8 @@ + soname_spec='${libname}${release}.so$major' + fi + shlibpath_var=LIBPATH +- deplibs_check_method=pass_all + fi ++ hardcode_into_libs=yes + ;; + + amigaos*) +@@ -4042,7 +6319,7 @@ + ;; + yes,mingw*) + library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' +- sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g"` ++ sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g" -e "s,=/,/,g"` + ;; + yes,pw32*) + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/./-/g'`${versuffix}.dll' +@@ -4074,6 +6351,18 @@ + dynamic_linker=no + ;; + ++freebsd*-gnu*) ++ version_type=linux ++ need_lib_prefix=no ++ need_version=no ++ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' ++ soname_spec='${libname}${release}.so$major' ++ shlibpath_var=LD_LIBRARY_PATH ++ shlibpath_overrides_runpath=no ++ hardcode_into_libs=yes ++ dynamic_linker='GNU/FreeBSD ld.so' ++ ;; ++ + freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat +@@ -4125,14 +6414,17 @@ + postinstall_cmds='chmod 555 $lib' + ;; + +-irix5* | irix6*) +- version_type=irix ++irix5* | irix6* | nonstopux*) ++ case $host_os in ++ nonstopux*) version_type=nonstopux ;; ++ *) version_type=irix ;; ++ esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so' + case $host_os in +- irix5*) ++ irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) +@@ -4206,9 +6498,19 @@ + + openbsd*) + version_type=sunos +- if test "$with_gnu_ld" = yes; then +- need_lib_prefix=no +- need_version=no ++ need_lib_prefix=no ++ need_version=no ++ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then ++ case "$host_os" in ++ openbsd2.[89] | openbsd2.[89].*) ++ shlibpath_overrides_runpath=no ++ ;; ++ *) ++ shlibpath_overrides_runpath=yes ++ ;; ++ esac ++ else ++ shlibpath_overrides_runpath=yes + fi + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' +@@ -4226,11 +6528,13 @@ + osf3* | osf4* | osf5*) + version_type=osf + need_version=no +- soname_spec='${libname}${release}.so' +- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' ++ need_lib_prefix=no ++ soname_spec='${libname}${release}.so$major' ++ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ++ hardcode_into_libs=yes + ;; + + sco3.2v5*) +@@ -4273,6 +6577,12 @@ + case $host_vendor in + sni) + shlibpath_overrides_runpath=no ++ need_lib_prefix=no ++ export_dynamic_flag_spec='${wl}-Blargedynsym' ++ runpath_var=LD_RUN_PATH ++ ;; ++ siemens) ++ need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no +@@ -4312,13 +6622,46 @@ + dynamic_linker=no + ;; + esac +-echo "$ac_t""$dynamic_linker" 1>&6 ++echo "$as_me:$LINENO: result: $dynamic_linker" >&5 ++echo "${ECHO_T}$dynamic_linker" >&6 + test "$dynamic_linker" = no && can_build_shared=no + + # Report the final consequences. +-echo $ac_n "checking if libtool supports shared libraries""... $ac_c" 1>&6 +-echo "configure:4321: checking if libtool supports shared libraries" >&5 +-echo "$ac_t""$can_build_shared" 1>&6 ++echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 ++echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 ++echo "$as_me:$LINENO: result: $can_build_shared" >&5 ++echo "${ECHO_T}$can_build_shared" >&6 ++ ++echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 ++echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 ++test "$can_build_shared" = "no" && enable_shared=no ++ ++# On AIX, shared libraries and static libraries use the same namespace, and ++# are all built from PIC. ++case "$host_os" in ++aix3*) ++ test "$enable_shared" = yes && enable_static=no ++ if test -n "$RANLIB"; then ++ archive_cmds="$archive_cmds~\$RANLIB \$lib" ++ postinstall_cmds='$RANLIB $lib' ++ fi ++ ;; ++ ++aix4*) ++ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then ++ test "$enable_shared" = yes && enable_static=no ++ fi ++ ;; ++esac ++echo "$as_me:$LINENO: result: $enable_shared" >&5 ++echo "${ECHO_T}$enable_shared" >&6 ++ ++echo "$as_me:$LINENO: checking whether to build static libraries" >&5 ++echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 ++# Make sure either enable_shared or enable_static is yes. ++test "$enable_shared" = yes || enable_static=yes ++echo "$as_me:$LINENO: result: $enable_static" >&5 ++echo "${ECHO_T}$enable_static" >&6 + + if test "$hardcode_action" = relink; then + # Fast installation is not supported +@@ -4355,224 +6698,398 @@ + ;; + + *) +- echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 +-echo "configure:4360: checking for dlopen in -ldl" >&5 +-ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` +-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 +-else +- ac_save_LIBS="$LIBS" +-LIBS="-ldl $LIBS" +-cat > conftest.$ac_ext <<EOF +-#line 4368 "configure" +-#include "confdefs.h" +-/* Override any gcc2 internal prototype to avoid an error. */ +-/* We use char because int might match the return type of a gcc2 +- builtin and then its argument prototype would still apply. */ +-char dlopen(); +- +-int main() { +-dlopen() +-; return 0; } +-EOF +-if { (eval echo configure:4379: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +- rm -rf conftest* +- eval "ac_cv_lib_$ac_lib_var=yes" +-else +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 +- rm -rf conftest* +- eval "ac_cv_lib_$ac_lib_var=no" +-fi +-rm -f conftest* +-LIBS="$ac_save_LIBS" +- +-fi +-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then +- echo "$ac_t""yes" 1>&6 +- lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +-else +- echo "$ac_t""no" 1>&6 +-echo $ac_n "checking for dlopen""... $ac_c" 1>&6 +-echo "configure:4398: checking for dlopen" >&5 +-if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 +-else +- cat > conftest.$ac_ext <<EOF +-#line 4403 "configure" +-#include "confdefs.h" ++ echo "$as_me:$LINENO: checking for shl_load" >&5 ++echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 ++if test "${ac_cv_func_shl_load+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ cat >conftest.$ac_ext <<_ACEOF ++#line $LINENO "configure" ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ + /* System header to define __stub macros and hopefully few prototypes, +- which can conflict with char dlopen(); below. */ +-#include <assert.h> ++ which can conflict with char shl_load (); below. ++ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since ++ <limits.h> exists even on freestanding compilers. */ ++#ifdef __STDC__ ++# include <limits.h> ++#else ++# include <assert.h> ++#endif + /* Override any gcc2 internal prototype to avoid an error. */ ++#ifdef __cplusplus ++extern "C" ++{ ++#endif + /* We use char because int might match the return type of a gcc2 +- builtin and then its argument prototype would still apply. */ +-char dlopen(); +- +-int main() { +- ++ builtin and then its argument prototype would still apply. */ ++char shl_load (); + /* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +-#if defined (__stub_dlopen) || defined (__stub___dlopen) ++#if defined (__stub_shl_load) || defined (__stub___shl_load) + choke me + #else +-dlopen(); ++char (*f) () = shl_load; ++#endif ++#ifdef __cplusplus ++} + #endif + +-; return 0; } +-EOF +-if { (eval echo configure:4426: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +- rm -rf conftest* +- eval "ac_cv_func_dlopen=yes" +-else +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 +- rm -rf conftest* +- eval "ac_cv_func_dlopen=no" +-fi +-rm -f conftest* +-fi +- +-if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then +- echo "$ac_t""yes" 1>&6 +- lt_cv_dlopen="dlopen" ++int ++main () ++{ ++return f != shl_load; ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext conftest$ac_exeext ++if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ++ (eval $ac_link) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -s conftest$ac_exeext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_cv_func_shl_load=yes ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ac_cv_func_shl_load=no ++fi ++rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext ++fi ++echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 ++echo "${ECHO_T}$ac_cv_func_shl_load" >&6 ++if test $ac_cv_func_shl_load = yes; then ++ lt_cv_dlopen="shl_load" + else +- echo "$ac_t""no" 1>&6 +-echo $ac_n "checking for shl_load""... $ac_c" 1>&6 +-echo "configure:4444: checking for shl_load" >&5 +-if eval "test \"`echo '$''{'ac_cv_func_shl_load'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 ++ echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 ++echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 ++if test "${ac_cv_lib_dld_shl_load+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 + else +- cat > conftest.$ac_ext <<EOF +-#line 4449 "configure" +-#include "confdefs.h" ++ ac_check_lib_save_LIBS=$LIBS ++LIBS="-ldld $LIBS" ++cat >conftest.$ac_ext <<_ACEOF ++#line $LINENO "configure" ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++ ++/* Override any gcc2 internal prototype to avoid an error. */ ++#ifdef __cplusplus ++extern "C" ++#endif ++/* We use char because int might match the return type of a gcc2 ++ builtin and then its argument prototype would still apply. */ ++char shl_load (); ++int ++main () ++{ ++shl_load (); ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext conftest$ac_exeext ++if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ++ (eval $ac_link) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -s conftest$ac_exeext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_cv_lib_dld_shl_load=yes ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ac_cv_lib_dld_shl_load=no ++fi ++rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext ++LIBS=$ac_check_lib_save_LIBS ++fi ++echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 ++echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 ++if test $ac_cv_lib_dld_shl_load = yes; then ++ lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" ++else ++ echo "$as_me:$LINENO: checking for dlopen" >&5 ++echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 ++if test "${ac_cv_func_dlopen+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ cat >conftest.$ac_ext <<_ACEOF ++#line $LINENO "configure" ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ + /* System header to define __stub macros and hopefully few prototypes, +- which can conflict with char shl_load(); below. */ +-#include <assert.h> ++ which can conflict with char dlopen (); below. ++ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since ++ <limits.h> exists even on freestanding compilers. */ ++#ifdef __STDC__ ++# include <limits.h> ++#else ++# include <assert.h> ++#endif + /* Override any gcc2 internal prototype to avoid an error. */ ++#ifdef __cplusplus ++extern "C" ++{ ++#endif + /* We use char because int might match the return type of a gcc2 +- builtin and then its argument prototype would still apply. */ +-char shl_load(); +- +-int main() { +- ++ builtin and then its argument prototype would still apply. */ ++char dlopen (); + /* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +-#if defined (__stub_shl_load) || defined (__stub___shl_load) ++#if defined (__stub_dlopen) || defined (__stub___dlopen) + choke me + #else +-shl_load(); ++char (*f) () = dlopen; ++#endif ++#ifdef __cplusplus ++} + #endif + +-; return 0; } +-EOF +-if { (eval echo configure:4472: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +- rm -rf conftest* +- eval "ac_cv_func_shl_load=yes" ++int ++main () ++{ ++return f != dlopen; ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext conftest$ac_exeext ++if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ++ (eval $ac_link) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -s conftest$ac_exeext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_cv_func_dlopen=yes ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ac_cv_func_dlopen=no ++fi ++rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext ++fi ++echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 ++echo "${ECHO_T}$ac_cv_func_dlopen" >&6 ++if test $ac_cv_func_dlopen = yes; then ++ lt_cv_dlopen="dlopen" + else +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 +- rm -rf conftest* +- eval "ac_cv_func_shl_load=no" +-fi +-rm -f conftest* +-fi ++ echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 ++echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 ++if test "${ac_cv_lib_dl_dlopen+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ ac_check_lib_save_LIBS=$LIBS ++LIBS="-ldl $LIBS" ++cat >conftest.$ac_ext <<_ACEOF ++#line $LINENO "configure" ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ + +-if eval "test \"`echo '$ac_cv_func_'shl_load`\" = yes"; then +- echo "$ac_t""yes" 1>&6 +- lt_cv_dlopen="shl_load" ++/* Override any gcc2 internal prototype to avoid an error. */ ++#ifdef __cplusplus ++extern "C" ++#endif ++/* We use char because int might match the return type of a gcc2 ++ builtin and then its argument prototype would still apply. */ ++char dlopen (); ++int ++main () ++{ ++dlopen (); ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext conftest$ac_exeext ++if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ++ (eval $ac_link) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -s conftest$ac_exeext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_cv_lib_dl_dlopen=yes ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ac_cv_lib_dl_dlopen=no ++fi ++rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext ++LIBS=$ac_check_lib_save_LIBS ++fi ++echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 ++echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 ++if test $ac_cv_lib_dl_dlopen = yes; then ++ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" + else +- echo "$ac_t""no" 1>&6 +-echo $ac_n "checking for dlopen in -lsvld""... $ac_c" 1>&6 +-echo "configure:4490: checking for dlopen in -lsvld" >&5 +-ac_lib_var=`echo svld'_'dlopen | sed 'y%./+-%__p_%'` +-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 ++ echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 ++echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 ++if test "${ac_cv_lib_svld_dlopen+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 + else +- ac_save_LIBS="$LIBS" ++ ac_check_lib_save_LIBS=$LIBS + LIBS="-lsvld $LIBS" +-cat > conftest.$ac_ext <<EOF +-#line 4498 "configure" +-#include "confdefs.h" ++cat >conftest.$ac_ext <<_ACEOF ++#line $LINENO "configure" ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++ + /* Override any gcc2 internal prototype to avoid an error. */ ++#ifdef __cplusplus ++extern "C" ++#endif + /* We use char because int might match the return type of a gcc2 +- builtin and then its argument prototype would still apply. */ +-char dlopen(); +- +-int main() { +-dlopen() +-; return 0; } +-EOF +-if { (eval echo configure:4509: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +- rm -rf conftest* +- eval "ac_cv_lib_$ac_lib_var=yes" +-else +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 +- rm -rf conftest* +- eval "ac_cv_lib_$ac_lib_var=no" +-fi +-rm -f conftest* +-LIBS="$ac_save_LIBS" +- +-fi +-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then +- echo "$ac_t""yes" 1>&6 ++ builtin and then its argument prototype would still apply. */ ++char dlopen (); ++int ++main () ++{ ++dlopen (); ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext conftest$ac_exeext ++if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ++ (eval $ac_link) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -s conftest$ac_exeext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_cv_lib_svld_dlopen=yes ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ac_cv_lib_svld_dlopen=no ++fi ++rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext ++LIBS=$ac_check_lib_save_LIBS ++fi ++echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 ++echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 ++if test $ac_cv_lib_svld_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" + else +- echo "$ac_t""no" 1>&6 +-echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6 +-echo "configure:4528: checking for shl_load in -ldld" >&5 +-ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'` +-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 ++ echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 ++echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 ++if test "${ac_cv_lib_dld_dld_link+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 + else +- ac_save_LIBS="$LIBS" ++ ac_check_lib_save_LIBS=$LIBS + LIBS="-ldld $LIBS" +-cat > conftest.$ac_ext <<EOF +-#line 4536 "configure" +-#include "confdefs.h" ++cat >conftest.$ac_ext <<_ACEOF ++#line $LINENO "configure" ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++ + /* Override any gcc2 internal prototype to avoid an error. */ ++#ifdef __cplusplus ++extern "C" ++#endif + /* We use char because int might match the return type of a gcc2 +- builtin and then its argument prototype would still apply. */ +-char shl_load(); +- +-int main() { +-shl_load() +-; return 0; } +-EOF +-if { (eval echo configure:4547: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +- rm -rf conftest* +- eval "ac_cv_lib_$ac_lib_var=yes" +-else +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 +- rm -rf conftest* +- eval "ac_cv_lib_$ac_lib_var=no" ++ builtin and then its argument prototype would still apply. */ ++char dld_link (); ++int ++main () ++{ ++dld_link (); ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext conftest$ac_exeext ++if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ++ (eval $ac_link) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -s conftest$ac_exeext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_cv_lib_dld_dld_link=yes ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ac_cv_lib_dld_dld_link=no ++fi ++rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext ++LIBS=$ac_check_lib_save_LIBS ++fi ++echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 ++echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 ++if test $ac_cv_lib_dld_dld_link = yes; then ++ lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" + fi +-rm -f conftest* +-LIBS="$ac_save_LIBS" + +-fi +-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then +- echo "$ac_t""yes" 1>&6 +- lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" +-else +- echo "$ac_t""no" 1>&6 ++ + fi + +- ++ + fi + +- ++ + fi + +- ++ + fi + +- ++ + fi + + ;; +@@ -4595,10 +7112,10 @@ + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + +- echo $ac_n "checking whether a program can dlopen itself""... $ac_c" 1>&6 +-echo "configure:4600: checking whether a program can dlopen itself" >&5 +-if eval "test \"`echo '$''{'lt_cv_dlopen_self'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 ++ echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 ++echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 ++if test "${lt_cv_dlopen_self+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 + else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +@@ -4606,7 +7123,7 @@ + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<EOF +-#line 4610 "configure" ++#line 7126 "configure" + #include "confdefs.h" + + #if HAVE_DLFCN_H +@@ -4667,7 +7184,11 @@ + exit (status); + } + EOF +- if { (eval echo configure:4671: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} 2>/dev/null; then ++ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ++ (eval $ac_link) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in +@@ -4682,17 +7203,17 @@ + fi + rm -fr conftest* + +- +-fi + +-echo "$ac_t""$lt_cv_dlopen_self" 1>&6 ++fi ++echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 ++echo "${ECHO_T}$lt_cv_dlopen_self" >&6 + + if test "x$lt_cv_dlopen_self" = xyes; then + LDFLAGS="$LDFLAGS $link_static_flag" +- echo $ac_n "checking whether a statically linked program can dlopen itself""... $ac_c" 1>&6 +-echo "configure:4694: checking whether a statically linked program can dlopen itself" >&5 +-if eval "test \"`echo '$''{'lt_cv_dlopen_self_static'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 ++ echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 ++echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 ++if test "${lt_cv_dlopen_self_static+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 + else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +@@ -4700,7 +7221,7 @@ + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<EOF +-#line 4704 "configure" ++#line 7224 "configure" + #include "confdefs.h" + + #if HAVE_DLFCN_H +@@ -4761,7 +7282,11 @@ + exit (status); + } + EOF +- if { (eval echo configure:4765: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} 2>/dev/null; then ++ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ++ (eval $ac_link) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in +@@ -4776,10 +7301,10 @@ + fi + rm -fr conftest* + +- +-fi + +-echo "$ac_t""$lt_cv_dlopen_self_static" 1>&6 ++fi ++echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 ++echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 + fi + + CPPFLAGS="$save_CPPFLAGS" +@@ -4809,15 +7334,19 @@ + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. +- echo $ac_n "checking whether -lc should be explicitly linked in""... $ac_c" 1>&6 +-echo "configure:4814: checking whether -lc should be explicitly linked in" >&5 +- if eval "test \"`echo '$''{'lt_cv_archive_cmds_need_lc'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 ++ echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 ++echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 ++ if test "${lt_cv_archive_cmds_need_lc+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 + else + $rm conftest* + echo 'static int dummy;' > conftest.$ac_ext + +- if { (eval echo configure:4821: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then ++ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext +@@ -4830,7 +7359,11 @@ + libname=conftest + save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= +- if { (eval echo configure:4834: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\") 1>&5; (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5; } ++ if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 ++ (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } + then + lt_cv_archive_cmds_need_lc=no + else +@@ -4842,7 +7375,8 @@ + fi + fi + +- echo "$ac_t""$lt_cv_archive_cmds_need_lc" 1>&6 ++ echo "$as_me:$LINENO: result: $lt_cv_archive_cmds_need_lc" >&5 ++echo "${ECHO_T}$lt_cv_archive_cmds_need_lc" >&6 + ;; + esac + fi +@@ -4870,7 +7404,7 @@ + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. +- for var in echo old_CC old_CFLAGS \ ++ for var in echo old_CC old_CFLAGS SED \ + AR AR_FLAGS CC LD LN_S NM SHELL \ + reload_flag reload_cmds wl \ + pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ +@@ -4882,6 +7416,7 @@ + old_striplib striplib file_magic_cmd export_symbols_cmds \ + deplibs_check_method allow_undefined_flag no_undefined_flag \ + finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ ++ global_symbol_to_c_name_address \ + hardcode_libdir_flag_spec hardcode_libdir_separator \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do +@@ -4931,8 +7466,11 @@ + # configuration script generated by Autoconf, you may include it under + # the same distribution terms that you use for the rest of that program. + ++# A sed that does not truncate output. ++SED=$lt_SED ++ + # Sed that helps us avoid accidentally triggering echo(1) options like -n. +-Xsed="sed -e s/^X//" ++Xsed="${SED} -e s/^X//" + + # The HP-UX ksh and POSIX shell print the target directory to stdout + # if CDPATH is set. +@@ -4948,12 +7486,12 @@ + # Whether or not to build shared libraries. + build_libtool_libs=$enable_shared + +-# Whether or not to add -lc for building shared libraries. +-build_libtool_need_lc=$need_lc +- + # Whether or not to build static libraries. + build_old_libs=$enable_static + ++# Whether or not to add -lc for building shared libraries. ++build_libtool_need_lc=$need_lc ++ + # Whether or not to optimize for fast installation. + fast_install=$enable_fast_install + +@@ -5119,6 +7657,9 @@ + # Transform the output of nm in a proper C declaration + global_symbol_to_cdecl=$lt_global_symbol_to_cdecl + ++# Transform the output of nm in a C name address pair ++global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address ++ + # This is the shared library runtime path variable. + runpath_var=$runpath_var + +@@ -5241,9 +7782,9 @@ + # return TRUE; + # } + # /* ltdll.c ends here */ +- # This is a source program that is used to create import libraries +- # on Windows for dlls which lack them. Don't remove nor modify the +- # starting and closing comments ++ # This is a source program that is used to create import libraries ++ # on Windows for dlls which lack them. Don't remove nor modify the ++ # starting and closing comments + # /* impgen.c starts here */ + # /* Copyright (C) 1999-2000 Free Software Foundation, Inc. + # +@@ -5411,156 +7952,386 @@ + + # Extract the first word of "perl", so it can be a program name with args. + set dummy perl; ac_word=$2 +-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +-echo "configure:5416: checking for $ac_word" >&5 +-if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 ++echo "$as_me:$LINENO: checking for $ac_word" >&5 ++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 ++if test "${ac_cv_path_PERL+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 + else +- case "$PERL" in +- /*) ++ case $PERL in ++ [\\/]* | ?:[\\/]*) + ac_cv_path_PERL="$PERL" # Let the user override the test with a path. + ;; +- ?:/*) +- ac_cv_path_PERL="$PERL" # Let the user override the test with a dos path. +- ;; + *) +- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" +- ac_dummy="$PATH" +- for ac_dir in $ac_dummy; do +- test -z "$ac_dir" && ac_dir=. +- if test -f $ac_dir/$ac_word; then +- ac_cv_path_PERL="$ac_dir/$ac_word" +- break +- fi +- done +- IFS="$ac_save_ifs" ++ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext" ++ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++done ++ + ;; + esac + fi +-PERL="$ac_cv_path_PERL" ++PERL=$ac_cv_path_PERL ++ + if test -n "$PERL"; then +- echo "$ac_t""$PERL" 1>&6 ++ echo "$as_me:$LINENO: result: $PERL" >&5 ++echo "${ECHO_T}$PERL" >&6 + else +- echo "$ac_t""no" 1>&6 ++ echo "$as_me:$LINENO: result: no" >&5 ++echo "${ECHO_T}no" >&6 + fi + + + + +-ac_safe=`echo "asm/errno.h" | sed 'y%./+-%__p_%'` +-echo $ac_n "checking for asm/errno.h""... $ac_c" 1>&6 +-echo "configure:5453: checking for asm/errno.h" >&5 +-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 ++if test "${ac_cv_header_asm_errno_h+set}" = set; then ++ echo "$as_me:$LINENO: checking for asm/errno.h" >&5 ++echo $ECHO_N "checking for asm/errno.h... $ECHO_C" >&6 ++if test "${ac_cv_header_asm_errno_h+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++fi ++echo "$as_me:$LINENO: result: $ac_cv_header_asm_errno_h" >&5 ++echo "${ECHO_T}$ac_cv_header_asm_errno_h" >&6 + else +- cat > conftest.$ac_ext <<EOF +-#line 5458 "configure" +-#include "confdefs.h" ++ # Is the header compilable? ++echo "$as_me:$LINENO: checking asm/errno.h usability" >&5 ++echo $ECHO_N "checking asm/errno.h usability... $ECHO_C" >&6 ++cat >conftest.$ac_ext <<_ACEOF ++#line $LINENO "configure" ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++$ac_includes_default + #include <asm/errno.h> +-EOF +-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +-{ (eval echo configure:5463: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +-if test -z "$ac_err"; then +- rm -rf conftest* +- eval "ac_cv_header_$ac_safe=yes" ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_header_compiler=yes ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ac_header_compiler=no ++fi ++rm -f conftest.$ac_objext conftest.$ac_ext ++echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 ++echo "${ECHO_T}$ac_header_compiler" >&6 ++ ++# Is the header present? ++echo "$as_me:$LINENO: checking asm/errno.h presence" >&5 ++echo $ECHO_N "checking asm/errno.h presence... $ECHO_C" >&6 ++cat >conftest.$ac_ext <<_ACEOF ++#line $LINENO "configure" ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++#include <asm/errno.h> ++_ACEOF ++if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 ++ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } >/dev/null; then ++ if test -s conftest.err; then ++ ac_cpp_err=$ac_c_preproc_warn_flag ++ else ++ ac_cpp_err= ++ fi + else +- echo "$ac_err" >&5 +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 +- rm -rf conftest* +- eval "ac_cv_header_$ac_safe=no" ++ ac_cpp_err=yes + fi +-rm -f conftest* ++if test -z "$ac_cpp_err"; then ++ ac_header_preproc=yes ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ ac_header_preproc=no ++fi ++rm -f conftest.err conftest.$ac_ext ++echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 ++echo "${ECHO_T}$ac_header_preproc" >&6 ++ ++# So? What about this header? ++case $ac_header_compiler:$ac_header_preproc in ++ yes:no ) ++ { echo "$as_me:$LINENO: WARNING: asm/errno.h: accepted by the compiler, rejected by the preprocessor!" >&5 ++echo "$as_me: WARNING: asm/errno.h: accepted by the compiler, rejected by the preprocessor!" >&2;} ++ { echo "$as_me:$LINENO: WARNING: asm/errno.h: proceeding with the preprocessor's result" >&5 ++echo "$as_me: WARNING: asm/errno.h: proceeding with the preprocessor's result" >&2;} ++ ( ++ cat <<\_ASBOX ++## ------------------------------------ ## ++## Report this to bug-autoconf@gnu.org. ## ++## ------------------------------------ ## ++_ASBOX ++ ) | ++ sed "s/^/$as_me: WARNING: /" >&2 ++ ;; ++ no:yes ) ++ { echo "$as_me:$LINENO: WARNING: asm/errno.h: present but cannot be compiled" >&5 ++echo "$as_me: WARNING: asm/errno.h: present but cannot be compiled" >&2;} ++ { echo "$as_me:$LINENO: WARNING: asm/errno.h: check for missing prerequisite headers?" >&5 ++echo "$as_me: WARNING: asm/errno.h: check for missing prerequisite headers?" >&2;} ++ { echo "$as_me:$LINENO: WARNING: asm/errno.h: proceeding with the preprocessor's result" >&5 ++echo "$as_me: WARNING: asm/errno.h: proceeding with the preprocessor's result" >&2;} ++ ( ++ cat <<\_ASBOX ++## ------------------------------------ ## ++## Report this to bug-autoconf@gnu.org. ## ++## ------------------------------------ ## ++_ASBOX ++ ) | ++ sed "s/^/$as_me: WARNING: /" >&2 ++ ;; ++esac ++echo "$as_me:$LINENO: checking for asm/errno.h" >&5 ++echo $ECHO_N "checking for asm/errno.h... $ECHO_C" >&6 ++if test "${ac_cv_header_asm_errno_h+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ ac_cv_header_asm_errno_h=$ac_header_preproc ++fi ++echo "$as_me:$LINENO: result: $ac_cv_header_asm_errno_h" >&5 ++echo "${ECHO_T}$ac_cv_header_asm_errno_h" >&6 ++ + fi +-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then +- echo "$ac_t""yes" 1>&6 ++if test $ac_cv_header_asm_errno_h = yes; then + : + else +- echo "$ac_t""no" 1>&6 +-{ echo "configure: error: *** Unable to find asm/errno.h!!!" 1>&2; exit 1; } ++ { { echo "$as_me:$LINENO: error: *** Unable to find asm/errno.h!!!" >&5 ++echo "$as_me: error: *** Unable to find asm/errno.h!!!" >&2;} ++ { (exit 1); exit 1; }; } + + fi + + +-ac_safe=`echo "linux/atmsap.h" | sed 'y%./+-%__p_%'` +-echo $ac_n "checking for linux/atmsap.h""... $ac_c" 1>&6 +-echo "configure:5489: checking for linux/atmsap.h" >&5 +-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 +-else +- cat > conftest.$ac_ext <<EOF +-#line 5494 "configure" +-#include "confdefs.h" ++ ++if test "${ac_cv_header_linux_atmsap_h+set}" = set; then ++ echo "$as_me:$LINENO: checking for linux/atmsap.h" >&5 ++echo $ECHO_N "checking for linux/atmsap.h... $ECHO_C" >&6 ++if test "${ac_cv_header_linux_atmsap_h+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++fi ++echo "$as_me:$LINENO: result: $ac_cv_header_linux_atmsap_h" >&5 ++echo "${ECHO_T}$ac_cv_header_linux_atmsap_h" >&6 ++else ++ # Is the header compilable? ++echo "$as_me:$LINENO: checking linux/atmsap.h usability" >&5 ++echo $ECHO_N "checking linux/atmsap.h usability... $ECHO_C" >&6 ++cat >conftest.$ac_ext <<_ACEOF ++#line $LINENO "configure" ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++$ac_includes_default + #include <linux/atmsap.h> +-EOF +-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +-{ (eval echo configure:5499: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +-if test -z "$ac_err"; then +- rm -rf conftest* +- eval "ac_cv_header_$ac_safe=yes" ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_header_compiler=yes ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ac_header_compiler=no ++fi ++rm -f conftest.$ac_objext conftest.$ac_ext ++echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 ++echo "${ECHO_T}$ac_header_compiler" >&6 ++ ++# Is the header present? ++echo "$as_me:$LINENO: checking linux/atmsap.h presence" >&5 ++echo $ECHO_N "checking linux/atmsap.h presence... $ECHO_C" >&6 ++cat >conftest.$ac_ext <<_ACEOF ++#line $LINENO "configure" ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++#include <linux/atmsap.h> ++_ACEOF ++if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 ++ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } >/dev/null; then ++ if test -s conftest.err; then ++ ac_cpp_err=$ac_c_preproc_warn_flag ++ else ++ ac_cpp_err= ++ fi + else +- echo "$ac_err" >&5 +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 +- rm -rf conftest* +- eval "ac_cv_header_$ac_safe=no" ++ ac_cpp_err=yes + fi +-rm -f conftest* ++if test -z "$ac_cpp_err"; then ++ ac_header_preproc=yes ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ ac_header_preproc=no ++fi ++rm -f conftest.err conftest.$ac_ext ++echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 ++echo "${ECHO_T}$ac_header_preproc" >&6 ++ ++# So? What about this header? ++case $ac_header_compiler:$ac_header_preproc in ++ yes:no ) ++ { echo "$as_me:$LINENO: WARNING: linux/atmsap.h: accepted by the compiler, rejected by the preprocessor!" >&5 ++echo "$as_me: WARNING: linux/atmsap.h: accepted by the compiler, rejected by the preprocessor!" >&2;} ++ { echo "$as_me:$LINENO: WARNING: linux/atmsap.h: proceeding with the preprocessor's result" >&5 ++echo "$as_me: WARNING: linux/atmsap.h: proceeding with the preprocessor's result" >&2;} ++ ( ++ cat <<\_ASBOX ++## ------------------------------------ ## ++## Report this to bug-autoconf@gnu.org. ## ++## ------------------------------------ ## ++_ASBOX ++ ) | ++ sed "s/^/$as_me: WARNING: /" >&2 ++ ;; ++ no:yes ) ++ { echo "$as_me:$LINENO: WARNING: linux/atmsap.h: present but cannot be compiled" >&5 ++echo "$as_me: WARNING: linux/atmsap.h: present but cannot be compiled" >&2;} ++ { echo "$as_me:$LINENO: WARNING: linux/atmsap.h: check for missing prerequisite headers?" >&5 ++echo "$as_me: WARNING: linux/atmsap.h: check for missing prerequisite headers?" >&2;} ++ { echo "$as_me:$LINENO: WARNING: linux/atmsap.h: proceeding with the preprocessor's result" >&5 ++echo "$as_me: WARNING: linux/atmsap.h: proceeding with the preprocessor's result" >&2;} ++ ( ++ cat <<\_ASBOX ++## ------------------------------------ ## ++## Report this to bug-autoconf@gnu.org. ## ++## ------------------------------------ ## ++_ASBOX ++ ) | ++ sed "s/^/$as_me: WARNING: /" >&2 ++ ;; ++esac ++echo "$as_me:$LINENO: checking for linux/atmsap.h" >&5 ++echo $ECHO_N "checking for linux/atmsap.h... $ECHO_C" >&6 ++if test "${ac_cv_header_linux_atmsap_h+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ ac_cv_header_linux_atmsap_h=$ac_header_preproc + fi +-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then +- echo "$ac_t""yes" 1>&6 ++echo "$as_me:$LINENO: result: $ac_cv_header_linux_atmsap_h" >&5 ++echo "${ECHO_T}$ac_cv_header_linux_atmsap_h" >&6 ++ ++fi ++if test $ac_cv_header_linux_atmsap_h = yes; then + : + else +- echo "$ac_t""no" 1>&6 +-{ echo "configure: error: *** Unable to find linux/atmsap.h!!!" 1>&2; exit 1; } ++ { { echo "$as_me:$LINENO: error: *** Unable to find linux/atmsap.h!!!" >&5 ++echo "$as_me: error: *** Unable to find linux/atmsap.h!!!" >&2;} ++ { (exit 1); exit 1; }; } + + fi + + +-echo $ac_n "checking for main in -lresolv""... $ac_c" 1>&6 +-echo "configure:5524: checking for main in -lresolv" >&5 +-ac_lib_var=`echo resolv'_'main | sed 'y%./+-%__p_%'` +-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 ++ ++ ++echo "$as_me:$LINENO: checking for main in -lresolv" >&5 ++echo $ECHO_N "checking for main in -lresolv... $ECHO_C" >&6 ++if test "${ac_cv_lib_resolv_main+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 + else +- ac_save_LIBS="$LIBS" ++ ac_check_lib_save_LIBS=$LIBS + LIBS="-lresolv $LIBS" +-cat > conftest.$ac_ext <<EOF +-#line 5532 "configure" +-#include "confdefs.h" ++cat >conftest.$ac_ext <<_ACEOF ++#line $LINENO "configure" ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ + +-int main() { +-main() +-; return 0; } +-EOF +-if { (eval echo configure:5539: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +- rm -rf conftest* +- eval "ac_cv_lib_$ac_lib_var=yes" +-else +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 +- rm -rf conftest* +- eval "ac_cv_lib_$ac_lib_var=no" +-fi +-rm -f conftest* +-LIBS="$ac_save_LIBS" + +-fi +-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then +- echo "$ac_t""yes" 1>&6 +- ac_tr_lib=HAVE_LIB`echo resolv | sed -e 's/[^a-zA-Z0-9_]/_/g' \ +- -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` +- cat >> confdefs.h <<EOF +-#define $ac_tr_lib 1 +-EOF ++int ++main () ++{ ++main (); ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext conftest$ac_exeext ++if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ++ (eval $ac_link) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -s conftest$ac_exeext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_cv_lib_resolv_main=yes ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ac_cv_lib_resolv_main=no ++fi ++rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext ++LIBS=$ac_check_lib_save_LIBS ++fi ++echo "$as_me:$LINENO: result: $ac_cv_lib_resolv_main" >&5 ++echo "${ECHO_T}$ac_cv_lib_resolv_main" >&6 ++if test $ac_cv_lib_resolv_main = yes; then ++ cat >>confdefs.h <<_ACEOF ++#define HAVE_LIBRESOLV 1 ++_ACEOF + + LIBS="-lresolv $LIBS" + + else +- echo "$ac_t""no" 1>&6 +-{ echo "configure: error: *** Unable to find libresolv!!!" 1>&2; exit 1; } ++ { { echo "$as_me:$LINENO: error: *** Unable to find libresolv!!!" >&5 ++echo "$as_me: error: *** Unable to find libresolv!!!" >&2;} ++ { (exit 1); exit 1; }; } + + fi + +@@ -5571,639 +8342,1417 @@ + CFLAGS="$INCLUDES $CFLAGS -Wall -Wshadow -Wpointer-arith -Wwrite-strings -Wstrict-prototypes" + YACC="$YACC -d" + +-cat >> confdefs.h <<\EOF ++cat >>confdefs.h <<\_ACEOF + #define YY_USE_CONST 1 +-EOF ++_ACEOF + + + atmsigd_conf_dir=` test "x$exec_prefix" = xNONE && exec_prefix=$ac_default_prefix + test "x$prefix" = xNONE && prefix=${exec_prefix} + eval echo "$sysconfdir"` +-cat >> confdefs.h <<EOF ++cat >>confdefs.h <<_ACEOF + #define ATMSIGD_CONF "$atmsigd_conf_dir/atmsigd.conf" +-EOF ++_ACEOF ++ + + + # Check whether --with-uni or --without-uni was given. + if test "${with_uni+set}" = set; then + withval="$with_uni" +- ++ + case "$with_uni" in +- "3.0" ) cat >> confdefs.h <<\EOF ++ "3.0" ) cat >>confdefs.h <<\_ACEOF + #define UNI30 1 +-EOF ++_ACEOF + + ;; +- "3.1" ) cat >> confdefs.h <<\EOF ++ "3.1" ) cat >>confdefs.h <<\_ACEOF + #define UNI31 1 +-EOF ++_ACEOF + + ;; +- "4.0" ) cat >> confdefs.h <<\EOF ++ "4.0" ) cat >>confdefs.h <<\_ACEOF + #define UNI40 1 +-EOF ++_ACEOF + + ;; + *) +- cat >> confdefs.h <<\EOF ++ cat >>confdefs.h <<\_ACEOF + #define DYNAMIC_UNI 1 +-EOF ++_ACEOF + +- echo "configure: warning: *** UNI version not specified correctly. Defaulting to dynamic UNI." 1>&2 ++ { echo "$as_me:$LINENO: WARNING: *** UNI version not specified correctly. Defaulting to dynamic UNI." >&5 ++echo "$as_me: WARNING: *** UNI version not specified correctly. Defaulting to dynamic UNI." >&2;} + esac +- ++ + else +- cat >> confdefs.h <<\EOF ++ cat >>confdefs.h <<\_ACEOF + #define DYNAMIC_UNI 1 +-EOF ++_ACEOF + + +-fi +- ++fi; + + # Check whether --enable-allow_uni30 or --disable-allow_uni30 was given. + if test "${enable_allow_uni30+set}" = set; then + enableval="$enable_allow_uni30" +- ++ + if test "$with_uni" = "3.1" ; then +- cat >> confdefs.h <<\EOF ++ cat >>confdefs.h <<\_ACEOF + #define ALLOW_UNI30 1 +-EOF ++_ACEOF + + else +- echo "configure: warning: *** Allow UNI 3.0 was not enabled. It is only valid when UNI 3.1 is specified as the default via --with-uni." 1>&2 ++ { echo "$as_me:$LINENO: WARNING: *** Allow UNI 3.0 was not enabled. It is only valid when UNI 3.1 is specified as the default via --with-uni." >&5 ++echo "$as_me: WARNING: *** Allow UNI 3.0 was not enabled. It is only valid when UNI 3.1 is specified as the default via --with-uni." >&2;} + fi +- + +-fi + ++fi; + + # Check whether --enable-q2963_1 or --disable-q2963_1 was given. + if test "${enable_q2963_1+set}" = set; then + enableval="$enable_q2963_1" +- ++ + if test "$with_uni" = "4.0" ; then +- cat >> confdefs.h <<\EOF ++ cat >>confdefs.h <<\_ACEOF + #define Q2963_1 1 +-EOF ++_ACEOF + + else +- echo "configure: warning: *** Q.2963.1 was not enabled. It is only valid when UNI 4.0 is specified as the default via --with-uni." 1>&2 ++ { echo "$as_me:$LINENO: WARNING: *** Q.2963.1 was not enabled. It is only valid when UNI 4.0 is specified as the default via --with-uni." >&5 ++echo "$as_me: WARNING: *** Q.2963.1 was not enabled. It is only valid when UNI 4.0 is specified as the default via --with-uni." >&2;} + fi +- + +-fi + ++fi; + + # Check whether --enable-cisco or --disable-cisco was given. + if test "${enable_cisco+set}" = set; then + enableval="$enable_cisco" +- cat >> confdefs.h <<\EOF ++ cat >>confdefs.h <<\_ACEOF + #define CISCO 1 +-EOF ++_ACEOF + + +-fi +- ++fi; + + # Check whether --enable-thomflex or --disable-thomflex was given. + if test "${enable_thomflex+set}" = set; then + enableval="$enable_thomflex" +- cat >> confdefs.h <<\EOF ++ cat >>confdefs.h <<\_ACEOF + #define THOMFLEX 1 +-EOF +- ++_ACEOF + +-fi + ++fi; + +-cat >> confdefs.h <<\EOF ++cat >>confdefs.h <<\_ACEOF + #define BROKEN_POLL 1 +-EOF ++_ACEOF + + + # Check whether --enable-mpoa_1_1 or --disable-mpoa_1_1 was given. + if test "${enable_mpoa_1_1+set}" = set; then + enableval="$enable_mpoa_1_1" +- cat >> confdefs.h <<\EOF ++ cat >>confdefs.h <<\_ACEOF + #define MPOA_1_1 1 +-EOF +- ++_ACEOF + +-fi + ++fi; + + # Check whether --enable-mpr or --disable-mpr was given. + if test "${enable_mpr+set}" = set; then + enableval="$enable_mpr" +- ++ + case "$enable_mpr" in + "" | y | ye | yes | Y | YE | YES ) +- echo $ac_n "checking for main in -lmpr""... $ac_c" 1>&6 +-echo "configure:5704: checking for main in -lmpr" >&5 +-ac_lib_var=`echo mpr'_'main | sed 'y%./+-%__p_%'` +-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 ++ ++echo "$as_me:$LINENO: checking for main in -lmpr" >&5 ++echo $ECHO_N "checking for main in -lmpr... $ECHO_C" >&6 ++if test "${ac_cv_lib_mpr_main+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 + else +- ac_save_LIBS="$LIBS" ++ ac_check_lib_save_LIBS=$LIBS + LIBS="-lmpr $LIBS" +-cat > conftest.$ac_ext <<EOF +-#line 5712 "configure" +-#include "confdefs.h" ++cat >conftest.$ac_ext <<_ACEOF ++#line $LINENO "configure" ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ + +-int main() { +-main() +-; return 0; } +-EOF +-if { (eval echo configure:5719: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +- rm -rf conftest* +- eval "ac_cv_lib_$ac_lib_var=yes" +-else +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 +- rm -rf conftest* +- eval "ac_cv_lib_$ac_lib_var=no" +-fi +-rm -f conftest* +-LIBS="$ac_save_LIBS" + +-fi +-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then +- echo "$ac_t""yes" 1>&6 +- ac_tr_lib=HAVE_LIB`echo mpr | sed -e 's/[^a-zA-Z0-9_]/_/g' \ +- -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` +- cat >> confdefs.h <<EOF +-#define $ac_tr_lib 1 +-EOF ++int ++main () ++{ ++main (); ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext conftest$ac_exeext ++if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ++ (eval $ac_link) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -s conftest$ac_exeext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_cv_lib_mpr_main=yes ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ac_cv_lib_mpr_main=no ++fi ++rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext ++LIBS=$ac_check_lib_save_LIBS ++fi ++echo "$as_me:$LINENO: result: $ac_cv_lib_mpr_main" >&5 ++echo "${ECHO_T}$ac_cv_lib_mpr_main" >&6 ++if test $ac_cv_lib_mpr_main = yes; then ++ cat >>confdefs.h <<_ACEOF ++#define HAVE_LIBMPR 1 ++_ACEOF + + LIBS="-lmpr $LIBS" + + else +- echo "$ac_t""no" 1>&6 + +- echo "configure: warning: *** Could not find libmpr! Is MPR installed?" 1>&2 +- +- ++ { echo "$as_me:$LINENO: WARNING: *** Could not find libmpr! Is MPR installed?" >&5 ++echo "$as_me: WARNING: *** Could not find libmpr! Is MPR installed?" >&2;} ++ ++ + fi + + ;; + esac +- + +-fi + ++fi; + + +-trap '' 1 2 15 +-cat > confcache <<\EOF ++ ac_config_files="$ac_config_files Makefile doc/Makefile m4/Makefile src/Makefile src/include/Makefile src/lib/Makefile src/test/Makefile src/debug/Makefile src/qgen/Makefile src/saal/Makefile src/sigd/Makefile src/maint/Makefile src/arpd/Makefile src/ilmid/Makefile src/ilmid/asn1/Makefile src/man/Makefile src/led/Makefile src/lane/Makefile src/mpoad/Makefile src/switch/Makefile src/switch/debug/Makefile src/switch/tcp/Makefile src/config/Makefile src/config/init-redhat/Makefile src/extra/Makefile src/extra/linux-atm.spec src/extra/ANS/Makefile" ++cat >confcache <<\_ACEOF + # This file is a shell script that caches the results of configure + # tests run on this system so they can be shared between configure +-# scripts and configure runs. It is not useful on other systems. +-# If it contains results you don't want to keep, you may remove or edit it. ++# scripts and configure runs, see configure's option --config-cache. ++# It is not useful on other systems. If it contains results you don't ++# want to keep, you may remove or edit it. + # +-# By default, configure uses ./config.cache as the cache file, +-# creating it if it does not exist already. You can give configure +-# the --cache-file=FILE option to use a different cache file; that is +-# what configure does when it calls configure scripts in +-# subdirectories, so they share the cache. +-# Giving --cache-file=/dev/null disables caching, for debugging configure. +-# config.status only pays attention to the cache file if you give it the +-# --recheck option to rerun configure. ++# config.status only pays attention to the cache file if you give it ++# the --recheck option to rerun configure. + # +-EOF ++# `ac_cv_env_foo' variables (set or unset) will be overridden when ++# loading this file, other *unset* `ac_cv_foo' will be assigned the ++# following values. ++ ++_ACEOF ++ + # The following way of writing the cache mishandles newlines in values, + # but we know of no workaround that is simple, portable, and efficient. + # So, don't put newlines in cache variables' values. + # Ultrix sh set writes to stderr and can't be redirected directly, + # and sets the high bit in the cache file unless we assign to the vars. +-(set) 2>&1 | +- case `(ac_space=' '; set | grep ac_space) 2>&1` in +- *ac_space=\ *) +- # `set' does not quote correctly, so add quotes (double-quote substitution +- # turns \\\\ into \\, and sed turns \\ into \). +- sed -n \ +- -e "s/'/'\\\\''/g" \ +- -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" +- ;; +- *) +- # `set' quotes correctly as required by POSIX, so do not add quotes. +- sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' +- ;; +- esac >> confcache +-if cmp -s $cache_file confcache; then +- : +-else ++{ ++ (set) 2>&1 | ++ case `(ac_space=' '; set | grep ac_space) 2>&1` in ++ *ac_space=\ *) ++ # `set' does not quote correctly, so add quotes (double-quote ++ # substitution turns \\\\ into \\, and sed turns \\ into \). ++ sed -n \ ++ "s/'/'\\\\''/g; ++ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ++ ;; ++ *) ++ # `set' quotes correctly as required by POSIX, so do not add quotes. ++ sed -n \ ++ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ++ ;; ++ esac; ++} | ++ sed ' ++ t clear ++ : clear ++ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ ++ t end ++ /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ ++ : end' >>confcache ++if diff $cache_file confcache >/dev/null 2>&1; then :; else + if test -w $cache_file; then +- echo "updating cache $cache_file" +- cat confcache > $cache_file ++ test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" ++ cat confcache >$cache_file + else + echo "not updating unwritable cache $cache_file" + fi + fi + rm -f confcache + +-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 +- + test "x$prefix" = xNONE && prefix=$ac_default_prefix + # Let make expand exec_prefix. + test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +-# Any assignment to VPATH causes Sun make to only execute +-# the first set of double-colon rules, so remove it if not needed. +-# If there is a colon in the path, we need to keep it. ++# VPATH may cause trouble with some makes, so we remove $(srcdir), ++# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and ++# trailing colons and then remove the whole line if VPATH becomes empty ++# (actually we leave an empty line to preserve line numbers). + if test "x$srcdir" = x.; then +- ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' ++ ac_vpsub='/^[ ]*VPATH[ ]*=/{ ++s/:*\$(srcdir):*/:/; ++s/:*\${srcdir}:*/:/; ++s/:*@srcdir@:*/:/; ++s/^\([^=]*=[ ]*\):*/\1/; ++s/:*$//; ++s/^[^=]*=[ ]*$//; ++}' + fi + +-trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 +- + DEFS=-DHAVE_CONFIG_H + +-# Without the "./", some shells look in PATH for config.status. +-: ${CONFIG_STATUS=./config.status} ++ac_libobjs= ++ac_ltlibobjs= ++for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue ++ # 1. Remove the extension, and $U if already installed. ++ ac_i=`echo "$ac_i" | ++ sed 's/\$U\././;s/\.o$//;s/\.obj$//'` ++ # 2. Add them. ++ ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ++ ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' ++done ++LIBOBJS=$ac_libobjs + +-echo creating $CONFIG_STATUS +-rm -f $CONFIG_STATUS +-cat > $CONFIG_STATUS <<EOF +-#! /bin/sh +-# Generated automatically by configure. ++LTLIBOBJS=$ac_ltlibobjs ++ ++ ++ ++: ${CONFIG_STATUS=./config.status} ++ac_clean_files_save=$ac_clean_files ++ac_clean_files="$ac_clean_files $CONFIG_STATUS" ++{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 ++echo "$as_me: creating $CONFIG_STATUS" >&6;} ++cat >$CONFIG_STATUS <<_ACEOF ++#! $SHELL ++# Generated by $as_me. + # Run this file to recreate the current configuration. +-# This directory was configured as follows, +-# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +-# +-# $0 $ac_configure_args +-# + # Compiler output produced by configure, useful for debugging +-# configure, is in ./config.log if it exists. ++# configure, is in config.log if it exists. + +-ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +-for ac_option ++debug=false ++ac_cs_recheck=false ++ac_cs_silent=false ++SHELL=\${CONFIG_SHELL-$SHELL} ++_ACEOF ++ ++cat >>$CONFIG_STATUS <<\_ACEOF ++## --------------------- ## ++## M4sh Initialization. ## ++## --------------------- ## ++ ++# Be Bourne compatible ++if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then ++ emulate sh ++ NULLCMD=: ++ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which ++ # is contrary to our usage. Disable this feature. ++ alias -g '${1+"$@"}'='"$@"' ++elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then ++ set -o posix ++fi ++ ++# Support unset when possible. ++if (FOO=FOO; unset FOO) >/dev/null 2>&1; then ++ as_unset=unset ++else ++ as_unset=false ++fi ++ ++ ++# Work around bugs in pre-3.0 UWIN ksh. ++$as_unset ENV MAIL MAILPATH ++PS1='$ ' ++PS2='> ' ++PS4='+ ' ++ ++# NLS nuisances. ++for as_var in \ ++ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ ++ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ ++ LC_TELEPHONE LC_TIME + do +- case "\$ac_option" in +- -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) +- echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" +- exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; +- -version | --version | --versio | --versi | --vers | --ver | --ve | --v) +- echo "$CONFIG_STATUS generated by autoconf version 2.13" +- exit 0 ;; +- -help | --help | --hel | --he | --h) +- echo "\$ac_cs_usage"; exit 0 ;; +- *) echo "\$ac_cs_usage"; exit 1 ;; ++ if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then ++ eval $as_var=C; export $as_var ++ else ++ $as_unset $as_var ++ fi ++done ++ ++# Required to use basename. ++if expr a : '\(a\)' >/dev/null 2>&1; then ++ as_expr=expr ++else ++ as_expr=false ++fi ++ ++if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then ++ as_basename=basename ++else ++ as_basename=false ++fi ++ ++ ++# Name of the executable. ++as_me=`$as_basename "$0" || ++$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ ++ X"$0" : 'X\(//\)$' \| \ ++ X"$0" : 'X\(/\)$' \| \ ++ . : '\(.\)' 2>/dev/null || ++echo X/"$0" | ++ sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } ++ /^X\/\(\/\/\)$/{ s//\1/; q; } ++ /^X\/\(\/\).*/{ s//\1/; q; } ++ s/.*/./; q'` ++ ++ ++# PATH needs CR, and LINENO needs CR and PATH. ++# Avoid depending upon Character Ranges. ++as_cr_letters='abcdefghijklmnopqrstuvwxyz' ++as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' ++as_cr_Letters=$as_cr_letters$as_cr_LETTERS ++as_cr_digits='0123456789' ++as_cr_alnum=$as_cr_Letters$as_cr_digits ++ ++# The user is always right. ++if test "${PATH_SEPARATOR+set}" != set; then ++ echo "#! /bin/sh" >conf$$.sh ++ echo "exit 0" >>conf$$.sh ++ chmod +x conf$$.sh ++ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then ++ PATH_SEPARATOR=';' ++ else ++ PATH_SEPARATOR=: ++ fi ++ rm -f conf$$.sh ++fi ++ ++ ++ as_lineno_1=$LINENO ++ as_lineno_2=$LINENO ++ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` ++ test "x$as_lineno_1" != "x$as_lineno_2" && ++ test "x$as_lineno_3" = "x$as_lineno_2" || { ++ # Find who we are. Look in the path if we contain no path at all ++ # relative or not. ++ case $0 in ++ *[\\/]* ) as_myself=$0 ;; ++ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break ++done ++ ++ ;; + esac ++ # We did not find ourselves, most probably we were run as `sh COMMAND' ++ # in which case we are not to be found in the path. ++ if test "x$as_myself" = x; then ++ as_myself=$0 ++ fi ++ if test ! -f "$as_myself"; then ++ { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 ++echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} ++ { (exit 1); exit 1; }; } ++ fi ++ case $CONFIG_SHELL in ++ '') ++ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for as_base in sh bash ksh sh5; do ++ case $as_dir in ++ /*) ++ if ("$as_dir/$as_base" -c ' ++ as_lineno_1=$LINENO ++ as_lineno_2=$LINENO ++ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` ++ test "x$as_lineno_1" != "x$as_lineno_2" && ++ test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then ++ $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } ++ $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } ++ CONFIG_SHELL=$as_dir/$as_base ++ export CONFIG_SHELL ++ exec "$CONFIG_SHELL" "$0" ${1+"$@"} ++ fi;; ++ esac ++ done + done ++;; ++ esac + +-ac_given_srcdir=$srcdir +-ac_given_INSTALL="$INSTALL" +- +-trap 'rm -fr `echo "Makefile \ +- doc/Makefile \ +- m4/Makefile \ +- src/Makefile \ +- src/include/Makefile \ +- src/lib/Makefile \ +- src/test/Makefile \ +- src/debug/Makefile \ +- src/qgen/Makefile \ +- src/saal/Makefile \ +- src/sigd/Makefile \ +- src/maint/Makefile \ +- src/arpd/Makefile \ +- src/ilmid/Makefile \ +- src/ilmid/asn1/Makefile \ +- src/man/Makefile \ +- src/led/Makefile \ +- src/lane/Makefile \ +- src/mpoad/Makefile \ +- src/switch/Makefile \ +- src/switch/debug/Makefile \ +- src/switch/tcp/Makefile \ +- src/config/Makefile \ +- src/config/init-redhat/Makefile \ +- src/extra/Makefile \ +- src/extra/linux-atm.spec \ +- src/extra/ANS/Makefile +- config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +-EOF +-cat >> $CONFIG_STATUS <<EOF ++ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO ++ # uniformly replaced by the line number. The first 'sed' inserts a ++ # line-number line before each line; the second 'sed' does the real ++ # work. The second script uses 'N' to pair each line-number line ++ # with the numbered line, and appends trailing '-' during ++ # substitution so that $LINENO is not a special case at line end. ++ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the ++ # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) ++ sed '=' <$as_myself | ++ sed ' ++ N ++ s,$,-, ++ : loop ++ s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, ++ t loop ++ s,-$,, ++ s,^['$as_cr_digits']*\n,, ++ ' >$as_me.lineno && ++ chmod +x $as_me.lineno || ++ { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 ++echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} ++ { (exit 1); exit 1; }; } ++ ++ # Don't try to exec as it changes $[0], causing all sort of problems ++ # (the dirname of $[0] is not the place where we might find the ++ # original and so on. Autoconf is especially sensible to this). ++ . ./$as_me.lineno ++ # Exit status is that of the last command. ++ exit ++} + +-# Protect against being on the right side of a sed subst in config.status. +-sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; +- s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF +-$ac_vpsub +-$extrasub +-s%@SHELL@%$SHELL%g +-s%@CFLAGS@%$CFLAGS%g +-s%@CPPFLAGS@%$CPPFLAGS%g +-s%@CXXFLAGS@%$CXXFLAGS%g +-s%@FFLAGS@%$FFLAGS%g +-s%@DEFS@%$DEFS%g +-s%@LDFLAGS@%$LDFLAGS%g +-s%@LIBS@%$LIBS%g +-s%@exec_prefix@%$exec_prefix%g +-s%@prefix@%$prefix%g +-s%@program_transform_name@%$program_transform_name%g +-s%@bindir@%$bindir%g +-s%@sbindir@%$sbindir%g +-s%@libexecdir@%$libexecdir%g +-s%@datadir@%$datadir%g +-s%@sysconfdir@%$sysconfdir%g +-s%@sharedstatedir@%$sharedstatedir%g +-s%@localstatedir@%$localstatedir%g +-s%@libdir@%$libdir%g +-s%@includedir@%$includedir%g +-s%@oldincludedir@%$oldincludedir%g +-s%@infodir@%$infodir%g +-s%@mandir@%$mandir%g +-s%@host@%$host%g +-s%@host_alias@%$host_alias%g +-s%@host_cpu@%$host_cpu%g +-s%@host_vendor@%$host_vendor%g +-s%@host_os@%$host_os%g +-s%@target@%$target%g +-s%@target_alias@%$target_alias%g +-s%@target_cpu@%$target_cpu%g +-s%@target_vendor@%$target_vendor%g +-s%@target_os@%$target_os%g +-s%@build@%$build%g +-s%@build_alias@%$build_alias%g +-s%@build_cpu@%$build_cpu%g +-s%@build_vendor@%$build_vendor%g +-s%@build_os@%$build_os%g +-s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +-s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g +-s%@INSTALL_DATA@%$INSTALL_DATA%g +-s%@PACKAGE@%$PACKAGE%g +-s%@VERSION@%$VERSION%g +-s%@ACLOCAL@%$ACLOCAL%g +-s%@AUTOCONF@%$AUTOCONF%g +-s%@AUTOMAKE@%$AUTOMAKE%g +-s%@AUTOHEADER@%$AUTOHEADER%g +-s%@MAKEINFO@%$MAKEINFO%g +-s%@SET_MAKE@%$SET_MAKE%g +-s%@LIBVER_CURRENT@%$LIBVER_CURRENT%g +-s%@LIBVER_REVISION@%$LIBVER_REVISION%g +-s%@LIBVER_AGE@%$LIBVER_AGE%g +-s%@CC@%$CC%g +-s%@LEX@%$LEX%g +-s%@LEXLIB@%$LEXLIB%g +-s%@CPP@%$CPP%g +-s%@LEX_OUTPUT_ROOT@%$LEX_OUTPUT_ROOT%g +-s%@YACC@%$YACC%g +-s%@LN_S@%$LN_S%g +-s%@OBJEXT@%$OBJEXT%g +-s%@EXEEXT@%$EXEEXT%g +-s%@ECHO@%$ECHO%g +-s%@RANLIB@%$RANLIB%g +-s%@STRIP@%$STRIP%g +-s%@LIBTOOL@%$LIBTOOL%g +-s%@LIBTOOL_DEPS@%$LIBTOOL_DEPS%g +-s%@PERL@%$PERL%g + +-CEOF +-EOF ++case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in ++ *c*,-n*) ECHO_N= ECHO_C=' ++' ECHO_T=' ' ;; ++ *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; ++ *) ECHO_N= ECHO_C='\c' ECHO_T= ;; ++esac + +-cat >> $CONFIG_STATUS <<\EOF ++if expr a : '\(a\)' >/dev/null 2>&1; then ++ as_expr=expr ++else ++ as_expr=false ++fi + +-# Split the substitutions into bite-sized pieces for seds with +-# small command number limits, like on Digital OSF/1 and HP-UX. +-ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +-ac_file=1 # Number of current file. +-ac_beg=1 # First line for current file. +-ac_end=$ac_max_sed_cmds # Line after last line for current file. +-ac_more_lines=: +-ac_sed_cmds="" +-while $ac_more_lines; do +- if test $ac_beg -gt 1; then +- sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file +- else +- sed "${ac_end}q" conftest.subs > conftest.s$ac_file +- fi +- if test ! -s conftest.s$ac_file; then +- ac_more_lines=false +- rm -f conftest.s$ac_file ++rm -f conf$$ conf$$.exe conf$$.file ++echo >conf$$.file ++if ln -s conf$$.file conf$$ 2>/dev/null; then ++ # We could just check for DJGPP; but this test a) works b) is more generic ++ # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). ++ if test -f conf$$.exe; then ++ # Don't use ln at all; we don't have any links ++ as_ln_s='cp -p' + else +- if test -z "$ac_sed_cmds"; then +- ac_sed_cmds="sed -f conftest.s$ac_file" +- else +- ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" +- fi +- ac_file=`expr $ac_file + 1` +- ac_beg=$ac_end +- ac_end=`expr $ac_end + $ac_max_sed_cmds` ++ as_ln_s='ln -s' + fi ++elif ln conf$$.file conf$$ 2>/dev/null; then ++ as_ln_s=ln ++else ++ as_ln_s='cp -p' ++fi ++rm -f conf$$ conf$$.exe conf$$.file ++ ++if mkdir -p . 2>/dev/null; then ++ as_mkdir_p=: ++else ++ as_mkdir_p=false ++fi ++ ++as_executable_p="test -f" ++ ++# Sed expression to map a string onto a valid CPP name. ++as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" ++ ++# Sed expression to map a string onto a valid variable name. ++as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" ++ ++ ++# IFS ++# We need space, tab and new line, in precisely that order. ++as_nl=' ++' ++IFS=" $as_nl" ++ ++# CDPATH. ++$as_unset CDPATH ++ ++exec 6>&1 ++ ++# Open the log real soon, to keep \$[0] and so on meaningful, and to ++# report actual input values of CONFIG_FILES etc. instead of their ++# values after options handling. Logging --version etc. is OK. ++exec 5>>config.log ++{ ++ echo ++ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ++## Running $as_me. ## ++_ASBOX ++} >&5 ++cat >&5 <<_CSEOF ++ ++This file was extended by $as_me, which was ++generated by GNU Autoconf 2.57. Invocation command line was ++ ++ CONFIG_FILES = $CONFIG_FILES ++ CONFIG_HEADERS = $CONFIG_HEADERS ++ CONFIG_LINKS = $CONFIG_LINKS ++ CONFIG_COMMANDS = $CONFIG_COMMANDS ++ $ $0 $@ ++ ++_CSEOF ++echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 ++echo >&5 ++_ACEOF ++ ++# Files that config.status was made for. ++if test -n "$ac_config_files"; then ++ echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS ++fi ++ ++if test -n "$ac_config_headers"; then ++ echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS ++fi ++ ++if test -n "$ac_config_links"; then ++ echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS ++fi ++ ++if test -n "$ac_config_commands"; then ++ echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS ++fi ++ ++cat >>$CONFIG_STATUS <<\_ACEOF ++ ++ac_cs_usage="\ ++\`$as_me' instantiates files from templates according to the ++current configuration. ++ ++Usage: $0 [OPTIONS] [FILE]... ++ ++ -h, --help print this help, then exit ++ -V, --version print version number, then exit ++ -q, --quiet do not print progress messages ++ -d, --debug don't remove temporary files ++ --recheck update $as_me by reconfiguring in the same conditions ++ --file=FILE[:TEMPLATE] ++ instantiate the configuration file FILE ++ --header=FILE[:TEMPLATE] ++ instantiate the configuration header FILE ++ ++Configuration files: ++$config_files ++ ++Configuration headers: ++$config_headers ++ ++Configuration commands: ++$config_commands ++ ++Report bugs to <bug-autoconf@gnu.org>." ++_ACEOF ++ ++cat >>$CONFIG_STATUS <<_ACEOF ++ac_cs_version="\\ ++config.status ++configured by $0, generated by GNU Autoconf 2.57, ++ with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" ++ ++Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 ++Free Software Foundation, Inc. ++This config.status script is free software; the Free Software Foundation ++gives unlimited permission to copy, distribute and modify it." ++srcdir=$srcdir ++INSTALL="$INSTALL" ++_ACEOF ++ ++cat >>$CONFIG_STATUS <<\_ACEOF ++# If no file are specified by the user, then we need to provide default ++# value. By we need to know if files were specified by the user. ++ac_need_defaults=: ++while test $# != 0 ++do ++ case $1 in ++ --*=*) ++ ac_option=`expr "x$1" : 'x\([^=]*\)='` ++ ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` ++ ac_shift=: ++ ;; ++ -*) ++ ac_option=$1 ++ ac_optarg=$2 ++ ac_shift=shift ++ ;; ++ *) # This is not an option, so the user has probably given explicit ++ # arguments. ++ ac_option=$1 ++ ac_need_defaults=false;; ++ esac ++ ++ case $ac_option in ++ # Handling of the options. ++_ACEOF ++cat >>$CONFIG_STATUS <<\_ACEOF ++ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ++ ac_cs_recheck=: ;; ++ --version | --vers* | -V ) ++ echo "$ac_cs_version"; exit 0 ;; ++ --he | --h) ++ # Conflict between --help and --header ++ { { echo "$as_me:$LINENO: error: ambiguous option: $1 ++Try \`$0 --help' for more information." >&5 ++echo "$as_me: error: ambiguous option: $1 ++Try \`$0 --help' for more information." >&2;} ++ { (exit 1); exit 1; }; };; ++ --help | --hel | -h ) ++ echo "$ac_cs_usage"; exit 0 ;; ++ --debug | --d* | -d ) ++ debug=: ;; ++ --file | --fil | --fi | --f ) ++ $ac_shift ++ CONFIG_FILES="$CONFIG_FILES $ac_optarg" ++ ac_need_defaults=false;; ++ --header | --heade | --head | --hea ) ++ $ac_shift ++ CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ++ ac_need_defaults=false;; ++ -q | -quiet | --quiet | --quie | --qui | --qu | --q \ ++ | -silent | --silent | --silen | --sile | --sil | --si | --s) ++ ac_cs_silent=: ;; ++ ++ # This is an error. ++ -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 ++Try \`$0 --help' for more information." >&5 ++echo "$as_me: error: unrecognized option: $1 ++Try \`$0 --help' for more information." >&2;} ++ { (exit 1); exit 1; }; } ;; ++ ++ *) ac_config_targets="$ac_config_targets $1" ;; ++ ++ esac ++ shift ++done ++ ++ac_configure_extra_args= ++ ++if $ac_cs_silent; then ++ exec 6>/dev/null ++ ac_configure_extra_args="$ac_configure_extra_args --silent" ++fi ++ ++_ACEOF ++cat >>$CONFIG_STATUS <<_ACEOF ++if \$ac_cs_recheck; then ++ echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 ++ exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion ++fi ++ ++_ACEOF ++ ++cat >>$CONFIG_STATUS <<_ACEOF ++# ++# INIT-COMMANDS section. ++# ++ ++ ++ ++_ACEOF ++ ++ ++ ++cat >>$CONFIG_STATUS <<\_ACEOF ++for ac_config_target in $ac_config_targets ++do ++ case "$ac_config_target" in ++ # Handling of arguments. ++ "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; ++ "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; ++ "m4/Makefile" ) CONFIG_FILES="$CONFIG_FILES m4/Makefile" ;; ++ "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; ++ "src/include/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/include/Makefile" ;; ++ "src/lib/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/lib/Makefile" ;; ++ "src/test/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/test/Makefile" ;; ++ "src/debug/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/debug/Makefile" ;; ++ "src/qgen/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/qgen/Makefile" ;; ++ "src/saal/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/saal/Makefile" ;; ++ "src/sigd/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/sigd/Makefile" ;; ++ "src/maint/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/maint/Makefile" ;; ++ "src/arpd/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/arpd/Makefile" ;; ++ "src/ilmid/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/ilmid/Makefile" ;; ++ "src/ilmid/asn1/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/ilmid/asn1/Makefile" ;; ++ "src/man/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/man/Makefile" ;; ++ "src/led/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/led/Makefile" ;; ++ "src/lane/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/lane/Makefile" ;; ++ "src/mpoad/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/mpoad/Makefile" ;; ++ "src/switch/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/switch/Makefile" ;; ++ "src/switch/debug/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/switch/debug/Makefile" ;; ++ "src/switch/tcp/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/switch/tcp/Makefile" ;; ++ "src/config/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/config/Makefile" ;; ++ "src/config/init-redhat/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/config/init-redhat/Makefile" ;; ++ "src/extra/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/extra/Makefile" ;; ++ "src/extra/linux-atm.spec" ) CONFIG_FILES="$CONFIG_FILES src/extra/linux-atm.spec" ;; ++ "src/extra/ANS/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/extra/ANS/Makefile" ;; ++ "default-1" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;; ++ "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; ++ *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 ++echo "$as_me: error: invalid argument: $ac_config_target" >&2;} ++ { (exit 1); exit 1; }; };; ++ esac + done +-if test -z "$ac_sed_cmds"; then +- ac_sed_cmds=cat ++ ++# If the user did not use the arguments to specify the items to instantiate, ++# then the envvar interface is used. Set only those that are not. ++# We use the long form for the default assignment because of an extremely ++# bizarre bug on SunOS 4.1.3. ++if $ac_need_defaults; then ++ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files ++ test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers ++ test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands + fi +-EOF + +-cat >> $CONFIG_STATUS <<EOF ++# Have a temporary directory for convenience. Make it in the build tree ++# simply because there is no reason to put it here, and in addition, ++# creating and moving files from /tmp can sometimes cause problems. ++# Create a temporary directory, and hook for its removal unless debugging. ++$debug || ++{ ++ trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 ++ trap '{ (exit 1); exit 1; }' 1 2 13 15 ++} + +-CONFIG_FILES=\${CONFIG_FILES-"Makefile \ +- doc/Makefile \ +- m4/Makefile \ +- src/Makefile \ +- src/include/Makefile \ +- src/lib/Makefile \ +- src/test/Makefile \ +- src/debug/Makefile \ +- src/qgen/Makefile \ +- src/saal/Makefile \ +- src/sigd/Makefile \ +- src/maint/Makefile \ +- src/arpd/Makefile \ +- src/ilmid/Makefile \ +- src/ilmid/asn1/Makefile \ +- src/man/Makefile \ +- src/led/Makefile \ +- src/lane/Makefile \ +- src/mpoad/Makefile \ +- src/switch/Makefile \ +- src/switch/debug/Makefile \ +- src/switch/tcp/Makefile \ +- src/config/Makefile \ +- src/config/init-redhat/Makefile \ +- src/extra/Makefile \ +- src/extra/linux-atm.spec \ +- src/extra/ANS/Makefile +- "} +-EOF +-cat >> $CONFIG_STATUS <<\EOF +-for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then ++# Create a (secure) tmp directory for tmp files. ++ ++{ ++ tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && ++ test -n "$tmp" && test -d "$tmp" ++} || ++{ ++ tmp=./confstat$$-$RANDOM ++ (umask 077 && mkdir $tmp) ++} || ++{ ++ echo "$me: cannot create a temporary directory in ." >&2 ++ { (exit 1); exit 1; } ++} ++ ++_ACEOF ++ ++cat >>$CONFIG_STATUS <<_ACEOF ++ ++# ++# CONFIG_FILES section. ++# ++ ++# No need to generate the scripts if there are no CONFIG_FILES. ++# This happens for instance when ./config.status config.h ++if test -n "\$CONFIG_FILES"; then ++ # Protect against being on the right side of a sed subst in config.status. ++ sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; ++ s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF ++s,@SHELL@,$SHELL,;t t ++s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t ++s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t ++s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t ++s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t ++s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t ++s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t ++s,@exec_prefix@,$exec_prefix,;t t ++s,@prefix@,$prefix,;t t ++s,@program_transform_name@,$program_transform_name,;t t ++s,@bindir@,$bindir,;t t ++s,@sbindir@,$sbindir,;t t ++s,@libexecdir@,$libexecdir,;t t ++s,@datadir@,$datadir,;t t ++s,@sysconfdir@,$sysconfdir,;t t ++s,@sharedstatedir@,$sharedstatedir,;t t ++s,@localstatedir@,$localstatedir,;t t ++s,@libdir@,$libdir,;t t ++s,@includedir@,$includedir,;t t ++s,@oldincludedir@,$oldincludedir,;t t ++s,@infodir@,$infodir,;t t ++s,@mandir@,$mandir,;t t ++s,@build_alias@,$build_alias,;t t ++s,@host_alias@,$host_alias,;t t ++s,@target_alias@,$target_alias,;t t ++s,@DEFS@,$DEFS,;t t ++s,@ECHO_C@,$ECHO_C,;t t ++s,@ECHO_N@,$ECHO_N,;t t ++s,@ECHO_T@,$ECHO_T,;t t ++s,@LIBS@,$LIBS,;t t ++s,@build@,$build,;t t ++s,@build_cpu@,$build_cpu,;t t ++s,@build_vendor@,$build_vendor,;t t ++s,@build_os@,$build_os,;t t ++s,@host@,$host,;t t ++s,@host_cpu@,$host_cpu,;t t ++s,@host_vendor@,$host_vendor,;t t ++s,@host_os@,$host_os,;t t ++s,@target@,$target,;t t ++s,@target_cpu@,$target_cpu,;t t ++s,@target_vendor@,$target_vendor,;t t ++s,@target_os@,$target_os,;t t ++s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t ++s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t ++s,@INSTALL_DATA@,$INSTALL_DATA,;t t ++s,@PACKAGE@,$PACKAGE,;t t ++s,@VERSION@,$VERSION,;t t ++s,@ACLOCAL@,$ACLOCAL,;t t ++s,@AUTOCONF@,$AUTOCONF,;t t ++s,@AUTOMAKE@,$AUTOMAKE,;t t ++s,@AUTOHEADER@,$AUTOHEADER,;t t ++s,@MAKEINFO@,$MAKEINFO,;t t ++s,@SET_MAKE@,$SET_MAKE,;t t ++s,@LIBVER_CURRENT@,$LIBVER_CURRENT,;t t ++s,@LIBVER_REVISION@,$LIBVER_REVISION,;t t ++s,@LIBVER_AGE@,$LIBVER_AGE,;t t ++s,@CC@,$CC,;t t ++s,@CFLAGS@,$CFLAGS,;t t ++s,@LDFLAGS@,$LDFLAGS,;t t ++s,@CPPFLAGS@,$CPPFLAGS,;t t ++s,@ac_ct_CC@,$ac_ct_CC,;t t ++s,@EXEEXT@,$EXEEXT,;t t ++s,@OBJEXT@,$OBJEXT,;t t ++s,@LEX@,$LEX,;t t ++s,@LEXLIB@,$LEXLIB,;t t ++s,@LEX_OUTPUT_ROOT@,$LEX_OUTPUT_ROOT,;t t ++s,@YACC@,$YACC,;t t ++s,@LN_S@,$LN_S,;t t ++s,@ECHO@,$ECHO,;t t ++s,@RANLIB@,$RANLIB,;t t ++s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t ++s,@STRIP@,$STRIP,;t t ++s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t ++s,@CPP@,$CPP,;t t ++s,@EGREP@,$EGREP,;t t ++s,@LIBTOOL@,$LIBTOOL,;t t ++s,@LIBTOOL_DEPS@,$LIBTOOL_DEPS,;t t ++s,@PERL@,$PERL,;t t ++s,@LIBOBJS@,$LIBOBJS,;t t ++s,@LTLIBOBJS@,$LTLIBOBJS,;t t ++CEOF ++ ++_ACEOF ++ ++ cat >>$CONFIG_STATUS <<\_ACEOF ++ # Split the substitutions into bite-sized pieces for seds with ++ # small command number limits, like on Digital OSF/1 and HP-UX. ++ ac_max_sed_lines=48 ++ ac_sed_frag=1 # Number of current file. ++ ac_beg=1 # First line for current file. ++ ac_end=$ac_max_sed_lines # Line after last line for current file. ++ ac_more_lines=: ++ ac_sed_cmds= ++ while $ac_more_lines; do ++ if test $ac_beg -gt 1; then ++ sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag ++ else ++ sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag ++ fi ++ if test ! -s $tmp/subs.frag; then ++ ac_more_lines=false ++ else ++ # The purpose of the label and of the branching condition is to ++ # speed up the sed processing (if there are no `@' at all, there ++ # is no need to browse any of the substitutions). ++ # These are the two extra sed commands mentioned above. ++ (echo ':t ++ /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed ++ if test -z "$ac_sed_cmds"; then ++ ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" ++ else ++ ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" ++ fi ++ ac_sed_frag=`expr $ac_sed_frag + 1` ++ ac_beg=$ac_end ++ ac_end=`expr $ac_end + $ac_max_sed_lines` ++ fi ++ done ++ if test -z "$ac_sed_cmds"; then ++ ac_sed_cmds=cat ++ fi ++fi # test -n "$CONFIG_FILES" ++ ++_ACEOF ++cat >>$CONFIG_STATUS <<\_ACEOF ++for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". +- case "$ac_file" in +- *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` +- ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; +- *) ac_file_in="${ac_file}.in" ;; +- esac +- +- # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. +- +- # Remove last slash and all that follows it. Not all systems have dirname. +- ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` +- if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then +- # The file is in a subdirectory. +- test ! -d "$ac_dir" && mkdir "$ac_dir" +- ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" +- # A "../" for each directory in $ac_dir_suffix. +- ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` +- else +- ac_dir_suffix= ac_dots= +- fi +- +- case "$ac_given_srcdir" in +- .) srcdir=. +- if test -z "$ac_dots"; then top_srcdir=. +- else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; +- /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; ++ case $ac_file in ++ - | *:- | *:-:* ) # input from stdin ++ cat >$tmp/stdin ++ ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ++ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; ++ *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ++ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; ++ * ) ac_file_in=$ac_file.in ;; ++ esac ++ ++ # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ++ ac_dir=`(dirname "$ac_file") 2>/dev/null || ++$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ ++ X"$ac_file" : 'X\(//\)[^/]' \| \ ++ X"$ac_file" : 'X\(//\)$' \| \ ++ X"$ac_file" : 'X\(/\)' \| \ ++ . : '\(.\)' 2>/dev/null || ++echo X"$ac_file" | ++ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } ++ /^X\(\/\/\)[^/].*/{ s//\1/; q; } ++ /^X\(\/\/\)$/{ s//\1/; q; } ++ /^X\(\/\).*/{ s//\1/; q; } ++ s/.*/./; q'` ++ { if $as_mkdir_p; then ++ mkdir -p "$ac_dir" ++ else ++ as_dir="$ac_dir" ++ as_dirs= ++ while test ! -d "$as_dir"; do ++ as_dirs="$as_dir $as_dirs" ++ as_dir=`(dirname "$as_dir") 2>/dev/null || ++$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ ++ X"$as_dir" : 'X\(//\)[^/]' \| \ ++ X"$as_dir" : 'X\(//\)$' \| \ ++ X"$as_dir" : 'X\(/\)' \| \ ++ . : '\(.\)' 2>/dev/null || ++echo X"$as_dir" | ++ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } ++ /^X\(\/\/\)[^/].*/{ s//\1/; q; } ++ /^X\(\/\/\)$/{ s//\1/; q; } ++ /^X\(\/\).*/{ s//\1/; q; } ++ s/.*/./; q'` ++ done ++ test ! -n "$as_dirs" || mkdir $as_dirs ++ fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 ++echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} ++ { (exit 1); exit 1; }; }; } ++ ++ ac_builddir=. ++ ++if test "$ac_dir" != .; then ++ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` ++ # A "../" for each directory in $ac_dir_suffix. ++ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` ++else ++ ac_dir_suffix= ac_top_builddir= ++fi ++ ++case $srcdir in ++ .) # No --srcdir option. We are building in place. ++ ac_srcdir=. ++ if test -z "$ac_top_builddir"; then ++ ac_top_srcdir=. ++ else ++ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` ++ fi ;; ++ [\\/]* | ?:[\\/]* ) # Absolute path. ++ ac_srcdir=$srcdir$ac_dir_suffix; ++ ac_top_srcdir=$srcdir ;; + *) # Relative path. +- srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" +- top_srcdir="$ac_dots$ac_given_srcdir" ;; ++ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ++ ac_top_srcdir=$ac_top_builddir$srcdir ;; ++esac ++# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be ++# absolute. ++ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ++ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ++ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ++ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` ++ ++ ++ case $INSTALL in ++ [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; ++ *) ac_INSTALL=$ac_top_builddir$INSTALL ;; + esac + +- case "$ac_given_INSTALL" in +- [/$]*) INSTALL="$ac_given_INSTALL" ;; +- *) INSTALL="$ac_dots$ac_given_INSTALL" ;; +- esac +- +- echo creating "$ac_file" +- rm -f "$ac_file" +- configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." +- case "$ac_file" in +- *Makefile*) ac_comsub="1i\\ +-# $configure_input" ;; +- *) ac_comsub= ;; +- esac +- +- ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` +- sed -e "$ac_comsub +-s%@configure_input@%$configure_input%g +-s%@srcdir@%$srcdir%g +-s%@top_srcdir@%$top_srcdir%g +-s%@INSTALL@%$INSTALL%g +-" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +-fi; done +-rm -f conftest.s* ++ if test x"$ac_file" != x-; then ++ { echo "$as_me:$LINENO: creating $ac_file" >&5 ++echo "$as_me: creating $ac_file" >&6;} ++ rm -f "$ac_file" ++ fi ++ # Let's still pretend it is `configure' which instantiates (i.e., don't ++ # use $as_me), people would be surprised to read: ++ # /* config.h. Generated by config.status. */ ++ if test x"$ac_file" = x-; then ++ configure_input= ++ else ++ configure_input="$ac_file. " ++ fi ++ configure_input=$configure_input"Generated from `echo $ac_file_in | ++ sed 's,.*/,,'` by configure." ++ ++ # First look for the input files in the build tree, otherwise in the ++ # src tree. ++ ac_file_inputs=`IFS=: ++ for f in $ac_file_in; do ++ case $f in ++ -) echo $tmp/stdin ;; ++ [\\/$]*) ++ # Absolute (can't be DOS-style, as IFS=:) ++ test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 ++echo "$as_me: error: cannot find input file: $f" >&2;} ++ { (exit 1); exit 1; }; } ++ echo $f;; ++ *) # Relative ++ if test -f "$f"; then ++ # Build tree ++ echo $f ++ elif test -f "$srcdir/$f"; then ++ # Source tree ++ echo $srcdir/$f ++ else ++ # /dev/null tree ++ { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 ++echo "$as_me: error: cannot find input file: $f" >&2;} ++ { (exit 1); exit 1; }; } ++ fi;; ++ esac ++ done` || { (exit 1); exit 1; } ++_ACEOF ++cat >>$CONFIG_STATUS <<_ACEOF ++ sed "$ac_vpsub ++$extrasub ++_ACEOF ++cat >>$CONFIG_STATUS <<\_ACEOF ++:t ++/@[a-zA-Z_][a-zA-Z_0-9]*@/!b ++s,@configure_input@,$configure_input,;t t ++s,@srcdir@,$ac_srcdir,;t t ++s,@abs_srcdir@,$ac_abs_srcdir,;t t ++s,@top_srcdir@,$ac_top_srcdir,;t t ++s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t ++s,@builddir@,$ac_builddir,;t t ++s,@abs_builddir@,$ac_abs_builddir,;t t ++s,@top_builddir@,$ac_top_builddir,;t t ++s,@abs_top_builddir@,$ac_abs_top_builddir,;t t ++s,@INSTALL@,$ac_INSTALL,;t t ++" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out ++ rm -f $tmp/stdin ++ if test x"$ac_file" != x-; then ++ mv $tmp/out $ac_file ++ else ++ cat $tmp/out ++ rm -f $tmp/out ++ fi ++ ++done ++_ACEOF ++cat >>$CONFIG_STATUS <<\_ACEOF ++ ++# ++# CONFIG_HEADER section. ++# + + # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where + # NAME is the cpp macro being defined and VALUE is the value it is being given. + # + # ac_d sets the value in "#define NAME VALUE" lines. +-ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' +-ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' +-ac_dC='\3' +-ac_dD='%g' +-# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +-ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +-ac_uB='\([ ]\)%\1#\2define\3' ++ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' ++ac_dB='[ ].*$,\1#\2' ++ac_dC=' ' ++ac_dD=',;t' ++# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ++ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ++ac_uB='$,\1#\2define\3' + ac_uC=' ' +-ac_uD='\4%g' +-# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +-ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +-ac_eB='$%\1#\2define\3' +-ac_eC=' ' +-ac_eD='%g' ++ac_uD=',;t' + +-if test "${CONFIG_HEADERS+set}" != set; then +-EOF +-cat >> $CONFIG_STATUS <<EOF +- CONFIG_HEADERS="config.h" +-EOF +-cat >> $CONFIG_STATUS <<\EOF +-fi +-for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then ++for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". +- case "$ac_file" in +- *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` +- ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; +- *) ac_file_in="${ac_file}.in" ;; ++ case $ac_file in ++ - | *:- | *:-:* ) # input from stdin ++ cat >$tmp/stdin ++ ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ++ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; ++ *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ++ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; ++ * ) ac_file_in=$ac_file.in ;; + esac + +- echo creating $ac_file +- +- rm -f conftest.frag conftest.in conftest.out +- ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` +- cat $ac_file_inputs > conftest.in +- +-EOF ++ test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 ++echo "$as_me: creating $ac_file" >&6;} + +-# Transform confdefs.h into a sed script conftest.vals that substitutes +-# the proper values into config.h.in to produce config.h. And first: +-# Protect against being on the right side of a sed subst in config.status. +-# Protect against being in an unquoted here document in config.status. +-rm -f conftest.vals +-cat > conftest.hdr <<\EOF +-s/[\\&%]/\\&/g +-s%[\\$`]%\\&%g +-s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp +-s%ac_d%ac_u%gp +-s%ac_u%ac_e%gp +-EOF +-sed -n -f conftest.hdr confdefs.h > conftest.vals +-rm -f conftest.hdr ++ # First look for the input files in the build tree, otherwise in the ++ # src tree. ++ ac_file_inputs=`IFS=: ++ for f in $ac_file_in; do ++ case $f in ++ -) echo $tmp/stdin ;; ++ [\\/$]*) ++ # Absolute (can't be DOS-style, as IFS=:) ++ test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 ++echo "$as_me: error: cannot find input file: $f" >&2;} ++ { (exit 1); exit 1; }; } ++ echo $f;; ++ *) # Relative ++ if test -f "$f"; then ++ # Build tree ++ echo $f ++ elif test -f "$srcdir/$f"; then ++ # Source tree ++ echo $srcdir/$f ++ else ++ # /dev/null tree ++ { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 ++echo "$as_me: error: cannot find input file: $f" >&2;} ++ { (exit 1); exit 1; }; } ++ fi;; ++ esac ++ done` || { (exit 1); exit 1; } ++ # Remove the trailing spaces. ++ sed 's/[ ]*$//' $ac_file_inputs >$tmp/in ++ ++_ACEOF ++ ++# Transform confdefs.h into two sed scripts, `conftest.defines' and ++# `conftest.undefs', that substitutes the proper values into ++# config.h.in to produce config.h. The first handles `#define' ++# templates, and the second `#undef' templates. ++# And first: Protect against being on the right side of a sed subst in ++# config.status. Protect against being in an unquoted here document ++# in config.status. ++rm -f conftest.defines conftest.undefs ++# Using a here document instead of a string reduces the quoting nightmare. ++# Putting comments in sed scripts is not portable. ++# ++# `end' is used to avoid that the second main sed command (meant for ++# 0-ary CPP macros) applies to n-ary macro definitions. ++# See the Autoconf documentation for `clear'. ++cat >confdef2sed.sed <<\_ACEOF ++s/[\\&,]/\\&/g ++s,[\\$`],\\&,g ++t clear ++: clear ++s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp ++t end ++s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp ++: end ++_ACEOF ++# If some macros were called several times there might be several times ++# the same #defines, which is useless. Nevertheless, we may not want to ++# sort them, since we want the *last* AC-DEFINE to be honored. ++uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines ++sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs ++rm -f confdef2sed.sed + + # This sed command replaces #undef with comments. This is necessary, for + # example, in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. +-cat >> conftest.vals <<\EOF +-s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% +-EOF +- +-# Break up conftest.vals because some shells have a limit on +-# the size of here documents, and old seds have small limits too. +- ++cat >>conftest.undefs <<\_ACEOF ++s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, ++_ACEOF ++ ++# Break up conftest.defines because some shells have a limit on the size ++# of here documents, and old seds have small limits too (100 cmds). ++echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS ++echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS ++echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS ++echo ' :' >>$CONFIG_STATUS ++rm -f conftest.tail ++while grep . conftest.defines >/dev/null ++do ++ # Write a limited-size here document to $tmp/defines.sed. ++ echo ' cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS ++ # Speed up: don't consider the non `#define' lines. ++ echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS ++ # Work around the forget-to-reset-the-flag bug. ++ echo 't clr' >>$CONFIG_STATUS ++ echo ': clr' >>$CONFIG_STATUS ++ sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS ++ echo 'CEOF ++ sed -f $tmp/defines.sed $tmp/in >$tmp/out ++ rm -f $tmp/in ++ mv $tmp/out $tmp/in ++' >>$CONFIG_STATUS ++ sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail ++ rm -f conftest.defines ++ mv conftest.tail conftest.defines ++done ++rm -f conftest.defines ++echo ' fi # grep' >>$CONFIG_STATUS ++echo >>$CONFIG_STATUS ++ ++# Break up conftest.undefs because some shells have a limit on the size ++# of here documents, and old seds have small limits too (100 cmds). ++echo ' # Handle all the #undef templates' >>$CONFIG_STATUS + rm -f conftest.tail +-while : ++while grep . conftest.undefs >/dev/null + do +- ac_lines=`grep -c . conftest.vals` +- # grep -c gives empty output for an empty file on some AIX systems. +- if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi +- # Write a limited-size here document to conftest.frag. +- echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS +- sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS ++ # Write a limited-size here document to $tmp/undefs.sed. ++ echo ' cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS ++ # Speed up: don't consider the non `#undef' ++ echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS ++ # Work around the forget-to-reset-the-flag bug. ++ echo 't clr' >>$CONFIG_STATUS ++ echo ': clr' >>$CONFIG_STATUS ++ sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS + echo 'CEOF +- sed -f conftest.frag conftest.in > conftest.out +- rm -f conftest.in +- mv conftest.out conftest.in +-' >> $CONFIG_STATUS +- sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail +- rm -f conftest.vals +- mv conftest.tail conftest.vals +-done +-rm -f conftest.vals +- +-cat >> $CONFIG_STATUS <<\EOF +- rm -f conftest.frag conftest.h +- echo "/* $ac_file. Generated automatically by configure. */" > conftest.h +- cat conftest.in >> conftest.h +- rm -f conftest.in +- if cmp -s $ac_file conftest.h 2>/dev/null; then +- echo "$ac_file is unchanged" +- rm -f conftest.h +- else +- # Remove last slash and all that follows it. Not all systems have dirname. +- ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` +- if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then +- # The file is in a subdirectory. +- test ! -d "$ac_dir" && mkdir "$ac_dir" ++ sed -f $tmp/undefs.sed $tmp/in >$tmp/out ++ rm -f $tmp/in ++ mv $tmp/out $tmp/in ++' >>$CONFIG_STATUS ++ sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail ++ rm -f conftest.undefs ++ mv conftest.tail conftest.undefs ++done ++rm -f conftest.undefs ++ ++cat >>$CONFIG_STATUS <<\_ACEOF ++ # Let's still pretend it is `configure' which instantiates (i.e., don't ++ # use $as_me), people would be surprised to read: ++ # /* config.h. Generated by config.status. */ ++ if test x"$ac_file" = x-; then ++ echo "/* Generated by configure. */" >$tmp/config.h ++ else ++ echo "/* $ac_file. Generated by configure. */" >$tmp/config.h ++ fi ++ cat $tmp/in >>$tmp/config.h ++ rm -f $tmp/in ++ if test x"$ac_file" != x-; then ++ if diff $ac_file $tmp/config.h >/dev/null 2>&1; then ++ { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 ++echo "$as_me: $ac_file is unchanged" >&6;} ++ else ++ ac_dir=`(dirname "$ac_file") 2>/dev/null || ++$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ ++ X"$ac_file" : 'X\(//\)[^/]' \| \ ++ X"$ac_file" : 'X\(//\)$' \| \ ++ X"$ac_file" : 'X\(/\)' \| \ ++ . : '\(.\)' 2>/dev/null || ++echo X"$ac_file" | ++ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } ++ /^X\(\/\/\)[^/].*/{ s//\1/; q; } ++ /^X\(\/\/\)$/{ s//\1/; q; } ++ /^X\(\/\).*/{ s//\1/; q; } ++ s/.*/./; q'` ++ { if $as_mkdir_p; then ++ mkdir -p "$ac_dir" ++ else ++ as_dir="$ac_dir" ++ as_dirs= ++ while test ! -d "$as_dir"; do ++ as_dirs="$as_dir $as_dirs" ++ as_dir=`(dirname "$as_dir") 2>/dev/null || ++$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ ++ X"$as_dir" : 'X\(//\)[^/]' \| \ ++ X"$as_dir" : 'X\(//\)$' \| \ ++ X"$as_dir" : 'X\(/\)' \| \ ++ . : '\(.\)' 2>/dev/null || ++echo X"$as_dir" | ++ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } ++ /^X\(\/\/\)[^/].*/{ s//\1/; q; } ++ /^X\(\/\/\)$/{ s//\1/; q; } ++ /^X\(\/\).*/{ s//\1/; q; } ++ s/.*/./; q'` ++ done ++ test ! -n "$as_dirs" || mkdir $as_dirs ++ fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 ++echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} ++ { (exit 1); exit 1; }; }; } ++ ++ rm -f $ac_file ++ mv $tmp/config.h $ac_file + fi +- rm -f $ac_file +- mv conftest.h $ac_file ++ else ++ cat $tmp/config.h ++ rm -f $tmp/config.h + fi +-fi; done ++done ++_ACEOF ++cat >>$CONFIG_STATUS <<\_ACEOF + +-EOF +-cat >> $CONFIG_STATUS <<EOF ++# ++# CONFIG_COMMANDS section. ++# ++for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue ++ ac_dest=`echo "$ac_file" | sed 's,:.*,,'` ++ ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` ++ ac_dir=`(dirname "$ac_dest") 2>/dev/null || ++$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ ++ X"$ac_dest" : 'X\(//\)[^/]' \| \ ++ X"$ac_dest" : 'X\(//\)$' \| \ ++ X"$ac_dest" : 'X\(/\)' \| \ ++ . : '\(.\)' 2>/dev/null || ++echo X"$ac_dest" | ++ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } ++ /^X\(\/\/\)[^/].*/{ s//\1/; q; } ++ /^X\(\/\/\)$/{ s//\1/; q; } ++ /^X\(\/\).*/{ s//\1/; q; } ++ s/.*/./; q'` ++ ac_builddir=. ++ ++if test "$ac_dir" != .; then ++ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` ++ # A "../" for each directory in $ac_dir_suffix. ++ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` ++else ++ ac_dir_suffix= ac_top_builddir= ++fi ++ ++case $srcdir in ++ .) # No --srcdir option. We are building in place. ++ ac_srcdir=. ++ if test -z "$ac_top_builddir"; then ++ ac_top_srcdir=. ++ else ++ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` ++ fi ;; ++ [\\/]* | ?:[\\/]* ) # Absolute path. ++ ac_srcdir=$srcdir$ac_dir_suffix; ++ ac_top_srcdir=$srcdir ;; ++ *) # Relative path. ++ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ++ ac_top_srcdir=$ac_top_builddir$srcdir ;; ++esac ++# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be ++# absolute. ++ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ++ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ++ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ++ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + +-EOF +-cat >> $CONFIG_STATUS <<\EOF +-test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h ++ { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 ++echo "$as_me: executing $ac_dest commands" >&6;} ++ case $ac_dest in ++ default-1 ) test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h ;; ++ esac ++done ++_ACEOF + +-exit 0 +-EOF ++cat >>$CONFIG_STATUS <<\_ACEOF ++ ++{ (exit 0); exit 0; } ++_ACEOF + chmod +x $CONFIG_STATUS +-rm -fr confdefs* $ac_clean_files +-test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 ++ac_clean_files=$ac_clean_files_save ++ ++ ++# configure is writing to config.log, and then calls config.status. ++# config.status does its own redirection, appending to config.log. ++# Unfortunately, on DOS this fails, as config.log is still kept open ++# by configure, so config.status won't be able to write to it; its ++# output is simply discarded. So we exec the FD to /dev/null, ++# effectively closing config.log, so it can be properly (re)opened and ++# appended to by config.status. When coming back to configure, we ++# need to make the FD available again. ++if test "$no_create" != yes; then ++ ac_cs_success=: ++ ac_config_status_args= ++ test "$silent" = yes && ++ ac_config_status_args="$ac_config_status_args --quiet" ++ exec 5>/dev/null ++ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false ++ exec 5>>config.log ++ # Use ||, not &&, to avoid exiting from the if with $? = 1, which ++ # would make configure fail if this is the last instruction. ++ $ac_cs_success || { (exit 1); exit 1; } ++fi + + +--- linux-atm-2.4.1.orig/ltmain.sh ++++ linux-atm-2.4.1/ltmain.sh +@@ -49,14 +49,14 @@ + fi + + # The name of this program. +-progname=`$echo "$0" | sed 's%^.*/%%'` ++progname=`$echo "$0" | ${SED} 's%^.*/%%'` + modename="$progname" + + # Constants. + PROGRAM=ltmain.sh + PACKAGE=libtool +-VERSION=1.4 +-TIMESTAMP=" (1.920 2001/04/24 23:26:18)" ++VERSION=1.4.3 ++TIMESTAMP=" (1.922.2.111 2002/10/23 02:54:36)" + + default_mode= + help="Try \`$progname --help' for more information." +@@ -67,10 +67,19 @@ + + # Sed substitution that helps us do robust quoting. It backslashifies + # metacharacters that are still active within double-quoted strings. +-Xsed='sed -e 1s/^X//' ++Xsed="${SED}"' -e 1s/^X//' + sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' +-SP2NL='tr \040 \012' +-NL2SP='tr \015\012 \040\040' ++# test EBCDIC or ASCII ++case `echo A|od -x` in ++ *[Cc]1*) # EBCDIC based system ++ SP2NL="tr '\100' '\n'" ++ NL2SP="tr '\r\n' '\100\100'" ++ ;; ++ *) # Assume ASCII based system ++ SP2NL="tr '\040' '\012'" ++ NL2SP="tr '\015\012' '\040\040'" ++ ;; ++esac + + # NLS nuisances. + # Only set LANG and LC_ALL to C if already set. +@@ -84,6 +93,9 @@ + save_LANG="$LANG"; LANG=C; export LANG + fi + ++# Make sure IFS has a sensible default ++: ${IFS=" "} ++ + if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then + echo "$modename: not configured to build any kind of library" 1>&2 + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 +@@ -141,7 +153,7 @@ + ;; + + --config) +- sed -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0 ++ ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0 + exit 0 + ;; + +@@ -174,6 +186,8 @@ + --mode) prevopt="--mode" prev=mode ;; + --mode=*) mode="$optarg" ;; + ++ --preserve-dup-deps) duplicate_deps="yes" ;; ++ + --quiet | --silent) + show=: + ;; +@@ -202,12 +216,17 @@ + exit 1 + fi + ++# If this variable is set in any of the actions, the command in it ++# will be execed at the end. This prevents here-documents from being ++# left over by shells. ++exec_cmd= ++ + if test -z "$show_help"; then + + # Infer the operation mode. + if test -z "$mode"; then + case $nonopt in +- *cc | *++ | gcc* | *-gcc*) ++ *cc | *++ | gcc* | *-gcc* | g++* | xlc*) + mode=link + for arg + do +@@ -329,7 +348,7 @@ + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` + lastarg= +- IFS="${IFS= }"; save_ifs="$IFS"; IFS=',' ++ save_ifs="$IFS"; IFS=',' + for arg in $args; do + IFS="$save_ifs" + +@@ -615,6 +634,10 @@ + # Now arrange that obj and lo_libobj become the same file + $show "(cd $xdir && $LN_S $baseobj $libobj)" + if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then ++ # Unlock the critical section if it was locked ++ if test "$need_locks" != no; then ++ $run $rm "$lockfile" ++ fi + exit 0 + else + error=$? +@@ -745,6 +768,7 @@ + linker_flags= + dllsearchpath= + lib_search_path=`pwd` ++ inst_prefix_dir= + + avoid_version=no + dlfiles= +@@ -875,6 +899,11 @@ + prev= + continue + ;; ++ inst_prefix) ++ inst_prefix_dir="$arg" ++ prev= ++ continue ++ ;; + release) + release="-$arg" + prev= +@@ -976,11 +1005,16 @@ + continue + ;; + ++ -inst-prefix-dir) ++ prev=inst_prefix ++ continue ++ ;; ++ + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* + # so, if we see these flags be careful not to treat them like -L + -L[A-Z][A-Z]*:*) + case $with_gcc/$host in +- no/*-*-irix*) ++ no/*-*-irix* | no/*-*-nonstopux*) + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + ;; +@@ -1031,6 +1065,17 @@ + # These systems don't actually have a C library (as such) + test "X$arg" = "X-lc" && continue + ;; ++ *-*-openbsd* | *-*-freebsd*) ++ # Do not include libc due to us having libc/libc_r. ++ test "X$arg" = "X-lc" && continue ++ ;; ++ esac ++ elif test "X$arg" = "X-lc_r"; then ++ case $host in ++ *-*-openbsd* | *-*-freebsd*) ++ # Do not include libc_r directly, use -pthread flag. ++ continue ++ ;; + esac + fi + deplibs="$deplibs $arg" +@@ -1122,7 +1167,7 @@ + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` + arg= +- IFS="${IFS= }"; save_ifs="$IFS"; IFS=',' ++ save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + case $flag in +@@ -1140,7 +1185,7 @@ + -Wl,*) + args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` + arg= +- IFS="${IFS= }"; save_ifs="$IFS"; IFS=',' ++ save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + case $flag in +@@ -1307,9 +1352,11 @@ + # Find all interdependent deplibs by searching for libraries + # that are linked more than once (e.g. -la -lb -la) + for deplib in $deplibs; do +- case "$libs " in +- *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; +- esac ++ if test "X$duplicate_deps" = "Xyes" ; then ++ case "$libs " in ++ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; ++ esac ++ fi + libs="$libs $deplib" + done + deplibs= +@@ -1343,7 +1390,7 @@ + ;; + esac + for pass in $passes; do +- if test "$linkmode" = prog; then ++ if test $linkmode = prog; then + # Determine which files to process + case $pass in + dlopen) +@@ -1360,11 +1407,11 @@ + found=no + case $deplib in + -l*) +- if test "$linkmode" = oldlib && test "$linkmode" = obj; then ++ if test $linkmode = oldlib && test $linkmode = obj; then + $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2 + continue + fi +- if test "$pass" = conv; then ++ if test $pass = conv; then + deplibs="$deplib $deplibs" + continue + fi +@@ -1384,7 +1431,7 @@ + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" +- test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" ++ test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi +@@ -1393,16 +1440,16 @@ + case $linkmode in + lib) + deplibs="$deplib $deplibs" +- test "$pass" = conv && continue ++ test $pass = conv && continue + newdependency_libs="$deplib $newdependency_libs" + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + ;; + prog) +- if test "$pass" = conv; then ++ if test $pass = conv; then + deplibs="$deplib $deplibs" + continue + fi +- if test "$pass" = scan; then ++ if test $pass = scan; then + deplibs="$deplib $deplibs" + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + else +@@ -1417,7 +1464,7 @@ + continue + ;; # -L + -R*) +- if test "$pass" = link; then ++ if test $pass = link; then + dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` + # Make sure the xrpath contains only unique directories. + case "$xrpath " in +@@ -1430,7 +1477,7 @@ + ;; + *.la) lib="$deplib" ;; + *.$libext) +- if test "$pass" = conv; then ++ if test $pass = conv; then + deplibs="$deplib $deplibs" + continue + fi +@@ -1438,10 +1485,12 @@ + lib) + if test "$deplibs_check_method" != pass_all; then + echo +- echo "*** Warning: This library needs some functionality provided by $deplib." ++ echo "*** Warning: Trying to link with static lib archive $deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" +- echo "*** shared version of the library, which you do not appear to have." ++ echo "*** shared version of the library, which you do not appear to have" ++ echo "*** because the file extensions .$libext of this argument makes me believe" ++ echo "*** that it is just a static archive that I should not used here." + else + echo + echo "*** Warning: Linking the shared library $output against the" +@@ -1451,7 +1500,7 @@ + continue + ;; + prog) +- if test "$pass" != link; then ++ if test $pass != link; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" +@@ -1462,7 +1511,7 @@ + esac # linkmode + ;; # *.$libext + *.lo | *.$objext) +- if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then ++ if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + newdlprefiles="$newdlprefiles $deplib" +@@ -1485,7 +1534,7 @@ + fi + + # Check to see that this really is a libtool archive. +- if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : ++ if (${SED} -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit 1 +@@ -1512,13 +1561,13 @@ + + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan" || +- { test "$linkmode" = oldlib && test "$linkmode" = obj; }; then ++ { test $linkmode = oldlib && test $linkmode = obj; }; then + # Add dl[pre]opened files of deplib + test -n "$dlopen" && dlfiles="$dlfiles $dlopen" + test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" + fi + +- if test "$pass" = conv; then ++ if test $pass = conv; then + # Only check for convenience libraries + deplibs="$lib $deplibs" + if test -z "$libdir"; then +@@ -1532,12 +1581,14 @@ + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" +- case "$tmp_libs " in +- *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; +- esac ++ if test "X$duplicate_deps" = "Xyes" ; then ++ case "$tmp_libs " in ++ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; ++ esac ++ fi + tmp_libs="$tmp_libs $deplib" + done +- elif test "$linkmode" != prog && test "$linkmode" != lib; then ++ elif test $linkmode != prog && test $linkmode != lib; then + $echo "$modename: \`$lib' is not a convenience library" 1>&2 + exit 1 + fi +@@ -1555,7 +1606,7 @@ + fi + + # This library was specified with -dlopen. +- if test "$pass" = dlopen; then ++ if test $pass = dlopen; then + if test -z "$libdir"; then + $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 + exit 1 +@@ -1604,7 +1655,7 @@ + name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + + # This library was specified with -dlpreopen. +- if test "$pass" = dlpreopen; then ++ if test $pass = dlpreopen; then + if test -z "$libdir"; then + $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 + exit 1 +@@ -1623,7 +1674,7 @@ + + if test -z "$libdir"; then + # Link the convenience library +- if test "$linkmode" = lib; then ++ if test $linkmode = lib; then + deplibs="$dir/$old_library $deplibs" + elif test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$dir/$old_library $compile_deplibs" +@@ -1634,7 +1685,7 @@ + continue + fi + +- if test "$linkmode" = prog && test "$pass" != link; then ++ if test $linkmode = prog && test $pass != link; then + newlib_search_path="$newlib_search_path $ladir" + deplibs="$lib $deplibs" + +@@ -1657,9 +1708,11 @@ + # or/and link against static libraries + newdependency_libs="$deplib $newdependency_libs" + fi +- case "$tmp_libs " in +- *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; +- esac ++ if test "X$duplicate_deps" = "Xyes" ; then ++ case "$tmp_libs " in ++ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; ++ esac ++ fi + tmp_libs="$tmp_libs $deplib" + done # for deplib + continue +@@ -1671,7 +1724,7 @@ + # Link against this shared library + + if test "$linkmode,$pass" = "prog,link" || +- { test "$linkmode" = lib && test "$hardcode_into_libs" = yes; }; then ++ { test $linkmode = lib && test $hardcode_into_libs = yes; }; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. +@@ -1693,7 +1746,7 @@ + esac + ;; + esac +- if test "$linkmode" = prog; then ++ if test $linkmode = prog; then + # We need to hardcode the library path + if test -n "$shlibpath_var"; then + # Make sure the rpath contains only unique directories. +@@ -1743,14 +1796,14 @@ + + # Make a new name for the extract_expsyms_cmds to use + soroot="$soname" +- soname=`echo $soroot | sed -e 's/^.*\///'` +- newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a" ++ soname=`echo $soroot | ${SED} -e 's/^.*\///'` ++ newlib="libimp-`echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" + + # If the library has no export list, then create one now + if test -f "$output_objdir/$soname-def"; then : + else + $show "extracting exported symbol list from \`$soname'" +- IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' ++ save_ifs="$IFS"; IFS='~' + eval cmds=\"$extract_expsyms_cmds\" + for cmd in $cmds; do + IFS="$save_ifs" +@@ -1763,7 +1816,7 @@ + # Create $newlib + if test -f "$output_objdir/$newlib"; then :; else + $show "generating import library for \`$soname'" +- IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' ++ save_ifs="$IFS"; IFS='~' + eval cmds=\"$old_archive_from_expsyms_cmds\" + for cmd in $cmds; do + IFS="$save_ifs" +@@ -1777,7 +1830,7 @@ + linklib=$newlib + fi # test -n $old_archive_from_expsyms_cmds + +- if test "$linkmode" = prog || test "$mode" != relink; then ++ if test $linkmode = prog || test "$mode" != relink; then + add_shlibpath= + add_dir= + add= +@@ -1804,6 +1857,14 @@ + add="$dir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$dir" ++ # Try looking first in the location we're being installed to. ++ if test -n "$inst_prefix_dir"; then ++ case "$libdir" in ++ [\/]*) ++ add_dir="-L$inst_prefix_dir$libdir $add_dir" ++ ;; ++ esac ++ fi + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + add_shlibpath="$dir" +@@ -1826,7 +1887,7 @@ + *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; + esac + fi +- if test "$linkmode" = prog; then ++ if test $linkmode = prog; then + test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" + test -n "$add" && compile_deplibs="$add $compile_deplibs" + else +@@ -1843,7 +1904,7 @@ + fi + fi + +- if test "$linkmode" = prog || test "$mode" = relink; then ++ if test $linkmode = prog || test "$mode" = relink; then + add_shlibpath= + add_dir= + add= +@@ -1862,10 +1923,18 @@ + else + # We cannot seem to hardcode it, guess we'll fake it. + add_dir="-L$libdir" ++ # Try looking first in the location we're being installed to. ++ if test -n "$inst_prefix_dir"; then ++ case "$libdir" in ++ [\/]*) ++ add_dir="-L$inst_prefix_dir$libdir $add_dir" ++ ;; ++ esac ++ fi + add="-l$name" + fi + +- if test "$linkmode" = prog; then ++ if test $linkmode = prog; then + test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" + test -n "$add" && finalize_deplibs="$add $finalize_deplibs" + else +@@ -1873,7 +1942,7 @@ + test -n "$add" && deplibs="$add $deplibs" + fi + fi +- elif test "$linkmode" = prog; then ++ elif test $linkmode = prog; then + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && +@@ -1903,25 +1972,26 @@ + # Just print a warning and add the library to dependency_libs so + # that the program can be linked against the static library. + echo +- echo "*** Warning: This library needs some functionality provided by $lib." ++ echo "*** Warning: This system can not link to static lib archive $lib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + if test "$module" = yes; then +- echo "*** Therefore, libtool will create a static module, that should work " +- echo "*** as long as the dlopening application is linked with the -dlopen flag." ++ echo "*** But as you try to build a module library, libtool will still create " ++ echo "*** a static module, that should work as long as the dlopening application" ++ echo "*** is linked with the -dlopen flag to resolve symbols at runtime." + if test -z "$global_symbol_pipe"; then +- echo +- echo "*** However, this would only work if libtool was able to extract symbol" +- echo "*** lists from a program, using \`nm' or equivalent, but libtool could" +- echo "*** not find such a program. So, this module is probably useless." +- echo "*** \`nm' from GNU binutils and a full rebuild may help." ++ echo ++ echo "*** However, this would only work if libtool was able to extract symbol" ++ echo "*** lists from a program, using \`nm' or equivalent, but libtool could" ++ echo "*** not find such a program. So, this module is probably useless." ++ echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then +- build_libtool_libs=module +- build_old_libs=yes ++ build_libtool_libs=module ++ build_old_libs=yes + else +- build_libtool_libs=no ++ build_libtool_libs=no + fi + fi + else +@@ -1932,9 +2002,9 @@ + fi + fi # link shared/static library? + +- if test "$linkmode" = lib; then ++ if test $linkmode = lib; then + if test -n "$dependency_libs" && +- { test "$hardcode_into_libs" != yes || test $build_old_libs = yes || ++ { test $hardcode_into_libs != yes || test $build_old_libs = yes || + test $link_static = yes; }; then + # Extract -R from dependency_libs + temp_deplibs= +@@ -1958,13 +2028,15 @@ + tmp_libs= + for deplib in $dependency_libs; do + newdependency_libs="$deplib $newdependency_libs" +- case "$tmp_libs " in +- *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; +- esac ++ if test "X$duplicate_deps" = "Xyes" ; then ++ case "$tmp_libs " in ++ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; ++ esac ++ fi + tmp_libs="$tmp_libs $deplib" + done + +- if test "$link_all_deplibs" != no; then ++ if test $link_all_deplibs != no; then + # Add the search paths of all dependency libraries + for deplib in $dependency_libs; do + case $deplib in +@@ -1986,7 +2058,7 @@ + if grep "^installed=no" $deplib > /dev/null; then + path="-L$absdir/$objdir" + else +- eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` ++ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -z "$libdir"; then + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit 1 +@@ -2007,15 +2079,15 @@ + fi # link_all_deplibs != no + fi # linkmode = lib + done # for deplib in $libs +- if test "$pass" = dlpreopen; then ++ if test $pass = dlpreopen; then + # Link the dlpreopened libraries before other libraries + for deplib in $save_deplibs; do + deplibs="$deplib $deplibs" + done + fi +- if test "$pass" != dlopen; then +- test "$pass" != scan && dependency_libs="$newdependency_libs" +- if test "$pass" != conv; then ++ if test $pass != dlopen; then ++ test $pass != scan && dependency_libs="$newdependency_libs" ++ if test $pass != conv; then + # Make sure lib_search_path contains only unique directories. + lib_search_path= + for dir in $newlib_search_path; do +@@ -2073,7 +2145,7 @@ + deplibs= + fi + done # for pass +- if test "$linkmode" = prog; then ++ if test $linkmode = prog; then + dlfiles="$newdlfiles" + dlprefiles="$newdlprefiles" + fi +@@ -2175,7 +2247,7 @@ + else + + # Parse the version information argument. +- IFS="${IFS= }"; save_ifs="$IFS"; IFS=':' ++ save_ifs="$IFS"; IFS=':' + set dummy $vinfo 0 0 0 + IFS="$save_ifs" + +@@ -2250,16 +2322,21 @@ + versuffix=".$current"; + ;; + +- irix) ++ irix | nonstopux) + major=`expr $current - $age + 1` +- verstring="sgi$major.$revision" ++ ++ case $version_type in ++ nonstopux) verstring_prefix=nonstopux ;; ++ *) verstring_prefix=sgi ;; ++ esac ++ verstring="$verstring_prefix$major.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test $loop != 0; do + iface=`expr $revision - $loop` + loop=`expr $loop - 1` +- verstring="sgi$major.$iface:$verstring" ++ verstring="$verstring_prefix$major.$iface:$verstring" + done + + # Before this point, $major must not contain `.'. +@@ -2273,7 +2350,7 @@ + ;; + + osf) +- major=`expr $current - $age` ++ major=.`expr $current - $age` + versuffix=".$current.$age.$revision" + verstring="$current.$age.$revision" + +@@ -2312,6 +2389,16 @@ + if test -z "$vinfo" && test -n "$release"; then + major= + verstring="0.0" ++ case $version_type in ++ darwin) ++ # we can't check for "0.0" in archive_cmds due to quoting ++ # problems, so we reset it completely ++ verstring="" ++ ;; ++ *) ++ verstring="0.0" ++ ;; ++ esac + if test "$need_version" = no; then + versuffix= + else +@@ -2355,9 +2442,9 @@ + + # Eliminate all temporary directories. + for path in $notinst_path; do +- lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'` +- deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'` +- dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'` ++ lib_search_path=`echo "$lib_search_path " | ${SED} -e 's% $path % %g'` ++ deplibs=`echo "$deplibs " | ${SED} -e 's% -L$path % %g'` ++ dependency_libs=`echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` + done + + if test -n "$xrpath"; then +@@ -2408,9 +2495,12 @@ + *-*-netbsd*) + # Don't link with libc until the a.out ld.so is fixed. + ;; ++ *-*-openbsd* | *-*-freebsd*) ++ # Do not include libc due to us having libc/libc_r. ++ ;; + *) + # Add libc to deplibs on all other systems if necessary. +- if test "$build_libtool_need_lc" = "yes"; then ++ if test $build_libtool_need_lc = "yes"; then + deplibs="$deplibs -lc" + fi + ;; +@@ -2466,18 +2556,20 @@ + else + droppeddeps=yes + echo +- echo "*** Warning: This library needs some functionality provided by $i." ++ echo "*** Warning: dynamic linker does not accept needed library $i." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" +- echo "*** shared version of the library, which you do not appear to have." ++ echo "*** shared version of the library, which I believe you do not have" ++ echo "*** because a test_compile did reveal that the linker did not use it for" ++ echo "*** its dynamic dependency list that programs get resolved with at runtime." + fi + else + newdeplibs="$newdeplibs $i" + fi + done + else +- # Error occured in the first compile. Let's try to salvage the situation: +- # Compile a seperate program for each library. ++ # Error occured in the first compile. Let's try to salvage ++ # the situation: Compile a separate program for each library. + for i in $deplibs; do + name="`expr $i : '-l\(.*\)'`" + # If $name is empty we are operating on a -L argument. +@@ -2496,10 +2588,12 @@ + else + droppeddeps=yes + echo +- echo "*** Warning: This library needs some functionality provided by $i." ++ echo "*** Warning: dynamic linker does not accept needed library $i." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" +- echo "*** shared version of the library, which you do not appear to have." ++ echo "*** shared version of the library, which you do not appear to have" ++ echo "*** because a test_compile did reveal that the linker did not use this one" ++ echo "*** as a dynamic dependency that programs can get resolved with at runtime." + fi + else + droppeddeps=yes +@@ -2538,14 +2632,14 @@ + # but so what? + potlib="$potent_lib" + while test -h "$potlib" 2>/dev/null; do +- potliblink=`ls -ld $potlib | sed 's/.* -> //'` ++ potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` + case $potliblink in + [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; + *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ +- | sed 10q \ ++ | ${SED} 10q \ + | egrep "$file_magic_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" +@@ -2556,10 +2650,17 @@ + if test -n "$a_deplib" ; then + droppeddeps=yes + echo +- echo "*** Warning: This library needs some functionality provided by $a_deplib." ++ echo "*** Warning: linker path does not have real file for library $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" +- echo "*** shared version of the library, which you do not appear to have." ++ echo "*** shared version of the library, which you do not appear to have" ++ echo "*** because I did check the linker path looking for a file starting" ++ if test -z "$potlib" ; then ++ echo "*** with $libname but no candidates were found. (...for file magic test)" ++ else ++ echo "*** with $libname and none of the candidates passed a file format test" ++ echo "*** using a file magic. Last file checked: $potlib" ++ fi + fi + else + # Add a -L argument. +@@ -2578,8 +2679,9 @@ + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do ++ potlib="$potent_lib" # see symlink-check below in file_magic test + if eval echo \"$potent_lib\" 2>/dev/null \ +- | sed 10q \ ++ | ${SED} 10q \ + | egrep "$match_pattern_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" +@@ -2590,10 +2692,17 @@ + if test -n "$a_deplib" ; then + droppeddeps=yes + echo +- echo "*** Warning: This library needs some functionality provided by $a_deplib." ++ echo "*** Warning: linker path does not have real file for library $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" +- echo "*** shared version of the library, which you do not appear to have." ++ echo "*** shared version of the library, which you do not appear to have" ++ echo "*** because I did check the linker path looking for a file starting" ++ if test -z "$potlib" ; then ++ echo "*** with $libname but no candidates were found. (...for regex pattern test)" ++ else ++ echo "*** with $libname and none of the candidates passed a file format test" ++ echo "*** using a regex pattern. Last file checked: $potlib" ++ fi + fi + else + # Add a -L argument. +@@ -2683,7 +2792,7 @@ + + # Test again, we may have decided not to build it any more + if test "$build_libtool_libs" = yes; then +- if test "$hardcode_into_libs" = yes; then ++ if test $hardcode_into_libs = yes; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= +@@ -2784,7 +2893,7 @@ + export_symbols="$output_objdir/$libname.exp" + $run $rm $export_symbols + eval cmds=\"$export_symbols_cmds\" +- IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' ++ save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" +@@ -2858,9 +2967,20 @@ + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval cmds=\"$archive_expsym_cmds\" + else ++ save_deplibs="$deplibs" ++ for conv in $convenience; do ++ tmp_deplibs= ++ for test_deplib in $deplibs; do ++ if test "$test_deplib" != "$conv"; then ++ tmp_deplibs="$tmp_deplibs $test_deplib" ++ fi ++ done ++ deplibs="$tmp_deplibs" ++ done + eval cmds=\"$archive_cmds\" ++ deplibs="$save_deplibs" + fi +- IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' ++ save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" +@@ -2988,7 +3108,7 @@ + + output="$obj" + eval cmds=\"$reload_cmds\" +- IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' ++ save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" +@@ -3024,7 +3144,7 @@ + reload_objs="$libobjs $reload_conv_objs" + output="$libobj" + eval cmds=\"$reload_cmds\" +- IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' ++ save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" +@@ -3057,7 +3177,7 @@ + + prog) + case $host in +- *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;; ++ *cygwin*) output=`echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; + esac + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 +@@ -3079,6 +3199,13 @@ + # On Rhapsody replace the C library is the System framework + compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` ++ case $host in ++ *darwin*) ++ # Don't allow lazy linking, it breaks C++ global constructors ++ compile_command="$compile_command ${wl}-bind_at_load" ++ finalize_command="$finalize_command ${wl}-bind_at_load" ++ ;; ++ esac + ;; + esac + +@@ -3245,9 +3372,9 @@ + if test -z "$export_symbols"; then + export_symbols="$output_objdir/$output.exp" + $run $rm $export_symbols +- $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' ++ $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + else +- $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' ++ $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' + $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' + $run eval 'mv "$nlist"T "$nlist"' + fi +@@ -3255,7 +3382,7 @@ + + for arg in $dlprefiles; do + $show "extracting global C symbols from \`$arg'" +- name=`echo "$arg" | sed -e 's%^.*/%%'` ++ name=`echo "$arg" | ${SED} -e 's%^.*/%%'` + $run eval 'echo ": $name " >> "$nlist"' + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done +@@ -3270,7 +3397,13 @@ + fi + + # Try sorting and uniquifying the output. +- if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then ++ if grep -v "^: " < "$nlist" | ++ if sort -k 3 </dev/null >/dev/null 2>&1; then ++ sort -k 3 ++ else ++ sort +2 ++ fi | ++ uniq > "$nlist"S; then + : + else + grep -v "^: " < "$nlist" > "$nlist"S +@@ -3287,27 +3420,25 @@ + #undef lt_preloaded_symbols + + #if defined (__STDC__) && __STDC__ +-# define lt_ptr_t void * ++# define lt_ptr void * + #else +-# define lt_ptr_t char * ++# define lt_ptr char * + # define const + #endif + + /* The mapping between symbol names and symbols. */ + const struct { + const char *name; +- lt_ptr_t address; ++ lt_ptr address; + } + lt_preloaded_symbols[] = + {\ + " + +- sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \ +- -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \ +- < "$nlist" >> "$output_objdir/$dlsyms" ++ eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" + + $echo >> "$output_objdir/$dlsyms" "\ +- {0, (lt_ptr_t) 0} ++ {0, (lt_ptr) 0} + }; + + /* This works around a problem in FreeBSD linker */ +@@ -3494,7 +3625,7 @@ + relink_command="$var=\"$var_value\"; export $var; $relink_command" + fi + done +- relink_command="cd `pwd`; $relink_command" ++ relink_command="(cd `pwd`; $relink_command)" + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + fi + +@@ -3514,7 +3645,7 @@ + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in +- *.exe) output=`echo $output|sed 's,.exe$,,'` ;; ++ *.exe) output=`echo $output|${SED} 's,.exe$,,'` ;; + esac + # test for cygwin because mv fails w/o .exe extensions + case $host in +@@ -3538,7 +3669,7 @@ + + # Sed substitution that helps us do robust quoting. It backslashifies + # metacharacters that are still active within double-quoted strings. +-Xsed='sed -e 1s/^X//' ++Xsed="${SED}"' -e 1s/^X//' + sed_quote_subst='$sed_quote_subst' + + # The HP-UX ksh and POSIX shell print the target directory to stdout +@@ -3576,7 +3707,7 @@ + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. +- file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\` ++ file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` + +@@ -3589,7 +3720,7 @@ + fi + + file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` +- file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\` ++ file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` + done + + # Try to get the absolute directory name. +@@ -3603,7 +3734,7 @@ + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || \\ +- { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\ ++ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" +@@ -3618,8 +3749,9 @@ + + # relink executable if necessary + if test -n \"\$relink_command\"; then +- if (eval \$relink_command); then : ++ if relink_command_output=\`eval \$relink_command 2>&1\`; then : + else ++ $echo \"\$relink_command_output\" >&2 + $rm \"\$progdir/\$file\" + exit 1 + fi +@@ -3648,7 +3780,7 @@ + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var +- # The second colon is a workaround for a bug in BeOS R4 sed ++ # The second colon is a workaround for a bug in BeOS R4 ${SED} + $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` + + export $shlibpath_var +@@ -3790,7 +3922,7 @@ + + eval cmds=\"$old_archive_cmds\" + fi +- IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' ++ save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" +@@ -3823,7 +3955,7 @@ + fi + done + # Quote the link command for shipping. +- relink_command="cd `pwd`; $SHELL $0 --mode=relink $libtool_args" ++ relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)" + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + + # Only create the output if not a dry run. +@@ -3840,7 +3972,7 @@ + case $deplib in + *.la) + name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` +- eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` ++ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -z "$libdir"; then + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit 1 +@@ -3854,7 +3986,7 @@ + newdlfiles= + for lib in $dlfiles; do + name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` +- eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib` ++ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + if test -z "$libdir"; then + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit 1 +@@ -3865,7 +3997,7 @@ + newdlprefiles= + for lib in $dlprefiles; do + name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` +- eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib` ++ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + if test -z "$libdir"; then + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit 1 +@@ -4089,7 +4221,7 @@ + + *.la) + # Check to see that this really is a libtool archive. +- if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : ++ if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 +@@ -4124,12 +4256,30 @@ + dir="$dir$objdir" + + if test -n "$relink_command"; then ++ # Determine the prefix the user has applied to our future dir. ++ inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"` ++ ++ # Don't allow the user to place us outside of our expected ++ # location b/c this prevents finding dependent libraries that ++ # are installed to the same prefix. ++ if test "$inst_prefix_dir" = "$destdir"; then ++ $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 ++ exit 1 ++ fi ++ ++ if test -n "$inst_prefix_dir"; then ++ # Stick the inst_prefix_dir data into the link command. ++ relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` ++ else ++ relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"` ++ fi ++ + $echo "$modename: warning: relinking \`$file'" 1>&2 + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 +- continue ++ exit 1 + fi + fi + +@@ -4165,7 +4315,7 @@ + # Do each command in the postinstall commands. + lib="$destdir/$realname" + eval cmds=\"$postinstall_cmds\" +- IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' ++ save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" +@@ -4238,19 +4388,27 @@ + fi + + # Do a test to see if this is really a libtool program. +- if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then ++ case $host in ++ *cygwin*|*mingw*) ++ wrapper=`echo $file | ${SED} -e 's,.exe$,,'` ++ ;; ++ *) ++ wrapper=$file ++ ;; ++ esac ++ if (${SED} -e '4q' $wrapper | egrep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then + notinst_deplibs= + relink_command= + + # If there is no directory component, then add one. + case $file in +- */* | *\\*) . $file ;; +- *) . ./$file ;; ++ */* | *\\*) . $wrapper ;; ++ *) . ./$wrapper ;; + esac + + # Check the variables that should have been set. + if test -z "$notinst_deplibs"; then +- $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2 ++ $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 + exit 1 + fi + +@@ -4275,8 +4433,8 @@ + relink_command= + # If there is no directory component, then add one. + case $file in +- */* | *\\*) . $file ;; +- *) . ./$file ;; ++ */* | *\\*) . $wrapper ;; ++ *) . ./$wrapper ;; + esac + + outputname= +@@ -4324,7 +4482,7 @@ + destfile=$destfile.exe + ;; + *:*.exe) +- destfile=`echo $destfile | sed -e 's,.exe$,,'` ++ destfile=`echo $destfile | ${SED} -e 's,.exe$,,'` + ;; + esac + ;; +@@ -4352,7 +4510,7 @@ + + # Do each command in the postinstall commands. + eval cmds=\"$old_postinstall_cmds\" +- IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' ++ save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" +@@ -4368,11 +4526,10 @@ + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + test -n "$run" && current_libdirs=" -n$current_libdirs" +- exec $SHELL $0 --finish$current_libdirs +- exit 1 ++ exec_cmd='$SHELL $0 --finish$current_libdirs' ++ else ++ exit 0 + fi +- +- exit 0 + ;; + + # libtool finish mode +@@ -4391,7 +4548,7 @@ + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + eval cmds=\"$finish_cmds\" +- IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' ++ save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" +@@ -4473,7 +4630,7 @@ + case $file in + *.la) + # Check to see that this really is a libtool archive. +- if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : ++ if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 +@@ -4544,7 +4701,7 @@ + -*) ;; + *) + # Do a test to see if this is really a libtool program. +- if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then ++ if (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; +@@ -4575,11 +4732,8 @@ + LANG="$save_LANG"; export LANG + fi + +- # Now actually exec the command. +- eval "exec \$cmd$args" +- +- $echo "$modename: cannot exec \$cmd$args" +- exit 1 ++ # Now prepare to actually exec the command. ++ exec_cmd="\$cmd$args" + else + # Display what would be done. + if test -n "$shlibpath_var"; then +@@ -4641,14 +4795,14 @@ + + # Don't error if the file doesn't exist and rm -f was used. + if (test -L "$file") >/dev/null 2>&1 \ +- || (test -h "$file") >/dev/null 2>&1 \ ++ || (test -h "$file") >/dev/null 2>&1 \ + || test -f "$file"; then +- : ++ : + elif test -d "$file"; then +- exit_status=1 ++ exit_status=1 + continue + elif test "$rmforce" = yes; then +- continue ++ continue + fi + + rmfiles="$file" +@@ -4656,7 +4810,7 @@ + case $name in + *.la) + # Possibly a libtool archive, so verify it. +- if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then ++ if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + . $dir/$name + + # Delete the libtool libraries and symlinks. +@@ -4670,7 +4824,7 @@ + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + eval cmds=\"$postuninstall_cmds\" +- IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' ++ save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" +@@ -4685,7 +4839,7 @@ + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + eval cmds=\"$old_postuninstall_cmds\" +- IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' ++ save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" +@@ -4711,7 +4865,7 @@ + *) + # Do a test to see if this is a libtool program. + if test $mode = clean && +- (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then ++ (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + relink_command= + . $dir/$file + +@@ -4744,11 +4898,18 @@ + ;; + esac + +- $echo "$modename: invalid operation mode \`$mode'" 1>&2 +- $echo "$generic_help" 1>&2 +- exit 1 ++ if test -z "$exec_cmd"; then ++ $echo "$modename: invalid operation mode \`$mode'" 1>&2 ++ $echo "$generic_help" 1>&2 ++ exit 1 ++ fi + fi # test -z "$show_help" + ++if test -n "$exec_cmd"; then ++ eval exec $exec_cmd ++ exit 1 ++fi ++ + # We need to display help for each of the modes. + case $mode in + "") $echo \ +--- linux-atm-2.4.1.orig/m4/Makefile.in ++++ linux-atm-2.4.1/m4/Makefile.in +@@ -1,4 +1,4 @@ +-# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am ++# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am + + # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation +@@ -92,14 +92,14 @@ + + DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +-TAR = gtar ++TAR = tar + GZIP_ENV = --best + all: all-redirect + .SUFFIXES: + $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +- cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps m4/Makefile ++ cd $(top_srcdir) && $(AUTOMAKE) --gnu m4/Makefile + +-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +@@ -112,6 +112,11 @@ + subdir = m4 + + distdir: $(DISTFILES) ++ here=`cd $(top_builddir) && pwd`; \ ++ top_distdir=`cd $(top_distdir) && pwd`; \ ++ distdir=`cd $(distdir) && pwd`; \ ++ cd $(top_srcdir) \ ++ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu m4/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ +--- linux-atm-2.4.1.orig/src/Makefile.in ++++ linux-atm-2.4.1/src/Makefile.in +@@ -1,4 +1,4 @@ +-# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am ++# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am + + # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation +@@ -85,8 +85,7 @@ + VERSION = @VERSION@ + YACC = @YACC@ + +-SUBDIRS = include lib test debug qgen saal sigd maint arpd ilmid man led lane \ +- mpoad switch config extra ++SUBDIRS = include lib + + mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs + CONFIG_HEADER = ../config.h +@@ -96,14 +95,14 @@ + + DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +-TAR = gtar ++TAR = tar + GZIP_ENV = --best + all: all-redirect + .SUFFIXES: + $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +- cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps src/Makefile ++ cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile + +-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +@@ -186,7 +185,7 @@ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ +- || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) ++ || (cd $(srcdir) && etags -o $$here/TAGS $(ETAGS_ARGS) $$tags $$unique $(LISP)) + + mostlyclean-tags: + +@@ -202,6 +201,11 @@ + subdir = src + + distdir: $(DISTFILES) ++ here=`cd $(top_builddir) && pwd`; \ ++ top_distdir=`cd $(top_distdir) && pwd`; \ ++ distdir=`cd $(distdir) && pwd`; \ ++ cd $(top_srcdir) \ ++ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu src/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ +--- linux-atm-2.4.1.orig/src/include/Makefile.in ++++ linux-atm-2.4.1/src/include/Makefile.in +@@ -1,4 +1,4 @@ +-# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am ++# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am + + # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation +@@ -97,14 +97,14 @@ + + DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +-TAR = gtar ++TAR = tar + GZIP_ENV = --best + all: all-redirect + .SUFFIXES: + $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +- cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps src/include/Makefile ++ cd $(top_srcdir) && $(AUTOMAKE) --gnu src/include/Makefile + +-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +@@ -142,7 +142,7 @@ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ +- || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) ++ || (cd $(srcdir) && etags -o $$here/TAGS $(ETAGS_ARGS) $$tags $$unique $(LISP)) + + mostlyclean-tags: + +@@ -158,6 +158,11 @@ + subdir = src/include + + distdir: $(DISTFILES) ++ here=`cd $(top_builddir) && pwd`; \ ++ top_distdir=`cd $(top_distdir) && pwd`; \ ++ distdir=`cd $(distdir) && pwd`; \ ++ cd $(top_srcdir) \ ++ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu src/include/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ +--- linux-atm-2.4.1.orig/src/include/atmd.h ++++ linux-atm-2.4.1/src/include/atmd.h +@@ -24,6 +24,10 @@ + (i)->prev = (b)->prev; if ((b)->prev) (b)->prev->next = i; else r = i; \ + (b)->prev = i; } else { (i)->next = r; (i)->prev = NULL; \ + if (r) (r)->prev = i; r = i; } }) ++#define Q_INSERT_BEFORE_TYPED(r,t,i,b) ({ if (b) { (i)->next = b; \ ++ (i)->prev = (b)->prev; if ((b)->prev) (b)->prev->next = i; else r = i; \ ++ (b)->prev = i; } else { (i)->next = t r; (i)->prev = NULL; \ ++ if (t r) (t r)->prev = i; r = i; } }) + #define Q_REMOVE(r,i) ({ if ((i)->next) (i)->next->prev = (i)->prev; \ + if ((i)->prev) (i)->prev->next = (i)->next; else r = (i)->next; }) + +--- linux-atm-2.4.1.orig/src/lib/Makefile.in ++++ linux-atm-2.4.1/src/lib/Makefile.in +@@ -1,4 +1,4 @@ +-# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am ++# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am + + # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation +@@ -92,16 +92,10 @@ + # ATMLIBS_VERSION comes from configure.in in the toplevel directory + LDFLAGS = -version-info @LIBVER_CURRENT@:@LIBVER_REVISION@:@LIBVER_AGE@ + +-libatm_la_SOURCES = text2atm.c atm2text.c atmequal.c sdu2cell.c text2qos.c \ +- qos2text.c qosequal.c sap2text.c text2sap.c sapequal.c \ +- misc.c atmres.h ans.c \ +- common.c diag.c kptr.c text2ip.c timer.c unix.c ++libatm_la_SOURCES = text2atm.c atm2text.c atmequal.c sdu2cell.c text2qos.c qos2text.c qosequal.c sap2text.c text2sap.c sapequal.c misc.c atmres.h ans.c common.c diag.c kptr.c text2ip.c timer.c unix.c + + libatm_la_LIBADD = -lresolv +-libatm_la_DEPENDENCIES = $(top_builddir)/src/include/atm.h \ +- $(top_builddir)/src/include/atmsap.h \ +- $(top_builddir)/src/include/stdint.h \ +- $(top_builddir)/src/include/atmd.h ++libatm_la_DEPENDENCIES = $(top_builddir)/src/include/atm.h $(top_builddir)/src/include/atmsap.h $(top_builddir)/src/include/stdint.h $(top_builddir)/src/include/atmd.h + + mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs + CONFIG_HEADER = ../../config.h +@@ -126,8 +120,13 @@ + + DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +-TAR = gtar ++TAR = tar + GZIP_ENV = --best ++DEP_FILES = .deps/ans.P .deps/atm2text.P .deps/atmequal.P \ ++.deps/common.P .deps/diag.P .deps/kptr.P .deps/misc.P .deps/qos2text.P \ ++.deps/qosequal.P .deps/sap2text.P .deps/sapequal.P .deps/sdu2cell.P \ ++.deps/text2atm.P .deps/text2ip.P .deps/text2qos.P .deps/text2sap.P \ ++.deps/timer.P .deps/unix.P + SOURCES = $(libatm_la_SOURCES) + OBJECTS = $(libatm_la_OBJECTS) + +@@ -135,9 +134,9 @@ + .SUFFIXES: + .SUFFIXES: .S .c .lo .o .obj .s + $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +- cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps src/lib/Makefile ++ cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/Makefile + +-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +@@ -167,9 +166,6 @@ + $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \ + done + +-.c.o: +- $(COMPILE) -c $< +- + # FIXME: We should only use cygpath when building on Windows, + # and only if it is available. + .c.obj: +@@ -192,9 +188,6 @@ + + maintainer-clean-compile: + +-.c.lo: +- $(LIBTOOL) --mode=compile $(COMPILE) -c $< +- + .s.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +@@ -232,7 +225,7 @@ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ +- || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) ++ || (cd $(srcdir) && etags -o $$here/TAGS $(ETAGS_ARGS) $$tags $$unique $(LISP)) + + mostlyclean-tags: + +@@ -248,6 +241,11 @@ + subdir = src/lib + + distdir: $(DISTFILES) ++ here=`cd $(top_builddir) && pwd`; \ ++ top_distdir=`cd $(top_distdir) && pwd`; \ ++ distdir=`cd $(distdir) && pwd`; \ ++ cd $(top_srcdir) \ ++ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu src/lib/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ +@@ -258,48 +256,38 @@ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done +-ans.lo ans.o : ans.c ../../config.h ../../src/include/stdint.h \ +- ../../src/include/atm.h atmres.h +-atm2text.lo atm2text.o : atm2text.c ../../config.h \ +- ../../src/include/atm.h ../../src/include/stdint.h atmres.h +-atmequal.lo atmequal.o : atmequal.c ../../config.h \ +- ../../src/include/atm.h ../../src/include/stdint.h +-common.lo common.o : common.c ../../config.h ../../src/include/stdint.h \ +- ../../src/include/atmd.h ../../src/include/atm.h +-diag.lo diag.o : diag.c ../../config.h ../../src/include/atmd.h \ +- ../../src/include/stdint.h ../../src/include/atm.h +-kptr.lo kptr.o : kptr.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h ../../src/include/atmd.h +-misc.lo misc.o : misc.c ../../config.h ../../src/include/stdint.h \ +- ../../src/include/atm.h ../../src/include/atmsap.h +-qos2text.lo qos2text.o : qos2text.c ../../config.h \ +- ../../src/include/atm.h ../../src/include/stdint.h +-qosequal.lo qosequal.o : qosequal.c ../../config.h \ +- ../../src/include/atm.h ../../src/include/stdint.h +-sap2text.lo sap2text.o : sap2text.c ../../config.h \ +- ../../src/include/atmsap.h ../../src/include/stdint.h \ +- ../../src/include/atm.h +-sapequal.lo sapequal.o : sapequal.c ../../config.h \ +- ../../src/include/atm.h ../../src/include/stdint.h \ +- ../../src/include/atmsap.h +-sdu2cell.lo sdu2cell.o : sdu2cell.c ../../config.h \ +- ../../src/include/atm.h ../../src/include/stdint.h +-text2atm.lo text2atm.o : text2atm.c ../../config.h \ +- ../../src/include/atm.h ../../src/include/stdint.h \ +- ../../src/include/atmsap.h atmres.h +-text2ip.lo text2ip.o : text2ip.c ../../config.h \ +- ../../src/include/stdint.h ../../src/include/atm.h \ +- ../../src/include/atmd.h +-text2qos.lo text2qos.o : text2qos.c ../../config.h \ +- ../../src/include/atm.h ../../src/include/stdint.h +-text2sap.lo text2sap.o : text2sap.c ../../config.h \ +- ../../src/include/atmsap.h ../../src/include/stdint.h \ +- ../../src/include/atm.h +-timer.lo timer.o : timer.c ../../config.h ../../src/include/atmd.h \ +- ../../src/include/stdint.h ../../src/include/atm.h +-unix.lo unix.o : unix.c ../../config.h ../../src/include/atmd.h \ +- ../../src/include/stdint.h ../../src/include/atm.h + ++DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) ++ ++-include $(DEP_FILES) ++ ++mostlyclean-depend: ++ ++clean-depend: ++ ++distclean-depend: ++ -rm -rf .deps ++ ++maintainer-clean-depend: ++ ++%.o: %.c ++ @echo '$(COMPILE) -c $<'; \ ++ $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< ++ @-cp .deps/$(*F).pp .deps/$(*F).P; \ ++ tr ' ' '\012' < .deps/$(*F).pp \ ++ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ ++ >> .deps/$(*F).P; \ ++ rm .deps/$(*F).pp ++ ++%.lo: %.c ++ @echo '$(LTCOMPILE) -c $<'; \ ++ $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< ++ @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ ++ < .deps/$(*F).pp > .deps/$(*F).P; \ ++ tr ' ' '\012' < .deps/$(*F).pp \ ++ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ ++ >> .deps/$(*F).P; \ ++ rm -f .deps/$(*F).pp + info-am: + info: info-am + dvi-am: +@@ -337,27 +325,27 @@ + + maintainer-clean-generic: + mostlyclean-am: mostlyclean-libLTLIBRARIES mostlyclean-compile \ +- mostlyclean-libtool mostlyclean-tags \ ++ mostlyclean-libtool mostlyclean-tags mostlyclean-depend \ + mostlyclean-generic + + mostlyclean: mostlyclean-am + + clean-am: clean-libLTLIBRARIES clean-compile clean-libtool clean-tags \ +- clean-generic mostlyclean-am ++ clean-depend clean-generic mostlyclean-am + + clean: clean-am + + distclean-am: distclean-libLTLIBRARIES distclean-compile \ +- distclean-libtool distclean-tags distclean-generic \ +- clean-am ++ distclean-libtool distclean-tags distclean-depend \ ++ distclean-generic clean-am + -rm -f libtool + + distclean: distclean-am + + maintainer-clean-am: maintainer-clean-libLTLIBRARIES \ + maintainer-clean-compile maintainer-clean-libtool \ +- maintainer-clean-tags maintainer-clean-generic \ +- distclean-am ++ maintainer-clean-tags maintainer-clean-depend \ ++ maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +@@ -369,12 +357,13 @@ + distclean-compile clean-compile maintainer-clean-compile \ + mostlyclean-libtool distclean-libtool clean-libtool \ + maintainer-clean-libtool tags mostlyclean-tags distclean-tags \ +-clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \ +-check-am installcheck-am installcheck install-exec-am install-exec \ +-install-data-am install-data install-am install uninstall-am uninstall \ +-all-redirect all-am all installdirs mostlyclean-generic \ +-distclean-generic clean-generic maintainer-clean-generic clean \ +-mostlyclean distclean maintainer-clean ++clean-tags maintainer-clean-tags distdir mostlyclean-depend \ ++distclean-depend clean-depend maintainer-clean-depend info-am info \ ++dvi-am dvi check check-am installcheck-am installcheck install-exec-am \ ++install-exec install-data-am install-data install-am install \ ++uninstall-am uninstall all-redirect all-am all installdirs \ ++mostlyclean-generic distclean-generic clean-generic \ ++maintainer-clean-generic clean mostlyclean distclean maintainer-clean + + + #libatm_la_SOURCES = text2atm.c atm2text.c atmequal.c sdu2cell.c text2qos.c \ +--- linux-atm-2.4.1.orig/src/lib/sapequal.c ++++ linux-atm-2.4.1/src/lib/sapequal.c +@@ -65,6 +65,7 @@ + CHECK(l2.itu.window,a.l2.itu.window > b.l2.itu.window); + break; + default: ++ break; + } + switch (a.l3_proto) { + case ATM_L3_X25: +@@ -83,6 +84,7 @@ + if (a.l3.user != b.l3.user) return 0; + break; + default: ++ break; + } + return 1; + } +--- linux-atm-2.4.1.orig/src/test/Makefile.in ++++ linux-atm-2.4.1/src/test/Makefile.in +@@ -1,4 +1,4 @@ +-# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am ++# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am + + # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation +@@ -168,8 +168,11 @@ + + DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +-TAR = gtar ++TAR = tar + GZIP_ENV = --best ++DEP_FILES = .deps/align.P .deps/aping.P .deps/aread.P .deps/awrite.P \ ++.deps/br.P .deps/bw.P .deps/isp.P .deps/ispl_l.P .deps/ispl_y.P \ ++.deps/ttcp.P .deps/window.P + SOURCES = $(aread_SOURCES) $(awrite_SOURCES) $(ttcp_atm_SOURCES) $(align_SOURCES) $(aping_SOURCES) $(br_SOURCES) $(bw_SOURCES) $(isp_SOURCES) $(window_SOURCES) + OBJECTS = $(aread_OBJECTS) $(awrite_OBJECTS) $(ttcp_atm_OBJECTS) $(align_OBJECTS) $(aping_OBJECTS) $(br_OBJECTS) $(bw_OBJECTS) $(isp_OBJECTS) $(window_OBJECTS) + +@@ -177,9 +180,9 @@ + .SUFFIXES: + .SUFFIXES: .S .c .l .lo .o .obj .s .y + $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +- cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps src/test/Makefile ++ cd $(top_srcdir) && $(AUTOMAKE) --gnu src/test/Makefile + +-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +@@ -218,9 +221,6 @@ + + maintainer-clean-noinstPROGRAMS: + +-.c.o: +- $(COMPILE) -c $< +- + # FIXME: We should only use cygpath when building on Windows, + # and only if it is available. + .c.obj: +@@ -243,9 +243,6 @@ + + maintainer-clean-compile: + +-.c.lo: +- $(LIBTOOL) --mode=compile $(COMPILE) -c $< +- + .s.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +@@ -325,7 +322,7 @@ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ +- || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) ++ || (cd $(srcdir) && etags -o $$here/TAGS $(ETAGS_ARGS) $$tags $$unique $(LISP)) + + mostlyclean-tags: + +@@ -341,6 +338,11 @@ + subdir = src/test + + distdir: $(DISTFILES) ++ here=`cd $(top_builddir) && pwd`; \ ++ top_distdir=`cd $(top_distdir) && pwd`; \ ++ distdir=`cd $(distdir) && pwd`; \ ++ cd $(top_srcdir) \ ++ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu src/test/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ +@@ -351,30 +353,38 @@ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done +-align.o: align.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h +-aping.o: aping.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h +-aread.o: aread.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h +-awrite.o: awrite.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h +-br.o: br.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h +-bw.o: bw.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h +-isp.o: isp.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h ../../src/include/atmd.h isp.h \ +- errnos.inc +-ispl_l.o: ispl_l.c ../../config.h ../../src/include/stdint.h isp.h \ +- ../../src/include/atm.h ispl_y.h +-ispl_y.o: ispl_y.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h isp.h +-ttcp.o: ttcp.c ../../config.h ../../src/include/stdint.h \ +- ../../src/include/atm.h ../../src/include/atmsap.h +-window.o: window.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h + ++DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) ++ ++-include $(DEP_FILES) ++ ++mostlyclean-depend: ++ ++clean-depend: ++ ++distclean-depend: ++ -rm -rf .deps ++ ++maintainer-clean-depend: ++ ++%.o: %.c ++ @echo '$(COMPILE) -c $<'; \ ++ $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< ++ @-cp .deps/$(*F).pp .deps/$(*F).P; \ ++ tr ' ' '\012' < .deps/$(*F).pp \ ++ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ ++ >> .deps/$(*F).P; \ ++ rm .deps/$(*F).pp ++ ++%.lo: %.c ++ @echo '$(LTCOMPILE) -c $<'; \ ++ $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< ++ @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ ++ < .deps/$(*F).pp > .deps/$(*F).P; \ ++ tr ' ' '\012' < .deps/$(*F).pp \ ++ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ ++ >> .deps/$(*F).P; \ ++ rm -f .deps/$(*F).pp + info-am: + info: info-am + dvi-am: +@@ -412,21 +422,22 @@ + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + + maintainer-clean-generic: +- -test -z "ispl_llispl_yhispl_yc" || rm -f ispl_ll ispl_yh ispl_yc ++ -test -z "ispl_lcispl_yhispl_yc" || rm -f ispl_lc ispl_yh ispl_yc + mostlyclean-am: mostlyclean-binPROGRAMS mostlyclean-noinstPROGRAMS \ + mostlyclean-compile mostlyclean-libtool \ +- mostlyclean-tags mostlyclean-generic ++ mostlyclean-tags mostlyclean-depend mostlyclean-generic + + mostlyclean: mostlyclean-am + + clean-am: clean-binPROGRAMS clean-noinstPROGRAMS clean-compile \ +- clean-libtool clean-tags clean-generic mostlyclean-am ++ clean-libtool clean-tags clean-depend clean-generic \ ++ mostlyclean-am + + clean: clean-am + + distclean-am: distclean-binPROGRAMS distclean-noinstPROGRAMS \ + distclean-compile distclean-libtool distclean-tags \ +- distclean-generic clean-am ++ distclean-depend distclean-generic clean-am + -rm -f libtool + + distclean: distclean-am +@@ -434,8 +445,8 @@ + maintainer-clean-am: maintainer-clean-binPROGRAMS \ + maintainer-clean-noinstPROGRAMS \ + maintainer-clean-compile maintainer-clean-libtool \ +- maintainer-clean-tags maintainer-clean-generic \ +- distclean-am ++ maintainer-clean-tags maintainer-clean-depend \ ++ maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +@@ -448,19 +459,22 @@ + mostlyclean-compile distclean-compile clean-compile \ + maintainer-clean-compile mostlyclean-libtool distclean-libtool \ + clean-libtool maintainer-clean-libtool tags mostlyclean-tags \ +-distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ +-dvi-am dvi check check-am installcheck-am installcheck install-exec-am \ +-install-exec install-data-am install-data install-am install \ +-uninstall-am uninstall all-redirect all-am all installdirs \ +-mostlyclean-generic distclean-generic clean-generic \ +-maintainer-clean-generic clean mostlyclean distclean maintainer-clean ++distclean-tags clean-tags maintainer-clean-tags distdir \ ++mostlyclean-depend distclean-depend clean-depend \ ++maintainer-clean-depend info-am info dvi-am dvi check check-am \ ++installcheck-am installcheck install-exec-am install-exec \ ++install-data-am install-data install-am install uninstall-am uninstall \ ++all-redirect all-am all installdirs mostlyclean-generic \ ++distclean-generic clean-generic maintainer-clean-generic clean \ ++mostlyclean distclean maintainer-clean + + + isp.o: errnos.inc + + errnos.inc: mkerrnos.pl +- @PERL@ ./mkerrnos.pl </usr/include/asm/errno.h \ +- >errnos.inc || { rm -f errnos.inc; exit 1; } ++ cpp -I/usr/include/ -dM /usr/include/asm/errno.h | grep "^#define E" \ ++ | @PERL@ ./mkerrnos.pl | grep -v EMAXERRNO >errnos.inc \ ++ || { rm -f errnos.inc; exit 1; } + + # Tell versions [3.59,3.63) of GNU make to not export all variables. + # Otherwise a system limit (for SysV at least) may be exceeded. +--- linux-atm-2.4.1.orig/src/test/Makefile.am ++++ linux-atm-2.4.1/src/test/Makefile.am +@@ -26,6 +26,7 @@ + isp.o: errnos.inc + + errnos.inc: mkerrnos.pl +- @PERL@ ./mkerrnos.pl </usr/include/asm/errno.h \ +- >errnos.inc || { rm -f errnos.inc; exit 1; } +- ++ cpp -I/usr/include/ -dM /usr/include/asm/errno.h | grep "^#define E" \ ++ | @PERL@ ./mkerrnos.pl | grep -v EMAXERRNO >errnos.inc \ ++ || { rm -f errnos.inc; exit 1; } ++ +--- linux-atm-2.4.1.orig/src/test/ttcp.c ++++ linux-atm-2.4.1/src/test/ttcp.c +@@ -55,6 +55,8 @@ + /* #define SYSV */ /* required on SGI IRIX releases before 3.3 */ + + #include <stdio.h> ++#include <stdlib.h> ++#include <string.h> + #include <signal.h> + #include <ctype.h> + #include <errno.h> +@@ -67,6 +69,7 @@ + #include <sys/time.h> /* struct timeval */ + #include <atm.h> + #include <atmsap.h> ++#include <unistd.h> + + #if defined(SYSV) + #include <sys/times.h> +@@ -85,7 +88,8 @@ + struct sockaddr_atmsvc satm; + struct atm_qos qos; + +-int domain, fromlen; ++int domain; ++socklen_t fromlen; + int fd; /* fd of network socket */ + + int buflen = 8 * 1024; /* length of buffer */ +@@ -120,7 +124,6 @@ + static struct rusage ru0; /* Resource utilization at the start */ + + struct hostent *addr; +-extern int errno; + extern int optind; + extern char *optarg; + +@@ -158,23 +161,21 @@ + unsigned long numCalls; /* # of I/O system calls */ + double cput, realt; /* user, real time (seconds) */ + +-void err(); +-void mes(); +-int pattern(); +-void prep_timer(); +-double read_timer(); +-int Nread(); +-int Nwrite(); +-void delay(); +-int mread(); +-char *outfmt(); +-static void prusage(); +-static void tvadd(); +-static void tvsub(); +-static void psecs(); ++void err(const char *s); ++void mes(const char *s); ++void prep_timer(void); ++void pattern(char *cp, int cnt); ++int Nread(int nfd, char *Nbuf, int count); ++int Nwrite(int nfd, char *Nbuf, int count); ++void delay(int us); ++int mread(int mfd, char *bufp, unsigned n); ++char *outfmt(double b); ++static void prusage(struct rusage *r0, struct rusage *r1, struct timeval *e, struct timeval *b, char *outp); ++static void tvadd(struct timeval *tsum, struct timeval *t0, struct timeval *t1); ++static void tvsub(struct timeval *tdiff, struct timeval *t1, struct timeval *t0); ++static void psecs(long l, char *cp); + +-void +-sigpipe() ++void sigpipe(int unused) + { + } + +@@ -183,16 +184,14 @@ + * main - + *------------------------------------------------------------------------- + */ +-main(argc,argv) +-int argc; +-char **argv; ++int main(int argc,char **argv) + { + struct timeval td; + unsigned long addr_tmp; + const char *port_name = NULL,*tos = NULL; + int c; + double mbps; +-int no_check = 0; ++ int no_check = 0; + + if (argc < 2) goto usage; + +@@ -275,7 +274,7 @@ + } + } + +- if (port_name) ++ if (port_name) { + if (atm) goto usage; + else { + struct servent *se; +@@ -283,13 +282,13 @@ + se = getservbyname(port_name,udp ? "udp" : "tcp"); + if (se) port = ntohs(se->s_port); + else { +- const char *end; ++ char *end; + + port = strtoul(port_name,&end,0); + if (*end) goto usage; + } + } +- ++ } + host = argv[optind]; + + if (atm) { +@@ -435,9 +434,9 @@ + #endif + + if (!atm || satm.sas_family == AF_ATMPVC || !trans) +- if (bind(fd, atm ? &satm : &sinme, atm ? satm.sas_family == AF_ATMPVC ? +- sizeof(struct sockaddr_atmpvc) : sizeof(struct sockaddr_atmsvc) : +- sizeof(sinme)) < 0) ++ if (bind(fd, atm ? ++ (struct sockaddr *)&satm : (struct sockaddr *)&sinme, ++ atm ? satm.sas_family == AF_ATMPVC ? sizeof(struct sockaddr_atmpvc) : sizeof(struct sockaddr_atmsvc) : sizeof(sinme)) < 0) + err("bind"); + + if (!udp || (atm && satm.sas_family == AF_ATMSVC)) { +@@ -453,8 +452,8 @@ + err("setsockopt"); + } + +- if (connect(fd, atm ? &satm : &sinhim, atm ? sizeof(satm) : +- sizeof(sinhim)) < 0) ++ if (connect(fd, ++ atm ? (struct sockaddr *)&satm : (struct sockaddr *)&sinhim, atm ? sizeof(satm) : sizeof(sinhim)) < 0) + err("connect"); + + mes("connect"); +@@ -482,13 +481,13 @@ + fromlen = sizeof(frominet); + domain = AF_INET; + +- if ((fd=accept(fd, &frominet, &fromlen) ) < 0) ++ if ((fd=accept(fd, (struct sockaddr *)&frominet, &fromlen) ) < 0) + err("accept"); + + { + struct sockaddr_atmsvc peer; + int peerlen = sizeof(peer); +- if (getpeername(fd, (struct sockaddr_in *) &peer, ++ if (getpeername(fd, (struct sockaddr *) &peer, + &peerlen) < 0) { + err("getpeername"); + } +@@ -638,13 +637,13 @@ + nbytes, cput, outfmt((double)nbytes/cput)); + + fprintf(stdout, +- "ttcp%s: %d I/O calls, msec/call = %.2f, calls/sec = %.2f\n", ++ "ttcp%s: %lu I/O calls, msec/call = %.2f, calls/sec = %.2f\n", + trans?"-t":"-r", + numCalls, + 1000.0 * realt/((double)numCalls), + ((double)numCalls)/realt); + fprintf(stdout, +- "ttcp%s: buffer address %#x\n", ++ "ttcp%s: buffer address %p\n", + trans?"-t":"-r", + buf); + } +@@ -656,8 +655,7 @@ + } + + void +-err(s) +-char *s; ++err(const char *s) + { + int en = errno; + +@@ -670,8 +668,7 @@ + } + + void +-mes(s) +-char *s; ++mes(const char *s) + { + fprintf(stderr,"ttcp%s: %s\n", trans?"-t":"-r", s); + } +@@ -681,9 +678,7 @@ + * pattern - + *------------------------------------------------------------------------- + */ +-pattern(cp, cnt) +-register char *cp; +-register int cnt; ++void pattern(char *cp, int cnt) + { + register char c; + c = 0; +@@ -694,9 +689,7 @@ + } + + +-char * +-outfmt(b) +-double b; ++char *outfmt(double b) + { + static char obuf[50]; + switch (fmt) { +@@ -758,7 +751,7 @@ + * P R E P _ T I M E R + */ + void +-prep_timer() ++prep_timer(void) + { + gettimeofday(&start_time, (struct timezone *)0); + getrusage(RUSAGE_SELF, &ru0); +@@ -768,8 +761,7 @@ + * read_timer - + *------------------------------------------------------------------------- + */ +-double read_timer(str,len) +-char *str; ++double read_timer(char *str,int len) + { + struct rusage ru1; + struct timeval tend, tstart, td; +@@ -788,15 +780,11 @@ + return( cput ); + } + +-static void +-prusage(r0, r1, e, b, outp) +- register struct rusage *r0, *r1; +- struct timeval *e, *b; +- char *outp; ++static void prusage(struct rusage *r0, struct rusage *r1, struct timeval *e, struct timeval *b, char *outp) + { + struct timeval tdiff; + register time_t t; +- register char *cp; ++ register const char *cp; + register int i; + int ms; + +@@ -823,13 +811,13 @@ + + case 'U': + tvsub(&tdiff, &r1->ru_utime, &r0->ru_utime); +- sprintf(outp,"%d.%01d", tdiff.tv_sec, tdiff.tv_usec/100000); ++ sprintf(outp,"%ld.%01ld", tdiff.tv_sec, tdiff.tv_usec/100000); + END(outp); + break; + + case 'S': + tvsub(&tdiff, &r1->ru_stime, &r0->ru_stime); +- sprintf(outp,"%d.%01d", tdiff.tv_sec, tdiff.tv_usec/100000); ++ sprintf(outp,"%ld.%01ld", tdiff.tv_sec, tdiff.tv_usec/100000); + END(outp); + break; + +@@ -851,49 +839,49 @@ + break; + + case 'X': +- sprintf(outp,"%d", t == 0 ? 0 : (r1->ru_ixrss-r0->ru_ixrss)/t); ++ sprintf(outp,"%ld", t == 0 ? 0 : (r1->ru_ixrss-r0->ru_ixrss)/t); + END(outp); + break; + + case 'D': +- sprintf(outp,"%d", t == 0 ? 0 : ++ sprintf(outp,"%ld", t == 0 ? 0 : + (r1->ru_idrss+r1->ru_isrss-(r0->ru_idrss+r0->ru_isrss))/t); + END(outp); + break; + + case 'K': +- sprintf(outp,"%d", t == 0 ? 0 : ++ sprintf(outp,"%ld", t == 0 ? 0 : + ((r1->ru_ixrss+r1->ru_isrss+r1->ru_idrss) - + (r0->ru_ixrss+r0->ru_idrss+r0->ru_isrss))/t); + END(outp); + break; + + case 'M': +- sprintf(outp,"%d", r1->ru_maxrss/2); ++ sprintf(outp,"%ld", r1->ru_maxrss/2); + END(outp); + break; + + case 'F': +- sprintf(outp,"%d", r1->ru_majflt-r0->ru_majflt); ++ sprintf(outp,"%ld", r1->ru_majflt-r0->ru_majflt); + END(outp); + break; + + case 'R': +- sprintf(outp,"%d", r1->ru_minflt-r0->ru_minflt); ++ sprintf(outp,"%ld", r1->ru_minflt-r0->ru_minflt); + END(outp); + break; + + case 'I': +- sprintf(outp,"%d", r1->ru_inblock-r0->ru_inblock); ++ sprintf(outp,"%ld", r1->ru_inblock-r0->ru_inblock); + END(outp); + break; + + case 'O': +- sprintf(outp,"%d", r1->ru_oublock-r0->ru_oublock); ++ sprintf(outp,"%ld", r1->ru_oublock-r0->ru_oublock); + END(outp); + break; + case 'C': +- sprintf(outp,"%d+%d", r1->ru_nvcsw-r0->ru_nvcsw, ++ sprintf(outp,"%ld+%ld", r1->ru_nvcsw-r0->ru_nvcsw, + r1->ru_nivcsw-r0->ru_nivcsw ); + END(outp); + break; +@@ -903,9 +891,7 @@ + *outp = '\0'; + } + +-static void +-tvadd(tsum, t0, t1) +- struct timeval *tsum, *t0, *t1; ++static void tvadd(struct timeval *tsum, struct timeval *t0, struct timeval *t1) + { + + tsum->tv_sec = t0->tv_sec + t1->tv_sec; +@@ -919,8 +905,7 @@ + * tvsub - tdiff = t1 - t0 + *------------------------------------------------------------------------- + */ +-static void tvsub(tdiff, t1, t0) +- struct timeval *tdiff, *t1, *t0; ++static void tvsub(struct timeval *tdiff, struct timeval *t1, struct timeval *t0) + { + + tdiff->tv_sec = t1->tv_sec - t0->tv_sec; +@@ -931,10 +916,7 @@ + } + } + +-static void +-psecs(l,cp) +-long l; +-register char *cp; ++static void psecs(long l, char *cp) + { + register int i; + +@@ -958,26 +940,23 @@ + /* + * N R E A D + */ +-Nread( fd, buf, count ) +-int fd; +-char *buf; +-int count; ++int Nread( int nfd, char *Nbuf, int count ) + { + struct sockaddr_in from; + int len = sizeof(from); + register int cnt; + if( udp ) { + #if 0 +- cnt = recvfrom( fd, buf, count, 0, &from, &len ); ++ cnt = recvfrom( nfd, Nbuf, count, 0, &from, &len ); + #else +- cnt = recv( fd, buf, count, 0); ++ cnt = recv( nfd, Nbuf, count, 0); + #endif + numCalls++; + } else { + if( b_flag ) +- cnt = mread( fd, buf, count ); /* fill buf */ ++ cnt = mread( nfd, Nbuf, count ); /* fill buf */ + else { +- cnt = read( fd, buf, count ); ++ cnt = read( nfd, Nbuf, count ); + numCalls++; + } + if (touchdata && cnt > 0) { +@@ -994,17 +973,15 @@ + * Nwrite - + *------------------------------------------------------------------------- + */ +-Nwrite(fd, buf, count) +-int fd; +-char *buf; +-int count; ++int Nwrite(int nfd, char *Nbuf, int count) + { + register int cnt; + + if (udp) { + again: +- if (atm) cnt = write(fd, buf, count); +- else cnt = sendto(fd, buf, count, 0, &sinhim, sizeof(sinhim)); ++ if (atm) cnt = write(nfd, Nbuf, count); ++ else cnt = sendto(nfd, Nbuf, count, 0, (struct sockaddr *)&sinhim, ++ sizeof(sinhim)); + numCalls++; + if ( cnt<0 && errno == ENOBUFS ) { + delay(18000); +@@ -1012,7 +989,7 @@ + goto again; + } + } else { +- cnt = write(fd, buf, count); ++ cnt = write(nfd, Nbuf, count); + numCalls++; + } + if (cnt < 0) perror("WA:write"); +@@ -1020,13 +997,13 @@ + } + + void +-delay(us) ++delay(int us) + { + struct timeval tv; + + tv.tv_sec = 0; + tv.tv_usec = us; +- (void)select( 1, (char *)0, (char *)0, (char *)0, &tv ); ++ (void)select( 1, NULL, NULL, NULL, &tv ); + } + + /* +@@ -1038,17 +1015,13 @@ + * network connections don't deliver data with the same + * grouping as it is written with. Written by Robert S. Miles, BRL. + */ +-int +-mread(fd, bufp, n) +-int fd; +-register char *bufp; +-unsigned n; ++int mread(int mfd, char *bufp, unsigned n) + { + register unsigned count = 0; + register int nread; + + do { +- nread = read(fd, bufp, n-count); ++ nread = read(mfd, bufp, n-count); + numCalls++; + if(nread < 0) { + perror("ttcp_mread"); +--- linux-atm-2.4.1.orig/src/debug/Makefile.in ++++ linux-atm-2.4.1/src/debug/Makefile.in +@@ -1,4 +1,4 @@ +-# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am ++# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am + + # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation +@@ -129,8 +129,9 @@ + + DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +-TAR = gtar ++TAR = tar + GZIP_ENV = --best ++DEP_FILES = .deps/delay.P .deps/svctor.P + SOURCES = $(delay_SOURCES) $(svctor_SOURCES) + OBJECTS = $(delay_OBJECTS) $(svctor_OBJECTS) + +@@ -138,9 +139,9 @@ + .SUFFIXES: + .SUFFIXES: .S .c .lo .o .obj .s + $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +- cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps src/debug/Makefile ++ cd $(top_srcdir) && $(AUTOMAKE) --gnu src/debug/Makefile + +-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +@@ -154,9 +155,6 @@ + + maintainer-clean-noinstPROGRAMS: + +-.c.o: +- $(COMPILE) -c $< +- + # FIXME: We should only use cygpath when building on Windows, + # and only if it is available. + .c.obj: +@@ -179,9 +177,6 @@ + + maintainer-clean-compile: + +-.c.lo: +- $(LIBTOOL) --mode=compile $(COMPILE) -c $< +- + .s.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +@@ -224,7 +219,7 @@ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ +- || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) ++ || (cd $(srcdir) && etags -o $$here/TAGS $(ETAGS_ARGS) $$tags $$unique $(LISP)) + + mostlyclean-tags: + +@@ -240,6 +235,11 @@ + subdir = src/debug + + distdir: $(DISTFILES) ++ here=`cd $(top_builddir) && pwd`; \ ++ top_distdir=`cd $(top_distdir) && pwd`; \ ++ distdir=`cd $(distdir) && pwd`; \ ++ cd $(top_srcdir) \ ++ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu src/debug/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ +@@ -250,11 +250,38 @@ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done +-delay.o: delay.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h +-svctor.o: svctor.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h + ++DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) ++ ++-include $(DEP_FILES) ++ ++mostlyclean-depend: ++ ++clean-depend: ++ ++distclean-depend: ++ -rm -rf .deps ++ ++maintainer-clean-depend: ++ ++%.o: %.c ++ @echo '$(COMPILE) -c $<'; \ ++ $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< ++ @-cp .deps/$(*F).pp .deps/$(*F).P; \ ++ tr ' ' '\012' < .deps/$(*F).pp \ ++ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ ++ >> .deps/$(*F).P; \ ++ rm .deps/$(*F).pp ++ ++%.lo: %.c ++ @echo '$(LTCOMPILE) -c $<'; \ ++ $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< ++ @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ ++ < .deps/$(*F).pp > .deps/$(*F).P; \ ++ tr ' ' '\012' < .deps/$(*F).pp \ ++ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ ++ >> .deps/$(*F).P; \ ++ rm -f .deps/$(*F).pp + info-am: + info: info-am + dvi-am: +@@ -291,27 +318,27 @@ + + maintainer-clean-generic: + mostlyclean-am: mostlyclean-noinstPROGRAMS mostlyclean-compile \ +- mostlyclean-libtool mostlyclean-tags \ ++ mostlyclean-libtool mostlyclean-tags mostlyclean-depend \ + mostlyclean-generic + + mostlyclean: mostlyclean-am + + clean-am: clean-noinstPROGRAMS clean-compile clean-libtool clean-tags \ +- clean-generic mostlyclean-am ++ clean-depend clean-generic mostlyclean-am + + clean: clean-am + + distclean-am: distclean-noinstPROGRAMS distclean-compile \ +- distclean-libtool distclean-tags distclean-generic \ +- clean-am ++ distclean-libtool distclean-tags distclean-depend \ ++ distclean-generic clean-am + -rm -f libtool + + distclean: distclean-am + + maintainer-clean-am: maintainer-clean-noinstPROGRAMS \ + maintainer-clean-compile maintainer-clean-libtool \ +- maintainer-clean-tags maintainer-clean-generic \ +- distclean-am ++ maintainer-clean-tags maintainer-clean-depend \ ++ maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +@@ -322,12 +349,14 @@ + mostlyclean-compile distclean-compile clean-compile \ + maintainer-clean-compile mostlyclean-libtool distclean-libtool \ + clean-libtool maintainer-clean-libtool tags mostlyclean-tags \ +-distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ +-dvi-am dvi check check-am installcheck-am installcheck install-exec-am \ +-install-exec install-data-am install-data install-am install \ +-uninstall-am uninstall all-redirect all-am all installdirs \ +-mostlyclean-generic distclean-generic clean-generic \ +-maintainer-clean-generic clean mostlyclean distclean maintainer-clean ++distclean-tags clean-tags maintainer-clean-tags distdir \ ++mostlyclean-depend distclean-depend clean-depend \ ++maintainer-clean-depend info-am info dvi-am dvi check check-am \ ++installcheck-am installcheck install-exec-am install-exec \ ++install-data-am install-data install-am install uninstall-am uninstall \ ++all-redirect all-am all installdirs mostlyclean-generic \ ++distclean-generic clean-generic maintainer-clean-generic clean \ ++mostlyclean distclean maintainer-clean + + + # Tell versions [3.59,3.63) of GNU make to not export all variables. +--- linux-atm-2.4.1.orig/src/qgen/Makefile.in ++++ linux-atm-2.4.1/src/qgen/Makefile.in +@@ -1,4 +1,4 @@ +-# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am ++# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am + + # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation +@@ -88,8 +88,7 @@ + noinst_PROGRAMS = qgen q.dump # q40.out.o + check_PROGRAMS = q.test + +-qgen_SOURCES = common.c common.h file.c file.h first.c ql_y.y ql_l.l qgen.c \ +- qgen.h second.c third.c ++qgen_SOURCES = common.c common.h file.c file.h first.c ql_y.y ql_l.l qgen.c qgen.h second.c third.c + + qgen_LDADD = -lfl + +@@ -108,17 +107,10 @@ + + EXTRA_DIST = ql_y.h incl.pl mknl.pl msg.fmt TODO + +-CLEANFILES = q.out.h q.out.c q.test.c qd.out.h qd.out.c qd.dump.c qd.test.c \ +- default.nl # q40.out.h q40.out.c q40.test.c ++CLEANFILES = q.out.h q.out.c q.test.c qd.out.h qd.out.c qd.dump.c qd.test.c default.nl # q40.out.h q40.out.c q40.test.c + + +-NLS = atm_ai_msg atm_ai_ie atm_loc atm_cv atm_pu atm_na atm_cond atm_ie \ +- atm_msg atm_np atm_ton atm_sat atm_prs atm_scrn atm_vpa atm_poe \ +- q2931_cs atm_td atm_bc atm_tc atm_stc atm_upcc q2931_proto atm_flag \ +- atm_aalp atm_fd atm_tag atm_l2 atm_l3 atm_tt atm_mc atm_hl atm_imd \ +- atm_tdl atm_tni atm_nip atm_shi atm_oci atm_unfm atm_ofi atm_irs \ +- atm_it atm_lit atm_lsi atm_tcs atm_css atm_eqo atm_eqp atm_aap \ +- atm_asp atm_tor ++NLS = atm_ai_msg atm_ai_ie atm_loc atm_cv atm_pu atm_na atm_cond atm_ie atm_msg atm_np atm_ton atm_sat atm_prs atm_scrn atm_vpa atm_poe q2931_cs atm_td atm_bc atm_tc atm_stc atm_upcc q2931_proto atm_flag atm_aalp atm_fd atm_tag atm_l2 atm_l3 atm_tt atm_mc atm_hl atm_imd atm_tdl atm_tni atm_nip atm_shi atm_oci atm_unfm atm_ofi atm_irs atm_it atm_lit atm_lsi atm_tcs atm_css atm_eqo atm_eqp atm_aap atm_asp atm_tor + + SYMFILES = uni.h $(shell @PERL@ incl.pl $(CFLAGS) linux/atmsap.h) + mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +@@ -155,8 +147,11 @@ + + DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +-TAR = gtar ++TAR = tar + GZIP_ENV = --best ++DEP_FILES = .deps/common.P .deps/file.P .deps/first.P .deps/qgen.P \ ++.deps/ql_l.P .deps/ql_y.P .deps/qlib.P .deps/qtest.P .deps/second.P \ ++.deps/third.P + SOURCES = $(q_test_SOURCES) $(qgen_SOURCES) $(q_dump_SOURCES) $(EXTRA_q_dump_SOURCES) + OBJECTS = $(q_test_OBJECTS) $(qgen_OBJECTS) $(q_dump_OBJECTS) + +@@ -164,9 +159,9 @@ + .SUFFIXES: + .SUFFIXES: .S .c .l .lo .o .obj .s .y + $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +- cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps src/qgen/Makefile ++ cd $(top_srcdir) && $(AUTOMAKE) --gnu src/qgen/Makefile + +-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +@@ -189,9 +184,6 @@ + + maintainer-clean-noinstPROGRAMS: + +-.c.o: +- $(COMPILE) -c $< +- + # FIXME: We should only use cygpath when building on Windows, + # and only if it is available. + .c.obj: +@@ -214,9 +206,6 @@ + + maintainer-clean-compile: + +-.c.lo: +- $(LIBTOOL) --mode=compile $(COMPILE) -c $< +- + .s.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +@@ -272,7 +261,7 @@ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ +- || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) ++ || (cd $(srcdir) && etags -o $$here/TAGS $(ETAGS_ARGS) $$tags $$unique $(LISP)) + + mostlyclean-tags: + +@@ -288,6 +277,11 @@ + subdir = src/qgen + + distdir: $(DISTFILES) ++ here=`cd $(top_builddir) && pwd`; \ ++ top_distdir=`cd $(top_distdir) && pwd`; \ ++ distdir=`cd $(distdir) && pwd`; \ ++ cd $(top_srcdir) \ ++ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu src/qgen/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ +@@ -298,15 +292,38 @@ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done +-common.o: common.c ../../config.h common.h +-file.o: file.c ../../config.h common.h file.h +-first.o: first.c ../../config.h common.h qgen.h file.h +-qgen.o: qgen.c ../../config.h common.h file.h qgen.h +-ql_l.o: ql_l.c ../../config.h common.h qgen.h ql_y.h +-ql_y.o: ql_y.c ../../config.h common.h qgen.h file.h +-second.o: second.c ../../config.h common.h qgen.h file.h +-third.o: third.c ../../config.h common.h qgen.h file.h + ++DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) ++ ++-include $(DEP_FILES) ++ ++mostlyclean-depend: ++ ++clean-depend: ++ ++distclean-depend: ++ -rm -rf .deps ++ ++maintainer-clean-depend: ++ ++%.o: %.c ++ @echo '$(COMPILE) -c $<'; \ ++ $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< ++ @-cp .deps/$(*F).pp .deps/$(*F).P; \ ++ tr ' ' '\012' < .deps/$(*F).pp \ ++ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ ++ >> .deps/$(*F).P; \ ++ rm .deps/$(*F).pp ++ ++%.lo: %.c ++ @echo '$(LTCOMPILE) -c $<'; \ ++ $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< ++ @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ ++ < .deps/$(*F).pp > .deps/$(*F).P; \ ++ tr ' ' '\012' < .deps/$(*F).pp \ ++ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ ++ >> .deps/$(*F).P; \ ++ rm -f .deps/$(*F).pp + info-am: + info: info-am + dvi-am: +@@ -344,21 +361,22 @@ + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + + maintainer-clean-generic: +- -test -z "ql_llql_yhql_yc" || rm -f ql_ll ql_yh ql_yc ++ -test -z "ql_lcql_yhql_yc" || rm -f ql_lc ql_yh ql_yc + mostlyclean-am: mostlyclean-checkPROGRAMS mostlyclean-noinstPROGRAMS \ + mostlyclean-compile mostlyclean-libtool \ +- mostlyclean-tags mostlyclean-generic ++ mostlyclean-tags mostlyclean-depend mostlyclean-generic + + mostlyclean: mostlyclean-am + + clean-am: clean-checkPROGRAMS clean-noinstPROGRAMS clean-compile \ +- clean-libtool clean-tags clean-generic mostlyclean-am ++ clean-libtool clean-tags clean-depend clean-generic \ ++ mostlyclean-am + + clean: clean-am + + distclean-am: distclean-checkPROGRAMS distclean-noinstPROGRAMS \ + distclean-compile distclean-libtool distclean-tags \ +- distclean-generic clean-am ++ distclean-depend distclean-generic clean-am + -rm -f libtool + + distclean: distclean-am +@@ -366,8 +384,8 @@ + maintainer-clean-am: maintainer-clean-checkPROGRAMS \ + maintainer-clean-noinstPROGRAMS \ + maintainer-clean-compile maintainer-clean-libtool \ +- maintainer-clean-tags maintainer-clean-generic \ +- distclean-am ++ maintainer-clean-tags maintainer-clean-depend \ ++ maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +@@ -380,12 +398,14 @@ + mostlyclean-compile distclean-compile clean-compile \ + maintainer-clean-compile mostlyclean-libtool distclean-libtool \ + clean-libtool maintainer-clean-libtool tags mostlyclean-tags \ +-distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ +-dvi-am dvi check check-am installcheck-am installcheck install-exec-am \ +-install-exec install-data-am install-data install-am install \ +-uninstall-am uninstall all-redirect all-am all installdirs \ +-mostlyclean-generic distclean-generic clean-generic \ +-maintainer-clean-generic clean mostlyclean distclean maintainer-clean ++distclean-tags clean-tags maintainer-clean-tags distdir \ ++mostlyclean-depend distclean-depend clean-depend \ ++maintainer-clean-depend info-am info dvi-am dvi check check-am \ ++installcheck-am installcheck install-exec-am install-exec \ ++install-data-am install-data install-am install uninstall-am uninstall \ ++all-redirect all-am all installdirs mostlyclean-generic \ ++distclean-generic clean-generic maintainer-clean-generic clean \ ++mostlyclean distclean maintainer-clean + + + default.nl: mknl.pl $(SYMFILES) +--- linux-atm-2.4.1.orig/src/qgen/ql_l.c ++++ linux-atm-2.4.1/src/qgen/ql_l.c +@@ -1,32 +1,85 @@ +-/* A lexical scanner generated by flex */ + +-/* Scanner skeleton version: +- * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $ +- */ ++#line 3 "lex.yy.c" ++ ++#define YY_INT_ALIGNED short int ++ ++/* A lexical scanner generated by flex */ + + #define FLEX_SCANNER + #define YY_FLEX_MAJOR_VERSION 2 + #define YY_FLEX_MINOR_VERSION 5 ++#define YY_FLEX_SUBMINOR_VERSION 31 ++#if YY_FLEX_SUBMINOR_VERSION > 0 ++#define FLEX_BETA ++#endif + ++/* First, we deal with platform-specific or compiler-specific issues. */ ++ ++/* begin standard C headers. */ + #include <stdio.h> +-#include <unistd.h> ++#include <string.h> ++#include <errno.h> ++#include <stdlib.h> + ++/* end standard C headers. */ + +-/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ +-#ifdef c_plusplus +-#ifndef __cplusplus +-#define __cplusplus ++/* flex integer type definitions */ ++ ++#ifndef FLEXINT_H ++#define FLEXINT_H ++ ++/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ ++ ++#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L ++#include <inttypes.h> ++typedef int8_t flex_int8_t; ++typedef uint8_t flex_uint8_t; ++typedef int16_t flex_int16_t; ++typedef uint16_t flex_uint16_t; ++typedef int32_t flex_int32_t; ++typedef uint32_t flex_uint32_t; ++#else ++typedef signed char flex_int8_t; ++typedef short int flex_int16_t; ++typedef int flex_int32_t; ++typedef unsigned char flex_uint8_t; ++typedef unsigned short int flex_uint16_t; ++typedef unsigned int flex_uint32_t; ++#endif /* ! C99 */ ++ ++/* Limits of integral types. */ ++#ifndef INT8_MIN ++#define INT8_MIN (-128) ++#endif ++#ifndef INT16_MIN ++#define INT16_MIN (-32767-1) ++#endif ++#ifndef INT32_MIN ++#define INT32_MIN (-2147483647-1) + #endif ++#ifndef INT8_MAX ++#define INT8_MAX (127) ++#endif ++#ifndef INT16_MAX ++#define INT16_MAX (32767) ++#endif ++#ifndef INT32_MAX ++#define INT32_MAX (2147483647) ++#endif ++#ifndef UINT8_MAX ++#define UINT8_MAX (255U) ++#endif ++#ifndef UINT16_MAX ++#define UINT16_MAX (65535U) ++#endif ++#ifndef UINT32_MAX ++#define UINT32_MAX (4294967295U) + #endif + ++#endif /* ! FLEXINT_H */ + + #ifdef __cplusplus + +-#include <stdlib.h> +- +-/* Use prototypes in function declarations. */ +-#define YY_USE_PROTOS +- + /* The "const" storage-class-modifier is valid. */ + #define YY_USE_CONST + +@@ -34,34 +87,17 @@ + + #if __STDC__ + +-#define YY_USE_PROTOS + #define YY_USE_CONST + + #endif /* __STDC__ */ + #endif /* ! __cplusplus */ + +-#ifdef __TURBOC__ +- #pragma warn -rch +- #pragma warn -use +-#include <io.h> +-#include <stdlib.h> +-#define YY_USE_CONST +-#define YY_USE_PROTOS +-#endif +- + #ifdef YY_USE_CONST + #define yyconst const + #else + #define yyconst + #endif + +- +-#ifdef YY_USE_PROTOS +-#define YY_PROTO(proto) proto +-#else +-#define YY_PROTO(proto) () +-#endif +- + /* Returned upon end-of-file. */ + #define YY_NULL 0 + +@@ -76,71 +112,71 @@ + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +-#define BEGIN yy_start = 1 + 2 * ++#define BEGIN (yy_start) = 1 + 2 * + + /* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +-#define YY_START ((yy_start - 1) / 2) ++#define YY_START (((yy_start) - 1) / 2) + #define YYSTATE YY_START + + /* Action number for EOF rule of a given start state. */ + #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + + /* Special action meaning "start processing a new file". */ +-#define YY_NEW_FILE yyrestart( yyin ) ++#define YY_NEW_FILE yyrestart(yyin ) + + #define YY_END_OF_BUFFER_CHAR 0 + + /* Size of default input buffer. */ ++#ifndef YY_BUF_SIZE + #define YY_BUF_SIZE 16384 ++#endif + ++#ifndef YY_TYPEDEF_YY_BUFFER_STATE ++#define YY_TYPEDEF_YY_BUFFER_STATE + typedef struct yy_buffer_state *YY_BUFFER_STATE; ++#endif + + extern int yyleng; ++ + extern FILE *yyin, *yyout; + + #define EOB_ACT_CONTINUE_SCAN 0 + #define EOB_ACT_END_OF_FILE 1 + #define EOB_ACT_LAST_MATCH 2 + +-/* The funky do-while in the following #define is used to turn the definition +- * int a single C statement (which needs a semi-colon terminator). This +- * avoids problems with code like: +- * +- * if ( condition_holds ) +- * yyless( 5 ); +- * else +- * do_something_else(); +- * +- * Prior to using the do-while the compiler would get upset at the +- * "else" because it interpreted the "if" statement as being all +- * done when it reached the ';' after the yyless() call. +- */ +- +-/* Return all but the first 'n' matched characters back to the input stream. */ +- ++ #define YY_LESS_LINENO(n) ++ ++/* Return all but the first "n" matched characters back to the input stream. */ + #define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ +- *yy_cp = yy_hold_char; \ ++ int yyless_macro_arg = (n); \ ++ YY_LESS_LINENO(yyless_macro_arg);\ ++ *yy_cp = (yy_hold_char); \ + YY_RESTORE_YY_MORE_OFFSET \ +- yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ ++ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +-#define unput(c) yyunput( c, yytext_ptr ) ++#define unput(c) yyunput( c, (yytext_ptr) ) + + /* The following is because we cannot portably get our hands on size_t + * (without autoconf's help, which isn't available because we want + * flex-generated scanners to compile on their own). + */ +-typedef unsigned int yy_size_t; + ++#ifndef YY_TYPEDEF_YY_SIZE_T ++#define YY_TYPEDEF_YY_SIZE_T ++typedef unsigned int yy_size_t; ++#endif + ++#ifndef YY_STRUCT_YY_BUFFER_STATE ++#define YY_STRUCT_YY_BUFFER_STATE + struct yy_buffer_state + { + FILE *yy_input_file; +@@ -177,12 +213,16 @@ + */ + int yy_at_bol; + ++ int yy_bs_lineno; /**< The line count. */ ++ int yy_bs_column; /**< The column count. */ ++ + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; ++ + #define YY_BUFFER_NEW 0 + #define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process +@@ -196,23 +236,33 @@ + * just pointing yyin at a new input file. + */ + #define YY_BUFFER_EOF_PENDING 2 ++ + }; ++#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +-static YY_BUFFER_STATE yy_current_buffer = 0; ++/* Stack of input buffers. */ ++static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ ++static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ ++static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ + + /* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". ++ * ++ * Returns the top of the stack, or NULL. + */ +-#define YY_CURRENT_BUFFER yy_current_buffer ++#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ ++ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ ++ : NULL) + ++/* Same as previous macro, but useful when we know that the buffer stack is not ++ * NULL or when we need an lvalue. For internal use only. ++ */ ++#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] + + /* yy_hold_char holds the character lost when yytext is formed. */ + static char yy_hold_char; +- + static int yy_n_chars; /* number of characters read into yy_ch_buf */ +- +- + int yyleng; + + /* Points to current character in buffer. */ +@@ -225,66 +275,92 @@ + */ + static int yy_did_buffer_switch_on_eof; + +-void yyrestart YY_PROTO(( FILE *input_file )); +- +-void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); +-void yy_load_buffer_state YY_PROTO(( void )); +-YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); +-void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); +-void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); +-void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); +-#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) +- +-YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); +-YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); +-YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); +- +-static void *yy_flex_alloc YY_PROTO(( yy_size_t )); +-static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); +-static void yy_flex_free YY_PROTO(( void * )); ++void yyrestart (FILE *input_file ); ++void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); ++YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); ++void yy_delete_buffer (YY_BUFFER_STATE b ); ++void yy_flush_buffer (YY_BUFFER_STATE b ); ++void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); ++void yypop_buffer_state (void ); ++ ++static void yyensure_buffer_stack (void ); ++static void yy_load_buffer_state (void ); ++static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); ++ ++#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) ++ ++YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); ++YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); ++YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); ++ ++void *yyalloc (yy_size_t ); ++void *yyrealloc (void *,yy_size_t ); ++void yyfree (void * ); + + #define yy_new_buffer yy_create_buffer + + #define yy_set_interactive(is_interactive) \ + { \ +- if ( ! yy_current_buffer ) \ +- yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ +- yy_current_buffer->yy_is_interactive = is_interactive; \ ++ if ( ! YY_CURRENT_BUFFER ){ \ ++ yyensure_buffer_stack (); \ ++ YY_CURRENT_BUFFER_LVALUE = \ ++ yy_create_buffer(yyin,YY_BUF_SIZE ); \ ++ } \ ++ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } + + #define yy_set_bol(at_bol) \ + { \ +- if ( ! yy_current_buffer ) \ +- yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ +- yy_current_buffer->yy_at_bol = at_bol; \ ++ if ( ! YY_CURRENT_BUFFER ){\ ++ yyensure_buffer_stack (); \ ++ YY_CURRENT_BUFFER_LVALUE = \ ++ yy_create_buffer(yyin,YY_BUF_SIZE ); \ ++ } \ ++ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } + +-#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) ++#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) ++ ++/* Begin user sect3 */ + + typedef unsigned char YY_CHAR; ++ + FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; ++ + typedef int yy_state_type; ++ ++extern int yylineno; ++ ++int yylineno = 1; ++ + extern char *yytext; + #define yytext_ptr yytext + +-static yy_state_type yy_get_previous_state YY_PROTO(( void )); +-static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); +-static int yy_get_next_buffer YY_PROTO(( void )); +-static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); ++static yy_state_type yy_get_previous_state (void ); ++static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); ++static int yy_get_next_buffer (void ); ++static void yy_fatal_error (yyconst char msg[] ); + + /* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ + #define YY_DO_BEFORE_ACTION \ +- yytext_ptr = yy_bp; \ +- yyleng = (int) (yy_cp - yy_bp); \ +- yy_hold_char = *yy_cp; \ ++ (yytext_ptr) = yy_bp; \ ++ yyleng = (size_t) (yy_cp - yy_bp); \ ++ (yy_hold_char) = *yy_cp; \ + *yy_cp = '\0'; \ +- yy_c_buf_p = yy_cp; ++ (yy_c_buf_p) = yy_cp; + + #define YY_NUM_RULES 16 + #define YY_END_OF_BUFFER 17 +-static yyconst short int yy_accept[70] = ++/* This struct is not used in this scanner, ++ but its presence is necessary. */ ++struct yy_trans_info ++ { ++ flex_int32_t yy_verify; ++ flex_int32_t yy_nxt; ++ }; ++static yyconst flex_int16_t yy_accept[70] = + { 0, + 10, 10, 17, 15, 10, 10, 15, 15, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 10, 0, 0, +@@ -295,7 +371,7 @@ + 7, 0, 0, 0, 0, 0, 11, 12, 0 + } ; + +-static yyconst int yy_ec[256] = ++static yyconst flex_int32_t yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +@@ -327,14 +403,14 @@ + 1, 1, 1, 1, 1 + } ; + +-static yyconst int yy_meta[29] = ++static yyconst flex_int32_t yy_meta[29] = + { 0, + 1, 2, 2, 1, 3, 1, 4, 5, 5, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4 + } ; + +-static yyconst short int yy_base[75] = ++static yyconst flex_int16_t yy_base[75] = + { 0, + 0, 0, 99, 100, 27, 28, 0, 95, 0, 86, + 72, 85, 80, 71, 78, 64, 76, 31, 84, 85, +@@ -346,7 +422,7 @@ + 48, 34, 53, 58 + } ; + +-static yyconst short int yy_def[75] = ++static yyconst flex_int16_t yy_def[75] = + { 0, + 69, 1, 69, 69, 69, 69, 70, 71, 72, 72, + 72, 72, 72, 72, 72, 72, 72, 69, 70, 71, +@@ -358,7 +434,7 @@ + 69, 69, 69, 69 + } ; + +-static yyconst short int yy_nxt[129] = ++static yyconst flex_int16_t yy_nxt[129] = + { 0, + 4, 5, 6, 5, 7, 8, 9, 4, 4, 10, + 11, 12, 13, 9, 9, 9, 9, 14, 9, 15, +@@ -376,7 +452,7 @@ + 69, 69, 69, 69, 69, 69, 69, 69 + } ; + +-static yyconst short int yy_chk[129] = ++static yyconst flex_int16_t yy_chk[129] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +@@ -397,6 +473,9 @@ + static yy_state_type yy_last_accepting_state; + static char *yy_last_accepting_cpos; + ++extern int yy_flex_debug; ++int yy_flex_debug = 0; ++ + /* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +@@ -406,7 +485,6 @@ + #define YY_RESTORE_YY_MORE_OFFSET + char *yytext; + #line 1 "ql_l.l" +-#define INITIAL 0 + #line 2 "ql_l.l" + /* ql.l - Q.2931 data structures description language */ + +@@ -451,7 +529,21 @@ + return (*walk)->str; + } + +-#line 455 "lex.yy.c" ++#line 533 "lex.yy.c" ++ ++#define INITIAL 0 ++ ++#ifndef YY_NO_UNISTD_H ++/* Special case for "unistd.h", since it is non-ANSI. We include it way ++ * down here because we want the user's section 1 to have been scanned first. ++ * The user has a chance to override it with an option. ++ */ ++#include <unistd.h> ++#endif ++ ++#ifndef YY_EXTRA_TYPE ++#define YY_EXTRA_TYPE void * ++#endif + + /* Macros after this point can all be overridden by user definitions in + * section 1. +@@ -459,65 +551,30 @@ + + #ifndef YY_SKIP_YYWRAP + #ifdef __cplusplus +-extern "C" int yywrap YY_PROTO(( void )); ++extern "C" int yywrap (void ); + #else +-extern int yywrap YY_PROTO(( void )); ++extern int yywrap (void ); + #endif + #endif + +-#ifndef YY_NO_UNPUT +-static void yyunput YY_PROTO(( int c, char *buf_ptr )); +-#endif +- ++ static void yyunput (int c,char *buf_ptr ); ++ + #ifndef yytext_ptr +-static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); ++static void yy_flex_strncpy (char *,yyconst char *,int ); + #endif + + #ifdef YY_NEED_STRLEN +-static int yy_flex_strlen YY_PROTO(( yyconst char * )); ++static int yy_flex_strlen (yyconst char * ); + #endif + + #ifndef YY_NO_INPUT ++ + #ifdef __cplusplus +-static int yyinput YY_PROTO(( void )); ++static int yyinput (void ); + #else +-static int input YY_PROTO(( void )); +-#endif +-#endif +- +-#if YY_STACK_USED +-static int yy_start_stack_ptr = 0; +-static int yy_start_stack_depth = 0; +-static int *yy_start_stack = 0; +-#ifndef YY_NO_PUSH_STATE +-static void yy_push_state YY_PROTO(( int new_state )); +-#endif +-#ifndef YY_NO_POP_STATE +-static void yy_pop_state YY_PROTO(( void )); +-#endif +-#ifndef YY_NO_TOP_STATE +-static int yy_top_state YY_PROTO(( void )); ++static int input (void ); + #endif + +-#else +-#define YY_NO_PUSH_STATE 1 +-#define YY_NO_POP_STATE 1 +-#define YY_NO_TOP_STATE 1 +-#endif +- +-#ifdef YY_MALLOC_DECL +-YY_MALLOC_DECL +-#else +-#if __STDC__ +-#ifndef __cplusplus +-#include <stdlib.h> +-#endif +-#else +-/* Just try to get by without declaring the routines. This will fail +- * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) +- * or sizeof(void*) != sizeof(int). +- */ +-#endif + #endif + + /* Amount of stuff to slurp up with each read. */ +@@ -526,7 +583,6 @@ + #endif + + /* Copy whatever the last rule matched to the standard output. */ +- + #ifndef ECHO + /* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). +@@ -539,9 +595,10 @@ + */ + #ifndef YY_INPUT + #define YY_INPUT(buf,result,max_size) \ +- if ( yy_current_buffer->yy_is_interactive ) \ ++ if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ +- int c = '*', n; \ ++ int c = '*'; \ ++ size_t n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ +@@ -551,9 +608,22 @@ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ +- else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ +- && ferror( yyin ) ) \ +- YY_FATAL_ERROR( "input in flex scanner failed" ); ++ else \ ++ { \ ++ errno=0; \ ++ while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ ++ { \ ++ if( errno != EINTR) \ ++ { \ ++ YY_FATAL_ERROR( "input in flex scanner failed" ); \ ++ break; \ ++ } \ ++ errno=0; \ ++ clearerr(yyin); \ ++ } \ ++ }\ ++\ ++ + #endif + + /* No semi-colon after return; correct usage is to write "yyterminate();" - +@@ -574,12 +644,18 @@ + #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) + #endif + ++/* end tables serialization structures and prototypes */ ++ + /* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ + #ifndef YY_DECL +-#define YY_DECL int yylex YY_PROTO(( void )) +-#endif ++#define YY_DECL_IS_OURS 1 ++ ++extern int yylex (void); ++ ++#define YY_DECL int yylex (void) ++#endif /* !YY_DECL */ + + /* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. +@@ -596,27 +672,29 @@ + #define YY_RULE_SETUP \ + YY_USER_ACTION + ++/** The main scanner function which does all the work. ++ */ + YY_DECL +- { ++{ + register yy_state_type yy_current_state; +- register char *yy_cp = NULL, *yy_bp = NULL; ++ register char *yy_cp, *yy_bp; + register int yy_act; +- ++ + #line 47 "ql_l.l" + + +-#line 609 "lex.yy.c" ++#line 687 "lex.yy.c" + +- if ( yy_init ) ++ if ( (yy_init) ) + { +- yy_init = 0; ++ (yy_init) = 0; + + #ifdef YY_USER_INIT + YY_USER_INIT; + #endif + +- if ( ! yy_start ) +- yy_start = 1; /* first start state */ ++ if ( ! (yy_start) ) ++ (yy_start) = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; +@@ -624,34 +702,36 @@ + if ( ! yyout ) + yyout = stdout; + +- if ( ! yy_current_buffer ) +- yy_current_buffer = +- yy_create_buffer( yyin, YY_BUF_SIZE ); ++ if ( ! YY_CURRENT_BUFFER ) { ++ yyensure_buffer_stack (); ++ YY_CURRENT_BUFFER_LVALUE = ++ yy_create_buffer(yyin,YY_BUF_SIZE ); ++ } + +- yy_load_buffer_state(); ++ yy_load_buffer_state( ); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { +- yy_cp = yy_c_buf_p; ++ yy_cp = (yy_c_buf_p); + + /* Support of yytext. */ +- *yy_cp = yy_hold_char; ++ *yy_cp = (yy_hold_char); + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + +- yy_current_state = yy_start; ++ yy_current_state = (yy_start); + yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { +- yy_last_accepting_state = yy_current_state; +- yy_last_accepting_cpos = yy_cp; ++ (yy_last_accepting_state) = yy_current_state; ++ (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { +@@ -668,24 +748,22 @@ + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ +- yy_cp = yy_last_accepting_cpos; +- yy_current_state = yy_last_accepting_state; ++ yy_cp = (yy_last_accepting_cpos); ++ yy_current_state = (yy_last_accepting_state); + yy_act = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + +- + do_action: /* This label is used only to access EOF actions. */ + +- + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ +- *yy_cp = yy_hold_char; +- yy_cp = yy_last_accepting_cpos; +- yy_current_state = yy_last_accepting_state; ++ *yy_cp = (yy_hold_char); ++ yy_cp = (yy_last_accepting_cpos); ++ yy_current_state = (yy_last_accepting_state); + goto yy_find_action; + + case 1: +@@ -735,6 +813,7 @@ + return TOK_ID; } + YY_BREAK + case 10: ++/* rule 10 can match eol */ + YY_RULE_SETUP + #line 59 "ql_l.l" + lineno += *yytext == '\n'; +@@ -755,6 +834,7 @@ + return TOK_STRING; } + YY_BREAK + case 14: ++/* rule 14 can match eol */ + YY_RULE_SETUP + #line 66 "ql_l.l" + lineno++; +@@ -769,33 +849,33 @@ + #line 69 "ql_l.l" + ECHO; + YY_BREAK +-#line 773 "lex.yy.c" ++#line 853 "lex.yy.c" + case YY_STATE_EOF(INITIAL): + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ +- int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; ++ int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ +- *yy_cp = yy_hold_char; ++ *yy_cp = (yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET + +- if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) ++ if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure +- * consistency between yy_current_buffer and our ++ * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ +- yy_n_chars = yy_current_buffer->yy_n_chars; +- yy_current_buffer->yy_input_file = yyin; +- yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; ++ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; ++ YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; ++ YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position +@@ -805,13 +885,13 @@ + * end-of-buffer state). Contrast this with the test + * in input(). + */ +- if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) ++ if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + +- yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; ++ (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + +- yy_current_state = yy_get_previous_state(); ++ yy_current_state = yy_get_previous_state( ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have +@@ -824,30 +904,30 @@ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + +- yy_bp = yytext_ptr + YY_MORE_ADJ; ++ yy_bp = (yytext_ptr) + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ +- yy_cp = ++yy_c_buf_p; ++ yy_cp = ++(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { +- yy_cp = yy_c_buf_p; ++ yy_cp = (yy_c_buf_p); + goto yy_find_action; + } + } + +- else switch ( yy_get_next_buffer() ) ++ else switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_END_OF_FILE: + { +- yy_did_buffer_switch_on_eof = 0; ++ (yy_did_buffer_switch_on_eof) = 0; + +- if ( yywrap() ) ++ if ( yywrap( ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up +@@ -858,7 +938,7 @@ + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ +- yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; ++ (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; +@@ -866,30 +946,30 @@ + + else + { +- if ( ! yy_did_buffer_switch_on_eof ) ++ if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: +- yy_c_buf_p = +- yytext_ptr + yy_amount_of_matched_text; ++ (yy_c_buf_p) = ++ (yytext_ptr) + yy_amount_of_matched_text; + +- yy_current_state = yy_get_previous_state(); ++ yy_current_state = yy_get_previous_state( ); + +- yy_cp = yy_c_buf_p; +- yy_bp = yytext_ptr + YY_MORE_ADJ; ++ yy_cp = (yy_c_buf_p); ++ yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: +- yy_c_buf_p = +- &yy_current_buffer->yy_ch_buf[yy_n_chars]; ++ (yy_c_buf_p) = ++ &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; + +- yy_current_state = yy_get_previous_state(); ++ yy_current_state = yy_get_previous_state( ); + +- yy_cp = yy_c_buf_p; +- yy_bp = yytext_ptr + YY_MORE_ADJ; ++ yy_cp = (yy_c_buf_p); ++ yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_find_action; + } + break; +@@ -900,8 +980,7 @@ + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ +- } /* end of yylex */ +- ++} /* end of yylex */ + + /* yy_get_next_buffer - try to read in a new buffer + * +@@ -910,21 +989,20 @@ + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +- +-static int yy_get_next_buffer() +- { +- register char *dest = yy_current_buffer->yy_ch_buf; +- register char *source = yytext_ptr; ++static int yy_get_next_buffer (void) ++{ ++ register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; ++ register char *source = (yytext_ptr); + register int number_to_move, i; + int ret_val; + +- if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) ++ if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + +- if ( yy_current_buffer->yy_fill_buffer == 0 ) ++ if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ +- if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) ++ if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. +@@ -944,34 +1022,30 @@ + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ +- number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; ++ number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + +- if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) ++ if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ +- yy_current_buffer->yy_n_chars = yy_n_chars = 0; ++ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; + + else + { +- int num_to_read = +- yy_current_buffer->yy_buf_size - number_to_move - 1; ++ size_t num_to_read = ++ YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ +-#ifdef YY_USES_REJECT +- YY_FATAL_ERROR( +-"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); +-#else + + /* just a shorter name for the current buffer */ +- YY_BUFFER_STATE b = yy_current_buffer; ++ YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + + int yy_c_buf_p_offset = +- (int) (yy_c_buf_p - b->yy_ch_buf); ++ (int) ((yy_c_buf_p) - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { +@@ -984,8 +1058,7 @@ + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ +- yy_flex_realloc( (void *) b->yy_ch_buf, +- b->yy_buf_size + 2 ); ++ yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ +@@ -995,35 +1068,35 @@ + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + +- yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; ++ (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; + +- num_to_read = yy_current_buffer->yy_buf_size - ++ num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; +-#endif ++ + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ +- YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), +- yy_n_chars, num_to_read ); ++ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), ++ (yy_n_chars), num_to_read ); + +- yy_current_buffer->yy_n_chars = yy_n_chars; ++ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + +- if ( yy_n_chars == 0 ) ++ if ( (yy_n_chars) == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; +- yyrestart( yyin ); ++ yyrestart(yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; +- yy_current_buffer->yy_buffer_status = ++ YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } +@@ -1031,32 +1104,31 @@ + else + ret_val = EOB_ACT_CONTINUE_SCAN; + +- yy_n_chars += number_to_move; +- yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; +- yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; ++ (yy_n_chars) += number_to_move; ++ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; ++ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + +- yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; ++ (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +- } +- ++} + + /* yy_get_previous_state - get the state just before the EOB char was reached */ + +-static yy_state_type yy_get_previous_state() +- { ++ static yy_state_type yy_get_previous_state (void) ++{ + register yy_state_type yy_current_state; + register char *yy_cp; ++ ++ yy_current_state = (yy_start); + +- yy_current_state = yy_start; +- +- for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) ++ for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { +- yy_last_accepting_state = yy_current_state; +- yy_last_accepting_cpos = yy_cp; ++ (yy_last_accepting_state) = yy_current_state; ++ (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { +@@ -1068,30 +1140,23 @@ + } + + return yy_current_state; +- } +- ++} + + /* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ +- +-#ifdef YY_USE_PROTOS +-static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) +-#else +-static yy_state_type yy_try_NUL_trans( yy_current_state ) +-yy_state_type yy_current_state; +-#endif +- { ++ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) ++{ + register int yy_is_jam; +- register char *yy_cp = yy_c_buf_p; ++ register char *yy_cp = (yy_c_buf_p); + + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { +- yy_last_accepting_state = yy_current_state; +- yy_last_accepting_cpos = yy_cp; ++ (yy_last_accepting_state) = yy_current_state; ++ (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { +@@ -1103,80 +1168,73 @@ + yy_is_jam = (yy_current_state == 69); + + return yy_is_jam ? 0 : yy_current_state; +- } +- ++} + +-#ifndef YY_NO_UNPUT +-#ifdef YY_USE_PROTOS +-static void yyunput( int c, register char *yy_bp ) +-#else +-static void yyunput( c, yy_bp ) +-int c; +-register char *yy_bp; +-#endif +- { +- register char *yy_cp = yy_c_buf_p; ++ static void yyunput (int c, register char * yy_bp ) ++{ ++ register char *yy_cp; ++ ++ yy_cp = (yy_c_buf_p); + + /* undo effects of setting up yytext */ +- *yy_cp = yy_hold_char; ++ *yy_cp = (yy_hold_char); + +- if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) ++ if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ +- register int number_to_move = yy_n_chars + 2; +- register char *dest = &yy_current_buffer->yy_ch_buf[ +- yy_current_buffer->yy_buf_size + 2]; ++ register int number_to_move = (yy_n_chars) + 2; ++ register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ ++ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + register char *source = +- &yy_current_buffer->yy_ch_buf[number_to_move]; ++ &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + +- while ( source > yy_current_buffer->yy_ch_buf ) ++ while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); +- yy_current_buffer->yy_n_chars = +- yy_n_chars = yy_current_buffer->yy_buf_size; ++ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = ++ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + +- if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) ++ if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + ++ (yytext_ptr) = yy_bp; ++ (yy_hold_char) = *yy_cp; ++ (yy_c_buf_p) = yy_cp; ++} + +- yytext_ptr = yy_bp; +- yy_hold_char = *yy_cp; +- yy_c_buf_p = yy_cp; +- } +-#endif /* ifndef YY_NO_UNPUT */ +- +- ++#ifndef YY_NO_INPUT + #ifdef __cplusplus +-static int yyinput() ++ static int yyinput (void) + #else +-static int input() ++ static int input (void) + #endif +- { +- int c; + +- *yy_c_buf_p = yy_hold_char; ++{ ++ int c; ++ ++ *(yy_c_buf_p) = (yy_hold_char); + +- if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) ++ if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ +- if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) ++ if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + /* This was really a NUL. */ +- *yy_c_buf_p = '\0'; ++ *(yy_c_buf_p) = '\0'; + + else + { /* need more input */ +- int offset = yy_c_buf_p - yytext_ptr; +- ++yy_c_buf_p; ++ int offset = (yy_c_buf_p) - (yytext_ptr); ++ ++(yy_c_buf_p); + +- switch ( yy_get_next_buffer() ) ++ switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() +@@ -1190,16 +1248,16 @@ + */ + + /* Reset buffer status. */ +- yyrestart( yyin ); ++ yyrestart(yyin ); + +- /* fall through */ ++ /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { +- if ( yywrap() ) ++ if ( yywrap( ) ) + return EOF; + +- if ( ! yy_did_buffer_switch_on_eof ) ++ if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + #ifdef __cplusplus + return yyinput(); +@@ -1209,90 +1267,92 @@ + } + + case EOB_ACT_CONTINUE_SCAN: +- yy_c_buf_p = yytext_ptr + offset; ++ (yy_c_buf_p) = (yytext_ptr) + offset; + break; + } + } + } + +- c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ +- *yy_c_buf_p = '\0'; /* preserve yytext */ +- yy_hold_char = *++yy_c_buf_p; +- ++ c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ ++ *(yy_c_buf_p) = '\0'; /* preserve yytext */ ++ (yy_hold_char) = *++(yy_c_buf_p); + + return c; +- } +- +- +-#ifdef YY_USE_PROTOS +-void yyrestart( FILE *input_file ) +-#else +-void yyrestart( input_file ) +-FILE *input_file; +-#endif +- { +- if ( ! yy_current_buffer ) +- yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); ++} ++#endif /* ifndef YY_NO_INPUT */ + +- yy_init_buffer( yy_current_buffer, input_file ); +- yy_load_buffer_state(); ++/** Immediately switch to a different input stream. ++ * @param input_file A readable stream. ++ * ++ * @note This function does not reset the start condition to @c INITIAL . ++ */ ++ void yyrestart (FILE * input_file ) ++{ ++ ++ if ( ! YY_CURRENT_BUFFER ){ ++ yyensure_buffer_stack (); ++ YY_CURRENT_BUFFER_LVALUE = ++ yy_create_buffer(yyin,YY_BUF_SIZE ); + } + ++ yy_init_buffer(YY_CURRENT_BUFFER,input_file ); ++ yy_load_buffer_state( ); ++} + +-#ifdef YY_USE_PROTOS +-void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) +-#else +-void yy_switch_to_buffer( new_buffer ) +-YY_BUFFER_STATE new_buffer; +-#endif +- { +- if ( yy_current_buffer == new_buffer ) ++/** Switch to a different input buffer. ++ * @param new_buffer The new input buffer. ++ * ++ */ ++ void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) ++{ ++ ++ /* TODO. We should be able to replace this entire function body ++ * with ++ * yypop_buffer_state(); ++ * yypush_buffer_state(new_buffer); ++ */ ++ yyensure_buffer_stack (); ++ if ( YY_CURRENT_BUFFER == new_buffer ) + return; + +- if ( yy_current_buffer ) ++ if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ +- *yy_c_buf_p = yy_hold_char; +- yy_current_buffer->yy_buf_pos = yy_c_buf_p; +- yy_current_buffer->yy_n_chars = yy_n_chars; ++ *(yy_c_buf_p) = (yy_hold_char); ++ YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); ++ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + +- yy_current_buffer = new_buffer; +- yy_load_buffer_state(); ++ YY_CURRENT_BUFFER_LVALUE = new_buffer; ++ yy_load_buffer_state( ); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ +- yy_did_buffer_switch_on_eof = 1; +- } +- +- +-#ifdef YY_USE_PROTOS +-void yy_load_buffer_state( void ) +-#else +-void yy_load_buffer_state() +-#endif +- { +- yy_n_chars = yy_current_buffer->yy_n_chars; +- yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; +- yyin = yy_current_buffer->yy_input_file; +- yy_hold_char = *yy_c_buf_p; +- } ++ (yy_did_buffer_switch_on_eof) = 1; ++} + ++static void yy_load_buffer_state (void) ++{ ++ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; ++ (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; ++ yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; ++ (yy_hold_char) = *(yy_c_buf_p); ++} + +-#ifdef YY_USE_PROTOS +-YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) +-#else +-YY_BUFFER_STATE yy_create_buffer( file, size ) +-FILE *file; +-int size; +-#endif +- { ++/** Allocate and initialize an input buffer state. ++ * @param file A readable stream. ++ * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. ++ * ++ * @return the allocated buffer state. ++ */ ++ YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) ++{ + YY_BUFFER_STATE b; +- +- b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); ++ ++ b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + +@@ -1301,75 +1361,75 @@ + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ +- b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); ++ b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + +- yy_init_buffer( b, file ); ++ yy_init_buffer(b,file ); + + return b; +- } +- ++} + +-#ifdef YY_USE_PROTOS +-void yy_delete_buffer( YY_BUFFER_STATE b ) +-#else +-void yy_delete_buffer( b ) +-YY_BUFFER_STATE b; +-#endif +- { ++/** Destroy the buffer. ++ * @param b a buffer created with yy_create_buffer() ++ * ++ */ ++ void yy_delete_buffer (YY_BUFFER_STATE b ) ++{ ++ + if ( ! b ) + return; + +- if ( b == yy_current_buffer ) +- yy_current_buffer = (YY_BUFFER_STATE) 0; ++ if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ ++ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) +- yy_flex_free( (void *) b->yy_ch_buf ); ++ yyfree((void *) b->yy_ch_buf ); + +- yy_flex_free( (void *) b ); +- } +- +- +- +-#ifdef YY_USE_PROTOS +-void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) +-#else +-void yy_init_buffer( b, file ) +-YY_BUFFER_STATE b; +-FILE *file; +-#endif ++ yyfree((void *) b ); ++} + ++#ifndef __cplusplus ++extern int isatty (int ); ++#endif /* __cplusplus */ ++ ++/* Initializes or reinitializes a buffer. ++ * This function is sometimes called more than once on the same buffer, ++ * such as during a yyrestart() or at EOF. ++ */ ++ static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) + +- { +- yy_flush_buffer( b ); ++{ ++ int oerrno = errno; ++ ++ yy_flush_buffer(b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + +-#if YY_ALWAYS_INTERACTIVE +- b->yy_is_interactive = 1; +-#else +-#if YY_NEVER_INTERACTIVE +- b->yy_is_interactive = 0; +-#else +- b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; +-#endif +-#endif +- } +- ++ /* If b is the current buffer, then yy_init_buffer was _probably_ ++ * called from yyrestart() or through yy_get_next_buffer. ++ * In that case, we don't want to reset the lineno or column. ++ */ ++ if (b != YY_CURRENT_BUFFER){ ++ b->yy_bs_lineno = 1; ++ b->yy_bs_column = 0; ++ } + +-#ifdef YY_USE_PROTOS +-void yy_flush_buffer( YY_BUFFER_STATE b ) +-#else +-void yy_flush_buffer( b ) +-YY_BUFFER_STATE b; +-#endif ++ b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; ++ ++ errno = oerrno; ++} + +- { +- if ( ! b ) ++/** Discard all buffered characters. On the next scan, YY_INPUT will be called. ++ * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. ++ * ++ */ ++ void yy_flush_buffer (YY_BUFFER_STATE b ) ++{ ++ if ( ! b ) + return; + + b->yy_n_chars = 0; +@@ -1386,29 +1446,121 @@ + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + +- if ( b == yy_current_buffer ) +- yy_load_buffer_state(); ++ if ( b == YY_CURRENT_BUFFER ) ++ yy_load_buffer_state( ); ++} ++ ++/** Pushes the new state onto the stack. The new state becomes ++ * the current state. This function will allocate the stack ++ * if necessary. ++ * @param new_buffer The new state. ++ * ++ */ ++void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) ++{ ++ if (new_buffer == NULL) ++ return; ++ ++ yyensure_buffer_stack(); ++ ++ /* This block is copied from yy_switch_to_buffer. */ ++ if ( YY_CURRENT_BUFFER ) ++ { ++ /* Flush out information for old buffer. */ ++ *(yy_c_buf_p) = (yy_hold_char); ++ YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); ++ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); ++ } ++ ++ /* Only push if top exists. Otherwise, replace top. */ ++ if (YY_CURRENT_BUFFER) ++ (yy_buffer_stack_top)++; ++ YY_CURRENT_BUFFER_LVALUE = new_buffer; ++ ++ /* copied from yy_switch_to_buffer. */ ++ yy_load_buffer_state( ); ++ (yy_did_buffer_switch_on_eof) = 1; ++} ++ ++/** Removes and deletes the top of the stack, if present. ++ * The next element becomes the new top. ++ * ++ */ ++void yypop_buffer_state (void) ++{ ++ if (!YY_CURRENT_BUFFER) ++ return; ++ ++ yy_delete_buffer(YY_CURRENT_BUFFER ); ++ YY_CURRENT_BUFFER_LVALUE = NULL; ++ if ((yy_buffer_stack_top) > 0) ++ --(yy_buffer_stack_top); ++ ++ if (YY_CURRENT_BUFFER) { ++ yy_load_buffer_state( ); ++ (yy_did_buffer_switch_on_eof) = 1; + } ++} + ++/* Allocates the stack if it does not exist. ++ * Guarantees space for at least one push. ++ */ ++static void yyensure_buffer_stack (void) ++{ ++ int num_to_alloc; ++ ++ if (!(yy_buffer_stack)) { ++ ++ /* First allocation is just for 2 elements, since we don't know if this ++ * scanner will even need a stack. We use 2 instead of 1 to avoid an ++ * immediate realloc on the next call. ++ */ ++ num_to_alloc = 1; ++ (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc ++ (num_to_alloc * sizeof(struct yy_buffer_state*) ++ ); ++ ++ memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); ++ ++ (yy_buffer_stack_max) = num_to_alloc; ++ (yy_buffer_stack_top) = 0; ++ return; ++ } + +-#ifndef YY_NO_SCAN_BUFFER +-#ifdef YY_USE_PROTOS +-YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) +-#else +-YY_BUFFER_STATE yy_scan_buffer( base, size ) +-char *base; +-yy_size_t size; +-#endif +- { +- YY_BUFFER_STATE b; ++ if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ ++ ++ /* Increase the buffer to prepare for a possible push. */ ++ int grow_size = 8 /* arbitrary grow size */; + ++ num_to_alloc = (yy_buffer_stack_max) + grow_size; ++ (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc ++ ((yy_buffer_stack), ++ num_to_alloc * sizeof(struct yy_buffer_state*) ++ ); ++ ++ /* zero only the new slots.*/ ++ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); ++ (yy_buffer_stack_max) = num_to_alloc; ++ } ++} ++ ++/** Setup the input buffer state to scan directly from a user-specified character buffer. ++ * @param base the character buffer ++ * @param size the size in bytes of the character buffer ++ * ++ * @return the newly allocated buffer state object. ++ */ ++YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) ++{ ++ YY_BUFFER_STATE b; ++ + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + +- b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); ++ b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + +@@ -1422,47 +1574,42 @@ + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + +- yy_switch_to_buffer( b ); ++ yy_switch_to_buffer(b ); + + return b; +- } +-#endif +- +- +-#ifndef YY_NO_SCAN_STRING +-#ifdef YY_USE_PROTOS +-YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) +-#else +-YY_BUFFER_STATE yy_scan_string( yy_str ) +-yyconst char *yy_str; +-#endif +- { +- int len; +- for ( len = 0; yy_str[len]; ++len ) +- ; +- +- return yy_scan_bytes( yy_str, len ); +- } +-#endif ++} + ++/** Setup the input buffer state to scan a string. The next call to yylex() will ++ * scan from a @e copy of @a str. ++ * @param str a NUL-terminated string to scan ++ * ++ * @return the newly allocated buffer state object. ++ * @note If you want to scan bytes that may contain NUL values, then use ++ * yy_scan_bytes() instead. ++ */ ++YY_BUFFER_STATE yy_scan_string (yyconst char * yy_str ) ++{ ++ ++ return yy_scan_bytes(yy_str,strlen(yy_str) ); ++} + +-#ifndef YY_NO_SCAN_BYTES +-#ifdef YY_USE_PROTOS +-YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) +-#else +-YY_BUFFER_STATE yy_scan_bytes( bytes, len ) +-yyconst char *bytes; +-int len; +-#endif +- { ++/** Setup the input buffer state to scan the given bytes. The next call to yylex() will ++ * scan from a @e copy of @a bytes. ++ * @param bytes the byte buffer to scan ++ * @param len the number of bytes in the buffer pointed to by @a bytes. ++ * ++ * @return the newly allocated buffer state object. ++ */ ++YY_BUFFER_STATE yy_scan_bytes (yyconst char * bytes, int len ) ++{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; +- ++ + /* Get memory for full buffer, including space for trailing EOB's. */ + n = len + 2; +- buf = (char *) yy_flex_alloc( n ); ++ buf = (char *) yyalloc(n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + +@@ -1471,7 +1618,7 @@ + + buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + +- b = yy_scan_buffer( buf, n ); ++ b = yy_scan_buffer(buf,n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + +@@ -1481,148 +1628,164 @@ + b->yy_is_our_buffer = 1; + + return b; +- } +-#endif +- ++} + +-#ifndef YY_NO_PUSH_STATE +-#ifdef YY_USE_PROTOS +-static void yy_push_state( int new_state ) +-#else +-static void yy_push_state( new_state ) +-int new_state; ++#ifndef YY_EXIT_FAILURE ++#define YY_EXIT_FAILURE 2 + #endif +- { +- if ( yy_start_stack_ptr >= yy_start_stack_depth ) +- { +- yy_size_t new_size; + +- yy_start_stack_depth += YY_START_STACK_INCR; +- new_size = yy_start_stack_depth * sizeof( int ); ++static void yy_fatal_error (yyconst char* msg ) ++{ ++ (void) fprintf( stderr, "%s\n", msg ); ++ exit( YY_EXIT_FAILURE ); ++} + +- if ( ! yy_start_stack ) +- yy_start_stack = (int *) yy_flex_alloc( new_size ); ++/* Redefine yyless() so it works in section 3 code. */ + +- else +- yy_start_stack = (int *) yy_flex_realloc( +- (void *) yy_start_stack, new_size ); ++#undef yyless ++#define yyless(n) \ ++ do \ ++ { \ ++ /* Undo effects of setting up yytext. */ \ ++ int yyless_macro_arg = (n); \ ++ YY_LESS_LINENO(yyless_macro_arg);\ ++ yytext[yyleng] = (yy_hold_char); \ ++ (yy_c_buf_p) = yytext + yyless_macro_arg; \ ++ (yy_hold_char) = *(yy_c_buf_p); \ ++ *(yy_c_buf_p) = '\0'; \ ++ yyleng = yyless_macro_arg; \ ++ } \ ++ while ( 0 ) + +- if ( ! yy_start_stack ) +- YY_FATAL_ERROR( +- "out of memory expanding start-condition stack" ); +- } ++/* Accessor methods (get/set functions) to struct members. */ + +- yy_start_stack[yy_start_stack_ptr++] = YY_START; ++/** Get the current line number. ++ * ++ */ ++int yyget_lineno (void) ++{ ++ ++ return yylineno; ++} + +- BEGIN(new_state); +- } +-#endif ++/** Get the input stream. ++ * ++ */ ++FILE *yyget_in (void) ++{ ++ return yyin; ++} + ++/** Get the output stream. ++ * ++ */ ++FILE *yyget_out (void) ++{ ++ return yyout; ++} + +-#ifndef YY_NO_POP_STATE +-static void yy_pop_state() +- { +- if ( --yy_start_stack_ptr < 0 ) +- YY_FATAL_ERROR( "start-condition stack underflow" ); ++/** Get the length of the current token. ++ * ++ */ ++int yyget_leng (void) ++{ ++ return yyleng; ++} + +- BEGIN(yy_start_stack[yy_start_stack_ptr]); +- } +-#endif ++/** Get the current token. ++ * ++ */ + ++char *yyget_text (void) ++{ ++ return yytext; ++} + +-#ifndef YY_NO_TOP_STATE +-static int yy_top_state() +- { +- return yy_start_stack[yy_start_stack_ptr - 1]; +- } +-#endif ++/** Set the current line number. ++ * @param line_number ++ * ++ */ ++void yyset_lineno (int line_number ) ++{ ++ ++ yylineno = line_number; ++} + +-#ifndef YY_EXIT_FAILURE +-#define YY_EXIT_FAILURE 2 +-#endif ++/** Set the input stream. This does not discard the current ++ * input buffer. ++ * @param in_str A readable stream. ++ * ++ * @see yy_switch_to_buffer ++ */ ++void yyset_in (FILE * in_str ) ++{ ++ yyin = in_str ; ++} + +-#ifdef YY_USE_PROTOS +-static void yy_fatal_error( yyconst char msg[] ) +-#else +-static void yy_fatal_error( msg ) +-char msg[]; +-#endif +- { +- (void) fprintf( stderr, "%s\n", msg ); +- exit( YY_EXIT_FAILURE ); +- } ++void yyset_out (FILE * out_str ) ++{ ++ yyout = out_str ; ++} + ++int yyget_debug (void) ++{ ++ return yy_flex_debug; ++} + ++void yyset_debug (int bdebug ) ++{ ++ yy_flex_debug = bdebug ; ++} + +-/* Redefine yyless() so it works in section 3 code. */ ++/* yylex_destroy is for both reentrant and non-reentrant scanners. */ ++int yylex_destroy (void) ++{ ++ ++ /* Pop the buffer stack, destroying each element. */ ++ while(YY_CURRENT_BUFFER){ ++ yy_delete_buffer(YY_CURRENT_BUFFER ); ++ YY_CURRENT_BUFFER_LVALUE = NULL; ++ yypop_buffer_state(); ++ } + +-#undef yyless +-#define yyless(n) \ +- do \ +- { \ +- /* Undo effects of setting up yytext. */ \ +- yytext[yyleng] = yy_hold_char; \ +- yy_c_buf_p = yytext + n; \ +- yy_hold_char = *yy_c_buf_p; \ +- *yy_c_buf_p = '\0'; \ +- yyleng = n; \ +- } \ +- while ( 0 ) ++ /* Destroy the stack itself. */ ++ yyfree((yy_buffer_stack) ); ++ (yy_buffer_stack) = NULL; + ++ return 0; ++} + +-/* Internal utility routines. */ ++/* ++ * Internal utility routines. ++ */ + + #ifndef yytext_ptr +-#ifdef YY_USE_PROTOS +-static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) +-#else +-static void yy_flex_strncpy( s1, s2, n ) +-char *s1; +-yyconst char *s2; +-int n; +-#endif +- { ++static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) ++{ + register int i; +- for ( i = 0; i < n; ++i ) ++ for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +- } ++} + #endif + + #ifdef YY_NEED_STRLEN +-#ifdef YY_USE_PROTOS +-static int yy_flex_strlen( yyconst char *s ) +-#else +-static int yy_flex_strlen( s ) +-yyconst char *s; +-#endif +- { ++static int yy_flex_strlen (yyconst char * s ) ++{ + register int n; +- for ( n = 0; s[n]; ++n ) ++ for ( n = 0; s[n]; ++n ) + ; + + return n; +- } ++} + #endif + +- +-#ifdef YY_USE_PROTOS +-static void *yy_flex_alloc( yy_size_t size ) +-#else +-static void *yy_flex_alloc( size ) +-yy_size_t size; +-#endif +- { ++void *yyalloc (yy_size_t size ) ++{ + return (void *) malloc( size ); +- } ++} + +-#ifdef YY_USE_PROTOS +-static void *yy_flex_realloc( void *ptr, yy_size_t size ) +-#else +-static void *yy_flex_realloc( ptr, size ) +-void *ptr; +-yy_size_t size; +-#endif +- { ++void *yyrealloc (void * ptr, yy_size_t size ) ++{ + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter +@@ -1631,30 +1794,34 @@ + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); +- } ++} + +-#ifdef YY_USE_PROTOS +-static void yy_flex_free( void *ptr ) +-#else +-static void yy_flex_free( ptr ) +-void *ptr; +-#endif +- { +- free( ptr ); +- } ++void yyfree (void * ptr ) ++{ ++ free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ ++} + +-#if YY_MAIN +-int main() +- { +- yylex(); +- return 0; +- } ++#define YYTABLES_NAME "yytables" ++ ++#undef YY_NEW_FILE ++#undef YY_FLUSH_BUFFER ++#undef yy_set_bol ++#undef yy_new_buffer ++#undef yy_set_interactive ++#undef yytext_ptr ++#undef YY_DO_BEFORE_ACTION ++ ++#ifdef YY_DECL_IS_OURS ++#undef YY_DECL_IS_OURS ++#undef YY_DECL + #endif + #line 69 "ql_l.l" + + +-void yyerror(char *s) ++ ++void yyerror(const char *s) + { + fprintf(stderr,"line %d: %s near \"%s\"\n",lineno,s,yytext); + exit(1); + } ++ +--- linux-atm-2.4.1.orig/src/qgen/ql_y.c ++++ linux-atm-2.4.1/src/qgen/ql_y.c +@@ -1,21 +1,87 @@ ++/* A Bison parser, made by GNU Bison 1.875d. */ + +-/* A Bison parser, made from ql_y.y +- by GNU Bison version 1.28 */ ++/* Skeleton parser for Yacc-like parsing with Bison, ++ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + +-#define YYBISON 1 /* Identify Bison output. */ ++ 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 ++ the Free Software Foundation; either version 2, or (at your option) ++ any later version. + +-#define TOK_BREAK 257 +-#define TOK_CASE 258 +-#define TOK_DEF 259 +-#define TOK_DEFAULT 260 +-#define TOK_LENGTH 261 +-#define TOK_MULTI 262 +-#define TOK_RECOVER 263 +-#define TOK_ABORT 264 +-#define TOK_ID 265 +-#define TOK_INCLUDE 266 +-#define TOK_STRING 267 ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. + ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software ++ Foundation, Inc., 59 Temple Place - Suite 330, ++ Boston, MA 02111-1307, USA. */ ++ ++/* As a special exception, when this file is copied by Bison into a ++ Bison output file, you may use that output file without restriction. ++ This special exception was added by the Free Software Foundation ++ in version 1.24 of Bison. */ ++ ++/* Written by Richard Stallman by simplifying the original so called ++ ``semantic'' parser. */ ++ ++/* All symbols defined below should begin with yy or YY, to avoid ++ infringing on user name space. This should be done even for local ++ variables, as they might otherwise be expanded by user macros. ++ There are some unavoidable exceptions within include files to ++ define necessary library symbols; they are noted "INFRINGES ON ++ USER NAME SPACE" below. */ ++ ++/* Identify Bison output. */ ++#define YYBISON 1 ++ ++/* Skeleton name. */ ++#define YYSKELETON_NAME "yacc.c" ++ ++/* Pure parsers. */ ++#define YYPURE 0 ++ ++/* Using locations. */ ++#define YYLSP_NEEDED 0 ++ ++ ++ ++/* Tokens. */ ++#ifndef YYTOKENTYPE ++# define YYTOKENTYPE ++ /* Put the tokens into the symbol table, so that GDB and other debuggers ++ know about them. */ ++ enum yytokentype { ++ TOK_BREAK = 258, ++ TOK_CASE = 259, ++ TOK_DEF = 260, ++ TOK_DEFAULT = 261, ++ TOK_LENGTH = 262, ++ TOK_MULTI = 263, ++ TOK_RECOVER = 264, ++ TOK_ABORT = 265, ++ TOK_ID = 266, ++ TOK_INCLUDE = 267, ++ TOK_STRING = 268 ++ }; ++#endif ++#define TOK_BREAK 258 ++#define TOK_CASE 259 ++#define TOK_DEF 260 ++#define TOK_DEFAULT 261 ++#define TOK_LENGTH 262 ++#define TOK_MULTI 263 ++#define TOK_RECOVER 264 ++#define TOK_ABORT 265 ++#define TOK_ID 266 ++#define TOK_INCLUDE 267 ++#define TOK_STRING 268 ++ ++ ++ ++ ++/* Copy the first part of user declarations. */ + #line 1 "ql_y.y" + + /* ql.y - Q.2931 data structures description language */ +@@ -36,6 +102,8 @@ + #include "qgen.h" + #include "file.h" + ++extern void yyerror(const char *s); ++ + + #define MAX_TOKEN 256 + #define DEFAULT_NAMELIST_FILE "default.nl" +@@ -77,9 +145,10 @@ + for (walk = strchr(start,0)-1; walk > start && isspace(*walk); walk--) + *walk = 0; + if (*start == ':') { +- if (!(searching = strcmp(start+1,name))) ++ if (!(searching = strcmp(start+1,name))) { + if (found) yyerror("multiple entries"); + else found = 1; ++ } + continue; + } + if (searching) continue; +@@ -154,8 +223,23 @@ + + + +-#line 139 "ql_y.y" +-typedef union { ++ ++/* Enabling traces. */ ++#ifndef YYDEBUG ++# define YYDEBUG 0 ++#endif ++ ++/* Enabling verbose error messages. */ ++#ifdef YYERROR_VERBOSE ++# undef YYERROR_VERBOSE ++# define YYERROR_VERBOSE 1 ++#else ++# define YYERROR_VERBOSE 0 ++#endif ++ ++#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) ++#line 142 "ql_y.y" ++typedef union YYSTYPE { + const char *str; + int num; + FIELD *field; +@@ -164,470 +248,762 @@ + TAG *tag; + NAME_LIST *nlist; + } YYSTYPE; +-#include <stdio.h> ++/* Line 191 of yacc.c. */ ++#line 253 "y.tab.c" ++# define yystype YYSTYPE /* obsolescent; will be withdrawn */ ++# define YYSTYPE_IS_DECLARED 1 ++# define YYSTYPE_IS_TRIVIAL 1 ++#endif ++ ++ ++ ++/* Copy the second part of user declarations. */ ++ ++ ++/* Line 214 of yacc.c. */ ++#line 265 "y.tab.c" ++ ++#if ! defined (yyoverflow) || YYERROR_VERBOSE ++ ++# ifndef YYFREE ++# define YYFREE free ++# endif ++# ifndef YYMALLOC ++# define YYMALLOC malloc ++# endif ++ ++/* The parser invokes alloca or malloc; define the necessary symbols. */ ++ ++# ifdef YYSTACK_USE_ALLOCA ++# if YYSTACK_USE_ALLOCA ++# define YYSTACK_ALLOC alloca ++# endif ++# else ++# if defined (alloca) || defined (_ALLOCA_H) ++# define YYSTACK_ALLOC alloca ++# else ++# ifdef __GNUC__ ++# define YYSTACK_ALLOC __builtin_alloca ++# endif ++# endif ++# endif ++ ++# ifdef YYSTACK_ALLOC ++ /* Pacify GCC's `empty if-body' warning. */ ++# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) ++# else ++# if defined (__STDC__) || defined (__cplusplus) ++# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ ++# define YYSIZE_T size_t ++# endif ++# define YYSTACK_ALLOC YYMALLOC ++# define YYSTACK_FREE YYFREE ++# endif ++#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ ++ ++ ++#if (! defined (yyoverflow) \ ++ && (! defined (__cplusplus) \ ++ || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) ++ ++/* A type that is properly aligned for any stack member. */ ++union yyalloc ++{ ++ short int yyss; ++ YYSTYPE yyvs; ++ }; ++ ++/* The size of the maximum gap between one aligned stack and the next. */ ++# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) ++ ++/* The size of an array large to enough to hold all stacks, each with ++ N elements. */ ++# define YYSTACK_BYTES(N) \ ++ ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ ++ + YYSTACK_GAP_MAXIMUM) ++ ++/* Copy COUNT objects from FROM to TO. The source and destination do ++ not overlap. */ ++# ifndef YYCOPY ++# if defined (__GNUC__) && 1 < __GNUC__ ++# define YYCOPY(To, From, Count) \ ++ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) ++# else ++# define YYCOPY(To, From, Count) \ ++ do \ ++ { \ ++ register YYSIZE_T yyi; \ ++ for (yyi = 0; yyi < (Count); yyi++) \ ++ (To)[yyi] = (From)[yyi]; \ ++ } \ ++ while (0) ++# endif ++# endif ++ ++/* Relocate STACK from its old location to the new one. The ++ local variables YYSIZE and YYSTACKSIZE give the old and new number of ++ elements in the stack, and YYPTR gives the new location of the ++ stack. Advance YYPTR to a properly aligned location for the next ++ stack. */ ++# define YYSTACK_RELOCATE(Stack) \ ++ do \ ++ { \ ++ YYSIZE_T yynewbytes; \ ++ YYCOPY (&yyptr->Stack, Stack, yysize); \ ++ Stack = &yyptr->Stack; \ ++ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ ++ yyptr += yynewbytes / sizeof (*yyptr); \ ++ } \ ++ while (0) + +-#ifndef __cplusplus +-#ifndef __STDC__ +-#define const +-#endif + #endif + ++#if defined (__STDC__) || defined (__cplusplus) ++ typedef signed char yysigned_char; ++#else ++ typedef short int yysigned_char; ++#endif + +- +-#define YYFINAL 86 +-#define YYFLAG -32768 +-#define YYNTBASE 23 +- +-#define YYTRANSLATE(x) ((unsigned)(x) <= 267 ? yytranslate[x] : 47) +- +-static const char yytranslate[] = { 0, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 21, 18, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 22, 2, 17, +- 14, 19, 2, 20, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 15, 2, 16, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, +- 7, 8, 9, 10, 11, 12, 13 ++/* YYFINAL -- State number of the termination state. */ ++#define YYFINAL 5 ++/* YYLAST -- Last index in YYTABLE. */ ++#define YYLAST 65 ++ ++/* YYNTOKENS -- Number of terminals. */ ++#define YYNTOKENS 23 ++/* YYNNTS -- Number of nonterminals. */ ++#define YYNNTS 25 ++/* YYNRULES -- Number of rules. */ ++#define YYNRULES 46 ++/* YYNRULES -- Number of states. */ ++#define YYNSTATES 86 ++ ++/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ ++#define YYUNDEFTOK 2 ++#define YYMAXUTOK 268 ++ ++#define YYTRANSLATE(YYX) \ ++ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) ++ ++/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ ++static const unsigned char yytranslate[] = ++{ ++ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 21, 18, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 22, 2, ++ 17, 14, 19, 2, 20, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 15, 2, 16, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, ++ 5, 6, 7, 8, 9, 10, 11, 12, 13 + }; + +-#if YYDEBUG != 0 +-static const short yyprhs[] = { 0, +- 0, 4, 5, 8, 9, 12, 17, 18, 21, 23, +- 27, 30, 31, 34, 40, 41, 43, 47, 53, 54, +- 57, 59, 60, 63, 64, 67, 69, 74, 79, 83, +- 84, 87, 88, 90, 91, 97, 98, 105, 106, 112, +- 113, 120, 121, 124, 125 ++#if YYDEBUG ++/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in ++ YYRHS. */ ++static const unsigned char yyprhs[] = ++{ ++ 0, 0, 3, 7, 8, 11, 12, 15, 20, 21, ++ 24, 26, 30, 33, 34, 37, 43, 44, 46, 50, ++ 56, 57, 60, 62, 63, 66, 67, 70, 72, 77, ++ 82, 86, 87, 90, 91, 93, 94, 100, 101, 108, ++ 109, 115, 116, 123, 124, 127, 128 + }; + +-static const short yyrhs[] = { 24, +- 25, 29, 0, 0, 12, 24, 0, 0, 25, 26, +- 0, 5, 11, 14, 29, 0, 0, 28, 29, 0, +- 11, 0, 15, 30, 16, 0, 10, 11, 0, 0, +- 31, 30, 0, 32, 11, 40, 17, 33, 0, 0, +- 3, 0, 18, 35, 19, 0, 35, 34, 36, 19, +- 37, 0, 0, 20, 35, 0, 11, 0, 0, 21, +- 11, 0, 0, 14, 38, 0, 11, 0, 4, 15, +- 41, 16, 0, 8, 15, 43, 16, 0, 39, 7, +- 29, 0, 0, 9, 11, 0, 0, 13, 0, 0, +- 6, 11, 45, 46, 29, 0, 0, 11, 45, 46, +- 29, 42, 41, 0, 0, 6, 11, 45, 46, 27, +- 0, 0, 11, 45, 46, 27, 44, 43, 0, 0, +- 22, 11, 0, 0, 21, 11, 46, 0 ++/* YYRHS -- A `-1'-separated list of the rules' RHS. */ ++static const yysigned_char yyrhs[] = ++{ ++ 24, 0, -1, 25, 26, 30, -1, -1, 12, 25, ++ -1, -1, 26, 27, -1, 5, 11, 14, 30, -1, ++ -1, 29, 30, -1, 11, -1, 15, 31, 16, -1, ++ 10, 11, -1, -1, 32, 31, -1, 33, 11, 41, ++ 17, 34, -1, -1, 3, -1, 18, 36, 19, -1, ++ 36, 35, 37, 19, 38, -1, -1, 20, 36, -1, ++ 11, -1, -1, 21, 11, -1, -1, 14, 39, -1, ++ 11, -1, 4, 15, 42, 16, -1, 8, 15, 44, ++ 16, -1, 40, 7, 30, -1, -1, 9, 11, -1, ++ -1, 13, -1, -1, 6, 11, 46, 47, 30, -1, ++ -1, 11, 46, 47, 30, 43, 42, -1, -1, 6, ++ 11, 46, 47, 28, -1, -1, 11, 46, 47, 28, ++ 45, 44, -1, -1, 22, 11, -1, -1, 21, 11, ++ 47, -1 + }; + +-#endif +- +-#if YYDEBUG != 0 +-static const short yyrline[] = { 0, +- 163, 175, 176, 184, 185, 188, 202, 207, 212, 231, +- 236, 243, 247, 254, 278, 282, 288, 301, 318, 322, +- 329, 339, 343, 350, 354, 360, 367, 374, 380, 390, +- 394, 400, 404, 410, 414, 431, 437, 454, 458, 474, +- 480, 497, 501, 507, 511 ++/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ ++static const unsigned short int yyrline[] = ++{ ++ 0, 167, 167, 178, 179, 187, 188, 192, 206, 206, ++ 216, 234, 239, 247, 250, 258, 282, 285, 292, 304, ++ 323, 326, 334, 344, 347, 355, 358, 365, 371, 378, ++ 384, 395, 398, 405, 408, 415, 418, 436, 435, 459, ++ 462, 479, 478, 502, 505, 512, 515 + }; + #endif + +- +-#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) +- +-static const char * const yytname[] = { "$","error","$undefined.","TOK_BREAK", +-"TOK_CASE","TOK_DEF","TOK_DEFAULT","TOK_LENGTH","TOK_MULTI","TOK_RECOVER","TOK_ABORT", +-"TOK_ID","TOK_INCLUDE","TOK_STRING","'='","'{'","'}'","'<'","'-'","'>'","'@'", +-"','","':'","all","includes","structures","structure","rep_block","@1","block", +-"fields","field","opt_break","field_cont","opt_pos","decimal","opt_more","opt_val", +-"value","opt_recover","opt_name_list","tags","@2","rep_tags","@3","opt_id","list", NULL ++#if YYDEBUG || YYERROR_VERBOSE ++/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. ++ First, the terminals, then, starting at YYNTOKENS, nonterminals. */ ++static const char *const yytname[] = ++{ ++ "$end", "error", "$undefined", "TOK_BREAK", "TOK_CASE", "TOK_DEF", ++ "TOK_DEFAULT", "TOK_LENGTH", "TOK_MULTI", "TOK_RECOVER", "TOK_ABORT", ++ "TOK_ID", "TOK_INCLUDE", "TOK_STRING", "'='", "'{'", "'}'", "'<'", "'-'", ++ "'>'", "'@'", "','", "':'", "$accept", "all", "includes", "structures", ++ "structure", "rep_block", "@1", "block", "fields", "field", "opt_break", ++ "field_cont", "opt_pos", "decimal", "opt_more", "opt_val", "value", ++ "opt_recover", "opt_name_list", "tags", "@2", "rep_tags", "@3", "opt_id", ++ "list", 0 + }; + #endif + +-static const short yyr1[] = { 0, +- 23, 24, 24, 25, 25, 26, 28, 27, 29, 29, +- 29, 30, 30, 31, 32, 32, 33, 33, 34, 34, +- 35, 36, 36, 37, 37, 38, 38, 38, 38, 39, +- 39, 40, 40, 41, 41, 42, 41, 43, 43, 44, +- 43, 45, 45, 46, 46 ++# ifdef YYPRINT ++/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to ++ token YYLEX-NUM. */ ++static const unsigned short int yytoknum[] = ++{ ++ 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, ++ 265, 266, 267, 268, 61, 123, 125, 60, 45, 62, ++ 64, 44, 58 + }; ++# endif + +-static const short yyr2[] = { 0, +- 3, 0, 2, 0, 2, 4, 0, 2, 1, 3, +- 2, 0, 2, 5, 0, 1, 3, 5, 0, 2, +- 1, 0, 2, 0, 2, 1, 4, 4, 3, 0, +- 2, 0, 1, 0, 5, 0, 6, 0, 5, 0, +- 6, 0, 2, 0, 3 ++/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ ++static const unsigned char yyr1[] = ++{ ++ 0, 23, 24, 25, 25, 26, 26, 27, 29, 28, ++ 30, 30, 30, 31, 31, 32, 33, 33, 34, 34, ++ 35, 35, 36, 37, 37, 38, 38, 39, 39, 39, ++ 39, 40, 40, 41, 41, 42, 42, 43, 42, 44, ++ 44, 45, 44, 46, 46, 47, 47 + }; + +-static const short yydefact[] = { 2, +- 2, 4, 3, 0, 0, 0, 9, 12, 5, 1, +- 0, 11, 16, 0, 12, 0, 0, 10, 13, 32, +- 6, 33, 0, 0, 21, 0, 14, 19, 0, 0, +- 22, 17, 20, 0, 0, 23, 24, 30, 18, 0, +- 0, 0, 26, 25, 0, 34, 38, 31, 0, 0, +- 42, 0, 0, 42, 0, 29, 42, 0, 44, 27, +- 42, 44, 28, 44, 43, 0, 0, 44, 7, 0, +- 44, 36, 7, 40, 0, 35, 45, 34, 39, 38, +- 8, 37, 41, 0, 0, 0 ++/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ ++static const unsigned char yyr2[] = ++{ ++ 0, 2, 3, 0, 2, 0, 2, 4, 0, 2, ++ 1, 3, 2, 0, 2, 5, 0, 1, 3, 5, ++ 0, 2, 1, 0, 2, 0, 2, 1, 4, 4, ++ 3, 0, 2, 0, 1, 0, 5, 0, 6, 0, ++ 5, 0, 6, 0, 2, 0, 3 + }; + +-static const short yydefgoto[] = { 84, +- 2, 4, 9, 74, 75, 10, 14, 15, 16, 27, +- 31, 28, 35, 39, 44, 45, 23, 52, 78, 55, +- 80, 59, 67 ++/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state ++ STATE-NUM when YYTABLE doesn't specify something else to do. Zero ++ means the default is an error. */ ++static const unsigned char yydefact[] = ++{ ++ 3, 3, 0, 5, 4, 1, 0, 0, 0, 10, ++ 13, 6, 2, 0, 12, 17, 0, 13, 0, 0, ++ 11, 14, 33, 7, 34, 0, 0, 22, 0, 15, ++ 20, 0, 0, 23, 18, 21, 0, 0, 24, 25, ++ 31, 19, 0, 0, 0, 27, 26, 0, 35, 39, ++ 32, 0, 0, 43, 0, 0, 43, 0, 30, 43, ++ 0, 45, 28, 43, 45, 29, 45, 44, 0, 0, ++ 45, 8, 0, 45, 37, 8, 41, 0, 36, 46, ++ 35, 40, 39, 9, 38, 42 + }; + +-static const short yypact[] = { -8, +- -8,-32768,-32768, -4, 3, 17,-32768, -1,-32768,-32768, +- 20,-32768,-32768, 21, -1, 22, 11,-32768,-32768, 23, +--32768,-32768, 24, -3,-32768, 27,-32768, 15, 25, 27, +- 26,-32768,-32768, 28, 29,-32768, 31, 9,-32768, 34, +- 36, 32,-32768,-32768, 33, 18, 19,-32768, 11, 35, +- 30, 38, 44, 30, 40,-32768, 30, 46, 39,-32768, +- 30, 39,-32768, 39,-32768, 48, 11, 39,-32768, 11, +- 39,-32768,-32768,-32768, 11,-32768,-32768, 18,-32768, 19, +--32768,-32768,-32768, 42, 61,-32768 ++/* YYDEFGOTO[NTERM-NUM]. */ ++static const yysigned_char yydefgoto[] = ++{ ++ -1, 2, 3, 6, 11, 76, 77, 12, 16, 17, ++ 18, 29, 33, 30, 37, 41, 46, 47, 25, 54, ++ 80, 57, 82, 61, 69 + }; + +-static const short yypgoto[] = {-32768, +- 62,-32768,-32768, -11,-32768, -17, 49,-32768,-32768,-32768, +--32768, 1,-32768,-32768,-32768,-32768,-32768, -13,-32768, -14, +--32768, -38, -59 ++/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing ++ STATE-NUM. */ ++#define YYPACT_NINF -62 ++static const yysigned_char yypact[] = ++{ ++ -8, -8, 14, -62, -62, -62, -4, 16, 17, -62, ++ -1, -62, -62, 20, -62, -62, 21, -1, 22, 11, ++ -62, -62, 23, -62, -62, 24, -3, -62, 27, -62, ++ 25, 28, 27, 30, -62, -62, 29, 33, -62, 32, ++ 9, -62, 34, 39, 31, -62, -62, 36, 18, 19, ++ -62, 11, 37, 35, 40, 44, 35, 43, -62, 35, ++ 49, 41, -62, 35, 41, -62, 41, -62, 50, 11, ++ 41, -62, 11, 41, -62, -62, -62, 11, -62, -62, ++ 18, -62, 19, -62, -62, -62 + }; + +- +-#define YYLAST 66 +- +- +-static const short yytable[] = { 21, +- 5, 13, 69, 1, 70, 6, 7, 25, 73, -15, +- 8, 77, 40, 11, 26, 62, 41, 42, 64, 43, +- 6, 7, 68, 50, 53, 8, 29, 12, 51, 54, +- 33, 56, 20, 17, 30, 22, 18, 25, 36, 49, +- 24, 85, 48, 32, 38, 57, 34, 37, 46, 72, +- 47, 58, 76, 60, 61, 63, 65, 81, 71, 66, +- 86, 79, 3, 19, 82, 83 ++/* YYPGOTO[NTERM-NUM]. */ ++static const yysigned_char yypgoto[] = ++{ ++ -62, -62, 38, -62, -62, -31, -62, -19, 46, -62, ++ -62, -62, -62, 3, -62, -62, -62, -62, -62, -16, ++ -62, -17, -62, -40, -61 + }; + +-static const short yycheck[] = { 17, +- 5, 3, 62, 12, 64, 10, 11, 11, 68, 11, +- 15, 71, 4, 11, 18, 54, 8, 9, 57, 11, +- 10, 11, 61, 6, 6, 15, 26, 11, 11, 11, +- 30, 49, 11, 14, 20, 13, 16, 11, 11, 7, +- 17, 0, 11, 19, 14, 11, 21, 19, 15, 67, +- 15, 22, 70, 16, 11, 16, 11, 75, 11, 21, +- 0, 73, 1, 15, 78, 80 ++/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If ++ positive, shift that token. If negative, reduce the rule which ++ number is the opposite. If zero, do what YYDEFACT says. ++ If YYTABLE_NINF, syntax error. */ ++#define YYTABLE_NINF -17 ++static const yysigned_char yytable[] = ++{ ++ 23, 7, 15, 71, 1, 72, 8, 9, 27, 75, ++ -16, 10, 79, 42, 5, 28, 64, 43, 44, 66, ++ 45, 8, 9, 70, 52, 55, 10, 13, 14, 53, ++ 56, 31, 58, 22, 19, 35, 24, 20, 27, 4, ++ 38, 26, 50, 51, 81, 32, 40, 34, 59, 48, ++ 74, 36, 39, 78, 49, 63, 62, 60, 83, 65, ++ 67, 73, 68, 21, 84, 85 + }; +-/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ +-#line 3 "/usr/lib/bison.simple" +-/* This file comes from bison-1.28. */ + +-/* Skeleton output parser for bison, +- Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. +- +- 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 +- the Free Software Foundation; either version 2, or (at your option) +- any later version. +- +- This program is distributed in the hope that it will be useful, +- but WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- GNU General Public License for more details. +- +- You should have received a copy of the GNU General Public License +- along with this program; if not, write to the Free Software +- Foundation, Inc., 59 Temple Place - Suite 330, +- Boston, MA 02111-1307, USA. */ +- +-/* As a special exception, when this file is copied by Bison into a +- Bison output file, you may use that output file without restriction. +- This special exception was added by the Free Software Foundation +- in version 1.24 of Bison. */ ++static const unsigned char yycheck[] = ++{ ++ 19, 5, 3, 64, 12, 66, 10, 11, 11, 70, ++ 11, 15, 73, 4, 0, 18, 56, 8, 9, 59, ++ 11, 10, 11, 63, 6, 6, 15, 11, 11, 11, ++ 11, 28, 51, 11, 14, 32, 13, 16, 11, 1, ++ 11, 17, 11, 7, 75, 20, 14, 19, 11, 15, ++ 69, 21, 19, 72, 15, 11, 16, 22, 77, 16, ++ 11, 11, 21, 17, 80, 82 ++}; + +-/* This is the parser code that is written into each bison parser +- when the %semantic_parser declaration is not specified in the grammar. +- It was written by Richard Stallman by simplifying the hairy parser +- used when %semantic_parser is specified. */ +- +-#ifndef YYSTACK_USE_ALLOCA +-#ifdef alloca +-#define YYSTACK_USE_ALLOCA +-#else /* alloca not defined */ +-#ifdef __GNUC__ +-#define YYSTACK_USE_ALLOCA +-#define alloca __builtin_alloca +-#else /* not GNU C. */ +-#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) +-#define YYSTACK_USE_ALLOCA +-#include <alloca.h> +-#else /* not sparc */ +-/* We think this test detects Watcom and Microsoft C. */ +-/* This used to test MSDOS, but that is a bad idea +- since that symbol is in the user namespace. */ +-#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) +-#if 0 /* No need for malloc.h, which pollutes the namespace; +- instead, just don't use alloca. */ +-#include <malloc.h> +-#endif +-#else /* not MSDOS, or __TURBOC__ */ +-#if defined(_AIX) +-/* I don't know what this was needed for, but it pollutes the namespace. +- So I turned it off. rms, 2 May 1997. */ +-/* #include <malloc.h> */ +- #pragma alloca +-#define YYSTACK_USE_ALLOCA +-#else /* not MSDOS, or __TURBOC__, or _AIX */ +-#if 0 +-#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, +- and on HPUX 10. Eventually we can turn this on. */ +-#define YYSTACK_USE_ALLOCA +-#define alloca __builtin_alloca +-#endif /* __hpux */ +-#endif +-#endif /* not _AIX */ +-#endif /* not MSDOS, or __TURBOC__ */ +-#endif /* not sparc */ +-#endif /* not GNU C */ +-#endif /* alloca not defined */ +-#endif /* YYSTACK_USE_ALLOCA not defined */ ++/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing ++ symbol of state STATE-NUM. */ ++static const unsigned char yystos[] = ++{ ++ 0, 12, 24, 25, 25, 0, 26, 5, 10, 11, ++ 15, 27, 30, 11, 11, 3, 31, 32, 33, 14, ++ 16, 31, 11, 30, 13, 41, 17, 11, 18, 34, ++ 36, 36, 20, 35, 19, 36, 21, 37, 11, 19, ++ 14, 38, 4, 8, 9, 11, 39, 40, 15, 15, ++ 11, 7, 6, 11, 42, 6, 11, 44, 30, 11, ++ 22, 46, 16, 11, 46, 16, 46, 11, 21, 47, ++ 46, 47, 47, 11, 30, 47, 28, 29, 30, 47, ++ 43, 28, 45, 30, 42, 44 ++}; + +-#ifdef YYSTACK_USE_ALLOCA +-#define YYSTACK_ALLOC alloca +-#else +-#define YYSTACK_ALLOC malloc ++#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) ++# define YYSIZE_T __SIZE_TYPE__ ++#endif ++#if ! defined (YYSIZE_T) && defined (size_t) ++# define YYSIZE_T size_t ++#endif ++#if ! defined (YYSIZE_T) ++# if defined (__STDC__) || defined (__cplusplus) ++# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ ++# define YYSIZE_T size_t ++# endif ++#endif ++#if ! defined (YYSIZE_T) ++# define YYSIZE_T unsigned int + #endif +- +-/* Note: there must be only one dollar sign in this file. +- It is replaced by the list of actions, each action +- as one case of the switch. */ + + #define yyerrok (yyerrstatus = 0) + #define yyclearin (yychar = YYEMPTY) +-#define YYEMPTY -2 ++#define YYEMPTY (-2) + #define YYEOF 0 ++ + #define YYACCEPT goto yyacceptlab +-#define YYABORT goto yyabortlab +-#define YYERROR goto yyerrlab1 +-/* Like YYERROR except do call yyerror. +- This remains here temporarily to ease the +- transition to the new meaning of YYERROR, for GCC. ++#define YYABORT goto yyabortlab ++#define YYERROR goto yyerrorlab ++ ++ ++/* Like YYERROR except do call yyerror. This remains here temporarily ++ to ease the transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. */ ++ + #define YYFAIL goto yyerrlab ++ + #define YYRECOVERING() (!!yyerrstatus) +-#define YYBACKUP(token, value) \ ++ ++#define YYBACKUP(Token, Value) \ + do \ + if (yychar == YYEMPTY && yylen == 1) \ +- { yychar = (token), yylval = (value); \ +- yychar1 = YYTRANSLATE (yychar); \ ++ { \ ++ yychar = (Token); \ ++ yylval = (Value); \ ++ yytoken = YYTRANSLATE (yychar); \ + YYPOPSTACK; \ + goto yybackup; \ + } \ + else \ +- { yyerror ("syntax error: cannot back up"); YYERROR; } \ ++ { \ ++ yyerror ("syntax error: cannot back up");\ ++ YYERROR; \ ++ } \ + while (0) + + #define YYTERROR 1 + #define YYERRCODE 256 + +-#ifndef YYPURE +-#define YYLEX yylex() +-#endif ++/* YYLLOC_DEFAULT -- Compute the default location (before the actions ++ are run). */ + +-#ifdef YYPURE +-#ifdef YYLSP_NEEDED +-#ifdef YYLEX_PARAM +-#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) +-#else +-#define YYLEX yylex(&yylval, &yylloc) ++#ifndef YYLLOC_DEFAULT ++# define YYLLOC_DEFAULT(Current, Rhs, N) \ ++ ((Current).first_line = (Rhs)[1].first_line, \ ++ (Current).first_column = (Rhs)[1].first_column, \ ++ (Current).last_line = (Rhs)[N].last_line, \ ++ (Current).last_column = (Rhs)[N].last_column) + #endif +-#else /* not YYLSP_NEEDED */ ++ ++/* YYLEX -- calling `yylex' with the right arguments. */ ++ + #ifdef YYLEX_PARAM +-#define YYLEX yylex(&yylval, YYLEX_PARAM) ++# define YYLEX yylex (YYLEX_PARAM) + #else +-#define YYLEX yylex(&yylval) +-#endif +-#endif /* not YYLSP_NEEDED */ ++# define YYLEX yylex () + #endif + +-/* If nonreentrant, generate the variables here */ ++/* Enable debugging if requested. */ ++#if YYDEBUG + +-#ifndef YYPURE ++# ifndef YYFPRINTF ++# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ ++# define YYFPRINTF fprintf ++# endif ++ ++# define YYDPRINTF(Args) \ ++do { \ ++ if (yydebug) \ ++ YYFPRINTF Args; \ ++} while (0) ++ ++# define YYDSYMPRINT(Args) \ ++do { \ ++ if (yydebug) \ ++ yysymprint Args; \ ++} while (0) ++ ++# define YYDSYMPRINTF(Title, Token, Value, Location) \ ++do { \ ++ if (yydebug) \ ++ { \ ++ YYFPRINTF (stderr, "%s ", Title); \ ++ yysymprint (stderr, \ ++ Token, Value); \ ++ YYFPRINTF (stderr, "\n"); \ ++ } \ ++} while (0) + +-int yychar; /* the lookahead symbol */ +-YYSTYPE yylval; /* the semantic value of the */ +- /* lookahead symbol */ ++/*------------------------------------------------------------------. ++| yy_stack_print -- Print the state stack from its BOTTOM up to its | ++| TOP (included). | ++`------------------------------------------------------------------*/ + +-#ifdef YYLSP_NEEDED +-YYLTYPE yylloc; /* location data for the lookahead */ +- /* symbol */ ++#if defined (__STDC__) || defined (__cplusplus) ++static void ++yy_stack_print (short int *bottom, short int *top) ++#else ++static void ++yy_stack_print (bottom, top) ++ short int *bottom; ++ short int *top; + #endif ++{ ++ YYFPRINTF (stderr, "Stack now"); ++ for (/* Nothing. */; bottom <= top; ++bottom) ++ YYFPRINTF (stderr, " %d", *bottom); ++ YYFPRINTF (stderr, "\n"); ++} + +-int yynerrs; /* number of parse errors so far */ +-#endif /* not YYPURE */ ++# define YY_STACK_PRINT(Bottom, Top) \ ++do { \ ++ if (yydebug) \ ++ yy_stack_print ((Bottom), (Top)); \ ++} while (0) + +-#if YYDEBUG != 0 +-int yydebug; /* nonzero means print parse trace */ +-/* Since this is uninitialized, it does not stop multiple parsers +- from coexisting. */ ++ ++/*------------------------------------------------. ++| Report that the YYRULE is going to be reduced. | ++`------------------------------------------------*/ ++ ++#if defined (__STDC__) || defined (__cplusplus) ++static void ++yy_reduce_print (int yyrule) ++#else ++static void ++yy_reduce_print (yyrule) ++ int yyrule; + #endif ++{ ++ int yyi; ++ unsigned int yylno = yyrline[yyrule]; ++ YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", ++ yyrule - 1, yylno); ++ /* Print the symbols being reduced, and their result. */ ++ for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) ++ YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]); ++ YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]); ++} + +-/* YYINITDEPTH indicates the initial size of the parser's stacks */ ++# define YY_REDUCE_PRINT(Rule) \ ++do { \ ++ if (yydebug) \ ++ yy_reduce_print (Rule); \ ++} while (0) ++ ++/* Nonzero means print parse trace. It is left uninitialized so that ++ multiple parsers can coexist. */ ++int yydebug; ++#else /* !YYDEBUG */ ++# define YYDPRINTF(Args) ++# define YYDSYMPRINT(Args) ++# define YYDSYMPRINTF(Title, Token, Value, Location) ++# define YY_STACK_PRINT(Bottom, Top) ++# define YY_REDUCE_PRINT(Rule) ++#endif /* !YYDEBUG */ + ++ ++/* YYINITDEPTH -- initial size of the parser's stacks. */ + #ifndef YYINITDEPTH +-#define YYINITDEPTH 200 ++# define YYINITDEPTH 200 + #endif + +-/* YYMAXDEPTH is the maximum size the stacks can grow to +- (effective only if the built-in stack extension method is used). */ ++/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only ++ if the built-in stack extension method is used). ++ ++ Do not make this value too large; the results are undefined if ++ SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) ++ evaluated with infinite-precision integer arithmetic. */ + +-#if YYMAXDEPTH == 0 +-#undef YYMAXDEPTH ++#if defined (YYMAXDEPTH) && YYMAXDEPTH == 0 ++# undef YYMAXDEPTH + #endif + + #ifndef YYMAXDEPTH +-#define YYMAXDEPTH 10000 ++# define YYMAXDEPTH 10000 + #endif ++ + +-/* Define __yy_memcpy. Note that the size argument +- should be passed with type unsigned int, because that is what the non-GCC +- definitions require. With GCC, __builtin_memcpy takes an arg +- of type size_t, but it can handle unsigned int. */ +- +-#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ +-#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) +-#else /* not GNU C or C++ */ +-#ifndef __cplusplus + +-/* This is the most reliable way to avoid incompatibilities +- in available built-in functions on various systems. */ +-static void +-__yy_memcpy (to, from, count) +- char *to; +- char *from; +- unsigned int count; +-{ +- register char *f = from; +- register char *t = to; +- register int i = count; ++#if YYERROR_VERBOSE ++ ++# ifndef yystrlen ++# if defined (__GLIBC__) && defined (_STRING_H) ++# define yystrlen strlen ++# else ++/* Return the length of YYSTR. */ ++static YYSIZE_T ++# if defined (__STDC__) || defined (__cplusplus) ++yystrlen (const char *yystr) ++# else ++yystrlen (yystr) ++ const char *yystr; ++# endif ++{ ++ register const char *yys = yystr; ++ ++ while (*yys++ != '\0') ++ continue; + +- while (i-- > 0) +- *t++ = *f++; ++ return yys - yystr - 1; + } ++# endif ++# endif + +-#else /* __cplusplus */ ++# ifndef yystpcpy ++# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) ++# define yystpcpy stpcpy ++# else ++/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in ++ YYDEST. */ ++static char * ++# if defined (__STDC__) || defined (__cplusplus) ++yystpcpy (char *yydest, const char *yysrc) ++# else ++yystpcpy (yydest, yysrc) ++ char *yydest; ++ const char *yysrc; ++# endif ++{ ++ register char *yyd = yydest; ++ register const char *yys = yysrc; ++ ++ while ((*yyd++ = *yys++) != '\0') ++ continue; ++ ++ return yyd - 1; ++} ++# endif ++# endif ++ ++#endif /* !YYERROR_VERBOSE */ ++ ++ ++ ++#if YYDEBUG ++/*--------------------------------. ++| Print this symbol on YYOUTPUT. | ++`--------------------------------*/ + +-/* This is the most reliable way to avoid incompatibilities +- in available built-in functions on various systems. */ ++#if defined (__STDC__) || defined (__cplusplus) + static void +-__yy_memcpy (char *to, char *from, unsigned int count) ++yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) ++#else ++static void ++yysymprint (yyoutput, yytype, yyvaluep) ++ FILE *yyoutput; ++ int yytype; ++ YYSTYPE *yyvaluep; ++#endif + { +- register char *t = to; +- register char *f = from; +- register int i = count; ++ /* Pacify ``unused variable'' warnings. */ ++ (void) yyvaluep; ++ ++ if (yytype < YYNTOKENS) ++ { ++ YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); ++# ifdef YYPRINT ++ YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); ++# endif ++ } ++ else ++ YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + +- while (i-- > 0) +- *t++ = *f++; ++ switch (yytype) ++ { ++ default: ++ break; ++ } ++ YYFPRINTF (yyoutput, ")"); + } + ++#endif /* ! YYDEBUG */ ++/*-----------------------------------------------. ++| Release the memory associated to this symbol. | ++`-----------------------------------------------*/ ++ ++#if defined (__STDC__) || defined (__cplusplus) ++static void ++yydestruct (int yytype, YYSTYPE *yyvaluep) ++#else ++static void ++yydestruct (yytype, yyvaluep) ++ int yytype; ++ YYSTYPE *yyvaluep; + #endif +-#endif ++{ ++ /* Pacify ``unused variable'' warnings. */ ++ (void) yyvaluep; ++ ++ switch (yytype) ++ { ++ ++ default: ++ break; ++ } ++} + +-#line 217 "/usr/lib/bison.simple" + +-/* The user can define YYPARSE_PARAM as the name of an argument to be passed +- into yyparse. The argument should have type void *. +- It should actually point to an object. +- Grammar actions can access the variable by casting it +- to the proper pointer type. */ ++/* Prevent warnings from -Wmissing-prototypes. */ + + #ifdef YYPARSE_PARAM +-#ifdef __cplusplus +-#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM +-#define YYPARSE_PARAM_DECL +-#else /* not __cplusplus */ +-#define YYPARSE_PARAM_ARG YYPARSE_PARAM +-#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; +-#endif /* not __cplusplus */ +-#else /* not YYPARSE_PARAM */ +-#define YYPARSE_PARAM_ARG +-#define YYPARSE_PARAM_DECL +-#endif /* not YYPARSE_PARAM */ ++# if defined (__STDC__) || defined (__cplusplus) ++int yyparse (void *YYPARSE_PARAM); ++# else ++int yyparse (); ++# endif ++#else /* ! YYPARSE_PARAM */ ++#if defined (__STDC__) || defined (__cplusplus) ++int yyparse (void); ++#else ++int yyparse (); ++#endif ++#endif /* ! YYPARSE_PARAM */ ++ ++ ++ ++/* The lookahead symbol. */ ++int yychar; ++ ++/* The semantic value of the lookahead symbol. */ ++YYSTYPE yylval; ++ ++/* Number of syntax errors so far. */ ++int yynerrs; ++ ++ ++ ++/*----------. ++| yyparse. | ++`----------*/ + +-/* Prevent warning if -Wstrict-prototypes. */ +-#ifdef __GNUC__ + #ifdef YYPARSE_PARAM +-int yyparse (void *); ++# if defined (__STDC__) || defined (__cplusplus) ++int yyparse (void *YYPARSE_PARAM) ++# else ++int yyparse (YYPARSE_PARAM) ++ void *YYPARSE_PARAM; ++# endif ++#else /* ! YYPARSE_PARAM */ ++#if defined (__STDC__) || defined (__cplusplus) ++int ++yyparse (void) + #else +-int yyparse (void); ++int ++yyparse () ++ + #endif + #endif +- +-int +-yyparse(YYPARSE_PARAM_ARG) +- YYPARSE_PARAM_DECL + { ++ + register int yystate; + register int yyn; +- register short *yyssp; ++ int yyresult; ++ /* Number of tokens to shift before error messages enabled. */ ++ int yyerrstatus; ++ /* Lookahead token as an internal (translated) token number. */ ++ int yytoken = 0; ++ ++ /* Three stacks and their tools: ++ `yyss': related to states, ++ `yyvs': related to semantic values, ++ `yyls': related to locations. ++ ++ Refer to the stacks thru separate pointers, to allow yyoverflow ++ to reallocate them elsewhere. */ ++ ++ /* The state stack. */ ++ short int yyssa[YYINITDEPTH]; ++ short int *yyss = yyssa; ++ register short int *yyssp; ++ ++ /* The semantic value stack. */ ++ YYSTYPE yyvsa[YYINITDEPTH]; ++ YYSTYPE *yyvs = yyvsa; + register YYSTYPE *yyvsp; +- int yyerrstatus; /* number of tokens to shift before error messages enabled */ +- int yychar1 = 0; /* lookahead token as an internal (translated) token number */ + +- short yyssa[YYINITDEPTH]; /* the state stack */ +- YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ + +- short *yyss = yyssa; /* refer to the stacks thru separate pointers */ +- YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ + +-#ifdef YYLSP_NEEDED +- YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ +- YYLTYPE *yyls = yylsa; +- YYLTYPE *yylsp; +- +-#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) +-#else + #define YYPOPSTACK (yyvsp--, yyssp--) +-#endif + +- int yystacksize = YYINITDEPTH; +- int yyfree_stacks = 0; ++ YYSIZE_T yystacksize = YYINITDEPTH; + +-#ifdef YYPURE +- int yychar; +- YYSTYPE yylval; +- int yynerrs; +-#ifdef YYLSP_NEEDED +- YYLTYPE yylloc; +-#endif +-#endif ++ /* The variables used to return semantic value and location from the ++ action routines. */ ++ YYSTYPE yyval; + +- YYSTYPE yyval; /* the variable used to return */ +- /* semantic values from the action */ +- /* routines */ + ++ /* When reducing, the number of symbols on the RHS of the reduced ++ rule. */ + int yylen; + +-#if YYDEBUG != 0 +- if (yydebug) +- fprintf(stderr, "Starting parse\n"); +-#endif ++ YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; +@@ -639,110 +1015,97 @@ + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + +- yyssp = yyss - 1; ++ yyssp = yyss; + yyvsp = yyvs; +-#ifdef YYLSP_NEEDED +- yylsp = yyls; +-#endif + +-/* Push a new state, which is found in yystate . */ +-/* In all cases, when you get here, the value and location stacks +- have just been pushed. so pushing a state here evens the stacks. */ +-yynewstate: + +- *++yyssp = yystate; ++ goto yysetstate; + +- if (yyssp >= yyss + yystacksize - 1) +- { +- /* Give user a chance to reallocate the stack */ +- /* Use copies of these so that the &'s don't force the real ones into memory. */ +- YYSTYPE *yyvs1 = yyvs; +- short *yyss1 = yyss; +-#ifdef YYLSP_NEEDED +- YYLTYPE *yyls1 = yyls; +-#endif ++/*------------------------------------------------------------. ++| yynewstate -- Push a new state, which is found in yystate. | ++`------------------------------------------------------------*/ ++ yynewstate: ++ /* In all cases, when you get here, the value and location stacks ++ have just been pushed. so pushing a state here evens the stacks. ++ */ ++ yyssp++; + ++ yysetstate: ++ *yyssp = yystate; ++ ++ if (yyss + yystacksize - 1 <= yyssp) ++ { + /* Get the current used size of the three stacks, in elements. */ +- int size = yyssp - yyss + 1; ++ YYSIZE_T yysize = yyssp - yyss + 1; + + #ifdef yyoverflow +- /* Each stack pointer address is followed by the size of +- the data in use in that stack, in bytes. */ +-#ifdef YYLSP_NEEDED +- /* This used to be a conditional around just the two extra args, +- but that might be undefined if yyoverflow is a macro. */ +- yyoverflow("parser stack overflow", +- &yyss1, size * sizeof (*yyssp), +- &yyvs1, size * sizeof (*yyvsp), +- &yyls1, size * sizeof (*yylsp), +- &yystacksize); +-#else +- yyoverflow("parser stack overflow", +- &yyss1, size * sizeof (*yyssp), +- &yyvs1, size * sizeof (*yyvsp), +- &yystacksize); +-#endif +- +- yyss = yyss1; yyvs = yyvs1; +-#ifdef YYLSP_NEEDED +- yyls = yyls1; +-#endif ++ { ++ /* Give user a chance to reallocate the stack. Use copies of ++ these so that the &'s don't force the real ones into ++ memory. */ ++ YYSTYPE *yyvs1 = yyvs; ++ short int *yyss1 = yyss; ++ ++ ++ /* Each stack pointer address is followed by the size of the ++ data in use in that stack, in bytes. This used to be a ++ conditional around just the two extra args, but that might ++ be undefined if yyoverflow is a macro. */ ++ yyoverflow ("parser stack overflow", ++ &yyss1, yysize * sizeof (*yyssp), ++ &yyvs1, yysize * sizeof (*yyvsp), ++ ++ &yystacksize); ++ ++ yyss = yyss1; ++ yyvs = yyvs1; ++ } + #else /* no yyoverflow */ ++# ifndef YYSTACK_RELOCATE ++ goto yyoverflowlab; ++# else + /* Extend the stack our own way. */ +- if (yystacksize >= YYMAXDEPTH) +- { +- yyerror("parser stack overflow"); +- if (yyfree_stacks) +- { +- free (yyss); +- free (yyvs); +-#ifdef YYLSP_NEEDED +- free (yyls); +-#endif +- } +- return 2; +- } ++ if (YYMAXDEPTH <= yystacksize) ++ goto yyoverflowlab; + yystacksize *= 2; +- if (yystacksize > YYMAXDEPTH) ++ if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; +-#ifndef YYSTACK_USE_ALLOCA +- yyfree_stacks = 1; +-#endif +- yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); +- __yy_memcpy ((char *)yyss, (char *)yyss1, +- size * (unsigned int) sizeof (*yyssp)); +- yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); +- __yy_memcpy ((char *)yyvs, (char *)yyvs1, +- size * (unsigned int) sizeof (*yyvsp)); +-#ifdef YYLSP_NEEDED +- yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); +- __yy_memcpy ((char *)yyls, (char *)yyls1, +- size * (unsigned int) sizeof (*yylsp)); +-#endif ++ ++ { ++ short int *yyss1 = yyss; ++ union yyalloc *yyptr = ++ (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); ++ if (! yyptr) ++ goto yyoverflowlab; ++ YYSTACK_RELOCATE (yyss); ++ YYSTACK_RELOCATE (yyvs); ++ ++# undef YYSTACK_RELOCATE ++ if (yyss1 != yyssa) ++ YYSTACK_FREE (yyss1); ++ } ++# endif + #endif /* no yyoverflow */ + +- yyssp = yyss + size - 1; +- yyvsp = yyvs + size - 1; +-#ifdef YYLSP_NEEDED +- yylsp = yyls + size - 1; +-#endif ++ yyssp = yyss + yysize - 1; ++ yyvsp = yyvs + yysize - 1; + +-#if YYDEBUG != 0 +- if (yydebug) +- fprintf(stderr, "Stack size increased to %d\n", yystacksize); +-#endif + +- if (yyssp >= yyss + yystacksize - 1) ++ YYDPRINTF ((stderr, "Stack size increased to %lu\n", ++ (unsigned long int) yystacksize)); ++ ++ if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + +-#if YYDEBUG != 0 +- if (yydebug) +- fprintf(stderr, "Entering state %d\n", yystate); +-#endif ++ YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + goto yybackup; +- yybackup: ++ ++/*-----------. ++| yybackup. | ++`-----------*/ ++yybackup: + + /* Do appropriate processing given the current state. */ + /* Read a lookahead token if we need one and don't already have one. */ +@@ -751,154 +1114,120 @@ + /* First try to decide what to do without reference to lookahead token. */ + + yyn = yypact[yystate]; +- if (yyn == YYFLAG) ++ if (yyn == YYPACT_NINF) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + +- /* yychar is either YYEMPTY or YYEOF +- or a valid token in external form. */ +- ++ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) + { +-#if YYDEBUG != 0 +- if (yydebug) +- fprintf(stderr, "Reading a token: "); +-#endif ++ YYDPRINTF ((stderr, "Reading a token: ")); + yychar = YYLEX; + } + +- /* Convert token to internal form (in yychar1) for indexing tables with */ +- +- if (yychar <= 0) /* This means end of input. */ ++ if (yychar <= YYEOF) + { +- yychar1 = 0; +- yychar = YYEOF; /* Don't call YYLEX any more */ +- +-#if YYDEBUG != 0 +- if (yydebug) +- fprintf(stderr, "Now at end of input.\n"); +-#endif ++ yychar = yytoken = YYEOF; ++ YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { +- yychar1 = YYTRANSLATE(yychar); +- +-#if YYDEBUG != 0 +- if (yydebug) +- { +- fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); +- /* Give the individual parser a way to print the precise meaning +- of a token, for further debugging info. */ +-#ifdef YYPRINT +- YYPRINT (stderr, yychar, yylval); +-#endif +- fprintf (stderr, ")\n"); +- } +-#endif ++ yytoken = YYTRANSLATE (yychar); ++ YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc); + } + +- yyn += yychar1; +- if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) ++ /* If the proper action on seeing token YYTOKEN is to reduce or to ++ detect an error, take that action. */ ++ yyn += yytoken; ++ if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; +- + yyn = yytable[yyn]; +- +- /* yyn is what to do for this token type in this state. +- Negative => reduce, -yyn is rule number. +- Positive => shift, yyn is new state. +- New state is final state => don't bother to shift, +- just return success. +- 0, or most negative number => error. */ +- +- if (yyn < 0) ++ if (yyn <= 0) + { +- if (yyn == YYFLAG) ++ if (yyn == 0 || yyn == YYTABLE_NINF) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } +- else if (yyn == 0) +- goto yyerrlab; + + if (yyn == YYFINAL) + YYACCEPT; + + /* Shift the lookahead token. */ +- +-#if YYDEBUG != 0 +- if (yydebug) +- fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); +-#endif ++ YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken])); + + /* Discard the token being shifted unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; + + *++yyvsp = yylval; +-#ifdef YYLSP_NEEDED +- *++yylsp = yylloc; +-#endif + +- /* count tokens shifted since error; after three, turn off error status. */ +- if (yyerrstatus) yyerrstatus--; ++ ++ /* Count tokens shifted since error; after three, turn off error ++ status. */ ++ if (yyerrstatus) ++ yyerrstatus--; + + yystate = yyn; + goto yynewstate; + +-/* Do the default action for the current state. */ +-yydefault: + ++/*-----------------------------------------------------------. ++| yydefault -- do the default action for the current state. | ++`-----------------------------------------------------------*/ ++yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; ++ goto yyreduce; + +-/* Do a reduction. yyn is the number of a rule to reduce with. */ ++ ++/*-----------------------------. ++| yyreduce -- Do a reduction. | ++`-----------------------------*/ + yyreduce: ++ /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; +- if (yylen > 0) +- yyval = yyvsp[1-yylen]; /* implement default value of the action */ + +-#if YYDEBUG != 0 +- if (yydebug) +- { +- int i; ++ /* If YYLEN is nonzero, implement the default value of the action: ++ `$$ = $1'. + +- fprintf (stderr, "Reducing via rule %d (line %d), ", +- yyn, yyrline[yyn]); ++ Otherwise, the following line sets YYVAL to garbage. ++ This behavior is undocumented and Bison ++ users should not rely upon it. Assigning to YYVAL ++ unconditionally makes the parser a bit smaller, and it avoids a ++ GCC warning that YYVAL may be used uninitialized. */ ++ yyval = yyvsp[1-yylen]; + +- /* Print the symbols being reduced, and their result. */ +- for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) +- fprintf (stderr, "%s ", yytname[yyrhs[i]]); +- fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); +- } +-#endif + +- +- switch (yyn) { +- +-case 1: +-#line 165 "ql_y.y" +-{ ++ YY_REDUCE_PRINT (yyn); ++ switch (yyn) ++ { ++ case 2: ++#line 168 "ql_y.y" ++ { + STRUCTURE *walk; + + def = yyvsp[0].field; + for (walk = structures; walk; walk = walk->next) + if (!walk->instances) + fprintf(stderr,"unused structure: %s\n",walk->id); +- ; +- break;} +-case 3: +-#line 177 "ql_y.y" +-{ ++ } ++ break; ++ ++ case 4: ++#line 180 "ql_y.y" ++ { + to_c("#%s\n",yyvsp[-1].str); + to_test("#%s\n",yyvsp[-1].str); + if (dump) to_dump("#%s\n",yyvsp[-1].str); +- ; +- break;} +-case 6: +-#line 190 "ql_y.y" +-{ ++ } ++ break; ++ ++ case 7: ++#line 193 "ql_y.y" ++ { + STRUCTURE *n; + + n = alloc_t(STRUCTURE); +@@ -907,23 +1236,26 @@ + n->instances = 0; + n->next = structures; + structures = n; +- ; +- break;} +-case 7: +-#line 203 "ql_y.y" +-{ ++ } ++ break; ++ ++ case 8: ++#line 206 "ql_y.y" ++ { + abort_id = NULL; +- ; +- break;} +-case 8: +-#line 207 "ql_y.y" +-{ ++ } ++ break; ++ ++ case 9: ++#line 210 "ql_y.y" ++ { + yyval.field = yyvsp[0].field; +- ; +- break;} +-case 9: +-#line 214 "ql_y.y" +-{ ++ } ++ break; ++ ++ case 10: ++#line 217 "ql_y.y" ++ { + STRUCTURE *walk; + + for (walk = structures; walk; walk = walk->next) +@@ -939,38 +1271,43 @@ + yyval.field->my_block = copy_block(walk->block); + yyval.field->next = NULL; + abort_id = NULL; +- ; +- break;} +-case 10: +-#line 232 "ql_y.y" +-{ ++ } ++ break; ++ ++ case 11: ++#line 235 "ql_y.y" ++ { + yyval.field = yyvsp[-1].field; + abort_id = NULL; +- ; +- break;} +-case 11: +-#line 237 "ql_y.y" +-{ ++ } ++ break; ++ ++ case 12: ++#line 240 "ql_y.y" ++ { + yyval.field = NULL; + abort_id = yyvsp[0].str; +- ; +- break;} +-case 12: +-#line 244 "ql_y.y" +-{ ++ } ++ break; ++ ++ case 13: ++#line 247 "ql_y.y" ++ { + yyval.field = NULL; +- ; +- break;} +-case 13: +-#line 248 "ql_y.y" +-{ ++ } ++ break; ++ ++ case 14: ++#line 251 "ql_y.y" ++ { + yyval.field = yyvsp[-1].field; + yyvsp[-1].field->next = yyvsp[0].field; +- ; +- break;} +-case 14: +-#line 256 "ql_y.y" +-{ ++ } ++ break; ++ ++ case 15: ++#line 259 "ql_y.y" ++ { + TAG *walk; + + yyval.field = yyvsp[0].field; +@@ -989,23 +1326,26 @@ + "selections"); + if (*yyval.field->id != '_' && yyval.field->value && yyval.field->value->type == vt_multi) + yyerror("multi selectors must be unnamed"); +- ; +- break;} +-case 15: +-#line 279 "ql_y.y" +-{ ++ } ++ break; ++ ++ case 16: ++#line 282 "ql_y.y" ++ { + yyval.num = 0; +- ; +- break;} +-case 16: +-#line 283 "ql_y.y" +-{ ++ } ++ break; ++ ++ case 17: ++#line 286 "ql_y.y" ++ { + yyval.num = 1; +- ; +- break;} +-case 17: +-#line 290 "ql_y.y" +-{ ++ } ++ break; ++ ++ case 18: ++#line 293 "ql_y.y" ++ { + yyval.field = alloc_t(FIELD); + yyval.field->size = yyvsp[-1].num; + yyval.field->var_len = -2; /* hack */ +@@ -1015,140 +1355,159 @@ + yyval.field->value = NULL; + yyval.field->structure = NULL; + yyval.field->next = NULL; +- ; +- break;} +-case 18: +-#line 302 "ql_y.y" +-{ ++ } ++ break; ++ ++ case 19: ++#line 305 "ql_y.y" ++ { + yyval.field = alloc_t(FIELD); + yyval.field->size = yyvsp[-4].num; + yyval.field->var_len = -1; + yyval.field->pos = yyvsp[-3].num; + yyval.field->flush = !yyvsp[-2].num; +- if (yyval.field->pos == -1) ++ if (yyval.field->pos == -1) { + if (yyval.field->size & 7) + yyerror("position required for small fields"); + else yyval.field->pos = 0; ++ } + yyval.field->value = yyvsp[0].value; + yyval.field->structure = NULL; + yyval.field->next = NULL; +- ; +- break;} +-case 19: +-#line 319 "ql_y.y" +-{ +- yyval.num = -1; +- ; +- break;} +-case 20: ++ } ++ break; ++ ++ case 20: + #line 323 "ql_y.y" +-{ ++ { ++ yyval.num = -1; ++ } ++ break; ++ ++ case 21: ++#line 327 "ql_y.y" ++ { + yyval.num = yyvsp[0].num-1; + if (yyval.num < 0 || yyval.num > 7) yyerror("invalid position"); +- ; +- break;} +-case 21: +-#line 331 "ql_y.y" +-{ ++ } ++ break; ++ ++ case 22: ++#line 335 "ql_y.y" ++ { + char *end; + + yyval.num = strtoul(yyvsp[0].str,&end,10); + if (*end) yyerror("no a decimal number"); +- ; +- break;} +-case 22: +-#line 340 "ql_y.y" +-{ +- yyval.num = 0; +- ; +- break;} +-case 23: ++ } ++ break; ++ ++ case 23: + #line 344 "ql_y.y" +-{ ++ { ++ yyval.num = 0; ++ } ++ break; ++ ++ case 24: ++#line 348 "ql_y.y" ++ { + if (strcmp(yyvsp[0].str,"more")) yyerror("\"more\" expected"); + yyval.num = 1; +- ; +- break;} +-case 24: +-#line 351 "ql_y.y" +-{ +- yyval.value = NULL; +- ; +- break;} +-case 25: ++ } ++ break; ++ ++ case 25: + #line 355 "ql_y.y" +-{ ++ { ++ yyval.value = NULL; ++ } ++ break; ++ ++ case 26: ++#line 359 "ql_y.y" ++ { + yyval.value = yyvsp[0].value; +- ; +- break;} +-case 26: +-#line 362 "ql_y.y" +-{ ++ } ++ break; ++ ++ case 27: ++#line 366 "ql_y.y" ++ { + yyval.value = alloc_t(VALUE); + yyval.value->type = vt_id; + yyval.value->id = yyvsp[0].str; +- ; +- break;} +-case 27: +-#line 368 "ql_y.y" +-{ ++ } ++ break; ++ ++ case 28: ++#line 372 "ql_y.y" ++ { + yyval.value = alloc_t(VALUE); + yyval.value->type = vt_case; + yyval.value->id = NULL; + yyval.value->tags = yyvsp[-1].tag; +- ; +- break;} +-case 28: +-#line 375 "ql_y.y" +-{ ++ } ++ break; ++ ++ case 29: ++#line 379 "ql_y.y" ++ { + yyval.value = alloc_t(VALUE); + yyval.value->type = vt_multi; + yyval.value->tags = yyvsp[-1].tag; +- ; +- break;} +-case 29: +-#line 381 "ql_y.y" +-{ ++ } ++ break; ++ ++ case 30: ++#line 385 "ql_y.y" ++ { + yyval.value = alloc_t(VALUE); + yyval.value->type = vt_length; + yyval.value->recovery = yyvsp[-2].str; + yyval.value->block = yyvsp[0].field; + yyval.value->abort_id = abort_id; +- ; +- break;} +-case 30: +-#line 391 "ql_y.y" +-{ +- yyval.str = NULL; +- ; +- break;} +-case 31: ++ } ++ break; ++ ++ case 31: + #line 395 "ql_y.y" +-{ ++ { ++ yyval.str = NULL; ++ } ++ break; ++ ++ case 32: ++#line 399 "ql_y.y" ++ { + yyval.str = yyvsp[0].str; +- ; +- break;} +-case 32: +-#line 401 "ql_y.y" +-{ +- yyval.nlist = NULL; +- ; +- break;} +-case 33: ++ } ++ break; ++ ++ case 33: + #line 405 "ql_y.y" +-{ ++ { ++ yyval.nlist = NULL; ++ } ++ break; ++ ++ case 34: ++#line 409 "ql_y.y" ++ { + yyval.nlist = get_name_list(yyvsp[0].str); +- ; +- break;} +-case 34: +-#line 411 "ql_y.y" +-{ +- yyval.tag = NULL; +- ; +- break;} +-case 35: ++ } ++ break; ++ ++ case 35: + #line 415 "ql_y.y" +-{ ++ { ++ yyval.tag = NULL; ++ } ++ break; ++ ++ case 36: ++#line 419 "ql_y.y" ++ { + yyval.tag = alloc_t(TAG); + yyval.tag->deflt = 1; + if (yyvsp[-2].str) { +@@ -1163,18 +1522,20 @@ + yyval.tag->block = yyvsp[0].field; + yyval.tag->next = NULL; + yyval.tag->abort_id = abort_id; +- ; +- break;} +-case 36: +-#line 432 "ql_y.y" +-{ ++ } ++ break; ++ ++ case 37: ++#line 436 "ql_y.y" ++ { + yyval.tag = alloc_t(TAG); + yyval.tag->abort_id = abort_id; +- ; +- break;} +-case 37: +-#line 437 "ql_y.y" +-{ ++ } ++ break; ++ ++ case 38: ++#line 441 "ql_y.y" ++ { + yyval.tag = yyvsp[-1].tag; + yyval.tag->deflt = 0; + if (yyvsp[-4].str) { +@@ -1188,17 +1549,19 @@ + yyval.tag->more = yyvsp[-3].list; + yyval.tag->block = yyvsp[-2].field; + yyval.tag->next = yyvsp[0].tag; +- ; +- break;} +-case 38: +-#line 455 "ql_y.y" +-{ +- yyval.tag = NULL; +- ; +- break;} +-case 39: ++ } ++ break; ++ ++ case 39: + #line 459 "ql_y.y" +-{ ++ { ++ yyval.tag = NULL; ++ } ++ break; ++ ++ case 40: ++#line 463 "ql_y.y" ++ { + yyval.tag = alloc_t(TAG); + yyval.tag->deflt = 1; + if (yyvsp[-2].str) { +@@ -1212,18 +1575,20 @@ + yyval.tag->more = yyvsp[-1].list; + yyval.tag->block = yyvsp[0].field; + yyval.tag->next = NULL; +- ; +- break;} +-case 40: +-#line 475 "ql_y.y" +-{ ++ } ++ break; ++ ++ case 41: ++#line 479 "ql_y.y" ++ { + yyval.tag = alloc_t(TAG); + yyval.tag->abort_id = abort_id; +- ; +- break;} +-case 41: +-#line 480 "ql_y.y" +-{ ++ } ++ break; ++ ++ case 42: ++#line 484 "ql_y.y" ++ { + yyval.tag = yyvsp[-1].tag; + yyval.tag->deflt = 0; + if (yyvsp[-4].str) { +@@ -1237,254 +1602,266 @@ + yyval.tag->more = yyvsp[-3].list; + yyval.tag->block = yyvsp[-2].field; + yyval.tag->next = yyvsp[0].tag; +- ; +- break;} +-case 42: +-#line 498 "ql_y.y" +-{ +- yyval.str = NULL; +- ; +- break;} +-case 43: ++ } ++ break; ++ ++ case 43: + #line 502 "ql_y.y" +-{ ++ { ++ yyval.str = NULL; ++ } ++ break; ++ ++ case 44: ++#line 506 "ql_y.y" ++ { + yyval.str = yyvsp[0].str; +- ; +- break;} +-case 44: +-#line 508 "ql_y.y" +-{ +- yyval.list = NULL; +- ; +- break;} +-case 45: ++ } ++ break; ++ ++ case 45: + #line 512 "ql_y.y" +-{ ++ { ++ yyval.list = NULL; ++ } ++ break; ++ ++ case 46: ++#line 516 "ql_y.y" ++ { + yyval.list = alloc_t(VALUE_LIST); + yyval.list->value = yyvsp[-1].str; + yyval.list->next = yyvsp[0].list; +- ; +- break;} +-} +- /* the action file gets copied in in place of this dollarsign */ +-#line 543 "/usr/lib/bison.simple" ++ } ++ break; ++ ++ ++ } ++ ++/* Line 1010 of yacc.c. */ ++#line 1643 "y.tab.c" + + yyvsp -= yylen; + yyssp -= yylen; +-#ifdef YYLSP_NEEDED +- yylsp -= yylen; +-#endif + +-#if YYDEBUG != 0 +- if (yydebug) +- { +- short *ssp1 = yyss - 1; +- fprintf (stderr, "state stack now"); +- while (ssp1 != yyssp) +- fprintf (stderr, " %d", *++ssp1); +- fprintf (stderr, "\n"); +- } +-#endif ++ ++ YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + +-#ifdef YYLSP_NEEDED +- yylsp++; +- if (yylen == 0) +- { +- yylsp->first_line = yylloc.first_line; +- yylsp->first_column = yylloc.first_column; +- yylsp->last_line = (yylsp-1)->last_line; +- yylsp->last_column = (yylsp-1)->last_column; +- yylsp->text = 0; +- } +- else +- { +- yylsp->last_line = (yylsp+yylen-1)->last_line; +- yylsp->last_column = (yylsp+yylen-1)->last_column; +- } +-#endif + +- /* Now "shift" the result of the reduction. +- Determine what state that goes to, +- based on the state we popped back to +- and the rule number reduced by. */ ++ /* Now `shift' the result of the reduction. Determine what state ++ that goes to, based on the state we popped back to and the rule ++ number reduced by. */ + + yyn = yyr1[yyn]; + +- yystate = yypgoto[yyn - YYNTBASE] + *yyssp; +- if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) ++ yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; ++ if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else +- yystate = yydefgoto[yyn - YYNTBASE]; ++ yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + +-yyerrlab: /* here on detecting error */ + +- if (! yyerrstatus) +- /* If not already recovering from an error, report this error. */ ++/*------------------------------------. ++| yyerrlab -- here on detecting error | ++`------------------------------------*/ ++yyerrlab: ++ /* If not already recovering from an error, report this error. */ ++ if (!yyerrstatus) + { + ++yynerrs; +- +-#ifdef YYERROR_VERBOSE ++#if YYERROR_VERBOSE + yyn = yypact[yystate]; + +- if (yyn > YYFLAG && yyn < YYLAST) ++ if (YYPACT_NINF < yyn && yyn < YYLAST) + { +- int size = 0; +- char *msg; +- int x, count; +- +- count = 0; +- /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ +- for (x = (yyn < 0 ? -yyn : 0); +- x < (sizeof(yytname) / sizeof(char *)); x++) +- if (yycheck[x + yyn] == x) +- size += strlen(yytname[x]) + 15, count++; +- msg = (char *) malloc(size + 15); +- if (msg != 0) ++ YYSIZE_T yysize = 0; ++ int yytype = YYTRANSLATE (yychar); ++ const char* yyprefix; ++ char *yymsg; ++ int yyx; ++ ++ /* Start YYX at -YYN if negative to avoid negative indexes in ++ YYCHECK. */ ++ int yyxbegin = yyn < 0 ? -yyn : 0; ++ ++ /* Stay within bounds of both yycheck and yytname. */ ++ int yychecklim = YYLAST - yyn; ++ int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; ++ int yycount = 0; ++ ++ yyprefix = ", expecting "; ++ for (yyx = yyxbegin; yyx < yyxend; ++yyx) ++ if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) ++ { ++ yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]); ++ yycount += 1; ++ if (yycount == 5) ++ { ++ yysize = 0; ++ break; ++ } ++ } ++ yysize += (sizeof ("syntax error, unexpected ") ++ + yystrlen (yytname[yytype])); ++ yymsg = (char *) YYSTACK_ALLOC (yysize); ++ if (yymsg != 0) + { +- strcpy(msg, "parse error"); ++ char *yyp = yystpcpy (yymsg, "syntax error, unexpected "); ++ yyp = yystpcpy (yyp, yytname[yytype]); + +- if (count < 5) ++ if (yycount < 5) + { +- count = 0; +- for (x = (yyn < 0 ? -yyn : 0); +- x < (sizeof(yytname) / sizeof(char *)); x++) +- if (yycheck[x + yyn] == x) ++ yyprefix = ", expecting "; ++ for (yyx = yyxbegin; yyx < yyxend; ++yyx) ++ if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { +- strcat(msg, count == 0 ? ", expecting `" : " or `"); +- strcat(msg, yytname[x]); +- strcat(msg, "'"); +- count++; ++ yyp = yystpcpy (yyp, yyprefix); ++ yyp = yystpcpy (yyp, yytname[yyx]); ++ yyprefix = " or "; + } + } +- yyerror(msg); +- free(msg); ++ yyerror (yymsg); ++ YYSTACK_FREE (yymsg); + } + else +- yyerror ("parse error; also virtual memory exceeded"); ++ yyerror ("syntax error; also virtual memory exhausted"); + } + else + #endif /* YYERROR_VERBOSE */ +- yyerror("parse error"); ++ yyerror ("syntax error"); + } + +- goto yyerrlab1; +-yyerrlab1: /* here on error raised explicitly by an action */ ++ + + if (yyerrstatus == 3) + { +- /* if just tried and failed to reuse lookahead token after an error, discard it. */ ++ /* If just tried and failed to reuse lookahead token after an ++ error, discard it. */ + +- /* return failure if at end of input */ +- if (yychar == YYEOF) +- YYABORT; +- +-#if YYDEBUG != 0 +- if (yydebug) +- fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); +-#endif ++ if (yychar <= YYEOF) ++ { ++ /* If at end of input, pop the error token, ++ then the rest of the stack, then return failure. */ ++ if (yychar == YYEOF) ++ for (;;) ++ { ++ YYPOPSTACK; ++ if (yyssp == yyss) ++ YYABORT; ++ YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); ++ yydestruct (yystos[*yyssp], yyvsp); ++ } ++ } ++ else ++ { ++ YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc); ++ yydestruct (yytoken, &yylval); ++ yychar = YYEMPTY; + +- yychar = YYEMPTY; ++ } + } + +- /* Else will try to reuse lookahead token +- after shifting the error token. */ +- +- yyerrstatus = 3; /* Each real token shifted decrements this */ ++ /* Else will try to reuse lookahead token after shifting the error ++ token. */ ++ goto yyerrlab1; + +- goto yyerrhandle; + +-yyerrdefault: /* current state does not do anything special for the error token. */ ++/*---------------------------------------------------. ++| yyerrorlab -- error raised explicitly by YYERROR. | ++`---------------------------------------------------*/ ++yyerrorlab: + +-#if 0 +- /* This is wrong; only states that explicitly want error tokens +- should shift them. */ +- yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ +- if (yyn) goto yydefault; ++#ifdef __GNUC__ ++ /* Pacify GCC when the user code never invokes YYERROR and the label ++ yyerrorlab therefore never appears in user code. */ ++ if (0) ++ goto yyerrorlab; + #endif + +-yyerrpop: /* pop the current state because it cannot handle the error token */ +- +- if (yyssp == yyss) YYABORT; +- yyvsp--; +- yystate = *--yyssp; +-#ifdef YYLSP_NEEDED +- yylsp--; +-#endif ++ yyvsp -= yylen; ++ yyssp -= yylen; ++ yystate = *yyssp; ++ goto yyerrlab1; + +-#if YYDEBUG != 0 +- if (yydebug) +- { +- short *ssp1 = yyss - 1; +- fprintf (stderr, "Error: state stack now"); +- while (ssp1 != yyssp) +- fprintf (stderr, " %d", *++ssp1); +- fprintf (stderr, "\n"); +- } +-#endif + +-yyerrhandle: ++/*-------------------------------------------------------------. ++| yyerrlab1 -- common code for both syntax error and YYERROR. | ++`-------------------------------------------------------------*/ ++yyerrlab1: ++ yyerrstatus = 3; /* Each real token shifted decrements this. */ + +- yyn = yypact[yystate]; +- if (yyn == YYFLAG) +- goto yyerrdefault; ++ for (;;) ++ { ++ yyn = yypact[yystate]; ++ if (yyn != YYPACT_NINF) ++ { ++ yyn += YYTERROR; ++ if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) ++ { ++ yyn = yytable[yyn]; ++ if (0 < yyn) ++ break; ++ } ++ } + +- yyn += YYTERROR; +- if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) +- goto yyerrdefault; ++ /* Pop the current state because it cannot handle the error token. */ ++ if (yyssp == yyss) ++ YYABORT; + +- yyn = yytable[yyn]; +- if (yyn < 0) +- { +- if (yyn == YYFLAG) +- goto yyerrpop; +- yyn = -yyn; +- goto yyreduce; ++ YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); ++ yydestruct (yystos[yystate], yyvsp); ++ YYPOPSTACK; ++ yystate = *yyssp; ++ YY_STACK_PRINT (yyss, yyssp); + } +- else if (yyn == 0) +- goto yyerrpop; + + if (yyn == YYFINAL) + YYACCEPT; + +-#if YYDEBUG != 0 +- if (yydebug) +- fprintf(stderr, "Shifting error token, "); +-#endif ++ YYDPRINTF ((stderr, "Shifting error token, ")); + + *++yyvsp = yylval; +-#ifdef YYLSP_NEEDED +- *++yylsp = yylloc; +-#endif ++ + + yystate = yyn; + goto yynewstate; + +- yyacceptlab: +- /* YYACCEPT comes here. */ +- if (yyfree_stacks) +- { +- free (yyss); +- free (yyvs); +-#ifdef YYLSP_NEEDED +- free (yyls); +-#endif +- } +- return 0; + +- yyabortlab: +- /* YYABORT comes here. */ +- if (yyfree_stacks) +- { +- free (yyss); +- free (yyvs); +-#ifdef YYLSP_NEEDED +- free (yyls); ++/*-------------------------------------. ++| yyacceptlab -- YYACCEPT comes here. | ++`-------------------------------------*/ ++yyacceptlab: ++ yyresult = 0; ++ goto yyreturn; ++ ++/*-----------------------------------. ++| yyabortlab -- YYABORT comes here. | ++`-----------------------------------*/ ++yyabortlab: ++ yyresult = 1; ++ goto yyreturn; ++ ++#ifndef yyoverflow ++/*----------------------------------------------. ++| yyoverflowlab -- parser overflow comes here. | ++`----------------------------------------------*/ ++yyoverflowlab: ++ yyerror ("parser stack overflow"); ++ yyresult = 2; ++ /* Fall through. */ ++#endif ++ ++yyreturn: ++#ifndef yyoverflow ++ if (yyss != yyssa) ++ YYSTACK_FREE (yyss); + #endif +- } +- return 1; ++ return yyresult; + } +-#line 518 "ql_y.y" ++ ++ ++ +--- linux-atm-2.4.1.orig/src/qgen/ql_y.y ++++ linux-atm-2.4.1/src/qgen/ql_y.y +@@ -17,6 +17,8 @@ + #include "qgen.h" + #include "file.h" + ++extern void yyerror(const char *s); ++ + + #define MAX_TOKEN 256 + #define DEFAULT_NAMELIST_FILE "default.nl" +@@ -58,9 +60,10 @@ + for (walk = strchr(start,0)-1; walk > start && isspace(*walk); walk--) + *walk = 0; + if (*start == ':') { +- if (!(searching = strcmp(start+1,name))) ++ if (!(searching = strcmp(start+1,name))) { + if (found) yyerror("multiple entries"); + else found = 1; ++ } + continue; + } + if (searching) continue; +@@ -305,10 +308,11 @@ + $$->var_len = -1; + $$->pos = $2; + $$->flush = !$3; +- if ($$->pos == -1) ++ if ($$->pos == -1) { + if ($$->size & 7) + yyerror("position required for small fields"); + else $$->pos = 0; ++ } + $$->value = $5; + $$->structure = NULL; + $$->next = NULL; +--- linux-atm-2.4.1.orig/src/qgen/ql_l.l ++++ linux-atm-2.4.1/src/qgen/ql_l.l +@@ -68,7 +68,7 @@ + + %% + +-void yyerror(char *s) ++void yyerror(const char *s) + { + fprintf(stderr,"line %d: %s near \"%s\"\n",lineno,s,yytext); + exit(1); +--- linux-atm-2.4.1.orig/src/qgen/qlib.c ++++ linux-atm-2.4.1/src/qgen/qlib.c +@@ -26,14 +26,14 @@ + #include "op.h" + + +-static int debug = 0; ++static int q_debug = 0; + + + void PREFIX(report)(int severity,const char *msg,...) + { + va_list ap; + +- if (!debug && severity > Q_ERROR) return; ++ if (!q_debug && severity > Q_ERROR) return; + va_start(ap,msg); + vprintf(msg,ap); + printf("\n"); +@@ -836,7 +836,7 @@ + Q_DSC dsc; + int len,c; + +- debug = argc != 1; ++ q_debug = argc != 1; + len = 0; + while (scanf("%x",&c) == 1) msg[len++] = c; + qd_start(); +--- linux-atm-2.4.1.orig/src/qgen/qlib.h ++++ linux-atm-2.4.1/src/qgen/qlib.h +@@ -23,7 +23,9 @@ + #define Q_FATAL -1 + + ++#ifndef DUMP_MODE + extern int q_dump; ++#endif + extern void q_report(int severity,const char *msg,...); + + #ifdef DUMP_MODE +--- linux-atm-2.4.1.orig/src/qgen/ql_y.h ++++ linux-atm-2.4.1/src/qgen/ql_y.h +@@ -1,4 +1,65 @@ +-typedef union { ++/* A Bison parser, made by GNU Bison 1.875d. */ ++ ++/* Skeleton parser for Yacc-like parsing with Bison, ++ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++ ++ 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 ++ the Free Software Foundation; either version 2, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software ++ Foundation, Inc., 59 Temple Place - Suite 330, ++ Boston, MA 02111-1307, USA. */ ++ ++/* As a special exception, when this file is copied by Bison into a ++ Bison output file, you may use that output file without restriction. ++ This special exception was added by the Free Software Foundation ++ in version 1.24 of Bison. */ ++ ++/* Tokens. */ ++#ifndef YYTOKENTYPE ++# define YYTOKENTYPE ++ /* Put the tokens into the symbol table, so that GDB and other debuggers ++ know about them. */ ++ enum yytokentype { ++ TOK_BREAK = 258, ++ TOK_CASE = 259, ++ TOK_DEF = 260, ++ TOK_DEFAULT = 261, ++ TOK_LENGTH = 262, ++ TOK_MULTI = 263, ++ TOK_RECOVER = 264, ++ TOK_ABORT = 265, ++ TOK_ID = 266, ++ TOK_INCLUDE = 267, ++ TOK_STRING = 268 ++ }; ++#endif ++#define TOK_BREAK 258 ++#define TOK_CASE 259 ++#define TOK_DEF 260 ++#define TOK_DEFAULT 261 ++#define TOK_LENGTH 262 ++#define TOK_MULTI 263 ++#define TOK_RECOVER 264 ++#define TOK_ABORT 265 ++#define TOK_ID 266 ++#define TOK_INCLUDE 267 ++#define TOK_STRING 268 ++ ++ ++ ++ ++#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) ++#line 142 "ql_y.y" ++typedef union YYSTYPE { + const char *str; + int num; + FIELD *field; +@@ -7,17 +68,14 @@ + TAG *tag; + NAME_LIST *nlist; + } YYSTYPE; +-#define TOK_BREAK 257 +-#define TOK_CASE 258 +-#define TOK_DEF 259 +-#define TOK_DEFAULT 260 +-#define TOK_LENGTH 261 +-#define TOK_MULTI 262 +-#define TOK_RECOVER 263 +-#define TOK_ABORT 264 +-#define TOK_ID 265 +-#define TOK_INCLUDE 266 +-#define TOK_STRING 267 +- ++/* Line 1285 of yacc.c. */ ++#line 73 "y.tab.h" ++# define yystype YYSTYPE /* obsolescent; will be withdrawn */ ++# define YYSTYPE_IS_DECLARED 1 ++# define YYSTYPE_IS_TRIVIAL 1 ++#endif + + extern YYSTYPE yylval; ++ ++ ++ +--- linux-atm-2.4.1.orig/src/qgen/incl.pl ++++ linux-atm-2.4.1/src/qgen/incl.pl +@@ -24,7 +24,7 @@ + } + die "no include file specified" unless defined $last; + for (@STD,@USR) { +- next unless defined stat $_."/".$last; ++ next unless -e "$_/$last"; + print $_."/".$last."\n" || die "print STDOUT: $!"; + exit 0; + } +--- linux-atm-2.4.1.orig/src/qgen/msg.fmt ++++ linux-atm-2.4.1/src/qgen/msg.fmt +@@ -53,7 +53,7 @@ + ATM_TD_FW_PCR_0 { p##fw_pcr_0 <24> } \ + ATM_TD_BW_PCR_0 { p##bw_pcr_0 <24> } \ + ATM_TD_FW_PCR_01 { p##fw_pcr_01 <24> } \ +- ATM_TD_BW_PCR_01 { p##bw_pcr_01 <24> } \ ++ ATM_TD_BW_PCR_01 { p##bw_pcr_01 <24> } + + #define TRAFFIC_DESCRIPTOR_VBR(p) \ + ATM_TD_FW_SCR_0 { p##fw_scr_0 <24> } \ +@@ -63,15 +63,15 @@ + ATM_TD_FW_MBS_0 { p##fw_mbs_0 <24> } \ + ATM_TD_BW_MBS_0 { p##bw_mbs_0 <24> } \ + ATM_TD_FW_MBS_01 { p##fw_mbs_01 <24> } \ +- ATM_TD_BW_MBS_01 { p##bw_mbs_01 <24> } \ ++ ATM_TD_BW_MBS_01 { p##bw_mbs_01 <24> } + + #define TRAFFIC_DESCRIPTOR_BE(p) \ +- ATM_TD_BEST_EFFORT { p##best_effort <0> } \ ++ ATM_TD_BEST_EFFORT { p##best_effort <0> } + + #if defined(UNI40) || defined(DYNAMIC_UNI) + #define TRAFFIC_DESCRIPTOR_ABR(p) \ + ATM_TD_FW_MCR_01 { p##fw_mcr_01 <24> } \ +- ATM_TD_BW_MCR_01 { p##bw_mcr_01 <24> } \ ++ ATM_TD_BW_MCR_01 { p##bw_mcr_01 <24> } + + #else + #define TRAFFIC_DESCRIPTOR_ABR(p) /* not yet */ +--- linux-atm-2.4.1.orig/src/qgen/output ++++ linux-atm-2.4.1/src/qgen/output +@@ -0,0 +1,704 @@ ++# 1 "<stdin>" ++# 1 "<built-in>" ++# 1 "<command line>" ++# 1 "<stdin>" ++ ++ ++ ++ ++ ++# 1 "../../config.h" 1 ++# 7 "<stdin>" 2 ++ ++ ++ ++ ++include "atmsap.h" ++include "uni.h" ++# 26 "<stdin>" ++def ie_aal = { ++ _ext <1@8,more> = 1 _cs "q2931_cs" <2@6,more> = Q2931_CS_ITU _flag "atm_flag" <1@5,more> = ATM_FLAG_NO _action_ind "atm_ai_ie" <3@1> = 0 _ie_len <16> = recover RECOV_IND_IE length { ++ aal_type <8> = case { ++ 5 { ++ _id "atm_aalp" <8> = multi { ++ ATM_AALP_FW_MAX_SDU { ++ fw_max_sdu <16> ++ } ++ ATM_AALP_BW_MAX_SDU { ++ bw_max_sdu <16> ++ } ++ ++ ATM_AALP_AAL_MODE { ++ aal_mode <8> # UNI 3.0 only ++ } ++ ++ ATM_AALP_SSCS { ++ sscs_type <8> ++ } ++ } ++ } ++ } ++ } ++} ++# 90 "<stdin>" ++def ie_td = { # UNI 3.0 calls this "User Cell Rate" ++ _ext <1@8,more> = 1 _cs "q2931_cs" <2@6,more> = Q2931_CS_ITU _flag "atm_flag" <1@5,more> = ATM_FLAG_NO _action_ind "atm_ai_ie" <3@1> = 0 _ie_len <16> = recover RECOV_IND_IE length { ++ _id "atm_td" <8> = multi { ++ ATM_TD_FW_PCR_0 { _dummy <0> = length {}fw_pcr_0 <24> } ATM_TD_BW_PCR_0 { _dummy <0> = length {}bw_pcr_0 <24> } ATM_TD_FW_PCR_01 { _dummy <0> = length {}fw_pcr_01 <24> } ATM_TD_BW_PCR_01 { _dummy <0> = length {}bw_pcr_01 <24> } ATM_TD_FW_SCR_0 { _dummy <0> = length {}fw_scr_0 <24> } ATM_TD_BW_SCR_0 { _dummy <0> = length {}bw_scr_0 <24> } ATM_TD_FW_SCR_01 { _dummy <0> = length {}fw_scr_01 <24> } ATM_TD_BW_SCR_01 { _dummy <0> = length {}bw_scr_01 <24> } ATM_TD_FW_MBS_0 { _dummy <0> = length {}fw_mbs_0 <24> } ATM_TD_BW_MBS_0 { _dummy <0> = length {}bw_mbs_0 <24> } ATM_TD_FW_MBS_01 { _dummy <0> = length {}fw_mbs_01 <24> } ATM_TD_BW_MBS_01 { _dummy <0> = length {}bw_mbs_01 <24> } ATM_TD_BEST_EFFORT { _dummy <0> = length {}best_effort <0> } ++# 104 "<stdin>" ++ ATM_TD_TM_OPT { # @@@ should this also go into the TD macro ? ++ ++ fw_fdisc "atm_fd" <1@8,more> = ATM_FD_NO ++ bw_fdisc "atm_fd" <1@7,more> = ATM_FD_NO ++ ++ bw_tag "atm_tag" <1@2,more> = ATM_TAG_NO ++ fw_tag "atm_tag" <1@1> = ATM_TAG_NO ++ } ++ } ++ } ++} ++ ++ ++def ie_bbcap = { ++ _ext <1@8,more> = 1 _cs "q2931_cs" <2@6,more> = Q2931_CS_ITU _flag "atm_flag" <1@5,more> = ATM_FLAG_NO _action_ind "atm_ai_ie" <3@1> = 0 _ie_len <16> = recover RECOV_IND_IE length { ++ bearer_class "atm_bc" <5@1,more> ++ _ext <1@8> = case { ++ 0 { ++ _ext <1@8,more> = 1 ++ trans_cap "atm_tc" <7@1> ++ } ++ default 1 {} ++ } ++ _ext <1@8,more> = 1 ++ susc_clip "atm_stc" <2@6,more> = ATM_STC_NO ++ upcc "atm_upcc" <2@1> = ATM_UPCC_P2P ++ } ++} ++ ++ ++def ie_bhli = { ++ _ext <1@8,more> = 1 _cs "q2931_cs" <2@6,more> = Q2931_CS_ITU _flag "atm_flag" <1@5,more> = ATM_FLAG_NO _action_ind "atm_ai_ie" <3@1> = 0 _ie_len <16> = recover RECOV_IND_IE length { ++ _ext <1@8,more> = 1 ++ hli_type <7@1> = case { ++ ++ ++ 0 { # ISO ++ iso_hli <-64> ++ } ++ 1 { # User Specific ++ user_hli <-64> ++ } ++ ++ 2 { # High layer profile - UNI 3.0 only ++ hlp <32> ++ } ++ ++ 3 { # Vendor-Specific Application identifier ++ hli_oui <24> ++ app_id <32> ++ } ++ ++ 4 { # Reference to ITU-T SG 1 B-ISDN Teleservice Recommendation ++ tobedefined <8> ++ } ++ ++ } ++ } ++} ++ ++ ++def ie_blli = { ++ _ext <1@8,more> = 1 _cs "q2931_cs" <2@6,more> = Q2931_CS_ITU _flag "atm_flag" <1@5,more> = ATM_FLAG_NO _action_ind "atm_ai_ie" <3@1> = 0 _ie_len <16> = recover RECOV_IND_IE length { ++ _lid <2@6,more> = multi { ++ 1 { ++ _ext <1@8,more> = 1 ++ uil1_proto <5@1> ++ } ++ 2 { ++ uil2_proto "atm_l2" <5@1,more> = case { ++ ATM_L2_X25_LL,ATM_L2_X25_ML,ATM_L2_HDLC_ARM, ++ ATM_L2_HDLC_NRM,ATM_L2_HDLC_ABM,ATM_L2_Q922, ++ ATM_L2_ISO7776 { # CCITT encoding ++ _ext <1@8> = case { ++ 0 { ++ l2_mode "atm_imd" <2@6,more> = ATM_IMD_NORMAL ++ q933 <2@1,more> = 0 ++ _ext <1@8> = case { ++ 0 { ++ window_size <7@1,more> ++ _ext <1@8> = 1 ++ } ++ default 1 {} ++ } ++ } ++ default 1 {} ++ } ++ } ++ ATM_L2_USER { # User specified ++ _ext <1@8> = 0 ++ user_l2 <7@1,more> ++ _ext <1@8> = 1 ++ } ++ default ATM_L2_ISO1745,ATM_L2_Q291,ATM_L2_LAPB, ++ ATM_L2_ISO8802,ATM_L2_X75 { # No additional data ++ _ext <1@8> = 1 ++ } ++ } ++ } ++ 3 { ++ uil3_proto "atm_l3" <5@1,more> = case { ++ ATM_L3_X25,ATM_L3_ISO8208,ATM_L3_X223 { # CCITT coding ++ _ext <1@8> = case { ++ 0 { ++ l3_mode "atm_imd" <2@6,more> = ATM_IMD_NORMAL ++ _ext <1@8> = case { ++ 0 { ++ def_pck_size <4@1,more> ++ _ext <1@8> = case { ++ 0 { ++ _ext <1@8> = 1 ++ pck_win_size <7@1> ++ } ++ default 1 {} ++ } ++ } ++ default 1 {} ++ } ++ } ++ default 1 {} ++ } ++ } ++ ++ ATM_L3_H310 { # ITU-T Rec. H.310 ++ _ext <1@8> = case { ++ 0 { ++ term_type "atm_tt" <4@1,more> = ATM_TT_RXTX ++ _ext <1@8> = case { ++ 0 { ++ _ext <1@8,more> = 1 ++ fw_mpx_cap "atm_mc" <3@4,more> = ++ ATM_MC_NONE ++ bw_mpx_cap "atm_mc" <3@1> = ATM_MC_NONE ++ } ++ default 1 {} ++ } ++ } ++ default 1 {} ++ } ++ } ++ ++ ATM_L3_TR9577 { # ISO/IEC TR9577 ++ _ext <1@8> = case { ++ 0 { ++ _ext <1@8,more> = 0 ++ ipi_high <7@1> = case { ++ 0x40 { # SNAP hack ++ _ext <1@8,more> = 1 ++ _ipi_low <1@7> = case { # ugly ++ 0 { ++ _ext <1@8,more> = 1 ++ _snap_id <2@6> = 0 ++ oui <24> ++ pid <16> ++ } ++ default 1 {} ++ } ++ } ++ default 0x0 { # ugly ++ _ext <1@8,more> = 1 ++ ipi_low <1@7> ++ } ++ } ++ } ++ default 1 {} ++ } ++ } ++ ATM_L3_USER { # User specified ++ _ext <1@8> = 0 ++ user_l3 <7@1,more> ++ _ext <1@8> = 1 ++ } ++ } ++ } ++ } ++ } ++} ++ ++ ++def ie_call_state = { ++ _ext <1@8,more> = 1 _cs "q2931_cs" <2@6,more> = Q2931_CS_ITU _flag "atm_flag" <1@5,more> = ATM_FLAG_NO _action_ind "atm_ai_ie" <3@1> = 0 _ie_len <16> = recover RECOV_IND_IE length { ++ call_state <6@1> ++ } ++} ++ ++ ++def ie_cdpn = { ++ _ext <1@8,more> = 1 _cs "q2931_cs" <2@6,more> = Q2931_CS_ITU _flag "atm_flag" <1@5,more> = ATM_FLAG_NO _action_ind "atm_ai_ie" <3@1> = 0 _ie_len <16> = recover RECOV_IND_IE length { ++ _ext <1@8,more> = 1 ++ _plan "atm_np" <4@1,more> = case { ++ ATM_NP_E164 { ++ _type "atm_ton" <3@5> = ATM_TON_INTRNTNL ++ cdpn_e164 <-96> ++ } ++ ATM_NP_AEA { # ATM Endsystem Address ++ _type "atm_ton" <3@5> = ATM_TON_UNKNOWN ++ cdpn_esa <-160> ++ } ++ } ++ } ++} ++ ++ ++def ie_cdps = { ++ _ext <1@8,more> = 1 _cs "q2931_cs" <2@6,more> = Q2931_CS_ITU _flag "atm_flag" <1@5,more> = ATM_FLAG_NO _action_ind "atm_ai_ie" <3@1> = 0 _ie_len <16> = recover RECOV_IND_IE length { ++ _ext <1@8,more> = 1 ++ ++ ++ ++ ++ cdps_type "atm_sat" <3@5,more> = ATM_SAT_AEA ++ ++ _oddeven <1@4> = 0 ++ cdps <-160> ++ } ++} ++ ++ ++def ie_cgpn = { # @@@ extend language to allow same trick as for cdpn ++ _ext <1@8,more> = 1 _cs "q2931_cs" <2@6,more> = Q2931_CS_ITU _flag "atm_flag" <1@5,more> = ATM_FLAG_NO _action_ind "atm_ai_ie" <3@1> = 0 _ie_len <16> = recover RECOV_IND_IE length { ++ cgpn_plan "atm_np" <4@1,more> ++ cgpn_type "atm_ton" <3@5,more> ++ _ext <1@8> = case { ++ 0 { ++ _ext <1@8,more> = 1 ++ pres_ind "atm_prs" <2@6,more> = ATM_PRS_ALLOW ++ scr_ind "atm_scrn" <2@1> = ATM_SCRN_UP_NS ++ } ++ default 1 {} ++ } ++ cgpn <-160> ++ } ++} ++ ++ ++def ie_cgps = { ++ _ext <1@8,more> = 1 _cs "q2931_cs" <2@6,more> = Q2931_CS_ITU _flag "atm_flag" <1@5,more> = ATM_FLAG_NO _action_ind "atm_ai_ie" <3@1> = 0 _ie_len <16> = recover RECOV_IND_IE length { ++ _ext <1@8,more> = 1 ++ ++ ++ ++ ++ cgps_type "atm_sat" <3@5,more> = ATM_SAT_AEA ++ ++ _oddeven <1@4> = 0 ++ cgps <-160> ++ } ++} ++ ++ ++def ie_cause = { ++ _ext <1@8,more> = 1 cause_cs "q2931_cs" <2@6,more> = Q2931_CS_ITU _flag "atm_flag" <1@5,more> = ATM_FLAG_NO _action_ind "atm_ai_ie" <3@1> = 0 _ie_len <16> = recover RECOV_IND_IE length { ++ _ext <1@8,more> = 1 ++ location "atm_loc" <4@1> = ATM_LOC_USER ++ _ext <1@8,more> = 1 ++ cause "atm_cv" <7@1> = case { ++ ATM_CV_UNALLOC,ATM_CV_NO_ROUTE_DEST,ATM_CV_QOS_UNAVAIL { # Note 2 ++ break ++ _ext <1@8,more> = 1 ++ pu "atm_pu" <1@4,more> = ATM_PU_USER ++ na "atm_na" <1@3,more> = ATM_NA_NORMAL ++ cond2 "atm_cond" <2@1> = ATM_COND_UNKNOWN ++ } ++ ATM_CV_CALL_REJ { # Note 3 ++ break ++ _ext <1@8,more> = 1 ++ cond3 "atm_cond" <2@1,more> = ATM_COND_UNKNOWN ++ reason <5@3> = case { ++ ATM_RSN_USER { ++ user_diag <-216> ++ } ++ ATM_RSN_IE_MISS,ATM_RSN_IE_INSUFF { ++ ie_id3 "atm_ie" <8> ++ } ++ } ++ } ++ ATM_CV_NUM_CHANGED { # Note 4 ++ break ++ new_dest <-224> # good luck ... ++ } ++ ATM_CV_REJ_CLIR { # Note 5 ++ break ++ invalid <8> # not supported ++ } ++ ATM_CV_ACC_INF_DISC,ATM_CV_INCOMP_DEST,ATM_CV_MAND_IE_MISSING, ++ ATM_CV_UNKNOWN_IE,ATM_CV_INVALID_IE { # Note 6 ++ break ++ ie_id6 <-224> ++ } ++ ++ ATM_CV_UCR_UNAVAIL_OLD,ATM_CV_UCR_UNAVAIL_NEW { # Note 8 ++ ++ ++ ++ ++ ++ ++ ++ break ++ ucr_id <-224> ++ } ++ ATM_CV_NO_SUCH_CHAN { # Note 9 ++ break ++ unav_vpci <16> ++ unav_vci <16> ++ } ++ ATM_CV_UNKNOWN_MSG_TYPE,ATM_CV_INCOMP_MSG { # Note 10 ++ break ++ bad_msg_type "atm_msg" <8> ++ } ++ ATM_CV_TIMER_EXP { # Note 11 ++ break ++ timer <24> ++ } ++ default 0 {} ++ } ++ } ++} ++ ++ ++def ie_conn_id = { ++ _ext <1@8,more> = 1 _cs "q2931_cs" <2@6,more> = Q2931_CS_ITU _flag "atm_flag" <1@5,more> = ATM_FLAG_NO _action_ind "atm_ai_ie" <3@1> = 0 _ie_len <16> = recover RECOV_IND_IE length { ++ _ext <1@8,more> = 1 ++ _vp_ass "atm_vpa" <2@4,more> = ATM_VPA_EXPL ++ _pref_exc "atm_poe" <3@1> = 0 ++ vpi <16> ++ vci <16> ++ } ++} ++ ++ ++ ++ ++def ie_e2e_tdl = { ++ _ext <1@8,more> = 1 _cs "q2931_cs" <2@6,more> = Q2931_CS_ITU _flag "atm_flag" <1@5,more> = ATM_FLAG_NO _action_ind "atm_ai_ie" <3@1> = 0 _ie_len <16> = recover RECOV_IND_IE length { ++ _id "atm_tdl" <8> = multi { ++ ATM_TDL_CUM { ++ cum_delay <16> ++ } ++ ATM_TDL_E2EMAX { ++ max_delay <16> ++ } ++ ATM_TDL_NGI {} ++ } ++ ++ } ++} ++ ++ ++ ++ ++def ie_qos = { ++# 467 "<stdin>" ++ _ext <1@8,more> = 1 qos_cs "q2931_cs" <2@6,more> = Q2931_CS_NET _flag "atm_flag" <1@5,more> = ATM_FLAG_NO _action_ind "atm_ai_ie" <3@1> = 0 _ie_len <16> = recover RECOV_IND_IE length { ++ ++ qos_fw <8> = 0 ++ qos_bw <8> = 0 ++ } ++} ++ ++ ++def ie_bbrep = { ++ _ext <1@8,more> = 1 _cs "q2931_cs" <2@6,more> = Q2931_CS_ITU _flag "atm_flag" <1@5,more> = ATM_FLAG_NO _action_ind "atm_ai_ie" <3@1> = 0 _ie_len <16> = recover RECOV_IND_IE length { ++ _ext <1@8,more> = 1 ++ rep_ind <4@1> = 2 ++ } ++} ++ ++ ++def ie_restart = { ++ _ext <1@8,more> = 1 _cs "q2931_cs" <2@6,more> = Q2931_CS_ITU _flag "atm_flag" <1@5,more> = ATM_FLAG_NO _action_ind "atm_ai_ie" <3@1> = 0 _ie_len <16> = recover RECOV_IND_IE length { ++ _ext <1@8,more> = 1 ++ rst_class <3@1> ++ } ++} ++ ++ ++def ie_bbs_comp = { ++ _ext <1@8,more> = 1 _cs "q2931_cs" <2@6,more> = Q2931_CS_ITU _flag "atm_flag" <1@5,more> = ATM_FLAG_NO _action_ind "atm_ai_ie" <3@1> = 0 _ie_len <16> = recover RECOV_IND_IE length { ++ _ext <1@8,more> = 1 ++ bbsc_ind <7@1> = 0x21 ++ } ++} ++ ++ ++def ie_tns = { ++ _ext <1@8,more> = 1 _cs "q2931_cs" <2@6,more> = Q2931_CS_ITU _flag "atm_flag" <1@5,more> = ATM_FLAG_NO _action_ind "atm_ai_ie" <3@1> = 0 _ie_len <16> = recover RECOV_IND_IE length { ++ _ext <1@8,more> = 1 ++ _net_type "atm_tni" <3@5,more> = ATM_TNI_NNI ++ _carrier_id "atm_nip" <4@1> = ATM_NIP_CARRIER ++ net_id <-32> ++ } ++} ++ ++ ++ ++ ++def ie_notify = { ++ _ext <1@8,more> = 1 _cs "q2931_cs" <2@6,more> = Q2931_CS_ITU _flag "atm_flag" <1@5,more> = ATM_FLAG_NO _action_ind "atm_ai_ie" <3@1> = 0 _ie_len <16> = recover RECOV_IND_IE length { ++ notification <-32> # @@@ how many actually ? ++ } ++} ++ ++ ++def ie_oam_td = { ++ _ext <1@8,more> = 1 _cs "q2931_cs" <2@6,more> = Q2931_CS_ITU _flag "atm_flag" <1@5,more> = ATM_FLAG_NO _action_ind "atm_ai_ie" <3@1> = 0 _ie_len <16> = recover RECOV_IND_IE length { ++ _ext <1@8,more> = 1 ++ shaping "atm_shi" <2@6,more> = ATM_SHI_NONE ++ compliance "atm_oci" <1@5,more> = ATM_OCI_OPT ++ fault "atm_unfm" <3@1> = ATM_UNFM_NONE ++ _ext <1@8,more> = 1 ++ fwd_ofi "atm_ofi" <3@5,more> = ATM_OFI_0_0 ++ bwd_ofi "atm_ofi" <3@1> = ATM_OFI_0_0 ++ } ++} ++ ++ ++def ie_git = { ++ _ext <1@8,more> = 1 _cs "q2931_cs" <2@6,more> = Q2931_CS_NET _flag "atm_flag" <1@5,more> = ATM_FLAG_NO _action_ind "atm_ai_ie" <3@1> = 0 _ie_len <16> = recover RECOV_IND_IE length { # @@@ UNI 4.0 does not specify the coding ++ _dummy <1@8> = 0 # bit is "spare", although not indicated in spec ++ id_std_app "atm_irs" <7@1> = case { ++ ATM_IRS_DSMCC,ATM_IRS_H245 { ++ _type "atm_it" <8> = ATM_IT_SESSION ++ _length <8> = length { ++ session_id <-160> ++ } ++ _type "atm_it" <8> = ATM_IT_RESOURCE ++ _length <8> = length { ++ resource_id <-32> ++ } ++ } ++ default 0 { ++ unrecognized_git_identifiers <-224> # 33-5 bytes ++ } ++ } ++ } ++} ++ ++ ++def ie_lij_id = { ++ _ext <1@8,more> = 1 _cs "q2931_cs" <2@6,more> = Q2931_CS_NET _flag "atm_flag" <1@5,more> = ATM_FLAG_NO _action_ind "atm_ai_ie" <3@1> = 0 _ie_len <16> = recover RECOV_IND_IE length { # @@@ UNI 4.0 does not specify the coding ++ _ext <1@8,more> = 1 ++ lij_id_type "atm_lit" <7@1> = ATM_LIT_ROOT ++ lij_id <32> ++ } ++} ++ ++ ++def ie_lij_prm = { ++ _ext <1@8,more> = 1 _cs "q2931_cs" <2@6,more> = Q2931_CS_NET _flag "atm_flag" <1@5,more> = ATM_FLAG_NO _action_ind "atm_ai_ie" <3@1> = 0 _ie_len <16> = recover RECOV_IND_IE length { # @@@ UNI 4.0 does not specify the coding ++ _ext <1@8,more> = 1 ++ lij_scr_ind "atm_lsi" <2@1> ++ } ++} ++ ++ ++def ie_leaf_sn = { ++ _ext <1@8,more> = 1 _cs "q2931_cs" <2@6,more> = Q2931_CS_NET _flag "atm_flag" <1@5,more> = ATM_FLAG_NO _action_ind "atm_ai_ie" <3@1> = 0 _ie_len <16> = recover RECOV_IND_IE length { # @@@ UNI 4.0 does not specify the coding ++ leaf_sn <32> ++ } ++} ++ ++ ++def ie_scope_sel = { ++ _ext <1@8,more> = 1 _cs "q2931_cs" <2@6,more> = Q2931_CS_NET _flag "atm_flag" <1@5,more> = ATM_FLAG_NO _action_ind "atm_ai_ie" <3@1> = 0 _ie_len <16> = recover RECOV_IND_IE length { # @@@ UNI 4.0 does not specify the coding ++ _ext <1@8,more> = 1 ++ scope_type "atm_tcs" <4@1> = ATM_TCS_ORGANIZATIONAL ++ scope_sel "atm_css" <8> ++ } ++} ++ ++ ++def ie_alt_td = { ++ _ext <1@8,more> = 1 _cs "q2931_cs" <2@6,more> = Q2931_CS_ITU _flag "atm_flag" <1@5,more> = ATM_FLAG_NO _action_ind "atm_ai_ie" <3@1> = 0 _ie_len <16> = recover RECOV_IND_IE length { ++ _id "atm_td" <8> = multi { ++ ATM_TD_FW_PCR_0 { altfw_pcr_0 <24> } ATM_TD_BW_PCR_0 { altbw_pcr_0 <24> } ATM_TD_FW_PCR_01 { altfw_pcr_01 <24> } ATM_TD_BW_PCR_01 { altbw_pcr_01 <24> } ATM_TD_FW_SCR_0 { altfw_scr_0 <24> } ATM_TD_BW_SCR_0 { altbw_scr_0 <24> } ATM_TD_FW_SCR_01 { altfw_scr_01 <24> } ATM_TD_BW_SCR_01 { altbw_scr_01 <24> } ATM_TD_FW_MBS_0 { altfw_mbs_0 <24> } ATM_TD_BW_MBS_0 { altbw_mbs_0 <24> } ATM_TD_FW_MBS_01 { altfw_mbs_01 <24> } ATM_TD_BW_MBS_01 { altbw_mbs_01 <24> } ATM_TD_BEST_EFFORT { altbest_effort <0> } ++ } ++ } ++} ++ ++ ++def ie_min_td = { ++ _ext <1@8,more> = 1 _cs "q2931_cs" <2@6,more> = Q2931_CS_NET _flag "atm_flag" <1@5,more> = ATM_FLAG_NO _action_ind "atm_ai_ie" <3@1> = 0 _ie_len <16> = recover RECOV_IND_IE length { # @@@ UNI 4.0 does not specify the coding ++ _id "atm_td" <8> = multi { ++ ATM_TD_FW_PCR_0 { minfw_pcr_0 <24> } ATM_TD_BW_PCR_0 { minbw_pcr_0 <24> } ATM_TD_FW_PCR_01 { minfw_pcr_01 <24> } ATM_TD_BW_PCR_01 { minbw_pcr_01 <24> } ++ ATM_TD_FW_MCR_01 { minfw_mcr_01 <24> } ATM_TD_BW_MCR_01 { minbw_mcr_01 <24> } ++ } ++ } ++} ++ ++ ++def ie_eqos = { ++ _ext <1@8,more> = 1 _cs "q2931_cs" <2@6,more> = Q2931_CS_NET _flag "atm_flag" <1@5,more> = ATM_FLAG_NO _action_ind "atm_ai_ie" <3@1> = 0 _ie_len <16> = recover RECOV_IND_IE length { ++ eqos_origin "atm_eqo" <8> ++ _id "atm_eqp" <8> = multi { ++ ATM_EQP_ACC_FW_CDV { ++ acc_fw_cdv <24> ++ } ++ ATM_EQP_ACC_BW_CDV { ++ acc_bw_cdv <24> ++ } ++ ATM_EQP_CUM_FW_CDV { ++ cum_fw_cdv <24> ++ } ++ ATM_EQP_CUM_BW_CDV { ++ cum_bw_cdv <24> ++ } ++ ATM_EQP_ACC_FW_CLR { ++ acc_fw_clr <8> ++ } ++ ATM_EQP_ACC_BW_CLR { ++ acc_bw_clr <8> ++ } ++ } ++ } ++} ++ ++ ++def ie_abr_add_prm = { ++ _ext <1@8,more> = 1 _cs "q2931_cs" <2@6,more> = Q2931_CS_NET _flag "atm_flag" <1@5,more> = ATM_FLAG_NO _action_ind "atm_ai_ie" <3@1> = 0 _ie_len <16> = recover RECOV_IND_IE length { ++ _id "atm_aap" <8> = multi { ++ ATM_AAP_FW_REC { ++ abr_fw_add_rec <32> ++ } ++ ATM_AAP_BW_REC { ++ abr_bw_add_rec <32> ++ } ++ } ++ } ++} ++ ++ ++def ie_abr_set_prm = { ++ _ext <1@8,more> = 1 _cs "q2931_cs" <2@6,more> = Q2931_CS_NET _flag "atm_flag" <1@5,more> = ATM_FLAG_NO _action_ind "atm_ai_ie" <3@1> = 0 _ie_len <16> = recover RECOV_IND_IE length { # @@@ UNI 4.0 does not specify the coding ++ _id "atm_asp" <8> = multi { ++ ATM_ASP_FW_ICR { ++ abr_fw_icr <24> ++ } ++ ATM_ASP_BW_ICR { ++ abr_bw_icr <24> ++ } ++ ATM_ASP_FW_TBE { ++ abr_fw_tbe <24> ++ } ++ ATM_ASP_BW_TBE { ++ abr_bw_tbe <24> ++ } ++ ATM_ASP_CRF_RTT { ++ atm_crf_rtt <24> ++ } ++ ATM_ASP_FW_RIF { ++ atm_fw_rif <8> ++ } ++ ATM_ASP_BW_RIF { ++ atm_bw_rif <8> ++ } ++ ATM_ASP_FW_RDF { ++ atm_fw_rdf <8> ++ } ++ ATM_ASP_BW_RDF { ++ atm_bw_rdf <8> ++ } ++ } ++ } ++} ++ ++ ++ ++ ++def ie_ep_ref = { ++ _ext <1@8,more> = 1 _cs "q2931_cs" <2@6,more> = Q2931_CS_ITU _flag "atm_flag" <1@5,more> = ATM_FLAG_NO _action_ind "atm_ai_ie" <3@1> = 0 _ie_len <16> = recover RECOV_IND_IE length { ++ _ep_type <8> = 0 ++ ep_ref <16> ++ } ++} ++ ++ ++def ie_ep_state = { ++ _ext <1@8,more> = 1 _cs "q2931_cs" <2@6,more> = Q2931_CS_ITU _flag "atm_flag" <1@5,more> = ATM_FLAG_NO _action_ind "atm_ai_ie" <3@1> = 0 _ie_len <16> = recover RECOV_IND_IE length { ++ ep_state <6@1> ++ } ++} ++ ++ ++ ++ ++def ie_bbrt = { ++ _ext <1@8,more> = 1 _cs "q2931_cs" <2@6,more> = Q2931_CS_ITU _flag "atm_flag" <1@5,more> = ATM_FLAG_NO _action_ind "atm_ai_ie" <3@1> = 0 _ie_len <16> = recover RECOV_IND_IE length { ++ type_of_report "atm_tor" <8> ++ } ++} ++ ++ ++ ++ ++{ ++ _pdsc "q2931_proto" <8> = Q2931_PROTO_DSC ++ _cr_len <8> = 3 ++ call_ref <24> ++ msg_type "atm_msg" <8> ++ _ext <1@8,more> = 1 ++ _flag "atm_flag" <1@5,more> = ATM_FLAG_NO ++ _action_ind "atm_ai_msg" <2@1> = 0 ++ msg_len <16> = length { ++ _ie_id "atm_ie" <8> = multi { ++ aal: ATM_IE_AAL ie_aal ++ td: ATM_IE_TD ie_td ++ bbcap: ATM_IE_BBCAP ie_bbcap ++ bhli: ATM_IE_BHLI ie_bhli ++ blli1: ATM_IE_BLLI ie_blli ++ blli2: ATM_IE_BLLI ie_blli ++ blli3: ATM_IE_BLLI ie_blli ++ call_state: ATM_IE_CALL_STATE ie_call_state ++ cdpn: ATM_IE_CDPN ie_cdpn ++ cdps: ATM_IE_CDPS ie_cdps ++ cgpn: ATM_IE_CGPN ie_cgpn ++ cgps: ATM_IE_CGPS ie_cgps ++ cause: ATM_IE_CAUSE ie_cause ++ cause2: ATM_IE_CAUSE ie_cause ++ conn_id: ATM_IE_CONN_ID ie_conn_id ++ ++ e2e_tdl: ATM_IE_E2E_TDL ie_e2e_tdl ++ ++ qos: ATM_IE_QOS ie_qos ++ bbrep: ATM_IE_BBREP ie_bbrep ++ restart: ATM_IE_RESTART ie_restart ++ bbs_comp: ATM_IE_BBS_COMP ie_bbs_comp ++ tns: ATM_IE_TNS ie_tns ++ ++ notify: ATM_IE_NOTIFY ie_notify ++ oam_td: ATM_IE_OAM_TD ie_oam_td ++ git: ATM_IE_GIT ie_git ++ git2: ATM_IE_GIT ie_git ++ git3: ATM_IE_GIT ie_git ++ lij_id: ATM_IE_LIJ_ID ie_lij_id ++ lij_prm: ATM_IE_LIJ_PRM ie_lij_prm ++ leaf_sn: ATM_IE_LEAF_SN ie_leaf_sn ++ scope_sel: ATM_IE_SCOPE_SEL ie_scope_sel ++ alt_td: ATM_IE_ALT_TD ie_alt_td ++ min_td: ATM_IE_MIN_TD ie_min_td ++ eqos: ATM_IE_EQOS ie_eqos ++ abr_add_prm:ATM_IE_ABR_ADD_PRM ie_abr_add_prm ++ abr_set_prm:ATM_IE_ABR_SET_PRM ie_abr_set_prm ++ ++ ep_ref: ATM_IE_EPR ie_ep_ref ++ ep_state: ATM_IE_EP_STATE ie_ep_state ++ ++ bbrt: ATM_IE_BBRT ie_bbrt ++ ++ default 0 { ++ _ext <1@8,more> = 1 __cs "q2931_cs" <2@6,more> = 0 _flag "atm_flag" <1@5,more> = ATM_FLAG_NO _action_ind "atm_ai_ie" <3@1> = 0 _ie_len <16> = recover RECOV_IND_IE length ++ abort RECOV_ASE_UNKNOWN_IE ++ } ++ } ++ } ++} +--- linux-atm-2.4.1.orig/src/saal/Makefile.in ++++ linux-atm-2.4.1/src/saal/Makefile.in +@@ -1,4 +1,4 @@ +-# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am ++# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am + + # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation +@@ -87,8 +87,7 @@ + + noinst_LIBRARIES = libsaal.a + +-libsaal_a_SOURCES = pdu.h queue.h saal.h sscf.h sscop.h pdu.c queue.c saal.c \ +- sscf.c sscop.c ++libsaal_a_SOURCES = pdu.h queue.h saal.h sscf.h sscop.h pdu.c queue.c saal.c sscf.c sscop.c + + mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs + CONFIG_HEADER = ../../config.h +@@ -114,8 +113,10 @@ + + DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +-TAR = gtar ++TAR = tar + GZIP_ENV = --best ++DEP_FILES = .deps/pdu.P .deps/queue.P .deps/saal.P .deps/sscf.P \ ++.deps/sscop.P + SOURCES = $(libsaal_a_SOURCES) + OBJECTS = $(libsaal_a_OBJECTS) + +@@ -123,9 +124,9 @@ + .SUFFIXES: + .SUFFIXES: .S .c .lo .o .obj .s + $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +- cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps src/saal/Makefile ++ cd $(top_srcdir) && $(AUTOMAKE) --gnu src/saal/Makefile + +-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +@@ -139,9 +140,6 @@ + + maintainer-clean-noinstLIBRARIES: + +-.c.o: +- $(COMPILE) -c $< +- + # FIXME: We should only use cygpath when building on Windows, + # and only if it is available. + .c.obj: +@@ -164,9 +162,6 @@ + + maintainer-clean-compile: + +-.c.lo: +- $(LIBTOOL) --mode=compile $(COMPILE) -c $< +- + .s.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +@@ -206,7 +201,7 @@ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ +- || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) ++ || (cd $(srcdir) && etags -o $$here/TAGS $(ETAGS_ARGS) $$tags $$unique $(LISP)) + + mostlyclean-tags: + +@@ -222,6 +217,11 @@ + subdir = src/saal + + distdir: $(DISTFILES) ++ here=`cd $(top_builddir) && pwd`; \ ++ top_distdir=`cd $(top_distdir) && pwd`; \ ++ distdir=`cd $(distdir) && pwd`; \ ++ cd $(top_srcdir) \ ++ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu src/saal/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ +@@ -232,20 +232,38 @@ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done +-pdu.o: pdu.c ../../config.h ../../src/include/stdint.h pdu.h \ +- ../../src/include/atmd.h ../../src/include/atm.h +-queue.o: queue.c ../../config.h ../../src/include/atmd.h \ +- ../../src/include/stdint.h ../../src/include/atm.h queue.h +-saal.o: saal.c ../../config.h sscop.h ../../src/include/stdint.h \ +- ../../src/include/atmd.h ../../src/include/atm.h queue.h saal.h \ +- sscf.h +-sscf.o: sscf.c ../../config.h ../../src/include/atmd.h \ +- ../../src/include/stdint.h ../../src/include/atm.h sscop.h \ +- queue.h sscf.h +-sscop.o: sscop.c ../../config.h ../../src/include/stdint.h \ +- ../../src/include/atmd.h ../../src/include/atm.h sscop.h \ +- queue.h pdu.h + ++DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) ++ ++-include $(DEP_FILES) ++ ++mostlyclean-depend: ++ ++clean-depend: ++ ++distclean-depend: ++ -rm -rf .deps ++ ++maintainer-clean-depend: ++ ++%.o: %.c ++ @echo '$(COMPILE) -c $<'; \ ++ $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< ++ @-cp .deps/$(*F).pp .deps/$(*F).P; \ ++ tr ' ' '\012' < .deps/$(*F).pp \ ++ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ ++ >> .deps/$(*F).P; \ ++ rm .deps/$(*F).pp ++ ++%.lo: %.c ++ @echo '$(LTCOMPILE) -c $<'; \ ++ $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< ++ @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ ++ < .deps/$(*F).pp > .deps/$(*F).P; \ ++ tr ' ' '\012' < .deps/$(*F).pp \ ++ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ ++ >> .deps/$(*F).P; \ ++ rm -f .deps/$(*F).pp + info-am: + info: info-am + dvi-am: +@@ -282,27 +300,27 @@ + + maintainer-clean-generic: + mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \ +- mostlyclean-libtool mostlyclean-tags \ ++ mostlyclean-libtool mostlyclean-tags mostlyclean-depend \ + mostlyclean-generic + + mostlyclean: mostlyclean-am + + clean-am: clean-noinstLIBRARIES clean-compile clean-libtool clean-tags \ +- clean-generic mostlyclean-am ++ clean-depend clean-generic mostlyclean-am + + clean: clean-am + + distclean-am: distclean-noinstLIBRARIES distclean-compile \ +- distclean-libtool distclean-tags distclean-generic \ +- clean-am ++ distclean-libtool distclean-tags distclean-depend \ ++ distclean-generic clean-am + -rm -f libtool + + distclean: distclean-am + + maintainer-clean-am: maintainer-clean-noinstLIBRARIES \ + maintainer-clean-compile maintainer-clean-libtool \ +- maintainer-clean-tags maintainer-clean-generic \ +- distclean-am ++ maintainer-clean-tags maintainer-clean-depend \ ++ maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +@@ -313,12 +331,14 @@ + mostlyclean-compile distclean-compile clean-compile \ + maintainer-clean-compile mostlyclean-libtool distclean-libtool \ + clean-libtool maintainer-clean-libtool tags mostlyclean-tags \ +-distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ +-dvi-am dvi check check-am installcheck-am installcheck install-exec-am \ +-install-exec install-data-am install-data install-am install \ +-uninstall-am uninstall all-redirect all-am all installdirs \ +-mostlyclean-generic distclean-generic clean-generic \ +-maintainer-clean-generic clean mostlyclean distclean maintainer-clean ++distclean-tags clean-tags maintainer-clean-tags distdir \ ++mostlyclean-depend distclean-depend clean-depend \ ++maintainer-clean-depend info-am info dvi-am dvi check check-am \ ++installcheck-am installcheck install-exec-am install-exec \ ++install-data-am install-data install-am install uninstall-am uninstall \ ++all-redirect all-am all installdirs mostlyclean-generic \ ++distclean-generic clean-generic maintainer-clean-generic clean \ ++mostlyclean distclean maintainer-clean + + + # Tell versions [3.59,3.63) of GNU make to not export all variables. +--- linux-atm-2.4.1.orig/src/sigd/Makefile.in ++++ linux-atm-2.4.1/src/sigd/Makefile.in +@@ -1,4 +1,4 @@ +-# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am ++# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am + + # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation +@@ -88,14 +88,9 @@ + INCLUDES = -I$(top_builddir)/src/qgen -I$(top_builddir)/src/saal -I. + + sbin_PROGRAMS = atmsigd +-atmsigd_SOURCES = atmsigd.c io.c io.h kernel.c proto.c proto.h uni.c \ +- sap.c sap.h timeout.c timeout.h trace.c trace.h \ +- policy.c policy.h cfg_y.y cfg_l.l +- +-atmsigd_XTRAS = mess.o $(top_builddir)/src/qgen/q.out.o \ +- $(top_builddir)/src/qgen/qd.dump.o \ +- $(top_builddir)/src/lib/libatm.la \ +- $(top_builddir)/src/saal/libsaal.a ++atmsigd_SOURCES = atmsigd.c io.c io.h kernel.c proto.c proto.h uni.c sap.c sap.h timeout.c timeout.h trace.c trace.h policy.c policy.h cfg_y.y cfg_l.l ++ ++atmsigd_XTRAS = mess.o $(top_builddir)/src/qgen/q.out.o $(top_builddir)/src/qgen/qd.dump.o $(top_builddir)/src/lib/libatm.la $(top_builddir)/src/saal/libsaal.a + + atmsigd_LDADD = $(atmsigd_XTRAS) -lfl + atmsigd_DEPENDENCIES = mess.c $(atmsigd_XTRAS) +@@ -140,8 +135,11 @@ + + DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +-TAR = gtar ++TAR = tar + GZIP_ENV = --best ++DEP_FILES = .deps/atmsigd.P .deps/cfg_l.P .deps/cfg_y.P .deps/io.P \ ++.deps/kernel.P .deps/policy.P .deps/proto.P .deps/sap.P .deps/timeout.P \ ++.deps/trace.P .deps/uni.P + SOURCES = $(atmsigd_SOURCES) + OBJECTS = $(atmsigd_OBJECTS) + +@@ -149,9 +147,9 @@ + .SUFFIXES: + .SUFFIXES: .S .c .l .lo .o .obj .s .y + $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +- cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps src/sigd/Makefile ++ cd $(top_srcdir) && $(AUTOMAKE) --gnu src/sigd/Makefile + +-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +@@ -181,9 +179,6 @@ + rm -f $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + done + +-.c.o: +- $(COMPILE) -c $< +- + # FIXME: We should only use cygpath when building on Windows, + # and only if it is available. + .c.obj: +@@ -206,9 +201,6 @@ + + maintainer-clean-compile: + +-.c.lo: +- $(LIBTOOL) --mode=compile $(COMPILE) -c $< +- + .s.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +@@ -347,7 +339,7 @@ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ +- || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) ++ || (cd $(srcdir) && etags -o $$here/TAGS $(ETAGS_ARGS) $$tags $$unique $(LISP)) + + mostlyclean-tags: + +@@ -363,6 +355,11 @@ + subdir = src/sigd + + distdir: $(DISTFILES) ++ here=`cd $(top_builddir) && pwd`; \ ++ top_distdir=`cd $(top_distdir) && pwd`; \ ++ distdir=`cd $(distdir) && pwd`; \ ++ cd $(top_srcdir) \ ++ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu src/sigd/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ +@@ -373,69 +370,38 @@ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done +-atmsigd.o: atmsigd.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h ../../src/include/atmd.h \ +- ../../src/qgen/qlib.h io.h proto.h ../../src/include/atmsap.h \ +- ../../src/saal/saal.h ../../src/saal/sscf.h \ +- ../../src/saal/sscop.h ../../src/saal/queue.h trace.h +-cfg_l.o: cfg_l.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h cfg_y.h +-cfg_y.o: cfg_y.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h ../../src/include/atmd.h proto.h \ +- ../../src/include/atmsap.h ../../src/saal/saal.h \ +- ../../src/saal/sscf.h ../../src/saal/sscop.h \ +- ../../src/saal/queue.h io.h trace.h policy.h +-io.o: io.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h ../../src/include/atmd.h \ +- ../../src/qgen/uni.h ../../src/saal/pdu.h proto.h \ +- ../../src/include/atmsap.h ../../src/saal/saal.h \ +- ../../src/saal/sscf.h ../../src/saal/sscop.h \ +- ../../src/saal/queue.h io.h trace.h +-kernel.o: kernel.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h ../../src/include/atmd.h \ +- ../../src/qgen/uni.h ../../src/qgen/qlib.h \ +- ../../src/qgen/q.out.h proto.h ../../src/include/atmsap.h \ +- ../../src/saal/saal.h ../../src/saal/sscf.h \ +- ../../src/saal/sscop.h ../../src/saal/queue.h sap.h io.h \ +- policy.h timeout.h +-mess.o: mess.c ../../config.h +-policy.o: policy.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h ../../src/include/atmd.h proto.h \ +- ../../src/include/atmsap.h ../../src/saal/saal.h \ +- ../../src/saal/sscf.h ../../src/saal/sscop.h \ +- ../../src/saal/queue.h policy.h +-proto.o: proto.c ../../config.h ../../src/include/atmd.h \ +- ../../src/include/stdint.h ../../src/include/atm.h \ +- ../../src/qgen/uni.h ../../src/qgen/qlib.h \ +- ../../src/qgen/q.out.h io.h proto.h ../../src/include/atmsap.h \ +- ../../src/saal/saal.h ../../src/saal/sscf.h \ +- ../../src/saal/sscop.h ../../src/saal/queue.h sap.h +-sap.o: sap.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h ../../src/include/atmd.h \ +- ../../src/qgen/uni.h ../../src/qgen/qlib.h \ +- ../../src/qgen/q.out.h ../../src/qgen/common.h proto.h \ +- ../../src/include/atmsap.h ../../src/saal/saal.h \ +- ../../src/saal/sscf.h ../../src/saal/sscop.h \ +- ../../src/saal/queue.h sap.h +-timeout.o: timeout.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h ../../src/include/atmd.h \ +- ../../src/qgen/uni.h proto.h ../../src/include/atmsap.h \ +- ../../src/saal/saal.h ../../src/saal/sscf.h \ +- ../../src/saal/sscop.h ../../src/saal/queue.h timeout.h +-trace.o: trace.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h ../../src/include/atmd.h \ +- ../../src/include/atmsap.h trace.h proto.h \ +- ../../src/saal/saal.h ../../src/saal/sscf.h \ +- ../../src/saal/sscop.h ../../src/saal/queue.h \ +- ../../src/qgen/qlib.h +-uni.o: uni.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h ../../src/include/atmd.h \ +- ../../src/qgen/uni.h ../../src/qgen/qlib.h \ +- ../../src/qgen/q.out.h proto.h ../../src/include/atmsap.h \ +- ../../src/saal/saal.h ../../src/saal/sscf.h \ +- ../../src/saal/sscop.h ../../src/saal/queue.h sap.h io.h \ +- policy.h timeout.h trace.h + ++DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) ++ ++-include $(DEP_FILES) ++ ++mostlyclean-depend: ++ ++clean-depend: ++ ++distclean-depend: ++ -rm -rf .deps ++ ++maintainer-clean-depend: ++ ++%.o: %.c ++ @echo '$(COMPILE) -c $<'; \ ++ $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< ++ @-cp .deps/$(*F).pp .deps/$(*F).P; \ ++ tr ' ' '\012' < .deps/$(*F).pp \ ++ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ ++ >> .deps/$(*F).P; \ ++ rm .deps/$(*F).pp ++ ++%.lo: %.c ++ @echo '$(LTCOMPILE) -c $<'; \ ++ $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< ++ @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ ++ < .deps/$(*F).pp > .deps/$(*F).P; \ ++ tr ' ' '\012' < .deps/$(*F).pp \ ++ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ ++ >> .deps/$(*F).P; \ ++ rm -f .deps/$(*F).pp + info-am: + info: info-am + dvi-am: +@@ -474,29 +440,29 @@ + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + + maintainer-clean-generic: +- -test -z "cfg_llcfg_yhcfg_yc" || rm -f cfg_ll cfg_yh cfg_yc ++ -test -z "cfg_lccfg_yhcfg_yc" || rm -f cfg_lc cfg_yh cfg_yc + mostlyclean-am: mostlyclean-sbinPROGRAMS mostlyclean-compile \ +- mostlyclean-libtool mostlyclean-tags \ ++ mostlyclean-libtool mostlyclean-tags mostlyclean-depend \ + mostlyclean-generic + + mostlyclean: mostlyclean-am + + clean-am: clean-sbinPROGRAMS clean-compile clean-libtool clean-tags \ +- clean-generic mostlyclean-am ++ clean-depend clean-generic mostlyclean-am + + clean: clean-am + + distclean-am: distclean-sbinPROGRAMS distclean-compile \ +- distclean-libtool distclean-tags distclean-generic \ +- clean-am ++ distclean-libtool distclean-tags distclean-depend \ ++ distclean-generic clean-am + -rm -f libtool + + distclean: distclean-am + + maintainer-clean-am: maintainer-clean-sbinPROGRAMS \ + maintainer-clean-compile maintainer-clean-libtool \ +- maintainer-clean-tags maintainer-clean-generic \ +- distclean-am ++ maintainer-clean-tags maintainer-clean-depend \ ++ maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +@@ -509,12 +475,14 @@ + distclean-libtool clean-libtool maintainer-clean-libtool install-man4 \ + uninstall-man4 install-man8 uninstall-man8 install-man uninstall-man \ + uninstall-sysconfDATA install-sysconfDATA tags mostlyclean-tags \ +-distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ +-dvi-am dvi check check-am installcheck-am installcheck install-exec-am \ +-install-exec install-data-am install-data install-am install \ +-uninstall-am uninstall all-redirect all-am all installdirs \ +-mostlyclean-generic distclean-generic clean-generic \ +-maintainer-clean-generic clean mostlyclean distclean maintainer-clean ++distclean-tags clean-tags maintainer-clean-tags distdir \ ++mostlyclean-depend distclean-depend clean-depend \ ++maintainer-clean-depend info-am info dvi-am dvi check check-am \ ++installcheck-am installcheck install-exec-am install-exec \ ++install-data-am install-data install-am install uninstall-am uninstall \ ++all-redirect all-am all installdirs mostlyclean-generic \ ++distclean-generic clean-generic maintainer-clean-generic clean \ ++mostlyclean distclean maintainer-clean + + + mess.c: $(top_builddir)/src/qgen/uni.h mkmess.pl +--- linux-atm-2.4.1.orig/src/sigd/cfg_y.c ++++ linux-atm-2.4.1/src/sigd/cfg_y.c +@@ -1,46 +1,137 @@ ++/* A Bison parser, made by GNU Bison 1.875d. */ + +-/* A Bison parser, made from cfg_y.y +- by GNU Bison version 1.28 */ ++/* Skeleton parser for Yacc-like parsing with Bison, ++ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + +-#define YYBISON 1 /* Identify Bison output. */ ++ 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 ++ the Free Software Foundation; either version 2, or (at your option) ++ any later version. + +-#define TOK_LEVEL 257 +-#define TOK_DEBUG 258 +-#define TOK_INFO 259 +-#define TOK_WARN 260 +-#define TOK_ERROR 261 +-#define TOK_FATAL 262 +-#define TOK_SIG 263 +-#define TOK_UNI30 264 +-#define TOK_UNI31 265 +-#define TOK_UNI40 266 +-#define TOK_Q2963_1 267 +-#define TOK_SAAL 268 +-#define TOK_VC 269 +-#define TOK_IO 270 +-#define TOK_MODE 271 +-#define TOK_USER 272 +-#define TOK_NET 273 +-#define TOK_SWITCH 274 +-#define TOK_VPCI 275 +-#define TOK_ITF 276 +-#define TOK_PCR 277 +-#define TOK_TRACE 278 +-#define TOK_POLICY 279 +-#define TOK_ALLOW 280 +-#define TOK_REJECT 281 +-#define TOK_ENTITY 282 +-#define TOK_DEFAULT 283 +-#define TOK_NUMBER 284 +-#define TOK_MAX_RATE 285 +-#define TOK_DUMP_DIR 286 +-#define TOK_LOGFILE 287 +-#define TOK_QOS 288 +-#define TOK_FROM 289 +-#define TOK_TO 290 +-#define TOK_ROUTE 291 +-#define TOK_PVC 292 ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. + ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software ++ Foundation, Inc., 59 Temple Place - Suite 330, ++ Boston, MA 02111-1307, USA. */ ++ ++/* As a special exception, when this file is copied by Bison into a ++ Bison output file, you may use that output file without restriction. ++ This special exception was added by the Free Software Foundation ++ in version 1.24 of Bison. */ ++ ++/* Written by Richard Stallman by simplifying the original so called ++ ``semantic'' parser. */ ++ ++/* All symbols defined below should begin with yy or YY, to avoid ++ infringing on user name space. This should be done even for local ++ variables, as they might otherwise be expanded by user macros. ++ There are some unavoidable exceptions within include files to ++ define necessary library symbols; they are noted "INFRINGES ON ++ USER NAME SPACE" below. */ ++ ++/* Identify Bison output. */ ++#define YYBISON 1 ++ ++/* Skeleton name. */ ++#define YYSKELETON_NAME "yacc.c" ++ ++/* Pure parsers. */ ++#define YYPURE 0 ++ ++/* Using locations. */ ++#define YYLSP_NEEDED 0 ++ ++ ++ ++/* Tokens. */ ++#ifndef YYTOKENTYPE ++# define YYTOKENTYPE ++ /* Put the tokens into the symbol table, so that GDB and other debuggers ++ know about them. */ ++ enum yytokentype { ++ TOK_LEVEL = 258, ++ TOK_DEBUG = 259, ++ TOK_INFO = 260, ++ TOK_WARN = 261, ++ TOK_ERROR = 262, ++ TOK_FATAL = 263, ++ TOK_SIG = 264, ++ TOK_UNI30 = 265, ++ TOK_UNI31 = 266, ++ TOK_UNI40 = 267, ++ TOK_Q2963_1 = 268, ++ TOK_SAAL = 269, ++ TOK_VC = 270, ++ TOK_IO = 271, ++ TOK_MODE = 272, ++ TOK_USER = 273, ++ TOK_NET = 274, ++ TOK_SWITCH = 275, ++ TOK_VPCI = 276, ++ TOK_ITF = 277, ++ TOK_PCR = 278, ++ TOK_TRACE = 279, ++ TOK_POLICY = 280, ++ TOK_ALLOW = 281, ++ TOK_REJECT = 282, ++ TOK_ENTITY = 283, ++ TOK_DEFAULT = 284, ++ TOK_NUMBER = 285, ++ TOK_MAX_RATE = 286, ++ TOK_DUMP_DIR = 287, ++ TOK_LOGFILE = 288, ++ TOK_QOS = 289, ++ TOK_FROM = 290, ++ TOK_TO = 291, ++ TOK_ROUTE = 292, ++ TOK_PVC = 293 ++ }; ++#endif ++#define TOK_LEVEL 258 ++#define TOK_DEBUG 259 ++#define TOK_INFO 260 ++#define TOK_WARN 261 ++#define TOK_ERROR 262 ++#define TOK_FATAL 263 ++#define TOK_SIG 264 ++#define TOK_UNI30 265 ++#define TOK_UNI31 266 ++#define TOK_UNI40 267 ++#define TOK_Q2963_1 268 ++#define TOK_SAAL 269 ++#define TOK_VC 270 ++#define TOK_IO 271 ++#define TOK_MODE 272 ++#define TOK_USER 273 ++#define TOK_NET 274 ++#define TOK_SWITCH 275 ++#define TOK_VPCI 276 ++#define TOK_ITF 277 ++#define TOK_PCR 278 ++#define TOK_TRACE 279 ++#define TOK_POLICY 280 ++#define TOK_ALLOW 281 ++#define TOK_REJECT 282 ++#define TOK_ENTITY 283 ++#define TOK_DEFAULT 284 ++#define TOK_NUMBER 285 ++#define TOK_MAX_RATE 286 ++#define TOK_DUMP_DIR 287 ++#define TOK_LOGFILE 288 ++#define TOK_QOS 289 ++#define TOK_FROM 290 ++#define TOK_TO 291 ++#define TOK_ROUTE 292 ++#define TOK_PVC 293 ++ ++ ++ ++ ++/* Copy the first part of user declarations. */ + #line 1 "cfg_y.y" + + /* cfg.y - configuration language */ +@@ -51,6 +142,7 @@ + #include <config.h> + #endif + ++#include <stdlib.h> + #include <string.h> + #include <ctype.h> + #include <limits.h> +@@ -63,6 +155,8 @@ + #include "trace.h" + #include "policy.h" + ++extern void yywarn(const char *s); ++extern void yyerror(const char *s); + + static RULE *rule; + static SIG_ENTITY *curr_sig = &_entity; +@@ -93,516 +187,830 @@ + } + + +-#line 53 "cfg_y.y" +-typedef union { ++ ++/* Enabling traces. */ ++#ifndef YYDEBUG ++# define YYDEBUG 0 ++#endif ++ ++/* Enabling verbose error messages. */ ++#ifdef YYERROR_VERBOSE ++# undef YYERROR_VERBOSE ++# define YYERROR_VERBOSE 1 ++#else ++# define YYERROR_VERBOSE 0 ++#endif ++ ++#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) ++#line 56 "cfg_y.y" ++typedef union YYSTYPE { + int num; + char *str; + struct sockaddr_atmpvc pvc; + } YYSTYPE; +-#include <stdio.h> ++/* Line 191 of yacc.c. */ ++#line 213 "y.tab.c" ++# define yystype YYSTYPE /* obsolescent; will be withdrawn */ ++# define YYSTYPE_IS_DECLARED 1 ++# define YYSTYPE_IS_TRIVIAL 1 ++#endif ++ ++ ++ ++/* Copy the second part of user declarations. */ ++ ++ ++/* Line 214 of yacc.c. */ ++#line 225 "y.tab.c" ++ ++#if ! defined (yyoverflow) || YYERROR_VERBOSE ++ ++# ifndef YYFREE ++# define YYFREE free ++# endif ++# ifndef YYMALLOC ++# define YYMALLOC malloc ++# endif ++ ++/* The parser invokes alloca or malloc; define the necessary symbols. */ ++ ++# ifdef YYSTACK_USE_ALLOCA ++# if YYSTACK_USE_ALLOCA ++# define YYSTACK_ALLOC alloca ++# endif ++# else ++# if defined (alloca) || defined (_ALLOCA_H) ++# define YYSTACK_ALLOC alloca ++# else ++# ifdef __GNUC__ ++# define YYSTACK_ALLOC __builtin_alloca ++# endif ++# endif ++# endif ++ ++# ifdef YYSTACK_ALLOC ++ /* Pacify GCC's `empty if-body' warning. */ ++# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) ++# else ++# if defined (__STDC__) || defined (__cplusplus) ++# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ ++# define YYSIZE_T size_t ++# endif ++# define YYSTACK_ALLOC YYMALLOC ++# define YYSTACK_FREE YYFREE ++# endif ++#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ ++ ++ ++#if (! defined (yyoverflow) \ ++ && (! defined (__cplusplus) \ ++ || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) ++ ++/* A type that is properly aligned for any stack member. */ ++union yyalloc ++{ ++ short int yyss; ++ YYSTYPE yyvs; ++ }; ++ ++/* The size of the maximum gap between one aligned stack and the next. */ ++# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) ++ ++/* The size of an array large to enough to hold all stacks, each with ++ N elements. */ ++# define YYSTACK_BYTES(N) \ ++ ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ ++ + YYSTACK_GAP_MAXIMUM) ++ ++/* Copy COUNT objects from FROM to TO. The source and destination do ++ not overlap. */ ++# ifndef YYCOPY ++# if defined (__GNUC__) && 1 < __GNUC__ ++# define YYCOPY(To, From, Count) \ ++ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) ++# else ++# define YYCOPY(To, From, Count) \ ++ do \ ++ { \ ++ register YYSIZE_T yyi; \ ++ for (yyi = 0; yyi < (Count); yyi++) \ ++ (To)[yyi] = (From)[yyi]; \ ++ } \ ++ while (0) ++# endif ++# endif ++ ++/* Relocate STACK from its old location to the new one. The ++ local variables YYSIZE and YYSTACKSIZE give the old and new number of ++ elements in the stack, and YYPTR gives the new location of the ++ stack. Advance YYPTR to a properly aligned location for the next ++ stack. */ ++# define YYSTACK_RELOCATE(Stack) \ ++ do \ ++ { \ ++ YYSIZE_T yynewbytes; \ ++ YYCOPY (&yyptr->Stack, Stack, yysize); \ ++ Stack = &yyptr->Stack; \ ++ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ ++ yyptr += yynewbytes / sizeof (*yyptr); \ ++ } \ ++ while (0) + +-#ifndef __cplusplus +-#ifndef __STDC__ +-#define const +-#endif + #endif + ++#if defined (__STDC__) || defined (__cplusplus) ++ typedef signed char yysigned_char; ++#else ++ typedef short int yysigned_char; ++#endif + +- +-#define YYFINAL 117 +-#define YYFLAG -32768 +-#define YYNTBASE 41 +- +-#define YYTRANSLATE(x) ((unsigned)(x) <= 292 ? yytranslate[x] : 71) +- +-static const char yytranslate[] = { 0, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 39, 2, 40, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, +- 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, +- 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, +- 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, +- 37, 38 ++/* YYFINAL -- State number of the termination state. */ ++#define YYFINAL 53 ++/* YYLAST -- Last index in YYTABLE. */ ++#define YYLAST 108 ++ ++/* YYNTOKENS -- Number of terminals. */ ++#define YYNTOKENS 41 ++/* YYNNTS -- Number of nonterminals. */ ++#define YYNNTS 31 ++/* YYNRULES -- Number of rules. */ ++#define YYNRULES 79 ++/* YYNRULES -- Number of states. */ ++#define YYNSTATES 117 ++ ++/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ ++#define YYUNDEFTOK 2 ++#define YYMAXUTOK 293 ++ ++#define YYTRANSLATE(YYX) \ ++ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) ++ ++/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ ++static const unsigned char yytranslate[] = ++{ ++ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 39, 2, 40, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, ++ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ++ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, ++ 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, ++ 35, 36, 37, 38 + }; + +-#if YYDEBUG != 0 +-static const short yyprhs[] = { 0, +- 0, 3, 4, 7, 8, 11, 14, 17, 20, 23, +- 26, 29, 30, 35, 36, 40, 41, 44, 49, 52, +- 54, 56, 58, 60, 62, 66, 67, 70, 72, 76, +- 77, 80, 82, 86, 87, 90, 92, 96, 97, 100, +- 102, 106, 107, 110, 113, 118, 120, 122, 124, 126, +- 128, 131, 134, 137, 140, 143, 145, 147, 150, 152, +- 154, 157, 158, 160, 162, 164, 166, 168, 170, 172, +- 174, 176, 179, 180, 184, 186, 188, 190 ++#if YYDEBUG ++/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in ++ YYRHS. */ ++static const unsigned char yyprhs[] = ++{ ++ 0, 0, 3, 6, 7, 10, 11, 14, 17, 20, ++ 23, 26, 29, 32, 33, 38, 39, 43, 44, 47, ++ 52, 55, 57, 59, 61, 63, 65, 69, 70, 73, ++ 75, 79, 80, 83, 85, 89, 90, 93, 95, 99, ++ 100, 103, 105, 109, 110, 113, 116, 121, 123, 125, ++ 127, 129, 131, 134, 137, 140, 143, 146, 148, 150, ++ 153, 155, 157, 160, 161, 163, 165, 167, 169, 171, ++ 173, 175, 177, 179, 182, 183, 187, 189, 191, 193 + }; + +-static const short yyrhs[] = { 42, +- 43, 0, 0, 44, 42, 0, 0, 45, 43, 0, +- 3, 65, 0, 9, 50, 0, 14, 52, 0, 16, +- 54, 0, 4, 56, 0, 25, 58, 0, 0, 28, +- 38, 46, 47, 0, 0, 39, 48, 40, 0, 0, +- 49, 48, 0, 21, 30, 22, 30, 0, 17, 66, +- 0, 34, 0, 31, 0, 37, 0, 29, 0, 60, +- 0, 39, 51, 40, 0, 0, 60, 51, 0, 61, +- 0, 39, 53, 40, 0, 0, 61, 53, 0, 62, +- 0, 39, 55, 40, 0, 0, 62, 55, 0, 63, +- 0, 39, 57, 40, 0, 0, 63, 57, 0, 67, +- 0, 39, 59, 40, 0, 0, 67, 59, 0, 3, +- 65, 0, 21, 30, 22, 30, 0, 10, 0, 11, +- 0, 12, 0, 13, 0, 19, 0, 17, 66, 0, +- 3, 65, 0, 3, 65, 0, 15, 38, 0, 23, +- 30, 0, 34, 0, 31, 0, 3, 65, 0, 32, +- 0, 33, 0, 24, 64, 0, 0, 30, 0, 4, +- 0, 5, 0, 6, 0, 7, 0, 8, 0, 18, +- 0, 19, 0, 20, 0, 3, 65, 0, 0, 69, +- 68, 70, 0, 26, 0, 27, 0, 35, 0, 36, +- 0 ++/* YYRHS -- A `-1'-separated list of the rules' RHS. */ ++static const yysigned_char yyrhs[] = ++{ ++ 42, 0, -1, 43, 44, -1, -1, 45, 43, -1, ++ -1, 46, 44, -1, 3, 66, -1, 9, 51, -1, ++ 14, 53, -1, 16, 55, -1, 4, 57, -1, 25, ++ 59, -1, -1, 28, 38, 47, 48, -1, -1, 39, ++ 49, 40, -1, -1, 50, 49, -1, 21, 30, 22, ++ 30, -1, 17, 67, -1, 34, -1, 31, -1, 37, ++ -1, 29, -1, 61, -1, 39, 52, 40, -1, -1, ++ 61, 52, -1, 62, -1, 39, 54, 40, -1, -1, ++ 62, 54, -1, 63, -1, 39, 56, 40, -1, -1, ++ 63, 56, -1, 64, -1, 39, 58, 40, -1, -1, ++ 64, 58, -1, 68, -1, 39, 60, 40, -1, -1, ++ 68, 60, -1, 3, 66, -1, 21, 30, 22, 30, ++ -1, 10, -1, 11, -1, 12, -1, 13, -1, 19, ++ -1, 17, 67, -1, 3, 66, -1, 3, 66, -1, ++ 15, 38, -1, 23, 30, -1, 34, -1, 31, -1, ++ 3, 66, -1, 32, -1, 33, -1, 24, 65, -1, ++ -1, 30, -1, 4, -1, 5, -1, 6, -1, 7, ++ -1, 8, -1, 18, -1, 19, -1, 20, -1, 3, ++ 66, -1, -1, 70, 69, 71, -1, 26, -1, 27, ++ -1, 35, -1, 36, -1 + }; + +-#endif +- +-#if YYDEBUG != 0 +-static const short yyrline[] = { 0, +- 73, 77, 78, 81, 82, 105, 110, 111, 112, 113, +- 114, 117, 138, 140, 141, 144, 145, 148, 153, 154, +- 158, 162, 176, 182, 184, 187, 188, 191, 193, 196, +- 197, 200, 202, 205, 206, 209, 211, 214, 215, 218, +- 220, 223, 224, 227, 234, 238, 247, 256, 265, 274, +- 279, 282, 290, 295, 299, 304, 308, 314, 319, 324, +- 328, 334, 338, 344, 349, 353, 357, 361, 367, 372, +- 376, 382, 387, 393, 395, 400, 406, 412 ++/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ ++static const unsigned short int yyrline[] = ++{ ++ 0, 77, 77, 80, 81, 84, 85, 109, 113, 114, ++ 115, 116, 117, 122, 121, 151, 152, 155, 156, 160, ++ 164, 165, 169, 173, 187, 194, 195, 198, 199, 203, ++ 204, 207, 208, 212, 213, 216, 217, 221, 222, 225, ++ 226, 230, 231, 234, 235, 239, 245, 249, 258, 267, ++ 276, 285, 290, 294, 302, 306, 310, 315, 319, 326, ++ 330, 335, 339, 346, 349, 356, 360, 364, 368, 372, ++ 379, 383, 387, 394, 399, 398, 407, 411, 418, 423 + }; + #endif + +- +-#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) +- +-static const char * const yytname[] = { "$","error","$undefined.","TOK_LEVEL", +-"TOK_DEBUG","TOK_INFO","TOK_WARN","TOK_ERROR","TOK_FATAL","TOK_SIG","TOK_UNI30", +-"TOK_UNI31","TOK_UNI40","TOK_Q2963_1","TOK_SAAL","TOK_VC","TOK_IO","TOK_MODE", +-"TOK_USER","TOK_NET","TOK_SWITCH","TOK_VPCI","TOK_ITF","TOK_PCR","TOK_TRACE", +-"TOK_POLICY","TOK_ALLOW","TOK_REJECT","TOK_ENTITY","TOK_DEFAULT","TOK_NUMBER", +-"TOK_MAX_RATE","TOK_DUMP_DIR","TOK_LOGFILE","TOK_QOS","TOK_FROM","TOK_TO","TOK_ROUTE", +-"TOK_PVC","'{'","'}'","all","global","local","item","entity","@1","opt_options", +-"options","option","sig","sig_items","saal","saal_items","io","io_items","debug", +-"debug_items","policy","policy_items","sig_item","saal_item","io_item","debug_item", +-"opt_trace_size","level","mode","policy_item","@2","action","direction", NULL ++#if YYDEBUG || YYERROR_VERBOSE ++/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. ++ First, the terminals, then, starting at YYNTOKENS, nonterminals. */ ++static const char *const yytname[] = ++{ ++ "$end", "error", "$undefined", "TOK_LEVEL", "TOK_DEBUG", "TOK_INFO", ++ "TOK_WARN", "TOK_ERROR", "TOK_FATAL", "TOK_SIG", "TOK_UNI30", ++ "TOK_UNI31", "TOK_UNI40", "TOK_Q2963_1", "TOK_SAAL", "TOK_VC", "TOK_IO", ++ "TOK_MODE", "TOK_USER", "TOK_NET", "TOK_SWITCH", "TOK_VPCI", "TOK_ITF", ++ "TOK_PCR", "TOK_TRACE", "TOK_POLICY", "TOK_ALLOW", "TOK_REJECT", ++ "TOK_ENTITY", "TOK_DEFAULT", "TOK_NUMBER", "TOK_MAX_RATE", ++ "TOK_DUMP_DIR", "TOK_LOGFILE", "TOK_QOS", "TOK_FROM", "TOK_TO", ++ "TOK_ROUTE", "TOK_PVC", "'{'", "'}'", "$accept", "all", "global", ++ "local", "item", "entity", "@1", "opt_options", "options", "option", ++ "sig", "sig_items", "saal", "saal_items", "io", "io_items", "debug", ++ "debug_items", "policy", "policy_items", "sig_item", "saal_item", ++ "io_item", "debug_item", "opt_trace_size", "level", "mode", ++ "policy_item", "@2", "action", "direction", 0 + }; + #endif + +-static const short yyr1[] = { 0, +- 41, 42, 42, 43, 43, 44, 44, 44, 44, 44, +- 44, 46, 45, 47, 47, 48, 48, 49, 49, 49, +- 49, 49, 49, 50, 50, 51, 51, 52, 52, 53, +- 53, 54, 54, 55, 55, 56, 56, 57, 57, 58, +- 58, 59, 59, 60, 60, 60, 60, 60, 60, 60, +- 60, 61, 62, 62, 62, 62, 62, 63, 63, 63, +- 63, 64, 64, 65, 65, 65, 65, 65, 66, 66, +- 66, 67, 68, 67, 69, 69, 70, 70 ++# ifdef YYPRINT ++/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to ++ token YYLEX-NUM. */ ++static const unsigned short int yytoknum[] = ++{ ++ 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, ++ 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, ++ 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, ++ 285, 286, 287, 288, 289, 290, 291, 292, 293, 123, ++ 125 + }; ++# endif + +-static const short yyr2[] = { 0, +- 2, 0, 2, 0, 2, 2, 2, 2, 2, 2, +- 2, 0, 4, 0, 3, 0, 2, 4, 2, 1, +- 1, 1, 1, 1, 3, 0, 2, 1, 3, 0, +- 2, 1, 3, 0, 2, 1, 3, 0, 2, 1, +- 3, 0, 2, 2, 4, 1, 1, 1, 1, 1, +- 2, 2, 2, 2, 2, 1, 1, 2, 1, 1, +- 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, +- 1, 2, 0, 3, 1, 1, 1, 1 ++/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ ++static const unsigned char yyr1[] = ++{ ++ 0, 41, 42, 43, 43, 44, 44, 45, 45, 45, ++ 45, 45, 45, 47, 46, 48, 48, 49, 49, 50, ++ 50, 50, 50, 50, 50, 51, 51, 52, 52, 53, ++ 53, 54, 54, 55, 55, 56, 56, 57, 57, 58, ++ 58, 59, 59, 60, 60, 61, 61, 61, 61, 61, ++ 61, 61, 61, 62, 63, 63, 63, 63, 63, 64, ++ 64, 64, 64, 65, 65, 66, 66, 66, 66, 66, ++ 67, 67, 67, 68, 69, 68, 70, 70, 71, 71 + }; + +-static const short yydefact[] = { 2, +- 0, 0, 0, 0, 0, 0, 4, 2, 64, 65, +- 66, 67, 68, 6, 0, 62, 59, 60, 38, 10, +- 36, 0, 46, 47, 48, 49, 0, 50, 0, 26, +- 7, 24, 0, 30, 8, 28, 0, 0, 0, 57, +- 56, 34, 9, 32, 0, 75, 76, 42, 11, 40, +- 73, 0, 1, 4, 3, 58, 63, 61, 0, 38, +- 44, 69, 70, 71, 51, 0, 0, 26, 52, 0, +- 30, 53, 54, 55, 0, 34, 72, 0, 42, 0, +- 12, 5, 37, 39, 0, 25, 27, 29, 31, 33, +- 35, 41, 43, 77, 78, 74, 14, 45, 16, 13, +- 0, 0, 23, 21, 20, 22, 0, 16, 19, 0, +- 15, 17, 0, 18, 0, 0, 0 ++/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ ++static const unsigned char yyr2[] = ++{ ++ 0, 2, 2, 0, 2, 0, 2, 2, 2, 2, ++ 2, 2, 2, 0, 4, 0, 3, 0, 2, 4, ++ 2, 1, 1, 1, 1, 1, 3, 0, 2, 1, ++ 3, 0, 2, 1, 3, 0, 2, 1, 3, 0, ++ 2, 1, 3, 0, 2, 2, 4, 1, 1, 1, ++ 1, 1, 2, 2, 2, 2, 2, 1, 1, 2, ++ 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, ++ 1, 1, 1, 2, 0, 3, 1, 1, 1, 1 + }; + +-static const short yydefgoto[] = { 115, +- 7, 53, 8, 54, 97, 100, 107, 108, 31, 67, +- 35, 70, 43, 75, 20, 59, 49, 78, 68, 71, +- 76, 60, 58, 14, 65, 79, 80, 51, 96 ++/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state ++ STATE-NUM when YYTABLE doesn't specify something else to do. Zero ++ means the default is an error. */ ++static const unsigned char yydefact[] = ++{ ++ 3, 0, 0, 0, 0, 0, 0, 0, 5, 3, ++ 65, 66, 67, 68, 69, 7, 0, 63, 60, 61, ++ 39, 11, 37, 0, 47, 48, 49, 50, 0, 51, ++ 0, 27, 8, 25, 0, 31, 9, 29, 0, 0, ++ 0, 58, 57, 35, 10, 33, 0, 76, 77, 43, ++ 12, 41, 74, 1, 0, 2, 5, 4, 59, 64, ++ 62, 0, 39, 45, 70, 71, 72, 52, 0, 0, ++ 27, 53, 0, 31, 54, 55, 56, 0, 35, 73, ++ 0, 43, 0, 13, 6, 38, 40, 0, 26, 28, ++ 30, 32, 34, 36, 42, 44, 78, 79, 75, 15, ++ 46, 17, 14, 0, 0, 24, 22, 21, 23, 0, ++ 17, 20, 0, 16, 18, 0, 19 + }; + +-static const short yypact[] = { 52, +- 100, 1, -3, -1, -2, 0, -17, 52,-32768,-32768, +--32768,-32768,-32768,-32768, 100, -18,-32768,-32768, 25,-32768, +--32768, 100,-32768,-32768,-32768,-32768, 60,-32768, -15, 82, +--32768,-32768, 100, 14,-32768,-32768, 100, -19, -10,-32768, +--32768, 20,-32768,-32768, 100,-32768,-32768, 19,-32768,-32768, +--32768, -14,-32768, -17,-32768,-32768,-32768,-32768, -9, 25, +--32768,-32768,-32768,-32768,-32768, 8, 2, 82,-32768, 4, +- 14,-32768,-32768,-32768, 7, 20,-32768, 10, 19, -30, +--32768,-32768,-32768,-32768, 22,-32768,-32768,-32768,-32768,-32768, +--32768,-32768,-32768,-32768,-32768,-32768, 21,-32768, 53,-32768, +- 60, 23,-32768,-32768,-32768,-32768, 24, 53,-32768, 40, +--32768,-32768, 35,-32768, 67, 69,-32768 ++/* YYDEFGOTO[NTERM-NUM]. */ ++static const yysigned_char yydefgoto[] = ++{ ++ -1, 7, 8, 55, 9, 56, 99, 102, 109, 110, ++ 32, 69, 36, 72, 44, 77, 21, 61, 50, 80, ++ 70, 73, 78, 62, 60, 15, 67, 81, 82, 52, ++ 98 + }; + +-static const short yypgoto[] = {-32768, +- 64, 27,-32768,-32768,-32768,-32768, -35,-32768,-32768, 15, +--32768, 5,-32768, 12,-32768, 29,-32768, -4, 83, 87, +- 91, 95,-32768, 26, 9, 92,-32768,-32768,-32768 ++/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing ++ STATE-NUM. */ ++#define YYPACT_NINF -31 ++static const yysigned_char yypact[] = ++{ ++ 53, 69, 1, -3, -1, -2, 0, 11, -16, 53, ++ -31, -31, -31, -31, -31, -31, 69, -15, -31, -31, ++ 28, -31, -31, 69, -31, -31, -31, -31, 46, -31, ++ -13, 80, -31, -31, 69, 16, -31, -31, 69, -18, ++ -6, -31, -31, 20, -31, -31, 69, -31, -31, 19, ++ -31, -31, -31, -31, -10, -31, -16, -31, -31, -31, ++ -31, 2, 28, -31, -31, -31, -31, -31, 8, 4, ++ 80, -31, 7, 16, -31, -31, -31, 9, 20, -31, ++ 10, 19, -30, -31, -31, -31, -31, 23, -31, -31, ++ -31, -31, -31, -31, -31, -31, -31, -31, -31, 31, ++ -31, 51, -31, 46, 49, -31, -31, -31, -31, 15, ++ 51, -31, 36, -31, -31, 54, -31 + }; + +- +-#define YYLAST 110 +- +- +-static const short yytable[] = { 22, +- 37, 33, 45, 15, 94, 95, 23, 24, 25, 26, +- 52, 57, 38, 27, 66, 28, 33, 29, 73, 74, +- 39, 45, 37, 81, 16, 46, 47, 15, 40, 85, +- 83, 41, 17, 18, 38, 30, 42, 34, 48, 19, +- 56, 86, 39, 88, 46, 47, 90, 61, 16, 92, +- 40, 98, 110, 41, 1, 2, 17, 18, 69, 99, +- 3, 113, 72, 111, 114, 4, 116, 5, 117, 101, +- 77, 55, 112, 102, 93, 89, 6, 62, 63, 64, +- 82, 103, 87, 104, 22, 32, 105, 91, 84, 106, +- 36, 23, 24, 25, 26, 44, 21, 50, 27, 0, +- 28, 0, 29, 9, 10, 11, 12, 13, 0, 109 ++/* YYPGOTO[NTERM-NUM]. */ ++static const yysigned_char yypgoto[] = ++{ ++ -31, -31, 72, 30, -31, -31, -31, -31, -23, -31, ++ -31, 24, -31, 22, -31, 18, -31, 27, -31, 17, ++ 97, 98, 99, 101, -31, 25, 3, 102, -31, -31, ++ -31 + }; + +-static const short yycheck[] = { 3, +- 3, 3, 3, 3, 35, 36, 10, 11, 12, 13, +- 28, 30, 15, 17, 30, 19, 3, 21, 38, 30, +- 23, 3, 3, 38, 24, 26, 27, 3, 31, 22, +- 40, 34, 32, 33, 15, 39, 39, 39, 39, 39, +- 15, 40, 23, 40, 26, 27, 40, 22, 24, 40, +- 31, 30, 30, 34, 3, 4, 32, 33, 33, 39, +- 9, 22, 37, 40, 30, 14, 0, 16, 0, 17, +- 45, 8, 108, 21, 79, 71, 25, 18, 19, 20, +- 54, 29, 68, 31, 3, 3, 34, 76, 60, 37, +- 4, 10, 11, 12, 13, 5, 2, 6, 17, -1, +- 19, -1, 21, 4, 5, 6, 7, 8, -1, 101 ++/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If ++ positive, shift that token. If negative, reduce the rule which ++ number is the opposite. If zero, do what YYDEFACT says. ++ If YYTABLE_NINF, syntax error. */ ++#define YYTABLE_NINF -1 ++static const unsigned char yytable[] = ++{ ++ 23, 38, 34, 46, 16, 96, 97, 24, 25, 26, ++ 27, 53, 54, 39, 28, 59, 29, 68, 30, 34, ++ 75, 40, 46, 38, 76, 17, 47, 48, 83, 41, ++ 87, 16, 42, 18, 19, 39, 31, 43, 35, 49, ++ 20, 58, 85, 40, 88, 47, 48, 90, 63, 92, ++ 94, 41, 17, 100, 42, 113, 1, 2, 115, 71, ++ 18, 19, 3, 74, 64, 65, 66, 4, 103, 5, ++ 101, 79, 104, 10, 11, 12, 13, 14, 6, 112, ++ 105, 57, 106, 23, 116, 107, 84, 114, 108, 86, ++ 24, 25, 26, 27, 89, 91, 93, 28, 95, 29, ++ 33, 30, 37, 22, 45, 0, 111, 0, 51 + }; +-/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ +-#line 3 "/usr/lib/bison.simple" +-/* This file comes from bison-1.28. */ +- +-/* Skeleton output parser for bison, +- Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. +- +- 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 +- the Free Software Foundation; either version 2, or (at your option) +- any later version. + +- This program is distributed in the hope that it will be useful, +- but WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- GNU General Public License for more details. +- +- You should have received a copy of the GNU General Public License +- along with this program; if not, write to the Free Software +- Foundation, Inc., 59 Temple Place - Suite 330, +- Boston, MA 02111-1307, USA. */ +- +-/* As a special exception, when this file is copied by Bison into a +- Bison output file, you may use that output file without restriction. +- This special exception was added by the Free Software Foundation +- in version 1.24 of Bison. */ ++static const yysigned_char yycheck[] = ++{ ++ 3, 3, 3, 3, 3, 35, 36, 10, 11, 12, ++ 13, 0, 28, 15, 17, 30, 19, 30, 21, 3, ++ 38, 23, 3, 3, 30, 24, 26, 27, 38, 31, ++ 22, 3, 34, 32, 33, 15, 39, 39, 39, 39, ++ 39, 16, 40, 23, 40, 26, 27, 40, 23, 40, ++ 40, 31, 24, 30, 34, 40, 3, 4, 22, 34, ++ 32, 33, 9, 38, 18, 19, 20, 14, 17, 16, ++ 39, 46, 21, 4, 5, 6, 7, 8, 25, 30, ++ 29, 9, 31, 3, 30, 34, 56, 110, 37, 62, ++ 10, 11, 12, 13, 70, 73, 78, 17, 81, 19, ++ 3, 21, 4, 2, 5, -1, 103, -1, 6 ++}; + +-/* This is the parser code that is written into each bison parser +- when the %semantic_parser declaration is not specified in the grammar. +- It was written by Richard Stallman by simplifying the hairy parser +- used when %semantic_parser is specified. */ +- +-#ifndef YYSTACK_USE_ALLOCA +-#ifdef alloca +-#define YYSTACK_USE_ALLOCA +-#else /* alloca not defined */ +-#ifdef __GNUC__ +-#define YYSTACK_USE_ALLOCA +-#define alloca __builtin_alloca +-#else /* not GNU C. */ +-#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) +-#define YYSTACK_USE_ALLOCA +-#include <alloca.h> +-#else /* not sparc */ +-/* We think this test detects Watcom and Microsoft C. */ +-/* This used to test MSDOS, but that is a bad idea +- since that symbol is in the user namespace. */ +-#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) +-#if 0 /* No need for malloc.h, which pollutes the namespace; +- instead, just don't use alloca. */ +-#include <malloc.h> +-#endif +-#else /* not MSDOS, or __TURBOC__ */ +-#if defined(_AIX) +-/* I don't know what this was needed for, but it pollutes the namespace. +- So I turned it off. rms, 2 May 1997. */ +-/* #include <malloc.h> */ +- #pragma alloca +-#define YYSTACK_USE_ALLOCA +-#else /* not MSDOS, or __TURBOC__, or _AIX */ +-#if 0 +-#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, +- and on HPUX 10. Eventually we can turn this on. */ +-#define YYSTACK_USE_ALLOCA +-#define alloca __builtin_alloca +-#endif /* __hpux */ +-#endif +-#endif /* not _AIX */ +-#endif /* not MSDOS, or __TURBOC__ */ +-#endif /* not sparc */ +-#endif /* not GNU C */ +-#endif /* alloca not defined */ +-#endif /* YYSTACK_USE_ALLOCA not defined */ ++/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing ++ symbol of state STATE-NUM. */ ++static const unsigned char yystos[] = ++{ ++ 0, 3, 4, 9, 14, 16, 25, 42, 43, 45, ++ 4, 5, 6, 7, 8, 66, 3, 24, 32, 33, ++ 39, 57, 64, 3, 10, 11, 12, 13, 17, 19, ++ 21, 39, 51, 61, 3, 39, 53, 62, 3, 15, ++ 23, 31, 34, 39, 55, 63, 3, 26, 27, 39, ++ 59, 68, 70, 0, 28, 44, 46, 43, 66, 30, ++ 65, 58, 64, 66, 18, 19, 20, 67, 30, 52, ++ 61, 66, 54, 62, 66, 38, 30, 56, 63, 66, ++ 60, 68, 69, 38, 44, 40, 58, 22, 40, 52, ++ 40, 54, 40, 56, 40, 60, 35, 36, 71, 47, ++ 30, 39, 48, 17, 21, 29, 31, 34, 37, 49, ++ 50, 67, 30, 40, 49, 22, 30 ++}; + +-#ifdef YYSTACK_USE_ALLOCA +-#define YYSTACK_ALLOC alloca +-#else +-#define YYSTACK_ALLOC malloc ++#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) ++# define YYSIZE_T __SIZE_TYPE__ ++#endif ++#if ! defined (YYSIZE_T) && defined (size_t) ++# define YYSIZE_T size_t ++#endif ++#if ! defined (YYSIZE_T) ++# if defined (__STDC__) || defined (__cplusplus) ++# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ ++# define YYSIZE_T size_t ++# endif ++#endif ++#if ! defined (YYSIZE_T) ++# define YYSIZE_T unsigned int + #endif +- +-/* Note: there must be only one dollar sign in this file. +- It is replaced by the list of actions, each action +- as one case of the switch. */ + + #define yyerrok (yyerrstatus = 0) + #define yyclearin (yychar = YYEMPTY) +-#define YYEMPTY -2 ++#define YYEMPTY (-2) + #define YYEOF 0 ++ + #define YYACCEPT goto yyacceptlab +-#define YYABORT goto yyabortlab +-#define YYERROR goto yyerrlab1 +-/* Like YYERROR except do call yyerror. +- This remains here temporarily to ease the +- transition to the new meaning of YYERROR, for GCC. ++#define YYABORT goto yyabortlab ++#define YYERROR goto yyerrorlab ++ ++ ++/* Like YYERROR except do call yyerror. This remains here temporarily ++ to ease the transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. */ ++ + #define YYFAIL goto yyerrlab ++ + #define YYRECOVERING() (!!yyerrstatus) +-#define YYBACKUP(token, value) \ ++ ++#define YYBACKUP(Token, Value) \ + do \ + if (yychar == YYEMPTY && yylen == 1) \ +- { yychar = (token), yylval = (value); \ +- yychar1 = YYTRANSLATE (yychar); \ ++ { \ ++ yychar = (Token); \ ++ yylval = (Value); \ ++ yytoken = YYTRANSLATE (yychar); \ + YYPOPSTACK; \ + goto yybackup; \ + } \ + else \ +- { yyerror ("syntax error: cannot back up"); YYERROR; } \ ++ { \ ++ yyerror ("syntax error: cannot back up");\ ++ YYERROR; \ ++ } \ + while (0) + + #define YYTERROR 1 + #define YYERRCODE 256 + +-#ifndef YYPURE +-#define YYLEX yylex() +-#endif ++/* YYLLOC_DEFAULT -- Compute the default location (before the actions ++ are run). */ + +-#ifdef YYPURE +-#ifdef YYLSP_NEEDED +-#ifdef YYLEX_PARAM +-#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) +-#else +-#define YYLEX yylex(&yylval, &yylloc) ++#ifndef YYLLOC_DEFAULT ++# define YYLLOC_DEFAULT(Current, Rhs, N) \ ++ ((Current).first_line = (Rhs)[1].first_line, \ ++ (Current).first_column = (Rhs)[1].first_column, \ ++ (Current).last_line = (Rhs)[N].last_line, \ ++ (Current).last_column = (Rhs)[N].last_column) + #endif +-#else /* not YYLSP_NEEDED */ ++ ++/* YYLEX -- calling `yylex' with the right arguments. */ ++ + #ifdef YYLEX_PARAM +-#define YYLEX yylex(&yylval, YYLEX_PARAM) ++# define YYLEX yylex (YYLEX_PARAM) + #else +-#define YYLEX yylex(&yylval) +-#endif +-#endif /* not YYLSP_NEEDED */ ++# define YYLEX yylex () + #endif + +-/* If nonreentrant, generate the variables here */ ++/* Enable debugging if requested. */ ++#if YYDEBUG + +-#ifndef YYPURE ++# ifndef YYFPRINTF ++# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ ++# define YYFPRINTF fprintf ++# endif ++ ++# define YYDPRINTF(Args) \ ++do { \ ++ if (yydebug) \ ++ YYFPRINTF Args; \ ++} while (0) ++ ++# define YYDSYMPRINT(Args) \ ++do { \ ++ if (yydebug) \ ++ yysymprint Args; \ ++} while (0) ++ ++# define YYDSYMPRINTF(Title, Token, Value, Location) \ ++do { \ ++ if (yydebug) \ ++ { \ ++ YYFPRINTF (stderr, "%s ", Title); \ ++ yysymprint (stderr, \ ++ Token, Value); \ ++ YYFPRINTF (stderr, "\n"); \ ++ } \ ++} while (0) + +-int yychar; /* the lookahead symbol */ +-YYSTYPE yylval; /* the semantic value of the */ +- /* lookahead symbol */ ++/*------------------------------------------------------------------. ++| yy_stack_print -- Print the state stack from its BOTTOM up to its | ++| TOP (included). | ++`------------------------------------------------------------------*/ + +-#ifdef YYLSP_NEEDED +-YYLTYPE yylloc; /* location data for the lookahead */ +- /* symbol */ ++#if defined (__STDC__) || defined (__cplusplus) ++static void ++yy_stack_print (short int *bottom, short int *top) ++#else ++static void ++yy_stack_print (bottom, top) ++ short int *bottom; ++ short int *top; + #endif ++{ ++ YYFPRINTF (stderr, "Stack now"); ++ for (/* Nothing. */; bottom <= top; ++bottom) ++ YYFPRINTF (stderr, " %d", *bottom); ++ YYFPRINTF (stderr, "\n"); ++} ++ ++# define YY_STACK_PRINT(Bottom, Top) \ ++do { \ ++ if (yydebug) \ ++ yy_stack_print ((Bottom), (Top)); \ ++} while (0) + +-int yynerrs; /* number of parse errors so far */ +-#endif /* not YYPURE */ + +-#if YYDEBUG != 0 +-int yydebug; /* nonzero means print parse trace */ +-/* Since this is uninitialized, it does not stop multiple parsers +- from coexisting. */ ++/*------------------------------------------------. ++| Report that the YYRULE is going to be reduced. | ++`------------------------------------------------*/ ++ ++#if defined (__STDC__) || defined (__cplusplus) ++static void ++yy_reduce_print (int yyrule) ++#else ++static void ++yy_reduce_print (yyrule) ++ int yyrule; + #endif ++{ ++ int yyi; ++ unsigned int yylno = yyrline[yyrule]; ++ YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", ++ yyrule - 1, yylno); ++ /* Print the symbols being reduced, and their result. */ ++ for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) ++ YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]); ++ YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]); ++} ++ ++# define YY_REDUCE_PRINT(Rule) \ ++do { \ ++ if (yydebug) \ ++ yy_reduce_print (Rule); \ ++} while (0) ++ ++/* Nonzero means print parse trace. It is left uninitialized so that ++ multiple parsers can coexist. */ ++int yydebug; ++#else /* !YYDEBUG */ ++# define YYDPRINTF(Args) ++# define YYDSYMPRINT(Args) ++# define YYDSYMPRINTF(Title, Token, Value, Location) ++# define YY_STACK_PRINT(Bottom, Top) ++# define YY_REDUCE_PRINT(Rule) ++#endif /* !YYDEBUG */ + +-/* YYINITDEPTH indicates the initial size of the parser's stacks */ + ++/* YYINITDEPTH -- initial size of the parser's stacks. */ + #ifndef YYINITDEPTH +-#define YYINITDEPTH 200 ++# define YYINITDEPTH 200 + #endif + +-/* YYMAXDEPTH is the maximum size the stacks can grow to +- (effective only if the built-in stack extension method is used). */ ++/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only ++ if the built-in stack extension method is used). + +-#if YYMAXDEPTH == 0 +-#undef YYMAXDEPTH ++ Do not make this value too large; the results are undefined if ++ SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) ++ evaluated with infinite-precision integer arithmetic. */ ++ ++#if defined (YYMAXDEPTH) && YYMAXDEPTH == 0 ++# undef YYMAXDEPTH + #endif + + #ifndef YYMAXDEPTH +-#define YYMAXDEPTH 10000 ++# define YYMAXDEPTH 10000 + #endif ++ + +-/* Define __yy_memcpy. Note that the size argument +- should be passed with type unsigned int, because that is what the non-GCC +- definitions require. With GCC, __builtin_memcpy takes an arg +- of type size_t, but it can handle unsigned int. */ +- +-#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ +-#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) +-#else /* not GNU C or C++ */ +-#ifndef __cplusplus + +-/* This is the most reliable way to avoid incompatibilities +- in available built-in functions on various systems. */ +-static void +-__yy_memcpy (to, from, count) +- char *to; +- char *from; +- unsigned int count; +-{ +- register char *f = from; +- register char *t = to; +- register int i = count; ++#if YYERROR_VERBOSE + +- while (i-- > 0) +- *t++ = *f++; ++# ifndef yystrlen ++# if defined (__GLIBC__) && defined (_STRING_H) ++# define yystrlen strlen ++# else ++/* Return the length of YYSTR. */ ++static YYSIZE_T ++# if defined (__STDC__) || defined (__cplusplus) ++yystrlen (const char *yystr) ++# else ++yystrlen (yystr) ++ const char *yystr; ++# endif ++{ ++ register const char *yys = yystr; ++ ++ while (*yys++ != '\0') ++ continue; ++ ++ return yys - yystr - 1; + } ++# endif ++# endif + +-#else /* __cplusplus */ ++# ifndef yystpcpy ++# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) ++# define yystpcpy stpcpy ++# else ++/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in ++ YYDEST. */ ++static char * ++# if defined (__STDC__) || defined (__cplusplus) ++yystpcpy (char *yydest, const char *yysrc) ++# else ++yystpcpy (yydest, yysrc) ++ char *yydest; ++ const char *yysrc; ++# endif ++{ ++ register char *yyd = yydest; ++ register const char *yys = yysrc; ++ ++ while ((*yyd++ = *yys++) != '\0') ++ continue; ++ ++ return yyd - 1; ++} ++# endif ++# endif + +-/* This is the most reliable way to avoid incompatibilities +- in available built-in functions on various systems. */ ++#endif /* !YYERROR_VERBOSE */ ++ ++ ++ ++#if YYDEBUG ++/*--------------------------------. ++| Print this symbol on YYOUTPUT. | ++`--------------------------------*/ ++ ++#if defined (__STDC__) || defined (__cplusplus) + static void +-__yy_memcpy (char *to, char *from, unsigned int count) ++yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) ++#else ++static void ++yysymprint (yyoutput, yytype, yyvaluep) ++ FILE *yyoutput; ++ int yytype; ++ YYSTYPE *yyvaluep; ++#endif + { +- register char *t = to; +- register char *f = from; +- register int i = count; ++ /* Pacify ``unused variable'' warnings. */ ++ (void) yyvaluep; + +- while (i-- > 0) +- *t++ = *f++; ++ if (yytype < YYNTOKENS) ++ { ++ YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); ++# ifdef YYPRINT ++ YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); ++# endif ++ } ++ else ++ YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); ++ ++ switch (yytype) ++ { ++ default: ++ break; ++ } ++ YYFPRINTF (yyoutput, ")"); + } + ++#endif /* ! YYDEBUG */ ++/*-----------------------------------------------. ++| Release the memory associated to this symbol. | ++`-----------------------------------------------*/ ++ ++#if defined (__STDC__) || defined (__cplusplus) ++static void ++yydestruct (int yytype, YYSTYPE *yyvaluep) ++#else ++static void ++yydestruct (yytype, yyvaluep) ++ int yytype; ++ YYSTYPE *yyvaluep; + #endif +-#endif ++{ ++ /* Pacify ``unused variable'' warnings. */ ++ (void) yyvaluep; ++ ++ switch (yytype) ++ { ++ ++ default: ++ break; ++ } ++} + +-#line 217 "/usr/lib/bison.simple" + +-/* The user can define YYPARSE_PARAM as the name of an argument to be passed +- into yyparse. The argument should have type void *. +- It should actually point to an object. +- Grammar actions can access the variable by casting it +- to the proper pointer type. */ ++/* Prevent warnings from -Wmissing-prototypes. */ + + #ifdef YYPARSE_PARAM +-#ifdef __cplusplus +-#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM +-#define YYPARSE_PARAM_DECL +-#else /* not __cplusplus */ +-#define YYPARSE_PARAM_ARG YYPARSE_PARAM +-#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; +-#endif /* not __cplusplus */ +-#else /* not YYPARSE_PARAM */ +-#define YYPARSE_PARAM_ARG +-#define YYPARSE_PARAM_DECL +-#endif /* not YYPARSE_PARAM */ ++# if defined (__STDC__) || defined (__cplusplus) ++int yyparse (void *YYPARSE_PARAM); ++# else ++int yyparse (); ++# endif ++#else /* ! YYPARSE_PARAM */ ++#if defined (__STDC__) || defined (__cplusplus) ++int yyparse (void); ++#else ++int yyparse (); ++#endif ++#endif /* ! YYPARSE_PARAM */ ++ ++ ++ ++/* The lookahead symbol. */ ++int yychar; ++ ++/* The semantic value of the lookahead symbol. */ ++YYSTYPE yylval; ++ ++/* Number of syntax errors so far. */ ++int yynerrs; ++ ++ ++ ++/*----------. ++| yyparse. | ++`----------*/ + +-/* Prevent warning if -Wstrict-prototypes. */ +-#ifdef __GNUC__ + #ifdef YYPARSE_PARAM +-int yyparse (void *); ++# if defined (__STDC__) || defined (__cplusplus) ++int yyparse (void *YYPARSE_PARAM) ++# else ++int yyparse (YYPARSE_PARAM) ++ void *YYPARSE_PARAM; ++# endif ++#else /* ! YYPARSE_PARAM */ ++#if defined (__STDC__) || defined (__cplusplus) ++int ++yyparse (void) + #else +-int yyparse (void); ++int ++yyparse () ++ + #endif + #endif +- +-int +-yyparse(YYPARSE_PARAM_ARG) +- YYPARSE_PARAM_DECL + { ++ + register int yystate; + register int yyn; +- register short *yyssp; ++ int yyresult; ++ /* Number of tokens to shift before error messages enabled. */ ++ int yyerrstatus; ++ /* Lookahead token as an internal (translated) token number. */ ++ int yytoken = 0; ++ ++ /* Three stacks and their tools: ++ `yyss': related to states, ++ `yyvs': related to semantic values, ++ `yyls': related to locations. ++ ++ Refer to the stacks thru separate pointers, to allow yyoverflow ++ to reallocate them elsewhere. */ ++ ++ /* The state stack. */ ++ short int yyssa[YYINITDEPTH]; ++ short int *yyss = yyssa; ++ register short int *yyssp; ++ ++ /* The semantic value stack. */ ++ YYSTYPE yyvsa[YYINITDEPTH]; ++ YYSTYPE *yyvs = yyvsa; + register YYSTYPE *yyvsp; +- int yyerrstatus; /* number of tokens to shift before error messages enabled */ +- int yychar1 = 0; /* lookahead token as an internal (translated) token number */ + +- short yyssa[YYINITDEPTH]; /* the state stack */ +- YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ + +- short *yyss = yyssa; /* refer to the stacks thru separate pointers */ +- YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ + +-#ifdef YYLSP_NEEDED +- YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ +- YYLTYPE *yyls = yylsa; +- YYLTYPE *yylsp; +- +-#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) +-#else + #define YYPOPSTACK (yyvsp--, yyssp--) +-#endif + +- int yystacksize = YYINITDEPTH; +- int yyfree_stacks = 0; ++ YYSIZE_T yystacksize = YYINITDEPTH; + +-#ifdef YYPURE +- int yychar; +- YYSTYPE yylval; +- int yynerrs; +-#ifdef YYLSP_NEEDED +- YYLTYPE yylloc; +-#endif +-#endif ++ /* The variables used to return semantic value and location from the ++ action routines. */ ++ YYSTYPE yyval; + +- YYSTYPE yyval; /* the variable used to return */ +- /* semantic values from the action */ +- /* routines */ + ++ /* When reducing, the number of symbols on the RHS of the reduced ++ rule. */ + int yylen; + +-#if YYDEBUG != 0 +- if (yydebug) +- fprintf(stderr, "Starting parse\n"); +-#endif ++ YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; +@@ -614,110 +1022,97 @@ + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + +- yyssp = yyss - 1; ++ yyssp = yyss; + yyvsp = yyvs; +-#ifdef YYLSP_NEEDED +- yylsp = yyls; +-#endif + +-/* Push a new state, which is found in yystate . */ +-/* In all cases, when you get here, the value and location stacks +- have just been pushed. so pushing a state here evens the stacks. */ +-yynewstate: + +- *++yyssp = yystate; ++ goto yysetstate; + +- if (yyssp >= yyss + yystacksize - 1) +- { +- /* Give user a chance to reallocate the stack */ +- /* Use copies of these so that the &'s don't force the real ones into memory. */ +- YYSTYPE *yyvs1 = yyvs; +- short *yyss1 = yyss; +-#ifdef YYLSP_NEEDED +- YYLTYPE *yyls1 = yyls; +-#endif ++/*------------------------------------------------------------. ++| yynewstate -- Push a new state, which is found in yystate. | ++`------------------------------------------------------------*/ ++ yynewstate: ++ /* In all cases, when you get here, the value and location stacks ++ have just been pushed. so pushing a state here evens the stacks. ++ */ ++ yyssp++; + ++ yysetstate: ++ *yyssp = yystate; ++ ++ if (yyss + yystacksize - 1 <= yyssp) ++ { + /* Get the current used size of the three stacks, in elements. */ +- int size = yyssp - yyss + 1; ++ YYSIZE_T yysize = yyssp - yyss + 1; + + #ifdef yyoverflow +- /* Each stack pointer address is followed by the size of +- the data in use in that stack, in bytes. */ +-#ifdef YYLSP_NEEDED +- /* This used to be a conditional around just the two extra args, +- but that might be undefined if yyoverflow is a macro. */ +- yyoverflow("parser stack overflow", +- &yyss1, size * sizeof (*yyssp), +- &yyvs1, size * sizeof (*yyvsp), +- &yyls1, size * sizeof (*yylsp), +- &yystacksize); +-#else +- yyoverflow("parser stack overflow", +- &yyss1, size * sizeof (*yyssp), +- &yyvs1, size * sizeof (*yyvsp), +- &yystacksize); +-#endif +- +- yyss = yyss1; yyvs = yyvs1; +-#ifdef YYLSP_NEEDED +- yyls = yyls1; +-#endif ++ { ++ /* Give user a chance to reallocate the stack. Use copies of ++ these so that the &'s don't force the real ones into ++ memory. */ ++ YYSTYPE *yyvs1 = yyvs; ++ short int *yyss1 = yyss; ++ ++ ++ /* Each stack pointer address is followed by the size of the ++ data in use in that stack, in bytes. This used to be a ++ conditional around just the two extra args, but that might ++ be undefined if yyoverflow is a macro. */ ++ yyoverflow ("parser stack overflow", ++ &yyss1, yysize * sizeof (*yyssp), ++ &yyvs1, yysize * sizeof (*yyvsp), ++ ++ &yystacksize); ++ ++ yyss = yyss1; ++ yyvs = yyvs1; ++ } + #else /* no yyoverflow */ ++# ifndef YYSTACK_RELOCATE ++ goto yyoverflowlab; ++# else + /* Extend the stack our own way. */ +- if (yystacksize >= YYMAXDEPTH) +- { +- yyerror("parser stack overflow"); +- if (yyfree_stacks) +- { +- free (yyss); +- free (yyvs); +-#ifdef YYLSP_NEEDED +- free (yyls); +-#endif +- } +- return 2; +- } ++ if (YYMAXDEPTH <= yystacksize) ++ goto yyoverflowlab; + yystacksize *= 2; +- if (yystacksize > YYMAXDEPTH) ++ if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; +-#ifndef YYSTACK_USE_ALLOCA +- yyfree_stacks = 1; +-#endif +- yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); +- __yy_memcpy ((char *)yyss, (char *)yyss1, +- size * (unsigned int) sizeof (*yyssp)); +- yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); +- __yy_memcpy ((char *)yyvs, (char *)yyvs1, +- size * (unsigned int) sizeof (*yyvsp)); +-#ifdef YYLSP_NEEDED +- yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); +- __yy_memcpy ((char *)yyls, (char *)yyls1, +- size * (unsigned int) sizeof (*yylsp)); +-#endif ++ ++ { ++ short int *yyss1 = yyss; ++ union yyalloc *yyptr = ++ (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); ++ if (! yyptr) ++ goto yyoverflowlab; ++ YYSTACK_RELOCATE (yyss); ++ YYSTACK_RELOCATE (yyvs); ++ ++# undef YYSTACK_RELOCATE ++ if (yyss1 != yyssa) ++ YYSTACK_FREE (yyss1); ++ } ++# endif + #endif /* no yyoverflow */ + +- yyssp = yyss + size - 1; +- yyvsp = yyvs + size - 1; +-#ifdef YYLSP_NEEDED +- yylsp = yyls + size - 1; +-#endif ++ yyssp = yyss + yysize - 1; ++ yyvsp = yyvs + yysize - 1; + +-#if YYDEBUG != 0 +- if (yydebug) +- fprintf(stderr, "Stack size increased to %d\n", yystacksize); +-#endif + +- if (yyssp >= yyss + yystacksize - 1) ++ YYDPRINTF ((stderr, "Stack size increased to %lu\n", ++ (unsigned long int) yystacksize)); ++ ++ if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + +-#if YYDEBUG != 0 +- if (yydebug) +- fprintf(stderr, "Entering state %d\n", yystate); +-#endif ++ YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + goto yybackup; +- yybackup: ++ ++/*-----------. ++| yybackup. | ++`-----------*/ ++yybackup: + + /* Do appropriate processing given the current state. */ + /* Read a lookahead token if we need one and don't already have one. */ +@@ -726,135 +1121,99 @@ + /* First try to decide what to do without reference to lookahead token. */ + + yyn = yypact[yystate]; +- if (yyn == YYFLAG) ++ if (yyn == YYPACT_NINF) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + +- /* yychar is either YYEMPTY or YYEOF +- or a valid token in external form. */ +- ++ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) + { +-#if YYDEBUG != 0 +- if (yydebug) +- fprintf(stderr, "Reading a token: "); +-#endif ++ YYDPRINTF ((stderr, "Reading a token: ")); + yychar = YYLEX; + } + +- /* Convert token to internal form (in yychar1) for indexing tables with */ +- +- if (yychar <= 0) /* This means end of input. */ ++ if (yychar <= YYEOF) + { +- yychar1 = 0; +- yychar = YYEOF; /* Don't call YYLEX any more */ +- +-#if YYDEBUG != 0 +- if (yydebug) +- fprintf(stderr, "Now at end of input.\n"); +-#endif ++ yychar = yytoken = YYEOF; ++ YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { +- yychar1 = YYTRANSLATE(yychar); +- +-#if YYDEBUG != 0 +- if (yydebug) +- { +- fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); +- /* Give the individual parser a way to print the precise meaning +- of a token, for further debugging info. */ +-#ifdef YYPRINT +- YYPRINT (stderr, yychar, yylval); +-#endif +- fprintf (stderr, ")\n"); +- } +-#endif ++ yytoken = YYTRANSLATE (yychar); ++ YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc); + } + +- yyn += yychar1; +- if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) ++ /* If the proper action on seeing token YYTOKEN is to reduce or to ++ detect an error, take that action. */ ++ yyn += yytoken; ++ if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; +- + yyn = yytable[yyn]; +- +- /* yyn is what to do for this token type in this state. +- Negative => reduce, -yyn is rule number. +- Positive => shift, yyn is new state. +- New state is final state => don't bother to shift, +- just return success. +- 0, or most negative number => error. */ +- +- if (yyn < 0) ++ if (yyn <= 0) + { +- if (yyn == YYFLAG) ++ if (yyn == 0 || yyn == YYTABLE_NINF) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } +- else if (yyn == 0) +- goto yyerrlab; + + if (yyn == YYFINAL) + YYACCEPT; + + /* Shift the lookahead token. */ +- +-#if YYDEBUG != 0 +- if (yydebug) +- fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); +-#endif ++ YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken])); + + /* Discard the token being shifted unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; + + *++yyvsp = yylval; +-#ifdef YYLSP_NEEDED +- *++yylsp = yylloc; +-#endif + +- /* count tokens shifted since error; after three, turn off error status. */ +- if (yyerrstatus) yyerrstatus--; ++ ++ /* Count tokens shifted since error; after three, turn off error ++ status. */ ++ if (yyerrstatus) ++ yyerrstatus--; + + yystate = yyn; + goto yynewstate; + +-/* Do the default action for the current state. */ +-yydefault: + ++/*-----------------------------------------------------------. ++| yydefault -- do the default action for the current state. | ++`-----------------------------------------------------------*/ ++yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; ++ goto yyreduce; ++ + +-/* Do a reduction. yyn is the number of a rule to reduce with. */ ++/*-----------------------------. ++| yyreduce -- Do a reduction. | ++`-----------------------------*/ + yyreduce: ++ /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; +- if (yylen > 0) +- yyval = yyvsp[1-yylen]; /* implement default value of the action */ + +-#if YYDEBUG != 0 +- if (yydebug) +- { +- int i; +- +- fprintf (stderr, "Reducing via rule %d (line %d), ", +- yyn, yyrline[yyn]); ++ /* If YYLEN is nonzero, implement the default value of the action: ++ `$$ = $1'. + +- /* Print the symbols being reduced, and their result. */ +- for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) +- fprintf (stderr, "%s ", yytname[yyrhs[i]]); +- fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); +- } +-#endif ++ Otherwise, the following line sets YYVAL to garbage. ++ This behavior is undocumented and Bison ++ users should not rely upon it. Assigning to YYVAL ++ unconditionally makes the parser a bit smaller, and it avoids a ++ GCC warning that YYVAL may be used uninitialized. */ ++ yyval = yyvsp[1-yylen]; + + +- switch (yyn) { +- +-case 5: +-#line 83 "cfg_y.y" +-{ ++ YY_REDUCE_PRINT (yyn); ++ switch (yyn) ++ { ++ case 6: ++#line 86 "cfg_y.y" ++ { + if (!curr_sig->uni) + curr_sig->uni = + #if defined(UNI30) || defined(DYNAMIC_UNI) +@@ -873,17 +1232,19 @@ + #endif + #endif + ; +- ; +- break;} +-case 6: +-#line 107 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 7: ++#line 110 "cfg_y.y" ++ { + set_verbosity(NULL,yyvsp[0].num); +- ; +- break;} +-case 12: +-#line 119 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 13: ++#line 122 "cfg_y.y" ++ { + SIG_ENTITY *sig,**walk; + + if (atmpvc_addr_in_use(_entity.signaling_pvc)) +@@ -892,37 +1253,49 @@ + if (entities == &_entity) entities = NULL; + for (sig = entities; sig; sig = sig->next) + if (atm_equal((struct sockaddr *) &sig->signaling_pvc, +- (struct sockaddr *) &yyvsp[0].pvc,0,0)) +- yyerror("duplicate PVC address %d.%d.%d",S_PVC(sig)); ++ (struct sockaddr *) &yyvsp[0].pvc,0,0)) { ++ const char *err; ++ asprintf(&err,"duplicate PVC address %d.%d.%d",S_PVC(sig)); ++ if(err) { ++ yyerror(err); ++ free(err); ++ } ++ else ++ yyerror("duplicate PVC address"); ++ } + curr_sig = alloc_t(SIG_ENTITY); + *curr_sig = _entity; + curr_sig->signaling_pvc = yyvsp[0].pvc; + curr_sig->next = NULL; + for (walk = &entities; *walk; walk = &(*walk)->next); + *walk = curr_sig; +- ; +- break;} +-case 18: +-#line 150 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 19: ++#line 161 "cfg_y.y" ++ { + enter_vpci(curr_sig,yyvsp[-2].num,yyvsp[0].num); +- ; +- break;} +-case 20: +-#line 155 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 21: ++#line 166 "cfg_y.y" ++ { + curr_sig->sig_qos = yyvsp[0].str; +- ; +- break;} +-case 21: +-#line 159 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 22: ++#line 170 "cfg_y.y" ++ { + curr_sig->max_rate = yyvsp[0].num; +- ; +- break;} +-case 22: +-#line 163 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 23: ++#line 174 "cfg_y.y" ++ { + struct sockaddr_atmsvc addr; + char *mask; + +@@ -931,464 +1304,506 @@ + if (text2atm(yyvsp[0].str,(struct sockaddr *) &addr,sizeof(addr), + T2A_SVC | T2A_WILDCARD | T2A_NAME | T2A_LOCAL) < 0) { + yyerror("invalid address"); +- return; ++ return 0; + } + add_route(curr_sig,&addr,mask ? strtol(mask,NULL,10) : INT_MAX); +- ; +- break;} +-case 23: +-#line 177 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 24: ++#line 188 "cfg_y.y" ++ { + add_route(curr_sig,NULL,0); +- ; +- break;} +-case 44: +-#line 229 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 45: ++#line 240 "cfg_y.y" ++ { + set_verbosity("UNI",yyvsp[0].num); + set_verbosity("KERNEL",yyvsp[0].num); + set_verbosity("SAP",yyvsp[0].num); +- ; +- break;} +-case 45: +-#line 235 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 46: ++#line 246 "cfg_y.y" ++ { + enter_vpci(curr_sig,yyvsp[-2].num,yyvsp[0].num); +- ; +- break;} +-case 46: +-#line 239 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 47: ++#line 250 "cfg_y.y" ++ { + #if defined(UNI30) || defined(ALLOW_UNI30) || defined(DYNAMIC_UNI) + if (curr_sig->uni & ~S_UNI31) yyerror("UNI mode is already set"); + curr_sig->uni |= S_UNI30; + #else + yyerror("Sorry, not supported yet"); + #endif +- ; +- break;} +-case 47: +-#line 248 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 48: ++#line 259 "cfg_y.y" ++ { + #if defined(UNI31) || defined(ALLOW_UNI30) || defined(DYNAMIC_UNI) + if (curr_sig->uni & ~S_UNI30) yyerror("UNI mode is already set"); + curr_sig->uni |= S_UNI31; + #else + yyerror("Sorry, not supported yet"); + #endif +- ; +- break;} +-case 48: +-#line 257 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 49: ++#line 268 "cfg_y.y" ++ { + #if defined(UNI40) || defined(DYNAMIC_UNI) + if (curr_sig->uni) yyerror("UNI mode is already set"); + curr_sig->uni = S_UNI40; + #else + yyerror("Sorry, not supported yet"); + #endif +- ; +- break;} +-case 49: +-#line 266 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 50: ++#line 277 "cfg_y.y" ++ { + #if defined(Q2963_1) || defined(DYNAMIC_UNI) + if (!(curr_sig->uni & S_UNI40)) yyerror("Incompatible UNI mode"); + curr_sig->uni |= S_Q2963_1; + #else + yyerror("Sorry, not supported yet"); + #endif +- ; +- break;} +-case 50: +-#line 275 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 51: ++#line 286 "cfg_y.y" ++ { + yywarn("sig net is obsolete, please use sig mode net instead"); + curr_sig->mode = sm_net; +- ; +- break;} +-case 52: +-#line 284 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 53: ++#line 295 "cfg_y.y" ++ { + set_verbosity("SSCF",yyvsp[0].num); + set_verbosity("SSCOP",yyvsp[0].num); +- ; +- break;} +-case 53: +-#line 292 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 54: ++#line 303 "cfg_y.y" ++ { + set_verbosity("IO",yyvsp[0].num); +- ; +- break;} +-case 54: +-#line 296 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 55: ++#line 307 "cfg_y.y" ++ { + curr_sig->signaling_pvc = yyvsp[0].pvc; +- ; +- break;} +-case 55: +-#line 300 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 56: ++#line 311 "cfg_y.y" ++ { + yywarn("io pcr is obsolete, please use io qos instead"); + curr_sig->sig_pcr = yyvsp[0].num; +- ; +- break;} +-case 56: +-#line 305 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 57: ++#line 316 "cfg_y.y" ++ { + curr_sig->sig_qos = yyvsp[0].str; +- ; +- break;} +-case 57: +-#line 309 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 58: ++#line 320 "cfg_y.y" ++ { + curr_sig->max_rate = yyvsp[0].num; +- ; +- break;} +-case 58: +-#line 316 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 59: ++#line 327 "cfg_y.y" ++ { + set_verbosity(NULL,yyvsp[0].num); +- ; +- break;} +-case 59: +-#line 320 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 60: ++#line 331 "cfg_y.y" ++ { + dump_dir = yyvsp[0].str; + if (!trace_size) trace_size = DEFAULT_TRACE_SIZE; +- ; +- break;} +-case 60: +-#line 325 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 61: ++#line 336 "cfg_y.y" ++ { + set_logfile(yyvsp[0].str); +- ; +- break;} +-case 61: +-#line 329 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 62: ++#line 340 "cfg_y.y" ++ { + trace_size = yyvsp[0].num; +- ; +- break;} +-case 62: +-#line 335 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 63: ++#line 346 "cfg_y.y" ++ { + yyval.num = DEFAULT_TRACE_SIZE; +- ; +- break;} +-case 63: +-#line 339 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 64: ++#line 350 "cfg_y.y" ++ { + yyval.num = yyvsp[0].num; +- ; +- break;} +-case 64: +-#line 346 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 65: ++#line 357 "cfg_y.y" ++ { + yyval.num = DIAG_DEBUG; +- ; +- break;} +-case 65: +-#line 350 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 66: ++#line 361 "cfg_y.y" ++ { + yyval.num = DIAG_INFO; +- ; +- break;} +-case 66: +-#line 354 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 67: ++#line 365 "cfg_y.y" ++ { + yyval.num = DIAG_WARN; +- ; +- break;} +-case 67: +-#line 358 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 68: ++#line 369 "cfg_y.y" ++ { + yyval.num = DIAG_ERROR; +- ; +- break;} +-case 68: +-#line 362 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 69: ++#line 373 "cfg_y.y" ++ { + yyval.num = DIAG_FATAL; +- ; +- break;} +-case 69: +-#line 369 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 70: ++#line 380 "cfg_y.y" ++ { + curr_sig->mode = sm_user; +- ; +- break;} +-case 70: +-#line 373 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 71: ++#line 384 "cfg_y.y" ++ { + curr_sig->mode = sm_net; +- ; +- break;} +-case 71: +-#line 377 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 72: ++#line 388 "cfg_y.y" ++ { + curr_sig->mode = sm_switch; +- ; +- break;} +-case 72: +-#line 384 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 73: ++#line 395 "cfg_y.y" ++ { + set_verbosity("POLICY",yyvsp[0].num); +- ; +- break;} +-case 73: +-#line 388 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 74: ++#line 399 "cfg_y.y" ++ { + rule = alloc_t(RULE); + rule->type = yyvsp[0].num; +- ; +- break;} +-case 75: +-#line 397 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 76: ++#line 408 "cfg_y.y" ++ { + yyval.num = ACL_ALLOW; +- ; +- break;} +-case 76: +-#line 401 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 77: ++#line 412 "cfg_y.y" ++ { + yyval.num = ACL_REJECT; +- ; +- break;} +-case 77: +-#line 408 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 78: ++#line 419 "cfg_y.y" ++ { + rule->type |= ACL_IN; + put_address(yyvsp[0].str); +- ; +- break;} +-case 78: +-#line 413 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 79: ++#line 424 "cfg_y.y" ++ { + rule->type |= ACL_OUT; + put_address(yyvsp[0].str); +- ; +- break;} +-} +- /* the action file gets copied in in place of this dollarsign */ +-#line 543 "/usr/lib/bison.simple" ++ } ++ break; ++ ++ ++ } ++ ++/* Line 1010 of yacc.c. */ ++#line 1585 "y.tab.c" + + yyvsp -= yylen; + yyssp -= yylen; +-#ifdef YYLSP_NEEDED +- yylsp -= yylen; +-#endif + +-#if YYDEBUG != 0 +- if (yydebug) +- { +- short *ssp1 = yyss - 1; +- fprintf (stderr, "state stack now"); +- while (ssp1 != yyssp) +- fprintf (stderr, " %d", *++ssp1); +- fprintf (stderr, "\n"); +- } +-#endif ++ ++ YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + +-#ifdef YYLSP_NEEDED +- yylsp++; +- if (yylen == 0) +- { +- yylsp->first_line = yylloc.first_line; +- yylsp->first_column = yylloc.first_column; +- yylsp->last_line = (yylsp-1)->last_line; +- yylsp->last_column = (yylsp-1)->last_column; +- yylsp->text = 0; +- } +- else +- { +- yylsp->last_line = (yylsp+yylen-1)->last_line; +- yylsp->last_column = (yylsp+yylen-1)->last_column; +- } +-#endif + +- /* Now "shift" the result of the reduction. +- Determine what state that goes to, +- based on the state we popped back to +- and the rule number reduced by. */ ++ /* Now `shift' the result of the reduction. Determine what state ++ that goes to, based on the state we popped back to and the rule ++ number reduced by. */ + + yyn = yyr1[yyn]; + +- yystate = yypgoto[yyn - YYNTBASE] + *yyssp; +- if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) ++ yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; ++ if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else +- yystate = yydefgoto[yyn - YYNTBASE]; ++ yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + +-yyerrlab: /* here on detecting error */ + +- if (! yyerrstatus) +- /* If not already recovering from an error, report this error. */ ++/*------------------------------------. ++| yyerrlab -- here on detecting error | ++`------------------------------------*/ ++yyerrlab: ++ /* If not already recovering from an error, report this error. */ ++ if (!yyerrstatus) + { + ++yynerrs; +- +-#ifdef YYERROR_VERBOSE ++#if YYERROR_VERBOSE + yyn = yypact[yystate]; + +- if (yyn > YYFLAG && yyn < YYLAST) ++ if (YYPACT_NINF < yyn && yyn < YYLAST) + { +- int size = 0; +- char *msg; +- int x, count; +- +- count = 0; +- /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ +- for (x = (yyn < 0 ? -yyn : 0); +- x < (sizeof(yytname) / sizeof(char *)); x++) +- if (yycheck[x + yyn] == x) +- size += strlen(yytname[x]) + 15, count++; +- msg = (char *) malloc(size + 15); +- if (msg != 0) ++ YYSIZE_T yysize = 0; ++ int yytype = YYTRANSLATE (yychar); ++ const char* yyprefix; ++ char *yymsg; ++ int yyx; ++ ++ /* Start YYX at -YYN if negative to avoid negative indexes in ++ YYCHECK. */ ++ int yyxbegin = yyn < 0 ? -yyn : 0; ++ ++ /* Stay within bounds of both yycheck and yytname. */ ++ int yychecklim = YYLAST - yyn; ++ int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; ++ int yycount = 0; ++ ++ yyprefix = ", expecting "; ++ for (yyx = yyxbegin; yyx < yyxend; ++yyx) ++ if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) ++ { ++ yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]); ++ yycount += 1; ++ if (yycount == 5) ++ { ++ yysize = 0; ++ break; ++ } ++ } ++ yysize += (sizeof ("syntax error, unexpected ") ++ + yystrlen (yytname[yytype])); ++ yymsg = (char *) YYSTACK_ALLOC (yysize); ++ if (yymsg != 0) + { +- strcpy(msg, "parse error"); ++ char *yyp = yystpcpy (yymsg, "syntax error, unexpected "); ++ yyp = yystpcpy (yyp, yytname[yytype]); + +- if (count < 5) ++ if (yycount < 5) + { +- count = 0; +- for (x = (yyn < 0 ? -yyn : 0); +- x < (sizeof(yytname) / sizeof(char *)); x++) +- if (yycheck[x + yyn] == x) ++ yyprefix = ", expecting "; ++ for (yyx = yyxbegin; yyx < yyxend; ++yyx) ++ if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { +- strcat(msg, count == 0 ? ", expecting `" : " or `"); +- strcat(msg, yytname[x]); +- strcat(msg, "'"); +- count++; ++ yyp = yystpcpy (yyp, yyprefix); ++ yyp = yystpcpy (yyp, yytname[yyx]); ++ yyprefix = " or "; + } + } +- yyerror(msg); +- free(msg); ++ yyerror (yymsg); ++ YYSTACK_FREE (yymsg); + } + else +- yyerror ("parse error; also virtual memory exceeded"); ++ yyerror ("syntax error; also virtual memory exhausted"); + } + else + #endif /* YYERROR_VERBOSE */ +- yyerror("parse error"); ++ yyerror ("syntax error"); + } + +- goto yyerrlab1; +-yyerrlab1: /* here on error raised explicitly by an action */ ++ + + if (yyerrstatus == 3) + { +- /* if just tried and failed to reuse lookahead token after an error, discard it. */ ++ /* If just tried and failed to reuse lookahead token after an ++ error, discard it. */ + +- /* return failure if at end of input */ +- if (yychar == YYEOF) +- YYABORT; +- +-#if YYDEBUG != 0 +- if (yydebug) +- fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); +-#endif ++ if (yychar <= YYEOF) ++ { ++ /* If at end of input, pop the error token, ++ then the rest of the stack, then return failure. */ ++ if (yychar == YYEOF) ++ for (;;) ++ { ++ YYPOPSTACK; ++ if (yyssp == yyss) ++ YYABORT; ++ YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); ++ yydestruct (yystos[*yyssp], yyvsp); ++ } ++ } ++ else ++ { ++ YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc); ++ yydestruct (yytoken, &yylval); ++ yychar = YYEMPTY; + +- yychar = YYEMPTY; ++ } + } + +- /* Else will try to reuse lookahead token +- after shifting the error token. */ +- +- yyerrstatus = 3; /* Each real token shifted decrements this */ ++ /* Else will try to reuse lookahead token after shifting the error ++ token. */ ++ goto yyerrlab1; + +- goto yyerrhandle; + +-yyerrdefault: /* current state does not do anything special for the error token. */ ++/*---------------------------------------------------. ++| yyerrorlab -- error raised explicitly by YYERROR. | ++`---------------------------------------------------*/ ++yyerrorlab: + +-#if 0 +- /* This is wrong; only states that explicitly want error tokens +- should shift them. */ +- yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ +- if (yyn) goto yydefault; ++#ifdef __GNUC__ ++ /* Pacify GCC when the user code never invokes YYERROR and the label ++ yyerrorlab therefore never appears in user code. */ ++ if (0) ++ goto yyerrorlab; + #endif + +-yyerrpop: /* pop the current state because it cannot handle the error token */ +- +- if (yyssp == yyss) YYABORT; +- yyvsp--; +- yystate = *--yyssp; +-#ifdef YYLSP_NEEDED +- yylsp--; +-#endif ++ yyvsp -= yylen; ++ yyssp -= yylen; ++ yystate = *yyssp; ++ goto yyerrlab1; + +-#if YYDEBUG != 0 +- if (yydebug) +- { +- short *ssp1 = yyss - 1; +- fprintf (stderr, "Error: state stack now"); +- while (ssp1 != yyssp) +- fprintf (stderr, " %d", *++ssp1); +- fprintf (stderr, "\n"); +- } +-#endif + +-yyerrhandle: ++/*-------------------------------------------------------------. ++| yyerrlab1 -- common code for both syntax error and YYERROR. | ++`-------------------------------------------------------------*/ ++yyerrlab1: ++ yyerrstatus = 3; /* Each real token shifted decrements this. */ + +- yyn = yypact[yystate]; +- if (yyn == YYFLAG) +- goto yyerrdefault; ++ for (;;) ++ { ++ yyn = yypact[yystate]; ++ if (yyn != YYPACT_NINF) ++ { ++ yyn += YYTERROR; ++ if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) ++ { ++ yyn = yytable[yyn]; ++ if (0 < yyn) ++ break; ++ } ++ } + +- yyn += YYTERROR; +- if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) +- goto yyerrdefault; ++ /* Pop the current state because it cannot handle the error token. */ ++ if (yyssp == yyss) ++ YYABORT; + +- yyn = yytable[yyn]; +- if (yyn < 0) +- { +- if (yyn == YYFLAG) +- goto yyerrpop; +- yyn = -yyn; +- goto yyreduce; ++ YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); ++ yydestruct (yystos[yystate], yyvsp); ++ YYPOPSTACK; ++ yystate = *yyssp; ++ YY_STACK_PRINT (yyss, yyssp); + } +- else if (yyn == 0) +- goto yyerrpop; + + if (yyn == YYFINAL) + YYACCEPT; + +-#if YYDEBUG != 0 +- if (yydebug) +- fprintf(stderr, "Shifting error token, "); +-#endif ++ YYDPRINTF ((stderr, "Shifting error token, ")); + + *++yyvsp = yylval; +-#ifdef YYLSP_NEEDED +- *++yylsp = yylloc; +-#endif ++ + + yystate = yyn; + goto yynewstate; + +- yyacceptlab: +- /* YYACCEPT comes here. */ +- if (yyfree_stacks) +- { +- free (yyss); +- free (yyvs); +-#ifdef YYLSP_NEEDED +- free (yyls); +-#endif +- } +- return 0; + +- yyabortlab: +- /* YYABORT comes here. */ +- if (yyfree_stacks) +- { +- free (yyss); +- free (yyvs); +-#ifdef YYLSP_NEEDED +- free (yyls); ++/*-------------------------------------. ++| yyacceptlab -- YYACCEPT comes here. | ++`-------------------------------------*/ ++yyacceptlab: ++ yyresult = 0; ++ goto yyreturn; ++ ++/*-----------------------------------. ++| yyabortlab -- YYABORT comes here. | ++`-----------------------------------*/ ++yyabortlab: ++ yyresult = 1; ++ goto yyreturn; ++ ++#ifndef yyoverflow ++/*----------------------------------------------. ++| yyoverflowlab -- parser overflow comes here. | ++`----------------------------------------------*/ ++yyoverflowlab: ++ yyerror ("parser stack overflow"); ++ yyresult = 2; ++ /* Fall through. */ ++#endif ++ ++yyreturn: ++#ifndef yyoverflow ++ if (yyss != yyssa) ++ YYSTACK_FREE (yyss); + #endif +- } +- return 1; ++ return yyresult; + } +-#line 418 "cfg_y.y" ++ ++ ++ +--- linux-atm-2.4.1.orig/src/sigd/proto.c ++++ linux-atm-2.4.1/src/sigd/proto.c +@@ -259,6 +259,7 @@ + break; + } + default: ++ break; + } + va_end(ap); + if ((size = q_close(&dsc)) >= 0) to_signaling(sock->sig,q_buffer,size); +@@ -288,6 +289,7 @@ + } + break; + default: ++ break; + } + va_end(ap); + } +--- linux-atm-2.4.1.orig/src/sigd/cfg_y.y ++++ linux-atm-2.4.1/src/sigd/cfg_y.y +@@ -7,6 +7,7 @@ + #include <config.h> + #endif + ++#include <stdlib.h> + #include <string.h> + #include <ctype.h> + #include <limits.h> +@@ -19,6 +20,8 @@ + #include "trace.h" + #include "policy.h" + ++extern void yywarn(const char *s); ++extern void yyerror(const char *s); + + static RULE *rule; + static SIG_ENTITY *curr_sig = &_entity; +@@ -125,8 +128,16 @@ + if (entities == &_entity) entities = NULL; + for (sig = entities; sig; sig = sig->next) + if (atm_equal((struct sockaddr *) &sig->signaling_pvc, +- (struct sockaddr *) &$2,0,0)) +- yyerror("duplicate PVC address %d.%d.%d",S_PVC(sig)); ++ (struct sockaddr *) &$2,0,0)) { ++ const char *err; ++ asprintf(&err,"duplicate PVC address %d.%d.%d",S_PVC(sig)); ++ if(err) { ++ yyerror(err); ++ free(err); ++ } ++ else ++ yyerror("duplicate PVC address"); ++ } + curr_sig = alloc_t(SIG_ENTITY); + *curr_sig = _entity; + curr_sig->signaling_pvc = $2; +@@ -169,7 +180,7 @@ + if (text2atm($1,(struct sockaddr *) &addr,sizeof(addr), + T2A_SVC | T2A_WILDCARD | T2A_NAME | T2A_LOCAL) < 0) { + yyerror("invalid address"); +- return; ++ return 0; + } + add_route(curr_sig,&addr,mask ? strtol(mask,NULL,10) : INT_MAX); + } +--- linux-atm-2.4.1.orig/src/sigd/cfg_y.h ++++ linux-atm-2.4.1/src/sigd/cfg_y.h +@@ -1,44 +1,127 @@ +-typedef union { ++/* A Bison parser, made by GNU Bison 1.875d. */ ++ ++/* Skeleton parser for Yacc-like parsing with Bison, ++ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++ ++ 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 ++ the Free Software Foundation; either version 2, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software ++ Foundation, Inc., 59 Temple Place - Suite 330, ++ Boston, MA 02111-1307, USA. */ ++ ++/* As a special exception, when this file is copied by Bison into a ++ Bison output file, you may use that output file without restriction. ++ This special exception was added by the Free Software Foundation ++ in version 1.24 of Bison. */ ++ ++/* Tokens. */ ++#ifndef YYTOKENTYPE ++# define YYTOKENTYPE ++ /* Put the tokens into the symbol table, so that GDB and other debuggers ++ know about them. */ ++ enum yytokentype { ++ TOK_LEVEL = 258, ++ TOK_DEBUG = 259, ++ TOK_INFO = 260, ++ TOK_WARN = 261, ++ TOK_ERROR = 262, ++ TOK_FATAL = 263, ++ TOK_SIG = 264, ++ TOK_UNI30 = 265, ++ TOK_UNI31 = 266, ++ TOK_UNI40 = 267, ++ TOK_Q2963_1 = 268, ++ TOK_SAAL = 269, ++ TOK_VC = 270, ++ TOK_IO = 271, ++ TOK_MODE = 272, ++ TOK_USER = 273, ++ TOK_NET = 274, ++ TOK_SWITCH = 275, ++ TOK_VPCI = 276, ++ TOK_ITF = 277, ++ TOK_PCR = 278, ++ TOK_TRACE = 279, ++ TOK_POLICY = 280, ++ TOK_ALLOW = 281, ++ TOK_REJECT = 282, ++ TOK_ENTITY = 283, ++ TOK_DEFAULT = 284, ++ TOK_NUMBER = 285, ++ TOK_MAX_RATE = 286, ++ TOK_DUMP_DIR = 287, ++ TOK_LOGFILE = 288, ++ TOK_QOS = 289, ++ TOK_FROM = 290, ++ TOK_TO = 291, ++ TOK_ROUTE = 292, ++ TOK_PVC = 293 ++ }; ++#endif ++#define TOK_LEVEL 258 ++#define TOK_DEBUG 259 ++#define TOK_INFO 260 ++#define TOK_WARN 261 ++#define TOK_ERROR 262 ++#define TOK_FATAL 263 ++#define TOK_SIG 264 ++#define TOK_UNI30 265 ++#define TOK_UNI31 266 ++#define TOK_UNI40 267 ++#define TOK_Q2963_1 268 ++#define TOK_SAAL 269 ++#define TOK_VC 270 ++#define TOK_IO 271 ++#define TOK_MODE 272 ++#define TOK_USER 273 ++#define TOK_NET 274 ++#define TOK_SWITCH 275 ++#define TOK_VPCI 276 ++#define TOK_ITF 277 ++#define TOK_PCR 278 ++#define TOK_TRACE 279 ++#define TOK_POLICY 280 ++#define TOK_ALLOW 281 ++#define TOK_REJECT 282 ++#define TOK_ENTITY 283 ++#define TOK_DEFAULT 284 ++#define TOK_NUMBER 285 ++#define TOK_MAX_RATE 286 ++#define TOK_DUMP_DIR 287 ++#define TOK_LOGFILE 288 ++#define TOK_QOS 289 ++#define TOK_FROM 290 ++#define TOK_TO 291 ++#define TOK_ROUTE 292 ++#define TOK_PVC 293 ++ ++ ++ ++ ++#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) ++#line 56 "cfg_y.y" ++typedef union YYSTYPE { + int num; + char *str; + struct sockaddr_atmpvc pvc; + } YYSTYPE; +-#define TOK_LEVEL 257 +-#define TOK_DEBUG 258 +-#define TOK_INFO 259 +-#define TOK_WARN 260 +-#define TOK_ERROR 261 +-#define TOK_FATAL 262 +-#define TOK_SIG 263 +-#define TOK_UNI30 264 +-#define TOK_UNI31 265 +-#define TOK_UNI40 266 +-#define TOK_Q2963_1 267 +-#define TOK_SAAL 268 +-#define TOK_VC 269 +-#define TOK_IO 270 +-#define TOK_MODE 271 +-#define TOK_USER 272 +-#define TOK_NET 273 +-#define TOK_SWITCH 274 +-#define TOK_VPCI 275 +-#define TOK_ITF 276 +-#define TOK_PCR 277 +-#define TOK_TRACE 278 +-#define TOK_POLICY 279 +-#define TOK_ALLOW 280 +-#define TOK_REJECT 281 +-#define TOK_ENTITY 282 +-#define TOK_DEFAULT 283 +-#define TOK_NUMBER 284 +-#define TOK_MAX_RATE 285 +-#define TOK_DUMP_DIR 286 +-#define TOK_LOGFILE 287 +-#define TOK_QOS 288 +-#define TOK_FROM 289 +-#define TOK_TO 290 +-#define TOK_ROUTE 291 +-#define TOK_PVC 292 +- ++/* Line 1285 of yacc.c. */ ++#line 119 "y.tab.h" ++# define yystype YYSTYPE /* obsolescent; will be withdrawn */ ++# define YYSTYPE_IS_DECLARED 1 ++# define YYSTYPE_IS_TRIVIAL 1 ++#endif + + extern YYSTYPE yylval; ++ ++ ++ +--- linux-atm-2.4.1.orig/src/maint/Makefile.in ++++ linux-atm-2.4.1/src/maint/Makefile.in +@@ -1,4 +1,4 @@ +-# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am ++# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am + + # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation +@@ -181,8 +181,11 @@ + + DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +-TAR = gtar ++TAR = tar + GZIP_ENV = --best ++DEP_FILES = .deps/atmaddr.P .deps/atmdiag.P .deps/atmdump.P \ ++.deps/atmloop.P .deps/atmtcp.P .deps/enitune.P .deps/esi.P \ ++.deps/saaldump.P .deps/sonetdiag.P .deps/zntune.P + SOURCES = $(atmdiag_SOURCES) $(atmdump_SOURCES) $(sonetdiag_SOURCES) $(saaldump_SOURCES) $(atmaddr_SOURCES) $(esi_SOURCES) $(atmloop_SOURCES) $(atmtcp_SOURCES) $(enitune_SOURCES) $(zntune_SOURCES) + OBJECTS = $(atmdiag_OBJECTS) $(atmdump_OBJECTS) $(sonetdiag_OBJECTS) $(saaldump_OBJECTS) $(atmaddr_OBJECTS) $(esi_OBJECTS) $(atmloop_OBJECTS) $(atmtcp_OBJECTS) $(enitune_OBJECTS) $(zntune_OBJECTS) + +@@ -190,9 +193,9 @@ + .SUFFIXES: + .SUFFIXES: .S .c .lo .o .obj .s + $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +- cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps src/maint/Makefile ++ cd $(top_srcdir) && $(AUTOMAKE) --gnu src/maint/Makefile + +-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +@@ -247,9 +250,6 @@ + rm -f $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + done + +-.c.o: +- $(COMPILE) -c $< +- + # FIXME: We should only use cygpath when building on Windows, + # and only if it is available. + .c.obj: +@@ -272,9 +272,6 @@ + + maintainer-clean-compile: + +-.c.lo: +- $(LIBTOOL) --mode=compile $(COMPILE) -c $< +- + .s.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +@@ -388,7 +385,7 @@ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ +- || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) ++ || (cd $(srcdir) && etags -o $$here/TAGS $(ETAGS_ARGS) $$tags $$unique $(LISP)) + + mostlyclean-tags: + +@@ -404,6 +401,11 @@ + subdir = src/maint + + distdir: $(DISTFILES) ++ here=`cd $(top_builddir) && pwd`; \ ++ top_distdir=`cd $(top_distdir) && pwd`; \ ++ distdir=`cd $(distdir) && pwd`; \ ++ cd $(top_srcdir) \ ++ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu src/maint/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ +@@ -414,28 +416,38 @@ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done +-atmaddr.o: atmaddr.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h +-atmdiag.o: atmdiag.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h +-atmdump.o: atmdump.c ../../config.h ../../src/include/stdint.h \ +- ../../src/include/atm.h +-atmloop.o: atmloop.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h +-atmtcp.o: atmtcp.c ../../config.h ../../src/include/stdint.h \ +- ../../src/include/atm.h ../../src/include/atmd.h +-enitune.o: enitune.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h +-esi.o: esi.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h +-saaldump.o: saaldump.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h ../../src/saal/pdu.h \ +- ../../src/include/atmd.h ../../src/qgen/qlib.h +-sonetdiag.o: sonetdiag.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h +-zntune.o: zntune.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h + ++DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) ++ ++-include $(DEP_FILES) ++ ++mostlyclean-depend: ++ ++clean-depend: ++ ++distclean-depend: ++ -rm -rf .deps ++ ++maintainer-clean-depend: ++ ++%.o: %.c ++ @echo '$(COMPILE) -c $<'; \ ++ $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< ++ @-cp .deps/$(*F).pp .deps/$(*F).P; \ ++ tr ' ' '\012' < .deps/$(*F).pp \ ++ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ ++ >> .deps/$(*F).P; \ ++ rm .deps/$(*F).pp ++ ++%.lo: %.c ++ @echo '$(LTCOMPILE) -c $<'; \ ++ $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< ++ @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ ++ < .deps/$(*F).pp > .deps/$(*F).P; \ ++ tr ' ' '\012' < .deps/$(*F).pp \ ++ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ ++ >> .deps/$(*F).P; \ ++ rm -f .deps/$(*F).pp + info-am: + info: info-am + dvi-am: +@@ -475,18 +487,19 @@ + maintainer-clean-generic: + mostlyclean-am: mostlyclean-binPROGRAMS mostlyclean-sbinPROGRAMS \ + mostlyclean-compile mostlyclean-libtool \ +- mostlyclean-tags mostlyclean-generic ++ mostlyclean-tags mostlyclean-depend mostlyclean-generic + + mostlyclean: mostlyclean-am + + clean-am: clean-binPROGRAMS clean-sbinPROGRAMS clean-compile \ +- clean-libtool clean-tags clean-generic mostlyclean-am ++ clean-libtool clean-tags clean-depend clean-generic \ ++ mostlyclean-am + + clean: clean-am + + distclean-am: distclean-binPROGRAMS distclean-sbinPROGRAMS \ + distclean-compile distclean-libtool distclean-tags \ +- distclean-generic clean-am ++ distclean-depend distclean-generic clean-am + -rm -f libtool + + distclean: distclean-am +@@ -494,7 +507,8 @@ + maintainer-clean-am: maintainer-clean-binPROGRAMS \ + maintainer-clean-sbinPROGRAMS maintainer-clean-compile \ + maintainer-clean-libtool maintainer-clean-tags \ +- maintainer-clean-generic distclean-am ++ maintainer-clean-depend maintainer-clean-generic \ ++ distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +@@ -508,12 +522,14 @@ + clean-compile maintainer-clean-compile mostlyclean-libtool \ + distclean-libtool clean-libtool maintainer-clean-libtool install-man8 \ + uninstall-man8 install-man uninstall-man tags mostlyclean-tags \ +-distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ +-dvi-am dvi check check-am installcheck-am installcheck install-exec-am \ +-install-exec install-data-am install-data install-am install \ +-uninstall-am uninstall all-redirect all-am all installdirs \ +-mostlyclean-generic distclean-generic clean-generic \ +-maintainer-clean-generic clean mostlyclean distclean maintainer-clean ++distclean-tags clean-tags maintainer-clean-tags distdir \ ++mostlyclean-depend distclean-depend clean-depend \ ++maintainer-clean-depend info-am info dvi-am dvi check check-am \ ++installcheck-am installcheck install-exec-am install-exec \ ++install-data-am install-data install-am install uninstall-am uninstall \ ++all-redirect all-am all installdirs mostlyclean-generic \ ++distclean-generic clean-generic maintainer-clean-generic clean \ ++mostlyclean distclean maintainer-clean + + + # Tell versions [3.59,3.63) of GNU make to not export all variables. +--- linux-atm-2.4.1.orig/src/maint/atmtcp.c ++++ linux-atm-2.4.1/src/maint/atmtcp.c +@@ -60,7 +60,7 @@ + static IN *inputs = NULL; + static fd_set in_set; + static int fds = 0; +-static int debug = 0; ++static int atmtcp_debug = 0; + static int links = 0; + + +@@ -86,7 +86,7 @@ + { + OUT *out; + +- if (debug) ++ if (atmtcp_debug) + fprintf(stderr,"Emit: %d.%d, %d bytes\n",ntohs(hdr->vpi), + ntohs(hdr->vci),(int) ntohl(hdr->length)); + for (out = outputs; out; out = out->next) +@@ -99,7 +99,7 @@ + OUT *out; + int changed = 0; + +- if (debug) ++ if (atmtcp_debug) + fprintf(stderr,"Control: (%d.%d) %s %d.%d, vcc %s\n", + ntohs(msg->hdr.vpi),ntohs(msg->hdr.vci), + msg->type == ATMTCP_CTRL_OPEN ? "OPEN" : +@@ -295,19 +295,19 @@ + } + if ((s = socket(PF_ATMPVC,SOCK_DGRAM,0)) < 0) { + msg->result = -errno; +- if (debug) perror("socket"); ++ if (atmtcp_debug) perror("socket"); + return 1; + } + if (setsockopt(s,SOL_ATM,SO_ATMQOS,&msg->qos,sizeof(msg->qos)) < 0) { + msg->result = -errno; +- if (debug) perror("setsockopt SO_ATMQOS"); ++ if (atmtcp_debug) perror("setsockopt SO_ATMQOS"); + return 1; + } + msg->addr.sap_addr.itf = data->itf; + if (connect(s,(struct sockaddr *) &msg->addr, + sizeof(struct sockaddr_atmpvc)) < 0) { + msg->result = -errno; +- if (debug) perror("connect"); ++ if (atmtcp_debug) perror("connect"); + return 1; + } + (*vcc) = alloc_t(VCC); +@@ -333,7 +333,7 @@ + addr.sap_addr.vci = ntohs(hdr->vci); + vcc = real_lookup(data,&addr); + if (!*vcc) { +- if (debug) ++ if (atmtcp_debug) + fprintf(stderr,"VCC %d.%d not found\n",addr.sap_addr.vpi, + addr.sap_addr.vci); + return; +@@ -430,7 +430,7 @@ + exit(1); + } + if (in->bytes < sizeof(*hdr)+ntohl(hdr->length)) return; +- if (debug) ++ if (atmtcp_debug) + fprintf(stderr,"TCP %d.%d, %d bytes\n",ntohs(hdr->vpi), + ntohs(hdr->vci),(unsigned int) ntohl(hdr->length)); + in->bytes = 0; +@@ -447,7 +447,7 @@ + fprintf(stderr,"unrecognized control message \"%s\"\n",msg); + return; + } +- if (debug) fprintf(stderr,"received control \"%s\"\n",msg); ++ if (atmtcp_debug) fprintf(stderr,"received control \"%s\"\n",msg); + ctl.hdr.vpi = htons(vpi); + ctl.hdr.vci = htons(vci); + ctl.hdr.length = htonl(ATMTCP_HDR_MAGIC); +@@ -508,7 +508,7 @@ + } + hdr->vpi = hdr->vci = htons(0); + hdr->length = htonl(pos-start); +- if (debug) fprintf(stderr,"sending control \"%s\"\n",start); ++ if (atmtcp_debug) fprintf(stderr,"sending control \"%s\"\n",start); + tcp_do_send(*(int *) out->user,buf,pos-buf); + return 0; + } +@@ -555,7 +555,7 @@ + exit(1); + } + if (in->bytes < sizeof(int)+sizeof(*hdr)+ntohl(hdr->length)) return; +- if (debug) ++ if (atmtcp_debug) + fprintf(stderr,"File %d.%d, %d bytes\n",ntohs(hdr->vpi), + ntohs(hdr->vci),(unsigned int) ntohl(hdr->length)); + } +@@ -708,7 +708,7 @@ + while ((c = getopt(argc,argv,"dvV")) != EOF) + switch (c) { + case 'd': +- debug = 1; ++ atmtcp_debug = 1; + break; + case 'v': + verbose = 1; +@@ -817,7 +817,8 @@ + } + else if (!strcmp(ARG,"listen") || + (do_background = !strcmp(ARG,"listen-bg"))) { +- int fd,port,addr_len; ++ int fd,port; ++ size_t addr_len; + int *fd2 = alloc_t(int); + + if ((fd = socket(PF_INET,SOCK_STREAM,0)) < 0) { +--- linux-atm-2.4.1.orig/src/maint/enitune.c ++++ linux-atm-2.4.1/src/maint/enitune.c +@@ -44,6 +44,7 @@ + if (*end || mult.rx <= 100) usage(name); + break; + default: ++ break; + } + if (argc != optind+1) usage(name); + sioc.number = strtol(argv[optind],&end,0); +--- linux-atm-2.4.1.orig/src/arpd/Makefile.in ++++ linux-atm-2.4.1/src/arpd/Makefile.in +@@ -1,4 +1,4 @@ +-# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am ++# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am + + # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation +@@ -90,8 +90,7 @@ + sbin_PROGRAMS = atmarp atmarpd + + atmarp_SOURCES = atmarp.c atmarp.h atmarpd.h +-atmarpd_SOURCES = atmarpd.c atmarpd.h arp.c arp.h io.c io.h itf.c itf.h \ +- table.c table.h atmarp.h ++atmarpd_SOURCES = atmarpd.c atmarpd.h arp.c arp.h io.c io.h itf.c itf.h table.c table.h atmarp.h + + + include_HEADERS = atmarp.h atmarpd.h +@@ -135,8 +134,10 @@ + + DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +-TAR = gtar ++TAR = tar + GZIP_ENV = --best ++DEP_FILES = .deps/arp.P .deps/atmarp.P .deps/atmarpd.P .deps/io.P \ ++.deps/itf.P .deps/table.P + SOURCES = $(atmarp_SOURCES) $(atmarpd_SOURCES) + OBJECTS = $(atmarp_OBJECTS) $(atmarpd_OBJECTS) + +@@ -144,9 +145,9 @@ + .SUFFIXES: + .SUFFIXES: .S .c .lo .o .obj .s + $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +- cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps src/arpd/Makefile ++ cd $(top_srcdir) && $(AUTOMAKE) --gnu src/arpd/Makefile + +-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +@@ -176,9 +177,6 @@ + rm -f $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + done + +-.c.o: +- $(COMPILE) -c $< +- + # FIXME: We should only use cygpath when building on Windows, + # and only if it is available. + .c.obj: +@@ -201,9 +199,6 @@ + + maintainer-clean-compile: + +-.c.lo: +- $(LIBTOOL) --mode=compile $(COMPILE) -c $< +- + .s.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +@@ -300,7 +295,7 @@ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ +- || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) ++ || (cd $(srcdir) && etags -o $$here/TAGS $(ETAGS_ARGS) $$tags $$unique $(LISP)) + + mostlyclean-tags: + +@@ -316,6 +311,11 @@ + subdir = src/arpd + + distdir: $(DISTFILES) ++ here=`cd $(top_builddir) && pwd`; \ ++ top_distdir=`cd $(top_distdir) && pwd`; \ ++ distdir=`cd $(distdir) && pwd`; \ ++ cd $(top_srcdir) \ ++ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu src/arpd/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ +@@ -326,24 +326,38 @@ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done +-arp.o: arp.c ../../config.h ../../src/include/stdint.h \ +- ../../src/include/atm.h ../../src/include/atmd.h atmarp.h \ +- atmarpd.h table.h itf.h io.h arp.h +-atmarp.o: atmarp.c ../../config.h ../../src/include/stdint.h \ +- ../../src/include/atm.h ../../src/include/atmd.h atmarpd.h +-atmarpd.o: atmarpd.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h ../../src/include/atmd.h atmarpd.h \ +- io.h table.h +-io.o: io.c ../../config.h ../../src/include/stdint.h \ +- ../../src/include/atm.h ../../src/include/atmd.h atmarpd.h \ +- table.h arp.h atmarp.h itf.h io.h +-itf.o: itf.c ../../config.h ../../src/include/stdint.h \ +- ../../src/include/atmd.h ../../src/include/atm.h table.h io.h \ +- itf.h arp.h atmarp.h atmarpd.h +-table.o: table.c ../../config.h ../../src/include/stdint.h \ +- ../../src/include/atm.h ../../src/include/atmd.h atmarpd.h \ +- table.h + ++DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) ++ ++-include $(DEP_FILES) ++ ++mostlyclean-depend: ++ ++clean-depend: ++ ++distclean-depend: ++ -rm -rf .deps ++ ++maintainer-clean-depend: ++ ++%.o: %.c ++ @echo '$(COMPILE) -c $<'; \ ++ $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< ++ @-cp .deps/$(*F).pp .deps/$(*F).P; \ ++ tr ' ' '\012' < .deps/$(*F).pp \ ++ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ ++ >> .deps/$(*F).P; \ ++ rm .deps/$(*F).pp ++ ++%.lo: %.c ++ @echo '$(LTCOMPILE) -c $<'; \ ++ $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< ++ @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ ++ < .deps/$(*F).pp > .deps/$(*F).P; \ ++ tr ' ' '\012' < .deps/$(*F).pp \ ++ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ ++ >> .deps/$(*F).P; \ ++ rm -f .deps/$(*F).pp + info-am: + info: info-am + dvi-am: +@@ -383,27 +397,27 @@ + + maintainer-clean-generic: + mostlyclean-am: mostlyclean-sbinPROGRAMS mostlyclean-compile \ +- mostlyclean-libtool mostlyclean-tags \ ++ mostlyclean-libtool mostlyclean-tags mostlyclean-depend \ + mostlyclean-generic + + mostlyclean: mostlyclean-am + + clean-am: clean-sbinPROGRAMS clean-compile clean-libtool clean-tags \ +- clean-generic mostlyclean-am ++ clean-depend clean-generic mostlyclean-am + + clean: clean-am + + distclean-am: distclean-sbinPROGRAMS distclean-compile \ +- distclean-libtool distclean-tags distclean-generic \ +- clean-am ++ distclean-libtool distclean-tags distclean-depend \ ++ distclean-generic clean-am + -rm -f libtool + + distclean: distclean-am + + maintainer-clean-am: maintainer-clean-sbinPROGRAMS \ + maintainer-clean-compile maintainer-clean-libtool \ +- maintainer-clean-tags maintainer-clean-generic \ +- distclean-am ++ maintainer-clean-tags maintainer-clean-depend \ ++ maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +@@ -416,8 +430,9 @@ + distclean-libtool clean-libtool maintainer-clean-libtool install-man8 \ + uninstall-man8 install-man uninstall-man uninstall-includeHEADERS \ + install-includeHEADERS tags mostlyclean-tags distclean-tags clean-tags \ +-maintainer-clean-tags distdir info-am info dvi-am dvi check check-am \ +-installcheck-am installcheck install-exec-am install-exec \ ++maintainer-clean-tags distdir mostlyclean-depend distclean-depend \ ++clean-depend maintainer-clean-depend info-am info dvi-am dvi check \ ++check-am installcheck-am installcheck install-exec-am install-exec \ + install-data-am install-data install-am install uninstall-am uninstall \ + all-redirect all-am all installdirs mostlyclean-generic \ + distclean-generic clean-generic maintainer-clean-generic clean \ +--- linux-atm-2.4.1.orig/src/arpd/atmarp.c ++++ linux-atm-2.4.1/src/arpd/atmarp.c +@@ -92,7 +92,7 @@ + perror("read " ATMARP_DUMP_DIR "/" ATMARP_DUMP_FILE); + return 1; + } +- if (write(0,buffer,size) < 0) { ++ if (write(1,buffer,size) < 0) { + perror("write stdout"); + return 1; + } +--- linux-atm-2.4.1.orig/src/ilmid/Makefile.in ++++ linux-atm-2.4.1/src/ilmid/Makefile.in +@@ -1,4 +1,4 @@ +-# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am ++# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am + + # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation +@@ -91,13 +91,9 @@ + + sbin_PROGRAMS = ilmid + +-ilmid_SOURCES = rfc1157_snmp.c rfc1157_snmp.h rfc1155_smi.c rfc1155_smi.h \ +- util.c util.h io.c io.h message.c message.h \ +- atmf_uni.c atmf_uni.h mib.c mib.h \ +- sysgroup.c sysgroup.h ilmid.c ++ilmid_SOURCES = rfc1157_snmp.c rfc1157_snmp.h rfc1155_smi.c rfc1155_smi.h util.c util.h io.c io.h message.c message.h atmf_uni.c atmf_uni.h mib.c mib.h sysgroup.c sysgroup.h ilmid.c + +-ilmid_LDADD = $(top_builddir)/src/lib/libatm.la \ +- $(top_builddir)/src/ilmid/asn1/libasn1.a ++ilmid_LDADD = $(top_builddir)/src/lib/libatm.la $(top_builddir)/src/ilmid/asn1/libasn1.a + + ilmid_DEPENDENCIES = $(ilmid_LDADD) + +@@ -127,8 +123,11 @@ + + DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +-TAR = gtar ++TAR = tar + GZIP_ENV = --best ++DEP_FILES = .deps/atmf_uni.P .deps/ilmid.P .deps/io.P .deps/message.P \ ++.deps/mib.P .deps/rfc1155_smi.P .deps/rfc1157_snmp.P .deps/sysgroup.P \ ++.deps/util.P + SOURCES = $(ilmid_SOURCES) + OBJECTS = $(ilmid_OBJECTS) + +@@ -136,9 +135,9 @@ + .SUFFIXES: + .SUFFIXES: .S .c .lo .o .obj .s + $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +- cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps src/ilmid/Makefile ++ cd $(top_srcdir) && $(AUTOMAKE) --gnu src/ilmid/Makefile + +-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +@@ -168,9 +167,6 @@ + rm -f $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + done + +-.c.o: +- $(COMPILE) -c $< +- + # FIXME: We should only use cygpath when building on Windows, + # and only if it is available. + .c.obj: +@@ -193,9 +189,6 @@ + + maintainer-clean-compile: + +-.c.lo: +- $(LIBTOOL) --mode=compile $(COMPILE) -c $< +- + .s.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +@@ -294,7 +287,7 @@ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ +- || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) ++ || (cd $(srcdir) && etags -o $$here/TAGS $(ETAGS_ARGS) $$tags $$unique $(LISP)) + + mostlyclean-tags: + +@@ -310,6 +303,11 @@ + subdir = src/ilmid + + distdir: $(DISTFILES) ++ here=`cd $(top_builddir) && pwd`; \ ++ top_distdir=`cd $(top_distdir) && pwd`; \ ++ distdir=`cd $(distdir) && pwd`; \ ++ cd $(top_srcdir) \ ++ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu src/ilmid/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ +@@ -330,62 +328,38 @@ + || exit 1; \ + fi; \ + done +-atmf_uni.o: atmf_uni.c ../../config.h atmf_uni.h asn1/asn_incl.h \ +- asn1/asn_config.h asn1/nibble_alloc.h asn1/sbuf.h asn1/print.h \ +- asn1/asn_len.h asn1/asn_tag.h asn1/asn_int.h asn1/asn_octs.h \ +- asn1/asn_bits.h asn1/asn_oid.h asn1/asn_null.h asn1/asn_list.h \ +- rfc1155_smi.h rfc1157_snmp.h mib.h ../../src/include/atmd.h \ +- ../../src/include/stdint.h ../../src/include/atm.h util.h +-ilmid.o: ilmid.c ../../config.h asn1/asn_incl.h asn1/asn_config.h \ +- asn1/nibble_alloc.h asn1/sbuf.h asn1/print.h asn1/asn_len.h \ +- asn1/asn_tag.h asn1/asn_int.h asn1/asn_octs.h asn1/asn_bits.h \ +- asn1/asn_oid.h asn1/asn_null.h asn1/asn_list.h rfc1155_smi.h \ +- rfc1157_snmp.h message.h util.h ../../src/include/atmd.h \ +- ../../src/include/stdint.h ../../src/include/atm.h io.h mib.h \ +- atmf_uni.h sysgroup.h +-io.o: io.c ../../config.h ../../src/include/stdint.h \ +- ../../src/include/atm.h io.h asn1/asn_incl.h asn1/asn_config.h \ +- asn1/nibble_alloc.h asn1/sbuf.h asn1/print.h asn1/asn_len.h \ +- asn1/asn_tag.h asn1/asn_int.h asn1/asn_octs.h asn1/asn_bits.h \ +- asn1/asn_oid.h asn1/asn_null.h asn1/asn_list.h rfc1155_smi.h \ +- rfc1157_snmp.h ../../src/include/atmd.h atmf_uni.h mib.h +-message.o: message.c ../../config.h message.h asn1/asn_incl.h \ +- asn1/asn_config.h asn1/nibble_alloc.h asn1/sbuf.h asn1/print.h \ +- asn1/asn_len.h asn1/asn_tag.h asn1/asn_int.h asn1/asn_octs.h \ +- asn1/asn_bits.h asn1/asn_oid.h asn1/asn_null.h asn1/asn_list.h \ +- rfc1155_smi.h rfc1157_snmp.h atmf_uni.h mib.h \ +- ../../src/include/atmd.h ../../src/include/stdint.h \ +- ../../src/include/atm.h util.h +-mib.o: mib.c ../../config.h mib.h ../../src/include/atmd.h \ +- ../../src/include/stdint.h ../../src/include/atm.h \ +- asn1/asn_incl.h asn1/asn_config.h asn1/nibble_alloc.h \ +- asn1/sbuf.h asn1/print.h asn1/asn_len.h asn1/asn_tag.h \ +- asn1/asn_int.h asn1/asn_octs.h asn1/asn_bits.h asn1/asn_oid.h \ +- asn1/asn_null.h asn1/asn_list.h rfc1155_smi.h rfc1157_snmp.h \ +- sysgroup.h atmf_uni.h util.h +-rfc1155_smi.o: rfc1155_smi.c ../../config.h asn1/asn_incl.h \ +- asn1/asn_config.h asn1/nibble_alloc.h asn1/sbuf.h asn1/print.h \ +- asn1/asn_len.h asn1/asn_tag.h asn1/asn_int.h asn1/asn_octs.h \ +- asn1/asn_bits.h asn1/asn_oid.h asn1/asn_null.h asn1/asn_list.h \ +- rfc1155_smi.h rfc1157_snmp.h +-rfc1157_snmp.o: rfc1157_snmp.c ../../config.h asn1/asn_incl.h \ +- asn1/asn_config.h asn1/nibble_alloc.h asn1/sbuf.h asn1/print.h \ +- asn1/asn_len.h asn1/asn_tag.h asn1/asn_int.h asn1/asn_octs.h \ +- asn1/asn_bits.h asn1/asn_oid.h asn1/asn_null.h asn1/asn_list.h \ +- rfc1155_smi.h rfc1157_snmp.h +-sysgroup.o: sysgroup.c ../../config.h sysgroup.h asn1/asn_incl.h \ +- asn1/asn_config.h asn1/nibble_alloc.h asn1/sbuf.h asn1/print.h \ +- asn1/asn_len.h asn1/asn_tag.h asn1/asn_int.h asn1/asn_octs.h \ +- asn1/asn_bits.h asn1/asn_oid.h asn1/asn_null.h asn1/asn_list.h \ +- rfc1155_smi.h rfc1157_snmp.h mib.h ../../src/include/atmd.h \ +- ../../src/include/stdint.h ../../src/include/atm.h +-util.o: util.c ../../config.h util.h asn1/asn_incl.h asn1/asn_config.h \ +- asn1/nibble_alloc.h asn1/sbuf.h asn1/print.h asn1/asn_len.h \ +- asn1/asn_tag.h asn1/asn_int.h asn1/asn_octs.h asn1/asn_bits.h \ +- asn1/asn_oid.h asn1/asn_null.h asn1/asn_list.h rfc1155_smi.h \ +- rfc1157_snmp.h ../../src/include/atmd.h \ +- ../../src/include/stdint.h ../../src/include/atm.h + ++DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) ++ ++-include $(DEP_FILES) ++ ++mostlyclean-depend: ++ ++clean-depend: ++ ++distclean-depend: ++ -rm -rf .deps ++ ++maintainer-clean-depend: ++ ++%.o: %.c ++ @echo '$(COMPILE) -c $<'; \ ++ $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< ++ @-cp .deps/$(*F).pp .deps/$(*F).P; \ ++ tr ' ' '\012' < .deps/$(*F).pp \ ++ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ ++ >> .deps/$(*F).P; \ ++ rm .deps/$(*F).pp ++ ++%.lo: %.c ++ @echo '$(LTCOMPILE) -c $<'; \ ++ $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< ++ @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ ++ < .deps/$(*F).pp > .deps/$(*F).P; \ ++ tr ' ' '\012' < .deps/$(*F).pp \ ++ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ ++ >> .deps/$(*F).P; \ ++ rm -f .deps/$(*F).pp + info-am: + info: info-recursive + dvi-am: +@@ -424,27 +398,27 @@ + + maintainer-clean-generic: + mostlyclean-am: mostlyclean-sbinPROGRAMS mostlyclean-compile \ +- mostlyclean-libtool mostlyclean-tags \ ++ mostlyclean-libtool mostlyclean-tags mostlyclean-depend \ + mostlyclean-generic + + mostlyclean: mostlyclean-recursive + + clean-am: clean-sbinPROGRAMS clean-compile clean-libtool clean-tags \ +- clean-generic mostlyclean-am ++ clean-depend clean-generic mostlyclean-am + + clean: clean-recursive + + distclean-am: distclean-sbinPROGRAMS distclean-compile \ +- distclean-libtool distclean-tags distclean-generic \ +- clean-am ++ distclean-libtool distclean-tags distclean-depend \ ++ distclean-generic clean-am + -rm -f libtool + + distclean: distclean-recursive + + maintainer-clean-am: maintainer-clean-sbinPROGRAMS \ + maintainer-clean-compile maintainer-clean-libtool \ +- maintainer-clean-tags maintainer-clean-generic \ +- distclean-am ++ maintainer-clean-tags maintainer-clean-depend \ ++ maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +@@ -460,12 +434,14 @@ + all-recursive check-recursive installcheck-recursive info-recursive \ + dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \ + maintainer-clean-recursive tags tags-recursive mostlyclean-tags \ +-distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ +-dvi-am dvi check check-am installcheck-am installcheck install-exec-am \ +-install-exec install-data-am install-data install-am install \ +-uninstall-am uninstall all-redirect all-am all installdirs-am \ +-installdirs mostlyclean-generic distclean-generic clean-generic \ +-maintainer-clean-generic clean mostlyclean distclean maintainer-clean ++distclean-tags clean-tags maintainer-clean-tags distdir \ ++mostlyclean-depend distclean-depend clean-depend \ ++maintainer-clean-depend info-am info dvi-am dvi check check-am \ ++installcheck-am installcheck install-exec-am install-exec \ ++install-data-am install-data install-am install uninstall-am uninstall \ ++all-redirect all-am all installdirs-am installdirs mostlyclean-generic \ ++distclean-generic clean-generic maintainer-clean-generic clean \ ++mostlyclean distclean maintainer-clean + + + # Tell versions [3.59,3.63) of GNU make to not export all variables. +--- linux-atm-2.4.1.orig/src/ilmid/io.c ++++ linux-atm-2.4.1/src/ilmid/io.c +@@ -32,6 +32,7 @@ + #include <net/if.h> + #include <atm.h> + #include <linux/atmdev.h> ++#include <unistd.h> + #include "io.h" + #include "atmd.h" + #include "atmf_uni.h" +@@ -299,4 +300,5 @@ + diag(COMPONENT,DIAG_ERROR,"ioctl ATM_GETCIRANGE: %s",strerror(errno)); + return error; + } ++ return 0; + } +--- linux-atm-2.4.1.orig/src/ilmid/atmf_uni.c ++++ linux-atm-2.4.1/src/ilmid/atmf_uni.c +@@ -187,7 +187,7 @@ + newPrefix->name = alloc_t(AsnOid); + newPrefix->name->octs = alloc(varBindName->octetLen); + AsnOidCopy(newPrefix->name, varBindName); +- Q_INSERT_BEFORE((NetPrefixNode *) var->value, newPrefix, prefix); ++ Q_INSERT_BEFORE_TYPED(var->value,(NetPrefixNode *), newPrefix, prefix); + if(atmNetPrefix.octs == NULL) + { + atmNetPrefix.octetLen = varBindName->octetLen - NETPREFIX_LEN - 2; +@@ -197,7 +197,7 @@ + } + else if (varbind->value->a.simple->a.number == INVALID && cmp == AsnOidEqual) + { +- Q_REMOVE((NetPrefixNode *) var->value, prefix); ++ Q_REMOVE(var->value, prefix); + } + + return NOERROR; +--- linux-atm-2.4.1.orig/src/ilmid/mib.c ++++ linux-atm-2.4.1/src/ilmid/mib.c +@@ -58,13 +58,13 @@ + { NULL } + }; + +-void MIBget(VarBindList *list, PDUInt *status, AsnInt *index) ++void MIBget(VarBindList *list, PDUInt *status, AsnInt *Mindex) + { + VarBind *varbind; + Variable *var; + AsnOidResult result; + +- *index = 1; ++ *Mindex = 1; + FOR_EACH_LIST_ELMT(varbind, list) + { + /* Find the first MIB object not lexigraphically less than the * +@@ -91,20 +91,20 @@ + if(*status != NOERROR) + return; + +- (*index)++; ++ (*Mindex)++; + } +- *index = 0; ++ *Mindex = 0; + return; + } + + +-void MIBgetnext(VarBindList *list, PDUInt *status, AsnInt *index) ++void MIBgetnext(VarBindList *list, PDUInt *status, AsnInt *Mindex) + { + VarBind *varbind; + Variable *var; + AsnOidResult result; + +- *index = 1; ++ *Mindex = 1; + FOR_EACH_LIST_ELMT(varbind, list) + { + /* Find the first complex MIB object not lexigraphically less than * +@@ -139,19 +139,19 @@ + if(*status != NOERROR) + return; + +- (*index)++; ++ (*Mindex)++; + } +- *index = 0; ++ *Mindex = 0; + return; + } + +-void MIBset(VarBindList *list, PDUInt *status, AsnInt *index) ++void MIBset(VarBindList *list, PDUInt *status, AsnInt *Mindex) + { + VarBind *varbind; + Variable *var; + AsnOidResult result; + +- *index = 1; ++ *Mindex = 1; + FOR_EACH_LIST_ELMT(varbind, list) + { + /* Find the first MIB object not lexigraphically less than the * +@@ -182,9 +182,9 @@ + if(*status != NOERROR) + return; + +- (*index)++; ++ (*Mindex)++; + } +- *index = 0; ++ *Mindex = 0; + return; + } + +--- linux-atm-2.4.1.orig/src/ilmid/mib.h ++++ linux-atm-2.4.1/src/ilmid/mib.h +@@ -39,9 +39,9 @@ + void *value; + } Variable; + +-void MIBget(VarBindList *list, PDUInt *status, AsnInt *index); +-void MIBgetnext(VarBindList *list, PDUInt *status, AsnInt *index); +-void MIBset(VarBindList *list, PDUInt *status, AsnInt *index); ++void MIBget(VarBindList *list, PDUInt *status, AsnInt *Mindex); ++void MIBgetnext(VarBindList *list, PDUInt *status, AsnInt *Mindex); ++void MIBset(VarBindList *list, PDUInt *status, AsnInt *Mindex); + void *MIBdelete(AsnOid *oid); + + AsnInt getString(VarBind *varbind, Variable *var); +--- linux-atm-2.4.1.orig/src/ilmid/ilmid.c ++++ linux-atm-2.4.1/src/ilmid/ilmid.c +@@ -33,6 +33,7 @@ + #include <config.h> + #endif + ++#include <stdlib.h> + #include <unistd.h> + #include <sys/time.h> + #include <errno.h> +--- linux-atm-2.4.1.orig/src/ilmid/asn1/Makefile.in ++++ linux-atm-2.4.1/src/ilmid/asn1/Makefile.in +@@ -1,4 +1,4 @@ +-# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am ++# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am + + # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation +@@ -87,13 +87,7 @@ + + noinst_LIBRARIES = libasn1.a + +-libasn1_a_SOURCES = asn_len.c asn_len.h asn_tag.c asn_tag.h \ +- asn_int.c asn_int.h asn_octs.c asn_octs.h \ +- asn_bits.c asn_bits.h str_stk.c str_stk.h \ +- asn_oid.c asn_oid.h asn_null.c asn_null.h \ +- asn_list.c asn_list.h nibble_alloc.c nibble_alloc.h \ +- print.c print.h \ +- asn_config.h min_buf.h sbuf.h exp_buf.h ++libasn1_a_SOURCES = asn_len.c asn_len.h asn_tag.c asn_tag.h asn_int.c asn_int.h asn_octs.c asn_octs.h asn_bits.c asn_bits.h str_stk.c str_stk.h asn_oid.c asn_oid.h asn_null.c asn_null.h asn_list.c asn_list.h nibble_alloc.c nibble_alloc.h print.c print.h asn_config.h min_buf.h sbuf.h exp_buf.h + + + EXTRA_libasn1_a_SOURCES = asn_incl.h exp_buf.c +@@ -125,8 +119,12 @@ + + DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +-TAR = gtar ++TAR = tar + GZIP_ENV = --best ++DEP_FILES = .deps/asn_bits.P .deps/asn_int.P .deps/asn_len.P \ ++.deps/asn_list.P .deps/asn_null.P .deps/asn_octs.P .deps/asn_oid.P \ ++.deps/asn_tag.P .deps/exp_buf.P .deps/nibble_alloc.P .deps/print.P \ ++.deps/str_stk.P + SOURCES = $(libasn1_a_SOURCES) $(EXTRA_libasn1_a_SOURCES) + OBJECTS = $(libasn1_a_OBJECTS) + +@@ -134,9 +132,9 @@ + .SUFFIXES: + .SUFFIXES: .S .c .lo .o .obj .s + $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +- cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps src/ilmid/asn1/Makefile ++ cd $(top_srcdir) && $(AUTOMAKE) --gnu src/ilmid/asn1/Makefile + +-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +@@ -150,9 +148,6 @@ + + maintainer-clean-noinstLIBRARIES: + +-.c.o: +- $(COMPILE) -c $< +- + # FIXME: We should only use cygpath when building on Windows, + # and only if it is available. + .c.obj: +@@ -175,9 +170,6 @@ + + maintainer-clean-compile: + +-.c.lo: +- $(LIBTOOL) --mode=compile $(COMPILE) -c $< +- + .s.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +@@ -217,7 +209,7 @@ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ +- || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) ++ || (cd $(srcdir) && etags -o $$here/TAGS $(ETAGS_ARGS) $$tags $$unique $(LISP)) + + mostlyclean-tags: + +@@ -233,6 +225,11 @@ + subdir = src/ilmid/asn1 + + distdir: $(DISTFILES) ++ here=`cd $(top_builddir) && pwd`; \ ++ top_distdir=`cd $(top_distdir) && pwd`; \ ++ distdir=`cd $(distdir) && pwd`; \ ++ cd $(top_srcdir) \ ++ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu src/ilmid/asn1/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ +@@ -243,30 +240,38 @@ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done +-asn_bits.o: asn_bits.c ../../../config.h asn_config.h nibble_alloc.h \ +- sbuf.h print.h asn_len.h asn_tag.h str_stk.h asn_bits.h +-asn_int.o: asn_int.c ../../../config.h asn_config.h nibble_alloc.h \ +- sbuf.h print.h asn_len.h asn_tag.h asn_int.h +-asn_len.o: asn_len.c ../../../config.h asn_config.h nibble_alloc.h \ +- sbuf.h print.h asn_len.h +-asn_list.o: asn_list.c ../../../config.h asn_config.h nibble_alloc.h \ +- sbuf.h print.h asn_list.h +-asn_null.o: asn_null.c ../../../config.h asn_config.h nibble_alloc.h \ +- sbuf.h print.h asn_len.h asn_tag.h asn_null.h +-asn_octs.o: asn_octs.c ../../../config.h asn_config.h nibble_alloc.h \ +- sbuf.h print.h asn_len.h asn_tag.h str_stk.h asn_bits.h \ +- asn_octs.h +-asn_oid.o: asn_oid.c ../../../config.h asn_config.h nibble_alloc.h \ +- sbuf.h print.h asn_len.h asn_tag.h asn_octs.h asn_oid.h +-asn_tag.o: asn_tag.c ../../../config.h asn_config.h nibble_alloc.h \ +- sbuf.h print.h asn_len.h asn_tag.h +-nibble_alloc.o: nibble_alloc.c ../../../config.h asn_config.h \ +- nibble_alloc.h sbuf.h print.h +-print.o: print.c ../../../config.h asn_config.h nibble_alloc.h sbuf.h \ +- print.h +-str_stk.o: str_stk.c ../../../config.h asn_config.h nibble_alloc.h \ +- sbuf.h print.h str_stk.h + ++DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) ++ ++-include $(DEP_FILES) ++ ++mostlyclean-depend: ++ ++clean-depend: ++ ++distclean-depend: ++ -rm -rf .deps ++ ++maintainer-clean-depend: ++ ++%.o: %.c ++ @echo '$(COMPILE) -c $<'; \ ++ $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< ++ @-cp .deps/$(*F).pp .deps/$(*F).P; \ ++ tr ' ' '\012' < .deps/$(*F).pp \ ++ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ ++ >> .deps/$(*F).P; \ ++ rm .deps/$(*F).pp ++ ++%.lo: %.c ++ @echo '$(LTCOMPILE) -c $<'; \ ++ $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< ++ @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ ++ < .deps/$(*F).pp > .deps/$(*F).P; \ ++ tr ' ' '\012' < .deps/$(*F).pp \ ++ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ ++ >> .deps/$(*F).P; \ ++ rm -f .deps/$(*F).pp + info-am: + info: info-am + dvi-am: +@@ -303,27 +308,27 @@ + + maintainer-clean-generic: + mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \ +- mostlyclean-libtool mostlyclean-tags \ ++ mostlyclean-libtool mostlyclean-tags mostlyclean-depend \ + mostlyclean-generic + + mostlyclean: mostlyclean-am + + clean-am: clean-noinstLIBRARIES clean-compile clean-libtool clean-tags \ +- clean-generic mostlyclean-am ++ clean-depend clean-generic mostlyclean-am + + clean: clean-am + + distclean-am: distclean-noinstLIBRARIES distclean-compile \ +- distclean-libtool distclean-tags distclean-generic \ +- clean-am ++ distclean-libtool distclean-tags distclean-depend \ ++ distclean-generic clean-am + -rm -f libtool + + distclean: distclean-am + + maintainer-clean-am: maintainer-clean-noinstLIBRARIES \ + maintainer-clean-compile maintainer-clean-libtool \ +- maintainer-clean-tags maintainer-clean-generic \ +- distclean-am ++ maintainer-clean-tags maintainer-clean-depend \ ++ maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +@@ -334,12 +339,14 @@ + mostlyclean-compile distclean-compile clean-compile \ + maintainer-clean-compile mostlyclean-libtool distclean-libtool \ + clean-libtool maintainer-clean-libtool tags mostlyclean-tags \ +-distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ +-dvi-am dvi check check-am installcheck-am installcheck install-exec-am \ +-install-exec install-data-am install-data install-am install \ +-uninstall-am uninstall all-redirect all-am all installdirs \ +-mostlyclean-generic distclean-generic clean-generic \ +-maintainer-clean-generic clean mostlyclean distclean maintainer-clean ++distclean-tags clean-tags maintainer-clean-tags distdir \ ++mostlyclean-depend distclean-depend clean-depend \ ++maintainer-clean-depend info-am info dvi-am dvi check check-am \ ++installcheck-am installcheck install-exec-am install-exec \ ++install-data-am install-data install-am install uninstall-am uninstall \ ++all-redirect all-am all installdirs mostlyclean-generic \ ++distclean-generic clean-generic maintainer-clean-generic clean \ ++mostlyclean distclean maintainer-clean + + + # Tell versions [3.59,3.63) of GNU make to not export all variables. +--- linux-atm-2.4.1.orig/src/ilmid/asn1/asn_int.c ++++ linux-atm-2.4.1/src/ilmid/asn1/asn_int.c +@@ -185,7 +185,7 @@ + AsnInt* v _AND_ + unsigned short int indent) + { +- fprintf(f,"%d", *v); ++ fprintf(f,"%ld", *v); + } + + +@@ -252,7 +252,6 @@ + UAsnInt* data) + { + int len; +- int retLen; + int i; + unsigned long int mask; + unsigned long int dataCpy; +@@ -370,5 +369,5 @@ + UAsnInt* v _AND_ + unsigned short int indent) + { +- fprintf(f,"%u", *v); ++ fprintf(f,"%lu", *v); + } +--- linux-atm-2.4.1.orig/src/ilmid/asn1/asn_octs.c ++++ linux-atm-2.4.1/src/ilmid/asn1/asn_octs.c +@@ -21,6 +21,9 @@ + #include <config.h> + #endif + ++#include <stdlib.h> ++#include <string.h> ++ + #include "asn_config.h" + #include "asn_len.h" + #include "asn_tag.h" +--- linux-atm-2.4.1.orig/src/ilmid/asn1/asn_bits.c ++++ linux-atm-2.4.1/src/ilmid/asn1/asn_bits.c +@@ -21,6 +21,9 @@ + #include <config.h> + #endif + ++#include <stdlib.h> ++#include <string.h> ++ + #include "asn_config.h" + #include "asn_len.h" + #include "asn_tag.h" +--- linux-atm-2.4.1.orig/src/ilmid/asn1/asn_oid.c ++++ linux-atm-2.4.1/src/ilmid/asn1/asn_oid.c +@@ -21,6 +21,9 @@ + #include <config.h> + #endif + ++#include <stdlib.h> ++#include <string.h> ++ + #include "asn_config.h" + #include "asn_len.h" + #include "asn_tag.h" +@@ -125,7 +128,7 @@ + if (firstArcNum > 2) + firstArcNum = 2; + +- fprintf(f,"%u %u", firstArcNum, arcNum - (firstArcNum * 40)); ++ fprintf(f,"%d %lu", firstArcNum, arcNum - (firstArcNum * 40)); + + for (; i < v->octetLen ; ) + { +@@ -134,7 +137,7 @@ + + arcNum = (arcNum << 7) + (v->octs[i] & 0x7f); + i++; +- fprintf(f," %u", arcNum); ++ fprintf(f," %lu", arcNum); + } + fprintf(f,"}"); + +--- linux-atm-2.4.1.orig/src/ilmid/asn1/asn_list.c ++++ linux-atm-2.4.1/src/ilmid/asn1/asn_list.c +@@ -20,6 +20,8 @@ + #include <config.h> + #endif + ++#include <stdlib.h> ++ + #include "asn_config.h" + #include "asn_list.h" + +--- linux-atm-2.4.1.orig/src/ilmid/asn1/nibble_alloc.c ++++ linux-atm-2.4.1/src/ilmid/asn1/nibble_alloc.c +@@ -20,7 +20,9 @@ + #include <config.h> + #endif + ++#include <string.h> + #include <memory.h> ++#include <stdlib.h> + #include "asn_config.h" + #include "nibble_alloc.h" + +--- linux-atm-2.4.1.orig/src/ilmid/asn1/nibble_alloc.h ++++ linux-atm-2.4.1/src/ilmid/asn1/nibble_alloc.h +@@ -39,13 +39,13 @@ + void InitNibbleMem PROTO((unsigned long int initialSize, + unsigned long int incrementSize)); + +-void ShutdownNibbleMem(); ++void ShutdownNibbleMem(void); + + void ServiceNibbleFault PROTO((unsigned long int size)); + + void* NibbleAlloc PROTO((unsigned long int size)); + +-void ResetNibbleMem(); ++void ResetNibbleMem(void); + + + #endif /* conditional include */ +--- linux-atm-2.4.1.orig/src/man/Makefile.in ++++ linux-atm-2.4.1/src/man/Makefile.in +@@ -1,4 +1,4 @@ +-# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am ++# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am + + # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation +@@ -100,14 +100,14 @@ + + DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +-TAR = gtar ++TAR = tar + GZIP_ENV = --best + all: all-redirect + .SUFFIXES: + $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +- cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps src/man/Makefile ++ cd $(top_srcdir) && $(AUTOMAKE) --gnu src/man/Makefile + +-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +@@ -159,6 +159,11 @@ + subdir = src/man + + distdir: $(DISTFILES) ++ here=`cd $(top_builddir) && pwd`; \ ++ top_distdir=`cd $(top_distdir) && pwd`; \ ++ distdir=`cd $(distdir) && pwd`; \ ++ cd $(top_srcdir) \ ++ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu src/man/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ +--- linux-atm-2.4.1.orig/src/led/Makefile.in ++++ linux-atm-2.4.1/src/led/Makefile.in +@@ -1,4 +1,4 @@ +-# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am ++# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am + + # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation +@@ -87,9 +87,7 @@ + + sbin_PROGRAMS = zeppelin + +-zeppelin_SOURCES = join.c join.h conn.c conn.h main.c address.c address.h \ +- frames.c frames.h display.c display.h \ +- kernel.c kernel.h frame_defs.h lec.h ++zeppelin_SOURCES = join.c join.h conn.c conn.h main.c address.c address.h frames.c frames.h display.c display.h kernel.c kernel.h frame_defs.h lec.h + + zeppelin_LDADD = $(top_builddir)/src/lib/libatm.la + zeppelin_DEPENDENCIES = $(zeppelin_LDADD) +@@ -125,8 +123,10 @@ + + DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +-TAR = gtar ++TAR = tar + GZIP_ENV = --best ++DEP_FILES = .deps/address.P .deps/conn.P .deps/display.P .deps/frames.P \ ++.deps/join.P .deps/kernel.P .deps/main.P + SOURCES = $(zeppelin_SOURCES) + OBJECTS = $(zeppelin_OBJECTS) + +@@ -134,9 +134,9 @@ + .SUFFIXES: + .SUFFIXES: .S .c .lo .o .obj .s + $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +- cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps src/led/Makefile ++ cd $(top_srcdir) && $(AUTOMAKE) --gnu src/led/Makefile + +-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +@@ -166,9 +166,6 @@ + rm -f $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + done + +-.c.o: +- $(COMPILE) -c $< +- + # FIXME: We should only use cygpath when building on Windows, + # and only if it is available. + .c.obj: +@@ -191,9 +188,6 @@ + + maintainer-clean-compile: + +-.c.lo: +- $(LIBTOOL) --mode=compile $(COMPILE) -c $< +- + .s.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +@@ -271,7 +265,7 @@ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ +- || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) ++ || (cd $(srcdir) && etags -o $$here/TAGS $(ETAGS_ARGS) $$tags $$unique $(LISP)) + + mostlyclean-tags: + +@@ -287,6 +281,11 @@ + subdir = src/led + + distdir: $(DISTFILES) ++ here=`cd $(top_builddir) && pwd`; \ ++ top_distdir=`cd $(top_distdir) && pwd`; \ ++ distdir=`cd $(distdir) && pwd`; \ ++ cd $(top_srcdir) \ ++ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu src/led/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ +@@ -297,28 +296,38 @@ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done +-address.o: address.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h ../../src/include/atmd.h address.h +-conn.o: conn.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h ../../src/include/atmsap.h \ +- ../../src/include/atmd.h conn.h display.h lec.h frames.h \ +- frame_defs.h kernel.h +-display.o: display.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h ../../src/include/atmd.h display.h \ +- frame_defs.h +-frames.o: frames.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h ../../src/include/atmd.h conn.h \ +- lec.h frames.h frame_defs.h display.h kernel.h +-join.o: join.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h ../../src/include/atmd.h conn.h \ +- lec.h join.h frames.h frame_defs.h display.h +-kernel.o: kernel.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h ../../src/include/atmd.h kernel.h \ +- lec.h conn.h frames.h frame_defs.h +-main.o: main.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h ../../src/include/atmd.h join.h \ +- lec.h conn.h address.h display.h kernel.h + ++DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) ++ ++-include $(DEP_FILES) ++ ++mostlyclean-depend: ++ ++clean-depend: ++ ++distclean-depend: ++ -rm -rf .deps ++ ++maintainer-clean-depend: ++ ++%.o: %.c ++ @echo '$(COMPILE) -c $<'; \ ++ $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< ++ @-cp .deps/$(*F).pp .deps/$(*F).P; \ ++ tr ' ' '\012' < .deps/$(*F).pp \ ++ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ ++ >> .deps/$(*F).P; \ ++ rm .deps/$(*F).pp ++ ++%.lo: %.c ++ @echo '$(LTCOMPILE) -c $<'; \ ++ $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< ++ @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ ++ < .deps/$(*F).pp > .deps/$(*F).P; \ ++ tr ' ' '\012' < .deps/$(*F).pp \ ++ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ ++ >> .deps/$(*F).P; \ ++ rm -f .deps/$(*F).pp + info-am: + info: info-am + dvi-am: +@@ -356,27 +365,27 @@ + + maintainer-clean-generic: + mostlyclean-am: mostlyclean-sbinPROGRAMS mostlyclean-compile \ +- mostlyclean-libtool mostlyclean-tags \ ++ mostlyclean-libtool mostlyclean-tags mostlyclean-depend \ + mostlyclean-generic + + mostlyclean: mostlyclean-am + + clean-am: clean-sbinPROGRAMS clean-compile clean-libtool clean-tags \ +- clean-generic mostlyclean-am ++ clean-depend clean-generic mostlyclean-am + + clean: clean-am + + distclean-am: distclean-sbinPROGRAMS distclean-compile \ +- distclean-libtool distclean-tags distclean-generic \ +- clean-am ++ distclean-libtool distclean-tags distclean-depend \ ++ distclean-generic clean-am + -rm -f libtool + + distclean: distclean-am + + maintainer-clean-am: maintainer-clean-sbinPROGRAMS \ + maintainer-clean-compile maintainer-clean-libtool \ +- maintainer-clean-tags maintainer-clean-generic \ +- distclean-am ++ maintainer-clean-tags maintainer-clean-depend \ ++ maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +@@ -388,12 +397,14 @@ + clean-compile maintainer-clean-compile mostlyclean-libtool \ + distclean-libtool clean-libtool maintainer-clean-libtool install-man8 \ + uninstall-man8 install-man uninstall-man tags mostlyclean-tags \ +-distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ +-dvi-am dvi check check-am installcheck-am installcheck install-exec-am \ +-install-exec install-data-am install-data install-am install \ +-uninstall-am uninstall all-redirect all-am all installdirs \ +-mostlyclean-generic distclean-generic clean-generic \ +-maintainer-clean-generic clean mostlyclean distclean maintainer-clean ++distclean-tags clean-tags maintainer-clean-tags distdir \ ++mostlyclean-depend distclean-depend clean-depend \ ++maintainer-clean-depend info-am info dvi-am dvi check check-am \ ++installcheck-am installcheck install-exec-am install-exec \ ++install-data-am install-data install-am install uninstall-am uninstall \ ++all-redirect all-am all installdirs mostlyclean-generic \ ++distclean-generic clean-generic maintainer-clean-generic clean \ ++mostlyclean distclean maintainer-clean + + + # Tell versions [3.59,3.63) of GNU make to not export all variables. +--- linux-atm-2.4.1.orig/src/lane/Makefile.in ++++ linux-atm-2.4.1/src/lane/Makefile.in +@@ -1,4 +1,4 @@ +-# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am ++# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am + + # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation +@@ -89,14 +89,11 @@ + + LDADD = $(top_builddir)/src/lib/libatm.la + +-LES_BUS_SRCS = mem.c mem.h load.c load.h units.c units.h load_lex.l load_lex.h \ +- timers.c timers.h dump.c dump.h lane_atm.c lane_atm.h \ +- events.c events.h lane.c lane.h ++LES_BUS_SRCS = mem.c mem.h load.c load.h units.c units.h load_lex.l load_lex.h timers.c timers.h dump.c dump.h lane_atm.c lane_atm.h events.c events.h lane.c lane.h + + les_SOURCES = $(LES_BUS_SRCS) packet.c packet.h connect.c connect.h db.c db.h + bus_SOURCES = $(LES_BUS_SRCS) connect_bus.c +-lecs_SOURCES = lecs_db.l lecs_db.h lecs_load.c lecs_load.h lecs.c lecs.h \ +- ldb.c ldb.h mem_lecs.c mem_lecs.h atm_lecs.c atm_lecs.h ++lecs_SOURCES = lecs_db.l lecs_db.h lecs_load.c lecs_load.h lecs.c lecs.h ldb.c ldb.h mem_lecs.c mem_lecs.h atm_lecs.c atm_lecs.h + + + man_MANS = les.8 lecs.8 bus.8 +@@ -148,8 +145,13 @@ + + DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +-TAR = gtar ++TAR = tar + GZIP_ENV = --best ++DEP_FILES = .deps/atm_lecs.P .deps/connect.P .deps/connect_bus.P \ ++.deps/db.P .deps/dump.P .deps/events.P .deps/lane.P .deps/lane_atm.P \ ++.deps/ldb.P .deps/lecs.P .deps/lecs_db.P .deps/lecs_load.P .deps/load.P \ ++.deps/load_lex.P .deps/mem.P .deps/mem_lecs.P .deps/packet.P \ ++.deps/timers.P .deps/units.P + SOURCES = $(les_SOURCES) $(bus_SOURCES) $(lecs_SOURCES) + OBJECTS = $(les_OBJECTS) $(bus_OBJECTS) $(lecs_OBJECTS) + +@@ -157,9 +159,9 @@ + .SUFFIXES: + .SUFFIXES: .S .c .l .lo .o .obj .s + $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +- cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps src/lane/Makefile ++ cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lane/Makefile + +-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +@@ -189,9 +191,6 @@ + rm -f $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + done + +-.c.o: +- $(COMPILE) -c $< +- + # FIXME: We should only use cygpath when building on Windows, + # and only if it is available. + .c.obj: +@@ -214,9 +213,6 @@ + + maintainer-clean-compile: + +-.c.lo: +- $(LIBTOOL) --mode=compile $(COMPILE) -c $< +- + .s.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +@@ -304,7 +300,7 @@ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ +- || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) ++ || (cd $(srcdir) && etags -o $$here/TAGS $(ETAGS_ARGS) $$tags $$unique $(LISP)) + + mostlyclean-tags: + +@@ -320,6 +316,11 @@ + subdir = src/lane + + distdir: $(DISTFILES) ++ here=`cd $(top_builddir) && pwd`; \ ++ top_distdir=`cd $(top_distdir) && pwd`; \ ++ distdir=`cd $(distdir) && pwd`; \ ++ cd $(top_srcdir) \ ++ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu src/lane/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ +@@ -330,62 +331,38 @@ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done +-atm_lecs.o: atm_lecs.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h ../../src/include/atmsap.h \ +- atm_lecs.h +-connect.o: connect.c ../../config.h ../../src/include/stdint.h mem.h \ +- units.h lane.h dump.h ../../src/include/atm.h \ +- ../../src/include/atmsap.h load.h connect.h timers.h events.h \ +- db.h packet.h lane_atm.h +-connect_bus.o: connect_bus.c ../../config.h ../../src/include/stdint.h \ +- mem.h units.h lane.h dump.h ../../src/include/atm.h \ +- ../../src/include/atmsap.h load.h connect.h timers.h events.h \ +- lane_atm.h +-db.o: db.c ../../config.h ../../src/include/stdint.h mem.h units.h \ +- lane.h dump.h ../../src/include/atm.h \ +- ../../src/include/atmsap.h load.h connect.h timers.h events.h \ +- db.h +-dump.o: dump.c ../../config.h ../../src/include/stdint.h \ +- ../../src/include/atm.h ../../src/include/atmsap.h dump.h \ +- units.h lane.h load.h +-events.o: events.c ../../config.h events.h units.h load.h lane.h dump.h \ +- ../../src/include/atm.h ../../src/include/stdint.h \ +- ../../src/include/atmsap.h mem.h timers.h connect.h +-lane.o: lane.c ../../config.h units.h load.h lane.h dump.h \ +- ../../src/include/atm.h ../../src/include/stdint.h \ +- ../../src/include/atmsap.h mem.h connect.h timers.h events.h +-lane_atm.o: lane_atm.c ../../config.h lane_atm.h units.h lane.h \ +- connect.h timers.h load.h events.h ../../src/include/atmsap.h \ +- ../../src/include/stdint.h dump.h ../../src/include/atm.h mem.h +-ldb.o: ldb.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h lecs.h ldb.h mem_lecs.h +-lecs.o: lecs.c ../../config.h ../../src/include/stdint.h \ +- ../../src/include/atm.h lecs_load.h ldb.h mem_lecs.h lecs.h \ +- atm_lecs.h +-lecs_db.o: lecs_db.c ../../config.h lecs_load.h lecs_db.h +-lecs_load.o: lecs_load.c ../../config.h lecs_load.h lecs_db.h ldb.h \ +- lecs.h +-load.o: load.c ../../config.h load.h units.h lane.h dump.h \ +- ../../src/include/atm.h ../../src/include/stdint.h \ +- ../../src/include/atmsap.h mem.h load_lex.h +-load_lex.o: load_lex.c ../../config.h ../../src/include/stdint.h \ +- load_lex.h lane.h units.h load.h mem.h +-mem.o: mem.c ../../config.h mem.h units.h dump.h ../../src/include/atm.h \ +- ../../src/include/stdint.h ../../src/include/atmsap.h lane.h \ +- load.h +-mem_lecs.o: mem_lecs.c ../../config.h mem_lecs.h +-packet.o: packet.c ../../config.h ../../src/include/stdint.h mem.h \ +- units.h lane.h dump.h ../../src/include/atm.h \ +- ../../src/include/atmsap.h load.h connect.h timers.h events.h \ +- db.h packet.h +-timers.o: timers.c ../../config.h timers.h units.h load.h lane.h dump.h \ +- ../../src/include/atm.h ../../src/include/stdint.h \ +- ../../src/include/atmsap.h mem.h +-units.o: units.c ../../config.h units.h mem.h lane.h load.h dump.h \ +- ../../src/include/atm.h ../../src/include/stdint.h \ +- ../../src/include/atmsap.h connect.h timers.h events.h \ +- lane_atm.h + ++DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) ++ ++-include $(DEP_FILES) ++ ++mostlyclean-depend: ++ ++clean-depend: ++ ++distclean-depend: ++ -rm -rf .deps ++ ++maintainer-clean-depend: ++ ++%.o: %.c ++ @echo '$(COMPILE) -c $<'; \ ++ $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< ++ @-cp .deps/$(*F).pp .deps/$(*F).P; \ ++ tr ' ' '\012' < .deps/$(*F).pp \ ++ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ ++ >> .deps/$(*F).P; \ ++ rm .deps/$(*F).pp ++ ++%.lo: %.c ++ @echo '$(LTCOMPILE) -c $<'; \ ++ $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< ++ @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ ++ < .deps/$(*F).pp > .deps/$(*F).P; \ ++ tr ' ' '\012' < .deps/$(*F).pp \ ++ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ ++ >> .deps/$(*F).P; \ ++ rm -f .deps/$(*F).pp + info-am: + info: info-am + dvi-am: +@@ -422,29 +399,29 @@ + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + + maintainer-clean-generic: +- -test -z "lecs_dblload_lexl" || rm -f lecs_dbl load_lexl ++ -test -z "lecs_dbcload_lexc" || rm -f lecs_dbc load_lexc + mostlyclean-am: mostlyclean-sbinPROGRAMS mostlyclean-compile \ +- mostlyclean-libtool mostlyclean-tags \ ++ mostlyclean-libtool mostlyclean-tags mostlyclean-depend \ + mostlyclean-generic + + mostlyclean: mostlyclean-am + + clean-am: clean-sbinPROGRAMS clean-compile clean-libtool clean-tags \ +- clean-generic mostlyclean-am ++ clean-depend clean-generic mostlyclean-am + + clean: clean-am + + distclean-am: distclean-sbinPROGRAMS distclean-compile \ +- distclean-libtool distclean-tags distclean-generic \ +- clean-am ++ distclean-libtool distclean-tags distclean-depend \ ++ distclean-generic clean-am + -rm -f libtool + + distclean: distclean-am + + maintainer-clean-am: maintainer-clean-sbinPROGRAMS \ + maintainer-clean-compile maintainer-clean-libtool \ +- maintainer-clean-tags maintainer-clean-generic \ +- distclean-am ++ maintainer-clean-tags maintainer-clean-depend \ ++ maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +@@ -456,12 +433,14 @@ + clean-compile maintainer-clean-compile mostlyclean-libtool \ + distclean-libtool clean-libtool maintainer-clean-libtool install-man8 \ + uninstall-man8 install-man uninstall-man tags mostlyclean-tags \ +-distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ +-dvi-am dvi check check-am installcheck-am installcheck install-exec-am \ +-install-exec install-data-am install-data install-am install \ +-uninstall-am uninstall all-redirect all-am all installdirs \ +-mostlyclean-generic distclean-generic clean-generic \ +-maintainer-clean-generic clean mostlyclean distclean maintainer-clean ++distclean-tags clean-tags maintainer-clean-tags distdir \ ++mostlyclean-depend distclean-depend clean-depend \ ++maintainer-clean-depend info-am info dvi-am dvi check check-am \ ++installcheck-am installcheck install-exec-am install-exec \ ++install-data-am install-data install-am install uninstall-am uninstall \ ++all-redirect all-am all installdirs mostlyclean-generic \ ++distclean-generic clean-generic maintainer-clean-generic clean \ ++mostlyclean distclean maintainer-clean + + + # Tell versions [3.59,3.63) of GNU make to not export all variables. +--- linux-atm-2.4.1.orig/src/mpoad/Makefile.in ++++ linux-atm-2.4.1/src/mpoad/Makefile.in +@@ -1,4 +1,4 @@ +-# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am ++# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am + + # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation +@@ -89,9 +89,7 @@ + + LDADD = $(top_builddir)/src/lib/libatm.la + +-mpcd_SOURCES = get_vars.c get_vars.h io.c io.h k_interf.c k_interf.h main.c \ +- p_factory.c p_recogn.c id_list.c tag_list.c \ +- poll2select.c poll2select.h lecs.c lecs.h packets.h ++mpcd_SOURCES = get_vars.c get_vars.h io.c io.h k_interf.c k_interf.h main.c p_factory.c p_recogn.c id_list.c tag_list.c poll2select.c poll2select.h lecs.c lecs.h packets.h + + + man_MANS = mpcd.8 +@@ -128,8 +126,11 @@ + + DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +-TAR = gtar ++TAR = tar + GZIP_ENV = --best ++DEP_FILES = .deps/get_vars.P .deps/id_list.P .deps/io.P \ ++.deps/k_interf.P .deps/lecs.P .deps/main.P .deps/p_factory.P \ ++.deps/p_recogn.P .deps/poll2select.P .deps/tag_list.P + SOURCES = $(mpcd_SOURCES) + OBJECTS = $(mpcd_OBJECTS) + +@@ -137,9 +138,9 @@ + .SUFFIXES: + .SUFFIXES: .S .c .lo .o .obj .s + $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +- cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps src/mpoad/Makefile ++ cd $(top_srcdir) && $(AUTOMAKE) --gnu src/mpoad/Makefile + +-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +@@ -169,9 +170,6 @@ + rm -f $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + done + +-.c.o: +- $(COMPILE) -c $< +- + # FIXME: We should only use cygpath when building on Windows, + # and only if it is available. + .c.obj: +@@ -194,9 +192,6 @@ + + maintainer-clean-compile: + +-.c.lo: +- $(LIBTOOL) --mode=compile $(COMPILE) -c $< +- + .s.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +@@ -274,7 +269,7 @@ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ +- || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) ++ || (cd $(srcdir) && etags -o $$here/TAGS $(ETAGS_ARGS) $$tags $$unique $(LISP)) + + mostlyclean-tags: + +@@ -290,6 +285,11 @@ + subdir = src/mpoad + + distdir: $(DISTFILES) ++ here=`cd $(top_builddir) && pwd`; \ ++ top_distdir=`cd $(top_distdir) && pwd`; \ ++ distdir=`cd $(distdir) && pwd`; \ ++ cd $(top_srcdir) \ ++ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu src/mpoad/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ +@@ -300,29 +300,38 @@ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done +-get_vars.o: get_vars.c ../../config.h ../../src/include/stdint.h \ +- ../../src/include/atm.h packets.h get_vars.h io.h +-id_list.o: id_list.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h packets.h +-io.o: io.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h packets.h k_interf.h io.h get_vars.h \ +- poll2select.h +-k_interf.o: k_interf.c ../../config.h ../../src/include/stdint.h \ +- ../../src/include/atm.h k_interf.h packets.h io.h get_vars.h +-lecs.o: lecs.c ../../config.h ../../src/include/stdint.h \ +- ../../src/include/atm.h ../../src/include/atmsap.h lecs.h \ +- k_interf.h +-main.o: main.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h packets.h io.h k_interf.h get_vars.h \ +- lecs.h +-p_factory.o: p_factory.c ../../config.h ../../src/include/stdint.h \ +- ../../src/include/atm.h packets.h get_vars.h io.h +-p_recogn.o: p_recogn.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h io.h k_interf.h packets.h +-poll2select.o: poll2select.c ../../config.h +-tag_list.o: tag_list.c ../../config.h packets.h ../../src/include/atm.h \ +- ../../src/include/stdint.h + ++DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) ++ ++-include $(DEP_FILES) ++ ++mostlyclean-depend: ++ ++clean-depend: ++ ++distclean-depend: ++ -rm -rf .deps ++ ++maintainer-clean-depend: ++ ++%.o: %.c ++ @echo '$(COMPILE) -c $<'; \ ++ $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< ++ @-cp .deps/$(*F).pp .deps/$(*F).P; \ ++ tr ' ' '\012' < .deps/$(*F).pp \ ++ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ ++ >> .deps/$(*F).P; \ ++ rm .deps/$(*F).pp ++ ++%.lo: %.c ++ @echo '$(LTCOMPILE) -c $<'; \ ++ $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< ++ @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ ++ < .deps/$(*F).pp > .deps/$(*F).P; \ ++ tr ' ' '\012' < .deps/$(*F).pp \ ++ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ ++ >> .deps/$(*F).P; \ ++ rm -f .deps/$(*F).pp + info-am: + info: info-am + dvi-am: +@@ -360,27 +369,27 @@ + + maintainer-clean-generic: + mostlyclean-am: mostlyclean-sbinPROGRAMS mostlyclean-compile \ +- mostlyclean-libtool mostlyclean-tags \ ++ mostlyclean-libtool mostlyclean-tags mostlyclean-depend \ + mostlyclean-generic + + mostlyclean: mostlyclean-am + + clean-am: clean-sbinPROGRAMS clean-compile clean-libtool clean-tags \ +- clean-generic mostlyclean-am ++ clean-depend clean-generic mostlyclean-am + + clean: clean-am + + distclean-am: distclean-sbinPROGRAMS distclean-compile \ +- distclean-libtool distclean-tags distclean-generic \ +- clean-am ++ distclean-libtool distclean-tags distclean-depend \ ++ distclean-generic clean-am + -rm -f libtool + + distclean: distclean-am + + maintainer-clean-am: maintainer-clean-sbinPROGRAMS \ + maintainer-clean-compile maintainer-clean-libtool \ +- maintainer-clean-tags maintainer-clean-generic \ +- distclean-am ++ maintainer-clean-tags maintainer-clean-depend \ ++ maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +@@ -392,12 +401,14 @@ + clean-compile maintainer-clean-compile mostlyclean-libtool \ + distclean-libtool clean-libtool maintainer-clean-libtool install-man8 \ + uninstall-man8 install-man uninstall-man tags mostlyclean-tags \ +-distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ +-dvi-am dvi check check-am installcheck-am installcheck install-exec-am \ +-install-exec install-data-am install-data install-am install \ +-uninstall-am uninstall all-redirect all-am all installdirs \ +-mostlyclean-generic distclean-generic clean-generic \ +-maintainer-clean-generic clean mostlyclean distclean maintainer-clean ++distclean-tags clean-tags maintainer-clean-tags distdir \ ++mostlyclean-depend distclean-depend clean-depend \ ++maintainer-clean-depend info-am info dvi-am dvi check check-am \ ++installcheck-am installcheck install-exec-am install-exec \ ++install-data-am install-data install-am install uninstall-am uninstall \ ++all-redirect all-am all installdirs mostlyclean-generic \ ++distclean-generic clean-generic maintainer-clean-generic clean \ ++mostlyclean distclean maintainer-clean + + + # Tell versions [3.59,3.63) of GNU make to not export all variables. +--- linux-atm-2.4.1.orig/src/mpoad/p_factory.c ++++ linux-atm-2.4.1/src/mpoad/p_factory.c +@@ -34,7 +34,7 @@ + + while( count > 1 ) { + /* This is the inner loop */ +- sum += * ((uint16_t *) addr)++; ++ sum += * ((uint16_t *) addr); addr += sizeof(uint16_t); + count -= 2; + } + +--- linux-atm-2.4.1.orig/src/switch/Makefile.in ++++ linux-atm-2.4.1/src/switch/Makefile.in +@@ -1,4 +1,4 @@ +-# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am ++# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am + + # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation +@@ -92,11 +92,9 @@ + + swc_SOURCES = swc.c swc.h + swc_LDADD = $(top_builddir)/src/lib/libatm.la +-swc_DEPENDENCIES = $(swc_LDADD) $(top_builddir)/src/include/atm.h \ +- $(top_builddir)/src/include/atmd.h ++swc_DEPENDENCIES = $(swc_LDADD) $(top_builddir)/src/include/atm.h $(top_builddir)/src/include/atmd.h + +-libsw_a_SOURCES = control.c dispatch.c dispatch.h proto.c proto.h relay.c \ +- route.c route.h sig.c sig.h cfg_y.y cfg_l.l fab.h ++libsw_a_SOURCES = control.c dispatch.c dispatch.h proto.c proto.h relay.c route.c route.h sig.c sig.h cfg_y.y cfg_l.l fab.h + + + EXTRA_DIST = cfg_y.h README +@@ -132,8 +130,11 @@ + + DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +-TAR = gtar ++TAR = tar + GZIP_ENV = --best ++DEP_FILES = .deps/cfg_l.P .deps/cfg_y.P .deps/control.P \ ++.deps/dispatch.P .deps/proto.P .deps/relay.P .deps/route.P .deps/sig.P \ ++.deps/swc.P + SOURCES = $(libsw_a_SOURCES) $(swc_SOURCES) + OBJECTS = $(libsw_a_OBJECTS) $(swc_OBJECTS) + +@@ -141,9 +142,9 @@ + .SUFFIXES: + .SUFFIXES: .S .c .l .lo .o .obj .s .y + $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +- cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps src/switch/Makefile ++ cd $(top_srcdir) && $(AUTOMAKE) --gnu src/switch/Makefile + +-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +@@ -157,9 +158,6 @@ + + maintainer-clean-noinstLIBRARIES: + +-.c.o: +- $(COMPILE) -c $< +- + # FIXME: We should only use cygpath when building on Windows, + # and only if it is available. + .c.obj: +@@ -182,9 +180,6 @@ + + maintainer-clean-compile: + +-.c.lo: +- $(LIBTOOL) --mode=compile $(COMPILE) -c $< +- + .s.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +@@ -306,7 +301,7 @@ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ +- || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) ++ || (cd $(srcdir) && etags -o $$here/TAGS $(ETAGS_ARGS) $$tags $$unique $(LISP)) + + mostlyclean-tags: + +@@ -322,6 +317,11 @@ + subdir = src/switch + + distdir: $(DISTFILES) ++ here=`cd $(top_builddir) && pwd`; \ ++ top_distdir=`cd $(top_distdir) && pwd`; \ ++ distdir=`cd $(distdir) && pwd`; \ ++ cd $(top_srcdir) \ ++ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu src/switch/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ +@@ -342,32 +342,38 @@ + || exit 1; \ + fi; \ + done +-cfg_l.o: cfg_l.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h cfg_y.h +-cfg_y.o: cfg_y.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h fab.h proto.h \ +- ../../src/include/atmsap.h ../../src/include/atmd.h sig.h \ +- route.h swc.h +-control.o: control.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h ../../src/include/atmd.h fab.h \ +- proto.h ../../src/include/atmsap.h sig.h dispatch.h swc.h +-dispatch.o: dispatch.c ../../config.h ../../src/include/atmd.h \ +- ../../src/include/stdint.h ../../src/include/atm.h dispatch.h +-proto.o: proto.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h ../../src/include/atmd.h sig.h fab.h \ +- proto.h ../../src/include/atmsap.h +-relay.o: relay.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h ../../src/include/atmd.h fab.h \ +- proto.h ../../src/include/atmsap.h sig.h dispatch.h route.h +-route.o: route.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h ../../src/include/atmd.h route.h \ +- sig.h +-sig.o: sig.c ../../config.h ../../src/include/stdint.h \ +- ../../src/include/atmd.h ../../src/include/atm.h dispatch.h \ +- proto.h ../../src/include/atmsap.h sig.h route.h fab.h +-swc.o: swc.c ../../config.h ../../src/include/atm.h \ +- ../../src/include/stdint.h ../../src/include/atmd.h swc.h + ++DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) ++ ++-include $(DEP_FILES) ++ ++mostlyclean-depend: ++ ++clean-depend: ++ ++distclean-depend: ++ -rm -rf .deps ++ ++maintainer-clean-depend: ++ ++%.o: %.c ++ @echo '$(COMPILE) -c $<'; \ ++ $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< ++ @-cp .deps/$(*F).pp .deps/$(*F).P; \ ++ tr ' ' '\012' < .deps/$(*F).pp \ ++ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ ++ >> .deps/$(*F).P; \ ++ rm .deps/$(*F).pp ++ ++%.lo: %.c ++ @echo '$(LTCOMPILE) -c $<'; \ ++ $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< ++ @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ ++ < .deps/$(*F).pp > .deps/$(*F).P; \ ++ tr ' ' '\012' < .deps/$(*F).pp \ ++ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ ++ >> .deps/$(*F).P; \ ++ rm -f .deps/$(*F).pp + info-am: + info: info-recursive + dvi-am: +@@ -404,22 +410,23 @@ + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + + maintainer-clean-generic: +- -test -z "cfg_llcfg_yhcfg_yc" || rm -f cfg_ll cfg_yh cfg_yc ++ -test -z "cfg_lccfg_yhcfg_yc" || rm -f cfg_lc cfg_yh cfg_yc + mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \ + mostlyclean-libtool mostlyclean-noinstPROGRAMS \ +- mostlyclean-tags mostlyclean-generic ++ mostlyclean-tags mostlyclean-depend mostlyclean-generic + + mostlyclean: mostlyclean-recursive + + clean-am: clean-noinstLIBRARIES clean-compile clean-libtool \ +- clean-noinstPROGRAMS clean-tags clean-generic \ +- mostlyclean-am ++ clean-noinstPROGRAMS clean-tags clean-depend \ ++ clean-generic mostlyclean-am + + clean: clean-recursive + + distclean-am: distclean-noinstLIBRARIES distclean-compile \ + distclean-libtool distclean-noinstPROGRAMS \ +- distclean-tags distclean-generic clean-am ++ distclean-tags distclean-depend distclean-generic \ ++ clean-am + -rm -f libtool + + distclean: distclean-recursive +@@ -427,7 +434,8 @@ + maintainer-clean-am: maintainer-clean-noinstLIBRARIES \ + maintainer-clean-compile maintainer-clean-libtool \ + maintainer-clean-noinstPROGRAMS maintainer-clean-tags \ +- maintainer-clean-generic distclean-am ++ maintainer-clean-depend maintainer-clean-generic \ ++ distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +@@ -445,12 +453,14 @@ + all-recursive check-recursive installcheck-recursive info-recursive \ + dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \ + maintainer-clean-recursive tags tags-recursive mostlyclean-tags \ +-distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ +-dvi-am dvi check check-am installcheck-am installcheck install-exec-am \ +-install-exec install-data-am install-data install-am install \ +-uninstall-am uninstall all-redirect all-am all installdirs-am \ +-installdirs mostlyclean-generic distclean-generic clean-generic \ +-maintainer-clean-generic clean mostlyclean distclean maintainer-clean ++distclean-tags clean-tags maintainer-clean-tags distdir \ ++mostlyclean-depend distclean-depend clean-depend \ ++maintainer-clean-depend info-am info dvi-am dvi check check-am \ ++installcheck-am installcheck install-exec-am install-exec \ ++install-data-am install-data install-am install uninstall-am uninstall \ ++all-redirect all-am all installdirs-am installdirs mostlyclean-generic \ ++distclean-generic clean-generic maintainer-clean-generic clean \ ++mostlyclean distclean maintainer-clean + + + # Tell versions [3.59,3.63) of GNU make to not export all variables. +--- linux-atm-2.4.1.orig/src/switch/cfg_y.c ++++ linux-atm-2.4.1/src/switch/cfg_y.c +@@ -1,21 +1,87 @@ ++/* A Bison parser, made by GNU Bison 1.875d. */ + +-/* A Bison parser, made from cfg_y.y +- by GNU Bison version 1.28 */ ++/* Skeleton parser for Yacc-like parsing with Bison, ++ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + +-#define YYBISON 1 /* Identify Bison output. */ ++ 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 ++ the Free Software Foundation; either version 2, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software ++ Foundation, Inc., 59 Temple Place - Suite 330, ++ Boston, MA 02111-1307, USA. */ ++ ++/* As a special exception, when this file is copied by Bison into a ++ Bison output file, you may use that output file without restriction. ++ This special exception was added by the Free Software Foundation ++ in version 1.24 of Bison. */ ++ ++/* Written by Richard Stallman by simplifying the original so called ++ ``semantic'' parser. */ ++ ++/* All symbols defined below should begin with yy or YY, to avoid ++ infringing on user name space. This should be done even for local ++ variables, as they might otherwise be expanded by user macros. ++ There are some unavoidable exceptions within include files to ++ define necessary library symbols; they are noted "INFRINGES ON ++ USER NAME SPACE" below. */ ++ ++/* Identify Bison output. */ ++#define YYBISON 1 ++ ++/* Skeleton name. */ ++#define YYSKELETON_NAME "yacc.c" ++ ++/* Pure parsers. */ ++#define YYPURE 0 ++ ++/* Using locations. */ ++#define YYLSP_NEEDED 0 + +-#define TOK_COMMAND 257 +-#define TOK_VPCI 258 +-#define TOK_ITF 259 +-#define TOK_DEFAULT 260 +-#define TOK_ROUTE 261 +-#define TOK_STR 262 +-#define TOK_SOCKET 263 +-#define TOK_OPTION 264 +-#define TOK_CONTROL 265 +-#define TOK_NUM 266 +-#define TOK_PVC 267 + ++ ++/* Tokens. */ ++#ifndef YYTOKENTYPE ++# define YYTOKENTYPE ++ /* Put the tokens into the symbol table, so that GDB and other debuggers ++ know about them. */ ++ enum yytokentype { ++ TOK_COMMAND = 258, ++ TOK_VPCI = 259, ++ TOK_ITF = 260, ++ TOK_DEFAULT = 261, ++ TOK_ROUTE = 262, ++ TOK_STR = 263, ++ TOK_SOCKET = 264, ++ TOK_OPTION = 265, ++ TOK_CONTROL = 266, ++ TOK_NUM = 267, ++ TOK_PVC = 268 ++ }; ++#endif ++#define TOK_COMMAND 258 ++#define TOK_VPCI 259 ++#define TOK_ITF 260 ++#define TOK_DEFAULT 261 ++#define TOK_ROUTE 262 ++#define TOK_STR 263 ++#define TOK_SOCKET 264 ++#define TOK_OPTION 265 ++#define TOK_CONTROL 266 ++#define TOK_NUM 267 ++#define TOK_PVC 268 ++ ++ ++ ++ ++/* Copy the first part of user declarations. */ + #line 1 "cfg_y.y" + + /* cfg.y - switch configuration language */ +@@ -29,6 +95,7 @@ + #include <string.h> + #include <errno.h> + #include <limits.h> ++#include <stdlib.h> + + #include "atm.h" + +@@ -38,436 +105,743 @@ + #include "swc.h" + + ++extern void yyerror(const char *s); ++ + static int itf; + static SIGNALING_ENTITY *sig; + + +-#line 27 "cfg_y.y" +-typedef union { ++ ++/* Enabling traces. */ ++#ifndef YYDEBUG ++# define YYDEBUG 0 ++#endif ++ ++/* Enabling verbose error messages. */ ++#ifdef YYERROR_VERBOSE ++# undef YYERROR_VERBOSE ++# define YYERROR_VERBOSE 1 ++#else ++# define YYERROR_VERBOSE 0 ++#endif ++ ++#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) ++#line 30 "cfg_y.y" ++typedef union YYSTYPE { + int num; + char *str; + struct sockaddr_atmpvc pvc; + } YYSTYPE; +-#include <stdio.h> +- +-#ifndef __cplusplus +-#ifndef __STDC__ +-#define const +-#endif ++/* Line 191 of yacc.c. */ ++#line 137 "y.tab.c" ++# define yystype YYSTYPE /* obsolescent; will be withdrawn */ ++# define YYSTYPE_IS_DECLARED 1 ++# define YYSTYPE_IS_TRIVIAL 1 + #endif + + + +-#define YYFINAL 31 +-#define YYFLAG -32768 +-#define YYNTBASE 16 +- +-#define YYTRANSLATE(x) ((unsigned)(x) <= 267 ? yytranslate[x] : 27) +- +-static const char yytranslate[] = { 0, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 14, 2, 15, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +- 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, +- 7, 8, 9, 10, 11, 12, 13 +-}; +- +-#if YYDEBUG != 0 +-static const short yyprhs[] = { 0, +- 0, 1, 4, 7, 10, 13, 14, 15, 25, 26, +- 29, 30, 33, 34, 36, 37, 40, 41, 45 +-}; ++/* Copy the second part of user declarations. */ ++ ++ ++/* Line 214 of yacc.c. */ ++#line 149 "y.tab.c" ++ ++#if ! defined (yyoverflow) || YYERROR_VERBOSE ++ ++# ifndef YYFREE ++# define YYFREE free ++# endif ++# ifndef YYMALLOC ++# define YYMALLOC malloc ++# endif ++ ++/* The parser invokes alloca or malloc; define the necessary symbols. */ ++ ++# ifdef YYSTACK_USE_ALLOCA ++# if YYSTACK_USE_ALLOCA ++# define YYSTACK_ALLOC alloca ++# endif ++# else ++# if defined (alloca) || defined (_ALLOCA_H) ++# define YYSTACK_ALLOC alloca ++# else ++# ifdef __GNUC__ ++# define YYSTACK_ALLOC __builtin_alloca ++# endif ++# endif ++# endif ++ ++# ifdef YYSTACK_ALLOC ++ /* Pacify GCC's `empty if-body' warning. */ ++# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) ++# else ++# if defined (__STDC__) || defined (__cplusplus) ++# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ ++# define YYSIZE_T size_t ++# endif ++# define YYSTACK_ALLOC YYMALLOC ++# define YYSTACK_FREE YYFREE ++# endif ++#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ ++ ++ ++#if (! defined (yyoverflow) \ ++ && (! defined (__cplusplus) \ ++ || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) + +-static const short yyrhs[] = { -1, +- 17, 16, 0, 18, 16, 0, 11, 16, 0, 10, +- 8, 0, 0, 0, 21, 9, 14, 19, 22, 20, +- 23, 24, 15, 0, 0, 3, 8, 0, 0, 5, +- 12, 0, 0, 13, 0, 0, 26, 24, 0, 0, +- 6, 25, 24, 0, 7, 0 +-}; ++/* A type that is properly aligned for any stack member. */ ++union yyalloc ++{ ++ short int yyss; ++ YYSTYPE yyvs; ++ }; ++ ++/* The size of the maximum gap between one aligned stack and the next. */ ++# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) ++ ++/* The size of an array large to enough to hold all stacks, each with ++ N elements. */ ++# define YYSTACK_BYTES(N) \ ++ ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ ++ + YYSTACK_GAP_MAXIMUM) ++ ++/* Copy COUNT objects from FROM to TO. The source and destination do ++ not overlap. */ ++# ifndef YYCOPY ++# if defined (__GNUC__) && 1 < __GNUC__ ++# define YYCOPY(To, From, Count) \ ++ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) ++# else ++# define YYCOPY(To, From, Count) \ ++ do \ ++ { \ ++ register YYSIZE_T yyi; \ ++ for (yyi = 0; yyi < (Count); yyi++) \ ++ (To)[yyi] = (From)[yyi]; \ ++ } \ ++ while (0) ++# endif ++# endif ++ ++/* Relocate STACK from its old location to the new one. The ++ local variables YYSIZE and YYSTACKSIZE give the old and new number of ++ elements in the stack, and YYPTR gives the new location of the ++ stack. Advance YYPTR to a properly aligned location for the next ++ stack. */ ++# define YYSTACK_RELOCATE(Stack) \ ++ do \ ++ { \ ++ YYSIZE_T yynewbytes; \ ++ YYCOPY (&yyptr->Stack, Stack, yysize); \ ++ Stack = &yyptr->Stack; \ ++ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ ++ yyptr += yynewbytes / sizeof (*yyptr); \ ++ } \ ++ while (0) + + #endif + +-#if YYDEBUG != 0 +-static const short yyrline[] = { 0, +- 43, 44, 45, 46, 52, 59, 65, 73, 76, 80, +- 87, 88, 94, 95, 101, 102, 103, 108, 110 +-}; ++#if defined (__STDC__) || defined (__cplusplus) ++ typedef signed char yysigned_char; ++#else ++ typedef short int yysigned_char; + #endif + ++/* YYFINAL -- State number of the termination state. */ ++#define YYFINAL 11 ++/* YYLAST -- Last index in YYTABLE. */ ++#define YYLAST 22 ++ ++/* YYNTOKENS -- Number of terminals. */ ++#define YYNTOKENS 16 ++/* YYNNTS -- Number of nonterminals. */ ++#define YYNNTS 12 ++/* YYNRULES -- Number of rules. */ ++#define YYNRULES 20 ++/* YYNRULES -- Number of states. */ ++#define YYNSTATES 31 ++ ++/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ ++#define YYUNDEFTOK 2 ++#define YYMAXUTOK 268 + +-#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) ++#define YYTRANSLATE(YYX) \ ++ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +-static const char * const yytname[] = { "$","error","$undefined.","TOK_COMMAND", +-"TOK_VPCI","TOK_ITF","TOK_DEFAULT","TOK_ROUTE","TOK_STR","TOK_SOCKET","TOK_OPTION", +-"TOK_CONTROL","TOK_NUM","TOK_PVC","'{'","'}'","all","option","sig","@1","@2", +-"opt_command","opt_itf","opt_via","routes","@3","route", NULL ++/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ ++static const unsigned char yytranslate[] = ++{ ++ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 14, 2, 15, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ++ 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, ++ 5, 6, 7, 8, 9, 10, 11, 12, 13 + }; +-#endif + +-static const short yyr1[] = { 0, +- 16, 16, 16, 16, 17, 19, 20, 18, 21, 21, +- 22, 22, 23, 23, 24, 24, 25, 24, 26 ++#if YYDEBUG ++/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in ++ YYRHS. */ ++static const unsigned char yyprhs[] = ++{ ++ 0, 0, 3, 4, 7, 10, 13, 16, 17, 18, ++ 28, 29, 32, 33, 36, 37, 39, 40, 43, 44, ++ 48 + }; + +-static const short yyr2[] = { 0, +- 0, 2, 2, 2, 2, 0, 0, 9, 0, 2, +- 0, 2, 0, 1, 0, 2, 0, 3, 1 ++/* YYRHS -- A `-1'-separated list of the rules' RHS. */ ++static const yysigned_char yyrhs[] = ++{ ++ 17, 0, -1, -1, 18, 17, -1, 19, 17, -1, ++ 11, 17, -1, 10, 8, -1, -1, -1, 22, 9, ++ 14, 20, 23, 21, 24, 25, 15, -1, -1, 3, ++ 8, -1, -1, 5, 12, -1, -1, 13, -1, -1, ++ 27, 25, -1, -1, 6, 26, 25, -1, 7, -1 + }; + +-static const short yydefact[] = { 1, +- 0, 0, 1, 1, 1, 0, 10, 5, 4, 2, +- 3, 0, 6, 11, 0, 7, 12, 13, 14, 15, +- 17, 19, 0, 15, 15, 8, 16, 18, 0, 0, +- 0 ++/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ ++static const unsigned char yyrline[] = ++{ ++ 0, 46, 46, 47, 48, 49, 56, 64, 68, 63, ++ 80, 83, 90, 91, 97, 98, 104, 105, 107, 106, ++ 114 + }; ++#endif + +-static const short yydefgoto[] = { 9, +- 4, 5, 14, 18, 6, 16, 20, 23, 25, 24 ++#if YYDEBUG || YYERROR_VERBOSE ++/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. ++ First, the terminals, then, starting at YYNTOKENS, nonterminals. */ ++static const char *const yytname[] = ++{ ++ "$end", "error", "$undefined", "TOK_COMMAND", "TOK_VPCI", "TOK_ITF", ++ "TOK_DEFAULT", "TOK_ROUTE", "TOK_STR", "TOK_SOCKET", "TOK_OPTION", ++ "TOK_CONTROL", "TOK_NUM", "TOK_PVC", "'{'", "'}'", "$accept", "all", ++ "option", "sig", "@1", "@2", "opt_command", "opt_itf", "opt_via", ++ "routes", "@3", "route", 0 + }; ++#endif + +-static const short yypact[] = { -3, +- 3, 4, -3, -3, -3, 6,-32768,-32768,-32768,-32768, +--32768, -1,-32768, 9, 7,-32768,-32768, 8,-32768, -5, +--32768,-32768, 1, -5, -5,-32768,-32768,-32768, 17, 18, +--32768 ++# ifdef YYPRINT ++/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to ++ token YYLEX-NUM. */ ++static const unsigned short int yytoknum[] = ++{ ++ 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, ++ 265, 266, 267, 268, 123, 125 + }; ++# endif + +-static const short yypgoto[] = { 5, +--32768,-32768,-32768,-32768,-32768,-32768,-32768, -21,-32768,-32768 ++/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ ++static const unsigned char yyr1[] = ++{ ++ 0, 16, 17, 17, 17, 17, 18, 20, 21, 19, ++ 22, 22, 23, 23, 24, 24, 25, 25, 26, 25, ++ 27 + }; + +- +-#define YYLAST 21 +- +- +-static const short yytable[] = { 1, +- 21, 22, 27, 28, 29, -9, 2, 3, 10, 11, +- 7, 8, 13, 15, 12, 26, 30, 31, 17, 0, +- 19 ++/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ ++static const unsigned char yyr2[] = ++{ ++ 0, 2, 0, 2, 2, 2, 2, 0, 0, 9, ++ 0, 2, 0, 2, 0, 1, 0, 2, 0, 3, ++ 1 + }; + +-static const short yycheck[] = { 3, +- 6, 7, 24, 25, 0, 9, 10, 11, 4, 5, +- 8, 8, 14, 5, 9, 15, 0, 0, 12, -1, +- 13 ++/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state ++ STATE-NUM when YYTABLE doesn't specify something else to do. Zero ++ means the default is an error. */ ++static const unsigned char yydefact[] = ++{ ++ 2, 0, 0, 2, 0, 2, 2, 0, 11, 6, ++ 5, 1, 3, 4, 0, 7, 12, 0, 8, 13, ++ 14, 15, 16, 18, 20, 0, 16, 16, 9, 17, ++ 19 + }; +-/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ +-#line 3 "/usr/lib/bison.simple" +-/* This file comes from bison-1.28. */ + +-/* Skeleton output parser for bison, +- Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. ++/* YYDEFGOTO[NTERM-NUM]. */ ++static const yysigned_char yydefgoto[] = ++{ ++ -1, 4, 5, 6, 16, 20, 7, 18, 22, 25, ++ 27, 26 ++}; + +- 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 +- the Free Software Foundation; either version 2, or (at your option) +- any later version. ++/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing ++ STATE-NUM. */ ++#define YYPACT_NINF -16 ++static const yysigned_char yypact[] = ++{ ++ -3, -6, 5, -3, 14, -3, -3, -4, -16, -16, ++ -16, -16, -16, -16, 1, -16, 11, 6, -16, -16, ++ 4, -16, 3, -16, -16, 7, 3, 3, -16, -16, ++ -16 ++}; + +- This program is distributed in the hope that it will be useful, +- but WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- GNU General Public License for more details. ++/* YYPGOTO[NTERM-NUM]. */ ++static const yysigned_char yypgoto[] = ++{ ++ -16, -2, -16, -16, -16, -16, -16, -16, -16, -15, ++ -16, -16 ++}; + +- You should have received a copy of the GNU General Public License +- along with this program; if not, write to the Free Software +- Foundation, Inc., 59 Temple Place - Suite 330, +- Boston, MA 02111-1307, USA. */ ++/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If ++ positive, shift that token. If negative, reduce the rule which ++ number is the opposite. If zero, do what YYDEFACT says. ++ If YYTABLE_NINF, syntax error. */ ++#define YYTABLE_NINF -11 ++static const yysigned_char yytable[] = ++{ ++ 1, 10, 8, 12, 13, 14, -10, 2, 3, 23, ++ 24, 29, 30, 9, 11, 15, 17, 21, 19, 0, ++ 0, 0, 28 ++}; + +-/* As a special exception, when this file is copied by Bison into a +- Bison output file, you may use that output file without restriction. +- This special exception was added by the Free Software Foundation +- in version 1.24 of Bison. */ ++static const yysigned_char yycheck[] = ++{ ++ 3, 3, 8, 5, 6, 9, 9, 10, 11, 6, ++ 7, 26, 27, 8, 0, 14, 5, 13, 12, -1, ++ -1, -1, 15 ++}; + +-/* This is the parser code that is written into each bison parser +- when the %semantic_parser declaration is not specified in the grammar. +- It was written by Richard Stallman by simplifying the hairy parser +- used when %semantic_parser is specified. */ +- +-#ifndef YYSTACK_USE_ALLOCA +-#ifdef alloca +-#define YYSTACK_USE_ALLOCA +-#else /* alloca not defined */ +-#ifdef __GNUC__ +-#define YYSTACK_USE_ALLOCA +-#define alloca __builtin_alloca +-#else /* not GNU C. */ +-#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) +-#define YYSTACK_USE_ALLOCA +-#include <alloca.h> +-#else /* not sparc */ +-/* We think this test detects Watcom and Microsoft C. */ +-/* This used to test MSDOS, but that is a bad idea +- since that symbol is in the user namespace. */ +-#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) +-#if 0 /* No need for malloc.h, which pollutes the namespace; +- instead, just don't use alloca. */ +-#include <malloc.h> +-#endif +-#else /* not MSDOS, or __TURBOC__ */ +-#if defined(_AIX) +-/* I don't know what this was needed for, but it pollutes the namespace. +- So I turned it off. rms, 2 May 1997. */ +-/* #include <malloc.h> */ +- #pragma alloca +-#define YYSTACK_USE_ALLOCA +-#else /* not MSDOS, or __TURBOC__, or _AIX */ +-#if 0 +-#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, +- and on HPUX 10. Eventually we can turn this on. */ +-#define YYSTACK_USE_ALLOCA +-#define alloca __builtin_alloca +-#endif /* __hpux */ +-#endif +-#endif /* not _AIX */ +-#endif /* not MSDOS, or __TURBOC__ */ +-#endif /* not sparc */ +-#endif /* not GNU C */ +-#endif /* alloca not defined */ +-#endif /* YYSTACK_USE_ALLOCA not defined */ ++/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing ++ symbol of state STATE-NUM. */ ++static const unsigned char yystos[] = ++{ ++ 0, 3, 10, 11, 17, 18, 19, 22, 8, 8, ++ 17, 0, 17, 17, 9, 14, 20, 5, 23, 12, ++ 21, 13, 24, 6, 7, 25, 27, 26, 15, 25, ++ 25 ++}; + +-#ifdef YYSTACK_USE_ALLOCA +-#define YYSTACK_ALLOC alloca +-#else +-#define YYSTACK_ALLOC malloc ++#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) ++# define YYSIZE_T __SIZE_TYPE__ ++#endif ++#if ! defined (YYSIZE_T) && defined (size_t) ++# define YYSIZE_T size_t ++#endif ++#if ! defined (YYSIZE_T) ++# if defined (__STDC__) || defined (__cplusplus) ++# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ ++# define YYSIZE_T size_t ++# endif ++#endif ++#if ! defined (YYSIZE_T) ++# define YYSIZE_T unsigned int + #endif +- +-/* Note: there must be only one dollar sign in this file. +- It is replaced by the list of actions, each action +- as one case of the switch. */ + + #define yyerrok (yyerrstatus = 0) + #define yyclearin (yychar = YYEMPTY) +-#define YYEMPTY -2 ++#define YYEMPTY (-2) + #define YYEOF 0 ++ + #define YYACCEPT goto yyacceptlab +-#define YYABORT goto yyabortlab +-#define YYERROR goto yyerrlab1 +-/* Like YYERROR except do call yyerror. +- This remains here temporarily to ease the +- transition to the new meaning of YYERROR, for GCC. ++#define YYABORT goto yyabortlab ++#define YYERROR goto yyerrorlab ++ ++ ++/* Like YYERROR except do call yyerror. This remains here temporarily ++ to ease the transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. */ ++ + #define YYFAIL goto yyerrlab ++ + #define YYRECOVERING() (!!yyerrstatus) +-#define YYBACKUP(token, value) \ ++ ++#define YYBACKUP(Token, Value) \ + do \ + if (yychar == YYEMPTY && yylen == 1) \ +- { yychar = (token), yylval = (value); \ +- yychar1 = YYTRANSLATE (yychar); \ ++ { \ ++ yychar = (Token); \ ++ yylval = (Value); \ ++ yytoken = YYTRANSLATE (yychar); \ + YYPOPSTACK; \ + goto yybackup; \ + } \ + else \ +- { yyerror ("syntax error: cannot back up"); YYERROR; } \ ++ { \ ++ yyerror ("syntax error: cannot back up");\ ++ YYERROR; \ ++ } \ + while (0) + + #define YYTERROR 1 + #define YYERRCODE 256 + +-#ifndef YYPURE +-#define YYLEX yylex() +-#endif ++/* YYLLOC_DEFAULT -- Compute the default location (before the actions ++ are run). */ + +-#ifdef YYPURE +-#ifdef YYLSP_NEEDED +-#ifdef YYLEX_PARAM +-#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) +-#else +-#define YYLEX yylex(&yylval, &yylloc) ++#ifndef YYLLOC_DEFAULT ++# define YYLLOC_DEFAULT(Current, Rhs, N) \ ++ ((Current).first_line = (Rhs)[1].first_line, \ ++ (Current).first_column = (Rhs)[1].first_column, \ ++ (Current).last_line = (Rhs)[N].last_line, \ ++ (Current).last_column = (Rhs)[N].last_column) + #endif +-#else /* not YYLSP_NEEDED */ ++ ++/* YYLEX -- calling `yylex' with the right arguments. */ ++ + #ifdef YYLEX_PARAM +-#define YYLEX yylex(&yylval, YYLEX_PARAM) ++# define YYLEX yylex (YYLEX_PARAM) + #else +-#define YYLEX yylex(&yylval) +-#endif +-#endif /* not YYLSP_NEEDED */ ++# define YYLEX yylex () + #endif + +-/* If nonreentrant, generate the variables here */ ++/* Enable debugging if requested. */ ++#if YYDEBUG + +-#ifndef YYPURE ++# ifndef YYFPRINTF ++# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ ++# define YYFPRINTF fprintf ++# endif ++ ++# define YYDPRINTF(Args) \ ++do { \ ++ if (yydebug) \ ++ YYFPRINTF Args; \ ++} while (0) ++ ++# define YYDSYMPRINT(Args) \ ++do { \ ++ if (yydebug) \ ++ yysymprint Args; \ ++} while (0) ++ ++# define YYDSYMPRINTF(Title, Token, Value, Location) \ ++do { \ ++ if (yydebug) \ ++ { \ ++ YYFPRINTF (stderr, "%s ", Title); \ ++ yysymprint (stderr, \ ++ Token, Value); \ ++ YYFPRINTF (stderr, "\n"); \ ++ } \ ++} while (0) + +-int yychar; /* the lookahead symbol */ +-YYSTYPE yylval; /* the semantic value of the */ +- /* lookahead symbol */ ++/*------------------------------------------------------------------. ++| yy_stack_print -- Print the state stack from its BOTTOM up to its | ++| TOP (included). | ++`------------------------------------------------------------------*/ + +-#ifdef YYLSP_NEEDED +-YYLTYPE yylloc; /* location data for the lookahead */ +- /* symbol */ ++#if defined (__STDC__) || defined (__cplusplus) ++static void ++yy_stack_print (short int *bottom, short int *top) ++#else ++static void ++yy_stack_print (bottom, top) ++ short int *bottom; ++ short int *top; + #endif ++{ ++ YYFPRINTF (stderr, "Stack now"); ++ for (/* Nothing. */; bottom <= top; ++bottom) ++ YYFPRINTF (stderr, " %d", *bottom); ++ YYFPRINTF (stderr, "\n"); ++} + +-int yynerrs; /* number of parse errors so far */ +-#endif /* not YYPURE */ ++# define YY_STACK_PRINT(Bottom, Top) \ ++do { \ ++ if (yydebug) \ ++ yy_stack_print ((Bottom), (Top)); \ ++} while (0) + +-#if YYDEBUG != 0 +-int yydebug; /* nonzero means print parse trace */ +-/* Since this is uninitialized, it does not stop multiple parsers +- from coexisting. */ ++ ++/*------------------------------------------------. ++| Report that the YYRULE is going to be reduced. | ++`------------------------------------------------*/ ++ ++#if defined (__STDC__) || defined (__cplusplus) ++static void ++yy_reduce_print (int yyrule) ++#else ++static void ++yy_reduce_print (yyrule) ++ int yyrule; + #endif ++{ ++ int yyi; ++ unsigned int yylno = yyrline[yyrule]; ++ YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", ++ yyrule - 1, yylno); ++ /* Print the symbols being reduced, and their result. */ ++ for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) ++ YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]); ++ YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]); ++} ++ ++# define YY_REDUCE_PRINT(Rule) \ ++do { \ ++ if (yydebug) \ ++ yy_reduce_print (Rule); \ ++} while (0) ++ ++/* Nonzero means print parse trace. It is left uninitialized so that ++ multiple parsers can coexist. */ ++int yydebug; ++#else /* !YYDEBUG */ ++# define YYDPRINTF(Args) ++# define YYDSYMPRINT(Args) ++# define YYDSYMPRINTF(Title, Token, Value, Location) ++# define YY_STACK_PRINT(Bottom, Top) ++# define YY_REDUCE_PRINT(Rule) ++#endif /* !YYDEBUG */ + +-/* YYINITDEPTH indicates the initial size of the parser's stacks */ + ++/* YYINITDEPTH -- initial size of the parser's stacks. */ + #ifndef YYINITDEPTH +-#define YYINITDEPTH 200 ++# define YYINITDEPTH 200 + #endif + +-/* YYMAXDEPTH is the maximum size the stacks can grow to +- (effective only if the built-in stack extension method is used). */ ++/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only ++ if the built-in stack extension method is used). + +-#if YYMAXDEPTH == 0 +-#undef YYMAXDEPTH ++ Do not make this value too large; the results are undefined if ++ SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) ++ evaluated with infinite-precision integer arithmetic. */ ++ ++#if defined (YYMAXDEPTH) && YYMAXDEPTH == 0 ++# undef YYMAXDEPTH + #endif + + #ifndef YYMAXDEPTH +-#define YYMAXDEPTH 10000 ++# define YYMAXDEPTH 10000 + #endif ++ + +-/* Define __yy_memcpy. Note that the size argument +- should be passed with type unsigned int, because that is what the non-GCC +- definitions require. With GCC, __builtin_memcpy takes an arg +- of type size_t, but it can handle unsigned int. */ +- +-#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ +-#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) +-#else /* not GNU C or C++ */ +-#ifndef __cplusplus + +-/* This is the most reliable way to avoid incompatibilities +- in available built-in functions on various systems. */ +-static void +-__yy_memcpy (to, from, count) +- char *to; +- char *from; +- unsigned int count; +-{ +- register char *f = from; +- register char *t = to; +- register int i = count; ++#if YYERROR_VERBOSE ++ ++# ifndef yystrlen ++# if defined (__GLIBC__) && defined (_STRING_H) ++# define yystrlen strlen ++# else ++/* Return the length of YYSTR. */ ++static YYSIZE_T ++# if defined (__STDC__) || defined (__cplusplus) ++yystrlen (const char *yystr) ++# else ++yystrlen (yystr) ++ const char *yystr; ++# endif ++{ ++ register const char *yys = yystr; ++ ++ while (*yys++ != '\0') ++ continue; ++ ++ return yys - yystr - 1; ++} ++# endif ++# endif ++ ++# ifndef yystpcpy ++# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) ++# define yystpcpy stpcpy ++# else ++/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in ++ YYDEST. */ ++static char * ++# if defined (__STDC__) || defined (__cplusplus) ++yystpcpy (char *yydest, const char *yysrc) ++# else ++yystpcpy (yydest, yysrc) ++ char *yydest; ++ const char *yysrc; ++# endif ++{ ++ register char *yyd = yydest; ++ register const char *yys = yysrc; + +- while (i-- > 0) +- *t++ = *f++; ++ while ((*yyd++ = *yys++) != '\0') ++ continue; ++ ++ return yyd - 1; + } ++# endif ++# endif ++ ++#endif /* !YYERROR_VERBOSE */ + +-#else /* __cplusplus */ ++ ++ ++#if YYDEBUG ++/*--------------------------------. ++| Print this symbol on YYOUTPUT. | ++`--------------------------------*/ + +-/* This is the most reliable way to avoid incompatibilities +- in available built-in functions on various systems. */ ++#if defined (__STDC__) || defined (__cplusplus) + static void +-__yy_memcpy (char *to, char *from, unsigned int count) ++yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) ++#else ++static void ++yysymprint (yyoutput, yytype, yyvaluep) ++ FILE *yyoutput; ++ int yytype; ++ YYSTYPE *yyvaluep; ++#endif + { +- register char *t = to; +- register char *f = from; +- register int i = count; ++ /* Pacify ``unused variable'' warnings. */ ++ (void) yyvaluep; + +- while (i-- > 0) +- *t++ = *f++; ++ if (yytype < YYNTOKENS) ++ { ++ YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); ++# ifdef YYPRINT ++ YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); ++# endif ++ } ++ else ++ YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); ++ ++ switch (yytype) ++ { ++ default: ++ break; ++ } ++ YYFPRINTF (yyoutput, ")"); + } + ++#endif /* ! YYDEBUG */ ++/*-----------------------------------------------. ++| Release the memory associated to this symbol. | ++`-----------------------------------------------*/ ++ ++#if defined (__STDC__) || defined (__cplusplus) ++static void ++yydestruct (int yytype, YYSTYPE *yyvaluep) ++#else ++static void ++yydestruct (yytype, yyvaluep) ++ int yytype; ++ YYSTYPE *yyvaluep; + #endif +-#endif ++{ ++ /* Pacify ``unused variable'' warnings. */ ++ (void) yyvaluep; ++ ++ switch (yytype) ++ { ++ ++ default: ++ break; ++ } ++} + +-#line 217 "/usr/lib/bison.simple" + +-/* The user can define YYPARSE_PARAM as the name of an argument to be passed +- into yyparse. The argument should have type void *. +- It should actually point to an object. +- Grammar actions can access the variable by casting it +- to the proper pointer type. */ ++/* Prevent warnings from -Wmissing-prototypes. */ + + #ifdef YYPARSE_PARAM +-#ifdef __cplusplus +-#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM +-#define YYPARSE_PARAM_DECL +-#else /* not __cplusplus */ +-#define YYPARSE_PARAM_ARG YYPARSE_PARAM +-#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; +-#endif /* not __cplusplus */ +-#else /* not YYPARSE_PARAM */ +-#define YYPARSE_PARAM_ARG +-#define YYPARSE_PARAM_DECL +-#endif /* not YYPARSE_PARAM */ ++# if defined (__STDC__) || defined (__cplusplus) ++int yyparse (void *YYPARSE_PARAM); ++# else ++int yyparse (); ++# endif ++#else /* ! YYPARSE_PARAM */ ++#if defined (__STDC__) || defined (__cplusplus) ++int yyparse (void); ++#else ++int yyparse (); ++#endif ++#endif /* ! YYPARSE_PARAM */ ++ ++ ++ ++/* The lookahead symbol. */ ++int yychar; ++ ++/* The semantic value of the lookahead symbol. */ ++YYSTYPE yylval; ++ ++/* Number of syntax errors so far. */ ++int yynerrs; ++ ++ ++ ++/*----------. ++| yyparse. | ++`----------*/ + +-/* Prevent warning if -Wstrict-prototypes. */ +-#ifdef __GNUC__ + #ifdef YYPARSE_PARAM +-int yyparse (void *); ++# if defined (__STDC__) || defined (__cplusplus) ++int yyparse (void *YYPARSE_PARAM) ++# else ++int yyparse (YYPARSE_PARAM) ++ void *YYPARSE_PARAM; ++# endif ++#else /* ! YYPARSE_PARAM */ ++#if defined (__STDC__) || defined (__cplusplus) ++int ++yyparse (void) + #else +-int yyparse (void); ++int ++yyparse () ++ + #endif + #endif +- +-int +-yyparse(YYPARSE_PARAM_ARG) +- YYPARSE_PARAM_DECL + { ++ + register int yystate; + register int yyn; +- register short *yyssp; ++ int yyresult; ++ /* Number of tokens to shift before error messages enabled. */ ++ int yyerrstatus; ++ /* Lookahead token as an internal (translated) token number. */ ++ int yytoken = 0; ++ ++ /* Three stacks and their tools: ++ `yyss': related to states, ++ `yyvs': related to semantic values, ++ `yyls': related to locations. ++ ++ Refer to the stacks thru separate pointers, to allow yyoverflow ++ to reallocate them elsewhere. */ ++ ++ /* The state stack. */ ++ short int yyssa[YYINITDEPTH]; ++ short int *yyss = yyssa; ++ register short int *yyssp; ++ ++ /* The semantic value stack. */ ++ YYSTYPE yyvsa[YYINITDEPTH]; ++ YYSTYPE *yyvs = yyvsa; + register YYSTYPE *yyvsp; +- int yyerrstatus; /* number of tokens to shift before error messages enabled */ +- int yychar1 = 0; /* lookahead token as an internal (translated) token number */ +- +- short yyssa[YYINITDEPTH]; /* the state stack */ +- YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ + +- short *yyss = yyssa; /* refer to the stacks thru separate pointers */ +- YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ + +-#ifdef YYLSP_NEEDED +- YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ +- YYLTYPE *yyls = yylsa; +- YYLTYPE *yylsp; + +-#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) +-#else + #define YYPOPSTACK (yyvsp--, yyssp--) +-#endif + +- int yystacksize = YYINITDEPTH; +- int yyfree_stacks = 0; ++ YYSIZE_T yystacksize = YYINITDEPTH; + +-#ifdef YYPURE +- int yychar; +- YYSTYPE yylval; +- int yynerrs; +-#ifdef YYLSP_NEEDED +- YYLTYPE yylloc; +-#endif +-#endif ++ /* The variables used to return semantic value and location from the ++ action routines. */ ++ YYSTYPE yyval; + +- YYSTYPE yyval; /* the variable used to return */ +- /* semantic values from the action */ +- /* routines */ + ++ /* When reducing, the number of symbols on the RHS of the reduced ++ rule. */ + int yylen; + +-#if YYDEBUG != 0 +- if (yydebug) +- fprintf(stderr, "Starting parse\n"); +-#endif ++ YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; +@@ -479,110 +853,97 @@ + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + +- yyssp = yyss - 1; ++ yyssp = yyss; + yyvsp = yyvs; +-#ifdef YYLSP_NEEDED +- yylsp = yyls; +-#endif + +-/* Push a new state, which is found in yystate . */ +-/* In all cases, when you get here, the value and location stacks +- have just been pushed. so pushing a state here evens the stacks. */ +-yynewstate: + +- *++yyssp = yystate; ++ goto yysetstate; + +- if (yyssp >= yyss + yystacksize - 1) +- { +- /* Give user a chance to reallocate the stack */ +- /* Use copies of these so that the &'s don't force the real ones into memory. */ +- YYSTYPE *yyvs1 = yyvs; +- short *yyss1 = yyss; +-#ifdef YYLSP_NEEDED +- YYLTYPE *yyls1 = yyls; +-#endif ++/*------------------------------------------------------------. ++| yynewstate -- Push a new state, which is found in yystate. | ++`------------------------------------------------------------*/ ++ yynewstate: ++ /* In all cases, when you get here, the value and location stacks ++ have just been pushed. so pushing a state here evens the stacks. ++ */ ++ yyssp++; + ++ yysetstate: ++ *yyssp = yystate; ++ ++ if (yyss + yystacksize - 1 <= yyssp) ++ { + /* Get the current used size of the three stacks, in elements. */ +- int size = yyssp - yyss + 1; ++ YYSIZE_T yysize = yyssp - yyss + 1; + + #ifdef yyoverflow +- /* Each stack pointer address is followed by the size of +- the data in use in that stack, in bytes. */ +-#ifdef YYLSP_NEEDED +- /* This used to be a conditional around just the two extra args, +- but that might be undefined if yyoverflow is a macro. */ +- yyoverflow("parser stack overflow", +- &yyss1, size * sizeof (*yyssp), +- &yyvs1, size * sizeof (*yyvsp), +- &yyls1, size * sizeof (*yylsp), +- &yystacksize); +-#else +- yyoverflow("parser stack overflow", +- &yyss1, size * sizeof (*yyssp), +- &yyvs1, size * sizeof (*yyvsp), +- &yystacksize); +-#endif +- +- yyss = yyss1; yyvs = yyvs1; +-#ifdef YYLSP_NEEDED +- yyls = yyls1; +-#endif ++ { ++ /* Give user a chance to reallocate the stack. Use copies of ++ these so that the &'s don't force the real ones into ++ memory. */ ++ YYSTYPE *yyvs1 = yyvs; ++ short int *yyss1 = yyss; ++ ++ ++ /* Each stack pointer address is followed by the size of the ++ data in use in that stack, in bytes. This used to be a ++ conditional around just the two extra args, but that might ++ be undefined if yyoverflow is a macro. */ ++ yyoverflow ("parser stack overflow", ++ &yyss1, yysize * sizeof (*yyssp), ++ &yyvs1, yysize * sizeof (*yyvsp), ++ ++ &yystacksize); ++ ++ yyss = yyss1; ++ yyvs = yyvs1; ++ } + #else /* no yyoverflow */ ++# ifndef YYSTACK_RELOCATE ++ goto yyoverflowlab; ++# else + /* Extend the stack our own way. */ +- if (yystacksize >= YYMAXDEPTH) +- { +- yyerror("parser stack overflow"); +- if (yyfree_stacks) +- { +- free (yyss); +- free (yyvs); +-#ifdef YYLSP_NEEDED +- free (yyls); +-#endif +- } +- return 2; +- } ++ if (YYMAXDEPTH <= yystacksize) ++ goto yyoverflowlab; + yystacksize *= 2; +- if (yystacksize > YYMAXDEPTH) ++ if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; +-#ifndef YYSTACK_USE_ALLOCA +- yyfree_stacks = 1; +-#endif +- yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); +- __yy_memcpy ((char *)yyss, (char *)yyss1, +- size * (unsigned int) sizeof (*yyssp)); +- yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); +- __yy_memcpy ((char *)yyvs, (char *)yyvs1, +- size * (unsigned int) sizeof (*yyvsp)); +-#ifdef YYLSP_NEEDED +- yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); +- __yy_memcpy ((char *)yyls, (char *)yyls1, +- size * (unsigned int) sizeof (*yylsp)); +-#endif ++ ++ { ++ short int *yyss1 = yyss; ++ union yyalloc *yyptr = ++ (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); ++ if (! yyptr) ++ goto yyoverflowlab; ++ YYSTACK_RELOCATE (yyss); ++ YYSTACK_RELOCATE (yyvs); ++ ++# undef YYSTACK_RELOCATE ++ if (yyss1 != yyssa) ++ YYSTACK_FREE (yyss1); ++ } ++# endif + #endif /* no yyoverflow */ + +- yyssp = yyss + size - 1; +- yyvsp = yyvs + size - 1; +-#ifdef YYLSP_NEEDED +- yylsp = yyls + size - 1; +-#endif ++ yyssp = yyss + yysize - 1; ++ yyvsp = yyvs + yysize - 1; + +-#if YYDEBUG != 0 +- if (yydebug) +- fprintf(stderr, "Stack size increased to %d\n", yystacksize); +-#endif + +- if (yyssp >= yyss + yystacksize - 1) ++ YYDPRINTF ((stderr, "Stack size increased to %lu\n", ++ (unsigned long int) yystacksize)); ++ ++ if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + +-#if YYDEBUG != 0 +- if (yydebug) +- fprintf(stderr, "Entering state %d\n", yystate); +-#endif ++ YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + goto yybackup; +- yybackup: ++ ++/*-----------. ++| yybackup. | ++`-----------*/ ++yybackup: + + /* Do appropriate processing given the current state. */ + /* Read a lookahead token if we need one and don't already have one. */ +@@ -591,194 +952,167 @@ + /* First try to decide what to do without reference to lookahead token. */ + + yyn = yypact[yystate]; +- if (yyn == YYFLAG) ++ if (yyn == YYPACT_NINF) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + +- /* yychar is either YYEMPTY or YYEOF +- or a valid token in external form. */ +- ++ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) + { +-#if YYDEBUG != 0 +- if (yydebug) +- fprintf(stderr, "Reading a token: "); +-#endif ++ YYDPRINTF ((stderr, "Reading a token: ")); + yychar = YYLEX; + } + +- /* Convert token to internal form (in yychar1) for indexing tables with */ +- +- if (yychar <= 0) /* This means end of input. */ ++ if (yychar <= YYEOF) + { +- yychar1 = 0; +- yychar = YYEOF; /* Don't call YYLEX any more */ +- +-#if YYDEBUG != 0 +- if (yydebug) +- fprintf(stderr, "Now at end of input.\n"); +-#endif ++ yychar = yytoken = YYEOF; ++ YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { +- yychar1 = YYTRANSLATE(yychar); +- +-#if YYDEBUG != 0 +- if (yydebug) +- { +- fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); +- /* Give the individual parser a way to print the precise meaning +- of a token, for further debugging info. */ +-#ifdef YYPRINT +- YYPRINT (stderr, yychar, yylval); +-#endif +- fprintf (stderr, ")\n"); +- } +-#endif ++ yytoken = YYTRANSLATE (yychar); ++ YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc); + } + +- yyn += yychar1; +- if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) ++ /* If the proper action on seeing token YYTOKEN is to reduce or to ++ detect an error, take that action. */ ++ yyn += yytoken; ++ if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; +- + yyn = yytable[yyn]; +- +- /* yyn is what to do for this token type in this state. +- Negative => reduce, -yyn is rule number. +- Positive => shift, yyn is new state. +- New state is final state => don't bother to shift, +- just return success. +- 0, or most negative number => error. */ +- +- if (yyn < 0) ++ if (yyn <= 0) + { +- if (yyn == YYFLAG) ++ if (yyn == 0 || yyn == YYTABLE_NINF) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } +- else if (yyn == 0) +- goto yyerrlab; + + if (yyn == YYFINAL) + YYACCEPT; + + /* Shift the lookahead token. */ +- +-#if YYDEBUG != 0 +- if (yydebug) +- fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); +-#endif ++ YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken])); + + /* Discard the token being shifted unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; + + *++yyvsp = yylval; +-#ifdef YYLSP_NEEDED +- *++yylsp = yylloc; +-#endif + +- /* count tokens shifted since error; after three, turn off error status. */ +- if (yyerrstatus) yyerrstatus--; ++ ++ /* Count tokens shifted since error; after three, turn off error ++ status. */ ++ if (yyerrstatus) ++ yyerrstatus--; + + yystate = yyn; + goto yynewstate; + +-/* Do the default action for the current state. */ +-yydefault: + ++/*-----------------------------------------------------------. ++| yydefault -- do the default action for the current state. | ++`-----------------------------------------------------------*/ ++yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; ++ goto yyreduce; ++ + +-/* Do a reduction. yyn is the number of a rule to reduce with. */ ++/*-----------------------------. ++| yyreduce -- Do a reduction. | ++`-----------------------------*/ + yyreduce: ++ /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; +- if (yylen > 0) +- yyval = yyvsp[1-yylen]; /* implement default value of the action */ + +-#if YYDEBUG != 0 +- if (yydebug) +- { +- int i; ++ /* If YYLEN is nonzero, implement the default value of the action: ++ `$$ = $1'. + +- fprintf (stderr, "Reducing via rule %d (line %d), ", +- yyn, yyrline[yyn]); ++ Otherwise, the following line sets YYVAL to garbage. ++ This behavior is undocumented and Bison ++ users should not rely upon it. Assigning to YYVAL ++ unconditionally makes the parser a bit smaller, and it avoids a ++ GCC warning that YYVAL may be used uninitialized. */ ++ yyval = yyvsp[1-yylen]; + +- /* Print the symbols being reduced, and their result. */ +- for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) +- fprintf (stderr, "%s ", yytname[yyrhs[i]]); +- fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); +- } +-#endif + +- +- switch (yyn) { +- +-case 4: +-#line 47 "cfg_y.y" +-{ ++ YY_REDUCE_PRINT (yyn); ++ switch (yyn) ++ { ++ case 5: ++#line 50 "cfg_y.y" ++ { + control_init(yyvsp[-1].str); +- ; +- break;} +-case 5: +-#line 54 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 6: ++#line 57 "cfg_y.y" ++ { + fab_option(yyvsp[-1].str,yyvsp[0].str); +- ; +- break;} +-case 6: +-#line 61 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 7: ++#line 64 "cfg_y.y" ++ { + itf = 0; +- ; +- break;} +-case 7: +-#line 65 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 8: ++#line 68 "cfg_y.y" ++ { + char *tmp; + + tmp = strdup(yyvsp[-3].str); + if (!tmp) yyerror(strerror(errno)); + sig = sig_vc(yyvsp[-4].str,tmp,itf); +- ; +- break;} +-case 9: +-#line 77 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 10: ++#line 80 "cfg_y.y" ++ { + yyval.str = NULL; +- ; +- break;} +-case 10: +-#line 81 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 11: ++#line 84 "cfg_y.y" ++ { + yyval.str = strdup(yyvsp[0].str); + if (!yyval.str) yyerror(strerror(errno)); +- ; +- break;} +-case 12: +-#line 89 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 13: ++#line 92 "cfg_y.y" ++ { + itf = yyvsp[0].num; +- ; +- break;} +-case 14: +-#line 96 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 15: ++#line 99 "cfg_y.y" ++ { + sig->pvc = yyvsp[0].pvc; +- ; +- break;} +-case 17: +-#line 104 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 18: ++#line 107 "cfg_y.y" ++ { + put_route(NULL,0,sig); +- ; +- break;} +-case 19: +-#line 112 "cfg_y.y" +-{ ++ } ++ break; ++ ++ case 20: ++#line 115 "cfg_y.y" ++ { + struct sockaddr_atmsvc addr; + char *mask; + +@@ -790,228 +1124,236 @@ + return; + } + put_route(&addr,mask ? strtol(mask,NULL,10) : INT_MAX,sig); +- ; +- break;} +-} +- /* the action file gets copied in in place of this dollarsign */ +-#line 543 "/usr/lib/bison.simple" ++ } ++ break; ++ ++ ++ } ++ ++/* Line 1010 of yacc.c. */ ++#line 1135 "y.tab.c" + + yyvsp -= yylen; + yyssp -= yylen; +-#ifdef YYLSP_NEEDED +- yylsp -= yylen; +-#endif + +-#if YYDEBUG != 0 +- if (yydebug) +- { +- short *ssp1 = yyss - 1; +- fprintf (stderr, "state stack now"); +- while (ssp1 != yyssp) +- fprintf (stderr, " %d", *++ssp1); +- fprintf (stderr, "\n"); +- } +-#endif ++ ++ YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + +-#ifdef YYLSP_NEEDED +- yylsp++; +- if (yylen == 0) +- { +- yylsp->first_line = yylloc.first_line; +- yylsp->first_column = yylloc.first_column; +- yylsp->last_line = (yylsp-1)->last_line; +- yylsp->last_column = (yylsp-1)->last_column; +- yylsp->text = 0; +- } +- else +- { +- yylsp->last_line = (yylsp+yylen-1)->last_line; +- yylsp->last_column = (yylsp+yylen-1)->last_column; +- } +-#endif + +- /* Now "shift" the result of the reduction. +- Determine what state that goes to, +- based on the state we popped back to +- and the rule number reduced by. */ ++ /* Now `shift' the result of the reduction. Determine what state ++ that goes to, based on the state we popped back to and the rule ++ number reduced by. */ + + yyn = yyr1[yyn]; + +- yystate = yypgoto[yyn - YYNTBASE] + *yyssp; +- if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) ++ yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; ++ if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else +- yystate = yydefgoto[yyn - YYNTBASE]; ++ yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + +-yyerrlab: /* here on detecting error */ + +- if (! yyerrstatus) +- /* If not already recovering from an error, report this error. */ ++/*------------------------------------. ++| yyerrlab -- here on detecting error | ++`------------------------------------*/ ++yyerrlab: ++ /* If not already recovering from an error, report this error. */ ++ if (!yyerrstatus) + { + ++yynerrs; +- +-#ifdef YYERROR_VERBOSE ++#if YYERROR_VERBOSE + yyn = yypact[yystate]; + +- if (yyn > YYFLAG && yyn < YYLAST) ++ if (YYPACT_NINF < yyn && yyn < YYLAST) + { +- int size = 0; +- char *msg; +- int x, count; +- +- count = 0; +- /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ +- for (x = (yyn < 0 ? -yyn : 0); +- x < (sizeof(yytname) / sizeof(char *)); x++) +- if (yycheck[x + yyn] == x) +- size += strlen(yytname[x]) + 15, count++; +- msg = (char *) malloc(size + 15); +- if (msg != 0) ++ YYSIZE_T yysize = 0; ++ int yytype = YYTRANSLATE (yychar); ++ const char* yyprefix; ++ char *yymsg; ++ int yyx; ++ ++ /* Start YYX at -YYN if negative to avoid negative indexes in ++ YYCHECK. */ ++ int yyxbegin = yyn < 0 ? -yyn : 0; ++ ++ /* Stay within bounds of both yycheck and yytname. */ ++ int yychecklim = YYLAST - yyn; ++ int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; ++ int yycount = 0; ++ ++ yyprefix = ", expecting "; ++ for (yyx = yyxbegin; yyx < yyxend; ++yyx) ++ if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) ++ { ++ yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]); ++ yycount += 1; ++ if (yycount == 5) ++ { ++ yysize = 0; ++ break; ++ } ++ } ++ yysize += (sizeof ("syntax error, unexpected ") ++ + yystrlen (yytname[yytype])); ++ yymsg = (char *) YYSTACK_ALLOC (yysize); ++ if (yymsg != 0) + { +- strcpy(msg, "parse error"); ++ char *yyp = yystpcpy (yymsg, "syntax error, unexpected "); ++ yyp = yystpcpy (yyp, yytname[yytype]); + +- if (count < 5) ++ if (yycount < 5) + { +- count = 0; +- for (x = (yyn < 0 ? -yyn : 0); +- x < (sizeof(yytname) / sizeof(char *)); x++) +- if (yycheck[x + yyn] == x) ++ yyprefix = ", expecting "; ++ for (yyx = yyxbegin; yyx < yyxend; ++yyx) ++ if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { +- strcat(msg, count == 0 ? ", expecting `" : " or `"); +- strcat(msg, yytname[x]); +- strcat(msg, "'"); +- count++; ++ yyp = yystpcpy (yyp, yyprefix); ++ yyp = yystpcpy (yyp, yytname[yyx]); ++ yyprefix = " or "; + } + } +- yyerror(msg); +- free(msg); ++ yyerror (yymsg); ++ YYSTACK_FREE (yymsg); + } + else +- yyerror ("parse error; also virtual memory exceeded"); ++ yyerror ("syntax error; also virtual memory exhausted"); + } + else + #endif /* YYERROR_VERBOSE */ +- yyerror("parse error"); ++ yyerror ("syntax error"); + } + +- goto yyerrlab1; +-yyerrlab1: /* here on error raised explicitly by an action */ ++ + + if (yyerrstatus == 3) + { +- /* if just tried and failed to reuse lookahead token after an error, discard it. */ ++ /* If just tried and failed to reuse lookahead token after an ++ error, discard it. */ + +- /* return failure if at end of input */ +- if (yychar == YYEOF) +- YYABORT; +- +-#if YYDEBUG != 0 +- if (yydebug) +- fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); +-#endif ++ if (yychar <= YYEOF) ++ { ++ /* If at end of input, pop the error token, ++ then the rest of the stack, then return failure. */ ++ if (yychar == YYEOF) ++ for (;;) ++ { ++ YYPOPSTACK; ++ if (yyssp == yyss) ++ YYABORT; ++ YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); ++ yydestruct (yystos[*yyssp], yyvsp); ++ } ++ } ++ else ++ { ++ YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc); ++ yydestruct (yytoken, &yylval); ++ yychar = YYEMPTY; + +- yychar = YYEMPTY; ++ } + } + +- /* Else will try to reuse lookahead token +- after shifting the error token. */ +- +- yyerrstatus = 3; /* Each real token shifted decrements this */ ++ /* Else will try to reuse lookahead token after shifting the error ++ token. */ ++ goto yyerrlab1; + +- goto yyerrhandle; + +-yyerrdefault: /* current state does not do anything special for the error token. */ ++/*---------------------------------------------------. ++| yyerrorlab -- error raised explicitly by YYERROR. | ++`---------------------------------------------------*/ ++yyerrorlab: + +-#if 0 +- /* This is wrong; only states that explicitly want error tokens +- should shift them. */ +- yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ +- if (yyn) goto yydefault; ++#ifdef __GNUC__ ++ /* Pacify GCC when the user code never invokes YYERROR and the label ++ yyerrorlab therefore never appears in user code. */ ++ if (0) ++ goto yyerrorlab; + #endif + +-yyerrpop: /* pop the current state because it cannot handle the error token */ +- +- if (yyssp == yyss) YYABORT; +- yyvsp--; +- yystate = *--yyssp; +-#ifdef YYLSP_NEEDED +- yylsp--; +-#endif ++ yyvsp -= yylen; ++ yyssp -= yylen; ++ yystate = *yyssp; ++ goto yyerrlab1; + +-#if YYDEBUG != 0 +- if (yydebug) +- { +- short *ssp1 = yyss - 1; +- fprintf (stderr, "Error: state stack now"); +- while (ssp1 != yyssp) +- fprintf (stderr, " %d", *++ssp1); +- fprintf (stderr, "\n"); +- } +-#endif + +-yyerrhandle: ++/*-------------------------------------------------------------. ++| yyerrlab1 -- common code for both syntax error and YYERROR. | ++`-------------------------------------------------------------*/ ++yyerrlab1: ++ yyerrstatus = 3; /* Each real token shifted decrements this. */ + +- yyn = yypact[yystate]; +- if (yyn == YYFLAG) +- goto yyerrdefault; ++ for (;;) ++ { ++ yyn = yypact[yystate]; ++ if (yyn != YYPACT_NINF) ++ { ++ yyn += YYTERROR; ++ if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) ++ { ++ yyn = yytable[yyn]; ++ if (0 < yyn) ++ break; ++ } ++ } + +- yyn += YYTERROR; +- if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) +- goto yyerrdefault; ++ /* Pop the current state because it cannot handle the error token. */ ++ if (yyssp == yyss) ++ YYABORT; + +- yyn = yytable[yyn]; +- if (yyn < 0) +- { +- if (yyn == YYFLAG) +- goto yyerrpop; +- yyn = -yyn; +- goto yyreduce; ++ YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); ++ yydestruct (yystos[yystate], yyvsp); ++ YYPOPSTACK; ++ yystate = *yyssp; ++ YY_STACK_PRINT (yyss, yyssp); + } +- else if (yyn == 0) +- goto yyerrpop; + + if (yyn == YYFINAL) + YYACCEPT; + +-#if YYDEBUG != 0 +- if (yydebug) +- fprintf(stderr, "Shifting error token, "); +-#endif ++ YYDPRINTF ((stderr, "Shifting error token, ")); + + *++yyvsp = yylval; +-#ifdef YYLSP_NEEDED +- *++yylsp = yylloc; +-#endif ++ + + yystate = yyn; + goto yynewstate; + +- yyacceptlab: +- /* YYACCEPT comes here. */ +- if (yyfree_stacks) +- { +- free (yyss); +- free (yyvs); +-#ifdef YYLSP_NEEDED +- free (yyls); +-#endif +- } +- return 0; + +- yyabortlab: +- /* YYABORT comes here. */ +- if (yyfree_stacks) +- { +- free (yyss); +- free (yyvs); +-#ifdef YYLSP_NEEDED +- free (yyls); ++/*-------------------------------------. ++| yyacceptlab -- YYACCEPT comes here. | ++`-------------------------------------*/ ++yyacceptlab: ++ yyresult = 0; ++ goto yyreturn; ++ ++/*-----------------------------------. ++| yyabortlab -- YYABORT comes here. | ++`-----------------------------------*/ ++yyabortlab: ++ yyresult = 1; ++ goto yyreturn; ++ ++#ifndef yyoverflow ++/*----------------------------------------------. ++| yyoverflowlab -- parser overflow comes here. | ++`----------------------------------------------*/ ++yyoverflowlab: ++ yyerror ("parser stack overflow"); ++ yyresult = 2; ++ /* Fall through. */ ++#endif ++ ++yyreturn: ++#ifndef yyoverflow ++ if (yyss != yyssa) ++ YYSTACK_FREE (yyss); + #endif +- } +- return 1; ++ return yyresult; + } +-#line 126 "cfg_y.y" ++ ++ ++ +--- linux-atm-2.4.1.orig/src/switch/cfg_y.y ++++ linux-atm-2.4.1/src/switch/cfg_y.y +@@ -10,6 +10,7 @@ + #include <string.h> + #include <errno.h> + #include <limits.h> ++#include <stdlib.h> + + #include "atm.h" + +@@ -19,6 +20,8 @@ + #include "swc.h" + + ++extern void yyerror(const char *s); ++ + static int itf; + static SIGNALING_ENTITY *sig; + +--- linux-atm-2.4.1.orig/src/switch/cfg_y.h ++++ linux-atm-2.4.1/src/switch/cfg_y.h +@@ -1,19 +1,77 @@ +-typedef union { ++/* A Bison parser, made by GNU Bison 1.875d. */ ++ ++/* Skeleton parser for Yacc-like parsing with Bison, ++ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++ ++ 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 ++ the Free Software Foundation; either version 2, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software ++ Foundation, Inc., 59 Temple Place - Suite 330, ++ Boston, MA 02111-1307, USA. */ ++ ++/* As a special exception, when this file is copied by Bison into a ++ Bison output file, you may use that output file without restriction. ++ This special exception was added by the Free Software Foundation ++ in version 1.24 of Bison. */ ++ ++/* Tokens. */ ++#ifndef YYTOKENTYPE ++# define YYTOKENTYPE ++ /* Put the tokens into the symbol table, so that GDB and other debuggers ++ know about them. */ ++ enum yytokentype { ++ TOK_COMMAND = 258, ++ TOK_VPCI = 259, ++ TOK_ITF = 260, ++ TOK_DEFAULT = 261, ++ TOK_ROUTE = 262, ++ TOK_STR = 263, ++ TOK_SOCKET = 264, ++ TOK_OPTION = 265, ++ TOK_CONTROL = 266, ++ TOK_NUM = 267, ++ TOK_PVC = 268 ++ }; ++#endif ++#define TOK_COMMAND 258 ++#define TOK_VPCI 259 ++#define TOK_ITF 260 ++#define TOK_DEFAULT 261 ++#define TOK_ROUTE 262 ++#define TOK_STR 263 ++#define TOK_SOCKET 264 ++#define TOK_OPTION 265 ++#define TOK_CONTROL 266 ++#define TOK_NUM 267 ++#define TOK_PVC 268 ++ ++ ++ ++ ++#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) ++#line 30 "cfg_y.y" ++typedef union YYSTYPE { + int num; + char *str; + struct sockaddr_atmpvc pvc; + } YYSTYPE; +-#define TOK_COMMAND 257 +-#define TOK_VPCI 258 +-#define TOK_ITF 259 +-#define TOK_DEFAULT 260 +-#define TOK_ROUTE 261 +-#define TOK_STR 262 +-#define TOK_SOCKET 263 +-#define TOK_OPTION 264 +-#define TOK_CONTROL 265 +-#define TOK_NUM 266 +-#define TOK_PVC 267 +- ++/* Line 1285 of yacc.c. */ ++#line 69 "y.tab.h" ++# define yystype YYSTYPE /* obsolescent; will be withdrawn */ ++# define YYSTYPE_IS_DECLARED 1 ++# define YYSTYPE_IS_TRIVIAL 1 ++#endif + + extern YYSTYPE yylval; ++ ++ ++ +--- linux-atm-2.4.1.orig/src/switch/debug/Makefile.in ++++ linux-atm-2.4.1/src/switch/debug/Makefile.in +@@ -1,4 +1,4 @@ +-# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am ++# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am + + # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation +@@ -90,8 +90,7 @@ + INCLUDES = -I$(top_builddir)/src/qgen + + sw_debug_SOURCES = debug.c +-sw_debug_XTRAS = $(top_builddir)/src/switch/libsw.a \ +- $(top_builddir)/src/lib/libatm.la ++sw_debug_XTRAS = $(top_builddir)/src/switch/libsw.a $(top_builddir)/src/lib/libatm.la + + sw_debug_LDADD = $(sw_debug_XTRAS) -lfl + +@@ -121,8 +120,9 @@ + + DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +-TAR = gtar ++TAR = tar + GZIP_ENV = --best ++DEP_FILES = .deps/debug.P + SOURCES = $(sw_debug_SOURCES) + OBJECTS = $(sw_debug_OBJECTS) + +@@ -130,9 +130,9 @@ + .SUFFIXES: + .SUFFIXES: .S .c .lo .o .obj .s + $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +- cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps src/switch/debug/Makefile ++ cd $(top_srcdir) && $(AUTOMAKE) --gnu src/switch/debug/Makefile + +-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +@@ -146,9 +146,6 @@ + + maintainer-clean-noinstPROGRAMS: + +-.c.o: +- $(COMPILE) -c $< +- + # FIXME: We should only use cygpath when building on Windows, + # and only if it is available. + .c.obj: +@@ -171,9 +168,6 @@ + + maintainer-clean-compile: + +-.c.lo: +- $(LIBTOOL) --mode=compile $(COMPILE) -c $< +- + .s.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +@@ -212,7 +206,7 @@ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ +- || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) ++ || (cd $(srcdir) && etags -o $$here/TAGS $(ETAGS_ARGS) $$tags $$unique $(LISP)) + + mostlyclean-tags: + +@@ -228,6 +222,11 @@ + subdir = src/switch/debug + + distdir: $(DISTFILES) ++ here=`cd $(top_builddir) && pwd`; \ ++ top_distdir=`cd $(top_distdir) && pwd`; \ ++ distdir=`cd $(distdir) && pwd`; \ ++ cd $(top_srcdir) \ ++ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu src/switch/debug/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ +@@ -238,11 +237,38 @@ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done +-debug.o: debug.c ../../../config.h ../../../src/include/atm.h \ +- ../../../src/include/stdint.h ../../../src/include/atmd.h \ +- ../../../src/qgen/uni.h ../fab.h ../proto.h \ +- ../../../src/include/atmsap.h ../sig.h + ++DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) ++ ++-include $(DEP_FILES) ++ ++mostlyclean-depend: ++ ++clean-depend: ++ ++distclean-depend: ++ -rm -rf .deps ++ ++maintainer-clean-depend: ++ ++%.o: %.c ++ @echo '$(COMPILE) -c $<'; \ ++ $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< ++ @-cp .deps/$(*F).pp .deps/$(*F).P; \ ++ tr ' ' '\012' < .deps/$(*F).pp \ ++ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ ++ >> .deps/$(*F).P; \ ++ rm .deps/$(*F).pp ++ ++%.lo: %.c ++ @echo '$(LTCOMPILE) -c $<'; \ ++ $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< ++ @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ ++ < .deps/$(*F).pp > .deps/$(*F).P; \ ++ tr ' ' '\012' < .deps/$(*F).pp \ ++ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ ++ >> .deps/$(*F).P; \ ++ rm -f .deps/$(*F).pp + info-am: + info: info-am + dvi-am: +@@ -279,27 +305,27 @@ + + maintainer-clean-generic: + mostlyclean-am: mostlyclean-noinstPROGRAMS mostlyclean-compile \ +- mostlyclean-libtool mostlyclean-tags \ ++ mostlyclean-libtool mostlyclean-tags mostlyclean-depend \ + mostlyclean-generic + + mostlyclean: mostlyclean-am + + clean-am: clean-noinstPROGRAMS clean-compile clean-libtool clean-tags \ +- clean-generic mostlyclean-am ++ clean-depend clean-generic mostlyclean-am + + clean: clean-am + + distclean-am: distclean-noinstPROGRAMS distclean-compile \ +- distclean-libtool distclean-tags distclean-generic \ +- clean-am ++ distclean-libtool distclean-tags distclean-depend \ ++ distclean-generic clean-am + -rm -f libtool + + distclean: distclean-am + + maintainer-clean-am: maintainer-clean-noinstPROGRAMS \ + maintainer-clean-compile maintainer-clean-libtool \ +- maintainer-clean-tags maintainer-clean-generic \ +- distclean-am ++ maintainer-clean-tags maintainer-clean-depend \ ++ maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +@@ -310,12 +336,14 @@ + mostlyclean-compile distclean-compile clean-compile \ + maintainer-clean-compile mostlyclean-libtool distclean-libtool \ + clean-libtool maintainer-clean-libtool tags mostlyclean-tags \ +-distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ +-dvi-am dvi check check-am installcheck-am installcheck install-exec-am \ +-install-exec install-data-am install-data install-am install \ +-uninstall-am uninstall all-redirect all-am all installdirs \ +-mostlyclean-generic distclean-generic clean-generic \ +-maintainer-clean-generic clean mostlyclean distclean maintainer-clean ++distclean-tags clean-tags maintainer-clean-tags distdir \ ++mostlyclean-depend distclean-depend clean-depend \ ++maintainer-clean-depend info-am info dvi-am dvi check check-am \ ++installcheck-am installcheck install-exec-am install-exec \ ++install-data-am install-data install-am install uninstall-am uninstall \ ++all-redirect all-am all installdirs mostlyclean-generic \ ++distclean-generic clean-generic maintainer-clean-generic clean \ ++mostlyclean distclean maintainer-clean + + + # Tell versions [3.59,3.63) of GNU make to not export all variables. +--- linux-atm-2.4.1.orig/src/switch/debug/debug.c ++++ linux-atm-2.4.1/src/switch/debug/debug.c +@@ -43,7 +43,7 @@ + + void fab_init(CALL *call) + { +- PRV(call) = alloc_t(FAB); ++ call->fab = alloc_t(FAB); + PRV(call)->next = calls; + calls = call; + } +@@ -59,7 +59,7 @@ + diag(COMPONENT,DIAG_FATAL,"fab_destroy: call %p not found",call); + *walk = PRV(call)->next; + free(PRV(call)); +- PRV(call) = NULL; ++ call->fab = NULL; + } + + +--- linux-atm-2.4.1.orig/src/switch/tcp/Makefile.in ++++ linux-atm-2.4.1/src/switch/tcp/Makefile.in +@@ -1,4 +1,4 @@ +-# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am ++# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am + + # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation +@@ -90,8 +90,7 @@ + INCLUDES = -I$(top_builddir)/src/qgen + + sw_tcp_SOURCES = tcpsw.c +-sw_tcp_XTRAS = $(top_builddir)/src/switch/libsw.a \ +- $(top_builddir)/src/lib/libatm.la ++sw_tcp_XTRAS = $(top_builddir)/src/switch/libsw.a $(top_builddir)/src/lib/libatm.la + + sw_tcp_LDADD = $(sw_tcp_XTRAS) -lfl + sw_tcp_DEPENDENCIES = $(sw_tcp_XTRAS) +@@ -120,8 +119,9 @@ + + DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +-TAR = gtar ++TAR = tar + GZIP_ENV = --best ++DEP_FILES = .deps/tcpsw.P + SOURCES = $(sw_tcp_SOURCES) + OBJECTS = $(sw_tcp_OBJECTS) + +@@ -129,9 +129,9 @@ + .SUFFIXES: + .SUFFIXES: .S .c .lo .o .obj .s + $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +- cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps src/switch/tcp/Makefile ++ cd $(top_srcdir) && $(AUTOMAKE) --gnu src/switch/tcp/Makefile + +-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +@@ -145,9 +145,6 @@ + + maintainer-clean-noinstPROGRAMS: + +-.c.o: +- $(COMPILE) -c $< +- + # FIXME: We should only use cygpath when building on Windows, + # and only if it is available. + .c.obj: +@@ -170,9 +167,6 @@ + + maintainer-clean-compile: + +-.c.lo: +- $(LIBTOOL) --mode=compile $(COMPILE) -c $< +- + .s.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +@@ -211,7 +205,7 @@ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ +- || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) ++ || (cd $(srcdir) && etags -o $$here/TAGS $(ETAGS_ARGS) $$tags $$unique $(LISP)) + + mostlyclean-tags: + +@@ -227,6 +221,11 @@ + subdir = src/switch/tcp + + distdir: $(DISTFILES) ++ here=`cd $(top_builddir) && pwd`; \ ++ top_distdir=`cd $(top_distdir) && pwd`; \ ++ distdir=`cd $(distdir) && pwd`; \ ++ cd $(top_srcdir) \ ++ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu src/switch/tcp/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ +@@ -237,11 +236,38 @@ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done +-tcpsw.o: tcpsw.c ../../../config.h ../../../src/include/stdint.h \ +- ../../../src/include/atm.h ../../../src/include/atmd.h \ +- ../../../src/qgen/uni.h ../fab.h ../proto.h \ +- ../../../src/include/atmsap.h ../sig.h ../dispatch.h ../swc.h + ++DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) ++ ++-include $(DEP_FILES) ++ ++mostlyclean-depend: ++ ++clean-depend: ++ ++distclean-depend: ++ -rm -rf .deps ++ ++maintainer-clean-depend: ++ ++%.o: %.c ++ @echo '$(COMPILE) -c $<'; \ ++ $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< ++ @-cp .deps/$(*F).pp .deps/$(*F).P; \ ++ tr ' ' '\012' < .deps/$(*F).pp \ ++ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ ++ >> .deps/$(*F).P; \ ++ rm .deps/$(*F).pp ++ ++%.lo: %.c ++ @echo '$(LTCOMPILE) -c $<'; \ ++ $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< ++ @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ ++ < .deps/$(*F).pp > .deps/$(*F).P; \ ++ tr ' ' '\012' < .deps/$(*F).pp \ ++ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ ++ >> .deps/$(*F).P; \ ++ rm -f .deps/$(*F).pp + info-am: + info: info-am + dvi-am: +@@ -278,27 +304,27 @@ + + maintainer-clean-generic: + mostlyclean-am: mostlyclean-noinstPROGRAMS mostlyclean-compile \ +- mostlyclean-libtool mostlyclean-tags \ ++ mostlyclean-libtool mostlyclean-tags mostlyclean-depend \ + mostlyclean-generic + + mostlyclean: mostlyclean-am + + clean-am: clean-noinstPROGRAMS clean-compile clean-libtool clean-tags \ +- clean-generic mostlyclean-am ++ clean-depend clean-generic mostlyclean-am + + clean: clean-am + + distclean-am: distclean-noinstPROGRAMS distclean-compile \ +- distclean-libtool distclean-tags distclean-generic \ +- clean-am ++ distclean-libtool distclean-tags distclean-depend \ ++ distclean-generic clean-am + -rm -f libtool + + distclean: distclean-am + + maintainer-clean-am: maintainer-clean-noinstPROGRAMS \ + maintainer-clean-compile maintainer-clean-libtool \ +- maintainer-clean-tags maintainer-clean-generic \ +- distclean-am ++ maintainer-clean-tags maintainer-clean-depend \ ++ maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +@@ -309,12 +335,14 @@ + mostlyclean-compile distclean-compile clean-compile \ + maintainer-clean-compile mostlyclean-libtool distclean-libtool \ + clean-libtool maintainer-clean-libtool tags mostlyclean-tags \ +-distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ +-dvi-am dvi check check-am installcheck-am installcheck install-exec-am \ +-install-exec install-data-am install-data install-am install \ +-uninstall-am uninstall all-redirect all-am all installdirs \ +-mostlyclean-generic distclean-generic clean-generic \ +-maintainer-clean-generic clean mostlyclean distclean maintainer-clean ++distclean-tags clean-tags maintainer-clean-tags distdir \ ++mostlyclean-depend distclean-depend clean-depend \ ++maintainer-clean-depend info-am info dvi-am dvi check check-am \ ++installcheck-am installcheck install-exec-am install-exec \ ++install-data-am install-data install-am install uninstall-am uninstall \ ++all-redirect all-am all installdirs mostlyclean-generic \ ++distclean-generic clean-generic maintainer-clean-generic clean \ ++mostlyclean distclean maintainer-clean + + + # Tell versions [3.59,3.63) of GNU make to not export all variables. +--- linux-atm-2.4.1.orig/src/switch/tcp/tcpsw.c ++++ linux-atm-2.4.1/src/switch/tcp/tcpsw.c +@@ -345,7 +345,7 @@ + + void fab_init(CALL *call) + { +- PRV(call) = alloc_t(FAB); ++ call->fab = alloc_t(FAB); + PRV(call)->active = 0; + PRV(call)->next = calls; + calls = call; +@@ -362,7 +362,7 @@ + diag(COMPONENT,DIAG_FATAL,"fab_destroy: call %p not found",call); + *walk = PRV(call)->next; + free(PRV(call)); +- PRV(call) = NULL; ++ call->fab = NULL; + } + + +--- linux-atm-2.4.1.orig/src/config/Makefile.in ++++ linux-atm-2.4.1/src/config/Makefile.in +@@ -1,4 +1,4 @@ +-# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am ++# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am + + # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation +@@ -96,14 +96,14 @@ + + DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +-TAR = gtar ++TAR = tar + GZIP_ENV = --best + all: all-redirect + .SUFFIXES: + $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +- cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps src/config/Makefile ++ cd $(top_srcdir) && $(AUTOMAKE) --gnu src/config/Makefile + +-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +@@ -186,7 +186,7 @@ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ +- || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) ++ || (cd $(srcdir) && etags -o $$here/TAGS $(ETAGS_ARGS) $$tags $$unique $(LISP)) + + mostlyclean-tags: + +@@ -202,6 +202,11 @@ + subdir = src/config + + distdir: $(DISTFILES) ++ here=`cd $(top_builddir) && pwd`; \ ++ top_distdir=`cd $(top_distdir) && pwd`; \ ++ distdir=`cd $(distdir) && pwd`; \ ++ cd $(top_srcdir) \ ++ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu src/config/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ +--- linux-atm-2.4.1.orig/src/config/init-redhat/Makefile.in ++++ linux-atm-2.4.1/src/config/init-redhat/Makefile.in +@@ -1,4 +1,4 @@ +-# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am ++# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am + + # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation +@@ -94,14 +94,14 @@ + + DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +-TAR = gtar ++TAR = tar + GZIP_ENV = --best + all: all-redirect + .SUFFIXES: + $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +- cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps src/config/init-redhat/Makefile ++ cd $(top_srcdir) && $(AUTOMAKE) --gnu src/config/init-redhat/Makefile + +-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +@@ -114,6 +114,11 @@ + subdir = src/config/init-redhat + + distdir: $(DISTFILES) ++ here=`cd $(top_builddir) && pwd`; \ ++ top_distdir=`cd $(top_distdir) && pwd`; \ ++ distdir=`cd $(distdir) && pwd`; \ ++ cd $(top_srcdir) \ ++ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu src/config/init-redhat/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ +--- linux-atm-2.4.1.orig/src/extra/Makefile.in ++++ linux-atm-2.4.1/src/extra/Makefile.in +@@ -1,4 +1,4 @@ +-# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am ++# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am + + # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation +@@ -96,14 +96,14 @@ + + DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +-TAR = gtar ++TAR = tar + GZIP_ENV = --best + all: all-redirect + .SUFFIXES: + $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +- cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps src/extra/Makefile ++ cd $(top_srcdir) && $(AUTOMAKE) --gnu src/extra/Makefile + +-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +@@ -188,7 +188,7 @@ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ +- || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) ++ || (cd $(srcdir) && etags -o $$here/TAGS $(ETAGS_ARGS) $$tags $$unique $(LISP)) + + mostlyclean-tags: + +@@ -204,6 +204,11 @@ + subdir = src/extra + + distdir: $(DISTFILES) ++ here=`cd $(top_builddir) && pwd`; \ ++ top_distdir=`cd $(top_distdir) && pwd`; \ ++ distdir=`cd $(distdir) && pwd`; \ ++ cd $(top_srcdir) \ ++ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu src/extra/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ +--- linux-atm-2.4.1.orig/src/extra/ANS/Makefile.in ++++ linux-atm-2.4.1/src/extra/ANS/Makefile.in +@@ -1,4 +1,4 @@ +-# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am ++# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am + + # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation +@@ -94,14 +94,14 @@ + + DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +-TAR = gtar ++TAR = tar + GZIP_ENV = --best + all: all-redirect + .SUFFIXES: + $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +- cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps src/extra/ANS/Makefile ++ cd $(top_srcdir) && $(AUTOMAKE) --gnu src/extra/ANS/Makefile + +-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +@@ -114,6 +114,11 @@ + subdir = src/extra/ANS + + distdir: $(DISTFILES) ++ here=`cd $(top_builddir) && pwd`; \ ++ top_distdir=`cd $(top_distdir) && pwd`; \ ++ distdir=`cd $(distdir) && pwd`; \ ++ cd $(top_srcdir) \ ++ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu src/extra/ANS/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ +--- linux-atm-2.4.1.orig/src/br2684/Makefile.am ++++ linux-atm-2.4.1/src/br2684/Makefile.am +@@ -0,0 +1,10 @@ ++sbin_PROGRAMS = br2684ctl ++ ++LDADD = $(top_builddir)/src/lib/libatm.la ++ ++br2684ctl_SOURCES = br2684ctl.c ++ ++man_MANS = br2684ctl.8 ++ ++EXTRA_DIST = $(man_MANS) USAGE.br2684 ++ +--- linux-atm-2.4.1.orig/src/br2684/Makefile.in ++++ linux-atm-2.4.1/src/br2684/Makefile.in +@@ -0,0 +1,418 @@ ++# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am ++ ++# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. ++# This Makefile.in is free software; the Free Software Foundation ++# gives unlimited permission to copy and/or distribute it, ++# with or without modifications, as long as this notice is preserved. ++ ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY, to the extent permitted by law; without ++# even the implied warranty of MERCHANTABILITY or FITNESS FOR A ++# PARTICULAR PURPOSE. ++ ++ ++SHELL = @SHELL@ ++ ++srcdir = @srcdir@ ++top_srcdir = @top_srcdir@ ++VPATH = @srcdir@ ++prefix = @prefix@ ++exec_prefix = @exec_prefix@ ++ ++bindir = @bindir@ ++sbindir = @sbindir@ ++libexecdir = @libexecdir@ ++datadir = @datadir@ ++sysconfdir = @sysconfdir@ ++sharedstatedir = @sharedstatedir@ ++localstatedir = @localstatedir@ ++libdir = @libdir@ ++infodir = @infodir@ ++mandir = @mandir@ ++includedir = @includedir@ ++oldincludedir = /usr/include ++ ++DESTDIR = ++ ++pkgdatadir = $(datadir)/@PACKAGE@ ++pkglibdir = $(libdir)/@PACKAGE@ ++pkgincludedir = $(includedir)/@PACKAGE@ ++ ++top_builddir = ../.. ++ ++ACLOCAL = @ACLOCAL@ ++AUTOCONF = @AUTOCONF@ ++AUTOMAKE = @AUTOMAKE@ ++AUTOHEADER = @AUTOHEADER@ ++ ++INSTALL = @INSTALL@ ++INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) ++INSTALL_DATA = @INSTALL_DATA@ ++INSTALL_SCRIPT = @INSTALL_SCRIPT@ ++transform = @program_transform_name@ ++ ++NORMAL_INSTALL = : ++PRE_INSTALL = : ++POST_INSTALL = : ++NORMAL_UNINSTALL = : ++PRE_UNINSTALL = : ++POST_UNINSTALL = : ++host_alias = @host_alias@ ++host_triplet = @host@ ++AR = @AR@ ++AS = @AS@ ++CC = /usr/src/openwrt/staging_dir_mipsel/bin/mipsel-linux-gcc ++CXX = @CXX@ ++CXXCPP = @CXXCPP@ ++DLLTOOL = @DLLTOOL@ ++ECHO = @ECHO@ ++EGREP = @EGREP@ ++EXEEXT = @EXEEXT@ ++F77 = @F77@ ++GCJ = @GCJ@ ++GCJFLAGS = @GCJFLAGS@ ++HAVE_LIB = @HAVE_LIB@ ++LEX = @LEX@ ++LIB = @LIB@ ++LIBTOOL = @LIBTOOL@ ++LIBTOOL_DEPS = @LIBTOOL_DEPS@ ++LIBVER_AGE = @LIBVER_AGE@ ++LIBVER_CURRENT = @LIBVER_CURRENT@ ++LIBVER_REVISION = @LIBVER_REVISION@ ++LN_S = @LN_S@ ++LTLIB = @LTLIB@ ++MAKEINFO = @MAKEINFO@ ++OBJDUMP = @OBJDUMP@ ++OBJEXT = @OBJEXT@ ++PACKAGE = @PACKAGE@ ++PERL = @PERL@ ++RANLIB = @RANLIB@ ++RC = @RC@ ++STRIP = @STRIP@ ++VERSION = @VERSION@ ++YACC = @YACC@ ++ ++sbin_PROGRAMS = br2684ctl ++ ++LDADD = $(top_builddir)/src/lib/libatm.la ++ ++br2684ctl_SOURCES = br2684ctl.c ++ ++man_MANS = br2684ctl.8 ++ ++EXTRA_DIST = $(man_MANS) USAGE.br2684 ++mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs ++CONFIG_HEADER = ../../config.h ++CONFIG_CLEAN_FILES = ++sbin_PROGRAMS = br2684ctl$(EXEEXT) ++PROGRAMS = $(sbin_PROGRAMS) ++ ++ ++DEFS = @DEFS@ -I. -I$(srcdir) -I../.. ++CPPFLAGS = @CPPFLAGS@ ++LDFLAGS = @LDFLAGS@ ++LIBS = @LIBS@ ++br2684ctl_OBJECTS = br2684ctl.$(OBJEXT) ++br2684ctl_LDADD = $(LDADD) ++br2684ctl_DEPENDENCIES = $(top_builddir)/src/lib/libatm.la ++br2684ctl_LDFLAGS = ++CFLAGS = @CFLAGS@ ++COMPILE = $(TARGET_CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) ++LTCOMPILE = $(LIBTOOL) --mode=compile $(TARGET_CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) ++CCLD = $(TARGET_CC) ++LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ ++man8dir = $(mandir)/man8 ++MANS = $(man_MANS) ++ ++NROFF = nroff ++DIST_COMMON = Makefile.am Makefile.in ++ ++ ++DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) ++ ++TAR = tar ++GZIP_ENV = --best ++DEP_FILES = .deps/br2684ctl.P ++SOURCES = $(br2684ctl_SOURCES) ++OBJECTS = $(br2684ctl_OBJECTS) ++ ++all: all-redirect ++.SUFFIXES: ++.SUFFIXES: .S .c .lo .o .obj .s ++$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) ++ cd $(top_srcdir) && $(AUTOMAKE) --gnu src/br2684/Makefile ++ ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) ++ cd $(top_builddir) \ ++ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status ++ ++ ++mostlyclean-sbinPROGRAMS: ++ ++clean-sbinPROGRAMS: ++ -test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS) ++ ++distclean-sbinPROGRAMS: ++ ++maintainer-clean-sbinPROGRAMS: ++ ++install-sbinPROGRAMS: $(sbin_PROGRAMS) ++ @$(NORMAL_INSTALL) ++ $(mkinstalldirs) $(DESTDIR)$(sbindir) ++ @list='$(sbin_PROGRAMS)'; for p in $$list; do \ ++ if test -f $$p; then \ ++ echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \ ++ $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ ++ else :; fi; \ ++ done ++ ++uninstall-sbinPROGRAMS: ++ @$(NORMAL_UNINSTALL) ++ list='$(sbin_PROGRAMS)'; for p in $$list; do \ ++ rm -f $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ ++ done ++ ++# FIXME: We should only use cygpath when building on Windows, ++# and only if it is available. ++.c.obj: ++ $(COMPILE) -c `cygpath -w $<` ++ ++.s.o: ++ $(COMPILE) -c $< ++ ++.S.o: ++ $(COMPILE) -c $< ++ ++mostlyclean-compile: ++ -rm -f *.o core *.core ++ -rm -f *.$(OBJEXT) ++ ++clean-compile: ++ ++distclean-compile: ++ -rm -f *.tab.c ++ ++maintainer-clean-compile: ++ ++.s.lo: ++ $(LIBTOOL) --mode=compile $(COMPILE) -c $< ++ ++.S.lo: ++ $(LIBTOOL) --mode=compile $(COMPILE) -c $< ++ ++mostlyclean-libtool: ++ -rm -f *.lo ++ ++clean-libtool: ++ -rm -rf .libs _libs ++ ++distclean-libtool: ++ ++maintainer-clean-libtool: ++ ++br2684ctl$(EXEEXT): $(br2684ctl_OBJECTS) $(br2684ctl_DEPENDENCIES) ++ @rm -f br2684ctl$(EXEEXT) ++ $(LINK) $(br2684ctl_LDFLAGS) $(br2684ctl_OBJECTS) $(br2684ctl_LDADD) $(LIBS) ++ ++install-man8: ++ $(mkinstalldirs) $(DESTDIR)$(man8dir) ++ @list='$(man8_MANS)'; \ ++ l2='$(man_MANS)'; for i in $$l2; do \ ++ case "$$i" in \ ++ *.8*) list="$$list $$i" ;; \ ++ esac; \ ++ done; \ ++ for i in $$list; do \ ++ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ ++ else file=$$i; fi; \ ++ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ ++ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ ++ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ ++ echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst"; \ ++ $(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst; \ ++ done ++ ++uninstall-man8: ++ @list='$(man8_MANS)'; \ ++ l2='$(man_MANS)'; for i in $$l2; do \ ++ case "$$i" in \ ++ *.8*) list="$$list $$i" ;; \ ++ esac; \ ++ done; \ ++ for i in $$list; do \ ++ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ ++ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ ++ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ ++ echo " rm -f $(DESTDIR)$(man8dir)/$$inst"; \ ++ rm -f $(DESTDIR)$(man8dir)/$$inst; \ ++ done ++install-man: $(MANS) ++ @$(NORMAL_INSTALL) ++ $(MAKE) $(AM_MAKEFLAGS) install-man8 ++uninstall-man: ++ @$(NORMAL_UNINSTALL) ++ $(MAKE) $(AM_MAKEFLAGS) uninstall-man8 ++ ++tags: TAGS ++ ++ID: $(HEADERS) $(SOURCES) $(LISP) ++ list='$(SOURCES) $(HEADERS)'; \ ++ unique=`for i in $$list; do echo $$i; done | \ ++ awk ' { files[$$0] = 1; } \ ++ END { for (i in files) print i; }'`; \ ++ here=`pwd` && cd $(srcdir) \ ++ && mkid -f$$here/ID $$unique $(LISP) ++ ++TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) ++ tags=; \ ++ here=`pwd`; \ ++ list='$(SOURCES) $(HEADERS)'; \ ++ unique=`for i in $$list; do echo $$i; done | \ ++ awk ' { files[$$0] = 1; } \ ++ END { for (i in files) print i; }'`; \ ++ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ ++ || (cd $(srcdir) && etags -o $$here/TAGS $(ETAGS_ARGS) $$tags $$unique $(LISP)) ++ ++mostlyclean-tags: ++ ++clean-tags: ++ ++distclean-tags: ++ -rm -f TAGS ID ++ ++maintainer-clean-tags: ++ ++distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) ++ ++subdir = src/br2684 ++ ++distdir: $(DISTFILES) ++ here=`cd $(top_builddir) && pwd`; \ ++ top_distdir=`cd $(top_distdir) && pwd`; \ ++ distdir=`cd $(distdir) && pwd`; \ ++ cd $(top_srcdir) \ ++ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu src/br2684/Makefile ++ @for file in $(DISTFILES); do \ ++ d=$(srcdir); \ ++ if test -d $$d/$$file; then \ ++ cp -pr $$d/$$file $(distdir)/$$file; \ ++ else \ ++ test -f $(distdir)/$$file \ ++ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ ++ || cp -p $$d/$$file $(distdir)/$$file || :; \ ++ fi; \ ++ done ++ ++DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) ++ ++-include $(DEP_FILES) ++ ++mostlyclean-depend: ++ ++clean-depend: ++ ++distclean-depend: ++ -rm -rf .deps ++ ++maintainer-clean-depend: ++ ++%.o: %.c ++ @echo '$(COMPILE) -c $<'; \ ++ $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< ++ @-cp .deps/$(*F).pp .deps/$(*F).P; \ ++ tr ' ' '\012' < .deps/$(*F).pp \ ++ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ ++ >> .deps/$(*F).P; \ ++ rm .deps/$(*F).pp ++ ++%.lo: %.c ++ @echo '$(LTCOMPILE) -c $<'; \ ++ $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< ++ @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ ++ < .deps/$(*F).pp > .deps/$(*F).P; \ ++ tr ' ' '\012' < .deps/$(*F).pp \ ++ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ ++ >> .deps/$(*F).P; \ ++ rm -f .deps/$(*F).pp ++info-am: ++info: info-am ++dvi-am: ++dvi: dvi-am ++check-am: all-am ++check: check-am ++installcheck-am: ++installcheck: installcheck-am ++install-exec-am: install-sbinPROGRAMS ++install-exec: install-exec-am ++ ++install-data-am: install-man ++install-data: install-data-am ++ ++install-am: all-am ++ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am ++install: install-am ++uninstall-am: uninstall-sbinPROGRAMS uninstall-man ++uninstall: uninstall-am ++all-am: Makefile $(PROGRAMS) $(MANS) ++all-redirect: all-am ++install-strip: ++ $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install ++installdirs: ++ $(mkinstalldirs) $(DESTDIR)$(sbindir) $(DESTDIR)$(mandir)/man8 ++ ++ ++mostlyclean-generic: ++ ++clean-generic: ++ ++distclean-generic: ++ -rm -f Makefile $(CONFIG_CLEAN_FILES) ++ -rm -f config.cache config.log stamp-h stamp-h[0-9]* ++ ++maintainer-clean-generic: ++mostlyclean-am: mostlyclean-sbinPROGRAMS mostlyclean-compile \ ++ mostlyclean-libtool mostlyclean-tags mostlyclean-depend \ ++ mostlyclean-generic ++ ++mostlyclean: mostlyclean-am ++ ++clean-am: clean-sbinPROGRAMS clean-compile clean-libtool clean-tags \ ++ clean-depend clean-generic mostlyclean-am ++ ++clean: clean-am ++ ++distclean-am: distclean-sbinPROGRAMS distclean-compile \ ++ distclean-libtool distclean-tags distclean-depend \ ++ distclean-generic clean-am ++ -rm -f libtool ++ ++distclean: distclean-am ++ ++maintainer-clean-am: maintainer-clean-sbinPROGRAMS \ ++ maintainer-clean-compile maintainer-clean-libtool \ ++ maintainer-clean-tags maintainer-clean-depend \ ++ maintainer-clean-generic distclean-am ++ @echo "This command is intended for maintainers to use;" ++ @echo "it deletes files that may require special tools to rebuild." ++ ++maintainer-clean: maintainer-clean-am ++ ++.PHONY: mostlyclean-sbinPROGRAMS distclean-sbinPROGRAMS \ ++clean-sbinPROGRAMS maintainer-clean-sbinPROGRAMS uninstall-sbinPROGRAMS \ ++install-sbinPROGRAMS mostlyclean-compile distclean-compile \ ++clean-compile maintainer-clean-compile mostlyclean-libtool \ ++distclean-libtool clean-libtool maintainer-clean-libtool install-man8 \ ++uninstall-man8 install-man uninstall-man tags mostlyclean-tags \ ++distclean-tags clean-tags maintainer-clean-tags distdir \ ++mostlyclean-depend distclean-depend clean-depend \ ++maintainer-clean-depend info-am info dvi-am dvi check check-am \ ++installcheck-am installcheck install-exec-am install-exec \ ++install-data-am install-data install-am install uninstall-am uninstall \ ++all-redirect all-am all installdirs mostlyclean-generic \ ++distclean-generic clean-generic maintainer-clean-generic clean \ ++mostlyclean distclean maintainer-clean ++ ++ ++# Tell versions [3.59,3.63) of GNU make to not export all variables. ++# Otherwise a system limit (for SysV at least) may be exceeded. ++.NOEXPORT: +--- linux-atm-2.4.1.orig/src/br2684/br2684ctl.8 ++++ linux-atm-2.4.1/src/br2684/br2684ctl.8 +@@ -0,0 +1,74 @@ ++.\" ++.TH br2684ctl 1 "7 Jul 2003" ++.SH NAME ++br2684ctl \- RFC1483/2684 Bridge Daemon ++.SH SYNOPSIS ++.B br2684ctl ++[ ++.BI \-b ++] [[ ++.BI \-c\ n ++] [ ++.BI \-e\ 0|1 ++] [ ++.BI \-s\ sndbuf ++] [ ++.BI \-a\ [itf].vpi.vci ++]] ... ++.SH PARAMETERS ++.TP 15 ++.BI \-a\ [itf].vpi.vci ++ATM PVC number, VPI and VCI. (Required) ++.BI \-b ++Puts the process in the background. ++.TP 15 ++.BI \-c\ n ++br2684 interface number such as 0, 1, ... (Required) ++.TP 15 ++.BI \-e\ 0|1 ++Encapsulation method: 0=LLC, 1=VC mux (the default is 0 or LLC) ++.TP 15 ++.TP 15 ++.BI \-s\ sndbuf ++Send buffer size. Default is 8192. ++.SH DESCRIPTION ++br2684ctl handles RFC1483/2684 bridged PDUs. ++This is most often used in ADSL scenarios where ++.I usually ++the subscribers' ++ethernet traffic is encapsulated in ATM AAL5 (by bridging ADSL modems) ++according to RFC2684. ++The subscriber-side ADSL modem can be external with an ethernet connector ++or an internal ADSL card in a PC. ++RFC1483 has been obsoleted by RFC2684. ++ ++For example it is possible to set up your Linux box to handle several ++ATM PVC's with bridged-1483 (sometimes referred as SNAP) encapsulation. ++The Linux network stack might provide DHCP, IP masquerading, IP firewall services or ++bridge the Ethernet frames just like it had several ethernet interfaces. ++In fact it can have several (logical) ethernet interfaces, where ++ATM is just used as a carrier. ++.SH USAGE ++br2684ctl creates a new network interface named nas[n] ++which is bound to an specific ATM PVC. It requires two mandatory ++arguments: -c, the interface number, and -a, the ATM PVC. It should be ++noted that the order of the command arguments matter; -c should be ++followed by -a. You can create as many interfaces as necessary ++in one go, just make a long command line ;) ++ ++For example, following command will create a nas0 interface which uses ++the ATM PVC with VPI=0 and VCI=401. You need to configure the PVC connection ++0.401 on the ATM switch manually. ++ ++% br2684ctl -c 0 -a 0.401 ++ ++The command will only create a new interface nas0. ++Next step is to assign an IP address and netmask to ++the interface nas0 using the ifconfig command. Using ifconfig, you can ++also assign a Ethernet MAC address to the interface nas0, if necessary. ++ ++% ifconfig nas0 192.168.2.1 netmask 255.255.255.0 ++.SH NOTES ++This man page is based on a tutorial by by Joonbum Byun <jbyun@megaxess.com> ++.SH SEE ALSO ++.BR qos (7) +--- linux-atm-2.4.1.orig/doc/Makefile.in ++++ linux-atm-2.4.1/doc/Makefile.in +@@ -1,4 +1,4 @@ +-# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am ++# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am + + # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation +@@ -96,14 +96,14 @@ + + DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +-TAR = gtar ++TAR = tar + GZIP_ENV = --best + all: all-redirect + .SUFFIXES: + $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +- cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps doc/Makefile ++ cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile + +-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +@@ -116,6 +116,11 @@ + subdir = doc + + distdir: $(DISTFILES) ++ here=`cd $(top_builddir) && pwd`; \ ++ top_distdir=`cd $(top_distdir) && pwd`; \ ++ distdir=`cd $(distdir) && pwd`; \ ++ cd $(top_srcdir) \ ++ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu doc/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ +--- linux-atm-2.4.1.orig/debian/patches/00list ++++ linux-atm-2.4.1/debian/patches/00list +@@ -0,0 +1 @@ ++10_atmbr2684.h +--- linux-atm-2.4.1.orig/debian/patches/10_atmbr2684.h.dpatch ++++ linux-atm-2.4.1/debian/patches/10_atmbr2684.h.dpatch +@@ -0,0 +1,598 @@ ++#! /bin/sh -e ++## 01_kernel-header.dpatch by <bengen+debian@hilluzination.de> ++## ++## All lines beginning with ## DP:' are a description of the patch. ++## DP: add header file atmbr2684.h ++ ++if [ -e /usr/include/linux/atmbr2684.h ]; then exit 0; fi ++ ++if [ $# -ne 1 ]; then ++ echo "basename $0: script expects -patch|-unpatch as argument" >&2 ++ exit 1 ++fi ++case "$1" in ++ -patch) patch -f --no-backup-if-mismatch -p1 < $0;; ++ -unpatch) patch -f --no-backup-if-mismatch -E -R -p1 < $0;; ++ *) ++ echo "basename $0: script expects -patch|-unpatch as argument" >&2 ++ exit 1;; ++esac ++ ++exit 0 ++@DPATCH@ ++ ++--- linux-atm.orig/src/include/linux/atmbr2684.h +++++ linux-atm/src/include/linux/atmbr2684.h ++@@ -0,0 +1,101 @@ +++#ifndef _LINUX_ATMBR2684_H +++#define _LINUX_ATMBR2684_H +++ +++#include <linux/atm.h> +++#include <linux/if.h> /* For IFNAMSIZ */ +++ +++/* +++ * Type of media we're bridging (ethernet, token ring, etc) Currently only +++ * ethernet is supported +++ */ +++#define BR2684_MEDIA_ETHERNET (0) /* 802.3 */ +++#define BR2684_MEDIA_802_4 (1) /* 802.4 */ +++#define BR2684_MEDIA_TR (2) /* 802.5 - token ring */ +++#define BR2684_MEDIA_FDDI (3) +++#define BR2684_MEDIA_802_6 (4) /* 802.6 */ +++ +++/* +++ * Is there FCS inbound on this VC? This currently isn't supported. +++ */ +++#define BR2684_FCSIN_NO (0) +++#define BR2684_FCSIN_IGNORE (1) +++#define BR2684_FCSIN_VERIFY (2) +++ +++/* +++ * Is there FCS outbound on this VC? This currently isn't supported. +++ */ +++#define BR2684_FCSOUT_NO (0) +++#define BR2684_FCSOUT_SENDZERO (1) +++#define BR2684_FCSOUT_GENERATE (2) +++ +++/* +++ * Does this VC include LLC encapsulation? +++ */ +++#define BR2684_ENCAPS_VC (0) /* VC-mux */ +++#define BR2684_ENCAPS_LLC (1) +++#define BR2684_ENCAPS_AUTODETECT (2) /* Unsuported */ +++ +++/* +++ * This is for the ATM_NEWBACKENDIF call - these are like socket families: +++ * the first element of the structure is the backend number and the rest +++ * is per-backend specific +++ */ +++struct atm_newif_br2684 { +++ atm_backend_t backend_num; /* ATM_BACKEND_BR2684 */ +++ int media; /* BR2684_MEDIA_* */ +++ char ifname[IFNAMSIZ]; +++ int mtu; +++}; +++ +++/* +++ * This structure is used to specify a br2684 interface - either by a +++ * positive integer (returned by ATM_NEWBACKENDIF) or the interfaces name +++ */ +++#define BR2684_FIND_BYNOTHING (0) +++#define BR2684_FIND_BYNUM (1) +++#define BR2684_FIND_BYIFNAME (2) +++struct br2684_if_spec { +++ int method; /* BR2684_FIND_* */ +++ union { +++ char ifname[IFNAMSIZ]; +++ int devnum; +++ } spec; +++}; +++ +++/* +++ * This is for the ATM_SETBACKEND call - these are like socket families: +++ * the first element of the structure is the backend number and the rest +++ * is per-backend specific +++ */ +++struct atm_backend_br2684 { +++ atm_backend_t backend_num; /* ATM_BACKEND_BR2684 */ +++ struct br2684_if_spec ifspec; +++ int fcs_in; /* BR2684_FCSIN_* */ +++ int fcs_out; /* BR2684_FCSOUT_* */ +++ int fcs_auto; /* 1: fcs_{in,out} disabled if no FCS rx'ed */ +++ int encaps; /* BR2684_ENCAPS_* */ +++ int has_vpiid; /* 1: use vpn_id - Unsupported */ +++ __u8 vpn_id[7]; +++ int send_padding; /* unsupported */ +++ int min_size; /* we will pad smaller packets than this */ +++}; +++ +++/* +++ * The BR2684_SETFILT ioctl is an experimental mechanism for folks +++ * terminating a large number of IP-only vcc's. When netfilter allows +++ * efficient per-if in/out filters, this support will be removed +++ */ +++struct br2684_filter { +++ __u32 prefix; /* network byte order */ +++ __u32 netmask; /* 0 = disable filter */ +++}; +++ +++struct br2684_filter_set { +++ struct br2684_if_spec ifspec; +++ struct br2684_filter filter; +++}; +++ +++#define BR2684_SETFILT _IOW( 'a', ATMIOC_BACKEND + 0, \ +++ struct br2684_filter_set) +++ +++#endif /* _LINUX_ATMBR2684_H */ ++--- linux-atm.orig/src/include/linux/atmdev.h +++++ linux-atm/src/include/linux/atmdev.h ++@@ -0,0 +1,468 @@ +++/* atmdev.h - ATM device driver declarations and various related items */ +++ +++/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ +++ +++ +++#ifndef LINUX_ATMDEV_H +++#define LINUX_ATMDEV_H +++ +++ +++#include <linux/config.h> +++#include <linux/atmapi.h> +++#include <linux/atm.h> +++#include <linux/atmioc.h> +++ +++ +++#define ESI_LEN 6 +++ +++#define ATM_OC3_PCR (155520000/270*260/8/53) +++ /* OC3 link rate: 155520000 bps +++ SONET overhead: /270*260 (9 section, 1 path) +++ bits per cell: /8/53 +++ max cell rate: 353207.547 cells/sec */ +++#define ATM_25_PCR ((25600000/8-8000)/54) +++ /* 25 Mbps ATM cell rate (59111) */ +++#define ATM_OC12_PCR (622080000/1080*1040/8/53) +++ /* OC12 link rate: 622080000 bps +++ SONET overhead: /1080*1040 +++ bits per cell: /8/53 +++ max cell rate: 1412830.188 cells/sec */ +++#define ATM_DS3_PCR (8000*12) +++ /* DS3: 12 cells in a 125 usec time slot */ +++ +++#define ATM_SD(s) ((s)->sk->protinfo.af_atm) +++ +++ +++#define __AAL_STAT_ITEMS \ +++ __HANDLE_ITEM(tx); /* TX okay */ \ +++ __HANDLE_ITEM(tx_err); /* TX errors */ \ +++ __HANDLE_ITEM(rx); /* RX okay */ \ +++ __HANDLE_ITEM(rx_err); /* RX errors */ \ +++ __HANDLE_ITEM(rx_drop); /* RX out of memory */ +++ +++struct atm_aal_stats { +++#define __HANDLE_ITEM(i) int i +++ __AAL_STAT_ITEMS +++#undef __HANDLE_ITEM +++}; +++ +++ +++struct atm_dev_stats { +++ struct atm_aal_stats aal0; +++ struct atm_aal_stats aal34; +++ struct atm_aal_stats aal5; +++} __ATM_API_ALIGN; +++ +++ +++#define ATM_GETLINKRATE _IOW('a',ATMIOC_ITF+1,struct atmif_sioc) +++ /* get link rate */ +++#define ATM_GETNAMES _IOW('a',ATMIOC_ITF+3,struct atm_iobuf) +++ /* get interface names (numbers) */ +++#define ATM_GETTYPE _IOW('a',ATMIOC_ITF+4,struct atmif_sioc) +++ /* get interface type name */ +++#define ATM_GETESI _IOW('a',ATMIOC_ITF+5,struct atmif_sioc) +++ /* get interface ESI */ +++#define ATM_GETADDR _IOW('a',ATMIOC_ITF+6,struct atmif_sioc) +++ /* get itf's local ATM addr. list */ +++#define ATM_RSTADDR _IOW('a',ATMIOC_ITF+7,struct atmif_sioc) +++ /* reset itf's ATM address list */ +++#define ATM_ADDADDR _IOW('a',ATMIOC_ITF+8,struct atmif_sioc) +++ /* add a local ATM address */ +++#define ATM_DELADDR _IOW('a',ATMIOC_ITF+9,struct atmif_sioc) +++ /* remove a local ATM address */ +++#define ATM_GETCIRANGE _IOW('a',ATMIOC_ITF+10,struct atmif_sioc) +++ /* get connection identifier range */ +++#define ATM_SETCIRANGE _IOW('a',ATMIOC_ITF+11,struct atmif_sioc) +++ /* set connection identifier range */ +++#define ATM_SETESI _IOW('a',ATMIOC_ITF+12,struct atmif_sioc) +++ /* set interface ESI */ +++#define ATM_SETESIF _IOW('a',ATMIOC_ITF+13,struct atmif_sioc) +++ /* force interface ESI */ +++#define ATM_GETSTAT _IOW('a',ATMIOC_SARCOM+0,struct atmif_sioc) +++ /* get AAL layer statistics */ +++#define ATM_GETSTATZ _IOW('a',ATMIOC_SARCOM+1,struct atmif_sioc) +++ /* get AAL layer statistics and zero */ +++#define ATM_GETLOOP _IOW('a',ATMIOC_SARCOM+2,struct atmif_sioc) +++ /* get loopback mode */ +++#define ATM_SETLOOP _IOW('a',ATMIOC_SARCOM+3,struct atmif_sioc) +++ /* set loopback mode */ +++#define ATM_QUERYLOOP _IOW('a',ATMIOC_SARCOM+4,struct atmif_sioc) +++ /* query supported loopback modes */ +++#define ATM_SETSC _IOW('a',ATMIOC_SPECIAL+1,int) +++ /* enable or disable single-copy */ +++#define ATM_SETBACKEND _IOW('a',ATMIOC_SPECIAL+2,atm_backend_t) +++ /* set backend handler */ +++#define ATM_NEWBACKENDIF _IOW('a',ATMIOC_SPECIAL+3,atm_backend_t) +++ /* use backend to make new if */ +++ +++/* +++ * These are backend handkers that can be set via the ATM_SETBACKEND call +++ * above. In the future we may support dynamic loading of these - for now, +++ * they're just being used to share the ATMIOC_BACKEND ioctls +++ */ +++#define ATM_BACKEND_RAW 0 +++#define ATM_BACKEND_PPP 1 /* PPPoATM - RFC2364 */ +++#define ATM_BACKEND_BR2684 2 /* Bridged RFC1483/2684 */ +++ +++/* for ATM_GETTYPE */ +++#define ATM_ITFTYP_LEN 8 /* maximum length of interface type name */ +++ +++/* +++ * Loopback modes for ATM_{PHY,SAR}_{GET,SET}LOOP +++ */ +++ +++/* Point of loopback CPU-->SAR-->PHY-->line--> ... */ +++#define __ATM_LM_NONE 0 /* no loop back ^ ^ ^ ^ */ +++#define __ATM_LM_AAL 1 /* loop back PDUs --' | | | */ +++#define __ATM_LM_ATM 2 /* loop back ATM cells ---' | | */ +++/* RESERVED 4 loop back on PHY side ---' */ +++#define __ATM_LM_PHY 8 /* loop back bits (digital) ----' | */ +++#define __ATM_LM_ANALOG 16 /* loop back the analog signal --------' */ +++ +++/* Direction of loopback */ +++#define __ATM_LM_MKLOC(n) ((n)) /* Local (i.e. loop TX to RX) */ +++#define __ATM_LM_MKRMT(n) ((n) << 8) /* Remote (i.e. loop RX to TX) */ +++ +++#define __ATM_LM_XTLOC(n) ((n) & 0xff) +++#define __ATM_LM_XTRMT(n) (((n) >> 8) & 0xff) +++ +++#define ATM_LM_NONE 0 /* no loopback */ +++ +++#define ATM_LM_LOC_AAL __ATM_LM_MKLOC(__ATM_LM_AAL) +++#define ATM_LM_LOC_ATM __ATM_LM_MKLOC(__ATM_LM_ATM) +++#define ATM_LM_LOC_PHY __ATM_LM_MKLOC(__ATM_LM_PHY) +++#define ATM_LM_LOC_ANALOG __ATM_LM_MKLOC(__ATM_LM_ANALOG) +++ +++#define ATM_LM_RMT_AAL __ATM_LM_MKRMT(__ATM_LM_AAL) +++#define ATM_LM_RMT_ATM __ATM_LM_MKRMT(__ATM_LM_ATM) +++#define ATM_LM_RMT_PHY __ATM_LM_MKRMT(__ATM_LM_PHY) +++#define ATM_LM_RMT_ANALOG __ATM_LM_MKRMT(__ATM_LM_ANALOG) +++ +++/* +++ * Note: ATM_LM_LOC_* and ATM_LM_RMT_* can be combined, provided that +++ * __ATM_LM_XTLOC(x) <= __ATM_LM_XTRMT(x) +++ */ +++ +++ +++struct atm_iobuf { +++ int length; +++ void *buffer; +++}; +++ +++/* for ATM_GETCIRANGE / ATM_SETCIRANGE */ +++ +++#define ATM_CI_MAX -1 /* use maximum range of VPI/VCI */ +++ +++struct atm_cirange { +++ char vpi_bits; /* 1..8, ATM_CI_MAX (-1) for maximum */ +++ char vci_bits; /* 1..16, ATM_CI_MAX (-1) for maximum */ +++}; +++ +++/* for ATM_SETSC; actually taken from the ATM_VF number space */ +++ +++#define ATM_SC_RX 1024 /* enable RX single-copy */ +++#define ATM_SC_TX 2048 /* enable TX single-copy */ +++ +++#define ATM_BACKLOG_DEFAULT 32 /* if we get more, we're likely to time out +++ anyway */ +++ +++/* MF: change_qos (Modify) flags */ +++ +++#define ATM_MF_IMMED 1 /* Block until change is effective */ +++#define ATM_MF_INC_RSV 2 /* Change reservation on increase */ +++#define ATM_MF_INC_SHP 4 /* Change shaping on increase */ +++#define ATM_MF_DEC_RSV 8 /* Change reservation on decrease */ +++#define ATM_MF_DEC_SHP 16 /* Change shaping on decrease */ +++#define ATM_MF_BWD 32 /* Set the backward direction parameters */ +++ +++#define ATM_MF_SET (ATM_MF_INC_RSV | ATM_MF_INC_SHP | ATM_MF_DEC_RSV | \ +++ ATM_MF_DEC_SHP | ATM_MF_BWD) +++ +++/* +++ * ATM_VS_* are used to express VC state in a human-friendly way. +++ */ +++ +++#define ATM_VS_IDLE 0 /* VC is not used */ +++#define ATM_VS_CONNECTED 1 /* VC is connected */ +++#define ATM_VS_CLOSING 2 /* VC is closing */ +++#define ATM_VS_LISTEN 3 /* VC is listening for incoming setups */ +++#define ATM_VS_INUSE 4 /* VC is in use (registered with atmsigd) */ +++#define ATM_VS_BOUND 5 /* VC is bound */ +++ +++#define ATM_VS2TXT_MAP \ +++ "IDLE", "CONNECTED", "CLOSING", "LISTEN", "INUSE", "BOUND" +++ +++#define ATM_VF2TXT_MAP \ +++ "ADDR", "READY", "PARTIAL", "REGIS", \ +++ "RELEASED", "HASQOS", "LISTEN", "META", \ +++ "256", "512", "1024", "2048", \ +++ "SESSION", "HASSAP", "BOUND", "CLOSE" +++ +++ +++#ifndef __KERNEL__ +++#undef __AAL_STAT_ITEMS +++#else +++ +++#include <linux/sched.h> /* wait_queue_head_t */ +++#include <linux/time.h> /* struct timeval */ +++#include <linux/net.h> +++#include <linux/skbuff.h> /* struct sk_buff */ +++#include <linux/uio.h> +++#include <net/sock.h> +++#include <asm/atomic.h> +++ +++#ifdef CONFIG_PROC_FS +++#include <linux/proc_fs.h> +++#endif +++ +++ +++struct k_atm_aal_stats { +++#define __HANDLE_ITEM(i) atomic_t i +++ __AAL_STAT_ITEMS +++#undef __HANDLE_ITEM +++}; +++ +++ +++struct k_atm_dev_stats { +++ struct k_atm_aal_stats aal0; +++ struct k_atm_aal_stats aal34; +++ struct k_atm_aal_stats aal5; +++}; +++ +++ +++enum { +++ ATM_VF_ADDR, /* Address is in use. Set by anybody, cleared +++ by device driver. */ +++ ATM_VF_READY, /* VC is ready to transfer data. Set by device +++ driver, cleared by anybody. */ +++ ATM_VF_PARTIAL, /* resources are bound to PVC (partial PVC +++ setup), controlled by socket layer */ +++ ATM_VF_REGIS, /* registered with demon, controlled by SVC +++ socket layer */ +++ ATM_VF_BOUND, /* local SAP is set, controlled by SVC socket +++ layer */ +++ ATM_VF_RELEASED, /* demon has indicated/requested release, +++ controlled by SVC socket layer */ +++ ATM_VF_HASQOS, /* QOS parameters have been set */ +++ ATM_VF_LISTEN, /* socket is used for listening */ +++ ATM_VF_META, /* SVC socket isn't used for normal data +++ traffic and doesn't depend on signaling +++ to be available */ +++ ATM_VF_SESSION, /* VCC is p2mp session control descriptor */ +++ ATM_VF_HASSAP, /* SAP has been set */ +++ ATM_VF_CLOSE, /* asynchronous close - treat like VF_RELEASED*/ +++}; +++ +++ +++#define ATM_VF2VS(flags) \ +++ (test_bit(ATM_VF_READY,&(flags)) ? ATM_VS_CONNECTED : \ +++ test_bit(ATM_VF_RELEASED,&(flags)) ? ATM_VS_CLOSING : \ +++ test_bit(ATM_VF_LISTEN,&(flags)) ? ATM_VS_LISTEN : \ +++ test_bit(ATM_VF_REGIS,&(flags)) ? ATM_VS_INUSE : \ +++ test_bit(ATM_VF_BOUND,&(flags)) ? ATM_VS_BOUND : ATM_VS_IDLE) +++ +++ +++enum { +++ ATM_DF_CLOSE, /* close device when last VCC is closed */ +++}; +++ +++ +++#define ATM_PHY_SIG_LOST 0 /* no carrier/light */ +++#define ATM_PHY_SIG_UNKNOWN 1 /* carrier/light status is unknown */ +++#define ATM_PHY_SIG_FOUND 2 /* carrier/light okay */ +++ +++#define ATM_ATMOPT_CLP 1 /* set CLP bit */ +++ +++ +++typedef struct { unsigned long bits; } atm_vcc_flags_t; +++ +++ +++struct atm_vcc { +++ atm_vcc_flags_t flags; /* VCC flags (ATM_VF_*) */ +++ short vpi; /* VPI and VCI (types must be equal */ +++ /* with sockaddr) */ +++ int vci; +++ unsigned long aal_options; /* AAL layer options */ +++ unsigned long atm_options; /* ATM layer options */ +++ struct atm_dev *dev; /* device back pointer */ +++ struct atm_qos qos; /* QOS */ +++ struct atm_sap sap; /* SAP */ +++ void (*push)(struct atm_vcc *vcc,struct sk_buff *skb); +++ void (*pop)(struct atm_vcc *vcc,struct sk_buff *skb); /* optional */ +++ int (*push_oam)(struct atm_vcc *vcc,void *cell); +++ int (*send)(struct atm_vcc *vcc,struct sk_buff *skb); +++ void *dev_data; /* per-device data */ +++ void *proto_data; /* per-protocol data */ +++ struct k_atm_aal_stats *stats; /* pointer to AAL stats group */ +++ wait_queue_head_t sleep; /* if socket is busy */ +++ struct sock *sk; /* socket backpointer */ +++ struct atm_vcc *prev,*next; +++ /* SVC part --- may move later ------------------------------------- */ +++ short itf; /* interface number */ +++ struct sockaddr_atmsvc local; +++ struct sockaddr_atmsvc remote; +++ void (*callback)(struct atm_vcc *vcc); +++ struct sk_buff_head listenq; +++ int backlog_quota; /* number of connection requests we */ +++ /* can still accept */ +++ int reply; /* also used by ATMTCP */ +++ /* Multipoint part ------------------------------------------------- */ +++ struct atm_vcc *session; /* session VCC descriptor */ +++ /* Other stuff ----------------------------------------------------- */ +++ void *user_back; /* user backlink - not touched by */ +++ /* native ATM stack. Currently used */ +++ /* by CLIP and sch_atm. */ +++}; +++ +++ +++struct atm_dev_addr { +++ struct sockaddr_atmsvc addr; /* ATM address */ +++ struct atm_dev_addr *next; /* next address */ +++}; +++ +++ +++typedef struct { unsigned int bits; } atm_dev_flags_t; +++ +++ +++struct atm_dev { +++ const struct atmdev_ops *ops; /* device operations; NULL if unused */ +++ const struct atmphy_ops *phy; /* PHY operations, may be undefined */ +++ /* (NULL) */ +++ const char *type; /* device type name */ +++ int number; /* device index */ +++ struct atm_vcc *vccs; /* VCC table (or NULL) */ +++ struct atm_vcc *last; /* last VCC (or undefined) */ +++ void *dev_data; /* per-device data */ +++ void *phy_data; /* private PHY date */ +++ atm_dev_flags_t flags; /* device flags (ATM_DF_*) */ +++ struct atm_dev_addr *local; /* local ATM addresses */ +++ unsigned char esi[ESI_LEN]; /* ESI ("MAC" addr) */ +++ struct atm_cirange ci_range; /* VPI/VCI range */ +++ struct k_atm_dev_stats stats; /* statistics */ +++ char signal; /* signal status (ATM_PHY_SIG_*) */ +++ int link_rate; /* link rate (default: OC3) */ +++ atomic_t refcnt; /* reference count */ +++ spinlock_t lock; /* protect internal members */ +++#ifdef CONFIG_PROC_FS +++ struct proc_dir_entry *proc_entry; /* proc entry */ +++ char *proc_name; /* proc entry name */ +++#endif +++ struct list_head dev_list; /* linkage */ +++}; +++ +++ +++/* +++ * ioctl, getsockopt, setsockopt, and sg_send are optional and can be set to +++ * NULL. */ +++ +++/* OF: send_Oam Flags */ +++ +++#define ATM_OF_IMMED 1 /* Attempt immediate delivery */ +++#define ATM_OF_INRATE 2 /* Attempt in-rate delivery */ +++ +++struct atmdev_ops { /* only send is required */ +++ void (*dev_close)(struct atm_dev *dev); +++ int (*open)(struct atm_vcc *vcc,short vpi,int vci); +++ void (*close)(struct atm_vcc *vcc); +++ int (*ioctl)(struct atm_dev *dev,unsigned int cmd,void *arg); +++ int (*getsockopt)(struct atm_vcc *vcc,int level,int optname, +++ void *optval,int optlen); +++ int (*setsockopt)(struct atm_vcc *vcc,int level,int optname, +++ void *optval,int optlen); +++ int (*send)(struct atm_vcc *vcc,struct sk_buff *skb); +++ int (*sg_send)(struct atm_vcc *vcc,unsigned long start, +++ unsigned long size); +++#if 0 /* keep the current hack for now */ +++ int (*send_iovec)(struct atm_vcc *vcc,struct iovec *iov,int size, +++ void (*discard)(struct atm_vcc *vcc,void *user),void *user); +++#endif +++ int (*send_oam)(struct atm_vcc *vcc,void *cell,int flags); +++ void (*phy_put)(struct atm_dev *dev,unsigned char value, +++ unsigned long addr); +++ unsigned char (*phy_get)(struct atm_dev *dev,unsigned long addr); +++ void (*feedback)(struct atm_vcc *vcc,struct sk_buff *skb, +++ unsigned long start,unsigned long dest,int len); +++ int (*change_qos)(struct atm_vcc *vcc,struct atm_qos *qos,int flags); +++ int (*proc_read)(struct atm_dev *dev,loff_t *pos,char *page); +++ struct module *owner; +++}; +++ +++ +++struct atmphy_ops { +++ int (*start)(struct atm_dev *dev); +++ int (*ioctl)(struct atm_dev *dev,unsigned int cmd,void *arg); +++ void (*interrupt)(struct atm_dev *dev); +++ int (*stop)(struct atm_dev *dev); +++}; +++ +++struct atm_skb_data { +++ struct atm_vcc *vcc; /* ATM VCC */ +++ unsigned long atm_options; /* ATM layer options */ +++}; +++ +++#define ATM_SKB(skb) (((struct atm_skb_data *) (skb)->cb)) +++ +++struct atm_dev *atm_dev_register(const char *type,const struct atmdev_ops *ops, +++ int number,atm_dev_flags_t *flags); /* number == -1: pick first available */ +++struct atm_dev *atm_dev_lookup(int number); +++void atm_dev_deregister(struct atm_dev *dev); +++void shutdown_atm_dev(struct atm_dev *dev); +++void bind_vcc(struct atm_vcc *vcc,struct atm_dev *dev); +++ +++ +++/* +++ * This is approximately the algorithm used by alloc_skb. +++ * +++ */ +++ +++static inline int atm_guess_pdu2truesize(int pdu_size) +++{ +++ return ((pdu_size+15) & ~15) + sizeof(struct sk_buff); +++} +++ +++ +++static inline void atm_force_charge(struct atm_vcc *vcc,int truesize) +++{ +++ atomic_add(truesize, &vcc->sk->rmem_alloc); +++} +++ +++ +++static inline void atm_return(struct atm_vcc *vcc,int truesize) +++{ +++ atomic_sub(truesize, &vcc->sk->rmem_alloc); +++} +++ +++ +++static inline int atm_may_send(struct atm_vcc *vcc,unsigned int size) +++{ +++ return (size + atomic_read(&vcc->sk->wmem_alloc)) < vcc->sk->sndbuf; +++} +++ +++ +++static inline void atm_dev_hold(struct atm_dev *dev) +++{ +++ atomic_inc(&dev->refcnt); +++} +++ +++ +++static inline void atm_dev_release(struct atm_dev *dev) +++{ +++ atomic_dec(&dev->refcnt); +++ +++ if ((atomic_read(&dev->refcnt) == 1) && +++ test_bit(ATM_DF_CLOSE,&dev->flags)) +++ shutdown_atm_dev(dev); +++} +++ +++ +++int atm_charge(struct atm_vcc *vcc,int truesize); +++struct sk_buff *atm_alloc_charge(struct atm_vcc *vcc,int pdu_size, +++ int gfp_flags); +++int atm_find_ci(struct atm_vcc *vcc,short *vpi,int *vci); +++int atm_pcr_goal(struct atm_trafprm *tp); +++ +++void atm_async_release_vcc(struct atm_vcc *vcc,int reply); +++ +++#endif /* __KERNEL__ */ +++ +++#endif +--- linux-atm-2.4.1.orig/debian/README.br2684 ++++ linux-atm-2.4.1/debian/README.br2684 +@@ -0,0 +1,79 @@ ++README.br2684 ++~~~~~~~~~~~~~ ++ ++The linux-atm CVS includes a program called br2684 which can be used ++to configure br2684 ATM bridging. On request (#216663), the Debian ++maintainer included br2684 in the source package. ++ ++This was done in a way that separates the - unreleased CVS snapshot - ++br2684 program into its own binary package so avoid shipping ++released and unreleased software in the same binary package. ++ ++The modified source package (2.4.1-10) was rejected by Debian ++ftpmaster because he found the package too small to warrant its own ++.deb. ++ ++Hence, atm-tools-br2684 is not built any more. ++ ++You can, however, build your own atm-tools-br2684 package from the ++official Debian source package by following this "script". ++ ++(0) ++Install all build dependencies plus autoconf, libtool, automake. If ++#219936 is still unfixed, copy /usr/bin/autoreconf to a local ++directory and apply the following patch after changing "+@@" to "@@" ++in the first line (this was inserted to be able to feed this readme to ++patch to apply the patch given in (1). ++ ++--- /usr/bin/autoreconf +++++ autoreconf +++@@ -183,7 +183,7 @@ ++ { ++ $autoconf .= ' --force'; ++ $autoheader .= ' --force'; ++- $automake .= ' --force-missing'; +++ $automake .= ''; ++ $autopoint .= ' --force'; ++ $libtoolize .= ' --force'; ++ } ++ ++(1) Apply the following patch ++--- configure.in.orig +++++ configure.in ++@@ -152,6 +152,7 @@ ++ m4/Makefile \ ++ src/Makefile \ ++ src/include/Makefile \ +++ src/br2684/Makefile \ ++ src/lib/Makefile \ ++ src/test/Makefile \ ++ src/debug/Makefile \ ++--- debian/rules.orig +++++ debian/rules ++@@ -11,7 +11,7 @@ ++ export PACKAGE=linux-atm ++ ++ buildindeppackages=atm-dev ++-buildarchpackages=atm-tools libatm1 libatm1-dev +++buildarchpackages=atm-tools atm-tools-br2684 libatm1 libatm1-dev ++ ++ # generate -ppackage1 -ppackage2 ... commandline for debhelper ++ dhbuildarchpackages=$(addprefix -p,$(buildarchpackages)) ++--- src/Makefile.am.orig +++++ src/Makefile.am ++@@ -1,3 +1,3 @@ ++ SUBDIRS = include lib test debug qgen saal sigd maint arpd ilmid man led lane \ ++- mpoad switch config extra +++ mpoad switch config extra br2684 ++ ++ ++(2) ++Invoke autoreconf -f -i ++ ++(3) ++create your own changelog entry and your own local version number ++ ++(4) ++Build the package as usual ++ ++Marc Haber, 2003-11-05 +--- linux-atm-2.4.1.orig/debian/control ++++ linux-atm-2.4.1/debian/control +@@ -0,0 +1,57 @@ ++Source: linux-atm ++Section: net ++Priority: optional ++Maintainer: Peter De Schrijver (p2) <p2@mind.be> ++Build-Depends: debhelper (>> 4.0.0), bison, flex, perl, dpatch, automake1.4 ++Standards-Version: 3.6.1 ++ ++Package: atm-tools ++Architecture: any ++Depends: ${shlibs:Depends} ++Description: Base programs for ATM in Linux, the net-tools for ATM ++ This package provides all the basic programs needed for setting up, ++ monitoring and tuning ATM networks. Such as: ++ * atmsigd, an ATM signal daemon that implements the ATM UNI protocol. ++ * atmtcp, a tool to setup ATM over TCP connections. ++ * atmarpd, an implementation of the ATMARP protocol (RFC1577, RFC1755) ++ * zeppelin, an ATM LAN Emulation client daemon ++ * les and bus, ATM LAN Emulation service daemons ++ . ++ Notice that upstream still flags these tools as experimental software and ++ says that there is still a number of known bugs and issues. The ++ software is, however, in productive use at a number of sites and is ++ working reliably. ++ . ++ Homepage: http://linux-atm.sourceforge.net/ ++ ++Package: atm-dev ++Depends: libatm1-dev ++Architecture: all ++Section: oldlibs ++Description: Development files for compiling ATM programs (dummy package) ++ This dummy package provides a transition from the previous atm packages. ++ It is provided for backwards compatibility only and may be removedafter ++ the upgrade has completed or when when no other package depend on it. ++ ++Package: libatm1 ++Section: libs ++Architecture: any ++Depends: ${shlibs:Depends} ++Conflicts: atm-tools (<< 2.4.1-6) ++Description: shared library for ATM (Asynchronous Transfer Mode) ++ Shared libraries needed by ATM (Asynchronous Transfer Mode) related programs ++ . ++ Homepage: http://linux-atm.sourceforge.net/ ++ ++Package: libatm1-dev ++Section: libdevel ++Architecture: any ++Depends: libc6-dev, libatm1 ++Replaces: atm-dev (<< 2.4.1-7) ++Conflicts: atm-dev (<< 2.4.1-7) ++Provides: libatm-dev ++Description: Development files for compiling ATM programs ++ Header files and development libraries for compiling ATM (Asynchronous ++ Transfer Mode) related programs. ++ . ++ Homepage: http://linux-atm.sourceforge.net/ +--- linux-atm-2.4.1.orig/debian/atm-tools-br2684.dirs ++++ linux-atm-2.4.1/debian/atm-tools-br2684.dirs +@@ -0,0 +1,2 @@ ++usr/sbin ++usr/share/man/man8 +--- linux-atm-2.4.1.orig/debian/rules ++++ linux-atm-2.4.1/debian/rules +@@ -0,0 +1,136 @@ ++#!/usr/bin/make -f ++# Sample debian/rules that uses debhelper. ++# GNU copyright 1997 to 1999 by Joey Hess. ++ ++# Uncomment this to turn on verbose mode. ++#export DH_VERBOSE=1 ++ ++# This is the debhelper compatability version to use. ++export DH_COMPAT=4 ++ ++export PACKAGE=linux-atm ++ ++buildindeppackages=atm-dev ++buildarchpackages=atm-tools libatm1 libatm1-dev ++ ++# generate -ppackage1 -ppackage2 ... commandline for debhelper ++dhbuildarchpackages=$(addprefix -p,$(buildarchpackages)) ++dhbuildindeppackages=$(addprefix -p,$(buildindeppackages)) ++ ++include /usr/share/dpatch/dpatch.make ++ ++configure: configure-stamp ++configure-stamp: ++ dh_testdir ++ ./configure --prefix /usr --mandir /usr/share/man --sysconfdir /etc ++ touch configure-stamp ++ ++build: configure-stamp build-stamp ++build-stamp: patch-stamp ++ dh_testdir ++ ++ # Add here commands to compile the package. ++ $(MAKE) $(EXTRA_VARS) ++ cat debian/copyright.header COPYING > debian/copyright ++ ++ touch build-stamp ++ ++clean: clean1 unpatch ++clean1: ++ dh_testdir ++ dh_testroot ++ rm -f build-stamp configure-stamp ++ ++ # Add here commands to clean up after the build process. ++ -$(MAKE) distclean ++ ++ dh_clean ++ rm -rf debian/atm-tools.8 debian/copyright ++ ++install: build ++ dh_testdir ++ dh_testroot ++ dh_clean -k ++ dh_installdirs ++ ++ # Add here commands to install the package into debian/atm-tools ++ $(MAKE) DESTDIR=`pwd`/debian/tmp install ++ ++ # manpages ++ /usr/bin/pod2man --section=8 --release="atm-tools $(PKG_VER)" --lax \ ++ --center="Debian GNU/Linux" debian/atm-tools.pod > debian/atm-tools.8 ++ ++ ln -s atm-tools.8 debian/tmp/usr/share/man/man8/aread.8 ++ ln -s atm-tools.8 debian/tmp/usr/share/man/man8/awrite.8 ++ ln -s atm-tools.8 debian/tmp/usr/share/man/man8/enitune.8 ++ ln -s atm-tools.8 debian/tmp/usr/share/man/man8/ilmid.8 ++ ln -s atm-tools.8 debian/tmp/usr/share/man/man8/saaldump.8 ++ ln -s atm-tools.8 debian/tmp/usr/share/man/man8/sonetdiag.8 ++ ln -s atm-tools.8 debian/tmp/usr/share/man/man8/ttcp_atm.8 ++ ln -s atm-tools.8 debian/tmp/usr/share/man/man8/zntune.8 ++ ++# Build architecture-independent files here. ++binary-indep: build install ++ dh_testdir $(dhbuildindeppackages) ++ dh_testroot $(dhbuildindeppackages) ++ dh_install $(dhbuildindeppackages) ++ ++# dh_installdebconf $(dhbuildindeppackages) ++ dh_installdocs $(dhbuildindeppackages) ++ dh_installmenu $(dhbuildindeppackages) ++# dh_installlogrotate $(dhbuildindeppackages) ++# dh_installemacsen $(dhbuildindeppackages) ++# dh_installpam $(dhbuildindeppackages) ++# dh_installmime $(dhbuildindeppackages) ++ dh_installinit $(dhbuildindeppackages) --init-script=atm -- start 34 0 6 . start 39 S . ++ dh_installcron $(dhbuildindeppackages) ++ dh_installman $(dhbuildindeppackages) ++ dh_installinfo $(dhbuildindeppackages) ++# dh_undocumented $(dhbuildindeppackages) ++ dh_installchangelogs -i ChangeLog $(dhbuildpackages) ++ dh_link $(dhbuildindeppackages) ++ dh_strip $(dhbuildindeppackages) ++ dh_compress $(dhbuildindeppackages) ++ dh_fixperms $(dhbuildindeppackages) ++ dh_makeshlibs $(dhbuildindeppackages) ++ dh_installdeb $(dhbuildindeppackages) ++# dh_perl $(dhbuildindeppackages) ++ dh_shlibdeps $(dhbuildindeppackages) ++ dh_gencontrol $(dhbuildindeppackages) ++ dh_md5sums $(dhbuildindeppackages) ++ dh_builddeb $(dhbuildindeppackages) ++ ++# Build architecture-dependent files here. ++binary-arch: build install ++ dh_testdir $(dhbuildarchpackages) ++ dh_testroot $(dhbuildarchpackages) ++ dh_install $(dhbuildarchpackages) ++ ++# dh_installdebconf $(dhbuildarchpackages) ++ dh_installdocs $(dhbuildarchpackages) ++ dh_installmenu $(dhbuildarchpackages) ++# dh_installlogrotate $(dhbuildarchpackages) ++# dh_installemacsen $(dhbuildarchpackages) ++# dh_installpam $(dhbuildarchpackages) ++# dh_installmime $(dhbuildarchpackages) ++ dh_installinit $(dhbuildarchpackages) --init-script=atm -- start 34 0 6 . start 39 S . ++ dh_installcron $(dhbuildarchpackages) ++ dh_installman $(dhbuildarchpackages) ++ dh_installinfo $(dhbuildarchpackages) ++# dh_undocumented $(dhbuildarchpackages) ++ dh_installchangelogs -a ChangeLog $(dhbuildarchpackages) ++ dh_link $(dhbuildarchpackages) ++ dh_strip $(dhbuildarchpackages) ++ dh_compress $(dhbuildarchpackages) ++ dh_fixperms $(dhbuildarchpackages) ++ dh_makeshlibs $(dhbuildarchpackages) ++ dh_installdeb $(dhbuildarchpackages) ++# dh_perl $(dhbuildarchpackages) ++ dh_shlibdeps -a -L libatm1 -l debian/libatm1/lib $(dhbuildarchpackages) ++ dh_gencontrol $(dhbuildarchpackages) ++ dh_md5sums $(dhbuildarchpackages) ++ dh_builddeb $(dhbuildarchpackages) ++ ++binary: binary-indep binary-arch ++.PHONY: build binary-indep binary-arch binary install configure ++ get-2684 patch unpatch clean1 +--- linux-atm-2.4.1.orig/debian/atm-tools-br2684.install ++++ linux-atm-2.4.1/debian/atm-tools-br2684.install +@@ -0,0 +1 @@ ++debian/tmp/usr/sbin/br2684ctl usr/sbin +--- linux-atm-2.4.1.orig/debian/atm-tools-br2684/usr/share/doc/atm-tools-br2684/changelog.Debian ++++ linux-atm-2.4.1/debian/atm-tools-br2684/usr/share/doc/atm-tools-br2684/changelog.Debian +@@ -0,0 +1,206 @@ ++linux-atm (2.4.1-16) unstable; urgency=low ++ ++ * Fix build problem with gcc 3.4 (Closes: #259422) ++ ++ -- Peter De Schrijver (p2) <p2@mind.be> Thu, 15 Jul 2004 14:28:10 +0200 ++ ++linux-atm (2.4.1-15) unstable; urgency=low ++ ++ * Updated descriptions (Closes: #239161) ++ ++ -- Peter De Schrijver (p2) <p2@mind.be> Sun, 4 Apr 2004 21:10:20 +0200 ++ ++linux-atm (2.4.1-14) unstable; urgency=low ++ ++ * Fix symlink for /usr/lib/libatm.so (Closes: #221011) ++ ++ -- Peter De Schrijver (p2) <p2@mind.be> Sun, 7 Dec 2003 21:53:19 +0100 ++ ++linux-atm (2.4.1-13) unstable; urgency=low ++ ++ * Previous version fixed #217259, but no changelog entry (Closes: #217259) ++ * Previous version fixed #216662, but no changelog entry (Closes: #216662) ++ * Added missing build dependency on automake1.4 (Closes: #221120, #221284) ++ * New Maintainer (Closes: #206982) ++ ++ -- Peter De Schrijver (p2) <p2@mind.be> Mon, 17 Nov 2003 23:03:58 +0100 ++ ++linux-atm (2.4.1-12) unstable; urgency=low ++ ++ * don't build atm-tools-br2684 by default. Thanks to ftpmaster for ++ not allowing the package to be in Debian. ++ * Since we don't build atm-tools-br2684 any more, revert back to ++ autotools output from 2.4.1-9 ++ * Add README.br2684 documenting a way to build the package locally. ++ ++ -- Marc Haber <mh+debian-packages@zugschlus.de> Wed, 5 Nov 2003 21:31:42 +0000 ++ ++linux-atm (2.4.1-11) experimental; urgency=low ++ ++ * Build-Depend on dpatch ++ * dpatch br2684 header files from later libc for old libc (woody) ++ ++ -- Marc Haber <mh+debian-packages@zugschlus.de> Wed, 29 Oct 2003 19:05:07 +0000 ++ ++linux-atm (2.4.1-10) experimental; urgency=low ++ ++ * add br2684 to package (closes: #216663) ++ * autoreconf to actually build br2684 ++ * have libatm1-dev provide libatm-dev (closes: #216662) ++ * move lib symlink to libatm1-dev as well (closes: #217259) ++ ++ -- Marc Haber <mh+debian-packages@zugschlus.de> Thu, 23 Oct 2003 17:55:43 +0000 ++ ++linux-atm (2.4.1-9) unstable; urgency=low ++ ++ * put libatm1-dev in libdevel (closes: #213170) ++ * make sure that new descriptions actually make it into the package ++ ++ -- Marc Haber <mh+debian-packages@zugschlus.de> Thu, 9 Oct 2003 17:08:10 +0000 ++ ++linux-atm (2.4.1-8) unstable; urgency=low ++ ++ * build arch-indep package as targets of binary-indep (closes: #212124) ++ * use dh_installdocs to install files to libatm1-dev/docs ++ * symlink shared lib to usr/bin (closes: #213146) ++ * Use better long descriptions. Thanks to Javier (closes: #209427) ++ Fernandez-Sanguino (closes: #209612) ++ ++ -- Marc Haber <mh+debian-packages@zugschlus.de> Sun, 28 Sep 2003 19:29:08 +0000 ++ ++linux-atm (2.4.1-7) unstable; urgency=low ++ ++ * libatm1 now conflicts with atm-tools (<< 2.4.1-6) (closes: #208170) ++ * armarp now writes output to stdout. ++ * add atm-dev as empty transitional package to help upgrades ++ ++ -- Marc Haber <mh+debian-packages@zugschlus.de> Tue, 2 Sep 2003 09:20:33 +0000 ++ ++linux-atm (2.4.1-6) unstable; urgency=low ++ ++ * split off shared libraries to libatm1 ++ * rename atm-dev to libatm1-dev ++ * Standards-Version: 3.6.1 ++ ++ -- Marc Haber <mh+debian-packages@zugschlus.de> Tue, 26 Aug 2003 15:46:27 +0000 ++ ++linux-atm (2.4.1-5) unstable; urgency=low ++ ++ * move *.a and *.la to usr/lib (closes: #199506). ++ * let atm-dev depend on atm-tools to avoid dangling /lib/libatm.so ++ symlink. ++ * Standards-Version: 3.5.6 ++ ++ -- Marc Haber <mh+debian-packages@zugschlus.de> Wed, 30 Jul 2003 11:46:19 +0000 ++ ++linux-atm (2.4.1-4) unstable; urgency=low ++ ++ * add Build-Depends: on automake1.4 ++ ++ -- Marc Haber <mh+debian-packages@zugschlus.de> Wed, 11 Jun 2003 16:58:21 +0000 ++ ++linux-atm (2.4.1-3) unstable; urgency=low ++ ++ * rebuilding libtool broke src/test/Makefile.in. Applied fix to ++ Makefile.am and re-built again. ++ ++ -- Marc Haber <mh+debian-packages@zugschlus.de> Wed, 11 Jun 2003 11:05:26 +0000 ++ ++linux-atm (2.4.1-2) unstable; urgency=low ++ ++ * rebuild configure script with new libtool (closes: #196909) ++ ++ -- Marc Haber <mh+debian-packages@zugschlus.de> Tue, 10 Jun 2003 21:01:50 +0000 ++ ++linux-atm (2.4.1-1) unstable; urgency=low ++ ++ * new upstream source ++ * remove atmarp and atmarpd from /usr/sbin as they are already in ++ /sbin (closes: #196216) ++ * lintian fixes ++ ++ -- Marc Haber <mh+debian-packages@zugschlus.de> Mon, 9 Jun 2003 16:03:45 +0000 ++ ++linux-atm (2.4.0-5) unstable; urgency=low ++ ++ * Fix for src/test/Makefile.in to allow building on hppa and ia64 ++ which the fix introduced to 2.4.0-4 broke. Thanks to Goswin ++ Brederlow. ++ * Move init.d priority to that atmarpd is started before network ++ interfaces are started. ++ * Move atmarpd and libatm to /sbin and /lib to allow atmarpd to be ++ started before /usr is mounted. ++ * use dh_install instead of dh_movefiles. ++ ++ -- Marc Haber <mh+debian-packages@zugschlus.de> Sat, 24 Aug 2002 15:13:48 +0000 ++ ++linux-atm (2.4.0-4) unstable; urgency=low ++ ++ * new maintainer ++ * Fix for src/test/Makefile.in to allow building on sparc. ++ Thanks to Patrick Mauritz. (closes: #144225). ++ * added pseudo-manpage for manpage-less binaries. ++ * removed rpath by changing configure and make install paramaters ++ ++ -- Marc Haber <mh+debian-packages@zugschlus.de> Fri, 16 Aug 2002 20:39:05 +0000 ++ ++linux-atm (2.4.0-3) unstable; urgency=HIGH ++ ++ * Re-ran libtoolize. ++ Closes: #143522 ++ ++ * Previous version Closes: #135328 ++ ++ -- Russell Coker <russell@coker.com.au> Fri, 19 Apr 2002 01:55:00 +0200 ++ ++linux-atm (2.4.0-2) unstable; urgency=HIGH ++ ++ * Put a "grep -v EMAXERRNO" into the build process to deal with mipsel and ++ the "#ifdef __KERNEL__" it has in it's /usr/include/asm/errno.h . ++ ++ -- Russell Coker <russell@coker.com.au> Thu, 18 Apr 2002 19:56:00 +0200 ++ ++linux-atm (2.4.0-1) unstable; urgency=HIGH ++ ++ * New upstream version which changes source package name. ++ Closes: #138911 ++ ++ -- Russell Coker <russell@coker.com.au> Mon, 18 Mar 2002 17:42:00 +0100 ++ ++atm (0.79-4) unstable; urgency=low ++ ++ * Added build-depends on flex. ++ Closes: #111072 ++ ++ * Made the atm tools use a shared object to save space. ++ ++ * Fixed the copyright file and put all copyright details in both packages. ++ ++ * Added support for easy building with different kernel headers. ++ Closes: #110249 ++ ++ -- Russell Coker <russell@coker.com.au> Sun, 7 Oct 2001 14:11:33 +0200 ++ ++atm (0.79-3) unstable; urgency=low ++ ++ * Created /etc/init.d/atm to start and stop atmarpd. ++ Closes: #110252 ++ ++ * Added build-depends on bison. ++ Closes: #110576 ++ ++ -- Russell Coker <russell@coker.com.au> Fri, 31 Aug 2001 15:21:44 +0200 ++ ++atm (0.79-2) unstable; urgency=low ++ ++ * Changed the main package name to atm-tools to indicate that it doesn't ++ provide ATM (gotta have the kernel support), it just has the daemons and ++ utilities. ++ ++ -- Russell Coker <russell@coker.com.au> Sat, 25 Aug 2001 17:55:00 +0200 ++ ++atm (0.79-1) unstable; urgency=low ++ ++ * Initial Release. ++ ++ -- Russell Coker <russell@coker.com.au> Fri, 24 Aug 2001 17:31:00 +0200 +--- linux-atm-2.4.1.orig/debian/atm-tools-br2684/usr/share/doc/atm-tools-br2684/changelog ++++ linux-atm-2.4.1/debian/atm-tools-br2684/usr/share/doc/atm-tools-br2684/changelog +@@ -0,0 +1,3299 @@ ++Version 2.4.0 to 2.4.1 (25-APR-2003) ++===================== ++ ++Bug fixes ++--------- ++ ++ - vsprintf's changed to vsnprintf's to prevent possible stack overflows ++ ++ ++Version 0.79 to 2.4.0 (18-OCT-2001) ++===================== ++ ++Bug fixes ++--------- ++ ++ - defined 'now' in src/lib/timer.c ++ - ia64 build fix for ASN (Chas Williams) ++ ++Other changes ++------------- ++ ++ - In general, the source tree was rearranged and the old cruft was removed ++ - Old ad hoc build system replaced in favor of a standardized autoconfiscation ++ - Build configuration options are now controlled by 'configure' script instead ++ of changes to the previous 'Rules.make' file ++ - libatm and libatmd merged into one lib: libatm ++ - Both static and shared libraries are built by default. Binaries now built ++ with shared library by default. ++ - Sample atmsigd.conf and hosts.atm are now installed when doing 'make install' ++ - RPM spec file is now available in src/extra/ ++ - New RedHat init scripts available in src/config/init-redhat/ (John Strange) ++ (old RedHat 4.0 scripts removed) ++ - ATM on Linux HOWTO now included in doc/ (much derived from usage.tex). We ++ will publish this on the home page as well as linuxdoc.org ++ - tcpdump and libpcap ATM patches/build removed (they have been integrated into ++ their respective packages; see www.tcpdump.org) ++ - ATM Name Service (ANS) files coalesced into src/extra/ANS ++ - ANS bind patch upgraded to bind-4.9.8 (untested) ++ - rtf2e164_cc.pl removed in favor of src/extra/ANS/pdf2e164_cc.pl. The ITU no ++ longer provides E.164 country codes in RTF format. PDF used instead. ++ ++ ++Version 0.78 to 0.79 (15-AUG-2001) ++==================== ++ ++Bug fixes ++--------- ++ ++- uni.c fix for newer versions of gcc ++- mpoad/io.c quick fix for undefined OPEN_MAX ++ ++ ++Version 0.77 to 0.78 (7-JUL-2000) ++==================== ++ ++Bug fixes ++--------- ++ ++ - skb_migrate wasn't protected against functions accessing the list via ++ skb->list ++ - removal of MOD_xxx races in FORE 200E and atmtcp (by Jeff Garzik) ++ - CONFIG_ATM_NICSTAR_USE_IDT77105 set NEED_SUNI_MX instead of ++ NEED_IDT77105_MX (fix from mainstream) ++ - ambassador.c: changed string concatenation and offset calculation breaking ++ compilation with gcc 2.96 (by Jakub Jelinek) ++ - nicstar.c: various locking fixes for SMP (by Rui Prior) ++ - LANE vs. bridging build conflict solved (from mainstream) ++ - %%u instead of %u in mpc.c ++ - fixed formatting of /proc/net/atm/svc ++ - /proc/net/atm/clip always added + after public address, not only if followed ++ by private address ++ - atmsigd now returns EINVAL if attempting to change max_sdu ++ - atm_change_qos now calls adjust_to for additional parameter checking ++ - sendmsg now returns error if size > max_sdu (reported by Alan Kennington) ++ - removed explicit defaults in Config.in (by Christoph Hellwig) ++ - Fore200E: removed #ifdef MODULE ++ - ipcommon.c didn't export skb_migrate to modules (by Mitchell Blank) ++ - ENI: /proc/net/atm/eni:* claimed backlog was in bytes instead of packets ++ - br, bw, window: changed variables receiving possibly negative return values ++ from size_t to ssize_t (reported by Alan Kennington) ++ - LANE: fixed stray errors on lack of ATM address, ATM address change, or ESI ++ change (by Heikki Vatiainen) ++ - LANE: could loop forwever when trying to connect to LECS (by Heikki ++ Vatiainen) ++ ++New features ++------------ ++ ++ - upgraded to the 2.4.0-test3-pre4 kernel ++ ++Other changes ++------------- ++ ++ - as_reject now returns the errno value in msg->reply ++ - removed save_qos hack in svc_change_qos ++ - atmsigd: sap_encode now always includes both max_sdu fields, even if one ++ contains the null value for some reason (by Mohsen Souissi) ++ - PCI updates for Ambassador, FORE 200E, Horizon, Iphase, nicstar, ENI, and ++ ZATM (by Jeff Garzik) ++ - removal of unnecessary #ifdef MODULE for nicstar, idt77105, and FORE 200E ++ (by Jeff Garzik) ++ - generalized skb_migrate to append to an arbitrary sk_buff list ++ - iphase.c: timer initialization cleanup (from mainstream) ++ - clip: dev->name initialization change (from mainstream) ++ - idt77105: cleaned up timer initialization ++ - clip.c: some general cleanup ++ - removed redundant return in clip.c (by Heikki Vatiainen) ++ - changed atm_change_qos to static ++ - fore200e.c: re-enabled anti-unloading code ++ - lec.c: now drops packets on overrun instead of growing infinite queue (by ++ Heikki Vatiainen) ++ - COPYING still mentioned the old led code with partial DEC copyright ++ (reported by Chris Pimlott) ++ - Horizon: removed const warning by casting to (hrz_flags *) ++ - Iphase: tried to print unsigned long with %x when errors are enabled ++ - ENI: eni_send tries to use do_tx instead of tasklet_schedule to reduce delay ++ - ENI: removed eni_dev->backlog_len (information is already in backlog->qlen) ++ - changed the kernel source tree references from .gz to .bz2 compression ++ - changed mkdiff to allow more flexible selection of additional patch ++ ++ ++Version 0.76 to 0.77 (29-APR-2000) ++==================== ++ ++Bug fixes ++--------- ++ ++ - atmaddr.8, atmarp.8, atmdump.8, atmloop.8, esi.8 didn't print all options ++ in bold ++ - atmsigd crashed if an interface had more than one local ATM address ++ - atmarpd continued to use VCs after closing if they were closed because ++ ATMARP_SETENTRY failed (reported by Joseph Gooch) ++ ++New features ++------------ ++ ++ - upgraded to the 2.3.99-pre6 kernel ++ ++Other changes ++------------- ++ ++ - CLIP now uses NETDEV_GOING_DOWN instead of NETDEV_DOWN; also avoids ++ "clip_device_event: unknown event 9" warning ++ - added ubr:pcr example to qos(7) ++ - added -V option to atmaddr, atmarp, atmarpd, atmloop, atmsigd, atmtcp, esi, ++ ilmid ++ - sock->sk->sleep now points to vcc->sleep (by Alexander Viro) ++ - CLIP: ATMARP server now reponds to query for local IP address (suggested by ++ Joseph Gooch) ++ - updated t2a.pl ++ ++ ++Version 0.75 to 0.76 (13-APR-2000) ++==================== ++ ++Bug fixes ++--------- ++ ++ - ttcp_atm declared port as "short" instead of "unsigned short", yielding ++ confusing diagnostic output ++ ++New features ++------------ ++ ++ - upgraded to the 2.3.99-pre5 kernel ++ ++Other changes ++------------- ++ ++ - eliminated eni_send-tasklet synchronization ++ - PCA200: merged unconditional #inclusion of linux/pci.h from pre5 ++ ++ ++Version 0.74 to 0.75 (7-APR-2000) ++==================== ++ ++Bug fixes ++--------- ++ ++ - ENI: moved send operation into tasklet to correct synchronization (reported ++ by Heikki Vatiainen) ++ - MPOA: possible deadlock fix (by Heikki Vatiainen) ++ - atm_vcc_flags_t was too small on PPC, causing an overlap with vcc->family ++ (fixed by Chas Williams) ++ - CLIP: needs spin_lock_irqsave instead of only spin_lock (by Rui Prior) ++ - CLIP: clip_push may be called from an interrupt, so the kfree_skb has to ++ become dev_kfree_skb_any (by Heikki Vatiainen) ++ ++Other changes ++------------- ++ ++ - removed INCLUDES from atm/ilmid/asn1/Makefile (suggested by Jean Marc ++ Lacroix) ++ - atm/maint/Makefile no longer special-cases atmdiag.c (suggested by Jean Marc ++ Lacroix) ++ ++ ++Version 0.73 to 0.74 (2-APR-2000) ++==================== ++ ++Bug fixes ++--------- ++ ++ - atm_poll tried to sleep on two wait queues, which is no longer possible. ++ Removed vcc->wsleep to solve this. (Reported by Joseph Gooch) ++ - lec.c:lec_arp_clear_vccs changed the VCC flags of the wrong VCC, fortunately ++ only in commented-out code ++ - major revision of MPOA ingress and egress cache locking (Heikki Vatiainen) ++ ++Other changes ++------------- ++ ++ - removed last remnants of bogus bridging lock from lane_mpoa_init.c ++ (reported by Heikki Vatiainen) ++ - removed last traces of TNET1570A driver ++ - atmdev_init still knew about ENI, but ENI now uses new-style initialization ++ - improved Fore 200E configuration to catch useless settings already at ++ configuration time (by Christophe Lizzi) ++ ++ ++Version 0.72 to 0.73 (29-MAR-2000) ++==================== ++ ++Bug fixes ++--------- ++ ++ - ambassador.c and horizon.c had module loading races (fixed by Giuliano ++ Procida) ++ - fore200e: one set_bit was accidently converted to clear_bit, preventing VCs ++ from being opened (fixed by Christophe Lizzi) ++ ++Other changes ++------------- ++ ++ - fore200e: moved interrupt handler work to tasklet (by Christophe Lizzi) ++ - fore200e: fixed SBUS DMA direction flags (by Christophe Lizzi) ++ - fore200e: the compile no longer fails when the driver is compiled without ++ any hardware support (and displays a warning; by Christophe Lizzi) ++ - oops, atm/README was lagging behind a few versions ++ ++ ++Version 0.71 to 0.72 (25-MAR-2000) ++==================== ++ ++Bug fixes ++--------- ++ ++ - fore200e.h and lec.h didn't #include <linux/config.h> (fixed by David S. ++ Miller ?) ++ - atmloop.c always assumed -q to be present ++ ++New features ++------------ ++ ++ - upgraded to the 2.3.99-pre3 kernel ++ ++Other changes ++------------- ++ ++ - kernel patch still included wd.c hack (reported by David S. Miller) ++ - removed bogus initialization of skb->rx_dev (spotted by Alexey Kuznetsov) ++ - removed bogus lane_bridge_hook_lock (by Heikki Vatiainen) ++ - added sparc64 support for ATM_QUERYLOOP (by Christophe Lizzi) ++ - minor Fore driver cleanup (by Christophe Lizzi) ++ - eni.c: moved interrupt handler work to tasklet ++ ++ ++Version 0.70 to 0.71 (21-MAR-2000) ++==================== ++ ++Bug fixes ++--------- ++ ++ - eni.c: fixed potential SMP deadlock on tx_wait ++ - clip.c and lec.c didn't initialize skb->rx_dev ++ - net/atm/svc.c:svc_connect left wait entry in queue on return in some cases ++ - idiot bug in skb_migrate caused weird crashes ++ - atmloop usage erroneously claimed -s was optional ++ ++New features ++------------ ++ ++ - upgraded to the 2.3.99-pre2 kernel ++ - added atmloop.8 man page ++ - added enqueuing result NET_XMIT_BYPASS for qdiscs that send packets on a ++ path without dequeue (e.g. sch_atm) ++ ++Other changes ++------------- ++ ++ - ambassador.c: removed warnings when compiling with CONFIG_SMP (by Giuliano ++ Procida) ++ - changed drivers/atm target from atm.a to atm.o, to make initcalls work ++ - converted eni.c to use pci_register_driver and initcall ++ - cleaned up #ifdef hell in net/atm/signaling.c:sigd_put_skb ++ ++ ++Version 0.69 to 0.70 (20-MAR-2000) ++==================== ++ ++Bug fixes ++--------- ++ ++ - LEC compilation as a module still left it in the kernel ++ ++Other changes ++------------- ++ ++ - moved LANE-bridging interface code from lec.c to lane_mpoa_init.c (by ++ Heikki Vatiainen) ++ - made SONET and ATM statistics counters atomic to avoid cli() when reading ++ (not updated: similar mechanism in idt77105.c and private shadow statistics ++ of ambassador.c) ++ - changed access to VCC and device flags (ATM_VF_* and ATM_DF_*) to bit set ++ operations ++ - changed flag types to structs to fail compilation of old code ++ - changed last argument of atm_dev_register to a pointer to a bit set for ++ easier migration ++ - net/atm/*.c: eliminated all sleep_on and cli (except in lec.c) ++ - ditto for eni.c and suni.c ++ - corrected indentation of some "permanent" debugging code in zatm.c ++ - made skb_migrate partially atomic, obsoleting yet another cli() in clip.c ++ ++ ++Version 0.68 to 0.69 (19-MAR-2000) ++==================== ++ ++Bug fixes ++--------- ++ ++ - ambassador.c: corrected location of initial PLX window for use on Alpha (by ++ Giuliano Procida) ++ - zeppelin: fixed address initialization (found by Christophe Lizzi) ++ - atmsigd.conf man page erroneously described the option "q.2963.1" as ++ "q2963_1" ++ - LANE didn't compile when bridging was enabled (fixed by Heikki Vatiainen; ++ note that bridging also needs an update which is being merged via the ++ mainstream kernel) ++ ++New features ++------------ ++ ++ - atmsigd: added command-line option -u to set the UNI mode ++ - added ioctl ATM_QUERYLOOP to determine supported loopback modes ++ - added atmloop(8) option -q ++ ++Other changes ++------------- ++ ++ - added CREDITS entry of Giuliano Procida ++ - various cosmetic changes to horizon.c (by Giuliano Procida) ++ - ambassador.c: various bits of cleanup (by Giuliano Procida) ++ - added -S <tos> option to ttcp_atm to set the IPv4 TOS byte (this is not ++ really related to ATM) ++ - changed loopback mode values to a bit set ++ - idt77105_ioctl: returned sizeof(int) instead of 0 on ATM_GETLOOP ++ - added phy_ops->stop to suni.c and uPD98402_stop, cleaned up suni.c in the ++ process ++ - removed (very obsolete) mmuio.o from net/atm/Makefile ++ ++ ++Version 0.67 to 0.68 (28-FEB-2000) ++==================== ++ ++Bug fixes ++--------- ++ ++ - removed potential dev_kfree_skb(NULL) from *_send of eni.c, zatm.c, iphase.c ++ - eni.c, zatm.c, iphase.c sometimes returned PCI error codes instead of errno ++ codes ++ - arpd/io.c could try to de-reference entry->addr with addr == NULL (fixed by ++ Thomas Dietz) ++ - LANE copied more than dev->addr_len address bytes (fixed by Heikki ++ Vatiainen) ++ - sch_atm didn't remove filters on destroy ++ - fixed typo in esi.c error message ++ - esi.8 claimed to be the man page of atmarp, and it wasn't installed ++ - added checking for VPI/VCI when sending AAL0 cells (by Mitchell Blank) ++ - atmtcp allowed sending on receive-only VCs ++ - various ioctl permission checks were missing (fixed by Mitchell Blank) ++ - fore200e.c and horizon.c didn't always free skbs on send error (fixed by ++ Mitchell Blank) ++ - included an ugly hack to fix the wd.c driver that was broken around 2.3.47 ++ (not related to ATM at all...) ++ ++New features ++------------ ++ ++ - upgraded to the 2.3.48 kernel ++ - added device-independent SAR/PHY loopback setting interface (with many good ++ ideas from Greg Banks and Mitchell Blank), and removed old loopback ioctls ++ - new utility atmloop to set loopback mode ++ - added "stop" to atmphy_ops (requested by Mitchell Blank) ++ ++Other changes ++------------- ++ ++ - mkdiff can now also use pre-release kernels ++ - changed *kfree_skb to dev_kfree_skb_{irq,any} in eni.c, zatm.c, and raw.c, ++ where necessary (with help from Heikki Vatiainen) ++ - changed {dev_,}kfree_skb to dev_kfree_skb_any in ambassador.c, horizon.c, ++ iphase.c, and nicstar.c (needs further cleanup) ++ - softnet updates for LANE (by Heikki Vatiainen) ++ - fixed firmeware license of Fore 200E driver and general 0.46/0.47 updates ++ (Christophe Lizzi) ++ - more CREDITS file additions ++ - softnet updates for sch_atm ++ - softnet updates for CLIP (also cleaned up flow control for > 1 VCC/itf; ++ reported by Alexey Kuznetsov) ++ - updated documentation for iproute2-2.2.4-now-ss000225 and streamlined the ++ build procedure ++ - PCI DMA updates for ENI driver ++ - changed the default install location of executables and man pages from ++ /usr/local to /usr ++ - make install no longer installs align, aping, br, bw, delay, isp, svctor, ++ sw_debug, sw_tcp, swc, and window ++ - eni.c: made highly controversial aal5 = ... line more readable ++ - moved /proc/atm to /proc/net/atm ++ - added vcc->send function to allow for AAL-specific processing (may be set ++ to dev->ops->send) ++ - atm_do_connect_dev now calls bind_vcc before AAL initialization to make ++ vcc->dev available ++ - change_qos no longer allows changing of AAL or traffic class (by Mitchell ++ Blank) ++ - changes for new loopback support to fore200e driver and sparc64 code (by ++ Christophe Lizzi) ++ ++ ++Version 0.66 to 0.67 (2-FEB-2000) ++==================== ++ ++New features ++------------ ++ ++ - upgraded to 2.3.42 ++ - added sunimode utility to set SUNI loopback mode (by Christophe Lizzi) ++ ++Other changes ++------------- ++ ++ - removed unused variable warning in net/sched/sch_atm.c ++ - changed ENI_SETMULT from ATMIOC_SARPRV+1 to ATMIOC_SARPRV+7 ++ - changed atmarpd's complaint about VCC-less non-ATMARP-server entries from ++ DIAG_ERROR to DIAG_INFO (the condition is okay for an ATMARP server) ++ ++ ++Version 0.65 to 0.66 (31-JAN-2000) ++==================== ++ ++Bug fixes ++--------- ++ ++ - atmsigd crashed on reception of as_accept, etc., because of inverted NULL ++ pointer test (reported by Kevin Vargo, Rui Prior, fixed by Julian Cable) ++ - fixed various SPARC build problems (by Christophe Lizzi) ++ - atmsigd insisted that calling party number is local in switch mode ++ - debug switch didn't initialize any ports ++ - net/atm/signaling.c:sigd_enq didn't properly zero the message, yielding ++ kernel pointers partially containing junk ++ - accept(2) didn't copy local ATM address to VCC descriptor (reported by ++ Pedro Brandao) ++ - ilmid/io.c didn't compile on SPARC (reported by Christophe Lizzi) ++ - usage.txt didn't define the %: macro, leaving garbage in usage.txt ++ ++New features ++------------ ++ ++ - upgraded to 2.3.41 ++ - Fore 200E driver now also works for SBA-200E (by Christophe Lizzi) ++ ++Other changes ++------------- ++ ++ - added various CREDITS entries ++ - changed TIOC{IN,OUT}Q to SIOC{IN,OUT}Q (no user space rebuild required; ++ the values are identical) ++ - added script atm/switch/tcp/mkfiles for automatic extraction of ++ configuration files ++ - atmsigd called ATM_GETLINKRATE "ATM_GETLINERATE" in complaints ++ - atmsigd tried to obtain link speed in switch mode, although it's not used ++ - Ambassador NIC: various files still had the wrong copyright/licensing text ++ (patch by Giuliano Procida) ++ ++ ++Version 0.64 to 0.65 (21-JAN-2000) ++==================== ++ ++Bug fixes ++--------- ++ ++ - fixed 32/64 bit %p formatting problem in /proc/atm/vc ++ - atmtcp: fixed RX/TX statistics (by Jens Axboe) ++ - sparc64-specific ioctl 32/64 bit marshalling fixes (by Christophe Lizzi, ++ with further improvements by Jens Axboe) ++ - zeppelin -l option handling (reported by Mike Prudence, fixed by Heikki ++ Vatiainen) ++ - mkpatch didn't include drivers/atm/eni.h ++ - updated eni.h (tx->backlog_len was missing) ++ - fixed various uint32_t build problems of user space tools by including ++ atm.h before anything other ATM headers (first reported by Rashmi Dravid) ++ - "natmtcp virtual" didn't parse the command line properly ++ - natmtcp's TCP link changed VPI/VCI to 0.0 on close ++ - CLIP: fixed crash after sending ARP (reported by Rui Prior) ++ ++New features ++------------ ++ ++ - upgraded to 2.3.40 (with help from Jens Axboe) ++ - added sparc64 changes for ENI driver (by Heikki Vatiainen) ++ - added the Fore PCA-200E(/SBA-200E) driver (by Uwe Dannowski and Christophe ++ Lizzi) ++ - added the Interphase ATM PCI (i)Chip (x575, x525, x531, etc.) driver (by ++ Monalisa Agrawal and Peter Wang) ++ - added ABR fields to struct atm_trafprm (by Peter Wang) ++ - nicstar driver now supports setting of the CLP bit (by Rui Prior) ++ - added ENI_SETMULT ioctl and enitune utility to change ENI buffer size ++ multipliers at run time ++ ++Other changes ++------------- ++ ++ - atmsigd: changed default UNI version from 3.0 to dynamic (which defaults ++ to 3.0) ++ - atmtcp: removed ugly ../../net/atm/protocols.h include ++ - ioctls now internally return -ENOIOCTLCMD if ioctl command number is not ++ recognized ++ - removed ATM_CREATE_LEAF ioctl (wasn't used and suggested the wrong design ++ approach anyway) ++ - updated README.DRIVERS ++ - natmtcp now uses port 2812 (assigned by IANA) ++ - moved Documentation/atm.txt to Documentation/networking ++ - improved atm_kptr_int_t for non-Sparc architectures (by Christophe Lizzi) ++ - removed two compiler warnings from nicstar.c ++ - some minor nicstar cleanup (by Rui Prior) ++ - added "vbr" and "abr" to text2qos/qos2text ("vbr" not used for anything ++ right now) ++ - natmtcp: added commands "create", "remove", "switch", corresponding to ++ options -p, -r, and -s of atmtcp ++ - natmtcp: added link type "print" (write PDU content to stdout) ++ - natmtcp: now uses atm_kptr_int_t for VCC kernel pointer instead of unsigned ++ long ++ - added apologetic man page for natmtcp ++ - renamed natmtcp to atmtcp and removed the old atmtcp ++ - changed some user-space code to avoid patronizing "ambiguous `else'" ++ warnings from egcs, adding as few ugly redundant curly braces as possible ++ - fixed some other compiler warnings ++ - kernel part: trimmed operations structure initializers which consisted ++ mainly of NULL pointers ++ - kernel pointers sent as opaque references to user space are now of type ++ atm_kptr_t. Added support functions kptr_eq and kptr_print. (With help from ++ Richard Johnson and Mitchell Blank) ++ - removed various "overriding commands" warnings in user-space build process ++ - mkdist now creates arcvie in current directory if ~/l/arch doesn't exist ++ - make clean && make now works also if dependencies are present (make clean ++ used to remove sigd/q.out.h, which the dependencies required) ++ - atmtcp uses command bg instead of -b for backgrounding. Also, listen-bg ++ listens and backgrounds before calling accept. ++ ++ ++Version 0.63 to 0.64 (1-DEC-1999) ++==================== ++ ++Bug fixes ++--------- ++ ++ - atmapi.h logic was still wrong (fixed by Christophe Lizzi) ++ - LANE: fixed BUS filtering and net/atm/lec.c cleanup (by Heikki Vatiainen) ++ - arpd/io.c assumed that diag() preserves errno ++ - atmarpd didn't include QOS in output if getsockopt failed ++ ++New features ++------------ ++ ++ - /proc/atm/eni:* now also shows transmit queue and backlog length ++ - added option "sndbuf" to atmarp ++ - added option "sndbuf" to tc ... atm ... ++ - /proc/atm/vc lists internal details for all VCs (flags, buffers, etc.); ++ added ATM_VF2TXT_MAP to atmdev.h to allow translation of flag values ++ ++Other changes ++------------- ++ ++ - ATM now uses sk->sndbuf/rvcbuf instead of atm_vcc->tx_quota/rx_quota ++ - removed rx_quota hack from zatm.c ++ - removed net/atm/tunable.h ++ - CLIP and sch_atm now only send packets if the VC's send queue allows them to ++ - implemented correct "requeue" function in sch_atm ++ - updated zeppelin(8) man page (Heikki Vatiainen) ++ - atmarp: atmarp -q qos_spec usage is obsolete; use atmarp -q qos qos_spec ++ instead ++ - /proc/atm/svc now prints "N/A@xxxxxxxx" instead of "Unassigned", with the ++ address of the descriptor in xxxxxxxx ++ - removed all traces of CONFIG_MMU_HACKS ++ - obsoleted ATM_SETSC (single-copy control) ++ ++ ++Version 0.62 to 0.63 (22-NOV-1999) ++==================== ++ ++Bug fixes ++--------- ++ ++ - horizon.c: cleared weird rate_lock/rates_lock patch conflict ++ - saaldump output formatting was completely wrecked; added option -q for ++ "quiet" output (no Q.2931 printing) ++ - fixed LANE Ethernet interface MTU mapping (patch by Rob Scott) ++ - atmsigd incorrectly rejected CONNECTION AVAILABLE (Q.2963.1) ++ - SVC address was wrong in /proc/atm/arp if using private and public part ++ - RESTART ACKNOWLEDGE was not sent with the correct global call reference ++ value (reported by Peter Ryan) ++ - zatm: usec timestamps need 64 division of x86, so this option must be ++ unavailable on other architectures (reported by Matti Aarnio) ++ - nicstar: added "fix3" and "fix4" (by Rui Prior) ++ - LANE: non-proxy didn't filter packets coming from BUS (fix by Marko Kiiskila ++ and Heikki Vatiainen) ++ ++New features ++------------ ++ ++ - upgraded to kernel version 2.3.28 ++ - atmtcp now reports VC open/close and generates timestamps (Note: the ++ protocol used between the kernel and the atmtcp utility has changed) ++ - new utility "natmtcp" which combines the ATMTCP protocol, ATMTCP ("virtual") ++ interfaces, "real" ATM interfaces, and log files (experimental) ++ - added ILMI 4.0 MIB variables atmfPortMyIdentifier and atmfMySystemIdentifier ++ (by Thomas Seidel) ++ - zeppelin: new command line option -I to select interface, allowing the use ++ of LANE with multiple physical interfaces (by Heikki Vatiainen) ++ - UltraSparc (sparc64) support (by Christophe Lizzi) ++ - nicstar: added IDT77105 PHY support (by Greg Banks) ++ - added utility loop25 to control ForeRunner LE loopback mode (by Greg Banks) ++ - added support for DNS lookup of NSAP addresses (by Rui Prior) ++ - added utility debug/dnstest (by Rui Prior) ++ ++Other changes ++------------- ++ ++ - net/atm/tunable.h cleanup ++ - removed SO_BCTXOPT, SO_BCRXOPT, and struct atm_buffconst ++ - removed obsolete field "next" from struct atm_blli ++ - changed potentially unaligned 32 bit accesses in SAAL to use read_netl ++ (spotted by Christophe Lizzi) ++ - added __attribute__ ((aligned(8))) to many structures containing structures ++ which are shared by kernel and user space to enfore uniform packing on ++ sparc64 (with help from Christophe Lizzi) ++ - changed unsigned long to unsigned int at API for compatibility with ++ architecture where sizeof(long) differs between user and kernel space ++ (e.g. sparc64; suggested by Christophe Lizzi) ++ - changed struct atmsvc_msg.{vcc,listen_vcc} from unsigned long to new type ++ atm_kptr_int_t; changed atmsigd accordingly (NB: debugging output may strip ++ upper bits) ++ - changed various casts pointer->int to pointer->long->int (where the pointer ++ does indeed only contain an int, e.g. in ioctl) for Alpha (reported by ++ Matti Aarnio) ++ - nicstar: changes card->membase from u32 to unsigned long ++ - added __attribute__ ((unused)) to mpc.c and mpoa_caches.c to remove ++ warnings about variables used only for debugging ++ - drivers/atm/Config.in: changed ! "$foo" = "x" to "$foo" != "x" ++ ++ ++Version 0.61 to 0.62 (27-AUG-1999) ++==================== ++ ++Bug fixes ++--------- ++ ++ - lib/diag.c:set_logfile didn't set log_to_initialized (reported by Lars ++ Burgstahler) ++ - sch_atm did not use classifiers attached to the x:0 class (reported by Lars ++ Burgstahler) ++ - net/atm/atm_misc.c EXPORT'ed atm_return, which is an inline function (fixed ++ by Mitchell Blank) ++ - work-around for SO_LEVEL range problems (by Mitchell Blank) ++ - nicstar oops fix (by Rui Prior and John Brosnan) ++ - nicstar should now work also as non-module (by Rui Prior) ++ - nicstar fix for chip bug showing up on 64-bit CPCI bus systems (by Jay ++ Talbott) ++ - cleared confusion about inclusion of suni.o when building both nicstar and ++ ENI ++ - suni.c now always exports suni_init ++ - various fixes and cleanups in the Madge drivers (by Giuliano Procida) ++ - fixed new set of atm_pdu2truesize problems by introducing atm_alloc_charge ++ which handles the allocation too (problem report and work-around by Alexey ++ Kuznetsov) ++ - getsockname on unbound PVC socket caused an oops ++ - LANE: Token Ring source route bridge support fix (by Heikki Vatiainen) ++ ++New features ++------------ ++ ++ - upgraded to kernel version 2.3.15 (mainly by Alexey Kuznetsov and Mitchell ++ Blank) ++ - new socket option SO_ATMPVC to retrieve the "PVC" address (PVC & SVC) (based ++ on a patch by Jay Talbott) ++ - zeppelin -l now also accepts only the selector byte (by Robert Slaski) ++ ++Other changes ++------------- ++ ++ - removed obsolete drivers/atm/nicstar.c.old_skb ++ - removed all references to Arequipa (obsolete) ++ - SO_BCTXOPT/SO_BCRXOPT are now obsolete, given that the final verdict on page ++ flipping has been spoken in linux-kernel ++ - interface statistics are now counted in struct net_device_stats instead of ++ struct enet_statistics (by Mitchell Blank) ++ - added pointer to mailing list to Documentation/atm.txt ++ - Documentation/Configure.help now points to Documentation/atm.txt instead of ++ directly to the Web page. ++ - usage.tex: clarified the consequences of interrupting atmtcp ++ - changed the highly misleading "atmarpd:ITF: no such interface" message to ++ DIAG_DEBUG ++ ++ ++Version 0.60 to 0.61 (11-JUN-1999) ++==================== ++ ++Bug fixes ++--------- ++ ++ - nicstar: driver sometimes crashed when starting for 25 Mbps cards (Rui ++ Prior) ++ - Zeitnet driver: uPD98402.c wasn't compiled with -DEXPORT_SYMTAB when ++ building as a module ++ - net/atm/raw.c didn't export atm_init_aal5, so ATMTCP didn't load as a module ++ - atmtcp could still be accessed after loading and then unloading, yielding an ++ Oops ++ ++Other changes ++------------- ++ ++ - PPC configuration now also includes ATM (Jay Talbott) ++ - lots of cleanup in the Madge drivers (Giuliano Procida) ++ - tamed down a bit the tone in README ++ ++ ++Version 0.59 to 0.60 (3-JUN-1999) ++==================== ++ ++New features ++------------ ++ ++ - upgraded to kernel version 2.3.3 (main change is slightly different wait ++ queue handling; affects all drivers) ++ ++Other changes ++------------- ++ ++ - mkdiff script now takes .bz2 kernel if no .gz can be found ++ - made a few changes to the Madge drivers to reduce the number of warnings ++ ++ ++Version 0.58 to 0.59 (3-JUN-1999) ++==================== ++ ++New features ++------------ ++ ++ - upgrade to kernel version 2.2.9 ++ - zeppelin now adjusts MTU when joining ELAN (Heikki Vatiainen) ++ ++Other changes ++------------- ++ ++ - adjusted tr interface name limit to 8 characters (down from a wasteful 9) ++ ++ ++Version 0.57 to 0.58 (3-JUN-1999) ++==================== ++ ++Bug fixes ++--------- ++ ++ - ENI drivers sometimes directly dereferenced pointers instead of using readl/ ++ writel (fixed by Mitchell Blank) ++ - nicstar driver no longer uses floating point (fixed by Rui Prior) ++ - nicstar driver may have refused CBR VC in some cases even with enough ++ bandwidth available (fixed by Rui Prior) ++ - usage.tex failed to build (fixed by Bill Brooks) ++ - zeppelin got byte order in BLLI wrong (reported by Chas Williams; fixed by ++ Mitchell Blank and Heikki Vatiainen) ++ - zeppelin did not work when the host had multiple ATM addresses (reported by ++ Benoit Steiner; fixed by Heikki Vatiainen) ++ - zeppelin incorrectly parsed -i command line option (reported by Benoit ++ Steiner; fixed by Heikki Vatiainen) ++ - atm_connect_vcc and /proc/atm/pvc report AAL0 now properly (reported by Zhu ++ Qun Ying and Uwe Dannowski) ++ ++New features ++------------ ++ ++ - nicstar driver now support SONET diagnostics (by Rui Prior) ++ - nicstar driver now works on PowerPC (by Jay Talbott) ++ - LANE now also supports Token Ring (Heikki Vatiainen, with testing by ++ Holger Smolinski) ++ ++Other changes ++------------- ++ ++ - major non-i386 architecture and other cleanup in ENI driver (by Mitchell ++ Blank) ++ - number of lec devices is 40+8 (lec0-lec39 are Ethernet and lec40-lec47 are ++ Token Ring; Heikki Vatiainen) ++ - lec.c and mpc.c now use atm_force_charge (Heikki Vatiainen) ++ - net/802/tr.c limited interface names to 4 characters (fixed by Heikki ++ Vatiainen) ++ - zeppelin man page updated (Heikki Vatiainen) ++ - "zeppelin.new" is now "zeppelin", the old "zeppelin" is gone ++ - set "atm_connect" printk to KERN_DEBUG ++ - removed ATM_SAAL from include/linux/atm.h (there never was any support for ++ SAAL in the kernel) ++ ++ ++Version 0.56 to 0.57 (18-MAY-1999) ++==================== ++ ++Bug fixes ++--------- ++ ++ - atmarpd complained "invalid control msg type" when changing interface ++ characteristics (reported by Soo-Khim Ho) ++ - sch_atm didn't compile without CLIP (reported by Zhu Qun Ying) ++ - LANE & MPOA: plugged a few memory leaks after failure to atm_charge (Heikki ++ Vatiainen) ++ - mpcd could not be killed if MPS's address was not known (fixed by Heikki ++ Vatiainen) ++ - nicstar: fixed the sleeping in interrupt issue (Rui Prior) ++ ++New features ++------------ ++ ++ - drivers for the Madge "Ambassador" and "Horizon [Ultra]" NICs, also known ++ as Collage PCI 155 Server, 25, and 155 Client (by Giuliano Procida) ++ ++Other changes ++------------- ++ ++ - MPOA code cleanup and debugging printks are now conditional (Heikki ++ Vatiainen) ++ - removed both led/USAGE files ++ - removed the old atmsigd (was in atm/sig.old/) ++ - nicstar driver now works around TSQ bug on older chips (77201) (by Rui ++ Prior, with the detective work by Jay Talbott) ++ ++ ++Version 0.55 to 0.56 (22-APR-1999) ++==================== ++ ++Bug fixes ++--------- ++ ++ - atm/doc/Makefile assumed . to be included in PATH when invoking rlatex ++ (fix by Heikki Vatiainen) ++ - usage.txt leaked Arequipa configuration examples (fix by Heikki Vatiainen) ++ - plugged a small memory leak in led.new which occurred when using the LANE ++ client as a proxy (Heikki Vatiainen) ++ - atmarpd crashed when printing ATMARP table entries with flag 0x8000 set ++ (reported by Vinay Kulkarni) ++ - CLIP interfaces now follow netmask changes ++ - Nicstar: 25.6 Mbps cell rate corrected (by Rui Prior) ++ - atm_equal could loop forever when comparing NSAP-encoded E.164 addresses ++ (reported by Valley Zhizhkun) ++ - [AP]F_ATM[PS]VC definitions in lib/atm.h conflicted with glibc 2.1 ++ (reported by Heikki Vatiainen and Jens Vagelpohl) ++ - changed a few non-int main to int main (reported by Heikki Vatiainen) ++ - changed lib/diag.c work with glibc 2.1, where stderr is no longer a constant ++ (based on a patch by Heikki Vatiainen, also reported by Giuliano Procida) ++ - make clean didn't remove qgen/q.test.c, qgen/qd.out.h, qgen/qd.test.c, ++ sigd/q.out.h and sigd.old/q.out.h (reported by Giuliano Procida) ++ - optional headers were installed even with system headers present if ++ INSTROOT was different from / (reported by Giuliano Procida) ++ - lib/stdint.h was used even on systems that had a "real" stdlib.h (based on a ++ patch by Heikki Vatiainen, also reported by Giuliano Procida) ++ - renamed net/atm/misc.c to atm_misc.c to avoid name clash with ++ drivers/char/misc.c on include/linux/modules/misc.* (reported by Borek ++ Lupomesky) ++ ++New features ++------------ ++ ++ - new ioctl ATM_GETLINKRATE to query link rate of an interface (suggested by ++ Vitaly Lavrov) ++ - new atmsigd.conf option io max_rate to specify rate to signal if ++ application requests the "maximum" ++ - added decription of CONFIG_ATM_LANE and CONFIG_ATM_MPOA to the kernel ++ configuration help (Heikki Vatiainen) ++ - added description of LANE to usage.tex (Heikki Vatiainen) ++ - new function atm_force_charge to unconditionally add data to a receive ++ buffer ++ ++Other changes ++------------- ++ ++ - atmsigd now determines maximum link rate by querying interfaces (suggested ++ by Vitaly Lavrov) ++ - moved local address registry from a global table to VPCI structures ++ - changed unknown net device notification severity from KERN_ERR to ++ KERN_WARNING ++ - atmarpd now overwrites old atmarpd.table on startup (it used to keep it ++ until the first configuration change) ++ - shutdown(2) of native ATM VCs now returns 0 instead of -EOPNOTSUPP ++ (suggested by Mitchell Blank) ++ - Nicstar: IRQ sharing is now allowed (by Rui Prior) ++ - Nicstar: default maximum number of cards is now 4 (by Rui Prior) ++ - Nicstar: when compiled as a module, the driver may no longer be removed ++ while in use (by Rui Prior) ++ - Nicstar: loss of cells is no longer reported as a plain CRC error (by Rui ++ Prior) ++ - atmsigd now always clears the endpoint reference flag if in UNI 3.0 mode ++ (based on a patch by Heikki Vatiainen) ++ ++ ++Version 0.54 to 0.55 (1-MAR-1999) ++==================== ++ ++Bug fixes ++--------- ++ ++ - SELECT_TOP_PCR didn't take intro account the "pcr" field, causing SVC with ++ QoS pcr=xxx to be set up at link speed ++ - qos_equal didn't detect differences in the "pcr" fields ++ - sch_atm only accepted parent == root or absent (reported by John Loughney) ++ - sch_atm:atm_tc_put accessed flow structure after kfree'ing it ++ - sch_atm:atm_tc_change didn't put excess traffic class if class creation ++ failed ++ - sch_atm:atm_tc_dump_class didn't return class ID in tcm->tcm_handle ++ - sch_atm:atm_tc_delete refused to delete classes because it expected ++ ref == 1, but ref == 2 (reported by John Loughney) ++ ++ ++Version 0.53 to 0.54 (19-FEB-1999) ++==================== ++ ++Bug fixes ++--------- ++ ++ - led.new: fixed build problem and warning (Heikki Vatiainen) ++ - fixed LANE arp cache timeouts (Heikki Vatiainen) ++ - ilmid -i option fell through into -l, causing logging to go into a file ++ named after the local address ++ - flipping the highest bit of ep_ref made it negative which was erroneously ++ interpreted to mean "absent" (reported by Giuliano Procida and Chas ++ Williams) ++ - ilmid used the result of AsnOidCompare inconsistently, causing network ++ prefix registration to fail with some switches (based on a patch by Giuliano ++ Procida) ++ ++New features ++------------ ++ ++ - tc:q_atm: new option "clip" to select Classical IP processing of inbound ++ traffic ++ - new sch_atm class attribute TCA_ATM_STATE to retrieve VC state ++ ++Other changes ++------------- ++ ++ - led.new: improved handling of LANE flush protocol (Heikki Vatiainen) ++ - copied USAGE from led/ to led.new/ ++ - added description of ilmid options -i and -u to USAGE (Heikki Vatiainen) ++ - ilmid -u now also works without -DDYNAMIC_UNI (all values but the default ++ are refused) ++ - tcpdump patch updated to tcpdump version 3.4 (Heikki Vatiainen) ++ - updated "tc" patch to iproute2 version 2.1.99-now-ss990203 ++ ++ ++Version 0.52 to 0.53 (9-FEB-1999) ++==================== ++ ++Bug fixes ++--------- ++ ++ - atmsigd: selecting the UNI version via compile-time options didn't yield ++ the desired result in some cases (reported by Vinay Kulkarni and others) ++ - ATM VCCs now use struct sock, as required by protocol-independent layer ++ starting with recent 2.1 kernels (by Mitchell Blank) ++ - led fixes: htons/htonl bugs in LANEv2 code, one duplicate close() removed ++ (by Heikki Vatiainen) ++ ++New features ++------------ ++ ++ - upgraded to the 2.2.1 kernel (by Mitchell Blank) ++ - LANE: added bridging support (by Heikki Vatiainen) ++ - complete rewrite of led (in led.new), which is now leaner and no longer ++ contains code (c) Digital (by Heikki Vatiainen) ++ - added macros for local AESA format and group addresses, and support in ++ atm2text (by Heikki Vatiainen) ++ ++Other changes ++------------- ++ ++ - ENI: buffer sizes are now limited to MID_MAX_BUF_SIZE even if max_sdu > ++ MID_MAX_BUF_SIZE/3 (reported by Andrew Lunn) ++ - plenty of NICStAR changes (Rui Prior and Mitchell Blank) ++ - LANE interface to upper layer looks more like Ethernet, so adding bridge and ++ 802.1Q support is easier, and tcpdump does not need any extra patches (by ++ Heikki Vatiainen) ++ ++ ++Version 0.51 to 0.52 (5-DEC-1998) ++==================== ++ ++Bug fixes ++--------- ++ ++ - atmsigd crashed when receiving STATUS ENQUIRY for call in Null state ++ (reported by Heikki Vatiainen) ++ - outbound endpoint reference didin't have the 16th bit toggled (fixed by ++ Andrew Lunn) ++ - lec.c: fixed a bug in kernel which could cause kernel part to deadlock when ++ signalling was not started successfully (by Heikki Vatiainen) ++ - MPOA: bug fixes and other changes, see atm/mpoa/CHANGELOG (by Heikki ++ Vatiainen) ++ ++New features ++------------ ++ ++ - LANE: both kernel & daemon: support for ELANs which have MTUs greater than ++ 1516 (by Eric H. Kinzie) ++ - MPOA: can now ask LECS for configuratino information (by Heikki Vatiainen) ++ ++Other changes ++------------- ++ ++ - zeppelin.8: updated (Heikki Vatiainen) ++ ++ ++Version 0.50 to 0.51 (6-NOV-1998) ++==================== ++ ++Bug fixes ++--------- ++ ++ - atmsigd: typo prevented kernel.c from compiling with UNI30 disabled (fix by ++ Andrew Lunn and Uwe Dannowski) ++ - option -u crashed ilmid (reported by Michael Wolf) ++ ++Other changes ++------------- ++ ++ - bearer capability is now set to "CBR" for CBR (suggested by Heikki ++ Vatiainen) ++ ++ ++Version 0.49 to 0.50 (3-NOV-1998) ++==================== ++ ++Bug fixes ++--------- ++ ++ - atmsigd didn't compile for -DUNI31 -DALLOW_UNI30 (fixed by Richard Gooch) ++ - atmsigd crashed on as_bind and also had problems with as_connect after ++ as_bind (reported by Heiko Krupp, Heikki Vatiainen, and many others) ++ ++Other changes ++------------- ++ ++ - atmsigd now enables tracing by default (use -t 0 to turn it off) ++ - added "terminate" message to test/isp ++ - mpoad defaults to UBR if service category is absent (by Heikki Vatiainen) ++ - LANE now avoids blocking intact connections when other connections have ++ problems by queuing packets independently per destination while waiting for ++ a connection (by Heikki Vatiainen) ++ ++ ++Version 0.48 to 0.49 (1-NOV-1998) ++==================== ++ ++Bug fixes ++--------- ++ ++ - q_atm.c passed TCA_ATM_EXCESS even if zero, while the kernel expected it ++ to be absent in this case (changed q_atm.c) ++ - q_atm: tc class show didn't separate fields properly with blanks ++ - removed double inclusion of atm/config from mkdist ++ ++New features ++------------ ++ ++ - upgraded to the 2.1.126 kernel ++ ++Other changes ++------------- ++ ++ - "new" atmsigd is now the default (atm/sigd got renamed to atm/sigd.old, ++ atm/sigd.new to atm/sigd) ++ - updated extra/tc/README ++ ++ ++Version 0.47 to 0.48 (30-OCT-1998) ++==================== ++ ++Bug fixes ++--------- ++ ++ - ilmid didn't recognize the -u option ++ - ATM_GETCIRANGE copied wrong amount of data (fix by Heikki Vatiainen) ++ - sch_atm didn't compile without policing enabled (reported by Calin Poenaru) ++ - BHLI octets: qgen/msg.fmt allowed nine instead of eight bytes for ISO and ++ user specified, include/linux/atmsap.h:ATM_MAX_HLI was 7 instead of 8 (by ++ Damian Gilmurray and Paisit Thamsakorn) ++ - MPOA: bug fixes and other changes, see atm/mpoa/CHANGELOG (by Heikki ++ Vatiainen) ++ ++New features ++------------ ++ ++ - ilmid: new option -i to set local IP address (suggested by Andrew May) ++ - ilmid now also supports the MIB variables atmfAtmLayerMaxVpiBits and ++ atmfAtmLayerMaxVciBits (based on a patch by Uwe Dannowski) ++ ++Other changes ++------------- ++ ++ - ilmid: search for local IP address didn't consider LANE interfaces (lec*) ++ - consolidated most of the various calls to gethostbyname and friends into ++ text2ip (libatmd) ++ - corrected some glitches in net/sched/sch_atm.c (untested) ++ - removed debug/encopy, debug/endump, and debug/zndump from the distribution. ++ They were almost useless and caused problems with make depend ++ - SYMFILES in qgen/Makefile now determines location of atmsap.h at run time to ++ avoid problems when kernel headers are not in /usr/include/linux (reported ++ by Uwe Dannowski) ++ ++ ++Version 0.46 to 0.47 (6-OCT-1998) ++==================== ++ ++Bug fixes ++--------- ++ ++ - qgen didn't build for all UNI versions (fixed by Richard Gooch) ++ ++New features ++------------ ++ ++ - ilmid: new option -u to set UNI version (3.0, 3.1, or 4.0). Only available ++ if compiled with -DDYNAMIC_UNI. ++ ++Other changes ++------------- ++ ++ - ilmid: getIpAddr: improved robustness and added debugging output ++ ++ ++Version 0.45 to 0.46 (5-OCT-1998) ++==================== ++ ++Bug fixes ++--------- ++ ++ - ENI and ZATM driver used to read IRQ directly from PCI configuration, ++ bypassing any fixups (reported by Richard Gooch) ++ - atmsigd.new: removed "Known bug" memory leak (when tracing) ++ - led/lec_ctrl.c: signalling bug fixed, max_sdu now has correct value instead ++ of 1 (by Heikki Vatiainen, reported by Josh Baratz <jbaratz@lucentctc.com> ++ and Wolfgang Platzer <wplatzer@iaik.tu-graz.ac.at>) ++ - lots of MPOA bug fixes and other changes, see atm/mpoa/CHANGELOG (by Heikki ++ Vatiainen) ++ - atmsigd reported "Q.2931.1" when configured to support Q.2963.1 ++ ++New features ++------------ ++ ++ - atmsigd.new now supports run-time configuration of the signaling protocol ++ version (via atmsigd.conf) ++ ++Other changes ++------------- ++ ++ - added 16W bursts to ENI burst size configuration (NB: 16W may actually be ++ *slower* than 8W) ++ - lec_ctrl.c: zeppelin now uses LE_REGISTER protocol when TLVs are associated ++ with client's MAC address (by Heikki Vatiainen) ++ ++ ++Version 0.44 to 0.45 (1-OCT-1998) ++==================== ++ ++Bug fixes ++--------- ++ ++ - ENI driver didn't do four-word bursts on RX for sizes < 8 words ++ - arequipad, atmarpd, bus, lecs, les, mpcd, sw_*, and zeppelin silently ++ ignored extra command-line arguments instead of complaining ++ ++New features ++------------ ++ ++ - ENI: added configuration options to fine-tune burst sizes (in reponse to ++ incompatibility found by Dave Airlie) ++ ++Other changes ++------------- ++ ++ - changed the way how ATM-specific data is stored in skbs. Tentatively updated ++ the the stack, including drivers. Use CONFIG_ATM_SKB to enable the new-style ++ skbs. ++ - Rules.make no longer discards the previous value of LDLIBS ++ - sw_tcp now only establishes bi-directional VCs if both directions are really ++ requested in the QoS structure ++ - moved manual switch control from sw_tcp to the generic switch code; "tcpswc" ++ is now called "swc", the corresponding switch.conf clause is now ++ 'control <path>' instead of 'option control "<path>"' ++ ++ ++Version 0.43 to 0.44 (24-SEP-1998) ++==================== ++ ++Bug fixes ++--------- ++ ++ - CONNECT messages no longer contain the AAL type IE if EP ref is present and ++ non-zero (reported by Heikki Vatiainen) ++ - SSCOP: added mode for partial compatibility with Q.SAAL1 (to get rid of ++ warnings reported by Heikki Vatiainen and of interoperability problems with ++ Virata switches reported by Damian Gilmurray) ++ - ilmid now returns a valid response for atmfMyIpNmAddress (by Uwe Dannowski) ++ - configuration on-line help for CLIP didn't work because tag was different ++ from configuration variable ++ - atmsigd crashed when adding multiple local addresses on an interface ++ (reported by Heiko Krupp) ++ - atmaddr.8 said "ATMARP" in the header (reported by Hans Einsiedler) ++ - net/atm/misc.c didn't include linux/config.h and linux/module.h, causing ++ symbols to be missing when rebuilding the kernel after enabling modules ++ (reported by Thomas Parvais) ++ ++New features ++------------ ++ ++ - new maintenance utility tcpswc to control sw_tcp "switches" (description at ++ the end of switch/tcp/README) ++ - added support for setting the CLP bit (untested; see doc/README.CLP) ++ - added support for policing to the ATM qdisc (untested; see extra/tc/README) ++ - ilmid: added support for atmfAtmLayerUniVersion (by Uwe Dannowski) ++ ++Other changes ++------------- ++ ++ - updated the NICStAR driver to version 008b (by Rui Prior) ++ - new switch fabric function fab_option to pass configuration options ++ - atm2text now also supports unspecified and wildcard components in PVC ++ addresses ++ - added configuration option CONFIG_ATM_CLIP_NO_ICMP to discard packets for ++ which no ATMARP entry exists silently instead of sending an ICMP (this is an ++ ugly hack-around for the revalidation problem reported by Gerald Hanusch) ++ - various minor documentation updates ++ - atmarpd now sends InARP requests when active VC setup completes in order to ++ tell the peer our IP address(es) ++ ++ ++Version 0.42 to 0.43 (21-AUG-1998) ++==================== ++ ++Bug fixes ++--------- ++ ++ - trying to use atmtcp when compiled as a module with the module not loaded ++ crashed the kernel ++ ++New features ++------------ ++ ++ - upgraded to the 2.1.117 kernel ++ - included NICStAR driver by Rui Prior at INESC (this driver also includes ++ parts of an earlier driver written by Matt Welsh, then enhanced by R. D. ++ Rechenmacher and Jawaid Bazyar) ++ - new atmsigd with support for multiple signaling entities (experimental) ++ ++Other changes ++------------- ++ ++ - removed register dumping code from suni.c (leaked out into the distribution) ++ ++ ++Version 0.41 to 0.42 (19-AUG-1998) ++==================== ++ ++Bug fixes ++--------- ++ ++ - atm.patch was out of sync again :-( ++ ++ ++Version 0.40 to 0.41 (19-AUG-1998) ++==================== ++ ++Bug fixes ++--------- ++ ++ - 0.40 contained an older atm.patch than the one that was supposed to go with ++ it (some changes to sch_atm and MPOA were missing) ++ - kernel didn't build with LANE enabled and MPOA disabled (fix by Mitchell ++ Blank Jr) ++ ++New features ++------------ ++ ++ - MPOA now also supports CBR SVCs (by Heikki Vatiainen and Sampo Saaristo) ++ ++Other changes ++------------- ++ ++ - atmtcp may work as a module (untested) ++ - kernel code now uses capabilities instead of suser() ++ - removed obsolete recycle_buffer code ++ - distribution now also includes mkpatch, the script that's used to create ++ atm.patch ++ ++ ++Version 0.39 to 0.40 (13-AUG-1998) ++==================== ++ ++Bug fixes ++--------- ++ ++ - ilmid defined the value of "invalid" as 0 instead of 2 (fix by Timo ++ Parnanen) ++ - bash-2 doesn't like for n in $(SUBDIR); ... if SUBDIR is undefined (fix ++ by Heikki Vatiainen) ++ - LANE still cleared ATM_VF_RELEASED instead of calling atm_async_release_vcc, ++ which apparently led to stray kernel crashes in signaling (found with a lot ++ of help from John McPherson) ++ - ATM qdisc now properly re-allocates skb memory to grow headers, if necessary ++ - atm/switch/Makefile didn't build SUBDIRS ++ - atmarpd sent garbage ATM addresses in InARP responses over PVCs (reported by ++ Stefan Keller-Tuberg) ++ ++New features ++------------ ++ ++ - MPOA (Multi-Protocol Over ATM) client support written by Heikki Vatiainen ++ and Sampo Saaristo ++ - LANE client (zeppelin) now also supports LANE2 (by Heikki Vatiainen) ++ ++Other changes ++------------- ++ ++ - accept() now also returns on ATM_VF_CLOSE ++ - ATM qdisc now uses the same data format on rtnetlink as other qdiscs; new ++ option for user-provided headers ++ - atm/switch can now use "external" routing (e.g. provided by the fab control) ++ ++ ++Version 0.38 to 0.39 (4-AUG-1998) ++==================== ++ ++Bug fixes ++--------- ++ ++ - added missing #include <atm.h> in tcpsw.c (fixed by Heikki Vatiainen) ++ - atmsigd allowed both sides to initiate PCR modification; Q.2963.1 only ++ allows the connection owner (i.e. the caller) to do this ++ - atmarpd no longer tries to use incoming SVCs with zero backward bandwidth ++ for ATMARP ++ - ENI and ZATM drivers didn't invoke vcc->pop on dev->ops->send failure ++ - make install didn't probe correctly for presence of /usr/include/stdint.h ++ (needed on GLIBC 1 systems) ++ - net/atm/resources.c didn't export bind_vcc to modules (fix by Oliver ++ Frommel) ++ - net/arpd/atmarp didn't build without make depend (reported by Stefano ++ Giacometti) ++ - clip_mkip zeroed vcc->rx_inuse and didn't take into account that clip_push ++ calls atm_return, which subtracts from vcc->rx_inuse too ++ - fixed typos in qgen/uni.h (and msg.fmt) for causes 38, 41, and 43 ++ - atmsigd wrote exit trace to stderr when it had a dump directory and vice ++ versa ++ - documentation still claimed that atmtcp yields messages at boot time ++ ++New features ++------------ ++ ++ - added flow to ATM VCC mapping queuing discipline (experimental) ++ - module for setting up ATM PVC/SVC mappings with "tc" in extra/tc (see ++ extra/tc/README) ++ - atmarpd: new request type art_query to request resolution without VC setup ++ - atmarp: new undocumented option -Q to test art_query ++ - added ATMTCP interfaces that survive disconnects (persistent; new atmtcp(8) ++ options -p and -r; new ioctls ATMTCP_CREATE and ATMTCP_REMOVE) ++ ++Other changes ++------------- ++ ++ - zeppelin didn't explicitly set the AAL type for outbound connections (by ++ Heikki Vatiainen) ++ - CLIP also allows SVCs to have no idle timeout at all (timeout = 0) ++ - moved SUNI private ioctls (SUNI_GETLOOP and SUNI_SETLOOP) from ++ drivers/atm/suni.h to include/linux/atm_suni.h ++ - atmarpd now shows QoS information for VCs where it differs from the default ++ or where no default is applicable ++ - removed the file atm/WARNING, which gave an overly pessimistic perspective ++ of the state of things ++ - switch: fab_op now returns the cause value plus (optionally) a pointer to ++ diagnostics in the callback instead of a simple okay/not okay indication ++ - updated and corrected the atmtcp man page ++ - further cleanup of the build procedure ++ - README now mainly refers to http://lrcwww.epfl.ch/linux-atm/info.html ++ - updated and trimmed BUGS ++ - added a note to CREDITS indicating its obsolescence ++ ++ ++Version 0.37 to 0.38 (25-JUN-1998) ++==================== ++ ++Bug fixes ++--------- ++ ++ - fixed the remaining few #include <linux/atm.h> ++ - invoking fcntl() or socketpair() on an ATM socket caused an "Oops" (reported ++ by Jonathan Chan) ++ - CLIP PVCs caused an "Oops" when cat'ing /proc/atm/pvc (reported by Marko ++ Kiiskila and Robert Olsson) ++ - atm/qgen/default.nl wasn't removed after build failure ++ - debugging switch (sw_debug) did not stop operations after the first error ++ - svc_accept returned apparent success instead of -EAGAIN, usually leading to ++ a later -ENOTCONN ++ - ttcp.c didn't initialize port_name, leading to erratic behaviour when making ++ slight changes to the build process ++ - atm_pdu2truesize diverged from alloc_skb, leading to sudden failure of VCs ++ or of ATMARP (reported by Robert Olsson) ++ - corrected use of '~' when applied to unsigned longs representing memory ++ addresses in aread, ENI, and ZATM (reported by Wai-Sun Chia) ++ - atmtcp and LANE didn't use bind_vcc when setting up control VCs ++ - atmtcp got ENOMEM/EBUSY wrong when failing to create an interface ++ - sig level <level> in atmsigd.conf didn't affect UNI diagnostics ++ ++New features ++------------ ++ ++ - upgraded to the 2.1.105 kernel ++ - added ATMTCP "switch" in atm/switch/tcp ++ - atmtcp: new mode -s to connect to an ATMTCP "switch" ++ - atmtcp: new option -d for debugging output ++ - added -b option (the usual "background") to switch/relay.c ++ ++Other changes ++------------- ++ ++ - changed "PDU" to "SDU" in the atmtcp(8) man page ++ - atmarpd now includes the interface netmask in ATMARP table dumps ++ - added ATM devices also to the Alpha architecture, because at least ATMTCP ++ works (by Wai-Sun Chia) ++ - added the removal of -Wmissing-prototypes to the 0.37 changes ++ - removed -Wcast-align from Rules.make because of a conflict with ++ /usr/include/socketbits.h of glibc 2 on Alphas (reported by Wai-Sun Chia) ++ - atmsigd.conf.4: documented that debug log stderr works too ++ - sap_equal now also allows wildcard matches for BHLI (with SXE_COMPATIBLE) ++ - atmsigd now uses -m <mode> instead of -N and -A ++ - atmsigd.conf now uses sig mode <mode> instead of sig net ++ ++ ++Version 0.36 to 0.37 (6-JUN-1998) ++==================== ++ ++Bug fixes ++--------- ++ ++ - lib/atm.h defined AF_ATMPVC to 20, but the correct value is 8. Likewise, ++ AF_ATMSVC should be 20, not 21. (Reported by Luke Diamand) ++ - fixed bad ASN encoding in ilmid (by Vesa-Matti Puro) ++ - make install and make instdirs didn't stop on error ++ ++New features ++------------ ++ ++ - upgraded to the 2.1.104 kernel ++ - included a script to demonstrate the debug switch (see switch/debug/README) ++ ++Other changes ++------------- ++ ++ - moved definitions not used by the kernel from linux/atmarp.h to atmarp.h ++ - removed linux/atm_stdint.h (linux/types.h has now caught up) ++ - changed ENI and ZATM driver to use new PCI interface ++ - net/atm/clip.c no longer uses ether_setup (suggested by Alexey Kuznetsov) ++ - more header file cleanup (main change: applications should now ++ #include <atm.h> instead of #include <linux/atm.h>) ++ - removed -Wmissing-prototypes from Rules.make because of a conflict with ++ include/linux/byteorder/swab.h ++ ++ ++Version 0.35 to 0.36 (23-APR-1998) ++==================== ++ ++Bug fixes ++--------- ++ ++ - changed the numeric values of PF/AF_ATMPVC/SVC and SOL_ATM/AAL to avoid ++ conflicts with other allocations. This breaks binary compatibility with ++ ATM programs compiled under older kernels ++ - RESTART ACK was sent with the wrong class when acknowledging the restart of ++ the indicated virtual channel (fix by Mohsen Souissi) ++ - RELEASE was retransmitted forever (to avoid having to perform a RESTART), ++ although it's sufficient to retransmit once and then drop the connection ++ - esi.c checked the kernel version code without including linux/version.h ++ - CLIP changes magically fixed hangs on SICGIFCONF (reported by Wayne Salamon) ++ - atmsigd usually didn't set pvc.sap_family in ISP messages ++ ++New features ++------------ ++ ++ - added build-time option -DTHOMFLEX to send RESTART when SAAL comes up, which ++ works around a bug in some Thomson Thomflex 5000 switches (by Mohsen ++ Souissi) ++ - atmtcp: new option "-i itf" to request a specific interface number ++ - the "debug switch" (switch/debug/sw_debug) is now capable of successfully ++ signaling a UNI 3.x call (see switch/debug/README for details) ++ ++Other changes ++------------- ++ ++ - atm_equal can now also compare PVC addresses. The argument type has ++ therefore been changed from struct sockaddr_atmsvc * to struct sockaddr * ++ - moved driver-private data from skb->atm.* into skb->cb ++ - complete redesign of communication between atmarp(8) and atmarpd(8) (now ++ uses a UNIX domain socket; suggested by Alexey Kuznetsov) ++ - atmarp -a now also produces correct output if atmarpd is running with -d ++ - removed clip(8) ++ - moved atmarp(8) from atm/ip into atm/arpd, removed atm/ip ++ - /proc/atm/svc shows listening sockets again ++ - cleaned up a few cases where diag(...,DIAG_FATAL,...) was followed by an ++ "else" or a "return". ++ - atmsigd now uses Unix domain sockets (instead of named pipes) to communicate ++ with non-kernel ISP users (updated test/isp too) ++ - net/atm/resources.c:atm_dev_register can now be asked to assign a specific ++ interface number (-1 yields the old behaviour) ++ ++ ++Version 0.34 to 0.35 (27-MAR-1998) ++==================== ++ ++Bug fixes ++--------- ++ ++ - ilmid compared memcmp results with -1,1, which fails under optimization ++ (fixed by Damian Gilmurray) ++ - various fixes and cleanup in how CLIP interacts with the neighbour cache ++ (spotted by Alexey Kuznetsov) ++ - Rules.make complained about missing "optprocess" command on some occasions ++ ++New features ++------------ ++ ++ - upgraded to the 2.1.90 kernel ++ - added some components for ATM switch control (not properly integrated yet, ++ so they don't do anything useful at the moment; written by Roman Pletka) ++ ++Other changes ++------------- ++ ++ - eliminated various compiler warnings when compiling with glibc2 ++ - removed clip_hard_header (suggested by Alexey Kuznetsov) ++ ++ ++Version 0.33 to 0.34 (13-MAR-1998) ++==================== ++ ++Bug fixes ++--------- ++ ++ - eni.c didn't include config.h (fix by Pete Wyckoff) ++ - (yet another) VCC list handling bug (fixed by Heikki Vatiainen) ++ - kernel also applied idle timeout to CLIP PVCs ++ - make clean didn't remove test/errnos.inc ++ - atmsigd errored as_connect and as_accept with as_close instead of as_error ++ - eni: bandwidth was sometimes reserved for UBR VCs ++ - eni: checking of bandwidth changes was broken ++ - eni: error handling after failed bw change checks destroyed the free list ++ - test/errnos.inc sometimes wasn't generated because of mtime granularity (fix ++ by Brian Armstrong and Corinne Rosier) ++ - fixed use of return code of get/put_user and copy_from/to_user ++ - kernel: fixed a few minor race conditions ++ - ATM_GETADDR left address list locked on fault ++ - maximum length of high layer information was 7 bytes instead of 8 for ISO ++ and User Specific high layer information (reported by Damian Gilmurray) ++ - some tools didn't include errno.h although they use errno or Exxx ++ - atmsigd usually accessed deallocated memory when writing traces, which ++ sometimes led to crashes (reported by Heikki Vatiainen) ++ - indentation of the first two lines of UNI signaling messages in traces was ++ missing ++ - LANE: duplicate data direct connections to entities where we already ++ have a connection are now forbidden. LES and BUS can now co-reside. ++ (Reported by Jean-Francois Moine, fixed by Heikki Vatiainen) ++ - LANE: plugged a file descriptor leak (by Heikki Vatiainen) ++ - atmsigd.conf.4 incorrectly stated that diagnostics must have a higher ++ priority than the specified level to get printed (they're also printed if ++ their priority is equal to that level) ++ - zatm driver didn't virt_to_bus the back pointer of TX rings, leading to ++ crash after sending the 32nd PDU of a VCC (reported by Ajay Bakre) ++ - zatm_feedback sometimes returned with interrupts disabled ++ - ENI driver didn't treat requests for UBR at link speed as "unlimited" and ++ allocated one shaper for each such VCC ++ - atm_async_release_vcc now has its own flag ATM_VF_CLOSE. Overloading ++ ATM_VF_RELEASED caused hung SVCs under some conditions. ++ - atmsigd sometimes released listening sockets before kernel completed its ++ cleanup, yielding warnings and zombies ++ - atmsigd accessed already deallocated data structures when handling ++ unparseable signaling messages ++ ++ ++New features ++------------ ++ ++ - upgraded to the 2.1.79 kernel ++ - CLIP now handles NETDEV_CHANGE (proposed by Pete Wyckoff; untested) ++ - various minor signaling changes for operation as switch control ++ - new device operation proc_read: device drivers can now register in /proc ++ (e.g. /proc/atm/eni:0) ++ - added some more BHLI definitions to include/atmsap.h, including draft ++ mapping of well-known TCP/UDP port numbers ++ - added support for TIOCOUTQ/TIOCINQ on native ATM ++ - new library function sap_equal ++ - added convenience function atmpvc_addr_in_use to linux/atm.h ++ - major overhaul of "isp", which is now a good tool for signaling regression ++ tests. See atm/test/README.isp ++ - LANE can now be compiled as a kernel module (by Heikki Vatiainen) ++ - new tool debug/svctor.c to torture signaling by setting up and releasing ++ lots of SVCs (see the source for details) ++ ++Other changes ++------------- ++ ++ - cleaned up the copying terms: libraries are now covered by LGPL instead of ++ GPL and qgen doesn't "taint" the code it generates ++ - atmarpd: IP addresses are now __u32 instead of unsigned long ++ - atmarpd: changed printf("... %08x ...",(unsigned long) ptr) to %p ...",ptr ++ - /proc support now allocates inode numbers dynamically ++ - added comment to clarify motivation for useless buffer alignment in aread.c ++ (reported by Jeon Jong Hwan) ++ - suni.c and uPD98402.c: SONET_GETSTATZ no longer clears the statistics if the ++ copy faults ++ - ilmid should now work on any interface (patch by Heikki Vatiainen) ++ - changed all __uNN of tools to uintNN_t for glibc2-compatibility ++ - added stdint.h to lib for compatibility with future versions of glibc2 ++ - various other evil hacks in tools to make things compile with glibc2 ++ - the NIC debugging programs ed, encopy, endump, zndump, and znth are no ++ longer built and installed by default ++ - for compatibility with POSIX 1003.1g, accept now returns ECONNABORTED ++ instead of ECONNREFUSED if connection is already gone (proposed by Heikki ++ Vatiainen) ++ - listening sockets now return instantly if the signaling demon dies ++ - various minor LANE updates to track API changes (by Heikki Vatiainen) ++ - SUNI now also warns if signal is missing at initialization time ++ - zatm: added work-around for unfair buffer space accounting ++ - clarified some of atmarpd's diagnostics ++ - documentation updates ++ ++ ++Version 0.32 to 0.33 (19-NOV-1997) ++==================== ++ ++Bug fixes ++--------- ++ ++ - SSCOP did poll sequence number comparisons in the (data) sequence number ++ space, typically leading to periodic SSCOP restarts (reported by Heikki ++ Vatiainen) ++ - atmsigd now releases calls on receipt of STATUS with call state 0 (reported ++ by Heikki Vatiainen) ++ - qgen tried to print the names of unnamed groups (fix by Simon Leinen) ++ - make clean in qgen left all the .c and .h files produced by qgen ++ - minor fixes to signaling message format description (qgen/msg.fmt, ++ previously qgen/uni*) ++ - /usr/include/atm.h was calling itself "atmlib" (found by Leena Chandran) ++ - atmsigd: the address format of the calling party number was used to ++ determine the format of the called party number in a SETUP message ++ - added some semicolons to Rules.make for bash 2.0 compatibility (by Tan Chang ++ Hu and Rolf Kunisch) ++ - select/poll indicated an exception when a non-blocking connect terminated. ++ Now it indicates writability, and an error only if the connect failed. ++ - LES/BUS can now co-exist at the same address (by Heikki Vatiainen) ++ - fixed race condition between asynchronous release (e.g. on ATMARP idle timer ++ expiration) and signaling demon response ++ - fixed a typo "[itf]." instead of "[itf.]" in atmsigd.conf.8 ++ - "ATM drivers" kernel configuration section is no longer a top-level menu ++ item but it's now under "Network devices" ++ - sigd_close forgot to purge VCs not connected to devices (e.g. closing ones), ++ so they hung ++ - the list of unconnected VCs was sometimes garbled ++ - atmsigd printed null string for as_itf_notify message name when debugging ++ - Arequipa: check_aq_vcc also accepted VCs that were already released by ++ signaling ++ - ATM_VF_PARTIAL and ATM_VF_BOUND had the same value ++ - atmaddr still used old calling convention of ATM_GETNAMES ++ - the atmarpd man page referred to atmarpd as "atmsigd" ++ - various atmtcp bug fixes ++ - atm_recvmsg sometimes returned with interrupts disabled (reported by Pete ++ Wyckoff) ++ - fixed ttcp_atm dependencies (.depend contains dependencies for "ttcp.o") ++ - UNI message format: "more" was missing for def_pck_size ++ - eni/suni didn't compile as modules (fixed by Pete Wyckoff and Ladislav ++ Lhotka) ++ - further net/atm/Makefile cleanup ++ - arequipa_close always left the socket with arequipa_expect enabled. Now it ++ returns it to the previous state. ++ - ENI driver was leaking buffer memory on failure of set_tx ++ - atmarpd didn't print symbolic names of "new" flags (ATF_ARPSRV, etc.) ++ - ATM ARP server didn't make client entries public (reported by Tom Mahieu) ++ - drivers/atm/Config.in had extra "endmenu" (fixed by Ladislav Lhotka) ++ - atmarpd got confused when receiving InARP reply without source ATM address ++ - atmsigd sometimes didn't stop timers if Q.2963.1 wasn't enabled ++ - when rejecting a call, the kernel freed the VCC twice ++ ++New features ++------------ ++ ++ - merged source tree (except Arequipa, single-copy, and various NIC drivers) ++ with 2.1.65-Linus tree ++ - qgen can now handle repeated information elements ++ - added ATM_SETESI[F] ioctl and esi utility (boards without a real ESI in ROM ++ should now set the default ESI to 0x000000000000) ++ - new socket option SO_ATMSAP along with struct atm_sap (using a fixed-size ++ BLLI array instead of the linked list in struct sockaddr_atmsvc) ++ - added Q.2963.1 PCR modification in signaling and the ENI driver ++ - aread: new option -c to print received data as characters (similar to od -c) ++ - new tool test/align to test handling of mis-alignment in NIC drivers ++ - atmsigd now supports policy restrictions for incoming/outgoing calls (see ++ atmsigd.conf.4, "policy") ++ - atmsigd can now also use a pair of named pipes (or, actually, any named ++ object in the file system) for communicating with the user of signaling ++ (normally the kernel) ++ - new tool called "isp" (for "Internal Signaling Protocol") to talk ISP with ++ atmsigd over named pipes ++ - new functions sap2text and text2sap to converts SAPs to/from textual ++ representation, and a sap(7) man page ++ - new traffic parameter field "pcr" to indicate the desired PCR. min_pcr and ++ max_pcr can the be used to indicate the acceptable range. ++ - new function atm_pcr_goal to help drivers to interpret traffic parameters ++ ++Other changes ++------------- ++ ++ - removed some more obsolete CLIP-related ioctls ++ - qgen: simplified generation of engines with a prefix other than "q" or "qd" ++ - ENI and ZATM drivers now use shareable interrupts ++ - cleaned up some 32bit-isms in ENI driver ++ - cleaned up several 32bit-isms in SSCOP (reported by Tan Chang Hu) ++ - SSCOP: work-arounds for buggy ntohl prototype in some early versions of ++ glibc (reported by Tan Chang Hu, further explored by David S. Miller and ++ Richard Henderson) ++ - started updating the ZATM driver for 2.1 (still crashes under load) ++ - added missing 2.1 pieces in ENI's SUNI driver ++ - added __initfunc and __initdata where appropriate ++ - tools tree now compiles under 0.31 (2.0.25 kernel) and 0.33 (2.1.55 kernel) ++ - gratuitous improvement of identifier tree allocation in qgen ++ - the interface number is now optional for sonetdiag (like for atmdiag) ++ - started implementing the kernel side of point-to-multipoint signaling ++ support ++ - /proc/atm/arp now displays "resolving" or "expired" (with the number of ++ times the entry is referenced) instead of "incomplete". ++ - moved ATM_MAX_BLLI from linux/atm.h to linux/atmsap.h ++ - changed ttcp_atm to use SO_ATMSAP (if available) to set BHLI ++ Note: ttcp_atm previously didn't use a BHLI, so old and new versions of ++ ttcp_atm don't interoperate. ++ - updated all other programs using SAPs too, except for LANE ++ - ENI: failure to allocate a traffic shaper now yields EBUSY instead of EAGAIN ++ - instead of just complaining, the ENI driver now handles all kinds of ++ mis-alignment in the TX path properly ++ - re-implemented send and receive side of Arequipa ++ - merged qgen/uni3x and qgen/uni40 into msg.fmt ++ - added missing Q.2931/UNI 4.0 items to qgen/q2931.h and msg.fmt ++ - also added BLLI L3 H.310 codepoint with related encodings ++ - various file name and identifier changes to give a more appropriate name ++ (e.g. "uni" or "call") to something that's never been Q.2931 ++ - added library dependencies ++ - atmsigd produces more readable and usually more comprehensive debugging ++ output ++ - atmsigd.conf.4 now mentions that -d is the debugging output addict's choice ++ - all programs accepting -l syslog now also accept -l stderr. (This is useful ++ for atmsigd if atmsigd.conf sets logging to something else.) ++ - atmsigd now issues ATM_GETADDR ioctls on the signaling socket, not on the ++ kernel socket ++ - WARNING: text2qos: "pcr" is no longer a synonym for "max_pcr" ! ++ - text2qos now refuses min_pcr=max ++ - device driver interface: removed vcc->peek; device drivers now choose their ++ own allocation strategy (change motivated by bug report from Furquan Ansari) ++ - drive driver interface: new helper functions atm_charge/atm_return to handle ++ buffer space allocation ++ - device driver interface: vcc->push no longer allocates buffer space. This is ++ now done by the driver, via atm_charge ++ - updated eni, zatm, and atmtcp to use the new mechanism ++ - zero padding in eni driver failed due to mis-alignment on some systems ++ (fixed by Pete Wyckoff) ++ - various compiler warnings removed (by Pete Wyckoff) ++ - removed support for pre-AREQUIPA_WORK mechanism ++ - arequipa close mechanism cleanup ++ - further cleaned up QOS parameter checking ++ - new ISP message as_identify for parallel call processing (not supported yet) ++ - zatm: renamed struct zatm_thist to struct zatm_t_hist after wondering ++ myself what on earth "this t" could be ... ++ - doc/Makefile now invokes dvips with -o ++ ++ ++Version 0.31 to 0.32 (10-JUL-1997) ++==================== ++ ++Bug fixes ++--------- ++ ++ - manipulation of local ATM addresses didn't check for permission ++ ++New features ++------------ ++ ++ - ilmid now supports the system group and a couple of ILMI MIB objects (by ++ Scott Shumate) ++ - device and VCC allocation is now dynamic ++ - E.164 addressing support and corrections to address coding in uni3x/uni40 ++ (by S. A. Wright, T. C. Jepsen, and Z. Zhang) ++ - support for device de-allocation via per-device operation dev_close ++ ++Other changes ++------------- ++ ++ - upgrade to kernel version 2.1.37 ++ - ENI driver cleanup (uses readl/writel, skb_put, etc.) ++ - socket option handling has changed: optval is now void * (to improve ++ compile-time type checking) and optlen is int (not int *) in getsockopt ++ - socket option "names" now encode the level and the size (based on an idea of ++ Elwyn Davies) ++ - cleaned up some of the #includes in net/atm/proc.c ++ - total rewrite of ATMTCP (now the data forwarding is done in user space, ++ which makes things slower but a lot more flexible) ++ - separated PDU parsing and printing from SSCOP state machine ++ - new per-device operation dev_close to shut down devices ++ - changed a few DIAG_WARNs to DIAG_INFO in ilmid ++ ++Removed features ++---------------- ++ ++ - polled ATM devices are no longer supported ++ - CLIP is gone (use ATMARP instead) ++ - Arequipa and LANE don't work yet (will come back later) ++ ++ ++Version 0.30 to 0.31 (22-APR-1997) ++==================== ++ ++Bug fixes ++--------- ++ ++ - atmarpd even refused IP address changes by the ATMARP server, which ++ typically led to the creation of one extra SVC ++ - ATMARP timeouts were computed at the wrong place (found by Gerald Hanusch) ++ - aqtest's usage didn't mention the -v option ++ - some tools used 0x%p instead of %p (which is fine in the kernel, by the way) ++ - skb_migrate didn't update skb->list ++ - zeppelin: incurred spurious core dumps on unsuccessful attempts to connect ++ to LANE servers, ESI parsing from command line seg faulted, obtaining ESI ++ from NIC left an ATM socket hanging, man page didn't describe all options ++ (by Marko Kiiskila and Heikki Vatiainen) ++ ++Other changes ++------------- ++ ++ - arequipa_close now only returns after the Arequipa connection has been ++ successfully closed. This allows applications to reliably close and ++ re-create Arequipa SVCs, e.g. to change the traffic parameters. ++ - the arequipad operations 3rd party close and synchronization are now handled ++ inside the kernel and survive arequipad restarts ++ ++ ++Version 0.29 to 0.30 (10-APR-1997) ++==================== ++ ++Bug fixes ++--------- ++ ++ - atmtcp didn't use vcc->push and therefore got the buffer usage accounting ++ wrong (fix by Gerald Hanusch) ++ - when closing a VC, the ENI driver didn't wait until all TX data has really ++ left the board, which created a close/open race (found by Richard Jones) ++ - SSCOP sometimes omitted the last element in a STAT PDU (fix - even with ++ optimization vs. Q.2110 - by Ngo Bach Long) ++ - atmarpd allowed ARP information to change permanent entries (found by Gerald ++ Hanusch) ++ - atmsigd's get_pvc used the maximum SDU size, thereby wasting buffer space ++ very quickly, which led to signaling problems (reported by Richard Jones and ++ Rik Wade) ++ - oops, the BUGS file was always one version number ahead ++ - ATMARP had a race between packets sent by the remote station and the ++ ATMARP_MKIP ioctl. This caused the dreaded "unknown hw protocol 0xaaaa" ++ error. (Finally fixed thanks to a dump provided by Patrick Flynn) ++ - Arequipa had the same race for AREQUIPA_INCOMING. This probably caused the ++ occasional "loss" (they were actually kept in vcc->recvq until the ++ connection was closed) of the first packet(s). ++ ++ ++Version 0.28 to 0.29 (4-APR-1997) ++==================== ++ ++Bug fixes ++--------- ++ ++ - saal/sscop.c: NORMALIZE macro was weird and broken (fix by Ngo Bach Long) ++ - InARP queries didn't contain the target ATM address, even if it is known, ++ which stretches the allowances RFC1577 makes for violating RFC1293 (found ++ by Juha Heinanen) ++ - tcp_conn_request: Arequipa modification to MTU size calculation used wrong ++ socket (fix by Gerald Hanusch) ++ - kernel ATMARP table handling had some obscure races ++ - temporary work-around: added A2T_LOCAL when using A2T_NAME in atmsigd and ++ atmarpd. Before, systems using ANS where the name server is reached via (IP ++ over) ATM exhibited truly bizarre failure patterns when refreshing ATMARP ++ entries. (With a lot of help from Juha Heinanen) ++ - ditto for arequipad, although the effects were less dramatic ++ - atmarpd: if not using -m, incoming connections for which a valid entry ++ already existed (e.g. due to manual configuration) were not entered in the ++ kernel ATMARP table until after the entry timed out for the first time (by ++ Gerald Hanusch) ++ - skb data areas are now aligned using skb_reserve instead of directly ++ tampering with skb->data (and forgetting skb->tail in the process ...) ++ (found by Uwe Dannowski) ++ ++New features ++------------ ++ ++ - atmarpd is now automatically notified of IP over ATM interfaces already ++ existing at startup. This greatly simplifies the atmarpd restart ritual. ++ (All ATMARP table entries and the default QoS are still lost, though.) ++ ++Other changes ++------------- ++ ++ - cleaned up some weird and partially dead code in arpd/arp.c (found by ++ Gerald Hanusch) ++ - removed superfluous continue in arp.c:atmarp_setentry ++ - device-driver specific declarations now reside in ++ /usr/include/linux/atm_<drv_name>.h, so that disgusting hacks like ++ #include "/usr/src/linux/..." can be avoided (based on proposal by Uwe ++ Dannowski) ++ - updated the list of supported NICs in README and the on-line help ++ - arpd/atmarpd.8: documented that atmarpd -m may violate RFC1577 in subtle ++ ways (pointed out by Gerald Hanusch) ++ - updated MPR usage description to version 1.5 and removed mpr.patch ++ - removed MEM_DEBUG from the build process (MPR 1.5 initializes itself ++ automatically) ++ ++ ++Version 0.27 to 0.28 (27-MAR-1997) ++==================== ++ ++Bug fixes ++--------- ++ ++ - atmarpd restarted timers on as_valid -> as_valid transitions, illegally ++ delayed necessary refreshes (reported by Juha Heinanen) ++ - SSCOP cleared POLL timer on IDLE timer expiry (fix by Ngo Bach Long) ++ - atmsigd didn't initialize "now" soon enough, causing an unnecessary ++ retransmission of the first BGN PDU (by Ngo Bach Long) ++ - atmsigd responded to RELEASE COMPLETE in ss_rel_ind with a STATUS instead of ++ entering ss_wait_close (by Steve Pope) ++ ++New features ++------------ ++ ++ - new tool aqpvc to declare incoming Arequipa traffic on a PVC to the system ++ (caveat: removing such a PVC can turn out to be surprisingly difficult) ++ ++Other changes ++------------- ++ ++ - removed some useless code in atmarpd's handling of VC disconnects ++ - removed unused signaling state ss_hold (equivalent to ss_wait_rel) ++ ++ ++Version 0.26 to 0.27 (11-MAR-1997) ++==================== ++ ++Bug fixes ++--------- ++ ++ - oops, forgot to include atm/lib/rtf2e164_cc.pl in the distribution ++ - atmsigd's VCI allocation in -N mode was too simplistic and failed after some ++ signaling activity (reported by Richard Jones) ++ - atm_connect was rejecting ATM_{VPI,VCI}_ANY ++ - aq_prev in the list of Arequipa connections wasn't set properly, leading to ++ random crashes when using Arequipa (found and fixed by Richard Jones, after ++ weeks of tearing his hair out) ++ - arequipa_close didn't remove the Arequipa route, which kept the upper layer ++ protocol connection alive for a rather long time (reported by Richard Jones) ++ ++New features ++------------ ++ ++ - ilmid enhancements: vastly improved retry mechanism, workaround for a bug in ++ the ATML Virata switch, -v option for very detailed debug output (Scott ++ Shumate) ++ - atmsigd now also accepts the signaling VC as a command line argument ++ - qos2text appended colon to traffic type even if nothing else followed ++ - new program debug/aqtest to test Arequipa (based on work by Mehdi Tazi) ++ ++Other changes ++------------- ++ ++ - added a few missing NULLs to struct atmdev_ops initialization in various ++ drivers (this change does not alter any semantics) ++ - changed printk ...%lx... (unsigned long) ptr to ...%p... ptr at many ++ places ++ - removed atm/lib/rtf2cc.pl and atm/lib/cc.inc (they were only used by an ++ interim version of cc_len) ++ - atmarp's usage no longer contains lines longer than 80 characters ++ - added get_logfile() and get_verbosity() to libatm (for ilmid, by Scott ++ Shumate) ++ - select() consumed CPU time unnecessarily if testing for one direction while ++ there's a lot of activity in the other direction (e.g. atmarpd wasted cycles ++ in select() for each outbound packet while waiting for ARP messages) ++ - the value of ATM_AAL0 has changed (from zero to 13), so all programs using ++ AAL0 need to be recompiled ++ - MAX_ATM_QOS_LEN has changed, so most programs using qos2text need to be ++ recompiled ++ - the AAL can now also be set along with the QoS parameters. This approach ++ should be used instead of specifying it in the socket() call. ++ - if no AAL is specified, the kernel now defaults to AAL5 (was AAL0) ++ - updated most demons, tools, and library functions to set the AAL along with ++ the QoS parameters ++ ++ ++Version 0.25 to 0.26 (29-JAN-1997) ++==================== ++ ++Bug fixes ++--------- ++ ++ - ATMARP VCCs could stay around forever even after timing out, because the ++ process was not woken up. ++ - the ATMARP "fix" in 0.25 introduced an infinite loop. Fixed that one too. ++ - bit 8 in octets 6 and 7 of BLLI ("ext") were set to 1 instead of 0 when ++ using ATM_L2_USER/ATM_L3_USER (reported by ukl2@rz.uni-karlsruhe.de) ++ - qlib added silly offset (which fortunately happened to be zero most of the ++ time) to dumps of large fields (fixed by Jean-Francois Moine) ++ - IP over ATM restricted MTU changes to valid Ethernet MTU sizes ++ - LANE: fixed two bugs that crashed zeppelin when the connection to the ++ servers failed (by Marko Kiiskila) ++ ++New features ++------------ ++ ++ - lib/ans.c now properly computes the length of the country prefix of E.164 ++ addresses for reverse lookups (needs file /etc/e164_cc, see USAGE) ++ - if the new -m option is set, atmarpd now merges incoming calls into the ++ ATMARP table if the ATM address is known (see atmarpd.8 for details) ++ - included an RPM spec file (this is still very experimental) ++ - NICStAR driver now also works with IP over ATM (by Stuart Daniel) ++ - usage.txt: added description of how to run ATM NICs back-to-back (by Richard ++ Jones) ++ ++Other changes ++------------- ++ ++ - signaling traces now also include SAAL up/down transitions ++ - qgen no longer (unnecessarily) depends on libatm.a ++ - started work on letting qgen handle items that appear at more than one ++ place, e.g. repeated IEs (after an idea by Jean-Francois Moine) ++ - did some cleanup and added comments to qlib.[ch] ++ - added -m option to atmarp in config/redhat-4.0/atm.init ++ - added new make target "filenames" to generate a list of all the files which ++ are installed ++ - config/redhat-4.0 now contains an example hosts.atm file and also a Makefile ++ for more convenient installation ++ - atmsigd now reads atmsigd.conf before parsing the command-line options, ++ thereby allowing values set in the file to be superseeded ++ - atmsigd now also logs the internal reference and the caller's address on ++ calls establishment ++ - ilmid: very dirty hack to give switches some time to process ILMI cold start ++ (by Joseph Evans) ++ ++ ++Version 0.24 to 0.25 (20-DEC-1996) ++==================== ++ ++Bug fixes ++--------- ++ ++ - net/atm/atmarp.c:idle_timer_check only expired every other entry (reported ++ by Marko Kiiskila) ++ ++New features ++------------ ++ ++ - LANE now also supports IPX (SNAP and 802.3; by Marko Kiiskila) ++ - NICStAR driver now supports VPI != 0 and has configurable settings in ++ nicstar.h (by Stuart Daniel) ++ ++Other changes ++------------- ++ ++ - ENI: TX DMA scratch are is now stored per device. This should allow multiple ++ NICs to coexist. ++ ++ ++Version 0.23 to 0.24 (29-NOV-1996) ++==================== ++ ++Bug fixes ++--------- ++ ++ - atm/test/window.c was missing in 0.23 ++ - atm/debug/delay didn't build unless atm/lib headers were already installed ++ in /usr/include ++ - atm/debug/znth had undefined return value ++ - SSCOP: fixed typo (that could probably kill the SSCOP connection in case of ++ a retransmission); fix by Olivier Bonaventure ++ - corrected unnecessarily large buffer allocation in zatm.c:pool_index (by ++ Jonathan Larmour) ++ - hosts2ans.pl generated reverse addresses for the domain "ATM.INT" instead of ++ "ATMA.INT" ++ - atmarpd "forgot" any pre-set QOS when receiving new ARP information for the ++ respective entry (reported by Gerald Hanusch) ++ - window scale didn't scale the window sent in the SYNACK packet (reported by ++ Juan-Antonio Ibanez) ++ - LANE: better connection failure handling in zeppelin (by Marko Kiiskila) ++ - LEC kernel timer wasn't restarted when restarting zeppelin (found by Gerald ++ Hanusch, fixed by Marko Kiiskila) ++ - LANE: le_flush_request was sent too early when establishing connection (by ++ Marko Kiiskila) ++ - zeppelin stopped operation (unwantedly) in random cases when LANE servers ++ were down (by Marko Kiiskila) ++ - LANE: non-blocking connections, VCC and LE ARP timeouts, and TLV fields in ++ LE_CONFIG_RESPONSE fixed (by Marko Kiiskila) ++ ++New features ++------------ ++ ++ - atm2text now also uses ANS ++ - signaling traces now also contain error reports from qgen ++ - added new build-time configuration option "CISCO" (in atm/Rules.make) to ++ work around a bug in Cisco's point-to-multipoint signaling ++ - included example configuration files for RedHat 4.0 (see ++ atm/config/redhat-4.0/README) ++ ++Other changes ++------------- ++ ++ - local variable "link" in atm/debug/delay.c:loop was shadowing "link" system ++ call ++ - cleaned up various Makefiles ++ - qgen: bytes left in qet_space are now more meaningful ++ - named (ANS) now also starts even if atmsigd is not running and retries to ++ create the ATM socket in 15 minute intervals until is succeeds (by Marko ++ Kiiskila) ++ - LANE: (too) short le_flush_responses (Cisco 7010, sw ??.??) are now handled ++ (by Marko Kiiskila) ++ ++ ++Version 0.22 to 0.23 (16-NOV-1996) ++==================== ++ ++Bug fixes ++--------- ++ ++ - fixed stupid typos in atm/lib/atmres.h and an unnecessary dependency on ++ libresolv.a in atm/lib/Makefile (reported by Gerald Hanusch) ++ - fixed warning about implicit declaration of function bigphysarea_init in ++ init/main.c ++ - I think I fixed the SSCOP VR(MR) problems that were first reported by ++ Edouard Lamboray in '95, then by Heinz Schuerch, and that finally led to a ++ total SSCOP breakdown (in 0.22) reported by Gerald Hanusch ++ ++New features ++------------ ++ ++ - integrated the IDT 77201 (NICStAR) driver by Matt Welsh and Stuart Daniel ++ <stuartd@eecs.umich.edu>. Note that this driver currently only supports ++ native ATM. ++ - new throughput and latency benchmark test/window (by Matt Welsh) ++ ++Other changes ++------------- ++ ++ - upgrade to kernel version 2.0.25 ++ - changed drivers/atm/eni.c:do_tx:dma to static in order to reduce kernel ++ stack use (by 480 bytes). Note that this hack may crash systems with more ++ than one ENI adapter. ++ - qlib now also complains if changing a field without a fixed list of values ++ - made a few changes to the native ATM data delivery path to handle some ++ strangeness required by the IDT driver ++ ++ ++Version 0.21 to 0.22 (13-NOV-1996) ++==================== ++ ++Bug fixes ++--------- ++ ++ - (dummy) depend target was missing in atm/man (reported by Bernd Wolf) ++ - net/atm/arequipa.c:make_aq_vcc didn't set ATM_VF_AQINUSE, thereby allowing ++ race conditions to slip through ++ - fixed a few potential race conditions when activating Arequipa ++ - text2qos didn't complain if unit was omitted after multiplier, allowing ++ misleading settings like pcr=50M (that's 19.2 Gbps) ++ - SSCOP: took wrong branch if POLL_AFTER_RETRANSMISSION was enabled (fix by ++ Jonathan Larmour) ++ - SSCOP: rel_ind for ENDAK and BGREJ PDU in sscop_inconn was sent with "user" ++ = 1 (must be 0 for "Source := SSCOP") ++ - initialize_vr_mr now initializes vr_mr to a constant value (instead of ++ garbage plus constant value) ++ - atm_recvmsg now ignores msg->msg_name, as it should by POSIX 1003.1g (fix by ++ Mike Wooten) ++ - atm_sendmsg now fails with EISCONN instead of with EINVAL if msg->msg_name ++ is set, as it should by POSIX 1003.1g (reported by Mike Wooten) ++ - atm_recvmsg and atm_sendmsg now return ENOTCONN if not connected and ++ EOPNOTSUP if flags are passed, as they should by POSIX 1003.1g ++ - the QOS zeppelin uses for its connections can now be set with the option -q ++ - atmarpd didn't include the QOS in PVC entries, so atmarp -a complained about ++ them ++ ++New features ++------------ ++ ++ - kernel changes to support tcpdump with LANE (by Marko Kiiskila) ++ - patch for tcpdump 3.0.4 (installed as tcpdump_atm) to support Classical IP ++ and LANE (by Marko Kiiskila) ++ - patch for BIND 4.9.5 to support ANS (ATM Name Service) functionality (by ++ Marko Kiiskila) ++ - added hierarchy extra/ for packages for which only patches are contained in ++ the ATM on Linux distribution ++ - enhanced text2atm to use ANS if local lookups fail (atm2text will be updated ++ later) ++ - wrote script extra/hosts2ans.pl to convert hosts.atm file to ANS zone files ++ ++Other changes ++------------- ++ ++ - changed ATM_VF_AQINUSE to ATM_VF_AQDANG and changed aq_list membership to ++ be for dangling VCs only ++ - added the new command-line options to ttcp_atm's online help (finally !) ++ - atm_sendmsg now returns error codes from the driver's send function ++ (suggested by Jonathan Larmour) ++ - text2qos now performs a syntax check if NULL is passed in the qos argument ++ - various minor LANE cleanup (Marko Kiiskila) ++ - upgraded to the latest version of t2a.pl ++ - {A2T,T2A}_REMOTE is obsolete; instead, {A2T,T2A}_LOCAL should be used if ++ ANS lookups are _not_ desired ++ ++ ++Version 0.20 to 0.21 (18-OCT-1996) ++==================== ++ ++Bug fixes ++--------- ++ ++ - net/atm/common.c:atm_connect didn't refuse traffic_class == ATM_NONE in both ++ directions ++ - include/linux/atmsvc.h:SELECT_TOP_PCR didn't default to ATM_MAX_PCR if ++ min_pcr == 0 && max_pcr == 0 ++ - debug/delay swallowed one-byte packets ++ - oops, forgot man/Makefile, so qos.7 wasn't installed ++ - atmarpd left max_sdu at zero for automatically generated entries ++ - atmarpd now only uses the default QOS if the traffic type is set in neither ++ direction ++ - signaling: if the listen queue was full, new connections were rejected with ++ as_close instead of as_reject, thereby upsetting atmsigd ++ - svc_accept didn't adjust the listen queue quota when rejecting incoming ++ connection requests ++ - fixed a few bad font selections in atmsigd(8) ++ ++New features ++------------ ++ ++ - included the window scale patch by Randy Scott <scottr@belle.bork.com> and ++ Robert Hill <rhill@tisl.ukans.edu> ++ - -q option for ilmid to set the QOS (like in atmsigd) ++ - new script mkbindist to install the utilities into a tar.gz file ++ ++Other changes ++------------- ++ ++ - debug/delay now prints the usage if invoked without arguments ++ - removed the pretentious usec resolution for delays in debug/delay ++ - removed the UBR semantics change warning ++ - qos.7: clarified that bps are the user data rate ++ - arequipa_attach_unchecked now also adjusts the upper layer MTU (which can ++ violate RFC1122, but I'll tackle that later) ++ - text2qos now also accepts fractional values, e.g. 9.6kbps ++ ++ ++Version 0.19 to 0.20 (14-OCT-1996) ++==================== ++ ++Bug fixes ++--------- ++ ++ - fixed a few typos and errors in the 0.18 to 0.19 change log ++ - signaling traces only included hl_type bytes instead of hl_length ++ bytes ++ - TNET1570 driver: various fixes (DMA allocation, seg ring overflow, ++ timeouts, etc.) (Christian Paetz) ++ - TNET1570 driver: removed most compiler warnings (Christian Paetz) ++ - listen() on an arequipa_preset() socket and arequipa_preset() on a listening ++ socket now both return EPROTO ++ - oops, forgot to enable the "rm" in make uninstall ++ - kernel didn't set interface number field in act_create messages to atmarpd ++ ++New features ++------------ ++ ++ - added ioctl ATM_SETSC to enable or disable RX and TX single-copy per VC ++ - new device driver operation change_qos (not yet implemented) ++ - TNET1570 driver supports DEC Alphas and 64 bit PCI transfer (for CIA PCI ++ chipsets) (Christian Paetz) ++ - TNET1570 driver also supports the UniNET1570 board (Christian Paetz) ++ - new functions text2qos and qos2text to convert between textual and binary ++ QOS specifications (the format is described in man qos) ++ - atmarp -q ip_addr qos sets the default QOS to use for all VCs created for ++ that IP interface ++ - new utility debug/delay to use machine as AAL5-level delay line ++ ++Other changes ++------------- ++ ++ - NLPIDs and vendor-specific application identifiers are now collected in ++ the new file /usr/include/atmsap.h ++ - SO_ATMQOS now attempts to change the QOS settings when invoked on an active ++ connection ++ - included Matt Welsh's bigphysarea patch (this isn't related to ATM, but it ++ keeps my development source tree simpler) ++ - arequipa_preset now initializes max_sdu to RFC1626_MTU+RFC1483LLC_LEN if ++ zero ++ - atmarp: new option qos <spec> to set the QOS parameters (uses text2qos) ++ Use of pcr <pcr> is deprecated. ++ - ttcp_atm's -P option now also accepts a QOS specification string. (use of ++ -P <number> is deprecated. ++ - atmsigd: new option -q <qos> and configuration clause io qos <qos> to ++ set the QOS of the signaling VC. Use of -P <pcr> or io pcr <pcr> is ++ deprecated. ++ - removed the backward compatibility #define class traffic_class in ++ linux/atm.h ++ - removed obsolete keywords from atmsigd.conf language ++ - atmarp -a now also includes QOS parameters ++ - UBR now respects txtp.max_pcr if set ++ - new rules for the use of [rt]xtp.traffic_class: both fields must be either ++ equal or zero, e.g. ATM_CBR in TX and ATM_UBR in RX no longer works ++ - doc/usage.tex now points to the man pages instead of repeating their content ++ ++ ++Version 0.18 to 0.19 (27-SEP-1996) ++==================== ++ ++Bug fixes ++--------- ++ ++ - sscop.c:data_sd had a comparison inversed, so generation of USTAT PDUs was ++ wrong in some cases (by Juhana Rasanen) ++ - sigd_enq: accessed vcc->qos without checking for vcc == NULL, causing an ++ "Oops" in atmaddr ++ - svc_accept: generated a general protection fault when atmsigd was killed ++ while a process was waiting for new incoming connections ++ - atmaddr didn't zero the address structure before calling text2atm ++ - LANE: fixed usage of kernel timers and LE_ARP_REQUESTs should now get sent ++ until the entry expires or a response is received (by Marko Kiiskila) ++ - less compiler warnings from LANE servers (Marko Kiiskila) ++ - SSCOP: fixed SDU size in AA-RETRIEVE.indication (reported by Heinz Schuerch) ++ - NULL encapsulation for ATMARP works now (reported by Gerald Hanusch) ++ - fixed stray EINVAL from get{sock,peer}name on PVCs (reported by Gerald ++ Hanusch) ++ - clip now sets max_sdu to RFC1626_MTU+RFC1483LLC_LEN when using LLC/SNAP ++ encapsulation ++ - if parsing of a Q.2931 message fails, atmsigd now aborts the call instead of ++ (stupidly) trying to process the incomplete and probably inconsistent data ++ - SUNI driver didn't properly mask out unused highest bits of some statistics ++ counters, thereby yielding absurdly high values ++ - zatm: changed timing of RX channel closing, so the dreaded "can't close RX ++ channel" message should be history ++ - fixed race between Arequipa attachment due to packet reception and closing ++ of the Arequipa VC ++ - local address validity check (for ATM_???ADDR) was all wrong (reported by ++ David Simpson) ++ - message dumper ignored fatal errors if debugging was not enabled ++ ++New features ++------------ ++ ++ - man pages for lecs, les, bus, and zeppelin (Marko Kiiskila) ++ - configuration file name for les and bus can be defined (Marko Kiiskila) ++ - zatm: new kernel configuration option CONFIG_ATM_ZATM_EXACT_TS now supports ++ reception timestamps with microsecond resolution (the accuracy is only in ++ the ms range, though) ++ - new utility znth (ZeitNet Timer History) to monitor timer synchronization ++ - LANE now supports up to 4 LEC network interfaces (Marko Kiiskila) ++ - the Q.2931 message parser now recovers nicely from IE errors, logs the ++ event, and continues parsing. The higher layers of the signaling stack ++ don't use this information yet, though. ++ ++Other changes ++------------- ++ ++ - Arequipa's BHLI now uses a "vendor-specific application identifier" under ++ the EPFL OUI ++ - moved buffer/queue handling from lib/libatmd to saal/, because it is rather ++ SSCOP-specific anyway ++ - atm_release_vcc now complains if rx_inuse != 0 when closing (if this ever ++ happens, it may point out dangerous races with upper layer protocols) ++ - SO_ATMQOS now issues a warning when using UBR with {min,max}_pcr != 0 ++ - max_sdu is now set by atmarpd to MTU+RFC1483LLC_LEN (atmarp could still ++ override this, if necessary) ++ - atmdump: new option -i to display the arrival interval instead of the ++ absolute time. Also changed the time format to be more readable. ++ - updated the kernel configuration documentation to indicate that the SMC ++ ATM Power155 adapters are compatible with the Efficient ENI-155 ++ - atmarpd now deletes the old table file (containing stale information) if ++ invoked with -d (debug) ++ ++ ++Version 0.17 to 0.18 (9-SEP-1996) ++==================== ++ ++Bug fixes ++--------- ++ ++ - atmsigd didn't respond to SETUP followed by RELEASE with a RELEASE COMPLETE ++ - atmsigd now implements incoming call rejection (as_indicate -> as_close) ++ - kernel now opens the VC before sending the as_accept. This a) allows to ++ check if the parameters are acceptable, and b) avoids a race condition ++ between the sender and the local VC open procedure, which frequently led to ++ loss of the beginning of the first PDU sent on a new connection. ++ - qdump: _q_parse used the wrong length when dumping variable-length fields, ++ yielding a fatal internal error ++ - clip didn't set rxtp.max_sdu ++ - svc_accept didn't set ATM_VF_HASQOS, so getsockopt SO_ATMQOS didn't work ++ (by Marko Kiiskila) ++ - ttcp_atm calculated Mbps as 2^20 bits/sec instead of 10^6, thereby making ++ all results come out approximately 5% too low (by Fraz Ahmad) ++ - added $(LDLIBS) to linking of lane/lecs (by Lawrence MacIntyre) ++ - interface number allocation in clip and atmarp did not check for collision ++ with the respective other name space ++ - atmarp's -c option didn't work when omitting the "atm" in the interface name ++ ++New features ++------------ ++ ++ - new man page: arequipad.8 ++ ++Other changes ++------------- ++ ++ - simplified the internal signaling protocol by adding the as_reject message ++ (sent by kernel in response to as_indicate; not acknowledged by demon) ++ - packets received from Arequipa are no longer forwarded to other hosts ++ - further ilmid improvements to use RSTADDR less frequently (by Gerald ++ Hanusch; with a slight modification) ++ ++ ++Version 0.16 to 0.17 (2-SEP-1996) ++==================== ++ ++Bug fixes ++--------- ++ ++ - lib/diag.c didn't fflush when logging to a file ++ - arequipad didn't accept the -l option ++ - qgen: possible weird crashes because second.c:find_required accessed ++ value->tag even if vt_id ++ - qgen: fixed wrong PC indication in one error message in _q_parse ++ - make spotless didn't know about new $(*PGMS) targets ++ - atmsigd: fixed memory leak when sending messages to the kernel ++ - atmarpd: fixed memory leak when sending messages to the network ++ - atmsigd: didn't send final as_close when kernel closed connection ++ immediately after requesting it (as_connect) ++ - several minor corrections ++ ++New features ++------------ ++ ++ - added make target "uninstall" to remove all files installed by ++ make install ++ - atmsigd has two new options: -D dump_dir to set the dump directory and ++ -t trace_length to set the length of the trace buffer ++ - wrote a few man pages: atmarp.8, atmarpd.8, atmsigd.8, atmsigd.conf.4 ++ - added automatic support for memory debugging if MPR is installed (and ++ included a patch to make MPR 1.1 work with ELF). atmarpd and atmsigd ++ currently use this feature. ++ ++Other changes ++------------- ++ ++ - changed "class" to "traffic_class" everywhere ++ - make install is now implemented in a more elegant way ++ - q.dump is now much better at finding symbolic names for numbers ++ - q.dump no longer prints zero-length fields ++ - qgen no longer includes constructor "microcode" in dumper ++ - atmarp now gives more informative error messages on ioctl failure ++ - removed obsolete ioctls SIOCGIFATMADDR and SIOCSIFATMADDR ++ - added hack to allow ilmid to be less hostile to locally configured addresses ++ (by Gerald Hanusch; with slight modifications) ++ - atmarpd now automatically sets ATF_PERM of PVC entries with NULL ++ encapsulation ++ ++ ++Version 0.15 to 0.16 (29-AUG-1996) ++==================== ++ ++Bug fixes ++--------- ++ ++ - fixed an "unterminated character constant" warning by CPP in qgen/uni3x ++ - atm/sigd/q2931.c always tried to read the Cause IE of RELEASE COMPLETE ++ messages even if it wasn't included ++ - LANE: fixed buffer allocation and VCC timeouts (Marko Kiiskila) ++ - LANE: when connecting directly to LES, name of the ELAN was not set ++ properly (discoverd by Gerald Hanusch; fixed by Marko Kiiskila) ++ - LANE, ATMARP, signaling: control sockets didn't account for messages sent ++ back from demons (fixed by Marko Kiiskila) ++ - permanent ATMARP entries for SVCs were ignored if no ATMARP server was ++ configured (reported by Gerald Hanusch) ++ - atmarp option "temp" mis-spelled as "term" (fixed by Gerald Hanusch) ++ - forgot to undo experimental rcvbuf/sndbuf change to unsigned long ++ - make modules didn't generate ATM modules ++ - atmtcp_attach_hook wasn't defined when compiling ATMTCP as a module ++ - ATM patch set dev->ip_atm to ether_arp in net/ppp.c and net/eql.c, so they ++ failed to work as modules ++ ++New features ++------------ ++ ++ - added LANE servers (LECS, LES, and BUS) by Marko Kiiskila ++ - Rules.make: new variable INSTROOT for easier cross-installation ++ - atmsigd: added option -P to set the maximum PCR used on the signaling VC ++ - atmarp: added option "pcr <value>" (proposed by Gerald Hanusch) ++ - added the usual -l <logfile> option to arequipad ++ ++Other changes ++------------- ++ ++ - upgrade to kernel version 2.0.14 ++ - SVCs can now be bound with any SEL value ++ - messages of size > quota can be sent if the send buffer is empty ++ - ilmid no longer empties the address list when refreshing the NSAP address ++ (by Gerald Hanusch) ++ - LANE client should now survive network reset (e.g. restart) gracefully ++ (Marko Kiiskila) ++ - LANE: major cleanup of zeppelin code (Marko Kiiskila) ++ - improved loadable module support for eni and zatm (i.e. loading works now) ++ - the message dumper can now be linked to programs that also use the ++ compilation/parsing functions ++ ++ ++Version 0.14 to 0.15 (31-JUL-1996) ++==================== ++ ++Bug fixes ++--------- ++ ++ - zatm: fixed traffic shaper settings for UBR (with a little help from Joern ++ Wohlrab) ++ - atmsigd compilation didn't use the same UNI version configuration as qgen ++ - field "class" in struct atm_traform broke compilation of ATM applications ++ written in C++, so it has been renamed to "traffic_class" (reported by ++ Furquan Ansari) ++ - AAL parameters IE wasn't included in CONNECT, which violated RFC1755 ++ (discovered by Robert Olsson) ++ - zatm: removed broken sanity check for in-sequence skb delivery on RX ++ - clip didn't have clip_open function, so SIOCSIFFLAGS on the interface failed ++ with ENODEV ++ - single-copy compiles again ++ - zatm: driver doesn't pretend any longer to support single-copy (but ++ single-copy will come back later) ++ - QOS IE was sent with the wrong coding standard when using UNI 3.1 (with help ++ from Fraz Ahmad) ++ - zatm: forgot to remove some debugging code (around ZATM_TUNE) ++ - qlib.c didn't zero the length array, leading to (rare) "not enough space" ++ errors from QMSG (actually, the "break" mechanism seems to be flaky - will ++ have to check) ++ - fixed Arequipa race condition when the upper layer protocol and signaling ++ decided to close the SVC at the same time ++ - alloc_tx used to return NULL in out of memory conditions, thereby possibly ++ hanging atm_sendmsg ++ ++New features ++------------ ++ ++ - ttcp_atm now also accepts names with -p ++ - (finally !) added send/receive buffer limits and cleaned up the use of ++ vcc->[rt]x_{inuse,quota} ++ - added mkdiff script for automatic generation of diffs ++ - Arequipa now works for PVCs too (but arequipad is now required for any ++ use of Arequipa, not only for incoming connections) ++ ++Other changes ++------------- ++ ++ - atm/atm-<version>.patch is now called atm/atm.patch (to make the diffs more ++ useful) ++ - the maximum SDU size is now checked in net/atm/common.c:adjust_tp ++ - text2atm/atm2text now accepts/generates E.164 addresses with a leading + ++ sign, as required by ANS (atm95-1532) ++ - internal signaling protocol: added message as_error to un-overload as_close ++ - internal signaling protocol: split as_establish into as_connect and ++ as_accept ++ - internal signaling prococol: as_close.reply no longer contains positive ++ numbers ++ - internal signaling prococol: as_bind now also carries the AAL type ++ - atmsigd: now also checks the AAL type in as_bind messages ++ - kernel signaling: a few minor changes ++ - STANDARDS (i.e. UNI version) configuration option has been moved from ++ atm/qgen/Makefile to atm/Rules.make ++ - atmsigd's startup message now gives more useful indication of which UNI ++ version(s) it supports ++ - signaling no longer uses sa[sp]_[rt]xtp, so ... ++ - sa[sp]_[rt]xtp is gone ++ - removed atm/sigd/svc.c from the distribution. We now have many other tools ++ for testing SVCs, so it's superfluous. ++ - atmarpd: revalidation is now less frequent (use -DFREQUENT_REVAL for ++ the faster timeout) ++ - ioctl CLIP_PVC now returns the number of the new interface and clip prints ++ its name to standard output (like atmarp -c) ++ - clip now issues the CLIP_PVC ioctl after binding, which avoids wasting ++ interface numbers on failed setup attempts ++ - atmsigd -d now sets the debug level for qgen and SSCOP to DIAG_INFO, and ++ doesn't set q_dump ++ - zatm: added protection against I > M ++ - atm_peek_aal5 now only aligns to page boundaries for pdu_size >= PAGE_SIZE ++ - eni driver now spits out CRC error messages at most every other second ++ - zatm driver now repeats RX error messages at most every other second ++ - ttcp_atm now sleeps for a second after setting up an SVC, because the ++ switch seems to lag behind (need to examine this further) ++ - moved SAAL from sigd/ to saal/ (for sharing with UNI 4.0 signaling) ++ - Arequipa sockets are now closed via arequipad instead of via atmsigd (new ++ ioctls AREQUIPA_CTRL and AREQUIPA_CLS3RD) ++ - various minor changes ++ ++ ++Version 0.13 to 0.14 (19-JUL-1996) ++==================== ++ ++Bug fixes ++--------- ++ ++ - LANE: reaction to LE_ARP_RESPONSE's wasn't always correct ++ - LANE: compiler warnings fixed ++ - LANE: comparing ATM addresses in checking whether connection is formed was ++ wrong ++ - zntune didn't divide by 1024 when displaying the "k" ++ - .depend wasn't deleted by make spotless ++ - ATM_GETSTAT and ATM_GETSTATZ used wrong argument type for coding ioctl ++ number. WARNING: programs using ATM_GETSTAT{,Z} need to be recompiled. ++ - requests to set up SVCs with ATM_NONE in both directions are now caught by ++ svc_connect (used to yield an invalid SETUP message) ++ - signaling: fixed connection identifier setting when acting as network side ++ (fix by Elwyn B Davies) ++ - ATMARP server ARP entries were undeletable ++ - atmarp showed wrong argument in error message when given an invalid ATM ++ address ++ - zatm: do_tx left interrupts turned off when returning with RING_BUSY ++ - LANE ARP hash table handling bugs fixed ++ - atmarp: act_create is now only sent on interface creation ++ - atmarp: act_down is now only sent once per transition ++ - demon control SVCs are no longer closed when atmsigd dies (new VCC flag ++ ATM_VF_META) ++ - netdevice notifier is now properly unregistered when atmarpd goes down ++ (not doing so caused endless loop in kernel on atmarpd restart) ++ - sigd_enq{_atomic} never calls schedule() ++ - atmsigd no longer "forgets" to bring up ARP server SVC before sending an ++ InARP ++ - atmarpd no longer dies with "timer in state 3" when the ARP server becomes ++ unreachable ++ - atm/atmarp.c: clip_create() now refuses creation of already existing ++ interface ++ - Documentation/Configure.help gave an obsolete URL for CONFIG_AREQUIPA ++ and doc/usage.tex also mentioned the old file name ++ - Arequipa didn't work in the outbound direction for TCP, because ++ net/ipv4/tcp.c was missing in the kernel patch ++ - drivers/atm/eni.c:foo raced with initialization of eni_boards if the ++ board lost the signal _immediately_ after being initialized ++ - atmarpd: fixed a few uninitialized entry->timer pointers (discovered by ++ Gerald Hanusch) ++ - atmarpd: arps entry should no longer get stuck in as_resolv ++ ++New features ++------------ ++ ++ - compiles on SparcLinux too (but only atmtcp works) ++ ++Other changes ++------------- ++ ++ - upgrade to kernel version 2.0.0 ++ - BHLI matching changed: SAPs without BHLI are now incompatible with calls ++ that specify a BHLI ++ - LANE: interface stays up when zeppelin dies -> possibility for ++ wrapper script around zeppelin ++ - LANE: LUNI interoperability test (ATM Forum/96-0805) is now followed ++ in setting ELAN name in LE_CONFIG_RESPONSE and LE_JOIN_RESPONSE, ++ there is also a delay of 1 second before sending LE_CONFIG_REQUEST and ++ LE_JOIN_REQUEST. This allows 'slow' LE servers to catch up. ++ - LANE: no longer uses sa[sp]_[rt]xtp ++ - LANE: now adjusts better to ATM address changes ++ - zeppelin: new option -m to select debugging output ++ - updated aping, aread, awrite, br, bw, atmdump, ilmid, atmarp, clip, atmarpd, ++ and zeppelin to use setsockopt SO_ATMQOS ++ - added option -x for ilmid to disable variable bindings (caused ++ interoperability problems with certain switches, e.g. the LS100) ++ - changed SO_CIRANGE into a pair of ioctls ++ - changed return value of fetch() (passed to atm_vcc->peek) from unsigned long ++ to __u32 ++ - atmarp now accepts arpsrv option also for -d ++ - zatm driver can now also read ESIs of rev. 10 boards (with help from Nikos ++ Anerousis) ++ - awrite: fixed txtp.max_sdu calculation in awrite (was using uninitialized ++ variable "offset") ++ - atmarpd: IP interface removal now has the desired effect (used to do ++ nothing) ++ - atmarpd: now reports and ignores unexpected interface transitions ++ - added sigd_enq_atomic for atomic sigd_enq (so that non-Arequipa SVCs can ++ still use the "safe" but non-atomic version) ++ - made SIOCGIF* failures in atmarpd non-fatal (itf.c:itf_up was handling them ++ anyway) ++ - moved Arequipa-specific code from net/atm/clip.c to net/atm/arequipa.c, and ++ put code common to CLIP, Arequipa, and - to a lesser extent - ATMARP into ++ net/atm/ipcommon.[ch] ++ - Arequipa can now be complied without CLIP ++ - various minor documentation changes ++ - moved ATM device initialization from net/atm/pvc.c to drivers/block/genhd.c, ++ where most other devices are initialized too ++ - preparation for new binary locations: tools build process now knows about ++ four types of programs: for booting, for system use, for users, and for ++ internal use during build ++ - make install now hides the for loops ++ - non-user binaries are now installed in /usr/local/sbin ++ - struct atm_iobuf.buffer is now of type void * (was int*). Also, ++ ATM_GETNAMES now returns the length in bytes in that field. ++ ++ ++Version 0.12 to 0.13 (7-JUN-1996) ++==================== ++ ++Bug fixes ++--------- ++ ++ - BHLI type used the ATM_HL_* values (which are off by one) in qgen/uni3x ++ - atmarpd ended up in a tight select-accept loop if atmsigd went away ++ - removed sleep in ZATM's do_tx (so it works with IP over ATM again) ++ ++New features ++------------ ++ ++ - added experimental support for Application requested IP over ATM (Arequipa), ++ prototyped by Jean-Michel Pittet ++ - new traffic class ATM_ANYCLASS to accept incoming SVCs without looking at ++ the traffic parameters ++ - added (untested) support for SO_BCTXOPT/SO_BCRXOPT ++ ++Other changes ++------------- ++ ++ - SVCs used to listen are now marked as "LISTEN" in /proc/atm/svc ++ - added option -Q <atm_addr> to ttcp_atm to support AREQUIPA ++ - cleaned up the FILE macro and removed atm_dir in net/atm/proc.c ++ ++ ++Version 0.11 to 0.12 (3-JUN-1996) ++==================== ++ ++Bug fixes ++--------- ++ ++ - atm/lib/Makefile: had to comment out PGMS=test ++ - distribution didn't include atm/doc/usage.txt ++ - patch didn't include arch/i386/config.in ++ - return 0; was missing at the end of net/atm/mmuio.c:mmu_step ++ - atm/ilmid didn't install into INSTBIN; also made some other Makefile ++ changes ++ - read() returned garbage instead of error when network drops connections ++ - POLL_AFTER_RETRANSMISSION in SSCOP didn't even compile ++ - SVCs: bind to wildcard addresses should now work even if no local address ++ is known yet ++ - make clean in atm/qgen left some dirt ++ - ATM drivers didn't free skbs when detecting an error in TX direction ++ - SIOCMKCLIP was in the wrong #ifdef, so CLIP had to be enabled to make ++ ATMARP usable ++ - signaling didn't respond properly to messages with non-existent call ++ reference ++ ++New features ++------------ ++ ++ - merged in LAN Emulation client support written by Marko Kiiskila ++ - new socket option SO_ATMQOS at SOL_ATM to set/get QOS parameters ++ ++Other changes ++------------- ++ ++ - t2a.pl now also works with Perl 5.001 ++ - changed the TX side of the ZATM driver to use a ring instead of a list in ++ order to improve stability and throughput (needs some more testing) ++ ++ ++Version 0.10 to 0.11 (21-MAY-1996) ++==================== ++ ++Bug fixes ++--------- ++ ++ - README.DRIVERS still referenced INSTALL (it's now in USAGE) ++ - sap_decode didn't clear BLLI part of address structure ++ - trying to connect to NULL address fails locally instead of yielding an ++ invalid SETUP message ++ - bind now properly sets the local address ++ - SVC getname now returns the traffic parameters ++ - oops, zatm open_tx didn't return PCR ++ - awrite printed errors for connect() as "bind: ..." ++ - atmsigd no longer generates dummy call references (0x7fffff) ++ - atmtcp: changed a few kfree_skb to dev_kfree_skb, which should make it ++ work better (does anybody care to try ?) ++ - some more dev_kfree_skb fixed for control messages from or to demons (led ++ to some minor memory leaks) ++ - various major fixes for CBR SVCs ++ - RELEASE was signaled for SVCs before all data was sent ++ - single copy tried to access mem_map with user space addresses, leading to ++ crashes or worse ++ - zatm: sleep_on was racing with TX completion in close_tx, leading to hangs ++ - zatm: now fails attempts to open AAL0 VCs (used to accept them and to ++ crash later) ++ - BHLI encoding/decoding was broken in several ways ++ ++New features ++------------ ++ ++ - hacked in primitive leaf-only p2m support (based on an idea by Marko ++ Kiiskil{) ++ - the socket layer, and the zatm, eni, and atmtcp drivers now support ++ two-phase connect ++ - PVCs now respect max_pcr (SVCs can't for now) ++ - lib/diag.c can now also log to a file or to syslog, and atmarpd, atmsigd, ++ and ilmid now have a -l option to use that ++ - new option -c config_file for atmsigd ++ - zatm and atmtcp now also support timestamps (but zatm timestamps can be ++ improved a lot by using the timestamps the uPD98401 generates) ++ - Classical IP over ATM support is now configurable ++ - added on-line help texts for configuration ++ - added atm/test/aping, a round-trip tester for PVCs ++ - added "flags" field to struct atm_dev and to atm_dev_register, on request ++ by Bureau 13 ++ ++Other changes ++------------- ++ ++ - past versions of the BUGS list aren't included in the distribution anymore ++ because I didn't update them anyway ++ - invalid connect() calls now return an error instead of panicing atmsigd ++ - text2atm no longer clobbers sas_addr.{blli,bhli} ++ - greatly simplified zatm traffic shaper settings calculation (and it's ++ better than before too) ++ - atmsigd: diagnostics class "sig" (in atmsigd.conf) now also includes "SAP" ++ - DPRINTK now uses GNU-specific #define foo(bar...) ++ - signaling: PCR is now also indicated (0) for directions in which ATM_NONE ++ is requested, which is probably "cleaner" (for CBR) ++ - added logging priorities to most printks ++ - the default location for atmsigd.conf changed from . to /etc ++ - ipv4/af_inet.c: atmtcp_attach_hook is now only included when using ATM over ++ TCP ++ - configuration options for extended driver debugging, (old) CLIP, and ++ ATM over TCP are turned off by default ++ ++ ++Version 0.9 to 0.10 (21-MAR-1996) ++=================== ++ ++Bug fixes ++--------- ++ ++ - zatm: deallocated UBR shaper when closing UBR VC, which the other UBR VCs ++ didn't really appreciate ++ - fixed nasty memory leak for native ATM (spotted by Rolf Fiedler) ++ ++New features ++------------ ++ ++ - added Rolf Fiedler's driver for his adapter based on the TI TNETA1570 ++ - single-copy is back again ! ++ ++Other changes ++------------- ++ ++ - eni buffers are now slightly (50%) bigger, allowing for more effective ++ overlapped operations ++ - documented zntune ++ ++ ++Version 0.8 to 0.9 (14-MAR-1996) ++================== ++ ++Bug fixes ++--------- ++ ++ - oops, accidently removed ZN1221 from drivers/pci/pci.c (so /proc/pci ++ reported it as "unknown") ++ - sigd didn't poll for the default interface on startup ++ - atmarpd didn't initialize timer field in newly allocated table entries, ++ which led to crashes ++ - removed a few stray debugging printks in net/atm/svc.c:svc_bind ++ - ATMARP tried to send queued packet before adding new table entry, so the ++ packet was always discarded ++ - sigd/sap.c: didn't allow to use different traffic classes for fwd and bwd ++ direction ++ - atm2text accepted SVC addresses of all zeroes ++ - atmsigd didn't refresh its local address list properly after ilmid restart ++ - net/atm/common.c: returned positive error codes (-vcc->reply) instead of ++ negative ones ++ - forgot to include maint/zntune.c in the distribution ++ ++New features ++------------ ++ ++ - sigd/svc now accepts ATM addresses in all formats supported by text2atm ++ ++Other changes ++------------- ++ ++ - upgraded to kernel version 1.3.73 ++ - the called party number must now match the local address (if bound) ++ - renamed ttcp.atm to ttcp_atm ++ - all executables are now explicitly linked (so make works even without ++ dependencies) ++ ++ ++Version 0.7 to 0.8 (12-MAR-1996) ++================== ++ ++Bug fixes ++--------- ++ ++ - fixed stray segmentation violation in arpd/arp.c:learn ++ - fixed coding standard of the QoS IE if using UNI 3.0 (and made coding ++ standard variable) ++ - made coding standard variable for Cause IE ++ - SSCOP didn't properly set N(MR) ++ - list elements in STAT PDUs had host byte order ++ - SSCF didn't call sscop_estab_resp on restart (AA-EST.ind in 1/1) ++ - signaling didn't handle SAPs with >= 2 BLLI IEs properly ++ - uni3x: iso_hli and user_hli were confined to 7 bytes, but UNI allows up to 8 ++ - q_read choked on non-variable-length fields ++ - qgen sometimes didn't read all IEs of a signaling message ++ - fixed usage line of test/bw ++ - qgen no longer complains about missing required fields after a break ++ - fixed compiler warning in zntune.c ++ - fixed ATMARP table additions (caused GPF when flushing ATMARP entry at ++ the end of the table and possibly other problems) ++ - qgen: q_put or'ed data instead of overwriting it, which caused problems ++ only on surprisingly few occasions ++ ++New features ++------------ ++ ++ - atm2text and text2atm now also do name lookups via a /etc/hosts.atm file ++ - atmaddr, atmarpd, and atmsigd now pretty-print addresses using name ++ translation (unless invoked with -n) ++ - atmarpd now dumps its table into /var/run/atmarpd.table and atmarp -a ++ reads it from there ++ - started modularizing the ENI and ZATM drivers ++ - ilmid and atmsigd now support multiple interfaces (untested) ++ ++Other changes ++------------- ++ ++ - the documentation is now available in LaTeX and in ASCII ++ - rewrote most of the SAP handling code (now everything is in sigd/sap.c) ++ - proto.c:lookup_sap now picks wildcard SAP last ++ - signaling always includes SSCS type = 0 in SETUP messages (for LANE) ++ - changed the message format for the the kernel-demon signaling protocol ++ - qgen is now a bit more tolerant when being fed with bad data ++ - qgen now assumes that q_report(Q_FATAL,...) doesn't return ++ - marked sigd/test.c as obsolete ++ - svc_accept failing in atm_connect no longer returns success ++ - atmsigd -n is now atmsigd -N ++ - qgen now puts the PC in q.out.c and qd.out.c at the beginning of the code ++ line and not on a line by itself ++ ++ ++Version 0.6 to 0.7 (2-FEB-1996) ++================== ++ ++Bug fixes ++--------- ++ ++ - removed TTL setting ioctl (1234) used for something entirely unrelated to ++ ATM, oops ++ - changed kfree_skb in atm_pop_raw to dev_kfree_skb (this fixes the socket ++ "leak") ++ - more unusual configurations (no PCI, no IP, no /proc) should compile now ++ - atm_equal didn't recognize wildcards in embedded E.164 addresses ++ - fixed net/atm/proc.c:svc_addr (too many bugs to mention) ++ - atmarpd didn't check for ARP traffic on inbound connections ++ - atmarpd didn't properly merge incoming connections with existing entries ++ - various other ATMARP fixes ++ - free list was too short in ENI driver for worst case fragmentation on ++ 2 MB boards ++ - signaling didn't set ISO/IEC TR9577 IPI and NLPID correctly in active open ++ - getname looked at *sockaddr_len, which is uninitialized (need to fix this ++ later in the common socket code) ++ - SSCOP generated incorrect error code ("1" instead of "B") for BGN PDU ++ problems ++ ++New features ++------------ ++ ++ - new ioctls ATM_GETADDR, ATM_RSTADDR, ATM_ADDADDR, and ATM_DELADDR to ++ manage local ATM addresses ++ - signaling now handles incoming RESTART, SAAL failure, and SAAL ++ re-establishment ++ - ATMARP now times out idle connection; ATMARP_MKIP ioctl takes a timeout ++ argument ++ - ATMARP (kernel) now queues one skb per pending ARP request and limits the ++ rate of requests for the same address (default 2 req/min) ++ - atmsigd now prints cause values when receiving a RELEASE or a RELEASE ++ COMPLETE and returns more informative error codes ++ - atmarpd falls back to PVC-only operation if signaling is unavailable at ++ startup ++ - kernel can now assign next free number on IP interface creation (atmarp ++ prints the interface name) ++ - qgen -D generates a Q.2931 message dumper (see USAGE for details) ++ - qgen now checks for proper use of repetition indicator (but doesn't ++ support repeated IEs yet) ++ - protocols and device drivers can now use their own memory allocator in the ++ TX direction by changing vcc->alloc_tx ++ ++Other changes ++------------- ++ ++ - upgraded to kernel version 1.3.53 ++ - build process now uses Perl ++ - ATM ioctls writing back data now always return the size of the data ++ structure written ++ - struct atmif_sioc now has a length field (recompile all atmarpd, ilmid, ++ debug/ed, and everything in maint) ++ - PHY driver no longer has to check validity (permissions and access) for ++ "standard" ioctls ++ - signaling should now also work on an interface > 0 (but there's still only ++ one interface using signaling per host) ++ - make install now adds /usr/include/atm.h and /usr/include/atmd.h ++ - atmarpd now also displays if SVC has been opened actively or passively ++ - atmaddr(8) now uses new ioctls and has different command-line syntax ++ and even has a man page ++ - example IP addresses in USAGE now conform to RFC1597 ++ - diagnostics now also include the application name (optional) ++ ++ ++Version 0.5 to 0.6 (21-DEC-1995) ++================== ++ ++Bug fixes ++--------- ++ ++ - ARP ioctls stopped working for most non-ATM devices, oops ++ - ATMTCP driver counted lack of memory as rx_err instead of rx_drop ++ - select on driver using polling may have hung ++ - atmarp man page and usage didn't indicate that the interface number is ++ optional ++ - restricted atmarpd and signaling control, and SIOCSIFATMADDR to the super ++ user ++ - atmtcp: fixed handling of VPI/VCI <= 0 for setsockopt(SO_CIRANGE) ++ - eni and zn driver had static UBR shaper pointer, making it difficult to have ++ more than one such device per system ++ - eni driver initialization didn't work properly in systems with ASIC Tonga ++ - suni.[ch]: confused MC (Master Config) and MCT (Master ConTrol) registers ++ - (SVC) accept now returns PVC -EAGAIN as -EBUSY because the operation cannot ++ be retried ++ - qgen: fixed several bugs in case handling (and made defaults work for ++ parsing) ++ - svc_dup passed PF_ATMSVC instead of AAL to svc_create ++ - plugged a few skb leaks in svc_accept ++ - text2atm didn't properly NUL-terminate E.164 addresses ++ ++New features ++------------ ++ ++ - ZN1221 driver works partially for AAL5 (still hangs after a few dozen MB) ++ (also wrote maint/zntune to monitor/adjust free buffer pools) ++ - ENI driver now supports new Tonga ASIC boards ++ - added Scott Shumate's ILMI demon (for automatic address registration) ++ - text2atm: added wildcard support for SVCs (syntax: addr/bits) ++ - new library function atm_equal to compare SVC addresses ++ - new ioctl ATM_GETTYPE to obtain interface type name ++ - new ioctl ATM_GETESI to obtain ESI (parallels /proc/atm/devices) ++ - new ioctls SONET_SETFRAMING, SONET_GETFRAMING, and SONET_GETFRSENSE to ++ handle SONET vs. SDH framing ++ - added socket option SO_AALTYPE (SOL_AAL) to query AAL type (getsockopt ++ only) ++ - signaling demon is now notified on address changes (new message ++ as_itf_notify) ++ ++Other changes ++------------- ++ ++ - known bugs are now listed in a file called BUGS ++ - all utility programs (aread, awrite, atmdump, br, bw, clip, ttcp) now use ++ the notation [itf.]vpi.vci for PVCs (was itf vpi vci , except for ttcp, ++ where it was only vpi vci (no itf)) ++ - all ioctl values have changed ++ Note: most programs have to be recompiled because of this ++ - sigd and arpd now register their control sockets via ioctls ++ - (old) clip now creates interfaces with an ioctl ++ - text2atm now returns the wildcard length, i.e. a non-zero return value ++ no longer implies failure ++ - push_oam now returns an int (was void) ++ - push_oam now has several flags (in a bit set) instead of the immed ++ argument ++ - the peek function must now update the statistics if it rejects a packet ++ - (ATM device) close is now only invoked after a successful open ++ - the SUNI_GETLOOP ioctl now has an int * argument (was unsigned long *) ++ - uPD98402 driver no longer tries to detect return of the signal (didn't ++ work anyway - would have to sample section errors) ++ - ATMARP no longer supports mixed PVC/SVC entries (I'm sure this will be ++ missed a lot :-) ++ - ATMARP no longer supports "IP address discovery" via InARP for PVCs ++ (maybe later) ++ - specifying an invalid AAL now yields EPROTOTYPE ++ - specifying an invalid address family (connect, bind) now yields EAFNOSUPPORT ++ - make install now also installs libraries (in /usr/lib) ++ - improved many header file comments ++ - re-arranged some comments to simplify automated document generation ++ - added copyright statement ++ - UNI 3.0 IE fields are now always recognized (but we shouldn't generate them) ++ - UNI 3.0 wants octet 5a when using BCOB-X, so we'll set it to twice "No ++ indication" ++ - aread, awrite, br, bw, ttcp, atmsigd, and atmdump now set max_sdu ++ - aread and awrite no longer print strerror(errno) on success ++ ++ ++Version 0.4 to 0.5 (26-OCT-1995) ++================== ++ ++Bug fixes ++--------- ++ ++ - now only root can open a CLIP socket (thereby creating an IP interface) ++ - now only root can issue CLIP_NULENCAP and CLIP_LLCENCAP ioctls ++ - atmdump: forgot default in getopt switch ++ - eni driver: called misc_int on every interrupt ++ - Q.2931 message description: various fixes and improvements ++ - linux/atm.h: ATM_*_UNSPEC used the same value as ATM_*_ANY, oops ! ++ - SSCOP is now more careful about not accessing the descriptor if it might ++ possibly have been deleted ++ - typo in SSCF leading to wrong response to AA-RECOVER.indication ++ - SSCOP now correctly copies N(PS) from POLL to STAT PDUs ++ - SSCF now discards data when not ready instead of issuing a fatal error ++ - AAL initialization failure no longer leaks memory ++ - closing an SVC without VCC no longer yields a GPF ++ ++New features ++------------ ++ ++ - ZN1221 driver is starting to work ++ - new, ARP-based mechanism for IP over ATM (with atmarpd, atmarp, etc.) ++ - /proc/atm/pvc now displays more information for CLIP PVCs (after a patch ++ by Raghavan Menon) ++ - added max_pcr to struct atm_trafprm (also fixed a few comments in atm.h) ++ Note: all programs using sockaddr_atm* will have to be recompiled. ++ - qgen now handles value lists in named selections ++ - signaling now supports bhli/blli, plus various other minor extensions ++ - new ioctls to set/get local ATM address ++ - added library with address to/from text conversion functions ++ - finally implemented getname() ++ ++Other changes ++------------- ++ ++ - eni driver: avoided potential generation of superfluous code if extended ++ debugging is disabled ++ - eni driver: detects new boards using ASIC PCI chip (doesn't support them ++ yet, though) ++ - qgen: semicolon is now comment character and no longer used to terminate ++ clauses ++ - qgen: replaced term "item" with "field" ++ - linux/include/atmsap.h: removed obsolete comment "protocol cannot be fully ++ encoded in current structure". Also re-arranged some comments to simplify ++ automated document generation. ++ - saal,sscf,sscop: callbacks don't pass the pointer to the descriptor of the ++ calling protocol anymore ++ - SSCOP no longer prints a number for non-'V' errors ++ - improved handling of STATUS messages ++ - select now indicates ready for writing if max_sdu packet can be enqueued ++ without blocking ++ - select can now also be used to check status of non-blocking connect ++ - moved some common demon functions from sigd into a common demon library ++ ++ ++Version 0.3 to 0.4 (27-SEP-1995) ++================== ++ ++Bug fixes ++--------- ++ ++ - various minor documentation fixes ++ - clip.c:atm_push_clip now updates statistics before forwarding the skb to ++ the upper layer (which may free and overwrite the skb) ++ ++New features ++------------ ++ ++ - added partial UNI 3.x signaling ++ - added various adapter debugging programs to the distribution ++ - new config option CONFIG_ATM_ENI_DEBUG to enable extended debugging ++ in eni driver ++ ++Other changes ++------------- ++ ++ - upgraded to kernel version 1.3.24 ++ - changed the distribution directory structure (programs are now in maint/, ++ test/, ip/, debug/, and sigd/, see INSTALL) ++ - ATM interfaces are no longer named, only numbered. This affects the ++ ATM_GETNAMES ioctl, all ioctls using struct atmif_sioc, the usage of atmdiag ++ and sonetdiag, and various diagnostic kernel messages. ++ - ATM socket state is now recorded in field "flags" (this also replaces the ++ SVC fields "released", "registered", and "state") ++ - added #ifdef __KERNEL__ to some header files ++ - added "int immed" argument to send_oam ++ - some minor modifications to the distribution process (mkdist) ++ - removed devmap.c ++ - SVC sockets no longer hang if the signaling demon dies ++ ++ ++Version 0.2 to 0.3 (8-SEP-1995) ++================== ++ ++Bug fixes ++--------- ++ ++ - select(2) didn't work (was sleeping on sock->wait instead of ++ &ATM_SD(sock)->sleep) ++ - ENI driver did allow binding to VPI/VCI already in use ++ - ENI driver now properly handles PDUs with CRC errors ++ - ENI driver had race condition when discarding PDUs causing new PDUs to be ++ shifted in adapter memory by one word (which confused the driver quite a ++ bit) ++ - ENI driver now enables VC _after_ setting all pointers (caused crashes if ++ data was already coming in while opening VC) ++ - various bugs fixes related to SVC sockets ++ - fixed GPF (in kernel) when running atmdiag without arguments ++ - atmdiag now left-adjusts interface names ++ - fixed ttcp.atm crash when not specifying vpi.vci ++ - clip_xmit now checks for NULL vcc (e.g. after failure to connect) ++ ++New features ++------------ ++ ++ - zatm driver now reads ESI correctly ++ - blocking svc_connect is now interruptible ++ - atmdump now also displays the numeric PTI value of incoming cells ++ - added RX/TX buffer quotas (default is 64 kB) ++ - added OAM hooks to device driver interface (but there's no OAM support yet) ++ ++Other changes ++------------- ++ ++ - ENI driver now checks ID field of reassembly buffer descriptors ++ - ENI driver now uses vremap ++ - ENI driver now prints more useful physical layer type information (e.g. ++ "MMF" and "UTP" instead of "UTOPIA") ++ - some redesign of the protocol used for signaling between kernel and demon ++ - disabled "Grr, servicing VCC twice" message in ENI driver ++ - device drivers now have to adapt AAL0 cell header byte order ++ - some cleanup in common.c:atm_getsockopt ++ - device drivers are now required to use the peek function; protocols now ++ must provide it ++ ++ ++Version 0.1 to 0.2 (15-AUG-1995) ++================== ++ ++Bug fixes ++--------- ++ ++ - VCC family field is now correctly set to protocol family in ++ common.c:atm_create (was pvc.c:pvc_create). With protocol set to zero, ++ this created all types of strange problems, because the family field ++ is used to indicate whether an VCC slot is busy/free. ++ - fixed race condition in common.c:atm_read (reader might have blocked ++ even if data is ready) ++ - fixed dereferencing of uninitialized skb->dev pointer in ++ clip.c:atm_push_clip ++ - SIOCSIFATMTCP now refuses to attach the same socket twice ++ - zatm.c: fixed setting of the VPI/VCI mask ++ - USAGE said ttcp uses -B for the bandwidth, but it's -P ++ - mkdist didn't include man pages ++ ++New features ++------------ ++ ++ - added some /proc/atm functionality ++ - added support for ATM_{VPI,VCI}_ANY ++ - SIOCSIFATMTCP now returns the interface number and atmtcp(8) prints it ++ - wrote atmtcp man page ++ - added kernel part of SVC support ++ ++Other changes ++------------- ++ ++ - common.c: only root is now allowed to bind to reserved VCIs ++ - Classical IP interfaces are now removed by downing by ifconfig; clip(8) ++ returns immediately ++ - PVC-connect for non-existing device now returns ENODEV instead of EINVAL ++ - new field (type) in struct atm_dev to indicate device type ++ - moved getsockopt(SO_CIRANGE) to common.c (removed atmtcp's own version) ++ - added ci_range to struct atm_dev (and removed it from atmtcp's private ++ structure) ++ - added code to read the ESI to zatm.c (but that code doesn't seem to work ++ yet) +--- linux-atm-2.4.1.orig/debian/atm-tools-br2684.manpages ++++ linux-atm-2.4.1/debian/atm-tools-br2684.manpages +@@ -0,0 +1 @@ ++debian/tmp/usr/share/man/man8/br2684ctl.8 +--- linux-atm-2.4.1.orig/debian/atm-tools.atm ++++ linux-atm-2.4.1/debian/atm-tools.atm +@@ -0,0 +1,27 @@ ++#!/bin/sh ++# Start/stop the atm daemon(s). ++ ++DAEMON="/sbin/atmarpd" ++ ++test -f $DAEMON || exit 0 ++ ++case "$1" in ++start) echo -n "Starting ATM ARP Daemon: " ++ start-stop-daemon --start --quiet --exec $DAEMON -b ++ /bin/sleep 2 ++ echo "atmarpd." ++ ;; ++stop) echo -n "Stopping ATM ARP Daemon: " ++ start-stop-daemon --stop --quiet --exec $DAEMON ++ echo "atmarpd." ++ ;; ++restart|force-reload) echo -n "Re-starting ATM ARP Daemon: " ++ start-stop-daemon --stop --quiet --exec $DAEMON ++ start-stop-daemon --start --quiet --exec $DAEMON -b ++ /bin/sleep 2 ++ echo "atmarpd." ++ ;; ++*) echo "Usage: /etc/init.d/atm start|stop|restart|force-reload"; exit 1 ++ ;; ++esac ++exit 0 +--- linux-atm-2.4.1.orig/debian/atm-tools.docs ++++ linux-atm-2.4.1/debian/atm-tools.docs +@@ -0,0 +1,4 @@ ++BUGS ++README ++doc/README.tc ++debian/README.br2684 +--- linux-atm-2.4.1.orig/debian/control.old ++++ linux-atm-2.4.1/debian/control.old +@@ -0,0 +1,72 @@ ++Source: linux-atm ++Section: net ++Priority: optional ++Maintainer: Peter De Schrijver (p2) <p2@mind.be> ++Build-Depends: debhelper (>> 4.0.0), bison, flex, perl, dpatch, automake1.4 ++Standards-Version: 3.6.1 ++ ++Package: atm-tools ++Architecture: any ++Depends: ${shlibs:Depends} ++Description: Base programs for ATM in Linux, the net-tools for ATM ++ This package provides all the basic programs needed for setting up, ++ monitoring and tuning ATM networks. Such as: ++ * atmsigd, an ATM signal daemon that implements the ATM UNI protocol. ++ * atmtcp, a tool to setup ATM over TCP connections. ++ * atmarpd, an implementation of the ATMARP protocol (RFC1577, RFC1755) ++ * zeppelin, an ATM LAN Emulation client daemon ++ * les and bus, ATM LAN Emulation service daemons ++ . ++ Notice that upstream still flags these tools as experimental software and ++ says that there is still a number of known bugs and issues. The ++ software is, however, in productive use at a number of sites and is ++ working reliably. ++ . ++ Homepage: http://linux-atm.sourceforge.net/ ++ ++Package: atm-tools-br2684 ++Architecture: any ++Depends: ${shlibs:Depends} ++Description: br2864ctl - RFC1483/2864 Bridge Daemon for ATM Networks ++ br2684ctl handles RFC1483/2684 bridged PDUs. This is most often ++ used in ADSL scenarios where usually the subscribers' ethernet ++ traffic is encapsulated in ATM AAL5 (by bridging ADSL modems) ++ according to RFC2684 ++ . ++ The sources for br2684ctl has been pulled from linux-atm's CVS ++ repository. Warning: This is unreleased software that can break any ++ time, any place. If it does, you get to keep the pieces. linux-atm's ++ upstream flags even the released software as experimental software. ++ There is still a number of known bugs and issues. ++ ++Package: atm-dev ++Depends: libatm1-dev ++Architecture: all ++Section: oldlibs ++Description: Development files for compiling ATM programs (dummy package) ++ This dummy package provides a transition from the previous atm packages. ++ It is provided for backwards compatibility only and may be removedafter ++ the upgrade has completed or when when no other package depend on it. ++ ++Package: libatm1 ++Section: libs ++Architecture: any ++Depends: ${shlibs:Depends} ++Conflicts: atm-tools (<< 2.4.1-6) ++Description: shared library for ATM (Asynchronous Transfer Mode) ++ Shared libraries needed by ATM (Asynchronous Transfer Mode) related programs ++ . ++ Homepage: http://linux-atm.sourceforge.net/ ++ ++Package: libatm1-dev ++Section: libdevel ++Architecture: any ++Depends: libc6-dev, libatm1 ++Replaces: atm-dev (<< 2.4.1-7) ++Conflicts: atm-dev (<< 2.4.1-7) ++Provides: libatm-dev ++Description: Development files for compiling ATM programs ++ Header files and development libraries for compiling ATM (Asynchronous ++ Transfer Mode) related programs. ++ . ++ Homepage: http://linux-atm.sourceforge.net/ +--- linux-atm-2.4.1.orig/debian/atm-tools.install ++++ linux-atm-2.4.1/debian/atm-tools.install +@@ -0,0 +1,18 @@ ++debian/tmp/usr/share/man/* ++debian/tmp/usr/bin/* ++debian/tmp/usr/sbin/atmsigd ++debian/tmp/usr/sbin/atmaddr ++debian/tmp/usr/sbin/esi ++debian/tmp/usr/sbin/atmloop ++debian/tmp/usr/sbin/atmtcp ++debian/tmp/usr/sbin/enitune ++debian/tmp/usr/sbin/zntune ++debian/tmp/usr/sbin/atmarp sbin ++debian/tmp/usr/sbin/atmarpd sbin ++debian/tmp/usr/sbin/ilmid ++debian/tmp/usr/sbin/zeppelin ++debian/tmp/usr/sbin/les ++debian/tmp/usr/sbin/bus ++debian/tmp/usr/sbin/lecs ++debian/tmp/usr/sbin/mpcd ++debian/tmp/etc/atmsigd.conf +--- linux-atm-2.4.1.orig/debian/atm-tools.manpages ++++ linux-atm-2.4.1/debian/atm-tools.manpages +@@ -0,0 +1 @@ ++debian/atm-tools.8 +--- linux-atm-2.4.1.orig/debian/atm-tools.pod ++++ linux-atm-2.4.1/debian/atm-tools.pod +@@ -0,0 +1,27 @@ ++=head1 NAME ++ ++linux-atm - preliminary manpage ++aread ++awrite ++enitune ++ilmid ++saaldump ++sonetdiag ++ttcp_atm ++zntune ++ ++=head1 DOCUMENTATION ++ ++atm-tools is a package containing the basic tools that are needed for ++setting up, monitoring, and tuning ATM networks. All available ++documentation can be found in /usr/share/doc/atnm-tools in Debian ++systems, and on the Web on: http://linux-atm.sourceforge.net. ++ ++=head1 BUGS ++ ++Many. Be prepared to debug. ++ ++=head1 AUTHOR ++ ++This manpage was written by Marc Haber for linux-atm packaging in ++Debian/GNU Operating System. +--- linux-atm-2.4.1.orig/debian/changelog ++++ linux-atm-2.4.1/debian/changelog +@@ -0,0 +1,212 @@ ++linux-atm (2.4.1-17) unstable; urgency=low ++ ++ * Fix build problem with gcc 4.0 (Closes: ) ++ ++ -- Peter De Schrijver (p2) <p2@mind.be> Thu, 17 Mar 2005 23:02:03 +0100 ++ ++linux-atm (2.4.1-16) unstable; urgency=low ++ ++ * Fix build problem with gcc 3.4 (Closes: #259422) ++ ++ -- Peter De Schrijver (p2) <p2@mind.be> Thu, 15 Jul 2004 14:28:10 +0200 ++ ++linux-atm (2.4.1-15) unstable; urgency=low ++ ++ * Updated descriptions (Closes: #239161) ++ ++ -- Peter De Schrijver (p2) <p2@mind.be> Sun, 4 Apr 2004 21:10:20 +0200 ++ ++linux-atm (2.4.1-14) unstable; urgency=low ++ ++ * Fix symlink for /usr/lib/libatm.so (Closes: #221011) ++ ++ -- Peter De Schrijver (p2) <p2@mind.be> Sun, 7 Dec 2003 21:53:19 +0100 ++ ++linux-atm (2.4.1-13) unstable; urgency=low ++ ++ * Previous version fixed #217259, but no changelog entry (Closes: #217259) ++ * Previous version fixed #216662, but no changelog entry (Closes: #216662) ++ * Added missing build dependency on automake1.4 (Closes: #221120, #221284) ++ * New Maintainer (Closes: #206982) ++ ++ -- Peter De Schrijver (p2) <p2@mind.be> Mon, 17 Nov 2003 23:03:58 +0100 ++ ++linux-atm (2.4.1-12) unstable; urgency=low ++ ++ * don't build atm-tools-br2684 by default. Thanks to ftpmaster for ++ not allowing the package to be in Debian. ++ * Since we don't build atm-tools-br2684 any more, revert back to ++ autotools output from 2.4.1-9 ++ * Add README.br2684 documenting a way to build the package locally. ++ ++ -- Marc Haber <mh+debian-packages@zugschlus.de> Wed, 5 Nov 2003 21:31:42 +0000 ++ ++linux-atm (2.4.1-11) experimental; urgency=low ++ ++ * Build-Depend on dpatch ++ * dpatch br2684 header files from later libc for old libc (woody) ++ ++ -- Marc Haber <mh+debian-packages@zugschlus.de> Wed, 29 Oct 2003 19:05:07 +0000 ++ ++linux-atm (2.4.1-10) experimental; urgency=low ++ ++ * add br2684 to package (closes: #216663) ++ * autoreconf to actually build br2684 ++ * have libatm1-dev provide libatm-dev (closes: #216662) ++ * move lib symlink to libatm1-dev as well (closes: #217259) ++ ++ -- Marc Haber <mh+debian-packages@zugschlus.de> Thu, 23 Oct 2003 17:55:43 +0000 ++ ++linux-atm (2.4.1-9) unstable; urgency=low ++ ++ * put libatm1-dev in libdevel (closes: #213170) ++ * make sure that new descriptions actually make it into the package ++ ++ -- Marc Haber <mh+debian-packages@zugschlus.de> Thu, 9 Oct 2003 17:08:10 +0000 ++ ++linux-atm (2.4.1-8) unstable; urgency=low ++ ++ * build arch-indep package as targets of binary-indep (closes: #212124) ++ * use dh_installdocs to install files to libatm1-dev/docs ++ * symlink shared lib to usr/bin (closes: #213146) ++ * Use better long descriptions. Thanks to Javier (closes: #209427) ++ Fernandez-Sanguino (closes: #209612) ++ ++ -- Marc Haber <mh+debian-packages@zugschlus.de> Sun, 28 Sep 2003 19:29:08 +0000 ++ ++linux-atm (2.4.1-7) unstable; urgency=low ++ ++ * libatm1 now conflicts with atm-tools (<< 2.4.1-6) (closes: #208170) ++ * armarp now writes output to stdout. ++ * add atm-dev as empty transitional package to help upgrades ++ ++ -- Marc Haber <mh+debian-packages@zugschlus.de> Tue, 2 Sep 2003 09:20:33 +0000 ++ ++linux-atm (2.4.1-6) unstable; urgency=low ++ ++ * split off shared libraries to libatm1 ++ * rename atm-dev to libatm1-dev ++ * Standards-Version: 3.6.1 ++ ++ -- Marc Haber <mh+debian-packages@zugschlus.de> Tue, 26 Aug 2003 15:46:27 +0000 ++ ++linux-atm (2.4.1-5) unstable; urgency=low ++ ++ * move *.a and *.la to usr/lib (closes: #199506). ++ * let atm-dev depend on atm-tools to avoid dangling /lib/libatm.so ++ symlink. ++ * Standards-Version: 3.5.6 ++ ++ -- Marc Haber <mh+debian-packages@zugschlus.de> Wed, 30 Jul 2003 11:46:19 +0000 ++ ++linux-atm (2.4.1-4) unstable; urgency=low ++ ++ * add Build-Depends: on automake1.4 ++ ++ -- Marc Haber <mh+debian-packages@zugschlus.de> Wed, 11 Jun 2003 16:58:21 +0000 ++ ++linux-atm (2.4.1-3) unstable; urgency=low ++ ++ * rebuilding libtool broke src/test/Makefile.in. Applied fix to ++ Makefile.am and re-built again. ++ ++ -- Marc Haber <mh+debian-packages@zugschlus.de> Wed, 11 Jun 2003 11:05:26 +0000 ++ ++linux-atm (2.4.1-2) unstable; urgency=low ++ ++ * rebuild configure script with new libtool (closes: #196909) ++ ++ -- Marc Haber <mh+debian-packages@zugschlus.de> Tue, 10 Jun 2003 21:01:50 +0000 ++ ++linux-atm (2.4.1-1) unstable; urgency=low ++ ++ * new upstream source ++ * remove atmarp and atmarpd from /usr/sbin as they are already in ++ /sbin (closes: #196216) ++ * lintian fixes ++ ++ -- Marc Haber <mh+debian-packages@zugschlus.de> Mon, 9 Jun 2003 16:03:45 +0000 ++ ++linux-atm (2.4.0-5) unstable; urgency=low ++ ++ * Fix for src/test/Makefile.in to allow building on hppa and ia64 ++ which the fix introduced to 2.4.0-4 broke. Thanks to Goswin ++ Brederlow. ++ * Move init.d priority to that atmarpd is started before network ++ interfaces are started. ++ * Move atmarpd and libatm to /sbin and /lib to allow atmarpd to be ++ started before /usr is mounted. ++ * use dh_install instead of dh_movefiles. ++ ++ -- Marc Haber <mh+debian-packages@zugschlus.de> Sat, 24 Aug 2002 15:13:48 +0000 ++ ++linux-atm (2.4.0-4) unstable; urgency=low ++ ++ * new maintainer ++ * Fix for src/test/Makefile.in to allow building on sparc. ++ Thanks to Patrick Mauritz. (closes: #144225). ++ * added pseudo-manpage for manpage-less binaries. ++ * removed rpath by changing configure and make install paramaters ++ ++ -- Marc Haber <mh+debian-packages@zugschlus.de> Fri, 16 Aug 2002 20:39:05 +0000 ++ ++linux-atm (2.4.0-3) unstable; urgency=HIGH ++ ++ * Re-ran libtoolize. ++ Closes: #143522 ++ ++ * Previous version Closes: #135328 ++ ++ -- Russell Coker <russell@coker.com.au> Fri, 19 Apr 2002 01:55:00 +0200 ++ ++linux-atm (2.4.0-2) unstable; urgency=HIGH ++ ++ * Put a "grep -v EMAXERRNO" into the build process to deal with mipsel and ++ the "#ifdef __KERNEL__" it has in it's /usr/include/asm/errno.h . ++ ++ -- Russell Coker <russell@coker.com.au> Thu, 18 Apr 2002 19:56:00 +0200 ++ ++linux-atm (2.4.0-1) unstable; urgency=HIGH ++ ++ * New upstream version which changes source package name. ++ Closes: #138911 ++ ++ -- Russell Coker <russell@coker.com.au> Mon, 18 Mar 2002 17:42:00 +0100 ++ ++atm (0.79-4) unstable; urgency=low ++ ++ * Added build-depends on flex. ++ Closes: #111072 ++ ++ * Made the atm tools use a shared object to save space. ++ ++ * Fixed the copyright file and put all copyright details in both packages. ++ ++ * Added support for easy building with different kernel headers. ++ Closes: #110249 ++ ++ -- Russell Coker <russell@coker.com.au> Sun, 7 Oct 2001 14:11:33 +0200 ++ ++atm (0.79-3) unstable; urgency=low ++ ++ * Created /etc/init.d/atm to start and stop atmarpd. ++ Closes: #110252 ++ ++ * Added build-depends on bison. ++ Closes: #110576 ++ ++ -- Russell Coker <russell@coker.com.au> Fri, 31 Aug 2001 15:21:44 +0200 ++ ++atm (0.79-2) unstable; urgency=low ++ ++ * Changed the main package name to atm-tools to indicate that it doesn't ++ provide ATM (gotta have the kernel support), it just has the daemons and ++ utilities. ++ ++ -- Russell Coker <russell@coker.com.au> Sat, 25 Aug 2001 17:55:00 +0200 ++ ++atm (0.79-1) unstable; urgency=low ++ ++ * Initial Release. ++ ++ -- Russell Coker <russell@coker.com.au> Fri, 24 Aug 2001 17:31:00 +0200 +--- linux-atm-2.4.1.orig/debian/checkout-br2684 ++++ linux-atm-2.4.1/debian/checkout-br2684 +@@ -0,0 +1,25 @@ ++#!/bin/bash -x ++ ++set -e ++ ++# check out br2684 from upstream CVS. We need to jump through hoops if ++# the local source package is under cvs control as well. ++ ++CVSDIR=":pserver:anonymous:@cvs.linux-atm.sourceforge.net.:/cvsroot/linux-atm" ++DIR="br2684" ++TMPDIR="/tmp" ++TARGETDIR="src" ++ ++cvs -d${CVSDIR} login ++ ++mkdir -p $TMPDIR ++pushd $TMPDIR ++cvs -z6 -d${CVSDIR} export -d $DIR -r V2_5_0 linux-atm/src/br2684 ++ ++popd ++ ++mv $TMPDIR/$DIR/* $TARGETDIR/$DIR ++rm -rf $TMPDIR/$DIR ++ ++autoreconf -i -f ++ +--- linux-atm-2.4.1.orig/debian/copyright.header ++++ linux-atm-2.4.1/debian/copyright.header +@@ -0,0 +1,18 @@ ++This package was debianized by Russell Coker <russell@coker.com.au> on ++Fri, 24 Aug 2001 16:11:12 +0200 and is now maintained by Marc Haber ++<mh+debian-packages@zugschlus.de>. ++ ++It was downloaded from http://www.sourceforge.net/projects/linux-atm/ ++ ++See also http://linux-atm.sourceforge.net/dist.php ++ ++Upstream Authors: ++Werner Almesberger EPFL ICA <Werner.Almesberger@epfl.ch> ++Mitchell Blank Jr. <mitch@sfgoth.com> ++Paul B Schroeder <paulsch@us.ibm.com> ++ ++Copyright: ++ ++GPL 2.0 ++ ++See /usr/share/common-licenses/GPL-2 +--- linux-atm-2.4.1.orig/debian/libatm1-dev.dirs ++++ linux-atm-2.4.1/debian/libatm1-dev.dirs +@@ -0,0 +1,2 @@ ++usr/lib ++usr/include +--- linux-atm-2.4.1.orig/debian/libatm1-dev.docs ++++ linux-atm-2.4.1/debian/libatm1-dev.docs +@@ -0,0 +1,2 @@ ++doc/README.CLP ++doc/atm-linux-howto.txt +--- linux-atm-2.4.1.orig/debian/libatm1-dev.install ++++ linux-atm-2.4.1/debian/libatm1-dev.install +@@ -0,0 +1,2 @@ ++debian/tmp/usr/include/* ++debian/tmp/usr/lib/*.a usr/lib +--- linux-atm-2.4.1.orig/debian/libatm1-dev.links ++++ linux-atm-2.4.1/debian/libatm1-dev.links +@@ -0,0 +1 @@ ++lib/libatm.so.1 usr/lib/libatm.so +--- linux-atm-2.4.1.orig/debian/libatm1.dirs ++++ linux-atm-2.4.1/debian/libatm1.dirs +@@ -0,0 +1 @@ ++/lib +--- linux-atm-2.4.1.orig/debian/libatm1.install ++++ linux-atm-2.4.1/debian/libatm1.install +@@ -0,0 +1 @@ ++debian/tmp/usr/lib/libatm.so.* lib diff --git a/package/linux-atm/patches/100-br2684.patch b/package/linux-atm/patches/100-br2684.patch new file mode 100644 index 0000000000..dfb1de0205 --- /dev/null +++ b/package/linux-atm/patches/100-br2684.patch @@ -0,0 +1,488 @@ +diff -ruN linux-atm-2.4.1/configure.in linux-atm-2.4.1.new/configure.in +--- linux-atm-2.4.1/configure.in 2003-04-25 04:17:05.000000000 +0200 ++++ linux-atm-2.4.1.new/configure.in 2005-07-27 15:45:49.532396543 +0200 +@@ -153,26 +153,6 @@ + src/Makefile \ + src/include/Makefile \ + src/lib/Makefile \ +- src/test/Makefile \ +- src/debug/Makefile \ +- src/qgen/Makefile \ +- src/saal/Makefile \ +- src/sigd/Makefile \ +- src/maint/Makefile \ +- src/arpd/Makefile \ +- src/ilmid/Makefile \ +- src/ilmid/asn1/Makefile \ +- src/man/Makefile \ +- src/led/Makefile \ +- src/lane/Makefile \ +- src/mpoad/Makefile \ +- src/switch/Makefile \ +- src/switch/debug/Makefile \ +- src/switch/tcp/Makefile \ +- src/config/Makefile \ +- src/config/init-redhat/Makefile \ +- src/extra/Makefile \ +- src/extra/linux-atm.spec \ +- src/extra/ANS/Makefile ++ src/br2684/Makefile \ + ) + +diff -ruN linux-atm-2.4.1/src/br2684/Makefile linux-atm-2.4.1.new/src/br2684/Makefile +--- linux-atm-2.4.1/src/br2684/Makefile 1970-01-01 02:00:00.000000000 +0200 ++++ linux-atm-2.4.1.new/src/br2684/Makefile 2002-07-15 23:44:25.000000000 +0200 +@@ -0,0 +1,13 @@ ++PREFIX=${TI_FILESYSTEM} ++ ++all: br2684ctl ++ ++br2684ctl: br2684ctl.c ++ gcc -latm -o br2684ctl br2684ctl.c ++ strip br2684ctl ++ ++install: br2684ctl ++ cp br2684ctl $(PREFIX)/usr/sbin/ ++ ++clean: ++ rm -rf br2684ctl *.o +diff -ruN linux-atm-2.4.1/src/Makefile.am linux-atm-2.4.1.new/src/Makefile.am +--- linux-atm-2.4.1/src/Makefile.am 2001-10-03 23:14:53.000000000 +0200 ++++ linux-atm-2.4.1.new/src/Makefile.am 2005-07-27 15:33:52.389309711 +0200 +@@ -1,3 +1,2 @@ +-SUBDIRS = include lib test debug qgen saal sigd maint arpd ilmid man led lane \ +- mpoad switch config extra ++SUBDIRS = include lib br2684 + + +diff -Nur linux-atm-2.4.1.orig/src/include/linux/atmbr2684.h linux-atm-2.4.1/src/include/linux/atmbr2684.h +--- linux-atm-2.4.1.orig/src/include/linux/atmbr2684.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-atm-2.4.1/src/include/linux/atmbr2684.h 2005-11-13 00:06:42.000000000 +0100 +@@ -0,0 +1,117 @@ ++#ifndef _LINUX_ATMBR2684_H ++#define _LINUX_ATMBR2684_H ++ ++#include <linux/atm.h> ++#include <linux/if.h> /* For IFNAMSIZ */ ++#include <linux/if_ether.h> /* ETH_P_* */ ++ ++/* ++ * Type of media we're bridging (ethernet, token ring, etc) Currently only ++ * ethernet is supported ++ */ ++#define BR2684_MEDIA_ETHERNET (0) /* 802.3 */ ++#define BR2684_MEDIA_802_4 (1) /* 802.4 */ ++#define BR2684_MEDIA_TR (2) /* 802.5 - token ring */ ++#define BR2684_MEDIA_FDDI (3) ++#define BR2684_MEDIA_802_6 (4) /* 802.6 */ ++ ++/* ++ * Is there FCS inbound on this VC? This currently isn't supported. ++ */ ++#define BR2684_FCSIN_NO (0) ++#define BR2684_FCSIN_IGNORE (1) ++#define BR2684_FCSIN_VERIFY (2) ++ ++/* ++ * Is there FCS outbound on this VC? This currently isn't supported. ++ */ ++#define BR2684_FCSOUT_NO (0) ++#define BR2684_FCSOUT_SENDZERO (1) ++#define BR2684_FCSOUT_GENERATE (2) ++ ++/* ++ * Does this VC include LLC encapsulation? ++ */ ++#define BR2684_ENCAPS_VC (0) /* VC-mux */ ++#define BR2684_ENCAPS_LLC (1) ++#define BR2684_ENCAPS_AUTODETECT (2) /* Unsuported */ ++ ++/* ++ * Is this VC bridged or routed? ++ */ ++ ++#define BR2684_PAYLOAD_ROUTED (0) ++#define BR2684_PAYLOAD_BRIDGED (1) ++ ++ ++/* ++ * This is for the ATM_NEWBACKENDIF call - these are like socket families: ++ * the first element of the structure is the backend number and the rest ++ * is per-backend specific ++ */ ++struct atm_newif_br2684 { ++ atm_backend_t backend_num; /* ATM_BACKEND_BR2684 */ ++ int media; /* BR2684_MEDIA_* */ ++ char ifname[IFNAMSIZ]; ++ int mtu; ++ int payload; /* bridged or routed */ ++}; ++ ++/* ++ * This structure is used to specify a br2684 interface - either by a ++ * positive integer (returned by ATM_NEWBACKENDIF) or the interfaces name ++ */ ++#define BR2684_FIND_BYNOTHING (0) ++#define BR2684_FIND_BYNUM (1) ++#define BR2684_FIND_BYIFNAME (2) ++struct br2684_if_spec { ++ int method; /* BR2684_FIND_* */ ++ union { ++ char ifname[IFNAMSIZ]; ++ int devnum; ++ } spec; ++}; ++ ++/* ++ * This is for the ATM_SETBACKEND call - these are like socket families: ++ * the first element of the structure is the backend number and the rest ++ * is per-backend specific ++ */ ++struct atm_backend_br2684 { ++ atm_backend_t backend_num; /* ATM_BACKEND_BR2684 */ ++ struct br2684_if_spec ifspec; ++ int fcs_in; /* BR2684_FCSIN_* */ ++ int fcs_out; /* BR2684_FCSOUT_* */ ++ int fcs_auto; /* 1: fcs_{in,out} disabled if no FCS rx'ed */ ++ int encaps; /* BR2684_ENCAPS_* */ ++ int payload; /* BR2684_PAYLOAD_* */ ++ int has_vpiid; /* 1: use vpn_id - Unsupported */ ++ __u8 vpn_id[7]; ++ int send_padding; /* unsupported */ ++ int min_size; /* we will pad smaller packets than this */ ++}; ++ ++/* ++ * The BR2684_SETFILT ioctl is an experimental mechanism for folks ++ * terminating a large number of IP-only vcc's. When netfilter allows ++ * efficient per-if in/out filters, this support will be removed ++ */ ++struct br2684_filter { ++ __u32 prefix; /* network byte order */ ++ __u32 netmask; /* 0 = disable filter */ ++}; ++ ++struct br2684_filter_set { ++ struct br2684_if_spec ifspec; ++ struct br2684_filter filter; ++}; ++ ++enum br2684_payload { ++ p_routed = BR2684_PAYLOAD_ROUTED, ++ p_bridged = BR2684_PAYLOAD_BRIDGED, ++}; ++ ++#define BR2684_SETFILT _IOW( 'a', ATMIOC_BACKEND + 0, \ ++ struct br2684_filter_set) ++ ++#endif /* _LINUX_ATMBR2684_H */ +--- linux-atm-2.4.1/src/br2684/br2684ctl.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-atm-2.4.1.new/src/br2684/br2684ctl.c 2006-02-07 14:19:42.000000000 +0100 +@@ -0,0 +1,307 @@ ++#include <stdio.h> ++#include <stdlib.h> ++#include <unistd.h> ++#include <errno.h> ++#include <sys/ioctl.h> ++#include <string.h> ++#include <syslog.h> ++#include <atm.h> ++#include <linux/atmdev.h> ++#include <linux/atmbr2684.h> ++ ++/* Written by Marcell GAL <cell@sch.bme.hu> to make use of the */ ++/* ioctls defined in the br2684... kernel patch */ ++/* Compile with cc -o br2684ctl br2684ctl.c -latm */ ++ ++/* ++ Modified feb 2001 by Stephen Aaskov (saa@lasat.com) ++ - Added daemonization code ++ - Added syslog ++ ++ TODO: Delete interfaces after exit? ++*/ ++ ++ ++#define LOG_NAME "RFC1483/2684 bridge" ++#define LOG_OPTION LOG_PERROR ++#define LOG_FACILITY LOG_LOCAL0 ++ ++ ++int lastsock, lastitf; ++ ++void fatal(char *str, int i) ++{ ++ syslog(LOG_ERR, "Fatal: %s", str); ++ exit(-2); ++}; ++ ++ ++void exitFunc(void) ++{ ++ syslog(LOG_PID, "Daemon terminated\n"); ++} ++ ++ ++int create_pidfile(char *nstr) ++{ ++ FILE *pidfile = NULL; ++ char name[20]; ++ int num; ++ ++ if (nstr == NULL) ++ return -1; ++ num = atoi(nstr); ++ if (num < 0) ++ return -1; ++ ++ snprintf(name, 20, "/var/run/nas%d.pid", num); ++ pidfile = fopen(name, "w"); ++ if (pidfile == NULL) ++ return -1; ++ fprintf(pidfile, "%d", getpid()); ++ fclose(pidfile); ++ ++ return 0; ++} ++ ++int create_br(char *nstr, int payload) ++{ ++ int num, err; ++ ++ if (lastsock < 0) { ++ lastsock = socket(PF_ATMPVC, SOCK_DGRAM, ATM_AAL5); ++ } ++ if (lastsock < 0) { ++ syslog(LOG_ERR, "socket creation failed: %s", ++ strerror(errno)); ++ } else { ++ /* create the device with ioctl: */ ++ num = atoi(nstr); ++ if (num >= 0 && num < 1234567890) { ++ struct atm_newif_br2684 ni; ++ ni.backend_num = ATM_BACKEND_BR2684; ++ ni.media = BR2684_MEDIA_ETHERNET; ++ ni.mtu = 1500; ++ ni.payload = payload; /* bridged or routed */ ++ sprintf(ni.ifname, "nas%d", num); ++ err = ioctl(lastsock, ATM_NEWBACKENDIF, &ni); ++ ++ if (err == 0) ++ syslog(LOG_INFO, ++ "Interface \"%s\" (mtu=%d, payload=%s) created sucessfully\n", ++ ni.ifname, ni.mtu,ni.payload ? "bridged" : "routed"); ++ else ++ syslog(LOG_INFO, ++ "Interface \"%s\" could not be created, reason: %s\n", ++ ni.ifname, strerror(errno)); ++ lastitf = num; /* even if we didn't create, because existed, assign_vcc wil want to know it! */ ++ } else { ++ syslog(LOG_ERR, "err: strange interface number %d", ++ num); ++ } ++ } ++ return 0; ++} ++ ++ ++int assign_vcc(char *astr, int encap, int payload, int bufsize) ++{ ++ int err, errno; ++ struct atm_qos qos; ++ struct sockaddr_atmpvc addr; ++ int fd; ++ struct atm_backend_br2684 be; ++ ++ memset(&addr, 0, sizeof(addr)); ++ err = ++ text2atm(astr, (struct sockaddr *) (&addr), sizeof(addr), ++ T2A_PVC); ++ if (err != 0) ++ syslog(LOG_ERR, ++ "Could not parse ATM parameters (error=%d)\n", err); ++ ++#if 0 ++ addr.sap_family = AF_ATMPVC; ++ addr.sap_addr.itf = itf; ++ addr.sap_addr.vpi = 0; ++ addr.sap_addr.vci = vci; ++#endif ++ syslog(LOG_INFO, ++ "Communicating over ATM %d.%d.%d, encapsulation: %s\n", ++ addr.sap_addr.itf, addr.sap_addr.vpi, addr.sap_addr.vci, ++ encap ? "VC mux" : "LLC"); ++ ++ if ((fd = socket(PF_ATMPVC, SOCK_DGRAM, ATM_AAL5)) < 0) ++ syslog(LOG_ERR, "failed to create socket %d, reason: %s", ++ errno, strerror(errno)); ++ ++ ++ memset(&qos, 0, sizeof(qos)); ++ qos.aal = ATM_AAL5; ++ qos.txtp.traffic_class = ATM_UBR; ++ qos.txtp.max_sdu = 1524; ++ qos.txtp.pcr = ATM_MAX_PCR; ++ qos.rxtp = qos.txtp; ++ ++ if ((err = ++ setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &bufsize, ++ sizeof(bufsize)))) ++ syslog(LOG_ERR, "setsockopt SO_SNDBUF: (%d) %s\n", err, ++ strerror(err)); ++ ++ if (setsockopt(fd, SOL_ATM, SO_ATMQOS, &qos, sizeof(qos)) < 0) ++ syslog(LOG_ERR, "setsockopt SO_ATMQOS %d", errno); ++ ++ err = ++ connect(fd, (struct sockaddr *) &addr, ++ sizeof(struct sockaddr_atmpvc)); ++ ++ if (err < 0) ++ fatal("failed to connect on socket", err); ++ ++ /* attach the vcc to device: */ ++ ++ be.backend_num = ATM_BACKEND_BR2684; ++ be.ifspec.method = BR2684_FIND_BYIFNAME; ++ sprintf(be.ifspec.spec.ifname, "nas%d", lastitf); ++ be.fcs_in = BR2684_FCSIN_NO; ++ be.fcs_out = BR2684_FCSOUT_NO; ++ be.fcs_auto = 0; ++ be.encaps = encap ? BR2684_ENCAPS_VC : BR2684_ENCAPS_LLC; ++ be.payload = payload; ++ be.has_vpiid = 0; ++ be.send_padding = 0; ++ be.min_size = 0; ++ err = ioctl(fd, ATM_SETBACKEND, &be); ++ if (err == 0) ++ syslog(LOG_INFO, "Interface configured"); ++ else { ++ syslog(LOG_ERR, "Could not configure interface:%s", ++ strerror(errno)); ++ exit(2); ++ } ++ return fd; ++} ++ ++ ++ ++void usage(char *s) ++{ ++ printf("usage: %s [-b] [[-c number] [-e 0|1] [-p 0|1] [-s num] [-a [itf.]vpi.vci]*]*\n" ++ " -b = run in background (daemonize)\n" ++ " -c <num> = use interface nas<num>\n" ++ " -e 0|1 = encapsulation (0=LLC, 1=VC Mux)\n" ++ " -p 0|1 = payload type (0=routed,1=bridged)\n" ++ " -s <num> = set sndbuf (send buffer) size (default 8192)\n" ++ " -a [itf.]vpi.vci = ATM interface no, VPI, VCI\n", ++ s); ++ exit(1); ++} ++ ++ ++ ++int main(int argc, char **argv) ++{ ++ int c, background = 0, encap = 0, sndbuf = 8192, payload = 1; ++ char *itfnum = NULL; ++ ++ lastsock = -1; ++ lastitf = 0; ++ ++ openlog(LOG_NAME, LOG_OPTION, LOG_FACILITY); ++ if (argc > 1) ++ while ((c = getopt(argc, argv, "a:bc:e:s:p:t:?h")) != EOF) ++ switch (c) { ++ case 'a': ++ assign_vcc(optarg, encap, payload, sndbuf); ++ break; ++ case 'b': ++ background = 1; ++ break; ++ case 'c': ++ create_br(optarg, payload); ++ itfnum = strdup(optarg); ++ break; ++ case 'e': ++ encap = (atoi(optarg)); ++ if (encap < 0) { ++ syslog(LOG_ERR, ++ "invalid encapsulation: %s:\n", ++ optarg); ++ encap = 0; ++ } ++ break; ++ case 's': ++ sndbuf = (atoi(optarg)); ++ if (sndbuf < 0) { ++ syslog(LOG_ERR, ++ "Invalid sndbuf: %s, using size of 8192 instead\n", ++ optarg); ++ sndbuf = 8192; ++ } ++ break; ++ case 'p': /* payload type: routed (0) or bridged (1) */ ++ payload = atoi(optarg); ++ break; ++ case '?': ++ case 'h': ++ default: ++ usage(argv[0]); ++ } else ++ usage(argv[0]); ++ ++ if (argc != optind) ++ usage(argv[0]); ++ ++ if (lastsock >= 0) ++ close(lastsock); ++ ++ if (background) { ++ pid_t pid; ++ ++ pid = fork(); ++ if (pid < 0) { ++ fprintf(stderr, "Error detaching\n"); ++ exit(2); ++ } else if (pid) ++ exit(0); // This is the parent ++ ++ // Become a process group and session group leader ++ if (setsid() < 0) { ++ fprintf(stderr, "Could not set process group\n"); ++ exit(2); ++ } ++ // Fork again to let process group leader exit ++ pid = fork(); ++ if (pid < 0) { ++ fprintf(stderr, ++ "Error detaching during second fork\n"); ++ exit(2); ++ } else if (pid) ++ exit(0); // This is the parent ++ ++ // Now we're ready for buisness ++ chdir("/"); // Don't keep directories in use ++ close(0); ++ close(1); ++ close(2); // Close stdin, -out and -error ++ /* ++ Note that this implementation does not keep an open ++ stdout/err. ++ If we need them they can be opened now ++ */ ++ ++ } ++ ++ if (itfnum != NULL) { ++ create_pidfile(itfnum); ++ free(itfnum); ++ } ++ ++ syslog(LOG_INFO, "RFC 1483/2684 bridge daemon started\n"); ++ atexit(exitFunc); ++ ++ while (1) ++ sleep(30); /* to keep the sockets... */ ++ return 0; ++} diff --git a/package/linux-atm/patches/200-no_libfl.patch b/package/linux-atm/patches/200-no_libfl.patch new file mode 100644 index 0000000000..1b538b2a3b --- /dev/null +++ b/package/linux-atm/patches/200-no_libfl.patch @@ -0,0 +1,193 @@ +diff -ruN linux-atm-2.4.1/src/qgen/Makefile.am linux-atm-2.4.1.new/src/qgen/Makefile.am +--- linux-atm-2.4.1/src/qgen/Makefile.am 2001-09-03 20:41:05.000000000 +0200 ++++ linux-atm-2.4.1.new/src/qgen/Makefile.am 2005-07-26 14:49:05.000000000 +0200 +@@ -3,7 +3,7 @@ + + qgen_SOURCES = common.c common.h file.c file.h first.c ql_y.y ql_l.l qgen.c \ + qgen.h second.c third.c +-qgen_LDADD = -lfl ++qgen_LDADD = + + q_dump_SOURCES = common.c + q_dump_LDADD = qd.dump.standalone.o +diff -ruN linux-atm-2.4.1/src/qgen/Makefile.in linux-atm-2.4.1.new/src/qgen/Makefile.in +--- linux-atm-2.4.1/src/qgen/Makefile.in 2003-04-30 16:44:01.000000000 +0200 ++++ linux-atm-2.4.1.new/src/qgen/Makefile.in 2005-07-26 14:49:13.000000000 +0200 +@@ -91,7 +91,7 @@ + qgen_SOURCES = common.c common.h file.c file.h first.c ql_y.y ql_l.l qgen.c \ + qgen.h second.c third.c + +-qgen_LDADD = -lfl ++qgen_LDADD = + + q_dump_SOURCES = common.c + q_dump_LDADD = qd.dump.standalone.o +diff -ruN linux-atm-2.4.1/src/qgen/ql_l.c linux-atm-2.4.1.new/src/qgen/ql_l.c +--- linux-atm-2.4.1/src/qgen/ql_l.c 2003-04-24 21:46:49.000000000 +0200 ++++ linux-atm-2.4.1.new/src/qgen/ql_l.c 2005-07-26 20:45:40.000000000 +0200 +@@ -11,6 +11,11 @@ + #include <stdio.h> + #include <unistd.h> + ++int yywrap(void) ++{ ++ return 1; ++} ++ + + /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ + #ifdef c_plusplus +diff -ruN linux-atm-2.4.1/src/sigd/cfg_l.c linux-atm-2.4.1.new/src/sigd/cfg_l.c +--- linux-atm-2.4.1/src/sigd/cfg_l.c 2003-04-24 21:47:21.000000000 +0200 ++++ linux-atm-2.4.1.new/src/sigd/cfg_l.c 2005-07-26 22:04:13.000000000 +0200 +@@ -11,6 +11,10 @@ + #include <stdio.h> + #include <unistd.h> + ++int yywrap(void) ++{ ++ return 1; ++} + + /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ + #ifdef c_plusplus +diff -ruN linux-atm-2.4.1/src/sigd/Makefile.am linux-atm-2.4.1.new/src/sigd/Makefile.am +--- linux-atm-2.4.1/src/sigd/Makefile.am 2001-10-04 23:17:26.000000000 +0200 ++++ linux-atm-2.4.1.new/src/sigd/Makefile.am 2005-07-26 14:49:44.000000000 +0200 +@@ -8,7 +8,7 @@ + $(top_builddir)/src/qgen/qd.dump.o \ + $(top_builddir)/src/lib/libatm.la \ + $(top_builddir)/src/saal/libsaal.a +-atmsigd_LDADD = $(atmsigd_XTRAS) -lfl ++atmsigd_LDADD = $(atmsigd_XTRAS) + atmsigd_DEPENDENCIES = mess.c $(atmsigd_XTRAS) + + CLEANFILES = mess.c +diff -ruN linux-atm-2.4.1/src/sigd/Makefile.in linux-atm-2.4.1.new/src/sigd/Makefile.in +--- linux-atm-2.4.1/src/sigd/Makefile.in 2003-04-30 16:44:03.000000000 +0200 ++++ linux-atm-2.4.1.new/src/sigd/Makefile.in 2005-07-26 14:49:48.000000000 +0200 +@@ -97,7 +97,7 @@ + $(top_builddir)/src/lib/libatm.la \ + $(top_builddir)/src/saal/libsaal.a + +-atmsigd_LDADD = $(atmsigd_XTRAS) -lfl ++atmsigd_LDADD = $(atmsigd_XTRAS) + atmsigd_DEPENDENCIES = mess.c $(atmsigd_XTRAS) + + CLEANFILES = mess.c +diff -ruN linux-atm-2.4.1/src/switch/debug/debug.c linux-atm-2.4.1.new/src/switch/debug/debug.c +--- linux-atm-2.4.1/src/switch/debug/debug.c 2001-09-03 20:41:06.000000000 +0200 ++++ linux-atm-2.4.1.new/src/switch/debug/debug.c 2005-07-26 22:06:53.000000000 +0200 +@@ -20,6 +20,11 @@ + + #define PRV(call) ((FAB *) (call)->fab) + ++int yywrap(void) ++{ ++ return 1; ++} ++ + + typedef struct _fab { + CALL *next; /* relay.c may not keep track of calls, but WE are */ +diff -ruN linux-atm-2.4.1/src/switch/debug/Makefile.am linux-atm-2.4.1.new/src/switch/debug/Makefile.am +--- linux-atm-2.4.1/src/switch/debug/Makefile.am 2001-10-04 23:17:26.000000000 +0200 ++++ linux-atm-2.4.1.new/src/switch/debug/Makefile.am 2005-07-26 14:50:03.000000000 +0200 +@@ -5,7 +5,7 @@ + sw_debug_SOURCES = debug.c + sw_debug_XTRAS = $(top_builddir)/src/switch/libsw.a \ + $(top_builddir)/src/lib/libatm.la +-sw_debug_LDADD = $(sw_debug_XTRAS) -lfl ++sw_debug_LDADD = $(sw_debug_XTRAS) + + sw_debug_DEPENDENCIES = $(sw_debug_XTRAS) + +diff -ruN linux-atm-2.4.1/src/switch/debug/Makefile.in linux-atm-2.4.1.new/src/switch/debug/Makefile.in +--- linux-atm-2.4.1/src/switch/debug/Makefile.in 2003-04-30 16:44:13.000000000 +0200 ++++ linux-atm-2.4.1.new/src/switch/debug/Makefile.in 2005-07-26 14:50:08.000000000 +0200 +@@ -93,7 +93,7 @@ + sw_debug_XTRAS = $(top_builddir)/src/switch/libsw.a \ + $(top_builddir)/src/lib/libatm.la + +-sw_debug_LDADD = $(sw_debug_XTRAS) -lfl ++sw_debug_LDADD = $(sw_debug_XTRAS) + + sw_debug_DEPENDENCIES = $(sw_debug_XTRAS) + +diff -ruN linux-atm-2.4.1/src/switch/tcp/Makefile.am linux-atm-2.4.1.new/src/switch/tcp/Makefile.am +--- linux-atm-2.4.1/src/switch/tcp/Makefile.am 2001-10-04 23:17:27.000000000 +0200 ++++ linux-atm-2.4.1.new/src/switch/tcp/Makefile.am 2005-07-26 14:50:16.000000000 +0200 +@@ -5,7 +5,7 @@ + sw_tcp_SOURCES = tcpsw.c + sw_tcp_XTRAS = $(top_builddir)/src/switch/libsw.a \ + $(top_builddir)/src/lib/libatm.la +-sw_tcp_LDADD = $(sw_tcp_XTRAS) -lfl ++sw_tcp_LDADD = $(sw_tcp_XTRAS) + sw_tcp_DEPENDENCIES = $(sw_tcp_XTRAS) + + EXTRA_DIST = mkfiles README +diff -ruN linux-atm-2.4.1/src/switch/tcp/Makefile.in linux-atm-2.4.1.new/src/switch/tcp/Makefile.in +--- linux-atm-2.4.1/src/switch/tcp/Makefile.in 2003-04-30 16:44:14.000000000 +0200 ++++ linux-atm-2.4.1.new/src/switch/tcp/Makefile.in 2005-07-26 14:50:19.000000000 +0200 +@@ -93,7 +93,7 @@ + sw_tcp_XTRAS = $(top_builddir)/src/switch/libsw.a \ + $(top_builddir)/src/lib/libatm.la + +-sw_tcp_LDADD = $(sw_tcp_XTRAS) -lfl ++sw_tcp_LDADD = $(sw_tcp_XTRAS) + sw_tcp_DEPENDENCIES = $(sw_tcp_XTRAS) + + EXTRA_DIST = mkfiles README +diff -ruN linux-atm-2.4.1/src/switch/tcp/tcpsw.c linux-atm-2.4.1.new/src/switch/tcp/tcpsw.c +--- linux-atm-2.4.1/src/switch/tcp/tcpsw.c 2001-09-03 20:41:06.000000000 +0200 ++++ linux-atm-2.4.1.new/src/switch/tcp/tcpsw.c 2005-07-26 22:08:25.000000000 +0200 +@@ -35,6 +35,10 @@ + #define MAX_PACKET (ATM_MAX_AAL5_PDU+sizeof(struct atmtcp_hdr)) + #define BUFFER_SIZE (MAX_PACKET*2) + ++int yywrap(void) ++{ ++ return 1; ++} + + typedef struct _table { + struct _link *out; /* output port */ +diff -ruN linux-atm-2.4.1/src/test/ispl_l.c linux-atm-2.4.1.new/src/test/ispl_l.c +--- linux-atm-2.4.1/src/test/ispl_l.c 2003-04-24 21:46:39.000000000 +0200 ++++ linux-atm-2.4.1.new/src/test/ispl_l.c 2005-07-26 20:45:19.000000000 +0200 +@@ -11,6 +11,11 @@ + #include <stdio.h> + #include <unistd.h> + ++int yywrap(void) ++{ ++ return 1; ++} ++ + + /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ + #ifdef c_plusplus +diff -ruN linux-atm-2.4.1/src/test/Makefile.am linux-atm-2.4.1.new/src/test/Makefile.am +--- linux-atm-2.4.1/src/test/Makefile.am 2001-10-04 23:17:27.000000000 +0200 ++++ linux-atm-2.4.1.new/src/test/Makefile.am 2005-07-26 14:49:27.000000000 +0200 +@@ -15,7 +15,7 @@ + bw_SOURCES = bw.c + isp_SOURCES = isp.c isp.h ispl_y.y ispl_l.l + isp_XTRAS = $(LDADD) +-isp_LDADD = $(isp_XTRAS) -lfl ++isp_LDADD = $(isp_XTRAS) + isp_DEPENDENCIES = $(isp_XTRAS) errnos.inc + window_SOURCES = window.c + +diff -ruN linux-atm-2.4.1/src/test/Makefile.in linux-atm-2.4.1.new/src/test/Makefile.in +--- linux-atm-2.4.1/src/test/Makefile.in 2003-04-30 16:43:59.000000000 +0200 ++++ linux-atm-2.4.1.new/src/test/Makefile.in 2005-07-26 14:49:32.000000000 +0200 +@@ -102,7 +102,7 @@ + bw_SOURCES = bw.c + isp_SOURCES = isp.c isp.h ispl_y.y ispl_l.l + isp_XTRAS = $(LDADD) +-isp_LDADD = $(isp_XTRAS) -lfl ++isp_LDADD = $(isp_XTRAS) + isp_DEPENDENCIES = $(isp_XTRAS) errnos.inc + window_SOURCES = window.c + diff --git a/package/linux-atm/patches/300-no_autotools.patch b/package/linux-atm/patches/300-no_autotools.patch new file mode 100644 index 0000000000..73427296c9 --- /dev/null +++ b/package/linux-atm/patches/300-no_autotools.patch @@ -0,0 +1,12014 @@ +diff -urN linux-atm.old/aclocal.m4 linux-atm.dev/aclocal.m4 +--- linux-atm.old/aclocal.m4 2005-08-23 01:12:10.833789000 +0200 ++++ linux-atm.dev/aclocal.m4 2005-08-23 01:12:44.813623720 +0200 +@@ -10,6 +10,825 @@ + dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A + dnl PARTICULAR PURPOSE. + ++# lib-prefix.m4 serial 4 (gettext-0.14.2) ++dnl Copyright (C) 2001-2005 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++dnl From Bruno Haible. ++ ++dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and ++dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't ++dnl require excessive bracketing. ++ifdef([AC_HELP_STRING], ++[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])], ++[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])]) ++ ++dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed ++dnl to access previously installed libraries. The basic assumption is that ++dnl a user will want packages to use other packages he previously installed ++dnl with the same --prefix option. ++dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate ++dnl libraries, but is otherwise very convenient. ++AC_DEFUN([AC_LIB_PREFIX], ++[ ++ AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) ++ AC_REQUIRE([AC_PROG_CC]) ++ AC_REQUIRE([AC_CANONICAL_HOST]) ++ AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) ++ dnl By default, look in $includedir and $libdir. ++ use_additional=yes ++ AC_LIB_WITH_FINAL_PREFIX([ ++ eval additional_includedir=\"$includedir\" ++ eval additional_libdir=\"$libdir\" ++ ]) ++ AC_LIB_ARG_WITH([lib-prefix], ++[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib ++ --without-lib-prefix don't search for libraries in includedir and libdir], ++[ ++ if test "X$withval" = "Xno"; then ++ use_additional=no ++ else ++ if test "X$withval" = "X"; then ++ AC_LIB_WITH_FINAL_PREFIX([ ++ eval additional_includedir=\"$includedir\" ++ eval additional_libdir=\"$libdir\" ++ ]) ++ else ++ additional_includedir="$withval/include" ++ additional_libdir="$withval/lib" ++ fi ++ fi ++]) ++ if test $use_additional = yes; then ++ dnl Potentially add $additional_includedir to $CPPFLAGS. ++ dnl But don't add it ++ dnl 1. if it's the standard /usr/include, ++ dnl 2. if it's already present in $CPPFLAGS, ++ dnl 3. if it's /usr/local/include and we are using GCC on Linux, ++ dnl 4. if it doesn't exist as a directory. ++ if test "X$additional_includedir" != "X/usr/include"; then ++ haveit= ++ for x in $CPPFLAGS; do ++ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) ++ if test "X$x" = "X-I$additional_includedir"; then ++ haveit=yes ++ break ++ fi ++ done ++ if test -z "$haveit"; then ++ if test "X$additional_includedir" = "X/usr/local/include"; then ++ if test -n "$GCC"; then ++ case $host_os in ++ linux* | gnu* | k*bsd*-gnu) haveit=yes;; ++ esac ++ fi ++ fi ++ if test -z "$haveit"; then ++ if test -d "$additional_includedir"; then ++ dnl Really add $additional_includedir to $CPPFLAGS. ++ CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" ++ fi ++ fi ++ fi ++ fi ++ dnl Potentially add $additional_libdir to $LDFLAGS. ++ dnl But don't add it ++ dnl 1. if it's the standard /usr/lib, ++ dnl 2. if it's already present in $LDFLAGS, ++ dnl 3. if it's /usr/local/lib and we are using GCC on Linux, ++ dnl 4. if it doesn't exist as a directory. ++ if test "X$additional_libdir" != "X/usr/lib"; then ++ haveit= ++ for x in $LDFLAGS; do ++ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) ++ if test "X$x" = "X-L$additional_libdir"; then ++ haveit=yes ++ break ++ fi ++ done ++ if test -z "$haveit"; then ++ if test "X$additional_libdir" = "X/usr/local/lib"; then ++ if test -n "$GCC"; then ++ case $host_os in ++ linux*) haveit=yes;; ++ esac ++ fi ++ fi ++ if test -z "$haveit"; then ++ if test -d "$additional_libdir"; then ++ dnl Really add $additional_libdir to $LDFLAGS. ++ LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" ++ fi ++ fi ++ fi ++ fi ++ fi ++]) ++ ++dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, ++dnl acl_final_exec_prefix, containing the values to which $prefix and ++dnl $exec_prefix will expand at the end of the configure script. ++AC_DEFUN([AC_LIB_PREPARE_PREFIX], ++[ ++ dnl Unfortunately, prefix and exec_prefix get only finally determined ++ dnl at the end of configure. ++ if test "X$prefix" = "XNONE"; then ++ acl_final_prefix="$ac_default_prefix" ++ else ++ acl_final_prefix="$prefix" ++ fi ++ if test "X$exec_prefix" = "XNONE"; then ++ acl_final_exec_prefix='${prefix}' ++ else ++ acl_final_exec_prefix="$exec_prefix" ++ fi ++ acl_save_prefix="$prefix" ++ prefix="$acl_final_prefix" ++ eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" ++ prefix="$acl_save_prefix" ++]) ++ ++dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the ++dnl variables prefix and exec_prefix bound to the values they will have ++dnl at the end of the configure script. ++AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], ++[ ++ acl_save_prefix="$prefix" ++ prefix="$acl_final_prefix" ++ acl_save_exec_prefix="$exec_prefix" ++ exec_prefix="$acl_final_exec_prefix" ++ $1 ++ exec_prefix="$acl_save_exec_prefix" ++ prefix="$acl_save_prefix" ++]) ++ ++# lib-link.m4 serial 6 (gettext-0.14.3) ++dnl Copyright (C) 2001-2005 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++dnl From Bruno Haible. ++ ++AC_PREREQ(2.50) ++ ++dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and ++dnl the libraries corresponding to explicit and implicit dependencies. ++dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and ++dnl augments the CPPFLAGS variable. ++AC_DEFUN([AC_LIB_LINKFLAGS], ++[ ++ AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) ++ AC_REQUIRE([AC_LIB_RPATH]) ++ define([Name],[translit([$1],[./-], [___])]) ++ define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], ++ [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) ++ AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ ++ AC_LIB_LINKFLAGS_BODY([$1], [$2]) ++ ac_cv_lib[]Name[]_libs="$LIB[]NAME" ++ ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME" ++ ac_cv_lib[]Name[]_cppflags="$INC[]NAME" ++ ]) ++ LIB[]NAME="$ac_cv_lib[]Name[]_libs" ++ LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs" ++ INC[]NAME="$ac_cv_lib[]Name[]_cppflags" ++ AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) ++ AC_SUBST([LIB]NAME) ++ AC_SUBST([LTLIB]NAME) ++ dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the ++ dnl results of this search when this library appears as a dependency. ++ HAVE_LIB[]NAME=yes ++ undefine([Name]) ++ undefine([NAME]) ++]) ++ ++dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode) ++dnl searches for libname and the libraries corresponding to explicit and ++dnl implicit dependencies, together with the specified include files and ++dnl the ability to compile and link the specified testcode. If found, it ++dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and ++dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and ++dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs ++dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty. ++AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], ++[ ++ AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) ++ AC_REQUIRE([AC_LIB_RPATH]) ++ define([Name],[translit([$1],[./-], [___])]) ++ define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], ++ [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) ++ ++ dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME ++ dnl accordingly. ++ AC_LIB_LINKFLAGS_BODY([$1], [$2]) ++ ++ dnl Add $INC[]NAME to CPPFLAGS before performing the following checks, ++ dnl because if the user has installed lib[]Name and not disabled its use ++ dnl via --without-lib[]Name-prefix, he wants to use it. ++ ac_save_CPPFLAGS="$CPPFLAGS" ++ AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) ++ ++ AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [ ++ ac_save_LIBS="$LIBS" ++ LIBS="$LIBS $LIB[]NAME" ++ AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no]) ++ LIBS="$ac_save_LIBS" ++ ]) ++ if test "$ac_cv_lib[]Name" = yes; then ++ HAVE_LIB[]NAME=yes ++ AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.]) ++ AC_MSG_CHECKING([how to link with lib[]$1]) ++ AC_MSG_RESULT([$LIB[]NAME]) ++ else ++ HAVE_LIB[]NAME=no ++ dnl If $LIB[]NAME didn't lead to a usable library, we don't need ++ dnl $INC[]NAME either. ++ CPPFLAGS="$ac_save_CPPFLAGS" ++ LIB[]NAME= ++ LTLIB[]NAME= ++ fi ++ AC_SUBST([HAVE_LIB]NAME) ++ AC_SUBST([LIB]NAME) ++ AC_SUBST([LTLIB]NAME) ++ undefine([Name]) ++ undefine([NAME]) ++]) ++ ++dnl Determine the platform dependent parameters needed to use rpath: ++dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator, ++dnl hardcode_direct, hardcode_minus_L. ++AC_DEFUN([AC_LIB_RPATH], ++[ ++ dnl Tell automake >= 1.10 to complain if config.rpath is missing. ++ m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])]) ++ AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS ++ AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld ++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host ++ AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir ++ AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [ ++ CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ ++ ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh ++ . ./conftest.sh ++ rm -f ./conftest.sh ++ acl_cv_rpath=done ++ ]) ++ wl="$acl_cv_wl" ++ libext="$acl_cv_libext" ++ shlibext="$acl_cv_shlibext" ++ hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" ++ hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" ++ hardcode_direct="$acl_cv_hardcode_direct" ++ hardcode_minus_L="$acl_cv_hardcode_minus_L" ++ dnl Determine whether the user wants rpath handling at all. ++ AC_ARG_ENABLE(rpath, ++ [ --disable-rpath do not hardcode runtime library paths], ++ :, enable_rpath=yes) ++]) ++ ++dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and ++dnl the libraries corresponding to explicit and implicit dependencies. ++dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. ++AC_DEFUN([AC_LIB_LINKFLAGS_BODY], ++[ ++ define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], ++ [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) ++ dnl By default, look in $includedir and $libdir. ++ use_additional=yes ++ AC_LIB_WITH_FINAL_PREFIX([ ++ eval additional_includedir=\"$includedir\" ++ eval additional_libdir=\"$libdir\" ++ ]) ++ AC_LIB_ARG_WITH([lib$1-prefix], ++[ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib ++ --without-lib$1-prefix don't search for lib$1 in includedir and libdir], ++[ ++ if test "X$withval" = "Xno"; then ++ use_additional=no ++ else ++ if test "X$withval" = "X"; then ++ AC_LIB_WITH_FINAL_PREFIX([ ++ eval additional_includedir=\"$includedir\" ++ eval additional_libdir=\"$libdir\" ++ ]) ++ else ++ additional_includedir="$withval/include" ++ additional_libdir="$withval/lib" ++ fi ++ fi ++]) ++ dnl Search the library and its dependencies in $additional_libdir and ++ dnl $LDFLAGS. Using breadth-first-seach. ++ LIB[]NAME= ++ LTLIB[]NAME= ++ INC[]NAME= ++ rpathdirs= ++ ltrpathdirs= ++ names_already_handled= ++ names_next_round='$1 $2' ++ while test -n "$names_next_round"; do ++ names_this_round="$names_next_round" ++ names_next_round= ++ for name in $names_this_round; do ++ already_handled= ++ for n in $names_already_handled; do ++ if test "$n" = "$name"; then ++ already_handled=yes ++ break ++ fi ++ done ++ if test -z "$already_handled"; then ++ names_already_handled="$names_already_handled $name" ++ dnl See if it was already located by an earlier AC_LIB_LINKFLAGS ++ dnl or AC_LIB_HAVE_LINKFLAGS call. ++ uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` ++ eval value=\"\$HAVE_LIB$uppername\" ++ if test -n "$value"; then ++ if test "$value" = yes; then ++ eval value=\"\$LIB$uppername\" ++ test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value" ++ eval value=\"\$LTLIB$uppername\" ++ test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value" ++ else ++ dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined ++ dnl that this library doesn't exist. So just drop it. ++ : ++ fi ++ else ++ dnl Search the library lib$name in $additional_libdir and $LDFLAGS ++ dnl and the already constructed $LIBNAME/$LTLIBNAME. ++ found_dir= ++ found_la= ++ found_so= ++ found_a= ++ if test $use_additional = yes; then ++ if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then ++ found_dir="$additional_libdir" ++ found_so="$additional_libdir/lib$name.$shlibext" ++ if test -f "$additional_libdir/lib$name.la"; then ++ found_la="$additional_libdir/lib$name.la" ++ fi ++ else ++ if test -f "$additional_libdir/lib$name.$libext"; then ++ found_dir="$additional_libdir" ++ found_a="$additional_libdir/lib$name.$libext" ++ if test -f "$additional_libdir/lib$name.la"; then ++ found_la="$additional_libdir/lib$name.la" ++ fi ++ fi ++ fi ++ fi ++ if test "X$found_dir" = "X"; then ++ for x in $LDFLAGS $LTLIB[]NAME; do ++ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) ++ case "$x" in ++ -L*) ++ dir=`echo "X$x" | sed -e 's/^X-L//'` ++ if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then ++ found_dir="$dir" ++ found_so="$dir/lib$name.$shlibext" ++ if test -f "$dir/lib$name.la"; then ++ found_la="$dir/lib$name.la" ++ fi ++ else ++ if test -f "$dir/lib$name.$libext"; then ++ found_dir="$dir" ++ found_a="$dir/lib$name.$libext" ++ if test -f "$dir/lib$name.la"; then ++ found_la="$dir/lib$name.la" ++ fi ++ fi ++ fi ++ ;; ++ esac ++ if test "X$found_dir" != "X"; then ++ break ++ fi ++ done ++ fi ++ if test "X$found_dir" != "X"; then ++ dnl Found the library. ++ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name" ++ if test "X$found_so" != "X"; then ++ dnl Linking with a shared library. We attempt to hardcode its ++ dnl directory into the executable's runpath, unless it's the ++ dnl standard /usr/lib. ++ if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then ++ dnl No hardcoding is needed. ++ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" ++ else ++ dnl Use an explicit option to hardcode DIR into the resulting ++ dnl binary. ++ dnl Potentially add DIR to ltrpathdirs. ++ dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. ++ haveit= ++ for x in $ltrpathdirs; do ++ if test "X$x" = "X$found_dir"; then ++ haveit=yes ++ break ++ fi ++ done ++ if test -z "$haveit"; then ++ ltrpathdirs="$ltrpathdirs $found_dir" ++ fi ++ dnl The hardcoding into $LIBNAME is system dependent. ++ if test "$hardcode_direct" = yes; then ++ dnl Using DIR/libNAME.so during linking hardcodes DIR into the ++ dnl resulting binary. ++ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" ++ else ++ if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then ++ dnl Use an explicit option to hardcode DIR into the resulting ++ dnl binary. ++ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" ++ dnl Potentially add DIR to rpathdirs. ++ dnl The rpathdirs will be appended to $LIBNAME at the end. ++ haveit= ++ for x in $rpathdirs; do ++ if test "X$x" = "X$found_dir"; then ++ haveit=yes ++ break ++ fi ++ done ++ if test -z "$haveit"; then ++ rpathdirs="$rpathdirs $found_dir" ++ fi ++ else ++ dnl Rely on "-L$found_dir". ++ dnl But don't add it if it's already contained in the LDFLAGS ++ dnl or the already constructed $LIBNAME ++ haveit= ++ for x in $LDFLAGS $LIB[]NAME; do ++ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) ++ if test "X$x" = "X-L$found_dir"; then ++ haveit=yes ++ break ++ fi ++ done ++ if test -z "$haveit"; then ++ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" ++ fi ++ if test "$hardcode_minus_L" != no; then ++ dnl FIXME: Not sure whether we should use ++ dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" ++ dnl here. ++ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" ++ else ++ dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH ++ dnl here, because this doesn't fit in flags passed to the ++ dnl compiler. So give up. No hardcoding. This affects only ++ dnl very old systems. ++ dnl FIXME: Not sure whether we should use ++ dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" ++ dnl here. ++ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" ++ fi ++ fi ++ fi ++ fi ++ else ++ if test "X$found_a" != "X"; then ++ dnl Linking with a static library. ++ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" ++ else ++ dnl We shouldn't come here, but anyway it's good to have a ++ dnl fallback. ++ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" ++ fi ++ fi ++ dnl Assume the include files are nearby. ++ additional_includedir= ++ case "$found_dir" in ++ */lib | */lib/) ++ basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` ++ additional_includedir="$basedir/include" ++ ;; ++ esac ++ if test "X$additional_includedir" != "X"; then ++ dnl Potentially add $additional_includedir to $INCNAME. ++ dnl But don't add it ++ dnl 1. if it's the standard /usr/include, ++ dnl 2. if it's /usr/local/include and we are using GCC on Linux, ++ dnl 3. if it's already present in $CPPFLAGS or the already ++ dnl constructed $INCNAME, ++ dnl 4. if it doesn't exist as a directory. ++ if test "X$additional_includedir" != "X/usr/include"; then ++ haveit= ++ if test "X$additional_includedir" = "X/usr/local/include"; then ++ if test -n "$GCC"; then ++ case $host_os in ++ linux* | gnu* | k*bsd*-gnu) haveit=yes;; ++ esac ++ fi ++ fi ++ if test -z "$haveit"; then ++ for x in $CPPFLAGS $INC[]NAME; do ++ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) ++ if test "X$x" = "X-I$additional_includedir"; then ++ haveit=yes ++ break ++ fi ++ done ++ if test -z "$haveit"; then ++ if test -d "$additional_includedir"; then ++ dnl Really add $additional_includedir to $INCNAME. ++ INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" ++ fi ++ fi ++ fi ++ fi ++ fi ++ dnl Look for dependencies. ++ if test -n "$found_la"; then ++ dnl Read the .la file. It defines the variables ++ dnl dlname, library_names, old_library, dependency_libs, current, ++ dnl age, revision, installed, dlopen, dlpreopen, libdir. ++ save_libdir="$libdir" ++ case "$found_la" in ++ */* | *\\*) . "$found_la" ;; ++ *) . "./$found_la" ;; ++ esac ++ libdir="$save_libdir" ++ dnl We use only dependency_libs. ++ for dep in $dependency_libs; do ++ case "$dep" in ++ -L*) ++ additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` ++ dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME. ++ dnl But don't add it ++ dnl 1. if it's the standard /usr/lib, ++ dnl 2. if it's /usr/local/lib and we are using GCC on Linux, ++ dnl 3. if it's already present in $LDFLAGS or the already ++ dnl constructed $LIBNAME, ++ dnl 4. if it doesn't exist as a directory. ++ if test "X$additional_libdir" != "X/usr/lib"; then ++ haveit= ++ if test "X$additional_libdir" = "X/usr/local/lib"; then ++ if test -n "$GCC"; then ++ case $host_os in ++ linux* | gnu* | k*bsd*-gnu) haveit=yes;; ++ esac ++ fi ++ fi ++ if test -z "$haveit"; then ++ haveit= ++ for x in $LDFLAGS $LIB[]NAME; do ++ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) ++ if test "X$x" = "X-L$additional_libdir"; then ++ haveit=yes ++ break ++ fi ++ done ++ if test -z "$haveit"; then ++ if test -d "$additional_libdir"; then ++ dnl Really add $additional_libdir to $LIBNAME. ++ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir" ++ fi ++ fi ++ haveit= ++ for x in $LDFLAGS $LTLIB[]NAME; do ++ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) ++ if test "X$x" = "X-L$additional_libdir"; then ++ haveit=yes ++ break ++ fi ++ done ++ if test -z "$haveit"; then ++ if test -d "$additional_libdir"; then ++ dnl Really add $additional_libdir to $LTLIBNAME. ++ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir" ++ fi ++ fi ++ fi ++ fi ++ ;; ++ -R*) ++ dir=`echo "X$dep" | sed -e 's/^X-R//'` ++ if test "$enable_rpath" != no; then ++ dnl Potentially add DIR to rpathdirs. ++ dnl The rpathdirs will be appended to $LIBNAME at the end. ++ haveit= ++ for x in $rpathdirs; do ++ if test "X$x" = "X$dir"; then ++ haveit=yes ++ break ++ fi ++ done ++ if test -z "$haveit"; then ++ rpathdirs="$rpathdirs $dir" ++ fi ++ dnl Potentially add DIR to ltrpathdirs. ++ dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. ++ haveit= ++ for x in $ltrpathdirs; do ++ if test "X$x" = "X$dir"; then ++ haveit=yes ++ break ++ fi ++ done ++ if test -z "$haveit"; then ++ ltrpathdirs="$ltrpathdirs $dir" ++ fi ++ fi ++ ;; ++ -l*) ++ dnl Handle this in the next round. ++ names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` ++ ;; ++ *.la) ++ dnl Handle this in the next round. Throw away the .la's ++ dnl directory; it is already contained in a preceding -L ++ dnl option. ++ names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` ++ ;; ++ *) ++ dnl Most likely an immediate library name. ++ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep" ++ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep" ++ ;; ++ esac ++ done ++ fi ++ else ++ dnl Didn't find the library; assume it is in the system directories ++ dnl known to the linker and runtime loader. (All the system ++ dnl directories known to the linker should also be known to the ++ dnl runtime loader, otherwise the system is severely misconfigured.) ++ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" ++ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" ++ fi ++ fi ++ fi ++ done ++ done ++ if test "X$rpathdirs" != "X"; then ++ if test -n "$hardcode_libdir_separator"; then ++ dnl Weird platform: only the last -rpath option counts, the user must ++ dnl pass all path elements in one option. We can arrange that for a ++ dnl single library, but not when more than one $LIBNAMEs are used. ++ alldirs= ++ for found_dir in $rpathdirs; do ++ alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" ++ done ++ dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl. ++ acl_save_libdir="$libdir" ++ libdir="$alldirs" ++ eval flag=\"$hardcode_libdir_flag_spec\" ++ libdir="$acl_save_libdir" ++ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" ++ else ++ dnl The -rpath options are cumulative. ++ for found_dir in $rpathdirs; do ++ acl_save_libdir="$libdir" ++ libdir="$found_dir" ++ eval flag=\"$hardcode_libdir_flag_spec\" ++ libdir="$acl_save_libdir" ++ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" ++ done ++ fi ++ fi ++ if test "X$ltrpathdirs" != "X"; then ++ dnl When using libtool, the option that works for both libraries and ++ dnl executables is -R. The -R options are cumulative. ++ for found_dir in $ltrpathdirs; do ++ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" ++ done ++ fi ++]) ++ ++dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, ++dnl unless already present in VAR. ++dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes ++dnl contains two or three consecutive elements that belong together. ++AC_DEFUN([AC_LIB_APPENDTOVAR], ++[ ++ for element in [$2]; do ++ haveit= ++ for x in $[$1]; do ++ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) ++ if test "X$x" = "X$element"; then ++ haveit=yes ++ break ++ fi ++ done ++ if test -z "$haveit"; then ++ [$1]="${[$1]}${[$1]:+ }$element" ++ fi ++ done ++]) ++ ++# lib-ld.m4 serial 3 (gettext-0.13) ++dnl Copyright (C) 1996-2003 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++dnl Subroutines of libtool.m4, ++dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision ++dnl with libtool.m4. ++ ++dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no. ++AC_DEFUN([AC_LIB_PROG_LD_GNU], ++[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld, ++[# I'd rather use --version here, but apparently some GNU ld's only accept -v. ++case `$LD -v 2>&1 </dev/null` in ++*GNU* | *'with BFD'*) ++ acl_cv_prog_gnu_ld=yes ;; ++*) ++ acl_cv_prog_gnu_ld=no ;; ++esac]) ++with_gnu_ld=$acl_cv_prog_gnu_ld ++]) ++ ++dnl From libtool-1.4. Sets the variable LD. ++AC_DEFUN([AC_LIB_PROG_LD], ++[AC_ARG_WITH(gnu-ld, ++[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], ++test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) ++AC_REQUIRE([AC_PROG_CC])dnl ++AC_REQUIRE([AC_CANONICAL_HOST])dnl ++# Prepare PATH_SEPARATOR. ++# The user is always right. ++if test "${PATH_SEPARATOR+set}" != set; then ++ echo "#! /bin/sh" >conf$$.sh ++ echo "exit 0" >>conf$$.sh ++ chmod +x conf$$.sh ++ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then ++ PATH_SEPARATOR=';' ++ else ++ PATH_SEPARATOR=: ++ fi ++ rm -f conf$$.sh ++fi ++ac_prog=ld ++if test "$GCC" = yes; then ++ # Check if gcc -print-prog-name=ld gives a path. ++ AC_MSG_CHECKING([for ld used by GCC]) ++ case $host in ++ *-*-mingw*) ++ # gcc leaves a trailing carriage return which upsets mingw ++ ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; ++ *) ++ ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; ++ esac ++ case $ac_prog in ++ # Accept absolute paths. ++ [[\\/]* | [A-Za-z]:[\\/]*)] ++ [re_direlt='/[^/][^/]*/\.\./'] ++ # Canonicalize the path of ld ++ ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` ++ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ++ ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` ++ done ++ test -z "$LD" && LD="$ac_prog" ++ ;; ++ "") ++ # If it fails, then pretend we aren't using GCC. ++ ac_prog=ld ++ ;; ++ *) ++ # If it is relative, then search for the first ld in PATH. ++ with_gnu_ld=unknown ++ ;; ++ esac ++elif test "$with_gnu_ld" = yes; then ++ AC_MSG_CHECKING([for GNU ld]) ++else ++ AC_MSG_CHECKING([for non-GNU ld]) ++fi ++AC_CACHE_VAL(acl_cv_path_LD, ++[if test -z "$LD"; then ++ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" ++ for ac_dir in $PATH; do ++ test -z "$ac_dir" && ac_dir=. ++ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then ++ acl_cv_path_LD="$ac_dir/$ac_prog" ++ # Check to see if the program is GNU ld. I'd rather use --version, ++ # but apparently some GNU ld's only accept -v. ++ # Break only if it was the GNU/non-GNU ld that we prefer. ++ case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in ++ *GNU* | *'with BFD'*) ++ test "$with_gnu_ld" != no && break ;; ++ *) ++ test "$with_gnu_ld" != yes && break ;; ++ esac ++ fi ++ done ++ IFS="$ac_save_ifs" ++else ++ acl_cv_path_LD="$LD" # Let the user override the test with a path. ++fi]) ++LD="$acl_cv_path_LD" ++if test -n "$LD"; then ++ AC_MSG_RESULT($LD) ++else ++ AC_MSG_RESULT(no) ++fi ++test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) ++AC_LIB_PROG_LD_GNU ++]) ++ + # Like AC_CONFIG_HEADER, but automatically create stamp file. + + AC_DEFUN([AM_CONFIG_HEADER], +@@ -164,12 +983,64 @@ + AC_PROG_LEX + AC_DECL_YYTEXT]) + +-# libtool.m4 - Configure libtool for the host system. -*-Shell-script-*- ++# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- + +-# serial 46 AC_PROG_LIBTOOL ++# serial 47 AC_PROG_LIBTOOL ++# Debian $Rev$ + ++ ++# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) ++# ----------------------------------------------------------- ++# If this macro is not defined by Autoconf, define it here. ++m4_ifdef([AC_PROVIDE_IFELSE], ++ [], ++ [m4_define([AC_PROVIDE_IFELSE], ++ [m4_ifdef([AC_PROVIDE_$1], ++ [$2], [$3])])]) ++ ++ ++# AC_PROG_LIBTOOL ++# --------------- + AC_DEFUN([AC_PROG_LIBTOOL], ++[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl ++dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX ++dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX. ++ AC_PROVIDE_IFELSE([AC_PROG_CXX], ++ [AC_LIBTOOL_CXX], ++ [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX ++ ])]) ++dnl And a similar setup for Fortran 77 support ++ AC_PROVIDE_IFELSE([AC_PROG_F77], ++ [AC_LIBTOOL_F77], ++ [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77 ++])]) ++ ++dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly. ++dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run ++dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both. ++ AC_PROVIDE_IFELSE([AC_PROG_GCJ], ++ [AC_LIBTOOL_GCJ], ++ [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], ++ [AC_LIBTOOL_GCJ], ++ [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ], ++ [AC_LIBTOOL_GCJ], ++ [ifdef([AC_PROG_GCJ], ++ [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])]) ++ ifdef([A][M_PROG_GCJ], ++ [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])]) ++ ifdef([LT_AC_PROG_GCJ], ++ [define([LT_AC_PROG_GCJ], ++ defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])]) ++])])# AC_PROG_LIBTOOL ++ ++ ++# _AC_PROG_LIBTOOL ++# ---------------- ++AC_DEFUN([_AC_PROG_LIBTOOL], + [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl ++AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl ++AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl ++AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl + + # This can be used to rebuild libtool when needed + LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" +@@ -180,10 +1051,13 @@ + + # Prevent multiple expansion + define([AC_PROG_LIBTOOL], []) +-]) ++])# _AC_PROG_LIBTOOL + ++ ++# AC_LIBTOOL_SETUP ++# ---------------- + AC_DEFUN([AC_LIBTOOL_SETUP], +-[AC_PREREQ(2.13)dnl ++[AC_PREREQ(2.50)dnl + AC_REQUIRE([AC_ENABLE_SHARED])dnl + AC_REQUIRE([AC_ENABLE_STATIC])dnl + AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl +@@ -193,15 +1067,103 @@ + AC_REQUIRE([AC_PROG_LD])dnl + AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl + AC_REQUIRE([AC_PROG_NM])dnl +-AC_REQUIRE([LT_AC_PROG_SED])dnl + + AC_REQUIRE([AC_PROG_LN_S])dnl + AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl ++# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! + AC_REQUIRE([AC_OBJEXT])dnl + AC_REQUIRE([AC_EXEEXT])dnl + dnl + ++AC_LIBTOOL_SYS_MAX_CMD_LEN ++AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE ++AC_LIBTOOL_OBJDIR ++ ++AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl + _LT_AC_PROG_ECHO_BACKSLASH ++ ++case $host_os in ++aix3*) ++ # AIX sometimes has problems with the GCC collect2 program. For some ++ # reason, if we set the COLLECT_NAMES environment variable, the problems ++ # vanish in a puff of smoke. ++ if test "X${COLLECT_NAMES+set}" != Xset; then ++ COLLECT_NAMES= ++ export COLLECT_NAMES ++ fi ++ ;; ++esac ++ ++# Sed substitution that helps us do robust quoting. It backslashifies ++# metacharacters that are still active within double-quoted strings. ++Xsed='sed -e s/^X//' ++[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] ++ ++# Same as above, but do not quote variable references. ++[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'] ++ ++# Sed substitution to delay expansion of an escaped shell variable in a ++# double_quote_subst'ed string. ++delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' ++ ++# Sed substitution to avoid accidental globbing in evaled expressions ++no_glob_subst='s/\*/\\\*/g' ++ ++# Constants: ++rm="rm -f" ++ ++# Global variables: ++default_ofile=libtool ++can_build_shared=yes ++ ++# All known linkers require a `.a' archive for static linking (except M$VC, ++# which needs '.lib'). ++libext=a ++ltmain="$ac_aux_dir/ltmain.sh" ++ofile="$default_ofile" ++with_gnu_ld="$lt_cv_prog_gnu_ld" ++ ++AC_CHECK_TOOL(AR, ar, false) ++AC_CHECK_TOOL(RANLIB, ranlib, :) ++AC_CHECK_TOOL(STRIP, strip, :) ++ ++old_CC="$CC" ++old_CFLAGS="$CFLAGS" ++ ++# Set sane defaults for various variables ++test -z "$AR" && AR=ar ++test -z "$AR_FLAGS" && AR_FLAGS=cru ++test -z "$AS" && AS=as ++test -z "$CC" && CC=cc ++test -z "$LTCC" && LTCC=$CC ++test -z "$DLLTOOL" && DLLTOOL=dlltool ++test -z "$LD" && LD=ld ++test -z "$LN_S" && LN_S="ln -s" ++test -z "$MAGIC_CMD" && MAGIC_CMD=file ++test -z "$NM" && NM=nm ++test -z "$SED" && SED=sed ++test -z "$OBJDUMP" && OBJDUMP=objdump ++test -z "$RANLIB" && RANLIB=: ++test -z "$STRIP" && STRIP=: ++test -z "$ac_objext" && ac_objext=o ++ ++# Determine commands to create old-style static archives. ++old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' ++old_postinstall_cmds='chmod 644 $oldlib' ++old_postuninstall_cmds= ++ ++if test -n "$RANLIB"; then ++ case $host_os in ++ openbsd*) ++ old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" ++ ;; ++ *) ++ old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" ++ ;; ++ esac ++ old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" ++fi ++ + # Only perform the check for file, if the check method requires it + case $deplibs_check_method in + file_magic*) +@@ -211,327 +1173,78 @@ + ;; + esac + +-AC_CHECK_TOOL(RANLIB, ranlib, :) +-AC_CHECK_TOOL(STRIP, strip, :) +- +-ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) +-ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], ++AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) ++AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], + enable_win32_dll=yes, enable_win32_dll=no) + +-AC_ARG_ENABLE(libtool-lock, +- [ --disable-libtool-lock avoid locking (might break parallel builds)]) ++AC_ARG_ENABLE([libtool-lock], ++ [AC_HELP_STRING([--disable-libtool-lock], ++ [avoid locking (might break parallel builds)])]) + test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +-# Some flags need to be propagated to the compiler or linker for good +-# libtool support. +-case $host in +-*-*-irix6*) +- # Find out which ABI we are using. +- echo '[#]line __oline__ "configure"' > conftest.$ac_ext +- if AC_TRY_EVAL(ac_compile); then +- case `/usr/bin/file conftest.$ac_objext` in +- *32-bit*) +- LD="${LD-ld} -32" +- ;; +- *N32*) +- LD="${LD-ld} -n32" +- ;; +- *64-bit*) +- LD="${LD-ld} -64" +- ;; +- esac +- fi +- rm -rf conftest* +- ;; ++AC_ARG_WITH([pic], ++ [AC_HELP_STRING([--with-pic], ++ [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], ++ [pic_mode="$withval"], ++ [pic_mode=default]) ++test -z "$pic_mode" && pic_mode=default + +-*-*-sco3.2v5*) +- # On SCO OpenServer 5, we need -belf to get full-featured binaries. +- SAVE_CFLAGS="$CFLAGS" +- CFLAGS="$CFLAGS -belf" +- AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, +- [AC_LANG_SAVE +- AC_LANG_C +- AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) +- AC_LANG_RESTORE]) +- if test x"$lt_cv_cc_needs_belf" != x"yes"; then +- # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf +- CFLAGS="$SAVE_CFLAGS" +- fi +- ;; ++# Use C for the default configuration in the libtool script ++tagname= ++AC_LIBTOOL_LANG_C_CONFIG ++_LT_AC_TAGCONFIG ++])# AC_LIBTOOL_SETUP + +-ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +-[*-*-cygwin* | *-*-mingw* | *-*-pw32*) +- AC_CHECK_TOOL(DLLTOOL, dlltool, false) +- AC_CHECK_TOOL(AS, as, false) +- AC_CHECK_TOOL(OBJDUMP, objdump, false) + +- # recent cygwin and mingw systems supply a stub DllMain which the user +- # can override, but on older systems we have to supply one +- AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain, +- [AC_TRY_LINK([], +- [extern int __attribute__((__stdcall__)) DllMain(void*, int, void*); +- DllMain (0, 0, 0);], +- [lt_cv_need_dllmain=no],[lt_cv_need_dllmain=yes])]) +- +- case $host/$CC in +- *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*) +- # old mingw systems require "-dll" to link a DLL, while more recent ones +- # require "-mdll" +- SAVE_CFLAGS="$CFLAGS" +- CFLAGS="$CFLAGS -mdll" +- AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch, +- [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])]) +- CFLAGS="$SAVE_CFLAGS" ;; +- *-*-cygwin* | *-*-pw32*) +- # cygwin systems need to pass --dll to the linker, and not link +- # crt.o which will require a WinMain@16 definition. +- lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;; +- esac +- ;; +- ]) +-esac ++# _LT_AC_SYS_COMPILER ++# ------------------- ++AC_DEFUN([_LT_AC_SYS_COMPILER], ++[AC_REQUIRE([AC_PROG_CC])dnl + +-_LT_AC_LTCONFIG_HACK ++# If no C compiler was specified, use CC. ++LTCC=${LTCC-"$CC"} + +-]) +- +-# AC_LIBTOOL_HEADER_ASSERT +-# ------------------------ +-AC_DEFUN([AC_LIBTOOL_HEADER_ASSERT], +-[AC_CACHE_CHECK([whether $CC supports assert without backlinking], +- [lt_cv_func_assert_works], +- [case $host in +- *-*-solaris*) +- if test "$GCC" = yes && test "$with_gnu_ld" != yes; then +- case `$CC --version 2>/dev/null` in +- [[12]].*) lt_cv_func_assert_works=no ;; +- *) lt_cv_func_assert_works=yes ;; +- esac +- fi +- ;; +- esac]) +- +-if test "x$lt_cv_func_assert_works" = xyes; then +- AC_CHECK_HEADERS(assert.h) +-fi +-])# AC_LIBTOOL_HEADER_ASSERT +- +-# _LT_AC_CHECK_DLFCN +-# -------------------- +-AC_DEFUN([_LT_AC_CHECK_DLFCN], +-[AC_CHECK_HEADERS(dlfcn.h) +-])# _LT_AC_CHECK_DLFCN +- +-# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +-# --------------------------------- +-AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], +-[AC_REQUIRE([AC_CANONICAL_HOST]) +-AC_REQUIRE([AC_PROG_NM]) +-AC_REQUIRE([AC_OBJEXT]) +-# Check for command to grab the raw symbol name followed by C symbol from nm. +-AC_MSG_CHECKING([command to parse $NM output]) +-AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [dnl +- +-# These are sane defaults that work on at least a few old systems. +-# [They come from Ultrix. What could be older than Ultrix?!! ;)] +- +-# Character class describing NM global symbol codes. +-symcode='[[BCDEGRST]]' +- +-# Regexp to match symbols that can be accessed directly from C. +-sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' +- +-# Transform the above into a raw symbol and a C symbol. +-symxfrm='\1 \2\3 \3' +- +-# Transform an extracted symbol line into a proper C declaration +-lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" +- +-# Transform an extracted symbol line into symbol name and symbol address +-lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" +- +-# Define system-specific variables. +-case $host_os in +-aix*) +- symcode='[[BCDT]]' +- ;; +-cygwin* | mingw* | pw32*) +- symcode='[[ABCDGISTW]]' +- ;; +-hpux*) # Its linker distinguishes data from code symbols +- lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" +- lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" +- ;; +-irix* | nonstopux*) +- symcode='[[BCDEGRST]]' +- ;; +-osf*) +- symcode='[[BCDEGQRST]]' +- ;; +-solaris* | sysv5*) +- symcode='[[BDT]]' +- ;; +-sysv4) +- symcode='[[DFNSTU]]' +- ;; +-esac +- +-# Handle CRLF in mingw tool chain +-opt_cr= +-case $host_os in +-mingw*) +- opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp +- ;; +-esac +- +-# If we're using GNU nm, then use its standard symbol codes. +-if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then +- symcode='[[ABCDGISTW]]' +-fi +- +-# Try without a prefix undercore, then with it. +-for ac_symprfx in "" "_"; do +- +- # Write the raw and C identifiers. +-lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" +- +- # Check to see that the pipe works correctly. +- pipe_works=no +- rm -f conftest* +- cat > conftest.$ac_ext <<EOF +-#ifdef __cplusplus +-extern "C" { +-#endif +-char nm_test_var; +-void nm_test_func(){} +-#ifdef __cplusplus +-} +-#endif +-int main(){nm_test_var='a';nm_test_func();return(0);} +-EOF +- +- if AC_TRY_EVAL(ac_compile); then +- # Now try to grab the symbols. +- nlist=conftest.nm +- if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then +- # Try sorting and uniquifying the output. +- if sort "$nlist" | uniq > "$nlist"T; then +- mv -f "$nlist"T "$nlist" +- else +- rm -f "$nlist"T +- fi +- +- # Make sure that we snagged all the symbols we need. +- if egrep ' nm_test_var$' "$nlist" >/dev/null; then +- if egrep ' nm_test_func$' "$nlist" >/dev/null; then +- cat <<EOF > conftest.$ac_ext +-#ifdef __cplusplus +-extern "C" { +-#endif +- +-EOF +- # Now generate the symbol file. +- eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext' +- +- cat <<EOF >> conftest.$ac_ext +-#if defined (__STDC__) && __STDC__ +-# define lt_ptr void * +-#else +-# define lt_ptr char * +-# define const +-#endif +- +-/* The mapping between symbol names and symbols. */ +-const struct { +- const char *name; +- lt_ptr address; +-} +-lt_preloaded_symbols[[]] = +-{ +-EOF +- sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext +- cat <<\EOF >> conftest.$ac_ext +- {0, (lt_ptr) 0} +-}; ++# Allow CC to be a program name with arguments. ++compiler=$CC ++])# _LT_AC_SYS_COMPILER + +-#ifdef __cplusplus +-} +-#endif +-EOF +- # Now try linking the two files. +- mv conftest.$ac_objext conftstm.$ac_objext +- save_LIBS="$LIBS" +- save_CFLAGS="$CFLAGS" +- LIBS="conftstm.$ac_objext" +- CFLAGS="$CFLAGS$no_builtin_flag" +- if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then +- pipe_works=yes +- fi +- LIBS="$save_LIBS" +- CFLAGS="$save_CFLAGS" +- else +- echo "cannot find nm_test_func in $nlist" >&AC_FD_CC +- fi +- else +- echo "cannot find nm_test_var in $nlist" >&AC_FD_CC +- fi +- else +- echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AC_FD_CC +- fi +- else +- echo "$progname: failed program was:" >&AC_FD_CC +- cat conftest.$ac_ext >&5 +- fi +- rm -f conftest* conftst* + +- # Do not use the global_symbol_pipe unless it works. +- if test "$pipe_works" = yes; then +- break +- else +- lt_cv_sys_global_symbol_pipe= +- fi +-done +-]) +-global_symbol_pipe="$lt_cv_sys_global_symbol_pipe" +-if test -z "$lt_cv_sys_global_symbol_pipe"; then +- global_symbol_to_cdecl= +- global_symbol_to_c_name_address= +-else +- global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl" +- global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address" +-fi +-if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address"; +-then +- AC_MSG_RESULT(failed) +-else +- AC_MSG_RESULT(ok) +-fi +-]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE ++# _LT_AC_SYS_LIBPATH_AIX ++# ---------------------- ++# Links a minimal program and checks the executable ++# for the system default hardcoded library path. In most cases, ++# this is /usr/lib:/lib, but when the MPI compilers are used ++# the location of the communication and MPI libs are included too. ++# If we don't find anything, use the default library path according ++# to the aix ld manual. ++AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX], ++[AC_LINK_IFELSE(AC_LANG_PROGRAM,[ ++aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } ++}'` ++# Check for a 64-bit object if we didn't find anything. ++if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } ++}'`; fi],[]) ++if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ++])# _LT_AC_SYS_LIBPATH_AIX ++ ++ ++# _LT_AC_SHELL_INIT(ARG) ++# ---------------------- ++AC_DEFUN([_LT_AC_SHELL_INIT], ++[ifdef([AC_DIVERSION_NOTICE], ++ [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], ++ [AC_DIVERT_PUSH(NOTICE)]) ++$1 ++AC_DIVERT_POP ++])# _LT_AC_SHELL_INIT + +-# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR +-# --------------------------------- +-AC_DEFUN([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR], +-[# Find the correct PATH separator. Usually this is `:', but +-# DJGPP uses `;' like DOS. +-if test "X${PATH_SEPARATOR+set}" != Xset; then +- UNAME=${UNAME-`uname 2>/dev/null`} +- case X$UNAME in +- *-DOS) lt_cv_sys_path_separator=';' ;; +- *) lt_cv_sys_path_separator=':' ;; +- esac +- PATH_SEPARATOR=$lt_cv_sys_path_separator +-fi +-])# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR + + # _LT_AC_PROG_ECHO_BACKSLASH + # -------------------------- + # Add some code to the start of the generated configure script which + # will find an echo command which doesn't interpret backslashes. + AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], +-[ifdef([AC_DIVERSION_NOTICE], [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], +- [AC_DIVERT_PUSH(NOTICE)]) +-_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR +- ++[_LT_AC_SHELL_INIT([ + # Check that we are running under the correct shell. + SHELL=${CONFIG_SHELL-/bin/sh} + +@@ -549,7 +1262,7 @@ + elif test "X[$]1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +-elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then ++elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then + # Yippee, $echo works! + : + else +@@ -561,7 +1274,7 @@ + # used as fallback echo + shift + cat <<EOF +-$* ++[$]* + EOF + exit 0 + fi +@@ -595,8 +1308,9 @@ + # + # So, first we look for a working echo in the user's PATH. + +- IFS="${IFS= }"; save_ifs="$IFS"; IFS=$PATH_SEPARATOR ++ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do ++ IFS="$lt_save_ifs" + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && +@@ -605,7 +1319,7 @@ + break + fi + done +- IFS="$save_ifs" ++ IFS="$lt_save_ifs" + + if test "X$echo" = Xecho; then + # We didn't find a better echo, so look for alternatives. +@@ -678,47 +1392,328 @@ + fi + + AC_SUBST(ECHO) +-AC_DIVERT_POP +-])# _LT_AC_PROG_ECHO_BACKSLASH ++])])# _LT_AC_PROG_ECHO_BACKSLASH + +-# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, +-# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) +-# ------------------------------------------------------------------ +-AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], +-[if test "$cross_compiling" = yes; then : +- [$4] +-else +- AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl +- lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 +- lt_status=$lt_dlunknown +- cat > conftest.$ac_ext <<EOF +-[#line __oline__ "configure" +-#include "confdefs.h" + +-#if HAVE_DLFCN_H +-#include <dlfcn.h> +-#endif ++# _LT_AC_LOCK ++# ----------- ++AC_DEFUN([_LT_AC_LOCK], ++[AC_ARG_ENABLE([libtool-lock], ++ [AC_HELP_STRING([--disable-libtool-lock], ++ [avoid locking (might break parallel builds)])]) ++test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +-#include <stdio.h> ++# Some flags need to be propagated to the compiler or linker for good ++# libtool support. ++case $host in ++ia64-*-hpux*) ++ # Find out which ABI we are using. ++ echo 'int i;' > conftest.$ac_ext ++ if AC_TRY_EVAL(ac_compile); then ++ case `/usr/bin/file conftest.$ac_objext` in ++ *ELF-32*) ++ HPUX_IA64_MODE="32" ++ ;; ++ *ELF-64*) ++ HPUX_IA64_MODE="64" ++ ;; ++ esac ++ fi ++ rm -rf conftest* ++ ;; ++*-*-irix6*) ++ # Find out which ABI we are using. ++ echo '[#]line __oline__ "configure"' > conftest.$ac_ext ++ if AC_TRY_EVAL(ac_compile); then ++ if test "$lt_cv_prog_gnu_ld" = yes; then ++ case `/usr/bin/file conftest.$ac_objext` in ++ *32-bit*) ++ LD="${LD-ld} -melf32bsmip" ++ ;; ++ *N32*) ++ LD="${LD-ld} -melf32bmipn32" ++ ;; ++ *64-bit*) ++ LD="${LD-ld} -melf64bmip" ++ ;; ++ esac ++ else ++ case `/usr/bin/file conftest.$ac_objext` in ++ *32-bit*) ++ LD="${LD-ld} -32" ++ ;; ++ *N32*) ++ LD="${LD-ld} -n32" ++ ;; ++ *64-bit*) ++ LD="${LD-ld} -64" ++ ;; ++ esac ++ fi ++ fi ++ rm -rf conftest* ++ ;; + +-#ifdef RTLD_GLOBAL +-# define LT_DLGLOBAL RTLD_GLOBAL +-#else +-# ifdef DL_GLOBAL +-# define LT_DLGLOBAL DL_GLOBAL +-# else +-# define LT_DLGLOBAL 0 +-# endif +-#endif ++x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) ++ # Find out which ABI we are using. ++ echo 'int i;' > conftest.$ac_ext ++ if AC_TRY_EVAL(ac_compile); then ++ case "`/usr/bin/file conftest.o`" in ++ *32-bit*) ++ case $host in ++ x86_64-*linux*) ++ LD="${LD-ld} -m elf_i386" ++ ;; ++ ppc64-*linux*|powerpc64-*linux*) ++ LD="${LD-ld} -m elf32ppclinux" ++ ;; ++ s390x-*linux*) ++ LD="${LD-ld} -m elf_s390" ++ ;; ++ sparc64-*linux*) ++ LD="${LD-ld} -m elf32_sparc" ++ ;; ++ esac ++ ;; ++ *64-bit*) ++ case $host in ++ x86_64-*linux*) ++ LD="${LD-ld} -m elf_x86_64" ++ ;; ++ ppc*-*linux*|powerpc*-*linux*) ++ LD="${LD-ld} -m elf64ppc" ++ ;; ++ s390*-*linux*) ++ LD="${LD-ld} -m elf64_s390" ++ ;; ++ sparc*-*linux*) ++ LD="${LD-ld} -m elf64_sparc" ++ ;; ++ esac ++ ;; ++ esac ++ fi ++ rm -rf conftest* ++ ;; + +-/* We may have to define LT_DLLAZY_OR_NOW in the command line if we +- find out it does not work in some platform. */ +-#ifndef LT_DLLAZY_OR_NOW +-# ifdef RTLD_LAZY +-# define LT_DLLAZY_OR_NOW RTLD_LAZY +-# else +-# ifdef DL_LAZY +-# define LT_DLLAZY_OR_NOW DL_LAZY ++*-*-sco3.2v5*) ++ # On SCO OpenServer 5, we need -belf to get full-featured binaries. ++ SAVE_CFLAGS="$CFLAGS" ++ CFLAGS="$CFLAGS -belf" ++ AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, ++ [AC_LANG_PUSH(C) ++ AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) ++ AC_LANG_POP]) ++ if test x"$lt_cv_cc_needs_belf" != x"yes"; then ++ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf ++ CFLAGS="$SAVE_CFLAGS" ++ fi ++ ;; ++AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], ++[*-*-cygwin* | *-*-mingw* | *-*-pw32*) ++ AC_CHECK_TOOL(DLLTOOL, dlltool, false) ++ AC_CHECK_TOOL(AS, as, false) ++ AC_CHECK_TOOL(OBJDUMP, objdump, false) ++ ;; ++ ]) ++esac ++ ++need_locks="$enable_libtool_lock" ++ ++])# _LT_AC_LOCK ++ ++ ++# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, ++# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) ++# ---------------------------------------------------------------- ++# Check whether the given compiler option works ++AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], ++[AC_REQUIRE([LT_AC_PROG_SED]) ++AC_CACHE_CHECK([$1], [$2], ++ [$2=no ++ ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) ++ printf "$lt_simple_compile_test_code" > conftest.$ac_ext ++ lt_compiler_flag="$3" ++ # Insert the option either (1) after the last *FLAGS variable, or ++ # (2) before a word containing "conftest.", or (3) at the end. ++ # Note that $ac_compile itself does not contain backslashes and begins ++ # with a dollar sign (not a hyphen), so the echo should work correctly. ++ # The option is referenced via a variable to avoid confusing sed. ++ lt_compile=`echo "$ac_compile" | $SED \ ++ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ ++ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ ++ -e 's:$: $lt_compiler_flag:'` ++ (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) ++ (eval "$lt_compile" 2>conftest.err) ++ ac_status=$? ++ cat conftest.err >&AS_MESSAGE_LOG_FD ++ echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD ++ if (exit $ac_status) && test -s "$ac_outfile"; then ++ # The compiler can only warn and ignore the option if not recognized ++ # So say no if there are warnings ++ if test ! -s conftest.err; then ++ $2=yes ++ fi ++ fi ++ $rm conftest* ++]) ++ ++if test x"[$]$2" = xyes; then ++ ifelse([$5], , :, [$5]) ++else ++ ifelse([$6], , :, [$6]) ++fi ++])# AC_LIBTOOL_COMPILER_OPTION ++ ++ ++# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, ++# [ACTION-SUCCESS], [ACTION-FAILURE]) ++# ------------------------------------------------------------ ++# Check whether the given compiler option works ++AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], ++[AC_CACHE_CHECK([$1], [$2], ++ [$2=no ++ save_LDFLAGS="$LDFLAGS" ++ LDFLAGS="$LDFLAGS $3" ++ printf "$lt_simple_link_test_code" > conftest.$ac_ext ++ if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then ++ # The compiler can only warn and ignore the option if not recognized ++ # So say no if there are warnings ++ if test -s conftest.err; then ++ # Append any errors to the config.log. ++ cat conftest.err 1>&AS_MESSAGE_LOG_FD ++ else ++ $2=yes ++ fi ++ fi ++ $rm conftest* ++ LDFLAGS="$save_LDFLAGS" ++]) ++ ++if test x"[$]$2" = xyes; then ++ ifelse([$4], , :, [$4]) ++else ++ ifelse([$5], , :, [$5]) ++fi ++])# AC_LIBTOOL_LINKER_OPTION ++ ++ ++# AC_LIBTOOL_SYS_MAX_CMD_LEN ++# -------------------------- ++AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], ++[# find the maximum length of command line arguments ++AC_MSG_CHECKING([the maximum length of command line arguments]) ++AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl ++ i=0 ++ teststring="ABCD" ++ ++ case $build_os in ++ msdosdjgpp*) ++ # On DJGPP, this test can blow up pretty badly due to problems in libc ++ # (any single argument exceeding 2000 bytes causes a buffer overrun ++ # during glob expansion). Even if it were fixed, the result of this ++ # check would be larger than it should be. ++ lt_cv_sys_max_cmd_len=12288; # 12K is about right ++ ;; ++ ++ gnu*) ++ # Under GNU Hurd, this test is not required because there is ++ # no limit to the length of command line arguments. ++ # Libtool will interpret -1 as no limit whatsoever ++ lt_cv_sys_max_cmd_len=-1; ++ ;; ++ ++ cygwin* | mingw*) ++ # On Win9x/ME, this test blows up -- it succeeds, but takes ++ # about 5 minutes as the teststring grows exponentially. ++ # Worse, since 9x/ME are not pre-emptively multitasking, ++ # you end up with a "frozen" computer, even though with patience ++ # the test eventually succeeds (with a max line length of 256k). ++ # Instead, let's just punt: use the minimum linelength reported by ++ # all of the supported platforms: 8192 (on NT/2K/XP). ++ lt_cv_sys_max_cmd_len=8192; ++ ;; ++ ++ amigaos*) ++ # On AmigaOS with pdksh, this test takes hours, literally. ++ # So we just punt and use a minimum line length of 8192. ++ lt_cv_sys_max_cmd_len=8192; ++ ;; ++ ++ *) ++ # If test is not a shell built-in, we'll probably end up computing a ++ # maximum length that is only half of the actual maximum length, but ++ # we can't tell. ++ while (test "X"`$CONFIG_SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \ ++ = "XX$teststring") >/dev/null 2>&1 && ++ new_result=`expr "X$teststring" : ".*" 2>&1` && ++ lt_cv_sys_max_cmd_len=$new_result && ++ test $i != 17 # 1/2 MB should be enough ++ do ++ i=`expr $i + 1` ++ teststring=$teststring$teststring ++ done ++ teststring= ++ # Add a significant safety factor because C++ compilers can tack on massive ++ # amounts of additional arguments before passing them to the linker. ++ # It appears as though 1/2 is a usable value. ++ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` ++ ;; ++ esac ++]) ++if test -n $lt_cv_sys_max_cmd_len ; then ++ AC_MSG_RESULT($lt_cv_sys_max_cmd_len) ++else ++ AC_MSG_RESULT(none) ++fi ++])# AC_LIBTOOL_SYS_MAX_CMD_LEN ++ ++ ++# _LT_AC_CHECK_DLFCN ++# -------------------- ++AC_DEFUN([_LT_AC_CHECK_DLFCN], ++[AC_CHECK_HEADERS(dlfcn.h)dnl ++])# _LT_AC_CHECK_DLFCN ++ ++ ++# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, ++# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) ++# ------------------------------------------------------------------ ++AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], ++[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl ++if test "$cross_compiling" = yes; then : ++ [$4] ++else ++ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 ++ lt_status=$lt_dlunknown ++ cat > conftest.$ac_ext <<EOF ++[#line __oline__ "configure" ++#include "confdefs.h" ++ ++#if HAVE_DLFCN_H ++#include <dlfcn.h> ++#endif ++ ++#include <stdio.h> ++ ++#ifdef RTLD_GLOBAL ++# define LT_DLGLOBAL RTLD_GLOBAL ++#else ++# ifdef DL_GLOBAL ++# define LT_DLGLOBAL DL_GLOBAL ++# else ++# define LT_DLGLOBAL 0 ++# endif ++#endif ++ ++/* We may have to define LT_DLLAZY_OR_NOW in the command line if we ++ find out it does not work in some platform. */ ++#ifndef LT_DLLAZY_OR_NOW ++# ifdef RTLD_LAZY ++# define LT_DLLAZY_OR_NOW RTLD_LAZY ++# else ++# ifdef DL_LAZY ++# define LT_DLLAZY_OR_NOW DL_LAZY + # else + # ifdef RTLD_NOW + # define LT_DLLAZY_OR_NOW RTLD_NOW +@@ -769,10 +1764,12 @@ + rm -fr conftest* + ])# _LT_AC_TRY_DLOPEN_SELF + ++ + # AC_LIBTOOL_DLOPEN_SELF + # ------------------- + AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], +-[if test "x$enable_dlopen" != xyes; then ++[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl ++if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +@@ -787,24 +1784,39 @@ + lt_cv_dlopen_self=yes + ;; + +- cygwin* | mingw* | pw32*) ++ mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + ++ cygwin*) ++ lt_cv_dlopen="dlopen" ++ lt_cv_dlopen_libs= ++ ;; ++ ++ darwin*) ++ # if libdl is installed we need to link against it ++ AC_CHECK_LIB([dl], [dlopen], ++ [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ ++ lt_cv_dlopen="dyld" ++ lt_cv_dlopen_libs= ++ lt_cv_dlopen_self=yes ++ ]) ++ ;; ++ + *) + AC_CHECK_FUNC([shl_load], +- [lt_cv_dlopen="shl_load"], ++ [lt_cv_dlopen="shl_load"], + [AC_CHECK_LIB([dld], [shl_load], +- [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], ++ [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], + [AC_CHECK_FUNC([dlopen], + [lt_cv_dlopen="dlopen"], + [AC_CHECK_LIB([dl], [dlopen], +- [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], ++ [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], + [AC_CHECK_LIB([svld], [dlopen], +- [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], ++ [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], + [AC_CHECK_LIB([dld], [dld_link], +- [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) ++ [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) + ]) + ]) + ]) +@@ -822,7 +1834,6 @@ + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" +- AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" +@@ -866,707 +1877,1838 @@ + fi + ])# AC_LIBTOOL_DLOPEN_SELF + +-AC_DEFUN([_LT_AC_LTCONFIG_HACK], +-[AC_REQUIRE([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])dnl +-# Sed substitution that helps us do robust quoting. It backslashifies +-# metacharacters that are still active within double-quoted strings. +-Xsed='sed -e s/^X//' +-sed_quote_subst='s/\([[\\"\\`$\\\\]]\)/\\\1/g' +- +-# Same as above, but do not quote variable references. +-double_quote_subst='s/\([[\\"\\`\\\\]]\)/\\\1/g' +- +-# Sed substitution to delay expansion of an escaped shell variable in a +-# double_quote_subst'ed string. +-delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +-# Constants: +-rm="rm -f" ++# AC_LIBTOOL_PROG_CC_C_O([TAGNAME]) ++# --------------------------------- ++# Check to see if options -c and -o are simultaneously supported by compiler ++AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O], ++[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl ++AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], ++ [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)], ++ [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no ++ $rm -r conftest 2>/dev/null ++ mkdir conftest ++ cd conftest ++ mkdir out ++ printf "$lt_simple_compile_test_code" > conftest.$ac_ext ++ ++ lt_compiler_flag="-o out/conftest2.$ac_objext" ++ # Insert the option either (1) after the last *FLAGS variable, or ++ # (2) before a word containing "conftest.", or (3) at the end. ++ # Note that $ac_compile itself does not contain backslashes and begins ++ # with a dollar sign (not a hyphen), so the echo should work correctly. ++ lt_compile=`echo "$ac_compile" | $SED \ ++ -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ ++ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ ++ -e 's:$: $lt_compiler_flag:'` ++ (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) ++ (eval "$lt_compile" 2>out/conftest.err) ++ ac_status=$? ++ cat out/conftest.err >&AS_MESSAGE_LOG_FD ++ echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD ++ if (exit $ac_status) && test -s out/conftest2.$ac_objext ++ then ++ # The compiler can only warn and ignore the option if not recognized ++ # So say no if there are warnings ++ if test ! -s out/conftest.err; then ++ _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes ++ fi ++ fi ++ chmod u+w . ++ $rm conftest* ++ # SGI C++ compiler will create directory out/ii_files/ for ++ # template instantiation ++ test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files ++ $rm out/* && rmdir out ++ cd .. ++ rmdir conftest ++ $rm conftest* ++]) ++])# AC_LIBTOOL_PROG_CC_C_O + +-# Global variables: +-default_ofile=libtool +-can_build_shared=yes + +-# All known linkers require a `.a' archive for static linking (except M$VC, +-# which needs '.lib'). +-libext=a +-ltmain="$ac_aux_dir/ltmain.sh" +-ofile="$default_ofile" +-with_gnu_ld="$lt_cv_prog_gnu_ld" +-need_locks="$enable_libtool_lock" ++# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME]) ++# ----------------------------------------- ++# Check to see if we can do hard links to lock some files if needed ++AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], ++[AC_REQUIRE([_LT_AC_LOCK])dnl + +-old_CC="$CC" +-old_CFLAGS="$CFLAGS" ++hard_links="nottested" ++if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then ++ # do not overwrite the value of need_locks provided by the user ++ AC_MSG_CHECKING([if we can lock with hard links]) ++ hard_links=yes ++ $rm conftest* ++ ln conftest.a conftest.b 2>/dev/null && hard_links=no ++ touch conftest.a ++ ln conftest.a conftest.b 2>&5 || hard_links=no ++ ln conftest.a conftest.b 2>/dev/null && hard_links=no ++ AC_MSG_RESULT([$hard_links]) ++ if test "$hard_links" = no; then ++ AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) ++ need_locks=warn ++ fi ++else ++ need_locks=no ++fi ++])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS + +-# Set sane defaults for various variables +-test -z "$AR" && AR=ar +-test -z "$AR_FLAGS" && AR_FLAGS=cru +-test -z "$AS" && AS=as +-test -z "$CC" && CC=cc +-test -z "$DLLTOOL" && DLLTOOL=dlltool +-test -z "$LD" && LD=ld +-test -z "$LN_S" && LN_S="ln -s" +-test -z "$MAGIC_CMD" && MAGIC_CMD=file +-test -z "$NM" && NM=nm +-test -z "$OBJDUMP" && OBJDUMP=objdump +-test -z "$RANLIB" && RANLIB=: +-test -z "$STRIP" && STRIP=: +-test -z "$ac_objext" && ac_objext=o + +-if test x"$host" != x"$build"; then +- ac_tool_prefix=${host_alias}- ++# AC_LIBTOOL_OBJDIR ++# ----------------- ++AC_DEFUN([AC_LIBTOOL_OBJDIR], ++[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], ++[rm -f .libs 2>/dev/null ++mkdir .libs 2>/dev/null ++if test -d .libs; then ++ lt_cv_objdir=.libs + else +- ac_tool_prefix= ++ # MS-DOS does not allow filenames that begin with a dot. ++ lt_cv_objdir=_libs + fi ++rmdir .libs 2>/dev/null]) ++objdir=$lt_cv_objdir ++])# AC_LIBTOOL_OBJDIR + +-# Transform linux* to *-*-linux-gnu*, to support old configure scripts. +-case $host_os in +-linux-gnu*) ;; +-linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` +-esac + +-case $host_os in +-aix3*) +- # AIX sometimes has problems with the GCC collect2 program. For some +- # reason, if we set the COLLECT_NAMES environment variable, the problems +- # vanish in a puff of smoke. +- if test "X${COLLECT_NAMES+set}" != Xset; then +- COLLECT_NAMES= +- export COLLECT_NAMES ++# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME]) ++# ---------------------------------------------- ++# Check hardcoding attributes. ++AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], ++[AC_MSG_CHECKING([how to hardcode library paths into programs]) ++_LT_AC_TAGVAR(hardcode_action, $1)= ++if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \ ++ test -n "$_LT_AC_TAGVAR(runpath_var $1)" || \ ++ test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)"="Xyes" ; then ++ ++ # We can hardcode non-existant directories. ++ if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no && ++ # If the only mechanism to avoid hardcoding is shlibpath_var, we ++ # have to relink, otherwise we might link with an installed library ++ # when we should be linking with a yet-to-be-installed one ++ ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no && ++ test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then ++ # Linking always hardcodes the temporary library directory. ++ _LT_AC_TAGVAR(hardcode_action, $1)=relink ++ else ++ # We can link without hardcoding, and we can hardcode nonexisting dirs. ++ _LT_AC_TAGVAR(hardcode_action, $1)=immediate + fi +- ;; +-esac ++else ++ # We cannot hardcode anything, or else we can only hardcode existing ++ # directories. ++ _LT_AC_TAGVAR(hardcode_action, $1)=unsupported ++fi ++AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)]) + +-# Determine commands to create old-style static archives. +-old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' +-old_postinstall_cmds='chmod 644 $oldlib' +-old_postuninstall_cmds= ++if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then ++ # Fast installation is not supported ++ enable_fast_install=no ++elif test "$shlibpath_overrides_runpath" = yes || ++ test "$enable_shared" = no; then ++ # Fast installation is not necessary ++ enable_fast_install=needless ++fi ++])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH + +-if test -n "$RANLIB"; then ++ ++# AC_LIBTOOL_SYS_LIB_STRIP ++# ------------------------ ++AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP], ++[striplib= ++old_striplib= ++AC_MSG_CHECKING([whether stripping libraries is possible]) ++if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then ++ test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" ++ test -z "$striplib" && striplib="$STRIP --strip-unneeded" ++ AC_MSG_RESULT([yes]) ++else ++# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in +- openbsd*) +- old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" +- ;; +- *) +- old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" ++ darwin*) ++ if test -n "$STRIP" ; then ++ striplib="$STRIP -x" ++ AC_MSG_RESULT([yes]) ++ else ++ AC_MSG_RESULT([no]) ++fi ++ ;; ++ *) ++ AC_MSG_RESULT([no]) + ;; + esac +- old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" + fi ++])# AC_LIBTOOL_SYS_LIB_STRIP + +-# Allow CC to be a program name with arguments. +-set dummy $CC +-compiler="[$]2" + +-AC_MSG_CHECKING([for objdir]) +-rm -f .libs 2>/dev/null +-mkdir .libs 2>/dev/null +-if test -d .libs; then +- objdir=.libs ++# AC_LIBTOOL_SYS_DYNAMIC_LINKER ++# ----------------------------- ++# PORTME Fill in your ld.so characteristics ++AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], ++[AC_MSG_CHECKING([dynamic linker characteristics]) ++library_names_spec= ++libname_spec='lib$name' ++soname_spec= ++shrext_cmds=".so" ++postinstall_cmds= ++postuninstall_cmds= ++finish_cmds= ++finish_eval= ++shlibpath_var= ++shlibpath_overrides_runpath=unknown ++version_type=none ++dynamic_linker="$host_os ld.so" ++sys_lib_dlsearch_path_spec="/lib /usr/lib" ++if test "$GCC" = yes; then ++ sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` ++ if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then ++ # if the path contains ";" then we assume it to be the separator ++ # otherwise default to the standard path separator (i.e. ":") - it is ++ # assumed that no part of a normal pathname contains ";" but that should ++ # okay in the real world where ";" in dirpaths is itself problematic. ++ sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` ++ else ++ sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ++ fi + else +- # MS-DOS does not allow filenames that begin with a dot. +- objdir=_libs ++ sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" + fi +-rmdir .libs 2>/dev/null +-AC_MSG_RESULT($objdir) +- ++need_lib_prefix=unknown ++hardcode_into_libs=no + +-AC_ARG_WITH(pic, +-[ --with-pic try to use only PIC/non-PIC objects [default=use both]], +-pic_mode="$withval", pic_mode=default) +-test -z "$pic_mode" && pic_mode=default ++# when you set need_version to no, make sure it does not cause -set_version ++# flags to be left without arguments ++need_version=unknown + +-# We assume here that the value for lt_cv_prog_cc_pic will not be cached +-# in isolation, and that seeing it set (from the cache) indicates that +-# the associated values are set (in the cache) correctly too. +-AC_MSG_CHECKING([for $compiler option to produce PIC]) +-AC_CACHE_VAL(lt_cv_prog_cc_pic, +-[ lt_cv_prog_cc_pic= +- lt_cv_prog_cc_shlib= +- lt_cv_prog_cc_wl= +- lt_cv_prog_cc_static= +- lt_cv_prog_cc_no_builtin= +- lt_cv_prog_cc_can_build_shared=$can_build_shared ++case $host_os in ++aix3*) ++ version_type=linux ++ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' ++ shlibpath_var=LIBPATH + +- if test "$GCC" = yes; then +- lt_cv_prog_cc_wl='-Wl,' +- lt_cv_prog_cc_static='-static' ++ # AIX 3 has no versioning support, so we append a major version to the name. ++ soname_spec='${libname}${release}${shared_ext}$major' ++ ;; + +- case $host_os in +- aix*) +- # Below there is a dirty hack to force normal static linking with -ldl +- # The problem is because libdl dynamically linked with both libc and +- # libC (AIX C++ library), which obviously doesn't included in libraries +- # list by gcc. This cause undefined symbols with -static flags. +- # This hack allows C programs to be linked with "-static -ldl", but +- # not sure about C++ programs. +- lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC" +- ;; +- amigaos*) +- # FIXME: we need at least 68020 code to build shared libraries, but +- # adding the `-m68020' flag to GCC prevents building anything better, +- # like `-m68040'. +- lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' +- ;; +- beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) +- # PIC is the default for these OSes. +- ;; +- darwin* | rhapsody*) +- # PIC is the default on this platform +- # Common symbols not allowed in MH_DYLIB files +- lt_cv_prog_cc_pic='-fno-common' +- ;; +- cygwin* | mingw* | pw32* | os2*) +- # This hack is so that the source file can tell whether it is being +- # built for inclusion in a dll (and should export symbols for example). +- lt_cv_prog_cc_pic='-DDLL_EXPORT' +- ;; +- sysv4*MP*) +- if test -d /usr/nec; then +- lt_cv_prog_cc_pic=-Kconform_pic +- fi +- ;; +- *) +- lt_cv_prog_cc_pic='-fPIC' +- ;; +- esac ++aix4* | aix5*) ++ version_type=linux ++ need_lib_prefix=no ++ need_version=no ++ hardcode_into_libs=yes ++ if test "$host_cpu" = ia64; then ++ # AIX 5 supports IA64 ++ library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' ++ shlibpath_var=LD_LIBRARY_PATH + else +- # PORTME Check for PIC flags for the system compiler. ++ # With GCC up to 2.95.x, collect2 would create an import file ++ # for dependence libraries. The import file would start with ++ # the line `#! .'. This would cause the generated library to ++ # depend on `.', always an invalid library. This was fixed in ++ # development snapshots of GCC prior to 3.0. + case $host_os in +- aix3* | aix4* | aix5*) +- lt_cv_prog_cc_wl='-Wl,' +- # All AIX code is PIC. +- if test "$host_cpu" = ia64; then +- # AIX 5 now supports IA64 processor +- lt_cv_prog_cc_static='-Bstatic' ++ aix4 | aix4.[[01]] | aix4.[[01]].*) ++ if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' ++ echo ' yes ' ++ echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then ++ : + else +- lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' ++ can_build_shared=no + fi + ;; ++ esac ++ # AIX (on Power*) has no versioning support, so currently we can not hardcode correct ++ # soname into executable. Probably we can add versioning support to ++ # collect2, so additional links can be useful in future. ++ if test "$aix_use_runtimelinking" = yes; then ++ # If using run time linking (on AIX 4.2 or later) use lib<name>.so ++ # instead of lib<name>.a to let people know that these are not ++ # typical AIX shared libraries. ++ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ++ else ++ # We preserve .a as extension for shared libraries through AIX4.2 ++ # and later when we are not doing run time linking. ++ library_names_spec='${libname}${release}.a $libname.a' ++ soname_spec='${libname}${release}${shared_ext}$major' ++ fi ++ shlibpath_var=LIBPATH ++ fi ++ ;; + +- hpux9* | hpux10* | hpux11*) +- # Is there a better lt_cv_prog_cc_static that works with the bundled CC? +- lt_cv_prog_cc_wl='-Wl,' +- lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive" +- lt_cv_prog_cc_pic='+Z' +- ;; +- +- irix5* | irix6* | nonstopux*) +- lt_cv_prog_cc_wl='-Wl,' +- lt_cv_prog_cc_static='-non_shared' +- # PIC (with -KPIC) is the default. +- ;; +- +- cygwin* | mingw* | pw32* | os2*) +- # This hack is so that the source file can tell whether it is being +- # built for inclusion in a dll (and should export symbols for example). +- lt_cv_prog_cc_pic='-DDLL_EXPORT' +- ;; +- +- newsos6) +- lt_cv_prog_cc_pic='-KPIC' +- lt_cv_prog_cc_static='-Bstatic' +- ;; +- +- osf3* | osf4* | osf5*) +- # All OSF/1 code is PIC. +- lt_cv_prog_cc_wl='-Wl,' +- lt_cv_prog_cc_static='-non_shared' +- ;; ++amigaos*) ++ library_names_spec='$libname.ixlibrary $libname.a' ++ # Create ${libname}_ixlibrary.a entries in /sys/libs. ++ finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ++ ;; + +- sco3.2v5*) +- lt_cv_prog_cc_pic='-Kpic' +- lt_cv_prog_cc_static='-dn' +- lt_cv_prog_cc_shlib='-belf' +- ;; ++beos*) ++ library_names_spec='${libname}${shared_ext}' ++ dynamic_linker="$host_os ld.so" ++ shlibpath_var=LIBRARY_PATH ++ ;; + +- solaris*) +- lt_cv_prog_cc_pic='-KPIC' +- lt_cv_prog_cc_static='-Bstatic' +- lt_cv_prog_cc_wl='-Wl,' +- ;; ++bsdi4*) ++ version_type=linux ++ need_version=no ++ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ++ soname_spec='${libname}${release}${shared_ext}$major' ++ finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' ++ shlibpath_var=LD_LIBRARY_PATH ++ sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" ++ sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" ++ # the default ld.so.conf also contains /usr/contrib/lib and ++ # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow ++ # libtool to hard-code these into programs ++ ;; + +- sunos4*) +- lt_cv_prog_cc_pic='-PIC' +- lt_cv_prog_cc_static='-Bstatic' +- lt_cv_prog_cc_wl='-Qoption ld ' +- ;; ++cygwin* | mingw* | pw32*) ++ version_type=windows ++ shrext_cmds=".dll" ++ need_version=no ++ need_lib_prefix=no + +- sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) +- lt_cv_prog_cc_pic='-KPIC' +- lt_cv_prog_cc_static='-Bstatic' +- lt_cv_prog_cc_wl='-Wl,' +- ;; ++ case $GCC,$host_os in ++ yes,cygwin* | yes,mingw* | yes,pw32*) ++ library_names_spec='$libname.dll.a' ++ # DLL is installed to $(libdir)/../bin by postinstall_cmds ++ postinstall_cmds='base_file=`basename \${file}`~ ++ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ ++ dldir=$destdir/`dirname \$dlpath`~ ++ test -d \$dldir || mkdir -p \$dldir~ ++ $install_prog $dir/$dlname \$dldir/$dlname' ++ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ ++ dlpath=$dir/\$dldll~ ++ $rm \$dlpath' ++ shlibpath_overrides_runpath=yes + +- uts4*) +- lt_cv_prog_cc_pic='-pic' +- lt_cv_prog_cc_static='-Bstatic' ++ case $host_os in ++ cygwin*) ++ # Cygwin DLLs use 'cyg' prefix rather than 'lib' ++ soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ++ sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; +- +- sysv4*MP*) +- if test -d /usr/nec ;then +- lt_cv_prog_cc_pic='-Kconform_pic' +- lt_cv_prog_cc_static='-Bstatic' ++ mingw*) ++ # MinGW DLLs use traditional 'lib' prefix ++ soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ++ sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` ++ if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then ++ # It is most probably a Windows format PATH printed by ++ # mingw gcc, but we are running on Cygwin. Gcc prints its search ++ # path with ; separators, and with drive letters. We can handle the ++ # drive letters (cygwin fileutils understands them), so leave them, ++ # especially as we might pass files found there to a mingw objdump, ++ # which wouldn't understand a cygwinified path. Ahh. ++ sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` ++ else ++ sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; +- +- *) +- lt_cv_prog_cc_can_build_shared=no ++ pw32*) ++ # pw32 DLLs use 'pw' prefix rather than 'lib' ++ library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac +- fi +-]) +-if test -z "$lt_cv_prog_cc_pic"; then +- AC_MSG_RESULT([none]) +-else +- AC_MSG_RESULT([$lt_cv_prog_cc_pic]) +- +- # Check to make sure the pic_flag actually works. +- AC_MSG_CHECKING([if $compiler PIC flag $lt_cv_prog_cc_pic works]) +- AC_CACHE_VAL(lt_cv_prog_cc_pic_works, [dnl +- save_CFLAGS="$CFLAGS" +- CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC" +- AC_TRY_COMPILE([], [], [dnl +- case $host_os in +- hpux9* | hpux10* | hpux11*) +- # On HP-UX, both CC and GCC only warn that PIC is supported... then +- # they create non-PIC objects. So, if there were any warnings, we +- # assume that PIC is not supported. +- if test -s conftest.err; then +- lt_cv_prog_cc_pic_works=no +- else +- lt_cv_prog_cc_pic_works=yes +- fi +- ;; +- *) +- lt_cv_prog_cc_pic_works=yes +- ;; +- esac +- ], [dnl +- lt_cv_prog_cc_pic_works=no +- ]) +- CFLAGS="$save_CFLAGS" +- ]) +- +- if test "X$lt_cv_prog_cc_pic_works" = Xno; then +- lt_cv_prog_cc_pic= +- lt_cv_prog_cc_can_build_shared=no +- else +- lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic" +- fi +- +- AC_MSG_RESULT([$lt_cv_prog_cc_pic_works]) +-fi +- +-# Check for any special shared library compilation flags. +-if test -n "$lt_cv_prog_cc_shlib"; then +- AC_MSG_WARN([\`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries]) +- if echo "$old_CC $old_CFLAGS " | egrep -e "[[ ]]$lt_cv_prog_cc_shlib[[ ]]" >/dev/null; then : +- else +- AC_MSG_WARN([add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure]) +- lt_cv_prog_cc_can_build_shared=no +- fi +-fi +- +-AC_MSG_CHECKING([if $compiler static flag $lt_cv_prog_cc_static works]) +-AC_CACHE_VAL([lt_cv_prog_cc_static_works], [dnl +- lt_cv_prog_cc_static_works=no +- save_LDFLAGS="$LDFLAGS" +- LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static" +- AC_TRY_LINK([], [], [lt_cv_prog_cc_static_works=yes]) +- LDFLAGS="$save_LDFLAGS" +-]) +- +-# Belt *and* braces to stop my trousers falling down: +-test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static= +-AC_MSG_RESULT([$lt_cv_prog_cc_static_works]) +- +-pic_flag="$lt_cv_prog_cc_pic" +-special_shlib_compile_flags="$lt_cv_prog_cc_shlib" +-wl="$lt_cv_prog_cc_wl" +-link_static_flag="$lt_cv_prog_cc_static" +-no_builtin_flag="$lt_cv_prog_cc_no_builtin" +-can_build_shared="$lt_cv_prog_cc_can_build_shared" +- +- +-# Check to see if options -o and -c are simultaneously supported by compiler +-AC_MSG_CHECKING([if $compiler supports -c -o file.$ac_objext]) +-AC_CACHE_VAL([lt_cv_compiler_c_o], [ +-$rm -r conftest 2>/dev/null +-mkdir conftest +-cd conftest +-echo "int some_variable = 0;" > conftest.$ac_ext +-mkdir out +-# According to Tom Tromey, Ian Lance Taylor reported there are C compilers +-# that will create temporary files in the current directory regardless of +-# the output directory. Thus, making CWD read-only will cause this test +-# to fail, enabling locking or at least warning the user not to do parallel +-# builds. +-chmod -w . +-save_CFLAGS="$CFLAGS" +-CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" +-compiler_c_o=no +-if { (eval echo configure:__oline__: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then +- # The compiler can only warn and ignore the option if not recognized +- # So say no if there are warnings +- if test -s out/conftest.err; then +- lt_cv_compiler_c_o=no +- else +- lt_cv_compiler_c_o=yes +- fi +-else +- # Append any errors to the config.log. +- cat out/conftest.err 1>&AC_FD_CC +- lt_cv_compiler_c_o=no +-fi +-CFLAGS="$save_CFLAGS" +-chmod u+w . +-$rm conftest* out/* +-rmdir out +-cd .. +-rmdir conftest +-$rm -r conftest 2>/dev/null +-]) +-compiler_c_o=$lt_cv_compiler_c_o +-AC_MSG_RESULT([$compiler_c_o]) +- +-if test x"$compiler_c_o" = x"yes"; then +- # Check to see if we can write to a .lo +- AC_MSG_CHECKING([if $compiler supports -c -o file.lo]) +- AC_CACHE_VAL([lt_cv_compiler_o_lo], [ +- lt_cv_compiler_o_lo=no +- save_CFLAGS="$CFLAGS" +- CFLAGS="$CFLAGS -c -o conftest.lo" +- save_objext="$ac_objext" +- ac_objext=lo +- AC_TRY_COMPILE([], [int some_variable = 0;], [dnl +- # The compiler can only warn and ignore the option if not recognized +- # So say no if there are warnings +- if test -s conftest.err; then +- lt_cv_compiler_o_lo=no +- else +- lt_cv_compiler_o_lo=yes +- fi +- ]) +- ac_objext="$save_objext" +- CFLAGS="$save_CFLAGS" +- ]) +- compiler_o_lo=$lt_cv_compiler_o_lo +- AC_MSG_RESULT([$compiler_o_lo]) +-else +- compiler_o_lo=no +-fi +- +-# Check to see if we can do hard links to lock some files if needed +-hard_links="nottested" +-if test "$compiler_c_o" = no && test "$need_locks" != no; then +- # do not overwrite the value of need_locks provided by the user +- AC_MSG_CHECKING([if we can lock with hard links]) +- hard_links=yes +- $rm conftest* +- ln conftest.a conftest.b 2>/dev/null && hard_links=no +- touch conftest.a +- ln conftest.a conftest.b 2>&5 || hard_links=no +- ln conftest.a conftest.b 2>/dev/null && hard_links=no +- AC_MSG_RESULT([$hard_links]) +- if test "$hard_links" = no; then +- AC_MSG_WARN([\`$CC' does not support \`-c -o', so \`make -j' may be unsafe]) +- need_locks=warn +- fi +-else +- need_locks=no +-fi ++ ;; + +-if test "$GCC" = yes; then +- # Check to see if options -fno-rtti -fno-exceptions are supported by compiler +- AC_MSG_CHECKING([if $compiler supports -fno-rtti -fno-exceptions]) +- echo "int some_variable = 0;" > conftest.$ac_ext +- save_CFLAGS="$CFLAGS" +- CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext" +- compiler_rtti_exceptions=no +- AC_TRY_COMPILE([], [int some_variable = 0;], [dnl +- # The compiler can only warn and ignore the option if not recognized +- # So say no if there are warnings +- if test -s conftest.err; then +- compiler_rtti_exceptions=no +- else +- compiler_rtti_exceptions=yes +- fi +- ]) +- CFLAGS="$save_CFLAGS" +- AC_MSG_RESULT([$compiler_rtti_exceptions]) ++ *) ++ library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' ++ ;; ++ esac ++ dynamic_linker='Win32 ld.exe' ++ # FIXME: first we should search . and the directory the executable is in ++ shlibpath_var=PATH ++ ;; + +- if test "$compiler_rtti_exceptions" = "yes"; then +- no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' ++darwin* | rhapsody*) ++ dynamic_linker="$host_os dyld" ++ version_type=darwin ++ need_lib_prefix=no ++ need_version=no ++ library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' ++ soname_spec='${libname}${release}${major}$shared_ext' ++ shlibpath_overrides_runpath=yes ++ shlibpath_var=DYLD_LIBRARY_PATH ++ shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' ++ # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. ++ if test "$GCC" = yes; then ++ sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else +- no_builtin_flag=' -fno-builtin' ++ sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi +-fi +- +-# See if the linker supports building shared libraries. +-AC_MSG_CHECKING([whether the linker ($LD) supports shared libraries]) +- +-allow_undefined_flag= +-no_undefined_flag= +-need_lib_prefix=unknown +-need_version=unknown +-# when you set need_version to no, make sure it does not cause -set_version +-# flags to be left without arguments +-archive_cmds= +-archive_expsym_cmds= +-old_archive_from_new_cmds= +-old_archive_from_expsyms_cmds= +-export_dynamic_flag_spec= +-whole_archive_flag_spec= +-thread_safe_flag_spec= +-hardcode_into_libs=no +-hardcode_libdir_flag_spec= +-hardcode_libdir_separator= +-hardcode_direct=no +-hardcode_minus_L=no +-hardcode_shlibpath_var=unsupported +-runpath_var= +-link_all_deplibs=unknown +-always_export_symbols=no +-export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' +-# include_expsyms should be a list of space-separated symbols to be *always* +-# included in the symbol list +-include_expsyms= +-# exclude_expsyms can be an egrep regular expression of symbols to exclude +-# it will be wrapped by ` (' and `)$', so one must not match beginning or +-# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', +-# as well as any symbol that contains `d'. +-exclude_expsyms="_GLOBAL_OFFSET_TABLE_" +-# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out +-# platforms (ab)use it in PIC code, but their linkers get confused if +-# the symbol is explicitly referenced. Since portable code cannot +-# rely on this symbol name, it's probably fine to never include it in +-# preloaded symbol tables. +-extract_expsyms_cmds= ++ sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ++ ;; + +-case $host_os in +-cygwin* | mingw* | pw32*) +- # FIXME: the MSVC++ port hasn't been tested in a loooong time +- # When not using gcc, we currently assume that we are using +- # Microsoft Visual C++. +- if test "$GCC" != yes; then +- with_gnu_ld=no +- fi ++dgux*) ++ version_type=linux ++ need_lib_prefix=no ++ need_version=no ++ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' ++ soname_spec='${libname}${release}${shared_ext}$major' ++ shlibpath_var=LD_LIBRARY_PATH + ;; +-openbsd*) +- with_gnu_ld=no ++ ++freebsd1*) ++ dynamic_linker=no + ;; +-esac + +-ld_shlibs=yes +-if test "$with_gnu_ld" = yes; then +- # If archive_cmds runs LD, not CC, wlarc should be empty +- wlarc='${wl}' ++kfreebsd*-gnu) ++ version_type=linux ++ need_lib_prefix=no ++ need_version=no ++ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' ++ soname_spec='${libname}${release}${shared_ext}$major' ++ shlibpath_var=LD_LIBRARY_PATH ++ shlibpath_overrides_runpath=no ++ hardcode_into_libs=yes ++ dynamic_linker='GNU ld.so' ++ ;; + +- # See if GNU ld supports shared libraries. ++freebsd*) ++ objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` ++ version_type=freebsd-$objformat ++ case $version_type in ++ freebsd-elf*) ++ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' ++ need_version=no ++ need_lib_prefix=no ++ ;; ++ freebsd-*) ++ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' ++ need_version=yes ++ ;; ++ esac ++ shlibpath_var=LD_LIBRARY_PATH + case $host_os in +- aix3* | aix4* | aix5*) +- # On AIX, the GNU linker is very broken +- # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available. +- ld_shlibs=no +- cat <<EOF 1>&2 +- +-*** Warning: the GNU linker, at least up to release 2.9.1, is reported +-*** to be unable to reliably create shared libraries on AIX. +-*** Therefore, libtool is disabling shared libraries support. If you +-*** really care for shared libraries, you may want to modify your PATH +-*** so that a non-GNU linker is found, and then restart. +- +-EOF ++ freebsd2*) ++ shlibpath_overrides_runpath=yes + ;; +- +- amigaos*) +- archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' +- hardcode_libdir_flag_spec='-L$libdir' +- hardcode_minus_L=yes +- +- # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports +- # that the semantics of dynamic libraries on AmigaOS, at least up +- # to version 4, is to share data among multiple programs linked +- # with the same dynamic library. Since this doesn't match the +- # behavior of shared libraries on other platforms, we can use +- # them. +- ld_shlibs=no ++ freebsd3.[01]* | freebsdelf3.[01]*) ++ shlibpath_overrides_runpath=yes ++ hardcode_into_libs=yes + ;; +- +- beos*) +- if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then +- allow_undefined_flag=unsupported +- # Joseph Beckenbach <jrb3@best.com> says some releases of gcc +- # support --undefined. This deserves some investigation. FIXME +- archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' +- else +- ld_shlibs=no +- fi ++ *) # from 3.2 on ++ shlibpath_overrides_runpath=no ++ hardcode_into_libs=yes + ;; ++ esac ++ ;; + +- cygwin* | mingw* | pw32*) +- # hardcode_libdir_flag_spec is actually meaningless, as there is +- # no search path for DLLs. +- hardcode_libdir_flag_spec='-L$libdir' +- allow_undefined_flag=unsupported +- always_export_symbols=yes +- +- extract_expsyms_cmds='test -f $output_objdir/impgen.c || \ +- sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~ +- test -f $output_objdir/impgen.exe || (cd $output_objdir && \ +- if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \ +- else $CC -o impgen impgen.c ; fi)~ +- $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def' +- +- old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib' +- +- # cygwin and mingw dlls have different entry points and sets of symbols +- # to exclude. +- # FIXME: what about values for MSVC? +- dll_entry=__cygwin_dll_entry@12 +- dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~ +- case $host_os in +- mingw*) +- # mingw values +- dll_entry=_DllMainCRTStartup@12 +- dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~ +- ;; +- esac +- +- # mingw and cygwin differ, and it's simplest to just exclude the union +- # of the two symbol sets. +- dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12 +- +- # recent cygwin and mingw systems supply a stub DllMain which the user +- # can override, but on older systems we have to supply one (in ltdll.c) +- if test "x$lt_cv_need_dllmain" = "xyes"; then +- ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext " +- ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~ +- test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~' +- else +- ltdll_obj= +- ltdll_cmds= +- fi +- +- # Extract the symbol export list from an `--export-all' def file, +- # then regenerate the def file from the symbol export list, so that +- # the compiled dll only exports the symbol export list. +- # Be careful not to strip the DATA tag left be newer dlltools. +- export_symbols_cmds="$ltdll_cmds"' +- $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~ +- sed -e "1,/EXPORTS/d" -e "s/ @ [[0-9]]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols' +- +- # If the export-symbols file already is a .def file (1st line +- # is EXPORTS), use it as is. +- # If DATA tags from a recent dlltool are present, honour them! +- archive_expsym_cmds='if test "x`sed 1q $export_symbols`" = xEXPORTS; then +- cp $export_symbols $output_objdir/$soname-def; +- else +- echo EXPORTS > $output_objdir/$soname-def; +- _lt_hint=1; +- cat $export_symbols | while read symbol; do +- set dummy \$symbol; +- case \[$]# in +- 2) echo " \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; +- 4) echo " \[$]2 \[$]3 \[$]4 ; " >> $output_objdir/$soname-def; _lt_hint=`expr \$_lt_hint - 1`;; +- *) echo " \[$]2 @ \$_lt_hint \[$]3 ; " >> $output_objdir/$soname-def;; +- esac; +- _lt_hint=`expr 1 + \$_lt_hint`; +- done; +- fi~ +- '"$ltdll_cmds"' +- $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ +- $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~ +- $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ +- $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~ +- $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags' ++gnu*) ++ version_type=linux ++ need_lib_prefix=no ++ need_version=no ++ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' ++ soname_spec='${libname}${release}${shared_ext}$major' ++ shlibpath_var=LD_LIBRARY_PATH ++ hardcode_into_libs=yes ++ ;; ++ ++hpux9* | hpux10* | hpux11*) ++ # Give a soname corresponding to the major version so that dld.sl refuses to ++ # link against other versions. ++ version_type=sunos ++ need_lib_prefix=no ++ need_version=no ++ case "$host_cpu" in ++ ia64*) ++ shrext_cmds='.so' ++ hardcode_into_libs=yes ++ dynamic_linker="$host_os dld.so" ++ shlibpath_var=LD_LIBRARY_PATH ++ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. ++ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ++ soname_spec='${libname}${release}${shared_ext}$major' ++ if test "X$HPUX_IA64_MODE" = X32; then ++ sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" ++ else ++ sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" ++ fi ++ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ++ ;; ++ hppa*64*) ++ shrext_cmds='.sl' ++ hardcode_into_libs=yes ++ dynamic_linker="$host_os dld.sl" ++ shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH ++ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. ++ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ++ soname_spec='${libname}${release}${shared_ext}$major' ++ sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" ++ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ++ ;; ++ *) ++ shrext_cmds='.sl' ++ dynamic_linker="$host_os dld.sl" ++ shlibpath_var=SHLIB_PATH ++ shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH ++ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ++ soname_spec='${libname}${release}${shared_ext}$major' ++ ;; ++ esac ++ # HP-UX runs *really* slowly unless shared libraries are mode 555. ++ postinstall_cmds='chmod 555 $lib' ++ ;; ++ ++irix5* | irix6* | nonstopux*) ++ case $host_os in ++ nonstopux*) version_type=nonstopux ;; ++ *) ++ if test "$lt_cv_prog_gnu_ld" = yes; then ++ version_type=linux ++ else ++ version_type=irix ++ fi ;; ++ esac ++ need_lib_prefix=no ++ need_version=no ++ soname_spec='${libname}${release}${shared_ext}$major' ++ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' ++ case $host_os in ++ irix5* | nonstopux*) ++ libsuff= shlibsuff= ++ ;; ++ *) ++ case $LD in # libtool.m4 will add one of these switches to LD ++ *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") ++ libsuff= shlibsuff= libmagic=32-bit;; ++ *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") ++ libsuff=32 shlibsuff=N32 libmagic=N32;; ++ *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") ++ libsuff=64 shlibsuff=64 libmagic=64-bit;; ++ *) libsuff= shlibsuff= libmagic=never-match;; ++ esac ++ ;; ++ esac ++ shlibpath_var=LD_LIBRARY${shlibsuff}_PATH ++ shlibpath_overrides_runpath=no ++ sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" ++ sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" ++ hardcode_into_libs=yes ++ ;; ++ ++# No shared lib support for Linux oldld, aout, or coff. ++linux*oldld* | linux*aout* | linux*coff*) ++ dynamic_linker=no ++ ;; ++ ++# This must be Linux ELF. ++linux*) ++ version_type=linux ++ need_lib_prefix=no ++ need_version=no ++ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ++ soname_spec='${libname}${release}${shared_ext}$major' ++ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' ++ shlibpath_var=LD_LIBRARY_PATH ++ shlibpath_overrides_runpath=no ++ # This implies no fast_install, which is unacceptable. ++ # Some rework will be needed to allow for fast_install ++ # before this can be enabled. ++ hardcode_into_libs=yes ++ ++ # Append ld.so.conf contents to the search path ++ if test -f /etc/ld.so.conf; then ++ lt_ld_extra=`$SED -e 's/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g' /etc/ld.so.conf | tr '\n' ' '` ++ sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" ++ fi ++ ++ # We used to test for /lib/ld.so.1 and disable shared libraries on ++ # powerpc, because MkLinux only supported shared libraries with the ++ # GNU dynamic linker. Since this was broken with cross compilers, ++ # most powerpc-linux boxes support dynamic linking these days and ++ # people can always --disable-shared, the test was removed, and we ++ # assume the GNU/Linux dynamic linker is in use. ++ dynamic_linker='GNU/Linux ld.so' ++ ;; ++ ++netbsdelf*-gnu) ++ version_type=linux ++ need_lib_prefix=no ++ need_version=no ++ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' ++ soname_spec='${libname}${release}${shared_ext}$major' ++ shlibpath_var=LD_LIBRARY_PATH ++ shlibpath_overrides_runpath=no ++ hardcode_into_libs=yes ++ dynamic_linker='NetBSD ld.elf_so' ++ ;; ++ ++knetbsd*-gnu) ++ version_type=linux ++ need_lib_prefix=no ++ need_version=no ++ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' ++ soname_spec='${libname}${release}${shared_ext}$major' ++ shlibpath_var=LD_LIBRARY_PATH ++ shlibpath_overrides_runpath=no ++ hardcode_into_libs=yes ++ dynamic_linker='GNU ld.so' ++ ;; ++ ++netbsd*) ++ version_type=sunos ++ need_lib_prefix=no ++ need_version=no ++ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then ++ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' ++ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' ++ dynamic_linker='NetBSD (a.out) ld.so' ++ else ++ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' ++ soname_spec='${libname}${release}${shared_ext}$major' ++ dynamic_linker='NetBSD ld.elf_so' ++ fi ++ shlibpath_var=LD_LIBRARY_PATH ++ shlibpath_overrides_runpath=yes ++ hardcode_into_libs=yes ++ ;; ++ ++newsos6) ++ version_type=linux ++ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ++ shlibpath_var=LD_LIBRARY_PATH ++ shlibpath_overrides_runpath=yes ++ ;; ++ ++nto-qnx*) ++ version_type=linux ++ need_lib_prefix=no ++ need_version=no ++ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ++ soname_spec='${libname}${release}${shared_ext}$major' ++ shlibpath_var=LD_LIBRARY_PATH ++ shlibpath_overrides_runpath=yes ++ ;; ++ ++openbsd*) ++ version_type=sunos ++ need_lib_prefix=no ++ need_version=yes ++ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' ++ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' ++ shlibpath_var=LD_LIBRARY_PATH ++ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then ++ case $host_os in ++ openbsd2.[[89]] | openbsd2.[[89]].*) ++ shlibpath_overrides_runpath=no ++ ;; ++ *) ++ shlibpath_overrides_runpath=yes ++ ;; ++ esac ++ else ++ shlibpath_overrides_runpath=yes ++ fi ++ ;; ++ ++os2*) ++ libname_spec='$name' ++ shrext_cmds=".dll" ++ need_lib_prefix=no ++ library_names_spec='$libname${shared_ext} $libname.a' ++ dynamic_linker='OS/2 ld.exe' ++ shlibpath_var=LIBPATH ++ ;; ++ ++osf3* | osf4* | osf5*) ++ version_type=osf ++ need_lib_prefix=no ++ need_version=no ++ soname_spec='${libname}${release}${shared_ext}$major' ++ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ++ shlibpath_var=LD_LIBRARY_PATH ++ sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" ++ sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ++ ;; ++ ++sco3.2v5*) ++ version_type=osf ++ soname_spec='${libname}${release}${shared_ext}$major' ++ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ++ shlibpath_var=LD_LIBRARY_PATH ++ ;; ++ ++solaris*) ++ version_type=linux ++ need_lib_prefix=no ++ need_version=no ++ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ++ soname_spec='${libname}${release}${shared_ext}$major' ++ shlibpath_var=LD_LIBRARY_PATH ++ shlibpath_overrides_runpath=yes ++ hardcode_into_libs=yes ++ # ldd complains unless libraries are executable ++ postinstall_cmds='chmod +x $lib' ++ ;; ++ ++sunos4*) ++ version_type=sunos ++ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' ++ finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' ++ shlibpath_var=LD_LIBRARY_PATH ++ shlibpath_overrides_runpath=yes ++ if test "$with_gnu_ld" = yes; then ++ need_lib_prefix=no ++ fi ++ need_version=yes ++ ;; ++ ++sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) ++ version_type=linux ++ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ++ soname_spec='${libname}${release}${shared_ext}$major' ++ shlibpath_var=LD_LIBRARY_PATH ++ case $host_vendor in ++ sni) ++ shlibpath_overrides_runpath=no ++ need_lib_prefix=no ++ export_dynamic_flag_spec='${wl}-Blargedynsym' ++ runpath_var=LD_RUN_PATH ++ ;; ++ siemens) ++ need_lib_prefix=no ++ ;; ++ motorola) ++ need_lib_prefix=no ++ need_version=no ++ shlibpath_overrides_runpath=no ++ sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ++ ;; ++ esac ++ ;; ++ ++sysv4*MP*) ++ if test -d /usr/nec ;then ++ version_type=linux ++ library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' ++ soname_spec='$libname${shared_ext}.$major' ++ shlibpath_var=LD_LIBRARY_PATH ++ fi ++ ;; ++ ++uts4*) ++ version_type=linux ++ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ++ soname_spec='${libname}${release}${shared_ext}$major' ++ shlibpath_var=LD_LIBRARY_PATH ++ ;; ++ ++*) ++ dynamic_linker=no ++ ;; ++esac ++AC_MSG_RESULT([$dynamic_linker]) ++test "$dynamic_linker" = no && can_build_shared=no ++])# AC_LIBTOOL_SYS_DYNAMIC_LINKER ++ ++ ++# _LT_AC_TAGCONFIG ++# ---------------- ++AC_DEFUN([_LT_AC_TAGCONFIG], ++[AC_ARG_WITH([tags], ++ [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@], ++ [include additional configurations @<:@automatic@:>@])], ++ [tagnames="$withval"]) ++ ++if test -f "$ltmain" && test -n "$tagnames"; then ++ if test ! -f "${ofile}"; then ++ AC_MSG_WARN([output file `$ofile' does not exist]) ++ fi ++ ++ if test -z "$LTCC"; then ++ eval "`$SHELL ${ofile} --config | grep '^LTCC='`" ++ if test -z "$LTCC"; then ++ AC_MSG_WARN([output file `$ofile' does not look like a libtool script]) ++ else ++ AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile']) ++ fi ++ fi ++ ++ # Extract list of available tagged configurations in $ofile. ++ # Note that this assumes the entire list is on one line. ++ available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` ++ ++ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," ++ for tagname in $tagnames; do ++ IFS="$lt_save_ifs" ++ # Check whether tagname contains only valid characters ++ case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in ++ "") ;; ++ *) AC_MSG_ERROR([invalid tag name: $tagname]) ++ ;; ++ esac ++ ++ if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null ++ then ++ AC_MSG_ERROR([tag name \"$tagname\" already exists]) ++ fi ++ ++ # Update the list of available tags. ++ if test -n "$tagname"; then ++ echo appending configuration tag \"$tagname\" to $ofile ++ ++ case $tagname in ++ CXX) ++ if test -n "$CXX" && test "X$CXX" != "Xno"; then ++ AC_LIBTOOL_LANG_CXX_CONFIG ++ else ++ tagname="" ++ fi ++ ;; ++ ++ F77) ++ if test -n "$F77" && test "X$F77" != "Xno"; then ++ AC_LIBTOOL_LANG_F77_CONFIG ++ else ++ tagname="" ++ fi ++ ;; ++ ++ GCJ) ++ if test -n "$GCJ" && test "X$GCJ" != "Xno"; then ++ AC_LIBTOOL_LANG_GCJ_CONFIG ++ else ++ tagname="" ++ fi ++ ;; ++ ++ RC) ++ AC_LIBTOOL_LANG_RC_CONFIG ++ ;; ++ ++ *) ++ AC_MSG_ERROR([Unsupported tag name: $tagname]) ++ ;; ++ esac ++ ++ # Append the new tag name to the list of available tags. ++ if test -n "$tagname" ; then ++ available_tags="$available_tags $tagname" ++ fi ++ fi ++ done ++ IFS="$lt_save_ifs" ++ ++ # Now substitute the updated list of available tags. ++ if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then ++ mv "${ofile}T" "$ofile" ++ chmod +x "$ofile" ++ else ++ rm -f "${ofile}T" ++ AC_MSG_ERROR([unable to update list of available tagged configurations.]) ++ fi ++fi ++])# _LT_AC_TAGCONFIG ++ ++ ++# AC_LIBTOOL_DLOPEN ++# ----------------- ++# enable checks for dlopen support ++AC_DEFUN([AC_LIBTOOL_DLOPEN], ++ [AC_BEFORE([$0],[AC_LIBTOOL_SETUP]) ++])# AC_LIBTOOL_DLOPEN ++ ++ ++# AC_LIBTOOL_WIN32_DLL ++# -------------------- ++# declare package support for building win32 dll's ++AC_DEFUN([AC_LIBTOOL_WIN32_DLL], ++[AC_BEFORE([$0], [AC_LIBTOOL_SETUP]) ++])# AC_LIBTOOL_WIN32_DLL ++ ++ ++# AC_ENABLE_SHARED([DEFAULT]) ++# --------------------------- ++# implement the --enable-shared flag ++# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. ++AC_DEFUN([AC_ENABLE_SHARED], ++[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl ++AC_ARG_ENABLE([shared], ++ [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@], ++ [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])], ++ [p=${PACKAGE-default} ++ case $enableval in ++ yes) enable_shared=yes ;; ++ no) enable_shared=no ;; ++ *) ++ enable_shared=no ++ # Look at the argument we got. We use all the common list separators. ++ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," ++ for pkg in $enableval; do ++ IFS="$lt_save_ifs" ++ if test "X$pkg" = "X$p"; then ++ enable_shared=yes ++ fi ++ done ++ IFS="$lt_save_ifs" ++ ;; ++ esac], ++ [enable_shared=]AC_ENABLE_SHARED_DEFAULT) ++])# AC_ENABLE_SHARED ++ ++ ++# AC_DISABLE_SHARED ++# ----------------- ++#- set the default shared flag to --disable-shared ++AC_DEFUN([AC_DISABLE_SHARED], ++[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl ++AC_ENABLE_SHARED(no) ++])# AC_DISABLE_SHARED ++ ++ ++# AC_ENABLE_STATIC([DEFAULT]) ++# --------------------------- ++# implement the --enable-static flag ++# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. ++AC_DEFUN([AC_ENABLE_STATIC], ++[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl ++AC_ARG_ENABLE([static], ++ [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@], ++ [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])], ++ [p=${PACKAGE-default} ++ case $enableval in ++ yes) enable_static=yes ;; ++ no) enable_static=no ;; ++ *) ++ enable_static=no ++ # Look at the argument we got. We use all the common list separators. ++ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," ++ for pkg in $enableval; do ++ IFS="$lt_save_ifs" ++ if test "X$pkg" = "X$p"; then ++ enable_static=yes ++ fi ++ done ++ IFS="$lt_save_ifs" ++ ;; ++ esac], ++ [enable_static=]AC_ENABLE_STATIC_DEFAULT) ++])# AC_ENABLE_STATIC ++ ++ ++# AC_DISABLE_STATIC ++# ----------------- ++# set the default static flag to --disable-static ++AC_DEFUN([AC_DISABLE_STATIC], ++[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl ++AC_ENABLE_STATIC(no) ++])# AC_DISABLE_STATIC ++ ++ ++# AC_ENABLE_FAST_INSTALL([DEFAULT]) ++# --------------------------------- ++# implement the --enable-fast-install flag ++# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. ++AC_DEFUN([AC_ENABLE_FAST_INSTALL], ++[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl ++AC_ARG_ENABLE([fast-install], ++ [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], ++ [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], ++ [p=${PACKAGE-default} ++ case $enableval in ++ yes) enable_fast_install=yes ;; ++ no) enable_fast_install=no ;; ++ *) ++ enable_fast_install=no ++ # Look at the argument we got. We use all the common list separators. ++ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," ++ for pkg in $enableval; do ++ IFS="$lt_save_ifs" ++ if test "X$pkg" = "X$p"; then ++ enable_fast_install=yes ++ fi ++ done ++ IFS="$lt_save_ifs" ++ ;; ++ esac], ++ [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT) ++])# AC_ENABLE_FAST_INSTALL ++ ++ ++# AC_DISABLE_FAST_INSTALL ++# ----------------------- ++# set the default to --disable-fast-install ++AC_DEFUN([AC_DISABLE_FAST_INSTALL], ++[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl ++AC_ENABLE_FAST_INSTALL(no) ++])# AC_DISABLE_FAST_INSTALL ++ ++ ++# AC_LIBTOOL_PICMODE([MODE]) ++# -------------------------- ++# implement the --with-pic flag ++# MODE is either `yes' or `no'. If omitted, it defaults to `both'. ++AC_DEFUN([AC_LIBTOOL_PICMODE], ++[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl ++pic_mode=ifelse($#,1,$1,default) ++])# AC_LIBTOOL_PICMODE ++ ++ ++# AC_PROG_EGREP ++# ------------- ++# This is predefined starting with Autoconf 2.54, so this conditional ++# definition can be removed once we require Autoconf 2.54 or later. ++m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP], ++[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep], ++ [if echo a | (grep -E '(a|b)') >/dev/null 2>&1 ++ then ac_cv_prog_egrep='grep -E' ++ else ac_cv_prog_egrep='egrep' ++ fi]) ++ EGREP=$ac_cv_prog_egrep ++ AC_SUBST([EGREP]) ++])]) ++ ++ ++# AC_PATH_TOOL_PREFIX ++# ------------------- ++# find a file program which can recognise shared library ++AC_DEFUN([AC_PATH_TOOL_PREFIX], ++[AC_REQUIRE([AC_PROG_EGREP])dnl ++AC_MSG_CHECKING([for $1]) ++AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, ++[case $MAGIC_CMD in ++[[\\/*] | ?:[\\/]*]) ++ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ++ ;; ++*) ++ lt_save_MAGIC_CMD="$MAGIC_CMD" ++ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ++dnl $ac_dummy forces splitting on constant user-supplied paths. ++dnl POSIX.2 word splitting is done only on the output of word expansions, ++dnl not every word. This closes a longstanding sh security hole. ++ ac_dummy="ifelse([$2], , $PATH, [$2])" ++ for ac_dir in $ac_dummy; do ++ IFS="$lt_save_ifs" ++ test -z "$ac_dir" && ac_dir=. ++ if test -f $ac_dir/$1; then ++ lt_cv_path_MAGIC_CMD="$ac_dir/$1" ++ if test -n "$file_magic_test_file"; then ++ case $deplibs_check_method in ++ "file_magic "*) ++ file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" ++ MAGIC_CMD="$lt_cv_path_MAGIC_CMD" ++ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | ++ $EGREP "$file_magic_regex" > /dev/null; then ++ : ++ else ++ cat <<EOF 1>&2 ++ ++*** Warning: the command libtool uses to detect shared libraries, ++*** $file_magic_cmd, produces output that libtool cannot recognize. ++*** The result is that libtool may fail to recognize shared libraries ++*** as such. This will affect the creation of libtool libraries that ++*** depend on shared libraries, but programs linked with such libtool ++*** libraries will work regardless of this problem. Nevertheless, you ++*** may want to report the problem to your system manager and/or to ++*** bug-libtool@gnu.org ++ ++EOF ++ fi ;; ++ esac ++ fi ++ break ++ fi ++ done ++ IFS="$lt_save_ifs" ++ MAGIC_CMD="$lt_save_MAGIC_CMD" ++ ;; ++esac]) ++MAGIC_CMD="$lt_cv_path_MAGIC_CMD" ++if test -n "$MAGIC_CMD"; then ++ AC_MSG_RESULT($MAGIC_CMD) ++else ++ AC_MSG_RESULT(no) ++fi ++])# AC_PATH_TOOL_PREFIX ++ ++ ++# AC_PATH_MAGIC ++# ------------- ++# find a file program which can recognise a shared library ++AC_DEFUN([AC_PATH_MAGIC], ++[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) ++if test -z "$lt_cv_path_MAGIC_CMD"; then ++ if test -n "$ac_tool_prefix"; then ++ AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) ++ else ++ MAGIC_CMD=: ++ fi ++fi ++])# AC_PATH_MAGIC ++ ++ ++# AC_PROG_LD ++# ---------- ++# find the pathname to the GNU or non-GNU linker ++AC_DEFUN([AC_PROG_LD], ++[AC_ARG_WITH([gnu-ld], ++ [AC_HELP_STRING([--with-gnu-ld], ++ [assume the C compiler uses GNU ld @<:@default=no@:>@])], ++ [test "$withval" = no || with_gnu_ld=yes], ++ [with_gnu_ld=no]) ++AC_REQUIRE([LT_AC_PROG_SED])dnl ++AC_REQUIRE([AC_PROG_CC])dnl ++AC_REQUIRE([AC_CANONICAL_HOST])dnl ++AC_REQUIRE([AC_CANONICAL_BUILD])dnl ++ac_prog=ld ++if test "$GCC" = yes; then ++ # Check if gcc -print-prog-name=ld gives a path. ++ AC_MSG_CHECKING([for ld used by $CC]) ++ case $host in ++ *-*-mingw*) ++ # gcc leaves a trailing carriage return which upsets mingw ++ ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; ++ *) ++ ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; ++ esac ++ case $ac_prog in ++ # Accept absolute paths. ++ [[\\/]]* | ?:[[\\/]]*) ++ re_direlt='/[[^/]][[^/]]*/\.\./' ++ # Canonicalize the pathname of ld ++ ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` ++ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ++ ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` ++ done ++ test -z "$LD" && LD="$ac_prog" ++ ;; ++ "") ++ # If it fails, then pretend we aren't using GCC. ++ ac_prog=ld ++ ;; ++ *) ++ # If it is relative, then search for the first ld in PATH. ++ with_gnu_ld=unknown ++ ;; ++ esac ++elif test "$with_gnu_ld" = yes; then ++ AC_MSG_CHECKING([for GNU ld]) ++else ++ AC_MSG_CHECKING([for non-GNU ld]) ++fi ++AC_CACHE_VAL(lt_cv_path_LD, ++[if test -z "$LD"; then ++ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ++ for ac_dir in $PATH; do ++ IFS="$lt_save_ifs" ++ test -z "$ac_dir" && ac_dir=. ++ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then ++ lt_cv_path_LD="$ac_dir/$ac_prog" ++ # Check to see if the program is GNU ld. I'd rather use --version, ++ # but apparently some GNU ld's only accept -v. ++ # Break only if it was the GNU/non-GNU ld that we prefer. ++ case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in ++ *GNU* | *'with BFD'*) ++ test "$with_gnu_ld" != no && break ++ ;; ++ *) ++ test "$with_gnu_ld" != yes && break ++ ;; ++ esac ++ fi ++ done ++ IFS="$lt_save_ifs" ++else ++ lt_cv_path_LD="$LD" # Let the user override the test with a path. ++fi]) ++LD="$lt_cv_path_LD" ++if test -n "$LD"; then ++ AC_MSG_RESULT($LD) ++else ++ AC_MSG_RESULT(no) ++fi ++test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) ++AC_PROG_LD_GNU ++])# AC_PROG_LD ++ ++ ++# AC_PROG_LD_GNU ++# -------------- ++AC_DEFUN([AC_PROG_LD_GNU], ++[AC_REQUIRE([AC_PROG_EGREP])dnl ++AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld, ++[# I'd rather use --version here, but apparently some GNU ld's only accept -v. ++case `$LD -v 2>&1 </dev/null` in ++*GNU* | *'with BFD'*) ++ lt_cv_prog_gnu_ld=yes ++ ;; ++*) ++ lt_cv_prog_gnu_ld=no ++ ;; ++esac]) ++with_gnu_ld=$lt_cv_prog_gnu_ld ++])# AC_PROG_LD_GNU ++ ++ ++# AC_PROG_LD_RELOAD_FLAG ++# ---------------------- ++# find reload flag for linker ++# -- PORTME Some linkers may need a different reload flag. ++AC_DEFUN([AC_PROG_LD_RELOAD_FLAG], ++[AC_CACHE_CHECK([for $LD option to reload object files], ++ lt_cv_ld_reload_flag, ++ [lt_cv_ld_reload_flag='-r']) ++reload_flag=$lt_cv_ld_reload_flag ++case $reload_flag in ++"" | " "*) ;; ++*) reload_flag=" $reload_flag" ;; ++esac ++reload_cmds='$LD$reload_flag -o $output$reload_objs' ++])# AC_PROG_LD_RELOAD_FLAG ++ ++ ++# AC_DEPLIBS_CHECK_METHOD ++# ----------------------- ++# how to check for library dependencies ++# -- PORTME fill in with the dynamic library characteristics ++AC_DEFUN([AC_DEPLIBS_CHECK_METHOD], ++[AC_CACHE_CHECK([how to recognise dependent libraries], ++lt_cv_deplibs_check_method, ++[lt_cv_file_magic_cmd='$MAGIC_CMD' ++lt_cv_file_magic_test_file= ++lt_cv_deplibs_check_method='unknown' ++# Need to set the preceding variable on all platforms that support ++# interlibrary dependencies. ++# 'none' -- dependencies not supported. ++# `unknown' -- same as none, but documents that we really don't know. ++# 'pass_all' -- all dependencies passed with no checks. ++# 'test_compile' -- check by making test program. ++# 'file_magic [[regex]]' -- check by looking for files in library path ++# which responds to the $file_magic_cmd with a given extended regex. ++# If you have `file' or equivalent on your system and you're not sure ++# whether `pass_all' will *always* work, you probably want this one. ++ ++case $host_os in ++aix4* | aix5*) ++ lt_cv_deplibs_check_method=pass_all ++ ;; ++ ++beos*) ++ lt_cv_deplibs_check_method=pass_all ++ ;; ++ ++bsdi4*) ++ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)' ++ lt_cv_file_magic_cmd='/usr/bin/file -L' ++ lt_cv_file_magic_test_file=/shlib/libc.so ++ ;; ++ ++cygwin*) ++ # func_win32_libid is a shell function defined in ltmain.sh ++ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' ++ lt_cv_file_magic_cmd='func_win32_libid' ++ ;; ++ ++mingw* | pw32*) ++ # Base MSYS/MinGW do not provide the 'file' command needed by ++ # func_win32_libid shell function, so use a weaker test based on 'objdump'. ++ lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' ++ lt_cv_file_magic_cmd='$OBJDUMP -f' ++ ;; ++ ++darwin* | rhapsody*) ++ lt_cv_deplibs_check_method=pass_all ++ ;; ++ ++freebsd* | kfreebsd*-gnu) ++ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then ++ case $host_cpu in ++ i*86 ) ++ # Not sure whether the presence of OpenBSD here was a mistake. ++ # Let's accept both of them until this is cleared up. ++ lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[[3-9]]86 (compact )?demand paged shared library' ++ lt_cv_file_magic_cmd=/usr/bin/file ++ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ++ ;; ++ esac ++ else ++ lt_cv_deplibs_check_method=pass_all ++ fi ++ ;; ++ ++gnu*) ++ lt_cv_deplibs_check_method=pass_all ++ ;; ++ ++hpux10.20* | hpux11*) ++ lt_cv_file_magic_cmd=/usr/bin/file ++ case "$host_cpu" in ++ ia64*) ++ lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' ++ lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ++ ;; ++ hppa*64*) ++ [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] ++ lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ++ ;; ++ *) ++ lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' ++ lt_cv_file_magic_test_file=/usr/lib/libc.sl ++ ;; ++ esac ++ ;; ++ ++irix5* | irix6* | nonstopux*) ++ case $LD in ++ *-32|*"-32 ") libmagic=32-bit;; ++ *-n32|*"-n32 ") libmagic=N32;; ++ *-64|*"-64 ") libmagic=64-bit;; ++ *) libmagic=never-match;; ++ esac ++ lt_cv_deplibs_check_method=pass_all ++ ;; ++ ++# This must be Linux ELF. ++linux*) ++ lt_cv_deplibs_check_method=pass_all ++ ;; ++ ++netbsd* | netbsdelf*-gnu | knetbsd*-gnu) ++ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then ++ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' ++ else ++ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' ++ fi ++ ;; ++ ++newos6*) ++ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' ++ lt_cv_file_magic_cmd=/usr/bin/file ++ lt_cv_file_magic_test_file=/usr/lib/libnls.so ++ ;; ++ ++nto-qnx*) ++ lt_cv_deplibs_check_method=unknown ++ ;; ++ ++openbsd*) ++ lt_cv_file_magic_cmd=/usr/bin/file ++ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ++ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then ++ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' ++ else ++ lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' ++ fi ++ ;; ++ ++osf3* | osf4* | osf5*) ++ lt_cv_deplibs_check_method=pass_all ++ ;; ++ ++sco3.2v5*) ++ lt_cv_deplibs_check_method=pass_all ++ ;; ++ ++solaris*) ++ lt_cv_deplibs_check_method=pass_all ++ ;; ++ ++sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) ++ case $host_vendor in ++ motorola) ++ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' ++ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ++ ;; ++ ncr) ++ lt_cv_deplibs_check_method=pass_all ++ ;; ++ sequent) ++ lt_cv_file_magic_cmd='/bin/file' ++ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ++ ;; ++ sni) ++ lt_cv_file_magic_cmd='/bin/file' ++ lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" ++ lt_cv_file_magic_test_file=/lib/libc.so ++ ;; ++ siemens) ++ lt_cv_deplibs_check_method=pass_all + ;; ++ esac ++ ;; ++ ++sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7* | sysv4*uw2*) ++ lt_cv_deplibs_check_method=pass_all ++ ;; ++esac ++]) ++file_magic_cmd=$lt_cv_file_magic_cmd ++deplibs_check_method=$lt_cv_deplibs_check_method ++test -z "$deplibs_check_method" && deplibs_check_method=unknown ++])# AC_DEPLIBS_CHECK_METHOD + +- netbsd*) +- if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then +- archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' +- wlarc= +- else +- archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' +- archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ++ ++# AC_PROG_NM ++# ---------- ++# find the pathname to a BSD-compatible name lister ++AC_DEFUN([AC_PROG_NM], ++[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM, ++[if test -n "$NM"; then ++ # Let the user override the test. ++ lt_cv_path_NM="$NM" ++else ++ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ++ for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do ++ IFS="$lt_save_ifs" ++ test -z "$ac_dir" && ac_dir=. ++ tmp_nm="$ac_dir/${ac_tool_prefix}nm" ++ if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then ++ # Check to see if the nm accepts a BSD-compat flag. ++ # Adding the `sed 1q' prevents false positives on HP-UX, which says: ++ # nm: unknown option "B" ignored ++ # Tru64's nm complains that /dev/null is an invalid object file ++ case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in ++ */dev/null* | *'Invalid file or object type'*) ++ lt_cv_path_NM="$tmp_nm -B" ++ break ++ ;; ++ *) ++ case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in ++ */dev/null*) ++ lt_cv_path_NM="$tmp_nm -p" ++ break ++ ;; ++ *) ++ lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but ++ continue # so that we can try to find one that supports BSD flags ++ ;; ++ esac ++ esac + fi +- ;; ++ done ++ IFS="$lt_save_ifs" ++ test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm ++fi]) ++NM="$lt_cv_path_NM" ++])# AC_PROG_NM + +- solaris* | sysv5*) +- if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then +- ld_shlibs=no +- cat <<EOF 1>&2 + +-*** Warning: The releases 2.8.* of the GNU linker cannot reliably +-*** create shared libraries on Solaris systems. Therefore, libtool +-*** is disabling shared libraries support. We urge you to upgrade GNU +-*** binutils to release 2.9.1 or newer. Another option is to modify +-*** your PATH or compiler configuration so that the native linker is +-*** used, and then restart. ++# AC_CHECK_LIBM ++# ------------- ++# check for math library ++AC_DEFUN([AC_CHECK_LIBM], ++[AC_REQUIRE([AC_CANONICAL_HOST])dnl ++LIBM= ++case $host in ++*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) ++ # These system don't have libm, or don't need it ++ ;; ++*-ncr-sysv4.3*) ++ AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") ++ AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ++ ;; ++*) ++ AC_CHECK_LIB(m, cos, LIBM="-lm") ++ ;; ++esac ++])# AC_CHECK_LIBM + +-EOF +- elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then +- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' +- archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' +- else +- ld_shlibs=no +- fi +- ;; + +- sunos4*) +- archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' +- wlarc= +- hardcode_direct=yes +- hardcode_shlibpath_var=no +- ;; ++# AC_LIBLTDL_CONVENIENCE([DIRECTORY]) ++# ----------------------------------- ++# sets LIBLTDL to the link flags for the libltdl convenience library and ++# LTDLINCL to the include flags for the libltdl header and adds ++# --enable-ltdl-convenience to the configure arguments. Note that LIBLTDL ++# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If ++# DIRECTORY is not provided, it is assumed to be `libltdl'. LIBLTDL will ++# be prefixed with '${top_builddir}/' and LTDLINCL will be prefixed with ++# '${top_srcdir}/' (note the single quotes!). If your package is not ++# flat and you're not using automake, define top_builddir and ++# top_srcdir appropriately in the Makefiles. ++AC_DEFUN([AC_LIBLTDL_CONVENIENCE], ++[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl ++ case $enable_ltdl_convenience in ++ no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; ++ "") enable_ltdl_convenience=yes ++ ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; ++ esac ++ LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la ++ LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) ++ # For backwards non-gettext consistent compatibility... ++ INCLTDL="$LTDLINCL" ++])# AC_LIBLTDL_CONVENIENCE + +- *) +- if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then +- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' +- archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' +- else +- ld_shlibs=no +- fi ++ ++# AC_LIBLTDL_INSTALLABLE([DIRECTORY]) ++# ----------------------------------- ++# sets LIBLTDL to the link flags for the libltdl installable library and ++# LTDLINCL to the include flags for the libltdl header and adds ++# --enable-ltdl-install to the configure arguments. Note that LIBLTDL ++# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If ++# DIRECTORY is not provided and an installed libltdl is not found, it is ++# assumed to be `libltdl'. LIBLTDL will be prefixed with '${top_builddir}/' ++# and LTDLINCL will be prefixed with '${top_srcdir}/' (note the single ++# quotes!). If your package is not flat and you're not using automake, ++# define top_builddir and top_srcdir appropriately in the Makefiles. ++# In the future, this macro may have to be called after AC_PROG_LIBTOOL. ++AC_DEFUN([AC_LIBLTDL_INSTALLABLE], ++[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl ++ AC_CHECK_LIB(ltdl, lt_dlinit, ++ [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], ++ [if test x"$enable_ltdl_install" = xno; then ++ AC_MSG_WARN([libltdl not installed, but installation disabled]) ++ else ++ enable_ltdl_install=yes ++ fi ++ ]) ++ if test x"$enable_ltdl_install" = x"yes"; then ++ ac_configure_args="$ac_configure_args --enable-ltdl-install" ++ LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la ++ LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) ++ else ++ ac_configure_args="$ac_configure_args --enable-ltdl-install=no" ++ LIBLTDL="-lltdl" ++ LTDLINCL= ++ fi ++ # For backwards non-gettext consistent compatibility... ++ INCLTDL="$LTDLINCL" ++])# AC_LIBLTDL_INSTALLABLE ++ ++ ++# AC_LIBTOOL_CXX ++# -------------- ++# enable support for C++ libraries ++AC_DEFUN([AC_LIBTOOL_CXX], ++[AC_REQUIRE([_LT_AC_LANG_CXX]) ++])# AC_LIBTOOL_CXX ++ ++ ++# _LT_AC_LANG_CXX ++# --------------- ++AC_DEFUN([_LT_AC_LANG_CXX], ++[AC_REQUIRE([AC_PROG_CXX]) ++AC_REQUIRE([AC_PROG_CXXCPP]) ++_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX]) ++])# _LT_AC_LANG_CXX ++ ++ ++# AC_LIBTOOL_F77 ++# -------------- ++# enable support for Fortran 77 libraries ++AC_DEFUN([AC_LIBTOOL_F77], ++[AC_REQUIRE([_LT_AC_LANG_F77]) ++])# AC_LIBTOOL_F77 ++ ++ ++# _LT_AC_LANG_F77 ++# --------------- ++AC_DEFUN([_LT_AC_LANG_F77], ++[AC_REQUIRE([AC_PROG_F77]) ++_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77]) ++])# _LT_AC_LANG_F77 ++ ++ ++# AC_LIBTOOL_GCJ ++# -------------- ++# enable support for GCJ libraries ++AC_DEFUN([AC_LIBTOOL_GCJ], ++[AC_REQUIRE([_LT_AC_LANG_GCJ]) ++])# AC_LIBTOOL_GCJ ++ ++ ++# _LT_AC_LANG_GCJ ++# --------------- ++AC_DEFUN([_LT_AC_LANG_GCJ], ++[AC_PROVIDE_IFELSE([AC_PROG_GCJ],[], ++ [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[], ++ [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[], ++ [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])], ++ [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])], ++ [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])]) ++_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ]) ++])# _LT_AC_LANG_GCJ ++ ++ ++# AC_LIBTOOL_RC ++# -------------- ++# enable support for Windows resource files ++AC_DEFUN([AC_LIBTOOL_RC], ++[AC_REQUIRE([LT_AC_PROG_RC]) ++_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC]) ++])# AC_LIBTOOL_RC ++ ++ ++# AC_LIBTOOL_LANG_C_CONFIG ++# ------------------------ ++# Ensure that the configuration vars for the C compiler are ++# suitably defined. Those variables are subsequently used by ++# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. ++AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG]) ++AC_DEFUN([_LT_AC_LANG_C_CONFIG], ++[lt_save_CC="$CC" ++AC_LANG_PUSH(C) ++ ++# Source file extension for C test sources. ++ac_ext=c ++ ++# Object file extension for compiled C test sources. ++objext=o ++_LT_AC_TAGVAR(objext, $1)=$objext ++ ++# Code to be used in simple compile tests ++lt_simple_compile_test_code="int some_variable = 0;\n" ++ ++# Code to be used in simple link tests ++lt_simple_link_test_code='int main(){return(0);}\n' ++ ++_LT_AC_SYS_COMPILER ++ ++# ++# Check for any special shared library compilation flags. ++# ++_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)= ++if test "$GCC" = no; then ++ case $host_os in ++ sco3.2v5*) ++ _LT_AC_TAGVAR(lt_prog_cc_shlib, $1)='-belf' + ;; + esac ++fi ++if test -n "$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)"; then ++ AC_MSG_WARN([`$CC' requires `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to build shared libraries]) ++ if echo "$old_CC $old_CFLAGS " | grep "[[ ]]$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)[[ ]]" >/dev/null; then : ++ else ++ AC_MSG_WARN([add `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to the CC or CFLAGS env variable and reconfigure]) ++ _LT_AC_TAGVAR(lt_cv_prog_cc_can_build_shared, $1)=no ++ fi ++fi + +- if test "$ld_shlibs" = yes; then +- runpath_var=LD_RUN_PATH +- hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' +- export_dynamic_flag_spec='${wl}--export-dynamic' +- case $host_os in +- cygwin* | mingw* | pw32*) +- # dlltool doesn't understand --whole-archive et. al. +- whole_archive_flag_spec= ++ ++# ++# Check to make sure the static flag actually works. ++# ++AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $_LT_AC_TAGVAR(lt_prog_compiler_static, $1) works], ++ _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1), ++ $_LT_AC_TAGVAR(lt_prog_compiler_static, $1), ++ [], ++ [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) ++ ++ ++AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) ++AC_LIBTOOL_PROG_COMPILER_PIC($1) ++AC_LIBTOOL_PROG_CC_C_O($1) ++AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) ++AC_LIBTOOL_PROG_LD_SHLIBS($1) ++AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) ++AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) ++AC_LIBTOOL_SYS_LIB_STRIP ++AC_LIBTOOL_DLOPEN_SELF($1) ++ ++# Report which librarie types wil actually be built ++AC_MSG_CHECKING([if libtool supports shared libraries]) ++AC_MSG_RESULT([$can_build_shared]) ++ ++AC_MSG_CHECKING([whether to build shared libraries]) ++test "$can_build_shared" = "no" && enable_shared=no ++ ++# On AIX, shared libraries and static libraries use the same namespace, and ++# are all built from PIC. ++case "$host_os" in ++aix3*) ++ test "$enable_shared" = yes && enable_static=no ++ if test -n "$RANLIB"; then ++ archive_cmds="$archive_cmds~\$RANLIB \$lib" ++ postinstall_cmds='$RANLIB $lib' ++ fi ++ ;; ++ ++aix4* | aix5*) ++ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then ++ test "$enable_shared" = yes && enable_static=no ++ fi ++ ;; ++ darwin* | rhapsody*) ++ if test "$GCC" = yes; then ++ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ++ case "$host_os" in ++ rhapsody* | darwin1.[[012]]) ++ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' + ;; +- *) +- # ancient GNU ld didn't support --whole-archive et. al. +- if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then +- whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' ++ *) # Darwin 1.3 on ++ if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then ++ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + else +- whole_archive_flag_spec= ++ case ${MACOSX_DEPLOYMENT_TARGET} in ++ 10.[[012]]) ++ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' ++ ;; ++ 10.*) ++ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup' ++ ;; ++ esac + fi + ;; + esac ++ output_verbose_link_cmd='echo' ++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring' ++ _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' ++ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's ++ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ++ _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ++ _LT_AC_TAGVAR(hardcode_direct, $1)=no ++ _LT_AC_TAGVAR(hardcode_automatic, $1)=yes ++ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported ++ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' ++ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes ++ else ++ _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi ++ ;; ++esac ++AC_MSG_RESULT([$enable_shared]) ++ ++AC_MSG_CHECKING([whether to build static libraries]) ++# Make sure either enable_shared or enable_static is yes. ++test "$enable_shared" = yes || enable_static=yes ++AC_MSG_RESULT([$enable_static]) ++ ++AC_LIBTOOL_CONFIG($1) ++ ++AC_LANG_POP ++CC="$lt_save_CC" ++])# AC_LIBTOOL_LANG_C_CONFIG ++ ++ ++# AC_LIBTOOL_LANG_CXX_CONFIG ++# -------------------------- ++# Ensure that the configuration vars for the C compiler are ++# suitably defined. Those variables are subsequently used by ++# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. ++AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)]) ++AC_DEFUN([_LT_AC_LANG_CXX_CONFIG], ++[AC_LANG_PUSH(C++) ++AC_REQUIRE([AC_PROG_CXX]) ++AC_REQUIRE([AC_PROG_CXXCPP]) ++ ++_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ++_LT_AC_TAGVAR(allow_undefined_flag, $1)= ++_LT_AC_TAGVAR(always_export_symbols, $1)=no ++_LT_AC_TAGVAR(archive_expsym_cmds, $1)= ++_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= ++_LT_AC_TAGVAR(hardcode_direct, $1)=no ++_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= ++_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= ++_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= ++_LT_AC_TAGVAR(hardcode_minus_L, $1)=no ++_LT_AC_TAGVAR(hardcode_automatic, $1)=no ++_LT_AC_TAGVAR(module_cmds, $1)= ++_LT_AC_TAGVAR(module_expsym_cmds, $1)= ++_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown ++_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds ++_LT_AC_TAGVAR(no_undefined_flag, $1)= ++_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= ++_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no ++ ++# Dependencies to place before and after the object being linked: ++_LT_AC_TAGVAR(predep_objects, $1)= ++_LT_AC_TAGVAR(postdep_objects, $1)= ++_LT_AC_TAGVAR(predeps, $1)= ++_LT_AC_TAGVAR(postdeps, $1)= ++_LT_AC_TAGVAR(compiler_lib_search_path, $1)= ++ ++# Source file extension for C++ test sources. ++ac_ext=cc ++ ++# Object file extension for compiled C++ test sources. ++objext=o ++_LT_AC_TAGVAR(objext, $1)=$objext ++ ++# Code to be used in simple compile tests ++lt_simple_compile_test_code="int some_variable = 0;\n" ++ ++# Code to be used in simple link tests ++lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' ++ ++# ltmain only uses $CC for tagged configurations so make sure $CC is set. ++_LT_AC_SYS_COMPILER ++ ++# Allow CC to be a program name with arguments. ++lt_save_CC=$CC ++lt_save_LD=$LD ++lt_save_GCC=$GCC ++GCC=$GXX ++lt_save_with_gnu_ld=$with_gnu_ld ++lt_save_path_LD=$lt_cv_path_LD ++if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then ++ lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx + else +- # PORTME fill in a description of your system's linker (not GNU ld) +- case $host_os in +- aix3*) +- allow_undefined_flag=unsupported +- always_export_symbols=yes +- archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' +- # Note: this linker hardcodes the directories in LIBPATH if there +- # are no directories specified by -L. +- hardcode_minus_L=yes +- if test "$GCC" = yes && test -z "$link_static_flag"; then +- # Neither direct hardcoding nor static linking is supported with a +- # broken collect2. +- hardcode_direct=unsupported ++ unset lt_cv_prog_gnu_ld ++fi ++if test -n "${lt_cv_path_LDCXX+set}"; then ++ lt_cv_path_LD=$lt_cv_path_LDCXX ++else ++ unset lt_cv_path_LD ++fi ++test -z "${LDCXX+set}" || LD=$LDCXX ++CC=${CXX-"c++"} ++compiler=$CC ++_LT_AC_TAGVAR(compiler, $1)=$CC ++cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` ++ ++# We don't want -fno-exception wen compiling C++ code, so set the ++# no_builtin_flag separately ++if test "$GXX" = yes; then ++ _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ++else ++ _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= ++fi ++ ++if test "$GXX" = yes; then ++ # Set up default GNU C++ configuration ++ ++ AC_PROG_LD ++ ++ # Check if GNU C++ uses GNU ld as the underlying linker, since the ++ # archiving commands below assume that GNU ld is being used. ++ if test "$with_gnu_ld" = yes; then ++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' ++ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ++ ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' ++ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' ++ ++ # If archive_cmds runs LD, not CC, wlarc should be empty ++ # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to ++ # investigate it a little bit more. (MM) ++ wlarc='${wl}' ++ ++ # ancient GNU ld didn't support --whole-archive et. al. ++ if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ ++ grep 'no-whole-archive' > /dev/null; then ++ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' ++ else ++ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi +- ;; ++ else ++ with_gnu_ld=no ++ wlarc= ++ ++ # A generic and very simple default shared library creation ++ # command for GNU C++ for the case where it uses the native ++ # linker, instead of GNU ld. If possible, this setting should ++ # overridden to take advantage of the native linker features on ++ # the platform it is being used on. ++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' ++ fi ++ ++ # Commands to make compiler produce verbose output that lists ++ # what "hidden" libraries, object files and flags are used when ++ # linking a shared library. ++ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' ++ ++else ++ GXX=no ++ with_gnu_ld=no ++ wlarc= ++fi + ++# PORTME: fill in a description of your system's C++ link characteristics ++AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) ++_LT_AC_TAGVAR(ld_shlibs, $1)=yes ++case $host_os in ++ aix3*) ++ # FIXME: insert proper C++ library support ++ _LT_AC_TAGVAR(ld_shlibs, $1)=no ++ ;; + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't +@@ -1586,7 +3728,7 @@ + *-brtl*) + aix_use_runtimelinking=yes + break +- ;; ++ ;; + esac + done + esac +@@ -1601,34 +3743,39 @@ + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + +- hardcode_direct=yes +- archive_cmds='' +- hardcode_libdir_separator=':' +- if test "$GCC" = yes; then +- case $host_os in aix4.[[012]]|aix4.[[012]].*) ++ _LT_AC_TAGVAR(archive_cmds, $1)='' ++ _LT_AC_TAGVAR(hardcode_direct, $1)=yes ++ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' ++ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes ++ ++ if test "$GXX" = yes; then ++ case $host_os in aix4.[012]|aix4.[012].*) ++ # We only want to do this on AIX 4.2 and lower, the check ++ # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ +- strings "$collect2name" | grep resolve_lib_name >/dev/null ++ strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 +- hardcode_direct=yes ++ _LT_AC_TAGVAR(hardcode_direct, $1)=yes + else + # We have old collect2 +- hardcode_direct=unsupported ++ _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking +- hardcode_minus_L=yes +- hardcode_libdir_flag_spec='-L$libdir' +- hardcode_libdir_separator= ++ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' ++ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac +- + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then +- shared_flag='${wl}-G' ++ # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release ++ # chokes on -Wl,-G. The following line is correct: ++ shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' +@@ -1638,833 +3785,867 @@ + fi + fi + +- # It seems that -bexpall can do strange things, so it is better to +- # generate a list of symbols to export. +- always_export_symbols=yes ++ # It seems that -bexpall does not export symbols beginning with ++ # underscore (_), so it is better to generate a list of symbols to export. ++ _LT_AC_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. +- allow_undefined_flag='-berok' +- hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' +- archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" +- else ++ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' ++ # Determine the default libpath from the value encoded in an empty executable. ++ _LT_AC_SYS_LIBPATH_AIX ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" ++ ++ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" ++ else + if test "$host_cpu" = ia64; then +- hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' +- allow_undefined_flag="-z nodefs" +- archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' ++ _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" ++ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else +- hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' ++ # Determine the default libpath from the value encoded in an empty executable. ++ _LT_AC_SYS_LIBPATH_AIX ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. +- allow_undefined_flag='${wl}-berok' +- # This is a bit strange, but is similar to how AIX traditionally builds +- # it's shared libraries. +- archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $output_objdir/$libname$release.a $output_objdir/$soname' ++ _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' ++ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' ++ # -bexpall does not export symbols beginning with underscore (_) ++ _LT_AC_TAGVAR(always_export_symbols, $1)=yes ++ # Exported symbols can be pulled into shared objects from archives ++ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' ++ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes ++ # This is similar to how AIX traditionally builds it's shared libraries. ++ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; +- +- amigaos*) +- archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' +- hardcode_libdir_flag_spec='-L$libdir' +- hardcode_minus_L=yes +- # see comment about different semantics on the GNU ld section +- ld_shlibs=no ++ chorus*) ++ case $cc_basename in ++ *) ++ # FIXME: insert proper C++ library support ++ _LT_AC_TAGVAR(ld_shlibs, $1)=no ++ ;; ++ esac + ;; + + cygwin* | mingw* | pw32*) +- # When not using gcc, we currently assume that we are using +- # Microsoft Visual C++. +- # hardcode_libdir_flag_spec is actually meaningless, as there is +- # no search path for DLLs. +- hardcode_libdir_flag_spec=' ' +- allow_undefined_flag=unsupported +- # Tell ltmain to make .lib files, not .a files. +- libext=lib +- # FIXME: Setting linknames here is a bad hack. +- archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' +- # The linker will automatically build a .lib file if we build a DLL. +- old_archive_from_new_cmds='true' +- # FIXME: Should let the user specify the lib program. +- old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' +- fix_srcfile_path='`cygpath -w "$srcfile"`' +- ;; ++ # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, ++ # as there is no search path for DLLs. ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' ++ _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported ++ _LT_AC_TAGVAR(always_export_symbols, $1)=no ++ _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ++ ++ if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then ++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' ++ # If the export-symbols file already is a .def file (1st line ++ # is EXPORTS), use it as is; otherwise, prepend... ++ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then ++ cp $export_symbols $output_objdir/$soname.def; ++ else ++ echo EXPORTS > $output_objdir/$soname.def; ++ cat $export_symbols >> $output_objdir/$soname.def; ++ fi~ ++ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' ++ else ++ _LT_AC_TAGVAR(ld_shlibs, $1)=no ++ fi ++ ;; + + darwin* | rhapsody*) ++ if test "$GXX" = yes; then ++ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + case "$host_os" in + rhapsody* | darwin1.[[012]]) +- allow_undefined_flag='-undefined suppress' ++ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' + ;; + *) # Darwin 1.3 on +- allow_undefined_flag='-flat_namespace -undefined suppress' +- ;; +- esac +- # FIXME: Relying on posixy $() will cause problems for +- # cross-compilation, but unfortunately the echo tests do not +- # yet detect zsh echo's removal of \ escapes. Also zsh mangles +- # `"' quotes if we put them in here... so don't! +- archive_cmds='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib ${lib}-master.o $deplibs$linker_flags $(test .$module != .yes && echo -install_name $rpath/$soname $verstring)' +- # We need to add '_' to the symbols in $export_symbols first +- #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols' +- hardcode_direct=yes +- hardcode_shlibpath_var=no +- whole_archive_flag_spec='-all_load $convenience' +- ;; +- +- freebsd1*) +- ld_shlibs=no +- ;; +- +- # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor +- # support. Future versions do this automatically, but an explicit c++rt0.o +- # does not break anything, and helps significantly (at the cost of a little +- # extra space). +- freebsd2.2*) +- archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' +- hardcode_libdir_flag_spec='-R$libdir' +- hardcode_direct=yes +- hardcode_shlibpath_var=no +- ;; +- +- # Unfortunately, older versions of FreeBSD 2 do not have this feature. +- freebsd2*) +- archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' +- hardcode_direct=yes +- hardcode_minus_L=yes +- hardcode_shlibpath_var=no +- ;; +- +- # FreeBSD 3 and greater uses gcc -shared to do shared libraries. +- freebsd*) +- archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' +- hardcode_libdir_flag_spec='-R$libdir' +- hardcode_direct=yes +- hardcode_shlibpath_var=no +- ;; +- +- hpux9* | hpux10* | hpux11*) +- case $host_os in +- hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;; +- *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;; +- esac +- hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' +- hardcode_libdir_separator=: +- hardcode_direct=yes +- hardcode_minus_L=yes # Not in the search PATH, but as the default +- # location of the library. +- export_dynamic_flag_spec='${wl}-E' +- ;; +- +- irix5* | irix6* | nonstopux*) +- if test "$GCC" = yes; then +- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' +- hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' +- else +- archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' +- hardcode_libdir_flag_spec='-rpath $libdir' +- fi +- hardcode_libdir_separator=: +- link_all_deplibs=yes +- ;; +- +- netbsd*) +- if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then +- archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out +- else +- archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF +- fi +- hardcode_libdir_flag_spec='-R$libdir' +- hardcode_direct=yes +- hardcode_shlibpath_var=no +- ;; +- +- newsos6) +- archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' +- hardcode_direct=yes +- hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' +- hardcode_libdir_separator=: +- hardcode_shlibpath_var=no +- ;; +- +- openbsd*) +- hardcode_direct=yes +- hardcode_shlibpath_var=no +- if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then +- archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' +- hardcode_libdir_flag_spec='${wl}-rpath,$libdir' +- export_dynamic_flag_spec='${wl}-E' +- else +- case "$host_os" in +- openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) +- archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' +- hardcode_libdir_flag_spec='-R$libdir' +- ;; +- *) +- archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' +- hardcode_libdir_flag_spec='${wl}-rpath,$libdir' +- ;; +- esac ++ if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then ++ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' ++ else ++ case ${MACOSX_DEPLOYMENT_TARGET} in ++ 10.[[012]]) ++ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' ++ ;; ++ 10.*) ++ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup' ++ ;; ++ esac ++ fi ++ ;; ++ esac ++ lt_int_apple_cc_single_mod=no ++ output_verbose_link_cmd='echo' ++ if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then ++ lt_int_apple_cc_single_mod=yes + fi +- ;; +- +- os2*) +- hardcode_libdir_flag_spec='-L$libdir' +- hardcode_minus_L=yes +- allow_undefined_flag=unsupported +- archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' +- old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' +- ;; +- +- osf3*) +- if test "$GCC" = yes; then +- allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' +- archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ++ if test "X$lt_int_apple_cc_single_mod" = Xyes ; then ++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else +- allow_undefined_flag=' -expect_unresolved \*' +- archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' ++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi +- hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' +- hardcode_libdir_separator=: +- ;; ++ _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + +- osf4* | osf5*) # as osf3* with the addition of -msym flag +- if test "$GCC" = yes; then +- allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' +- archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' +- hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' ++ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's ++ if test "X$lt_int_apple_cc_single_mod" = Xyes ; then ++ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else +- allow_undefined_flag=' -expect_unresolved \*' +- archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' +- archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ +- $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' +- +- #Both c and cxx compiler support -rpath directly +- hardcode_libdir_flag_spec='-rpath $libdir' ++ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi +- hardcode_libdir_separator=: +- ;; +- +- sco3.2v5*) +- archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' +- hardcode_shlibpath_var=no +- runpath_var=LD_RUN_PATH +- hardcode_runpath_var=yes +- export_dynamic_flag_spec='${wl}-Bexport' ++ _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ++ _LT_AC_TAGVAR(hardcode_direct, $1)=no ++ _LT_AC_TAGVAR(hardcode_automatic, $1)=yes ++ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported ++ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' ++ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes ++ else ++ _LT_AC_TAGVAR(ld_shlibs, $1)=no ++ fi + ;; + +- solaris*) +- # gcc --version < 3.0 without binutils cannot create self contained +- # shared libraries reliably, requiring libgcc.a to resolve some of +- # the object symbols generated in some cases. Libraries that use +- # assert need libgcc.a to resolve __eprintf, for example. Linking +- # a copy of libgcc.a into every shared library to guarantee resolving +- # such symbols causes other problems: According to Tim Van Holder +- # <tim.van.holder@pandora.be>, C++ libraries end up with a separate +- # (to the application) exception stack for one thing. +- no_undefined_flag=' -z defs' +- if test "$GCC" = yes; then +- case `$CC --version 2>/dev/null` in +- [[12]].*) +- cat <<EOF 1>&2 +- +-*** Warning: Releases of GCC earlier than version 3.0 cannot reliably +-*** create self contained shared libraries on Solaris systems, without +-*** introducing a dependency on libgcc.a. Therefore, libtool is disabling +-*** -no-undefined support, which will at least allow you to build shared +-*** libraries. However, you may find that when you link such libraries +-*** into an application without using GCC, you have to manually add +-*** \`gcc --print-libgcc-file-name\` to the link command. We urge you to +-*** upgrade to a newer version of GCC. Another option is to rebuild your +-*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer. +- +-EOF +- no_undefined_flag= ++ dgux*) ++ case $cc_basename in ++ ec++) ++ # FIXME: insert proper C++ library support ++ _LT_AC_TAGVAR(ld_shlibs, $1)=no ++ ;; ++ ghcx) ++ # Green Hills C++ Compiler ++ # FIXME: insert proper C++ library support ++ _LT_AC_TAGVAR(ld_shlibs, $1)=no ++ ;; ++ *) ++ # FIXME: insert proper C++ library support ++ _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; +- esac +- fi +- # $CC -shared without GNU ld will not create a library from C++ +- # object files and a static libstdc++, better avoid it by now +- archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' +- archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ +- $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' +- hardcode_libdir_flag_spec='-R$libdir' +- hardcode_shlibpath_var=no +- case $host_os in +- solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; +- *) # Supported since Solaris 2.6 (maybe 2.5.1?) +- whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + esac +- link_all_deplibs=yes + ;; +- +- sunos4*) +- if test "x$host_vendor" = xsequent; then +- # Use $CC to link under sequent, because it throws in some extra .o +- # files that make .init and .fini sections work. +- archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' +- else +- archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' +- fi +- hardcode_libdir_flag_spec='-L$libdir' +- hardcode_direct=yes +- hardcode_minus_L=yes +- hardcode_shlibpath_var=no ++ freebsd[12]*) ++ # C++ shared libraries reported to be fairly broken before switch to ELF ++ _LT_AC_TAGVAR(ld_shlibs, $1)=no ++ ;; ++ freebsd-elf*) ++ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ++ ;; ++ freebsd* | kfreebsd*-gnu) ++ # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF ++ # conventions ++ _LT_AC_TAGVAR(ld_shlibs, $1)=yes ++ ;; ++ gnu*) ++ ;; ++ hpux9*) ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' ++ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: ++ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ++ _LT_AC_TAGVAR(hardcode_direct, $1)=yes ++ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, ++ # but as the default ++ # location of the library. ++ ++ case $cc_basename in ++ CC) ++ # FIXME: insert proper C++ library support ++ _LT_AC_TAGVAR(ld_shlibs, $1)=no ++ ;; ++ aCC) ++ _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ++ # Commands to make compiler produce verbose output that lists ++ # what "hidden" libraries, object files and flags are used when ++ # linking a shared library. ++ # ++ # There doesn't appear to be a way to prevent this compiler from ++ # explicitly linking system object files so we need to strip them ++ # from the output so that they don't get included in the library ++ # dependencies. ++ output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[-]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ++ ;; ++ *) ++ if test "$GXX" = yes; then ++ _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ++ else ++ # FIXME: insert proper C++ library support ++ _LT_AC_TAGVAR(ld_shlibs, $1)=no ++ fi ++ ;; ++ esac + ;; +- +- sysv4) +- case $host_vendor in +- sni) +- archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' +- hardcode_direct=yes # is this really true??? ++ hpux10*|hpux11*) ++ if test $with_gnu_ld = no; then ++ case "$host_cpu" in ++ hppa*64*) ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' ++ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; +- siemens) +- ## LD is ld it makes a PLAMLIB +- ## CC just makes a GrossModule. +- archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' +- reload_cmds='$CC -r -o $output$reload_objs' +- hardcode_direct=no ++ ia64*) ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + ;; +- motorola) +- archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' +- hardcode_direct=no #Motorola manual says yes, but my tests say they lie ++ *) ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' ++ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: ++ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; ++ esac ++ fi ++ case "$host_cpu" in ++ hppa*64*) ++ _LT_AC_TAGVAR(hardcode_direct, $1)=no ++ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ++ ;; ++ ia64*) ++ _LT_AC_TAGVAR(hardcode_direct, $1)=no ++ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ++ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, ++ # but as the default ++ # location of the library. ++ ;; ++ *) ++ _LT_AC_TAGVAR(hardcode_direct, $1)=yes ++ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, ++ # but as the default ++ # location of the library. ++ ;; + esac +- runpath_var='LD_RUN_PATH' +- hardcode_shlibpath_var=no +- ;; + +- sysv4.3*) +- archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' +- hardcode_shlibpath_var=no +- export_dynamic_flag_spec='-Bexport' +- ;; +- +- sysv5*) +- no_undefined_flag=' -z text' +- # $CC -shared without GNU ld will not create a library from C++ +- # object files and a static libstdc++, better avoid it by now +- archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' +- archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ +- $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' +- hardcode_libdir_flag_spec= +- hardcode_shlibpath_var=no +- runpath_var='LD_RUN_PATH' +- ;; +- +- uts4*) +- archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' +- hardcode_libdir_flag_spec='-L$libdir' +- hardcode_shlibpath_var=no ++ case $cc_basename in ++ CC) ++ # FIXME: insert proper C++ library support ++ _LT_AC_TAGVAR(ld_shlibs, $1)=no ++ ;; ++ aCC) ++ case "$host_cpu" in ++ hppa*64*|ia64*) ++ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' ++ ;; ++ *) ++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ++ ;; ++ esac ++ # Commands to make compiler produce verbose output that lists ++ # what "hidden" libraries, object files and flags are used when ++ # linking a shared library. ++ # ++ # There doesn't appear to be a way to prevent this compiler from ++ # explicitly linking system object files so we need to strip them ++ # from the output so that they don't get included in the library ++ # dependencies. ++ output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ++ ;; ++ *) ++ if test "$GXX" = yes; then ++ if test $with_gnu_ld = no; then ++ case "$host_cpu" in ++ ia64*|hppa*64*) ++ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' ++ ;; ++ *) ++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ++ ;; ++ esac ++ fi ++ else ++ # FIXME: insert proper C++ library support ++ _LT_AC_TAGVAR(ld_shlibs, $1)=no ++ fi ++ ;; ++ esac + ;; +- +- dgux*) +- archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' +- hardcode_libdir_flag_spec='-L$libdir' +- hardcode_shlibpath_var=no ++ irix5* | irix6*) ++ case $cc_basename in ++ CC) ++ # SGI C++ ++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' ++ ++ # Archives containing C++ object files must be created using ++ # "CC -ar", where "CC" is the IRIX C++ compiler. This is ++ # necessary to make sure instantiated templates are included ++ # in the archive. ++ _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ++ ;; ++ *) ++ if test "$GXX" = yes; then ++ if test "$with_gnu_ld" = no; then ++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' ++ else ++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' ++ fi ++ fi ++ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes ++ ;; ++ esac ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' ++ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; +- +- sysv4*MP*) +- if test -d /usr/nec; then +- archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' +- hardcode_shlibpath_var=no +- runpath_var=LD_RUN_PATH +- hardcode_runpath_var=yes +- ld_shlibs=yes +- fi ++ linux*) ++ case $cc_basename in ++ KCC) ++ # Kuck and Associates, Inc. (KAI) C++ Compiler ++ ++ # KCC will only create a shared library if the output file ++ # ends with ".so" (or ".sl" for HP-UX), so rename the library ++ # to its proper name (with version) after linking. ++ _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' ++ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' ++ # Commands to make compiler produce verbose output that lists ++ # what "hidden" libraries, object files and flags are used when ++ # linking a shared library. ++ # ++ # There doesn't appear to be a way to prevent this compiler from ++ # explicitly linking system object files so we need to strip them ++ # from the output so that they don't get included in the library ++ # dependencies. ++ output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ++ ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir' ++ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' ++ ++ # Archives containing C++ object files must be created using ++ # "CC -Bstatic", where "CC" is the KAI C++ compiler. ++ _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ++ ;; ++ icpc) ++ # Intel C++ ++ with_gnu_ld=yes ++ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' ++ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' ++ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' ++ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ++ ;; ++ cxx) ++ # Compaq C++ ++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' ++ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' ++ ++ runpath_var=LD_RUN_PATH ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ++ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: ++ ++ # Commands to make compiler produce verbose output that lists ++ # what "hidden" libraries, object files and flags are used when ++ # linking a shared library. ++ # ++ # There doesn't appear to be a way to prevent this compiler from ++ # explicitly linking system object files so we need to strip them ++ # from the output so that they don't get included in the library ++ # dependencies. ++ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ++ ;; ++ esac + ;; +- +- sysv4.2uw2*) +- archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' +- hardcode_direct=yes +- hardcode_minus_L=no +- hardcode_shlibpath_var=no +- hardcode_runpath_var=yes +- runpath_var=LD_RUN_PATH ++ lynxos*) ++ # FIXME: insert proper C++ library support ++ _LT_AC_TAGVAR(ld_shlibs, $1)=no ++ ;; ++ m88k*) ++ # FIXME: insert proper C++ library support ++ _LT_AC_TAGVAR(ld_shlibs, $1)=no ++ ;; ++ mvs*) ++ case $cc_basename in ++ cxx) ++ # FIXME: insert proper C++ library support ++ _LT_AC_TAGVAR(ld_shlibs, $1)=no ++ ;; ++ *) ++ # FIXME: insert proper C++ library support ++ _LT_AC_TAGVAR(ld_shlibs, $1)=no ++ ;; ++ esac + ;; +- +- sysv5uw7* | unixware7*) +- no_undefined_flag='${wl}-z ${wl}text' +- if test "$GCC" = yes; then +- archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' +- else +- archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ++ netbsd* | netbsdelf*-gnu | knetbsd*-gnu) ++ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then ++ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' ++ wlarc= ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' ++ _LT_AC_TAGVAR(hardcode_direct, $1)=yes ++ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + fi +- runpath_var='LD_RUN_PATH' +- hardcode_shlibpath_var=no +- ;; +- +- *) +- ld_shlibs=no ++ # Workaround some broken pre-1.5 toolchains ++ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; +- esac +-fi +-AC_MSG_RESULT([$ld_shlibs]) +-test "$ld_shlibs" = no && can_build_shared=no +- +-# Check hardcoding attributes. +-AC_MSG_CHECKING([how to hardcode library paths into programs]) +-hardcode_action= +-if test -n "$hardcode_libdir_flag_spec" || \ +- test -n "$runpath_var"; then +- +- # We can hardcode non-existant directories. +- if test "$hardcode_direct" != no && +- # If the only mechanism to avoid hardcoding is shlibpath_var, we +- # have to relink, otherwise we might link with an installed library +- # when we should be linking with a yet-to-be-installed one +- ## test "$hardcode_shlibpath_var" != no && +- test "$hardcode_minus_L" != no; then +- # Linking always hardcodes the temporary library directory. +- hardcode_action=relink +- else +- # We can link without hardcoding, and we can hardcode nonexisting dirs. +- hardcode_action=immediate +- fi +-else +- # We cannot hardcode anything, or else we can only hardcode existing +- # directories. +- hardcode_action=unsupported +-fi +-AC_MSG_RESULT([$hardcode_action]) +- +-striplib= +-old_striplib= +-AC_MSG_CHECKING([whether stripping libraries is possible]) +-if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then +- test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" +- test -z "$striplib" && striplib="$STRIP --strip-unneeded" +- AC_MSG_RESULT([yes]) +-else +- AC_MSG_RESULT([no]) +-fi +- +-reload_cmds='$LD$reload_flag -o $output$reload_objs' +-test -z "$deplibs_check_method" && deplibs_check_method=unknown +- +-# PORTME Fill in your ld.so characteristics +-AC_MSG_CHECKING([dynamic linker characteristics]) +-library_names_spec= +-libname_spec='lib$name' +-soname_spec= +-postinstall_cmds= +-postuninstall_cmds= +-finish_cmds= +-finish_eval= +-shlibpath_var= +-shlibpath_overrides_runpath=unknown +-version_type=none +-dynamic_linker="$host_os ld.so" +-sys_lib_dlsearch_path_spec="/lib /usr/lib" +-sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +- +-case $host_os in +-aix3*) +- version_type=linux +- library_names_spec='${libname}${release}.so$versuffix $libname.a' +- shlibpath_var=LIBPATH ++ osf3*) ++ case $cc_basename in ++ KCC) ++ # Kuck and Associates, Inc. (KAI) C++ Compiler ++ ++ # KCC will only create a shared library if the output file ++ # ends with ".so" (or ".sl" for HP-UX), so rename the library ++ # to its proper name (with version) after linking. ++ _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' ++ ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' ++ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: ++ ++ # Archives containing C++ object files must be created using ++ # "CC -Bstatic", where "CC" is the KAI C++ compiler. ++ _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + +- # AIX has no versioning support, so we append a major version to the name. +- soname_spec='${libname}${release}.so$major' +- ;; ++ ;; ++ RCC) ++ # Rational C++ 2.4.1 ++ # FIXME: insert proper C++ library support ++ _LT_AC_TAGVAR(ld_shlibs, $1)=no ++ ;; ++ cxx) ++ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' ++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' ++ ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' ++ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: ++ ++ # Commands to make compiler produce verbose output that lists ++ # what "hidden" libraries, object files and flags are used when ++ # linking a shared library. ++ # ++ # There doesn't appear to be a way to prevent this compiler from ++ # explicitly linking system object files so we need to strip them ++ # from the output so that they don't get included in the library ++ # dependencies. ++ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ++ ;; ++ *) ++ if test "$GXX" = yes && test "$with_gnu_ld" = no; then ++ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' ++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' ++ ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' ++ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: ++ ++ # Commands to make compiler produce verbose output that lists ++ # what "hidden" libraries, object files and flags are used when ++ # linking a shared library. ++ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + +-aix4* | aix5*) +- version_type=linux +- need_lib_prefix=no +- need_version=no +- hardcode_into_libs=yes +- if test "$host_cpu" = ia64; then +- # AIX 5 supports IA64 +- library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so' +- shlibpath_var=LD_LIBRARY_PATH +- else +- # With GCC up to 2.95.x, collect2 would create an import file +- # for dependence libraries. The import file would start with +- # the line `#! .'. This would cause the generated library to +- # depend on `.', always an invalid library. This was fixed in +- # development snapshots of GCC prior to 3.0. +- case $host_os in +- aix4 | aix4.[[01]] | aix4.[[01]].*) +- if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' +- echo ' yes ' +- echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then +- : + else +- can_build_shared=no ++ # FIXME: insert proper C++ library support ++ _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac +- # AIX (on Power*) has no versioning support, so currently we can +- # not hardcode correct soname into executable. Probably we can +- # add versioning support to collect2, so additional links can +- # be useful in future. +- if test "$aix_use_runtimelinking" = yes; then +- # If using run time linking (on AIX 4.2 or later) use lib<name>.so +- # instead of lib<name>.a to let people know that these are not +- # typical AIX shared libraries. +- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' +- else +- # We preserve .a as extension for shared libraries through AIX4.2 +- # and later when we are not doing run time linking. +- library_names_spec='${libname}${release}.a $libname.a' +- soname_spec='${libname}${release}.so$major' +- fi +- shlibpath_var=LIBPATH +- fi +- hardcode_into_libs=yes +- ;; +- +-amigaos*) +- library_names_spec='$libname.ixlibrary $libname.a' +- # Create ${libname}_ixlibrary.a entries in /sys/libs. +- finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' +- ;; +- +-beos*) +- library_names_spec='${libname}.so' +- dynamic_linker="$host_os ld.so" +- shlibpath_var=LIBRARY_PATH +- ;; +- +-bsdi4*) +- version_type=linux +- need_version=no +- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' +- soname_spec='${libname}${release}.so$major' +- finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' +- shlibpath_var=LD_LIBRARY_PATH +- sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" +- sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" +- export_dynamic_flag_spec=-rdynamic +- # the default ld.so.conf also contains /usr/contrib/lib and +- # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow +- # libtool to hard-code these into programs +- ;; +- +-cygwin* | mingw* | pw32*) +- version_type=windows +- need_version=no +- need_lib_prefix=no +- case $GCC,$host_os in +- yes,cygwin*) +- library_names_spec='$libname.dll.a' +- soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll' +- postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~ +- dldir=$destdir/`dirname \$dlpath`~ +- test -d \$dldir || mkdir -p \$dldir~ +- $install_prog .libs/$dlname \$dldir/$dlname' +- postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~ +- dlpath=$dir/\$dldll~ +- $rm \$dlpath' +- ;; +- yes,mingw*) +- library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll' +- sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g" -e "s,=/,/,g"` +- ;; +- yes,pw32*) +- library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' + ;; +- *) +- library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll $libname.lib' +- ;; +- esac +- dynamic_linker='Win32 ld.exe' +- # FIXME: first we should search . and the directory the executable is in +- shlibpath_var=PATH +- ;; +- +-darwin* | rhapsody*) +- dynamic_linker="$host_os dyld" +- version_type=darwin +- need_lib_prefix=no +- need_version=no +- # FIXME: Relying on posixy $() will cause problems for +- # cross-compilation, but unfortunately the echo tests do not +- # yet detect zsh echo's removal of \ escapes. +- library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)' +- soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)' +- shlibpath_overrides_runpath=yes +- shlibpath_var=DYLD_LIBRARY_PATH +- ;; +- +-freebsd1*) +- dynamic_linker=no +- ;; +- +-freebsd*-gnu*) +- version_type=linux +- need_lib_prefix=no +- need_version=no +- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' +- soname_spec='${libname}${release}.so$major' +- shlibpath_var=LD_LIBRARY_PATH +- shlibpath_overrides_runpath=no +- hardcode_into_libs=yes +- dynamic_linker='GNU/FreeBSD ld.so' +- ;; ++ osf4* | osf5*) ++ case $cc_basename in ++ KCC) ++ # Kuck and Associates, Inc. (KAI) C++ Compiler ++ ++ # KCC will only create a shared library if the output file ++ # ends with ".so" (or ".sl" for HP-UX), so rename the library ++ # to its proper name (with version) after linking. ++ _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' ++ ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' ++ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: ++ ++ # Archives containing C++ object files must be created using ++ # the KAI C++ compiler. ++ _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ++ ;; ++ RCC) ++ # Rational C++ 2.4.1 ++ # FIXME: insert proper C++ library support ++ _LT_AC_TAGVAR(ld_shlibs, $1)=no ++ ;; ++ cxx) ++ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' ++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' ++ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ ++ echo "-hidden">> $lib.exp~ ++ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ ++ $rm $lib.exp' ++ ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ++ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: ++ ++ # Commands to make compiler produce verbose output that lists ++ # what "hidden" libraries, object files and flags are used when ++ # linking a shared library. ++ # ++ # There doesn't appear to be a way to prevent this compiler from ++ # explicitly linking system object files so we need to strip them ++ # from the output so that they don't get included in the library ++ # dependencies. ++ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ++ ;; ++ *) ++ if test "$GXX" = yes && test "$with_gnu_ld" = no; then ++ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' ++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' ++ ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' ++ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: ++ ++ # Commands to make compiler produce verbose output that lists ++ # what "hidden" libraries, object files and flags are used when ++ # linking a shared library. ++ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + +-freebsd*) +- objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` +- version_type=freebsd-$objformat +- case $version_type in +- freebsd-elf*) +- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' +- need_version=no +- need_lib_prefix=no +- ;; +- freebsd-*) +- library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' +- need_version=yes +- ;; +- esac +- shlibpath_var=LD_LIBRARY_PATH +- case $host_os in +- freebsd2*) +- shlibpath_overrides_runpath=yes ++ else ++ # FIXME: insert proper C++ library support ++ _LT_AC_TAGVAR(ld_shlibs, $1)=no ++ fi ++ ;; ++ esac + ;; +- *) +- shlibpath_overrides_runpath=no +- hardcode_into_libs=yes ++ psos*) ++ # FIXME: insert proper C++ library support ++ _LT_AC_TAGVAR(ld_shlibs, $1)=no ++ ;; ++ sco*) ++ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ++ case $cc_basename in ++ CC) ++ # FIXME: insert proper C++ library support ++ _LT_AC_TAGVAR(ld_shlibs, $1)=no ++ ;; ++ *) ++ # FIXME: insert proper C++ library support ++ _LT_AC_TAGVAR(ld_shlibs, $1)=no ++ ;; ++ esac + ;; +- esac +- ;; ++ sunos4*) ++ case $cc_basename in ++ CC) ++ # Sun C++ 4.x ++ # FIXME: insert proper C++ library support ++ _LT_AC_TAGVAR(ld_shlibs, $1)=no ++ ;; ++ lcc) ++ # Lucid ++ # FIXME: insert proper C++ library support ++ _LT_AC_TAGVAR(ld_shlibs, $1)=no ++ ;; ++ *) ++ # FIXME: insert proper C++ library support ++ _LT_AC_TAGVAR(ld_shlibs, $1)=no ++ ;; ++ esac ++ ;; ++ solaris*) ++ case $cc_basename in ++ CC) ++ # Sun C++ 4.2, 5.x and Centerline C++ ++ _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' ++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ++ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ ++ $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' ++ ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' ++ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ++ case $host_os in ++ solaris2.[0-5] | solaris2.[0-5].*) ;; ++ *) ++ # The C++ compiler is used as linker so we must use $wl ++ # flag to pass the commands to the underlying system ++ # linker. ++ # Supported since Solaris 2.6 (maybe 2.5.1?) ++ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ++ ;; ++ esac ++ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + +-gnu*) +- version_type=linux +- need_lib_prefix=no +- need_version=no +- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' +- soname_spec='${libname}${release}.so$major' +- shlibpath_var=LD_LIBRARY_PATH +- hardcode_into_libs=yes +- ;; ++ # Commands to make compiler produce verbose output that lists ++ # what "hidden" libraries, object files and flags are used when ++ # linking a shared library. ++ # ++ # There doesn't appear to be a way to prevent this compiler from ++ # explicitly linking system object files so we need to strip them ++ # from the output so that they don't get included in the library ++ # dependencies. ++ output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[[LR]]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ++ ++ # Archives containing C++ object files must be created using ++ # "CC -xar", where "CC" is the Sun C++ compiler. This is ++ # necessary to make sure instantiated templates are included ++ # in the archive. ++ _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ++ ;; ++ gcx) ++ # Green Hills C++ Compiler ++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + +-hpux9* | hpux10* | hpux11*) +- # Give a soname corresponding to the major version so that dld.sl refuses to +- # link against other versions. +- dynamic_linker="$host_os dld.sl" +- version_type=sunos +- need_lib_prefix=no +- need_version=no +- shlibpath_var=SHLIB_PATH +- shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH +- library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' +- soname_spec='${libname}${release}.sl$major' +- # HP-UX runs *really* slowly unless shared libraries are mode 555. +- postinstall_cmds='chmod 555 $lib' +- ;; ++ # The C++ compiler must be used to create the archive. ++ _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ++ ;; ++ *) ++ # GNU C++ compiler with Solaris linker ++ if test "$GXX" = yes && test "$with_gnu_ld" = no; then ++ _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' ++ if $CC --version | grep -v '^2\.7' > /dev/null; then ++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' ++ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ ++ $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' ++ ++ # Commands to make compiler produce verbose output that lists ++ # what "hidden" libraries, object files and flags are used when ++ # linking a shared library. ++ output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" ++ else ++ # g++ 2.7 appears to require `-G' NOT `-shared' on this ++ # platform. ++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' ++ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ ++ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' ++ ++ # Commands to make compiler produce verbose output that lists ++ # what "hidden" libraries, object files and flags are used when ++ # linking a shared library. ++ output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" ++ fi + +-irix5* | irix6* | nonstopux*) +- case $host_os in +- nonstopux*) version_type=nonstopux ;; +- *) version_type=irix ;; +- esac +- need_lib_prefix=no +- need_version=no +- soname_spec='${libname}${release}.so$major' +- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so' +- case $host_os in +- irix5* | nonstopux*) +- libsuff= shlibsuff= ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' ++ fi ++ ;; ++ esac + ;; +- *) +- case $LD in # libtool.m4 will add one of these switches to LD +- *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; +- *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; +- *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; +- *) libsuff= shlibsuff= libmagic=never-match;; ++ sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) ++ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ++ ;; ++ tandem*) ++ case $cc_basename in ++ NCC) ++ # NonStop-UX NCC 3.20 ++ # FIXME: insert proper C++ library support ++ _LT_AC_TAGVAR(ld_shlibs, $1)=no ++ ;; ++ *) ++ # FIXME: insert proper C++ library support ++ _LT_AC_TAGVAR(ld_shlibs, $1)=no ++ ;; + esac + ;; +- esac +- shlibpath_var=LD_LIBRARY${shlibsuff}_PATH +- shlibpath_overrides_runpath=no +- sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" +- sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" +- ;; +- +-# No shared lib support for Linux oldld, aout, or coff. +-linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) +- dynamic_linker=no +- ;; ++ vxworks*) ++ # FIXME: insert proper C++ library support ++ _LT_AC_TAGVAR(ld_shlibs, $1)=no ++ ;; ++ *) ++ # FIXME: insert proper C++ library support ++ _LT_AC_TAGVAR(ld_shlibs, $1)=no ++ ;; ++esac ++AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) ++test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +-# This must be Linux ELF. +-linux-gnu*) +- version_type=linux +- need_lib_prefix=no +- need_version=no +- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' +- soname_spec='${libname}${release}.so$major' +- finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' +- shlibpath_var=LD_LIBRARY_PATH +- shlibpath_overrides_runpath=no +- # This implies no fast_install, which is unacceptable. +- # Some rework will be needed to allow for fast_install +- # before this can be enabled. +- hardcode_into_libs=yes ++_LT_AC_TAGVAR(GCC, $1)="$GXX" ++_LT_AC_TAGVAR(LD, $1)="$LD" + +- # We used to test for /lib/ld.so.1 and disable shared libraries on +- # powerpc, because MkLinux only supported shared libraries with the +- # GNU dynamic linker. Since this was broken with cross compilers, +- # most powerpc-linux boxes support dynamic linking these days and +- # people can always --disable-shared, the test was removed, and we +- # assume the GNU/Linux dynamic linker is in use. +- dynamic_linker='GNU/Linux ld.so' +- ;; ++AC_LIBTOOL_POSTDEP_PREDEP($1) ++AC_LIBTOOL_PROG_COMPILER_PIC($1) ++AC_LIBTOOL_PROG_CC_C_O($1) ++AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) ++AC_LIBTOOL_PROG_LD_SHLIBS($1) ++AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) ++AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) ++AC_LIBTOOL_SYS_LIB_STRIP ++AC_LIBTOOL_DLOPEN_SELF($1) ++ ++AC_LIBTOOL_CONFIG($1) ++ ++AC_LANG_POP ++CC=$lt_save_CC ++LDCXX=$LD ++LD=$lt_save_LD ++GCC=$lt_save_GCC ++with_gnu_ldcxx=$with_gnu_ld ++with_gnu_ld=$lt_save_with_gnu_ld ++lt_cv_path_LDCXX=$lt_cv_path_LD ++lt_cv_path_LD=$lt_save_path_LD ++lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld ++lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld ++])# AC_LIBTOOL_LANG_CXX_CONFIG + +-netbsd*) +- version_type=sunos +- need_lib_prefix=no +- need_version=no +- if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then +- library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' +- finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' +- dynamic_linker='NetBSD (a.out) ld.so' +- else +- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' +- soname_spec='${libname}${release}.so$major' +- dynamic_linker='NetBSD ld.elf_so' +- fi +- shlibpath_var=LD_LIBRARY_PATH +- shlibpath_overrides_runpath=yes +- hardcode_into_libs=yes +- ;; ++# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME]) ++# ------------------------ ++# Figure out "hidden" library dependencies from verbose ++# compiler output when linking a shared library. ++# Parse the compiler output and extract the necessary ++# objects, libraries and library flags. ++AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[ ++dnl we can't use the lt_simple_compile_test_code here, ++dnl because it contains code intended for an executable, ++dnl not a library. It's possible we should let each ++dnl tag define a new lt_????_link_test_code variable, ++dnl but it's only used here... ++ifelse([$1],[],[cat > conftest.$ac_ext <<EOF ++int a; ++void foo (void) { a = 0; } ++EOF ++],[$1],[CXX],[cat > conftest.$ac_ext <<EOF ++class Foo ++{ ++public: ++ Foo (void) { a = 0; } ++private: ++ int a; ++}; ++EOF ++],[$1],[F77],[cat > conftest.$ac_ext <<EOF ++ subroutine foo ++ implicit none ++ integer*4 a ++ a=0 ++ return ++ end ++EOF ++],[$1],[GCJ],[cat > conftest.$ac_ext <<EOF ++public class foo { ++ private int a; ++ public void bar (void) { ++ a = 0; ++ } ++}; ++EOF ++]) ++dnl Parse the compiler output and extract the necessary ++dnl objects, libraries and library flags. ++if AC_TRY_EVAL(ac_compile); then ++ # Parse the compiler output and extract the necessary ++ # objects, libraries and library flags. ++ ++ # Sentinel used to keep track of whether or not we are before ++ # the conftest object file. ++ pre_test_object_deps_done=no ++ ++ # The `*' in the case matches for architectures that use `case' in ++ # $output_verbose_cmd can trigger glob expansion during the loop ++ # eval without this substitution. ++ output_verbose_link_cmd="`$echo \"X$output_verbose_link_cmd\" | $Xsed -e \"$no_glob_subst\"`" ++ ++ for p in `eval $output_verbose_link_cmd`; do ++ case $p in ++ ++ -L* | -R* | -l*) ++ # Some compilers place space between "-{L,R}" and the path. ++ # Remove the space. ++ if test $p = "-L" \ ++ || test $p = "-R"; then ++ prev=$p ++ continue ++ else ++ prev= ++ fi ++ ++ if test "$pre_test_object_deps_done" = no; then ++ case $p in ++ -L* | -R*) ++ # Internal compiler library paths should come after those ++ # provided the user. The postdeps already come after the ++ # user supplied libs so there is no need to process them. ++ if test -z "$_LT_AC_TAGVAR(compiler_lib_search_path, $1)"; then ++ _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" ++ else ++ _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${_LT_AC_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" ++ fi ++ ;; ++ # The "-l" case would never come before the object being ++ # linked, so don't bother handling this case. ++ esac ++ else ++ if test -z "$_LT_AC_TAGVAR(postdeps, $1)"; then ++ _LT_AC_TAGVAR(postdeps, $1)="${prev}${p}" ++ else ++ _LT_AC_TAGVAR(postdeps, $1)="${_LT_AC_TAGVAR(postdeps, $1)} ${prev}${p}" ++ fi ++ fi ++ ;; ++ ++ *.$objext) ++ # This assumes that the test object file only shows up ++ # once in the compiler output. ++ if test "$p" = "conftest.$objext"; then ++ pre_test_object_deps_done=yes ++ continue ++ fi ++ ++ if test "$pre_test_object_deps_done" = no; then ++ if test -z "$_LT_AC_TAGVAR(predep_objects, $1)"; then ++ _LT_AC_TAGVAR(predep_objects, $1)="$p" ++ else ++ _LT_AC_TAGVAR(predep_objects, $1)="$_LT_AC_TAGVAR(predep_objects, $1) $p" ++ fi ++ else ++ if test -z "$_LT_AC_TAGVAR(postdep_objects, $1)"; then ++ _LT_AC_TAGVAR(postdep_objects, $1)="$p" ++ else ++ _LT_AC_TAGVAR(postdep_objects, $1)="$_LT_AC_TAGVAR(postdep_objects, $1) $p" ++ fi ++ fi ++ ;; + +-newsos6) +- version_type=linux +- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' +- shlibpath_var=LD_LIBRARY_PATH +- shlibpath_overrides_runpath=yes +- ;; ++ *) ;; # Ignore the rest. + +-openbsd*) +- version_type=sunos +- need_lib_prefix=no +- need_version=no +- if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then +- case "$host_os" in +- openbsd2.[[89]] | openbsd2.[[89]].*) +- shlibpath_overrides_runpath=no +- ;; +- *) +- shlibpath_overrides_runpath=yes +- ;; + esac +- else +- shlibpath_overrides_runpath=yes +- fi +- library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' +- finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' +- shlibpath_var=LD_LIBRARY_PATH +- ;; +- +-os2*) +- libname_spec='$name' +- need_lib_prefix=no +- library_names_spec='$libname.dll $libname.a' +- dynamic_linker='OS/2 ld.exe' +- shlibpath_var=LIBPATH +- ;; +- +-osf3* | osf4* | osf5*) +- version_type=osf +- need_version=no +- need_lib_prefix=no +- soname_spec='${libname}${release}.so$major' +- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' +- shlibpath_var=LD_LIBRARY_PATH +- sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" +- sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" +- hardcode_into_libs=yes +- ;; ++ done + +-sco3.2v5*) +- version_type=osf +- soname_spec='${libname}${release}.so$major' +- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' +- shlibpath_var=LD_LIBRARY_PATH +- ;; ++ # Clean up. ++ rm -f a.out a.exe ++else ++ echo "libtool.m4: error: problem compiling $1 test program" ++fi + +-solaris*) +- version_type=linux +- need_lib_prefix=no +- need_version=no +- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' +- soname_spec='${libname}${release}.so$major' +- shlibpath_var=LD_LIBRARY_PATH +- shlibpath_overrides_runpath=yes +- hardcode_into_libs=yes +- # ldd complains unless libraries are executable +- postinstall_cmds='chmod +x $lib' +- ;; ++$rm -f confest.$objext + +-sunos4*) +- version_type=sunos +- library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' +- finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' +- shlibpath_var=LD_LIBRARY_PATH +- shlibpath_overrides_runpath=yes +- if test "$with_gnu_ld" = yes; then +- need_lib_prefix=no +- fi +- need_version=yes +- ;; ++case " $_LT_AC_TAGVAR(postdeps, $1) " in ++*" -lc "*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;; ++esac ++])# AC_LIBTOOL_POSTDEP_PREDEP + +-sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) +- version_type=linux +- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' +- soname_spec='${libname}${release}.so$major' +- shlibpath_var=LD_LIBRARY_PATH +- case $host_vendor in +- sni) +- shlibpath_overrides_runpath=no +- need_lib_prefix=no +- export_dynamic_flag_spec='${wl}-Blargedynsym' +- runpath_var=LD_RUN_PATH +- ;; +- siemens) +- need_lib_prefix=no +- ;; +- motorola) +- need_lib_prefix=no +- need_version=no +- shlibpath_overrides_runpath=no +- sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' +- ;; +- esac +- ;; ++# AC_LIBTOOL_LANG_F77_CONFIG ++# ------------------------ ++# Ensure that the configuration vars for the C compiler are ++# suitably defined. Those variables are subsequently used by ++# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. ++AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG], [_LT_AC_LANG_F77_CONFIG(F77)]) ++AC_DEFUN([_LT_AC_LANG_F77_CONFIG], ++[AC_REQUIRE([AC_PROG_F77]) ++AC_LANG_PUSH(Fortran 77) ++ ++_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ++_LT_AC_TAGVAR(allow_undefined_flag, $1)= ++_LT_AC_TAGVAR(always_export_symbols, $1)=no ++_LT_AC_TAGVAR(archive_expsym_cmds, $1)= ++_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= ++_LT_AC_TAGVAR(hardcode_direct, $1)=no ++_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= ++_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= ++_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= ++_LT_AC_TAGVAR(hardcode_minus_L, $1)=no ++_LT_AC_TAGVAR(hardcode_automatic, $1)=no ++_LT_AC_TAGVAR(module_cmds, $1)= ++_LT_AC_TAGVAR(module_expsym_cmds, $1)= ++_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown ++_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds ++_LT_AC_TAGVAR(no_undefined_flag, $1)= ++_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= ++_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no ++ ++# Source file extension for f77 test sources. ++ac_ext=f ++ ++# Object file extension for compiled f77 test sources. ++objext=o ++_LT_AC_TAGVAR(objext, $1)=$objext + +-uts4*) +- version_type=linux +- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' +- soname_spec='${libname}${release}.so$major' +- shlibpath_var=LD_LIBRARY_PATH +- ;; ++# Code to be used in simple compile tests ++lt_simple_compile_test_code=" subroutine t\n return\n end\n" + +-dgux*) +- version_type=linux +- need_lib_prefix=no +- need_version=no +- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' +- soname_spec='${libname}${release}.so$major' +- shlibpath_var=LD_LIBRARY_PATH +- ;; ++# Code to be used in simple link tests ++lt_simple_link_test_code=" program t\n end\n" + +-sysv4*MP*) +- if test -d /usr/nec ;then +- version_type=linux +- library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' +- soname_spec='$libname.so.$major' +- shlibpath_var=LD_LIBRARY_PATH +- fi +- ;; ++# ltmain only uses $CC for tagged configurations so make sure $CC is set. ++_LT_AC_SYS_COMPILER + +-*) +- dynamic_linker=no +- ;; +-esac +-AC_MSG_RESULT([$dynamic_linker]) +-test "$dynamic_linker" = no && can_build_shared=no ++# Allow CC to be a program name with arguments. ++lt_save_CC="$CC" ++CC=${F77-"f77"} ++compiler=$CC ++_LT_AC_TAGVAR(compiler, $1)=$CC ++cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` + +-# Report the final consequences. + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + +@@ -2481,125 +4662,206 @@ + postinstall_cmds='$RANLIB $lib' + fi + ;; ++aix4* | aix5*) ++ test "$enable_shared" = yes && enable_static=no ++ ;; ++esac ++AC_MSG_RESULT([$enable_shared]) ++ ++AC_MSG_CHECKING([whether to build static libraries]) ++# Make sure either enable_shared or enable_static is yes. ++test "$enable_shared" = yes || enable_static=yes ++AC_MSG_RESULT([$enable_static]) ++ ++test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no ++ ++_LT_AC_TAGVAR(GCC, $1)="$G77" ++_LT_AC_TAGVAR(LD, $1)="$LD" ++ ++AC_LIBTOOL_PROG_COMPILER_PIC($1) ++AC_LIBTOOL_PROG_CC_C_O($1) ++AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) ++AC_LIBTOOL_PROG_LD_SHLIBS($1) ++AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) ++AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) ++AC_LIBTOOL_SYS_LIB_STRIP ++ ++ ++AC_LIBTOOL_CONFIG($1) ++ ++AC_LANG_POP ++CC="$lt_save_CC" ++])# AC_LIBTOOL_LANG_F77_CONFIG ++ ++ ++# AC_LIBTOOL_LANG_GCJ_CONFIG ++# -------------------------- ++# Ensure that the configuration vars for the C compiler are ++# suitably defined. Those variables are subsequently used by ++# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. ++AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG], [_LT_AC_LANG_GCJ_CONFIG(GCJ)]) ++AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG], ++[AC_LANG_SAVE ++ ++# Source file extension for Java test sources. ++ac_ext=java ++ ++# Object file extension for compiled Java test sources. ++objext=o ++_LT_AC_TAGVAR(objext, $1)=$objext ++ ++# Code to be used in simple compile tests ++lt_simple_compile_test_code="class foo {}\n" ++ ++# Code to be used in simple link tests ++lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }\n' ++ ++# ltmain only uses $CC for tagged configurations so make sure $CC is set. ++_LT_AC_SYS_COMPILER ++ ++# Allow CC to be a program name with arguments. ++lt_save_CC="$CC" ++CC=${GCJ-"gcj"} ++compiler=$CC ++_LT_AC_TAGVAR(compiler, $1)=$CC ++ ++# GCJ did not exist at the time GCC didn't implicitly link libc in. ++_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ++ ++AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) ++AC_LIBTOOL_PROG_COMPILER_PIC($1) ++AC_LIBTOOL_PROG_CC_C_O($1) ++AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) ++AC_LIBTOOL_PROG_LD_SHLIBS($1) ++AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) ++AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) ++AC_LIBTOOL_SYS_LIB_STRIP ++AC_LIBTOOL_DLOPEN_SELF($1) ++ ++AC_LIBTOOL_CONFIG($1) ++ ++AC_LANG_RESTORE ++CC="$lt_save_CC" ++])# AC_LIBTOOL_LANG_GCJ_CONFIG ++ ++ ++# AC_LIBTOOL_LANG_RC_CONFIG ++# -------------------------- ++# Ensure that the configuration vars for the Windows resource compiler are ++# suitably defined. Those variables are subsequently used by ++# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. ++AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG], [_LT_AC_LANG_RC_CONFIG(RC)]) ++AC_DEFUN([_LT_AC_LANG_RC_CONFIG], ++[AC_LANG_SAVE ++ ++# Source file extension for RC test sources. ++ac_ext=rc ++ ++# Object file extension for compiled RC test sources. ++objext=o ++_LT_AC_TAGVAR(objext, $1)=$objext + +-aix4*) +- if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then +- test "$enable_shared" = yes && enable_static=no +- fi +- ;; +-esac +-AC_MSG_RESULT([$enable_shared]) ++# Code to be used in simple compile tests ++lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n' + +-AC_MSG_CHECKING([whether to build static libraries]) +-# Make sure either enable_shared or enable_static is yes. +-test "$enable_shared" = yes || enable_static=yes +-AC_MSG_RESULT([$enable_static]) ++# Code to be used in simple link tests ++lt_simple_link_test_code="$lt_simple_compile_test_code" + +-if test "$hardcode_action" = relink; then +- # Fast installation is not supported +- enable_fast_install=no +-elif test "$shlibpath_overrides_runpath" = yes || +- test "$enable_shared" = no; then +- # Fast installation is not necessary +- enable_fast_install=needless +-fi ++# ltmain only uses $CC for tagged configurations so make sure $CC is set. ++_LT_AC_SYS_COMPILER + +-variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +-if test "$GCC" = yes; then +- variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +-fi ++# Allow CC to be a program name with arguments. ++lt_save_CC="$CC" ++CC=${RC-"windres"} ++compiler=$CC ++_LT_AC_TAGVAR(compiler, $1)=$CC ++_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + +-AC_LIBTOOL_DLOPEN_SELF ++AC_LIBTOOL_CONFIG($1) ++ ++AC_LANG_RESTORE ++CC="$lt_save_CC" ++])# AC_LIBTOOL_LANG_RC_CONFIG + +-if test "$enable_shared" = yes && test "$GCC" = yes; then +- case $archive_cmds in +- *'~'*) +- # FIXME: we may have to deal with multi-command sequences. +- ;; +- '$CC '*) +- # Test whether the compiler implicitly links with -lc since on some +- # systems, -lgcc has to come before -lc. If gcc already passes -lc +- # to ld, don't add -lc before -lgcc. +- AC_MSG_CHECKING([whether -lc should be explicitly linked in]) +- AC_CACHE_VAL([lt_cv_archive_cmds_need_lc], +- [$rm conftest* +- echo 'static int dummy;' > conftest.$ac_ext +- +- if AC_TRY_EVAL(ac_compile); then +- soname=conftest +- lib=conftest +- libobjs=conftest.$ac_objext +- deplibs= +- wl=$lt_cv_prog_cc_wl +- compiler_flags=-v +- linker_flags=-v +- verstring= +- output_objdir=. +- libname=conftest +- save_allow_undefined_flag=$allow_undefined_flag +- allow_undefined_flag= +- if AC_TRY_EVAL(archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) +- then +- lt_cv_archive_cmds_need_lc=no +- else +- lt_cv_archive_cmds_need_lc=yes +- fi +- allow_undefined_flag=$save_allow_undefined_flag +- else +- cat conftest.err 1>&5 +- fi]) +- AC_MSG_RESULT([$lt_cv_archive_cmds_need_lc]) +- ;; +- esac +-fi +-need_lc=${lt_cv_archive_cmds_need_lc-yes} + +-# The second clause should only fire when bootstrapping the ++# AC_LIBTOOL_CONFIG([TAGNAME]) ++# ---------------------------- ++# If TAGNAME is not passed, then create an initial libtool script ++# with a default configuration from the untagged config vars. Otherwise ++# add code to config.status for appending the configuration named by ++# TAGNAME from the matching tagged config vars. ++AC_DEFUN([AC_LIBTOOL_CONFIG], ++[# The else clause should only fire when bootstrapping the + # libtool distribution, otherwise you forgot to ship ltmain.sh + # with your package, and you will get complaints that there are + # no rules to generate ltmain.sh. + if test -f "$ltmain"; then +- : +-else +- # If there is no Makefile yet, we rely on a make rule to execute +- # `config.status --recheck' to rerun these tests and create the +- # libtool script then. +- test -f Makefile && make "$ltmain" +-fi +- +-if test -f "$ltmain"; then +- trap "$rm \"${ofile}T\"; exit 1" 1 2 15 +- $rm -f "${ofile}T" +- +- echo creating $ofile +- ++ # See if we are running on zsh, and set the options which allow our commands through ++ # without removal of \ escapes. ++ if test -n "${ZSH_VERSION+set}" ; then ++ setopt NO_GLOB_SUBST ++ fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. +- for var in echo old_CC old_CFLAGS SED \ +- AR AR_FLAGS CC LD LN_S NM SHELL \ +- reload_flag reload_cmds wl \ +- pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ +- thread_safe_flag_spec whole_archive_flag_spec libname_spec \ +- library_names_spec soname_spec \ +- RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ +- old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \ +- postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \ +- old_striplib striplib file_magic_cmd export_symbols_cmds \ +- deplibs_check_method allow_undefined_flag no_undefined_flag \ +- finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ +- global_symbol_to_c_name_address \ +- hardcode_libdir_flag_spec hardcode_libdir_separator \ ++ for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ ++ SED SHELL STRIP \ ++ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ ++ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ ++ deplibs_check_method reload_flag reload_cmds need_locks \ ++ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ ++ lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ +- compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do ++ old_postinstall_cmds old_postuninstall_cmds \ ++ _LT_AC_TAGVAR(compiler, $1) \ ++ _LT_AC_TAGVAR(CC, $1) \ ++ _LT_AC_TAGVAR(LD, $1) \ ++ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1) \ ++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1) \ ++ _LT_AC_TAGVAR(lt_prog_compiler_static, $1) \ ++ _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) \ ++ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1) \ ++ _LT_AC_TAGVAR(thread_safe_flag_spec, $1) \ ++ _LT_AC_TAGVAR(whole_archive_flag_spec, $1) \ ++ _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) \ ++ _LT_AC_TAGVAR(old_archive_cmds, $1) \ ++ _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) \ ++ _LT_AC_TAGVAR(predep_objects, $1) \ ++ _LT_AC_TAGVAR(postdep_objects, $1) \ ++ _LT_AC_TAGVAR(predeps, $1) \ ++ _LT_AC_TAGVAR(postdeps, $1) \ ++ _LT_AC_TAGVAR(compiler_lib_search_path, $1) \ ++ _LT_AC_TAGVAR(archive_cmds, $1) \ ++ _LT_AC_TAGVAR(archive_expsym_cmds, $1) \ ++ _LT_AC_TAGVAR(postinstall_cmds, $1) \ ++ _LT_AC_TAGVAR(postuninstall_cmds, $1) \ ++ _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) \ ++ _LT_AC_TAGVAR(allow_undefined_flag, $1) \ ++ _LT_AC_TAGVAR(no_undefined_flag, $1) \ ++ _LT_AC_TAGVAR(export_symbols_cmds, $1) \ ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) \ ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) \ ++ _LT_AC_TAGVAR(hardcode_libdir_separator, $1) \ ++ _LT_AC_TAGVAR(hardcode_automatic, $1) \ ++ _LT_AC_TAGVAR(module_cmds, $1) \ ++ _LT_AC_TAGVAR(module_expsym_cmds, $1) \ ++ _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) \ ++ _LT_AC_TAGVAR(exclude_expsyms, $1) \ ++ _LT_AC_TAGVAR(include_expsyms, $1); do + + case $var in +- reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ +- old_postinstall_cmds | old_postuninstall_cmds | \ +- export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ +- extract_expsyms_cmds | old_archive_from_expsyms_cmds | \ ++ _LT_AC_TAGVAR(old_archive_cmds, $1) | \ ++ _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) | \ ++ _LT_AC_TAGVAR(archive_cmds, $1) | \ ++ _LT_AC_TAGVAR(archive_expsym_cmds, $1) | \ ++ _LT_AC_TAGVAR(module_cmds, $1) | \ ++ _LT_AC_TAGVAR(module_expsym_cmds, $1) | \ ++ _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) | \ ++ _LT_AC_TAGVAR(export_symbols_cmds, $1) | \ ++ extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ +- finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) ++ old_postinstall_cmds | old_postuninstall_cmds | \ ++ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; +@@ -2609,14 +4871,31 @@ + esac + done + +- cat <<__EOF__ > "${ofile}T" +-#! $SHELL ++ case $lt_echo in ++ *'\[$]0 --fallback-echo"') ++ lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\[$]0 --fallback-echo"[$]/[$]0 --fallback-echo"/'` ++ ;; ++ esac + +-# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. ++ifelse([$1], [], ++ [cfgfile="${ofile}T" ++ trap "$rm \"$cfgfile\"; exit 1" 1 2 15 ++ $rm -f "$cfgfile" ++ AC_MSG_NOTICE([creating $ofile])], ++ [cfgfile="$ofile"]) ++ ++ cat <<__EOF__ >> "$cfgfile" ++ifelse([$1], [], ++[#! $SHELL ++ ++# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. + # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) + # NOTE: Changes made to this file will be lost: look at ltmain.sh. + # +-# Copyright (C) 1996-2000 Free Software Foundation, Inc. ++# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 ++# Free Software Foundation, Inc. ++# ++# This file is part of GNU Libtool: + # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 + # + # This program is free software; you can redistribute it and/or modify +@@ -2638,17 +4917,21 @@ + # configuration script generated by Autoconf, you may include it under + # the same distribution terms that you use for the rest of that program. + +-# A sed that does not truncate output. ++# A sed program that does not truncate output. + SED=$lt_SED + + # Sed that helps us avoid accidentally triggering echo(1) options like -n. +-Xsed="${SED} -e s/^X//" ++Xsed="$SED -e s/^X//" + + # The HP-UX ksh and POSIX shell print the target directory to stdout + # if CDPATH is set. + if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +-# ### BEGIN LIBTOOL CONFIG ++# The names of the tagged configurations supported by this script. ++available_tags= ++ ++# ### BEGIN LIBTOOL CONFIG], ++[# ### BEGIN LIBTOOL TAG CONFIG: $tagname]) + + # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +@@ -2662,7 +4945,10 @@ + build_old_libs=$enable_static + + # Whether or not to add -lc for building shared libraries. +-build_libtool_need_lc=$need_lc ++build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1) ++ ++# Whether or not to disallow shared libs when runtime libs are static ++allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) + + # Whether or not to optimize for fast installation. + fast_install=$enable_fast_install +@@ -2678,14 +4964,20 @@ + AR=$lt_AR + AR_FLAGS=$lt_AR_FLAGS + +-# The default C compiler. +-CC=$lt_CC ++# A C compiler. ++LTCC=$lt_LTCC ++ ++# A language-specific compiler. ++CC=$lt_[]_LT_AC_TAGVAR(compiler, $1) + + # Is the compiler the GNU C compiler? +-with_gcc=$GCC ++with_gcc=$_LT_AC_TAGVAR(GCC, $1) ++ ++# An ERE matcher. ++EGREP=$lt_EGREP + + # The linker used to build libraries. +-LD=$lt_LD ++LD=$lt_[]_LT_AC_TAGVAR(LD, $1) + + # Whether we need hard or soft links. + LN_S=$lt_LN_S +@@ -2694,7 +4986,7 @@ + NM=$lt_NM + + # A symbol stripping program +-STRIP=$STRIP ++STRIP=$lt_STRIP + + # Used to examine libraries when file_magic_cmd begins "file" + MAGIC_CMD=$MAGIC_CMD +@@ -2716,7 +5008,7 @@ + reload_cmds=$lt_reload_cmds + + # How to pass a linker flag through the compiler. +-wl=$lt_wl ++wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) + + # Object file suffix (normally "o"). + objext="$ac_objext" +@@ -2724,18 +5016,21 @@ + # Old archive suffix (normally "a"). + libext="$libext" + ++# Shared library suffix (normally ".so"). ++shrext_cmds='$shrext_cmds' ++ + # Executable file suffix (normally ""). + exeext="$exeext" + + # Additional compiler flags for building library objects. +-pic_flag=$lt_pic_flag ++pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) + pic_mode=$pic_mode + +-# Does compiler simultaneously support -c and -o options? +-compiler_c_o=$lt_compiler_c_o ++# What is the maximum length of a command? ++max_cmd_len=$lt_cv_sys_max_cmd_len + +-# Can we write directly to a .lo ? +-compiler_o_lo=$lt_compiler_o_lo ++# Does compiler simultaneously support -c and -o options? ++compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) + + # Must we lock files when doing compilation ? + need_locks=$lt_need_locks +@@ -2756,946 +5051,1770 @@ + dlopen_self_static=$enable_dlopen_self_static + + # Compiler flag to prevent dynamic linking. +-link_static_flag=$lt_link_static_flag ++link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1) + + # Compiler flag to turn off builtin functions. +-no_builtin_flag=$lt_no_builtin_flag ++no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) + + # Compiler flag to allow reflexive dlopens. +-export_dynamic_flag_spec=$lt_export_dynamic_flag_spec ++export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1) + + # Compiler flag to generate shared objects directly from archives. +-whole_archive_flag_spec=$lt_whole_archive_flag_spec ++whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1) + + # Compiler flag to generate thread-safe objects. +-thread_safe_flag_spec=$lt_thread_safe_flag_spec ++thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1) ++ ++# Library versioning type. ++version_type=$version_type ++ ++# Format of library name prefix. ++libname_spec=$lt_libname_spec ++ ++# List of archive names. First name is the real one, the rest are links. ++# The last name is the one that the linker finds with -lNAME. ++library_names_spec=$lt_library_names_spec ++ ++# The coded name of the library, if different from the real name. ++soname_spec=$lt_soname_spec ++ ++# Commands used to build and install an old-style archive. ++RANLIB=$lt_RANLIB ++old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1) ++old_postinstall_cmds=$lt_old_postinstall_cmds ++old_postuninstall_cmds=$lt_old_postuninstall_cmds ++ ++# Create an old-style archive from a shared archive. ++old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1) ++ ++# Create a temporary old-style archive to link instead of a shared archive. ++old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) ++ ++# Commands used to build and install a shared archive. ++archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1) ++archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1) ++postinstall_cmds=$lt_postinstall_cmds ++postuninstall_cmds=$lt_postuninstall_cmds ++ ++# Commands used to build a loadable module (assumed same as above if empty) ++module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1) ++module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1) ++ ++# Commands to strip libraries. ++old_striplib=$lt_old_striplib ++striplib=$lt_striplib ++ ++# Dependencies to place before the objects being linked to create a ++# shared library. ++predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1) ++ ++# Dependencies to place after the objects being linked to create a ++# shared library. ++postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1) ++ ++# Dependencies to place before the objects being linked to create a ++# shared library. ++predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1) ++ ++# Dependencies to place after the objects being linked to create a ++# shared library. ++postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) ++ ++# The library search path used internally by the compiler when linking ++# a shared library. ++compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) ++ ++# Method to check whether dependent libraries are shared objects. ++deplibs_check_method=$lt_deplibs_check_method ++ ++# Command to use when deplibs_check_method == file_magic. ++file_magic_cmd=$lt_file_magic_cmd ++ ++# Flag that allows shared libraries with undefined symbols to be built. ++allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1) ++ ++# Flag that forces no undefined symbols. ++no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1) ++ ++# Commands used to finish a libtool library installation in a directory. ++finish_cmds=$lt_finish_cmds ++ ++# Same as above, but a single script fragment to be evaled but not shown. ++finish_eval=$lt_finish_eval ++ ++# Take the output of nm and produce a listing of raw symbols and C names. ++global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe ++ ++# Transform the output of nm in a proper C declaration ++global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl ++ ++# Transform the output of nm in a C name address pair ++global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address ++ ++# This is the shared library runtime path variable. ++runpath_var=$runpath_var ++ ++# This is the shared library path variable. ++shlibpath_var=$shlibpath_var ++ ++# Is shlibpath searched before the hard-coded library search path? ++shlibpath_overrides_runpath=$shlibpath_overrides_runpath ++ ++# How to hardcode a shared library path into an executable. ++hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1) ++ ++# Whether we should hardcode library paths into libraries. ++hardcode_into_libs=$hardcode_into_libs ++ ++# Flag to hardcode \$libdir into a binary during linking. ++# This must work even if \$libdir does not exist. ++hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) ++ ++# If ld is used when linking, flag to hardcode \$libdir into ++# a binary during linking. This must work even if \$libdir does ++# not exist. ++hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) ++ ++# Whether we need a single -rpath flag with a separated argument. ++hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1) ++ ++# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the ++# resulting binary. ++hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1) ++ ++# Set to yes if using the -LDIR flag during linking hardcodes DIR into the ++# resulting binary. ++hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1) ++ ++# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into ++# the resulting binary. ++hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1) ++ ++# Set to yes if building a shared library automatically hardcodes DIR into the library ++# and all subsequent libraries and executables linked against it. ++hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1) ++ ++# Variables whose values should be saved in libtool wrapper scripts and ++# restored at relink time. ++variables_saved_for_relink="$variables_saved_for_relink" ++ ++# Whether libtool must link a program against all its dependency libraries. ++link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1) ++ ++# Compile-time system search path for libraries ++sys_lib_search_path_spec=$lt_sys_lib_search_path_spec ++ ++# Run-time system search path for libraries ++sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec ++ ++# Fix the shell variable \$srcfile for the compiler. ++fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)" ++ ++# Set to yes if exported symbols are required. ++always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1) ++ ++# The commands to list exported symbols. ++export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1) ++ ++# The commands to extract the exported symbol list from a shared archive. ++extract_expsyms_cmds=$lt_extract_expsyms_cmds ++ ++# Symbols that should not be listed in the preloaded symbols. ++exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1) ++ ++# Symbols that must always be exported. ++include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1) ++ ++ifelse([$1],[], ++[# ### END LIBTOOL CONFIG], ++[# ### END LIBTOOL TAG CONFIG: $tagname]) ++ ++__EOF__ ++ ++ifelse([$1],[], [ ++ case $host_os in ++ aix3*) ++ cat <<\EOF >> "$cfgfile" ++ ++# AIX sometimes has problems with the GCC collect2 program. For some ++# reason, if we set the COLLECT_NAMES environment variable, the problems ++# vanish in a puff of smoke. ++if test "X${COLLECT_NAMES+set}" != Xset; then ++ COLLECT_NAMES= ++ export COLLECT_NAMES ++fi ++EOF ++ ;; ++ esac ++ ++ # We use sed instead of cat because bash on DJGPP gets confused if ++ # if finds mixed CR/LF and LF-only lines. Since sed operates in ++ # text mode, it properly converts lines to CR/LF. This bash problem ++ # is reportedly fixed, but why not run on old versions too? ++ sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) ++ ++ mv -f "$cfgfile" "$ofile" || \ ++ (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") ++ chmod +x "$ofile" ++]) ++else ++ # If there is no Makefile yet, we rely on a make rule to execute ++ # `config.status --recheck' to rerun these tests and create the ++ # libtool script then. ++ ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` ++ if test -f "$ltmain_in"; then ++ test -f Makefile && make "$ltmain" ++ fi ++fi ++])# AC_LIBTOOL_CONFIG ++ ++ ++# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME]) ++# ------------------------------------------- ++AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], ++[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl ++ ++_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= ++ ++if test "$GCC" = yes; then ++ _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ++ ++ AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], ++ lt_cv_prog_compiler_rtti_exceptions, ++ [-fno-rtti -fno-exceptions], [], ++ [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) ++fi ++])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI ++ ++ ++# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE ++# --------------------------------- ++AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], ++[AC_REQUIRE([AC_CANONICAL_HOST]) ++AC_REQUIRE([AC_PROG_NM]) ++AC_REQUIRE([AC_OBJEXT]) ++# Check for command to grab the raw symbol name followed by C symbol from nm. ++AC_MSG_CHECKING([command to parse $NM output from $compiler object]) ++AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], ++[ ++# These are sane defaults that work on at least a few old systems. ++# [They come from Ultrix. What could be older than Ultrix?!! ;)] ++ ++# Character class describing NM global symbol codes. ++symcode='[[BCDEGRST]]' ++ ++# Regexp to match symbols that can be accessed directly from C. ++sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' ++ ++# Transform the above into a raw symbol and a C symbol. ++symxfrm='\1 \2\3 \3' ++ ++# Transform an extracted symbol line into a proper C declaration ++lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" ++ ++# Transform an extracted symbol line into symbol name and symbol address ++lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" ++ ++# Define system-specific variables. ++case $host_os in ++aix*) ++ symcode='[[BCDT]]' ++ ;; ++cygwin* | mingw* | pw32*) ++ symcode='[[ABCDGISTW]]' ++ ;; ++hpux*) # Its linker distinguishes data from code symbols ++ if test "$host_cpu" = ia64; then ++ symcode='[[ABCDEGRST]]' ++ fi ++ lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" ++ lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" ++ ;; ++irix* | nonstopux*) ++ symcode='[[BCDEGRST]]' ++ ;; ++osf*) ++ symcode='[[BCDEGQRST]]' ++ ;; ++solaris* | sysv5*) ++ symcode='[[BDRT]]' ++ ;; ++sysv4) ++ symcode='[[DFNSTU]]' ++ ;; ++esac ++ ++# Handle CRLF in mingw tool chain ++opt_cr= ++case $build_os in ++mingw*) ++ opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp ++ ;; ++esac + +-# Library versioning type. +-version_type=$version_type ++# If we're using GNU nm, then use its standard symbol codes. ++case `$NM -V 2>&1` in ++*GNU* | *'with BFD'*) ++ symcode='[[ABCDGIRSTW]]' ;; ++esac + +-# Format of library name prefix. +-libname_spec=$lt_libname_spec ++# Try without a prefix undercore, then with it. ++for ac_symprfx in "" "_"; do + +-# List of archive names. First name is the real one, the rest are links. +-# The last name is the one that the linker finds with -lNAME. +-library_names_spec=$lt_library_names_spec ++ # Write the raw and C identifiers. ++ lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" + +-# The coded name of the library, if different from the real name. +-soname_spec=$lt_soname_spec ++ # Check to see that the pipe works correctly. ++ pipe_works=no + +-# Commands used to build and install an old-style archive. +-RANLIB=$lt_RANLIB +-old_archive_cmds=$lt_old_archive_cmds +-old_postinstall_cmds=$lt_old_postinstall_cmds +-old_postuninstall_cmds=$lt_old_postuninstall_cmds ++ rm -f conftest* ++ cat > conftest.$ac_ext <<EOF ++#ifdef __cplusplus ++extern "C" { ++#endif ++char nm_test_var; ++void nm_test_func(){} ++#ifdef __cplusplus ++} ++#endif ++int main(){nm_test_var='a';nm_test_func();return(0);} ++EOF + +-# Create an old-style archive from a shared archive. +-old_archive_from_new_cmds=$lt_old_archive_from_new_cmds ++ if AC_TRY_EVAL(ac_compile); then ++ # Now try to grab the symbols. ++ nlist=conftest.nm ++ if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then ++ # Try sorting and uniquifying the output. ++ if sort "$nlist" | uniq > "$nlist"T; then ++ mv -f "$nlist"T "$nlist" ++ else ++ rm -f "$nlist"T ++ fi + +-# Create a temporary old-style archive to link instead of a shared archive. +-old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds ++ # Make sure that we snagged all the symbols we need. ++ if grep ' nm_test_var$' "$nlist" >/dev/null; then ++ if grep ' nm_test_func$' "$nlist" >/dev/null; then ++ cat <<EOF > conftest.$ac_ext ++#ifdef __cplusplus ++extern "C" { ++#endif + +-# Commands used to build and install a shared archive. +-archive_cmds=$lt_archive_cmds +-archive_expsym_cmds=$lt_archive_expsym_cmds +-postinstall_cmds=$lt_postinstall_cmds +-postuninstall_cmds=$lt_postuninstall_cmds ++EOF ++ # Now generate the symbol file. ++ eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' + +-# Commands to strip libraries. +-old_striplib=$lt_old_striplib +-striplib=$lt_striplib ++ cat <<EOF >> conftest.$ac_ext ++#if defined (__STDC__) && __STDC__ ++# define lt_ptr_t void * ++#else ++# define lt_ptr_t char * ++# define const ++#endif + +-# Method to check whether dependent libraries are shared objects. +-deplibs_check_method=$lt_deplibs_check_method ++/* The mapping between symbol names and symbols. */ ++const struct { ++ const char *name; ++ lt_ptr_t address; ++} ++lt_preloaded_symbols[[]] = ++{ ++EOF ++ $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext ++ cat <<\EOF >> conftest.$ac_ext ++ {0, (lt_ptr_t) 0} ++}; + +-# Command to use when deplibs_check_method == file_magic. +-file_magic_cmd=$lt_file_magic_cmd ++#ifdef __cplusplus ++} ++#endif ++EOF ++ # Now try linking the two files. ++ mv conftest.$ac_objext conftstm.$ac_objext ++ lt_save_LIBS="$LIBS" ++ lt_save_CFLAGS="$CFLAGS" ++ LIBS="conftstm.$ac_objext" ++ CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" ++ if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then ++ pipe_works=yes ++ fi ++ LIBS="$lt_save_LIBS" ++ CFLAGS="$lt_save_CFLAGS" ++ else ++ echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD ++ fi ++ else ++ echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD ++ fi ++ else ++ echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD ++ fi ++ else ++ echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD ++ cat conftest.$ac_ext >&5 ++ fi ++ rm -f conftest* conftst* + +-# Flag that allows shared libraries with undefined symbols to be built. +-allow_undefined_flag=$lt_allow_undefined_flag ++ # Do not use the global_symbol_pipe unless it works. ++ if test "$pipe_works" = yes; then ++ break ++ else ++ lt_cv_sys_global_symbol_pipe= ++ fi ++done ++]) ++if test -z "$lt_cv_sys_global_symbol_pipe"; then ++ lt_cv_sys_global_symbol_to_cdecl= ++fi ++if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then ++ AC_MSG_RESULT(failed) ++else ++ AC_MSG_RESULT(ok) ++fi ++]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE + +-# Flag that forces no undefined symbols. +-no_undefined_flag=$lt_no_undefined_flag + +-# Commands used to finish a libtool library installation in a directory. +-finish_cmds=$lt_finish_cmds ++# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME]) ++# --------------------------------------- ++AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC], ++[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)= ++_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= ++_LT_AC_TAGVAR(lt_prog_compiler_static, $1)= + +-# Same as above, but a single script fragment to be evaled but not shown. +-finish_eval=$lt_finish_eval ++AC_MSG_CHECKING([for $compiler option to produce PIC]) ++ ifelse([$1],[CXX],[ ++ # C++ specific cases for pic, static, wl, etc. ++ if test "$GXX" = yes; then ++ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ++ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + +-# Take the output of nm and produce a listing of raw symbols and C names. +-global_symbol_pipe=$lt_global_symbol_pipe ++ case $host_os in ++ aix*) ++ # All AIX code is PIC. ++ if test "$host_cpu" = ia64; then ++ # AIX 5 now supports IA64 processor ++ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ++ fi ++ ;; ++ amigaos*) ++ # FIXME: we need at least 68020 code to build shared libraries, but ++ # adding the `-m68020' flag to GCC prevents building anything better, ++ # like `-m68040'. ++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ++ ;; ++ beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) ++ # PIC is the default for these OSes. ++ ;; ++ mingw* | os2* | pw32*) ++ # This hack is so that the source file can tell whether it is being ++ # built for inclusion in a dll (and should export symbols for example). ++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' ++ ;; ++ darwin* | rhapsody*) ++ # PIC is the default on this platform ++ # Common symbols not allowed in MH_DYLIB files ++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ++ ;; ++ *djgpp*) ++ # DJGPP does not support shared libraries at all ++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= ++ ;; ++ sysv4*MP*) ++ if test -d /usr/nec; then ++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic ++ fi ++ ;; ++ hpux*) ++ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but ++ # not for PA HP-UX. ++ case "$host_cpu" in ++ hppa*64*|ia64*) ++ ;; ++ *) ++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ++ ;; ++ esac ++ ;; ++ *) ++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ++ ;; ++ esac ++ else ++ case $host_os in ++ aix4* | aix5*) ++ # All AIX code is PIC. ++ if test "$host_cpu" = ia64; then ++ # AIX 5 now supports IA64 processor ++ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ++ else ++ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' ++ fi ++ ;; ++ chorus*) ++ case $cc_basename in ++ cxch68) ++ # Green Hills C++ Compiler ++ # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ++ ;; ++ esac ++ ;; ++ dgux*) ++ case $cc_basename in ++ ec++) ++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ++ ;; ++ ghcx) ++ # Green Hills C++ Compiler ++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ++ ;; ++ *) ++ ;; ++ esac ++ ;; ++ freebsd* | kfreebsd*-gnu) ++ # FreeBSD uses GNU C++ ++ ;; ++ hpux9* | hpux10* | hpux11*) ++ case $cc_basename in ++ CC) ++ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ++ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" ++ if test "$host_cpu" != ia64; then ++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ++ fi ++ ;; ++ aCC) ++ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ++ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" ++ case "$host_cpu" in ++ hppa*64*|ia64*) ++ # +Z the default ++ ;; ++ *) ++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ++ ;; ++ esac ++ ;; ++ *) ++ ;; ++ esac ++ ;; ++ irix5* | irix6* | nonstopux*) ++ case $cc_basename in ++ CC) ++ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ++ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ++ # CC pic flag -KPIC is the default. ++ ;; ++ *) ++ ;; ++ esac ++ ;; ++ linux*) ++ case $cc_basename in ++ KCC) ++ # KAI C++ Compiler ++ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ++ ;; ++ icpc) ++ # Intel C++ ++ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ++ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ++ ;; ++ cxx) ++ # Compaq C++ ++ # Make sure the PIC flag is empty. It appears that all Alpha ++ # Linux and Compaq Tru64 Unix objects are PIC. ++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= ++ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ++ ;; ++ *) ++ ;; ++ esac ++ ;; ++ lynxos*) ++ ;; ++ m88k*) ++ ;; ++ mvs*) ++ case $cc_basename in ++ cxx) ++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ++ ;; ++ *) ++ ;; ++ esac ++ ;; ++ netbsd* | netbsdelf*-gnu | knetbsd*-gnu) ++ ;; ++ osf3* | osf4* | osf5*) ++ case $cc_basename in ++ KCC) ++ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ++ ;; ++ RCC) ++ # Rational C++ 2.4.1 ++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ++ ;; ++ cxx) ++ # Digital/Compaq C++ ++ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ++ # Make sure the PIC flag is empty. It appears that all Alpha ++ # Linux and Compaq Tru64 Unix objects are PIC. ++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= ++ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ++ ;; ++ *) ++ ;; ++ esac ++ ;; ++ psos*) ++ ;; ++ sco*) ++ case $cc_basename in ++ CC) ++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ++ ;; ++ *) ++ ;; ++ esac ++ ;; ++ solaris*) ++ case $cc_basename in ++ CC) ++ # Sun C++ 4.2, 5.x and Centerline C++ ++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ++ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ++ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ++ ;; ++ gcx) ++ # Green Hills C++ Compiler ++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ++ ;; ++ *) ++ ;; ++ esac ++ ;; ++ sunos4*) ++ case $cc_basename in ++ CC) ++ # Sun C++ 4.x ++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ++ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ++ ;; ++ lcc) ++ # Lucid ++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ++ ;; ++ *) ++ ;; ++ esac ++ ;; ++ tandem*) ++ case $cc_basename in ++ NCC) ++ # NonStop-UX NCC 3.20 ++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ++ ;; ++ *) ++ ;; ++ esac ++ ;; ++ unixware*) ++ ;; ++ vxworks*) ++ ;; ++ *) ++ _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ++ ;; ++ esac ++ fi ++], ++[ ++ if test "$GCC" = yes; then ++ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ++ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + +-# Transform the output of nm in a proper C declaration +-global_symbol_to_cdecl=$lt_global_symbol_to_cdecl ++ case $host_os in ++ aix*) ++ # All AIX code is PIC. ++ if test "$host_cpu" = ia64; then ++ # AIX 5 now supports IA64 processor ++ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ++ fi ++ ;; + +-# Transform the output of nm in a C name address pair +-global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address ++ amigaos*) ++ # FIXME: we need at least 68020 code to build shared libraries, but ++ # adding the `-m68020' flag to GCC prevents building anything better, ++ # like `-m68040'. ++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ++ ;; + +-# This is the shared library runtime path variable. +-runpath_var=$runpath_var ++ beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) ++ # PIC is the default for these OSes. ++ ;; + +-# This is the shared library path variable. +-shlibpath_var=$shlibpath_var ++ mingw* | pw32* | os2*) ++ # This hack is so that the source file can tell whether it is being ++ # built for inclusion in a dll (and should export symbols for example). ++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' ++ ;; + +-# Is shlibpath searched before the hard-coded library search path? +-shlibpath_overrides_runpath=$shlibpath_overrides_runpath ++ darwin* | rhapsody*) ++ # PIC is the default on this platform ++ # Common symbols not allowed in MH_DYLIB files ++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ++ ;; + +-# How to hardcode a shared library path into an executable. +-hardcode_action=$hardcode_action ++ msdosdjgpp*) ++ # Just because we use GCC doesn't mean we suddenly get shared libraries ++ # on systems that don't support them. ++ _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ++ enable_shared=no ++ ;; + +-# Whether we should hardcode library paths into libraries. +-hardcode_into_libs=$hardcode_into_libs ++ sysv4*MP*) ++ if test -d /usr/nec; then ++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic ++ fi ++ ;; + +-# Flag to hardcode \$libdir into a binary during linking. +-# This must work even if \$libdir does not exist. +-hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec ++ hpux*) ++ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but ++ # not for PA HP-UX. ++ case "$host_cpu" in ++ hppa*64*|ia64*) ++ # +Z the default ++ ;; ++ *) ++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ++ ;; ++ esac ++ ;; + +-# Whether we need a single -rpath flag with a separated argument. +-hardcode_libdir_separator=$lt_hardcode_libdir_separator ++ *) ++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ++ ;; ++ esac ++ else ++ # PORTME Check for flag to pass linker flags through the system compiler. ++ case $host_os in ++ aix*) ++ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ++ if test "$host_cpu" = ia64; then ++ # AIX 5 now supports IA64 processor ++ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ++ else ++ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' ++ fi ++ ;; + +-# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the +-# resulting binary. +-hardcode_direct=$hardcode_direct ++ mingw* | pw32* | os2*) ++ # This hack is so that the source file can tell whether it is being ++ # built for inclusion in a dll (and should export symbols for example). ++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' ++ ;; + +-# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +-# resulting binary. +-hardcode_minus_L=$hardcode_minus_L ++ hpux9* | hpux10* | hpux11*) ++ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ++ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but ++ # not for PA HP-UX. ++ case "$host_cpu" in ++ hppa*64*|ia64*) ++ # +Z the default ++ ;; ++ *) ++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ++ ;; ++ esac ++ # Is there a better lt_prog_compiler_static that works with the bundled CC? ++ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' ++ ;; + +-# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +-# the resulting binary. +-hardcode_shlibpath_var=$hardcode_shlibpath_var ++ irix5* | irix6* | nonstopux*) ++ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ++ # PIC (with -KPIC) is the default. ++ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ++ ;; + +-# Variables whose values should be saved in libtool wrapper scripts and +-# restored at relink time. +-variables_saved_for_relink="$variables_saved_for_relink" ++ newsos6) ++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ++ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ++ ;; + +-# Whether libtool must link a program against all its dependency libraries. +-link_all_deplibs=$link_all_deplibs ++ linux*) ++ case $CC in ++ icc* | ecc*) ++ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ++ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ++ ;; ++ ccc*) ++ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ++ # All Alpha code is PIC. ++ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ++ ;; ++ esac ++ ;; + +-# Compile-time system search path for libraries +-sys_lib_search_path_spec=$lt_sys_lib_search_path_spec ++ osf3* | osf4* | osf5*) ++ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ++ # All OSF/1 code is PIC. ++ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ++ ;; + +-# Run-time system search path for libraries +-sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec ++ sco3.2v5*) ++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kpic' ++ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-dn' ++ ;; + +-# Fix the shell variable \$srcfile for the compiler. +-fix_srcfile_path="$fix_srcfile_path" ++ solaris*) ++ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ++ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ++ ;; + +-# Set to yes if exported symbols are required. +-always_export_symbols=$always_export_symbols ++ sunos4*) ++ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ++ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ++ ;; + +-# The commands to list exported symbols. +-export_symbols_cmds=$lt_export_symbols_cmds ++ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) ++ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ++ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ++ ;; + +-# The commands to extract the exported symbol list from a shared archive. +-extract_expsyms_cmds=$lt_extract_expsyms_cmds ++ sysv4*MP*) ++ if test -d /usr/nec ;then ++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' ++ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ++ fi ++ ;; + +-# Symbols that should not be listed in the preloaded symbols. +-exclude_expsyms=$lt_exclude_expsyms ++ uts4*) ++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ++ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ++ ;; + +-# Symbols that must always be exported. +-include_expsyms=$lt_include_expsyms ++ *) ++ _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ++ ;; ++ esac ++ fi ++]) ++AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)]) + +-# ### END LIBTOOL CONFIG ++# ++# Check to make sure the PIC flag actually works. ++# ++if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then ++ AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works], ++ _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1), ++ [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [], ++ [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in ++ "" | " "*) ;; ++ *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;; ++ esac], ++ [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= ++ _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) ++fi ++case "$host_os" in ++ # For platforms which do not support PIC, -DPIC is meaningless: ++ *djgpp*) ++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= ++ ;; ++ *) ++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])" ++ ;; ++esac ++]) + +-__EOF__ + ++# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME]) ++# ------------------------------------ ++# See if the linker supports building shared libraries. ++AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS], ++[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) ++ifelse([$1],[CXX],[ ++ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + case $host_os in +- aix3*) +- cat <<\EOF >> "${ofile}T" +- +-# AIX sometimes has problems with the GCC collect2 program. For some +-# reason, if we set the COLLECT_NAMES environment variable, the problems +-# vanish in a puff of smoke. +-if test "X${COLLECT_NAMES+set}" != Xset; then +- COLLECT_NAMES= +- export COLLECT_NAMES +-fi +-EOF ++ aix4* | aix5*) ++ # If we're using GNU nm, then we don't want the "-C" option. ++ # -C means demangle to AIX nm, but means don't demangle with GNU nm ++ if $NM -V 2>&1 | grep 'GNU' > /dev/null; then ++ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' ++ else ++ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' ++ fi + ;; ++ pw32*) ++ _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" ++ ;; ++ cygwin* | mingw*) ++ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' ++ ;; ++ linux*) ++ _LT_AC_TAGVAR(link_all_deplibs, $1)=no ++ ;; ++ *) ++ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ++ ;; + esac ++],[ ++ runpath_var= ++ _LT_AC_TAGVAR(allow_undefined_flag, $1)= ++ _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no ++ _LT_AC_TAGVAR(archive_cmds, $1)= ++ _LT_AC_TAGVAR(archive_expsym_cmds, $1)= ++ _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)= ++ _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)= ++ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= ++ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= ++ _LT_AC_TAGVAR(thread_safe_flag_spec, $1)= ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= ++ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= ++ _LT_AC_TAGVAR(hardcode_direct, $1)=no ++ _LT_AC_TAGVAR(hardcode_minus_L, $1)=no ++ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported ++ _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown ++ _LT_AC_TAGVAR(hardcode_automatic, $1)=no ++ _LT_AC_TAGVAR(module_cmds, $1)= ++ _LT_AC_TAGVAR(module_expsym_cmds, $1)= ++ _LT_AC_TAGVAR(always_export_symbols, $1)=no ++ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ++ # include_expsyms should be a list of space-separated symbols to be *always* ++ # included in the symbol list ++ _LT_AC_TAGVAR(include_expsyms, $1)= ++ # exclude_expsyms can be an extended regexp of symbols to exclude ++ # it will be wrapped by ` (' and `)$', so one must not match beginning or ++ # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', ++ # as well as any symbol that contains `d'. ++ _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_" ++ # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out ++ # platforms (ab)use it in PIC code, but their linkers get confused if ++ # the symbol is explicitly referenced. Since portable code cannot ++ # rely on this symbol name, it's probably fine to never include it in ++ # preloaded symbol tables. ++ extract_expsyms_cmds= + + case $host_os in +- cygwin* | mingw* | pw32* | os2*) +- cat <<'EOF' >> "${ofile}T" +- # This is a source program that is used to create dlls on Windows +- # Don't remove nor modify the starting and closing comments +-# /* ltdll.c starts here */ +-# #define WIN32_LEAN_AND_MEAN +-# #include <windows.h> +-# #undef WIN32_LEAN_AND_MEAN +-# #include <stdio.h> +-# +-# #ifndef __CYGWIN__ +-# # ifdef __CYGWIN32__ +-# # define __CYGWIN__ __CYGWIN32__ +-# # endif +-# #endif +-# +-# #ifdef __cplusplus +-# extern "C" { +-# #endif +-# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); +-# #ifdef __cplusplus +-# } +-# #endif +-# +-# #ifdef __CYGWIN__ +-# #include <cygwin/cygwin_dll.h> +-# DECLARE_CYGWIN_DLL( DllMain ); +-# #endif +-# HINSTANCE __hDllInstance_base; +-# +-# BOOL APIENTRY +-# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) +-# { +-# __hDllInstance_base = hInst; +-# return TRUE; +-# } +-# /* ltdll.c ends here */ +- # This is a source program that is used to create import libraries +- # on Windows for dlls which lack them. Don't remove nor modify the +- # starting and closing comments +-# /* impgen.c starts here */ +-# /* Copyright (C) 1999-2000 Free Software Foundation, Inc. +-# +-# This file is part of GNU libtool. +-# +-# 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 +-# the Free Software Foundation; either version 2 of the License, or +-# (at your option) any later version. +-# +-# This program is distributed in the hope that it will be useful, +-# but WITHOUT ANY WARRANTY; without even the implied warranty of +-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-# GNU General Public License for more details. +-# +-# You should have received a copy of the GNU General Public License +-# along with this program; if not, write to the Free Software +-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +-# */ +-# +-# #include <stdio.h> /* for printf() */ +-# #include <unistd.h> /* for open(), lseek(), read() */ +-# #include <fcntl.h> /* for O_RDONLY, O_BINARY */ +-# #include <string.h> /* for strdup() */ +-# +-# /* O_BINARY isn't required (or even defined sometimes) under Unix */ +-# #ifndef O_BINARY +-# #define O_BINARY 0 +-# #endif +-# +-# static unsigned int +-# pe_get16 (fd, offset) +-# int fd; +-# int offset; +-# { +-# unsigned char b[2]; +-# lseek (fd, offset, SEEK_SET); +-# read (fd, b, 2); +-# return b[0] + (b[1]<<8); +-# } +-# +-# static unsigned int +-# pe_get32 (fd, offset) +-# int fd; +-# int offset; +-# { +-# unsigned char b[4]; +-# lseek (fd, offset, SEEK_SET); +-# read (fd, b, 4); +-# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +-# } +-# +-# static unsigned int +-# pe_as32 (ptr) +-# void *ptr; +-# { +-# unsigned char *b = ptr; +-# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +-# } +-# +-# int +-# main (argc, argv) +-# int argc; +-# char *argv[]; +-# { +-# int dll; +-# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; +-# unsigned long export_rva, export_size, nsections, secptr, expptr; +-# unsigned long name_rvas, nexp; +-# unsigned char *expdata, *erva; +-# char *filename, *dll_name; +-# +-# filename = argv[1]; +-# +-# dll = open(filename, O_RDONLY|O_BINARY); +-# if (dll < 1) +-# return 1; +-# +-# dll_name = filename; +-# +-# for (i=0; filename[i]; i++) +-# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') +-# dll_name = filename + i +1; +-# +-# pe_header_offset = pe_get32 (dll, 0x3c); +-# opthdr_ofs = pe_header_offset + 4 + 20; +-# num_entries = pe_get32 (dll, opthdr_ofs + 92); +-# +-# if (num_entries < 1) /* no exports */ +-# return 1; +-# +-# export_rva = pe_get32 (dll, opthdr_ofs + 96); +-# export_size = pe_get32 (dll, opthdr_ofs + 100); +-# nsections = pe_get16 (dll, pe_header_offset + 4 +2); +-# secptr = (pe_header_offset + 4 + 20 + +-# pe_get16 (dll, pe_header_offset + 4 + 16)); +-# +-# expptr = 0; +-# for (i = 0; i < nsections; i++) +-# { +-# char sname[8]; +-# unsigned long secptr1 = secptr + 40 * i; +-# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); +-# unsigned long vsize = pe_get32 (dll, secptr1 + 16); +-# unsigned long fptr = pe_get32 (dll, secptr1 + 20); +-# lseek(dll, secptr1, SEEK_SET); +-# read(dll, sname, 8); +-# if (vaddr <= export_rva && vaddr+vsize > export_rva) +-# { +-# expptr = fptr + (export_rva - vaddr); +-# if (export_rva + export_size > vaddr + vsize) +-# export_size = vsize - (export_rva - vaddr); +-# break; +-# } +-# } +-# +-# expdata = (unsigned char*)malloc(export_size); +-# lseek (dll, expptr, SEEK_SET); +-# read (dll, expdata, export_size); +-# erva = expdata - export_rva; +-# +-# nexp = pe_as32 (expdata+24); +-# name_rvas = pe_as32 (expdata+32); +-# +-# printf ("EXPORTS\n"); +-# for (i = 0; i<nexp; i++) +-# { +-# unsigned long name_rva = pe_as32 (erva+name_rvas+i*4); +-# printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i); +-# } +-# +-# return 0; +-# } +-# /* impgen.c ends here */ +- +-EOF ++ cygwin* | mingw* | pw32*) ++ # FIXME: the MSVC++ port hasn't been tested in a loooong time ++ # When not using gcc, we currently assume that we are using ++ # Microsoft Visual C++. ++ if test "$GCC" != yes; then ++ with_gnu_ld=no ++ fi ++ ;; ++ openbsd*) ++ with_gnu_ld=no + ;; + esac + +- # We use sed instead of cat because bash on DJGPP gets confused if +- # if finds mixed CR/LF and LF-only lines. Since sed operates in +- # text mode, it properly converts lines to CR/LF. This bash problem +- # is reportedly fixed, but why not run on old versions too? +- sed '$q' "$ltmain" >> "${ofile}T" || (rm -f "${ofile}T"; exit 1) ++ _LT_AC_TAGVAR(ld_shlibs, $1)=yes ++ if test "$with_gnu_ld" = yes; then ++ # If archive_cmds runs LD, not CC, wlarc should be empty ++ wlarc='${wl}' + +- mv -f "${ofile}T" "$ofile" || \ +- (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T") +- chmod +x "$ofile" +-fi ++ # See if GNU ld supports shared libraries. ++ case $host_os in ++ aix3* | aix4* | aix5*) ++ # On AIX/PPC, the GNU linker is very broken ++ if test "$host_cpu" != ia64; then ++ _LT_AC_TAGVAR(ld_shlibs, $1)=no ++ cat <<EOF 1>&2 + +-])# _LT_AC_LTCONFIG_HACK ++*** Warning: the GNU linker, at least up to release 2.9.1, is reported ++*** to be unable to reliably create shared libraries on AIX. ++*** Therefore, libtool is disabling shared libraries support. If you ++*** really care for shared libraries, you may want to modify your PATH ++*** so that a non-GNU linker is found, and then restart. + +-# AC_LIBTOOL_DLOPEN - enable checks for dlopen support +-AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])]) ++EOF ++ fi ++ ;; + +-# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's +-AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])]) ++ amigaos*) ++ _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' ++ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes ++ ++ # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports ++ # that the semantics of dynamic libraries on AmigaOS, at least up ++ # to version 4, is to share data among multiple programs linked ++ # with the same dynamic library. Since this doesn't match the ++ # behavior of shared libraries on other platforms, we can't use ++ # them. ++ _LT_AC_TAGVAR(ld_shlibs, $1)=no ++ ;; + +-# AC_ENABLE_SHARED - implement the --enable-shared flag +-# Usage: AC_ENABLE_SHARED[(DEFAULT)] +-# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +-# `yes'. +-AC_DEFUN([AC_ENABLE_SHARED], +-[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl +-AC_ARG_ENABLE(shared, +-changequote(<<, >>)dnl +-<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT], +-changequote([, ])dnl +-[p=${PACKAGE-default} +-case $enableval in +-yes) enable_shared=yes ;; +-no) enable_shared=no ;; +-*) +- enable_shared=no +- # Look at the argument we got. We use all the common list separators. +- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," +- for pkg in $enableval; do +- if test "X$pkg" = "X$p"; then +- enable_shared=yes +- fi +- done +- IFS="$ac_save_ifs" +- ;; +-esac], +-enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl +-]) ++ beos*) ++ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then ++ _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported ++ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc ++ # support --undefined. This deserves some investigation. FIXME ++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' ++ else ++ _LT_AC_TAGVAR(ld_shlibs, $1)=no ++ fi ++ ;; + +-# AC_DISABLE_SHARED - set the default shared flag to --disable-shared +-AC_DEFUN([AC_DISABLE_SHARED], +-[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +-AC_ENABLE_SHARED(no)]) ++ cygwin* | mingw* | pw32*) ++ # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, ++ # as there is no search path for DLLs. ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' ++ _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported ++ _LT_AC_TAGVAR(always_export_symbols, $1)=no ++ _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ++ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' ++ ++ if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then ++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' ++ # If the export-symbols file already is a .def file (1st line ++ # is EXPORTS), use it as is; otherwise, prepend... ++ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then ++ cp $export_symbols $output_objdir/$soname.def; ++ else ++ echo EXPORTS > $output_objdir/$soname.def; ++ cat $export_symbols >> $output_objdir/$soname.def; ++ fi~ ++ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' ++ else ++ ld_shlibs=no ++ fi ++ ;; + +-# AC_ENABLE_STATIC - implement the --enable-static flag +-# Usage: AC_ENABLE_STATIC[(DEFAULT)] +-# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +-# `yes'. +-AC_DEFUN([AC_ENABLE_STATIC], +-[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl +-AC_ARG_ENABLE(static, +-changequote(<<, >>)dnl +-<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT], +-changequote([, ])dnl +-[p=${PACKAGE-default} +-case $enableval in +-yes) enable_static=yes ;; +-no) enable_static=no ;; +-*) +- enable_static=no +- # Look at the argument we got. We use all the common list separators. +- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," +- for pkg in $enableval; do +- if test "X$pkg" = "X$p"; then +- enable_static=yes +- fi +- done +- IFS="$ac_save_ifs" +- ;; +-esac], +-enable_static=AC_ENABLE_STATIC_DEFAULT)dnl +-]) ++ netbsd* | netbsdelf*-gnu | knetbsd*-gnu) ++ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then ++ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' ++ wlarc= ++ else ++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' ++ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ++ fi ++ ;; + +-# AC_DISABLE_STATIC - set the default static flag to --disable-static +-AC_DEFUN([AC_DISABLE_STATIC], +-[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +-AC_ENABLE_STATIC(no)]) ++ solaris* | sysv5*) ++ if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then ++ _LT_AC_TAGVAR(ld_shlibs, $1)=no ++ cat <<EOF 1>&2 ++ ++*** Warning: The releases 2.8.* of the GNU linker cannot reliably ++*** create shared libraries on Solaris systems. Therefore, libtool ++*** is disabling shared libraries support. We urge you to upgrade GNU ++*** binutils to release 2.9.1 or newer. Another option is to modify ++*** your PATH or compiler configuration so that the native linker is ++*** used, and then restart. + ++EOF ++ elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then ++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' ++ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ++ else ++ _LT_AC_TAGVAR(ld_shlibs, $1)=no ++ fi ++ ;; + +-# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag +-# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] +-# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +-# `yes'. +-AC_DEFUN([AC_ENABLE_FAST_INSTALL], +-[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl +-AC_ARG_ENABLE(fast-install, +-changequote(<<, >>)dnl +-<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT], +-changequote([, ])dnl +-[p=${PACKAGE-default} +-case $enableval in +-yes) enable_fast_install=yes ;; +-no) enable_fast_install=no ;; +-*) +- enable_fast_install=no +- # Look at the argument we got. We use all the common list separators. +- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," +- for pkg in $enableval; do +- if test "X$pkg" = "X$p"; then +- enable_fast_install=yes ++ sunos4*) ++ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' ++ wlarc= ++ _LT_AC_TAGVAR(hardcode_direct, $1)=yes ++ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ++ ;; ++ ++ linux*) ++ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then ++ tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' ++ _LT_AC_TAGVAR(archive_cmds, $1)="$tmp_archive_cmds" ++ supports_anon_versioning=no ++ case `$LD -v 2>/dev/null` in ++ *\ [01].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 ++ *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... ++ *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... ++ *\ 2.11.*) ;; # other 2.11 versions ++ *) supports_anon_versioning=yes ;; ++ esac ++ if test $supports_anon_versioning = yes; then ++ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ ++cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ ++$echo "local: *; };" >> $output_objdir/$libname.ver~ ++ $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' ++ else ++ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="$tmp_archive_cmds" ++ fi ++ _LT_AC_TAGVAR(link_all_deplibs, $1)=no ++ else ++ _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi +- done +- IFS="$ac_save_ifs" +- ;; +-esac], +-enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl +-]) ++ ;; + +-# AC_DISABLE_FAST_INSTALL - set the default to --disable-fast-install +-AC_DEFUN([AC_DISABLE_FAST_INSTALL], +-[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +-AC_ENABLE_FAST_INSTALL(no)]) ++ *) ++ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then ++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' ++ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ++ else ++ _LT_AC_TAGVAR(ld_shlibs, $1)=no ++ fi ++ ;; ++ esac ++ ++ if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = yes; then ++ runpath_var=LD_RUN_PATH ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' ++ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' ++ # ancient GNU ld didn't support --whole-archive et. al. ++ if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then ++ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' ++ else ++ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= ++ fi ++ fi ++ else ++ # PORTME fill in a description of your system's linker (not GNU ld) ++ case $host_os in ++ aix3*) ++ _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported ++ _LT_AC_TAGVAR(always_export_symbols, $1)=yes ++ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' ++ # Note: this linker hardcodes the directories in LIBPATH if there ++ # are no directories specified by -L. ++ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes ++ if test "$GCC" = yes && test -z "$link_static_flag"; then ++ # Neither direct hardcoding nor static linking is supported with a ++ # broken collect2. ++ _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported ++ fi ++ ;; ++ ++ aix4* | aix5*) ++ if test "$host_cpu" = ia64; then ++ # On IA64, the linker does run time linking by default, so we don't ++ # have to do anything special. ++ aix_use_runtimelinking=no ++ exp_sym_flag='-Bexport' ++ no_entry_flag="" ++ else ++ # If we're using GNU nm, then we don't want the "-C" option. ++ # -C means demangle to AIX nm, but means don't demangle with GNU nm ++ if $NM -V 2>&1 | grep 'GNU' > /dev/null; then ++ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' ++ else ++ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' ++ fi ++ aix_use_runtimelinking=no + +-# AC_LIBTOOL_PICMODE - implement the --with-pic flag +-# Usage: AC_LIBTOOL_PICMODE[(MODE)] +-# Where MODE is either `yes' or `no'. If omitted, it defaults to +-# `both'. +-AC_DEFUN([AC_LIBTOOL_PICMODE], +-[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +-pic_mode=ifelse($#,1,$1,default)]) ++ # Test if we are trying to use run time linking or normal ++ # AIX style linking. If -brtl is somewhere in LDFLAGS, we ++ # need to do runtime linking. ++ case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) ++ for ld_flag in $LDFLAGS; do ++ if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then ++ aix_use_runtimelinking=yes ++ break ++ fi ++ done ++ esac + ++ exp_sym_flag='-bexport' ++ no_entry_flag='-bnoentry' ++ fi + +-# AC_PATH_TOOL_PREFIX - find a file program which can recognise shared library +-AC_DEFUN([AC_PATH_TOOL_PREFIX], +-[AC_MSG_CHECKING([for $1]) +-AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, +-[case $MAGIC_CMD in +- /*) +- lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. +- ;; +- ?:/*) +- lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. +- ;; +- *) +- ac_save_MAGIC_CMD="$MAGIC_CMD" +- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" +-dnl $ac_dummy forces splitting on constant user-supplied paths. +-dnl POSIX.2 word splitting is done only on the output of word expansions, +-dnl not every word. This closes a longstanding sh security hole. +- ac_dummy="ifelse([$2], , $PATH, [$2])" +- for ac_dir in $ac_dummy; do +- test -z "$ac_dir" && ac_dir=. +- if test -f $ac_dir/$1; then +- lt_cv_path_MAGIC_CMD="$ac_dir/$1" +- if test -n "$file_magic_test_file"; then +- case $deplibs_check_method in +- "file_magic "*) +- file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" +- MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +- if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | +- egrep "$file_magic_regex" > /dev/null; then +- : ++ # When large executables or shared objects are built, AIX ld can ++ # have problems creating the table of contents. If linking a library ++ # or program results in "error TOC overflow" add -mminimal-toc to ++ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not ++ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. ++ ++ _LT_AC_TAGVAR(archive_cmds, $1)='' ++ _LT_AC_TAGVAR(hardcode_direct, $1)=yes ++ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' ++ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes ++ ++ if test "$GCC" = yes; then ++ case $host_os in aix4.[012]|aix4.[012].*) ++ # We only want to do this on AIX 4.2 and lower, the check ++ # below for broken collect2 doesn't work under 4.3+ ++ collect2name=`${CC} -print-prog-name=collect2` ++ if test -f "$collect2name" && \ ++ strings "$collect2name" | grep resolve_lib_name >/dev/null ++ then ++ # We have reworked collect2 ++ _LT_AC_TAGVAR(hardcode_direct, $1)=yes + else +- cat <<EOF 1>&2 +- +-*** Warning: the command libtool uses to detect shared libraries, +-*** $file_magic_cmd, produces output that libtool cannot recognize. +-*** The result is that libtool may fail to recognize shared libraries +-*** as such. This will affect the creation of libtool libraries that +-*** depend on shared libraries, but programs linked with such libtool +-*** libraries will work regardless of this problem. Nevertheless, you +-*** may want to report the problem to your system manager and/or to +-*** bug-libtool@gnu.org +- +-EOF +- fi ;; ++ # We have old collect2 ++ _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported ++ # It fails to find uninstalled libraries when the uninstalled ++ # path is not listed in the libpath. Setting hardcode_minus_L ++ # to unsupported forces relinking ++ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' ++ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= ++ fi + esac ++ shared_flag='-shared' ++ else ++ # not using gcc ++ if test "$host_cpu" = ia64; then ++ # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release ++ # chokes on -Wl,-G. The following line is correct: ++ shared_flag='-G' ++ else ++ if test "$aix_use_runtimelinking" = yes; then ++ shared_flag='${wl}-G' ++ else ++ shared_flag='${wl}-bM:SRE' ++ fi ++ fi + fi +- break +- fi +- done +- IFS="$ac_save_ifs" +- MAGIC_CMD="$ac_save_MAGIC_CMD" +- ;; +-esac]) +-MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +-if test -n "$MAGIC_CMD"; then +- AC_MSG_RESULT($MAGIC_CMD) +-else +- AC_MSG_RESULT(no) +-fi +-]) + ++ # It seems that -bexpall does not export symbols beginning with ++ # underscore (_), so it is better to generate a list of symbols to export. ++ _LT_AC_TAGVAR(always_export_symbols, $1)=yes ++ if test "$aix_use_runtimelinking" = yes; then ++ # Warning - without using the other runtime loading flags (-brtl), ++ # -berok will link without error, but may produce a broken library. ++ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' ++ # Determine the default libpath from the value encoded in an empty executable. ++ _LT_AC_SYS_LIBPATH_AIX ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" ++ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" ++ else ++ if test "$host_cpu" = ia64; then ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' ++ _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" ++ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" ++ else ++ # Determine the default libpath from the value encoded in an empty executable. ++ _LT_AC_SYS_LIBPATH_AIX ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" ++ # Warning - without using the other run time loading flags, ++ # -berok will link without error, but may produce a broken library. ++ _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' ++ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' ++ # -bexpall does not export symbols beginning with underscore (_) ++ _LT_AC_TAGVAR(always_export_symbols, $1)=yes ++ # Exported symbols can be pulled into shared objects from archives ++ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' ++ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes ++ # This is similar to how AIX traditionally builds it's shared libraries. ++ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' ++ fi ++ fi ++ ;; + +-# AC_PATH_MAGIC - find a file program which can recognise a shared library +-AC_DEFUN([AC_PATH_MAGIC], +-[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl +-AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin:$PATH) +-if test -z "$lt_cv_path_MAGIC_CMD"; then +- if test -n "$ac_tool_prefix"; then +- AC_PATH_TOOL_PREFIX(file, /usr/bin:$PATH) +- else +- MAGIC_CMD=: +- fi +-fi +-]) ++ amigaos*) ++ _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' ++ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes ++ # see comment about different semantics on the GNU ld section ++ _LT_AC_TAGVAR(ld_shlibs, $1)=no ++ ;; + ++ bsdi4*) ++ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ++ ;; + +-# AC_PROG_LD - find the path to the GNU or non-GNU linker +-AC_DEFUN([AC_PROG_LD], +-[AC_ARG_WITH(gnu-ld, +-[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], +-test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) +-AC_REQUIRE([AC_PROG_CC])dnl +-AC_REQUIRE([AC_CANONICAL_HOST])dnl +-AC_REQUIRE([AC_CANONICAL_BUILD])dnl +-AC_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])dnl +-ac_prog=ld +-if test "$GCC" = yes; then +- # Check if gcc -print-prog-name=ld gives a path. +- AC_MSG_CHECKING([for ld used by GCC]) +- case $host in +- *-*-mingw*) +- # gcc leaves a trailing carriage return which upsets mingw +- ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; +- *) +- ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; +- esac +- case $ac_prog in +- # Accept absolute paths. +- [[\\/]]* | [[A-Za-z]]:[[\\/]]*) +- re_direlt='/[[^/]][[^/]]*/\.\./' +- # Canonicalize the path of ld +- ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` +- while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do +- ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` +- done +- test -z "$LD" && LD="$ac_prog" ++ cygwin* | mingw* | pw32*) ++ # When not using gcc, we currently assume that we are using ++ # Microsoft Visual C++. ++ # hardcode_libdir_flag_spec is actually meaningless, as there is ++ # no search path for DLLs. ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' ++ _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported ++ # Tell ltmain to make .lib files, not .a files. ++ libext=lib ++ # Tell ltmain to make .dll files, not .so files. ++ shrext_cmds=".dll" ++ # FIXME: Setting linknames here is a bad hack. ++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' ++ # The linker will automatically build a .lib file if we build a DLL. ++ _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' ++ # FIXME: Should let the user specify the lib program. ++ _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs' ++ fix_srcfile_path='`cygpath -w "$srcfile"`' ++ _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; +- "") +- # If it fails, then pretend we aren't using GCC. +- ac_prog=ld +- ;; +- *) +- # If it is relative, then search for the first ld in PATH. +- with_gnu_ld=unknown +- ;; +- esac +-elif test "$with_gnu_ld" = yes; then +- AC_MSG_CHECKING([for GNU ld]) +-else +- AC_MSG_CHECKING([for non-GNU ld]) +-fi +-AC_CACHE_VAL(lt_cv_path_LD, +-[if test -z "$LD"; then +- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR +- for ac_dir in $PATH; do +- test -z "$ac_dir" && ac_dir=. +- if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then +- lt_cv_path_LD="$ac_dir/$ac_prog" +- # Check to see if the program is GNU ld. I'd rather use --version, +- # but apparently some GNU ld's only accept -v. +- # Break only if it was the GNU/non-GNU ld that we prefer. +- if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then +- test "$with_gnu_ld" != no && break ++ ++ darwin* | rhapsody*) ++ if test "$GXX" = yes ; then ++ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ++ case "$host_os" in ++ rhapsody* | darwin1.[[012]]) ++ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' ++ ;; ++ *) # Darwin 1.3 on ++ if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then ++ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + else +- test "$with_gnu_ld" != yes && break ++ case ${MACOSX_DEPLOYMENT_TARGET} in ++ 10.[[012]]) ++ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' ++ ;; ++ 10.*) ++ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup' ++ ;; ++ esac + fi ++ ;; ++ esac ++ lt_int_apple_cc_single_mod=no ++ output_verbose_link_cmd='echo' ++ if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then ++ lt_int_apple_cc_single_mod=yes ++ fi ++ if test "X$lt_int_apple_cc_single_mod" = Xyes ; then ++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' ++ else ++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' ++ fi ++ _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' ++ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's ++ if test "X$lt_int_apple_cc_single_mod" = Xyes ; then ++ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ++ else ++ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ++ fi ++ _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ++ _LT_AC_TAGVAR(hardcode_direct, $1)=no ++ _LT_AC_TAGVAR(hardcode_automatic, $1)=yes ++ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported ++ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' ++ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes ++ else ++ _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi +- done +- IFS="$ac_save_ifs" +-else +- lt_cv_path_LD="$LD" # Let the user override the test with a path. +-fi]) +-LD="$lt_cv_path_LD" +-if test -n "$LD"; then +- AC_MSG_RESULT($LD) +-else +- AC_MSG_RESULT(no) +-fi +-test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) +-AC_PROG_LD_GNU +-]) ++ ;; + +-# AC_PROG_LD_GNU - +-AC_DEFUN([AC_PROG_LD_GNU], +-[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld, +-[# I'd rather use --version here, but apparently some GNU ld's only accept -v. +-if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then +- lt_cv_prog_gnu_ld=yes +-else +- lt_cv_prog_gnu_ld=no +-fi]) +-with_gnu_ld=$lt_cv_prog_gnu_ld +-]) ++ dgux*) ++ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' ++ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ++ ;; + +-# AC_PROG_LD_RELOAD_FLAG - find reload flag for linker +-# -- PORTME Some linkers may need a different reload flag. +-AC_DEFUN([AC_PROG_LD_RELOAD_FLAG], +-[AC_CACHE_CHECK([for $LD option to reload object files], lt_cv_ld_reload_flag, +-[lt_cv_ld_reload_flag='-r']) +-reload_flag=$lt_cv_ld_reload_flag +-test -n "$reload_flag" && reload_flag=" $reload_flag" +-]) ++ freebsd1*) ++ _LT_AC_TAGVAR(ld_shlibs, $1)=no ++ ;; + +-# AC_DEPLIBS_CHECK_METHOD - how to check for library dependencies +-# -- PORTME fill in with the dynamic library characteristics +-AC_DEFUN([AC_DEPLIBS_CHECK_METHOD], +-[AC_CACHE_CHECK([how to recognise dependent libraries], +-lt_cv_deplibs_check_method, +-[lt_cv_file_magic_cmd='$MAGIC_CMD' +-lt_cv_file_magic_test_file= +-lt_cv_deplibs_check_method='unknown' +-# Need to set the preceding variable on all platforms that support +-# interlibrary dependencies. +-# 'none' -- dependencies not supported. +-# `unknown' -- same as none, but documents that we really don't know. +-# 'pass_all' -- all dependencies passed with no checks. +-# 'test_compile' -- check by making test program. +-# 'file_magic [[regex]]' -- check by looking for files in library path +-# which responds to the $file_magic_cmd with a given egrep regex. +-# If you have `file' or equivalent on your system and you're not sure +-# whether `pass_all' will *always* work, you probably want this one. ++ # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor ++ # support. Future versions do this automatically, but an explicit c++rt0.o ++ # does not break anything, and helps significantly (at the cost of a little ++ # extra space). ++ freebsd2.2*) ++ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' ++ _LT_AC_TAGVAR(hardcode_direct, $1)=yes ++ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ++ ;; + +-case $host_os in +-aix4* | aix5*) +- lt_cv_deplibs_check_method=pass_all +- ;; ++ # Unfortunately, older versions of FreeBSD 2 do not have this feature. ++ freebsd2*) ++ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' ++ _LT_AC_TAGVAR(hardcode_direct, $1)=yes ++ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes ++ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ++ ;; + +-beos*) +- lt_cv_deplibs_check_method=pass_all +- ;; ++ # FreeBSD 3 and greater uses gcc -shared to do shared libraries. ++ freebsd* | kfreebsd*-gnu) ++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' ++ _LT_AC_TAGVAR(hardcode_direct, $1)=yes ++ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ++ ;; + +-bsdi4*) +- lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)' +- lt_cv_file_magic_cmd='/usr/bin/file -L' +- lt_cv_file_magic_test_file=/shlib/libc.so +- ;; ++ hpux9*) ++ if test "$GCC" = yes; then ++ _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ++ else ++ _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ++ fi ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' ++ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: ++ _LT_AC_TAGVAR(hardcode_direct, $1)=yes ++ ++ # hardcode_minus_L: Not really in the search PATH, ++ # but as the default location of the library. ++ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes ++ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ++ ;; + +-cygwin* | mingw* | pw32*) +- lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' +- lt_cv_file_magic_cmd='$OBJDUMP -f' +- ;; ++ hpux10* | hpux11*) ++ if test "$GCC" = yes -a "$with_gnu_ld" = no; then ++ case "$host_cpu" in ++ hppa*64*|ia64*) ++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ++ ;; ++ *) ++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ++ ;; ++ esac ++ else ++ case "$host_cpu" in ++ hppa*64*|ia64*) ++ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' ++ ;; ++ *) ++ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ++ ;; ++ esac ++ fi ++ if test "$with_gnu_ld" = no; then ++ case "$host_cpu" in ++ hppa*64*) ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' ++ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: ++ _LT_AC_TAGVAR(hardcode_direct, $1)=no ++ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ++ ;; ++ ia64*) ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' ++ _LT_AC_TAGVAR(hardcode_direct, $1)=no ++ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ++ ++ # hardcode_minus_L: Not really in the search PATH, ++ # but as the default location of the library. ++ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes ++ ;; ++ *) ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' ++ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: ++ _LT_AC_TAGVAR(hardcode_direct, $1)=yes ++ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ++ ++ # hardcode_minus_L: Not really in the search PATH, ++ # but as the default location of the library. ++ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes ++ ;; ++ esac ++ fi ++ ;; + +-darwin* | rhapsody*) +- lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' +- lt_cv_file_magic_cmd='/usr/bin/file -L' +- case "$host_os" in +- rhapsody* | darwin1.[[012]]) +- lt_cv_file_magic_test_file=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1` +- ;; +- *) # Darwin 1.3 on +- lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' +- ;; +- esac +- ;; ++ irix5* | irix6* | nonstopux*) ++ if test "$GCC" = yes; then ++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ++ else ++ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' ++ fi ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' ++ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: ++ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes ++ ;; + +-freebsd*) +- if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then +- case $host_cpu in +- i*86 ) +- # Not sure whether the presence of OpenBSD here was a mistake. +- # Let's accept both of them until this is cleared up. +- lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[[3-9]]86 (compact )?demand paged shared library' +- lt_cv_file_magic_cmd=/usr/bin/file +- lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ++ netbsd* | netbsdelf*-gnu | knetbsd*-gnu) ++ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then ++ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out ++ else ++ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF ++ fi ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' ++ _LT_AC_TAGVAR(hardcode_direct, $1)=yes ++ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ++ ;; ++ ++ newsos6) ++ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' ++ _LT_AC_TAGVAR(hardcode_direct, $1)=yes ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' ++ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: ++ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ++ ;; ++ ++ openbsd*) ++ _LT_AC_TAGVAR(hardcode_direct, $1)=yes ++ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ++ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then ++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' ++ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ++ else ++ case $host_os in ++ openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) ++ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' ++ ;; ++ *) ++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' ++ ;; ++ esac ++ fi ++ ;; ++ ++ os2*) ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' ++ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes ++ _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported ++ _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' ++ _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ++ ;; ++ ++ osf3*) ++ if test "$GCC" = yes; then ++ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' ++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ++ else ++ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' ++ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' ++ fi ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' ++ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; +- esac +- else +- lt_cv_deplibs_check_method=pass_all +- fi +- ;; + +-gnu*) +- lt_cv_deplibs_check_method=pass_all +- ;; ++ osf4* | osf5*) # as osf3* with the addition of -msym flag ++ if test "$GCC" = yes; then ++ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' ++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' ++ else ++ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' ++ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' ++ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ ++ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + +-hpux10.20*|hpux11*) +- lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' +- lt_cv_file_magic_cmd=/usr/bin/file +- lt_cv_file_magic_test_file=/usr/lib/libc.sl +- ;; ++ # Both c and cxx compiler support -rpath directly ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ++ fi ++ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: ++ ;; + +-irix5* | irix6* | nonstopux*) +- case $host_os in +- irix5* | nonstopux*) +- # this will be overridden with pass_all, but let us keep it just in case +- lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" +- ;; +- *) +- case $LD in +- *-32|*"-32 ") libmagic=32-bit;; +- *-n32|*"-n32 ") libmagic=N32;; +- *-64|*"-64 ") libmagic=64-bit;; +- *) libmagic=never-match;; +- esac +- # this will be overridden with pass_all, but let us keep it just in case +- lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[[1234]] dynamic lib MIPS - version 1" +- ;; +- esac +- lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` +- lt_cv_deplibs_check_method=pass_all +- ;; ++ sco3.2v5*) ++ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' ++ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ++ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' ++ runpath_var=LD_RUN_PATH ++ hardcode_runpath_var=yes ++ ;; + +-# This must be Linux ELF. +-linux-gnu*) +- case $host_cpu in +- alpha* | hppa* | i*86 | mips | mipsel | powerpc* | sparc* | ia64* | arm* | m68k) +- lt_cv_deplibs_check_method=pass_all ;; +- *) +- # glibc up to 2.1.1 does not perform some relocations on ARM +- lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; +- esac +- lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` +- ;; ++ solaris*) ++ _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' ++ if test "$GCC" = yes; then ++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ++ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ ++ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' ++ else ++ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' ++ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ ++ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' ++ fi ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' ++ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ++ case $host_os in ++ solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; ++ *) # Supported since Solaris 2.6 (maybe 2.5.1?) ++ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; ++ esac ++ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes ++ ;; + +-netbsd*) +- if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then +- lt_cv_deplibs_check_method='match_pattern /lib[[^/\.]]+\.so\.[[0-9]]+\.[[0-9]]+$' +- else +- lt_cv_deplibs_check_method='match_pattern /lib[[^/\.]]+\.so$' +- fi +- ;; ++ sunos4*) ++ if test "x$host_vendor" = xsequent; then ++ # Use $CC to link under sequent, because it throws in some extra .o ++ # files that make .init and .fini sections work. ++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' ++ else ++ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' ++ fi ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' ++ _LT_AC_TAGVAR(hardcode_direct, $1)=yes ++ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes ++ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ++ ;; + +-newos6*) +- lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' +- lt_cv_file_magic_cmd=/usr/bin/file +- lt_cv_file_magic_test_file=/usr/lib/libnls.so +- ;; ++ sysv4) ++ case $host_vendor in ++ sni) ++ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' ++ _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true??? ++ ;; ++ siemens) ++ ## LD is ld it makes a PLAMLIB ++ ## CC just makes a GrossModule. ++ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' ++ _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' ++ _LT_AC_TAGVAR(hardcode_direct, $1)=no ++ ;; ++ motorola) ++ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' ++ _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie ++ ;; ++ esac ++ runpath_var='LD_RUN_PATH' ++ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ++ ;; + +-openbsd*) +- lt_cv_file_magic_cmd=/usr/bin/file +- lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` +- if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then +- lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' +- else +- lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' +- fi +- ;; ++ sysv4.3*) ++ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' ++ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ++ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' ++ ;; + +-osf3* | osf4* | osf5*) +- # this will be overridden with pass_all, but let us keep it just in case +- lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' +- lt_cv_file_magic_test_file=/shlib/libc.so +- lt_cv_deplibs_check_method=pass_all +- ;; ++ sysv4*MP*) ++ if test -d /usr/nec; then ++ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' ++ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ++ runpath_var=LD_RUN_PATH ++ hardcode_runpath_var=yes ++ _LT_AC_TAGVAR(ld_shlibs, $1)=yes ++ fi ++ ;; + +-sco3.2v5*) +- lt_cv_deplibs_check_method=pass_all +- ;; ++ sysv4.2uw2*) ++ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' ++ _LT_AC_TAGVAR(hardcode_direct, $1)=yes ++ _LT_AC_TAGVAR(hardcode_minus_L, $1)=no ++ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ++ hardcode_runpath_var=yes ++ runpath_var=LD_RUN_PATH ++ ;; + +-solaris*) +- lt_cv_deplibs_check_method=pass_all +- lt_cv_file_magic_test_file=/lib/libc.so +- ;; ++ sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) ++ _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z ${wl}text' ++ if test "$GCC" = yes; then ++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ++ else ++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ++ fi ++ runpath_var='LD_RUN_PATH' ++ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ++ ;; + +-sysv5uw[[78]]* | sysv4*uw2*) +- lt_cv_deplibs_check_method=pass_all +- ;; ++ sysv5*) ++ _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' ++ # $CC -shared without GNU ld will not create a library from C++ ++ # object files and a static libstdc++, better avoid it by now ++ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' ++ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ ++ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= ++ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ++ runpath_var='LD_RUN_PATH' ++ ;; + +-sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) +- case $host_vendor in +- motorola) +- lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' +- lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` +- ;; +- ncr) +- lt_cv_deplibs_check_method=pass_all +- ;; +- sequent) +- lt_cv_file_magic_cmd='/bin/file' +- lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' +- ;; +- sni) +- lt_cv_file_magic_cmd='/bin/file' +- lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" +- lt_cv_file_magic_test_file=/lib/libc.so +- ;; +- siemens) +- lt_cv_deplibs_check_method=pass_all +- ;; +- esac +- ;; +-esac +-]) +-file_magic_cmd=$lt_cv_file_magic_cmd +-deplibs_check_method=$lt_cv_deplibs_check_method ++ uts4*) ++ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' ++ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' ++ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ++ ;; ++ ++ *) ++ _LT_AC_TAGVAR(ld_shlibs, $1)=no ++ ;; ++ esac ++ fi + ]) ++AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) ++test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + ++variables_saved_for_relink="PATH $shlibpath_var $runpath_var" ++if test "$GCC" = yes; then ++ variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" ++fi + +-# AC_PROG_NM - find the path to a BSD-compatible name lister +-AC_DEFUN([AC_PROG_NM], +-[AC_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])dnl +-AC_MSG_CHECKING([for BSD-compatible nm]) +-AC_CACHE_VAL(lt_cv_path_NM, +-[if test -n "$NM"; then +- # Let the user override the test. +- lt_cv_path_NM="$NM" +-else +- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR +- for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do +- test -z "$ac_dir" && ac_dir=. +- tmp_nm=$ac_dir/${ac_tool_prefix}nm +- if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then +- # Check to see if the nm accepts a BSD-compat flag. +- # Adding the `sed 1q' prevents false positives on HP-UX, which says: +- # nm: unknown option "B" ignored +- # Tru64's nm complains that /dev/null is an invalid object file +- if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then +- lt_cv_path_NM="$tmp_nm -B" +- break +- elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then +- lt_cv_path_NM="$tmp_nm -p" +- break ++# ++# Do we need to explicitly link libc? ++# ++case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in ++x|xyes) ++ # Assume -lc should be added ++ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes ++ ++ if test "$enable_shared" = yes && test "$GCC" = yes; then ++ case $_LT_AC_TAGVAR(archive_cmds, $1) in ++ *'~'*) ++ # FIXME: we may have to deal with multi-command sequences. ++ ;; ++ '$CC '*) ++ # Test whether the compiler implicitly links with -lc since on some ++ # systems, -lgcc has to come before -lc. If gcc already passes -lc ++ # to ld, don't add -lc before -lgcc. ++ AC_MSG_CHECKING([whether -lc should be explicitly linked in]) ++ $rm conftest* ++ printf "$lt_simple_compile_test_code" > conftest.$ac_ext ++ ++ if AC_TRY_EVAL(ac_compile) 2>conftest.err; then ++ soname=conftest ++ lib=conftest ++ libobjs=conftest.$ac_objext ++ deplibs= ++ wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) ++ compiler_flags=-v ++ linker_flags=-v ++ verstring= ++ output_objdir=. ++ libname=conftest ++ lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1) ++ _LT_AC_TAGVAR(allow_undefined_flag, $1)= ++ if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) ++ then ++ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ++ else ++ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes ++ fi ++ _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag + else +- lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but +- continue # so that we can try to find one that supports BSD flags ++ cat conftest.err 1>&5 + fi +- fi +- done +- IFS="$ac_save_ifs" +- test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +-fi]) +-NM="$lt_cv_path_NM" +-AC_MSG_RESULT([$NM]) +-]) +- +-# AC_CHECK_LIBM - check for math library +-AC_DEFUN([AC_CHECK_LIBM], +-[AC_REQUIRE([AC_CANONICAL_HOST])dnl +-LIBM= +-case $host in +-*-*-beos* | *-*-cygwin* | *-*-pw32*) +- # These system don't have libm +- ;; +-*-ncr-sysv4.3*) +- AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") +- AC_CHECK_LIB(m, main, LIBM="$LIBM -lm") +- ;; +-*) +- AC_CHECK_LIB(m, main, LIBM="-lm") ++ $rm conftest* ++ AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)]) ++ ;; ++ esac ++ fi + ;; + esac +-]) ++])# AC_LIBTOOL_PROG_LD_SHLIBS + +-# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for +-# the libltdl convenience library and LTDLINCL to the include flags for +-# the libltdl header and adds --enable-ltdl-convenience to the +-# configure arguments. Note that LIBLTDL and LTDLINCL are not +-# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not +-# provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed +-# with '${top_builddir}/' and LTDLINCL will be prefixed with +-# '${top_srcdir}/' (note the single quotes!). If your package is not +-# flat and you're not using automake, define top_builddir and +-# top_srcdir appropriately in the Makefiles. +-AC_DEFUN([AC_LIBLTDL_CONVENIENCE], +-[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +- case $enable_ltdl_convenience in +- no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; +- "") enable_ltdl_convenience=yes +- ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; +- esac +- LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la +- LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) +- # For backwards non-gettext consistent compatibility... +- INCLTDL="$LTDLINCL" +-]) + +-# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for +-# the libltdl installable library and LTDLINCL to the include flags for +-# the libltdl header and adds --enable-ltdl-install to the configure +-# arguments. Note that LIBLTDL and LTDLINCL are not AC_SUBSTed, nor is +-# AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed +-# libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will +-# be prefixed with '${top_builddir}/' and LTDLINCL will be prefixed +-# with '${top_srcdir}/' (note the single quotes!). If your package is +-# not flat and you're not using automake, define top_builddir and +-# top_srcdir appropriately in the Makefiles. +-# In the future, this macro may have to be called after AC_PROG_LIBTOOL. +-AC_DEFUN([AC_LIBLTDL_INSTALLABLE], +-[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +- AC_CHECK_LIB(ltdl, main, +- [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], +- [if test x"$enable_ltdl_install" = xno; then +- AC_MSG_WARN([libltdl not installed, but installation disabled]) +- else +- enable_ltdl_install=yes +- fi +- ]) +- if test x"$enable_ltdl_install" = x"yes"; then +- ac_configure_args="$ac_configure_args --enable-ltdl-install" +- LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la +- LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) +- else +- ac_configure_args="$ac_configure_args --enable-ltdl-install=no" +- LIBLTDL="-lltdl" +- LTDLINCL= +- fi +- # For backwards non-gettext consistent compatibility... +- INCLTDL="$LTDLINCL" +-]) ++# _LT_AC_FILE_LTDLL_C ++# ------------------- ++# Be careful that the start marker always follows a newline. ++AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ ++# /* ltdll.c starts here */ ++# #define WIN32_LEAN_AND_MEAN ++# #include <windows.h> ++# #undef WIN32_LEAN_AND_MEAN ++# #include <stdio.h> ++# ++# #ifndef __CYGWIN__ ++# # ifdef __CYGWIN32__ ++# # define __CYGWIN__ __CYGWIN32__ ++# # endif ++# #endif ++# ++# #ifdef __cplusplus ++# extern "C" { ++# #endif ++# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); ++# #ifdef __cplusplus ++# } ++# #endif ++# ++# #ifdef __CYGWIN__ ++# #include <cygwin/cygwin_dll.h> ++# DECLARE_CYGWIN_DLL( DllMain ); ++# #endif ++# HINSTANCE __hDllInstance_base; ++# ++# BOOL APIENTRY ++# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) ++# { ++# __hDllInstance_base = hInst; ++# return TRUE; ++# } ++# /* ltdll.c ends here */ ++])# _LT_AC_FILE_LTDLL_C ++ ++ ++# _LT_AC_TAGVAR(VARNAME, [TAGNAME]) ++# --------------------------------- ++AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])]) ++ + + # old names + AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) +@@ -3709,6 +6828,16 @@ + # This is just to silence aclocal about the macro not being used + ifelse([AC_DISABLE_FAST_INSTALL]) + ++AC_DEFUN([LT_AC_PROG_GCJ], ++[AC_CHECK_TOOL(GCJ, gcj, no) ++ test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" ++ AC_SUBST(GCJFLAGS) ++]) ++ ++AC_DEFUN([LT_AC_PROG_RC], ++[AC_CHECK_TOOL(RC, windres, no) ++]) ++ + # NOTE: This macro has been submitted for inclusion into # + # GNU Autoconf as AC_PROG_SED. When it is available in # + # a released version of Autoconf we should remove this # +@@ -3722,79 +6851,51 @@ + AC_CACHE_VAL(lt_cv_path_SED, + [# Loop through the user's path and test for sed and gsed. + # Then use that list of sed's as ones to test for truncation. +-as_executable_p="test -f" + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR + for as_dir in $PATH + do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. +- for ac_prog in sed gsed; do ++ for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do +- if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then +- _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext" ++ if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then ++ lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done + done +- +- # Create a temporary directory, and hook for its removal unless debugging. +-$debug || +-{ +- trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 +- trap '{ (exit 1); exit 1; }' 1 2 13 15 +-} +- +-# Create a (secure) tmp directory for tmp files. +-: ${TMPDIR=/tmp} +-{ +- tmp=`(umask 077 && mktemp -d -q "$TMPDIR/sedXXXXXX") 2>/dev/null` && +- test -n "$tmp" && test -d "$tmp" +-} || +-{ +- tmp=$TMPDIR/sed$$-$RANDOM +- (umask 077 && mkdir $tmp) +-} || +-{ +- echo "$me: cannot create a temporary directory in $TMPDIR" >&2 +- { (exit 1); exit 1; } +-} +- _max=0 +- _count=0 +- # Add /usr/xpg4/bin/sed as it is typically found on Solaris +- # along with /bin/sed that truncates output. +- for _sed in $_sed_list /usr/xpg4/bin/sed; do +- test ! -f ${_sed} && break +- cat /dev/null > "$tmp/sed.in" +- _count=0 +- echo ${ECHO_N-$ac_n} "0123456789${ECHO_C-$ac_c}" >"$tmp/sed.in" +- # Check for GNU sed and select it if it is found. +- if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; then +- lt_cv_path_SED=${_sed} +- break ++lt_ac_max=0 ++lt_ac_count=0 ++# Add /usr/xpg4/bin/sed as it is typically found on Solaris ++# along with /bin/sed that truncates output. ++for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do ++ test ! -f $lt_ac_sed && break ++ cat /dev/null > conftest.in ++ lt_ac_count=0 ++ echo $ECHO_N "0123456789$ECHO_C" >conftest.in ++ # Check for GNU sed and select it if it is found. ++ if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then ++ lt_cv_path_SED=$lt_ac_sed ++ break ++ fi ++ while true; do ++ cat conftest.in conftest.in >conftest.tmp ++ mv conftest.tmp conftest.in ++ cp conftest.in conftest.nl ++ echo >>conftest.nl ++ $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break ++ cmp -s conftest.out conftest.nl || break ++ # 10000 chars as input seems more than enough ++ test $lt_ac_count -gt 10 && break ++ lt_ac_count=`expr $lt_ac_count + 1` ++ if test $lt_ac_count -gt $lt_ac_max; then ++ lt_ac_max=$lt_ac_count ++ lt_cv_path_SED=$lt_ac_sed + fi +- while true; do +- cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp" +- mv "$tmp/sed.tmp" "$tmp/sed.in" +- cp "$tmp/sed.in" "$tmp/sed.nl" +- echo >>"$tmp/sed.nl" +- ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break +- cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break +- # 40000 chars as input seems more than enough +- test $_count -gt 10 && break +- _count=`expr $_count + 1` +- if test $_count -gt $_max; then +- _max=$_count +- lt_cv_path_SED=$_sed +- fi +- done + done +- rm -rf "$tmp" ++done ++SED=$lt_cv_path_SED + ]) +-if test "X$SED" != "X"; then +- lt_cv_path_SED=$SED +-else +- SED=$lt_cv_path_SED +-fi + AC_MSG_RESULT([$SED]) + ]) + +diff -urN linux-atm.old/configure linux-atm.dev/configure +--- linux-atm.old/configure 2005-08-23 01:12:10.846787000 +0200 ++++ linux-atm.dev/configure 2005-08-23 01:12:41.187175024 +0200 +@@ -1,9 +1,8 @@ + #! /bin/sh + # Guess values for system-dependent variables and create Makefiles. +-# Generated by GNU Autoconf 2.57. ++# Generated by GNU Autoconf 2.59. + # +-# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 +-# Free Software Foundation, Inc. ++# Copyright (C) 2003 Free Software Foundation, Inc. + # This configure script is free software; the Free Software Foundation + # gives unlimited permission to copy, distribute and modify it. + ## --------------------- ## +@@ -20,9 +19,10 @@ + elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix + fi ++DUALCASE=1; export DUALCASE # for MKS sh + + # Support unset when possible. +-if (FOO=FOO; unset FOO) >/dev/null 2>&1; then ++if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset + else + as_unset=false +@@ -41,7 +41,7 @@ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME + do +- if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then ++ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var +@@ -218,16 +218,17 @@ + if mkdir -p . 2>/dev/null; then + as_mkdir_p=: + else ++ test -d ./-p && rmdir ./-p + as_mkdir_p=false + fi + + as_executable_p="test -f" + + # Sed expression to map a string onto a valid CPP name. +-as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" ++as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + + # Sed expression to map a string onto a valid variable name. +-as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" ++as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + + # IFS +@@ -826,7 +827,7 @@ + + # Be sure to have absolute paths. + for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ +- localstatedir libdir includedir oldincludedir infodir mandir ++ localstatedir libdir includedir oldincludedir infodir mandir + do + eval ac_val=$`echo $ac_var` + case $ac_val in +@@ -866,10 +867,10 @@ + # Try the directory containing this script, then its parent. + ac_confdir=`(dirname "$0") 2>/dev/null || + $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ +- X"$0" : 'X\(//\)[^/]' \| \ +- X"$0" : 'X\(//\)$' \| \ +- X"$0" : 'X\(/\)' \| \ +- . : '\(.\)' 2>/dev/null || ++ X"$0" : 'X\(//\)[^/]' \| \ ++ X"$0" : 'X\(//\)$' \| \ ++ X"$0" : 'X\(/\)' \| \ ++ . : '\(.\)' 2>/dev/null || + echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } +@@ -961,9 +962,9 @@ + cat <<_ACEOF + Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX +- [$ac_default_prefix] ++ [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX +- [PREFIX] ++ [PREFIX] + + By default, \`make install' will install all the files in + \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +@@ -1071,12 +1072,45 @@ + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; + esac +-# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +-# absolute. +-ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +-ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` +-ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +-ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` ++ ++# Do not use `cd foo && pwd` to compute absolute paths, because ++# the directories may not exist. ++case `pwd` in ++.) ac_abs_builddir="$ac_dir";; ++*) ++ case "$ac_dir" in ++ .) ac_abs_builddir=`pwd`;; ++ [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; ++ *) ac_abs_builddir=`pwd`/"$ac_dir";; ++ esac;; ++esac ++case $ac_abs_builddir in ++.) ac_abs_top_builddir=${ac_top_builddir}.;; ++*) ++ case ${ac_top_builddir}. in ++ .) ac_abs_top_builddir=$ac_abs_builddir;; ++ [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; ++ *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; ++ esac;; ++esac ++case $ac_abs_builddir in ++.) ac_abs_srcdir=$ac_srcdir;; ++*) ++ case $ac_srcdir in ++ .) ac_abs_srcdir=$ac_abs_builddir;; ++ [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; ++ *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; ++ esac;; ++esac ++case $ac_abs_builddir in ++.) ac_abs_top_srcdir=$ac_top_srcdir;; ++*) ++ case $ac_top_srcdir in ++ .) ac_abs_top_srcdir=$ac_abs_builddir;; ++ [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; ++ *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; ++ esac;; ++esac + + cd $ac_dir + # Check for guested configure; otherwise get Cygnus style configure. +@@ -1087,13 +1121,13 @@ + echo + $SHELL $ac_srcdir/configure --help=recursive + elif test -f $ac_srcdir/configure.ac || +- test -f $ac_srcdir/configure.in; then ++ test -f $ac_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi +- cd $ac_popdir ++ cd "$ac_popdir" + done + fi + +@@ -1101,8 +1135,7 @@ + if $ac_init_version; then + cat <<\_ACEOF + +-Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 +-Free Software Foundation, Inc. ++Copyright (C) 2003 Free Software Foundation, Inc. + This configure script is free software; the Free Software Foundation + gives unlimited permission to copy, distribute and modify it. + _ACEOF +@@ -1114,7 +1147,7 @@ + running configure, to aid debugging if configure makes a mistake. + + It was created by $as_me, which was +-generated by GNU Autoconf 2.57. Invocation command line was ++generated by GNU Autoconf 2.59. Invocation command line was + + $ $0 $@ + +@@ -1191,19 +1224,19 @@ + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then +- ac_must_keep_next=false # Got value, back to normal. ++ ac_must_keep_next=false # Got value, back to normal. + else +- case $ac_arg in +- *=* | --config-cache | -C | -disable-* | --disable-* \ +- | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ +- | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ +- | -with-* | --with-* | -without-* | --without-* | --x) +- case "$ac_configure_args0 " in +- "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; +- esac +- ;; +- -* ) ac_must_keep_next=true ;; +- esac ++ case $ac_arg in ++ *=* | --config-cache | -C | -disable-* | --disable-* \ ++ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ ++ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ ++ | -with-* | --with-* | -without-* | --without-* | --x) ++ case "$ac_configure_args0 " in ++ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; ++ esac ++ ;; ++ -* ) ac_must_keep_next=true ;; ++ esac + fi + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + # Get rid of the leading space. +@@ -1237,12 +1270,12 @@ + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ +- "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; +- s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ++ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; ++ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ +- "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ++ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; + } +@@ -1271,7 +1304,7 @@ + for ac_var in $ac_subst_files + do + eval ac_val=$`echo $ac_var` +- echo "$ac_var='"'"'$ac_val'"'"'" ++ echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + fi +@@ -1370,7 +1403,7 @@ + # value. + ac_cache_corrupted=false + for ac_var in `(set) 2>&1 | +- sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do ++ sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" +@@ -1387,13 +1420,13 @@ + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then +- { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 ++ { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 + echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} +- { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 ++ { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 + echo "$as_me: former value: $ac_old_val" >&2;} +- { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 ++ { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 + echo "$as_me: current value: $ac_new_val" >&2;} +- ac_cache_corrupted=: ++ ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. +@@ -1567,6 +1600,7 @@ + # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag + # AFS /usr/afsws/bin/install, which mishandles nonexistent args + # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" ++# OS/2's system install, which has a completely different semantic + # ./install, which can be erroneously created by make from ./install.sh. + echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 + echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 +@@ -1583,6 +1617,7 @@ + case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ++ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. +@@ -1590,20 +1625,20 @@ + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do +- if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then +- if test $ac_prog = install && +- grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then +- # AIX install. It has an incompatible calling convention. +- : +- elif test $ac_prog = install && +- grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then +- # program-specific install script used by HP pwplus--don't use. +- : +- else +- ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" +- break 3 +- fi +- fi ++ if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then ++ if test $ac_prog = install && ++ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then ++ # AIX install. It has an incompatible calling convention. ++ : ++ elif test $ac_prog = install && ++ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then ++ # program-specific install script used by HP pwplus--don't use. ++ : ++ else ++ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" ++ break 3 ++ fi ++ fi + done + done + ;; +@@ -1693,7 +1728,7 @@ + + echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 + echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 +-set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` ++set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` + if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 + else +@@ -2163,7 +2198,6 @@ + (exit $ac_status); } + + cat >conftest.$ac_ext <<_ACEOF +-#line $LINENO "configure" + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext +@@ -2183,8 +2217,8 @@ + # Try to create an executable without -o first, disregard a.out. + # It will help us diagnose broken compilers, and finding out an intuition + # of exeext. +-echo "$as_me:$LINENO: checking for C compiler default output" >&5 +-echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 ++echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 ++echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 + ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 +@@ -2204,23 +2238,23 @@ + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) +- ;; ++ ;; + conftest.$ac_ext ) +- # This is the source file. +- ;; ++ # This is the source file. ++ ;; + [ab].out ) +- # We found the default executable, but exeext='' is most +- # certainly right. +- break;; ++ # We found the default executable, but exeext='' is most ++ # certainly right. ++ break;; + *.* ) +- ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` +- # FIXME: I believe we export ac_cv_exeext for Libtool, +- # but it would be cool to find out if it's true. Does anybody +- # maintain Libtool? --akim. +- export ac_cv_exeext +- break;; ++ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` ++ # FIXME: I believe we export ac_cv_exeext for Libtool, ++ # but it would be cool to find out if it's true. Does anybody ++ # maintain Libtool? --akim. ++ export ac_cv_exeext ++ break;; + * ) +- break;; ++ break;; + esac + done + else +@@ -2294,8 +2328,8 @@ + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` +- export ac_cv_exeext +- break;; ++ export ac_cv_exeext ++ break;; + * ) break;; + esac + done +@@ -2320,7 +2354,6 @@ + echo $ECHO_N "(cached) $ECHO_C" >&6 + else + cat >conftest.$ac_ext <<_ACEOF +-#line $LINENO "configure" + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext +@@ -2371,7 +2404,6 @@ + echo $ECHO_N "(cached) $ECHO_C" >&6 + else + cat >conftest.$ac_ext <<_ACEOF +-#line $LINENO "configure" + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext +@@ -2391,11 +2423,20 @@ + _ACEOF + rm -f conftest.$ac_objext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 +- (eval $ac_compile) 2>&5 ++ (eval $ac_compile) 2>conftest.er1 + ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -s conftest.$ac_objext' ++ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -2408,7 +2449,7 @@ + + ac_compiler_gnu=no + fi +-rm -f conftest.$ac_objext conftest.$ac_ext ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_c_compiler_gnu=$ac_compiler_gnu + + fi +@@ -2424,7 +2465,6 @@ + echo $ECHO_N "(cached) $ECHO_C" >&6 + else + cat >conftest.$ac_ext <<_ACEOF +-#line $LINENO "configure" + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext +@@ -2441,11 +2481,20 @@ + _ACEOF + rm -f conftest.$ac_objext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 +- (eval $ac_compile) 2>&5 ++ (eval $ac_compile) 2>conftest.er1 + ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -s conftest.$ac_objext' ++ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -2458,7 +2507,7 @@ + + ac_cv_prog_cc_g=no + fi +-rm -f conftest.$ac_objext conftest.$ac_ext ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + fi + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 + echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +@@ -2485,7 +2534,6 @@ + ac_cv_prog_cc_stdc=no + ac_save_CC=$CC + cat >conftest.$ac_ext <<_ACEOF +-#line $LINENO "configure" + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext +@@ -2513,6 +2561,16 @@ + va_end (v); + return s; + } ++ ++/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has ++ function prototypes and stuff, but not '\xHH' hex character constants. ++ These don't provoke an error unfortunately, instead are silently treated ++ as 'x'. The following induces an error, until -std1 is added to get ++ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an ++ array size at least. It's necessary to write '\x00'==0 to get something ++ that's true only with -std1. */ ++int osf4_cc_array ['\x00' == 0 ? 1 : -1]; ++ + int test (int i, double x); + struct s1 {int (*f) (int a);}; + struct s2 {int (*f) (double a);}; +@@ -2539,11 +2597,20 @@ + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 +- (eval $ac_compile) 2>&5 ++ (eval $ac_compile) 2>conftest.er1 + ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -s conftest.$ac_objext' ++ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -2556,7 +2623,7 @@ + sed 's/^/| /' conftest.$ac_ext >&5 + + fi +-rm -f conftest.$ac_objext ++rm -f conftest.err conftest.$ac_objext + done + rm -f conftest.$ac_ext conftest.$ac_objext + CC=$ac_save_CC +@@ -2584,11 +2651,20 @@ + _ACEOF + rm -f conftest.$ac_objext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 +- (eval $ac_compile) 2>&5 ++ (eval $ac_compile) 2>conftest.er1 + ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -s conftest.$ac_objext' ++ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -2603,7 +2679,6 @@ + 'void exit (int);' + do + cat >conftest.$ac_ext <<_ACEOF +-#line $LINENO "configure" + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext +@@ -2621,11 +2696,20 @@ + _ACEOF + rm -f conftest.$ac_objext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 +- (eval $ac_compile) 2>&5 ++ (eval $ac_compile) 2>conftest.er1 + ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -s conftest.$ac_objext' ++ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -2638,9 +2722,8 @@ + + continue + fi +-rm -f conftest.$ac_objext conftest.$ac_ext ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +-#line $LINENO "configure" + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext +@@ -2657,11 +2740,20 @@ + _ACEOF + rm -f conftest.$ac_objext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 +- (eval $ac_compile) 2>&5 ++ (eval $ac_compile) 2>conftest.er1 + ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -s conftest.$ac_objext' ++ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -2673,7 +2765,7 @@ + sed 's/^/| /' conftest.$ac_ext >&5 + + fi +-rm -f conftest.$ac_objext conftest.$ac_ext ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done + rm -f conftest* + if test -n "$ac_declaration"; then +@@ -2687,7 +2779,7 @@ + sed 's/^/| /' conftest.$ac_ext >&5 + + fi +-rm -f conftest.$ac_objext conftest.$ac_ext ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + ac_ext=c + ac_cpp='$CPP $CPPFLAGS' + ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +@@ -2788,7 +2880,6 @@ + ac_check_lib_save_LIBS=$LIBS + LIBS="-lfl $LIBS" + cat >conftest.$ac_ext <<_ACEOF +-#line $LINENO "configure" + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext +@@ -2812,11 +2903,20 @@ + _ACEOF + rm -f conftest.$ac_objext conftest$ac_exeext + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 +- (eval $ac_link) 2>&5 ++ (eval $ac_link) 2>conftest.er1 + ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -s conftest$ac_exeext' ++ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -2829,7 +2929,8 @@ + + ac_cv_lib_fl_yywrap=no + fi +-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext ++rm -f conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext conftest.$ac_ext + LIBS=$ac_check_lib_save_LIBS + fi + echo "$as_me:$LINENO: result: $ac_cv_lib_fl_yywrap" >&5 +@@ -2845,7 +2946,6 @@ + ac_check_lib_save_LIBS=$LIBS + LIBS="-ll $LIBS" + cat >conftest.$ac_ext <<_ACEOF +-#line $LINENO "configure" + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext +@@ -2869,11 +2969,20 @@ + _ACEOF + rm -f conftest.$ac_objext conftest$ac_exeext + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 +- (eval $ac_link) 2>&5 ++ (eval $ac_link) 2>conftest.er1 + ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -s conftest$ac_exeext' ++ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -2886,7 +2995,8 @@ + + ac_cv_lib_l_yywrap=no + fi +-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext ++rm -f conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext conftest.$ac_ext + LIBS=$ac_check_lib_save_LIBS + fi + echo "$as_me:$LINENO: result: $ac_cv_lib_l_yywrap" >&5 +@@ -2948,11 +3058,20 @@ + _ACEOF + rm -f conftest.$ac_objext conftest$ac_exeext + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 +- (eval $ac_link) 2>&5 ++ (eval $ac_link) 2>conftest.er1 + ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -s conftest$ac_exeext' ++ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -2964,7 +3083,8 @@ + sed 's/^/| /' conftest.$ac_ext >&5 + + fi +-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext ++rm -f conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext conftest.$ac_ext + LIBS=$ac_save_LIBS + rm -f "${LEX_OUTPUT_ROOT}.c" + +@@ -3033,6 +3153,7 @@ + # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag + # AFS /usr/afsws/bin/install, which mishandles nonexistent args + # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" ++# OS/2's system install, which has a completely different semantic + # ./install, which can be erroneously created by make from ./install.sh. + echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 + echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 +@@ -3049,6 +3170,7 @@ + case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ++ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. +@@ -3056,20 +3178,20 @@ + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do +- if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then +- if test $ac_prog = install && +- grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then +- # AIX install. It has an incompatible calling convention. +- : +- elif test $ac_prog = install && +- grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then +- # program-specific install script used by HP pwplus--don't use. +- : +- else +- ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" +- break 3 +- fi +- fi ++ if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then ++ if test $ac_prog = install && ++ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then ++ # AIX install. It has an incompatible calling convention. ++ : ++ elif test $ac_prog = install && ++ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then ++ # program-specific install script used by HP pwplus--don't use. ++ : ++ else ++ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" ++ break 3 ++ fi ++ fi + done + done + ;; +@@ -3842,7 +3964,6 @@ + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +-#line $LINENO "configure" + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext +@@ -3853,7 +3974,7 @@ + #else + # include <assert.h> + #endif +- Syntax error ++ Syntax error + _ACEOF + if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 +@@ -3865,6 +3986,7 @@ + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag ++ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +@@ -3885,7 +4007,6 @@ + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +-#line $LINENO "configure" + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext +@@ -3903,6 +4024,7 @@ + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag ++ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +@@ -3949,7 +4071,6 @@ + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +-#line $LINENO "configure" + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext +@@ -3960,7 +4081,7 @@ + #else + # include <assert.h> + #endif +- Syntax error ++ Syntax error + _ACEOF + if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 +@@ -3972,6 +4093,7 @@ + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag ++ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +@@ -3992,7 +4114,6 @@ + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +-#line $LINENO "configure" + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext +@@ -4010,6 +4131,7 @@ + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag ++ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +@@ -4070,7 +4192,6 @@ + echo $ECHO_N "(cached) $ECHO_C" >&6 + else + cat >conftest.$ac_ext <<_ACEOF +-#line $LINENO "configure" + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext +@@ -4091,11 +4212,20 @@ + _ACEOF + rm -f conftest.$ac_objext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 +- (eval $ac_compile) 2>&5 ++ (eval $ac_compile) 2>conftest.er1 + ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -s conftest.$ac_objext' ++ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -4108,12 +4238,11 @@ + + ac_cv_header_stdc=no + fi +-rm -f conftest.$ac_objext conftest.$ac_ext ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + + if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +-#line $LINENO "configure" + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext +@@ -4135,7 +4264,6 @@ + if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +-#line $LINENO "configure" + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext +@@ -4160,7 +4288,6 @@ + : + else + cat >conftest.$ac_ext <<_ACEOF +-#line $LINENO "configure" + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext +@@ -4172,9 +4299,9 @@ + # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) + #else + # define ISLOWER(c) \ +- (('a' <= (c) && (c) <= 'i') \ +- || ('j' <= (c) && (c) <= 'r') \ +- || ('s' <= (c) && (c) <= 'z')) ++ (('a' <= (c) && (c) <= 'i') \ ++ || ('j' <= (c) && (c) <= 'r') \ ++ || ('s' <= (c) && (c) <= 'z')) + # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) + #endif + +@@ -4185,7 +4312,7 @@ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) +- || toupper (i) != TOUPPER (i)) ++ || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); + } +@@ -4235,7 +4362,7 @@ + + + for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ +- inttypes.h stdint.h unistd.h ++ inttypes.h stdint.h unistd.h + do + as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` + echo "$as_me:$LINENO: checking for $ac_header" >&5 +@@ -4244,7 +4371,6 @@ + echo $ECHO_N "(cached) $ECHO_C" >&6 + else + cat >conftest.$ac_ext <<_ACEOF +-#line $LINENO "configure" + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext +@@ -4256,11 +4382,20 @@ + _ACEOF + rm -f conftest.$ac_objext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 +- (eval $ac_compile) 2>&5 ++ (eval $ac_compile) 2>conftest.er1 + ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -s conftest.$ac_objext' ++ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -4273,7 +4408,7 @@ + + eval "$as_ac_Header=no" + fi +-rm -f conftest.$ac_objext conftest.$ac_ext ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + fi + echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 + echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +@@ -4304,7 +4439,6 @@ + echo "$as_me:$LINENO: checking $ac_header usability" >&5 + echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +-#line $LINENO "configure" + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext +@@ -4315,11 +4449,20 @@ + _ACEOF + rm -f conftest.$ac_objext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 +- (eval $ac_compile) 2>&5 ++ (eval $ac_compile) 2>conftest.er1 + ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -s conftest.$ac_objext' ++ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -4332,7 +4475,7 @@ + + ac_header_compiler=no + fi +-rm -f conftest.$ac_objext conftest.$ac_ext ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 + echo "${ECHO_T}$ac_header_compiler" >&6 + +@@ -4340,7 +4483,6 @@ + echo "$as_me:$LINENO: checking $ac_header presence" >&5 + echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +-#line $LINENO "configure" + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext +@@ -4358,6 +4500,7 @@ + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag ++ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +@@ -4377,33 +4520,32 @@ + echo "${ECHO_T}$ac_header_preproc" >&6 + + # So? What about this header? +-case $ac_header_compiler:$ac_header_preproc in +- yes:no ) ++case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in ++ yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 + echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} +- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} +- ( +- cat <<\_ASBOX +-## ------------------------------------ ## +-## Report this to bug-autoconf@gnu.org. ## +-## ------------------------------------ ## +-_ASBOX +- ) | +- sed "s/^/$as_me: WARNING: /" >&2 ++ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 ++echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ++ ac_header_preproc=yes + ;; +- no:yes ) ++ no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 + echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} +- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} ++ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 ++echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} ++ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 ++echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} ++ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 ++echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 + echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} ++ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 ++echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +-## ------------------------------------ ## +-## Report this to bug-autoconf@gnu.org. ## +-## ------------------------------------ ## ++## ------------------------------------------ ## ++## Report this to the AC_PACKAGE_NAME lists. ## ++## ------------------------------------------ ## + _ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 +@@ -4414,7 +4556,7 @@ + if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 + else +- eval "$as_ac_Header=$ac_header_preproc" ++ eval "$as_ac_Header=\$ac_header_preproc" + fi + echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 + echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +@@ -4749,7 +4891,7 @@ + case $host in + *-*-irix6*) + # Find out which ABI we are using. +- echo '#line 4752 "configure"' > conftest.$ac_ext ++ echo '#line 4894 "configure"' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? +@@ -4788,7 +4930,6 @@ + ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat >conftest.$ac_ext <<_ACEOF +-#line $LINENO "configure" + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext +@@ -4805,11 +4946,20 @@ + _ACEOF + rm -f conftest.$ac_objext conftest$ac_exeext + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 +- (eval $ac_link) 2>&5 ++ (eval $ac_link) 2>conftest.er1 + ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -s conftest$ac_exeext' ++ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -4822,7 +4972,8 @@ + + lt_cv_cc_needs_belf=no + fi +-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext ++rm -f conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext conftest.$ac_ext + ac_ext=c + ac_cpp='$CPP $CPPFLAGS' + ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +@@ -5117,7 +5268,6 @@ + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC" + cat >conftest.$ac_ext <<_ACEOF +-#line $LINENO "configure" + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext +@@ -5134,11 +5284,20 @@ + _ACEOF + rm -f conftest.$ac_objext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 +- (eval $ac_compile) 2>&5 ++ (eval $ac_compile) 2>conftest.er1 + ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -s conftest.$ac_objext' ++ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -5167,7 +5326,7 @@ + lt_cv_prog_cc_pic_works=no + + fi +-rm -f conftest.$ac_objext conftest.$ac_ext ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + + fi +@@ -5205,7 +5364,6 @@ + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static" + cat >conftest.$ac_ext <<_ACEOF +-#line $LINENO "configure" + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext +@@ -5222,11 +5380,20 @@ + _ACEOF + rm -f conftest.$ac_objext conftest$ac_exeext + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 +- (eval $ac_link) 2>&5 ++ (eval $ac_link) 2>conftest.er1 + ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -s conftest$ac_exeext' ++ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -5238,7 +5405,8 @@ + sed 's/^/| /' conftest.$ac_ext >&5 + + fi +-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext ++rm -f conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" + + fi +@@ -5278,7 +5446,7 @@ + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" + compiler_c_o=no +-if { (eval echo configure:5281: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then ++if { (eval echo configure:5449: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s out/conftest.err; then +@@ -5319,7 +5487,6 @@ + save_objext="$ac_objext" + ac_objext=lo + cat >conftest.$ac_ext <<_ACEOF +-#line $LINENO "configure" + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext +@@ -5336,11 +5503,20 @@ + _ACEOF + rm -f conftest.$ac_objext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 +- (eval $ac_compile) 2>&5 ++ (eval $ac_compile) 2>conftest.er1 + ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -s conftest.$ac_objext' ++ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -5359,7 +5535,7 @@ + sed 's/^/| /' conftest.$ac_ext >&5 + + fi +-rm -f conftest.$ac_objext conftest.$ac_ext ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + ac_objext="$save_objext" + CFLAGS="$save_CFLAGS" + +@@ -5404,7 +5580,6 @@ + CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext" + compiler_rtti_exceptions=no + cat >conftest.$ac_ext <<_ACEOF +-#line $LINENO "configure" + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext +@@ -5421,11 +5596,20 @@ + _ACEOF + rm -f conftest.$ac_objext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 +- (eval $ac_compile) 2>&5 ++ (eval $ac_compile) 2>conftest.er1 + ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -s conftest.$ac_objext' ++ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -5444,7 +5628,7 @@ + sed 's/^/| /' conftest.$ac_ext >&5 + + fi +-rm -f conftest.$ac_objext conftest.$ac_ext ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + echo "$as_me:$LINENO: result: $compiler_rtti_exceptions" >&5 + echo "${ECHO_T}$compiler_rtti_exceptions" >&6 +@@ -6704,21 +6888,28 @@ + echo $ECHO_N "(cached) $ECHO_C" >&6 + else + cat >conftest.$ac_ext <<_ACEOF +-#line $LINENO "configure" + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext + cat >>conftest.$ac_ext <<_ACEOF + /* end confdefs.h. */ ++/* Define shl_load to an innocuous variant, in case <limits.h> declares shl_load. ++ For example, HP-UX 11i <limits.h> declares gettimeofday. */ ++#define shl_load innocuous_shl_load ++ + /* System header to define __stub macros and hopefully few prototypes, + which can conflict with char shl_load (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ ++ + #ifdef __STDC__ + # include <limits.h> + #else + # include <assert.h> + #endif ++ ++#undef shl_load ++ + /* Override any gcc2 internal prototype to avoid an error. */ + #ifdef __cplusplus + extern "C" +@@ -6749,11 +6940,20 @@ + _ACEOF + rm -f conftest.$ac_objext conftest$ac_exeext + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 +- (eval $ac_link) 2>&5 ++ (eval $ac_link) 2>conftest.er1 + ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -s conftest$ac_exeext' ++ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -6766,7 +6966,8 @@ + + ac_cv_func_shl_load=no + fi +-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext ++rm -f conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext conftest.$ac_ext + fi + echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 + echo "${ECHO_T}$ac_cv_func_shl_load" >&6 +@@ -6781,7 +6982,6 @@ + ac_check_lib_save_LIBS=$LIBS + LIBS="-ldld $LIBS" + cat >conftest.$ac_ext <<_ACEOF +-#line $LINENO "configure" + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext +@@ -6805,11 +7005,20 @@ + _ACEOF + rm -f conftest.$ac_objext conftest$ac_exeext + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 +- (eval $ac_link) 2>&5 ++ (eval $ac_link) 2>conftest.er1 + ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -s conftest$ac_exeext' ++ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -6822,7 +7031,8 @@ + + ac_cv_lib_dld_shl_load=no + fi +-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext ++rm -f conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext conftest.$ac_ext + LIBS=$ac_check_lib_save_LIBS + fi + echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 +@@ -6836,21 +7046,28 @@ + echo $ECHO_N "(cached) $ECHO_C" >&6 + else + cat >conftest.$ac_ext <<_ACEOF +-#line $LINENO "configure" + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext + cat >>conftest.$ac_ext <<_ACEOF + /* end confdefs.h. */ ++/* Define dlopen to an innocuous variant, in case <limits.h> declares dlopen. ++ For example, HP-UX 11i <limits.h> declares gettimeofday. */ ++#define dlopen innocuous_dlopen ++ + /* System header to define __stub macros and hopefully few prototypes, + which can conflict with char dlopen (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ ++ + #ifdef __STDC__ + # include <limits.h> + #else + # include <assert.h> + #endif ++ ++#undef dlopen ++ + /* Override any gcc2 internal prototype to avoid an error. */ + #ifdef __cplusplus + extern "C" +@@ -6881,11 +7098,20 @@ + _ACEOF + rm -f conftest.$ac_objext conftest$ac_exeext + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 +- (eval $ac_link) 2>&5 ++ (eval $ac_link) 2>conftest.er1 + ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -s conftest$ac_exeext' ++ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -6898,7 +7124,8 @@ + + ac_cv_func_dlopen=no + fi +-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext ++rm -f conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext conftest.$ac_ext + fi + echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 + echo "${ECHO_T}$ac_cv_func_dlopen" >&6 +@@ -6913,7 +7140,6 @@ + ac_check_lib_save_LIBS=$LIBS + LIBS="-ldl $LIBS" + cat >conftest.$ac_ext <<_ACEOF +-#line $LINENO "configure" + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext +@@ -6937,11 +7163,20 @@ + _ACEOF + rm -f conftest.$ac_objext conftest$ac_exeext + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 +- (eval $ac_link) 2>&5 ++ (eval $ac_link) 2>conftest.er1 + ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -s conftest$ac_exeext' ++ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -6954,7 +7189,8 @@ + + ac_cv_lib_dl_dlopen=no + fi +-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext ++rm -f conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext conftest.$ac_ext + LIBS=$ac_check_lib_save_LIBS + fi + echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +@@ -6970,7 +7206,6 @@ + ac_check_lib_save_LIBS=$LIBS + LIBS="-lsvld $LIBS" + cat >conftest.$ac_ext <<_ACEOF +-#line $LINENO "configure" + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext +@@ -6994,11 +7229,20 @@ + _ACEOF + rm -f conftest.$ac_objext conftest$ac_exeext + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 +- (eval $ac_link) 2>&5 ++ (eval $ac_link) 2>conftest.er1 + ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -s conftest$ac_exeext' ++ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -7011,7 +7255,8 @@ + + ac_cv_lib_svld_dlopen=no + fi +-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext ++rm -f conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext conftest.$ac_ext + LIBS=$ac_check_lib_save_LIBS + fi + echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 +@@ -7027,7 +7272,6 @@ + ac_check_lib_save_LIBS=$LIBS + LIBS="-ldld $LIBS" + cat >conftest.$ac_ext <<_ACEOF +-#line $LINENO "configure" + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext +@@ -7051,11 +7295,20 @@ + _ACEOF + rm -f conftest.$ac_objext conftest$ac_exeext + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 +- (eval $ac_link) 2>&5 ++ (eval $ac_link) 2>conftest.er1 + ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -s conftest$ac_exeext' ++ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -7068,7 +7321,8 @@ + + ac_cv_lib_dld_dld_link=no + fi +-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext ++rm -f conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext conftest.$ac_ext + LIBS=$ac_check_lib_save_LIBS + fi + echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 +@@ -7123,7 +7377,7 @@ + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<EOF +-#line 7126 "configure" ++#line 7380 "configure" + #include "confdefs.h" + + #if HAVE_DLFCN_H +@@ -7221,7 +7475,7 @@ + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<EOF +-#line 7224 "configure" ++#line 7478 "configure" + #include "confdefs.h" + + #if HAVE_DLFCN_H +@@ -8005,7 +8259,6 @@ + echo "$as_me:$LINENO: checking asm/errno.h usability" >&5 + echo $ECHO_N "checking asm/errno.h usability... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +-#line $LINENO "configure" + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext +@@ -8016,11 +8269,20 @@ + _ACEOF + rm -f conftest.$ac_objext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 +- (eval $ac_compile) 2>&5 ++ (eval $ac_compile) 2>conftest.er1 + ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -s conftest.$ac_objext' ++ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -8033,7 +8295,7 @@ + + ac_header_compiler=no + fi +-rm -f conftest.$ac_objext conftest.$ac_ext ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 + echo "${ECHO_T}$ac_header_compiler" >&6 + +@@ -8041,7 +8303,6 @@ + echo "$as_me:$LINENO: checking asm/errno.h presence" >&5 + echo $ECHO_N "checking asm/errno.h presence... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +-#line $LINENO "configure" + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext +@@ -8059,6 +8320,7 @@ + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag ++ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +@@ -8078,33 +8340,32 @@ + echo "${ECHO_T}$ac_header_preproc" >&6 + + # So? What about this header? +-case $ac_header_compiler:$ac_header_preproc in +- yes:no ) ++case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in ++ yes:no: ) + { echo "$as_me:$LINENO: WARNING: asm/errno.h: accepted by the compiler, rejected by the preprocessor!" >&5 + echo "$as_me: WARNING: asm/errno.h: accepted by the compiler, rejected by the preprocessor!" >&2;} +- { echo "$as_me:$LINENO: WARNING: asm/errno.h: proceeding with the preprocessor's result" >&5 +-echo "$as_me: WARNING: asm/errno.h: proceeding with the preprocessor's result" >&2;} +- ( +- cat <<\_ASBOX +-## ------------------------------------ ## +-## Report this to bug-autoconf@gnu.org. ## +-## ------------------------------------ ## +-_ASBOX +- ) | +- sed "s/^/$as_me: WARNING: /" >&2 ++ { echo "$as_me:$LINENO: WARNING: asm/errno.h: proceeding with the compiler's result" >&5 ++echo "$as_me: WARNING: asm/errno.h: proceeding with the compiler's result" >&2;} ++ ac_header_preproc=yes + ;; +- no:yes ) ++ no:yes:* ) + { echo "$as_me:$LINENO: WARNING: asm/errno.h: present but cannot be compiled" >&5 + echo "$as_me: WARNING: asm/errno.h: present but cannot be compiled" >&2;} +- { echo "$as_me:$LINENO: WARNING: asm/errno.h: check for missing prerequisite headers?" >&5 +-echo "$as_me: WARNING: asm/errno.h: check for missing prerequisite headers?" >&2;} ++ { echo "$as_me:$LINENO: WARNING: asm/errno.h: check for missing prerequisite headers?" >&5 ++echo "$as_me: WARNING: asm/errno.h: check for missing prerequisite headers?" >&2;} ++ { echo "$as_me:$LINENO: WARNING: asm/errno.h: see the Autoconf documentation" >&5 ++echo "$as_me: WARNING: asm/errno.h: see the Autoconf documentation" >&2;} ++ { echo "$as_me:$LINENO: WARNING: asm/errno.h: section \"Present But Cannot Be Compiled\"" >&5 ++echo "$as_me: WARNING: asm/errno.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: asm/errno.h: proceeding with the preprocessor's result" >&5 + echo "$as_me: WARNING: asm/errno.h: proceeding with the preprocessor's result" >&2;} ++ { echo "$as_me:$LINENO: WARNING: asm/errno.h: in the future, the compiler will take precedence" >&5 ++echo "$as_me: WARNING: asm/errno.h: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +-## ------------------------------------ ## +-## Report this to bug-autoconf@gnu.org. ## +-## ------------------------------------ ## ++## ------------------------------------------ ## ++## Report this to the AC_PACKAGE_NAME lists. ## ++## ------------------------------------------ ## + _ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 +@@ -8145,7 +8406,6 @@ + echo "$as_me:$LINENO: checking linux/atmsap.h usability" >&5 + echo $ECHO_N "checking linux/atmsap.h usability... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +-#line $LINENO "configure" + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext +@@ -8156,11 +8416,20 @@ + _ACEOF + rm -f conftest.$ac_objext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 +- (eval $ac_compile) 2>&5 ++ (eval $ac_compile) 2>conftest.er1 + ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -s conftest.$ac_objext' ++ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -8173,7 +8442,7 @@ + + ac_header_compiler=no + fi +-rm -f conftest.$ac_objext conftest.$ac_ext ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 + echo "${ECHO_T}$ac_header_compiler" >&6 + +@@ -8181,7 +8450,6 @@ + echo "$as_me:$LINENO: checking linux/atmsap.h presence" >&5 + echo $ECHO_N "checking linux/atmsap.h presence... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +-#line $LINENO "configure" + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext +@@ -8199,6 +8467,7 @@ + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag ++ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +@@ -8218,33 +8487,32 @@ + echo "${ECHO_T}$ac_header_preproc" >&6 + + # So? What about this header? +-case $ac_header_compiler:$ac_header_preproc in +- yes:no ) ++case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in ++ yes:no: ) + { echo "$as_me:$LINENO: WARNING: linux/atmsap.h: accepted by the compiler, rejected by the preprocessor!" >&5 + echo "$as_me: WARNING: linux/atmsap.h: accepted by the compiler, rejected by the preprocessor!" >&2;} +- { echo "$as_me:$LINENO: WARNING: linux/atmsap.h: proceeding with the preprocessor's result" >&5 +-echo "$as_me: WARNING: linux/atmsap.h: proceeding with the preprocessor's result" >&2;} +- ( +- cat <<\_ASBOX +-## ------------------------------------ ## +-## Report this to bug-autoconf@gnu.org. ## +-## ------------------------------------ ## +-_ASBOX +- ) | +- sed "s/^/$as_me: WARNING: /" >&2 ++ { echo "$as_me:$LINENO: WARNING: linux/atmsap.h: proceeding with the compiler's result" >&5 ++echo "$as_me: WARNING: linux/atmsap.h: proceeding with the compiler's result" >&2;} ++ ac_header_preproc=yes + ;; +- no:yes ) ++ no:yes:* ) + { echo "$as_me:$LINENO: WARNING: linux/atmsap.h: present but cannot be compiled" >&5 + echo "$as_me: WARNING: linux/atmsap.h: present but cannot be compiled" >&2;} +- { echo "$as_me:$LINENO: WARNING: linux/atmsap.h: check for missing prerequisite headers?" >&5 +-echo "$as_me: WARNING: linux/atmsap.h: check for missing prerequisite headers?" >&2;} ++ { echo "$as_me:$LINENO: WARNING: linux/atmsap.h: check for missing prerequisite headers?" >&5 ++echo "$as_me: WARNING: linux/atmsap.h: check for missing prerequisite headers?" >&2;} ++ { echo "$as_me:$LINENO: WARNING: linux/atmsap.h: see the Autoconf documentation" >&5 ++echo "$as_me: WARNING: linux/atmsap.h: see the Autoconf documentation" >&2;} ++ { echo "$as_me:$LINENO: WARNING: linux/atmsap.h: section \"Present But Cannot Be Compiled\"" >&5 ++echo "$as_me: WARNING: linux/atmsap.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: linux/atmsap.h: proceeding with the preprocessor's result" >&5 + echo "$as_me: WARNING: linux/atmsap.h: proceeding with the preprocessor's result" >&2;} ++ { echo "$as_me:$LINENO: WARNING: linux/atmsap.h: in the future, the compiler will take precedence" >&5 ++echo "$as_me: WARNING: linux/atmsap.h: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +-## ------------------------------------ ## +-## Report this to bug-autoconf@gnu.org. ## +-## ------------------------------------ ## ++## ------------------------------------------ ## ++## Report this to the AC_PACKAGE_NAME lists. ## ++## ------------------------------------------ ## + _ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 +@@ -8281,7 +8549,6 @@ + ac_check_lib_save_LIBS=$LIBS + LIBS="-lresolv $LIBS" + cat >conftest.$ac_ext <<_ACEOF +-#line $LINENO "configure" + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext +@@ -8299,11 +8566,20 @@ + _ACEOF + rm -f conftest.$ac_objext conftest$ac_exeext + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 +- (eval $ac_link) 2>&5 ++ (eval $ac_link) 2>conftest.er1 + ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -s conftest$ac_exeext' ++ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -8316,7 +8592,8 @@ + + ac_cv_lib_resolv_main=no + fi +-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext ++rm -f conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext conftest.$ac_ext + LIBS=$ac_check_lib_save_LIBS + fi + echo "$as_me:$LINENO: result: $ac_cv_lib_resolv_main" >&5 +@@ -8477,7 +8754,6 @@ + ac_check_lib_save_LIBS=$LIBS + LIBS="-lmpr $LIBS" + cat >conftest.$ac_ext <<_ACEOF +-#line $LINENO "configure" + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext +@@ -8495,11 +8771,20 @@ + _ACEOF + rm -f conftest.$ac_objext conftest$ac_exeext + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 +- (eval $ac_link) 2>&5 ++ (eval $ac_link) 2>conftest.er1 + ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && +- { ac_try='test -s conftest$ac_exeext' ++ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? +@@ -8512,7 +8797,8 @@ + + ac_cv_lib_mpr_main=no + fi +-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext ++rm -f conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext conftest.$ac_ext + LIBS=$ac_check_lib_save_LIBS + fi + echo "$as_me:$LINENO: result: $ac_cv_lib_mpr_main" >&5 +@@ -8539,7 +8825,7 @@ + fi; + + +- ac_config_files="$ac_config_files Makefile doc/Makefile m4/Makefile src/Makefile src/include/Makefile src/lib/Makefile src/test/Makefile src/debug/Makefile src/qgen/Makefile src/saal/Makefile src/sigd/Makefile src/maint/Makefile src/arpd/Makefile src/ilmid/Makefile src/ilmid/asn1/Makefile src/man/Makefile src/led/Makefile src/lane/Makefile src/mpoad/Makefile src/switch/Makefile src/switch/debug/Makefile src/switch/tcp/Makefile src/config/Makefile src/config/init-redhat/Makefile src/extra/Makefile src/extra/linux-atm.spec src/extra/ANS/Makefile" ++ ac_config_files="$ac_config_files Makefile doc/Makefile m4/Makefile src/Makefile src/include/Makefile src/lib/Makefile src/br2684/Makefile" + cat >confcache <<\_ACEOF + # This file is a shell script that caches the results of configure + # tests run on this system so they can be shared between configure +@@ -8568,13 +8854,13 @@ + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ +- "s/'/'\\\\''/g; +- s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ++ "s/'/'\\\\''/g; ++ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ +- "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ++ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; + } | +@@ -8604,13 +8890,13 @@ + # trailing colons and then remove the whole line if VPATH becomes empty + # (actually we leave an empty line to preserve line numbers). + if test "x$srcdir" = x.; then +- ac_vpsub='/^[ ]*VPATH[ ]*=/{ ++ ac_vpsub='/^[ ]*VPATH[ ]*=/{ + s/:*\$(srcdir):*/:/; + s/:*\${srcdir}:*/:/; + s/:*@srcdir@:*/:/; +-s/^\([^=]*=[ ]*\):*/\1/; ++s/^\([^=]*=[ ]*\):*/\1/; + s/:*$//; +-s/^[^=]*=[ ]*$//; ++s/^[^=]*=[ ]*$//; + }' + fi + +@@ -8621,7 +8907,7 @@ + for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_i=`echo "$ac_i" | +- sed 's/\$U\././;s/\.o$//;s/\.obj$//'` ++ sed 's/\$U\././;s/\.o$//;s/\.obj$//'` + # 2. Add them. + ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' +@@ -8665,9 +8951,10 @@ + elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix + fi ++DUALCASE=1; export DUALCASE # for MKS sh + + # Support unset when possible. +-if (FOO=FOO; unset FOO) >/dev/null 2>&1; then ++if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset + else + as_unset=false +@@ -8686,7 +8973,7 @@ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME + do +- if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then ++ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var +@@ -8865,16 +9152,17 @@ + if mkdir -p . 2>/dev/null; then + as_mkdir_p=: + else ++ test -d ./-p && rmdir ./-p + as_mkdir_p=false + fi + + as_executable_p="test -f" + + # Sed expression to map a string onto a valid CPP name. +-as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" ++as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + + # Sed expression to map a string onto a valid variable name. +-as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" ++as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + + # IFS +@@ -8901,7 +9189,7 @@ + cat >&5 <<_CSEOF + + This file was extended by $as_me, which was +-generated by GNU Autoconf 2.57. Invocation command line was ++generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS +@@ -8945,9 +9233,9 @@ + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] +- instantiate the configuration file FILE ++ instantiate the configuration file FILE + --header=FILE[:TEMPLATE] +- instantiate the configuration header FILE ++ instantiate the configuration header FILE + + Configuration files: + $config_files +@@ -8964,11 +9252,10 @@ + cat >>$CONFIG_STATUS <<_ACEOF + ac_cs_version="\\ + config.status +-configured by $0, generated by GNU Autoconf 2.57, ++configured by $0, generated by GNU Autoconf 2.59, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +-Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +-Free Software Foundation, Inc. ++Copyright (C) 2003 Free Software Foundation, Inc. + This config.status script is free software; the Free Software Foundation + gives unlimited permission to copy, distribute and modify it." + srcdir=$srcdir +@@ -9080,27 +9367,7 @@ + "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; + "src/include/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/include/Makefile" ;; + "src/lib/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/lib/Makefile" ;; +- "src/test/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/test/Makefile" ;; +- "src/debug/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/debug/Makefile" ;; +- "src/qgen/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/qgen/Makefile" ;; +- "src/saal/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/saal/Makefile" ;; +- "src/sigd/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/sigd/Makefile" ;; +- "src/maint/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/maint/Makefile" ;; +- "src/arpd/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/arpd/Makefile" ;; +- "src/ilmid/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/ilmid/Makefile" ;; +- "src/ilmid/asn1/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/ilmid/asn1/Makefile" ;; +- "src/man/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/man/Makefile" ;; +- "src/led/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/led/Makefile" ;; +- "src/lane/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/lane/Makefile" ;; +- "src/mpoad/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/mpoad/Makefile" ;; +- "src/switch/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/switch/Makefile" ;; +- "src/switch/debug/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/switch/debug/Makefile" ;; +- "src/switch/tcp/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/switch/tcp/Makefile" ;; +- "src/config/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/config/Makefile" ;; +- "src/config/init-redhat/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/config/init-redhat/Makefile" ;; +- "src/extra/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/extra/Makefile" ;; +- "src/extra/linux-atm.spec" ) CONFIG_FILES="$CONFIG_FILES src/extra/linux-atm.spec" ;; +- "src/extra/ANS/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/extra/ANS/Makefile" ;; ++ "src/br2684/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/br2684/Makefile" ;; + "default-1" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;; + "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +@@ -9267,9 +9534,9 @@ + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then +- ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" ++ ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else +- ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" ++ ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end +@@ -9287,21 +9554,21 @@ + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin +- cat >$tmp/stdin +- ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` +- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; ++ cat >$tmp/stdin ++ ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ++ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` +- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; ++ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`(dirname "$ac_file") 2>/dev/null || + $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ +- X"$ac_file" : 'X\(//\)[^/]' \| \ +- X"$ac_file" : 'X\(//\)$' \| \ +- X"$ac_file" : 'X\(/\)' \| \ +- . : '\(.\)' 2>/dev/null || ++ X"$ac_file" : 'X\(//\)[^/]' \| \ ++ X"$ac_file" : 'X\(//\)$' \| \ ++ X"$ac_file" : 'X\(/\)' \| \ ++ . : '\(.\)' 2>/dev/null || + echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } +@@ -9317,10 +9584,10 @@ + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || + $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ +- X"$as_dir" : 'X\(//\)[^/]' \| \ +- X"$as_dir" : 'X\(//\)$' \| \ +- X"$as_dir" : 'X\(/\)' \| \ +- . : '\(.\)' 2>/dev/null || ++ X"$as_dir" : 'X\(//\)[^/]' \| \ ++ X"$as_dir" : 'X\(//\)$' \| \ ++ X"$as_dir" : 'X\(/\)' \| \ ++ . : '\(.\)' 2>/dev/null || + echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } +@@ -9358,12 +9625,45 @@ + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; + esac +-# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +-# absolute. +-ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +-ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` +-ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +-ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` ++ ++# Do not use `cd foo && pwd` to compute absolute paths, because ++# the directories may not exist. ++case `pwd` in ++.) ac_abs_builddir="$ac_dir";; ++*) ++ case "$ac_dir" in ++ .) ac_abs_builddir=`pwd`;; ++ [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; ++ *) ac_abs_builddir=`pwd`/"$ac_dir";; ++ esac;; ++esac ++case $ac_abs_builddir in ++.) ac_abs_top_builddir=${ac_top_builddir}.;; ++*) ++ case ${ac_top_builddir}. in ++ .) ac_abs_top_builddir=$ac_abs_builddir;; ++ [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; ++ *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; ++ esac;; ++esac ++case $ac_abs_builddir in ++.) ac_abs_srcdir=$ac_srcdir;; ++*) ++ case $ac_srcdir in ++ .) ac_abs_srcdir=$ac_abs_builddir;; ++ [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; ++ *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; ++ esac;; ++esac ++case $ac_abs_builddir in ++.) ac_abs_top_srcdir=$ac_top_srcdir;; ++*) ++ case $ac_top_srcdir in ++ .) ac_abs_top_srcdir=$ac_abs_builddir;; ++ [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; ++ *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; ++ esac;; ++esac + + + case $INSTALL in +@@ -9371,11 +9671,6 @@ + *) ac_INSTALL=$ac_top_builddir$INSTALL ;; + esac + +- if test x"$ac_file" != x-; then +- { echo "$as_me:$LINENO: creating $ac_file" >&5 +-echo "$as_me: creating $ac_file" >&6;} +- rm -f "$ac_file" +- fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ +@@ -9385,7 +9680,7 @@ + configure_input="$ac_file. " + fi + configure_input=$configure_input"Generated from `echo $ac_file_in | +- sed 's,.*/,,'` by configure." ++ sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. +@@ -9394,26 +9689,32 @@ + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) +- # Absolute (can't be DOS-style, as IFS=:) +- test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 ++ # Absolute (can't be DOS-style, as IFS=:) ++ test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 + echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } +- echo $f;; ++ echo "$f";; + *) # Relative +- if test -f "$f"; then +- # Build tree +- echo $f +- elif test -f "$srcdir/$f"; then +- # Source tree +- echo $srcdir/$f +- else +- # /dev/null tree +- { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 ++ if test -f "$f"; then ++ # Build tree ++ echo "$f" ++ elif test -f "$srcdir/$f"; then ++ # Source tree ++ echo "$srcdir/$f" ++ else ++ # /dev/null tree ++ { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 + echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } +- fi;; ++ fi;; + esac + done` || { (exit 1); exit 1; } ++ ++ if test x"$ac_file" != x-; then ++ { echo "$as_me:$LINENO: creating $ac_file" >&5 ++echo "$as_me: creating $ac_file" >&6;} ++ rm -f "$ac_file" ++ fi + _ACEOF + cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +@@ -9453,12 +9754,12 @@ + # NAME is the cpp macro being defined and VALUE is the value it is being given. + # + # ac_d sets the value in "#define NAME VALUE" lines. +-ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +-ac_dB='[ ].*$,\1#\2' ++ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' ++ac_dB='[ ].*$,\1#\2' + ac_dC=' ' + ac_dD=',;t' + # ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +-ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ++ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' + ac_uB='$,\1#\2define\3' + ac_uC=' ' + ac_uD=',;t' +@@ -9467,11 +9768,11 @@ + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin +- cat >$tmp/stdin +- ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` +- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; ++ cat >$tmp/stdin ++ ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ++ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` +- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; ++ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + +@@ -9485,28 +9786,29 @@ + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) +- # Absolute (can't be DOS-style, as IFS=:) +- test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 ++ # Absolute (can't be DOS-style, as IFS=:) ++ test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 + echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } +- echo $f;; ++ # Do quote $f, to prevent DOS paths from being IFS'd. ++ echo "$f";; + *) # Relative +- if test -f "$f"; then +- # Build tree +- echo $f +- elif test -f "$srcdir/$f"; then +- # Source tree +- echo $srcdir/$f +- else +- # /dev/null tree +- { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 ++ if test -f "$f"; then ++ # Build tree ++ echo "$f" ++ elif test -f "$srcdir/$f"; then ++ # Source tree ++ echo "$srcdir/$f" ++ else ++ # /dev/null tree ++ { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 + echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } +- fi;; ++ fi;; + esac + done` || { (exit 1); exit 1; } + # Remove the trailing spaces. +- sed 's/[ ]*$//' $ac_file_inputs >$tmp/in ++ sed 's/[ ]*$//' $ac_file_inputs >$tmp/in + + _ACEOF + +@@ -9529,9 +9831,9 @@ + s,[\\$`],\\&,g + t clear + : clear +-s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp ++s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp + t end +-s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp ++s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp + : end + _ACEOF + # If some macros were called several times there might be several times +@@ -9545,13 +9847,13 @@ + # example, in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. + cat >>conftest.undefs <<\_ACEOF +-s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, ++s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, + _ACEOF + + # Break up conftest.defines because some shells have a limit on the size + # of here documents, and old seds have small limits too (100 cmds). + echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS +-echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS ++echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS + echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS + echo ' :' >>$CONFIG_STATUS + rm -f conftest.tail +@@ -9560,7 +9862,7 @@ + # Write a limited-size here document to $tmp/defines.sed. + echo ' cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS + # Speed up: don't consider the non `#define' lines. +- echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS ++ echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS +@@ -9587,7 +9889,7 @@ + # Write a limited-size here document to $tmp/undefs.sed. + echo ' cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS + # Speed up: don't consider the non `#undef' +- echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS ++ echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS +@@ -9621,10 +9923,10 @@ + else + ac_dir=`(dirname "$ac_file") 2>/dev/null || + $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ +- X"$ac_file" : 'X\(//\)[^/]' \| \ +- X"$ac_file" : 'X\(//\)$' \| \ +- X"$ac_file" : 'X\(/\)' \| \ +- . : '\(.\)' 2>/dev/null || ++ X"$ac_file" : 'X\(//\)[^/]' \| \ ++ X"$ac_file" : 'X\(//\)$' \| \ ++ X"$ac_file" : 'X\(/\)' \| \ ++ . : '\(.\)' 2>/dev/null || + echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } +@@ -9640,10 +9942,10 @@ + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || + $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ +- X"$as_dir" : 'X\(//\)[^/]' \| \ +- X"$as_dir" : 'X\(//\)$' \| \ +- X"$as_dir" : 'X\(/\)' \| \ +- . : '\(.\)' 2>/dev/null || ++ X"$as_dir" : 'X\(//\)[^/]' \| \ ++ X"$as_dir" : 'X\(//\)$' \| \ ++ X"$as_dir" : 'X\(/\)' \| \ ++ . : '\(.\)' 2>/dev/null || + echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } +@@ -9675,16 +9977,41 @@ + ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_dir=`(dirname "$ac_dest") 2>/dev/null || + $as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ +- X"$ac_dest" : 'X\(//\)[^/]' \| \ +- X"$ac_dest" : 'X\(//\)$' \| \ +- X"$ac_dest" : 'X\(/\)' \| \ +- . : '\(.\)' 2>/dev/null || ++ X"$ac_dest" : 'X\(//\)[^/]' \| \ ++ X"$ac_dest" : 'X\(//\)$' \| \ ++ X"$ac_dest" : 'X\(/\)' \| \ ++ . : '\(.\)' 2>/dev/null || + echo X"$ac_dest" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` ++ { if $as_mkdir_p; then ++ mkdir -p "$ac_dir" ++ else ++ as_dir="$ac_dir" ++ as_dirs= ++ while test ! -d "$as_dir"; do ++ as_dirs="$as_dir $as_dirs" ++ as_dir=`(dirname "$as_dir") 2>/dev/null || ++$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ ++ X"$as_dir" : 'X\(//\)[^/]' \| \ ++ X"$as_dir" : 'X\(//\)$' \| \ ++ X"$as_dir" : 'X\(/\)' \| \ ++ . : '\(.\)' 2>/dev/null || ++echo X"$as_dir" | ++ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } ++ /^X\(\/\/\)[^/].*/{ s//\1/; q; } ++ /^X\(\/\/\)$/{ s//\1/; q; } ++ /^X\(\/\).*/{ s//\1/; q; } ++ s/.*/./; q'` ++ done ++ test ! -n "$as_dirs" || mkdir $as_dirs ++ fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 ++echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} ++ { (exit 1); exit 1; }; }; } ++ + ac_builddir=. + + if test "$ac_dir" != .; then +@@ -9710,12 +10037,45 @@ + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; + esac +-# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +-# absolute. +-ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +-ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` +-ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +-ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` ++ ++# Do not use `cd foo && pwd` to compute absolute paths, because ++# the directories may not exist. ++case `pwd` in ++.) ac_abs_builddir="$ac_dir";; ++*) ++ case "$ac_dir" in ++ .) ac_abs_builddir=`pwd`;; ++ [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; ++ *) ac_abs_builddir=`pwd`/"$ac_dir";; ++ esac;; ++esac ++case $ac_abs_builddir in ++.) ac_abs_top_builddir=${ac_top_builddir}.;; ++*) ++ case ${ac_top_builddir}. in ++ .) ac_abs_top_builddir=$ac_abs_builddir;; ++ [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; ++ *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; ++ esac;; ++esac ++case $ac_abs_builddir in ++.) ac_abs_srcdir=$ac_srcdir;; ++*) ++ case $ac_srcdir in ++ .) ac_abs_srcdir=$ac_abs_builddir;; ++ [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; ++ *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; ++ esac;; ++esac ++case $ac_abs_builddir in ++.) ac_abs_top_srcdir=$ac_top_srcdir;; ++*) ++ case $ac_top_srcdir in ++ .) ac_abs_top_srcdir=$ac_abs_builddir;; ++ [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; ++ *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; ++ esac;; ++esac + + + { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 +diff -urN linux-atm.old/doc/Makefile.in linux-atm.dev/doc/Makefile.in +--- linux-atm.old/doc/Makefile.in 2005-08-23 01:12:10.885781000 +0200 ++++ linux-atm.dev/doc/Makefile.in 2005-08-23 01:12:46.551359544 +0200 +@@ -63,24 +63,35 @@ + host_triplet = @host@ + target_alias = @target_alias@ + target_triplet = @target@ ++AR = @AR@ + AS = @AS@ + CC = @CC@ ++CXX = @CXX@ ++CXXCPP = @CXXCPP@ + DLLTOOL = @DLLTOOL@ + ECHO = @ECHO@ ++EGREP = @EGREP@ + EXEEXT = @EXEEXT@ ++F77 = @F77@ ++GCJ = @GCJ@ ++GCJFLAGS = @GCJFLAGS@ ++HAVE_LIB = @HAVE_LIB@ + LEX = @LEX@ ++LIB = @LIB@ + LIBTOOL = @LIBTOOL@ + LIBTOOL_DEPS = @LIBTOOL_DEPS@ + LIBVER_AGE = @LIBVER_AGE@ + LIBVER_CURRENT = @LIBVER_CURRENT@ + LIBVER_REVISION = @LIBVER_REVISION@ + LN_S = @LN_S@ ++LTLIB = @LTLIB@ + MAKEINFO = @MAKEINFO@ + OBJDUMP = @OBJDUMP@ + OBJEXT = @OBJEXT@ + PACKAGE = @PACKAGE@ + PERL = @PERL@ + RANLIB = @RANLIB@ ++RC = @RC@ + STRIP = @STRIP@ + VERSION = @VERSION@ + YACC = @YACC@ +diff -urN linux-atm.old/m4/Makefile.in linux-atm.dev/m4/Makefile.in +--- linux-atm.old/m4/Makefile.in 2005-08-23 01:12:10.850786000 +0200 ++++ linux-atm.dev/m4/Makefile.in 2005-08-23 01:12:46.559358328 +0200 +@@ -63,24 +63,35 @@ + host_triplet = @host@ + target_alias = @target_alias@ + target_triplet = @target@ ++AR = @AR@ + AS = @AS@ + CC = @CC@ ++CXX = @CXX@ ++CXXCPP = @CXXCPP@ + DLLTOOL = @DLLTOOL@ + ECHO = @ECHO@ ++EGREP = @EGREP@ + EXEEXT = @EXEEXT@ ++F77 = @F77@ ++GCJ = @GCJ@ ++GCJFLAGS = @GCJFLAGS@ ++HAVE_LIB = @HAVE_LIB@ + LEX = @LEX@ ++LIB = @LIB@ + LIBTOOL = @LIBTOOL@ + LIBTOOL_DEPS = @LIBTOOL_DEPS@ + LIBVER_AGE = @LIBVER_AGE@ + LIBVER_CURRENT = @LIBVER_CURRENT@ + LIBVER_REVISION = @LIBVER_REVISION@ + LN_S = @LN_S@ ++LTLIB = @LTLIB@ + MAKEINFO = @MAKEINFO@ + OBJDUMP = @OBJDUMP@ + OBJEXT = @OBJEXT@ + PACKAGE = @PACKAGE@ + PERL = @PERL@ + RANLIB = @RANLIB@ ++RC = @RC@ + STRIP = @STRIP@ + VERSION = @VERSION@ + YACC = @YACC@ +diff -urN linux-atm.old/Makefile.in linux-atm.dev/Makefile.in +--- linux-atm.old/Makefile.in 2005-08-23 01:12:10.830789000 +0200 ++++ linux-atm.dev/Makefile.in 2005-08-23 01:12:46.542360912 +0200 +@@ -63,24 +63,35 @@ + host_triplet = @host@ + target_alias = @target_alias@ + target_triplet = @target@ ++AR = @AR@ + AS = @AS@ + CC = @CC@ ++CXX = @CXX@ ++CXXCPP = @CXXCPP@ + DLLTOOL = @DLLTOOL@ + ECHO = @ECHO@ ++EGREP = @EGREP@ + EXEEXT = @EXEEXT@ ++F77 = @F77@ ++GCJ = @GCJ@ ++GCJFLAGS = @GCJFLAGS@ ++HAVE_LIB = @HAVE_LIB@ + LEX = @LEX@ ++LIB = @LIB@ + LIBTOOL = @LIBTOOL@ + LIBTOOL_DEPS = @LIBTOOL_DEPS@ + LIBVER_AGE = @LIBVER_AGE@ + LIBVER_CURRENT = @LIBVER_CURRENT@ + LIBVER_REVISION = @LIBVER_REVISION@ + LN_S = @LN_S@ ++LTLIB = @LTLIB@ + MAKEINFO = @MAKEINFO@ + OBJDUMP = @OBJDUMP@ + OBJEXT = @OBJEXT@ + PACKAGE = @PACKAGE@ + PERL = @PERL@ + RANLIB = @RANLIB@ ++RC = @RC@ + STRIP = @STRIP@ + VERSION = @VERSION@ + YACC = @YACC@ +diff -urN linux-atm.old/src/br2684/Makefile.in linux-atm.dev/src/br2684/Makefile.in +--- linux-atm.old/src/br2684/Makefile.in 2005-08-23 01:12:10.884781000 +0200 ++++ linux-atm.dev/src/br2684/Makefile.in 2005-08-23 01:12:46.632347232 +0200 +@@ -57,11 +57,15 @@ + NORMAL_UNINSTALL = : + PRE_UNINSTALL = : + POST_UNINSTALL = : ++build_alias = @build_alias@ ++build_triplet = @build@ + host_alias = @host_alias@ + host_triplet = @host@ ++target_alias = @target_alias@ ++target_triplet = @target@ + AR = @AR@ + AS = @AS@ +-CC = /usr/src/openwrt/staging_dir_mipsel/bin/mipsel-linux-gcc ++CC = @CC@ + CXX = @CXX@ + CXXCPP = @CXXCPP@ + DLLTOOL = @DLLTOOL@ +@@ -117,9 +121,9 @@ + br2684ctl_DEPENDENCIES = $(top_builddir)/src/lib/libatm.la + br2684ctl_LDFLAGS = + CFLAGS = @CFLAGS@ +-COMPILE = $(TARGET_CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +-LTCOMPILE = $(LIBTOOL) --mode=compile $(TARGET_CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +-CCLD = $(TARGET_CC) ++COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) ++LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) ++CCLD = $(CC) + LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ + man8dir = $(mandir)/man8 + MANS = $(man_MANS) +diff -urN linux-atm.old/src/include/Makefile.in linux-atm.dev/src/include/Makefile.in +--- linux-atm.old/src/include/Makefile.in 2005-08-23 01:12:10.851786000 +0200 ++++ linux-atm.dev/src/include/Makefile.in 2005-08-23 01:12:46.585354376 +0200 +@@ -63,24 +63,35 @@ + host_triplet = @host@ + target_alias = @target_alias@ + target_triplet = @target@ ++AR = @AR@ + AS = @AS@ + CC = @CC@ ++CXX = @CXX@ ++CXXCPP = @CXXCPP@ + DLLTOOL = @DLLTOOL@ + ECHO = @ECHO@ ++EGREP = @EGREP@ + EXEEXT = @EXEEXT@ ++F77 = @F77@ ++GCJ = @GCJ@ ++GCJFLAGS = @GCJFLAGS@ ++HAVE_LIB = @HAVE_LIB@ + LEX = @LEX@ ++LIB = @LIB@ + LIBTOOL = @LIBTOOL@ + LIBTOOL_DEPS = @LIBTOOL_DEPS@ + LIBVER_AGE = @LIBVER_AGE@ + LIBVER_CURRENT = @LIBVER_CURRENT@ + LIBVER_REVISION = @LIBVER_REVISION@ + LN_S = @LN_S@ ++LTLIB = @LTLIB@ + MAKEINFO = @MAKEINFO@ + OBJDUMP = @OBJDUMP@ + OBJEXT = @OBJEXT@ + PACKAGE = @PACKAGE@ + PERL = @PERL@ + RANLIB = @RANLIB@ ++RC = @RC@ + STRIP = @STRIP@ + VERSION = @VERSION@ + YACC = @YACC@ +diff -urN linux-atm.old/src/lib/Makefile.in linux-atm.dev/src/lib/Makefile.in +--- linux-atm.old/src/lib/Makefile.in 2005-08-23 01:12:10.852786000 +0200 ++++ linux-atm.dev/src/lib/Makefile.in 2005-08-23 01:12:46.607351032 +0200 +@@ -65,24 +65,35 @@ + host_triplet = @host@ + target_alias = @target_alias@ + target_triplet = @target@ ++AR = @AR@ + AS = @AS@ + CC = @CC@ ++CXX = @CXX@ ++CXXCPP = @CXXCPP@ + DLLTOOL = @DLLTOOL@ + ECHO = @ECHO@ ++EGREP = @EGREP@ + EXEEXT = @EXEEXT@ ++F77 = @F77@ ++GCJ = @GCJ@ ++GCJFLAGS = @GCJFLAGS@ ++HAVE_LIB = @HAVE_LIB@ + LEX = @LEX@ ++LIB = @LIB@ + LIBTOOL = @LIBTOOL@ + LIBTOOL_DEPS = @LIBTOOL_DEPS@ + LIBVER_AGE = @LIBVER_AGE@ + LIBVER_CURRENT = @LIBVER_CURRENT@ + LIBVER_REVISION = @LIBVER_REVISION@ + LN_S = @LN_S@ ++LTLIB = @LTLIB@ + MAKEINFO = @MAKEINFO@ + OBJDUMP = @OBJDUMP@ + OBJEXT = @OBJEXT@ + PACKAGE = @PACKAGE@ + PERL = @PERL@ + RANLIB = @RANLIB@ ++RC = @RC@ + STRIP = @STRIP@ + VERSION = @VERSION@ + YACC = @YACC@ +diff -urN linux-atm.old/src/Makefile.in linux-atm.dev/src/Makefile.in +--- linux-atm.old/src/Makefile.in 2005-08-23 01:12:10.851786000 +0200 ++++ linux-atm.dev/src/Makefile.in 2005-08-23 01:12:46.572356352 +0200 +@@ -63,30 +63,40 @@ + host_triplet = @host@ + target_alias = @target_alias@ + target_triplet = @target@ ++AR = @AR@ + AS = @AS@ + CC = @CC@ ++CXX = @CXX@ ++CXXCPP = @CXXCPP@ + DLLTOOL = @DLLTOOL@ + ECHO = @ECHO@ ++EGREP = @EGREP@ + EXEEXT = @EXEEXT@ ++F77 = @F77@ ++GCJ = @GCJ@ ++GCJFLAGS = @GCJFLAGS@ ++HAVE_LIB = @HAVE_LIB@ + LEX = @LEX@ ++LIB = @LIB@ + LIBTOOL = @LIBTOOL@ + LIBTOOL_DEPS = @LIBTOOL_DEPS@ + LIBVER_AGE = @LIBVER_AGE@ + LIBVER_CURRENT = @LIBVER_CURRENT@ + LIBVER_REVISION = @LIBVER_REVISION@ + LN_S = @LN_S@ ++LTLIB = @LTLIB@ + MAKEINFO = @MAKEINFO@ + OBJDUMP = @OBJDUMP@ + OBJEXT = @OBJEXT@ + PACKAGE = @PACKAGE@ + PERL = @PERL@ + RANLIB = @RANLIB@ ++RC = @RC@ + STRIP = @STRIP@ + VERSION = @VERSION@ + YACC = @YACC@ + +-SUBDIRS = include lib +- ++SUBDIRS = include lib br2684 + mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs + CONFIG_HEADER = ../config.h + CONFIG_CLEAN_FILES = diff --git a/package/linux-atm/patches/400-stdint_local_instead_of_host.patch b/package/linux-atm/patches/400-stdint_local_instead_of_host.patch new file mode 100644 index 0000000000..7c1e8c14f4 --- /dev/null +++ b/package/linux-atm/patches/400-stdint_local_instead_of_host.patch @@ -0,0 +1,12 @@ +diff -ur linux-atm.old/src/include/stdint.h linux-atm.dev/src/include/stdint.h +--- linux-atm.old/src/include/stdint.h 2001-09-03 20:41:06.000000000 +0200 ++++ linux-atm.dev/src/include/stdint.h 2006-09-27 19:13:56.000000000 +0200 +@@ -6,7 +6,7 @@ + + #if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 + +-#include "/usr/include/stdint.h" ++#include_next <stdint.h> + + #elif __GLIBC__ >= 2 + diff --git a/package/madwifi/Makefile b/package/madwifi/Makefile new file mode 100644 index 0000000000..a4180063f4 --- /dev/null +++ b/package/madwifi/Makefile @@ -0,0 +1,133 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=madwifi +PKG_VERSION:=0.9.2 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=@SF/$(PKG_NAME) +PKG_MD5SUM:=a75baacbe07085ddc5cb28e1fb43edbb +PKG_CAT:=bzcat + +PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/kmod-madwifi + SECTION:=kernel + CATEGORY:=Kernel drivers + DEFAULT:=y if LINUX_2_6_BRCM || LINUX_2_6_ARUBA || LINUX_2_4_AR531X || LINUX_2_6_XSCALE, m if ALL + TITLE:=Driver for Atheros wireless chipsets + DESCRIPTION:=\ + This package contains a driver for Atheros 802.11a/b/g chipsets. + URL:=http://madwifi.org/ + VERSION:=$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE) +endef + +RATE_CONTROL:=sample + +ifeq ($(ARCH),mips) + HAL_TARGET:=mips-be-elf +endif +ifeq ($(ARCH),mipsel) + HAL_TARGET:=mips-le-elf +endif +ifeq ($(ARCH),i386) + HAL_TARGET:=i386-elf +endif +ifeq ($(ARCH),armeb) + HAL_TARGET:=xscale-be-elf +endif +ifeq ($(ARCH),powerpc) + HAL_TARGET:=powerpc-be-elf +endif + +BUS:=PCI +ifneq ($(CONFIG_LINUX_2_4_AR531X),) + BUS:=AHB +endif +ifneq ($(CONFIG_LINUX_2_6_ARUBA),) + BUS:=PCI AHB # no suitable HAL for AHB yet. +endif + +BUS_MODULES:= +ifeq ($(findstring AHB,$(BUS)),AHB) + BUS_MODULES+=$(PKG_BUILD_DIR)/ath/ath_ahb.$(LINUX_KMOD_SUFFIX) +endif +ifeq ($(findstring PCI,$(BUS)),PCI) + BUS_MODULES+=$(PKG_BUILD_DIR)/ath/ath_pci.$(LINUX_KMOD_SUFFIX) +endif + +MADWIFI_MAKEOPTS= -C $(PKG_BUILD_DIR) \ + PATH="$(TARGET_PATH)" \ + ARCH="$(LINUX_KARCH)" \ + CROSS_COMPILE="$(TARGET_CROSS)" \ + TARGET="$(HAL_TARGET)" \ + TOOLPREFIX="$(KERNEL_CROSS)" \ + TOOLPATH="$(KERNEL_CROSS)" \ + KERNELPATH="$(LINUX_DIR)" \ + LDOPTS=" " \ + ATH_RATE="ath_rate/$(RATE_CONTROL)" \ + DOMULTI=1 + +ifeq ($(findstring AHB,$(BUS)),AHB) + define Build/Compile/ahb + $(MAKE) $(MADWIFI_MAKEOPTS) BUS="AHB" all + endef +endif + +ifeq ($(findstring PCI,$(BUS)),PCI) + define Build/Compile/pci + $(MAKE) $(MADWIFI_MAKEOPTS) BUS="PCI" all + endef +endif + +define Build/Compile + $(call Build/Compile/ahb) + $(call Build/Compile/pci) +endef + +define Build/InstallDev + mkdir -p $(STAGING_DIR)/usr/include/madwifi + $(CP) $(PKG_BUILD_DIR)/include $(STAGING_DIR)/usr/include/madwifi/ + mkdir -p $(STAGING_DIR)/usr/include/madwifi/net80211 + $(CP) $(PKG_BUILD_DIR)/net80211/*.h $(STAGING_DIR)/usr/include/madwifi/net80211/ +endef + +define Build/UninstallDev + rm -rf $(STAGING_DIR)/usr/include/madwifi +endef + +define Package/kmod-madwifi/install + mkdir -p $(1)/etc/modules.d + mkdir -p $(1)/etc/init.d + mkdir -p $(1)/lib/modules/$(LINUX_VERSION) + mkdir -p $(1)/usr/sbin + install -m0644 ./files/madwifi.modules $(1)/etc/modules.d/20-madwifi + echo ath_rate_$(RATE_CONTROL) >> $(1)/etc/modules.d/20-madwifi +ifeq ($(findstring AHB,$(BUS)),AHB) + echo ath_ahb >> $(1)/etc/modules.d/20-madwifi +endif +ifeq ($(findstring PCI,$(BUS)),PCI) + echo ath_pci >> $(1)/etc/modules.d/20-madwifi +endif + install -m0755 ./files/madwifi.init $(1)/etc/init.d/S20madwifi + $(CP) \ + $(PKG_BUILD_DIR)/ath/ath_hal.$(LINUX_KMOD_SUFFIX) \ + $(BUS_MODULES) \ + $(PKG_BUILD_DIR)/ath_rate/$(RATE_CONTROL)/ath_rate_$(RATE_CONTROL).$(LINUX_KMOD_SUFFIX) \ + $(PKG_BUILD_DIR)/net80211/wlan*.$(LINUX_KMOD_SUFFIX) \ + $(1)/lib/modules/$(LINUX_VERSION)/ + $(CP) $(PKG_BUILD_DIR)/tools/{madwifi_multi,80211debug,80211stats,athchans,athctrl,athdebug,athkey,athstats,wlanconfig} $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,kmod-madwifi)) diff --git a/package/madwifi/files/madwifi.init b/package/madwifi/files/madwifi.init new file mode 100644 index 0000000000..73eb11017e --- /dev/null +++ b/package/madwifi/files/madwifi.init @@ -0,0 +1,4 @@ +#!/bin/sh /etc/rc.common +start() { + iwpriv ath0 mode 3 +} diff --git a/package/madwifi/files/madwifi.modules b/package/madwifi/files/madwifi.modules new file mode 100644 index 0000000000..515c1e9aa1 --- /dev/null +++ b/package/madwifi/files/madwifi.modules @@ -0,0 +1,10 @@ +wlan +wlan_scan_ap +wlan_scan_sta +ath_hal +ath_rate_sample +wlan_acl +wlan_ccmp +wlan_tkip +wlan_wep +wlan_xauth diff --git a/package/madwifi/patches/100-kernel_cflags.patch b/package/madwifi/patches/100-kernel_cflags.patch new file mode 100644 index 0000000000..39ac1437e1 --- /dev/null +++ b/package/madwifi/patches/100-kernel_cflags.patch @@ -0,0 +1,42 @@ +diff -ur madwifi.old/hal/public/mips-be-elf.inc madwifi.dev/hal/public/mips-be-elf.inc +--- madwifi.old/hal/public/mips-be-elf.inc 2006-05-27 04:48:16.000000000 +0200 ++++ madwifi.dev/hal/public/mips-be-elf.inc 2006-08-29 18:17:44.000000000 +0200 +@@ -71,5 +71,5 @@ + + LDOPTS= -EB + COPTS+= -DAH_BYTE_ORDER=AH_BIG_ENDIAN +-COPTS+= -G 0 -EB -mno-abicalls -fno-pic -mips2 -Wa,--trap \ ++COPTS+= -G 0 -mno-abicalls -fno-pic -mips32 -Wa,--trap \ + -fno-strict-aliasing -fno-common -fomit-frame-pointer -mlong-calls +diff -ur madwifi.old/hal/public/mips-le-elf.inc madwifi.dev/hal/public/mips-le-elf.inc +--- madwifi.old/hal/public/mips-le-elf.inc 2006-05-27 04:48:16.000000000 +0200 ++++ madwifi.dev/hal/public/mips-le-elf.inc 2006-08-29 18:17:57.000000000 +0200 +@@ -68,5 +68,5 @@ + + LDOPTS= -EL + COPTS+= -DAH_BYTE_ORDER=AH_LITTLE_ENDIAN +-COPTS+= -G 0 -EL -mno-abicalls -fno-pic -mips2 -Wa,--trap \ ++COPTS+= -G 0 -mno-abicalls -fno-pic -mips32 -Wa,--trap \ + -fno-strict-aliasing -fno-common -fomit-frame-pointer -mlong-calls +diff -ur madwifi.old/hal/public/xscale-be-elf.inc madwifi.dev/hal/public/xscale-be-elf.inc +--- madwifi.old/hal/public/xscale-be-elf.inc 2006-05-27 04:48:16.000000000 +0200 ++++ madwifi.dev/hal/public/xscale-be-elf.inc 2006-08-29 18:01:39.000000000 +0200 +@@ -77,5 +77,5 @@ + + LDOPTS= -EB + COPTS+= -DAH_BYTE_ORDER=AH_BIG_ENDIAN +-COPTS+= -march=armv4 -mbig-endian -fno-strict-aliasing -fno-common -mapcs-32 \ ++COPTS+= -march=armv5te -mtune=xscale -mbig-endian -fno-strict-aliasing -fno-common \ + -mtune=xscale -mshort-load-bytes -msoft-float -mfp=2 +diff -ur madwifi.old/Makefile madwifi.dev/Makefile +--- madwifi.old/Makefile 2006-07-14 07:15:56.000000000 +0200 ++++ madwifi.dev/Makefile 2006-08-29 18:01:39.000000000 +0200 +@@ -54,7 +54,7 @@ + + all: modules tools + +-modules: configcheck svnversion.h ++modules: svnversion.h + ifdef LINUX24 + for i in $(DIRS_MODULES); do \ + $(MAKE) -C $$i || exit 1; \ diff --git a/package/madwifi/patches/101-no_werror.patch b/package/madwifi/patches/101-no_werror.patch new file mode 100644 index 0000000000..d71021eb0e --- /dev/null +++ b/package/madwifi/patches/101-no_werror.patch @@ -0,0 +1,11 @@ +--- madwifi.old/Makefile.inc 2006-07-14 07:15:56.000000000 +0200 ++++ madwifi.dev/Makefile.inc 2006-08-30 05:20:27.000000000 +0200 +@@ -181,7 +181,7 @@ + # + TOOLS= $(DEPTH)/tools + +-COPTS+= -Werror ++# COPTS+= -Werror + INCS= -include $(obj)/$(DEPTH)/include/compat.h -I$(obj)/$(DEPTH)/include + + ifeq ($(strip $(BUS)),AHB) diff --git a/package/madwifi/patches/102-multicall_binary.patch b/package/madwifi/patches/102-multicall_binary.patch new file mode 100644 index 0000000000..8fa65676d4 --- /dev/null +++ b/package/madwifi/patches/102-multicall_binary.patch @@ -0,0 +1,369 @@ +diff -urN madwifi-0.9.2.old/tools/80211debug.c madwifi-0.9.2.dev/tools/80211debug.c +--- madwifi-0.9.2.old/tools/80211debug.c 2006-03-10 14:23:50.000000000 +0100 ++++ madwifi-0.9.2.dev/tools/80211debug.c 2006-08-29 17:49:50.000000000 +0200 +@@ -49,6 +49,10 @@ + #include <getopt.h> + #include <err.h> + ++#ifdef DOMULTI ++#include "do_multi.h" ++#endif ++ + #define N(a) (sizeof(a)/sizeof(a[0])) + + const char *progname; +@@ -180,9 +184,19 @@ + } + #endif /* __linux__ */ + ++#ifdef DOMULTI ++ ++int ++a80211debug_init(int argc, char *argv[]) ++{ ++ ++#else ++ + int + main(int argc, char *argv[]) + { ++ ++#endif + const char *ifname = "ath0"; + const char *cp, *tp; + const char *sep; +diff -urN madwifi-0.9.2.old/tools/80211stats.c madwifi-0.9.2.dev/tools/80211stats.c +--- madwifi-0.9.2.old/tools/80211stats.c 2006-05-27 08:21:18.000000000 +0200 ++++ madwifi-0.9.2.dev/tools/80211stats.c 2006-08-29 17:49:50.000000000 +0200 +@@ -58,6 +58,10 @@ + #include "net80211/ieee80211_crypto.h" + #include "net80211/ieee80211_ioctl.h" + ++#ifdef DOMULTI ++#include "do_multi.h" ++#endif ++ + #ifndef SIOCG80211STATS + #define SIOCG80211STATS (SIOCDEVPRIVATE + 2) + #endif +@@ -241,9 +245,19 @@ + #undef STAT + } + ++#ifdef DOMULTI ++ ++int ++a80211stats_init(int argc, char *argv[]) ++{ ++ ++#else ++ + int + main(int argc, char *argv[]) + { ++ ++#endif + int c, len; + struct ieee80211req_sta_info *si; + u_int8_t buf[24*1024], *cp; +diff -urN madwifi-0.9.2.old/tools/athchans.c madwifi-0.9.2.dev/tools/athchans.c +--- madwifi-0.9.2.old/tools/athchans.c 2006-02-01 21:07:11.000000000 +0100 ++++ madwifi-0.9.2.dev/tools/athchans.c 2006-08-29 17:49:50.000000000 +0200 +@@ -57,6 +57,10 @@ + #include "net80211/ieee80211_crypto.h" + #include "net80211/ieee80211_ioctl.h" + ++#ifdef DOMULTI ++#include "do_multi.h" ++#endif ++ + static int s = -1; + const char *progname; + +@@ -134,9 +138,20 @@ + } + + #define MAXCHAN ((int)(sizeof(struct ieee80211req_chanlist) * NBBY)) ++ ++#ifdef DOMULTI ++ ++int ++athchans_init(int argc, char *argv[]) ++{ ++ ++#else ++ + int + main(int argc, char *argv[]) + { ++ ++#endif + const char *ifname = "wifi0"; + struct ieee80211req_chanlist chanlist; + int c; +diff -urN madwifi-0.9.2.old/tools/athctrl.c madwifi-0.9.2.dev/tools/athctrl.c +--- madwifi-0.9.2.old/tools/athctrl.c 2006-02-03 13:03:03.000000000 +0100 ++++ madwifi-0.9.2.dev/tools/athctrl.c 2006-08-29 17:49:50.000000000 +0200 +@@ -53,6 +53,10 @@ + + #include <net/if.h> + ++#ifdef DOMULTI ++#include "do_multi.h" ++#endif ++ + static int + setsysctrl(const char *dev, const char *control , u_long value) + { +@@ -87,9 +91,19 @@ + exit(1); + } + ++#ifdef DOMULTI ++ ++int ++athctrl_init(int argc, char *argv[]) ++{ ++ ++#else ++ + int + main(int argc, char *argv[]) + { ++ ++#endif + char device[IFNAMSIZ + 1]; + int distance = -1; + int c; +diff -urN madwifi-0.9.2.old/tools/athdebug.c madwifi-0.9.2.dev/tools/athdebug.c +--- madwifi-0.9.2.old/tools/athdebug.c 2006-05-05 06:17:59.000000000 +0200 ++++ madwifi-0.9.2.dev/tools/athdebug.c 2006-08-29 17:49:50.000000000 +0200 +@@ -52,6 +52,10 @@ + #include <getopt.h> + #include <err.h> + ++#ifdef DOMULTI ++#include "do_multi.h" ++#endif ++ + #define N(a) (sizeof(a)/sizeof(a[0])) + + const char *progname; +@@ -179,9 +183,20 @@ + } + #endif /* __linux__ */ + ++#ifdef DOMULTI ++ ++int ++athdebug_init(int argc, char *argv[]) ++{ ++ ++#else ++ + int + main(int argc, char *argv[]) + { ++ ++#endif ++ + #ifdef __linux__ + const char *ifname = "wifi0"; + #else +diff -urN madwifi-0.9.2.old/tools/athkey.c madwifi-0.9.2.dev/tools/athkey.c +--- madwifi-0.9.2.old/tools/athkey.c 2006-02-01 21:07:11.000000000 +0100 ++++ madwifi-0.9.2.dev/tools/athkey.c 2006-08-29 17:49:50.000000000 +0200 +@@ -57,6 +57,10 @@ + #include "net80211/ieee80211_crypto.h" + #include "net80211/ieee80211_ioctl.h" + ++#ifdef DOMULTI ++#include "do_multi.h" ++#endif ++ + static int s = -1; + const char *progname; + +@@ -207,9 +211,19 @@ + exit(-1); + } + ++#ifdef DOMULTI ++ ++int ++athkey_init(int argc, char *argv[]) ++{ ++ ++#else ++ + int + main(int argc, char *argv[]) + { ++ ++#endif + const char *ifname = "wifi0"; + struct ieee80211req_key setkey; + struct ieee80211req_del_key delkey; +diff -urN madwifi-0.9.2.old/tools/athstats.c madwifi-0.9.2.dev/tools/athstats.c +--- madwifi-0.9.2.old/tools/athstats.c 2006-05-05 06:20:50.000000000 +0200 ++++ madwifi-0.9.2.dev/tools/athstats.c 2006-08-29 17:49:50.000000000 +0200 +@@ -64,6 +64,10 @@ + #include "ah_desc.h" + #include "if_athioctl.h" + ++#ifdef DOMULTI ++#include "do_multi.h" ++#endif ++ + static const struct { + u_int phyerr; + const char* desc; +@@ -227,9 +231,20 @@ + signalled = 1; + } + ++#ifdef DOMULTI ++ ++int ++athstats_init(int argc, char *argv[]) ++{ ++ ++#else ++ + int + main(int argc, char *argv[]) + { ++ ++#endif ++ + #ifdef __linux__ + const char *ifname = "wifi0"; + #else +diff -urN madwifi-0.9.2.old/tools/do_multi.c madwifi-0.9.2.dev/tools/do_multi.c +--- madwifi-0.9.2.old/tools/do_multi.c 1970-01-01 01:00:00.000000000 +0100 ++++ madwifi-0.9.2.dev/tools/do_multi.c 2006-08-29 17:49:50.000000000 +0200 +@@ -0,0 +1,30 @@ ++#include <string.h> ++#include "do_multi.h" ++ ++int ++main(int argc, char *argv[]) ++{ ++ char *progname; ++ int ret = 0; ++ ++ progname = basename(argv[0]); ++ ++ if(strcmp(progname, "80211debug") == 0) ++ ret = a80211debug_init(argc, argv); ++ if(strcmp(progname, "80211stats") == 0) ++ ret = a80211stats_init(argc, argv); ++ if(strcmp(progname, "athchans") == 0) ++ ret = athchans_init(argc, argv); ++ if(strcmp(progname, "athctrl") == 0) ++ ret = athctrl_init(argc, argv); ++ if(strcmp(progname, "athdebug") == 0) ++ ret = athdebug_init(argc, argv); ++ if(strcmp(progname, "athkey") == 0) ++ ret = athkey_init(argc, argv); ++ if(strcmp(progname, "athstats") == 0) ++ ret = athstats_init(argc, argv); ++ if(strcmp(progname, "wlanconfig") == 0) ++ ret = wlanconfig_init(argc, argv); ++ ++ return ret; ++} +diff -urN madwifi-0.9.2.old/tools/do_multi.h madwifi-0.9.2.dev/tools/do_multi.h +--- madwifi-0.9.2.old/tools/do_multi.h 1970-01-01 01:00:00.000000000 +0100 ++++ madwifi-0.9.2.dev/tools/do_multi.h 2006-08-29 17:49:50.000000000 +0200 +@@ -0,0 +1,9 @@ ++ ++int a80211debug_init(int argc, char *argv[]); ++int a80211stats_init(int argc, char *argv[]); ++int athchans_init(int argc, char *argv[]); ++int athctrl_init(int argc, char *argv[]); ++int athdebug_init(int argc, char *argv[]); ++int athkey_init(int argc, char *argv[]); ++int athstats_init(int argc, char *argv[]); ++int wlanconfig_init(int argc, char *argv[]); +diff -urN madwifi-0.9.2.old/tools/Makefile madwifi-0.9.2.dev/tools/Makefile +--- madwifi-0.9.2.old/tools/Makefile 2006-07-14 07:15:56.000000000 +0200 ++++ madwifi-0.9.2.dev/tools/Makefile 2006-08-29 17:49:50.000000000 +0200 +@@ -49,6 +49,12 @@ + + ALL= athstats 80211stats athkey athchans athctrl \ + athdebug 80211debug wlanconfig ++ ++ifdef DOMULTI ++OBJS= do_multi.o athstats.o 80211stats.o athkey.o athchans.o athctrl.o \ ++ athdebug.o 80211debug.o wlanconfig.o ++ALL= ${OBJS} madwifi_multi ++endif + + all: $(ALL) + +@@ -59,6 +65,30 @@ + + all: $(ALL) + ++athstats.o: athstats.c ++ ${CC} -c -o athstats.o -DDOMULTI=1 ${ALL_CFLAGS} -I../ath athstats.c ++80211stats.o: 80211stats.c ++ ${CC} -c -o 80211stats.o -DDOMULTI=1 ${ALL_CFLAGS} 80211stats.c ++athkey.o: athkey.c ++ ${CC} -c -o athkey.o -DDOMULTI=1 ${ALL_CFLAGS} athkey.c ++athchans.o: athchans.c ++ ${CC} -c -o athchans.o -DDOMULTI=1 ${ALL_CFLAGS} athchans.c ++athctrl.o: athctrl.c ++ ${CC} -c -o athctrl.o -DDOMULTI=1 ${ALL_CFLAGS} athctrl.c ++athdebug.o: athdebug.c ++ ${CC} -c -o athdebug.o -DDOMULTI=1 ${ALL_CFLAGS} athdebug.c ++wlanconfig.o: wlanconfig.c ++ ${CC} -c -o wlanconfig.o -DDOMULTI=1 ${ALL_CFLAGS} wlanconfig.c ++80211debug.o: 80211debug.c ++ ${CC} -c -o 80211debug.o -DDOMULTI=1 ${ALL_CFLAGS} 80211debug.c ++do_multi.o: do_multi.c ++ ${CC} -c -o do_multi.o -DDOMULTI=1 ${ALL_CFLAGS} do_multi.c ++madwifi_multi: ++ ${CC} -o madwifi_multi ${LDFLAGS} ${OBJS} ++ for i in athstats 80211stats athkey athchans athctrl athdebug wlanconfig 80211debug; do \ ++ ln -s -f madwifi_multi $$i; \ ++ done ++ + athstats: athstats.c + $(CC) -o athstats $(ALL_CFLAGS) -I../ath $(LDFLAGS) athstats.c + 80211stats: 80211stats.c +diff -urN madwifi-0.9.2.old/tools/wlanconfig.c madwifi-0.9.2.dev/tools/wlanconfig.c +--- madwifi-0.9.2.old/tools/wlanconfig.c 2006-05-14 09:17:29.000000000 +0200 ++++ madwifi-0.9.2.dev/tools/wlanconfig.c 2006-08-29 17:49:50.000000000 +0200 +@@ -60,6 +60,10 @@ + #include "net80211/ieee80211_crypto.h" + #include "net80211/ieee80211_ioctl.h" + ++#ifdef DOMULTI ++#include "do_multi.h" ++#endif ++ + /* + * These are taken from ieee80211_node.h + */ +@@ -96,9 +100,19 @@ + + int verbose = 0; + ++#ifdef DOMULTI ++ ++int ++wlanconfig_init(int argc, char *argv[]) ++{ ++ ++#else ++ + int + main(int argc, char *argv[]) + { ++ ++#endif + const char *ifname, *cmd; + unsigned char bnounit = 0; + char *if_base = NULL; diff --git a/package/madwifi/patches/103-disable_rfkill.patch b/package/madwifi/patches/103-disable_rfkill.patch new file mode 100644 index 0000000000..80a45e31d3 --- /dev/null +++ b/package/madwifi/patches/103-disable_rfkill.patch @@ -0,0 +1,12 @@ +diff -urN madwifi-0.9.2.old/ath/if_ath.c madwifi-0.9.2.dev/ath/if_ath.c +--- madwifi-0.9.2.old/ath/if_ath.c 2006-07-08 08:47:19.000000000 +0200 ++++ madwifi-0.9.2.dev/ath/if_ath.c 2006-08-29 17:49:50.000000000 +0200 +@@ -251,7 +251,7 @@ + static int ath_outdoor = AH_FALSE; /* enable outdoor use */ + static int ath_xchanmode = AH_TRUE; /* enable extended channels */ + static char *autocreate = NULL; +-static int rfkill = -1; ++static int rfkill = 0; + static int countrycode = -1; + static int outdoor = -1; + static int xchanmode = -1; diff --git a/package/madwifi/patches/104-apmode_by_default.patch b/package/madwifi/patches/104-apmode_by_default.patch new file mode 100644 index 0000000000..fc5cb978b0 --- /dev/null +++ b/package/madwifi/patches/104-apmode_by_default.patch @@ -0,0 +1,12 @@ +diff -urN madwifi-0.9.2.old/ath/if_ath.c madwifi-0.9.2.dev/ath/if_ath.c +--- madwifi-0.9.2.old/ath/if_ath.c 2006-08-29 17:49:50.000000000 +0200 ++++ madwifi-0.9.2.dev/ath/if_ath.c 2006-08-29 17:49:50.000000000 +0200 +@@ -387,7 +387,7 @@ + struct ath_hal *ah; + HAL_STATUS status; + int error = 0, i; +- int autocreatemode = IEEE80211_M_STA; ++ int autocreatemode = IEEE80211_M_HOSTAP; + u_int8_t csz; + + sc->devid = devid; diff --git a/package/mini_fo/Makefile b/package/mini_fo/Makefile new file mode 100644 index 0000000000..38ad63754b --- /dev/null +++ b/package/mini_fo/Makefile @@ -0,0 +1,50 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=mini_fo +PKG_VERSION:=0.6.2pre1 +PKG_RELEASE:=1 + +PKG_SOURCE:=mini_fo-0-6-2-pre1.tar.bz2 +PKG_SOURCE_URL:=http://www.denx.de/twiki/pub/Know/MiniFOHome/ +PKG_MD5SUM:=acd12157be25d7b3c8df90914049403e +PKG_CAT:=bzcat + +PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/mini_fo-0-6-2-pre1 + +include $(INCLUDE_DIR)/package.mk + +define Package/kmod-mini-fo + SECTION:=kernel + CATEGORY:=Kernel drivers + TITLE:=The mini fanout overlay file system + URL:=http://www.denx.de/wiki/Know.MiniFOHome + VERSION:=$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE) +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + ARCH="$(LINUX_KARCH)" \ + CROSS_COMPILE="$(TARGET_CROSS)" \ + KERNELVERSION="$(KERNEL)" \ + KERNEL_SRC="$(LINUX_DIR)" \ + all +endef + +define Package/kmod-mini-fo/install + install -m0755 -d $(1)/lib/modules/$(LINUX_VERSION) + $(CP) $(PKG_BUILD_DIR)/mini_fo.$(LINUX_KMOD_SUFFIX) \ + $(1)/lib/modules/$(LINUX_VERSION)/ + install -m0755 -d $(1)/etc/modules.d + echo "mini_fo" > $(1)/etc/modules.d/15-mini-fo +endef + +$(eval $(call BuildPackage,kmod-mini-fo)) diff --git a/package/mini_fo/patches/101-kmod_build.patch b/package/mini_fo/patches/101-kmod_build.patch new file mode 100644 index 0000000000..9b47a69ab7 --- /dev/null +++ b/package/mini_fo/patches/101-kmod_build.patch @@ -0,0 +1,52 @@ +diff -Nur mini_fo-0-6-2-pre1/Makefile mini_fo-0-6-2-pre1.patched/Makefile +--- mini_fo-0-6-2-pre1/Makefile 2005-10-15 12:49:43.000000000 +0200 ++++ mini_fo-0-6-2-pre1.patched/Makefile 2005-12-25 14:03:36.864205250 +0100 +@@ -26,36 +26,29 @@ + # allow custom override of TOPINC for fistgen developers + -include fistdev.mk + ++obj-m := mini_fo.o ++mini_fo-objs := meta.o dentry.o file.o inode.o main.o super.o state.o aux.o ++ + ifeq ($(KERNELVERSION),2.4) +-CFLAGS = -D__KERNEL__ -DMODULE -DFISTGEN -I. ${TOPINC} -O2 -Wall -Wno-unused -g -fno-common -fno-schedule-insns -fno-schedule-insns2 -fno-strict-aliasing -msoft-float -Werror +-ifeq ($(ARCH),um) +-CFLAGS += $(shell cd $(KERNEL_SRC) ; make script 'SCRIPT=@echo $$(CFLAGS)' ARCH=um) +-endif +-UCFLAGS = -DFISTGEN -I. ${TOPINC} -g -O2 -Wall -Wno-unused -Werror +-endif + +-CC = $(CROSS_COMPILE)gcc +-LD = $(CROSS_COMPILE)ld ++O_TARGET := $(obj-m) ++obj-y := $(mini_fo-objs) + +-obj-m := mini_fo.o +-mini_fo-objs := meta.o dentry.o file.o inode.o main.o super.o state.o aux.o ++-include $(TOPDIR)/Rules.make ++ ++endif + + all: mini_fo$(KERNELVERSION) + +-mini_fo2.4: ${obj-m} ++mini_fo2.4: ++ $(MAKE) -C ${KERNEL_SRC} TOPDIR="${KERNEL_SRC}" SUBDIRS=$(shell pwd) modules + + mini_fo2.6: +- make -C ${KERNEL_SRC} SUBDIRS=$(PWD) modules +- +-${obj-m}: ${mini_fo-objs} +- $(LD) -o ${obj-m} -r ${mini_fo-objs} +- +-tags: +- ctags -R -e ++ $(MAKE) -C ${KERNEL_SRC} SUBDIRS=$(shell pwd) modules + + clean: + ifeq ($(KERNELVERSION),2.6) +- -make -C ${KERNEL_SRC} SUBDIRS=$(PWD) clean ++ -$(MAKE) -C ${KERNEL_SRC} SUBDIRS=$(shell pwd) clean + endif + rm -f ${obj-m} ${mini_fo-objs} ${obj-m:.o=.ko} *.d .*.flags *~ + rm -f TAGS diff --git a/package/mini_fo/patches/102-mutex_change.patch b/package/mini_fo/patches/102-mutex_change.patch new file mode 100644 index 0000000000..4dec47bf5e --- /dev/null +++ b/package/mini_fo/patches/102-mutex_change.patch @@ -0,0 +1,602 @@ +From: <mk@mary.denx.de> +Date: Tue, 24 Jan 2006 14:09:21 +0000 (+0100) +Subject: Support for new mutex infrastructure +X-Git-Url: http://www.denx.de/cgi-bin/gitweb.cgi?p=mini_fo.git;a=commitdiff;h=1dcc028729060ea83ea662155634b33ae8e2c493 + + Support for new mutex infrastructure + (7892f2f48d165a34b0b8130c8a195dfd807b8cb6) +--- + +--- a/ChangeLog ++++ b/ChangeLog +@@ -1,3 +1,13 @@ ++2006-01-24 Markus Klotzbuecher <mk@mary.denx.de> ++ ++ * Add tons of ugly ifdefs to Ed L. Cashin's mutex patch to ++ retain backwards compatibility. ++ ++2006-01-24 Ed L. Cashin <ecashin@coraid.com> ++ ++ * Support for the new mutex infrastructure ++ (7892f2f48d165a34b0b8130c8a195dfd807b8cb6) ++ + 2005-10-15 Markus Klotzbuecher <mk@localhost.localdomain> + + * Bugfix for a serious memory leak in mini_fo_follow_link. +--- a/aux.c ++++ b/aux.c +@@ -435,8 +435,11 @@ int build_sto_structure(dentry_t *dir, d + + /* was: hidden_sto_dir_dentry = lock_parent(hidden_sto_dentry); */ + hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else + down(&hidden_sto_dir_dentry->d_inode->i_sem); +- ++#endif + /* lets be safe */ + if(dtohd2(dir) != hidden_sto_dir_dentry) { + printk(KERN_CRIT "mini_fo: build_sto_structure: invalid parameter or meta data corruption [2].\n"); +@@ -457,7 +460,11 @@ int build_sto_structure(dentry_t *dir, d + if(err) { + printk(KERN_CRIT "mini_fo: build_sto_structure: failed to create storage dir [1].\n"); + /* was: unlock_dir(dir); */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&dir->d_inode->i_mutex); ++#else + up(&dir->d_inode->i_sem); ++#endif + dput(dir); + return err; + } +@@ -466,7 +473,11 @@ int build_sto_structure(dentry_t *dir, d + if(!dtohd2(dentry)->d_inode) { + printk(KERN_CRIT "mini_fo: build_sto_structure: failed to create storage dir [2].\n"); + /* was: unlock_dir(dir); */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&dir->d_inode->i_mutex); ++#else + up(&dir->d_inode->i_sem); ++#endif + dput(dir); + return 1; + } +@@ -485,7 +496,11 @@ int build_sto_structure(dentry_t *dir, d + hidden_sto_dir_dentry->d_inode); + dir->d_inode->i_nlink++; + /* was: unlock_dir(hidden_sto_dir_dentry); */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else + up(&hidden_sto_dir_dentry->d_inode->i_sem); ++#endif + dput(hidden_sto_dir_dentry); + return 0; + } +--- a/file.c ++++ b/file.c +@@ -613,18 +613,34 @@ mini_fo_fsync(file_t *file, dentry_t *de + if ((hidden_file = ftohf(file)) != NULL) { + hidden_dentry = dtohd(dentry); + if (hidden_file->f_op && hidden_file->f_op->fsync) { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_lock(&hidden_dentry->d_inode->i_mutex); ++#else + down(&hidden_dentry->d_inode->i_sem); ++#endif + err1 = hidden_file->f_op->fsync(hidden_file, hidden_dentry, datasync); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&hidden_dentry->d_inode->i_mutex); ++#else + up(&hidden_dentry->d_inode->i_sem); ++#endif + } + } + + if ((hidden_file = ftohf2(file)) != NULL) { + hidden_dentry = dtohd2(dentry); + if (hidden_file->f_op && hidden_file->f_op->fsync) { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_lock(&hidden_dentry->d_inode->i_mutex); ++#else + down(&hidden_dentry->d_inode->i_sem); ++#endif + err2 = hidden_file->f_op->fsync(hidden_file, hidden_dentry, datasync); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&hidden_dentry->d_inode->i_mutex); ++#else + up(&hidden_dentry->d_inode->i_sem); ++#endif + } + } + else +--- a/inode.c ++++ b/inode.c +@@ -355,7 +355,11 @@ mini_fo_link(dentry_t *old_dentry, inode + + /* was: hidden_dir_dentry = lock_parent(hidden_new_dentry); */ + hidden_dir_dentry = dget(hidden_new_dentry->d_parent); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_lock(&hidden_dir_dentry->d_inode->i_mutex); ++#else + down(&hidden_dir_dentry->d_inode->i_sem); ++#endif + + err = vfs_link(hidden_old_dentry, + hidden_dir_dentry->d_inode, +@@ -374,7 +378,11 @@ mini_fo_link(dentry_t *old_dentry, inode + + out_lock: + /* was: unlock_dir(hidden_dir_dentry); */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&hidden_dir_dentry->d_inode->i_mutex); ++#else + up(&hidden_dir_dentry->d_inode->i_sem); ++#endif + dput(hidden_dir_dentry); + + dput(hidden_new_dentry); +@@ -452,7 +460,11 @@ mini_fo_symlink(inode_t *dir, dentry_t * + dget(hidden_sto_dentry); + /* was: hidden_sto_dir_dentry = lock_parent(hidden_sto_dentry); */ + hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else + down(&hidden_sto_dir_dentry->d_inode->i_sem); ++#endif + + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) + mode = S_IALLUGO; +@@ -481,7 +493,11 @@ mini_fo_symlink(inode_t *dir, dentry_t * + + out_lock: + /* was: unlock_dir(hidden_sto_dir_dentry); */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else + up(&hidden_sto_dir_dentry->d_inode->i_sem); ++#endif + dput(hidden_sto_dir_dentry); + + dput(hidden_sto_dentry); +@@ -524,7 +540,11 @@ mini_fo_rmdir(inode_t *dir, dentry_t *de + + /* was:hidden_sto_dir_dentry = lock_parent(hidden_sto_dentry); */ + hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else + down(&hidden_sto_dir_dentry->d_inode->i_sem); ++#endif + + /* avoid destroying the hidden inode if the file is in use */ + dget(hidden_sto_dentry); +@@ -572,7 +592,11 @@ mini_fo_rmdir(inode_t *dir, dentry_t *de + dentry->d_name.len); + } + /* was: unlock_dir(hidden_sto_dir_dentry); */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else + up(&hidden_sto_dir_dentry->d_inode->i_sem); ++#endif + dput(hidden_sto_dir_dentry); + goto out; + } +@@ -602,7 +626,12 @@ mini_fo_rmdir(inode_t *dir, dentry_t *de + + /* was: hidden_sto_dir_dentry = lock_parent(hidden_sto_dentry);*/ + hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent); ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else + down(&hidden_sto_dir_dentry->d_inode->i_sem); ++#endif + + /* avoid destroying the hidden inode if the file is in use */ + dget(hidden_sto_dentry); +@@ -630,7 +659,11 @@ mini_fo_rmdir(inode_t *dir, dentry_t *de + dtopd(dentry)->state = NON_EXISTANT; + + /* was: unlock_dir(hidden_sto_dir_dentry); */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else + up(&hidden_sto_dir_dentry->d_inode->i_sem); ++#endif + dput(hidden_sto_dir_dentry); + + goto out; +@@ -641,7 +674,12 @@ mini_fo_rmdir(inode_t *dir, dentry_t *de + + /* was: hidden_sto_dir_dentry = lock_parent(hidden_sto_dentry);*/ + hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent); ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else + down(&hidden_sto_dir_dentry->d_inode->i_sem); ++#endif + + /* avoid destroying the hidden inode if the file is in use */ + dget(hidden_sto_dentry); +@@ -668,7 +706,12 @@ mini_fo_rmdir(inode_t *dir, dentry_t *de + dentry->d_inode->i_nlink = itohi2(dentry->d_inode)->i_nlink; + dtopd(dentry)->state = DELETED; + /* was: unlock_dir(hidden_sto_dir_dentry); */ ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else + up(&hidden_sto_dir_dentry->d_inode->i_sem); ++#endif + dput(hidden_sto_dir_dentry); + goto out; + } +@@ -1294,11 +1337,19 @@ mini_fo_getxattr(struct dentry *dentry, + encoded_name = (char *)name; + encoded_value = (char *)value; + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_lock(&hidden_dentry->d_inode->i_mutex); ++#else + down(&hidden_dentry->d_inode->i_sem); ++#endif + /* lock_kernel() already done by caller. */ + err = hidden_dentry->d_inode->i_op->getxattr(hidden_dentry, encoded_name, encoded_value, size); + /* unlock_kernel() will be done by caller. */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_lock(&hidden_dentry->d_inode->i_mutex); ++#else + up(&hidden_dentry->d_inode->i_sem); ++#endif + } + return err; + } +@@ -1340,11 +1391,19 @@ mini_fo_setxattr(struct dentry *dentry, + encoded_name = (char *)name; + encoded_value = (char *)value; + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_lock(&hidden_dentry->d_inode->i_mutex); ++#else + down(&hidden_dentry->d_inode->i_sem); ++#endif + /* lock_kernel() already done by caller. */ + err = hidden_dentry->d_inode->i_op->setxattr(hidden_dentry, encoded_name, encoded_value, size, flags); + /* unlock_kernel() will be done by caller. */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&hidden_dentry->d_inode->i_mutex); ++#else + up(&hidden_dentry->d_inode->i_sem); ++#endif + } + return err; + } +@@ -1372,11 +1431,19 @@ mini_fo_removexattr(struct dentry *dentr + if (hidden_dentry->d_inode->i_op->removexattr) { + encoded_name = (char *)name; + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_lock(&hidden_dentry->d_inode->i_mutex); ++#else + down(&hidden_dentry->d_inode->i_sem); ++#endif + /* lock_kernel() already done by caller. */ + err = hidden_dentry->d_inode->i_op->removexattr(hidden_dentry, encoded_name); + /* unlock_kernel() will be done by caller. */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&hidden_dentry->d_inode->i_mutex); ++#else + up(&hidden_dentry->d_inode->i_sem); ++#endif + } + return err; + } +@@ -1403,11 +1470,20 @@ mini_fo_listxattr(struct dentry *dentry, + + if (hidden_dentry->d_inode->i_op->listxattr) { + encoded_list = list; ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_lock(&hidden_dentry->d_inode->i_mutex); ++#else + down(&hidden_dentry->d_inode->i_sem); ++#endif + /* lock_kernel() already done by caller. */ + err = hidden_dentry->d_inode->i_op->listxattr(hidden_dentry, encoded_list, size); + /* unlock_kernel() will be done by caller. */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&hidden_dentry->d_inode->i_mutex); ++#else + up(&hidden_dentry->d_inode->i_sem); ++#endif + } + return err; + } +--- a/meta.c ++++ b/meta.c +@@ -650,9 +650,20 @@ int meta_sync_d_list(dentry_t *dentry, i + struct iattr newattrs; + newattrs.ia_size = 0; + newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME; ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_lock(&meta_dentry->d_inode->i_mutex); ++#else + down(&meta_dentry->d_inode->i_sem); ++#endif + err = notify_change(meta_dentry, &newattrs); ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&meta_dentry->d_inode->i_mutex); ++#else + up(&meta_dentry->d_inode->i_sem); ++#endif ++ + if(err || meta_dentry->d_inode->i_size != 0) { + printk(KERN_CRIT "mini_fo: meta_sync_d_list: \ + ERROR truncating meta file.\n"); +@@ -780,9 +791,19 @@ int meta_sync_r_list(dentry_t *dentry, i + struct iattr newattrs; + newattrs.ia_size = 0; + newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME; ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_lock(&meta_dentry->d_inode->i_mutex); ++#else + down(&meta_dentry->d_inode->i_sem); ++#endif + err = notify_change(meta_dentry, &newattrs); ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&meta_dentry->d_inode->i_mutex); ++#else + up(&meta_dentry->d_inode->i_sem); ++#endif + if(err || meta_dentry->d_inode->i_size != 0) { + printk(KERN_CRIT "mini_fo: meta_sync_r_list: \ + ERROR truncating meta file.\n"); +--- a/mini_fo.h ++++ b/mini_fo.h +@@ -433,6 +433,33 @@ fist_copy_attr_all(inode_t *dest, const + + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) + /* copied from linux/fs.h */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++static inline void double_lock(struct dentry *d1, struct dentry *d2) ++{ ++ struct mutex *m1 = &d1->d_inode->i_mutex; ++ struct mutex *m2 = &d2->d_inode->i_mutex; ++ if (m1 != m2) { ++ if ((unsigned long) m1 < (unsigned long) m2) { ++ struct mutex *tmp = m2; ++ m2 = m1; m1 = tmp; ++ } ++ mutex_lock(m1); ++ } ++ mutex_lock(m2); ++} ++ ++static inline void double_unlock(struct dentry *d1, struct dentry *d2) ++{ ++ struct mutex *m1 = &d1->d_inode->i_mutex; ++ struct mutex *m2 = &d2->d_inode->i_mutex; ++ mutex_unlock(m1); ++ if (m1 != m2) ++ mutex_unlock(m2); ++ dput(d1); ++ dput(d2); ++} ++ ++#else + static inline void double_down(struct semaphore *s1, struct semaphore *s2) + { + if (s1 != s2) { +@@ -463,8 +490,8 @@ static inline void double_unlock(struct + dput(d1); + dput(d2); + } +- +-#endif ++#endif /* if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) */ ++#endif /* if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) */ + #endif /* __KERNEL__ */ + + /* +--- a/mmap.c ++++ b/mmap.c +@@ -478,7 +478,11 @@ mini_fo_commit_write(file_t *file, page_ + if (ftopd(file) != NULL) + hidden_file = ftohf(file); + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_lock(&hidden_inode->i_mutex); ++#else + down(&hidden_inode->i_sem); ++#endif + /* find lower page (returns a locked page) */ + hidden_page = grab_cache_page(hidden_inode->i_mapping, page->index); + if (!hidden_page) +@@ -556,7 +560,12 @@ mini_fo_commit_write(file_t *file, page_ + ClearPageUptodate(page); + else + SetPageUptodate(page); ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&hidden_inode->i_mutex); ++#else + up(&hidden_inode->i_sem); ++#endif + print_exit_status(err); + return err; /* assume all is ok */ + } +--- a/state.c ++++ b/state.c +@@ -44,7 +44,12 @@ int create_sto_reg_file(dentry_t *dentry + + /* lock parent */ + hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent); ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else + down(&hidden_sto_dir_dentry->d_inode->i_sem); ++#endif + + err = PTR_ERR(hidden_sto_dir_dentry); + if (IS_ERR(hidden_sto_dir_dentry)) +@@ -97,7 +102,11 @@ int create_sto_reg_file(dentry_t *dentry + hidden_sto_dir_dentry->d_inode); + + out_lock: ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else + up(&hidden_sto_dir_dentry->d_inode->i_sem); ++#endif + dput(hidden_sto_dir_dentry); + out: + return err; +@@ -130,7 +139,12 @@ n"); + + /* was: hidden_sto_dir_dentry = lock_parent(hidden_sto_dentry); */ + hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent); ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else + down(&hidden_sto_dir_dentry->d_inode->i_sem); ++#endif + + err = PTR_ERR(hidden_sto_dir_dentry); + if (IS_ERR(hidden_sto_dir_dentry)) +@@ -184,7 +198,11 @@ n"); + + out_lock: + /* was: unlock_dir(hidden_sto_dir_dentry); */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else + up(&hidden_sto_dir_dentry->d_inode->i_sem); ++#endif + dput(hidden_sto_dir_dentry); + out: + return err; +@@ -217,7 +235,12 @@ int create_sto_nod(dentry_t *dentry, int + + /* lock parent */ + hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent); ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else + down(&hidden_sto_dir_dentry->d_inode->i_sem); ++#endif + + err = PTR_ERR(hidden_sto_dir_dentry); + if (IS_ERR(hidden_sto_dir_dentry)) +@@ -260,7 +283,11 @@ int create_sto_nod(dentry_t *dentry, int + fist_copy_attr_timesizes(dir, hidden_sto_dir_dentry->d_inode); + + out_lock: ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else + up(&hidden_sto_dir_dentry->d_inode->i_sem); ++#endif + dput(hidden_sto_dir_dentry); + out: + return err; +@@ -314,7 +341,12 @@ int nondir_unmod_to_mod(dentry_t *dentry + + /* lock parent */ + hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent); ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else + down(&hidden_sto_dir_dentry->d_inode->i_sem); ++#endif + + err = PTR_ERR(hidden_sto_dir_dentry); + if (IS_ERR(hidden_sto_dir_dentry)) +@@ -365,7 +397,12 @@ int nondir_unmod_to_mod(dentry_t *dentry + if((cp_flag == 1) && S_ISREG(dentry->d_inode->i_mode)) { + + /* unlock first */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else + up(&hidden_sto_dir_dentry->d_inode->i_sem); ++#endif ++ + dput(hidden_sto_dir_dentry); + + tgt_dentry = dtohd2(dentry); +@@ -383,7 +420,11 @@ int nondir_unmod_to_mod(dentry_t *dentry + } + + out_lock: ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else + up(&hidden_sto_dir_dentry->d_inode->i_sem); ++#endif + dput(hidden_sto_dir_dentry); + out: + return err; +@@ -420,7 +461,12 @@ int nondir_creat_to_del(dentry_t *dentry + + /* was: hidden_sto_dir_dentry = lock_parent(hidden_sto_dentry);*/ + hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent); ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else + down(&hidden_sto_dir_dentry->d_inode->i_sem); ++#endif + + /* avoid destroying the hidden inode if the file is in use */ + dget(hidden_sto_dentry); +@@ -435,7 +481,11 @@ int nondir_creat_to_del(dentry_t *dentry + dtost(dentry) = NON_EXISTANT; + + /* was: unlock_dir(hidden_sto_dir_dentry); */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else + up(&hidden_sto_dir_dentry->d_inode->i_sem); ++#endif + dput(hidden_sto_dir_dentry); + + out: +@@ -464,7 +514,12 @@ int nondir_mod_to_del(dentry_t *dentry) + + /* was hidden_sto_dir_dentry = lock_parent(hidden_sto_dentry); */ + hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent); ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else + down(&hidden_sto_dir_dentry->d_inode->i_sem); ++#endif + + /* avoid destroying the hidden inode if the file is in use */ + dget(hidden_sto_dentry); +@@ -488,7 +543,11 @@ int nondir_mod_to_del(dentry_t *dentry) + dentry->d_name.len); + + /* was: unlock_dir(hidden_sto_dir_dentry); */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex); ++#else + up(&hidden_sto_dir_dentry->d_inode->i_sem); ++#endif + dput(hidden_sto_dir_dentry); + + out: + diff --git a/package/mini_fo/patches/103-remove_dead_code.patch b/package/mini_fo/patches/103-remove_dead_code.patch new file mode 100644 index 0000000000..cf81601741 --- /dev/null +++ b/package/mini_fo/patches/103-remove_dead_code.patch @@ -0,0 +1,47 @@ +From: Markus Klotzbuecher <mk@creamnet.de> +Date: Tue, 20 Jun 2006 14:50:26 +0000 (+0200) +Subject: Removed some dead code (mini_fo_lock) that caused compiling to fail on +X-Git-Url: http://www.denx.de/cgi-bin/gitweb.cgi?p=mini_fo.git;a=commitdiff;h=240ede43ad8342334494d36d6d762666f75a1c8e + +Removed some dead code (mini_fo_lock) that caused compiling to fail on +recent kernels. +--- + +--- a/file.c ++++ b/file.c +@@ -668,35 +668,6 @@ mini_fo_fasync(int fd, file_t *file, int + return (err1 || err2); + } + +- +-STATIC int +-mini_fo_lock(file_t *file, int cmd, struct file_lock *fl) +-{ +- int err = -EINVAL; +- file_t *hidden_file = NULL; +- +- if(!check_mini_fo_file(file)) +- goto out; +- +- /* which file shall we lock? */ +- if(ftohf2(file)) +- hidden_file = ftohf2(file); +- else +- hidden_file = ftohf(file); +- +- if (hidden_file->f_op->lock) { +- fl->fl_file = hidden_file; +- err = hidden_file->f_op->lock(hidden_file, F_GETLK, fl); +- fl->fl_file = file; +- } else { +- if(posix_test_lock(hidden_file, fl)) +- err = 0; +- } +- out: +- return err; +-} +- +- + struct file_operations mini_fo_dir_fops = + { + llseek: mini_fo_llseek, diff --git a/package/mtd/Makefile b/package/mtd/Makefile new file mode 100644 index 0000000000..00d347fad5 --- /dev/null +++ b/package/mtd/Makefile @@ -0,0 +1,38 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=mtd +PKG_RELEASE:=4 + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/mtd + SECTION:=utils + CATEGORY:=Base system + DEFAULT:=y + TITLE:=Update utility for trx firmware images + DESCRIPTION:=\ + This package contains an utility useful to upgrade from other firmware or \\\ + older OpenWrt releases. +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) + $(CP) ./src/* $(PKG_BUILD_DIR)/ +endef + +define Package/mtd/install + install -d -m0755 $(1)/sbin + install -m0755 $(PKG_BUILD_DIR)/mtd $(1)/sbin/ +endef + +$(eval $(call BuildPackage,mtd)) diff --git a/package/mtd/src/Makefile b/package/mtd/src/Makefile new file mode 100644 index 0000000000..b9f256ad0c --- /dev/null +++ b/package/mtd/src/Makefile @@ -0,0 +1,12 @@ +# $Id$ + +all: mtd + +%.o: %.c + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $^ + +mtd: mtd.o + $(CC) -o $@ $^ + +clean: + rm -f *.o mtd diff --git a/package/mtd/src/mtd.c b/package/mtd/src/mtd.c new file mode 100644 index 0000000000..23e99160a1 --- /dev/null +++ b/package/mtd/src/mtd.c @@ -0,0 +1,475 @@ +/* + * mtd - simple memory technology device manipulation tool + * + * Copyright (C) 2005 Waldemar Brodkorb <wbx@dass-it.de>, + * Felix Fietkau <nbd@openwrt.org> + * + * 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 the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * + * The code is based on the linux-mtd examples. + */ + +#include <limits.h> +#include <unistd.h> +#include <stdlib.h> +#include <stdio.h> +#include <stdint.h> +#include <fcntl.h> +#include <errno.h> +#include <error.h> +#include <time.h> +#include <sys/ioctl.h> +#include <sys/types.h> +#include <sys/param.h> +#include <sys/mount.h> +#include <sys/stat.h> +#include <sys/reboot.h> +#include <string.h> + +#include <linux/mtd/mtd.h> + +#define TRX_MAGIC 0x30524448 /* "HDR0" */ +#define BUFSIZE (16 * 1024) +#define MAX_ARGS 8 + +#define DEBUG + +#define SYSTYPE_UNKNOWN 0 +#define SYSTYPE_BROADCOM 1 +/* to be continued */ + +struct trx_header { + uint32_t magic; /* "HDR0" */ + uint32_t len; /* Length of file including header */ + uint32_t crc32; /* 32-bit CRC from flag_version to end of file */ + uint32_t flag_version; /* 0:15 flags, 16:31 version */ + uint32_t offsets[3]; /* Offsets of partitions from start of header */ +}; + +char buf[BUFSIZE]; +int buflen; + +int +image_check_bcom(int imagefd, const char *mtd) +{ + struct trx_header *trx = (struct trx_header *) buf; + struct mtd_info_user mtdInfo; + int fd; + + buflen = read(imagefd, buf, 32); + if (buflen < 32) { + fprintf(stdout, "Could not get image header, file too small (%ld bytes)\n", buflen); + return 0; + } + + switch(trx->magic) { + case 0x47343557: /* W54G */ + case 0x53343557: /* W54S */ + case 0x73343557: /* W54s */ + case 0x46343557: /* W54F */ + case 0x55343557: /* W54U */ + /* ignore the first 32 bytes */ + buflen = read(imagefd, buf, sizeof(struct trx_header)); + break; + } + + if (trx->magic != TRX_MAGIC || trx->len < sizeof(struct trx_header)) { + fprintf(stderr, "Bad trx header\n"); + fprintf(stderr, "If this is a firmware in bin format, like some of the\n" + "original firmware files are, use following command to convert to trx:\n" + "dd if=firmware.bin of=firmware.trx bs=32 skip=1\n"); + return 0; + } + + /* check if image fits to mtd device */ + fd = mtd_open(mtd, O_RDWR | O_SYNC); + if(fd < 0) { + fprintf(stderr, "Could not open mtd device: %s\n", mtd); + exit(1); + } + + if(ioctl(fd, MEMGETINFO, &mtdInfo)) { + fprintf(stderr, "Could not get MTD device info from %s\n", mtd); + exit(1); + } + + if(mtdInfo.size < trx->len) { + fprintf(stderr, "Image too big for partition: %s\n", mtd); + close(fd); + return 0; + } + + close(fd); + return 1; +} + +int +image_check(int imagefd, const char *mtd) +{ + int fd, systype; + size_t count; + char *c; + FILE *f; + + systype = SYSTYPE_UNKNOWN; + f = fopen("/proc/cpuinfo", "r"); + while (!feof(f) && (fgets(buf, BUFSIZE - 1, f) != NULL)) { + if ((strncmp(buf, "system type", 11) == 0) && (c = strchr(buf, ':'))) { + c += 2; + if (strncmp(c, "Broadcom BCM947XX", 17) == 0) + systype = SYSTYPE_BROADCOM; + } + } + fclose(f); + + switch(systype) { + case SYSTYPE_BROADCOM: + return image_check_bcom(imagefd, mtd); + default: + return 1; + } +} + +int mtd_check(char *mtd) +{ + struct mtd_info_user mtdInfo; + int fd; + + fd = mtd_open(mtd, O_RDWR | O_SYNC); + if(fd < 0) { + fprintf(stderr, "Could not open mtd device: %s\n", mtd); + return 0; + } + + if(ioctl(fd, MEMGETINFO, &mtdInfo)) { + fprintf(stderr, "Could not get MTD device info from %s\n", mtd); + close(fd); + return 0; + } + + close(fd); + return 1; +} + +int +mtd_unlock(const char *mtd) +{ + int fd; + struct mtd_info_user mtdInfo; + struct erase_info_user mtdLockInfo; + + fd = mtd_open(mtd, O_RDWR | O_SYNC); + if(fd < 0) { + fprintf(stderr, "Could not open mtd device: %s\n", mtd); + exit(1); + } + + if(ioctl(fd, MEMGETINFO, &mtdInfo)) { + fprintf(stderr, "Could not get MTD device info from %s\n", mtd); + close(fd); + exit(1); + } + + mtdLockInfo.start = 0; + mtdLockInfo.length = mtdInfo.size; + if(ioctl(fd, MEMUNLOCK, &mtdLockInfo)) { + close(fd); + return 0; + } + + close(fd); + return 0; +} + +int +mtd_open(const char *mtd, int flags) +{ + FILE *fp; + char dev[PATH_MAX]; + int i; + + if ((fp = fopen("/proc/mtd", "r"))) { + while (fgets(dev, sizeof(dev), fp)) { + if (sscanf(dev, "mtd%d:", &i) && strstr(dev, mtd)) { + snprintf(dev, sizeof(dev), "/dev/mtd/%d", i); + fclose(fp); + return open(dev, flags); + } + } + fclose(fp); + } + + return open(mtd, flags); +} + +int +mtd_erase(const char *mtd) +{ + int fd; + struct mtd_info_user mtdInfo; + struct erase_info_user mtdEraseInfo; + + fd = mtd_open(mtd, O_RDWR | O_SYNC); + if(fd < 0) { + fprintf(stderr, "Could not open mtd device: %s\n", mtd); + exit(1); + } + + if(ioctl(fd, MEMGETINFO, &mtdInfo)) { + fprintf(stderr, "Could not get MTD device info from %s\n", mtd); + close(fd); + exit(1); + } + + mtdEraseInfo.length = mtdInfo.erasesize; + + for (mtdEraseInfo.start = 0; + mtdEraseInfo.start < mtdInfo.size; + mtdEraseInfo.start += mtdInfo.erasesize) { + + ioctl(fd, MEMUNLOCK, &mtdEraseInfo); + if(ioctl(fd, MEMERASE, &mtdEraseInfo)) { + fprintf(stderr, "Could not erase MTD device: %s\n", mtd); + close(fd); + exit(1); + } + } + + close(fd); + return 0; + +} + +int +mtd_write(int imagefd, const char *mtd, int quiet) +{ + int fd, i, result; + size_t r, w, e; + struct mtd_info_user mtdInfo; + struct erase_info_user mtdEraseInfo; + int ret = 0; + + fd = mtd_open(mtd, O_RDWR | O_SYNC); + if(fd < 0) { + fprintf(stderr, "Could not open mtd device: %s\n", mtd); + exit(1); + } + + if(ioctl(fd, MEMGETINFO, &mtdInfo)) { + fprintf(stderr, "Could not get MTD device info from %s\n", mtd); + close(fd); + exit(1); + } + + r = w = e = 0; + if (!quiet) + fprintf(stderr, " [ ]"); + + for (;;) { + /* buffer may contain data already (from trx check) */ + r = buflen; + r += read(imagefd, buf + buflen, BUFSIZE - buflen); + w += r; + + /* EOF */ + if (r <= 0) break; + + /* need to erase the next block before writing data to it */ + while (w > e) { + mtdEraseInfo.start = e; + mtdEraseInfo.length = mtdInfo.erasesize; + + if (!quiet) + fprintf(stderr, "\b\b\b[e]"); + /* erase the chunk */ + if (ioctl (fd,MEMERASE,&mtdEraseInfo) < 0) { + fprintf(stderr, "Erasing mtd failed: %s\n", mtd); + exit(1); + } + e += mtdInfo.erasesize; + } + + if (!quiet) + fprintf(stderr, "\b\b\b[w]"); + + if ((result = write(fd, buf, r)) < r) { + if (result < 0) { + fprintf(stderr, "Error writing image.\n"); + exit(1); + } else { + fprintf(stderr, "Insufficient space.\n"); + exit(1); + } + } + + buflen = 0; + } + if (!quiet) + fprintf(stderr, "\b\b\b\b"); + + close(fd); + return 0; +} + +void usage(void) +{ + fprintf(stderr, "Usage: mtd [<options> ...] <command> [<arguments> ...] <device>\n\n" + "The device is in the format of mtdX (eg: mtd4) or its label.\n" + "mtd recognizes these commands:\n" + " unlock unlock the device\n" + " erase erase all data on device\n" + " write <imagefile>|- write <imagefile> (use - for stdin) to device\n" + "Following options are available:\n" + " -q quiet mode (once: no [w] on writing,\n" + " twice: no status messages)\n" + " -r reboot after successful command\n" + " -f force write without trx checks\n" + " -e <device> erase <device> before executing the command\n\n" + "Example: To write linux.trx to mtd4 labeled as linux and reboot afterwards\n" + " mtd -r write linux.trx linux\n\n"); + exit(1); +} + +int main (int argc, char **argv) +{ + int ch, i, boot, unlock, imagefd, force, quiet, unlocked; + char *erase[MAX_ARGS], *device, *imagefile; + enum { + CMD_ERASE, + CMD_WRITE, + CMD_UNLOCK + } cmd; + + erase[0] = NULL; + boot = 0; + force = 0; + buflen = 0; + quiet = 0; + + while ((ch = getopt(argc, argv, "frqe:")) != -1) + switch (ch) { + case 'f': + force = 1; + break; + case 'r': + boot = 1; + break; + case 'q': + quiet++; + break; + case 'e': + i = 0; + while ((erase[i] != NULL) && ((i + 1) < MAX_ARGS)) + i++; + + erase[i++] = optarg; + erase[i] = NULL; + break; + + case '?': + default: + usage(); + } + argc -= optind; + argv += optind; + + if (argc < 2) + usage(); + + if ((strcmp(argv[0], "unlock") == 0) && (argc == 2)) { + cmd = CMD_UNLOCK; + device = argv[1]; + } else if ((strcmp(argv[0], "erase") == 0) && (argc == 2)) { + cmd = CMD_ERASE; + device = argv[1]; + } else if ((strcmp(argv[0], "write") == 0) && (argc == 3)) { + cmd = CMD_WRITE; + device = argv[2]; + + if (strcmp(argv[1], "-") == 0) { + imagefile = "<stdin>"; + imagefd = 0; + } else { + imagefile = argv[1]; + if ((imagefd = open(argv[1], O_RDONLY)) < 0) { + fprintf(stderr, "Couldn't open image file: %s!\n", imagefile); + exit(1); + } + } + + /* check trx file before erasing or writing anything */ + if (!image_check(imagefd, device)) { + if ((quiet < 2) || !force) + fprintf(stderr, "TRX check failed!\n"); + if (!force) + exit(1); + } else { + if (!mtd_check(device)) { + fprintf(stderr, "Can't open device for writing!\n"); + exit(1); + } + } + } else { + usage(); + } + + sync(); + + i = 0; + unlocked = 0; + while (erase[i] != NULL) { + if (quiet < 2) + fprintf(stderr, "Unlocking %s ...\n", erase[i]); + mtd_unlock(erase[i]); + if (quiet < 2) + fprintf(stderr, "Erasing %s ...\n", erase[i]); + mtd_erase(erase[i]); + if (strcmp(erase[i], device) == 0) + unlocked = 1; + i++; + } + + if (!unlocked) { + if (quiet < 2) + fprintf(stderr, "Unlocking %s ...\n", device); + mtd_unlock(device); + } + + switch (cmd) { + case CMD_UNLOCK: + break; + case CMD_ERASE: + if (quiet < 2) + fprintf(stderr, "Erasing %s ...\n", device); + mtd_erase(device); + break; + case CMD_WRITE: + if (quiet < 2) + fprintf(stderr, "Writing from %s to %s ... ", imagefile, device); + mtd_write(imagefd, device, quiet); + if (quiet < 2) + fprintf(stderr, "\n"); + break; + } + + sync(); + + if (boot) + kill(1, 15); // send SIGTERM to init for reboot + + return 0; +} diff --git a/package/nvram/Makefile b/package/nvram/Makefile new file mode 100644 index 0000000000..ab33c11514 --- /dev/null +++ b/package/nvram/Makefile @@ -0,0 +1,49 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=nvram +PKG_RELEASE:=1 + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/nvram + SECTION:=utils + CATEGORY:=Utilities + DEPENDS:=@LINUX_2_4_BRCM + TITLE:=Broadcom config utility + DESCRIPTION:=\ + This package contains an utility to control broadcom's 'nvram' config \\\ + area. +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) + $(CP) ./src/* $(PKG_BUILD_DIR) +endef + +define Build/InstallDev + mkdir -p $(STAGING_DIR)/usr/lib + $(CP) $(PKG_BUILD_DIR)/lib{nvram,shared}*.so $(STAGING_DIR)/usr/lib/ +endef + +define Build/UninstallDev + rm -f $(STAGING_DIR)/usr/lib/lib{nvram,shared}*.so +endef + +define Package/nvram/install + install -d -m0755 $(1)/usr/lib + $(CP) $(PKG_BUILD_DIR)/lib{nvram,shared}*.so $(1)/usr/lib/ + install -d -m0755 $(1)/usr/sbin + install -m0755 $(PKG_BUILD_DIR)/nvram $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,nvram)) diff --git a/package/nvram/src/Makefile b/package/nvram/src/Makefile new file mode 100644 index 0000000000..3d98209e85 --- /dev/null +++ b/package/nvram/src/Makefile @@ -0,0 +1,21 @@ +# $Id$ + +LIBSHARED_OBJS := shutils.o wl.o wl_linux.o defaults.o linux_timer.o +LIBNVRAM_OBJS := nvram_linux.o nvram_convert.o + +all: libshared.so libnvram.so nvram + +%.o: %.c + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -I. -Iinclude -o $@ $^ + +libshared.so: $(LIBSHARED_OBJS) + $(CC) -shared -o $@ $^ + +libnvram.so: $(LIBNVRAM_OBJS) + $(CC) -shared -o $@ $^ + +nvram: main.o + $(CC) -o $@ $^ -L. -lnvram + +clean: + rm -f *.o *.so nvram diff --git a/package/nvram/src/bcmtimer.h b/package/nvram/src/bcmtimer.h new file mode 100644 index 0000000000..3db9e624f9 --- /dev/null +++ b/package/nvram/src/bcmtimer.h @@ -0,0 +1,42 @@ +/* + * Copyright 2004, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * + * Low resolution timer interface. Timer handlers may be called + * in a deferred manner in a different task context after the + * timer expires or in the task context from which the timer + * was created, depending on the implementation. + * + * $Id$ + */ +#ifndef __bcmtimer_h__ +#define __bcmtimer_h__ + +/* ANSI headers */ +#include <time.h> + +/* timer ID */ +typedef unsigned int bcm_timer_module_id; +typedef unsigned int bcm_timer_id; + +/* timer callback */ +typedef void (*bcm_timer_cb)(bcm_timer_id id, int data); + +/* OS-independant interfaces, applications should call these functions only */ +int bcm_timer_module_init(int timer_entries, bcm_timer_module_id *module_id); +int bcm_timer_module_cleanup(bcm_timer_module_id module_id); +int bcm_timer_module_enable(bcm_timer_module_id module_id, int enable); +int bcm_timer_create(bcm_timer_module_id module_id, bcm_timer_id *timer_id); +int bcm_timer_delete(bcm_timer_id timer_id); +int bcm_timer_gettime(bcm_timer_id timer_id, struct itimerspec *value); +int bcm_timer_settime(bcm_timer_id timer_id, const struct itimerspec *value); +int bcm_timer_connect(bcm_timer_id timer_id, bcm_timer_cb func, int data); +int bcm_timer_cancel(bcm_timer_id timer_id); +int bcm_timer_change_expirytime(bcm_timer_id timer_id, const struct itimerspec *timer_spec); + +#endif /* #ifndef __bcmtimer_h__ */ diff --git a/package/nvram/src/defaults.c b/package/nvram/src/defaults.c new file mode 100644 index 0000000000..119eaac72e --- /dev/null +++ b/package/nvram/src/defaults.c @@ -0,0 +1,179 @@ +/* + * Router default NVRAM values + * + * Copyright 2004, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * + * $Id$ + */ + +#include <epivers.h> +#include <string.h> +#include <bcmnvram.h> +#include <typedefs.h> +#include <wlioctl.h> + +#define XSTR(s) STR(s) +#define STR(s) #s + +struct nvram_tuple router_defaults[] = { + /* OS parameters */ + { "os_name", "", 0 }, /* OS name string */ + { "os_version", EPI_VERSION_STR, 0 }, /* OS revision */ + { "os_date", __DATE__, 0 }, /* OS date */ + + /* Miscellaneous parameters */ + { "timer_interval", "3600", 0 }, /* Timer interval in seconds */ + { "ntp_server", "192.5.41.40 192.5.41.41 133.100.9.2", 0 }, /* NTP server */ + { "time_zone", "PST8PDT", 0 }, /* Time zone (GNU TZ format) */ + { "log_level", "0", 0 }, /* Bitmask 0:off 1:denied 2:accepted */ + { "upnp_enable", "0", 0 }, /* Start UPnP */ + { "ezc_enable", "1", 0 }, /* Enable EZConfig updates */ + { "ezc_version", "1", 0 }, /* EZConfig version */ + { "is_default", "1", 0 }, /* is it default setting: 1:yes 0:no*/ + { "os_server", "", 0 }, /* URL for getting upgrades */ + { "stats_server", "", 0 }, /* URL for posting stats */ + { "console_loglevel", "1", 0 }, /* Kernel panics only */ + + /* Big switches */ + { "router_disable", "0", 0 }, /* lan_proto=static lan_stp=0 wan_proto=disabled */ + { "fw_disable", "0", 0 }, /* Disable firewall (allow new connections from the WAN) */ + + { "log_ipaddr", "", 0 }, /* syslog recipient */ + + /* LAN H/W parameters */ + { "lan_ifname", "", 0 }, /* LAN interface name */ + { "lan_ifnames", "", 0 }, /* Enslaved LAN interfaces */ + { "lan_hwnames", "", 0 }, /* LAN driver names (e.g. et0) */ + { "lan_hwaddr", "", 0 }, /* LAN interface MAC address */ + + /* LAN TCP/IP parameters */ + { "lan_proto", "dhcp", 0 }, /* [static|dhcp] */ + { "lan_ipaddr", "192.168.1.1", 0 }, /* LAN IP address */ + { "lan_netmask", "255.255.255.0", 0 }, /* LAN netmask */ + { "lan_stp", "0", 0 }, /* LAN spanning tree protocol */ + { "lan_wins", "", 0 }, /* x.x.x.x x.x.x.x ... */ + { "lan_domain", "", 0 }, /* LAN domain name */ + { "lan_lease", "86400", 0 }, /* LAN lease time in seconds */ + + /* WAN H/W parameters */ + { "wan_ifname", "", 0 }, /* WAN interface name */ + { "wan_ifnames", "", 0 }, /* WAN interface names */ + { "wan_hwname", "", 0 }, /* WAN driver name (e.g. et1) */ + { "wan_hwaddr", "", 0 }, /* WAN interface MAC address */ + + /* WAN TCP/IP parameters */ + { "wan_proto", "dhcp", 0 }, /* [static|dhcp|pppoe|disabled] */ + { "wan_ipaddr", "0.0.0.0", 0 }, /* WAN IP address */ + { "wan_netmask", "0.0.0.0", 0 }, /* WAN netmask */ + { "wan_gateway", "0.0.0.0", 0 }, /* WAN gateway */ + { "wan_dns", "", 0 }, /* x.x.x.x x.x.x.x ... */ + { "wan_wins", "", 0 }, /* x.x.x.x x.x.x.x ... */ + { "wan_hostname", "", 0 }, /* WAN hostname */ + { "wan_domain", "", 0 }, /* WAN domain name */ + { "wan_lease", "86400", 0 }, /* WAN lease time in seconds */ + + /* PPPoE parameters */ + { "wan_pppoe_ifname", "", 0 }, /* PPPoE enslaved interface */ + { "wan_pppoe_username", "", 0 }, /* PPP username */ + { "wan_pppoe_passwd", "", 0 }, /* PPP password */ + { "wan_pppoe_idletime", "60", 0 }, /* Dial on demand max idle time (seconds) */ + { "wan_pppoe_keepalive", "0", 0 }, /* Restore link automatically */ + { "wan_pppoe_demand", "0", 0 }, /* Dial on demand */ + { "wan_pppoe_mru", "1492", 0 }, /* Negotiate MRU to this value */ + { "wan_pppoe_mtu", "1492", 0 }, /* Negotiate MTU to the smaller of this value or the peer MRU */ + { "wan_pppoe_service", "", 0 }, /* PPPoE service name */ + { "wan_pppoe_ac", "", 0 }, /* PPPoE access concentrator name */ + + /* Misc WAN parameters */ + { "wan_desc", "", 0 }, /* WAN connection description */ + { "wan_route", "", 0 }, /* Static routes (ipaddr:netmask:gateway:metric:ifname ...) */ + { "wan_primary", "0", 0 }, /* Primary wan connection */ + + { "wan_unit", "0", 0 }, /* Last configured connection */ + + /* Filters */ + { "filter_maclist", "", 0 }, /* xx:xx:xx:xx:xx:xx ... */ + { "filter_macmode", "deny", 0 }, /* "allow" only, "deny" only, or "disabled" (allow all) */ + { "filter_client0", "", 0 }, /* [lan_ipaddr0-lan_ipaddr1|*]:lan_port0-lan_port1,proto,enable,day_start-day_end,sec_start-sec_end,desc */ + + /* Port forwards */ + { "dmz_ipaddr", "", 0 }, /* x.x.x.x (equivalent to 0-60999>dmz_ipaddr:0-60999) */ + { "forward_port0", "", 0 }, /* wan_port0-wan_port1>lan_ipaddr:lan_port0-lan_port1[:,]proto[:,]enable[:,]desc */ + { "autofw_port0", "", 0 }, /* out_proto:out_port,in_proto:in_port0-in_port1>to_port0-to_port1,enable,desc */ + + /* DHCP server parameters */ + { "dhcp_start", "192.168.1.100", 0 }, /* First assignable DHCP address */ + { "dhcp_end", "192.168.1.150", 0 }, /* Last assignable DHCP address */ + { "dhcp_domain", "wan", 0 }, /* Use WAN domain name first if available (wan|lan) */ + { "dhcp_wins", "wan", 0 }, /* Use WAN WINS first if available (wan|lan) */ + + /* Web server parameters */ + { "http_username", "", 0 }, /* Username */ + { "http_passwd", "admin", 0 }, /* Password */ + { "http_wanport", "", 0 }, /* WAN port to listen on */ + { "http_lanport", "80", 0 }, /* LAN port to listen on */ + + /* Wireless parameters */ + { "wl_ifname", "", 0 }, /* Interface name */ + { "wl_hwaddr", "", 0 }, /* MAC address */ + { "wl_phytype", "g", 0 }, /* Current wireless band ("a" (5 GHz), "b" (2.4 GHz), or "g" (2.4 GHz)) */ + { "wl_corerev", "", 0 }, /* Current core revision */ + { "wl_phytypes", "", 0 }, /* List of supported wireless bands (e.g. "ga") */ + { "wl_radioids", "", 0 }, /* List of radio IDs */ + { "wl_ssid", "OpenWrt", 0 }, /* Service set ID (network name) */ + { "wl_country", "", 0 }, /* Country (default obtained from driver) */ + { "wl_radio", "1", 0 }, /* Enable (1) or disable (0) radio */ + { "wl_closed", "0", 0 }, /* Closed (hidden) network */ + { "wl_ap_isolate", "0", 0 }, /* AP isolate mode */ + { "wl_mode", "ap", 0 }, /* AP mode (ap|sta|wds) */ + { "wl_lazywds", "0", 0 }, /* Enable "lazy" WDS mode (0|1) */ + { "wl_wds", "", 0 }, /* xx:xx:xx:xx:xx:xx ... */ + { "wl_wep", "disabled", 0 }, /* WEP data encryption (enabled|disabled) */ + { "wl_auth", "0", 0 }, /* Shared key authentication optional (0) or required (1) */ + { "wl_key", "1", 0 }, /* Current WEP key */ + { "wl_key1", "", 0 }, /* 5/13 char ASCII or 10/26 char hex */ + { "wl_key2", "", 0 }, /* 5/13 char ASCII or 10/26 char hex */ + { "wl_key3", "", 0 }, /* 5/13 char ASCII or 10/26 char hex */ + { "wl_key4", "", 0 }, /* 5/13 char ASCII or 10/26 char hex */ + { "wl_maclist", "", 0 }, /* xx:xx:xx:xx:xx:xx ... */ + { "wl_macmode", "disabled", 0 }, /* "allow" only, "deny" only, or "disabled" (allow all) */ + { "wl_channel", "11", 0 }, /* Channel number */ + { "wl_rate", "0", 0 }, /* Rate (bps, 0 for auto) */ + { "wl_rateset", "default", 0 }, /* "default" or "all" or "12" */ + { "wl_frag", "2346", 0 }, /* Fragmentation threshold */ + { "wl_rts", "2347", 0 }, /* RTS threshold */ + { "wl_dtim", "1", 0 }, /* DTIM period */ + { "wl_bcn", "100", 0 }, /* Beacon interval */ + { "wl_plcphdr", "long", 0 }, /* 802.11b PLCP preamble type */ + { "wl_net_mode", "mixed", 0 }, /* 54g mode */ + { "wl_gmode", "6", 0 }, /* 54g mode */ + { "wl_gmode_protection", "auto", 0 }, /* 802.11g RTS/CTS protection (off|auto) */ + { "wl_afterburner", "auto", 0 }, /* AfterBurner */ + { "wl_frameburst", "off", 0 }, /* BRCM Frambursting mode (off|on) */ + { "wl_antdiv", "-1", 0 }, /* Antenna Diversity (-1|0|1|3) */ + { "wl_infra", "1", 0 }, /* Network Type (BSS/IBSS) */ + + /* WPA parameters */ + { "security_mode", "open", 0 }, + { "wl_auth_mode", "open", 0 }, /* Network authentication mode (open|shared|radius|wpa|psk) */ + { "wl_wpa_psk", "", 0 }, /* WPA pre-shared key */ + { "wl_wpa_gtk_rekey", "3600", 0 }, /* GTK rotation interval */ + { "wl_radius_ipaddr", "", 0 }, /* RADIUS server IP address */ + { "wl_radius_key", "", 0 }, /* RADIUS shared secret */ + { "wl_radius_port", "1812", 0 }, /* RADIUS server UDP port */ + { "wl_crypto", "tkip", 0 }, /* WPA data encryption */ + + + { "wl_unit", "0", 0 }, /* Last configured interface */ + + /* Restore defaults */ + { "restore_defaults", "0", 0 }, /* Set to 0 to not restore defaults on boot */ + + { 0, 0, 0 } +}; diff --git a/package/nvram/src/include/bcmnvram.h b/package/nvram/src/include/bcmnvram.h new file mode 100644 index 0000000000..3c452634e8 --- /dev/null +++ b/package/nvram/src/include/bcmnvram.h @@ -0,0 +1,148 @@ +/* + * NVRAM variable manipulation + * + * Copyright 2004, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * + * $Id$ + */ + +#ifndef _bcmnvram_h_ +#define _bcmnvram_h_ + +#ifndef _LANGUAGE_ASSEMBLY + +#include <typedefs.h> + +struct nvram_header { + uint32 magic; + uint32 len; + uint32 crc_ver_init; /* 0:7 crc, 8:15 ver, 16:27 init, mem. test 28, 29-31 reserved */ + uint32 config_refresh; /* 0:15 config, 16:31 refresh */ + uint32 config_ncdl; /* ncdl values for memc */ +}; + +struct nvram_tuple { + char *name; + char *value; + struct nvram_tuple *next; +}; + +/* + * Initialize NVRAM access. May be unnecessary or undefined on certain + * platforms. + */ +extern int nvram_init(void *sbh); + +/* + * Disable NVRAM access. May be unnecessary or undefined on certain + * platforms. + */ +extern void nvram_exit(void); + +/* + * Get the value of an NVRAM variable. The pointer returned may be + * invalid after a set. + * @param name name of variable to get + * @return value of variable or NULL if undefined + */ +extern char * nvram_get(const char *name); + +/* + * Get the value of an NVRAM variable. + * @param name name of variable to get + * @return value of variable or NUL if undefined + */ +#define nvram_safe_get(name) (nvram_get(name) ? : "") + +#define nvram_safe_unset(name) ({ \ + if(nvram_get(name)) \ + nvram_unset(name); \ +}) + +#define nvram_safe_set(name, value) ({ \ + if(!nvram_get(name) || strcmp(nvram_get(name), value)) \ + nvram_set(name, value); \ +}) + +/* + * Match an NVRAM variable. + * @param name name of variable to match + * @param match value to compare against value of variable + * @return TRUE if variable is defined and its value is string equal + * to match or FALSE otherwise + */ +static INLINE int +nvram_match(char *name, char *match) { + const char *value = nvram_get(name); + return (value && !strcmp(value, match)); +} + +/* + * Inversely match an NVRAM variable. + * @param name name of variable to match + * @param match value to compare against value of variable + * @return TRUE if variable is defined and its value is not string + * equal to invmatch or FALSE otherwise + */ +static INLINE int +nvram_invmatch(char *name, char *invmatch) { + const char *value = nvram_get(name); + return (value && strcmp(value, invmatch)); +} + +/* + * Set the value of an NVRAM variable. The name and value strings are + * copied into private storage. Pointers to previously set values + * may become invalid. The new value may be immediately + * retrieved but will not be permanently stored until a commit. + * @param name name of variable to set + * @param value value of variable + * @return 0 on success and errno on failure + */ +extern int nvram_set(const char *name, const char *value); + +/* + * Unset an NVRAM variable. Pointers to previously set values + * remain valid until a set. + * @param name name of variable to unset + * @return 0 on success and errno on failure + * NOTE: use nvram_commit to commit this change to flash. + */ +extern int nvram_unset(const char *name); + +/* + * Commit NVRAM variables to permanent storage. All pointers to values + * may be invalid after a commit. + * NVRAM values are undefined after a commit. + * @return 0 on success and errno on failure + */ +extern int nvram_commit(void); + +/* + * Get all NVRAM variables (format name=value\0 ... \0\0). + * @param buf buffer to store variables + * @param count size of buffer in bytes + * @return 0 on success and errno on failure + */ +extern int nvram_getall(char *buf, int count); + +extern int file2nvram(char *filename, char *varname); +extern int nvram2file(char *varname, char *filename); + +#endif /* _LANGUAGE_ASSEMBLY */ + +#define NVRAM_MAGIC 0x48534C46 /* 'FLSH' */ +#define NVRAM_VERSION 1 +#define NVRAM_HEADER_SIZE 20 +#define NVRAM_SPACE 0x8000 +#define FLASH_BASE 0xbfc00000 /* Extif core */ +#define FLASH_MIN 0x00100000 /* Minimum flash size */ +#define FLASH_MAX 0x00400000 /* Maximum flash size with extif */ + +#endif /* _bcmnvram_h_ */ diff --git a/package/nvram/src/include/bcmutils.h b/package/nvram/src/include/bcmutils.h new file mode 100644 index 0000000000..05ad41d9d8 --- /dev/null +++ b/package/nvram/src/include/bcmutils.h @@ -0,0 +1,157 @@ +/* + * Misc useful os-independent macros and functions. + * + * Copyright 2004, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * $Id$ + */ + +#ifndef _bcmutils_h_ +#define _bcmutils_h_ + +#ifndef MIN +#define MIN(a, b) (((a)<(b))?(a):(b)) +#endif + +#ifndef MAX +#define MAX(a, b) (((a)>(b))?(a):(b)) +#endif + +#define CEIL(x, y) (((x) + ((y)-1)) / (y)) +#define ROUNDUP(x, y) ((((ulong)(x)+((y)-1))/(y))*(y)) +#define ISALIGNED(a, x) (((uint)(a) & ((x)-1)) == 0) +#define ISPOWEROF2(x) ((((x)-1)&(x))==0) +#define OFFSETOF(type, member) ((uint) &((type *)0)->member) +#define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0])) + +/* bit map related macros */ +#ifndef setbit +#define NBBY 8 /* 8 bits per byte */ +#define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) +#define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY))) +#define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY))) +#define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) +#endif + +#define NBITS(type) (sizeof (type) * 8) + +#define _BCM_U 0x01 /* upper */ +#define _BCM_L 0x02 /* lower */ +#define _BCM_D 0x04 /* digit */ +#define _BCM_C 0x08 /* cntrl */ +#define _BCM_P 0x10 /* punct */ +#define _BCM_S 0x20 /* white space (space/lf/tab) */ +#define _BCM_X 0x40 /* hex digit */ +#define _BCM_SP 0x80 /* hard space (0x20) */ + +extern unsigned char bcm_ctype[]; +#define bcm_ismask(x) (bcm_ctype[(int)(unsigned char)(x)]) + +#define bcm_isalnum(c) ((bcm_ismask(c)&(_BCM_U|_BCM_L|_BCM_D)) != 0) +#define bcm_isalpha(c) ((bcm_ismask(c)&(_BCM_U|_BCM_L)) != 0) +#define bcm_iscntrl(c) ((bcm_ismask(c)&(_BCM_C)) != 0) +#define bcm_isdigit(c) ((bcm_ismask(c)&(_BCM_D)) != 0) +#define bcm_isgraph(c) ((bcm_ismask(c)&(_BCM_P|_BCM_U|_BCM_L|_BCM_D)) != 0) +#define bcm_islower(c) ((bcm_ismask(c)&(_BCM_L)) != 0) +#define bcm_isprint(c) ((bcm_ismask(c)&(_BCM_P|_BCM_U|_BCM_L|_BCM_D|_BCM_SP)) != 0) +#define bcm_ispunct(c) ((bcm_ismask(c)&(_BCM_P)) != 0) +#define bcm_isspace(c) ((bcm_ismask(c)&(_BCM_S)) != 0) +#define bcm_isupper(c) ((bcm_ismask(c)&(_BCM_U)) != 0) +#define bcm_isxdigit(c) ((bcm_ismask(c)&(_BCM_D|_BCM_X)) != 0) + +/* + * Spin at most 'us' microseconds while 'exp' is true. + * Caller should explicitly test 'exp' when this completes + * and take appropriate error action if 'exp' is still true. + */ +#define SPINWAIT(exp, us) { \ + uint countdown = (us) + 9; \ + while ((exp) && (countdown >= 10)) {\ + OSL_DELAY(10); \ + countdown -= 10; \ + } \ +} + +/* generic osl packet queue */ +struct pktq { + void *head; /* first packet to dequeue */ + void *tail; /* last packet to dequeue */ + uint len; /* number of queued packets */ + uint maxlen; /* maximum number of queued packets */ + bool priority; /* enqueue by packet priority */ +}; +#define DEFAULT_QLEN 128 + +#define pktq_len(q) ((q)->len) +#define pktq_avail(q) ((q)->maxlen - (q)->len) +#define pktq_head(q) ((q)->head) +#define pktq_full(q) ((q)->len >= (q)->maxlen) + +/* crc defines */ +#define CRC8_INIT_VALUE 0xff /* Initial CRC8 checksum value */ +#define CRC8_GOOD_VALUE 0x9f /* Good final CRC8 checksum value */ +#define CRC16_INIT_VALUE 0xffff /* Initial CRC16 checksum value */ +#define CRC16_GOOD_VALUE 0xf0b8 /* Good final CRC16 checksum value */ +#define CRC32_INIT_VALUE 0xffffffff /* Initial CRC32 checksum value */ +#define CRC32_GOOD_VALUE 0xdebb20e3 /* Good final CRC32 checksum value */ + +/* tag_ID/length/value_buffer tuple */ +typedef struct bcm_tlv { + uint8 id; + uint8 len; + uint8 data[1]; +} bcm_tlv_t; + +/* Check that bcm_tlv_t fits into the given buflen */ +#define bcm_valid_tlv(elt, buflen) ((buflen) >= 2 && (buflen) >= 2 + (elt)->len) + +/* buffer length for ethernet address from bcm_ether_ntoa() */ +#define ETHER_ADDR_STR_LEN 18 + +/* +* load 32-bit value from unaligned byte array +*/ +#ifdef IL_BIGENDIAN +#define load32_ua(a) ((((uint8 *)(a))[0] << 24) + (((uint8 *)(a))[1] << 16) + \ + (((uint8 *)(a))[2] << 8) + ((uint8 *)(a))[3]) +#else +#define load32_ua(a) ((((uint8 *)(a))[3] << 24) + (((uint8 *)(a))[2] << 16) + \ + (((uint8 *)(a))[1] << 8) + ((uint8 *)(a))[0]) +#endif + +/* externs */ +extern uint bcm_atoi(char *s); +extern uchar bcm_toupper(uchar c); +extern ulong bcm_strtoul(char *cp, char **endp, uint base); +extern void deadbeef(char *p, uint len); +extern void prhex(char *msg, uchar *buf, uint len); +extern void prpkt(char *msg, void *drv, void *p0); +extern uint pktcopy(void *drv, void *p, uint offset, int len, uchar *buf); +extern uint pkttotlen(void *drv, void *); +extern uchar *bcm_ether_ntoa(char *ea, char *buf); +extern int bcm_ether_atoe(char *p, char *ea); +extern void bcm_mdelay(uint ms); +extern char *getvar(char *vars, char *name); +extern int getintvar(char *vars, char *name); +extern char *bcmstrstr(char *haystack, char *needle); + +extern uint8 crc8(uint8 *p, uint nbytes, uint8 crc); +extern uint16 crc16(uint8 *p, uint nbytes, uint16 crc); +extern uint32 crc32(uint8 *p, uint nbytes, uint32 crc); +extern bcm_tlv_t *bcm_next_tlv(bcm_tlv_t *elt, int *buflen); +extern bcm_tlv_t *bcm_parse_tlvs(void *buf, int buflen, uint key); +extern bcm_tlv_t *bcm_parse_ordered_tlvs(void *buf, int buflen, uint key); +extern void pktq_init(struct pktq *q, uint maxlen, bool priority); +extern bool pktenq(struct pktq *q, void *p, bool lifo); +extern void *pktdeq(struct pktq *q); + +#define bcmlog(fmt, a1, a2) +#define bcmdumplog(buf, size) *buf = '\0' +#define bcmdumplogent(buf, idx) -1 + +#endif /* _bcmutils_h_ */ diff --git a/package/nvram/src/include/cy_conf.h b/package/nvram/src/include/cy_conf.h new file mode 100644 index 0000000000..dbe387b83b --- /dev/null +++ b/package/nvram/src/include/cy_conf.h @@ -0,0 +1,69 @@ + +#define DNSMASQ_SUPPORT 1 +#define CONFIG_DNSMASQ y +#define UDHCPD_SUPPORT 1 +#define CONFIG_UDHCPD y +#define UDHCPC_SUPPORT 1 +#define CONFIG_UDHCPC y +#define PPPOE_SUPPORT 1 +#define CONFIG_PPPOE y +#define PPTP_SUPPORT 1 +#define CONFIG_PPTP y +#define L2TP_SUPPORT 1 +#define CONFIG_L2TP y +#define PPPD_SUPPORT 1 +#define CONFIG_PPPD y +#define ZEBRA_SUPPORT 1 +#define CONFIG_ZEBRA y +#define TFTPD_SUPPORT 1 +#define CONFIG_TFTPD y +#define DDNS_SUPPORT 1 +#define CONFIG_DDNS y +#define CRON_SUPPORT 1 +#define CONFIG_CRON y +#define HTTPD_SUPPORT 1 +#define CONFIG_HTTPD y +#define GET_POST_SUPPORT 1 +#define CONFIG_GET_POST y + +#if 1 +#define HEARTBEAT_SUPPORT 1 +#define CONFIG_HEARTBEAT y +#define MULTICAST_SUPPORT 1 +#define CONFIG_MULTICAST y +#define SETUP_WIZARD_SUPPORT 1 +#define CONFIG_SETUP_WIZARD y +#define PARENTAL_CONTROL_SUPPORT 1 +#define CONFIG_PARENTAL_CONTROL y +#define HTTPS_SUPPORT 1 +#define CONFIG_HTTPS y +#define EOU_SUPPORT 1 +#define CONFIG_EOU y +#define EZC_SUPPORT 1 +#define CONFIG_EZC y +#define WRITE_MAC_SUPPORT 1 +#define CONFIG_WRITE_MAC y +#define DIAG_SUPPORT 1 +#define CONFIG_DIAG y +#endif + +#define SPEED_BOOSTER_SUPPORT 1 +#define CONFIG_SPEED_BOOSTER y +#define XBOX_SUPPORT 1 +#define CONFIG_XBOX y + +#if 0 +#define MPPPOE_SUPPORT 1 +#define CONFIG_MPPPOE y +#define UNNUMBERIP_SUPPORT 1 +#define CONFIG_UNNUMBERIP y +#endif + +#define WL_STA_SUPPORT 1 +#define CONFIG_WL_STA y +#define BACKUP_RESTORE_SUPPORT 1 +#define CONFIG_BACKUP_RESTORE y +#define PORT_TRIGGER_SUPPORT 1 +#define CONFIG_PORT_TRIGGER y +#define HW_QOS_SUPPORT 1 +#define CONFIG_HW_QOS y diff --git a/package/nvram/src/include/epivers.h b/package/nvram/src/include/epivers.h new file mode 100644 index 0000000000..e174fb50d8 --- /dev/null +++ b/package/nvram/src/include/epivers.h @@ -0,0 +1,69 @@ +/* + * Copyright 2004, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * + * $Id$ + * +*/ + +#ifndef _epivers_h_ +#define _epivers_h_ + +#ifdef linux +#include <linux/config.h> +#endif + +/* Vendor Name, ASCII, 32 chars max */ +#ifdef COMPANYNAME +#define HPNA_VENDOR COMPANYNAME +#else +#define HPNA_VENDOR "Broadcom Corporation" +#endif + +/* Driver Date, ASCII, 32 chars max */ +#define HPNA_DRV_BUILD_DATE __DATE__ + +/* Hardware Manufacture Date, ASCII, 32 chars max */ +#define HPNA_HW_MFG_DATE "Not Specified" + +/* See documentation for Device Type values, 32 values max */ +#ifndef HPNA_DEV_TYPE + +#if defined(CONFIG_BRCM_VJ) +#define HPNA_DEV_TYPE { CDCF_V0_DEVICE_DISPLAY } + +#elif defined(CONFIG_BCRM_93725) +#define HPNA_DEV_TYPE { CDCF_V0_DEVICE_CM_BRIDGE, CDCF_V0_DEVICE_DISPLAY } + +#else +#define HPNA_DEV_TYPE { CDCF_V0_DEVICE_PCINIC } + +#endif + +#endif /* !HPNA_DEV_TYPE */ + + +#define EPI_MAJOR_VERSION 3 + +#define EPI_MINOR_VERSION 60 + +#define EPI_RC_NUMBER 13 + +#define EPI_INCREMENTAL_NUMBER 0 + +#define EPI_BUILD_NUMBER 0 + +#define EPI_VERSION 3,60,13,0 + +#define EPI_VERSION_NUM 0x033c0d00 + +/* Driver Version String, ASCII, 32 chars max */ +#define EPI_VERSION_STR "3.60.13.0" +#define EPI_ROUTER_VERSION_STR "3.61.13.0" + +#endif /* _epivers_h_ */ diff --git a/package/nvram/src/include/proto/802.11.h b/package/nvram/src/include/proto/802.11.h new file mode 100644 index 0000000000..ea57850ce5 --- /dev/null +++ b/package/nvram/src/include/proto/802.11.h @@ -0,0 +1,852 @@ +/* + * Copyright 2004, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * + * Fundamental types and constants relating to 802.11 + * + * $Id$ + */ + +#ifndef _802_11_H_ +#define _802_11_H_ + +#ifndef _TYPEDEFS_H_ +#include <typedefs.h> +#endif + +#ifndef _NET_ETHERNET_H_ +#include <proto/ethernet.h> +#endif + +/* enable structure packing */ +#if !defined(__GNUC__) +#pragma pack(1) +#endif + +/* some platforms require stronger medicine */ +#if defined(__GNUC__) +#define PACKED __attribute__((packed)) +#else +#define PACKED +#endif + + +#define DOT11_TU_TO_US 1024 /* 802.11 Time Unit is 1024 microseconds */ + +/* Generic 802.11 frame constants */ +#define DOT11_A3_HDR_LEN 24 +#define DOT11_A4_HDR_LEN 30 +#define DOT11_MAC_HDR_LEN DOT11_A3_HDR_LEN +#define DOT11_FCS_LEN 4 +#define DOT11_ICV_LEN 4 +#define DOT11_ICV_AES_LEN 8 +#define DOT11_QOS_LEN 2 + +#define DOT11_KEY_INDEX_SHIFT 6 +#define DOT11_IV_LEN 4 +#define DOT11_IV_TKIP_LEN 8 +#define DOT11_IV_AES_OCB_LEN 4 +#define DOT11_IV_AES_CCM_LEN 8 + +/* Includes MIC */ +#define DOT11_MAX_MPDU_BODY_LEN 2304 +/* A4 header + QoS + CCMP + PDU + ICV + FCS = 2352 */ +#define DOT11_MAX_MPDU_LEN (DOT11_A4_HDR_LEN + \ + DOT11_QOS_LEN + \ + DOT11_IV_AES_CCM_LEN + \ + DOT11_MAX_MPDU_BODY_LEN + \ + DOT11_ICV_LEN + \ + DOT11_FCS_LEN) + +#define DOT11_MAX_SSID_LEN 32 + +/* dot11RTSThreshold */ +#define DOT11_DEFAULT_RTS_LEN 2347 +#define DOT11_MAX_RTS_LEN 2347 + +/* dot11FragmentationThreshold */ +#define DOT11_MIN_FRAG_LEN 256 +#define DOT11_MAX_FRAG_LEN 2346 /* Max frag is also limited by aMPDUMaxLength of the attached PHY */ +#define DOT11_DEFAULT_FRAG_LEN 2346 + +/* dot11BeaconPeriod */ +#define DOT11_MIN_BEACON_PERIOD 1 +#define DOT11_MAX_BEACON_PERIOD 0xFFFF + +/* dot11DTIMPeriod */ +#define DOT11_MIN_DTIM_PERIOD 1 +#define DOT11_MAX_DTIM_PERIOD 0xFF + +/* 802.2 LLC/SNAP header used by 802.11 per 802.1H */ +#define DOT11_LLC_SNAP_HDR_LEN 8 +#define DOT11_OUI_LEN 3 +struct dot11_llc_snap_header { + uint8 dsap; /* always 0xAA */ + uint8 ssap; /* always 0xAA */ + uint8 ctl; /* always 0x03 */ + uint8 oui[DOT11_OUI_LEN]; /* RFC1042: 0x00 0x00 0x00 + Bridge-Tunnel: 0x00 0x00 0xF8 */ + uint16 type; /* ethertype */ +} PACKED; + +/* RFC1042 header used by 802.11 per 802.1H */ +#define RFC1042_HDR_LEN (ETHER_HDR_LEN + DOT11_LLC_SNAP_HDR_LEN) + +/* Generic 802.11 MAC header */ +/* + * N.B.: This struct reflects the full 4 address 802.11 MAC header. + * The fields are defined such that the shorter 1, 2, and 3 + * address headers just use the first k fields. + */ +struct dot11_header { + uint16 fc; /* frame control */ + uint16 durid; /* duration/ID */ + struct ether_addr a1; /* address 1 */ + struct ether_addr a2; /* address 2 */ + struct ether_addr a3; /* address 3 */ + uint16 seq; /* sequence control */ + struct ether_addr a4; /* address 4 */ +} PACKED; + +/* Control frames */ + +struct dot11_rts_frame { + uint16 fc; /* frame control */ + uint16 durid; /* duration/ID */ + struct ether_addr ra; /* receiver address */ + struct ether_addr ta; /* transmitter address */ +} PACKED; +#define DOT11_RTS_LEN 16 + +struct dot11_cts_frame { + uint16 fc; /* frame control */ + uint16 durid; /* duration/ID */ + struct ether_addr ra; /* receiver address */ +} PACKED; +#define DOT11_CTS_LEN 10 + +struct dot11_ack_frame { + uint16 fc; /* frame control */ + uint16 durid; /* duration/ID */ + struct ether_addr ra; /* receiver address */ +} PACKED; +#define DOT11_ACK_LEN 10 + +struct dot11_ps_poll_frame { + uint16 fc; /* frame control */ + uint16 durid; /* AID */ + struct ether_addr bssid; /* receiver address, STA in AP */ + struct ether_addr ta; /* transmitter address */ +} PACKED; +#define DOT11_PS_POLL_LEN 16 + +struct dot11_cf_end_frame { + uint16 fc; /* frame control */ + uint16 durid; /* duration/ID */ + struct ether_addr ra; /* receiver address */ + struct ether_addr bssid; /* transmitter address, STA in AP */ +} PACKED; +#define DOT11_CS_END_LEN 16 + +/* Management frame header */ +struct dot11_management_header { + uint16 fc; /* frame control */ + uint16 durid; /* duration/ID */ + struct ether_addr da; /* receiver address */ + struct ether_addr sa; /* transmitter address */ + struct ether_addr bssid; /* BSS ID */ + uint16 seq; /* sequence control */ +} PACKED; +#define DOT11_MGMT_HDR_LEN 24 + +/* Management frame payloads */ + +struct dot11_bcn_prb { + uint32 timestamp[2]; + uint16 beacon_interval; + uint16 capability; +} PACKED; +#define DOT11_BCN_PRB_LEN 12 + +struct dot11_auth { + uint16 alg; /* algorithm */ + uint16 seq; /* sequence control */ + uint16 status; /* status code */ +} PACKED; +#define DOT11_AUTH_FIXED_LEN 6 /* length of auth frame without challenge info elt */ + +struct dot11_assoc_req { + uint16 capability; /* capability information */ + uint16 listen; /* listen interval */ +} PACKED; + +struct dot11_assoc_resp { + uint16 capability; /* capability information */ + uint16 status; /* status code */ + uint16 aid; /* association ID */ +} PACKED; + +struct dot11_action_measure { + uint8 category; + uint8 action; + uint8 token; + uint8 data[1]; +} PACKED; +#define DOT11_ACTION_MEASURE_LEN 3 + +/************** + 802.11h related definitions. +**************/ +typedef struct { + uint8 id; + uint8 len; + uint8 power; +} dot11_power_cnst_t; + +typedef struct { + uint8 min; + uint8 max; +} dot11_power_cap_t; + +typedef struct { + uint8 id; + uint8 len; + uint8 tx_pwr; + uint8 margin; +} dot11_tpc_rep_t; +#define DOT11_MNG_IE_TPC_REPORT_LEN 2 /* length of IE data, not including 2 byte header */ + +typedef struct { + uint8 id; + uint8 len; + uint8 first_channel; + uint8 num_channels; +} dot11_supp_channels_t; + +struct dot11_channel_switch { + uint8 id; + uint8 len; + uint8 mode; + uint8 channel; + uint8 count; +} PACKED; +typedef struct dot11_channel_switch dot11_channel_switch_t; + +/* 802.11h Measurement Request/Report IEs */ +/* Measurement Type field */ +#define DOT11_MEASURE_TYPE_BASIC 0 +#define DOT11_MEASURE_TYPE_CCA 1 +#define DOT11_MEASURE_TYPE_RPI 2 + +/* Measurement Mode field */ + +/* Measurement Request Modes */ +#define DOT11_MEASURE_MODE_ENABLE (1<<1) +#define DOT11_MEASURE_MODE_REQUEST (1<<2) +#define DOT11_MEASURE_MODE_REPORT (1<<3) +/* Measurement Report Modes */ +#define DOT11_MEASURE_MODE_LATE (1<<0) +#define DOT11_MEASURE_MODE_INCAPABLE (1<<1) +#define DOT11_MEASURE_MODE_REFUSED (1<<2) +/* Basic Measurement Map bits */ +#define DOT11_MEASURE_BASIC_MAP_BSS ((uint8)(1<<0)) +#define DOT11_MEASURE_BASIC_MAP_OFDM ((uint8)(1<<1)) +#define DOT11_MEASURE_BASIC_MAP_UKNOWN ((uint8)(1<<2)) +#define DOT11_MEASURE_BASIC_MAP_RADAR ((uint8)(1<<3)) +#define DOT11_MEASURE_BASIC_MAP_UNMEAS ((uint8)(1<<4)) + +typedef struct { + uint8 id; + uint8 len; + uint8 token; + uint8 mode; + uint8 type; + uint8 channel; + uint8 start_time[8]; + uint16 duration; +} dot11_meas_req_t; +#define DOT11_MNG_IE_MREQ_LEN 14 +/* length of Measure Request IE data not including variable len */ +#define DOT11_MNG_IE_MREQ_FIXED_LEN 3 + +struct dot11_meas_rep { + uint8 id; + uint8 len; + uint8 token; + uint8 mode; + uint8 type; + union + { + struct { + uint8 channel; + uint8 start_time[8]; + uint16 duration; + uint8 map; + } PACKED basic; + uint8 data[1]; + } PACKED rep; +} PACKED; +typedef struct dot11_meas_rep dot11_meas_rep_t; + +/* length of Measure Report IE data not including variable len */ +#define DOT11_MNG_IE_MREP_FIXED_LEN 3 + +struct dot11_meas_rep_basic { + uint8 channel; + uint8 start_time[8]; + uint16 duration; + uint8 map; +} PACKED; +typedef struct dot11_meas_rep_basic dot11_meas_rep_basic_t; +#define DOT11_MEASURE_BASIC_REP_LEN 12 + +struct dot11_quiet { + uint8 id; + uint8 len; + uint8 count; /* TBTTs until beacon interval in quiet starts */ + uint8 period; /* Beacon intervals between periodic quiet periods ? */ + uint16 duration;/* Length of quiet period, in TU's */ + uint16 offset; /* TU's offset from TBTT in Count field */ +} PACKED; +typedef struct dot11_quiet dot11_quiet_t; + +typedef struct { + uint8 channel; + uint8 map; +} chan_map_tuple_t; + +typedef struct { + uint8 id; + uint8 len; + uint8 eaddr[ETHER_ADDR_LEN]; + uint8 interval; + chan_map_tuple_t map[1]; +} dot11_ibss_dfs_t; + +/* WME Elements */ +#define WME_OUI "\x00\x50\xf2" +#define WME_VER 1 +#define WME_TYPE 2 +#define WME_SUBTYPE_IE 0 /* Information Element */ +#define WME_SUBTYPE_PARAM_IE 1 /* Parameter Element */ +#define WME_SUBTYPE_TSPEC 2 /* Traffic Specification */ + +/* WME Access Category Indices (ACIs) */ +#define AC_BE 0 /* Best Effort */ +#define AC_BK 1 /* Background */ +#define AC_VI 2 /* Video */ +#define AC_VO 3 /* Voice */ +#define AC_MAX 4 + +/* WME Information Element (IE) */ +struct wme_ie { + uint8 oui[3]; + uint8 type; + uint8 subtype; + uint8 version; + uint8 acinfo; +} PACKED; +typedef struct wme_ie wme_ie_t; +#define WME_IE_LEN 7 + +struct wme_acparam { + uint8 ACI; + uint8 ECW; + uint16 TXOP; /* stored in network order (ls octet first) */ +} PACKED; +typedef struct wme_acparam wme_acparam_t; + +/* WME Parameter Element (PE) */ +struct wme_params { + uint8 oui[3]; + uint8 type; + uint8 subtype; + uint8 version; + uint8 acinfo; + uint8 rsvd; + wme_acparam_t acparam[4]; +} PACKED; +typedef struct wme_params wme_params_t; +#define WME_PARAMS_IE_LEN 24 + +/* acinfo */ +#define WME_COUNT_MASK 0x0f +/* ACI */ +#define WME_AIFS_MASK 0x0f +#define WME_ACM_MASK 0x10 +#define WME_ACI_MASK 0x60 +#define WME_ACI_SHIFT 5 +/* ECW */ +#define WME_CWMIN_MASK 0x0f +#define WME_CWMAX_MASK 0xf0 +#define WME_CWMAX_SHIFT 4 + +#define WME_TXOP_UNITS 32 + +/* WME Traffic Specification (TSPEC) element */ +#define WME_SUBTYPE_TSPEC 2 +#define WME_TSPEC_HDR_LEN 2 +#define WME_TSPEC_BODY_OFF 2 +struct wme_tspec { + uint8 oui[DOT11_OUI_LEN]; /* WME_OUI */ + uint8 type; /* WME_TYPE */ + uint8 subtype; /* WME_SUBTYPE_TSPEC */ + uint8 version; /* WME_VERSION */ + uint16 ts_info; /* TS Info */ + uint16 nom_msdu_size; /* (Nominal or fixed) MSDU Size (bytes) */ + uint16 max_msdu_size; /* Maximum MSDU Size (bytes) */ + uint32 min_service_interval; /* Minimum Service Interval (us) */ + uint32 max_service_interval; /* Maximum Service Interval (us) */ + uint32 inactivity_interval; /* Inactivity Interval (us) */ + uint32 service_start; /* Service Start Time (us) */ + uint32 min_rate; /* Minimum Data Rate (bps) */ + uint32 mean_rate; /* Mean Data Rate (bps) */ + uint32 max_burst_size; /* Maximum Burst Size (bytes) */ + uint32 min_phy_rate; /* Minimum PHY Rate (bps) */ + uint32 peak_rate; /* Peak Data Rate (bps) */ + uint32 delay_bound; /* Delay Bound (us) */ + uint16 surplus_bandwidth; /* Surplus Bandwidth Allowance Factor */ + uint16 medium_time; /* Medium Time (32 us/s periods) */ +} PACKED; +typedef struct wme_tspec wme_tspec_t; +#define WME_TSPEC_LEN 56 /* not including 2-byte header */ + +/* ts_info */ +/* 802.1D priority is duplicated - bits 13-11 AND bits 3-1 */ +#define TS_INFO_PRIO_SHIFT_HI 11 +#define TS_INFO_PRIO_MASK_HI (0x7 << TS_INFO_PRIO_SHIFT_HI) +#define TS_INFO_PRIO_SHIFT_LO 1 +#define TS_INFO_PRIO_MASK_LO (0x7 << TS_INFO_PRIO_SHIFT_LO) +#define TS_INFO_CONTENTION_SHIFT 7 +#define TS_INFO_CONTENTION_MASK (0x1 << TS_INFO_CONTENTION_SHIFT) +#define TS_INFO_DIRECTION_SHIFT 5 +#define TS_INFO_DIRECTION_MASK (0x3 << TS_INFO_DIRECTION_SHIFT) +#define TS_INFO_UPLINK (0 << TS_INFO_DIRECTION_SHIFT) +#define TS_INFO_DOWNLINK (1 << TS_INFO_DIRECTION_SHIFT) +#define TS_INFO_BIDIRECTIONAL (3 << TS_INFO_DIRECTION_SHIFT) + +/* nom_msdu_size */ +#define FIXED_MSDU_SIZE 0x8000 /* MSDU size is fixed */ +#define MSDU_SIZE_MASK 0x7fff /* (Nominal or fixed) MSDU size */ + +/* surplus_bandwidth */ +/* Represented as 3 bits of integer, binary point, 13 bits fraction */ +#define INTEGER_SHIFT 13 +#define FRACTION_MASK 0x1FFF + +/* Management Notification Frame */ +struct dot11_management_notification { + uint8 category; /* DOT11_ACTION_NOTIFICATION */ + uint8 action; + uint8 token; + uint8 status; + uint8 data[1]; /* Elements */ +} PACKED; +#define DOT11_MGMT_NOTIFICATION_LEN 4 /* Fixed length */ + +/* WME Action Codes */ +#define WME_SETUP_REQUEST 0 +#define WME_SETUP_RESPONSE 1 +#define WME_TEARDOWN 2 + +/* WME Setup Response Status Codes */ +#define WME_ADMISSION_ACCEPTED 0 +#define WME_INVALID_PARAMETERS 1 +#define WME_ADMISSION_REFUSED 3 + +/* Macro to take a pointer to a beacon or probe response + * header and return the char* pointer to the SSID info element + */ +#define BCN_PRB_SSID(hdr) ((char*)(hdr) + DOT11_MGMT_HDR_LEN + DOT11_BCN_PRB_LEN) + +/* Authentication frame payload constants */ +#define DOT11_OPEN_SYSTEM 0 +#define DOT11_SHARED_KEY 1 +#define DOT11_CHALLENGE_LEN 128 + +/* Frame control macros */ +#define FC_PVER_MASK 0x3 +#define FC_PVER_SHIFT 0 +#define FC_TYPE_MASK 0xC +#define FC_TYPE_SHIFT 2 +#define FC_SUBTYPE_MASK 0xF0 +#define FC_SUBTYPE_SHIFT 4 +#define FC_TODS 0x100 +#define FC_TODS_SHIFT 8 +#define FC_FROMDS 0x200 +#define FC_FROMDS_SHIFT 9 +#define FC_MOREFRAG 0x400 +#define FC_MOREFRAG_SHIFT 10 +#define FC_RETRY 0x800 +#define FC_RETRY_SHIFT 11 +#define FC_PM 0x1000 +#define FC_PM_SHIFT 12 +#define FC_MOREDATA 0x2000 +#define FC_MOREDATA_SHIFT 13 +#define FC_WEP 0x4000 +#define FC_WEP_SHIFT 14 +#define FC_ORDER 0x8000 +#define FC_ORDER_SHIFT 15 + +/* sequence control macros */ +#define SEQNUM_SHIFT 4 +#define FRAGNUM_MASK 0xF + +/* Frame Control type/subtype defs */ + +/* FC Types */ +#define FC_TYPE_MNG 0 +#define FC_TYPE_CTL 1 +#define FC_TYPE_DATA 2 + +/* Management Subtypes */ +#define FC_SUBTYPE_ASSOC_REQ 0 +#define FC_SUBTYPE_ASSOC_RESP 1 +#define FC_SUBTYPE_REASSOC_REQ 2 +#define FC_SUBTYPE_REASSOC_RESP 3 +#define FC_SUBTYPE_PROBE_REQ 4 +#define FC_SUBTYPE_PROBE_RESP 5 +#define FC_SUBTYPE_BEACON 8 +#define FC_SUBTYPE_ATIM 9 +#define FC_SUBTYPE_DISASSOC 10 +#define FC_SUBTYPE_AUTH 11 +#define FC_SUBTYPE_DEAUTH 12 +#define FC_SUBTYPE_ACTION 13 + +/* Control Subtypes */ +#define FC_SUBTYPE_PS_POLL 10 +#define FC_SUBTYPE_RTS 11 +#define FC_SUBTYPE_CTS 12 +#define FC_SUBTYPE_ACK 13 +#define FC_SUBTYPE_CF_END 14 +#define FC_SUBTYPE_CF_END_ACK 15 + +/* Data Subtypes */ +#define FC_SUBTYPE_DATA 0 +#define FC_SUBTYPE_DATA_CF_ACK 1 +#define FC_SUBTYPE_DATA_CF_POLL 2 +#define FC_SUBTYPE_DATA_CF_ACK_POLL 3 +#define FC_SUBTYPE_NULL 4 +#define FC_SUBTYPE_CF_ACK 5 +#define FC_SUBTYPE_CF_POLL 6 +#define FC_SUBTYPE_CF_ACK_POLL 7 +#define FC_SUBTYPE_QOS_DATA 8 +#define FC_SUBTYPE_QOS_NULL 12 + +/* type-subtype combos */ +#define FC_KIND_MASK (FC_TYPE_MASK | FC_SUBTYPE_MASK) + +#define FC_KIND(t, s) (((t) << FC_TYPE_SHIFT) | ((s) << FC_SUBTYPE_SHIFT)) + +#define FC_ASSOC_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ASSOC_REQ) +#define FC_ASSOC_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ASSOC_RESP) +#define FC_REASSOC_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_REASSOC_REQ) +#define FC_REASSOC_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_REASSOC_RESP) +#define FC_PROBE_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_PROBE_REQ) +#define FC_PROBE_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_PROBE_RESP) +#define FC_BEACON FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_BEACON) +#define FC_DISASSOC FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_DISASSOC) +#define FC_AUTH FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_AUTH) +#define FC_DEAUTH FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_DEAUTH) +#define FC_ACTION FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ACTION) + +#define FC_PS_POLL FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_PS_POLL) +#define FC_RTS FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_RTS) +#define FC_CTS FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CTS) +#define FC_ACK FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_ACK) +#define FC_CF_END FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CF_END) +#define FC_CF_END_ACK FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CF_END_ACK) + +#define FC_DATA FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_DATA) +#define FC_NULL_DATA FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_NULL) +#define FC_DATA_CF_ACK FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_DATA_CF_ACK) +#define FC_QOS_DATA FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_QOS_DATA) +#define FC_QOS_NULL FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_QOS_NULL) + +/* QoS Control Field */ + +/* 802.1D Tag */ +#define QOS_PRIO_SHIFT 0 +#define QOS_PRIO_MASK 0x0007 +#define QOS_PRIO(qos) (((qos) & QOS_PRIO_MASK) >> QOS_PRIO_SHIFT) + +/* Ack Policy (0 means Acknowledge) */ +#define QOS_ACK_SHIFT 5 +#define QOS_ACK_MASK 0x0060 +#define QOS_ACK(qos) (((qos) & QOS_ACK_MASK) >> QOS_ACK_SHIFT) + +/* Management Frames */ + +/* Management Frame Constants */ + +/* Fixed fields */ +#define DOT11_MNG_AUTH_ALGO_LEN 2 +#define DOT11_MNG_AUTH_SEQ_LEN 2 +#define DOT11_MNG_BEACON_INT_LEN 2 +#define DOT11_MNG_CAP_LEN 2 +#define DOT11_MNG_AP_ADDR_LEN 6 +#define DOT11_MNG_LISTEN_INT_LEN 2 +#define DOT11_MNG_REASON_LEN 2 +#define DOT11_MNG_AID_LEN 2 +#define DOT11_MNG_STATUS_LEN 2 +#define DOT11_MNG_TIMESTAMP_LEN 8 + +/* DUR/ID field in assoc resp is 0xc000 | AID */ +#define DOT11_AID_MASK 0x3fff + +/* Reason Codes */ +#define DOT11_RC_RESERVED 0 +#define DOT11_RC_UNSPECIFIED 1 /* Unspecified reason */ +#define DOT11_RC_AUTH_INVAL 2 /* Previous authentication no longer valid */ +#define DOT11_RC_DEAUTH_LEAVING 3 /* Deauthenticated because sending station is + leaving (or has left) IBSS or ESS */ +#define DOT11_RC_INACTIVITY 4 /* Disassociated due to inactivity */ +#define DOT11_RC_BUSY 5 /* Disassociated because AP is unable to handle + all currently associated stations */ +#define DOT11_RC_INVAL_CLASS_2 6 /* Class 2 frame received from + nonauthenticated station */ +#define DOT11_RC_INVAL_CLASS_3 7 /* Class 3 frame received from + nonassociated station */ +#define DOT11_RC_DISASSOC_LEAVING 8 /* Disassociated because sending station is + leaving (or has left) BSS */ +#define DOT11_RC_NOT_AUTH 9 /* Station requesting (re)association is + not authenticated with responding station */ +#define DOT11_RC_MAX 23 /* Reason codes > 23 are reserved */ + +/* Status Codes */ +#define DOT11_STATUS_SUCCESS 0 /* Successful */ +#define DOT11_STATUS_FAILURE 1 /* Unspecified failure */ +#define DOT11_STATUS_CAP_MISMATCH 10 /* Cannot support all requested capabilities + in the Capability Information field */ +#define DOT11_STATUS_REASSOC_FAIL 11 /* Reassociation denied due to inability to + confirm that association exists */ +#define DOT11_STATUS_ASSOC_FAIL 12 /* Association denied due to reason outside + the scope of this standard */ +#define DOT11_STATUS_AUTH_MISMATCH 13 /* Responding station does not support the + specified authentication algorithm */ +#define DOT11_STATUS_AUTH_SEQ 14 /* Received an Authentication frame with + authentication transaction sequence number + out of expected sequence */ +#define DOT11_STATUS_AUTH_CHALLENGE_FAIL 15 /* Authentication rejected because of challenge failure */ +#define DOT11_STATUS_AUTH_TIMEOUT 16 /* Authentication rejected due to timeout waiting + for next frame in sequence */ +#define DOT11_STATUS_ASSOC_BUSY_FAIL 17 /* Association denied because AP is unable to + handle additional associated stations */ +#define DOT11_STATUS_ASSOC_RATE_MISMATCH 18 /* Association denied due to requesting station + not supporting all of the data rates in the + BSSBasicRateSet parameter */ +#define DOT11_STATUS_ASSOC_SHORT_REQUIRED 19 /* Association denied due to requesting station + not supporting the Short Preamble option */ +#define DOT11_STATUS_ASSOC_PBCC_REQUIRED 20 /* Association denied due to requesting station + not supporting the PBCC Modulation option */ +#define DOT11_STATUS_ASSOC_AGILITY_REQUIRED 21 /* Association denied due to requesting station + not supporting the Channel Agility option */ +#define DOT11_STATUS_ASSOC_SPECTRUM_REQUIRED 22 /* Association denied because Spectrum Management + capability is required. */ +#define DOT11_STATUS_ASSOC_BAD_POWER_CAP 23 /* Association denied because the info in the + Power Cap element is unacceptable. */ +#define DOT11_STATUS_ASSOC_BAD_SUP_CHANNELS 24 /* Association denied because the info in the + Supported Channel element is unacceptable */ +#define DOT11_STATUS_ASSOC_SHORTSLOT_REQUIRED 25 /* Association denied due to requesting station + not supporting the Short Slot Time option */ +#define DOT11_STATUS_ASSOC_ERPBCC_REQUIRED 26 /* Association denied due to requesting station + not supporting the ER-PBCC Modulation option */ +#define DOT11_STATUS_ASSOC_DSSOFDM_REQUIRED 27 /* Association denied due to requesting station + not supporting the DSS-OFDM option */ + +/* Info Elts, length of INFORMATION portion of Info Elts */ +#define DOT11_MNG_DS_PARAM_LEN 1 +#define DOT11_MNG_IBSS_PARAM_LEN 2 + +/* TIM Info element has 3 bytes fixed info in INFORMATION field, + * followed by 1 to 251 bytes of Partial Virtual Bitmap */ +#define DOT11_MNG_TIM_FIXED_LEN 3 +#define DOT11_MNG_TIM_DTIM_COUNT 0 +#define DOT11_MNG_TIM_DTIM_PERIOD 1 +#define DOT11_MNG_TIM_BITMAP_CTL 2 +#define DOT11_MNG_TIM_PVB 3 + +/* TLV defines */ +#define TLV_TAG_OFF 0 +#define TLV_LEN_OFF 1 +#define TLV_HDR_LEN 2 +#define TLV_BODY_OFF 2 + +/* Management Frame Information Element IDs */ +#define DOT11_MNG_SSID_ID 0 +#define DOT11_MNG_RATES_ID 1 +#define DOT11_MNG_FH_PARMS_ID 2 +#define DOT11_MNG_DS_PARMS_ID 3 +#define DOT11_MNG_CF_PARMS_ID 4 +#define DOT11_MNG_TIM_ID 5 +#define DOT11_MNG_IBSS_PARMS_ID 6 +#define DOT11_MNG_COUNTRY_ID 7 +#define DOT11_MNG_HOPPING_PARMS_ID 8 +#define DOT11_MNG_HOPPING_TABLE_ID 9 +#define DOT11_MNG_REQUEST_ID 10 +#define DOT11_MNG_CHALLENGE_ID 16 +#define DOT11_MNG_PWR_CONSTRAINT_ID 32 /* 11H PowerConstraint */ +#define DOT11_MNG_PWR_CAP_ID 33 /* 11H PowerCapability */ +#define DOT11_MNG_TPC_REQUEST_ID 34 /* 11H TPC Request */ +#define DOT11_MNG_TPC_REPORT_ID 35 /* 11H TPC Report */ +#define DOT11_MNG_SUPP_CHANNELS_ID 36 /* 11H Supported Channels */ +#define DOT11_MNG_CHANNEL_SWITCH_ID 37 /* 11H ChannelSwitch Announcement*/ +#define DOT11_MNG_MEASURE_REQUEST_ID 38 /* 11H MeasurementRequest */ +#define DOT11_MNG_MEASURE_REPORT_ID 39 /* 11H MeasurementReport */ +#define DOT11_MNG_QUIET_ID 40 /* 11H Quiet */ +#define DOT11_MNG_IBSS_DFS_ID 41 /* 11H IBSS_DFS */ +#define DOT11_MNG_ERP_ID 42 +#define DOT11_MNG_NONERP_ID 47 +#define DOT11_MNG_EXT_RATES_ID 50 +#define DOT11_MNG_WPA_ID 221 +#define DOT11_MNG_PROPR_ID 221 + +/* ERP info element bit values */ +#define DOT11_MNG_ERP_LEN 1 /* ERP is currently 1 byte long */ +#define DOT11_MNG_NONERP_PRESENT 0x01 /* NonERP (802.11b) STAs are present in the BSS */ +#define DOT11_MNG_USE_PROTECTION 0x02 /* Use protection mechanisms for ERP-OFDM frames */ +#define DOT11_MNG_BARKER_PREAMBLE 0x04 /* Short Preambles: 0 == allowed, 1 == not allowed */ + +/* Capability Information Field */ +#define DOT11_CAP_ESS 0x0001 +#define DOT11_CAP_IBSS 0x0002 +#define DOT11_CAP_POLLABLE 0x0004 +#define DOT11_CAP_POLL_RQ 0x0008 +#define DOT11_CAP_PRIVACY 0x0010 +#define DOT11_CAP_SHORT 0x0020 +#define DOT11_CAP_PBCC 0x0040 +#define DOT11_CAP_AGILITY 0x0080 +#define DOT11_CAP_SPECTRUM 0x0100 +#define DOT11_CAP_SHORTSLOT 0x0400 +#define DOT11_CAP_CCK_OFDM 0x2000 + +/* Action Frame Constants */ +#define DOT11_ACTION_CAT_ERR_MASK 0x80 +#define DOT11_ACTION_CAT_SPECT_MNG 0x00 +#define DOT11_ACTION_NOTIFICATION 0x11 /* 17 */ + +#define DOT11_ACTION_ID_M_REQ 0 +#define DOT11_ACTION_ID_M_REP 1 +#define DOT11_ACTION_ID_TPC_REQ 2 +#define DOT11_ACTION_ID_TPC_REP 3 +#define DOT11_ACTION_ID_CHANNEL_SWITCH 4 + +/* MLME Enumerations */ +#define DOT11_BSSTYPE_INFRASTRUCTURE 0 +#define DOT11_BSSTYPE_INDEPENDENT 1 +#define DOT11_BSSTYPE_ANY 2 +#define DOT11_SCANTYPE_ACTIVE 0 +#define DOT11_SCANTYPE_PASSIVE 1 + +/* 802.11 A PHY constants */ +#define APHY_SLOT_TIME 9 +#define APHY_SIFS_TIME 16 +#define APHY_DIFS_TIME (APHY_SIFS_TIME + (2 * APHY_SLOT_TIME)) +#define APHY_PREAMBLE_TIME 16 +#define APHY_SIGNAL_TIME 4 +#define APHY_SYMBOL_TIME 4 +#define APHY_SERVICE_NBITS 16 +#define APHY_TAIL_NBITS 6 +#define APHY_CWMIN 15 + +/* 802.11 B PHY constants */ +#define BPHY_SLOT_TIME 20 +#define BPHY_SIFS_TIME 10 +#define BPHY_DIFS_TIME 50 +#define BPHY_PLCP_TIME 192 +#define BPHY_PLCP_SHORT_TIME 96 +#define BPHY_CWMIN 31 + +/* 802.11 G constants */ +#define DOT11_OFDM_SIGNAL_EXTENSION 6 + +#define PHY_CWMAX 1023 + +#define DOT11_MAXNUMFRAGS 16 /* max # fragments per MSDU */ + +/* dot11Counters Table - 802.11 spec., Annex D */ +typedef struct d11cnt { + uint32 txfrag; /* dot11TransmittedFragmentCount */ + uint32 txmulti; /* dot11MulticastTransmittedFrameCount */ + uint32 txfail; /* dot11FailedCount */ + uint32 txretry; /* dot11RetryCount */ + uint32 txretrie; /* dot11MultipleRetryCount */ + uint32 rxdup; /* dot11FrameduplicateCount */ + uint32 txrts; /* dot11RTSSuccessCount */ + uint32 txnocts; /* dot11RTSFailureCount */ + uint32 txnoack; /* dot11ACKFailureCount */ + uint32 rxfrag; /* dot11ReceivedFragmentCount */ + uint32 rxmulti; /* dot11MulticastReceivedFrameCount */ + uint32 rxcrc; /* dot11FCSErrorCount */ + uint32 txfrmsnt; /* dot11TransmittedFrameCount */ + uint32 rxundec; /* dot11WEPUndecryptableCount */ +} d11cnt_t; + +/* BRCM OUI */ +#define BRCM_OUI "\x00\x10\x18" + +/* BRCM info element */ +struct brcm_ie { + uchar id; + uchar len; + uchar oui[3]; + uchar ver; + uchar assoc; /* # of assoc STAs */ + uchar flags; /* misc flags */ +} PACKED; +#define BRCM_IE_LEN 8 +typedef struct brcm_ie brcm_ie_t; +#define BRCM_IE_VER 1 + +/* brcm_ie flags */ +#define BRF_ABCAP 0x1 /* afterburner capable */ +#define BRF_ABRQRD 0x2 /* afterburner requested */ + +/* WPA definitions */ +#define WPA_VERSION 1 +#define WPA_OUI "\x00\x50\xF2" + +#define WPA_OUI_LEN 3 + +/* WPA authentication modes */ +#define WPA_AUTH_NONE 0 /* None */ +#define WPA_AUTH_UNSPECIFIED 1 /* Unspecified authentication over 802.1X: default for WPA */ +#define WPA_AUTH_PSK 2 /* Pre-shared Key over 802.1X */ +#define WPA_AUTH_DISABLED 255 /* Legacy (i.e., non-WPA) */ + +#define IS_WPA_AUTH(auth) ((auth) == WPA_AUTH_NONE || \ + (auth) == WPA_AUTH_UNSPECIFIED || \ + (auth) == WPA_AUTH_PSK) + + +/* Key related defines */ +#define DOT11_MAX_DEFAULT_KEYS 4 /* number of default keys */ +#define DOT11_MAX_KEY_SIZE 32 /* max size of any key */ +#define DOT11_MAX_IV_SIZE 16 /* max size of any IV */ +#define DOT11_EXT_IV_FLAG (1<<5) /* flag to indicate IV is > 4 bytes */ + +#define WEP1_KEY_SIZE 5 /* max size of any WEP key */ +#define WEP1_KEY_HEX_SIZE 10 /* size of WEP key in hex. */ +#define WEP128_KEY_SIZE 13 /* max size of any WEP key */ +#define WEP128_KEY_HEX_SIZE 26 /* size of WEP key in hex. */ +#define TKIP_MIC_SIZE 8 /* size of TKIP MIC */ +#define TKIP_EOM_SIZE 7 /* max size of TKIP EOM */ +#define TKIP_EOM_FLAG 0x5a /* TKIP EOM flag byte */ +#define TKIP_KEY_SIZE 32 /* size of any TKIP key */ +#define TKIP_MIC_AUTH_TX 16 /* offset to Authenticator MIC TX key */ +#define TKIP_MIC_AUTH_RX 24 /* offset to Authenticator MIC RX key */ +#define TKIP_MIC_SUP_RX 16 /* offset to Supplicant MIC RX key */ +#define TKIP_MIC_SUP_TX 24 /* offset to Supplicant MIC TX key */ +#define AES_KEY_SIZE 16 /* size of AES key */ + +#undef PACKED +#if !defined(__GNUC__) +#pragma pack() +#endif + +#endif /* _802_11_H_ */ diff --git a/package/nvram/src/include/proto/ethernet.h b/package/nvram/src/include/proto/ethernet.h new file mode 100644 index 0000000000..173464af63 --- /dev/null +++ b/package/nvram/src/include/proto/ethernet.h @@ -0,0 +1,179 @@ +/******************************************************************************* + * $Id$ + * Copyright 2004, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * From FreeBSD 2.2.7: Fundamental constants relating to ethernet. + ******************************************************************************/ + +#ifndef _NET_ETHERNET_H_ /* use native BSD ethernet.h when available */ +#define _NET_ETHERNET_H_ + +#ifndef _TYPEDEFS_H_ +#include "typedefs.h" +#endif + +#if defined(__GNUC__) +#define PACKED __attribute__((packed)) +#else +#define PACKED +#endif + +/* + * The number of bytes in an ethernet (MAC) address. + */ +#ifndef ETHER_ADDR_LEN +#define ETHER_ADDR_LEN 6 +#endif + +/* + * The number of bytes in the type field. + */ +#ifndef ETHER_TYPE_LEN +#define ETHER_TYPE_LEN 2 +#endif + +/* + * The number of bytes in the trailing CRC field. + */ +#ifndef ETHER_CRC_LEN +#define ETHER_CRC_LEN 4 +#endif + +/* + * The length of the combined header. + */ +#ifndef ETHER_HDR_LEN +#define ETHER_HDR_LEN (ETHER_ADDR_LEN*2+ETHER_TYPE_LEN) +#endif + +/* + * The minimum packet length. + */ +#ifndef ETHER_MIN_LEN +#define ETHER_MIN_LEN 64 +#endif + +/* + * The minimum packet user data length. + */ +#ifndef ETHER_MIN_DATA +#define ETHER_MIN_DATA 46 +#endif + +/* + * The maximum packet length. + */ +#ifndef ETHER_MAX_LEN +#define ETHER_MAX_LEN 1518 +#endif + +/* + * The maximum packet user data length. + */ +#define ETHER_MAX_DATA 1500 + +/* + * Used to uniquely identify a 802.1q VLAN-tagged header. + */ +#define VLAN_TAG 0x8100 + +/* + * Located after dest & src address in ether header. + */ +#define VLAN_FIELDS_OFFSET (ETHER_ADDR_LEN * 2) + +/* + * 4 bytes of vlan field info. + */ +#define VLAN_FIELDS_SIZE 4 + +/* location of bits in 16-bit vlan fields */ +#define VLAN_PRI_SHIFT 13 /* user priority */ +#define VLAN_CFI_SHIFT 12 /* canonical format indicator bit */ + +/* 3 bits of priority */ +#define VLAN_PRI_MASK 7 +/* 12 bits of vlan identfier (VID) */ +#define VLAN_VID_MASK 0xFFF /* VLAN identifier (VID) field */ + +struct vlan_tags { + uint16 tag_type; /* 0x8100 for VLAN */ + uint16 tag_control; /* prio | cfi | vid */ +} PACKED ; + +/* 802.1X ethertype */ + +#define ETHER_TYPE_IP 0x0800 /* IP */ +#define ETHER_TYPE_BRCM 0x886c /* Broadcom Corp. */ +#define ETHER_TYPE_802_1X 0x888e /* 802.1x */ + +#define ETHER_BRCM_SUBTYPE_LEN 4 /* Broadcom 4byte subtype follows ethertype */ +#define ETHER_BRCM_CRAM 0x1 /* Broadcom subtype cram protocol */ + +/* + * A macro to validate a length with + */ +#define ETHER_IS_VALID_LEN(foo) \ + ((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN) + +#ifndef __NET_ETHERNET_H +#ifndef __INCif_etherh /* Quick and ugly hack for VxWorks */ +/* + * Structure of a 10Mb/s Ethernet header. + */ +struct ether_header { + uint8 ether_dhost[ETHER_ADDR_LEN]; + uint8 ether_shost[ETHER_ADDR_LEN]; + uint16 ether_type; +} PACKED ; + +/* + * Structure of a 48-bit Ethernet address. + */ +struct ether_addr { + uint8 octet[ETHER_ADDR_LEN]; +} PACKED ; +#endif +#endif + +/* + * Takes a pointer, returns true if a 48-bit multicast address + * (including broadcast, since it is all ones) + */ +#define ETHER_ISMULTI(ea) (((uint8 *)(ea))[0] & 1) + +/* + * Takes a pointer, returns true if a 48-bit broadcast (all ones) + */ +#define ETHER_ISBCAST(ea) ((((uint8 *)(ea))[0] & \ + ((uint8 *)(ea))[1] & \ + ((uint8 *)(ea))[2] & \ + ((uint8 *)(ea))[3] & \ + ((uint8 *)(ea))[4] & \ + ((uint8 *)(ea))[5]) == 0xff) + +static const struct ether_addr ether_bcast = {{255, 255, 255, 255, 255, 255}}; + +/* + * Takes a pointer, returns true if a 48-bit null address (all zeros) + */ +#define ETHER_ISNULLADDR(ea) ((((uint8 *)(ea))[0] | \ + ((uint8 *)(ea))[1] | \ + ((uint8 *)(ea))[2] | \ + ((uint8 *)(ea))[3] | \ + ((uint8 *)(ea))[4] | \ + ((uint8 *)(ea))[5]) == 0) + +/* Differentiated Services Codepoint - lower 6 bits of tos in iphdr */ +#define DSCP_PRI_MASK 0x3F /* bits 0-6 */ +#define DSCP_WME_PRI_MASK 0x38 /* bits 3-6 */ +#define DSCP_WME_PRI_SHIFT 3 + +#undef PACKED + +#endif /* _NET_ETHERNET_H_ */ diff --git a/package/nvram/src/include/shutils.h b/package/nvram/src/include/shutils.h new file mode 100644 index 0000000000..783ee9ede1 --- /dev/null +++ b/package/nvram/src/include/shutils.h @@ -0,0 +1,200 @@ +/* + * Shell-like utility functions + * + * Copyright 2004, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * + * $Id$ + */ + +#ifndef _shutils_h_ +#define _shutils_h_ +#include <string.h> +/* + * Reads file and returns contents + * @param fd file descriptor + * @return contents of file or NULL if an error occurred + */ +extern char * fd2str(int fd); + +/* + * Reads file and returns contents + * @param path path to file + * @return contents of file or NULL if an error occurred + */ +extern char * file2str(const char *path); + +/* + * Waits for a file descriptor to become available for reading or unblocked signal + * @param fd file descriptor + * @param timeout seconds to wait before timing out or 0 for no timeout + * @return 1 if descriptor changed status or 0 if timed out or -1 on error + */ +extern int waitfor(int fd, int timeout); + +/* + * Concatenates NULL-terminated list of arguments into a single + * commmand and executes it + * @param argv argument list + * @param path NULL, ">output", or ">>output" + * @param timeout seconds to wait before timing out or 0 for no timeout + * @param ppid NULL to wait for child termination or pointer to pid + * @return return value of executed command or errno + */ +extern int _eval(char *const argv[], char *path, int timeout, pid_t *ppid); + +/* + * Concatenates NULL-terminated list of arguments into a single + * commmand and executes it + * @param argv argument list + * @return stdout of executed command or NULL if an error occurred + */ +extern char * _backtick(char *const argv[]); + +/* + * Kills process whose PID is stored in plaintext in pidfile + * @param pidfile PID file + * @return 0 on success and errno on failure + */ +extern int kill_pidfile(char *pidfile); + +/* + * fread() with automatic retry on syscall interrupt + * @param ptr location to store to + * @param size size of each element of data + * @param nmemb number of elements + * @param stream file stream + * @return number of items successfully read + */ +extern int safe_fread(void *ptr, size_t size, size_t nmemb, FILE *stream); + +/* + * fwrite() with automatic retry on syscall interrupt + * @param ptr location to read from + * @param size size of each element of data + * @param nmemb number of elements + * @param stream file stream + * @return number of items successfully written + */ +extern int safe_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream); + +/* + * Convert Ethernet address string representation to binary data + * @param a string in xx:xx:xx:xx:xx:xx notation + * @param e binary data + * @return TRUE if conversion was successful and FALSE otherwise + */ +extern int ether_atoe(const char *a, unsigned char *e); + +/* + * Convert Ethernet address binary data to string representation + * @param e binary data + * @param a string in xx:xx:xx:xx:xx:xx notation + * @return a + */ +extern char * ether_etoa(const unsigned char *e, char *a); + +/* + * Concatenate two strings together into a caller supplied buffer + * @param s1 first string + * @param s2 second string + * @param buf buffer large enough to hold both strings + * @return buf + */ +static inline char * strcat_r(const char *s1, const char *s2, char *buf) +{ + strcpy(buf, s1); + strcat(buf, s2); + return buf; +} + +/* Check for a blank character; that is, a space or a tab */ +#define isblank(c) ((c) == ' ' || (c) == '\t') + +/* Strip trailing CR/NL from string <s> */ +#define chomp(s) ({ \ + char *c = (s) + strlen((s)) - 1; \ + while ((c > (s)) && (*c == '\n' || *c == '\r' || *c == ' ')) \ + *c-- = '\0'; \ + s; \ +}) + +/* Simple version of _backtick() */ +#define backtick(cmd, args...) ({ \ + char *argv[] = { cmd, ## args, NULL }; \ + _backtick(argv); \ +}) + +/* Simple version of _eval() (no timeout and wait for child termination) */ +#define eval(cmd, args...) ({ \ + char *argv[] = { cmd, ## args, NULL }; \ + _eval(argv, ">/dev/console", 0, NULL); \ +}) + +/* Copy each token in wordlist delimited by space into word */ +#define foreach(word, wordlist, next) \ + for (next = &wordlist[strspn(wordlist, " ")], \ + strncpy(word, next, sizeof(word)), \ + word[strcspn(word, " ")] = '\0', \ + word[sizeof(word) - 1] = '\0', \ + next = strchr(next, ' '); \ + strlen(word); \ + next = next ? &next[strspn(next, " ")] : "", \ + strncpy(word, next, sizeof(word)), \ + word[strcspn(word, " ")] = '\0', \ + word[sizeof(word) - 1] = '\0', \ + next = strchr(next, ' ')) + +/* Return NUL instead of NULL if undefined */ +#define safe_getenv(s) (getenv(s) ? : "") + +/* Print directly to the console */ +#define cprintf(fmt, args...) do { \ + FILE *fp = fopen("/dev/console", "w"); \ + if (fp) { \ + fprintf(fp, fmt, ## args); \ + fclose(fp); \ + } \ +} while (0) + +/* Debug print */ +#ifdef DEBUG +#define dprintf(fmt, args...) cprintf("%s: " fmt, __FUNCTION__, ## args) +#else +#define dprintf(fmt, args...) +#endif + +#ifdef vxworks + +#include <inetLib.h> +#define inet_aton(a, n) ((inet_aton((a), (n)) == ERROR) ? 0 : 1) +#define inet_ntoa(n) ({ char a[INET_ADDR_LEN]; inet_ntoa_b ((n), a); a; }) + +#include <typedefs.h> +#include <bcmutils.h> +#define ether_atoe(a, e) bcm_ether_atoe((a), (e)) +#define ether_etoa(e, a) bcm_ether_ntoa((e), (a)) + +/* These declarations are not available where you would expect them */ +extern int vsnprintf (char *, size_t, const char *, va_list); +extern int snprintf(char *str, size_t count, const char *fmt, ...); +extern char *strdup(const char *); +extern char *strsep(char **stringp, char *delim); +extern int strcasecmp(const char *s1, const char *s2); +extern int strncasecmp(const char *s1, const char *s2, size_t n); + +/* Neither are socket() and connect() */ +#include <sockLib.h> + +#ifdef DEBUG +#undef dprintf +#define dprintf printf +#endif +#endif + +#endif /* _shutils_h_ */ diff --git a/package/nvram/src/include/typedefs.h b/package/nvram/src/include/typedefs.h new file mode 100644 index 0000000000..6b0c25e042 --- /dev/null +++ b/package/nvram/src/include/typedefs.h @@ -0,0 +1,293 @@ +/* + * Copyright 2004, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * $Id$ + */ + +#ifndef _TYPEDEFS_H_ +#define _TYPEDEFS_H_ + + +/* Define 'SITE_TYPEDEFS' in the compile to include a site specific + * typedef file "site_typedefs.h". + * + * If 'SITE_TYPEDEFS' is not defined, then the "Inferred Typedefs" + * section of this file makes inferences about the compile environment + * based on defined symbols and possibly compiler pragmas. + * + * Following these two sections is the "Default Typedefs" + * section. This section is only prcessed if 'USE_TYPEDEF_DEFAULTS' is + * defined. This section has a default set of typedefs and a few + * proprocessor symbols (TRUE, FALSE, NULL, ...). + */ + +#ifdef SITE_TYPEDEFS + +/******************************************************************************* + * Site Specific Typedefs + *******************************************************************************/ + +#include "site_typedefs.h" + +#else + +/******************************************************************************* + * Inferred Typedefs + *******************************************************************************/ + +/* Infer the compile environment based on preprocessor symbols and pramas. + * Override type definitions as needed, and include configuration dependent + * header files to define types. + */ + +#ifdef __cplusplus + +#define TYPEDEF_BOOL +#ifndef FALSE +#define FALSE false +#endif +#ifndef TRUE +#define TRUE true +#endif + +#else /* ! __cplusplus */ + +/* for Windows build, define bool as a uchar instead of the default int */ +#if defined(_WIN32) + +#define TYPEDEF_BOOL +typedef unsigned char bool; + +#endif /* _WIN32 */ + +#endif /* ! __cplusplus */ + +#ifdef _MSC_VER /* Microsoft C */ +#define TYPEDEF_INT64 +#define TYPEDEF_UINT64 +typedef signed __int64 int64; +typedef unsigned __int64 uint64; +#endif + +#if defined(MACOSX) && defined(KERNEL) +#define TYPEDEF_BOOL +#endif + + +#if defined(linux) +#define TYPEDEF_UINT +#define TYPEDEF_USHORT +#define TYPEDEF_ULONG +#endif + +#if !defined(linux) && !defined(_WIN32) && !defined(PMON) && !defined(_CFE_) +#define TYPEDEF_UINT +#define TYPEDEF_USHORT +#endif + + +/* Do not support the (u)int64 types with strict ansi for GNU C */ +#if defined(__GNUC__) && defined(__STRICT_ANSI__) +#define TYPEDEF_INT64 +#define TYPEDEF_UINT64 +#endif + +/* ICL accepts unsigned 64 bit type only, and complains in ANSI mode + * for singned or unsigned */ +#if defined(__ICL) + +#define TYPEDEF_INT64 + +#if defined(__STDC__) +#define TYPEDEF_UINT64 +#endif + +#endif /* __ICL */ + + +#if !defined(_WIN32) && !defined(PMON) && !defined(_CFE_) + +/* pick up ushort & uint from standard types.h */ +#if defined(linux) && defined(__KERNEL__) + +#include <linux/types.h> /* sys/types.h and linux/types.h are oil and water */ + +#else + +#include <sys/types.h> + +#endif + +#endif /* !_WIN32 && !PMON && !_CFE_ */ + +#if defined(MACOSX) && defined(KERNEL) +#include <IOKit/IOTypes.h> +#endif + + +/* use the default typedefs in the next section of this file */ +#define USE_TYPEDEF_DEFAULTS + +#endif /* SITE_TYPEDEFS */ + + +/******************************************************************************* + * Default Typedefs + *******************************************************************************/ + +#ifdef USE_TYPEDEF_DEFAULTS +#undef USE_TYPEDEF_DEFAULTS + +#ifndef TYPEDEF_BOOL +typedef int bool; +#endif + +/*----------------------- define uchar, ushort, uint, ulong ----------------*/ + +#ifndef TYPEDEF_UCHAR +typedef unsigned char uchar; +#endif + +#ifndef TYPEDEF_USHORT +typedef unsigned short ushort; +#endif + +#ifndef TYPEDEF_UINT +typedef unsigned int uint; +#endif + +#ifndef TYPEDEF_ULONG +typedef unsigned long ulong; +#endif + +/*----------------------- define [u]int8/16/32/64 --------------------------*/ + +#ifndef TYPEDEF_UINT8 +typedef unsigned char uint8; +#endif + +#ifndef TYPEDEF_UINT16 +typedef unsigned short uint16; +#endif + +#ifndef TYPEDEF_UINT32 +typedef unsigned int uint32; +#endif + +#ifndef TYPEDEF_UINT64 +typedef unsigned long long uint64; +#endif + +#ifndef TYPEDEF_INT8 +typedef signed char int8; +#endif + +#ifndef TYPEDEF_INT16 +typedef signed short int16; +#endif + +#ifndef TYPEDEF_INT32 +typedef signed int int32; +#endif + +#ifndef TYPEDEF_INT64 +typedef signed long long int64; +#endif + +/*----------------------- define float32/64, float_t -----------------------*/ + +#ifndef TYPEDEF_FLOAT32 +typedef float float32; +#endif + +#ifndef TYPEDEF_FLOAT64 +typedef double float64; +#endif + +/* + * abstracted floating point type allows for compile time selection of + * single or double precision arithmetic. Compiling with -DFLOAT32 + * selects single precision; the default is double precision. + */ + +#ifndef TYPEDEF_FLOAT_T + +#if defined(FLOAT32) +typedef float32 float_t; +#else /* default to double precision floating point */ +typedef float64 float_t; +#endif + +#endif /* TYPEDEF_FLOAT_T */ + +/*----------------------- define macro values -----------------------------*/ + +#ifndef FALSE +#define FALSE 0 +#endif + +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef NULL +#define NULL 0 +#endif + +#ifndef OFF +#define OFF 0 +#endif + +#ifndef ON +#define ON 1 +#endif + +/*----------------------- define PTRSZ, INLINE ----------------------------*/ + +#ifndef PTRSZ +#define PTRSZ sizeof (char*) +#endif + +#ifndef INLINE + +#ifdef _MSC_VER + +#define INLINE __inline + +#elif __GNUC__ + +#define INLINE __inline__ + +#else + +#define INLINE + +#endif /* _MSC_VER */ + +#endif /* INLINE */ + +#undef TYPEDEF_BOOL +#undef TYPEDEF_UCHAR +#undef TYPEDEF_USHORT +#undef TYPEDEF_UINT +#undef TYPEDEF_ULONG +#undef TYPEDEF_UINT8 +#undef TYPEDEF_UINT16 +#undef TYPEDEF_UINT32 +#undef TYPEDEF_UINT64 +#undef TYPEDEF_INT8 +#undef TYPEDEF_INT16 +#undef TYPEDEF_INT32 +#undef TYPEDEF_INT64 +#undef TYPEDEF_FLOAT32 +#undef TYPEDEF_FLOAT64 +#undef TYPEDEF_FLOAT_T + +#endif /* USE_TYPEDEF_DEFAULTS */ + +#endif /* _TYPEDEFS_H_ */ diff --git a/package/nvram/src/include/utils.h b/package/nvram/src/include/utils.h new file mode 100644 index 0000000000..b8d1cdb7bf --- /dev/null +++ b/package/nvram/src/include/utils.h @@ -0,0 +1,131 @@ +#include <cy_conf.h> + +extern int diag_led(int type, int act); +extern int C_led(int i); +extern int get_single_ip(char *ipaddr, int which); +extern char *get_mac_from_ip(char *ip); +extern struct dns_lists *get_dns_list(int no); +extern int dns_to_resolv(void); +extern char *get_wan_face(void); +extern int check_wan_link(int num); +extern char *get_complete_lan_ip(char *ip); +extern int get_int_len(int num); +extern int file_to_buf(char *path, char *buf, int len); +extern int buf_to_file(char *path, char *buf); +extern pid_t* find_pid_by_name( char* pidName); +extern int find_pid_by_ps(char* pidName); +extern int *find_all_pid_by_ps(char* pidName); +extern char *find_name_by_proc(int pid); +extern int get_ppp_pid(char *file); +extern long convert_ver(char *ver); +extern int check_flash(void); +extern int check_action(void); +extern int check_now_boot(void); +extern int check_hw_type(void); +extern int is_exist(char *filename); +extern void set_ip_forward(char c); +struct mtu_lists *get_mtu(char *proto); +extern void set_host_domain_name(void); + +extern void encode(char *buf, int len); +extern void decode(char *buf, int len); + +extern int sys_netdev_ioctl(int family, int socket, char *if_name, int cmd, struct ifreq *ifr); + +int ct_openlog(const char *ident, int option, int facility, char *log_name); +void ct_syslog(int level, int enable, const char *fmt,...); +void ct_logger(int level, const char *fmt,...); +struct wl_assoc_mac * get_wl_assoc_mac(int *c); + + + +enum { DMZ, SESSION, DIAG , WL}; + +enum { START_LED, STOP_LED }; + +typedef enum { ACT_IDLE, + ACT_TFTP_UPGRADE, + ACT_WEB_UPGRADE, + ACT_WEBS_UPGRADE, + ACT_SW_RESTORE, + ACT_HW_RESTORE } ACTION; + +enum { UNKNOWN_BOOT = -1, PMON_BOOT, CFE_BOOT }; + +enum { BCM4702_CHIP, BCM4712_CHIP, BCM5325E_CHIP }; + +enum { FIRST, SECOND }; + +enum { SYSLOG_LOG=1, SYSLOG_DEBUG, CONSOLE_ONLY, LOG_CONSOLE, DEBUG_CONSOLE }; + +#define ACTION(cmd) buf_to_file(ACTION_FILE, cmd) + +struct dns_lists { + int num_servers; + char dns_server[4][16]; +}; + +#define NOT_USING 0 +#define USING 1 + +struct wl_assoc_mac +{ + char mac[18]; +}; + +struct mtu_lists { + char *proto; /* protocol */ + char *min; /* min mtu */ + char *max; /* max mtu */ +}; + + +#define PPP_PSEUDO_IP "10.64.64.64" +#define PPP_PSEUDO_NM "255.255.255.255" +#define PPP_PSEUDO_GW "10.112.112.112" + +#define PING_TMP "/tmp/ping.log" +#define TRACEROUTE_TMP "/tmp/traceroute.log" +#define MAX_BUF_LEN 254 + +#define RESOLV_FILE "/tmp/resolv.conf" +#define HOSTS_FILE "/tmp/hosts" + +#define LOG_FILE "/var/log/mess" + +#define ACTION_FILE "/tmp/action" + + +#define split(word, wordlist, next, delim) \ + for (next = wordlist, \ + strncpy(word, next, sizeof(word)), \ + word[(next=strstr(next, delim)) ? strstr(word, delim) - word : sizeof(word) - 1] = '\0', \ + next = next ? next + sizeof(delim) - 1 : NULL ; \ + strlen(word); \ + next = next ? : "", \ + strncpy(word, next, sizeof(word)), \ + word[(next=strstr(next, delim)) ? strstr(word, delim) - word : sizeof(word) - 1] = '\0', \ + next = next ? next + sizeof(delim) - 1 : NULL) + +#define STRUCT_LEN(name) sizeof(name)/sizeof(name[0]) + +#define printHEX(str,len) { \ + int i; \ + for (i=0 ; i<len ; i++) { \ + printf("%02X ", (unsigned char)*(str+i)); \ + if(((i+1)%16) == 0) printf("- "); \ + if(((i+1)%32) == 0) printf("\n"); \ + } \ + printf("\n\n"); \ +} + + +#define printASC(str,len) { \ + int i; \ + for (i=0 ; i<len ; i++) { \ + printf("%c", (unsigned char)*(str+i)); \ + if(((i+1)%16) == 0) printf("- "); \ + if(((i+1)%32) == 0) printf("\n"); \ + } \ + printf("\n\n"); \ +} diff --git a/package/nvram/src/include/wlcompat.h b/package/nvram/src/include/wlcompat.h new file mode 100644 index 0000000000..a4fc13439d --- /dev/null +++ b/package/nvram/src/include/wlcompat.h @@ -0,0 +1,36 @@ +/* + * wlcompat.h + * + * Copyright (C) 2005 Felix Fietkau <nbd@vd-s.ath.cx> + * + * 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 the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + */ +#include <linux/wireless.h> + +#ifndef WLCOMPAT_H +#define WLCOMPAT_H + +#define WLCOMPAT_SET_MONITOR SIOCIWFIRSTPRIV + 0 +#define WLCOMPAT_GET_MONITOR SIOCIWFIRSTPRIV + 1 +#define WLCOMPAT_SET_TXPWR_LIMIT SIOCIWFIRSTPRIV + 2 +#define WLCOMPAT_GET_TXPWR_LIMIT SIOCIWFIRSTPRIV + 3 +#define WLCOMPAT_SET_ANTDIV SIOCIWFIRSTPRIV + 4 +#define WLCOMPAT_GET_ANTDIV SIOCIWFIRSTPRIV + 5 +#define WLCOMPAT_SET_TXANT SIOCIWFIRSTPRIV + 6 +#define WLCOMPAT_GET_TXANT SIOCIWFIRSTPRIV + 7 + +#endif diff --git a/package/nvram/src/include/wlioctl.h b/package/nvram/src/include/wlioctl.h new file mode 100644 index 0000000000..66783cc44d --- /dev/null +++ b/package/nvram/src/include/wlioctl.h @@ -0,0 +1,1097 @@ +/* + * Custom OID/ioctl definitions for + * Broadcom 802.11abg Networking Device Driver + * + * Definitions subject to change without notice. + * + * Copyright 2004, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * + * $Id$ + */ + +#ifndef _wlioctl_h_ +#define _wlioctl_h_ + +#include <typedefs.h> +#include <proto/ethernet.h> +#include <proto/802.11.h> + +#if defined(__GNUC__) +#define PACKED __attribute__((packed)) +#else +#define PACKED +#endif + +#define WLC_ESSID_MAX_SIZE 32 + +#define WL_NUMRATES 255 /* max # of rates in a rateset */ + +typedef struct wl_rateset { + uint32 count; /* # rates in this set */ + uint8 rates[WL_NUMRATES]; /* rates in 500kbps units w/hi bit set if basic */ +} wl_rateset_t; + +#define WL_CHANSPEC_CHAN_MASK 0x0fff +#define WL_CHANSPEC_BAND_MASK 0xf000 +#define WL_CHANSPEC_BAND_SHIFT 12 +#define WL_CHANSPEC_BAND_A 0x1000 +#define WL_CHANSPEC_BAND_B 0x2000 + +/* + * Per-bss information structure. + */ + +#define WL_LEGACY_BSS_INFO_VERSION 106 /* an older supported version of wl_bss_info struct */ +#define WL_BSS_INFO_VERSION 107 /* current version of wl_bss_info struct */ + +typedef struct wl_bss_info106 { + uint version; /* version field */ + struct ether_addr BSSID; + uint8 SSID_len; + uint8 SSID[32]; + uint8 Privacy; /* 0=No WEP, 1=Use WEP */ + int16 RSSI; /* receive signal strength (in dBm) */ + uint16 beacon_period; /* units are Kusec */ + uint16 atim_window; /* units are Kusec */ + uint8 channel; /* Channel no. */ + int8 infra; /* 0=IBSS, 1=infrastructure, 2=unknown */ + struct { + uint count; /* # rates in this set */ + uint8 rates[12]; /* rates in 500kbps units w/hi bit set if basic */ + } rateset; /* supported rates */ + uint8 dtim_period; /* DTIM period */ + int8 phy_noise; /* noise right after tx (in dBm) */ + uint16 capability; /* Capability information */ + struct dot11_bcn_prb *prb; /* probe response frame (ioctl na) */ + uint16 prb_len; /* probe response frame length (ioctl na) */ + struct { + uint8 supported; /* wpa supported */ + uint8 multicast; /* multicast cipher */ + uint8 ucount; /* count of unicast ciphers */ + uint8 unicast[4]; /* unicast ciphers */ + uint8 acount; /* count of auth modes */ + uint8 auth[4]; /* Authentication modes */ + } wpa; +} wl_bss_info106_t; + +typedef struct wl_bss_info { + uint32 version; /* version field */ + uint32 length; /* byte length of data in this record, starting at version and including IEs */ + struct ether_addr BSSID; + uint16 beacon_period; /* units are Kusec */ + uint16 capability; /* Capability information */ + uint8 SSID_len; + uint8 SSID[32]; + struct { + uint count; /* # rates in this set */ + uint8 rates[16]; /* rates in 500kbps units w/hi bit set if basic */ + } rateset; /* supported rates */ + uint8 channel; /* Channel no. */ + uint16 atim_window; /* units are Kusec */ + uint8 dtim_period; /* DTIM period */ + int16 RSSI; /* receive signal strength (in dBm) */ + int8 phy_noise; /* noise (in dBm) */ + uint32 ie_length; /* byte length of Information Elements */ + /* variable length Information Elements */ +} wl_bss_info_t; + +typedef struct wlc_ssid { + uint32 SSID_len; + uchar SSID[32]; +} wlc_ssid_t; + +typedef struct wl_scan_params { + wlc_ssid_t ssid; /* default is {0, ""} */ + struct ether_addr bssid;/* default is bcast */ + int8 bss_type; /* default is any, DOT11_BSSTYPE_ANY/INFRASTRUCTURE/INDEPENDENT */ + int8 scan_type; /* -1 use default, DOT11_SCANTYPE_ACTIVE/PASSIVE */ + int32 nprobes; /* -1 use default, number of probes per channel */ + int32 active_time; /* -1 use default, dwell time per channel for active scanning */ + int32 passive_time; /* -1 use default, dwell time per channel for passive scanning */ + int32 home_time; /* -1 use default, dwell time for the home channel between channel scans */ + int32 channel_num; /* 0 use default (all available channels), count of channels in channel_list */ + uint16 channel_list[1]; /* list of chanspecs */ +} wl_scan_params_t; +/* size of wl_scan_params not including variable length array */ +#define WL_SCAN_PARAMS_FIXED_SIZE 64 + +typedef struct wl_scan_results { + uint32 buflen; + uint32 version; + uint32 count; + wl_bss_info_t bss_info[1]; +} wl_scan_results_t; +/* size of wl_scan_results not including variable length array */ +#define WL_SCAN_RESULTS_FIXED_SIZE 12 + +/* uint32 list */ +typedef struct wl_uint32_list { + /* in - # of elements, out - # of entries */ + uint32 count; + /* variable length uint32 list */ + uint32 element[1]; +} wl_uint32_list_t; + +#define WLC_CNTRY_BUF_SZ 4 /* Country string is 3 bytes + NULL */ + +typedef struct wl_channels_in_country { + uint32 buflen; + uint32 band; + char country_abbrev[WLC_CNTRY_BUF_SZ]; + uint32 count; + uint32 channel[1]; +} wl_channels_in_country_t; + +typedef struct wl_country_list { + uint32 buflen; + uint32 band_set; + uint32 band; + uint32 count; + char country_abbrev[1]; +} wl_country_list_t; + +#define WL_RM_TYPE_BASIC 1 +#define WL_RM_TYPE_CCA 2 +#define WL_RM_TYPE_RPI 3 + +#define WL_RM_FLAG_PARALLEL (1<<0) + +#define WL_RM_FLAG_LATE (1<<1) +#define WL_RM_FLAG_INCAPABLE (1<<2) +#define WL_RM_FLAG_REFUSED (1<<3) + +typedef struct wl_rm_req_elt { + int8 type; + int8 flags; + uint16 chanspec; + uint32 token; /* token for this measurement */ + uint32 tsf_h; /* TSF high 32-bits of Measurement start time */ + uint32 tsf_l; /* TSF low 32-bits */ + uint32 dur; /* TUs */ +} wl_rm_req_elt_t; + +typedef struct wl_rm_req { + uint32 token; /* overall measurement set token */ + uint32 count; /* number of measurement reqests */ + wl_rm_req_elt_t req[1]; /* variable length block of requests */ +} wl_rm_req_t; +#define WL_RM_REQ_FIXED_LEN 8 + +typedef struct wl_rm_rep_elt { + int8 type; + int8 flags; + uint16 chanspec; + uint32 token; /* token for this measurement */ + uint32 tsf_h; /* TSF high 32-bits of Measurement start time */ + uint32 tsf_l; /* TSF low 32-bits */ + uint32 dur; /* TUs */ + uint32 len; /* byte length of data block */ + uint8 data[1]; /* variable length data block */ +} wl_rm_rep_elt_t; +#define WL_RM_REP_ELT_FIXED_LEN 24 /* length excluding data block */ + +#define WL_RPI_REP_BIN_NUM 8 +typedef struct wl_rm_rpi_rep { + uint8 rpi[WL_RPI_REP_BIN_NUM]; + int8 rpi_max[WL_RPI_REP_BIN_NUM]; +} wl_rm_rpi_rep_t; + +typedef struct wl_rm_rep { + uint32 token; /* overall measurement set token */ + uint32 len; /* length of measurement report block */ + wl_rm_rep_elt_t rep[1]; /* variable length block of reports */ +} wl_rm_rep_t; +#define WL_RM_REP_FIXED_LEN 8 + + +#define WLC_MAX_KEY_SIZE 32 /* max size of any key */ +#define WLC_MAX_IV_SIZE 16 /* max size of any IV */ +#define WLC_EXT_IV_FLAG (1<<5) /* flag to indicate IV is > 4 bytes */ +#define WLC_MAX_DEFAULT_KEYS 4 /* # of default WEP keys */ +#define WLC_MAX_KEYS 54 /* Max # of WEP keys */ +#define WLC_WEP1_KEY_SIZE 5 /* max size of any WEP key */ +#define WLC_WEP1_KEY_HEX_SIZE 10 /* size of WEP key in hex. */ +#define WLC_WEP128_KEY_SIZE 13 /* max size of any WEP key */ +#define WLC_WEP128_KEY_HEX_SIZE 26 /* size of WEP key in hex. */ +#define WLC_TKIP_MIC_SIZE 8 /* size of TKIP MIC */ +#define WLC_TKIP_EOM_SIZE 7 /* max size of TKIP EOM */ +#define WLC_TKIP_EOM_FLAG 0x5a /* TKIP EOM flag byte */ +#define WLC_TKIP_KEY_SIZE 32 /* size of any TKIP key */ +#define WLC_TKIP_MIC_AUTH_TX 16 /* offset to Authenticator MIC TX key */ +#define WLC_TKIP_MIC_AUTH_RX 24 /* offset to Authenticator MIC RX key */ +#define WLC_TKIP_MIC_SUP_RX 16 /* offset to Supplicant MIC RX key */ +#define WLC_TKIP_MIC_SUP_TX 24 /* offset to Supplicant MIC TX key */ +#define WLC_TKIP_P1_KEY_SIZE 10 /* size of TKHash Phase1 output, in bytes */ +#define WLC_TKIP_P2_KEY_SIZE 16 /* size of TKHash Phase2 output */ +#define WLC_AES_KEY_SIZE 16 /* size of AES key */ + + +typedef enum sup_auth_status { + WLC_SUP_DISCONNECTED = 0, + WLC_SUP_CONNECTING, + WLC_SUP_IDREQUIRED, + WLC_SUP_AUTHENTICATING, + WLC_SUP_AUTHENTICATED, + WLC_SUP_KEYXCHANGE, + WLC_SUP_KEYED +} sup_auth_status_t; + +/* Enumerate crypto algorithms */ +#define CRYPTO_ALGO_OFF 0 +#define CRYPTO_ALGO_WEP1 1 +#define CRYPTO_ALGO_TKIP 2 +#define CRYPTO_ALGO_WEP128 3 +#define CRYPTO_ALGO_AES_CCM 4 +#define CRYPTO_ALGO_AES_OCB_MSDU 5 +#define CRYPTO_ALGO_AES_OCB_MPDU 6 +#define CRYPTO_ALGO_NALG 7 + +#define WSEC_GEN_MIC_ERROR 0x0001 +#define WSEC_GEN_REPLAY 0x0002 + +#define WL_SOFT_KEY (1 << 0) /* Indicates this key is using soft encrypt */ +#define WL_PRIMARY_KEY (1 << 1) /* Indicates this key is the primary (ie tx) key */ +#define WL_KF_RES_4 (1 << 4) /* Reserved for backward compat */ +#define WL_KF_RES_5 (1 << 5) /* Reserved for backward compat */ + + +typedef struct wlc_tkip_info { + uint16 phase1[WLC_TKIP_P1_KEY_SIZE/sizeof(uint16)]; /* tkhash phase1 result */ + uint8 phase2[WLC_TKIP_P2_KEY_SIZE]; /* tkhash phase2 result */ + uint32 micl; + uint32 micr; +} tkip_info_t; + +typedef struct _wsec_iv { + uint32 hi; /* upper 32 bits of IV */ + uint16 lo; /* lower 16 bits of IV */ +} wsec_iv_t; + +typedef struct wsec_key { + uint32 index; /* key index */ + uint32 len; /* key length */ + uint8 data[WLC_MAX_KEY_SIZE]; /* key data */ + tkip_info_t tkip_tx; /* tkip transmit state */ + tkip_info_t tkip_rx; /* tkip receive state */ + uint32 algo; /* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */ + uint32 flags; /* misc flags */ + uint32 algo_hw; /* cache for hw register*/ + uint32 aes_mode; /* cache for hw register*/ + int iv_len; /* IV length */ + int iv_initialized; /* has IV been initialized already? */ + int icv_len; /* ICV length */ + wsec_iv_t rxiv; /* Rx IV */ + wsec_iv_t txiv; /* Tx IV */ + struct ether_addr ea; /* per station */ +} wsec_key_t; + + + +typedef struct wl_wsec_key { + uint32 index; /* key index */ + uint32 len; /* key length */ + uint8 data[DOT11_MAX_KEY_SIZE]; /* key data */ + uint32 pad_1[18]; + uint32 algo; /* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */ + uint32 flags; /* misc flags */ + uint32 pad_2[2]; + int pad_3; + int iv_initialized; /* has IV been initialized already? */ + int pad_4; + /* Rx IV */ + struct { + uint32 hi; /* upper 32 bits of IV */ + uint16 lo; /* lower 16 bits of IV */ + } rxiv; + uint32 pad_5[2]; + struct ether_addr ea; /* per station */ +} wl_wsec_key_t; + +/* For use with wlc_wep_key.flags */ +#define WSEC_PRIMARY_KEY (1 << 1) /* Indicates this key is the primary (ie tx) key */ +#define WSEC_TKIP_ERROR (1 << 2) /* Provoke deliberate error */ + +#define WSEC_MIN_PSK_LEN 8 +#define WSEC_MAX_PSK_LEN 64 + +/* Flag for key material needing passhash'ing */ +#define WSEC_PASSPHRASE (1<<0) + +/* recepticle for WLC_SET_WSEC_PMK parameter */ +typedef struct { + ushort key_len; /* octets in key material */ + ushort flags; /* key handling qualification */ + uint8 key[WSEC_MAX_PSK_LEN]; /* PMK material */ +} wsec_pmk_t; + +/* wireless security bitvec */ +#define WEP_ENABLED 1 +#define TKIP_ENABLED 2 +#define AES_ENABLED 4 +#define WSEC_SWFLAG 8 + +#define WSEC_SW(wsec) ((wsec) & WSEC_SWFLAG) +#define WSEC_HW(wsec) (!WSEC_SW(wsec)) +#define WSEC_WEP_ENABLED(wsec) ((wsec) & WEP_ENABLED) +#define WSEC_TKIP_ENABLED(wsec) ((wsec) & TKIP_ENABLED) +#define WSEC_AES_ENABLED(wsec) ((wsec) & AES_ENABLED) +#define WSEC_ENABLED(wsec) ((wsec) & (WEP_ENABLED | TKIP_ENABLED | AES_ENABLED)) + + +/* wireless authentication bit vector */ +#define WPA_ENABLED 1 +#define PSK_ENABLED 2 + +#define WAUTH_WPA_ENABLED(wauth) ((wauth) & WPA_ENABLED) +#define WAUTH_PSK_ENABLED(wauth) ((wauth) & PSK_ENABLED) +#define WAUTH_ENABLED(wauth) ((wauth) & (WPA_ENABLED | PSK_ENABLED)) + +/* group/mcast cipher */ +#define WPA_MCAST_CIPHER(wsec) (((wsec) & TKIP_ENABLED) ? WPA_CIPHER_TKIP : \ + ((wsec) & AES_ENABLED) ? WPA_CIPHER_AES_CCM : \ + WPA_CIPHER_NONE) + + +typedef struct wl_led_info { + uint32 index; /* led index */ + uint32 behavior; + bool activehi; +} wl_led_info_t; + +/* + * definitions for driver messages passed from WL to NAS. + */ +/* Use this to recognize wpa and 802.1x driver messages. */ +static const uint8 wl_wpa_snap_template[] = + { 0xaa, 0xaa, 0x03, 0x00, 0x90, 0x4c }; + +#define WL_WPA_MSG_IFNAME_MAX 16 + +/* WPA driver message */ +typedef struct wl_wpa_header { + struct ether_header eth; + struct dot11_llc_snap_header snap; + uint8 version; + uint8 type; + /* version 2 additions */ + char ifname[WL_WPA_MSG_IFNAME_MAX]; + /* version specific data */ + /* uint8 data[1]; */ +} wl_wpa_header_t PACKED; + +/* + * definitions for 802.2 messages passed from WL to NAS. + */ +/* This seems not to be defined outside the kernel on linux. */ +#ifndef ETH_P_802_2 +#define ETH_P_802_2 4 +#endif + +#define WL_WPA_HEADER_LEN (ETHER_HDR_LEN + DOT11_LLC_SNAP_HDR_LEN + 2 + WL_WPA_MSG_IFNAME_MAX) + +/* WPA driver message ethertype - private between wlc and nas */ +#define WL_WPA_ETHER_TYPE 0x9999 + +/* WPA driver message current version */ +#define WL_WPA_MSG_VERSION 2 + +/* Type field values for the 802.2 driver messages for WPA. */ +#define WLC_ASSOC_MSG 1 +#define WLC_DISASSOC_MSG 2 +#define WLC_PTK_MIC_MSG 3 +#define WLC_GTK_MIC_MSG 4 + +/* Use this to recognize 802.2 driver messages. */ +static const uint8 wpa_snap_template[] = + { 0xaa, 0xaa, 0x03, 0x00, 0x90, 0x4c }; + + +/* 802.1x driver message */ +typedef struct wl_eapol_header { + struct ether_header eth; + struct dot11_llc_snap_header snap; + uint8 version; + uint8 reserved; + char ifname[WL_WPA_MSG_IFNAME_MAX]; + /* version specific data */ + /* uint8 802_1x_msg[1]; */ +} wl_eapol_header_t PACKED; + +#define WL_EAPOL_HEADER_LEN (ETHER_HDR_LEN + DOT11_LLC_SNAP_HDR_LEN + 2 + WL_WPA_MSG_IFNAME_MAX) + +/* 802.1x driver message ethertype - private between wlc and nas */ +#define WL_EAPOL_ETHER_TYPE 0x999A + +/* 802.1x driver message current version */ +#define WL_EAPOL_MSG_VERSION 1 + +/* srom read/write struct passed through ioctl */ +typedef struct { + uint byteoff; /* byte offset */ + uint nbytes; /* number of bytes */ + uint16 buf[1]; +} srom_rw_t; + +/* R_REG and W_REG struct passed through ioctl */ +typedef struct { + uint32 byteoff; /* byte offset of the field in d11regs_t */ + uint32 val; /* read/write value of the field */ + uint32 size; /* sizeof the field */ +} rw_reg_t; + +/* Structure used by GET/SET_ATTEN ioctls */ +typedef struct { + uint16 auto_ctrl; /* 1: Automatic control, 0: overriden */ + uint16 bb; /* Baseband attenuation */ + uint16 radio; /* Radio attenuation */ + uint16 txctl1; /* Radio TX_CTL1 value */ +} atten_t; + +/* Used to get specific STA parameters */ +typedef struct { + uint32 val; + struct ether_addr ea; +} scb_val_t; + +/* callback registration data types */ + +typedef struct _mac_event_params { + uint msg; + struct ether_addr *addr; + uint result; + uint status; + uint auth_type; +} mac_event_params_t; + +typedef struct _mic_error_params { + struct ether_addr *ea; + bool group; + bool flush_txq; +} mic_error_params_t; + +typedef enum _wl_callback { + WL_MAC_EVENT_CALLBACK = 0, + WL_LINK_UP_CALLBACK, + WL_LINK_DOWN_CALLBACK, + WL_MIC_ERROR_CALLBACK, + WL_LAST_CALLBACK +} wl_callback_t; + +typedef struct _callback { + void (*fn)(void *, void *); + void *context; +} callback_t; + +typedef struct _scan_callback { + void (*fn)(void *); + void *context; +} scan_callback_t; + +/* used to register an arbitrary callback via the IOCTL interface */ +typedef struct _set_callback { + int index; + callback_t callback; +} set_callback_t; + + + +/* Event data type */ +typedef struct { + uint msg; /* Message (see below) */ + struct ether_addr *addr; /* Station address (if applicable) */ + uint status; /* Status code (see below) */ + uint reason; /* Reason code (if applicable) */ + uint auth_type; /* WLC_E_AUTH */ + bool link; /* WLC_E_LINK */ + bool group; /* WLC_E_MIC_ERROR */ + bool flush_txq; /* WLC_E_MIC_ERROR */ +} wlc_event_t; + +typedef struct { + uint16 ver; /* version of this struct */ + uint16 cap; /* sta's advertized capabilities */ + uint32 flags; /* flags defined below */ + uint32 idle; /* time since data pkt rx'd from sta */ + struct ether_addr ea; /* Station address */ + wl_rateset_t rateset; /* rateset in use */ +} sta_info_t; + +#define WL_STA_INFO_LEN 300 +#define WL_STA_VER 1 + +/* flags fields */ +#define WL_STA_BRCM 0x01 +#define WL_STA_WME 0x02 +#define WL_STA_ABCAP 0x04 +#define WL_STA_AUTHE 0x08 +#define WL_STA_ASSOC 0x10 +#define WL_STA_AUTHO 0x20 + +/* Event messages */ +#define WLC_E_SET_SSID 1 +#define WLC_E_JOIN 2 +#define WLC_E_START 3 +#define WLC_E_AUTH 4 +#define WLC_E_AUTH_IND 5 +#define WLC_E_DEAUTH 6 +#define WLC_E_DEAUTH_IND 7 +#define WLC_E_ASSOC 8 +#define WLC_E_ASSOC_IND 9 +#define WLC_E_REASSOC 10 +#define WLC_E_REASSOC_IND 11 +#define WLC_E_DISASSOC 12 +#define WLC_E_DISASSOC_IND 13 +#define WLC_E_QUIET_START 14 /* 802.11h Quiet period started */ +#define WLC_E_QUIET_END 15 /* 802.11h Quiet period ended */ +#define WLC_E_GOT_BEACONS 16 +#define WLC_E_LINK 17 /* Link indication */ +#define WLC_E_MIC_ERROR 18 /* TKIP MIC error occurred */ +#define WLC_E_NDIS_LINK 19 /* NDIS style link indication */ +#define WLC_E_ROAM 20 +#define WLC_E_LAST 21 + +/* Event status codes */ +#define WLC_E_STATUS_SUCCESS 0 +#define WLC_E_STATUS_FAIL 1 +#define WLC_E_STATUS_TIMEOUT 2 +#define WLC_E_STATUS_NO_NETWORKS 3 +#define WLC_E_STATUS_ABORT 4 + +typedef struct wlc_event_cb { + uint msg; /* Event message or 0 for all */ + void (*fn)(void *, wlc_event_t *); /* Callback function */ + void *context; /* Passed to callback function */ + struct wlc_event_cb *next; /* Next in the chain */ +} wlc_event_cb_t; + +/* + * Country locale determines which channels are available to us. + */ +typedef enum _wlc_locale { + WLC_WW = 0, /* Worldwide */ + WLC_THA, /* Thailand */ + WLC_ISR, /* Israel */ + WLC_JDN, /* Jordan */ + WLC_PRC, /* China */ + WLC_JPN, /* Japan */ + WLC_FCC, /* USA */ + WLC_EUR, /* Europe */ + WLC_USL, /* US Low Band only */ + WLC_JPH, /* Japan High Band only */ + WLC_ALL, /* All the channels in this band */ + WLC_11D, /* Represents locale recieved by 11d beacons */ + WLC_LAST_LOCALE, + WLC_UNDEFINED_LOCALE = 0xf +} wlc_locale_t; + +/* channel encoding */ +typedef struct channel_info { + int hw_channel; + int target_channel; + int scan_channel; +} channel_info_t; + +/* For ioctls that take a list of MAC addresses */ +struct maclist { + uint count; /* number of MAC addresses */ + struct ether_addr ea[1]; /* variable length array of MAC addresses */ +}; + +/* get pkt count struct passed through ioctl */ +typedef struct get_pktcnt { + uint rx_good_pkt; + uint rx_bad_pkt; + uint tx_good_pkt; + uint tx_bad_pkt; +} get_pktcnt_t; + +/* Linux network driver ioctl encoding */ +typedef struct wl_ioctl { + uint cmd; /* common ioctl definition */ + void *buf; /* pointer to user buffer */ + uint len; /* length of user buffer */ + bool set; /* get or set request (optional) */ + uint used; /* bytes read or written (optional) */ + uint needed; /* bytes needed (optional) */ +} wl_ioctl_t; + +/* + * Structure for passing hardware and software + * revision info up from the driver. + */ +typedef struct wlc_rev_info { + uint vendorid; /* PCI vendor id */ + uint deviceid; /* device id of chip */ + uint radiorev; /* radio revision */ + uint chiprev; /* chip revision */ + uint corerev; /* core revision */ + uint boardid; /* board identifier (usu. PCI sub-device id) */ + uint boardvendor; /* board vendor (usu. PCI sub-vendor id) */ + uint boardrev; /* board revision */ + uint driverrev; /* driver version */ + uint ucoderev; /* microcode version */ + uint bus; /* bus type */ + uint chipnum; /* chip number */ +} wlc_rev_info_t; + +/* check this magic number */ +#define WLC_IOCTL_MAGIC 0x14e46c77 + +/* bump this number if you change the ioctl interface */ +#define WLC_IOCTL_VERSION 1 + +/* maximum length buffer required */ +#define WLC_IOCTL_MAXLEN 8192 + +/* maximum length buffer required */ +#define WLC_IOCTL_SMLEN 256 + +/* common ioctl definitions */ +#define WLC_GET_MAGIC 0 +#define WLC_GET_VERSION 1 +#define WLC_UP 2 +#define WLC_DOWN 3 +#define WLC_GET_LOOP 4 +#define WLC_SET_LOOP 5 +#define WLC_DUMP 6 +#define WLC_GET_MSGLEVEL 7 +#define WLC_SET_MSGLEVEL 8 +#define WLC_GET_PROMISC 9 +#define WLC_SET_PROMISC 10 +#define WLC_OBSOLETE 11 +#define WLC_GET_RATE 12 +#define WLC_SET_RATE 13 +#define WLC_GET_INSTANCE 14 +#define WLC_GET_FRAG 15 +#define WLC_SET_FRAG 16 +#define WLC_GET_RTS 17 +#define WLC_SET_RTS 18 +#define WLC_GET_INFRA 19 +#define WLC_SET_INFRA 20 +#define WLC_GET_AUTH 21 +#define WLC_SET_AUTH 22 +#define WLC_GET_BSSID 23 +#define WLC_SET_BSSID 24 +#define WLC_GET_SSID 25 +#define WLC_SET_SSID 26 +#define WLC_RESTART 27 +#define WLC_DUMP_SCB 28 +#define WLC_GET_CHANNEL 29 +#define WLC_SET_CHANNEL 30 +#define WLC_GET_SRL 31 +#define WLC_SET_SRL 32 +#define WLC_GET_LRL 33 +#define WLC_SET_LRL 34 +#define WLC_GET_PLCPHDR 35 +#define WLC_SET_PLCPHDR 36 +#define WLC_GET_RADIO 37 +#define WLC_SET_RADIO 38 +#define WLC_GET_PHYTYPE 39 +#define WLC_DUMP_RATE 40 +#define WLC_SET_RATE_PARAMS 41 +#define WLC_GET_WEP 42 +#define WLC_SET_WEP 43 +#define WLC_GET_KEY 44 +#define WLC_SET_KEY 45 +#define WLC_GET_REGULATORY 46 +#define WLC_SET_REGULATORY 47 +#define WLC_GET_PASSIVE 48 /* added by nbd */ +#define WLC_SET_PASSIVE 49 /* added by nbd */ +#define WLC_SCAN 50 +#define WLC_SCAN_RESULTS 51 +#define WLC_DISASSOC 52 +#define WLC_REASSOC 53 +#define WLC_GET_ROAM_TRIGGER 54 +#define WLC_SET_ROAM_TRIGGER 55 +#define WLC_GET_ROAM_DELTA 56 +#define WLC_SET_ROAM_DELTA 57 +#define WLC_GET_ROAM_SCAN_PERIOD 58 +#define WLC_SET_ROAM_SCAN_PERIOD 59 +#define WLC_EVM 60 +#define WLC_GET_TXANT 61 +#define WLC_SET_TXANT 62 +#define WLC_GET_ANTDIV 63 +#define WLC_SET_ANTDIV 64 +#define WLC_GET_TXPWR 65 +#define WLC_SET_TXPWR 66 +#define WLC_GET_CLOSED 67 +#define WLC_SET_CLOSED 68 +#define WLC_GET_MACLIST 69 +#define WLC_SET_MACLIST 70 +#define WLC_GET_RATESET 71 +#define WLC_SET_RATESET 72 +#define WLC_GET_LOCALE 73 +#define WLC_SET_LOCALE 74 +#define WLC_GET_BCNPRD 75 +#define WLC_SET_BCNPRD 76 +#define WLC_GET_DTIMPRD 77 +#define WLC_SET_DTIMPRD 78 +#define WLC_GET_SROM 79 +#define WLC_SET_SROM 80 +#define WLC_GET_WEP_RESTRICT 81 +#define WLC_SET_WEP_RESTRICT 82 +#define WLC_GET_COUNTRY 83 +#define WLC_SET_COUNTRY 84 +#define WLC_GET_PM 85 +#define WLC_SET_PM 86 +#define WLC_GET_WAKE 87 +#define WLC_SET_WAKE 88 +#define WLC_GET_D11CNTS 89 +#define WLC_GET_FORCELINK 90 /* ndis only */ +#define WLC_SET_FORCELINK 91 /* ndis only */ +#define WLC_FREQ_ACCURACY 92 +#define WLC_CARRIER_SUPPRESS 93 +#define WLC_GET_PHYREG 94 +#define WLC_SET_PHYREG 95 +#define WLC_GET_RADIOREG 96 +#define WLC_SET_RADIOREG 97 +#define WLC_GET_REVINFO 98 +#define WLC_GET_UCANTDIV 99 +#define WLC_SET_UCANTDIV 100 +#define WLC_R_REG 101 +#define WLC_W_REG 102 +#define WLC_DIAG_LOOPBACK 103 +#define WLC_RESET_D11CNTS 104 +#define WLC_GET_MACMODE 105 +#define WLC_SET_MACMODE 106 +#define WLC_GET_MONITOR 107 /* added by nbd */ +#define WLC_SET_MONITOR 108 /* added by nbd */ +#define WLC_GET_GMODE 109 +#define WLC_SET_GMODE 110 +#define WLC_GET_LEGACY_ERP 111 +#define WLC_SET_LEGACY_ERP 112 +#define WLC_GET_RX_ANT 113 +#define WLC_GET_CURR_RATESET 114 /* current rateset */ +#define WLC_GET_SCANSUPPRESS 115 +#define WLC_SET_SCANSUPPRESS 116 +#define WLC_GET_AP 117 +#define WLC_SET_AP 118 +#define WLC_GET_EAP_RESTRICT 119 +#define WLC_SET_EAP_RESTRICT 120 +#define WLC_SCB_AUTHORIZE 121 +#define WLC_SCB_DEAUTHORIZE 122 +#define WLC_GET_WDSLIST 123 +#define WLC_SET_WDSLIST 124 +#define WLC_GET_ATIM 125 +#define WLC_SET_ATIM 126 +#define WLC_GET_RSSI 127 +#define WLC_GET_PHYANTDIV 128 +#define WLC_SET_PHYANTDIV 129 +#define WLC_AP_RX_ONLY 130 +#define WLC_GET_TX_PATH_PWR 131 +#define WLC_SET_TX_PATH_PWR 132 +#define WLC_GET_WSEC 133 +#define WLC_SET_WSEC 134 +#define WLC_GET_PHY_NOISE 135 +#define WLC_GET_BSS_INFO 136 +#define WLC_GET_PKTCNTS 137 +#define WLC_GET_LAZYWDS 138 +#define WLC_SET_LAZYWDS 139 +#define WLC_GET_BANDLIST 140 +#define WLC_GET_BAND 141 +#define WLC_SET_BAND 142 +#define WLC_SCB_DEAUTHENTICATE 143 +#define WLC_GET_SHORTSLOT 144 +#define WLC_GET_SHORTSLOT_OVERRIDE 145 +#define WLC_SET_SHORTSLOT_OVERRIDE 146 +#define WLC_GET_SHORTSLOT_RESTRICT 147 +#define WLC_SET_SHORTSLOT_RESTRICT 148 +#define WLC_GET_GMODE_PROTECTION 149 +#define WLC_GET_GMODE_PROTECTION_OVERRIDE 150 +#define WLC_SET_GMODE_PROTECTION_OVERRIDE 151 +#define WLC_UPGRADE 152 +#define WLC_GET_MRATE 153 +#define WLC_SET_MRATE 154 +#define WLC_GET_IGNORE_BCNS 155 +#define WLC_SET_IGNORE_BCNS 156 +#define WLC_GET_SCB_TIMEOUT 157 +#define WLC_SET_SCB_TIMEOUT 158 +#define WLC_GET_ASSOCLIST 159 +#define WLC_GET_CLK 160 +#define WLC_SET_CLK 161 +#define WLC_GET_UP 162 +#define WLC_OUT 163 +#define WLC_GET_WPA_AUTH 164 +#define WLC_SET_WPA_AUTH 165 +#define WLC_GET_UCFLAGS 166 +#define WLC_SET_UCFLAGS 167 +#define WLC_GET_PWRIDX 168 +#define WLC_SET_PWRIDX 169 +#define WLC_GET_TSSI 170 +#define WLC_GET_SUP_RATESET_OVERRIDE 171 +#define WLC_SET_SUP_RATESET_OVERRIDE 172 +#define WLC_SET_FAST_TIMER 173 +#define WLC_GET_FAST_TIMER 174 +#define WLC_SET_SLOW_TIMER 175 +#define WLC_GET_SLOW_TIMER 176 +#define WLC_DUMP_PHYREGS 177 +#define WLC_GET_GMODE_PROTECTION_CONTROL 178 +#define WLC_SET_GMODE_PROTECTION_CONTROL 179 +#define WLC_GET_PHYLIST 180 +#define WLC_ENCRYPT_STRENGTH 181 /* ndis only */ +#define WLC_DECRYPT_STATUS 182 /* ndis only */ +#define WLC_GET_KEY_SEQ 183 +#define WLC_GET_SCAN_CHANNEL_TIME 184 +#define WLC_SET_SCAN_CHANNEL_TIME 185 +#define WLC_GET_SCAN_UNASSOC_TIME 186 +#define WLC_SET_SCAN_UNASSOC_TIME 187 +#define WLC_GET_SCAN_HOME_TIME 188 +#define WLC_SET_SCAN_HOME_TIME 189 +#define WLC_GET_SCAN_PASSES 190 +#define WLC_SET_SCAN_PASSES 191 +#define WLC_GET_PRB_RESP_TIMEOUT 192 +#define WLC_SET_PRB_RESP_TIMEOUT 193 +#define WLC_GET_ATTEN 194 +#define WLC_SET_ATTEN 195 +#define WLC_GET_SHMEM 196 /* diag */ +#define WLC_SET_SHMEM 197 /* diag */ +#define WLC_GET_GMODE_PROTECTION_CTS 198 +#define WLC_SET_GMODE_PROTECTION_CTS 199 +#define WLC_SET_TKIP_MIC_FLAG 200 +#define WLC_SCB_DEAUTHENTICATE_FOR_REASON 201 +#define WLC_TKIP_COUNTERMEASURES 202 +#define WLC_GET_PIOMODE 203 +#define WLC_SET_PIOMODE 204 +#define WLC_SET_LED 209 +#define WLC_GET_LED 210 +#define WLC_GET_INTERFERENCE_MODE 211 +#define WLC_SET_INTERFERENCE_MODE 212 +#define WLC_GET_CHANNEL_QA 213 +#define WLC_START_CHANNEL_QA 214 +#define WLC_GET_CHANNEL_SEL 215 +#define WLC_START_CHANNEL_SEL 216 +#define WLC_GET_VALID_CHANNELS 217 +#define WLC_GET_FAKEFRAG 218 +#define WLC_SET_FAKEFRAG 219 +#define WLC_GET_PWROUT_PERCENTAGE 220 +#define WLC_SET_PWROUT_PERCENTAGE 221 +#define WLC_SET_BAD_FRAME_PREEMPT 222 +#define WLC_GET_BAD_FRAME_PREEMPT 223 +#define WLC_SET_LEAP_LIST 224 +#define WLC_GET_LEAP_LIST 225 +#define WLC_GET_CWMIN 226 +#define WLC_SET_CWMIN 227 +#define WLC_GET_CWMAX 228 +#define WLC_SET_CWMAX 229 +#define WLC_GET_WET 230 +#define WLC_SET_WET 231 +#define WLC_GET_KEY_PRIMARY 235 +#define WLC_SET_KEY_PRIMARY 236 +#define WLC_SCAN_WITH_CALLBACK 240 +#define WLC_WDS_GET_REMOTE_HWADDR 246 /* currently handled in wl_linux.c/wl_vx.c */ +#define WLC_SET_CS_SCAN_TIMER 248 +#define WLC_GET_CS_SCAN_TIMER 249 +#define WLC_CURRENT_PWR 256 +#define WLC_GET_CHANNELS_IN_COUNTRY 260 +#define WLC_GET_COUNTRY_LIST 261 +#define WLC_GET_VAR 262 /* get value of named variable */ +#define WLC_SET_VAR 263 /* set named variable to value */ +#define WLC_NVRAM_GET 264 +#define WLC_NVRAM_SET 265 +#define WLC_SET_WSEC_PMK 268 +#define WLC_GET_AUTH_MODE 269 +#define WLC_SET_AUTH_MODE 270 +#define WLC_LAST 273 /* do not change - use get_var/set_var */ + +/* + * Minor kludge alert: + * Duplicate a few definitions that irelay requires from epiioctl.h here + * so caller doesn't have to include this file and epiioctl.h . + * If this grows any more, it would be time to move these irelay-specific + * definitions out of the epiioctl.h and into a separate driver common file. + */ +#ifndef EPICTRL_COOKIE +#define EPICTRL_COOKIE 0xABADCEDE +#endif + +/* vx wlc ioctl's offset */ +#define CMN_IOCTL_OFF 0x180 + +/* + * custom OID support + * + * 0xFF - implementation specific OID + * 0xE4 - first byte of Broadcom PCI vendor ID + * 0x14 - second byte of Broadcom PCI vendor ID + * 0xXX - the custom OID number + */ + +/* begin 0x1f values beyond the start of the ET driver range. */ +#define WL_OID_BASE 0xFFE41420 + +/* NDIS overrides */ +#define OID_WL_GETINSTANCE (WL_OID_BASE + WLC_GET_INSTANCE) +#define OID_WL_GET_FORCELINK (WL_OID_BASE + WLC_GET_FORCELINK) +#define OID_WL_SET_FORCELINK (WL_OID_BASE + WLC_SET_FORCELINK) +#define OID_WL_ENCRYPT_STRENGTH (WL_OID_BASE + WLC_ENCRYPT_STRENGTH) +#define OID_WL_DECRYPT_STATUS (WL_OID_BASE + WLC_DECRYPT_STATUS) + +#define WL_DECRYPT_STATUS_SUCCESS 1 +#define WL_DECRYPT_STATUS_FAILURE 2 +#define WL_DECRYPT_STATUS_UNKNOWN 3 + +/* allows user-mode app to poll the status of USB image upgrade */ +#define WLC_UPGRADE_SUCCESS 0 +#define WLC_UPGRADE_PENDING 1 + +/* Bit masks for radio disabled status - returned by WL_GET_RADIO */ +#define WL_RADIO_SW_DISABLE (1<<0) +#define WL_RADIO_HW_DISABLE (1<<1) + +/* Override bit for WLC_SET_TXPWR. if set, ignore other level limits */ +#define WL_TXPWR_OVERRIDE (1<<31) + + +/* Bus types */ +#define WL_SB_BUS 0 /* Silicon Backplane */ +#define WL_PCI_BUS 1 /* PCI target */ +#define WL_PCMCIA_BUS 2 /* PCMCIA target */ + +/* band types */ +#define WLC_BAND_AUTO 0 /* auto-select */ +#define WLC_BAND_A 1 /* "a" band (5 Ghz) */ +#define WLC_BAND_B 2 /* "b" band (2.4 Ghz) */ + +/* MAC list modes */ +#define WLC_MACMODE_DISABLED 0 /* MAC list disabled */ +#define WLC_MACMODE_DENY 1 /* Deny specified (i.e. allow unspecified) */ +#define WLC_MACMODE_ALLOW 2 /* Allow specified (i.e. deny unspecified) */ + + +/* 54g modes (basic bits may still be overridden) */ +#define GMODE_LEGACY_B 0 /* Rateset: 1b, 2b, 5.5, 11 */ + /* Preamble: Long */ + /* Shortslot: Off */ +#define GMODE_AUTO 1 /* Rateset: 1b, 2b, 5.5b, 11b, 18, 24, 36, 54 */ + /* Extended Rateset: 6, 9, 12, 48 */ + /* Preamble: Long */ + /* Shortslot: Auto */ +#define GMODE_ONLY 2 /* Rateset: 1b, 2b, 5.5b, 11b, 18, 24b, 36, 54 */ + /* Extended Rateset: 6b, 9, 12b, 48 */ + /* Preamble: Short required */ + /* Shortslot: Auto */ +#define GMODE_B_DEFERRED 3 /* Rateset: 1b, 2b, 5.5b, 11b, 18, 24, 36, 54 */ + /* Extended Rateset: 6, 9, 12, 48 */ + /* Preamble: Long */ + /* Shortslot: On */ +#define GMODE_PERFORMANCE 4 /* Rateset: 1b, 2b, 5.5b, 6b, 9, 11b, 12b, 18, 24b, 36, 48, 54 */ + /* Preamble: Short required */ + /* Shortslot: On and required */ +#define GMODE_LRS 5 /* Rateset: 1b, 2b, 5.5b, 11b */ + /* Extended Rateset: 6, 9, 12, 18, 24, 36, 48, 54 */ + /* Preamble: Long */ + /* Shortslot: Auto */ +#define GMODE_MAX 6 + + +/* values for PLCPHdr_override */ +#define WLC_PLCP_AUTO -1 +#define WLC_PLCP_SHORT 0 +#define WLC_PLCP_LONG 1 + +/* values for g_protection_override */ +#define WLC_G_PROTECTION_AUTO -1 +#define WLC_G_PROTECTION_OFF 0 +#define WLC_G_PROTECTION_ON 1 + +/* values for g_protection_control */ +#define WLC_G_PROTECTION_CTL_OFF 0 +#define WLC_G_PROTECTION_CTL_LOCAL 1 +#define WLC_G_PROTECTION_CTL_OVERLAP 2 + +/* Values for PM */ +#define PM_OFF 0 +#define PM_MAX 1 +#define PM_FAST 2 + +/* interference mitigation options */ +#define INTERFERE_NONE 0 /* off */ +#define NON_WLAN 1 /* foreign/non 802.11 interference, no auto detect */ +#define WLAN_MANUAL 2 /* ACI: no auto detection */ +#define WLAN_AUTO 3 /* ACI: auto - detact */ + +/* Message levels */ +#define WL_ERROR_VAL 0x0001 +#define WL_TRACE_VAL 0x0002 +#define WL_PRHDRS_VAL 0x0004 +#define WL_PRPKT_VAL 0x0008 +#define WL_INFORM_VAL 0x0010 +#define WL_TMP_VAL 0x0020 +#define WL_OID_VAL 0x0040 +#define WL_RATE_VAL 0x0080 +#define WL_ASSOC_VAL 0x0100 +#define WL_PRUSR_VAL 0x0200 +#define WL_PS_VAL 0x0400 +#define WL_TXPWR_VAL 0x0800 +#define WL_GMODE_VAL 0x1000 +#define WL_DUAL_VAL 0x2000 +#define WL_WSEC_VAL 0x4000 +#define WL_WSEC_DUMP_VAL 0x8000 +#define WL_LOG_VAL 0x10000 +#define WL_NRSSI_VAL 0x20000 +#define WL_LOFT_VAL 0x40000 +#define WL_REGULATORY_VAL 0x80000 +#define WL_ACI_VAL 0x100000 + + +/* 802.11h enforcement levels */ +#define SPECT_MNGMT_OFF 0 /* 11h disabled */ +#define SPECT_MNGMT_LOOSE 1 /* Allow scan lists to contain non-11h AP */ + /* when 11h is enabled */ +#define SPECT_MNGMT_STRICT 2 /* Prine out non-11h APs from scan list */ + + + +/* max # of leds supported by GPIO (gpio pin# == led index#) */ +#define WL_LED_NUMGPIO 16 /* gpio 0-15 */ + +/* led per-pin behaviors */ +#define WL_LED_OFF 0 /* always off */ +#define WL_LED_ON 1 /* always on */ +#define WL_LED_ACTIVITY 2 /* activity */ +#define WL_LED_RADIO 3 /* radio enabled */ +#define WL_LED_ARADIO 4 /* 5 Ghz radio enabled */ +#define WL_LED_BRADIO 5 /* 2.4Ghz radio enabled */ +#define WL_LED_BGMODE 6 /* on if gmode, off if bmode */ +#define WL_LED_WI1 7 +#define WL_LED_WI2 8 +#define WL_LED_WI3 9 +#define WL_LED_ASSOC 10 /* associated state indicator */ +#define WL_LED_INACTIVE 11 /* null behavior (clears default behavior) */ +#define WL_LED_NUMBEHAVIOR 12 + +/* led behavior numeric value format */ +#define WL_LED_BEH_MASK 0x7f /* behavior mask */ +#define WL_LED_AL_MASK 0x80 /* activelow (polarity) bit */ + + +/* maximum channels */ +#define WL_NUMCHANNELS 64 /* max # of channels in the band */ + +/* rate check */ +#define WL_RATE_OFDM(r) (((r) & 0x7f) == 12 || ((r) & 0x7f) == 18 || \ + ((r) & 0x7f) == 24 || ((r) & 0x7f) == 36 || \ + ((r) & 0x7f) == 48 || ((r) & 0x7f) == 72 || \ + ((r) & 0x7f) == 96 || ((r) & 0x7f) == 108) + +/* WDS link local endpoint WPA role */ +#define WL_WDS_WPA_ROLE_AUTH 0 /* authenticator */ +#define WL_WDS_WPA_ROLE_SUP 1 /* supplicant */ +#define WL_WDS_WPA_ROLE_AUTO 255 /* auto, based on mac addr value */ + +/* afterburner_override */ +#define ABO_AUTO -1 /* auto - no override */ +#define ABO_OFF 0 /* force afterburner off */ +#define ABO_ON 1 /* force afterburner on */ + +#define GMODE_AFTERBURNER 6 + +#undef PACKED + +#endif /* _wlioctl_h_ */ diff --git a/package/nvram/src/include/wlutils.h b/package/nvram/src/include/wlutils.h new file mode 100644 index 0000000000..07e2536ca3 --- /dev/null +++ b/package/nvram/src/include/wlutils.h @@ -0,0 +1,59 @@ +/* + * Broadcom wireless network adapter utility functions + * + * Copyright 2004, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * + * $Id$ + */ + +#ifndef _wlutils_h_ +#define _wlutils_h_ + +#include <typedefs.h> +#include <wlioctl.h> + +/* + * Pass a wlioctl request to the specified interface. + * @param name interface name + * @param cmd WLC_GET_MAGIC <= cmd < WLC_LAST + * @param buf buffer for passing in and/or receiving data + * @param len length of buf + * @return >= 0 if successful or < 0 otherwise + */ +extern int wl_ioctl(char *name, int cmd, void *buf, int len); + +/* + * Get the MAC (hardware) address of the specified interface. + * @param name interface name + * @param hwaddr 6-byte buffer for receiving address + * @return >= 0 if successful or < 0 otherwise + */ +extern int wl_hwaddr(char *name, unsigned char *hwaddr); + +/* + * Probe the specified interface. + * @param name interface name + * @return >= 0 if a Broadcom wireless device or < 0 otherwise + */ +extern int wl_probe(char *name); + +/* + * Set/Get named variable. + * @param name interface name + * @param var variable name + * @param val variable value/buffer + * @param len variable value/buffer length + * @return success == 0, failure != 0 + */ +extern int wl_set_val(char *name, char *var, void *val, int len); +extern int wl_get_val(char *name, char *var, void *val, int len); +extern int wl_set_int(char *name, char *var, int val); +extern int wl_get_int(char *name, char *var, int *val); + +#endif /* _wlutils_h_ */ diff --git a/package/nvram/src/linux_timer.c b/package/nvram/src/linux_timer.c new file mode 100644 index 0000000000..0402e44378 --- /dev/null +++ b/package/nvram/src/linux_timer.c @@ -0,0 +1,738 @@ +/* + * Copyright 2004, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * + * Low resolution timer interface linux specific implementation. + * + * $Id$ + */ + +/* +* debug facilities +*/ +#define TIMER_DEBUG 0 +#if TIMER_DEBUG +#define TIMERDBG(fmt, args...) printf("%s: " fmt "\n" , __FUNCTION__ , ## args) +#else +#define TIMERDBG(fmt, args...) +#endif + + +/* + * POSIX timer support for Linux. Taken from linux_timer.c in upnp + */ + +#define __USE_GNU + + +#include <stdlib.h> // for malloc, free, etc. +#include <string.h> // for memset, strncasecmp, etc. +#include <assert.h> // for assert, of course. +#include <signal.h> // for sigemptyset, etc. +#include <stdio.h> // for printf, etc. +#include <sys/time.h> +#include <time.h> + +/* define TIMER_PROFILE to enable code which guages how accurate the timer functions are. + For each expiring timer the code will print the expected time interval and the actual time interval. +#define TIMER_PROFILE +*/ +#undef TIMER_PROFILE + +/* +timer_cancel( ) - cancel a timer +timer_connect( ) - connect a user routine to the timer signal +timer_create( ) - allocate a timer using the specified clock for a timing base (POSIX) +timer_delete( ) - remove a previously created timer (POSIX) +timer_gettime( ) - get the remaining time before expiration and the reload value (POSIX) +timer_getoverrun( ) - return the timer expiration overrun (POSIX) +timer_settime( ) - set the time until the next expiration and arm timer (POSIX) +nanosleep( ) - suspend the current task until the time interval elapses (POSIX) +*/ + +#define MS_PER_SEC 1000 +#define US_PER_SEC 1000000 +#define US_PER_MS 1000 +#define UCLOCKS_PER_SEC 1000000 + +typedef void (*event_callback_t)(timer_t, int); + +#ifndef TIMESPEC_TO_TIMEVAL +# define TIMESPEC_TO_TIMEVAL(tv, ts) { \ + (tv)->tv_sec = (ts)->tv_sec; \ + (tv)->tv_usec = (ts)->tv_nsec / 1000; \ +} +#endif + +#ifndef TIMEVAL_TO_TIMESPEC +# define TIMEVAL_TO_TIMESPEC(tv, ts) { \ + (ts)->tv_sec = (tv)->tv_sec; \ + (ts)->tv_nsec = (tv)->tv_usec * 1000; \ +} +#endif + +#define ROUNDUP(x,y) ((((x)+(y)-1)/(y))*(y)) + +#define timerroundup(t,g) \ + do { \ + if (!timerisset(t)) (t)->tv_usec=1; \ + if ((t)->tv_sec == 0) (t)->tv_usec=ROUNDUP((t)->tv_usec, g); \ + } while (0) + +typedef long uclock_t; + +#define TFLAG_NONE 0 +#define TFLAG_CANCELLED (1<<0) +#define TFLAG_DELETED (1<<1) + +struct event { + struct timeval it_interval; + struct timeval it_value; + event_callback_t func; + int arg; + unsigned short flags; + struct event *next; +#ifdef TIMER_PROFILE + uint expected_ms; + uclock_t start; +#endif +}; + +void timer_cancel(timer_t timerid); + +static void alarm_handler(int i); +static void check_event_queue(); +static void print_event_queue(); +static void check_timer(); +#if THIS_FINDS_USE +static int count_queue(struct event *); +#endif +static int timer_change_settime(timer_t timer_id, const struct itimerspec *timer_spec); +void block_timer(); +void unblock_timer(); + +static struct event *event_queue = NULL; +static struct event *event_freelist; +static uint g_granularity; +static int g_maxevents = 0; + +uclock_t uclock() +{ + struct timeval tv; + + gettimeofday(&tv, NULL); + return ((tv.tv_sec * US_PER_SEC) + tv.tv_usec); +} + + +void init_event_queue(int n) +{ + int i; + struct itimerval tv; + + g_maxevents = n; + event_freelist = (struct event *) malloc(n * sizeof(struct event)); + memset(event_freelist, 0, n * sizeof(struct event)); + + for (i = 0; i < (n-1); i++) + event_freelist[i].next = &event_freelist[i+1]; + + event_freelist[i].next = NULL; + + tv.it_interval.tv_sec = 0; + tv.it_interval.tv_usec = 1; + tv.it_value.tv_sec = 0; + tv.it_value.tv_usec = 0; + setitimer (ITIMER_REAL, &tv, 0); + setitimer (ITIMER_REAL, 0, &tv); + g_granularity = tv.it_interval.tv_usec; + + signal(SIGALRM, alarm_handler); +} + + +int clock_gettime( + clockid_t clock_id, /* clock ID (always CLOCK_REALTIME) */ + struct timespec * tp /* where to store current time */ +) +{ + struct timeval tv; + int n; + + + n = gettimeofday(&tv, NULL); + TIMEVAL_TO_TIMESPEC(&tv, tp); + + return n; +} + + +int timer_create( + clockid_t clock_id, /* clock ID (always CLOCK_REALTIME) */ + struct sigevent * evp, /* user event handler */ + timer_t * pTimer /* ptr to return value */ +) +{ + struct event *event; + + if (clock_id != CLOCK_REALTIME) { + TIMERDBG("timer_create can only support clock id CLOCK_REALTIME"); + exit(1); + } + + if (evp != NULL) { + if (evp->sigev_notify != SIGEV_SIGNAL || evp->sigev_signo != SIGALRM) { + TIMERDBG("timer_create can only support signalled alarms using SIGALRM"); + exit(1); + } + } + + event = event_freelist; + if (event == NULL) { + print_event_queue(); + } + assert(event != NULL); + + event->flags = TFLAG_NONE; + + event_freelist = event->next; + event->next = NULL; + + check_event_queue(); + + *pTimer = (timer_t) event; + + return 0; +} + +int timer_delete( + timer_t timerid /* timer ID */ +) +{ + struct event *event = (struct event *) timerid; + + if (event->flags & TFLAG_DELETED) { + TIMERDBG("Cannot delete a deleted event"); + return 1; + } + + timer_cancel(timerid); + + event->flags |= TFLAG_DELETED; + + event->next = event_freelist; + event_freelist = event; + + return 0; +} + +int timer_connect +( + timer_t timerid, /* timer ID */ + void (*routine)(timer_t, int), /* user routine */ + int arg /* user argument */ +) +{ + struct event *event = (struct event *) timerid; + + assert(routine != NULL); + event->func = routine; + event->arg = arg; + + return 0; +} + +/* + * Please Call this function only from the call back functions of the alarm_handler. + * This is just a hack +*/ +int timer_change_settime +( + timer_t timerid, /* timer ID */ + const struct itimerspec * value /* time to be set */ +) +{ + struct event *event = (struct event *) timerid; + + TIMESPEC_TO_TIMEVAL(&event->it_interval, &value->it_interval); + TIMESPEC_TO_TIMEVAL(&event->it_value, &value->it_value); + + return 1; +} + +int timer_settime +( + timer_t timerid, /* timer ID */ + int flags, /* absolute or relative */ + const struct itimerspec * value, /* time to be set */ + struct itimerspec * ovalue /* previous time set (NULL=no result) */ +) +{ + struct itimerval itimer; + struct event *event = (struct event *) timerid; + struct event **ppevent; + + TIMESPEC_TO_TIMEVAL(&event->it_interval, &value->it_interval); + TIMESPEC_TO_TIMEVAL(&event->it_value, &value->it_value); + + /* if .it_value is zero, the timer is disarmed */ + if (!timerisset(&event->it_value)) { + timer_cancel(timerid); + return 0; + } + + block_timer(); + +#ifdef TIMER_PROFILE + event->expected_ms = (event->it_value.tv_sec * MS_PER_SEC) + (event->it_value.tv_usec / US_PER_MS); + event->start = uclock(); +#endif + if (event->next) { + TIMERDBG("calling timer_settime with a timer that is already on the queue."); + } + + + /* We always want to make sure that the event at the head of the + queue has a timeout greater than the itimer granularity. + Otherwise we end up with the situation that the time remaining + on an itimer is greater than the time at the head of the queue + in the first place. */ + timerroundup(&event->it_value, g_granularity); + + timerclear(&itimer.it_value); + getitimer(ITIMER_REAL, &itimer); + if (timerisset(&itimer.it_value)) { + // reset the top timer to have an interval equal to the remaining interval + // when the timer was cancelled. + if (event_queue) { + if (timercmp(&(itimer.it_value), &(event_queue->it_value), >)) { + // it is an error if the amount of time remaining is more than the amount of time + // requested by the top event. + // + TIMERDBG("timer_settime: TIMER ERROR!"); + + } else { + // some portion of the top event has already expired. + // Reset the interval of the top event to remaining + // time left in that interval. + // + event_queue->it_value = itimer.it_value; + + // if we were the earliest timer before now, we are still the earliest timer now. + // we do not need to reorder the list. + } + } + } + + // Now, march down the list, decrementing the new timer by the + // current it_value of each event on the queue. + ppevent = &event_queue; + while (*ppevent) { + if ( timercmp(&(event->it_value), &((*ppevent)->it_value), <) ) { + // if the proposed event will trigger sooner than the next event + // in the queue, we will insert the new event just before the next one. + // + // we also need to adjust the delta value to the next event. + timersub(&((*ppevent)->it_value), &(event->it_value), &((*ppevent)->it_value)); + break; + } + // subtract the interval of the next event from the proposed interval. + timersub(&(event->it_value), &((*ppevent)->it_value), &(event->it_value)); + + ppevent = &((*ppevent)->next); + } + + // we have found our proper place in the queue, + // link our new event into the pending event queue. + event->next = *ppevent; + *ppevent = event; + + check_event_queue(); + + // if our new event ended up at the front of the queue, reissue the timer. + if (event == event_queue) { + timerroundup(&event_queue->it_value, g_granularity); + timerclear(&itimer.it_interval); + itimer.it_value = event_queue->it_value; + + // we want to be sure to never turn off the timer completely, + // so if the next interval is zero, set it to some small value. + if (!timerisset(&(itimer.it_value))) + itimer.it_value = (struct timeval) { 0, 1 }; + + assert(!timerisset(&itimer.it_interval)); + assert(itimer.it_value.tv_sec > 0 || itimer.it_value.tv_usec >= g_granularity); + assert(event_queue->it_value.tv_sec > 0 || event_queue->it_value.tv_usec >= g_granularity); + setitimer(ITIMER_REAL, &itimer, NULL); + check_timer(); + } + + event->flags &= ~TFLAG_CANCELLED; + + unblock_timer(); + + return 0; +} + +static void check_timer() +{ + struct itimerval itimer; + + getitimer(ITIMER_REAL, &itimer); + if (timerisset(&itimer.it_interval)) { + TIMERDBG("ERROR timer interval is set."); + } + if (timercmp(&(itimer.it_value), &(event_queue->it_value), >)) { + TIMERDBG("ERROR timer expires later than top event."); + } +} + + +static void check_event_queue() +{ + struct timeval sum; + struct event *event; + int i = 0; + +#ifdef notdef + int nfree = 0; + struct event *p; + for (p = event_freelist; p; p = p->next) + nfree++; + printf("%d free events\n", nfree); +#endif + + timerclear(&sum); + for (event = event_queue; event; event = event->next) { + if (i > g_maxevents) { + TIMERDBG("timer queue looks like it loops back on itself!"); + print_event_queue(); + exit(1); + } + i++; + } +} + +#if THIS_FINDS_USE +/* The original upnp version has this unused function, so I left it in + to maintain the resemblance. */ +static int count_queue(struct event *event_queue) +{ + struct event *event; + int i = 0; + for (event = event_queue; event; event = event->next) + i++; + return i; +} +#endif + +static void print_event_queue() +{ + struct event *event; + int i = 0; + + for (event = event_queue; event; event = event->next) { + printf("#%d (0x%x)->0x%x: \t%d sec %d usec\t%p\n", + i++, (unsigned int) event, (unsigned int) event->next, (int) event->it_value.tv_sec, (int) event->it_value.tv_usec, event->func); + if (i > g_maxevents) { + printf("...(giving up)\n"); + break; + } + } +} + +// The top element of the event queue must have expired. +// Remove that element, run its function, and reset the timer. +// if there is no interval, recycle the event structure. +static void alarm_handler(int i) +{ + struct event *event, **ppevent; + struct itimerval itimer; + struct timeval small_interval = { 0, g_granularity/2 }; +#ifdef TIMER_PROFILE + uint junk; + uclock_t end; + uint actual; +#endif + + block_timer(); + + // Loop through the event queue and remove the first event plus any + // subsequent events that will expire very soon thereafter (within 'small_interval'}. + // + do { + // remove the top event. + event = event_queue; + event_queue = event_queue->next; + event->next = NULL; + +#ifdef TIMER_PROFILE + end = uclock(); + actual = ((end-event->start)/((uclock_t)UCLOCKS_PER_SEC/1000)); + if (actual < 0) + junk = end; + TIMERDBG("expected %d ms actual %d ms", event->expected_ms, ((end-event->start)/((uclock_t)UCLOCKS_PER_SEC/1000))); +#endif + + // call the event callback function + (*(event->func))((timer_t) event, (int)event->arg); + + /* If the event has been cancelled, do NOT put it back on the queue. */ + if ( !(event->flags & TFLAG_CANCELLED) ) { + + // if the event is a recurring event, reset the timer and + // find its correct place in the sorted list of events. + // + if (timerisset(&event->it_interval)) { + // event is recurring... + // + event->it_value = event->it_interval; +#ifdef TIMER_PROFILE + event->expected_ms = (event->it_value.tv_sec * MS_PER_SEC) + (event->it_value.tv_usec / US_PER_MS); + event->start = uclock(); +#endif + timerroundup(&event->it_value, g_granularity); + + // Now, march down the list, decrementing the new timer by the + // current delta of each event on the queue. + ppevent = &event_queue; + while (*ppevent) { + if ( timercmp(&(event->it_value), &((*ppevent)->it_value), <) ) { + // if the proposed event will trigger sooner than the next event + // in the queue, we will insert the new event just before the next one. + // + // we also need to adjust the delta value to the next event. + timersub(&((*ppevent)->it_value), &(event->it_value), &((*ppevent)->it_value)); + break; + } + timersub(&(event->it_value), &((*ppevent)->it_value), &(event->it_value)); + ppevent = &((*ppevent)->next); + } + + // we have found our proper place in the queue, + // link our new event into the pending event queue. + event->next = *ppevent; + *ppevent = event; + } else { + // there is no interval, so recycle the event structure. + //timer_delete((timer_t) event); + } + } + + check_event_queue(); + + } while (event_queue && timercmp(&event_queue->it_value, &small_interval, <)); + + // re-issue the timer... + if (event_queue) { + timerroundup(&event_queue->it_value, g_granularity); + + timerclear(&itimer.it_interval); + itimer.it_value = event_queue->it_value; + // we want to be sure to never turn off the timer completely, + // so if the next interval is zero, set it to some small value. + if (!timerisset(&(itimer.it_value))) + itimer.it_value = (struct timeval) { 0, 1 }; + + setitimer(ITIMER_REAL, &itimer, NULL); + check_timer(); + } else { + TIMERDBG("There are no events in the queue - timer not reset."); + } + + unblock_timer(); +} + +static int block_count = 0; + +void block_timer() +{ + sigset_t set; + + if (block_count++ == 0) { + sigemptyset(&set); + sigaddset(&set, SIGALRM); + sigprocmask(SIG_BLOCK, &set, NULL); + } +} + +void unblock_timer() +{ + sigset_t set; + + if (--block_count == 0) { + sigemptyset(&set); + sigaddset(&set, SIGALRM); + sigprocmask(SIG_UNBLOCK, &set, NULL); + } +} + +void timer_cancel_all() +{ + struct itimerval timeroff = { { 0, 0 }, { 0, 0} }; + struct event *event; + struct event **ppevent; + + setitimer(ITIMER_REAL, &timeroff, NULL); + + ppevent = &event_queue; + while (*ppevent) { + event = *ppevent; + *ppevent = event->next; + event->next = NULL; + } +} + + + +void timer_cancel(timer_t timerid) +{ + struct itimerval itimer; + struct itimerval timeroff = { { 0, 0 }, { 0, 0} }; + struct event *event = (struct event *) timerid; + struct event **ppevent; + + if (event->flags & TFLAG_CANCELLED) { + TIMERDBG("Cannot cancel a cancelled event"); + return; + } + + block_timer(); + + ppevent = &event_queue; + while (*ppevent) { + if ( *ppevent == event ) { + + /* RACE CONDITION - if the alarm goes off while we are in + this loop, and if the timer we want to cancel is the + next to expire, the alarm will end up firing + after this routine is complete, causing it to go off early. */ + + /* If the cancelled timer is the next to expire, + we need to do something special to clean up correctly. */ + if (event == event_queue && event->next != NULL) { + timerclear(&itimer.it_value); + getitimer(ITIMER_REAL, &itimer); + + /* subtract the time that has already passed while waiting for this timer... */ + timersub(&(event->it_value), &(itimer.it_value), &(event->it_value)); + + /* and add any remainder to the next timer in the list */ + timeradd(&(event->next->it_value), &(event->it_value), &(event->next->it_value)); + } + + *ppevent = event->next; + event->next = NULL; + + if (event_queue) { + timerroundup(&event_queue->it_value, g_granularity); + timerclear(&itimer.it_interval); + itimer.it_value = event_queue->it_value; + + /* We want to be sure to never turn off the timer + completely if there are more events on the queue, + so if the next interval is zero, set it to some + small value. */ + + if (!timerisset(&(itimer.it_value))) + itimer.it_value = (struct timeval) { 0, 1 }; + + assert(itimer.it_value.tv_sec > 0 || itimer.it_value.tv_usec >= g_granularity); + assert(event_queue->it_value.tv_sec > 0 || event_queue->it_value.tv_usec >= g_granularity); + setitimer(ITIMER_REAL, &itimer, NULL); + check_timer(); + } else { + setitimer(ITIMER_REAL, &timeroff, NULL); + } + break; + } + ppevent = &((*ppevent)->next); + } + + event->flags |= TFLAG_CANCELLED; + + unblock_timer(); +} + +/* +* timer related headers +*/ +#include "bcmtimer.h" + +/* +* locally used global variables and constants +*/ + +/* +* Initialize internal resources used in the timer module. It must be called +* before any other timer function calls. The param 'timer_entries' is used +* to pre-allocate fixed number of timer entries. +*/ +int bcm_timer_module_init(int timer_entries, bcm_timer_module_id *module_id) +{ + init_event_queue(timer_entries); + *module_id = (bcm_timer_module_id)event_freelist; + return 0; +} + +/* +* Cleanup internal resources used by this timer module. It deletes all +* pending timer entries from the backend timer system as well. +*/ +int bcm_timer_module_cleanup(bcm_timer_module_id module_id) +{ + module_id = 0; + return 0; +} + +/* Enable/Disable timer module */ +int bcm_timer_module_enable(bcm_timer_module_id module_id, int enable) +{ + if (enable) + unblock_timer(); + else + block_timer(); + return 0; +} + +int bcm_timer_create(bcm_timer_module_id module_id, bcm_timer_id *timer_id) +{ + module_id = 0; + return timer_create(CLOCK_REALTIME, NULL, (timer_t *)timer_id); +} + +int bcm_timer_delete(bcm_timer_id timer_id) +{ + return timer_delete((timer_t)timer_id); +} + +int bcm_timer_gettime(bcm_timer_id timer_id, struct itimerspec *timer_spec) +{ + return -1; +} + +int bcm_timer_settime(bcm_timer_id timer_id, const struct itimerspec *timer_spec) +{ + return timer_settime((timer_t)timer_id, 0, timer_spec, NULL); +} + +int bcm_timer_connect(bcm_timer_id timer_id, bcm_timer_cb func, int data) +{ + return timer_connect((timer_t)timer_id, (void *)func, data); +} + +int bcm_timer_cancel(bcm_timer_id timer_id) +{ + timer_cancel((timer_t)timer_id); + return 0; +} +int bcm_timer_change_expirytime(bcm_timer_id timer_id, const struct itimerspec *timer_spec) +{ + timer_change_settime((timer_t)timer_id, timer_spec); + return 1; +} diff --git a/package/nvram/src/main.c b/package/nvram/src/main.c new file mode 100644 index 0000000000..7af26729d9 --- /dev/null +++ b/package/nvram/src/main.c @@ -0,0 +1,88 @@ +/* + * Frontend command-line utility for Linux NVRAM layer + * + * Copyright 2004, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * + * $Id$ + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include <typedefs.h> +#include <bcmnvram.h> + +static void +usage(void) +{ + fprintf(stderr, "usage: nvram [get name] [set name=value] [unset name] [show]\n"); + exit(0); +} + +/* hack for some PMON default nvram values which have '\r' appended */ +void +puts_trim_cr(char *str) +{ + int len= strlen(str); + if (len && (str[len-1] == '\r')) len--; + printf("%.*s\n", len, str); +} + +/* NVRAM utility */ +int +main(int argc, char **argv) +{ + char *name, *value, buf[NVRAM_SPACE]; + int size; + + /* Skip program name */ + --argc; + ++argv; + + if (!*argv) + usage(); + + /* Process the remaining arguments. */ + for (; *argv; argv++) { + if (!strncmp(*argv, "get", 3)) { + if (*++argv) { + if ((value = nvram_get(*argv))) { + puts_trim_cr(value); + } + } + } + else if (!strncmp(*argv, "set", 3)) { + if (*++argv) { + strncpy(value = buf, *argv, sizeof(buf)); + name = strsep(&value, "="); + nvram_set(name, value); + } + } + else if (!strncmp(*argv, "unset", 5)) { + if (*++argv) + nvram_unset(*argv); + } + else if (!strncmp(*argv, "commit", 5)) { + nvram_commit(); + } + else if (!strncmp(*argv, "show", 4) || + !strncmp(*argv, "getall", 6)) { + nvram_getall(buf, sizeof(buf)); + for (name = buf; *name; name += strlen(name) + 1) + puts_trim_cr(name); + size = sizeof(struct nvram_header) + (int) name - (int) buf; + fprintf(stderr, "size: %d bytes (%d left)\n", size, NVRAM_SPACE - size); + } + if (!*argv) + break; + } + + return 0; +} diff --git a/package/nvram/src/nvram_convert.c b/package/nvram/src/nvram_convert.c new file mode 100644 index 0000000000..485909026c --- /dev/null +++ b/package/nvram/src/nvram_convert.c @@ -0,0 +1,77 @@ + +#define WL(a) "wl_"a +#define WL0(a) "wl0_"a +#define D11G(a) "d11g_"a + +#define PPP(a) "ppp_"a +#define PPPOE(a) "pppoe_"a + +struct nvram_convert { + char *name; // for WEB + char *wl0_name; // for driver + char *d11g_name; // for old nv name +}; + +struct nvram_convert nvram_converts[] = { + // Bellow change from 3.11.48.7 + { WL("ssid"), WL0("ssid"), ""}, + { WL("radio"), WL0("mode"), ""}, + { WL("mode"), WL0("mode"), ""}, + { WL("wds"), WL0("wds"), ""}, + { WL("auth"), WL0("auth"), ""}, + { WL("key"), WL0("key"), ""}, + { WL("key1"), WL0("key1"), ""}, + { WL("key2"), WL0("key2"), ""}, + { WL("key3"), WL0("key3"), ""}, + { WL("key4"), WL0("key4"), ""}, + { WL("maclist"), WL0("maclist"), ""}, + { WL("channel"), WL0("channel"), D11G("channel")}, + { WL("rateset"), WL0("rateset"), D11G("rateset")}, + { WL("rts"), WL0("rts"), D11G("rts")}, + { WL("bcn"), WL0("bcn"), D11G("bcn")}, + { WL("gmode"), WL0("gmode"), "d11g_mode"}, + { WL("unit"), WL0("unit"), ""}, + { WL("ifname"), WL0("ifname"), ""}, + { WL("phytype"), WL0("phytype"), ""}, + { WL("country"), WL0("country"), ""}, + { WL("closed"), WL0("closed"), ""}, + { WL("lazywds"), WL0("lazywds"), ""}, + { WL("wep"), WL0("wep"), ""}, + { WL("macmode"), WL0("macmode"), ""}, + { WL("rate"), WL0("rate"), D11G("rate")}, + { WL("frag"), WL0("frag"), D11G("frag")}, + { WL("dtim"), WL0("dtim"), D11G("dtim")}, + { WL("plcphdr"), WL0("plcphdr"), ""}, + { WL("gmode_protection"), WL0("gmode_protection"), ""}, + { WL("radio"), WL0("radio"), ""}, + // Bellow change from 3.21.9.0 + { WL("auth_mode"), WL0("auth_mode"), ""}, + { WL("radius_ipaddr"), WL0("radius_ipaddr"), ""}, + { WL("radius_port"), WL0("radius_port"), ""}, + { WL("radius_key"), WL0("radius_key"), ""}, + { WL("wpa_psk"), WL0("wpa_psk"), ""}, + { WL("wpa_gtk_rekey"), WL0("wpa_gtk_rekey"), ""}, + { WL("frameburst"), WL0("frameburst"), ""}, + { WL("crypto"), WL0("crypto"), ""}, + { WL("ap_isolate"), WL0("ap_isolate"), ""}, + { WL("afterburner"), WL0("afterburner"), ""}, + // for PPPoE + { PPP("username"), PPPOE("username"), ""}, + { PPP("passwd"), PPPOE("passwd"), ""}, + { PPP("idletime"), PPPOE("idletime"), ""}, + { PPP("keepalive"), PPPOE("keepalive"), ""}, + { PPP("demand"), PPPOE("demand"), ""}, + { PPP("service"), PPPOE("service"), ""}, + { PPP("ac"), PPPOE("ac"), ""}, + { PPP("static"), PPPOE("static"), ""}, + { PPP("static_ip"), PPPOE("static_ip"), ""}, + { PPP("username_1"), PPPOE("username_1"), ""}, + { PPP("passwd_1"), PPPOE("passwd_1"), ""}, + { PPP("idletime_1"), PPPOE("idletime_1"), ""}, + { PPP("keepalive_1"), PPPOE("keepalive_1"), ""}, + { PPP("demand_1"), PPPOE("demand_1"), ""}, + { PPP("service_1"), PPPOE("service_1"), ""}, + { PPP("ac_1"), PPPOE("ac_1"), ""}, + + { 0, 0, 0}, +}; diff --git a/package/nvram/src/nvram_convert.h b/package/nvram/src/nvram_convert.h new file mode 100644 index 0000000000..70e12327d1 --- /dev/null +++ b/package/nvram/src/nvram_convert.h @@ -0,0 +1,7 @@ + +struct nvram_convert { + char *name; + char *wl0_name; + char *d11g_name; +}; + diff --git a/package/nvram/src/nvram_linux.c b/package/nvram/src/nvram_linux.c new file mode 100644 index 0000000000..c41e32118a --- /dev/null +++ b/package/nvram/src/nvram_linux.c @@ -0,0 +1,320 @@ +/* + * NVRAM variable manipulation (Linux user mode half) + * + * Copyright 2004, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * + * $Id$ + */ + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <errno.h> +#include <error.h> +#include <string.h> +#include <sys/ioctl.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <sys/mman.h> + +#include <typedefs.h> +#include <bcmnvram.h> +#include <nvram_convert.h> +#include <shutils.h> +#include <utils.h> + +#define PATH_DEV_NVRAM "/dev/nvram" + +/* Globals */ +static int nvram_fd = -1; +static char *nvram_buf = NULL; +int check_action(void); +int file_to_buf(char *path, char *buf, int len); + +int +nvram_init(void *unused) +{ + if ((nvram_fd = open(PATH_DEV_NVRAM, O_RDWR)) < 0) + goto err; + + /* Map kernel string buffer into user space */ + if ((nvram_buf = mmap(NULL, NVRAM_SPACE, PROT_READ, MAP_SHARED, nvram_fd, 0)) == MAP_FAILED) { + close(nvram_fd); + nvram_fd = -1; + goto err; + } + + return 0; + + err: + perror(PATH_DEV_NVRAM); + return errno; +} + +char * +nvram_get(const char *name) +{ + size_t count = strlen(name) + 1; + char tmp[100], *value; + unsigned long *off = (unsigned long *) tmp; + + if (nvram_fd < 0) + if (nvram_init(NULL)) + return NULL; + + if (count > sizeof(tmp)) { + if (!(off = malloc(count))) + return NULL; + } + + /* Get offset into mmap() space */ + strcpy((char *) off, name); + + count = read(nvram_fd, off, count); + + if (count == sizeof(unsigned long)) + value = &nvram_buf[*off]; + else + value = NULL; + + if (count < 0) + perror(PATH_DEV_NVRAM); + + if (off != (unsigned long *) tmp) + free(off); + + return value; +} + +int +nvram_getall(char *buf, int count) +{ + int ret; + + if (nvram_fd < 0) + if ((ret = nvram_init(NULL))) + return ret; + + if (count == 0) + return 0; + + /* Get all variables */ + *buf = '\0'; + + ret = read(nvram_fd, buf, count); + + if (ret < 0) + perror(PATH_DEV_NVRAM); + + return (ret == count) ? 0 : ret; +} + +static int +_nvram_set(const char *name, const char *value) +{ + size_t count = strlen(name) + 1; + char tmp[100], *buf = tmp; + int ret; + + if (nvram_fd < 0) + if ((ret = nvram_init(NULL))) + return ret; + + /* Unset if value is NULL */ + if (value) + count += strlen(value) + 1; + + if (count > sizeof(tmp)) { + if (!(buf = malloc(count))) + return -ENOMEM; + } + + if (value) + sprintf(buf, "%s=%s", name, value); + else + strcpy(buf, name); + + ret = write(nvram_fd, buf, count); + + if (ret < 0) + perror(PATH_DEV_NVRAM); + + if (buf != tmp) + free(buf); + + return (ret == count) ? 0 : ret; +} + +int +nvram_set(const char *name, const char *value) +{ + extern struct nvram_convert nvram_converts[]; + struct nvram_convert *v; + int ret; + + ret = _nvram_set(name, value); + + for(v = nvram_converts ; v->name ; v++) { + if(!strcmp(v->name, name)){ + if(strcmp(v->wl0_name,"")) _nvram_set(v->wl0_name, value); + if(strcmp(v->d11g_name,"")) _nvram_set(v->d11g_name, value); + } + } + + return ret; +} + +int +nvram_unset(const char *name) +{ + return _nvram_set(name, NULL); +} + +int +nvram_commit(void) +{ + int ret; + + cprintf("nvram_commit(): start\n"); + + if((check_action() == ACT_IDLE) || + (check_action() == ACT_SW_RESTORE) || + (check_action() == ACT_HW_RESTORE)){ + if (nvram_fd < 0) + if ((ret = nvram_init(NULL))) + return ret; + + ret = ioctl(nvram_fd, NVRAM_MAGIC, NULL); + + if (ret < 0) + perror(PATH_DEV_NVRAM); + + cprintf("nvram_commit(): end\n"); + } + else + cprintf("nvram_commit(): nothing to do...\n"); + + return ret; +} + +int file2nvram(char *filename, char *varname) { + FILE *fp; + int c,count; + int i=0,j=0; + char mem[10000],buf[30000]; + + if ( !(fp=fopen(filename,"rb") )) + return 0; + + count=fread(mem,1,sizeof(mem),fp); + fclose(fp); + for (j=0;j<count;j++) { + if (i > sizeof(buf)-3 ) + break; + c=mem[j]; + if (c >= 32 && c <= 126 && c != '\\' && c != '~') { + buf[i++]=(unsigned char) c; + } else if (c==0) { + buf[i++]='~'; + } else { + buf[i++]='\\'; + sprintf(buf+i,"%02X",c); + i+=2; + } + } + if (i==0) return 0; + buf[i]=0; + //fprintf(stderr,"================ > file2nvram %s = [%s] \n",varname,buf); + nvram_set(varname,buf); + //nvram_commit(); //Barry adds for test +} + +int nvram2file(char *varname, char *filename) { + FILE *fp; + int c,tmp; + int i=0,j=0; + char *buf; + char mem[10000]; + + if ( !(fp=fopen(filename,"wb") )) + return 0; + + buf=strdup(nvram_safe_get(varname)); + //fprintf(stderr,"=================> nvram2file %s = [%s] \n",varname,buf); + while ( buf[i] && j < sizeof(mem)-3 ) { + if (buf[i] == '\\') { + i++; + tmp=buf[i+2]; + buf[i+2]=0; + sscanf(buf+i,"%02X",&c); + buf[i+2]=tmp; + i+=2; + mem[j]=c;j++; + } else if (buf[i] == '~') { + mem[j]=0;j++; + i++; + } else { + mem[j]=buf[i];j++; + i++; + } + } + if (j<=0) return j; + j=fwrite(mem,1,j,fp); + fclose(fp); + free(buf); + return j; +} + +int +check_action(void) +{ + char buf[80] = ""; + + if(file_to_buf(ACTION_FILE, buf, sizeof(buf))){ + if(!strcmp(buf, "ACT_TFTP_UPGRADE")){ + cprintf("Upgrading from tftp now, quiet exit....\n"); + return ACT_TFTP_UPGRADE; + } + else if(!strcmp(buf, "ACT_WEBS_UPGRADE")){ + cprintf("Upgrading from web (https) now, quiet exit....\n"); + return ACT_WEBS_UPGRADE; + } + else if(!strcmp(buf, "ACT_WEB_UPGRADE")){ + cprintf("Upgrading from web (http) now, quiet exit....\n"); + return ACT_WEB_UPGRADE; + } + else if(!strcmp(buf, "ACT_SW_RESTORE")){ + cprintf("Receive restore command from web, quiet exit....\n"); + return ACT_SW_RESTORE; + } + else if(!strcmp(buf, "ACT_HW_RESTORE")){ + cprintf("Receive restore commond from resetbutton, quiet exit....\n"); + return ACT_HW_RESTORE; + } + } + //fprintf(stderr, "Waiting for upgrading....\n"); + return ACT_IDLE; +} + +int +file_to_buf(char *path, char *buf, int len) +{ + FILE *fp; + + memset(buf, 0 , len); + + if ((fp = fopen(path, "r"))) { + fgets(buf, len, fp); + fclose(fp); + return 1; + } + + return 0; +} diff --git a/package/nvram/src/shutils.c b/package/nvram/src/shutils.c new file mode 100644 index 0000000000..49ad41af81 --- /dev/null +++ b/package/nvram/src/shutils.c @@ -0,0 +1,329 @@ +/* + * Shell-like utility functions + * + * Copyright 2004, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * + * $Id$ + */ + +#include <stdio.h> +#include <stdlib.h> +#include <stdarg.h> +#include <errno.h> +#include <error.h> +#include <fcntl.h> +#include <limits.h> +#include <unistd.h> +#include <signal.h> +#include <string.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <sys/wait.h> +#include <termios.h> +#include <sys/ioctl.h> +#include <sys/time.h> +#include <net/ethernet.h> + +#include <shutils.h> + +/* + * Reads file and returns contents + * @param fd file descriptor + * @return contents of file or NULL if an error occurred + */ +char * +fd2str(int fd) +{ + char *buf = NULL; + size_t count = 0, n; + + do { + buf = realloc(buf, count + 512); + n = read(fd, buf + count, 512); + if (n < 0) { + free(buf); + buf = NULL; + } + count += n; + } while (n == 512); + + close(fd); + if (buf) + buf[count] = '\0'; + return buf; +} + +/* + * Reads file and returns contents + * @param path path to file + * @return contents of file or NULL if an error occurred + */ +char * +file2str(const char *path) +{ + int fd; + + if ((fd = open(path, O_RDONLY)) == -1) { + perror(path); + return NULL; + } + + return fd2str(fd); +} + +/* + * Waits for a file descriptor to change status or unblocked signal + * @param fd file descriptor + * @param timeout seconds to wait before timing out or 0 for no timeout + * @return 1 if descriptor changed status or 0 if timed out or -1 on error + */ +int +waitfor(int fd, int timeout) +{ + fd_set rfds; + struct timeval tv = { timeout, 0 }; + + FD_ZERO(&rfds); + FD_SET(fd, &rfds); + return select(fd + 1, &rfds, NULL, NULL, (timeout > 0) ? &tv : NULL); +} + +/* + * Concatenates NULL-terminated list of arguments into a single + * commmand and executes it + * @param argv argument list + * @param path NULL, ">output", or ">>output" + * @param timeout seconds to wait before timing out or 0 for no timeout + * @param ppid NULL to wait for child termination or pointer to pid + * @return return value of executed command or errno + */ +int +_eval(char *const argv[], char *path, int timeout, int *ppid) +{ + pid_t pid; + int status; + int fd; + int flags; + int sig; + char buf[254]=""; + int i; + + switch (pid = fork()) { + case -1: /* error */ + perror("fork"); + return errno; + case 0: /* child */ + /* Reset signal handlers set for parent process */ + for (sig = 0; sig < (_NSIG-1); sig++) + signal(sig, SIG_DFL); + + /* Clean up */ + ioctl(0, TIOCNOTTY, 0); + close(STDIN_FILENO); + close(STDOUT_FILENO); + close(STDERR_FILENO); + setsid(); + + /* We want to check the board if exist UART? , add by honor 2003-12-04 */ + if ((fd = open("/dev/console", O_RDWR)) < 0) { + (void) open("/dev/null", O_RDONLY); + (void) open("/dev/null", O_WRONLY); + (void) open("/dev/null", O_WRONLY); + } + else{ + close(fd); + (void) open("/dev/console", O_RDONLY); + (void) open("/dev/console", O_WRONLY); + (void) open("/dev/console", O_WRONLY); + } + + /* Redirect stdout to <path> */ + if (path) { + flags = O_WRONLY | O_CREAT; + if (!strncmp(path, ">>", 2)) { + /* append to <path> */ + flags |= O_APPEND; + path += 2; + } else if (!strncmp(path, ">", 1)) { + /* overwrite <path> */ + flags |= O_TRUNC; + path += 1; + } + if ((fd = open(path, flags, 0644)) < 0) + perror(path); + else { + dup2(fd, STDOUT_FILENO); + close(fd); + } + } + + /* execute command */ + for(i=0 ; argv[i] ; i++) + snprintf(buf+strlen(buf), sizeof(buf), "%s ", argv[i]); + dprintf("cmd=[%s]\n", buf); + setenv("PATH", "/sbin:/bin:/usr/sbin:/usr/bin", 1); + alarm(timeout); + execvp(argv[0], argv); + perror(argv[0]); + exit(errno); + default: /* parent */ + if (ppid) { + *ppid = pid; + return 0; + } else { + waitpid(pid, &status, 0); + if (WIFEXITED(status)) + return WEXITSTATUS(status); + else + return status; + } + } +} + +/* + * Concatenates NULL-terminated list of arguments into a single + * commmand and executes it + * @param argv argument list + * @return stdout of executed command or NULL if an error occurred + */ +char * +_backtick(char *const argv[]) +{ + int filedes[2]; + pid_t pid; + int status; + char *buf = NULL; + + /* create pipe */ + if (pipe(filedes) == -1) { + perror(argv[0]); + return NULL; + } + + switch (pid = fork()) { + case -1: /* error */ + return NULL; + case 0: /* child */ + close(filedes[0]); /* close read end of pipe */ + dup2(filedes[1], 1); /* redirect stdout to write end of pipe */ + close(filedes[1]); /* close write end of pipe */ + execvp(argv[0], argv); + exit(errno); + break; + default: /* parent */ + close(filedes[1]); /* close write end of pipe */ + buf = fd2str(filedes[0]); + waitpid(pid, &status, 0); + break; + } + + return buf; +} + +/* + * Kills process whose PID is stored in plaintext in pidfile + * @param pidfile PID file + * @return 0 on success and errno on failure + */ +int +kill_pidfile(char *pidfile) +{ + FILE *fp = fopen(pidfile, "r"); + char buf[256]; + + if (fp && fgets(buf, sizeof(buf), fp)) { + pid_t pid = strtoul(buf, NULL, 0); + fclose(fp); + return kill(pid, SIGTERM); + } else + return errno; +} + +/* + * fread() with automatic retry on syscall interrupt + * @param ptr location to store to + * @param size size of each element of data + * @param nmemb number of elements + * @param stream file stream + * @return number of items successfully read + */ +int +safe_fread(void *ptr, size_t size, size_t nmemb, FILE *stream) +{ + size_t ret = 0; + + do { + clearerr(stream); + ret += fread((char *)ptr + (ret * size), size, nmemb - ret, stream); + } while (ret < nmemb && ferror(stream) && errno == EINTR); + + return ret; +} + +/* + * fwrite() with automatic retry on syscall interrupt + * @param ptr location to read from + * @param size size of each element of data + * @param nmemb number of elements + * @param stream file stream + * @return number of items successfully written + */ +int +safe_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream) +{ + size_t ret = 0; + + do { + clearerr(stream); + ret += fwrite((char *)ptr + (ret * size), size, nmemb - ret, stream); + } while (ret < nmemb && ferror(stream) && errno == EINTR); + + return ret; +} + +/* + * Convert Ethernet address string representation to binary data + * @param a string in xx:xx:xx:xx:xx:xx notation + * @param e binary data + * @return TRUE if conversion was successful and FALSE otherwise + */ +int +ether_atoe(const char *a, unsigned char *e) +{ + char *c = (char *) a; + int i = 0; + + memset(e, 0, ETHER_ADDR_LEN); + for (;;) { + e[i++] = (unsigned char) strtoul(c, &c, 16); + if (!*c++ || i == ETHER_ADDR_LEN) + break; + } + return (i == ETHER_ADDR_LEN); +} + +/* + * Convert Ethernet address binary data to string representation + * @param e binary data + * @param a string in xx:xx:xx:xx:xx:xx notation + * @return a + */ +char * +ether_etoa(const unsigned char *e, char *a) +{ + char *c = a; + int i; + + for (i = 0; i < ETHER_ADDR_LEN; i++) { + if (i) + *c++ = ':'; + c += sprintf(c, "%02X", e[i] & 0xff); + } + return a; +} diff --git a/package/nvram/src/wl.c b/package/nvram/src/wl.c new file mode 100644 index 0000000000..5738e2cd04 --- /dev/null +++ b/package/nvram/src/wl.c @@ -0,0 +1,299 @@ +/* + * Wireless network adapter utilities + * + * Copyright 2004, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * + * $Id$ + */ +#include <string.h> + +#include <typedefs.h> +#include <wlutils.h> + +int +wl_probe(char *name) +{ + int ret, val; + + /* Check interface */ + if ((ret = wl_ioctl(name, WLC_GET_MAGIC, &val, sizeof(val)))) + return ret; + if (val != WLC_IOCTL_MAGIC) + return -1; + if ((ret = wl_ioctl(name, WLC_GET_VERSION, &val, sizeof(val)))) + return ret; + if (val > WLC_IOCTL_VERSION) + return -1; + + return ret; +} + +int +wl_set_val(char *name, char *var, void *val, int len) +{ + char buf[128]; + int buf_len; + + /* check for overflow */ + if ((buf_len = strlen(var)) + 1 + len > sizeof(buf)) + return -1; + + strcpy(buf, var); + buf_len += 1; + + /* append int value onto the end of the name string */ + memcpy(&buf[buf_len], val, len); + buf_len += len; + + return wl_ioctl(name, WLC_SET_VAR, buf, buf_len); +} + +int +wl_get_val(char *name, char *var, void *val, int len) +{ + char buf[128]; + int ret; + + /* check for overflow */ + if (strlen(var) + 1 > sizeof(buf) || len > sizeof(buf)) + return -1; + + strcpy(buf, var); + if ((ret = wl_ioctl(name, WLC_GET_VAR, buf, sizeof(buf)))) + return ret; + + memcpy(val, buf, len); + return 0; +} + +int +wl_set_int(char *name, char *var, int val) +{ + return wl_set_val(name, var, &val, sizeof(val)); +} + +int +wl_get_int(char *name, char *var, int *val) +{ + return wl_get_val(name, var, val, sizeof(*val)); +} + +/************************************************************************** + * The following code is from Broadcom (wl.c) * + **************************************************************************/ + +int +wl_iovar_getbuf(char *ifname, char *iovar, void *param, + int paramlen, void *bufptr, int buflen) +{ + int err; + uint namelen; + uint iolen; + + namelen = strlen(iovar) + 1; /* length of iovar name plus null */ + iolen = namelen + paramlen; + + /* check for overflow */ + if (iolen > buflen) + return (-1); + + memcpy(bufptr, iovar, namelen); /* copy iovar name including null */ + memcpy((int8*)bufptr + namelen, param, paramlen); + + err = wl_ioctl(ifname, WLC_GET_VAR, bufptr, buflen); + + return (err); +} + +int +wl_iovar_setbuf(char *ifname, char *iovar, void *param, + int paramlen, void *bufptr, int buflen) +{ + uint namelen; + uint iolen; + + namelen = strlen(iovar) + 1; /* length of iovar name plus null */ + iolen = namelen + paramlen; + + /* check for overflow */ + if (iolen > buflen) + return (-1); + + memcpy(bufptr, iovar, namelen); /* copy iovar name including null */ + memcpy((int8*)bufptr + namelen, param, paramlen); + + return wl_ioctl(ifname, WLC_SET_VAR, bufptr, iolen); +} + +int +wl_iovar_set(char *ifname, char *iovar, void *param, int paramlen) +{ + char smbuf[WLC_IOCTL_SMLEN]; + + return wl_iovar_setbuf(ifname, iovar, param, paramlen, smbuf, sizeof(smbuf)); +} + +int +wl_iovar_get(char *ifname, char *iovar, void *bufptr, int buflen) +{ + char smbuf[WLC_IOCTL_SMLEN]; + int ret; + + /* use the return buffer if it is bigger than what we have on the stack */ + if (buflen > sizeof(smbuf)) { + ret = wl_iovar_getbuf(ifname, iovar, NULL, 0, bufptr, buflen); + } else { + ret = wl_iovar_getbuf(ifname, iovar, NULL, 0, smbuf, sizeof(smbuf)); + if (ret == 0) + memcpy(bufptr, smbuf, buflen); + } + + return ret; +} + +/* + * set named driver variable to int value + * calling example: wl_iovar_setint(ifname, "arate", rate) +*/ +int +wl_iovar_setint(char *ifname, char *iovar, int val) +{ + return wl_iovar_set(ifname, iovar, &val, sizeof(val)); +} + +/* + * get named driver variable to int value and return error indication + * calling example: wl_iovar_getint(ifname, "arate", &rate) + */ +int +wl_iovar_getint(char *ifname, char *iovar, int *val) +{ + return wl_iovar_get(ifname, iovar, val, sizeof(int)); +} + +/* + * format a bsscfg indexed iovar buffer + */ +static int +wl_bssiovar_mkbuf(char *iovar, int bssidx, void *param, + int paramlen, void *bufptr, int buflen, int *plen) +{ + char *prefix = "bsscfg:"; + int8* p; + uint prefixlen; + uint namelen; + uint iolen; + + prefixlen = strlen(prefix); /* length of bsscfg prefix */ + namelen = strlen(iovar) + 1; /* length of iovar name + null */ + iolen = prefixlen + namelen + sizeof(int) + paramlen; + + /* check for overflow */ + if (buflen < 0 || iolen > (uint)buflen) { + *plen = 0; + return -1; + } + + p = (int8*)bufptr; + + /* copy prefix, no null */ + memcpy(p, prefix, prefixlen); + p += prefixlen; + + /* copy iovar name including null */ + memcpy(p, iovar, namelen); + p += namelen; + + /* bss config index as first param */ + memcpy(p, &bssidx, sizeof(int32)); + p += sizeof(int32); + + /* parameter buffer follows */ + if (paramlen) + memcpy(p, param, paramlen); + + *plen = iolen; + return 0; +} + +/* + * set named & bss indexed driver variable to buffer value + */ +int +wl_bssiovar_setbuf(char *ifname, char *iovar, int bssidx, void *param, + int paramlen, void *bufptr, int buflen) +{ + int err; + uint iolen; + + err = wl_bssiovar_mkbuf(iovar, bssidx, param, paramlen, bufptr, buflen, &iolen); + if (err) + return err; + + return wl_ioctl(ifname, WLC_SET_VAR, bufptr, iolen); +} + +/* + * get named & bss indexed driver variable buffer value + */ +int +wl_bssiovar_getbuf(char *ifname, char *iovar, int bssidx, void *param, + int paramlen, void *bufptr, int buflen) +{ + int err; + uint iolen; + + err = wl_bssiovar_mkbuf(iovar, bssidx, param, paramlen, bufptr, buflen, &iolen); + if (err) + return err; + + return wl_ioctl(ifname, WLC_GET_VAR, bufptr, buflen); +} + +/* + * set named & bss indexed driver variable to buffer value + */ +int +wl_bssiovar_set(char *ifname, char *iovar, int bssidx, void *param, int paramlen) +{ + char smbuf[WLC_IOCTL_SMLEN]; + + return wl_bssiovar_setbuf(ifname, iovar, bssidx, param, paramlen, smbuf, sizeof(smbuf)); +} + +/* + * get named & bss indexed driver variable buffer value + */ +int +wl_bssiovar_get(char *ifname, char *iovar, int bssidx, void *outbuf, int len) +{ + char smbuf[WLC_IOCTL_SMLEN]; + int err; + + /* use the return buffer if it is bigger than what we have on the stack */ + if (len > (int)sizeof(smbuf)) { + err = wl_bssiovar_getbuf(ifname, iovar, bssidx, NULL, 0, outbuf, len); + } else { + memset(smbuf, 0, sizeof(smbuf)); + err = wl_bssiovar_getbuf(ifname, iovar, bssidx, NULL, 0, smbuf, sizeof(smbuf)); + if (err == 0) + memcpy(outbuf, smbuf, len); + } + + return err; +} + +/* + * set named & bss indexed driver variable to int value + */ +int +wl_bssiovar_setint(char *ifname, char *iovar, int bssidx, int val) +{ + return wl_bssiovar_set(ifname, iovar, bssidx, &val, sizeof(int)); +} diff --git a/package/nvram/src/wl_linux.c b/package/nvram/src/wl_linux.c new file mode 100644 index 0000000000..126a40b4b3 --- /dev/null +++ b/package/nvram/src/wl_linux.c @@ -0,0 +1,77 @@ +/* + * Wireless network adapter utilities (linux-specific) + * + * Copyright 2004, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * + * $Id$ + */ + +#include <stdio.h> +#include <unistd.h> +#include <string.h> +#include <errno.h> +#include <sys/ioctl.h> +#include <net/if.h> + +#include <typedefs.h> +#include <wlioctl.h> +#include <wlutils.h> + +int +wl_ioctl(char *name, int cmd, void *buf, int len) +{ + struct ifreq ifr; + wl_ioctl_t ioc; + int ret = 0; + int s; + + /* open socket to kernel */ + if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { + perror("socket"); + return errno; + } + + /* do it */ + ioc.cmd = cmd; + ioc.buf = buf; + ioc.len = len; + strncpy(ifr.ifr_name, name, IFNAMSIZ); + ifr.ifr_data = (caddr_t) &ioc; + if ((ret = ioctl(s, SIOCDEVPRIVATE, &ifr)) < 0) + if (cmd != WLC_GET_MAGIC) + perror(ifr.ifr_name); + + /* cleanup */ + close(s); + return ret; +} + +int +wl_hwaddr(char *name, unsigned char *hwaddr) +{ + struct ifreq ifr; + int ret = 0; + int s; + + /* open socket to kernel */ + if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { + perror("socket"); + return errno; + } + + /* do it */ + strncpy(ifr.ifr_name, name, IFNAMSIZ); + if ((ret = ioctl(s, SIOCGIFHWADDR, &ifr)) == 0) + memcpy(hwaddr, ifr.ifr_hwaddr.sa_data, ETHER_ADDR_LEN); + + /* cleanup */ + close(s); + return ret; +} + diff --git a/package/openssl/Makefile b/package/openssl/Makefile new file mode 100644 index 0000000000..54b4aac089 --- /dev/null +++ b/package/openssl/Makefile @@ -0,0 +1,134 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=openssl +PKG_VERSION:=0.9.8d +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://www.openssl.org/source/ \ + ftp://ftp.funet.fi/pub/crypt/cryptography/libs/openssl/source/ \ + ftp://ftp.webmonster.de/pub/openssl/source/ \ + ftp://ftp.sunet.se/pub/security/tools/net/openssl/source/ +PKG_MD5SUM:=8ed1853538e1d05a1f5ada61ebf8bffa +PKG_CAT:=zcat + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install + +include $(INCLUDE_DIR)/package.mk + +define Package/openssl/Default + TITLE:=Open source SSL toolkit + DESCRIPTION:=\ + The OpenSSL Project is a collaborative effort to develop a robust, \\\ + commercial-grade, full-featured, and Open Source toolkit implementing the \\\ + Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) \\\ + protocols as well as a full-strength general purpose cryptography library. + URL:=http://www.openssl.org/ +endef + +define Package/libopenssl + $(call Package/openssl/Default) + SECTION:=libs + CATEGORY:=Libraries + DEPENDS:=+zlib + TITLE+= (libraries) + DESCRIPTION+=\\\ + \\\ + This package contains the OpenSSL shared libraries, needed by other \\\ + programs. +endef + +define Package/openssl-util + $(call Package/openssl/Default) + SECTION:=utils + CATEGORY:=Utilities + DEPENDS:=+libopenssl + TITLE+= (utility) + DESCRIPTION+=\\\ + \\\ + This package contains the OpenSSL command-line utility. +endef + +define Package/openssl-util/conffiles +/etc/ssl/openssl.cnf +endef + +OPENSSL_NO_CIPHERS:= no-idea no-md2 no-mdc2 no-rc5 no-sha0 no-rmd160 no-aes192 +OPENSSL_OPTIONS:= shared no-ec no-err no-fips no-hw no-krb5 no-threads zlib-dynamic no-engines + +define Build/Configure + (cd $(PKG_BUILD_DIR); \ + ./Configure linux-openwrt \ + --prefix=/usr \ + --openssldir=/etc/ssl \ + -I$(STAGING_DIR)/usr/include \ + -L$(STAGING_DIR)/usr/lib -ldl \ + -DOPENSSL_SMALL_FOOTPRINT \ + $(OPENSSL_NO_CIPHERS) \ + $(OPENSSL_OPTIONS) \ + ) +endef + +define Build/Compile + rm -rf $(PKG_INSTALL_DIR) + mkdir -p $(PKG_INSTALL_DIR) + $(MAKE) -C $(PKG_BUILD_DIR) -j1 \ + MAKEDEPPROG="$(TARGET_CROSS)gcc" \ + OPENWRT_OPTIMIZATION_FLAGS="$(TARGET_CFLAGS)" \ + depend + $(MAKE) -C $(PKG_BUILD_DIR) -j1 \ + CC="$(TARGET_CC)" \ + AR="$(TARGET_CROSS)ar r" \ + RANLIB="$(TARGET_CROSS)ranlib" \ + OPENWRT_OPTIMIZATION_FLAGS="$(TARGET_CFLAGS)" \ + all build-shared + # Work around openssl build bug to link libssl.so with libcrypto.so. + -rm $(PKG_BUILD_DIR)/libssl.so.*.*.* + $(MAKE) -C $(PKG_BUILD_DIR) -j1 \ + CC="$(TARGET_CC)" \ + OPENWRT_OPTIMIZATION_FLAGS="$(TARGET_CFLAGS)" \ + do_linux-shared + $(MAKE) -C $(PKG_BUILD_DIR) -j1 \ + INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \ + install +endef + +define Build/InstallDev + mkdir -p $(STAGING_DIR)/usr/include + $(CP) $(PKG_INSTALL_DIR)/usr/include/openssl $(STAGING_DIR)/usr/include/ + mkdir -p $(STAGING_DIR)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{crypto,ssl}.{a,so*} $(STAGING_DIR)/usr/lib/ +endef + +define Build/UninstallDev + rm -rf $(STAGING_DIR)/usr/include/openssl \ + $(STAGING_DIR)/usr/lib/lib{crypto,ssl}.{a,so*} +endef + +define Package/libopenssl/install + install -d -m0755 $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{crypto,ssl}.so.* $(1)/usr/lib/ + chmod 0644 $(1)/usr/lib/* +endef + +define Package/openssl-util/install + install -d -m0755 $(1)/etc/ssl + $(CP) $(PKG_INSTALL_DIR)/etc/ssl/openssl.cnf $(1)/etc/ssl/ + install -d -m0755 $(1)/etc/ssl/certs + install -d -m0755 $(1)/etc/ssl/private + chmod 0700 $(1)/etc/ssl/private + install -d -m0755 $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/openssl $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,libopenssl)) +$(eval $(call BuildPackage,openssl-util)) diff --git a/package/openssl/patches/110-optimize-for-size.patch b/package/openssl/patches/110-optimize-for-size.patch new file mode 100644 index 0000000000..8c78b6a01c --- /dev/null +++ b/package/openssl/patches/110-optimize-for-size.patch @@ -0,0 +1,12 @@ +diff -ur openssl-0.9.8a/Configure openssl-0.9.8a-owrt/Configure +--- openssl-0.9.8a/Configure 2005-08-02 12:59:42.000000000 +0200 ++++ openssl-0.9.8a-owrt/Configure 2006-03-23 14:16:35.000000000 +0100 +@@ -353,6 +353,8 @@ + "linux-alpha+bwx-gcc","gcc:-O3 -DL_ENDIAN -DTERMIO::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", + "linux-alpha-ccc","ccc:-fast -readonly_strings -DL_ENDIAN -DTERMIO::-D_REENTRANT:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:${no_asm}", + "linux-alpha+bwx-ccc","ccc:-fast -readonly_strings -DL_ENDIAN -DTERMIO::-D_REENTRANT:::SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:${no_asm}", ++# OpenWrt targets ++"linux-openwrt","gcc:-DTERMIO \$(OPENWRT_OPTIMIZATION_FLAGS) -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", + + #### *BSD [do see comment about ${BSDthreads} above!] + "BSD-generic32","gcc:-DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", diff --git a/package/openssl/patches/120-makedepend.patch b/package/openssl/patches/120-makedepend.patch new file mode 100644 index 0000000000..c802fe4adc --- /dev/null +++ b/package/openssl/patches/120-makedepend.patch @@ -0,0 +1,28 @@ +diff -ruN openssl-0.9.7g-old/util/domd openssl-0.9.7g-new/util/domd +--- openssl-0.9.7g-old/util/domd 2004-05-11 14:46:18.000000000 +0200 ++++ openssl-0.9.7g-new/util/domd 2005-05-30 20:20:04.000000000 +0200 +@@ -1,4 +1,4 @@ +-#!/bin/sh ++#!/bin/bash + # Do a makedepend, only leave out the standard headers + # Written by Ben Laurie <ben@algroup.co.uk> 19 Jan 1999 + +@@ -14,7 +14,8 @@ + cp Makefile Makefile.save + # fake the presence of Kerberos + touch $TOP/krb5.h +-if [ "$MAKEDEPEND" = "gcc" ]; then ++D=${MAKEDEPEND/%*gcc/gcc} ++if [ "$D" = "gcc" ]; then + args="" + while [ $# -gt 0 ]; do + if [ "$1" != "--" ]; then args="$args $1"; fi +@@ -22,7 +23,7 @@ + done + sed -e '/^# DO NOT DELETE.*/,$d' < Makefile > Makefile.tmp + echo '# DO NOT DELETE THIS LINE -- make depend depends on it.' >> Makefile.tmp +- gcc -D OPENSSL_DOING_MAKEDEPEND -M $args >> Makefile.tmp ++ ${MAKEDEPEND} -D OPENSSL_DOING_MAKEDEPEND -M $args >> Makefile.tmp + ${PERL} $TOP/util/clean-depend.pl < Makefile.tmp > Makefile.new + rm -f Makefile.tmp + else diff --git a/package/openssl/patches/130-perl-path.patch b/package/openssl/patches/130-perl-path.patch new file mode 100644 index 0000000000..42467b8388 --- /dev/null +++ b/package/openssl/patches/130-perl-path.patch @@ -0,0 +1,72 @@ +diff -Nur openssl-0.9.7f/Configure openssl-0.9.7f.new/Configure +--- openssl-0.9.7f/Configure 2005-03-12 12:28:21.000000000 +0100 ++++ openssl-0.9.7f.new/Configure 2005-04-03 20:32:00.000000000 +0200 +@@ -1,4 +1,4 @@ +-: ++#!/usr/bin/perl + eval 'exec perl -S $0 ${1+"$@"}' + if $running_under_some_shell; + ## +diff -Nur openssl-0.9.7f/tools/c_rehash.in openssl-0.9.7f.new/tools/c_rehash.in +--- openssl-0.9.7f/tools/c_rehash.in 2002-10-11 22:35:45.000000000 +0200 ++++ openssl-0.9.7f.new/tools/c_rehash.in 2005-04-03 20:41:17.000000000 +0200 +@@ -1,4 +1,4 @@ +-#!/usr/local/bin/perl ++#!/usr/bin/perl + + + # Perl c_rehash script, scan all files in a directory +diff -Nur openssl-0.9.7f/util/clean-depend.pl openssl-0.9.7f.new/util/clean-depend.pl +--- openssl-0.9.7f/util/clean-depend.pl 2001-10-10 10:27:28.000000000 +0200 ++++ openssl-0.9.7f.new/util/clean-depend.pl 2005-04-03 20:41:38.000000000 +0200 +@@ -1,4 +1,4 @@ +-#!/usr/local/bin/perl -w ++#!/usr/bin/perl -w + # Clean the dependency list in a makefile of standard includes... + # Written by Ben Laurie <ben@algroup.co.uk> 19 Jan 1999 + +diff -Nur openssl-0.9.7f/util/mkdef.pl openssl-0.9.7f.new/util/mkdef.pl +--- openssl-0.9.7f/util/mkdef.pl 2005-02-05 18:19:23.000000000 +0100 ++++ openssl-0.9.7f.new/util/mkdef.pl 2005-04-03 20:42:49.000000000 +0200 +@@ -1,4 +1,4 @@ +-#!/usr/local/bin/perl -w ++#!/usr/bin/perl + # + # generate a .def file + # +diff -Nur openssl-0.9.7f/util/mkerr.pl openssl-0.9.7f.new/util/mkerr.pl +--- openssl-0.9.7f/util/mkerr.pl 2005-01-31 02:28:17.000000000 +0100 ++++ openssl-0.9.7f.new/util/mkerr.pl 2005-04-03 20:43:02.000000000 +0200 +@@ -1,4 +1,4 @@ +-#!/usr/local/bin/perl -w ++#!/usr/bin/perl + + my $config = "crypto/err/openssl.ec"; + my $debug = 0; +diff -Nur openssl-0.9.7f/util/mkstack.pl openssl-0.9.7f.new/util/mkstack.pl +--- openssl-0.9.7f/util/mkstack.pl 2004-10-04 18:27:36.000000000 +0200 ++++ openssl-0.9.7f.new/util/mkstack.pl 2005-04-03 20:43:18.000000000 +0200 +@@ -1,4 +1,4 @@ +-#!/usr/local/bin/perl -w ++#!/usr/bin/perl + + # This is a utility that searches out "DECLARE_STACK_OF()" + # declarations in .h and .c files, and updates/creates/replaces +diff -Nur openssl-0.9.7f/util/pod2man.pl openssl-0.9.7f.new/util/pod2man.pl +--- openssl-0.9.7f/util/pod2man.pl 2002-05-30 17:30:21.000000000 +0200 ++++ openssl-0.9.7f.new/util/pod2man.pl 2005-04-03 20:43:52.000000000 +0200 +@@ -1,4 +1,4 @@ +-: #!/usr/bin/perl-5.005 ++#!/usr/bin/perl + eval 'exec /usr/bin/perl -S $0 ${1+"$@"}' + if $running_under_some_shell; + +diff -Nur openssl-0.9.7f/util/selftest.pl openssl-0.9.7f.new/util/selftest.pl +--- openssl-0.9.7f/util/selftest.pl 2004-05-11 14:46:19.000000000 +0200 ++++ openssl-0.9.7f.new/util/selftest.pl 2005-04-03 20:44:10.000000000 +0200 +@@ -1,4 +1,4 @@ +-#!/usr/local/bin/perl -w ++#!/usr/bin/perl + # + # Run the test suite and generate a report + # diff --git a/package/openssl/patches/140-makefile-dirs.patch b/package/openssl/patches/140-makefile-dirs.patch new file mode 100644 index 0000000000..89022e0c6c --- /dev/null +++ b/package/openssl/patches/140-makefile-dirs.patch @@ -0,0 +1,11 @@ +--- openssl-0.9.8a/Makefile.org 2006-02-21 20:57:45.000000000 -0800 ++++ openssl-0.9.8a-new/Makefile.org 2006-02-21 21:37:11.000000000 -0800 +@@ -100,7 +100,7 @@ + KRB5_INCLUDES= + LIBKRB5= + +-DIRS= crypto ssl engines apps test tools ++DIRS= crypto ssl apps + SHLIBDIRS= crypto ssl + + # dirs in crypto to build diff --git a/package/openssl/patches/150-no_engines.patch b/package/openssl/patches/150-no_engines.patch new file mode 100644 index 0000000000..b928fbcc61 --- /dev/null +++ b/package/openssl/patches/150-no_engines.patch @@ -0,0 +1,83 @@ +diff -udrNP openssl-0.9.8-stable-SNAP-20050703.orig/util/libeay.num openssl-0.9.8-stable-SNAP-20050703/util/libeay.num +--- openssl-0.9.8-stable-SNAP-20050703.orig/util/libeay.num 2005-07-04 00:27:14.653639088 +0200 ++++ openssl-0.9.8-stable-SNAP-20050703/util/libeay.num 2005-07-04 22:50:07.986576664 +0200 +@@ -2071,7 +2071,6 @@ + UI_add_error_string 2633 EXIST::FUNCTION: + KRB5_CHECKSUM_free 2634 EXIST::FUNCTION: + OCSP_REQUEST_get_ext 2635 EXIST::FUNCTION: +-ENGINE_load_ubsec 2636 EXIST::FUNCTION:ENGINE,STATIC_ENGINE + ENGINE_register_all_digests 2637 EXIST::FUNCTION:ENGINE + PKEY_USAGE_PERIOD_it 2638 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: + PKEY_USAGE_PERIOD_it 2638 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: +@@ -2545,7 +2544,6 @@ + AES_set_encrypt_key 3024 EXIST::FUNCTION:AES + OCSP_resp_count 3025 EXIST::FUNCTION: + KRB5_CHECKSUM_new 3026 EXIST::FUNCTION: +-ENGINE_load_cswift 3027 EXIST::FUNCTION:ENGINE,STATIC_ENGINE + OCSP_onereq_get0_id 3028 EXIST::FUNCTION: + ENGINE_set_default_ciphers 3029 EXIST::FUNCTION:ENGINE + NOTICEREF_it 3030 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: +@@ -2576,7 +2574,6 @@ + i2d_EXTENDED_KEY_USAGE 3052 EXIST::FUNCTION: + i2d_OCSP_SIGNATURE 3053 EXIST::FUNCTION: + asn1_enc_save 3054 EXIST::FUNCTION: +-ENGINE_load_nuron 3055 EXIST::FUNCTION:ENGINE,STATIC_ENGINE + _ossl_old_des_pcbc_encrypt 3056 EXIST::FUNCTION:DES + PKCS12_MAC_DATA_it 3057 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: + PKCS12_MAC_DATA_it 3057 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: +@@ -2600,7 +2597,6 @@ + i2d_KRB5_CHECKSUM 3072 EXIST::FUNCTION: + ENGINE_set_table_flags 3073 EXIST::FUNCTION:ENGINE + AES_options 3074 EXIST::FUNCTION:AES +-ENGINE_load_chil 3075 EXIST::FUNCTION:ENGINE,STATIC_ENGINE + OCSP_id_cmp 3076 EXIST::FUNCTION: + OCSP_BASICRESP_new 3077 EXIST::FUNCTION: + OCSP_REQUEST_get_ext_by_NID 3078 EXIST::FUNCTION: +@@ -2667,7 +2663,6 @@ + OCSP_CRLID_it 3127 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: + i2d_KRB5_AUTHENTBODY 3128 EXIST::FUNCTION: + OCSP_REQUEST_get_ext_count 3129 EXIST::FUNCTION: +-ENGINE_load_atalla 3130 EXIST::FUNCTION:ENGINE,STATIC_ENGINE + X509_NAME_it 3131 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: + X509_NAME_it 3131 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: + USERNOTICE_it 3132 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: +@@ -2762,8 +2757,6 @@ + DES_read_password 3207 EXIST::FUNCTION:DES + UI_UTIL_read_pw 3208 EXIST::FUNCTION: + UI_UTIL_read_pw_string 3209 EXIST::FUNCTION: +-ENGINE_load_aep 3210 EXIST::FUNCTION:ENGINE,STATIC_ENGINE +-ENGINE_load_sureware 3211 EXIST::FUNCTION:ENGINE,STATIC_ENGINE + OPENSSL_add_all_algorithms_noconf 3212 EXIST:!VMS:FUNCTION: + OPENSSL_add_all_algo_noconf 3212 EXIST:VMS:FUNCTION: + OPENSSL_add_all_algorithms_conf 3213 EXIST:!VMS:FUNCTION: +@@ -2772,7 +2765,6 @@ + AES_ofb128_encrypt 3215 EXIST::FUNCTION:AES + AES_ctr128_encrypt 3216 EXIST::FUNCTION:AES + AES_cfb128_encrypt 3217 EXIST::FUNCTION:AES +-ENGINE_load_4758cca 3218 EXIST::FUNCTION:ENGINE,STATIC_ENGINE + _ossl_096_des_random_seed 3219 EXIST::FUNCTION:DES + EVP_aes_256_ofb 3220 EXIST::FUNCTION:AES + EVP_aes_192_ofb 3221 EXIST::FUNCTION:AES +@@ -3107,7 +3099,6 @@ + STORE_method_set_modify_function 3530 EXIST:!VMS:FUNCTION: + STORE_meth_set_modify_fn 3530 EXIST:VMS:FUNCTION: + STORE_parse_attrs_next 3531 EXIST::FUNCTION: +-ENGINE_load_padlock 3532 EXIST::FUNCTION:ENGINE + EC_GROUP_set_curve_name 3533 EXIST::FUNCTION:EC + X509_CERT_PAIR_it 3534 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: + X509_CERT_PAIR_it 3534 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: +diff -udrNP openssl-0.9.8-stable-SNAP-20050703.orig/Configure openssl-0.9.8-stable-SNAP-20050703/Configure +--- openssl-0.9.8-stable-SNAP-20050703.orig/Configure 2005-07-04 00:27:11.169168808 +0200 ++++ openssl-0.9.8-stable-SNAP-20050703/Configure 2005-07-05 00:02:12.590136992 +0200 +@@ -1623,6 +1624,11 @@ + close(OUT); + } + ++# ugly hack to disable engines ++if($target eq "mingwx") { ++ system("sed -e s/^LIB/XLIB/g -i engines/Makefile"); ++} ++ + print <<EOF; + + Configured for $target. diff --git a/package/openssl/patches/160-disable_doc_tests.patch b/package/openssl/patches/160-disable_doc_tests.patch new file mode 100644 index 0000000000..27e2033475 --- /dev/null +++ b/package/openssl/patches/160-disable_doc_tests.patch @@ -0,0 +1,60 @@ +diff -urN openssl-0.9.8a/Makefile openssl-0.9.8a.new/Makefile +--- openssl-0.9.8a/Makefile 2005-10-11 12:21:48.000000000 +0200 ++++ openssl-0.9.8a.new/Makefile 2006-03-29 15:23:28.107586680 +0200 +@@ -102,7 +102,7 @@ + KRB5_INCLUDES= + LIBKRB5= + +-DIRS= crypto ssl engines apps test tools ++DIRS= crypto ssl engines apps tools + SHLIBDIRS= crypto ssl + + # dirs in crypto to build +@@ -119,7 +119,7 @@ + + # tests to perform. "alltests" is a special word indicating that all tests + # should be performed. +-TESTS = alltests ++TESTS = + + MAKEFILE= Makefile + +@@ -131,7 +131,7 @@ + + TOP= . + ONEDIRS=out tmp +-EDIRS= times doc bugs util include certs ms shlib mt demos perl sf dep VMS ++EDIRS= times bugs util include certs ms shlib mt demos perl sf dep VMS + WDIRS= windows + LIBS= libcrypto.a libssl.a + SHARED_CRYPTO=libcrypto$(SHLIB_EXT) +@@ -204,7 +204,7 @@ + @[ -n "$(THIS)" ] && $(CLEARENV) && $(MAKE) $(THIS) -e $(BUILDENV) + + sub_all: build_all +-build_all: build_libs build_apps build_tests build_tools ++build_all: build_libs build_apps build_tools + + build_libs: build_crypto build_ssl build_engines + +@@ -454,7 +454,7 @@ + dist_pem_h: + (cd crypto/pem; $(MAKE) -e $(BUILDENV) pem.h; $(MAKE) clean) + +-install: all install_docs install_sw ++install: all install_sw + + install_sw: + @$(PERL) $(TOP)/util/mkdir-p.pl $(INSTALL_PREFIX)$(INSTALLTOP)/bin \ +diff -urN openssl-0.9.8b/Makefile.org openssl-0.9.8b.new/Makefile.org +--- openssl-0.9.8b/Makefile.org 2006-09-01 19:34:51.000000000 +0200 ++++ openssl-0.9.8b.new/Makefile.org 2006-09-01 19:36:38.000000000 +0200 +@@ -473,7 +473,7 @@ + dist_pem_h: + (cd crypto/pem; $(MAKE) -e $(BUILDENV) pem.h; $(MAKE) clean) + +-install: all install_docs install_sw ++install: all install_sw + + install_sw: + @$(PERL) $(TOP)/util/mkdir-p.pl $(INSTALL_PREFIX)$(INSTALLTOP)/bin \ diff --git a/package/openswan/Makefile b/package/openswan/Makefile new file mode 100644 index 0000000000..54b565efdd --- /dev/null +++ b/package/openswan/Makefile @@ -0,0 +1,94 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=openswan +PKG_VERSION:=2.4.6 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://www.openswan.org/download +PKG_MD5SUM:=b34d71ca49dedad017879b0e912d40dd +PKG_CAT:=zcat + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install + +PKG_INIT_PRIO:=60 + +include $(INCLUDE_DIR)/package.mk + +define Package/openswan/Default + TITLE:=Openswan + DESCRIPTION:=\ + Openswan is an IPsec implementation for Linux. + URL:=http://www.openswan.org/ +endef + +define Package/openswan + $(call Package/openswan/Default) + SECTION:=net + CATEGORY:=Network + DEPENDS:=+kmod-openswan +libgmp + TITLE+= (daemon) + DESCRIPTION+=\\\ + \\\ + This package contains the Openswan user-land daemon. + URL:=http://www.openswan.org/ +endef + +define Package/kmod-openswan + $(call Package/openswan/Default) + SECTION:=kernel + CATEGORY:=Kernel drivers + TITLE+= (kernel module) + DESCRIPTION+=\\\ + \\\ + This package contains the Openswan kernel module. + VERSION:=$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE) +endef + +PKG_MAKE_OPTS:= \ + LINUX_RELEASE="$(LINUX_RELEASE)" \ + KERNELSRC="$(LINUX_DIR)" \ + ARCH="$(LINUX_KARCH)" \ + CROSS_COMPILE="$(TARGET_CROSS)" \ + USERCOMPILE="$(TARGET_CFLAGS) -I./linux/include -I$(STAGING_DIR)/usr/include -L$(STAGING_DIR)/usr/lib" \ + IPSECDIR="/usr/lib/ipsec" \ + INC_USRLOCAL="/usr" \ + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + $(TARGET_CONFIGURE_OPTS) \ + $(PKG_MAKE_OPTS) \ + LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + programs module install +endef + +define Package/openswan/install + $(CP) $(PKG_INSTALL_DIR)/* $(1) + install -d -m0755 $(1)/etc/init.d + $(CP) $(1)/etc/rc.d/init.d/ipsec $(1)/etc/init.d/S$(PKG_INIT_PRIO)ipsec + rm -rf $(1)/usr/share + rm -rf $(1)/usr/man + rm -rf $(1)/var + rm -rf $(1)/etc/rc.d + find $(1) -name \*.old | xargs rm -rf +endef + +define Package/kmod-openswan/install + mkdir -p $(1)/lib/modules/$(LINUX_VERSION) + $(CP) $(PKG_BUILD_DIR)/modobj*/ipsec.$(LINUX_KMOD_SUFFIX) \ + $(1)/lib/modules/$(LINUX_VERSION)/ +endef + +$(eval $(call BuildPackage,openswan)) +$(eval $(call BuildPackage,kmod-openswan)) diff --git a/package/openswan/patches/100-pluto_includes.patch b/package/openswan/patches/100-pluto_includes.patch new file mode 100644 index 0000000000..8cd1398d4a --- /dev/null +++ b/package/openswan/patches/100-pluto_includes.patch @@ -0,0 +1,12 @@ +diff -Nur openswan-2.4.0.orig/programs/pluto/Makefile openswan-2.4.0/programs/pluto/Makefile +--- openswan-2.4.0.orig/programs/pluto/Makefile 2005-08-12 03:12:38.000000000 +0200 ++++ openswan-2.4.0/programs/pluto/Makefile 2005-09-29 13:41:14.016377750 +0200 +@@ -271,7 +271,7 @@ + LIBSPLUTO+=$(HAVE_THREADS_LIBS) ${XAUTHPAM_LIBS} + LIBSPLUTO+=${CURL_LIBS} + LIBSPLUTO+=${EXTRA_CRYPTO_LIBS} +-LIBSPLUTO+= -lgmp -lresolv # -lefence ++LIBSPLUTO+=$(EXTRA_LIBS) -lgmp -lresolv # -lefence + + ifneq ($(LD_LIBRARY_PATH),) + LDFLAGS=-L$(LD_LIBRARY_PATH) diff --git a/package/openswan/patches/110-scripts.patch b/package/openswan/patches/110-scripts.patch new file mode 100644 index 0000000000..ed8eba92cf --- /dev/null +++ b/package/openswan/patches/110-scripts.patch @@ -0,0 +1,243 @@ +diff -urN openswan.old/programs/loggerfix openswan.dev/programs/loggerfix +--- openswan.old/programs/loggerfix 1970-01-01 01:00:00.000000000 +0100 ++++ openswan.dev/programs/loggerfix 2006-10-08 20:41:08.000000000 +0200 +@@ -0,0 +1,5 @@ ++#!/bin/sh ++# use filename instead of /dev/null to log, but dont log to flash or ram ++# pref. log to nfs mount ++echo "$*" >> /dev/null ++exit 0 +diff -urN openswan.old/programs/look/look.in openswan.dev/programs/look/look.in +--- openswan.old/programs/look/look.in 2006-10-08 20:43:21.000000000 +0200 ++++ openswan.dev/programs/look/look.in 2006-10-08 20:41:08.000000000 +0200 +@@ -84,7 +84,7 @@ + then + pat="$pat|$defaultroutephys\$|$defaultroutevirt\$" + else +- for i in `echo "$IPSECinterfaces" | sed 's/=/ /'` ++ for i in `echo "$IPSECinterfaces" | tr '=' ' '` + do + pat="$pat|$i\$" + done +diff -urN openswan.old/programs/_plutorun/_plutorun.in openswan.dev/programs/_plutorun/_plutorun.in +--- openswan.old/programs/_plutorun/_plutorun.in 2006-10-08 20:43:21.000000000 +0200 ++++ openswan.dev/programs/_plutorun/_plutorun.in 2006-10-08 20:41:08.000000000 +0200 +@@ -147,7 +147,7 @@ + exit 1 + fi + else +- if test ! -w "`dirname $stderrlog`" ++ if test ! -w "`echo $stderrlog | sed -r 's/(^.*\/)(.*$)/\1/'`" + then + echo Cannot write to directory to create \"$stderrlog\". + exit 1 +diff -urN openswan.old/programs/_realsetup/_realsetup.in openswan.dev/programs/_realsetup/_realsetup.in +--- openswan.old/programs/_realsetup/_realsetup.in 2006-10-08 20:43:21.000000000 +0200 ++++ openswan.dev/programs/_realsetup/_realsetup.in 2006-10-08 20:41:08.000000000 +0200 +@@ -232,7 +232,7 @@ + + # misc pre-Pluto setup + +- perform test -d `dirname $subsyslock` "&&" touch $subsyslock ++ perform test -d `echo $subsyslock | sed -r 's/(^.*\/)(.*$)/\1/'` "&&" touch $subsyslock "&&" rm -f $subsyslock + + if test " $IPSECforwardcontrol" = " yes" + then +diff -urN openswan.old/programs/send-pr/send-pr.in openswan.dev/programs/send-pr/send-pr.in +--- openswan.old/programs/send-pr/send-pr.in 2006-10-08 20:43:21.000000000 +0200 ++++ openswan.dev/programs/send-pr/send-pr.in 2006-10-08 20:41:08.000000000 +0200 +@@ -402,7 +402,7 @@ + else + if [ "$fieldname" != "Category" ] + then +- values=`${BINDIR}/query-pr --valid-values $fieldname | sed ':a;N;$!ba;s/\n/ /g' | sed 's/ *$//g;s/ / | /g;s/^/[ /;s/$/ ]/;'` ++ values=`${BINDIR}/query-pr --valid-values $fieldname | tr '\n' ' ' | sed 's/ *$//g;s/ / | /g;s/^/[ /;s/$/ ]/;'` + valslen=`echo "$values" | wc -c` + else + values="choose from a category listed above" +@@ -414,7 +414,7 @@ + else + desc="<${values} (one line)>"; + fi +- dpat=`echo "$desc" | sed 's/[][*+^$|\()&/]/./g'` ++ dpat=`echo "$desc" | tr '\]\[*+^$|\()&/' '............'` + echo "/^>${fieldname}:/ s/${dpat}//" >> $FIXFIL + fi + echo "${fmtname}${desc}" >> $file +@@ -425,7 +425,7 @@ + desc=" $default_val"; + else + desc=" <`${BINDIR}/query-pr --field-description $fieldname` (multiple lines)>"; +- dpat=`echo "$desc" | sed 's/[][*+^$|\()&/]/./g'` ++ dpat=`echo "$desc" | tr '\]\[*+^$|\()&/' '............'` + echo "s/^${dpat}//" >> $FIXFIL + fi + echo "${fmtname}" >> $file; +@@ -437,7 +437,7 @@ + desc="${default_val}" + else + desc="<`${BINDIR}/query-pr --field-description $fieldname` (one line)>" +- dpat=`echo "$desc" | sed 's/[][*+^$|\()&/]/./g'` ++ dpat=`echo "$desc" | tr '\]\[*+^$|\()&/' '............'` + echo "/^>${fieldname}:/ s/${dpat}//" >> $FIXFIL + fi + echo "${fmtname}${desc}" >> $file +diff -urN openswan.old/programs/setup/setup.in openswan.dev/programs/setup/setup.in +--- openswan.old/programs/setup/setup.in 2006-10-08 20:43:21.000000000 +0200 ++++ openswan.dev/programs/setup/setup.in 2006-10-08 20:41:08.000000000 +0200 +@@ -117,12 +117,21 @@ + # do it + case "$1" in + start|--start|stop|--stop|_autostop|_autostart) +- if test " `id -u`" != " 0" ++ if [ "x${USER}" != "xroot" ] + then + echo "permission denied (must be superuser)" | + logger -s -p $IPSECsyslog -t ipsec_setup 2>&1 + exit 1 + fi ++ # make sure all required directories exist ++ if [ ! -d /var/run/pluto ] ++ then ++ mkdir -p /var/run/pluto ++ fi ++ if [ ! -d /var/lock/subsys ] ++ then ++ mkdir -p /var/lock/subsys ++ fi + tmp=/var/run/pluto/ipsec_setup.st + outtmp=/var/run/pluto/ipsec_setup.out + ( +diff -urN openswan.old/programs/showhostkey/showhostkey.in openswan.dev/programs/showhostkey/showhostkey.in +--- openswan.old/programs/showhostkey/showhostkey.in 2006-10-08 20:43:21.000000000 +0200 ++++ openswan.dev/programs/showhostkey/showhostkey.in 2006-10-08 20:41:08.000000000 +0200 +@@ -63,7 +63,7 @@ + exit 1 + fi + +-host="`hostname --fqdn`" ++host="`cat /proc/sys/kernel/hostname`" + + awk ' BEGIN { + inkey = 0 +@@ -81,7 +81,7 @@ + os = "[ \t]*" + x = "[^ \t]+" + oc = "(#.*)?" +- suffix = ":" os "[rR][sS][aA]" os "{" os oc "$" ++ suffix = ":" os "[rR][sS][aA]" os "\0173" os oc "$" + if (id == "") { + pat = "^" suffix + printid = "default" +diff -urN openswan.old/programs/starter/klips.c openswan.dev/programs/starter/klips.c +--- openswan.old/programs/starter/klips.c 2006-10-08 20:43:21.000000000 +0200 ++++ openswan.dev/programs/starter/klips.c 2006-10-08 20:41:08.000000000 +0200 +@@ -83,7 +83,7 @@ + if (stat(PROC_MODULES,&stb)==0) { + unsetenv("MODPATH"); + unsetenv("MODULECONF"); +- system("depmod -a >/dev/null 2>&1 && modprobe ipsec"); ++ system("depmod -a >/dev/null 2>&1 && insmod ipsec"); + } + if (stat(PROC_IPSECVERSION,&stb)==0) { + _klips_module_loaded = 1; +diff -urN openswan.old/programs/starter/netkey.c openswan.dev/programs/starter/netkey.c +--- openswan.old/programs/starter/netkey.c 2006-10-08 20:43:21.000000000 +0200 ++++ openswan.dev/programs/starter/netkey.c 2006-10-08 20:41:08.000000000 +0200 +@@ -75,7 +75,7 @@ + if (stat(PROC_MODULES,&stb)==0) { + unsetenv("MODPATH"); + unsetenv("MODULECONF"); +- system("depmod -a >/dev/null 2>&1 && modprobe xfrm4_tunnel esp4 ah4 af_key"); ++ system("depmod -a >/dev/null 2>&1 && insmod xfrm4_tunnel esp4 ah4 af_key"); + } + if (stat(PROC_NETKEY,&stb)==0) { + _netkey_module_loaded = 1; +diff -urN openswan.old/programs/_startklips/_startklips.in openswan.dev/programs/_startklips/_startklips.in +--- openswan.old/programs/_startklips/_startklips.in 2006-10-08 20:43:21.000000000 +0200 ++++ openswan.dev/programs/_startklips/_startklips.in 2006-10-08 20:41:46.000000000 +0200 +@@ -242,7 +242,7 @@ + fi + if test -f $moduleinstplace/$wantgoo + then +- echo "modprobe failed, but found matching template module $wantgoo." ++ echo "insmod failed, but found matching template module $wantgoo." + echo "Copying $moduleinstplace/$wantgoo to $module." + rm -f $module + mkdir -p $moduleplace +@@ -262,15 +262,15 @@ + echo "FATAL ERROR: Both KLIPS and NETKEY IPsec code is present in kernel" + exit + fi +-if test ! -f $ipsecversion && test ! -f $netkey && modprobe -qn ipsec ++if test ! -f $ipsecversion && test ! -f $netkey && insmod -q ipsec + then + # statically compiled KLIPS/NETKEY not found; try to load the module +- modprobe ipsec ++ insmod ipsec + fi + + if test ! -f $ipsecversion && test ! -f $netkey + then +- modprobe -v af_key ++ insmod -v af_key + fi + + if test -f $netkey +@@ -278,25 +278,25 @@ + klips=false + if test -f $modules + then +- modprobe -qv ah4 +- modprobe -qv esp4 +- modprobe -qv ipcomp ++ insmod -qv ah4 ++ insmod -qv esp4 ++ insmod -qv ipcomp + # xfrm4_tunnel is needed by ipip and ipcomp +- modprobe -qv xfrm4_tunnel ++ insmod -qv xfrm4_tunnel + # xfrm_user contains netlink support for IPsec +- modprobe -qv xfrm_user ++ insmod -qv xfrm_user + if [ -n "`cat /proc/cpuinfo |grep Nehemiah`" ] + then + echo "VIA Nehemiah detected, probing for PadLock" +- modprobe -qv hw_random ++ insmod -qv hw_random + # padlock must load before aes module +- modprobe -qv padlock ++ insmod -qv padlock + fi + # load the most common ciphers/algo's +- modprobe -qv sha1 +- modprobe -qv md5 +- modprobe -qv des +- modprobe -qv aes ++ insmod -qv sha1 ++ insmod -qv md5 ++ insmod -qv des ++ insmod -qv aes + fi + fi + +@@ -312,10 +312,16 @@ + fi + unset MODPATH MODULECONF # no user overrides! + depmod -a >/dev/null 2>&1 +- modprobe -qv hw_random ++ insmod -qv hw_random + # padlock must load before aes module +- modprobe -qv padlock +- modprobe -v ipsec ++ insmod -qv padlock ++ if [ -f insmod ] ++ then ++ insmod -v ipsec ++ elif [ -f insmod ] ++ then ++ insmod ipsec ++ fi + fi + if test ! -f $ipsecversion + then diff --git a/package/openswan/patches/120-use_dev_urandom.patch b/package/openswan/patches/120-use_dev_urandom.patch new file mode 100644 index 0000000000..1a19884584 --- /dev/null +++ b/package/openswan/patches/120-use_dev_urandom.patch @@ -0,0 +1,36 @@ +diff -urN openswan-2.3.1dr6.old/programs/ranbits/ranbits.c openswan-2.3.1dr6.dev/programs/ranbits/ranbits.c +--- openswan-2.3.1dr6.old/programs/ranbits/ranbits.c 2004-04-04 03:50:56.000000000 +0200 ++++ openswan-2.3.1dr6.dev/programs/ranbits/ranbits.c 2005-04-05 17:37:16.000000000 +0200 +@@ -29,7 +29,7 @@ + #include <openswan.h> + + #ifndef DEVICE +-#define DEVICE "/dev/random" ++#define DEVICE "/dev/urandom" + #endif + #ifndef QDEVICE + #define QDEVICE "/dev/urandom" +diff -urN openswan-2.3.1dr6.old/programs/rsasigkey/rsasigkey.c openswan-2.3.1dr6.dev/programs/rsasigkey/rsasigkey.c +--- openswan-2.3.1dr6.old/programs/rsasigkey/rsasigkey.c 2004-05-23 23:32:03.000000000 +0200 ++++ openswan-2.3.1dr6.dev/programs/rsasigkey/rsasigkey.c 2005-04-05 17:38:00.000000000 +0200 +@@ -31,7 +31,7 @@ + #include <gmp.h> + + #ifndef DEVICE +-#define DEVICE "/dev/random" ++#define DEVICE "/dev/urandom" + #endif + #ifndef MAXBITS + #define MAXBITS 20000 +diff -urN openswan-2.3.1dr6.old/programs/starter/files.h openswan-2.3.1dr6.dev/programs/starter/files.h +--- openswan-2.3.1dr6.old/programs/starter/files.h 2005-01-11 18:52:51.000000000 +0100 ++++ openswan-2.3.1dr6.dev/programs/starter/files.h 2005-04-05 17:38:16.000000000 +0200 +@@ -36,7 +36,7 @@ + + #define MY_PID_FILE "/var/run/pluto/ipsec-starter.pid" + +-#define DEV_RANDOM "/dev/random" ++#define DEV_RANDOM "/dev/urandom" + #define DEV_URANDOM "/dev/urandom" + + #define PROC_IPSECVERSION "/proc/net/ipsec_version" diff --git a/package/pcmcia-cs/Makefile b/package/pcmcia-cs/Makefile new file mode 100644 index 0000000000..78419de75d --- /dev/null +++ b/package/pcmcia-cs/Makefile @@ -0,0 +1,68 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=pcmcia-cs +PKG_VERSION:=3.2.8 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/$(PKG_NAME) +PKG_MD5SUM:=0d6d65be8896eff081aee996049afaa5 +PKG_CAT:=zcat + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install + +include $(INCLUDE_DIR)/package.mk + +define Package/pcmcia-cs + SECTION:=utils + CATEGORY:=Utilities + DEPENDS:=@PCMCIA_SUPPORT + TITLE:=PCMCIA/Cardbus management utilities + URL:=http://pcmcia-cs.sourceforge.net/ +endef + +define Build/Configure + ( cd $(PKG_BUILD_DIR); \ + ./Configure \ + --noprompt \ + --kernel="$(LINUX_DIR)" \ + --target="$(PKG_INSTALL_DIR)" \ + --arch="$(ARCH)" \ + --ucc="$(TARGET_CC)" \ + --uflags="$(TARGET_CFLAGS)" \ + --srctree \ + --cardbus \ + --noapm \ + --nopnp \ + --notrust \ + --nox11 \ + --rcdir="/etc" \ + --sysv \ + ) +endef + +define Build/Compile + $(call Build/Compile/Default, \ + CFLAGS="$(TARGET_CFLAGS)" \ + all install \ + ) +endef + +define Package/pcmcia-cs/install + install -d -m0755 $(1)/etc + $(CP) $(PKG_INSTALL_DIR)/etc/pcmcia $(1)/etc/ + install -d -m0755 $(1)/usr/sbin + $(CP) $(PKG_INSTALL_DIR)/sbin/cardctl $(1)/usr/sbin/ + $(CP) $(PKG_INSTALL_DIR)/sbin/cardmgr $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,pcmcia-cs)) diff --git a/package/pcmcia-cs/patches/001-config-novatel_merlin_u630.patch b/package/pcmcia-cs/patches/001-config-novatel_merlin_u630.patch new file mode 100644 index 0000000000..071a697298 --- /dev/null +++ b/package/pcmcia-cs/patches/001-config-novatel_merlin_u630.patch @@ -0,0 +1,14 @@ +diff -ruN pcmcia-cs-3.2.8-old/etc/config pcmcia-cs-3.2.8-new/etc/config +--- pcmcia-cs-3.2.8-old/etc/config 2004-07-16 18:38:25.000000000 +0200 ++++ pcmcia-cs-3.2.8-new/etc/config 2005-11-21 08:52:54.000000000 +0100 +@@ -2413,6 +2413,10 @@ + pci 0x115d, 0x0101 + bind "serial_cb" + ++card "Novatel Wireless - Merlin U630 UMTS Modem" ++ manfid 0x00a4, 0x0276 ++ bind "serial_cs" to 0, "serial_cs" to 1 ++ + # Include configuration files for add-on drivers + + source ./*.conf diff --git a/package/ppp/Makefile b/package/ppp/Makefile new file mode 100644 index 0000000000..b5a317bd03 --- /dev/null +++ b/package/ppp/Makefile @@ -0,0 +1,182 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=ppp +PKG_VERSION:=2.4.3 +PKG_RELEASE:=7 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=ftp://ftp.samba.org/pub/ppp/ +PKG_MD5SUM:=848f6c3cafeb6074ffeb293c3af79b7c +PKG_CAT:=zcat + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install + +PKG_BUILDDEP:=libpcap linux-atm + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/kernel.mk + +define Package/ppp/Default + SECTION:=net + CATEGORY:=Network + URL:=http://ppp.samba.org/ +endef + +define Package/ppp + $(call Package/ppp/Default) + DEFAULT:=y + DEPENDS:=+kmod-ppp + TITLE:=PPP daemon + DESCRIPTION:=\ + This package contains the PPP (Point-to-Point Protocol) daemon. + MENU:=1 +endef + +define Package/ppp-mod-pppoa + $(call Package/ppp/Default) + DEPENDS:=ppp +linux-atm +kmod-pppoa + TITLE:=PPPoA plugin + DESCRIPTION:=\ + This package contains a PPPoA (PPP over ATM) plugin for ppp. +endef + +define Package/ppp-mod-pppoe + $(call Package/ppp/Default) + DEFAULT:=y + DEPENDS:=ppp +kmod-pppoe + TITLE:=PPPoE plugin + DESCRIPTION:=\ + This package contains a PPPoE (PPP over Ethernet) plugin for ppp. +endef + +define Package/ppp-mod-radius + $(call Package/ppp/Default) + DEPENDS:=ppp + TITLE:=RADIUS plugin + DESCRIPTION:=\ + This package contains a RADIUS (Remote Authentication Dial-In User \\\ + Service) plugin for ppp. +endef + +define Package/chat + $(call Package/ppp/Default) + DEPENDS:=ppp + TITLE:=Establish conversation with a modem + DESCRIPTION:=\ + This package contains an utility to establish conversation with other \\\ + PPP servers (via a modem). +endef + +define Package/pppdump + $(call Package/ppp/Default) + DEPENDS:=ppp + TITLE:=Read PPP record file + DESCRIPTION:=\ + This package contains an utility to read PPP record file. +endef + +define Package/pppstats + $(call Package/ppp/Default) + DEPENDS:=ppp + TITLE:=Report PPP statistics + DESCRIPTION:=\ + This package contains an utility to report PPP statistics. +endef + +define Build/Configure +$(call Build/Configure/Default,, \ + UNAME_S="Linux" \ + UNAME_R="$(LINUX_VERSION)" \ + UNAME_M="$(ARCH)" \ +) +endef + +define Build/Compile + rm -rf $(PKG_INSTALL_DIR) + mkdir -p $(PKG_INSTALL_DIR)/usr + $(MAKE) -C $(PKG_BUILD_DIR) \ + $(TARGET_CONFIGURE_OPTS) \ + COPTS="$(TARGET_CFLAGS)" \ + PRECOMPILED_FILTER=1 \ + STAGING_DIR="$(STAGING_DIR)" \ + DESTDIR="$(PKG_INSTALL_DIR)/usr" \ + all install +endef + +define Package/ppp/install + install -d -m0755 $(1)/usr/lib/pppd/$(PKG_VERSION) + install -d -m0755 $(1)/usr/sbin + install -m0755 $(PKG_INSTALL_DIR)/usr/sbin/pppd $(1)/usr/sbin/ + install -d -m0755 $(1)/lib/network + install -m0755 ./files/ppp.sh $(1)/lib/network/ + install -d -m0755 $(1)/etc/ppp + install -m0600 ./files/etc/ppp/chap-secrets $(1)/etc/ppp/ + install -m0644 ./files/etc/ppp/filter $(1)/etc/ppp/ + install -m0755 ./files/etc/ppp/ip-up $(1)/etc/ppp/ + install -d -m0755 $(1)/etc/ppp/ip-up.d + install -m0755 ./files/etc/ppp/ip-down $(1)/etc/ppp/ + install -d -m0755 $(1)/etc/ppp/ip-down.d + install -m0644 ./files/etc/ppp/options $(1)/etc/ppp/ + ln -sf /tmp/resolv.conf $(1)/etc/ppp/resolv.conf +endef + +define Package/ppp-mod-pppoa/install + install -d -m0755 $(1)/usr/lib/pppd/$(PKG_VERSION) + install -m0755 $(PKG_INSTALL_DIR)/usr/lib/pppd/$(PKG_VERSION)/pppoatm.so \ + $(1)/usr/lib/pppd/$(PKG_VERSION)/ + install -d -m0755 $(1)/lib/network + install -m0755 ./files/pppoa.sh $(1)/lib/network/ +endef + +define Package/ppp-mod-pppoe/install + install -d -m0755 $(1)/usr/lib/pppd/$(PKG_VERSION) + install -m0755 $(PKG_INSTALL_DIR)/usr/lib/pppd/$(PKG_VERSION)/rp-pppoe.so \ + $(1)/usr/lib/pppd/$(PKG_VERSION)/ + install -d -m0755 $(1)/lib/network + install -m0755 ./files/pppoe.sh $(1)/lib/network/ +endef + +define Package/ppp-mod-radius/install + install -d -m0755 $(1)/usr/lib/pppd/$(PKG_VERSION) + install -m0755 $(PKG_INSTALL_DIR)/usr/lib/pppd/$(PKG_VERSION)/radius.so \ + $(1)/usr/lib/pppd/$(PKG_VERSION)/ + install -d -m0755 $(1)/etc/ppp + install -m0644 ./files/etc/ppp/radius.conf $(1)/etc/ppp/ + install -d -m0755 $(1)/etc/ppp/radius + install -m0644 ./files/etc/ppp/radius/dictionary* \ + $(1)/etc/ppp/radius/ + install -m0600 ./files/etc/ppp/radius/servers \ + $(1)/etc/ppp/radius/ +endef + +define Package/chat/install + install -d -m0755 $(1)/usr/sbin + install -m0755 $(PKG_INSTALL_DIR)/usr/sbin/chat $(1)/usr/sbin/ +endef + +define Package/pppdump/install + install -d -m0755 $(1)/usr/sbin + install -m0755 $(PKG_INSTALL_DIR)/usr/sbin/pppdump $(1)/usr/sbin/ +endef + +define Package/pppstats/install + install -d -m0755 $(1)/usr/sbin + install -m0755 $(PKG_INSTALL_DIR)/usr/sbin/pppstats $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,ppp)) +$(eval $(call BuildPackage,ppp-mod-pppoa)) +$(eval $(call BuildPackage,ppp-mod-pppoe)) +$(eval $(call BuildPackage,ppp-mod-radius)) +$(eval $(call BuildPackage,chat)) +$(eval $(call BuildPackage,pppdump)) +$(eval $(call BuildPackage,pppstats)) diff --git a/package/ppp/files/etc/ppp/chap-secrets b/package/ppp/files/etc/ppp/chap-secrets new file mode 100644 index 0000000000..6ab76e49e9 --- /dev/null +++ b/package/ppp/files/etc/ppp/chap-secrets @@ -0,0 +1 @@ +#USERNAME PROVIDER PASSWORD IPADDRESS diff --git a/package/ppp/files/etc/ppp/filter b/package/ppp/files/etc/ppp/filter new file mode 100644 index 0000000000..ec72a81a01 --- /dev/null +++ b/package/ppp/files/etc/ppp/filter @@ -0,0 +1,23 @@ +# +# Expression: outbound and not icmp[0] != 8 and not tcp[13] & 4 != 0 +# +19 +48 0 0 0 +21 0 16 1 +40 0 0 2 +21 0 13 33 +48 0 0 13 +21 0 5 1 +40 0 0 10 +69 9 0 8191 +177 0 0 4 +80 0 0 4 +21 6 7 8 +21 0 5 6 +40 0 0 10 +69 3 0 8191 +177 0 0 4 +80 0 0 17 +69 1 0 4 +6 0 0 4 +6 0 0 0 diff --git a/package/ppp/files/etc/ppp/ip-down b/package/ppp/files/etc/ppp/ip-down new file mode 100755 index 0000000000..334bcb885a --- /dev/null +++ b/package/ppp/files/etc/ppp/ip-down @@ -0,0 +1,9 @@ +#!/bin/sh +[ -z "$6" ] || env -i ACTION="ifdown" INTERFACE="$6" PROTO=ppp /sbin/hotplug "iface" + +[ -d /etc/ppp/ip-down.d ] && { + for SCRIPT in /etc/ppp/ip-down.d/* + do + [ -x "$SCRIPT" ] && "$SCRIPT" $@ + done +} diff --git a/package/ppp/files/etc/ppp/ip-up b/package/ppp/files/etc/ppp/ip-up new file mode 100755 index 0000000000..34b4b50e15 --- /dev/null +++ b/package/ppp/files/etc/ppp/ip-up @@ -0,0 +1,9 @@ +#!/bin/sh +[ -z "$6" ] || env -i ACTION="ifup" INTERFACE="$6" PROTO=ppp /sbin/hotplug "iface" + +[ -d /etc/ppp/ip-up.d ] && { + for SCRIPT in /etc/ppp/ip-up.d/* + do + [ -x "$SCRIPT" ] && "$SCRIPT" $@ + done +} diff --git a/package/ppp/files/etc/ppp/options b/package/ppp/files/etc/ppp/options new file mode 100644 index 0000000000..d74de79306 --- /dev/null +++ b/package/ppp/files/etc/ppp/options @@ -0,0 +1,6 @@ +#debug +noaccomp +nopcomp +nocrtscts +lock +maxfail 0 diff --git a/package/ppp/files/etc/ppp/radius.conf b/package/ppp/files/etc/ppp/radius.conf new file mode 100644 index 0000000000..0f24a8c7f7 --- /dev/null +++ b/package/ppp/files/etc/ppp/radius.conf @@ -0,0 +1,8 @@ +authserver localhost:1812 +acctserver localhost:1813 +dictionary /etc/ppp/radius/dictionary +servers /etc/ppp/radius/servers +mapfile /dev/null +seqfile /tmp/radius.seq +radius_timeout 5 +radius_retries 3 diff --git a/package/ppp/files/etc/ppp/radius/dictionary b/package/ppp/files/etc/ppp/radius/dictionary new file mode 100644 index 0000000000..706d1ce99c --- /dev/null +++ b/package/ppp/files/etc/ppp/radius/dictionary @@ -0,0 +1,253 @@ +# +# Updated 97/06/13 to livingston-radius-2.01 miquels@cistron.nl +# +# This file contains dictionary translations for parsing +# requests and generating responses. All transactions are +# composed of Attribute/Value Pairs. The value of each attribute +# is specified as one of 4 data types. Valid data types are: +# +# string - 0-253 octets +# ipaddr - 4 octets in network byte order +# integer - 32 bit value in big endian order (high byte first) +# date - 32 bit value in big endian order - seconds since +# 00:00:00 GMT, Jan. 1, 1970 +# +# Enumerated values are stored in the user file with dictionary +# VALUE translations for easy administration. +# +# Example: +# +# ATTRIBUTE VALUE +# --------------- ----- +# Framed-Protocol = PPP +# 7 = 1 (integer encoding) +# + +# The dictionary format now supports vendor-specific attributes. +# Vendors are introduced like this: +# +# VENDOR vendor_name vendor_number +# +# For example: +# +# VENDOR RoaringPenguin 10055 +# +# Vendor-specific attributes have a fifth field with the name of the +# vendor. For example: +# +# ATTRIBUTE RP-Upstream-Speed-Limit 1 integer RoaringPenguin +# +# introduces a Roaring Penguin vendor-specific attribbute with name +# RP-Upstream-Speed-Limit, number 1, type integer and vendor RoaringPenguin. + +# +# Following are the proper new names. Use these. +# +ATTRIBUTE User-Name 1 string +ATTRIBUTE Password 2 string +ATTRIBUTE CHAP-Password 3 string +ATTRIBUTE NAS-IP-Address 4 ipaddr +ATTRIBUTE NAS-Port-Id 5 integer +ATTRIBUTE Service-Type 6 integer +ATTRIBUTE Framed-Protocol 7 integer +ATTRIBUTE Framed-IP-Address 8 ipaddr +ATTRIBUTE Framed-IP-Netmask 9 ipaddr +ATTRIBUTE Framed-Routing 10 integer +ATTRIBUTE Filter-Id 11 string +ATTRIBUTE Framed-MTU 12 integer +ATTRIBUTE Framed-Compression 13 integer +ATTRIBUTE Login-IP-Host 14 ipaddr +ATTRIBUTE Login-Service 15 integer +ATTRIBUTE Login-TCP-Port 16 integer +ATTRIBUTE Reply-Message 18 string +ATTRIBUTE Callback-Number 19 string +ATTRIBUTE Callback-Id 20 string +ATTRIBUTE Framed-Route 22 string +ATTRIBUTE Framed-IPX-Network 23 ipaddr +ATTRIBUTE State 24 string +ATTRIBUTE Class 25 string +ATTRIBUTE Session-Timeout 27 integer +ATTRIBUTE Idle-Timeout 28 integer +ATTRIBUTE Termination-Action 29 integer +ATTRIBUTE Called-Station-Id 30 string +ATTRIBUTE Calling-Station-Id 31 string +ATTRIBUTE NAS-Identifier 32 string +ATTRIBUTE Acct-Status-Type 40 integer +ATTRIBUTE Acct-Delay-Time 41 integer +ATTRIBUTE Acct-Input-Octets 42 integer +ATTRIBUTE Acct-Output-Octets 43 integer +ATTRIBUTE Acct-Session-Id 44 string +ATTRIBUTE Acct-Authentic 45 integer +ATTRIBUTE Acct-Session-Time 46 integer +ATTRIBUTE Acct-Input-Packets 47 integer +ATTRIBUTE Acct-Output-Packets 48 integer +ATTRIBUTE Acct-Terminate-Cause 49 integer +ATTRIBUTE Chap-Challenge 60 string +ATTRIBUTE NAS-Port-Type 61 integer +ATTRIBUTE Port-Limit 62 integer +ATTRIBUTE Connect-Info 77 string + +# RFC 2869 +ATTRIBUTE Acct-Interim-Interval 85 integer + +# +# Experimental Non Protocol Attributes used by Cistron-Radiusd +# +ATTRIBUTE Huntgroup-Name 221 string +ATTRIBUTE User-Category 1029 string +ATTRIBUTE Group-Name 1030 string +ATTRIBUTE Simultaneous-Use 1034 integer +ATTRIBUTE Strip-User-Name 1035 integer +ATTRIBUTE Fall-Through 1036 integer +ATTRIBUTE Add-Port-To-IP-Address 1037 integer +ATTRIBUTE Exec-Program 1038 string +ATTRIBUTE Exec-Program-Wait 1039 string +ATTRIBUTE Hint 1040 string + +# +# Non-Protocol Attributes +# These attributes are used internally by the server +# +ATTRIBUTE Expiration 21 date +ATTRIBUTE Auth-Type 1000 integer +ATTRIBUTE Menu 1001 string +ATTRIBUTE Termination-Menu 1002 string +ATTRIBUTE Prefix 1003 string +ATTRIBUTE Suffix 1004 string +ATTRIBUTE Group 1005 string +ATTRIBUTE Crypt-Password 1006 string +ATTRIBUTE Connect-Rate 1007 integer + +# +# Experimental, implementation specific attributes +# +# Limit session traffic +ATTRIBUTE Session-Octets-Limit 227 integer +# What to assume as limit - 0 in+out, 1 in, 2 out, 3 max(in,out) +ATTRIBUTE Octets-Direction 228 integer + +# +# Integer Translations +# + +# User Types + +VALUE Service-Type Login-User 1 +VALUE Service-Type Framed-User 2 +VALUE Service-Type Callback-Login-User 3 +VALUE Service-Type Callback-Framed-User 4 +VALUE Service-Type Outbound-User 5 +VALUE Service-Type Administrative-User 6 +VALUE Service-Type NAS-Prompt-User 7 + +# Framed Protocols + +VALUE Framed-Protocol PPP 1 +VALUE Framed-Protocol SLIP 2 + +# Framed Routing Values + +VALUE Framed-Routing None 0 +VALUE Framed-Routing Broadcast 1 +VALUE Framed-Routing Listen 2 +VALUE Framed-Routing Broadcast-Listen 3 + +# Framed Compression Types + +VALUE Framed-Compression None 0 +VALUE Framed-Compression Van-Jacobson-TCP-IP 1 + +# Login Services + +VALUE Login-Service Telnet 0 +VALUE Login-Service Rlogin 1 +VALUE Login-Service TCP-Clear 2 +VALUE Login-Service PortMaster 3 + +# Status Types + +VALUE Acct-Status-Type Start 1 +VALUE Acct-Status-Type Stop 2 +VALUE Acct-Status-Type Accounting-On 7 +VALUE Acct-Status-Type Accounting-Off 8 + +# Authentication Types + +VALUE Acct-Authentic RADIUS 1 +VALUE Acct-Authentic Local 2 +VALUE Acct-Authentic PowerLink128 100 + +# Termination Options + +VALUE Termination-Action Default 0 +VALUE Termination-Action RADIUS-Request 1 + +# NAS Port Types, available in 3.3.1 and later + +VALUE NAS-Port-Type Async 0 +VALUE NAS-Port-Type Sync 1 +VALUE NAS-Port-Type ISDN 2 +VALUE NAS-Port-Type ISDN-V120 3 +VALUE NAS-Port-Type ISDN-V110 4 + +# Acct Terminate Causes, available in 3.3.2 and later + +VALUE Acct-Terminate-Cause User-Request 1 +VALUE Acct-Terminate-Cause Lost-Carrier 2 +VALUE Acct-Terminate-Cause Lost-Service 3 +VALUE Acct-Terminate-Cause Idle-Timeout 4 +VALUE Acct-Terminate-Cause Session-Timeout 5 +VALUE Acct-Terminate-Cause Admin-Reset 6 +VALUE Acct-Terminate-Cause Admin-Reboot 7 +VALUE Acct-Terminate-Cause Port-Error 8 +VALUE Acct-Terminate-Cause NAS-Error 9 +VALUE Acct-Terminate-Cause NAS-Request 10 +VALUE Acct-Terminate-Cause NAS-Reboot 11 +VALUE Acct-Terminate-Cause Port-Unneeded 12 +VALUE Acct-Terminate-Cause Port-Preempted 13 +VALUE Acct-Terminate-Cause Port-Suspended 14 +VALUE Acct-Terminate-Cause Service-Unavailable 15 +VALUE Acct-Terminate-Cause Callback 16 +VALUE Acct-Terminate-Cause User-Error 17 +VALUE Acct-Terminate-Cause Host-Request 18 + +# +# Non-Protocol Integer Translations +# + +VALUE Auth-Type Local 0 +VALUE Auth-Type System 1 +VALUE Auth-Type SecurID 2 +VALUE Auth-Type Crypt-Local 3 +VALUE Auth-Type Reject 4 + +# +# Cistron extensions +# +VALUE Auth-Type Pam 253 +VALUE Auth-Type None 254 + +# +# Experimental Non-Protocol Integer Translations for Cistron-Radiusd +# +VALUE Fall-Through No 0 +VALUE Fall-Through Yes 1 +VALUE Add-Port-To-IP-Address No 0 +VALUE Add-Port-To-IP-Address Yes 1 + +# +# Configuration Values +# uncomment these two lines to turn account expiration on +# + +#VALUE Server-Config Password-Expiration 30 +#VALUE Server-Config Password-Warning 5 + +# Octets-Direction +VALUE Octets-Direction Sum 0 +VALUE Octets-Direction Input 1 +VALUE Octets-Direction Output 2 +VALUE Octets-Direction MaxOveral 3 +VALUE Octets-Direction MaxSession 4 + +INCLUDE /etc/ppp/radius/dictionary.microsoft diff --git a/package/ppp/files/etc/ppp/radius/dictionary.asnet b/package/ppp/files/etc/ppp/radius/dictionary.asnet new file mode 100644 index 0000000000..337d1e1407 --- /dev/null +++ b/package/ppp/files/etc/ppp/radius/dictionary.asnet @@ -0,0 +1,3 @@ +VENDOR ASNET 50000 +ATTRIBUTE Speed-Down 1 string ASNET +ATTRIBUTE Speed-Up 2 string ASNET diff --git a/package/ppp/files/etc/ppp/radius/dictionary.microsoft b/package/ppp/files/etc/ppp/radius/dictionary.microsoft new file mode 100644 index 0000000000..09fdbba63f --- /dev/null +++ b/package/ppp/files/etc/ppp/radius/dictionary.microsoft @@ -0,0 +1,81 @@ +# +# Microsoft's VSA's, from RFC 2548 +# +# $Id$ +# + +VENDOR Microsoft 311 Microsoft + +ATTRIBUTE MS-CHAP-Response 1 string Microsoft +ATTRIBUTE MS-CHAP-Error 2 string Microsoft +ATTRIBUTE MS-CHAP-CPW-1 3 string Microsoft +ATTRIBUTE MS-CHAP-CPW-2 4 string Microsoft +ATTRIBUTE MS-CHAP-LM-Enc-PW 5 string Microsoft +ATTRIBUTE MS-CHAP-NT-Enc-PW 6 string Microsoft +ATTRIBUTE MS-MPPE-Encryption-Policy 7 string Microsoft +# This is referred to as both singular and plural in the RFC. +# Plural seems to make more sense. +ATTRIBUTE MS-MPPE-Encryption-Type 8 string Microsoft +ATTRIBUTE MS-MPPE-Encryption-Types 8 string Microsoft +ATTRIBUTE MS-RAS-Vendor 9 integer Microsoft +ATTRIBUTE MS-CHAP-Domain 10 string Microsoft +ATTRIBUTE MS-CHAP-Challenge 11 string Microsoft +ATTRIBUTE MS-CHAP-MPPE-Keys 12 string Microsoft +ATTRIBUTE MS-BAP-Usage 13 integer Microsoft +ATTRIBUTE MS-Link-Utilization-Threshold 14 integer Microsoft +ATTRIBUTE MS-Link-Drop-Time-Limit 15 integer Microsoft +ATTRIBUTE MS-MPPE-Send-Key 16 string Microsoft +ATTRIBUTE MS-MPPE-Recv-Key 17 string Microsoft +ATTRIBUTE MS-RAS-Version 18 string Microsoft +ATTRIBUTE MS-Old-ARAP-Password 19 string Microsoft +ATTRIBUTE MS-New-ARAP-Password 20 string Microsoft +ATTRIBUTE MS-ARAP-PW-Change-Reason 21 integer Microsoft + +ATTRIBUTE MS-Filter 22 string Microsoft +ATTRIBUTE MS-Acct-Auth-Type 23 integer Microsoft +ATTRIBUTE MS-Acct-EAP-Type 24 integer Microsoft + +ATTRIBUTE MS-CHAP2-Response 25 string Microsoft +ATTRIBUTE MS-CHAP2-Success 26 string Microsoft +ATTRIBUTE MS-CHAP2-CPW 27 string Microsoft + +ATTRIBUTE MS-Primary-DNS-Server 28 ipaddr Microsoft +ATTRIBUTE MS-Secondary-DNS-Server 29 ipaddr Microsoft +ATTRIBUTE MS-Primary-NBNS-Server 30 ipaddr Microsoft +ATTRIBUTE MS-Secondary-NBNS-Server 31 ipaddr Microsoft + +#ATTRIBUTE MS-ARAP-Challenge 33 string Microsoft + + +# +# Integer Translations +# + +# MS-BAP-Usage Values + +VALUE MS-BAP-Usage Not-Allowed 0 +VALUE MS-BAP-Usage Allowed 1 +VALUE MS-BAP-Usage Required 2 + +# MS-ARAP-Password-Change-Reason Values + +VALUE MS-ARAP-PW-Change-Reason Just-Change-Password 1 +VALUE MS-ARAP-PW-Change-Reason Expired-Password 2 +VALUE MS-ARAP-PW-Change-Reason Admin-Requires-Password-Change 3 +VALUE MS-ARAP-PW-Change-Reason Password-Too-Short 4 + +# MS-Acct-Auth-Type Values + +VALUE MS-Acct-Auth-Type PAP 1 +VALUE MS-Acct-Auth-Type CHAP 2 +VALUE MS-Acct-Auth-Type MS-CHAP-1 3 +VALUE MS-Acct-Auth-Type MS-CHAP-2 4 +VALUE MS-Acct-Auth-Type EAP 5 + +# MS-Acct-EAP-Type Values + +VALUE MS-Acct-EAP-Type MD5 4 +VALUE MS-Acct-EAP-Type OTP 5 +VALUE MS-Acct-EAP-Type Generic-Token-Card 6 +VALUE MS-Acct-EAP-Type TLS 13 + diff --git a/package/ppp/files/etc/ppp/radius/servers b/package/ppp/files/etc/ppp/radius/servers new file mode 100644 index 0000000000..0d4f0691d0 --- /dev/null +++ b/package/ppp/files/etc/ppp/radius/servers @@ -0,0 +1,2 @@ +# SERVER SECRET +localhost secret diff --git a/package/ppp/files/ppp.sh b/package/ppp/files/ppp.sh new file mode 100644 index 0000000000..343223af1b --- /dev/null +++ b/package/ppp/files/ppp.sh @@ -0,0 +1,29 @@ +scan_ppp() { + config_get ifname "$1" ifname + pppdev="${pppdev:-0}" + config_set "$1" ifname "ppp$pppdev" + config_set "$1" unit "$pppdev" +} + +start_pppd() { + local cfg="$1"; shift + config_get device "$cfg" device + config_get unit "$cfg" unit + config_get username "$cfg" username + config_get password "$cfg" password + config_get keepalive "$cfg" keepalive + interval="${keepalive%%*[, ]}" + [ "$interval" != "$keepalive" ] || interval=5 + + config_get demand "$cfg" demand + [ -n "$demand" ] && echo "nameserver 1.1.1.1" > /tmp/resolv.conf + /usr/sbin/pppd "$@" \ + ${keepalive:+lcp-echo-interval $interval lcp-echo-failure ${keepalive##[, ]*}} \ + ${demand:+precompiled-active-filter /etc/ppp/filter demand idle }${demand:-persist} \ + usepeerdns \ + defaultroute \ + replacedefaultroute \ + ${username:+user "$username" password "$password"} \ + linkname "$cfg" \ + ipparam "$cfg" +} diff --git a/package/ppp/files/pppoa.sh b/package/ppp/files/pppoa.sh new file mode 100644 index 0000000000..e6530b073e --- /dev/null +++ b/package/ppp/files/pppoa.sh @@ -0,0 +1,20 @@ +scan_pppoa() { + scan_ppp "$@" +} + +setup_interface_pppoa() { + local iface="$1" + local config="$2" + + config_get device "$config" device + + for module in slhc ppp_generic pppoatm; do + /sbin/insmod $module 2>&- >&- + done + + config_get mtu "$cfg" mtu + mtu=${mtu:-1492} + start_pppd "$config" \ + plugin pppoatm.so ${atm_vpi:-8}.${atm_vci:-35} \ + mtu $mtu mru $mtu +} diff --git a/package/ppp/files/pppoe.sh b/package/ppp/files/pppoe.sh new file mode 100644 index 0000000000..f263caaeef --- /dev/null +++ b/package/ppp/files/pppoe.sh @@ -0,0 +1,21 @@ +scan_pppoe() { + scan_ppp "$@" +} + +setup_interface_pppoe() { + local iface="$1" + local config="$2" + + config_get device "$config" device + + for module in slhc ppp_generic pppox pppoe; do + /sbin/insmod $module 2>&- >&- + done + + config_get mtu "$cfg" mtu + mtu=${mtu:-1480} + start_pppd "$config" \ + plugin rp-pppoe.so \ + mtu $mtu mru $mtu \ + "nic-$device" +} diff --git a/package/ppp/patches/010-use_target_for_configure.patch b/package/ppp/patches/010-use_target_for_configure.patch new file mode 100644 index 0000000000..56439a6122 --- /dev/null +++ b/package/ppp/patches/010-use_target_for_configure.patch @@ -0,0 +1,20 @@ + + Use values exported from $(TOPDIR)/rules.mk for determining + the target system instead of the host configuration + +--- ppp-2.4.3/configure.orig Sat Nov 6 11:36:32 2004 ++++ ppp-2.4.3/configure Sun Jun 18 23:40:46 2006 +@@ -8,9 +8,9 @@ SYSCONF=/etc + # if [ -d /NextApps ]; then + # system="NeXTStep" + # else +- system=`uname -s` +- release=`uname -r` +- arch=`uname -m` ++ system=${UNAME_S:-`uname -s`} ++ release=${UNAME_R:-`uname -r`} ++ arch=${UNAME_M:-`uname -m`} + # fi + state="unknown" + + diff --git a/package/ppp/patches/100-debian_close_dev_ppp.patch b/package/ppp/patches/100-debian_close_dev_ppp.patch new file mode 100644 index 0000000000..4e50118e87 --- /dev/null +++ b/package/ppp/patches/100-debian_close_dev_ppp.patch @@ -0,0 +1,34 @@ +From: Simon Peter <dn.tlp@gmx.net> +Subject: Bug#306261: pppd does not properly close /dev/ppp on persist + +When using the kernel PPPoE driver, pppd never +closes /dev/ppp when the link has come down. + +It opens superfluous fds to the device each time it re-opens the +connection, with the unclosed ones falsely reported always ready for +data by select(). + +This makes pppd eat up 100% CPU time after the first persist because of +the always instantly returning select() on the unclosed fds. + +The problem also occurs with the upstream version, but does not occur +when a pty/tty device is used for the ppp connection. + + +diff -u -r ppp-2.4.3/pppd/sys-linux.c ppp-2.4.3/pppd/sys-linux.c +--- ppp-2.4.3/pppd/sys-linux.c 2005-04-29 20:08:37.000000000 +0200 ++++ ppp-2.4.3/pppd/sys-linux.c 2005-04-29 20:07:03.000000000 +0200 +@@ -455,6 +455,13 @@ + if (new_style_driver) { + int flags; + ++ /* if a ppp_fd is already open, close it first */ ++ if(ppp_fd > 0) { ++ close(ppp_fd); ++ remove_fd(ppp_fd); ++ ppp_fd = -1; ++ } ++ + /* Open an instance of /dev/ppp and connect the channel to it */ + if (ioctl(fd, PPPIOCGCHAN, &chindex) == -1) { + error("Couldn't get channel number: %m"); diff --git a/package/ppp/patches/101-debian_ip-up_option.patch b/package/ppp/patches/101-debian_ip-up_option.patch new file mode 100644 index 0000000000..6033fda247 --- /dev/null +++ b/package/ppp/patches/101-debian_ip-up_option.patch @@ -0,0 +1,88 @@ +diff -ruNp ppp-2.4.3.orig/pppd/ipcp.c ppp-2.4.3/pppd/ipcp.c +--- ppp-2.4.3.orig/pppd/ipcp.c 2004-11-13 13:03:26.000000000 +0100 ++++ ppp-2.4.3/pppd/ipcp.c 2005-02-20 18:45:22.241810136 +0100 +@@ -1846,7 +1846,7 @@ ipcp_up(f) + */ + if (ipcp_script_state == s_down && ipcp_script_pid == 0) { + ipcp_script_state = s_up; +- ipcp_script(_PATH_IPUP); ++ ipcp_script(path_ipup); + } + } + +@@ -1896,7 +1896,7 @@ ipcp_down(f) + /* Execute the ip-down script */ + if (ipcp_script_state == s_up && ipcp_script_pid == 0) { + ipcp_script_state = s_down; +- ipcp_script(_PATH_IPDOWN); ++ ipcp_script(path_ipdown); + } + } + +@@ -1950,13 +1950,13 @@ ipcp_script_done(arg) + case s_up: + if (ipcp_fsm[0].state != OPENED) { + ipcp_script_state = s_down; +- ipcp_script(_PATH_IPDOWN); ++ ipcp_script(path_ipdown); + } + break; + case s_down: + if (ipcp_fsm[0].state == OPENED) { + ipcp_script_state = s_up; +- ipcp_script(_PATH_IPUP); ++ ipcp_script(path_ipup); + } + break; + } +diff -ruNp ppp-2.4.3.orig/pppd/main.c ppp-2.4.3/pppd/main.c +--- ppp-2.4.3.orig/pppd/main.c 2005-02-20 18:46:14.409879384 +0100 ++++ ppp-2.4.3/pppd/main.c 2005-02-20 18:45:22.243809832 +0100 +@@ -314,6 +314,9 @@ main(argc, argv) + struct protent *protp; + char numbuf[16]; + ++ strlcpy(path_ipup, _PATH_IPUP, sizeof(path_ipup)); ++ strlcpy(path_ipdown, _PATH_IPDOWN, sizeof(path_ipdown)); ++ + link_stats_valid = 0; + new_phase(PHASE_INITIALIZE); + +diff -ruNp ppp-2.4.3.orig/pppd/options.c ppp-2.4.3/pppd/options.c +--- ppp-2.4.3.orig/pppd/options.c 2005-02-20 18:46:14.410879232 +0100 ++++ ppp-2.4.3/pppd/options.c 2005-02-20 18:46:02.154742448 +0100 +@@ -108,6 +108,8 @@ char linkname[MAXPATHLEN]; /* logical na + bool tune_kernel; /* may alter kernel settings */ + int connect_delay = 1000; /* wait this many ms after connect script */ + int req_unit = -1; /* requested interface unit */ ++char path_ipup[MAXPATHLEN]; /* pathname of ip-up script */ ++char path_ipdown[MAXPATHLEN];/* pathname of ip-down script */ + bool multilink = 0; /* Enable multilink operation */ + char *bundle_name = NULL; /* bundle name for multilink */ + bool dump_options; /* print out option values */ +@@ -276,6 +278,13 @@ option_t general_options[] = { + "Number of seconds to wait for child processes at exit", + OPT_PRIO }, + ++ { "ip-up-script", o_string, path_ipup, ++ "Set pathname of ip-up script", ++ OPT_PRIV|OPT_STATIC, NULL, MAXPATHLEN }, ++ { "ip-down-script", o_string, path_ipdown, ++ "Set pathname of ip-down script", ++ OPT_PRIV|OPT_STATIC, NULL, MAXPATHLEN }, ++ + #ifdef HAVE_MULTILINK + { "multilink", o_bool, &multilink, + "Enable multilink operation", OPT_PRIO | 1 }, +diff -ruNp ppp-2.4.3.orig/pppd/pppd.h ppp-2.4.3/pppd/pppd.h +--- ppp-2.4.3.orig/pppd/pppd.h 2005-02-20 18:46:14.414878624 +0100 ++++ ppp-2.4.3/pppd/pppd.h 2005-02-20 18:45:22.247809224 +0100 +@@ -312,6 +312,8 @@ extern bool tune_kernel; /* May alter ke + extern int connect_delay; /* Time to delay after connect script */ + extern int max_data_rate; /* max bytes/sec through charshunt */ + extern int req_unit; /* interface unit number to use */ ++extern char path_ipup[MAXPATHLEN]; /* pathname of ip-up script */ ++extern char path_ipdown[MAXPATHLEN]; /* pathname of ip-down script */ + extern bool multilink; /* enable multilink operation */ + extern bool noendpoint; /* don't send or accept endpt. discrim. */ + extern char *bundle_name; /* bundle name for multilink */ diff --git a/package/ppp/patches/102-debian_pppoe_multicast_pado.patch b/package/ppp/patches/102-debian_pppoe_multicast_pado.patch new file mode 100644 index 0000000000..ea5275c461 --- /dev/null +++ b/package/ppp/patches/102-debian_pppoe_multicast_pado.patch @@ -0,0 +1,14 @@ +diff -ruNp ppp-2.4.3.orig/pppd/plugins/rp-pppoe/discovery.c ppp-2.4.3/pppd/plugins/rp-pppoe/discovery.c +--- ppp-2.4.3.orig/pppd/plugins/rp-pppoe/discovery.c 2004-11-04 11:07:37.000000000 +0100 ++++ ppp-2.4.3/pppd/plugins/rp-pppoe/discovery.c 2005-02-24 21:00:11.586697752 +0100 +@@ -365,8 +365,8 @@ waitForPADO(PPPoEConnection *conn, int t + if (!packetIsForMe(conn, &packet)) continue; + + if (packet.code == CODE_PADO) { +- if (NOT_UNICAST(packet.ethHdr.h_source)) { +- printErr("Ignoring PADO packet from non-unicast MAC address"); ++ if (BROADCAST(packet.ethHdr.h_source)) { ++ printErr("Ignoring PADO packet from broadcast MAC address"); + continue; + } + parsePacket(&packet, parsePADOTags, &pc); diff --git a/package/ppp/patches/103-debian_pppoe_cleanup.patch b/package/ppp/patches/103-debian_pppoe_cleanup.patch new file mode 100644 index 0000000000..8a97a0b2e5 --- /dev/null +++ b/package/ppp/patches/103-debian_pppoe_cleanup.patch @@ -0,0 +1,1079 @@ +diff -ruNp ppp-2.4.3.orig/pppd/plugins/rp-pppoe/common.c ppp-2.4.3/pppd/plugins/rp-pppoe/common.c +--- ppp-2.4.3.orig/pppd/plugins/rp-pppoe/common.c 2004-02-02 04:36:46.000000000 +0100 ++++ ppp-2.4.3/pppd/plugins/rp-pppoe/common.c 2005-03-11 02:09:19.000000000 +0100 +@@ -18,10 +18,6 @@ static char const RCSID[] = + + #include "pppoe.h" + +-#ifdef HAVE_SYSLOG_H +-#include <syslog.h> +-#endif +- + #include <string.h> + #include <errno.h> + #include <stdlib.h> +@@ -50,17 +46,17 @@ parsePacket(PPPoEPacket *packet, ParseFu + UINT16_t tagType, tagLen; + + if (packet->ver != 1) { +- syslog(LOG_ERR, "Invalid PPPoE version (%d)", (int) packet->ver); ++ error("Invalid PPPoE version (%u)", packet->ver); + return -1; + } + if (packet->type != 1) { +- syslog(LOG_ERR, "Invalid PPPoE type (%d)", (int) packet->type); ++ error("Invalid PPPoE type (%u)", packet->type); + return -1; + } + + /* Do some sanity checks on packet */ + if (len > ETH_DATA_LEN - 6) { /* 6-byte overhead for PPPoE header */ +- syslog(LOG_ERR, "Invalid PPPoE packet length (%u)", len); ++ error("Invalid PPPoE packet length (%u)", len); + return -1; + } + +@@ -76,7 +72,7 @@ parsePacket(PPPoEPacket *packet, ParseFu + return 0; + } + if ((curTag - packet->payload) + tagLen + TAG_HDR_SIZE > len) { +- syslog(LOG_ERR, "Invalid PPPoE tag length (%u)", tagLen); ++ error("Invalid PPPoE tag length (%u)", tagLen); + return -1; + } + func(tagType, tagLen, curTag+TAG_HDR_SIZE, extra); +@@ -105,17 +101,17 @@ findTag(PPPoEPacket *packet, UINT16_t ty + UINT16_t tagType, tagLen; + + if (packet->ver != 1) { +- syslog(LOG_ERR, "Invalid PPPoE version (%d)", (int) packet->ver); ++ error("Invalid PPPoE version (%u)", packet->ver); + return NULL; + } + if (packet->type != 1) { +- syslog(LOG_ERR, "Invalid PPPoE type (%d)", (int) packet->type); ++ error("Invalid PPPoE type (%u)", packet->type); + return NULL; + } + + /* Do some sanity checks on packet */ + if (len > ETH_DATA_LEN - 6) { /* 6-byte overhead for PPPoE header */ +- syslog(LOG_ERR, "Invalid PPPoE packet length (%u)", len); ++ error("Invalid PPPoE packet length (%u)", len); + return NULL; + } + +@@ -131,7 +127,7 @@ findTag(PPPoEPacket *packet, UINT16_t ty + return NULL; + } + if ((curTag - packet->payload) + tagLen + TAG_HDR_SIZE > len) { +- syslog(LOG_ERR, "Invalid PPPoE tag length (%u)", tagLen); ++ error("Invalid PPPoE tag length (%u)", tagLen); + return NULL; + } + if (tagType == type) { +@@ -143,6 +139,7 @@ findTag(PPPoEPacket *packet, UINT16_t ty + return NULL; + } + ++#ifdef unused + /********************************************************************** + *%FUNCTION: printErr + *%ARGUMENTS: +@@ -158,6 +155,7 @@ printErr(char const *str) + fprintf(stderr, "pppoe: %s\n", str); + syslog(LOG_ERR, "%s", str); + } ++#endif + + + /********************************************************************** +@@ -172,7 +170,7 @@ strDup(char const *str) + { + char *copy = malloc(strlen(str)+1); + if (!copy) { +- rp_fatal("strdup failed"); ++ fatal("strdup failed"); + } + strcpy(copy, str); + return copy; +@@ -467,9 +465,10 @@ sendPADT(PPPoEConnection *conn, char con + fprintf(conn->debugFile, "\n"); + fflush(conn->debugFile); + } +- syslog(LOG_INFO,"Sent PADT"); ++ info("Sent PADT"); + } + ++#ifdef unused + /********************************************************************** + *%FUNCTION: parseLogErrs + *%ARGUMENTS: +@@ -501,4 +500,5 @@ parseLogErrs(UINT16_t type, UINT16_t len + break; + } + } ++#endif + +diff -ruNp ppp-2.4.3.orig/pppd/plugins/rp-pppoe/discovery.c ppp-2.4.3/pppd/plugins/rp-pppoe/discovery.c +--- ppp-2.4.3.orig/pppd/plugins/rp-pppoe/discovery.c 2005-03-11 02:12:52.000000000 +0100 ++++ ppp-2.4.3/pppd/plugins/rp-pppoe/discovery.c 2005-03-10 12:24:19.000000000 +0100 +@@ -13,10 +13,6 @@ static char const RCSID[] = + + #include "pppoe.h" + +-#ifdef HAVE_SYSLOG_H +-#include <syslog.h> +-#endif +- + #include <string.h> + #include <stdlib.h> + #include <errno.h> +@@ -167,24 +163,21 @@ parsePADOTags(UINT16_t type, UINT16_t le + if (conn->printACNames) { + printf("Got a Service-Name-Error tag: %.*s\n", (int) len, data); + } else { +- syslog(LOG_ERR, "PADO: Service-Name-Error: %.*s", (int) len, data); +- exit(1); ++ fatal("PADO: Service-Name-Error: %.*s", (int) len, data); + } + break; + case TAG_AC_SYSTEM_ERROR: + if (conn->printACNames) { + printf("Got a System-Error tag: %.*s\n", (int) len, data); + } else { +- syslog(LOG_ERR, "PADO: System-Error: %.*s", (int) len, data); +- exit(1); ++ fatal("PADO: System-Error: %.*s", (int) len, data); + } + break; + case TAG_GENERIC_ERROR: + if (conn->printACNames) { + printf("Got a Generic-Error tag: %.*s\n", (int) len, data); + } else { +- syslog(LOG_ERR, "PADO: Generic-Error: %.*s", (int) len, data); +- exit(1); ++ fatal("PADO: Generic-Error: %.*s", (int) len, data); + } + break; + } +@@ -209,20 +202,14 @@ parsePADSTags(UINT16_t type, UINT16_t le + PPPoEConnection *conn = (PPPoEConnection *) extra; + switch(type) { + case TAG_SERVICE_NAME: +- syslog(LOG_DEBUG, "PADS: Service-Name: '%.*s'", (int) len, data); ++ dbglog("PADS: Service-Name: '%.*s'", (int) len, data); + break; + case TAG_SERVICE_NAME_ERROR: +- syslog(LOG_ERR, "PADS: Service-Name-Error: %.*s", (int) len, data); +- fprintf(stderr, "PADS: Service-Name-Error: %.*s\n", (int) len, data); +- exit(1); ++ fatal("PADS: Service-Name-Error: %.*s", (int) len, data); + case TAG_AC_SYSTEM_ERROR: +- syslog(LOG_ERR, "PADS: System-Error: %.*s", (int) len, data); +- fprintf(stderr, "PADS: System-Error: %.*s\n", (int) len, data); +- exit(1); ++ fatal("PADS: System-Error: %.*s", (int) len, data); + case TAG_GENERIC_ERROR: +- syslog(LOG_ERR, "PADS: Generic-Error: %.*s", (int) len, data); +- fprintf(stderr, "PADS: Generic-Error: %.*s\n", (int) len, data); +- exit(1); ++ fatal("PADS: Generic-Error: %.*s", (int) len, data); + case TAG_RELAY_SESSION_ID: + conn->relayId.type = htons(type); + conn->relayId.length = htons(len); +@@ -336,7 +323,7 @@ waitForPADO(PPPoEConnection *conn, int t + if (r >= 0 || errno != EINTR) break; + } + if (r < 0) { +- fatalSys("select (waitForPADO)"); ++ fatal("waitForPADO: select: %m"); + } + if (r == 0) return; /* Timed out */ + } +@@ -346,8 +333,7 @@ waitForPADO(PPPoEConnection *conn, int t + + /* Check length */ + if (ntohs(packet.length) + HDR_SIZE > len) { +- syslog(LOG_ERR, "Bogus PPPoE length field (%u)", +- (unsigned int) ntohs(packet.length)); ++ error("Bogus PPPoE length field (%u)", ntohs(packet.length)); + continue; + } + +@@ -366,16 +352,16 @@ waitForPADO(PPPoEConnection *conn, int t + + if (packet.code == CODE_PADO) { + if (BROADCAST(packet.ethHdr.h_source)) { +- printErr("Ignoring PADO packet from broadcast MAC address"); ++ error("Ignoring PADO packet from broadcast MAC address"); + continue; + } + parsePacket(&packet, parsePADOTags, &pc); + if (!pc.seenACName) { +- printErr("Ignoring PADO packet with no AC-Name tag"); ++ error("Ignoring PADO packet with no AC-Name tag"); + continue; + } + if (!pc.seenServiceName) { +- printErr("Ignoring PADO packet with no Service-Name tag"); ++ error("Ignoring PADO packet with no Service-Name tag"); + continue; + } + conn->numPADOs++; +@@ -513,7 +499,7 @@ waitForPADS(PPPoEConnection *conn, int t + if (r >= 0 || errno != EINTR) break; + } + if (r < 0) { +- fatalSys("select (waitForPADS)"); ++ fatal("waitForPADS: select: %m"); + } + if (r == 0) return; + } +@@ -523,8 +509,7 @@ waitForPADS(PPPoEConnection *conn, int t + + /* Check length */ + if (ntohs(packet.length) + HDR_SIZE > len) { +- syslog(LOG_ERR, "Bogus PPPoE length field (%u)", +- (unsigned int) ntohs(packet.length)); ++ error("Bogus PPPoE length field (%u)", ntohs(packet.length)); + continue; + } + +@@ -556,11 +541,12 @@ waitForPADS(PPPoEConnection *conn, int t + /* Don't bother with ntohs; we'll just end up converting it back... */ + conn->session = packet.session; + +- syslog(LOG_INFO, "PPP session is %d", (int) ntohs(conn->session)); ++ info("PPP session is %d", ntohs(conn->session)); + + /* RFC 2516 says session id MUST NOT be zero or 0xFFFF */ + if (ntohs(conn->session) == 0 || ntohs(conn->session) == 0xFFFF) { +- syslog(LOG_ERR, "Access concentrator used a session value of %x -- the AC is violating RFC 2516", (unsigned int) ntohs(conn->session)); ++ error("Access concentrator used a session value of 0x%x" ++ " -- the AC is violating RFC 2516", ntohs(conn->session)); + } + } + +@@ -620,7 +606,7 @@ discovery(PPPoEConnection *conn) + + /* If we're only printing access concentrator names, we're done */ + if (conn->printACNames) { +- die(0); ++ exit(0); + } + + timeout = PADI_TIMEOUT; +diff -ruNp ppp-2.4.3.orig/pppd/plugins/rp-pppoe/if.c ppp-2.4.3/pppd/plugins/rp-pppoe/if.c +--- ppp-2.4.3.orig/pppd/plugins/rp-pppoe/if.c 2001-12-14 03:55:20.000000000 +0100 ++++ ppp-2.4.3/pppd/plugins/rp-pppoe/if.c 2005-03-10 13:32:43.000000000 +0100 +@@ -40,10 +40,6 @@ static char const RCSID[] = + #include <sys/ioctl.h> + #endif + +-#ifdef HAVE_SYSLOG_H +-#include <syslog.h> +-#endif +- + #include <errno.h> + #include <stdlib.h> + #include <string.h> +@@ -127,7 +123,7 @@ etherType(PPPoEPacket *packet) + { + UINT16_t type = (UINT16_t) ntohs(packet->ethHdr.h_proto); + if (type != Eth_PPPOE_Discovery && type != Eth_PPPOE_Session) { +- syslog(LOG_ERR, "Invalid ether type 0x%x", type); ++ error("Invalid ethernet type 0x%x", type); + } + return type; + } +@@ -156,7 +152,7 @@ getHWaddr(int sock, char const *ifname, + ifc.ifc_len = sizeof(inbuf); + ifc.ifc_buf = inbuf; + if (ioctl(sock, SIOCGIFCONF, &ifc) < 0) { +- fatalSys("SIOCGIFCONF"); ++ fatal("SIOCGIFCONF: %m"); + } + ifr = ifc.ifc_req; + ifreq.ifr_name[0] = '\0'; +@@ -172,9 +168,7 @@ getHWaddr(int sock, char const *ifname, + (sdl->sdl_alen == ETH_ALEN) && + !strncmp(ifname, ifr->ifr_name, sizeof(ifr->ifr_name))) { + if (found) { +- char buffer[256]; +- sprintf(buffer, "interface %.16s has more than one ethernet address", ifname); +- rp_fatal(buffer); ++ fatal("interface %s has more than one ethernet address", ifname); + } else { + found = 1; + memcpy(hwaddr, LLADDR(sdl), ETH_ALEN); +@@ -183,9 +177,7 @@ getHWaddr(int sock, char const *ifname, + } + } + if (!found) { +- char buffer[256]; +- sprintf(buffer, "interface %.16s has no ethernet address", ifname); +- rp_fatal(buffer); ++ fatal("interface %s has no ethernet address", ifname); + } + } + +@@ -252,7 +244,7 @@ initFilter(int fd, UINT16_t type, unsign + + /* Apply the filter */ + if (ioctl(fd, BIOCSETF, &bpfProgram) < 0) { +- fatalSys("ioctl(BIOCSETF)"); ++ fatal("ioctl(BIOCSETF): %m"); + } + } + } +@@ -298,42 +290,36 @@ openInterface(char const *ifname, UINT16 + if (fd < 0) { + switch (errno) { + case EACCES: /* permission denied */ +- { +- char buffer[256]; +- sprintf(buffer, "Cannot open %.32s -- pppoe must be run as root.", bpfName); +- rp_fatal(buffer); +- } ++ fatal("Cannot open %s -- pppoe must be run as root.", bpfName); + break; + case EBUSY: + case ENOENT: /* no such file */ + if (i == 0) { +- rp_fatal("No /dev/bpf* devices (check your kernel configuration for BPF support)"); ++ fatal("No /dev/bpf* devices (check your kernel configuration for BPF support)"); + } else { +- rp_fatal("All /dev/bpf* devices are in use"); ++ fatal("All /dev/bpf* devices are in use"); + } + break; + } +- fatalSys(bpfName); ++ fatal("%s: %m", bpfName); + } + + if ((sock = socket(AF_LOCAL, SOCK_DGRAM, 0)) < 0) { +- fatalSys("socket"); ++ fatal("socket: %m"); + } + + /* Check that the interface is up */ + strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); + if (ioctl(sock, SIOCGIFFLAGS, &ifr) < 0) { +- fatalSys("ioctl(SIOCGIFFLAGS)"); ++ fatal("ioctl(SIOCGIFFLAGS): %m"); + } + if ((ifr.ifr_flags & IFF_UP) == 0) { +- char buffer[256]; +- sprintf(buffer, "Interface %.16s is not up\n", ifname); +- rp_fatal(buffer); ++ fatal("Interface %s is not up", ifname); + } + + /* Fill in hardware address and initialize the packet filter rules */ + if (hwaddr == NULL) { +- rp_fatal("openInterface: no hwaddr arg."); ++ fatal("openInterface: no hwaddr arg."); + } + getHWaddr(sock, ifname, hwaddr); + initFilter(fd, type, hwaddr); +@@ -342,58 +328,52 @@ openInterface(char const *ifname, UINT16 + #if !defined(__OpenBSD__) + strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); + if (ioctl(sock, SIOCGIFMTU, &ifr) < 0) { +- fatalSys("ioctl(SIOCGIFMTU)"); ++ fatal("ioctl(SIOCGIFMTU): %m"); + } + if (ifr.ifr_mtu < ETH_DATA_LEN) { +- char buffer[256]; +- sprintf(buffer, "Interface %.16s has MTU of %d -- should be %d. You may have serious connection problems.", ++ error("Interface %s has MTU of %d -- should be %d." ++ " You may have serious connection problems.", + ifname, ifr.ifr_mtu, ETH_DATA_LEN); +- printErr(buffer); + } + #endif + + /* done with the socket */ + if (close(sock) < 0) { +- fatalSys("close"); ++ fatal("close: %m"); + } + + /* Check the BPF version number */ + if (ioctl(fd, BIOCVERSION, &bpf_ver) < 0) { +- fatalSys("ioctl(BIOCVERSION)"); ++ fatal("ioctl(BIOCVERSION): %m"); + } + if ((bpf_ver.bv_major != BPF_MAJOR_VERSION) || + (bpf_ver.bv_minor < BPF_MINOR_VERSION)) { +- char buffer[256]; +- sprintf(buffer, "Unsupported BPF version: %d.%d (kernel: %d.%d)", ++ fatal("Unsupported BPF version: %d.%d (kernel: %d.%d)", + BPF_MAJOR_VERSION, BPF_MINOR_VERSION, + bpf_ver.bv_major, bpf_ver.bv_minor); +- rp_fatal(buffer); + } + + /* allocate a receive packet buffer */ + if (ioctl(fd, BIOCGBLEN, &bpfLength) < 0) { +- fatalSys("ioctl(BIOCGBLEN)"); ++ fatal("ioctl(BIOCGBLEN): %m"); + } + if (!(bpfBuffer = (unsigned char *) malloc(bpfLength))) { +- rp_fatal("malloc"); ++ fatal("malloc"); + } + + /* reads should return as soon as there is a packet available */ + optval = 1; + if (ioctl(fd, BIOCIMMEDIATE, &optval) < 0) { +- fatalSys("ioctl(BIOCIMMEDIATE)"); ++ fatal("ioctl(BIOCIMMEDIATE): %m"); + } + + /* Bind the interface to the filter */ + strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); + if (ioctl(fd, BIOCSETIF, &ifr) < 0) { +- char buffer[256]; +- sprintf(buffer, "ioctl(BIOCSETIF) can't select interface %.16s", +- ifname); +- rp_fatal(buffer); ++ fatal("ioctl(BIOCSETIF) can't select interface %s: %m", ifname); + } + +- syslog(LOG_INFO, "Interface=%.16s HWaddr=%02X:%02X:%02X:%02X:%02X:%02X Device=%.32s Buffer size=%d", ++ info("Interface=%s HWaddr=%02X:%02X:%02X:%02X:%02X:%02X Device=%s Buffer size=%d", + ifname, + hwaddr[0], hwaddr[1], hwaddr[2], + hwaddr[3], hwaddr[4], hwaddr[5], +@@ -442,48 +422,41 @@ openInterface(char const *ifname, UINT16 + if ((fd = socket(domain, stype, htons(type))) < 0) { + /* Give a more helpful message for the common error case */ + if (errno == EPERM) { +- rp_fatal("Cannot create raw socket -- pppoe must be run as root."); ++ fatal("Cannot create raw socket -- pppoe must be run as root."); + } +- fatalSys("socket"); ++ fatal("cannot create the raw socket: %m"); + } + + if (setsockopt(fd, SOL_SOCKET, SO_BROADCAST, &optval, sizeof(optval)) < 0) { +- fatalSys("setsockopt"); ++ fatal("setsockopt(SOL_SOCKET, SO_BROADCAST): %m"); + } + + /* Fill in hardware address */ + if (hwaddr) { + strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); +- if (ioctl(fd, SIOCGIFHWADDR, &ifr) < 0) { +- fatalSys("ioctl(SIOCGIFHWADDR)"); +- } ++ if (ioctl(fd, SIOCGIFHWADDR, &ifr) < 0) ++ fatal("ioctl(SIOCGIFHWADDR): %m"); + memcpy(hwaddr, ifr.ifr_hwaddr.sa_data, ETH_ALEN); + #ifdef ARPHRD_ETHER + if (ifr.ifr_hwaddr.sa_family != ARPHRD_ETHER) { +- char buffer[256]; +- sprintf(buffer, "Interface %.16s is not Ethernet", ifname); +- rp_fatal(buffer); ++ fatal("Interface %s is not Ethernet", ifname); + } + #endif + if (NOT_UNICAST(hwaddr)) { +- char buffer[256]; +- sprintf(buffer, +- "Interface %.16s has broadcast/multicast MAC address??", ++ fatal("Interface %s has broadcast/multicast MAC address", + ifname); +- rp_fatal(buffer); + } + } + + /* Sanity check on MTU */ + strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); + if (ioctl(fd, SIOCGIFMTU, &ifr) < 0) { +- fatalSys("ioctl(SIOCGIFMTU)"); ++ fatal("ioctl(SIOCGIFMTU): %m"); + } + if (ifr.ifr_mtu < ETH_DATA_LEN) { +- char buffer[256]; +- sprintf(buffer, "Interface %.16s has MTU of %d -- should be %d. You may have serious connection problems.", ++ error("Interface %s has MTU of %d -- should be %d." ++ " You may have serious connection problems.", + ifname, ifr.ifr_mtu, ETH_DATA_LEN); +- printErr(buffer); + } + + #ifdef HAVE_STRUCT_SOCKADDR_LL +@@ -493,7 +466,7 @@ openInterface(char const *ifname, UINT16 + + strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); + if (ioctl(fd, SIOCGIFINDEX, &ifr) < 0) { +- fatalSys("ioctl(SIOCFIGINDEX): Could not get interface index"); ++ fatal("ioctl(SIOCFIGINDEX): Could not get interface index: %m"); + } + sa.sll_ifindex = ifr.ifr_ifindex; + +@@ -503,7 +476,7 @@ openInterface(char const *ifname, UINT16 + + /* We're only interested in packets on specified interface */ + if (bind(fd, (struct sockaddr *) &sa, sizeof(sa)) < 0) { +- fatalSys("bind"); ++ fatal("bind: %m"); + } + + return fd; +@@ -527,13 +500,11 @@ sendPacket(PPPoEConnection *conn, int so + { + #if defined(USE_BPF) + if (write(sock, pkt, size) < 0) { +- sysErr("write (sendPacket)"); +- return -1; ++ fatal("sendPacket: write: %m"); + } + #elif defined(HAVE_STRUCT_SOCKADDR_LL) + if (send(sock, pkt, size, 0) < 0) { +- sysErr("send (sendPacket)"); +- return -1; ++ fatal("sendPacket: send: %m"); + } + #else + #ifdef USE_DLPI +@@ -577,12 +548,11 @@ sendPacket(PPPoEConnection *conn, int so + struct sockaddr sa; + + if (!conn) { +- rp_fatal("relay and server not supported on Linux 2.0 kernels"); ++ fatal("relay and server not supported on Linux 2.0 kernels"); + } + strcpy(sa.sa_data, conn->ifName); + if (sendto(sock, pkt, size, 0, &sa, sizeof(sa)) < 0) { +- sysErr("sendto (sendPacket)"); +- return -1; ++ fatal("sendPacket: sendto: %m"); + } + #endif + #endif +@@ -632,26 +602,24 @@ receivePacket(int sock, PPPoEPacket *pkt + if (bpfSize <= 0) { + bpfOffset = 0; + if ((bpfSize = read(sock, bpfBuffer, bpfLength)) < 0) { +- sysErr("read (receivePacket)"); +- return -1; ++ fatal("receivePacket: read: %m"); + } + } + if (bpfSize < sizeof(hdr)) { +- syslog(LOG_ERR, "Truncated bpf packet header: len=%d", bpfSize); ++ error("Truncated bpf packet header: len=%d", bpfSize); + clearPacketHeader(pkt); /* resets bpfSize and bpfOffset */ + return 0; + } + memcpy(&hdr, bpfBuffer + bpfOffset, sizeof(hdr)); + if (hdr.bh_caplen != hdr.bh_datalen) { +- syslog(LOG_ERR, "Truncated bpf packet: caplen=%d, datalen=%d", ++ error("Truncated bpf packet: caplen=%d, datalen=%d", + hdr.bh_caplen, hdr.bh_datalen); + clearPacketHeader(pkt); /* resets bpfSize and bpfOffset */ + return 0; + } + seglen = hdr.bh_hdrlen + hdr.bh_caplen; + if (seglen > bpfSize) { +- syslog(LOG_ERR, "Truncated bpf packet: seglen=%d, bpfSize=%d", +- seglen, bpfSize); ++ error("Truncated bpf packet: seglen=%d, bpfSize=%d", seglen, bpfSize); + clearPacketHeader(pkt); /* resets bpfSize and bpfOffset */ + return 0; + } +@@ -676,16 +644,14 @@ receivePacket(int sock, PPPoEPacket *pkt + data.len = 0; + + if ((retval = getmsg(sock, NULL, &data, &flags)) < 0) { +- sysErr("read (receivePacket)"); +- return -1; ++ fatal("receivePacket: getmsg: %m"); + } + + *size = data.len; + + #else + if ((*size = recv(sock, pkt, sizeof(PPPoEPacket), 0)) < 0) { +- sysErr("recv (receivePacket)"); +- return -1; ++ fatal("receivePacket: recv: %m"); + } + #endif + #endif +@@ -716,7 +682,7 @@ openInterface(char const *ifname, UINT16 + int ppa; + + if(strlen(ifname) > PATH_MAX) { +- rp_fatal("socket: string to long"); ++ fatal("openInterface: interface name too long"); + } + + ppa = atoi(&ifname[strlen(ifname)-1]); +@@ -729,9 +695,9 @@ openInterface(char const *ifname, UINT16 + if (( fd = open(base_dev, O_RDWR)) < 0) { + /* Give a more helpful message for the common error case */ + if (errno == EPERM) { +- rp_fatal("Cannot create raw socket -- pppoe must be run as root."); ++ fatal("Cannot create raw socket -- pppoe must be run as root."); + } +- fatalSys("socket"); ++ fatal("open(%s): %m", base_dev); + } + + /* rearranged order of DLPI code - delphys 20010803 */ +@@ -747,17 +713,18 @@ openInterface(char const *ifname, UINT16 + dl_abssaplen = ABS(dlp->info_ack.dl_sap_length); + dl_saplen = dlp->info_ack.dl_sap_length; + if (ETHERADDRL != (dlp->info_ack.dl_addr_length - dl_abssaplen)) +- fatalSys("invalid destination physical address length"); ++ fatal("invalid destination physical address length"); + dl_addrlen = dl_abssaplen + ETHERADDRL; + + /* ethernet address retrieved as part of DL_INFO_ACK - delphys 20010803 */ + memcpy(hwaddr, (u_char*)((char*)(dlp) + (int)(dlp->info_ack.dl_addr_offset)), ETHERADDRL); + + if ( strioctl(fd, DLIOCRAW, -1, 0, NULL) < 0 ) { +- fatalSys("DLIOCRAW"); ++ fatal("DLIOCRAW: %m"); + } + +- if (ioctl(fd, I_FLUSH, FLUSHR) < 0) fatalSys("I_FLUSH"); ++ if (ioctl(fd, I_FLUSH, FLUSHR) < 0) ++ fatal("I_FLUSH: %m"); + + return fd; + } +@@ -780,7 +747,7 @@ void dlpromisconreq(int fd, u_long level + flags = 0; + + if (putmsg(fd, &ctl, (struct strbuf*) NULL, flags) < 0) +- fatalSys("dlpromiscon: putmsg"); ++ fatal("dlpromiscon: putmsg: %m"); + + } + +@@ -799,7 +766,7 @@ void dlinforeq(int fd) + flags = RS_HIPRI; + + if (putmsg(fd, &ctl, (struct strbuf*) NULL, flags) < 0) +- fatalSys("dlinforeq: putmsg"); ++ fatal("dlinforeq: putmsg: %m"); + } + + void dlunitdatareq(int fd, u_char *addrp, int addrlen, u_long minpri, u_long maxpri, u_char *datap, int datalen) +@@ -827,7 +794,7 @@ void dlunitdatareq(int fd, u_char *addrp + data.buf = (char *) datap; + + if (putmsg(fd, &ctl, &data, 0) < 0) +- fatalSys("dlunitdatareq: putmsg"); ++ fatal("dlunitdatareq: putmsg: %m"); + } + + void dlinfoack(int fd, char *bufp) +@@ -847,18 +814,14 @@ void dlinfoack(int fd, char *bufp) + expecting(DL_INFO_ACK, dlp); + + if (ctl.len < sizeof (dl_info_ack_t)) { +- char buffer[256]; +- sprintf(buffer, "dlinfoack: response ctl.len too short: %d", ctl.len); +- rp_fatal(buffer); ++ fatal("dlinfoack: response ctl.len too short: %d", ctl.len); + } + + if (flags != RS_HIPRI) +- rp_fatal("dlinfoack: DL_INFO_ACK was not M_PCPROTO"); ++ fatal("dlinfoack: DL_INFO_ACK was not M_PCPROTO"); + + if (ctl.len < sizeof (dl_info_ack_t)) { +- char buffer[256]; +- sprintf(buffer, "dlinfoack: short response ctl.len: %d", ctl.len); +- rp_fatal(buffer); ++ fatal("dlinfoack: short response ctl.len: %d", ctl.len); + } + } + +@@ -882,7 +845,7 @@ void dlbindreq(int fd, u_long sap, u_lon + flags = 0; + + if (putmsg(fd, &ctl, (struct strbuf*) NULL, flags) < 0) +- fatalSys("dlbindreq: putmsg"); ++ fatal("dlbindreq: putmsg: %m"); + } + + void dlattachreq(int fd, u_long ppa) +@@ -901,7 +864,7 @@ void dlattachreq(int fd, u_long ppa) + flags = 0; + + if (putmsg(fd, &ctl, (struct strbuf*) NULL, flags) < 0) +- fatalSys("dlattachreq: putmsg"); ++ fatal("dlattachreq: putmsg: %m"); + } + + void dlokack(int fd, char *bufp) +@@ -921,18 +884,14 @@ void dlokack(int fd, char *bufp) + expecting(DL_OK_ACK, dlp); + + if (ctl.len < sizeof (dl_ok_ack_t)) { +- char buffer[256]; +- sprintf(buffer, "dlokack: response ctl.len too short: %d", ctl.len); +- rp_fatal(buffer); ++ fatal("dlokack: response ctl.len too short: %d", ctl.len); + } + + if (flags != RS_HIPRI) +- rp_fatal("dlokack: DL_OK_ACK was not M_PCPROTO"); ++ fatal("dlokack: DL_OK_ACK was not M_PCPROTO"); + + if (ctl.len < sizeof (dl_ok_ack_t)) { +- char buffer[256]; +- sprintf(buffer, "dlokack: short response ctl.len: %d", ctl.len); +- rp_fatal(buffer); ++ fatal("dlokack: short response ctl.len: %d", ctl.len); + } + } + +@@ -953,12 +912,10 @@ void dlbindack(int fd, char *bufp) + expecting(DL_BIND_ACK, dlp); + + if (flags != RS_HIPRI) +- rp_fatal("dlbindack: DL_OK_ACK was not M_PCPROTO"); ++ fatal("dlbindack: DL_OK_ACK was not M_PCPROTO"); + + if (ctl.len < sizeof (dl_bind_ack_t)) { +- char buffer[256]; +- sprintf(buffer, "dlbindack: short response ctl.len: %d", ctl.len); +- rp_fatal(buffer); ++ fatal("dlbindack: short response ctl.len: %d", ctl.len); + } + } + +@@ -989,8 +946,7 @@ void strgetmsg(int fd, struct strbuf *ct + */ + (void) signal(SIGALRM, sigalrm); + if (alarm(MAXWAIT) < 0) { +- (void) sprintf(errmsg, "%s: alarm", caller); +- fatalSys(errmsg); ++ fatal("%s: alarm", caller); + } + + /* +@@ -998,61 +954,48 @@ void strgetmsg(int fd, struct strbuf *ct + */ + *flagsp = 0; + if ((rc = getmsg(fd, ctlp, datap, flagsp)) < 0) { +- (void) sprintf(errmsg, "%s: getmsg", caller); +- fatalSys(errmsg); ++ fatal(errmsg, "%s: getmsg: %m", caller); + } + + /* + * Stop timer. + */ + if (alarm(0) < 0) { +- (void) sprintf(errmsg, "%s: alarm", caller); +- fatalSys(errmsg); ++ fatal("%s: alarm", caller); + } + + /* + * Check for MOREDATA and/or MORECTL. + */ + if ((rc & (MORECTL | MOREDATA)) == (MORECTL | MOREDATA)) { +- char buffer[256]; +- sprintf(buffer, "%s: MORECTL|MOREDATA", caller); +- rp_fatal(buffer); ++ fatal("%s: MORECTL|MOREDATA", caller); + } + + if (rc & MORECTL) { +- char buffer[256]; +- sprintf(buffer, "%s: MORECTL", caller); +- rp_fatal(buffer); ++ fatal("%s: MORECTL", caller); + } + + if (rc & MOREDATA) { +- char buffer[256]; +- sprintf(buffer, "%s: MOREDATA", caller); +- rp_fatal(buffer); ++ fatal("%s: MOREDATA", caller); + } + + /* + * Check for at least sizeof (long) control data portion. + */ + if (ctlp->len < sizeof (long)) { +- char buffer[256]; +- sprintf(buffer, "getmsg: control portion length < sizeof (long): %d", ctlp->len); +- rp_fatal(buffer); ++ fatal("getmsg: control portion length < sizeof (long): %d", ctlp->len); + } + } + + void sigalrm(int sig) + { +- (void) rp_fatal("sigalrm: TIMEOUT"); ++ fatal("sigalrm: TIMEOUT"); + } + + void expecting(int prim, union DL_primitives *dlp) + { + if (dlp->dl_primitive != (u_long)prim) { +- char buffer[256]; +- sprintf(buffer, "expected %s got %s", dlprim(prim), dlprim(dlp->dl_primitive)); +- rp_fatal(buffer); +- exit(1); ++ fatal("expected %s got %s", dlprim(prim), dlprim(dlp->dl_primitive)); + } + } + +diff -ruNp ppp-2.4.3.orig/pppd/plugins/rp-pppoe/Makefile.linux ppp-2.4.3/pppd/plugins/rp-pppoe/Makefile.linux +--- ppp-2.4.3.orig/pppd/plugins/rp-pppoe/Makefile.linux 2004-11-14 08:58:37.000000000 +0100 ++++ ppp-2.4.3/pppd/plugins/rp-pppoe/Makefile.linux 2005-03-11 01:48:27.000000000 +0100 +@@ -28,8 +28,8 @@ COPTS=-O2 -g + CFLAGS=$(COPTS) -I../../../include/linux + all: rp-pppoe.so pppoe-discovery + +-pppoe-discovery: libplugin.a pppoe-discovery.o +- $(CC) -o pppoe-discovery pppoe-discovery.o libplugin.a ++pppoe-discovery: pppoe-discovery.o utils.o libplugin.a ++ $(CC) -o pppoe-discovery pppoe-discovery.o utils.o libplugin.a + + pppoe-discovery.o: pppoe-discovery.c + $(CC) $(CFLAGS) '-DVERSION="$(VERSION)"' -c -o pppoe-discovery.o pppoe-discovery.c +diff -ruNp ppp-2.4.3.orig/pppd/plugins/rp-pppoe/plugin.c ppp-2.4.3/pppd/plugins/rp-pppoe/plugin.c +--- ppp-2.4.3.orig/pppd/plugins/rp-pppoe/plugin.c 2004-11-04 11:07:37.000000000 +0100 ++++ ppp-2.4.3/pppd/plugins/rp-pppoe/plugin.c 2005-03-11 02:12:39.000000000 +0100 +@@ -35,7 +35,6 @@ static char const RCSID[] = + #include "pppd/pathnames.h" + + #include <linux/types.h> +-#include <syslog.h> + #include <sys/ioctl.h> + #include <sys/types.h> + #include <sys/socket.h> +@@ -173,10 +172,8 @@ PPPOEConnectDevice(void) + (unsigned) conn->peerEth[5]); + + if (connect(conn->sessionSocket, (struct sockaddr *) &sp, +- sizeof(struct sockaddr_pppox)) < 0) { ++ sizeof(struct sockaddr_pppox)) < 0) + fatal("Failed to connect PPPoE socket: %d %m", errno); +- return -1; +- } + + return conn->sessionSocket; + } +@@ -365,11 +362,9 @@ plugin_init(void) + } + + add_options(Options); +- +- info("RP-PPPoE plugin version %s compiled against pppd %s", +- RP_VERSION, VERSION); + } + ++#ifdef unused + /********************************************************************** + *%FUNCTION: fatalSys + *%ARGUMENTS: +@@ -423,6 +418,7 @@ sysErr(char const *str) + { + rp_fatal(str); + } ++#endif + + + struct channel pppoe_channel = { +diff -ruNp ppp-2.4.3.orig/pppd/plugins/rp-pppoe/pppoe-discovery.c ppp-2.4.3/pppd/plugins/rp-pppoe/pppoe-discovery.c +--- ppp-2.4.3.orig/pppd/plugins/rp-pppoe/pppoe-discovery.c 2004-11-13 13:12:05.000000000 +0100 ++++ ppp-2.4.3/pppd/plugins/rp-pppoe/pppoe-discovery.c 2005-03-11 02:06:13.000000000 +0100 +@@ -17,14 +17,8 @@ + + #include "pppoe.h" + +-char *xstrdup(const char *s); + void usage(void); + +-void die(int status) +-{ +- exit(status); +-} +- + int main(int argc, char *argv[]) + { + int opt; +@@ -32,17 +26,17 @@ int main(int argc, char *argv[]) + + conn = malloc(sizeof(PPPoEConnection)); + if (!conn) +- fatalSys("malloc"); ++ fatal("malloc"); + + memset(conn, 0, sizeof(PPPoEConnection)); + + while ((opt = getopt(argc, argv, "I:D:VUAS:C:h")) > 0) { + switch(opt) { + case 'S': +- conn->serviceName = xstrdup(optarg); ++ conn->serviceName = strDup(optarg); + break; + case 'C': +- conn->acName = xstrdup(optarg); ++ conn->acName = strDup(optarg); + break; + case 'U': + conn->useHostUniq = 1; +@@ -57,7 +51,7 @@ int main(int argc, char *argv[]) + fprintf(conn->debugFile, "pppoe-discovery %s\n", VERSION); + break; + case 'I': +- conn->ifName = xstrdup(optarg); ++ conn->ifName = strDup(optarg); + break; + case 'A': + /* this is the default */ +@@ -74,7 +68,7 @@ int main(int argc, char *argv[]) + + /* default interface name */ + if (!conn->ifName) +- conn->ifName = strdup("eth0"); ++ conn->ifName = strDup("eth0"); + + conn->discoverySocket = -1; + conn->sessionSocket = -1; +@@ -84,39 +78,6 @@ int main(int argc, char *argv[]) + exit(0); + } + +-void rp_fatal(char const *str) +-{ +- char buf[1024]; +- +- printErr(str); +- sprintf(buf, "pppoe-discovery: %.256s", str); +- exit(1); +-} +- +-void fatalSys(char const *str) +-{ +- char buf[1024]; +- int i = errno; +- +- sprintf(buf, "%.256s: %.256s", str, strerror(i)); +- printErr(buf); +- sprintf(buf, "pppoe-discovery: %.256s: %.256s", str, strerror(i)); +- exit(1); +-} +- +-void sysErr(char const *str) +-{ +- rp_fatal(str); +-} +- +-char *xstrdup(const char *s) +-{ +- register char *ret = strdup(s); +- if (!ret) +- sysErr("strdup"); +- return ret; +-} +- + void usage(void) + { + fprintf(stderr, "Usage: pppoe-discovery [options]\n"); +diff -ruNp ppp-2.4.3.orig/pppd/plugins/rp-pppoe/pppoe.h ppp-2.4.3/pppd/plugins/rp-pppoe/pppoe.h +--- ppp-2.4.3.orig/pppd/plugins/rp-pppoe/pppoe.h 2004-11-04 11:07:37.000000000 +0100 ++++ ppp-2.4.3/pppd/plugins/rp-pppoe/pppoe.h 2005-03-11 02:08:00.000000000 +0100 +@@ -307,12 +307,18 @@ void discovery(PPPoEConnection *conn); + unsigned char *findTag(PPPoEPacket *packet, UINT16_t tagType, + PPPoETag *tag); + ++void dbglog(char *, ...); /* log a debug message */ ++void info(char *, ...); /* log an informational message */ ++void warn(char *, ...); /* log a warning message */ ++void error(char *, ...); /* log an error message */ ++void fatal(char *, ...); /* log an error message and die(1) */ ++ + #define SET_STRING(var, val) do { if (var) free(var); var = strDup(val); } while(0); + + #define CHECK_ROOM(cursor, start, len) \ + do {\ + if (((cursor)-(start))+(len) > MAX_PPPOE_PAYLOAD) { \ +- syslog(LOG_ERR, "Would create too-long packet"); \ ++ error("Would create too-long packet"); \ + return; \ + } \ + } while(0) +diff -ruNp ppp-2.4.3.orig/pppd/plugins/rp-pppoe/utils.c ppp-2.4.3/pppd/plugins/rp-pppoe/utils.c +--- ppp-2.4.3.orig/pppd/plugins/rp-pppoe/utils.c 1970-01-01 01:00:00.000000000 +0100 ++++ ppp-2.4.3/pppd/plugins/rp-pppoe/utils.c 2005-03-11 02:07:57.000000000 +0100 +@@ -0,0 +1,62 @@ ++#include <stdio.h> ++#include <stdlib.h> ++#include <unistd.h> ++#include <stdarg.h> ++#include <syslog.h> ++ ++void dbglog(const char *fmt, ...) ++{ ++ va_list ap; ++ ++ va_start(ap, fmt); ++ vsyslog(LOG_DEBUG, fmt, ap); ++ vfprintf(stderr, fmt, ap); ++ fputs("\n", stderr); ++ va_end(ap); ++} ++ ++void info(const char *fmt, ...) ++{ ++ va_list ap; ++ ++ va_start(ap, fmt); ++ vsyslog(LOG_INFO, fmt, ap); ++ vfprintf(stderr, fmt, ap); ++ fputs("\n", stderr); ++ va_end(ap); ++} ++ ++void warn(const char *fmt, ...) ++{ ++ va_list ap; ++ ++ va_start(ap, fmt); ++ vsyslog(LOG_WARNING, fmt, ap); ++ vfprintf(stderr, fmt, ap); ++ fputs("\n", stderr); ++ va_end(ap); ++} ++ ++void error(const char *fmt, ...) ++{ ++ va_list ap; ++ ++ va_start(ap, fmt); ++ vsyslog(LOG_ERR, fmt, ap); ++ vfprintf(stderr, fmt, ap); ++ fputs("\n", stderr); ++ va_end(ap); ++} ++ ++void fatal(const char *fmt, ...) ++{ ++ va_list ap; ++ ++ va_start(ap, fmt); ++ vsyslog(LOG_ERR, fmt, ap); ++ vfprintf(stderr, fmt, ap); ++ fputs("\n", stderr); ++ va_end(ap); ++ exit(1); ++} ++ diff --git a/package/ppp/patches/104-debian_fix_linkpidfile.patch b/package/ppp/patches/104-debian_fix_linkpidfile.patch new file mode 100644 index 0000000000..9e32adcae1 --- /dev/null +++ b/package/ppp/patches/104-debian_fix_linkpidfile.patch @@ -0,0 +1,43 @@ +Subject: Bug#284382: ppp: linkpidfile is not created upon detachment +From: <herbert@gondor.apana.org.au> + +Package: ppp +Version: 2.4.2+20040428-2 +Severity: wishlist + +When pppd detaches from the parent normally, that is, without nodetach +or updetach set, the linkpidfile is not created even when linkname is +set. + +This is because the create_linkpidfile call in detach() is only made +if the linkpidfile is filled in. However, linkpidfile is never filled +in until create_linkpidfile has been called. + +IMHO the call should be made uncondtionally in detach() since +create_linkpidfile does its own check on linkname anyway. + +Please note that the version of pppd in woody always wrote the +linkpidfile after detaching. It did so in main() however. That +call has now been removed which is why I'm seeing this problem. + +[...] + +-- +Index: pppd/main.c +=================================================================== +RCS file: /var/cvs/snwb/packages/ppp/pppd/main.c,v +retrieving revision 1.11 +diff -u -r1.11 main.c +--- ppp/pppd/main.c 29 Nov 2004 22:49:23 -0000 1.11 ++++ ppp/pppd/main.c 5 Dec 2004 23:59:58 -0000 +@@ -819,8 +819,7 @@ + /* update pid files if they have been written already */ + if (pidfilename[0]) + create_pidfile(pid); +- if (linkpidfile[0]) +- create_linkpidfile(pid); ++ create_linkpidfile(pid); + exit(0); /* parent dies */ + } + setsid(); + diff --git a/package/ppp/patches/105-debian_pppoatm_cleanup.patch b/package/ppp/patches/105-debian_pppoatm_cleanup.patch new file mode 100644 index 0000000000..2437a12003 --- /dev/null +++ b/package/ppp/patches/105-debian_pppoatm_cleanup.patch @@ -0,0 +1,95 @@ +diff -ruNp ppp-2.4.3.orig/pppd/plugins/pppoatm/pppoatm.c ppp-2.4.3/pppd/plugins/pppoatm/pppoatm.c +--- ppp-2.4.3.orig/pppd/plugins/pppoatm/pppoatm.c 2005-03-22 14:44:18.000000000 +0100 ++++ ppp-2.4.3/pppd/plugins/pppoatm/pppoatm.c 2005-03-22 14:44:02.000000000 +0100 +@@ -70,18 +70,20 @@ static int setdevname_pppoatm(const char + { + struct sockaddr_atmpvc addr; + extern struct stat devstat; ++ + if (device_got_set) + return 0; +- //info("PPPoATM setdevname_pppoatm: '%s'", cp); ++ + memset(&addr, 0, sizeof addr); + if (text2atm(cp, (struct sockaddr *) &addr, sizeof(addr), + T2A_PVC | T2A_NAME) < 0) { +- if(doit) +- info("atm does not recognize: %s", cp); ++ if (doit) ++ info("cannot parse the ATM address: %s", cp); + return 0; +- } +- if (!doit) return 1; +- //if (!dev_set_ok()) return -1; ++ } ++ if (!doit) ++ return 1; ++ + memcpy(&pvcaddr, &addr, sizeof pvcaddr); + strlcpy(devnam, cp, sizeof devnam); + devstat.st_mode = S_IFSOCK; +@@ -93,7 +95,6 @@ static int setdevname_pppoatm(const char + lcp_allowoptions[0].neg_asyncmap = 0; + lcp_wantoptions[0].neg_pcompression = 0; + } +- info("PPPoATM setdevname_pppoatm - SUCCESS:%s", cp); + device_got_set = 1; + return 1; + } +@@ -108,6 +109,7 @@ static void no_device_given_pppoatm(void + static void set_line_discipline_pppoatm(int fd) + { + struct atm_backend_ppp be; ++ + be.backend_num = ATM_BACKEND_PPP; + if (!llc_encaps) + be.encaps = PPPOATM_ENCAPS_VC; +@@ -115,6 +117,7 @@ static void set_line_discipline_pppoatm( + be.encaps = PPPOATM_ENCAPS_LLC; + else + be.encaps = PPPOATM_ENCAPS_AUTODETECT; ++ + if (ioctl(fd, ATM_SETBACKEND, &be) < 0) + fatal("ioctl(ATM_SETBACKEND): %m"); + } +@@ -179,16 +182,19 @@ static void send_config_pppoa(int mtu, + { + int sock; + struct ifreq ifr; ++ + if (mtu > pppoatm_max_mtu) + error("Couldn't increase MTU to %d", mtu); ++ + sock = socket(AF_INET, SOCK_DGRAM, 0); + if (sock < 0) + fatal("Couldn't create IP socket: %m"); ++ + strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); + ifr.ifr_mtu = mtu; + if (ioctl(sock, SIOCSIFMTU, (caddr_t) &ifr) < 0) + fatal("ioctl(SIOCSIFMTU): %m"); +- (void) close (sock); ++ close(sock); + } + + static void recv_config_pppoa(int mru, +@@ -202,7 +208,7 @@ static void recv_config_pppoa(int mru, + + void plugin_init(void) + { +-#if defined(__linux__) ++#ifdef linux + extern int new_style_driver; /* From sys-linux.c */ + if (!ppp_available() && !new_style_driver) + fatal("Kernel doesn't support ppp_generic - " +@@ -210,9 +216,9 @@ void plugin_init(void) + #else + fatal("No PPPoATM support on this OS"); + #endif +- info("PPPoATM plugin_init"); + add_options(pppoa_options); + } ++ + struct channel pppoa_channel = { + options: pppoa_options, + process_extra_options: NULL, diff --git a/package/ppp/patches/106-debian_pppoatm_fix_mtu.patch b/package/ppp/patches/106-debian_pppoatm_fix_mtu.patch new file mode 100644 index 0000000000..ef28b5cf2b --- /dev/null +++ b/package/ppp/patches/106-debian_pppoatm_fix_mtu.patch @@ -0,0 +1,31 @@ +diff -ruNp ppp-2.4.3.orig/pppd/plugins/pppoatm/pppoatm.c ppp-2.4.3/pppd/plugins/pppoatm/pppoatm.c +--- ppp-2.4.3.orig/pppd/plugins/pppoatm/pppoatm.c 2005-05-04 02:00:28.000000000 +0200 ++++ ppp-2.4.3/pppd/plugins/pppoatm/pppoatm.c 2005-05-04 01:59:11.000000000 +0200 +@@ -183,8 +183,11 @@ static void send_config_pppoa(int mtu, + int sock; + struct ifreq ifr; + +- if (mtu > pppoatm_max_mtu) +- error("Couldn't increase MTU to %d", mtu); ++ if (pppoatm_max_mtu && mtu > pppoatm_max_mtu) { ++ warn("Couldn't increase MTU to %d. Using %d", ++ mtu, pppoatm_max_mtu); ++ mtu = pppoatm_max_mtu; ++ } + + sock = socket(AF_INET, SOCK_DGRAM, 0); + if (sock < 0) +@@ -202,8 +205,11 @@ static void recv_config_pppoa(int mru, + int pcomp, + int accomp) + { +- if (mru > pppoatm_max_mru) +- error("Couldn't increase MRU to %d", mru); ++ if (pppoatm_max_mru && mru > pppoatm_max_mru) { ++ warn("Couldn't increase MRU to %d. Using %d", ++ mru, pppoatm_max_mru); ++ mru = pppoatm_max_mru; ++ } + } + + void plugin_init(void) diff --git a/package/ppp/patches/107-debian_stripMSdomain.patch b/package/ppp/patches/107-debian_stripMSdomain.patch new file mode 100644 index 0000000000..d52e38645d --- /dev/null +++ b/package/ppp/patches/107-debian_stripMSdomain.patch @@ -0,0 +1,35 @@ +diff -ruN ppp.orig/pppd/chap-new.c ppp/pppd/chap-new.c +--- ppp.orig/pppd/chap-new.c 2003-11-27 23:25:17.000000000 +0100 ++++ ppp/pppd/chap-new.c 2003-12-02 12:26:21.000000000 +0100 +@@ -57,6 +57,7 @@ + int chap_timeout_time = 3; + int chap_max_transmits = 10; + int chap_rechallenge_time = 0; ++int chapms_strip_domain = 0; + + /* + * Command-line options. +@@ -68,6 +69,8 @@ + "Set max #xmits for challenge", OPT_PRIO }, + { "chap-interval", o_int, &chap_rechallenge_time, + "Set interval for rechallenge", OPT_PRIO }, ++ { "chapms-strip-domain", o_bool, &chapms_strip_domain, ++ "Strip the domain prefix before the Username", 1 }, + { NULL } + }; + +@@ -338,6 +341,14 @@ + /* Null terminate and clean remote name. */ + slprintf(rname, sizeof(rname), "%.*v", len, name); + name = rname; ++ ++ /* strip the MS domain name */ ++ if (chapms_strip_domain && strrchr(rname, '\\')) { ++ char tmp[MAXNAMELEN+1]; ++ ++ strcpy(tmp, strrchr(rname, '\\') + 1); ++ strcpy(rname, tmp); ++ } + } + + if (chap_verify_hook) diff --git a/package/ppp/patches/108-debian_defaultroute.patch b/package/ppp/patches/108-debian_defaultroute.patch new file mode 100644 index 0000000000..76b444e4b2 --- /dev/null +++ b/package/ppp/patches/108-debian_defaultroute.patch @@ -0,0 +1,253 @@ +--- ppp/pppd/ipcp.c Wed May 31 17:20:41 2000 ++++ ppp/pppd/ipcp.c Wed May 31 17:27:19 2000 +@@ -145,7 +145,17 @@ + { "-defaultroute", o_bool, &ipcp_allowoptions[0].default_route, + "disable defaultroute option", OPT_A2COPY, + &ipcp_wantoptions[0].default_route }, + ++#ifdef __linux__ ++ { "replacedefaultroute", o_bool, ++ &ipcp_wantoptions[0].replace_default_route, ++ "Replace default route", 1 ++ }, ++ { "noreplacedefaultroute", o_bool, ++ &ipcp_allowoptions[0].replace_default_route, ++ "Never replace default route", OPT_A2COPY, ++ &ipcp_wantoptions[0].replace_default_route }, ++#endif + { "proxyarp", o_bool, &ipcp_wantoptions[0].proxy_arp, + "Add proxy ARP entry", OPT_ENABLE|1, &ipcp_allowoptions[0].proxy_arp }, + { "noproxyarp", o_bool, &ipcp_allowoptions[0].proxy_arp, +@@ -195,7 +205,7 @@ + ip_active_pkt + }; + +-static void ipcp_clear_addrs __P((int, u_int32_t, u_int32_t)); ++static void ipcp_clear_addrs __P((int, u_int32_t, u_int32_t, bool)); + static void ipcp_script __P((char *)); /* Run an up/down script */ + static void ipcp_script_done __P((void *)); + +@@ -1344,7 +1354,12 @@ + if (!sifnpmode(u, PPP_IP, NPMODE_QUEUE)) + return 0; + if (wo->default_route) ++#ifndef __linux__ + if (sifdefaultroute(u, wo->ouraddr, wo->hisaddr)) ++#else ++ if (sifdefaultroute(u, wo->ouraddr, wo->hisaddr, ++ wo->replace_default_route)) ++#endif + default_route_set[u] = 1; + if (wo->proxy_arp) + if (sifproxyarp(u, wo->hisaddr)) +@@ -1420,7 +1435,8 @@ + */ + if (demand) { + if (go->ouraddr != wo->ouraddr || ho->hisaddr != wo->hisaddr) { +- ipcp_clear_addrs(f->unit, wo->ouraddr, wo->hisaddr); ++ ipcp_clear_addrs(f->unit, wo->ouraddr, wo->hisaddr, ++ wo->replace_default_route); + if (go->ouraddr != wo->ouraddr) { + warn("Local IP address changed to %I", go->ouraddr); + script_setenv("OLDIPLOCAL", ip_ntoa(wo->ouraddr)); +@@ -1445,7 +1461,12 @@ + + /* assign a default route through the interface if required */ + if (ipcp_wantoptions[f->unit].default_route) ++#ifndef __linux__ + if (sifdefaultroute(f->unit, go->ouraddr, ho->hisaddr)) ++#else ++ if (sifdefaultroute(f->unit, go->ouraddr, ho->hisaddr, ++ wo->replace_default_route)) ++#endif + default_route_set[f->unit] = 1; + + /* Make a proxy ARP entry if requested. */ +@@ -1492,7 +1513,12 @@ + + /* assign a default route through the interface if required */ + if (ipcp_wantoptions[f->unit].default_route) ++#ifndef __linux__ + if (sifdefaultroute(f->unit, go->ouraddr, ho->hisaddr)) ++#else ++ if (sifdefaultroute(f->unit, go->ouraddr, ho->hisaddr, ++ wo->replace_default_route)) ++#endif + default_route_set[f->unit] = 1; + + /* Make a proxy ARP entry if requested. */ +@@ -1559,7 +1585,7 @@ + sifnpmode(f->unit, PPP_IP, NPMODE_DROP); + sifdown(f->unit); + ipcp_clear_addrs(f->unit, ipcp_gotoptions[f->unit].ouraddr, +- ipcp_hisoptions[f->unit].hisaddr); ++ ipcp_hisoptions[f->unit].hisaddr, 0); + } + + /* Execute the ip-down script */ +@@ -1575,16 +1601,25 @@ + * proxy arp entries, etc. + */ + static void +-ipcp_clear_addrs(unit, ouraddr, hisaddr) ++ipcp_clear_addrs(unit, ouraddr, hisaddr, replacedefaultroute) + int unit; + u_int32_t ouraddr; /* local address */ + u_int32_t hisaddr; /* remote address */ ++ bool replacedefaultroute; + { + if (proxy_arp_set[unit]) { + cifproxyarp(unit, hisaddr); + proxy_arp_set[unit] = 0; + } +- if (default_route_set[unit]) { ++ /* If replacedefaultroute, sifdefaultroute will be called soon ++ * with replacedefaultroute set and that will overwrite the current ++ * default route. This is the case only when doing demand, otherwise ++ * during demand, this cifdefaultroute would restore the old default ++ * route which is not what we want in this case. In the non-demand ++ * case, we'll delete the default route and restore the old if there ++ * is one saved by an sifdefaultroute with replacedefaultroute. ++ */ ++ if (!replacedefaultroute && default_route_set[unit]) { + cifdefaultroute(unit, ouraddr, hisaddr); + default_route_set[unit] = 0; + } +--- ppp/pppd/ipcp.h Wed May 31 17:20:41 2000 ++++ ppp/pppd/ipcp.h Wed May 31 15:56:17 2000 +@@ -47,6 +47,7 @@ + bool old_addrs; /* Use old (IP-Addresses) option? */ + bool req_addr; /* Ask peer to send IP address? */ + bool default_route; /* Assign default route through interface? */ ++ bool replace_default_route; /* Replace default route through interface? */ + bool proxy_arp; /* Make proxy ARP entry for peer? */ + bool neg_vj; /* Van Jacobson Compression? */ + bool old_vj; /* use old (short) form of VJ option? */ +--- ppp/pppd/pppd.h Wed May 31 17:20:41 2000 ++++ ppp/pppd/pppd.h Wed May 31 15:56:17 2000 +@@ -416,7 +416,11 @@ + int cif6addr __P((int, eui64_t, eui64_t)); + /* Remove an IPv6 address from i/f */ + #endif ++#ifndef __linux__ + int sifdefaultroute __P((int, u_int32_t, u_int32_t)); ++#else ++int sifdefaultroute __P((int, u_int32_t, u_int32_t, bool replace_default_rt)); ++#endif + /* Create default route through i/f */ + int cifdefaultroute __P((int, u_int32_t, u_int32_t)); + /* Delete default route through i/f */ +--- ppp/pppd/sys-linux.c Wed May 31 17:20:41 2000 ++++ ppp/pppd/sys-linux.c Wed May 31 17:37:23 2000 +@@ -143,6 +143,8 @@ + + static int if_is_up; /* Interface has been marked up */ + static u_int32_t default_route_gateway; /* Gateway for default route added */ ++static struct rtentry old_def_rt; /* Old default route */ ++static int default_rt_repl_rest; /* replace and restore old default rt */ + static u_int32_t proxy_arp_addr; /* Addr for proxy arp entry added */ + static char proxy_arp_dev[16]; /* Device for proxy arp entry */ + static u_int32_t our_old_addr; /* for detecting address changes */ +@@ -1209,6 +1211,9 @@ + p = NULL; + } + ++ SET_SA_FAMILY (rt->rt_dst, AF_INET); ++ SET_SA_FAMILY (rt->rt_gateway, AF_INET); ++ + SIN_ADDR(rt->rt_dst) = strtoul(cols[route_dest_col], NULL, 16); + SIN_ADDR(rt->rt_gateway) = strtoul(cols[route_gw_col], NULL, 16); + SIN_ADDR(rt->rt_genmask) = strtoul(cols[route_mask_col], NULL, 16); +@@ -1278,19 +1283,53 @@ + /******************************************************************** + * + * sifdefaultroute - assign a default route through the address given. ++ * ++ * If the global default_rt_repl_rest flag is set, then this function ++ * already replaced the original system defaultroute with some other ++ * route and it should just replace the current defaultroute with ++ * another one, without saving the current route. Use: demand mode, ++ * when pppd sets first a defaultroute it it's temporary ppp0 addresses ++ * and then changes the temporary addresses to the addresses for the real ++ * ppp connection when it has come up. + */ + +-int sifdefaultroute (int unit, u_int32_t ouraddr, u_int32_t gateway) ++int sifdefaultroute (int unit, u_int32_t ouraddr, u_int32_t gateway, bool replace) + { +- struct rtentry rt; +- +- if (defaultroute_exists(&rt) && strcmp(rt.rt_dev, ifname) != 0) { +- u_int32_t old_gateway = SIN_ADDR(rt.rt_gateway); ++ struct rtentry rt, tmp_rt; ++ struct rtentry *del_rt = NULL; + +- if (old_gateway != gateway) +- error("not replacing existing default route to %s [%I]", +- rt.rt_dev, old_gateway); +- return 0; ++ ++ if (default_rt_repl_rest) { ++ /* We have already reclaced the original defaultroute, if we ++ * are called again, we will delete the current default route ++ * and set the new default route in this function. ++ * - this is normally only the case the doing demand: */ ++ if (defaultroute_exists( &tmp_rt )) ++ del_rt = &tmp_rt; ++ } else if ( defaultroute_exists( &old_def_rt ) && ++ strcmp( old_def_rt.rt_dev, ifname ) != 0) { ++ /* We did not yet replace an existing default route, let's ++ * check if we should save and replace a default route: ++ */ ++ u_int32_t old_gateway = SIN_ADDR(old_def_rt.rt_gateway); ++ ++ if (old_gateway != gateway) { ++ if (!replace) { ++ error("not replacing default route to %s [%I]", ++ old_def_rt.rt_dev, old_gateway); ++ return 0; ++ } else { ++ // we need to copy rt_dev because we need it permanent too: ++ char * tmp_dev = malloc(strlen(old_def_rt.rt_dev)+1); ++ strcpy(tmp_dev, old_def_rt.rt_dev); ++ old_def_rt.rt_dev = tmp_dev; ++ ++ notice("replacing old default route to %s [%I]", ++ old_def_rt.rt_dev, old_gateway); ++ default_rt_repl_rest = 1; ++ del_rt = &old_def_rt; ++ } ++ } + } + + memset (&rt, '\0', sizeof (rt)); +@@ -1310,6 +1349,12 @@ + error("default route ioctl(SIOCADDRT): %m(%d)", errno); + return 0; + } ++ if (default_rt_repl_rest && del_rt) ++ if (ioctl(sock_fd, SIOCDELRT, del_rt) < 0) { ++ if ( ! ok_error ( errno )) ++ error("del old default route ioctl(SIOCDELRT): %m(%d)", errno); ++ return 0; ++ } + + default_route_gateway = gateway; + return 1; +@@ -1344,6 +1389,16 @@ + error("default route ioctl(SIOCDELRT): %m (%d)", errno); + return 0; + } ++ } ++ if (default_rt_repl_rest) { ++ notice("restoring old default route to %s [%I]", ++ old_def_rt.rt_dev, SIN_ADDR(old_def_rt.rt_gateway)); ++ if (ioctl(sock_fd, SIOCADDRT, &old_def_rt) < 0) { ++ if ( ! ok_error ( errno )) ++ error("restore default route ioctl(SIOCADDRT): %m(%d)", errno); ++ return 0; ++ } ++ default_rt_repl_rest = 0; + } + + return 1; diff --git a/package/ppp/patches/109-debian_demand.patch b/package/ppp/patches/109-debian_demand.patch new file mode 100644 index 0000000000..e024696697 --- /dev/null +++ b/package/ppp/patches/109-debian_demand.patch @@ -0,0 +1,172 @@ +--- ppp/pppd/demand.c ++++ ppp/pppd/demand.c 2000/06/28 14:54:04 +@@ -25,6 +25,8 @@ + #include <errno.h> + #include <fcntl.h> + #include <netdb.h> ++#include <unistd.h> ++#include <syslog.h> + #include <sys/param.h> + #include <sys/types.h> + #include <sys/wait.h> +@@ -32,6 +34,8 @@ + #include <sys/resource.h> + #include <sys/stat.h> + #include <sys/socket.h> ++#include <netinet/in.h> ++#include <arpa/inet.h> + #ifdef PPP_FILTER + #include <net/if.h> + #include <net/bpf.h> +@@ -210,6 +214,14 @@ + int c, rv; + + rv = 0; ++ ++/* check for synchronous connection... */ ++ ++ if ( (p[0] == 0xFF) && (p[1] == 0x03) ) { ++ rv = loop_frame(p,n); ++ return rv; ++ } ++ + for (; n > 0; --n) { + c = *p++; + if (c == PPP_FLAG) { +@@ -288,17 +300,102 @@ + * loopback, now that the real serial link is up. + */ + void +-demand_rexmit(proto) ++demand_rexmit(proto, newip) + int proto; ++ u_int32_t newip; + { + struct packet *pkt, *prev, *nextpkt; ++ unsigned short checksum; ++ unsigned short pkt_checksum = 0; ++ unsigned iphdr; ++ struct timeval tv; ++ char cv = 0; ++ char ipstr[16]; + + prev = NULL; + pkt = pend_q; + pend_q = NULL; ++ tv.tv_sec = 1; ++ tv.tv_usec = 0; ++ select(0,NULL,NULL,NULL,&tv); /* Sleep for 1 Seconds */ + for (; pkt != NULL; pkt = nextpkt) { + nextpkt = pkt->next; + if (PPP_PROTOCOL(pkt->data) == proto) { ++ if ( (proto == PPP_IP) && newip ) { ++ /* Get old checksum */ ++ ++ iphdr = (pkt->data[4] & 15) << 2; ++ checksum = *((unsigned short *) (pkt->data+14)); ++ if (checksum == 0xFFFF) { ++ checksum = 0; ++ } ++ ++ ++ if (pkt->data[13] == 17) { ++ pkt_checksum = *((unsigned short *) (pkt->data+10+iphdr)); ++ if (pkt_checksum) { ++ cv = 1; ++ if (pkt_checksum == 0xFFFF) { ++ pkt_checksum = 0; ++ } ++ } ++ else { ++ cv = 0; ++ } ++ } ++ ++ if (pkt->data[13] == 6) { ++ pkt_checksum = *((unsigned short *) (pkt->data+20+iphdr)); ++ cv = 1; ++ if (pkt_checksum == 0xFFFF) { ++ pkt_checksum = 0; ++ } ++ } ++ ++ /* Delete old Source-IP-Address */ ++ checksum -= *((unsigned short *) (pkt->data+16)) ^ 0xFFFF; ++ checksum -= *((unsigned short *) (pkt->data+18)) ^ 0xFFFF; ++ ++ pkt_checksum -= *((unsigned short *) (pkt->data+16)) ^ 0xFFFF; ++ pkt_checksum -= *((unsigned short *) (pkt->data+18)) ^ 0xFFFF; ++ ++ /* Change Source-IP-Address */ ++ * ((u_int32_t *) (pkt->data + 16)) = newip; ++ ++ /* Add new Source-IP-Address */ ++ checksum += *((unsigned short *) (pkt->data+16)) ^ 0xFFFF; ++ checksum += *((unsigned short *) (pkt->data+18)) ^ 0xFFFF; ++ ++ pkt_checksum += *((unsigned short *) (pkt->data+16)) ^ 0xFFFF; ++ pkt_checksum += *((unsigned short *) (pkt->data+18)) ^ 0xFFFF; ++ ++ /* Write new checksum */ ++ if (!checksum) { ++ checksum = 0xFFFF; ++ } ++ *((unsigned short *) (pkt->data+14)) = checksum; ++ if (pkt->data[13] == 6) { ++ *((unsigned short *) (pkt->data+20+iphdr)) = pkt_checksum; ++ } ++ if (cv && (pkt->data[13] == 17) ) { ++ *((unsigned short *) (pkt->data+10+iphdr)) = pkt_checksum; ++ } ++ ++ /* Log Packet */ ++ strcpy(ipstr,inet_ntoa(*( (struct in_addr *) (pkt->data+16)))); ++ if (pkt->data[13] == 1) { ++ syslog(LOG_INFO,"Open ICMP %s -> %s\n", ++ ipstr, ++ inet_ntoa(*( (struct in_addr *) (pkt->data+20)))); ++ } else { ++ syslog(LOG_INFO,"Open %s %s:%d -> %s:%d\n", ++ pkt->data[13] == 6 ? "TCP" : "UDP", ++ ipstr, ++ ntohs(*( (short *) (pkt->data+iphdr+4))), ++ inet_ntoa(*( (struct in_addr *) (pkt->data+20))), ++ ntohs(*( (short *) (pkt->data+iphdr+6)))); ++ } ++ } + output(0, pkt->data, pkt->length); + free(pkt); + } else { +--- ppp/pppd/ipcp.c ++++ ppp/pppd/ipcp.c 2000/06/28 12:32:05 +@@ -1454,7 +1454,7 @@ + proxy_arp_set[f->unit] = 1; + + } +- demand_rexmit(PPP_IP); ++ demand_rexmit(PPP_IP,go->ouraddr); + sifnpmode(f->unit, PPP_IP, NPMODE_PASS); + + } else { +--- ppp/pppd/ipv6cp.c ++++ ppp/pppd/ipv6cp.c 2000/06/28 12:32:06 +@@ -1153,7 +1153,7 @@ + } + + } +- demand_rexmit(PPP_IPV6); ++ demand_rexmit(PPP_IPV6,0); + sifnpmode(f->unit, PPP_IPV6, NPMODE_PASS); + + } else { +--- ppp/pppd/pppd.h ++++ ppp/pppd/pppd.h 2000/06/28 12:32:06 +@@ -359,7 +359,7 @@ + void demand_block __P((void)); /* set all NPs to queue up packets */ + void demand_unblock __P((void)); /* set all NPs to pass packets */ + void demand_discard __P((void)); /* set all NPs to discard packets */ +-void demand_rexmit __P((int)); /* retransmit saved frames for an NP */ ++void demand_rexmit __P((int, u_int32_t)); /* retransmit saved frames for an NP*/ + int loop_chars __P((unsigned char *, int)); /* process chars from loopback */ + int loop_frame __P((unsigned char *, int)); /* should we bring link up? */ + diff --git a/package/ppp/patches/200-makefile.patch b/package/ppp/patches/200-makefile.patch new file mode 100644 index 0000000000..5bbf8602d1 --- /dev/null +++ b/package/ppp/patches/200-makefile.patch @@ -0,0 +1,53 @@ +diff -ruN ppp-2.4.3-orig/pppd/Makefile.linux ppp-2.4.3-3/pppd/Makefile.linux +--- ppp-2.4.3-orig/pppd/Makefile.linux 2004-11-13 13:02:22.000000000 +0100 ++++ ppp-2.4.3-3/pppd/Makefile.linux 2004-12-16 04:43:41.000000000 +0100 +@@ -48,19 +48,19 @@ + # Uncomment the next line to include support for PPP packet filtering. + # This requires that the libpcap library and headers be installed + # and that the kernel driver support PPP packet filtering. +-FILTER=y ++#FILTER=y + + # Uncomment the next line to enable multilink PPP (enabled by default) + # Linux distributions: Please leave multilink ENABLED in your builds + # of pppd! +-HAVE_MULTILINK=y ++#HAVE_MULTILINK=y + + # Uncomment the next line to enable the TDB database (enabled by default.) + # If you enable multilink, then TDB is automatically enabled also. + # Linux distributions: Please leave TDB ENABLED in your builds. +-USE_TDB=y ++#USE_TDB=y + +-HAS_SHADOW=y ++#HAS_SHADOW=y + #USE_PAM=y + #HAVE_INET6=y + +@@ -77,7 +77,7 @@ + + INCLUDE_DIRS= -I../include + +-COMPILE_FLAGS= -DHAVE_PATHS_H -DIPX_CHANGE -DHAVE_MMAP ++COMPILE_FLAGS= -DHAVE_PATHS_H -DHAVE_MMAP + + CFLAGS= $(COPTS) $(COMPILE_FLAGS) $(INCLUDE_DIRS) + +@@ -117,12 +117,12 @@ + #LIBS += -lshadow $(LIBS) + endif + +-ifneq ($(wildcard /usr/include/crypt.h),) ++#ifneq ($(wildcard /usr/include/crypt.h),) + CFLAGS += -DHAVE_CRYPT_H=1 +-endif +-ifneq ($(wildcard /usr/lib/libcrypt.*),) ++#endif ++#ifneq ($(wildcard /usr/lib/libcrypt.*),) + LIBS += -lcrypt +-endif ++#endif + + ifdef NEEDDES + ifndef USE_CRYPT diff --git a/package/ppp/patches/201-mppe_mppc_1.1.patch b/package/ppp/patches/201-mppe_mppc_1.1.patch new file mode 100644 index 0000000000..7e09f1a792 --- /dev/null +++ b/package/ppp/patches/201-mppe_mppc_1.1.patch @@ -0,0 +1,1585 @@ +diff -ruN ppp-2.4.3.orig/include/linux/ppp-comp.h ppp-2.4.3/include/linux/ppp-comp.h +--- ppp-2.4.3.orig/include/linux/ppp-comp.h 2002-12-06 10:49:15.000000000 +0100 ++++ ppp-2.4.3/include/linux/ppp-comp.h 2004-11-21 13:54:09.000000000 +0100 +@@ -36,7 +36,7 @@ + */ + + /* +- * ==FILEVERSION 20020319== ++ * ==FILEVERSION 20020715== + * + * NOTE TO MAINTAINERS: + * If you modify this file at all, please set the above date. +@@ -86,7 +86,7 @@ + + /* Compress a packet */ + int (*compress) (void *state, unsigned char *rptr, +- unsigned char *obuf, int isize, int osize); ++ unsigned char *obuf, int isize, int osize); + + /* Return compression statistics */ + void (*comp_stat) (void *state, struct compstat *stats); +@@ -107,7 +107,7 @@ + + /* Decompress a packet. */ + int (*decompress) (void *state, unsigned char *ibuf, int isize, +- unsigned char *obuf, int osize); ++ unsigned char *obuf, int osize); + + /* Update state for an incompressible packet received */ + void (*incomp) (void *state, unsigned char *ibuf, int icnt); +@@ -288,6 +288,33 @@ + opts |= MPPE_OPT_UNKNOWN; \ + } while (/* CONSTCOND */ 0) + ++/* MPPE/MPPC definitions by J.D.*/ ++#define MPPE_STATELESS MPPE_H_BIT /* configuration bit H */ ++#define MPPE_40BIT MPPE_L_BIT /* configuration bit L */ ++#define MPPE_56BIT MPPE_M_BIT /* configuration bit M */ ++#define MPPE_128BIT MPPE_S_BIT /* configuration bit S */ ++#define MPPE_MPPC MPPE_C_BIT /* configuration bit C */ ++ ++/* ++ * Definitions for Stac LZS. ++ */ ++ ++#define CI_LZS 17 /* config option for Stac LZS */ ++#define CILEN_LZS 5 /* length of config option */ ++ ++#define LZS_OVHD 4 /* max. LZS overhead */ ++#define LZS_HIST_LEN 2048 /* LZS history size */ ++#define LZS_MAX_CCOUNT 0x0FFF /* max. coherency counter value */ ++ ++#define LZS_MODE_NONE 0 ++#define LZS_MODE_LCB 1 ++#define LZS_MODE_CRC 2 ++#define LZS_MODE_SEQ 3 ++#define LZS_MODE_EXT 4 ++ ++#define LZS_EXT_BIT_FLUSHED 0x80 /* bit A */ ++#define LZS_EXT_BIT_COMP 0x20 /* bit C */ ++ + /* + * Definitions for other, as yet unsupported, compression methods. + */ +diff -ruN ppp-2.4.3.orig/include/net/ppp-comp.h ppp-2.4.3/include/net/ppp-comp.h +--- ppp-2.4.3.orig/include/net/ppp-comp.h 2002-12-06 10:49:15.000000000 +0100 ++++ ppp-2.4.3/include/net/ppp-comp.h 2004-11-21 13:54:09.000000000 +0100 +@@ -255,6 +255,33 @@ + opts |= MPPE_OPT_UNKNOWN; \ + } while (/* CONSTCOND */ 0) + ++/* MPPE/MPPC definitions by J.D.*/ ++#define MPPE_STATELESS MPPE_H_BIT /* configuration bit H */ ++#define MPPE_40BIT MPPE_L_BIT /* configuration bit L */ ++#define MPPE_56BIT MPPE_M_BIT /* configuration bit M */ ++#define MPPE_128BIT MPPE_S_BIT /* configuration bit S */ ++#define MPPE_MPPC MPPE_C_BIT /* configuration bit C */ ++ ++/* ++ * Definitions for Stac LZS. ++ */ ++ ++#define CI_LZS 17 /* config option for Stac LZS */ ++#define CILEN_LZS 5 /* length of config option */ ++ ++#define LZS_OVHD 4 /* max. LZS overhead */ ++#define LZS_HIST_LEN 2048 /* LZS history size */ ++#define LZS_MAX_CCOUNT 0x0FFF /* max. coherency counter value */ ++ ++#define LZS_MODE_NONE 0 ++#define LZS_MODE_LCB 1 ++#define LZS_MODE_CRC 2 ++#define LZS_MODE_SEQ 3 ++#define LZS_MODE_EXT 4 ++ ++#define LZS_EXT_BIT_FLUSHED 0x80 /* bit A */ ++#define LZS_EXT_BIT_COMP 0x20 /* bit C */ ++ + /* + * Definitions for other, as yet unsupported, compression methods. + */ +diff -ruN ppp-2.4.3.orig/pppd/ccp.c ppp-2.4.3/pppd/ccp.c +--- ppp-2.4.3.orig/pppd/ccp.c 2004-11-13 03:28:15.000000000 +0100 ++++ ppp-2.4.3/pppd/ccp.c 2004-11-21 13:54:09.000000000 +0100 +@@ -62,12 +62,10 @@ + static char bsd_value[8]; + static char deflate_value[8]; + +-/* +- * Option variables. +- */ + #ifdef MPPE +-bool refuse_mppe_stateful = 1; /* Allow stateful mode? */ +-#endif ++static int setmppe(char **); ++static int setnomppe(void); ++#endif /* MPPE */ + + static option_t ccp_option_list[] = { + { "noccp", o_bool, &ccp_protent.enabled_flag, +@@ -108,54 +106,36 @@ + "don't allow Predictor-1", OPT_ALIAS | OPT_PRIOSUB | OPT_A2CLR, + &ccp_allowoptions[0].predictor_1 }, + ++ { "lzs", o_bool, &ccp_wantoptions[0].lzs, ++ "request Stac LZS", 1, &ccp_allowoptions[0].lzs, OPT_PRIO }, ++ { "+lzs", o_bool, &ccp_wantoptions[0].lzs, ++ "request Stac LZS", 1, &ccp_allowoptions[0].lzs, OPT_ALIAS | OPT_PRIO }, ++ { "nolzs", o_bool, &ccp_wantoptions[0].lzs, ++ "don't allow Stac LZS", OPT_PRIOSUB | OPT_A2CLR, ++ &ccp_allowoptions[0].lzs }, ++ { "-lzs", o_bool, &ccp_wantoptions[0].lzs, ++ "don't allow Stac LZS", OPT_ALIAS | OPT_PRIOSUB | OPT_A2CLR, ++ &ccp_allowoptions[0].lzs }, ++ + #ifdef MPPE +- /* MPPE options are symmetrical ... we only set wantoptions here */ +- { "require-mppe", o_bool, &ccp_wantoptions[0].mppe, +- "require MPPE encryption", +- OPT_PRIO | MPPE_OPT_40 | MPPE_OPT_128 }, +- { "+mppe", o_bool, &ccp_wantoptions[0].mppe, +- "require MPPE encryption", +- OPT_ALIAS | OPT_PRIO | MPPE_OPT_40 | MPPE_OPT_128 }, +- { "nomppe", o_bool, &ccp_wantoptions[0].mppe, +- "don't allow MPPE encryption", OPT_PRIO }, +- { "-mppe", o_bool, &ccp_wantoptions[0].mppe, +- "don't allow MPPE encryption", OPT_ALIAS | OPT_PRIO }, +- +- /* We use ccp_allowoptions[0].mppe as a junk var ... it is reset later */ +- { "require-mppe-40", o_bool, &ccp_allowoptions[0].mppe, +- "require MPPE 40-bit encryption", OPT_PRIO | OPT_A2OR | MPPE_OPT_40, +- &ccp_wantoptions[0].mppe }, +- { "+mppe-40", o_bool, &ccp_allowoptions[0].mppe, +- "require MPPE 40-bit encryption", OPT_PRIO | OPT_A2OR | MPPE_OPT_40, +- &ccp_wantoptions[0].mppe }, +- { "nomppe-40", o_bool, &ccp_allowoptions[0].mppe, +- "don't allow MPPE 40-bit encryption", +- OPT_PRIOSUB | OPT_A2CLRB | MPPE_OPT_40, &ccp_wantoptions[0].mppe }, +- { "-mppe-40", o_bool, &ccp_allowoptions[0].mppe, +- "don't allow MPPE 40-bit encryption", +- OPT_ALIAS | OPT_PRIOSUB | OPT_A2CLRB | MPPE_OPT_40, +- &ccp_wantoptions[0].mppe }, +- +- { "require-mppe-128", o_bool, &ccp_allowoptions[0].mppe, +- "require MPPE 128-bit encryption", OPT_PRIO | OPT_A2OR | MPPE_OPT_128, +- &ccp_wantoptions[0].mppe }, +- { "+mppe-128", o_bool, &ccp_allowoptions[0].mppe, +- "require MPPE 128-bit encryption", +- OPT_ALIAS | OPT_PRIO | OPT_A2OR | MPPE_OPT_128, +- &ccp_wantoptions[0].mppe }, +- { "nomppe-128", o_bool, &ccp_allowoptions[0].mppe, +- "don't allow MPPE 128-bit encryption", +- OPT_PRIOSUB | OPT_A2CLRB | MPPE_OPT_128, &ccp_wantoptions[0].mppe }, +- { "-mppe-128", o_bool, &ccp_allowoptions[0].mppe, +- "don't allow MPPE 128-bit encryption", +- OPT_ALIAS | OPT_PRIOSUB | OPT_A2CLRB | MPPE_OPT_128, +- &ccp_wantoptions[0].mppe }, +- +- /* strange one; we always request stateless, but will we allow stateful? */ +- { "mppe-stateful", o_bool, &refuse_mppe_stateful, +- "allow MPPE stateful mode", OPT_PRIO }, +- { "nomppe-stateful", o_bool, &refuse_mppe_stateful, +- "disallow MPPE stateful mode", OPT_PRIO | 1 }, ++ { "mppc", o_bool, &ccp_wantoptions[0].mppc, ++ "request MPPC compression", 1, &ccp_allowoptions[0].mppc }, ++ { "+mppc", o_bool, &ccp_wantoptions[0].mppc, ++ "request MPPC compression", 1, &ccp_allowoptions[0].mppc, OPT_ALIAS }, ++ { "nomppc", o_bool, &ccp_wantoptions[0].mppc, ++ "don't allow MPPC compression", OPT_PRIOSUB | OPT_A2CLR, ++ &ccp_allowoptions[0].mppc }, ++ { "-mppc", o_bool, &ccp_wantoptions[0].mppc, ++ "don't allow MPPC compression", OPT_ALIAS | OPT_PRIOSUB | OPT_A2CLR, ++ &ccp_allowoptions[0].mppc }, ++ { "mppe", o_special, (void *)setmppe, ++ "request MPPE encryption" }, ++ { "+mppe", o_special, (void *)setmppe, ++ "request MPPE encryption" }, ++ { "nomppe", o_special_noarg, (void *)setnomppe, ++ "don't allow MPPE encryption" }, ++ { "-mppe", o_special_noarg, (void *)setnomppe, ++ "don't allow MPPE encryption" }, + #endif /* MPPE */ + + { NULL } +@@ -241,7 +221,7 @@ + */ + #define ANY_COMPRESS(opt) ((opt).deflate || (opt).bsd_compress \ + || (opt).predictor_1 || (opt).predictor_2 \ +- || (opt).mppe) ++ || (opt).lzs || (opt).mppc || (opt).mppe) + + /* + * Local state (mainly for handling reset-reqs and reset-acks). +@@ -344,6 +324,100 @@ + return 1; + } + ++#ifdef MPPE ++/* ++ * Functions called from config options ++ */ ++/* ++ MPPE suboptions: ++ required - require MPPE; disconnect if peer doesn't support it ++ stateless - use stateless mode ++ no40 - disable 40 bit keys ++ no56 - disable 56 bit keys ++ no128 - disable 128 bit keys ++*/ ++int setmppe(char **argv) ++{ ++ int i; ++ char *str, cmdbuf[16]; ++ ++ ccp_allowoptions[0].mppe = 1; ++ ccp_allowoptions[0].mppe_40 = 1; ++ ccp_allowoptions[0].mppe_56 = 1; ++ ccp_allowoptions[0].mppe_128 = 1; ++ ccp_allowoptions[0].mppe_stateless = 0; ++ ccp_wantoptions[0].mppe = 0; ++ ++ str = *argv; ++ ++ while (1) { ++ i = 0; ++ memset(cmdbuf, '\0', 16); ++ while ((i < 16) && (*str != ',') && (*str != '\0')) ++ cmdbuf[i++] = *str++; ++ cmdbuf[i] = '\0'; ++ if (!strncasecmp(cmdbuf, "no40", strlen("no40"))) { ++ ccp_allowoptions[0].mppe_40 = 0; ++ goto next_param; ++ } else if (!strncasecmp(cmdbuf, "no56", strlen("no56"))) { ++ ccp_allowoptions[0].mppe_56 = 0; ++ goto next_param; ++ } else if (!strncasecmp(cmdbuf, "no128", strlen("no128"))) { ++ ccp_allowoptions[0].mppe_128 = 0; ++ goto next_param; ++ } else if (!strncasecmp(cmdbuf, "stateless", strlen("stateless"))) { ++ ccp_allowoptions[0].mppe_stateless = 1; ++ goto next_param; ++ } else if (!strncasecmp(cmdbuf, "required", strlen("required"))) { ++ ccp_wantoptions[0].mppe = 1; ++ goto next_param; ++ } else { ++ option_error("invalid parameter '%s' for mppe option", cmdbuf); ++ return 0; ++ } ++ ++ next_param: ++ if (*str == ',') { ++ str++; ++ continue; ++ } ++ if (*str == '\0') { ++ if (!(ccp_allowoptions[0].mppe_40 || ccp_allowoptions[0].mppe_56 || ++ ccp_allowoptions[0].mppe_128)) { ++ if (ccp_wantoptions[0].mppe == 1) { ++ option_error("You require MPPE but you have switched off " ++ "all encryption key lengths."); ++ return 0; ++ } ++ ccp_wantoptions[0].mppe = ccp_allowoptions[0].mppe = 0; ++ ccp_wantoptions[0].mppe_stateless = ++ ccp_allowoptions[0].mppe_stateless = 0; ++ } else { ++ ccp_allowoptions[0].mppe = 1; ++ ccp_wantoptions[0].mppe_stateless = ++ ccp_allowoptions[0].mppe_stateless; ++ if (ccp_wantoptions[0].mppe == 1) { ++ ccp_wantoptions[0].mppe_40 = ccp_allowoptions[0].mppe_40; ++ ccp_wantoptions[0].mppe_56 = ccp_allowoptions[0].mppe_56; ++ ccp_wantoptions[0].mppe_128 = ccp_allowoptions[0].mppe_128; ++ } ++ } ++ return 1; ++ } ++ } ++} ++ ++int setnomppe(void) ++{ ++ ccp_wantoptions[0].mppe = ccp_allowoptions[0].mppe = 0; ++ ccp_wantoptions[0].mppe_40 = ccp_allowoptions[0].mppe_40 = 0; ++ ccp_wantoptions[0].mppe_56 = ccp_allowoptions[0].mppe_56 = 0; ++ ccp_wantoptions[0].mppe_128 = ccp_allowoptions[0].mppe_128 = 0; ++ ccp_wantoptions[0].mppe_stateless = ccp_allowoptions[0].mppe_stateless = 0; ++ return 1; ++} ++#endif /* MPPE */ ++ + /* + * ccp_init - initialize CCP. + */ +@@ -378,6 +452,30 @@ + ccp_allowoptions[0].bsd_bits = BSD_MAX_BITS; + + ccp_allowoptions[0].predictor_1 = 1; ++ ++ ccp_wantoptions[0].lzs = 0; /* Stac LZS - will be enabled in the future */ ++ ccp_wantoptions[0].lzs_mode = LZS_MODE_SEQ; ++ ccp_wantoptions[0].lzs_hists = 1; ++ ccp_allowoptions[0].lzs = 0; /* Stac LZS - will be enabled in the future */ ++ ccp_allowoptions[0].lzs_mode = LZS_MODE_SEQ; ++ ccp_allowoptions[0].lzs_hists = 1; ++ ++#ifdef MPPE ++ /* by default allow and request MPPC... */ ++ ccp_wantoptions[0].mppc = ccp_allowoptions[0].mppc = 1; ++ ++ /* ... and allow but don't request MPPE */ ++ ccp_allowoptions[0].mppe = 1; ++ ccp_allowoptions[0].mppe_40 = 1; ++ ccp_allowoptions[0].mppe_56 = 1; ++ ccp_allowoptions[0].mppe_128 = 1; ++ ccp_allowoptions[0].mppe_stateless = 1; ++ ccp_wantoptions[0].mppe = 0; ++ ccp_wantoptions[0].mppe_40 = 0; ++ ccp_wantoptions[0].mppe_56 = 0; ++ ccp_wantoptions[0].mppe_128 = 0; ++ ccp_wantoptions[0].mppe_stateless = 0; ++#endif /* MPPE */ + } + + /* +@@ -455,11 +553,11 @@ + if (oldstate == OPENED && p[0] == TERMREQ && f->state != OPENED) { + notice("Compression disabled by peer."); + #ifdef MPPE +- if (ccp_gotoptions[unit].mppe) { ++ if (ccp_wantoptions[unit].mppe) { + error("MPPE disabled, closing LCP"); + lcp_close(unit, "MPPE disabled by peer"); + } +-#endif ++#endif /* MPPE */ + } + + /* +@@ -487,6 +585,15 @@ + break; + /* send a reset-ack, which the transmitter will see and + reset its compression state. */ ++ ++ /* In case of MPPE/MPPC or LZS we shouldn't send CCP_RESETACK, ++ but we do it in order to reset compressor; CCP_RESETACK is ++ then silently discarded. See functions ppp_send_frame and ++ ppp_ccp_peek in ppp_generic.c (Linux only !!!). All the ++ confusion is caused by the fact that CCP code is splited ++ into two parts - one part is handled by pppd, the other one ++ is handled by kernel. */ ++ + fsm_sdata(f, CCP_RESETACK, id, NULL, 0); + break; + +@@ -515,12 +622,11 @@ + fsm_lowerdown(&ccp_fsm[unit]); + + #ifdef MPPE +- if (ccp_gotoptions[unit].mppe) { ++ if (ccp_wantoptions[unit].mppe) { + error("MPPE required but peer negotiation failed"); + lcp_close(unit, "MPPE required but peer negotiation failed"); + } +-#endif +- ++#endif /* MPPE */ + } + + /* +@@ -537,7 +643,7 @@ + all_rejected[f->unit] = 0; + + #ifdef MPPE +- if (go->mppe) { ++ if (go->mppe || go->mppc) { + ccp_options *ao = &ccp_allowoptions[f->unit]; + int auth_mschap_bits = auth_done[f->unit]; + int numbits; +@@ -551,80 +657,109 @@ + * NB: If MPPE is required, all other compression opts are invalid. + * So, we return right away if we can't do it. + */ ++ if (ccp_wantoptions[f->unit].mppe) { ++ /* Leave only the mschap auth bits set */ ++ auth_mschap_bits &= (CHAP_MS_WITHPEER | CHAP_MS_PEER | ++ CHAP_MS2_WITHPEER | CHAP_MS2_PEER); ++ /* Count the mschap auths */ ++ auth_mschap_bits >>= CHAP_MS_SHIFT; ++ numbits = 0; ++ do { ++ numbits += auth_mschap_bits & 1; ++ auth_mschap_bits >>= 1; ++ } while (auth_mschap_bits); ++ if (numbits > 1) { ++ error("MPPE required, but auth done in both directions."); ++ lcp_close(f->unit, "MPPE required but not available"); ++ return; ++ } ++ if (!numbits) { ++ error("MPPE required, but MS-CHAP[v2] auth not performed."); ++ lcp_close(f->unit, "MPPE required but not available"); ++ return; ++ } + +- /* Leave only the mschap auth bits set */ +- auth_mschap_bits &= (CHAP_MS_WITHPEER | CHAP_MS_PEER | +- CHAP_MS2_WITHPEER | CHAP_MS2_PEER); +- /* Count the mschap auths */ +- auth_mschap_bits >>= CHAP_MS_SHIFT; +- numbits = 0; +- do { +- numbits += auth_mschap_bits & 1; +- auth_mschap_bits >>= 1; +- } while (auth_mschap_bits); +- if (numbits > 1) { +- error("MPPE required, but auth done in both directions."); +- lcp_close(f->unit, "MPPE required but not available"); +- return; +- } +- if (!numbits) { +- error("MPPE required, but MS-CHAP[v2] auth not performed."); +- lcp_close(f->unit, "MPPE required but not available"); +- return; +- } +- +- /* A plugin (eg radius) may not have obtained key material. */ +- if (!mppe_keys_set) { +- error("MPPE required, but keys are not available. " +- "Possible plugin problem?"); +- lcp_close(f->unit, "MPPE required but not available"); +- return; +- } +- +- /* LM auth not supported for MPPE */ +- if (auth_done[f->unit] & (CHAP_MS_WITHPEER | CHAP_MS_PEER)) { +- /* This might be noise */ +- if (go->mppe & MPPE_OPT_40) { +- notice("Disabling 40-bit MPPE; MS-CHAP LM not supported"); +- go->mppe &= ~MPPE_OPT_40; +- ccp_wantoptions[f->unit].mppe &= ~MPPE_OPT_40; ++ /* A plugin (eg radius) may not have obtained key material. */ ++ if (!mppe_keys_set) { ++ error("MPPE required, but keys are not available. " ++ "Possible plugin problem?"); ++ lcp_close(f->unit, "MPPE required but not available"); ++ return; + } + } + +- /* Last check: can we actually negotiate something? */ +- if (!(go->mppe & (MPPE_OPT_40 | MPPE_OPT_128))) { +- /* Could be misconfig, could be 40-bit disabled above. */ +- error("MPPE required, but both 40-bit and 128-bit disabled."); +- lcp_close(f->unit, "MPPE required but not available"); +- return; ++ /* ++ * Check whether the kernel knows about the various ++ * compression methods we might request. Key material ++ * unimportant here. ++ */ ++ if (go->mppc) { ++ opt_buf[0] = CI_MPPE; ++ opt_buf[1] = CILEN_MPPE; ++ opt_buf[2] = 0; ++ opt_buf[3] = 0; ++ opt_buf[4] = 0; ++ opt_buf[5] = MPPE_MPPC; ++ if (ccp_test(f->unit, opt_buf, CILEN_MPPE, 0) <= 0) ++ go->mppc = 0; ++ } ++ if (go->mppe_40) { ++ opt_buf[0] = CI_MPPE; ++ opt_buf[1] = CILEN_MPPE; ++ opt_buf[2] = MPPE_STATELESS; ++ opt_buf[3] = 0; ++ opt_buf[4] = 0; ++ opt_buf[5] = MPPE_40BIT; ++ if (ccp_test(f->unit, opt_buf, CILEN_MPPE + MPPE_MAX_KEY_LEN, 0) <= 0) ++ go->mppe_40 = 0; ++ } ++ if (go->mppe_56) { ++ opt_buf[0] = CI_MPPE; ++ opt_buf[1] = CILEN_MPPE; ++ opt_buf[2] = MPPE_STATELESS; ++ opt_buf[3] = 0; ++ opt_buf[4] = 0; ++ opt_buf[5] = MPPE_56BIT; ++ if (ccp_test(f->unit, opt_buf, CILEN_MPPE + MPPE_MAX_KEY_LEN, 0) <= 0) ++ go->mppe_56 = 0; ++ } ++ if (go->mppe_128) { ++ opt_buf[0] = CI_MPPE; ++ opt_buf[1] = CILEN_MPPE; ++ opt_buf[2] = MPPE_STATELESS; ++ opt_buf[3] = 0; ++ opt_buf[4] = 0; ++ opt_buf[5] = MPPE_128BIT; ++ if (ccp_test(f->unit, opt_buf, CILEN_MPPE + MPPE_MAX_KEY_LEN, 0) <= 0) ++ go->mppe_128 = 0; ++ } ++ if (!go->mppe_40 && !go->mppe_56 && !go->mppe_128) { ++ if (ccp_wantoptions[f->unit].mppe) { ++ error("MPPE required, but kernel has no support."); ++ lcp_close(f->unit, "MPPE required but not available"); ++ } ++ go->mppe = go->mppe_stateless = 0; ++ } else { ++ /* MPPE is not compatible with other compression types */ ++ if (ccp_wantoptions[f->unit].mppe) { ++ ao->bsd_compress = go->bsd_compress = 0; ++ ao->predictor_1 = go->predictor_1 = 0; ++ ao->predictor_2 = go->predictor_2 = 0; ++ ao->deflate = go->deflate = 0; ++ ao->lzs = go->lzs = 0; ++ } + } +- +- /* sync options */ +- ao->mppe = go->mppe; +- /* MPPE is not compatible with other compression types */ +- ao->bsd_compress = go->bsd_compress = 0; +- ao->predictor_1 = go->predictor_1 = 0; +- ao->predictor_2 = go->predictor_2 = 0; +- ao->deflate = go->deflate = 0; + } + #endif /* MPPE */ +- +- /* +- * Check whether the kernel knows about the various +- * compression methods we might request. +- */ +-#ifdef MPPE +- if (go->mppe) { +- opt_buf[0] = CI_MPPE; +- opt_buf[1] = CILEN_MPPE; +- MPPE_OPTS_TO_CI(go->mppe, &opt_buf[2]); +- /* Key material unimportant here. */ +- if (ccp_test(f->unit, opt_buf, CILEN_MPPE + MPPE_MAX_KEY_LEN, 0) <= 0) { +- error("MPPE required, but kernel has no support."); +- lcp_close(f->unit, "MPPE required but not available"); +- } ++ if (go->lzs) { ++ opt_buf[0] = CI_LZS; ++ opt_buf[1] = CILEN_LZS; ++ opt_buf[2] = go->lzs_hists >> 8; ++ opt_buf[3] = go->lzs_hists & 0xff; ++ opt_buf[4] = LZS_MODE_SEQ; ++ if (ccp_test(f->unit, opt_buf, CILEN_LZS, 0) <= 0) ++ go->lzs = 0; + } +-#endif + if (go->bsd_compress) { + opt_buf[0] = CI_BSD_COMPRESS; + opt_buf[1] = CILEN_BSD_COMPRESS; +@@ -679,7 +814,8 @@ + + (go->deflate? CILEN_DEFLATE: 0) + + (go->predictor_1? CILEN_PREDICTOR_1: 0) + + (go->predictor_2? CILEN_PREDICTOR_2: 0) +- + (go->mppe? CILEN_MPPE: 0); ++ + (go->lzs? CILEN_LZS: 0) ++ + ((go->mppe || go->mppc)? CILEN_MPPE: 0); + } + + /* +@@ -693,6 +829,8 @@ + { + int res; + ccp_options *go = &ccp_gotoptions[f->unit]; ++ ccp_options *ao = &ccp_allowoptions[f->unit]; ++ ccp_options *wo = &ccp_wantoptions[f->unit]; + u_char *p0 = p; + + /* +@@ -701,22 +839,43 @@ + * in case it gets Acked. + */ + #ifdef MPPE +- if (go->mppe) { ++ if (go->mppe || go->mppc || (!wo->mppe && ao->mppe)) { + u_char opt_buf[CILEN_MPPE + MPPE_MAX_KEY_LEN]; + +- p[0] = opt_buf[0] = CI_MPPE; +- p[1] = opt_buf[1] = CILEN_MPPE; +- MPPE_OPTS_TO_CI(go->mppe, &p[2]); +- MPPE_OPTS_TO_CI(go->mppe, &opt_buf[2]); ++ p[0] = CI_MPPE; ++ p[1] = CILEN_MPPE; ++ p[2] = (go->mppe_stateless ? MPPE_STATELESS : 0); ++ p[3] = 0; ++ p[4] = 0; ++ p[5] = (go->mppe_40 ? MPPE_40BIT : 0) | (go->mppe_56 ? MPPE_56BIT : 0) | ++ (go->mppe_128 ? MPPE_128BIT : 0) | (go->mppc ? MPPE_MPPC : 0); ++ ++ BCOPY(p, opt_buf, CILEN_MPPE); + BCOPY(mppe_recv_key, &opt_buf[CILEN_MPPE], MPPE_MAX_KEY_LEN); + res = ccp_test(f->unit, opt_buf, CILEN_MPPE + MPPE_MAX_KEY_LEN, 0); +- if (res > 0) ++ if (res > 0) { + p += CILEN_MPPE; +- else ++ } else { + /* This shouldn't happen, we've already tested it! */ +- lcp_close(f->unit, "MPPE required but not available in kernel"); ++ go->mppe = go->mppe_40 = go->mppe_56 = go->mppe_128 = ++ go->mppe_stateless = go->mppc = 0; ++ if (ccp_wantoptions[f->unit].mppe) ++ lcp_close(f->unit, "MPPE required but not available in kernel"); ++ } ++ } ++#endif /* MPPE */ ++ if (go->lzs) { ++ p[0] = CI_LZS; ++ p[1] = CILEN_LZS; ++ p[2] = go->lzs_hists >> 8; ++ p[3] = go->lzs_hists & 0xff; ++ p[4] = LZS_MODE_SEQ; ++ res = ccp_test(f->unit, p, CILEN_LZS, 0); ++ if (res > 0) { ++ p += CILEN_LZS; ++ } else ++ go->lzs = 0; + } +-#endif + if (go->deflate) { + p[0] = go->deflate_correct? CI_DEFLATE: CI_DEFLATE_DRAFT; + p[1] = CILEN_DEFLATE; +@@ -802,7 +961,7 @@ + + /* + * ccp_ackci - process a received configure-ack, and return +- * 1 iff the packet was OK. ++ * 1 if the packet was OK. + */ + static int + ccp_ackci(f, p, len) +@@ -811,24 +970,44 @@ + int len; + { + ccp_options *go = &ccp_gotoptions[f->unit]; ++ ccp_options *ao = &ccp_allowoptions[f->unit]; ++ ccp_options *wo = &ccp_wantoptions[f->unit]; + u_char *p0 = p; + + #ifdef MPPE +- if (go->mppe) { +- u_char opt_buf[CILEN_MPPE]; +- +- opt_buf[0] = CI_MPPE; +- opt_buf[1] = CILEN_MPPE; +- MPPE_OPTS_TO_CI(go->mppe, &opt_buf[2]); +- if (len < CILEN_MPPE || memcmp(opt_buf, p, CILEN_MPPE)) ++ if (go->mppe || go->mppc || (!wo->mppe && ao->mppe)) { ++ if (len < CILEN_MPPE ++ || p[1] != CILEN_MPPE || p[0] != CI_MPPE ++ || p[2] != (go->mppe_stateless ? MPPE_STATELESS : 0) ++ || p[3] != 0 ++ || p[4] != 0 ++ || (p[5] != ((go->mppe_40 ? MPPE_40BIT : 0) | ++ (go->mppc ? MPPE_MPPC : 0)) ++ && p[5] != ((go->mppe_56 ? MPPE_56BIT : 0) | ++ (go->mppc ? MPPE_MPPC : 0)) ++ && p[5] != ((go->mppe_128 ? MPPE_128BIT : 0) | ++ (go->mppc ? MPPE_MPPC : 0)))) + return 0; ++ if (go->mppe_40 || go->mppe_56 || go->mppe_128) ++ go->mppe = 1; + p += CILEN_MPPE; + len -= CILEN_MPPE; ++ /* Cope with first/fast ack */ ++ if (p == p0 && len == 0) ++ return 1; ++ } ++#endif /* MPPE */ ++ if (go->lzs) { ++ if (len < CILEN_LZS || p[0] != CI_LZS || p[1] != CILEN_LZS ++ || p[2] != go->lzs_hists>>8 || p[3] != (go->lzs_hists&0xff) ++ || p[4] != LZS_MODE_SEQ) ++ return 0; ++ p += CILEN_LZS; ++ len -= CILEN_LZS; + /* XXX Cope with first/fast ack */ +- if (len == 0) ++ if (p == p0 && len == 0) + return 1; + } +-#endif + if (go->deflate) { + if (len < CILEN_DEFLATE + || p[0] != (go->deflate_correct? CI_DEFLATE: CI_DEFLATE_DRAFT) +@@ -891,7 +1070,7 @@ + + /* + * ccp_nakci - process received configure-nak. +- * Returns 1 iff the nak was OK. ++ * Returns 1 if the nak was OK. + */ + static int + ccp_nakci(f, p, len, treat_as_reject) +@@ -900,6 +1079,8 @@ + int len; + { + ccp_options *go = &ccp_gotoptions[f->unit]; ++ ccp_options *ao = &ccp_allowoptions[f->unit]; ++ ccp_options *wo = &ccp_wantoptions[f->unit]; + ccp_options no; /* options we've seen already */ + ccp_options try; /* options to ask for next time */ + +@@ -907,28 +1088,100 @@ + try = *go; + + #ifdef MPPE +- if (go->mppe && len >= CILEN_MPPE +- && p[0] == CI_MPPE && p[1] == CILEN_MPPE) { +- no.mppe = 1; +- /* +- * Peer wants us to use a different strength or other setting. +- * Fail if we aren't willing to use his suggestion. +- */ +- MPPE_CI_TO_OPTS(&p[2], try.mppe); +- if ((try.mppe & MPPE_OPT_STATEFUL) && refuse_mppe_stateful) { +- error("Refusing MPPE stateful mode offered by peer"); +- try.mppe = 0; +- } else if (((go->mppe | MPPE_OPT_STATEFUL) & try.mppe) != try.mppe) { +- /* Peer must have set options we didn't request (suggest) */ +- try.mppe = 0; +- } ++ if ((go->mppe || go->mppc || (!wo->mppe && ao->mppe)) && ++ len >= CILEN_MPPE && p[0] == CI_MPPE && p[1] == CILEN_MPPE) { + +- if (!try.mppe) { +- error("MPPE required but peer negotiation failed"); +- lcp_close(f->unit, "MPPE required but peer negotiation failed"); ++ if (go->mppc) { ++ no.mppc = 1; ++ if (!(p[5] & MPPE_MPPC)) ++ try.mppc = 0; ++ } ++ ++ if (go->mppe) ++ no.mppe = 1; ++ if (go->mppe_40) ++ no.mppe_40 = 1; ++ if (go->mppe_56) ++ no.mppe_56 = 1; ++ if (go->mppe_128) ++ no.mppe_128 = 1; ++ if (go->mppe_stateless) ++ no.mppe_stateless = 1; ++ ++ if (ao->mppe_40) { ++ if ((p[5] & MPPE_40BIT)) ++ try.mppe_40 = 1; ++ else ++ try.mppe_40 = (p[5] == 0) ? 1 : 0; ++ } ++ if (ao->mppe_56) { ++ if ((p[5] & MPPE_56BIT)) ++ try.mppe_56 = 1; ++ else ++ try.mppe_56 = (p[5] == 0) ? 1 : 0; ++ } ++ if (ao->mppe_128) { ++ if ((p[5] & MPPE_128BIT)) ++ try.mppe_128 = 1; ++ else ++ try.mppe_128 = (p[5] == 0) ? 1 : 0; ++ } ++ ++ if (ao->mppe_stateless) { ++ if ((p[2] & MPPE_STATELESS) || wo->mppe_stateless) ++ try.mppe_stateless = 1; ++ else ++ try.mppe_stateless = 0; ++ } ++ ++ if (!try.mppe_56 && !try.mppe_40 && !try.mppe_128) { ++ try.mppe = try.mppe_stateless = 0; ++ if (wo->mppe) { ++ /* we require encryption, but peer doesn't support it ++ so we close connection */ ++ wo->mppc = wo->mppe = wo->mppe_stateless = wo->mppe_40 = ++ wo->mppe_56 = wo->mppe_128 = 0; ++ lcp_close(f->unit, "MPPE required but cannot negotiate MPPE " ++ "key length"); ++ } ++ } ++ if (wo->mppe && (wo->mppe_40 != try.mppe_40) && ++ (wo->mppe_56 != try.mppe_56) && (wo->mppe_128 != try.mppe_128)) { ++ /* cannot negotiate key length */ ++ wo->mppc = wo->mppe = wo->mppe_stateless = wo->mppe_40 = ++ wo->mppe_56 = wo->mppe_128 = 0; ++ lcp_close(f->unit, "Cannot negotiate MPPE key length"); + } ++ if (try.mppe_40 && try.mppe_56 && try.mppe_128) ++ try.mppe_40 = try.mppe_56 = 0; ++ else ++ if (try.mppe_56 && try.mppe_128) ++ try.mppe_56 = 0; ++ else ++ if (try.mppe_40 && try.mppe_128) ++ try.mppe_40 = 0; ++ else ++ if (try.mppe_40 && try.mppe_56) ++ try.mppe_40 = 0; ++ ++ p += CILEN_MPPE; ++ len -= CILEN_MPPE; + } + #endif /* MPPE */ ++ ++ if (go->lzs && len >= CILEN_LZS && p[0] == CI_LZS && p[1] == CILEN_LZS) { ++ no.lzs = 1; ++ if (((p[2]<<8)|p[3]) > 1 || (p[4] != LZS_MODE_SEQ && ++ p[4] != LZS_MODE_EXT)) ++ try.lzs = 0; ++ else { ++ try.lzs_mode = p[4]; ++ try.lzs_hists = (p[2] << 8) | p[3]; ++ } ++ p += CILEN_LZS; ++ len -= CILEN_LZS; ++ } ++ + if (go->deflate && len >= CILEN_DEFLATE + && p[0] == (go->deflate_correct? CI_DEFLATE: CI_DEFLATE_DRAFT) + && p[1] == CILEN_DEFLATE) { +@@ -1001,14 +1254,50 @@ + return -1; + + #ifdef MPPE +- if (go->mppe && len >= CILEN_MPPE ++ if ((go->mppe || go->mppc) && len >= CILEN_MPPE + && p[0] == CI_MPPE && p[1] == CILEN_MPPE) { +- error("MPPE required but peer refused"); +- lcp_close(f->unit, "MPPE required but peer refused"); ++ ccp_options *wo = &ccp_wantoptions[f->unit]; ++ if (p[2] != (go->mppe_stateless ? MPPE_STATELESS : 0) || ++ p[3] != 0 || ++ p[4] != 0 || ++ p[5] != ((go->mppe_40 ? MPPE_40BIT : 0) | ++ (go->mppe_56 ? MPPE_56BIT : 0) | ++ (go->mppe_128 ? MPPE_128BIT : 0) | ++ (go->mppc ? MPPE_MPPC : 0))) ++ return 0; ++ if (go->mppc) ++ try.mppc = 0; ++ if (go->mppe) { ++ try.mppe = 0; ++ if (go->mppe_40) ++ try.mppe_40 = 0; ++ if (go->mppe_56) ++ try.mppe_56 = 0; ++ if (go->mppe_128) ++ try.mppe_128 = 0; ++ if (go->mppe_stateless) ++ try.mppe_stateless = 0; ++ if (!try.mppe_56 && !try.mppe_40 && !try.mppe_128) ++ try.mppe = try.mppe_stateless = 0; ++ if (wo->mppe) { /* we want MPPE but cannot negotiate key length */ ++ wo->mppc = wo->mppe = wo->mppe_stateless = wo->mppe_40 = ++ wo->mppe_56 = wo->mppe_128 = 0; ++ lcp_close(f->unit, "MPPE required but cannot negotiate MPPE " ++ "key length"); ++ } ++ } + p += CILEN_MPPE; + len -= CILEN_MPPE; + } +-#endif ++#endif /* MPPE */ ++ if (go->lzs && len >= CILEN_LZS && p[0] == CI_LZS && p[1] == CILEN_LZS) { ++ if (p[2] != go->lzs_hists>>8 || p[3] != (go->lzs_hists&0xff) ++ || p[4] != go->lzs_mode) ++ return 0; ++ try.lzs = 0; ++ p += CILEN_LZS; ++ len -= CILEN_LZS; ++ } + if (go->deflate_correct && len >= CILEN_DEFLATE + && p[0] == CI_DEFLATE && p[1] == CILEN_DEFLATE) { + if (p[2] != DEFLATE_MAKE_OPT(go->deflate_size) +@@ -1072,14 +1361,15 @@ + int dont_nak; + { + int ret, newret, res; +- u_char *p0, *retp; ++ u_char *p0, *retp, p2, p5; + int len, clen, type, nb; + ccp_options *ho = &ccp_hisoptions[f->unit]; + ccp_options *ao = &ccp_allowoptions[f->unit]; ++ ccp_options *wo = &ccp_wantoptions[f->unit]; + #ifdef MPPE +- bool rej_for_ci_mppe = 1; /* Are we rejecting based on a bad/missing */ +- /* CI_MPPE, or due to other options? */ +-#endif ++ u_char opt_buf[CILEN_MPPE + MPPE_MAX_KEY_LEN]; ++/* int mtu; */ ++#endif /* MPPE */ + + ret = CONFACK; + retp = p0 = p; +@@ -1102,103 +1392,305 @@ + switch (type) { + #ifdef MPPE + case CI_MPPE: +- if (!ao->mppe || clen != CILEN_MPPE) { ++ if ((!ao->mppc && !ao->mppe) || clen != CILEN_MPPE) { + newret = CONFREJ; + break; + } +- MPPE_CI_TO_OPTS(&p[2], ho->mppe); + +- /* Nak if anything unsupported or unknown are set. */ +- if (ho->mppe & MPPE_OPT_UNSUPPORTED) { +- newret = CONFNAK; +- ho->mppe &= ~MPPE_OPT_UNSUPPORTED; +- } +- if (ho->mppe & MPPE_OPT_UNKNOWN) { ++ p2 = p[2]; ++ p5 = p[5]; ++ /* not sure what they want, tell 'em what we got */ ++ if (((p[2] & ~MPPE_STATELESS) != 0 || p[3] != 0 || p[4] != 0 || ++ (p[5] & ~(MPPE_40BIT | MPPE_56BIT | MPPE_128BIT | ++ MPPE_MPPC)) != 0 || p[5] == 0) || ++ (p[2] == 0 && p[3] == 0 && p[4] == 0 && p[5] == 0)) { + newret = CONFNAK; +- ho->mppe &= ~MPPE_OPT_UNKNOWN; ++ p[2] = (wo->mppe_stateless ? MPPE_STATELESS : 0); ++ p[3] = 0; ++ p[4] = 0; ++ p[5] = (wo->mppe_40 ? MPPE_40BIT : 0) | ++ (wo->mppe_56 ? MPPE_56BIT : 0) | ++ (wo->mppe_128 ? MPPE_128BIT : 0) | ++ (wo->mppc ? MPPE_MPPC : 0); ++ break; + } + +- /* Check state opt */ +- if (ho->mppe & MPPE_OPT_STATEFUL) { +- /* +- * We can Nak and request stateless, but it's a +- * lot easier to just assume the peer will request +- * it if he can do it; stateful mode is bad over +- * the Internet -- which is where we expect MPPE. +- */ +- if (refuse_mppe_stateful) { +- error("Refusing MPPE stateful mode offered by peer"); ++ if ((p[5] & MPPE_MPPC)) { ++ if (ao->mppc) { ++ ho->mppc = 1; ++ BCOPY(p, opt_buf, CILEN_MPPE); ++ opt_buf[2] = opt_buf[3] = opt_buf[4] = 0; ++ opt_buf[5] = MPPE_MPPC; ++ if (ccp_test(f->unit, opt_buf, CILEN_MPPE, 1) <= 0) { ++ ho->mppc = 0; ++ p[5] &= ~MPPE_MPPC; ++ newret = CONFNAK; ++ } ++ } else { + newret = CONFREJ; +- break; ++ if (wo->mppe || ao->mppe) { ++ p[5] &= ~MPPE_MPPC; ++ newret = CONFNAK; ++ } ++ } ++ } ++ ++ if (ao->mppe) ++ ho->mppe = 1; ++ ++ if ((p[2] & MPPE_STATELESS)) { ++ if (ao->mppe_stateless) { ++ if (wo->mppe_stateless) ++ ho->mppe_stateless = 1; ++ else { ++ newret = CONFNAK; ++ if (!dont_nak) ++ p[2] &= ~MPPE_STATELESS; ++ } ++ } else { ++ newret = CONFNAK; ++ if (!dont_nak) ++ p[2] &= ~MPPE_STATELESS; ++ } ++ } else { ++ if (wo->mppe_stateless && !dont_nak) { ++ wo->mppe_stateless = 0; ++ newret = CONFNAK; ++ p[2] |= MPPE_STATELESS; + } + } + +- /* Find out which of {S,L} are set. */ +- if ((ho->mppe & MPPE_OPT_128) +- && (ho->mppe & MPPE_OPT_40)) { +- /* Both are set, negotiate the strongest. */ ++ if ((p[5] & ~MPPE_MPPC) == (MPPE_40BIT|MPPE_56BIT|MPPE_128BIT)) { + newret = CONFNAK; +- if (ao->mppe & MPPE_OPT_128) +- ho->mppe &= ~MPPE_OPT_40; +- else if (ao->mppe & MPPE_OPT_40) +- ho->mppe &= ~MPPE_OPT_128; +- else { +- newret = CONFREJ; +- break; ++ if (ao->mppe_128) { ++ ho->mppe_128 = 1; ++ p[5] &= ~(MPPE_40BIT|MPPE_56BIT); ++ BCOPY(p, opt_buf, CILEN_MPPE); ++ BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE], ++ MPPE_MAX_KEY_LEN); ++ if (ccp_test(f->unit, opt_buf, CILEN_MPPE + ++ MPPE_MAX_KEY_LEN, 1) <= 0) { ++ ho->mppe_128 = 0; ++ p[5] |= (MPPE_40BIT|MPPE_56BIT); ++ p[5] &= ~MPPE_128BIT; ++ goto check_mppe_56_40; ++ } ++ goto check_mppe; + } +- } else if (ho->mppe & MPPE_OPT_128) { +- if (!(ao->mppe & MPPE_OPT_128)) { +- newret = CONFREJ; +- break; ++ p[5] &= ~MPPE_128BIT; ++ goto check_mppe_56_40; ++ } ++ if ((p[5] & ~MPPE_MPPC) == (MPPE_56BIT|MPPE_128BIT)) { ++ newret = CONFNAK; ++ if (ao->mppe_128) { ++ ho->mppe_128 = 1; ++ p[5] &= ~MPPE_56BIT; ++ BCOPY(p, opt_buf, CILEN_MPPE); ++ BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE], ++ MPPE_MAX_KEY_LEN); ++ if (ccp_test(f->unit, opt_buf, CILEN_MPPE + ++ MPPE_MAX_KEY_LEN, 1) <= 0) { ++ ho->mppe_128 = 0; ++ p[5] |= MPPE_56BIT; ++ p[5] &= ~MPPE_128BIT; ++ goto check_mppe_56; ++ } ++ goto check_mppe; + } +- } else if (ho->mppe & MPPE_OPT_40) { +- if (!(ao->mppe & MPPE_OPT_40)) { +- newret = CONFREJ; +- break; ++ p[5] &= ~MPPE_128BIT; ++ goto check_mppe_56; ++ } ++ if ((p[5] & ~MPPE_MPPC) == (MPPE_40BIT|MPPE_128BIT)) { ++ newret = CONFNAK; ++ if (ao->mppe_128) { ++ ho->mppe_128 = 1; ++ p[5] &= ~MPPE_40BIT; ++ BCOPY(p, opt_buf, CILEN_MPPE); ++ BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE], ++ MPPE_MAX_KEY_LEN); ++ if (ccp_test(f->unit, opt_buf, CILEN_MPPE + ++ MPPE_MAX_KEY_LEN, 1) <= 0) { ++ ho->mppe_128 = 0; ++ p[5] |= MPPE_40BIT; ++ p[5] &= ~MPPE_128BIT; ++ goto check_mppe_40; ++ } ++ goto check_mppe; ++ } ++ p[5] &= ~MPPE_128BIT; ++ goto check_mppe_40; ++ } ++ if ((p[5] & ~MPPE_MPPC) == MPPE_128BIT) { ++ if (ao->mppe_128) { ++ ho->mppe_128 = 1; ++ BCOPY(p, opt_buf, CILEN_MPPE); ++ BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE], ++ MPPE_MAX_KEY_LEN); ++ if (ccp_test(f->unit, opt_buf, CILEN_MPPE + ++ MPPE_MAX_KEY_LEN, 1) <= 0) { ++ ho->mppe_128 = 0; ++ p[5] &= ~MPPE_128BIT; ++ newret = CONFNAK; ++ } ++ goto check_mppe; ++ } ++ p[5] &= ~MPPE_128BIT; ++ newret = CONFNAK; ++ goto check_mppe; ++ } ++ check_mppe_56_40: ++ if ((p[5] & ~MPPE_MPPC) == (MPPE_40BIT|MPPE_56BIT)) { ++ newret = CONFNAK; ++ if (ao->mppe_56) { ++ ho->mppe_56 = 1; ++ p[5] &= ~MPPE_40BIT; ++ BCOPY(p, opt_buf, CILEN_MPPE); ++ BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE], ++ MPPE_MAX_KEY_LEN); ++ if (ccp_test(f->unit, opt_buf, CILEN_MPPE + ++ MPPE_MAX_KEY_LEN, 1) <= 0) { ++ ho->mppe_56 = 0; ++ p[5] |= MPPE_40BIT; ++ p[5] &= ~MPPE_56BIT; ++ newret = CONFNAK; ++ goto check_mppe_40; ++ } ++ goto check_mppe; ++ } ++ p[5] &= ~MPPE_56BIT; ++ goto check_mppe_40; ++ } ++ check_mppe_56: ++ if ((p[5] & ~MPPE_MPPC) == MPPE_56BIT) { ++ if (ao->mppe_56) { ++ ho->mppe_56 = 1; ++ BCOPY(p, opt_buf, CILEN_MPPE); ++ BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE], ++ MPPE_MAX_KEY_LEN); ++ if (ccp_test(f->unit, opt_buf, CILEN_MPPE + ++ MPPE_MAX_KEY_LEN, 1) <= 0) { ++ ho->mppe_56 = 0; ++ p[5] &= ~MPPE_56BIT; ++ newret = CONFNAK; ++ } ++ goto check_mppe; ++ } ++ p[5] &= ~MPPE_56BIT; ++ newret = CONFNAK; ++ goto check_mppe; ++ } ++ check_mppe_40: ++ if ((p[5] & ~MPPE_MPPC) == MPPE_40BIT) { ++ if (ao->mppe_40) { ++ ho->mppe_40 = 1; ++ BCOPY(p, opt_buf, CILEN_MPPE); ++ BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE], ++ MPPE_MAX_KEY_LEN); ++ if (ccp_test(f->unit, opt_buf, CILEN_MPPE + ++ MPPE_MAX_KEY_LEN, 1) <= 0) { ++ ho->mppe_40 = 0; ++ p[5] &= ~MPPE_40BIT; ++ newret = CONFNAK; ++ } ++ goto check_mppe; ++ } ++ p[5] &= ~MPPE_40BIT; ++ } ++ ++ check_mppe: ++ if (!ho->mppe_40 && !ho->mppe_56 && !ho->mppe_128) { ++ if (wo->mppe_40 || wo->mppe_56 || wo->mppe_128) { ++ newret = CONFNAK; ++ p[2] |= (wo->mppe_stateless ? MPPE_STATELESS : 0); ++ p[5] |= (wo->mppe_40 ? MPPE_40BIT : 0) | ++ (wo->mppe_56 ? MPPE_56BIT : 0) | ++ (wo->mppe_128 ? MPPE_128BIT : 0) | ++ (wo->mppc ? MPPE_MPPC : 0); ++ } else { ++ ho->mppe = ho->mppe_stateless = 0; + } + } else { +- /* Neither are set. */ ++ /* MPPE is not compatible with other compression types */ ++ if (wo->mppe) { ++ ao->bsd_compress = 0; ++ ao->predictor_1 = 0; ++ ao->predictor_2 = 0; ++ ao->deflate = 0; ++ ao->lzs = 0; ++ } ++ } ++ if ((!ho->mppc || !ao->mppc) && !ho->mppe) { ++ p[2] = p2; ++ p[5] = p5; + newret = CONFREJ; + break; + } + +- /* rebuild the opts */ +- MPPE_OPTS_TO_CI(ho->mppe, &p[2]); +- if (newret == CONFACK) { +- u_char opt_buf[CILEN_MPPE + MPPE_MAX_KEY_LEN]; +- int mtu; +- +- BCOPY(p, opt_buf, CILEN_MPPE); +- BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE], +- MPPE_MAX_KEY_LEN); +- if (ccp_test(f->unit, opt_buf, +- CILEN_MPPE + MPPE_MAX_KEY_LEN, 1) <= 0) { +- /* This shouldn't happen, we've already tested it! */ +- error("MPPE required, but kernel has no support."); +- lcp_close(f->unit, "MPPE required but not available"); +- newret = CONFREJ; +- break; +- } +- /* +- * We need to decrease the interface MTU by MPPE_PAD +- * because MPPE frames **grow**. The kernel [must] +- * allocate MPPE_PAD extra bytes in xmit buffers. +- */ +- mtu = netif_get_mtu(f->unit); +- if (mtu) +- netif_set_mtu(f->unit, mtu - MPPE_PAD); +- else +- newret = CONFREJ; +- } ++ /* ++ * I have commented the code below because according to RFC1547 ++ * MTU is only information for higher level protocols about ++ * "the maximum allowable length for a packet (q.v.) transmitted ++ * over a point-to-point link without incurring network layer ++ * fragmentation." Of course a PPP implementation should be able ++ * to handle overhead added by MPPE - in our case apropriate code ++ * is located in drivers/net/ppp_generic.c in the kernel sources. ++ * ++ * According to RFC1661: ++ * - when negotiated MRU is less than 1500 octets, a PPP ++ * implementation must still be able to receive at least 1500 ++ * octets, ++ * - when PFC is negotiated, a PPP implementation is still ++ * required to receive frames with uncompressed protocol field. ++ * ++ * So why not to handle MPPE overhead without changing MTU value? ++ * I am sure that RFC3078, unfortunately silently, assumes that. ++ */ + + /* +- * We have accepted MPPE or are willing to negotiate +- * MPPE parameters. A CONFREJ is due to subsequent +- * (non-MPPE) processing. ++ * We need to decrease the interface MTU by MPPE_PAD ++ * because MPPE frames **grow**. The kernel [must] ++ * allocate MPPE_PAD extra bytes in xmit buffers. + */ +- rej_for_ci_mppe = 0; ++/* ++ mtu = netif_get_mtu(f->unit); ++ if (mtu) { ++ netif_set_mtu(f->unit, mtu - MPPE_PAD); ++ } else { ++ newret = CONFREJ; ++ if (ccp_wantoptions[f->unit].mppe) { ++ error("Cannot adjust MTU needed by MPPE."); ++ lcp_close(f->unit, "Cannot adjust MTU needed by MPPE."); ++ } ++ } ++*/ + break; + #endif /* MPPE */ ++ ++ case CI_LZS: ++ if (!ao->lzs || clen != CILEN_LZS) { ++ newret = CONFREJ; ++ break; ++ } ++ ++ ho->lzs = 1; ++ ho->lzs_hists = (p[2] << 8) | p[3]; ++ ho->lzs_mode = p[4]; ++ if ((ho->lzs_hists != ao->lzs_hists) || ++ (ho->lzs_mode != ao->lzs_mode)) { ++ newret = CONFNAK; ++ if (!dont_nak) { ++ p[2] = ao->lzs_hists >> 8; ++ p[3] = ao->lzs_hists & 0xff; ++ p[4] = ao->lzs_mode; ++ } else ++ break; ++ } ++ ++ if (p == p0 && ccp_test(f->unit, p, CILEN_LZS, 1) <= 0) { ++ newret = CONFREJ; ++ } ++ break; ++ + case CI_DEFLATE: + case CI_DEFLATE_DRAFT: + if (!ao->deflate || clen != CILEN_DEFLATE +@@ -1340,12 +1832,6 @@ + else + *lenp = retp - p0; + } +-#ifdef MPPE +- if (ret == CONFREJ && ao->mppe && rej_for_ci_mppe) { +- error("MPPE required but peer negotiation failed"); +- lcp_close(f->unit, "MPPE required but peer negotiation failed"); +- } +-#endif + return ret; + } + +@@ -1367,24 +1853,35 @@ + char *p = result; + char *q = result + sizeof(result); /* 1 past result */ + +- slprintf(p, q - p, "MPPE "); +- p += 5; +- if (opt->mppe & MPPE_OPT_128) { +- slprintf(p, q - p, "128-bit "); +- p += 8; +- } +- if (opt->mppe & MPPE_OPT_40) { +- slprintf(p, q - p, "40-bit "); +- p += 7; +- } +- if (opt->mppe & MPPE_OPT_STATEFUL) +- slprintf(p, q - p, "stateful"); +- else +- slprintf(p, q - p, "stateless"); +- ++ if (opt->mppe) { ++ if (opt->mppc) { ++ slprintf(p, q - p, "MPPC/MPPE "); ++ p += 10; ++ } else { ++ slprintf(p, q - p, "MPPE "); ++ p += 5; ++ } ++ if (opt->mppe_128) { ++ slprintf(p, q - p, "128-bit "); ++ p += 8; ++ } else if (opt->mppe_56) { ++ slprintf(p, q - p, "56-bit "); ++ p += 7; ++ } else if (opt->mppe_40) { ++ slprintf(p, q - p, "40-bit "); ++ p += 7; ++ } ++ if (opt->mppe_stateless) ++ slprintf(p, q - p, "stateless"); ++ else ++ slprintf(p, q - p, "stateful"); ++ } else if (opt->mppc) ++ slprintf(p, q - p, "MPPC"); + break; + } +-#endif ++#endif /* MPPE */ ++ case CI_LZS: ++ return "Stac LZS"; + case CI_DEFLATE: + case CI_DEFLATE_DRAFT: + if (opt2 != NULL && opt2->deflate_size != opt->deflate_size) +@@ -1440,12 +1937,12 @@ + } else if (ANY_COMPRESS(*ho)) + notice("%s transmit compression enabled", method_name(ho, NULL)); + #ifdef MPPE +- if (go->mppe) { ++ if (go->mppe || go->mppc) { + BZERO(mppe_recv_key, MPPE_MAX_KEY_LEN); + BZERO(mppe_send_key, MPPE_MAX_KEY_LEN); + continue_networks(f->unit); /* Bring up IP et al */ + } +-#endif ++#endif /* MPPE */ + } + + /* +@@ -1468,7 +1965,7 @@ + lcp_close(f->unit, "MPPE disabled"); + } + } +-#endif ++#endif /* MPPE */ + } + + /* +@@ -1528,24 +2025,28 @@ + #ifdef MPPE + case CI_MPPE: + if (optlen >= CILEN_MPPE) { +- u_char mppe_opts; +- +- MPPE_CI_TO_OPTS(&p[2], mppe_opts); +- printer(arg, "mppe %s %s %s %s %s %s%s", +- (p[2] & MPPE_H_BIT)? "+H": "-H", +- (p[5] & MPPE_M_BIT)? "+M": "-M", +- (p[5] & MPPE_S_BIT)? "+S": "-S", +- (p[5] & MPPE_L_BIT)? "+L": "-L", ++ printer(arg, "mppe %s %s %s %s %s %s", ++ (p[2] & MPPE_STATELESS)? "+H": "-H", ++ (p[5] & MPPE_56BIT)? "+M": "-M", ++ (p[5] & MPPE_128BIT)? "+S": "-S", ++ (p[5] & MPPE_40BIT)? "+L": "-L", + (p[5] & MPPE_D_BIT)? "+D": "-D", +- (p[5] & MPPE_C_BIT)? "+C": "-C", +- (mppe_opts & MPPE_OPT_UNKNOWN)? " +U": ""); +- if (mppe_opts & MPPE_OPT_UNKNOWN) ++ (p[5] & MPPE_MPPC)? "+C": "-C"); ++ if ((p[5] & ~(MPPE_56BIT | MPPE_128BIT | MPPE_40BIT | ++ MPPE_D_BIT | MPPE_MPPC)) || ++ (p[2] & ~MPPE_STATELESS)) + printer(arg, " (%.2x %.2x %.2x %.2x)", + p[2], p[3], p[4], p[5]); + p += CILEN_MPPE; + } + break; +-#endif ++#endif /* MPPE */ ++ case CI_LZS: ++ if (optlen >= CILEN_LZS) { ++ printer(arg, "lzs %.2x %.2x %.2x", p[2], p[3], p[4]); ++ p += CILEN_LZS; ++ } ++ break; + case CI_DEFLATE: + case CI_DEFLATE_DRAFT: + if (optlen >= CILEN_DEFLATE) { +@@ -1631,6 +2132,7 @@ + error("Lost compression sync: disabling compression"); + ccp_close(unit, "Lost compression sync"); + #ifdef MPPE ++ /* My module dosn't need this. J.D., 2003-07-06 */ + /* + * If we were doing MPPE, we must also take the link down. + */ +@@ -1638,9 +2140,18 @@ + error("Too many MPPE errors, closing LCP"); + lcp_close(unit, "Too many MPPE errors"); + } +-#endif ++#endif /* MPPE */ + } else { + /* ++ * When LZS or MPPE/MPPC is negotiated we just send CCP_RESETREQ ++ * and don't wait for CCP_RESETACK ++ */ ++ if ((ccp_gotoptions[f->unit].method == CI_LZS) || ++ (ccp_gotoptions[f->unit].method == CI_MPPE)) { ++ fsm_sdata(f, CCP_RESETREQ, f->reqid = ++f->id, NULL, 0); ++ return; ++ } ++ /* + * Send a reset-request to reset the peer's compressor. + * We don't do that if we are still waiting for an + * acknowledgement to a previous reset-request. +@@ -1671,4 +2182,3 @@ + } else + ccp_localstate[f->unit] &= ~RACK_PENDING; + } +- +diff -ruN ppp-2.4.3.orig/pppd/ccp.h ppp-2.4.3/pppd/ccp.h +--- ppp-2.4.3.orig/pppd/ccp.h 2004-11-04 11:02:26.000000000 +0100 ++++ ppp-2.4.3/pppd/ccp.h 2004-11-21 13:54:09.000000000 +0100 +@@ -37,9 +37,17 @@ + bool predictor_2; /* do Predictor-2? */ + bool deflate_correct; /* use correct code for deflate? */ + bool deflate_draft; /* use draft RFC code for deflate? */ ++ bool lzs; /* do Stac LZS? */ ++ bool mppc; /* do MPPC? */ + bool mppe; /* do MPPE? */ ++ bool mppe_40; /* allow 40 bit encryption? */ ++ bool mppe_56; /* allow 56 bit encryption? */ ++ bool mppe_128; /* allow 128 bit encryption? */ ++ bool mppe_stateless; /* allow stateless encryption */ + u_short bsd_bits; /* # bits/code for BSD Compress */ + u_short deflate_size; /* lg(window size) for Deflate */ ++ u_short lzs_mode; /* LZS check mode */ ++ u_short lzs_hists; /* number of LZS histories */ + short method; /* code for chosen compression method */ + } ccp_options; + +diff -ruN ppp-2.4.3.orig/pppd/chap_ms.c ppp-2.4.3/pppd/chap_ms.c +--- ppp-2.4.3.orig/pppd/chap_ms.c 2004-11-12 10:57:43.000000000 +0100 ++++ ppp-2.4.3/pppd/chap_ms.c 2004-11-21 13:54:09.000000000 +0100 +@@ -895,13 +895,17 @@ + /* + * Disable undesirable encryption types. Note that we don't ENABLE + * any encryption types, to avoid overriding manual configuration. ++ * ++ * It seems that 56 bit keys are unsupported in MS-RADIUS (see RFC 2548) + */ + switch(types) { + case MPPE_ENC_TYPES_RC4_40: +- ccp_wantoptions[0].mppe &= ~MPPE_OPT_128; /* disable 128-bit */ ++ ccp_wantoptions[0].mppe_128 = 0; /* disable 128-bit */ ++ ccp_wantoptions[0].mppe_56 = 0; /* disable 56-bit */ + break; + case MPPE_ENC_TYPES_RC4_128: +- ccp_wantoptions[0].mppe &= ~MPPE_OPT_40; /* disable 40-bit */ ++ ccp_wantoptions[0].mppe_56 = 0; /* disable 56-bit */ ++ ccp_wantoptions[0].mppe_40 = 0; /* disable 40-bit */ + break; + default: + break; +diff -ruN ppp-2.4.3.orig/pppd/pppd.8 ppp-2.4.3/pppd/pppd.8 +--- ppp-2.4.3.orig/pppd/pppd.8 2004-11-13 13:22:49.000000000 +0100 ++++ ppp-2.4.3/pppd/pppd.8 2004-11-21 14:24:47.000000000 +0100 +@@ -622,9 +622,29 @@ + Enables the use of PPP multilink; this is an alias for the `multilink' + option. This option is currently only available under Linux. + .TP +-.B mppe\-stateful +-Allow MPPE to use stateful mode. Stateless mode is still attempted first. +-The default is to disallow stateful mode. ++.B mppc ++Enables MPPC (Microsoft Point to Point Compression). This is the default. ++.TP ++.B mppe \fIsubopt1[,subopt2[,subopt3[..]]] ++Modify MPPE (Microsoft Point to Point Encryption) parameters. In order ++for MPPE to successfully come up, you must have authenticated with either ++MS-CHAP or MS-CHAPv2. By default MPPE is optional, it means that pppd will ++not propose MPPE to the peer, but will negotiate MPPE if peer wants that. ++You can change this using \fIrequired\fR suboption. ++This option is presently only supported under Linux, and only if your ++kernel has been configured to include MPPE support. ++.IP ++MPPE suboptions: ++.br ++\fIrequired\fR - require MPPE; disconnect if peer doesn't support it, ++.br ++\fIstateless\fR - try to negotiate stateless mode; default is stateful, ++.br ++\fIno40\fR - disable 40 bit keys, ++.br ++\fIno56\fR - disable 56 bit keys, ++.br ++\fIno128\fR - disable 128 bit keys + .TP + .B mpshortseq + Enables the use of short (12-bit) sequence numbers in multilink +@@ -757,17 +777,11 @@ + Disables the use of PPP multilink. This option is currently only + available under Linux. + .TP +-.B nomppe +-Disables MPPE (Microsoft Point to Point Encryption). This is the default. +-.TP +-.B nomppe\-40 +-Disable 40-bit encryption with MPPE. ++.B nomppc ++Disables MPPC (Microsoft Point to Point Compression). + .TP +-.B nomppe\-128 +-Disable 128-bit encryption with MPPE. +-.TP +-.B nomppe\-stateful +-Disable MPPE stateful mode. This is the default. ++.B nomppe ++Disables MPPE (Microsoft Point to Point Encryption). + .TP + .B nompshortseq + Disables the use of short (12-bit) sequence numbers in the PPP +@@ -948,19 +962,6 @@ + Require the peer to authenticate itself using CHAP [Challenge + Handshake Authentication Protocol] authentication. + .TP +-.B require\-mppe +-Require the use of MPPE (Microsoft Point to Point Encryption). This +-option disables all other compression types. This option enables +-both 40-bit and 128-bit encryption. In order for MPPE to successfully +-come up, you must have authenticated with either MS\-CHAP or MS\-CHAPv2. +-This option is presently only supported under Linux, and only if your +-kernel has been configured to include MPPE support. +-.TP +-.B require\-mppe\-40 +-Require the use of MPPE, with 40-bit encryption. +-.TP +-.B require\-mppe\-128 +-Require the use of MPPE, with 128-bit encryption. + .TP + .B require\-mschap + Require the peer to authenticate itself using MS\-CHAP [Microsoft Challenge diff --git a/package/ppp/patches/202-atm_fix.patch b/package/ppp/patches/202-atm_fix.patch new file mode 100644 index 0000000000..40d9d595cf --- /dev/null +++ b/package/ppp/patches/202-atm_fix.patch @@ -0,0 +1,11 @@ +--- ppp-2.4.3/pppd/plugins/pppoatm/pppoatm.c 2005-08-26 15:18:55.000000000 +0200 ++++ ppp-2.4.3/pppd/plugins/pppoatm/pppoatm.c 2005-08-26 15:19:51.000000000 +0200 +@@ -136,8 +136,6 @@ + int fd; + struct atm_qos qos; + +- system ("/sbin/modprobe pppoatm"); +- + if (!device_got_set) + no_device_given_pppoatm(); + fd = socket(AF_ATMPVC, SOCK_DGRAM, 0); diff --git a/package/ppp/patches/203-no_strip.patch b/package/ppp/patches/203-no_strip.patch new file mode 100644 index 0000000000..216973cf59 --- /dev/null +++ b/package/ppp/patches/203-no_strip.patch @@ -0,0 +1,86 @@ +diff -ruN ppp-2.4.3-orig/chat/Makefile.linux ppp-2.4.3-3/chat/Makefile.linux +--- ppp-2.4.3-orig/chat/Makefile.linux 2004-11-03 12:51:47.000000000 +0100 ++++ ppp-2.4.3-3/chat/Makefile.linux 2004-12-05 17:42:43.000000000 +0100 +@@ -25,7 +25,7 @@ + + install: chat + mkdir -p $(BINDIR) +- $(INSTALL) -s -c chat $(BINDIR) ++ $(INSTALL) -c chat $(BINDIR) + $(INSTALL) -c -m 644 chat.8 $(MANDIR) + + clean: +diff -ruN ppp-2.4.3-orig/pppd/Makefile.linux ppp-2.4.3-3/pppd/Makefile.linux +--- ppp-2.4.3-orig/pppd/Makefile.linux 2004-11-13 13:02:22.000000000 +0100 ++++ ppp-2.4.3-3/pppd/Makefile.linux 2004-12-16 04:43:41.000000000 +0100 +@@ -99,7 +99,7 @@ + CFLAGS += -DUSE_SRP -DOPENSSL -I/usr/local/ssl/include + LIBS += -lsrp -L/usr/local/ssl/lib -lcrypto + TARGETS += srp-entry +-EXTRAINSTALL = $(INSTALL) -s -c -m 555 srp-entry $(BINDIR)/srp-entry ++EXTRAINSTALL = $(INSTALL) -c -m 555 srp-entry $(BINDIR)/srp-entry + MANPAGES += srp-entry.8 + EXTRACLEAN += srp-entry.o + NEEDDES=y +@@ -202,7 +202,7 @@ + install: pppd + mkdir -p $(BINDIR) $(MANDIR) + $(EXTRAINSTALL) +- $(INSTALL) -s -c -m 555 pppd $(BINDIR)/pppd ++ $(INSTALL) -c -m 555 pppd $(BINDIR)/pppd + if chgrp pppusers $(BINDIR)/pppd 2>/dev/null; then \ + chmod o-rx,u+s $(BINDIR)/pppd; fi + $(INSTALL) -c -m 444 pppd.8 $(MANDIR) +diff -ruN ppp-2.4.3-orig/pppd/plugins/radius/Makefile.linux ppp-2.4.3-3/pppd/plugins/radius/Makefile.linux +--- ppp-2.4.3-orig/pppd/plugins/radius/Makefile.linux 2004-11-14 08:02:31.000000000 +0100 ++++ ppp-2.4.3-3/pppd/plugins/radius/Makefile.linux 2004-12-05 17:43:17.000000000 +0100 +@@ -36,9 +37,9 @@ + + install: all + $(INSTALL) -d -m 755 $(LIBDIR) +- $(INSTALL) -s -c -m 755 radius.so $(LIBDIR) +- $(INSTALL) -s -c -m 755 radattr.so $(LIBDIR) +- $(INSTALL) -s -c -m 755 radrealms.so $(LIBDIR) ++ $(INSTALL) -c -m 755 radius.so $(LIBDIR) ++ $(INSTALL) -c -m 755 radattr.so $(LIBDIR) ++ $(INSTALL) -c -m 755 radrealms.so $(LIBDIR) + $(INSTALL) -c -m 444 pppd-radius.8 $(MANDIR) + $(INSTALL) -c -m 444 pppd-radattr.8 $(MANDIR) + +diff -ruN ppp-2.4.3-orig/pppd/plugins/rp-pppoe/Makefile.linux ppp-2.4.3-3/pppd/plugins/rp-pppoe/Makefile.linux +--- ppp-2.4.3-orig/pppd/plugins/rp-pppoe/Makefile.linux 2004-11-14 08:58:37.000000000 +0100 ++++ ppp-2.4.3-3/pppd/plugins/rp-pppoe/Makefile.linux 2004-12-05 17:43:23.000000000 +0100 +@@ -39,9 +39,9 @@ + + install: all + $(INSTALL) -d -m 755 $(LIBDIR) +- $(INSTALL) -s -c -m 4550 rp-pppoe.so $(LIBDIR) ++ $(INSTALL) -c -m 4550 rp-pppoe.so $(LIBDIR) + $(INSTALL) -d -m 755 $(BINDIR) +- $(INSTALL) -s -c -m 555 pppoe-discovery $(BINDIR) ++ $(INSTALL) -c -m 555 pppoe-discovery $(BINDIR) + + clean: + rm -f *.o *.so +diff -ruN ppp-2.4.3-orig/pppdump/Makefile.linux ppp-2.4.3-3/pppdump/Makefile.linux +--- ppp-2.4.3-orig/pppdump/Makefile.linux 2004-10-31 02:36:52.000000000 +0200 ++++ ppp-2.4.3-3/pppdump/Makefile.linux 2004-12-05 17:50:34.000000000 +0100 +@@ -17,5 +18,5 @@ + + install: + mkdir -p $(BINDIR) $(MANDIR) +- $(INSTALL) -s -c pppdump $(BINDIR) ++ $(INSTALL) -c pppdump $(BINDIR) + $(INSTALL) -c -m 444 pppdump.8 $(MANDIR) +diff -ruN ppp-2.4.3-orig/pppstats/Makefile.linux ppp-2.4.3-3/pppstats/Makefile.linux +--- ppp-2.4.3-orig/pppstats/Makefile.linux 2004-10-31 23:09:03.000000000 +0100 ++++ ppp-2.4.3-3/pppstats/Makefile.linux 2004-12-05 17:43:38.000000000 +0100 +@@ -22,7 +22,7 @@ + + install: pppstats + -mkdir -p $(MANDIR) +- $(INSTALL) -s -c pppstats $(BINDIR) ++ $(INSTALL) -c pppstats $(BINDIR) + $(INSTALL) -c -m 444 pppstats.8 $(MANDIR) + + pppstats: $(PPPSTATSRCS) diff --git a/package/ppp/patches/204-opt_flags.patch b/package/ppp/patches/204-opt_flags.patch new file mode 100644 index 0000000000..200e76b5b5 --- /dev/null +++ b/package/ppp/patches/204-opt_flags.patch @@ -0,0 +1,26 @@ +diff -ruN ppp-2.4.3-orig/pppd/plugins/radius/Makefile.linux ppp-2.4.3-3/pppd/plugins/radius/Makefile.linux +--- ppp-2.4.3-orig/pppd/plugins/radius/Makefile.linux 2004-11-14 08:02:31.000000000 +0100 ++++ ppp-2.4.3-3/pppd/plugins/radius/Makefile.linux 2004-12-05 17:43:17.000000000 +0100 +@@ -12,7 +12,8 @@ + INSTALL = install + + PLUGIN=radius.so radattr.so radrealms.so +-CFLAGS=-I. -I../.. -I../../../include -O2 -fPIC -DRC_LOG_FACILITY=LOG_DAEMON ++COPTS = -O2 ++CFLAGS=-I. -I../.. -I../../../include $(COPTS) -fPIC -DRC_LOG_FACILITY=LOG_DAEMON + + # Uncomment the next line to include support for Microsoft's + # MS-CHAP authentication protocol. +diff -ruN ppp-2.4.3-orig/pppdump/Makefile.linux ppp-2.4.3-3/pppdump/Makefile.linux +--- ppp-2.4.3-orig/pppdump/Makefile.linux 2004-10-31 02:36:52.000000000 +0200 ++++ ppp-2.4.3-3/pppdump/Makefile.linux 2004-12-05 17:50:34.000000000 +0100 +@@ -2,7 +2,8 @@ + BINDIR = $(DESTDIR)/sbin + MANDIR = $(DESTDIR)/share/man/man8 + +-CFLAGS= -O -I../include/net ++COPTS = -O ++CFLAGS= $(COPTS) -I../include/net + OBJS = pppdump.o bsd-comp.o deflate.o zlib.o + + INSTALL= install diff --git a/package/ppp/patches/205-pppoe_iface_name.patch b/package/ppp/patches/205-pppoe_iface_name.patch new file mode 100644 index 0000000000..0961eca623 --- /dev/null +++ b/package/ppp/patches/205-pppoe_iface_name.patch @@ -0,0 +1,12 @@ +diff -ruN ppp-2.4.3-orig/pppd/plugins/rp-pppoe/plugin.c ppp-2.4.3-3/pppd/plugins/rp-pppoe/plugin.c +--- ppp-2.4.3-orig/pppd/plugins/rp-pppoe/plugin.c 2004-11-04 11:07:37.000000000 +0100 ++++ ppp-2.4.3-3/pppd/plugins/rp-pppoe/plugin.c 2004-12-16 01:07:22.000000000 +0100 +@@ -286,7 +286,7 @@ + /* Strip off "nic-" */ + cmd += 4; + } else if (strlen(cmd) < 4 +- || (strncmp(cmd, "eth", 3) && strncmp(cmd, "nas", 3) ++ || (strncmp(cmd, "eth", 3) && strncmp(cmd, "nas", 3) && strncmp(cmd, "vlan", 4) && strncmp(cmd, "ath", 3) + && strncmp(cmd, "tap", 3) && strncmp(cmd, "br", 2))) { + return 0; + } diff --git a/package/ppp/patches/206-radius_config.patch b/package/ppp/patches/206-radius_config.patch new file mode 100644 index 0000000000..90c02af4c1 --- /dev/null +++ b/package/ppp/patches/206-radius_config.patch @@ -0,0 +1,74 @@ +diff -ruN ppp-2.4.3-orig/pppd/plugins/radius/config.c ppp-2.4.3-3/pppd/plugins/radius/config.c +--- ppp-2.4.3-orig/pppd/plugins/radius/config.c 2004-11-14 08:26:26.000000000 +0100 ++++ ppp-2.4.3-3/pppd/plugins/radius/config.c 2004-12-16 04:03:46.000000000 +0100 +@@ -369,31 +369,37 @@ + } + #endif + ++#if 0 + if (rc_conf_int("login_tries") <= 0) + { + error("%s: login_tries <= 0 is illegal", filename); + return (-1); + } ++#endif + if (rc_conf_str("seqfile") == NULL) + { + error("%s: seqfile not specified", filename); + return (-1); + } ++#if 0 + if (rc_conf_int("login_timeout") <= 0) + { + error("%s: login_timeout <= 0 is illegal", filename); + return (-1); + } ++#endif + if (rc_conf_str("mapfile") == NULL) + { + error("%s: mapfile not specified", filename); + return (-1); + } ++#if 0 + if (rc_conf_str("nologin") == NULL) + { + error("%s: nologin not specified", filename); + return (-1); + } ++#endif + + return 0; + } +diff -ruN ppp-2.4.3-orig/pppd/plugins/radius/options.h ppp-2.4.3-3/pppd/plugins/radius/options.h +--- ppp-2.4.3-orig/pppd/plugins/radius/options.h 2004-11-14 08:26:26.000000000 +0100 ++++ ppp-2.4.3-3/pppd/plugins/radius/options.h 2004-12-16 04:09:16.000000000 +0100 +@@ -31,24 +31,21 @@ + static SERVER acctserver = {0}; + static SERVER authserver = {0}; + +-int default_tries = 4; +-int default_timeout = 60; +- + static OPTION config_options[] = { + /* internally used options */ + {"config_file", OT_STR, ST_UNDEF, NULL}, + /* General options */ + {"auth_order", OT_AUO, ST_UNDEF, NULL}, +-{"login_tries", OT_INT, ST_UNDEF, &default_tries}, +-{"login_timeout", OT_INT, ST_UNDEF, &default_timeout}, +-{"nologin", OT_STR, ST_UNDEF, "/etc/nologin"}, +-{"issue", OT_STR, ST_UNDEF, "/etc/radiusclient/issue"}, ++{"login_tries", OT_INT, ST_UNDEF, NULL}, ++{"login_timeout", OT_INT, ST_UNDEF, NULL}, ++{"nologin", OT_STR, ST_UNDEF, NULL}, ++{"issue", OT_STR, ST_UNDEF, NULL}, + /* RADIUS specific options */ + {"authserver", OT_SRV, ST_UNDEF, &authserver}, + {"acctserver", OT_SRV, ST_UNDEF, &acctserver}, + {"servers", OT_STR, ST_UNDEF, NULL}, + {"dictionary", OT_STR, ST_UNDEF, NULL}, +-{"login_radius", OT_STR, ST_UNDEF, "/usr/sbin/login.radius"}, ++{"login_radius", OT_STR, ST_UNDEF, NULL}, + {"seqfile", OT_STR, ST_UNDEF, NULL}, + {"mapfile", OT_STR, ST_UNDEF, NULL}, + {"default_realm", OT_STR, ST_UNDEF, NULL}, diff --git a/package/ppp/patches/207-ppp_reconnect.patch b/package/ppp/patches/207-ppp_reconnect.patch new file mode 100644 index 0000000000..9311c9ef4e --- /dev/null +++ b/package/ppp/patches/207-ppp_reconnect.patch @@ -0,0 +1,129 @@ +diff -urN -x'*.swp' ppp.old/pppd/auth.c ppp.dev/pppd/auth.c +--- ppp.old/pppd/auth.c 2004-11-12 11:30:51.000000000 +0100 ++++ ppp.dev/pppd/auth.c 2005-07-13 14:54:23.000000000 +0200 +@@ -532,6 +532,12 @@ + link_required(unit) + int unit; + { ++} ++ ++void ++start_link(unit) ++ int unit; ++{ + new_phase(PHASE_SERIALCONN); + + devfd = the_channel->connect(); +@@ -984,10 +990,12 @@ + int unit, protocol, prot_flavor; + { + int bit; ++ const char *prot = ""; + + switch (protocol) { + case PPP_CHAP: + bit = CHAP_WITHPEER; ++ prot = "CHAP"; + switch (prot_flavor) { + case CHAP_MD5: + bit |= CHAP_MD5_WITHPEER; +@@ -1006,15 +1014,19 @@ + if (passwd_from_file) + BZERO(passwd, MAXSECRETLEN); + bit = PAP_WITHPEER; ++ prot = "PAP"; + break; + case PPP_EAP: + bit = EAP_WITHPEER; ++ prot = "EAP"; + break; + default: + warn("auth_withpeer_success: unknown protocol %x", protocol); + bit = 0; + } + ++ notice("%s authentication succeeded", prot); ++ + /* Save the authentication method for later. */ + auth_done[unit] |= bit; + +@@ -1648,6 +1660,7 @@ + static void + plogout() + { ++ char *tty; + #ifdef USE_PAM + int pam_error; + +@@ -1658,14 +1671,12 @@ + } + /* Apparently the pam stuff does closelog(). */ + reopen_log(); +-#else /* ! USE_PAM */ +- char *tty; ++#endif /* USE_PAM */ + + tty = devnam; + if (strncmp(tty, "/dev/", 5) == 0) + tty += 5; + logwtmp(tty, "", ""); /* Wipe out utmp logout entry */ +-#endif /* ! USE_PAM */ + logged_in = 0; + } + +diff -urN -x'*.swp' ppp.old/pppd/main.c ppp.dev/pppd/main.c +--- ppp.old/pppd/main.c 2005-07-13 11:34:28.000000000 +0200 ++++ ppp.dev/pppd/main.c 2005-07-13 14:49:06.000000000 +0200 +@@ -537,6 +537,7 @@ + script_unsetenv("BYTES_RCVD"); + + lcp_open(0); /* Start protocol */ ++ start_link(0); + while (phase != PHASE_DEAD) { + handle_events(); + get_input(); +diff -urN -x'*.swp' ppp.old/pppd/pppd.h ppp.dev/pppd/pppd.h +--- ppp.old/pppd/pppd.h 2005-07-13 11:34:28.000000000 +0200 ++++ ppp.dev/pppd/pppd.h 2005-07-13 14:48:56.000000000 +0200 +@@ -526,6 +526,7 @@ + + /* Procedures exported from auth.c */ + void link_required __P((int)); /* we are starting to use the link */ ++void start_link __P((int)); /* bring the link up now */ + void link_terminated __P((int)); /* we are finished with the link */ + void link_down __P((int)); /* the LCP layer has left the Opened state */ + void upper_layers_down __P((int));/* take all NCPs down */ +diff -urN -x'*.swp' ppp.old/pppd/tty.c ppp.dev/pppd/tty.c +--- ppp.old/pppd/tty.c 2004-11-13 13:07:29.000000000 +0100 ++++ ppp.dev/pppd/tty.c 2005-07-13 14:46:57.000000000 +0200 +@@ -755,14 +755,6 @@ + close(pty_master); + pty_master = -1; + } +- if (pty_slave >= 0) { +- close(pty_slave); +- pty_slave = -1; +- } +- if (real_ttyfd >= 0) { +- close(real_ttyfd); +- real_ttyfd = -1; +- } + ttyfd = -1; + if (got_sigterm) + asked_to_quit = 1; +@@ -781,6 +773,7 @@ + } else { + info("Serial link disconnected."); + } ++ stop_charshunt(NULL, 0); + } + + void tty_close_fds() +@@ -944,7 +937,6 @@ + exit(0); + } + charshunt_pid = cpid; +- add_notifier(&sigreceived, stop_charshunt, 0); + record_child(cpid, "pppd (charshunt)", charshunt_done, NULL); + return 1; + } diff --git a/package/ppp/patches/208-no_exponential_timeout.patch b/package/ppp/patches/208-no_exponential_timeout.patch new file mode 100644 index 0000000000..d6c986a7ed --- /dev/null +++ b/package/ppp/patches/208-no_exponential_timeout.patch @@ -0,0 +1,28 @@ +diff -urN ppp.old/pppd/plugins/rp-pppoe/discovery.c ppp.dev/pppd/plugins/rp-pppoe/discovery.c +--- ppp.old/pppd/plugins/rp-pppoe/discovery.c 2005-09-05 15:25:35.917232000 +0200 ++++ ppp.dev/pppd/plugins/rp-pppoe/discovery.c 2005-09-05 15:29:17.233586872 +0200 +@@ -593,12 +593,14 @@ + conn->discoveryState = STATE_SENT_PADI; + waitForPADO(conn, timeout); + ++#if 0 + /* If we're just probing for access concentrators, don't do + exponential backoff. This reduces the time for an unsuccessful + probe to 15 seconds. */ + if (!conn->printACNames) { + timeout *= 2; + } ++#endif + if (conn->printACNames && conn->numPADOs) { + break; + } +@@ -621,7 +623,9 @@ + sendPADR(conn); + conn->discoveryState = STATE_SENT_PADR; + waitForPADS(conn, timeout); ++#if 0 + timeout *= 2; ++#endif + } while (conn->discoveryState == STATE_SENT_PADR); + + /* We're done. */ diff --git a/package/ppp/patches/209-compensate_time_change.patch b/package/ppp/patches/209-compensate_time_change.patch new file mode 100644 index 0000000000..f43085ab11 --- /dev/null +++ b/package/ppp/patches/209-compensate_time_change.patch @@ -0,0 +1,82 @@ +diff -urN ppp.old/pppd/main.c ppp.dev/pppd/main.c +--- ppp.old/pppd/main.c 2005-11-11 19:19:28.177790000 +0100 ++++ ppp.dev/pppd/main.c 2005-11-11 20:18:05.957363000 +0100 +@@ -90,6 +90,7 @@ + #include <sys/socket.h> + #include <netinet/in.h> + #include <arpa/inet.h> ++#include <sys/sysinfo.h> + + #include "pppd.h" + #include "magic.h" +@@ -227,6 +228,7 @@ + + /* Prototypes for procedures local to this file. */ + ++static void check_time(void); + static void setup_signals __P((void)); + static void create_pidfile __P((int pid)); + static void create_linkpidfile __P((int pid)); +@@ -531,6 +533,7 @@ + info("Starting link"); + } + ++ check_time(); + gettimeofday(&start_time, NULL); + script_unsetenv("CONNECT_TIME"); + script_unsetenv("BYTES_SENT"); +@@ -1195,6 +1198,36 @@ + + static struct callout *callout = NULL; /* Callout list */ + static struct timeval timenow; /* Current time */ ++static long uptime_diff = 0; ++static int uptime_diff_set = 0; ++ ++static void check_time(void) ++{ ++ long new_diff; ++ struct timeval t; ++ struct sysinfo i; ++ struct callout *p; ++ ++ gettimeofday(&t, NULL); ++ sysinfo(&i); ++ new_diff = t.tv_sec - i.uptime; ++ ++ if (!uptime_diff_set) { ++ uptime_diff = new_diff; ++ uptime_diff_set = 1; ++ return; ++ } ++ ++ if ((new_diff - 5 > uptime_diff) || (new_diff + 5 < uptime_diff)) { ++ /* system time has changed, update counters and timeouts */ ++ info("System time change detected."); ++ start_time.tv_sec += new_diff - uptime_diff; ++ ++ for (p = callout; p != NULL; p = p->c_next) ++ p->c_time.tv_sec += new_diff - uptime_diff; ++ } ++ uptime_diff = new_diff; ++} + + /* + * timeout - Schedule a timeout. +@@ -1265,6 +1298,8 @@ + { + struct callout *p; + ++ check_time(); ++ + while (callout != NULL) { + p = callout; + +@@ -1292,6 +1327,8 @@ + { + if (callout == NULL) + return NULL; ++ ++ check_time(); + + gettimeofday(&timenow, NULL); + tvp->tv_sec = callout->c_time.tv_sec - timenow.tv_sec; diff --git a/package/ppp/patches/210-lcp_mtu_max.patch b/package/ppp/patches/210-lcp_mtu_max.patch new file mode 100644 index 0000000000..2056a87325 --- /dev/null +++ b/package/ppp/patches/210-lcp_mtu_max.patch @@ -0,0 +1,17 @@ +--- ppp-2.4.3/pppd/lcp.c.old 2006-10-10 14:19:11.000000000 +0200 ++++ ppp-2.4.3/pppd/lcp.c 2006-10-10 14:19:55.000000000 +0200 +@@ -1891,12 +1891,12 @@ + * the interface MTU is set to the lowest of that, the + * MTU we want to use, and our link MRU. + */ +- mtu = ho->neg_mru? ho->mru: PPP_MRU; ++ mtu = MIN(ho->neg_mru? ho->mru: PPP_MRU, ao->mru); + mru = go->neg_mru? MAX(wo->mru, go->mru): PPP_MRU; + #ifdef HAVE_MULTILINK + if (!(multilink && go->neg_mrru && ho->neg_mrru)) + #endif /* HAVE_MULTILINK */ +- netif_set_mtu(f->unit, MIN(MIN(mtu, mru), ao->mru)); ++ netif_set_mtu(f->unit, MIN(mtu, mru)); + ppp_send_config(f->unit, mtu, + (ho->neg_asyncmap? ho->asyncmap: 0xffffffff), + ho->neg_pcompression, ho->neg_accompression); diff --git a/package/ppp/patches/300-filter-pcap-includes-lib.patch b/package/ppp/patches/300-filter-pcap-includes-lib.patch new file mode 100644 index 0000000000..3f6247d6ef --- /dev/null +++ b/package/ppp/patches/300-filter-pcap-includes-lib.patch @@ -0,0 +1,14 @@ +diff -urN ppp-2.4.3.orig/pppd/Makefile.linux ppp-2.4.3/pppd/Makefile.linux +--- ppp-2.4.3.orig/pppd/Makefile.linux 2006-02-05 20:13:06.000000000 +0100 ++++ ppp-2.4.3/pppd/Makefile.linux 2006-02-05 20:24:22.000000000 +0100 +@@ -172,8 +172,8 @@ + + ifdef FILTER + ifneq ($(wildcard /usr/include/pcap-bpf.h),) +-LIBS += -lpcap +-CFLAGS += -DPPP_FILTER ++LIBS += -lpcap -L$(STAGING_DIR)/usr/lib ++CFLAGS += -DPPP_FILTER -I$(STAGING_DIR)/usr/include + endif + endif + diff --git a/package/ppp/patches/310-precompiled_filter.patch b/package/ppp/patches/310-precompiled_filter.patch new file mode 100644 index 0000000000..df9452c379 --- /dev/null +++ b/package/ppp/patches/310-precompiled_filter.patch @@ -0,0 +1,231 @@ +diff -urN ppp.old/pppd/Makefile.linux ppp.dev/pppd/Makefile.linux +--- ppp.old/pppd/Makefile.linux 2006-03-18 15:58:00.000000000 +0100 ++++ ppp.dev/pppd/Makefile.linux 2006-03-18 16:52:01.000000000 +0100 +@@ -50,6 +50,9 @@ + # and that the kernel driver support PPP packet filtering. + #FILTER=y + ++# Support for precompiled filters ++PRECOMPILED_FILTER=y ++ + # Uncomment the next line to enable multilink PPP (enabled by default) + # Linux distributions: Please leave multilink ENABLED in your builds + # of pppd! +@@ -177,6 +180,14 @@ + endif + endif + ++ifdef PRECOMPILED_FILTER ++PPPDSRCS += pcap_pcc.c ++HEADERS += pcap_pcc.h ++PPPDOBJS += pcap_pcc.o ++LIBS += $(STAGING_DIR)/usr/lib/libpcap.a ++CFLAGS += -DPPP_FILTER -DPPP_PRECOMPILED_FILTER -I$(STAGING_DIR)/usr/include ++endif ++ + ifdef HAVE_INET6 + PPPDSRCS += ipv6cp.c eui64.c + HEADERS += ipv6cp.h eui64.h +diff -urN ppp.old/pppd/demand.c ppp.dev/pppd/demand.c +--- ppp.old/pppd/demand.c 2006-03-18 15:58:00.000000000 +0100 ++++ ppp.dev/pppd/demand.c 2006-03-18 18:09:16.000000000 +0100 +@@ -438,12 +438,14 @@ + return 0; + proto = PPP_PROTOCOL(p); + #ifdef PPP_FILTER ++ *p = 1; /* set outbound for the filter rule */ + if (pass_filter.bf_len != 0 + && bpf_filter(pass_filter.bf_insns, p, len, len) == 0) + return 0; + if (active_filter.bf_len != 0 + && bpf_filter(active_filter.bf_insns, p, len, len) == 0) + return 0; ++ *p = 0xff; /* restore original ppp header */ + #endif + for (i = 0; (protp = protocols[i]) != NULL; ++i) { + if (protp->protocol < 0xC000 && (protp->protocol & ~0x8000) == proto) { +diff -urN ppp.old/pppd/options.c ppp.dev/pppd/options.c +--- ppp.old/pppd/options.c 2006-03-18 15:58:00.000000000 +0100 ++++ ppp.dev/pppd/options.c 2006-03-18 18:05:58.000000000 +0100 +@@ -57,14 +57,7 @@ + + #ifdef PPP_FILTER + #include <pcap.h> +-/* +- * DLT_PPP_WITH_DIRECTION is in current libpcap cvs, and should be in +- * libpcap-0.8.4. Until that is released, use DLT_PPP - but that means +- * we lose the inbound and outbound qualifiers. +- */ +-#ifndef DLT_PPP_WITH_DIRECTION +-#define DLT_PPP_WITH_DIRECTION DLT_PPP +-#endif ++#include <pcap-bpf.h> + #endif + + #include "pppd.h" +@@ -155,6 +148,13 @@ + static int loadplugin __P((char **)); + #endif + ++#ifdef PPP_PRECOMPILED_FILTER ++#include "pcap_pcc.h" ++static int setprecompiledpassfilter __P((char **)); ++static int setprecompiledactivefilter __P((char **)); ++#undef PPP_FILTER ++#endif ++ + #ifdef PPP_FILTER + static int setpassfilter __P((char **)); + static int setactivefilter __P((char **)); +@@ -312,6 +312,14 @@ + "set filter for active pkts", OPT_PRIO }, + #endif + ++#ifdef PPP_PRECOMPILED_FILTER ++ { "precompiled-pass-filter", 1, setprecompiledpassfilter, ++ "set precompiled filter for packets to pass", OPT_PRIO }, ++ ++ { "precompiled-active-filter", 1, setprecompiledactivefilter, ++ "set precompiled filter for active pkts", OPT_PRIO }, ++#endif ++ + #ifdef MAXOCTETS + { "maxoctets", o_int, &maxoctets, + "Set connection traffic limit", +@@ -1447,6 +1455,29 @@ + return ok; + } + ++#ifdef PPP_PRECOMPILED_FILTER ++/* ++ * setprecompiledpassfilter - Set the pass filter for packets using a ++ * precompiled expression ++ */ ++static int ++setprecompiledpassfilter(argv) ++ char **argv; ++{ ++ return pcap_pre_compiled (*argv, &pass_filter); ++} ++ ++/* ++ * setactivefilter - Set the active filter for packets ++ */ ++static int ++setprecompiledactivefilter(argv) ++ char **argv; ++{ ++ return pcap_pre_compiled (*argv, &active_filter); ++} ++#endif ++ + #ifdef PPP_FILTER + /* + * setpassfilter - Set the pass filter for packets +@@ -1458,7 +1489,7 @@ + pcap_t *pc; + int ret = 0; + +- pc = pcap_open_dead(DLT_PPP_WITH_DIRECTION, 65535); ++ pc = pcap_open_dead(DLT_PPP_PPPD, 65535); + if (pcap_compile(pc, &pass_filter, *argv, 1, netmask) == -1) { + option_error("error in pass-filter expression: %s\n", + pcap_geterr(pc)); +@@ -1479,7 +1510,7 @@ + pcap_t *pc; + int ret = 0; + +- pc = pcap_open_dead(DLT_PPP_WITH_DIRECTION, 65535); ++ pc = pcap_open_dead(DLT_PPP_PPPD, 65535); + if (pcap_compile(pc, &active_filter, *argv, 1, netmask) == -1) { + option_error("error in active-filter expression: %s\n", + pcap_geterr(pc)); +diff -urN ppp.old/pppd/pcap_pcc.c ppp.dev/pppd/pcap_pcc.c +--- ppp.old/pppd/pcap_pcc.c 1970-01-01 01:00:00.000000000 +0100 ++++ ppp.dev/pppd/pcap_pcc.c 2006-03-18 16:51:31.000000000 +0100 +@@ -0,0 +1,74 @@ ++#include <pcap.h> ++#include <pcap-bpf.h> ++#include <stdio.h> ++#include <stdlib.h> ++#include <string.h> ++#include <errno.h> ++#include "pppd.h" ++ ++int pcap_pre_compiled (char * fname, struct bpf_program *p) ++{ ++ char buf[128]; ++ int line = 0, size = 0, index=0, ret=1; ++ FILE *f = fopen (fname, "r"); ++ if (!f) ++ { ++ option_error("error opening precompiled active-filter '%s': %s", ++ fname, strerror (errno)); ++ return 0; ++ } ++ while (fgets (buf, 127, f)) ++ { ++ line++; ++ if (*buf == '#') ++ continue; ++ if (size) ++ { ++ /* ++ struct bpf_insn { ++ u_short code; ++ u_char jt; ++ u_char jf; ++ bpf_int32 k; ++ } ++ */ ++ struct bpf_insn * insn = & p->bf_insns[index]; ++ unsigned code, jt, jf, k; ++ if (sscanf (buf, "%u %u %u %u", &code, &jt, &jf, &k) != 4) ++ { ++ goto err; ++ } ++ insn->code = code; ++ insn->jt = jt; ++ insn->jf = jf; ++ insn->k = k; ++ index++; ++ } ++ else ++ { ++ if (sscanf (buf, "%u", &size) != 1) ++ { ++ goto err; ++ } ++ p->bf_len = size; ++ p->bf_insns = (struct bpf_insn *) ++ malloc (size * sizeof (struct bpf_insn)); ++ } ++ } ++ if (size != index) ++ { ++ option_error("error in precompiled active-filter," ++ " expected %d expressions, got %dn", ++ size, index); ++ ret = 0; ++ } ++ fclose(f); ++ return ret; ++ ++err: ++ option_error("error in precompiled active-filter" ++ " expression line %s:%d (wrong size)\n", ++ fname, line); ++ fclose (f); ++ return 0; ++} +diff -urN ppp.old/pppd/pcap_pcc.h ppp.dev/pppd/pcap_pcc.h +--- ppp.old/pppd/pcap_pcc.h 1970-01-01 01:00:00.000000000 +0100 ++++ ppp.dev/pppd/pcap_pcc.h 2006-03-18 15:59:14.000000000 +0100 +@@ -0,0 +1,7 @@ ++#ifndef PCAP_PCC_H ++#define PCAP_PCC_H ++ ++#include <pcap.h> ++ ++int pcap_pre_compiled (char * fname, struct bpf_program *p); ++#endif /* PCAP_PCC_H */ diff --git a/package/ppp/utils/pfc.c b/package/ppp/utils/pfc.c new file mode 100644 index 0000000000..5476be170a --- /dev/null +++ b/package/ppp/utils/pfc.c @@ -0,0 +1,51 @@ +/* + * Taken from fli4l 3.0 + * Make sure you compile it against the same libpcap version used in OpenWrt + */ + +#include <stdlib.h> +#include <sys/types.h> +#include <sys/time.h> +#include <string.h> + +#include <linux/types.h> +#include <linux/ppp_defs.h> + +#include <pcap.h> +#include <pcap-bpf.h> + +int main (int argc, char ** argv) +{ + pcap_t *pc; /* Fake struct pcap so we can compile expr */ + struct bpf_program filter; /* Filter program for link-active pkts */ + u_int32_t netmask=0; + + int dflag = 3; + if (argc == 4) + { + if (!strcmp (argv[1], "-d")) + { + dflag = atoi (argv[2]); + argv += 2; + argc -=2; + } + } + if (argc != 2) + { + printf ("usage; %s [ -d <debug_level> ] expression\n", argv[0]); + return 1; + } + + pc = pcap_open_dead(DLT_PPP_PPPD, PPP_HDRLEN); + if (pcap_compile(pc, &filter, argv[1], 1, netmask) == 0) + { + printf ("#\n# Expression: %s\n#\n", argv[1]); + bpf_dump (&filter, dflag); + return 0; + } + else + { + printf("error in active-filter expression: %s\n", pcap_geterr(pc)); + } + return 1; +} diff --git a/package/pptp/Makefile b/package/pptp/Makefile new file mode 100644 index 0000000000..bb0710419b --- /dev/null +++ b/package/pptp/Makefile @@ -0,0 +1,42 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=pptp +PKG_VERSION:=1.6.0 +PKG_RELEASE:=3 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/pptpclient +PKG_MD5SUM:=9a706327fb9827541d7c86d48ceb9631 +PKG_CAT:=zcat + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/pptp + SECTION:=net + CATEGORY:=Network + TITLE:=PPTP client + DESCRIPTION:=\ + This package contains a PPTP (Point-to-Point Tunneling Protocol) client. + URL:=http://pptpclient.sourceforge.net/ +endef + +define Package/pptp/install + install -d -m0755 $(1)/usr/sbin + install -m0755 $(PKG_BUILD_DIR)/pptp $(1)/usr/sbin/ + install -d -m0755 $(1)/etc/ppp + install -m0644 ./files/options.pptp $(1)/etc/ppp/ + install -d -m0755 $(1)/lib/network + install -m0755 ./files/pptp.sh $(1)/lib/network/ +endef + +$(eval $(call BuildPackage,pptp)) diff --git a/package/pptp/files/options.pptp b/package/pptp/files/options.pptp new file mode 100644 index 0000000000..5332445e78 --- /dev/null +++ b/package/pptp/files/options.pptp @@ -0,0 +1,7 @@ +lock +noauth +nobsdcomp +nodeflate +idle 0 +defaultroute +maxfail 0 diff --git a/package/pptp/files/pptp.sh b/package/pptp/files/pptp.sh new file mode 100644 index 0000000000..fffa625a2f --- /dev/null +++ b/package/pptp/files/pptp.sh @@ -0,0 +1,23 @@ +scan_pptp() { + scan_ppp "$@" +} + +setup_interface_pptp() { + local iface="$1" + local config="$2" + + config_get device "$config" device + + for module in slhc ppp_generic ppp_async ip_gre; do + /sbin/insmod $module 2>&- >&- + done + setup_interface "$iface" "$config" "dhcp" + + config_get mtu "$cfg" mtu + config_get server "$cfg" server + mtu=${mtu:-1452} + start_pppd "$config" \ + pty "/usr/sbin/pptp $server --loglevel 0 --nolaunchpppd" + file /etc/ppp/options.pptp + mtu $mtu mru $mtu +} diff --git a/package/qos-scripts/Makefile b/package/qos-scripts/Makefile new file mode 100644 index 0000000000..444009791c --- /dev/null +++ b/package/qos-scripts/Makefile @@ -0,0 +1,44 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id: Makefile 4823 2006-09-23 13:45:49Z nico $ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=qos-scripts +PKG_VERSION:=0.9.2 +PKG_RELEASE:=1 + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/qos-scripts + SECTION:=utils + CATEGORY:=Base system + DEPENDS:=+tc +kmod-sched +iptables-mod-filter +iptables-mod-ipopt +iptables-mod-extra +iptables-mod-conntrack +iptables-mod-imq + TITLE:=QoS scripts + DESCRIPTION:=QoS scripts \\\ + A set of scripts that abstract QoS configuration \\\ + into a simple configuration file supporting stanzas that specify \\\ + any number of QoS entries. +endef + +define Build/Prepare +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/qos-scripts/install + mkdir -p $(1) + $(CP) ./files/* $(1)/ +endef + +$(eval $(call BuildPackage,qos-scripts)) diff --git a/package/qos-scripts/files/etc/config/qos b/package/qos-scripts/files/etc/config/qos new file mode 100644 index 0000000000..1bf991766c --- /dev/null +++ b/package/qos-scripts/files/etc/config/qos @@ -0,0 +1,94 @@ +# QoS configuration for OpenWrt + +# INTERFACES: +config interface wan + option classgroup "Default" + option enabled 1 + option upload 128 + option download 1024 + +# RULES: +config classify + option target "Bulk" + option ipp2p "all" +config classify + option target "Bulk" + option layer7 "edonkey" +config classify + option target "Bulk" + option layer7 "bittorrent" +config classify + option target "Priority" + option ports "22,53" +config classify + option target "Normal" + option proto "tcp" + option ports "20,21,25,80,110,443,993,995" +config classify + option target "Express" + option ports "5190" +config default + option target "Express" + option proto "udp" + option pktsize "-500" +config reclassify + option target "Priority" + option proto "icmp" +config default + option target "Bulk" + option portrange "1024-65535" +config reclassify + option target "Priority" + option proto "tcp" + option pktsize "-128" + option mark "!Bulk" + option tcpflags "SYN" +config reclassify + option target "Priority" + option proto "tcp" + option pktsize "-128" + option mark "!Bulk" + option tcpflags "ACK" + + +# Don't change the stuff below unless you +# really know what it means :) + +config classgroup "Default" + option classes "Priority Express Normal Bulk" + option default "Normal" + + +config class "Priority" + option packetsize 300 + option packetdelay 10 + option maxsize 400 + option avgrate 40 + option linksharing 75 +config class "Priority_down" + option packetsize 1500 + option avgrate 20 + + +config class "Express" + option packetsize 1300 + option packetdelay 15 + option maxsize 800 + option avgrate 30 + option linksharing 80 + + +config class "Normal" + option packetsize 1500 + option packetdelay 150 + option avgrate 20 + option linksharing 30 +config class "Normal_down" + option avgrate 30 + + +config class "Bulk" + option linksharing 10 +config class "Bulk_down" + option avgrate 15 + option limitrate 85 diff --git a/package/qos-scripts/files/etc/hotplug.d/iface/10-qos b/package/qos-scripts/files/etc/hotplug.d/iface/10-qos new file mode 100755 index 0000000000..0682db145c --- /dev/null +++ b/package/qos-scripts/files/etc/hotplug.d/iface/10-qos @@ -0,0 +1,2 @@ +#!/bin/sh +[ "$ACTION" = ifup ] && /usr/lib/qos.sh interface "$INTERFACE" | sh diff --git a/package/qos-scripts/files/etc/init.d/S50qos b/package/qos-scripts/files/etc/init.d/S50qos new file mode 100755 index 0000000000..87e18fb28d --- /dev/null +++ b/package/qos-scripts/files/etc/init.d/S50qos @@ -0,0 +1,18 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org + +boot() { + /usr/lib/qos.sh firewall | sh +} + +start() { +# FIXME: after init script migration +# qos-start +# + + boot +} + +stop() { + qos-stop +} diff --git a/package/qos-scripts/files/usr/bin/qos-start b/package/qos-scripts/files/usr/bin/qos-start new file mode 100755 index 0000000000..347ca46b90 --- /dev/null +++ b/package/qos-scripts/files/usr/bin/qos-start @@ -0,0 +1,4 @@ +#!/bin/sh +qos-stop +/usr/lib/qos.sh all | sh + diff --git a/package/qos-scripts/files/usr/bin/qos-stat b/package/qos-scripts/files/usr/bin/qos-stat new file mode 100755 index 0000000000..fc940a8218 --- /dev/null +++ b/package/qos-scripts/files/usr/bin/qos-stat @@ -0,0 +1,16 @@ +#!/bin/sh +echo '#################' +echo '# EGRESS STATUS #' +echo '#################' +echo +for iface in $(tc qdisc show | grep hfsc | awk '{print $5}' | grep -v imq); do + tc -s class show dev "$iface" +done + +echo '##################' +echo '# INGRESS STATUS #' +echo '##################' +echo +for iface in $(tc qdisc show | grep hfsc | awk '{print $5}' | grep imq); do + tc -s class show dev "$iface" +done diff --git a/package/qos-scripts/files/usr/bin/qos-stop b/package/qos-scripts/files/usr/bin/qos-stop new file mode 100755 index 0000000000..2275ea12dc --- /dev/null +++ b/package/qos-scripts/files/usr/bin/qos-stop @@ -0,0 +1,6 @@ +#!/bin/sh +for iface in $(tc qdisc show | grep hfsc | awk '{print $5}'); do + tc qdisc del dev "$iface" root +done +iptables -t mangle -F +iptables -t mangle -X diff --git a/package/qos-scripts/files/usr/lib/qos.sh b/package/qos-scripts/files/usr/lib/qos.sh new file mode 100755 index 0000000000..bc04807031 --- /dev/null +++ b/package/qos-scripts/files/usr/lib/qos.sh @@ -0,0 +1,495 @@ +#!/bin/sh +. /etc/functions.sh + +insmod="insmod" +[ -f /sbin/modprobe ] && insmod="modprobe" + +add_insmod() { + eval "export isset=\${insmod_$1}" + case "$isset" in + 1) ;; + *) append INSMOD "$insmod $* >&- 2>&-" "$N"; export insmod_$1=1;; + esac +} + +find_ifname() {( + include /lib/network + scan_interfaces + config_get "$1" ifname +)} + +parse_matching_rule() { + local var="$1" + local section="$2" + local options="$3" + local prefix="$4" + local suffix="$5" + local proto="$6" + local mport="" + local ports="" + + append "$var" "$prefix" "$N" + for option in $options; do + case "$option" in + proto) config_get value "$section" proto; proto="${proto:-$value}";; + esac + done + config_get type "$section" TYPE + case "$type" in + classify) unset pkt; append "$var" "-m mark --mark 0";; + default) pkt=1; append "$var" "-m mark --mark 0";; + reclassify) pkt=1;; + esac + append "$var" "${proto:+-p $proto}" + for option in $options; do + config_get value "$section" "$option" + + case "$pkt:$option" in + *:srchost) + append "$var" "-s $value" + ;; + *:dsthost) + append "$var" "-d $value" + ;; + *:ipp2p) + add_insmod ipt_ipp2p + append "$var" "-m ipp2p" + case "$value" in + all) append "$var" "--edk --dc --kazaa --gnu --bit";; + *) append "$var" "--$value";; + esac + ;; + *:layer7) + add_insmod ipt_layer7 + append "$var" "-m layer7 --l7proto $value${pkt:+ --l7pkt}" + ;; + *:ports|*:srcports|*:dstports) + value="$(echo "$value" | sed -e 's,-,:,g')" + lproto=${lproto:-tcp} + case "$proto" in + ""|tcp|udp) append "$var" "-m ${proto:-tcp -p tcp} -m multiport";; + *) unset "$var"; return 0;; + esac + case "$option" in + ports) + config_set "$section" srcports "" + config_set "$section" dstports "" + config_set "$section" portrange "" + append "$var" "--ports $value" + ;; + srcports) + config_set "$section" ports "" + config_set "$section" dstports "" + config_set "$section" portrange "" + append "$var" "--sports $value" + ;; + dstports) + config_set "$section" ports "" + config_set "$section" srcports "" + config_set "$section" portrange "" + append "$var" "--dports $value" + ;; + esac + ports=1 + ;; + *:portrange) + config_set "$section" ports "" + config_set "$section" srcports "" + config_set "$section" dstports "" + value="$(echo "$value" | sed -e 's,-,:,g')" + case "$proto" in + ""|tcp|udp) append "$var" "-m ${proto:-tcp -p tcp} --sport $value --dport $value";; + *) unset "$var"; return 0;; + esac + ports=1 + ;; + 1:pktsize) + value="$(echo "$value" | sed -e 's,-,:,g')" + add_insmod ipt_length + append "$var" "-m length --length $value" + ;; + 1:limit) + add_insmod ipt_limit + append "$var" "-m limit --limit $value" + ;; + 1:tcpflags) + case "$proto" in + tcp) append "$var" "-m tcp --tcp-flags ALL $value";; + *) unset $var; return 0;; + esac + ;; + 1:mark) + config_get class "${value##!}" classnr + [ -z "$class" ] && continue; + case "$value" in + !*) append "$var" "-m mark ! --mark $class";; + *) append "$var" "-m mark --mark $class";; + esac + esac + done + append "$var" "$suffix" + case "$ports:$proto" in + 1:) parse_matching_rule "$var" "$section" "$options" "$prefix" "$suffix" "udp";; + esac +} + +config_cb() { + option_cb() { + return 0 + } + + # Section start + case "$1" in + interface) + config_set "$1" "classgroup" "Default" + config_set "$1" "upload" "128" + config_set "$1" "download" "1024" + ;; + classify|default|reclassify) + option_cb() { + append options "$1" + } + ;; + esac + + # Section end + config_get TYPE "$CONFIG_SECTION" TYPE + case "$TYPE" in + interface) + config_get enabled "$CONFIG_SECTION" enabled + config_get download "$CONFIG_SECTION" download + config_get classgroup "$CONFIG_SECTION" classgroup + config_set "$CONFIG_SECTION" imqdev "$C" + [ -z "$enabled" -o "$(($enabled))" -eq 0 ] || { + C=$(($C+1)) + INTERFACES="$INTERFACES $CONFIG_SECTION" + config_set "$classgroup" enabled 1 + } + config_get device "$CONFIG_SECTION" device + [ -z "$device" ] && device="$(find_ifname ${CONFIG_SECTION})" + config_set "$CONFIG_SECTION" device "${device:-eth0}" + ;; + classgroup) append CG "$CONFIG_SECTION";; + classify|default|reclassify) + case "$TYPE" in + classify) var="ctrules";; + *) var="rules";; + esac + config_get target "$CONFIG_SECTION" target + config_set "$CONFIG_SECTION" options "$options" + append "$var" "$CONFIG_SECTION" + unset options + ;; + esac +} + +class_main_qdisc() { + local device="$1" + awk -f - <<EOF +BEGIN { + limit = int("$maxrate") + m2 = int("$m2") + dmax = int("$dmax") + umax = int("$umax") + share = int("$share") + + if (!(m2 > 0)) { + dmax = 500 + umax = 1500 + m2 = 10 + rt = 0 + } else { + rt = 1 + } + + cdata = "" + pdmax = int (dmax + (umax * 8 / limit)) + if (rt == 1) { + if (share > 0) cdata = " rt" + else cdata = " ls" + if ((umax > 0) && (dmax > 0)) { + cdata = cdata " umax " umax "b dmax " pdmax "ms" + } + cdata = cdata " rate " m2 "kbit" + } + if (share > 0) { + if ((m2 > 0) && (umax > 0) && (dmax > 0)) { + cdata = cdata " ls umax " umax "b dmax " pdmax "ms rate " share "kbit" + } else { + cdata = cdata " ls m1 " share "kbit d 500ms m2 " share "kbit" + } + } + + print "tc class add dev $device parent 1:1 classid 1:${classnr}0 hfsc" cdata " ul rate " limit "kbit" +} +EOF +} + +class_leaf_qdisc() { + local device="$1" + awk -f - <<EOF + +function qlen(rate, m2, umax, dmax, qb, qr, qt, ql) { + qlen_min = 5 # minimum queue length + qlen_base = 1.7 # base value - queueing time in seconds + qlen_avgr = 0.7 # avgrate modifier + qlen_dmax = 0.0 # dmax modifier + + # bits in a packet + qb = 1500 + if ((m2 > 0) && (umax > 0)) qb -= int((1500 - umax) * qlen_pkt) + qb *= 8 + + # rate in bits/s + qr = rate + qr -= int((rate - m2) * qlen_avgr) + qr *= 1024 + + # queue time + qt = qlen_base + qlen_dmax * (dmax / 1000) + + # queue length + ql = int(qr * qt / qb) + if (ql < qlen_min) ql = qlen_min + + return ql +} + +BEGIN { + sfq_dthresh = 25 # use sfq for download if pktdelay set to this or lower + + limit = int("$maxrate") + m2 = int("$m2") + dmax = int("$dmax") + umax = int("$umax") + + if (!(m2 > 0)) { + dmax = 500 + umax = 1500 + m2 = 10 + } + + cqlen = ${dl_mode:+2 * }qlen(limit, m2, umax, dmax) + + printf "tc qdisc add dev $device parent 1:${classnr}0 handle ${classnr}00: " + if (("$dir" != "down") || ((dmax > 0) && (dmax <= sfq_dthresh))) { + print "sfq perturb 10 limit " cqlen + } else { + avpkt = 1200 + min = int(limit * 1024 / 8 * 0.1) + dqb = cqlen * 1500 + max = int(min + (dqb - min) * 0.25) + burst = int((2 * min + max) / (3 * avpkt)) + + print "red min " min " max " max " burst " burst " avpkt " avpkt " limit " dqb " probability 0.04 ecn" + } +} +EOF +} + +enum_classes() { + local c="0" + config_get classes "$1" classes + config_get default "$1" default + for class in $classes; do + c="$(($c + 1))" + config_set "${class}" classnr $c + case "$class" in + $default) class_default=$c;; + esac + done + class_default="${class_default:-$c}" +} + +cls_var() { + local varname="$1" + local class="$2" + local name="$3" + local type="$4" + local default="$5" + local tmp tmp1 tmp2 + config_get tmp1 "$class" "$name" + config_get tmp2 "${class}_${type}" "$name" + tmp="${tmp2:-$tmp1}" + tmp="${tmp:-$tmp2}" + export ${varname}="${tmp:-$default}" +} + +start_interface() { + local iface="$1" + local num_imq="$2" + config_get device "$iface" device + config_get enabled "$iface" enabled + [ -z "$device" -o -z "$enabled" ] && exit + config_get upload "$iface" upload + config_get halfduplex "$iface" halfduplex + config_get download "$iface" download + config_get classgroup "$iface" classgroup + + download="${download:-${halfduplex:+$upload}}" + enum_classes "$classgroup" + for dir in up${halfduplex} ${download:+down}; do + case "$dir" in + up) + upload=$(($upload * 98 / 100 - 10)) + dev="$device" + rate="$upload" + dl_mode="" + prefix="cls" + ;; + down) + add_insmod imq numdevs="$num_imq" + config_get imqdev "$iface" imqdev + download=$(($download * 96 / 100 - 64)) + dev="imq$imqdev" + rate="$download" + dl_mode=1 + prefix="d_cls" + ;; + *) continue;; + esac + for class in $classes; do + cls_var umax "$class" packetsize $dir 1500 + cls_var dmax "$class" packetdelay $dir 500 + + cls_var maxrate "$class" limitrate $dir 100 + cls_var share "$class" linksharing $dir 0 + cls_var m2 "$class" avgrate $dir 0 + maxrate=$(($maxrate * $rate / 100)) + share=$(($share * $rate / 100)) + m2=$(($m2 * $rate / 100)) + + config_get classnr "$class" classnr + append ${prefix}q "$(class_main_qdisc "$dev" "$iface")" "$N" + append ${prefix}l "$(class_leaf_qdisc "$dev" "$iface")" "$N" + append ${prefix}f "tc filter add dev $dev parent 1: prio $classnr protocol ip handle $classnr fw flowid 1:${classnr}0" "$N" + done + export dev_${dir}="ifconfig $dev up txqueuelen 5 >&- 2>&- +tc qdisc del dev $dev root >&- 2>&- +tc qdisc add dev $dev root handle 1: hfsc default ${class_default}0 +tc class add dev $dev parent 1: classid 1:1 hfsc sc rate ${rate}kbit ul rate ${rate}kbit" + done + add_insmod cls_fw + add_insmod sch_hfsc + add_insmod sch_sfq + add_insmod sch_red + cat <<EOF +${INSMOD:+$INSMOD$N}${dev_up:+$dev_up +$clsq +$clsl +$clsf +}${imqdev:+$dev_down +$d_clsq +$d_clsl +$d_clsf +} +EOF + unset INSMOD clsq clsf clsl d_clsq d_clsl d_clsf dev_up dev_down +} + +start_interfaces() { + local C="$1" + for iface in $INTERFACES; do + start_interface "$iface" "$C" + done +} + +add_rules() { + local var="$1" + local rules="$2" + local prefix="$3" + + for rule in $rules; do + unset iptrule + config_get target "$rule" target + config_get target "$target" classnr + config_get options "$rule" options + parse_matching_rule iptrule "$rule" "$options" "$prefix" "-j MARK --set-mark $target" + append "$var" "$iptrule" "$N" + done +} + +start_cg() { + local cg="$1" + local iptrules + local pktrules + local sizerules + local download + enum_classes "$cg" + add_rules iptrules "$ctrules" "iptables -t mangle -A ${cg}_ct" + config_get classes "$cg" classes + for class in $classes; do + config_get mark "$class" classnr + config_get maxsize "$class" maxsize + [ -z "$maxsize" -o -z "$mark" ] || { + add_insmod ipt_length + append pktrules "iptables -t mangle -A ${cg} -m mark --mark $mark -m length --length $maxsize: -j MARK --set-mark 0" "$N" + } + done + add_rules pktrules "$rules" "iptables -t mangle -A ${cg}" + for iface in $INTERFACES; do + config_get classgroup "$iface" classgroup + config_get device "$iface" device + config_get imqdev "$iface" imqdev + config_get dl "$iface" download + config_get halfduplex "$iface" halfduplex + add_insmod ipt_IMQ + append up "iptables -t mangle -A OUTPUT -o $device -j ${cg}" "$N" + append up "iptables -t mangle -A FORWARD -o $device -j ${cg}" "$N" + [ -z "$dl" ] || { + [ -z "$halfduplex" ] || { + append down "iptables -t mangle -A POSTROUTING -o $device -j IMQ --todev $imqdev" "$N" + } + append down "iptables -t mangle -A PREROUTING -i $device -j ${cg}" "$N" + append down "iptables -t mangle -A PREROUTING -i $device -j IMQ --todev $imqdev" "$N" + } + done + cat <<EOF +$INSMOD +iptables -t mangle -N ${cg} >&- 2>&- +iptables -t mangle -N ${cg}_ct >&- 2>&- +${iptrules:+${iptrules}${N}iptables -t mangle -A ${cg}_ct -j CONNMARK --save-mark} +iptables -t mangle -A ${cg} -j CONNMARK --restore-mark +iptables -t mangle -A ${cg} -m mark --mark 0 -j ${cg}_ct +$pktrules +$up$N${down:+${down}$N} +EOF + unset INSMOD +} + +start_firewall() { + add_insmod ipt_multiport + add_insmod ipt_CONNMARK + cat <<EOF +iptables -t mangle -F +iptables -t mangle -X +EOF + for group in $CG; do + start_cg $group + done +} + +C="0" +INTERFACES="" +config_load qos + +C="0" +for iface in $INTERFACES; do + export C="$(($C + 1))" +done + +case "$1" in + all) + start_interfaces "$C" + start_firewall + ;; + interface) + start_interface "$2" "$C" + ;; + interfaces) + start_interfaces + ;; + firewall) + start_firewall + ;; +esac diff --git a/package/robocfg/Makefile b/package/robocfg/Makefile new file mode 100644 index 0000000000..c0e7e2c21e --- /dev/null +++ b/package/robocfg/Makefile @@ -0,0 +1,38 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=robocfg +PKG_VERSION:=0.01 +PKG_RELEASE:=1 + +PKG_BUILD_DIR:=$(BUILD_DIR)/robocfg + +include $(INCLUDE_DIR)/package.mk + +define Package/robocfg + SECTION:=utils + CATEGORY:=Utilities + TITLE:=BCM5325E/536x switch configuration utility + DESCRIPTION:=\ + This package contains an utility for configuring the Broadcom BCM5325E/536x \\\ + based switches. +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) + $(CP) ./src/* $(PKG_BUILD_DIR)/ +endef + +define Package/robocfg/install + install -d -m0755 $(1)/sbin + install -m0755 $(PKG_BUILD_DIR)/robocfg $(1)/sbin/ +endef + +$(eval $(call BuildPackage,robocfg)) diff --git a/package/robocfg/src/Makefile b/package/robocfg/src/Makefile new file mode 100644 index 0000000000..fa763edbc8 --- /dev/null +++ b/package/robocfg/src/Makefile @@ -0,0 +1,12 @@ +# $Id$ + +all: robocfg + +%.o: %.c + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $^ + +robocfg: robocfg.o + $(CC) -o $@ $^ + +clean: + rm -f *.o robocfg diff --git a/package/robocfg/src/etc53xx.h b/package/robocfg/src/etc53xx.h new file mode 100644 index 0000000000..4e1f8ad8a2 --- /dev/null +++ b/package/robocfg/src/etc53xx.h @@ -0,0 +1,620 @@ +/* + * Broadcom Home Gateway Reference Design + * BCM53xx Register definitions + * + * Copyright 2004, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * $Id$ + */ + +#ifndef __BCM535M_H_ +#define __BCM535M_H_ + +/* ROBO embedded device type */ +#define ROBO_DEV_5380 1 +#define ROBO_DEV_5365 2 +#define ROBO_DEV_5350 3 + +/* BCM5325m GLOBAL PAGE REGISTER MAP */ +#ifndef _CFE_ +#pragma pack(1) +#endif + +/* BCM5325m Serial Management Port (SMP) Page offsets */ +#define ROBO_CTRL_PAGE 0x00 /* Control registers */ +#define ROBO_STAT_PAGE 0x01 /* Status register */ +#define ROBO_MGMT_PAGE 0x02 /* Management Mode registers */ +#define ROBO_MIB_AC_PAGE 0x03 /* MIB Autocast registers */ +#define ROBO_ARLCTRL_PAGE 0x04 /* ARL Control Registers */ +#define ROBO_ARLIO_PAGE 0x05 /* ARL Access Registers */ +#define ROBO_FRAMEBUF_PAGE 0x06 /* Management frame access registers */ +#define ROBO_MEM_ACCESS_PAGE 0x08 /* Memory access registers */ + +/* PHY Registers */ +#define ROBO_PORT0_MII_PAGE 0x10 /* Port 0 MII Registers */ +#define ROBO_PORT1_MII_PAGE 0x11 /* Port 1 MII Registers */ +#define ROBO_PORT2_MII_PAGE 0x12 /* Port 2 MII Registers */ +#define ROBO_PORT3_MII_PAGE 0x13 /* Port 3 MII Registers */ +#define ROBO_PORT4_MII_PAGE 0x14 /* Port 4 MII Registers */ +/* (start) registers only for BCM5380 */ +#define ROBO_PORT5_MII_PAGE 0x15 /* Port 5 MII Registers */ +#define ROBO_PORT6_MII_PAGE 0x16 /* Port 6 MII Registers */ +#define ROBO_PORT7_MII_PAGE 0x17 /* Port 7 MII Registers */ +/* (end) registers only for BCM5380 */ +#define ROBO_IM_PORT_PAGE 0x18 /* Inverse MII Port (to EMAC) */ +#define ROBO_ALL_PORT_PAGE 0x19 /* All ports MII Registers (broadcast)*/ + +/* MAC Statistics registers */ +#define ROBO_PORT0_MIB_PAGE 0x20 /* Port 0 10/100 MIB Statistics */ +#define ROBO_PORT1_MIB_PAGE 0x21 /* Port 1 10/100 MIB Statistics */ +#define ROBO_PORT2_MIB_PAGE 0x22 /* Port 2 10/100 MIB Statistics */ +#define ROBO_PORT3_MIB_PAGE 0x23 /* Port 3 10/100 MIB Statistics */ +#define ROBO_PORT4_MIB_PAGE 0x24 /* Port 4 10/100 MIB Statistics */ +/* (start) registers only for BCM5380 */ +#define ROBO_PORT5_MIB_PAGE 0x25 /* Port 5 10/100 MIB Statistics */ +#define ROBO_PORT6_MIB_PAGE 0x26 /* Port 6 10/100 MIB Statistics */ +#define ROBO_PORT7_MIB_PAGE 0x27 /* Port 7 10/100 MIB Statistics */ +/* (end) registers only for BCM5380 */ +#define ROBO_IM_PORT_MIB_PAGE 0x28 /* Inverse MII Port MIB Statistics */ + +/* Quality of Service (QoS) Registers */ +#define ROBO_QOS_PAGE 0x30 /* QoS Registers */ + +/* VLAN Registers */ +#define ROBO_VLAN_PAGE 0x34 /* VLAN Registers */ + +/* Note SPI Data/IO Registers not used */ +#define ROBO_SPI_DATA_IO_0_PAGE 0xf0 /* SPI Data I/O 0 */ +#define ROBO_SPI_DATA_IO_1_PAGE 0xf1 /* SPI Data I/O 1 */ +#define ROBO_SPI_DATA_IO_2_PAGE 0xf2 /* SPI Data I/O 2 */ +#define ROBO_SPI_DATA_IO_3_PAGE 0xf3 /* SPI Data I/O 3 */ +#define ROBO_SPI_DATA_IO_4_PAGE 0xf4 /* SPI Data I/O 4 */ +#define ROBO_SPI_DATA_IO_5_PAGE 0xf5 /* SPI Data I/O 5 */ +#define ROBO_SPI_DATA_IO_6_PAGE 0xf6 /* SPI Data I/O 6 */ +#define ROBO_SPI_DATA_IO_7_PAGE 0xf7 /* SPI Data I/O 7 */ + +#define ROBO_SPI_STATUS_PAGE 0xfe /* SPI Status Registers */ +#define ROBO_PAGE_PAGE 0xff /* Page Registers */ + + +/* BCM5325m CONTROL PAGE (0x00) REGISTER MAP : 8bit (byte) registers */ +typedef struct _ROBO_PORT_CTRL_STRUC +{ + unsigned char rx_disable:1; /* rx disable */ + unsigned char tx_disable:1; /* tx disable */ + unsigned char rsvd:3; /* reserved */ + unsigned char stp_state:3; /* spanning tree state */ +} ROBO_PORT_CTRL_STRUC; + +#define ROBO_PORT0_CTRL 0x00 /* 10/100 Port 0 Control */ +#define ROBO_PORT1_CTRL 0x01 /* 10/100 Port 1 Control */ +#define ROBO_PORT2_CTRL 0x02 /* 10/100 Port 2 Control */ +#define ROBO_PORT3_CTRL 0x03 /* 10/100 Port 3 Control */ +#define ROBO_PORT4_CTRL 0x04 /* 10/100 Port 4 Control */ +/* (start) registers only for BCM5380 */ +#define ROBO_PORT5_CTRL 0x05 /* 10/100 Port 5 Control */ +#define ROBO_PORT6_CTRL 0x06 /* 10/100 Port 6 Control */ +#define ROBO_PORT7_CTRL 0x07 /* 10/100 Port 7 Control */ +/* (end) registers only for BCM5380 */ +#define ROBO_IM_PORT_CTRL 0x08 /* 10/100 Port 8 Control */ +#define ROBO_SMP_CTRL 0x0a /* SMP Control register */ +#define ROBO_SWITCH_MODE 0x0b /* Switch Mode Control */ +#define ROBO_PORT_OVERRIDE_CTRL 0x0e /* Port state override */ +#define ROBO_PORT_OVERRIDE_RVMII (1<<4) /* Bit 4 enables RvMII */ +#define ROBO_PD_MODE_CTRL 0x0f /* Power-down mode control */ +#define ROBO_IP_MULTICAST_CTRL 0x21 /* IP Multicast control */ + +/* BCM5325m STATUS PAGE (0x01) REGISTER MAP : 16bit/48bit registers */ +#define ROBO_HALF_DUPLEX 0 +#define ROBO_FULL_DUPLEX 1 + +#define ROBO_LINK_STAT_SUMMARY 0x00 /* Link Status Summary: 16bit */ +#define ROBO_LINK_STAT_CHANGE 0x02 /* Link Status Change: 16bit */ +#define ROBO_SPEED_STAT_SUMMARY 0x04 /* Port Speed Summary: 16bit*/ +#define ROBO_DUPLEX_STAT_SUMMARY 0x06 /* Duplex Status Summary: 16bit */ +#define ROBO_PAUSE_STAT_SUMMARY 0x08 /* PAUSE Status Summary: 16bit */ +#define ROBO_SOURCE_ADDR_CHANGE 0x0C /* Source Address Change: 16bit */ +#define ROBO_LSA_PORT0 0x10 /* Last Source Addr, Port 0: 48bits*/ +#define ROBO_LSA_PORT1 0x16 /* Last Source Addr, Port 1: 48bits*/ +#define ROBO_LSA_PORT2 0x1c /* Last Source Addr, Port 2: 48bits*/ +#define ROBO_LSA_PORT3 0x22 /* Last Source Addr, Port 3: 48bits*/ +#define ROBO_LSA_PORT4 0x28 /* Last Source Addr, Port 4: 48bits*/ +#define ROBO_LSA_IM_PORT 0x40 /* Last Source Addr, IM Port: 48bits*/ + +/* BCM5325m MANAGEMENT MODE REGISTERS (0x02) REGISTER MAP: 8/48 bit regs*/ +typedef struct _ROBO_GLOBAL_CONFIG_STRUC +{ + unsigned char resetMIB:1; /* reset MIB counters */ + unsigned char rxBPDU:1; /* receive BDPU enable */ + unsigned char rsvd1:2; /* reserved */ + unsigned char MIBacHdrCtrl:1; /* MIB autocast header control */ + unsigned char MIBac:1; /* MIB autocast enable */ + unsigned char frameMgmtPort:2; /* frame management port */ +} ROBO_GLOBAL_CONFIG_STRUC; +#define ROBO_GLOBAL_CONFIG 0x00 /* Global Management Config: 8bit*/ +#define ROBO_MGMT_PORT_ID 0x02 /* Management Port ID: 8bit*/ +#define ROBO_RMON_MIB_STEER 0x04 /* RMON Mib Steering: 16bit */ +#define ROBO_MIB_MODE_SELECT 0x04 /* MIB Mode select: 16bit (BCM5350) */ +#define ROBO_AGE_TIMER_CTRL 0x06 /* Age time control: 32bit */ +#define ROBO_MIRROR_CAP_CTRL 0x10 /* Mirror Capture : 16bit */ +#define ROBO_MIRROR_ING_CTRL 0x12 /* Mirror Ingress Control: 16bit */ +#define ROBO_MIRROR_ING_DIV_CTRL 0x14 /* Mirror Ingress Divider: 16bit */ +#define ROBO_MIRROR_ING_MAC_ADDR 0x16 /* Ingress Mirror MAC Addr: 48bit*/ +#define ROBO_MIRROR_EGR_CTRL 0x1c /* Mirror Egress Control: 16bit */ +#define ROBO_MIRROR_EGR_DIV_CTRL 0x1e /* Mirror Egress Divider: 16bit */ +#define ROBO_MIRROR_EGR_MAC_ADDR 0x20 /* Egress Mirror MAC Addr: 48bit*/ + +/* BCM5325m MIB AUTOCAST REGISTERS (0x03) REGISTER MAP: 8/16/48 bit regs */ +#define ROBO_MIB_AC_PORT 0x00 /* MIB Autocast Port: 16bit */ +#define ROBO_MIB_AC_HDR_PTR 0x02 /* MIB Autocast Header pointer:16bit*/ +#define ROBO_MIB_AC_HDR_LEN 0x04 /* MIB Autocast Header Len: 16bit */ +#define ROBO_MIB_AC_DA 0x06 /* MIB Autocast DA: 48bit */ +#define ROBO_MIB_AC_SA 0x0c /* MIB Autocast SA: 48bit */ +#define ROBO_MIB_AC_TYPE 0x12 /* MIB Autocast Type: 16bit */ +#define ROBO_MIB_AC_RATE 0x14 /* MIB Autocast Rate: 8bit */ +#define ROBO_GET_AC_RATE(secs) ((secs)*10) +#define ROBO_AC_RATE_MAX 0xff +#define ROBO_AC_RATE_DEFAULT 0x64 /* 10 secs */ +typedef struct _ROBO_MIB_AC_STRUCT +{ + unsigned char opcode:4; /* Tx MIB Autocast opcode */ + unsigned char portno:4; /* zero-based port no. */ + unsigned char portstate:8; /* port state */ + unsigned long long TxOctets; + unsigned int TxDropPkts; + unsigned int rsvd; + unsigned int TxBroadcastPkts; + unsigned int TxMulticastPkts; + unsigned int TxUnicastPkts; + unsigned int TxCollisions; + unsigned int TxSingleCollision; + unsigned int TxMultiCollision; + unsigned int TxDeferredTransmit; + unsigned int TxLateCollision; + unsigned int TxExcessiveCollision; + unsigned int TxFrameInDiscards; + unsigned int TxPausePkts; + unsigned int rsvd1[2]; + unsigned long long RxOctets; + unsigned int RxUndersizePkts; + unsigned int RxPausePkts; + unsigned int RxPkts64Octets; + unsigned int RxPkts64to127Octets; + unsigned int RxPkts128to255Octets; + unsigned int RxPkts256to511Octets; + unsigned int RxPkts512to1023Octets; + unsigned int RxPkts1024to1522Octets; + unsigned int RxOversizePkts; + unsigned int RxJabbers; + unsigned int RxAlignmentErrors; + unsigned int RxFCSErrors; + unsigned long long RxGoodOctets; + unsigned int RxDropPkts; + unsigned int RxUnicastPkts; + unsigned int RxMulticastPkts; + unsigned int RxBroadcastPkts; + unsigned int RxSAChanges; + unsigned int RxFragments; + unsigned int RxExcessSizeDisc; + unsigned int RxSymbolError; +} ROBO_MIB_AC_STRUCT; + +/* BCM5325m ARL CONTROL REGISTERS (0x04) REGISTER MAP: 8/16/48/64 bit regs */ +#define ROBO_ARL_CONFIG 0x00 /* ARL Global Configuration: 8bit*/ +#define ROBO_BPDU_MC_ADDR_REG 0x04 /* BPDU Multicast Address Reg:64bit*/ +#define ROBO_MULTIPORT_ADDR_1 0x10 /* Multiport Address 1: 48 bits*/ +#define ROBO_MULTIPORT_VECTOR_1 0x16 /* Multiport Vector 1: 16 bits */ +#define ROBO_MULTIPORT_ADDR_2 0x20 /* Multiport Address 2: 48 bits*/ +#define ROBO_MULTIPORT_VECTOR_2 0x26 /* Multiport Vector 2: 16 bits */ +#define ROBO_SECURE_SRC_PORT_MASK 0x30 /* Secure Source Port Mask: 16 bits*/ +#define ROBO_SECURE_DST_PORT_MASK 0x32 /* Secure Dest Port Mask: 16 bits */ + + +/* BCM5325m ARL IO REGISTERS (0x05) REGISTER MAP: 8/16/48/64 bit regs */ +#define ARL_TABLE_WRITE 0 /* for read/write state in control reg */ +#define ARL_TABLE_READ 1 /* for read/write state in control reg */ +#ifdef BCM5380 +#define ARL_VID_BYTES 2 /* number of bytes for VID */ +#else +#define ARL_VID_BYTES 1 /* number of bytes for VID */ +#endif +typedef struct _ROBO_ARL_RW_CTRL_STRUC +{ + unsigned char ARLrw:1; /* ARL read/write (1=read) */ + unsigned char rsvd:6; /* reserved */ + unsigned char ARLStart:1; /* ARL start/done (1=start) */ +} ROBO_ARL_RW_CTRL_STRUC; +typedef struct _ROBO_ARL_SEARCH_CTRL_STRUC +{ + unsigned char valid:1; /* ARL search result valid */ + unsigned char rsvd:6; /* reserved */ + unsigned char ARLStart:1; /* ARL start/done (1=start) */ +} ROBO_ARL_SEARCH_CTRL_STRUC; +typedef struct _ROBO_ARL_ENTRY_CTRL_STRUC +{ + unsigned char portID:4; /* port id */ + unsigned char chipID:2; /* chip id */ + unsigned char rsvd:5; /* reserved */ + unsigned char prio:2; /* priority */ + unsigned char age:1; /* age */ + unsigned char staticEn:1; /* static */ + unsigned char valid:1; /* valid */ +} ROBO_ARL_ENTRY_CTRL_STRUC; +typedef struct _ROBO_ARL_SEARCH_RESULT_CTRL_STRUC +{ + unsigned char portID:4; /* port id */ + unsigned char rsvd:1; /* reserved */ + unsigned char vid:8; /* vlan id */ + unsigned char age:1; /* age */ + unsigned char staticEn:1; /* static */ + unsigned char valid:1; /* valid */ +} ROBO_ARL_SEARCH_RESULT_CTRL_STRUC; +typedef struct _ROBO_ARL_ENTRY_MAC_STRUC +{ + unsigned char macBytes[6]; /* MAC address */ +} ROBO_ARL_ENTRY_MAC_STRUC; + +typedef struct _ROBO_ARL_ENTRY_STRUC +{ + ROBO_ARL_ENTRY_MAC_STRUC mac; /* MAC address */ + ROBO_ARL_ENTRY_CTRL_STRUC ctrl; /* control bits */ +} ROBO_ARL_ENTRY_STRUC; + +typedef struct _ROBO_ARL_SEARCH_RESULT_STRUC +{ + ROBO_ARL_ENTRY_MAC_STRUC mac; /* MAC address */ + ROBO_ARL_SEARCH_RESULT_CTRL_STRUC ctrl; /* control bits */ +} ROBO_ARL_SEARCH_RESULT_STRUC; + +/* multicast versions of ARL entry structs */ +typedef struct _ROBO_ARL_ENTRY_MCAST_CTRL_STRUC +{ + unsigned int portMask:12;/* multicast port mask */ + unsigned char prio:1; /* priority */ + unsigned char gigPort:1; /* gigabit port 1 mask */ + unsigned char staticEn:1; /* static */ + unsigned char valid:1; /* valid */ +} ROBO_ARL_ENTRY_MCAST_CTRL_STRUC; +typedef struct _ROBO_ARL_SEARCH_RESULT_MCAST_CTRL_STRUC +{ + unsigned int portMask:13; /* multicast port mask */ + unsigned char age:1; /* age */ + unsigned char staticEn:1; /* static */ + unsigned char valid:1; /* valid */ +} ROBO_ARL_SEARCH_RESULT_MCAST_CTRL_STRUC; +/* BCM5350 extension register */ +typedef struct _ROBO_ARL_SEARCH_RESULT_EXTENSION +{ + unsigned int prio:2; /* priority */ + unsigned int portMask:1; /* MSB (MII) of port mask for multicast */ + unsigned int reserved:5; +} ROBO_ARL_SEARCH_RESULT_EXTENSION; + +typedef struct _ROBO_ARL_ENTRY_MCAST_STRUC +{ + ROBO_ARL_ENTRY_MAC_STRUC mac; /* MAC address */ + ROBO_ARL_ENTRY_MCAST_CTRL_STRUC ctrl; /* control bits */ +} ROBO_ARL_ENTRY_MCAST_STRUC; +typedef struct _ROBO_ARL_SEARCH_RESULT_MCAST_STRUC +{ + ROBO_ARL_ENTRY_MAC_STRUC mac; /* MAC address */ + ROBO_ARL_SEARCH_RESULT_MCAST_CTRL_STRUC ctrl; /* control bits */ +} ROBO_ARL_SEARCH_RESULT_MCAST_STRUC; + +#define ROBO_ARL_RW_CTRL 0x00 /* ARL Read/Write Control : 8bit */ +#define ROBO_ARL_MAC_ADDR_IDX 0x02 /* MAC Address Index: 48bit */ +#define ROBO_ARL_VID_TABLE_IDX 0x08 /* VID Table Address Index: 8bit */ +#define ROBO_ARL_ENTRY0 0x10 /* ARL Entry 0 : 64 bit */ +#define ROBO_ARL_ENTRY1 0x18 /* ARL Entry 1 : 64 bit */ +#define ROBO_ARL_SEARCH_CTRL 0x20 /* ARL Search Control: 8bit */ +#define ROBO_ARL_SEARCH_ADDR 0x22 /* ARL Search Address: 16bit */ +#define ROBO_ARL_SEARCH_RESULT 0x24 /* ARL Search Result: 64bit */ +#define ROBO_ARL_SEARCH_RESULT_EXT 0x2c /* ARL Search Result Extension (5350): 8bit */ +#define ROBO_ARL_VID_ENTRY0 0x30 /* ARL VID Entry 0: 64bit */ +#define ROBO_ARL_VID_ENTRY1 0x32 /* ARL VID Entry 1: 64bit */ + +/* BCM5325m MANAGEMENT FRAME REGISTERS (0x6) REGISTER MAP: 8/16 bit regs */ +#define ROBO_MGMT_FRAME_RD_DATA 0x00 /* Management Frame Read Data :8bit*/ +#define ROBO_MGMT_FRAME_WR_DATA 0x01 /* Management Frame Write Data:8bit*/ +#define ROBO_MGMT_FRAME_WR_CTRL 0x02 /* Write Control: 16bit */ +#define ROBO_MGMT_FRAME_RD_STAT 0x04 /* Read Status: 16bit */ + +/* BCM5325m MEMORY ACCESS REGISTERS (Page 0x08) REGISTER MAP: 32 bit regs */ +#define MEM_TABLE_READ 1 /* for read/write state in mem access reg */ +#define MEM_TABLE_WRITE 0 /* for read/write state in mem access reg */ +#define MEM_TABLE_ACCESS_START 1 /* for mem access read/write start */ +#define MEM_TABLE_ACCESS_DONE 0 /* for mem access read/write done */ +#define VLAN_TABLE_ADDR 0x3800 /* BCM5380 only */ +#ifdef BCM5380 +#define NUM_ARL_TABLE_ENTRIES 4096 /* number of entries in ARL table */ +#define NUM_VLAN_TABLE_ENTRIES 2048 /* number of entries in VLAN table */ +#define ARL_TABLE_ADDR 0 /* offset of ARL table start */ +#else +#define NUM_ARL_TABLE_ENTRIES 2048 /* number of entries in ARL table */ +#define NUM_VLAN_TABLE_ENTRIES 256 /* number of entries in VLAN table */ +#define ARL_TABLE_ADDR 0x3800 /* offset of ARL table start */ +/* corresponding values for 5350 */ +#define NUM_ARL_TABLE_ENTRIES_5350 1024 /* number of entries in ARL table (5350) */ +#define NUM_VLAN_TABLE_ENTRIES_5350 16 /* number of entries in VLAN table */ +#define ARL_TABLE_ADDR_5350 0x1c00 /* offset of ARL table start (5350) */ +#endif +typedef struct _ROBO_MEM_ACCESS_CTRL_STRUC +{ + unsigned int memAddr:14; /* 64-bit memory address */ + unsigned char rsvd:4; /* reserved */ + unsigned char readEn:1; /* read enable (0 == write) */ + unsigned char startDone:1;/* memory access start/done */ + unsigned int rsvd1:12; /* reserved */ +} ROBO_MEM_ACCESS_CTRL_STRUC; +typedef struct _ROBO_MEM_ACCESS_DATA_STRUC +{ + unsigned int memData[2]; /* 64-bit data */ + unsigned short rsvd; /* reserved */ +} ROBO_MEM_ACCESS_DATA_STRUC; + +#ifdef BCM5380 +typedef struct _ROBO_ARL_TABLE_DATA_STRUC +{ + unsigned char MACaddr[6]; /* MAC addr */ + unsigned int portID:4; /* port ID */ + unsigned int chipID:2; /* chip ID */ + unsigned int rsvd:6; /* reserved */ + unsigned int highPrio:1; /* high priority address */ + unsigned int age:1; /* entry accessed/learned since ageing process */ + unsigned int staticAddr:1;/* entry is static */ + unsigned int valid:1; /* entry is valid */ + unsigned int vid:12; /* vlan id */ + unsigned int rsvd2:4; /* reserved */ +} ROBO_ARL_TABLE_DATA_STRUC; +#else +typedef struct _ROBO_ARL_TABLE_DATA_STRUC +{ + unsigned char MACaddr[6]; /* MAC addr */ + unsigned int portID:4; /* port ID */ + unsigned int chipID:2; /* chip ID */ + unsigned int rsvd:7; /* reserved */ + unsigned int age:1; /* entry accessed/learned since ageing process */ + unsigned int staticAddr:1;/* entry is static */ + unsigned int valid:1; /* entry is valid */ +} ROBO_ARL_TABLE_DATA_STRUC; +#endif + +/* multicast format*/ +typedef struct _ROBO_ARL_TABLE_MCAST_DATA_STRUC +{ + unsigned char MACaddr[6]; /* MAC addr */ + unsigned int portMask:12;/* multicast port mask */ + unsigned char prio:1; /* priority */ + unsigned char gigPort:1; /* gigabit port 1 mask */ + unsigned char staticEn:1; /* static */ + unsigned char valid:1; /* valid */ + unsigned int vid:12; /* vlan id */ + unsigned int rsvd2:4; /* reserved */ +} ROBO_ARL_TABLE_MCAST_DATA_STRUC; +#define ROBO_MEM_ACCESS_CTRL 0x00 /* Memory Read/Write Control :32bit*/ +#define ROBO_MEM_ACCESS_DATA 0x04 /* Memory Read/Write Data:64bit*/ + +/* BCM5325m SWITCH PORT (0x10-18) REGISTER MAP: 8/16 bit regs */ +typedef struct _ROBO_MII_CTRL_STRUC +{ + unsigned char rsvd:8; /* reserved */ + unsigned char duplex:1; /* duplex mode */ + unsigned char restartAN:1;/* restart auto-negotiation */ + unsigned char rsvd1:1; /* reserved */ + unsigned char powerDown:1;/* power down */ + unsigned char ANenable:1; /* auto-negotiation enable */ + unsigned char speed:1; /* forced speed selection */ + unsigned char loopback:1; /* loopback */ + unsigned char reset:1; /* reset */ +} ROBO_MII_CTRL_STRUC; +typedef struct _ROBO_MII_AN_ADVERT_STRUC +{ + unsigned char selector:5; /* advertise selector field */ + unsigned char T10BaseT:1; /* advertise 10BaseT */ + unsigned char T10BaseTFull:1; /* advertise 10BaseT, full duplex */ + unsigned char T100BaseX:1; /* advertise 100BaseX */ + unsigned char T100BaseXFull:1;/* advertise 100BaseX full duplex */ + unsigned char noT4:1; /* do not advertise T4 */ + unsigned char pause:1; /* advertise pause for full duplex */ + unsigned char rsvd:2; /* reserved */ + unsigned char remoteFault:1; /* transmit remote fault */ + unsigned char rsvd1:1; /* reserved */ + unsigned char nextPage:1; /* nex page operation supported */ +} ROBO_MII_AN_ADVERT_STRUC; +#define ROBO_MII_CTRL 0x00 /* Port MII Control */ +#define ROBO_MII_STAT 0x02 /* Port MII Status */ +/* Fields of link status register */ +#define ROBO_MII_STAT_JABBER (1<<1) /* Jabber detected */ +#define ROBO_MII_STAT_LINK (1<<2) /* Link status */ + +#define ROBO_MII_PHYID_HI 0x04 /* Port PHY ID High */ +#define ROBO_MII_PHYID_LO 0x06 /* Port PHY ID Low */ +#define ROBO_MII_ANA_REG 0x08 /* MII Auto-Neg Advertisement */ +#define ROBO_MII_ANP_REG 0x0a /* MII Auto-Neg Partner Ability */ +#define ROBO_MII_AN_EXP_REG 0x0c /* MII Auto-Neg Expansion */ +#define ROBO_MII_AN_NP_REG 0x0e /* MII next page */ +#define ROBO_MII_ANP_NP_REG 0x10 /* MII Partner next page */ +#define ROBO_MII_100BX_AUX_CTRL 0x20 /* 100BASE-X Auxiliary Control */ +#define ROBO_MII_100BX_AUX_STAT 0x22 /* 100BASE-X Auxiliary Status */ +#define ROBO_MII_100BX_RCV_ERR_CTR 0x24 /* 100BASE-X Receive Error Ctr */ +#define ROBO_MII_100BX_RCV_FS_ERR 0x26 /* 100BASE-X Rcv False Sense Ctr */ +#define ROBO_MII_AUX_CTRL 0x30 /* Auxiliary Control/Status */ +/* Fields of Auxiliary control register */ +#define ROBO_MII_AUX_CTRL_FD (1<<0) /* Full duplex link detected*/ +#define ROBO_MII_AUX_CTRL_SP100 (1<<1) /* Speed 100 indication */ +#define ROBO_MII_AUX_STATUS 0x32 /* Aux Status Summary */ +#define ROBO_MII_CONN_STATUS 0x34 /* Aux Connection Status */ +#define ROBO_MII_AUX_MODE2 0x36 /* Aux Mode 2 */ +#define ROBO_MII_AUX_ERR_STATUS 0x38 /* Aux Error and General Status */ +#define ROBO_MII_AUX_MULTI_PHY 0x3c /* Aux Multiple PHY Register*/ +#define ROBO_MII_BROADCOM_TEST 0x3e /* Broadcom Test Register */ + + +/* BCM5325m PORT MIB REGISTERS (Pages 0x20-0x24,0x28) REGISTER MAP: 64/32 */ +/* Tranmit Statistics */ +#define ROBO_MIB_TX_OCTETS 0x00 /* 64b: TxOctets */ +#define ROBO_MIB_TX_DROP_PKTS 0x08 /* 32b: TxDropPkts */ +#define ROBO_MIB_TX_BC_PKTS 0x10 /* 32b: TxBroadcastPkts */ +#define ROBO_MIB_TX_MC_PKTS 0x14 /* 32b: TxMulticastPkts */ +#define ROBO_MIB_TX_UC_PKTS 0x18 /* 32b: TxUnicastPkts */ +#define ROBO_MIB_TX_COLLISIONS 0x1c /* 32b: TxCollisions */ +#define ROBO_MIB_TX_SINGLE_COLLISIONS 0x20 /* 32b: TxSingleCollision */ +#define ROBO_MIB_TX_MULTI_COLLISIONS 0x24 /* 32b: TxMultiCollision */ +#define ROBO_MIB_TX_DEFER_TX 0x28 /* 32b: TxDeferred Transmit */ +#define ROBO_MIB_TX_LATE_COLLISIONS 0x2c /* 32b: TxLateCollision */ +#define ROBO_MIB_EXCESS_COLLISIONS 0x30 /* 32b: TxExcessiveCollision*/ +#define ROBO_MIB_FRAME_IN_DISCARDS 0x34 /* 32b: TxFrameInDiscards */ +#define ROBO_MIB_TX_PAUSE_PKTS 0x38 /* 32b: TxPausePkts */ + +/* Receive Statistics */ +#define ROBO_MIB_RX_OCTETS 0x44 /* 64b: RxOctets */ +#define ROBO_MIB_RX_UNDER_SIZE_PKTS 0x4c /* 32b: RxUndersizePkts(runts)*/ +#define ROBO_MIB_RX_PAUSE_PKTS 0x50 /* 32b: RxPausePkts */ +#define ROBO_MIB_RX_PKTS_64 0x54 /* 32b: RxPkts64Octets */ +#define ROBO_MIB_RX_PKTS_65_TO_127 0x58 /* 32b: RxPkts64to127Octets*/ +#define ROBO_MIB_RX_PKTS_128_TO_255 0x5c /* 32b: RxPkts128to255Octets*/ +#define ROBO_MIB_RX_PKTS_256_TO_511 0x60 /* 32b: RxPkts256to511Octets*/ +#define ROBO_MIB_RX_PKTS_512_TO_1023 0x64 /* 32b: RxPkts512to1023Octets*/ +#define ROBO_MIB_RX_PKTS_1024_TO_1522 0x68 /* 32b: RxPkts1024to1522Octets*/ +#define ROBO_MIB_RX_OVER_SIZE_PKTS 0x6c /* 32b: RxOversizePkts*/ +#define ROBO_MIB_RX_JABBERS 0x70 /* 32b: RxJabbers*/ +#define ROBO_MIB_RX_ALIGNMENT_ERRORS 0x74 /* 32b: RxAlignmentErrors*/ +#define ROBO_MIB_RX_FCS_ERRORS 0x78 /* 32b: RxFCSErrors */ +#define ROBO_MIB_RX_GOOD_OCTETS 0x7c /* 32b: RxGoodOctets */ +#define ROBO_MIB_RX_DROP_PKTS 0x84 /* 32b: RxDropPkts */ +#define ROBO_MIB_RX_UC_PKTS 0x88 /* 32b: RxUnicastPkts */ +#define ROBO_MIB_RX_MC_PKTS 0x8c /* 32b: RxMulticastPkts */ +#define ROBO_MIB_RX_BC_PKTS 0x90 /* 32b: RxBroadcastPkts */ +#define ROBO_MIB_RX_SA_CHANGES 0x94 /* 32b: RxSAChanges */ +#define ROBO_MIB_RX_FRAGMENTS 0x98 /* 32b: RxFragments */ +#define ROBO_MIB_RX_EXCESS_SZ_DISC 0x9c /* 32b: RxExcessSizeDisc*/ +#define ROBO_MIB_RX_SYMBOL_ERROR 0xa0 /* 32b: RxSymbolError */ + +/* BCM5350 MIB Statistics */ +/* Group 0 */ +#define ROBO_MIB_TX_GOOD_PKTS 0x00 /* 16b: TxGoodPkts */ +#define ROBO_MIB_TX_UNICAST_PKTS 0x02 /* 16b: TxUnicastPkts */ +#define ROBO_MIB_RX_GOOD_PKTS 0x04 /* 16b: RxGoodPkts */ +#define ROBO_MIB_RX_GOOD_UNICAST_PKTS 0x06 /* 16b: RxGoodUnicastPkts */ +/* Group 1 */ +#define ROBO_MIB_TX_COLLISION 0x00 /* 16b: TxCollision */ +#define ROBO_MIB_TX_OCTETS_5350 0x02 /* 16b: TxOctets */ +#define ROBO_MIB_RX_FCS_ERRORS_5350 0x04 /* 16b: RxFCSErrors */ +#define ROBO_MIB_RX_GOOD_OCTETS_5350 0x06 /* 16b: RxGoodOctets */ + +/* BCM5325m QoS REGISTERS (Page 0x30) REGISTER MAP: 8/16 */ +#define ROBO_QOS_CTRL 0x00 /* 16b: QoS Control Register */ +#define ROBO_QOS_LOCAL_WEIGHT_CTRL 0x10 /* 8b: Local HQ/LQ Weight Register*/ +#define ROBO_QOS_CPU_WEIGHT_CTRL 0x12 /* 8b: CPU HQ/LQ Weight Register*/ +#define ROBO_QOS_PAUSE_ENA 0x13 /* 16b: Qos Pause Enable Register*/ +#define ROBO_QOS_PRIO_THRESHOLD 0x15 /* 8b: Priority Threshold Register*/ +#define ROBO_QOS_RESERVED 0x16 /* 8b: Qos Reserved Register */ + +/* BCM5325m VLAN REGISTERS (Page 0x34) REGISTER MAP: 8/16bit */ +typedef struct _ROBO_VLAN_CTRL0_STRUC +{ + unsigned char frameControlP:2; /* 802.1P frame control */ + unsigned char frameControlQ:2; /* 802.1Q frame control */ + unsigned char dropMissedVID:1; /* enable drop missed VID packet */ + unsigned char vidMacHash:1; /* VID_MAC hash enable */ + unsigned char vidMacCheck:1; /* VID_MAC check enable */ + unsigned char VLANen:1; /* 802.1Q VLAN enable */ +} ROBO_VLAN_CTRL0_STRUC; +#define VLAN_TABLE_WRITE 1 /* for read/write state in table access reg */ +#define VLAN_TABLE_READ 0 /* for read/write state in table access reg */ +#define VLAN_ID_HIGH_BITS 0 /* static high bits in table access reg */ +#define VLAN_ID_MAX 255 /* max VLAN id */ +#define VLAN_ID_MAX5350 15 /* max VLAN id (5350) */ +#define VLAN_ID_MASK VLAN_ID_MAX /* VLAN id mask */ +#ifdef BCM5380 +#define VLAN_UNTAG_SHIFT 13 /* for postioning untag bits in write reg */ +#define VLAN_VALID 0x4000000 /* valid bit in write reg */ +#else +#define VLAN_UNTAG_SHIFT 7 /* for postioning untag bits in write reg */ +#define VLAN_VALID 0x4000 /* valid bit in write reg */ +/* corresponding values for 5350 */ +#define VLAN_UNTAG_SHIFT_5350 6 /* for postioning untag bits in write reg */ +#define VLAN_VALID_5350 0x00100000 /* valid bit in write reg */ +#endif +typedef struct _ROBO_VLAN_TABLE_ACCESS_STRUC +{ + unsigned char VLANid:8; /* VLAN ID (low 8 bits) */ + unsigned char VLANidHi:4; /* VLAN ID (fixed upper portion) */ + unsigned char readWriteState:1; /* read/write state (write = 1) */ + volatile unsigned char readWriteEnable:1; /* table read/write enable */ + unsigned char rsvd:2; /* reserved */ +} ROBO_VLAN_TABLE_ACCESS_STRUC; +#ifdef BCM5380 +typedef struct _ROBO_VLAN_READ_WRITE_STRUC +{ + unsigned int VLANgroup:13;/* VLAN group mask */ + unsigned int VLANuntag:13;/* VLAN untag enable mask */ + unsigned char valid:1; /* valid */ + unsigned char rsvd:5; /* reserved */ +} ROBO_VLAN_READ_WRITE_STRUC; +#else +typedef struct _ROBO_VLAN_READ_WRITE_STRUC +{ + unsigned char VLANgroup:7; /* VLAN group mask */ + unsigned char VLANuntag:7; /* VLAN untag enable mask */ + unsigned char valid:1; /* valid */ + unsigned char rsvd:1; /* reserved */ +} ROBO_VLAN_READ_WRITE_STRUC; +typedef struct _ROBO_VLAN_READ_WRITE_STRUC_5350 +{ + unsigned char VLANgroup:6; /* VLAN group mask */ + unsigned char VLANuntag:6; /* VLAN untag enable mask */ + unsigned char highVID:8; /* upper bits of vid */ + unsigned char valid:1; /* valid */ + unsigned int rsvd:11; /* reserved */ +} ROBO_VLAN_READ_WRITE_STRUC_5350; +#endif +#define ROBO_VLAN_CTRL0 0x00 /* 8b: VLAN Control 0 Register */ +#define ROBO_VLAN_CTRL1 0x01 /* 8b: VLAN Control 1 Register */ +#define ROBO_VLAN_CTRL2 0x02 /* 8b: VLAN Control 2 Register */ +#define ROBO_VLAN_CTRL3 0x03 /* 8b: VLAN Control 3 Register */ +#define ROBO_VLAN_CTRL4 0x04 /* 8b: VLAN Control 4 Register */ +#define ROBO_VLAN_CTRL5 0x05 /* 8b: VLAN Control 5 Register */ +#define ROBO_VLAN_TABLE_ACCESS 0x08 /* 14b: VLAN Table Access Register */ +#define ROBO_VLAN_TABLE_ACCESS_5350 0x06 /* 14b: VLAN Table Access Register (5350) */ +#define ROBO_VLAN_WRITE 0x0a /* 15b: VLAN Write Register */ +#define ROBO_VLAN_WRITE_5350 0x08 /* 15b: VLAN Write Register (5350) */ +#define ROBO_VLAN_READ 0x0c /* 15b: VLAN Read Register */ +#define ROBO_VLAN_PORT0_DEF_TAG 0x10 /* 16b: VLAN Port 0 Default Tag Register */ +#define ROBO_VLAN_PORT1_DEF_TAG 0x12 /* 16b: VLAN Port 1 Default Tag Register */ +#define ROBO_VLAN_PORT2_DEF_TAG 0x14 /* 16b: VLAN Port 2 Default Tag Register */ +#define ROBO_VLAN_PORT3_DEF_TAG 0x16 /* 16b: VLAN Port 3 Default Tag Register */ +#define ROBO_VLAN_PORT4_DEF_TAG 0x18 /* 16b: VLAN Port 4 Default Tag Register */ +#define ROBO_VLAN_PORTMII_DEF_TAG 0x1a /* 16b: VLAN Port MII Default Tag Register */ +/* 5380 only */ +#define ROBO_VLAN_PORT5_DEF_TAG 0x1a /* 16b: VLAN Port 5 Default Tag Register */ +#define ROBO_VLAN_PORT6_DEF_TAG 0x1c /* 16b: VLAN Port 6 Default Tag Register */ +#define ROBO_VLAN_PORT7_DEF_TAG 0x1e /* 16b: VLAN Port 7 Default Tag Register */ + +/* obsolete */ +#define ROBO_VLAN_PORT0_CTRL 0x00 /* 16b: Port 0 VLAN Register */ +#define ROBO_VLAN_PORT1_CTRL 0x02 /* 16b: Port 1 VLAN Register */ +#define ROBO_VLAN_PORT2_CTRL 0x04 /* 16b: Port 2 VLAN Register */ +#define ROBO_VLAN_PORT3_CTRL 0x06 /* 16b: Port 3 VLAN Register */ +#define ROBO_VLAN_PORT4_CTRL 0x08 /* 16b: Port 4 VLAN Register */ +#define ROBO_VLAN_IM_PORT_CTRL 0x10 /* 16b: Inverse MII Port VLAN Reg */ +#define ROBO_VLAN_SMP_PORT_CTRL 0x12 /* 16b: Serial Port VLAN Register */ +#define ROBO_VLAN_PORTSPI_DEF_TAG 0x1c /* 16b: VLAN Port SPI Default Tag Register */ +#define ROBO_VLAN_PRIORITY_REMAP 0x20 /* 24b: VLAN Priority Re-Map Register */ + +#ifndef _CFE_ +#pragma pack() +#endif + + +#endif /* !__BCM535M_H_ */ + + + + + diff --git a/package/robocfg/src/robocfg.c b/package/robocfg/src/robocfg.c new file mode 100644 index 0000000000..b8fc49f499 --- /dev/null +++ b/package/robocfg/src/robocfg.c @@ -0,0 +1,533 @@ +/* + * Broadcom BCM5325E/536x switch configuration utility + * + * Copyright (C) 2005 Oleg I. Vdovikin + * + * 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 the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/param.h> +#include <sys/ioctl.h> +#include <sys/socket.h> + +/* linux stuff */ +typedef u_int64_t u64; +typedef u_int32_t u32; +typedef u_int16_t u16; +typedef u_int8_t u8; + +#include <linux/if.h> +#include <linux/sockios.h> +#include <linux/ethtool.h> +#include <linux/mii.h> + +#include "etc53xx.h" +#define ROBO_PHY_ADDR 0x1E /* robo switch phy address */ + +/* MII registers */ +#define REG_MII_PAGE 0x10 /* MII Page register */ +#define REG_MII_ADDR 0x11 /* MII Address register */ +#define REG_MII_DATA0 0x18 /* MII Data register 0 */ + +#define REG_MII_PAGE_ENABLE 1 +#define REG_MII_ADDR_WRITE 1 +#define REG_MII_ADDR_READ 2 + +/* Private et.o ioctls */ +#define SIOCGETCPHYRD (SIOCDEVPRIVATE + 9) +#define SIOCSETCPHYWR (SIOCDEVPRIVATE + 10) + +typedef struct { + struct ifreq ifr; + int fd; + int et; /* use private ioctls */ +} robo_t; + +static u16 mdio_read(robo_t *robo, u16 phy_id, u8 reg) +{ + if (robo->et) { + int args[2] = { reg }; + + if (phy_id != ROBO_PHY_ADDR) { + fprintf(stderr, + "Access to real 'phy' registers unavaliable.\n" + "Upgrade kernel driver.\n"); + + return 0xffff; + } + + robo->ifr.ifr_data = (caddr_t) args; + if (ioctl(robo->fd, SIOCGETCPHYRD, (caddr_t)&robo->ifr) < 0) { + perror("SIOCGETCPHYRD"); + exit(1); + } + + return args[1]; + } else { + struct mii_ioctl_data *mii = (struct mii_ioctl_data *)&robo->ifr.ifr_data; + mii->phy_id = phy_id; + mii->reg_num = reg; + if (ioctl(robo->fd, SIOCGMIIREG, &robo->ifr) < 0) { + perror("SIOCGMIIREG"); + exit(1); + } + return mii->val_out; + } +} + +static void mdio_write(robo_t *robo, u16 phy_id, u8 reg, u16 val) +{ + if (robo->et) { + int args[2] = { reg, val }; + + if (phy_id != ROBO_PHY_ADDR) { + fprintf(stderr, + "Access to real 'phy' registers unavaliable.\n" + "Upgrade kernel driver.\n"); + return; + } + + robo->ifr.ifr_data = (caddr_t) args; + if (ioctl(robo->fd, SIOCSETCPHYWR, (caddr_t)&robo->ifr) < 0) { + perror("SIOCGETCPHYWR"); + exit(1); + } + } else { + struct mii_ioctl_data *mii = (struct mii_ioctl_data *)&robo->ifr.ifr_data; + mii->phy_id = phy_id; + mii->reg_num = reg; + mii->val_in = val; + if (ioctl(robo->fd, SIOCSMIIREG, &robo->ifr) < 0) { + perror("SIOCSMIIREG"); + exit(1); + } + } +} + +static int robo_reg(robo_t *robo, u8 page, u8 reg, u8 op) +{ + int i = 3; + + /* set page number */ + mdio_write(robo, ROBO_PHY_ADDR, REG_MII_PAGE, + (page << 8) | REG_MII_PAGE_ENABLE); + + /* set register address */ + mdio_write(robo, ROBO_PHY_ADDR, REG_MII_ADDR, + (reg << 8) | op); + + /* check if operation completed */ + while (i--) { + if ((mdio_read(robo, ROBO_PHY_ADDR, REG_MII_ADDR) & 3) == 0) + return 0; + } + + fprintf(stderr, "robo_reg: timeout\n"); + exit(1); + + return 0; +} + +static void robo_read(robo_t *robo, u8 page, u8 reg, u16 *val, int count) +{ + int i; + + robo_reg(robo, page, reg, REG_MII_ADDR_READ); + + for (i = 0; i < count; i++) + val[i] = mdio_read(robo, ROBO_PHY_ADDR, REG_MII_DATA0 + i); +} + +static u16 robo_read16(robo_t *robo, u8 page, u8 reg) +{ + robo_reg(robo, page, reg, REG_MII_ADDR_READ); + + return mdio_read(robo, ROBO_PHY_ADDR, REG_MII_DATA0); +} + +static u32 robo_read32(robo_t *robo, u8 page, u8 reg) +{ + robo_reg(robo, page, reg, REG_MII_ADDR_READ); + + return mdio_read(robo, ROBO_PHY_ADDR, REG_MII_DATA0) + + (mdio_read(robo, ROBO_PHY_ADDR, REG_MII_DATA0 + 1) << 16); +} + +static void robo_write16(robo_t *robo, u8 page, u8 reg, u16 val16) +{ + /* write data */ + mdio_write(robo, ROBO_PHY_ADDR, REG_MII_DATA0, val16); + + robo_reg(robo, page, reg, REG_MII_ADDR_WRITE); +} + +static void robo_write32(robo_t *robo, u8 page, u8 reg, u32 val32) +{ + /* write data */ + mdio_write(robo, ROBO_PHY_ADDR, REG_MII_DATA0, val32 & 65535); + mdio_write(robo, ROBO_PHY_ADDR, REG_MII_DATA0 + 1, val32 >> 16); + + robo_reg(robo, page, reg, REG_MII_ADDR_WRITE); +} + +/* checks that attached switch is 5325E/5350 */ +static int robo_vlan5350(robo_t *robo) +{ + /* set vlan access id to 15 and read it back */ + u16 val16 = 15; + robo_write16(robo, ROBO_VLAN_PAGE, ROBO_VLAN_TABLE_ACCESS_5350, val16); + + /* 5365 will refuse this as it does not have this reg */ + return (robo_read16(robo, ROBO_VLAN_PAGE, ROBO_VLAN_TABLE_ACCESS_5350) == val16); +} + +u8 port[6] = { 0, 1, 2, 3, 4, 8 }; +char ports[6] = { 'W', '4', '3', '2', '1', 'C' }; +char *rxtx[4] = { "enabled", "rx_disabled", "tx_disabled", "disabled" }; +char *stp[8] = { "none", "disable", "block", "listen", "learn", "forward", "6", "7" }; + +struct { + char *name; + u16 bmcr; +} media[5] = { { "auto", BMCR_ANENABLE | BMCR_ANRESTART }, + { "10HD", 0 }, { "10FD", BMCR_FULLDPLX }, + { "100HD", BMCR_SPEED100 }, { "100FD", BMCR_SPEED100 | BMCR_FULLDPLX } }; + +struct { + char *name; + u16 value; +} mdix[3] = { { "auto", 0x0000 }, { "on", 0x1800 }, { "off", 0x0800 } }; + +void usage() +{ + fprintf(stderr, "Broadcom BCM5325E/536x switch configuration utility\n" + "Copyright (C) 2005 Oleg I. Vdovikin\n\n" + "This program is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n\n"); + + fprintf(stderr, "Usage: robocfg <op> ... <op>\n" + "Operations are as below:\n" + "\tshow\n" + "\tswitch <enable|disable>\n" + "\tport <port_number> [state <%s|%s|%s|%s>]\n\t\t[stp %s|%s|%s|%s|%s|%s] [tag <vlan_tag>]\n" + "\t\t[media %s|%s|%s|%s|%s] [mdi-x %s|%s|%s]\n" + "\tvlan <vlan_number> [ports <ports_list>]\n" + "\tvlans <enable|disable|reset>\n\n" + "\tports_list should be one argument, space separated, quoted if needed,\n" + "\tport number could be followed by 't' to leave packet vlan tagged (CPU \n" + "\tport default) or by 'u' to untag packet (other ports default) before \n" + "\tbringing it to the port, '*' is ignored\n" + "\nSamples:\n" + "1) ASUS WL-500g Deluxe stock config (eth0 is WAN, eth0.1 is LAN):\n" + "robocfg switch disable vlans enable reset vlan 0 ports \"0 5u\" vlan 1 ports \"1 2 3 4 5t\"" + " port 0 state enabled stp none switch enable\n" + "2) WRT54g, WL-500g Deluxe OpenWRT config (vlan0 is LAN, vlan1 is WAN):\n" + "robocfg switch disable vlans enable reset vlan 0 ports \"1 2 3 4 5t\" vlan 1 ports \"0 5t\"" + " port 0 state enabled stp none switch enable\n", + rxtx[0], rxtx[1], rxtx[2], rxtx[3], stp[0], stp[1], stp[2], stp[3], stp[4], stp[5], + media[0].name, media[1].name, media[2].name, media[3].name, media[4].name, + mdix[0].name, mdix[1].name, mdix[2].name); +} + +int +main(int argc, char *argv[]) +{ + u16 val16; + u16 mac[3]; + int i = 0, j; + int robo5350 = 0; + u32 phyid; + + static robo_t robo; + struct ethtool_drvinfo info; + + if ((robo.fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { + perror("socket"); + exit(1); + } + + /* the only interface for now */ + strcpy(robo.ifr.ifr_name, "eth0"); + + memset(&info, 0, sizeof(info)); + info.cmd = ETHTOOL_GDRVINFO; + robo.ifr.ifr_data = (caddr_t)&info; + if (ioctl(robo.fd, SIOCETHTOOL, (caddr_t)&robo.ifr) < 0) { + perror("SIOCETHTOOL: your ethernet module is either unsupported or outdated"); +// exit(1); + } else + if (strcmp(info.driver, "et0") && strcmp(info.driver, "b44")) { + fprintf(stderr, "No suitable module found for %s (managed by %s)\n", + robo.ifr.ifr_name, info.driver); + exit(1); + } + + /* try access using MII ioctls - get phy address */ + if (ioctl(robo.fd, SIOCGMIIPHY, &robo.ifr) < 0) { + robo.et = 1; + } else { + /* got phy address check for robo address */ + struct mii_ioctl_data *mii = (struct mii_ioctl_data *)&robo.ifr.ifr_data; + if (mii->phy_id != ROBO_PHY_ADDR) { + fprintf(stderr, "Invalid phy address (%d)\n", mii->phy_id); + exit(1); + } + } + + phyid = mdio_read(&robo, ROBO_PHY_ADDR, 0x2) | + (mdio_read(&robo, ROBO_PHY_ADDR, 0x3) << 16); + + if (phyid == 0xffffffff || phyid == 0x55210022) { + fprintf(stderr, "No Robo switch in managed mode found\n"); + exit(1); + } + + robo5350 = robo_vlan5350(&robo); + + for (i = 1; i < argc;) { + if (strcasecmp(argv[i], "port") == 0 && (i + 1) < argc) + { + int index = atoi(argv[++i]); + /* read port specs */ + while (++i < argc) { + if (strcasecmp(argv[i], "state") == 0 && ++i < argc) { + for (j = 0; j < 4 && strcasecmp(argv[i], rxtx[j]); j++); + if (j < 4) { + /* change state */ + robo_write16(&robo,ROBO_CTRL_PAGE, port[index], + (robo_read16(&robo, ROBO_CTRL_PAGE, port[index]) & ~(3 << 0)) | (j << 0)); + } else { + fprintf(stderr, "Invalid state '%s'.\n", argv[i]); + exit(1); + } + } else + if (strcasecmp(argv[i], "stp") == 0 && ++i < argc) { + for (j = 0; j < 8 && strcasecmp(argv[i], stp[j]); j++); + if (j < 8) { + /* change stp */ + robo_write16(&robo,ROBO_CTRL_PAGE, port[index], + (robo_read16(&robo, ROBO_CTRL_PAGE, port[index]) & ~(7 << 5)) | (j << 5)); + } else { + fprintf(stderr, "Invalid stp '%s'.\n", argv[i]); + exit(1); + } + } else + if (strcasecmp(argv[i], "media") == 0 && ++i < argc) { + for (j = 0; j < 5 && strcasecmp(argv[i], media[j].name); j++); + if (j < 5) { + mdio_write(&robo, port[index], MII_BMCR, media[j].bmcr); + } else { + fprintf(stderr, "Invalid media '%s'.\n", argv[i]); + exit(1); + } + } else + if (strcasecmp(argv[i], "mdi-x") == 0 && ++i < argc) { + for (j = 0; j < 3 && strcasecmp(argv[i], mdix[j].name); j++); + if (j < 3) { + mdio_write(&robo, port[index], 0x1c, mdix[j].value | + (mdio_read(&robo, port[index], 0x1c) & ~0x1800)); + } else { + fprintf(stderr, "Invalid mdi-x '%s'.\n", argv[i]); + exit(1); + } + } else + if (strcasecmp(argv[i], "tag") == 0 && ++i < argc) { + j = atoi(argv[i]); + /* change vlan tag */ + robo_write16(&robo, ROBO_VLAN_PAGE, ROBO_VLAN_PORT0_DEF_TAG + (index << 1), j); + } else break; + } + } else + if (strcasecmp(argv[i], "vlan") == 0 && (i + 1) < argc) + { + int index = atoi(argv[++i]); + while (++i < argc) { + if (strcasecmp(argv[i], "ports") == 0 && ++i < argc) { + char *ports = argv[i]; + int untag = 0; + int member = 0; + + while (*ports >= '0' && *ports <= '9') { + j = *ports++ - '0'; + member |= 1 << j; + + /* untag if needed, CPU port requires special handling */ + if (*ports == 'u' || (j != 5 && (*ports == ' ' || *ports == 0))) + { + untag |= 1 << j; + if (*ports) ports++; + /* change default vlan tag */ + robo_write16(&robo, ROBO_VLAN_PAGE, + ROBO_VLAN_PORT0_DEF_TAG + (j << 1), index); + } else + if (*ports == '*' || *ports == 't' || *ports == ' ') ports++; + else break; + + while (*ports == ' ') ports++; + } + + if (*ports) { + fprintf(stderr, "Invalid ports '%s'.\n", argv[i]); + exit(1); + } else { + /* write config now */ + val16 = (index) /* vlan */ | (1 << 12) /* write */ | (1 << 13) /* enable */; + if (robo5350) { + robo_write32(&robo, ROBO_VLAN_PAGE, ROBO_VLAN_WRITE_5350, + (1 << 20) /* valid */ | (untag << 6) | member); + robo_write16(&robo, ROBO_VLAN_PAGE, ROBO_VLAN_TABLE_ACCESS_5350, val16); + } else { + robo_write16(&robo, ROBO_VLAN_PAGE, ROBO_VLAN_WRITE, + (1 << 14) /* valid */ | (untag << 7) | member); + robo_write16(&robo, ROBO_VLAN_PAGE, ROBO_VLAN_TABLE_ACCESS, val16); + } + } + } else break; + } + } else + if (strcasecmp(argv[i], "switch") == 0 && (i + 1) < argc) + { + /* enable/disable switching */ + robo_write16(&robo, ROBO_CTRL_PAGE, ROBO_SWITCH_MODE, + (robo_read16(&robo, ROBO_CTRL_PAGE, ROBO_SWITCH_MODE) & ~2) | + (*argv[++i] == 'e' ? 2 : 0)); + i++; + } else + if (strcasecmp(argv[i], "vlans") == 0 && (i + 1) < argc) + { + while (++i < argc) { + if (strcasecmp(argv[i], "reset") == 0) { + /* reset vlan validity bit */ + for (j = 0; j <= (robo5350 ? VLAN_ID_MAX5350 : VLAN_ID_MAX); j++) + { + /* write config now */ + val16 = (j) /* vlan */ | (1 << 12) /* write */ | (1 << 13) /* enable */; + if (robo5350) { + robo_write32(&robo, ROBO_VLAN_PAGE, ROBO_VLAN_WRITE_5350, 0); + robo_write16(&robo, ROBO_VLAN_PAGE, ROBO_VLAN_TABLE_ACCESS_5350, val16); + } else { + robo_write16(&robo, ROBO_VLAN_PAGE, ROBO_VLAN_WRITE, 0); + robo_write16(&robo, ROBO_VLAN_PAGE, ROBO_VLAN_TABLE_ACCESS, val16); + } + } + } else + if (strcasecmp(argv[i], "enable") == 0 || strcasecmp(argv[i], "disable") == 0) + { + int disable = (*argv[i] == 'd') || (*argv[i] == 'D'); + /* enable/disable vlans */ + robo_write16(&robo, ROBO_VLAN_PAGE, ROBO_VLAN_CTRL0, disable ? 0 : + (1 << 7) /* 802.1Q VLAN */ | (3 << 5) /* mac check and hash */); + + robo_write16(&robo, ROBO_VLAN_PAGE, ROBO_VLAN_CTRL1, disable ? 0 : + (1 << 1) | (1 << 2) | (1 << 3) /* RSV multicast */); + + robo_write16(&robo, ROBO_VLAN_PAGE, ROBO_VLAN_CTRL4, disable ? 0 : + (1 << 6) /* drop invalid VID frames */); + + robo_write16(&robo, ROBO_VLAN_PAGE, ROBO_VLAN_CTRL5, disable ? 0 : + (1 << 3) /* drop miss V table frames */); + + } else break; + } + } else + if (strcasecmp(argv[i], "show") == 0) + { + break; + } else { + fprintf(stderr, "Invalid option %s\n", argv[i]); + usage(); + exit(1); + } + } + + if (i == argc) { + if (argc == 1) usage(); + return 0; + } + + /* show config */ + + printf("Switch: %sabled\n", robo_read16(&robo, ROBO_CTRL_PAGE, ROBO_SWITCH_MODE) & 2 ? "en" : "dis"); + + for (i = 0; i < 6; i++) { + printf(robo_read16(&robo, ROBO_STAT_PAGE, ROBO_LINK_STAT_SUMMARY) & (1 << port[i]) ? + "Port %d(%c): %s%s " : "Port %d(%c): DOWN ", i, ports[i], + robo_read16(&robo, ROBO_STAT_PAGE, ROBO_SPEED_STAT_SUMMARY) & (1 << port[i]) ? "100" : " 10", + robo_read16(&robo, ROBO_STAT_PAGE, ROBO_DUPLEX_STAT_SUMMARY) & (1 << port[i]) ? "FD" : "HD"); + + val16 = robo_read16(&robo, ROBO_CTRL_PAGE, port[i]); + + printf("%s stp: %s vlan: %d ", rxtx[val16 & 3], stp[(val16 >> 5) & 7], + robo_read16(&robo, ROBO_VLAN_PAGE, ROBO_VLAN_PORT0_DEF_TAG + (i << 1))); + + robo_read(&robo, ROBO_STAT_PAGE, ROBO_LSA_PORT0 + port[i] * 6, mac, 3); + + printf("mac: %02x:%02x:%02x:%02x:%02x:%02x\n", + mac[2] >> 8, mac[2] & 255, mac[1] >> 8, mac[1] & 255, mac[0] >> 8, mac[0] & 255); + } + + val16 = robo_read16(&robo, ROBO_VLAN_PAGE, ROBO_VLAN_CTRL0); + + printf("VLANs: %s %sabled%s%s\n", + robo5350 ? "BCM5325/535x" : "BCM536x", + (val16 & (1 << 7)) ? "en" : "dis", + (val16 & (1 << 6)) ? " mac_check" : "", + (val16 & (1 << 5)) ? " mac_hash" : ""); + + /* scan VLANs */ + for (i = 0; i <= (robo5350 ? VLAN_ID_MAX5350 : VLAN_ID_MAX); i++) { + /* issue read */ + val16 = (i) /* vlan */ | (0 << 12) /* read */ | (1 << 13) /* enable */; + + if (robo5350) { + u32 val32; + robo_write16(&robo, ROBO_VLAN_PAGE, ROBO_VLAN_TABLE_ACCESS_5350, val16); + /* actual read */ + val32 = robo_read32(&robo, ROBO_VLAN_PAGE, ROBO_VLAN_READ); + if ((val32 & (1 << 20)) /* valid */) { + printf("vlan%d:", i); + for (j = 0; j < 6; j++) { + if (val32 & (1 << j)) { + printf(" %d%s", j, (val32 & (1 << (j + 6))) ? + (j == 5 ? "u" : "") : "t"); + } + } + printf("\n"); + } + } else { + robo_write16(&robo, ROBO_VLAN_PAGE, ROBO_VLAN_TABLE_ACCESS, val16); + /* actual read */ + val16 = robo_read16(&robo, ROBO_VLAN_PAGE, ROBO_VLAN_READ); + if ((val16 & (1 << 14)) /* valid */) { + printf("vlan%d:", i); + for (j = 0; j < 6; j++) { + if (val16 & (1 << j)) { + printf(" %d%s", j, (val16 & (1 << (j + 7))) ? + (j == 5 ? "u" : "") : "t"); + } + } + printf("\n"); + } + } + } + + return (0); +} diff --git a/package/shfs/Makefile b/package/shfs/Makefile new file mode 100644 index 0000000000..f4383a3f96 --- /dev/null +++ b/package/shfs/Makefile @@ -0,0 +1,93 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=shfs +PKG_VERSION:=0.35 +PKG_RELEASE:=2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/shfs +PKG_MD5SUM:=016f49d71bc32eee2b5d11fc1600cfbe +PKG_CAT:=zcat + +PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install + +include $(INCLUDE_DIR)/package.mk + +define Package/shfs/Default + TITLE:=ShFS + DESCRIPTION:=\ + ShFS is a simple and easy to use Linux kernel module which allows you to \\\ + mount remote filesystems using a plain shell (SSH) connection. When using \\\ + ShFS, you can access all remote files just like the local ones, only the \\\ + access is governed through the transport security of SSH. + URL:=http://shfs.sourceforge.net/ +endef + +define Package/kmod-shfs + $(call Package/shfs/Default) + SECTION:=kernel + CATEGORY:=Kernel drivers + DEPENDS:= + TITLE+= (kernel module) + DESCRIPTION+=\\\ + \\\ + This package contains the ShFS kernel module. + VERSION:=$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE) +endef + +define Package/shfs-utils + $(call Package/shfs/Default) + SECTION:=utils + CATEGORY:=Utilities + DEPENDS:=+kmod-shfs + TITLE+= (utilities) + DESCRIPTION+=\\\ + \\\ + This package contains the ShFS utilities. +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + ARCH="$(LINUX_KARCH)" \ + CROSS_COMPILE="$(TARGET_CROSS)" \ + OFLAGS="$(TARGET_CFLAGS)" \ + CC="$(TARGET_CC)" \ + LINKER="$(TARGET_CC)" \ + KERNEL="$(LINUX_VERSION)" \ + KERNEL_SOURCES="$(LINUX_DIR)" \ + ROOT="$(PKG_INSTALL_DIR)" \ + module module-install + $(MAKE) -C $(PKG_BUILD_DIR) \ + OFLAGS="$(TARGET_CFLAGS)" \ + CC="$(TARGET_CC)" \ + LINKER="$(TARGET_CC)" \ + KERNEL_SOURCES="$(LINUX_DIR)" \ + ROOT="$(PKG_INSTALL_DIR)" \ + utils utils-install +endef + +define Package/kmod-shfs/install + install -m0755 -d $(1)/lib/modules/$(LINUX_VERSION) + $(CP) $(PKG_INSTALL_DIR)/lib/modules/$(LINUX_VERSION)/kernel/fs/shfs/shfs.$(LINUX_KMOD_SUFFIX) \ + $(1)/lib/modules/$(LINUX_VERSION)/ +endef + +define Package/shfs-utils/install + install -m0755 -d $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/shfs{,u}mount $(1)/usr/bin/ + install -m0755 -d $(1)/sbin + $(CP) $(PKG_INSTALL_DIR)/sbin/mount.shfs $(1)/sbin/ +endef + +$(eval $(call BuildPackage,kmod-shfs)) +$(eval $(call BuildPackage,shfs-utils)) diff --git a/package/shfs/patches/101-kmod_build.patch b/package/shfs/patches/101-kmod_build.patch new file mode 100644 index 0000000000..11701033f5 --- /dev/null +++ b/package/shfs/patches/101-kmod_build.patch @@ -0,0 +1,98 @@ +--- shfs-0.35-orig/shfs/Linux-2.4/Makefile 2004-06-01 15:16:19.000000000 +0200 ++++ shfs-0.35-2/shfs/Linux-2.4/Makefile 2005-04-09 02:34:35.000000000 +0200 +@@ -1,3 +1,13 @@ ++# ++# the original Makefile was trashed and replaced by this one ++# The main reason is that loadable modules should be built with ++# the same compile flags the kernel was built with, so we'd better ++# let the kernel tree build the module for us, like that : ++# ++# make -C $(KERNEL_DIR) SUBDIRS="$(shell pwd)" modules ++# make -C $(KERNEL_DIR) SUBDIRS="$(shell pwd)" modules_install ++# ++ + ifndef KERNEL + KERNEL=$(shell uname -r) + endif +@@ -10,67 +24,29 @@ + KERNEL_SOURCES=${MODULESDIR}/build + endif + +-ifeq (${MODVERSIONS},detect) +- ifeq ($(shell test -e ${KERNEL_SOURCES}/include/linux/modversions.h; echo $$?),0) +- MODVERSIONS=yes +- endif +-endif +- +-ifeq (${MODVERSIONS},yes) +-MVER=-DMODVERSIONS -DEXPORT_SYMTAB +-endif +- +-LINVER=linux-${KERNEL} +- +-ALL_TARGETS := shfs.o +- +-SEARCHDIRS := -I- -I. -I${KERNEL_SOURCES}/include #-I/usr/src/linux/include/ ++all: all-y + +-CC := gcc +-CFLAGS = -O2 -fomit-frame-pointer -fno-strict-aliasing -pipe -Wall ${SEARCHDIRS} -DMODULE ${MVER} -D__KERNEL__ -DLINUX +-LINKER := ld +-LDFLAGS = -r +-LOADLIBES := ++O_TARGET := shfs.o + +-all: ${ALL_TARGETS} ++shfs-objs := dcache.o dir.o fcache.o file.o inode.o ioctl.o proc.o shell.o symlink.o + +-%.o: %.c $(wildcard *.h) +- ${CC} ${CFLAGS} -c $< -o $@ ++obj-y := $(shfs-objs) ++obj-m := $(O_TARGET) + +-shfs.o: dcache.o dir.o fcache.o file.o inode.o ioctl.o proc.o shell.o symlink.o +- ${LINKER} ${LDFLAGS} -o $@ ${filter-out %.a %.so, $^} ${LOADLIBES} +- +-tidy: +- ${RM} core dcache.o dir.o fcache.o file.o inode.o ioctl.o proc.o shell.o symlink.o +- +-clean: tidy patch-clean +- ${RM} shfs.o ++-include $(TOPDIR)/Rules.make + ++all-y: ++ make -C ${KERNEL_SOURCES} TOPDIR="${KERNEL_SOURCES}" SUBDIRS="$(shell pwd)" modules ++ + install: shfs.o + rm -f ${MODULESDIR}/kernel/fs/shfs/shfs.o + install -m644 -b -D shfs.o ${MODULESDIR}/kernel/fs/shfs/shfs.o +- if [ -x /sbin/depmod -a "${ROOT}" = "/" ]; then /sbin/depmod -aq; fi + + uninstall: + rm -rf ${MODULESDIR}/kernel/fs/shfs +- if [ -x /sbin/depmod -a "${ROOT}" = "/" ]; then /sbin/depmod -aq; fi + +-patch: +- rm -rf ${LINVER} ${LINVER}.orig; mkdir ${LINVER}; +- for i in Documentation fs/shfs include/linux; do \ +- mkdir -p ${LINVER}/$$i; \ +- done +- cp ${KERNEL_SOURCES}/Documentation/Configure.help ${LINVER}/Documentation +- cp ${KERNEL_SOURCES}/fs/{Makefile,Config.in} ${LINVER}/fs +- cp -r ${LINVER} ${LINVER}.orig +- cp ../../Changelog *.c shfs_debug.h proc.h ${LINVER}/fs/shfs/ +- cp shfs.h shfs_fs* ${LINVER}/include/linux/ +- (cd ${LINVER}; patch -p1 <../kernel-config.diff) +- find . -type f -name "*.orig" -print | xargs rm -f +- diff -urN ${LINVER}.orig ${LINVER} >${LINVER}.diff; true +- +-patch-clean: +- rm -rf ${LINVER} ${LINVER}.orig; +- rm -f ${LINVER}.diff +- +-.PHONY : all tidy clean install uninstall patch patch-clean ++clean: ++ rm -f core *.o *.a *.s ++ ++shfs.o: $(shfs-objs) ++ diff --git a/package/shfs/patches/102-gcc4_fix.patch b/package/shfs/patches/102-gcc4_fix.patch new file mode 100644 index 0000000000..c4fd36629b --- /dev/null +++ b/package/shfs/patches/102-gcc4_fix.patch @@ -0,0 +1,23 @@ +diff -ur shfs-0.35/shfs/Linux-2.6/dir.c shfs-0.35-new/shfs/Linux-2.6/dir.c +--- shfs-0.35/shfs/Linux-2.6/dir.c 2004-06-01 09:16:19.000000000 -0400 ++++ shfs-0.35-new/shfs/Linux-2.6/dir.c 2005-02-11 18:12:00.000000000 -0500 +@@ -19,6 +19,8 @@ + #include "shfs_debug.h" + #include "proc.h" + ++static struct dentry_operations shfs_dentry_operations; ++ + static int + shfs_dir_open(struct inode *inode, struct file *filp) + { +diff -ur shfs-0.35/shfs/Linux-2.6/shfs_fs.h shfs-0.35-new/shfs/Linux-2.6/shfs_fs.h +--- shfs-0.35/shfs/Linux-2.6/shfs_fs.h 2004-06-01 09:16:19.000000000 -0400 ++++ shfs-0.35-new/shfs/Linux-2.6/shfs_fs.h 2005-02-11 18:12:03.000000000 -0500 +@@ -50,7 +50,6 @@ + #define ROUND_TO_MINS(x) do { (x).tv_sec = ((x).tv_sec / 60) * 60; (x).tv_nsec = 0; } while (0) + + /* shfs/dir.c */ +-extern struct dentry_operations shfs_dentry_operations; + extern struct file_operations shfs_dir_operations; + extern struct inode_operations shfs_dir_inode_operations; + extern void shfs_new_dentry(struct dentry *dentry); diff --git a/package/shfs/patches/103-dentry.patch b/package/shfs/patches/103-dentry.patch new file mode 100644 index 0000000000..83a406a268 --- /dev/null +++ b/package/shfs/patches/103-dentry.patch @@ -0,0 +1,21 @@ +diff -urN shfs-0.35.orig/shfs/Linux-2.6/dcache.c shfs-0.35/shfs/Linux-2.6/dcache.c +--- shfs-0.35.orig/shfs/Linux-2.6/dcache.c 2004-06-01 09:16:19.000000000 -0400 ++++ shfs-0.35/shfs/Linux-2.6/dcache.c 2006-03-25 07:08:57.950752296 -0500 +@@ -68,7 +68,7 @@ + spin_lock(&dcache_lock); + next = parent->d_subdirs.next; + while (next != &parent->d_subdirs) { +- dentry = list_entry(next, struct dentry, d_child); ++ dentry = list_entry(next, struct dentry, d_u.d_child); + dentry->d_fsdata = NULL; + shfs_age_dentry(info, dentry); + next = next->next; +@@ -101,7 +101,7 @@ + spin_lock(&dcache_lock); + next = parent->d_subdirs.next; + while (next != &parent->d_subdirs) { +- dent = list_entry(next, struct dentry, d_child); ++ dent = list_entry(next, struct dentry, d_u.d_child); + if ((unsigned long)dent->d_fsdata == fpos) { + if (dent->d_inode) + dget_locked(dent); diff --git a/package/spca5xx/Makefile b/package/spca5xx/Makefile new file mode 100644 index 0000000000..643e5863f4 --- /dev/null +++ b/package/spca5xx/Makefile @@ -0,0 +1,52 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=spca5xx +PKG_VERSION:=20060501 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://mxhaard.free.fr/spca50x/Download/ +PKG_MD5SUM:=8fcec25715aea10f9ebec5728c37e752 +PKG_CAT:=zcat + +PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +#FIXME: add proper dependency handling on kmod-usb-core & kmod-videodev packages +define Package/kmod-spca5xx + SECTION:=kernel + CATEGORY:=Kernel drivers + DEPENDS:=@PACKAGE_KMOD_USB&&PACKAGE_KMOD_VIDEODEV + TITLE:=Driver for SPCA5xx based USB cameras + URL:=http://mxhaard.free.fr/ + VERSION:=$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE) +endef + +define Build/Compile + $(MAKE) -C $(LINUX_DIR) \ + ARCH="$(LINUX_KARCH)" \ + CROSS_COMPILE="$(TARGET_CROSS)" \ + KERNELVERSION="$(KERNEL)" \ + KERNEL_VERSION="$(LINUX_VERSION)" \ + KERNELDIR="$(LINUX_DIR)" \ + SUBDIRS="$(PKG_BUILD_DIR)" \ + modules +endef + +define Package/kmod-spca5xx/install + install -m0755 -d $(1)/lib/modules/$(LINUX_VERSION) + $(CP) $(PKG_BUILD_DIR)/spca5xx.$(LINUX_KMOD_SUFFIX) \ + $(1)/lib/modules/$(LINUX_VERSION)/ +endef + +$(eval $(call BuildPackage,kmod-spca5xx)) diff --git a/package/spca5xx/patches/01-kmod-build.patch b/package/spca5xx/patches/01-kmod-build.patch new file mode 100644 index 0000000000..304df92047 --- /dev/null +++ b/package/spca5xx/patches/01-kmod-build.patch @@ -0,0 +1,177 @@ +diff -Nur spca5xx-20051212/Makefile spca5xx-20051212.patched/Makefile +--- spca5xx-20051212/Makefile 2005-12-10 17:05:51.000000000 +0100 ++++ spca5xx-20051212.patched/Makefile 2005-12-25 02:41:29.910720750 +0100 +@@ -33,7 +33,9 @@ + DEFINES += -DCONFIG_USB_SPCA5XX_MODULE=1 -DMODULE -D__KERNEL__ + DEFINES += -DVID_HARDWARE_SPCA5XX=0xFF -DSPCA5XX_VERSION=\"$(VERSION)\" + +-ifneq ($(shell uname -r | cut -d. -f1,2), 2.4) ++KERNELVERSION=$(shell uname -r | cut -d. -f1,2) ++ ++ifneq ($(KERNELVERSION), 2.4) + + ifneq ($(KERNELRELEASE),) # We were called by kbuild + CFLAGS += $(DEFINES) +@@ -68,152 +70,16 @@ + + else # kernel version test + +-############################################################################# +-# For Linux 2.4 users. +-# Change the following lines according to your system configuration. +-# It is important to configure your particular source tree ("make dep") before +-# compiling this module! +-############################################################################# +-### +-# This makefile will build the spca50x driver module external to the kernel +-# source tree. It makes it easier to swap kernels. +- +- +-KERNEL_VERSION = `uname -r` +- +-### +-# Location of the header files (most importantly the config files) +-# for the kernel you want to build the module against. +-# This should be correct for the currently installed kernel on your machine. +-KINCLUDE = /lib/modules/$(KERNEL_VERSION)/build/include +-KERNEL_ACFILE = $(KINCLUDE)/linux/autoconf.h +-KERNEL_MODVERSIONSFILE = $(KINCLUDE)/linux/modversions.h +-MODULE_INSTALLDIR = /lib/modules/$(KERNEL_VERSION)/kernel/drivers/usb/ +- +-# Detect module versioning support +-ifneq ($(strip $(shell grep 'define CONFIG_MODVERSIONS 1' $(KERNEL_ACFILE))),) +- DEFINES += -DMODVERSIONS -include $(KERNEL_MODVERSIONSFILE) +-endif +- +-# Detect SMP support +-ifneq ($(strip $(shell grep 'define CONFIG_SMP 1' $(KERNEL_ACFILE))),) +- DEFINES += -D__SMP__ -DSMP +-endif +- +-# Setup the tools +-CC = gcc +-LD = ld +- +-# Setup compiler warnings +-WARNINGS = -Wall -Wpointer-arith +-WARNINGS += -Wcast-align -Wwrite-strings -Wstrict-prototypes +-WARNINGS += -Wuninitialized -Wreturn-type -Wunused -Wparentheses +- +-# Setup compiler flags +-CFLAGS = -O2 -fomit-frame-pointer -fno-strict-aliasing -pipe +-CFLAGS += -mpreferred-stack-boundary=2 +-CFLAGS += -I$(KINCLUDE) -Idrivers/usb +- +-# Setup link flags +-LDFLAGS = --strip-debug -r +- +-# Setup the list of files to be included in a distribution +-DIST_FILES = CHANGELOG \ +- README \ +- Makefile \ +- drivers/usb/Config.in \ +- drivers/usb/spcadecoder.c \ +- drivers/usb/spcadecoder.h \ +- drivers/usb/spcagamma.h \ +- drivers/usb/spcaCompat.h \ +- drivers/usb/spcausb.h \ +- drivers/usb/spca500_init.h \ +- drivers/usb/spca501_init.h \ +- drivers/usb/sp5xxfw2.dat \ +- drivers/usb/sp5xxfw2.h \ +- drivers/usb/spca505_init.h \ +- drivers/usb/spca506.h \ +- drivers/usb/spca508_init.h \ +- drivers/usb/spca561.h \ +- drivers/usb/sonix.h \ +- drivers/usb/cs2102.h \ +- drivers/usb/hv7131b.h \ +- drivers/usb/icm105a.h \ +- drivers/usb/hv7131c.h \ +- drivers/usb/hdcs2020.h \ +- drivers/usb/pb0330.h \ +- drivers/usb/tas5130c.h \ +- drivers/usb/zc3xx.h\ +- drivers/usb/tv8532.h\ +- drivers/usb/cxlib.h\ +- drivers/usb/sn9cxxx.h\ +- drivers/usb/cx11646.h\ +- drivers/usb/pac207.h\ +- drivers/usb/spca5xx.c \ +- drivers/usb/spca5xx.h +- +-OBJS = drivers/usb/spcadecoder.o \ +- drivers/usb/spca5xx.o +- +-BINARY = spca5xx.o +- +-### +-# Targets follow here +- +-binary: $(OBJS) +- @echo Linking $(BINARY) +- @$(LD) $(LDFLAGS) -o $(BINARY) $(OBJS) +- +-install: binary +- @echo Installing.. Your root password may be required. +- su -c "make install-root" +- +-install-root: +- @echo Installing.. +- @mkdir -p /lib/modules/`uname -r`/kernel/drivers/usb +- @rm -f /lib/modules/`uname -r`/kernel/drivers/usb/spca50x.o +- @rm -f /lib/modules/`uname -r`/kernel/drivers/usb/et61x.o +- @cp spca5xx.o /lib/modules/`uname -r`/kernel/drivers/usb/spca5xx.o +- @/sbin/depmod +- +-dist: clean binary +- @echo Making distributable archives +- @rm -f spca5xx-src-$(VERSION).tar.gz +- @tar zcf spca5xx-src-$(VERSION).tar.gz $(DIST_FILES) +- @rm -f spca5xx-module-$(VERSION).tar.gz +- @cp $(BINARY) spca5xx-$(VERSION).o +- @tar zcf spca5xx-module-$(VERSION).tar.gz spca5xx-$(VERSION).o README +- @rm spca5xx-$(VERSION).o +- +-.c.o: Makefile $*.c +- @echo Compiling $*.c +- @$(CC) $(CFLAGS) $(WARNINGS) $(DEFINES) -c $*.c -o $*.o +- +-### +-# Dependencies follow here +- +-drivers/usb/spca5xx.o: drivers/usb/spca5xx.h \ +- drivers/usb/spcaCompat.h \ +- drivers/usb/spcausb.h \ +- drivers/usb/sonix.h \ +- drivers/usb/spca500_init.h \ +- drivers/usb/spca501_init.h \ +- drivers/usb/sp5xxfw2.h \ +- drivers/usb/spca505_init.h \ +- drivers/usb/spca506.h \ +- drivers/usb/spca508_init.h \ +- drivers/usb/spca561.h \ +- drivers/usb/zc3xx.h\ +- drivers/usb/tv8532.h\ +- drivers/usb/cx11646.h\ +- drivers/usb/mr97311.h\ +- drivers/usb/sn9cxxx.h\ +- drivers/usb/pac207.h\ +- +- +-drivers/usb/spcadecoder.o: drivers/usb/spcadecoder.h \ +- drivers/usb/spcagamma.h \ +- ++EXTRA_CFLAGS += $(DEFINES) ++ ++spca5xx-objs := drivers/usb/spca5xx.o drivers/usb/spcadecoder.o ++ ++obj-m += spca5xx.o ++obj-y := $(spca5xx-objs) ++ ++O_TARGET := $(obj-m) ++ ++-include $(TOPDIR)/Rules.make + + endif # End kernel version test + diff --git a/package/spca5xx/patches/02-seq_bug.patch b/package/spca5xx/patches/02-seq_bug.patch new file mode 100644 index 0000000000..ec1003e700 --- /dev/null +++ b/package/spca5xx/patches/02-seq_bug.patch @@ -0,0 +1,14 @@ +diff -Nur spca5xx-20060501/drivers/usb/spca5xx.c.orig spca5xx-20060501/drivers/usb/spca5xx.c +--- spca5xx-20060501/drivers/usb/spca5xx.c.orig 2006-08-16 11:56:33.000000000 -0700 ++++ spca5xx-20060501/drivers/usb/spca5xx.c 2006-08-16 11:55:41.000000000 -0700 +@@ -1092,8 +1092,8 @@ + // spca50x->avg_lum, spca50x->avg_lum); + for (i = 0; i < SPCA50X_NUMFRAMES; i++) { + out += sprintf(out, "frame : %d\n", i); +- out += +- sprintf(out, " sequence : %d\n", spca50x->frame[i].seq); ++// out += ++// sprintf(out, " sequence : %d\n", spca50x->frame[i].seq); + out += + sprintf(out, " grabstate : %d\n", + spca50x->frame[i].grabstate); diff --git a/package/switch/Makefile b/package/switch/Makefile new file mode 100644 index 0000000000..75f3129402 --- /dev/null +++ b/package/switch/Makefile @@ -0,0 +1,54 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id:$ + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=kmod-switch +PKG_RELEASE:=1 + +PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/kmod-switch + SECTION:=kernel + CATEGORY:=Kernel drivers + DEPENDS:=@LINUX_2_6_BRCM||LINUX_2_4_BRCM + DEFAULT:=y + TITLE:=Switch drivers + DESCRIPTION:=\ + This package contains switch drivers for ADM6996L and BCM53XX RoboSwitch. + VERSION:=$(LINUX_VERSION)-$(BOARD)-$(PKG_RELEASE) +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) + $(CP) ./src/* $(PKG_BUILD_DIR)/ +endef + +define Build/Compile + $(MAKE) -C "$(LINUX_DIR)" \ + CROSS_COMPILE="$(TARGET_CROSS)" \ + ARCH="$(LINUX_KARCH)" \ + SUBDIRS="$(PKG_BUILD_DIR)" \ + EXTRA_CFLAGS="-DBCMGPIO2" \ + modules +endef + +define Package/kmod-switch/install + install -m0755 -d $(1)/lib/modules/$(LINUX_VERSION) + $(CP) $(PKG_BUILD_DIR)/*.$(LINUX_KMOD_SUFFIX) \ + $(1)/lib/modules/$(LINUX_VERSION) + install -m0755 -d $(1)/lib/network/ + install -m0755 ./files/switch.sh $(1)/lib/network/ + install -m0755 -d $(1)/etc/modules.d/ + printf 'switch-core\nswitch-robo\nswitch-adm\n' > $(1)/etc/modules.d/20-switch +endef + +$(eval $(call BuildPackage,kmod-switch)) diff --git a/package/switch/files/switch.sh b/package/switch/files/switch.sh new file mode 100644 index 0000000000..a787a8cf38 --- /dev/null +++ b/package/switch/files/switch.sh @@ -0,0 +1,33 @@ +#!/bin/sh +# Copyright (C) 2006 OpenWrt.org + +setup_switch_vlan() { + DIR="/proc/switch/$CONFIG_SECTION/vlan/$1" + [ -d "$DIR" ] || return 0 + + config_get ports "$CONFIG_SECTION" "vlan$1" + echo "$ports" > "$DIR/ports" +} + +setup_switch() { + config_cb() { + case "$1" in + switch) + [ -n "$2" -a -d "/proc/switch/$2" ] && { + echo 1 > "/proc/switch/$2/reset" + echo 1 > "/proc/switch/$2/enable" + echo 1 > "/proc/switch/$2/enable_vlan" + option_cb() { + case "$1" in + vlan*) setup_switch_vlan "${1##vlan}";; + esac + } + } + ;; + *) + option_cb() { return 0; } + ;; + esac + } + config_load network +} diff --git a/package/switch/src/Makefile b/package/switch/src/Makefile new file mode 100644 index 0000000000..4c5f911ea2 --- /dev/null +++ b/package/switch/src/Makefile @@ -0,0 +1,19 @@ +# $Id$ +# +# Makefile for switch driver +# +# Copyright (C) 2005 Felix Fietkau <nbd@openwrt.org> +# +# 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 the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# + +obj-m := switch-core.o switch-adm.o switch-robo.o + +ifeq ($(MAKING_MODULES),1) +export-objs := switch-core.o + +-include $(TOPDIR)/Rules.make +endif diff --git a/package/switch/src/etc53xx.h b/package/switch/src/etc53xx.h new file mode 100644 index 0000000000..12d94a5d03 --- /dev/null +++ b/package/switch/src/etc53xx.h @@ -0,0 +1,620 @@ +/* + * Broadcom Home Gateway Reference Design + * BCM53xx Register definitions + * + * Copyright 2004, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * $Id: etc53xx.h,v 1.1 2005/05/14 13:15:46 nbd Exp $ + */ + +#ifndef __BCM535M_H_ +#define __BCM535M_H_ + +/* ROBO embedded device type */ +#define ROBO_DEV_5380 1 +#define ROBO_DEV_5365 2 +#define ROBO_DEV_5350 3 + +/* BCM5325m GLOBAL PAGE REGISTER MAP */ +#ifndef _CFE_ +#pragma pack(1) +#endif + +/* BCM5325m Serial Management Port (SMP) Page offsets */ +#define ROBO_CTRL_PAGE 0x00 /* Control registers */ +#define ROBO_STAT_PAGE 0x01 /* Status register */ +#define ROBO_MGMT_PAGE 0x02 /* Management Mode registers */ +#define ROBO_MIB_AC_PAGE 0x03 /* MIB Autocast registers */ +#define ROBO_ARLCTRL_PAGE 0x04 /* ARL Control Registers */ +#define ROBO_ARLIO_PAGE 0x05 /* ARL Access Registers */ +#define ROBO_FRAMEBUF_PAGE 0x06 /* Management frame access registers */ +#define ROBO_MEM_ACCESS_PAGE 0x08 /* Memory access registers */ + +/* PHY Registers */ +#define ROBO_PORT0_MII_PAGE 0x10 /* Port 0 MII Registers */ +#define ROBO_PORT1_MII_PAGE 0x11 /* Port 1 MII Registers */ +#define ROBO_PORT2_MII_PAGE 0x12 /* Port 2 MII Registers */ +#define ROBO_PORT3_MII_PAGE 0x13 /* Port 3 MII Registers */ +#define ROBO_PORT4_MII_PAGE 0x14 /* Port 4 MII Registers */ +/* (start) registers only for BCM5380 */ +#define ROBO_PORT5_MII_PAGE 0x15 /* Port 5 MII Registers */ +#define ROBO_PORT6_MII_PAGE 0x16 /* Port 6 MII Registers */ +#define ROBO_PORT7_MII_PAGE 0x17 /* Port 7 MII Registers */ +/* (end) registers only for BCM5380 */ +#define ROBO_IM_PORT_PAGE 0x18 /* Inverse MII Port (to EMAC) */ +#define ROBO_ALL_PORT_PAGE 0x19 /* All ports MII Registers (broadcast)*/ + +/* MAC Statistics registers */ +#define ROBO_PORT0_MIB_PAGE 0x20 /* Port 0 10/100 MIB Statistics */ +#define ROBO_PORT1_MIB_PAGE 0x21 /* Port 1 10/100 MIB Statistics */ +#define ROBO_PORT2_MIB_PAGE 0x22 /* Port 2 10/100 MIB Statistics */ +#define ROBO_PORT3_MIB_PAGE 0x23 /* Port 3 10/100 MIB Statistics */ +#define ROBO_PORT4_MIB_PAGE 0x24 /* Port 4 10/100 MIB Statistics */ +/* (start) registers only for BCM5380 */ +#define ROBO_PORT5_MIB_PAGE 0x25 /* Port 5 10/100 MIB Statistics */ +#define ROBO_PORT6_MIB_PAGE 0x26 /* Port 6 10/100 MIB Statistics */ +#define ROBO_PORT7_MIB_PAGE 0x27 /* Port 7 10/100 MIB Statistics */ +/* (end) registers only for BCM5380 */ +#define ROBO_IM_PORT_MIB_PAGE 0x28 /* Inverse MII Port MIB Statistics */ + +/* Quality of Service (QoS) Registers */ +#define ROBO_QOS_PAGE 0x30 /* QoS Registers */ + +/* VLAN Registers */ +#define ROBO_VLAN_PAGE 0x34 /* VLAN Registers */ + +/* Note SPI Data/IO Registers not used */ +#define ROBO_SPI_DATA_IO_0_PAGE 0xf0 /* SPI Data I/O 0 */ +#define ROBO_SPI_DATA_IO_1_PAGE 0xf1 /* SPI Data I/O 1 */ +#define ROBO_SPI_DATA_IO_2_PAGE 0xf2 /* SPI Data I/O 2 */ +#define ROBO_SPI_DATA_IO_3_PAGE 0xf3 /* SPI Data I/O 3 */ +#define ROBO_SPI_DATA_IO_4_PAGE 0xf4 /* SPI Data I/O 4 */ +#define ROBO_SPI_DATA_IO_5_PAGE 0xf5 /* SPI Data I/O 5 */ +#define ROBO_SPI_DATA_IO_6_PAGE 0xf6 /* SPI Data I/O 6 */ +#define ROBO_SPI_DATA_IO_7_PAGE 0xf7 /* SPI Data I/O 7 */ + +#define ROBO_SPI_STATUS_PAGE 0xfe /* SPI Status Registers */ +#define ROBO_PAGE_PAGE 0xff /* Page Registers */ + + +/* BCM5325m CONTROL PAGE (0x00) REGISTER MAP : 8bit (byte) registers */ +typedef struct _ROBO_PORT_CTRL_STRUC +{ + unsigned char rx_disable:1; /* rx disable */ + unsigned char tx_disable:1; /* tx disable */ + unsigned char rsvd:3; /* reserved */ + unsigned char stp_state:3; /* spanning tree state */ +} ROBO_PORT_CTRL_STRUC; + +#define ROBO_PORT0_CTRL 0x00 /* 10/100 Port 0 Control */ +#define ROBO_PORT1_CTRL 0x01 /* 10/100 Port 1 Control */ +#define ROBO_PORT2_CTRL 0x02 /* 10/100 Port 2 Control */ +#define ROBO_PORT3_CTRL 0x03 /* 10/100 Port 3 Control */ +#define ROBO_PORT4_CTRL 0x04 /* 10/100 Port 4 Control */ +/* (start) registers only for BCM5380 */ +#define ROBO_PORT5_CTRL 0x05 /* 10/100 Port 5 Control */ +#define ROBO_PORT6_CTRL 0x06 /* 10/100 Port 6 Control */ +#define ROBO_PORT7_CTRL 0x07 /* 10/100 Port 7 Control */ +/* (end) registers only for BCM5380 */ +#define ROBO_IM_PORT_CTRL 0x08 /* 10/100 Port 8 Control */ +#define ROBO_SMP_CTRL 0x0a /* SMP Control register */ +#define ROBO_SWITCH_MODE 0x0b /* Switch Mode Control */ +#define ROBO_PORT_OVERRIDE_CTRL 0x0e /* Port state override */ +#define ROBO_PORT_OVERRIDE_RVMII (1<<4) /* Bit 4 enables RvMII */ +#define ROBO_PD_MODE_CTRL 0x0f /* Power-down mode control */ +#define ROBO_IP_MULTICAST_CTRL 0x21 /* IP Multicast control */ + +/* BCM5325m STATUS PAGE (0x01) REGISTER MAP : 16bit/48bit registers */ +#define ROBO_HALF_DUPLEX 0 +#define ROBO_FULL_DUPLEX 1 + +#define ROBO_LINK_STAT_SUMMARY 0x00 /* Link Status Summary: 16bit */ +#define ROBO_LINK_STAT_CHANGE 0x02 /* Link Status Change: 16bit */ +#define ROBO_SPEED_STAT_SUMMARY 0x04 /* Port Speed Summary: 16bit*/ +#define ROBO_DUPLEX_STAT_SUMMARY 0x06 /* Duplex Status Summary: 16bit */ +#define ROBO_PAUSE_STAT_SUMMARY 0x08 /* PAUSE Status Summary: 16bit */ +#define ROBO_SOURCE_ADDR_CHANGE 0x0C /* Source Address Change: 16bit */ +#define ROBO_LSA_PORT0 0x10 /* Last Source Addr, Port 0: 48bits*/ +#define ROBO_LSA_PORT1 0x16 /* Last Source Addr, Port 1: 48bits*/ +#define ROBO_LSA_PORT2 0x1c /* Last Source Addr, Port 2: 48bits*/ +#define ROBO_LSA_PORT3 0x22 /* Last Source Addr, Port 3: 48bits*/ +#define ROBO_LSA_PORT4 0x28 /* Last Source Addr, Port 4: 48bits*/ +#define ROBO_LSA_IM_PORT 0x40 /* Last Source Addr, IM Port: 48bits*/ + +/* BCM5325m MANAGEMENT MODE REGISTERS (0x02) REGISTER MAP: 8/48 bit regs*/ +typedef struct _ROBO_GLOBAL_CONFIG_STRUC +{ + unsigned char resetMIB:1; /* reset MIB counters */ + unsigned char rxBPDU:1; /* receive BDPU enable */ + unsigned char rsvd1:2; /* reserved */ + unsigned char MIBacHdrCtrl:1; /* MIB autocast header control */ + unsigned char MIBac:1; /* MIB autocast enable */ + unsigned char frameMgmtPort:2; /* frame management port */ +} ROBO_GLOBAL_CONFIG_STRUC; +#define ROBO_GLOBAL_CONFIG 0x00 /* Global Management Config: 8bit*/ +#define ROBO_MGMT_PORT_ID 0x02 /* Management Port ID: 8bit*/ +#define ROBO_RMON_MIB_STEER 0x04 /* RMON Mib Steering: 16bit */ +#define ROBO_MIB_MODE_SELECT 0x04 /* MIB Mode select: 16bit (BCM5350) */ +#define ROBO_AGE_TIMER_CTRL 0x06 /* Age time control: 32bit */ +#define ROBO_MIRROR_CAP_CTRL 0x10 /* Mirror Capture : 16bit */ +#define ROBO_MIRROR_ING_CTRL 0x12 /* Mirror Ingress Control: 16bit */ +#define ROBO_MIRROR_ING_DIV_CTRL 0x14 /* Mirror Ingress Divider: 16bit */ +#define ROBO_MIRROR_ING_MAC_ADDR 0x16 /* Ingress Mirror MAC Addr: 48bit*/ +#define ROBO_MIRROR_EGR_CTRL 0x1c /* Mirror Egress Control: 16bit */ +#define ROBO_MIRROR_EGR_DIV_CTRL 0x1e /* Mirror Egress Divider: 16bit */ +#define ROBO_MIRROR_EGR_MAC_ADDR 0x20 /* Egress Mirror MAC Addr: 48bit*/ + +/* BCM5325m MIB AUTOCAST REGISTERS (0x03) REGISTER MAP: 8/16/48 bit regs */ +#define ROBO_MIB_AC_PORT 0x00 /* MIB Autocast Port: 16bit */ +#define ROBO_MIB_AC_HDR_PTR 0x02 /* MIB Autocast Header pointer:16bit*/ +#define ROBO_MIB_AC_HDR_LEN 0x04 /* MIB Autocast Header Len: 16bit */ +#define ROBO_MIB_AC_DA 0x06 /* MIB Autocast DA: 48bit */ +#define ROBO_MIB_AC_SA 0x0c /* MIB Autocast SA: 48bit */ +#define ROBO_MIB_AC_TYPE 0x12 /* MIB Autocast Type: 16bit */ +#define ROBO_MIB_AC_RATE 0x14 /* MIB Autocast Rate: 8bit */ +#define ROBO_GET_AC_RATE(secs) ((secs)*10) +#define ROBO_AC_RATE_MAX 0xff +#define ROBO_AC_RATE_DEFAULT 0x64 /* 10 secs */ +typedef struct _ROBO_MIB_AC_STRUCT +{ + unsigned char opcode:4; /* Tx MIB Autocast opcode */ + unsigned char portno:4; /* zero-based port no. */ + unsigned char portstate:8; /* port state */ + unsigned long long TxOctets; + unsigned int TxDropPkts; + unsigned int rsvd; + unsigned int TxBroadcastPkts; + unsigned int TxMulticastPkts; + unsigned int TxUnicastPkts; + unsigned int TxCollisions; + unsigned int TxSingleCollision; + unsigned int TxMultiCollision; + unsigned int TxDeferredTransmit; + unsigned int TxLateCollision; + unsigned int TxExcessiveCollision; + unsigned int TxFrameInDiscards; + unsigned int TxPausePkts; + unsigned int rsvd1[2]; + unsigned long long RxOctets; + unsigned int RxUndersizePkts; + unsigned int RxPausePkts; + unsigned int RxPkts64Octets; + unsigned int RxPkts64to127Octets; + unsigned int RxPkts128to255Octets; + unsigned int RxPkts256to511Octets; + unsigned int RxPkts512to1023Octets; + unsigned int RxPkts1024to1522Octets; + unsigned int RxOversizePkts; + unsigned int RxJabbers; + unsigned int RxAlignmentErrors; + unsigned int RxFCSErrors; + unsigned long long RxGoodOctets; + unsigned int RxDropPkts; + unsigned int RxUnicastPkts; + unsigned int RxMulticastPkts; + unsigned int RxBroadcastPkts; + unsigned int RxSAChanges; + unsigned int RxFragments; + unsigned int RxExcessSizeDisc; + unsigned int RxSymbolError; +} ROBO_MIB_AC_STRUCT; + +/* BCM5325m ARL CONTROL REGISTERS (0x04) REGISTER MAP: 8/16/48/64 bit regs */ +#define ROBO_ARL_CONFIG 0x00 /* ARL Global Configuration: 8bit*/ +#define ROBO_BPDU_MC_ADDR_REG 0x04 /* BPDU Multicast Address Reg:64bit*/ +#define ROBO_MULTIPORT_ADDR_1 0x10 /* Multiport Address 1: 48 bits*/ +#define ROBO_MULTIPORT_VECTOR_1 0x16 /* Multiport Vector 1: 16 bits */ +#define ROBO_MULTIPORT_ADDR_2 0x20 /* Multiport Address 2: 48 bits*/ +#define ROBO_MULTIPORT_VECTOR_2 0x26 /* Multiport Vector 2: 16 bits */ +#define ROBO_SECURE_SRC_PORT_MASK 0x30 /* Secure Source Port Mask: 16 bits*/ +#define ROBO_SECURE_DST_PORT_MASK 0x32 /* Secure Dest Port Mask: 16 bits */ + + +/* BCM5325m ARL IO REGISTERS (0x05) REGISTER MAP: 8/16/48/64 bit regs */ +#define ARL_TABLE_WRITE 0 /* for read/write state in control reg */ +#define ARL_TABLE_READ 1 /* for read/write state in control reg */ +#ifdef BCM5380 +#define ARL_VID_BYTES 2 /* number of bytes for VID */ +#else +#define ARL_VID_BYTES 1 /* number of bytes for VID */ +#endif +typedef struct _ROBO_ARL_RW_CTRL_STRUC +{ + unsigned char ARLrw:1; /* ARL read/write (1=read) */ + unsigned char rsvd:6; /* reserved */ + unsigned char ARLStart:1; /* ARL start/done (1=start) */ +} ROBO_ARL_RW_CTRL_STRUC; +typedef struct _ROBO_ARL_SEARCH_CTRL_STRUC +{ + unsigned char valid:1; /* ARL search result valid */ + unsigned char rsvd:6; /* reserved */ + unsigned char ARLStart:1; /* ARL start/done (1=start) */ +} ROBO_ARL_SEARCH_CTRL_STRUC; +typedef struct _ROBO_ARL_ENTRY_CTRL_STRUC +{ + unsigned char portID:4; /* port id */ + unsigned char chipID:2; /* chip id */ + unsigned char rsvd:5; /* reserved */ + unsigned char prio:2; /* priority */ + unsigned char age:1; /* age */ + unsigned char staticEn:1; /* static */ + unsigned char valid:1; /* valid */ +} ROBO_ARL_ENTRY_CTRL_STRUC; +typedef struct _ROBO_ARL_SEARCH_RESULT_CTRL_STRUC +{ + unsigned char portID:4; /* port id */ + unsigned char rsvd:1; /* reserved */ + unsigned char vid:8; /* vlan id */ + unsigned char age:1; /* age */ + unsigned char staticEn:1; /* static */ + unsigned char valid:1; /* valid */ +} ROBO_ARL_SEARCH_RESULT_CTRL_STRUC; +typedef struct _ROBO_ARL_ENTRY_MAC_STRUC +{ + unsigned char macBytes[6]; /* MAC address */ +} ROBO_ARL_ENTRY_MAC_STRUC; + +typedef struct _ROBO_ARL_ENTRY_STRUC +{ + ROBO_ARL_ENTRY_MAC_STRUC mac; /* MAC address */ + ROBO_ARL_ENTRY_CTRL_STRUC ctrl; /* control bits */ +} ROBO_ARL_ENTRY_STRUC; + +typedef struct _ROBO_ARL_SEARCH_RESULT_STRUC +{ + ROBO_ARL_ENTRY_MAC_STRUC mac; /* MAC address */ + ROBO_ARL_SEARCH_RESULT_CTRL_STRUC ctrl; /* control bits */ +} ROBO_ARL_SEARCH_RESULT_STRUC; + +/* multicast versions of ARL entry structs */ +typedef struct _ROBO_ARL_ENTRY_MCAST_CTRL_STRUC +{ + unsigned int portMask:12;/* multicast port mask */ + unsigned char prio:1; /* priority */ + unsigned char gigPort:1; /* gigabit port 1 mask */ + unsigned char staticEn:1; /* static */ + unsigned char valid:1; /* valid */ +} ROBO_ARL_ENTRY_MCAST_CTRL_STRUC; +typedef struct _ROBO_ARL_SEARCH_RESULT_MCAST_CTRL_STRUC +{ + unsigned int portMask:13; /* multicast port mask */ + unsigned char age:1; /* age */ + unsigned char staticEn:1; /* static */ + unsigned char valid:1; /* valid */ +} ROBO_ARL_SEARCH_RESULT_MCAST_CTRL_STRUC; +/* BCM5350 extension register */ +typedef struct _ROBO_ARL_SEARCH_RESULT_EXTENSION +{ + unsigned int prio:2; /* priority */ + unsigned int portMask:1; /* MSB (MII) of port mask for multicast */ + unsigned int reserved:5; +} ROBO_ARL_SEARCH_RESULT_EXTENSION; + +typedef struct _ROBO_ARL_ENTRY_MCAST_STRUC +{ + ROBO_ARL_ENTRY_MAC_STRUC mac; /* MAC address */ + ROBO_ARL_ENTRY_MCAST_CTRL_STRUC ctrl; /* control bits */ +} ROBO_ARL_ENTRY_MCAST_STRUC; +typedef struct _ROBO_ARL_SEARCH_RESULT_MCAST_STRUC +{ + ROBO_ARL_ENTRY_MAC_STRUC mac; /* MAC address */ + ROBO_ARL_SEARCH_RESULT_MCAST_CTRL_STRUC ctrl; /* control bits */ +} ROBO_ARL_SEARCH_RESULT_MCAST_STRUC; + +#define ROBO_ARL_RW_CTRL 0x00 /* ARL Read/Write Control : 8bit */ +#define ROBO_ARL_MAC_ADDR_IDX 0x02 /* MAC Address Index: 48bit */ +#define ROBO_ARL_VID_TABLE_IDX 0x08 /* VID Table Address Index: 8bit */ +#define ROBO_ARL_ENTRY0 0x10 /* ARL Entry 0 : 64 bit */ +#define ROBO_ARL_ENTRY1 0x18 /* ARL Entry 1 : 64 bit */ +#define ROBO_ARL_SEARCH_CTRL 0x20 /* ARL Search Control: 8bit */ +#define ROBO_ARL_SEARCH_ADDR 0x22 /* ARL Search Address: 16bit */ +#define ROBO_ARL_SEARCH_RESULT 0x24 /* ARL Search Result: 64bit */ +#define ROBO_ARL_SEARCH_RESULT_EXT 0x2c /* ARL Search Result Extension (5350): 8bit */ +#define ROBO_ARL_VID_ENTRY0 0x30 /* ARL VID Entry 0: 64bit */ +#define ROBO_ARL_VID_ENTRY1 0x32 /* ARL VID Entry 1: 64bit */ + +/* BCM5325m MANAGEMENT FRAME REGISTERS (0x6) REGISTER MAP: 8/16 bit regs */ +#define ROBO_MGMT_FRAME_RD_DATA 0x00 /* Management Frame Read Data :8bit*/ +#define ROBO_MGMT_FRAME_WR_DATA 0x01 /* Management Frame Write Data:8bit*/ +#define ROBO_MGMT_FRAME_WR_CTRL 0x02 /* Write Control: 16bit */ +#define ROBO_MGMT_FRAME_RD_STAT 0x04 /* Read Status: 16bit */ + +/* BCM5325m MEMORY ACCESS REGISTERS (Page 0x08) REGISTER MAP: 32 bit regs */ +#define MEM_TABLE_READ 1 /* for read/write state in mem access reg */ +#define MEM_TABLE_WRITE 0 /* for read/write state in mem access reg */ +#define MEM_TABLE_ACCESS_START 1 /* for mem access read/write start */ +#define MEM_TABLE_ACCESS_DONE 0 /* for mem access read/write done */ +#define VLAN_TABLE_ADDR 0x3800 /* BCM5380 only */ +#ifdef BCM5380 +#define NUM_ARL_TABLE_ENTRIES 4096 /* number of entries in ARL table */ +#define NUM_VLAN_TABLE_ENTRIES 2048 /* number of entries in VLAN table */ +#define ARL_TABLE_ADDR 0 /* offset of ARL table start */ +#else +#define NUM_ARL_TABLE_ENTRIES 2048 /* number of entries in ARL table */ +#define NUM_VLAN_TABLE_ENTRIES 256 /* number of entries in VLAN table */ +#define ARL_TABLE_ADDR 0x3800 /* offset of ARL table start */ +/* corresponding values for 5350 */ +#define NUM_ARL_TABLE_ENTRIES_5350 1024 /* number of entries in ARL table (5350) */ +#define NUM_VLAN_TABLE_ENTRIES_5350 16 /* number of entries in VLAN table */ +#define ARL_TABLE_ADDR_5350 0x1c00 /* offset of ARL table start (5350) */ +#endif +typedef struct _ROBO_MEM_ACCESS_CTRL_STRUC +{ + unsigned int memAddr:14; /* 64-bit memory address */ + unsigned char rsvd:4; /* reserved */ + unsigned char readEn:1; /* read enable (0 == write) */ + unsigned char startDone:1;/* memory access start/done */ + unsigned int rsvd1:12; /* reserved */ +} ROBO_MEM_ACCESS_CTRL_STRUC; +typedef struct _ROBO_MEM_ACCESS_DATA_STRUC +{ + unsigned int memData[2]; /* 64-bit data */ + unsigned short rsvd; /* reserved */ +} ROBO_MEM_ACCESS_DATA_STRUC; + +#ifdef BCM5380 +typedef struct _ROBO_ARL_TABLE_DATA_STRUC +{ + unsigned char MACaddr[6]; /* MAC addr */ + unsigned int portID:4; /* port ID */ + unsigned int chipID:2; /* chip ID */ + unsigned int rsvd:6; /* reserved */ + unsigned int highPrio:1; /* high priority address */ + unsigned int age:1; /* entry accessed/learned since ageing process */ + unsigned int staticAddr:1;/* entry is static */ + unsigned int valid:1; /* entry is valid */ + unsigned int vid:12; /* vlan id */ + unsigned int rsvd2:4; /* reserved */ +} ROBO_ARL_TABLE_DATA_STRUC; +#else +typedef struct _ROBO_ARL_TABLE_DATA_STRUC +{ + unsigned char MACaddr[6]; /* MAC addr */ + unsigned int portID:4; /* port ID */ + unsigned int chipID:2; /* chip ID */ + unsigned int rsvd:7; /* reserved */ + unsigned int age:1; /* entry accessed/learned since ageing process */ + unsigned int staticAddr:1;/* entry is static */ + unsigned int valid:1; /* entry is valid */ +} ROBO_ARL_TABLE_DATA_STRUC; +#endif + +/* multicast format*/ +typedef struct _ROBO_ARL_TABLE_MCAST_DATA_STRUC +{ + unsigned char MACaddr[6]; /* MAC addr */ + unsigned int portMask:12;/* multicast port mask */ + unsigned char prio:1; /* priority */ + unsigned char gigPort:1; /* gigabit port 1 mask */ + unsigned char staticEn:1; /* static */ + unsigned char valid:1; /* valid */ + unsigned int vid:12; /* vlan id */ + unsigned int rsvd2:4; /* reserved */ +} ROBO_ARL_TABLE_MCAST_DATA_STRUC; +#define ROBO_MEM_ACCESS_CTRL 0x00 /* Memory Read/Write Control :32bit*/ +#define ROBO_MEM_ACCESS_DATA 0x04 /* Memory Read/Write Data:64bit*/ + +/* BCM5325m SWITCH PORT (0x10-18) REGISTER MAP: 8/16 bit regs */ +typedef struct _ROBO_MII_CTRL_STRUC +{ + unsigned char rsvd:8; /* reserved */ + unsigned char duplex:1; /* duplex mode */ + unsigned char restartAN:1;/* restart auto-negotiation */ + unsigned char rsvd1:1; /* reserved */ + unsigned char powerDown:1;/* power down */ + unsigned char ANenable:1; /* auto-negotiation enable */ + unsigned char speed:1; /* forced speed selection */ + unsigned char loopback:1; /* loopback */ + unsigned char reset:1; /* reset */ +} ROBO_MII_CTRL_STRUC; +typedef struct _ROBO_MII_AN_ADVERT_STRUC +{ + unsigned char selector:5; /* advertise selector field */ + unsigned char T10BaseT:1; /* advertise 10BaseT */ + unsigned char T10BaseTFull:1; /* advertise 10BaseT, full duplex */ + unsigned char T100BaseX:1; /* advertise 100BaseX */ + unsigned char T100BaseXFull:1;/* advertise 100BaseX full duplex */ + unsigned char noT4:1; /* do not advertise T4 */ + unsigned char pause:1; /* advertise pause for full duplex */ + unsigned char rsvd:2; /* reserved */ + unsigned char remoteFault:1; /* transmit remote fault */ + unsigned char rsvd1:1; /* reserved */ + unsigned char nextPage:1; /* nex page operation supported */ +} ROBO_MII_AN_ADVERT_STRUC; +#define ROBO_MII_CTRL 0x00 /* Port MII Control */ +#define ROBO_MII_STAT 0x02 /* Port MII Status */ +/* Fields of link status register */ +#define ROBO_MII_STAT_JABBER (1<<1) /* Jabber detected */ +#define ROBO_MII_STAT_LINK (1<<2) /* Link status */ + +#define ROBO_MII_PHYID_HI 0x04 /* Port PHY ID High */ +#define ROBO_MII_PHYID_LO 0x06 /* Port PHY ID Low */ +#define ROBO_MII_ANA_REG 0x08 /* MII Auto-Neg Advertisement */ +#define ROBO_MII_ANP_REG 0x0a /* MII Auto-Neg Partner Ability */ +#define ROBO_MII_AN_EXP_REG 0x0c /* MII Auto-Neg Expansion */ +#define ROBO_MII_AN_NP_REG 0x0e /* MII next page */ +#define ROBO_MII_ANP_NP_REG 0x10 /* MII Partner next page */ +#define ROBO_MII_100BX_AUX_CTRL 0x20 /* 100BASE-X Auxiliary Control */ +#define ROBO_MII_100BX_AUX_STAT 0x22 /* 100BASE-X Auxiliary Status */ +#define ROBO_MII_100BX_RCV_ERR_CTR 0x24 /* 100BASE-X Receive Error Ctr */ +#define ROBO_MII_100BX_RCV_FS_ERR 0x26 /* 100BASE-X Rcv False Sense Ctr */ +#define ROBO_MII_AUX_CTRL 0x30 /* Auxiliary Control/Status */ +/* Fields of Auxiliary control register */ +#define ROBO_MII_AUX_CTRL_FD (1<<0) /* Full duplex link detected*/ +#define ROBO_MII_AUX_CTRL_SP100 (1<<1) /* Speed 100 indication */ +#define ROBO_MII_AUX_STATUS 0x32 /* Aux Status Summary */ +#define ROBO_MII_CONN_STATUS 0x34 /* Aux Connection Status */ +#define ROBO_MII_AUX_MODE2 0x36 /* Aux Mode 2 */ +#define ROBO_MII_AUX_ERR_STATUS 0x38 /* Aux Error and General Status */ +#define ROBO_MII_AUX_MULTI_PHY 0x3c /* Aux Multiple PHY Register*/ +#define ROBO_MII_BROADCOM_TEST 0x3e /* Broadcom Test Register */ + + +/* BCM5325m PORT MIB REGISTERS (Pages 0x20-0x24,0x28) REGISTER MAP: 64/32 */ +/* Tranmit Statistics */ +#define ROBO_MIB_TX_OCTETS 0x00 /* 64b: TxOctets */ +#define ROBO_MIB_TX_DROP_PKTS 0x08 /* 32b: TxDropPkts */ +#define ROBO_MIB_TX_BC_PKTS 0x10 /* 32b: TxBroadcastPkts */ +#define ROBO_MIB_TX_MC_PKTS 0x14 /* 32b: TxMulticastPkts */ +#define ROBO_MIB_TX_UC_PKTS 0x18 /* 32b: TxUnicastPkts */ +#define ROBO_MIB_TX_COLLISIONS 0x1c /* 32b: TxCollisions */ +#define ROBO_MIB_TX_SINGLE_COLLISIONS 0x20 /* 32b: TxSingleCollision */ +#define ROBO_MIB_TX_MULTI_COLLISIONS 0x24 /* 32b: TxMultiCollision */ +#define ROBO_MIB_TX_DEFER_TX 0x28 /* 32b: TxDeferred Transmit */ +#define ROBO_MIB_TX_LATE_COLLISIONS 0x2c /* 32b: TxLateCollision */ +#define ROBO_MIB_EXCESS_COLLISIONS 0x30 /* 32b: TxExcessiveCollision*/ +#define ROBO_MIB_FRAME_IN_DISCARDS 0x34 /* 32b: TxFrameInDiscards */ +#define ROBO_MIB_TX_PAUSE_PKTS 0x38 /* 32b: TxPausePkts */ + +/* Receive Statistics */ +#define ROBO_MIB_RX_OCTETS 0x44 /* 64b: RxOctets */ +#define ROBO_MIB_RX_UNDER_SIZE_PKTS 0x4c /* 32b: RxUndersizePkts(runts)*/ +#define ROBO_MIB_RX_PAUSE_PKTS 0x50 /* 32b: RxPausePkts */ +#define ROBO_MIB_RX_PKTS_64 0x54 /* 32b: RxPkts64Octets */ +#define ROBO_MIB_RX_PKTS_65_TO_127 0x58 /* 32b: RxPkts64to127Octets*/ +#define ROBO_MIB_RX_PKTS_128_TO_255 0x5c /* 32b: RxPkts128to255Octets*/ +#define ROBO_MIB_RX_PKTS_256_TO_511 0x60 /* 32b: RxPkts256to511Octets*/ +#define ROBO_MIB_RX_PKTS_512_TO_1023 0x64 /* 32b: RxPkts512to1023Octets*/ +#define ROBO_MIB_RX_PKTS_1024_TO_1522 0x68 /* 32b: RxPkts1024to1522Octets*/ +#define ROBO_MIB_RX_OVER_SIZE_PKTS 0x6c /* 32b: RxOversizePkts*/ +#define ROBO_MIB_RX_JABBERS 0x70 /* 32b: RxJabbers*/ +#define ROBO_MIB_RX_ALIGNMENT_ERRORS 0x74 /* 32b: RxAlignmentErrors*/ +#define ROBO_MIB_RX_FCS_ERRORS 0x78 /* 32b: RxFCSErrors */ +#define ROBO_MIB_RX_GOOD_OCTETS 0x7c /* 32b: RxGoodOctets */ +#define ROBO_MIB_RX_DROP_PKTS 0x84 /* 32b: RxDropPkts */ +#define ROBO_MIB_RX_UC_PKTS 0x88 /* 32b: RxUnicastPkts */ +#define ROBO_MIB_RX_MC_PKTS 0x8c /* 32b: RxMulticastPkts */ +#define ROBO_MIB_RX_BC_PKTS 0x90 /* 32b: RxBroadcastPkts */ +#define ROBO_MIB_RX_SA_CHANGES 0x94 /* 32b: RxSAChanges */ +#define ROBO_MIB_RX_FRAGMENTS 0x98 /* 32b: RxFragments */ +#define ROBO_MIB_RX_EXCESS_SZ_DISC 0x9c /* 32b: RxExcessSizeDisc*/ +#define ROBO_MIB_RX_SYMBOL_ERROR 0xa0 /* 32b: RxSymbolError */ + +/* BCM5350 MIB Statistics */ +/* Group 0 */ +#define ROBO_MIB_TX_GOOD_PKTS 0x00 /* 16b: TxGoodPkts */ +#define ROBO_MIB_TX_UNICAST_PKTS 0x02 /* 16b: TxUnicastPkts */ +#define ROBO_MIB_RX_GOOD_PKTS 0x04 /* 16b: RxGoodPkts */ +#define ROBO_MIB_RX_GOOD_UNICAST_PKTS 0x06 /* 16b: RxGoodUnicastPkts */ +/* Group 1 */ +#define ROBO_MIB_TX_COLLISION 0x00 /* 16b: TxCollision */ +#define ROBO_MIB_TX_OCTETS_5350 0x02 /* 16b: TxOctets */ +#define ROBO_MIB_RX_FCS_ERRORS_5350 0x04 /* 16b: RxFCSErrors */ +#define ROBO_MIB_RX_GOOD_OCTETS_5350 0x06 /* 16b: RxGoodOctets */ + +/* BCM5325m QoS REGISTERS (Page 0x30) REGISTER MAP: 8/16 */ +#define ROBO_QOS_CTRL 0x00 /* 16b: QoS Control Register */ +#define ROBO_QOS_LOCAL_WEIGHT_CTRL 0x10 /* 8b: Local HQ/LQ Weight Register*/ +#define ROBO_QOS_CPU_WEIGHT_CTRL 0x12 /* 8b: CPU HQ/LQ Weight Register*/ +#define ROBO_QOS_PAUSE_ENA 0x13 /* 16b: Qos Pause Enable Register*/ +#define ROBO_QOS_PRIO_THRESHOLD 0x15 /* 8b: Priority Threshold Register*/ +#define ROBO_QOS_RESERVED 0x16 /* 8b: Qos Reserved Register */ + +/* BCM5325m VLAN REGISTERS (Page 0x34) REGISTER MAP: 8/16bit */ +typedef struct _ROBO_VLAN_CTRL0_STRUC +{ + unsigned char frameControlP:2; /* 802.1P frame control */ + unsigned char frameControlQ:2; /* 802.1Q frame control */ + unsigned char dropMissedVID:1; /* enable drop missed VID packet */ + unsigned char vidMacHash:1; /* VID_MAC hash enable */ + unsigned char vidMacCheck:1; /* VID_MAC check enable */ + unsigned char VLANen:1; /* 802.1Q VLAN enable */ +} ROBO_VLAN_CTRL0_STRUC; +#define VLAN_TABLE_WRITE 1 /* for read/write state in table access reg */ +#define VLAN_TABLE_READ 0 /* for read/write state in table access reg */ +#define VLAN_ID_HIGH_BITS 0 /* static high bits in table access reg */ +#define VLAN_ID_MAX 255 /* max VLAN id */ +#define VLAN_ID_MAX5350 15 /* max VLAN id (5350) */ +#define VLAN_ID_MASK VLAN_ID_MAX /* VLAN id mask */ +#ifdef BCM5380 +#define VLAN_UNTAG_SHIFT 13 /* for postioning untag bits in write reg */ +#define VLAN_VALID 0x4000000 /* valid bit in write reg */ +#else +#define VLAN_UNTAG_SHIFT 7 /* for postioning untag bits in write reg */ +#define VLAN_VALID 0x4000 /* valid bit in write reg */ +/* corresponding values for 5350 */ +#define VLAN_UNTAG_SHIFT_5350 6 /* for postioning untag bits in write reg */ +#define VLAN_VALID_5350 0x00100000 /* valid bit in write reg */ +#endif +typedef struct _ROBO_VLAN_TABLE_ACCESS_STRUC +{ + unsigned char VLANid:8; /* VLAN ID (low 8 bits) */ + unsigned char VLANidHi:4; /* VLAN ID (fixed upper portion) */ + unsigned char readWriteState:1; /* read/write state (write = 1) */ + volatile unsigned char readWriteEnable:1; /* table read/write enable */ + unsigned char rsvd:2; /* reserved */ +} ROBO_VLAN_TABLE_ACCESS_STRUC; +#ifdef BCM5380 +typedef struct _ROBO_VLAN_READ_WRITE_STRUC +{ + unsigned int VLANgroup:13;/* VLAN group mask */ + unsigned int VLANuntag:13;/* VLAN untag enable mask */ + unsigned char valid:1; /* valid */ + unsigned char rsvd:5; /* reserved */ +} ROBO_VLAN_READ_WRITE_STRUC; +#else +typedef struct _ROBO_VLAN_READ_WRITE_STRUC +{ + unsigned char VLANgroup:7; /* VLAN group mask */ + unsigned char VLANuntag:7; /* VLAN untag enable mask */ + unsigned char valid:1; /* valid */ + unsigned char rsvd:1; /* reserved */ +} ROBO_VLAN_READ_WRITE_STRUC; +typedef struct _ROBO_VLAN_READ_WRITE_STRUC_5350 +{ + unsigned char VLANgroup:6; /* VLAN group mask */ + unsigned char VLANuntag:6; /* VLAN untag enable mask */ + unsigned char highVID:8; /* upper bits of vid */ + unsigned char valid:1; /* valid */ + unsigned int rsvd:11; /* reserved */ +} ROBO_VLAN_READ_WRITE_STRUC_5350; +#endif +#define ROBO_VLAN_CTRL0 0x00 /* 8b: VLAN Control 0 Register */ +#define ROBO_VLAN_CTRL1 0x01 /* 8b: VLAN Control 1 Register */ +#define ROBO_VLAN_CTRL2 0x02 /* 8b: VLAN Control 2 Register */ +#define ROBO_VLAN_CTRL3 0x03 /* 8b: VLAN Control 3 Register */ +#define ROBO_VLAN_CTRL4 0x04 /* 8b: VLAN Control 4 Register */ +#define ROBO_VLAN_CTRL5 0x05 /* 8b: VLAN Control 5 Register */ +#define ROBO_VLAN_TABLE_ACCESS 0x08 /* 14b: VLAN Table Access Register */ +#define ROBO_VLAN_TABLE_ACCESS_5350 0x06 /* 14b: VLAN Table Access Register (5350) */ +#define ROBO_VLAN_WRITE 0x0a /* 15b: VLAN Write Register */ +#define ROBO_VLAN_WRITE_5350 0x08 /* 15b: VLAN Write Register (5350) */ +#define ROBO_VLAN_READ 0x0c /* 15b: VLAN Read Register */ +#define ROBO_VLAN_PORT0_DEF_TAG 0x10 /* 16b: VLAN Port 0 Default Tag Register */ +#define ROBO_VLAN_PORT1_DEF_TAG 0x12 /* 16b: VLAN Port 1 Default Tag Register */ +#define ROBO_VLAN_PORT2_DEF_TAG 0x14 /* 16b: VLAN Port 2 Default Tag Register */ +#define ROBO_VLAN_PORT3_DEF_TAG 0x16 /* 16b: VLAN Port 3 Default Tag Register */ +#define ROBO_VLAN_PORT4_DEF_TAG 0x18 /* 16b: VLAN Port 4 Default Tag Register */ +#define ROBO_VLAN_PORTMII_DEF_TAG 0x1a /* 16b: VLAN Port MII Default Tag Register */ +/* 5380 only */ +#define ROBO_VLAN_PORT5_DEF_TAG 0x1a /* 16b: VLAN Port 5 Default Tag Register */ +#define ROBO_VLAN_PORT6_DEF_TAG 0x1c /* 16b: VLAN Port 6 Default Tag Register */ +#define ROBO_VLAN_PORT7_DEF_TAG 0x1e /* 16b: VLAN Port 7 Default Tag Register */ + +/* obsolete */ +#define ROBO_VLAN_PORT0_CTRL 0x00 /* 16b: Port 0 VLAN Register */ +#define ROBO_VLAN_PORT1_CTRL 0x02 /* 16b: Port 1 VLAN Register */ +#define ROBO_VLAN_PORT2_CTRL 0x04 /* 16b: Port 2 VLAN Register */ +#define ROBO_VLAN_PORT3_CTRL 0x06 /* 16b: Port 3 VLAN Register */ +#define ROBO_VLAN_PORT4_CTRL 0x08 /* 16b: Port 4 VLAN Register */ +#define ROBO_VLAN_IM_PORT_CTRL 0x10 /* 16b: Inverse MII Port VLAN Reg */ +#define ROBO_VLAN_SMP_PORT_CTRL 0x12 /* 16b: Serial Port VLAN Register */ +#define ROBO_VLAN_PORTSPI_DEF_TAG 0x1c /* 16b: VLAN Port SPI Default Tag Register */ +#define ROBO_VLAN_PRIORITY_REMAP 0x20 /* 24b: VLAN Priority Re-Map Register */ + +#ifndef _CFE_ +#pragma pack() +#endif + + +#endif /* !__BCM535M_H_ */ + + + + + diff --git a/package/switch/src/gpio.h b/package/switch/src/gpio.h new file mode 100644 index 0000000000..800ae25a9f --- /dev/null +++ b/package/switch/src/gpio.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2006 OpenWrt.org + * + * This is free software, licensed under the GNU General Public License v2. + * See /LICENSE for more information. + */ + +#ifndef __GPIO_H +#define __GPIO_H + +#if defined(BCMGPIO2) + +#ifdef LINUX_2_4 +#define sbh bcm947xx_sbh +extern void *bcm947xx_sbh; +#else +extern void *sbh; +#endif + +extern __u32 sb_gpioin(void *sbh); +extern __u32 sb_gpiointpolarity(void *sbh, __u32 mask, __u32 val, __u8 prio); +extern __u32 sb_gpiointmask(void *sbh, __u32 mask, __u32 val, __u8 prio); +extern __u32 sb_gpioouten(void *sbh, __u32 mask, __u32 val, __u8 prio); +extern __u32 sb_gpioout(void *sbh, __u32 mask, __u32 val, __u8 prio); + +#define gpioin() sb_gpioin(sbh) +#define gpiointpolarity(mask,val) sb_gpiointpolarity(sbh, mask, val, 0) +#define gpiointmask(mask,val) sb_gpiointmask(sbh, mask, val, 0) +#define gpioouten(mask,val) sb_gpioouten(sbh, mask, val, 0) +#define gpioout(mask,val) sb_gpioout(sbh, mask, val, 0) + +#elif defined(BCMGPIO) + +#define sbh bcm947xx_sbh +extern void *bcm947xx_sbh; +extern __u32 sb_gpioin(void *sbh); +extern __u32 sb_gpiointpolarity(void *sbh, __u32 mask, __u32 val); +extern __u32 sb_gpiointmask(void *sbh, __u32 mask, __u32 val); +extern __u32 sb_gpioouten(void *sbh, __u32 mask, __u32 val); +extern __u32 sb_gpioout(void *sbh, __u32 mask, __u32 val); + +#define gpioin() sb_gpioin(sbh) +#define gpiointpolarity(mask,val) sb_gpiointpolarity(sbh, mask, val) +#define gpiointmask(mask,val) sb_gpiointmask(sbh, mask, val) +#define gpioouten(mask,val) sb_gpioouten(sbh, mask, val) +#define gpioout(mask,val) sb_gpioout(sbh, mask, val) + +#else +#error Unsupported/unknown GPIO configuration +#endif + +#endif /* __GPIO_H */ diff --git a/package/switch/src/switch-adm.c b/package/switch/src/switch-adm.c new file mode 100644 index 0000000000..083b6ebc47 --- /dev/null +++ b/package/switch/src/switch-adm.c @@ -0,0 +1,579 @@ +/* + * ADMTEK Adm6996 switch configuration module + * + * Copyright (C) 2005 Felix Fietkau <nbd@nbd.name> + * + * Partially based on Broadcom Home Networking Division 10/100 Mbit/s + * Ethernet Device Driver (from Montavista 2.4.20_mvl31 Kernel). + * Copyright (C) 2004 Broadcom Corporation + * + * adm_rreg function from adm6996 + * Copyright (C) 2004 Nikki Chumakov <nikki@gattaca.ru> + * + * 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 the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +#include <linux/config.h> +#include <linux/module.h> +#include <linux/init.h> +#include <linux/if.h> +#include <linux/if_arp.h> +#include <linux/sockios.h> +#include <linux/delay.h> +#include <asm/uaccess.h> + +#include "switch-core.h" +#include "gpio.h" + +#define DRIVER_NAME "adm6996" +#define DRIVER_VERSION "0.01" + +static int eecs = 0; +static int eesk = 0; +static int eedi = 0; +static int eerc = 0; +static int force = 0; + +MODULE_AUTHOR("Felix Fietkau <openwrt@nbd.name>"); +MODULE_LICENSE("GPL"); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,52) +module_param(eecs, int, 0); +module_param(eesk, int, 0); +module_param(eedi, int, 0); +module_param(eerc, int, 0); +module_param(force, int, 0); +#else +MODULE_PARM(eecs, "i"); +MODULE_PARM(eesk, "i"); +MODULE_PARM(eedi, "i"); +MODULE_PARM(eerc, "i"); +MODULE_PARM(force, "i"); +#endif + +/* Minimum timing constants */ +#define EECK_EDGE_TIME 3 /* 3us - max(adm 2.5us, 93c 1us) */ +#define EEDI_SETUP_TIME 1 /* 1us - max(adm 10ns, 93c 400ns) */ +#define EECS_SETUP_TIME 1 /* 1us - max(adm no, 93c 200ns) */ + +/* Handy macros for writing fixed length values */ +#define adm_write8(cs, b) { __u8 val = (__u8) (b); adm_write(cs, &val, sizeof(val)*8); } +#define adm_write16(cs, w) { __u16 val = hton16(w); adm_write(cs, (__u8 *)&val, sizeof(val)*8); } +#define adm_write32(cs, i) { uint32 val = hton32(i); adm_write(cs, (__u8 *)&val, sizeof(val)*8); } + +#define atoi(str) simple_strtoul(((str != NULL) ? str : ""), NULL, 0) + +#if defined(BCMGPIO2) || defined(BCMGPIO) +extern char *nvram_get(char *name); + +/* Return gpio pin number assigned to the named pin */ +/* +* Variable should be in format: +* +* gpio<N>=pin_name +* +* 'def_pin' is returned if there is no such variable found. +*/ +static unsigned int getgpiopin(char *pin_name, unsigned int def_pin) +{ + char name[] = "gpioXXXX"; + char *val; + unsigned int pin; + + /* Go thru all possibilities till a match in pin name */ + for (pin = 0; pin < 16; pin ++) { + sprintf(name, "gpio%d", pin); + val = nvram_get(name); + if (val && !strcmp(val, pin_name)) + return pin; + } + return def_pin; +} +#endif + + +static void adm_write(int cs, char *buf, unsigned int bits) +{ + int i, len = (bits + 7) / 8; + __u8 mask; + + gpioout(eecs, (cs ? eecs : 0)); + udelay(EECK_EDGE_TIME); + + /* Byte assemble from MSB to LSB */ + for (i = 0; i < len; i++) { + /* Bit bang from MSB to LSB */ + for (mask = 0x80; mask && bits > 0; mask >>= 1, bits --) { + /* Clock low */ + gpioout(eesk, 0); + udelay(EECK_EDGE_TIME); + + /* Output on rising edge */ + gpioout(eedi, ((mask & buf[i]) ? eedi : 0)); + udelay(EEDI_SETUP_TIME); + + /* Clock high */ + gpioout(eesk, eesk); + udelay(EECK_EDGE_TIME); + } + } + + /* Clock low */ + gpioout(eesk, 0); + udelay(EECK_EDGE_TIME); + + if (cs) + gpioout(eecs, 0); +} + + +static void adm_read(int cs, char *buf, unsigned int bits) +{ + int i, len = (bits + 7) / 8; + __u8 mask; + + gpioout(eecs, (cs ? eecs : 0)); + udelay(EECK_EDGE_TIME); + + /* Byte assemble from MSB to LSB */ + for (i = 0; i < len; i++) { + __u8 byte; + + /* Bit bang from MSB to LSB */ + for (mask = 0x80, byte = 0; mask && bits > 0; mask >>= 1, bits --) { + __u8 gp; + + /* Clock low */ + gpioout(eesk, 0); + udelay(EECK_EDGE_TIME); + + /* Input on rising edge */ + gp = gpioin(); + if (gp & eedi) + byte |= mask; + + /* Clock high */ + gpioout(eesk, eesk); + udelay(EECK_EDGE_TIME); + } + + *buf++ = byte; + } + + /* Clock low */ + gpioout(eesk, 0); + udelay(EECK_EDGE_TIME); + + if (cs) + gpioout(eecs, 0); +} + + +/* Enable outputs with specified value to the chip */ +static void adm_enout(__u8 pins, __u8 val) +{ + /* Prepare GPIO output value */ + gpioout(pins, val); + + /* Enable GPIO outputs */ + gpioouten(pins, pins); + udelay(EECK_EDGE_TIME); +} + + +/* Disable outputs to the chip */ +static void adm_disout(__u8 pins) +{ + /* Disable GPIO outputs */ + gpioouten(pins, 0); + udelay(EECK_EDGE_TIME); +} + + +/* Advance clock(s) */ +static void adm_adclk(int clocks) +{ + int i; + for (i = 0; i < clocks; i++) { + /* Clock high */ + gpioout(eesk, eesk); + udelay(EECK_EDGE_TIME); + + /* Clock low */ + gpioout(eesk, 0); + udelay(EECK_EDGE_TIME); + } +} + +static __u32 adm_rreg(__u8 table, __u8 addr) +{ + /* cmd: 01 10 T DD R RRRRRR */ + __u8 bits[6] = { + 0xFF, 0xFF, 0xFF, 0xFF, + (0x06 << 4) | ((table & 0x01) << 3 | (addr&64)>>6), + ((addr&62)<<2) + }; + + __u8 rbits[4]; + + /* Enable GPIO outputs with all pins to 0 */ + adm_enout((__u8)(eecs | eesk | eedi), 0); + + adm_write(0, bits, 46); + adm_disout((__u8)(eedi)); + adm_adclk(2); + adm_read (0, rbits, 32); + + /* Extra clock(s) required per datasheet */ + adm_adclk(2); + + /* Disable GPIO outputs */ + adm_disout((__u8)(eecs | eesk)); + + if (!table) /* EEPROM has 16-bit registers, but pumps out two registers in one request */ + return (addr & 0x01 ? (rbits[0]<<8) | rbits[1] : (rbits[2]<<8) | (rbits[3])); + else + return (rbits[0]<<24) | (rbits[1]<<16) | (rbits[2]<<8) | rbits[3]; +} + + + +/* Write chip configuration register */ +/* Follow 93c66 timing and chip's min EEPROM timing requirement */ +void +adm_wreg(__u8 addr, __u16 val) +{ + /* cmd(27bits): sb(1) + opc(01) + addr(bbbbbbbb) + data(bbbbbbbbbbbbbbbb) */ + __u8 bits[4] = { + (0x05 << 5) | (addr >> 3), + (addr << 5) | (__u8)(val >> 11), + (__u8)(val >> 3), + (__u8)(val << 5) + }; + + /* Enable GPIO outputs with all pins to 0 */ + adm_enout((__u8)(eecs | eesk | eedi), 0); + + /* Write cmd. Total 27 bits */ + adm_write(1, bits, 27); + + /* Extra clock(s) required per datasheet */ + adm_adclk(2); + + /* Disable GPIO outputs */ + adm_disout((__u8)(eecs | eesk | eedi)); +} + + +/* Port configuration registers */ +static int port_conf[] = { 0x01, 0x03, 0x05, 0x07, 0x08, 0x09 }; + +/* Bits in VLAN port mapping */ +static int vlan_ports[] = { 1 << 0, 1 << 2, 1 << 4, 1 << 6, 1 << 7, 1 << 8 }; + +static int handle_vlan_port_read(void *driver, char *buf, int nr) +{ + int ports, i, c, len = 0; + + if ((nr < 0) || (nr > 15)) + return 0; + + /* Get VLAN port map */ + ports = adm_rreg(0, 0x13 + nr); + + for (i = 0; i <= 5; i++) { + if (ports & vlan_ports[i]) { + c = adm_rreg(0, port_conf[i]); + + len += sprintf(buf + len, "%d", i); + if (c & (1 << 4)) { + buf[len++] = 't'; + if (((c & (0xf << 10)) >> 10) == nr) + buf[len++] = '*'; + } else if (i == 5) + buf[len++] = 'u'; + + buf[len++] = '\t'; + } + } + len += sprintf(buf + len, "\n"); + + return len; +} + +static int handle_vlan_port_write(void *driver, char *buf, int nr) +{ + int i, cfg, ports; + switch_driver *d = (switch_driver *) driver; + switch_vlan_config *c = switch_parse_vlan(d, buf); + + if (c == NULL) + return -1; + + ports = adm_rreg(0, 0x13 + nr); + for (i = 0; i < d->ports; i++) { + if (c->port & (1 << i)) { + ports |= vlan_ports[i]; + + cfg = adm_rreg(0, port_conf[i]); + + /* Tagging */ + if (c->untag & (1 << i)) + cfg &= ~(1 << 4); + else + cfg |= (1 << 4); + + if ((c->untag | c->pvid) & (1 << i)) { + cfg = (cfg & ~(0xf << 10)) | (nr << 10); + } + + adm_wreg(port_conf[i], (__u16) cfg); + } else { + ports &= ~(vlan_ports[i]); + } + } + adm_wreg(0x13 + nr, (__u16) ports); + + return 0; +} + +static int handle_port_enable_read(void *driver, char *buf, int nr) +{ + return sprintf(buf, "%d\n", ((adm_rreg(0, port_conf[nr]) & (1 << 5)) ? 0 : 1)); +} + +static int handle_port_enable_write(void *driver, char *buf, int nr) +{ + int reg = adm_rreg(0, port_conf[nr]); + + if (buf[0] == '0') + reg |= (1 << 5); + else if (buf[0] == '1') + reg &= ~(1 << 5); + else return -1; + + adm_wreg(port_conf[nr], (__u16) reg); + return 0; +} + +static int handle_port_media_read(void *driver, char *buf, int nr) +{ + int len; + int media = 0; + int reg = adm_rreg(0, port_conf[nr]); + + if (reg & (1 << 1)) + media |= SWITCH_MEDIA_AUTO; + if (reg & (1 << 2)) + media |= SWITCH_MEDIA_100; + if (reg & (1 << 3)) + media |= SWITCH_MEDIA_FD; + + len = switch_print_media(buf, media); + return len + sprintf(buf + len, "\n"); +} + +static int handle_port_media_write(void *driver, char *buf, int nr) +{ + int media = switch_parse_media(buf); + int reg = adm_rreg(0, port_conf[nr]); + + if (media < 0) + return -1; + + reg &= ~((1 << 1) | (1 << 2) | (1 << 3)); + if (media & SWITCH_MEDIA_AUTO) + reg |= 1 << 1; + if (media & SWITCH_MEDIA_100) + reg |= 1 << 2; + if (media & SWITCH_MEDIA_FD) + reg |= 1 << 3; + + adm_wreg(port_conf[nr], reg); + + return 0; +} + +static int handle_vlan_enable_read(void *driver, char *buf, int nr) +{ + return sprintf(buf, "%d\n", ((adm_rreg(0, 0x11) & (1 << 5)) ? 1 : 0)); +} + +static int handle_vlan_enable_write(void *driver, char *buf, int nr) +{ + int reg = adm_rreg(0, 0x11); + + if (buf[0] == '1') + reg |= (1 << 5); + else if (buf[0] == '0') + reg &= ~(1 << 5); + else return -1; + + adm_wreg(0x11, (__u16) reg); + return 0; +} + +static int handle_reset(void *driver, char *buf, int nr) +{ + int i; + u32 cfg; + + /* + * Reset sequence: RC high->low(100ms)->high(30ms) + * + * WAR: Certain boards don't have the correct power on + * reset logic therefore we must explicitly perform the + * sequence in software. + */ + if (eerc) { + /* Keep RC high for at least 20ms */ + adm_enout(eerc, eerc); + for (i = 0; i < 20; i ++) + udelay(1000); + /* Keep RC low for at least 100ms */ + adm_enout(eerc, 0); + for (i = 0; i < 100; i++) + udelay(1000); + /* Set default configuration */ + adm_enout((__u8)(eesk | eedi), eesk); + /* Keep RC high for at least 30ms */ + adm_enout(eerc, eerc); + for (i = 0; i < 30; i++) + udelay(1000); + /* Leave RC high and disable GPIO outputs */ + adm_disout((__u8)(eecs | eesk | eedi)); + + } + + /* set up initial configuration for cpu port */ + cfg = (0x8000 | /* Auto MDIX */ + (0xf << 10) | /* PVID */ + (1 << 4) | /* Tagging */ + 0xf); /* full duplex, 100Mbps, auto neg, flow ctrl */ + adm_wreg(port_conf[5], cfg); + + /* vlan mode select register (0x11): vlan on, mac clone */ + adm_wreg(0x11, 0xff30); + + return 0; +} + +static int handle_registers(void *driver, char *buf, int nr) +{ + int i, len = 0; + + for (i = 0; i <= 0x33; i++) { + len += sprintf(buf + len, "0x%02x: 0x%04x\n", i, adm_rreg(0, i)); + } + + return len; +} + +static int handle_counters(void *driver, char *buf, int nr) +{ + int i, len = 0; + + for (i = 0; i <= 0x3c; i++) { + len += sprintf(buf + len, "0x%02x: 0x%08x\n", i, adm_rreg(1, i)); + } + + return len; +} + +static int detect_adm(void) +{ + int ret = 0; + +#if defined(BCMGPIO2) || defined(BCMGPIO) + int boardflags = atoi(nvram_get("boardflags")); + + if ((boardflags & 0x80) || force) { + ret = 1; + + eecs = getgpiopin("adm_eecs", 2); + eesk = getgpiopin("adm_eesk", 3); + eedi = getgpiopin("adm_eedi", 4); + eerc = getgpiopin("adm_rc", 0); + + } else if ((strcmp(nvram_get("boardtype") ?: "", "bcm94710dev") == 0) && + (strncmp(nvram_get("boardnum") ?: "", "42", 2) == 0)) { + /* WRT54G v1.1 hack */ + eecs = 2; + eesk = 3; + eedi = 5; + + ret = 1; + } else + printk("BFL_ENETADM not set in boardflags. Use force=1 to ignore.\n"); + + if (eecs) + eecs = (1 << eecs); + if (eesk) + eesk = (1 << eesk); + if (eedi) + eedi = (1 << eedi); + if (eerc) + eerc = (1 << eerc); +#else + ret = 1; +#endif + + return ret; +} + +static int __init adm_init(void) +{ + switch_config cfg[] = { + {"registers", handle_registers, NULL}, + {"counters", handle_counters, NULL}, + {"reset", NULL, handle_reset}, + {"enable_vlan", handle_vlan_enable_read, handle_vlan_enable_write}, + {NULL, NULL, NULL} + }; + switch_config port[] = { + {"enable", handle_port_enable_read, handle_port_enable_write}, + {"media", handle_port_media_read, handle_port_media_write}, + {NULL, NULL, NULL} + }; + switch_config vlan[] = { + {"ports", handle_vlan_port_read, handle_vlan_port_write}, + {NULL, NULL, NULL} + }; + switch_driver driver = { + name: DRIVER_NAME, + version: DRIVER_VERSION, + interface: "eth0", + ports: 6, + cpuport: 5, + vlans: 16, + driver_handlers: cfg, + port_handlers: port, + vlan_handlers: vlan, + }; + + if (!detect_adm()) + return -ENODEV; + + return switch_register_driver(&driver); +} + +static void __exit adm_exit(void) +{ + switch_unregister_driver(DRIVER_NAME); +} + + +module_init(adm_init); +module_exit(adm_exit); diff --git a/package/switch/src/switch-core.c b/package/switch/src/switch-core.c new file mode 100644 index 0000000000..7bf705afe4 --- /dev/null +++ b/package/switch/src/switch-core.c @@ -0,0 +1,466 @@ +/* + * switch-core.c + * + * Copyright (C) 2005 Felix Fietkau <openwrt@nbd.name> + * + * 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 the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id: $ + * + * Basic doc of driver's /proc interface: + * /proc/switch/<interface>/ + * registers: read-only + * counters: read-only + * reset: write causes hardware reset + * enable_vlan: "0", "1" + * port/<port-number>/ + * enabled: "0", "1" + * media: "AUTO", "100FD", "100HD", "10FD", "10HD" + * vlan/<port-number>/ + * ports: same syntax as for nvram's vlan*ports (eg. "1 2 3 4 5*") + */ + +#include <linux/config.h> +#include <linux/module.h> +#include <linux/init.h> +#include <asm/uaccess.h> +#include <linux/proc_fs.h> +#include <linux/list.h> + +#include "switch-core.h" + +static int drv_num = 0; +static struct proc_dir_entry *switch_root; +switch_driver drivers; + +typedef struct { + struct list_head list; + struct proc_dir_entry *parent; + int nr; + void *driver; + switch_config handler; +} switch_proc_handler; + +typedef struct { + struct proc_dir_entry *driver_dir, *port_dir, *vlan_dir; + struct proc_dir_entry **ports, **vlans; + switch_proc_handler data; + int nr; +} switch_priv; + +static ssize_t switch_proc_read(struct file *file, char *buf, size_t count, loff_t *ppos); +static ssize_t switch_proc_write(struct file *file, const char *buf, size_t count, void *data); + +static struct file_operations switch_proc_fops = { + .read = (ssize_t (*) (struct file *, char __user *, size_t, loff_t *))switch_proc_read, + .write = (ssize_t (*) (struct file *, const char __user *, size_t, loff_t *))switch_proc_write +}; + +static ssize_t switch_proc_read(struct file *file, char *buf, size_t count, loff_t *ppos) +{ +#ifdef LINUX_2_4 + struct inode *inode = file->f_dentry->d_inode; + struct proc_dir_entry *dent = inode->u.generic_ip; +#else + struct proc_dir_entry *dent = PDE(file->f_dentry->d_inode); +#endif + char *page; + int len = 0; + + if ((page = kmalloc(SWITCH_MAX_BUFSZ, GFP_KERNEL)) == NULL) + return -ENOBUFS; + + if (dent->data != NULL) { + switch_proc_handler *handler = (switch_proc_handler *) dent->data; + if (handler->handler.read != NULL) + len += handler->handler.read(handler->driver, page + len, handler->nr); + } + len += 1; + + if (*ppos < len) { + len = min_t(int, len - *ppos, count); + if (copy_to_user(buf, (page + *ppos), len)) { + kfree(page); + return -EFAULT; + } + *ppos += len; + } else { + len = 0; + } + + return len; +} + + +static ssize_t switch_proc_write(struct file *file, const char *buf, size_t count, void *data) +{ +#ifdef LINUX_2_4 + struct inode *inode = file->f_dentry->d_inode; + struct proc_dir_entry *dent = inode->u.generic_ip; +#else + struct proc_dir_entry *dent = PDE(file->f_dentry->d_inode); +#endif + char *page; + int ret = -EINVAL; + + if ((page = kmalloc(count + 1, GFP_KERNEL)) == NULL) + return -ENOBUFS; + + if (copy_from_user(page, buf, count)) { + kfree(page); + return -EINVAL; + } + page[count] = 0; + + if (dent->data != NULL) { + switch_proc_handler *handler = (switch_proc_handler *) dent->data; + if (handler->handler.write != NULL) { + if ((ret = handler->handler.write(handler->driver, page, handler->nr)) >= 0) + ret = count; + } + } + + kfree(page); + return ret; +} + +static int handle_driver_name(void *driver, char *buf, int nr) +{ + char *name = ((switch_driver *) driver)->name; + return sprintf(buf, "%s\n", name); +} + +static int handle_driver_version(void *driver, char *buf, int nr) +{ + char *version = ((switch_driver *) driver)->version; + strcpy(buf, version); + return sprintf(buf, "%s\n", version); +} + +static void add_handler(switch_driver *driver, switch_config *handler, struct proc_dir_entry *parent, int nr) +{ + switch_priv *priv = (switch_priv *) driver->data; + struct proc_dir_entry *p; + int mode; + + switch_proc_handler *tmp; + tmp = (switch_proc_handler *) kmalloc(sizeof(switch_proc_handler), GFP_KERNEL); + INIT_LIST_HEAD(&tmp->list); + tmp->parent = parent; + tmp->nr = nr; + tmp->driver = driver; + memcpy(&tmp->handler, handler, sizeof(switch_config)); + list_add(&tmp->list, &priv->data.list); + + mode = 0; + if (handler->read != NULL) mode |= S_IRUSR; + if (handler->write != NULL) mode |= S_IWUSR; + + if ((p = create_proc_entry(handler->name, mode, parent)) != NULL) { + p->data = (void *) tmp; + p->proc_fops = &switch_proc_fops; + } +} + +static inline void add_handlers(switch_driver *driver, switch_config *handlers, struct proc_dir_entry *parent, int nr) +{ + int i; + + for (i = 0; handlers[i].name != NULL; i++) { + add_handler(driver, &(handlers[i]), parent, nr); + } +} + +static void remove_handlers(switch_priv *priv) +{ + struct list_head *pos, *q; + switch_proc_handler *tmp; + + list_for_each_safe(pos, q, &priv->data.list) { + tmp = list_entry(pos, switch_proc_handler, list); + list_del(pos); + remove_proc_entry(tmp->handler.name, tmp->parent); + kfree(tmp); + } +} + + +static void do_unregister(switch_driver *driver) +{ + char buf[4]; + int i; + switch_priv *priv = (switch_priv *) driver->data; + + remove_handlers(priv); + + for(i = 0; priv->ports[i] != NULL; i++) { + sprintf(buf, "%d", i); + remove_proc_entry(buf, priv->port_dir); + } + kfree(priv->ports); + remove_proc_entry("port", priv->driver_dir); + + for(i = 0; priv->vlans[i] != NULL; i++) { + sprintf(buf, "%d", i); + remove_proc_entry(buf, priv->vlan_dir); + } + kfree(priv->vlans); + remove_proc_entry("vlan", priv->driver_dir); + + remove_proc_entry(driver->interface, switch_root); + + if (priv->nr == (drv_num - 1)) + drv_num--; + + kfree(priv); +} + +switch_config global_driver_handlers[] = { + {"driver", handle_driver_name, NULL}, + {"version", handle_driver_version, NULL}, + {NULL, NULL, NULL} +}; + +static int do_register(switch_driver *driver) +{ + switch_priv *priv; + int i; + char buf[4]; + + if ((priv = kmalloc(sizeof(switch_priv), GFP_KERNEL)) == NULL) + return -ENOBUFS; + driver->data = (void *) priv; + + INIT_LIST_HEAD(&priv->data.list); + + priv->nr = drv_num++; + priv->driver_dir = proc_mkdir(driver->interface, switch_root); + if (driver->driver_handlers != NULL) { + add_handlers(driver, driver->driver_handlers, priv->driver_dir, 0); + add_handlers(driver, global_driver_handlers, priv->driver_dir, 0); + } + + priv->port_dir = proc_mkdir("port", priv->driver_dir); + priv->ports = kmalloc((driver->ports + 1) * sizeof(struct proc_dir_entry *), GFP_KERNEL); + for (i = 0; i < driver->ports; i++) { + sprintf(buf, "%d", i); + priv->ports[i] = proc_mkdir(buf, priv->port_dir); + if (driver->port_handlers != NULL) + add_handlers(driver, driver->port_handlers, priv->ports[i], i); + } + priv->ports[i] = NULL; + + priv->vlan_dir = proc_mkdir("vlan", priv->driver_dir); + priv->vlans = kmalloc((driver->vlans + 1) * sizeof(struct proc_dir_entry *), GFP_KERNEL); + for (i = 0; i < driver->vlans; i++) { + sprintf(buf, "%d", i); + priv->vlans[i] = proc_mkdir(buf, priv->vlan_dir); + if (driver->vlan_handlers != NULL) + add_handlers(driver, driver->vlan_handlers, priv->vlans[i], i); + } + priv->vlans[i] = NULL; + + + return 0; +} + +static inline int isspace(char c) { + switch(c) { + case ' ': + case 0x09: + case 0x0a: + case 0x0d: + return 1; + default: + return 0; + } +} + +#define toupper(c) (islower(c) ? ((c) ^ 0x20) : (c)) +#define islower(c) (((unsigned char)((c) - 'a')) < 26) + +int switch_parse_media(char *buf) +{ + char *str = buf; + while (*buf != 0) { + *buf = toupper(*buf); + buf++; + } + + if (strncmp(str, "AUTO", 4) == 0) + return SWITCH_MEDIA_AUTO; + else if (strncmp(str, "100FD", 5) == 0) + return SWITCH_MEDIA_100 | SWITCH_MEDIA_FD; + else if (strncmp(str, "100HD", 5) == 0) + return SWITCH_MEDIA_100; + else if (strncmp(str, "10FD", 4) == 0) + return SWITCH_MEDIA_FD; + else if (strncmp(str, "10HD", 4) == 0) + return 0; + else return -1; +} + +int switch_print_media(char *buf, int media) +{ + int len = 0; + + if (media & SWITCH_MEDIA_AUTO) + len = sprintf(buf, "Auto"); + else if (media == (SWITCH_MEDIA_100 | SWITCH_MEDIA_FD)) + len = sprintf(buf, "100FD"); + else if (media == SWITCH_MEDIA_100) + len = sprintf(buf, "100HD"); + else if (media == SWITCH_MEDIA_FD) + len = sprintf(buf, "10FD"); + else if (media == 0) + len = sprintf(buf, "10HD"); + else + len = sprintf(buf, "Invalid"); + + return len; +} + +switch_vlan_config *switch_parse_vlan(switch_driver *driver, char *buf) +{ + switch_vlan_config *c; + int j, u, p, s; + + c = kmalloc(sizeof(switch_vlan_config), GFP_KERNEL); + memset(c, 0, sizeof(switch_vlan_config)); + + while (isspace(*buf)) buf++; + j = 0; + while (*buf >= '0' && *buf <= '9') { + j *= 10; + j += *buf++ - '0'; + + u = ((j == driver->cpuport) ? 0 : 1); + p = 0; + s = !(*buf >= '0' && *buf <= '9'); + + if (s) { + while (s && !isspace(*buf) && (*buf != 0)) { + switch(*buf) { + case 'u': + u = 1; + break; + case 't': + u = 0; + break; + case '*': + p = 1; + break; + } + buf++; + } + c->port |= (1 << j); + if (u) + c->untag |= (1 << j); + if (p) + c->pvid |= (1 << j); + + j = 0; + } + + while (isspace(*buf)) buf++; + } + if (*buf != 0) return NULL; + + c->port &= (1 << driver->ports) - 1; + c->untag &= (1 << driver->ports) - 1; + c->pvid &= (1 << driver->ports) - 1; + + return c; +} + + +int switch_register_driver(switch_driver *driver) +{ + struct list_head *pos; + switch_driver *new; + int ret; + + list_for_each(pos, &drivers.list) { + if (strcmp(list_entry(pos, switch_driver, list)->name, driver->name) == 0) { + printk("Switch driver '%s' already exists in the kernel\n", driver->name); + return -EINVAL; + } + if (strcmp(list_entry(pos, switch_driver, list)->interface, driver->interface) == 0) { + printk("There is already a switch registered on the device '%s'\n", driver->interface); + return -EINVAL; + } + } + + new = kmalloc(sizeof(switch_driver), GFP_KERNEL); + memcpy(new, driver, sizeof(switch_driver)); + new->name = strdup(driver->name); + new->interface = strdup(driver->interface); + + if ((ret = do_register(new)) < 0) { + kfree(new->name); + kfree(new); + return ret; + } + INIT_LIST_HEAD(&new->list); + list_add(&new->list, &drivers.list); + + return 0; +} + +void switch_unregister_driver(char *name) { + struct list_head *pos, *q; + switch_driver *tmp; + + list_for_each_safe(pos, q, &drivers.list) { + tmp = list_entry(pos, switch_driver, list); + if (strcmp(tmp->name, name) == 0) { + do_unregister(tmp); + list_del(pos); + kfree(tmp->name); + kfree(tmp); + + return; + } + } +} + +static int __init switch_init(void) +{ + if ((switch_root = proc_mkdir("switch", NULL)) == NULL) { + printk("%s: proc_mkdir failed.\n", __FILE__); + return -ENODEV; + } + + INIT_LIST_HEAD(&drivers.list); + + return 0; +} + +static void __exit switch_exit(void) +{ + remove_proc_entry("switch", NULL); +} + +MODULE_AUTHOR("Felix Fietkau <openwrt@nbd.name>"); +MODULE_LICENSE("GPL"); + +EXPORT_SYMBOL(switch_register_driver); +EXPORT_SYMBOL(switch_unregister_driver); +EXPORT_SYMBOL(switch_parse_vlan); +EXPORT_SYMBOL(switch_parse_media); +EXPORT_SYMBOL(switch_print_media); + +module_init(switch_init); +module_exit(switch_exit); diff --git a/package/switch/src/switch-core.h b/package/switch/src/switch-core.h new file mode 100644 index 0000000000..5292469c01 --- /dev/null +++ b/package/switch/src/switch-core.h @@ -0,0 +1,59 @@ +#ifndef __SWITCH_CORE_H +#define __SWITCH_CORE_H + +#include <linux/version.h> +#include <linux/list.h> +#define SWITCH_MAX_BUFSZ 4096 + +#define SWITCH_MEDIA_AUTO 1 +#define SWITCH_MEDIA_100 2 +#define SWITCH_MEDIA_FD 4 + +#ifndef KERNEL_VERSION +#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) +#define LINUX_2_4 +#endif + +typedef int (*switch_handler)(void *driver, char *buf, int nr); + +typedef struct { + char *name; + switch_handler read, write; +} switch_config; + +typedef struct { + struct list_head list; + char *name; + char *version; + char *interface; + int cpuport; + int ports; + int vlans; + switch_config *driver_handlers, *port_handlers, *vlan_handlers; + void *data; + void *priv; +} switch_driver; + +typedef struct { + u32 port, untag, pvid; +} switch_vlan_config; + + +extern int switch_register_driver(switch_driver *driver); +extern void switch_unregister_driver(char *name); +extern switch_vlan_config *switch_parse_vlan(switch_driver *driver, char *buf); +extern int switch_parse_media(char *buf); +extern int switch_print_media(char *buf, int media); + +static inline char *strdup(char *str) +{ + char *new = kmalloc(strlen(str) + 1, GFP_KERNEL); + strcpy(new, str); + return new; +} + + +#endif diff --git a/package/switch/src/switch-robo.c b/package/switch/src/switch-robo.c new file mode 100644 index 0000000000..32cf2b3960 --- /dev/null +++ b/package/switch/src/switch-robo.c @@ -0,0 +1,484 @@ +/* + * Broadcom BCM5325E/536x switch configuration module + * + * Copyright (C) 2005 Felix Fietkau <nbd@nbd.name> + * Based on 'robocfg' by Oleg I. Vdovikin + * + * 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 the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +#include <linux/config.h> +#include <linux/module.h> +#include <linux/init.h> +#include <linux/if.h> +#include <linux/if_arp.h> +#include <linux/sockios.h> +#include <linux/ethtool.h> +#include <linux/mii.h> +#include <asm/uaccess.h> + +#include "switch-core.h" +#include "etc53xx.h" + +#define DRIVER_NAME "bcm53xx" +#define DRIVER_VERSION "0.01" + +#define ROBO_PHY_ADDR 0x1E /* robo switch phy address */ + +/* MII registers */ +#define REG_MII_PAGE 0x10 /* MII Page register */ +#define REG_MII_ADDR 0x11 /* MII Address register */ +#define REG_MII_DATA0 0x18 /* MII Data register 0 */ + +#define REG_MII_PAGE_ENABLE 1 +#define REG_MII_ADDR_WRITE 1 +#define REG_MII_ADDR_READ 2 + +/* Private et.o ioctls */ +#define SIOCGETCPHYRD (SIOCDEVPRIVATE + 9) +#define SIOCSETCPHYWR (SIOCDEVPRIVATE + 10) + +static char *device; +static int use_et = 0; +static int is_5350 = 0; +static struct ifreq ifr; +static struct net_device *dev; +static unsigned char port[6] = { 0, 1, 2, 3, 4, 8 }; + +static int do_ioctl(int cmd, void *buf) +{ + mm_segment_t old_fs = get_fs(); + int ret; + + if (buf != NULL) + ifr.ifr_data = (caddr_t) buf; + + set_fs(KERNEL_DS); + ret = dev->do_ioctl(dev, &ifr, cmd); + set_fs(old_fs); + + return ret; +} + +static u16 mdio_read(__u16 phy_id, __u8 reg) +{ + if (use_et) { + int args[2] = { reg }; + + if (phy_id != ROBO_PHY_ADDR) { + printk( + "Access to real 'phy' registers unavaliable.\n" + "Upgrade kernel driver.\n"); + + return 0xffff; + } + + + if (do_ioctl(SIOCGETCPHYRD, &args) < 0) { + printk("[%s:%d] SIOCGETCPHYRD failed!\n", __FILE__, __LINE__); + return 0xffff; + } + + return args[1]; + } else { + struct mii_ioctl_data *mii = (struct mii_ioctl_data *) &ifr.ifr_data; + mii->phy_id = phy_id; + mii->reg_num = reg; + + if (do_ioctl(SIOCGMIIREG, NULL) < 0) { + printk("[%s:%d] SIOCGMIIREG failed!\n", __FILE__, __LINE__); + + return 0xffff; + } + + return mii->val_out; + } +} + +static void mdio_write(__u16 phy_id, __u8 reg, __u16 val) +{ + if (use_et) { + int args[2] = { reg, val }; + + if (phy_id != ROBO_PHY_ADDR) { + printk( + "Access to real 'phy' registers unavaliable.\n" + "Upgrade kernel driver.\n"); + + return; + } + + if (do_ioctl(SIOCSETCPHYWR, args) < 0) { + printk("[%s:%d] SIOCGETCPHYWR failed!\n", __FILE__, __LINE__); + return; + } + } else { + struct mii_ioctl_data *mii = (struct mii_ioctl_data *)&ifr.ifr_data; + + mii->phy_id = phy_id; + mii->reg_num = reg; + mii->val_in = val; + + if (do_ioctl(SIOCSMIIREG, NULL) < 0) { + printk("[%s:%d] SIOCSMIIREG failed!\n", __FILE__, __LINE__); + return; + } + } +} + +static int robo_reg(__u8 page, __u8 reg, __u8 op) +{ + int i = 3; + + /* set page number */ + mdio_write(ROBO_PHY_ADDR, REG_MII_PAGE, + (page << 8) | REG_MII_PAGE_ENABLE); + + /* set register address */ + mdio_write(ROBO_PHY_ADDR, REG_MII_ADDR, + (reg << 8) | op); + + /* check if operation completed */ + while (i--) { + if ((mdio_read(ROBO_PHY_ADDR, REG_MII_ADDR) & 3) == 0) + return 0; + } + + printk("[%s:%d] timeout in robo_reg!\n", __FILE__, __LINE__); + + return 0; +} + +/* +static void robo_read(__u8 page, __u8 reg, __u16 *val, int count) +{ + int i; + + robo_reg(page, reg, REG_MII_ADDR_READ); + + for (i = 0; i < count; i++) + val[i] = mdio_read(ROBO_PHY_ADDR, REG_MII_DATA0 + i); +} +*/ + +static __u16 robo_read16(__u8 page, __u8 reg) +{ + robo_reg(page, reg, REG_MII_ADDR_READ); + + return mdio_read(ROBO_PHY_ADDR, REG_MII_DATA0); +} + +static __u32 robo_read32(__u8 page, __u8 reg) +{ + robo_reg(page, reg, REG_MII_ADDR_READ); + + return mdio_read(ROBO_PHY_ADDR, REG_MII_DATA0) + + (mdio_read(ROBO_PHY_ADDR, REG_MII_DATA0 + 1) << 16); +} + +static void robo_write16(__u8 page, __u8 reg, __u16 val16) +{ + /* write data */ + mdio_write(ROBO_PHY_ADDR, REG_MII_DATA0, val16); + + robo_reg(page, reg, REG_MII_ADDR_WRITE); +} + +static void robo_write32(__u8 page, __u8 reg, __u32 val32) +{ + /* write data */ + mdio_write(ROBO_PHY_ADDR, REG_MII_DATA0, val32 & 65535); + mdio_write(ROBO_PHY_ADDR, REG_MII_DATA0 + 1, val32 >> 16); + + robo_reg(page, reg, REG_MII_ADDR_WRITE); +} + +/* checks that attached switch is 5325E/5350 */ +static int robo_vlan5350(void) +{ + /* set vlan access id to 15 and read it back */ + __u16 val16 = 15; + robo_write16(ROBO_VLAN_PAGE, ROBO_VLAN_TABLE_ACCESS_5350, val16); + + /* 5365 will refuse this as it does not have this reg */ + return (robo_read16(ROBO_VLAN_PAGE, ROBO_VLAN_TABLE_ACCESS_5350) == val16); +} + + + +static int robo_probe(char *devname) +{ + struct ethtool_drvinfo info; +/* + int i; +*/ + __u32 phyid; + + printk("Probing device %s: ", devname); + strcpy(ifr.ifr_name, devname); + + if ((dev = dev_get_by_name(devname)) == NULL) { + printk("No such device\n"); + return 1; + } + + info.cmd = ETHTOOL_GDRVINFO; + if (do_ioctl(SIOCETHTOOL, (void *) &info) < 0) { + printk("SIOCETHTOOL: not supported\n"); + return 1; + } + + /* try access using MII ioctls - get phy address */ + if (do_ioctl(SIOCGMIIPHY, NULL) < 0) { + use_et = 1; + } else { + /* got phy address check for robo address */ + struct mii_ioctl_data *mii = (struct mii_ioctl_data *) &ifr.ifr_data; + if (mii->phy_id != ROBO_PHY_ADDR) { + printk("Invalid phy address (%d)\n", mii->phy_id); + return 1; + } + } + + phyid = mdio_read(ROBO_PHY_ADDR, 0x2) | + (mdio_read(ROBO_PHY_ADDR, 0x3) << 16); + + if (phyid == 0xffffffff || phyid == 0x55210022) { + printk("No Robo switch in managed mode found\n"); + return 1; + } + + is_5350 = robo_vlan5350(); + + printk("found!\n"); + return 0; +} + + +static int handle_vlan_port_read(void *driver, char *buf, int nr) +{ + __u16 val16; + int len = 0; + int j; + + val16 = (nr) /* vlan */ | (0 << 12) /* read */ | (1 << 13) /* enable */; + + if (is_5350) { + u32 val32; + robo_write16(ROBO_VLAN_PAGE, ROBO_VLAN_TABLE_ACCESS_5350, val16); + /* actual read */ + val32 = robo_read32(ROBO_VLAN_PAGE, ROBO_VLAN_READ); + if ((val32 & (1 << 20)) /* valid */) { + for (j = 0; j < 6; j++) { + if (val32 & (1 << j)) { + len += sprintf(buf + len, "%d", j); + if (val32 & (1 << (j + 6))) { + if (j == 5) buf[len++] = 'u'; + } else { + buf[len++] = 't'; + if (robo_read16(ROBO_VLAN_PAGE, ROBO_VLAN_PORT0_DEF_TAG + (j << 1)) == nr) + buf[len++] = '*'; + } + buf[len++] = '\t'; + } + } + len += sprintf(buf + len, "\n"); + } + } else { + robo_write16(ROBO_VLAN_PAGE, ROBO_VLAN_TABLE_ACCESS, val16); + /* actual read */ + val16 = robo_read16(ROBO_VLAN_PAGE, ROBO_VLAN_READ); + if ((val16 & (1 << 14)) /* valid */) { + for (j = 0; j < 6; j++) { + if (val16 & (1 << j)) { + len += sprintf(buf + len, "%d", j); + if (val16 & (1 << (j + 7))) { + if (j == 5) buf[len++] = 'u'; + } else { + buf[len++] = 't'; + if (robo_read16(ROBO_VLAN_PAGE, ROBO_VLAN_PORT0_DEF_TAG + (j << 1)) == nr) + buf[len++] = '*'; + } + buf[len++] = '\t'; + } + } + len += sprintf(buf + len, "\n"); + } + } + + buf[len] = '\0'; + + return len; +} + +static int handle_vlan_port_write(void *driver, char *buf, int nr) +{ + switch_driver *d = (switch_driver *) driver; + switch_vlan_config *c = switch_parse_vlan(d, buf); + int j; + __u16 val16; + + if (c == NULL) + return -EINVAL; + + for (j = 0; j < d->ports; j++) { + if ((c->untag | c->pvid) & (1 << j)) + /* change default vlan tag */ + robo_write16(ROBO_VLAN_PAGE, ROBO_VLAN_PORT0_DEF_TAG + (j << 1), nr); + } + + /* write config now */ + val16 = (nr) /* vlan */ | (1 << 12) /* write */ | (1 << 13) /* enable */; + if (is_5350) { + robo_write32(ROBO_VLAN_PAGE, ROBO_VLAN_WRITE_5350, + (1 << 20) /* valid */ | (c->untag << 6) | c->port); + robo_write16(ROBO_VLAN_PAGE, ROBO_VLAN_TABLE_ACCESS_5350, val16); + } else { + robo_write16(ROBO_VLAN_PAGE, ROBO_VLAN_WRITE, + (1 << 14) /* valid */ | (c->untag << 7) | c->port); + robo_write16(ROBO_VLAN_PAGE, ROBO_VLAN_TABLE_ACCESS, val16); + } + + return 0; +} + +#define set_switch(state) \ + robo_write16(ROBO_CTRL_PAGE, ROBO_SWITCH_MODE, (robo_read16(ROBO_CTRL_PAGE, ROBO_SWITCH_MODE) & ~2) | (state ? 2 : 0)); + +static int handle_enable_read(void *driver, char *buf, int nr) +{ + return sprintf(buf, "%d\n", (((robo_read16(ROBO_CTRL_PAGE, ROBO_SWITCH_MODE) & 2) == 2) ? 1 : 0)); +} + +static int handle_enable_write(void *driver, char *buf, int nr) +{ + set_switch(buf[0] == '1'); + + return 0; +} + +static int handle_enable_vlan_read(void *driver, char *buf, int nr) +{ + return sprintf(buf, "%d\n", (((robo_read16(ROBO_VLAN_PAGE, ROBO_VLAN_CTRL0) & (1 << 7)) == (1 << 7)) ? 1 : 0)); +} + +static int handle_enable_vlan_write(void *driver, char *buf, int nr) +{ + int disable = ((buf[0] != '1') ? 1 : 0); + + robo_write16(ROBO_VLAN_PAGE, ROBO_VLAN_CTRL0, disable ? 0 : + (1 << 7) /* 802.1Q VLAN */ | (3 << 5) /* mac check and hash */); + robo_write16(ROBO_VLAN_PAGE, ROBO_VLAN_CTRL1, disable ? 0 : + (1 << 1) | (1 << 2) | (1 << 3) /* RSV multicast */); + robo_write16(ROBO_VLAN_PAGE, ROBO_VLAN_CTRL4, disable ? 0 : + (1 << 6) /* drop invalid VID frames */); + robo_write16(ROBO_VLAN_PAGE, ROBO_VLAN_CTRL5, disable ? 0 : + (1 << 3) /* drop miss V table frames */); + + return 0; +} + +static int handle_reset(void *driver, char *buf, int nr) +{ + switch_driver *d = (switch_driver *) driver; + switch_vlan_config *c = switch_parse_vlan(d, buf); + int j; + __u16 val16; + + if (c == NULL) + return -EINVAL; + + /* disable switching */ + set_switch(0); + + /* reset vlans */ + for (j = 0; j <= (is_5350 ? VLAN_ID_MAX5350 : VLAN_ID_MAX); j++) { + /* write config now */ + val16 = (j) /* vlan */ | (1 << 12) /* write */ | (1 << 13) /* enable */; + if (is_5350) + robo_write32(ROBO_VLAN_PAGE, ROBO_VLAN_WRITE_5350, 0); + else + robo_write16(ROBO_VLAN_PAGE, ROBO_VLAN_WRITE, 0); + robo_write16(ROBO_VLAN_PAGE, (is_5350 ? ROBO_VLAN_TABLE_ACCESS_5350 : ROBO_VLAN_TABLE_ACCESS), val16); + } + + /* reset ports to a known good state */ + for (j = 0; j < d->ports; j++) { + robo_write16(ROBO_CTRL_PAGE, port[j], 0x0000); + robo_write16(ROBO_VLAN_PAGE, ROBO_VLAN_PORT0_DEF_TAG + (j << 1), 0); + } + + /* enable switching */ + set_switch(1); + + /* enable vlans */ + handle_enable_vlan_write(driver, "1", 0); + + return 0; +} + +static int __init robo_init(void) +{ + int notfound = 1; + + device = strdup("ethX"); + for (device[3] = '0'; (device[3] <= '3') && notfound; device[3]++) { + notfound = robo_probe(device); + } + device[3]--; + + if (notfound) { + kfree(device); + return -ENODEV; + } else { + switch_config cfg[] = { + {"enable", handle_enable_read, handle_enable_write}, + {"enable_vlan", handle_enable_vlan_read, handle_enable_vlan_write}, + {"reset", NULL, handle_reset}, + {NULL, NULL, NULL} + }; + switch_config vlan[] = { + {"ports", handle_vlan_port_read, handle_vlan_port_write}, + {NULL, NULL, NULL} + }; + switch_driver driver = { + name: DRIVER_NAME, + version: DRIVER_VERSION, + interface: device, + cpuport: 5, + ports: 6, + vlans: 16, + driver_handlers: cfg, + port_handlers: NULL, + vlan_handlers: vlan, + }; + + return switch_register_driver(&driver); + } +} + +static void __exit robo_exit(void) +{ + switch_unregister_driver(DRIVER_NAME); + kfree(device); +} + + +MODULE_AUTHOR("Felix Fietkau <openwrt@nbd.name>"); +MODULE_LICENSE("GPL"); + +module_init(robo_init); +module_exit(robo_exit); diff --git a/package/udev/Makefile b/package/udev/Makefile new file mode 100644 index 0000000000..830ea6a664 --- /dev/null +++ b/package/udev/Makefile @@ -0,0 +1,69 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=udev +PKG_VERSION:=077 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=ftp://ftp.kernel.org/pub/linux/utils/kernel/hotplug/ \ + http://ftp.kernel.org/pub/linux/utils/kernel/hotplug/ \ + ftp://ftp.de.kernel.org/pub/linux/utils/kernel/hotplug/ \ + http://ftp.de.kernel.org/pub/linux/utils/kernel/hotplug/ \ + ftp://ftp.fr.kernel.org/pub/linux/utils/kernel/hotplug/ \ + http://ftp.fr.kernel.org/pub/linux/utils/kernel/hotplug/ +PKG_MD5SUM:=61ec646daf7795e9777e8f33975408fe +PKG_CAT:=bzcat + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install + +include $(INCLUDE_DIR)/package.mk + +define Package/udev + SECTION:=utils + CATEGORY:=Utilities + DEPENDS:=@LINUX_2_6 + TITLE:=Dynamic device management subsystem + DESCRIPTION:=\ + udev provides a dynamic device directory containing only the files for \\\ + actually present devices. It creates or removes device node files in \\\ + the /dev directory, or it renames network interfaces. + URL:=http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + CROSS="$(TARGET_CROSS)" \ + STRIP="/bin/true" \ + OPTFLAGS="$(TARGET_CFLAGS)" \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + INSTALL="install -c" \ + all install +endef + +define Package/udev/install + install -d -m0775 $(1)/etc/udev + $(CP) $(PKG_INSTALL_DIR)/etc/udev/* $(1)/etc/udev/ + install -d -m0775 $(1)/lib/udev + install -d -m0775 $(1)/sbin/ + $(CP) $(PKG_INSTALL_DIR)/sbin/udev $(1)/sbin/ + $(CP) $(PKG_INSTALL_DIR)/sbin/udevcontrol $(1)/sbin/ + $(CP) $(PKG_INSTALL_DIR)/sbin/udevd $(1)/sbin/ + $(CP) $(PKG_INSTALL_DIR)/sbin/udevsend $(1)/sbin/ + $(CP) $(PKG_INSTALL_DIR)/sbin/udevstart $(1)/sbin/ + install -d -m0775 $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/udevinfo $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/udevtest $(1)/usr/bin/ + install -d -m0775 $(1)/usr/sbin/ + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/udevmonitor $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,udev)) diff --git a/package/udev/patches/01-no_debug.patch b/package/udev/patches/01-no_debug.patch new file mode 100644 index 0000000000..dcbc1051a9 --- /dev/null +++ b/package/udev/patches/01-no_debug.patch @@ -0,0 +1,21 @@ +diff -ruN udev-077-old/Makefile udev-077-new/Makefile +--- udev-077-old/Makefile 2005-12-04 03:01:48.000000000 +0100 ++++ udev-077-new/Makefile 2005-12-07 16:48:11.000000000 +0100 +@@ -136,7 +136,7 @@ + # check if compiler option is supported + cc-supports = ${shell if $(CC) ${1} -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi;} + +-CFLAGS = -g -Wall -pipe -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 ++CFLAGS = -Wall -pipe -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 + WARNINGS = -Wstrict-prototypes -Wsign-compare -Wshadow \ + -Wchar-subscripts -Wmissing-declarations -Wnested-externs \ + -Wpointer-arith -Wcast-align -Wsign-compare -Wmissing-prototypes +@@ -159,7 +159,7 @@ + + # if DEBUG is enabled, then we do not strip + ifeq ($(strip $(DEBUG)),true) +- CFLAGS += -DDEBUG ++ CFLAGS += -g -DDEBUG + STRIPCMD = + endif + diff --git a/package/ueagle-atm/Makefile b/package/ueagle-atm/Makefile new file mode 100644 index 0000000000..7e93fe1acd --- /dev/null +++ b/package/ueagle-atm/Makefile @@ -0,0 +1,55 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id: Makefile 2767 2005-12-25 02:10:14Z wbx $ + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=ueagle-atm +PKG_VERSION:=1.0d1 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://castet.matthieu.free.fr/eagle/release/ +PKG_MD5SUM:=5da1fceb15168f4c7ad407a3e38ddecb +PKG_CAT:=zcat + +PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install + +include $(INCLUDE_DIR)/package.mk + +#FIXME: add dependency on kmod-usb-core +define Package/kmod-ueagle-atm + SECTION:=kernel + CATEGORY:=Kernel drivers + DEPENDS:=@LINUX_2_6_BRCM @PACKAGE_KMOD_USB + TITLE:=Driver for Eagle 8051 based USB ADSL modems + URL:=http://www.eagle-usb.org/ + VERSION:=$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE) +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + ARCH="$(LINUX_KARCH)" \ + CROSS_COMPILE="$(TARGET_CROSS)" \ + TARGET="$(HAL_TARGET)" \ + KERNELDIR="$(LINUX_DIR)" \ + all +endef + +define Package/kmod-ueagle-atm/install + install -d -m0755 $(1)/lib/modules/$(LINUX_VERSION) + $(CP) $(PKG_BUILD_DIR)/driver/ueagle-atm.$(LINUX_KMOD_SUFFIX) \ + $(PKG_BUILD_DIR)/usbatm_iso/usbatm.$(LINUX_KMOD_SUFFIX) \ + $(1)/lib/modules/$(LINUX_VERSION)/ + install -d -m0755 $(1)/etc/modules.d + install -m0644 ./files/$(PKG_NAME).modules \ + $(1)/etc/modules.d/10-$(PKG_NAME) +endef + +$(eval $(call BuildPackage,kmod-ueagle-atm)) diff --git a/package/ueagle-atm/files/ueagle-atm.modules b/package/ueagle-atm/files/ueagle-atm.modules new file mode 100644 index 0000000000..6343f50e73 --- /dev/null +++ b/package/ueagle-atm/files/ueagle-atm.modules @@ -0,0 +1,2 @@ +usbatm +ueagle-atm diff --git a/package/ueagle-atm/patches/100-compile_fix.patch b/package/ueagle-atm/patches/100-compile_fix.patch new file mode 100644 index 0000000000..b8e70a2ff3 --- /dev/null +++ b/package/ueagle-atm/patches/100-compile_fix.patch @@ -0,0 +1,11 @@ +diff -Nur ueagle-atm-1.0d1/driver/ueagle.c ueagle-atm-1.0d1.patched/driver/ueagle.c +--- ueagle-atm-1.0d1/driver/ueagle.c 2005-11-19 18:36:04.000000000 +0100 ++++ ueagle-atm-1.0d1.patched/driver/ueagle.c 2006-03-29 02:03:43.000000000 +0200 +@@ -1652,7 +1652,6 @@ + * USB driver descriptor + */ + static struct usb_driver uea_driver = { +- .owner = THIS_MODULE, + .name = "ueagle-atm", + .id_table = uea_ids, + .probe = uea_probe, diff --git a/package/util-linux/Makefile b/package/util-linux/Makefile new file mode 100644 index 0000000000..8ca8052ea1 --- /dev/null +++ b/package/util-linux/Makefile @@ -0,0 +1,93 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id: Makefile 3822 2006-05-24 07:01:52Z nico $ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=util-linux +PKG_VERSION:=2.12r +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=ftp://ftp.kernel.org/pub/linux/utils/$(PKG_NAME)/ \ + http://ftp.kernel.org/pub/linux/utils/$(PKG_NAME)/ \ + ftp://ftp.de.kernel.org/pub/linux/utils/$(PKG_NAME)/ \ + http://ftp.de.kernel.org/pub/linux/utils/$(PKG_NAME)/ +PKG_MD5SUM:=c261230b27fc0fbcc287c76884caf2d3 +PKG_CAT:=zcat + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install + +include $(INCLUDE_DIR)/package.mk + +define Package/util-linux/Default + SECTION:=utils + CATEGORY:=Utilities + URL:=http://www.kernel.org/pub/linux/utils/util-linux/ +endef + +define Package/fdisk + $(call Package/util-linux/Default) + TITLE:=Partition table manipulation utility + DESCRIPTION:=\ + This package contains an utility for managing disk partition tables. + URL:=http://www.kernel.org/pub/linux/utils/util-linux/ +endef + +define Package/losetup + $(call Package/util-linux/Default) + TITLE:=Loopback devices setup and control utility + DESCRIPTION:=\ + This package contains an utility for managing loopback devices. +endef + +define Package/swap-utils + $(call Package/util-linux/Default) + TITLE:=Swap space management utilities + DESCRIPTION:=\ + This package contains a collection of tools for managing swap space: \\\ + - mkswap\\\ + - swapon\\\ + - swapoff +endef + +define Build/Compile + $(call Build/Compile/Default, \ + OPT="$(TARGET_CFLAGS)" \ + INSTALLSUID="install -m 4755" \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + all install \ + ) +endef + +define Package/Template + @if [ \! -f "$(PKG_INSTALL_DIR)/$(1)" ]; then \ + rm -f $(PKG_BUILD_DIR)/.built; \ + $(MAKE) $(PKG_BUILD_DIR)/.built; \ + fi + install -d -m0755 $(2) + $(CP) $(PKG_INSTALL_DIR)/$(1) $(2)/ +endef + +define Package/fdisk/install + $(call Package/Template,sbin/fdisk,$(1)/usr/sbin) +endef + +define Package/losetup/install + $(call Package/Template,sbin/losetup,$(1)/usr/sbin) +endef + +define Package/swap-utils/install + $(call Package/Template,sbin/mkswap,$(1)/usr/sbin) + $(call Package/Template,sbin/swapon,$(1)/usr/sbin) + $(call Package/Template,sbin/swapoff,$(1)/usr/sbin) +endef + +$(eval $(call BuildPackage,fdisk)) +$(eval $(call BuildPackage,losetup)) +$(eval $(call BuildPackage,swap-utils)) diff --git a/package/util-linux/patches/501-mconfig.patch b/package/util-linux/patches/501-mconfig.patch new file mode 100644 index 0000000000..67e6530de9 --- /dev/null +++ b/package/util-linux/patches/501-mconfig.patch @@ -0,0 +1,68 @@ +--- util-linux-2.12r-orig/MCONFIG 2004-12-13 00:15:48.000000000 +0100 ++++ util-linux-2.12r/MCONFIG 2005-10-03 17:54:15.945049312 +0200 +@@ -16,8 +16,8 @@ + # Select for ARCH one of intel, alpha, sparc, arm, m68k, mips + # Select for CPU i386 if the binaries must be able to run on an intel 386 + # (by default i486 code is generated, see below) +-CPU=$(shell uname -m) +-ARCH=$(shell echo $(CPU) | sed 's/i.86/intel/;s/arm.*/arm/') ++CPU= ++ARCH=mips + + # If HAVE_PAM is set to "yes", then login, chfn, chsh, and newgrp + # will use PAM for authentication. Additionally, passwd will not be +@@ -64,12 +64,12 @@ + # If HAVE_WRITE is set to "yes", then write will not be built or + # installed from the misc-utils subdirectory. + # (There is a network aware write in netwrite from NetKit 0.16 or later.) +-HAVE_WRITE=no ++HAVE_WRITE=yes + + # If HAVE_GETTY is set to "yes", then agetty will not be built or + # installed from the login-utils subdirectory. Note that agetty can + # co-exist with other gettys, so this option should never be used. +-HAVE_GETTY=no ++HAVE_GETTY=yes + + # If USE_TTY_GROUP is set to "yes", then wall and write will be installed + # setgid to the "tty" group, and mesg will only set the group write bit. +@@ -82,13 +82,13 @@ + # If HAVE_KILL is set to "yes", then kill will not be built or + # installed from the misc-utils subdirectory. + # (There is also a kill in the procps package.) +-HAVE_KILL=no ++HAVE_KILL=yes + + # If ALLOW_VCS_USE is set to "yes", then login will chown /dev/vcsN + # to the current user, allowing her to make a screendump and do other + # nifty things on the console, but also allowing him to keep an open + # file descriptor after logging out to trick the next user. +-ALLOW_VCS_USE=yes ++ALLOW_VCS_USE=no + + # If DO_STAT_MAIL is set to "yes", then login will stat() the mailbox + # and tell the user that she has new mail. This can hang the login if +@@ -102,19 +102,19 @@ + # If HAVE_SLN is set to "yes", then sln won't be installed + # (but the man page sln.8 will be installed anyway). + # sln also comes with libc and glibc. +-HAVE_SLN=no ++HAVE_SLN=yes + + # If HAVE_FDUTILS is set to "yes", then setfdprm won't be installed. +-HAVE_FDUTILS=no ++HAVE_FDUTILS=yes + + # If SILENT_PG is set to "yes", then pg will not ring the bell + # when an invalid key is pressed +-SILENT_PG=no ++SILENT_PG=yes + + # If configure decides that Native Language Support (NLS) is available, + # it sets MAY_ENABLE_NLS in defines.h. If you don't want NLS, set + # DISABLE_NLS to "yes". +-DISABLE_NLS=no ++DISABLE_NLS=yes + + # Different optimizations for different cpus. + # Before gcc 2.8.0 only -m486 diff --git a/package/util-linux/patches/601-util-linux-2.12r-umount-no-special.patch b/package/util-linux/patches/601-util-linux-2.12r-umount-no-special.patch new file mode 100644 index 0000000000..d79598fc84 --- /dev/null +++ b/package/util-linux/patches/601-util-linux-2.12r-umount-no-special.patch @@ -0,0 +1,11 @@ +--- util-linux-2.12r.old/mount/umount.c ++++ util-linux-2.12r/mount/umount.c +@@ -31,7 +31,7 @@ + #include <arpa/inet.h> + #endif + +-#if defined(MNT_FORCE) && !defined(__sparc__) && !defined(__arm__) ++#if defined(MNT_FORCE) + /* Interesting ... it seems libc knows about MNT_FORCE and presumably + about umount2 as well -- need not do anything */ + #else /* MNT_FORCE */ diff --git a/package/wireless-tools/Makefile b/package/wireless-tools/Makefile new file mode 100644 index 0000000000..c19ff7613d --- /dev/null +++ b/package/wireless-tools/Makefile @@ -0,0 +1,70 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=wireless-tools +PKG_VERSION:=28 +PKG_RELEASE:=1 + +PKG_SOURCE:=wireless_tools.$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux +PKG_MD5SUM:=599c94497f9c9073c7b052d3dcb7cd16 +PKG_CAT:=zcat + +PKG_BUILD_DIR:=$(BUILD_DIR)/wireless_tools.28 +PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install + +include $(INCLUDE_DIR)/package.mk + +define Package/wireless-tools + SECTION:=net + CATEGORY:=Base system + DEFAULT:=y + TITLE:=Tools for manipulating Linux Wireless Extensions + DESCRIPTION:=\ + This package contains a collection of tools for configuring wireless \\\ + adapters implementing the "Linux Wireless Extensions". + URL:=http://hplabs.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html +endef + +define Build/Compile + rm -rf $(PKG_INSTALL_DIR) + mkdir -p $(PKG_INSTALL_DIR) + $(MAKE) -C $(PKG_BUILD_DIR) \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS) -I." \ + libiw.so.28 iwmulticall + $(MAKE) -C $(PKG_BUILD_DIR) \ + PREFIX="$(PKG_INSTALL_DIR)" \ + INSTALL_DIR="$(PKG_INSTALL_DIR)/usr/sbin" \ + INSTALL_LIB="$(PKG_INSTALL_DIR)/usr/lib" \ + install-iwmulticall +endef + +define Build/InstallDev + mkdir -p $(STAGING_DIR)/usr/include + $(CP) $(PKG_BUILD_DIR)/{iwlib,wireless}.h $(STAGING_DIR)/usr/include/ + mkdir -p $(STAGING_DIR)/usr/lib + $(CP) $(PKG_BUILD_DIR)/libiw.so* $(STAGING_DIR)/usr/lib/ + ln -sf libiw.so.28 $(STAGING_DIR)/usr/lib/libiw.so +endef + +define Build/UninstallDev + rm -f $(STAGING_DIR)/usr/include/{iwlib,wireless}.h \ + $(STAGING_DIR)/usr/lib/libiw.so* +endef + +define Package/wireless-tools/install + install -d -m0755 $(1)/usr/lib + install -m0755 $(PKG_BUILD_DIR)/libiw.so.28 $(1)/usr/lib/ + install -d -m0755 $(1)/usr/sbin + install -m0755 $(PKG_INSTALL_DIR)/usr/sbin/iw{config,getid,list,priv,spy} $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,wireless-tools)) diff --git a/package/wireless-tools/patches/debian-2.patch b/package/wireless-tools/patches/debian-2.patch new file mode 100644 index 0000000000..ba8755b705 --- /dev/null +++ b/package/wireless-tools/patches/debian-2.patch @@ -0,0 +1,35 @@ +--- wireless-tools-27.orig/iwlib.c ++++ wireless-tools-27/iwlib.c +@@ -622,6 +622,7 @@ + { + struct iwreq wrq; + ++ memset((char *) &wrq, 0, sizeof(struct iwreq)); + memset((char *) info, 0, sizeof(struct wireless_config)); + + /* Get wireless name */ +--- wireless-tools-27.orig/Makefile ++++ wireless-tools-27/Makefile +@@ -64,8 +64,8 @@ + # Install directories + INSTALL_DIR= $(PREFIX)/sbin/ + INSTALL_LIB= $(PREFIX)/lib/ +-INSTALL_INC= $(PREFIX)/include/ +-INSTALL_MAN= $(PREFIX)/man/ ++INSTALL_INC= $(PREFIX)/usr/include/ ++INSTALL_MAN= $(PREFIX)/usr/share/man/ + + # Various commands + RM = rm -f +@@ -81,9 +81,9 @@ + endif + + # Other flags +-CFLAGS=-Os -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow \ ++#CFLAGS=-Os -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow \ + -Wpointer-arith -Wcast-qual -Winline -I. +-#CFLAGS=-O2 -W -Wall -Wstrict-prototypes -I. ++CFLAGS=-O2 -W -Wall -Wstrict-prototypes -I. + DEPFLAGS=-MMD + XCFLAGS=$(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS) $(WELIB_FLAG) + PICFLAG=-fPIC diff --git a/package/wlcompat/Makefile b/package/wlcompat/Makefile new file mode 100644 index 0000000000..fc66c90f50 --- /dev/null +++ b/package/wlcompat/Makefile @@ -0,0 +1,77 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=kmod-wlcompat +PKG_RELEASE:=4 + +PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/kmod-wlcompat/Default + SECTION:=kernel + CATEGORY:=Kernel drivers + DEPENDS:=kmod-brcm-wl + TITLE:=Broadcom wl wrapper module + DESCRIPTION:=\ + This package contains a wrapper module, that provides Wireless Extension \\\ + support for the proprietary Broadcom wl module. + VERSION:=$(LINUX_VERSION)+$(BOARD)-$(PKG_RELEASE) +endef + +define Package/kmod-wlcompat + $(call Package/kmod-wlcompat/Default) + DEFAULT:=y +endef + +define Package/kmod-wlcompat-debug + $(call Package/kmod-wlcompat/Default) + TITLE+= (debug) + DESCRIPTION+=\\\ + \\\ + This is a debugging version. +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) + $(CP) ./src/* $(PKG_BUILD_DIR)/ +endef + +define Build/Compile + $(MAKE) -C "$(LINUX_DIR)" \ + CROSS_COMPILE="$(TARGET_CROSS)" \ + ARCH="$(LINUX_KARCH)" \ + SUBDIRS="$(PKG_BUILD_DIR)" \ + EXTRA_CFLAGS="-DDEBUG -I$(LINUX_DIR)/arch/mips/bcm947xx/include -I$(PKG_BUILD_DIR)/include" \ + modules + mv $(PKG_BUILD_DIR)/wlcompat.o $(PKG_BUILD_DIR)/wlcompat-debug.o + $(MAKE) -C "$(LINUX_DIR)" \ + CROSS_COMPILE="$(TARGET_CROSS)" \ + ARCH="$(LINUX_KARCH)" \ + SUBDIRS="$(PKG_BUILD_DIR)" \ + EXTRA_CFLAGS="-I$(LINUX_DIR)/arch/mips/bcm947xx/include -I$(PKG_BUILD_DIR)/include" \ + modules +endef + +define Package/kmod-wlcompat/install + install -d -m0755 $(1)/lib/modules/$(LINUX_VERSION) + $(CP) $(PKG_BUILD_DIR)/wlcompat.o $(1)/lib/modules/$(LINUX_VERSION)/ + install -d -m0755 $(1)/etc/modules.d + echo "wlcompat" > $(1)/etc/modules.d/30-wlcompat +endef + +define Package/kmod-wlcompat-debug/install + install -d -m0755 $(1)/lib/modules/$(LINUX_VERSION) + $(CP) $(PKG_BUILD_DIR)/wlcompat-debug.o $(1)/lib/modules/$(LINUX_VERSION)/ +endef + +$(eval $(call BuildPackage,kmod-wlcompat)) +$(eval $(call BuildPackage,kmod-wlcompat-debug)) diff --git a/package/wlcompat/src/Makefile b/package/wlcompat/src/Makefile new file mode 100644 index 0000000000..4290d9a33a --- /dev/null +++ b/package/wlcompat/src/Makefile @@ -0,0 +1,19 @@ +# $Id$ +# +# Makefile for diag driver +# +# Copyright (C) 2005 Felix Fietkau <nbd@openwrt.org> +# +# 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 the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# + +obj-m := wlcompat.o + +ifeq ($(MAKING_MODULES),1) +export-objs := wlcompat.o + +-include $(TOPDIR)/Rules.make +endif diff --git a/package/wlcompat/src/include/bcmnvram.h b/package/wlcompat/src/include/bcmnvram.h new file mode 100644 index 0000000000..3c452634e8 --- /dev/null +++ b/package/wlcompat/src/include/bcmnvram.h @@ -0,0 +1,148 @@ +/* + * NVRAM variable manipulation + * + * Copyright 2004, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * + * $Id$ + */ + +#ifndef _bcmnvram_h_ +#define _bcmnvram_h_ + +#ifndef _LANGUAGE_ASSEMBLY + +#include <typedefs.h> + +struct nvram_header { + uint32 magic; + uint32 len; + uint32 crc_ver_init; /* 0:7 crc, 8:15 ver, 16:27 init, mem. test 28, 29-31 reserved */ + uint32 config_refresh; /* 0:15 config, 16:31 refresh */ + uint32 config_ncdl; /* ncdl values for memc */ +}; + +struct nvram_tuple { + char *name; + char *value; + struct nvram_tuple *next; +}; + +/* + * Initialize NVRAM access. May be unnecessary or undefined on certain + * platforms. + */ +extern int nvram_init(void *sbh); + +/* + * Disable NVRAM access. May be unnecessary or undefined on certain + * platforms. + */ +extern void nvram_exit(void); + +/* + * Get the value of an NVRAM variable. The pointer returned may be + * invalid after a set. + * @param name name of variable to get + * @return value of variable or NULL if undefined + */ +extern char * nvram_get(const char *name); + +/* + * Get the value of an NVRAM variable. + * @param name name of variable to get + * @return value of variable or NUL if undefined + */ +#define nvram_safe_get(name) (nvram_get(name) ? : "") + +#define nvram_safe_unset(name) ({ \ + if(nvram_get(name)) \ + nvram_unset(name); \ +}) + +#define nvram_safe_set(name, value) ({ \ + if(!nvram_get(name) || strcmp(nvram_get(name), value)) \ + nvram_set(name, value); \ +}) + +/* + * Match an NVRAM variable. + * @param name name of variable to match + * @param match value to compare against value of variable + * @return TRUE if variable is defined and its value is string equal + * to match or FALSE otherwise + */ +static INLINE int +nvram_match(char *name, char *match) { + const char *value = nvram_get(name); + return (value && !strcmp(value, match)); +} + +/* + * Inversely match an NVRAM variable. + * @param name name of variable to match + * @param match value to compare against value of variable + * @return TRUE if variable is defined and its value is not string + * equal to invmatch or FALSE otherwise + */ +static INLINE int +nvram_invmatch(char *name, char *invmatch) { + const char *value = nvram_get(name); + return (value && strcmp(value, invmatch)); +} + +/* + * Set the value of an NVRAM variable. The name and value strings are + * copied into private storage. Pointers to previously set values + * may become invalid. The new value may be immediately + * retrieved but will not be permanently stored until a commit. + * @param name name of variable to set + * @param value value of variable + * @return 0 on success and errno on failure + */ +extern int nvram_set(const char *name, const char *value); + +/* + * Unset an NVRAM variable. Pointers to previously set values + * remain valid until a set. + * @param name name of variable to unset + * @return 0 on success and errno on failure + * NOTE: use nvram_commit to commit this change to flash. + */ +extern int nvram_unset(const char *name); + +/* + * Commit NVRAM variables to permanent storage. All pointers to values + * may be invalid after a commit. + * NVRAM values are undefined after a commit. + * @return 0 on success and errno on failure + */ +extern int nvram_commit(void); + +/* + * Get all NVRAM variables (format name=value\0 ... \0\0). + * @param buf buffer to store variables + * @param count size of buffer in bytes + * @return 0 on success and errno on failure + */ +extern int nvram_getall(char *buf, int count); + +extern int file2nvram(char *filename, char *varname); +extern int nvram2file(char *varname, char *filename); + +#endif /* _LANGUAGE_ASSEMBLY */ + +#define NVRAM_MAGIC 0x48534C46 /* 'FLSH' */ +#define NVRAM_VERSION 1 +#define NVRAM_HEADER_SIZE 20 +#define NVRAM_SPACE 0x8000 +#define FLASH_BASE 0xbfc00000 /* Extif core */ +#define FLASH_MIN 0x00100000 /* Minimum flash size */ +#define FLASH_MAX 0x00400000 /* Maximum flash size with extif */ + +#endif /* _bcmnvram_h_ */ diff --git a/package/wlcompat/src/include/bcmutils.h b/package/wlcompat/src/include/bcmutils.h new file mode 100644 index 0000000000..05ad41d9d8 --- /dev/null +++ b/package/wlcompat/src/include/bcmutils.h @@ -0,0 +1,157 @@ +/* + * Misc useful os-independent macros and functions. + * + * Copyright 2004, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * $Id$ + */ + +#ifndef _bcmutils_h_ +#define _bcmutils_h_ + +#ifndef MIN +#define MIN(a, b) (((a)<(b))?(a):(b)) +#endif + +#ifndef MAX +#define MAX(a, b) (((a)>(b))?(a):(b)) +#endif + +#define CEIL(x, y) (((x) + ((y)-1)) / (y)) +#define ROUNDUP(x, y) ((((ulong)(x)+((y)-1))/(y))*(y)) +#define ISALIGNED(a, x) (((uint)(a) & ((x)-1)) == 0) +#define ISPOWEROF2(x) ((((x)-1)&(x))==0) +#define OFFSETOF(type, member) ((uint) &((type *)0)->member) +#define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0])) + +/* bit map related macros */ +#ifndef setbit +#define NBBY 8 /* 8 bits per byte */ +#define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) +#define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY))) +#define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY))) +#define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) +#endif + +#define NBITS(type) (sizeof (type) * 8) + +#define _BCM_U 0x01 /* upper */ +#define _BCM_L 0x02 /* lower */ +#define _BCM_D 0x04 /* digit */ +#define _BCM_C 0x08 /* cntrl */ +#define _BCM_P 0x10 /* punct */ +#define _BCM_S 0x20 /* white space (space/lf/tab) */ +#define _BCM_X 0x40 /* hex digit */ +#define _BCM_SP 0x80 /* hard space (0x20) */ + +extern unsigned char bcm_ctype[]; +#define bcm_ismask(x) (bcm_ctype[(int)(unsigned char)(x)]) + +#define bcm_isalnum(c) ((bcm_ismask(c)&(_BCM_U|_BCM_L|_BCM_D)) != 0) +#define bcm_isalpha(c) ((bcm_ismask(c)&(_BCM_U|_BCM_L)) != 0) +#define bcm_iscntrl(c) ((bcm_ismask(c)&(_BCM_C)) != 0) +#define bcm_isdigit(c) ((bcm_ismask(c)&(_BCM_D)) != 0) +#define bcm_isgraph(c) ((bcm_ismask(c)&(_BCM_P|_BCM_U|_BCM_L|_BCM_D)) != 0) +#define bcm_islower(c) ((bcm_ismask(c)&(_BCM_L)) != 0) +#define bcm_isprint(c) ((bcm_ismask(c)&(_BCM_P|_BCM_U|_BCM_L|_BCM_D|_BCM_SP)) != 0) +#define bcm_ispunct(c) ((bcm_ismask(c)&(_BCM_P)) != 0) +#define bcm_isspace(c) ((bcm_ismask(c)&(_BCM_S)) != 0) +#define bcm_isupper(c) ((bcm_ismask(c)&(_BCM_U)) != 0) +#define bcm_isxdigit(c) ((bcm_ismask(c)&(_BCM_D|_BCM_X)) != 0) + +/* + * Spin at most 'us' microseconds while 'exp' is true. + * Caller should explicitly test 'exp' when this completes + * and take appropriate error action if 'exp' is still true. + */ +#define SPINWAIT(exp, us) { \ + uint countdown = (us) + 9; \ + while ((exp) && (countdown >= 10)) {\ + OSL_DELAY(10); \ + countdown -= 10; \ + } \ +} + +/* generic osl packet queue */ +struct pktq { + void *head; /* first packet to dequeue */ + void *tail; /* last packet to dequeue */ + uint len; /* number of queued packets */ + uint maxlen; /* maximum number of queued packets */ + bool priority; /* enqueue by packet priority */ +}; +#define DEFAULT_QLEN 128 + +#define pktq_len(q) ((q)->len) +#define pktq_avail(q) ((q)->maxlen - (q)->len) +#define pktq_head(q) ((q)->head) +#define pktq_full(q) ((q)->len >= (q)->maxlen) + +/* crc defines */ +#define CRC8_INIT_VALUE 0xff /* Initial CRC8 checksum value */ +#define CRC8_GOOD_VALUE 0x9f /* Good final CRC8 checksum value */ +#define CRC16_INIT_VALUE 0xffff /* Initial CRC16 checksum value */ +#define CRC16_GOOD_VALUE 0xf0b8 /* Good final CRC16 checksum value */ +#define CRC32_INIT_VALUE 0xffffffff /* Initial CRC32 checksum value */ +#define CRC32_GOOD_VALUE 0xdebb20e3 /* Good final CRC32 checksum value */ + +/* tag_ID/length/value_buffer tuple */ +typedef struct bcm_tlv { + uint8 id; + uint8 len; + uint8 data[1]; +} bcm_tlv_t; + +/* Check that bcm_tlv_t fits into the given buflen */ +#define bcm_valid_tlv(elt, buflen) ((buflen) >= 2 && (buflen) >= 2 + (elt)->len) + +/* buffer length for ethernet address from bcm_ether_ntoa() */ +#define ETHER_ADDR_STR_LEN 18 + +/* +* load 32-bit value from unaligned byte array +*/ +#ifdef IL_BIGENDIAN +#define load32_ua(a) ((((uint8 *)(a))[0] << 24) + (((uint8 *)(a))[1] << 16) + \ + (((uint8 *)(a))[2] << 8) + ((uint8 *)(a))[3]) +#else +#define load32_ua(a) ((((uint8 *)(a))[3] << 24) + (((uint8 *)(a))[2] << 16) + \ + (((uint8 *)(a))[1] << 8) + ((uint8 *)(a))[0]) +#endif + +/* externs */ +extern uint bcm_atoi(char *s); +extern uchar bcm_toupper(uchar c); +extern ulong bcm_strtoul(char *cp, char **endp, uint base); +extern void deadbeef(char *p, uint len); +extern void prhex(char *msg, uchar *buf, uint len); +extern void prpkt(char *msg, void *drv, void *p0); +extern uint pktcopy(void *drv, void *p, uint offset, int len, uchar *buf); +extern uint pkttotlen(void *drv, void *); +extern uchar *bcm_ether_ntoa(char *ea, char *buf); +extern int bcm_ether_atoe(char *p, char *ea); +extern void bcm_mdelay(uint ms); +extern char *getvar(char *vars, char *name); +extern int getintvar(char *vars, char *name); +extern char *bcmstrstr(char *haystack, char *needle); + +extern uint8 crc8(uint8 *p, uint nbytes, uint8 crc); +extern uint16 crc16(uint8 *p, uint nbytes, uint16 crc); +extern uint32 crc32(uint8 *p, uint nbytes, uint32 crc); +extern bcm_tlv_t *bcm_next_tlv(bcm_tlv_t *elt, int *buflen); +extern bcm_tlv_t *bcm_parse_tlvs(void *buf, int buflen, uint key); +extern bcm_tlv_t *bcm_parse_ordered_tlvs(void *buf, int buflen, uint key); +extern void pktq_init(struct pktq *q, uint maxlen, bool priority); +extern bool pktenq(struct pktq *q, void *p, bool lifo); +extern void *pktdeq(struct pktq *q); + +#define bcmlog(fmt, a1, a2) +#define bcmdumplog(buf, size) *buf = '\0' +#define bcmdumplogent(buf, idx) -1 + +#endif /* _bcmutils_h_ */ diff --git a/package/wlcompat/src/include/cy_conf.h b/package/wlcompat/src/include/cy_conf.h new file mode 100644 index 0000000000..dbe387b83b --- /dev/null +++ b/package/wlcompat/src/include/cy_conf.h @@ -0,0 +1,69 @@ + +#define DNSMASQ_SUPPORT 1 +#define CONFIG_DNSMASQ y +#define UDHCPD_SUPPORT 1 +#define CONFIG_UDHCPD y +#define UDHCPC_SUPPORT 1 +#define CONFIG_UDHCPC y +#define PPPOE_SUPPORT 1 +#define CONFIG_PPPOE y +#define PPTP_SUPPORT 1 +#define CONFIG_PPTP y +#define L2TP_SUPPORT 1 +#define CONFIG_L2TP y +#define PPPD_SUPPORT 1 +#define CONFIG_PPPD y +#define ZEBRA_SUPPORT 1 +#define CONFIG_ZEBRA y +#define TFTPD_SUPPORT 1 +#define CONFIG_TFTPD y +#define DDNS_SUPPORT 1 +#define CONFIG_DDNS y +#define CRON_SUPPORT 1 +#define CONFIG_CRON y +#define HTTPD_SUPPORT 1 +#define CONFIG_HTTPD y +#define GET_POST_SUPPORT 1 +#define CONFIG_GET_POST y + +#if 1 +#define HEARTBEAT_SUPPORT 1 +#define CONFIG_HEARTBEAT y +#define MULTICAST_SUPPORT 1 +#define CONFIG_MULTICAST y +#define SETUP_WIZARD_SUPPORT 1 +#define CONFIG_SETUP_WIZARD y +#define PARENTAL_CONTROL_SUPPORT 1 +#define CONFIG_PARENTAL_CONTROL y +#define HTTPS_SUPPORT 1 +#define CONFIG_HTTPS y +#define EOU_SUPPORT 1 +#define CONFIG_EOU y +#define EZC_SUPPORT 1 +#define CONFIG_EZC y +#define WRITE_MAC_SUPPORT 1 +#define CONFIG_WRITE_MAC y +#define DIAG_SUPPORT 1 +#define CONFIG_DIAG y +#endif + +#define SPEED_BOOSTER_SUPPORT 1 +#define CONFIG_SPEED_BOOSTER y +#define XBOX_SUPPORT 1 +#define CONFIG_XBOX y + +#if 0 +#define MPPPOE_SUPPORT 1 +#define CONFIG_MPPPOE y +#define UNNUMBERIP_SUPPORT 1 +#define CONFIG_UNNUMBERIP y +#endif + +#define WL_STA_SUPPORT 1 +#define CONFIG_WL_STA y +#define BACKUP_RESTORE_SUPPORT 1 +#define CONFIG_BACKUP_RESTORE y +#define PORT_TRIGGER_SUPPORT 1 +#define CONFIG_PORT_TRIGGER y +#define HW_QOS_SUPPORT 1 +#define CONFIG_HW_QOS y diff --git a/package/wlcompat/src/include/epivers.h b/package/wlcompat/src/include/epivers.h new file mode 100644 index 0000000000..e174fb50d8 --- /dev/null +++ b/package/wlcompat/src/include/epivers.h @@ -0,0 +1,69 @@ +/* + * Copyright 2004, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * + * $Id$ + * +*/ + +#ifndef _epivers_h_ +#define _epivers_h_ + +#ifdef linux +#include <linux/config.h> +#endif + +/* Vendor Name, ASCII, 32 chars max */ +#ifdef COMPANYNAME +#define HPNA_VENDOR COMPANYNAME +#else +#define HPNA_VENDOR "Broadcom Corporation" +#endif + +/* Driver Date, ASCII, 32 chars max */ +#define HPNA_DRV_BUILD_DATE __DATE__ + +/* Hardware Manufacture Date, ASCII, 32 chars max */ +#define HPNA_HW_MFG_DATE "Not Specified" + +/* See documentation for Device Type values, 32 values max */ +#ifndef HPNA_DEV_TYPE + +#if defined(CONFIG_BRCM_VJ) +#define HPNA_DEV_TYPE { CDCF_V0_DEVICE_DISPLAY } + +#elif defined(CONFIG_BCRM_93725) +#define HPNA_DEV_TYPE { CDCF_V0_DEVICE_CM_BRIDGE, CDCF_V0_DEVICE_DISPLAY } + +#else +#define HPNA_DEV_TYPE { CDCF_V0_DEVICE_PCINIC } + +#endif + +#endif /* !HPNA_DEV_TYPE */ + + +#define EPI_MAJOR_VERSION 3 + +#define EPI_MINOR_VERSION 60 + +#define EPI_RC_NUMBER 13 + +#define EPI_INCREMENTAL_NUMBER 0 + +#define EPI_BUILD_NUMBER 0 + +#define EPI_VERSION 3,60,13,0 + +#define EPI_VERSION_NUM 0x033c0d00 + +/* Driver Version String, ASCII, 32 chars max */ +#define EPI_VERSION_STR "3.60.13.0" +#define EPI_ROUTER_VERSION_STR "3.61.13.0" + +#endif /* _epivers_h_ */ diff --git a/package/wlcompat/src/include/proto/802.11.h b/package/wlcompat/src/include/proto/802.11.h new file mode 100644 index 0000000000..ea57850ce5 --- /dev/null +++ b/package/wlcompat/src/include/proto/802.11.h @@ -0,0 +1,852 @@ +/* + * Copyright 2004, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * + * Fundamental types and constants relating to 802.11 + * + * $Id$ + */ + +#ifndef _802_11_H_ +#define _802_11_H_ + +#ifndef _TYPEDEFS_H_ +#include <typedefs.h> +#endif + +#ifndef _NET_ETHERNET_H_ +#include <proto/ethernet.h> +#endif + +/* enable structure packing */ +#if !defined(__GNUC__) +#pragma pack(1) +#endif + +/* some platforms require stronger medicine */ +#if defined(__GNUC__) +#define PACKED __attribute__((packed)) +#else +#define PACKED +#endif + + +#define DOT11_TU_TO_US 1024 /* 802.11 Time Unit is 1024 microseconds */ + +/* Generic 802.11 frame constants */ +#define DOT11_A3_HDR_LEN 24 +#define DOT11_A4_HDR_LEN 30 +#define DOT11_MAC_HDR_LEN DOT11_A3_HDR_LEN +#define DOT11_FCS_LEN 4 +#define DOT11_ICV_LEN 4 +#define DOT11_ICV_AES_LEN 8 +#define DOT11_QOS_LEN 2 + +#define DOT11_KEY_INDEX_SHIFT 6 +#define DOT11_IV_LEN 4 +#define DOT11_IV_TKIP_LEN 8 +#define DOT11_IV_AES_OCB_LEN 4 +#define DOT11_IV_AES_CCM_LEN 8 + +/* Includes MIC */ +#define DOT11_MAX_MPDU_BODY_LEN 2304 +/* A4 header + QoS + CCMP + PDU + ICV + FCS = 2352 */ +#define DOT11_MAX_MPDU_LEN (DOT11_A4_HDR_LEN + \ + DOT11_QOS_LEN + \ + DOT11_IV_AES_CCM_LEN + \ + DOT11_MAX_MPDU_BODY_LEN + \ + DOT11_ICV_LEN + \ + DOT11_FCS_LEN) + +#define DOT11_MAX_SSID_LEN 32 + +/* dot11RTSThreshold */ +#define DOT11_DEFAULT_RTS_LEN 2347 +#define DOT11_MAX_RTS_LEN 2347 + +/* dot11FragmentationThreshold */ +#define DOT11_MIN_FRAG_LEN 256 +#define DOT11_MAX_FRAG_LEN 2346 /* Max frag is also limited by aMPDUMaxLength of the attached PHY */ +#define DOT11_DEFAULT_FRAG_LEN 2346 + +/* dot11BeaconPeriod */ +#define DOT11_MIN_BEACON_PERIOD 1 +#define DOT11_MAX_BEACON_PERIOD 0xFFFF + +/* dot11DTIMPeriod */ +#define DOT11_MIN_DTIM_PERIOD 1 +#define DOT11_MAX_DTIM_PERIOD 0xFF + +/* 802.2 LLC/SNAP header used by 802.11 per 802.1H */ +#define DOT11_LLC_SNAP_HDR_LEN 8 +#define DOT11_OUI_LEN 3 +struct dot11_llc_snap_header { + uint8 dsap; /* always 0xAA */ + uint8 ssap; /* always 0xAA */ + uint8 ctl; /* always 0x03 */ + uint8 oui[DOT11_OUI_LEN]; /* RFC1042: 0x00 0x00 0x00 + Bridge-Tunnel: 0x00 0x00 0xF8 */ + uint16 type; /* ethertype */ +} PACKED; + +/* RFC1042 header used by 802.11 per 802.1H */ +#define RFC1042_HDR_LEN (ETHER_HDR_LEN + DOT11_LLC_SNAP_HDR_LEN) + +/* Generic 802.11 MAC header */ +/* + * N.B.: This struct reflects the full 4 address 802.11 MAC header. + * The fields are defined such that the shorter 1, 2, and 3 + * address headers just use the first k fields. + */ +struct dot11_header { + uint16 fc; /* frame control */ + uint16 durid; /* duration/ID */ + struct ether_addr a1; /* address 1 */ + struct ether_addr a2; /* address 2 */ + struct ether_addr a3; /* address 3 */ + uint16 seq; /* sequence control */ + struct ether_addr a4; /* address 4 */ +} PACKED; + +/* Control frames */ + +struct dot11_rts_frame { + uint16 fc; /* frame control */ + uint16 durid; /* duration/ID */ + struct ether_addr ra; /* receiver address */ + struct ether_addr ta; /* transmitter address */ +} PACKED; +#define DOT11_RTS_LEN 16 + +struct dot11_cts_frame { + uint16 fc; /* frame control */ + uint16 durid; /* duration/ID */ + struct ether_addr ra; /* receiver address */ +} PACKED; +#define DOT11_CTS_LEN 10 + +struct dot11_ack_frame { + uint16 fc; /* frame control */ + uint16 durid; /* duration/ID */ + struct ether_addr ra; /* receiver address */ +} PACKED; +#define DOT11_ACK_LEN 10 + +struct dot11_ps_poll_frame { + uint16 fc; /* frame control */ + uint16 durid; /* AID */ + struct ether_addr bssid; /* receiver address, STA in AP */ + struct ether_addr ta; /* transmitter address */ +} PACKED; +#define DOT11_PS_POLL_LEN 16 + +struct dot11_cf_end_frame { + uint16 fc; /* frame control */ + uint16 durid; /* duration/ID */ + struct ether_addr ra; /* receiver address */ + struct ether_addr bssid; /* transmitter address, STA in AP */ +} PACKED; +#define DOT11_CS_END_LEN 16 + +/* Management frame header */ +struct dot11_management_header { + uint16 fc; /* frame control */ + uint16 durid; /* duration/ID */ + struct ether_addr da; /* receiver address */ + struct ether_addr sa; /* transmitter address */ + struct ether_addr bssid; /* BSS ID */ + uint16 seq; /* sequence control */ +} PACKED; +#define DOT11_MGMT_HDR_LEN 24 + +/* Management frame payloads */ + +struct dot11_bcn_prb { + uint32 timestamp[2]; + uint16 beacon_interval; + uint16 capability; +} PACKED; +#define DOT11_BCN_PRB_LEN 12 + +struct dot11_auth { + uint16 alg; /* algorithm */ + uint16 seq; /* sequence control */ + uint16 status; /* status code */ +} PACKED; +#define DOT11_AUTH_FIXED_LEN 6 /* length of auth frame without challenge info elt */ + +struct dot11_assoc_req { + uint16 capability; /* capability information */ + uint16 listen; /* listen interval */ +} PACKED; + +struct dot11_assoc_resp { + uint16 capability; /* capability information */ + uint16 status; /* status code */ + uint16 aid; /* association ID */ +} PACKED; + +struct dot11_action_measure { + uint8 category; + uint8 action; + uint8 token; + uint8 data[1]; +} PACKED; +#define DOT11_ACTION_MEASURE_LEN 3 + +/************** + 802.11h related definitions. +**************/ +typedef struct { + uint8 id; + uint8 len; + uint8 power; +} dot11_power_cnst_t; + +typedef struct { + uint8 min; + uint8 max; +} dot11_power_cap_t; + +typedef struct { + uint8 id; + uint8 len; + uint8 tx_pwr; + uint8 margin; +} dot11_tpc_rep_t; +#define DOT11_MNG_IE_TPC_REPORT_LEN 2 /* length of IE data, not including 2 byte header */ + +typedef struct { + uint8 id; + uint8 len; + uint8 first_channel; + uint8 num_channels; +} dot11_supp_channels_t; + +struct dot11_channel_switch { + uint8 id; + uint8 len; + uint8 mode; + uint8 channel; + uint8 count; +} PACKED; +typedef struct dot11_channel_switch dot11_channel_switch_t; + +/* 802.11h Measurement Request/Report IEs */ +/* Measurement Type field */ +#define DOT11_MEASURE_TYPE_BASIC 0 +#define DOT11_MEASURE_TYPE_CCA 1 +#define DOT11_MEASURE_TYPE_RPI 2 + +/* Measurement Mode field */ + +/* Measurement Request Modes */ +#define DOT11_MEASURE_MODE_ENABLE (1<<1) +#define DOT11_MEASURE_MODE_REQUEST (1<<2) +#define DOT11_MEASURE_MODE_REPORT (1<<3) +/* Measurement Report Modes */ +#define DOT11_MEASURE_MODE_LATE (1<<0) +#define DOT11_MEASURE_MODE_INCAPABLE (1<<1) +#define DOT11_MEASURE_MODE_REFUSED (1<<2) +/* Basic Measurement Map bits */ +#define DOT11_MEASURE_BASIC_MAP_BSS ((uint8)(1<<0)) +#define DOT11_MEASURE_BASIC_MAP_OFDM ((uint8)(1<<1)) +#define DOT11_MEASURE_BASIC_MAP_UKNOWN ((uint8)(1<<2)) +#define DOT11_MEASURE_BASIC_MAP_RADAR ((uint8)(1<<3)) +#define DOT11_MEASURE_BASIC_MAP_UNMEAS ((uint8)(1<<4)) + +typedef struct { + uint8 id; + uint8 len; + uint8 token; + uint8 mode; + uint8 type; + uint8 channel; + uint8 start_time[8]; + uint16 duration; +} dot11_meas_req_t; +#define DOT11_MNG_IE_MREQ_LEN 14 +/* length of Measure Request IE data not including variable len */ +#define DOT11_MNG_IE_MREQ_FIXED_LEN 3 + +struct dot11_meas_rep { + uint8 id; + uint8 len; + uint8 token; + uint8 mode; + uint8 type; + union + { + struct { + uint8 channel; + uint8 start_time[8]; + uint16 duration; + uint8 map; + } PACKED basic; + uint8 data[1]; + } PACKED rep; +} PACKED; +typedef struct dot11_meas_rep dot11_meas_rep_t; + +/* length of Measure Report IE data not including variable len */ +#define DOT11_MNG_IE_MREP_FIXED_LEN 3 + +struct dot11_meas_rep_basic { + uint8 channel; + uint8 start_time[8]; + uint16 duration; + uint8 map; +} PACKED; +typedef struct dot11_meas_rep_basic dot11_meas_rep_basic_t; +#define DOT11_MEASURE_BASIC_REP_LEN 12 + +struct dot11_quiet { + uint8 id; + uint8 len; + uint8 count; /* TBTTs until beacon interval in quiet starts */ + uint8 period; /* Beacon intervals between periodic quiet periods ? */ + uint16 duration;/* Length of quiet period, in TU's */ + uint16 offset; /* TU's offset from TBTT in Count field */ +} PACKED; +typedef struct dot11_quiet dot11_quiet_t; + +typedef struct { + uint8 channel; + uint8 map; +} chan_map_tuple_t; + +typedef struct { + uint8 id; + uint8 len; + uint8 eaddr[ETHER_ADDR_LEN]; + uint8 interval; + chan_map_tuple_t map[1]; +} dot11_ibss_dfs_t; + +/* WME Elements */ +#define WME_OUI "\x00\x50\xf2" +#define WME_VER 1 +#define WME_TYPE 2 +#define WME_SUBTYPE_IE 0 /* Information Element */ +#define WME_SUBTYPE_PARAM_IE 1 /* Parameter Element */ +#define WME_SUBTYPE_TSPEC 2 /* Traffic Specification */ + +/* WME Access Category Indices (ACIs) */ +#define AC_BE 0 /* Best Effort */ +#define AC_BK 1 /* Background */ +#define AC_VI 2 /* Video */ +#define AC_VO 3 /* Voice */ +#define AC_MAX 4 + +/* WME Information Element (IE) */ +struct wme_ie { + uint8 oui[3]; + uint8 type; + uint8 subtype; + uint8 version; + uint8 acinfo; +} PACKED; +typedef struct wme_ie wme_ie_t; +#define WME_IE_LEN 7 + +struct wme_acparam { + uint8 ACI; + uint8 ECW; + uint16 TXOP; /* stored in network order (ls octet first) */ +} PACKED; +typedef struct wme_acparam wme_acparam_t; + +/* WME Parameter Element (PE) */ +struct wme_params { + uint8 oui[3]; + uint8 type; + uint8 subtype; + uint8 version; + uint8 acinfo; + uint8 rsvd; + wme_acparam_t acparam[4]; +} PACKED; +typedef struct wme_params wme_params_t; +#define WME_PARAMS_IE_LEN 24 + +/* acinfo */ +#define WME_COUNT_MASK 0x0f +/* ACI */ +#define WME_AIFS_MASK 0x0f +#define WME_ACM_MASK 0x10 +#define WME_ACI_MASK 0x60 +#define WME_ACI_SHIFT 5 +/* ECW */ +#define WME_CWMIN_MASK 0x0f +#define WME_CWMAX_MASK 0xf0 +#define WME_CWMAX_SHIFT 4 + +#define WME_TXOP_UNITS 32 + +/* WME Traffic Specification (TSPEC) element */ +#define WME_SUBTYPE_TSPEC 2 +#define WME_TSPEC_HDR_LEN 2 +#define WME_TSPEC_BODY_OFF 2 +struct wme_tspec { + uint8 oui[DOT11_OUI_LEN]; /* WME_OUI */ + uint8 type; /* WME_TYPE */ + uint8 subtype; /* WME_SUBTYPE_TSPEC */ + uint8 version; /* WME_VERSION */ + uint16 ts_info; /* TS Info */ + uint16 nom_msdu_size; /* (Nominal or fixed) MSDU Size (bytes) */ + uint16 max_msdu_size; /* Maximum MSDU Size (bytes) */ + uint32 min_service_interval; /* Minimum Service Interval (us) */ + uint32 max_service_interval; /* Maximum Service Interval (us) */ + uint32 inactivity_interval; /* Inactivity Interval (us) */ + uint32 service_start; /* Service Start Time (us) */ + uint32 min_rate; /* Minimum Data Rate (bps) */ + uint32 mean_rate; /* Mean Data Rate (bps) */ + uint32 max_burst_size; /* Maximum Burst Size (bytes) */ + uint32 min_phy_rate; /* Minimum PHY Rate (bps) */ + uint32 peak_rate; /* Peak Data Rate (bps) */ + uint32 delay_bound; /* Delay Bound (us) */ + uint16 surplus_bandwidth; /* Surplus Bandwidth Allowance Factor */ + uint16 medium_time; /* Medium Time (32 us/s periods) */ +} PACKED; +typedef struct wme_tspec wme_tspec_t; +#define WME_TSPEC_LEN 56 /* not including 2-byte header */ + +/* ts_info */ +/* 802.1D priority is duplicated - bits 13-11 AND bits 3-1 */ +#define TS_INFO_PRIO_SHIFT_HI 11 +#define TS_INFO_PRIO_MASK_HI (0x7 << TS_INFO_PRIO_SHIFT_HI) +#define TS_INFO_PRIO_SHIFT_LO 1 +#define TS_INFO_PRIO_MASK_LO (0x7 << TS_INFO_PRIO_SHIFT_LO) +#define TS_INFO_CONTENTION_SHIFT 7 +#define TS_INFO_CONTENTION_MASK (0x1 << TS_INFO_CONTENTION_SHIFT) +#define TS_INFO_DIRECTION_SHIFT 5 +#define TS_INFO_DIRECTION_MASK (0x3 << TS_INFO_DIRECTION_SHIFT) +#define TS_INFO_UPLINK (0 << TS_INFO_DIRECTION_SHIFT) +#define TS_INFO_DOWNLINK (1 << TS_INFO_DIRECTION_SHIFT) +#define TS_INFO_BIDIRECTIONAL (3 << TS_INFO_DIRECTION_SHIFT) + +/* nom_msdu_size */ +#define FIXED_MSDU_SIZE 0x8000 /* MSDU size is fixed */ +#define MSDU_SIZE_MASK 0x7fff /* (Nominal or fixed) MSDU size */ + +/* surplus_bandwidth */ +/* Represented as 3 bits of integer, binary point, 13 bits fraction */ +#define INTEGER_SHIFT 13 +#define FRACTION_MASK 0x1FFF + +/* Management Notification Frame */ +struct dot11_management_notification { + uint8 category; /* DOT11_ACTION_NOTIFICATION */ + uint8 action; + uint8 token; + uint8 status; + uint8 data[1]; /* Elements */ +} PACKED; +#define DOT11_MGMT_NOTIFICATION_LEN 4 /* Fixed length */ + +/* WME Action Codes */ +#define WME_SETUP_REQUEST 0 +#define WME_SETUP_RESPONSE 1 +#define WME_TEARDOWN 2 + +/* WME Setup Response Status Codes */ +#define WME_ADMISSION_ACCEPTED 0 +#define WME_INVALID_PARAMETERS 1 +#define WME_ADMISSION_REFUSED 3 + +/* Macro to take a pointer to a beacon or probe response + * header and return the char* pointer to the SSID info element + */ +#define BCN_PRB_SSID(hdr) ((char*)(hdr) + DOT11_MGMT_HDR_LEN + DOT11_BCN_PRB_LEN) + +/* Authentication frame payload constants */ +#define DOT11_OPEN_SYSTEM 0 +#define DOT11_SHARED_KEY 1 +#define DOT11_CHALLENGE_LEN 128 + +/* Frame control macros */ +#define FC_PVER_MASK 0x3 +#define FC_PVER_SHIFT 0 +#define FC_TYPE_MASK 0xC +#define FC_TYPE_SHIFT 2 +#define FC_SUBTYPE_MASK 0xF0 +#define FC_SUBTYPE_SHIFT 4 +#define FC_TODS 0x100 +#define FC_TODS_SHIFT 8 +#define FC_FROMDS 0x200 +#define FC_FROMDS_SHIFT 9 +#define FC_MOREFRAG 0x400 +#define FC_MOREFRAG_SHIFT 10 +#define FC_RETRY 0x800 +#define FC_RETRY_SHIFT 11 +#define FC_PM 0x1000 +#define FC_PM_SHIFT 12 +#define FC_MOREDATA 0x2000 +#define FC_MOREDATA_SHIFT 13 +#define FC_WEP 0x4000 +#define FC_WEP_SHIFT 14 +#define FC_ORDER 0x8000 +#define FC_ORDER_SHIFT 15 + +/* sequence control macros */ +#define SEQNUM_SHIFT 4 +#define FRAGNUM_MASK 0xF + +/* Frame Control type/subtype defs */ + +/* FC Types */ +#define FC_TYPE_MNG 0 +#define FC_TYPE_CTL 1 +#define FC_TYPE_DATA 2 + +/* Management Subtypes */ +#define FC_SUBTYPE_ASSOC_REQ 0 +#define FC_SUBTYPE_ASSOC_RESP 1 +#define FC_SUBTYPE_REASSOC_REQ 2 +#define FC_SUBTYPE_REASSOC_RESP 3 +#define FC_SUBTYPE_PROBE_REQ 4 +#define FC_SUBTYPE_PROBE_RESP 5 +#define FC_SUBTYPE_BEACON 8 +#define FC_SUBTYPE_ATIM 9 +#define FC_SUBTYPE_DISASSOC 10 +#define FC_SUBTYPE_AUTH 11 +#define FC_SUBTYPE_DEAUTH 12 +#define FC_SUBTYPE_ACTION 13 + +/* Control Subtypes */ +#define FC_SUBTYPE_PS_POLL 10 +#define FC_SUBTYPE_RTS 11 +#define FC_SUBTYPE_CTS 12 +#define FC_SUBTYPE_ACK 13 +#define FC_SUBTYPE_CF_END 14 +#define FC_SUBTYPE_CF_END_ACK 15 + +/* Data Subtypes */ +#define FC_SUBTYPE_DATA 0 +#define FC_SUBTYPE_DATA_CF_ACK 1 +#define FC_SUBTYPE_DATA_CF_POLL 2 +#define FC_SUBTYPE_DATA_CF_ACK_POLL 3 +#define FC_SUBTYPE_NULL 4 +#define FC_SUBTYPE_CF_ACK 5 +#define FC_SUBTYPE_CF_POLL 6 +#define FC_SUBTYPE_CF_ACK_POLL 7 +#define FC_SUBTYPE_QOS_DATA 8 +#define FC_SUBTYPE_QOS_NULL 12 + +/* type-subtype combos */ +#define FC_KIND_MASK (FC_TYPE_MASK | FC_SUBTYPE_MASK) + +#define FC_KIND(t, s) (((t) << FC_TYPE_SHIFT) | ((s) << FC_SUBTYPE_SHIFT)) + +#define FC_ASSOC_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ASSOC_REQ) +#define FC_ASSOC_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ASSOC_RESP) +#define FC_REASSOC_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_REASSOC_REQ) +#define FC_REASSOC_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_REASSOC_RESP) +#define FC_PROBE_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_PROBE_REQ) +#define FC_PROBE_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_PROBE_RESP) +#define FC_BEACON FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_BEACON) +#define FC_DISASSOC FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_DISASSOC) +#define FC_AUTH FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_AUTH) +#define FC_DEAUTH FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_DEAUTH) +#define FC_ACTION FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ACTION) + +#define FC_PS_POLL FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_PS_POLL) +#define FC_RTS FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_RTS) +#define FC_CTS FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CTS) +#define FC_ACK FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_ACK) +#define FC_CF_END FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CF_END) +#define FC_CF_END_ACK FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CF_END_ACK) + +#define FC_DATA FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_DATA) +#define FC_NULL_DATA FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_NULL) +#define FC_DATA_CF_ACK FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_DATA_CF_ACK) +#define FC_QOS_DATA FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_QOS_DATA) +#define FC_QOS_NULL FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_QOS_NULL) + +/* QoS Control Field */ + +/* 802.1D Tag */ +#define QOS_PRIO_SHIFT 0 +#define QOS_PRIO_MASK 0x0007 +#define QOS_PRIO(qos) (((qos) & QOS_PRIO_MASK) >> QOS_PRIO_SHIFT) + +/* Ack Policy (0 means Acknowledge) */ +#define QOS_ACK_SHIFT 5 +#define QOS_ACK_MASK 0x0060 +#define QOS_ACK(qos) (((qos) & QOS_ACK_MASK) >> QOS_ACK_SHIFT) + +/* Management Frames */ + +/* Management Frame Constants */ + +/* Fixed fields */ +#define DOT11_MNG_AUTH_ALGO_LEN 2 +#define DOT11_MNG_AUTH_SEQ_LEN 2 +#define DOT11_MNG_BEACON_INT_LEN 2 +#define DOT11_MNG_CAP_LEN 2 +#define DOT11_MNG_AP_ADDR_LEN 6 +#define DOT11_MNG_LISTEN_INT_LEN 2 +#define DOT11_MNG_REASON_LEN 2 +#define DOT11_MNG_AID_LEN 2 +#define DOT11_MNG_STATUS_LEN 2 +#define DOT11_MNG_TIMESTAMP_LEN 8 + +/* DUR/ID field in assoc resp is 0xc000 | AID */ +#define DOT11_AID_MASK 0x3fff + +/* Reason Codes */ +#define DOT11_RC_RESERVED 0 +#define DOT11_RC_UNSPECIFIED 1 /* Unspecified reason */ +#define DOT11_RC_AUTH_INVAL 2 /* Previous authentication no longer valid */ +#define DOT11_RC_DEAUTH_LEAVING 3 /* Deauthenticated because sending station is + leaving (or has left) IBSS or ESS */ +#define DOT11_RC_INACTIVITY 4 /* Disassociated due to inactivity */ +#define DOT11_RC_BUSY 5 /* Disassociated because AP is unable to handle + all currently associated stations */ +#define DOT11_RC_INVAL_CLASS_2 6 /* Class 2 frame received from + nonauthenticated station */ +#define DOT11_RC_INVAL_CLASS_3 7 /* Class 3 frame received from + nonassociated station */ +#define DOT11_RC_DISASSOC_LEAVING 8 /* Disassociated because sending station is + leaving (or has left) BSS */ +#define DOT11_RC_NOT_AUTH 9 /* Station requesting (re)association is + not authenticated with responding station */ +#define DOT11_RC_MAX 23 /* Reason codes > 23 are reserved */ + +/* Status Codes */ +#define DOT11_STATUS_SUCCESS 0 /* Successful */ +#define DOT11_STATUS_FAILURE 1 /* Unspecified failure */ +#define DOT11_STATUS_CAP_MISMATCH 10 /* Cannot support all requested capabilities + in the Capability Information field */ +#define DOT11_STATUS_REASSOC_FAIL 11 /* Reassociation denied due to inability to + confirm that association exists */ +#define DOT11_STATUS_ASSOC_FAIL 12 /* Association denied due to reason outside + the scope of this standard */ +#define DOT11_STATUS_AUTH_MISMATCH 13 /* Responding station does not support the + specified authentication algorithm */ +#define DOT11_STATUS_AUTH_SEQ 14 /* Received an Authentication frame with + authentication transaction sequence number + out of expected sequence */ +#define DOT11_STATUS_AUTH_CHALLENGE_FAIL 15 /* Authentication rejected because of challenge failure */ +#define DOT11_STATUS_AUTH_TIMEOUT 16 /* Authentication rejected due to timeout waiting + for next frame in sequence */ +#define DOT11_STATUS_ASSOC_BUSY_FAIL 17 /* Association denied because AP is unable to + handle additional associated stations */ +#define DOT11_STATUS_ASSOC_RATE_MISMATCH 18 /* Association denied due to requesting station + not supporting all of the data rates in the + BSSBasicRateSet parameter */ +#define DOT11_STATUS_ASSOC_SHORT_REQUIRED 19 /* Association denied due to requesting station + not supporting the Short Preamble option */ +#define DOT11_STATUS_ASSOC_PBCC_REQUIRED 20 /* Association denied due to requesting station + not supporting the PBCC Modulation option */ +#define DOT11_STATUS_ASSOC_AGILITY_REQUIRED 21 /* Association denied due to requesting station + not supporting the Channel Agility option */ +#define DOT11_STATUS_ASSOC_SPECTRUM_REQUIRED 22 /* Association denied because Spectrum Management + capability is required. */ +#define DOT11_STATUS_ASSOC_BAD_POWER_CAP 23 /* Association denied because the info in the + Power Cap element is unacceptable. */ +#define DOT11_STATUS_ASSOC_BAD_SUP_CHANNELS 24 /* Association denied because the info in the + Supported Channel element is unacceptable */ +#define DOT11_STATUS_ASSOC_SHORTSLOT_REQUIRED 25 /* Association denied due to requesting station + not supporting the Short Slot Time option */ +#define DOT11_STATUS_ASSOC_ERPBCC_REQUIRED 26 /* Association denied due to requesting station + not supporting the ER-PBCC Modulation option */ +#define DOT11_STATUS_ASSOC_DSSOFDM_REQUIRED 27 /* Association denied due to requesting station + not supporting the DSS-OFDM option */ + +/* Info Elts, length of INFORMATION portion of Info Elts */ +#define DOT11_MNG_DS_PARAM_LEN 1 +#define DOT11_MNG_IBSS_PARAM_LEN 2 + +/* TIM Info element has 3 bytes fixed info in INFORMATION field, + * followed by 1 to 251 bytes of Partial Virtual Bitmap */ +#define DOT11_MNG_TIM_FIXED_LEN 3 +#define DOT11_MNG_TIM_DTIM_COUNT 0 +#define DOT11_MNG_TIM_DTIM_PERIOD 1 +#define DOT11_MNG_TIM_BITMAP_CTL 2 +#define DOT11_MNG_TIM_PVB 3 + +/* TLV defines */ +#define TLV_TAG_OFF 0 +#define TLV_LEN_OFF 1 +#define TLV_HDR_LEN 2 +#define TLV_BODY_OFF 2 + +/* Management Frame Information Element IDs */ +#define DOT11_MNG_SSID_ID 0 +#define DOT11_MNG_RATES_ID 1 +#define DOT11_MNG_FH_PARMS_ID 2 +#define DOT11_MNG_DS_PARMS_ID 3 +#define DOT11_MNG_CF_PARMS_ID 4 +#define DOT11_MNG_TIM_ID 5 +#define DOT11_MNG_IBSS_PARMS_ID 6 +#define DOT11_MNG_COUNTRY_ID 7 +#define DOT11_MNG_HOPPING_PARMS_ID 8 +#define DOT11_MNG_HOPPING_TABLE_ID 9 +#define DOT11_MNG_REQUEST_ID 10 +#define DOT11_MNG_CHALLENGE_ID 16 +#define DOT11_MNG_PWR_CONSTRAINT_ID 32 /* 11H PowerConstraint */ +#define DOT11_MNG_PWR_CAP_ID 33 /* 11H PowerCapability */ +#define DOT11_MNG_TPC_REQUEST_ID 34 /* 11H TPC Request */ +#define DOT11_MNG_TPC_REPORT_ID 35 /* 11H TPC Report */ +#define DOT11_MNG_SUPP_CHANNELS_ID 36 /* 11H Supported Channels */ +#define DOT11_MNG_CHANNEL_SWITCH_ID 37 /* 11H ChannelSwitch Announcement*/ +#define DOT11_MNG_MEASURE_REQUEST_ID 38 /* 11H MeasurementRequest */ +#define DOT11_MNG_MEASURE_REPORT_ID 39 /* 11H MeasurementReport */ +#define DOT11_MNG_QUIET_ID 40 /* 11H Quiet */ +#define DOT11_MNG_IBSS_DFS_ID 41 /* 11H IBSS_DFS */ +#define DOT11_MNG_ERP_ID 42 +#define DOT11_MNG_NONERP_ID 47 +#define DOT11_MNG_EXT_RATES_ID 50 +#define DOT11_MNG_WPA_ID 221 +#define DOT11_MNG_PROPR_ID 221 + +/* ERP info element bit values */ +#define DOT11_MNG_ERP_LEN 1 /* ERP is currently 1 byte long */ +#define DOT11_MNG_NONERP_PRESENT 0x01 /* NonERP (802.11b) STAs are present in the BSS */ +#define DOT11_MNG_USE_PROTECTION 0x02 /* Use protection mechanisms for ERP-OFDM frames */ +#define DOT11_MNG_BARKER_PREAMBLE 0x04 /* Short Preambles: 0 == allowed, 1 == not allowed */ + +/* Capability Information Field */ +#define DOT11_CAP_ESS 0x0001 +#define DOT11_CAP_IBSS 0x0002 +#define DOT11_CAP_POLLABLE 0x0004 +#define DOT11_CAP_POLL_RQ 0x0008 +#define DOT11_CAP_PRIVACY 0x0010 +#define DOT11_CAP_SHORT 0x0020 +#define DOT11_CAP_PBCC 0x0040 +#define DOT11_CAP_AGILITY 0x0080 +#define DOT11_CAP_SPECTRUM 0x0100 +#define DOT11_CAP_SHORTSLOT 0x0400 +#define DOT11_CAP_CCK_OFDM 0x2000 + +/* Action Frame Constants */ +#define DOT11_ACTION_CAT_ERR_MASK 0x80 +#define DOT11_ACTION_CAT_SPECT_MNG 0x00 +#define DOT11_ACTION_NOTIFICATION 0x11 /* 17 */ + +#define DOT11_ACTION_ID_M_REQ 0 +#define DOT11_ACTION_ID_M_REP 1 +#define DOT11_ACTION_ID_TPC_REQ 2 +#define DOT11_ACTION_ID_TPC_REP 3 +#define DOT11_ACTION_ID_CHANNEL_SWITCH 4 + +/* MLME Enumerations */ +#define DOT11_BSSTYPE_INFRASTRUCTURE 0 +#define DOT11_BSSTYPE_INDEPENDENT 1 +#define DOT11_BSSTYPE_ANY 2 +#define DOT11_SCANTYPE_ACTIVE 0 +#define DOT11_SCANTYPE_PASSIVE 1 + +/* 802.11 A PHY constants */ +#define APHY_SLOT_TIME 9 +#define APHY_SIFS_TIME 16 +#define APHY_DIFS_TIME (APHY_SIFS_TIME + (2 * APHY_SLOT_TIME)) +#define APHY_PREAMBLE_TIME 16 +#define APHY_SIGNAL_TIME 4 +#define APHY_SYMBOL_TIME 4 +#define APHY_SERVICE_NBITS 16 +#define APHY_TAIL_NBITS 6 +#define APHY_CWMIN 15 + +/* 802.11 B PHY constants */ +#define BPHY_SLOT_TIME 20 +#define BPHY_SIFS_TIME 10 +#define BPHY_DIFS_TIME 50 +#define BPHY_PLCP_TIME 192 +#define BPHY_PLCP_SHORT_TIME 96 +#define BPHY_CWMIN 31 + +/* 802.11 G constants */ +#define DOT11_OFDM_SIGNAL_EXTENSION 6 + +#define PHY_CWMAX 1023 + +#define DOT11_MAXNUMFRAGS 16 /* max # fragments per MSDU */ + +/* dot11Counters Table - 802.11 spec., Annex D */ +typedef struct d11cnt { + uint32 txfrag; /* dot11TransmittedFragmentCount */ + uint32 txmulti; /* dot11MulticastTransmittedFrameCount */ + uint32 txfail; /* dot11FailedCount */ + uint32 txretry; /* dot11RetryCount */ + uint32 txretrie; /* dot11MultipleRetryCount */ + uint32 rxdup; /* dot11FrameduplicateCount */ + uint32 txrts; /* dot11RTSSuccessCount */ + uint32 txnocts; /* dot11RTSFailureCount */ + uint32 txnoack; /* dot11ACKFailureCount */ + uint32 rxfrag; /* dot11ReceivedFragmentCount */ + uint32 rxmulti; /* dot11MulticastReceivedFrameCount */ + uint32 rxcrc; /* dot11FCSErrorCount */ + uint32 txfrmsnt; /* dot11TransmittedFrameCount */ + uint32 rxundec; /* dot11WEPUndecryptableCount */ +} d11cnt_t; + +/* BRCM OUI */ +#define BRCM_OUI "\x00\x10\x18" + +/* BRCM info element */ +struct brcm_ie { + uchar id; + uchar len; + uchar oui[3]; + uchar ver; + uchar assoc; /* # of assoc STAs */ + uchar flags; /* misc flags */ +} PACKED; +#define BRCM_IE_LEN 8 +typedef struct brcm_ie brcm_ie_t; +#define BRCM_IE_VER 1 + +/* brcm_ie flags */ +#define BRF_ABCAP 0x1 /* afterburner capable */ +#define BRF_ABRQRD 0x2 /* afterburner requested */ + +/* WPA definitions */ +#define WPA_VERSION 1 +#define WPA_OUI "\x00\x50\xF2" + +#define WPA_OUI_LEN 3 + +/* WPA authentication modes */ +#define WPA_AUTH_NONE 0 /* None */ +#define WPA_AUTH_UNSPECIFIED 1 /* Unspecified authentication over 802.1X: default for WPA */ +#define WPA_AUTH_PSK 2 /* Pre-shared Key over 802.1X */ +#define WPA_AUTH_DISABLED 255 /* Legacy (i.e., non-WPA) */ + +#define IS_WPA_AUTH(auth) ((auth) == WPA_AUTH_NONE || \ + (auth) == WPA_AUTH_UNSPECIFIED || \ + (auth) == WPA_AUTH_PSK) + + +/* Key related defines */ +#define DOT11_MAX_DEFAULT_KEYS 4 /* number of default keys */ +#define DOT11_MAX_KEY_SIZE 32 /* max size of any key */ +#define DOT11_MAX_IV_SIZE 16 /* max size of any IV */ +#define DOT11_EXT_IV_FLAG (1<<5) /* flag to indicate IV is > 4 bytes */ + +#define WEP1_KEY_SIZE 5 /* max size of any WEP key */ +#define WEP1_KEY_HEX_SIZE 10 /* size of WEP key in hex. */ +#define WEP128_KEY_SIZE 13 /* max size of any WEP key */ +#define WEP128_KEY_HEX_SIZE 26 /* size of WEP key in hex. */ +#define TKIP_MIC_SIZE 8 /* size of TKIP MIC */ +#define TKIP_EOM_SIZE 7 /* max size of TKIP EOM */ +#define TKIP_EOM_FLAG 0x5a /* TKIP EOM flag byte */ +#define TKIP_KEY_SIZE 32 /* size of any TKIP key */ +#define TKIP_MIC_AUTH_TX 16 /* offset to Authenticator MIC TX key */ +#define TKIP_MIC_AUTH_RX 24 /* offset to Authenticator MIC RX key */ +#define TKIP_MIC_SUP_RX 16 /* offset to Supplicant MIC RX key */ +#define TKIP_MIC_SUP_TX 24 /* offset to Supplicant MIC TX key */ +#define AES_KEY_SIZE 16 /* size of AES key */ + +#undef PACKED +#if !defined(__GNUC__) +#pragma pack() +#endif + +#endif /* _802_11_H_ */ diff --git a/package/wlcompat/src/include/proto/ethernet.h b/package/wlcompat/src/include/proto/ethernet.h new file mode 100644 index 0000000000..173464af63 --- /dev/null +++ b/package/wlcompat/src/include/proto/ethernet.h @@ -0,0 +1,179 @@ +/******************************************************************************* + * $Id$ + * Copyright 2004, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * From FreeBSD 2.2.7: Fundamental constants relating to ethernet. + ******************************************************************************/ + +#ifndef _NET_ETHERNET_H_ /* use native BSD ethernet.h when available */ +#define _NET_ETHERNET_H_ + +#ifndef _TYPEDEFS_H_ +#include "typedefs.h" +#endif + +#if defined(__GNUC__) +#define PACKED __attribute__((packed)) +#else +#define PACKED +#endif + +/* + * The number of bytes in an ethernet (MAC) address. + */ +#ifndef ETHER_ADDR_LEN +#define ETHER_ADDR_LEN 6 +#endif + +/* + * The number of bytes in the type field. + */ +#ifndef ETHER_TYPE_LEN +#define ETHER_TYPE_LEN 2 +#endif + +/* + * The number of bytes in the trailing CRC field. + */ +#ifndef ETHER_CRC_LEN +#define ETHER_CRC_LEN 4 +#endif + +/* + * The length of the combined header. + */ +#ifndef ETHER_HDR_LEN +#define ETHER_HDR_LEN (ETHER_ADDR_LEN*2+ETHER_TYPE_LEN) +#endif + +/* + * The minimum packet length. + */ +#ifndef ETHER_MIN_LEN +#define ETHER_MIN_LEN 64 +#endif + +/* + * The minimum packet user data length. + */ +#ifndef ETHER_MIN_DATA +#define ETHER_MIN_DATA 46 +#endif + +/* + * The maximum packet length. + */ +#ifndef ETHER_MAX_LEN +#define ETHER_MAX_LEN 1518 +#endif + +/* + * The maximum packet user data length. + */ +#define ETHER_MAX_DATA 1500 + +/* + * Used to uniquely identify a 802.1q VLAN-tagged header. + */ +#define VLAN_TAG 0x8100 + +/* + * Located after dest & src address in ether header. + */ +#define VLAN_FIELDS_OFFSET (ETHER_ADDR_LEN * 2) + +/* + * 4 bytes of vlan field info. + */ +#define VLAN_FIELDS_SIZE 4 + +/* location of bits in 16-bit vlan fields */ +#define VLAN_PRI_SHIFT 13 /* user priority */ +#define VLAN_CFI_SHIFT 12 /* canonical format indicator bit */ + +/* 3 bits of priority */ +#define VLAN_PRI_MASK 7 +/* 12 bits of vlan identfier (VID) */ +#define VLAN_VID_MASK 0xFFF /* VLAN identifier (VID) field */ + +struct vlan_tags { + uint16 tag_type; /* 0x8100 for VLAN */ + uint16 tag_control; /* prio | cfi | vid */ +} PACKED ; + +/* 802.1X ethertype */ + +#define ETHER_TYPE_IP 0x0800 /* IP */ +#define ETHER_TYPE_BRCM 0x886c /* Broadcom Corp. */ +#define ETHER_TYPE_802_1X 0x888e /* 802.1x */ + +#define ETHER_BRCM_SUBTYPE_LEN 4 /* Broadcom 4byte subtype follows ethertype */ +#define ETHER_BRCM_CRAM 0x1 /* Broadcom subtype cram protocol */ + +/* + * A macro to validate a length with + */ +#define ETHER_IS_VALID_LEN(foo) \ + ((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN) + +#ifndef __NET_ETHERNET_H +#ifndef __INCif_etherh /* Quick and ugly hack for VxWorks */ +/* + * Structure of a 10Mb/s Ethernet header. + */ +struct ether_header { + uint8 ether_dhost[ETHER_ADDR_LEN]; + uint8 ether_shost[ETHER_ADDR_LEN]; + uint16 ether_type; +} PACKED ; + +/* + * Structure of a 48-bit Ethernet address. + */ +struct ether_addr { + uint8 octet[ETHER_ADDR_LEN]; +} PACKED ; +#endif +#endif + +/* + * Takes a pointer, returns true if a 48-bit multicast address + * (including broadcast, since it is all ones) + */ +#define ETHER_ISMULTI(ea) (((uint8 *)(ea))[0] & 1) + +/* + * Takes a pointer, returns true if a 48-bit broadcast (all ones) + */ +#define ETHER_ISBCAST(ea) ((((uint8 *)(ea))[0] & \ + ((uint8 *)(ea))[1] & \ + ((uint8 *)(ea))[2] & \ + ((uint8 *)(ea))[3] & \ + ((uint8 *)(ea))[4] & \ + ((uint8 *)(ea))[5]) == 0xff) + +static const struct ether_addr ether_bcast = {{255, 255, 255, 255, 255, 255}}; + +/* + * Takes a pointer, returns true if a 48-bit null address (all zeros) + */ +#define ETHER_ISNULLADDR(ea) ((((uint8 *)(ea))[0] | \ + ((uint8 *)(ea))[1] | \ + ((uint8 *)(ea))[2] | \ + ((uint8 *)(ea))[3] | \ + ((uint8 *)(ea))[4] | \ + ((uint8 *)(ea))[5]) == 0) + +/* Differentiated Services Codepoint - lower 6 bits of tos in iphdr */ +#define DSCP_PRI_MASK 0x3F /* bits 0-6 */ +#define DSCP_WME_PRI_MASK 0x38 /* bits 3-6 */ +#define DSCP_WME_PRI_SHIFT 3 + +#undef PACKED + +#endif /* _NET_ETHERNET_H_ */ diff --git a/package/wlcompat/src/include/shutils.h b/package/wlcompat/src/include/shutils.h new file mode 100644 index 0000000000..783ee9ede1 --- /dev/null +++ b/package/wlcompat/src/include/shutils.h @@ -0,0 +1,200 @@ +/* + * Shell-like utility functions + * + * Copyright 2004, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * + * $Id$ + */ + +#ifndef _shutils_h_ +#define _shutils_h_ +#include <string.h> +/* + * Reads file and returns contents + * @param fd file descriptor + * @return contents of file or NULL if an error occurred + */ +extern char * fd2str(int fd); + +/* + * Reads file and returns contents + * @param path path to file + * @return contents of file or NULL if an error occurred + */ +extern char * file2str(const char *path); + +/* + * Waits for a file descriptor to become available for reading or unblocked signal + * @param fd file descriptor + * @param timeout seconds to wait before timing out or 0 for no timeout + * @return 1 if descriptor changed status or 0 if timed out or -1 on error + */ +extern int waitfor(int fd, int timeout); + +/* + * Concatenates NULL-terminated list of arguments into a single + * commmand and executes it + * @param argv argument list + * @param path NULL, ">output", or ">>output" + * @param timeout seconds to wait before timing out or 0 for no timeout + * @param ppid NULL to wait for child termination or pointer to pid + * @return return value of executed command or errno + */ +extern int _eval(char *const argv[], char *path, int timeout, pid_t *ppid); + +/* + * Concatenates NULL-terminated list of arguments into a single + * commmand and executes it + * @param argv argument list + * @return stdout of executed command or NULL if an error occurred + */ +extern char * _backtick(char *const argv[]); + +/* + * Kills process whose PID is stored in plaintext in pidfile + * @param pidfile PID file + * @return 0 on success and errno on failure + */ +extern int kill_pidfile(char *pidfile); + +/* + * fread() with automatic retry on syscall interrupt + * @param ptr location to store to + * @param size size of each element of data + * @param nmemb number of elements + * @param stream file stream + * @return number of items successfully read + */ +extern int safe_fread(void *ptr, size_t size, size_t nmemb, FILE *stream); + +/* + * fwrite() with automatic retry on syscall interrupt + * @param ptr location to read from + * @param size size of each element of data + * @param nmemb number of elements + * @param stream file stream + * @return number of items successfully written + */ +extern int safe_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream); + +/* + * Convert Ethernet address string representation to binary data + * @param a string in xx:xx:xx:xx:xx:xx notation + * @param e binary data + * @return TRUE if conversion was successful and FALSE otherwise + */ +extern int ether_atoe(const char *a, unsigned char *e); + +/* + * Convert Ethernet address binary data to string representation + * @param e binary data + * @param a string in xx:xx:xx:xx:xx:xx notation + * @return a + */ +extern char * ether_etoa(const unsigned char *e, char *a); + +/* + * Concatenate two strings together into a caller supplied buffer + * @param s1 first string + * @param s2 second string + * @param buf buffer large enough to hold both strings + * @return buf + */ +static inline char * strcat_r(const char *s1, const char *s2, char *buf) +{ + strcpy(buf, s1); + strcat(buf, s2); + return buf; +} + +/* Check for a blank character; that is, a space or a tab */ +#define isblank(c) ((c) == ' ' || (c) == '\t') + +/* Strip trailing CR/NL from string <s> */ +#define chomp(s) ({ \ + char *c = (s) + strlen((s)) - 1; \ + while ((c > (s)) && (*c == '\n' || *c == '\r' || *c == ' ')) \ + *c-- = '\0'; \ + s; \ +}) + +/* Simple version of _backtick() */ +#define backtick(cmd, args...) ({ \ + char *argv[] = { cmd, ## args, NULL }; \ + _backtick(argv); \ +}) + +/* Simple version of _eval() (no timeout and wait for child termination) */ +#define eval(cmd, args...) ({ \ + char *argv[] = { cmd, ## args, NULL }; \ + _eval(argv, ">/dev/console", 0, NULL); \ +}) + +/* Copy each token in wordlist delimited by space into word */ +#define foreach(word, wordlist, next) \ + for (next = &wordlist[strspn(wordlist, " ")], \ + strncpy(word, next, sizeof(word)), \ + word[strcspn(word, " ")] = '\0', \ + word[sizeof(word) - 1] = '\0', \ + next = strchr(next, ' '); \ + strlen(word); \ + next = next ? &next[strspn(next, " ")] : "", \ + strncpy(word, next, sizeof(word)), \ + word[strcspn(word, " ")] = '\0', \ + word[sizeof(word) - 1] = '\0', \ + next = strchr(next, ' ')) + +/* Return NUL instead of NULL if undefined */ +#define safe_getenv(s) (getenv(s) ? : "") + +/* Print directly to the console */ +#define cprintf(fmt, args...) do { \ + FILE *fp = fopen("/dev/console", "w"); \ + if (fp) { \ + fprintf(fp, fmt, ## args); \ + fclose(fp); \ + } \ +} while (0) + +/* Debug print */ +#ifdef DEBUG +#define dprintf(fmt, args...) cprintf("%s: " fmt, __FUNCTION__, ## args) +#else +#define dprintf(fmt, args...) +#endif + +#ifdef vxworks + +#include <inetLib.h> +#define inet_aton(a, n) ((inet_aton((a), (n)) == ERROR) ? 0 : 1) +#define inet_ntoa(n) ({ char a[INET_ADDR_LEN]; inet_ntoa_b ((n), a); a; }) + +#include <typedefs.h> +#include <bcmutils.h> +#define ether_atoe(a, e) bcm_ether_atoe((a), (e)) +#define ether_etoa(e, a) bcm_ether_ntoa((e), (a)) + +/* These declarations are not available where you would expect them */ +extern int vsnprintf (char *, size_t, const char *, va_list); +extern int snprintf(char *str, size_t count, const char *fmt, ...); +extern char *strdup(const char *); +extern char *strsep(char **stringp, char *delim); +extern int strcasecmp(const char *s1, const char *s2); +extern int strncasecmp(const char *s1, const char *s2, size_t n); + +/* Neither are socket() and connect() */ +#include <sockLib.h> + +#ifdef DEBUG +#undef dprintf +#define dprintf printf +#endif +#endif + +#endif /* _shutils_h_ */ diff --git a/package/wlcompat/src/include/typedefs.h b/package/wlcompat/src/include/typedefs.h new file mode 100644 index 0000000000..6b0c25e042 --- /dev/null +++ b/package/wlcompat/src/include/typedefs.h @@ -0,0 +1,293 @@ +/* + * Copyright 2004, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * $Id$ + */ + +#ifndef _TYPEDEFS_H_ +#define _TYPEDEFS_H_ + + +/* Define 'SITE_TYPEDEFS' in the compile to include a site specific + * typedef file "site_typedefs.h". + * + * If 'SITE_TYPEDEFS' is not defined, then the "Inferred Typedefs" + * section of this file makes inferences about the compile environment + * based on defined symbols and possibly compiler pragmas. + * + * Following these two sections is the "Default Typedefs" + * section. This section is only prcessed if 'USE_TYPEDEF_DEFAULTS' is + * defined. This section has a default set of typedefs and a few + * proprocessor symbols (TRUE, FALSE, NULL, ...). + */ + +#ifdef SITE_TYPEDEFS + +/******************************************************************************* + * Site Specific Typedefs + *******************************************************************************/ + +#include "site_typedefs.h" + +#else + +/******************************************************************************* + * Inferred Typedefs + *******************************************************************************/ + +/* Infer the compile environment based on preprocessor symbols and pramas. + * Override type definitions as needed, and include configuration dependent + * header files to define types. + */ + +#ifdef __cplusplus + +#define TYPEDEF_BOOL +#ifndef FALSE +#define FALSE false +#endif +#ifndef TRUE +#define TRUE true +#endif + +#else /* ! __cplusplus */ + +/* for Windows build, define bool as a uchar instead of the default int */ +#if defined(_WIN32) + +#define TYPEDEF_BOOL +typedef unsigned char bool; + +#endif /* _WIN32 */ + +#endif /* ! __cplusplus */ + +#ifdef _MSC_VER /* Microsoft C */ +#define TYPEDEF_INT64 +#define TYPEDEF_UINT64 +typedef signed __int64 int64; +typedef unsigned __int64 uint64; +#endif + +#if defined(MACOSX) && defined(KERNEL) +#define TYPEDEF_BOOL +#endif + + +#if defined(linux) +#define TYPEDEF_UINT +#define TYPEDEF_USHORT +#define TYPEDEF_ULONG +#endif + +#if !defined(linux) && !defined(_WIN32) && !defined(PMON) && !defined(_CFE_) +#define TYPEDEF_UINT +#define TYPEDEF_USHORT +#endif + + +/* Do not support the (u)int64 types with strict ansi for GNU C */ +#if defined(__GNUC__) && defined(__STRICT_ANSI__) +#define TYPEDEF_INT64 +#define TYPEDEF_UINT64 +#endif + +/* ICL accepts unsigned 64 bit type only, and complains in ANSI mode + * for singned or unsigned */ +#if defined(__ICL) + +#define TYPEDEF_INT64 + +#if defined(__STDC__) +#define TYPEDEF_UINT64 +#endif + +#endif /* __ICL */ + + +#if !defined(_WIN32) && !defined(PMON) && !defined(_CFE_) + +/* pick up ushort & uint from standard types.h */ +#if defined(linux) && defined(__KERNEL__) + +#include <linux/types.h> /* sys/types.h and linux/types.h are oil and water */ + +#else + +#include <sys/types.h> + +#endif + +#endif /* !_WIN32 && !PMON && !_CFE_ */ + +#if defined(MACOSX) && defined(KERNEL) +#include <IOKit/IOTypes.h> +#endif + + +/* use the default typedefs in the next section of this file */ +#define USE_TYPEDEF_DEFAULTS + +#endif /* SITE_TYPEDEFS */ + + +/******************************************************************************* + * Default Typedefs + *******************************************************************************/ + +#ifdef USE_TYPEDEF_DEFAULTS +#undef USE_TYPEDEF_DEFAULTS + +#ifndef TYPEDEF_BOOL +typedef int bool; +#endif + +/*----------------------- define uchar, ushort, uint, ulong ----------------*/ + +#ifndef TYPEDEF_UCHAR +typedef unsigned char uchar; +#endif + +#ifndef TYPEDEF_USHORT +typedef unsigned short ushort; +#endif + +#ifndef TYPEDEF_UINT +typedef unsigned int uint; +#endif + +#ifndef TYPEDEF_ULONG +typedef unsigned long ulong; +#endif + +/*----------------------- define [u]int8/16/32/64 --------------------------*/ + +#ifndef TYPEDEF_UINT8 +typedef unsigned char uint8; +#endif + +#ifndef TYPEDEF_UINT16 +typedef unsigned short uint16; +#endif + +#ifndef TYPEDEF_UINT32 +typedef unsigned int uint32; +#endif + +#ifndef TYPEDEF_UINT64 +typedef unsigned long long uint64; +#endif + +#ifndef TYPEDEF_INT8 +typedef signed char int8; +#endif + +#ifndef TYPEDEF_INT16 +typedef signed short int16; +#endif + +#ifndef TYPEDEF_INT32 +typedef signed int int32; +#endif + +#ifndef TYPEDEF_INT64 +typedef signed long long int64; +#endif + +/*----------------------- define float32/64, float_t -----------------------*/ + +#ifndef TYPEDEF_FLOAT32 +typedef float float32; +#endif + +#ifndef TYPEDEF_FLOAT64 +typedef double float64; +#endif + +/* + * abstracted floating point type allows for compile time selection of + * single or double precision arithmetic. Compiling with -DFLOAT32 + * selects single precision; the default is double precision. + */ + +#ifndef TYPEDEF_FLOAT_T + +#if defined(FLOAT32) +typedef float32 float_t; +#else /* default to double precision floating point */ +typedef float64 float_t; +#endif + +#endif /* TYPEDEF_FLOAT_T */ + +/*----------------------- define macro values -----------------------------*/ + +#ifndef FALSE +#define FALSE 0 +#endif + +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef NULL +#define NULL 0 +#endif + +#ifndef OFF +#define OFF 0 +#endif + +#ifndef ON +#define ON 1 +#endif + +/*----------------------- define PTRSZ, INLINE ----------------------------*/ + +#ifndef PTRSZ +#define PTRSZ sizeof (char*) +#endif + +#ifndef INLINE + +#ifdef _MSC_VER + +#define INLINE __inline + +#elif __GNUC__ + +#define INLINE __inline__ + +#else + +#define INLINE + +#endif /* _MSC_VER */ + +#endif /* INLINE */ + +#undef TYPEDEF_BOOL +#undef TYPEDEF_UCHAR +#undef TYPEDEF_USHORT +#undef TYPEDEF_UINT +#undef TYPEDEF_ULONG +#undef TYPEDEF_UINT8 +#undef TYPEDEF_UINT16 +#undef TYPEDEF_UINT32 +#undef TYPEDEF_UINT64 +#undef TYPEDEF_INT8 +#undef TYPEDEF_INT16 +#undef TYPEDEF_INT32 +#undef TYPEDEF_INT64 +#undef TYPEDEF_FLOAT32 +#undef TYPEDEF_FLOAT64 +#undef TYPEDEF_FLOAT_T + +#endif /* USE_TYPEDEF_DEFAULTS */ + +#endif /* _TYPEDEFS_H_ */ diff --git a/package/wlcompat/src/include/utils.h b/package/wlcompat/src/include/utils.h new file mode 100644 index 0000000000..b8d1cdb7bf --- /dev/null +++ b/package/wlcompat/src/include/utils.h @@ -0,0 +1,131 @@ +#include <cy_conf.h> + +extern int diag_led(int type, int act); +extern int C_led(int i); +extern int get_single_ip(char *ipaddr, int which); +extern char *get_mac_from_ip(char *ip); +extern struct dns_lists *get_dns_list(int no); +extern int dns_to_resolv(void); +extern char *get_wan_face(void); +extern int check_wan_link(int num); +extern char *get_complete_lan_ip(char *ip); +extern int get_int_len(int num); +extern int file_to_buf(char *path, char *buf, int len); +extern int buf_to_file(char *path, char *buf); +extern pid_t* find_pid_by_name( char* pidName); +extern int find_pid_by_ps(char* pidName); +extern int *find_all_pid_by_ps(char* pidName); +extern char *find_name_by_proc(int pid); +extern int get_ppp_pid(char *file); +extern long convert_ver(char *ver); +extern int check_flash(void); +extern int check_action(void); +extern int check_now_boot(void); +extern int check_hw_type(void); +extern int is_exist(char *filename); +extern void set_ip_forward(char c); +struct mtu_lists *get_mtu(char *proto); +extern void set_host_domain_name(void); + +extern void encode(char *buf, int len); +extern void decode(char *buf, int len); + +extern int sys_netdev_ioctl(int family, int socket, char *if_name, int cmd, struct ifreq *ifr); + +int ct_openlog(const char *ident, int option, int facility, char *log_name); +void ct_syslog(int level, int enable, const char *fmt,...); +void ct_logger(int level, const char *fmt,...); +struct wl_assoc_mac * get_wl_assoc_mac(int *c); + + + +enum { DMZ, SESSION, DIAG , WL}; + +enum { START_LED, STOP_LED }; + +typedef enum { ACT_IDLE, + ACT_TFTP_UPGRADE, + ACT_WEB_UPGRADE, + ACT_WEBS_UPGRADE, + ACT_SW_RESTORE, + ACT_HW_RESTORE } ACTION; + +enum { UNKNOWN_BOOT = -1, PMON_BOOT, CFE_BOOT }; + +enum { BCM4702_CHIP, BCM4712_CHIP, BCM5325E_CHIP }; + +enum { FIRST, SECOND }; + +enum { SYSLOG_LOG=1, SYSLOG_DEBUG, CONSOLE_ONLY, LOG_CONSOLE, DEBUG_CONSOLE }; + +#define ACTION(cmd) buf_to_file(ACTION_FILE, cmd) + +struct dns_lists { + int num_servers; + char dns_server[4][16]; +}; + +#define NOT_USING 0 +#define USING 1 + +struct wl_assoc_mac +{ + char mac[18]; +}; + +struct mtu_lists { + char *proto; /* protocol */ + char *min; /* min mtu */ + char *max; /* max mtu */ +}; + + +#define PPP_PSEUDO_IP "10.64.64.64" +#define PPP_PSEUDO_NM "255.255.255.255" +#define PPP_PSEUDO_GW "10.112.112.112" + +#define PING_TMP "/tmp/ping.log" +#define TRACEROUTE_TMP "/tmp/traceroute.log" +#define MAX_BUF_LEN 254 + +#define RESOLV_FILE "/tmp/resolv.conf" +#define HOSTS_FILE "/tmp/hosts" + +#define LOG_FILE "/var/log/mess" + +#define ACTION_FILE "/tmp/action" + + +#define split(word, wordlist, next, delim) \ + for (next = wordlist, \ + strncpy(word, next, sizeof(word)), \ + word[(next=strstr(next, delim)) ? strstr(word, delim) - word : sizeof(word) - 1] = '\0', \ + next = next ? next + sizeof(delim) - 1 : NULL ; \ + strlen(word); \ + next = next ? : "", \ + strncpy(word, next, sizeof(word)), \ + word[(next=strstr(next, delim)) ? strstr(word, delim) - word : sizeof(word) - 1] = '\0', \ + next = next ? next + sizeof(delim) - 1 : NULL) + +#define STRUCT_LEN(name) sizeof(name)/sizeof(name[0]) + +#define printHEX(str,len) { \ + int i; \ + for (i=0 ; i<len ; i++) { \ + printf("%02X ", (unsigned char)*(str+i)); \ + if(((i+1)%16) == 0) printf("- "); \ + if(((i+1)%32) == 0) printf("\n"); \ + } \ + printf("\n\n"); \ +} + + +#define printASC(str,len) { \ + int i; \ + for (i=0 ; i<len ; i++) { \ + printf("%c", (unsigned char)*(str+i)); \ + if(((i+1)%16) == 0) printf("- "); \ + if(((i+1)%32) == 0) printf("\n"); \ + } \ + printf("\n\n"); \ +} diff --git a/package/wlcompat/src/include/wlcompat.h b/package/wlcompat/src/include/wlcompat.h new file mode 100644 index 0000000000..a4fc13439d --- /dev/null +++ b/package/wlcompat/src/include/wlcompat.h @@ -0,0 +1,36 @@ +/* + * wlcompat.h + * + * Copyright (C) 2005 Felix Fietkau <nbd@vd-s.ath.cx> + * + * 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 the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + */ +#include <linux/wireless.h> + +#ifndef WLCOMPAT_H +#define WLCOMPAT_H + +#define WLCOMPAT_SET_MONITOR SIOCIWFIRSTPRIV + 0 +#define WLCOMPAT_GET_MONITOR SIOCIWFIRSTPRIV + 1 +#define WLCOMPAT_SET_TXPWR_LIMIT SIOCIWFIRSTPRIV + 2 +#define WLCOMPAT_GET_TXPWR_LIMIT SIOCIWFIRSTPRIV + 3 +#define WLCOMPAT_SET_ANTDIV SIOCIWFIRSTPRIV + 4 +#define WLCOMPAT_GET_ANTDIV SIOCIWFIRSTPRIV + 5 +#define WLCOMPAT_SET_TXANT SIOCIWFIRSTPRIV + 6 +#define WLCOMPAT_GET_TXANT SIOCIWFIRSTPRIV + 7 + +#endif diff --git a/package/wlcompat/src/include/wlioctl.h b/package/wlcompat/src/include/wlioctl.h new file mode 100644 index 0000000000..d5ef11f9ed --- /dev/null +++ b/package/wlcompat/src/include/wlioctl.h @@ -0,0 +1,1094 @@ +/* + * Custom OID/ioctl definitions for + * Broadcom 802.11abg Networking Device Driver + * + * Definitions subject to change without notice. + * + * Copyright 2004, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * + * $Id$ + */ + +#ifndef _wlioctl_h_ +#define _wlioctl_h_ + +#include <typedefs.h> +#include <proto/ethernet.h> +#include <proto/802.11.h> + +#if defined(__GNUC__) +#define PACKED __attribute__((packed)) +#else +#define PACKED +#endif + +#define WLC_ESSID_MAX_SIZE 32 + +#define WL_NUMRATES 255 /* max # of rates in a rateset */ + +typedef struct wl_rateset { + uint32 count; /* # rates in this set */ + uint8 rates[WL_NUMRATES]; /* rates in 500kbps units w/hi bit set if basic */ +} wl_rateset_t; + +#define WL_CHANSPEC_CHAN_MASK 0x0fff +#define WL_CHANSPEC_BAND_MASK 0xf000 +#define WL_CHANSPEC_BAND_SHIFT 12 +#define WL_CHANSPEC_BAND_A 0x1000 +#define WL_CHANSPEC_BAND_B 0x2000 + +/* + * Per-bss information structure. + */ + +#define WL_LEGACY_BSS_INFO_VERSION 106 /* an older supported version of wl_bss_info struct */ +#define WL_BSS_INFO_VERSION 107 /* current version of wl_bss_info struct */ + +typedef struct wl_bss_info106 { + uint version; /* version field */ + struct ether_addr BSSID; + uint8 SSID_len; + uint8 SSID[32]; + uint8 Privacy; /* 0=No WEP, 1=Use WEP */ + int16 RSSI; /* receive signal strength (in dBm) */ + uint16 beacon_period; /* units are Kusec */ + uint16 atim_window; /* units are Kusec */ + uint8 channel; /* Channel no. */ + int8 infra; /* 0=IBSS, 1=infrastructure, 2=unknown */ + struct { + uint count; /* # rates in this set */ + uint8 rates[12]; /* rates in 500kbps units w/hi bit set if basic */ + } rateset; /* supported rates */ + uint8 dtim_period; /* DTIM period */ + int8 phy_noise; /* noise right after tx (in dBm) */ + uint16 capability; /* Capability information */ + struct dot11_bcn_prb *prb; /* probe response frame (ioctl na) */ + uint16 prb_len; /* probe response frame length (ioctl na) */ + struct { + uint8 supported; /* wpa supported */ + uint8 multicast; /* multicast cipher */ + uint8 ucount; /* count of unicast ciphers */ + uint8 unicast[4]; /* unicast ciphers */ + uint8 acount; /* count of auth modes */ + uint8 auth[4]; /* Authentication modes */ + } wpa; +} wl_bss_info106_t; + +typedef struct wl_bss_info { + uint32 version; /* version field */ + uint32 length; /* byte length of data in this record, starting at version and including IEs */ + struct ether_addr BSSID; + uint16 beacon_period; /* units are Kusec */ + uint16 capability; /* Capability information */ + uint8 SSID_len; + uint8 SSID[32]; + struct { + uint count; /* # rates in this set */ + uint8 rates[16]; /* rates in 500kbps units w/hi bit set if basic */ + } rateset; /* supported rates */ + uint8 channel; /* Channel no. */ + uint16 atim_window; /* units are Kusec */ + uint8 dtim_period; /* DTIM period */ + int16 RSSI; /* receive signal strength (in dBm) */ + int8 phy_noise; /* noise (in dBm) */ + uint32 ie_length; /* byte length of Information Elements */ + /* variable length Information Elements */ +} wl_bss_info_t; + +typedef struct wlc_ssid { + uint32 SSID_len; + uchar SSID[32]; +} wlc_ssid_t; + +typedef struct wl_scan_params { + wlc_ssid_t ssid; /* default is {0, ""} */ + struct ether_addr bssid;/* default is bcast */ + int8 bss_type; /* default is any, DOT11_BSSTYPE_ANY/INFRASTRUCTURE/INDEPENDENT */ + int8 scan_type; /* -1 use default, DOT11_SCANTYPE_ACTIVE/PASSIVE */ + int32 nprobes; /* -1 use default, number of probes per channel */ + int32 active_time; /* -1 use default, dwell time per channel for active scanning */ + int32 passive_time; /* -1 use default, dwell time per channel for passive scanning */ + int32 home_time; /* -1 use default, dwell time for the home channel between channel scans */ + int32 channel_num; /* 0 use default (all available channels), count of channels in channel_list */ + uint16 channel_list[1]; /* list of chanspecs */ +} wl_scan_params_t; +/* size of wl_scan_params not including variable length array */ +#define WL_SCAN_PARAMS_FIXED_SIZE 64 + +typedef struct wl_scan_results { + uint32 buflen; + uint32 version; + uint32 count; + wl_bss_info_t bss_info[1]; +} wl_scan_results_t; +/* size of wl_scan_results not including variable length array */ +#define WL_SCAN_RESULTS_FIXED_SIZE 12 + +/* uint32 list */ +typedef struct wl_uint32_list { + /* in - # of elements, out - # of entries */ + uint32 count; + /* variable length uint32 list */ + uint32 element[1]; +} wl_uint32_list_t; + +#define WLC_CNTRY_BUF_SZ 4 /* Country string is 3 bytes + NULL */ + +typedef struct wl_channels_in_country { + uint32 buflen; + uint32 band; + char country_abbrev[WLC_CNTRY_BUF_SZ]; + uint32 count; + uint32 channel[1]; +} wl_channels_in_country_t; + +typedef struct wl_country_list { + uint32 buflen; + uint32 band_set; + uint32 band; + uint32 count; + char country_abbrev[1]; +} wl_country_list_t; + +#define WL_RM_TYPE_BASIC 1 +#define WL_RM_TYPE_CCA 2 +#define WL_RM_TYPE_RPI 3 + +#define WL_RM_FLAG_PARALLEL (1<<0) + +#define WL_RM_FLAG_LATE (1<<1) +#define WL_RM_FLAG_INCAPABLE (1<<2) +#define WL_RM_FLAG_REFUSED (1<<3) + +typedef struct wl_rm_req_elt { + int8 type; + int8 flags; + uint16 chanspec; + uint32 token; /* token for this measurement */ + uint32 tsf_h; /* TSF high 32-bits of Measurement start time */ + uint32 tsf_l; /* TSF low 32-bits */ + uint32 dur; /* TUs */ +} wl_rm_req_elt_t; + +typedef struct wl_rm_req { + uint32 token; /* overall measurement set token */ + uint32 count; /* number of measurement reqests */ + wl_rm_req_elt_t req[1]; /* variable length block of requests */ +} wl_rm_req_t; +#define WL_RM_REQ_FIXED_LEN 8 + +typedef struct wl_rm_rep_elt { + int8 type; + int8 flags; + uint16 chanspec; + uint32 token; /* token for this measurement */ + uint32 tsf_h; /* TSF high 32-bits of Measurement start time */ + uint32 tsf_l; /* TSF low 32-bits */ + uint32 dur; /* TUs */ + uint32 len; /* byte length of data block */ + uint8 data[1]; /* variable length data block */ +} wl_rm_rep_elt_t; +#define WL_RM_REP_ELT_FIXED_LEN 24 /* length excluding data block */ + +#define WL_RPI_REP_BIN_NUM 8 +typedef struct wl_rm_rpi_rep { + uint8 rpi[WL_RPI_REP_BIN_NUM]; + int8 rpi_max[WL_RPI_REP_BIN_NUM]; +} wl_rm_rpi_rep_t; + +typedef struct wl_rm_rep { + uint32 token; /* overall measurement set token */ + uint32 len; /* length of measurement report block */ + wl_rm_rep_elt_t rep[1]; /* variable length block of reports */ +} wl_rm_rep_t; +#define WL_RM_REP_FIXED_LEN 8 + + +#define WLC_MAX_KEY_SIZE 32 /* max size of any key */ +#define WLC_MAX_IV_SIZE 16 /* max size of any IV */ +#define WLC_EXT_IV_FLAG (1<<5) /* flag to indicate IV is > 4 bytes */ +#define WLC_MAX_DEFAULT_KEYS 4 /* # of default WEP keys */ +#define WLC_MAX_KEYS 54 /* Max # of WEP keys */ +#define WLC_WEP1_KEY_SIZE 5 /* max size of any WEP key */ +#define WLC_WEP1_KEY_HEX_SIZE 10 /* size of WEP key in hex. */ +#define WLC_WEP128_KEY_SIZE 13 /* max size of any WEP key */ +#define WLC_WEP128_KEY_HEX_SIZE 26 /* size of WEP key in hex. */ +#define WLC_TKIP_MIC_SIZE 8 /* size of TKIP MIC */ +#define WLC_TKIP_EOM_SIZE 7 /* max size of TKIP EOM */ +#define WLC_TKIP_EOM_FLAG 0x5a /* TKIP EOM flag byte */ +#define WLC_TKIP_KEY_SIZE 32 /* size of any TKIP key */ +#define WLC_TKIP_MIC_AUTH_TX 16 /* offset to Authenticator MIC TX key */ +#define WLC_TKIP_MIC_AUTH_RX 24 /* offset to Authenticator MIC RX key */ +#define WLC_TKIP_MIC_SUP_RX 16 /* offset to Supplicant MIC RX key */ +#define WLC_TKIP_MIC_SUP_TX 24 /* offset to Supplicant MIC TX key */ +#define WLC_TKIP_P1_KEY_SIZE 10 /* size of TKHash Phase1 output, in bytes */ +#define WLC_TKIP_P2_KEY_SIZE 16 /* size of TKHash Phase2 output */ +#define WLC_AES_KEY_SIZE 16 /* size of AES key */ + + +typedef enum sup_auth_status { + WLC_SUP_DISCONNECTED = 0, + WLC_SUP_CONNECTING, + WLC_SUP_IDREQUIRED, + WLC_SUP_AUTHENTICATING, + WLC_SUP_AUTHENTICATED, + WLC_SUP_KEYXCHANGE, + WLC_SUP_KEYED +} sup_auth_status_t; + +/* Enumerate crypto algorithms */ +#define CRYPTO_ALGO_OFF 0 +#define CRYPTO_ALGO_WEP1 1 +#define CRYPTO_ALGO_TKIP 2 +#define CRYPTO_ALGO_WEP128 3 +#define CRYPTO_ALGO_AES_CCM 4 +#define CRYPTO_ALGO_AES_OCB_MSDU 5 +#define CRYPTO_ALGO_AES_OCB_MPDU 6 +#define CRYPTO_ALGO_NALG 7 + +#define WSEC_GEN_MIC_ERROR 0x0001 +#define WSEC_GEN_REPLAY 0x0002 + +#define WL_SOFT_KEY (1 << 0) /* Indicates this key is using soft encrypt */ +#define WL_PRIMARY_KEY (1 << 1) /* Indicates this key is the primary (ie tx) key */ +#define WL_KF_RES_4 (1 << 4) /* Reserved for backward compat */ +#define WL_KF_RES_5 (1 << 5) /* Reserved for backward compat */ + + +typedef struct wlc_tkip_info { + uint16 phase1[WLC_TKIP_P1_KEY_SIZE/sizeof(uint16)]; /* tkhash phase1 result */ + uint8 phase2[WLC_TKIP_P2_KEY_SIZE]; /* tkhash phase2 result */ + uint32 micl; + uint32 micr; +} tkip_info_t; + +typedef struct _wsec_iv { + uint32 hi; /* upper 32 bits of IV */ + uint16 lo; /* lower 16 bits of IV */ +} wsec_iv_t; + +typedef struct wsec_key { + uint32 index; /* key index */ + uint32 len; /* key length */ + uint8 data[WLC_MAX_KEY_SIZE]; /* key data */ + tkip_info_t tkip_tx; /* tkip transmit state */ + tkip_info_t tkip_rx; /* tkip receive state */ + uint32 algo; /* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */ + uint32 flags; /* misc flags */ + uint32 algo_hw; /* cache for hw register*/ + uint32 aes_mode; /* cache for hw register*/ + int iv_len; /* IV length */ + int iv_initialized; /* has IV been initialized already? */ + int icv_len; /* ICV length */ + wsec_iv_t rxiv; /* Rx IV */ + wsec_iv_t txiv; /* Tx IV */ + struct ether_addr ea; /* per station */ +} wsec_key_t; + + + +typedef struct wl_wsec_key { + uint32 index; /* key index */ + uint32 len; /* key length */ + uint8 data[DOT11_MAX_KEY_SIZE]; /* key data */ + uint32 pad_1[18]; + uint32 algo; /* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */ + uint32 flags; /* misc flags */ + uint32 pad_2[2]; + int pad_3; + int iv_initialized; /* has IV been initialized already? */ + int pad_4; + /* Rx IV */ + struct { + uint32 hi; /* upper 32 bits of IV */ + uint16 lo; /* lower 16 bits of IV */ + } rxiv; + uint32 pad_5[2]; + struct ether_addr ea; /* per station */ +} wl_wsec_key_t; + +/* For use with wlc_wep_key.flags */ +#define WSEC_PRIMARY_KEY (1 << 1) /* Indicates this key is the primary (ie tx) key */ +#define WSEC_TKIP_ERROR (1 << 2) /* Provoke deliberate error */ + +#define WSEC_MIN_PSK_LEN 8 +#define WSEC_MAX_PSK_LEN 64 + +/* Flag for key material needing passhash'ing */ +#define WSEC_PASSPHRASE (1<<0) + +/* recepticle for WLC_SET_WSEC_PMK parameter */ +typedef struct { + ushort key_len; /* octets in key material */ + ushort flags; /* key handling qualification */ + uint8 key[WSEC_MAX_PSK_LEN]; /* PMK material */ +} wsec_pmk_t; + +/* wireless security bitvec */ +#define WEP_ENABLED 1 +#define TKIP_ENABLED 2 +#define AES_ENABLED 4 +#define WSEC_SWFLAG 8 + +#define WSEC_SW(wsec) ((wsec) & WSEC_SWFLAG) +#define WSEC_HW(wsec) (!WSEC_SW(wsec)) +#define WSEC_WEP_ENABLED(wsec) ((wsec) & WEP_ENABLED) +#define WSEC_TKIP_ENABLED(wsec) ((wsec) & TKIP_ENABLED) +#define WSEC_AES_ENABLED(wsec) ((wsec) & AES_ENABLED) +#define WSEC_ENABLED(wsec) ((wsec) & (WEP_ENABLED | TKIP_ENABLED | AES_ENABLED)) + + +/* wireless authentication bit vector */ +#define WPA_ENABLED 1 +#define PSK_ENABLED 2 + +#define WAUTH_WPA_ENABLED(wauth) ((wauth) & WPA_ENABLED) +#define WAUTH_PSK_ENABLED(wauth) ((wauth) & PSK_ENABLED) +#define WAUTH_ENABLED(wauth) ((wauth) & (WPA_ENABLED | PSK_ENABLED)) + +/* group/mcast cipher */ +#define WPA_MCAST_CIPHER(wsec) (((wsec) & TKIP_ENABLED) ? WPA_CIPHER_TKIP : \ + ((wsec) & AES_ENABLED) ? WPA_CIPHER_AES_CCM : \ + WPA_CIPHER_NONE) + + +typedef struct wl_led_info { + uint32 index; /* led index */ + uint32 behavior; + bool activehi; +} wl_led_info_t; + +/* + * definitions for driver messages passed from WL to NAS. + */ +/* Use this to recognize wpa and 802.1x driver messages. */ +static const uint8 wl_wpa_snap_template[] = + { 0xaa, 0xaa, 0x03, 0x00, 0x90, 0x4c }; + +#define WL_WPA_MSG_IFNAME_MAX 16 + +/* WPA driver message */ +typedef struct wl_wpa_header { + struct ether_header eth; + struct dot11_llc_snap_header snap; + uint8 version; + uint8 type; + /* version 2 additions */ + char ifname[WL_WPA_MSG_IFNAME_MAX]; + /* version specific data */ + /* uint8 data[1]; */ +} wl_wpa_header_t PACKED; + +/* + * definitions for 802.2 messages passed from WL to NAS. + */ +/* This seems not to be defined outside the kernel on linux. */ +#ifndef ETH_P_802_2 +#define ETH_P_802_2 4 +#endif + +#define WL_WPA_HEADER_LEN (ETHER_HDR_LEN + DOT11_LLC_SNAP_HDR_LEN + 2 + WL_WPA_MSG_IFNAME_MAX) + +/* WPA driver message ethertype - private between wlc and nas */ +#define WL_WPA_ETHER_TYPE 0x9999 + +/* WPA driver message current version */ +#define WL_WPA_MSG_VERSION 2 + +/* Type field values for the 802.2 driver messages for WPA. */ +#define WLC_ASSOC_MSG 1 +#define WLC_DISASSOC_MSG 2 +#define WLC_PTK_MIC_MSG 3 +#define WLC_GTK_MIC_MSG 4 + +/* Use this to recognize 802.2 driver messages. */ +static const uint8 wpa_snap_template[] = + { 0xaa, 0xaa, 0x03, 0x00, 0x90, 0x4c }; + + +/* 802.1x driver message */ +typedef struct wl_eapol_header { + struct ether_header eth; + struct dot11_llc_snap_header snap; + uint8 version; + uint8 reserved; + char ifname[WL_WPA_MSG_IFNAME_MAX]; + /* version specific data */ + /* uint8 802_1x_msg[1]; */ +} wl_eapol_header_t PACKED; + +#define WL_EAPOL_HEADER_LEN (ETHER_HDR_LEN + DOT11_LLC_SNAP_HDR_LEN + 2 + WL_WPA_MSG_IFNAME_MAX) + +/* 802.1x driver message ethertype - private between wlc and nas */ +#define WL_EAPOL_ETHER_TYPE 0x999A + +/* 802.1x driver message current version */ +#define WL_EAPOL_MSG_VERSION 1 + +/* srom read/write struct passed through ioctl */ +typedef struct { + uint byteoff; /* byte offset */ + uint nbytes; /* number of bytes */ + uint16 buf[1]; +} srom_rw_t; + +/* R_REG and W_REG struct passed through ioctl */ +typedef struct { + uint32 byteoff; /* byte offset of the field in d11regs_t */ + uint32 val; /* read/write value of the field */ + uint32 size; /* sizeof the field */ +} rw_reg_t; + +/* Structure used by GET/SET_ATTEN ioctls */ +typedef struct { + uint16 auto_ctrl; /* 1: Automatic control, 0: overriden */ + uint16 bb; /* Baseband attenuation */ + uint16 radio; /* Radio attenuation */ + uint16 txctl1; /* Radio TX_CTL1 value */ +} atten_t; + +/* Used to get specific STA parameters */ +typedef struct { + uint32 val; + struct ether_addr ea; +} scb_val_t; + +/* callback registration data types */ + +typedef struct _mac_event_params { + uint msg; + struct ether_addr *addr; + uint result; + uint status; + uint auth_type; +} mac_event_params_t; + +typedef struct _mic_error_params { + struct ether_addr *ea; + bool group; + bool flush_txq; +} mic_error_params_t; + +typedef enum _wl_callback { + WL_MAC_EVENT_CALLBACK = 0, + WL_LINK_UP_CALLBACK, + WL_LINK_DOWN_CALLBACK, + WL_MIC_ERROR_CALLBACK, + WL_LAST_CALLBACK +} wl_callback_t; + +typedef struct _callback { + void (*fn)(void *, void *); + void *context; +} callback_t; + +typedef struct _scan_callback { + void (*fn)(void *); + void *context; +} scan_callback_t; + +/* used to register an arbitrary callback via the IOCTL interface */ +typedef struct _set_callback { + int index; + callback_t callback; +} set_callback_t; + + + +/* Event data type */ +typedef struct { + uint msg; /* Message (see below) */ + struct ether_addr *addr; /* Station address (if applicable) */ + uint status; /* Status code (see below) */ + uint reason; /* Reason code (if applicable) */ + uint auth_type; /* WLC_E_AUTH */ + bool link; /* WLC_E_LINK */ + bool group; /* WLC_E_MIC_ERROR */ + bool flush_txq; /* WLC_E_MIC_ERROR */ +} wlc_event_t; + +typedef struct { + uint16 ver; /* version of this struct */ + uint16 cap; /* sta's advertized capabilities */ + uint32 flags; /* flags defined below */ + uint32 idle; /* time since data pkt rx'd from sta */ + struct ether_addr ea; /* Station address */ + wl_rateset_t rateset; /* rateset in use */ +} sta_info_t; + +#define WL_STA_INFO_LEN 300 +#define WL_STA_VER 1 + +/* flags fields */ +#define WL_STA_BRCM 0x01 +#define WL_STA_WME 0x02 +#define WL_STA_ABCAP 0x04 +#define WL_STA_AUTHE 0x08 +#define WL_STA_ASSOC 0x10 +#define WL_STA_AUTHO 0x20 + +/* Event messages */ +#define WLC_E_SET_SSID 1 +#define WLC_E_JOIN 2 +#define WLC_E_START 3 +#define WLC_E_AUTH 4 +#define WLC_E_AUTH_IND 5 +#define WLC_E_DEAUTH 6 +#define WLC_E_DEAUTH_IND 7 +#define WLC_E_ASSOC 8 +#define WLC_E_ASSOC_IND 9 +#define WLC_E_REASSOC 10 +#define WLC_E_REASSOC_IND 11 +#define WLC_E_DISASSOC 12 +#define WLC_E_DISASSOC_IND 13 +#define WLC_E_QUIET_START 14 /* 802.11h Quiet period started */ +#define WLC_E_QUIET_END 15 /* 802.11h Quiet period ended */ +#define WLC_E_GOT_BEACONS 16 +#define WLC_E_LINK 17 /* Link indication */ +#define WLC_E_MIC_ERROR 18 /* TKIP MIC error occurred */ +#define WLC_E_NDIS_LINK 19 /* NDIS style link indication */ +#define WLC_E_ROAM 20 +#define WLC_E_LAST 21 + +/* Event status codes */ +#define WLC_E_STATUS_SUCCESS 0 +#define WLC_E_STATUS_FAIL 1 +#define WLC_E_STATUS_TIMEOUT 2 +#define WLC_E_STATUS_NO_NETWORKS 3 +#define WLC_E_STATUS_ABORT 4 + +typedef struct wlc_event_cb { + uint msg; /* Event message or 0 for all */ + void (*fn)(void *, wlc_event_t *); /* Callback function */ + void *context; /* Passed to callback function */ + struct wlc_event_cb *next; /* Next in the chain */ +} wlc_event_cb_t; + +/* + * Country locale determines which channels are available to us. + */ +typedef enum _wlc_locale { + WLC_WW = 0, /* Worldwide */ + WLC_THA, /* Thailand */ + WLC_ISR, /* Israel */ + WLC_JDN, /* Jordan */ + WLC_PRC, /* China */ + WLC_JPN, /* Japan */ + WLC_FCC, /* USA */ + WLC_EUR, /* Europe */ + WLC_USL, /* US Low Band only */ + WLC_JPH, /* Japan High Band only */ + WLC_ALL, /* All the channels in this band */ + WLC_11D, /* Represents locale recieved by 11d beacons */ + WLC_LAST_LOCALE, + WLC_UNDEFINED_LOCALE = 0xf +} wlc_locale_t; + +/* channel encoding */ +typedef struct channel_info { + int hw_channel; + int target_channel; + int scan_channel; +} channel_info_t; + +/* For ioctls that take a list of MAC addresses */ +struct maclist { + uint count; /* number of MAC addresses */ + struct ether_addr ea[1]; /* variable length array of MAC addresses */ +}; + +/* get pkt count struct passed through ioctl */ +typedef struct get_pktcnt { + uint rx_good_pkt; + uint rx_bad_pkt; + uint tx_good_pkt; + uint tx_bad_pkt; +} get_pktcnt_t; + +/* Linux network driver ioctl encoding */ +typedef struct wl_ioctl { + uint cmd; /* common ioctl definition */ + void *buf; /* pointer to user buffer */ + uint len; /* length of user buffer */ + bool set; /* get or set request (optional) */ + uint used; /* bytes read or written (optional) */ + uint needed; /* bytes needed (optional) */ +} wl_ioctl_t; + +/* + * Structure for passing hardware and software + * revision info up from the driver. + */ +typedef struct wlc_rev_info { + uint vendorid; /* PCI vendor id */ + uint deviceid; /* device id of chip */ + uint radiorev; /* radio revision */ + uint chiprev; /* chip revision */ + uint corerev; /* core revision */ + uint boardid; /* board identifier (usu. PCI sub-device id) */ + uint boardvendor; /* board vendor (usu. PCI sub-vendor id) */ + uint boardrev; /* board revision */ + uint driverrev; /* driver version */ + uint ucoderev; /* microcode version */ + uint bus; /* bus type */ + uint chipnum; /* chip number */ +} wlc_rev_info_t; + +/* check this magic number */ +#define WLC_IOCTL_MAGIC 0x14e46c77 + +/* bump this number if you change the ioctl interface */ +#define WLC_IOCTL_VERSION 1 + +/* maximum length buffer required */ +#define WLC_IOCTL_MAXLEN 8192 + +/* common ioctl definitions */ +#define WLC_GET_MAGIC 0 +#define WLC_GET_VERSION 1 +#define WLC_UP 2 +#define WLC_DOWN 3 +#define WLC_GET_LOOP 4 +#define WLC_SET_LOOP 5 +#define WLC_DUMP 6 +#define WLC_GET_MSGLEVEL 7 +#define WLC_SET_MSGLEVEL 8 +#define WLC_GET_PROMISC 9 +#define WLC_SET_PROMISC 10 +#define WLC_OBSOLETE 11 +#define WLC_GET_RATE 12 +#define WLC_SET_RATE 13 +#define WLC_GET_INSTANCE 14 +#define WLC_GET_FRAG 15 +#define WLC_SET_FRAG 16 +#define WLC_GET_RTS 17 +#define WLC_SET_RTS 18 +#define WLC_GET_INFRA 19 +#define WLC_SET_INFRA 20 +#define WLC_GET_AUTH 21 +#define WLC_SET_AUTH 22 +#define WLC_GET_BSSID 23 +#define WLC_SET_BSSID 24 +#define WLC_GET_SSID 25 +#define WLC_SET_SSID 26 +#define WLC_RESTART 27 +#define WLC_DUMP_SCB 28 +#define WLC_GET_CHANNEL 29 +#define WLC_SET_CHANNEL 30 +#define WLC_GET_SRL 31 +#define WLC_SET_SRL 32 +#define WLC_GET_LRL 33 +#define WLC_SET_LRL 34 +#define WLC_GET_PLCPHDR 35 +#define WLC_SET_PLCPHDR 36 +#define WLC_GET_RADIO 37 +#define WLC_SET_RADIO 38 +#define WLC_GET_PHYTYPE 39 +#define WLC_DUMP_RATE 40 +#define WLC_SET_RATE_PARAMS 41 +#define WLC_GET_WEP 42 +#define WLC_SET_WEP 43 +#define WLC_GET_KEY 44 +#define WLC_SET_KEY 45 +#define WLC_GET_REGULATORY 46 +#define WLC_SET_REGULATORY 47 +#define WLC_GET_PASSIVE 48 /* added by nbd */ +#define WLC_SET_PASSIVE 49 /* added by nbd */ +#define WLC_SCAN 50 +#define WLC_SCAN_RESULTS 51 +#define WLC_DISASSOC 52 +#define WLC_REASSOC 53 +#define WLC_GET_ROAM_TRIGGER 54 +#define WLC_SET_ROAM_TRIGGER 55 +#define WLC_GET_ROAM_DELTA 56 +#define WLC_SET_ROAM_DELTA 57 +#define WLC_GET_ROAM_SCAN_PERIOD 58 +#define WLC_SET_ROAM_SCAN_PERIOD 59 +#define WLC_EVM 60 +#define WLC_GET_TXANT 61 +#define WLC_SET_TXANT 62 +#define WLC_GET_ANTDIV 63 +#define WLC_SET_ANTDIV 64 +#define WLC_GET_TXPWR 65 +#define WLC_SET_TXPWR 66 +#define WLC_GET_CLOSED 67 +#define WLC_SET_CLOSED 68 +#define WLC_GET_MACLIST 69 +#define WLC_SET_MACLIST 70 +#define WLC_GET_RATESET 71 +#define WLC_SET_RATESET 72 +#define WLC_GET_LOCALE 73 +#define WLC_SET_LOCALE 74 +#define WLC_GET_BCNPRD 75 +#define WLC_SET_BCNPRD 76 +#define WLC_GET_DTIMPRD 77 +#define WLC_SET_DTIMPRD 78 +#define WLC_GET_SROM 79 +#define WLC_SET_SROM 80 +#define WLC_GET_WEP_RESTRICT 81 +#define WLC_SET_WEP_RESTRICT 82 +#define WLC_GET_COUNTRY 83 +#define WLC_SET_COUNTRY 84 +#define WLC_GET_PM 85 +#define WLC_SET_PM 86 +#define WLC_GET_WAKE 87 +#define WLC_SET_WAKE 88 +#define WLC_GET_D11CNTS 89 +#define WLC_GET_FORCELINK 90 /* ndis only */ +#define WLC_SET_FORCELINK 91 /* ndis only */ +#define WLC_FREQ_ACCURACY 92 +#define WLC_CARRIER_SUPPRESS 93 +#define WLC_GET_PHYREG 94 +#define WLC_SET_PHYREG 95 +#define WLC_GET_RADIOREG 96 +#define WLC_SET_RADIOREG 97 +#define WLC_GET_REVINFO 98 +#define WLC_GET_UCANTDIV 99 +#define WLC_SET_UCANTDIV 100 +#define WLC_R_REG 101 +#define WLC_W_REG 102 +#define WLC_DIAG_LOOPBACK 103 +#define WLC_RESET_D11CNTS 104 +#define WLC_GET_MACMODE 105 +#define WLC_SET_MACMODE 106 +#define WLC_GET_MONITOR 107 /* added by nbd */ +#define WLC_SET_MONITOR 108 /* added by nbd */ +#define WLC_GET_GMODE 109 +#define WLC_SET_GMODE 110 +#define WLC_GET_LEGACY_ERP 111 +#define WLC_SET_LEGACY_ERP 112 +#define WLC_GET_RX_ANT 113 +#define WLC_GET_CURR_RATESET 114 /* current rateset */ +#define WLC_GET_SCANSUPPRESS 115 +#define WLC_SET_SCANSUPPRESS 116 +#define WLC_GET_AP 117 +#define WLC_SET_AP 118 +#define WLC_GET_EAP_RESTRICT 119 +#define WLC_SET_EAP_RESTRICT 120 +#define WLC_SCB_AUTHORIZE 121 +#define WLC_SCB_DEAUTHORIZE 122 +#define WLC_GET_WDSLIST 123 +#define WLC_SET_WDSLIST 124 +#define WLC_GET_ATIM 125 +#define WLC_SET_ATIM 126 +#define WLC_GET_RSSI 127 +#define WLC_GET_PHYANTDIV 128 +#define WLC_SET_PHYANTDIV 129 +#define WLC_AP_RX_ONLY 130 +#define WLC_GET_TX_PATH_PWR 131 +#define WLC_SET_TX_PATH_PWR 132 +#define WLC_GET_WSEC 133 +#define WLC_SET_WSEC 134 +#define WLC_GET_PHY_NOISE 135 +#define WLC_GET_BSS_INFO 136 +#define WLC_GET_PKTCNTS 137 +#define WLC_GET_LAZYWDS 138 +#define WLC_SET_LAZYWDS 139 +#define WLC_GET_BANDLIST 140 +#define WLC_GET_BAND 141 +#define WLC_SET_BAND 142 +#define WLC_SCB_DEAUTHENTICATE 143 +#define WLC_GET_SHORTSLOT 144 +#define WLC_GET_SHORTSLOT_OVERRIDE 145 +#define WLC_SET_SHORTSLOT_OVERRIDE 146 +#define WLC_GET_SHORTSLOT_RESTRICT 147 +#define WLC_SET_SHORTSLOT_RESTRICT 148 +#define WLC_GET_GMODE_PROTECTION 149 +#define WLC_GET_GMODE_PROTECTION_OVERRIDE 150 +#define WLC_SET_GMODE_PROTECTION_OVERRIDE 151 +#define WLC_UPGRADE 152 +#define WLC_GET_MRATE 153 +#define WLC_SET_MRATE 154 +#define WLC_GET_IGNORE_BCNS 155 +#define WLC_SET_IGNORE_BCNS 156 +#define WLC_GET_SCB_TIMEOUT 157 +#define WLC_SET_SCB_TIMEOUT 158 +#define WLC_GET_ASSOCLIST 159 +#define WLC_GET_CLK 160 +#define WLC_SET_CLK 161 +#define WLC_GET_UP 162 +#define WLC_OUT 163 +#define WLC_GET_WPA_AUTH 164 +#define WLC_SET_WPA_AUTH 165 +#define WLC_GET_UCFLAGS 166 +#define WLC_SET_UCFLAGS 167 +#define WLC_GET_PWRIDX 168 +#define WLC_SET_PWRIDX 169 +#define WLC_GET_TSSI 170 +#define WLC_GET_SUP_RATESET_OVERRIDE 171 +#define WLC_SET_SUP_RATESET_OVERRIDE 172 +#define WLC_SET_FAST_TIMER 173 +#define WLC_GET_FAST_TIMER 174 +#define WLC_SET_SLOW_TIMER 175 +#define WLC_GET_SLOW_TIMER 176 +#define WLC_DUMP_PHYREGS 177 +#define WLC_GET_GMODE_PROTECTION_CONTROL 178 +#define WLC_SET_GMODE_PROTECTION_CONTROL 179 +#define WLC_GET_PHYLIST 180 +#define WLC_ENCRYPT_STRENGTH 181 /* ndis only */ +#define WLC_DECRYPT_STATUS 182 /* ndis only */ +#define WLC_GET_KEY_SEQ 183 +#define WLC_GET_SCAN_CHANNEL_TIME 184 +#define WLC_SET_SCAN_CHANNEL_TIME 185 +#define WLC_GET_SCAN_UNASSOC_TIME 186 +#define WLC_SET_SCAN_UNASSOC_TIME 187 +#define WLC_GET_SCAN_HOME_TIME 188 +#define WLC_SET_SCAN_HOME_TIME 189 +#define WLC_GET_SCAN_PASSES 190 +#define WLC_SET_SCAN_PASSES 191 +#define WLC_GET_PRB_RESP_TIMEOUT 192 +#define WLC_SET_PRB_RESP_TIMEOUT 193 +#define WLC_GET_ATTEN 194 +#define WLC_SET_ATTEN 195 +#define WLC_GET_SHMEM 196 /* diag */ +#define WLC_SET_SHMEM 197 /* diag */ +#define WLC_GET_GMODE_PROTECTION_CTS 198 +#define WLC_SET_GMODE_PROTECTION_CTS 199 +#define WLC_SET_TKIP_MIC_FLAG 200 +#define WLC_SCB_DEAUTHENTICATE_FOR_REASON 201 +#define WLC_TKIP_COUNTERMEASURES 202 +#define WLC_GET_PIOMODE 203 +#define WLC_SET_PIOMODE 204 +#define WLC_SET_LED 209 +#define WLC_GET_LED 210 +#define WLC_GET_INTERFERENCE_MODE 211 +#define WLC_SET_INTERFERENCE_MODE 212 +#define WLC_GET_CHANNEL_QA 213 +#define WLC_START_CHANNEL_QA 214 +#define WLC_GET_CHANNEL_SEL 215 +#define WLC_START_CHANNEL_SEL 216 +#define WLC_GET_VALID_CHANNELS 217 +#define WLC_GET_FAKEFRAG 218 +#define WLC_SET_FAKEFRAG 219 +#define WLC_GET_PWROUT_PERCENTAGE 220 +#define WLC_SET_PWROUT_PERCENTAGE 221 +#define WLC_SET_BAD_FRAME_PREEMPT 222 +#define WLC_GET_BAD_FRAME_PREEMPT 223 +#define WLC_SET_LEAP_LIST 224 +#define WLC_GET_LEAP_LIST 225 +#define WLC_GET_CWMIN 226 +#define WLC_SET_CWMIN 227 +#define WLC_GET_CWMAX 228 +#define WLC_SET_CWMAX 229 +#define WLC_GET_WET 230 +#define WLC_SET_WET 231 +#define WLC_GET_KEY_PRIMARY 235 +#define WLC_SET_KEY_PRIMARY 236 +#define WLC_SCAN_WITH_CALLBACK 240 +#define WLC_WDS_GET_REMOTE_HWADDR 246 /* currently handled in wl_linux.c/wl_vx.c */ +#define WLC_SET_CS_SCAN_TIMER 248 +#define WLC_GET_CS_SCAN_TIMER 249 +#define WLC_CURRENT_PWR 256 +#define WLC_GET_CHANNELS_IN_COUNTRY 260 +#define WLC_GET_COUNTRY_LIST 261 +#define WLC_GET_VAR 262 /* get value of named variable */ +#define WLC_SET_VAR 263 /* set named variable to value */ +#define WLC_NVRAM_GET 264 +#define WLC_NVRAM_SET 265 +#define WLC_SET_WSEC_PMK 268 +#define WLC_GET_AUTH_MODE 269 +#define WLC_SET_AUTH_MODE 270 +#define WLC_LAST 273 /* do not change - use get_var/set_var */ + +/* + * Minor kludge alert: + * Duplicate a few definitions that irelay requires from epiioctl.h here + * so caller doesn't have to include this file and epiioctl.h . + * If this grows any more, it would be time to move these irelay-specific + * definitions out of the epiioctl.h and into a separate driver common file. + */ +#ifndef EPICTRL_COOKIE +#define EPICTRL_COOKIE 0xABADCEDE +#endif + +/* vx wlc ioctl's offset */ +#define CMN_IOCTL_OFF 0x180 + +/* + * custom OID support + * + * 0xFF - implementation specific OID + * 0xE4 - first byte of Broadcom PCI vendor ID + * 0x14 - second byte of Broadcom PCI vendor ID + * 0xXX - the custom OID number + */ + +/* begin 0x1f values beyond the start of the ET driver range. */ +#define WL_OID_BASE 0xFFE41420 + +/* NDIS overrides */ +#define OID_WL_GETINSTANCE (WL_OID_BASE + WLC_GET_INSTANCE) +#define OID_WL_GET_FORCELINK (WL_OID_BASE + WLC_GET_FORCELINK) +#define OID_WL_SET_FORCELINK (WL_OID_BASE + WLC_SET_FORCELINK) +#define OID_WL_ENCRYPT_STRENGTH (WL_OID_BASE + WLC_ENCRYPT_STRENGTH) +#define OID_WL_DECRYPT_STATUS (WL_OID_BASE + WLC_DECRYPT_STATUS) + +#define WL_DECRYPT_STATUS_SUCCESS 1 +#define WL_DECRYPT_STATUS_FAILURE 2 +#define WL_DECRYPT_STATUS_UNKNOWN 3 + +/* allows user-mode app to poll the status of USB image upgrade */ +#define WLC_UPGRADE_SUCCESS 0 +#define WLC_UPGRADE_PENDING 1 + +/* Bit masks for radio disabled status - returned by WL_GET_RADIO */ +#define WL_RADIO_SW_DISABLE (1<<0) +#define WL_RADIO_HW_DISABLE (1<<1) + +/* Override bit for WLC_SET_TXPWR. if set, ignore other level limits */ +#define WL_TXPWR_OVERRIDE (1<<31) + + +/* Bus types */ +#define WL_SB_BUS 0 /* Silicon Backplane */ +#define WL_PCI_BUS 1 /* PCI target */ +#define WL_PCMCIA_BUS 2 /* PCMCIA target */ + +/* band types */ +#define WLC_BAND_AUTO 0 /* auto-select */ +#define WLC_BAND_A 1 /* "a" band (5 Ghz) */ +#define WLC_BAND_B 2 /* "b" band (2.4 Ghz) */ + +/* MAC list modes */ +#define WLC_MACMODE_DISABLED 0 /* MAC list disabled */ +#define WLC_MACMODE_DENY 1 /* Deny specified (i.e. allow unspecified) */ +#define WLC_MACMODE_ALLOW 2 /* Allow specified (i.e. deny unspecified) */ + + +/* 54g modes (basic bits may still be overridden) */ +#define GMODE_LEGACY_B 0 /* Rateset: 1b, 2b, 5.5, 11 */ + /* Preamble: Long */ + /* Shortslot: Off */ +#define GMODE_AUTO 1 /* Rateset: 1b, 2b, 5.5b, 11b, 18, 24, 36, 54 */ + /* Extended Rateset: 6, 9, 12, 48 */ + /* Preamble: Long */ + /* Shortslot: Auto */ +#define GMODE_ONLY 2 /* Rateset: 1b, 2b, 5.5b, 11b, 18, 24b, 36, 54 */ + /* Extended Rateset: 6b, 9, 12b, 48 */ + /* Preamble: Short required */ + /* Shortslot: Auto */ +#define GMODE_B_DEFERRED 3 /* Rateset: 1b, 2b, 5.5b, 11b, 18, 24, 36, 54 */ + /* Extended Rateset: 6, 9, 12, 48 */ + /* Preamble: Long */ + /* Shortslot: On */ +#define GMODE_PERFORMANCE 4 /* Rateset: 1b, 2b, 5.5b, 6b, 9, 11b, 12b, 18, 24b, 36, 48, 54 */ + /* Preamble: Short required */ + /* Shortslot: On and required */ +#define GMODE_LRS 5 /* Rateset: 1b, 2b, 5.5b, 11b */ + /* Extended Rateset: 6, 9, 12, 18, 24, 36, 48, 54 */ + /* Preamble: Long */ + /* Shortslot: Auto */ +#define GMODE_MAX 6 + + +/* values for PLCPHdr_override */ +#define WLC_PLCP_AUTO -1 +#define WLC_PLCP_SHORT 0 +#define WLC_PLCP_LONG 1 + +/* values for g_protection_override */ +#define WLC_G_PROTECTION_AUTO -1 +#define WLC_G_PROTECTION_OFF 0 +#define WLC_G_PROTECTION_ON 1 + +/* values for g_protection_control */ +#define WLC_G_PROTECTION_CTL_OFF 0 +#define WLC_G_PROTECTION_CTL_LOCAL 1 +#define WLC_G_PROTECTION_CTL_OVERLAP 2 + +/* Values for PM */ +#define PM_OFF 0 +#define PM_MAX 1 +#define PM_FAST 2 + +/* interference mitigation options */ +#define INTERFERE_NONE 0 /* off */ +#define NON_WLAN 1 /* foreign/non 802.11 interference, no auto detect */ +#define WLAN_MANUAL 2 /* ACI: no auto detection */ +#define WLAN_AUTO 3 /* ACI: auto - detact */ + +/* Message levels */ +#define WL_ERROR_VAL 0x0001 +#define WL_TRACE_VAL 0x0002 +#define WL_PRHDRS_VAL 0x0004 +#define WL_PRPKT_VAL 0x0008 +#define WL_INFORM_VAL 0x0010 +#define WL_TMP_VAL 0x0020 +#define WL_OID_VAL 0x0040 +#define WL_RATE_VAL 0x0080 +#define WL_ASSOC_VAL 0x0100 +#define WL_PRUSR_VAL 0x0200 +#define WL_PS_VAL 0x0400 +#define WL_TXPWR_VAL 0x0800 +#define WL_GMODE_VAL 0x1000 +#define WL_DUAL_VAL 0x2000 +#define WL_WSEC_VAL 0x4000 +#define WL_WSEC_DUMP_VAL 0x8000 +#define WL_LOG_VAL 0x10000 +#define WL_NRSSI_VAL 0x20000 +#define WL_LOFT_VAL 0x40000 +#define WL_REGULATORY_VAL 0x80000 +#define WL_ACI_VAL 0x100000 + + +/* 802.11h enforcement levels */ +#define SPECT_MNGMT_OFF 0 /* 11h disabled */ +#define SPECT_MNGMT_LOOSE 1 /* Allow scan lists to contain non-11h AP */ + /* when 11h is enabled */ +#define SPECT_MNGMT_STRICT 2 /* Prine out non-11h APs from scan list */ + + + +/* max # of leds supported by GPIO (gpio pin# == led index#) */ +#define WL_LED_NUMGPIO 16 /* gpio 0-15 */ + +/* led per-pin behaviors */ +#define WL_LED_OFF 0 /* always off */ +#define WL_LED_ON 1 /* always on */ +#define WL_LED_ACTIVITY 2 /* activity */ +#define WL_LED_RADIO 3 /* radio enabled */ +#define WL_LED_ARADIO 4 /* 5 Ghz radio enabled */ +#define WL_LED_BRADIO 5 /* 2.4Ghz radio enabled */ +#define WL_LED_BGMODE 6 /* on if gmode, off if bmode */ +#define WL_LED_WI1 7 +#define WL_LED_WI2 8 +#define WL_LED_WI3 9 +#define WL_LED_ASSOC 10 /* associated state indicator */ +#define WL_LED_INACTIVE 11 /* null behavior (clears default behavior) */ +#define WL_LED_NUMBEHAVIOR 12 + +/* led behavior numeric value format */ +#define WL_LED_BEH_MASK 0x7f /* behavior mask */ +#define WL_LED_AL_MASK 0x80 /* activelow (polarity) bit */ + + +/* maximum channels */ +#define WL_NUMCHANNELS 64 /* max # of channels in the band */ + +/* rate check */ +#define WL_RATE_OFDM(r) (((r) & 0x7f) == 12 || ((r) & 0x7f) == 18 || \ + ((r) & 0x7f) == 24 || ((r) & 0x7f) == 36 || \ + ((r) & 0x7f) == 48 || ((r) & 0x7f) == 72 || \ + ((r) & 0x7f) == 96 || ((r) & 0x7f) == 108) + +/* WDS link local endpoint WPA role */ +#define WL_WDS_WPA_ROLE_AUTH 0 /* authenticator */ +#define WL_WDS_WPA_ROLE_SUP 1 /* supplicant */ +#define WL_WDS_WPA_ROLE_AUTO 255 /* auto, based on mac addr value */ + +/* afterburner_override */ +#define ABO_AUTO -1 /* auto - no override */ +#define ABO_OFF 0 /* force afterburner off */ +#define ABO_ON 1 /* force afterburner on */ + +#define GMODE_AFTERBURNER 6 + +#undef PACKED + +#endif /* _wlioctl_h_ */ diff --git a/package/wlcompat/src/include/wlutils.h b/package/wlcompat/src/include/wlutils.h new file mode 100644 index 0000000000..07e2536ca3 --- /dev/null +++ b/package/wlcompat/src/include/wlutils.h @@ -0,0 +1,59 @@ +/* + * Broadcom wireless network adapter utility functions + * + * Copyright 2004, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * + * $Id$ + */ + +#ifndef _wlutils_h_ +#define _wlutils_h_ + +#include <typedefs.h> +#include <wlioctl.h> + +/* + * Pass a wlioctl request to the specified interface. + * @param name interface name + * @param cmd WLC_GET_MAGIC <= cmd < WLC_LAST + * @param buf buffer for passing in and/or receiving data + * @param len length of buf + * @return >= 0 if successful or < 0 otherwise + */ +extern int wl_ioctl(char *name, int cmd, void *buf, int len); + +/* + * Get the MAC (hardware) address of the specified interface. + * @param name interface name + * @param hwaddr 6-byte buffer for receiving address + * @return >= 0 if successful or < 0 otherwise + */ +extern int wl_hwaddr(char *name, unsigned char *hwaddr); + +/* + * Probe the specified interface. + * @param name interface name + * @return >= 0 if a Broadcom wireless device or < 0 otherwise + */ +extern int wl_probe(char *name); + +/* + * Set/Get named variable. + * @param name interface name + * @param var variable name + * @param val variable value/buffer + * @param len variable value/buffer length + * @return success == 0, failure != 0 + */ +extern int wl_set_val(char *name, char *var, void *val, int len); +extern int wl_get_val(char *name, char *var, void *val, int len); +extern int wl_set_int(char *name, char *var, int val); +extern int wl_get_int(char *name, char *var, int *val); + +#endif /* _wlutils_h_ */ diff --git a/package/wlcompat/src/wlcompat.c b/package/wlcompat/src/wlcompat.c new file mode 100644 index 0000000000..23b0d50a81 --- /dev/null +++ b/package/wlcompat/src/wlcompat.c @@ -0,0 +1,1056 @@ +/* + * wlcompat.c + * + * Copyright (C) 2005 Mike Baker, + * Felix Fietkau <openwrt@nbd.name> + * + * 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 the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + */ + + +#include <linux/config.h> +#include <linux/module.h> +#include <linux/moduleparam.h> +#include <linux/init.h> +#include <linux/if_arp.h> +#include <asm/uaccess.h> +#include <linux/wireless.h> +#include <linux/timer.h> + +#include <net/iw_handler.h> +#include <wlioctl.h> + +static struct net_device *dev; +static unsigned short bss_force; +static struct iw_statistics wstats; +static int random = 1; +char buf[WLC_IOCTL_MAXLEN]; + +/* The frequency of each channel in MHz */ +const long channel_frequency[] = { + 2412, 2417, 2422, 2427, 2432, 2437, 2442, + 2447, 2452, 2457, 2462, 2467, 2472, 2484 +}; +#define NUM_CHANNELS ( sizeof(channel_frequency) / sizeof(channel_frequency[0]) ) + +#define RNG_POLL_FREQ 20 + +typedef struct internal_wsec_key { + uint8 index; // 0x00 + uint8 unknown_1; // 0x01 + uint8 type; // 0x02 + uint8 unknown_2[7]; // 0x03 + uint8 len; // 0x0a + uint8 pad[3]; + char data[32]; // 0x0e +} wkey; + + +static int wlcompat_private_ioctl(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, + char *extra); +#ifdef DEBUG +void print_buffer(int len, unsigned char *buf); +#endif + +static int wl_ioctl(struct net_device *dev, int cmd, void *buf, int len) +{ + mm_segment_t old_fs = get_fs(); + struct ifreq ifr; + int ret; + wl_ioctl_t ioc; + ioc.cmd = cmd; + ioc.buf = buf; + ioc.len = len; + strncpy(ifr.ifr_name, dev->name, IFNAMSIZ); + ifr.ifr_data = (caddr_t) &ioc; + set_fs(KERNEL_DS); + ret = dev->do_ioctl(dev,&ifr,SIOCDEVPRIVATE); + set_fs (old_fs); + return ret; +} + +static int wl_set_val(struct net_device *dev, char *var, void *val, int len) +{ + char buf[128]; + int buf_len; + int ret; + + /* check for overflow */ + if ((buf_len = strlen(var)) + 1 + len > sizeof(buf)) + return -1; + + strcpy(buf, var); + buf_len += 1; + + /* append int value onto the end of the name string */ + memcpy(&(buf[buf_len]), val, len); + buf_len += len; + + ret = wl_ioctl(dev, WLC_SET_VAR, buf, buf_len); + return ret; +} + +static int wl_get_val(struct net_device *dev, char *var, void *val, int len) +{ + char buf[128]; + int buf_len; + int ret; + + /* check for overflow */ + if ((buf_len = strlen(var)) + 1 > sizeof(buf) || len > sizeof(buf)) + return -1; + + strcpy(buf, var); + if (ret = wl_ioctl(dev, WLC_GET_VAR, buf, buf_len + len)) + return ret; + + memcpy(val, buf, len); + return 0; +} + +int get_primary_key(struct net_device *dev) +{ + int key, val; + + for (key = val = 0; (key < 4) && (val == 0); key++) { + val = key; + if (wl_ioctl(dev, WLC_GET_KEY_PRIMARY, &val, sizeof(val)) < 0) + return -EINVAL; + } + return key; +} + + +static int wlcompat_ioctl_getiwrange(struct net_device *dev, + char *extra) +{ + int i, k; + struct iw_range *range; + + range = (struct iw_range *) extra; + bzero(extra, sizeof(struct iw_range)); + + range->we_version_compiled = WIRELESS_EXT; + range->we_version_source = WIRELESS_EXT; + + range->min_nwid = range->max_nwid = 0; + + range->num_channels = NUM_CHANNELS; + k = 0; + for (i = 0; i < NUM_CHANNELS; i++) { + range->freq[k].i = i + 1; + range->freq[k].m = channel_frequency[i] * 100000; + range->freq[k].e = 1; + k++; + if (k >= IW_MAX_FREQUENCIES) + break; + } + range->num_frequency = k; + range->sensitivity = 3; + + /* nbd: don't know what this means, but other drivers set it this way */ + range->pmp_flags = IW_POWER_PERIOD; + range->pmt_flags = IW_POWER_TIMEOUT; + range->pm_capa = IW_POWER_PERIOD | IW_POWER_TIMEOUT | IW_POWER_UNICAST_R; + + range->min_pmp = 0; + range->max_pmp = 65535000; + range->min_pmt = 0; + range->max_pmt = 65535 * 1000; + + range->max_qual.qual = 0; + range->max_qual.level = 0; + range->max_qual.noise = 0; + + range->min_rts = 0; + if (wl_ioctl(dev, WLC_GET_RTS, &range->max_rts, sizeof(int)) < 0) + range->max_rts = 2347; + + range->min_frag = 256; + + if (wl_ioctl(dev, WLC_GET_FRAG, &range->max_frag, sizeof(int)) < 0) + range->max_frag = 2346; + + range->txpower_capa = IW_TXPOW_DBM; + + return 0; +} + + +static int wlcompat_set_scan(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, + char *extra) +{ + int ap = 0, oldap = 0; + wl_scan_params_t params; + + memset(¶ms, 0, sizeof(params)); + + /* use defaults (same parameters as wl scan) */ + memset(¶ms.bssid, 0xff, sizeof(params.bssid)); + params.bss_type = DOT11_BSSTYPE_ANY; + params.scan_type = -1; + params.nprobes = -1; + params.active_time = -1; + params.passive_time = -1; + params.home_time = -1; + + /* can only scan in STA mode */ + wl_ioctl(dev, WLC_GET_AP, &oldap, sizeof(oldap)); + if (oldap > 0) + wl_ioctl(dev, WLC_SET_AP, &ap, sizeof(ap)); + + if (wl_ioctl(dev, WLC_SCAN, ¶ms, 64) < 0) + return -EINVAL; + + if (oldap > 0) + wl_ioctl(dev, WLC_SET_AP, &oldap, sizeof(oldap)); + + return 0; +} + + +struct iw_statistics *wlcompat_get_wireless_stats(struct net_device *dev) +{ + wl_bss_info_t *bss_info = (wl_bss_info_t *) buf; + get_pktcnt_t pkt; + unsigned int rssi, noise, ap; + + memset(&wstats, 0, sizeof(wstats)); + memset(&pkt, 0, sizeof(pkt)); + memset(buf, 0, sizeof(buf)); + bss_info->version = 0x2000; + wl_ioctl(dev, WLC_GET_BSS_INFO, bss_info, WLC_IOCTL_MAXLEN); + wl_ioctl(dev, WLC_GET_PKTCNTS, &pkt, sizeof(pkt)); + + rssi = 0; + if ((wl_ioctl(dev, WLC_GET_AP, &ap, sizeof(ap)) < 0) || ap) { + if (wl_ioctl(dev, WLC_GET_PHY_NOISE, &noise, sizeof(noise)) < 0) + noise = 0; + } else { + // somehow the structure doesn't fit here + rssi = buf[82]; + noise = buf[84]; + } + rssi = (rssi == 0 ? 1 : rssi); + wstats.qual.updated = 0x10; + if (rssi <= 1) + wstats.qual.updated |= 0x20; + if (noise <= 1) + wstats.qual.updated |= 0x40; + + if ((wstats.qual.updated & 0x60) == 0x60) + return NULL; + + wstats.qual.level = rssi; + wstats.qual.noise = noise; + wstats.discard.misc = pkt.rx_bad_pkt; + wstats.discard.retries = pkt.tx_bad_pkt; + + return &wstats; +} + +static int wlcompat_get_scan(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, + char *extra) +{ + wl_scan_results_t *results = (wl_scan_results_t *) buf; + wl_bss_info_t *bss_info; + char *info_ptr; + char *current_ev = extra; + char *current_val; + char *end_buf = extra + IW_SCAN_MAX_DATA; + struct iw_event iwe; + int i, j; + int rssi, noise; + + results->buflen = WLC_IOCTL_MAXLEN - sizeof(wl_scan_results_t); + + if (wl_ioctl(dev, WLC_SCAN_RESULTS, buf, WLC_IOCTL_MAXLEN) < 0) + return -EAGAIN; + + bss_info = &(results->bss_info[0]); + info_ptr = (char *) bss_info; + for (i = 0; i < results->count; i++) { + + /* send the cell address (must be sent first) */ + iwe.cmd = SIOCGIWAP; + iwe.u.ap_addr.sa_family = ARPHRD_ETHER; + memcpy(&iwe.u.ap_addr.sa_data, &bss_info->BSSID, sizeof(bss_info->BSSID)); + current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_ADDR_LEN); + + /* send the ESSID */ + iwe.cmd = SIOCGIWESSID; + iwe.u.data.length = bss_info->SSID_len; + if (iwe.u.data.length > IW_ESSID_MAX_SIZE) + iwe.u.data.length = IW_ESSID_MAX_SIZE; + iwe.u.data.flags = 1; + current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, bss_info->SSID); + + /* send frequency/channel info */ + iwe.cmd = SIOCGIWFREQ; + iwe.u.freq.e = 0; + iwe.u.freq.m = bss_info->channel; + current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_FREQ_LEN); + + /* add quality statistics */ + iwe.cmd = IWEVQUAL; + iwe.u.qual.qual = 0; + iwe.u.qual.level = bss_info->RSSI; + iwe.u.qual.noise = bss_info->phy_noise; + current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_QUAL_LEN); + + /* send rate information */ + iwe.cmd = SIOCGIWRATE; + current_val = current_ev + IW_EV_LCP_LEN; + iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0; + + for(j = 0 ; j < bss_info->rateset.count ; j++) { + iwe.u.bitrate.value = ((bss_info->rateset.rates[j] & 0x7f) * 500000); + current_val = iwe_stream_add_value(current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN); + } + if((current_val - current_ev) > IW_EV_LCP_LEN) + current_ev = current_val; + + info_ptr += sizeof(wl_bss_info_t); + if (bss_info->ie_length % 4) + info_ptr += bss_info->ie_length + 4 - (bss_info->ie_length % 4); + else + info_ptr += bss_info->ie_length; + bss_info = (wl_bss_info_t *) info_ptr; + } + + wrqu->data.length = (current_ev - extra); + wrqu->data.flags = 0; + + return 0; +} + +static int wlcompat_ioctl(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, + char *extra) +{ + switch (info->cmd) { + case SIOCGIWNAME: + strcpy(wrqu->name, "IEEE 802.11-DS"); + break; + case SIOCGIWFREQ: + { + channel_info_t ci; + + if (wl_ioctl(dev,WLC_GET_CHANNEL, &ci, sizeof(ci)) < 0) + return -EINVAL; + + wrqu->freq.m = ci.target_channel; + wrqu->freq.e = 0; + break; + } + case SIOCSIWFREQ: + { + if (wrqu->freq.m == -1) { + wrqu->freq.m = 0; + if (wl_ioctl(dev, WLC_SET_CHANNEL, &wrqu->freq.m, sizeof(int)) < 0) + return -EINVAL; + } else { + if (wrqu->freq.e == 1) { + int channel = 0; + int f = wrqu->freq.m / 100000; + while ((channel < NUM_CHANNELS + 1) && (f != channel_frequency[channel])) + channel++; + + if (channel == NUM_CHANNELS) // channel not found + return -EINVAL; + + wrqu->freq.e = 0; + wrqu->freq.m = channel + 1; + } + if ((wrqu->freq.e == 0) && (wrqu->freq.m < 1000)) { + if (wl_ioctl(dev, WLC_SET_CHANNEL, &wrqu->freq.m, sizeof(int)) < 0) + return -EINVAL; + } else { + return -EINVAL; + } + } + break; + } + case SIOCSIWAP: + { + int ap = 0; + int infra = 0; + rw_reg_t reg; + + memset(®, 0, sizeof(reg)); + + if (wrqu->ap_addr.sa_family != ARPHRD_ETHER) + return -EINVAL; + + if (wl_ioctl(dev, WLC_GET_AP, &ap, sizeof(ap)) < 0) + return -EINVAL; + + if (wl_ioctl(dev, WLC_GET_INFRA, &infra, sizeof(infra)) < 0) + return -EINVAL; + + if (!infra) { + wl_ioctl(dev, WLC_SET_BSSID, wrqu->ap_addr.sa_data, 6); + + reg.size = 4; + reg.byteoff = 0x184; + reg.val = bss_force << 16 | bss_force; + wl_ioctl(dev, WLC_W_REG, ®, sizeof(reg)); + + reg.byteoff = 0x180; + wl_ioctl(dev, WLC_R_REG, ®, sizeof(reg)); + reg.val = bss_force << 16; + wl_ioctl(dev, WLC_W_REG, ®, sizeof(reg)); + } + + if (wl_ioctl(dev, ((ap || !infra) ? WLC_SET_BSSID : WLC_REASSOC), wrqu->ap_addr.sa_data, 6) < 0) + return -EINVAL; + + break; + } + case SIOCGIWAP: + { +#ifdef DEBUG + rw_reg_t reg; + memset(®, 0, sizeof(reg)); + + reg.size = 4; + reg.byteoff = 0x184; + wl_ioctl(dev, WLC_R_REG, ®, sizeof(reg)); + printk("bss time = 0x%08x", reg.val); + + reg.byteoff = 0x180; + wl_ioctl(dev, WLC_R_REG, ®, sizeof(reg)); + printk("%08x\n", reg.val); +#endif + + wrqu->ap_addr.sa_family = ARPHRD_ETHER; + if (wl_ioctl(dev,WLC_GET_BSSID,wrqu->ap_addr.sa_data,6) < 0) + return -EINVAL; + break; + } + case SIOCGIWESSID: + { + wlc_ssid_t ssid; + + if (wl_ioctl(dev,WLC_GET_SSID, &ssid, sizeof(wlc_ssid_t)) < 0) + return -EINVAL; + + wrqu->essid.flags = wrqu->data.flags = 1; + wrqu->essid.length = wrqu->data.length = ssid.SSID_len + 1; + memcpy(extra,ssid.SSID,ssid.SSID_len + 1); + break; + } + case SIOCSIWESSID: + { + wlc_ssid_t ssid; + memset(&ssid, 0, sizeof(ssid)); + ssid.SSID_len = strlen(extra); + if (ssid.SSID_len > WLC_ESSID_MAX_SIZE) + ssid.SSID_len = WLC_ESSID_MAX_SIZE; + memcpy(ssid.SSID, extra, ssid.SSID_len); + if (wl_ioctl(dev, WLC_SET_SSID, &ssid, sizeof(ssid)) < 0) + return -EINVAL; + break; + } + case SIOCGIWRTS: + { + if (wl_ioctl(dev,WLC_GET_RTS,&(wrqu->rts.value),sizeof(int)) < 0) + return -EINVAL; + break; + } + case SIOCSIWRTS: + { + if (wl_ioctl(dev,WLC_SET_RTS,&(wrqu->rts.value),sizeof(int)) < 0) + return -EINVAL; + break; + } + case SIOCGIWFRAG: + { + if (wl_ioctl(dev,WLC_GET_FRAG,&(wrqu->frag.value),sizeof(int)) < 0) + return -EINVAL; + break; + } + case SIOCSIWFRAG: + { + if (wl_ioctl(dev,WLC_SET_FRAG,&(wrqu->frag.value),sizeof(int)) < 0) + return -EINVAL; + break; + } + case SIOCGIWTXPOW: + { + int radio, override; + + wl_ioctl(dev, WLC_GET_RADIO, &radio, sizeof(int)); + + if (wl_get_val(dev, "qtxpower", &(wrqu->txpower.value), sizeof(int)) < 0) + return -EINVAL; + + override = (wrqu->txpower.value & WL_TXPWR_OVERRIDE) == WL_TXPWR_OVERRIDE; + wrqu->txpower.value &= ~WL_TXPWR_OVERRIDE; + if (!override && (wrqu->txpower.value > 76)) + wrqu->txpower.value = 76; + wrqu->txpower.value /= 4; + + wrqu->txpower.fixed = 0; + wrqu->txpower.disabled = radio; + wrqu->txpower.flags = IW_TXPOW_DBM; + break; + } + case SIOCSIWTXPOW: + { + /* This is weird: WLC_SET_RADIO with 1 as argument disables the radio */ + int radio = wrqu->txpower.disabled; + + wl_ioctl(dev, WLC_SET_RADIO, &radio, sizeof(int)); + + if (!wrqu->txpower.disabled && (wrqu->txpower.value > 0)) { + int value; + + if (wl_get_val(dev, "qtxpower", &value, sizeof(int)) < 0) + return -EINVAL; + + value &= WL_TXPWR_OVERRIDE; + wrqu->txpower.value *= 4; + wrqu->txpower.value |= value; + + if (wrqu->txpower.flags != IW_TXPOW_DBM) + return -EINVAL; + + if (wrqu->txpower.value > 0) + if (wl_set_val(dev, "qtxpower", &(wrqu->txpower.value), sizeof(int)) < 0) + return -EINVAL; + } + break; + } + case SIOCSIWENCODE: + { + int val = 0, wep = 1, wrestrict = 1; + int index = (wrqu->data.flags & IW_ENCODE_INDEX) - 1; + + if (index < 0) + index = get_primary_key(dev); + + if (wrqu->data.flags & IW_ENCODE_DISABLED) { + wep = 0; + if (wl_ioctl(dev, WLC_SET_WSEC, &wep, sizeof(val)) < 0) + return -EINVAL; + return 0; + } + + if (wl_ioctl(dev, WLC_SET_WSEC, &wep, sizeof(val)) < 0) + return -EINVAL; + + if (wrqu->data.flags & IW_ENCODE_OPEN) + wrestrict = 0; + + if (wrqu->data.pointer && (wrqu->data.length > 0) && (wrqu->data.length <= 16)) { + wl_wsec_key_t key; + memset(&key, 0, sizeof(key)); + + key.flags = WL_PRIMARY_KEY; + key.len = wrqu->data.length; + key.index = index; + memcpy(key.data, wrqu->data.pointer, wrqu->data.length); + + if (wl_ioctl(dev, WLC_SET_KEY, &key, sizeof(key)) < 0) + return -EINVAL; + } + + if (index >= 0) + wl_ioctl(dev, WLC_SET_KEY_PRIMARY, &index, sizeof(index)); + + if (wrestrict >= 0) + wl_ioctl(dev, WLC_SET_WEP_RESTRICT, &wrestrict, sizeof(wrestrict)); + + break; + } + case SIOCGIWENCODE: + { + int val; + + if (wl_ioctl(dev, WLC_GET_WEP, &val, sizeof(val)) < 0) + return -EINVAL; + + + if (val > 0) { + int key = get_primary_key(dev); + + wrqu->data.flags = IW_ENCODE_ENABLED; + if (key-- > 0) { + int *info_addr; + wkey *wep_key; + + info_addr = (int *) dev->priv; + wep_key = (wkey *) ((*info_addr) + 0x2752 + (key * 0x110)); + + wrqu->data.flags |= key + 1; + wrqu->data.length = wep_key->len; + + memset(extra, 0, 16); + memcpy(extra, wep_key->data, 16); + } else { + wrqu->data.flags |= IW_ENCODE_NOKEY; + } + } else { + wrqu->data.flags = IW_ENCODE_DISABLED; + } + + break; + } + case SIOCGIWRANGE: + { + return wlcompat_ioctl_getiwrange(dev, extra); + break; + } + case SIOCSIWMODE: + { + int ap = -1, infra = -1, passive = 0, wet = 0; + + switch (wrqu->mode) { + case IW_MODE_MONITOR: + passive = 1; + break; + case IW_MODE_ADHOC: + infra = 0; + ap = 0; + break; + case IW_MODE_MASTER: + infra = 1; + ap = 1; + break; + case IW_MODE_INFRA: + infra = 1; + ap = 0; + break; + case IW_MODE_REPEAT: + infra = 1; + ap = 0; + wet = 1; + break; + + default: + return -EINVAL; + } + + wl_ioctl(dev, WLC_SET_PASSIVE, &passive, sizeof(passive)); + wl_ioctl(dev, WLC_SET_MONITOR, &passive, sizeof(passive)); + wl_ioctl(dev, WLC_SET_WET, &wet, sizeof(wet)); + if (ap >= 0) + wl_ioctl(dev, WLC_SET_AP, &ap, sizeof(ap)); + if (infra >= 0) + wl_ioctl(dev, WLC_SET_INFRA, &infra, sizeof(infra)); + + break; + + } + case SIOCGIWMODE: + { + int ap, infra, wet, passive; + + if (wl_ioctl(dev, WLC_GET_AP, &ap, sizeof(ap)) < 0) + return -EINVAL; + if (wl_ioctl(dev, WLC_GET_INFRA, &infra, sizeof(infra)) < 0) + return -EINVAL; + if (wl_ioctl(dev, WLC_GET_PASSIVE, &passive, sizeof(passive)) < 0) + return -EINVAL; + if (wl_ioctl(dev, WLC_GET_WET, &wet, sizeof(wet)) < 0) + return -EINVAL; + + if (passive) { + wrqu->mode = IW_MODE_MONITOR; + } else if (!infra) { + wrqu->mode = IW_MODE_ADHOC; + } else { + if (ap) { + wrqu->mode = IW_MODE_MASTER; + } else { + if (wet) { + wrqu->mode = IW_MODE_REPEAT; + } else { + wrqu->mode = IW_MODE_INFRA; + } + } + } + break; + } + default: + { + if (info->cmd >= SIOCIWFIRSTPRIV) + return wlcompat_private_ioctl(dev, info, wrqu, extra); + + return -EINVAL; + } + } + + return 0; +} + +static const iw_handler wlcompat_handler[] = { + NULL, /* SIOCSIWCOMMIT */ + wlcompat_ioctl, /* SIOCGIWNAME */ + NULL, /* SIOCSIWNWID */ + NULL, /* SIOCGIWNWID */ + wlcompat_ioctl, /* SIOCSIWFREQ */ + wlcompat_ioctl, /* SIOCGIWFREQ */ + wlcompat_ioctl, /* SIOCSIWMODE */ + wlcompat_ioctl, /* SIOCGIWMODE */ + NULL, /* SIOCSIWSENS */ + NULL, /* SIOCGIWSENS */ + NULL, /* SIOCSIWRANGE, unused */ + wlcompat_ioctl, /* SIOCGIWRANGE */ + NULL, /* SIOCSIWPRIV */ + NULL, /* SIOCGIWPRIV */ + NULL, /* SIOCSIWSTATS */ + NULL, /* SIOCGIWSTATS */ + iw_handler_set_spy, /* SIOCSIWSPY */ + iw_handler_get_spy, /* SIOCGIWSPY */ + iw_handler_set_thrspy, /* SIOCSIWTHRSPY */ + iw_handler_get_thrspy, /* SIOCGIWTHRSPY */ + wlcompat_ioctl, /* SIOCSIWAP */ + wlcompat_ioctl, /* SIOCGIWAP */ + NULL, /* -- hole -- */ + NULL, /* SIOCGIWAPLIST */ + wlcompat_set_scan, /* SIOCSIWSCAN */ + wlcompat_get_scan, /* SIOCGIWSCAN */ + wlcompat_ioctl, /* SIOCSIWESSID */ + wlcompat_ioctl, /* SIOCGIWESSID */ + NULL, /* SIOCSIWNICKN */ + NULL, /* SIOCGIWNICKN */ + NULL, /* -- hole -- */ + NULL, /* -- hole -- */ + NULL, /* SIOCSIWRATE */ + NULL, /* SIOCGIWRATE */ + wlcompat_ioctl, /* SIOCSIWRTS */ + wlcompat_ioctl, /* SIOCGIWRTS */ + wlcompat_ioctl, /* SIOCSIWFRAG */ + wlcompat_ioctl, /* SIOCGIWFRAG */ + wlcompat_ioctl, /* SIOCSIWTXPOW */ + wlcompat_ioctl, /* SIOCGIWTXPOW */ + NULL, /* SIOCSIWRETRY */ + NULL, /* SIOCGIWRETRY */ + wlcompat_ioctl, /* SIOCSIWENCODE */ + wlcompat_ioctl, /* SIOCGIWENCODE */ +}; + + +#define WLCOMPAT_SET_MONITOR SIOCIWFIRSTPRIV + 0 +#define WLCOMPAT_GET_MONITOR SIOCIWFIRSTPRIV + 1 +#define WLCOMPAT_SET_TXPWR_LIMIT SIOCIWFIRSTPRIV + 2 +#define WLCOMPAT_GET_TXPWR_LIMIT SIOCIWFIRSTPRIV + 3 +#define WLCOMPAT_SET_ANTDIV SIOCIWFIRSTPRIV + 4 +#define WLCOMPAT_GET_ANTDIV SIOCIWFIRSTPRIV + 5 +#define WLCOMPAT_SET_TXANT SIOCIWFIRSTPRIV + 6 +#define WLCOMPAT_GET_TXANT SIOCIWFIRSTPRIV + 7 +#define WLCOMPAT_SET_BSS_FORCE SIOCIWFIRSTPRIV + 8 +#define WLCOMPAT_GET_BSS_FORCE SIOCIWFIRSTPRIV + 9 + + +static int wlcompat_private_ioctl(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, + char *extra) +{ + int *value = (int *) wrqu->name; + + switch (info->cmd) { + case WLCOMPAT_SET_MONITOR: + { + if (wl_ioctl(dev, WLC_SET_MONITOR, value, sizeof(int)) < 0) + return -EINVAL; + + break; + } + case WLCOMPAT_GET_MONITOR: + { + if (wl_ioctl(dev, WLC_GET_MONITOR, extra, sizeof(int)) < 0) + return -EINVAL; + + break; + } + case WLCOMPAT_SET_TXPWR_LIMIT: + { + int val; + + + if (wl_get_val(dev, "qtxpower", &val, sizeof(int)) < 0) + return -EINVAL; + + if (*extra > 0) + val |= WL_TXPWR_OVERRIDE; + else + val &= ~WL_TXPWR_OVERRIDE; + + if (wl_set_val(dev, "qtxpower", &val, sizeof(int)) < 0) + return -EINVAL; + + break; + } + case WLCOMPAT_GET_TXPWR_LIMIT: + { + if (wl_get_val(dev, "qtxpower", value, sizeof(int)) < 0) + return -EINVAL; + + *value = ((*value & WL_TXPWR_OVERRIDE) == WL_TXPWR_OVERRIDE ? 1 : 0); + + break; + } + case WLCOMPAT_SET_ANTDIV: + { + if (wl_ioctl(dev, WLC_SET_ANTDIV, value, sizeof(int)) < 0) + return -EINVAL; + + break; + } + case WLCOMPAT_GET_ANTDIV: + { + if (wl_ioctl(dev, WLC_GET_ANTDIV, extra, sizeof(int)) < 0) + return -EINVAL; + + break; + } + case WLCOMPAT_SET_TXANT: + { + if (wl_ioctl(dev, WLC_SET_TXANT, value, sizeof(int)) < 0) + return -EINVAL; + + break; + } + case WLCOMPAT_GET_TXANT: + { + if (wl_ioctl(dev, WLC_GET_TXANT, extra, sizeof(int)) < 0) + return -EINVAL; + + break; + } + case WLCOMPAT_SET_BSS_FORCE: + { + bss_force = (unsigned short) *value; + break; + } + case WLCOMPAT_GET_BSS_FORCE: + { + *extra = (int) bss_force; + break; + } + default: + { + return -EINVAL; + } + + } + return 0; +} + +static const struct iw_priv_args wlcompat_private_args[] = +{ + { WLCOMPAT_SET_MONITOR, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, + 0, + "set_monitor" + }, + { WLCOMPAT_GET_MONITOR, + 0, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, + "get_monitor" + }, + { WLCOMPAT_SET_TXPWR_LIMIT, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, + 0, + "set_txpwr_force" + }, + { WLCOMPAT_GET_TXPWR_LIMIT, + 0, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, + "get_txpwr_force" + }, + { WLCOMPAT_SET_ANTDIV, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, + 0, + "set_antdiv" + }, + { WLCOMPAT_GET_ANTDIV, + 0, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, + "get_antdiv" + }, + { WLCOMPAT_SET_TXANT, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, + 0, + "set_txant" + }, + { WLCOMPAT_GET_TXANT, + 0, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, + "get_txant" + }, + { WLCOMPAT_SET_BSS_FORCE, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, + 0, + "set_bss_force" + }, + { WLCOMPAT_GET_BSS_FORCE, + 0, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, + "get_bss_force" + }, +}; + +static const iw_handler wlcompat_private[] = +{ + wlcompat_private_ioctl, + NULL +}; + + +static const struct iw_handler_def wlcompat_handler_def = +{ + .standard = (iw_handler *) wlcompat_handler, + .num_standard = sizeof(wlcompat_handler)/sizeof(iw_handler), + .private = wlcompat_private, + .num_private = 1, + .private_args = wlcompat_private_args, + .num_private_args = sizeof(wlcompat_private_args) / sizeof(wlcompat_private_args[0]) +}; + + +#ifdef DEBUG +void print_buffer(int len, unsigned char *buf) { + int x; + if (buf != NULL) { + for (x=0;x<len && x<180 ;x++) { + if ((x % 4) == 0) + printk(" "); + printk("%02X",buf[x]); + } + } else { + printk(" NULL"); + } + printk("\n"); + +} +#endif +static int (*old_ioctl)(struct net_device *dev, struct ifreq *ifr, int cmd); +static int new_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { + int ret = 0; + struct iwreq *iwr = (struct iwreq *) ifr; + struct iw_request_info info; + +#ifdef DEBUG + printk("dev: %s ioctl: 0x%04x\n",dev->name,cmd); +#endif + + if (cmd >= SIOCIWFIRSTPRIV) { + info.cmd = cmd; + info.flags = 0; + ret = wlcompat_private_ioctl(dev, &info, &(iwr->u), (char *) &(iwr->u)); +#ifdef DEBUG + } else if (cmd==SIOCDEVPRIVATE) { + wl_ioctl_t *ioc = (wl_ioctl_t *)ifr->ifr_data; + unsigned char *buf = ioc->buf; + printk(" cmd: %d buf: 0x%08x len: %d\n",ioc->cmd,&(ioc->buf),ioc->len); + printk(" send: ->"); + print_buffer(ioc->len, buf); + ret = old_ioctl(dev,ifr,cmd); + printk(" recv: ->"); + print_buffer(ioc->len, buf); + printk(" ret: %d\n", ret); +#endif + } else { + ret = old_ioctl(dev,ifr,cmd); + } + return ret; +} + +static struct timer_list rng_timer; + +static void rng_timer_tick(unsigned long n) +{ + struct net_device *dev = (struct net_device *) n; + u16 data[4]; + int i, ret; + + ret = 0; + for (i = 0; i < 3; i++) { + ret |= wl_get_val(dev, "rand", &data[i], sizeof(u16)); + } + if (!ret) + batch_entropy_store(*((u32 *) &data[0]), *((u32 *) &data[2]), (jiffies % 255)); + + mod_timer(&rng_timer, jiffies + (HZ/RNG_POLL_FREQ)); +} + + +static int __init wlcompat_init() +{ + int found = 0, i; + char devname[4] = "wl0"; + bss_force = 0; + + while (!found && (dev = dev_get_by_name(devname))) { + if ((dev->wireless_handlers == NULL) && ((wl_ioctl(dev, WLC_GET_MAGIC, &i, sizeof(i)) == 0) && i == WLC_IOCTL_MAGIC)) + found = 1; + devname[2]++; + } + + if (!found) { + printk("No Broadcom devices found.\n"); + return -ENODEV; + } + + + old_ioctl = dev->do_ioctl; + dev->do_ioctl = new_ioctl; + dev->wireless_handlers = (struct iw_handler_def *)&wlcompat_handler_def; + dev->get_wireless_stats = wlcompat_get_wireless_stats; + + if (random) { + init_timer(&rng_timer); + rng_timer.function = rng_timer_tick; + rng_timer.data = (unsigned long) dev; + rng_timer_tick((unsigned long) dev); + } + +#ifdef DEBUG + printk("broadcom driver private data: 0x%08x\n", dev->priv); +#endif + return 0; +} + +static void __exit wlcompat_exit() +{ + if (random) + del_timer(&rng_timer); + dev->get_wireless_stats = NULL; + dev->wireless_handlers = NULL; + dev->do_ioctl = old_ioctl; + return; +} + +EXPORT_NO_SYMBOLS; +MODULE_AUTHOR("openwrt.org"); +MODULE_LICENSE("GPL"); + +module_param(random, int, 0); +module_init(wlcompat_init); +module_exit(wlcompat_exit); diff --git a/package/yamonenv/Makefile b/package/yamonenv/Makefile new file mode 100644 index 0000000000..dfb9bbb59a --- /dev/null +++ b/package/yamonenv/Makefile @@ -0,0 +1,40 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id: Makefile 4091 2006-06-27 00:35:46Z mbm $ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=yamonenv +PKG_VERSION:=20051022 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)_gruen.4g__$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://meshcube.org/nylon/stable/sources/ +PKG_MD5SUM:=a3e4f24155aa3ba5aa502bc63fdaa6ad +PKG_CAT:=zcat + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/yamonenv + SECTION:=utils + CATEGORY:=Utilities + DEPENDS:=@LINUX_2_6_AU1000@ + TITLE:=YAMON configuration utility + URL:=http://meshcube.org/nylon/stable/sources/ +endef + +define Build/Configure +endef + +define Package/yamonenv/install + install -d -m0755 $(1)/usr/sbin + $(CP) $(PKG_BUILD_DIR)/src/$(PKG_NAME) $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,yamonenv)) diff --git a/package/zd1211/Makefile b/package/zd1211/Makefile new file mode 100644 index 0000000000..e5d2c2724f --- /dev/null +++ b/package/zd1211/Makefile @@ -0,0 +1,63 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id: Makefile 3297 2006-03-02 23:42:52Z florian $ + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=zd1211 +PKG_VERSION:=r69 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-driver-$(PKG_VERSION).tgz +PKG_SOURCE_URL:=http://zd1211.ath.cx/download/ +PKG_MD5SUM:=c14133a3d5b27927402a492e84d2467a +PKG_CAT:=zcat + +PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-driver-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +#FIXME: add proper dependency handling on kmod-usb-core packages +define Package/kmod-zd1211 + SECTION:=kernel + CATEGORY:=Kernel drivers + DEPENDS:=@LINUX_2_6&&!LINUX_2_6_UML + TITLE:=Driver for Zydas 1211 based USB devices + DESCRIPTION:=\ + This package contains a Linux driver for the ZyDAS ZD1211 802.11b/g \\\ + USB-WLAN-Chip.\\\ + Initially contributed by ZyDAS, this driver is actively maintained by the \\\ + open source community. + URL:=http://zd1211.ath.cx/ + VERSION:=$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE) +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + ARCH="$(LINUX_KARCH)" \ + CROSS_COMPILE="$(TARGET_CROSS)" \ + CC="$(TARGET_CC)" \ + CPP="$(TARGET_CC)" \ + LD="$(TARGET_CROSS)ld" \ + KERNELVERSION="$(KERNEL)" \ + KERNEL_SOURCE="$(LINUX_DIR)" \ + KDIR="$(LINUX_DIR)" \ + all + $(TARGET_CC) $(PKG_BUILD_DIR)/apdbg.c -o $(PKG_BUILD_DIR)/apdbg +endef + +define Package/kmod-zd1211/install + install -d -m0755 $(1)/lib/modules/$(LINUX_VERSION) + $(CP) $(PKG_BUILD_DIR)/zd1211.$(LINUX_KMOD_SUFFIX) \ + $(1)/lib/modules/$(LINUX_VERSION)/ + install -d -m0755 $(1)/usr/sbin + $(CP) $(PKG_BUILD_DIR)/apdbg $(1)/usr/sbin/ + $(CP) $(PKG_BUILD_DIR)/sta $(1)/usr/sbin/$(PKG_NAME)-sta +endef + +$(eval $(call BuildPackage,kmod-zd1211)) diff --git a/package/zlib/Makefile b/package/zlib/Makefile new file mode 100644 index 0000000000..df4a4753ff --- /dev/null +++ b/package/zlib/Makefile @@ -0,0 +1,73 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=zlib +PKG_VERSION:=1.2.3 +PKG_RELEASE:=3 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=http://www.zlib.net @SF/zlib +PKG_MD5SUM:=dee233bf288ee795ac96a98cc2e369b6 +PKG_CAT:=bzcat + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install + +include $(INCLUDE_DIR)/package.mk + +define Package/zlib + SECTION:=libs + CATEGORY:=Libraries + TITLE:=Library implementing the deflate compression method + URL:=http://www.zlib.net/ +endef + +define Build/Configure + (cd $(PKG_BUILD_DIR); \ + $(TARGET_CONFIGURE_OPTS) \ + LDSHARED="$(TARGET_CC) -shared -Wl,-soname,libz.so.1" \ + CFLAGS="$(TARGET_CFLAGS) $(CFLAGS_LARGEFILE)" \ + ./configure \ + --prefix=/usr \ + --shared \ + ); +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS) $(CFLAGS_LARGEFILE)" \ + libz.a libz.so + mkdir -p $(PKG_INSTALL_DIR) + $(MAKE) -C $(PKG_BUILD_DIR) \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + install +endef + +define Build/InstallDev + mkdir -p $(STAGING_DIR)/usr/include + $(CP) $(PKG_INSTALL_DIR)/usr/include/z{conf,lib}.h \ + $(STAGING_DIR)/usr/include/ + mkdir -p $(STAGING_DIR)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libz.{a,so*} \ + $(STAGING_DIR)/usr/lib/ +endef + +define Build/UninstallDev + rm -rf $(STAGING_DIR)/usr/include/z{conf,lib}.h \ + $(STAGING_DIR)/usr/lib/libz.{a,so*} +endef + +define Package/zlib/install + install -d -m0755 $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libz.so.* $(1)/usr/lib/ +endef + +$(eval $(call BuildPackage,zlib)) diff --git a/package/zlib/patches/zlib.patch b/package/zlib/patches/zlib.patch new file mode 100644 index 0000000000..1325462ba5 --- /dev/null +++ b/package/zlib/patches/zlib.patch @@ -0,0 +1,206 @@ +diff -ruN zlib-1.2.3-orig/Makefile.in zlib-1.2.3-2/Makefile.in +--- zlib-1.2.3-orig/Makefile.in 2004-09-15 16:27:20.000000000 +0200 ++++ zlib-1.2.3-2/Makefile.in 2004-11-13 13:38:12.000000000 +0100 +@@ -25,20 +25,23 @@ + # -Wstrict-prototypes -Wmissing-prototypes + + LDFLAGS=libz.a +-LDSHARED=$(CC) ++LDSHARED=$(CC) -shared -Wl,-soname,$(SHAREDLIBM) + CPP=$(CC) -E + +-LIBS=libz.a ++LIBS= ++STATICLIB=libz.a + SHAREDLIB=libz.so + SHAREDLIBV=libz.so.1.2.3 + SHAREDLIBM=libz.so.1 + +-AR=ar rc ++AR=ar + RANLIB=ranlib + TAR=tar + SHELL=/bin/sh + EXE= + ++DESTDIR = ++ + prefix = /usr/local + exec_prefix = ${prefix} + libdir = ${exec_prefix}/lib +@@ -67,8 +70,8 @@ + echo ' *** zlib test FAILED ***'; \ + fi + +-libz.a: $(OBJS) $(OBJA) +- $(AR) $@ $(OBJS) $(OBJA) ++$(STATICLIB): $(OBJS) $(OBJA) ++ $(AR) rc $@ $(OBJS) $(OBJA) + -@ ($(RANLIB) $@ || true) >/dev/null 2>&1 + + match.o: match.S +@@ -77,8 +80,10 @@ + mv _match.o match.o + rm -f _match.s + ++$(SHAREDLIB): $(SHAREDLIBV) ++ + $(SHAREDLIBV): $(OBJS) +- $(LDSHARED) -o $@ $(OBJS) ++ $(LDSHARED) -lc -o $@ $(OBJS) + rm -f $(SHAREDLIB) $(SHAREDLIBM) + ln -s $@ $(SHAREDLIB) + ln -s $@ $(SHAREDLIBM) +@@ -90,23 +95,23 @@ + $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) + + install: $(LIBS) +- -@if [ ! -d $(exec_prefix) ]; then mkdir -p $(exec_prefix); fi +- -@if [ ! -d $(includedir) ]; then mkdir -p $(includedir); fi +- -@if [ ! -d $(libdir) ]; then mkdir -p $(libdir); fi +- -@if [ ! -d $(man3dir) ]; then mkdir -p $(man3dir); fi +- cp zlib.h zconf.h $(includedir) +- chmod 644 $(includedir)/zlib.h $(includedir)/zconf.h +- cp $(LIBS) $(libdir) +- cd $(libdir); chmod 755 $(LIBS) +- -@(cd $(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1 +- cd $(libdir); if test -f $(SHAREDLIBV); then \ ++ -@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi ++ -@if [ ! -d $(DESTDIR)$(includedir) ]; then mkdir -p $(DESTDIR)$(includedir); fi ++ -@if [ ! -d $(DESTDIR)$(libdir) ]; then mkdir -p $(DESTDIR)$(libdir); fi ++ -@if [ ! -d $(DESTDIR)$(man3dir) ]; then mkdir -p $(DESTDIR)$(man3dir); fi ++ cp zlib.h zconf.h $(DESTDIR)$(includedir) ++ chmod 644 $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h ++ cp $(STATICLIB) $(SHAREDLIBV) $(DESTDIR)$(libdir) ++ cd $(DESTDIR)$(libdir); chmod 755 $(LIBS) ++ -@(cd $(DESTDIR)$(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1 ++ cd $(DESTDIR)$(libdir); if test -f $(SHAREDLIBV); then \ + rm -f $(SHAREDLIB) $(SHAREDLIBM); \ + ln -s $(SHAREDLIBV) $(SHAREDLIB); \ + ln -s $(SHAREDLIBV) $(SHAREDLIBM); \ + (ldconfig || true) >/dev/null 2>&1; \ + fi +- cp zlib.3 $(man3dir) +- chmod 644 $(man3dir)/zlib.3 ++ cp zlib.3 $(DESTDIR)$(man3dir) ++ chmod 644 $(DESTDIR)$(man3dir)/zlib.3 + # The ranlib in install is needed on NeXTSTEP which checks file times + # ldconfig is for Linux + +diff -ruN zlib-1.2.3-orig/configure zlib-1.2.3-2/configure +--- zlib-1.2.3-orig/configure 2004-09-07 07:50:06.000000000 +0200 ++++ zlib-1.2.3-2/configure 2004-11-13 12:37:43.000000000 +0100 +@@ -23,7 +23,7 @@ + VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h` + VER2=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < zlib.h` + VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < zlib.h` +-AR=${AR-"ar rc"} ++AR=${AR-"ar"} + RANLIB=${RANLIB-"ranlib"} + prefix=${prefix-/usr/local} + exec_prefix=${exec_prefix-'${prefix}'} +@@ -73,7 +73,7 @@ + + if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) 2>/dev/null; then + CC="$cc" +- SFLAGS=${CFLAGS-"-fPIC -O3"} ++ SFLAGS=${CFLAGS-"-D_REENTRANT -fPIC -O3"} + CFLAGS="$cflags" + case `(uname -s || echo unknown) 2>/dev/null` in + Linux | linux | GNU | GNU/*) LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1"};; +@@ -408,6 +408,29 @@ + echo Checking for mmap support... No. + fi + ++cat > $test.c <<EOF ++#include <stdio.h> ++int main() { char buf[10]; snprintf(buf, sizeof(buf), "%s", "F"); return 0; } ++EOF ++if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then ++ echo "Checking for snprintf... Yes." ++ CFLAGS="$CFLAGS -DHAS_snprintf" ++else ++ echo "Checking for snprintf.. No." ++fi ++ ++cat > $test.c <<EOF ++#include <stdio.h> ++#include <stdarg.h> ++int main(void) { va_list a; vsnprintf(0, 0, "", a); return 0; } ++EOF ++if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then ++ echo "Checking for vsnprintf... Yes." ++ CFLAGS="$CFLAGS -DHAS_vsnprintf" ++else ++ echo "Checking for vsnprintf.. No." ++fi ++ + CPP=${CPP-"$CC -E"} + case $CFLAGS in + *ASMV*) +@@ -424,20 +447,21 @@ + # udpate Makefile + sed < Makefile.in " + /^CC *=/s#=.*#=$CC# +-/^CFLAGS *=/s#=.*#=$CFLAGS# +-/^CPP *=/s#=.*#=$CPP# +-/^LDSHARED *=/s#=.*#=$LDSHARED# +-/^LIBS *=/s#=.*#=$LIBS# +-/^SHAREDLIB *=/s#=.*#=$SHAREDLIB# +-/^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV# +-/^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM# +-/^AR *=/s#=.*#=$AR# +-/^RANLIB *=/s#=.*#=$RANLIB# +-/^EXE *=/s#=.*#=$EXE# +-/^prefix *=/s#=.*#=$prefix# +-/^exec_prefix *=/s#=.*#=$exec_prefix# +-/^libdir *=/s#=.*#=$libdir# +-/^includedir *=/s#=.*#=$includedir# +-/^mandir *=/s#=.*#=$mandir# +-/^LDFLAGS *=/s#=.*#=$LDFLAGS# ++/^CC *=/s%=.*%= $CC% ++/^CFLAGS *=/s%=.*%= $CFLAGS% ++/^CPP *=/s%=.*%= $CPP% ++/^LDSHARED *=/s%=.*%= $LDSHARED% ++/^LIBS *=/s%=.*%= $LIBS% ++/^SHAREDLIB *=/s%=.*%= $SHAREDLIB% ++/^SHAREDLIBV *=/s%=.*%= $SHAREDLIBV% ++/^SHAREDLIBM *=/s%=.*%= $SHAREDLIBM% ++/^AR *=/s%=.*%= $AR% ++/^RANLIB *=/s%=.*%= $RANLIB% ++/^EXE *=/s%=.*%= $EXE% ++/^prefix *=/s%=.*%= $prefix% ++/^exec_prefix *=/s%=.*%= $exec_prefix% ++/^libdir *=/s%=.*%= $libdir% ++/^includedir *=/s%=.*%= $includedir% ++/^mandir *=/s%=.*%= $mandir% ++/^LDFLAGS *=/s%=.*%= $LDFLAGS% + " > Makefile +diff -ruN zlib-1.2.3-orig/contrib/minizip/Makefile zlib-1.2.3-2/contrib/minizip/Makefile +--- zlib-1.2.3-orig/contrib/minizip/Makefile 2003-09-10 20:00:16.000000000 +0200 ++++ zlib-1.2.3-2/contrib/minizip/Makefile 2004-11-13 12:37:43.000000000 +0100 +@@ -1,8 +1,8 @@ + CC=cc +-CFLAGS=-O -I../.. ++CFLAGS=-O2 -g -I../.. -Dunix + +-UNZ_OBJS = miniunz.o unzip.o ioapi.o ../../libz.a +-ZIP_OBJS = minizip.o zip.o ioapi.o ../../libz.a ++UNZ_OBJS = miniunz.o unzip.o ioapi.o ++ZIP_OBJS = minizip.o zip.o ioapi.o + + .c.o: + $(CC) -c $(CFLAGS) $*.c +@@ -10,10 +10,10 @@ + all: miniunz minizip + + miniunz: $(UNZ_OBJS) +- $(CC) $(CFLAGS) -o $@ $(UNZ_OBJS) ++ $(CC) $(CFLAGS) -o $@ $(UNZ_OBJS) -L ../.. -lz + + minizip: $(ZIP_OBJS) +- $(CC) $(CFLAGS) -o $@ $(ZIP_OBJS) ++ $(CC) $(CFLAGS) -o $@ $(ZIP_OBJS) -L ../.. -lz + + test: miniunz minizip + ./minizip test readme.txt |