mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-12-27 09:49:52 +02:00
Merge commit 'nbd/master' into xburst
This commit is contained in:
commit
032f4ffb70
@ -173,6 +173,15 @@ choice
|
||||
|
||||
endchoice
|
||||
|
||||
config STRIP_ARGS
|
||||
string
|
||||
prompt "Strip arguments"
|
||||
depends USE_STRIP
|
||||
default "--strip-unneeded --remove-section=.comment --remove-section=.note" if DEBUG
|
||||
default "--strip-all"
|
||||
help
|
||||
Specifies arguments passed to the strip command when stripping binaries
|
||||
|
||||
config USE_MKLIBS
|
||||
bool "Strip unnecessary functions from libraries"
|
||||
help
|
||||
|
@ -11,7 +11,7 @@ DOWNLOAD_RDEP=$(STAMP_PREPARED) $(HOST_STAMP_PREPARED)
|
||||
define dl_method
|
||||
$(strip \
|
||||
$(if $(2),$(2), \
|
||||
$(if $(filter @GNOME/% @GNU/% @KERNEL/% @SF/% ftp://% http://%,$(1)),default, \
|
||||
$(if $(filter @GNOME/% @GNU/% @KERNEL/% @SF/% ftp://% http://% file://%,$(1)),default, \
|
||||
$(if $(filter git://%,$(1)),git, \
|
||||
$(if $(filter svn://%,$(1)),svn, \
|
||||
$(if $(filter cvs://%,$(1)),cvs, \
|
||||
|
@ -126,9 +126,9 @@ endif
|
||||
|
||||
|
||||
define Image/mkfs/prepare/default
|
||||
- find $(TARGET_DIR) -type f -not -perm +0100 -not -name 'ssh_host*' | $(XARGS) chmod 0644
|
||||
- find $(TARGET_DIR) -type f -perm +0100 | $(XARGS) chmod 0755
|
||||
- find $(TARGET_DIR) -type d | $(XARGS) chmod 0755
|
||||
- $(FIND) $(TARGET_DIR) -type f -not -perm +0100 -not -name 'ssh_host*' -print0 | $(XARGS) -0 chmod 0644
|
||||
- $(FIND) $(TARGET_DIR) -type f -perm +0100 -print0 | $(XARGS) -0 chmod 0755
|
||||
- $(FIND) $(TARGET_DIR) -type d -print0 | $(XARGS) -0 chmod 0755
|
||||
$(INSTALL_DIR) $(TARGET_DIR)/tmp
|
||||
chmod 0777 $(TARGET_DIR)/tmp
|
||||
endef
|
||||
|
@ -19,11 +19,11 @@ endif
|
||||
ifeq ($(LINUX_VERSION),2.6.30.10)
|
||||
LINUX_KERNEL_MD5SUM:=eb6be465f914275967a5602cb33662f5
|
||||
endif
|
||||
ifeq ($(LINUX_VERSION),2.6.31.11)
|
||||
LINUX_KERNEL_MD5SUM:=39e34c9a6439bcd4c088abe631302a99
|
||||
ifeq ($(LINUX_VERSION),2.6.31.12)
|
||||
LINUX_KERNEL_MD5SUM:=517be354b81b780e2f4b2ad614d030de
|
||||
endif
|
||||
ifeq ($(LINUX_VERSION),2.6.32.3)
|
||||
LINUX_KERNEL_MD5SUM:=730045c2c7f7e6618db3c4d4d7094853
|
||||
ifeq ($(LINUX_VERSION),2.6.32.7)
|
||||
LINUX_KERNEL_MD5SUM:=d59aca06609cedabe4d6d161d9f11113
|
||||
endif
|
||||
|
||||
# disable the md5sum check for unknown kernel versions
|
||||
|
@ -29,6 +29,9 @@ export DYLD_LIBRARY_PATH:=$(if $(DYLD_LIBRARY_PATH),$(DYLD_LIBRARY_PATH):)$(STAG
|
||||
# prevent perforce from messing with the patch utility
|
||||
unexport P4PORT P4USER P4CONFIG P4CLIENT
|
||||
|
||||
# prevent user defaults for quilt from interfering
|
||||
unexport QUILT_PATCHES QUILT_PATCH_OPTS
|
||||
|
||||
# make sure that a predefined CFLAGS variable does not disturb packages
|
||||
export CFLAGS=
|
||||
|
||||
|
@ -49,7 +49,7 @@ ifneq ($(KBUILD_VERBOSE),99)
|
||||
|
||||
.SILENT: $(MAKECMDGOALS)
|
||||
else
|
||||
SUBMAKE=$(MAKE)
|
||||
SUBMAKE=$(MAKE) -w
|
||||
define MESSAGE
|
||||
printf "%s\n" "$(1)"
|
||||
endef
|
||||
|
@ -1,5 +1,6 @@
|
||||
#
|
||||
# Copyright (C) 2007-2009 OpenWrt.org
|
||||
# Copyright (C) 2007-2010 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
@ -9,7 +10,7 @@ include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=base-files
|
||||
PKG_RELEASE:=34
|
||||
PKG_RELEASE:=37
|
||||
|
||||
PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/
|
||||
|
||||
@ -298,6 +299,24 @@ define Package/ldconfig/config
|
||||
endef
|
||||
|
||||
|
||||
ifneq ($(CONFIG_PREINITOPT),)
|
||||
define ImageConfigOptions
|
||||
mkdir -p $(1)/lib/preinit
|
||||
echo 'pi_suppress_stderr="$(CONFIG_TARGET_PREINIT_SUPPRESS_STDERR)"' >$(1)/lib/preinit/00_preinit.conf
|
||||
echo 'fs_failsafe_wait_timeout=$(if $(CONFIG_TARGET_PREINIT_TIMEOUT),$(CONFIG_TARGET_PREINIT_TIMEOUT),2)' >>$(1)/lib/preinit/00_preinit.conf
|
||||
echo 'pi_init_path=$(if $(CONFIG_TARGET_INIT_PATH),$(CONFIG_TARGET_INIT_PATH),"/bin:/sbin:/usr/bin:/usr/sbin")' >>$(1)/lib/preinit/00_preinit.conf
|
||||
echo 'pi_init_env=$(if $(CONFIG_TARGET_INIT_ENV),$(CONFIG_TARGET_INIT_ENV),"")' >>$(1)/lib/preinit/00_preinit.conf
|
||||
echo 'pi_init_cmd=$(if $(CONFIG_TARGET_INIT_CMD),$(CONFIG_TARGET_INIT_CMD),"/sbin/init")' >>$(1)/lib/preinit/00_preinit.conf
|
||||
echo 'pi_init_suppress_stderr="$(CONFIG_TARGET_INIT_SUPPRESS_STDERR)"' >>$(1)/lib/preinit/00_preinit.conf
|
||||
echo 'pi_ifname=$(if $(CONFIG_TARGET_PREINIT_IFNAME),$(CONFIG_TARGET_PREINIT_IFNAME),"")' >>$(1)/lib/preinit/00_preinit.conf
|
||||
echo 'pi_ip=$(if $(CONFIG_TARGET_PREINIT_IP),$(CONFIG_TARGET_PREINIT_IP),"192.168.1.1")' >>$(1)/lib/preinit/00_preinit.conf
|
||||
echo 'pi_netmask=$(if $(CONFIG_TARGET_PREINIT_NETMASK),$(CONFIG_TARGET_PREINIT_NETMASK),"255.255.255.0")' >>$(1)/lib/preinit/00_preinit.conf
|
||||
echo 'pi_broadcast=$(if $(CONFIG_TARGET_PREINIT_BROADCAST),$(CONFIG_TARGET_PREINIT_BROADCAST),"192.168.1.255")' >>$(1)/lib/preinit/00_preinit.conf
|
||||
echo 'pi_preinit_net_messages="$(CONFIG_TARGET_PREINIT_SHOW_NETMSG)"' >>$(1)/lib/preinit/00_preinit.conf
|
||||
echo 'pi_preinit_no_failsafe_netmsg="$(CONFIG_TARGET_SUPPRESS_FAILSAFE_NETMSG)"' >>$(1)/lib/preinit/00_preinit.conf
|
||||
endef
|
||||
endif
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
endef
|
||||
@ -367,6 +386,7 @@ define Package/base-files/install
|
||||
ln -sf /tmp $(1)/var
|
||||
mkdir -p $(1)/etc
|
||||
ln -sf /tmp/resolv.conf /tmp/fstab /tmp/TZ $(1)/etc/
|
||||
$(call ImageConfigOptions,$(1))
|
||||
$(call Package/base-files/install-target,$(1))
|
||||
for conffile in $(1)/etc/config/*; do \
|
||||
if [ -f "$$$$conffile" ]; then \
|
||||
|
@ -1,6 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (C) 2009 OpenWrt.org
|
||||
# Copyright (C) 2009-2010 OpenWrt.org
|
||||
|
||||
blkdev=`dirname $DEVPATH`
|
||||
if [ `basename $blkdev` != "block" ]; then
|
||||
@ -8,8 +7,10 @@ if [ `basename $blkdev` != "block" ]; then
|
||||
device=`basename $DEVPATH`
|
||||
case "$ACTION" in
|
||||
add)
|
||||
mkdir -p /mnt/$device
|
||||
mount /dev/$device /mnt/$device
|
||||
swapon /dev/$device >/dev/null 2>/dev/null || (
|
||||
mkdir -p /mnt/$device
|
||||
mount /dev/$device /mnt/$device
|
||||
)
|
||||
;;
|
||||
remove)
|
||||
umount /dev/$device
|
||||
|
@ -3,5 +3,5 @@
|
||||
|
||||
START=99
|
||||
start() {
|
||||
[ -f /etc/sysctl.conf ] && sysctl -p >&-
|
||||
[ -f /etc/sysctl.conf ] && sysctl -p -e >&-
|
||||
}
|
||||
|
@ -1,98 +1,45 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2006 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
|
||||
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
|
||||
. /etc/diag.sh
|
||||
|
||||
failsafe_ip() {
|
||||
ifconfig $ifname 192.168.1.1 netmask 255.255.255.0 broadcast 192.168.1.255 up
|
||||
}
|
||||
preinit_essential_hook=
|
||||
preinit_main_hook=
|
||||
failsafe_hook=
|
||||
initramfs_hook=
|
||||
preinit_mount_root=
|
||||
|
||||
failsafe() {
|
||||
set_state failsafe
|
||||
[ -n "$ifname" ] && grep "$ifname" /proc/net/dev >/dev/null && {
|
||||
failsafe_ip
|
||||
netmsg 192.168.1.255 "Entering Failsafe!"
|
||||
telnetd -l /bin/login.sh <> /dev/null 2>&1
|
||||
}
|
||||
lock /tmp/.failsafe
|
||||
ash --login
|
||||
}
|
||||
pi_ifname=
|
||||
pi_ip=192.168.1.1
|
||||
pi_broadcast=192.168.1.255
|
||||
pi_netmask=255.255.255.0
|
||||
|
||||
mount proc /proc -t proc
|
||||
mount sysfs /sys -t sysfs
|
||||
fs_failsafe_ifname=
|
||||
fs_failsafe_ip=192.168.1.1
|
||||
fs_failsafe_broadcast=192.168.1.255
|
||||
fs_failsafe_netmask=255.255.255.0
|
||||
|
||||
size=$(awk '/MemTotal:/ {l=5242880;mt=($2*1024);print((s=mt/2)<l)&&(mt>l)?mt-l:s}' /proc/meminfo)
|
||||
mount tmpfs /tmp -t tmpfs -o size=$size,nosuid,nodev,mode=1777
|
||||
fs_failsafe_wait_timeout=2
|
||||
|
||||
if grep devfs /proc/filesystems > /dev/null; then
|
||||
mount devfs /dev -t devfs
|
||||
M0=/dev/pty/m0
|
||||
M1=/dev/pty/m1
|
||||
HOTPLUG=/sbin/hotplug-call
|
||||
pi_suppress_stderr="y"
|
||||
pi_init_suppress_stderr="y"
|
||||
pi_init_path="/bin:/sbin:/usr/bin:/usr/sbin"
|
||||
pi_init_cmd="/sbin/init"
|
||||
|
||||
elif [ -x /sbin/hotplug2 ]; then
|
||||
mount -t tmpfs tmpfs /dev -o size=512K
|
||||
mknod /dev/console c 5 1
|
||||
/sbin/hotplug2 --set-worker /lib/hotplug2/worker_fork.so --set-rules-file /etc/hotplug2-init.rules --no-persistent --set-coldplug-cmd /sbin/udevtrigger
|
||||
/sbin/hotplug2 --set-worker /lib/hotplug2/worker_fork.so --set-rules-file /etc/hotplug2-init.rules --persistent &
|
||||
M0=/dev/ptmx
|
||||
M1=/dev/ptmx
|
||||
HOTPLUG=
|
||||
. /lib/functions/boot.sh
|
||||
|
||||
elif [ -x /sbin/udevd ]; then
|
||||
mount -n -t tmpfs -o mode=0755 udev /dev
|
||||
[ -d /lib/udev/devices ] && cp -af /lib/udev/devices/* /dev/
|
||||
[ -c /dev/console ] || mknod -m 0600 /dev/console c 5 1
|
||||
[ -c /dev/null ] || mknod -m 0666 /dev/null c 1 3
|
||||
/sbin/udevd --daemon --resolve-names=never
|
||||
/sbin/udevadm trigger
|
||||
/sbin/udevadm settle
|
||||
M0=/dev/pty/ptmx
|
||||
M1=/dev/pty/ptmx
|
||||
HOTPLUG=
|
||||
fi
|
||||
|
||||
[ -d /dev/pts ] || mkdir -p /dev/pts
|
||||
[ -d /dev/shm ] || mkdir -p /dev/shm
|
||||
mount devpts /dev/pts -t devpts
|
||||
for pi_source_file in /lib/preinit/*; do
|
||||
. $pi_source_file
|
||||
done
|
||||
|
||||
# the shell really doesn't like having stdin/out closed
|
||||
# that's why we use /dev/pty/m0 and m1 as replacement
|
||||
# for /dev/console if there's no serial console available
|
||||
dd if=/dev/console of=/dev/null bs=1 count=0 >/dev/null 2>/dev/null && {
|
||||
M0=/dev/console
|
||||
M1=/dev/console
|
||||
}
|
||||
boot_run_hook preinit_essential
|
||||
|
||||
exec <$M0 >$M1 2>&0
|
||||
pi_mount_skip_next=false
|
||||
pi_jffs2_mount_success=false
|
||||
pi_failsafe_net_message=false
|
||||
|
||||
echo "- preinit -"
|
||||
set_state preinit
|
||||
echo "Press CTRL-C for failsafe"
|
||||
trap 'FAILSAFE=true' INT
|
||||
trap 'FAILSAFE=true' USR1
|
||||
if [ -e /etc/preinit.arch ]; then
|
||||
. /etc/preinit.arch
|
||||
else
|
||||
sleep 2
|
||||
fi
|
||||
echo "$HOTPLUG" > /proc/sys/kernel/hotplug
|
||||
export FAILSAFE
|
||||
eval ${FAILSAFE:+failsafe}
|
||||
lock -w /tmp/.failsafe
|
||||
boot_run_hook preinit_main
|
||||
|
||||
if [ -z "$INITRAMFS" ]; then
|
||||
mount_root
|
||||
[ -f /sysupgrade.tgz ] && {
|
||||
echo "- config restore -"
|
||||
cd /
|
||||
mv sysupgrade.tgz /tmp
|
||||
tar xzf /tmp/sysupgrade.tgz
|
||||
rm -f /tmp/sysupgrade.tgz
|
||||
sync
|
||||
}
|
||||
|
||||
echo "- init -"
|
||||
|
||||
exec /sbin/init
|
||||
fi
|
||||
|
@ -17,3 +17,8 @@ net.ipv4.netfilter.ip_conntrack_tcp_timeout_established=3600
|
||||
net.ipv4.netfilter.ip_conntrack_udp_timeout=60
|
||||
net.ipv4.netfilter.ip_conntrack_udp_timeout_stream=180
|
||||
# net.ipv6.conf.all.forwarding=1
|
||||
|
||||
# disable bridge firewalling by default
|
||||
net.bridge.bridge-nf-call-arptables=0
|
||||
net.bridge.bridge-nf-call-ip6tables=0
|
||||
net.bridge.bridge-nf-call-iptables=0
|
||||
|
10
package/base-files/files/lib/firstboot/05_firstboot_skip
Normal file
10
package/base-files/files/lib/firstboot/05_firstboot_skip
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
check_skip() {
|
||||
if [ "$firsboot_skip_next" = "true" ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
46
package/base-files/files/lib/firstboot/10_determine_parts
Normal file
46
package/base-files/files/lib/firstboot/10_determine_parts
Normal file
@ -0,0 +1,46 @@
|
||||
#!/bin/sh
|
||||
|
||||
set_mtd_part() {
|
||||
partname="rootfs_data"
|
||||
mtdpart="$(find_mtd_part $partname)"
|
||||
}
|
||||
|
||||
set_rom_part() {
|
||||
rom=$(awk '/squashfs/ {print $2}' /proc/mounts)
|
||||
}
|
||||
|
||||
set_jffs_part() {
|
||||
jffs=$(awk '/jffs2/ {print $2}' /proc/mounts)
|
||||
}
|
||||
|
||||
determine_mtd_part() {
|
||||
set_mtd_part
|
||||
if [ -z "$mtdpart" ]; then
|
||||
echo "MTD partition not found."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
determine_rom_part() {
|
||||
check_skip || {
|
||||
set_rom_part
|
||||
if [ -z "$rom" ]; then
|
||||
echo "You do not have a squashfs partition; aborting"
|
||||
echo "(firstboot cannot be run on jffs2 based firmwares)"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
||||
determine_jffs2_part() {
|
||||
check_skip || {
|
||||
set_jffs_part
|
||||
}
|
||||
}
|
||||
|
||||
boot_hook_add switch2jffs determine_mtd_part
|
||||
boot_hook_add jffs2reset determine_mtd_part
|
||||
boot_hook_add switch2jffs determine_rom_part
|
||||
boot_hook_add jffs2reset determine_rom_part
|
||||
boot_hook_add switch2jffs determine_jffs2_part
|
||||
boot_hook_add jffs2reset determine_jffs2_part
|
@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (C) 2006-2010 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
|
||||
no_fo_clear_overlay() {
|
||||
# switch back to squashfs temporarily
|
||||
pivot /rom /mnt
|
||||
|
||||
# get rid of the old overlay
|
||||
umount -l /mnt
|
||||
|
||||
# another umount to get rid of the bind from /tmp/root
|
||||
umount -l /mnt
|
||||
}
|
||||
|
||||
boot_hook_add no_fo no_fo_clear_overlay
|
12
package/base-files/files/lib/firstboot/10_reset_has_mini_fo
Normal file
12
package/base-files/files/lib/firstboot/10_reset_has_mini_fo
Normal file
@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (C) 2006-2010 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
|
||||
reset_check_for_mini_fo() {
|
||||
if grep -q mini_fo /proc/filesystems; then
|
||||
reset_has_fo=true
|
||||
fi
|
||||
}
|
||||
|
||||
boot_hook_add jffs2reset reset_check_for_mini_fo
|
13
package/base-files/files/lib/firstboot/20_has_mini_fo
Normal file
13
package/base-files/files/lib/firstboot/20_has_mini_fo
Normal file
@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (C) 2006-2010 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
|
||||
check_for_mini_fo() {
|
||||
if ! grep -q mini_fo /proc/filesystems; then
|
||||
boot_run_hook no_fo
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
boot_hook_add switch2jffs check_for_mini_fo
|
15
package/base-files/files/lib/firstboot/20_no_fo_mount_jffs
Normal file
15
package/base-files/files/lib/firstboot/20_no_fo_mount_jffs
Normal file
@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (C) 2006-2010 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
|
||||
no_fo_mount_jffs() {
|
||||
# initialize jffs2
|
||||
mount "$mtdpart" /jffs -t jffs2 || exit
|
||||
|
||||
# workaround to ensure that union can attach properly
|
||||
sync
|
||||
ls /jffs >/dev/null
|
||||
}
|
||||
|
||||
boot_hook_add no_fo no_fo_mount_jffs
|
14
package/base-files/files/lib/firstboot/20_reset_clear_jffs
Normal file
14
package/base-files/files/lib/firstboot/20_reset_clear_jffs
Normal file
@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (C) 2006-2010 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
|
||||
reset_clear_jffs() {
|
||||
[ "$reset_has_fo" = "true" ] && {
|
||||
rm -rf $jffs/* 2>&-
|
||||
mount -o remount $jffs / 2>&-
|
||||
exit 0
|
||||
} || reset_has_fo=false
|
||||
}
|
||||
|
||||
boot_hook_add jffs2reset reset_clear_jffs
|
10
package/base-files/files/lib/firstboot/30_is_rootfs_mounted
Normal file
10
package/base-files/files/lib/firstboot/30_is_rootfs_mounted
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (C) 2006-2010 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
|
||||
skip_if_rootfs_mounted() {
|
||||
mount "$mtdpart" /rom/jffs -t jffs2 || exit
|
||||
}
|
||||
|
||||
boot_hook_add switch2jffs skip_if_rootfs_mounted
|
11
package/base-files/files/lib/firstboot/30_no_fo_pivot
Normal file
11
package/base-files/files/lib/firstboot/30_no_fo_pivot
Normal file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (C) 2006-2010 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
|
||||
no_fo_pivot() {
|
||||
# switch to the new (empty) jffs2
|
||||
fopivot /jffs /rom 1
|
||||
}
|
||||
|
||||
boot_hook_add no_fo no_fo_pivot
|
13
package/base-files/files/lib/firstboot/30_reset_copy_rom
Normal file
13
package/base-files/files/lib/firstboot/30_reset_copy_rom
Normal file
@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (C) 2006-2010 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
|
||||
reset_copy_rom() {
|
||||
[ "$reset_has_fo" != "true" ] && {
|
||||
dupe $jffs $rom
|
||||
exit 0
|
||||
}
|
||||
}
|
||||
|
||||
boot_hook_add jffs2reset reset_copy_rom
|
15
package/base-files/files/lib/firstboot/40_copy_ramoverlay
Normal file
15
package/base-files/files/lib/firstboot/40_copy_ramoverlay
Normal file
@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (C) 2006-2010 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
|
||||
copy_ramoverlay() {
|
||||
# try to avoid fs changing while copying
|
||||
mount -o remount,ro none / 2>&-
|
||||
# copy ramoverlay to jffs2
|
||||
echo -n "copying files ... "
|
||||
cp -a /tmp/root/* /rom/jffs 2>&-
|
||||
echo "done"
|
||||
}
|
||||
|
||||
boot_hook_add switch2jffs copy_ramoverlay
|
@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (C) 2006-2010 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
|
||||
no_fo_copy_ramoverlay() {
|
||||
# copy ramoverlay to jffs2, must be done after switching
|
||||
# to the new rootfs to avoid creating opaque directories
|
||||
echo -n "copying files ... "
|
||||
cp -a /tmp/root/* / >/dev/null 2>&1
|
||||
sync
|
||||
}
|
||||
|
||||
boot_hook_add no_fo no_fo_ramoverlay
|
17
package/base-files/files/lib/firstboot/50_pivot
Normal file
17
package/base-files/files/lib/firstboot/50_pivot
Normal file
@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (C) 2006-2010 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
|
||||
with_fo_pivot() {
|
||||
# switch back to squashfs (temporarily)
|
||||
# and park the ramdisk ontop of /tmp/root
|
||||
pivot /rom /mnt
|
||||
mount -o move /mnt /tmp/root
|
||||
|
||||
# /jffs is the overlay
|
||||
# /rom is the readonly
|
||||
fopivot /jffs /rom
|
||||
}
|
||||
|
||||
boot_hook_add switch2jffs with_fo_pivot
|
13
package/base-files/files/lib/firstboot/99_10_no_fo_cleanup
Normal file
13
package/base-files/files/lib/firstboot/99_10_no_fo_cleanup
Normal file
@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (C) 2006-2010 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
|
||||
no_fo_cleanup() {
|
||||
echo "done"
|
||||
umount -l /jffs
|
||||
umount -l /tmp/root
|
||||
exit 0
|
||||
}
|
||||
|
||||
boot_hook_add no_fo no_fo_cleanup
|
13
package/base-files/files/lib/firstboot/99_10_with_fo_cleanup
Normal file
13
package/base-files/files/lib/firstboot/99_10_with_fo_cleanup
Normal file
@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (C) 2006-2010 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
|
||||
with_fo_cleanup() {
|
||||
# try to get rid of /tmp/root
|
||||
# this will almost always fail
|
||||
mount /tmp/root 2>&-
|
||||
exit 0
|
||||
}
|
||||
|
||||
boot_hook_add switch2jffs with_fo_cleanup
|
95
package/base-files/files/lib/functions/boot.sh
Normal file
95
package/base-files/files/lib/functions/boot.sh
Normal file
@ -0,0 +1,95 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2006-2010 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
|
||||
boot_hook_add() {
|
||||
local hook="${1}_hook"
|
||||
local value="$2"
|
||||
local sep=" "
|
||||
|
||||
eval "$hook=\"\${$hook:+\${$hook}\${value:+\$sep}}\$value\""
|
||||
}
|
||||
|
||||
boot_run_hook() {
|
||||
local boot_func
|
||||
for boot_func in $(eval "echo \"\$${1}_hook\""); do
|
||||
$boot_func "$1" "$2"
|
||||
done
|
||||
}
|
||||
|
||||
find_mtd_part() {
|
||||
local PART="$(grep "\"$1\"" /proc/mtd | awk -F: '{print $1}')"
|
||||
local PREFIX=/dev/mtdblock
|
||||
|
||||
PART="${PART##mtd}"
|
||||
[ -d /dev/mtdblock ] && PREFIX=/dev/mtdblock/
|
||||
echo "${PART:+$PREFIX$PART}"
|
||||
}
|
||||
|
||||
jffs2_ready () {
|
||||
mtdpart="$(find_mtd_part rootfs_data)"
|
||||
magic=$(hexdump $mtdpart -n 4 -e '4/1 "%02x"')
|
||||
[ "$magic" != "deadc0de" ]
|
||||
}
|
||||
|
||||
dupe() { # <new_root> <old_root>
|
||||
cd $1
|
||||
echo -n "creating directories... "
|
||||
{
|
||||
cd $2
|
||||
find . -xdev -type d
|
||||
echo "./dev ./jffs ./mnt ./proc ./tmp"
|
||||
# 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*|\
|
||||
./usr/lib/opkg/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 2>&-
|
||||
mount -o move $2/jffs /jffs 2>&-
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
fopivot() { # <rw_root> <ro_root> <dupe?>
|
||||
root=$1
|
||||
{
|
||||
if grep -q mini_fo /proc/filesystems; then
|
||||
mount -t mini_fo -o base=/,sto=$1 "mini_fo:$1" /mnt 2>&- && root=/mnt
|
||||
else
|
||||
mount --bind / /mnt
|
||||
mount --bind -o union "$1" /mnt && root=/mnt
|
||||
fi
|
||||
} || {
|
||||
[ "$3" = "1" ] && {
|
||||
mount | grep "on $1 type" 2>&- 1>&- || mount -o bind $1 $1
|
||||
dupe $1 $rom
|
||||
}
|
||||
}
|
||||
pivot $root $2
|
||||
}
|
||||
|
||||
ramoverlay() {
|
||||
mkdir -p /tmp/root
|
||||
mount -t tmpfs root /tmp/root
|
||||
fopivot /tmp/root /rom 1
|
||||
}
|
@ -233,48 +233,50 @@ setup_interface_alias() {
|
||||
}
|
||||
|
||||
setup_interface() {
|
||||
local iface="$1"
|
||||
local iface_main="$1"
|
||||
local config="$2"
|
||||
local proto="$3"
|
||||
local vifmac="$4"
|
||||
local ip6addr_main=
|
||||
|
||||
[ -n "$config" ] || {
|
||||
config=$(find_config "$iface")
|
||||
config=$(find_config "$iface_main")
|
||||
[ "$?" = 0 ] || return 1
|
||||
}
|
||||
|
||||
prepare_interface "$iface" "$config" "$vifmac" || return 0
|
||||
prepare_interface "$iface_main" "$config" "$vifmac" || return 0
|
||||
|
||||
[ "$iface" = "br-$config" ] && {
|
||||
[ "$iface_main" = "br-$config" ] && {
|
||||
# need to bring up the bridge and wait a second for
|
||||
# it to switch to the 'forwarding' state, otherwise
|
||||
# it will lose its routes...
|
||||
ifconfig "$iface" up
|
||||
ifconfig "$iface_main" up
|
||||
sleep 1
|
||||
}
|
||||
|
||||
# Interface settings
|
||||
grep "$iface:" /proc/net/dev > /dev/null && {
|
||||
grep "$iface_main:" /proc/net/dev > /dev/null && {
|
||||
local mtu macaddr
|
||||
config_get mtu "$config" mtu
|
||||
config_get macaddr "$config" macaddr
|
||||
[ -n "$macaddr" ] && $DEBUG ifconfig "$iface" down
|
||||
$DEBUG ifconfig "$iface" ${macaddr:+hw ether "$macaddr"} ${mtu:+mtu $mtu} up
|
||||
[ -n "$macaddr" ] && $DEBUG ifconfig "$iface_main" down
|
||||
$DEBUG ifconfig "$iface_main" ${macaddr:+hw ether "$macaddr"} ${mtu:+mtu $mtu} up
|
||||
}
|
||||
set_interface_ifname "$config" "$iface"
|
||||
set_interface_ifname "$config" "$iface_main"
|
||||
|
||||
pidfile="/var/run/$iface.pid"
|
||||
pidfile="/var/run/$iface_main.pid"
|
||||
[ -n "$proto" ] || config_get proto "$config" proto
|
||||
case "$proto" in
|
||||
static)
|
||||
setup_interface_static "$iface" "$config"
|
||||
config_get ip6addr_main "$config" ip6addr
|
||||
setup_interface_static "$iface_main" "$config"
|
||||
;;
|
||||
dhcp)
|
||||
# prevent udhcpc from starting more than once
|
||||
lock "/var/lock/dhcp-$iface"
|
||||
lock "/var/lock/dhcp-$iface_main"
|
||||
local pid="$(cat "$pidfile" 2>/dev/null)"
|
||||
if [ -d "/proc/$pid" ] && grep udhcpc "/proc/${pid}/cmdline" >/dev/null 2>/dev/null; then
|
||||
lock -u "/var/lock/dhcp-$iface"
|
||||
lock -u "/var/lock/dhcp-$iface_main"
|
||||
else
|
||||
local ipaddr netmask hostname proto1 clientid
|
||||
config_get ipaddr "$config" ipaddr
|
||||
@ -284,21 +286,21 @@ setup_interface() {
|
||||
config_get clientid "$config" clientid
|
||||
|
||||
[ -z "$ipaddr" ] || \
|
||||
$DEBUG ifconfig "$iface" "$ipaddr" ${netmask:+netmask "$netmask"}
|
||||
$DEBUG ifconfig "$iface_main" "$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)
|
||||
local dhcpopts
|
||||
[ ."$proto1" != ."$proto" ] && dhcpopts="-n -q"
|
||||
$DEBUG eval udhcpc -t 0 -i "$iface" ${ipaddr:+-r $ipaddr} ${hostname:+-H $hostname} ${clientid:+-c $clientid} -b -p "$pidfile" ${dhcpopts:- -O rootpath -R &}
|
||||
lock -u "/var/lock/dhcp-$iface"
|
||||
$DEBUG eval udhcpc -t 0 -i "$iface_main" ${ipaddr:+-r $ipaddr} ${hostname:+-H $hostname} ${clientid:+-c $clientid} -b -p "$pidfile" ${dhcpopts:- -O rootpath -R &}
|
||||
lock -u "/var/lock/dhcp-$iface_main"
|
||||
fi
|
||||
;;
|
||||
none)
|
||||
setup_interface_none "$iface" "$config"
|
||||
setup_interface_none "$iface_main" "$config"
|
||||
;;
|
||||
*)
|
||||
if ( eval "type setup_interface_$proto" ) >/dev/null 2>/dev/null; then
|
||||
eval "setup_interface_$proto '$iface' '$config' '$proto'"
|
||||
eval "setup_interface_$proto '$iface_main' '$config' '$proto'"
|
||||
else
|
||||
echo "Interface type $proto not supported."
|
||||
return 1
|
||||
@ -306,7 +308,7 @@ setup_interface() {
|
||||
;;
|
||||
esac
|
||||
[ "$proto" = none ] || {
|
||||
for ifn in `ifconfig | grep "^$iface:" | awk '{print $1}'`; do
|
||||
for ifn in `ifconfig | grep "^$iface_main:" | awk '{print $1}'`; do
|
||||
ifconfig "$ifn" down
|
||||
done
|
||||
}
|
||||
@ -314,9 +316,15 @@ setup_interface() {
|
||||
local aliases
|
||||
config_set "$config" aliases ""
|
||||
config_set "$config" alias_count 0
|
||||
config_foreach setup_interface_alias alias "$config" "$iface"
|
||||
config_foreach setup_interface_alias alias "$config" "$iface_main"
|
||||
config_get aliases "$config" aliases
|
||||
[ -z "$aliases" ] || uci_set_state network "$config" aliases "$aliases"
|
||||
|
||||
# put the ip6addr back to the beginning to become the main ip again
|
||||
[ -z "$ip6addr_main" ] || {
|
||||
$DEBUG ifconfig "$iface_main" del "$ip6addr_main"
|
||||
$DEBUG ifconfig "$iface_main" add "$ip6addr_main"
|
||||
}
|
||||
}
|
||||
|
||||
unbridge() {
|
||||
|
13
package/base-files/files/lib/preinit/05_mount_skip
Normal file
13
package/base-files/files/lib/preinit/05_mount_skip
Normal file
@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (C) 2006 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
|
||||
check_skip() {
|
||||
if [ "$pi_mount_skip_next" = "true" ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
20
package/base-files/files/lib/preinit/10_check_for_mtd
Normal file
20
package/base-files/files/lib/preinit/10_check_for_mtd
Normal file
@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (C) 2006-2010 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
|
||||
mount_no_mtd() {
|
||||
mtd unlock rootfs
|
||||
mount -o remount,rw /dev/root /
|
||||
}
|
||||
|
||||
check_for_mtd() {
|
||||
check_skip || {
|
||||
grep rootfs_data /proc/mtd >/dev/null 2>/dev/null || {
|
||||
mount_no_mtd && pi_mount_skip_next=true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boot_hook_add preinit_mount_root check_for_mtd
|
||||
|
25
package/base-files/files/lib/preinit/10_essential_fs
Normal file
25
package/base-files/files/lib/preinit/10_essential_fs
Normal file
@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2006 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
|
||||
do_mount_procfs() {
|
||||
mount proc /proc -t proc
|
||||
}
|
||||
|
||||
do_mount_sysfs() {
|
||||
mount sysfs /sys -t sysfs
|
||||
}
|
||||
|
||||
calc_tmpfs_size() {
|
||||
pi_size=$(awk '/MemTotal:/ {l=5242880;mt=($2*1024);print((s=mt/2)<l)&&(mt>l)?mt-l:s}' /proc/meminfo)
|
||||
}
|
||||
|
||||
do_mount_tmpfs() {
|
||||
calc_tmpfs_size
|
||||
mount tmpfs /tmp -t tmpfs -o size=$pi_size,nosuid,nodev,mode=1777
|
||||
}
|
||||
|
||||
boot_hook_add preinit_essential do_mount_procfs
|
||||
boot_hook_add preinit_essential do_mount_sysfs
|
||||
boot_hook_add preinit_essential do_mount_tmpfs
|
||||
|
18
package/base-files/files/lib/preinit/10_indicate_failsafe
Normal file
18
package/base-files/files/lib/preinit/10_indicate_failsafe
Normal file
@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2006 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
|
||||
# commands for emitting messages to network in failsafe mode
|
||||
|
||||
indicate_failsafe_led () {
|
||||
set_state failsafe
|
||||
}
|
||||
|
||||
indicate_failsafe() {
|
||||
echo "- failsafe -"
|
||||
preinit_net_echo "Entering Failsafe!\n"
|
||||
indicate_failsafe_led
|
||||
}
|
||||
|
||||
boot_hook_add failsafe indicate_failsafe
|
||||
|
52
package/base-files/files/lib/preinit/10_indicate_preinit
Normal file
52
package/base-files/files/lib/preinit/10_indicate_preinit
Normal file
@ -0,0 +1,52 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2006 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
|
||||
preinit_ip() {
|
||||
# if the preinit interface isn't specified and ifname is set in
|
||||
# preinit.arch use that interface
|
||||
if [ -z "$pi_ifname" ]; then
|
||||
pi_ifname=$ifname
|
||||
fi
|
||||
|
||||
[ -n "$pi_ifname" ] && grep "$pi_ifname" /proc/net/dev >/dev/null && {
|
||||
ifconfig $pi_ifname $pi_ip netmask $pi_netmask broadcast $pi_broadcast up
|
||||
}
|
||||
}
|
||||
|
||||
preinit_ip_deconfig() {
|
||||
[ -n "$pi_ifname" ] && grep "$pi_ifname" /proc/net/dev >/dev/null && {
|
||||
ifconfig $pi_ifname 0.0.0.0 down
|
||||
}
|
||||
}
|
||||
|
||||
preinit_net_echo() {
|
||||
[ -n "$pi_ifname" ] && grep "$pi_ifname" /proc/net/dev >/dev/null && {
|
||||
{
|
||||
[ "$pi_preinit_net_messages" = "y" ] || {
|
||||
[ "$pi_failsafe_net_message" = "true" ] &&
|
||||
[ "$pi_preinit_no_failsafe_netmsg" != "y" ]
|
||||
}
|
||||
|
||||
} && netmsg $pi_broadcast "$1"
|
||||
}
|
||||
}
|
||||
|
||||
preinit_echo() {
|
||||
preinit_net_echo $1
|
||||
echo $1
|
||||
}
|
||||
|
||||
pi_indicate_led() {
|
||||
set_state preinit
|
||||
}
|
||||
|
||||
pi_indicate_preinit() {
|
||||
echo "- preinit -"
|
||||
preinit_net_echo "Doing OpenWRT Preinit\n"
|
||||
pi_indicate_led
|
||||
}
|
||||
|
||||
boot_hook_add preinit_main preinit_ip
|
||||
boot_hook_add preinit_main pi_indicate_preinit
|
||||
|
19
package/base-files/files/lib/preinit/20_check_jffs2_ready
Normal file
19
package/base-files/files/lib/preinit/20_check_jffs2_ready
Normal file
@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2006-2010 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
|
||||
mount_no_jffs2() {
|
||||
echo "jffs2 not ready yet; using ramdisk"
|
||||
ramoverlay
|
||||
}
|
||||
|
||||
check_for_jffs2() {
|
||||
check_skip || {
|
||||
jffs2_ready || {
|
||||
mount_no_jffs2 && pi_mount_skip_next=true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boot_hook_add preinit_mount_root check_for_jffs2
|
||||
|
28
package/base-files/files/lib/preinit/20_device_fs_mount
Normal file
28
package/base-files/files/lib/preinit/20_device_fs_mount
Normal file
@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2006 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
|
||||
do_mount_devfs() {
|
||||
mount devfs /dev -t devfs
|
||||
}
|
||||
|
||||
do_mount_hotplug() {
|
||||
mount -t tmpfs tmpfs /dev -o size=512K
|
||||
}
|
||||
|
||||
do_mount_udev() {
|
||||
mount -n -t tmpfs -o mode=0755 udev /dev
|
||||
}
|
||||
|
||||
choose_device_fs() {
|
||||
if grep devfs /proc/filesystems > /dev/null; then
|
||||
do_mount_devfs
|
||||
elif [ -x /sbin/hotplug2 ]; then
|
||||
do_mount_hotplug
|
||||
elif [ -x /sbin/udevd ]; then
|
||||
do_mount_udev
|
||||
fi
|
||||
}
|
||||
|
||||
boot_hook_add preinit_essential choose_device_fs
|
||||
|
36
package/base-files/files/lib/preinit/30_device_fs_daemons
Normal file
36
package/base-files/files/lib/preinit/30_device_fs_daemons
Normal file
@ -0,0 +1,36 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2006 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
|
||||
init_devfs() {
|
||||
HOTPLUG=/sbin/hotplug-call
|
||||
}
|
||||
|
||||
init_hotplug2() {
|
||||
[ -c /dev/console ] || mknod /dev/console c 5 1
|
||||
/sbin/hotplug2 --set-worker /lib/hotplug2/worker_fork.so --set-rules-file /etc/hotplug2-init.rules --no-persistent --set-coldplug-cmd /sbin/udevtrigger
|
||||
/sbin/hotplug2 --set-worker /lib/hotplug2/worker_fork.so --set-rules-file /etc/hotplug2-init.rules --persistent &
|
||||
}
|
||||
|
||||
init_udev() {
|
||||
[ -d /lib/udev/devices ] && cp -af /lib/udev/devices/* /dev/
|
||||
[ -c /dev/console ] || mknod -m 0600 /dev/console c 5 1
|
||||
[ -c /dev/null ] || mknod -m 0666 /dev/null c 1 3
|
||||
/sbin/udevd --daemon --resolve-names=never
|
||||
/sbin/udevadm trigger
|
||||
/sbin/udevadm settle
|
||||
}
|
||||
|
||||
init_device_fs() {
|
||||
HOTPLUG=
|
||||
if grep devfs /proc/filesystems > /dev/null; then
|
||||
init_devfs
|
||||
elif [ -x /sbin/hotplug2 ]; then
|
||||
init_hotplug2
|
||||
elif [ -x /sbin/udevd ]; then
|
||||
init_udev
|
||||
fi
|
||||
}
|
||||
|
||||
boot_hook_add preinit_essential init_device_fs
|
||||
|
86
package/base-files/files/lib/preinit/30_failsafe_wait
Normal file
86
package/base-files/files/lib/preinit/30_failsafe_wait
Normal file
@ -0,0 +1,86 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2006-2010 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
|
||||
fs_wait_for_key () {
|
||||
local timeout=$3
|
||||
local timer
|
||||
local do_failsafe
|
||||
local keypress_true="$(mktemp)"
|
||||
local keypress_wait="$(mktemp)"
|
||||
local keypress_sec="$(mktemp)"
|
||||
if [ -z "$keypress_wait" ]; then
|
||||
keypress_wait=/tmp/.keypress_wait
|
||||
touch $keypress_wait
|
||||
fi
|
||||
if [ -z "$keypress_true" ]; then
|
||||
keypress_true=/tmp/.keypress_true
|
||||
touch $keypress_true
|
||||
fi
|
||||
if [ -z "$keypress_sec" ]; then
|
||||
keypress_sec=/tmp/.keypress_sec
|
||||
touch $keypress_sec
|
||||
fi
|
||||
|
||||
trap "echo 'true' >$keypress_true; lock -u $keypress_wait ; rm -f $keypress_wait" INT
|
||||
trap "echo 'true' >$keypress_true; lock -u $keypress_wait ; rm -f $keypress_wait" USR1
|
||||
|
||||
[ -n "$timeout" ] || timeout=1
|
||||
[ $timeout -ge 1 ] || timeout=1
|
||||
timer=$timeout
|
||||
lock $keypress_wait
|
||||
{
|
||||
while [ $timer -gt 0 ]; do
|
||||
echo "$timer" >$keypress_sec
|
||||
timer=$(($timer - 1))
|
||||
sleep 1
|
||||
done
|
||||
lock -u $keypress_wait
|
||||
rm -f $keypress_wait
|
||||
} &
|
||||
|
||||
echo "Press $1<ENTER> $2"
|
||||
# if we're on the console we wait for input
|
||||
{
|
||||
while [ -r $keypress_wait ]; do
|
||||
timer="$(cat $keypress_sec)"
|
||||
|
||||
[ -n "$timer" ] || timer=1
|
||||
timer="${timer%%\ *}"
|
||||
[ $timer -ge 1 ] || timer=1
|
||||
do_failsafe=""
|
||||
{
|
||||
read -t "$timer" do_failsafe
|
||||
if [ "$do_failsafe" = "$1" ]; then
|
||||
echo "true" >$keypress_true
|
||||
lock -u $keypress_wait
|
||||
rm -f $keypress_wait
|
||||
fi
|
||||
}
|
||||
done
|
||||
}
|
||||
lock -w $keypress_wait
|
||||
|
||||
trap - INT
|
||||
trap - USR1
|
||||
|
||||
keypressed=1
|
||||
[ "$(cat $keypress_true)" = "true" ] && keypressed=0
|
||||
rm -f $keypress_true
|
||||
rm -f $keypress_wait
|
||||
rm -f $keypress_sec
|
||||
|
||||
return $keypressed
|
||||
}
|
||||
|
||||
failsafe_wait() {
|
||||
FAILSAFE=
|
||||
pi_failsafe_net_message=true
|
||||
preinit_net_echo "Please press button now to enter failsafe"
|
||||
pi_failsafe_net_message=false
|
||||
echo -n "Press "
|
||||
fs_wait_for_key f 'to enter failsafe mode' $fs_failsafe_wait_timeout && FAILSAFE=true && export FAILSAFE
|
||||
}
|
||||
|
||||
boot_hook_add preinit_main failsafe_wait
|
||||
|
10
package/base-files/files/lib/preinit/40_init_shm
Normal file
10
package/base-files/files/lib/preinit/40_init_shm
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2006 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
|
||||
init_shm() {
|
||||
[ -d /dev/shm ] || mkdir -p /dev/shm
|
||||
}
|
||||
|
||||
boot_hook_add preinit_essential init_shm
|
||||
|
15
package/base-files/files/lib/preinit/40_mount_devpts
Normal file
15
package/base-files/files/lib/preinit/40_mount_devpts
Normal file
@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2006 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
|
||||
init_devpts() {
|
||||
[ -d /dev/pts ] || mkdir -p /dev/pts
|
||||
}
|
||||
|
||||
do_mount_devpts() {
|
||||
mount devpts /dev/pts -t devpts
|
||||
}
|
||||
|
||||
boot_hook_add preinit_essential init_devpts
|
||||
boot_hook_add preinit_essential do_mount_devpts
|
||||
|
24
package/base-files/files/lib/preinit/40_mount_jffs2
Normal file
24
package/base-files/files/lib/preinit/40_mount_jffs2
Normal file
@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2006-2010 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
|
||||
find_mount_jffs2() {
|
||||
mount "$(find_mtd_part rootfs_data)" /jffs -t jffs2
|
||||
}
|
||||
|
||||
jffs2_not_mounted() {
|
||||
if [ "$pi_jffs2_mount_success" != "true" ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
do_mount_jffs2() {
|
||||
check_skip || {
|
||||
find_mount_jffs2 && pi_jffs2_mount_success=true
|
||||
}
|
||||
}
|
||||
|
||||
boot_hook_add preinit_mount_root do_mount_jffs2
|
||||
|
13
package/base-files/files/lib/preinit/40_run_failsafe_hook
Normal file
13
package/base-files/files/lib/preinit/40_run_failsafe_hook
Normal file
@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2006-2010 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
|
||||
run_failsafe_hook() {
|
||||
if [ "$FAILSAFE" = "true" ]; then
|
||||
boot_run_hook failsafe
|
||||
lock -w /tmp/.failsafe
|
||||
fi
|
||||
}
|
||||
|
||||
boot_hook_add preinit_main run_failsafe_hook
|
||||
|
31
package/base-files/files/lib/preinit/50_choose_console
Normal file
31
package/base-files/files/lib/preinit/50_choose_console
Normal file
@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2006-2010 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
|
||||
choose_console() {
|
||||
# the shell really doesn't like having stdin/out closed
|
||||
# that's why we use /dev/pty/m0 and m1 (or equivalent) as replacement
|
||||
# for /dev/console if there's no serial console available
|
||||
|
||||
if grep devfs /proc/filesystems > /dev/null; then
|
||||
M0=/dev/pty/m0
|
||||
M1=/dev/pty/m1
|
||||
M2=/dev/pty/m1
|
||||
elif [ -x /sbin/hotplug2 ]; then
|
||||
M0=/dev/ptmx
|
||||
M1=/dev/ptmx
|
||||
M2=/dev/ptmx
|
||||
elif [ -x /sbin/udevd ]; then
|
||||
M0=/dev/pty/ptmx
|
||||
M1=/dev/pty/ptmx
|
||||
M2=/dev/pty/ptmx
|
||||
fi
|
||||
dd if=/dev/console of=/dev/null bs=1 count=0 >/dev/null 2>/dev/null && {
|
||||
M0=/dev/console
|
||||
M1=/dev/console
|
||||
M2=/dev/console
|
||||
}
|
||||
}
|
||||
|
||||
boot_hook_add preinit_essential choose_console
|
||||
|
@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2006 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
|
||||
indicate_regular_preinit() {
|
||||
echo "- regular preinit -"
|
||||
preinit_net_echo "Continuing with Regular Preinit\n"
|
||||
pi_indicate_led
|
||||
}
|
||||
|
||||
boot_hook_add preinit_main indicate_regular_preinit
|
||||
|
10
package/base-files/files/lib/preinit/60_init_hotplug
Normal file
10
package/base-files/files/lib/preinit/60_init_hotplug
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2006 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
|
||||
init_hotplug() {
|
||||
echo "$HOTPLUG" > /proc/sys/kernel/hotplug
|
||||
}
|
||||
|
||||
boot_hook_add preinit_main init_hotplug
|
||||
|
13
package/base-files/files/lib/preinit/70_initramfs_test
Normal file
13
package/base-files/files/lib/preinit/70_initramfs_test
Normal file
@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2006 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
|
||||
initramfs_test() {
|
||||
if [ -n "$INITRAMFS" ]; then
|
||||
boot_run_hook initramfs
|
||||
break
|
||||
fi
|
||||
}
|
||||
|
||||
boot_hook_add preinit_main initramfs_test
|
||||
|
13
package/base-files/files/lib/preinit/70_pivot_jffs2_root
Normal file
13
package/base-files/files/lib/preinit/70_pivot_jffs2_root
Normal file
@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2006-2010 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
|
||||
rootfs_pivot() {
|
||||
check_skip || jffs2_not_mounted || {
|
||||
echo "switching to jffs2"
|
||||
fopivot /jffs /rom && pi_mount_skip_next=true
|
||||
}
|
||||
}
|
||||
|
||||
boot_hook_add preinit_mount_root rootfs_pivot
|
||||
|
10
package/base-files/files/lib/preinit/80_mount_root
Normal file
10
package/base-files/files/lib/preinit/80_mount_root
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2006 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
|
||||
do_mount_root() {
|
||||
boot_run_hook preinit_mount_root
|
||||
}
|
||||
|
||||
boot_hook_add preinit_main do_mount_root
|
||||
|
14
package/base-files/files/lib/preinit/90_init_console
Normal file
14
package/base-files/files/lib/preinit/90_init_console
Normal file
@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2006-2010 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
|
||||
init_console() {
|
||||
if [ "$pi_suppress_stderr" = "y" ]; then
|
||||
exec <$M0 >$M1 2>&0
|
||||
else
|
||||
exec <$M0 >$M1 2>$M2
|
||||
fi
|
||||
}
|
||||
|
||||
boot_hook_add preinit_essential init_console
|
||||
|
12
package/base-files/files/lib/preinit/90_mount_no_jffs2
Normal file
12
package/base-files/files/lib/preinit/90_mount_no_jffs2
Normal file
@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2006-2010 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
|
||||
do_mount_no_jffs2() {
|
||||
check_skip || {
|
||||
mount_no_jffs2 && pi_mount_skip_next=true
|
||||
}
|
||||
}
|
||||
|
||||
boot_hook_add preinit_mount_root do_mount_no_jffs2
|
||||
|
17
package/base-files/files/lib/preinit/90_restore_config
Normal file
17
package/base-files/files/lib/preinit/90_restore_config
Normal file
@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2006 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
|
||||
restore_config() {
|
||||
[ -f /sysupgrade.tgz ] && {
|
||||
echo "- config restore -"
|
||||
cd /
|
||||
mv sysupgrade.tgz /tmp
|
||||
tar xzf /tmp/sysupgrade.tgz
|
||||
rm -f /tmp/sysupgrade.tgz
|
||||
sync
|
||||
}
|
||||
}
|
||||
|
||||
boot_hook_add preinit_main restore_config
|
||||
|
18
package/base-files/files/lib/preinit/99_10_failsafe_login
Normal file
18
package/base-files/files/lib/preinit/99_10_failsafe_login
Normal file
@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2006 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
|
||||
failsafe_netlogin () {
|
||||
telnetd -l /bin/login.sh <> /dev/null 2>&1
|
||||
}
|
||||
|
||||
failsafe_shell() {
|
||||
lock /tmp/.failsafe
|
||||
ash --login
|
||||
echo "Please reboot system when done with failsafe network logins"
|
||||
}
|
||||
|
||||
|
||||
boot_hook_add failsafe failsafe_netlogin
|
||||
boot_hook_add failsafe failsafe_shell
|
||||
|
12
package/base-files/files/lib/preinit/99_10_mount_no_mtd
Normal file
12
package/base-files/files/lib/preinit/99_10_mount_no_mtd
Normal file
@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2006-2010 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
|
||||
do_mount_no_mtd() {
|
||||
check_skip || {
|
||||
mount_no_mtd
|
||||
}
|
||||
}
|
||||
|
||||
boot_hook_add preinit_mount_root do_mount_no_mtd
|
||||
|
16
package/base-files/files/lib/preinit/99_10_run_init
Normal file
16
package/base-files/files/lib/preinit/99_10_run_init
Normal file
@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2006 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
|
||||
run_init() {
|
||||
preinit_echo "- init -"
|
||||
preinit_ip_deconfig
|
||||
if [ "$pi_init_stderr_suppress" = "y" ]; then
|
||||
exec env - PATH=$pi_init_path $pi_init_env $pi_init_cmd 2>&0
|
||||
else
|
||||
exec env - PATH=$pi_init_path $pi_init_env $pi_init_cmd
|
||||
fi
|
||||
}
|
||||
|
||||
boot_hook_add preinit_main run_init
|
||||
|
@ -21,6 +21,9 @@ install_bin() { # <file> [ <symlink> ... ]
|
||||
files=$1
|
||||
[ -x "$src" ] && files="$src $(libs $src)"
|
||||
install_file $files
|
||||
[ -e /lib/ld-linux.so.3 ] && {
|
||||
install_file /lib/ld-linux.so.3
|
||||
}
|
||||
shift
|
||||
for link in "$@"; do {
|
||||
dest="$RAM_ROOT/$link"
|
||||
|
@ -1,162 +1,34 @@
|
||||
#!/bin/sh
|
||||
. /etc/functions.sh
|
||||
|
||||
partname="rootfs_data"
|
||||
mtdpart="$(find_mtd_part $partname)"
|
||||
switch2jffs_hook=
|
||||
jffs2reset_hook=
|
||||
no_fo_hook=
|
||||
|
||||
rom=$(awk '/squashfs/ {print $2}' /proc/mounts)
|
||||
jffs=$(awk '/jffs2/ {print $2}' /proc/mounts)
|
||||
. /lib/functions/boot.sh
|
||||
|
||||
dupe() { # <new_root> <old_root>
|
||||
cd $1
|
||||
echo -n "creating directories... "
|
||||
{
|
||||
cd $2
|
||||
find . -xdev -type d
|
||||
echo "./dev ./jffs ./mnt ./proc ./tmp"
|
||||
# xdev skips mounted directories
|
||||
cd $1
|
||||
} | xargs mkdir -p
|
||||
echo "done"
|
||||
firstboot_skip_next=false
|
||||
|
||||
echo -n "setting up symlinks... "
|
||||
for file in $(cd $2; find . -xdev -type f;); do
|
||||
case "$file" in
|
||||
./rom/note) ;; #nothing
|
||||
./etc/config*|\
|
||||
./usr/lib/opkg/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 2>&-
|
||||
mount -o move $2/jffs /jffs 2>&-
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
fopivot() { # <rw_root> <ro_root> <dupe?>
|
||||
root=$1
|
||||
{
|
||||
if grep -q mini_fo /proc/filesystems; then
|
||||
mount -t mini_fo -o base=/,sto=$1 "mini_fo:$1" /mnt 2>&- && root=/mnt
|
||||
else
|
||||
mount --bind / /mnt
|
||||
mount --bind -o union "$1" /mnt && root=/mnt
|
||||
fi
|
||||
} || {
|
||||
[ "$3" = "1" ] && {
|
||||
mount | grep "on $1 type" 2>&- 1>&- || mount -o bind $1 $1
|
||||
dupe $1 $rom
|
||||
}
|
||||
}
|
||||
pivot $root $2
|
||||
}
|
||||
|
||||
ramoverlay() {
|
||||
mkdir -p /tmp/root
|
||||
mount -t tmpfs root /tmp/root
|
||||
fopivot /tmp/root /rom 1
|
||||
}
|
||||
for fb_source_file in /lib/firstboot/*; do
|
||||
. $fb_source_file
|
||||
done
|
||||
|
||||
# invoked as an executable
|
||||
[ "${0##*/}" = "firstboot" ] && {
|
||||
|
||||
[ -z "$mtdpart" ] && {
|
||||
echo "MTD partition not found."
|
||||
exit 1
|
||||
}
|
||||
|
||||
[ -z "$rom" ] && {
|
||||
echo "You do not have a squashfs partition; aborting"
|
||||
echo "(firstboot cannot be run on jffs2 based firmwares)"
|
||||
exit 1
|
||||
}
|
||||
|
||||
[ "$1" = "switch2jffs" ] && {
|
||||
if grep -q mini_fo /proc/filesystems; then
|
||||
mount "$mtdpart" /rom/jffs -t jffs2 || exit
|
||||
|
||||
# try to avoid fs changing while copying
|
||||
mount -o remount,ro none / 2>&-
|
||||
|
||||
# copy ramoverlay to jffs2
|
||||
echo -n "copying files ... "
|
||||
cp -a /tmp/root/* /rom/jffs 2>&-
|
||||
echo "done"
|
||||
|
||||
# switch back to squashfs (temporarily)
|
||||
# and park the ramdisk ontop of /tmp/root
|
||||
pivot /rom /mnt
|
||||
mount -o move /mnt /tmp/root
|
||||
|
||||
# /jffs is the overlay
|
||||
# /rom is the readonly
|
||||
fopivot /jffs /rom
|
||||
|
||||
# try to get rid of /tmp/root
|
||||
# this will almost always fail
|
||||
umount /tmp/root 2>&-
|
||||
else
|
||||
# switch back to squashfs temporarily
|
||||
pivot /rom /mnt
|
||||
|
||||
# get rid of the old overlay
|
||||
umount -l /mnt
|
||||
|
||||
# another umount to get rid of the bind from /tmp/root
|
||||
umount -l /mnt
|
||||
|
||||
# initialize jffs2
|
||||
mount "$mtdpart" /jffs -t jffs2 || exit
|
||||
|
||||
# workaround to ensure that union can attach properly
|
||||
sync
|
||||
ls /jffs >/dev/null
|
||||
|
||||
# switch to the new (empty) jffs2
|
||||
fopivot /jffs /rom 1
|
||||
|
||||
# copy ramoverlay to jffs2, must be done after switching
|
||||
# to the new rootfs to avoid creating opaque directories
|
||||
echo -n "copying files ... "
|
||||
cp -a /tmp/root/* / >/dev/null 2>&1
|
||||
sync
|
||||
echo "done"
|
||||
|
||||
umount -l /jffs
|
||||
umount -l /tmp/root
|
||||
fi
|
||||
|
||||
exit 0
|
||||
}
|
||||
|
||||
# script run manually
|
||||
[ \! -z "$jffs" ] && {
|
||||
echo "firstboot has already been run"
|
||||
echo "jffs2 partition is mounted, only resetting files"
|
||||
grep mini_fo /proc/filesystems >&-
|
||||
[ $? != 0 ] && {
|
||||
dupe $jffs $rom
|
||||
exit 0
|
||||
} || {
|
||||
rm -rf $jffs/* 2>&-
|
||||
mount -o remount $jffs / 2>&-
|
||||
exit 0
|
||||
}
|
||||
}
|
||||
|
||||
if [ "${0##*/}" = "firstboot" ]; then
|
||||
if [ "$1" = "switch2jffs" ]; then
|
||||
boot_run_hook switch2jffs
|
||||
elif [ -z "$jffs" ]; then
|
||||
reset_has_fo=true
|
||||
echo "firstboot has already been run"
|
||||
echo "jffs2 partition is mounted, only resetting files"
|
||||
boot_run_hook jffs2reset
|
||||
else
|
||||
mtd erase "$partname"
|
||||
mount "$mtdpart" /jffs -t jffs2
|
||||
fopivot /jffs /rom 1
|
||||
}
|
||||
fi
|
||||
else
|
||||
set_mtd_part
|
||||
set_rom_part
|
||||
set_jffs_part
|
||||
fi
|
||||
|
||||
|
@ -1,25 +1,26 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2006 OpenWrt.org
|
||||
. /etc/functions.sh
|
||||
# Copyright (C) 2006-2010 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
|
||||
jffs2_ready () {
|
||||
mtdpart="$(find_mtd_part rootfs_data)"
|
||||
magic=$(hexdump $mtdpart -n 4 -e '4/1 "%02x"')
|
||||
[ "$magic" != "deadc0de" ]
|
||||
# Initialize hook variables et by pulling in from preinit
|
||||
|
||||
preinit_essential_hook=
|
||||
preinit_main_hook=
|
||||
failsafe_hook=
|
||||
initramfs_hook=
|
||||
preinit_mount_root=
|
||||
|
||||
. /lib/functions/boot.sh
|
||||
|
||||
for pi_source_file in /lib/preinit/*; do
|
||||
. $pi_source_file
|
||||
done
|
||||
|
||||
# Override function that doesn't apply to use of mount_root as a command rather
|
||||
# than as part of preinit
|
||||
|
||||
preinit_echo() {
|
||||
echo "$@"
|
||||
}
|
||||
|
||||
grep rootfs_data /proc/mtd >/dev/null 2>/dev/null && {
|
||||
. /sbin/firstboot
|
||||
mtd unlock rootfs_data
|
||||
jffs2_ready && {
|
||||
echo "switching to jffs2"
|
||||
mount "$(find_mtd_part rootfs_data)" /jffs -t jffs2 && \
|
||||
fopivot /jffs /rom
|
||||
} || {
|
||||
echo "jffs2 not ready yet; using ramdisk"
|
||||
ramoverlay
|
||||
}
|
||||
} || {
|
||||
mtd unlock rootfs
|
||||
mount -o remount,rw /dev/root /
|
||||
}
|
||||
boot_run_hook mount_root
|
||||
|
@ -34,6 +34,19 @@ bridge_interface() {(
|
||||
[ "$iftype" = bridge ] && config_get "$cfg" ifname
|
||||
)}
|
||||
|
||||
prepare_key_wep() {
|
||||
local key="$1"
|
||||
local hex=1
|
||||
|
||||
echo -n "$key" | grep -qE "[^a-fA-F0-9]" && hex=0
|
||||
[ "${#key}" -eq 10 -a $hex -eq 1 ] || \
|
||||
[ "${#key}" -eq 26 -a $hex -eq 1 ] || {
|
||||
[ "${key:0:2}" = "s:" ] && key="${key#s:}"
|
||||
key="$(echo -n "$key" | hexdump -ve '1/1 "%02x" ""')"
|
||||
}
|
||||
echo "$key"
|
||||
}
|
||||
|
||||
wifi_fixup_hwmode() {
|
||||
local device="$1"
|
||||
local default="$2"
|
||||
@ -48,7 +61,7 @@ wifi_fixup_hwmode() {
|
||||
11g) hwmode=g;;
|
||||
11n*)
|
||||
hwmode_11n="${hwmode##11n}"
|
||||
case "$hwmode" in
|
||||
case "$hwmode_11n" in
|
||||
a|g) ;;
|
||||
default) hwmode_11n="$default"
|
||||
esac
|
||||
|
132
package/base-files/image-config.in
Normal file
132
package/base-files/image-config.in
Normal file
@ -0,0 +1,132 @@
|
||||
# Copyright (C) 2006 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
menuconfig PREINITOPT
|
||||
bool "Preinit configuration options" if IMAGEOPT
|
||||
default n
|
||||
help
|
||||
These options are used to control the environment used to initialize
|
||||
the system before running init (which typically mean /sbin/init which
|
||||
switches to multiuser mode).
|
||||
|
||||
config TARGET_PREINIT_SUPPRESS_STDERR
|
||||
bool "Suppress stderr messages during preinit" if PREINITOPT
|
||||
default y
|
||||
help
|
||||
Sends stderr to null during preinit. This is the default behaviour
|
||||
in previous versions of OpenWRT. This also prevents init process
|
||||
itself from displaying stderr, however processes launched by init
|
||||
in multiuser through inittab will use the current terminal (e.g.
|
||||
the ash shell launched by inittab will display stderr). That's
|
||||
the same behaviour as seen in previous version of OpenWRT.
|
||||
|
||||
config TARGET_PREINIT_TIMEOUT
|
||||
int
|
||||
prompt "Failsafe wait timeout" if PREINITOPT
|
||||
default 2
|
||||
help
|
||||
How long to wait for failsafe mode to be entered before
|
||||
continuing with a regular boot if failsafe not selected.
|
||||
|
||||
config TARGET_PREINIT_SHOW_NETMSG
|
||||
bool
|
||||
prompt "Show all preinit network messages" if PREINITOPT
|
||||
default n
|
||||
help
|
||||
Show preinit all network messages (via netmsg broadcast), not only
|
||||
the message indicating to press reset to enter failsafe. Note that
|
||||
if the architecture doesn't define an interface, and there is no
|
||||
'Preinit network interface' defined, then no messages will be
|
||||
emitted, even if this is set.
|
||||
|
||||
config TARGET_PREINIT_SUPPRESS_FAILSAFE_NETMSG
|
||||
bool
|
||||
prompt "Suppress network message indicating failsafe" if PREINITOPT
|
||||
default n
|
||||
help
|
||||
If "Show all preinit network messages" above is not set, then
|
||||
setting this option suppresses the only message that would be
|
||||
emitted otherwise, name the network message to enter failsafe
|
||||
(via netmsg).
|
||||
|
||||
config TARGET_PREINIT_IFNAME
|
||||
string
|
||||
prompt "Preinit network interface" if PREINITOPT
|
||||
default ""
|
||||
help
|
||||
Interface for sending preinit messages to network, and any other
|
||||
default networking in failsafe or preinit. If empty
|
||||
uses $ifname (if defined in /etc/preinit.arch).
|
||||
|
||||
config TARGET_PREINIT_IP
|
||||
string
|
||||
prompt "IP address for preinit network messages" if PREINITOPT
|
||||
default "192.168.1.1"
|
||||
help
|
||||
IP address used to configure interface for preinit network
|
||||
messages, including failsafe messages
|
||||
|
||||
config TARGET_PREINIT_NETMASK
|
||||
string
|
||||
prompt "Netmask for preinit network messages" if PREINITOPT
|
||||
default "255.255.255.0"
|
||||
help
|
||||
Netmask used to configure interface for preinit network
|
||||
messages, including failsafes messages
|
||||
|
||||
config TARGET_PREINIT_BROADCAST
|
||||
string
|
||||
prompt "Broadcast address for preinit network messages" if PREINITOPT
|
||||
default "192.168.1.255"
|
||||
help
|
||||
Broadcast address to which to send preinit network messages, as
|
||||
as failsafe messages
|
||||
|
||||
|
||||
menuconfig INITOPT
|
||||
bool "Init configuration options" if IMAGEOPT
|
||||
default n
|
||||
help
|
||||
These option choose the command that will run as the 'init' command
|
||||
(that is which is responsible for controlling the system once preinit
|
||||
transfers control to it) as well as some options controlling its
|
||||
behaviour. Normally init is /sbin/init.
|
||||
|
||||
config TARGET_INIT_PATH
|
||||
string
|
||||
prompt "PATH for regular boot" if INITOPT
|
||||
default "/bin:/sbin:/usr/bin:/usr/sbin"
|
||||
help
|
||||
Default PATH used during normal operation
|
||||
|
||||
config TARGET_INIT_ENV
|
||||
string
|
||||
prompt "Environment variables to set when starting init (start with none)" if INITOPT
|
||||
default ""
|
||||
help
|
||||
Should be a space seperated list of variable assignments. These
|
||||
variables will be present in the environment. Spaces may not be
|
||||
present (including through expansion) even in a quoted string
|
||||
(env doesn't understanding quoting).
|
||||
|
||||
config TARGET_INIT_CMD
|
||||
string
|
||||
prompt "Init command" if INITOPT
|
||||
default "/sbin/init"
|
||||
help
|
||||
The executable to run as the init process. Is 'exec'd by
|
||||
preinit (which is the init that the kernel launches on boot).
|
||||
|
||||
config TARGET_INIT_SUPPRESS_STDERR
|
||||
bool
|
||||
prompt "Suppress stderr messages of init" if INITOPT
|
||||
default y
|
||||
help
|
||||
Prevents showing stderr messages for init command if not already
|
||||
suppressed during preinit. This is the default behaviour in
|
||||
previous versions of OpenWRT. Removing this does nothing if
|
||||
stderr is suppressed during preinit (which is the default).
|
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=broadcom-diag
|
||||
PKG_RELEASE:=5
|
||||
PKG_RELEASE:=6
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
@ -138,6 +138,9 @@ enum {
|
||||
|
||||
/* Askey */
|
||||
RT210W,
|
||||
|
||||
/* OvisLink */
|
||||
WL1600GL,
|
||||
};
|
||||
|
||||
static void __init bcm4780_init(void) {
|
||||
@ -852,6 +855,19 @@ static struct platform_t __initdata platforms[] = {
|
||||
{ .name = "power", .gpio = 1 << 5, .polarity = REVERSE },
|
||||
},
|
||||
},
|
||||
[WL1600GL] = {
|
||||
.name = "OvisLink WL-1600GL",
|
||||
.buttons = {
|
||||
{ .name = "reset", .gpio = 1 << 3 },
|
||||
{ .name = "ses", .gpio = 1 << 4 },
|
||||
},
|
||||
.leds = {
|
||||
{ .name = "power", .gpio = 1 << 5, .polarity = REVERSE },
|
||||
{ .name = "wps", .gpio = 1 << 2, .polarity = REVERSE },
|
||||
{ .name = "wlan", .gpio = 1 << 1, .polarity = REVERSE },
|
||||
{ .name = "connected", .gpio = 1 << 0, .polarity = REVERSE },
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static struct platform_t __init *platform_detect(void)
|
||||
@ -966,6 +982,10 @@ static struct platform_t __init *platform_detect(void)
|
||||
if (!strcmp(boardnum, "1024") && !strcmp(boardtype, "0x0446"))
|
||||
return &platforms[WAP54GV2];
|
||||
|
||||
if (!strcmp(boardnum, "8") && !strcmp(boardtype, "0x048e"))
|
||||
return &platforms[WL1600GL];
|
||||
|
||||
|
||||
if (!strcmp(boardnum, "44") || !strcmp(boardnum, "44\r")) {
|
||||
if (!strcmp(boardtype,"0x0101") || !strcmp(boardtype, "0x0101\r"))
|
||||
return &platforms[TM2300V2]; /* Dell TrueMobile 2300 v2 */
|
||||
|
@ -1,46 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2007 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=broadcom-mmc
|
||||
PKG_VERSION:=0.1
|
||||
PKG_RELEASE:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
MAKEFLAGS_KMOD:= -C "$(LINUX_DIR)" \
|
||||
CROSS_COMPILE="$(TARGET_CROSS)" \
|
||||
ARCH="$(LINUX_KARCH)" \
|
||||
PATH="$(TARGET_PATH)" \
|
||||
SUBDIRS="$(PKG_BUILD_DIR)"
|
||||
|
||||
define KernelPackage/broadcom-mmc
|
||||
SUBMENU:=Other modules
|
||||
DEPENDS:=@TARGET_brcm_2_4
|
||||
TITLE:=Kernel driver for the Linksys WRT54G MM/SD-Card Mod
|
||||
URL:=http://kiel.kool.dk/
|
||||
FILES:=$(PKG_BUILD_DIR)/mmc.$(LINUX_KMOD_SUFFIX)
|
||||
AUTOLOAD:=$(call AutoLoad,80,mmc)
|
||||
endef
|
||||
|
||||
define KernelPackage/broadcom-mmc/description
|
||||
Kernel driver for the Linksys WRT54G MM/SD-Card Mod
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
$(CP) ./src/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) $(MAKEFLAGS_KMOD) \
|
||||
modules
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,broadcom-mmc))
|
@ -1,7 +0,0 @@
|
||||
obj-m := mmc.o
|
||||
|
||||
ifeq ($(MAKING_MODULES),1)
|
||||
|
||||
-include $(TOPDIR)/Rules.make
|
||||
endif
|
||||
|
@ -1,676 +0,0 @@
|
||||
#include <linux/delay.h>
|
||||
#include <linux/timer.h>
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/blkpg.h>
|
||||
#include <linux/hdreg.h>
|
||||
#include <linux/major.h>
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
#define DEVICE_NAME "mmc"
|
||||
#define DEVICE_NR(device) (MINOR(device))
|
||||
#define DEVICE_ON(device)
|
||||
#define DEVICE_OFF(device)
|
||||
#define MAJOR_NR 121
|
||||
|
||||
#include <linux/blk.h>
|
||||
|
||||
MODULE_AUTHOR("Madsuk/Rohde");
|
||||
MODULE_DESCRIPTION("Driver MMC/SD-Cards");
|
||||
MODULE_SUPPORTED_DEVICE("WRT54G");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
#define SD_DI 0x20
|
||||
#define SD_DO 0x10
|
||||
#define SD_CLK 0x08
|
||||
#define SD_CS 0x80
|
||||
|
||||
/* we have only one device */
|
||||
static int hd_sizes[1<<6];
|
||||
static int hd_blocksizes[1<<6];
|
||||
static int hd_hardsectsizes[1<<6];
|
||||
static int hd_maxsect[1<<6];
|
||||
static struct hd_struct hd[1<<6];
|
||||
|
||||
static struct timer_list mmc_timer;
|
||||
static int mmc_media_detect = 0;
|
||||
static int mmc_media_changed = 1;
|
||||
|
||||
typedef unsigned int uint32;
|
||||
|
||||
static unsigned char port_state = 0x00;
|
||||
static volatile uint32 *gpioaddr_input = (uint32 *)0xb8000060;
|
||||
static volatile uint32 *gpioaddr_output = (uint32 *)0xb8000064;
|
||||
static volatile uint32 *gpioaddr_enable = (uint32 *)0xb8000068;
|
||||
static volatile uint32 *gpioaddr_control = (uint32 *)0xb800006c;
|
||||
|
||||
static void mmc_spi_cs_low(void)
|
||||
{
|
||||
port_state &= ~(SD_CS);
|
||||
*gpioaddr_output = port_state;
|
||||
}
|
||||
|
||||
static void mmc_spi_cs_high(void)
|
||||
{
|
||||
port_state |= SD_CS;
|
||||
*gpioaddr_output = port_state;
|
||||
}
|
||||
|
||||
static unsigned char mmc_spi_io(unsigned char data_out)
|
||||
{
|
||||
int i;
|
||||
unsigned char result = 0, tmp_data = 0;
|
||||
|
||||
for(i=0; i<8; i++) {
|
||||
if(data_out & (0x01 << (7-i)))
|
||||
port_state |= SD_DI;
|
||||
else
|
||||
port_state &= ~SD_DI;
|
||||
|
||||
*gpioaddr_output = port_state;
|
||||
port_state |= SD_CLK;
|
||||
*gpioaddr_output = port_state;
|
||||
|
||||
tmp_data = *gpioaddr_input;
|
||||
|
||||
port_state &= ~SD_CLK;
|
||||
*gpioaddr_output = port_state;
|
||||
|
||||
result <<= 1;
|
||||
|
||||
if(tmp_data & SD_DO)
|
||||
result |= 1;
|
||||
}
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
||||
static int mmc_write_block(unsigned int dest_addr, unsigned char *data)
|
||||
{
|
||||
unsigned int address;
|
||||
unsigned char r = 0;
|
||||
unsigned char ab0, ab1, ab2, ab3;
|
||||
int i;
|
||||
|
||||
address = dest_addr;
|
||||
|
||||
ab3 = 0xff & (address >> 24);
|
||||
ab2 = 0xff & (address >> 16);
|
||||
ab1 = 0xff & (address >> 8);
|
||||
ab0 = 0xff & address;
|
||||
mmc_spi_cs_low();
|
||||
for (i = 0; i < 4; i++) mmc_spi_io(0xff);
|
||||
mmc_spi_io(0x58);
|
||||
mmc_spi_io(ab3); /* msb */
|
||||
mmc_spi_io(ab2);
|
||||
mmc_spi_io(ab1);
|
||||
mmc_spi_io(ab0); /* lsb */
|
||||
mmc_spi_io(0xff);
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
r = mmc_spi_io(0xff);
|
||||
if (r == 0x00) break;
|
||||
}
|
||||
if (r != 0x00)
|
||||
{
|
||||
mmc_spi_cs_high();
|
||||
mmc_spi_io(0xff);
|
||||
return(1);
|
||||
}
|
||||
|
||||
mmc_spi_io(0xfe);
|
||||
for (i = 0; i < 512; i++) mmc_spi_io(data[i]);
|
||||
for (i = 0; i < 2; i++) mmc_spi_io(0xff);
|
||||
|
||||
for (i = 0; i < 1000000; i++)
|
||||
{
|
||||
r = mmc_spi_io(0xff);
|
||||
if (r == 0xff) break;
|
||||
}
|
||||
if (r != 0xff)
|
||||
{
|
||||
mmc_spi_cs_high();
|
||||
mmc_spi_io(0xff);
|
||||
return(3);
|
||||
}
|
||||
mmc_spi_cs_high();
|
||||
mmc_spi_io(0xff);
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int mmc_read_block(unsigned char *data, unsigned int src_addr)
|
||||
{
|
||||
unsigned int address;
|
||||
unsigned char r = 0;
|
||||
unsigned char ab0, ab1, ab2, ab3;
|
||||
int i;
|
||||
|
||||
address = src_addr;
|
||||
|
||||
ab3 = 0xff & (address >> 24);
|
||||
ab2 = 0xff & (address >> 16);
|
||||
ab1 = 0xff & (address >> 8);
|
||||
ab0 = 0xff & address;
|
||||
|
||||
mmc_spi_cs_low();
|
||||
for (i = 0; i < 4; i++) mmc_spi_io(0xff);
|
||||
mmc_spi_io(0x51);
|
||||
mmc_spi_io(ab3); /* msb */
|
||||
mmc_spi_io(ab2);
|
||||
mmc_spi_io(ab1);
|
||||
mmc_spi_io(ab0); /* lsb */
|
||||
|
||||
mmc_spi_io(0xff);
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
r = mmc_spi_io(0xff);
|
||||
if (r == 0x00) break;
|
||||
}
|
||||
if (r != 0x00)
|
||||
{
|
||||
mmc_spi_cs_high();
|
||||
mmc_spi_io(0xff);
|
||||
return(1);
|
||||
}
|
||||
for (i = 0; i < 100000; i++)
|
||||
{
|
||||
r = mmc_spi_io(0xff);
|
||||
if (r == 0xfe) break;
|
||||
}
|
||||
if (r != 0xfe)
|
||||
{
|
||||
mmc_spi_cs_high();
|
||||
mmc_spi_io(0xff);
|
||||
return(2);
|
||||
}
|
||||
for (i = 0; i < 512; i++)
|
||||
{
|
||||
r = mmc_spi_io(0xff);
|
||||
data[i] = r;
|
||||
}
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
r = mmc_spi_io(0xff);
|
||||
}
|
||||
mmc_spi_cs_high();
|
||||
mmc_spi_io(0xff);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
static void mmc_request(request_queue_t *q)
|
||||
{
|
||||
unsigned int mmc_address;
|
||||
unsigned char *buffer_address;
|
||||
int nr_sectors;
|
||||
int i;
|
||||
int cmd;
|
||||
int rc, code;
|
||||
|
||||
(void)q;
|
||||
while (1)
|
||||
{
|
||||
code = 1; // Default is success
|
||||
INIT_REQUEST;
|
||||
mmc_address = (CURRENT->sector + hd[MINOR(CURRENT->rq_dev)].start_sect) * hd_hardsectsizes[0];
|
||||
buffer_address = CURRENT->buffer;
|
||||
nr_sectors = CURRENT->current_nr_sectors;
|
||||
cmd = CURRENT->cmd;
|
||||
if (((CURRENT->sector + CURRENT->current_nr_sectors + hd[MINOR(CURRENT->rq_dev)].start_sect) > hd[0].nr_sects) || (mmc_media_detect == 0))
|
||||
{
|
||||
code = 0;
|
||||
}
|
||||
else if (cmd == READ)
|
||||
{
|
||||
spin_unlock_irq(&io_request_lock);
|
||||
for (i = 0; i < nr_sectors; i++)
|
||||
{
|
||||
rc = mmc_read_block(buffer_address, mmc_address);
|
||||
if (rc != 0)
|
||||
{
|
||||
printk("mmc: error in mmc_read_block (%d)\n", rc);
|
||||
code = 0;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
mmc_address += hd_hardsectsizes[0];
|
||||
buffer_address += hd_hardsectsizes[0];
|
||||
}
|
||||
}
|
||||
spin_lock_irq(&io_request_lock);
|
||||
}
|
||||
else if (cmd == WRITE)
|
||||
{
|
||||
spin_unlock_irq(&io_request_lock);
|
||||
for (i = 0; i < nr_sectors; i++)
|
||||
{
|
||||
rc = mmc_write_block(mmc_address, buffer_address);
|
||||
if (rc != 0)
|
||||
{
|
||||
printk("mmc: error in mmc_write_block (%d)\n", rc);
|
||||
code = 0;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
mmc_address += hd_hardsectsizes[0];
|
||||
buffer_address += hd_hardsectsizes[0];
|
||||
}
|
||||
}
|
||||
spin_lock_irq(&io_request_lock);
|
||||
}
|
||||
else
|
||||
{
|
||||
code = 0;
|
||||
}
|
||||
end_request(code);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int mmc_open(struct inode *inode, struct file *filp)
|
||||
{
|
||||
int device;
|
||||
(void)filp;
|
||||
|
||||
if (mmc_media_detect == 0) return -ENODEV;
|
||||
|
||||
#if defined(MODULE)
|
||||
MOD_INC_USE_COUNT;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mmc_release(struct inode *inode, struct file *filp)
|
||||
{
|
||||
(void)filp;
|
||||
fsync_dev(inode->i_rdev);
|
||||
invalidate_buffers(inode->i_rdev);
|
||||
|
||||
#if defined(MODULE)
|
||||
MOD_DEC_USE_COUNT;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern struct gendisk hd_gendisk;
|
||||
static int mmc_revalidate(kdev_t dev)
|
||||
{
|
||||
int target, max_p, start, i;
|
||||
if (mmc_media_detect == 0) return -ENODEV;
|
||||
|
||||
target = DEVICE_NR(dev);
|
||||
|
||||
max_p = hd_gendisk.max_p;
|
||||
start = target << 6;
|
||||
for (i = max_p - 1; i >= 0; i--) {
|
||||
int minor = start + i;
|
||||
invalidate_device(MKDEV(MAJOR_NR, minor), 1);
|
||||
hd_gendisk.part[minor].start_sect = 0;
|
||||
hd_gendisk.part[minor].nr_sects = 0;
|
||||
}
|
||||
|
||||
grok_partitions(&hd_gendisk, target, 1 << 6,
|
||||
hd_sizes[0] * 2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mmc_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
if (!inode || !inode->i_rdev)
|
||||
return -EINVAL;
|
||||
|
||||
switch(cmd) {
|
||||
case BLKGETSIZE:
|
||||
return put_user(hd[MINOR(inode->i_rdev)].nr_sects, (unsigned long *)arg);
|
||||
case BLKGETSIZE64:
|
||||
return put_user((u64)hd[MINOR(inode->i_rdev)].
|
||||
nr_sects, (u64 *) arg);
|
||||
case BLKRRPART:
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
return -EACCES;
|
||||
|
||||
return mmc_revalidate(inode->i_rdev);
|
||||
case HDIO_GETGEO:
|
||||
{
|
||||
struct hd_geometry *loc, g;
|
||||
loc = (struct hd_geometry *) arg;
|
||||
if (!loc)
|
||||
return -EINVAL;
|
||||
g.heads = 4;
|
||||
g.sectors = 16;
|
||||
g.cylinders = hd[0].nr_sects / (4 * 16);
|
||||
g.start = hd[MINOR(inode->i_rdev)].start_sect;
|
||||
return copy_to_user(loc, &g, sizeof(g)) ? -EFAULT : 0;
|
||||
}
|
||||
default:
|
||||
return blk_ioctl(inode->i_rdev, cmd, arg);
|
||||
}
|
||||
}
|
||||
|
||||
static int mmc_card_init(void)
|
||||
{
|
||||
unsigned char r = 0;
|
||||
short i, j;
|
||||
unsigned long flags;
|
||||
|
||||
save_flags(flags);
|
||||
cli();
|
||||
|
||||
printk("mmc Card init\n");
|
||||
mmc_spi_cs_high();
|
||||
for (i = 0; i < 20; i++) mmc_spi_io(0xff);
|
||||
|
||||
mmc_spi_cs_low();
|
||||
|
||||
mmc_spi_io(0x40);
|
||||
for (i = 0; i < 4; i++) mmc_spi_io(0x00);
|
||||
mmc_spi_io(0x95);
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
r = mmc_spi_io(0xff);
|
||||
if (r == 0x01) break;
|
||||
}
|
||||
mmc_spi_cs_high();
|
||||
mmc_spi_io(0xff);
|
||||
if (r != 0x01)
|
||||
{
|
||||
restore_flags(flags);
|
||||
return(1);
|
||||
}
|
||||
|
||||
printk("mmc Card init *1*\n");
|
||||
for (j = 0; j < 10000; j++)
|
||||
{
|
||||
mmc_spi_cs_low();
|
||||
|
||||
mmc_spi_io(0x41);
|
||||
for (i = 0; i < 4; i++) mmc_spi_io(0x00);
|
||||
mmc_spi_io(0xff);
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
r = mmc_spi_io(0xff);
|
||||
if (r == 0x00) break;
|
||||
}
|
||||
mmc_spi_cs_high();
|
||||
mmc_spi_io(0xff);
|
||||
if (r == 0x00)
|
||||
{
|
||||
restore_flags(flags);
|
||||
printk("mmc Card init *2*\n");
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
restore_flags(flags);
|
||||
|
||||
return(2);
|
||||
}
|
||||
|
||||
static int mmc_card_config(void)
|
||||
{
|
||||
unsigned char r = 0;
|
||||
short i;
|
||||
unsigned char csd[32];
|
||||
unsigned int c_size;
|
||||
unsigned int c_size_mult;
|
||||
unsigned int mult;
|
||||
unsigned int read_bl_len;
|
||||
unsigned int blocknr = 0;
|
||||
unsigned int block_len = 0;
|
||||
unsigned int size = 0;
|
||||
|
||||
mmc_spi_cs_low();
|
||||
for (i = 0; i < 4; i++) mmc_spi_io(0xff);
|
||||
mmc_spi_io(0x49);
|
||||
for (i = 0; i < 4; i++) mmc_spi_io(0x00);
|
||||
mmc_spi_io(0xff);
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
r = mmc_spi_io(0xff);
|
||||
if (r == 0x00) break;
|
||||
}
|
||||
if (r != 0x00)
|
||||
{
|
||||
mmc_spi_cs_high();
|
||||
mmc_spi_io(0xff);
|
||||
return(1);
|
||||
}
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
r = mmc_spi_io(0xff);
|
||||
if (r == 0xfe) break;
|
||||
}
|
||||
if (r != 0xfe)
|
||||
{
|
||||
mmc_spi_cs_high();
|
||||
mmc_spi_io(0xff);
|
||||
return(2);
|
||||
}
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
r = mmc_spi_io(0xff);
|
||||
csd[i] = r;
|
||||
}
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
r = mmc_spi_io(0xff);
|
||||
}
|
||||
mmc_spi_cs_high();
|
||||
mmc_spi_io(0xff);
|
||||
if (r == 0x00) return(3);
|
||||
|
||||
c_size = csd[8] + csd[7] * 256 + (csd[6] & 0x03) * 256 * 256;
|
||||
c_size >>= 6;
|
||||
c_size_mult = csd[10] + (csd[9] & 0x03) * 256;
|
||||
c_size_mult >>= 7;
|
||||
read_bl_len = csd[5] & 0x0f;
|
||||
mult = 1;
|
||||
mult <<= c_size_mult + 2;
|
||||
blocknr = (c_size + 1) * mult;
|
||||
block_len = 1;
|
||||
block_len <<= read_bl_len;
|
||||
size = block_len * blocknr;
|
||||
size >>= 10;
|
||||
|
||||
for(i=0; i<(1<<6); i++) {
|
||||
hd_blocksizes[i] = 1024;
|
||||
hd_hardsectsizes[i] = block_len;
|
||||
hd_maxsect[i] = 256;
|
||||
}
|
||||
hd_sizes[0] = size;
|
||||
hd[0].nr_sects = blocknr;
|
||||
|
||||
|
||||
printk("Size = %d, hardsectsize = %d, sectors = %d\n",
|
||||
size, block_len, blocknr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mmc_hardware_init(void)
|
||||
{
|
||||
unsigned char gpio_outen;
|
||||
|
||||
// Set inputs/outputs here
|
||||
printk("mmc Hardware init\n");
|
||||
gpio_outen = *gpioaddr_enable;
|
||||
|
||||
gpio_outen = (gpio_outen | SD_DI | SD_CLK | SD_CS) & ~SD_DO;
|
||||
*gpioaddr_enable = gpio_outen;
|
||||
|
||||
port_state = *gpioaddr_input;
|
||||
|
||||
// Clock low
|
||||
port_state &= ~(SD_CLK | SD_DI | SD_CS);
|
||||
*gpioaddr_output = port_state;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mmc_check_media_change(kdev_t dev)
|
||||
{
|
||||
(void)dev;
|
||||
if (mmc_media_changed == 1)
|
||||
{
|
||||
mmc_media_changed = 0;
|
||||
return 1;
|
||||
}
|
||||
else return 0;
|
||||
}
|
||||
|
||||
static struct block_device_operations mmc_bdops =
|
||||
{
|
||||
open: mmc_open,
|
||||
release: mmc_release,
|
||||
ioctl: mmc_ioctl,
|
||||
#if 0
|
||||
check_media_change: mmc_check_media_change,
|
||||
revalidate: mmc_revalidate,
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct gendisk hd_gendisk = {
|
||||
major: MAJOR_NR,
|
||||
major_name: DEVICE_NAME,
|
||||
minor_shift: 6,
|
||||
max_p: 1 << 6,
|
||||
part: hd,
|
||||
sizes: hd_sizes,
|
||||
fops: &mmc_bdops,
|
||||
};
|
||||
|
||||
static int mmc_init(void)
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = mmc_hardware_init();
|
||||
|
||||
if ( rc != 0)
|
||||
{
|
||||
printk("mmc: error in mmc_hardware_init (%d)\n", rc);
|
||||
return -1;
|
||||
}
|
||||
|
||||
rc = mmc_card_init();
|
||||
if ( rc != 0)
|
||||
{
|
||||
// Give it an extra shot
|
||||
rc = mmc_card_init();
|
||||
if ( rc != 0)
|
||||
{
|
||||
printk("mmc: error in mmc_card_init (%d)\n", rc);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
memset(hd_sizes, 0, sizeof(hd_sizes));
|
||||
rc = mmc_card_config();
|
||||
if ( rc != 0)
|
||||
{
|
||||
printk("mmc: error in mmc_card_config (%d)\n", rc);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
blk_size[MAJOR_NR] = hd_sizes;
|
||||
|
||||
memset(hd, 0, sizeof(hd));
|
||||
hd[0].nr_sects = hd_sizes[0]*2;
|
||||
|
||||
blksize_size[MAJOR_NR] = hd_blocksizes;
|
||||
hardsect_size[MAJOR_NR] = hd_hardsectsizes;
|
||||
max_sectors[MAJOR_NR] = hd_maxsect;
|
||||
|
||||
hd_gendisk.nr_real = 1;
|
||||
|
||||
register_disk(&hd_gendisk, MKDEV(MAJOR_NR,0), 1<<6,
|
||||
&mmc_bdops, hd_sizes[0]*2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void mmc_exit(void)
|
||||
{
|
||||
blk_size[MAJOR_NR] = NULL;
|
||||
blksize_size[MAJOR_NR] = NULL;
|
||||
hardsect_size[MAJOR_NR] = NULL;
|
||||
max_sectors[MAJOR_NR] = NULL;
|
||||
hd[0].nr_sects = 0;
|
||||
}
|
||||
|
||||
static void mmc_check_media(void)
|
||||
{
|
||||
int old_state;
|
||||
int rc;
|
||||
|
||||
old_state = mmc_media_detect;
|
||||
|
||||
// TODO: Add card detection here
|
||||
mmc_media_detect = 1;
|
||||
if (old_state != mmc_media_detect)
|
||||
{
|
||||
mmc_media_changed = 1;
|
||||
if (mmc_media_detect == 1)
|
||||
{
|
||||
rc = mmc_init();
|
||||
if (rc != 0) printk("mmc: error in mmc_init (%d)\n", rc);
|
||||
}
|
||||
else
|
||||
{
|
||||
mmc_exit();
|
||||
}
|
||||
}
|
||||
|
||||
/* del_timer(&mmc_timer);
|
||||
mmc_timer.expires = jiffies + 10*HZ;
|
||||
add_timer(&mmc_timer); */
|
||||
}
|
||||
|
||||
static int __init mmc_driver_init(void)
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = devfs_register_blkdev(MAJOR_NR, DEVICE_NAME, &mmc_bdops);
|
||||
if (rc < 0)
|
||||
{
|
||||
printk(KERN_WARNING "mmc: can't get major %d\n", MAJOR_NR);
|
||||
return rc;
|
||||
}
|
||||
|
||||
blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), mmc_request);
|
||||
|
||||
read_ahead[MAJOR_NR] = 8;
|
||||
add_gendisk(&hd_gendisk);
|
||||
|
||||
mmc_check_media();
|
||||
|
||||
/*init_timer(&mmc_timer);
|
||||
mmc_timer.expires = jiffies + HZ;
|
||||
mmc_timer.function = (void *)mmc_check_media;
|
||||
add_timer(&mmc_timer);*/
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __exit mmc_driver_exit(void)
|
||||
{
|
||||
int i;
|
||||
del_timer(&mmc_timer);
|
||||
|
||||
for (i = 0; i < (1 << 6); i++)
|
||||
fsync_dev(MKDEV(MAJOR_NR, i));
|
||||
|
||||
blk_cleanup_queue(BLK_DEFAULT_QUEUE(MAJOR_NR));
|
||||
del_gendisk(&hd_gendisk);
|
||||
devfs_unregister_blkdev(MAJOR_NR, DEVICE_NAME);
|
||||
mmc_exit();
|
||||
}
|
||||
|
||||
module_init(mmc_driver_init);
|
||||
module_exit(mmc_driver_exit);
|
57
package/broadcom-sdhc/Makefile
Normal file
57
package/broadcom-sdhc/Makefile
Normal file
@ -0,0 +1,57 @@
|
||||
#
|
||||
# High Capacity Media card driver. Handles high capacity and standard multimedia
|
||||
# and secure digital cards
|
||||
#
|
||||
# This makefile is compatible for building under the kamikaze 8.09 branch
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=broadcom-sdhc
|
||||
PKG_VERSION:=2.0.2
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=http://www.4mul8.ca/openwrt/source/broadcom-sdhc-2.0.2
|
||||
PKG_MD5SUM:=6238463bce27e64829eda1d88f1a7edd
|
||||
PKG_CAT:=zcat
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define KernelPackage/broadcom-sdhc
|
||||
SUBMENU:=Other modules
|
||||
DEPENDS:=@TARGET_brcm_2_4
|
||||
TITLE:= MMHC/SDHC card driver - Linksys WRT54G/GS/GL
|
||||
VERSION:=$(LINUX_VERSION)-$(BOARD)-$(PKG_VERSION)-$(PKG_RELEASE)
|
||||
FILES:=\
|
||||
$(PKG_BUILD_DIR)/sdhc.$(LINUX_KMOD_SUFFIX)\
|
||||
$(PKG_BUILD_DIR)/sdhcd.$(LINUX_KMOD_SUFFIX)
|
||||
URL:=http://www.4mul8.ca/openwrt
|
||||
endef
|
||||
|
||||
define KernelPackage/broadcom-sdhc/description
|
||||
Driver for Linksys WRT54G/GS/GL MM/SD card modification.
|
||||
Supports standard and high capacity cards.
|
||||
May work for other broadcom based routers (Buffalo, etc).
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) -C "$(LINUX_DIR)" \
|
||||
CROSS_COMPILE="$(TARGET_CROSS)" \
|
||||
ARCH="$(LINUX_KARCH)" \
|
||||
SUBDIRS="$(PKG_BUILD_DIR)" \
|
||||
modules
|
||||
endef
|
||||
|
||||
define KernelPackage/broadcom-sdhc/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/sdcard $(1)/etc/init.d/sdcard
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/sdcard.conf $(1)/etc/sdcard.conf
|
||||
$(CP) $(PKG_BUILD_DIR)/sdhc.o $(1)/lib/modules/$(LINUX_VERSION)/
|
||||
$(CP) $(PKG_BUILD_DIR)/sdhcd.o $(1)/lib/modules/$(LINUX_VERSION)/
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,broadcom-sdhc))
|
@ -42,7 +42,7 @@ scan_broadcom() {
|
||||
|
||||
local _c=
|
||||
for vif in ${adhoc_if:-$sta_if $ap_if $mon_if}; do
|
||||
config_set "$vif" ifname "wl0${_c:+.$_c}"
|
||||
config_set "$vif" ifname "${device}${_c:+.$_c}"
|
||||
_c=$((${_c:-0} + 1))
|
||||
done
|
||||
config_set "$device" vifs "${adhoc_if:-$sta_if $ap_if $mon_if}"
|
||||
@ -93,13 +93,14 @@ scan_broadcom() {
|
||||
}
|
||||
|
||||
disable_broadcom() {
|
||||
set_wifi_down "$1"
|
||||
wlc down
|
||||
local device="$1"
|
||||
set_wifi_down "$device"
|
||||
wlc ifname "$device" down
|
||||
(
|
||||
include /lib/network
|
||||
|
||||
# make sure the interfaces are down and removed from all bridges
|
||||
for dev in wl0 wl0.1 wl0.2 wl0.3; do
|
||||
for dev in $device ${device}.1 ${device}.2 ${device}.3; do
|
||||
ifconfig "$dev" down 2>/dev/null >/dev/null && {
|
||||
unbridge "$dev"
|
||||
}
|
||||
@ -109,6 +110,7 @@ disable_broadcom() {
|
||||
}
|
||||
|
||||
enable_broadcom() {
|
||||
local device="$1"
|
||||
local _c
|
||||
config_get channel "$device" channel
|
||||
config_get country "$device" country
|
||||
@ -132,6 +134,7 @@ enable_broadcom() {
|
||||
|
||||
_c=0
|
||||
nas="$(which nas)"
|
||||
[ -n "$nas" ] && nas="start-stop-daemon -S -b -x $nas -- "
|
||||
nas_cmd=
|
||||
if_up=
|
||||
|
||||
@ -181,11 +184,15 @@ enable_broadcom() {
|
||||
nasopts=
|
||||
config_get enc "$vif" encryption
|
||||
case "$enc" in
|
||||
WEP|wep)
|
||||
*WEP*|*wep*)
|
||||
wsec_r=1
|
||||
wsec=1
|
||||
defkey=1
|
||||
config_get key "$vif" key
|
||||
case "$enc" in
|
||||
*shared*) append vif_do_up "wepauth 1" "$N";;
|
||||
*) append vif_do_up "wepauth 0" "$N";;
|
||||
esac
|
||||
case "$key" in
|
||||
[1234])
|
||||
defkey="$key"
|
||||
@ -280,7 +287,7 @@ enable_broadcom() {
|
||||
_c=$(($_c + 1))
|
||||
done
|
||||
killall -KILL nas >&- 2>&-
|
||||
wlc stdin <<EOF
|
||||
wlc ifname "$device" stdin <<EOF
|
||||
$ifdown
|
||||
|
||||
apsta $apsta
|
||||
@ -314,7 +321,7 @@ up
|
||||
$vif_post_up
|
||||
EOF
|
||||
eval "$if_up"
|
||||
wlc stdin <<EOF
|
||||
wlc ifname "$device" stdin <<EOF
|
||||
$vif_do_up
|
||||
EOF
|
||||
|
||||
@ -328,11 +335,13 @@ EOF
|
||||
|
||||
|
||||
detect_broadcom() {
|
||||
[ -f /proc/net/wl0 ] || return
|
||||
config_get type wl0 type
|
||||
[ "$type" = broadcom ] && return
|
||||
cat <<EOF
|
||||
config wifi-device wl0
|
||||
local i=0
|
||||
|
||||
while [ -f /proc/net/wl$((i++)) ]; do
|
||||
config_get type wl${i} type
|
||||
[ "$type" = broadcom ] && continue
|
||||
cat <<EOF
|
||||
config wifi-device wl${i}
|
||||
option type broadcom
|
||||
option channel 5
|
||||
|
||||
@ -340,10 +349,12 @@ config wifi-device wl0
|
||||
option disabled 1
|
||||
|
||||
config wifi-iface
|
||||
option device wl0
|
||||
option device wl${i}
|
||||
option network lan
|
||||
option mode ap
|
||||
option ssid OpenWrt
|
||||
option ssid OpenWrt${i#0}
|
||||
option encryption none
|
||||
|
||||
EOF
|
||||
done
|
||||
}
|
||||
|
@ -663,6 +663,13 @@ static const struct wlc_call wlc_calls[] = {
|
||||
.handler = wlc_wsec_key,
|
||||
.desc = "Set/Remove WEP keys"
|
||||
},
|
||||
{
|
||||
.name = "wepauth",
|
||||
.param = INT,
|
||||
.handler = wlc_ioctl,
|
||||
.data.num = ((WLC_GET_AUTH << 16) | WLC_SET_AUTH),
|
||||
.desc = "WEP authentication type. 0 = OpenSystem, 1 = SharedKey"
|
||||
},
|
||||
{
|
||||
.name = "wsec_restrict",
|
||||
.param = INT,
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2006 OpenWrt.org
|
||||
# Copyright (C) 2010 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
@ -9,12 +9,13 @@ include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=carl9170
|
||||
PKG_VERSION:=0.9.2.1
|
||||
PKG_VERSION:=0.9.9.1
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||
PKG_SOURCE_URL:=http://www.kernel.org/pub/linux/kernel/people/chr/carl9170/$(PKG_VERSION)
|
||||
PKG_MD5SUM:=5f0057ea651343460ea4f1fb093a4bdf
|
||||
PKG_SOURCE_URL:=@KERNEL/linux/kernel/people/chr/carl9170/$(PKG_VERSION) \
|
||||
@KERNEL/linux/kernel/people/chr/carl9170/old/$(PKG_VERSION)
|
||||
PKG_MD5SUM:=122610b254125d93c7f64cc559d3341a
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
@ -23,7 +24,7 @@ DRV_PATH:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/carl9170
|
||||
define KernelPackage/carl9170
|
||||
SUBMENU:=Wireless Drivers
|
||||
TITLE:=Driver for Atheros AR9170 USB sticks
|
||||
DEPENDS:=+kmod-mac80211 +kmod-ath
|
||||
DEPENDS:=@USB_SUPPORT +kmod-mac80211 +kmod-ath +kmod-usb-core
|
||||
URL:=http://www.kernel.org/pub/linux/kernel/people/chr/carl9170
|
||||
FILES:=$(DRV_PATH)/carl9170usb.$(LINUX_KMOD_SUFFIX)
|
||||
AUTOLOAD:=$(call AutoLoad,60,carl9170usb)
|
||||
@ -38,7 +39,7 @@ define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
$(HOST_TAR) -C $(PKG_BUILD_DIR) -xjf $(DL_DIR)/$(PKG_SOURCE)
|
||||
$(HOST_TAR) -C $(PKG_BUILD_DIR) -xf $(PKG_BUILD_DIR)/$(PKG_VERSION)/driver/carl9170-driver-$(PKG_VERSION).tar
|
||||
ln -s Makefile.standalone $(DRV_PATH)/Makefile
|
||||
ln -sf Makefile.standalone $(DRV_PATH)/Makefile
|
||||
ln -s $(STAGING_DIR)/usr/include/mac80211/ath/*.h $(PKG_BUILD_DIR)/drivers/net/wireless/ath/
|
||||
$(Build/Patch)
|
||||
endef
|
||||
|
@ -1,93 +0,0 @@
|
||||
--- a/drivers/net/wireless/ath/carl9170/fw.c
|
||||
+++ b/drivers/net/wireless/ath/carl9170/fw.c
|
||||
@@ -39,7 +39,7 @@ const void *ar9170_fw_find_desc(struct a
|
||||
for_each_hdr(iter, ar->fw_desc) {
|
||||
if (!memcmp(iter->magic, descid, sizeof(*descid)) &&
|
||||
!CHECK_HDR_VERSION(iter, compatible_revision) &&
|
||||
- (iter->length >= len)) {
|
||||
+ (le16_to_cpu(iter->length) >= len)) {
|
||||
ret = (void *)iter;
|
||||
break;
|
||||
}
|
||||
@@ -63,20 +63,22 @@ static int ar9170_fw_verify_descs(struct
|
||||
end = (void *) head + max_len;
|
||||
|
||||
while (pos < end) {
|
||||
- if (((unsigned long)pos + pos->length) > (unsigned long)end)
|
||||
+ int pos_length = le16_to_cpu(pos->length);
|
||||
+
|
||||
+ if (((unsigned long)pos + pos_length) > (unsigned long)end)
|
||||
return -EMSGSIZE;
|
||||
|
||||
- if (pos->length > max_len)
|
||||
+ if (pos_length > max_len)
|
||||
return -EMSGSIZE;
|
||||
|
||||
- if (pos->length < sizeof(struct carl9170_fw_desc_head))
|
||||
+ if (pos_length < sizeof(struct carl9170_fw_desc_head))
|
||||
return -EINVAL;
|
||||
|
||||
if (!memcmp(pos->magic, last_magic, sizeof(last_magic)))
|
||||
return 0;
|
||||
|
||||
- pos = (void *)((unsigned long)pos + pos->length);
|
||||
- max_len -= pos->length;
|
||||
+ pos = (void *)((unsigned long)pos + pos_length);
|
||||
+ max_len -= le16_to_cpu(pos->length);
|
||||
}
|
||||
|
||||
return -EINVAL;
|
||||
@@ -139,7 +141,7 @@ static int ar9170_fw_check(struct ar9170
|
||||
if (SUPP(CARL9170_FW_CRC32_CHECKSUM_TAIL)) {
|
||||
__le32 crc32;
|
||||
|
||||
- crc32 = crc32_le(~0, data, len - 4);
|
||||
+ crc32 = cpu_to_le32(crc32_le(~0, data, len - 4));
|
||||
if (!memcmp(&crc32, &data[len - 4], 4) == 0) {
|
||||
dev_err(ar->pdev, "CRC32 checksum mismatch!\n");
|
||||
return -EINVAL;
|
||||
--- a/drivers/net/wireless/ath/carl9170/fwhdr.h
|
||||
+++ b/drivers/net/wireless/ath/carl9170/fwhdr.h
|
||||
@@ -196,7 +196,7 @@ struct carl9170_fw_last_desc_v1 {
|
||||
#define for_each_hdr(desc, fw_desc) \
|
||||
for (desc = fw_desc; \
|
||||
(memcmp(desc->magic, LAST_MAGIC, 4) && desc->length); \
|
||||
- desc = (void *)((unsigned long)desc + desc->length))
|
||||
+ desc = (void *)((unsigned long)desc + le16_to_cpu(desc->length)))
|
||||
|
||||
#define CHECK_HDR_VERSION(head, _min_ver) \
|
||||
(((head)->cur_ver < _min_ver) || ((head)->min_ver > _min_ver)) \
|
||||
--- a/drivers/net/wireless/ath/carl9170/usb.c
|
||||
+++ b/drivers/net/wireless/ath/carl9170/usb.c
|
||||
@@ -640,9 +640,10 @@ static int ar9170_usb_check_firmware(str
|
||||
}
|
||||
|
||||
if ((usb_desc->tx_descs < 16) ||
|
||||
- (usb_desc->tx_frag_len < 64) || (usb_desc->tx_frag_len > 512) ||
|
||||
- (usb_desc->rx_max_frame_len < 1024) ||
|
||||
- (usb_desc->rx_max_frame_len > AR9170_MAX_RX_BUFFER_SIZE)) {
|
||||
+ (le16_to_cpu(usb_desc->tx_frag_len) < 64) ||
|
||||
+ (le16_to_cpu(usb_desc->tx_frag_len) > 512) ||
|
||||
+ (le16_to_cpu(usb_desc->rx_max_frame_len) < 1024) ||
|
||||
+ (le16_to_cpu(usb_desc->rx_max_frame_len) > AR9170_MAX_RX_BUFFER_SIZE)) {
|
||||
dev_err(&aru->udev->dev, "usb firmware has obvious signs of "
|
||||
"malicious tampering.\n");
|
||||
err = -EINVAL;
|
||||
@@ -650,14 +651,14 @@ static int ar9170_usb_check_firmware(str
|
||||
}
|
||||
|
||||
if (SUPP(CARL9170_FW_USB_MINIBOOT))
|
||||
- aru->fw_offset = usb_desc->miniboot_size;
|
||||
+ aru->fw_offset = le16_to_cpu(usb_desc->miniboot_size);
|
||||
else
|
||||
aru->fw_offset = 0;
|
||||
|
||||
- aru->rx_size = usb_desc->rx_max_frame_len;
|
||||
+ aru->rx_size = le16_to_cpu(usb_desc->rx_max_frame_len);
|
||||
aru->common.mem_blocks = usb_desc->tx_descs;
|
||||
atomic_set(&aru->common.mem_free_blocks, usb_desc->tx_descs);
|
||||
- aru->common.mem_block_size = usb_desc->tx_frag_len;
|
||||
+ aru->common.mem_block_size = le16_to_cpu(usb_desc->tx_frag_len);
|
||||
return 0;
|
||||
|
||||
fail:
|
@ -1,10 +0,0 @@
|
||||
--- a/drivers/net/wireless/ath/carl9170/debug.c
|
||||
+++ b/drivers/net/wireless/ath/carl9170/debug.c
|
||||
@@ -38,6 +38,7 @@
|
||||
*/
|
||||
|
||||
#include <linux/seq_file.h>
|
||||
+#include <linux/vmalloc.h>
|
||||
#include "carl9170.h"
|
||||
#include "usb.h"
|
||||
#include "cmd.h"
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2006-2009 OpenWrt.org
|
||||
# Copyright (C) 2006-2010 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
@ -8,12 +8,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=dnsmasq
|
||||
PKG_VERSION:=2.51
|
||||
PKG_RELEASE:=3
|
||||
PKG_VERSION:=2.52
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq
|
||||
PKG_MD5SUM:=97465261a6de5258a3c3edfe51ca16a4
|
||||
PKG_MD5SUM:=1bb32fffdb4f977ead607802b5d701d0
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
@ -1,15 +1,13 @@
|
||||
Index: dnsmasq-2.51/src/config.h
|
||||
===================================================================
|
||||
--- dnsmasq-2.51.orig/src/config.h
|
||||
+++ dnsmasq-2.51/src/config.h
|
||||
@@ -270,8 +270,9 @@ NOTES:
|
||||
--- a/src/config.h
|
||||
+++ b/src/config.h
|
||||
@@ -269,8 +269,9 @@ NOTES:
|
||||
/* 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 IPV6_V6ONLY 26
|
||||
# define ADDRSTRLEN INET6_ADDRSTRLEN
|
||||
# if defined(SOL_IPV6)
|
||||
# define IPV6_LEVEL SOL_IPV6
|
||||
|
@ -1,48 +0,0 @@
|
||||
Index: dnsmasq-2.51/src/netlink.c
|
||||
===================================================================
|
||||
--- dnsmasq-2.51.orig/src/netlink.c
|
||||
+++ dnsmasq-2.51/src/netlink.c
|
||||
@@ -129,6 +129,7 @@ int iface_enumerate(void *parm, int (*ip
|
||||
ssize_t len;
|
||||
static unsigned int seq = 0;
|
||||
int family = AF_INET;
|
||||
+ int ipv4_done = 0;
|
||||
|
||||
struct {
|
||||
struct nlmsghdr nlh;
|
||||
@@ -207,9 +208,12 @@ int iface_enumerate(void *parm, int (*ip
|
||||
rta = RTA_NEXT(rta, len1);
|
||||
}
|
||||
|
||||
- if (addr.s_addr && ipv4_callback)
|
||||
+ if (addr.s_addr && ipv4_callback) {
|
||||
if (!((*ipv4_callback)(addr, ifa->ifa_index, netmask, broadcast, parm)))
|
||||
return 0;
|
||||
+ else
|
||||
+ ipv4_done = 1;
|
||||
+ }
|
||||
}
|
||||
#ifdef HAVE_IPV6
|
||||
else if (ifa->ifa_family == AF_INET6)
|
||||
@@ -225,7 +229,7 @@ int iface_enumerate(void *parm, int (*ip
|
||||
|
||||
if (addrp && ipv6_callback)
|
||||
if (!((*ipv6_callback)(addrp, ifa->ifa_index, ifa->ifa_index, parm)))
|
||||
- return 0;
|
||||
+ return ipv4_done;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
Index: dnsmasq-2.51/src/network.c
|
||||
===================================================================
|
||||
--- dnsmasq-2.51.orig/src/network.c
|
||||
+++ dnsmasq-2.51/src/network.c
|
||||
@@ -302,7 +302,7 @@ static int create_ipv6_listener(struct l
|
||||
bind(tcpfd, (struct sockaddr *)&addr, sa_len(&addr)) == -1 ||
|
||||
listen(tcpfd, 5) == -1 ||
|
||||
bind(fd, (struct sockaddr *)&addr, sa_len(&addr)) == -1)
|
||||
- return 0;
|
||||
+ return 1;
|
||||
|
||||
l = safe_malloc(sizeof(struct listener));
|
||||
l->fd = fd;
|
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=dropbear
|
||||
PKG_VERSION:=0.52
|
||||
PKG_RELEASE:=3
|
||||
PKG_RELEASE:=4
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:= \
|
||||
|
@ -38,10 +38,13 @@ dropbear_start()
|
||||
local bannerfile
|
||||
config_get bannerfile ${section} BannerFile
|
||||
[ -f $bannerfile ] || bannerfile=''
|
||||
|
||||
# D) gatewayports
|
||||
local gatewayports
|
||||
config_get_bool gatewayports "${section}" GatewayPorts 0
|
||||
[ "${gatewayports}" -eq 1 ] || gatewayports=''
|
||||
# concatenate parameters
|
||||
local args
|
||||
args="${nopasswd:+-s }${port:+-p ${port} }${bannerfile:+-b $bannerfile }-P /var/run/${NAME}.${PIDCOUNT}.pid"
|
||||
args="${nopasswd:+-s }${port:+-p ${port} }${bannerfile:+-b $bannerfile }${gatewayports:+-a }-P /var/run/${NAME}.${PIDCOUNT}.pid"
|
||||
|
||||
# execute program and return its exit code
|
||||
[ "${verbosed}" -ne 0 ] && echo "${initscript}: section ${section} starting ${PROG} ${args}"
|
||||
|
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
||||
PKG_NAME:=firewall
|
||||
|
||||
PKG_VERSION:=1
|
||||
PKG_RELEASE:=9
|
||||
PKG_RELEASE:=10
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
@ -506,9 +506,13 @@ fw_init() {
|
||||
uci_set_state firewall core loaded 1
|
||||
config_set core loaded 1
|
||||
config_foreach fw_check_notrack zone
|
||||
INTERFACES="$(sh -c '. /etc/functions.sh; config_load network; config_foreach echo interface')"
|
||||
INTERFACES="$(sh -c '
|
||||
. /etc/functions.sh; config_load network
|
||||
echo_up() { local up; config_get_bool up "$1" up 0; [ $up = 1 ] && echo "$1"; }
|
||||
config_foreach echo_up interface
|
||||
')"
|
||||
for interface in $INTERFACES; do
|
||||
fw_addif "$interface"
|
||||
fw_event ifup "$interface"
|
||||
done
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ endef
|
||||
define KernelPackage/hostap
|
||||
$(call KernelPackage/hostap/Default)
|
||||
TITLE:=Host AP support for Prism2/2.5/3
|
||||
DEPENDS:=@PCI_SUPPORT||PCMCIA_SUPPORT +!(LINUX_2_6_30||LINUX_2_6_31||LINUX_2_6_32):kmod-ieee80211 +LINUX_2_6_30||LINUX_2_6_31||LINUX_2_6_32:kmod-lib80211 +wireless-tools
|
||||
DEPENDS:=@PCI_SUPPORT||PCMCIA_SUPPORT +LINUX_2_6:kmod-lib80211 +wireless-tools
|
||||
KCONFIG:=CONFIG_HOSTAP CONFIG_HOSTAP_FIRMWARE=y CONFIG_HOSTAP_FIRMWARE_NVRAM=y
|
||||
PROVIDES:=kmod-hostap
|
||||
endef
|
||||
|
@ -1,14 +1,15 @@
|
||||
# wpa_supplicant config
|
||||
config WPA_SUPPLICANT_NO_TIMESTAMP_CHECK
|
||||
bool "Disable timestamp check"
|
||||
depends PACKAGE_wpa-supplicant
|
||||
depends PACKAGE_wpa-supplicant || PACKAGE_wpa-supplicant-mini || PACKAGE_wpad || PACKAGE_wpad-mini
|
||||
default n
|
||||
help
|
||||
This disables the timestamp check for certificates in wpa_supplicant
|
||||
Useful for devices without RTC that cannot reliably get the real date/time
|
||||
|
||||
choice
|
||||
prompt "Choose TLS provider"
|
||||
default WPA_SUPPLICANT_INTERNAL
|
||||
prompt "Choose TLS provider"
|
||||
default WPA_SUPPLICANT_INTERNAL
|
||||
depends PACKAGE_wpa-supplicant
|
||||
|
||||
config WPA_SUPPLICANT_INTERNAL
|
@ -8,9 +8,9 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=hostapd
|
||||
PKG_VERSION:=20100108
|
||||
PKG_VERSION:=20100117
|
||||
PKG_RELEASE:=1
|
||||
PKG_REV:=d97572a40fd7ec77094e2e4ef83424a4c0f7e24d
|
||||
PKG_REV:=43a7fe2e0e614e52fa05ff4d78af91bd4e17d3b2
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||
PKG_SOURCE_URL:=git://w1.fi/srv/git/hostap.git
|
||||
@ -23,6 +23,7 @@ PKG_BUILD_DEPENDS:= \
|
||||
PACKAGE_kmod-mac80211:mac80211 \
|
||||
|
||||
PKG_CONFIG_DEPENDS:= \
|
||||
CONFIG_WPA_SUPPLICANT_NO_TIMESTAMP_CHECK \
|
||||
CONFIG_PACKAGE_kmod-ath9k \
|
||||
CONFIG_PACKAGE_kmod-mac80211 \
|
||||
CONFIG_PACKAGE_kmod-madwifi \
|
||||
@ -30,6 +31,21 @@ PKG_CONFIG_DEPENDS:= \
|
||||
CONFIG_PACKAGE_hostapd-mini \
|
||||
CONFIG_PACKAGE_kmod-hostap
|
||||
|
||||
LOCAL_TYPE=$(strip \
|
||||
$(if $(findstring wpad,$(BUILD_VARIANT)),wpad, \
|
||||
$(if $(findstring supplicant,$(BUILD_VARIANT)),supplicant, \
|
||||
hostapd \
|
||||
)))
|
||||
LOCAL_VARIANT=$(patsubst wpad-%,%,$(patsubst supplicant-%,%,$(BUILD_VARIANT)))
|
||||
|
||||
ifeq ($(LOCAL_TYPE),supplicant)
|
||||
ifeq ($(LOCAL_VARIANT),full)
|
||||
PKG_CONFIG_DEPENDS += \
|
||||
CONFIG_WPA_SUPPLICANT_INTERNAL \
|
||||
CONFIG_WPA_SUPPLICANT_OPENSSL
|
||||
endif
|
||||
endif
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
@ -40,6 +56,20 @@ DRIVER_MAKEOPTS= \
|
||||
CONFIG_DRIVER_HOSTAP=$(CONFIG_PACKAGE_kmod-hostap) \
|
||||
CONFIG_IEEE80211N=$(CONFIG_PACKAGE_kmod-ath9k)
|
||||
|
||||
ifeq ($(LOCAL_TYPE),supplicant)
|
||||
ifeq ($(LOCAL_VARIANT),full)
|
||||
DRIVER_MAKEOPTS += $(if $(CONFIG_WPA_SUPPLICANT_OPENSSL),CONFIG_TLS=openssl)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(LOCAL_TYPE),hostapd)
|
||||
ifdef CONFIG_WPA_SUPPLICANT_NO_TIMESTAMP_CHECK
|
||||
TARGET_CFLAGS += -DNO_TIMESTAMP_CHECK
|
||||
DRIVER_MAKEOPTS += \
|
||||
CONFIG_DRIVER_ROBOSWITCH=$(CONFIG_PACKAGE_kmod-switch)
|
||||
endif
|
||||
endif
|
||||
|
||||
define Package/hostapd/Default
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
@ -80,12 +110,80 @@ define Package/hostapd-utils/description
|
||||
IEEE 802.1x/WPA/EAP/RADIUS Authenticator.
|
||||
endef
|
||||
|
||||
define Package/wpad/Default
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=IEEE 802.1x Authenticator/Supplicant
|
||||
URL:=http://hostap.epitest.fi/
|
||||
DEPENDS:=@!TARGET_avr32 @!TARGET_etrax +PACKAGE_kmod-mac80211:libnl-tiny
|
||||
endef
|
||||
|
||||
define Package/wpad
|
||||
$(call Package/wpad/Default)
|
||||
TITLE+= (full)
|
||||
VARIANT:=wpad-full
|
||||
endef
|
||||
|
||||
define Package/wpad/description
|
||||
This package contains a full featured IEEE 802.1x/WPA/EAP/RADIUS
|
||||
Authenticator and Supplicant
|
||||
endef
|
||||
|
||||
define Package/wpad-mini
|
||||
$(call Package/wpad/Default)
|
||||
TITLE+= (WPA-PSK only)
|
||||
VARIANT:=wpad-mini
|
||||
endef
|
||||
|
||||
define Package/wpad-mini/description
|
||||
This package contains a minimal IEEE 802.1x/WPA Authenticator and Supplicant (WPA-PSK only).
|
||||
endef
|
||||
|
||||
define Package/wpa-supplicant
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=WPA Supplicant
|
||||
URL:=http://hostap.epitest.fi/wpa_supplicant/
|
||||
DEPENDS:=@!TARGET_avr32 @!TARGET_etrax +PACKAGE_kmod-mac80211:libnl-tiny
|
||||
VARIANT:=supplicant-full
|
||||
endef
|
||||
|
||||
define Package/wpa-supplicant/Description
|
||||
WPA Supplicant
|
||||
endef
|
||||
|
||||
define Package/wpa-supplicant/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
define Package/wpa-supplicant-mini
|
||||
$(Package/wpa-supplicant)
|
||||
TITLE:=WPA Supplicant (minimal version)
|
||||
DEPENDS:=$(if $(CONFIG_WPA_SUPPLICANT_OPENSSL),+libopenssl)
|
||||
VARIANT:=supplicant-mini
|
||||
endef
|
||||
|
||||
define Package/wpa-supplicant-mini/Description
|
||||
WPA Supplicant (minimal version)
|
||||
endef
|
||||
|
||||
define Package/wpa-cli
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
DEPENDS:=wpa-supplicant
|
||||
TITLE:=WPA Supplicant command line interface
|
||||
endef
|
||||
|
||||
define Package/wpa-cli/Description
|
||||
WPA Supplicant control utility
|
||||
endef
|
||||
|
||||
|
||||
ifneq ($(wildcard $(PKG_BUILD_DIR)/.config_*),$(subst .configured_,.config_,$(STAMP_CONFIGURED)))
|
||||
$(warning $(wildcard $(PKG_BUILD_DIR)/.config_*) != $(subst .configured_,.config_,$(STAMP_CONFIGURED)))
|
||||
define Build/Configure/rebuild
|
||||
$(FIND) $(PKG_BUILD_DIR) -name \*.o -or -name \*.a | $(XARGS) rm -f
|
||||
rm -f $(PKG_BUILD_DIR)/hostapd/hostapd
|
||||
rm -f $(PKG_BUILD_DIR)/hostapd/*.o
|
||||
rm -f $(PKG_BUILD_DIR)/src/drivers/drivers.o
|
||||
rm -f $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant
|
||||
rm -f $(PKG_BUILD_DIR)/.config_*
|
||||
touch $(subst .configured_,.config_,$(STAMP_CONFIGURED))
|
||||
endef
|
||||
@ -93,7 +191,8 @@ endif
|
||||
|
||||
define Build/Configure
|
||||
$(Build/Configure/rebuild)
|
||||
$(CP) ./files/$(BUILD_VARIANT).config $(PKG_BUILD_DIR)/hostapd/.config
|
||||
$(CP) ./files/hostapd-$(LOCAL_VARIANT).config $(PKG_BUILD_DIR)/hostapd/.config
|
||||
$(CP) ./files/wpa_supplicant-$(LOCAL_VARIANT).config $(PKG_BUILD_DIR)/wpa_supplicant/.config
|
||||
endef
|
||||
|
||||
TARGET_CPPFLAGS := \
|
||||
@ -109,30 +208,108 @@ ifdef CONFIG_PACKAGE_kmod-mac80211
|
||||
TARGET_LDFLAGS += -lm -lnl-tiny
|
||||
endif
|
||||
|
||||
define Build/Compile
|
||||
define Build/RunMake
|
||||
CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
|
||||
$(MAKE) -C $(PKG_BUILD_DIR)/hostapd \
|
||||
$(MAKE) -C $(PKG_BUILD_DIR)/$(1) \
|
||||
$(TARGET_CONFIGURE_OPTS) \
|
||||
$(DRIVER_MAKEOPTS) \
|
||||
LIBS="$(TARGET_LDFLAGS)" \
|
||||
hostapd hostapd_cli
|
||||
$(2)
|
||||
endef
|
||||
|
||||
define Package/hostapd/install
|
||||
define Build/Compile/wpad
|
||||
echo ` \
|
||||
$(call Build/RunMake,hostapd,-s MULTICALL=1 dump_cflags); \
|
||||
$(call Build/RunMake,wpa_supplicant,-s dump_cflags) | sed -e 's,$(TARGET_CFLAGS),,' \
|
||||
` > $(PKG_BUILD_DIR)/.cflags
|
||||
$(call Build/RunMake,hostapd, \
|
||||
CFLAGS="$$$$(cat $(PKG_BUILD_DIR)/.cflags)" \
|
||||
MULTICALL=1 \
|
||||
hostapd_cli hostapd_multi.a \
|
||||
)
|
||||
$(call Build/RunMake,wpa_supplicant, \
|
||||
CFLAGS="$$$$(cat $(PKG_BUILD_DIR)/.cflags)" \
|
||||
MULTICALL=1 \
|
||||
wpa_cli wpa_supplicant_multi.a \
|
||||
)
|
||||
$(TARGET_CC) -o $(PKG_BUILD_DIR)/wpad \
|
||||
$(TARGET_CFLAGS) \
|
||||
./files/multicall.c \
|
||||
$(PKG_BUILD_DIR)/hostapd/hostapd_multi.a \
|
||||
$(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant_multi.a \
|
||||
$(TARGET_LDFLAGS)
|
||||
endef
|
||||
|
||||
define Build/Compile/hostapd
|
||||
$(call Build/RunMake,hostapd, \
|
||||
hostapd hostapd_cli \
|
||||
)
|
||||
endef
|
||||
|
||||
define Build/Compile/supplicant
|
||||
$(call Build/RunMake,wpa_supplicant, \
|
||||
wpa_cli wpa_supplicant \
|
||||
)
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(Build/Compile/$(LOCAL_TYPE))
|
||||
endef
|
||||
|
||||
define Install/hostapd
|
||||
$(INSTALL_DIR) $(1)/etc/hotplug.d/net
|
||||
$(INSTALL_DATA) ./files/hostapd.hotplug $(1)/etc/hotplug.d/net/
|
||||
$(INSTALL_DIR) $(1)/lib/wifi
|
||||
$(INSTALL_DATA) ./files/hostapd.sh $(1)/lib/wifi/hostapd.sh
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
endef
|
||||
|
||||
define Install/supplicant
|
||||
$(INSTALL_DIR) $(1)/lib/wifi
|
||||
$(INSTALL_DATA) ./files/wpa_supplicant.sh $(1)/lib/wifi/wpa_supplicant.sh
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
endef
|
||||
|
||||
define Package/hostapd/install
|
||||
$(call Install/hostapd,$(1))
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd $(1)/usr/sbin/
|
||||
endef
|
||||
Package/hostapd-mini/install = $(Package/hostapd/install)
|
||||
|
||||
define Package/hostapd-utils/install
|
||||
ifneq ($(LOCAL_TYPE),supplicant)
|
||||
define Package/hostapd-utils/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd_cli $(1)/usr/sbin/
|
||||
endef
|
||||
endif
|
||||
|
||||
define Package/wpad/install
|
||||
$(call Install/hostapd,$(1))
|
||||
$(call Install/supplicant,$(1))
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/wpad $(1)/usr/sbin/
|
||||
ln -sf wpad $(1)/usr/sbin/hostapd
|
||||
ln -sf wpad $(1)/usr/sbin/wpa_supplicant
|
||||
endef
|
||||
Package/wpad-mini/install = $(Package/wpad/install)
|
||||
|
||||
define Package/wpa-supplicant/install
|
||||
$(call Install/supplicant,$(1))
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant $(1)/usr/sbin/
|
||||
endef
|
||||
Package/wpa-supplicant-mini/install = $(Package/wpa-supplicant/install)
|
||||
|
||||
ifneq ($(LOCAL_TYPE),hostapd)
|
||||
define Package/wpa-cli/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(CP) $(PKG_BUILD_DIR)/wpa_supplicant/wpa_cli $(1)/usr/sbin/
|
||||
endef
|
||||
endif
|
||||
|
||||
$(eval $(call BuildPackage,hostapd))
|
||||
$(eval $(call BuildPackage,hostapd-mini))
|
||||
$(eval $(call BuildPackage,wpad))
|
||||
$(eval $(call BuildPackage,wpad-mini))
|
||||
$(eval $(call BuildPackage,wpa-supplicant))
|
||||
$(eval $(call BuildPackage,wpa-supplicant-mini))
|
||||
$(eval $(call BuildPackage,wpa-cli))
|
||||
$(eval $(call BuildPackage,hostapd-utils))
|
||||
|
@ -1,7 +1,10 @@
|
||||
hostapd_setup_vif() {
|
||||
local vif="$1"
|
||||
local driver="$2"
|
||||
local hostapd_cfg=
|
||||
hostapd_set_bss_options() {
|
||||
local var="$1"
|
||||
local vif="$2"
|
||||
local enc wpa_group_rekey
|
||||
|
||||
config_get enc "$vif" encryption
|
||||
config_get wpa_group_rekey "$vif" wpa_group_rekey
|
||||
|
||||
# Examples:
|
||||
# psk-mixed/tkip => WPA1+2 PSK, TKIP
|
||||
@ -14,7 +17,7 @@ hostapd_setup_vif() {
|
||||
|
||||
# crypto defaults: WPA2 vs WPA1
|
||||
case "$enc" in
|
||||
wpa2*|WPA2*|*PSK2*|*psk2*)
|
||||
wpa2*|*psk2*)
|
||||
wpa=2
|
||||
crypto="CCMP"
|
||||
;;
|
||||
@ -30,137 +33,82 @@ hostapd_setup_vif() {
|
||||
|
||||
# explicit override for crypto setting
|
||||
case "$enc" in
|
||||
*tkip+aes|*TKIP+AES|*tkip+ccmp|*TKIP+CCMP) crypto="CCMP TKIP";;
|
||||
*tkip|*TKIP) crypto="TKIP";;
|
||||
*aes|*AES|*ccmp|*CCMP) crypto="CCMP";;
|
||||
*tkip+aes|*tkip+ccmp) crypto="CCMP TKIP";;
|
||||
*aes|*ccmp) crypto="CCMP";;
|
||||
*tkip) crypto="TKIP";;
|
||||
esac
|
||||
|
||||
# use crypto/auth settings for building the hostapd config
|
||||
case "$enc" in
|
||||
*psk*|*PSK*)
|
||||
*psk*)
|
||||
config_get psk "$vif" key
|
||||
if [ ${#psk} -eq 64 ]; then
|
||||
append hostapd_cfg "wpa_psk=$psk" "$N"
|
||||
append "$var" "wpa_psk=$psk" "$N"
|
||||
else
|
||||
append hostapd_cfg "wpa_passphrase=$psk" "$N"
|
||||
append "$var" "wpa_passphrase=$psk" "$N"
|
||||
fi
|
||||
;;
|
||||
*wpa*|*WPA*)
|
||||
*wpa*)
|
||||
# required fields? formats?
|
||||
# hostapd is particular, maybe a default configuration for failures
|
||||
config_get server "$vif" server
|
||||
append hostapd_cfg "auth_server_addr=$server" "$N"
|
||||
append "$var" "auth_server_addr=$server" "$N"
|
||||
config_get port "$vif" port
|
||||
port=${port:-1812}
|
||||
append hostapd_cfg "auth_server_port=$port" "$N"
|
||||
append "$var" "auth_server_port=$port" "$N"
|
||||
config_get secret "$vif" key
|
||||
append hostapd_cfg "auth_server_shared_secret=$secret" "$N"
|
||||
append "$var" "auth_server_shared_secret=$secret" "$N"
|
||||
config_get nasid "$vif" nasid
|
||||
append hostapd_cfg "nas_identifier=$nasid" "$N"
|
||||
append hostapd_cfg "eapol_key_index_workaround=1" "$N"
|
||||
append hostapd_cfg "radius_acct_interim_interval=300" "$N"
|
||||
append hostapd_cfg "ieee8021x=1" "$N"
|
||||
append hostapd_cfg "auth_algs=1" "$N"
|
||||
append hostapd_cfg "wpa_key_mgmt=WPA-EAP" "$N"
|
||||
append hostapd_cfg "wpa_group_rekey=300" "$N"
|
||||
append hostapd_cfg "wpa_gmk_rekey=640" "$N"
|
||||
append "$var" "nas_identifier=$nasid" "$N"
|
||||
append "$var" "eapol_key_index_workaround=1" "$N"
|
||||
append "$var" "radius_acct_interim_interval=300" "$N"
|
||||
append "$var" "ieee8021x=1" "$N"
|
||||
append "$var" "auth_algs=1" "$N"
|
||||
append "$var" "wpa_key_mgmt=WPA-EAP" "$N"
|
||||
append "$var" "wpa_group_rekey=300" "$N"
|
||||
append "$var" "wpa_gmk_rekey=640" "$N"
|
||||
;;
|
||||
*)
|
||||
wpa=0
|
||||
crypto=
|
||||
;;
|
||||
esac
|
||||
config_get ifname "$vif" ifname
|
||||
config_get bridge "$vif" bridge
|
||||
append "$var" "wpa=$wpa" "$N"
|
||||
[ -n "$crypto" ] && append "$var" "wpa_pairwise=$crypto" "$N"
|
||||
[ -n "$wpa_group_rekey" ] && append "$var" "wpa_group_rekey=$wpa_group_rekey" "$N"
|
||||
|
||||
config_get ssid "$vif" ssid
|
||||
config_get bridge "$vif" bridge
|
||||
config_get ieee80211d "$vif" ieee80211d
|
||||
|
||||
append "$var" "ssid=$ssid" "$N"
|
||||
[ -n "$bridge" ] && append "$var" "bridge=$bridge" "$N"
|
||||
[ -n "$ieee80211d" ] && append "$var" "ieee80211d=$ieee80211d" "$N"
|
||||
}
|
||||
|
||||
hostapd_setup_vif() {
|
||||
local vif="$1"
|
||||
local driver="$2"
|
||||
hostapd_cfg=
|
||||
|
||||
hostapd_set_bss_options hostapd_cfg "$vif"
|
||||
config_get ifname "$vif" ifname
|
||||
config_get device "$vif" device
|
||||
config_get channel "$device" channel
|
||||
config_get hwmode "$device" hwmode
|
||||
config_get wpa_group_rekey "$vif" wpa_group_rekey
|
||||
config_get ieee80211d "$vif" ieee80211d
|
||||
config_get_bool hidden "$vif" hidden 0
|
||||
config_get_bool wds "$vif" wds 0
|
||||
[ "$wds" -gt 0 -a "$driver" = "nl80211" ] && wds="wds_sta=1" || wds=""
|
||||
case "$hwmode" in
|
||||
bg) hwmode=g;;
|
||||
esac
|
||||
config_get country "$device" country
|
||||
[ "$channel" = auto ] && channel=
|
||||
[ -n "$channel" -a -z "$hwmode" ] && wifi_fixup_hwmode "$device"
|
||||
[ -n "$hwmode" ] && {
|
||||
config_get hwmode_11n "$device" hwmode_11n
|
||||
[ -n "$hwmode_11n" ] && {
|
||||
hwmode="$hwmode_11n"
|
||||
config_get ht_capab "$device" ht_capab
|
||||
[ -n "$ht_capab" -a -n "${ht_capab%%\[*}" ] && {
|
||||
ht_capab=`echo "[$ht_capab]" | sed -e 's, ,][,g'`
|
||||
}
|
||||
}
|
||||
}
|
||||
cat > /var/run/hostapd-$ifname.conf <<EOF
|
||||
ctrl_interface=/var/run/hostapd-$ifname
|
||||
driver=$driver
|
||||
interface=$ifname
|
||||
${hwmode:+hw_mode=$hwmode}
|
||||
${channel:+channel=$channel}
|
||||
${bridge:+bridge=$bridge}
|
||||
ssid=$ssid
|
||||
wpa=$wpa
|
||||
${crypto:+wpa_pairwise=$crypto}
|
||||
${country:+country_code=$country}
|
||||
${hwmode_11n:+ieee80211n=1}
|
||||
${ht_capab:+ht_capab=$ht_capab}
|
||||
${wpa_group_rekey:+wpa_group_rekey=$wpa_group_rekey}
|
||||
${ieee80211d:+ieee80211d=$ieee80211d}
|
||||
$wds
|
||||
$hostapd_cfg
|
||||
EOF
|
||||
case "$driver" in
|
||||
madwifi)
|
||||
;;
|
||||
*)
|
||||
cat >> /var/run/hostapd-$ifname.conf <<EOF
|
||||
ignore_broadcast_ssid=$hidden
|
||||
wmm_enabled=1
|
||||
wmm_ac_bk_cwmin=4
|
||||
wmm_ac_bk_cwmax=10
|
||||
wmm_ac_bk_aifs=7
|
||||
wmm_ac_bk_txop_limit=0
|
||||
wmm_ac_bk_acm=0
|
||||
wmm_ac_be_aifs=3
|
||||
wmm_ac_be_cwmin=4
|
||||
wmm_ac_be_cwmax=10
|
||||
wmm_ac_be_txop_limit=0
|
||||
wmm_ac_be_acm=0
|
||||
wmm_ac_vi_aifs=2
|
||||
wmm_ac_vi_cwmin=3
|
||||
wmm_ac_vi_cwmax=4
|
||||
wmm_ac_vi_txop_limit=94
|
||||
wmm_ac_vi_acm=0
|
||||
wmm_ac_vo_aifs=2
|
||||
wmm_ac_vo_cwmin=2
|
||||
wmm_ac_vo_cwmax=3
|
||||
wmm_ac_vo_txop_limit=47
|
||||
wmm_ac_vo_acm=0
|
||||
tx_queue_data3_aifs=7
|
||||
tx_queue_data3_cwmin=15
|
||||
tx_queue_data3_cwmax=1023
|
||||
tx_queue_data3_burst=0
|
||||
tx_queue_data2_aifs=3
|
||||
tx_queue_data2_cwmin=15
|
||||
tx_queue_data2_cwmax=63
|
||||
tx_queue_data2_burst=0
|
||||
tx_queue_data1_aifs=1
|
||||
tx_queue_data1_cwmin=7
|
||||
tx_queue_data1_cwmax=15
|
||||
tx_queue_data1_burst=3.0
|
||||
tx_queue_data0_aifs=1
|
||||
tx_queue_data0_cwmin=3
|
||||
tx_queue_data0_cwmax=7
|
||||
tx_queue_data0_burst=1.5
|
||||
EOF
|
||||
;;
|
||||
esac
|
||||
hostapd -P /var/run/wifi-$ifname.pid -B /var/run/hostapd-$ifname.conf
|
||||
}
|
||||
|
||||
|
28
package/hostapd/files/multicall.c
Normal file
28
package/hostapd/files/multicall.c
Normal file
@ -0,0 +1,28 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
extern int hostapd_main(int argc, char **argv);
|
||||
extern int wpa_supplicant_main(int argc, char **argv);
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
bool restart = false;
|
||||
const char *prog = argv[0];
|
||||
|
||||
restart:
|
||||
if (strstr(argv[0], "hostapd"))
|
||||
return hostapd_main(argc, argv);
|
||||
else if (strstr(argv[0], "wpa_supplicant"))
|
||||
return wpa_supplicant_main(argc, argv);
|
||||
|
||||
if (!restart && argc > 1) {
|
||||
argv++;
|
||||
argc--;
|
||||
restart = true;
|
||||
goto restart;
|
||||
}
|
||||
|
||||
fprintf(stderr, "Invalid command.\nUsage: %s wpa_supplicant|hostapd [<arguments>]\n", prog);
|
||||
return 255;
|
||||
}
|
@ -50,20 +50,17 @@ CONFIG_DRIVER_HOSTAP=y
|
||||
#CFLAGS += -I../../include/wireless
|
||||
|
||||
# Driver interface for madwifi driver
|
||||
CONFIG_DRIVER_MADWIFI=y
|
||||
# Deprecated; use CONFIG_DRIVER_WEXT=y instead.
|
||||
#CONFIG_DRIVER_MADWIFI=y
|
||||
# Set include directory to the madwifi source tree
|
||||
#CFLAGS += -I../../madwifi
|
||||
|
||||
# Driver interface for Prism54 driver
|
||||
# (Note: Prism54 is not yet supported, i.e., this will not work as-is and is
|
||||
# for developers only)
|
||||
#CONFIG_DRIVER_PRISM54=y
|
||||
|
||||
# Driver interface for ndiswrapper
|
||||
# Deprecated; use CONFIG_DRIVER_WEXT=y instead.
|
||||
#CONFIG_DRIVER_NDISWRAPPER=y
|
||||
|
||||
# Driver interface for Atmel driver
|
||||
#CONFIG_DRIVER_ATMEL=y
|
||||
# CONFIG_DRIVER_ATMEL=y
|
||||
|
||||
# Driver interface for old Broadcom driver
|
||||
# Please note that the newer Broadcom driver ("hybrid Linux driver") supports
|
||||
@ -74,6 +71,7 @@ CONFIG_DRIVER_MADWIFI=y
|
||||
#CFLAGS += -I/opt/WRT54GS/release/src/include
|
||||
|
||||
# Driver interface for Intel ipw2100/2200 driver
|
||||
# Deprecated; use CONFIG_DRIVER_WEXT=y instead.
|
||||
#CONFIG_DRIVER_IPW=y
|
||||
|
||||
# Driver interface for Ralink driver
|
||||
@ -83,12 +81,14 @@ CONFIG_DRIVER_MADWIFI=y
|
||||
CONFIG_DRIVER_WEXT=y
|
||||
|
||||
# Driver interface for Linux drivers using the nl80211 kernel interface
|
||||
#CONFIG_DRIVER_NL80211=y
|
||||
CONFIG_DRIVER_NL80211=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
|
||||
#LIBS_p += -L/usr/local/lib
|
||||
#LIBS_c += -L/usr/local/lib
|
||||
|
||||
# Driver interface for Windows NDIS
|
||||
#CONFIG_DRIVER_NDIS=y
|
||||
@ -109,12 +109,20 @@ CONFIG_DRIVER_WEXT=y
|
||||
# Driver interface for development testing
|
||||
#CONFIG_DRIVER_TEST=y
|
||||
|
||||
# Include client MLME (management frame processing) for test driver
|
||||
# This can be used to test MLME operations in hostapd with the test interface.
|
||||
# space.
|
||||
#CONFIG_CLIENT_MLME=y
|
||||
|
||||
# Driver interface for wired Ethernet drivers
|
||||
CONFIG_DRIVER_WIRED=y
|
||||
|
||||
# Driver interface for the Broadcom RoboSwitch family
|
||||
#CONFIG_DRIVER_ROBOSWITCH=y
|
||||
|
||||
# Driver interface for no driver (e.g., WPS ER only)
|
||||
#CONFIG_DRIVER_NONE=y
|
||||
|
||||
# Enable IEEE 802.1X Supplicant (automatically included if any EAP method is
|
||||
# included)
|
||||
CONFIG_IEEE8021X_EAPOL=y
|
||||
@ -145,7 +153,7 @@ CONFIG_EAP_TTLS=y
|
||||
CONFIG_EAP_GTC=y
|
||||
|
||||
# EAP-OTP
|
||||
#CONFIG_EAP_OTP=y
|
||||
CONFIG_EAP_OTP=y
|
||||
|
||||
# EAP-SIM (enable CONFIG_PCSC, if EAP-SIM is used)
|
||||
#CONFIG_EAP_SIM=y
|
||||
@ -192,7 +200,7 @@ CONFIG_PKCS12=y
|
||||
|
||||
# Smartcard support (i.e., private key on a smartcard), e.g., with openssl
|
||||
# engine.
|
||||
#CONFIG_SMARTCARD=y
|
||||
CONFIG_SMARTCARD=y
|
||||
|
||||
# PC/SC interface for smartcards (USIM, GSM SIM)
|
||||
# Enable this if EAP-SIM or EAP-AKA is included
|
||||
@ -238,11 +246,6 @@ CONFIG_CTRL_IFACE=y
|
||||
# wpa_passphrase). This saves about 0.5 kB in code size.
|
||||
#CONFIG_NO_WPA_PASSPHRASE=y
|
||||
|
||||
# Remove AES extra functions. This can be used to reduce code size by about
|
||||
# 1.5 kB by removing extra AES modes that are not needed for commonly used
|
||||
# client configurations (they are needed for some EAP types).
|
||||
#CONFIG_NO_AES_EXTRAS=y
|
||||
|
||||
# Disable scan result processing (ap_mode=1) to save code size by about 1 kB.
|
||||
# This can be used if ap_scan=1 mode is never enabled.
|
||||
#CONFIG_NO_SCAN_PROCESSING=y
|
||||
@ -259,7 +262,7 @@ CONFIG_BACKEND=file
|
||||
# configuration can still be changed, the changes are just not going to be
|
||||
# persistent over restarts. This option can be used to reduce code size by
|
||||
# about 3.5 kB.
|
||||
CONFIG_NO_CONFIG_WRITE=y
|
||||
#CONFIG_NO_CONFIG_WRITE=y
|
||||
|
||||
# Remove support for configuration blobs to reduce code size by about 1.5 kB.
|
||||
#CONFIG_NO_CONFIG_BLOBS=y
|
||||
@ -268,19 +271,19 @@ CONFIG_NO_CONFIG_WRITE=y
|
||||
# main = UNIX/POSIX like main() function (default)
|
||||
# main_winsvc = Windows service (read parameters from registry)
|
||||
# main_none = Very basic example (development use only)
|
||||
CONFIG_MAIN=main
|
||||
#CONFIG_MAIN=main
|
||||
|
||||
# Select wrapper for operatins system and C library specific functions
|
||||
# unix = UNIX/POSIX like systems (default)
|
||||
# win32 = Windows systems
|
||||
# none = Empty template
|
||||
CONFIG_OS=unix
|
||||
#CONFIG_OS=unix
|
||||
|
||||
# Select event loop implementation
|
||||
# eloop = select() loop (default)
|
||||
# eloop_win = Windows events and WaitForMultipleObject() loop
|
||||
# eloop_none = Empty template
|
||||
CONFIG_ELOOP=eloop
|
||||
#CONFIG_ELOOP=eloop
|
||||
|
||||
# Select layer 2 packet implementation
|
||||
# linux = Linux packet socket (default)
|
||||
@ -289,7 +292,7 @@ CONFIG_ELOOP=eloop
|
||||
# winpcap = WinPcap with receive thread
|
||||
# ndis = Windows NDISUIO (note: requires CONFIG_USE_NDISUIO=y)
|
||||
# none = Empty template
|
||||
CONFIG_L2_PACKET=linux
|
||||
#CONFIG_L2_PACKET=linux
|
||||
|
||||
# PeerKey handshake for Station to Station Link (IEEE 802.11e DLS)
|
||||
CONFIG_PEERKEY=y
|
||||
@ -329,7 +332,7 @@ CONFIG_INTERNAL_LIBTOMMATH=y
|
||||
# At the cost of about 4 kB of additional binary size, the internal LibTomMath
|
||||
# can be configured to include faster routines for exptmod, sqr, and div to
|
||||
# speed up DH and RSA calculation considerably
|
||||
#CONFIG_INTERNAL_LIBTOMMATH_FAST=y
|
||||
CONFIG_INTERNAL_LIBTOMMATH_FAST=y
|
||||
|
||||
# Include NDIS event processing through WMI into wpa_supplicant/wpasvc.
|
||||
# This is only for Windows builds and requires WMI-related header files and
|
||||
@ -337,9 +340,17 @@ CONFIG_INTERNAL_LIBTOMMATH=y
|
||||
#CONFIG_NDIS_EVENTS_INTEGRATED=y
|
||||
#PLATFORMSDKLIB="/opt/Program Files/Microsoft Platform SDK/Lib"
|
||||
|
||||
# Add support for DBus control interface
|
||||
# Add support for old DBus control interface
|
||||
# (fi.epitest.hostap.WPASupplicant)
|
||||
#CONFIG_CTRL_IFACE_DBUS=y
|
||||
|
||||
# Add support for new DBus control interface
|
||||
# (fi.w1.hostap.wpa_supplicant1)
|
||||
#CONFIG_CTRL_IFACE_DBUS_NEW=y
|
||||
|
||||
# Add introspection support for new DBus control interface
|
||||
#CONFIG_CTRL_IFACE_DBUS_INTRO=y
|
||||
|
||||
# Add support for loading EAP methods dynamically as shared libraries.
|
||||
# When this option is enabled, each EAP method can be either included
|
||||
# statically (CONFIG_EAP_<method>=y) or dynamically (CONFIG_EAP_<method>=dyn).
|
||||
@ -361,18 +372,11 @@ CONFIG_INTERNAL_LIBTOMMATH=y
|
||||
# amount of memory/flash.
|
||||
#CONFIG_DYNAMIC_EAP_METHODS=y
|
||||
|
||||
# Include client MLME (management frame processing).
|
||||
# This can be used to move MLME processing of Linux mac80211 stack into user
|
||||
# space. Please note that this is currently only available with
|
||||
# driver_nl80211.c and only with a modified version of Linux kernel and
|
||||
# wpa_supplicant.
|
||||
#CONFIG_CLIENT_MLME=y
|
||||
|
||||
# IEEE Std 802.11r-2008 (Fast BSS Transition)
|
||||
#CONFIG_IEEE80211R=y
|
||||
|
||||
# Add support for writing debug log to a file (/tmp/wpa_supplicant-log-#.txt)
|
||||
CONFIG_DEBUG_FILE=y
|
||||
#CONFIG_DEBUG_FILE=y
|
||||
|
||||
# Enable privilege separation (see README 'Privilege separation' for details)
|
||||
#CONFIG_PRIVSEP=y
|
||||
@ -380,3 +384,21 @@ CONFIG_DEBUG_FILE=y
|
||||
# Enable mitigation against certain attacks against TKIP by delaying Michael
|
||||
# MIC error reports by a random amount of time between 0 and 60 seconds
|
||||
#CONFIG_DELAYED_MIC_ERROR_REPORT=y
|
||||
|
||||
# Enable tracing code for developer debugging
|
||||
# This tracks use of memory allocations and other registrations and reports
|
||||
# incorrect use with a backtrace of call (or allocation) location.
|
||||
#CONFIG_WPA_TRACE=y
|
||||
# For BSD, comment out these.
|
||||
#LIBS += -lexecinfo
|
||||
#LIBS_p += -lexecinfo
|
||||
#LIBS_c += -lexecinfo
|
||||
|
||||
# Use libbfd to get more details for developer debugging
|
||||
# This enables use of libbfd to get more detailed symbols for the backtraces
|
||||
# generated by CONFIG_WPA_TRACE=y.
|
||||
#CONFIG_WPA_TRACE_BFD=y
|
||||
# For BSD, comment out these.
|
||||
#LIBS += -lbfd -liberty -lz
|
||||
#LIBS_p += -lbfd -liberty -lz
|
||||
#LIBS_c += -lbfd -liberty -lz
|
@ -50,20 +50,17 @@ CONFIG_DRIVER_HOSTAP=y
|
||||
#CFLAGS += -I../../include/wireless
|
||||
|
||||
# Driver interface for madwifi driver
|
||||
CONFIG_DRIVER_MADWIFI=y
|
||||
# Deprecated; use CONFIG_DRIVER_WEXT=y instead.
|
||||
#CONFIG_DRIVER_MADWIFI=y
|
||||
# Set include directory to the madwifi source tree
|
||||
#CFLAGS += -I../../madwifi
|
||||
|
||||
# Driver interface for Prism54 driver
|
||||
# (Note: Prism54 is not yet supported, i.e., this will not work as-is and is
|
||||
# for developers only)
|
||||
#CONFIG_DRIVER_PRISM54=y
|
||||
|
||||
# Driver interface for ndiswrapper
|
||||
# Deprecated; use CONFIG_DRIVER_WEXT=y instead.
|
||||
#CONFIG_DRIVER_NDISWRAPPER=y
|
||||
|
||||
# Driver interface for Atmel driver
|
||||
#CONFIG_DRIVER_ATMEL=y
|
||||
# CONFIG_DRIVER_ATMEL=y
|
||||
|
||||
# Driver interface for old Broadcom driver
|
||||
# Please note that the newer Broadcom driver ("hybrid Linux driver") supports
|
||||
@ -74,6 +71,7 @@ CONFIG_DRIVER_MADWIFI=y
|
||||
#CFLAGS += -I/opt/WRT54GS/release/src/include
|
||||
|
||||
# Driver interface for Intel ipw2100/2200 driver
|
||||
# Deprecated; use CONFIG_DRIVER_WEXT=y instead.
|
||||
#CONFIG_DRIVER_IPW=y
|
||||
|
||||
# Driver interface for Ralink driver
|
||||
@ -83,12 +81,14 @@ CONFIG_DRIVER_MADWIFI=y
|
||||
CONFIG_DRIVER_WEXT=y
|
||||
|
||||
# Driver interface for Linux drivers using the nl80211 kernel interface
|
||||
#CONFIG_DRIVER_NL80211=y
|
||||
CONFIG_DRIVER_NL80211=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
|
||||
#LIBS_p += -L/usr/local/lib
|
||||
#LIBS_c += -L/usr/local/lib
|
||||
|
||||
# Driver interface for Windows NDIS
|
||||
#CONFIG_DRIVER_NDIS=y
|
||||
@ -109,30 +109,38 @@ CONFIG_DRIVER_WEXT=y
|
||||
# Driver interface for development testing
|
||||
#CONFIG_DRIVER_TEST=y
|
||||
|
||||
# Include client MLME (management frame processing) for test driver
|
||||
# This can be used to test MLME operations in hostapd with the test interface.
|
||||
# space.
|
||||
#CONFIG_CLIENT_MLME=y
|
||||
|
||||
# Driver interface for wired Ethernet drivers
|
||||
CONFIG_DRIVER_WIRED=y
|
||||
|
||||
# Driver interface for the Broadcom RoboSwitch family
|
||||
CONFIG_DRIVER_ROBOSWITCH=y
|
||||
#CONFIG_DRIVER_ROBOSWITCH=y
|
||||
|
||||
# Driver interface for no driver (e.g., WPS ER only)
|
||||
#CONFIG_DRIVER_NONE=y
|
||||
|
||||
# Enable IEEE 802.1X Supplicant (automatically included if any EAP method is
|
||||
# included)
|
||||
CONFIG_IEEE8021X_EAPOL=y
|
||||
# CONFIG_IEEE8021X_EAPOL=y
|
||||
|
||||
# EAP-MD5
|
||||
CONFIG_EAP_MD5=y
|
||||
# CONFIG_EAP_MD5=y
|
||||
|
||||
# EAP-MSCHAPv2
|
||||
CONFIG_EAP_MSCHAPV2=y
|
||||
# CONFIG_EAP_MSCHAPV2=y
|
||||
|
||||
# EAP-TLS
|
||||
CONFIG_EAP_TLS=y
|
||||
# CONFIG_EAP_TLS=y
|
||||
|
||||
# EAL-PEAP
|
||||
CONFIG_EAP_PEAP=y
|
||||
# CONFIG_EAP_PEAP=y
|
||||
|
||||
# EAP-TTLS
|
||||
CONFIG_EAP_TTLS=y
|
||||
# CONFIG_EAP_TTLS=y
|
||||
|
||||
# EAP-FAST
|
||||
# Note: Default OpenSSL package does not include support for all the
|
||||
@ -142,10 +150,10 @@ CONFIG_EAP_TTLS=y
|
||||
#CONFIG_EAP_FAST=y
|
||||
|
||||
# EAP-GTC
|
||||
CONFIG_EAP_GTC=y
|
||||
# CONFIG_EAP_GTC=y
|
||||
|
||||
# EAP-OTP
|
||||
#CONFIG_EAP_OTP=y
|
||||
# CONFIG_EAP_OTP=y
|
||||
|
||||
# EAP-SIM (enable CONFIG_PCSC, if EAP-SIM is used)
|
||||
#CONFIG_EAP_SIM=y
|
||||
@ -157,7 +165,7 @@ CONFIG_EAP_GTC=y
|
||||
#CONFIG_EAP_PAX=y
|
||||
|
||||
# LEAP
|
||||
CONFIG_EAP_LEAP=y
|
||||
# CONFIG_EAP_LEAP=y
|
||||
|
||||
# EAP-AKA (enable CONFIG_PCSC, if EAP-AKA is used)
|
||||
#CONFIG_EAP_AKA=y
|
||||
@ -188,11 +196,11 @@ CONFIG_EAP_LEAP=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
|
||||
# CONFIG_PKCS12=y
|
||||
|
||||
# Smartcard support (i.e., private key on a smartcard), e.g., with openssl
|
||||
# engine.
|
||||
#CONFIG_SMARTCARD=y
|
||||
# CONFIG_SMARTCARD=y
|
||||
|
||||
# PC/SC interface for smartcards (USIM, GSM SIM)
|
||||
# Enable this if EAP-SIM or EAP-AKA is included
|
||||
@ -238,11 +246,6 @@ CONFIG_CTRL_IFACE=y
|
||||
# wpa_passphrase). This saves about 0.5 kB in code size.
|
||||
#CONFIG_NO_WPA_PASSPHRASE=y
|
||||
|
||||
# Remove AES extra functions. This can be used to reduce code size by about
|
||||
# 1.5 kB by removing extra AES modes that are not needed for commonly used
|
||||
# client configurations (they are needed for some EAP types).
|
||||
#CONFIG_NO_AES_EXTRAS=y
|
||||
|
||||
# Disable scan result processing (ap_mode=1) to save code size by about 1 kB.
|
||||
# This can be used if ap_scan=1 mode is never enabled.
|
||||
#CONFIG_NO_SCAN_PROCESSING=y
|
||||
@ -259,7 +262,7 @@ CONFIG_BACKEND=file
|
||||
# configuration can still be changed, the changes are just not going to be
|
||||
# persistent over restarts. This option can be used to reduce code size by
|
||||
# about 3.5 kB.
|
||||
CONFIG_NO_CONFIG_WRITE=y
|
||||
#CONFIG_NO_CONFIG_WRITE=y
|
||||
|
||||
# Remove support for configuration blobs to reduce code size by about 1.5 kB.
|
||||
#CONFIG_NO_CONFIG_BLOBS=y
|
||||
@ -268,19 +271,19 @@ CONFIG_NO_CONFIG_WRITE=y
|
||||
# main = UNIX/POSIX like main() function (default)
|
||||
# main_winsvc = Windows service (read parameters from registry)
|
||||
# main_none = Very basic example (development use only)
|
||||
CONFIG_MAIN=main
|
||||
#CONFIG_MAIN=main
|
||||
|
||||
# Select wrapper for operatins system and C library specific functions
|
||||
# unix = UNIX/POSIX like systems (default)
|
||||
# win32 = Windows systems
|
||||
# none = Empty template
|
||||
CONFIG_OS=unix
|
||||
#CONFIG_OS=unix
|
||||
|
||||
# Select event loop implementation
|
||||
# eloop = select() loop (default)
|
||||
# eloop_win = Windows events and WaitForMultipleObject() loop
|
||||
# eloop_none = Empty template
|
||||
CONFIG_ELOOP=eloop
|
||||
#CONFIG_ELOOP=eloop
|
||||
|
||||
# Select layer 2 packet implementation
|
||||
# linux = Linux packet socket (default)
|
||||
@ -289,10 +292,10 @@ CONFIG_ELOOP=eloop
|
||||
# winpcap = WinPcap with receive thread
|
||||
# ndis = Windows NDISUIO (note: requires CONFIG_USE_NDISUIO=y)
|
||||
# none = Empty template
|
||||
CONFIG_L2_PACKET=linux
|
||||
#CONFIG_L2_PACKET=linux
|
||||
|
||||
# PeerKey handshake for Station to Station Link (IEEE 802.11e DLS)
|
||||
CONFIG_PEERKEY=y
|
||||
# CONFIG_PEERKEY=y
|
||||
|
||||
# IEEE 802.11w (management frame protection)
|
||||
# This version is an experimental implementation based on IEEE 802.11w/D1.0
|
||||
@ -319,7 +322,7 @@ CONFIG_TLS=internal
|
||||
# needed for LibTomMath. Alternatively, an integrated, minimal version of
|
||||
# LibTomMath can be used. See beginning of libtommath.c for details on benefits
|
||||
# and drawbacks of this option.
|
||||
CONFIG_INTERNAL_LIBTOMMATH=y
|
||||
#CONFIG_INTERNAL_LIBTOMMATH=y
|
||||
#ifndef CONFIG_INTERNAL_LIBTOMMATH
|
||||
#LTM_PATH=/usr/src/libtommath-0.39
|
||||
#CFLAGS += -I$(LTM_PATH)
|
||||
@ -337,9 +340,17 @@ CONFIG_INTERNAL_LIBTOMMATH=y
|
||||
#CONFIG_NDIS_EVENTS_INTEGRATED=y
|
||||
#PLATFORMSDKLIB="/opt/Program Files/Microsoft Platform SDK/Lib"
|
||||
|
||||
# Add support for DBus control interface
|
||||
# Add support for old DBus control interface
|
||||
# (fi.epitest.hostap.WPASupplicant)
|
||||
#CONFIG_CTRL_IFACE_DBUS=y
|
||||
|
||||
# Add support for new DBus control interface
|
||||
# (fi.w1.hostap.wpa_supplicant1)
|
||||
#CONFIG_CTRL_IFACE_DBUS_NEW=y
|
||||
|
||||
# Add introspection support for new DBus control interface
|
||||
#CONFIG_CTRL_IFACE_DBUS_INTRO=y
|
||||
|
||||
# Add support for loading EAP methods dynamically as shared libraries.
|
||||
# When this option is enabled, each EAP method can be either included
|
||||
# statically (CONFIG_EAP_<method>=y) or dynamically (CONFIG_EAP_<method>=dyn).
|
||||
@ -361,18 +372,11 @@ CONFIG_INTERNAL_LIBTOMMATH=y
|
||||
# amount of memory/flash.
|
||||
#CONFIG_DYNAMIC_EAP_METHODS=y
|
||||
|
||||
# Include client MLME (management frame processing).
|
||||
# This can be used to move MLME processing of Linux mac80211 stack into user
|
||||
# space. Please note that this is currently only available with
|
||||
# driver_nl80211.c and only with a modified version of Linux kernel and
|
||||
# wpa_supplicant.
|
||||
#CONFIG_CLIENT_MLME=y
|
||||
|
||||
# IEEE Std 802.11r-2008 (Fast BSS Transition)
|
||||
#CONFIG_IEEE80211R=y
|
||||
|
||||
# Add support for writing debug log to a file (/tmp/wpa_supplicant-log-#.txt)
|
||||
CONFIG_DEBUG_FILE=y
|
||||
#CONFIG_DEBUG_FILE=y
|
||||
|
||||
# Enable privilege separation (see README 'Privilege separation' for details)
|
||||
#CONFIG_PRIVSEP=y
|
||||
@ -380,3 +384,21 @@ CONFIG_DEBUG_FILE=y
|
||||
# Enable mitigation against certain attacks against TKIP by delaying Michael
|
||||
# MIC error reports by a random amount of time between 0 and 60 seconds
|
||||
#CONFIG_DELAYED_MIC_ERROR_REPORT=y
|
||||
|
||||
# Enable tracing code for developer debugging
|
||||
# This tracks use of memory allocations and other registrations and reports
|
||||
# incorrect use with a backtrace of call (or allocation) location.
|
||||
#CONFIG_WPA_TRACE=y
|
||||
# For BSD, comment out these.
|
||||
#LIBS += -lexecinfo
|
||||
#LIBS_p += -lexecinfo
|
||||
#LIBS_c += -lexecinfo
|
||||
|
||||
# Use libbfd to get more details for developer debugging
|
||||
# This enables use of libbfd to get more detailed symbols for the backtraces
|
||||
# generated by CONFIG_WPA_TRACE=y.
|
||||
#CONFIG_WPA_TRACE_BFD=y
|
||||
# For BSD, comment out these.
|
||||
#LIBS += -lbfd -liberty -lz
|
||||
#LIBS_p += -lbfd -liberty -lz
|
||||
#LIBS_c += -lbfd -liberty -lz
|
@ -12,12 +12,33 @@ wpa_supplicant_setup_vif() {
|
||||
}
|
||||
|
||||
case "$enc" in
|
||||
*wep*)
|
||||
key_mgmt='NONE'
|
||||
config_get key "$vif" key
|
||||
key="${key:-1}"
|
||||
case "$key" in
|
||||
[1234])
|
||||
for idx in 1 2 3 4; do
|
||||
local zidx
|
||||
zidx=$(($idx - 1))
|
||||
config_get ckey "$vif" "key${idx}"
|
||||
[ -n "$ckey" ] && \
|
||||
append "wep_key${zidx}" "wep_key${zidx}=$(prepare_key_wep "$ckey")"
|
||||
done
|
||||
wep_tx_keyidx="wep_tx_keyidx=$((key - 1))"
|
||||
;;
|
||||
*)
|
||||
wep_key0="wep_key0=$(prepare_key_wep "$key")"
|
||||
wep_tx_keyidx="wep_tx_keyidx=0"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*psk*)
|
||||
key_mgmt='WPA-PSK'
|
||||
config_get_bool usepassphrase "$vif" passphrase 1
|
||||
case "$enc" in
|
||||
*psk2*)
|
||||
proto='RSN'
|
||||
proto='proto=RSN'
|
||||
if [ "$usepassphrase" = "1" ]; then
|
||||
passphrase="psk=\"${key}\""
|
||||
else
|
||||
@ -25,7 +46,7 @@ wpa_supplicant_setup_vif() {
|
||||
fi
|
||||
;;
|
||||
*psk*)
|
||||
proto='WPA'
|
||||
proto='proto=WPA'
|
||||
if [ "$usepassphrase" = "1" ]; then
|
||||
passphrase="psk=\"${key}\""
|
||||
else
|
||||
@ -35,7 +56,7 @@ wpa_supplicant_setup_vif() {
|
||||
esac
|
||||
;;
|
||||
*wpa*|*8021x*)
|
||||
proto='WPA2'
|
||||
proto='proto=WPA2'
|
||||
key_mgmt='WPA-EAP'
|
||||
config_get ca_cert "$vif" ca_cert
|
||||
ca_cert=${ca_cert:+"ca_cert=\"$ca_cert\""}
|
||||
@ -65,6 +86,7 @@ wpa_supplicant_setup_vif() {
|
||||
config_get ssid "$vif" ssid
|
||||
config_get bssid "$vif" bssid
|
||||
bssid=${bssid:+"bssid=$bssid"}
|
||||
rm -rf /var/run/wpa_supplicant-$ifname
|
||||
cat > /var/run/wpa_supplicant-$ifname.conf <<EOF
|
||||
ctrl_interface=/var/run/wpa_supplicant-$ifname
|
||||
network={
|
||||
@ -72,7 +94,7 @@ network={
|
||||
ssid="$ssid"
|
||||
$bssid
|
||||
key_mgmt=$key_mgmt
|
||||
proto=$proto
|
||||
$proto
|
||||
$passphrase
|
||||
$pairwise
|
||||
$group
|
||||
@ -83,7 +105,13 @@ network={
|
||||
$phase2
|
||||
$identity
|
||||
$password
|
||||
$wep_key0
|
||||
$wep_key1
|
||||
$wep_key2
|
||||
$wep_key3
|
||||
$wep_tx_keyidx
|
||||
}
|
||||
EOF
|
||||
[ -z "$proto" ] || wpa_supplicant ${bridge:+ -b $bridge} -B -P "/var/run/wifi-${ifname}.pid" -D ${driver:-wext} -i "$ifname" -c /var/run/wpa_supplicant-$ifname.conf
|
||||
[ -z "$proto" -a "$key_mgmt" != "NONE" ] || \
|
||||
wpa_supplicant ${bridge:+ -b $bridge} -B -P "/var/run/wifi-${ifname}.pid" -D ${driver:-wext} -i "$ifname" -c /var/run/wpa_supplicant-$ifname.conf
|
||||
}
|
148
package/hostapd/patches/130-scan_wait.patch
Normal file
148
package/hostapd/patches/130-scan_wait.patch
Normal file
@ -0,0 +1,148 @@
|
||||
--- a/src/ap/hostapd.h
|
||||
+++ b/src/ap/hostapd.h
|
||||
@@ -238,6 +238,7 @@ struct hostapd_iface {
|
||||
int (*for_each_interface)(struct hapd_interfaces *interfaces,
|
||||
int (*cb)(struct hostapd_iface *iface,
|
||||
void *ctx), void *ctx);
|
||||
+ int (*init_complete)(struct hostapd_iface *iface);
|
||||
};
|
||||
|
||||
/* hostapd.c */
|
||||
--- a/src/ap/hostapd.c
|
||||
+++ b/src/ap/hostapd.c
|
||||
@@ -745,6 +745,9 @@ int hostapd_setup_interface_complete(str
|
||||
wpa_printf(MSG_DEBUG, "%s: Setup of interface done.",
|
||||
iface->bss[0]->conf->iface);
|
||||
|
||||
+ if (iface->init_complete)
|
||||
+ iface->init_complete(iface);
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
--- a/hostapd/main.c
|
||||
+++ b/hostapd/main.c
|
||||
@@ -35,6 +35,8 @@
|
||||
extern int wpa_debug_level;
|
||||
extern int wpa_debug_show_keys;
|
||||
extern int wpa_debug_timestamp;
|
||||
+static int daemonize = 0;
|
||||
+static char *pid_file = NULL;
|
||||
|
||||
|
||||
struct hapd_interfaces {
|
||||
@@ -162,6 +164,15 @@ static void hostapd_logger_cb(void *ctx,
|
||||
}
|
||||
#endif /* CONFIG_NO_HOSTAPD_LOGGER */
|
||||
|
||||
+static int hostapd_init_complete(struct hostapd_iface *iface)
|
||||
+{
|
||||
+ if (daemonize && os_daemonize(pid_file)) {
|
||||
+ perror("daemon");
|
||||
+ return -1;
|
||||
+ }
|
||||
+ daemonize = 0;
|
||||
+}
|
||||
+
|
||||
|
||||
/**
|
||||
* hostapd_init - Allocate and initialize per-interface data
|
||||
@@ -183,6 +194,7 @@ static struct hostapd_iface * hostapd_in
|
||||
if (hapd_iface == NULL)
|
||||
goto fail;
|
||||
|
||||
+ hapd_iface->init_complete = hostapd_init_complete;
|
||||
hapd_iface->reload_config = hostapd_reload_config;
|
||||
hapd_iface->config_read_cb = hostapd_config_read;
|
||||
hapd_iface->config_fname = os_strdup(config_file);
|
||||
@@ -390,7 +402,7 @@ static int hostapd_global_init(struct ha
|
||||
}
|
||||
|
||||
|
||||
-static void hostapd_global_deinit(const char *pid_file)
|
||||
+static void hostapd_global_deinit(void)
|
||||
{
|
||||
#ifdef EAP_SERVER_TNC
|
||||
tncs_global_deinit();
|
||||
@@ -408,8 +420,7 @@ static void hostapd_global_deinit(const
|
||||
}
|
||||
|
||||
|
||||
-static int hostapd_global_run(struct hapd_interfaces *ifaces, int daemonize,
|
||||
- const char *pid_file)
|
||||
+static int hostapd_global_run(struct hapd_interfaces *iface)
|
||||
{
|
||||
#ifdef EAP_SERVER_TNC
|
||||
int tnc = 0;
|
||||
@@ -430,11 +441,6 @@ static int hostapd_global_run(struct hap
|
||||
}
|
||||
#endif /* EAP_SERVER_TNC */
|
||||
|
||||
- if (daemonize && os_daemonize(pid_file)) {
|
||||
- perror("daemon");
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
eloop_run();
|
||||
|
||||
return 0;
|
||||
@@ -478,8 +484,7 @@ int main(int argc, char *argv[])
|
||||
struct hapd_interfaces interfaces;
|
||||
int ret = 1;
|
||||
size_t i;
|
||||
- int c, debug = 0, daemonize = 0;
|
||||
- char *pid_file = NULL;
|
||||
+ int c, debug = 0;
|
||||
|
||||
if (os_program_init())
|
||||
return -1;
|
||||
@@ -544,7 +549,7 @@ int main(int argc, char *argv[])
|
||||
goto out;
|
||||
}
|
||||
|
||||
- if (hostapd_global_run(&interfaces, daemonize, pid_file))
|
||||
+ if (hostapd_global_run(&interfaces))
|
||||
goto out;
|
||||
|
||||
ret = 0;
|
||||
@@ -555,7 +560,7 @@ int main(int argc, char *argv[])
|
||||
hostapd_interface_deinit_free(interfaces.iface[i]);
|
||||
os_free(interfaces.iface);
|
||||
|
||||
- hostapd_global_deinit(pid_file);
|
||||
+ hostapd_global_deinit();
|
||||
os_free(pid_file);
|
||||
|
||||
os_program_deinit();
|
||||
--- a/hostapd/config_file.c
|
||||
+++ b/hostapd/config_file.c
|
||||
@@ -1854,6 +1854,8 @@ struct hostapd_config * hostapd_config_r
|
||||
}
|
||||
#endif /* CONFIG_IEEE80211W */
|
||||
#ifdef CONFIG_IEEE80211N
|
||||
+ } else if (os_strcmp(buf, "noscan") == 0) {
|
||||
+ conf->noscan = atoi(pos);
|
||||
} else if (os_strcmp(buf, "ieee80211n") == 0) {
|
||||
conf->ieee80211n = atoi(pos);
|
||||
} else if (os_strcmp(buf, "ht_capab") == 0) {
|
||||
--- a/src/ap/ap_config.h
|
||||
+++ b/src/ap/ap_config.h
|
||||
@@ -366,6 +366,7 @@ struct hostapd_config {
|
||||
|
||||
int ht_op_mode_fixed;
|
||||
u16 ht_capab;
|
||||
+ int noscan;
|
||||
int ieee80211n;
|
||||
int secondary_channel;
|
||||
};
|
||||
--- a/src/ap/hw_features.c
|
||||
+++ b/src/ap/hw_features.c
|
||||
@@ -460,7 +460,7 @@ static int ieee80211n_check_40mhz(struct
|
||||
{
|
||||
struct wpa_driver_scan_params params;
|
||||
|
||||
- if (!iface->conf->secondary_channel)
|
||||
+ if (!iface->conf->secondary_channel || iface->conf->noscan)
|
||||
return 0; /* HT40 not used */
|
||||
|
||||
wpa_printf(MSG_DEBUG, "Scan for neighboring BSSes prior to enabling "
|
12
package/hostapd/patches/140-wds_sta_remove.patch
Normal file
12
package/hostapd/patches/140-wds_sta_remove.patch
Normal file
@ -0,0 +1,12 @@
|
||||
--- a/src/ap/sta_info.c
|
||||
+++ b/src/ap/sta_info.c
|
||||
@@ -121,7 +121,8 @@ void ap_free_sta(struct hostapd_data *ha
|
||||
|
||||
accounting_sta_stop(hapd, sta);
|
||||
|
||||
- hapd->drv.set_wds_sta(hapd, sta->addr, sta->aid, 0);
|
||||
+ if (sta->flags & WLAN_STA_WDS)
|
||||
+ hapd->drv.set_wds_sta(hapd, sta->addr, sta->aid, 0);
|
||||
if (!ap_sta_in_other_bss(hapd, sta, WLAN_STA_ASSOC) &&
|
||||
!(sta->flags & WLAN_STA_PREAUTH))
|
||||
hapd->drv.sta_remove(hapd, sta->addr);
|
1110
package/hostapd/patches/150-mbss_driver_handling.patch
Normal file
1110
package/hostapd/patches/150-mbss_driver_handling.patch
Normal file
File diff suppressed because it is too large
Load Diff
79
package/hostapd/patches/160-sta_roam_between_bss.patch
Normal file
79
package/hostapd/patches/160-sta_roam_between_bss.patch
Normal file
@ -0,0 +1,79 @@
|
||||
--- a/src/ap/sta_info.c
|
||||
+++ b/src/ap/sta_info.c
|
||||
@@ -32,8 +32,8 @@
|
||||
#include "vlan_init.h"
|
||||
#include "sta_info.h"
|
||||
|
||||
-static int ap_sta_in_other_bss(struct hostapd_data *hapd,
|
||||
- struct sta_info *sta, u32 flags);
|
||||
+static void ap_sta_remove_in_other_bss(struct hostapd_data *hapd,
|
||||
+ struct sta_info *sta);
|
||||
static void ap_handle_session_timer(void *eloop_ctx, void *timeout_ctx);
|
||||
#ifdef CONFIG_IEEE80211W
|
||||
static void ap_sa_query_timer(void *eloop_ctx, void *timeout_ctx);
|
||||
@@ -123,8 +123,8 @@ void ap_free_sta(struct hostapd_data *ha
|
||||
|
||||
if (sta->flags & WLAN_STA_WDS)
|
||||
hapd->drv.set_wds_sta(hapd, sta->addr, sta->aid, 0);
|
||||
- if (!ap_sta_in_other_bss(hapd, sta, WLAN_STA_ASSOC) &&
|
||||
- !(sta->flags & WLAN_STA_PREAUTH))
|
||||
+
|
||||
+ if (!(sta->flags & WLAN_STA_PREAUTH))
|
||||
hapd->drv.sta_remove(hapd, sta->addr);
|
||||
|
||||
ap_sta_hash_del(hapd, sta);
|
||||
@@ -451,6 +451,7 @@ struct sta_info * ap_sta_add(struct host
|
||||
hapd->num_sta++;
|
||||
ap_sta_hash_add(hapd, sta);
|
||||
sta->ssid = &hapd->conf->ssid;
|
||||
+ ap_sta_remove_in_other_bss(hapd, sta);
|
||||
|
||||
return sta;
|
||||
}
|
||||
@@ -472,8 +473,8 @@ static int ap_sta_remove(struct hostapd_
|
||||
}
|
||||
|
||||
|
||||
-static int ap_sta_in_other_bss(struct hostapd_data *hapd,
|
||||
- struct sta_info *sta, u32 flags)
|
||||
+static void ap_sta_remove_in_other_bss(struct hostapd_data *hapd,
|
||||
+ struct sta_info *sta)
|
||||
{
|
||||
struct hostapd_iface *iface = hapd->iface;
|
||||
size_t i;
|
||||
@@ -488,11 +489,11 @@ static int ap_sta_in_other_bss(struct ho
|
||||
if (bss == hapd || bss == NULL)
|
||||
continue;
|
||||
sta2 = ap_get_sta(bss, sta->addr);
|
||||
- if (sta2 && ((sta2->flags & flags) == flags))
|
||||
- return 1;
|
||||
- }
|
||||
+ if (!sta2)
|
||||
+ continue;
|
||||
|
||||
- return 0;
|
||||
+ ap_sta_disconnect(bss, sta2, sta2->addr, WLAN_REASON_DEAUTH_LEAVING);
|
||||
+ }
|
||||
}
|
||||
|
||||
|
||||
@@ -502,8 +503,7 @@ void ap_sta_disassociate(struct hostapd_
|
||||
wpa_printf(MSG_DEBUG, "%s: disassociate STA " MACSTR,
|
||||
hapd->conf->iface, MAC2STR(sta->addr));
|
||||
sta->flags &= ~WLAN_STA_ASSOC;
|
||||
- if (!ap_sta_in_other_bss(hapd, sta, WLAN_STA_ASSOC))
|
||||
- ap_sta_remove(hapd, sta);
|
||||
+ ap_sta_remove(hapd, sta);
|
||||
sta->timeout_next = STA_DEAUTH;
|
||||
eloop_cancel_timeout(ap_handle_timer, hapd, sta);
|
||||
eloop_register_timeout(AP_MAX_INACTIVITY_AFTER_DISASSOC, 0,
|
||||
@@ -521,8 +521,7 @@ void ap_sta_deauthenticate(struct hostap
|
||||
wpa_printf(MSG_DEBUG, "%s: deauthenticate STA " MACSTR,
|
||||
hapd->conf->iface, MAC2STR(sta->addr));
|
||||
sta->flags &= ~(WLAN_STA_AUTH | WLAN_STA_ASSOC);
|
||||
- if (!ap_sta_in_other_bss(hapd, sta, WLAN_STA_ASSOC))
|
||||
- ap_sta_remove(hapd, sta);
|
||||
+ ap_sta_remove(hapd, sta);
|
||||
sta->timeout_next = STA_REMOVE;
|
||||
eloop_cancel_timeout(ap_handle_timer, hapd, sta);
|
||||
eloop_register_timeout(AP_MAX_INACTIVITY_AFTER_DEAUTH, 0,
|
236
package/hostapd/patches/200-multicall.patch
Normal file
236
package/hostapd/patches/200-multicall.patch
Normal file
@ -0,0 +1,236 @@
|
||||
--- a/hostapd/Makefile
|
||||
+++ b/hostapd/Makefile
|
||||
@@ -14,6 +14,7 @@ CFLAGS += -I../src/utils
|
||||
# CFLAGS += -DUSE_KERNEL_HEADERS -I/usr/src/linux/include
|
||||
|
||||
-include .config
|
||||
+-include $(if $(MULTICALL), ../wpa_supplicant/.config)
|
||||
|
||||
ifndef CONFIG_OS
|
||||
ifdef CONFIG_NATIVE_WINDOWS
|
||||
@@ -157,10 +158,14 @@ ifdef CONFIG_IEEE80211N
|
||||
CFLAGS += -DCONFIG_IEEE80211N
|
||||
endif
|
||||
|
||||
+ifndef MULTICALL
|
||||
+CFLAGS += -DNO_SUPPLICANT
|
||||
+endif
|
||||
+
|
||||
include ../src/drivers/drivers.mak
|
||||
-OBJS += $(DRV_AP_OBJS)
|
||||
-CFLAGS += $(DRV_AP_CFLAGS)
|
||||
-LDFLAGS += $(DRV_AP_LDFLAGS)
|
||||
+OBJS += $(sort $(DRV_AP_OBJS) $(if $(MULTICALL),$(DRV_WPA_OBJS)))
|
||||
+CFLAGS += $(DRV_AP_CFLAGS) $(if $(MULTICALL),$(DRV_WPA_CFLAGS))
|
||||
+LDFLAGS += $(DRV_AP_LDFLAGS) $(if $(MULTICALL),$(DRV_WPA_LDFLAGS))
|
||||
LIBS += $(DRV_AP_LIBS)
|
||||
|
||||
ifdef CONFIG_L2_PACKET
|
||||
@@ -738,6 +743,12 @@ install: all
|
||||
|
||||
BCHECK=../src/drivers/build.hostapd
|
||||
|
||||
+hostapd_multi.a: $(BCHECK) $(OBJS)
|
||||
+ $(Q)$(CC) -c -o hostapd_multi.o -Dmain=hostapd_main $(CFLAGS) main.c
|
||||
+ @$(E) " CC " $<
|
||||
+ @rm -f $@
|
||||
+ @$(AR) cr $@ hostapd_multi.o $(OBJS)
|
||||
+
|
||||
hostapd: $(BCHECK) $(OBJS)
|
||||
$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS)
|
||||
|
||||
@@ -776,6 +787,12 @@ HOBJS += ../src/crypto/aes-internal.o
|
||||
HOBJS += ../src/crypto/aes-internal-enc.o
|
||||
endif
|
||||
|
||||
+dump_cflags:
|
||||
+ @echo -n $(CFLAGS) " "
|
||||
+
|
||||
+dump_ldflags:
|
||||
+ @echo -n $(LDFLAGS) $(LIBS) $(EXTRALIBS) " "
|
||||
+
|
||||
nt_password_hash: $(NOBJS)
|
||||
$(CC) $(LDFLAGS) -o nt_password_hash $(NOBJS) $(LIBS_n)
|
||||
|
||||
--- a/wpa_supplicant/Makefile
|
||||
+++ b/wpa_supplicant/Makefile
|
||||
@@ -52,6 +52,7 @@ OBJS_p += ../src/utils/wpabuf.o
|
||||
OBJS_c = wpa_cli.o ../src/common/wpa_ctrl.o
|
||||
|
||||
-include .config
|
||||
+-include $(if $(MULTICALL),../hostapd/.config)
|
||||
|
||||
ifndef CONFIG_OS
|
||||
ifdef CONFIG_NATIVE_WINDOWS
|
||||
@@ -579,6 +580,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS
|
||||
CFLAGS += -DCONFIG_DYNAMIC_EAP_METHODS
|
||||
LIBS += -ldl -rdynamic
|
||||
endif
|
||||
+else
|
||||
+ ifdef MULTICALL
|
||||
+ OBJS += ../src/eap_common/eap_common.o
|
||||
+ endif
|
||||
endif
|
||||
|
||||
ifdef CONFIG_AP
|
||||
@@ -631,6 +636,12 @@ CFLAGS += -DEAP_SERVER_WSC
|
||||
OBJS += ../src/ap/wps_hostapd.o
|
||||
OBJS += ../src/eap_server/eap_wsc.o
|
||||
endif
|
||||
+else
|
||||
+ ifdef MULTICALL
|
||||
+ OBJS += ../src/eap_server/eap.o
|
||||
+ OBJS += ../src/eap_server/eap_identity.o
|
||||
+ OBJS += ../src/eap_server/eap_methods.o
|
||||
+ endif
|
||||
endif
|
||||
|
||||
ifdef NEED_RSN_AUTHENTICATOR
|
||||
@@ -1260,6 +1271,12 @@ BCHECK=../src/drivers/build.wpa_supplica
|
||||
wpa_priv: $(BCHECK) $(OBJS_priv)
|
||||
$(LDO) $(LDFLAGS) -o wpa_priv $(OBJS_priv) $(LIBS)
|
||||
|
||||
+wpa_supplicant_multi.a: .config $(BCHECK) $(OBJS) $(EXTRA_progs)
|
||||
+ $(Q)$(CC) -c -o wpa_supplicant_multi.o -Dmain=wpa_supplicant_main $(CFLAGS) main.c
|
||||
+ @$(E) " CC " $<
|
||||
+ @rm -f $@
|
||||
+ @$(AR) cr $@ wpa_supplicant_multi.o $(OBJS)
|
||||
+
|
||||
wpa_supplicant: .config $(BCHECK) $(OBJS) $(EXTRA_progs)
|
||||
$(LDO) $(LDFLAGS) -o wpa_supplicant $(OBJS) $(LIBS) $(EXTRALIBS)
|
||||
|
||||
@@ -1319,6 +1336,12 @@ endif
|
||||
$(Q)$(CC) -c -o $@ $(CFLAGS) $<
|
||||
@$(E) " CC " $<
|
||||
|
||||
+dump_cflags:
|
||||
+ @echo -n $(CFLAGS) " "
|
||||
+
|
||||
+dump_ldflags:
|
||||
+ @echo -n $(LDFLAGS) $(LIBS) $(EXTRALIBS) " "
|
||||
+
|
||||
wpa_supplicant.exe: wpa_supplicant
|
||||
mv -f $< $@
|
||||
wpa_cli.exe: wpa_cli
|
||||
--- a/src/drivers/driver.h
|
||||
+++ b/src/drivers/driver.h
|
||||
@@ -2384,8 +2384,8 @@ union wpa_event_data {
|
||||
* Driver wrapper code should call this function whenever an event is received
|
||||
* from the driver.
|
||||
*/
|
||||
-void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
|
||||
- union wpa_event_data *data);
|
||||
+extern void (*wpa_supplicant_event)(void *ctx, enum wpa_event_type event,
|
||||
+ union wpa_event_data *data);
|
||||
|
||||
|
||||
/*
|
||||
--- a/src/ap/drv_callbacks.c
|
||||
+++ b/src/ap/drv_callbacks.c
|
||||
@@ -337,8 +337,8 @@ static void hostapd_event_eapol_rx(struc
|
||||
}
|
||||
|
||||
|
||||
-void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
|
||||
- union wpa_event_data *data)
|
||||
+void hostapd_wpa_event(void *ctx, enum wpa_event_type event,
|
||||
+ union wpa_event_data *data)
|
||||
{
|
||||
struct hostapd_data *hapd = ctx;
|
||||
|
||||
@@ -415,5 +415,6 @@ void wpa_supplicant_event(void *ctx, enu
|
||||
break;
|
||||
}
|
||||
}
|
||||
-
|
||||
#endif /* HOSTAPD */
|
||||
+
|
||||
+
|
||||
--- a/wpa_supplicant/wpa_priv.c
|
||||
+++ b/wpa_supplicant/wpa_priv.c
|
||||
@@ -825,8 +825,8 @@ static void wpa_priv_send_ft_response(st
|
||||
}
|
||||
|
||||
|
||||
-void wpa_supplicant_event(void *ctx, wpa_event_type event,
|
||||
- union wpa_event_data *data)
|
||||
+static void supplicant_event(void *ctx, wpa_event_type event,
|
||||
+ union wpa_event_data *data)
|
||||
{
|
||||
struct wpa_priv_interface *iface = ctx;
|
||||
|
||||
@@ -968,6 +968,7 @@ int main(int argc, char *argv[])
|
||||
if (os_program_init())
|
||||
return -1;
|
||||
|
||||
+ wpa_supplicant_event = supplicant_event;
|
||||
wpa_priv_fd_workaround();
|
||||
|
||||
for (;;) {
|
||||
--- a/wpa_supplicant/events.c
|
||||
+++ b/wpa_supplicant/events.c
|
||||
@@ -1425,8 +1425,8 @@ static void wpa_supplicant_event_ibss_rs
|
||||
#endif /* CONFIG_IBSS_RSN */
|
||||
|
||||
|
||||
-void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
|
||||
- union wpa_event_data *data)
|
||||
+void supplicant_event(void *ctx, enum wpa_event_type event,
|
||||
+ union wpa_event_data *data)
|
||||
{
|
||||
struct wpa_supplicant *wpa_s = ctx;
|
||||
|
||||
--- a/wpa_supplicant/wpa_supplicant.c
|
||||
+++ b/wpa_supplicant/wpa_supplicant.c
|
||||
@@ -2215,6 +2215,9 @@ struct wpa_supplicant * wpa_supplicant_g
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+extern void supplicant_event(void *ctx, enum wpa_event_type event,
|
||||
+ union wpa_event_data *data);
|
||||
+
|
||||
|
||||
/**
|
||||
* wpa_supplicant_init - Initialize %wpa_supplicant
|
||||
@@ -2233,6 +2236,7 @@ struct wpa_global * wpa_supplicant_init(
|
||||
if (params == NULL)
|
||||
return NULL;
|
||||
|
||||
+ wpa_supplicant_event = supplicant_event;
|
||||
wpa_debug_open_file(params->wpa_debug_file_path);
|
||||
if (params->wpa_debug_syslog)
|
||||
wpa_debug_open_syslog();
|
||||
--- a/hostapd/main.c
|
||||
+++ b/hostapd/main.c
|
||||
@@ -478,6 +478,9 @@ static void usage(void)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
+void hostapd_wpa_event(void *ctx, enum wpa_event_type event,
|
||||
+ union wpa_event_data *data);
|
||||
+
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@@ -489,6 +492,7 @@ int main(int argc, char *argv[])
|
||||
if (os_program_init())
|
||||
return -1;
|
||||
|
||||
+ wpa_supplicant_event = hostapd_wpa_event;
|
||||
for (;;) {
|
||||
c = getopt(argc, argv, "BdhKP:tv");
|
||||
if (c < 0)
|
||||
--- a/src/drivers/drivers.c
|
||||
+++ b/src/drivers/drivers.c
|
||||
@@ -13,7 +13,11 @@
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
+#include "common.h"
|
||||
+#include "driver.h"
|
||||
|
||||
+void (*wpa_supplicant_event)(void *ctx, enum wpa_event_type event,
|
||||
+ union wpa_event_data *data);
|
||||
|
||||
#ifdef CONFIG_DRIVER_WEXT
|
||||
extern struct wpa_driver_ops wpa_driver_wext_ops; /* driver_wext.c */
|
@ -1,6 +1,6 @@
|
||||
--- a/src/tls/x509v3.c
|
||||
+++ b/src/tls/x509v3.c
|
||||
@@ -1591,8 +1591,11 @@ int x509_certificate_chain_validate(stru
|
||||
@@ -1832,8 +1832,11 @@ int x509_certificate_chain_validate(stru
|
||||
if (chain_trusted)
|
||||
continue;
|
||||
|
37
package/hostapd/patches/310-scan_ssid.patch
Normal file
37
package/hostapd/patches/310-scan_ssid.patch
Normal file
@ -0,0 +1,37 @@
|
||||
--- a/wpa_supplicant/scan.c
|
||||
+++ b/wpa_supplicant/scan.c
|
||||
@@ -215,6 +215,7 @@ static void wpa_supplicant_scan(void *el
|
||||
enum wps_request_type req_type = WPS_REQ_ENROLLEE_INFO;
|
||||
#endif /* CONFIG_WPS */
|
||||
struct wpa_driver_scan_params params;
|
||||
+ int scan_ssid_all = 1;
|
||||
size_t max_ssids;
|
||||
|
||||
if (wpa_s->disconnected && !wpa_s->scan_req) {
|
||||
@@ -275,6 +276,16 @@ static void wpa_supplicant_scan(void *el
|
||||
wpa_s->wpa_state == WPA_INACTIVE)
|
||||
wpa_supplicant_set_state(wpa_s, WPA_SCANNING);
|
||||
|
||||
+ /* check if all configured ssids should be scanned directly */
|
||||
+ ssid = wpa_s->conf->ssid;
|
||||
+ while (ssid) {
|
||||
+ if (!ssid->scan_ssid) {
|
||||
+ scan_ssid_all = 0;
|
||||
+ break;
|
||||
+ }
|
||||
+ ssid = ssid->next;
|
||||
+ }
|
||||
+
|
||||
/* Find the starting point from which to continue scanning */
|
||||
ssid = wpa_s->conf->ssid;
|
||||
if (wpa_s->prev_scan_ssid != WILDCARD_SSID_SCAN) {
|
||||
@@ -336,6 +347,9 @@ static void wpa_supplicant_scan(void *el
|
||||
int_array_sort_unique(params.freqs);
|
||||
}
|
||||
|
||||
+ if (scan_ssid_all && !ssid)
|
||||
+ ssid = wpa_s->conf->ssid;
|
||||
+
|
||||
if (ssid) {
|
||||
wpa_s->prev_scan_ssid = ssid;
|
||||
if (max_ssids > 1) {
|
11
package/hostapd/patches/320-rescan_immediately.patch
Normal file
11
package/hostapd/patches/320-rescan_immediately.patch
Normal file
@ -0,0 +1,11 @@
|
||||
--- a/wpa_supplicant/events.c
|
||||
+++ b/wpa_supplicant/events.c
|
||||
@@ -843,7 +843,7 @@ static void wpa_supplicant_event_scan_re
|
||||
wpa_printf(MSG_DEBUG, "Setup a new network");
|
||||
wpa_supplicant_associate(wpa_s, NULL, ssid);
|
||||
} else
|
||||
- wpa_supplicant_req_new_scan(wpa_s, 5);
|
||||
+ wpa_supplicant_req_new_scan(wpa_s, 0);
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_NO_SCAN_PROCESSING */
|
767
package/hostapd/patches/330-madwifi_merge.patch
Normal file
767
package/hostapd/patches/330-madwifi_merge.patch
Normal file
@ -0,0 +1,767 @@
|
||||
--- a/src/drivers/driver_madwifi.c
|
||||
+++ b/src/drivers/driver_madwifi.c
|
||||
@@ -71,7 +71,6 @@
|
||||
|
||||
#define WPA_KEY_RSC_LEN 8
|
||||
|
||||
-#ifdef HOSTAPD
|
||||
|
||||
#include "priv_netlink.h"
|
||||
#include "netlink.h"
|
||||
@@ -82,17 +81,22 @@
|
||||
struct madwifi_driver_data {
|
||||
struct hostapd_data *hapd; /* back pointer */
|
||||
|
||||
- char iface[IFNAMSIZ + 1];
|
||||
+ void *wext; /* private data for driver_wext */
|
||||
+ void *ctx;
|
||||
+ char ifname[IFNAMSIZ + 1];
|
||||
+ int ioctl_sock; /* socket for ioctl() use */
|
||||
+
|
||||
+#ifdef HOSTAPD
|
||||
int ifindex;
|
||||
struct l2_packet_data *sock_xmit; /* raw packet xmit socket */
|
||||
struct l2_packet_data *sock_recv; /* raw packet recv socket */
|
||||
- int ioctl_sock; /* socket for ioctl() use */
|
||||
struct netlink_data *netlink;
|
||||
int we_version;
|
||||
u8 acct_mac[ETH_ALEN];
|
||||
struct hostap_sta_driver_data acct_data;
|
||||
|
||||
struct l2_packet_data *sock_raw; /* raw 802.11 management frames */
|
||||
+#endif
|
||||
};
|
||||
|
||||
static int madwifi_sta_deauth(void *priv, const u8 *own_addr, const u8 *addr,
|
||||
@@ -105,7 +109,7 @@ set80211priv(struct madwifi_driver_data
|
||||
int do_inline = len < IFNAMSIZ;
|
||||
|
||||
memset(&iwr, 0, sizeof(iwr));
|
||||
- os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ);
|
||||
+ os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
|
||||
#ifdef IEEE80211_IOCTL_FILTERFRAME
|
||||
/* FILTERFRAME must be NOT inline, regardless of size. */
|
||||
if (op == IEEE80211_IOCTL_FILTERFRAME)
|
||||
@@ -206,7 +210,7 @@ set80211param(struct madwifi_driver_data
|
||||
struct iwreq iwr;
|
||||
|
||||
memset(&iwr, 0, sizeof(iwr));
|
||||
- os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ);
|
||||
+ os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
|
||||
iwr.u.mode = op;
|
||||
memcpy(iwr.u.name+sizeof(__u32), &arg, sizeof(arg));
|
||||
|
||||
@@ -233,6 +237,7 @@ ether_sprintf(const u8 *addr)
|
||||
}
|
||||
#endif /* CONFIG_NO_STDOUT_DEBUG */
|
||||
|
||||
+#ifdef HOSTAPD
|
||||
/*
|
||||
* Configure WPA parameters.
|
||||
*/
|
||||
@@ -395,7 +400,7 @@ madwifi_sta_set_flags(void *priv, const
|
||||
return madwifi_set_sta_authorized(priv, addr, 0);
|
||||
return 0;
|
||||
}
|
||||
-
|
||||
+#endif /* HOSTAPD */
|
||||
static int
|
||||
madwifi_del_key(void *priv, const u8 *addr, int key_idx)
|
||||
{
|
||||
@@ -407,28 +412,20 @@ madwifi_del_key(void *priv, const u8 *ad
|
||||
__func__, ether_sprintf(addr), key_idx);
|
||||
|
||||
memset(&wk, 0, sizeof(wk));
|
||||
+ wk.idk_keyix = key_idx;
|
||||
if (addr != NULL) {
|
||||
memcpy(wk.idk_macaddr, addr, IEEE80211_ADDR_LEN);
|
||||
- wk.idk_keyix = (u8) IEEE80211_KEYIX_NONE;
|
||||
- } else {
|
||||
- wk.idk_keyix = key_idx;
|
||||
- }
|
||||
-
|
||||
- ret = set80211priv(drv, IEEE80211_IOCTL_DELKEY, &wk, sizeof(wk));
|
||||
- if (ret < 0) {
|
||||
- wpa_printf(MSG_DEBUG, "%s: Failed to delete key (addr %s"
|
||||
- " key_idx %d)", __func__, ether_sprintf(addr),
|
||||
- key_idx);
|
||||
}
|
||||
|
||||
- return ret;
|
||||
+ set80211priv(drv, IEEE80211_IOCTL_DELKEY, &wk, sizeof(wk));
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
-wpa_driver_madwifi_set_key(const char *ifname, void *priv, enum wpa_alg alg,
|
||||
- const u8 *addr, int key_idx, int set_tx,
|
||||
- const u8 *seq, size_t seq_len,
|
||||
- const u8 *key, size_t key_len)
|
||||
+madwifi_set_key(const char *ifname, void *priv, enum wpa_alg alg,
|
||||
+ const u8 *addr, int key_idx, int set_tx,
|
||||
+ const u8 *seq, size_t seq_len,
|
||||
+ const u8 *key, size_t key_len)
|
||||
{
|
||||
struct madwifi_driver_data *drv = priv;
|
||||
struct ieee80211req_key wk;
|
||||
@@ -462,10 +459,14 @@ wpa_driver_madwifi_set_key(const char *i
|
||||
memset(&wk, 0, sizeof(wk));
|
||||
wk.ik_type = cipher;
|
||||
wk.ik_flags = IEEE80211_KEY_RECV | IEEE80211_KEY_XMIT;
|
||||
+
|
||||
if (addr == NULL) {
|
||||
memset(wk.ik_macaddr, 0xff, IEEE80211_ADDR_LEN);
|
||||
wk.ik_keyix = key_idx;
|
||||
wk.ik_flags |= IEEE80211_KEY_DEFAULT;
|
||||
+ } else if (!memcmp(addr, "\xff\xff\xff\xff\xff\xff", ETH_ALEN)) {
|
||||
+ wk.ik_flags |= IEEE80211_KEY_GROUP;
|
||||
+ memcpy(wk.ik_macaddr, addr, IEEE80211_ADDR_LEN);
|
||||
} else {
|
||||
memcpy(wk.ik_macaddr, addr, IEEE80211_ADDR_LEN);
|
||||
wk.ik_keyix = IEEE80211_KEYIX_NONE;
|
||||
@@ -485,6 +486,7 @@ wpa_driver_madwifi_set_key(const char *i
|
||||
}
|
||||
|
||||
|
||||
+#ifdef HOSTAPD
|
||||
static int
|
||||
madwifi_get_seqnum(const char *ifname, void *priv, const u8 *addr, int idx,
|
||||
u8 *seq)
|
||||
@@ -591,7 +593,7 @@ madwifi_read_sta_driver_data(void *priv,
|
||||
|
||||
memset(data, 0, sizeof(*data));
|
||||
snprintf(buf, sizeof(buf), "/proc/net/madwifi/%s/" MACSTR,
|
||||
- drv->iface, MAC2STR(addr));
|
||||
+ drv->ifname, MAC2STR(addr));
|
||||
|
||||
f = fopen(buf, "r");
|
||||
if (!f) {
|
||||
@@ -757,7 +759,7 @@ static int madwifi_receive_probe_req(str
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
- drv->sock_raw = l2_packet_init(drv->iface, NULL, ETH_P_80211_RAW,
|
||||
+ drv->sock_raw = l2_packet_init(drv->ifname, NULL, ETH_P_80211_RAW,
|
||||
madwifi_raw_receive, drv, 1);
|
||||
if (drv->sock_raw == NULL)
|
||||
return -1;
|
||||
@@ -1017,7 +1019,7 @@ madwifi_get_we_version(struct madwifi_dr
|
||||
return -1;
|
||||
|
||||
memset(&iwr, 0, sizeof(iwr));
|
||||
- os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ);
|
||||
+ os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
|
||||
iwr.u.data.pointer = (caddr_t) range;
|
||||
iwr.u.data.length = buflen;
|
||||
|
||||
@@ -1134,17 +1136,17 @@ madwifi_init(struct hostapd_data *hapd,
|
||||
perror("socket[PF_INET,SOCK_DGRAM]");
|
||||
goto bad;
|
||||
}
|
||||
- memcpy(drv->iface, params->ifname, sizeof(drv->iface));
|
||||
+ memcpy(drv->ifname, params->ifname, sizeof(drv->ifname));
|
||||
|
||||
memset(&ifr, 0, sizeof(ifr));
|
||||
- os_strlcpy(ifr.ifr_name, drv->iface, sizeof(ifr.ifr_name));
|
||||
+ os_strlcpy(ifr.ifr_name, drv->ifname, sizeof(ifr.ifr_name));
|
||||
if (ioctl(drv->ioctl_sock, SIOCGIFINDEX, &ifr) != 0) {
|
||||
perror("ioctl(SIOCGIFINDEX)");
|
||||
goto bad;
|
||||
}
|
||||
drv->ifindex = ifr.ifr_ifindex;
|
||||
|
||||
- drv->sock_xmit = l2_packet_init(drv->iface, NULL, ETH_P_EAPOL,
|
||||
+ drv->sock_xmit = l2_packet_init(drv->ifname, NULL, ETH_P_EAPOL,
|
||||
handle_read, drv, 1);
|
||||
if (drv->sock_xmit == NULL)
|
||||
goto bad;
|
||||
@@ -1158,7 +1160,7 @@ madwifi_init(struct hostapd_data *hapd,
|
||||
1);
|
||||
if (drv->sock_recv == NULL)
|
||||
goto bad;
|
||||
- } else if (linux_br_get(brname, drv->iface) == 0) {
|
||||
+ } else if (linux_br_get(brname, drv->ifname) == 0) {
|
||||
wpa_printf(MSG_DEBUG, "Interface in bridge %s; configure for "
|
||||
"EAPOL receive", brname);
|
||||
drv->sock_recv = l2_packet_init(brname, NULL, ETH_P_EAPOL,
|
||||
@@ -1169,7 +1171,7 @@ madwifi_init(struct hostapd_data *hapd,
|
||||
drv->sock_recv = drv->sock_xmit;
|
||||
|
||||
memset(&iwr, 0, sizeof(iwr));
|
||||
- os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ);
|
||||
+ os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
|
||||
|
||||
iwr.u.mode = IW_MODE_MASTER;
|
||||
|
||||
@@ -1179,7 +1181,7 @@ madwifi_init(struct hostapd_data *hapd,
|
||||
goto bad;
|
||||
}
|
||||
|
||||
- madwifi_set_privacy(drv->iface, drv, 0); /* default to no privacy */
|
||||
+ madwifi_set_privacy(drv->ifname, drv, 0); /* default to no privacy */
|
||||
|
||||
madwifi_receive_probe_req(drv);
|
||||
|
||||
@@ -1204,7 +1206,7 @@ madwifi_deinit(void *priv)
|
||||
struct madwifi_driver_data *drv = priv;
|
||||
|
||||
netlink_deinit(drv->netlink);
|
||||
- (void) linux_set_iface_flags(drv->ioctl_sock, drv->iface, 0);
|
||||
+ (void) linux_set_iface_flags(drv->ioctl_sock, drv->ifname, 0);
|
||||
if (drv->ioctl_sock >= 0)
|
||||
close(drv->ioctl_sock);
|
||||
if (drv->sock_recv != NULL && drv->sock_recv != drv->sock_xmit)
|
||||
@@ -1223,7 +1225,7 @@ madwifi_set_ssid(const char *ifname, voi
|
||||
struct iwreq iwr;
|
||||
|
||||
memset(&iwr, 0, sizeof(iwr));
|
||||
- os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ);
|
||||
+ os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
|
||||
iwr.u.essid.flags = 1; /* SSID active */
|
||||
iwr.u.essid.pointer = (caddr_t) buf;
|
||||
iwr.u.essid.length = len + 1;
|
||||
@@ -1244,7 +1246,7 @@ madwifi_get_ssid(const char *ifname, voi
|
||||
int ret = 0;
|
||||
|
||||
memset(&iwr, 0, sizeof(iwr));
|
||||
- os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ);
|
||||
+ os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
|
||||
iwr.u.essid.pointer = (caddr_t) buf;
|
||||
iwr.u.essid.length = len;
|
||||
|
||||
@@ -1271,137 +1273,16 @@ madwifi_commit(void *priv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-#else /* HOSTAPD */
|
||||
+#endif /* HOSTAPD */
|
||||
|
||||
-struct wpa_driver_madwifi_data {
|
||||
- void *wext; /* private data for driver_wext */
|
||||
- void *ctx;
|
||||
- char ifname[IFNAMSIZ + 1];
|
||||
- int sock;
|
||||
-};
|
||||
+#if !defined(NO_SUPPLICANT)
|
||||
|
||||
static int wpa_driver_madwifi_set_auth_alg(void *priv, int auth_alg);
|
||||
static int wpa_driver_madwifi_set_probe_req_ie(void *priv, const u8 *ies,
|
||||
size_t ies_len);
|
||||
|
||||
-
|
||||
-static int
|
||||
-set80211priv(struct wpa_driver_madwifi_data *drv, int op, void *data, int len,
|
||||
- int show_err)
|
||||
-{
|
||||
- struct iwreq iwr;
|
||||
-
|
||||
- os_memset(&iwr, 0, sizeof(iwr));
|
||||
- os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
|
||||
- if (len < IFNAMSIZ &&
|
||||
- op != IEEE80211_IOCTL_SET_APPIEBUF) {
|
||||
- /*
|
||||
- * Argument data fits inline; put it there.
|
||||
- */
|
||||
- os_memcpy(iwr.u.name, data, len);
|
||||
- } else {
|
||||
- /*
|
||||
- * Argument data too big for inline transfer; setup a
|
||||
- * parameter block instead; the kernel will transfer
|
||||
- * the data for the driver.
|
||||
- */
|
||||
- iwr.u.data.pointer = data;
|
||||
- iwr.u.data.length = len;
|
||||
- }
|
||||
-
|
||||
- if (ioctl(drv->sock, op, &iwr) < 0) {
|
||||
- if (show_err) {
|
||||
-#ifdef MADWIFI_NG
|
||||
- int first = IEEE80211_IOCTL_SETPARAM;
|
||||
- int last = IEEE80211_IOCTL_KICKMAC;
|
||||
- static const char *opnames[] = {
|
||||
- "ioctl[IEEE80211_IOCTL_SETPARAM]",
|
||||
- "ioctl[IEEE80211_IOCTL_GETPARAM]",
|
||||
- "ioctl[IEEE80211_IOCTL_SETMODE]",
|
||||
- "ioctl[IEEE80211_IOCTL_GETMODE]",
|
||||
- "ioctl[IEEE80211_IOCTL_SETWMMPARAMS]",
|
||||
- "ioctl[IEEE80211_IOCTL_GETWMMPARAMS]",
|
||||
- "ioctl[IEEE80211_IOCTL_SETCHANLIST]",
|
||||
- "ioctl[IEEE80211_IOCTL_GETCHANLIST]",
|
||||
- "ioctl[IEEE80211_IOCTL_CHANSWITCH]",
|
||||
- NULL,
|
||||
- "ioctl[IEEE80211_IOCTL_SET_APPIEBUF]",
|
||||
- "ioctl[IEEE80211_IOCTL_GETSCANRESULTS]",
|
||||
- NULL,
|
||||
- "ioctl[IEEE80211_IOCTL_GETCHANINFO]",
|
||||
- "ioctl[IEEE80211_IOCTL_SETOPTIE]",
|
||||
- "ioctl[IEEE80211_IOCTL_GETOPTIE]",
|
||||
- "ioctl[IEEE80211_IOCTL_SETMLME]",
|
||||
- NULL,
|
||||
- "ioctl[IEEE80211_IOCTL_SETKEY]",
|
||||
- NULL,
|
||||
- "ioctl[IEEE80211_IOCTL_DELKEY]",
|
||||
- NULL,
|
||||
- "ioctl[IEEE80211_IOCTL_ADDMAC]",
|
||||
- NULL,
|
||||
- "ioctl[IEEE80211_IOCTL_DELMAC]",
|
||||
- NULL,
|
||||
- "ioctl[IEEE80211_IOCTL_WDSMAC]",
|
||||
- NULL,
|
||||
- "ioctl[IEEE80211_IOCTL_WDSDELMAC]",
|
||||
- NULL,
|
||||
- "ioctl[IEEE80211_IOCTL_KICKMAC]",
|
||||
- };
|
||||
-#else /* MADWIFI_NG */
|
||||
- int first = IEEE80211_IOCTL_SETPARAM;
|
||||
- int last = IEEE80211_IOCTL_CHANLIST;
|
||||
- static const char *opnames[] = {
|
||||
- "ioctl[IEEE80211_IOCTL_SETPARAM]",
|
||||
- "ioctl[IEEE80211_IOCTL_GETPARAM]",
|
||||
- "ioctl[IEEE80211_IOCTL_SETKEY]",
|
||||
- "ioctl[IEEE80211_IOCTL_GETKEY]",
|
||||
- "ioctl[IEEE80211_IOCTL_DELKEY]",
|
||||
- NULL,
|
||||
- "ioctl[IEEE80211_IOCTL_SETMLME]",
|
||||
- NULL,
|
||||
- "ioctl[IEEE80211_IOCTL_SETOPTIE]",
|
||||
- "ioctl[IEEE80211_IOCTL_GETOPTIE]",
|
||||
- "ioctl[IEEE80211_IOCTL_ADDMAC]",
|
||||
- NULL,
|
||||
- "ioctl[IEEE80211_IOCTL_DELMAC]",
|
||||
- NULL,
|
||||
- "ioctl[IEEE80211_IOCTL_CHANLIST]",
|
||||
- };
|
||||
-#endif /* MADWIFI_NG */
|
||||
- int idx = op - first;
|
||||
- if (first <= op && op <= last &&
|
||||
- idx < (int) (sizeof(opnames) / sizeof(opnames[0]))
|
||||
- && opnames[idx])
|
||||
- perror(opnames[idx]);
|
||||
- else
|
||||
- perror("ioctl[unknown???]");
|
||||
- }
|
||||
- return -1;
|
||||
- }
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
static int
|
||||
-set80211param(struct wpa_driver_madwifi_data *drv, int op, int arg,
|
||||
- int show_err)
|
||||
-{
|
||||
- struct iwreq iwr;
|
||||
-
|
||||
- os_memset(&iwr, 0, sizeof(iwr));
|
||||
- os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
|
||||
- iwr.u.mode = op;
|
||||
- os_memcpy(iwr.u.name+sizeof(u32), &arg, sizeof(arg));
|
||||
-
|
||||
- if (ioctl(drv->sock, IEEE80211_IOCTL_SETPARAM, &iwr) < 0) {
|
||||
- if (show_err)
|
||||
- perror("ioctl[IEEE80211_IOCTL_SETPARAM]");
|
||||
- return -1;
|
||||
- }
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
-static int
|
||||
-wpa_driver_madwifi_set_wpa_ie(struct wpa_driver_madwifi_data *drv,
|
||||
+wpa_driver_madwifi_set_wpa_ie(struct madwifi_driver_data *drv,
|
||||
const u8 *wpa_ie, size_t wpa_ie_len)
|
||||
{
|
||||
struct iwreq iwr;
|
||||
@@ -1412,7 +1293,7 @@ wpa_driver_madwifi_set_wpa_ie(struct wpa
|
||||
iwr.u.data.pointer = (void *) wpa_ie;
|
||||
iwr.u.data.length = wpa_ie_len;
|
||||
|
||||
- if (ioctl(drv->sock, IEEE80211_IOCTL_SETOPTIE, &iwr) < 0) {
|
||||
+ if (ioctl(drv->ioctl_sock, IEEE80211_IOCTL_SETOPTIE, &iwr) < 0) {
|
||||
perror("ioctl[IEEE80211_IOCTL_SETOPTIE]");
|
||||
return -1;
|
||||
}
|
||||
@@ -1420,156 +1301,51 @@ wpa_driver_madwifi_set_wpa_ie(struct wpa
|
||||
}
|
||||
|
||||
static int
|
||||
-wpa_driver_madwifi_del_key(struct wpa_driver_madwifi_data *drv, int key_idx,
|
||||
- const u8 *addr)
|
||||
-{
|
||||
- struct ieee80211req_del_key wk;
|
||||
-
|
||||
- wpa_printf(MSG_DEBUG, "%s: keyidx=%d", __FUNCTION__, key_idx);
|
||||
- os_memset(&wk, 0, sizeof(wk));
|
||||
- wk.idk_keyix = key_idx;
|
||||
- if (addr != NULL)
|
||||
- os_memcpy(wk.idk_macaddr, addr, IEEE80211_ADDR_LEN);
|
||||
-
|
||||
- return set80211priv(drv, IEEE80211_IOCTL_DELKEY, &wk, sizeof(wk), 1);
|
||||
-}
|
||||
-
|
||||
-static int
|
||||
-wpa_driver_madwifi_set_key(const char *ifname, void *priv, enum wpa_alg alg,
|
||||
- const u8 *addr, int key_idx, int set_tx,
|
||||
- const u8 *seq, size_t seq_len,
|
||||
- const u8 *key, size_t key_len)
|
||||
-{
|
||||
- struct wpa_driver_madwifi_data *drv = priv;
|
||||
- struct ieee80211req_key wk;
|
||||
- char *alg_name;
|
||||
- u_int8_t cipher;
|
||||
-
|
||||
- if (alg == WPA_ALG_NONE)
|
||||
- return wpa_driver_madwifi_del_key(drv, key_idx, addr);
|
||||
-
|
||||
- switch (alg) {
|
||||
- case WPA_ALG_WEP:
|
||||
- if (addr == NULL || os_memcmp(addr, "\xff\xff\xff\xff\xff\xff",
|
||||
- ETH_ALEN) == 0) {
|
||||
- /*
|
||||
- * madwifi did not seem to like static WEP key
|
||||
- * configuration with IEEE80211_IOCTL_SETKEY, so use
|
||||
- * Linux wireless extensions ioctl for this.
|
||||
- */
|
||||
- return wpa_driver_wext_set_key(ifname, drv->wext, alg,
|
||||
- addr, key_idx, set_tx,
|
||||
- seq, seq_len,
|
||||
- key, key_len);
|
||||
- }
|
||||
- alg_name = "WEP";
|
||||
- cipher = IEEE80211_CIPHER_WEP;
|
||||
- break;
|
||||
- case WPA_ALG_TKIP:
|
||||
- alg_name = "TKIP";
|
||||
- cipher = IEEE80211_CIPHER_TKIP;
|
||||
- break;
|
||||
- case WPA_ALG_CCMP:
|
||||
- alg_name = "CCMP";
|
||||
- cipher = IEEE80211_CIPHER_AES_CCM;
|
||||
- break;
|
||||
- default:
|
||||
- wpa_printf(MSG_DEBUG, "%s: unknown/unsupported algorithm %d",
|
||||
- __FUNCTION__, alg);
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
- wpa_printf(MSG_DEBUG, "%s: alg=%s key_idx=%d set_tx=%d seq_len=%lu "
|
||||
- "key_len=%lu", __FUNCTION__, alg_name, key_idx, set_tx,
|
||||
- (unsigned long) seq_len, (unsigned long) key_len);
|
||||
-
|
||||
- if (seq_len > sizeof(u_int64_t)) {
|
||||
- wpa_printf(MSG_DEBUG, "%s: seq_len %lu too big",
|
||||
- __FUNCTION__, (unsigned long) seq_len);
|
||||
- return -2;
|
||||
- }
|
||||
- if (key_len > sizeof(wk.ik_keydata)) {
|
||||
- wpa_printf(MSG_DEBUG, "%s: key length %lu too big",
|
||||
- __FUNCTION__, (unsigned long) key_len);
|
||||
- return -3;
|
||||
- }
|
||||
-
|
||||
- os_memset(&wk, 0, sizeof(wk));
|
||||
- wk.ik_type = cipher;
|
||||
- wk.ik_flags = IEEE80211_KEY_RECV;
|
||||
- if (addr == NULL ||
|
||||
- os_memcmp(addr, "\xff\xff\xff\xff\xff\xff", ETH_ALEN) == 0)
|
||||
- wk.ik_flags |= IEEE80211_KEY_GROUP;
|
||||
- if (set_tx) {
|
||||
- wk.ik_flags |= IEEE80211_KEY_XMIT | IEEE80211_KEY_DEFAULT;
|
||||
- os_memcpy(wk.ik_macaddr, addr, IEEE80211_ADDR_LEN);
|
||||
- } else
|
||||
- os_memset(wk.ik_macaddr, 0, IEEE80211_ADDR_LEN);
|
||||
- wk.ik_keyix = key_idx;
|
||||
- wk.ik_keylen = key_len;
|
||||
-#ifdef WORDS_BIGENDIAN
|
||||
- {
|
||||
- size_t i;
|
||||
- u8 tmp[WPA_KEY_RSC_LEN];
|
||||
- os_memset(tmp, 0, sizeof(tmp));
|
||||
- for (i = 0; i < seq_len; i++)
|
||||
- tmp[WPA_KEY_RSC_LEN - i - 1] = seq[i];
|
||||
- os_memcpy(&wk.ik_keyrsc, tmp, WPA_KEY_RSC_LEN);
|
||||
- }
|
||||
-#else /* WORDS_BIGENDIAN */
|
||||
- os_memcpy(&wk.ik_keyrsc, seq, seq_len);
|
||||
-#endif /* WORDS_BIGENDIAN */
|
||||
- os_memcpy(wk.ik_keydata, key, key_len);
|
||||
-
|
||||
- return set80211priv(drv, IEEE80211_IOCTL_SETKEY, &wk, sizeof(wk), 1);
|
||||
-}
|
||||
-
|
||||
-static int
|
||||
wpa_driver_madwifi_set_countermeasures(void *priv, int enabled)
|
||||
{
|
||||
- struct wpa_driver_madwifi_data *drv = priv;
|
||||
+ struct madwifi_driver_data *drv = priv;
|
||||
wpa_printf(MSG_DEBUG, "%s: enabled=%d", __FUNCTION__, enabled);
|
||||
- return set80211param(drv, IEEE80211_PARAM_COUNTERMEASURES, enabled, 1);
|
||||
+ return set80211param(drv, IEEE80211_PARAM_COUNTERMEASURES, enabled);
|
||||
}
|
||||
|
||||
static int
|
||||
wpa_driver_madwifi_deauthenticate(void *priv, const u8 *addr, int reason_code)
|
||||
{
|
||||
- struct wpa_driver_madwifi_data *drv = priv;
|
||||
+ struct madwifi_driver_data *drv = priv;
|
||||
struct ieee80211req_mlme mlme;
|
||||
|
||||
wpa_printf(MSG_DEBUG, "%s", __FUNCTION__);
|
||||
mlme.im_op = IEEE80211_MLME_DEAUTH;
|
||||
mlme.im_reason = reason_code;
|
||||
os_memcpy(mlme.im_macaddr, addr, IEEE80211_ADDR_LEN);
|
||||
- return set80211priv(drv, IEEE80211_IOCTL_SETMLME, &mlme, sizeof(mlme), 1);
|
||||
+ return set80211priv(drv, IEEE80211_IOCTL_SETMLME, &mlme, sizeof(mlme));
|
||||
}
|
||||
|
||||
static int
|
||||
wpa_driver_madwifi_disassociate(void *priv, const u8 *addr, int reason_code)
|
||||
{
|
||||
- struct wpa_driver_madwifi_data *drv = priv;
|
||||
+ struct madwifi_driver_data *drv = priv;
|
||||
struct ieee80211req_mlme mlme;
|
||||
|
||||
wpa_printf(MSG_DEBUG, "%s", __FUNCTION__);
|
||||
mlme.im_op = IEEE80211_MLME_DISASSOC;
|
||||
mlme.im_reason = reason_code;
|
||||
os_memcpy(mlme.im_macaddr, addr, IEEE80211_ADDR_LEN);
|
||||
- return set80211priv(drv, IEEE80211_IOCTL_SETMLME, &mlme, sizeof(mlme), 1);
|
||||
+ return set80211priv(drv, IEEE80211_IOCTL_SETMLME, &mlme, sizeof(mlme));
|
||||
}
|
||||
|
||||
static int
|
||||
wpa_driver_madwifi_associate(void *priv,
|
||||
struct wpa_driver_associate_params *params)
|
||||
{
|
||||
- struct wpa_driver_madwifi_data *drv = priv;
|
||||
+ struct madwifi_driver_data *drv = priv;
|
||||
struct ieee80211req_mlme mlme;
|
||||
int ret = 0, privacy = 1;
|
||||
|
||||
wpa_printf(MSG_DEBUG, "%s", __FUNCTION__);
|
||||
|
||||
if (set80211param(drv, IEEE80211_PARAM_DROPUNENCRYPTED,
|
||||
- params->drop_unencrypted, 1) < 0)
|
||||
+ params->drop_unencrypted) < 0)
|
||||
ret = -1;
|
||||
if (wpa_driver_madwifi_set_auth_alg(drv, params->auth_alg) < 0)
|
||||
ret = -1;
|
||||
@@ -1592,12 +1368,12 @@ wpa_driver_madwifi_associate(void *priv,
|
||||
params->wpa_ie_len == 0)
|
||||
privacy = 0;
|
||||
|
||||
- if (set80211param(drv, IEEE80211_PARAM_PRIVACY, privacy, 1) < 0)
|
||||
+ if (set80211param(drv, IEEE80211_PARAM_PRIVACY, privacy) < 0)
|
||||
ret = -1;
|
||||
|
||||
if (params->wpa_ie_len &&
|
||||
set80211param(drv, IEEE80211_PARAM_WPA,
|
||||
- params->wpa_ie[0] == WLAN_EID_RSN ? 2 : 1, 1) < 0)
|
||||
+ params->wpa_ie[0] == WLAN_EID_RSN ? 2 : 1) < 0)
|
||||
ret = -1;
|
||||
|
||||
if (params->bssid == NULL) {
|
||||
@@ -1605,14 +1381,14 @@ wpa_driver_madwifi_associate(void *priv,
|
||||
* roaming */
|
||||
/* FIX: this does not seem to work; would probably need to
|
||||
* change something in the driver */
|
||||
- if (set80211param(drv, IEEE80211_PARAM_ROAMING, 0, 1) < 0)
|
||||
+ if (set80211param(drv, IEEE80211_PARAM_ROAMING, 0) < 0)
|
||||
ret = -1;
|
||||
|
||||
if (wpa_driver_wext_set_ssid(drv->wext, params->ssid,
|
||||
params->ssid_len) < 0)
|
||||
ret = -1;
|
||||
} else {
|
||||
- if (set80211param(drv, IEEE80211_PARAM_ROAMING, 2, 1) < 0)
|
||||
+ if (set80211param(drv, IEEE80211_PARAM_ROAMING, 2) < 0)
|
||||
ret = -1;
|
||||
if (wpa_driver_wext_set_ssid(drv->wext, params->ssid,
|
||||
params->ssid_len) < 0)
|
||||
@@ -1621,7 +1397,7 @@ wpa_driver_madwifi_associate(void *priv,
|
||||
mlme.im_op = IEEE80211_MLME_ASSOC;
|
||||
os_memcpy(mlme.im_macaddr, params->bssid, IEEE80211_ADDR_LEN);
|
||||
if (set80211priv(drv, IEEE80211_IOCTL_SETMLME, &mlme,
|
||||
- sizeof(mlme), 1) < 0) {
|
||||
+ sizeof(mlme)) < 0) {
|
||||
wpa_printf(MSG_DEBUG, "%s: SETMLME[ASSOC] failed",
|
||||
__func__);
|
||||
ret = -1;
|
||||
@@ -1634,7 +1410,7 @@ wpa_driver_madwifi_associate(void *priv,
|
||||
static int
|
||||
wpa_driver_madwifi_set_auth_alg(void *priv, int auth_alg)
|
||||
{
|
||||
- struct wpa_driver_madwifi_data *drv = priv;
|
||||
+ struct madwifi_driver_data *drv = priv;
|
||||
int authmode;
|
||||
|
||||
if ((auth_alg & WPA_AUTH_ALG_OPEN) &&
|
||||
@@ -1645,13 +1421,13 @@ wpa_driver_madwifi_set_auth_alg(void *pr
|
||||
else
|
||||
authmode = IEEE80211_AUTH_OPEN;
|
||||
|
||||
- return set80211param(drv, IEEE80211_PARAM_AUTHMODE, authmode, 1);
|
||||
+ return set80211param(drv, IEEE80211_PARAM_AUTHMODE, authmode);
|
||||
}
|
||||
|
||||
static int
|
||||
wpa_driver_madwifi_scan(void *priv, struct wpa_driver_scan_params *params)
|
||||
{
|
||||
- struct wpa_driver_madwifi_data *drv = priv;
|
||||
+ struct madwifi_driver_data *drv = priv;
|
||||
struct iwreq iwr;
|
||||
int ret = 0;
|
||||
const u8 *ssid = params->ssids[0].ssid;
|
||||
@@ -1669,7 +1445,7 @@ wpa_driver_madwifi_scan(void *priv, stru
|
||||
if (wpa_driver_wext_set_ssid(drv->wext, ssid, ssid_len) < 0)
|
||||
ret = -1;
|
||||
|
||||
- if (ioctl(drv->sock, SIOCSIWSCAN, &iwr) < 0) {
|
||||
+ if (ioctl(drv->ioctl_sock, SIOCSIWSCAN, &iwr) < 0) {
|
||||
perror("ioctl[SIOCSIWSCAN]");
|
||||
ret = -1;
|
||||
}
|
||||
@@ -1691,14 +1467,14 @@ wpa_driver_madwifi_scan(void *priv, stru
|
||||
|
||||
static int wpa_driver_madwifi_get_bssid(void *priv, u8 *bssid)
|
||||
{
|
||||
- struct wpa_driver_madwifi_data *drv = priv;
|
||||
+ struct madwifi_driver_data *drv = priv;
|
||||
return wpa_driver_wext_get_bssid(drv->wext, bssid);
|
||||
}
|
||||
|
||||
|
||||
static int wpa_driver_madwifi_get_ssid(void *priv, u8 *ssid)
|
||||
{
|
||||
- struct wpa_driver_madwifi_data *drv = priv;
|
||||
+ struct madwifi_driver_data *drv = priv;
|
||||
return wpa_driver_wext_get_ssid(drv->wext, ssid);
|
||||
}
|
||||
|
||||
@@ -1706,14 +1482,14 @@ static int wpa_driver_madwifi_get_ssid(v
|
||||
static struct wpa_scan_results *
|
||||
wpa_driver_madwifi_get_scan_results(void *priv)
|
||||
{
|
||||
- struct wpa_driver_madwifi_data *drv = priv;
|
||||
+ struct madwifi_driver_data *drv = priv;
|
||||
return wpa_driver_wext_get_scan_results(drv->wext);
|
||||
}
|
||||
|
||||
|
||||
static int wpa_driver_madwifi_set_operstate(void *priv, int state)
|
||||
{
|
||||
- struct wpa_driver_madwifi_data *drv = priv;
|
||||
+ struct madwifi_driver_data *drv = priv;
|
||||
return wpa_driver_wext_set_operstate(drv->wext, state);
|
||||
}
|
||||
|
||||
@@ -1734,7 +1510,7 @@ static int wpa_driver_madwifi_set_probe_
|
||||
|
||||
ret = set80211priv(priv, IEEE80211_IOCTL_SET_APPIEBUF, probe_req_ie,
|
||||
sizeof(struct ieee80211req_getset_appiebuf) +
|
||||
- ies_len, 1);
|
||||
+ ies_len);
|
||||
|
||||
os_free(probe_req_ie);
|
||||
|
||||
@@ -1744,7 +1520,7 @@ static int wpa_driver_madwifi_set_probe_
|
||||
|
||||
static void * wpa_driver_madwifi_init(void *ctx, const char *ifname)
|
||||
{
|
||||
- struct wpa_driver_madwifi_data *drv;
|
||||
+ struct madwifi_driver_data *drv;
|
||||
|
||||
drv = os_zalloc(sizeof(*drv));
|
||||
if (drv == NULL)
|
||||
@@ -1755,17 +1531,17 @@ static void * wpa_driver_madwifi_init(vo
|
||||
|
||||
drv->ctx = ctx;
|
||||
os_strlcpy(drv->ifname, ifname, sizeof(drv->ifname));
|
||||
- drv->sock = socket(PF_INET, SOCK_DGRAM, 0);
|
||||
- if (drv->sock < 0)
|
||||
+ drv->ioctl_sock = socket(PF_INET, SOCK_DGRAM, 0);
|
||||
+ if (drv->ioctl_sock < 0)
|
||||
goto fail2;
|
||||
|
||||
- if (set80211param(drv, IEEE80211_PARAM_ROAMING, 2, 1) < 0) {
|
||||
+ if (set80211param(drv, IEEE80211_PARAM_ROAMING, 2) < 0) {
|
||||
wpa_printf(MSG_DEBUG, "%s: failed to set wpa_supplicant-based "
|
||||
"roaming", __FUNCTION__);
|
||||
goto fail3;
|
||||
}
|
||||
|
||||
- if (set80211param(drv, IEEE80211_PARAM_WPA, 3, 1) < 0) {
|
||||
+ if (set80211param(drv, IEEE80211_PARAM_WPA, 3) < 0) {
|
||||
wpa_printf(MSG_DEBUG, "%s: failed to enable WPA support",
|
||||
__FUNCTION__);
|
||||
goto fail3;
|
||||
@@ -1774,7 +1550,7 @@ static void * wpa_driver_madwifi_init(vo
|
||||
return drv;
|
||||
|
||||
fail3:
|
||||
- close(drv->sock);
|
||||
+ close(drv->ioctl_sock);
|
||||
fail2:
|
||||
wpa_driver_wext_deinit(drv->wext);
|
||||
fail:
|
||||
@@ -1785,38 +1561,37 @@ fail:
|
||||
|
||||
static void wpa_driver_madwifi_deinit(void *priv)
|
||||
{
|
||||
- struct wpa_driver_madwifi_data *drv = priv;
|
||||
+ struct madwifi_driver_data *drv = priv;
|
||||
|
||||
if (wpa_driver_madwifi_set_wpa_ie(drv, NULL, 0) < 0) {
|
||||
wpa_printf(MSG_DEBUG, "%s: failed to clear WPA IE",
|
||||
__FUNCTION__);
|
||||
}
|
||||
- if (set80211param(drv, IEEE80211_PARAM_ROAMING, 0, 1) < 0) {
|
||||
+ if (set80211param(drv, IEEE80211_PARAM_ROAMING, 0) < 0) {
|
||||
wpa_printf(MSG_DEBUG, "%s: failed to enable driver-based "
|
||||
"roaming", __FUNCTION__);
|
||||
}
|
||||
- if (set80211param(drv, IEEE80211_PARAM_PRIVACY, 0, 1) < 0) {
|
||||
+ if (set80211param(drv, IEEE80211_PARAM_PRIVACY, 0) < 0) {
|
||||
wpa_printf(MSG_DEBUG, "%s: failed to disable forced Privacy "
|
||||
"flag", __FUNCTION__);
|
||||
}
|
||||
- if (set80211param(drv, IEEE80211_PARAM_WPA, 0, 1) < 0) {
|
||||
+ if (set80211param(drv, IEEE80211_PARAM_WPA, 0) < 0) {
|
||||
wpa_printf(MSG_DEBUG, "%s: failed to disable WPA",
|
||||
__FUNCTION__);
|
||||
}
|
||||
|
||||
wpa_driver_wext_deinit(drv->wext);
|
||||
|
||||
- close(drv->sock);
|
||||
+ close(drv->ioctl_sock);
|
||||
os_free(drv);
|
||||
}
|
||||
|
||||
-#endif /* HOSTAPD */
|
||||
-
|
||||
+#endif
|
||||
|
||||
const struct wpa_driver_ops wpa_driver_madwifi_ops = {
|
||||
.name = "madwifi",
|
||||
.desc = "MADWIFI 802.11 support (Atheros, etc.)",
|
||||
- .set_key = wpa_driver_madwifi_set_key,
|
||||
+ .set_key = madwifi_set_key,
|
||||
#ifdef HOSTAPD
|
||||
.hapd_init = madwifi_init,
|
||||
.hapd_deinit = madwifi_deinit,
|
||||
@@ -1836,7 +1611,8 @@ const struct wpa_driver_ops wpa_driver_m
|
||||
.sta_clear_stats = madwifi_sta_clear_stats,
|
||||
.commit = madwifi_commit,
|
||||
.set_ap_wps_ie = madwifi_set_ap_wps_ie,
|
||||
-#else /* HOSTAPD */
|
||||
+#endif /* HOSTAPD */
|
||||
+#if !defined(NO_SUPPLICANT)
|
||||
.get_bssid = wpa_driver_madwifi_get_bssid,
|
||||
.get_ssid = wpa_driver_madwifi_get_ssid,
|
||||
.init = wpa_driver_madwifi_init,
|
||||
@@ -1848,5 +1624,5 @@ const struct wpa_driver_ops wpa_driver_m
|
||||
.disassociate = wpa_driver_madwifi_disassociate,
|
||||
.associate = wpa_driver_madwifi_associate,
|
||||
.set_operstate = wpa_driver_madwifi_set_operstate,
|
||||
-#endif /* HOSTAPD */
|
||||
+#endif
|
||||
};
|
14
package/hostapd/patches/340-roboswitch_fix.patch
Normal file
14
package/hostapd/patches/340-roboswitch_fix.patch
Normal file
@ -0,0 +1,14 @@
|
||||
--- a/src/drivers/driver_roboswitch.c
|
||||
+++ b/src/drivers/driver_roboswitch.c
|
||||
@@ -14,10 +14,10 @@
|
||||
|
||||
#include "includes.h"
|
||||
#include <sys/ioctl.h>
|
||||
-#include <linux/if.h>
|
||||
#include <linux/sockios.h>
|
||||
#include <linux/if_ether.h>
|
||||
#include <linux/mii.h>
|
||||
+#include <net/if.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "driver.h"
|
@ -9,18 +9,16 @@ include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=iptables
|
||||
PKG_VERSION:=1.4.4
|
||||
PKG_RELEASE:=3
|
||||
PKG_VERSION:=1.4.6
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_MD5SUM:=08cd9196881657ea0615d926334cb7e9
|
||||
PKG_MD5SUM:=c67cf30e281a924def6426be0973df56
|
||||
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/
|
||||
|
||||
PATCH_DIR:=./patches/$(PKG_VERSION)
|
||||
|
||||
PKG_FIXUP = libtool
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
@ -258,7 +256,6 @@ TARGET_CPPFLAGS := \
|
||||
|
||||
CONFIGURE_ARGS += \
|
||||
--enable-shared \
|
||||
--enable-static \
|
||||
--enable-devel \
|
||||
--enable-ipv6 \
|
||||
--with-kernel="$(LINUX_DIR)" \
|
||||
@ -295,7 +292,7 @@ define Build/InstallDev
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
|
||||
mkdir -p $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libxtables.{a,so*} $(1)/usr/lib/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libiptc.{a,so*} $(1)/usr/lib/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libip*tc.{a,so*} $(1)/usr/lib/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libipq.a $(1)/usr/lib/
|
||||
mkdir -p $(1)/usr/lib/pkgconfig
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/xtables.pc $(1)/usr/lib/pkgconfig/
|
||||
@ -336,7 +333,7 @@ endef
|
||||
|
||||
define Package/libiptc/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libiptc.so* $(1)/usr/lib/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libip*tc.so* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Package/libxtables/install
|
||||
|
@ -48,7 +48,7 @@
|
||||
+
|
||||
+ switch(c) {
|
||||
+ case '1':
|
||||
+ if (xtables_check_inverse(optarg, &invert, NULL, 0))
|
||||
+ if (xtables_check_inverse(optarg, &invert, NULL, 0, argv))
|
||||
+ xtables_error(PARAMETER_PROBLEM,
|
||||
+ "Unexpected `!' after --todev");
|
||||
+ mr->todev=atoi(optarg);
|
||||
@ -80,7 +80,7 @@
|
||||
+static struct xtables_target imq_target = {
|
||||
+ .name = "IMQ",
|
||||
+ .version = XTABLES_VERSION,
|
||||
+ .family = AF_INET,
|
||||
+ .family = NFPROTO_IPV4,
|
||||
+ .size = XT_ALIGN(sizeof(struct xt_imq_info)),
|
||||
+ .userspacesize = XT_ALIGN(sizeof(struct xt_imq_info)),
|
||||
+ .help = IMQ_help,
|
||||
@ -94,7 +94,7 @@
|
||||
+static struct xtables_target imq_target6 = {
|
||||
+ .name = "IMQ",
|
||||
+ .version = XTABLES_VERSION,
|
||||
+ .family = AF_INET6,
|
||||
+ .family = NFPROTO_IPV6,
|
||||
+ .size = XT_ALIGN(sizeof(struct xt_imq_info)),
|
||||
+ .userspacesize = XT_ALIGN(sizeof(struct xt_imq_info)),
|
||||
+ .help = IMQ_help,
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user