[OpenWrt-Devel] [PATCH, v2] lantiq: fix etop registers
As first reported more than a year ago (https://lists.openwrt.org/pipermail/openwrt-devel/2012-August/016240.html and https://lists.openwrt.org/pipermail/openwrt-devel/2012-August/016241.html), some of the register definitions of the lantiq etop driver are incorrect. When OpenWrt is booted with a bootloader which doesn't do proper network initialization of its own (e.g. brnboot), ethernet won't work. The patch below changes the register names and addresses to match the lantiq etop driver included with the recent U-Boot. At the moment the MII/RMII setting in the lantiq .dts-files has no effect, since wrong registers are written. Once this patch is applied, it is necessary to make sure that the MII/RMII setting in the .dts-file is correct. v2: fix mangled whitespaces Signed-off-by: Matti Laakso malaa...@elisanet.fi --- Index: target/linux/lantiq/patches-3.10/0200-NET-fix-etop-registers.patch === --- target/linux/lantiq/patches-3.10/0200-NET-fix-etop-registers.patch (Revision 0) +++ target/linux/lantiq/patches-3.10/0200-NET-fix-etop-registers.patch (Revision 0) @@ -0,0 +1,121 @@ +--- a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c +@@ -47,7 +47,7 @@ + #include xway_dma.h + #include lantiq_platform.h + +-#define LTQ_ETOP_MDIO 0x11804 ++#define LTQ_ETOP_MDIO_ACC 0x11804 + #define MDIO_REQUEST 0x8000 + #define MDIO_READ 0x4000 + #define MDIO_ADDR_MASK0x1f +@@ -56,27 +56,38 @@ + #define MDIO_REG_OFFSET 0x10 + #define MDIO_VAL_MASK 0x + +-#define PPE32_CGEN0x800 +-#define LQ_PPE32_ENET_MAC_CFG 0x1840 ++#define LTQ_ETOP_MDIO_CFG 0x11800 ++#define MDIO_CFG_MASK 0x6 ++ ++#define LTQ_ETOP_CFG0x11808 ++#define LTQ_ETOP_IGPLEN 0x11820 ++#define LTQ_ETOP_MAC_CFG 0x11840 + + #define LTQ_ETOP_ENETS0 0x11850 + #define LTQ_ETOP_MAC_DA0 0x1186C + #define LTQ_ETOP_MAC_DA1 0x11870 +-#define LTQ_ETOP_CFG 0x16020 +-#define LTQ_ETOP_IGPLEN 0x16080 ++ ++#define MAC_CFG_MASK 0xfff ++#define MAC_CFG_CGEN (1 11) ++#define MAC_CFG_DUPLEX(1 2) ++#define MAC_CFG_SPEED (1 1) ++#define MAC_CFG_LINK (1 0) + + #define MAX_DMA_CHAN 0x8 + #define MAX_DMA_CRC_LEN 0x4 + #define MAX_DMA_DATA_LEN 0x600 + + #define ETOP_FTCU BIT(28) +-#define ETOP_MII_MASK 0xf +-#define ETOP_MII_NORMAL 0xd +-#define ETOP_MII_REVERSE 0xe + #define ETOP_PLEN_UNDER 0x40 +-#define ETOP_CGEN 0x800 + #define ETOP_CFG_MII0 0x01 + ++#define ETOP_CFG_MASK 0xfff ++#define ETOP_CFG_FEN0 (1 8) ++#define ETOP_CFG_SEN0 (1 6) ++#define ETOP_CFG_OFF1 (1 3) ++#define ETOP_CFG_REMII0 (1 1) ++#define ETOP_CFG_OFF0 (1 0) ++ + #define LTQ_GBIT_MDIO_CTL 0xCC + #define LTQ_GBIT_MDIO_DATA0xd0 + #define LTQ_GBIT_GCTL00x68 +@@ -355,16 +366,19 @@ ltq_etop_hw_init(struct net_device *dev) + /* force the etops link to the gbit to MII */ + mii_mode = PHY_INTERFACE_MODE_MII; + } ++ ltq_etop_w32_mask(MDIO_CFG_MASK, 0, LTQ_ETOP_MDIO_CFG); ++ ltq_etop_w32_mask(MAC_CFG_MASK, MAC_CFG_CGEN | MAC_CFG_DUPLEX | ++ MAC_CFG_SPEED | MAC_CFG_LINK, LTQ_ETOP_MAC_CFG); + + switch (mii_mode) { + case PHY_INTERFACE_MODE_RMII: +- ltq_etop_w32_mask(ETOP_MII_MASK, +- ETOP_MII_REVERSE, LTQ_ETOP_CFG); ++ ltq_etop_w32_mask(ETOP_CFG_MASK, ETOP_CFG_REMII0 | ETOP_CFG_OFF1 | ++ ETOP_CFG_SEN0 | ETOP_CFG_FEN0, LTQ_ETOP_CFG); + break; + + case PHY_INTERFACE_MODE_MII: +- ltq_etop_w32_mask(ETOP_MII_MASK, +- ETOP_MII_NORMAL, LTQ_ETOP_CFG); ++ ltq_etop_w32_mask(ETOP_CFG_MASK, ETOP_CFG_OFF1 | ++ ETOP_CFG_SEN0 | ETOP_CFG_FEN0, LTQ_ETOP_CFG); + break; + + default: +@@ -385,9 +399,6 @@ ltq_etop_hw_init(struct net_device *dev) + return -ENOTSUPP; + } + +- /* enable crc generation */ +- ltq_etop_w32(PPE32_CGEN, LQ_PPE32_ENET_MAC_CFG); +- + return 0; + } + +@@ -521,9 +532,9 @@ ltq_etop_mdio_wr(struct mii_bus *bus, in + ((phy_reg MDIO_REG_MASK) MDIO_REG_OFFSET) | + phy_data; + +- while (ltq_etop_r32(LTQ_ETOP_MDIO) MDIO_REQUEST) ++ while (ltq_etop_r32(LTQ_ETOP_MDIO_ACC) MDIO_REQUEST) + ; +- ltq_etop_w32(val, LTQ_ETOP_MDIO); ++ ltq_etop_w32(val, LTQ_ETOP_MDIO_ACC); + return 0; + } + +@@ -534,12 +545,12 @@ ltq_etop_mdio_rd(struct mii_bus *bus, in + ((phy_addr MDIO_ADDR_MASK) MDIO_ADDR_OFFSET) | + ((phy_reg MDIO_REG_MASK)
Re: [OpenWrt-Devel] [ath9k-devel] ath9k: Deaf QCA9558 when setting rxchainmask
Alex Hacker wrote: Thank you Sujith. Probably I understood the following patch in a wrong way. Felix removed all chain masks checking. If the mask 5 is invalid, how about the mask 4 and 6? The patch is correct. For calibration, the mask that is calibrated in the EEPROM has to be used. Even if you change the mask config dynamically, either using the antenna API or ath9k's debugs, it will be disregarded when calibration is done. Sujith ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] hotplug: ifup-calls during shutdown / netifd-crash
* Bastian Bittorf bitt...@bluebottle.com [12.11.2013 10:32]: here on an alix2d i can see hotplug calls with ACTION = ifup during shutdown. also netif-crashs. i'am unsure why: maybe netifd crashs because of interface shutdowns and procd refires it again, so it takes all interfaces up again? the game goes infinite and nobody wins: especially: reboot does not work... 2 possible solutions for this: 1) if procd signals shutdown via ubus, then netifd should not send out 'ifup' calls anymore 2) in K90-network-stop we can e.g. 'touch /tmp/hotplug-noifup' and check for existence and respect in /sbin/hotplug-call bye, bastian ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] Unifi AP Pro sysupgrade patch V3
The current implementation of mtd will not append the backup file created by sysupgrade to the correct partition, as mtd will append the data to first jffs2 partition it finds. As the kernel is also stored on a jffs2 partition (which resides before the overlay partition), the data will be appended to this partition. To fix this problem, a new option -s number skip the first n bytes when appending data to the jffs2 partiton, defaults to 0 is added to mtd. Signed-off-by: Peter Wagner tripo...@gmx.atdiff --git a/package/base-files/files/lib/upgrade/common.sh b/package/base-files/files/lib/upgrade/common.sh index 9116206..e01ffc5 100644 --- a/package/base-files/files/lib/upgrade/common.sh +++ b/package/base-files/files/lib/upgrade/common.sh @@ -188,7 +188,7 @@ jffs2_copy_config() { default_do_upgrade() { sync if [ $SAVE_CONFIG -eq 1 ]; then - get_image $1 | mtd -j $CONF_TAR write - ${PART_NAME:-image} + get_image $1 | mtd $MTD_CONFIG_ARGS -j $CONF_TAR write - ${PART_NAME:-image} else get_image $1 | mtd write - ${PART_NAME:-image} fi diff --git a/package/base-files/files/sbin/sysupgrade b/package/base-files/files/sbin/sysupgrade index eb5ab03..14b09eb 100755 --- a/package/base-files/files/sbin/sysupgrade +++ b/package/base-files/files/sbin/sysupgrade @@ -4,6 +4,7 @@ # initialize defaults RAMFS_COPY_BIN= # extra programs for temporary ramfs root RAMFS_COPY_DATA= # extra data files +export MTD_CONFIG_ARGS= export INTERACTIVE=0 export VERBOSE=1 export SAVE_CONFIG=1 diff --git a/package/system/mtd/src/mtd.c b/package/system/mtd/src/mtd.c index a660486..b47eab4 100644 --- a/package/system/mtd/src/mtd.c +++ b/package/system/mtd/src/mtd.c @@ -55,6 +55,7 @@ int quiet; int no_erase; int mtdsize = 0; int erasesize = 0; +int jffs2_skip_bytes=0; int mtd_open(const char *mtd, bool block) { @@ -339,7 +340,6 @@ resume: fprintf(stderr, Could not open mtd device: %s\n, mtd); exit(1); } - if (part_offset 0) { fprintf(stderr, Seeking on mtd device '%s' to: %u\n, mtd, part_offset); lseek(fd, part_offset, SEEK_SET); @@ -380,7 +380,8 @@ resume: } if (jffs2file) { - if (memcmp(buf, JFFS2_EOF, sizeof(JFFS2_EOF) - 1) == 0) { + if (w = jffs2_skip_bytes + memcmp(buf, JFFS2_EOF, sizeof(JFFS2_EOF) - 1) == 0) { if (!quiet) fprintf(stderr, \b\b\b ); if (quiet 2) @@ -503,6 +504,7 @@ static void usage(void) -e device erase device before executing the command\n -d name directory for jffs2write, defaults to \tmp\\n -j name integrate file into jffs2 data when writing an image\n + -s number skip the first n bytes when appending data to the jffs2 partiton, defaults to \0\\n -p write beginning at partition offset\n); if (mtd_fixtrx) { fprintf(stderr, @@ -560,7 +562,7 @@ int main (int argc, char **argv) #ifdef FIS_SUPPORT F: #endif - frnqe:d:j:p:o:)) != -1) + frnqe:d:s:j:p:o:)) != -1) switch (ch) { case 'f': force = 1; @@ -574,6 +576,14 @@ int main (int argc, char **argv) case 'j': jffs2file = optarg; break; + case 's': +errno = 0; +jffs2_skip_bytes = strtoul(optarg, 0, 0); +if (errno) { + fprintf(stderr, -s: illegal numeric string\n); + usage(); +} +break; case 'q': quiet++; break; diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh index 266bf3f..1eb9354 100755 --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh @@ -327,6 +327,10 @@ platform_do_upgrade() { om2p-lc) platform_do_upgrade_openmesh $ARGV ;; + uap-pro) + MTD_CONFIG_ARGS=-s 0x18 + default_do_upgrade $ARGV + ;; *) default_do_upgrade $ARGV ;; ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] Unifi AP Pro sysupgrade patch V4
Changelog: V1: skip the first n-1 occurrence of JFFS2_EOF V2: change argument handling V3: skip first n bytes when appending jffs2 data V4: remove quotes for $MTD_CONFIG_ARGS The current implementation of mtd will not append the backup file created by sysupgrade to the correct partition, as mtd will append the data to first jffs2 partition it finds. As the kernel is also stored on a jffs2 partition (which resides before the overlay partition), the data will be appended to this partition. To fix this problem, a new option -s number skip the first n bytes when appending data to the jffs2 partiton, defaults to 0 is added to mtd. Signed-off-by: Peter Wagner tripo...@gmx.atdiff --git a/package/base-files/files/lib/upgrade/common.sh b/package/base-files/files/lib/upgrade/common.sh index 9116206..c19640f 100644 --- a/package/base-files/files/lib/upgrade/common.sh +++ b/package/base-files/files/lib/upgrade/common.sh @@ -188,7 +188,7 @@ jffs2_copy_config() { default_do_upgrade() { sync if [ $SAVE_CONFIG -eq 1 ]; then - get_image $1 | mtd -j $CONF_TAR write - ${PART_NAME:-image} + get_image $1 | mtd $MTD_CONFIG_ARGS -j $CONF_TAR write - ${PART_NAME:-image} else get_image $1 | mtd write - ${PART_NAME:-image} fi diff --git a/package/base-files/files/sbin/sysupgrade b/package/base-files/files/sbin/sysupgrade index eb5ab03..14b09eb 100755 --- a/package/base-files/files/sbin/sysupgrade +++ b/package/base-files/files/sbin/sysupgrade @@ -4,6 +4,7 @@ # initialize defaults RAMFS_COPY_BIN= # extra programs for temporary ramfs root RAMFS_COPY_DATA= # extra data files +export MTD_CONFIG_ARGS= export INTERACTIVE=0 export VERBOSE=1 export SAVE_CONFIG=1 diff --git a/package/system/mtd/src/mtd.c b/package/system/mtd/src/mtd.c index a660486..b47eab4 100644 --- a/package/system/mtd/src/mtd.c +++ b/package/system/mtd/src/mtd.c @@ -55,6 +55,7 @@ int quiet; int no_erase; int mtdsize = 0; int erasesize = 0; +int jffs2_skip_bytes=0; int mtd_open(const char *mtd, bool block) { @@ -339,7 +340,6 @@ resume: fprintf(stderr, Could not open mtd device: %s\n, mtd); exit(1); } - if (part_offset 0) { fprintf(stderr, Seeking on mtd device '%s' to: %u\n, mtd, part_offset); lseek(fd, part_offset, SEEK_SET); @@ -380,7 +380,8 @@ resume: } if (jffs2file) { - if (memcmp(buf, JFFS2_EOF, sizeof(JFFS2_EOF) - 1) == 0) { + if (w = jffs2_skip_bytes + memcmp(buf, JFFS2_EOF, sizeof(JFFS2_EOF) - 1) == 0) { if (!quiet) fprintf(stderr, \b\b\b ); if (quiet 2) @@ -503,6 +504,7 @@ static void usage(void) -e device erase device before executing the command\n -d name directory for jffs2write, defaults to \tmp\\n -j name integrate file into jffs2 data when writing an image\n + -s number skip the first n bytes when appending data to the jffs2 partiton, defaults to \0\\n -p write beginning at partition offset\n); if (mtd_fixtrx) { fprintf(stderr, @@ -560,7 +562,7 @@ int main (int argc, char **argv) #ifdef FIS_SUPPORT F: #endif - frnqe:d:j:p:o:)) != -1) + frnqe:d:s:j:p:o:)) != -1) switch (ch) { case 'f': force = 1; @@ -574,6 +576,14 @@ int main (int argc, char **argv) case 'j': jffs2file = optarg; break; + case 's': +errno = 0; +jffs2_skip_bytes = strtoul(optarg, 0, 0); +if (errno) { + fprintf(stderr, -s: illegal numeric string\n); + usage(); +} +break; case 'q': quiet++; break; diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh index 266bf3f..1eb9354 100755 --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh @@ -327,6 +327,10 @@ platform_do_upgrade() { om2p-lc) platform_do_upgrade_openmesh $ARGV ;; + uap-pro) + MTD_CONFIG_ARGS=-s 0x18 + default_do_upgrade $ARGV + ;; *) default_do_upgrade $ARGV ;; ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH 0/2]netifd: Check routing table parameter when updating route
The route table parameter needs to be checked in interface_update_proto_route; a route which has an identical nexthop but a different routing table needs to be deleted and added in the correct routing table. While dumping the route list via ubus; don't display the default route when no default route is enabled. Additonal make the ip4table and ip6table parameters visible when displaying the interface status. Signed-off-by: Hans Dedecker dedec...@gmail.com --- interface-ip.c |3 ++- interface.c|2 +- ubus.c |7 +++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/interface-ip.c b/interface-ip.c index 084688c..fb1163c 100644 --- a/interface-ip.c +++ b/interface-ip.c @@ -632,7 +632,8 @@ interface_update_proto_route(struct vlist_tree *tree, route_new = container_of(node_new, struct device_route, node); if (node_old node_new) - keep = !memcmp(route_old-nexthop, route_new-nexthop, sizeof(route_old-nexthop)); + keep = !memcmp(route_old-nexthop, route_new-nexthop, sizeof(route_old-nexthop)) + (route_old-table == route_new-table); if (node_old) { if (!(route_old-flags DEVADDR_EXTERNAL) route_old-enabled !keep) diff --git a/interface.c b/interface.c index 23c7032..9c208a2 100644 --- a/interface.c +++ b/interface.c @@ -918,7 +918,7 @@ interface_change_config(struct interface *if_old, struct interface *if_new) #undef UPDATE if (reload) { - D(INTERFACE, Reload interface '%s because of config changes\n, + D(INTERFACE, Reload interface '%s' because of config changes\n, if_old-name); interface_clear_errors(if_old); set_config_state(if_old, IFC_RELOAD); diff --git a/ubus.c b/ubus.c index 9063680..1b90594 100644 --- a/ubus.c +++ b/ubus.c @@ -459,6 +459,9 @@ interface_ip_dump_route_list(struct interface_ip_settings *ip, bool enabled) if (route-enabled != enabled) continue; + if ((ip-no_defaultroute == enabled) !route-mask) + continue; + if ((route-flags DEVADDR_FAMILY) == DEVADDR_INET4) af = AF_INET; else @@ -655,6 +658,10 @@ netifd_dump_status(struct interface *iface) blobmsg_add_string(b, device, dev-ifname); if (iface-state == IFS_UP) { + if (iface-ip4table) + blobmsg_add_u32(b, ip4table, iface-ip4table); + if (iface-ip6table) + blobmsg_add_u32(b, ip6table, iface-ip6table); blobmsg_add_u32(b, metric, iface-metric); blobmsg_add_u8(b, delegation, !iface-proto_ip.no_delegation); a = blobmsg_open_array(b, ipv4-address); -- 1.7.1 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH 2/2]netifd: Link layer status support
Patch implements link layer state awareness (aka carrier detection) in netifd; an interface will only go to the setup state (and send a setup event to the protocol handlers) when it's enabled and the link state is enabled. Vice versa an interface will go the down state when either it's disabled or the link goes down; in this case a teardown will be send to the protocol handlers. It solves the issue that a DHCPv4/v6 client remains active on a WAN link which loses its link connectivity; also a DHCPv4/v6 client will only be started on a WAN link when the link layer is up and the interface is enabled. Patch also fixes some issues with handling of netlink messages as the original implementation was edge triggered. Testing has been done with PPP, IPoE, tunnel, static interfaces. Signed-off-by: Hans Dedecker dedec...@gmail.com --- alias.c| 16 +-- device.c | 29 - device.h |4 ++ interface.c| 130 +++- interface.h|2 + macvlan.c |6 +++ proto-shell.c |1 + system-linux.c | 117 +- vlan.c | 13 - 9 files changed, 258 insertions(+), 60 deletions(-) diff --git a/alias.c b/alias.c index 4e0a6be..cef125f 100644 --- a/alias.c +++ b/alias.c @@ -51,7 +51,7 @@ static void alias_set_device(struct alias_device *alias, struct device *dev) device_remove_user(alias-dep); alias-dev.hidden = !dev; if (dev) { - alias-dev.ifindex = dev-ifindex; + device_set_ifindex(alias-dev, dev-ifindex); strcpy(alias-dev.ifname, dev-ifname); device_broadcast_event(alias-dev, DEV_EVENT_UPDATE_IFNAME); device_add_user(alias-dep, dev); @@ -83,14 +83,22 @@ alias_device_set_state(struct device *dev, bool state) static void alias_device_cb(struct device_user *dep, enum device_event ev) { struct alias_device *alias; - bool present = false; + bool new_state = false; alias = container_of(dep, struct alias_device, dep); switch (ev) { case DEV_EVENT_ADD: - present = true; + new_state = true; case DEV_EVENT_REMOVE: - device_set_present(alias-dev, present); + device_set_present(alias-dev, new_state); + break; + case DEV_EVENT_LINK_UP: + new_state = true; + case DEV_EVENT_LINK_DOWN: + device_set_link(alias-dev, new_state); + break; + case DEV_EVENT_UPDATE_IFINDEX: + device_set_ifindex(alias-dev, dep-dev-ifindex); break; default: device_broadcast_event(alias-dev, ev); diff --git a/device.c b/device.c index 56fc3f7..f8834f0 100644 --- a/device.c +++ b/device.c @@ -207,7 +207,7 @@ int device_claim(struct device_user *dep) return 0; dep-claimed = true; - D(DEVICE, Claim %s %s, new refcount: %d\n, dev-type-name, dev-ifname, dev-active + 1); + D(DEVICE, Claim %s %s, new active count: %d\n, dev-type-name, dev-ifname, dev-active + 1); if (++dev-active != 1) return 0; @@ -233,7 +233,7 @@ void device_release(struct device_user *dep) dep-claimed = false; dev-active--; - D(DEVICE, Release %s %s, new refcount: %d\n, dev-type-name, dev-ifname, dev-active); + D(DEVICE, Release %s %s, new active count: %d\n, dev-type-name, dev-ifname, dev-active); assert(dev-active = 0); if (dev-active) @@ -390,6 +390,26 @@ void device_set_present(struct device *dev, bool state) device_refresh_present(dev); } +void device_set_link(struct device *dev, bool state) +{ + if (dev-link_active == state) + return; + + netifd_log_message(L_NOTICE, %s '%s' link is %s\n, dev-type-name, dev-ifname, state ? up : down ); + + dev-link_active = state; + device_broadcast_event(dev, state ? DEV_EVENT_LINK_UP : DEV_EVENT_LINK_DOWN); +} + +void device_set_ifindex(struct device *dev, int ifindex) +{ + if (dev-ifindex == ifindex) + return; + + dev-ifindex = ifindex; + device_broadcast_event(dev, DEV_EVENT_UPDATE_IFINDEX); +} + static int device_refcount(struct device *dev) { struct list_head *list; @@ -431,6 +451,9 @@ void device_add_user(struct device_user *dep, struct device *dev) dep-cb(dep, DEV_EVENT_ADD); if (dev-active) dep-cb(dep, DEV_EVENT_UP); + + if (dev-link_active) + dep-cb(dep, DEV_EVENT_LINK_UP); } } @@ -663,6 +686,8 @@ device_dump_status(struct blob_buf *b, struct device *dev) return; blobmsg_add_u8(b, up, !!dev-active); + blobmsg_add_u8(b, carrier, !!dev-link_active); + if (dev-type-dump_info)
[OpenWrt-Devel] [PATCH 1/2]netifd: Fix tunnel mtu setting and configurable don't fragment support
The tunnel mtu parameter can be configured in UCI but the setting was not applied on tunnel interfaces.The patch also adds functionality to configure the don't fragment bit of tunnel interfaces via UCI. Signed-off-by: Hans Dedecker dedec...@gmail.com --- device.c | 12 ++-- device.h |2 +- system-linux.c | 15 ++- system.c | 16 +--- system.h |2 ++ tunnel.c | 24 +++- 6 files changed, 51 insertions(+), 20 deletions(-) diff --git a/device.c b/device.c index c30650a..56fc3f7 100644 --- a/device.c +++ b/device.c @@ -31,12 +31,12 @@ static struct avl_tree devices; static const struct blobmsg_policy dev_attrs[__DEV_ATTR_MAX] = { - [DEV_ATTR_TYPE] = { type, BLOBMSG_TYPE_STRING }, - [DEV_ATTR_IFNAME] = { ifname, BLOBMSG_TYPE_ARRAY }, - [DEV_ATTR_MTU] = { mtu, BLOBMSG_TYPE_INT32 }, - [DEV_ATTR_MACADDR] = { macaddr, BLOBMSG_TYPE_STRING }, - [DEV_ATTR_TXQUEUELEN] = { txqueuelen, BLOBMSG_TYPE_INT32 }, - [DEV_ATTR_ENABLED] = { enabled, BLOBMSG_TYPE_BOOL }, + [DEV_ATTR_TYPE] = { .name = type, .type = BLOBMSG_TYPE_STRING }, + [DEV_ATTR_IFNAME] = { .name = ifname, .type = BLOBMSG_TYPE_ARRAY }, + [DEV_ATTR_MTU] = { .name = mtu, .type = BLOBMSG_TYPE_INT32 }, + [DEV_ATTR_MACADDR] = { .name = macaddr, .type = BLOBMSG_TYPE_STRING }, + [DEV_ATTR_TXQUEUELEN] = { .name = txqueuelen, .type = BLOBMSG_TYPE_INT32 }, + [DEV_ATTR_ENABLED] = { .name = enabled, .type = BLOBMSG_TYPE_BOOL }, }; const struct uci_blob_param_list device_attr_list = { diff --git a/device.h b/device.h index dbcaf77..d63ffe3 100644 --- a/device.h +++ b/device.h @@ -59,7 +59,7 @@ struct device_type { enum { DEV_OPT_MTU = (1 0), DEV_OPT_MACADDR = (1 1), - DEV_OPT_TXQUEUELEN = (1 2) + DEV_OPT_TXQUEUELEN = (1 2), }; /* events broadcasted to all users of a device */ diff --git a/system-linux.c b/system-linux.c index d01d7e3..dae98b0 100644 --- a/system-linux.c +++ b/system-linux.c @@ -1418,11 +1418,11 @@ out: return ret; } - int system_add_ip_tunnel(const char *name, struct blob_attr *attr) { struct blob_attr *tb[__TUNNEL_ATTR_MAX]; struct blob_attr *cur; + bool set_df = true; const char *str; system_del_ip_tunnel(name); @@ -1434,9 +1434,15 @@ int system_add_ip_tunnel(const char *name, struct blob_attr *attr) return -EINVAL; str = blobmsg_data(cur); + if ((cur = tb[TUNNEL_ATTR_DF])) + set_df = blobmsg_get_bool(cur); + unsigned int ttl = 0; - if ((cur = tb[TUNNEL_ATTR_TTL]) (ttl = blobmsg_get_u32(cur)) 255) - return -EINVAL; + if ((cur = tb[TUNNEL_ATTR_TTL])) { + ttl = blobmsg_get_u32(cur); + if (ttl 255 || (!set_df ttl)) + return -EINVAL; + } unsigned int link = 0; if ((cur = tb[TUNNEL_ATTR_LINK])) { @@ -1448,14 +1454,13 @@ int system_add_ip_tunnel(const char *name, struct blob_attr *attr) link = iface-l3_dev.dev-ifindex; } - if (!strcmp(str, sit)) { struct ip_tunnel_parm p = { .link = link, .iph = { .version = 4, .ihl = 5, - .frag_off = htons(IP_DF), + .frag_off = set_df ? htons(IP_DF) : 0, .protocol = IPPROTO_IPV6, .ttl = ttl } diff --git a/system.c b/system.c index 8e866da..3dd90b4 100644 --- a/system.c +++ b/system.c @@ -16,13 +16,15 @@ #include fcntl.h static const struct blobmsg_policy tunnel_attrs[__TUNNEL_ATTR_MAX] = { - [TUNNEL_ATTR_TYPE] = { mode, BLOBMSG_TYPE_STRING }, - [TUNNEL_ATTR_LOCAL] = { local, BLOBMSG_TYPE_STRING }, - [TUNNEL_ATTR_REMOTE] = { remote, BLOBMSG_TYPE_STRING }, - [TUNNEL_ATTR_TTL] = { ttl, BLOBMSG_TYPE_INT32 }, - [TUNNEL_ATTR_6RD_PREFIX] = { 6rd-prefix, BLOBMSG_TYPE_STRING }, - [TUNNEL_ATTR_6RD_RELAY_PREFIX] = { 6rd-relay-prefix, BLOBMSG_TYPE_STRING }, - [TUNNEL_ATTR_LINK] = { link, BLOBMSG_TYPE_STRING }, + [TUNNEL_ATTR_TYPE] = { .name = mode, .type = BLOBMSG_TYPE_STRING }, + [TUNNEL_ATTR_LOCAL] = { .name = local, .type = BLOBMSG_TYPE_STRING }, + [TUNNEL_ATTR_REMOTE] = { .name = remote, .type = BLOBMSG_TYPE_STRING }, + [TUNNEL_ATTR_MTU] = { .name = mtu, .type = BLOBMSG_TYPE_INT32 }, + [TUNNEL_ATTR_DF] = { .name = df, .type = BLOBMSG_TYPE_BOOL }, + [TUNNEL_ATTR_TTL] = { .name = ttl, .type = BLOBMSG_TYPE_INT32 }, + [TUNNEL_ATTR_6RD_PREFIX] = {.name = 6rd-prefix, .type = BLOBMSG_TYPE_STRING }, + [TUNNEL_ATTR_6RD_RELAY_PREFIX] = { .name = 6rd-relay-prefix, .type =
[OpenWrt-Devel] Unifi AP Pro sysupgrade patch V5
Changelog: V1: skip the first n-1 occurrence of JFFS2_EOF V2: change argument handling V3: skip first n bytes when appending jffs2 data V4: remove quotes for $MTD_CONFIG_ARGS V5: add nbd's jffs2 padding element code to work around broken boot loaders jffs2 partition parsing now really happens after the specified number of bytes The current implementation of mtd will not append the backup file created by sysupgrade to the correct partition, as mtd will append the data to first jffs2 partition it finds. As the kernel is also stored on a jffs2 partition (which resides before the overlay partition), the data will be appended to this partition. To fix this problem, a new option -s number skip the first n bytes when appending data to the jffs2 partiton, defaults to 0 is added to mtd. nbd's code adds this options to padjffs2: x offset: Add an extra offset for padding data -J: Use a bogus jffs2 padding element instead of EOF This is used to work around broken boot loaders that try to parse the entire firmware area as one big jffs2 -j: (like -J, but little-endian instead of big-endian) Signed-off-by: Peter Wagner tripo...@gmx.atdiff --git a/package/base-files/files/lib/upgrade/common.sh b/package/base-files/files/lib/upgrade/common.sh index 9116206..c19640f 100644 --- a/package/base-files/files/lib/upgrade/common.sh +++ b/package/base-files/files/lib/upgrade/common.sh @@ -188,7 +188,7 @@ jffs2_copy_config() { default_do_upgrade() { sync if [ $SAVE_CONFIG -eq 1 ]; then - get_image $1 | mtd -j $CONF_TAR write - ${PART_NAME:-image} + get_image $1 | mtd $MTD_CONFIG_ARGS -j $CONF_TAR write - ${PART_NAME:-image} else get_image $1 | mtd write - ${PART_NAME:-image} fi diff --git a/package/base-files/files/sbin/sysupgrade b/package/base-files/files/sbin/sysupgrade index eb5ab03..14b09eb 100755 --- a/package/base-files/files/sbin/sysupgrade +++ b/package/base-files/files/sbin/sysupgrade @@ -4,6 +4,7 @@ # initialize defaults RAMFS_COPY_BIN= # extra programs for temporary ramfs root RAMFS_COPY_DATA= # extra data files +export MTD_CONFIG_ARGS= export INTERACTIVE=0 export VERBOSE=1 export SAVE_CONFIG=1 diff --git a/package/system/mtd/src/mtd.c b/package/system/mtd/src/mtd.c index a660486..2ec02a8 100644 --- a/package/system/mtd/src/mtd.c +++ b/package/system/mtd/src/mtd.c @@ -55,6 +55,7 @@ int quiet; int no_erase; int mtdsize = 0; int erasesize = 0; +int jffs2_skip_bytes=0; int mtd_open(const char *mtd, bool block) { @@ -339,7 +340,6 @@ resume: fprintf(stderr, Could not open mtd device: %s\n, mtd); exit(1); } - if (part_offset 0) { fprintf(stderr, Seeking on mtd device '%s' to: %u\n, mtd, part_offset); lseek(fd, part_offset, SEEK_SET); @@ -379,7 +379,7 @@ resume: continue; } - if (jffs2file) { + if (jffs2file w = jffs2_skip_bytes) { if (memcmp(buf, JFFS2_EOF, sizeof(JFFS2_EOF) - 1) == 0) { if (!quiet) fprintf(stderr, \b\b\b ); @@ -503,6 +503,7 @@ static void usage(void) -e device erase device before executing the command\n -d name directory for jffs2write, defaults to \tmp\\n -j name integrate file into jffs2 data when writing an image\n + -s number skip the first n bytes when appending data to the jffs2 partiton, defaults to \0\\n -p write beginning at partition offset\n); if (mtd_fixtrx) { fprintf(stderr, @@ -560,7 +561,7 @@ int main (int argc, char **argv) #ifdef FIS_SUPPORT F: #endif - frnqe:d:j:p:o:)) != -1) + frnqe:d:s:j:p:o:)) != -1) switch (ch) { case 'f': force = 1; @@ -574,6 +575,14 @@ int main (int argc, char **argv) case 'j': jffs2file = optarg; break; + case 's': +errno = 0; +jffs2_skip_bytes = strtoul(optarg, 0, 0); +if (errno) { + fprintf(stderr, -s: illegal numeric string\n); + usage(); +} +break; case 'q': quiet++; break; diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh index 266bf3f..1eb9354 100755 --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh @@ -327,6 +327,10 @@ platform_do_upgrade() { om2p-lc) platform_do_upgrade_openmesh $ARGV ;; + uap-pro) + MTD_CONFIG_ARGS=-s 0x18 + default_do_upgrade $ARGV + ;; *) default_do_upgrade $ARGV ;; diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile index 3af8375..d1e91c0 100644 --- a/target/linux/ar71xx/image/Makefile +++ b/target/linux/ar71xx/image/Makefile @@ -448,7 +448,7 @@ define Image/Build/UAPPRO/buildkernel -d $(KDIR_TMP)/$(2)/image \ 21 1/dev/null | awk '/^.+/' -rm -rf $(KDIR_TMP)/$(2) - $(STAGING_DIR_HOST)/bin/padjffs2 $(KDIR_TMP)/$(2)-kernel.jffs2 64 +
Re: [OpenWrt-Devel] [Patch][packages][RFC] erlang: update and remove RIPEMD
Hi Dirk, could you please resend the patch. i get: patching file Makefile patch: malformed patch at line 84: 2. As it seems you mail clients wraps the lines. If you can't disable wrapping just attach the patch as file. /Peter On Thu, 14 Nov 2013 23:53:42 +0100 Dirk Neukirchen dirkneukirc...@web.de wrote: This patch updates erlang to a more current 16B02 and hopefully removes RIPEMD160 support. It's only compile tested - don't know about erlang I used the commit that added ripemd to erlang as a guideline https://github.com/erlang/otp/commit/3881407ea8444c280d9659f40e6c169a1e10310d.patch add ripemd160 support to crypto add ripemd160 message digest support to the crypto app, includes some test cases. and reverted it accordingly i hope. notice: - docs are left untouched - tests are left untouched Signed-off-by: Dirk Neukirchen dirkneukirc...@web.de --- diff --git a/lang/erlang/Makefile b/lang/erlang/Makefile index ddba81c..96d336e 100644 --- a/lang/erlang/Makefile +++ b/lang/erlang/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2009-2012 OpenWrt.org +# Copyright (C) 2009-2013 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=erlang -PKG_VERSION:=R15B01 -PKG_RELEASE:=4 +PKG_VERSION:=R16B02 +PKG_RELEASE:=1 PKG_SOURCE:=otp_src_$(PKG_VERSION).tar.gz PKG_SOURCE_URL:= http://www.erlang.org/download/ \ http://erlang.mirror.su.se/ -PKG_MD5SUM:=f12d00f6e62b36ad027d6c0c08905fad +PKG_MD5SUM:=ca63bcde0e5ae0f2df9457f97b3115a4 PKG_BUILD_DEPENDS:=erlang/host openssl diff --git a/lang/erlang/patches/101-emulator_includes.patch b/lang/erlang/patches/101-emulator_includes.patch index 933c73e..8136e47 100644 --- a/lang/erlang/patches/101-emulator_includes.patch +++ b/lang/erlang/patches/101-emulator_includes.patch @@ -1,11 +1,14 @@ --- a/erts/emulator/Makefile.in +++ b/erts/emulator/Makefile.in -@@ -591,7 +591,7 @@ endif - - - $(OBJDIR)/%.o: beam/%.c --$(CC) $(subst -O2, $(GEN_OPT_FLGS), $(CFLAGS)) $(INCLUDES) -c $ -o $@ -+$(CC) $(INCLUDES) $(subst -O2, $(GEN_OPT_FLGS), $(CFLAGS)) -c $ -o $@ - +@@ -642,9 +642,9 @@ endif + + ifneq ($(filter tile-%,$(TARGET)),) + $(OBJDIR)/beam_emu.o: beam/beam_emu.c +-$(V_CC) $(subst -O2, $(GEN_OPT_FLGS), $(CFLAGS)) \ ++$(V_CC) $(INCLUDES) \ + -OPT:Olimit=0 -WOPT:lpre=off:spre=off:epre=off \ +- $(INCLUDES) -c $ -o $@ ++ $(subst -O2, $(GEN_OPT_FLGS), $(CFLAGS)) -c $ -o $@ else - + # Usually the same as the default rule, but certain platforms (e.g. win32) mix + # different compilers diff --git a/lang/erlang/patches/104-disable_ripemd.patch b/lang/erlang/patches/104-disable_ripemd.patch new file mode 100644 index 000..0995c01 --- /dev/null +++ b/lang/erlang/patches/104-disable_ripemd.patch @@ -0,0 +1,191 @@ +--- a/lib/crypto/c_src/crypto.c b/lib/crypto/c_src/crypto.c +@@ -44,7 +44,6 @@ + #include openssl/md5.h + #include openssl/md4.h + #include openssl/sha.h +-#include openssl/ripemd.h + #include openssl/bn.h + #include openssl/objects.h + #include openssl/rc4.h +@@ -167,10 +166,6 @@ static ERL_NIF_TERM md5(ErlNifEnv* env, + static ERL_NIF_TERM md5_init(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); + static ERL_NIF_TERM md5_update(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); + static ERL_NIF_TERM md5_final(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); +-static ERL_NIF_TERM ripemd160(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); +-static ERL_NIF_TERM ripemd160_init(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); +-static ERL_NIF_TERM ripemd160_update(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); +-static ERL_NIF_TERM ripemd160_final(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); + static ERL_NIF_TERM sha(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); + static ERL_NIF_TERM sha_init(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); + static ERL_NIF_TERM sha_update(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); +@@ -292,10 +287,6 @@ static ErlNifFunc nif_funcs[] = { + {md5_init, 0, md5_init}, + {md5_update, 2, md5_update}, + {md5_final, 1, md5_final}, +-{ripemd160, 1, ripemd160}, +-{ripemd160_init, 0, ripemd160_init}, +-{ripemd160_update, 2, ripemd160_update}, +-{ripemd160_final, 1, ripemd160_final}, + {sha, 1, sha}, + {sha_init, 0, sha_init}, + {sha_update, 2, sha_update}, +@@ -478,8 +469,6 @@ ERL_NIF_INIT(crypto,nif_funcs,load,NULL, + #define MD5_LEN_96 12 + #define MD4_CTX_LEN (sizeof(MD4_CTX)) + #define MD4_LEN 16 +-#define RIPEMD160_CTX_LEN (sizeof(RIPEMD160_CTX)) +-#define RIPEMD160_LEN 20 + #define SHA_CTX_LEN (sizeof(SHA_CTX)) + #define SHA_LEN 20 + #define SHA_LEN_96 12