[submodule "openembedded-core"]
path = openembedded-core
- url = git://git.openembedded.org/openembedded-core-contrib
+ url = http://192.168.102.71/openembedded-core-daisy
[submodule "meta-openembedded"]
path = meta-openembedded
- url = git://git.openembedded.org/meta-openembedded-contrib
+ url = http://192.168.102.71/meta-openembedded-daisy
[submodule "bitbake"]
path = bitbake
url = git://git.openembedded.org/bitbake
$(CURDIR)/meta-bsp/common \
$(CURDIR)/meta-openvuplus \
$(CURDIR)/meta-openembedded/meta-oe \
+ $(CURDIR)/meta-openembedded/meta-networking \
+ $(CURDIR)/meta-openembedded/meta-multimedia \
+ $(CURDIR)/meta-openembedded/meta-filesystems \
$(CURDIR)/openembedded-core/meta
CONFFILES = \
-Subproject commit 270a05b0b4ba0959fe0624d2a4885d7b70426da5
+Subproject commit ef2bf63e56b87e19d1a9059dd2d81a9a1a537254
PR .= "-bsp12"
SRC_URI += "\
- file://linux_3.1.1_bm750.patch;patch=1;pnum=1 \
- file://linux-sata_brcm.patch;patch=1;pnum=1 \
+ file://linux_3.1.1_bm750.patch \
+ file://linux-sata_brcm.patch \
"
MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "vuplus-dvb-modules"
MACHINE_FEATURES += "kernel26 alsa pci wifi"
+MACHINE_FEATURES_BACKFILL_CONSIDERED = "rtc"
+
PREFERRED_PROVIDER_virtual/kernel = "linux-vuplus"
PREFERRED_VERSION_linux-vuplus = "${VUPLUS_KERNEL_VERSION}"
--- /dev/null
+commit 8511b7b083db01ad0538bea6a8af79f88fe02a8b
+Author: hschang <chang@dev3>
+Date: Wed Jan 8 20:32:42 2014 +0900
+
+ MIPS: Refactor 'clear_page' and 'copy_page' functions.
+
+ Remove usage of the '__attribute__((alias("...")))' hack that aliased
+ to integer arrays containing micro-assembled instructions. This hack
+ breaks when building a microMIPS kernel. It also makes the code much
+ easier to understand.
+
+ [ralf@linux-mips.org: Added back export of the clear_page and copy_page
+ symbols so certain modules will work again. Also fixed build with
+ CONFIG_SIBYTE_DMA_PAGEOPS enabled.]
+
+ Signed-off-by: Steven J. Hill <sjhill@mips.com>
+ Cc: linux-mips@linux-mips.org
+ Patchwork: https://patchwork.linux-mips.org/patch/3866/
+ Acked-by: David Daney <david.daney@cavium.com>
+ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
+
+diff --git a/arch/mips/kernel/mips_ksyms.c b/arch/mips/kernel/mips_ksyms.c
+index 1d04807..17160bf 100644
+--- a/arch/mips/kernel/mips_ksyms.c
++++ b/arch/mips/kernel/mips_ksyms.c
+@@ -5,7 +5,7 @@
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+- * Copyright (C) 1996, 97, 98, 99, 2000, 01, 03, 04, 05 by Ralf Baechle
++ * Copyright (C) 1996, 97, 98, 99, 2000, 01, 03, 04, 05, 12 by Ralf Baechle
+ * Copyright (C) 1999, 2000, 01 Silicon Graphics, Inc.
+ */
+ #include <linux/interrupt.h>
+@@ -35,6 +35,13 @@ EXPORT_SYMBOL(memmove);
+ EXPORT_SYMBOL(kernel_thread);
+
+ /*
++ * Functions that operate on entire pages. Mostly used by memory management.
++ */
++
++EXPORT_SYMBOL(clear_page);
++EXPORT_SYMBOL(copy_page);
++
++/*
+ * Userspace access stuff.
+ */
+ EXPORT_SYMBOL(__copy_user);
+diff --git a/arch/mips/mm/Makefile b/arch/mips/mm/Makefile
+index 95e5ccb..2f2dc25 100644
+--- a/arch/mips/mm/Makefile
++++ b/arch/mips/mm/Makefile
+@@ -4,7 +4,7 @@
+
+ obj-y += cache.o dma-default.o extable.o fault.o \
+ init.o mmap.o tlbex.o tlbex-fault.o uasm.o \
+- page.o
++ page.o page-funcs.o
+
+ obj-$(CONFIG_32BIT) += ioremap.o pgtable-32.o
+ obj-$(CONFIG_64BIT) += pgtable-64.o
+diff --git a/arch/mips/mm/page-funcs.S b/arch/mips/mm/page-funcs.S
+new file mode 100644
+index 0000000..48a6b38
+--- /dev/null
++++ b/arch/mips/mm/page-funcs.S
+@@ -0,0 +1,50 @@
++/*
++ * This file is subject to the terms and conditions of the GNU General Public
++ * License. See the file "COPYING" in the main directory of this archive
++ * for more details.
++ *
++ * Micro-assembler generated clear_page/copy_page functions.
++ *
++ * Copyright (C) 2012 MIPS Technologies, Inc.
++ * Copyright (C) 2012 Ralf Baechle <ralf@linux-mips.org>
++ */
++#include <asm/asm.h>
++#include <asm/regdef.h>
++
++#ifdef CONFIG_SIBYTE_DMA_PAGEOPS
++#define cpu_clear_page_function_name clear_page_cpu
++#define cpu_copy_page_function_name copy_page_cpu
++#else
++#define cpu_clear_page_function_name clear_page
++#define cpu_copy_page_function_name copy_page
++#endif
++
++/*
++ * Maximum sizes:
++ *
++ * R4000 128 bytes S-cache: 0x058 bytes
++ * R4600 v1.7: 0x05c bytes
++ * R4600 v2.0: 0x060 bytes
++ * With prefetching, 16 word strides 0x120 bytes
++ */
++EXPORT(__clear_page_start)
++LEAF(cpu_clear_page_function_name)
++1: j 1b /* Dummy, will be replaced. */
++ .space 288
++END(cpu_clear_page_function_name)
++EXPORT(__clear_page_end)
++
++/*
++ * Maximum sizes:
++ *
++ * R4000 128 bytes S-cache: 0x11c bytes
++ * R4600 v1.7: 0x080 bytes
++ * R4600 v2.0: 0x07c bytes
++ * With prefetching, 16 word strides 0x540 bytes
++ */
++EXPORT(__copy_page_start)
++LEAF(cpu_copy_page_function_name)
++1: j 1b /* Dummy, will be replaced. */
++ .space 1344
++END(cpu_copy_page_function_name)
++EXPORT(__copy_page_end)
+diff --git a/arch/mips/mm/page.c b/arch/mips/mm/page.c
+index 36272f7..a22bd40 100644
+--- a/arch/mips/mm/page.c
++++ b/arch/mips/mm/page.c
+@@ -6,6 +6,7 @@
+ * Copyright (C) 2003, 04, 05 Ralf Baechle (ralf@linux-mips.org)
+ * Copyright (C) 2007 Maciej W. Rozycki
+ * Copyright (C) 2008 Thiemo Seufer
++ * Copyright (C) 2012 MIPS Technologies, Inc.
+ */
+ #include <linux/init.h>
+ #include <linux/kernel.h>
+@@ -72,45 +73,6 @@ static struct uasm_reloc __cpuinitdata relocs[5];
+ #define cpu_is_r4600_v1_x() ((read_c0_prid() & 0xfffffff0) == 0x00002010)
+ #define cpu_is_r4600_v2_x() ((read_c0_prid() & 0xfffffff0) == 0x00002020)
+
+-/*
+- * Maximum sizes:
+- *
+- * R4000 128 bytes S-cache: 0x058 bytes
+- * R4600 v1.7: 0x05c bytes
+- * R4600 v2.0: 0x060 bytes
+- * With prefetching, 16 word strides 0x120 bytes
+- */
+-
+-static u32 clear_page_array[0x120 / 4];
+-
+-#ifdef CONFIG_SIBYTE_DMA_PAGEOPS
+-void clear_page_cpu(void *page) __attribute__((alias("clear_page_array")));
+-#else
+-void clear_page(void *page) __attribute__((alias("clear_page_array")));
+-#endif
+-
+-EXPORT_SYMBOL(clear_page);
+-
+-/*
+- * Maximum sizes:
+- *
+- * R4000 128 bytes S-cache: 0x11c bytes
+- * R4600 v1.7: 0x080 bytes
+- * R4600 v2.0: 0x07c bytes
+- * With prefetching, 16 word strides 0x540 bytes
+- */
+-static u32 copy_page_array[0x540 / 4];
+-
+-#ifdef CONFIG_SIBYTE_DMA_PAGEOPS
+-void
+-copy_page_cpu(void *to, void *from) __attribute__((alias("copy_page_array")));
+-#else
+-void copy_page(void *to, void *from) __attribute__((alias("copy_page_array")));
+-#endif
+-
+-EXPORT_SYMBOL(copy_page);
+-
+-
+ static int pref_bias_clear_store __cpuinitdata;
+ static int pref_bias_copy_load __cpuinitdata;
+ static int pref_bias_copy_store __cpuinitdata;
+@@ -283,10 +245,15 @@ static inline void __cpuinit build_clear_pref(u32 **buf, int off)
+ }
+ }
+
++extern u32 __clear_page_start;
++extern u32 __clear_page_end;
++extern u32 __copy_page_start;
++extern u32 __copy_page_end;
++
+ void __cpuinit build_clear_page(void)
+ {
+ int off;
+- u32 *buf = (u32 *)&clear_page_array;
++ u32 *buf = &__clear_page_start;
+ struct uasm_label *l = labels;
+ struct uasm_reloc *r = relocs;
+ int i;
+@@ -357,17 +324,17 @@ void __cpuinit build_clear_page(void)
+ uasm_i_jr(&buf, RA);
+ uasm_i_nop(&buf);
+
+- BUG_ON(buf > clear_page_array + ARRAY_SIZE(clear_page_array));
++ BUG_ON(buf > &__clear_page_end);
+
+ uasm_resolve_relocs(relocs, labels);
+
+ pr_debug("Synthesized clear page handler (%u instructions).\n",
+- (u32)(buf - clear_page_array));
++ (u32)(buf - &__clear_page_start));
+
+ pr_debug("\t.set push\n");
+ pr_debug("\t.set noreorder\n");
+- for (i = 0; i < (buf - clear_page_array); i++)
+- pr_debug("\t.word 0x%08x\n", clear_page_array[i]);
++ for (i = 0; i < (buf - &__clear_page_start); i++)
++ pr_debug("\t.word 0x%08x\n", (&__clear_page_start)[i]);
+ pr_debug("\t.set pop\n");
+ }
+
+@@ -428,7 +395,7 @@ static inline void build_copy_store_pref(u32 **buf, int off)
+ void __cpuinit build_copy_page(void)
+ {
+ int off;
+- u32 *buf = (u32 *)©_page_array;
++ u32 *buf = &__copy_page_start;
+ struct uasm_label *l = labels;
+ struct uasm_reloc *r = relocs;
+ int i;
+@@ -596,21 +563,23 @@ void __cpuinit build_copy_page(void)
+ uasm_i_jr(&buf, RA);
+ uasm_i_nop(&buf);
+
+- BUG_ON(buf > copy_page_array + ARRAY_SIZE(copy_page_array));
++ BUG_ON(buf > &__copy_page_end);
+
+ uasm_resolve_relocs(relocs, labels);
+
+ pr_debug("Synthesized copy page handler (%u instructions).\n",
+- (u32)(buf - copy_page_array));
++ (u32)(buf - &__copy_page_start));
+
+ pr_debug("\t.set push\n");
+ pr_debug("\t.set noreorder\n");
+- for (i = 0; i < (buf - copy_page_array); i++)
+- pr_debug("\t.word 0x%08x\n", copy_page_array[i]);
++ for (i = 0; i < (buf - &__copy_page_start); i++)
++ pr_debug("\t.word 0x%08x\n", (&__copy_page_start)[i]);
+ pr_debug("\t.set pop\n");
+ }
+
+ #ifdef CONFIG_SIBYTE_DMA_PAGEOPS
++extern void clear_page_cpu(void *page);
++extern void copy_page_cpu(void *to, void *from);
+
+ /*
+ * Pad descriptors to cacheline, since each is exclusively owned by a
--- /dev/null
+commit c022630633624a75b3b58f43dd3c6cc896a56cff
+Author: Steven J. Hill <sjhill@mips.com>
+Date: Fri Jul 6 21:56:01 2012 +0200
+
+ MIPS: Refactor 'clear_page' and 'copy_page' functions.
+
+ Remove usage of the '__attribute__((alias("...")))' hack that aliased
+ to integer arrays containing micro-assembled instructions. This hack
+ breaks when building a microMIPS kernel. It also makes the code much
+ easier to understand.
+
+ [ralf@linux-mips.org: Added back export of the clear_page and copy_page
+ symbols so certain modules will work again. Also fixed build with
+ CONFIG_SIBYTE_DMA_PAGEOPS enabled.]
+
+ Signed-off-by: Steven J. Hill <sjhill@mips.com>
+ Cc: linux-mips@linux-mips.org
+ Patchwork: https://patchwork.linux-mips.org/patch/3866/
+ Acked-by: David Daney <david.daney@cavium.com>
+ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
+
+diff --git a/arch/mips/kernel/mips_ksyms.c b/arch/mips/kernel/mips_ksyms.c
+index 57ba13e..3fc1691 100644
+--- a/arch/mips/kernel/mips_ksyms.c
++++ b/arch/mips/kernel/mips_ksyms.c
+@@ -5,7 +5,7 @@
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+- * Copyright (C) 1996, 97, 98, 99, 2000, 01, 03, 04, 05 by Ralf Baechle
++ * Copyright (C) 1996, 97, 98, 99, 2000, 01, 03, 04, 05, 12 by Ralf Baechle
+ * Copyright (C) 1999, 2000, 01 Silicon Graphics, Inc.
+ */
+ #include <linux/interrupt.h>
+@@ -35,6 +35,12 @@ EXPORT_SYMBOL(memmove);
+ EXPORT_SYMBOL(kernel_thread);
+
+ /*
++ * Functions that operate on entire pages. Mostly used by memory management.
++ */
++EXPORT_SYMBOL(clear_page);
++EXPORT_SYMBOL(copy_page);
++
++/*
+ * Userspace access stuff.
+ */
+ EXPORT_SYMBOL(__copy_user);
+diff --git a/arch/mips/mm/Makefile b/arch/mips/mm/Makefile
+index 4aa2028..fd6203f 100644
+--- a/arch/mips/mm/Makefile
++++ b/arch/mips/mm/Makefile
+@@ -3,8 +3,8 @@
+ #
+
+ obj-y += cache.o dma-default.o extable.o fault.o \
+- gup.o init.o mmap.o page.o tlbex.o \
+- tlbex-fault.o uasm.o
++ gup.o init.o mmap.o page.o page-funcs.o \
++ tlbex.o tlbex-fault.o uasm.o
+
+ obj-$(CONFIG_32BIT) += ioremap.o pgtable-32.o
+ obj-$(CONFIG_64BIT) += pgtable-64.o
+diff --git a/arch/mips/mm/page-funcs.S b/arch/mips/mm/page-funcs.S
+new file mode 100644
+index 0000000..48a6b38
+--- /dev/null
++++ b/arch/mips/mm/page-funcs.S
+@@ -0,0 +1,50 @@
++/*
++ * This file is subject to the terms and conditions of the GNU General Public
++ * License. See the file "COPYING" in the main directory of this archive
++ * for more details.
++ *
++ * Micro-assembler generated clear_page/copy_page functions.
++ *
++ * Copyright (C) 2012 MIPS Technologies, Inc.
++ * Copyright (C) 2012 Ralf Baechle <ralf@linux-mips.org>
++ */
++#include <asm/asm.h>
++#include <asm/regdef.h>
++
++#ifdef CONFIG_SIBYTE_DMA_PAGEOPS
++#define cpu_clear_page_function_name clear_page_cpu
++#define cpu_copy_page_function_name copy_page_cpu
++#else
++#define cpu_clear_page_function_name clear_page
++#define cpu_copy_page_function_name copy_page
++#endif
++
++/*
++ * Maximum sizes:
++ *
++ * R4000 128 bytes S-cache: 0x058 bytes
++ * R4600 v1.7: 0x05c bytes
++ * R4600 v2.0: 0x060 bytes
++ * With prefetching, 16 word strides 0x120 bytes
++ */
++EXPORT(__clear_page_start)
++LEAF(cpu_clear_page_function_name)
++1: j 1b /* Dummy, will be replaced. */
++ .space 288
++END(cpu_clear_page_function_name)
++EXPORT(__clear_page_end)
++
++/*
++ * Maximum sizes:
++ *
++ * R4000 128 bytes S-cache: 0x11c bytes
++ * R4600 v1.7: 0x080 bytes
++ * R4600 v2.0: 0x07c bytes
++ * With prefetching, 16 word strides 0x540 bytes
++ */
++EXPORT(__copy_page_start)
++LEAF(cpu_copy_page_function_name)
++1: j 1b /* Dummy, will be replaced. */
++ .space 1344
++END(cpu_copy_page_function_name)
++EXPORT(__copy_page_end)
+diff --git a/arch/mips/mm/page.c b/arch/mips/mm/page.c
+index cc0b626..98f530e 100644
+--- a/arch/mips/mm/page.c
++++ b/arch/mips/mm/page.c
+@@ -6,6 +6,7 @@
+ * Copyright (C) 2003, 04, 05 Ralf Baechle (ralf@linux-mips.org)
+ * Copyright (C) 2007 Maciej W. Rozycki
+ * Copyright (C) 2008 Thiemo Seufer
++ * Copyright (C) 2012 MIPS Technologies, Inc.
+ */
+ #include <linux/init.h>
+ #include <linux/kernel.h>
+@@ -71,45 +72,6 @@ static struct uasm_reloc __cpuinitdata relocs[5];
+ #define cpu_is_r4600_v1_x() ((read_c0_prid() & 0xfffffff0) == 0x00002010)
+ #define cpu_is_r4600_v2_x() ((read_c0_prid() & 0xfffffff0) == 0x00002020)
+
+-/*
+- * Maximum sizes:
+- *
+- * R4000 128 bytes S-cache: 0x058 bytes
+- * R4600 v1.7: 0x05c bytes
+- * R4600 v2.0: 0x060 bytes
+- * With prefetching, 16 word strides 0x120 bytes
+- */
+-
+-static u32 clear_page_array[0x120 / 4];
+-
+-#ifdef CONFIG_SIBYTE_DMA_PAGEOPS
+-void clear_page_cpu(void *page) __attribute__((alias("clear_page_array")));
+-#else
+-void clear_page(void *page) __attribute__((alias("clear_page_array")));
+-#endif
+-
+-EXPORT_SYMBOL(clear_page);
+-
+-/*
+- * Maximum sizes:
+- *
+- * R4000 128 bytes S-cache: 0x11c bytes
+- * R4600 v1.7: 0x080 bytes
+- * R4600 v2.0: 0x07c bytes
+- * With prefetching, 16 word strides 0x540 bytes
+- */
+-static u32 copy_page_array[0x540 / 4];
+-
+-#ifdef CONFIG_SIBYTE_DMA_PAGEOPS
+-void
+-copy_page_cpu(void *to, void *from) __attribute__((alias("copy_page_array")));
+-#else
+-void copy_page(void *to, void *from) __attribute__((alias("copy_page_array")));
+-#endif
+-
+-EXPORT_SYMBOL(copy_page);
+-
+-
+ static int pref_bias_clear_store __cpuinitdata;
+ static int pref_bias_copy_load __cpuinitdata;
+ static int pref_bias_copy_store __cpuinitdata;
+@@ -282,10 +244,15 @@ static inline void __cpuinit build_clear_pref(u32 **buf, int off)
+ }
+ }
+
++extern u32 __clear_page_start;
++extern u32 __clear_page_end;
++extern u32 __copy_page_start;
++extern u32 __copy_page_end;
++
+ void __cpuinit build_clear_page(void)
+ {
+ int off;
+- u32 *buf = (u32 *)&clear_page_array;
++ u32 *buf = &__clear_page_start;
+ struct uasm_label *l = labels;
+ struct uasm_reloc *r = relocs;
+ int i;
+@@ -356,17 +323,17 @@ void __cpuinit build_clear_page(void)
+ uasm_i_jr(&buf, RA);
+ uasm_i_nop(&buf);
+
+- BUG_ON(buf > clear_page_array + ARRAY_SIZE(clear_page_array));
++ BUG_ON(buf > &__clear_page_end);
+
+ uasm_resolve_relocs(relocs, labels);
+
+ pr_debug("Synthesized clear page handler (%u instructions).\n",
+- (u32)(buf - clear_page_array));
++ (u32)(buf - &__clear_page_start));
+
+ pr_debug("\t.set push\n");
+ pr_debug("\t.set noreorder\n");
+- for (i = 0; i < (buf - clear_page_array); i++)
+- pr_debug("\t.word 0x%08x\n", clear_page_array[i]);
++ for (i = 0; i < (buf - &__clear_page_start); i++)
++ pr_debug("\t.word 0x%08x\n", (&__clear_page_start)[i]);
+ pr_debug("\t.set pop\n");
+ }
+
+@@ -427,7 +394,7 @@ static inline void build_copy_store_pref(u32 **buf, int off)
+ void __cpuinit build_copy_page(void)
+ {
+ int off;
+- u32 *buf = (u32 *)©_page_array;
++ u32 *buf = &__copy_page_start;
+ struct uasm_label *l = labels;
+ struct uasm_reloc *r = relocs;
+ int i;
+@@ -595,21 +562,23 @@ void __cpuinit build_copy_page(void)
+ uasm_i_jr(&buf, RA);
+ uasm_i_nop(&buf);
+
+- BUG_ON(buf > copy_page_array + ARRAY_SIZE(copy_page_array));
++ BUG_ON(buf > &__copy_page_end);
+
+ uasm_resolve_relocs(relocs, labels);
+
+ pr_debug("Synthesized copy page handler (%u instructions).\n",
+- (u32)(buf - copy_page_array));
++ (u32)(buf - &__copy_page_start));
+
+ pr_debug("\t.set push\n");
+ pr_debug("\t.set noreorder\n");
+- for (i = 0; i < (buf - copy_page_array); i++)
+- pr_debug("\t.word 0x%08x\n", copy_page_array[i]);
++ for (i = 0; i < (buf - &__copy_page_start); i++)
++ pr_debug("\t.word 0x%08x\n", (&__copy_page_start)[i]);
+ pr_debug("\t.set pop\n");
+ }
+
+ #ifdef CONFIG_SIBYTE_DMA_PAGEOPS
++extern void clear_page_cpu(void *page);
++extern void copy_page_cpu(void *to, void *from);
+
+ /*
+ * Pad descriptors to cacheline, since each is exclusively owned by a
MODULE = "linux-2.6.37"
SRC_URI += " http://archive.vuplus.com/download/kernel/stblinux-2.6.37-3.1.tar.bz2 \
- file://dvb-core.patch;patch=1;pnum=1 \
- file://fix_cpu_proc.patch;patch=1;pnum=1 \
- file://brcm_disable_enet1.patch;patch=1;pnum=1 \
- file://bcmgenet_oobctrl.patch;patch=1;pnum=1 \
- file://brcm_mtd_mac.patch;patch=1;pnum=1 \
+ file://dvb-core.patch \
+ file://fix_cpu_proc.patch \
+ file://brcm_disable_enet1.patch \
+ file://bcmgenet_oobctrl.patch \
+ file://brcm_mtd_mac.patch \
file://${MACHINE}_defconfig \
"
MODULE = "linux-3.1.1"
SRC_URI += "http://archive.vuplus.com/download/kernel/linux-${KV}_${SRCREV}.tar.bz2 \
- file://fix_cpu_proc.patch;patch=1;pnum=1 \
+ file://fix_cpu_proc.patch \
+ file://igmp.patch \
+ file://rt5372_kernel_3.1.1.patch \
+ file://kernel_miscompilation_with_gcc_4_8.patch \
file://${MACHINE}_defconfig \
- file://igmp.patch;patch=1;pnum=1 \
- file://rt5372_kernel_3.1.1.patch \
"
SRC_URI[md5sum] = "4dc3ac322453abbfaade7020cddea205"
MODULE = "linux-3.3.6"
SRC_URI += "http://archive.vuplus.com/download/kernel/stblinux-3.3.6-1.2.tar.bz2 \
- file://brcm_3.3.patch;patch=1;pnum=1 \
- file://fix_cpu_proc.patch;patch=1;pnum=1 \
- file://brcm_mtd_mac.patch;patch=1;pnum=1 \
- file://dvb_core_5.5.patch;patch=1;pnum=1 \
- file://brcm_remove_entire_mtd.patch;patch=1;pnum=1 \
+ file://brcm_3.3.patch \
+ file://fix_cpu_proc.patch \
+ file://brcm_mtd_mac.patch \
+ file://dvb_core_5.5.patch \
+ file://brcm_remove_entire_mtd.patch \
file://${MACHINE}_defconfig \
"
MODULE = "linux-3.3.8"
SRC_URI += "http://archive.vuplus.com/download/kernel/stblinux-3.3.6-2.0.tar.bz2 \
- file://brcm_3.3.patch;patch=1;pnum=1 \
- file://fix_cpu_proc.patch;patch=1;pnum=1 \
- file://brcm_mtd_mac.patch;patch=1;pnum=1 \
- file://dvb_core_5.5.patch;patch=1;pnum=1 \
- file://dvb_backport.patch;patch=1;pnum=1 \
- file://bmips-no-array-bounds.patch;patch=1;pnum=1 \
+ file://brcm_3.3.patch \
+ file://fix_cpu_proc.patch \
+ file://brcm_mtd_mac.patch \
+ file://dvb_core_5.5.patch \
+ file://dvb_backport.patch \
+ file://bmips-no-array-bounds.patch \
file://${MACHINE}_defconfig \
file://rt5372_kernel_3.3.8.patch \
- "
+ file://kernel_miscompilation_with_gcc_4_8.patch \
+"
S = "${WORKDIR}/linux"
PR .= "-bsp9"
-SRC_URI += "file://bmips-no-array-bounds.patch;patch=1;pnum=1 "
+SRC_URI += "file://bmips-no-array-bounds.patch "
PR .= "-bsp4"
-SRC_URI += "file://remove_genet1.patch;patch=1;pnum=1 \
- file://nand_base.patch;patch=1;pnum=1 \
- file://brcm_s3_wol.patch;patch=1;pnum=1 \
+SRC_URI += "file://remove_genet1.patch \
+ file://nand_base.patch \
+ file://brcm_s3_wol.patch \
"
PR .= "-bsp9"
SRC_URI += "\
- file://linux_3.1.1_vusolo.patch;patch=1;pnum=1 \
- file://fix_cpu_proc_solo.patch;patch=1;pnum=1 \
+ file://linux_3.1.1_vusolo.patch \
+ file://fix_cpu_proc_solo.patch \
"
PR.= "-bsp1"
-SRC_URI_append = " file://enigma2_vuplus_misc.patch;patch=1;pnum=1"
+SRC_URI_append = " file://enigma2_vuplus_misc.patch"
PR .= "-bsp10"
-SRC_URI += "file://bmips-no-array-bounds.patch;patch=1;pnum=1 "
-SRC_URI += "file://dvb_backport.patch;patch=1;pnum=1 "
+SRC_URI += "file://bmips-no-array-bounds.patch "
+SRC_URI += "file://dvb_backport.patch "
PR .= "-bsp0"
SRC_URI += "\
- file://linux-sata_brcm.patch;patch=1;pnum=1 \
+ file://linux-sata_brcm.patch \
"
PR .= "-bsp11"
SRC_URI += "\
- file://linux_3.1.1_vuuno.patch;patch=1;pnum=1 \
- file://linux-sata_brcm.patch;patch=1;pnum=1 \
+ file://linux_3.1.1_vuuno.patch \
+ file://linux-sata_brcm.patch \
"
-Subproject commit 835745de3fc9ad367d82a79983ca22f8694cf7ce
+Subproject commit 6434d97ee958e7f597b9cf358db0275315a33c47
+++ /dev/null
-def autotools_dep_prepend(d):
- if d.getVar('INHIBIT_AUTOTOOLS_DEPS', True):
- return ''
-
- pn = d.getVar('PN', True)
- deps = ''
-
- if pn in ['autoconf-native', 'automake-native', 'help2man-native']:
- return deps
- deps += 'autoconf-native automake-native '
-
- if not pn in ['libtool', 'libtool-native'] and not pn.endswith("libtool-cross"):
- deps += 'libtool-native '
- if not bb.data.inherits_class('native', d) \
- and not bb.data.inherits_class('nativesdk', d) \
- and not bb.data.inherits_class('cross', d) \
- and not d.getVar('INHIBIT_DEFAULT_DEPS', True):
- deps += 'libtool-cross '
-
- return deps + 'gnu-config-native '
-
-EXTRA_OEMAKE = ""
-
-DEPENDS_prepend = "${@autotools_dep_prepend(d)}"
-
-inherit siteinfo
-
-# Space separated list of shell scripts with variables defined to supply test
-# results for autoconf tests we cannot run at build time.
-export CONFIG_SITE = "${@siteinfo_get_files(d)}"
-
-acpaths = "default"
-EXTRA_AUTORECONF = "--exclude=autopoint"
-
-export lt_cv_sys_lib_dlsearch_path_spec = "${libdir} ${base_libdir}"
-
-def autotools_set_crosscompiling(d):
- if not bb.data.inherits_class('native', d):
- return " cross_compiling=yes"
- return ""
-
-def append_libtool_sysroot(d):
- # Only supply libtool sysroot option for non-native packages
- if not bb.data.inherits_class('native', d):
- return '--with-libtool-sysroot=${STAGING_DIR_HOST}'
- return ""
-
-# EXTRA_OECONF_append = "${@autotools_set_crosscompiling(d)}"
-
-CONFIGUREOPTS = " --build=${BUILD_SYS} \
- --host=${HOST_SYS} \
- --target=${TARGET_SYS} \
- --prefix=${prefix} \
- --exec_prefix=${exec_prefix} \
- --bindir=${bindir} \
- --sbindir=${sbindir} \
- --libexecdir=${libexecdir} \
- --datadir=${datadir} \
- --sysconfdir=${sysconfdir} \
- --sharedstatedir=${sharedstatedir} \
- --localstatedir=${localstatedir} \
- --libdir=${libdir} \
- --includedir=${includedir} \
- --oldincludedir=${oldincludedir} \
- --infodir=${infodir} \
- --mandir=${mandir} \
- --disable-silent-rules \
- ${CONFIGUREOPT_DEPTRACK} \
- ${@append_libtool_sysroot(d)}"
-CONFIGUREOPT_DEPTRACK = "--disable-dependency-tracking"
-
-
-oe_runconf () {
- cfgscript="${S}/configure"
- if [ -x "$cfgscript" ] ; then
- bbnote "Running $cfgscript ${CONFIGUREOPTS} ${EXTRA_OECONF} $@"
- ${CACHED_CONFIGUREVARS} $cfgscript ${CONFIGUREOPTS} ${EXTRA_OECONF} "$@" || bbfatal "oe_runconf failed"
- else
- bbfatal "no configure script found at $cfgscript"
- fi
-}
-
-AUTOTOOLS_AUXDIR ?= "${S}"
-
-autotools_do_configure() {
- case ${PN} in
- autoconf*)
- ;;
- automake*)
- ;;
- *)
- # WARNING: gross hack follows:
- # An autotools built package generally needs these scripts, however only
- # automake or libtoolize actually install the current versions of them.
- # This is a problem in builds that do not use libtool or automake, in the case
- # where we -need- the latest version of these scripts. e.g. running a build
- # for a package whose autotools are old, on an x86_64 machine, which the old
- # config.sub does not support. Work around this by installing them manually
- # regardless.
- ( for ac in `find ${S} -name configure.in -o -name configure.ac`; do
- rm -f `dirname $ac`/configure
- done )
- if [ -e ${S}/configure.in -o -e ${S}/configure.ac ]; then
- olddir=`pwd`
- cd ${S}
- # Remove any previous copy of the m4 macros
- rm -rf ${B}/aclocal-copy/
- if [ x"${acpaths}" = xdefault ]; then
- acpaths=
- for i in `find ${S} -maxdepth 2 -name \*.m4|grep -v 'aclocal.m4'| \
- grep -v 'acinclude.m4' | sed -e 's,\(.*/\).*$,\1,'|sort -u`; do
- acpaths="$acpaths -I $i"
- done
- else
- acpaths="${acpaths}"
- fi
- AUTOV=`automake --version |head -n 1 |sed "s/.* //;s/\.[0-9]\+$//"`
- automake --version
- echo "AUTOV is $AUTOV"
- if [ -d ${STAGING_DATADIR_NATIVE}/aclocal-$AUTOV ]; then
- acpaths="$acpaths -I${STAGING_DATADIR_NATIVE}/aclocal-$AUTOV"
- fi
- # The aclocal directory could get modified by other processes
- # uninstalling data from the sysroot. See Yocto #861 for details.
- # We avoid this by taking a copy here and then files cannot disappear.
- if [ -d ${STAGING_DATADIR}/aclocal ]; then
- mkdir -p ${B}/aclocal-copy/
- # for scratch build this directory can be empty
- # so avoid cp's no files to copy error
- cp -r ${STAGING_DATADIR}/aclocal/. ${B}/aclocal-copy/
- acpaths="$acpaths -I ${B}/aclocal-copy/"
- fi
- # autoreconf is too shy to overwrite aclocal.m4 if it doesn't look
- # like it was auto-generated. Work around this by blowing it away
- # by hand, unless the package specifically asked not to run aclocal.
- if ! echo ${EXTRA_AUTORECONF} | grep -q "aclocal"; then
- rm -f aclocal.m4
- fi
- if [ -e configure.in ]; then
- CONFIGURE_AC=configure.in
- else
- CONFIGURE_AC=configure.ac
- fi
- if ! echo ${EXTRA_OECONF} | grep -q "\-\-disable-nls"; then
- if grep "^[[:space:]]*AM_GLIB_GNU_GETTEXT" $CONFIGURE_AC >/dev/null; then
- if grep "sed.*POTFILES" $CONFIGURE_AC >/dev/null; then
- : do nothing -- we still have an old unmodified configure.ac
- else
- bbnote Executing glib-gettextize --force --copy
- echo "no" | glib-gettextize --force --copy
- fi
- else if grep "^[[:space:]]*AM_GNU_GETTEXT" $CONFIGURE_AC >/dev/null; then
- # We'd call gettextize here if it wasn't so broken...
- cp ${STAGING_DATADIR}/gettext/config.rpath ${AUTOTOOLS_AUXDIR}/
- if [ -d ${S}/po/ -a ! -e ${S}/po/Makefile.in.in ]; then
- cp ${STAGING_DATADIR}/gettext/po/Makefile.in.in ${S}/po/
- if [ ! -e ${S}/po/remove-potcdate.sin ]; then
- cp ${STAGING_DATADIR_NATIVE}/gettext/po/remove-potcdate.sin ${S}/po/
- fi
- fi
- fi
- fi
- fi
- mkdir -p m4
- if grep "^[[:space:]]*[AI][CT]_PROG_INTLTOOL" $CONFIGURE_AC >/dev/null; then
- bbnote Executing intltoolize --copy --force --automake
- intltoolize --copy --force --automake
- fi
- bbnote Executing autoreconf --verbose --install --force ${EXTRA_AUTORECONF} $acpaths
- autoreconf -Wcross --verbose --install --force ${EXTRA_AUTORECONF} $acpaths || bbfatal "autoreconf execution failed."
- cd $olddir
- fi
- ;;
- esac
- if [ -e ${S}/configure ]; then
- oe_runconf
- else
- bbnote "nothing to configure"
- fi
-}
-
-autotools_do_install() {
- oe_runmake 'DESTDIR=${D}' install
- # Info dir listing isn't interesting at this point so remove it if it exists.
- if [ -e "${D}${infodir}/dir" ]; then
- rm -f ${D}${infodir}/dir
- fi
-}
-
-inherit siteconfig
-
-EXPORT_FUNCTIONS do_configure do_install
#@NAME: OpenVuplus
#@DESCRIPTION: Distribution configuration for OpenVuplus
-QA_LOG = "1"
+QA_LOGFILE = "${TMPDIR}/qa.log"
#USER_CLASSES += "image-prelink"
SANITY_REQUIRED_UTILITIES = "patch diffstat texi2html makeinfo svn bzip2 tar gzip gawk chrpath wget cpio sshpass"
-INHERIT += "buildhistory recipe_sanity testlab"
+INHERIT += "buildhistory recipe_sanity"
BUILDHISTORY_COMMIT = "1"
DISTRO = "vuplus"
DISTRO_NAME = "vuplus"
-DISTRO_VERSION = "2.1.0"
+DISTRO_VERSION = "3.0.0"
DISTRO_PR ?= ""
# meta/conf/distro/include/default-distrovars.inc
# package versions
PREFERRED_VERSION_pango ?= "1.28.4"
-PREFERRED_VERSION_wpa-supplicant ?= "0.7.3"
+PREFERRED_VERSION_wpa-supplicant ?= "2.1"
PREFERRED_VERSION_linux-libc-headers ?= "${LINUXLIBCVERSION}"
PREFERRED_VERSION_linux-libc-headers-nativesdk ?= "${LINUXLIBCVERSION}"
#PREFERRED_VERSION_linux-libc-headers = "3.1.1"
#PREFERRED_VERSION_linux-libc-headers-nativesdk = "3.1.1"
+PREFERRED_VERSION_orc ?= "0.4.14"
+PREFERRED_VERSION_freetype ?= "2.4.12"
+
# chang : udev_182 is not working with linux-libc-headers_2.6.31.
PREFERRED_VERSION_udev ?= "124"
PREFERRED_PROVIDERS += "virtual/${TARGET_PREFIX}gcc:gcc-cross"
PREFERRED_PROVIDERS += "virtual/${TARGET_PREFIX}g++:gcc-cross"
-LICENSE_FLAGS_WHITELIST = "commercial_gst-plugins-ugly commercial_lame commercial_libmad commercial_mpeg2dec"
+LICENSE_FLAGS_WHITELIST = "commercial_gst-plugins-ugly commercial_lame commercial_libmad commercial_mpeg2dec commercial_libav"
COMMERCIAL_AUDIO_PLUGINS ?= "gst-plugins-ugly-mad gst-plugins-ugly-mpegaudioparse"
COMMERCIAL_VIDEO_PLUGINS ?= "gst-plugins-ugly-mpeg2dec gst-plugins-ugly-mpegstream gst-plugins-bad-mpegvideoparse"
S = "${WORKDIR}/${BP}"
-inherit autotools update-rc.d
+inherit autotools-brokensep update-rc.d
do_configure_prepend () {
if [ ! -e acinclude.m4 ]; then
+++ /dev/null
-# Example hostapd build time configuration
-#
-# This file lists the configuration options that are used when building the
-# hostapd binary. All lines starting with # are ignored. Configuration option
-# lines must be commented out complete, if they are not to be included, i.e.,
-# just setting VARIABLE=n is not disabling that variable.
-#
-# This file is included in Makefile, so variables like CFLAGS and LIBS can also
-# be modified from here. In most cass, these lines should use += in order not
-# to override previous values of the variables.
-
-# Driver interface for Host AP driver
-CONFIG_DRIVER_HOSTAP=y
-
-# Driver interface for wired authenticator
-CONFIG_DRIVER_WIRED=y
-
-# Driver interface for madwifi driver
-#CONFIG_DRIVER_MADWIFI=y
-#CFLAGS += -I../../madwifi # change to the madwifi source directory
-
-# Driver interface for Prism54 driver
-CONFIG_DRIVER_PRISM54=y
-
-# Driver interface for drivers using the nl80211 kernel interface
-CONFIG_DRIVER_NL80211=y
-CONFIG_LIBNL20=y
-# driver_nl80211.c requires a rather new libnl (version 1.1) which may not be
-# shipped with your distribution yet. If that is the case, you need to build
-# newer libnl version and point the hostapd build to use it.
-#LIBNL=/usr/src/libnl
-#CFLAGS += -I$(LIBNL)/include
-#LIBS += -L$(LIBNL)/lib
-
-# Driver interface for FreeBSD net80211 layer (e.g., Atheros driver)
-#CONFIG_DRIVER_BSD=y
-#CFLAGS += -I/usr/local/include
-#LIBS += -L/usr/local/lib
-
-# Driver interface for no driver (e.g., RADIUS server only)
-#CONFIG_DRIVER_NONE=y
-
-# IEEE 802.11F/IAPP
-CONFIG_IAPP=y
-
-# WPA2/IEEE 802.11i RSN pre-authentication
-CONFIG_RSN_PREAUTH=y
-
-# PeerKey handshake for Station to Station Link (IEEE 802.11e DLS)
-CONFIG_PEERKEY=y
-
-# IEEE 802.11w (management frame protection)
-# This version is an experimental implementation based on IEEE 802.11w/D1.0
-# draft and is subject to change since the standard has not yet been finalized.
-# Driver support is also needed for IEEE 802.11w.
-#CONFIG_IEEE80211W=y
-
-# Integrated EAP server
-CONFIG_EAP=y
-
-# EAP-MD5 for the integrated EAP server
-CONFIG_EAP_MD5=y
-
-# EAP-TLS for the integrated EAP server
-CONFIG_EAP_TLS=y
-
-# EAP-MSCHAPv2 for the integrated EAP server
-CONFIG_EAP_MSCHAPV2=y
-
-# EAP-PEAP for the integrated EAP server
-CONFIG_EAP_PEAP=y
-
-# EAP-GTC for the integrated EAP server
-CONFIG_EAP_GTC=y
-
-# EAP-TTLS for the integrated EAP server
-CONFIG_EAP_TTLS=y
-
-# EAP-SIM for the integrated EAP server
-#CONFIG_EAP_SIM=y
-
-# EAP-AKA for the integrated EAP server
-#CONFIG_EAP_AKA=y
-
-# EAP-AKA' for the integrated EAP server
-# This requires CONFIG_EAP_AKA to be enabled, too.
-#CONFIG_EAP_AKA_PRIME=y
-
-# EAP-PAX for the integrated EAP server
-#CONFIG_EAP_PAX=y
-
-# EAP-PSK for the integrated EAP server (this is _not_ needed for WPA-PSK)
-#CONFIG_EAP_PSK=y
-
-# EAP-SAKE for the integrated EAP server
-#CONFIG_EAP_SAKE=y
-
-# EAP-GPSK for the integrated EAP server
-#CONFIG_EAP_GPSK=y
-# Include support for optional SHA256 cipher suite in EAP-GPSK
-#CONFIG_EAP_GPSK_SHA256=y
-
-# EAP-FAST for the integrated EAP server
-# Note: Default OpenSSL package does not include support for all the
-# functionality needed for EAP-FAST. If EAP-FAST is enabled with OpenSSL,
-# the OpenSSL library must be patched (openssl-0.9.9-session-ticket.patch)
-# to add the needed functions.
-#CONFIG_EAP_FAST=y
-
-# Wi-Fi Protected Setup (WPS)
-CONFIG_WPS=y
-# Enable UPnP support for external WPS Registrars
-#CONFIG_WPS_UPNP=y
-
-# EAP-IKEv2
-#CONFIG_EAP_IKEV2=y
-
-# Trusted Network Connect (EAP-TNC)
-#CONFIG_EAP_TNC=y
-
-# PKCS#12 (PFX) support (used to read private key and certificate file from
-# a file that usually has extension .p12 or .pfx)
-CONFIG_PKCS12=y
-
-# RADIUS authentication server. This provides access to the integrated EAP
-# server from external hosts using RADIUS.
-CONFIG_RADIUS_SERVER=y
-
-# Build IPv6 support for RADIUS operations
-CONFIG_IPV6=y
-
-# IEEE Std 802.11r-2008 (Fast BSS Transition)
-#CONFIG_IEEE80211R=y
-
-# Use the hostapd's IEEE 802.11 authentication (ACL), but without
-# the IEEE 802.11 Management capability (e.g., madwifi or FreeBSD/net80211)
-CONFIG_DRIVER_RADIUS_ACL=y
-
-# IEEE 802.11n (High Throughput) support
-CONFIG_IEEE80211N=y
-
-# Remove debugging code that is printing out debug messages to stdout.
-# This can be used to reduce the size of the hostapd considerably if debugging
-# code is not needed.
-#CONFIG_NO_STDOUT_DEBUG=y
+++ /dev/null
-#!/bin/sh
-DAEMON=/usr/sbin/hostapd
-NAME=hostapd
-DESC="HOSTAP Daemon"
-ARGS="/etc/hostapd.conf -B"
-
-test -f $DAEMON || exit 0
-
-set -e
-
-case "$1" in
- start)
- echo -n "Starting $DESC: "
- start-stop-daemon -S -x $DAEMON -- $ARGS
- echo "$NAME."
- ;;
- stop)
- echo -n "Stopping $DESC: "
- start-stop-daemon -K -x $DAEMON
- echo "$NAME."
- ;;
- restart)
- $0 stop
- $0 start
- ;;
- reload)
- echo -n "Reloading $DESC: "
- killall -HUP $(basename ${DAEMON})
- echo "$NAME."
- ;;
- *)
- echo "Usage: $0 {start|stop|restart|reload}"
- exit 1
- ;;
-esac
-
-exit 0
+++ /dev/null
-HOMEPAGE = "http://hostap.epitest.fi"
-SECTION = "kernel/userland"
-PRIORITY = "optional"
-LICENSE = "GPLv2"
-LIC_FILES_CHKSUM = "file://${WORKDIR}/hostapd-0.7.3/COPYING;md5=c54ce9345727175ff66d17b67ff51f58"
-DEPENDS = "libnl openssl"
-
-inherit update-rc.d
-INITSCRIPT_NAME="hostapd"
-
-do_configure() {
- install -m 0644 ${WORKDIR}/defconfig ${S}/.config
-}
-
-do_compile() {
- make
-}
-
-do_install() {
- install -d ${D}${sbindir} ${D}${sysconfdir}/init.d
- install -m 0755 ${S}/hostapd ${D}${sbindir}
- install -m 0755 ${S}/hostapd_cli ${D}${sbindir}
- install -m 755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/hostapd
-}
-
+++ /dev/null
-DESCRIPTION = "User space daemon for extended IEEE 802.11 management"
-
-require hostap-daemon-0.7.inc
-
-PR = "r4"
-
-DEFAULT_PREFERENCE = "-1"
-
-SRC_URI = "http://hostap.epitest.fi/releases/hostapd-${PV}.tar.gz \
- file://defconfig \
- file://init"
-SRC_URI[md5sum] = "91a7c8d0f090b7104152d3455a84c112"
-SRC_URI[sha256sum] = "31eb2781f37e1a4c27969d1594f8019c0ca87779349c099ab812833289961567"
-
-S = "${WORKDIR}/hostapd-${PV}/hostapd"
-
-
S = "${WORKDIR}/${PN}"
-inherit autotools gettext
+inherit autotools-brokensep gettext
PACKAGES =+ "${PN}-utils"
require recipes-connectivity/openssl/openssl.inc
-PR = "${INC_PR}.1"
+PR .= "-vuplus0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=f9a8f968107345e0b75aa8c2ecaa7ec8"
--- /dev/null
+DESCRIPTION = "Vuplus: W-LAN package group for the Vuplus Distribution"
+SECTION = "vuplus/base"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+PR = "r15"
+
+inherit packagegroup
+
+DEPENDS_${PN} = "enigma2"
+RDEPENDS_${PN} = "\
+ enigma2-plugin-systemplugins-wirelesslansetup \
+ wireless-tools \
+ wpa-supplicant \
+"
+
+WIFI_FIRMWARES = "\
+ rt73-firmware \
+ zd1211-firmware \
+ firmware-htc9271 \
+ firmware-rt2561 \
+ firmware-rtl8721u \
+ firmware-rt3070 \
+"
+
+KERNEL_WIFI_MODULES = " \
+ kernel-module-ath9k-htc \
+ kernel-module-carl9170 \
+ kernel-module-prism2-usb \
+ kernel-module-rt73usb \
+ kernel-module-rt2500usb \
+ kernel-module-rtl8187 \
+ kernel-module-r8712u \
+ kernel-module-w35und \
+ kernel-module-zd1211rw \
+ kernel-module-llc \
+ kernel-module-stp \
+ kernel-module-bridge \
+ kernel-module-hostap \
+ ${@base_contains('VUPLUS_FEATURES', 'ralink-kmod', 'kernel-module-rt2800usb', ' ', d)} \
+"
+
+KERNEL_WIFI_MODULES += "${@base_version_less_or_equal('VUPLUS_KERNEL_VERSION', '3.1.1', 'kernel-module-r8192u-usb', '', d)}"
+
+LEGACY_MODULES = " \
+ ${@base_contains('VUPLUS_FEATURES', 'ralink-legacy', 'rt3070', ' ', d)} \
+ r8192cu \
+"
+
+RDEPENDS_${PN}_append = "\
+ ${WIFI_FIRMWARES} \
+ ${KERNEL_WIFI_MODULES} \
+ ${LEGACY_MODULES} \
+ rt2870sta \
+"
+
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+
+++ /dev/null
-PR .= "-vuplus0"
-
-do_install_append() {
- rm ${D}/${sysconfdir}/ppp/options
- rm ${D}/${sysconfdir}/ppp/pap-secrets
-}
-
-CONFFILES_${PN} = "${sysconfdir}/ppp/chap-secrets"
--- /dev/null
+PR .= "-vuplus0"
+
+do_install_append() {
+ rm ${D}/${sysconfdir}/ppp/options
+ rm ${D}/${sysconfdir}/ppp/pap-secrets
+}
+
+CONFFILES_${PN} = "${sysconfdir}/ppp/chap-secrets"
SRC_URI = " \
file://rtl8192_8188CU_linux_v3.1.2590.20110922.tar.gz \
- file://makefile.patch;patch=1 \
- file://linux_3.1.patch;patch=1 \
+ file://makefile.patch \
+ file://linux_3.1.patch \
"
S = "${WORKDIR}/rtl8192_8188CU_linux_v${PV}"
FILES_${PN} = "${base_libdir}/firmware/"
PACKAGE_ARCH = "all"
+
+SRC_URI[md5sum] = "0612338acc553d6809fed0632ab6619d"
+SRC_URI[sha256sum] = "5e075817e70db189674ef725502b7e6ac31426b0ac6066773438cc7bb7fff930"
--- /dev/null
+SRC_URI += "file://config-lfs.patch \
+ file://quota.patch;striplevel=0 \
+ "
+
+EXTRA_OECONF += "\
+ --without-ads \
+ --without-winbind \
+ --without-ldap \
+ --without-krb5"
+
+PACKAGES =+ "libnetapi libtdb libsmbsharemodes libsmbclient libsmbclient-dev cifs cifs-doc swat"
+
+FILES_libnetapi = "${libdir}/libnetapi.so.*"
+FILES_libsmbsharemodes = "${libdir}/libsmbsharemodes.so.*"
+FILES_libtdb = "${libdir}/libtdb.so.*"
+FILES_cifs = "${base_sbindir}/mount.cifs ${base_sbindir}/umount.cifs"
+FILES_cifs-doc = "${mandir}/man8/mount.cifs.8 ${mandir}/man8/umount.cifs.8"
+FILES_libsmbclient = "${libdir}/libsmbclient.so.*"
+FILES_libsmbclient-dev = "${libdir}/libsmbclient.so ${includedir}"
+FILES_swat = "${sbindir}/swat ${datadir}/swat ${libdir}/*.msg"
--- /dev/null
+SECTION = "console/network"
+LICENSE = "GPL"
+DEPENDS = "readline virtual/libiconv talloc"
+
+SRC_URI = "http://samba.org/samba/ftp/stable/samba-${PV}.tar.gz \
+ file://volatiles.03_samba \
+ file://smb.conf \
+ file://init \
+ file://tdb.pc \
+ "
+
+S = "${WORKDIR}/samba-${PV}/source"
+
+inherit autotools-brokensep update-rc.d
+
+FILES_${PN} += "${libdir}/vfs/*.so ${libdir}/charset/*.so ${libdir}/*.dat \
+ ${libdir}/auth/*.so ${libdir}/security/*.so"
+FILES_${PN}-dbg += "${libdir}/vfs/.debug/*.so ${libdir}/charset/.debug/*.so \
+ ${libdir}/auth/.debug/*.so ${libdir}/security/.debug/*.so"
+
+SAMBAMMAP = "no"
+SAMBAMMAP_libc-glibc = "yes"
+
+# The file system settings --foodir=dirfoo and overridden unconditionally
+# in the samba config by --with-foodir=dirfoo - even if the --with is not
+# specified! Fix that here. Set the privatedir to /etc/samba/private.
+EXTRA_OECONF='--disable-cups \
+ --with-readline=${STAGING_LIBDIR}/.. \
+ --with-libiconv=${STAGING_LIBDIR}/.. \
+ --without-automount \
+ --with-configdir=${sysconfdir}/samba \
+ --with-privatedir=${sysconfdir}/samba/private \
+ --with-lockdir=${localstatedir}/lock \
+ --with-piddir=${localstatedir}/run \
+ --with-logfilebase=${localstatedir}/log \
+ --with-libdir=${libdir} \
+ --with-mandir=${mandir} \
+ --with-swatdir=${datadir}/swat \
+ --with-aio-support \
+ --without-libtalloc \
+ samba_cv_struct_timespec=yes \
+ libreplace_cv_HAVE_MMAP=${SAMBAMMAP}'
+
+INITSCRIPT_NAME = "samba"
+# No dependencies, goes in at level 20 (NOTE: take care with the
+# level, later levels put the shutdown later too - see the links
+# in rc6.d, the shutdown must precede network shutdown).
+INITSCRIPT_PARAMS = "defaults"
+CONFFILES_${PN} = "${sysconfdir}/samba/smb.conf"
+
+do_configure_prepend () {
+ ./script/mkversion.sh
+ if [ ! -e acinclude.m4 ]; then
+ touch aclocal.m4
+ cat aclocal.m4 > acinclude.m4
+ fi
+}
+
+do_compile () {
+ oe_runmake proto_exists
+ base_do_compile
+}
+
+do_install_append() {
+ install -d ${D}${libdir}/pkgconfig/
+ cp ${WORKDIR}/tdb.pc ${D}${libdir}/pkgconfig/
+ mv ${D}${libdir}/libsmbclient.so ${D}${libdir}/libsmbclient.so.0 || true
+ ln -sf libsmbclient.so.0 ${D}${libdir}/libsmbclient.so
+ mkdir -p ${D}${base_sbindir}
+ rm -f ${D}${bindir}/*.old
+ rm -f ${D}${sbindir}/*.old
+ [ -f ${D}${sbindir}/mount.cifs ] && mv ${D}${sbindir}/mount.cifs ${D}${base_sbindir}/
+ [ -f ${D}${sbindir}/umount.cifs ] && mv ${D}${sbindir}/umount.cifs ${D}${base_sbindir}/
+
+ # This is needed for < 3.2.4
+ rm -f ${D}${sbindir}/mount.smbfs ${D}${base_sbindir}/mount.smbfs
+ if [ -f ${D}${bindir}/smbmount ]; then
+ ln -sf ${bindir}/smbmount ${D}${base_sbindir}/mount.smb
+ ln -sf ${bindir}/smbmount ${D}${base_sbindir}/mount.smbfs
+ fi
+
+ install -D -m 755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/samba
+ install -D -m 644 ${WORKDIR}/smb.conf ${D}${sysconfdir}/samba/smb.conf
+ install -D -m 644 ${WORKDIR}/volatiles.03_samba ${D}${sysconfdir}/default/volatiles/volatiles.03_samba
+ install -d ${D}/var/log/samba
+ install -d ${D}/var/spool/samba
+ rmdir ${D}/var/run
+}
+
-require recipes-connectivity/samba/samba.inc
-require recipes-connectivity/samba/samba-basic.inc
+require samba.inc
+require samba-basic.inc
LICENSE = "GPLv2+"
LIC_FILES_CHKSUM = "file://../COPYING;md5=8ca43cbc842c2336e835926c2166c28b"
PR = "r2"
-PR .= "-vuplus3"
+PR .= "-vuplus0"
SRC_URI += " \
file://01samba-kill \
+++ /dev/null
-DESCRIPTION = "Vuplus: W-LAN Task for the Vuplus Distribution"
-SECTION = "vuplus/base"
-LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
-PR = "r15"
-
-inherit task
-
-DEPENDS_${PN} = "enigma2-plugins"
-RDEPENDS_${PN} = "\
- ${@base_contains("VUPLUS_FEATURES", "vuwlan", "enigma2-plugin-systemplugins-wirelesslansetup", "enigma2-plugin-systemplugins-wirelesslan", d)} \
- wireless-tools \
- wpa-supplicant \
-"
-
-WIFI_FIRMWARES = "\
- rt73-firmware \
- zd1211-firmware \
- firmware-htc9271 \
- firmware-rt2561 \
- firmware-rtl8721u \
- firmware-rt3070 \
-"
-
-KERNEL_WIFI_MODULES = " \
- kernel-module-ath9k-htc \
- kernel-module-carl9170 \
- kernel-module-prism2-usb \
- kernel-module-rt73usb \
- kernel-module-rt2500usb \
- kernel-module-rtl8187 \
- kernel-module-r8712u \
- kernel-module-w35und \
- kernel-module-zd1211rw \
- kernel-module-llc \
- kernel-module-stp \
- kernel-module-bridge \
- kernel-module-hostap \
- ${@base_contains('VUPLUS_FEATURES', 'ralink-kmod', 'kernel-module-rt2800usb', ' ', d)} \
-"
-
-KERNEL_WIFI_MODULES += "${@base_version_less_or_equal('VUPLUS_KERNEL_VERSION', '3.1.1', 'kernel-module-r8192u-usb', '', d)}"
-
-LEGACY_MODULES = " \
- ${@base_contains('VUPLUS_FEATURES', 'ralink-legacy', 'rt3070', ' ', d)} \
- r8192cu \
-"
-
-RDEPENDS_${PN}_append = "\
- ${WIFI_FIRMWARES} \
- ${KERNEL_WIFI_MODULES} \
- ${LEGACY_MODULES} \
- rt2870sta \
-"
-
-PACKAGE_ARCH = "${MACHINE_ARCH}"
-
inherit allarch
SRC_URI = "http://www.draisberghof.de/usb_modeswitch/usb-modeswitch-data-${PV}.tar.bz2 \
- file://usb-modeswitch-data_20120215.patch;patch=1;pnum=1 \
+ file://usb-modeswitch-data_20120215.patch \
"
do_install() {
+++ /dev/null
-#!/bin/sh
-
-# Action script to enable/disable wpa-roam interfaces in reaction to
-# ifplugd events.
-#
-# Copyright: Copyright (c) 2008-2010, Kel Modderman <kel@otaku42.de>
-# License: GPL-2
-#
-
-PATH=/sbin:/usr/sbin:/bin:/usr/bin
-
-if [ ! -x /usr/sbin/wpa_action ]; then
- exit 0
-fi
-
-# ifplugd(8) - <iface> <action>
-#
-# If an ifplugd managed interface is brought up, disconnect any
-# wpa-roam managed interfaces so that only one "roaming" interface
-# remains active on the system.
-
-IFPLUGD_IFACE="${1}"
-
-case "${2}" in
- up)
- COMMAND=disconnect
- ;;
- down)
- COMMAND=reconnect
- ;;
- *)
- echo "$0: unknown arguments: ${@}" >&2
- exit 1
- ;;
-esac
-
-for CTRL in /var/run/wpa_supplicant/*; do
- [ -S "${CTRL}" ] || continue
-
- IFACE="${CTRL#/var/run/wpa_supplicant/}"
-
- # skip if ifplugd is managing this interface
- if [ "${IFPLUGD_IFACE}" = "${IFACE}" ]; then
- continue
- fi
-
- if wpa_action "${IFACE}" check; then
- wpa_cli -i "${IFACE}" "${COMMAND}"
- fi
-done
+++ /dev/null
-#!/bin/sh
-
-#####################################################################
-## Purpose
-# This file contains common shell functions used by scripts of the
-# wpasupplicant package to allow ifupdown to manage wpa_supplicant.
-# It also contains some functions used by wpa_action(8) that allow
-# ifupdown to be managed by wpa_cli(8) action events.
-#
-# This file is provided by the wpasupplicant package.
-
-#####################################################################
-# Copyright (C) 2006 - 2009 Debian/Ubuntu wpasupplicant Maintainers
-# <pkg-wpa-devel@lists.alioth.debian.org>
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# On Debian GNU/Linux systems, the text of the GPL license,
-# version 2, can be found in /usr/share/common-licenses/GPL-2.
-
-#####################################################################
-## global variables
-# wpa_supplicant variables
-WPA_SUP_BIN="/usr/sbin/wpa_supplicant"
-WPA_SUP_PNAME="wpa_supplicant"
-WPA_SUP_PIDFILE="/var/run/wpa_supplicant.${WPA_IFACE}.pid"
-
-# wpa_cli variables
-WPA_CLI_BIN="/usr/sbin/wpa_cli"
-WPA_CLI_PNAME="wpa_cli"
-WPA_CLI_PIDFILE="/var/run/wpa_action.${WPA_IFACE}.pid"
-WPA_CLI_TIMESTAMP="/var/run/wpa_action.${WPA_IFACE}.timestamp"
-WPA_CLI_IFUPDOWN="/var/run/wpa_action.${WPA_IFACE}.ifupdown"
-
-# sendsigs omission interface, present in initscripts (>= 2.86.ds1-48)
-if [ -d /lib/init/rw/sendsigs.omit.d/ ]; then
- # Debian
- WPA_SUP_OMIT_PIDFILE="/lib/init/rw/sendsigs.omit.d/wpasupplicant.wpa_supplicant.${WPA_IFACE}.pid"
-elif [ -d /var/run/sendsigs.omit.d/ ]; then
- # Ubuntu, see https://launchpad.net/bugs/181541 for status
- WPA_SUP_OMIT_PIDFILE="/var/run/sendsigs.omit.d/wpasupplicant.wpa_supplicant.${WPA_IFACE}.pid"
-else
- WPA_SUP_OMIT_PIDFILE=
-fi
-
-# default ctrl_interface socket directory
-if [ -z "$WPA_CTRL_DIR" ]; then
- WPA_CTRL_DIR="/var/run/wpa_supplicant"
-fi
-
-# verbosity variables
-if [ -n "$IF_WPA_VERBOSITY" ] || [ "$VERBOSITY" = "1" ]; then
- TO_NULL="/dev/stdout"
- DAEMON_VERBOSITY="--verbose"
-else
- TO_NULL="/dev/null"
- DAEMON_VERBOSITY="--quiet"
-fi
-
-#####################################################################
-## wpa_cli wrapper
-# Path to common ctrl_interface socket and iface supplied.
-# NB: WPA_CTRL_DIR cannot be used for interactive commands, it is
-# set only in the environment that wpa_cli provides when processing
-# action events.
-#
-wpa_cli () {
- "$WPA_CLI_BIN" -p "$WPA_CTRL_DIR" -i "$WPA_IFACE" "$@"
-
- return "$?"
-}
-
-#####################################################################
-## verbose and stderr message wrapper
-# Ensures a standard and easily identifiable message is printed by
-# scripts using this function library.
-#
-# log Log a message to syslog when called non-interactively
-# by wpa_action
-#
-# verbose To stdout when IF_WPA_VERBOSITY or VERBOSITY is true
-#
-# action Same as verbose but without newline
-# Useful for allowing wpa_cli commands to echo result
-# value of 'OK' or 'FAILED'
-#
-# stderr Echo warning or error messages to stderr
-#
-# NB: when called by wpa_action, there is no redirection (verbose)
-#
-wpa_msg () {
- if [ "$1" = "log" ]; then
- shift
- case "$WPA_ACTION" in
- "CONNECTED"|"DISCONNECTED")
- [ -x /usr/bin/logger ] || return
- if [ "$#" -gt 0 ]; then
- logger -t "wpa_action" "$@"
- else
- logger -t "wpa_action"
- fi
- ;;
- *)
- [ "$#" -gt 0 ] && echo "wpa_action: $@"
- ;;
- esac
- return
- fi
-
- case "$1" in
- "verbose")
- shift
- echo "$WPA_SUP_PNAME: $@" >$TO_NULL
- ;;
- "action")
- shift
- echo -n "$WPA_SUP_PNAME: $@ -- " >$TO_NULL
- ;;
- "stderr")
- shift
- echo "$WPA_SUP_PNAME: $@" >/dev/stderr
- ;;
- *)
- ;;
- esac
-}
-
-#####################################################################
-## validate daemon pid files
-# Test daemon process ID files via start-stop-daemon with a signal 0
-# given the exec binary and pidfile location.
-#
-# $1 daemon
-# $2 pidfile
-#
-# Returns true when pidfile exists, the process ID exists _and_ was
-# created by the exec binary.
-#
-# If the test fails, but the pidfile exists, it is stale
-#
-test_daemon_pidfile () {
- local DAEMON
- local PIDFILE
-
- if [ -n "$1" ]; then
- DAEMON="$1"
- fi
-
- if [ -f "$2" ]; then
- PIDFILE="$2"
- fi
-
- if [ -n "$DAEMON" ] && [ -f "$PIDFILE" ]; then
- if start-stop-daemon --stop --quiet --signal 0 \
- --exec "$DAEMON" --pidfile "$PIDFILE"; then
- return 0
- else
- rm -f "$PIDFILE"
- return 1
- fi
- else
- return 1
- fi
-}
-
-# validate wpa_supplicant pidfile
-test_wpa_supplicant () {
- test_daemon_pidfile "$WPA_SUP_BIN" "$WPA_SUP_PIDFILE"
-}
-
-# validate wpa_cli pidfile
-test_wpa_cli () {
- test_daemon_pidfile "$WPA_CLI_BIN" "$WPA_CLI_PIDFILE"
-}
-
-#####################################################################
-## daemonize wpa_supplicant
-# Start wpa_supplicant via start-stop-dameon with all required
-# options. Will start if environment variable WPA_SUP_CONF is present
-#
-# Default options:
-# -B dameonize/background process
-# -D driver backend ('wext' if none given)
-# -P process ID file
-# -C path to ctrl_interface socket directory
-# -s log to syslog
-#
-# Conditional options:
-# -c configuration file
-# -W wait for wpa_cli to attach to ctrl_interface socket
-# -b bridge interface name
-# -f path to log file
-#
-init_wpa_supplicant () {
- [ -n "$WPA_SUP_CONF" ] || return 0
-
- local WPA_SUP_OPTIONS
- WPA_SUP_OPTIONS="-s -B -P $WPA_SUP_PIDFILE -i $WPA_IFACE"
-
- if [ -n "$WPA_ACTION_SCRIPT" ]; then
- if [ -x "$WPA_ACTION_SCRIPT" ]; then
- WPA_SUP_OPTIONS="$WPA_SUP_OPTIONS -W"
- wpa_msg verbose "wait for wpa_cli to attach"
- else
- wpa_msg stderr "action script \"$WPA_ACTION_SCRIPT\" not executable"
- return 1
- fi
- fi
-
- if [ -n "$IF_WPA_BRIDGE" ]; then
- WPA_SUP_OPTIONS="$WPA_SUP_OPTIONS -b $IF_WPA_BRIDGE"
- wpa_msg verbose "wpa-bridge $IF_WPA_BRIDGE"
- fi
-
- if [ -n "$IF_WPA_DRIVER" ]; then
- wpa_msg verbose "wpa-driver $IF_WPA_DRIVER"
- case "$IF_WPA_DRIVER" in
- hostap|ipw|madwifi|ndiswrapper)
- WPA_SUP_OPTIONS="$WPA_SUP_OPTIONS -D nl80211,wext"
- wpa_msg stderr "\"$IF_WPA_DRIVER\" wpa-driver is unsupported"
- wpa_msg stderr "using \"nl80211,wext\" wpa-driver instead ..."
- ;;
- *)
- WPA_SUP_OPTIONS="$WPA_SUP_OPTIONS -D $IF_WPA_DRIVER"
- ;;
- esac
- else
- WPA_SUP_OPTIONS="$WPA_SUP_OPTIONS -D nl80211,wext"
- wpa_msg verbose "wpa-driver nl80211,wext (default)"
- fi
-
- if [ -n "$IF_WPA_DEBUG_LEVEL" ]; then
- case "$IF_WPA_DEBUG_LEVEL" in
- 3)
- WPA_SUP_OPTIONS="$WPA_SUP_OPTIONS -t -ddd"
- ;;
- 2)
- WPA_SUP_OPTIONS="$WPA_SUP_OPTIONS -t -dd"
- ;;
- 1)
- WPA_SUP_OPTIONS="$WPA_SUP_OPTIONS -t -d"
- ;;
- 0)
- # wpa_supplicant default verbosity
- ;;
- -1)
- WPA_SUP_OPTIONS="$WPA_SUP_OPTIONS -q"
- ;;
- -2)
- WPA_SUP_OPTIONS="$WPA_SUP_OPTIONS -qq"
- ;;
- esac
- wpa_msg verbose "using debug level: $IF_WPA_DEBUG_LEVEL"
- fi
-
- if [ -n "$IF_WPA_LOGFILE" ]; then
- # custom log file
- WPA_SUP_OPTIONS="$WPA_SUP_OPTIONS -f $IF_WPA_LOGFILE"
- WPA_SUP_LOGFILE="$IF_WPA_LOGFILE"
- wpa_msg verbose "logging to $IF_WPA_LOGFILE"
- fi
-
- wpa_msg verbose "$WPA_SUP_BIN $WPA_SUP_OPTIONS $WPA_SUP_CONF"
-
- start-stop-daemon --start --oknodo $DAEMON_VERBOSITY \
- --name $WPA_SUP_PNAME --startas $WPA_SUP_BIN --pidfile $WPA_SUP_PIDFILE \
- -- $WPA_SUP_OPTIONS $WPA_SUP_CONF
-
- if [ "$?" -ne 0 ]; then
- wpa_msg stderr "$WPA_SUP_BIN daemon failed to start"
- return 1
- fi
-
- if [ -n "$WPA_SUP_OMIT_PIDFILE" ]; then
- local WPA_PIDFILE_WAIT
- local MAX_WPA_PIDFILE_WAIT
- WPA_PIDFILE_WAIT="0"
- MAX_WPA_PIDFILE_WAIT="5"
- until [ -s "$WPA_SUP_PIDFILE" ]; do
- if [ "$WPA_PIDFILE_WAIT" -ge "$MAX_WPA_PIDFILE_WAIT" ]; then
- wpa_msg stderr "timed out waiting for creation of $WPA_SUP_PIDFILE"
- return 1
- else
- wpa_msg verbose "waiting for \"$WPA_SUP_PIDFILE\": " \
- "$WPA_PIDFILE_WAIT (max. $MAX_WPA_PIDFILE_WAIT)"
- fi
-
- WPA_PIDFILE_WAIT=$(($WPA_PIDFILE_WAIT + 1))
- sleep 1
- done
- wpa_msg verbose "creating sendsigs omission pidfile: $WPA_SUP_OMIT_PIDFILE"
- cat "$WPA_SUP_PIDFILE" > "$WPA_SUP_OMIT_PIDFILE"
- else
- wpa_msg verbose "sendsigs omission pidfile not created"
- fi
-
- local WPA_SOCKET_WAIT
- local MAX_WPA_SOCKET_WAIT
- WPA_SOCKET_WAIT="0"
- MAX_WPA_SOCKET_WAIT="5"
- until [ -S "$WPA_CTRL_DIR/$WPA_IFACE" ]; do
- if [ "$WPA_SOCKET_WAIT" -ge "$MAX_WPA_SOCKET_WAIT" ]; then
- wpa_msg stderr "ctrl_interface socket not found at $WPA_CTRL_DIR/$WPA_IFACE"
- return 1
- else
- wpa_msg verbose "waiting for \"$WPA_CTRL_DIR/$WPA_IFACE\": " \
- "$WPA_SOCKET_WAIT (max. $MAX_WPA_SOCKET_WAIT)"
- fi
-
- WPA_SOCKET_WAIT=$(($WPA_SOCKET_WAIT + 1))
- sleep 1
- done
-
- wpa_msg verbose "ctrl_interface socket located at $WPA_CTRL_DIR/$WPA_IFACE"
-}
-
-#####################################################################
-## stop wpa_supplicant process
-# Kill wpa_supplicant via start-stop-daemon, given the location of
-# the pidfile or ctrl_interface socket path and interface name
-#
-kill_wpa_supplicant () {
- test_wpa_supplicant || return 0
-
- wpa_msg verbose "terminating $WPA_SUP_PNAME daemon via pidfile $WPA_SUP_PIDFILE"
-
- start-stop-daemon --stop --oknodo $DAEMON_VERBOSITY \
- --exec $WPA_SUP_BIN --pidfile $WPA_SUP_PIDFILE
-
- if [ -f "$WPA_SUP_PIDFILE" ]; then
- rm -f "$WPA_SUP_PIDFILE"
- fi
-
- if [ -f "$WPA_SUP_OMIT_PIDFILE" ]; then
- wpa_msg verbose "removing $WPA_SUP_OMIT_PIDFILE"
- rm -f "$WPA_SUP_OMIT_PIDFILE"
- fi
-}
-
-#####################################################################
-## reload wpa_supplicant process
-# Sending a HUP signal causes wpa_supplicant to reparse its
-# configuration file
-#
-reload_wpa_supplicant () {
- if test_wpa_supplicant; then
- wpa_msg verbose "reloading wpa_supplicant configuration file via HUP signal"
- start-stop-daemon --stop --signal HUP \
- --name "$WPA_SUP_PNAME" --pidfile "$WPA_SUP_PIDFILE"
- else
- wpa_msg verbose "cannot $WPA_ACTION, $WPA_SUP_PIDFILE does not exist"
- fi
-}
-
-#####################################################################
-## daemonize wpa_cli and action script
-# If environment variable WPA_ACTION_SCRIPT is present, wpa_cli will
-# be spawned via start-stop-daemon
-#
-# Required options:
-# -a action script => wpa_action
-# -P process ID file
-# -B background process
-#
-init_wpa_cli () {
- [ -n "$WPA_ACTION_SCRIPT" ] || return 0
-
- local WPA_CLI_OPTIONS
- WPA_CLI_OPTIONS="-B -P $WPA_CLI_PIDFILE -i $WPA_IFACE"
-
- wpa_msg verbose "$WPA_CLI_BIN $WPA_CLI_OPTIONS -p $WPA_CTRL_DIR -a $WPA_ACTION_SCRIPT"
-
- start-stop-daemon --start --oknodo $DAEMON_VERBOSITY \
- --name $WPA_CLI_PNAME --startas $WPA_CLI_BIN --pidfile $WPA_CLI_PIDFILE \
- -- $WPA_CLI_OPTIONS -p $WPA_CTRL_DIR -a $WPA_ACTION_SCRIPT
-
- if [ "$?" -ne 0 ]; then
- wpa_msg stderr "$WPA_CLI_BIN daemon failed to start"
- return 1
- fi
-}
-
-#####################################################################
-## stop wpa_cli process
-# Kill wpa_cli via start-stop-daemon, given the location of the
-# pidfile
-#
-kill_wpa_cli () {
- test_wpa_cli || return 0
-
- wpa_msg verbose "terminating $WPA_CLI_PNAME daemon via pidfile $WPA_CLI_PIDFILE"
-
- start-stop-daemon --stop --oknodo $DAEMON_VERBOSITY \
- --exec $WPA_CLI_BIN --pidfile $WPA_CLI_PIDFILE
-
- if [ -f "$WPA_CLI_PIDFILE" ]; then
- rm -f "$WPA_CLI_PIDFILE"
- fi
-
- if [ -f "$WPA_CLI_TIMESTAMP" ]; then
- rm -f "$WPA_CLI_TIMESTAMP"
- fi
-
- if [ -L "$WPA_CLI_IFUPDOWN" ]; then
- rm -f "$WPA_CLI_IFUPDOWN"
- fi
-}
-
-#####################################################################
-## higher level wpa_cli wrapper for variable and set_network commands
-# wpa_cli_do <value> <type> <variable> [set_network variable] <desc>
-#
-# $1 envorinment variable
-# $2 data type of variable {raw|ascii}
-# $3 wpa_cli variable, if $3 is set_network, shift and take
-# set_network subvariable
-# $4 wpa-* string as it would appear in interfaces file, enhances
-# verbose messages
-#
-wpa_cli_do () {
- if [ -z "$1" ]; then
- return 0
- fi
-
- local WPACLISET_VALUE
- local WPACLISET_VARIABLE
- local WPACLISET_DESC
-
- case "$2" in
- ascii)
- # Double quote
- WPACLISET_VALUE="\"$1\""
- ;;
- raw|*)
- # Provide raw value
- WPACLISET_VALUE="$1"
- ;;
- esac
-
- case "$3" in
- set_network)
- if [ -z "$WPA_ID" ]; then
- return 1
- fi
- shift
- WPACLISET_VARIABLE="set_network $WPA_ID $3"
- ;;
- *)
- WPACLISET_VARIABLE="$3"
- ;;
- esac
-
- case "$4" in
- *-psk|*-passphrase|*-passwd*|*-wep-key*)
- WPACLISET_DESC="$4 *****"
- ;;
- *)
- WPACLISET_DESC="$4 $WPACLISET_VALUE"
- ;;
- esac
-
- wpa_msg action "$WPACLISET_DESC"
-
- wpa_cli $WPACLISET_VARIABLE "$WPACLISET_VALUE" >$TO_NULL
-
- if [ "$?" -ne 0 ]; then
- wpa_msg stderr "$WPACLISET_DESC failed!"
- fi
-}
-
-#####################################################################
-## check value data type in plaintext or hex
-# returns 0 if input consists of hexadecimal digits only, 1 otherwise
-#
-ishex () {
- if [ -z "$1" ]; then
- return 0
- fi
-
- case "$1" in
- *[!0-9a-fA-F]*)
- # plaintext
- return 1
- ;;
- *)
- # hexadecimal
- return 0
- ;;
- esac
-}
-
-#####################################################################
-## sanity check and set psk|passphrase
-# Warn about strange psk|passphrase values
-#
-# $1 psk or passphrase value
-#
-# If psk is surrounded by quotes strip them.
-#
-# If psk contains all hexadecimal characters and string length is 64:
-# is 256bit hexadecimal
-# else:
-# is plaintext
-#
-# plaintext passphrases must be 8 - 63 characters in length
-# 256-bit hexadecimal key must be 64 characters in length
-#
-wpa_key_check_and_set () {
- if [ "$#" -ne 3 ]; then
- return 0
- fi
-
- local KEY
- local KEY_LEN
- local KEY_TYPE
- local ENC_TYPE
-
- case "$1" in
- '"'*'"')
- # Strip surrounding quotation marks
- KEY=$(echo -n "$1" | sed 's/^"//;s/"$//')
- ;;
- *)
- KEY="$1"
- ;;
- esac
-
- KEY_LEN="${#KEY}"
-
- case "$2" in
- wep_key*)
- ENC_TYPE="WEP"
- ;;
- psk)
- ENC_TYPE="WPA"
- ;;
- *)
- return 0
- ;;
- esac
-
- if [ "$ENC_TYPE" = "WEP" ]; then
- if ishex "$KEY"; then
- case "$KEY_LEN" in
- 10|26|32|58)
- # 64/128/152/256-bit WEP
- KEY_TYPE="raw"
- ;;
- *)
- KEY_TYPE="ascii"
- ;;
- esac
- else
- KEY_TYPE="ascii"
- fi
-
- if [ "$KEY_TYPE" = "ascii" ]; then
- if [ "$KEY_LEN" -lt "5" ]; then
- wpa_msg stderr "WARNING: plaintext or ascii WEP key has $KEY_LEN characters,"
- wpa_msg stderr "it must have at least 5 to be valid."
- fi
- fi
- elif [ "$ENC_TYPE" = "WPA" ]; then
- if ishex "$KEY"; then
- case "$KEY_LEN" in
- 64)
- # 256-bit WPA
- KEY_TYPE="raw"
- ;;
- *)
- KEY_TYPE="ascii"
- ;;
- esac
- else
- KEY_TYPE="ascii"
- fi
-
- if [ "$KEY_TYPE" = "ascii" ]; then
- if [ "$KEY_LEN" -lt "8" ] || [ "$KEY_LEN" -gt "63" ]; then
- wpa_msg stderr "WARNING: plaintext or ascii WPA key has $KEY_LEN characters,"
- wpa_msg stderr "it must have between 8 and 63 to be valid."
- wpa_msg stderr "If the WPA key is a 256-bit hexadecimal key, it must have"
- wpa_msg stderr "exactly 64 characters."
- fi
- fi
- fi
-
- wpa_cli_do "$KEY" "$KEY_TYPE" set_network "$2" "$3"
-}
-
-#####################################################################
-## formulate a usable configuration from interfaces(5) wpa- lines
-# A series of wpa_cli commands corresponding to environment variables
-# created as a result of wpa- lines in an interfaces stanza.
-#
-# NB: no-act when roaming daemon is used (to avoid prematurely
-# attaching to ctrl_interface socket)
-#
-conf_wpa_supplicant () {
- if [ -n "$WPA_ACTION_SCRIPT" ]; then
- return 0
- fi
-
- if [ "$IF_WPA_DRIVER" = "wired" ]; then
- IF_WPA_AP_SCAN="0"
- wpa_msg verbose "forcing ap_scan=0 (required for wired IEEE8021X auth)"
- fi
-
- if [ -n "$IF_WPA_ESSID" ]; then
- # #403316, be similar to wireless tools
- IF_WPA_SSID="$IF_WPA_ESSID"
- fi
-
- wpa_cli_do "$IF_WPA_AP_SCAN" raw \
- ap_scan wpa-ap-scan
-
- wpa_cli_do "$IF_WPA_PREAUTHENTICATE" raw \
- preauthenticate wpa-preauthenticate
-
- if [ -n "$IF_WPA_SSID" ] || [ "$IF_WPA_DRIVER" = "wired" ] || \
- [ -n "$IF_WPA_KEY_MGMT" ]; then
-
- case "$IF_WPA_SSID" in
- '"'*'"')
- IF_WPA_SSID=$(echo -n "$IF_WPA_SSID" | sed 's/^"//;s/"$//')
- ;;
- *)
- ;;
- esac
-
- WPA_ID=$(wpa_cli add_network)
-
- wpa_msg verbose "configuring network block -- $WPA_ID"
-
- wpa_cli_do "$IF_WPA_SSID" ascii \
- set_network ssid wpa-ssid
-
- wpa_cli_do "$IF_WPA_PRIORITY" raw \
- set_network priority wpa-priority
-
- wpa_cli_do "$IF_WPA_BSSID" raw \
- set_network bssid wpa-bssid
-
- if [ -s "$IF_WPA_PSK_FILE" ]; then
- IF_WPA_PSK=$(cat "$IF_WPA_PSK_FILE")
- fi
-
- # remain compat with wpa-passphrase-file
- if [ -s "$IF_WPA_PASSPHRASE_FILE" ]; then
- IF_WPA_PSK=$(cat "$IF_WPA_PASSPHRASE_FILE")
- fi
-
- # remain compat with wpa-passphrase
- if [ -n "$IF_WPA_PASSPHRASE" ]; then
- IF_WPA_PSK="$IF_WPA_PASSPHRASE"
- fi
-
- if [ -n "$IF_WPA_PSK" ]; then
- wpa_key_check_and_set "$IF_WPA_PSK" \
- psk wpa-psk
- fi
-
- wpa_cli_do "$IF_WPA_PAIRWISE" raw \
- set_network pairwise wpa-pairwise
-
- wpa_cli_do "$IF_WPA_GROUP" raw \
- set_network group wpa-group
-
- wpa_cli_do "$IF_WPA_MODE" raw \
- set_network mode wpa-mode
-
- wpa_cli_do "$IF_WPA_FREQUENCY" raw \
- set_network frequency wpa-frequency
-
- wpa_cli_do "$IF_WPA_SCAN_FREQ" raw \
- set_network scan_freq wpa-scan-freq
-
- wpa_cli_do "$IF_WPA_FREQ_LIST" raw \
- set_network freq_list wpa-freq-list
-
- wpa_cli_do "$IF_WPA_KEY_MGMT" raw \
- set_network key_mgmt wpa-key-mgmt
-
- wpa_cli_do "$IF_WPA_PROTO" raw \
- set_network proto wpa-proto
-
- wpa_cli_do "$IF_WPA_AUTH_ALG" raw \
- set_network auth_alg wpa-auth-alg
-
- wpa_cli_do "$IF_WPA_SCAN_SSID" raw \
- set_network scan_ssid wpa-scan-ssid
-
- wpa_cli_do "$IF_WPA_IDENTITY" ascii \
- set_network identity wpa-identity
-
- wpa_cli_do "$IF_WPA_ANONYMOUS_IDENTITY" ascii \
- set_network anonymous_identity wpa-anonymous-identity
-
- wpa_cli_do "$IF_WPA_EAP" raw \
- set_network eap wpa-eap
-
- wpa_cli_do "$IF_WPA_EAPPSK" raw \
- set_network eappsk wpa-eappsk
-
- wpa_cli_do "$IF_WPA_NAI" ascii \
- set_network nai wpa-nai
-
- wpa_cli_do "$IF_WPA_PASSWORD" ascii \
- set_network password wpa-password
-
- wpa_cli_do "$IF_WPA_CA_CERT" ascii \
- set_network ca_cert wpa-ca-cert
-
- wpa_cli_do "$IF_WPA_CA_PATH" ascii \
- set_network ca_path wpa-ca-path
-
- wpa_cli_do "$IF_WPA_CLIENT_CERT" ascii \
- set_network client_cert wpa-client-cert
-
- wpa_cli_do "$IF_WPA_PRIVATE_KEY" ascii \
- set_network private_key wpa-private-key
-
- wpa_cli_do "$IF_WPA_PRIVATE_KEY_PASSWD" ascii \
- set_network private_key_passwd wpa-private-key-passwd
-
- wpa_cli_do "$IF_WPA_DH_FILE" ascii \
- set_network dh_file wpa-dh-file
-
- wpa_cli_do "$IF_WPA_SUBJECT_MATCH" ascii \
- set_network subject_match wpa-subject-match
-
- wpa_cli_do "$IF_WPA_ALTSUBJECT_MATCH" ascii \
- set_network altsubject_match wpa-altsubject-match
-
- wpa_cli_do "$IF_WPA_CA_CERT2" ascii \
- set_network ca_cert2 wpa-ca-cert2
-
- wpa_cli_do "$IF_WPA_CA_PATH2" ascii \
- set_network ca_path2 wpa-ca-path2
-
- wpa_cli_do "$IF_WPA_CLIENT_CERT2" ascii \
- set_network client_cert2 wpa-client-cert2
-
- wpa_cli_do "$IF_WPA_PRIVATE_KEY2" ascii \
- set_network private_key2 wpa-private-key2
-
- wpa_cli_do "$IF_WPA_PRIVATE_KEY_PASSWD2" ascii \
- set_network private_key_passwd2 wpa-private-key-passwd2
-
- wpa_cli_do "$IF_WPA_DH_FILE2" ascii \
- set_network dh_file2 wpa-dh-file2
-
- wpa_cli_do "$IF_WPA_SUBJECT_MATCH2" ascii \
- set_network subject_match2 wpa-subject-match2
-
- wpa_cli_do "$IF_WPA_ALTSUBJECT_MATCH2" ascii \
- set_network altsubject_match2 wpa-altsubject-match2
-
- wpa_cli_do "$IF_WPA_EAP_METHODS" raw \
- set_network eap_methods wpa-eap-methods
-
- wpa_cli_do "$IF_WPA_PHASE1" ascii \
- set_network phase1 wpa-phase1
-
- wpa_cli_do "$IF_WPA_PHASE2" ascii \
- set_network phase2 wpa-phase2
-
- wpa_cli_do "$IF_WPA_PCSC" raw \
- set_network pcsc wpa-pcsc
-
- wpa_cli_do "$IF_WPA_PIN" ascii \
- set_network pin wpa-pin
-
- wpa_cli_do "$IF_WPA_ENGINE" raw \
- set_network engine wpa-engine
-
- wpa_cli_do "$IF_WPA_ENGINE_ID" ascii \
- set_network engine_id wpa-engine-id
-
- wpa_cli_do "$IF_WPA_KEY_ID" ascii \
- set_network key_id wpa-key-id
-
- wpa_cli_do "$IF_WPA_EAPOL_FLAGS" raw \
- set_network eapol_flags wpa-eapol-flags
-
- if [ -n "$IF_WPA_WEP_KEY0" ]; then
- wpa_key_check_and_set "$IF_WPA_WEP_KEY0" \
- wep_key0 wpa-wep-key0
- fi
-
- if [ -n "$IF_WPA_WEP_KEY1" ]; then
- wpa_key_check_and_set "$IF_WPA_WEP_KEY1" \
- wep_key1 wpa-wep-key1
- fi
-
- if [ -n "$IF_WPA_WEP_KEY2" ]; then
- wpa_key_check_and_set "$IF_WPA_WEP_KEY2" \
- wep_key2 wpa-wep-key2
- fi
-
- if [ -n "$IF_WPA_WEP_KEY3" ]; then
- wpa_key_check_and_set "$IF_WPA_WEP_KEY3" \
- wep_key3 wpa-wep-key3
- fi
-
- wpa_cli_do "$IF_WPA_WEP_TX_KEYIDX" raw \
- set_network wep_tx_keyidx wpa-wep-tx-keyidx
-
- wpa_cli_do "$IF_WPA_PROACTIVE_KEY_CACHING" raw \
- set_network proactive_key_caching wpa-proactive-key-caching
-
- wpa_cli_do "$IF_WPA_PAC_FILE" ascii \
- set_network pac_file wpa-pac-file
-
- wpa_cli_do "$IF_WPA_PEERKEY" raw \
- set_network peerkey wpa-peerkey
-
- wpa_cli_do "$IF_FRAGMENT_SIZE" raw \
- set_network fragment_size wpa-fragment-size
-
- wpa_cli_do "$IF_WPA_ID_STR" ascii \
- set_network id_str wpa-id-str
-
- wpa_cli_do "$WPA_ID" raw \
- enable_network "enabling network block"
- fi
-}
-
-#####################################################################
-## Log wpa_cli environment variables
-wpa_log_env () {
- wpa_msg log "WPA_IFACE=$WPA_IFACE WPA_ACTION=$WPA_ACTION"
- wpa_msg log "WPA_ID=$WPA_ID WPA_ID_STR=$WPA_ID_STR WPA_CTRL_DIR=$WPA_CTRL_DIR"
-}
-
-#####################################################################
-## hysteresis checking
-# Networking tools such as dhcp clients used with ifupdown can
-# synthesize artificial ACTION events, particuarly just after a
-# DISCONNECTED/CONNECTED events are experienced in quick succession.
-# This can lead to infinite event loops, and in extreme cases has the
-# potential to cause system instability.
-#
-wpa_hysteresis_event () {
- echo "$(date +%s)" > "$WPA_CLI_TIMESTAMP" 2>/dev/null
-}
-
-wpa_hysteresis_check () {
- if [ -f "$WPA_CLI_TIMESTAMP" ]; then
- local TIME
- local TIMESTAMP
- local TIMEWAIT
- TIME=$(date +%s)
- # current time minus 4 second event buffer
- TIMEWAIT=$(($TIME-4))
- # get time of last event
- TIMESTAMP=$(cat $WPA_CLI_TIMESTAMP)
- # compare values, allowing new action to be processed
- # only if last action was more than 4 seconds ago
- if [ "$TIMEWAIT" -le "$TIMESTAMP" ]; then
- wpa_msg log "$WPA_ACTION event blocked by hysteresis check"
- return 1
- fi
- fi
-
- return 0
-}
-
-#####################################################################
-## ifupdown locking functions
-# A collection of rudimentary locking functions to lock ifup/ifdown
-# actions.
-#
-
-ifupdown_lock () {
- ln -s lock "$WPA_CLI_IFUPDOWN"
-}
-
-ifupdown_locked () {
- [ -L "$WPA_CLI_IFUPDOWN" ] && return 0
-
- return 1
-}
-
-ifupdown_unlock () {
- rm -f "$WPA_CLI_IFUPDOWN"
-}
-
-#####################################################################
-## apply mapping logic and ifup logical interface
-# Apply mapping logic via id_str or external mapping script, check
-# state of IFACE with respect to ifupdown and ifup logical interaface
-#
-ifup () {
- local INTERFACES_FILE
- local IFSTATE_FILE
- local IFUP_RETVAL
- local WPA_LOGICAL_IFACE
-
- if [ -e /etc/network/interfaces ]; then
- INTERFACES_FILE="/etc/network/interfaces"
- else
- wpa_msg log "/etc/network/interfaces does not exist, $WPA_IFACE will not be configured"
- return 1
- fi
-
- if [ -e /etc/network/run/ifstate ]; then
- # debian's ifupdown
- IFSTATE_FILE="/etc/network/run/ifstate"
- elif [ -e /var/run/network/ifstate ]; then
- # ubuntu's
- IFSTATE_FILE="/var/run/network/ifstate"
- else
- unset IFSTATE_FILE
- fi
-
- if [ -z "$IF_WPA_MAPPING_SCRIPT_PRIORITY" ] && [ -n "$WPA_ID_STR" ]; then
- WPA_LOGICAL_IFACE="$WPA_ID_STR"
- fi
-
- if [ -z "$WPA_LOGICAL_IFACE" ] && [ -n "$IF_WPA_MAPPING_SCRIPT" ]; then
- local WPA_MAP_STDIN
-
- WPA_MAP_STDIN=$(set | sed -n 's/^\(IF_WPA_MAP[0-9]*\)=.*/echo \$\1/p')
-
- if [ -n "$WPA_MAP_STDIN" ]; then
- WPA_LOGICAL_IFACE=$(eval "$WPA_MAP_STDIN" | "$IF_WPA_MAPPING_SCRIPT" "$WPA_IFACE")
- else
- WPA_LOGICAL_IFACE=$("$IF_WPA_MAPPING_SCRIPT" "$WPA_IFACE")
- fi
-
- if [ -n "$WPA_LOGICAL_IFACE" ]; then
- wpa_msg log "mapping script result: $WPA_LOGICAL_IFACE"
- else
- wpa_msg log "mapping script failed."
- fi
- fi
-
- if [ -z "$WPA_LOGICAL_IFACE" ]; then
- if [ -n "$IF_WPA_ROAM_DEFAULT_IFACE" ]; then
- WPA_LOGICAL_IFACE="$IF_WPA_ROAM_DEFAULT_IFACE"
- else
- WPA_LOGICAL_IFACE="default"
- fi
- fi
-
- if [ -n "$WPA_LOGICAL_IFACE" ]; then
- if egrep -q "^iface[[:space:]]+${WPA_LOGICAL_IFACE}[[:space:]]+inet" "$INTERFACES_FILE"; then
- : # logical network is defined
- else
- wpa_msg log "network settings not defined for $WPA_LOGICAL_IFACE in $INTERFACES_FILE"
- WPA_LOGICAL_IFACE="default"
- fi
-
- wpa_msg log "ifup $WPA_IFACE=$WPA_LOGICAL_IFACE"
-
- ifupdown_lock
-
- if [ -n "$IFSTATE_FILE" ] && grep -q "^$WPA_IFACE=$WPA_IFACE" "$IFSTATE_FILE"; then
- # Force settings over the unconfigured "master" IFACE
- /sbin/ifup -v --force "$WPA_IFACE=$WPA_LOGICAL_IFACE"
- else
- /sbin/ifup -v "$WPA_IFACE=$WPA_LOGICAL_IFACE"
- fi
- IFUP_RETVAL="$?"
-
- ifupdown_unlock
- fi
-
- wpa_msg log "creating sendsigs omission pidfile: $WPA_SUP_OMIT_PIDFILE"
- cat "$WPA_SUP_PIDFILE" > "$WPA_SUP_OMIT_PIDFILE"
-
- return "$IFUP_RETVAL"
-}
-
-#####################################################################
-## ifdown IFACE
-# Check IFACE state and ifdown as requested.
-#
-ifdown () {
- wpa_msg log "ifdown $WPA_IFACE"
-
- ifupdown_lock
-
- /sbin/ifdown -v "$WPA_IFACE"
-
- ifupdown_unlock
-
- wpa_msg log "removing sendsigs omission pidfile: $WPA_SUP_OMIT_PIDFILE"
- rm -f "$WPA_SUP_OMIT_PIDFILE"
-}
-
-#####################################################################
-## keep IFACE scanning
-# After ifdown, the IFACE may be left "down", and inhibits
-# wpa_supplicant's ability to continue roaming.
-#
-# NB: use iproute if present, flushing the IFACE first
-#
-if_post_down_up () {
- if [ -x /bin/ip ]; then
- ip addr flush dev "$WPA_IFACE" 2>/dev/null
- ip link set "$WPA_IFACE" up
- else
- ifconfig "$WPA_IFACE" up
- fi
-}
+++ /dev/null
-#!/bin/sh
-
-#####################################################################
-## Purpose
-# This file is executed by ifupdown in pre-up, post-up, pre-down and
-# post-down phases of network interface configuration. It allows
-# ifup(8), and ifdown(8) to manage wpa_supplicant(8) and wpa_cli(8)
-# processes running in daemon mode.
-#
-# /etc/wpa_supplicant/functions.sh is sourced by this file.
-#
-# This file is provided by the wpasupplicant package.
-
-#####################################################################
-# Copyright (C) 2006 - 2009 Debian/Ubuntu wpasupplicant Maintainers
-# <pkg-wpa-devel@lists.alioth.debian.org>
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# On Debian GNU/Linux systems, the text of the GPL license,
-# version 2, can be found in /usr/share/common-licenses/GPL-2.
-
-if [ -n "$IF_WPA_MAINT_DEBUG" ]; then
- set -x
-fi
-
-# quit if we're called for the loopback
-if [ "$IFACE" = lo ]; then
- exit 0
-fi
-
-# allow wpa_supplicant interface to be specified via wpa-iface
-# useful for starting wpa_supplicant on one interface of a bridge
-if [ -n "$IF_WPA_IFACE" ]; then
- WPA_IFACE="$IF_WPA_IFACE"
-else
- WPA_IFACE="$IFACE"
-fi
-
-# source functions
-if [ -f /etc/wpa_supplicant/functions.sh ]; then
- . /etc/wpa_supplicant/functions.sh
-else
- exit 0
-fi
-
-# quit if executables are not installed
-if [ ! -x "$WPA_SUP_BIN" ] || [ ! -x "$WPA_CLI_BIN" ]; then
- exit 0
-fi
-
-do_start () {
- if test_wpa_cli; then
- # if wpa_action is active for this IFACE, do nothing
- ifupdown_locked && exit 0
-
- # if the administrator is calling ifup, say something useful
- if [ "$PHASE" = "pre-up" ]; then
- wpa_msg stderr "wpa_action is managing ifup/ifdown state of $WPA_IFACE"
- wpa_msg stderr "execute \`ifdown --force $WPA_IFACE' to stop wpa_action"
- fi
- exit 1
- elif ! set | grep -q "^IF_WPA"; then
- # no wpa- option defined for IFACE, do nothing
- exit 0
- fi
-
- # ensure stale ifupdown_lock marker is purged
- ifupdown_unlock
-
- # preliminary sanity checks for roaming daemon
- if [ -n "$IF_WPA_ROAM" ]; then
- if [ "$METHOD" != "manual" ]; then
- wpa_msg stderr "wpa-roam can only be used with the \"manual\" inet METHOD"
- exit 1
- fi
- if [ -n "$IF_WPA_MAPPING_SCRIPT" ]; then
- if ! type "$IF_WPA_MAPPING_SCRIPT" >/dev/null; then
- wpa_msg stderr "wpa-mapping-script \"$IF_WPA_MAPPING_SCRIPT\" is not valid"
- exit 1
- fi
- fi
- if [ -n "$IF_WPA_MAPPING_SCRIPT_PRIORITY" ] && [ -z "$IF_WPA_MAPPING_SCRIPT" ]; then
- wpa_msg stderr "\"wpa-mapping-script-priority 1\" is invalid without a wpa-mapping-script"
- exit 1
- fi
- IF_WPA_CONF="$IF_WPA_ROAM"
- WPA_ACTION_SCRIPT="/usr/sbin/wpa_action"
- fi
-
- # master function; determines if ifupdown.sh should do something or not
- if [ -n "$IF_WPA_CONF" ] && [ "$IF_WPA_CONF" != "managed" ]; then
- if [ ! -s "$IF_WPA_CONF" ]; then
- wpa_msg stderr "cannot read contents of $IF_WPA_CONF"
- exit 1
- fi
- WPA_SUP_CONF_CTRL_DIR=$(sed -n -e 's/[[:space:]]*#.*//g' -e 's/[[:space:]]\+.*$//g' \
- -e 's/^ctrl_interface=\(DIR=\)\?\(.*\)/\2/p' "$IF_WPA_CONF")
- if [ -n "$WPA_SUP_CONF_CTRL_DIR" ]; then
- WPA_CTRL_DIR="$WPA_SUP_CONF_CTRL_DIR"
- WPA_SUP_CONF="-c $IF_WPA_CONF"
- else
- # specify the default ctrl_interface since none was defined in
- # the given IF_WPA_CONF
- WPA_SUP_CONF="-c $IF_WPA_CONF -C $WPA_CTRL_DIR"
- fi
- else
- # specify the default ctrl_interface
- WPA_SUP_CONF="-C $WPA_CTRL_DIR"
- fi
-}
-
-do_stop () {
- if test_wpa_cli; then
- # if wpa_action is active for this IFACE and calling ifdown,
- # do nothing
- ifupdown_locked && exit 0
- elif test_wpa_supplicant; then
- # wpa_supplicant process exists for this IFACE, but wpa_cli
- # process does not. Allow stop mode to kill this process.
- :
- else
- exit 0
- fi
-}
-
-case "$MODE" in
- start)
- do_start
- case "$PHASE" in
- pre-up)
- kill_wpa_supplicant
- init_wpa_supplicant || exit 1
- conf_wpa_supplicant || { kill_wpa_supplicant; exit 1; }
- ;;
- post-up)
- init_wpa_cli || { kill_wpa_supplicant; exit 1; }
- ;;
- esac
- ;;
-
- stop)
- do_stop
- case "$PHASE" in
- pre-down)
- kill_wpa_cli
- ;;
- post-down)
- kill_wpa_supplicant
- ;;
- *)
- wpa_msg stderr "unknown phase: \"$PHASE\""
- exit 1
- ;;
- esac
- ;;
-
- *)
- wpa_msg stderr "unknown mode: \"$MODE\""
- exit 1
- ;;
-esac
-
-exit 0
+++ /dev/null
-#!/bin/sh
-
-# Copyright (C) 2006 - 2009 Debian/Ubuntu wpasupplicant Maintainers
-# <pkg-wpa-devel@lists.alioth.debian.org>
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# On Debian GNU/Linux systems, the text of the GPL license,
-# version 2, can be found in /usr/share/common-licenses/GPL-2.
-
-if [ -n "$IF_WPA_ROAM_MAINT_DEBUG" ]; then
- set -x
-fi
-
-if [ -z "$1" ] || [ -z "$2" ]; then
- echo "Usage: $0 IFACE ACTION"
- exit 1
-fi
-
-# network interface
-WPA_IFACE="$1"
-# [CONNECTED|DISCONNECTED|stop|reload|check]
-WPA_ACTION="$2"
-
-if [ -f /etc/wpa_supplicant/functions.sh ]; then
- . /etc/wpa_supplicant/functions.sh
-else
- exit 0
-fi
-
-case "$WPA_ACTION" in
- "CONNECTED")
- wpa_log_env
- wpa_hysteresis_check || exit 1
- wpa_hysteresis_event
- if ifup; then
- wpa_cli status | wpa_msg log
- else
- wpa_cli status | wpa_msg log
- wpa_cli reassociate
- fi
- ;;
-
- "DISCONNECTED")
- wpa_log_env
- wpa_hysteresis_check || exit 1
- ifdown
- if_post_down_up
- ;;
-
- "stop"|"down")
- test_wpa_cli && kill_wpa_cli
- ifdown
- test_wpa_supplicant && kill_wpa_supplicant
- ;;
-
- "restart"|"reload")
- test_wpa_supplicant || exit 1
- reload_wpa_supplicant
- ;;
-
- "check")
- test_wpa_supplicant || exit 1
- test_wpa_cli || exit 1
- ;;
-
- *)
- echo "Unknown action: \"$WPA_ACTION\""
- exit 1
- ;;
-esac
-
-exit 0
+++ /dev/null
-.TH WPA_ACTION "8" "26 May 2006" "" ""
-.SH NAME
-wpa_action \- wpa_cli action script
-.SH SYNOPSIS
-\fBwpa_action\fR \fIIFACE ACTION\fR
-.SH "DESCRIPTION"
-\fBwpa_action\fR is a shell script designed to control the \fBifupdown\fR
-framework according to \fIACTION\fR events received from \fBwpa_supplicant\fR.
-\fBwpa_cli\fR receives \fICONNECTED\fR and \fIDISCONNECTED\fR events from
-\fBwpa_supplicant\fR via the crtl_iface socket and gives the \fIACTION\fR event
-to the \fBwpa_action\fR script as an argument, along with the \fIIFACE\fR to be
-acted upon.
-.PP
-\fBwpa_action\fR also receives an environment variable from \fBwpa_cli\fR,
-\fIWPA_ID_STR\fR, containing an alphanumeric identification string for the
-\fICURRENT\fR network block. \fIWPA_ID_STR\fR is provided by the 'id_str'
-network block option of \fBwpa_supplicant.conf\fR, and provides a means to map
-the \fIACTION\fR to a \fILOGICAL\fR interface configured in the \fBinterfaces\fR
-file.
-.PP
-If either the ifupdown \fBinterfaces\fR or \fIifstate\fR file cannot be found,
-\fBwpa_action\fR will exit silently (status 0). \fBwpa_action\fR will search
-the following locations for their existance:
-.nf
- /etc/network/run/ifstate
- /var/run/network/ifstate
- /etc/network/interfaces
-.fi
-.PP
-.SH IFACE
-Network interface to be acted upon, for example 'eth1' or 'wlan0'.
-.SH ACTION
-An \fIACTION\fR to be performed on the \fIIFACE\fR.
-.TP
-\fBCONNECTED\fR
-\fBwpa_supplicant\fR has completed authentication.
-\fBifup\fR \fIIFACE=WPA_ID_STR\fR is invoked and the action is logged to
-syslog. Network settings for the \fILOGICAL\fR interface \fIWPA_ID_STR\fR
-are applied.
-.TP
-\fBDISCONNECTED\fR
-\fBwpa_supplicant\fR has detected disconnection.
-\fBifdown\fR \fIIFACE=WPA_ID_STR\fR is invoked and the action is logged to
-syslog. Network settings for the \fILOGICAL\fR interface \fIWPA_ID_STR\fR
-are undone.
-.TP
-\fBstop\fR
-The 'stop' \fIACTION\fR is a called manually by the user, to stop the
-\fBwpa_cli\fR daemon, invoke \fBifdown\fR \fIIFACE\fR (if the \fIIFACE\fR is
-present in the \fIifstate\fR file) and stop the \fBwpa_supplicant\fR daemon.
-.TP
-\fBreload\fR
-The 'reload' \fIACTION\fR can be used to reload the \fBwpa_supplicant\fR
-configuration file specified by \fIwpa-roam\fR . 'restart' is a synonym
-for 'reload' and can be used equally. The action is logged to
-\fI/var/log/wpa_action.log\fR.
-.SH ENVIRONMENT
-An alphanumeric identification string provided by the 'id_str' network block
-option of \fBwpa_supplicant.conf\fR is exported to \fBwpa_action\fR as an
-environment variable, \fIWPA_ID_STR\fR. When 'id_str' is not configured for the
-\fICURRENT\fR network block, 'default' is substituted for the absent
-\fIWPA_ID_STR\fR environment variable.
-.PP
-A unique network identifier, \fIWPA_ID\fR, is exported to \fBwpa_action\fR. It
-is the number assigned to the \fICURRENT\fR \fBwpa_supplicant\fR network block
-(network_id).
-.SH USAGE
-The only reasons for \fBwpa_action\fR to be explicitly executed by the user is
-to stop \fBwpa_cli\fR from controlling \fBifupdown\fR or reload the
-\fIwpa_supplicant.conf\fR file after editing.
-.PP
-.RS
-\fBwpa_action\fR \fIeth1 stop\fR
-.RE
-.PP
-Otherwise, \fBwpa_action\fR is given as an argument to a \fBwpa_cli\fR
-daemon.
-.PP
-.RS
-\fBwpa_cli\fR \fI-i eth1 -a /sbin/wpa_action -B\fR
-.RE
-.PP
-This can be done by using the \fIwpa-roam\fR option in the \fBinterfaces\fR
-file. \fIwpa-roam\fR takes one argument, a user provided
-\fBwpa_supplicant.conf\fR file.
-.PP
-The inet \fIMETHOD\fR must be 'manual' for this interface, as it will
-be configured according to \fBwpa_cli\fR action events. Also supply a 'default'
-\fBinterfaces\fR stanza using the dhcp inet \fIMETHOD\fR so that networks
-without an 'id_str' option can fallback to attempting to receive an ip via
-dhcp. If one or more networks requires additional network configuration,
-provide an unique 'id_str' for each network, and an \fBinterfaces\fR stanza
-using the 'id_str' value as a \fILOGICAL\fR interface. The following interfaces
-file is configured to use dhcp for any network without an 'id_str', a static ip
-for the network with an 'id_str' of 'home_static' and dhcp plus an additional
-post-up command for the network with an 'id_str' of 'uni'.
-.PP
-An example wpa_supplicant.conf configured to roam between 3 different networks:
-.PP
-.RS
-.nf
-network={
- ssid="foo"
- id_str="uni"
- key_mgmt=NONE
-}
-
-network={
- ssid="bar"
- id_str="home_static"
- psk=123456789...
-}
-
-network={
- ssid=""
- key_mgmt=NONE
-}
-.fi
-.RE
-.PP
-The corresponding \fBinterfaces\fR file would contain \fILOGICAL\fR interfaces,
-that correlate to each unique 'id_str' provided by the configuration file:
-.PP
-.RS
-.nf
-iface eth1 inet manual
- wpa-driver wext
- wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
-
-iface default inet dhcp
-
-iface uni inet dhcp
-
-iface home_static inet static
- address 192.168.0.20
- netmask 255.255.255.0
- network 192.168.0.0
- broadcast 192.168.0.255
- gateway 192.168.0.1
-.fi
-.RE
-.PP
-.SH SEE ALSO
-\fBwpa_cli(8)\fR, \fBwpa_supplicant(8)\fR, \fBwpa_supplicant.conf(5)\fR,
-\fBifup(8)\fR, \fBinterfaces(5)\fR
-.SH AUTHOR
-This manual page was written by Kel Modderman <kel@otaku42.de> for
-the Debian GNU system (but may be used by others).
--- /dev/null
+#!/bin/sh
+
+# Action script to enable/disable wpa-roam interfaces in reaction to
+# ifplugd events.
+#
+# Copyright: Copyright (c) 2008-2010, Kel Modderman <kel@otaku42.de>
+# License: GPL-2
+#
+
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+
+if [ ! -x /usr/sbin/wpa_action ]; then
+ exit 0
+fi
+
+# ifplugd(8) - <iface> <action>
+#
+# If an ifplugd managed interface is brought up, disconnect any
+# wpa-roam managed interfaces so that only one "roaming" interface
+# remains active on the system.
+
+IFPLUGD_IFACE="${1}"
+
+case "${2}" in
+ up)
+ COMMAND=disconnect
+ ;;
+ down)
+ COMMAND=reconnect
+ ;;
+ *)
+ echo "$0: unknown arguments: ${@}" >&2
+ exit 1
+ ;;
+esac
+
+for CTRL in /var/run/wpa_supplicant/*; do
+ [ -S "${CTRL}" ] || continue
+
+ IFACE="${CTRL#/var/run/wpa_supplicant/}"
+
+ # skip if ifplugd is managing this interface
+ if [ "${IFPLUGD_IFACE}" = "${IFACE}" ]; then
+ continue
+ fi
+
+ if wpa_action "${IFACE}" check; then
+ wpa_cli -i "${IFACE}" "${COMMAND}"
+ fi
+done
--- /dev/null
+#!/bin/sh
+
+#####################################################################
+## Purpose
+# This file contains common shell functions used by scripts of the
+# wpasupplicant package to allow ifupdown to manage wpa_supplicant.
+# It also contains some functions used by wpa_action(8) that allow
+# ifupdown to be managed by wpa_cli(8) action events.
+#
+# This file is provided by the wpasupplicant package.
+
+#####################################################################
+# Copyright (C) 2006 - 2009 Debian/Ubuntu wpasupplicant Maintainers
+# <pkg-wpa-devel@lists.alioth.debian.org>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# On Debian GNU/Linux systems, the text of the GPL license,
+# version 2, can be found in /usr/share/common-licenses/GPL-2.
+
+#####################################################################
+## global variables
+# wpa_supplicant variables
+WPA_SUP_BIN="/usr/sbin/wpa_supplicant"
+WPA_SUP_PNAME="wpa_supplicant"
+WPA_SUP_PIDFILE="/var/run/wpa_supplicant.${WPA_IFACE}.pid"
+
+# wpa_cli variables
+WPA_CLI_BIN="/usr/sbin/wpa_cli"
+WPA_CLI_PNAME="wpa_cli"
+WPA_CLI_PIDFILE="/var/run/wpa_action.${WPA_IFACE}.pid"
+WPA_CLI_TIMESTAMP="/var/run/wpa_action.${WPA_IFACE}.timestamp"
+WPA_CLI_IFUPDOWN="/var/run/wpa_action.${WPA_IFACE}.ifupdown"
+
+# sendsigs omission interface, present in initscripts (>= 2.86.ds1-48)
+if [ -d /lib/init/rw/sendsigs.omit.d/ ]; then
+ # Debian
+ WPA_SUP_OMIT_PIDFILE="/lib/init/rw/sendsigs.omit.d/wpasupplicant.wpa_supplicant.${WPA_IFACE}.pid"
+elif [ -d /var/run/sendsigs.omit.d/ ]; then
+ # Ubuntu, see https://launchpad.net/bugs/181541 for status
+ WPA_SUP_OMIT_PIDFILE="/var/run/sendsigs.omit.d/wpasupplicant.wpa_supplicant.${WPA_IFACE}.pid"
+else
+ WPA_SUP_OMIT_PIDFILE=
+fi
+
+# default ctrl_interface socket directory
+if [ -z "$WPA_CTRL_DIR" ]; then
+ WPA_CTRL_DIR="/var/run/wpa_supplicant"
+fi
+
+# verbosity variables
+if [ -n "$IF_WPA_VERBOSITY" ] || [ "$VERBOSITY" = "1" ]; then
+ TO_NULL="/dev/stdout"
+ DAEMON_VERBOSITY="--verbose"
+else
+ TO_NULL="/dev/null"
+ DAEMON_VERBOSITY="--quiet"
+fi
+
+#####################################################################
+## wpa_cli wrapper
+# Path to common ctrl_interface socket and iface supplied.
+# NB: WPA_CTRL_DIR cannot be used for interactive commands, it is
+# set only in the environment that wpa_cli provides when processing
+# action events.
+#
+wpa_cli () {
+ "$WPA_CLI_BIN" -p "$WPA_CTRL_DIR" -i "$WPA_IFACE" "$@"
+
+ return "$?"
+}
+
+#####################################################################
+## verbose and stderr message wrapper
+# Ensures a standard and easily identifiable message is printed by
+# scripts using this function library.
+#
+# log Log a message to syslog when called non-interactively
+# by wpa_action
+#
+# verbose To stdout when IF_WPA_VERBOSITY or VERBOSITY is true
+#
+# action Same as verbose but without newline
+# Useful for allowing wpa_cli commands to echo result
+# value of 'OK' or 'FAILED'
+#
+# stderr Echo warning or error messages to stderr
+#
+# NB: when called by wpa_action, there is no redirection (verbose)
+#
+wpa_msg () {
+ if [ "$1" = "log" ]; then
+ shift
+ case "$WPA_ACTION" in
+ "CONNECTED"|"DISCONNECTED")
+ [ -x /usr/bin/logger ] || return
+ if [ "$#" -gt 0 ]; then
+ logger -t "wpa_action" "$@"
+ else
+ logger -t "wpa_action"
+ fi
+ ;;
+ *)
+ [ "$#" -gt 0 ] && echo "wpa_action: $@"
+ ;;
+ esac
+ return
+ fi
+
+ case "$1" in
+ "verbose")
+ shift
+ echo "$WPA_SUP_PNAME: $@" >$TO_NULL
+ ;;
+ "action")
+ shift
+ echo -n "$WPA_SUP_PNAME: $@ -- " >$TO_NULL
+ ;;
+ "stderr")
+ shift
+ echo "$WPA_SUP_PNAME: $@" >/dev/stderr
+ ;;
+ *)
+ ;;
+ esac
+}
+
+#####################################################################
+## validate daemon pid files
+# Test daemon process ID files via start-stop-daemon with a signal 0
+# given the exec binary and pidfile location.
+#
+# $1 daemon
+# $2 pidfile
+#
+# Returns true when pidfile exists, the process ID exists _and_ was
+# created by the exec binary.
+#
+# If the test fails, but the pidfile exists, it is stale
+#
+test_daemon_pidfile () {
+ local DAEMON
+ local PIDFILE
+
+ if [ -n "$1" ]; then
+ DAEMON="$1"
+ fi
+
+ if [ -f "$2" ]; then
+ PIDFILE="$2"
+ fi
+
+ if [ -n "$DAEMON" ] && [ -f "$PIDFILE" ]; then
+ if start-stop-daemon --stop --quiet --signal 0 \
+ --exec "$DAEMON" --pidfile "$PIDFILE"; then
+ return 0
+ else
+ rm -f "$PIDFILE"
+ return 1
+ fi
+ else
+ return 1
+ fi
+}
+
+# validate wpa_supplicant pidfile
+test_wpa_supplicant () {
+ test_daemon_pidfile "$WPA_SUP_BIN" "$WPA_SUP_PIDFILE"
+}
+
+# validate wpa_cli pidfile
+test_wpa_cli () {
+ test_daemon_pidfile "$WPA_CLI_BIN" "$WPA_CLI_PIDFILE"
+}
+
+#####################################################################
+## daemonize wpa_supplicant
+# Start wpa_supplicant via start-stop-dameon with all required
+# options. Will start if environment variable WPA_SUP_CONF is present
+#
+# Default options:
+# -B dameonize/background process
+# -D driver backend ('wext' if none given)
+# -P process ID file
+# -C path to ctrl_interface socket directory
+# -s log to syslog
+#
+# Conditional options:
+# -c configuration file
+# -W wait for wpa_cli to attach to ctrl_interface socket
+# -b bridge interface name
+# -f path to log file
+#
+init_wpa_supplicant () {
+ [ -n "$WPA_SUP_CONF" ] || return 0
+
+ local WPA_SUP_OPTIONS
+ WPA_SUP_OPTIONS="-s -B -P $WPA_SUP_PIDFILE -i $WPA_IFACE"
+
+ if [ -n "$WPA_ACTION_SCRIPT" ]; then
+ if [ -x "$WPA_ACTION_SCRIPT" ]; then
+ WPA_SUP_OPTIONS="$WPA_SUP_OPTIONS -W"
+ wpa_msg verbose "wait for wpa_cli to attach"
+ else
+ wpa_msg stderr "action script \"$WPA_ACTION_SCRIPT\" not executable"
+ return 1
+ fi
+ fi
+
+ if [ -n "$IF_WPA_BRIDGE" ]; then
+ WPA_SUP_OPTIONS="$WPA_SUP_OPTIONS -b $IF_WPA_BRIDGE"
+ wpa_msg verbose "wpa-bridge $IF_WPA_BRIDGE"
+ fi
+
+ if [ -n "$IF_WPA_DRIVER" ]; then
+ wpa_msg verbose "wpa-driver $IF_WPA_DRIVER"
+ case "$IF_WPA_DRIVER" in
+ hostap|ipw|madwifi|ndiswrapper)
+ WPA_SUP_OPTIONS="$WPA_SUP_OPTIONS -D nl80211,wext"
+ wpa_msg stderr "\"$IF_WPA_DRIVER\" wpa-driver is unsupported"
+ wpa_msg stderr "using \"nl80211,wext\" wpa-driver instead ..."
+ ;;
+ *)
+ WPA_SUP_OPTIONS="$WPA_SUP_OPTIONS -D $IF_WPA_DRIVER"
+ ;;
+ esac
+ else
+ WPA_SUP_OPTIONS="$WPA_SUP_OPTIONS -D nl80211,wext"
+ wpa_msg verbose "wpa-driver nl80211,wext (default)"
+ fi
+
+ if [ -n "$IF_WPA_DEBUG_LEVEL" ]; then
+ case "$IF_WPA_DEBUG_LEVEL" in
+ 3)
+ WPA_SUP_OPTIONS="$WPA_SUP_OPTIONS -t -ddd"
+ ;;
+ 2)
+ WPA_SUP_OPTIONS="$WPA_SUP_OPTIONS -t -dd"
+ ;;
+ 1)
+ WPA_SUP_OPTIONS="$WPA_SUP_OPTIONS -t -d"
+ ;;
+ 0)
+ # wpa_supplicant default verbosity
+ ;;
+ -1)
+ WPA_SUP_OPTIONS="$WPA_SUP_OPTIONS -q"
+ ;;
+ -2)
+ WPA_SUP_OPTIONS="$WPA_SUP_OPTIONS -qq"
+ ;;
+ esac
+ wpa_msg verbose "using debug level: $IF_WPA_DEBUG_LEVEL"
+ fi
+
+ if [ -n "$IF_WPA_LOGFILE" ]; then
+ # custom log file
+ WPA_SUP_OPTIONS="$WPA_SUP_OPTIONS -f $IF_WPA_LOGFILE"
+ WPA_SUP_LOGFILE="$IF_WPA_LOGFILE"
+ wpa_msg verbose "logging to $IF_WPA_LOGFILE"
+ fi
+
+ wpa_msg verbose "$WPA_SUP_BIN $WPA_SUP_OPTIONS $WPA_SUP_CONF"
+
+ start-stop-daemon --start --oknodo $DAEMON_VERBOSITY \
+ --name $WPA_SUP_PNAME --startas $WPA_SUP_BIN --pidfile $WPA_SUP_PIDFILE \
+ -- $WPA_SUP_OPTIONS $WPA_SUP_CONF
+
+ if [ "$?" -ne 0 ]; then
+ wpa_msg stderr "$WPA_SUP_BIN daemon failed to start"
+ return 1
+ fi
+
+ if [ -n "$WPA_SUP_OMIT_PIDFILE" ]; then
+ local WPA_PIDFILE_WAIT
+ local MAX_WPA_PIDFILE_WAIT
+ WPA_PIDFILE_WAIT="0"
+ MAX_WPA_PIDFILE_WAIT="5"
+ until [ -s "$WPA_SUP_PIDFILE" ]; do
+ if [ "$WPA_PIDFILE_WAIT" -ge "$MAX_WPA_PIDFILE_WAIT" ]; then
+ wpa_msg stderr "timed out waiting for creation of $WPA_SUP_PIDFILE"
+ return 1
+ else
+ wpa_msg verbose "waiting for \"$WPA_SUP_PIDFILE\": " \
+ "$WPA_PIDFILE_WAIT (max. $MAX_WPA_PIDFILE_WAIT)"
+ fi
+
+ WPA_PIDFILE_WAIT=$(($WPA_PIDFILE_WAIT + 1))
+ sleep 1
+ done
+ wpa_msg verbose "creating sendsigs omission pidfile: $WPA_SUP_OMIT_PIDFILE"
+ cat "$WPA_SUP_PIDFILE" > "$WPA_SUP_OMIT_PIDFILE"
+ else
+ wpa_msg verbose "sendsigs omission pidfile not created"
+ fi
+
+ local WPA_SOCKET_WAIT
+ local MAX_WPA_SOCKET_WAIT
+ WPA_SOCKET_WAIT="0"
+ MAX_WPA_SOCKET_WAIT="5"
+ until [ -S "$WPA_CTRL_DIR/$WPA_IFACE" ]; do
+ if [ "$WPA_SOCKET_WAIT" -ge "$MAX_WPA_SOCKET_WAIT" ]; then
+ wpa_msg stderr "ctrl_interface socket not found at $WPA_CTRL_DIR/$WPA_IFACE"
+ return 1
+ else
+ wpa_msg verbose "waiting for \"$WPA_CTRL_DIR/$WPA_IFACE\": " \
+ "$WPA_SOCKET_WAIT (max. $MAX_WPA_SOCKET_WAIT)"
+ fi
+
+ WPA_SOCKET_WAIT=$(($WPA_SOCKET_WAIT + 1))
+ sleep 1
+ done
+
+ wpa_msg verbose "ctrl_interface socket located at $WPA_CTRL_DIR/$WPA_IFACE"
+}
+
+#####################################################################
+## stop wpa_supplicant process
+# Kill wpa_supplicant via start-stop-daemon, given the location of
+# the pidfile or ctrl_interface socket path and interface name
+#
+kill_wpa_supplicant () {
+ test_wpa_supplicant || return 0
+
+ wpa_msg verbose "terminating $WPA_SUP_PNAME daemon via pidfile $WPA_SUP_PIDFILE"
+
+ start-stop-daemon --stop --oknodo $DAEMON_VERBOSITY \
+ --exec $WPA_SUP_BIN --pidfile $WPA_SUP_PIDFILE
+
+ if [ -f "$WPA_SUP_PIDFILE" ]; then
+ rm -f "$WPA_SUP_PIDFILE"
+ fi
+
+ if [ -f "$WPA_SUP_OMIT_PIDFILE" ]; then
+ wpa_msg verbose "removing $WPA_SUP_OMIT_PIDFILE"
+ rm -f "$WPA_SUP_OMIT_PIDFILE"
+ fi
+}
+
+#####################################################################
+## reload wpa_supplicant process
+# Sending a HUP signal causes wpa_supplicant to reparse its
+# configuration file
+#
+reload_wpa_supplicant () {
+ if test_wpa_supplicant; then
+ wpa_msg verbose "reloading wpa_supplicant configuration file via HUP signal"
+ start-stop-daemon --stop --signal HUP \
+ --name "$WPA_SUP_PNAME" --pidfile "$WPA_SUP_PIDFILE"
+ else
+ wpa_msg verbose "cannot $WPA_ACTION, $WPA_SUP_PIDFILE does not exist"
+ fi
+}
+
+#####################################################################
+## daemonize wpa_cli and action script
+# If environment variable WPA_ACTION_SCRIPT is present, wpa_cli will
+# be spawned via start-stop-daemon
+#
+# Required options:
+# -a action script => wpa_action
+# -P process ID file
+# -B background process
+#
+init_wpa_cli () {
+ [ -n "$WPA_ACTION_SCRIPT" ] || return 0
+
+ local WPA_CLI_OPTIONS
+ WPA_CLI_OPTIONS="-B -P $WPA_CLI_PIDFILE -i $WPA_IFACE"
+
+ wpa_msg verbose "$WPA_CLI_BIN $WPA_CLI_OPTIONS -p $WPA_CTRL_DIR -a $WPA_ACTION_SCRIPT"
+
+ start-stop-daemon --start --oknodo $DAEMON_VERBOSITY \
+ --name $WPA_CLI_PNAME --startas $WPA_CLI_BIN --pidfile $WPA_CLI_PIDFILE \
+ -- $WPA_CLI_OPTIONS -p $WPA_CTRL_DIR -a $WPA_ACTION_SCRIPT
+
+ if [ "$?" -ne 0 ]; then
+ wpa_msg stderr "$WPA_CLI_BIN daemon failed to start"
+ return 1
+ fi
+}
+
+#####################################################################
+## stop wpa_cli process
+# Kill wpa_cli via start-stop-daemon, given the location of the
+# pidfile
+#
+kill_wpa_cli () {
+ test_wpa_cli || return 0
+
+ wpa_msg verbose "terminating $WPA_CLI_PNAME daemon via pidfile $WPA_CLI_PIDFILE"
+
+ start-stop-daemon --stop --oknodo $DAEMON_VERBOSITY \
+ --exec $WPA_CLI_BIN --pidfile $WPA_CLI_PIDFILE
+
+ if [ -f "$WPA_CLI_PIDFILE" ]; then
+ rm -f "$WPA_CLI_PIDFILE"
+ fi
+
+ if [ -f "$WPA_CLI_TIMESTAMP" ]; then
+ rm -f "$WPA_CLI_TIMESTAMP"
+ fi
+
+ if [ -L "$WPA_CLI_IFUPDOWN" ]; then
+ rm -f "$WPA_CLI_IFUPDOWN"
+ fi
+}
+
+#####################################################################
+## higher level wpa_cli wrapper for variable and set_network commands
+# wpa_cli_do <value> <type> <variable> [set_network variable] <desc>
+#
+# $1 envorinment variable
+# $2 data type of variable {raw|ascii}
+# $3 wpa_cli variable, if $3 is set_network, shift and take
+# set_network subvariable
+# $4 wpa-* string as it would appear in interfaces file, enhances
+# verbose messages
+#
+wpa_cli_do () {
+ if [ -z "$1" ]; then
+ return 0
+ fi
+
+ local WPACLISET_VALUE
+ local WPACLISET_VARIABLE
+ local WPACLISET_DESC
+
+ case "$2" in
+ ascii)
+ # Double quote
+ WPACLISET_VALUE="\"$1\""
+ ;;
+ raw|*)
+ # Provide raw value
+ WPACLISET_VALUE="$1"
+ ;;
+ esac
+
+ case "$3" in
+ set_network)
+ if [ -z "$WPA_ID" ]; then
+ return 1
+ fi
+ shift
+ WPACLISET_VARIABLE="set_network $WPA_ID $3"
+ ;;
+ *)
+ WPACLISET_VARIABLE="$3"
+ ;;
+ esac
+
+ case "$4" in
+ *-psk|*-passphrase|*-passwd*|*-wep-key*)
+ WPACLISET_DESC="$4 *****"
+ ;;
+ *)
+ WPACLISET_DESC="$4 $WPACLISET_VALUE"
+ ;;
+ esac
+
+ wpa_msg action "$WPACLISET_DESC"
+
+ wpa_cli $WPACLISET_VARIABLE "$WPACLISET_VALUE" >$TO_NULL
+
+ if [ "$?" -ne 0 ]; then
+ wpa_msg stderr "$WPACLISET_DESC failed!"
+ fi
+}
+
+#####################################################################
+## check value data type in plaintext or hex
+# returns 0 if input consists of hexadecimal digits only, 1 otherwise
+#
+ishex () {
+ if [ -z "$1" ]; then
+ return 0
+ fi
+
+ case "$1" in
+ *[!0-9a-fA-F]*)
+ # plaintext
+ return 1
+ ;;
+ *)
+ # hexadecimal
+ return 0
+ ;;
+ esac
+}
+
+#####################################################################
+## sanity check and set psk|passphrase
+# Warn about strange psk|passphrase values
+#
+# $1 psk or passphrase value
+#
+# If psk is surrounded by quotes strip them.
+#
+# If psk contains all hexadecimal characters and string length is 64:
+# is 256bit hexadecimal
+# else:
+# is plaintext
+#
+# plaintext passphrases must be 8 - 63 characters in length
+# 256-bit hexadecimal key must be 64 characters in length
+#
+wpa_key_check_and_set () {
+ if [ "$#" -ne 3 ]; then
+ return 0
+ fi
+
+ local KEY
+ local KEY_LEN
+ local KEY_TYPE
+ local ENC_TYPE
+
+ case "$1" in
+ '"'*'"')
+ # Strip surrounding quotation marks
+ KEY=$(echo -n "$1" | sed 's/^"//;s/"$//')
+ ;;
+ *)
+ KEY="$1"
+ ;;
+ esac
+
+ KEY_LEN="${#KEY}"
+
+ case "$2" in
+ wep_key*)
+ ENC_TYPE="WEP"
+ ;;
+ psk)
+ ENC_TYPE="WPA"
+ ;;
+ *)
+ return 0
+ ;;
+ esac
+
+ if [ "$ENC_TYPE" = "WEP" ]; then
+ if ishex "$KEY"; then
+ case "$KEY_LEN" in
+ 10|26|32|58)
+ # 64/128/152/256-bit WEP
+ KEY_TYPE="raw"
+ ;;
+ *)
+ KEY_TYPE="ascii"
+ ;;
+ esac
+ else
+ KEY_TYPE="ascii"
+ fi
+
+ if [ "$KEY_TYPE" = "ascii" ]; then
+ if [ "$KEY_LEN" -lt "5" ]; then
+ wpa_msg stderr "WARNING: plaintext or ascii WEP key has $KEY_LEN characters,"
+ wpa_msg stderr "it must have at least 5 to be valid."
+ fi
+ fi
+ elif [ "$ENC_TYPE" = "WPA" ]; then
+ if ishex "$KEY"; then
+ case "$KEY_LEN" in
+ 64)
+ # 256-bit WPA
+ KEY_TYPE="raw"
+ ;;
+ *)
+ KEY_TYPE="ascii"
+ ;;
+ esac
+ else
+ KEY_TYPE="ascii"
+ fi
+
+ if [ "$KEY_TYPE" = "ascii" ]; then
+ if [ "$KEY_LEN" -lt "8" ] || [ "$KEY_LEN" -gt "63" ]; then
+ wpa_msg stderr "WARNING: plaintext or ascii WPA key has $KEY_LEN characters,"
+ wpa_msg stderr "it must have between 8 and 63 to be valid."
+ wpa_msg stderr "If the WPA key is a 256-bit hexadecimal key, it must have"
+ wpa_msg stderr "exactly 64 characters."
+ fi
+ fi
+ fi
+
+ wpa_cli_do "$KEY" "$KEY_TYPE" set_network "$2" "$3"
+}
+
+#####################################################################
+## formulate a usable configuration from interfaces(5) wpa- lines
+# A series of wpa_cli commands corresponding to environment variables
+# created as a result of wpa- lines in an interfaces stanza.
+#
+# NB: no-act when roaming daemon is used (to avoid prematurely
+# attaching to ctrl_interface socket)
+#
+conf_wpa_supplicant () {
+ if [ -n "$WPA_ACTION_SCRIPT" ]; then
+ return 0
+ fi
+
+ if [ "$IF_WPA_DRIVER" = "wired" ]; then
+ IF_WPA_AP_SCAN="0"
+ wpa_msg verbose "forcing ap_scan=0 (required for wired IEEE8021X auth)"
+ fi
+
+ if [ -n "$IF_WPA_ESSID" ]; then
+ # #403316, be similar to wireless tools
+ IF_WPA_SSID="$IF_WPA_ESSID"
+ fi
+
+ wpa_cli_do "$IF_WPA_AP_SCAN" raw \
+ ap_scan wpa-ap-scan
+
+ wpa_cli_do "$IF_WPA_PREAUTHENTICATE" raw \
+ preauthenticate wpa-preauthenticate
+
+ if [ -n "$IF_WPA_SSID" ] || [ "$IF_WPA_DRIVER" = "wired" ] || \
+ [ -n "$IF_WPA_KEY_MGMT" ]; then
+
+ case "$IF_WPA_SSID" in
+ '"'*'"')
+ IF_WPA_SSID=$(echo -n "$IF_WPA_SSID" | sed 's/^"//;s/"$//')
+ ;;
+ *)
+ ;;
+ esac
+
+ WPA_ID=$(wpa_cli add_network)
+
+ wpa_msg verbose "configuring network block -- $WPA_ID"
+
+ wpa_cli_do "$IF_WPA_SSID" ascii \
+ set_network ssid wpa-ssid
+
+ wpa_cli_do "$IF_WPA_PRIORITY" raw \
+ set_network priority wpa-priority
+
+ wpa_cli_do "$IF_WPA_BSSID" raw \
+ set_network bssid wpa-bssid
+
+ if [ -s "$IF_WPA_PSK_FILE" ]; then
+ IF_WPA_PSK=$(cat "$IF_WPA_PSK_FILE")
+ fi
+
+ # remain compat with wpa-passphrase-file
+ if [ -s "$IF_WPA_PASSPHRASE_FILE" ]; then
+ IF_WPA_PSK=$(cat "$IF_WPA_PASSPHRASE_FILE")
+ fi
+
+ # remain compat with wpa-passphrase
+ if [ -n "$IF_WPA_PASSPHRASE" ]; then
+ IF_WPA_PSK="$IF_WPA_PASSPHRASE"
+ fi
+
+ if [ -n "$IF_WPA_PSK" ]; then
+ wpa_key_check_and_set "$IF_WPA_PSK" \
+ psk wpa-psk
+ fi
+
+ wpa_cli_do "$IF_WPA_PAIRWISE" raw \
+ set_network pairwise wpa-pairwise
+
+ wpa_cli_do "$IF_WPA_GROUP" raw \
+ set_network group wpa-group
+
+ wpa_cli_do "$IF_WPA_MODE" raw \
+ set_network mode wpa-mode
+
+ wpa_cli_do "$IF_WPA_FREQUENCY" raw \
+ set_network frequency wpa-frequency
+
+ wpa_cli_do "$IF_WPA_SCAN_FREQ" raw \
+ set_network scan_freq wpa-scan-freq
+
+ wpa_cli_do "$IF_WPA_FREQ_LIST" raw \
+ set_network freq_list wpa-freq-list
+
+ wpa_cli_do "$IF_WPA_KEY_MGMT" raw \
+ set_network key_mgmt wpa-key-mgmt
+
+ wpa_cli_do "$IF_WPA_PROTO" raw \
+ set_network proto wpa-proto
+
+ wpa_cli_do "$IF_WPA_AUTH_ALG" raw \
+ set_network auth_alg wpa-auth-alg
+
+ wpa_cli_do "$IF_WPA_SCAN_SSID" raw \
+ set_network scan_ssid wpa-scan-ssid
+
+ wpa_cli_do "$IF_WPA_IDENTITY" ascii \
+ set_network identity wpa-identity
+
+ wpa_cli_do "$IF_WPA_ANONYMOUS_IDENTITY" ascii \
+ set_network anonymous_identity wpa-anonymous-identity
+
+ wpa_cli_do "$IF_WPA_EAP" raw \
+ set_network eap wpa-eap
+
+ wpa_cli_do "$IF_WPA_EAPPSK" raw \
+ set_network eappsk wpa-eappsk
+
+ wpa_cli_do "$IF_WPA_NAI" ascii \
+ set_network nai wpa-nai
+
+ wpa_cli_do "$IF_WPA_PASSWORD" ascii \
+ set_network password wpa-password
+
+ wpa_cli_do "$IF_WPA_CA_CERT" ascii \
+ set_network ca_cert wpa-ca-cert
+
+ wpa_cli_do "$IF_WPA_CA_PATH" ascii \
+ set_network ca_path wpa-ca-path
+
+ wpa_cli_do "$IF_WPA_CLIENT_CERT" ascii \
+ set_network client_cert wpa-client-cert
+
+ wpa_cli_do "$IF_WPA_PRIVATE_KEY" ascii \
+ set_network private_key wpa-private-key
+
+ wpa_cli_do "$IF_WPA_PRIVATE_KEY_PASSWD" ascii \
+ set_network private_key_passwd wpa-private-key-passwd
+
+ wpa_cli_do "$IF_WPA_DH_FILE" ascii \
+ set_network dh_file wpa-dh-file
+
+ wpa_cli_do "$IF_WPA_SUBJECT_MATCH" ascii \
+ set_network subject_match wpa-subject-match
+
+ wpa_cli_do "$IF_WPA_ALTSUBJECT_MATCH" ascii \
+ set_network altsubject_match wpa-altsubject-match
+
+ wpa_cli_do "$IF_WPA_CA_CERT2" ascii \
+ set_network ca_cert2 wpa-ca-cert2
+
+ wpa_cli_do "$IF_WPA_CA_PATH2" ascii \
+ set_network ca_path2 wpa-ca-path2
+
+ wpa_cli_do "$IF_WPA_CLIENT_CERT2" ascii \
+ set_network client_cert2 wpa-client-cert2
+
+ wpa_cli_do "$IF_WPA_PRIVATE_KEY2" ascii \
+ set_network private_key2 wpa-private-key2
+
+ wpa_cli_do "$IF_WPA_PRIVATE_KEY_PASSWD2" ascii \
+ set_network private_key_passwd2 wpa-private-key-passwd2
+
+ wpa_cli_do "$IF_WPA_DH_FILE2" ascii \
+ set_network dh_file2 wpa-dh-file2
+
+ wpa_cli_do "$IF_WPA_SUBJECT_MATCH2" ascii \
+ set_network subject_match2 wpa-subject-match2
+
+ wpa_cli_do "$IF_WPA_ALTSUBJECT_MATCH2" ascii \
+ set_network altsubject_match2 wpa-altsubject-match2
+
+ wpa_cli_do "$IF_WPA_EAP_METHODS" raw \
+ set_network eap_methods wpa-eap-methods
+
+ wpa_cli_do "$IF_WPA_PHASE1" ascii \
+ set_network phase1 wpa-phase1
+
+ wpa_cli_do "$IF_WPA_PHASE2" ascii \
+ set_network phase2 wpa-phase2
+
+ wpa_cli_do "$IF_WPA_PCSC" raw \
+ set_network pcsc wpa-pcsc
+
+ wpa_cli_do "$IF_WPA_PIN" ascii \
+ set_network pin wpa-pin
+
+ wpa_cli_do "$IF_WPA_ENGINE" raw \
+ set_network engine wpa-engine
+
+ wpa_cli_do "$IF_WPA_ENGINE_ID" ascii \
+ set_network engine_id wpa-engine-id
+
+ wpa_cli_do "$IF_WPA_KEY_ID" ascii \
+ set_network key_id wpa-key-id
+
+ wpa_cli_do "$IF_WPA_EAPOL_FLAGS" raw \
+ set_network eapol_flags wpa-eapol-flags
+
+ if [ -n "$IF_WPA_WEP_KEY0" ]; then
+ wpa_key_check_and_set "$IF_WPA_WEP_KEY0" \
+ wep_key0 wpa-wep-key0
+ fi
+
+ if [ -n "$IF_WPA_WEP_KEY1" ]; then
+ wpa_key_check_and_set "$IF_WPA_WEP_KEY1" \
+ wep_key1 wpa-wep-key1
+ fi
+
+ if [ -n "$IF_WPA_WEP_KEY2" ]; then
+ wpa_key_check_and_set "$IF_WPA_WEP_KEY2" \
+ wep_key2 wpa-wep-key2
+ fi
+
+ if [ -n "$IF_WPA_WEP_KEY3" ]; then
+ wpa_key_check_and_set "$IF_WPA_WEP_KEY3" \
+ wep_key3 wpa-wep-key3
+ fi
+
+ wpa_cli_do "$IF_WPA_WEP_TX_KEYIDX" raw \
+ set_network wep_tx_keyidx wpa-wep-tx-keyidx
+
+ wpa_cli_do "$IF_WPA_PROACTIVE_KEY_CACHING" raw \
+ set_network proactive_key_caching wpa-proactive-key-caching
+
+ wpa_cli_do "$IF_WPA_PAC_FILE" ascii \
+ set_network pac_file wpa-pac-file
+
+ wpa_cli_do "$IF_WPA_PEERKEY" raw \
+ set_network peerkey wpa-peerkey
+
+ wpa_cli_do "$IF_FRAGMENT_SIZE" raw \
+ set_network fragment_size wpa-fragment-size
+
+ wpa_cli_do "$IF_WPA_ID_STR" ascii \
+ set_network id_str wpa-id-str
+
+ wpa_cli_do "$WPA_ID" raw \
+ enable_network "enabling network block"
+ fi
+}
+
+#####################################################################
+## Log wpa_cli environment variables
+wpa_log_env () {
+ wpa_msg log "WPA_IFACE=$WPA_IFACE WPA_ACTION=$WPA_ACTION"
+ wpa_msg log "WPA_ID=$WPA_ID WPA_ID_STR=$WPA_ID_STR WPA_CTRL_DIR=$WPA_CTRL_DIR"
+}
+
+#####################################################################
+## hysteresis checking
+# Networking tools such as dhcp clients used with ifupdown can
+# synthesize artificial ACTION events, particuarly just after a
+# DISCONNECTED/CONNECTED events are experienced in quick succession.
+# This can lead to infinite event loops, and in extreme cases has the
+# potential to cause system instability.
+#
+wpa_hysteresis_event () {
+ echo "$(date +%s)" > "$WPA_CLI_TIMESTAMP" 2>/dev/null
+}
+
+wpa_hysteresis_check () {
+ if [ -f "$WPA_CLI_TIMESTAMP" ]; then
+ local TIME
+ local TIMESTAMP
+ local TIMEWAIT
+ TIME=$(date +%s)
+ # current time minus 4 second event buffer
+ TIMEWAIT=$(($TIME-4))
+ # get time of last event
+ TIMESTAMP=$(cat $WPA_CLI_TIMESTAMP)
+ # compare values, allowing new action to be processed
+ # only if last action was more than 4 seconds ago
+ if [ "$TIMEWAIT" -le "$TIMESTAMP" ]; then
+ wpa_msg log "$WPA_ACTION event blocked by hysteresis check"
+ return 1
+ fi
+ fi
+
+ return 0
+}
+
+#####################################################################
+## ifupdown locking functions
+# A collection of rudimentary locking functions to lock ifup/ifdown
+# actions.
+#
+
+ifupdown_lock () {
+ ln -s lock "$WPA_CLI_IFUPDOWN"
+}
+
+ifupdown_locked () {
+ [ -L "$WPA_CLI_IFUPDOWN" ] && return 0
+
+ return 1
+}
+
+ifupdown_unlock () {
+ rm -f "$WPA_CLI_IFUPDOWN"
+}
+
+#####################################################################
+## apply mapping logic and ifup logical interface
+# Apply mapping logic via id_str or external mapping script, check
+# state of IFACE with respect to ifupdown and ifup logical interaface
+#
+ifup () {
+ local INTERFACES_FILE
+ local IFSTATE_FILE
+ local IFUP_RETVAL
+ local WPA_LOGICAL_IFACE
+
+ if [ -e /etc/network/interfaces ]; then
+ INTERFACES_FILE="/etc/network/interfaces"
+ else
+ wpa_msg log "/etc/network/interfaces does not exist, $WPA_IFACE will not be configured"
+ return 1
+ fi
+
+ if [ -e /etc/network/run/ifstate ]; then
+ # debian's ifupdown
+ IFSTATE_FILE="/etc/network/run/ifstate"
+ elif [ -e /var/run/network/ifstate ]; then
+ # ubuntu's
+ IFSTATE_FILE="/var/run/network/ifstate"
+ else
+ unset IFSTATE_FILE
+ fi
+
+ if [ -z "$IF_WPA_MAPPING_SCRIPT_PRIORITY" ] && [ -n "$WPA_ID_STR" ]; then
+ WPA_LOGICAL_IFACE="$WPA_ID_STR"
+ fi
+
+ if [ -z "$WPA_LOGICAL_IFACE" ] && [ -n "$IF_WPA_MAPPING_SCRIPT" ]; then
+ local WPA_MAP_STDIN
+
+ WPA_MAP_STDIN=$(set | sed -n 's/^\(IF_WPA_MAP[0-9]*\)=.*/echo \$\1/p')
+
+ if [ -n "$WPA_MAP_STDIN" ]; then
+ WPA_LOGICAL_IFACE=$(eval "$WPA_MAP_STDIN" | "$IF_WPA_MAPPING_SCRIPT" "$WPA_IFACE")
+ else
+ WPA_LOGICAL_IFACE=$("$IF_WPA_MAPPING_SCRIPT" "$WPA_IFACE")
+ fi
+
+ if [ -n "$WPA_LOGICAL_IFACE" ]; then
+ wpa_msg log "mapping script result: $WPA_LOGICAL_IFACE"
+ else
+ wpa_msg log "mapping script failed."
+ fi
+ fi
+
+ if [ -z "$WPA_LOGICAL_IFACE" ]; then
+ if [ -n "$IF_WPA_ROAM_DEFAULT_IFACE" ]; then
+ WPA_LOGICAL_IFACE="$IF_WPA_ROAM_DEFAULT_IFACE"
+ else
+ WPA_LOGICAL_IFACE="default"
+ fi
+ fi
+
+ if [ -n "$WPA_LOGICAL_IFACE" ]; then
+ if egrep -q "^iface[[:space:]]+${WPA_LOGICAL_IFACE}[[:space:]]+inet" "$INTERFACES_FILE"; then
+ : # logical network is defined
+ else
+ wpa_msg log "network settings not defined for $WPA_LOGICAL_IFACE in $INTERFACES_FILE"
+ WPA_LOGICAL_IFACE="default"
+ fi
+
+ wpa_msg log "ifup $WPA_IFACE=$WPA_LOGICAL_IFACE"
+
+ ifupdown_lock
+
+ if [ -n "$IFSTATE_FILE" ] && grep -q "^$WPA_IFACE=$WPA_IFACE" "$IFSTATE_FILE"; then
+ # Force settings over the unconfigured "master" IFACE
+ /sbin/ifup -v --force "$WPA_IFACE=$WPA_LOGICAL_IFACE"
+ else
+ /sbin/ifup -v "$WPA_IFACE=$WPA_LOGICAL_IFACE"
+ fi
+ IFUP_RETVAL="$?"
+
+ ifupdown_unlock
+ fi
+
+ wpa_msg log "creating sendsigs omission pidfile: $WPA_SUP_OMIT_PIDFILE"
+ cat "$WPA_SUP_PIDFILE" > "$WPA_SUP_OMIT_PIDFILE"
+
+ return "$IFUP_RETVAL"
+}
+
+#####################################################################
+## ifdown IFACE
+# Check IFACE state and ifdown as requested.
+#
+ifdown () {
+ wpa_msg log "ifdown $WPA_IFACE"
+
+ ifupdown_lock
+
+ /sbin/ifdown -v "$WPA_IFACE"
+
+ ifupdown_unlock
+
+ wpa_msg log "removing sendsigs omission pidfile: $WPA_SUP_OMIT_PIDFILE"
+ rm -f "$WPA_SUP_OMIT_PIDFILE"
+}
+
+#####################################################################
+## keep IFACE scanning
+# After ifdown, the IFACE may be left "down", and inhibits
+# wpa_supplicant's ability to continue roaming.
+#
+# NB: use iproute if present, flushing the IFACE first
+#
+if_post_down_up () {
+ if [ -x /bin/ip ]; then
+ ip addr flush dev "$WPA_IFACE" 2>/dev/null
+ ip link set "$WPA_IFACE" up
+ else
+ ifconfig "$WPA_IFACE" up
+ fi
+}
--- /dev/null
+#!/bin/sh
+
+#####################################################################
+## Purpose
+# This file is executed by ifupdown in pre-up, post-up, pre-down and
+# post-down phases of network interface configuration. It allows
+# ifup(8), and ifdown(8) to manage wpa_supplicant(8) and wpa_cli(8)
+# processes running in daemon mode.
+#
+# /etc/wpa_supplicant/functions.sh is sourced by this file.
+#
+# This file is provided by the wpasupplicant package.
+
+#####################################################################
+# Copyright (C) 2006 - 2009 Debian/Ubuntu wpasupplicant Maintainers
+# <pkg-wpa-devel@lists.alioth.debian.org>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# On Debian GNU/Linux systems, the text of the GPL license,
+# version 2, can be found in /usr/share/common-licenses/GPL-2.
+
+if [ -n "$IF_WPA_MAINT_DEBUG" ]; then
+ set -x
+fi
+
+# quit if we're called for the loopback
+if [ "$IFACE" = lo ]; then
+ exit 0
+fi
+
+# allow wpa_supplicant interface to be specified via wpa-iface
+# useful for starting wpa_supplicant on one interface of a bridge
+if [ -n "$IF_WPA_IFACE" ]; then
+ WPA_IFACE="$IF_WPA_IFACE"
+else
+ WPA_IFACE="$IFACE"
+fi
+
+# source functions
+if [ -f /etc/wpa_supplicant/functions.sh ]; then
+ . /etc/wpa_supplicant/functions.sh
+else
+ exit 0
+fi
+
+# quit if executables are not installed
+if [ ! -x "$WPA_SUP_BIN" ] || [ ! -x "$WPA_CLI_BIN" ]; then
+ exit 0
+fi
+
+do_start () {
+ if test_wpa_cli; then
+ # if wpa_action is active for this IFACE, do nothing
+ ifupdown_locked && exit 0
+
+ # if the administrator is calling ifup, say something useful
+ if [ "$PHASE" = "pre-up" ]; then
+ wpa_msg stderr "wpa_action is managing ifup/ifdown state of $WPA_IFACE"
+ wpa_msg stderr "execute \`ifdown --force $WPA_IFACE' to stop wpa_action"
+ fi
+ exit 1
+ elif ! set | grep -q "^IF_WPA"; then
+ # no wpa- option defined for IFACE, do nothing
+ exit 0
+ fi
+
+ # ensure stale ifupdown_lock marker is purged
+ ifupdown_unlock
+
+ # preliminary sanity checks for roaming daemon
+ if [ -n "$IF_WPA_ROAM" ]; then
+ if [ "$METHOD" != "manual" ]; then
+ wpa_msg stderr "wpa-roam can only be used with the \"manual\" inet METHOD"
+ exit 1
+ fi
+ if [ -n "$IF_WPA_MAPPING_SCRIPT" ]; then
+ if ! type "$IF_WPA_MAPPING_SCRIPT" >/dev/null; then
+ wpa_msg stderr "wpa-mapping-script \"$IF_WPA_MAPPING_SCRIPT\" is not valid"
+ exit 1
+ fi
+ fi
+ if [ -n "$IF_WPA_MAPPING_SCRIPT_PRIORITY" ] && [ -z "$IF_WPA_MAPPING_SCRIPT" ]; then
+ wpa_msg stderr "\"wpa-mapping-script-priority 1\" is invalid without a wpa-mapping-script"
+ exit 1
+ fi
+ IF_WPA_CONF="$IF_WPA_ROAM"
+ WPA_ACTION_SCRIPT="/usr/sbin/wpa_action"
+ fi
+
+ # master function; determines if ifupdown.sh should do something or not
+ if [ -n "$IF_WPA_CONF" ] && [ "$IF_WPA_CONF" != "managed" ]; then
+ if [ ! -s "$IF_WPA_CONF" ]; then
+ wpa_msg stderr "cannot read contents of $IF_WPA_CONF"
+ exit 1
+ fi
+ WPA_SUP_CONF_CTRL_DIR=$(sed -n -e 's/[[:space:]]*#.*//g' -e 's/[[:space:]]\+.*$//g' \
+ -e 's/^ctrl_interface=\(DIR=\)\?\(.*\)/\2/p' "$IF_WPA_CONF")
+ if [ -n "$WPA_SUP_CONF_CTRL_DIR" ]; then
+ WPA_CTRL_DIR="$WPA_SUP_CONF_CTRL_DIR"
+ WPA_SUP_CONF="-c $IF_WPA_CONF"
+ else
+ # specify the default ctrl_interface since none was defined in
+ # the given IF_WPA_CONF
+ WPA_SUP_CONF="-c $IF_WPA_CONF -C $WPA_CTRL_DIR"
+ fi
+ else
+ # specify the default ctrl_interface
+ WPA_SUP_CONF="-C $WPA_CTRL_DIR"
+ fi
+}
+
+do_stop () {
+ if test_wpa_cli; then
+ # if wpa_action is active for this IFACE and calling ifdown,
+ # do nothing
+ ifupdown_locked && exit 0
+ elif test_wpa_supplicant; then
+ # wpa_supplicant process exists for this IFACE, but wpa_cli
+ # process does not. Allow stop mode to kill this process.
+ :
+ else
+ exit 0
+ fi
+}
+
+case "$MODE" in
+ start)
+ do_start
+ case "$PHASE" in
+ pre-up)
+ kill_wpa_supplicant
+ init_wpa_supplicant || exit 1
+ conf_wpa_supplicant || { kill_wpa_supplicant; exit 1; }
+ ;;
+ post-up)
+ init_wpa_cli || { kill_wpa_supplicant; exit 1; }
+ ;;
+ esac
+ ;;
+
+ stop)
+ do_stop
+ case "$PHASE" in
+ pre-down)
+ kill_wpa_cli
+ ;;
+ post-down)
+ kill_wpa_supplicant
+ ;;
+ *)
+ wpa_msg stderr "unknown phase: \"$PHASE\""
+ exit 1
+ ;;
+ esac
+ ;;
+
+ *)
+ wpa_msg stderr "unknown mode: \"$MODE\""
+ exit 1
+ ;;
+esac
+
+exit 0
--- /dev/null
+#!/bin/sh
+
+# Copyright (C) 2006 - 2009 Debian/Ubuntu wpasupplicant Maintainers
+# <pkg-wpa-devel@lists.alioth.debian.org>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# On Debian GNU/Linux systems, the text of the GPL license,
+# version 2, can be found in /usr/share/common-licenses/GPL-2.
+
+if [ -n "$IF_WPA_ROAM_MAINT_DEBUG" ]; then
+ set -x
+fi
+
+if [ -z "$1" ] || [ -z "$2" ]; then
+ echo "Usage: $0 IFACE ACTION"
+ exit 1
+fi
+
+# network interface
+WPA_IFACE="$1"
+# [CONNECTED|DISCONNECTED|stop|reload|check]
+WPA_ACTION="$2"
+
+if [ -f /etc/wpa_supplicant/functions.sh ]; then
+ . /etc/wpa_supplicant/functions.sh
+else
+ exit 0
+fi
+
+case "$WPA_ACTION" in
+ "CONNECTED")
+ wpa_log_env
+ wpa_hysteresis_check || exit 1
+ wpa_hysteresis_event
+ if ifup; then
+ wpa_cli status | wpa_msg log
+ else
+ wpa_cli status | wpa_msg log
+ wpa_cli reassociate
+ fi
+ ;;
+
+ "DISCONNECTED")
+ wpa_log_env
+ wpa_hysteresis_check || exit 1
+ ifdown
+ if_post_down_up
+ ;;
+
+ "stop"|"down")
+ test_wpa_cli && kill_wpa_cli
+ ifdown
+ test_wpa_supplicant && kill_wpa_supplicant
+ ;;
+
+ "restart"|"reload")
+ test_wpa_supplicant || exit 1
+ reload_wpa_supplicant
+ ;;
+
+ "check")
+ test_wpa_supplicant || exit 1
+ test_wpa_cli || exit 1
+ ;;
+
+ *)
+ echo "Unknown action: \"$WPA_ACTION\""
+ exit 1
+ ;;
+esac
+
+exit 0
--- /dev/null
+.TH WPA_ACTION "8" "26 May 2006" "" ""
+.SH NAME
+wpa_action \- wpa_cli action script
+.SH SYNOPSIS
+\fBwpa_action\fR \fIIFACE ACTION\fR
+.SH "DESCRIPTION"
+\fBwpa_action\fR is a shell script designed to control the \fBifupdown\fR
+framework according to \fIACTION\fR events received from \fBwpa_supplicant\fR.
+\fBwpa_cli\fR receives \fICONNECTED\fR and \fIDISCONNECTED\fR events from
+\fBwpa_supplicant\fR via the crtl_iface socket and gives the \fIACTION\fR event
+to the \fBwpa_action\fR script as an argument, along with the \fIIFACE\fR to be
+acted upon.
+.PP
+\fBwpa_action\fR also receives an environment variable from \fBwpa_cli\fR,
+\fIWPA_ID_STR\fR, containing an alphanumeric identification string for the
+\fICURRENT\fR network block. \fIWPA_ID_STR\fR is provided by the 'id_str'
+network block option of \fBwpa_supplicant.conf\fR, and provides a means to map
+the \fIACTION\fR to a \fILOGICAL\fR interface configured in the \fBinterfaces\fR
+file.
+.PP
+If either the ifupdown \fBinterfaces\fR or \fIifstate\fR file cannot be found,
+\fBwpa_action\fR will exit silently (status 0). \fBwpa_action\fR will search
+the following locations for their existance:
+.nf
+ /etc/network/run/ifstate
+ /var/run/network/ifstate
+ /etc/network/interfaces
+.fi
+.PP
+.SH IFACE
+Network interface to be acted upon, for example 'eth1' or 'wlan0'.
+.SH ACTION
+An \fIACTION\fR to be performed on the \fIIFACE\fR.
+.TP
+\fBCONNECTED\fR
+\fBwpa_supplicant\fR has completed authentication.
+\fBifup\fR \fIIFACE=WPA_ID_STR\fR is invoked and the action is logged to
+syslog. Network settings for the \fILOGICAL\fR interface \fIWPA_ID_STR\fR
+are applied.
+.TP
+\fBDISCONNECTED\fR
+\fBwpa_supplicant\fR has detected disconnection.
+\fBifdown\fR \fIIFACE=WPA_ID_STR\fR is invoked and the action is logged to
+syslog. Network settings for the \fILOGICAL\fR interface \fIWPA_ID_STR\fR
+are undone.
+.TP
+\fBstop\fR
+The 'stop' \fIACTION\fR is a called manually by the user, to stop the
+\fBwpa_cli\fR daemon, invoke \fBifdown\fR \fIIFACE\fR (if the \fIIFACE\fR is
+present in the \fIifstate\fR file) and stop the \fBwpa_supplicant\fR daemon.
+.TP
+\fBreload\fR
+The 'reload' \fIACTION\fR can be used to reload the \fBwpa_supplicant\fR
+configuration file specified by \fIwpa-roam\fR . 'restart' is a synonym
+for 'reload' and can be used equally. The action is logged to
+\fI/var/log/wpa_action.log\fR.
+.SH ENVIRONMENT
+An alphanumeric identification string provided by the 'id_str' network block
+option of \fBwpa_supplicant.conf\fR is exported to \fBwpa_action\fR as an
+environment variable, \fIWPA_ID_STR\fR. When 'id_str' is not configured for the
+\fICURRENT\fR network block, 'default' is substituted for the absent
+\fIWPA_ID_STR\fR environment variable.
+.PP
+A unique network identifier, \fIWPA_ID\fR, is exported to \fBwpa_action\fR. It
+is the number assigned to the \fICURRENT\fR \fBwpa_supplicant\fR network block
+(network_id).
+.SH USAGE
+The only reasons for \fBwpa_action\fR to be explicitly executed by the user is
+to stop \fBwpa_cli\fR from controlling \fBifupdown\fR or reload the
+\fIwpa_supplicant.conf\fR file after editing.
+.PP
+.RS
+\fBwpa_action\fR \fIeth1 stop\fR
+.RE
+.PP
+Otherwise, \fBwpa_action\fR is given as an argument to a \fBwpa_cli\fR
+daemon.
+.PP
+.RS
+\fBwpa_cli\fR \fI-i eth1 -a /sbin/wpa_action -B\fR
+.RE
+.PP
+This can be done by using the \fIwpa-roam\fR option in the \fBinterfaces\fR
+file. \fIwpa-roam\fR takes one argument, a user provided
+\fBwpa_supplicant.conf\fR file.
+.PP
+The inet \fIMETHOD\fR must be 'manual' for this interface, as it will
+be configured according to \fBwpa_cli\fR action events. Also supply a 'default'
+\fBinterfaces\fR stanza using the dhcp inet \fIMETHOD\fR so that networks
+without an 'id_str' option can fallback to attempting to receive an ip via
+dhcp. If one or more networks requires additional network configuration,
+provide an unique 'id_str' for each network, and an \fBinterfaces\fR stanza
+using the 'id_str' value as a \fILOGICAL\fR interface. The following interfaces
+file is configured to use dhcp for any network without an 'id_str', a static ip
+for the network with an 'id_str' of 'home_static' and dhcp plus an additional
+post-up command for the network with an 'id_str' of 'uni'.
+.PP
+An example wpa_supplicant.conf configured to roam between 3 different networks:
+.PP
+.RS
+.nf
+network={
+ ssid="foo"
+ id_str="uni"
+ key_mgmt=NONE
+}
+
+network={
+ ssid="bar"
+ id_str="home_static"
+ psk=123456789...
+}
+
+network={
+ ssid=""
+ key_mgmt=NONE
+}
+.fi
+.RE
+.PP
+The corresponding \fBinterfaces\fR file would contain \fILOGICAL\fR interfaces,
+that correlate to each unique 'id_str' provided by the configuration file:
+.PP
+.RS
+.nf
+iface eth1 inet manual
+ wpa-driver wext
+ wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
+
+iface default inet dhcp
+
+iface uni inet dhcp
+
+iface home_static inet static
+ address 192.168.0.20
+ netmask 255.255.255.0
+ network 192.168.0.0
+ broadcast 192.168.0.255
+ gateway 192.168.0.1
+.fi
+.RE
+.PP
+.SH SEE ALSO
+\fBwpa_cli(8)\fR, \fBwpa_supplicant(8)\fR, \fBwpa_supplicant.conf(5)\fR,
+\fBifup(8)\fR, \fBinterfaces(5)\fR
+.SH AUTHOR
+This manual page was written by Kel Modderman <kel@otaku42.de> for
+the Debian GNU system (but may be used by others).
+++ /dev/null
-DEPENDS += "openssl"
-PR .= "-vuplus0"
-
-SRC_URI += " \
- file://action_wpa.sh \
- file://functions.sh \
- file://ifupdown.sh \
- file://wpa_action \
- file://wpa_action.8 \
-"
-
-do_configure_append() {
- sed -e '/^CONFIG_TLS = gnutls/d' -i .config
- echo "CONFIG_DEBUG_SYSLOG=y" >> .config
-}
-do_install_append() {
- rm -rf ${D}${sysconfdir}/network/if-*.d
-
- install -d ${D}${sysconfdir}/wpa_supplicant
- install -m 755 ${WORKDIR}/action_wpa.sh ${D}${sysconfdir}/wpa_supplicant
- install -m 755 ${WORKDIR}/functions.sh ${D}${sysconfdir}/wpa_supplicant
- install -m 755 ${WORKDIR}/ifupdown.sh ${D}${sysconfdir}/wpa_supplicant
-
- install -d ${D}${sbindir}
- install -m 755 ${WORKDIR}/wpa_action ${D}${sbindir}
-
- install -d ${D}${mandir}/man8
- install -m 755 ${WORKDIR}/wpa_action.8 ${D}${mandir}/man8
-
- install -d ${D}${sysconfdir}/network/if-down.d
- install -d ${D}${sysconfdir}/network/if-post-down.d
- install -d ${D}${sysconfdir}/network/if-pre-up.d
- install -d ${D}${sysconfdir}/network/if-up.d
- ln -s ../../wpa_supplicant/ifupdown.sh ${D}${sysconfdir}/network/if-down.d/${PN}
- ln -s ../../wpa_supplicant/ifupdown.sh ${D}${sysconfdir}/network/if-post-down.d/${PN}
- ln -s ../../wpa_supplicant/ifupdown.sh ${D}${sysconfdir}/network/if-pre-up.d/${PN}
- ln -s ../../wpa_supplicant/ifupdown.sh ${D}${sysconfdir}/network/if-up.d/${PN}
-}
-
-FILESEXTRAPATHS_prepend := "${THISDIR}/${P}:"
--- /dev/null
+DEPENDS += "openssl"
+PR .= "-vuplus0"
+
+SRC_URI += " \
+ file://action_wpa.sh \
+ file://functions.sh \
+ file://ifupdown.sh \
+ file://wpa_action \
+ file://wpa_action.8 \
+"
+
+do_configure_append() {
+ sed -e '/^CONFIG_TLS = gnutls/d' -i wpa_supplicant/.config
+ echo "CONFIG_DEBUG_SYSLOG=y" >> wpa_supplicant/.config
+}
+do_install_append() {
+ rm -rf ${D}${sysconfdir}/network/if-*.d
+
+ install -d ${D}${sysconfdir}/wpa_supplicant
+ install -m 755 ${WORKDIR}/action_wpa.sh ${D}${sysconfdir}/wpa_supplicant
+ install -m 755 ${WORKDIR}/functions.sh ${D}${sysconfdir}/wpa_supplicant
+ install -m 755 ${WORKDIR}/ifupdown.sh ${D}${sysconfdir}/wpa_supplicant
+
+ install -d ${D}${sbindir}
+ install -m 755 ${WORKDIR}/wpa_action ${D}${sbindir}
+
+ install -d ${D}${mandir}/man8
+ install -m 755 ${WORKDIR}/wpa_action.8 ${D}${mandir}/man8
+
+ install -d ${D}${sysconfdir}/network/if-down.d
+ install -d ${D}${sysconfdir}/network/if-post-down.d
+ install -d ${D}${sysconfdir}/network/if-pre-up.d
+ install -d ${D}${sysconfdir}/network/if-up.d
+ ln -s ../../wpa_supplicant/ifupdown.sh ${D}${sysconfdir}/network/if-down.d/${PN}
+ ln -s ../../wpa_supplicant/ifupdown.sh ${D}${sysconfdir}/network/if-post-down.d/${PN}
+ ln -s ../../wpa_supplicant/ifupdown.sh ${D}${sysconfdir}/network/if-pre-up.d/${PN}
+ ln -s ../../wpa_supplicant/ifupdown.sh ${D}${sysconfdir}/network/if-up.d/${PN}
+}
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/${P}:"
--- /dev/null
+diff --git a/wvmodemscan.cc b/wvmodemscan.cc
+index ef5ab87..f97581e 100644
+--- a/wvmodemscan.cc
++++ b/wvmodemscan.cc
+@@ -503,11 +503,16 @@ static int fileselect(const struct dirent *e)
+ #endif
+ }
+
+-
++#if defined(__GLIBC__) && __GLIBC_PREREQ(2, 10)
++static int filesort(const struct dirent **e1, const struct dirent **e2)
++#else
+ static int filesort(const void *_e1, const void *_e2)
++#endif
+ {
++#if !(defined(__GLIBC__) && __GLIBC_PREREQ(2, 10))
+ dirent const * const *e1 = (dirent const * const *)_e1;
+ dirent const * const *e2 = (dirent const * const *)_e2;
++#endif
+ const char *p1, *p2;
+ int diff;
+
SRC_URI = "\
http://www.alumnit.ca/download/wvdial-1.60.tar.gz \
- file://wvdial-vuplus_001.patch;patch=1 \
+ file://wvdial-vuplus_001.patch \
+ file://wvdial_fileselect.patch \
"
DEPENDS = "wvstreams ppp"
RDEPENDS_${PN} = "ppp wvstreams"
-inherit autotools pkgconfig
+inherit autotools-brokensep pkgconfig
CFLAGS += " -Wno-write-strings "
LDFLAGS = " -L ${CROSS_DIR}/${TARGET_SYS}/usr/lib -luniconf -lwvstreams -lwvbase -lwvutils "
--- /dev/null
+diff --git a/utils/wvuid.cc b/utils/wvuid.cc
+index 7fa1035..709a484 100644
+--- a/utils/wvuid.cc
++++ b/utils/wvuid.cc
+@@ -33,6 +33,7 @@ wvuid_t wvgetuid()
+
+ #else // not WIN32
+
++#include <unistd.h>
+
+ WvString wv_username_from_uid(wvuid_t uid)
+ {
DEPENDS = "zlib openssl (>= 0.9.8)"
SRC_URI = "http://wvstreams.googlecode.com/files/${PN}-${PV}.tar.gz \
- file://vuplus-wvstreams-build-fix.patch;patch=1;pnum=1 \
+ file://vuplus-wvstreams-build-fix.patch \
+ file://vuplus-wvstreams-build-fix_getuid.patch \
"
-inherit autotools pkgconfig
+inherit autotools-brokensep pkgconfig
LDFLAGS_append = " -Wl,-rpath-link,${CROSS_DIR}/${TARGET_SYS}/lib"
EXTRA_OECONF = " --without-tcl --without-qt --without-pam "
+++ /dev/null
-PR .= "-vuplus0"
-
-do_install_append() {
- sed -e 's,^#FALLBACK=yes,FALLBACK=yes,' -i ${D}${sysconfdir}/default/zeroconf
-}
-PR .= "-vuplus6"
+PR .= "-vuplus0"
do_install_append() {
- ln -s media/hdd ${D}/hdd
+ rm -rf ${D}/hdd
+ rm -rf ${D}/mnt
+ ln -sf media/hdd ${D}/hdd
+ ln -sf media ${D}/mnt
- rm -r ${D}/mnt
- ln -s media ${D}/mnt
-
- ln -s var/run ${D}/run
+ ln -sf var/run ${D}/run
}
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
-
+++ /dev/null
-From b58a1a06ca695aed6a4f6e5039e2de0e5a3df111 Mon Sep 17 00:00:00 2001
-From: Peter Korsgaard <jacmet@sunsite.dk>
-Date: Wed, 19 Oct 2011 02:35:54 +0200
-Subject: [PATCH 01/10] ifupdown: support post-up / pre-down hooks
-
-function old new delta
-set_environ 330 371 +41
-ifupdown_main 2156 2194 +38
-iface_up 97 113 +16
-iface_down 97 113 +16
-------------------------------------------------------------------------------
-(add/remove: 0/0 grow/shrink: 4/0 up/down: 111/0) Total: 111 bytes
-
-Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
-Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
----
- networking/ifupdown.c | 6 ++++++
- 1 file changed, 6 insertions(+)
-
-diff --git a/networking/ifupdown.c b/networking/ifupdown.c
-index 3820330..abc6b58 100644
---- a/networking/ifupdown.c
-+++ b/networking/ifupdown.c
-@@ -891,6 +891,8 @@ static struct interfaces_file_t *read_interfaces(const char *filename)
- if (strcmp(first_word, "up") != 0
- && strcmp(first_word, "down") != 0
- && strcmp(first_word, "pre-up") != 0
-+ && strcmp(first_word, "pre-down") != 0
-+ && strcmp(first_word, "post-up") != 0
- && strcmp(first_word, "post-down") != 0
- ) {
- int i;
-@@ -987,6 +989,8 @@ static void set_environ(struct interface_defn_t *iface, const char *mode)
- if (strcmp(iface->option[i].name, "up") == 0
- || strcmp(iface->option[i].name, "down") == 0
- || strcmp(iface->option[i].name, "pre-up") == 0
-+ || strcmp(iface->option[i].name, "pre-down") == 0
-+ || strcmp(iface->option[i].name, "post-up") == 0
- || strcmp(iface->option[i].name, "post-down") == 0
- ) {
- continue;
-@@ -1056,6 +1060,7 @@ static int iface_up(struct interface_defn_t *iface)
- if (!execute_all(iface, "pre-up")) return 0;
- if (!iface->method->up(iface, doit)) return 0;
- if (!execute_all(iface, "up")) return 0;
-+ if (!execute_all(iface, "post-up")) return 0;
- return 1;
- }
-
-@@ -1063,6 +1068,7 @@ static int iface_down(struct interface_defn_t *iface)
- {
- if (!iface->method->down(iface,check)) return -1;
- set_environ(iface, "stop");
-+ if (!execute_all(iface, "pre-down")) return 0;
- if (!execute_all(iface, "down")) return 0;
- if (!iface->method->down(iface, doit)) return 0;
- if (!execute_all(iface, "post-down")) return 0;
---
-1.7.10.4
-
+++ /dev/null
-From caf5768154301697430f0a3718838967d0f55f95 Mon Sep 17 00:00:00 2001
-From: Denys Vlasenko <vda.linux@googlemail.com>
-Date: Thu, 12 Apr 2012 14:01:10 +0200
-Subject: [PATCH 01/33] work around linux/ext2_fs.h breakage
-
-See https://bugzilla.kernel.org/show_bug.cgi?id=42986
-
-Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
----
- e2fsprogs/tune2fs.c | 6 ++++++
- util-linux/mkfs_ext2.c | 6 ++++++
- 2 files changed, 12 insertions(+)
-
-diff --git a/e2fsprogs/tune2fs.c b/e2fsprogs/tune2fs.c
-index 020bdaa..8da7432 100644
---- a/e2fsprogs/tune2fs.c
-+++ b/e2fsprogs/tune2fs.c
-@@ -8,6 +8,12 @@
- */
- #include "libbb.h"
- #include <linux/fs.h>
-+/*
-+ * Work around linux/ext2_fs.h breakage.
-+ * See https://bugzilla.kernel.org/show_bug.cgi?id=42986.
-+ */
-+typedef mode_t bb__umode_t;
-+#define umode_t bb__umode_t
- #include <linux/ext2_fs.h>
-
- // storage helpers
-diff --git a/util-linux/mkfs_ext2.c b/util-linux/mkfs_ext2.c
-index 6cbbe0e..759bb0a 100644
---- a/util-linux/mkfs_ext2.c
-+++ b/util-linux/mkfs_ext2.c
-@@ -48,6 +48,12 @@
-
- #include "libbb.h"
- #include <linux/fs.h>
-+/*
-+ * Work around linux/ext2_fs.h breakage.
-+ * See https://bugzilla.kernel.org/show_bug.cgi?id=42986.
-+ */
-+typedef mode_t bb__umode_t;
-+#define umode_t bb__umode_t
- #include <linux/ext2_fs.h>
-
- #define ENABLE_FEATURE_MKFS_EXT2_RESERVED_GDT 0
---
-1.7.9.5
-
+++ /dev/null
-From 0b2b0f31a38d77ebfb2a6416011562687ef58191 Mon Sep 17 00:00:00 2001
-From: Denys Vlasenko <vda.linux@googlemail.com>
-Date: Fri, 13 Apr 2012 16:39:18 +0200
-Subject: [PATCH 01/32] Create and use our own copy of linux/ext2_fs.h
-
-Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
----
- e2fsprogs/tune2fs.c | 8 +-
- include/bb_linux_ext2_fs.h | 547 ++++++++++++++++++++++++++++++++++++++++++++
- util-linux/mkfs_ext2.c | 8 +-
- 3 files changed, 549 insertions(+), 14 deletions(-)
- create mode 100644 include/bb_linux_ext2_fs.h
-
-diff --git a/e2fsprogs/tune2fs.c b/e2fsprogs/tune2fs.c
-index 8da7432..841d58a 100644
---- a/e2fsprogs/tune2fs.c
-+++ b/e2fsprogs/tune2fs.c
-@@ -8,13 +8,7 @@
- */
- #include "libbb.h"
- #include <linux/fs.h>
--/*
-- * Work around linux/ext2_fs.h breakage.
-- * See https://bugzilla.kernel.org/show_bug.cgi?id=42986.
-- */
--typedef mode_t bb__umode_t;
--#define umode_t bb__umode_t
--#include <linux/ext2_fs.h>
-+#include "bb_linux_ext2_fs.h"
-
- // storage helpers
- char BUG_wrong_field_size(void);
-diff --git a/include/bb_linux_ext2_fs.h b/include/bb_linux_ext2_fs.h
-new file mode 100644
-index 0000000..fdc470b
---- /dev/null
-+++ b/include/bb_linux_ext2_fs.h
-@@ -0,0 +1,547 @@
-+/*
-+ * Work around linux/ext2_fs.h breakage.
-+ * linux/ext2_fs.h might be removed from future kernel header distribution.
-+ * See https://bugzilla.kernel.org/show_bug.cgi?id=42986
-+ *
-+ * Licensed under GPLv2, see file LICENSE in this source tree.
-+ */
-+#ifndef BB_LINUX_EXT2_FS_H
-+#define BB_LINUX_EXT2_FS_H
-+
-+/*
-+ * From linux/magic.h
-+ */
-+
-+#define EXT2_SUPER_MAGIC 0xEF53
-+#define EXT3_SUPER_MAGIC 0xEF53
-+#define EXT4_SUPER_MAGIC 0xEF53
-+
-+/*
-+ * From linux/ext2_fs.h, with minor changes.
-+ */
-+
-+/*
-+ * Copyright (C) 1992, 1993, 1994, 1995
-+ * Remy Card (card@masi.ibp.fr)
-+ * Laboratoire MASI - Institut Blaise Pascal
-+ * Universite Pierre et Marie Curie (Paris VI)
-+ *
-+ * from
-+ *
-+ * linux/include/linux/minix_fs.h
-+ *
-+ * Copyright (C) 1991, 1992 Linus Torvalds
-+ */
-+
-+/*
-+ * The second extended filesystem constants/structures
-+ */
-+
-+/*
-+ * Define EXT2_RESERVATION to reserve data blocks for expanding files
-+ */
-+#define EXT2_DEFAULT_RESERVE_BLOCKS 8
-+/*max window size: 1024(direct blocks) + 3([t,d]indirect blocks) */
-+#define EXT2_MAX_RESERVE_BLOCKS 1027
-+#define EXT2_RESERVE_WINDOW_NOT_ALLOCATED 0
-+
-+/*
-+ * Special inode numbers
-+ */
-+#define EXT2_BAD_INO 1 /* Bad blocks inode */
-+#define EXT2_ROOT_INO 2 /* Root inode */
-+#define EXT2_BOOT_LOADER_INO 5 /* Boot loader inode */
-+#define EXT2_UNDEL_DIR_INO 6 /* Undelete directory inode */
-+
-+/* First non-reserved inode for old ext2 filesystems */
-+#define EXT2_GOOD_OLD_FIRST_INO 11
-+
-+/* Assume that user mode programs are passing in an ext2fs superblock, not
-+ * a kernel struct super_block. This will allow us to call the feature-test
-+ * macros from user land. */
-+#define EXT2_SB(sb) (sb)
-+
-+/*
-+ * Maximal count of links to a file
-+ */
-+#define EXT2_LINK_MAX 32000
-+
-+/*
-+ * Macro-instructions used to manage several block sizes
-+ */
-+#define EXT2_MIN_BLOCK_SIZE 1024
-+#define EXT2_MAX_BLOCK_SIZE 4096
-+#define EXT2_MIN_BLOCK_LOG_SIZE 10
-+# define EXT2_BLOCK_SIZE(s) (EXT2_MIN_BLOCK_SIZE << (s)->s_log_block_size)
-+#define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (uint32_t))
-+# define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10)
-+#define EXT2_INODE_SIZE(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
-+ EXT2_GOOD_OLD_INODE_SIZE : \
-+ (s)->s_inode_size)
-+#define EXT2_FIRST_INO(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
-+ EXT2_GOOD_OLD_FIRST_INO : \
-+ (s)->s_first_ino)
-+
-+/*
-+ * Macro-instructions used to manage fragments
-+ */
-+#define EXT2_MIN_FRAG_SIZE 1024
-+#define EXT2_MAX_FRAG_SIZE 4096
-+#define EXT2_MIN_FRAG_LOG_SIZE 10
-+# define EXT2_FRAG_SIZE(s) (EXT2_MIN_FRAG_SIZE << (s)->s_log_frag_size)
-+# define EXT2_FRAGS_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / EXT2_FRAG_SIZE(s))
-+
-+/*
-+ * Structure of a blocks group descriptor
-+ */
-+struct ext2_group_desc
-+{
-+ uint32_t bg_block_bitmap; /* Blocks bitmap block */
-+ uint32_t bg_inode_bitmap; /* Inodes bitmap block */
-+ uint32_t bg_inode_table; /* Inodes table block */
-+ uint16_t bg_free_blocks_count; /* Free blocks count */
-+ uint16_t bg_free_inodes_count; /* Free inodes count */
-+ uint16_t bg_used_dirs_count; /* Directories count */
-+ uint16_t bg_pad;
-+ uint32_t bg_reserved[3];
-+};
-+
-+/*
-+ * Macro-instructions used to manage group descriptors
-+ */
-+# define EXT2_BLOCKS_PER_GROUP(s) ((s)->s_blocks_per_group)
-+# define EXT2_DESC_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (struct ext2_group_desc))
-+# define EXT2_INODES_PER_GROUP(s) ((s)->s_inodes_per_group)
-+
-+/*
-+ * Constants relative to the data blocks
-+ */
-+#define EXT2_NDIR_BLOCKS 12
-+#define EXT2_IND_BLOCK EXT2_NDIR_BLOCKS
-+#define EXT2_DIND_BLOCK (EXT2_IND_BLOCK + 1)
-+#define EXT2_TIND_BLOCK (EXT2_DIND_BLOCK + 1)
-+#define EXT2_N_BLOCKS (EXT2_TIND_BLOCK + 1)
-+
-+/*
-+ * Inode flags (GETFLAGS/SETFLAGS)
-+ */
-+#define EXT2_SECRM_FL FS_SECRM_FL /* Secure deletion */
-+#define EXT2_UNRM_FL FS_UNRM_FL /* Undelete */
-+#define EXT2_COMPR_FL FS_COMPR_FL /* Compress file */
-+#define EXT2_SYNC_FL FS_SYNC_FL /* Synchronous updates */
-+#define EXT2_IMMUTABLE_FL FS_IMMUTABLE_FL /* Immutable file */
-+#define EXT2_APPEND_FL FS_APPEND_FL /* writes to file may only append */
-+#define EXT2_NODUMP_FL FS_NODUMP_FL /* do not dump file */
-+#define EXT2_NOATIME_FL FS_NOATIME_FL /* do not update atime */
-+/* Reserved for compression usage... */
-+#define EXT2_DIRTY_FL FS_DIRTY_FL
-+#define EXT2_COMPRBLK_FL FS_COMPRBLK_FL /* One or more compressed clusters */
-+#define EXT2_NOCOMP_FL FS_NOCOMP_FL /* Don't compress */
-+#define EXT2_ECOMPR_FL FS_ECOMPR_FL /* Compression error */
-+/* End compression flags --- maybe not all used */
-+#define EXT2_BTREE_FL FS_BTREE_FL /* btree format dir */
-+#define EXT2_INDEX_FL FS_INDEX_FL /* hash-indexed directory */
-+#define EXT2_IMAGIC_FL FS_IMAGIC_FL /* AFS directory */
-+#define EXT2_JOURNAL_DATA_FL FS_JOURNAL_DATA_FL /* Reserved for ext3 */
-+#define EXT2_NOTAIL_FL FS_NOTAIL_FL /* file tail should not be merged */
-+#define EXT2_DIRSYNC_FL FS_DIRSYNC_FL /* dirsync behaviour (directories only) */
-+#define EXT2_TOPDIR_FL FS_TOPDIR_FL /* Top of directory hierarchies*/
-+#define EXT2_RESERVED_FL FS_RESERVED_FL /* reserved for ext2 lib */
-+
-+#define EXT2_FL_USER_VISIBLE FS_FL_USER_VISIBLE /* User visible flags */
-+#define EXT2_FL_USER_MODIFIABLE FS_FL_USER_MODIFIABLE /* User modifiable flags */
-+
-+/* Flags that should be inherited by new inodes from their parent. */
-+#define EXT2_FL_INHERITED (EXT2_SECRM_FL | EXT2_UNRM_FL | EXT2_COMPR_FL |\
-+ EXT2_SYNC_FL | EXT2_IMMUTABLE_FL | EXT2_APPEND_FL |\
-+ EXT2_NODUMP_FL | EXT2_NOATIME_FL | EXT2_COMPRBLK_FL|\
-+ EXT2_NOCOMP_FL | EXT2_JOURNAL_DATA_FL |\
-+ EXT2_NOTAIL_FL | EXT2_DIRSYNC_FL)
-+
-+/* Flags that are appropriate for regular files (all but dir-specific ones). */
-+#define EXT2_REG_FLMASK (~(EXT2_DIRSYNC_FL | EXT2_TOPDIR_FL))
-+
-+/* Flags that are appropriate for non-directories/regular files. */
-+#define EXT2_OTHER_FLMASK (EXT2_NODUMP_FL | EXT2_NOATIME_FL)
-+
-+/* Mask out flags that are inappropriate for the given type of inode. */
-+static inline uint32_t ext2_mask_flags(mode_t mode, uint32_t flags)
-+{
-+ if (S_ISDIR(mode))
-+ return flags;
-+ else if (S_ISREG(mode))
-+ return flags & EXT2_REG_FLMASK;
-+ else
-+ return flags & EXT2_OTHER_FLMASK;
-+}
-+
-+/*
-+ * ioctl commands
-+ */
-+#define EXT2_IOC_GETFLAGS FS_IOC_GETFLAGS
-+#define EXT2_IOC_SETFLAGS FS_IOC_SETFLAGS
-+#define EXT2_IOC_GETVERSION FS_IOC_GETVERSION
-+#define EXT2_IOC_SETVERSION FS_IOC_SETVERSION
-+#define EXT2_IOC_GETRSVSZ _IOR('f', 5, long)
-+#define EXT2_IOC_SETRSVSZ _IOW('f', 6, long)
-+
-+/*
-+ * ioctl commands in 32 bit emulation
-+ */
-+#define EXT2_IOC32_GETFLAGS FS_IOC32_GETFLAGS
-+#define EXT2_IOC32_SETFLAGS FS_IOC32_SETFLAGS
-+#define EXT2_IOC32_GETVERSION FS_IOC32_GETVERSION
-+#define EXT2_IOC32_SETVERSION FS_IOC32_SETVERSION
-+
-+/*
-+ * Structure of an inode on the disk
-+ */
-+struct ext2_inode {
-+ uint16_t i_mode; /* File mode */
-+ uint16_t i_uid; /* Low 16 bits of Owner Uid */
-+ uint32_t i_size; /* Size in bytes */
-+ uint32_t i_atime; /* Access time */
-+ uint32_t i_ctime; /* Creation time */
-+ uint32_t i_mtime; /* Modification time */
-+ uint32_t i_dtime; /* Deletion Time */
-+ uint16_t i_gid; /* Low 16 bits of Group Id */
-+ uint16_t i_links_count; /* Links count */
-+ uint32_t i_blocks; /* Blocks count */
-+ uint32_t i_flags; /* File flags */
-+ union {
-+ struct {
-+ uint32_t l_i_reserved1;
-+ } linux1;
-+ struct {
-+ uint32_t h_i_translator;
-+ } hurd1;
-+ struct {
-+ uint32_t m_i_reserved1;
-+ } masix1;
-+ } osd1; /* OS dependent 1 */
-+ uint32_t i_block[EXT2_N_BLOCKS];/* Pointers to blocks */
-+ uint32_t i_generation; /* File version (for NFS) */
-+ uint32_t i_file_acl; /* File ACL */
-+ uint32_t i_dir_acl; /* Directory ACL */
-+ uint32_t i_faddr; /* Fragment address */
-+ union {
-+ struct {
-+ uint8_t l_i_frag; /* Fragment number */
-+ uint8_t l_i_fsize; /* Fragment size */
-+ uint16_t i_pad1;
-+ uint16_t l_i_uid_high; /* these 2 fields */
-+ uint16_t l_i_gid_high; /* were reserved2[0] */
-+ uint32_t l_i_reserved2;
-+ } linux2;
-+ struct {
-+ uint8_t h_i_frag; /* Fragment number */
-+ uint8_t h_i_fsize; /* Fragment size */
-+ uint16_t h_i_mode_high;
-+ uint16_t h_i_uid_high;
-+ uint16_t h_i_gid_high;
-+ uint32_t h_i_author;
-+ } hurd2;
-+ struct {
-+ uint8_t m_i_frag; /* Fragment number */
-+ uint8_t m_i_fsize; /* Fragment size */
-+ uint16_t m_pad1;
-+ uint32_t m_i_reserved2[2];
-+ } masix2;
-+ } osd2; /* OS dependent 2 */
-+};
-+
-+#define i_size_high i_dir_acl
-+
-+#if defined(__KERNEL__) || defined(__linux__)
-+#define i_reserved1 osd1.linux1.l_i_reserved1
-+#define i_frag osd2.linux2.l_i_frag
-+#define i_fsize osd2.linux2.l_i_fsize
-+#define i_uid_low i_uid
-+#define i_gid_low i_gid
-+#define i_uid_high osd2.linux2.l_i_uid_high
-+#define i_gid_high osd2.linux2.l_i_gid_high
-+#define i_reserved2 osd2.linux2.l_i_reserved2
-+#endif
-+
-+#ifdef __hurd__
-+#define i_translator osd1.hurd1.h_i_translator
-+#define i_frag osd2.hurd2.h_i_frag
-+#define i_fsize osd2.hurd2.h_i_fsize
-+#define i_uid_high osd2.hurd2.h_i_uid_high
-+#define i_gid_high osd2.hurd2.h_i_gid_high
-+#define i_author osd2.hurd2.h_i_author
-+#endif
-+
-+#ifdef __masix__
-+#define i_reserved1 osd1.masix1.m_i_reserved1
-+#define i_frag osd2.masix2.m_i_frag
-+#define i_fsize osd2.masix2.m_i_fsize
-+#define i_reserved2 osd2.masix2.m_i_reserved2
-+#endif
-+
-+/*
-+ * File system states
-+ */
-+#define EXT2_VALID_FS 0x0001 /* Unmounted cleanly */
-+#define EXT2_ERROR_FS 0x0002 /* Errors detected */
-+
-+/*
-+ * Mount flags
-+ */
-+#define EXT2_MOUNT_CHECK 0x000001 /* Do mount-time checks */
-+#define EXT2_MOUNT_OLDALLOC 0x000002 /* Don't use the new Orlov allocator */
-+#define EXT2_MOUNT_GRPID 0x000004 /* Create files with directory's group */
-+#define EXT2_MOUNT_DEBUG 0x000008 /* Some debugging messages */
-+#define EXT2_MOUNT_ERRORS_CONT 0x000010 /* Continue on errors */
-+#define EXT2_MOUNT_ERRORS_RO 0x000020 /* Remount fs ro on errors */
-+#define EXT2_MOUNT_ERRORS_PANIC 0x000040 /* Panic on errors */
-+#define EXT2_MOUNT_MINIX_DF 0x000080 /* Mimics the Minix statfs */
-+#define EXT2_MOUNT_NOBH 0x000100 /* No buffer_heads */
-+#define EXT2_MOUNT_NO_UID32 0x000200 /* Disable 32-bit UIDs */
-+#define EXT2_MOUNT_XATTR_USER 0x004000 /* Extended user attributes */
-+#define EXT2_MOUNT_POSIX_ACL 0x008000 /* POSIX Access Control Lists */
-+#define EXT2_MOUNT_XIP 0x010000 /* Execute in place */
-+#define EXT2_MOUNT_USRQUOTA 0x020000 /* user quota */
-+#define EXT2_MOUNT_GRPQUOTA 0x040000 /* group quota */
-+#define EXT2_MOUNT_RESERVATION 0x080000 /* Preallocation */
-+
-+
-+#define clear_opt(o, opt) o &= ~EXT2_MOUNT_##opt
-+#define set_opt(o, opt) o |= EXT2_MOUNT_##opt
-+#define test_opt(sb, opt) (EXT2_SB(sb)->s_mount_opt & \
-+ EXT2_MOUNT_##opt)
-+/*
-+ * Maximal mount counts between two filesystem checks
-+ */
-+#define EXT2_DFL_MAX_MNT_COUNT 20 /* Allow 20 mounts */
-+#define EXT2_DFL_CHECKINTERVAL 0 /* Don't use interval check */
-+
-+/*
-+ * Behaviour when detecting errors
-+ */
-+#define EXT2_ERRORS_CONTINUE 1 /* Continue execution */
-+#define EXT2_ERRORS_RO 2 /* Remount fs read-only */
-+#define EXT2_ERRORS_PANIC 3 /* Panic */
-+#define EXT2_ERRORS_DEFAULT EXT2_ERRORS_CONTINUE
-+
-+/*
-+ * Structure of the super block
-+ */
-+struct ext2_super_block {
-+ uint32_t s_inodes_count; /* Inodes count */
-+ uint32_t s_blocks_count; /* Blocks count */
-+ uint32_t s_r_blocks_count; /* Reserved blocks count */
-+ uint32_t s_free_blocks_count; /* Free blocks count */
-+ uint32_t s_free_inodes_count; /* Free inodes count */
-+ uint32_t s_first_data_block; /* First Data Block */
-+ uint32_t s_log_block_size; /* Block size */
-+ uint32_t s_log_frag_size; /* Fragment size */
-+ uint32_t s_blocks_per_group; /* # Blocks per group */
-+ uint32_t s_frags_per_group; /* # Fragments per group */
-+ uint32_t s_inodes_per_group; /* # Inodes per group */
-+ uint32_t s_mtime; /* Mount time */
-+ uint32_t s_wtime; /* Write time */
-+ uint16_t s_mnt_count; /* Mount count */
-+ uint16_t s_max_mnt_count; /* Maximal mount count */
-+ uint16_t s_magic; /* Magic signature */
-+ uint16_t s_state; /* File system state */
-+ uint16_t s_errors; /* Behaviour when detecting errors */
-+ uint16_t s_minor_rev_level; /* minor revision level */
-+ uint32_t s_lastcheck; /* time of last check */
-+ uint32_t s_checkinterval; /* max. time between checks */
-+ uint32_t s_creator_os; /* OS */
-+ uint32_t s_rev_level; /* Revision level */
-+ uint16_t s_def_resuid; /* Default uid for reserved blocks */
-+ uint16_t s_def_resgid; /* Default gid for reserved blocks */
-+ /*
-+ * These fields are for EXT2_DYNAMIC_REV superblocks only.
-+ *
-+ * Note: the difference between the compatible feature set and
-+ * the incompatible feature set is that if there is a bit set
-+ * in the incompatible feature set that the kernel doesn't
-+ * know about, it should refuse to mount the filesystem.
-+ *
-+ * e2fsck's requirements are more strict; if it doesn't know
-+ * about a feature in either the compatible or incompatible
-+ * feature set, it must abort and not try to meddle with
-+ * things it doesn't understand...
-+ */
-+ uint32_t s_first_ino; /* First non-reserved inode */
-+ uint16_t s_inode_size; /* size of inode structure */
-+ uint16_t s_block_group_nr; /* block group # of this superblock */
-+ uint32_t s_feature_compat; /* compatible feature set */
-+ uint32_t s_feature_incompat; /* incompatible feature set */
-+ uint32_t s_feature_ro_compat; /* readonly-compatible feature set */
-+ uint8_t s_uuid[16]; /* 128-bit uuid for volume */
-+ char s_volume_name[16]; /* volume name */
-+ char s_last_mounted[64]; /* directory where last mounted */
-+ uint32_t s_algorithm_usage_bitmap; /* For compression */
-+ /*
-+ * Performance hints. Directory preallocation should only
-+ * happen if the EXT2_COMPAT_PREALLOC flag is on.
-+ */
-+ uint8_t s_prealloc_blocks; /* Nr of blocks to try to preallocate*/
-+ uint8_t s_prealloc_dir_blocks; /* Nr to preallocate for dirs */
-+ uint16_t s_padding1;
-+ /*
-+ * Journaling support valid if EXT3_FEATURE_COMPAT_HAS_JOURNAL set.
-+ */
-+ uint8_t s_journal_uuid[16]; /* uuid of journal superblock */
-+ uint32_t s_journal_inum; /* inode number of journal file */
-+ uint32_t s_journal_dev; /* device number of journal file */
-+ uint32_t s_last_orphan; /* start of list of inodes to delete */
-+ uint32_t s_hash_seed[4]; /* HTREE hash seed */
-+ uint8_t s_def_hash_version; /* Default hash version to use */
-+ uint8_t s_reserved_char_pad;
-+ uint16_t s_reserved_word_pad;
-+ uint32_t s_default_mount_opts;
-+ uint32_t s_first_meta_bg; /* First metablock block group */
-+ uint32_t s_reserved[190]; /* Padding to the end of the block */
-+};
-+
-+/*
-+ * Codes for operating systems
-+ */
-+#define EXT2_OS_LINUX 0
-+#define EXT2_OS_HURD 1
-+#define EXT2_OS_MASIX 2
-+#define EXT2_OS_FREEBSD 3
-+#define EXT2_OS_LITES 4
-+
-+/*
-+ * Revision levels
-+ */
-+#define EXT2_GOOD_OLD_REV 0 /* The good old (original) format */
-+#define EXT2_DYNAMIC_REV 1 /* V2 format w/ dynamic inode sizes */
-+
-+#define EXT2_CURRENT_REV EXT2_GOOD_OLD_REV
-+#define EXT2_MAX_SUPP_REV EXT2_DYNAMIC_REV
-+
-+#define EXT2_GOOD_OLD_INODE_SIZE 128
-+
-+/*
-+ * Feature set definitions
-+ */
-+
-+#define EXT2_HAS_COMPAT_FEATURE(sb,mask) \
-+ ( EXT2_SB(sb)->s_es->s_feature_compat & cpu_to_le32(mask) )
-+#define EXT2_HAS_RO_COMPAT_FEATURE(sb,mask) \
-+ ( EXT2_SB(sb)->s_es->s_feature_ro_compat & cpu_to_le32(mask) )
-+#define EXT2_HAS_INCOMPAT_FEATURE(sb,mask) \
-+ ( EXT2_SB(sb)->s_es->s_feature_incompat & cpu_to_le32(mask) )
-+#define EXT2_SET_COMPAT_FEATURE(sb,mask) \
-+ EXT2_SB(sb)->s_es->s_feature_compat |= cpu_to_le32(mask)
-+#define EXT2_SET_RO_COMPAT_FEATURE(sb,mask) \
-+ EXT2_SB(sb)->s_es->s_feature_ro_compat |= cpu_to_le32(mask)
-+#define EXT2_SET_INCOMPAT_FEATURE(sb,mask) \
-+ EXT2_SB(sb)->s_es->s_feature_incompat |= cpu_to_le32(mask)
-+#define EXT2_CLEAR_COMPAT_FEATURE(sb,mask) \
-+ EXT2_SB(sb)->s_es->s_feature_compat &= ~cpu_to_le32(mask)
-+#define EXT2_CLEAR_RO_COMPAT_FEATURE(sb,mask) \
-+ EXT2_SB(sb)->s_es->s_feature_ro_compat &= ~cpu_to_le32(mask)
-+#define EXT2_CLEAR_INCOMPAT_FEATURE(sb,mask) \
-+ EXT2_SB(sb)->s_es->s_feature_incompat &= ~cpu_to_le32(mask)
-+
-+#define EXT2_FEATURE_COMPAT_DIR_PREALLOC 0x0001
-+#define EXT2_FEATURE_COMPAT_IMAGIC_INODES 0x0002
-+#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004
-+#define EXT2_FEATURE_COMPAT_EXT_ATTR 0x0008
-+#define EXT2_FEATURE_COMPAT_RESIZE_INO 0x0010
-+#define EXT2_FEATURE_COMPAT_DIR_INDEX 0x0020
-+#define EXT2_FEATURE_COMPAT_ANY 0xffffffff
-+
-+#define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001
-+#define EXT2_FEATURE_RO_COMPAT_LARGE_FILE 0x0002
-+#define EXT2_FEATURE_RO_COMPAT_BTREE_DIR 0x0004
-+#define EXT2_FEATURE_RO_COMPAT_ANY 0xffffffff
-+
-+#define EXT2_FEATURE_INCOMPAT_COMPRESSION 0x0001
-+#define EXT2_FEATURE_INCOMPAT_FILETYPE 0x0002
-+#define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004
-+#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008
-+#define EXT2_FEATURE_INCOMPAT_META_BG 0x0010
-+#define EXT2_FEATURE_INCOMPAT_ANY 0xffffffff
-+
-+#define EXT2_FEATURE_COMPAT_SUPP EXT2_FEATURE_COMPAT_EXT_ATTR
-+#define EXT2_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE| \
-+ EXT2_FEATURE_INCOMPAT_META_BG)
-+#define EXT2_FEATURE_RO_COMPAT_SUPP (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER| \
-+ EXT2_FEATURE_RO_COMPAT_LARGE_FILE| \
-+ EXT2_FEATURE_RO_COMPAT_BTREE_DIR)
-+#define EXT2_FEATURE_RO_COMPAT_UNSUPPORTED ~EXT2_FEATURE_RO_COMPAT_SUPP
-+#define EXT2_FEATURE_INCOMPAT_UNSUPPORTED ~EXT2_FEATURE_INCOMPAT_SUPP
-+
-+/*
-+ * Default values for user and/or group using reserved blocks
-+ */
-+#define EXT2_DEF_RESUID 0
-+#define EXT2_DEF_RESGID 0
-+
-+/*
-+ * Default mount options
-+ */
-+#define EXT2_DEFM_DEBUG 0x0001
-+#define EXT2_DEFM_BSDGROUPS 0x0002
-+#define EXT2_DEFM_XATTR_USER 0x0004
-+#define EXT2_DEFM_ACL 0x0008
-+#define EXT2_DEFM_UID16 0x0010
-+ /* Not used by ext2, but reserved for use by ext3 */
-+#define EXT3_DEFM_JMODE 0x0060
-+#define EXT3_DEFM_JMODE_DATA 0x0020
-+#define EXT3_DEFM_JMODE_ORDERED 0x0040
-+#define EXT3_DEFM_JMODE_WBACK 0x0060
-+
-+/*
-+ * Structure of a directory entry
-+ */
-+#define EXT2_NAME_LEN 255
-+
-+struct ext2_dir_entry {
-+ uint32_t inode; /* Inode number */
-+ uint16_t rec_len; /* Directory entry length */
-+ uint16_t name_len; /* Name length */
-+ char name[EXT2_NAME_LEN]; /* File name */
-+};
-+
-+/*
-+ * The new version of the directory entry. Since EXT2 structures are
-+ * stored in intel byte order, and the name_len field could never be
-+ * bigger than 255 chars, it's safe to reclaim the extra byte for the
-+ * file_type field.
-+ */
-+struct ext2_dir_entry_2 {
-+ uint32_t inode; /* Inode number */
-+ uint16_t rec_len; /* Directory entry length */
-+ uint8_t name_len; /* Name length */
-+ uint8_t file_type;
-+ char name[EXT2_NAME_LEN]; /* File name */
-+};
-+
-+/*
-+ * Ext2 directory file types. Only the low 3 bits are used. The
-+ * other bits are reserved for now.
-+ */
-+enum {
-+ EXT2_FT_UNKNOWN = 0,
-+ EXT2_FT_REG_FILE = 1,
-+ EXT2_FT_DIR = 2,
-+ EXT2_FT_CHRDEV = 3,
-+ EXT2_FT_BLKDEV = 4,
-+ EXT2_FT_FIFO = 5,
-+ EXT2_FT_SOCK = 6,
-+ EXT2_FT_SYMLINK = 7,
-+ EXT2_FT_MAX
-+};
-+
-+/*
-+ * EXT2_DIR_PAD defines the directory entries boundaries
-+ *
-+ * NOTE: It must be a multiple of 4
-+ */
-+#define EXT2_DIR_PAD 4
-+#define EXT2_DIR_ROUND (EXT2_DIR_PAD - 1)
-+#define EXT2_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT2_DIR_ROUND) & \
-+ ~EXT2_DIR_ROUND)
-+#define EXT2_MAX_REC_LEN ((1<<16)-1)
-+
-+#endif
-diff --git a/util-linux/mkfs_ext2.c b/util-linux/mkfs_ext2.c
-index 759bb0a..2d9d720 100644
---- a/util-linux/mkfs_ext2.c
-+++ b/util-linux/mkfs_ext2.c
-@@ -48,13 +48,7 @@
-
- #include "libbb.h"
- #include <linux/fs.h>
--/*
-- * Work around linux/ext2_fs.h breakage.
-- * See https://bugzilla.kernel.org/show_bug.cgi?id=42986.
-- */
--typedef mode_t bb__umode_t;
--#define umode_t bb__umode_t
--#include <linux/ext2_fs.h>
-+#include "bb_linux_ext2_fs.h"
-
- #define ENABLE_FEATURE_MKFS_EXT2_RESERVED_GDT 0
- #define ENABLE_FEATURE_MKFS_EXT2_DIR_INDEX 1
---
-1.7.9.5
-
+++ /dev/null
-From e5221a142e8ee4509734c17584f898a1f4ac86cc Mon Sep 17 00:00:00 2001
-From: Denys Vlasenko <vda.linux@googlemail.com>
-Date: Wed, 19 Oct 2011 02:37:08 +0200
-Subject: [PATCH 02/10] ifupdown: code shrink
-
-function old new delta
-keywords_up_down - 43 +43
-set_environ 371 259 -112
-ifupdown_main 2194 2073 -121
-------------------------------------------------------------------------------
-(add/remove: 1/0 grow/shrink: 0/2 up/down: 43/-233) Total: -190 bytes
-
-Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
----
- networking/ifupdown.c | 42 +++++++++++++++---------------------------
- 1 file changed, 15 insertions(+), 27 deletions(-)
-
-diff --git a/networking/ifupdown.c b/networking/ifupdown.c
-index abc6b58..5946323 100644
---- a/networking/ifupdown.c
-+++ b/networking/ifupdown.c
-@@ -87,7 +87,6 @@ struct mapping_defn_t {
-
- char *script;
-
-- int max_mappings;
- int n_mappings;
- char **mapping;
- };
-@@ -102,7 +101,6 @@ struct interface_defn_t {
- const struct method_t *method;
-
- char *iface;
-- int max_options;
- int n_options;
- struct variable_t *option;
- };
-@@ -138,6 +136,16 @@ struct globals {
- #define INIT_G() do { } while (0)
-
-
-+static const char keywords_up_down[] ALIGN1 =
-+ "up\0"
-+ "down\0"
-+ "pre-up\0"
-+ "pre-down\0"
-+ "post-up\0"
-+ "post-down\0"
-+;
-+
-+
- #if ENABLE_FEATURE_IFUPDOWN_IPV4 || ENABLE_FEATURE_IFUPDOWN_IPV6
-
- static void addstr(char **bufp, const char *str, size_t str_length)
-@@ -803,7 +811,6 @@ static struct interfaces_file_t *read_interfaces(const char *filename)
- currmap->match = xrealloc_vector(currmap->match, 4, currmap->n_matches);
- currmap->match[currmap->n_matches++] = xstrdup(first_word);
- }
-- /*currmap->max_mappings = 0; - done by xzalloc */
- /*currmap->n_mappings = 0;*/
- /*currmap->mapping = NULL;*/
- /*currmap->script = NULL;*/
-@@ -888,25 +895,16 @@ static struct interfaces_file_t *read_interfaces(const char *filename)
- if (rest_of_line[0] == '\0')
- bb_error_msg_and_die("option with empty value \"%s\"", buf);
-
-- if (strcmp(first_word, "up") != 0
-- && strcmp(first_word, "down") != 0
-- && strcmp(first_word, "pre-up") != 0
-- && strcmp(first_word, "pre-down") != 0
-- && strcmp(first_word, "post-up") != 0
-- && strcmp(first_word, "post-down") != 0
-- ) {
-+ /* If not one of "up", "down",... words... */
-+ if (index_in_strings(keywords_up_down, first_word) < 0) {
- int i;
- for (i = 0; i < currif->n_options; i++) {
- if (strcmp(currif->option[i].name, first_word) == 0)
- bb_error_msg_and_die("duplicate option \"%s\"", buf);
- }
- }
-- if (currif->n_options >= currif->max_options) {
-- currif->max_options += 10;
-- currif->option = xrealloc(currif->option,
-- sizeof(*currif->option) * currif->max_options);
-- }
- debug_noise("\t%s=%s\n", first_word, rest_of_line);
-+ currif->option = xrealloc_vector(currif->option, 4, currif->n_options);
- currif->option[currif->n_options].name = xstrdup(first_word);
- currif->option[currif->n_options].value = xstrdup(rest_of_line);
- currif->n_options++;
-@@ -918,11 +916,7 @@ static struct interfaces_file_t *read_interfaces(const char *filename)
- bb_error_msg_and_die("duplicate script in mapping \"%s\"", buf);
- currmap->script = xstrdup(next_word(&rest_of_line));
- } else if (strcmp(first_word, "map") == 0) {
-- if (currmap->n_mappings >= currmap->max_mappings) {
-- currmap->max_mappings = currmap->max_mappings * 2 + 1;
-- currmap->mapping = xrealloc(currmap->mapping,
-- sizeof(char *) * currmap->max_mappings);
-- }
-+ currmap->mapping = xrealloc_vector(currmap->mapping, 2, currmap->n_mappings);
- currmap->mapping[currmap->n_mappings] = xstrdup(next_word(&rest_of_line));
- currmap->n_mappings++;
- } else {
-@@ -986,13 +980,7 @@ static void set_environ(struct interface_defn_t *iface, const char *mode)
- pp = G.my_environ;
-
- for (i = 0; i < iface->n_options; i++) {
-- if (strcmp(iface->option[i].name, "up") == 0
-- || strcmp(iface->option[i].name, "down") == 0
-- || strcmp(iface->option[i].name, "pre-up") == 0
-- || strcmp(iface->option[i].name, "pre-down") == 0
-- || strcmp(iface->option[i].name, "post-up") == 0
-- || strcmp(iface->option[i].name, "post-down") == 0
-- ) {
-+ if (index_in_strings(keywords_up_down, iface->option[i].name) >= 0) {
- continue;
- }
- *pp++ = setlocalenv("IF_%s=%s", iface->option[i].name, iface->option[i].value);
---
-1.7.10.4
-
+++ /dev/null
-From 176bc344751dfc41e87976182381ae0560c94f22 Mon Sep 17 00:00:00 2001
-From: Denys Vlasenko <vda.linux@googlemail.com>
-Date: Tue, 17 Apr 2012 15:06:55 +0200
-Subject: [PATCH 04/32] Drop include/bb_linux_ext2_fs.h, use existing
- e2fsprogs/e2fs_defs.h
-
-Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
----
- e2fsprogs/e2fs_defs.h | 561 ---------------------------
- e2fsprogs/e2fs_lib.h | 2 +-
- e2fsprogs/old_e2fsprogs/e2fsck.c | 6 +-
- e2fsprogs/old_e2fsprogs/e2p/feature.c | 2 +-
- e2fsprogs/old_e2fsprogs/ext2fs/ext2_fs.h | 2 +-
- e2fsprogs/old_e2fsprogs/ext2fs/ext2fs.h | 2 +-
- e2fsprogs/old_e2fsprogs/ext2fs/initialize.c | 2 +-
- e2fsprogs/old_e2fsprogs/mke2fs.c | 8 +-
- e2fsprogs/tune2fs.c | 2 +-
- include/bb_e2fs_defs.h | 561 +++++++++++++++++++++++++++
- include/bb_linux_ext2_fs.h | 547 --------------------------
- util-linux/mkfs_ext2.c | 2 +-
- 12 files changed, 575 insertions(+), 1122 deletions(-)
- delete mode 100644 e2fsprogs/e2fs_defs.h
- create mode 100644 include/bb_e2fs_defs.h
- delete mode 100644 include/bb_linux_ext2_fs.h
-
-diff --git a/e2fsprogs/e2fs_defs.h b/e2fsprogs/e2fs_defs.h
-deleted file mode 100644
-index 379640e..0000000
---- a/e2fsprogs/e2fs_defs.h
-+++ /dev/null
-@@ -1,561 +0,0 @@
--/* vi: set sw=4 ts=4: */
--/*
-- * linux/include/linux/ext2_fs.h
-- *
-- * Copyright (C) 1992, 1993, 1994, 1995
-- * Remy Card (card@masi.ibp.fr)
-- * Laboratoire MASI - Institut Blaise Pascal
-- * Universite Pierre et Marie Curie (Paris VI)
-- *
-- * Copyright (C) 1991, 1992 Linus Torvalds
-- */
--
--#ifndef LINUX_EXT2_FS_H
--#define LINUX_EXT2_FS_H 1
--
--/*
-- * Special inode numbers
-- */
--#define EXT2_BAD_INO 1 /* Bad blocks inode */
--#define EXT2_ROOT_INO 2 /* Root inode */
--#define EXT2_ACL_IDX_INO 3 /* ACL inode */
--#define EXT2_ACL_DATA_INO 4 /* ACL inode */
--#define EXT2_BOOT_LOADER_INO 5 /* Boot loader inode */
--#define EXT2_UNDEL_DIR_INO 6 /* Undelete directory inode */
--#define EXT2_RESIZE_INO 7 /* Reserved group descriptors inode */
--#define EXT2_JOURNAL_INO 8 /* Journal inode */
--
--/* First non-reserved inode for old ext2 filesystems */
--#define EXT2_GOOD_OLD_FIRST_INO 11
--
--/*
-- * The second extended file system magic number
-- */
--#define EXT2_SUPER_MAGIC 0xEF53
--
--/* Assume that user mode programs are passing in an ext2fs superblock, not
-- * a kernel struct super_block. This will allow us to call the feature-test
-- * macros from user land. */
--#define EXT2_SB(sb) (sb)
--
--/*
-- * Maximal count of links to a file
-- */
--#define EXT2_LINK_MAX 32000
--
--/*
-- * Macro-instructions used to manage several block sizes
-- */
--#define EXT2_MIN_BLOCK_LOG_SIZE 10 /* 1024 */
--#define EXT2_MAX_BLOCK_LOG_SIZE 16 /* 65536 */
--#define EXT2_MIN_BLOCK_SIZE (1 << EXT2_MIN_BLOCK_LOG_SIZE)
--#define EXT2_MAX_BLOCK_SIZE (1 << EXT2_MAX_BLOCK_LOG_SIZE)
--#define EXT2_BLOCK_SIZE(s) (EXT2_MIN_BLOCK_SIZE << (s)->s_log_block_size)
--#define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10)
--#define EXT2_INODE_SIZE(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
-- EXT2_GOOD_OLD_INODE_SIZE : (s)->s_inode_size)
--#define EXT2_FIRST_INO(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
-- EXT2_GOOD_OLD_FIRST_INO : (s)->s_first_ino)
--#define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof(uint32_t))
--
--/*
-- * Macro-instructions used to manage fragments
-- */
--#define EXT2_MIN_FRAG_SIZE EXT2_MIN_BLOCK_SIZE
--#define EXT2_MAX_FRAG_SIZE EXT2_MAX_BLOCK_SIZE
--#define EXT2_MIN_FRAG_LOG_SIZE EXT2_MIN_BLOCK_LOG_SIZE
--#define EXT2_FRAG_SIZE(s) (EXT2_MIN_FRAG_SIZE << (s)->s_log_frag_size)
--#define EXT2_FRAGS_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / EXT2_FRAG_SIZE(s))
--
--/*
-- * ACL structures
-- */
--struct ext2_acl_header { /* Header of Access Control Lists */
-- uint32_t aclh_size;
-- uint32_t aclh_file_count;
-- uint32_t aclh_acle_count;
-- uint32_t aclh_first_acle;
--};
--
--struct ext2_acl_entry { /* Access Control List Entry */
-- uint32_t acle_size;
-- uint16_t acle_perms; /* Access permissions */
-- uint16_t acle_type; /* Type of entry */
-- uint16_t acle_tag; /* User or group identity */
-- uint16_t acle_pad1;
-- uint32_t acle_next; /* Pointer on next entry for the */
-- /* same inode or on next free entry */
--};
--
--/*
-- * Structure of a blocks group descriptor
-- */
--struct ext2_group_desc {
-- uint32_t bg_block_bitmap; /* Blocks bitmap block */
-- uint32_t bg_inode_bitmap; /* Inodes bitmap block */
-- uint32_t bg_inode_table; /* Inodes table block */
-- uint16_t bg_free_blocks_count; /* Free blocks count */
-- uint16_t bg_free_inodes_count; /* Free inodes count */
-- uint16_t bg_used_dirs_count; /* Directories count */
-- uint16_t bg_pad;
-- uint32_t bg_reserved[3];
--};
--
--/*
-- * Data structures used by the directory indexing feature
-- *
-- * Note: all of the multibyte integer fields are little endian.
-- */
--
--/*
-- * Note: dx_root_info is laid out so that if it should somehow get
-- * overlaid by a dirent the two low bits of the hash version will be
-- * zero. Therefore, the hash version mod 4 should never be 0.
-- * Sincerely, the paranoia department.
-- */
--struct ext2_dx_root_info {
-- uint32_t reserved_zero;
-- uint8_t hash_version; /* 0 now, 1 at release */
-- uint8_t info_length; /* 8 */
-- uint8_t indirect_levels;
-- uint8_t unused_flags;
--};
--
--#define EXT2_HASH_LEGACY 0
--#define EXT2_HASH_HALF_MD4 1
--#define EXT2_HASH_TEA 2
--
--#define EXT2_HASH_FLAG_INCOMPAT 0x1
--
--struct ext2_dx_entry {
-- uint32_t hash;
-- uint32_t block;
--};
--
--struct ext2_dx_countlimit {
-- uint16_t limit;
-- uint16_t count;
--};
--
--
--/*
-- * Macro-instructions used to manage group descriptors
-- */
--#define EXT2_BLOCKS_PER_GROUP(s) (EXT2_SB(s)->s_blocks_per_group)
--#define EXT2_INODES_PER_GROUP(s) (EXT2_SB(s)->s_inodes_per_group)
--#define EXT2_INODES_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s)/EXT2_INODE_SIZE(s))
--/* limits imposed by 16-bit value gd_free_{blocks,inode}_count */
--#define EXT2_MAX_BLOCKS_PER_GROUP(s) ((1 << 16) - 8)
--#define EXT2_MAX_INODES_PER_GROUP(s) ((1 << 16) - EXT2_INODES_PER_BLOCK(s))
--#define EXT2_DESC_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (struct ext2_group_desc))
--
--/*
-- * Constants relative to the data blocks
-- */
--#define EXT2_NDIR_BLOCKS 12
--#define EXT2_IND_BLOCK EXT2_NDIR_BLOCKS
--#define EXT2_DIND_BLOCK (EXT2_IND_BLOCK + 1)
--#define EXT2_TIND_BLOCK (EXT2_DIND_BLOCK + 1)
--#define EXT2_N_BLOCKS (EXT2_TIND_BLOCK + 1)
--
--/*
-- * Inode flags
-- */
--#define EXT2_SECRM_FL 0x00000001 /* Secure deletion */
--#define EXT2_UNRM_FL 0x00000002 /* Undelete */
--#define EXT2_COMPR_FL 0x00000004 /* Compress file */
--#define EXT2_SYNC_FL 0x00000008 /* Synchronous updates */
--#define EXT2_IMMUTABLE_FL 0x00000010 /* Immutable file */
--#define EXT2_APPEND_FL 0x00000020 /* writes to file may only append */
--#define EXT2_NODUMP_FL 0x00000040 /* do not dump file */
--#define EXT2_NOATIME_FL 0x00000080 /* do not update atime */
--/* Reserved for compression usage... */
--#define EXT2_DIRTY_FL 0x00000100
--#define EXT2_COMPRBLK_FL 0x00000200 /* One or more compressed clusters */
--#define EXT2_NOCOMPR_FL 0x00000400 /* Access raw compressed data */
--#define EXT2_ECOMPR_FL 0x00000800 /* Compression error */
--/* End compression flags --- maybe not all used */
--#define EXT2_BTREE_FL 0x00001000 /* btree format dir */
--#define EXT2_INDEX_FL 0x00001000 /* hash-indexed directory */
--#define EXT2_IMAGIC_FL 0x00002000
--#define EXT3_JOURNAL_DATA_FL 0x00004000 /* file data should be journaled */
--#define EXT2_NOTAIL_FL 0x00008000 /* file tail should not be merged */
--#define EXT2_DIRSYNC_FL 0x00010000 /* Synchronous directory modifications */
--#define EXT2_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/
--#define EXT3_EXTENTS_FL 0x00080000 /* Inode uses extents */
--#define EXT2_RESERVED_FL 0x80000000 /* reserved for ext2 lib */
--
--#define EXT2_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */
--#define EXT2_FL_USER_MODIFIABLE 0x000080FF /* User modifiable flags */
--
--/*
-- * ioctl commands
-- */
--#define EXT2_IOC_GETFLAGS _IOR('f', 1, long)
--#define EXT2_IOC_SETFLAGS _IOW('f', 2, long)
--#define EXT2_IOC_GETVERSION _IOR('v', 1, long)
--#define EXT2_IOC_SETVERSION _IOW('v', 2, long)
--
--/*
-- * Structure of an inode on the disk
-- */
--struct ext2_inode {
-- uint16_t i_mode; /* File mode */
-- uint16_t i_uid; /* Low 16 bits of Owner Uid */
-- uint32_t i_size; /* Size in bytes */
-- uint32_t i_atime; /* Access time */
-- uint32_t i_ctime; /* Creation time */
-- uint32_t i_mtime; /* Modification time */
-- uint32_t i_dtime; /* Deletion Time */
-- uint16_t i_gid; /* Low 16 bits of Group Id */
-- uint16_t i_links_count; /* Links count */
-- uint32_t i_blocks; /* Blocks count */
-- uint32_t i_flags; /* File flags */
-- union {
-- struct {
-- uint32_t l_i_reserved1;
-- } linux1;
-- struct {
-- uint32_t h_i_translator;
-- } hurd1;
-- struct {
-- uint32_t m_i_reserved1;
-- } masix1;
-- } osd1; /* OS dependent 1 */
-- uint32_t i_block[EXT2_N_BLOCKS];/* Pointers to blocks */
-- uint32_t i_generation; /* File version (for NFS) */
-- uint32_t i_file_acl; /* File ACL */
-- uint32_t i_dir_acl; /* Directory ACL */
-- uint32_t i_faddr; /* Fragment address */
-- union {
-- struct {
-- uint8_t l_i_frag; /* Fragment number */
-- uint8_t l_i_fsize; /* Fragment size */
-- uint16_t i_pad1;
-- uint16_t l_i_uid_high; /* these 2 fields */
-- uint16_t l_i_gid_high; /* were reserved2[0] */
-- uint32_t l_i_reserved2;
-- } linux2;
-- struct {
-- uint8_t h_i_frag; /* Fragment number */
-- uint8_t h_i_fsize; /* Fragment size */
-- uint16_t h_i_mode_high;
-- uint16_t h_i_uid_high;
-- uint16_t h_i_gid_high;
-- uint32_t h_i_author;
-- } hurd2;
-- struct {
-- uint8_t m_i_frag; /* Fragment number */
-- uint8_t m_i_fsize; /* Fragment size */
-- uint16_t m_pad1;
-- uint32_t m_i_reserved2[2];
-- } masix2;
-- } osd2; /* OS dependent 2 */
--};
--
--/*
-- * Permanent part of an large inode on the disk
-- */
--struct ext2_inode_large {
-- uint16_t i_mode; /* File mode */
-- uint16_t i_uid; /* Low 16 bits of Owner Uid */
-- uint32_t i_size; /* Size in bytes */
-- uint32_t i_atime; /* Access time */
-- uint32_t i_ctime; /* Creation time */
-- uint32_t i_mtime; /* Modification time */
-- uint32_t i_dtime; /* Deletion Time */
-- uint16_t i_gid; /* Low 16 bits of Group Id */
-- uint16_t i_links_count; /* Links count */
-- uint32_t i_blocks; /* Blocks count */
-- uint32_t i_flags; /* File flags */
-- union {
-- struct {
-- uint32_t l_i_reserved1;
-- } linux1;
-- struct {
-- uint32_t h_i_translator;
-- } hurd1;
-- struct {
-- uint32_t m_i_reserved1;
-- } masix1;
-- } osd1; /* OS dependent 1 */
-- uint32_t i_block[EXT2_N_BLOCKS];/* Pointers to blocks */
-- uint32_t i_generation; /* File version (for NFS) */
-- uint32_t i_file_acl; /* File ACL */
-- uint32_t i_dir_acl; /* Directory ACL */
-- uint32_t i_faddr; /* Fragment address */
-- union {
-- struct {
-- uint8_t l_i_frag; /* Fragment number */
-- uint8_t l_i_fsize; /* Fragment size */
-- uint16_t i_pad1;
-- uint16_t l_i_uid_high; /* these 2 fields */
-- uint16_t l_i_gid_high; /* were reserved2[0] */
-- uint32_t l_i_reserved2;
-- } linux2;
-- struct {
-- uint8_t h_i_frag; /* Fragment number */
-- uint8_t h_i_fsize; /* Fragment size */
-- uint16_t h_i_mode_high;
-- uint16_t h_i_uid_high;
-- uint16_t h_i_gid_high;
-- uint32_t h_i_author;
-- } hurd2;
-- struct {
-- uint8_t m_i_frag; /* Fragment number */
-- uint8_t m_i_fsize; /* Fragment size */
-- uint16_t m_pad1;
-- uint32_t m_i_reserved2[2];
-- } masix2;
-- } osd2; /* OS dependent 2 */
-- uint16_t i_extra_isize;
-- uint16_t i_pad1;
--};
--
--#define i_size_high i_dir_acl
--
--/*
-- * File system states
-- */
--#define EXT2_VALID_FS 0x0001 /* Unmounted cleanly */
--#define EXT2_ERROR_FS 0x0002 /* Errors detected */
--
--/*
-- * Mount flags
-- */
--#define EXT2_MOUNT_CHECK 0x0001 /* Do mount-time checks */
--#define EXT2_MOUNT_GRPID 0x0004 /* Create files with directory's group */
--#define EXT2_MOUNT_DEBUG 0x0008 /* Some debugging messages */
--#define EXT2_MOUNT_ERRORS_CONT 0x0010 /* Continue on errors */
--#define EXT2_MOUNT_ERRORS_RO 0x0020 /* Remount fs ro on errors */
--#define EXT2_MOUNT_ERRORS_PANIC 0x0040 /* Panic on errors */
--#define EXT2_MOUNT_MINIX_DF 0x0080 /* Mimics the Minix statfs */
--#define EXT2_MOUNT_NO_UID32 0x0200 /* Disable 32-bit UIDs */
--
--#define clear_opt(o, opt) o &= ~EXT2_MOUNT_##opt
--#define set_opt(o, opt) o |= EXT2_MOUNT_##opt
--#define test_opt(sb, opt) (EXT2_SB(sb)->s_mount_opt & \
-- EXT2_MOUNT_##opt)
--/*
-- * Maximal mount counts between two filesystem checks
-- */
--#define EXT2_DFL_MAX_MNT_COUNT 20 /* Allow 20 mounts */
--#define EXT2_DFL_CHECKINTERVAL 0 /* Don't use interval check */
--
--/*
-- * Behaviour when detecting errors
-- */
--#define EXT2_ERRORS_CONTINUE 1 /* Continue execution */
--#define EXT2_ERRORS_RO 2 /* Remount fs read-only */
--#define EXT2_ERRORS_PANIC 3 /* Panic */
--#define EXT2_ERRORS_DEFAULT EXT2_ERRORS_CONTINUE
--
--/*
-- * Structure of the super block
-- */
--struct ext2_super_block {
-- uint32_t s_inodes_count; /* Inodes count */
-- uint32_t s_blocks_count; /* Blocks count */
-- uint32_t s_r_blocks_count; /* Reserved blocks count */
-- uint32_t s_free_blocks_count; /* Free blocks count */
-- uint32_t s_free_inodes_count; /* Free inodes count */
-- uint32_t s_first_data_block; /* First Data Block */
-- uint32_t s_log_block_size; /* Block size */
-- int32_t s_log_frag_size; /* Fragment size */
-- uint32_t s_blocks_per_group; /* # Blocks per group */
-- uint32_t s_frags_per_group; /* # Fragments per group */
-- uint32_t s_inodes_per_group; /* # Inodes per group */
-- uint32_t s_mtime; /* Mount time */
-- uint32_t s_wtime; /* Write time */
-- uint16_t s_mnt_count; /* Mount count */
-- int16_t s_max_mnt_count; /* Maximal mount count */
-- uint16_t s_magic; /* Magic signature */
-- uint16_t s_state; /* File system state */
-- uint16_t s_errors; /* Behaviour when detecting errors */
-- uint16_t s_minor_rev_level; /* minor revision level */
-- uint32_t s_lastcheck; /* time of last check */
-- uint32_t s_checkinterval; /* max. time between checks */
-- uint32_t s_creator_os; /* OS */
-- uint32_t s_rev_level; /* Revision level */
-- uint16_t s_def_resuid; /* Default uid for reserved blocks */
-- uint16_t s_def_resgid; /* Default gid for reserved blocks */
-- /*
-- * These fields are for EXT2_DYNAMIC_REV superblocks only.
-- *
-- * Note: the difference between the compatible feature set and
-- * the incompatible feature set is that if there is a bit set
-- * in the incompatible feature set that the kernel doesn't
-- * know about, it should refuse to mount the filesystem.
-- *
-- * e2fsck's requirements are more strict; if it doesn't know
-- * about a feature in either the compatible or incompatible
-- * feature set, it must abort and not try to meddle with
-- * things it doesn't understand...
-- */
-- uint32_t s_first_ino; /* First non-reserved inode */
-- uint16_t s_inode_size; /* size of inode structure */
-- uint16_t s_block_group_nr; /* block group # of this superblock */
-- uint32_t s_feature_compat; /* compatible feature set */
-- uint32_t s_feature_incompat; /* incompatible feature set */
-- uint32_t s_feature_ro_compat; /* readonly-compatible feature set */
-- uint8_t s_uuid[16]; /* 128-bit uuid for volume */
-- char s_volume_name[16]; /* volume name */
-- char s_last_mounted[64]; /* directory where last mounted */
-- uint32_t s_algorithm_usage_bitmap; /* For compression */
-- /*
-- * Performance hints. Directory preallocation should only
-- * happen if the EXT2_FEATURE_COMPAT_DIR_PREALLOC flag is on.
-- */
-- uint8_t s_prealloc_blocks; /* Nr of blocks to try to preallocate*/
-- uint8_t s_prealloc_dir_blocks; /* Nr to preallocate for dirs */
-- uint16_t s_reserved_gdt_blocks; /* Per group table for online growth */
-- /*
-- * Journaling support valid if EXT2_FEATURE_COMPAT_HAS_JOURNAL set.
-- */
-- uint8_t s_journal_uuid[16]; /* uuid of journal superblock */
-- uint32_t s_journal_inum; /* inode number of journal file */
-- uint32_t s_journal_dev; /* device number of journal file */
-- uint32_t s_last_orphan; /* start of list of inodes to delete */
-- uint32_t s_hash_seed[4]; /* HTREE hash seed */
-- uint8_t s_def_hash_version; /* Default hash version to use */
-- uint8_t s_jnl_backup_type; /* Default type of journal backup */
-- &nb