diff --git a/build_patches/ar23xx/260_fixdmaoffset.patch b/build_patches/ar23xx/260_fixdmaoffset.patch new file mode 100644 index 0000000..253c888 --- /dev/null +++ b/build_patches/ar23xx/260_fixdmaoffset.patch @@ -0,0 +1,201 @@ +diff -Naur ./arch/mips/ar231x/ar2315.c ./arch/mips/ar231x/ar2315.c +--- ./arch/mips/ar231x/ar2315.c 2012-01-06 23:54:46.088547779 +0100 ++++ ./arch/mips/ar231x/ar2315.c 2012-01-06 23:57:27.117346318 +0100 +@@ -367,7 +367,7 @@ + .reset_base = AR2315_RESET, + .reset_mac = AR2315_RESET_ENET0, + .reset_phy = AR2315_RESET_EPHY0, +- .phy_base = AR2315_ENET0, ++ .phy_base = KSEG1ADDR(AR2315_ENET0), + .config = &ar231x_board, + }; + +@@ -405,13 +405,13 @@ + static inline u32 + spiflash_read_reg(int reg) + { +- return ar231x_read_reg(KSEG1ADDR(AR2315_SPI) + reg); ++ return ar231x_read_reg(AR2315_SPI + reg); + } + + static inline void + spiflash_write_reg(int reg, u32 data) + { +- ar231x_write_reg(KSEG1ADDR(AR2315_SPI) + reg, data); ++ ar231x_write_reg(AR2315_SPI + reg, data); + } + + static u32 +@@ -540,7 +540,7 @@ + ar2315_init_gpio(); + platform_device_register(&ar2315_wdt); + platform_device_register(&ar2315_spiflash); +- ar231x_add_ethernet(0, AR2315_ENET0, AR2315_IRQ_ENET0_INTRS, ++ ar231x_add_ethernet(0, KSEG1ADDR(AR2315_ENET0), AR2315_IRQ_ENET0_INTRS, + &ar2315_eth_data); + ar231x_add_wmac(0, AR2315_WLAN0, AR2315_IRQ_WLAN0_INTRS); + +diff -Naur ./arch/mips/ar231x/board.c ./arch/mips/ar231x/board.c +--- ./arch/mips/ar231x/board.c 2012-01-06 23:54:46.088547779 +0100 ++++ ./arch/mips/ar231x/board.c 2012-01-06 23:55:30.044765777 +0100 +@@ -137,6 +137,7 @@ + u8 *bcfg, *rcfg; + u8 *board_data; + u8 *radio_data; ++ u8 *mac_addr; + u32 offset; + + ar231x_board.config = NULL; +@@ -194,6 +195,12 @@ + rcfg_size = BOARD_CONFIG_BUFSZ - offset; + memcpy(radio_data, rcfg, rcfg_size); + ++ mac_addr = &radio_data[0x1d * 2]; ++ if (is_broadcast_ether_addr(mac_addr)) { ++ printk(KERN_INFO "Radio MAC is blank; using board-data\n"); ++ memcpy(mac_addr, ar231x_board.config->wlan0_mac, ETH_ALEN); ++ } ++ + return 0; + } + +diff -Naur ./arch/mips/ar231x/pci.c ./arch/mips/ar231x/pci.c +--- ./arch/mips/ar231x/pci.c 2012-01-06 23:54:46.088547779 +0100 ++++ ./arch/mips/ar231x/pci.c 2012-01-06 23:55:57.084899837 +0100 +@@ -176,7 +176,7 @@ + if (ar231x_devtype != DEV_TYPE_AR2315) + return -ENODEV; + +- configspace = (unsigned long) ioremap_nocache(0x80000000, 1*1024*1024); /* Remap PCI config space */ ++ configspace = (unsigned long) ioremap_nocache(AR2315_PCIEXT, 1*1024*1024); /* Remap PCI config space */ + ar231x_pci_controller.io_map_base = + (unsigned long) ioremap_nocache(AR531X_MEM_BASE + AR531X_MEM_SIZE, AR531X_IO_SIZE); + set_io_port_base(ar231x_pci_controller.io_map_base); /* PCI I/O space */ +diff -Naur ./arch/mips/include/asm/mach-ar231x/ar2315_regs.h ./arch/mips/include/asm/mach-ar231x/ar2315_regs.h +--- ./arch/mips/include/asm/mach-ar231x/ar2315_regs.h 2012-01-06 23:54:46.112547898 +0100 ++++ ./arch/mips/include/asm/mach-ar231x/ar2315_regs.h 2012-01-06 23:58:01.261515613 +0100 +@@ -27,14 +27,14 @@ + * Address map + */ + #define AR2315_SPI_READ 0x08000000 /* SPI FLASH */ +-#define AR2315_WLAN0 0xB0000000 /* Wireless MMR */ +-#define AR2315_PCI 0xB0100000 /* PCI MMR */ +-#define AR2315_SDRAMCTL 0xB0300000 /* SDRAM MMR */ +-#define AR2315_LOCAL 0xB0400000 /* LOCAL BUS MMR */ +-#define AR2315_ENET0 0xB0500000 /* ETHERNET MMR */ +-#define AR2315_DSLBASE 0xB1000000 /* RESET CONTROL MMR */ +-#define AR2315_UART0 0xB1100003 /* UART MMR */ +-#define AR2315_SPI 0xB1300000 /* SPI FLASH MMR */ ++#define AR2315_WLAN0 0x10000000 /* Wireless MMR */ ++#define AR2315_PCI 0x10100000 /* PCI MMR */ ++#define AR2315_SDRAMCTL 0x10300000 /* SDRAM MMR */ ++#define AR2315_LOCAL 0x10400000 /* LOCAL BUS MMR */ ++#define AR2315_ENET0 0x10500000 /* ETHERNET MMR */ ++#define AR2315_DSLBASE 0x11000000 /* RESET CONTROL MMR */ ++#define AR2315_UART0 0x11100003 /* UART MMR */ ++#define AR2315_SPI 0x11300000 /* SPI FLASH MMR */ + #define AR2315_PCIEXT 0x80000000 /* pci external */ + + /* +diff -Naur ./arch/mips/include/asm/mach-ar231x/dma-coherence.h ./arch/mips/include/asm/mach-ar231x/dma-coherence.h +--- ./arch/mips/include/asm/mach-ar231x/dma-coherence.h 2012-01-06 23:54:46.112547898 +0100 ++++ ./arch/mips/include/asm/mach-ar231x/dma-coherence.h 2012-01-07 00:00:28.458245493 +0100 +@@ -12,21 +12,33 @@ + + #define PCI_DMA_OFFSET 0x20000000 + +-struct device; ++#include ++ ++static inline dma_addr_t ar231x_dev_offset(struct device *dev) ++{ ++#ifdef CONFIG_PCI ++ extern struct bus_type pci_bus_type; ++ ++ if (dev && dev->bus == &pci_bus_type) ++ return PCI_DMA_OFFSET; ++ else ++#endif ++ return 0; ++} + + static dma_addr_t plat_map_dma_mem(struct device *dev, void *addr, size_t size) + { +- return virt_to_phys(addr) + (dev != NULL ? PCI_DMA_OFFSET : 0); ++ return virt_to_phys(addr) + ar231x_dev_offset(dev); + } + + static dma_addr_t plat_map_dma_mem_page(struct device *dev, struct page *page) + { +- return page_to_phys(page) + (dev != NULL ? PCI_DMA_OFFSET : 0); ++ return page_to_phys(page) + ar231x_dev_offset(dev); + } + +-static unsigned long plat_dma_addr_to_phys(dma_addr_t dma_addr) ++static unsigned long plat_dma_addr_to_phys(struct device *dev, dma_addr_t dma_addr) + { +- return (dma_addr > PCI_DMA_OFFSET ? dma_addr - PCI_DMA_OFFSET : dma_addr); ++ return dma_addr - ar231x_dev_offset(dev); + } + + static inline void plat_unmap_dma_mem(struct device *dev, dma_addr_t dma_addr) +diff -Naur ./arch/mips/mm/dma-default.c ./arch/mips/mm/dma-default.c +--- ./arch/mips/mm/dma-default.c 2012-01-06 23:54:46.088547779 +0100 ++++ ./arch/mips/mm/dma-default.c 2012-01-07 00:01:41.738608901 +0100 +@@ -20,9 +20,9 @@ + + #include + +-static inline unsigned long dma_addr_to_virt(dma_addr_t dma_addr) ++static inline unsigned long dma_addr_to_virt(struct device *dev, dma_addr_t dma_addr) + { +- unsigned long addr = plat_dma_addr_to_phys(dma_addr); ++ unsigned long addr = plat_dma_addr_to_phys(dev, dma_addr); + + return (unsigned long)phys_to_virt(addr); + } +@@ -170,7 +170,7 @@ + enum dma_data_direction direction) + { + if (cpu_is_noncoherent_r10000(dev)) +- __dma_sync(dma_addr_to_virt(dma_addr), size, ++ __dma_sync(dma_addr_to_virt(dev, dma_addr), size, + direction); + + plat_unmap_dma_mem(dev, dma_addr); +@@ -246,7 +246,7 @@ + if (cpu_is_noncoherent_r10000(dev)) { + unsigned long addr; + +- addr = dma_addr_to_virt(dma_handle); ++ addr = dma_addr_to_virt(dev, dma_handle); + __dma_sync(addr, size, direction); + } + } +@@ -262,7 +262,7 @@ + if (!plat_device_is_coherent(dev)) { + unsigned long addr; + +- addr = dma_addr_to_virt(dma_handle); ++ addr = dma_addr_to_virt(dev, dma_handle); + __dma_sync(addr, size, direction); + } + } +@@ -277,7 +277,7 @@ + if (cpu_is_noncoherent_r10000(dev)) { + unsigned long addr; + +- addr = dma_addr_to_virt(dma_handle); ++ addr = dma_addr_to_virt(dev, dma_handle); + __dma_sync(addr + offset, size, direction); + } + } +@@ -293,7 +293,7 @@ + if (!plat_device_is_coherent(dev)) { + unsigned long addr; + +- addr = dma_addr_to_virt(dma_handle); ++ addr = dma_addr_to_virt(dev, dma_handle); + __dma_sync(addr + offset, size, direction); + } + } diff --git a/build_patches/blaII/Makefile.patch b/build_patches/blaII/Makefile.patch new file mode 100644 index 0000000..d2ba078 --- /dev/null +++ b/build_patches/blaII/Makefile.patch @@ -0,0 +1,13 @@ +Index: Makefile +=================================================================== +--- Makefile (Revision 22) ++++ Makefile (Arbeitskopie) +@@ -10,7 +10,7 @@ + + PKG_NAME:=batman-adv-devel + +-PKG_BATMAN_REV:=b82b9b254c8a923fb2d65e2ca3eefc2e8b4429e7 ++PKG_BATMAN_REV:=ebdc92a614b3de8a32c66c92a46df286afe4bf6a + PKG_BATCTL_REV:=d9ee7eed3175992be75e2cb949c048bdddeb0769 + + PKG_BATMAN_BRANCH:=$(subst ",,$(CONFIG_KMOD_BATMAN_ADV_DEVEL_BRANCH_NAME)) diff --git a/build_patches/dir300/260_fixdmaoffset.patch b/build_patches/dir300/260_fixdmaoffset.patch new file mode 100644 index 0000000..253c888 --- /dev/null +++ b/build_patches/dir300/260_fixdmaoffset.patch @@ -0,0 +1,201 @@ +diff -Naur ./arch/mips/ar231x/ar2315.c ./arch/mips/ar231x/ar2315.c +--- ./arch/mips/ar231x/ar2315.c 2012-01-06 23:54:46.088547779 +0100 ++++ ./arch/mips/ar231x/ar2315.c 2012-01-06 23:57:27.117346318 +0100 +@@ -367,7 +367,7 @@ + .reset_base = AR2315_RESET, + .reset_mac = AR2315_RESET_ENET0, + .reset_phy = AR2315_RESET_EPHY0, +- .phy_base = AR2315_ENET0, ++ .phy_base = KSEG1ADDR(AR2315_ENET0), + .config = &ar231x_board, + }; + +@@ -405,13 +405,13 @@ + static inline u32 + spiflash_read_reg(int reg) + { +- return ar231x_read_reg(KSEG1ADDR(AR2315_SPI) + reg); ++ return ar231x_read_reg(AR2315_SPI + reg); + } + + static inline void + spiflash_write_reg(int reg, u32 data) + { +- ar231x_write_reg(KSEG1ADDR(AR2315_SPI) + reg, data); ++ ar231x_write_reg(AR2315_SPI + reg, data); + } + + static u32 +@@ -540,7 +540,7 @@ + ar2315_init_gpio(); + platform_device_register(&ar2315_wdt); + platform_device_register(&ar2315_spiflash); +- ar231x_add_ethernet(0, AR2315_ENET0, AR2315_IRQ_ENET0_INTRS, ++ ar231x_add_ethernet(0, KSEG1ADDR(AR2315_ENET0), AR2315_IRQ_ENET0_INTRS, + &ar2315_eth_data); + ar231x_add_wmac(0, AR2315_WLAN0, AR2315_IRQ_WLAN0_INTRS); + +diff -Naur ./arch/mips/ar231x/board.c ./arch/mips/ar231x/board.c +--- ./arch/mips/ar231x/board.c 2012-01-06 23:54:46.088547779 +0100 ++++ ./arch/mips/ar231x/board.c 2012-01-06 23:55:30.044765777 +0100 +@@ -137,6 +137,7 @@ + u8 *bcfg, *rcfg; + u8 *board_data; + u8 *radio_data; ++ u8 *mac_addr; + u32 offset; + + ar231x_board.config = NULL; +@@ -194,6 +195,12 @@ + rcfg_size = BOARD_CONFIG_BUFSZ - offset; + memcpy(radio_data, rcfg, rcfg_size); + ++ mac_addr = &radio_data[0x1d * 2]; ++ if (is_broadcast_ether_addr(mac_addr)) { ++ printk(KERN_INFO "Radio MAC is blank; using board-data\n"); ++ memcpy(mac_addr, ar231x_board.config->wlan0_mac, ETH_ALEN); ++ } ++ + return 0; + } + +diff -Naur ./arch/mips/ar231x/pci.c ./arch/mips/ar231x/pci.c +--- ./arch/mips/ar231x/pci.c 2012-01-06 23:54:46.088547779 +0100 ++++ ./arch/mips/ar231x/pci.c 2012-01-06 23:55:57.084899837 +0100 +@@ -176,7 +176,7 @@ + if (ar231x_devtype != DEV_TYPE_AR2315) + return -ENODEV; + +- configspace = (unsigned long) ioremap_nocache(0x80000000, 1*1024*1024); /* Remap PCI config space */ ++ configspace = (unsigned long) ioremap_nocache(AR2315_PCIEXT, 1*1024*1024); /* Remap PCI config space */ + ar231x_pci_controller.io_map_base = + (unsigned long) ioremap_nocache(AR531X_MEM_BASE + AR531X_MEM_SIZE, AR531X_IO_SIZE); + set_io_port_base(ar231x_pci_controller.io_map_base); /* PCI I/O space */ +diff -Naur ./arch/mips/include/asm/mach-ar231x/ar2315_regs.h ./arch/mips/include/asm/mach-ar231x/ar2315_regs.h +--- ./arch/mips/include/asm/mach-ar231x/ar2315_regs.h 2012-01-06 23:54:46.112547898 +0100 ++++ ./arch/mips/include/asm/mach-ar231x/ar2315_regs.h 2012-01-06 23:58:01.261515613 +0100 +@@ -27,14 +27,14 @@ + * Address map + */ + #define AR2315_SPI_READ 0x08000000 /* SPI FLASH */ +-#define AR2315_WLAN0 0xB0000000 /* Wireless MMR */ +-#define AR2315_PCI 0xB0100000 /* PCI MMR */ +-#define AR2315_SDRAMCTL 0xB0300000 /* SDRAM MMR */ +-#define AR2315_LOCAL 0xB0400000 /* LOCAL BUS MMR */ +-#define AR2315_ENET0 0xB0500000 /* ETHERNET MMR */ +-#define AR2315_DSLBASE 0xB1000000 /* RESET CONTROL MMR */ +-#define AR2315_UART0 0xB1100003 /* UART MMR */ +-#define AR2315_SPI 0xB1300000 /* SPI FLASH MMR */ ++#define AR2315_WLAN0 0x10000000 /* Wireless MMR */ ++#define AR2315_PCI 0x10100000 /* PCI MMR */ ++#define AR2315_SDRAMCTL 0x10300000 /* SDRAM MMR */ ++#define AR2315_LOCAL 0x10400000 /* LOCAL BUS MMR */ ++#define AR2315_ENET0 0x10500000 /* ETHERNET MMR */ ++#define AR2315_DSLBASE 0x11000000 /* RESET CONTROL MMR */ ++#define AR2315_UART0 0x11100003 /* UART MMR */ ++#define AR2315_SPI 0x11300000 /* SPI FLASH MMR */ + #define AR2315_PCIEXT 0x80000000 /* pci external */ + + /* +diff -Naur ./arch/mips/include/asm/mach-ar231x/dma-coherence.h ./arch/mips/include/asm/mach-ar231x/dma-coherence.h +--- ./arch/mips/include/asm/mach-ar231x/dma-coherence.h 2012-01-06 23:54:46.112547898 +0100 ++++ ./arch/mips/include/asm/mach-ar231x/dma-coherence.h 2012-01-07 00:00:28.458245493 +0100 +@@ -12,21 +12,33 @@ + + #define PCI_DMA_OFFSET 0x20000000 + +-struct device; ++#include ++ ++static inline dma_addr_t ar231x_dev_offset(struct device *dev) ++{ ++#ifdef CONFIG_PCI ++ extern struct bus_type pci_bus_type; ++ ++ if (dev && dev->bus == &pci_bus_type) ++ return PCI_DMA_OFFSET; ++ else ++#endif ++ return 0; ++} + + static dma_addr_t plat_map_dma_mem(struct device *dev, void *addr, size_t size) + { +- return virt_to_phys(addr) + (dev != NULL ? PCI_DMA_OFFSET : 0); ++ return virt_to_phys(addr) + ar231x_dev_offset(dev); + } + + static dma_addr_t plat_map_dma_mem_page(struct device *dev, struct page *page) + { +- return page_to_phys(page) + (dev != NULL ? PCI_DMA_OFFSET : 0); ++ return page_to_phys(page) + ar231x_dev_offset(dev); + } + +-static unsigned long plat_dma_addr_to_phys(dma_addr_t dma_addr) ++static unsigned long plat_dma_addr_to_phys(struct device *dev, dma_addr_t dma_addr) + { +- return (dma_addr > PCI_DMA_OFFSET ? dma_addr - PCI_DMA_OFFSET : dma_addr); ++ return dma_addr - ar231x_dev_offset(dev); + } + + static inline void plat_unmap_dma_mem(struct device *dev, dma_addr_t dma_addr) +diff -Naur ./arch/mips/mm/dma-default.c ./arch/mips/mm/dma-default.c +--- ./arch/mips/mm/dma-default.c 2012-01-06 23:54:46.088547779 +0100 ++++ ./arch/mips/mm/dma-default.c 2012-01-07 00:01:41.738608901 +0100 +@@ -20,9 +20,9 @@ + + #include + +-static inline unsigned long dma_addr_to_virt(dma_addr_t dma_addr) ++static inline unsigned long dma_addr_to_virt(struct device *dev, dma_addr_t dma_addr) + { +- unsigned long addr = plat_dma_addr_to_phys(dma_addr); ++ unsigned long addr = plat_dma_addr_to_phys(dev, dma_addr); + + return (unsigned long)phys_to_virt(addr); + } +@@ -170,7 +170,7 @@ + enum dma_data_direction direction) + { + if (cpu_is_noncoherent_r10000(dev)) +- __dma_sync(dma_addr_to_virt(dma_addr), size, ++ __dma_sync(dma_addr_to_virt(dev, dma_addr), size, + direction); + + plat_unmap_dma_mem(dev, dma_addr); +@@ -246,7 +246,7 @@ + if (cpu_is_noncoherent_r10000(dev)) { + unsigned long addr; + +- addr = dma_addr_to_virt(dma_handle); ++ addr = dma_addr_to_virt(dev, dma_handle); + __dma_sync(addr, size, direction); + } + } +@@ -262,7 +262,7 @@ + if (!plat_device_is_coherent(dev)) { + unsigned long addr; + +- addr = dma_addr_to_virt(dma_handle); ++ addr = dma_addr_to_virt(dev, dma_handle); + __dma_sync(addr, size, direction); + } + } +@@ -277,7 +277,7 @@ + if (cpu_is_noncoherent_r10000(dev)) { + unsigned long addr; + +- addr = dma_addr_to_virt(dma_handle); ++ addr = dma_addr_to_virt(dev, dma_handle); + __dma_sync(addr + offset, size, direction); + } + } +@@ -293,7 +293,7 @@ + if (!plat_device_is_coherent(dev)) { + unsigned long addr; + +- addr = dma_addr_to_virt(dma_handle); ++ addr = dma_addr_to_virt(dev, dma_handle); + __dma_sync(addr + offset, size, direction); + } + } diff --git a/build_patches/dir300/990_fix_wifi_led.patch b/build_patches/dir300/990_fix_wifi_led.patch new file mode 100644 index 0000000..699698a --- /dev/null +++ b/build_patches/dir300/990_fix_wifi_led.patch @@ -0,0 +1,75 @@ +--- a/drivers/net/wireless/ath/ath5k/led.c 2012-01-07 22:00:48.498399679 +0100 ++++ b/drivers/net/wireless/ath/ath5k/led.c 2012-01-07 22:04:06.783382922 +0100 +@@ -41,6 +41,7 @@ + + #include + #include "ath5k.h" ++#include + + #define ATH_SDEVICE(subv, subd) \ + .vendor = PCI_ANY_ID, .device = PCI_ANY_ID, \ +@@ -97,14 +98,22 @@ + { + if (!test_bit(ATH_STAT_LEDSOFT, ah->status)) + return; ++#ifdef CONFIG_ATHEROS_AR231X ++ gpio_set_value(ah->led_pin, ah->led_on); ++#else + ath5k_hw_set_gpio(ah, ah->led_pin, ah->led_on); ++#endif + } + + void ath5k_led_off(struct ath5k_hw *ah) + { + if (!test_bit(ATH_STAT_LEDSOFT, ah->status)) + return; ++#ifdef CONFIG_ATHEROS_AR231X ++ gpio_set_value(ah->led_pin, !ah->led_on); ++#else + ath5k_hw_set_gpio(ah, ah->led_pin, !ah->led_on); ++#endif + } + + static void +@@ -160,29 +169,33 @@ + { + int ret = 0; + struct ieee80211_hw *hw = ah->hw; +-#ifndef CONFIG_ATHEROS_AR231X +- struct pci_dev *pdev = ah->pdev; +-#endif + char name[ATH5K_LED_MAX_NAME_LEN + 1]; + const struct pci_device_id *match; + +- if (!ah->pdev) +- return 0; +- ++ printk(KERN_ERR "ath5k: init_leds\n"); + #ifdef CONFIG_ATHEROS_AR231X + match = NULL; ++ __set_bit(ATH_STAT_LEDSOFT, ah->status); ++ ah->led_pin = 2; ++ ah->led_on = 0; ++ ++ gpio_direction_output(ah->led_pin, 1); + #else +- match = pci_match_id(&ath5k_led_devices[0], pdev); +-#endif ++ if (!ah->pdev) ++ return 0; ++ ++ match = pci_match_id(&ath5k_led_devices[0], ah->pdev); + if (match) { + __set_bit(ATH_STAT_LEDSOFT, ah->status); + ah->led_pin = ATH_PIN(match->driver_data); + ah->led_on = ATH_POLARITY(match->driver_data); + } ++#endif + + if (!test_bit(ATH_STAT_LEDSOFT, ah->status)) + goto out; + ++ printk(KERN_ERR "ath5k: enable led\n"); + ath5k_led_enable(ah); + + snprintf(name, sizeof(name), "ath5k-%s::rx", wiphy_name(hw->wiphy)); diff --git a/build_patches/tinc/001_fix_a_few_small_memory_leaks.patch b/build_patches/tinc/001_fix_a_few_small_memory_leaks.patch new file mode 100644 index 0000000..053b586 --- /dev/null +++ b/build_patches/tinc/001_fix_a_few_small_memory_leaks.patch @@ -0,0 +1,70 @@ +From 5672863e59e6a114ac6b66de98254b14266c0e61 Mon Sep 17 00:00:00 2001 +From: Guus Sliepen +Date: Sat, 3 Dec 2011 21:59:47 +0100 +Subject: [PATCH 1/1] Fix a few small memory leaks. + +--- + src/protocol_key.c | 2 -- + src/subnet.c | 2 ++ + src/tincd.c | 5 ++++- + 3 files changed, 6 insertions(+), 3 deletions(-) + +diff --git a/src/protocol_key.c b/src/protocol_key.c +index f34ebaa..a7d4447 100644 +--- a/src/protocol_key.c ++++ b/src/protocol_key.c +@@ -242,8 +242,6 @@ bool ans_key_h(connection_t *c) { + + /* Update our copy of the origin's packet key */ + from->outkey = xrealloc(from->outkey, strlen(key) / 2); +- +- from->outkey = xstrdup(key); + from->outkeylength = strlen(key) / 2; + hex2bin(key, from->outkey, from->outkeylength); + +diff --git a/src/subnet.c b/src/subnet.c +index 47f1436..7fffe63 100644 +--- a/src/subnet.c ++++ b/src/subnet.c +@@ -468,6 +468,8 @@ void subnet_update(node_t *owner, subnet_t *subnet, bool up) { + // 4 and 5 are reserved for SUBNET and WEIGHT + xasprintf(&envp[6], "REMOTEADDRESS=%s", address); + xasprintf(&envp[7], "REMOTEPORT=%s", port); ++ free(port); ++ free(address); + } + + name = up ? "subnet-up" : "subnet-down"; +diff --git a/src/tincd.c b/src/tincd.c +index b3d911b..f075168 100644 +--- a/src/tincd.c ++++ b/src/tincd.c +@@ -612,7 +612,7 @@ int main2(int argc, char **argv) { + + /* Change process priority */ + +- char *priority = 0; ++ char *priority = NULL; + + if(get_config_string(lookup_config(config_tree, "ProcessPriority"), &priority)) { + if(!strcasecmp(priority, "Normal")) { +@@ -661,6 +661,8 @@ end: + remove_pid(pidfilename); + #endif + ++ free(priority); ++ + EVP_cleanup(); + ENGINE_cleanup(); + CRYPTO_cleanup_all_ex_data(); +@@ -668,6 +670,7 @@ end: + ERR_free_strings(); + + exit_configuration(&config_tree); ++ list_free(cmdline_conf); + free_names(); + + return status; +-- +1.7.2.5 + diff --git a/build_script.sh b/build_script.sh new file mode 100644 index 0000000..6ba94e0 --- /dev/null +++ b/build_script.sh @@ -0,0 +1,292 @@ +#!/bin/bash + +prepare() { + #Get the OpenWrt Core Source for Firmware + svn checkout svn://svn.openwrt.org/openwrt/tags/backfire_10.03.1/ ./build_dir + #apply own feeds.conf + svn export ./build_patches/feeds.conf ./build_dir/feeds.conf + + test -d ./build_dir/feeds && /bin/rm -rf ./build_dir/feeds + + ./build_dir/scripts/feeds update + + ./build_dir/scripts/feeds install -a + + #set git-rev to actual blaII-rebase + + #patch -p0 < ./build_patches/blaII/Makefile.patch ./build_dir/feeds/batman/batman-adv-devel/Makefile + + # fix some tinc mem leaks + mkdir ./build_dir/feeds/packages/net/tinc/patches + cp ./build_patches/tinc/001_fix_a_few_small_memory_leaks.patch ./build_dir/feeds/packages/net/tinc/patches/001_fix_a_few_small_memory_leaks.patch + + case "$1" in + "dir300" | "fonera") + svn export ./build_patches/ar23xx/260_fixdmaoffset.patch ./build_dir/target/linux/atheros/patches-2.6.30/260_fixdmaoffset.patch + svn export ./build_patches/dir300/990_fix_wifi_led.patch ./build_dir/package/mac80211/patches/990_fix_wifi_led.patch + + #fix bad switch behaveior: + /bin/rm ./build_dir/target/linux/atheros/base-files/etc/uci-defaults/network + ;; + esac +} + +configure_build() { + #create filesdir for our config + test -d ./build_dir/files || mkdir ./build_dir/files + + case "$1" in + "dir300") + svn export ./build_configuration/Atheros_AR231x_AR5312/.config ./build_dir/.config --force + svn export ./root_file_system/default ./build_dir/files/ --force + svn export ./root_file_system/dir300 ./build_dir/files/ --force + ;; + "fonera") + svn export ./build_configuration/Atheros_AR231x_AR5312/.config ./build_dir/.config --force + svn export ./root_file_system/default ./build_dir/files/ --force + svn export ./root_file_system/fonera ./build_dir/files/ --force + ;; + "wrt54g_ap") + svn export ./build_configuration/Broadcom_BCM947xx_953xx_ap/.config ./build_dir/.config --force + svn export ./root_file_system/default ./build_dir/files/ --force + svn export ./root_file_system/wrt54g_ap ./build_dir/files/ --force + ;; + "wrt54g_adhoc") + svn export ./build_configuration/Broadcom_BCM947xx_953xx_adhoc/.config ./build_dir/.config --force + svn export ./root_file_system/default ./build_dir/files/ --force + svn export ./root_file_system/wrt54g_adhoc ./build_dir/files/ --force + ;; + "dir300b_ap") + svn export ./build_configuration/ramips_rt3050/.config ./build_dir/.config --force + svn export ./root_file_system/default ./build_dir/files/ --force + svn export ./root_file_system/dir300b_ap ./build_dir/files/ --force + ;; + "dir300b_adhoc") + svn export ./build_configuration/ramips_rt3050/.config ./build_dir/.config --force + svn export ./root_file_system/default ./build_dir/files/ --force + svn export ./root_file_system/dir300b_adhoc ./build_dir/files/ --force + ;; + "wr1043nd") + svn export ./build_configuration/Atheros_AR71xx_AR7240_AR913x/.config_wr1043nd ./build_dir/.config --force + svn export ./root_file_system/default ./build_dir/files/ --force + svn export ./root_file_system/wr1043nd ./build_dir/files/ --force + ;; + "wr741nd") + svn export ./build_configuration/Atheros_AR71xx_AR7240_AR913x/.config_wr741nd ./build_dir/.config --force + svn export ./root_file_system/default ./build_dir/files/ --force + svn export ./root_file_system/wr741nd ./build_dir/files/ --force + ;; + *) + echo "ERROR"; + ;; + esac + + #insert actual firware version informations into release file + echo "FIRMWARE_REVISION=\""`svn info ./ |grep Revision: |cut -c11-`"\"" >> ./build_dir/files/etc/firmware_release + echo "OPENWRT_CORE_REVISION=\""`svn info ./build_dir |grep Revision: |cut -c11-`"\"" >> ./build_dir/files/etc/firmware_release + echo "OPENWRT_FEEDS_PACKAGES_REVISION=\""`svn info ./build_dir/feeds/packages |grep Revision: |cut -c11-`"\"" >> ./build_dir/files/etc/firmware_release +} + +build() { + cd ./build_dir + case "$2" in + "debug") + make V=99 + ;; + "fast") + make -j18 + ;; + *) + ionice -c 3 -- nice -n 10 -- make -j8 + ;; + esac + # actually this does northing! + # rm -rf ./build_dir/files/ + cd ../ + + if [ ! -d bin ]; then + mkdir bin + fi + + case "$1" in + "dir300") + cp ./build_dir/bin/atheros/openwrt-atheros-root.squashfs ./bin/openwrt-$1-root.squashfs + cp ./build_dir/bin/atheros/openwrt-atheros-vmlinux.lzma ./bin/openwrt-$1-vmlinux.lzma + cp ./build_dir/bin/atheros/openwrt-atheros-combined.squashfs.img ./bin/openwrt-$1-combined.squashfs.img + ;; + "fonera") + cp ./build_dir/bin/atheros/openwrt-atheros-root.squashfs ./bin/openwrt-$1-root.squashfs + cp ./build_dir/bin/atheros/openwrt-atheros-vmlinux.lzma ./bin/openwrt-$1-vmlinux.lzma + cp ./build_dir/bin/atheros/openwrt-atheros-combined.squashfs.img ./bin/openwrt-$1-combined.squashfs.img + ;; + "dir300b_adhoc" | "dir300b_ap") + + #build webflash image + rm -rf ./bin/openwrt-dir300b1-squashfs-webflash.bin + ./flash_tools/dir300b-flash/v2image -v \ + -i ./build_dir/bin/ramips/openwrt-ramips-rt305x-dir-300-b1-squashfs-sysupgrade.bin \ + -o bin/openwrt-dir300b1-squashfs-webflash.bin \ + -d /dev/mtdblock/2 -s wrgn23_dlwbr_dir300b + ;; + "wr1043nd") + cp ./build_dir/bin/ar71xx/openwrt-ar71xx-tl-wr1043nd-v1-squashfs-factory.bin ./bin/ + cp ./build_dir/bin/ar71xx/openwrt-ar71xx-tl-wr1043nd-v1-squashfs-sysupgrade.bin ./bin/ + ;; + "wr741nd") + cp ./build_dir/bin/ar71xx/openwrt-ar71xx-tl-wr741nd-v1-squashfs-factory.bin ./bin/ + cp ./build_dir/bin/ar71xx/openwrt-ar71xx-tl-wr741nd-v1-squashfs-sysupgrade.bin ./bin/ + ;; + "wrt54g_ap" | "wrt54g_adhoc") + cp ./build_dir/bin/brcm47xx/openwrt-wrt54g-squashfs.bin ./bin/ + ;; + *) + echo "Nothing implemented here yet -> missing knowledge!!" + ;; + esac +} + +flash() { + #Get flash tools + svn export http://svn.freifunk-ol.de/build_environment/flash_tools + + if [ ! "`whoami`" = "root" ] + then + echo "You need to be root to flash!" + exit 1 + fi + + echo "Do not plugin your router now, you will be asked to do this later!" + echo "Stopping Network manager and starting normal network and tftp server..." + if [ -f /etc/rc.d/networkmanager ];then + /etc/rc.d/networkmanager stop&&/etc/rc.d/network start + /etc/rc.d/tftpd start + elif [ -f /etc/init.d/networkmanager ];then + /etc/init.d/networkmanager stop&&/etc/init.d/network start + /etc/init.d/tftpd start + elif [ -f /usr/sbin/invoke-rc.d ];then + invoke-rc.d tftpd-hpa start + invoke-rc.d network-manager stop + fi + + echo "Clearing Firewall!" + iptables -F + iptables -P INPUT ACCEPT + iptables -P OUTPUT ACCEPT + + echo "Flashing now! Please plugin your router into the powerline now" + case "$1" in + "dir300") + if [ -f /usr/sbin/dir300-flash ]; then + /usr/sbin/dir300-flash $2 ./bin/openwrt-$1-vmlinux.lzma ./bin/openwrt-$1-root.squashfs + else + ./flash_tools/dir300-flash/dir300-flash.sh $2 ./bin/openwrt-$1-vmlinux.lzma ./bin/openwrt-$1-root.squashfs + fi + ;; + "fonera") + echo "In some cases you have to set a symlink to libpcap to make flashing work (Tim told me that it is evil if I do that for you):" + echo "ln -s /usr/lib/libpcap.so.1.1.1 /usr/lib/libpcap.so.0.8" + + ./flash_tools/fonera-flash/ap51-flash-1.0-42 $2 ./bin/openwrt-$1-root.squashfs ./bin/openwrt-$1-vmlinux.lzma freifunc + ;; + "dir300b_adhoc" | "dir300b_ap") + echo "* Press RESET on your router and power it on." + echo "* Now connect it to your Computer using the WAN interface" + echo "* Configure your Computer to use 192.168.0.2 as IP-Adress" + echo "* Go to http://192.168.0.1 and flash your router." + echo "* Happy Freifunk'ing! :-)" + ;; + *) + echo "Nothing implemented here yet" + ;; + esac + + echo "Starting Networkmanager again" + if [ -f /etc/rc.d/networkmanager ];then + /etc/rc.d/networkmanager start + elif [ -f /etc/init.d/networkmanager ];then + /etc/init.d/networkmanager start + elif [ -f /usr/sbin/invoke-rc.d ];then + invoke-rc.d tftpd-hpa stop + invoke-rc.d network-manager start + fi +} + +clean() { + /bin/rm -rf flash_tools build_dir bin +} + +routers() { + echo "router-types: " + echo " dir300" + echo " dir300b_adhoc" + echo " dir300b_ap" + echo " fonera" + echo " wrt54g_ap" + echo " wrt54g_adhoc" + echo " wr1043nd" +} + +case "$1" in + "prepare") + if [ "$2" = "help" ] || [ "$2" = "" ]; then + echo "This option fetches the sources for the images and configurates the build so that it can be compiled" + echo "Usage: $0 $1 router-type" + routers + else + prepare "$2" + configure_build "$2" + fi + ;; + "build") + if [ "$2" = "help" ] || [ "$2" = "" ]; then + echo "This option compiles the firmware" + echo "Normaly the build uses lower IO and System priorities, " + echo "you can append \"fast\" option, to use normal user priorities" + echo "Usage: $0 $1 router-type [fast|debug]" + routers + echo "Parallel build may fail with revisions before 24969 see https://dev.openwrt.org/ticket/8596" + else + build "$2" "$3" + fi + ;; + "download") + if [ "$2" = "help" ] || [ "$2" = "" ]; then + echo "This option downloads the ready configured images from an external location if needet." + echo "Usage: $0 $1 http://downloadfolder router-type" + routers + else + wget "$2/openwrt-$3-root.squashfs" + wget "$2/openwrt-$3-vmlinux.lzma" + fi + ;; + "flash") + if [ "$2" = "help" ] || [ "$2" = "" ]; then + echo "This option flashes the router." + echo "$0 $1 router-type net-dev" + routers + echo "net-dev:" + echo " ethX" + else + flash "$2" "$3" "$4" + fi + ;; + "clean") + if [ "$2" = "help" ] || [ "$2" = "" ]; then + echo "This option cleans all build files." + echo "$0 $1 all" + else + clean + fi + ;; + *) + echo "This is the Build Environment Script of the Freifunk Community Oldenburg." + echo "Usage: $0 command" + echo "command:" + echo " prepare" + echo " build" + echo " flash" + echo " download" + echo "" + echo "If you need help to one of these options just type $0 command help" + ;; +esac diff --git a/root_file_system/fonera/etc/config/wireless b/root_file_system/fonera/etc/config/wireless new file mode 100644 index 0000000..b58a3b6 --- /dev/null +++ b/root_file_system/fonera/etc/config/wireless @@ -0,0 +1,22 @@ +config 'wifi-device' 'wifi0' + option 'type' 'mac80211' + option 'phy' 'phy0' + option 'disabled' '0' + option 'channel' '6' + +config 'wifi-iface' + option 'device' 'wifi0' + option 'network' 'wlanmesh' + option 'mode' 'adhoc' + option 'ssid' 'batman.oldenburg.freifunk.net' + option 'bssid' '02:CA:FF:EE:BA:BE' + option 'encryption' 'none' + option 'hidden' '1' + +config 'wifi-iface' + option 'device' 'wifi0' + option 'network' 'mesh' + option 'mode' 'ap' + option 'ssid' 'oldenburg.freifunk.net' + option 'encryption' 'none' +