From e148281b008b6e71f06e26e603e3d3c50377b28a Mon Sep 17 00:00:00 2001 From: kaloz Date: Wed, 23 May 2007 19:48:34 +0000 Subject: break trunk temporary - upgrade to 2.6.21.1 and iptables 1.3.7 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@7315 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/generic-2.6/config-template | 56 + .../linux/generic-2.6/patches/001-squashfs.patch | 70 +- .../generic-2.6/patches/002-lzma_decompress.patch | 241 ++-- .../patches/013-mips_generic_gpio_support.patch | 50 - .../050-mtdpart_redboot_partition_truncate.patch | 61 - .../generic-2.6/patches/060-rootfs_split.patch | 30 +- .../generic-2.6/patches/110-ipp2p_0.8.1rc1.patch | 4 +- .../120-openswan-2.4.0.kernel-2.6-natt.patch | 56 +- .../generic-2.6/patches/130-netfilter-ipset.patch | 157 ++- .../generic-2.6/patches/150-netfilter_imq.patch | 98 +- .../generic-2.6/patches/160-netfilter_route.patch | 1284 +++++++++-------- .../patches/170-netfilter_chaostables.patch | 326 +++-- .../linux/generic-2.6/patches/200-sched_esfq.patch | 215 ++- .../patches/201-multiple_default_gateways.patch | 1025 +------------- target/linux/generic-2.6/patches/510-Yaffs.patch | 202 +-- .../linux/generic-2.6/patches/600-x86_lzma.patch | 108 +- .../linux/generic-2.6/patches/700-airprime.patch | 12 - .../patches/901-asm_bitops_include.patch | 11 - .../generic-2.6/patches/904-ls_time_locale.patch | 33 +- target/linux/ixp4xx-2.6/config/default | 9 + .../080-trivial_nslu2_nas100d_cleanup.patch | 196 +++ .../linux/ixp4xx-2.6/patches/100-npe_driver.patch | 1479 ++++++++++---------- .../ixp4xx-2.6/patches/102-nslu2_led_swap.patch | 36 - .../110-ixp4xx_net_driver_fix_mac_handling.patch | 17 + ...33-ixp4xx_net_driver_improve_mac_handling.patch | 41 - .../139-ixp4xx_net_driver_mtd_load_fw.patch | 79 +- target/linux/ixp4xx-2.6/patches/500-compex.patch | 16 +- .../patches/700-remove_avila_ixdp425_setup.patch | 39 - .../ixp4xx-2.6/patches/710-avila_loft_setup.patch | 381 ----- .../patches/800-eeprom_new_notifier.patch | 30 +- 30 files changed, 2668 insertions(+), 3694 deletions(-) delete mode 100644 target/linux/generic-2.6/patches/013-mips_generic_gpio_support.patch delete mode 100644 target/linux/generic-2.6/patches/050-mtdpart_redboot_partition_truncate.patch delete mode 100644 target/linux/generic-2.6/patches/700-airprime.patch delete mode 100644 target/linux/generic-2.6/patches/901-asm_bitops_include.patch create mode 100644 target/linux/ixp4xx-2.6/patches/080-trivial_nslu2_nas100d_cleanup.patch delete mode 100644 target/linux/ixp4xx-2.6/patches/102-nslu2_led_swap.patch create mode 100644 target/linux/ixp4xx-2.6/patches/110-ixp4xx_net_driver_fix_mac_handling.patch delete mode 100644 target/linux/ixp4xx-2.6/patches/133-ixp4xx_net_driver_improve_mac_handling.patch delete mode 100644 target/linux/ixp4xx-2.6/patches/700-remove_avila_ixdp425_setup.patch delete mode 100644 target/linux/ixp4xx-2.6/patches/710-avila_loft_setup.patch (limited to 'target') diff --git a/target/linux/generic-2.6/config-template b/target/linux/generic-2.6/config-template index c9e3c0c1ee..42695f3c28 100644 --- a/target/linux/generic-2.6/config-template +++ b/target/linux/generic-2.6/config-template @@ -20,6 +20,7 @@ CONFIG_ASK_IP_FIB_HASH=y # CONFIG_ATALK is not set # CONFIG_ATARI_PARTITION is not set # CONFIG_ATA_OVER_ETH is not set +# CONFIG_ATL1 is not set CONFIG_ATM=m CONFIG_ATMEL=m # CONFIG_ATM_AMBASSADOR is not set @@ -134,6 +135,7 @@ CONFIG_BT_SCO=m CONFIG_BUG=y # CONFIG_CAPI_AVM is not set # CONFIG_CAPI_EICON is not set +# CONFIG_CAPI_TRACE is not set CONFIG_CARDBUS=y # CONFIG_CARDMAN_4000 is not set # CONFIG_CARDMAN_4040 is not set @@ -141,6 +143,7 @@ CONFIG_CARDBUS=y CONFIG_CC_OPTIMIZE_FOR_SIZE=y # CONFIG_CDROM_PKTCDVD is not set # CONFIG_CHELSIO_T1 is not set +# CONFIG_CHELSIO_T3 is not set # CONFIG_CHR_DEV_OSST is not set # CONFIG_CHR_DEV_SCH is not set # CONFIG_CHR_DEV_SG is not set @@ -172,6 +175,7 @@ CONFIG_CRYPTO_ANUBIS=m CONFIG_CRYPTO_ARC4=m CONFIG_CRYPTO_BLKCIPHER=y CONFIG_CRYPTO_BLOWFISH=m +# CONFIG_CRYPTO_CAMELLIA is not set CONFIG_CRYPTO_CAST5=m CONFIG_CRYPTO_CAST6=m CONFIG_CRYPTO_CBC=y @@ -179,14 +183,18 @@ CONFIG_CRYPTO_CRC32C=m CONFIG_CRYPTO_DEFLATE=m CONFIG_CRYPTO_DES=y CONFIG_CRYPTO_ECB=m +# CONFIG_CRYPTO_FCRYPT is not set +# CONFIG_CRYPTO_GF128MUL is not set CONFIG_CRYPTO_HASH=m CONFIG_CRYPTO_HMAC=m CONFIG_CRYPTO_KHAZAD=m +# CONFIG_CRYPTO_LRW is not set CONFIG_CRYPTO_MANAGER=y CONFIG_CRYPTO_MD4=m CONFIG_CRYPTO_MD5=y CONFIG_CRYPTO_MICHAEL_MIC=m CONFIG_CRYPTO_NULL=m +# CONFIG_CRYPTO_PCBC is not set CONFIG_CRYPTO_SERPENT=m CONFIG_CRYPTO_SHA1=m CONFIG_CRYPTO_SHA256=m @@ -197,6 +205,7 @@ CONFIG_CRYPTO_TGR192=m CONFIG_CRYPTO_TWOFISH=m CONFIG_CRYPTO_TWOFISH_COMMON=m CONFIG_CRYPTO_WP512=m +# CONFIG_CRYPTO_XCBC is not set # CONFIG_DAVICOM_PHY is not set # CONFIG_DEBUG_FS is not set # CONFIG_DEBUG_KERNEL is not set @@ -220,6 +229,7 @@ CONFIG_DEVFS_MOUNT=y # CONFIG_DGRS is not set # CONFIG_DISCONTIGMEM_MANUAL is not set # CONFIG_DL2K is not set +# CONFIG_DLM is not set # CONFIG_DMA_ENGINE is not set # CONFIG_DNOTIFY is not set # CONFIG_DRM is not set @@ -367,6 +377,7 @@ CONFIG_IP6_NF_MATCH_FRAG=m CONFIG_IP6_NF_MATCH_HL=m CONFIG_IP6_NF_MATCH_IPV6HEADER=m CONFIG_IP6_NF_MATCH_LIMIT=m +# CONFIG_IP6_NF_MATCH_MH is not set CONFIG_IP6_NF_MATCH_OPTS=m CONFIG_IP6_NF_MATCH_OWNER=m CONFIG_IP6_NF_MATCH_RT=m @@ -417,6 +428,7 @@ CONFIG_IP_NF_ARP_MANGLE=m CONFIG_IP_NF_CONNTRACK=y # CONFIG_IP_NF_CONNTRACK_EVENTS is not set CONFIG_IP_NF_CONNTRACK_MARK=y +# CONFIG_IP_NF_CONNTRACK_SUPPORT is not set CONFIG_IP_NF_CT_ACCT=y CONFIG_IP_NF_CT_PROTO_SCTP=m CONFIG_IP_NF_FILTER=y @@ -555,6 +567,7 @@ CONFIG_MAC_PARTITION=y # CONFIG_MEGARAID_LEGACY is not set # CONFIG_MEGARAID_NEWGEN is not set # CONFIG_MEGARAID_SAS is not set +# CONFIG_MFD_SM501 is not set CONFIG_MII=y CONFIG_MINIX_FS=m # CONFIG_MINIX_SUBPARTITION is not set @@ -587,6 +600,7 @@ CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y CONFIG_NETFILTER_XT_MATCH_DCCP=m CONFIG_NETFILTER_XT_MATCH_DSCP=m CONFIG_NETFILTER_XT_MATCH_ESP=m +CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m CONFIG_NETFILTER_XT_MATCH_HELPER=m CONFIG_NETFILTER_XT_MATCH_LENGTH=m CONFIG_NETFILTER_XT_MATCH_LIMIT=y @@ -610,11 +624,15 @@ CONFIG_NETFILTER_XT_TARGET_CONNMARK=m CONFIG_NETFILTER_XT_TARGET_DELUDE=m CONFIG_NETFILTER_XT_TARGET_DSCP=m CONFIG_NETFILTER_XT_TARGET_MARK=m +CONFIG_NETFILTER_XT_TARGET_NFLOG=m CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m CONFIG_NETFILTER_XT_TARGET_NOTRACK=m +CONFIG_NETFILTER_XT_TARGET_TCPMSS=m +# CONFIG_NET_KEY_MIGRATE is not set # CONFIG_NETPOLL is not set # CONFIG_NETROM is not set # CONFIG_NETWORK_SECMARK is not set +# CONFIG_NETXEN_NIC is not set CONFIG_NET_ACT_GACT=m CONFIG_NET_ACT_IPT=m CONFIG_NET_ACT_MIRRED=m @@ -674,6 +692,26 @@ CONFIG_NET_SCH_TEQL=m CONFIG_NET_WIRELESS=y CONFIG_NET_WIRELESS_RTNETLINK=y CONFIG_NEW_LEDS=y +# CONFIG_NF_CONNTRACK_AMANDA is not set +CONFIG_NF_CONNTRACK_ENABLED=y +# CONFIG_NF_CONNTRACK_EVENTS is not set +CONFIG_NF_CONNTRACK_FTP=m +CONFIG_NF_CONNTRACK_H323=m +CONFIG_NF_CONNTRACK_IPV4=y +# CONFIG_NF_CONNTRACK_IPV6 is not set +CONFIG_NF_CONNTRACK_IRC=m +# CONFIG_NF_CONNTRACK_MARK is not set +# CONFIG_NF_CONNTRACK_NETBIOS_NS is not set +# CONFIG_NF_CONNTRACK_PPTP is not set +CONFIG_NF_CONNTRACK_PROC_COMPAT=y +# CONFIG_NF_CONNTRACK_SANE is not set +CONFIG_NF_CONNTRACK_SIP=m +CONFIG_NF_CONNTRACK_SUPPORT=y +# CONFIG_NF_CONNTRACK_TFTP is not set +# CONFIG_NF_CT_ACCT is not set +# CONFIG_NF_CT_PROTO_SCTP is not set +# CONFIG_NF_NAT_SNMP_BASIC is not set +CONFIG_NF_NAT=y CONFIG_NFSD=m CONFIG_NFSD_TCP=y # CONFIG_NFSD_V2_ACL is not set @@ -739,6 +777,10 @@ CONFIG_PACKET=y CONFIG_PACKET_MMAP=y # CONFIG_PARPORT is not set CONFIG_PARTITION_ADVANCED=y +# CONFIG_PATA_IT8213 is not set +# CONFIG_PATA_MARVELL is not set +CONFIG_PATA_PLATFORM=m +# CONFIG_PC300TOO is not set # CONFIG_PCCARD is not set CONFIG_PCI=y CONFIG_PCI_ATMEL=m @@ -810,8 +852,11 @@ CONFIG_ROMFS_FS=m CONFIG_RPCSEC_GSS_KRB5=m # CONFIG_RPCSEC_GSS_SPKM3 is not set # CONFIG_RTC_CLASS is not set +CONFIG_RTC_DRV_CMOS=y CONFIG_RT_MUTEXES=y # CONFIG_S2IO is not set +# CONFIG_SATA_INIC162X is not set +# CONFIG_SC92031 is not set CONFIG_SCSI=m # CONFIG_SCSI_3W_9XXX is not set # CONFIG_SCSI_AACRAID is not set @@ -845,9 +890,12 @@ CONFIG_SCSI_PROC_FS=y # CONFIG_SCSI_QLOGIC_1280 is not set # CONFIG_SCSI_SAS_ATTRS is not set # CONFIG_SCSI_SAS_LIBSAS is not set +# CONFIG_SCSI_SCAN_ASYNC is not set # CONFIG_SCSI_SPI_ATTRS is not set +# CONFIG_SCSI_SRP is not set # CONFIG_SCSI_STEX is not set # CONFIG_SCSI_SYM53C8XX_2 is not set +# CONFIG_SCSI_TGT is not set # CONFIG_SECURITY is not set CONFIG_SELECT_MEMORY_MODEL=y CONFIG_SERIAL_8250=y @@ -980,6 +1028,7 @@ CONFIG_SYN_COOKIES=y CONFIG_SYSCTL=y CONFIG_SYSCTL_SYSCALL=y CONFIG_SYSFS=y +# CONFIG_SYSFS_DEPRECATED is not set CONFIG_SYSVIPC=y # CONFIG_SYSV_FS is not set # CONFIG_SYS_HYPERVISOR is not set @@ -996,6 +1045,7 @@ CONFIG_TCP_CONG_SCALABLE=m CONFIG_TCP_CONG_VEGAS=y CONFIG_TCP_CONG_VENO=m CONFIG_TCP_CONG_WESTWOOD=m +# CONFIG_TCP_MD5SIG is not set CONFIG_TEXTSEARCH=y CONFIG_TEXTSEARCH_BM=m CONFIG_TEXTSEARCH_FSM=m @@ -1037,6 +1087,7 @@ CONFIG_USB_ATM=m # CONFIG_USB_AUERSWALD is not set # CONFIG_USB_BANDWIDTH is not set CONFIG_USB_BELKIN=y +# CONFIG_USB_BERRY_CHARGE is not set CONFIG_USB_CATC=m # CONFIG_USB_CXACRU is not set # CONFIG_USB_CYPRESS_CY7C63 is not set @@ -1054,6 +1105,7 @@ CONFIG_USB_EZUSB=y # CONFIG_USB_GADGET is not set # CONFIG_USB_HID is not set # CONFIG_USB_IDMOUSE is not set +# CONFIG_USB_IOWARRIOR is not set # CONFIG_USB_ISP116X_HCD is not set CONFIG_USB_KAWETH=m # CONFIG_USB_KBD is not set @@ -1176,12 +1228,15 @@ CONFIG_VIDEO_V4L2=y # CONFIG_VIDEO_TEA6415C is not set # CONFIG_VIDEO_TEA6420 is not set # CONFIG_VIDEO_MSP3400 is not set +# CONFIG_VIDEO_CAFE_CCIC is not set # CONFIG_VIDEO_CS53L32A is not set # CONFIG_VIDEO_TLV320AIC23B is not set +# CONFIG_VIDEO_OV7670 is not set # CONFIG_VIDEO_WM8775 is not set # CONFIG_VIDEO_WM8739 is not set # CONFIG_VIDEO_SAA711X is not set # CONFIG_VIDEO_TVP5150 is not set +# CONFIG_VIDEO_USBVISION is not set # CONFIG_VIDEO_CX25840 is not set # CONFIG_VIDEO_CX2341X is not set # CONFIG_VIDEO_SAA7127 is not set @@ -1226,6 +1281,7 @@ CONFIG_WIRELESS_EXT=y # CONFIG_WR_PPMC is not set # CONFIG_X25 is not set CONFIG_XFRM=y +# CONFIG_XFRM_MIGRATE is not set # CONFIG_XFRM_SUB_POLICY is not set CONFIG_XFRM_USER=m CONFIG_XFS_FS=m diff --git a/target/linux/generic-2.6/patches/001-squashfs.patch b/target/linux/generic-2.6/patches/001-squashfs.patch index 6881cd0bb1..8722c99592 100644 --- a/target/linux/generic-2.6/patches/001-squashfs.patch +++ b/target/linux/generic-2.6/patches/001-squashfs.patch @@ -1,7 +1,7 @@ -diff -urN linux-2.6.19.old/fs/Kconfig linux-2.6.19.dev/fs/Kconfig ---- linux-2.6.19.old/fs/Kconfig 2006-12-14 03:13:16.000000000 +0100 -+++ linux-2.6.19.dev/fs/Kconfig 2006-12-14 03:13:16.000000000 +0100 -@@ -1457,6 +1457,71 @@ +diff -Nur linux-2.6.21.1/fs/Kconfig linux-2.6.21.1-owrt/fs/Kconfig +--- linux-2.6.21.1/fs/Kconfig 2007-04-27 23:49:26.000000000 +0200 ++++ linux-2.6.21.1-owrt/fs/Kconfig 2007-05-23 19:09:55.000000000 +0200 +@@ -1371,6 +1371,71 @@ If unsure, say N. @@ -73,10 +73,10 @@ diff -urN linux-2.6.19.old/fs/Kconfig linux-2.6.19.dev/fs/Kconfig config VXFS_FS tristate "FreeVxFS file system support (VERITAS VxFS(TM) compatible)" depends on BLOCK -diff -urN linux-2.6.19.old/fs/Makefile linux-2.6.19.dev/fs/Makefile ---- linux-2.6.19.old/fs/Makefile 2006-12-14 03:13:16.000000000 +0100 -+++ linux-2.6.19.dev/fs/Makefile 2006-12-14 03:13:16.000000000 +0100 -@@ -67,6 +67,7 @@ +diff -Nur linux-2.6.21.1/fs/Makefile linux-2.6.21.1-owrt/fs/Makefile +--- linux-2.6.21.1/fs/Makefile 2007-04-27 23:49:26.000000000 +0200 ++++ linux-2.6.21.1-owrt/fs/Makefile 2007-05-23 19:09:55.000000000 +0200 +@@ -68,6 +68,7 @@ obj-$(CONFIG_JBD2) += jbd2/ obj-$(CONFIG_EXT2_FS) += ext2/ obj-$(CONFIG_CRAMFS) += cramfs/ @@ -84,9 +84,9 @@ diff -urN linux-2.6.19.old/fs/Makefile linux-2.6.19.dev/fs/Makefile obj-$(CONFIG_RAMFS) += ramfs/ obj-$(CONFIG_HUGETLBFS) += hugetlbfs/ obj-$(CONFIG_CODA_FS) += coda/ -diff -urN linux-2.6.19.old/fs/squashfs/inode.c linux-2.6.19.dev/fs/squashfs/inode.c ---- linux-2.6.19.old/fs/squashfs/inode.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.19.dev/fs/squashfs/inode.c 2006-12-14 03:13:16.000000000 +0100 +diff -Nur linux-2.6.21.1/fs/squashfs/inode.c linux-2.6.21.1-owrt/fs/squashfs/inode.c +--- linux-2.6.21.1/fs/squashfs/inode.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/fs/squashfs/inode.c 2007-05-23 19:52:20.000000000 +0200 @@ -0,0 +1,2124 @@ +/* + * Squashfs - a compressed read only filesystem for Linux @@ -2160,13 +2160,13 @@ diff -urN linux-2.6.19.old/fs/squashfs/inode.c linux-2.6.19.dev/fs/squashfs/inod +} + + -+static kmem_cache_t * squashfs_inode_cachep; ++static struct kmem_cache * squashfs_inode_cachep; + + +static struct inode *squashfs_alloc_inode(struct super_block *sb) +{ + struct squashfs_inode_info *ei; -+ ei = kmem_cache_alloc(squashfs_inode_cachep, SLAB_KERNEL); ++ ei = kmem_cache_alloc(squashfs_inode_cachep, GFP_KERNEL); + if (!ei) + return NULL; + return &ei->vfs_inode; @@ -2179,7 +2179,7 @@ diff -urN linux-2.6.19.old/fs/squashfs/inode.c linux-2.6.19.dev/fs/squashfs/inod +} + + -+static void init_once(void * foo, kmem_cache_t * cachep, unsigned long flags) ++static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags) +{ + struct squashfs_inode_info *ei = foo; + @@ -2212,9 +2212,9 @@ diff -urN linux-2.6.19.old/fs/squashfs/inode.c linux-2.6.19.dev/fs/squashfs/inod +MODULE_DESCRIPTION("squashfs, a compressed read-only filesystem"); +MODULE_AUTHOR("Phillip Lougher "); +MODULE_LICENSE("GPL"); -diff -urN linux-2.6.19.old/fs/squashfs/Makefile linux-2.6.19.dev/fs/squashfs/Makefile ---- linux-2.6.19.old/fs/squashfs/Makefile 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.19.dev/fs/squashfs/Makefile 2006-12-14 03:13:16.000000000 +0100 +diff -Nur linux-2.6.21.1/fs/squashfs/Makefile linux-2.6.21.1-owrt/fs/squashfs/Makefile +--- linux-2.6.21.1/fs/squashfs/Makefile 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/fs/squashfs/Makefile 2007-05-23 19:09:55.000000000 +0200 @@ -0,0 +1,7 @@ +# +# Makefile for the linux squashfs routines. @@ -2223,9 +2223,9 @@ diff -urN linux-2.6.19.old/fs/squashfs/Makefile linux-2.6.19.dev/fs/squashfs/Mak +obj-$(CONFIG_SQUASHFS) += squashfs.o +squashfs-y += inode.o +squashfs-y += squashfs2_0.o -diff -urN linux-2.6.19.old/fs/squashfs/squashfs2_0.c linux-2.6.19.dev/fs/squashfs/squashfs2_0.c ---- linux-2.6.19.old/fs/squashfs/squashfs2_0.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.19.dev/fs/squashfs/squashfs2_0.c 2006-12-14 03:13:16.000000000 +0100 +diff -Nur linux-2.6.21.1/fs/squashfs/squashfs2_0.c linux-2.6.21.1-owrt/fs/squashfs/squashfs2_0.c +--- linux-2.6.21.1/fs/squashfs/squashfs2_0.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/fs/squashfs/squashfs2_0.c 2007-05-23 19:09:55.000000000 +0200 @@ -0,0 +1,758 @@ +/* + * Squashfs - a compressed read only filesystem for Linux @@ -2985,9 +2985,9 @@ diff -urN linux-2.6.19.old/fs/squashfs/squashfs2_0.c linux-2.6.19.dev/fs/squashf + + return 1; +} -diff -urN linux-2.6.19.old/fs/squashfs/squashfs.h linux-2.6.19.dev/fs/squashfs/squashfs.h ---- linux-2.6.19.old/fs/squashfs/squashfs.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.19.dev/fs/squashfs/squashfs.h 2006-12-14 03:13:16.000000000 +0100 +diff -Nur linux-2.6.21.1/fs/squashfs/squashfs.h linux-2.6.21.1-owrt/fs/squashfs/squashfs.h +--- linux-2.6.21.1/fs/squashfs/squashfs.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/fs/squashfs/squashfs.h 2007-05-23 19:09:56.000000000 +0200 @@ -0,0 +1,86 @@ +/* + * Squashfs - a compressed read only filesystem for Linux @@ -3075,9 +3075,9 @@ diff -urN linux-2.6.19.old/fs/squashfs/squashfs.h linux-2.6.19.dev/fs/squashfs/s + return 0; +} +#endif -diff -urN linux-2.6.19.old/include/linux/squashfs_fs.h linux-2.6.19.dev/include/linux/squashfs_fs.h ---- linux-2.6.19.old/include/linux/squashfs_fs.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.19.dev/include/linux/squashfs_fs.h 2006-12-14 03:13:16.000000000 +0100 +diff -Nur linux-2.6.21.1/include/linux/squashfs_fs.h linux-2.6.21.1-owrt/include/linux/squashfs_fs.h +--- linux-2.6.21.1/include/linux/squashfs_fs.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/include/linux/squashfs_fs.h 2007-05-23 19:09:56.000000000 +0200 @@ -0,0 +1,911 @@ +#ifndef SQUASHFS_FS +#define SQUASHFS_FS @@ -3990,9 +3990,9 @@ diff -urN linux-2.6.19.old/include/linux/squashfs_fs.h linux-2.6.19.dev/include/ + +#endif +#endif -diff -urN linux-2.6.19.old/include/linux/squashfs_fs_i.h linux-2.6.19.dev/include/linux/squashfs_fs_i.h ---- linux-2.6.19.old/include/linux/squashfs_fs_i.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.19.dev/include/linux/squashfs_fs_i.h 2006-12-14 03:13:16.000000000 +0100 +diff -Nur linux-2.6.21.1/include/linux/squashfs_fs_i.h linux-2.6.21.1-owrt/include/linux/squashfs_fs_i.h +--- linux-2.6.21.1/include/linux/squashfs_fs_i.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/include/linux/squashfs_fs_i.h 2007-05-23 19:09:56.000000000 +0200 @@ -0,0 +1,45 @@ +#ifndef SQUASHFS_FS_I +#define SQUASHFS_FS_I @@ -4039,9 +4039,9 @@ diff -urN linux-2.6.19.old/include/linux/squashfs_fs_i.h linux-2.6.19.dev/includ + struct inode vfs_inode; +}; +#endif -diff -urN linux-2.6.19.old/include/linux/squashfs_fs_sb.h linux-2.6.19.dev/include/linux/squashfs_fs_sb.h ---- linux-2.6.19.old/include/linux/squashfs_fs_sb.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.19.dev/include/linux/squashfs_fs_sb.h 2006-12-14 03:13:16.000000000 +0100 +diff -Nur linux-2.6.21.1/include/linux/squashfs_fs_sb.h linux-2.6.21.1-owrt/include/linux/squashfs_fs_sb.h +--- linux-2.6.21.1/include/linux/squashfs_fs_sb.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/include/linux/squashfs_fs_sb.h 2007-05-23 19:09:56.000000000 +0200 @@ -0,0 +1,74 @@ +#ifndef SQUASHFS_FS_SB +#define SQUASHFS_FS_SB @@ -4117,9 +4117,9 @@ diff -urN linux-2.6.19.old/include/linux/squashfs_fs_sb.h linux-2.6.19.dev/inclu + int (*read_fragment_index_table)(struct super_block *s); +}; +#endif -diff -urN linux-2.6.19.old/init/do_mounts_rd.c linux-2.6.19.dev/init/do_mounts_rd.c ---- linux-2.6.19.old/init/do_mounts_rd.c 2006-11-29 22:57:37.000000000 +0100 -+++ linux-2.6.19.dev/init/do_mounts_rd.c 2006-12-14 03:13:16.000000000 +0100 +diff -Nur linux-2.6.21.1/init/do_mounts_rd.c linux-2.6.21.1-owrt/init/do_mounts_rd.c +--- linux-2.6.21.1/init/do_mounts_rd.c 2007-04-27 23:49:26.000000000 +0200 ++++ linux-2.6.21.1-owrt/init/do_mounts_rd.c 2007-05-23 19:09:56.000000000 +0200 @@ -5,6 +5,7 @@ #include #include diff --git a/target/linux/generic-2.6/patches/002-lzma_decompress.patch b/target/linux/generic-2.6/patches/002-lzma_decompress.patch index ca9767729c..d39d3d6877 100644 --- a/target/linux/generic-2.6/patches/002-lzma_decompress.patch +++ b/target/linux/generic-2.6/patches/002-lzma_decompress.patch @@ -1,15 +1,110 @@ ---- linux-2.6.19.old/lib/Makefile 2007-04-18 17:41:22.679403384 +0200 -+++ linux-2.6.19.dev/lib/Makefile 2007-04-18 17:41:43.303268080 +0200 -@@ -54,6 +54,7 @@ - obj-$(CONFIG_AUDIT_GENERIC) += audit.o - - obj-$(CONFIG_SWIOTLB) += swiotlb.o -+obj-y += LzmaDecode.o - - hostprogs-y := gen_crc32table - clean-files := crc32table.h ---- linux-2.6.19.old/lib/LzmaDecode.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.19.dev/lib/LzmaDecode.c 2006-12-14 03:13:20.000000000 +0100 +diff -Nur linux-2.6.21.1/include/linux/LzmaDecode.h linux-2.6.21.1-owrt/include/linux/LzmaDecode.h +--- linux-2.6.21.1/include/linux/LzmaDecode.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/include/linux/LzmaDecode.h 2007-05-14 10:51:05.000000000 +0200 +@@ -0,0 +1,100 @@ ++/* ++ LzmaDecode.h ++ LZMA Decoder interface ++ ++ LZMA SDK 4.05 Copyright (c) 1999-2004 Igor Pavlov (2004-08-25) ++ http://www.7-zip.org/ ++ ++ LZMA SDK is licensed under two licenses: ++ 1) GNU Lesser General Public License (GNU LGPL) ++ 2) Common Public License (CPL) ++ It means that you can select one of these two licenses and ++ follow rules of that license. ++ ++ SPECIAL EXCEPTION: ++ Igor Pavlov, as the author of this code, expressly permits you to ++ statically or dynamically link your code (or bind by name) to the ++ interfaces of this file without subjecting your linked code to the ++ terms of the CPL or GNU LGPL. Any modifications or additions ++ to this file, however, are subject to the LGPL or CPL terms. ++*/ ++ ++#ifndef __LZMADECODE_H ++#define __LZMADECODE_H ++ ++/* #define _LZMA_IN_CB */ ++/* Use callback for input data */ ++ ++/* #define _LZMA_OUT_READ */ ++/* Use read function for output data */ ++ ++/* #define _LZMA_PROB32 */ ++/* It can increase speed on some 32-bit CPUs, ++ but memory usage will be doubled in that case */ ++ ++/* #define _LZMA_LOC_OPT */ ++/* Enable local speed optimizations inside code */ ++ ++#ifndef UInt32 ++#ifdef _LZMA_UINT32_IS_ULONG ++#define UInt32 unsigned long ++#else ++#define UInt32 unsigned int ++#endif ++#endif ++ ++#ifdef _LZMA_PROB32 ++#define CProb UInt32 ++#else ++#define CProb unsigned short ++#endif ++ ++#define LZMA_RESULT_OK 0 ++#define LZMA_RESULT_DATA_ERROR 1 ++#define LZMA_RESULT_NOT_ENOUGH_MEM 2 ++ ++#ifdef _LZMA_IN_CB ++typedef struct _ILzmaInCallback ++{ ++ int (*Read)(void *object, unsigned char **buffer, UInt32 *bufferSize); ++} ILzmaInCallback; ++#endif ++ ++#define LZMA_BASE_SIZE 1846 ++#define LZMA_LIT_SIZE 768 ++ ++/* ++bufferSize = (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << (lc + lp)))* sizeof(CProb) ++bufferSize += 100 in case of _LZMA_OUT_READ ++by default CProb is unsigned short, ++but if specify _LZMA_PROB_32, CProb will be UInt32(unsigned int) ++*/ ++ ++#ifdef _LZMA_OUT_READ ++int LzmaDecoderInit( ++ unsigned char *buffer, UInt32 bufferSize, ++ int lc, int lp, int pb, ++ unsigned char *dictionary, UInt32 dictionarySize, ++ #ifdef _LZMA_IN_CB ++ ILzmaInCallback *inCallback ++ #else ++ unsigned char *inStream, UInt32 inSize ++ #endif ++); ++#endif ++ ++int LzmaDecode( ++ unsigned char *buffer, ++ #ifndef _LZMA_OUT_READ ++ UInt32 bufferSize, ++ int lc, int lp, int pb, ++ #ifdef _LZMA_IN_CB ++ ILzmaInCallback *inCallback, ++ #else ++ unsigned char *inStream, UInt32 inSize, ++ #endif ++ #endif ++ unsigned char *outStream, UInt32 outSize, ++ UInt32 *outSizeProcessed); ++ ++#endif +diff -Nur linux-2.6.21.1/lib/LzmaDecode.c linux-2.6.21.1-owrt/lib/LzmaDecode.c +--- linux-2.6.21.1/lib/LzmaDecode.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/lib/LzmaDecode.c 2007-05-14 10:51:05.000000000 +0200 @@ -0,0 +1,663 @@ +/* + LzmaDecode.c @@ -674,107 +769,23 @@ + *outSizeProcessed = nowPos; + return LZMA_RESULT_OK; +} ---- linux-2.6.19.old/include/linux/LzmaDecode.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.19.dev/include/linux/LzmaDecode.h 2006-12-14 03:13:20.000000000 +0100 -@@ -0,0 +1,100 @@ -+/* -+ LzmaDecode.h -+ LZMA Decoder interface -+ -+ LZMA SDK 4.05 Copyright (c) 1999-2004 Igor Pavlov (2004-08-25) -+ http://www.7-zip.org/ -+ -+ LZMA SDK is licensed under two licenses: -+ 1) GNU Lesser General Public License (GNU LGPL) -+ 2) Common Public License (CPL) -+ It means that you can select one of these two licenses and -+ follow rules of that license. -+ -+ SPECIAL EXCEPTION: -+ Igor Pavlov, as the author of this code, expressly permits you to -+ statically or dynamically link your code (or bind by name) to the -+ interfaces of this file without subjecting your linked code to the -+ terms of the CPL or GNU LGPL. Any modifications or additions -+ to this file, however, are subject to the LGPL or CPL terms. -+*/ -+ -+#ifndef __LZMADECODE_H -+#define __LZMADECODE_H -+ -+/* #define _LZMA_IN_CB */ -+/* Use callback for input data */ -+ -+/* #define _LZMA_OUT_READ */ -+/* Use read function for output data */ -+ -+/* #define _LZMA_PROB32 */ -+/* It can increase speed on some 32-bit CPUs, -+ but memory usage will be doubled in that case */ -+ -+/* #define _LZMA_LOC_OPT */ -+/* Enable local speed optimizations inside code */ -+ -+#ifndef UInt32 -+#ifdef _LZMA_UINT32_IS_ULONG -+#define UInt32 unsigned long -+#else -+#define UInt32 unsigned int -+#endif -+#endif -+ -+#ifdef _LZMA_PROB32 -+#define CProb UInt32 -+#else -+#define CProb unsigned short -+#endif -+ -+#define LZMA_RESULT_OK 0 -+#define LZMA_RESULT_DATA_ERROR 1 -+#define LZMA_RESULT_NOT_ENOUGH_MEM 2 -+ -+#ifdef _LZMA_IN_CB -+typedef struct _ILzmaInCallback -+{ -+ int (*Read)(void *object, unsigned char **buffer, UInt32 *bufferSize); -+} ILzmaInCallback; -+#endif -+ -+#define LZMA_BASE_SIZE 1846 -+#define LZMA_LIT_SIZE 768 -+ -+/* -+bufferSize = (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << (lc + lp)))* sizeof(CProb) -+bufferSize += 100 in case of _LZMA_OUT_READ -+by default CProb is unsigned short, -+but if specify _LZMA_PROB_32, CProb will be UInt32(unsigned int) -+*/ -+ -+#ifdef _LZMA_OUT_READ -+int LzmaDecoderInit( -+ unsigned char *buffer, UInt32 bufferSize, -+ int lc, int lp, int pb, -+ unsigned char *dictionary, UInt32 dictionarySize, -+ #ifdef _LZMA_IN_CB -+ ILzmaInCallback *inCallback -+ #else -+ unsigned char *inStream, UInt32 inSize -+ #endif -+); -+#endif -+ -+int LzmaDecode( -+ unsigned char *buffer, -+ #ifndef _LZMA_OUT_READ -+ UInt32 bufferSize, -+ int lc, int lp, int pb, -+ #ifdef _LZMA_IN_CB -+ ILzmaInCallback *inCallback, -+ #else -+ unsigned char *inStream, UInt32 inSize, -+ #endif -+ #endif -+ unsigned char *outStream, UInt32 outSize, -+ UInt32 *outSizeProcessed); +diff -Nur linux-2.6.21.1/lib/Makefile linux-2.6.21.1-owrt/lib/Makefile +--- linux-2.6.21.1/lib/Makefile 2007-04-27 23:49:26.000000000 +0200 ++++ linux-2.6.21.1-owrt/lib/Makefile 2007-05-14 10:52:43.000000000 +0200 +@@ -12,7 +12,7 @@ + + lib-y += kobject.o kref.o kobject_uevent.o klist.o + +-obj-y += sort.o parser.o halfmd4.o debug_locks.o random32.o bust_spinlocks.o ++obj-y += sort.o parser.o halfmd4.o debug_locks.o random32.o bust_spinlocks.o LzmaDecode.o + + ifeq ($(CONFIG_DEBUG_KOBJECT),y) + CFLAGS_kobject.o += -DDEBUG +@@ -56,6 +56,7 @@ + obj-$(CONFIG_AUDIT_GENERIC) += audit.o + + obj-$(CONFIG_SWIOTLB) += swiotlb.o + -+#endif - + obj-$(CONFIG_FAULT_INJECTION) += fault-inject.o + + lib-$(CONFIG_GENERIC_BUG) += bug.o diff --git a/target/linux/generic-2.6/patches/013-mips_generic_gpio_support.patch b/target/linux/generic-2.6/patches/013-mips_generic_gpio_support.patch deleted file mode 100644 index 6f779b9849..0000000000 --- a/target/linux/generic-2.6/patches/013-mips_generic_gpio_support.patch +++ /dev/null @@ -1,50 +0,0 @@ ---- linux-2.6.19.2.orig/arch/mips/Kconfig 2007-05-11 22:08:15.000000000 +0200 -+++ linux-2.6.19.2/arch/mips/Kconfig 2007-05-12 18:51:13.000000000 +0200 -@@ -818,6 +818,10 @@ - bool - default y - -+config GENERIC_GPIO -+ bool -+ default n -+ - config SCHED_NO_NO_OMIT_FRAME_POINTER - bool - default y ---- linux-2.6.19.2.orig/include/asm-generic/gpio.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.19.2/include/asm-generic/gpio.h 2007-03-18 17:17:10.000000000 +0100 -@@ -0,0 +1,25 @@ -+#ifndef _ASM_GENERIC_GPIO_H -+#define _ASM_GENERIC_GPIO_H -+ -+/* platforms that don't directly support access to GPIOs through I2C, SPI, -+ * or other blocking infrastructure can use these wrappers. -+ */ -+ -+static inline int gpio_cansleep(unsigned gpio) -+{ -+ return 0; -+} -+ -+static inline int gpio_get_value_cansleep(unsigned gpio) -+{ -+ might_sleep(); -+ return gpio_get_value(gpio); -+} -+ -+static inline void gpio_set_value_cansleep(unsigned gpio, int value) -+{ -+ might_sleep(); -+ gpio_set_value(gpio, value); -+} -+ -+#endif /* _ASM_GENERIC_GPIO_H */ ---- linux-2.6.19.2.orig/include/asm-mips/gpio.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.19.2/include/asm-mips/gpio.h 2007-03-18 17:17:10.000000000 +0100 -@@ -0,0 +1,6 @@ -+#ifndef _ASM_MIPS_GPIO_H -+#define _ASM_MIPS_GPIO_H -+ -+#include -+ -+#endif /* _ASM_MIPS_GPIO_H */ diff --git a/target/linux/generic-2.6/patches/050-mtdpart_redboot_partition_truncate.patch b/target/linux/generic-2.6/patches/050-mtdpart_redboot_partition_truncate.patch deleted file mode 100644 index 2e2cde0f43..0000000000 --- a/target/linux/generic-2.6/patches/050-mtdpart_redboot_partition_truncate.patch +++ /dev/null @@ -1,61 +0,0 @@ -Redboot supports storing the FIS directory and the RedBoot -configuration information in the same block of flash memory. This is -not the most common RedBoot configuration, but it is used on -commercially available boards supported by the kernel. - -A recent patch to mtd/redboot.c (http://lkml.org/lkml/2006/3/20/410) -which corrected the skipping of deleted table entries has exposed the -latent problem of the kernel redboot parser running off the end of the -FIS directory and interpreting the RedBoot configuration information -as table entries. - -This patch terminates the table parsing when the first truly empty -entry is found (table entry deletion only clears the first byte of the -name, so two cleared bytes in a row indicates the end of the table), -thereby supporting the combined redboot FIS directory and RedBoot -configuration information flash layout scenario. - -Signed-off-by: Rod Whitby --- - -Index: linux-2.6.19/drivers/mtd/redboot.c -=================================================================== ---- linux-2.6.19.orig/drivers/mtd/redboot.c -+++ linux-2.6.19/drivers/mtd/redboot.c -@@ -96,7 +96,19 @@ static int parse_redboot_partitions(stru - */ - if (swab32(buf[i].size) == master->erasesize) { - int j; -- for (j = 0; j < numslots && buf[j].name[0] != 0xff; ++j) { -+ for (j = 0; j < numslots; ++j) { -+ -+ /* A single 0xff denotes a deleted entry. -+ * Two of them in a row is the end of the table. -+ */ -+ if (buf[j].name[0] == 0xff) { -+ if (buf[j].name[1] == 0xff) { -+ break; -+ } else { -+ continue; -+ } -+ } -+ - /* The unsigned long fields were written with the - * wrong byte sex, name and pad have no byte sex. - */ -@@ -123,8 +135,13 @@ static int parse_redboot_partitions(stru - for (i = 0; i < numslots; i++) { - struct fis_list *new_fl, **prev; - -- if (buf[i].name[0] == 0xff) -- continue; -+ if (buf[i].name[0] == 0xff) { -+ if (buf[i].name[1] == 0xff) { -+ break; -+ } else { -+ continue; -+ } -+ } - if (!redboot_checksum(&buf[i])) - break; - diff --git a/target/linux/generic-2.6/patches/060-rootfs_split.patch b/target/linux/generic-2.6/patches/060-rootfs_split.patch index b4a55256bf..c3f674afbd 100644 --- a/target/linux/generic-2.6/patches/060-rootfs_split.patch +++ b/target/linux/generic-2.6/patches/060-rootfs_split.patch @@ -1,6 +1,6 @@ -diff -ur linux.old/drivers/mtd/Kconfig linux.dev/drivers/mtd/Kconfig ---- linux.old/drivers/mtd/Kconfig 2007-01-10 20:10:37.000000000 +0100 -+++ linux.dev/drivers/mtd/Kconfig 2007-02-19 23:00:53.739457000 +0100 +diff -Nur linux-2.6.21.1/drivers/mtd/Kconfig linux-2.6.21.1-owrt/drivers/mtd/Kconfig +--- linux-2.6.21.1/drivers/mtd/Kconfig 2007-04-27 23:49:26.000000000 +0200 ++++ linux-2.6.21.1-owrt/drivers/mtd/Kconfig 2007-05-14 10:59:59.000000000 +0200 @@ -49,6 +49,11 @@ devices. Partitioning on NFTL 'devices' is a different - that's the 'normal' form of partitioning used on a block device. @@ -13,9 +13,9 @@ diff -ur linux.old/drivers/mtd/Kconfig linux.dev/drivers/mtd/Kconfig config MTD_REDBOOT_PARTS tristate "RedBoot partition table parsing" depends on MTD_PARTITIONS -diff -ur linux.old/drivers/mtd/mtdpart.c linux.dev/drivers/mtd/mtdpart.c ---- linux.old/drivers/mtd/mtdpart.c 2007-01-10 20:10:37.000000000 +0100 -+++ linux.dev/drivers/mtd/mtdpart.c 2007-02-20 00:01:38.587355896 +0100 +diff -Nur linux-2.6.21.1/drivers/mtd/mtdpart.c linux-2.6.21.1-owrt/drivers/mtd/mtdpart.c +--- linux-2.6.21.1/drivers/mtd/mtdpart.c 2007-04-27 23:49:26.000000000 +0200 ++++ linux-2.6.21.1-owrt/drivers/mtd/mtdpart.c 2007-05-14 11:18:56.000000000 +0200 @@ -20,6 +20,8 @@ #include #include @@ -25,7 +25,7 @@ diff -ur linux.old/drivers/mtd/mtdpart.c linux.dev/drivers/mtd/mtdpart.c /* Our partition linked list */ static LIST_HEAD(mtd_partitions); -@@ -303,6 +305,173 @@ +@@ -308,6 +310,172 @@ return 0; } @@ -35,14 +35,13 @@ diff -ur linux.old/drivers/mtd/mtdpart.c linux.dev/drivers/mtd/mtdpart.c + struct mtd_part *slave; + + /* allocate the partition structure */ -+ slave = kmalloc (sizeof(*slave), GFP_KERNEL); ++ slave = kzalloc (sizeof(*slave), GFP_KERNEL); + if (!slave) { + printk ("memory allocation error while creating partitions for \"%s\"\n", + master->name); + del_mtd_partitions(master); + return -ENOMEM; + } -+ memset(slave, 0, sizeof(*slave)); + list_add(&slave->list, &mtd_partitions); + + /* set up the MTD object for this partition */ @@ -51,8 +50,8 @@ diff -ur linux.old/drivers/mtd/mtdpart.c linux.dev/drivers/mtd/mtdpart.c + slave->mtd.size = part->size; + slave->mtd.writesize = master->writesize; + slave->mtd.oobsize = master->oobsize; -+ slave->mtd.ecctype = master->ecctype; -+ slave->mtd.eccsize = master->eccsize; ++ slave->mtd.oobavail = master->oobavail; ++ slave->mtd.subpage_sft = master->subpage_sft; + + slave->mtd.name = part->name; + slave->mtd.bank_size = master->bank_size; @@ -199,7 +198,7 @@ diff -ur linux.old/drivers/mtd/mtdpart.c linux.dev/drivers/mtd/mtdpart.c /* * This function, given a master MTD object and a partition table, creates * and registers slave MTD objects which are bound to the master according to -@@ -314,171 +483,53 @@ +@@ -319,170 +487,53 @@ const struct mtd_partition *parts, int nbparts) { @@ -250,14 +249,13 @@ diff -ur linux.old/drivers/mtd/mtdpart.c linux.dev/drivers/mtd/mtdpart.c + return ret; - /* allocate the partition structure */ -- slave = kmalloc (sizeof(*slave), GFP_KERNEL); +- slave = kzalloc (sizeof(*slave), GFP_KERNEL); - if (!slave) { - printk ("memory allocation error while creating partitions for \"%s\"\n", - master->name); - del_mtd_partitions(master); - return -ENOMEM; - } -- memset(slave, 0, sizeof(*slave)); - list_add(&slave->list, &mtd_partitions); - - /* set up the MTD object for this partition */ @@ -266,8 +264,8 @@ diff -ur linux.old/drivers/mtd/mtdpart.c linux.dev/drivers/mtd/mtdpart.c - slave->mtd.size = parts[i].size; - slave->mtd.writesize = master->writesize; - slave->mtd.oobsize = master->oobsize; -- slave->mtd.ecctype = master->ecctype; -- slave->mtd.eccsize = master->eccsize; +- slave->mtd.oobavail = master->oobavail; +- slave->mtd.subpage_sft = master->subpage_sft; - - slave->mtd.name = parts[i].name; - slave->mtd.bank_size = master->bank_size; diff --git a/target/linux/generic-2.6/patches/110-ipp2p_0.8.1rc1.patch b/target/linux/generic-2.6/patches/110-ipp2p_0.8.1rc1.patch index e03f4d5676..67a66b1d90 100644 --- a/target/linux/generic-2.6/patches/110-ipp2p_0.8.1rc1.patch +++ b/target/linux/generic-2.6/patches/110-ipp2p_0.8.1rc1.patch @@ -905,12 +905,12 @@ diff -urN linux-2.6.19.old/net/ipv4/netfilter/ipt_ipp2p.c linux-2.6.19.dev/net/i +static int __init init(void) +{ + printk(KERN_INFO "IPP2P v%s loading\n", IPP2P_VERSION); -+ return ipt_register_match(&ipp2p_match); ++ return xt_register_match(&ipp2p_match); +} + +static void __exit fini(void) +{ -+ ipt_unregister_match(&ipp2p_match); ++ xt_unregister_match(&ipp2p_match); + printk(KERN_INFO "IPP2P v%s unloaded\n", IPP2P_VERSION); +} + diff --git a/target/linux/generic-2.6/patches/120-openswan-2.4.0.kernel-2.6-natt.patch b/target/linux/generic-2.6/patches/120-openswan-2.4.0.kernel-2.6-natt.patch index 2b4238c688..b11ed53881 100644 --- a/target/linux/generic-2.6/patches/120-openswan-2.4.0.kernel-2.6-natt.patch +++ b/target/linux/generic-2.6/patches/120-openswan-2.4.0.kernel-2.6-natt.patch @@ -1,6 +1,6 @@ -diff -urN linux-2.6.19.old/include/net/xfrmudp.h linux-2.6.19.dev/include/net/xfrmudp.h ---- linux-2.6.19.old/include/net/xfrmudp.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.19.dev/include/net/xfrmudp.h 2006-12-14 03:13:41.000000000 +0100 +diff -Nur linux-2.6.21.1/include/net/xfrmudp.h linux-2.6.21.1-owrt/include/net/xfrmudp.h +--- linux-2.6.21.1/include/net/xfrmudp.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/include/net/xfrmudp.h 2007-05-14 11:26:11.000000000 +0200 @@ -0,0 +1,10 @@ +/* + * pointer to function for type that xfrm4_input wants, to permit @@ -12,10 +12,10 @@ diff -urN linux-2.6.19.old/include/net/xfrmudp.h linux-2.6.19.dev/include/net/xf +extern int udp4_register_esp_rcvencap(xfrm4_rcv_encap_t func + , xfrm4_rcv_encap_t *oldfunc); +extern int udp4_unregister_esp_rcvencap(xfrm4_rcv_encap_t func); -diff -urN linux-2.6.19.old/net/ipv4/Kconfig linux-2.6.19.dev/net/ipv4/Kconfig ---- linux-2.6.19.old/net/ipv4/Kconfig 2006-11-29 22:57:37.000000000 +0100 -+++ linux-2.6.19.dev/net/ipv4/Kconfig 2006-12-14 03:13:41.000000000 +0100 -@@ -273,6 +273,12 @@ +diff -Nur linux-2.6.21.1/net/ipv4/Kconfig linux-2.6.21.1-owrt/net/ipv4/Kconfig +--- linux-2.6.21.1/net/ipv4/Kconfig 2007-04-27 23:49:26.000000000 +0200 ++++ linux-2.6.21.1-owrt/net/ipv4/Kconfig 2007-05-14 11:26:11.000000000 +0200 +@@ -266,6 +266,12 @@ Network), but can be distributed all over the Internet. If you want to do that, say Y here and to "IP multicast routing" below. @@ -28,14 +28,15 @@ diff -urN linux-2.6.19.old/net/ipv4/Kconfig linux-2.6.19.dev/net/ipv4/Kconfig config IP_MROUTE bool "IP: multicast routing" depends on IP_MULTICAST -diff -urN linux-2.6.19.old/net/ipv4/udp.c linux-2.6.19.dev/net/ipv4/udp.c ---- linux-2.6.19.old/net/ipv4/udp.c 2006-11-29 22:57:37.000000000 +0100 -+++ linux-2.6.19.dev/net/ipv4/udp.c 2006-12-14 03:13:41.000000000 +0100 -@@ -108,11 +108,14 @@ - #include +diff -Nur linux-2.6.21.1/net/ipv4/udp.c linux-2.6.21.1-owrt/net/ipv4/udp.c +--- linux-2.6.21.1/net/ipv4/udp.c 2007-04-27 23:49:26.000000000 +0200 ++++ linux-2.6.21.1-owrt/net/ipv4/udp.c 2007-05-14 11:42:44.000000000 +0200 +@@ -101,12 +101,15 @@ + #include #include #include +#include + #include "udp_impl.h" /* * Snmp MIB for the UDP layer @@ -46,8 +47,8 @@ diff -urN linux-2.6.19.old/net/ipv4/udp.c linux-2.6.19.dev/net/ipv4/udp.c DEFINE_SNMP_STAT(struct udp_mib, udp_statistics) __read_mostly; struct hlist_head udp_hash[UDP_HTABLE_SIZE]; -@@ -917,6 +920,42 @@ - sk_common_release(sk); +@@ -915,6 +918,42 @@ + return 0; } +#if defined(CONFIG_XFRM) || defined(CONFIG_IPSEC_NAT_TRAVERSAL) @@ -89,19 +90,16 @@ diff -urN linux-2.6.19.old/net/ipv4/udp.c linux-2.6.19.dev/net/ipv4/udp.c /* return: * 1 if the the UDP system should process it * 0 if we should drop this packet -@@ -924,9 +963,9 @@ +@@ -922,7 +961,7 @@ */ static int udp_encap_rcv(struct sock * sk, struct sk_buff *skb) { -#ifndef CONFIG_XFRM +#if !defined(CONFIG_XFRM) && !defined(CONFIG_IPSEC_NAT_TRAVERSAL) - return 1; --#else -+#else /* either CONFIG_XFRM or CONFIG_IPSEC_NAT_TRAVERSAL */ + return 1; + #else struct udp_sock *up = udp_sk(sk); - struct udphdr *uh; - struct iphdr *iph; -@@ -939,11 +978,11 @@ +@@ -937,11 +976,11 @@ /* if we're overly short, let UDP handle it */ len = skb->len - sizeof(struct udphdr); if (len <= 0) @@ -115,7 +113,7 @@ diff -urN linux-2.6.19.old/net/ipv4/udp.c linux-2.6.19.dev/net/ipv4/udp.c /* If this is a paged skb, make sure we pull up * whatever data we need to look at. */ -@@ -966,7 +1005,7 @@ +@@ -964,7 +1003,7 @@ len = sizeof(struct udphdr); } else /* Must be an IKE packet.. pass it through */ @@ -124,7 +122,7 @@ diff -urN linux-2.6.19.old/net/ipv4/udp.c linux-2.6.19.dev/net/ipv4/udp.c break; case UDP_ENCAP_ESPINUDP_NON_IKE: /* Check if this is a keepalive packet. If so, eat it. */ -@@ -979,7 +1018,7 @@ +@@ -977,7 +1016,7 @@ len = sizeof(struct udphdr) + 2 * sizeof(u32); } else /* Must be an IKE packet.. pass it through */ @@ -133,7 +131,7 @@ diff -urN linux-2.6.19.old/net/ipv4/udp.c linux-2.6.19.dev/net/ipv4/udp.c break; } -@@ -990,6 +1029,8 @@ +@@ -988,6 +1027,8 @@ */ if (skb_cloned(skb) && pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) return 0; @@ -142,24 +140,24 @@ diff -urN linux-2.6.19.old/net/ipv4/udp.c linux-2.6.19.dev/net/ipv4/udp.c /* Now we can update and verify the packet length... */ iph = skb->nh.iph; -@@ -1055,9 +1096,13 @@ +@@ -1051,9 +1092,13 @@ return 0; } if (ret < 0) { - /* process the ESP packet */ - ret = xfrm4_rcv_encap(skb, up->encap_type); -- UDP_INC_STATS_BH(UDP_MIB_INDATAGRAMS); +- UDP_INC_STATS_BH(UDP_MIB_INDATAGRAMS, up->pcflag); + if(xfrm4_rcv_encap_func != NULL) { + ret = (*xfrm4_rcv_encap_func)(skb, up->encap_type); -+ UDP_INC_STATS_BH(UDP_MIB_INDATAGRAMS); ++ UDP_INC_STATS_BH(UDP_MIB_INDATAGRAMS, up->pcflag); + } else { -+ UDP_INC_STATS_BH(UDP_MIB_INERRORS); ++ UDP_INC_STATS_BH(UDP_MIB_INERRORS, up->pcflag); + ret = 1; + } return -ret; } /* FALLTHROUGH -- it's a UDP Packet */ -@@ -1639,3 +1684,9 @@ +@@ -1733,3 +1778,9 @@ EXPORT_SYMBOL(udp_proc_register); EXPORT_SYMBOL(udp_proc_unregister); #endif diff --git a/target/linux/generic-2.6/patches/130-netfilter-ipset.patch b/target/linux/generic-2.6/patches/130-netfilter-ipset.patch index 8a35d8a6b4..443e78b832 100644 --- a/target/linux/generic-2.6/patches/130-netfilter-ipset.patch +++ b/target/linux/generic-2.6/patches/130-netfilter-ipset.patch @@ -1,6 +1,6 @@ -diff -urN linux-2.6.19.old/include/linux/netfilter_ipv4/ip_set.h linux-2.6.19.dev/include/linux/netfilter_ipv4/ip_set.h ---- linux-2.6.19.old/include/linux/netfilter_ipv4/ip_set.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.19.dev/include/linux/netfilter_ipv4/ip_set.h 2006-12-14 03:13:43.000000000 +0100 +diff -Nur linux-2.6.21.1/include/linux/netfilter_ipv4/ip_set.h linux-2.6.21.1-owrt/include/linux/netfilter_ipv4/ip_set.h +--- linux-2.6.21.1/include/linux/netfilter_ipv4/ip_set.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/include/linux/netfilter_ipv4/ip_set.h 2007-05-14 11:44:19.000000000 +0200 @@ -0,0 +1,489 @@ +#ifndef _IP_SET_H +#define _IP_SET_H @@ -491,9 +491,9 @@ diff -urN linux-2.6.19.old/include/linux/netfilter_ipv4/ip_set.h linux-2.6.19.de +#endif /* __KERNEL__ */ + +#endif /*_IP_SET_H*/ -diff -urN linux-2.6.19.old/include/linux/netfilter_ipv4/ip_set_iphash.h linux-2.6.19.dev/include/linux/netfilter_ipv4/ip_set_iphash.h ---- linux-2.6.19.old/include/linux/netfilter_ipv4/ip_set_iphash.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.19.dev/include/linux/netfilter_ipv4/ip_set_iphash.h 2006-12-14 03:13:43.000000000 +0100 +diff -Nur linux-2.6.21.1/include/linux/netfilter_ipv4/ip_set_iphash.h linux-2.6.21.1-owrt/include/linux/netfilter_ipv4/ip_set_iphash.h +--- linux-2.6.21.1/include/linux/netfilter_ipv4/ip_set_iphash.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/include/linux/netfilter_ipv4/ip_set_iphash.h 2007-05-14 11:44:19.000000000 +0200 @@ -0,0 +1,30 @@ +#ifndef __IP_SET_IPHASH_H +#define __IP_SET_IPHASH_H @@ -525,9 +525,9 @@ diff -urN linux-2.6.19.old/include/linux/netfilter_ipv4/ip_set_iphash.h linux-2. +}; + +#endif /* __IP_SET_IPHASH_H */ -diff -urN linux-2.6.19.old/include/linux/netfilter_ipv4/ip_set_ipmap.h linux-2.6.19.dev/include/linux/netfilter_ipv4/ip_set_ipmap.h ---- linux-2.6.19.old/include/linux/netfilter_ipv4/ip_set_ipmap.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.19.dev/include/linux/netfilter_ipv4/ip_set_ipmap.h 2006-12-14 03:13:43.000000000 +0100 +diff -Nur linux-2.6.21.1/include/linux/netfilter_ipv4/ip_set_ipmap.h linux-2.6.21.1-owrt/include/linux/netfilter_ipv4/ip_set_ipmap.h +--- linux-2.6.21.1/include/linux/netfilter_ipv4/ip_set_ipmap.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/include/linux/netfilter_ipv4/ip_set_ipmap.h 2007-05-14 11:44:19.000000000 +0200 @@ -0,0 +1,56 @@ +#ifndef __IP_SET_IPMAP_H +#define __IP_SET_IPMAP_H @@ -585,9 +585,9 @@ diff -urN linux-2.6.19.old/include/linux/netfilter_ipv4/ip_set_ipmap.h linux-2.6 +} + +#endif /* __IP_SET_IPMAP_H */ -diff -urN linux-2.6.19.old/include/linux/netfilter_ipv4/ip_set_iptree.h linux-2.6.19.dev/include/linux/netfilter_ipv4/ip_set_iptree.h ---- linux-2.6.19.old/include/linux/netfilter_ipv4/ip_set_iptree.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.19.dev/include/linux/netfilter_ipv4/ip_set_iptree.h 2006-12-14 03:13:43.000000000 +0100 +diff -Nur linux-2.6.21.1/include/linux/netfilter_ipv4/ip_set_iptree.h linux-2.6.21.1-owrt/include/linux/netfilter_ipv4/ip_set_iptree.h +--- linux-2.6.21.1/include/linux/netfilter_ipv4/ip_set_iptree.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/include/linux/netfilter_ipv4/ip_set_iptree.h 2007-05-14 11:44:19.000000000 +0200 @@ -0,0 +1,39 @@ +#ifndef __IP_SET_IPTREE_H +#define __IP_SET_IPTREE_H @@ -628,9 +628,9 @@ diff -urN linux-2.6.19.old/include/linux/netfilter_ipv4/ip_set_iptree.h linux-2. +}; + +#endif /* __IP_SET_IPTREE_H */ -diff -urN linux-2.6.19.old/include/linux/netfilter_ipv4/ip_set_jhash.h linux-2.6.19.dev/include/linux/netfilter_ipv4/ip_set_jhash.h ---- linux-2.6.19.old/include/linux/netfilter_ipv4/ip_set_jhash.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.19.dev/include/linux/netfilter_ipv4/ip_set_jhash.h 2006-12-14 03:13:43.000000000 +0100 +diff -Nur linux-2.6.21.1/include/linux/netfilter_ipv4/ip_set_jhash.h linux-2.6.21.1-owrt/include/linux/netfilter_ipv4/ip_set_jhash.h +--- linux-2.6.21.1/include/linux/netfilter_ipv4/ip_set_jhash.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/include/linux/netfilter_ipv4/ip_set_jhash.h 2007-05-14 11:44:19.000000000 +0200 @@ -0,0 +1,148 @@ +#ifndef _LINUX_IPSET_JHASH_H +#define _LINUX_IPSET_JHASH_H @@ -780,9 +780,9 @@ diff -urN linux-2.6.19.old/include/linux/netfilter_ipv4/ip_set_jhash.h linux-2.6 +} + +#endif /* _LINUX_IPSET_JHASH_H */ -diff -urN linux-2.6.19.old/include/linux/netfilter_ipv4/ip_set_macipmap.h linux-2.6.19.dev/include/linux/netfilter_ipv4/ip_set_macipmap.h ---- linux-2.6.19.old/include/linux/netfilter_ipv4/ip_set_macipmap.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.19.dev/include/linux/netfilter_ipv4/ip_set_macipmap.h 2006-12-14 03:13:43.000000000 +0100 +diff -Nur linux-2.6.21.1/include/linux/netfilter_ipv4/ip_set_macipmap.h linux-2.6.21.1-owrt/include/linux/netfilter_ipv4/ip_set_macipmap.h +--- linux-2.6.21.1/include/linux/netfilter_ipv4/ip_set_macipmap.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/include/linux/netfilter_ipv4/ip_set_macipmap.h 2007-05-14 11:44:19.000000000 +0200 @@ -0,0 +1,38 @@ +#ifndef __IP_SET_MACIPMAP_H +#define __IP_SET_MACIPMAP_H @@ -822,9 +822,9 @@ diff -urN linux-2.6.19.old/include/linux/netfilter_ipv4/ip_set_macipmap.h linux- +}; + +#endif /* __IP_SET_MACIPMAP_H */ -diff -urN linux-2.6.19.old/include/linux/netfilter_ipv4/ip_set_malloc.h linux-2.6.19.dev/include/linux/netfilter_ipv4/ip_set_malloc.h ---- linux-2.6.19.old/include/linux/netfilter_ipv4/ip_set_malloc.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.19.dev/include/linux/netfilter_ipv4/ip_set_malloc.h 2006-12-14 03:13:43.000000000 +0100 +diff -Nur linux-2.6.21.1/include/linux/netfilter_ipv4/ip_set_malloc.h linux-2.6.21.1-owrt/include/linux/netfilter_ipv4/ip_set_malloc.h +--- linux-2.6.21.1/include/linux/netfilter_ipv4/ip_set_malloc.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/include/linux/netfilter_ipv4/ip_set_malloc.h 2007-05-14 11:44:19.000000000 +0200 @@ -0,0 +1,42 @@ +#ifndef _IP_SET_MALLOC_H +#define _IP_SET_MALLOC_H @@ -868,9 +868,9 @@ diff -urN linux-2.6.19.old/include/linux/netfilter_ipv4/ip_set_malloc.h linux-2. +#endif /* __KERNEL__ */ + +#endif /*_IP_SET_MALLOC_H*/ -diff -urN linux-2.6.19.old/include/linux/netfilter_ipv4/ip_set_nethash.h linux-2.6.19.dev/include/linux/netfilter_ipv4/ip_set_nethash.h ---- linux-2.6.19.old/include/linux/netfilter_ipv4/ip_set_nethash.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.19.dev/include/linux/netfilter_ipv4/ip_set_nethash.h 2006-12-14 03:13:43.000000000 +0100 +diff -Nur linux-2.6.21.1/include/linux/netfilter_ipv4/ip_set_nethash.h linux-2.6.21.1-owrt/include/linux/netfilter_ipv4/ip_set_nethash.h +--- linux-2.6.21.1/include/linux/netfilter_ipv4/ip_set_nethash.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/include/linux/netfilter_ipv4/ip_set_nethash.h 2007-05-14 11:44:19.000000000 +0200 @@ -0,0 +1,55 @@ +#ifndef __IP_SET_NETHASH_H +#define __IP_SET_NETHASH_H @@ -927,9 +927,9 @@ diff -urN linux-2.6.19.old/include/linux/netfilter_ipv4/ip_set_nethash.h linux-2 +} + +#endif /* __IP_SET_NETHASH_H */ -diff -urN linux-2.6.19.old/include/linux/netfilter_ipv4/ip_set_portmap.h linux-2.6.19.dev/include/linux/netfilter_ipv4/ip_set_portmap.h ---- linux-2.6.19.old/include/linux/netfilter_ipv4/ip_set_portmap.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.19.dev/include/linux/netfilter_ipv4/ip_set_portmap.h 2006-12-14 03:13:43.000000000 +0100 +diff -Nur linux-2.6.21.1/include/linux/netfilter_ipv4/ip_set_portmap.h linux-2.6.21.1-owrt/include/linux/netfilter_ipv4/ip_set_portmap.h +--- linux-2.6.21.1/include/linux/netfilter_ipv4/ip_set_portmap.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/include/linux/netfilter_ipv4/ip_set_portmap.h 2007-05-14 11:44:19.000000000 +0200 @@ -0,0 +1,25 @@ +#ifndef __IP_SET_PORTMAP_H +#define __IP_SET_PORTMAP_H @@ -956,9 +956,9 @@ diff -urN linux-2.6.19.old/include/linux/netfilter_ipv4/ip_set_portmap.h linux-2 +}; + +#endif /* __IP_SET_PORTMAP_H */ -diff -urN linux-2.6.19.old/include/linux/netfilter_ipv4/ip_set_prime.h linux-2.6.19.dev/include/linux/netfilter_ipv4/ip_set_prime.h ---- linux-2.6.19.old/include/linux/netfilter_ipv4/ip_set_prime.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.19.dev/include/linux/netfilter_ipv4/ip_set_prime.h 2006-12-14 03:13:43.000000000 +0100 +diff -Nur linux-2.6.21.1/include/linux/netfilter_ipv4/ip_set_prime.h linux-2.6.21.1-owrt/include/linux/netfilter_ipv4/ip_set_prime.h +--- linux-2.6.21.1/include/linux/netfilter_ipv4/ip_set_prime.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/include/linux/netfilter_ipv4/ip_set_prime.h 2007-05-14 11:44:19.000000000 +0200 @@ -0,0 +1,34 @@ +#ifndef __IP_SET_PRIME_H +#define __IP_SET_PRIME_H @@ -994,9 +994,9 @@ diff -urN linux-2.6.19.old/include/linux/netfilter_ipv4/ip_set_prime.h linux-2.6 +} + +#endif /* __IP_SET_PRIME_H */ -diff -urN linux-2.6.19.old/include/linux/netfilter_ipv4/ipt_set.h linux-2.6.19.dev/include/linux/netfilter_ipv4/ipt_set.h ---- linux-2.6.19.old/include/linux/netfilter_ipv4/ipt_set.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.19.dev/include/linux/netfilter_ipv4/ipt_set.h 2006-12-14 03:13:43.000000000 +0100 +diff -Nur linux-2.6.21.1/include/linux/netfilter_ipv4/ipt_set.h linux-2.6.21.1-owrt/include/linux/netfilter_ipv4/ipt_set.h +--- linux-2.6.21.1/include/linux/netfilter_ipv4/ipt_set.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/include/linux/netfilter_ipv4/ipt_set.h 2007-05-14 11:44:19.000000000 +0200 @@ -0,0 +1,21 @@ +#ifndef _IPT_SET_H +#define _IPT_SET_H @@ -1019,9 +1019,9 @@ diff -urN linux-2.6.19.old/include/linux/netfilter_ipv4/ipt_set.h linux-2.6.19.d +}; + +#endif /*_IPT_SET_H*/ -diff -urN linux-2.6.19.old/include/linux/netfilter_ipv4/listhelp.h linux-2.6.19.dev/include/linux/netfilter_ipv4/listhelp.h ---- linux-2.6.19.old/include/linux/netfilter_ipv4/listhelp.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.19.dev/include/linux/netfilter_ipv4/listhelp.h 2006-12-14 03:13:43.000000000 +0100 +diff -Nur linux-2.6.21.1/include/linux/netfilter_ipv4/listhelp.h linux-2.6.21.1-owrt/include/linux/netfilter_ipv4/listhelp.h +--- linux-2.6.21.1/include/linux/netfilter_ipv4/listhelp.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/include/linux/netfilter_ipv4/listhelp.h 2007-05-14 11:44:19.000000000 +0200 @@ -0,0 +1,123 @@ +#ifndef _LISTHELP_H +#define _LISTHELP_H @@ -1146,9 +1146,9 @@ diff -urN linux-2.6.19.old/include/linux/netfilter_ipv4/listhelp.h linux-2.6.19. +LIST_FIND(head, __list_cmp_name, void *, name) + +#endif /*_LISTHELP_H*/ -diff -urN linux-2.6.19.old/net/ipv4/netfilter/ip_set.c linux-2.6.19.dev/net/ipv4/netfilter/ip_set.c ---- linux-2.6.19.old/net/ipv4/netfilter/ip_set.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.19.dev/net/ipv4/netfilter/ip_set.c 2006-12-14 03:13:43.000000000 +0100 +diff -Nur linux-2.6.21.1/net/ipv4/netfilter/ip_set.c linux-2.6.21.1-owrt/net/ipv4/netfilter/ip_set.c +--- linux-2.6.21.1/net/ipv4/netfilter/ip_set.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/net/ipv4/netfilter/ip_set.c 2007-05-14 11:44:19.000000000 +0200 @@ -0,0 +1,1989 @@ +/* Copyright (C) 2000-2002 Joakim Axelsson + * Patrick Schaaf @@ -3139,9 +3139,9 @@ diff -urN linux-2.6.19.old/net/ipv4/netfilter/ip_set.c linux-2.6.19.dev/net/ipv4 + +module_init(init); +module_exit(fini); -diff -urN linux-2.6.19.old/net/ipv4/netfilter/ip_set_iphash.c linux-2.6.19.dev/net/ipv4/netfilter/ip_set_iphash.c ---- linux-2.6.19.old/net/ipv4/netfilter/ip_set_iphash.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.19.dev/net/ipv4/netfilter/ip_set_iphash.c 2006-12-14 03:13:43.000000000 +0100 +diff -Nur linux-2.6.21.1/net/ipv4/netfilter/ip_set_iphash.c linux-2.6.21.1-owrt/net/ipv4/netfilter/ip_set_iphash.c +--- linux-2.6.21.1/net/ipv4/netfilter/ip_set_iphash.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/net/ipv4/netfilter/ip_set_iphash.c 2007-05-14 11:44:19.000000000 +0200 @@ -0,0 +1,379 @@ +/* Copyright (C) 2003-2004 Jozsef Kadlecsik + * @@ -3522,9 +3522,9 @@ diff -urN linux-2.6.19.old/net/ipv4/netfilter/ip_set_iphash.c linux-2.6.19.dev/n + +module_init(init); +module_exit(fini); -diff -urN linux-2.6.19.old/net/ipv4/netfilter/ip_set_ipmap.c linux-2.6.19.dev/net/ipv4/netfilter/ip_set_ipmap.c ---- linux-2.6.19.old/net/ipv4/netfilter/ip_set_ipmap.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.19.dev/net/ipv4/netfilter/ip_set_ipmap.c 2006-12-14 03:13:43.000000000 +0100 +diff -Nur linux-2.6.21.1/net/ipv4/netfilter/ip_set_ipmap.c linux-2.6.21.1-owrt/net/ipv4/netfilter/ip_set_ipmap.c +--- linux-2.6.21.1/net/ipv4/netfilter/ip_set_ipmap.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/net/ipv4/netfilter/ip_set_ipmap.c 2007-05-14 11:44:19.000000000 +0200 @@ -0,0 +1,313 @@ +/* Copyright (C) 2000-2002 Joakim Axelsson + * Patrick Schaaf @@ -3839,9 +3839,9 @@ diff -urN linux-2.6.19.old/net/ipv4/netfilter/ip_set_ipmap.c linux-2.6.19.dev/ne + +module_init(init); +module_exit(fini); -diff -urN linux-2.6.19.old/net/ipv4/netfilter/ip_set_iptree.c linux-2.6.19.dev/net/ipv4/netfilter/ip_set_iptree.c ---- linux-2.6.19.old/net/ipv4/netfilter/ip_set_iptree.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.19.dev/net/ipv4/netfilter/ip_set_iptree.c 2006-12-14 03:13:43.000000000 +0100 +diff -Nur linux-2.6.21.1/net/ipv4/netfilter/ip_set_iptree.c linux-2.6.21.1-owrt/net/ipv4/netfilter/ip_set_iptree.c +--- linux-2.6.21.1/net/ipv4/netfilter/ip_set_iptree.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/net/ipv4/netfilter/ip_set_iptree.c 2007-05-14 11:44:19.000000000 +0200 @@ -0,0 +1,510 @@ +/* Copyright (C) 2005 Jozsef Kadlecsik + * @@ -4353,9 +4353,9 @@ diff -urN linux-2.6.19.old/net/ipv4/netfilter/ip_set_iptree.c linux-2.6.19.dev/n + +module_init(init); +module_exit(fini); -diff -urN linux-2.6.19.old/net/ipv4/netfilter/ip_set_macipmap.c linux-2.6.19.dev/net/ipv4/netfilter/ip_set_macipmap.c ---- linux-2.6.19.old/net/ipv4/netfilter/ip_set_macipmap.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.19.dev/net/ipv4/netfilter/ip_set_macipmap.c 2006-12-14 03:13:43.000000000 +0100 +diff -Nur linux-2.6.21.1/net/ipv4/netfilter/ip_set_macipmap.c linux-2.6.21.1-owrt/net/ipv4/netfilter/ip_set_macipmap.c +--- linux-2.6.21.1/net/ipv4/netfilter/ip_set_macipmap.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/net/ipv4/netfilter/ip_set_macipmap.c 2007-05-14 11:44:19.000000000 +0200 @@ -0,0 +1,338 @@ +/* Copyright (C) 2000-2002 Joakim Axelsson + * Patrick Schaaf @@ -4695,9 +4695,9 @@ diff -urN linux-2.6.19.old/net/ipv4/netfilter/ip_set_macipmap.c linux-2.6.19.dev + +module_init(init); +module_exit(fini); -diff -urN linux-2.6.19.old/net/ipv4/netfilter/ip_set_nethash.c linux-2.6.19.dev/net/ipv4/netfilter/ip_set_nethash.c ---- linux-2.6.19.old/net/ipv4/netfilter/ip_set_nethash.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.19.dev/net/ipv4/netfilter/ip_set_nethash.c 2006-12-14 03:13:43.000000000 +0100 +diff -Nur linux-2.6.21.1/net/ipv4/netfilter/ip_set_nethash.c linux-2.6.21.1-owrt/net/ipv4/netfilter/ip_set_nethash.c +--- linux-2.6.21.1/net/ipv4/netfilter/ip_set_nethash.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/net/ipv4/netfilter/ip_set_nethash.c 2007-05-14 11:44:19.000000000 +0200 @@ -0,0 +1,449 @@ +/* Copyright (C) 2003-2004 Jozsef Kadlecsik + * @@ -5148,9 +5148,9 @@ diff -urN linux-2.6.19.old/net/ipv4/netfilter/ip_set_nethash.c linux-2.6.19.dev/ + +module_init(init); +module_exit(fini); -diff -urN linux-2.6.19.old/net/ipv4/netfilter/ip_set_portmap.c linux-2.6.19.dev/net/ipv4/netfilter/ip_set_portmap.c ---- linux-2.6.19.old/net/ipv4/netfilter/ip_set_portmap.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.19.dev/net/ipv4/netfilter/ip_set_portmap.c 2006-12-14 03:13:43.000000000 +0100 +diff -Nur linux-2.6.21.1/net/ipv4/netfilter/ip_set_portmap.c linux-2.6.21.1-owrt/net/ipv4/netfilter/ip_set_portmap.c +--- linux-2.6.21.1/net/ipv4/netfilter/ip_set_portmap.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/net/ipv4/netfilter/ip_set_portmap.c 2007-05-14 11:44:19.000000000 +0200 @@ -0,0 +1,325 @@ +/* Copyright (C) 2003-2004 Jozsef Kadlecsik + * @@ -5477,9 +5477,9 @@ diff -urN linux-2.6.19.old/net/ipv4/netfilter/ip_set_portmap.c linux-2.6.19.dev/ + +module_init(init); +module_exit(fini); -diff -urN linux-2.6.19.old/net/ipv4/netfilter/ipt_set.c linux-2.6.19.dev/net/ipv4/netfilter/ipt_set.c ---- linux-2.6.19.old/net/ipv4/netfilter/ipt_set.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.19.dev/net/ipv4/netfilter/ipt_set.c 2006-12-14 03:13:43.000000000 +0100 +diff -Nur linux-2.6.21.1/net/ipv4/netfilter/ipt_set.c linux-2.6.21.1-owrt/net/ipv4/netfilter/ipt_set.c +--- linux-2.6.21.1/net/ipv4/netfilter/ipt_set.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/net/ipv4/netfilter/ipt_set.c 2007-05-14 11:44:19.000000000 +0200 @@ -0,0 +1,105 @@ +/* Copyright (C) 2000-2002 Joakim Axelsson + * Patrick Schaaf @@ -5586,9 +5586,9 @@ diff -urN linux-2.6.19.old/net/ipv4/netfilter/ipt_set.c linux-2.6.19.dev/net/ipv + +module_init(init); +module_exit(fini); -diff -urN linux-2.6.19.old/net/ipv4/netfilter/ipt_SET.c linux-2.6.19.dev/net/ipv4/netfilter/ipt_SET.c ---- linux-2.6.19.old/net/ipv4/netfilter/ipt_SET.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.19.dev/net/ipv4/netfilter/ipt_SET.c 2006-12-14 03:13:43.000000000 +0100 +diff -Nur linux-2.6.21.1/net/ipv4/netfilter/ipt_SET.c linux-2.6.21.1-owrt/net/ipv4/netfilter/ipt_SET.c +--- linux-2.6.21.1/net/ipv4/netfilter/ipt_SET.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/net/ipv4/netfilter/ipt_SET.c 2007-05-14 11:44:19.000000000 +0200 @@ -0,0 +1,120 @@ +/* Copyright (C) 2000-2002 Joakim Axelsson + * Patrick Schaaf @@ -5700,7 +5700,7 @@ diff -urN linux-2.6.19.old/net/ipv4/netfilter/ipt_SET.c linux-2.6.19.dev/net/ipv + +static int __init init(void) +{ -+ return ipt_register_target(&SET_target); ++ return xt_register_target(&SET_target); +} + +static void __exit fini(void) @@ -5710,10 +5710,10 @@ diff -urN linux-2.6.19.old/net/ipv4/netfilter/ipt_SET.c linux-2.6.19.dev/net/ipv + +module_init(init); +module_exit(fini); -diff -urN linux-2.6.19.old/net/ipv4/netfilter/Kconfig linux-2.6.19.dev/net/ipv4/netfilter/Kconfig ---- linux-2.6.19.old/net/ipv4/netfilter/Kconfig 2006-12-14 03:13:41.000000000 +0100 -+++ linux-2.6.19.dev/net/ipv4/netfilter/Kconfig 2006-12-14 03:13:43.000000000 +0100 -@@ -647,5 +647,106 @@ +diff -Nur linux-2.6.21.1/net/ipv4/netfilter/Kconfig linux-2.6.21.1-owrt/net/ipv4/netfilter/Kconfig +--- linux-2.6.21.1/net/ipv4/netfilter/Kconfig 2007-05-14 11:24:57.000000000 +0200 ++++ linux-2.6.21.1-owrt/net/ipv4/netfilter/Kconfig 2007-05-14 11:44:19.000000000 +0200 +@@ -681,5 +681,106 @@ Allows altering the ARP packet payload: source and destination hardware and network addresses. @@ -5820,21 +5820,21 @@ diff -urN linux-2.6.19.old/net/ipv4/netfilter/Kconfig linux-2.6.19.dev/net/ipv4/ + endmenu -diff -urN linux-2.6.19.old/net/ipv4/netfilter/Makefile linux-2.6.19.dev/net/ipv4/netfilter/Makefile ---- linux-2.6.19.old/net/ipv4/netfilter/Makefile 2006-12-14 03:13:41.000000000 +0100 -+++ linux-2.6.19.dev/net/ipv4/netfilter/Makefile 2006-12-14 03:13:43.000000000 +0100 -@@ -54,6 +54,7 @@ +diff -Nur linux-2.6.21.1/net/ipv4/netfilter/Makefile linux-2.6.21.1-owrt/net/ipv4/netfilter/Makefile +--- linux-2.6.21.1/net/ipv4/netfilter/Makefile 2007-05-14 11:24:57.000000000 +0200 ++++ linux-2.6.21.1-owrt/net/ipv4/netfilter/Makefile 2007-05-14 11:47:22.000000000 +0200 +@@ -83,6 +83,7 @@ + obj-$(CONFIG_IP_NF_RAW) += iptable_raw.o # matches - obj-$(CONFIG_IP_NF_MATCH_HASHLIMIT) += ipt_hashlimit.o +obj-$(CONFIG_IP_NF_MATCH_SET) += ipt_set.o obj-$(CONFIG_IP_NF_MATCH_IPRANGE) += ipt_iprange.o obj-$(CONFIG_IP_NF_MATCH_OWNER) += ipt_owner.o obj-$(CONFIG_IP_NF_MATCH_TOS) += ipt_tos.o -@@ -77,6 +78,17 @@ - obj-$(CONFIG_IP_NF_TARGET_LOG) += ipt_LOG.o +@@ -107,6 +108,16 @@ obj-$(CONFIG_IP_NF_TARGET_ULOG) += ipt_ULOG.o - obj-$(CONFIG_IP_NF_TARGET_TCPMSS) += ipt_TCPMSS.o + obj-$(CONFIG_IP_NF_TARGET_CLUSTERIP) += ipt_CLUSTERIP.o + obj-$(CONFIG_IP_NF_TARGET_TTL) += ipt_TTL.o +obj-$(CONFIG_IP_NF_TARGET_SET) += ipt_SET.o + +# sets @@ -5845,7 +5845,6 @@ diff -urN linux-2.6.19.old/net/ipv4/netfilter/Makefile linux-2.6.19.dev/net/ipv4 +obj-$(CONFIG_IP_NF_SET_IPHASH) += ip_set_iphash.o +obj-$(CONFIG_IP_NF_SET_NETHASH) += ip_set_nethash.o +obj-$(CONFIG_IP_NF_SET_IPTREE) += ip_set_iptree.o -+ - obj-$(CONFIG_IP_NF_TARGET_CLUSTERIP) += ipt_CLUSTERIP.o - obj-$(CONFIG_IP_NF_TARGET_TTL) += ipt_TTL.o + # generic ARP tables + obj-$(CONFIG_IP_NF_ARPTABLES) += arp_tables.o diff --git a/target/linux/generic-2.6/patches/150-netfilter_imq.patch b/target/linux/generic-2.6/patches/150-netfilter_imq.patch index 54324022a9..742b4e8d01 100644 --- a/target/linux/generic-2.6/patches/150-netfilter_imq.patch +++ b/target/linux/generic-2.6/patches/150-netfilter_imq.patch @@ -1,6 +1,5 @@ -diff -urN linux-2.6.19/drivers/net/imq.c linux-2.6.19+imq/drivers/net/imq.c ---- linux-2.6.19/drivers/net/imq.c 1970-01-01 09:30:00.000000000 +0930 -+++ linux-2.6.19+imq/drivers/net/imq.c 2006-12-05 23:01:02.000000000 +1030 +--- linux-2.6.20-original/drivers/net/imq.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux-2.6.20/drivers/net/imq.c 2007-02-12 23:55:04.000000000 +0200 @@ -0,0 +1,402 @@ +/* + * Pseudo-driver for the intermediate queue device. @@ -404,9 +403,8 @@ diff -urN linux-2.6.19/drivers/net/imq.c linux-2.6.19+imq/drivers/net/imq.c +MODULE_AUTHOR("http://www.linuximq.net"); +MODULE_DESCRIPTION("Pseudo-driver for the intermediate queue device. See http://www.linuximq.net/ for more information."); +MODULE_LICENSE("GPL"); -diff -urN linux-2.6.19/drivers/net/Kconfig linux-2.6.19+imq/drivers/net/Kconfig ---- linux-2.6.19/drivers/net/Kconfig 2006-12-01 14:05:30.000000000 +1030 -+++ linux-2.6.19+imq/drivers/net/Kconfig 2006-12-05 23:03:52.000000000 +1030 +--- linux-2.6.20-original/drivers/net/Kconfig 2007-02-04 20:44:54.000000000 +0200 ++++ linux-2.6.20/drivers/net/Kconfig 2007-02-12 23:55:04.000000000 +0200 @@ -96,6 +96,129 @@ To compile this driver as a module, choose M here: the module will be called eql. If unsure, say N. @@ -537,9 +535,8 @@ diff -urN linux-2.6.19/drivers/net/Kconfig linux-2.6.19+imq/drivers/net/Kconfig config TUN tristate "Universal TUN/TAP device driver support" select CRC32 -diff -urN linux-2.6.19/drivers/net/Makefile linux-2.6.19+imq/drivers/net/Makefile ---- linux-2.6.19/drivers/net/Makefile 2006-12-01 14:05:30.000000000 +1030 -+++ linux-2.6.19+imq/drivers/net/Makefile 2006-12-04 12:41:01.000000000 +1030 +--- linux-2.6.20-original/drivers/net/Makefile 2007-02-04 20:44:54.000000000 +0200 ++++ linux-2.6.20/drivers/net/Makefile 2007-02-12 23:55:04.000000000 +0200 @@ -124,6 +124,7 @@ obj-$(CONFIG_SLHC) += slhc.o @@ -548,9 +545,8 @@ diff -urN linux-2.6.19/drivers/net/Makefile linux-2.6.19+imq/drivers/net/Makefil obj-$(CONFIG_IFB) += ifb.o obj-$(CONFIG_DE600) += de600.o obj-$(CONFIG_DE620) += de620.o -diff -urN linux-2.6.19/include/linux/imq.h linux-2.6.19+imq/include/linux/imq.h ---- linux-2.6.19/include/linux/imq.h 1970-01-01 09:30:00.000000000 +0930 -+++ linux-2.6.19+imq/include/linux/imq.h 2006-12-04 12:41:01.000000000 +1030 +--- linux-2.6.20-original/include/linux/imq.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux-2.6.20/include/linux/imq.h 2007-02-12 23:55:04.000000000 +0200 @@ -0,0 +1,9 @@ +#ifndef _IMQ_H +#define _IMQ_H @@ -561,9 +557,8 @@ diff -urN linux-2.6.19/include/linux/imq.h linux-2.6.19+imq/include/linux/imq.h +#define IMQ_F_ENQUEUE 0x80 + +#endif /* _IMQ_H */ -diff -urN linux-2.6.19/include/linux/netfilter_ipv4/ipt_IMQ.h linux-2.6.19+imq/include/linux/netfilter_ipv4/ipt_IMQ.h ---- linux-2.6.19/include/linux/netfilter_ipv4/ipt_IMQ.h 1970-01-01 09:30:00.000000000 +0930 -+++ linux-2.6.19+imq/include/linux/netfilter_ipv4/ipt_IMQ.h 2006-12-05 23:04:22.000000000 +1030 +--- linux-2.6.20-original/include/linux/netfilter_ipv4/ipt_IMQ.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux-2.6.20/include/linux/netfilter_ipv4/ipt_IMQ.h 2007-02-12 23:55:04.000000000 +0200 @@ -0,0 +1,8 @@ +#ifndef _IPT_IMQ_H +#define _IPT_IMQ_H @@ -573,9 +568,8 @@ diff -urN linux-2.6.19/include/linux/netfilter_ipv4/ipt_IMQ.h linux-2.6.19+imq/i +}; + +#endif /* _IPT_IMQ_H */ -diff -urN linux-2.6.19/include/linux/netfilter_ipv6/ip6t_IMQ.h linux-2.6.19+imq/include/linux/netfilter_ipv6/ip6t_IMQ.h ---- linux-2.6.19/include/linux/netfilter_ipv6/ip6t_IMQ.h 1970-01-01 09:30:00.000000000 +0930 -+++ linux-2.6.19+imq/include/linux/netfilter_ipv6/ip6t_IMQ.h 2006-12-05 23:04:32.000000000 +1030 +--- linux-2.6.20-original/include/linux/netfilter_ipv6/ip6t_IMQ.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux-2.6.20/include/linux/netfilter_ipv6/ip6t_IMQ.h 2007-02-12 23:55:04.000000000 +0200 @@ -0,0 +1,8 @@ +#ifndef _IP6T_IMQ_H +#define _IP6T_IMQ_H @@ -585,10 +579,9 @@ diff -urN linux-2.6.19/include/linux/netfilter_ipv6/ip6t_IMQ.h linux-2.6.19+imq/ +}; + +#endif /* _IP6T_IMQ_H */ -diff -urN linux-2.6.19/include/linux/skbuff.h linux-2.6.19+imq/include/linux/skbuff.h ---- linux-2.6.19/include/linux/skbuff.h 2006-12-01 14:05:44.000000000 +1030 -+++ linux-2.6.19+imq/include/linux/skbuff.h 2006-12-05 23:05:06.000000000 +1030 -@@ -292,6 +292,10 @@ +--- linux-2.6.20-original/include/linux/skbuff.h 2007-02-04 20:44:54.000000000 +0200 ++++ linux-2.6.20/include/linux/skbuff.h 2007-02-12 23:55:04.000000000 +0200 +@@ -293,6 +293,10 @@ #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) struct sk_buff *nfct_reasm; #endif @@ -599,9 +592,8 @@ diff -urN linux-2.6.19/include/linux/skbuff.h linux-2.6.19+imq/include/linux/skb #ifdef CONFIG_BRIDGE_NETFILTER struct nf_bridge_info *nf_bridge; #endif -diff -urN linux-2.6.19/net/core/dev.c linux-2.6.19+imq/net/core/dev.c ---- linux-2.6.19/net/core/dev.c 2006-12-01 14:05:45.000000000 +1030 -+++ linux-2.6.19+imq/net/core/dev.c 2006-12-05 23:05:40.000000000 +1030 +--- linux-2.6.20-original/net/core/dev.c 2007-02-04 20:44:54.000000000 +0200 ++++ linux-2.6.20/net/core/dev.c 2007-02-12 23:55:04.000000000 +0200 @@ -94,6 +94,9 @@ #include #include @@ -612,7 +604,7 @@ diff -urN linux-2.6.19/net/core/dev.c linux-2.6.19+imq/net/core/dev.c #include #include #include -@@ -1344,7 +1347,11 @@ +@@ -1343,7 +1346,11 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) { if (likely(!skb->next)) { @@ -625,10 +617,9 @@ diff -urN linux-2.6.19/net/core/dev.c linux-2.6.19+imq/net/core/dev.c dev_queue_xmit_nit(skb, dev); if (netif_needs_gso(dev, skb)) { -diff -urN linux-2.6.19/net/core/skbuff.c linux-2.6.19+imq/net/core/skbuff.c ---- linux-2.6.19/net/core/skbuff.c 2006-12-01 14:05:45.000000000 +1030 -+++ linux-2.6.19+imq/net/core/skbuff.c 2006-12-04 12:41:01.000000000 +1030 -@@ -482,6 +482,10 @@ +--- linux-2.6.20-original/net/core/skbuff.c 2007-02-04 20:44:54.000000000 +0200 ++++ linux-2.6.20/net/core/skbuff.c 2007-02-12 23:55:04.000000000 +0200 +@@ -485,6 +485,10 @@ C(nfct_reasm); nf_conntrack_get_reasm(skb->nfct_reasm); #endif @@ -639,7 +630,7 @@ diff -urN linux-2.6.19/net/core/skbuff.c linux-2.6.19+imq/net/core/skbuff.c #ifdef CONFIG_BRIDGE_NETFILTER C(nf_bridge); nf_bridge_get(skb->nf_bridge); -@@ -546,6 +550,10 @@ +@@ -549,6 +553,10 @@ #if defined(CONFIG_IP_VS) || defined(CONFIG_IP_VS_MODULE) new->ipvs_property = old->ipvs_property; #endif @@ -650,9 +641,8 @@ diff -urN linux-2.6.19/net/core/skbuff.c linux-2.6.19+imq/net/core/skbuff.c #ifdef CONFIG_BRIDGE_NETFILTER new->nf_bridge = old->nf_bridge; nf_bridge_get(old->nf_bridge); -diff -urN linux-2.6.19/net/ipv4/netfilter/ipt_IMQ.c linux-2.6.19+imq/net/ipv4/netfilter/ipt_IMQ.c ---- linux-2.6.19/net/ipv4/netfilter/ipt_IMQ.c 1970-01-01 09:30:00.000000000 +0930 -+++ linux-2.6.19.2/net/ipv4/netfilter/ipt_IMQ.c 2007-01-25 09:59:34.000000000 +0100 +--- linux-2.6.20-original/net/ipv4/netfilter/ipt_IMQ.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux-2.6.20/net/ipv4/netfilter/ipt_IMQ.c 2007-02-12 23:55:04.000000000 +0200 @@ -0,0 +1,71 @@ +/* + * This target marks packets to be enqueued to an imq device @@ -708,7 +698,7 @@ diff -urN linux-2.6.19/net/ipv4/netfilter/ipt_IMQ.c linux-2.6.19+imq/net/ipv4/ne + +static int __init init(void) +{ -+ if (ipt_register_target(&ipt_imq_reg)) ++ if (xt_register_target(&ipt_imq_reg)) + return -EINVAL; + + return 0; @@ -716,7 +706,7 @@ diff -urN linux-2.6.19/net/ipv4/netfilter/ipt_IMQ.c linux-2.6.19+imq/net/ipv4/ne + +static void __exit fini(void) +{ -+ ipt_unregister_target(&ipt_imq_reg); ++ xt_unregister_target(&ipt_imq_reg); +} + +module_init(init); @@ -725,10 +715,9 @@ diff -urN linux-2.6.19/net/ipv4/netfilter/ipt_IMQ.c linux-2.6.19+imq/net/ipv4/ne +MODULE_AUTHOR("http://www.linuximq.net"); +MODULE_DESCRIPTION("Pseudo-driver for the intermediate queue device. See http://www.linuximq.net/ for more information."); +MODULE_LICENSE("GPL"); -diff -urN linux-2.6.19/net/ipv4/netfilter/Kconfig linux-2.6.19+imq/net/ipv4/netfilter/Kconfig ---- linux-2.6.19/net/ipv4/netfilter/Kconfig 2006-12-01 14:05:45.000000000 +1030 -+++ linux-2.6.19+imq/net/ipv4/netfilter/Kconfig 2006-12-04 12:41:01.000000000 +1030 -@@ -533,6 +533,17 @@ +--- linux-2.6.20-original/net/ipv4/netfilter/Kconfig 2007-02-04 20:44:54.000000000 +0200 ++++ linux-2.6.20/net/ipv4/netfilter/Kconfig 2007-02-12 23:55:04.000000000 +0200 +@@ -591,6 +591,17 @@ To compile it as a module, choose M here. If unsure, say N. @@ -746,10 +735,9 @@ diff -urN linux-2.6.19/net/ipv4/netfilter/Kconfig linux-2.6.19+imq/net/ipv4/netf config IP_NF_TARGET_TOS tristate "TOS target support" depends on IP_NF_MANGLE -diff -urN linux-2.6.19/net/ipv4/netfilter/Makefile linux-2.6.19+imq/net/ipv4/netfilter/Makefile ---- linux-2.6.19/net/ipv4/netfilter/Makefile 2006-12-01 14:05:45.000000000 +1030 -+++ linux-2.6.19+imq/net/ipv4/netfilter/Makefile 2006-12-04 12:41:01.000000000 +1030 -@@ -67,6 +67,7 @@ +--- linux-2.6.20-original/net/ipv4/netfilter/Makefile 2007-02-04 20:44:54.000000000 +0200 ++++ linux-2.6.20/net/ipv4/netfilter/Makefile 2007-02-12 23:55:04.000000000 +0200 +@@ -96,6 +96,7 @@ obj-$(CONFIG_IP_NF_TARGET_REJECT) += ipt_REJECT.o obj-$(CONFIG_IP_NF_TARGET_TOS) += ipt_TOS.o obj-$(CONFIG_IP_NF_TARGET_ECN) += ipt_ECN.o @@ -757,9 +745,8 @@ diff -urN linux-2.6.19/net/ipv4/netfilter/Makefile linux-2.6.19+imq/net/ipv4/net obj-$(CONFIG_IP_NF_TARGET_MASQUERADE) += ipt_MASQUERADE.o obj-$(CONFIG_IP_NF_TARGET_REDIRECT) += ipt_REDIRECT.o obj-$(CONFIG_IP_NF_TARGET_NETMAP) += ipt_NETMAP.o -diff -urN linux-2.6.19/net/ipv6/netfilter/ip6t_IMQ.c linux-2.6.19+imq/net/ipv6/netfilter/ip6t_IMQ.c ---- linux-2.6.19/net/ipv6/netfilter/ip6t_IMQ.c 1970-01-01 09:30:00.000000000 +0930 -+++ linux-2.6.19.2/net/ipv6/netfilter/ip6t_IMQ.c 2007-01-25 10:06:41.000000000 +0100 +--- linux-2.6.20-original/net/ipv6/netfilter/ip6t_IMQ.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux-2.6.20/net/ipv6/netfilter/ip6t_IMQ.c 2007-02-12 23:55:04.000000000 +0200 @@ -0,0 +1,71 @@ +/* + * This target marks packets to be enqueued to an imq device @@ -832,10 +819,9 @@ diff -urN linux-2.6.19/net/ipv6/netfilter/ip6t_IMQ.c linux-2.6.19+imq/net/ipv6/n +MODULE_AUTHOR("http://www.linuximq.net"); +MODULE_DESCRIPTION("Pseudo-driver for the intermediate queue device. See http://www.linuximq.net/ for more information."); +MODULE_LICENSE("GPL"); -diff -urN linux-2.6.19/net/ipv6/netfilter/Kconfig linux-2.6.19+imq/net/ipv6/netfilter/Kconfig ---- linux-2.6.19/net/ipv6/netfilter/Kconfig 2006-12-01 14:05:46.000000000 +1030 -+++ linux-2.6.19+imq/net/ipv6/netfilter/Kconfig 2006-12-04 12:41:01.000000000 +1030 -@@ -163,6 +163,15 @@ +--- linux-2.6.20-original/net/ipv6/netfilter/Kconfig 2007-02-04 20:44:54.000000000 +0200 ++++ linux-2.6.20/net/ipv6/netfilter/Kconfig 2007-02-12 23:55:04.000000000 +0200 +@@ -164,6 +164,15 @@ To compile it as a module, choose M here. If unsure, say N. @@ -851,9 +837,8 @@ diff -urN linux-2.6.19/net/ipv6/netfilter/Kconfig linux-2.6.19+imq/net/ipv6/netf config IP6_NF_TARGET_HL tristate 'HL (hoplimit) target support' depends on IP6_NF_MANGLE -diff -urN linux-2.6.19/net/ipv6/netfilter/Makefile linux-2.6.19+imq/net/ipv6/netfilter/Makefile ---- linux-2.6.19/net/ipv6/netfilter/Makefile 2006-12-01 14:05:46.000000000 +1030 -+++ linux-2.6.19+imq/net/ipv6/netfilter/Makefile 2006-12-04 12:41:01.000000000 +1030 +--- linux-2.6.20-original/net/ipv6/netfilter/Makefile 2007-02-04 20:44:54.000000000 +0200 ++++ linux-2.6.20/net/ipv6/netfilter/Makefile 2007-02-12 23:55:04.000000000 +0200 @@ -13,6 +13,7 @@ obj-$(CONFIG_IP6_NF_MATCH_OWNER) += ip6t_owner.o obj-$(CONFIG_IP6_NF_FILTER) += ip6table_filter.o @@ -862,9 +847,8 @@ diff -urN linux-2.6.19/net/ipv6/netfilter/Makefile linux-2.6.19+imq/net/ipv6/net obj-$(CONFIG_IP6_NF_TARGET_HL) += ip6t_HL.o obj-$(CONFIG_IP6_NF_QUEUE) += ip6_queue.o obj-$(CONFIG_IP6_NF_TARGET_LOG) += ip6t_LOG.o -diff -urN linux-2.6.19/net/sched/sch_generic.c linux-2.6.19+imq/net/sched/sch_generic.c ---- linux-2.6.19/net/sched/sch_generic.c 2006-12-01 14:05:46.000000000 +1030 -+++ linux-2.6.19+imq/net/sched/sch_generic.c 2006-12-05 23:08:54.000000000 +1030 +--- linux-2.6.20-original/net/sched/sch_generic.c 2007-02-04 20:44:54.000000000 +0200 ++++ linux-2.6.20/net/sched/sch_generic.c 2007-02-12 23:55:04.000000000 +0200 @@ -87,7 +87,6 @@ NOTE: Called under dev->queue_lock with locally disabled BH. diff --git a/target/linux/generic-2.6/patches/160-netfilter_route.patch b/target/linux/generic-2.6/patches/160-netfilter_route.patch index 7e8491c3e3..0d73ba3193 100644 --- a/target/linux/generic-2.6/patches/160-netfilter_route.patch +++ b/target/linux/generic-2.6/patches/160-netfilter_route.patch @@ -1,6 +1,6 @@ -diff -urN linux-2.6.19.old/include/linux/netfilter_ipv4/ipt_ROUTE.h linux-2.6.19.dev/include/linux/netfilter_ipv4/ipt_ROUTE.h ---- linux-2.6.19.old/include/linux/netfilter_ipv4/ipt_ROUTE.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.19.dev/include/linux/netfilter_ipv4/ipt_ROUTE.h 2006-12-14 03:13:49.000000000 +0100 +diff -Nur linux-2.6.21.1/include/linux/netfilter_ipv4/ipt_ROUTE.h linux-2.6.21.1-owrt/include/linux/netfilter_ipv4/ipt_ROUTE.h +--- linux-2.6.21.1/include/linux/netfilter_ipv4/ipt_ROUTE.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/include/linux/netfilter_ipv4/ipt_ROUTE.h 2007-05-23 20:32:22.000000000 +0200 @@ -0,0 +1,23 @@ +/* Header file for iptables ipt_ROUTE target + * @@ -14,10 +14,10 @@ diff -urN linux-2.6.19.old/include/linux/netfilter_ipv4/ipt_ROUTE.h linux-2.6.19 +#define IPT_ROUTE_IFNAMSIZ 16 + +struct ipt_route_target_info { -+ char oif[IPT_ROUTE_IFNAMSIZ]; /* Output Interface Name */ -+ char iif[IPT_ROUTE_IFNAMSIZ]; /* Input Interface Name */ -+ u_int32_t gw; /* IP address of gateway */ -+ u_int8_t flags; ++ char oif[IPT_ROUTE_IFNAMSIZ]; /* Output Interface Name */ ++ char iif[IPT_ROUTE_IFNAMSIZ]; /* Input Interface Name */ ++ u_int32_t gw; /* IP address of gateway */ ++ u_int8_t flags; +}; + +/* Values for "flags" field */ @@ -25,9 +25,9 @@ diff -urN linux-2.6.19.old/include/linux/netfilter_ipv4/ipt_ROUTE.h linux-2.6.19 +#define IPT_ROUTE_TEE 0x02 + +#endif /*_IPT_ROUTE_H_target*/ -diff -urN linux-2.6.19.old/include/linux/netfilter_ipv6/ip6t_ROUTE.h linux-2.6.19.dev/include/linux/netfilter_ipv6/ip6t_ROUTE.h ---- linux-2.6.19.old/include/linux/netfilter_ipv6/ip6t_ROUTE.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.19.dev/include/linux/netfilter_ipv6/ip6t_ROUTE.h 2006-12-14 03:13:49.000000000 +0100 +diff -Nur linux-2.6.21.1/include/linux/netfilter_ipv6/ip6t_ROUTE.h linux-2.6.21.1-owrt/include/linux/netfilter_ipv6/ip6t_ROUTE.h +--- linux-2.6.21.1/include/linux/netfilter_ipv6/ip6t_ROUTE.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/include/linux/netfilter_ipv6/ip6t_ROUTE.h 2007-05-23 20:32:22.000000000 +0200 @@ -0,0 +1,23 @@ +/* Header file for iptables ip6t_ROUTE target + * @@ -41,10 +41,10 @@ diff -urN linux-2.6.19.old/include/linux/netfilter_ipv6/ip6t_ROUTE.h linux-2.6.1 +#define IP6T_ROUTE_IFNAMSIZ 16 + +struct ip6t_route_target_info { -+ char oif[IP6T_ROUTE_IFNAMSIZ]; /* Output Interface Name */ -+ char iif[IP6T_ROUTE_IFNAMSIZ]; /* Input Interface Name */ -+ u_int32_t gw[4]; /* IPv6 address of gateway */ -+ u_int8_t flags; ++ char oif[IP6T_ROUTE_IFNAMSIZ]; /* Output Interface Name */ ++ char iif[IP6T_ROUTE_IFNAMSIZ]; /* Input Interface Name */ ++ u_int32_t gw[4]; /* IPv6 address of gateway */ ++ u_int8_t flags; +}; + +/* Values for "flags" field */ @@ -52,10 +52,10 @@ diff -urN linux-2.6.19.old/include/linux/netfilter_ipv6/ip6t_ROUTE.h linux-2.6.1 +#define IP6T_ROUTE_TEE 0x02 + +#endif /*_IP6T_ROUTE_H_target*/ -diff -urN linux-2.6.19.old/net/ipv4/netfilter/ipt_ROUTE.c linux-2.6.19.dev/net/ipv4/netfilter/ipt_ROUTE.c ---- linux-2.6.19.old/net/ipv4/netfilter/ipt_ROUTE.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.19.dev/net/ipv4/netfilter/ipt_ROUTE.c 2006-12-14 03:13:49.000000000 +0100 -@@ -0,0 +1,455 @@ +diff -Nur linux-2.6.21.1/net/ipv4/netfilter/ipt_ROUTE.c linux-2.6.21.1-owrt/net/ipv4/netfilter/ipt_ROUTE.c +--- linux-2.6.21.1/net/ipv4/netfilter/ipt_ROUTE.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/net/ipv4/netfilter/ipt_ROUTE.c 2007-05-23 20:32:22.000000000 +0200 +@@ -0,0 +1,483 @@ +/* + * This implements the ROUTE target, which enables you to setup unusual + * routes not supported by the standard kernel routing table. @@ -75,6 +75,7 @@ diff -urN linux-2.6.19.old/net/ipv4/netfilter/ipt_ROUTE.c linux-2.6.19.dev/net/i +#include +#include +#include ++#include +#include +#include +#include @@ -93,73 +94,73 @@ diff -urN linux-2.6.19.old/net/ipv4/netfilter/ipt_ROUTE.c linux-2.6.19.dev/net/i + +/* Try to route the packet according to the routing keys specified in + * route_info. Keys are : -+ * - ifindex : -+ * 0 if no oif preferred, ++ * - ifindex : ++ * 0 if no oif preferred, + * otherwise set to the index of the desired oif + * - route_info->gw : + * 0 if no gateway specified, + * otherwise set to the next host to which the pkt must be routed -+ * If success, skb->dev is the output device to which the packet must ++ * If success, skb->dev is the output device to which the packet must + * be sent and skb->dst is not NULL + * + * RETURN: -1 if an error occured -+ * 1 if the packet was succesfully routed to the ++ * 1 if the packet was succesfully routed to the + * destination desired + * 0 if the kernel routing table could not route the packet + * according to the keys specified + */ +static int route(struct sk_buff *skb, -+ unsigned int ifindex, -+ const struct ipt_route_target_info *route_info) ++ unsigned int ifindex, ++ const struct ipt_route_target_info *route_info) +{ -+ int err; -+ struct rtable *rt; -+ struct iphdr *iph = skb->nh.iph; -+ struct flowi fl = { -+ .oif = ifindex, -+ .nl_u = { -+ .ip4_u = { -+ .daddr = iph->daddr, -+ .saddr = 0, -+ .tos = RT_TOS(iph->tos), -+ .scope = RT_SCOPE_UNIVERSE, -+ } -+ } -+ }; -+ -+ /* The destination address may be overloaded by the target */ -+ if (route_info->gw) -+ fl.fl4_dst = route_info->gw; -+ -+ /* Trying to route the packet using the standard routing table. */ -+ if ((err = ip_route_output_key(&rt, &fl))) { -+ if (net_ratelimit()) -+ DEBUGP("ipt_ROUTE: couldn't route pkt (err: %i)",err); -+ return -1; -+ } -+ -+ /* Drop old route. */ -+ dst_release(skb->dst); -+ skb->dst = NULL; -+ -+ /* Success if no oif specified or if the oif correspond to the -+ * one desired */ -+ if (!ifindex || rt->u.dst.dev->ifindex == ifindex) { -+ skb->dst = &rt->u.dst; -+ skb->dev = skb->dst->dev; -+ skb->protocol = htons(ETH_P_IP); -+ return 1; -+ } -+ -+ /* The interface selected by the routing table is not the one -+ * specified by the user. This may happen because the dst address -+ * is one of our own addresses. -+ */ -+ if (net_ratelimit()) -+ DEBUGP("ipt_ROUTE: failed to route as desired gw=%u.%u.%u.%u oif=%i (got oif=%i)\n", -+ NIPQUAD(route_info->gw), ifindex, rt->u.dst.dev->ifindex); -+ -+ return 0; ++ int err; ++ struct rtable *rt; ++ struct iphdr *iph = skb->nh.iph; ++ struct flowi fl = { ++ .oif = ifindex, ++ .nl_u = { ++ .ip4_u = { ++ .daddr = iph->daddr, ++ .saddr = 0, ++ .tos = RT_TOS(iph->tos), ++ .scope = RT_SCOPE_UNIVERSE, ++ } ++ } ++ }; ++ ++ /* The destination address may be overloaded by the target */ ++ if (route_info->gw) ++ fl.fl4_dst = route_info->gw; ++ ++ /* Trying to route the packet using the standard routing table. */ ++ if ((err = ip_route_output_key(&rt, &fl))) { ++ if (net_ratelimit()) ++ DEBUGP("ipt_ROUTE: couldn't route pkt (err: %i)",err); ++ return -1; ++ } ++ ++ /* Drop old route. */ ++ dst_release(skb->dst); ++ skb->dst = NULL; ++ ++ /* Success if no oif specified or if the oif correspond to the ++ * one desired */ ++ if (!ifindex || rt->u.dst.dev->ifindex == ifindex) { ++ skb->dst = &rt->u.dst; ++ skb->dev = skb->dst->dev; ++ skb->protocol = htons(ETH_P_IP); ++ return 1; ++ } ++ ++ /* The interface selected by the routing table is not the one ++ * specified by the user. This may happen because the dst address ++ * is one of our own addresses. ++ */ ++ if (net_ratelimit()) ++ DEBUGP("ipt_ROUTE: failed to route as desired gw=%u.%u.%u.%u oif=%i (got oif=%i)\n", ++ NIPQUAD(route_info->gw), ifindex, rt->u.dst.dev->ifindex); ++ ++ return 0; +} + + @@ -171,158 +172,158 @@ diff -urN linux-2.6.19.old/net/ipv4/netfilter/ipt_ROUTE.c linux-2.6.19.dev/net/i + */ +static void ip_direct_send(struct sk_buff *skb) +{ -+ struct dst_entry *dst = skb->dst; -+ struct hh_cache *hh = dst->hh; -+ struct net_device *dev = dst->dev; -+ int hh_len = LL_RESERVED_SPACE(dev); -+ -+ /* Be paranoid, rather than too clever. */ -+ if (unlikely(skb_headroom(skb) < hh_len && dev->hard_header)) { -+ struct sk_buff *skb2; -+ -+ skb2 = skb_realloc_headroom(skb, LL_RESERVED_SPACE(dev)); -+ if (skb2 == NULL) { -+ kfree_skb(skb); -+ return; -+ } -+ if (skb->sk) -+ skb_set_owner_w(skb2, skb->sk); -+ kfree_skb(skb); -+ skb = skb2; -+ } -+ -+ if (hh) { -+ int hh_alen; -+ -+ read_lock_bh(&hh->hh_lock); -+ hh_alen = HH_DATA_ALIGN(hh->hh_len); -+ memcpy(skb->data - hh_alen, hh->hh_data, hh_alen); -+ read_unlock_bh(&hh->hh_lock); -+ skb_push(skb, hh->hh_len); -+ hh->hh_output(skb); -+ } else if (dst->neighbour) -+ dst->neighbour->output(skb); -+ else { -+ if (net_ratelimit()) -+ DEBUGP(KERN_DEBUG "ipt_ROUTE: no hdr & no neighbour cache!\n"); -+ kfree_skb(skb); -+ } ++ struct dst_entry *dst = skb->dst; ++ struct hh_cache *hh = dst->hh; ++ struct net_device *dev = dst->dev; ++ int hh_len = LL_RESERVED_SPACE(dev); ++ ++ /* Be paranoid, rather than too clever. */ ++ if (unlikely(skb_headroom(skb) < hh_len && dev->hard_header)) { ++ struct sk_buff *skb2; ++ ++ skb2 = skb_realloc_headroom(skb, LL_RESERVED_SPACE(dev)); ++ if (skb2 == NULL) { ++ kfree_skb(skb); ++ return; ++ } ++ if (skb->sk) ++ skb_set_owner_w(skb2, skb->sk); ++ kfree_skb(skb); ++ skb = skb2; ++ } ++ ++ if (hh) { ++ int hh_alen; ++ ++ read_lock_bh(&hh->hh_lock); ++ hh_alen = HH_DATA_ALIGN(hh->hh_len); ++ memcpy(skb->data - hh_alen, hh->hh_data, hh_alen); ++ read_unlock_bh(&hh->hh_lock); ++ skb_push(skb, hh->hh_len); ++ hh->hh_output(skb); ++ } else if (dst->neighbour) ++ dst->neighbour->output(skb); ++ else { ++ if (net_ratelimit()) ++ DEBUGP(KERN_DEBUG "ipt_ROUTE: no hdr & no neighbour cache!\n"); ++ kfree_skb(skb); ++ } +} + + +/* PRE : skb->dev is set to the device we are leaving by -+ * POST: - the packet is directly sent to the skb->dev device, without ++ * POST: - the packet is directly sent to the skb->dev device, without + * pushing the link layer header. + * - the packet is destroyed + */ +static inline int dev_direct_send(struct sk_buff *skb) +{ -+ return dev_queue_xmit(skb); ++ return dev_queue_xmit(skb); +} + + +static unsigned int route_oif(const struct ipt_route_target_info *route_info, -+ struct sk_buff *skb) ++ struct sk_buff *skb) +{ -+ unsigned int ifindex = 0; -+ struct net_device *dev_out = NULL; -+ -+ /* The user set the interface name to use. -+ * Getting the current interface index. -+ */ -+ if ((dev_out = dev_get_by_name(route_info->oif))) { -+ ifindex = dev_out->ifindex; -+ } else { -+ /* Unknown interface name : packet dropped */ -+ if (net_ratelimit()) -+ DEBUGP("ipt_ROUTE: oif interface %s not found\n", route_info->oif); -+ return NF_DROP; -+ } -+ -+ /* Trying the standard way of routing packets */ -+ switch (route(skb, ifindex, route_info)) { -+ case 1: -+ dev_put(dev_out); -+ if (route_info->flags & IPT_ROUTE_CONTINUE) -+ return IPT_CONTINUE; -+ -+ ip_direct_send(skb); -+ return NF_STOLEN; -+ -+ case 0: -+ /* Failed to send to oif. Trying the hard way */ -+ if (route_info->flags & IPT_ROUTE_CONTINUE) -+ return NF_DROP; -+ -+ if (net_ratelimit()) -+ DEBUGP("ipt_ROUTE: forcing the use of %i\n", -+ ifindex); -+ -+ /* We have to force the use of an interface. -+ * This interface must be a tunnel interface since -+ * otherwise we can't guess the hw address for -+ * the packet. For a tunnel interface, no hw address -+ * is needed. -+ */ -+ if ((dev_out->type != ARPHRD_TUNNEL) -+ && (dev_out->type != ARPHRD_IPGRE)) { -+ if (net_ratelimit()) -+ DEBUGP("ipt_ROUTE: can't guess the hw addr !\n"); -+ dev_put(dev_out); -+ return NF_DROP; -+ } -+ -+ /* Send the packet. This will also free skb -+ * Do not go through the POST_ROUTING hook because -+ * skb->dst is not set and because it will probably -+ * get confused by the destination IP address. -+ */ -+ skb->dev = dev_out; -+ dev_direct_send(skb); -+ dev_put(dev_out); -+ return NF_STOLEN; -+ -+ default: -+ /* Unexpected error */ -+ dev_put(dev_out); -+ return NF_DROP; -+ } ++ unsigned int ifindex = 0; ++ struct net_device *dev_out = NULL; ++ ++ /* The user set the interface name to use. ++ * Getting the current interface index. ++ */ ++ if ((dev_out = dev_get_by_name(route_info->oif))) { ++ ifindex = dev_out->ifindex; ++ } else { ++ /* Unknown interface name : packet dropped */ ++ if (net_ratelimit()) ++ DEBUGP("ipt_ROUTE: oif interface %s not found\n", route_info->oif); ++ return NF_DROP; ++ } ++ ++ /* Trying the standard way of routing packets */ ++ switch (route(skb, ifindex, route_info)) { ++ case 1: ++ dev_put(dev_out); ++ if (route_info->flags & IPT_ROUTE_CONTINUE) ++ return IPT_CONTINUE; ++ ++ ip_direct_send(skb); ++ return NF_STOLEN; ++ ++ case 0: ++ /* Failed to send to oif. Trying the hard way */ ++ if (route_info->flags & IPT_ROUTE_CONTINUE) ++ return NF_DROP; ++ ++ if (net_ratelimit()) ++ DEBUGP("ipt_ROUTE: forcing the use of %i\n", ++ ifindex); ++ ++ /* We have to force the use of an interface. ++ * This interface must be a tunnel interface since ++ * otherwise we can't guess the hw address for ++ * the packet. For a tunnel interface, no hw address ++ * is needed. ++ */ ++ if ((dev_out->type != ARPHRD_TUNNEL) ++ && (dev_out->type != ARPHRD_IPGRE)) { ++ if (net_ratelimit()) ++ DEBUGP("ipt_ROUTE: can't guess the hw addr !\n"); ++ dev_put(dev_out); ++ return NF_DROP; ++ } ++ ++ /* Send the packet. This will also free skb ++ * Do not go through the POST_ROUTING hook because ++ * skb->dst is not set and because it will probably ++ * get confused by the destination IP address. ++ */ ++ skb->dev = dev_out; ++ dev_direct_send(skb); ++ dev_put(dev_out); ++ return NF_STOLEN; ++ ++ default: ++ /* Unexpected error */ ++ dev_put(dev_out); ++ return NF_DROP; ++ } +} + + +static unsigned int route_iif(const struct ipt_route_target_info *route_info, -+ struct sk_buff *skb) ++ struct sk_buff *skb) +{ -+ struct net_device *dev_in = NULL; -+ -+ /* Getting the current interface index. */ -+ if (!(dev_in = dev_get_by_name(route_info->iif))) { -+ if (net_ratelimit()) -+ DEBUGP("ipt_ROUTE: iif interface %s not found\n", route_info->iif); -+ return NF_DROP; -+ } -+ -+ skb->dev = dev_in; -+ dst_release(skb->dst); -+ skb->dst = NULL; -+ -+ netif_rx(skb); -+ dev_put(dev_in); -+ return NF_STOLEN; ++ struct net_device *dev_in = NULL; ++ ++ /* Getting the current interface index. */ ++ if (!(dev_in = dev_get_by_name(route_info->iif))) { ++ if (net_ratelimit()) ++ DEBUGP("ipt_ROUTE: iif interface %s not found\n", route_info->iif); ++ return NF_DROP; ++ } ++ ++ skb->dev = dev_in; ++ dst_release(skb->dst); ++ skb->dst = NULL; ++ ++ netif_rx(skb); ++ dev_put(dev_in); ++ return NF_STOLEN; +} + + +static unsigned int route_gw(const struct ipt_route_target_info *route_info, -+ struct sk_buff *skb) ++ struct sk_buff *skb) +{ -+ if (route(skb, 0, route_info)!=1) -+ return NF_DROP; ++ if (route(skb, 0, route_info)!=1) ++ return NF_DROP; + -+ if (route_info->flags & IPT_ROUTE_CONTINUE) -+ return IPT_CONTINUE; ++ if (route_info->flags & IPT_ROUTE_CONTINUE) ++ return IPT_CONTINUE; + -+ ip_direct_send(skb); -+ return NF_STOLEN; ++ ip_direct_send(skb); ++ return NF_STOLEN; +} + + @@ -335,224 +336,250 @@ diff -urN linux-2.6.19.old/net/ipv4/netfilter/ipt_ROUTE.c linux-2.6.19.dev/net/i +static struct ip_conntrack route_tee_track; + +static unsigned int ipt_route_target(struct sk_buff **pskb, -+ const struct net_device *in, -+ const struct net_device *out, -+ unsigned int hooknum, -+ const struct xt_target *target, -+ const void *targinfo) ++ const struct net_device *in, ++ const struct net_device *out, ++ unsigned int hooknum, ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17) ++ const struct xt_target *target, ++#endif ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) ++ const void *targinfo, ++ void *userinfo) ++#else ++ const void *targinfo) ++#endif +{ -+ const struct ipt_route_target_info *route_info = targinfo; -+ struct sk_buff *skb = *pskb; -+ unsigned int res; -+ -+ if (skb->nfct == &route_tee_track.ct_general) { -+ /* Loopback - a packet we already routed, is to be -+ * routed another time. Avoid that, now. -+ */ -+ if (net_ratelimit()) -+ DEBUGP(KERN_DEBUG "ipt_ROUTE: loopback - DROP!\n"); -+ return NF_DROP; -+ } -+ -+ /* If we are at PREROUTING or INPUT hook -+ * the TTL isn't decreased by the IP stack -+ */ -+ if (hooknum == NF_IP_PRE_ROUTING || -+ hooknum == NF_IP_LOCAL_IN) { -+ -+ struct iphdr *iph = skb->nh.iph; -+ -+ if (iph->ttl <= 1) { -+ struct rtable *rt; -+ struct flowi fl = { -+ .oif = 0, -+ .nl_u = { -+ .ip4_u = { -+ .daddr = iph->daddr, -+ .saddr = iph->saddr, -+ .tos = RT_TOS(iph->tos), -+ .scope = ((iph->tos & RTO_ONLINK) ? -+ RT_SCOPE_LINK : -+ RT_SCOPE_UNIVERSE) -+ } -+ } -+ }; -+ -+ if (ip_route_output_key(&rt, &fl)) { -+ return NF_DROP; -+ } -+ -+ if (skb->dev == rt->u.dst.dev) { -+ /* Drop old route. */ -+ dst_release(skb->dst); -+ skb->dst = &rt->u.dst; -+ -+ /* this will traverse normal stack, and -+ * thus call conntrack on the icmp packet */ -+ icmp_send(skb, ICMP_TIME_EXCEEDED, -+ ICMP_EXC_TTL, 0); -+ } -+ -+ return NF_DROP; -+ } -+ -+ /* -+ * If we are at INPUT the checksum must be recalculated since -+ * the length could change as the result of a defragmentation. -+ */ -+ if(hooknum == NF_IP_LOCAL_IN) { -+ iph->ttl = iph->ttl - 1; -+ iph->check = 0; -+ iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl); -+ } else { -+ ip_decrease_ttl(iph); -+ } -+ } -+ -+ if ((route_info->flags & IPT_ROUTE_TEE)) { -+ /* -+ * Copy the *pskb, and route the copy. Will later return -+ * IPT_CONTINUE for the original skb, which should continue -+ * on its way as if nothing happened. The copy should be -+ * independantly delivered to the ROUTE --gw. -+ */ -+ skb = skb_copy(*pskb, GFP_ATOMIC); -+ if (!skb) { -+ if (net_ratelimit()) -+ DEBUGP(KERN_DEBUG "ipt_ROUTE: copy failed!\n"); -+ return IPT_CONTINUE; -+ } -+ } -+ -+ /* Tell conntrack to forget this packet since it may get confused -+ * when a packet is leaving with dst address == our address. -+ * Good idea ? Dunno. Need advice. -+ * -+ * NEW: mark the skb with our &route_tee_track, so we avoid looping -+ * on any already routed packet. -+ */ -+ if (!(route_info->flags & IPT_ROUTE_CONTINUE)) { -+ nf_conntrack_put(skb->nfct); -+ skb->nfct = &route_tee_track.ct_general; -+ skb->nfctinfo = IP_CT_NEW; -+ nf_conntrack_get(skb->nfct); -+ } -+ -+ if (route_info->oif[0] != '\0') { -+ res = route_oif(route_info, skb); -+ } else if (route_info->iif[0] != '\0') { -+ res = route_iif(route_info, skb); -+ } else if (route_info->gw) { -+ res = route_gw(route_info, skb); -+ } else { -+ if (net_ratelimit()) -+ DEBUGP(KERN_DEBUG "ipt_ROUTE: no parameter !\n"); -+ res = IPT_CONTINUE; -+ } -+ -+ if ((route_info->flags & IPT_ROUTE_TEE)) -+ res = IPT_CONTINUE; -+ -+ return res; ++ const struct ipt_route_target_info *route_info = targinfo; ++ struct sk_buff *skb = *pskb; ++ unsigned int res; ++ ++ if (skb->nfct == &route_tee_track.ct_general) { ++ /* Loopback - a packet we already routed, is to be ++ * routed another time. Avoid that, now. ++ */ ++ if (net_ratelimit()) ++ DEBUGP(KERN_DEBUG "ipt_ROUTE: loopback - DROP!\n"); ++ return NF_DROP; ++ } ++ ++ /* If we are at PREROUTING or INPUT hook ++ * the TTL isn't decreased by the IP stack ++ */ ++ if (hooknum == NF_IP_PRE_ROUTING || ++ hooknum == NF_IP_LOCAL_IN) { ++ ++ struct iphdr *iph = skb->nh.iph; ++ ++ if (iph->ttl <= 1) { ++ struct rtable *rt; ++ struct flowi fl = { ++ .oif = 0, ++ .nl_u = { ++ .ip4_u = { ++ .daddr = iph->daddr, ++ .saddr = iph->saddr, ++ .tos = RT_TOS(iph->tos), ++ .scope = ((iph->tos & RTO_ONLINK) ? ++ RT_SCOPE_LINK : ++ RT_SCOPE_UNIVERSE) ++ } ++ } ++ }; ++ ++ if (ip_route_output_key(&rt, &fl)) { ++ return NF_DROP; ++ } ++ ++ if (skb->dev == rt->u.dst.dev) { ++ /* Drop old route. */ ++ dst_release(skb->dst); ++ skb->dst = &rt->u.dst; ++ ++ /* this will traverse normal stack, and ++ * thus call conntrack on the icmp packet */ ++ icmp_send(skb, ICMP_TIME_EXCEEDED, ++ ICMP_EXC_TTL, 0); ++ } ++ ++ return NF_DROP; ++ } ++ ++ /* ++ * If we are at INPUT the checksum must be recalculated since ++ * the length could change as the result of a defragmentation. ++ */ ++ if(hooknum == NF_IP_LOCAL_IN) { ++ iph->ttl = iph->ttl - 1; ++ iph->check = 0; ++ iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl); ++ } else { ++ ip_decrease_ttl(iph); ++ } ++ } ++ ++ if ((route_info->flags & IPT_ROUTE_TEE)) { ++ /* ++ * Copy the *pskb, and route the copy. Will later return ++ * IPT_CONTINUE for the original skb, which should continue ++ * on its way as if nothing happened. The copy should be ++ * independantly delivered to the ROUTE --gw. ++ */ ++ skb = skb_copy(*pskb, GFP_ATOMIC); ++ if (!skb) { ++ if (net_ratelimit()) ++ DEBUGP(KERN_DEBUG "ipt_ROUTE: copy failed!\n"); ++ return IPT_CONTINUE; ++ } ++ } ++ ++ /* Tell conntrack to forget this packet since it may get confused ++ * when a packet is leaving with dst address == our address. ++ * Good idea ? Dunno. Need advice. ++ * ++ * NEW: mark the skb with our &route_tee_track, so we avoid looping ++ * on any already routed packet. ++ */ ++ if (!(route_info->flags & IPT_ROUTE_CONTINUE)) { ++ nf_conntrack_put(skb->nfct); ++ skb->nfct = &route_tee_track.ct_general; ++ skb->nfctinfo = IP_CT_NEW; ++ nf_conntrack_get(skb->nfct); ++ } ++ ++ if (route_info->oif[0] != '\0') { ++ res = route_oif(route_info, skb); ++ } else if (route_info->iif[0] != '\0') { ++ res = route_iif(route_info, skb); ++ } else if (route_info->gw) { ++ res = route_gw(route_info, skb); ++ } else { ++ if (net_ratelimit()) ++ DEBUGP(KERN_DEBUG "ipt_ROUTE: no parameter !\n"); ++ res = IPT_CONTINUE; ++ } ++ ++ if ((route_info->flags & IPT_ROUTE_TEE)) ++ res = IPT_CONTINUE; ++ ++ return res; +} + + +static int ipt_route_checkentry(const char *tablename, -+ const void *e, -+ const struct xt_target *target, -+ void *targinfo, -+ unsigned int hook_mask) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ const void *e, ++#else ++ const struct ipt_ip *ip, ++#endif ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17) ++ const struct xt_target *target, ++#endif ++ void *targinfo, ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) ++ unsigned int targinfosize, ++#endif ++ unsigned int hook_mask) +{ -+ if (strcmp(tablename, "mangle") != 0) { -+ printk("ipt_ROUTE: bad table `%s', use the `mangle' table.\n", -+ tablename); -+ return 0; -+ } -+ -+ if (hook_mask & ~( (1 << NF_IP_PRE_ROUTING) -+ | (1 << NF_IP_LOCAL_IN) -+ | (1 << NF_IP_FORWARD) -+ | (1 << NF_IP_LOCAL_OUT) -+ | (1 << NF_IP_POST_ROUTING))) { -+ printk("ipt_ROUTE: bad hook\n"); -+ return 0; -+ } -+ -+ return 1; ++ if (strcmp(tablename, "mangle") != 0) { ++ printk("ipt_ROUTE: bad table `%s', use the `mangle' table.\n", ++ tablename); ++ return 0; ++ } ++ ++ if (hook_mask & ~( (1 << NF_IP_PRE_ROUTING) ++ | (1 << NF_IP_LOCAL_IN) ++ | (1 << NF_IP_FORWARD) ++ | (1 << NF_IP_LOCAL_OUT) ++ | (1 << NF_IP_POST_ROUTING))) { ++ printk("ipt_ROUTE: bad hook\n"); ++ return 0; ++ } ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) ++ if (targinfosize != IPT_ALIGN(sizeof(struct ipt_route_target_info))) { ++ printk(KERN_WARNING "ipt_ROUTE: targinfosize %u != %Zu\n", ++ targinfosize, ++ IPT_ALIGN(sizeof(struct ipt_route_target_info))); ++ return 0; ++ } ++#endif ++ ++ return 1; +} + + -+static struct ipt_target ipt_route_reg = { -+ .name = "ROUTE", -+ .target = ipt_route_target, -+ .targetsize = sizeof(struct ipt_route_target_info), -+ .checkentry = ipt_route_checkentry, -+ .me = THIS_MODULE, ++static struct ipt_target ipt_route_reg = { ++ .name = "ROUTE", ++ .target = ipt_route_target, ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17) ++ .targetsize = sizeof(struct ipt_route_target_info), ++#endif ++ .checkentry = ipt_route_checkentry, ++ .me = THIS_MODULE, +}; + +static int __init init(void) +{ -+ /* Set up fake conntrack (stolen from raw.patch): -+ - to never be deleted, not in any hashes */ -+ atomic_set(&route_tee_track.ct_general.use, 1); -+ /* - and look it like as a confirmed connection */ -+ set_bit(IPS_CONFIRMED_BIT, &route_tee_track.status); -+ /* Initialize fake conntrack so that NAT will skip it */ -+ route_tee_track.status |= IPS_NAT_DONE_MASK; -+ -+ return ipt_register_target(&ipt_route_reg); ++ /* Set up fake conntrack (stolen from raw.patch): ++ - to never be deleted, not in any hashes */ ++ atomic_set(&route_tee_track.ct_general.use, 1); ++ /* - and look it like as a confirmed connection */ ++ set_bit(IPS_CONFIRMED_BIT, &route_tee_track.status); ++ /* Initialize fake conntrack so that NAT will skip it */ ++ route_tee_track.status |= IPS_NAT_DONE_MASK; ++ ++ return xt_register_target(&ipt_route_reg); +} + + +static void __exit fini(void) +{ -+ ipt_unregister_target(&ipt_route_reg); ++ xt_unregister_target(&ipt_route_reg); +} + +module_init(init); +module_exit(fini); -diff -urN linux-2.6.19.old/net/ipv4/netfilter/Kconfig linux-2.6.19.dev/net/ipv4/netfilter/Kconfig ---- linux-2.6.19.old/net/ipv4/netfilter/Kconfig 2006-12-14 03:13:49.000000000 +0100 -+++ linux-2.6.19.dev/net/ipv4/netfilter/Kconfig 2006-12-14 03:13:49.000000000 +0100 -@@ -494,6 +494,23 @@ - - To compile it as a module, choose M here. If unsure, say N. +diff -Nur linux-2.6.21.1/net/ipv4/netfilter/Kconfig linux-2.6.21.1-owrt/net/ipv4/netfilter/Kconfig +--- linux-2.6.21.1/net/ipv4/netfilter/Kconfig 2007-04-27 23:49:26.000000000 +0200 ++++ linux-2.6.21.1-owrt/net/ipv4/netfilter/Kconfig 2007-05-23 20:32:22.000000000 +0200 +@@ -657,5 +657,22 @@ + Allows altering the ARP packet payload: source and destination + hardware and network addresses. +config IP_NF_TARGET_ROUTE -+ tristate 'ROUTE target support' -+ depends on IP_NF_MANGLE -+ help -+ This option adds a `ROUTE' target, which enables you to setup unusual -+ routes. For example, the ROUTE lets you route a received packet through -+ an interface or towards a host, even if the regular destination of the -+ packet is the router itself. The ROUTE target is also able to change the -+ incoming interface of a packet. -+ -+ The target can be or not a final target. It has to be used inside the -+ mangle table. -+ -+ If you want to compile it as a module, say M here and read -+ Documentation/modules.txt. The module will be called ipt_ROUTE.o. -+ If unsure, say `N'. -+ - config IP_NF_TARGET_NETMAP - tristate "NETMAP target support" - depends on IP_NF_NAT -diff -urN linux-2.6.19.old/net/ipv4/netfilter/Makefile linux-2.6.19.dev/net/ipv4/netfilter/Makefile ---- linux-2.6.19.old/net/ipv4/netfilter/Makefile 2006-12-14 03:13:49.000000000 +0100 -+++ linux-2.6.19.dev/net/ipv4/netfilter/Makefile 2006-12-14 03:13:49.000000000 +0100 -@@ -74,6 +74,7 @@ - obj-$(CONFIG_IP_NF_TARGET_IMQ) += ipt_IMQ.o ++ tristate 'ROUTE target support' ++ depends on IP_NF_MANGLE ++ help ++ This option adds a `ROUTE' target, which enables you to setup unusual ++ routes. For example, the ROUTE lets you route a received packet through ++ an interface or towards a host, even if the regular destination of the ++ packet is the router itself. The ROUTE target is also able to change the ++ incoming interface of a packet. ++ ++ The target can be or not a final target. It has to be used inside the ++ mangle table. ++ ++ If you want to compile it as a module, say M here and read ++ Documentation/modules.txt. The module will be called ipt_ROUTE.o. ++ If unsure, say `N'. ++ + endmenu + +diff -Nur linux-2.6.21.1/net/ipv4/netfilter/Makefile linux-2.6.21.1-owrt/net/ipv4/netfilter/Makefile +--- linux-2.6.21.1/net/ipv4/netfilter/Makefile 2007-04-27 23:49:26.000000000 +0200 ++++ linux-2.6.21.1-owrt/net/ipv4/netfilter/Makefile 2007-05-23 20:32:22.000000000 +0200 +@@ -98,6 +98,7 @@ + obj-$(CONFIG_IP_NF_TARGET_ECN) += ipt_ECN.o obj-$(CONFIG_IP_NF_TARGET_MASQUERADE) += ipt_MASQUERADE.o obj-$(CONFIG_IP_NF_TARGET_REDIRECT) += ipt_REDIRECT.o +obj-$(CONFIG_IP_NF_TARGET_ROUTE) += ipt_ROUTE.o obj-$(CONFIG_IP_NF_TARGET_NETMAP) += ipt_NETMAP.o obj-$(CONFIG_IP_NF_TARGET_SAME) += ipt_SAME.o obj-$(CONFIG_IP_NF_NAT_SNMP_BASIC) += ip_nat_snmp_basic.o -diff -urN linux-2.6.19.old/net/ipv6/ipv6_syms.c linux-2.6.19.dev/net/ipv6/ipv6_syms.c ---- linux-2.6.19.old/net/ipv6/ipv6_syms.c 2006-11-29 22:57:37.000000000 +0100 -+++ linux-2.6.19.dev/net/ipv6/ipv6_syms.c 2006-12-14 03:13:49.000000000 +0100 -@@ -11,6 +11,7 @@ +diff -Nur linux-2.6.21.1/net/ipv6/ipv6_syms.c linux-2.6.21.1-owrt/net/ipv6/ipv6_syms.c +--- linux-2.6.21.1/net/ipv6/ipv6_syms.c 2007-04-27 23:49:26.000000000 +0200 ++++ linux-2.6.21.1-owrt/net/ipv6/ipv6_syms.c 2007-05-23 20:32:22.000000000 +0200 +@@ -10,6 +10,7 @@ EXPORT_SYMBOL(icmpv6_statistics); EXPORT_SYMBOL(icmpv6_err_convert); EXPORT_SYMBOL(ndisc_mc_map); @@ -560,10 +587,10 @@ diff -urN linux-2.6.19.old/net/ipv6/ipv6_syms.c linux-2.6.19.dev/net/ipv6/ipv6_s EXPORT_SYMBOL(register_inet6addr_notifier); EXPORT_SYMBOL(unregister_inet6addr_notifier); EXPORT_SYMBOL(ip6_route_output); -diff -urN linux-2.6.19.old/net/ipv6/netfilter/ip6t_ROUTE.c linux-2.6.19.dev/net/ipv6/netfilter/ip6t_ROUTE.c ---- linux-2.6.19.old/net/ipv6/netfilter/ip6t_ROUTE.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.19.dev/net/ipv6/netfilter/ip6t_ROUTE.c 2006-12-14 03:13:49.000000000 +0100 -@@ -0,0 +1,302 @@ +diff -Nur linux-2.6.21.1/net/ipv6/netfilter/ip6t_ROUTE.c linux-2.6.21.1-owrt/net/ipv6/netfilter/ip6t_ROUTE.c +--- linux-2.6.21.1/net/ipv6/netfilter/ip6t_ROUTE.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/net/ipv6/netfilter/ip6t_ROUTE.c 2007-05-23 20:32:22.000000000 +0200 +@@ -0,0 +1,330 @@ +/* + * This implements the ROUTE v6 target, which enables you to setup unusual + * routes not supported by the standard kernel routing table. @@ -581,6 +608,7 @@ diff -urN linux-2.6.19.old/net/ipv6/netfilter/ip6t_ROUTE.c linux-2.6.19.dev/net/ +#include +#include +#include ++#include +#include +#include +#include @@ -593,85 +621,85 @@ diff -urN linux-2.6.19.old/net/ipv6/netfilter/ip6t_ROUTE.c linux-2.6.19.dev/net/ +#endif + +#define NIP6(addr) \ -+ ntohs((addr).s6_addr16[0]), \ -+ ntohs((addr).s6_addr16[1]), \ -+ ntohs((addr).s6_addr16[2]), \ -+ ntohs((addr).s6_addr16[3]), \ -+ ntohs((addr).s6_addr16[4]), \ -+ ntohs((addr).s6_addr16[5]), \ -+ ntohs((addr).s6_addr16[6]), \ -+ ntohs((addr).s6_addr16[7]) ++ ntohs((addr).s6_addr16[0]), \ ++ ntohs((addr).s6_addr16[1]), \ ++ ntohs((addr).s6_addr16[2]), \ ++ ntohs((addr).s6_addr16[3]), \ ++ ntohs((addr).s6_addr16[4]), \ ++ ntohs((addr).s6_addr16[5]), \ ++ ntohs((addr).s6_addr16[6]), \ ++ ntohs((addr).s6_addr16[7]) + +/* Route the packet according to the routing keys specified in + * route_info. Keys are : -+ * - ifindex : -+ * 0 if no oif preferred, ++ * - ifindex : ++ * 0 if no oif preferred, + * otherwise set to the index of the desired oif + * - route_info->gw : + * 0 if no gateway specified, + * otherwise set to the next host to which the pkt must be routed -+ * If success, skb->dev is the output device to which the packet must ++ * If success, skb->dev is the output device to which the packet must + * be sent and skb->dst is not NULL + * -+ * RETURN: 1 if the packet was succesfully routed to the ++ * RETURN: 1 if the packet was succesfully routed to the + * destination desired + * 0 if the kernel routing table could not route the packet + * according to the keys specified + */ -+static int ++static int +route6(struct sk_buff *skb, + unsigned int ifindex, + const struct ip6t_route_target_info *route_info) +{ -+ struct rt6_info *rt = NULL; -+ struct ipv6hdr *ipv6h = skb->nh.ipv6h; -+ struct in6_addr *gw = (struct in6_addr*)&route_info->gw; -+ -+ DEBUGP("ip6t_ROUTE: called with: "); -+ DEBUGP("DST=%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x ", NIP6(ipv6h->daddr)); -+ DEBUGP("GATEWAY=%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x ", NIP6(*gw)); -+ DEBUGP("OUT=%s\n", route_info->oif); -+ -+ if (ipv6_addr_any(gw)) -+ rt = rt6_lookup(&ipv6h->daddr, &ipv6h->saddr, ifindex, 1); -+ else -+ rt = rt6_lookup(gw, &ipv6h->saddr, ifindex, 1); -+ -+ if (!rt) -+ goto no_route; -+ -+ DEBUGP("ip6t_ROUTE: routing gives: "); -+ DEBUGP("DST=%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x ", NIP6(rt->rt6i_dst.addr)); -+ DEBUGP("GATEWAY=%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x ", NIP6(rt->rt6i_gateway)); -+ DEBUGP("OUT=%s\n", rt->rt6i_dev->name); -+ -+ if (ifindex && rt->rt6i_dev->ifindex!=ifindex) -+ goto wrong_route; -+ -+ if (!rt->rt6i_nexthop) { -+ DEBUGP("ip6t_ROUTE: discovering neighbour\n"); -+ rt->rt6i_nexthop = ndisc_get_neigh(rt->rt6i_dev, &rt->rt6i_dst.addr); -+ } -+ -+ /* Drop old route. */ -+ dst_release(skb->dst); -+ skb->dst = &rt->u.dst; -+ skb->dev = rt->rt6i_dev; -+ return 1; ++ struct rt6_info *rt = NULL; ++ struct ipv6hdr *ipv6h = skb->nh.ipv6h; ++ struct in6_addr *gw = (struct in6_addr*)&route_info->gw; ++ ++ DEBUGP("ip6t_ROUTE: called with: "); ++ DEBUGP("DST=%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x ", NIP6(ipv6h->daddr)); ++ DEBUGP("GATEWAY=%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x ", NIP6(*gw)); ++ DEBUGP("OUT=%s\n", route_info->oif); ++ ++ if (ipv6_addr_any(gw)) ++ rt = rt6_lookup(&ipv6h->daddr, &ipv6h->saddr, ifindex, 1); ++ else ++ rt = rt6_lookup(gw, &ipv6h->saddr, ifindex, 1); ++ ++ if (!rt) ++ goto no_route; ++ ++ DEBUGP("ip6t_ROUTE: routing gives: "); ++ DEBUGP("DST=%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x ", NIP6(rt->rt6i_dst.addr)); ++ DEBUGP("GATEWAY=%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x ", NIP6(rt->rt6i_gateway)); ++ DEBUGP("OUT=%s\n", rt->rt6i_dev->name); ++ ++ if (ifindex && rt->rt6i_dev->ifindex!=ifindex) ++ goto wrong_route; ++ ++ if (!rt->rt6i_nexthop) { ++ DEBUGP("ip6t_ROUTE: discovering neighbour\n"); ++ rt->rt6i_nexthop = ndisc_get_neigh(rt->rt6i_dev, &rt->rt6i_dst.addr); ++ } ++ ++ /* Drop old route. */ ++ dst_release(skb->dst); ++ skb->dst = &rt->u.dst; ++ skb->dev = rt->rt6i_dev; ++ return 1; + + wrong_route: -+ dst_release(&rt->u.dst); ++ dst_release(&rt->u.dst); + no_route: -+ if (!net_ratelimit()) -+ return 0; -+ -+ printk("ip6t_ROUTE: no explicit route found "); -+ if (ifindex) -+ printk("via interface %s ", route_info->oif); -+ if (!ipv6_addr_any(gw)) -+ printk("via gateway %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x", NIP6(*gw)); -+ printk("\n"); -+ return 0; ++ if (!net_ratelimit()) ++ return 0; ++ ++ printk("ip6t_ROUTE: no explicit route found "); ++ if (ifindex) ++ printk("via interface %s ", route_info->oif); ++ if (!ipv6_addr_any(gw)) ++ printk("via gateway %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x", NIP6(*gw)); ++ printk("\n"); ++ return 0; +} + + @@ -683,220 +711,246 @@ diff -urN linux-2.6.19.old/net/ipv6/netfilter/ip6t_ROUTE.c linux-2.6.19.dev/net/ + */ +static void ip_direct_send(struct sk_buff *skb) +{ -+ struct dst_entry *dst = skb->dst; -+ struct hh_cache *hh = dst->hh; -+ -+ if (hh) { -+ read_lock_bh(&hh->hh_lock); -+ memcpy(skb->data - 16, hh->hh_data, 16); -+ read_unlock_bh(&hh->hh_lock); -+ skb_push(skb, hh->hh_len); -+ hh->hh_output(skb); -+ } else if (dst->neighbour) -+ dst->neighbour->output(skb); -+ else { -+ if (net_ratelimit()) -+ DEBUGP(KERN_DEBUG "ip6t_ROUTE: no hdr & no neighbour cache!\n"); -+ kfree_skb(skb); -+ } ++ struct dst_entry *dst = skb->dst; ++ struct hh_cache *hh = dst->hh; ++ ++ if (hh) { ++ read_lock_bh(&hh->hh_lock); ++ memcpy(skb->data - 16, hh->hh_data, 16); ++ read_unlock_bh(&hh->hh_lock); ++ skb_push(skb, hh->hh_len); ++ hh->hh_output(skb); ++ } else if (dst->neighbour) ++ dst->neighbour->output(skb); ++ else { ++ if (net_ratelimit()) ++ DEBUGP(KERN_DEBUG "ip6t_ROUTE: no hdr & no neighbour cache!\n"); ++ kfree_skb(skb); ++ } +} + + -+static unsigned int ++static unsigned int +route6_oif(const struct ip6t_route_target_info *route_info, -+ struct sk_buff *skb) ++ struct sk_buff *skb) +{ -+ unsigned int ifindex = 0; -+ struct net_device *dev_out = NULL; -+ -+ /* The user set the interface name to use. -+ * Getting the current interface index. -+ */ -+ if ((dev_out = dev_get_by_name(route_info->oif))) { -+ ifindex = dev_out->ifindex; -+ } else { -+ /* Unknown interface name : packet dropped */ -+ if (net_ratelimit()) -+ DEBUGP("ip6t_ROUTE: oif interface %s not found\n", route_info->oif); -+ -+ if (route_info->flags & IP6T_ROUTE_CONTINUE) -+ return IP6T_CONTINUE; -+ else -+ return NF_DROP; -+ } -+ -+ /* Trying the standard way of routing packets */ -+ if (route6(skb, ifindex, route_info)) { -+ dev_put(dev_out); -+ if (route_info->flags & IP6T_ROUTE_CONTINUE) -+ return IP6T_CONTINUE; -+ -+ ip_direct_send(skb); -+ return NF_STOLEN; -+ } else -+ return NF_DROP; ++ unsigned int ifindex = 0; ++ struct net_device *dev_out = NULL; ++ ++ /* The user set the interface name to use. ++ * Getting the current interface index. ++ */ ++ if ((dev_out = dev_get_by_name(route_info->oif))) { ++ ifindex = dev_out->ifindex; ++ } else { ++ /* Unknown interface name : packet dropped */ ++ if (net_ratelimit()) ++ DEBUGP("ip6t_ROUTE: oif interface %s not found\n", route_info->oif); ++ ++ if (route_info->flags & IP6T_ROUTE_CONTINUE) ++ return IP6T_CONTINUE; ++ else ++ return NF_DROP; ++ } ++ ++ /* Trying the standard way of routing packets */ ++ if (route6(skb, ifindex, route_info)) { ++ dev_put(dev_out); ++ if (route_info->flags & IP6T_ROUTE_CONTINUE) ++ return IP6T_CONTINUE; ++ ++ ip_direct_send(skb); ++ return NF_STOLEN; ++ } else ++ return NF_DROP; +} + + -+static unsigned int ++static unsigned int +route6_gw(const struct ip6t_route_target_info *route_info, -+ struct sk_buff *skb) ++ struct sk_buff *skb) +{ -+ if (route6(skb, 0, route_info)) { -+ if (route_info->flags & IP6T_ROUTE_CONTINUE) -+ return IP6T_CONTINUE; -+ -+ ip_direct_send(skb); -+ return NF_STOLEN; -+ } else -+ return NF_DROP; ++ if (route6(skb, 0, route_info)) { ++ if (route_info->flags & IP6T_ROUTE_CONTINUE) ++ return IP6T_CONTINUE; ++ ++ ip_direct_send(skb); ++ return NF_STOLEN; ++ } else ++ return NF_DROP; +} + + -+static unsigned int ++static unsigned int +ip6t_route_target(struct sk_buff **pskb, -+ const struct net_device *in, -+ const struct net_device *out, -+ unsigned int hooknum, -+ const struct xt_target *target, -+ const void *targinfo) ++ const struct net_device *in, ++ const struct net_device *out, ++ unsigned int hooknum, ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17) ++ const struct xt_target *target, ++#endif ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) ++ const void *targinfo, ++ void *userinfo) ++#else ++ const void *targinfo) ++#endif +{ -+ const struct ip6t_route_target_info *route_info = targinfo; -+ struct sk_buff *skb = *pskb; -+ struct in6_addr *gw = (struct in6_addr*)&route_info->gw; -+ unsigned int res; -+ -+ if (route_info->flags & IP6T_ROUTE_CONTINUE) -+ goto do_it; -+ -+ /* If we are at PREROUTING or INPUT hook -+ * the TTL isn't decreased by the IP stack -+ */ -+ if (hooknum == NF_IP6_PRE_ROUTING || -+ hooknum == NF_IP6_LOCAL_IN) { -+ -+ struct ipv6hdr *ipv6h = skb->nh.ipv6h; -+ -+ if (ipv6h->hop_limit <= 1) { -+ /* Force OUTPUT device used as source address */ -+ skb->dev = skb->dst->dev; -+ -+ icmpv6_send(skb, ICMPV6_TIME_EXCEED, -+ ICMPV6_EXC_HOPLIMIT, 0, skb->dev); -+ -+ return NF_DROP; -+ } -+ -+ ipv6h->hop_limit--; -+ } -+ -+ if ((route_info->flags & IP6T_ROUTE_TEE)) { -+ /* -+ * Copy the *pskb, and route the copy. Will later return -+ * IP6T_CONTINUE for the original skb, which should continue -+ * on its way as if nothing happened. The copy should be -+ * independantly delivered to the ROUTE --gw. -+ */ -+ skb = skb_copy(*pskb, GFP_ATOMIC); -+ if (!skb) { -+ if (net_ratelimit()) -+ DEBUGP(KERN_DEBUG "ip6t_ROUTE: copy failed!\n"); -+ return IP6T_CONTINUE; -+ } -+ } ++ const struct ip6t_route_target_info *route_info = targinfo; ++ struct sk_buff *skb = *pskb; ++ struct in6_addr *gw = (struct in6_addr*)&route_info->gw; ++ unsigned int res; ++ ++ if (route_info->flags & IP6T_ROUTE_CONTINUE) ++ goto do_it; ++ ++ /* If we are at PREROUTING or INPUT hook ++ * the TTL isn't decreased by the IP stack ++ */ ++ if (hooknum == NF_IP6_PRE_ROUTING || ++ hooknum == NF_IP6_LOCAL_IN) { ++ ++ struct ipv6hdr *ipv6h = skb->nh.ipv6h; ++ ++ if (ipv6h->hop_limit <= 1) { ++ /* Force OUTPUT device used as source address */ ++ skb->dev = skb->dst->dev; ++ ++ icmpv6_send(skb, ICMPV6_TIME_EXCEED, ++ ICMPV6_EXC_HOPLIMIT, 0, skb->dev); ++ ++ return NF_DROP; ++ } ++ ++ ipv6h->hop_limit--; ++ } ++ ++ if ((route_info->flags & IP6T_ROUTE_TEE)) { ++ /* ++ * Copy the *pskb, and route the copy. Will later return ++ * IP6T_CONTINUE for the original skb, which should continue ++ * on its way as if nothing happened. The copy should be ++ * independantly delivered to the ROUTE --gw. ++ */ ++ skb = skb_copy(*pskb, GFP_ATOMIC); ++ if (!skb) { ++ if (net_ratelimit()) ++ DEBUGP(KERN_DEBUG "ip6t_ROUTE: copy failed!\n"); ++ return IP6T_CONTINUE; ++ } ++ } + +do_it: -+ if (route_info->oif[0]) { -+ res = route6_oif(route_info, skb); -+ } else if (!ipv6_addr_any(gw)) { -+ res = route6_gw(route_info, skb); -+ } else { -+ if (net_ratelimit()) -+ DEBUGP(KERN_DEBUG "ip6t_ROUTE: no parameter !\n"); -+ res = IP6T_CONTINUE; -+ } -+ -+ if ((route_info->flags & IP6T_ROUTE_TEE)) -+ res = IP6T_CONTINUE; -+ -+ return res; ++ if (route_info->oif[0]) { ++ res = route6_oif(route_info, skb); ++ } else if (!ipv6_addr_any(gw)) { ++ res = route6_gw(route_info, skb); ++ } else { ++ if (net_ratelimit()) ++ DEBUGP(KERN_DEBUG "ip6t_ROUTE: no parameter !\n"); ++ res = IP6T_CONTINUE; ++ } ++ ++ if ((route_info->flags & IP6T_ROUTE_TEE)) ++ res = IP6T_CONTINUE; ++ ++ return res; +} + + -+static int ++static int +ip6t_route_checkentry(const char *tablename, -+ const void *e, -+ const struct xt_target *target, -+ void *targinfo, -+ unsigned int hook_mask) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) ++ const void *entry, ++#else ++ const struct ip6t_entry *entry ++#endif ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17) ++ const struct xt_target *target, ++#endif ++ void *targinfo, ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) ++ unsigned int targinfosize, ++#endif ++ unsigned int hook_mask) +{ -+ if (strcmp(tablename, "mangle") != 0) { -+ printk("ip6t_ROUTE: can only be called from \"mangle\" table.\n"); -+ return 0; -+ } ++ if (strcmp(tablename, "mangle") != 0) { ++ printk("ip6t_ROUTE: can only be called from \"mangle\" table.\n"); ++ return 0; ++ } ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) ++ if (targinfosize != IP6T_ALIGN(sizeof(struct ip6t_route_target_info))) { ++ printk(KERN_WARNING "ip6t_ROUTE: targinfosize %u != %Zu\n", ++ targinfosize, ++ IP6T_ALIGN(sizeof(struct ip6t_route_target_info))); ++ return 0; ++ } ++#endif + -+ return 1; ++ return 1; +} + + +static struct ip6t_target ip6t_route_reg = { -+ .name = "ROUTE", -+ .target = ip6t_route_target, -+ .targetsize = sizeof(struct ip6t_route_target_info), -+ .checkentry = ip6t_route_checkentry, -+ .me = THIS_MODULE ++ .name = "ROUTE", ++ .target = ip6t_route_target, ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17) ++ .targetsize = sizeof(struct ip6t_route_target_info), ++#endif ++ .checkentry = ip6t_route_checkentry, ++ .me = THIS_MODULE +}; + + +static int __init init(void) +{ -+ printk(KERN_DEBUG "registering ipv6 ROUTE target\n"); -+ if (ip6t_register_target(&ip6t_route_reg)) -+ return -EINVAL; ++ printk(KERN_DEBUG "registering ipv6 ROUTE target\n"); ++ if (ip6t_register_target(&ip6t_route_reg)) ++ return -EINVAL; + -+ return 0; ++ return 0; +} + + +static void __exit fini(void) +{ -+ ip6t_unregister_target(&ip6t_route_reg); ++ ip6t_unregister_target(&ip6t_route_reg); +} + +module_init(init); +module_exit(fini); +MODULE_LICENSE("GPL"); -diff -urN linux-2.6.19.old/net/ipv6/netfilter/Kconfig linux-2.6.19.dev/net/ipv6/netfilter/Kconfig ---- linux-2.6.19.old/net/ipv6/netfilter/Kconfig 2006-12-14 03:13:49.000000000 +0100 -+++ linux-2.6.19.dev/net/ipv6/netfilter/Kconfig 2006-12-14 03:13:49.000000000 +0100 -@@ -162,6 +162,19 @@ - - To compile it as a module, choose M here. If unsure, say N. +diff -Nur linux-2.6.21.1/net/ipv6/netfilter/Kconfig linux-2.6.21.1-owrt/net/ipv6/netfilter/Kconfig +--- linux-2.6.21.1/net/ipv6/netfilter/Kconfig 2007-04-27 23:49:26.000000000 +0200 ++++ linux-2.6.21.1-owrt/net/ipv6/netfilter/Kconfig 2007-05-23 20:32:22.000000000 +0200 +@@ -200,5 +200,18 @@ + If you want to compile it as a module, say M here and read + . If unsure, say `N'. +config IP6_NF_TARGET_ROUTE -+ tristate "ROUTE target support" -+ depends on IP6_NF_MANGLE -+ help -+ This option adds a `ROUTE' target, which enables you to setup unusual -+ routes. The ROUTE target is also able to change the incoming interface -+ of a packet. -+ -+ The target can be or not a final target. It has to be used inside the -+ mangle table. -+ -+ Not working as a module. -+ - config IP6_NF_MANGLE - tristate "Packet mangling" - depends on IP6_NF_IPTABLES -diff -urN linux-2.6.19.old/net/ipv6/netfilter/Makefile linux-2.6.19.dev/net/ipv6/netfilter/Makefile ---- linux-2.6.19.old/net/ipv6/netfilter/Makefile 2006-12-14 03:13:49.000000000 +0100 -+++ linux-2.6.19.dev/net/ipv6/netfilter/Makefile 2006-12-14 03:13:49.000000000 +0100 -@@ -20,6 +20,7 @@ ++ tristate 'ROUTE target support' ++ depends on IP6_NF_MANGLE ++ help ++ This option adds a `ROUTE' target, which enables you to setup unusual ++ routes. The ROUTE target is also able to change the incoming interface ++ of a packet. ++ ++ The target can be or not a final target. It has to be used inside the ++ mangle table. ++ ++ Not working as a module. ++ + endmenu + +diff -Nur linux-2.6.21.1/net/ipv6/netfilter/Makefile linux-2.6.21.1-owrt/net/ipv6/netfilter/Makefile +--- linux-2.6.21.1/net/ipv6/netfilter/Makefile 2007-04-27 23:49:26.000000000 +0200 ++++ linux-2.6.21.1-owrt/net/ipv6/netfilter/Makefile 2007-05-23 20:32:22.000000000 +0200 +@@ -19,6 +19,7 @@ obj-$(CONFIG_IP6_NF_RAW) += ip6table_raw.o obj-$(CONFIG_IP6_NF_MATCH_HL) += ip6t_hl.o obj-$(CONFIG_IP6_NF_TARGET_REJECT) += ip6t_REJECT.o +obj-$(CONFIG_IP6_NF_TARGET_ROUTE) += ip6t_ROUTE.o + obj-$(CONFIG_IP6_NF_MATCH_MH) += ip6t_mh.o # objects for l3 independent conntrack - nf_conntrack_ipv6-objs := nf_conntrack_l3proto_ipv6.o nf_conntrack_proto_icmpv6.o nf_conntrack_reasm.o diff --git a/target/linux/generic-2.6/patches/170-netfilter_chaostables.patch b/target/linux/generic-2.6/patches/170-netfilter_chaostables.patch index 46d48a5d08..aa665211b8 100644 --- a/target/linux/generic-2.6/patches/170-netfilter_chaostables.patch +++ b/target/linux/generic-2.6/patches/170-netfilter_chaostables.patch @@ -1,6 +1,33 @@ -diff -ruN linux-2.6.19.1.orig/include/linux/netfilter/xt_CHAOS.h linux-2.6.19.1/include/linux/netfilter/xt_CHAOS.h ---- linux-2.6.19.1.orig/include/linux/netfilter/xt_CHAOS.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.19.1/include/linux/netfilter/xt_CHAOS.h 2007-01-11 13:28:07.656144799 +0100 +diff -Nur linux-2.6.21.1/include/linux/netfilter/oot_conntrack.h linux-2.6.21.1-owrt/include/linux/netfilter/oot_conntrack.h +--- linux-2.6.21.1/include/linux/netfilter/oot_conntrack.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/include/linux/netfilter/oot_conntrack.h 2007-05-14 14:18:54.000000000 +0200 +@@ -0,0 +1,5 @@ ++#if defined(CONFIG_IP_NF_CONNTRACK) || defined(CONFIG_IP_NF_CONNTRACK_MODULE) ++# include ++#else /* linux-2.6.20+ */ ++# include ++#endif +diff -Nur linux-2.6.21.1/include/linux/netfilter/oot_trans.h linux-2.6.21.1-owrt/include/linux/netfilter/oot_trans.h +--- linux-2.6.21.1/include/linux/netfilter/oot_trans.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/include/linux/netfilter/oot_trans.h 2007-05-14 14:18:54.000000000 +0200 +@@ -0,0 +1,14 @@ ++/* Out of tree workarounds */ ++#include ++#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18) ++# define HAVE_MATCHINFOSIZE 1 ++# define HAVE_TARGUSERINFO 1 ++# define HAVE_TARGINFOSIZE 1 ++#endif ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20) ++# define nfmark mark ++#endif ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 21) ++# define tcp_v4_check(tcph, tcph_sz, s, d, csp) \ ++ tcp_v4_check((tcph_sz), (s), (d), (csp)) ++#endif +diff -Nur linux-2.6.21.1/include/linux/netfilter/xt_CHAOS.h linux-2.6.21.1-owrt/include/linux/netfilter/xt_CHAOS.h +--- linux-2.6.21.1/include/linux/netfilter/xt_CHAOS.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/include/linux/netfilter/xt_CHAOS.h 2007-05-14 14:18:54.000000000 +0200 @@ -0,0 +1,14 @@ +#ifndef _LINUX_XT_CHAOS_H +#define _LINUX_XT_CHAOS_H 1 @@ -16,9 +43,9 @@ diff -ruN linux-2.6.19.1.orig/include/linux/netfilter/xt_CHAOS.h linux-2.6.19.1/ +}; + +#endif /* _LINUX_XT_CHAOS_H */ -diff -ruN linux-2.6.19.1.orig/include/linux/netfilter/xt_portscan.h linux-2.6.19.1/include/linux/netfilter/xt_portscan.h ---- linux-2.6.19.1.orig/include/linux/netfilter/xt_portscan.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.19.1/include/linux/netfilter/xt_portscan.h 2007-01-11 13:28:07.656144799 +0100 +diff -Nur linux-2.6.21.1/include/linux/netfilter/xt_portscan.h linux-2.6.21.1-owrt/include/linux/netfilter/xt_portscan.h +--- linux-2.6.21.1/include/linux/netfilter/xt_portscan.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/include/linux/netfilter/xt_portscan.h 2007-05-14 14:18:54.000000000 +0200 @@ -0,0 +1,8 @@ +#ifndef _LINUX_XT_PORTSCAN_H +#define _LINUX_XT_PORTSCAN_H 1 @@ -28,10 +55,10 @@ diff -ruN linux-2.6.19.1.orig/include/linux/netfilter/xt_portscan.h linux-2.6.19 +}; + +#endif /* _LINUX_XT_PORTSCAN_H */ -diff -ruN linux-2.6.19.1.orig/net/netfilter/find_match.c linux-2.6.19.1/net/netfilter/find_match.c ---- linux-2.6.19.1.orig/net/netfilter/find_match.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.19.1/net/netfilter/find_match.c 2007-01-11 13:28:12.191994379 +0100 -@@ -0,0 +1,37 @@ +diff -Nur linux-2.6.21.1/net/netfilter/find_match.c linux-2.6.21.1-owrt/net/netfilter/find_match.c +--- linux-2.6.21.1/net/netfilter/find_match.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/net/netfilter/find_match.c 2007-05-14 14:18:54.000000000 +0200 +@@ -0,0 +1,39 @@ +/* + xt_request_find_match + by Jan Engelhardt , 2006 - 2007 @@ -42,7 +69,6 @@ diff -ruN linux-2.6.19.1.orig/net/netfilter/find_match.c linux-2.6.19.1/net/netf + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. +*/ -+ +#include +#include +#include @@ -52,7 +78,7 @@ diff -ruN linux-2.6.19.1.orig/net/netfilter/find_match.c linux-2.6.19.1/net/netf + * Yeah this code is sub-optimal, but the function is missing in + * mainline so far. -jengelh + */ -+static struct xt_match *xt_request_find_match(int af, const char *name, ++static struct xt_match *xt_request_find_match_lo(int af, const char *name, + u8 revision) +{ + static const char *const xt_prefix[] = { @@ -69,10 +95,13 @@ diff -ruN linux-2.6.19.1.orig/net/netfilter/find_match.c linux-2.6.19.1/net/netf + + return match; +} -diff -ruN linux-2.6.19.1.orig/net/netfilter/Kconfig linux-2.6.19.1/net/netfilter/Kconfig ---- linux-2.6.19.1.orig/net/netfilter/Kconfig 2007-01-11 13:27:24.445577700 +0100 -+++ linux-2.6.19.1/net/netfilter/Kconfig 2007-01-11 13:28:09.092097179 +0100 -@@ -122,6 +122,14 @@ ++ ++/* In case it goes into mainline, let this out-of-tree package compile */ ++#define xt_request_find_match xt_request_find_match_lo +diff -Nur linux-2.6.21.1/net/netfilter/Kconfig linux-2.6.21.1-owrt/net/netfilter/Kconfig +--- linux-2.6.21.1/net/netfilter/Kconfig 2007-04-27 23:49:26.000000000 +0200 ++++ linux-2.6.21.1-owrt/net/netfilter/Kconfig 2007-05-14 14:30:47.000000000 +0200 +@@ -287,6 +287,14 @@ # alphabetically ordered list of targets @@ -87,7 +116,7 @@ diff -ruN linux-2.6.19.1.orig/net/netfilter/Kconfig linux-2.6.19.1/net/netfilter config NETFILTER_XT_TARGET_CLASSIFY tristate '"CLASSIFY" target support' depends on NETFILTER_XTABLES -@@ -148,6 +156,14 @@ +@@ -315,6 +323,14 @@ . The module will be called ipt_CONNMARK.o. If unsure, say `N'. @@ -102,7 +131,7 @@ diff -ruN linux-2.6.19.1.orig/net/netfilter/Kconfig linux-2.6.19.1/net/netfilter config NETFILTER_XT_TARGET_DSCP tristate '"DSCP" target support' depends on NETFILTER_XTABLES -@@ -355,6 +371,14 @@ +@@ -563,6 +579,14 @@ To compile it as a module, choose M here. If unsure, say N. @@ -117,10 +146,10 @@ diff -ruN linux-2.6.19.1.orig/net/netfilter/Kconfig linux-2.6.19.1/net/netfilter config NETFILTER_XT_MATCH_MULTIPORT tristate "Multiple port match support" depends on NETFILTER_XTABLES -diff -ruN linux-2.6.19.1.orig/net/netfilter/Makefile linux-2.6.19.1/net/netfilter/Makefile ---- linux-2.6.19.1.orig/net/netfilter/Makefile 2007-01-11 13:27:24.445577700 +0100 -+++ linux-2.6.19.1/net/netfilter/Makefile 2007-01-11 13:28:07.656144799 +0100 -@@ -23,8 +23,10 @@ +diff -Nur linux-2.6.21.1/net/netfilter/Makefile linux-2.6.21.1-owrt/net/netfilter/Makefile +--- linux-2.6.21.1/net/netfilter/Makefile 2007-04-27 23:49:26.000000000 +0200 ++++ linux-2.6.21.1-owrt/net/netfilter/Makefile 2007-05-14 14:30:47.000000000 +0200 +@@ -37,8 +37,10 @@ obj-$(CONFIG_NETFILTER_XTABLES) += x_tables.o xt_tcpudp.o # targets @@ -131,7 +160,7 @@ diff -ruN linux-2.6.19.1.orig/net/netfilter/Makefile linux-2.6.19.1/net/netfilte obj-$(CONFIG_NETFILTER_XT_TARGET_DSCP) += xt_DSCP.o obj-$(CONFIG_NETFILTER_XT_TARGET_MARK) += xt_MARK.o obj-$(CONFIG_NETFILTER_XT_TARGET_NFQUEUE) += xt_NFQUEUE.o -@@ -47,6 +49,7 @@ +@@ -63,6 +65,7 @@ obj-$(CONFIG_NETFILTER_XT_MATCH_MARK) += xt_mark.o obj-$(CONFIG_NETFILTER_XT_MATCH_MULTIPORT) += xt_multiport.o obj-$(CONFIG_NETFILTER_XT_MATCH_POLICY) += xt_policy.o @@ -139,16 +168,17 @@ diff -ruN linux-2.6.19.1.orig/net/netfilter/Makefile linux-2.6.19.1/net/netfilte obj-$(CONFIG_NETFILTER_XT_MATCH_PKTTYPE) += xt_pkttype.o obj-$(CONFIG_NETFILTER_XT_MATCH_QUOTA) += xt_quota.o obj-$(CONFIG_NETFILTER_XT_MATCH_REALM) += xt_realm.o -diff -ruN linux-2.6.19.1.orig/net/netfilter/xt_CHAOS.c linux-2.6.19.1/net/netfilter/xt_CHAOS.c ---- linux-2.6.19.1.orig/net/netfilter/xt_CHAOS.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.19.1/net/netfilter/xt_CHAOS.c 2007-01-11 13:28:14.407920893 +0100 -@@ -0,0 +1,180 @@ +diff -Nur linux-2.6.21.1/net/netfilter/xt_CHAOS.c linux-2.6.21.1-owrt/net/netfilter/xt_CHAOS.c +--- linux-2.6.21.1/net/netfilter/xt_CHAOS.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/net/netfilter/xt_CHAOS.c 2007-05-14 14:36:58.000000000 +0200 +@@ -0,0 +1,204 @@ +/* -+ CHAOS target for netfilter ++ CHAOS target for netfilter + -+ Copyright © Jan Engelhardt , 2006 - 2007 -+ released under the terms of the GNU General Public -+ License version 2.x and only versions 2.x. ++ Copyright © Jan Engelhardt , 2006 - 2007 ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License version 2 as ++ published by the Free Software Foundation. +*/ +#include +#include @@ -162,14 +192,9 @@ diff -ruN linux-2.6.19.1.orig/net/netfilter/xt_CHAOS.c linux-2.6.19.1/net/netfil +#include +#include +#include "find_match.c" ++#include +#define PFX KBUILD_MODNAME ": " + -+/* Out of tree workarounds */ -+#include -+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18) -+# define HAVE_TARGUSERINFO 1 -+#endif -+ +/* Module parameters */ +static unsigned int reject_percentage = ~0U * .01; +static unsigned int delude_percentage = ~0U * .0101; @@ -180,6 +205,8 @@ diff -ruN linux-2.6.19.1.orig/net/netfilter/xt_CHAOS.c linux-2.6.19.1/net/netfil +static struct xt_match *xm_tcp; +static struct xt_target *xt_delude, *xt_reject, *xt_tarpit; + ++static int have_delude, have_tarpit; ++ +/* Static data for other matches/targets */ +static const struct ipt_reject_info reject_params = { + .with = ICMP_HOST_UNREACH, @@ -226,7 +253,7 @@ diff -ruN linux-2.6.19.1.orig/net/netfilter/xt_CHAOS.c linux-2.6.19.1/net/netfil + /* Equivalent to: + * -A chaos -m statistic --mode random --probability \ + * $reject_percentage -j REJECT --reject-with host-unreach; -+ * -A chaos -m statistic --mode random --probability \ ++ * -A chaos -p tcp -m statistic --mode random --probability \ + * $delude_percentage -j DELUDE; + * -A chaos -j DROP; + */ @@ -249,9 +276,31 @@ diff -ruN linux-2.6.19.1.orig/net/netfilter/xt_CHAOS.c linux-2.6.19.1/net/netfil + return NF_DROP; +} + ++static int xt_chaos_checkentry(const char *tablename, const void *entry, ++ const struct xt_target *target, void *targinfo, ++#ifdef HAVE_TARGINFOSIZE ++ unsigned int targinfosize, ++#endif ++ unsigned int hook_mask) ++{ ++ const struct xt_chaos_info *info = targinfo; ++ if(info->variant == XTCHAOS_DELUDE && !have_delude) { ++ printk(KERN_WARNING PFX "Error: Cannot use --delude when " ++ "DELUDE module not available\n"); ++ return 0; ++ } ++ if(info->variant == XTCHAOS_TARPIT && !have_tarpit) { ++ printk(KERN_WARNING PFX "Error: Cannot use --tarpit when " ++ "TARPIT module not available\n"); ++ return 0; ++ } ++ return 1; ++} ++ +static struct xt_target xt_chaos_info = { + .name = "CHAOS", + .target = xt_chaos_target, ++ .checkentry = xt_chaos_checkentry, + .table = "filter", + .targetsize = sizeof(struct xt_chaos_info), + .hooks = (1 << NF_IP_LOCAL_IN) | (1 << NF_IP_FORWARD) | @@ -266,41 +315,43 @@ diff -ruN linux-2.6.19.1.orig/net/netfilter/xt_CHAOS.c linux-2.6.19.1/net/netfil + + xm_tcp = xt_request_find_match(AF_INET, "tcp", 0); + if(xm_tcp == NULL) { -+ printk(KERN_WARNING PFX "Could not find \"tcp\" match\n"); ++ printk(KERN_WARNING PFX "Error: Could not find or load " ++ "\"tcp\" match\n"); + return -EINVAL; + } + + xt_reject = xt_request_find_target(AF_INET, "REJECT", 0); + if(xt_reject == NULL) { -+ printk(KERN_WARNING PFX "Could not find \"REJECT\" target\n"); ++ printk(KERN_WARNING PFX "Error: Could not find or load " ++ "\"REJECT\" target\n"); + goto out2; + } + -+ xt_tarpit = xt_request_find_target(AF_INET, "TARPIT", 0); -+ if(xt_tarpit == NULL) { -+ printk(KERN_WARNING PFX "Could not find \"TARPIT\" target\n"); -+ goto out3; -+ } ++ xt_tarpit = xt_request_find_target(AF_INET, "TARPIT", 0); ++ have_tarpit = xt_tarpit != NULL; ++ if(!have_tarpit) ++ printk(KERN_WARNING PFX "Warning: Could not find or load " ++ "\"TARPIT\" target\n"); + -+ xt_delude = xt_request_find_target(AF_INET, "DELUDE", 0); -+ if(xt_delude == NULL) { -+ printk(KERN_WARNING PFX "Could not find \"DELUDE\" target\n"); -+ goto out4; -+ } ++ xt_delude = xt_request_find_target(AF_INET, "DELUDE", 0); ++ have_delude = xt_delude != NULL; ++ if(!have_delude) ++ printk(KERN_WARNING PFX "Warning: Could not find or load " ++ "\"DELUDE\" target\n"); + + if((ret = xt_register_target(&xt_chaos_info)) != 0) { + printk(KERN_WARNING PFX "xt_register_target returned " + "error %d\n", ret); -+ goto out5; ++ goto out3; + } + + return 0; + -+ out5: -+ module_put(xt_delude->me); -+ out4: -+ module_put(xt_tarpit->me); + out3: ++ if(have_delude) ++ module_put(xt_delude->me); ++ if(have_tarpit) ++ module_put(xt_tarpit->me); + module_put(xt_reject->me); + out2: + module_put(xm_tcp->me); @@ -312,8 +363,10 @@ diff -ruN linux-2.6.19.1.orig/net/netfilter/xt_CHAOS.c linux-2.6.19.1/net/netfil + xt_unregister_target(&xt_chaos_info); + module_put(xm_tcp->me); + module_put(xt_reject->me); -+ module_put(xt_delude->me); -+ module_put(xt_tarpit->me); ++ if(have_delude) ++ module_put(xt_delude->me); ++ if(have_tarpit) ++ module_put(xt_tarpit->me); + return; +} + @@ -323,26 +376,28 @@ diff -ruN linux-2.6.19.1.orig/net/netfilter/xt_CHAOS.c linux-2.6.19.1/net/netfil +MODULE_DESCRIPTION("netfilter CHAOS target"); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("ipt_CHAOS"); -diff -ruN linux-2.6.19.1.orig/net/netfilter/xt_DELUDE.c linux-2.6.19.1/net/netfilter/xt_DELUDE.c ---- linux-2.6.19.1.orig/net/netfilter/xt_DELUDE.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.19.1/net/netfilter/xt_DELUDE.c 2007-01-11 13:28:07.656144799 +0100 -@@ -0,0 +1,265 @@ +diff -Nur linux-2.6.21.1/net/netfilter/xt_DELUDE.c linux-2.6.21.1-owrt/net/netfilter/xt_DELUDE.c +--- linux-2.6.21.1/net/netfilter/xt_DELUDE.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/net/netfilter/xt_DELUDE.c 2007-05-14 14:53:12.000000000 +0200 +@@ -0,0 +1,288 @@ +/* -+ DELUDE target -+ Copyright © Jan Engelhardt , 2007 ++ DELUDE target ++ Copyright © Jan Engelhardt , 2007 + -+ Based upon linux-2.6.18.5/net/ipv4/netfilter/ipt_REJECT.c: -+ (C) 1999-2001 Paul `Rusty' Russell -+ (C) 2002-2004 Netfilter Core Team ++ Based upon linux-2.6.18.5/net/ipv4/netfilter/ipt_REJECT.c: ++ (C) 1999-2001 Paul `Rusty' Russell ++ (C) 2002-2004 Netfilter Core Team + -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License version 2 as -+ published by the Free Software Foundation. -+*/ ++ xt_DELUDE acts like REJECT, but does reply with SYN-ACK on SYN. + ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License version 2 as ++ published by the Free Software Foundation. ++*/ +#include +#include +#include ++#include +#include +#include +#include @@ -353,20 +408,11 @@ diff -ruN linux-2.6.19.1.orig/net/netfilter/xt_DELUDE.c linux-2.6.19.1/net/netfi +#include +#include +#ifdef CONFIG_BRIDGE_NETFILTER -+#include ++# include +#endif ++#include +#define PFX KBUILD_MODNAME ": " + -+/* Out of tree workarounds */ -+#include -+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18) -+# define HAVE_TARGINFOSIZE 1 -+# define HAVE_TARGUSERINFO 1 -+#endif -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20) -+# define nfmark mark -+#endif -+ +static inline struct rtable *route_reverse(struct sk_buff *skb, + struct tcphdr *tcph, int hook) +{ @@ -430,10 +476,10 @@ diff -ruN linux-2.6.19.1.orig/net/netfilter/xt_DELUDE.c linux-2.6.19.1/net/netfi + struct sk_buff *nskb; + struct iphdr *iph = oldskb->nh.iph; + struct tcphdr _otcph, *oth, *tcph; -+ struct rtable *rt; -+ u_int16_t tmp_port; -+ u_int32_t tmp_addr; -+ int hh_len; ++ __be16 tmp_port; ++ __be32 tmp_addr; ++ int needs_ack; ++ unsigned int addr_type; + + /* IP header checks: fragment. */ + if (oldskb->nh.iph->frag_off & htons(IP_OFFSET)) @@ -442,39 +488,33 @@ diff -ruN linux-2.6.19.1.orig/net/netfilter/xt_DELUDE.c linux-2.6.19.1/net/netfi + oth = skb_header_pointer(oldskb, oldskb->nh.iph->ihl * 4, + sizeof(_otcph), &_otcph); + if (oth == NULL) -+ return; ++ return; + -+ /* DELUDE only answers SYN. */ -+ if(!oth->syn || oth->ack || oth->fin || oth->rst) ++ /* No RST for RST. */ ++ if (oth->rst) + return; + + /* Check checksum */ + if (nf_ip_checksum(oldskb, hook, iph->ihl * 4, IPPROTO_TCP)) + return; + -+ if ((rt = route_reverse(oldskb, oth, hook)) == NULL) -+ return; -+ -+ hh_len = LL_RESERVED_SPACE(rt->u.dst.dev); -+ + /* We need a linear, writeable skb. We also need to expand + headroom in case hh_len of incoming interface < hh_len of + outgoing interface */ -+ nskb = skb_copy_expand(oldskb, hh_len, skb_tailroom(oldskb), ++ nskb = skb_copy_expand(oldskb, LL_MAX_HEADER, skb_tailroom(oldskb), + GFP_ATOMIC); -+ if (!nskb) { -+ dst_release(&rt->u.dst); ++ if (!nskb) + return; -+ } -+ -+ dst_release(nskb->dst); -+ nskb->dst = &rt->u.dst; + + /* This packet will not be the same as the other: clear nf fields */ + nf_reset(nskb); + nskb->nfmark = 0; + skb_init_secmark(nskb); + ++ skb_shinfo(nskb)->gso_size = 0; ++ skb_shinfo(nskb)->gso_segs = 0; ++ skb_shinfo(nskb)->gso_type = 0; ++ + tcph = (struct tcphdr *)((u_int32_t*)nskb->nh.iph + nskb->nh.iph->ihl); + + /* Swap source and dest */ @@ -490,12 +530,34 @@ diff -ruN linux-2.6.19.1.orig/net/netfilter/xt_DELUDE.c linux-2.6.19.1/net/netfi + skb_trim(nskb, nskb->nh.iph->ihl*4 + sizeof(struct tcphdr)); + nskb->nh.iph->tot_len = htons(nskb->len); + -+ tcph->seq = oth->ack_seq; -+ tcph->ack_seq = 0; ++ if(oth->syn && !oth->ack && !oth->rst && !oth->fin) { ++ /* DELUDE essential part */ ++ tcph->ack_seq = htonl(ntohl(oth->seq) + oth->syn + oth->fin + ++ oldskb->len - oldskb->nh.iph->ihl * 4 - ++ (oth->doff << 2)); ++ tcph->seq = htonl(secure_tcp_sequence_number( ++ nskb->nh.iph->saddr, nskb->nh.iph->daddr, ++ tcph->source, tcph->dest)); ++ tcph->ack = 1; ++ } else { ++ if(!tcph->ack) { ++ needs_ack = 1; ++ tcph->ack_seq = htonl(ntohl(oth->seq) + oth->syn + oth->fin ++ + oldskb->len - oldskb->nh.iph->ihl*4 ++ - (oth->doff<<2)); ++ tcph->seq = 0; ++ } else { ++ needs_ack = 0; ++ tcph->seq = oth->ack_seq; ++ tcph->ack_seq = 0; ++ } ++ ++ /* Reset flags */ ++ ((u_int8_t *)tcph)[13] = 0; ++ tcph->rst = 1; ++ tcph->ack = needs_ack; ++ } + -+ /* Reset flags */ -+ ((u_int8_t *)tcph)[13] = 0; -+ tcph->syn = tcph->ack = 1; + + tcph->window = 0; + tcph->urg_ptr = 0; @@ -508,12 +570,26 @@ diff -ruN linux-2.6.19.1.orig/net/netfilter/xt_DELUDE.c linux-2.6.19.1/net/netfi + csum_partial((char *)tcph, + sizeof(struct tcphdr), 0)); + -+ /* Adjust IP TTL, DF */ -+ nskb->nh.iph->ttl = dst_metric(nskb->dst, RTAX_HOPLIMIT); + /* Set DF, id = 0 */ + nskb->nh.iph->frag_off = htons(IP_DF); + nskb->nh.iph->id = 0; + ++ addr_type = RTN_UNSPEC; ++ if (hook != NF_IP_FORWARD ++#ifdef CONFIG_BRIDGE_NETFILTER ++ || (nskb->nf_bridge && nskb->nf_bridge->mask & BRNF_BRIDGED) ++#endif ++ ) ++ addr_type = RTN_LOCAL; ++ ++ if (ip_route_me_harder(&nskb, addr_type)) ++ goto free_nskb; ++ ++ nskb->ip_summed = CHECKSUM_NONE; ++ ++ /* Adjust IP TTL */ ++ nskb->nh.iph->ttl = dst_metric(nskb->dst, RTAX_HOPLIMIT); ++ + /* Adjust IP checksum */ + nskb->nh.iph->check = 0; + nskb->nh.iph->check = ip_fast_csum((unsigned char *)nskb->nh.iph, @@ -531,7 +607,6 @@ diff -ruN linux-2.6.19.1.orig/net/netfilter/xt_DELUDE.c linux-2.6.19.1/net/netfi + + free_nskb: + kfree_skb(nskb); -+ return; +} + +static unsigned int xt_delude_target(struct sk_buff **pskb, @@ -589,19 +664,21 @@ diff -ruN linux-2.6.19.1.orig/net/netfilter/xt_DELUDE.c linux-2.6.19.1/net/netfi + +module_init(xt_delude_init); +module_exit(xt_delude_exit); -+MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Jan Engelhardt "); +MODULE_DESCRIPTION("netfilter DELUDE target"); -diff -ruN linux-2.6.19.1.orig/net/netfilter/xt_portscan.c linux-2.6.19.1/net/netfilter/xt_portscan.c ---- linux-2.6.19.1.orig/net/netfilter/xt_portscan.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.19.1/net/netfilter/xt_portscan.c 2007-01-11 13:28:14.407920893 +0100 -@@ -0,0 +1,282 @@ ++MODULE_LICENSE("GPL"); ++MODULE_ALIAS("ipt_DELUDE"); +diff -Nur linux-2.6.21.1/net/netfilter/xt_portscan.c linux-2.6.21.1-owrt/net/netfilter/xt_portscan.c +--- linux-2.6.21.1/net/netfilter/xt_portscan.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/net/netfilter/xt_portscan.c 2007-05-14 14:37:35.000000000 +0200 +@@ -0,0 +1,272 @@ +/* -+ portscan match for netfilter ++ portscan match for netfilter + -+ Written by Jan Engelhardt, 2006 - 2007 -+ released under the terms of the GNU General Public -+ License version 2.x and only versions 2.x. ++ Written by Jan Engelhardt, 2006 - 2007 ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License version 2 as ++ published by the Free Software Foundation. +*/ +#include +#include @@ -614,22 +691,11 @@ diff -ruN linux-2.6.19.1.orig/net/netfilter/xt_portscan.c linux-2.6.19.1/net/net +#include +#include +#include -+#if defined(CONFIG_IP_NF_CONNTRACK) || defined(CONFIG_IP_NF_CONNTRACK_MODULE) -+# include -+#else /* linux-2.6.20+ */ -+# include -+#endif ++#include +#include ++#include +#define PFX KBUILD_MODNAME ": " + -+/* Out of tree workarounds */ -+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18) -+# define HAVE_MATCHINFOSIZE 1 -+#endif -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20) -+# define nfmark mark -+#endif -+ +enum { + TCP_FLAGS_ALL3 = TCP_FLAG_FIN | TCP_FLAG_RST | TCP_FLAG_SYN, + TCP_FLAGS_ALL4 = TCP_FLAGS_ALL3 | TCP_FLAG_ACK, diff --git a/target/linux/generic-2.6/patches/200-sched_esfq.patch b/target/linux/generic-2.6/patches/200-sched_esfq.patch index 6830b833ad..dba20cff28 100644 --- a/target/linux/generic-2.6/patches/200-sched_esfq.patch +++ b/target/linux/generic-2.6/patches/200-sched_esfq.patch @@ -1,7 +1,7 @@ -diff -urN linux-2.6.19.old/include/linux/pkt_sched.h linux-2.6.19.dev/include/linux/pkt_sched.h ---- linux-2.6.19.old/include/linux/pkt_sched.h 2006-11-29 22:57:37.000000000 +0100 -+++ linux-2.6.19.dev/include/linux/pkt_sched.h 2006-12-14 03:13:51.000000000 +0100 -@@ -146,8 +146,35 @@ +diff -Naur linux-2.6.20.orig/include/linux/pkt_sched.h linux-2.6.20/include/linux/pkt_sched.h +--- linux-2.6.20.orig/include/linux/pkt_sched.h 2007-02-04 10:44:54.000000000 -0800 ++++ linux-2.6.20/include/linux/pkt_sched.h 2007-02-14 23:58:41.000000000 -0800 +@@ -146,8 +146,40 @@ * * The only reason for this is efficiency, it is possible * to change these parameters in compile time. @@ -22,6 +22,11 @@ diff -urN linux-2.6.19.old/include/linux/pkt_sched.h linux-2.6.19.dev/include/li + TCA_SFQ_HASH_DSTDIR, + TCA_SFQ_HASH_SRCDIR, + TCA_SFQ_HASH_FWMARKDIR, ++ /* conntrack */ ++ TCA_SFQ_HASH_CTORIGDST, ++ TCA_SFQ_HASH_CTORIGSRC, ++ TCA_SFQ_HASH_CTREPLDST, ++ TCA_SFQ_HASH_CTREPLSRC, +}; + +struct tc_esfq_qopt @@ -37,31 +42,29 @@ diff -urN linux-2.6.19.old/include/linux/pkt_sched.h linux-2.6.19.dev/include/li /* RED section */ enum -diff -urN linux-2.6.19.old/net/sched/Kconfig linux-2.6.19.dev/net/sched/Kconfig ---- linux-2.6.19.old/net/sched/Kconfig 2006-11-29 22:57:37.000000000 +0100 -+++ linux-2.6.19.dev/net/sched/Kconfig 2006-12-14 03:13:51.000000000 +0100 -@@ -185,6 +185,28 @@ +diff -Naur linux-2.6.20.orig/net/sched/Kconfig linux-2.6.20/net/sched/Kconfig +--- linux-2.6.20.orig/net/sched/Kconfig 2007-02-04 10:44:54.000000000 -0800 ++++ linux-2.6.20/net/sched/Kconfig 2007-02-14 23:58:41.000000000 -0800 +@@ -189,6 +189,26 @@ To compile this code as a module, choose M here: the module will be called sch_sfq. +config NET_SCH_ESFQ -+ tristate "ESFQ queue" -+ depends on NET_SCHED ++ tristate "Enhanced Stochastic Fairness Queueing (ESFQ)" + ---help--- + Say Y here if you want to use the Enhanced Stochastic Fairness + Queueing (ESFQ) packet scheduling algorithm for some of your network + devices or as a leaf discipline for a classful qdisc such as HTB or + CBQ (see the top of for details and + references to the SFQ algorithm). -+ ++ + This is an enchanced SFQ version which allows you to control some -+ hardcoded values in the SFQ scheduler: queue depth, hash table size, -+ and queues limit. -+ -+ ESFQ also adds control to the hash function used to identify packet -+ flows. The original SFQ hashes by individual flow (TCP session or UDP -+ stream); ESFQ can hash by src or dst IP as well, which can be more -+ fair to users in some networking situations. ++ hardcoded values in the SFQ scheduler. ++ ++ ESFQ also adds control of the hash function used to identify packet ++ flows. The original SFQ discipline hashes by connection; ESFQ add ++ several other hashing methods, such as by src IP or by dst IP, which ++ can be more fair to users in some networking situations. + + To compile this code as a module, choose M here: the + module will be called sch_esfq. @@ -69,10 +72,10 @@ diff -urN linux-2.6.19.old/net/sched/Kconfig linux-2.6.19.dev/net/sched/Kconfig config NET_SCH_TEQL tristate "True Link Equalizer (TEQL)" ---help--- -diff -urN linux-2.6.19.old/net/sched/Makefile linux-2.6.19.dev/net/sched/Makefile ---- linux-2.6.19.old/net/sched/Makefile 2006-11-29 22:57:37.000000000 +0100 -+++ linux-2.6.19.dev/net/sched/Makefile 2006-12-14 03:13:51.000000000 +0100 -@@ -23,6 +23,7 @@ +diff -Naur linux-2.6.20.orig/net/sched/Makefile linux-2.6.20/net/sched/Makefile +--- linux-2.6.20.orig/net/sched/Makefile 2007-02-04 10:44:54.000000000 -0800 ++++ linux-2.6.20/net/sched/Makefile 2007-02-14 23:58:41.000000000 -0800 +@@ -24,6 +24,7 @@ obj-$(CONFIG_NET_SCH_INGRESS) += sch_ingress.o obj-$(CONFIG_NET_SCH_DSMARK) += sch_dsmark.o obj-$(CONFIG_NET_SCH_SFQ) += sch_sfq.o @@ -80,10 +83,10 @@ diff -urN linux-2.6.19.old/net/sched/Makefile linux-2.6.19.dev/net/sched/Makefil obj-$(CONFIG_NET_SCH_TBF) += sch_tbf.o obj-$(CONFIG_NET_SCH_TEQL) += sch_teql.o obj-$(CONFIG_NET_SCH_PRIO) += sch_prio.o -diff -urN linux-2.6.19.old/net/sched/sch_esfq.c linux-2.6.19.dev/net/sched/sch_esfq.c ---- linux-2.6.19.old/net/sched/sch_esfq.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.19.dev/net/sched/sch_esfq.c 2006-12-14 03:13:51.000000000 +0100 -@@ -0,0 +1,644 @@ +diff -Naur linux-2.6.20.orig/net/sched/sch_esfq.c linux-2.6.20/net/sched/sch_esfq.c +--- linux-2.6.20.orig/net/sched/sch_esfq.c 1969-12-31 16:00:00.000000000 -0800 ++++ linux-2.6.20/net/sched/sch_esfq.c 2007-02-15 00:19:56.000000000 -0800 +@@ -0,0 +1,704 @@ +/* + * net/sched/sch_esfq.c Extended Stochastic Fairness Queueing discipline. + * @@ -103,12 +106,12 @@ diff -urN linux-2.6.19.old/net/sched/sch_esfq.c linux-2.6.19.dev/net/sched/sch_e + * + * Corey Hickey, + * Maintenance of the Linux 2.6 port. -+ * Added fwmark hash (thanks to Robert Kurjata) ++ * Added fwmark hash (thanks to Robert Kurjata). + * Added direct hashing for src, dst, and fwmark. ++ * Added usage of jhash. + * + */ + -+#include +#include +#include +#include @@ -135,12 +138,16 @@ diff -urN linux-2.6.19.old/net/sched/sch_esfq.c linux-2.6.19.dev/net/sched/sch_e +#include +#include +#include ++#include + ++#ifdef CONFIG_NF_CONNTRACK_ENABLED ++#include ++#endif + +/* Stochastic Fairness Queuing algorithm. + For more comments look at sch_sfq.c. + The difference is that you can change limit, depth, -+ hash table size and choose 7 hash types. ++ hash table size and choose alternate hash types. + + classic: same as in sch_sfq.c + dst: destination IP address @@ -149,9 +156,11 @@ diff -urN linux-2.6.19.old/net/sched/sch_esfq.c linux-2.6.19.dev/net/sched/sch_e + dst_direct: + src_direct: + fwmark_direct: direct hashing of the above sources ++ ctorigdst: original destination IP address ++ ctorigsrc: original source IP address ++ ctrepldst: reply destination IP address ++ ctreplsrc: reply source IP + -+ TODO: -+ make sfq_change work. +*/ + + @@ -190,20 +199,24 @@ diff -urN linux-2.6.19.old/net/sched/sch_esfq.c linux-2.6.19.dev/net/sched/sch_e + unsigned dyn_range; /* saved range */ +}; + -+static __inline__ unsigned esfq_hash_u32(struct esfq_sched_data *q,u32 h) ++/* This contains the info we will hash. */ ++struct esfq_packet_info +{ -+ int pert = q->perturbation; -+ -+ if (pert) -+ h = (h<>(0x1F - pert)); -+ -+ h = ntohl(h) * 2654435761UL; -+ return h & (q->hash_divisor-1); -+} ++ u32 proto; /* protocol or port */ ++ u32 src; /* source from packet header */ ++ u32 dst; /* destination from packet header */ ++ u32 ctorigsrc; /* original source from conntrack */ ++ u32 ctorigdst; /* original destination from conntrack */ ++ u32 ctreplsrc; /* reply source from conntrack */ ++ u32 ctrepldst; /* reply destination from conntrack */ ++ u32 mark; /* netfilter mark (fwmark) */ ++}; + +/* Hash input values directly into the "nearest" slot, taking into account the + * range of input values seen. This is most useful when the hash table is at -+ * least as large as the range of possible values. */ ++ * least as large as the range of possible values. ++ * Note: this functionality was added before the change to using jhash, and may ++ * no longer be useful. */ +static __inline__ unsigned esfq_hash_direct(struct esfq_sched_data *q, u32 h) +{ + /* adjust minimum and maximum */ @@ -224,83 +237,128 @@ diff -urN linux-2.6.19.old/net/sched/sch_esfq.c linux-2.6.19.dev/net/sched/sch_e + return (h - q->dyn_min) * (q->hash_divisor - 1) / q->dyn_range; +} + -+static __inline__ unsigned esfq_fold_hash_classic(struct esfq_sched_data *q, u32 h, u32 h1) ++static __inline__ unsigned esfq_jhash_1word(struct esfq_sched_data *q,u32 a) +{ -+ int pert = q->perturbation; ++ return jhash_1word(a, q->perturbation) & (q->hash_divisor-1); ++} + -+ /* Have we any rotation primitives? If not, WHY? */ -+ h ^= (h1<>(0x1F - pert)); -+ h ^= h>>10; -+ return h & (q->hash_divisor-1); ++static __inline__ unsigned esfq_jhash_2words(struct esfq_sched_data *q, u32 a, u32 b) ++{ ++ return jhash_2words(a, b, q->perturbation) & (q->hash_divisor-1); +} + -+static unsigned esfq_hash(struct esfq_sched_data *q, struct sk_buff *skb) ++static __inline__ unsigned esfq_jhash_3words(struct esfq_sched_data *q, u32 a, u32 b, u32 c) +{ -+ u32 h, h2; -+ u32 hs; -+ u32 nfm; ++ return jhash_3words(a, b, c, q->perturbation) & (q->hash_divisor-1); ++} + ++ ++static unsigned esfq_hash(struct esfq_sched_data *q, struct sk_buff *skb) ++{ ++ struct esfq_packet_info info; ++#ifdef CONFIG_NF_CONNTRACK_ENABLED ++ enum ip_conntrack_info ctinfo; ++ struct nf_conn *ct = nf_ct_get(skb, &ctinfo); ++#endif ++ + switch (skb->protocol) { + case __constant_htons(ETH_P_IP): + { + struct iphdr *iph = skb->nh.iph; -+ h = iph->daddr; -+ hs = iph->saddr; -+ nfm = skb->nfmark; -+ h2 = hs^iph->protocol; ++ info.dst = iph->daddr; ++ info.src = iph->saddr; + if (!(iph->frag_off&htons(IP_MF|IP_OFFSET)) && + (iph->protocol == IPPROTO_TCP || + iph->protocol == IPPROTO_UDP || + iph->protocol == IPPROTO_SCTP || + iph->protocol == IPPROTO_DCCP || + iph->protocol == IPPROTO_ESP)) -+ h2 ^= *(((u32*)iph) + iph->ihl); ++ info.proto = *(((u32*)iph) + iph->ihl); ++ else ++ info.proto = iph->protocol; + break; + } + case __constant_htons(ETH_P_IPV6): + { + struct ipv6hdr *iph = skb->nh.ipv6h; -+ h = iph->daddr.s6_addr32[3]; -+ hs = iph->saddr.s6_addr32[3]; -+ nfm = skb->nfmark; -+ h2 = hs^iph->nexthdr; ++ /* Hash ipv6 addresses into a u32. This isn't ideal, ++ * but the code is simple. */ ++ info.dst = jhash2(iph->daddr.s6_addr32, 4, q->perturbation); ++ info.src = jhash2(iph->saddr.s6_addr32, 4, q->perturbation); + if (iph->nexthdr == IPPROTO_TCP || + iph->nexthdr == IPPROTO_UDP || + iph->nexthdr == IPPROTO_SCTP || + iph->nexthdr == IPPROTO_DCCP || + iph->nexthdr == IPPROTO_ESP) -+ h2 ^= *(u32*)&iph[1]; ++ info.proto = *(u32*)&iph[1]; ++ else ++ info.proto = iph->nexthdr; + break; + } + default: -+ h = (u32)(unsigned long)skb->dst; -+ hs = (u32)(unsigned long)skb->sk; -+ nfm = skb->nfmark; -+ h2 = hs^skb->protocol; ++ info.dst = (u32)(unsigned long)skb->dst; ++ info.src = (u32)(unsigned long)skb->sk; ++ info.proto = skb->protocol; ++ } ++ ++ info.mark = skb->mark; ++ ++#ifdef CONFIG_NF_CONNTRACK_ENABLED ++ /* defaults if there is no conntrack info */ ++ info.ctorigsrc = info.src; ++ info.ctorigdst = info.dst; ++ info.ctreplsrc = info.dst; ++ info.ctrepldst = info.src; ++ /* collect conntrack info */ ++ if (ct && ct != &nf_conntrack_untracked) { ++ if (skb->protocol == __constant_htons(ETH_P_IP)) { ++ info.ctorigsrc = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u3.ip; ++ info.ctorigdst = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.u3.ip; ++ info.ctreplsrc = ct->tuplehash[IP_CT_DIR_REPLY].tuple.src.u3.ip; ++ info.ctrepldst = ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u3.ip; ++ } ++ else if (skb->protocol == __constant_htons(ETH_P_IPV6)) { ++ /* Again, hash ipv6 addresses into a single u32. */ ++ info.ctorigsrc = jhash2(ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u3.ip6, 4, q->perturbation); ++ info.ctorigdst = jhash2(ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.u3.ip6, 4, q->perturbation); ++ info.ctreplsrc = jhash2(ct->tuplehash[IP_CT_DIR_REPLY].tuple.src.u3.ip6, 4, q->perturbation); ++ info.ctrepldst = jhash2(ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u3.ip6, 4, q->perturbation); ++ } ++ + } ++#endif ++ + switch(q->hash_kind) + { + case TCA_SFQ_HASH_CLASSIC: -+ return esfq_fold_hash_classic(q, h, h2); ++ return esfq_jhash_3words(q, info.dst, info.src, info.proto); + case TCA_SFQ_HASH_DST: -+ return esfq_hash_u32(q,h); ++ return esfq_jhash_1word(q, info.dst); + case TCA_SFQ_HASH_DSTDIR: -+ return esfq_hash_direct(q, ntohl(h)); ++ return esfq_hash_direct(q, ntohl(info.dst)); + case TCA_SFQ_HASH_SRC: -+ return esfq_hash_u32(q,hs); ++ return esfq_jhash_1word(q, info.src); + case TCA_SFQ_HASH_SRCDIR: -+ return esfq_hash_direct(q, ntohl(hs)); -+#ifdef CONFIG_NETFILTER ++ return esfq_hash_direct(q, ntohl(info.src)); + case TCA_SFQ_HASH_FWMARK: -+ return esfq_hash_u32(q,nfm); ++ return esfq_jhash_1word(q, info.mark); + case TCA_SFQ_HASH_FWMARKDIR: -+ return esfq_hash_direct(q,nfm); ++ return esfq_hash_direct(q, info.mark); ++#ifdef CONFIG_NF_CONNTRACK_ENABLED ++ case TCA_SFQ_HASH_CTORIGDST: ++ return esfq_jhash_1word(q, info.ctorigdst); ++ case TCA_SFQ_HASH_CTORIGSRC: ++ return esfq_jhash_1word(q, info.ctorigsrc); ++ case TCA_SFQ_HASH_CTREPLDST: ++ return esfq_jhash_1word(q, info.ctrepldst); ++ case TCA_SFQ_HASH_CTREPLSRC: ++ return esfq_jhash_1word(q, info.ctreplsrc); +#endif + default: + if (net_ratelimit()) + printk(KERN_WARNING "ESFQ: Unknown hash method. Falling back to classic.\n"); + } -+ return esfq_fold_hash_classic(q, h, h2); ++ return esfq_jhash_3words(q, info.dst, info.src, info.proto); +} + +static inline void esfq_link(struct esfq_sched_data *q, esfq_index x) @@ -365,6 +423,7 @@ diff -urN linux-2.6.19.old/net/sched/sch_esfq.c linux-2.6.19.dev/net/sched/sch_e + esfq_dec(q, x); + sch->q.qlen--; + sch->qstats.drops++; ++ sch->qstats.backlog -= len; + return len; + } + @@ -381,6 +440,7 @@ diff -urN linux-2.6.19.old/net/sched/sch_esfq.c linux-2.6.19.dev/net/sched/sch_e + sch->q.qlen--; + q->ht[q->hash[d]] = q->depth; + sch->qstats.drops++; ++ sch->qstats.backlog -= len; + return len; + } + @@ -400,6 +460,7 @@ diff -urN linux-2.6.19.old/net/sched/sch_esfq.c linux-2.6.19.dev/net/sched/sch_e + q->ht[hash] = x = q->dep[depth].next; + q->hash[x] = hash; + } ++ sch->qstats.backlog += skb->len; + __skb_queue_tail(&q->qs[x], skb); + esfq_inc(q, x); + if (q->qs[x].qlen == 1) { /* The flow is new */ @@ -436,6 +497,7 @@ diff -urN linux-2.6.19.old/net/sched/sch_esfq.c linux-2.6.19.dev/net/sched/sch_e + q->ht[hash] = x = q->dep[depth].next; + q->hash[x] = hash; + } ++ sch->qstats.backlog += skb->len; + __skb_queue_head(&q->qs[x], skb); + esfq_inc(q, x); + if (q->qs[x].qlen == 1) { /* The flow is new */ @@ -480,6 +542,7 @@ diff -urN linux-2.6.19.old/net/sched/sch_esfq.c linux-2.6.19.dev/net/sched/sch_e + skb = __skb_dequeue(&q->qs[a]); + esfq_dec(q, a); + sch->q.qlen--; ++ sch->qstats.backlog -= skb->len; + + /* Is the slot empty? */ + if (q->qs[a].qlen == 0) { @@ -542,7 +605,7 @@ diff -urN linux-2.6.19.old/net/sched/sch_esfq.c linux-2.6.19.dev/net/sched/sch_e + + if (ctl->hash_kind) { + q->hash_kind = ctl->hash_kind; -+ if (q->hash_kind != TCA_SFQ_HASH_CLASSIC) ++ if (q->hash_kind != TCA_SFQ_HASH_CLASSIC) + q->perturb_period = 0; + } + @@ -566,7 +629,7 @@ diff -urN linux-2.6.19.old/net/sched/sch_esfq.c linux-2.6.19.dev/net/sched/sch_e +{ + struct esfq_sched_data *q = qdisc_priv(sch); + struct tc_esfq_qopt *ctl; -+ esfq_index p = ~0UL/2; ++ esfq_index p = ~0U/2; + int i; + + if (opt && opt->rta_len < RTA_LENGTH(sizeof(*ctl))) diff --git a/target/linux/generic-2.6/patches/201-multiple_default_gateways.patch b/target/linux/generic-2.6/patches/201-multiple_default_gateways.patch index 4a3e327288..8b6612f4cf 100644 --- a/target/linux/generic-2.6/patches/201-multiple_default_gateways.patch +++ b/target/linux/generic-2.6/patches/201-multiple_default_gateways.patch @@ -1,7 +1,7 @@ -diff -urN linux-2.6.19.old/include/linux/netfilter_ipv4/ip_nat.h linux-2.6.19.dev/include/linux/netfilter_ipv4/ip_nat.h ---- linux-2.6.19.old/include/linux/netfilter_ipv4/ip_nat.h 2006-11-29 22:57:37.000000000 +0100 -+++ linux-2.6.19.dev/include/linux/netfilter_ipv4/ip_nat.h 2006-12-14 03:13:53.000000000 +0100 -@@ -63,6 +63,13 @@ +diff -urN linux-2.6.21.1/include/linux/netfilter_ipv4/ip_nat.h linux-2.6.21.1.new/include/linux/netfilter_ipv4/ip_nat.h +--- linux-2.6.21.1/include/linux/netfilter_ipv4/ip_nat.h 2007-04-27 23:49:26.000000000 +0200 ++++ linux-2.6.21.1.new/include/linux/netfilter_ipv4/ip_nat.h 2007-05-14 12:57:39.000000000 +0200 +@@ -64,6 +64,13 @@ struct ip_conntrack; @@ -15,9 +15,9 @@ diff -urN linux-2.6.19.old/include/linux/netfilter_ipv4/ip_nat.h linux-2.6.19.de /* Set up the info structure to map into this range. */ extern unsigned int ip_nat_setup_info(struct ip_conntrack *conntrack, const struct ip_nat_range *range, -diff -urN linux-2.6.19.old/include/linux/rtnetlink.h linux-2.6.19.dev/include/linux/rtnetlink.h ---- linux-2.6.19.old/include/linux/rtnetlink.h 2006-11-29 22:57:37.000000000 +0100 -+++ linux-2.6.19.dev/include/linux/rtnetlink.h 2006-12-14 03:13:53.000000000 +0100 +diff -urN linux-2.6.21.1/include/linux/rtnetlink.h linux-2.6.21.1.new/include/linux/rtnetlink.h +--- linux-2.6.21.1/include/linux/rtnetlink.h 2007-04-27 23:49:26.000000000 +0200 ++++ linux-2.6.21.1.new/include/linux/rtnetlink.h 2007-05-14 12:57:39.000000000 +0200 @@ -293,6 +293,8 @@ #define RTNH_F_DEAD 1 /* Nexthop is dead (used by multipath) */ #define RTNH_F_PERVASIVE 2 /* Do recursive gateway lookup */ @@ -27,916 +27,31 @@ diff -urN linux-2.6.19.old/include/linux/rtnetlink.h linux-2.6.19.dev/include/li /* Macros to handle hexthops */ -diff -urN linux-2.6.19.old/include/net/flow.h linux-2.6.19.dev/include/net/flow.h ---- linux-2.6.19.old/include/net/flow.h 2006-11-29 22:57:37.000000000 +0100 -+++ linux-2.6.19.dev/include/net/flow.h 2006-12-14 03:13:53.000000000 +0100 +diff -urN linux-2.6.21.1/include/net/flow.h linux-2.6.21.1.new/include/net/flow.h +--- linux-2.6.21.1/include/net/flow.h 2007-04-27 23:49:26.000000000 +0200 ++++ linux-2.6.21.1.new/include/net/flow.h 2007-05-14 13:00:27.000000000 +0200 @@ -19,6 +19,8 @@ + struct { __be32 daddr; __be32 saddr; - __u32 fwmark; + __u32 lsrc; + __u32 gw; __u8 tos; __u8 scope; } ip4_u; -@@ -48,6 +50,8 @@ +@@ -43,6 +45,8 @@ + #define fl6_flowlabel nl_u.ip6_u.flowlabel #define fl4_dst nl_u.ip4_u.daddr #define fl4_src nl_u.ip4_u.saddr - #define fl4_fwmark nl_u.ip4_u.fwmark -+#define fl4_lsrc nl_u.ip4_u.lsrc ++#define fl4_lsrc nl_u.ip4_u.lsrc +#define fl4_gw nl_u.ip4_u.gw #define fl4_tos nl_u.ip4_u.tos #define fl4_scope nl_u.ip4_u.scope -diff -urN linux-2.6.19.old/include/net/ip_fib.h linux-2.6.19.dev/include/net/ip_fib.h ---- linux-2.6.19.old/include/net/ip_fib.h 2006-11-29 22:57:37.000000000 +0100 -+++ linux-2.6.19.dev/include/net/ip_fib.h 2006-12-14 03:13:53.000000000 +0100 -@@ -196,7 +196,8 @@ - - static inline void fib_select_default(const struct flowi *flp, struct fib_result *res) - { -- if (FIB_RES_GW(*res) && FIB_RES_NH(*res).nh_scope == RT_SCOPE_LINK) -+ if ((FIB_RES_GW(*res) && FIB_RES_NH(*res).nh_scope == RT_SCOPE_LINK) || -+ FIB_RES_NH(*res).nh_scope == RT_SCOPE_HOST) - ip_fib_main_table->tb_select_default(ip_fib_main_table, flp, res); - } - -@@ -212,6 +213,8 @@ - - #endif /* CONFIG_IP_MULTIPLE_TABLES */ - -+extern int fib_result_table(struct fib_result *res); -+ - /* Exported by fib_frontend.c */ - extern struct nla_policy rtm_ipv4_policy[]; - extern void ip_fib_init(void); -@@ -284,4 +287,6 @@ - extern void fib_proc_exit(void); - #endif - -+extern rwlock_t fib_nhflags_lock; -+ - #endif /* _NET_FIB_H */ -diff -urN linux-2.6.19.old/include/net/route.h linux-2.6.19.dev/include/net/route.h ---- linux-2.6.19.old/include/net/route.h 2006-11-29 22:57:37.000000000 +0100 -+++ linux-2.6.19.dev/include/net/route.h 2006-12-14 03:13:53.000000000 +0100 -@@ -117,6 +117,7 @@ - extern int ip_route_output_key(struct rtable **, struct flowi *flp); - extern int ip_route_output_flow(struct rtable **rp, struct flowi *flp, struct sock *sk, int flags); - extern int ip_route_input(struct sk_buff*, __be32 dst, __be32 src, u8 tos, struct net_device *devin); -+extern int ip_route_input_lookup(struct sk_buff*, u32 dst, u32 src, u8 tos, struct net_device *devin, u32 lsrc); - extern unsigned short ip_rt_frag_needed(struct iphdr *iph, unsigned short new_mtu); - extern void ip_rt_send_redirect(struct sk_buff *skb); - -diff -urN linux-2.6.19.old/net/ipv4/fib_frontend.c linux-2.6.19.dev/net/ipv4/fib_frontend.c ---- linux-2.6.19.old/net/ipv4/fib_frontend.c 2006-11-29 22:57:37.000000000 +0100 -+++ linux-2.6.19.dev/net/ipv4/fib_frontend.c 2006-12-14 03:13:53.000000000 +0100 -@@ -58,6 +58,8 @@ - #define FIB_TABLE_HASHSZ 1 - static struct hlist_head fib_table_hash[FIB_TABLE_HASHSZ]; - -+#define FIB_RES_TABLE(r) (RT_TABLE_MAIN) -+ - #else - - #define FIB_TABLE_HASHSZ 256 -@@ -100,6 +102,9 @@ - rcu_read_unlock(); - return NULL; - } -+ -+#define FIB_RES_TABLE(r) (fib_result_table(r)) -+ - #endif /* CONFIG_IP_MULTIPLE_TABLES */ - - static void fib_flush(void) -@@ -190,6 +195,9 @@ - .tos = tos } }, - .iif = oif }; - struct fib_result res; -+ int table; -+ unsigned char prefixlen; -+ unsigned char scope; - int no_addr, rpf; - int ret; - -@@ -211,31 +219,35 @@ - goto e_inval_res; - *spec_dst = FIB_RES_PREFSRC(res); - fib_combine_itag(itag, &res); --#ifdef CONFIG_IP_ROUTE_MULTIPATH -- if (FIB_RES_DEV(res) == dev || res.fi->fib_nhs > 1) --#else - if (FIB_RES_DEV(res) == dev) --#endif - { - ret = FIB_RES_NH(res).nh_scope >= RT_SCOPE_HOST; - fib_res_put(&res); - return ret; - } -+ table = FIB_RES_TABLE(&res); -+ prefixlen = res.prefixlen; -+ scope = res.scope; - fib_res_put(&res); - if (no_addr) - goto last_resort; -- if (rpf) -- goto e_inval; - fl.oif = dev->ifindex; - - ret = 0; - if (fib_lookup(&fl, &res) == 0) { -- if (res.type == RTN_UNICAST) { -+ if (res.type == RTN_UNICAST && -+ ((table == FIB_RES_TABLE(&res) && -+ res.prefixlen >= prefixlen && res.scope >= scope) || -+ !rpf)) { - *spec_dst = FIB_RES_PREFSRC(res); - ret = FIB_RES_NH(res).nh_scope >= RT_SCOPE_HOST; -+ fib_res_put(&res); -+ return ret; - } - fib_res_put(&res); - } -+ if (rpf) -+ goto e_inval; - return ret; - - last_resort: -@@ -836,9 +848,7 @@ - switch (event) { - case NETDEV_UP: - fib_add_ifaddr(ifa); --#ifdef CONFIG_IP_ROUTE_MULTIPATH - fib_sync_up(ifa->ifa_dev->dev); --#endif - rt_cache_flush(-1); - break; - case NETDEV_DOWN: -@@ -874,9 +884,7 @@ - for_ifa(in_dev) { - fib_add_ifaddr(ifa); - } endfor_ifa(in_dev); --#ifdef CONFIG_IP_ROUTE_MULTIPATH - fib_sync_up(dev); --#endif - rt_cache_flush(-1); - break; - case NETDEV_DOWN: -diff -urN linux-2.6.19.old/net/ipv4/fib_hash.c linux-2.6.19.dev/net/ipv4/fib_hash.c ---- linux-2.6.19.old/net/ipv4/fib_hash.c 2006-11-29 22:57:37.000000000 +0100 -+++ linux-2.6.19.dev/net/ipv4/fib_hash.c 2006-12-14 03:13:53.000000000 +0100 -@@ -275,30 +275,38 @@ - return err; - } - --static int fn_hash_last_dflt=-1; -- - static void - fn_hash_select_default(struct fib_table *tb, const struct flowi *flp, struct fib_result *res) - { -- int order, last_idx; -+ int order, last_idx, last_dflt, last_nhsel; -+ struct fib_alias *first_fa = NULL; -+ struct hlist_head *head; - struct hlist_node *node; - struct fib_node *f; - struct fib_info *fi = NULL; - struct fib_info *last_resort; - struct fn_hash *t = (struct fn_hash*)tb->tb_data; -- struct fn_zone *fz = t->fn_zones[0]; -+ struct fn_zone *fz = t->fn_zones[res->prefixlen]; -+ u32 k; - - if (fz == NULL) - return; - -+ k = fz_key(flp->fl4_dst, fz); -+ last_dflt = -2; -+ last_nhsel = 0; - last_idx = -1; - last_resort = NULL; - order = -1; - - read_lock(&fib_hash_lock); -- hlist_for_each_entry(f, node, &fz->fz_hash[0], fn_hash) { -+ head = &fz->fz_hash[fn_hash(k, fz)]; -+ hlist_for_each_entry(f, node, head, fn_hash) { - struct fib_alias *fa; - -+ if (f->fn_key != k) -+ continue; -+ - list_for_each_entry(fa, &f->fn_alias, fa_list) { - struct fib_info *next_fi = fa->fa_info; - -@@ -306,41 +314,52 @@ - fa->fa_type != RTN_UNICAST) - continue; - -+ if (fa->fa_tos && -+ fa->fa_tos != flp->fl4_tos) -+ continue; - if (next_fi->fib_priority > res->fi->fib_priority) - break; -- if (!next_fi->fib_nh[0].nh_gw || -- next_fi->fib_nh[0].nh_scope != RT_SCOPE_LINK) -- continue; - fa->fa_state |= FA_S_ACCESSED; - -- if (fi == NULL) { -- if (next_fi != res->fi) -- break; -- } else if (!fib_detect_death(fi, order, &last_resort, -- &last_idx, &fn_hash_last_dflt)) { -+ if (!first_fa) { -+ last_dflt = fa->fa_last_dflt; -+ first_fa = fa; -+ } -+ if (fi && !fib_detect_death(fi, order, &last_resort, -+ &last_idx, &last_dflt, &last_nhsel, flp)) { - if (res->fi) - fib_info_put(res->fi); - res->fi = fi; - atomic_inc(&fi->fib_clntref); -- fn_hash_last_dflt = order; -+ first_fa->fa_last_dflt = order; - goto out; - } - fi = next_fi; - order++; - } -+ break; - } - - if (order <= 0 || fi == NULL) { -- fn_hash_last_dflt = -1; -+ if (fi && fi->fib_nhs > 1 && -+ fib_detect_death(fi, order, &last_resort, &last_idx, -+ &last_dflt, &last_nhsel, flp) && -+ last_resort == fi) { -+ read_lock_bh(&fib_nhflags_lock); -+ fi->fib_nh[last_nhsel].nh_flags &= ~RTNH_F_SUSPECT; -+ read_unlock_bh(&fib_nhflags_lock); -+ } -+ if (first_fa) first_fa->fa_last_dflt = -1; - goto out; - } - -- if (!fib_detect_death(fi, order, &last_resort, &last_idx, &fn_hash_last_dflt)) { -+ if (!fib_detect_death(fi, order, &last_resort, &last_idx, -+ &last_dflt, &last_nhsel, flp)) { - if (res->fi) - fib_info_put(res->fi); - res->fi = fi; - atomic_inc(&fi->fib_clntref); -- fn_hash_last_dflt = order; -+ first_fa->fa_last_dflt = order; - goto out; - } - -@@ -350,8 +369,11 @@ - res->fi = last_resort; - if (last_resort) - atomic_inc(&last_resort->fib_clntref); -+ read_lock_bh(&fib_nhflags_lock); -+ last_resort->fib_nh[last_nhsel].nh_flags &= ~RTNH_F_SUSPECT; -+ read_unlock_bh(&fib_nhflags_lock); -+ first_fa->fa_last_dflt = last_idx; - } -- fn_hash_last_dflt = last_idx; - out: - read_unlock(&fib_hash_lock); - } -@@ -447,6 +469,7 @@ - write_lock_bh(&fib_hash_lock); - fi_drop = fa->fa_info; - fa->fa_info = fi; -+ fa->fa_last_dflt = -1; - fa->fa_type = cfg->fc_type; - fa->fa_scope = cfg->fc_scope; - state = fa->fa_state; -@@ -506,6 +529,7 @@ - new_fa->fa_type = cfg->fc_type; - new_fa->fa_scope = cfg->fc_scope; - new_fa->fa_state = 0; -+ new_fa->fa_last_dflt = -1; - - /* - * Insert new entry to the list. -diff -urN linux-2.6.19.old/net/ipv4/fib_lookup.h linux-2.6.19.dev/net/ipv4/fib_lookup.h ---- linux-2.6.19.old/net/ipv4/fib_lookup.h 2006-11-29 22:57:37.000000000 +0100 -+++ linux-2.6.19.dev/net/ipv4/fib_lookup.h 2006-12-14 03:13:53.000000000 +0100 -@@ -9,6 +9,7 @@ - struct list_head fa_list; - struct rcu_head rcu; - struct fib_info *fa_info; -+ int fa_last_dflt; - u8 fa_tos; - u8 fa_type; - u8 fa_scope; -@@ -35,6 +36,7 @@ - u8 tos, u32 prio); - extern int fib_detect_death(struct fib_info *fi, int order, - struct fib_info **last_resort, -- int *last_idx, int *dflt); -+ int *last_idx, int *dflt, int *last_nhsel, -+ const struct flowi *flp); - - #endif /* _FIB_LOOKUP_H */ -diff -urN linux-2.6.19.old/net/ipv4/fib_rules.c linux-2.6.19.dev/net/ipv4/fib_rules.c ---- linux-2.6.19.old/net/ipv4/fib_rules.c 2006-11-29 22:57:37.000000000 +0100 -+++ linux-2.6.19.dev/net/ipv4/fib_rules.c 2006-12-14 03:13:53.000000000 +0100 -@@ -89,6 +89,11 @@ - } - #endif - -+int fib_result_table(struct fib_result *res) -+{ -+ return res->r->table; -+} -+ - int fib_lookup(struct flowi *flp, struct fib_result *res) - { - struct fib_lookup_arg arg = { -@@ -140,7 +145,8 @@ - void fib_select_default(const struct flowi *flp, struct fib_result *res) - { - if (res->r && res->r->action == FR_ACT_TO_TBL && -- FIB_RES_GW(*res) && FIB_RES_NH(*res).nh_scope == RT_SCOPE_LINK) { -+ ((FIB_RES_GW(*res) && FIB_RES_NH(*res).nh_scope == RT_SCOPE_LINK) || -+ FIB_RES_NH(*res).nh_scope == RT_SCOPE_HOST)) { - struct fib_table *tb; - if ((tb = fib_get_table(res->r->table)) != NULL) - tb->tb_select_default(tb, flp, res); -diff -urN linux-2.6.19.old/net/ipv4/fib_semantics.c linux-2.6.19.dev/net/ipv4/fib_semantics.c ---- linux-2.6.19.old/net/ipv4/fib_semantics.c 2006-11-29 22:57:37.000000000 +0100 -+++ linux-2.6.19.dev/net/ipv4/fib_semantics.c 2006-12-14 03:13:53.000000000 +0100 -@@ -55,6 +55,7 @@ - static struct hlist_head *fib_info_laddrhash; - static unsigned int fib_hash_size; - static unsigned int fib_info_cnt; -+rwlock_t fib_nhflags_lock = RW_LOCK_UNLOCKED; - - #define DEVINDEX_HASHBITS 8 - #define DEVINDEX_HASHSIZE (1U << DEVINDEX_HASHBITS) -@@ -190,7 +191,7 @@ - #ifdef CONFIG_NET_CLS_ROUTE - nh->nh_tclassid != onh->nh_tclassid || - #endif -- ((nh->nh_flags^onh->nh_flags)&~RTNH_F_DEAD)) -+ ((nh->nh_flags^onh->nh_flags)&~RTNH_F_BADSTATE)) - return -1; - onh++; - } endfor_nexthops(fi); -@@ -227,7 +228,7 @@ - nfi->fib_priority == fi->fib_priority && - memcmp(nfi->fib_metrics, fi->fib_metrics, - sizeof(fi->fib_metrics)) == 0 && -- ((nfi->fib_flags^fi->fib_flags)&~RTNH_F_DEAD) == 0 && -+ ((nfi->fib_flags^fi->fib_flags)&~RTNH_F_BADSTATE) == 0 && - (nfi->fib_nhs == 0 || nh_comp(fi, nfi) == 0)) - return fi; - } -@@ -319,26 +320,70 @@ - } - - int fib_detect_death(struct fib_info *fi, int order, -- struct fib_info **last_resort, int *last_idx, int *dflt) -+ struct fib_info **last_resort, int *last_idx, int *dflt, -+ int *last_nhsel, const struct flowi *flp) - { - struct neighbour *n; -- int state = NUD_NONE; -+ int nhsel; -+ int state; -+ struct fib_nh * nh; -+ u32 dst; -+ int flag, dead = 1; -+ -+ /* change_nexthops(fi) { */ -+ for (nhsel = 0, nh = fi->fib_nh; nhsel < fi->fib_nhs; nh++, nhsel++) { -+ if (flp->oif && flp->oif != nh->nh_oif) -+ continue; -+ if (flp->fl4_gw && flp->fl4_gw != nh->nh_gw && nh->nh_gw && -+ nh->nh_scope == RT_SCOPE_LINK) -+ continue; -+ if (nh->nh_flags & RTNH_F_DEAD) -+ continue; - -- n = neigh_lookup(&arp_tbl, &fi->fib_nh[0].nh_gw, fi->fib_dev); -- if (n) { -- state = n->nud_state; -- neigh_release(n); -- } -- if (state==NUD_REACHABLE) -- return 0; -- if ((state&NUD_VALID) && order != *dflt) -- return 0; -- if ((state&NUD_VALID) || -- (*last_idx<0 && order > *dflt)) { -- *last_resort = fi; -- *last_idx = order; -+ flag = 0; -+ if (nh->nh_dev->flags & IFF_NOARP) { -+ dead = 0; -+ goto setfl; -+ } -+ -+ dst = nh->nh_gw; -+ if (!nh->nh_gw || nh->nh_scope != RT_SCOPE_LINK) -+ dst = flp->fl4_dst; -+ -+ state = NUD_NONE; -+ n = neigh_lookup(&arp_tbl, &dst, nh->nh_dev); -+ if (n) { -+ state = n->nud_state; -+ neigh_release(n); -+ } -+ if (state==NUD_REACHABLE || -+ ((state&NUD_VALID) && order != *dflt)) { -+ dead = 0; -+ goto setfl; -+ } -+ if (!(state&NUD_VALID)) -+ flag = 1; -+ if (!dead) -+ goto setfl; -+ if ((state&NUD_VALID) || -+ (*last_idx<0 && order >= *dflt)) { -+ *last_resort = fi; -+ *last_idx = order; -+ *last_nhsel = nhsel; -+ } -+ -+ setfl: -+ -+ read_lock_bh(&fib_nhflags_lock); -+ if (flag) -+ nh->nh_flags |= RTNH_F_SUSPECT; -+ else -+ nh->nh_flags &= ~RTNH_F_SUSPECT; -+ read_unlock_bh(&fib_nhflags_lock); - } -- return 1; -+ /* } endfor_nexthops(fi) */ -+ -+ return dead; - } - - #ifdef CONFIG_IP_ROUTE_MULTIPATH -@@ -508,8 +553,11 @@ - return -EINVAL; - if ((dev = __dev_get_by_index(nh->nh_oif)) == NULL) - return -ENODEV; -- if (!(dev->flags&IFF_UP)) -- return -ENETDOWN; -+ if (!(dev->flags&IFF_UP)) { -+ if (fi->fib_protocol != RTPROT_STATIC) -+ return -ENETDOWN; -+ nh->nh_flags |= RTNH_F_DEAD; -+ } - nh->nh_dev = dev; - dev_hold(dev); - nh->nh_scope = RT_SCOPE_LINK; -@@ -529,24 +577,48 @@ - /* It is not necessary, but requires a bit of thinking */ - if (fl.fl4_scope < RT_SCOPE_LINK) - fl.fl4_scope = RT_SCOPE_LINK; -- if ((err = fib_lookup(&fl, &res)) != 0) -- return err; -+ err = fib_lookup(&fl, &res); - } -- err = -EINVAL; -- if (res.type != RTN_UNICAST && res.type != RTN_LOCAL) -- goto out; -- nh->nh_scope = res.scope; -- nh->nh_oif = FIB_RES_OIF(res); -- if ((nh->nh_dev = FIB_RES_DEV(res)) == NULL) -- goto out; -- dev_hold(nh->nh_dev); -- err = -ENETDOWN; -- if (!(nh->nh_dev->flags & IFF_UP)) -- goto out; -- err = 0; -+ if (err) { -+ struct in_device *in_dev; -+ -+ if (err != -ENETUNREACH || -+ fi->fib_protocol != RTPROT_STATIC) -+ return err; -+ -+ in_dev = inetdev_by_index(nh->nh_oif); -+ if (in_dev == NULL || -+ in_dev->dev->flags & IFF_UP) { -+ if (in_dev) -+ in_dev_put(in_dev); -+ return err; -+ } -+ nh->nh_flags |= RTNH_F_DEAD; -+ nh->nh_scope = RT_SCOPE_LINK; -+ nh->nh_dev = in_dev->dev; -+ dev_hold(nh->nh_dev); -+ in_dev_put(in_dev); -+ } else { -+ err = -EINVAL; -+ if (res.type != RTN_UNICAST && res.type != RTN_LOCAL) -+ goto out; -+ nh->nh_scope = res.scope; -+ nh->nh_oif = FIB_RES_OIF(res); -+ if ((nh->nh_dev = FIB_RES_DEV(res)) == NULL) -+ goto out; -+ dev_hold(nh->nh_dev); -+ if (!(nh->nh_dev->flags & IFF_UP)) { -+ if (fi->fib_protocol != RTPROT_STATIC) { -+ err = -ENETDOWN; -+ goto out; -+ } -+ nh->nh_flags |= RTNH_F_DEAD; -+ } -+ err = 0; - out: -- fib_res_put(&res); -- return err; -+ fib_res_put(&res); -+ return err; -+ } - } else { - struct in_device *in_dev; - -@@ -557,8 +629,11 @@ - if (in_dev == NULL) - return -ENODEV; - if (!(in_dev->dev->flags&IFF_UP)) { -- in_dev_put(in_dev); -- return -ENETDOWN; -+ if (fi->fib_protocol != RTPROT_STATIC) { -+ in_dev_put(in_dev); -+ return -ENETDOWN; -+ } -+ nh->nh_flags |= RTNH_F_DEAD; - } - nh->nh_dev = in_dev->dev; - dev_hold(nh->nh_dev); -@@ -881,8 +956,12 @@ - for_nexthops(fi) { - if (nh->nh_flags&RTNH_F_DEAD) - continue; -- if (!flp->oif || flp->oif == nh->nh_oif) -- break; -+ if (flp->oif && flp->oif != nh->nh_oif) -+ continue; -+ if (flp->fl4_gw && flp->fl4_gw != nh->nh_gw && -+ nh->nh_gw && nh->nh_scope == RT_SCOPE_LINK) -+ continue; -+ break; - } - #ifdef CONFIG_IP_ROUTE_MULTIPATH - if (nhsel < fi->fib_nhs) { -@@ -1056,18 +1135,29 @@ - prev_fi = fi; - dead = 0; - change_nexthops(fi) { -- if (nh->nh_flags&RTNH_F_DEAD) -- dead++; -- else if (nh->nh_dev == dev && -- nh->nh_scope != scope) { -- nh->nh_flags |= RTNH_F_DEAD; -+ if (nh->nh_flags&RTNH_F_DEAD) { -+ if (fi->fib_protocol!=RTPROT_STATIC || -+ nh->nh_dev == NULL || -+ __in_dev_get_rtnl(nh->nh_dev) == NULL || -+ nh->nh_dev->flags&IFF_UP) -+ dead++; -+ } else if (nh->nh_dev == dev && -+ nh->nh_scope != scope) { -+ write_lock_bh(&fib_nhflags_lock); - #ifdef CONFIG_IP_ROUTE_MULTIPATH -- spin_lock_bh(&fib_multipath_lock); -+ spin_lock(&fib_multipath_lock); -+ nh->nh_flags |= RTNH_F_DEAD; - fi->fib_power -= nh->nh_power; - nh->nh_power = 0; -- spin_unlock_bh(&fib_multipath_lock); -+ spin_unlock(&fib_multipath_lock); -+#else -+ nh->nh_flags |= RTNH_F_DEAD; - #endif -- dead++; -+ write_unlock_bh(&fib_nhflags_lock); -+ if (fi->fib_protocol!=RTPROT_STATIC || -+ force || -+ __in_dev_get_rtnl(dev) == NULL) -+ dead++; - } - #ifdef CONFIG_IP_ROUTE_MULTIPATH - if (force > 1 && nh->nh_dev == dev) { -@@ -1086,11 +1176,8 @@ - return ret; - } - --#ifdef CONFIG_IP_ROUTE_MULTIPATH -- - /* -- Dead device goes up. We wake up dead nexthops. -- It takes sense only on multipath routes. -+ Dead device goes up or new address is added. We wake up dead nexthops. - */ - - int fib_sync_up(struct net_device *dev) -@@ -1100,8 +1187,10 @@ - struct hlist_head *head; - struct hlist_node *node; - struct fib_nh *nh; -- int ret; -+ struct fib_result res; -+ int ret, rep; - -+repeat: - if (!(dev->flags&IFF_UP)) - return 0; - -@@ -1109,6 +1198,7 @@ - hash = fib_devindex_hashfn(dev->ifindex); - head = &fib_info_devhash[hash]; - ret = 0; -+ rep = 0; - - hlist_for_each_entry(nh, node, head, nh_hash) { - struct fib_info *fi = nh->nh_parent; -@@ -1121,19 +1211,37 @@ - prev_fi = fi; - alive = 0; - change_nexthops(fi) { -- if (!(nh->nh_flags&RTNH_F_DEAD)) { -- alive++; -+ if (!(nh->nh_flags&RTNH_F_DEAD)) - continue; -- } - if (nh->nh_dev == NULL || !(nh->nh_dev->flags&IFF_UP)) - continue; - if (nh->nh_dev != dev || !__in_dev_get_rtnl(dev)) - continue; -+ if (nh->nh_gw && fi->fib_protocol == RTPROT_STATIC) { -+ struct flowi fl = { -+ .nl_u = { .ip4_u = -+ { .daddr = nh->nh_gw, -+ .scope = nh->nh_scope } }, -+ .oif = nh->nh_oif, -+ }; -+ if (fib_lookup(&fl, &res) != 0) -+ continue; -+ if (res.type != RTN_UNICAST && -+ res.type != RTN_LOCAL) { -+ fib_res_put(&res); -+ continue; -+ } -+ nh->nh_scope = res.scope; -+ fib_res_put(&res); -+ rep = 1; -+ } - alive++; -+#ifdef CONFIG_IP_ROUTE_MULTIPATH - spin_lock_bh(&fib_multipath_lock); - nh->nh_power = 0; - nh->nh_flags &= ~RTNH_F_DEAD; - spin_unlock_bh(&fib_multipath_lock); -+#endif - } endfor_nexthops(fi) - - if (alive > 0) { -@@ -1141,10 +1249,14 @@ - ret++; - } - } -+ if (rep) -+ goto repeat; - - return ret; - } - -+#ifdef CONFIG_IP_ROUTE_MULTIPATH -+ - /* - The algorithm is suboptimal, but it provides really - fair weighted route distribution. -@@ -1153,24 +1265,45 @@ - void fib_select_multipath(const struct flowi *flp, struct fib_result *res) - { - struct fib_info *fi = res->fi; -- int w; -+ int w, alive; - - spin_lock_bh(&fib_multipath_lock); -+ if (flp->oif) { -+ int sel = -1; -+ w = -1; -+ change_nexthops(fi) { -+ if (flp->oif != nh->nh_oif) -+ continue; -+ if (flp->fl4_gw && flp->fl4_gw != nh->nh_gw && -+ nh->nh_gw && nh->nh_scope == RT_SCOPE_LINK) -+ continue; -+ if (!(nh->nh_flags&RTNH_F_BADSTATE)) { -+ if (nh->nh_power > w) { -+ w = nh->nh_power; -+ sel = nhsel; -+ } -+ } -+ } endfor_nexthops(fi); -+ if (sel >= 0) { -+ spin_unlock_bh(&fib_multipath_lock); -+ res->nh_sel = sel; -+ return; -+ } -+ goto last_resort; -+ } -+ -+repeat: - if (fi->fib_power <= 0) { - int power = 0; - change_nexthops(fi) { -- if (!(nh->nh_flags&RTNH_F_DEAD)) { -+ if (!(nh->nh_flags&RTNH_F_BADSTATE)) { - power += nh->nh_weight; - nh->nh_power = nh->nh_weight; - } - } endfor_nexthops(fi); - fi->fib_power = power; -- if (power <= 0) { -- spin_unlock_bh(&fib_multipath_lock); -- /* Race condition: route has just become dead. */ -- res->nh_sel = 0; -- return; -- } -+ if (power <= 0) -+ goto last_resort; - } - - -@@ -1180,20 +1313,40 @@ - - w = jiffies % fi->fib_power; - -+ alive = 0; - change_nexthops(fi) { -- if (!(nh->nh_flags&RTNH_F_DEAD) && nh->nh_power) { -+ if (!(nh->nh_flags&RTNH_F_BADSTATE) && nh->nh_power) { - if ((w -= nh->nh_power) <= 0) { - nh->nh_power--; - fi->fib_power--; -- res->nh_sel = nhsel; - spin_unlock_bh(&fib_multipath_lock); -+ res->nh_sel = nhsel; - return; - } -+ alive = 1; -+ } -+ } endfor_nexthops(fi); -+ if (alive) { -+ fi->fib_power = 0; -+ goto repeat; -+ } -+ -+last_resort: -+ -+ for_nexthops(fi) { -+ if (!(nh->nh_flags&RTNH_F_DEAD)) { -+ if (flp->oif && flp->oif != nh->nh_oif) -+ continue; -+ if (flp->fl4_gw && flp->fl4_gw != nh->nh_gw && -+ nh->nh_gw && nh->nh_scope == RT_SCOPE_LINK) -+ continue; -+ spin_unlock_bh(&fib_multipath_lock); -+ res->nh_sel = nhsel; -+ return; - } - } endfor_nexthops(fi); - - /* Race condition: route has just become dead. */ -- res->nh_sel = 0; - spin_unlock_bh(&fib_multipath_lock); - } - #endif -diff -urN linux-2.6.19.old/net/ipv4/netfilter/ip_nat_core.c linux-2.6.19.dev/net/ipv4/netfilter/ip_nat_core.c ---- linux-2.6.19.old/net/ipv4/netfilter/ip_nat_core.c 2006-11-29 22:57:37.000000000 +0100 -+++ linux-2.6.19.dev/net/ipv4/netfilter/ip_nat_core.c 2006-12-14 03:13:53.000000000 +0100 -@@ -573,6 +573,53 @@ - EXPORT_SYMBOL_GPL(ip_nat_port_range_to_nfattr); - #endif - -+unsigned int -+ip_nat_route_input(unsigned int hooknum, -+ struct sk_buff **pskb, -+ const struct net_device *in, -+ const struct net_device *out, -+ int (*okfn)(struct sk_buff *)) -+{ -+ struct sk_buff *skb = *pskb; -+ struct iphdr *iph; -+ struct ip_conntrack *conn; -+ enum ip_conntrack_info ctinfo; -+ enum ip_conntrack_dir dir; -+ unsigned long statusbit; -+ u32 saddr; -+ -+ if (!(conn = ip_conntrack_get(skb, &ctinfo))) -+ return NF_ACCEPT; -+ -+ if (!(conn->status & IPS_NAT_DONE_MASK)) -+ return NF_ACCEPT; -+ dir = CTINFO2DIR(ctinfo); -+ statusbit = IPS_SRC_NAT; -+ if (dir == IP_CT_DIR_REPLY) -+ statusbit ^= IPS_NAT_MASK; -+ if (!(conn->status & statusbit)) -+ return NF_ACCEPT; -+ -+ if (skb->dst) -+ return NF_ACCEPT; -+ -+ if (skb->len < sizeof(struct iphdr)) -+ return NF_ACCEPT; -+ -+ /* use daddr in other direction as masquerade address (lsrc) */ -+ iph = skb->nh.iph; -+ saddr = conn->tuplehash[!dir].tuple.dst.ip; -+ if (saddr == iph->saddr) -+ return NF_ACCEPT; -+ -+ if (ip_route_input_lookup(skb, iph->daddr, iph->saddr, iph->tos, -+ skb->dev, saddr)) -+ return NF_DROP; -+ -+ return NF_ACCEPT; -+} -+EXPORT_SYMBOL_GPL(ip_nat_route_input); -+ - static int __init ip_nat_init(void) - { - size_t i; -diff -urN linux-2.6.19.old/net/ipv4/netfilter/ip_nat_standalone.c linux-2.6.19.dev/net/ipv4/netfilter/ip_nat_standalone.c ---- linux-2.6.19.old/net/ipv4/netfilter/ip_nat_standalone.c 2006-11-29 22:57:37.000000000 +0100 -+++ linux-2.6.19.dev/net/ipv4/netfilter/ip_nat_standalone.c 2006-12-14 03:13:53.000000000 +0100 -@@ -325,6 +325,14 @@ - .hooknum = NF_IP_LOCAL_OUT, - .priority = NF_IP_PRI_NAT_DST, - }, -+ /* Before routing, route before mangling */ -+ { -+ .hook = ip_nat_route_input, -+ .owner = THIS_MODULE, -+ .pf = PF_INET, -+ .hooknum = NF_IP_PRE_ROUTING, -+ .priority = NF_IP_PRI_LAST-1, -+ }, - /* After packet filtering, change source */ - { - .hook = ip_nat_fn, -diff -urN linux-2.6.19.old/net/ipv4/netfilter/ipt_MASQUERADE.c linux-2.6.19.dev/net/ipv4/netfilter/ipt_MASQUERADE.c ---- linux-2.6.19.old/net/ipv4/netfilter/ipt_MASQUERADE.c 2006-11-29 22:57:37.000000000 +0100 -+++ linux-2.6.19.dev/net/ipv4/netfilter/ipt_MASQUERADE.c 2006-12-14 03:13:53.000000000 +0100 -@@ -85,13 +85,31 @@ - return NF_ACCEPT; - - mr = targinfo; -- rt = (struct rtable *)(*pskb)->dst; -- newsrc = inet_select_addr(out, rt->rt_gateway, RT_SCOPE_UNIVERSE); -- if (!newsrc) { -- printk("MASQUERADE: %s ate my IP address\n", out->name); -- return NF_DROP; -+ -+ { -+ struct flowi fl = { .nl_u = { .ip4_u = -+ { .daddr = (*pskb)->nh.iph->daddr, -+ .tos = (RT_TOS((*pskb)->nh.iph->tos) | -+ RTO_CONN), -+ .gw = ((struct rtable *) (*pskb)->dst)->rt_gateway, -+#ifdef CONFIG_IP_ROUTE_FWMARK -+ .fwmark = (*pskb)->nfmark -+#endif -+ } }, -+ .oif = out->ifindex }; -+ if (ip_route_output_key(&rt, &fl) != 0) { -+ /* Funky routing can do this. */ -+ if (net_ratelimit()) -+ printk("MASQUERADE:" -+ " No route: Rusty's brain broke!\n"); -+ return NF_DROP; -+ } - } - -+ newsrc = rt->rt_src; -+ DEBUGP("newsrc = %u.%u.%u.%u\n", NIPQUAD(newsrc)); -+ ip_rt_put(rt); -+ - write_lock_bh(&masq_lock); - ct->nat.masq_index = out->ifindex; - write_unlock_bh(&masq_lock); -diff -urN linux-2.6.19.old/net/ipv4/route.c linux-2.6.19.dev/net/ipv4/route.c ---- linux-2.6.19.old/net/ipv4/route.c 2006-11-29 22:57:37.000000000 +0100 -+++ linux-2.6.19.dev/net/ipv4/route.c 2006-12-14 03:13:53.000000000 +0100 -@@ -1211,6 +1211,7 @@ +diff -urN linux-2.6.21.1/net/ipv4/route.c linux-2.6.21.1.new/net/ipv4/route.c +--- linux-2.6.21.1/net/ipv4/route.c 2007-04-27 23:49:26.000000000 +0200 ++++ linux-2.6.21.1.new/net/ipv4/route.c 2007-05-14 13:09:24.000000000 +0200 +@@ -1208,6 +1208,7 @@ /* Gateway is different ... */ rt->rt_gateway = new_gw; @@ -944,15 +59,15 @@ diff -urN linux-2.6.19.old/net/ipv4/route.c linux-2.6.19.dev/net/ipv4/route.c /* Redirect received -> path was valid */ dst_confirm(&rth->u.dst); -@@ -1647,6 +1648,7 @@ - rth->fl.fl4_fwmark= skb->nfmark; - #endif +@@ -1643,6 +1644,7 @@ + rth->fl.fl4_tos = tos; + rth->fl.mark = skb->mark; rth->fl.fl4_src = saddr; + rth->fl.fl4_lsrc = 0; rth->rt_src = saddr; #ifdef CONFIG_NET_CLS_ROUTE rth->u.dst.tclassid = itag; -@@ -1657,6 +1659,7 @@ +@@ -1653,6 +1655,7 @@ dev_hold(rth->u.dst.dev); rth->idev = in_dev_get(rth->u.dst.dev); rth->fl.oif = 0; @@ -960,16 +75,16 @@ diff -urN linux-2.6.19.old/net/ipv4/route.c linux-2.6.19.dev/net/ipv4/route.c rth->rt_gateway = daddr; rth->rt_spec_dst= spec_dst; rth->rt_type = RTN_MULTICAST; -@@ -1721,7 +1724,7 @@ - struct fib_result* res, - struct in_device *in_dev, - __be32 daddr, __be32 saddr, u32 tos, -- struct rtable **result) -+ u32 lsrc, struct rtable **result) +@@ -1716,7 +1719,7 @@ + static inline int __mkroute_input(struct sk_buff *skb, + struct fib_result* res, + struct in_device *in_dev, +- __be32 daddr, __be32 saddr, u32 tos, ++ __be32 daddr, __be32 saddr, u32 tos, u32 lsrc, + struct rtable **result) { - struct rtable *rth; -@@ -1755,6 +1758,7 @@ +@@ -1751,6 +1754,7 @@ flags |= RTCF_DIRECTSRC; if (out_dev == in_dev && err && !(flags & (RTCF_NAT | RTCF_MASQ)) && @@ -977,15 +92,15 @@ diff -urN linux-2.6.19.old/net/ipv4/route.c linux-2.6.19.dev/net/ipv4/route.c (IN_DEV_SHARED_MEDIA(out_dev) || inet_addr_onlink(out_dev, saddr, FIB_RES_GW(*res)))) flags |= RTCF_DOREDIRECT; -@@ -1794,6 +1798,7 @@ - #endif +@@ -1788,6 +1792,7 @@ + rth->fl.mark = skb->mark; rth->fl.fl4_src = saddr; rth->rt_src = saddr; + rth->fl.fl4_lsrc = lsrc; rth->rt_gateway = daddr; rth->rt_iif = rth->fl.iif = in_dev->dev->ifindex; -@@ -1801,6 +1806,7 @@ +@@ -1795,6 +1800,7 @@ dev_hold(rth->u.dst.dev); rth->idev = in_dev_get(rth->u.dst.dev); rth->fl.oif = 0; @@ -993,8 +108,8 @@ diff -urN linux-2.6.19.old/net/ipv4/route.c linux-2.6.19.dev/net/ipv4/route.c rth->rt_spec_dst= spec_dst; rth->u.dst.input = ip_forward; -@@ -1822,19 +1828,21 @@ - struct fib_result* res, +@@ -1816,19 +1822,21 @@ + struct fib_result* res, const struct flowi *fl, struct in_device *in_dev, - __be32 daddr, __be32 saddr, u32 tos) @@ -1018,8 +133,8 @@ diff -urN linux-2.6.19.old/net/ipv4/route.c linux-2.6.19.dev/net/ipv4/route.c if (err) return err; -@@ -1847,7 +1855,8 @@ - struct fib_result* res, +@@ -1841,7 +1849,8 @@ + struct fib_result* res, const struct flowi *fl, struct in_device *in_dev, - __be32 daddr, __be32 saddr, u32 tos) @@ -1028,16 +143,16 @@ diff -urN linux-2.6.19.old/net/ipv4/route.c linux-2.6.19.dev/net/ipv4/route.c { #ifdef CONFIG_IP_ROUTE_MULTIPATH_CACHED struct rtable* rth = NULL, *rtres; -@@ -1863,7 +1872,7 @@ +@@ -1857,7 +1866,7 @@ /* distinguish between multipath and singlepath */ if (hopcount < 2) return ip_mkroute_input_def(skb, res, fl, in_dev, daddr, - saddr, tos); + saddr, tos, 0); - + /* add all alternatives to the routing cache */ for (hop = 0; hop < hopcount; hop++) { -@@ -1875,7 +1884,7 @@ +@@ -1869,7 +1878,7 @@ /* create a routing cache entry */ err = __mkroute_input(skb, res, in_dev, daddr, saddr, tos, @@ -1046,7 +161,7 @@ diff -urN linux-2.6.19.old/net/ipv4/route.c linux-2.6.19.dev/net/ipv4/route.c if (err) return err; -@@ -1895,7 +1904,7 @@ +@@ -1889,7 +1898,7 @@ skb->dst = &rtres->u.dst; return err; #else /* CONFIG_IP_ROUTE_MULTIPATH_CACHED */ @@ -1055,7 +170,7 @@ diff -urN linux-2.6.19.old/net/ipv4/route.c linux-2.6.19.dev/net/ipv4/route.c #endif /* CONFIG_IP_ROUTE_MULTIPATH_CACHED */ } -@@ -1911,20 +1920,20 @@ +@@ -1905,18 +1914,18 @@ */ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr, @@ -1067,19 +182,17 @@ diff -urN linux-2.6.19.old/net/ipv4/route.c linux-2.6.19.dev/net/ipv4/route.c struct flowi fl = { .nl_u = { .ip4_u = { .daddr = daddr, - .saddr = saddr, -+ .saddr = lsrc? : saddr, ++ .saddr = lsrc ? : saddr, .tos = tos, .scope = RT_SCOPE_UNIVERSE, - #ifdef CONFIG_IP_ROUTE_FWMARK - .fwmark = skb->nfmark - #endif } }, + .mark = skb->mark, - .iif = dev->ifindex }; + .iif = lsrc? loopback_dev.ifindex : dev->ifindex }; unsigned flags = 0; u32 itag = 0; struct rtable * rth; -@@ -1957,6 +1966,12 @@ +@@ -1949,6 +1958,12 @@ if (BADCLASS(daddr) || ZERONET(daddr) || LOOPBACK(daddr)) goto martian_destination; @@ -1092,7 +205,7 @@ diff -urN linux-2.6.19.old/net/ipv4/route.c linux-2.6.19.dev/net/ipv4/route.c /* * Now we are ready to route packet. */ -@@ -1966,6 +1981,10 @@ +@@ -1958,6 +1973,10 @@ goto no_route; } free_res = 1; @@ -1103,7 +216,7 @@ diff -urN linux-2.6.19.old/net/ipv4/route.c linux-2.6.19.dev/net/ipv4/route.c RT_CACHE_STAT_INC(in_slow_tot); -@@ -1990,7 +2009,7 @@ +@@ -1982,7 +2001,7 @@ if (res.type != RTN_UNICAST) goto martian_destination; @@ -1112,7 +225,7 @@ diff -urN linux-2.6.19.old/net/ipv4/route.c linux-2.6.19.dev/net/ipv4/route.c if (err == -ENOBUFS) goto e_nobufs; if (err == -EINVAL) -@@ -2005,6 +2024,8 @@ +@@ -1997,6 +2016,8 @@ brd_input: if (skb->protocol != htons(ETH_P_IP)) goto e_inval; @@ -1121,7 +234,7 @@ diff -urN linux-2.6.19.old/net/ipv4/route.c linux-2.6.19.dev/net/ipv4/route.c if (ZERONET(saddr)) spec_dst = inet_select_addr(dev, 0, RT_SCOPE_LINK); -@@ -2047,6 +2068,7 @@ +@@ -2037,6 +2058,7 @@ rth->u.dst.dev = &loopback_dev; dev_hold(rth->u.dst.dev); rth->idev = in_dev_get(rth->u.dst.dev); @@ -1129,7 +242,7 @@ diff -urN linux-2.6.19.old/net/ipv4/route.c linux-2.6.19.dev/net/ipv4/route.c rth->rt_gateway = daddr; rth->rt_spec_dst= spec_dst; rth->u.dst.input= ip_local_deliver; -@@ -2096,8 +2118,9 @@ +@@ -2086,8 +2108,9 @@ goto e_inval; } @@ -1141,15 +254,15 @@ diff -urN linux-2.6.19.old/net/ipv4/route.c linux-2.6.19.dev/net/ipv4/route.c { struct rtable * rth; unsigned hash; -@@ -2112,6 +2135,7 @@ +@@ -2102,6 +2125,7 @@ if (rth->fl.fl4_dst == daddr && rth->fl.fl4_src == saddr && rth->fl.iif == iif && + rth->fl.fl4_lsrc == lsrc && rth->fl.oif == 0 && - #ifdef CONFIG_IP_ROUTE_FWMARK - rth->fl.fl4_fwmark == skb->nfmark && -@@ -2160,7 +2184,19 @@ + rth->fl.mark == skb->mark && + rth->fl.fl4_tos == tos) { +@@ -2148,7 +2172,19 @@ rcu_read_unlock(); return -EINVAL; } @@ -1170,15 +283,15 @@ diff -urN linux-2.6.19.old/net/ipv4/route.c linux-2.6.19.dev/net/ipv4/route.c } static inline int __mkroute_output(struct rtable **result, -@@ -2239,6 +2275,7 @@ +@@ -2227,6 +2263,7 @@ rth->fl.fl4_tos = tos; rth->fl.fl4_src = oldflp->fl4_src; rth->fl.oif = oldflp->oif; -+ rth->fl.fl4_gw = oldflp->fl4_gw; - #ifdef CONFIG_IP_ROUTE_FWMARK - rth->fl.fl4_fwmark= oldflp->fl4_fwmark; - #endif -@@ -2381,6 +2418,7 @@ ++ rth->fl.fl4_gw = oldflp->fl4_gw; + rth->fl.mark = oldflp->mark; + rth->rt_dst = fl->fl4_dst; + rth->rt_src = fl->fl4_src; +@@ -2367,6 +2404,7 @@ struct flowi fl = { .nl_u = { .ip4_u = { .daddr = oldflp->fl4_dst, .saddr = oldflp->fl4_src, @@ -1186,7 +299,7 @@ diff -urN linux-2.6.19.old/net/ipv4/route.c linux-2.6.19.dev/net/ipv4/route.c .tos = tos & IPTOS_RT_MASK, .scope = ((tos & RTO_ONLINK) ? RT_SCOPE_LINK : -@@ -2486,6 +2524,7 @@ +@@ -2470,6 +2508,7 @@ dev_out = &loopback_dev; dev_hold(dev_out); fl.oif = loopback_dev.ifindex; @@ -1194,7 +307,7 @@ diff -urN linux-2.6.19.old/net/ipv4/route.c linux-2.6.19.dev/net/ipv4/route.c res.type = RTN_LOCAL; flags |= RTCF_LOCAL; goto make_route; -@@ -2493,7 +2532,7 @@ +@@ -2477,7 +2516,7 @@ if (fib_lookup(&fl, &res)) { res.fi = NULL; @@ -1203,7 +316,7 @@ diff -urN linux-2.6.19.old/net/ipv4/route.c linux-2.6.19.dev/net/ipv4/route.c /* Apparently, routing tables are wrong. Assume, that the destination is on link. -@@ -2533,6 +2572,7 @@ +@@ -2517,6 +2556,7 @@ dev_out = &loopback_dev; dev_hold(dev_out); fl.oif = dev_out->ifindex; @@ -1211,7 +324,7 @@ diff -urN linux-2.6.19.old/net/ipv4/route.c linux-2.6.19.dev/net/ipv4/route.c if (res.fi) fib_info_put(res.fi); res.fi = NULL; -@@ -2540,13 +2580,12 @@ +@@ -2524,13 +2564,12 @@ goto make_route; } @@ -1228,15 +341,15 @@ diff -urN linux-2.6.19.old/net/ipv4/route.c linux-2.6.19.dev/net/ipv4/route.c if (!fl.fl4_src) fl.fl4_src = FIB_RES_PREFSRC(res); -@@ -2583,6 +2622,7 @@ +@@ -2567,6 +2606,7 @@ rth->fl.fl4_src == flp->fl4_src && rth->fl.iif == 0 && rth->fl.oif == flp->oif && + rth->fl.fl4_gw == flp->fl4_gw && - #ifdef CONFIG_IP_ROUTE_FWMARK - rth->fl.fl4_fwmark == flp->fl4_fwmark && - #endif -@@ -3221,3 +3261,4 @@ + rth->fl.mark == flp->mark && + !((rth->fl.fl4_tos ^ flp->fl4_tos) & + (IPTOS_RT_MASK | RTO_ONLINK))) { +@@ -3199,3 +3239,4 @@ EXPORT_SYMBOL(__ip_select_ident); EXPORT_SYMBOL(ip_route_input); EXPORT_SYMBOL(ip_route_output_key); diff --git a/target/linux/generic-2.6/patches/510-Yaffs.patch b/target/linux/generic-2.6/patches/510-Yaffs.patch index d7b9c976b4..e5ddd22b21 100644 --- a/target/linux/generic-2.6/patches/510-Yaffs.patch +++ b/target/linux/generic-2.6/patches/510-Yaffs.patch @@ -1,26 +1,26 @@ -diff -urN linux.old/fs/Kconfig linux.dev/fs/Kconfig ---- linux.old/fs/Kconfig 2006-11-29 22:57:37.000000000 +0100 -+++ linux.dev/fs/Kconfig 2006-12-14 04:21:47.000000000 +0100 -@@ -1202,6 +1202,8 @@ +diff -Nur linux-2.6.21.1/fs/Kconfig linux-2.6.21.1-owrt/fs/Kconfig +--- linux-2.6.21.1/fs/Kconfig 2007-05-14 10:49:47.000000000 +0200 ++++ linux-2.6.21.1-owrt/fs/Kconfig 2007-05-14 11:53:15.000000000 +0200 +@@ -1189,6 +1189,8 @@ To compile the EFS file system support as a module, choose M here: the module will be called efs. +source "fs/yaffs2/Kconfig" + - config JFFS_FS - tristate "Journalling Flash File System (JFFS) support" - depends on MTD && BLOCK -diff -urN linux.old/fs/Makefile linux.dev/fs/Makefile ---- linux.old/fs/Makefile 2006-11-29 22:57:37.000000000 +0100 -+++ linux.dev/fs/Makefile 2006-12-14 04:21:47.000000000 +0100 -@@ -114,3 +114,4 @@ + config JFFS2_FS + tristate "Journalling Flash File System v2 (JFFS2) support" + select CRC32 +diff -Nur linux-2.6.21.1/fs/Makefile linux-2.6.21.1-owrt/fs/Makefile +--- linux-2.6.21.1/fs/Makefile 2007-05-14 10:49:47.000000000 +0200 ++++ linux-2.6.21.1-owrt/fs/Makefile 2007-05-14 11:52:43.000000000 +0200 +@@ -115,3 +115,4 @@ obj-$(CONFIG_DEBUG_FS) += debugfs/ obj-$(CONFIG_OCFS2_FS) += ocfs2/ obj-$(CONFIG_GFS2_FS) += gfs2/ +obj-$(CONFIG_YAFFS_FS) += yaffs2/ -diff -urN linux.old/fs/yaffs2/devextras.h linux.dev/fs/yaffs2/devextras.h ---- linux.old/fs/yaffs2/devextras.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/fs/yaffs2/devextras.h 2006-12-14 04:21:47.000000000 +0100 +diff -Nur linux-2.6.21.1/fs/yaffs2/devextras.h linux-2.6.21.1-owrt/fs/yaffs2/devextras.h +--- linux-2.6.21.1/fs/yaffs2/devextras.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/fs/yaffs2/devextras.h 2007-05-14 11:52:43.000000000 +0200 @@ -0,0 +1,265 @@ +/* + * YAFFS: Yet another FFS. A NAND-flash specific file system. @@ -287,9 +287,9 @@ diff -urN linux.old/fs/yaffs2/devextras.h linux.dev/fs/yaffs2/devextras.h +#endif + +#endif -diff -urN linux.old/fs/yaffs2/Kconfig linux.dev/fs/yaffs2/Kconfig ---- linux.old/fs/yaffs2/Kconfig 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/fs/yaffs2/Kconfig 2006-12-14 04:21:47.000000000 +0100 +diff -Nur linux-2.6.21.1/fs/yaffs2/Kconfig linux-2.6.21.1-owrt/fs/yaffs2/Kconfig +--- linux-2.6.21.1/fs/yaffs2/Kconfig 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/fs/yaffs2/Kconfig 2007-05-14 11:52:43.000000000 +0200 @@ -0,0 +1,135 @@ +# +# YAFFS file system configurations @@ -426,9 +426,9 @@ diff -urN linux.old/fs/yaffs2/Kconfig linux.dev/fs/yaffs2/Kconfig + but makes look-ups faster. + + If unsure, say Y. -diff -urN linux.old/fs/yaffs2/Makefile linux.dev/fs/yaffs2/Makefile ---- linux.old/fs/yaffs2/Makefile 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/fs/yaffs2/Makefile 2006-12-14 04:21:47.000000000 +0100 +diff -Nur linux-2.6.21.1/fs/yaffs2/Makefile linux-2.6.21.1-owrt/fs/yaffs2/Makefile +--- linux-2.6.21.1/fs/yaffs2/Makefile 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/fs/yaffs2/Makefile 2007-05-14 11:52:43.000000000 +0200 @@ -0,0 +1,10 @@ +# +# Makefile for the linux YAFFS filesystem routines. @@ -440,9 +440,9 @@ diff -urN linux.old/fs/yaffs2/Makefile linux.dev/fs/yaffs2/Makefile +yaffs-y += yaffs_packedtags2.o yaffs_nand.o yaffs_qsort.o +yaffs-y += yaffs_tagscompat.o yaffs_tagsvalidity.o +yaffs-y += yaffs_mtdif.o yaffs_mtdif2.o -diff -urN linux.old/fs/yaffs2/moduleconfig.h linux.dev/fs/yaffs2/moduleconfig.h ---- linux.old/fs/yaffs2/moduleconfig.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/fs/yaffs2/moduleconfig.h 2006-12-14 04:21:47.000000000 +0100 +diff -Nur linux-2.6.21.1/fs/yaffs2/moduleconfig.h linux-2.6.21.1-owrt/fs/yaffs2/moduleconfig.h +--- linux-2.6.21.1/fs/yaffs2/moduleconfig.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/fs/yaffs2/moduleconfig.h 2007-05-14 11:52:43.000000000 +0200 @@ -0,0 +1,32 @@ +#ifndef __YAFFS_CONFIG_H__ +#define __YAFFS_CONFIG_H__ @@ -476,9 +476,9 @@ diff -urN linux.old/fs/yaffs2/moduleconfig.h linux.dev/fs/yaffs2/moduleconfig.h +#endif /* YAFFS_OUT_OF_TREE */ + +#endif /* __YAFFS_CONFIG_H__ */ -diff -urN linux.old/fs/yaffs2/yaffs_checkptrw.c linux.dev/fs/yaffs2/yaffs_checkptrw.c ---- linux.old/fs/yaffs2/yaffs_checkptrw.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/fs/yaffs2/yaffs_checkptrw.c 2006-12-14 04:21:47.000000000 +0100 +diff -Nur linux-2.6.21.1/fs/yaffs2/yaffs_checkptrw.c linux-2.6.21.1-owrt/fs/yaffs2/yaffs_checkptrw.c +--- linux-2.6.21.1/fs/yaffs2/yaffs_checkptrw.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/fs/yaffs2/yaffs_checkptrw.c 2007-05-14 11:52:43.000000000 +0200 @@ -0,0 +1,384 @@ +/* YAFFS: Yet another FFS. A NAND-flash specific file system. + * @@ -864,9 +864,9 @@ diff -urN linux.old/fs/yaffs2/yaffs_checkptrw.c linux.dev/fs/yaffs2/yaffs_checkp + + + -diff -urN linux.old/fs/yaffs2/yaffs_checkptrw.h linux.dev/fs/yaffs2/yaffs_checkptrw.h ---- linux.old/fs/yaffs2/yaffs_checkptrw.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/fs/yaffs2/yaffs_checkptrw.h 2006-12-14 04:21:47.000000000 +0100 +diff -Nur linux-2.6.21.1/fs/yaffs2/yaffs_checkptrw.h linux-2.6.21.1-owrt/fs/yaffs2/yaffs_checkptrw.h +--- linux-2.6.21.1/fs/yaffs2/yaffs_checkptrw.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/fs/yaffs2/yaffs_checkptrw.h 2007-05-14 11:52:43.000000000 +0200 @@ -0,0 +1,18 @@ +#ifndef __YAFFS_CHECKPTRW_H__ +#define __YAFFS_CHECKPTRW_H__ @@ -886,9 +886,9 @@ diff -urN linux.old/fs/yaffs2/yaffs_checkptrw.h linux.dev/fs/yaffs2/yaffs_checkp + +#endif + -diff -urN linux.old/fs/yaffs2/yaffs_ecc.c linux.dev/fs/yaffs2/yaffs_ecc.c ---- linux.old/fs/yaffs2/yaffs_ecc.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/fs/yaffs2/yaffs_ecc.c 2006-12-14 04:21:47.000000000 +0100 +diff -Nur linux-2.6.21.1/fs/yaffs2/yaffs_ecc.c linux-2.6.21.1-owrt/fs/yaffs2/yaffs_ecc.c +--- linux-2.6.21.1/fs/yaffs2/yaffs_ecc.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/fs/yaffs2/yaffs_ecc.c 2007-05-14 11:52:43.000000000 +0200 @@ -0,0 +1,333 @@ +/* + * YAFFS: Yet another FFS. A NAND-flash specific file system. @@ -1223,9 +1223,9 @@ diff -urN linux.old/fs/yaffs2/yaffs_ecc.c linux.dev/fs/yaffs2/yaffs_ecc.c + +} + -diff -urN linux.old/fs/yaffs2/yaffs_ecc.h linux.dev/fs/yaffs2/yaffs_ecc.h ---- linux.old/fs/yaffs2/yaffs_ecc.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/fs/yaffs2/yaffs_ecc.h 2006-12-14 04:21:47.000000000 +0100 +diff -Nur linux-2.6.21.1/fs/yaffs2/yaffs_ecc.h linux-2.6.21.1-owrt/fs/yaffs2/yaffs_ecc.h +--- linux-2.6.21.1/fs/yaffs2/yaffs_ecc.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/fs/yaffs2/yaffs_ecc.h 2007-05-14 11:52:43.000000000 +0200 @@ -0,0 +1,44 @@ +/* + * YAFFS: Yet another FFS. A NAND-flash specific file system. @@ -1271,9 +1271,9 @@ diff -urN linux.old/fs/yaffs2/yaffs_ecc.h linux.dev/fs/yaffs2/yaffs_ecc.h + yaffs_ECCOther * read_ecc, + const yaffs_ECCOther * test_ecc); +#endif -diff -urN linux.old/fs/yaffs2/yaffs_fs.c linux.dev/fs/yaffs2/yaffs_fs.c ---- linux.old/fs/yaffs2/yaffs_fs.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/fs/yaffs2/yaffs_fs.c 2006-12-14 04:33:02.000000000 +0100 +diff -Nur linux-2.6.21.1/fs/yaffs2/yaffs_fs.c linux-2.6.21.1-owrt/fs/yaffs2/yaffs_fs.c +--- linux-2.6.21.1/fs/yaffs2/yaffs_fs.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/fs/yaffs2/yaffs_fs.c 2007-05-14 11:52:43.000000000 +0200 @@ -0,0 +1,2136 @@ +/* + * YAFFS: Yet another FFS. A NAND-flash specific file system. @@ -3411,9 +3411,9 @@ diff -urN linux.old/fs/yaffs2/yaffs_fs.c linux.dev/fs/yaffs2/yaffs_fs.c +MODULE_DESCRIPTION("YAFFS2 - a NAND specific flash file system"); +MODULE_AUTHOR("Charles Manning, Aleph One Ltd., 2002-2006"); +MODULE_LICENSE("GPL"); -diff -urN linux.old/fs/yaffs2/yaffs_guts.c linux.dev/fs/yaffs2/yaffs_guts.c ---- linux.old/fs/yaffs2/yaffs_guts.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/fs/yaffs2/yaffs_guts.c 2006-12-14 04:21:47.000000000 +0100 +diff -Nur linux-2.6.21.1/fs/yaffs2/yaffs_guts.c linux-2.6.21.1-owrt/fs/yaffs2/yaffs_guts.c +--- linux-2.6.21.1/fs/yaffs2/yaffs_guts.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/fs/yaffs2/yaffs_guts.c 2007-05-14 11:52:43.000000000 +0200 @@ -0,0 +1,6675 @@ +/* + * YAFFS: Yet another FFS. A NAND-flash specific file system. @@ -10090,9 +10090,9 @@ diff -urN linux.old/fs/yaffs2/yaffs_guts.c linux.dev/fs/yaffs2/yaffs_guts.c + + return YAFFS_OK; +} -diff -urN linux.old/fs/yaffs2/yaffs_guts.h linux.dev/fs/yaffs2/yaffs_guts.h ---- linux.old/fs/yaffs2/yaffs_guts.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/fs/yaffs2/yaffs_guts.h 2006-12-14 04:21:47.000000000 +0100 +diff -Nur linux-2.6.21.1/fs/yaffs2/yaffs_guts.h linux-2.6.21.1-owrt/fs/yaffs2/yaffs_guts.h +--- linux-2.6.21.1/fs/yaffs2/yaffs_guts.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/fs/yaffs2/yaffs_guts.h 2007-05-14 11:52:43.000000000 +0200 @@ -0,0 +1,893 @@ +/* + * YAFFS: Yet another FFS. A NAND-flash specific file system. @@ -10987,9 +10987,9 @@ diff -urN linux.old/fs/yaffs2/yaffs_guts.h linux.dev/fs/yaffs2/yaffs_guts.h +void yaffs_HandleChunkError(yaffs_Device *dev, yaffs_BlockInfo *bi); + +#endif -diff -urN linux.old/fs/yaffs2/yaffsinterface.h linux.dev/fs/yaffs2/yaffsinterface.h ---- linux.old/fs/yaffs2/yaffsinterface.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/fs/yaffs2/yaffsinterface.h 2006-12-14 04:21:47.000000000 +0100 +diff -Nur linux-2.6.21.1/fs/yaffs2/yaffsinterface.h linux-2.6.21.1-owrt/fs/yaffs2/yaffsinterface.h +--- linux-2.6.21.1/fs/yaffs2/yaffsinterface.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/fs/yaffs2/yaffsinterface.h 2007-05-14 11:52:43.000000000 +0200 @@ -0,0 +1,23 @@ +/* + * YAFFS: Yet another FFS. A NAND-flash specific file system. @@ -11014,9 +11014,9 @@ diff -urN linux.old/fs/yaffs2/yaffsinterface.h linux.dev/fs/yaffs2/yaffsinterfac +int yaffs_Initialise(unsigned nBlocks); + +#endif -diff -urN linux.old/fs/yaffs2/yaffs_mtdif2.c linux.dev/fs/yaffs2/yaffs_mtdif2.c ---- linux.old/fs/yaffs2/yaffs_mtdif2.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/fs/yaffs2/yaffs_mtdif2.c 2006-12-14 04:21:47.000000000 +0100 +diff -Nur linux-2.6.21.1/fs/yaffs2/yaffs_mtdif2.c linux-2.6.21.1-owrt/fs/yaffs2/yaffs_mtdif2.c +--- linux-2.6.21.1/fs/yaffs2/yaffs_mtdif2.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/fs/yaffs2/yaffs_mtdif2.c 2007-05-14 11:52:43.000000000 +0200 @@ -0,0 +1,234 @@ +/* + * YAFFS: Yet another FFS. A NAND-flash specific file system. @@ -11252,9 +11252,9 @@ diff -urN linux.old/fs/yaffs2/yaffs_mtdif2.c linux.dev/fs/yaffs2/yaffs_mtdif2.c + return YAFFS_FAIL; +} + -diff -urN linux.old/fs/yaffs2/yaffs_mtdif2.h linux.dev/fs/yaffs2/yaffs_mtdif2.h ---- linux.old/fs/yaffs2/yaffs_mtdif2.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/fs/yaffs2/yaffs_mtdif2.h 2006-12-14 04:21:47.000000000 +0100 +diff -Nur linux-2.6.21.1/fs/yaffs2/yaffs_mtdif2.h linux-2.6.21.1-owrt/fs/yaffs2/yaffs_mtdif2.h +--- linux-2.6.21.1/fs/yaffs2/yaffs_mtdif2.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/fs/yaffs2/yaffs_mtdif2.h 2007-05-14 11:52:43.000000000 +0200 @@ -0,0 +1,29 @@ +/* + * YAFFS: Yet another FFS. A NAND-flash specific file system. @@ -11285,9 +11285,9 @@ diff -urN linux.old/fs/yaffs2/yaffs_mtdif2.h linux.dev/fs/yaffs2/yaffs_mtdif2.h + yaffs_BlockState * state, int *sequenceNumber); + +#endif -diff -urN linux.old/fs/yaffs2/yaffs_mtdif.c linux.dev/fs/yaffs2/yaffs_mtdif.c ---- linux.old/fs/yaffs2/yaffs_mtdif.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/fs/yaffs2/yaffs_mtdif.c 2006-12-14 04:21:47.000000000 +0100 +diff -Nur linux-2.6.21.1/fs/yaffs2/yaffs_mtdif.c linux-2.6.21.1-owrt/fs/yaffs2/yaffs_mtdif.c +--- linux-2.6.21.1/fs/yaffs2/yaffs_mtdif.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/fs/yaffs2/yaffs_mtdif.c 2007-05-14 11:52:43.000000000 +0200 @@ -0,0 +1,243 @@ +/* + * YAFFS: Yet another FFS. A NAND-flash specific file system. @@ -11532,9 +11532,9 @@ diff -urN linux.old/fs/yaffs2/yaffs_mtdif.c linux.dev/fs/yaffs2/yaffs_mtdif.c + return YAFFS_OK; +} + -diff -urN linux.old/fs/yaffs2/yaffs_mtdif.h linux.dev/fs/yaffs2/yaffs_mtdif.h ---- linux.old/fs/yaffs2/yaffs_mtdif.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/fs/yaffs2/yaffs_mtdif.h 2006-12-14 04:21:47.000000000 +0100 +diff -Nur linux-2.6.21.1/fs/yaffs2/yaffs_mtdif.h linux-2.6.21.1-owrt/fs/yaffs2/yaffs_mtdif.h +--- linux-2.6.21.1/fs/yaffs2/yaffs_mtdif.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/fs/yaffs2/yaffs_mtdif.h 2007-05-14 11:52:43.000000000 +0200 @@ -0,0 +1,31 @@ +/* + * YAFFS: Yet another FFS. A NAND-flash specific file system. @@ -11567,9 +11567,9 @@ diff -urN linux.old/fs/yaffs2/yaffs_mtdif.h linux.dev/fs/yaffs2/yaffs_mtdif.h +int nandmtd_EraseBlockInNAND(yaffs_Device * dev, int blockNumber); +int nandmtd_InitialiseNAND(yaffs_Device * dev); +#endif -diff -urN linux.old/fs/yaffs2/yaffs_nand.c linux.dev/fs/yaffs2/yaffs_nand.c ---- linux.old/fs/yaffs2/yaffs_nand.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/fs/yaffs2/yaffs_nand.c 2006-12-14 04:21:47.000000000 +0100 +diff -Nur linux-2.6.21.1/fs/yaffs2/yaffs_nand.c linux-2.6.21.1-owrt/fs/yaffs2/yaffs_nand.c +--- linux-2.6.21.1/fs/yaffs2/yaffs_nand.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/fs/yaffs2/yaffs_nand.c 2007-05-14 11:52:43.000000000 +0200 @@ -0,0 +1,135 @@ +/* + * YAFFS: Yet another FFS. A NAND-flash specific file system. @@ -11706,9 +11706,9 @@ diff -urN linux.old/fs/yaffs2/yaffs_nand.c linux.dev/fs/yaffs2/yaffs_nand.c + + + -diff -urN linux.old/fs/yaffs2/yaffs_nandemul2k.h linux.dev/fs/yaffs2/yaffs_nandemul2k.h ---- linux.old/fs/yaffs2/yaffs_nandemul2k.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/fs/yaffs2/yaffs_nandemul2k.h 2006-12-14 04:21:47.000000000 +0100 +diff -Nur linux-2.6.21.1/fs/yaffs2/yaffs_nandemul2k.h linux-2.6.21.1-owrt/fs/yaffs2/yaffs_nandemul2k.h +--- linux-2.6.21.1/fs/yaffs2/yaffs_nandemul2k.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/fs/yaffs2/yaffs_nandemul2k.h 2007-05-14 11:52:43.000000000 +0200 @@ -0,0 +1,42 @@ +/* + * YAFFS: Yet another FFS. A NAND-flash specific file system. @@ -11752,9 +11752,9 @@ diff -urN linux.old/fs/yaffs2/yaffs_nandemul2k.h linux.dev/fs/yaffs2/yaffs_nande +int nandemul2k_GetNumberOfBlocks(void); + +#endif -diff -urN linux.old/fs/yaffs2/yaffs_nand.h linux.dev/fs/yaffs2/yaffs_nand.h ---- linux.old/fs/yaffs2/yaffs_nand.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/fs/yaffs2/yaffs_nand.h 2006-12-14 04:21:47.000000000 +0100 +diff -Nur linux-2.6.21.1/fs/yaffs2/yaffs_nand.h linux-2.6.21.1-owrt/fs/yaffs2/yaffs_nand.h +--- linux-2.6.21.1/fs/yaffs2/yaffs_nand.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/fs/yaffs2/yaffs_nand.h 2007-05-14 11:52:43.000000000 +0200 @@ -0,0 +1,43 @@ +/* + * YAFFS: Yet another FFS. A NAND-flash specific file system. @@ -11799,9 +11799,9 @@ diff -urN linux.old/fs/yaffs2/yaffs_nand.h linux.dev/fs/yaffs2/yaffs_nand.h + +#endif + -diff -urN linux.old/fs/yaffs2/yaffs_packedtags1.c linux.dev/fs/yaffs2/yaffs_packedtags1.c ---- linux.old/fs/yaffs2/yaffs_packedtags1.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/fs/yaffs2/yaffs_packedtags1.c 2006-12-14 04:21:47.000000000 +0100 +diff -Nur linux-2.6.21.1/fs/yaffs2/yaffs_packedtags1.c linux-2.6.21.1-owrt/fs/yaffs2/yaffs_packedtags1.c +--- linux-2.6.21.1/fs/yaffs2/yaffs_packedtags1.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/fs/yaffs2/yaffs_packedtags1.c 2007-05-14 11:52:43.000000000 +0200 @@ -0,0 +1,39 @@ +#include "yaffs_packedtags1.h" +#include "yportenv.h" @@ -11842,9 +11842,9 @@ diff -urN linux.old/fs/yaffs2/yaffs_packedtags1.c linux.dev/fs/yaffs2/yaffs_pack + + } +} -diff -urN linux.old/fs/yaffs2/yaffs_packedtags1.h linux.dev/fs/yaffs2/yaffs_packedtags1.h ---- linux.old/fs/yaffs2/yaffs_packedtags1.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/fs/yaffs2/yaffs_packedtags1.h 2006-12-14 04:21:47.000000000 +0100 +diff -Nur linux-2.6.21.1/fs/yaffs2/yaffs_packedtags1.h linux-2.6.21.1-owrt/fs/yaffs2/yaffs_packedtags1.h +--- linux-2.6.21.1/fs/yaffs2/yaffs_packedtags1.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/fs/yaffs2/yaffs_packedtags1.h 2007-05-14 11:52:43.000000000 +0200 @@ -0,0 +1,22 @@ +// This is used to pack YAFFS1 tags, not YAFFS2 tags. + @@ -11868,9 +11868,9 @@ diff -urN linux.old/fs/yaffs2/yaffs_packedtags1.h linux.dev/fs/yaffs2/yaffs_pack +void yaffs_PackTags1(yaffs_PackedTags1 * pt, const yaffs_ExtendedTags * t); +void yaffs_UnpackTags1(yaffs_ExtendedTags * t, const yaffs_PackedTags1 * pt); +#endif -diff -urN linux.old/fs/yaffs2/yaffs_packedtags2.c linux.dev/fs/yaffs2/yaffs_packedtags2.c ---- linux.old/fs/yaffs2/yaffs_packedtags2.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/fs/yaffs2/yaffs_packedtags2.c 2006-12-14 04:21:47.000000000 +0100 +diff -Nur linux-2.6.21.1/fs/yaffs2/yaffs_packedtags2.c linux-2.6.21.1-owrt/fs/yaffs2/yaffs_packedtags2.c +--- linux-2.6.21.1/fs/yaffs2/yaffs_packedtags2.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/fs/yaffs2/yaffs_packedtags2.c 2007-05-14 11:52:43.000000000 +0200 @@ -0,0 +1,184 @@ +/* + * YAFFS: Yet another FFS. A NAND-flash specific file system. @@ -12056,9 +12056,9 @@ diff -urN linux.old/fs/yaffs2/yaffs_packedtags2.c linux.dev/fs/yaffs2/yaffs_pack + yaffs_DumpTags2(t); + +} -diff -urN linux.old/fs/yaffs2/yaffs_packedtags2.h linux.dev/fs/yaffs2/yaffs_packedtags2.h ---- linux.old/fs/yaffs2/yaffs_packedtags2.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/fs/yaffs2/yaffs_packedtags2.h 2006-12-14 04:21:47.000000000 +0100 +diff -Nur linux-2.6.21.1/fs/yaffs2/yaffs_packedtags2.h linux-2.6.21.1-owrt/fs/yaffs2/yaffs_packedtags2.h +--- linux-2.6.21.1/fs/yaffs2/yaffs_packedtags2.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/fs/yaffs2/yaffs_packedtags2.h 2007-05-14 11:52:43.000000000 +0200 @@ -0,0 +1,23 @@ +/* This is used to pack YAFFS2 tags, not YAFFS1tags. */ + @@ -12083,9 +12083,9 @@ diff -urN linux.old/fs/yaffs2/yaffs_packedtags2.h linux.dev/fs/yaffs2/yaffs_pack +void yaffs_PackTags2(yaffs_PackedTags2 * pt, const yaffs_ExtendedTags * t); +void yaffs_UnpackTags2(yaffs_ExtendedTags * t, yaffs_PackedTags2 * pt); +#endif -diff -urN linux.old/fs/yaffs2/yaffs_qsort.c linux.dev/fs/yaffs2/yaffs_qsort.c ---- linux.old/fs/yaffs2/yaffs_qsort.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/fs/yaffs2/yaffs_qsort.c 2006-12-14 04:21:47.000000000 +0100 +diff -Nur linux-2.6.21.1/fs/yaffs2/yaffs_qsort.c linux-2.6.21.1-owrt/fs/yaffs2/yaffs_qsort.c +--- linux-2.6.21.1/fs/yaffs2/yaffs_qsort.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/fs/yaffs2/yaffs_qsort.c 2007-05-14 11:52:43.000000000 +0200 @@ -0,0 +1,156 @@ +/* + * Copyright (c) 1992, 1993 @@ -12243,9 +12243,9 @@ diff -urN linux.old/fs/yaffs2/yaffs_qsort.c linux.dev/fs/yaffs2/yaffs_qsort.c + } +/* qsort(pn - r, r / es, es, cmp);*/ +} -diff -urN linux.old/fs/yaffs2/yaffs_qsort.h linux.dev/fs/yaffs2/yaffs_qsort.h ---- linux.old/fs/yaffs2/yaffs_qsort.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/fs/yaffs2/yaffs_qsort.h 2006-12-14 04:21:47.000000000 +0100 +diff -Nur linux-2.6.21.1/fs/yaffs2/yaffs_qsort.h linux-2.6.21.1-owrt/fs/yaffs2/yaffs_qsort.h +--- linux-2.6.21.1/fs/yaffs2/yaffs_qsort.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/fs/yaffs2/yaffs_qsort.h 2007-05-14 11:52:43.000000000 +0200 @@ -0,0 +1,23 @@ +/* + * YAFFS: Yet another FFS. A NAND-flash specific file system. @@ -12270,9 +12270,9 @@ diff -urN linux.old/fs/yaffs2/yaffs_qsort.h linux.dev/fs/yaffs2/yaffs_qsort.h + int (*cmp)(const void *, const void *)); + +#endif -diff -urN linux.old/fs/yaffs2/yaffs_tagscompat.c linux.dev/fs/yaffs2/yaffs_tagscompat.c ---- linux.old/fs/yaffs2/yaffs_tagscompat.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/fs/yaffs2/yaffs_tagscompat.c 2006-12-14 04:21:47.000000000 +0100 +diff -Nur linux-2.6.21.1/fs/yaffs2/yaffs_tagscompat.c linux-2.6.21.1-owrt/fs/yaffs2/yaffs_tagscompat.c +--- linux-2.6.21.1/fs/yaffs2/yaffs_tagscompat.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/fs/yaffs2/yaffs_tagscompat.c 2007-05-14 11:52:43.000000000 +0200 @@ -0,0 +1,532 @@ +/* + * YAFFS: Yet another FFS. A NAND-flash specific file system. @@ -12806,9 +12806,9 @@ diff -urN linux.old/fs/yaffs2/yaffs_tagscompat.c linux.dev/fs/yaffs2/yaffs_tagsc + + return YAFFS_OK; +} -diff -urN linux.old/fs/yaffs2/yaffs_tagscompat.h linux.dev/fs/yaffs2/yaffs_tagscompat.h ---- linux.old/fs/yaffs2/yaffs_tagscompat.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/fs/yaffs2/yaffs_tagscompat.h 2006-12-14 04:21:47.000000000 +0100 +diff -Nur linux-2.6.21.1/fs/yaffs2/yaffs_tagscompat.h linux-2.6.21.1-owrt/fs/yaffs2/yaffs_tagscompat.h +--- linux-2.6.21.1/fs/yaffs2/yaffs_tagscompat.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/fs/yaffs2/yaffs_tagscompat.h 2007-05-14 11:52:43.000000000 +0200 @@ -0,0 +1,40 @@ +/* + * YAFFS: Yet another FFS. A NAND-flash specific file system. @@ -12850,9 +12850,9 @@ diff -urN linux.old/fs/yaffs2/yaffs_tagscompat.h linux.dev/fs/yaffs2/yaffs_tagsc + state, int *sequenceNumber); + +#endif -diff -urN linux.old/fs/yaffs2/yaffs_tagsvalidity.c linux.dev/fs/yaffs2/yaffs_tagsvalidity.c ---- linux.old/fs/yaffs2/yaffs_tagsvalidity.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/fs/yaffs2/yaffs_tagsvalidity.c 2006-12-14 04:21:47.000000000 +0100 +diff -Nur linux-2.6.21.1/fs/yaffs2/yaffs_tagsvalidity.c linux-2.6.21.1-owrt/fs/yaffs2/yaffs_tagsvalidity.c +--- linux-2.6.21.1/fs/yaffs2/yaffs_tagsvalidity.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/fs/yaffs2/yaffs_tagsvalidity.c 2007-05-14 11:52:43.000000000 +0200 @@ -0,0 +1,31 @@ + +/* @@ -12885,9 +12885,9 @@ diff -urN linux.old/fs/yaffs2/yaffs_tagsvalidity.c linux.dev/fs/yaffs2/yaffs_tag + tags->validMarker1 == 0x55555555); + +} -diff -urN linux.old/fs/yaffs2/yaffs_tagsvalidity.h linux.dev/fs/yaffs2/yaffs_tagsvalidity.h ---- linux.old/fs/yaffs2/yaffs_tagsvalidity.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/fs/yaffs2/yaffs_tagsvalidity.h 2006-12-14 04:21:47.000000000 +0100 +diff -Nur linux-2.6.21.1/fs/yaffs2/yaffs_tagsvalidity.h linux-2.6.21.1-owrt/fs/yaffs2/yaffs_tagsvalidity.h +--- linux-2.6.21.1/fs/yaffs2/yaffs_tagsvalidity.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/fs/yaffs2/yaffs_tagsvalidity.h 2007-05-14 11:52:43.000000000 +0200 @@ -0,0 +1,25 @@ + +/* @@ -12914,9 +12914,9 @@ diff -urN linux.old/fs/yaffs2/yaffs_tagsvalidity.h linux.dev/fs/yaffs2/yaffs_tag +void yaffs_InitialiseTags(yaffs_ExtendedTags * tags); +int yaffs_ValidateTags(yaffs_ExtendedTags * tags); +#endif -diff -urN linux.old/fs/yaffs2/yportenv.h linux.dev/fs/yaffs2/yportenv.h ---- linux.old/fs/yaffs2/yportenv.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/fs/yaffs2/yportenv.h 2006-12-14 04:26:06.000000000 +0100 +diff -Nur linux-2.6.21.1/fs/yaffs2/yportenv.h linux-2.6.21.1-owrt/fs/yaffs2/yportenv.h +--- linux-2.6.21.1/fs/yaffs2/yportenv.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/fs/yaffs2/yportenv.h 2007-05-14 11:52:43.000000000 +0200 @@ -0,0 +1,165 @@ +/* + * YAFFS: Yet another FFS. A NAND-flash specific file system. diff --git a/target/linux/generic-2.6/patches/600-x86_lzma.patch b/target/linux/generic-2.6/patches/600-x86_lzma.patch index 1a948839b0..b84a03cf09 100644 --- a/target/linux/generic-2.6/patches/600-x86_lzma.patch +++ b/target/linux/generic-2.6/patches/600-x86_lzma.patch @@ -1,6 +1,6 @@ -diff -Naur linux-old/arch/i386/boot/compressed/LzmaDecode.c linux-lzma/arch/i386/boot/compressed/LzmaDecode.c ---- linux-old/arch/i386/boot/compressed/LzmaDecode.c 1969-12-31 19:00:00.000000000 -0500 -+++ linux-lzma/arch/i386/boot/compressed/LzmaDecode.c 2005-06-05 00:07:38.000000000 -0400 +diff -Nur linux-2.6.21.1/arch/i386/boot/compressed/LzmaDecode.c linux-2.6.21.1-owrt/arch/i386/boot/compressed/LzmaDecode.c +--- linux-2.6.21.1/arch/i386/boot/compressed/LzmaDecode.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/arch/i386/boot/compressed/LzmaDecode.c 2007-05-14 11:55:38.000000000 +0200 @@ -0,0 +1,586 @@ +/* + LzmaDecode.c @@ -588,9 +588,9 @@ diff -Naur linux-old/arch/i386/boot/compressed/LzmaDecode.c linux-lzma/arch/i386 + *outSizeProcessed = nowPos; + return LZMA_RESULT_OK; +} -diff -Naur linux-old/arch/i386/boot/compressed/LzmaDecode.h linux-lzma/arch/i386/boot/compressed/LzmaDecode.h ---- linux-old/arch/i386/boot/compressed/LzmaDecode.h 1969-12-31 19:00:00.000000000 -0500 -+++ linux-lzma/arch/i386/boot/compressed/LzmaDecode.h 2005-06-05 00:07:39.000000000 -0400 +diff -Nur linux-2.6.21.1/arch/i386/boot/compressed/LzmaDecode.h linux-2.6.21.1-owrt/arch/i386/boot/compressed/LzmaDecode.h +--- linux-2.6.21.1/arch/i386/boot/compressed/LzmaDecode.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/arch/i386/boot/compressed/LzmaDecode.h 2007-05-14 11:55:38.000000000 +0200 @@ -0,0 +1,100 @@ +/* + LzmaDecode.h @@ -692,52 +692,9 @@ diff -Naur linux-old/arch/i386/boot/compressed/LzmaDecode.h linux-lzma/arch/i386 + UInt32 *outSizeProcessed); + +#endif -diff -Naur linux-old/arch/i386/boot/compressed/Makefile linux-lzma/arch/i386/boot/compressed/Makefile ---- linux-old/arch/i386/boot/compressed/Makefile 2005-06-04 21:53:40.000000000 -0400 -+++ linux-lzma/arch/i386/boot/compressed/Makefile 2005-06-05 00:25:23.000000000 -0400 -@@ -2,24 +2,33 @@ - # linux/arch/i386/boot/compressed/Makefile - # - # create a compressed vmlinux image from the original vmlinux -+# patched by Ming-Ching Tiew for kernel 2.6 -+# requires program 'lzma' from LZMA SDK ( http://www.7-zip.org/ ) to work -+# $ mkdir lzma -+# $ cd lzma -+# $ tar tvjf ../lzma417.tar.bz2 -+# $ cd SRC/7zip/Compress/LZMA_Alone -+# $ dos2unix makefile -+# $ make -+# $ su -+# # cp lzma /usr/bin - # -- --targets := vmlinux vmlinux.bin vmlinux.bin.gz head.o misc.o piggy.o -+targets := vmlinux vmlinux.bin vmlinux.bin.lzma head.o lzma_misc.o piggy.o - EXTRA_AFLAGS := -traditional - - LDFLAGS_vmlinux := -Ttext $(IMAGE_OFFSET) -e startup_32 - --$(obj)/vmlinux: $(obj)/head.o $(obj)/misc.o $(obj)/piggy.o FORCE -+$(obj)/vmlinux: $(obj)/head.o $(obj)/lzma_misc.o $(obj)/piggy.o FORCE - $(call if_changed,ld) - @: - - $(obj)/vmlinux.bin: vmlinux FORCE - $(call if_changed,objcopy) - --$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE -- $(call if_changed,gzip) -+$(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE -+ $(call if_changed,lzma) - - LDFLAGS_piggy.o := -r --format binary --oformat elf32-i386 -T - --$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.gz FORCE -+$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.lzma FORCE - $(call if_changed,ld) -diff -Naur linux-old/arch/i386/boot/compressed/lzma_misc.c linux-lzma/arch/i386/boot/compressed/lzma_misc.c ---- linux-old/arch/i386/boot/compressed/lzma_misc.c 1969-12-31 19:00:00.000000000 -0500 -+++ linux-lzma/arch/i386/boot/compressed/lzma_misc.c 2005-06-04 21:33:48.000000000 -0400 +diff -Nur linux-2.6.21.1/arch/i386/boot/compressed/lzma_misc.c linux-2.6.21.1-owrt/arch/i386/boot/compressed/lzma_misc.c +--- linux-2.6.21.1/arch/i386/boot/compressed/lzma_misc.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.21.1-owrt/arch/i386/boot/compressed/lzma_misc.c 2007-05-14 11:55:38.000000000 +0200 @@ -0,0 +1,412 @@ +/* + * lzma_misc.c @@ -1151,9 +1108,50 @@ diff -Naur linux-old/arch/i386/boot/compressed/lzma_misc.c linux-lzma/arch/i386/ + if (high_loaded) close_output_buffer_if_we_run_high(mv); + return high_loaded; +} -diff -urN linux-2.6.19.2/scripts/Makefile.lib linux-2.6.19.2.new/scripts/Makefile.lib ---- linux-2.6.19.2/scripts/Makefile.lib 2007-01-10 20:10:37.000000000 +0100 -+++ linux-2.6.19.2.new/scripts/Makefile.lib 2007-04-15 23:51:54.000000000 +0200 +diff -Nur linux-2.6.21.1/arch/i386/boot/compressed/Makefile linux-2.6.21.1-owrt/arch/i386/boot/compressed/Makefile +--- linux-2.6.21.1/arch/i386/boot/compressed/Makefile 2007-04-27 23:49:26.000000000 +0200 ++++ linux-2.6.21.1-owrt/arch/i386/boot/compressed/Makefile 2007-05-14 12:01:25.000000000 +0200 +@@ -4,7 +4,7 @@ + # create a compressed vmlinux image from the original vmlinux + # + +-targets := vmlinux vmlinux.bin vmlinux.bin.gz head.o misc.o piggy.o \ ++targets := vmlinux vmlinux.bin vmlinux.bin.lzma head.o lzma_misc.o piggy.o \ + vmlinux.bin.all vmlinux.relocs + EXTRA_AFLAGS := -traditional + +@@ -12,7 +12,7 @@ + CFLAGS_misc.o += -fPIC + hostprogs-y := relocs + +-$(obj)/vmlinux: $(src)/vmlinux.lds $(obj)/head.o $(obj)/misc.o $(obj)/piggy.o FORCE ++$(obj)/vmlinux: $(src)/vmlinux.lds $(obj)/head.o $(obj)/lzma_misc.o $(obj)/piggy.o FORCE + $(call if_changed,ld) + @: + +@@ -32,14 +32,14 @@ + $(call if_changed,relocbin) + + ifdef CONFIG_RELOCATABLE +-$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin.all FORCE +- $(call if_changed,gzip) ++$(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin.all FORCE ++ $(call if_changed,lzma) + else +-$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE +- $(call if_changed,gzip) ++$(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE ++ $(call if_changed,lzma) + endif + + LDFLAGS_piggy.o := -r --format binary --oformat elf32-i386 -T + +-$(obj)/piggy.o: $(src)/vmlinux.scr $(obj)/vmlinux.bin.gz FORCE ++$(obj)/piggy.o: $(src)/vmlinux.scr $(obj)/vmlinux.bin.lzma FORCE + $(call if_changed,ld) +diff -Nur linux-2.6.21.1/scripts/Makefile.lib linux-2.6.21.1-owrt/scripts/Makefile.lib +--- linux-2.6.21.1/scripts/Makefile.lib 2007-04-27 23:49:26.000000000 +0200 ++++ linux-2.6.21.1-owrt/scripts/Makefile.lib 2007-05-14 11:55:38.000000000 +0200 @@ -162,4 +162,9 @@ quiet_cmd_gzip = GZIP $@ cmd_gzip = gzip -f -9 < $< > $@ diff --git a/target/linux/generic-2.6/patches/700-airprime.patch b/target/linux/generic-2.6/patches/700-airprime.patch deleted file mode 100644 index 5eafe1da27..0000000000 --- a/target/linux/generic-2.6/patches/700-airprime.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -urN linux-2.6.19.2-old/drivers/usb/serial/airprime.c linux-2.6.19.2-dev/drivers/usb/serial/airprime.c ---- linux-2.6.19.2-old/drivers/usb/serial/airprime.c 2007-05-01 14:11:28.000000000 -0700 -+++ linux-2.6.19.2-dev/drivers/usb/serial/airprime.c 2007-05-01 14:12:03.000000000 -0700 -@@ -20,6 +20,8 @@ - { USB_DEVICE(0x0c88, 0x17da) }, /* Kyocera Wireless KPC650/Passport */ - { USB_DEVICE(0x1410, 0x1110) }, /* Novatel Wireless Merlin CDMA */ - { USB_DEVICE(0x1410, 0x1100) }, /* ExpressCard34 Qualcomm 3G CDMA */ -+ { USB_DEVICE(0x1410, 0x1130) }, /* Novatel Wireless S720 CDMA/EV-DO */ -+ { USB_DEVICE(0x1410, 0x2110) }, /* Novatel Wireless U720 CDMA/EV-DO */ - { }, - }; - MODULE_DEVICE_TABLE(usb, id_table); diff --git a/target/linux/generic-2.6/patches/901-asm_bitops_include.patch b/target/linux/generic-2.6/patches/901-asm_bitops_include.patch deleted file mode 100644 index ec18e9b102..0000000000 --- a/target/linux/generic-2.6/patches/901-asm_bitops_include.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff -urN linux-2.6.19.old/include/asm-mips/bitops.h linux-2.6.19.dev/include/asm-mips/bitops.h ---- linux-2.6.19.old/include/asm-mips/bitops.h 2006-11-29 22:57:37.000000000 +0100 -+++ linux-2.6.19.dev/include/asm-mips/bitops.h 2006-12-14 03:14:07.000000000 +0100 -@@ -11,6 +11,7 @@ - - #include - #include -+#include - #include - #include /* sigh ... */ - #include diff --git a/target/linux/generic-2.6/patches/904-ls_time_locale.patch b/target/linux/generic-2.6/patches/904-ls_time_locale.patch index cc4a392b8f..2b7d07c2fe 100644 --- a/target/linux/generic-2.6/patches/904-ls_time_locale.patch +++ b/target/linux/generic-2.6/patches/904-ls_time_locale.patch @@ -1,24 +1,21 @@ -diff -urN linux-2.6.19.2/scripts/gen_initramfs_list.sh linux-2.6.19.2.new/scripts/gen_initramfs_list.sh ---- linux-2.6.19.2/scripts/gen_initramfs_list.sh 2007-01-10 20:10:37.000000000 +0100 -+++ linux-2.6.19.2.new/scripts/gen_initramfs_list.sh 2007-05-03 16:25:06.000000000 +0200 -@@ -120,9 +120,9 @@ +diff -Nur linux-2.6.21.1/scripts/gen_initramfs_list.sh linux-2.6.21.1-owrt/scripts/gen_initramfs_list.sh +--- linux-2.6.21.1/scripts/gen_initramfs_list.sh 2007-04-27 23:49:26.000000000 +0200 ++++ linux-2.6.21.1-owrt/scripts/gen_initramfs_list.sh 2007-05-14 12:18:02.000000000 +0200 +@@ -125,7 +125,7 @@ + str="${ftype} ${name} ${location} ${str}" ;; "nod") - local dev_type= -- local maj=$(LC_ALL=C ls -l "${location}" | \ -+ local maj=$(LC_ALL=C ls --time-style=locale -l "${location}" | \ - gawk '{sub(/,/, "", $5); print $5}') -- local min=$(LC_ALL=C ls -l "${location}" | \ -+ local min=$(LC_ALL=C ls --time-style=locale -l "${location}" | \ - gawk '{print $6}') - - if [ -b "${location}" ]; then -@@ -133,7 +133,7 @@ - str="${ftype} ${name} ${str} ${dev_type} ${maj} ${min}" +- local dev=`LC_ALL=C ls -l "${location}"` ++ local dev=`LC_ALL=C ls -l --time-style=locale "${location}"` + local maj=`field 5 ${dev}` + local min=`field 6 ${dev}` + maj=${maj%,} +@@ -135,7 +135,7 @@ + str="${ftype} ${name} ${str} ${dev} ${maj} ${min}" ;; "slink") -- local target=$(LC_ALL=C ls -l "${location}" | \ -+ local target=$(LC_ALL=C ls --time-style=locale -l "${location}" | \ - gawk '{print $11}') +- local target=`field 11 $(LC_ALL=C ls -l "${location}")` ++ local target=`field 11 $(LC_ALL=C ls -l --time-style=locale "${location}")` str="${ftype} ${name} ${target} ${str}" ;; + *) diff --git a/target/linux/ixp4xx-2.6/config/default b/target/linux/ixp4xx-2.6/config/default index 39521838c5..066f6219a9 100644 --- a/target/linux/ixp4xx-2.6/config/default +++ b/target/linux/ixp4xx-2.6/config/default @@ -15,8 +15,10 @@ CONFIG_ALIGNMENT_TRAP=y # CONFIG_ARCH_H720X is not set # CONFIG_ARCH_IMX is not set # CONFIG_ARCH_INTEGRATOR is not set +# CONFIG_ARCH_IOP13XX is not set # CONFIG_ARCH_IOP32X is not set # CONFIG_ARCH_IOP33X is not set +CONFIG_ARCH_IXCDP1100=y CONFIG_ARCH_IXDP425=y CONFIG_ARCH_IXDP4XX=y # CONFIG_ARCH_IXP2000 is not set @@ -25,6 +27,7 @@ CONFIG_ARCH_IXP4XX=y # CONFIG_ARCH_L7200 is not set # CONFIG_ARCH_LH7A40X is not set # CONFIG_ARCH_NETX is not set +# CONFIG_ARCH_NS9XXX is not set # CONFIG_ARCH_OMAP is not set # CONFIG_ARCH_PNX4008 is not set # CONFIG_ARCH_PRPMC1100 is not set @@ -202,9 +205,11 @@ CONFIG_IXP4XX_NPE_FW_MTD=y CONFIG_IXP4XX_QMGR=y CONFIG_IXP4XX_CRYPTO=y CONFIG_IXP4XX_WATCHDOG=y +# CONFIG_IWMMXT is not set # CONFIG_JFFS2_COMPRESSION_OPTIONS is not set CONFIG_JFFS2_FS_DEBUG=0 # CONFIG_JFS_FS is not set +# CONFIG_KEXEC is not set # CONFIG_LANMEDIA is not set CONFIG_LEGACY_PTYS=y CONFIG_LEGACY_PTY_COUNT=256 @@ -318,6 +323,7 @@ CONFIG_PATA_ARTOP=m # CONFIG_PATA_HPT37X is not set # CONFIG_PATA_HPT3X2N is not set # CONFIG_PATA_HPT3X3 is not set +CONFIG_PATA_IXP4XX_CF=m # CONFIG_PATA_IT821X is not set # CONFIG_PATA_JMICRON is not set # CONFIG_PATA_MPIIX is not set @@ -389,6 +395,7 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y # CONFIG_SENSORS_ADM1021 is not set # CONFIG_SENSORS_ADM1025 is not set # CONFIG_SENSORS_ADM1026 is not set +# CONFIG_SENSORS_ADM1029 is not set # CONFIG_SENSORS_ADM1031 is not set # CONFIG_SENSORS_ADM9240 is not set # CONFIG_SENSORS_ASB100 is not set @@ -416,6 +423,7 @@ CONFIG_SENSORS_EEPROM=y # CONFIG_SENSORS_MAX1619 is not set # CONFIG_SENSORS_MAX6875 is not set # CONFIG_SENSORS_PC87360 is not set +# CONFIG_SENSORS_PC87427 is not set # CONFIG_SENSORS_PCA9539 is not set # CONFIG_SENSORS_PCF8574 is not set # CONFIG_SENSORS_PCF8591 is not set @@ -431,6 +439,7 @@ CONFIG_SENSORS_EEPROM=y # CONFIG_SENSORS_W83781D is not set # CONFIG_SENSORS_W83791D is not set # CONFIG_SENSORS_W83792D is not set +# CONFIG_SENSORS_W83793 is not set # CONFIG_SENSORS_W83L785TS is not set # CONFIG_SERIAL_8250_EXTENDED is not set # CONFIG_SHMEM is not set diff --git a/target/linux/ixp4xx-2.6/patches/080-trivial_nslu2_nas100d_cleanup.patch b/target/linux/ixp4xx-2.6/patches/080-trivial_nslu2_nas100d_cleanup.patch new file mode 100644 index 0000000000..f0bfcdec5f --- /dev/null +++ b/target/linux/ixp4xx-2.6/patches/080-trivial_nslu2_nas100d_cleanup.patch @@ -0,0 +1,196 @@ +This trivial patch updates the nslu2 and nas-100d headers to +remove pointless GPIO defines, and updates nslu2-setup.c +accordingly. In addition minor style cleanups to some comments +are included. + +Signed-off-by: Michael-Luke Jones + +Index: linux-2.6.21-armeb/arch/arm/mach-ixp4xx/nslu2-setup.c +=================================================================== +--- linux-2.6.21-armeb.orig/arch/arm/mach-ixp4xx/nslu2-setup.c 2007-05-09 07:32:43.000000000 -0700 ++++ linux-2.6.21-armeb/arch/arm/mach-ixp4xx/nslu2-setup.c 2007-05-09 07:32:46.000000000 -0700 +@@ -50,26 +50,26 @@ + static struct resource nslu2_led_resources[] = { + { + .name = "ready", /* green led */ +- .start = NSLU2_LED_GRN, +- .end = NSLU2_LED_GRN, ++ .start = NSLU2_LED_GRN_GPIO, ++ .end = NSLU2_LED_GRN_GPIO, + .flags = IXP4XX_GPIO_HIGH, + }, + { + .name = "status", /* red led */ +- .start = NSLU2_LED_RED, +- .end = NSLU2_LED_RED, ++ .start = NSLU2_LED_RED_GPIO, ++ .end = NSLU2_LED_RED_GPIO, + .flags = IXP4XX_GPIO_HIGH, + }, + { + .name = "disk-1", +- .start = NSLU2_LED_DISK1, +- .end = NSLU2_LED_DISK1, ++ .start = NSLU2_LED_DISK1_GPIO, ++ .end = NSLU2_LED_DISK1_GPIO, + .flags = IXP4XX_GPIO_LOW, + }, + { + .name = "disk-2", +- .start = NSLU2_LED_DISK2, +- .end = NSLU2_LED_DISK2, ++ .start = NSLU2_LED_DISK2_GPIO, ++ .end = NSLU2_LED_DISK2_GPIO, + .flags = IXP4XX_GPIO_LOW, + }, + }; +@@ -181,7 +181,8 @@ + + pm_power_off = nslu2_power_off; + +- /* This is only useful on a modified machine, but it is valuable ++ /* ++ * This is only useful on a modified machine, but it is valuable + * to have it first in order to see debug messages, and so that + * it does *not* get removed if platform_add_devices fails! + */ +Index: linux-2.6.21-armeb/include/asm-arm/arch-ixp4xx/nslu2.h +=================================================================== +--- linux-2.6.21-armeb.orig/include/asm-arm/arch-ixp4xx/nslu2.h 2007-05-09 07:32:43.000000000 -0700 ++++ linux-2.6.21-armeb/include/asm-arm/arch-ixp4xx/nslu2.h 2007-05-09 07:32:46.000000000 -0700 +@@ -9,7 +9,7 @@ + * based on ixdp425.h: + * Copyright 2004 (c) MontaVista, Software, Inc. + * +- * This file is licensed under the terms of the GNU General Public ++ * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + */ +@@ -34,36 +34,14 @@ + #define NSLU2_PCI_INTC_PIN 9 + #define NSLU2_PCI_INTD_PIN 8 + +- + /* NSLU2 Timer */ + #define NSLU2_FREQ 66000000 +-#define NSLU2_CLOCK_TICK_RATE (((NSLU2_FREQ / HZ & ~IXP4XX_OST_RELOAD_MASK) + 1) * HZ) +-#define NSLU2_CLOCK_TICKS_PER_USEC ((NSLU2_CLOCK_TICK_RATE + USEC_PER_SEC/2) / USEC_PER_SEC) +- +-/* GPIO */ +- +-#define NSLU2_GPIO0 0 +-#define NSLU2_GPIO1 1 +-#define NSLU2_GPIO2 2 +-#define NSLU2_GPIO3 3 +-#define NSLU2_GPIO4 4 +-#define NSLU2_GPIO5 5 +-#define NSLU2_GPIO6 6 +-#define NSLU2_GPIO7 7 +-#define NSLU2_GPIO8 8 +-#define NSLU2_GPIO9 9 +-#define NSLU2_GPIO10 10 +-#define NSLU2_GPIO11 11 +-#define NSLU2_GPIO12 12 +-#define NSLU2_GPIO13 13 +-#define NSLU2_GPIO14 14 +-#define NSLU2_GPIO15 15 + + /* Buttons */ + +-#define NSLU2_PB_GPIO NSLU2_GPIO5 +-#define NSLU2_PO_GPIO NSLU2_GPIO8 /* power off */ +-#define NSLU2_RB_GPIO NSLU2_GPIO12 ++#define NSLU2_PB_GPIO 5 ++#define NSLU2_PO_GPIO 8 /* power off */ ++#define NSLU2_RB_GPIO 12 + + #define NSLU2_PB_IRQ IRQ_IXP4XX_GPIO5 + #define NSLU2_RB_IRQ IRQ_IXP4XX_GPIO12 +@@ -79,16 +57,16 @@ + + /* LEDs */ + +-#define NSLU2_LED_RED NSLU2_GPIO0 +-#define NSLU2_LED_GRN NSLU2_GPIO1 ++#define NSLU2_LED_RED_GPIO 0 ++#define NSLU2_LED_GRN_GPIO 1 + +-#define NSLU2_LED_RED_BM (1L << NSLU2_LED_RED) +-#define NSLU2_LED_GRN_BM (1L << NSLU2_LED_GRN) ++#define NSLU2_LED_RED_BM (1L << NSLU2_LED_RED_GPIO) ++#define NSLU2_LED_GRN_BM (1L << NSLU2_LED_GRN_GPIO) + +-#define NSLU2_LED_DISK1 NSLU2_GPIO3 +-#define NSLU2_LED_DISK2 NSLU2_GPIO2 ++#define NSLU2_LED_DISK1_GPIO 3 ++#define NSLU2_LED_DISK2_GPIO 2 + +-#define NSLU2_LED_DISK1_BM (1L << NSLU2_GPIO2) +-#define NSLU2_LED_DISK2_BM (1L << NSLU2_GPIO3) ++#define NSLU2_LED_DISK1_BM (1L << NSLU2_LED_DISK1_GPIO) ++#define NSLU2_LED_DISK2_BM (1L << NSLU2_LED_DISK2_GPIO) + + +Index: linux-2.6.21-armeb/include/asm-arm/arch-ixp4xx/nas100d.h +=================================================================== +--- linux-2.6.21-armeb.orig/include/asm-arm/arch-ixp4xx/nas100d.h 2007-04-25 20:08:32.000000000 -0700 ++++ linux-2.6.21-armeb/include/asm-arm/arch-ixp4xx/nas100d.h 2007-05-09 07:34:14.000000000 -0700 +@@ -10,7 +10,7 @@ + * based on ixdp425.h: + * Copyright 2004 (c) MontaVista, Software, Inc. + * +- * This file is licensed under the terms of the GNU General Public ++ * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + */ +@@ -36,31 +36,11 @@ + #define NAS100D_PCI_INTD_PIN 8 + #define NAS100D_PCI_INTE_PIN 7 + +-/* GPIO */ +- +-#define NAS100D_GPIO0 0 +-#define NAS100D_GPIO1 1 +-#define NAS100D_GPIO2 2 +-#define NAS100D_GPIO3 3 +-#define NAS100D_GPIO4 4 +-#define NAS100D_GPIO5 5 +-#define NAS100D_GPIO6 6 +-#define NAS100D_GPIO7 7 +-#define NAS100D_GPIO8 8 +-#define NAS100D_GPIO9 9 +-#define NAS100D_GPIO10 10 +-#define NAS100D_GPIO11 11 +-#define NAS100D_GPIO12 12 +-#define NAS100D_GPIO13 13 +-#define NAS100D_GPIO14 14 +-#define NAS100D_GPIO15 15 +- +- + /* Buttons */ + +-#define NAS100D_PB_GPIO NAS100D_GPIO14 +-#define NAS100D_RB_GPIO NAS100D_GPIO4 +-#define NAS100D_PO_GPIO NAS100D_GPIO12 /* power off */ ++#define NAS100D_PB_GPIO 14 ++#define NAS100D_RB_GPIO 4 ++#define NAS100D_PO_GPIO 12 /* power off */ + + #define NAS100D_PB_IRQ IRQ_IXP4XX_GPIO14 + #define NAS100D_RB_IRQ IRQ_IXP4XX_GPIO4 +Index: linux-2.6.21-armeb/arch/arm/mach-ixp4xx/nas100d-setup.c +=================================================================== +--- linux-2.6.21-armeb.orig/arch/arm/mach-ixp4xx/nas100d-setup.c 2007-05-09 07:32:43.000000000 -0700 ++++ linux-2.6.21-armeb/arch/arm/mach-ixp4xx/nas100d-setup.c 2007-05-09 07:34:55.000000000 -0700 +@@ -155,7 +155,8 @@ + + pm_power_off = nas100d_power_off; + +- /* This is only useful on a modified machine, but it is valuable ++ /* ++ * This is only useful on a modified machine, but it is valuable + * to have it first in order to see debug messages, and so that + * it does *not* get removed if platform_add_devices fails! + */ diff --git a/target/linux/ixp4xx-2.6/patches/100-npe_driver.patch b/target/linux/ixp4xx-2.6/patches/100-npe_driver.patch index 8db6276587..78fb119bcd 100644 --- a/target/linux/ixp4xx-2.6/patches/100-npe_driver.patch +++ b/target/linux/ixp4xx-2.6/patches/100-npe_driver.patch @@ -1,184 +1,10 @@ -diff -Naur linux-2.6.19.orig/arch/arm/mach-ixp4xx/common.c linux-2.6.19/arch/arm/mach-ixp4xx/common.c ---- linux-2.6.19.orig/arch/arm/mach-ixp4xx/common.c 2006-11-29 14:57:37.000000000 -0700 -+++ linux-2.6.19/arch/arm/mach-ixp4xx/common.c 2007-01-12 21:54:40.000000000 -0700 -@@ -314,6 +314,90 @@ - &ixp46x_i2c_controller - }; - -+static struct npe_plat_data npea = { -+ .name = "NPE-A", -+ .data_size = 0x800, -+ .inst_size = 0x1000, -+ .id = 0, -+}; -+ -+static struct npe_plat_data npeb = { -+ .name = "NPE-B", -+ .data_size = 0x800, -+ .inst_size = 0x800, -+ .id = 1, -+}; -+ -+static struct npe_plat_data npec = { -+ .name = "NPE-C", -+ .data_size = 0x800, -+ .inst_size = 0x800, -+ .id = 2, -+}; -+ -+static struct resource res_npea = { -+ .start = IXP4XX_NPEA_BASE_PHYS, -+ .end = IXP4XX_NPEA_BASE_PHYS + 0xfff, -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct resource res_npeb = { -+ .start = IXP4XX_NPEB_BASE_PHYS, -+ .end = IXP4XX_NPEB_BASE_PHYS + 0xfff, -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct resource res_npec = { -+ .start = IXP4XX_NPEC_BASE_PHYS, -+ .end = IXP4XX_NPEC_BASE_PHYS + 0xfff, -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct platform_device dev_npea = { -+ .name = "ixp4xx_npe", -+ .id = 0, -+ .dev.platform_data = &npea, -+ .num_resources = 1, -+ .resource = &res_npea, -+}; -+ -+static struct platform_device dev_npeb = { -+ .name = "ixp4xx_npe", -+ .id = 1, -+ .dev.platform_data = &npeb, -+ .num_resources = 1, -+ .resource = &res_npeb, -+}; -+ -+static struct platform_device dev_npec = { -+ .name = "ixp4xx_npe", -+ .id = 2, -+ .dev.platform_data = &npec, -+ .num_resources = 1, -+ .resource = &res_npec, -+}; -+ -+/* QMGR */ -+static struct resource res_qmgr[] = { -+{ -+ .start = IXP4XX_QMGR_BASE_PHYS, -+ .end = IXP4XX_QMGR_BASE_PHYS + IXP4XX_QMGR_REGION_SIZE -1, -+ .flags = IORESOURCE_MEM, -+}, { -+ .start = IRQ_IXP4XX_QM1, -+ .flags = IORESOURCE_IRQ, -+} }; -+ -+static struct platform_device qmgr = { -+ .name = "ixp4xx_qmgr", -+ .id = 0, -+ .dev = { -+ .coherent_dma_mask = DMA_32BIT_MASK, -+ }, -+ .num_resources = ARRAY_SIZE(res_qmgr), -+ .resource = res_qmgr, -+}; -+ - unsigned long ixp4xx_exp_bus_size; - EXPORT_SYMBOL(ixp4xx_exp_bus_size); - -@@ -333,8 +417,19 @@ - break; - } - } -+ npeb.inst_size = 0x1000; -+ npec.inst_size = 0x1000; - } - -+ platform_device_register(&qmgr); -+ -+ if (ix_fuse() & IX_FUSE_NPEA) -+ platform_device_register(&dev_npea); -+ if (ix_fuse() & IX_FUSE_NPEB) -+ platform_device_register(&dev_npeb); -+ if (ix_fuse() & IX_FUSE_NPEC) -+ platform_device_register(&dev_npec); -+ - printk("IXP4xx: Using %luMiB expansion bus window size\n", - ixp4xx_exp_bus_size >> 20); - } -diff -Naur linux-2.6.19.orig/arch/arm/mach-ixp4xx/ixdp425-setup.c linux-2.6.19/arch/arm/mach-ixp4xx/ixdp425-setup.c ---- linux-2.6.19.orig/arch/arm/mach-ixp4xx/ixdp425-setup.c 2006-11-29 14:57:37.000000000 -0700 -+++ linux-2.6.19/arch/arm/mach-ixp4xx/ixdp425-setup.c 2007-01-12 21:54:40.000000000 -0700 -@@ -101,10 +101,59 @@ - .resource = ixdp425_uart_resources - }; - -+/* MACs */ -+static struct resource res_mac0 = { -+ .start = IXP4XX_EthB_BASE_PHYS, -+ .end = IXP4XX_EthB_BASE_PHYS + 0x1ff, -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct resource res_mac1 = { -+ .start = IXP4XX_EthC_BASE_PHYS, -+ .end = IXP4XX_EthC_BASE_PHYS + 0x1ff, -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct mac_plat_info plat_mac0 = { -+ .npe_id = 1, -+ .phy_id = 0, -+ .eth_id = 0, -+ .rxq_id = 27, -+ .txq_id = 24, -+ .rxdoneq_id = 4, -+}; -+ -+static struct mac_plat_info plat_mac1 = { -+ .npe_id = 2, -+ .phy_id = 1, -+ .eth_id = 1, -+ .rxq_id = 28, -+ .txq_id = 25, -+ .rxdoneq_id = 5, -+}; -+ -+static struct platform_device mac0 = { -+ .name = "ixp4xx_mac", -+ .id = 0, -+ .dev.platform_data = &plat_mac0, -+ .num_resources = 1, -+ .resource = &res_mac0, -+}; -+ -+static struct platform_device mac1 = { -+ .name = "ixp4xx_mac", -+ .id = 1, -+ .dev.platform_data = &plat_mac1, -+ .num_resources = 1, -+ .resource = &res_mac1, -+}; -+ - static struct platform_device *ixdp425_devices[] __initdata = { - &ixdp425_i2c_controller, - &ixdp425_flash, -- &ixdp425_uart -+ &ixdp425_uart, -+ &mac0, -+ &mac1, - }; - - static void __init ixdp425_init(void) -diff -Naur linux-2.6.19.orig/Documentation/networking/ixp4xx/IxNpeMicrocode.h linux-2.6.19/Documentation/networking/ixp4xx/IxNpeMicrocode.h ---- linux-2.6.19.orig/Documentation/networking/ixp4xx/IxNpeMicrocode.h 1969-12-31 17:00:00.000000000 -0700 -+++ linux-2.6.19/Documentation/networking/ixp4xx/IxNpeMicrocode.h 2007-01-12 21:54:40.000000000 -0700 +diff --git a/Documentation/networking/ixp4xx/IxNpeMicrocode.h b/Documentation/networking/ixp4xx/IxNpeMicrocode.h +new file mode 100644 +index 0000000..e5a4bd3 +Index: linux-2.6.21-rc1-arm/Documentation/networking/ixp4xx/IxNpeMicrocode.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.21-rc1-arm/Documentation/networking/ixp4xx/IxNpeMicrocode.h 2007-02-21 02:24:35.000000000 -0800 @@ -0,0 +1,143 @@ +/* + * IxNpeMicrocode.h - Headerfile for compiling the Intel microcode C file @@ -323,9 +149,77 @@ diff -Naur linux-2.6.19.orig/Documentation/networking/ixp4xx/IxNpeMicrocode.h li + close(fd); + return 0; +} -diff -Naur linux-2.6.19.orig/Documentation/networking/ixp4xx/mc_grab.c linux-2.6.19/Documentation/networking/ixp4xx/mc_grab.c ---- linux-2.6.19.orig/Documentation/networking/ixp4xx/mc_grab.c 1969-12-31 17:00:00.000000000 -0700 -+++ linux-2.6.19/Documentation/networking/ixp4xx/mc_grab.c 2007-01-12 21:54:40.000000000 -0700 +Index: linux-2.6.21-rc1-arm/Documentation/networking/ixp4xx/README +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.21-rc1-arm/Documentation/networking/ixp4xx/README 2007-02-21 02:24:35.000000000 -0800 +@@ -0,0 +1,62 @@ ++Informations about the Networking Driver using the IXP4XX CPU internal NPEs ++and Queue manager. ++ ++If this driver is used, the IAL (Intel Access Library) must not be loaded. ++However, the IAL may be loaded, if this Modules are unloaded: ++ ixp4xx_npe.ko, ixp4xx_qmgr.ko ixp4xx_mac.ko ++ ++This also means that HW crypto accelleration does NOT work when using this ++driver, unless I have finished my crypto driver for NPE-C ++ ++ ++Adoption to your custom board: ++------------------------------ ++use "arch/arm/mach-ixp4xx/ixdp425-setup.c" as template: ++ ++in "static struct mac_plat_info" adopt the entry "phy_id" to your needs ++(Ask your hardware designer about the PHY id) ++ ++The order of "&mac0" and "&mac1" in the "struct platform_device" ++determines which of them becomes eth0 and eth1 ++ ++ ++The Microcode: ++--------------- ++Solution 1) ++ Configure "CONFIG_HOTPLUG" and "CONFIG_FW_LOADER" and configure ++ IXP4XX_NPE as module. ++ The default hotplug script will load the Firmware from ++ /usr/lib/hotplug/firmware/NPE-[ABC] ++ see Documentation/firmware_class/hotplug-script ++ ++ You should take care, that $ACTION is "add" and $SUBSYSTEM is "firmware" ++ to avoid unnessecary calls: ++ test $ACTION = "remove" -o $SUBSYSTEM != "firmware" && exit ++ ++Solution 2) ++ create a char-dev: "mknod /dev/misc/npe c 10 184" ++ cat the Microcode into it: ++ cat /usr/lib/hotplug/firmware/NPE-* > /dev/misc/npe ++ This also works if the driver is linked to the kernel ++ ++ Having a mix of both (e.g. solution 1 for NPE-B and solution 2 for NPE-C) ++ is perfectly ok and works. ++ ++ The state of the NPEs can be seen and changed at: ++ /sys/bus/platform/devices/ixp4xx_npe.X/state ++ ++ ++Obtaining the Microcode: ++------------------------ ++1) IxNpeMicrocode.h in this directory: ++ Download IPL_IXP400NPELIBRARYWITHCRYPTO-2_1.ZIP from Intel ++ It unpacks the Microcode IxNpeMicrocode.c ++ Read the Licence ! ++ Compile it with "gcc -Wall IxNpeMicrocode.c -o IxNpeMicrocode" on your host. ++ The resulting images can be moved to "/usr/lib/hotplug/firmware" ++ ++2) mc_grab.c in this directory: ++ Compile and execute it either on the host or on the target ++ to grab the microcode from a binary image like the RedBoot bootloader. ++ ++ +Index: linux-2.6.21-rc1-arm/Documentation/networking/ixp4xx/mc_grab.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.21-rc1-arm/Documentation/networking/ixp4xx/mc_grab.c 2007-02-21 02:24:35.000000000 -0800 @@ -0,0 +1,97 @@ +/* + * mc_grab.c - grabs IXP4XX microcode from a binary datastream @@ -424,75 +318,280 @@ diff -Naur linux-2.6.19.orig/Documentation/networking/ixp4xx/mc_grab.c linux-2.6 + fprintf(stderr, "Error reading Microcode\n"); + return ret; +} -diff -Naur linux-2.6.19.orig/Documentation/networking/ixp4xx/README linux-2.6.19/Documentation/networking/ixp4xx/README ---- linux-2.6.19.orig/Documentation/networking/ixp4xx/README 1969-12-31 17:00:00.000000000 -0700 -+++ linux-2.6.19/Documentation/networking/ixp4xx/README 2007-01-12 21:54:40.000000000 -0700 -@@ -0,0 +1,62 @@ -+Informations about the Networking Driver using the IXP4XX CPU internal NPEs -+and Queue manager. +Index: linux-2.6.21-rc1-arm/arch/arm/mach-ixp4xx/common.c +=================================================================== +--- linux-2.6.21-rc1-arm.orig/arch/arm/mach-ixp4xx/common.c 2007-02-21 02:24:18.000000000 -0800 ++++ linux-2.6.21-rc1-arm/arch/arm/mach-ixp4xx/common.c 2007-02-21 02:24:35.000000000 -0800 +@@ -357,6 +357,90 @@ + &ixp46x_i2c_controller + }; + ++static struct npe_plat_data npea = { ++ .name = "NPE-A", ++ .data_size = 0x800, ++ .inst_size = 0x1000, ++ .id = 0, ++}; + -+If this driver is used, the IAL (Intel Access Library) must not be loaded. -+However, the IAL may be loaded, if this Modules are unloaded: -+ ixp4xx_npe.ko, ixp4xx_qmgr.ko ixp4xx_mac.ko ++static struct npe_plat_data npeb = { ++ .name = "NPE-B", ++ .data_size = 0x800, ++ .inst_size = 0x800, ++ .id = 1, ++}; + -+This also means that HW crypto accelleration does NOT work when using this -+driver, unless I have finished my crypto driver for NPE-C ++static struct npe_plat_data npec = { ++ .name = "NPE-C", ++ .data_size = 0x800, ++ .inst_size = 0x800, ++ .id = 2, ++}; + ++static struct resource res_npea = { ++ .start = IXP4XX_NPEA_BASE_PHYS, ++ .end = IXP4XX_NPEA_BASE_PHYS + 0xfff, ++ .flags = IORESOURCE_MEM, ++}; + -+Adoption to your custom board: -+------------------------------ -+use "arch/arm/mach-ixp4xx/ixdp425-setup.c" as template: ++static struct resource res_npeb = { ++ .start = IXP4XX_NPEB_BASE_PHYS, ++ .end = IXP4XX_NPEB_BASE_PHYS + 0xfff, ++ .flags = IORESOURCE_MEM, ++}; + -+in "static struct mac_plat_info" adopt the entry "phy_id" to your needs -+(Ask your hardware designer about the PHY id) ++static struct resource res_npec = { ++ .start = IXP4XX_NPEC_BASE_PHYS, ++ .end = IXP4XX_NPEC_BASE_PHYS + 0xfff, ++ .flags = IORESOURCE_MEM, ++}; + -+The order of "&mac0" and "&mac1" in the "struct platform_device" -+determines which of them becomes eth0 and eth1 ++static struct platform_device dev_npea = { ++ .name = "ixp4xx_npe", ++ .id = 0, ++ .dev.platform_data = &npea, ++ .num_resources = 1, ++ .resource = &res_npea, ++}; + ++static struct platform_device dev_npeb = { ++ .name = "ixp4xx_npe", ++ .id = 1, ++ .dev.platform_data = &npeb, ++ .num_resources = 1, ++ .resource = &res_npeb, ++}; + -+The Microcode: -+--------------- -+Solution 1) -+ Configure "CONFIG_HOTPLUG" and "CONFIG_FW_LOADER" and configure -+ IXP4XX_NPE as module. -+ The default hotplug script will load the Firmware from -+ /usr/lib/hotplug/firmware/NPE-[ABC] -+ see Documentation/firmware_class/hotplug-script ++static struct platform_device dev_npec = { ++ .name = "ixp4xx_npe", ++ .id = 2, ++ .dev.platform_data = &npec, ++ .num_resources = 1, ++ .resource = &res_npec, ++}; + -+ You should take care, that $ACTION is "add" and $SUBSYSTEM is "firmware" -+ to avoid unnessecary calls: -+ test $ACTION = "remove" -o $SUBSYSTEM != "firmware" && exit ++/* QMGR */ ++static struct resource res_qmgr[] = { ++{ ++ .start = IXP4XX_QMGR_BASE_PHYS, ++ .end = IXP4XX_QMGR_BASE_PHYS + IXP4XX_QMGR_REGION_SIZE -1, ++ .flags = IORESOURCE_MEM, ++}, { ++ .start = IRQ_IXP4XX_QM1, ++ .flags = IORESOURCE_IRQ, ++} }; + -+Solution 2) -+ create a char-dev: "mknod /dev/misc/npe c 10 184" -+ cat the Microcode into it: -+ cat /usr/lib/hotplug/firmware/NPE-* > /dev/misc/npe -+ This also works if the driver is linked to the kernel ++static struct platform_device qmgr = { ++ .name = "ixp4xx_qmgr", ++ .id = 0, ++ .dev = { ++ .coherent_dma_mask = DMA_32BIT_MASK, ++ }, ++ .num_resources = ARRAY_SIZE(res_qmgr), ++ .resource = res_qmgr, ++}; + -+ Having a mix of both (e.g. solution 1 for NPE-B and solution 2 for NPE-C) -+ is perfectly ok and works. + unsigned long ixp4xx_exp_bus_size; + EXPORT_SYMBOL(ixp4xx_exp_bus_size); + +@@ -378,8 +462,19 @@ + break; + } + } ++ npeb.inst_size = 0x1000; ++ npec.inst_size = 0x1000; + } + ++ platform_device_register(&qmgr); + -+ The state of the NPEs can be seen and changed at: -+ /sys/bus/platform/devices/ixp4xx_npe.X/state ++ if (ix_fuse() & IX_FUSE_NPEA) ++ platform_device_register(&dev_npea); ++ if (ix_fuse() & IX_FUSE_NPEB) ++ platform_device_register(&dev_npeb); ++ if (ix_fuse() & IX_FUSE_NPEC) ++ platform_device_register(&dev_npec); + + printk("IXP4xx: Using %luMiB expansion bus window size\n", + ixp4xx_exp_bus_size >> 20); + } +Index: linux-2.6.21-rc1-arm/arch/arm/mach-ixp4xx/ixdp425-setup.c +=================================================================== +--- linux-2.6.21-rc1-arm.orig/arch/arm/mach-ixp4xx/ixdp425-setup.c 2007-02-21 02:24:18.000000000 -0800 ++++ linux-2.6.21-rc1-arm/arch/arm/mach-ixp4xx/ixdp425-setup.c 2007-02-21 02:24:35.000000000 -0800 +@@ -101,10 +101,59 @@ + .resource = ixdp425_uart_resources + }; + ++/* MACs */ ++static struct resource res_mac0 = { ++ .start = IXP4XX_EthB_BASE_PHYS, ++ .end = IXP4XX_EthB_BASE_PHYS + 0x1ff, ++ .flags = IORESOURCE_MEM, ++}; + -+Obtaining the Microcode: -+------------------------ -+1) IxNpeMicrocode.h in this directory: -+ Download IPL_IXP400NPELIBRARYWITHCRYPTO-2_1.ZIP from Intel -+ It unpacks the Microcode IxNpeMicrocode.c -+ Read the Licence ! -+ Compile it with "gcc -Wall IxNpeMicrocode.c -o IxNpeMicrocode" on your host. -+ The resulting images can be moved to "/usr/lib/hotplug/firmware" ++static struct resource res_mac1 = { ++ .start = IXP4XX_EthC_BASE_PHYS, ++ .end = IXP4XX_EthC_BASE_PHYS + 0x1ff, ++ .flags = IORESOURCE_MEM, ++}; + -+2) mc_grab.c in this directory: -+ Compile and execute it either on the host or on the target -+ to grab the microcode from a binary image like the RedBoot bootloader. ++static struct mac_plat_info plat_mac0 = { ++ .npe_id = 1, ++ .phy_id = 0, ++ .eth_id = 0, ++ .rxq_id = 27, ++ .txq_id = 24, ++ .rxdoneq_id = 4, ++}; ++ ++static struct mac_plat_info plat_mac1 = { ++ .npe_id = 2, ++ .phy_id = 1, ++ .eth_id = 1, ++ .rxq_id = 28, ++ .txq_id = 25, ++ .rxdoneq_id = 5, ++}; ++ ++static struct platform_device mac0 = { ++ .name = "ixp4xx_mac", ++ .id = 0, ++ .dev.platform_data = &plat_mac0, ++ .num_resources = 1, ++ .resource = &res_mac0, ++}; ++ ++static struct platform_device mac1 = { ++ .name = "ixp4xx_mac", ++ .id = 1, ++ .dev.platform_data = &plat_mac1, ++ .num_resources = 1, ++ .resource = &res_mac1, ++}; ++ + static struct platform_device *ixdp425_devices[] __initdata = { + &ixdp425_i2c_controller, + &ixdp425_flash, +- &ixdp425_uart ++ &ixdp425_uart, ++ &mac0, ++ &mac1, + }; + + static void __init ixdp425_init(void) +Index: linux-2.6.21-rc1-arm/drivers/net/Kconfig +=================================================================== +--- linux-2.6.21-rc1-arm.orig/drivers/net/Kconfig 2007-02-21 02:24:18.000000000 -0800 ++++ linux-2.6.21-rc1-arm/drivers/net/Kconfig 2007-02-21 02:24:35.000000000 -0800 +@@ -201,6 +201,8 @@ + + source "drivers/net/arm/Kconfig" + ++source "drivers/net/ixp4xx/Kconfig" ++ + config MACE + tristate "MACE (Power Mac ethernet) support" + depends on NET_ETHERNET && PPC_PMAC && PPC32 +Index: linux-2.6.21-rc1-arm/drivers/net/Makefile +=================================================================== +--- linux-2.6.21-rc1-arm.orig/drivers/net/Makefile 2007-02-21 02:24:18.000000000 -0800 ++++ linux-2.6.21-rc1-arm/drivers/net/Makefile 2007-02-21 02:24:35.000000000 -0800 +@@ -212,6 +212,7 @@ + obj-$(CONFIG_IRDA) += irda/ + obj-$(CONFIG_ETRAX_ETHERNET) += cris/ + obj-$(CONFIG_ENP2611_MSF_NET) += ixp2000/ ++obj-$(CONFIG_IXP4XX_NPE) += ixp4xx/ + + obj-$(CONFIG_NETCONSOLE) += netconsole.o + +Index: linux-2.6.21-rc1-arm/drivers/net/ixp4xx/Kconfig +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.21-rc1-arm/drivers/net/ixp4xx/Kconfig 2007-02-21 02:24:35.000000000 -0800 +@@ -0,0 +1,48 @@ ++config IXP4XX_QMGR ++ tristate "IXP4xx Queue Manager support" ++ depends on ARCH_IXP4XX ++ depends on NET_ETHERNET ++ help ++ The IXP4XX Queue manager is a configurable hardware ringbuffer. ++ It is used by the NPEs to exchange data from and to the CPU. ++ You can either use this OR the Intel Access Library (IAL) ++ ++config IXP4XX_NPE ++ tristate "IXP4xx NPE support" ++ depends on ARCH_IXP4XX ++ depends on NET_ETHERNET ++ help ++ The IXP4XX NPE driver supports the 3 CPU co-processors called ++ "Network Processing Engines" (NPE). It adds support fo downloading ++ the Microcode (firmware) via Hotplug or character-special-device. ++ More about this at: Documentation/networking/ixp4xx/README. ++ You can either use this OR the Intel Access Library (IAL) ++ ++config IXP4XX_FW_LOAD ++ bool "Use Firmware hotplug for Microcode download" ++ depends on IXP4XX_NPE ++ select HOTPLUG ++ select FW_LOADER ++ help ++ The default hotplug script will load the Firmware from ++ /usr/lib/hotplug/firmware/NPE-[ABC] ++ see Documentation/firmware_class/hotplug-script ++ ++config IXP4XX_MAC ++ tristate "IXP4xx MAC support" ++ depends on IXP4XX_NPE ++ depends on IXP4XX_QMGR ++ depends on NET_ETHERNET ++ select MII ++ help ++ The IXP4XX MAC driver supports the MACs on the IXP4XX CPUs. ++ There are 2 on ixp425 and up to 5 on ixdp465. ++ You can either use this OR the Intel Access Library (IAL) + ++config IXP4XX_CRYPTO ++ tristate "IXP4xx crypto support" ++ depends on IXP4XX_NPE ++ depends on IXP4XX_QMGR ++ help ++ This driver is a generic NPE-crypto access layer. ++ You need additional code in OCF for example. +Index: linux-2.6.21-rc1-arm/drivers/net/ixp4xx/Makefile +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.21-rc1-arm/drivers/net/ixp4xx/Makefile 2007-02-21 02:24:35.000000000 -0800 +@@ -0,0 +1,7 @@ ++obj-$(CONFIG_IXP4XX_QMGR) += ixp4xx_qmgr.o ++obj-$(CONFIG_IXP4XX_NPE) += ixp4xx_npe.o ++obj-$(CONFIG_IXP4XX_MAC) += ixp4xx_mac.o ++obj-$(CONFIG_IXP4XX_CRYPTO) += ixp4xx_crypto.o + -diff -Naur linux-2.6.19.orig/drivers/net/ixp4xx/ixp4xx_crypto.c linux-2.6.19/drivers/net/ixp4xx/ixp4xx_crypto.c ---- linux-2.6.19.orig/drivers/net/ixp4xx/ixp4xx_crypto.c 1969-12-31 17:00:00.000000000 -0700 -+++ linux-2.6.19/drivers/net/ixp4xx/ixp4xx_crypto.c 2007-01-12 21:54:40.000000000 -0700 ++ixp4xx_npe-objs := ucode_dl.o npe_mh.o npe.o ++ixp4xx_mac-objs := mac_driver.o phy.o +Index: linux-2.6.21-rc1-arm/drivers/net/ixp4xx/ixp4xx_crypto.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.21-rc1-arm/drivers/net/ixp4xx/ixp4xx_crypto.c 2007-02-21 02:24:35.000000000 -0800 @@ -0,0 +1,851 @@ +/* + * ixp4xx_crypto.c - interface to the HW crypto @@ -1345,9 +1444,10 @@ diff -Naur linux-2.6.19.orig/drivers/net/ixp4xx/ixp4xx_crypto.c linux-2.6.19/dri +module_init(init_crypto); +module_exit(finish_crypto); + -diff -Naur linux-2.6.19.orig/drivers/net/ixp4xx/ixp4xx_qmgr.c linux-2.6.19/drivers/net/ixp4xx/ixp4xx_qmgr.c ---- linux-2.6.19.orig/drivers/net/ixp4xx/ixp4xx_qmgr.c 1969-12-31 17:00:00.000000000 -0700 -+++ linux-2.6.19/drivers/net/ixp4xx/ixp4xx_qmgr.c 2007-01-12 21:54:40.000000000 -0700 +Index: linux-2.6.21-rc1-arm/drivers/net/ixp4xx/ixp4xx_qmgr.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.21-rc1-arm/drivers/net/ixp4xx/ixp4xx_qmgr.c 2007-02-21 02:24:35.000000000 -0800 @@ -0,0 +1,474 @@ +/* + * qmgr.c - reimplementation of the queue configuration interface. @@ -1823,62 +1923,291 @@ diff -Naur linux-2.6.19.orig/drivers/net/ixp4xx/ixp4xx_qmgr.c linux-2.6.19/drive +EXPORT_SYMBOL(queue_set_irq_src); +EXPORT_SYMBOL(queue_set_watermarks); +EXPORT_SYMBOL(queue_len); -diff -Naur linux-2.6.19.orig/drivers/net/ixp4xx/Kconfig linux-2.6.19/drivers/net/ixp4xx/Kconfig ---- linux-2.6.19.orig/drivers/net/ixp4xx/Kconfig 1969-12-31 17:00:00.000000000 -0700 -+++ linux-2.6.19/drivers/net/ixp4xx/Kconfig 2007-01-12 21:54:40.000000000 -0700 -@@ -0,0 +1,48 @@ -+config IXP4XX_QMGR -+ tristate "IXP4xx Queue Manager support" -+ depends on ARCH_IXP4XX -+ depends on NET_ETHERNET -+ help -+ The IXP4XX Queue manager is a configurable hardware ringbuffer. -+ It is used by the NPEs to exchange data from and to the CPU. -+ You can either use this OR the Intel Access Library (IAL) +Index: linux-2.6.21-rc1-arm/drivers/net/ixp4xx/mac.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.21-rc1-arm/drivers/net/ixp4xx/mac.h 2007-02-21 02:24:35.000000000 -0800 +@@ -0,0 +1,275 @@ ++/* ++ * Copyright (C) 2002-2006 Christian Hohnstaedt ++ * ++ * This file is released under the GPLv2 ++ */ + -+config IXP4XX_NPE -+ tristate "IXP4xx NPE support" -+ depends on ARCH_IXP4XX -+ depends on NET_ETHERNET -+ help -+ The IXP4XX NPE driver supports the 3 CPU co-processors called -+ "Network Processing Engines" (NPE). It adds support fo downloading -+ the Microcode (firmware) via Hotplug or character-special-device. -+ More about this at: Documentation/networking/ixp4xx/README. -+ You can either use this OR the Intel Access Library (IAL) ++#include ++#include ++#include ++#include ++#include ++#include ++#include + -+config IXP4XX_FW_LOAD -+ bool "Use Firmware hotplug for Microcode download" -+ depends on IXP4XX_NPE -+ select HOTPLUG -+ select FW_LOADER -+ help -+ The default hotplug script will load the Firmware from -+ /usr/lib/hotplug/firmware/NPE-[ABC] -+ see Documentation/firmware_class/hotplug-script ++/* 32 bit offsets to be added to u32 *pointers */ ++#define MAC_TX_CNTRL1 0x00 // 0x000 ++#define MAC_TX_CNTRL2 0x01 // 0x004 ++#define MAC_RX_CNTRL1 0x04 // 0x010 ++#define MAC_RX_CNTRL2 0x05 // 0x014 ++#define MAC_RANDOM_SEED 0x08 // 0x020 ++#define MAC_THRESH_P_EMPTY 0x0c // 0x030 ++#define MAC_THRESH_P_FULL 0x0e // 0x038 ++#define MAC_BUF_SIZE_TX 0x10 // 0x040 ++#define MAC_TX_DEFER 0x14 // 0x050 ++#define MAC_RX_DEFER 0x15 // 0x054 ++#define MAC_TX_TWO_DEFER_1 0x18 // 0x060 ++#define MAC_TX_TWO_DEFER_2 0x19 // 0x064 ++#define MAC_SLOT_TIME 0x1c // 0x070 ++#define MAC_MDIO_CMD 0x20 // 0x080 4 registers 0x20 - 0x23 ++#define MAC_MDIO_STS 0x24 // 0x090 4 registers 0x24 - 0x27 ++#define MAC_ADDR_MASK 0x28 // 0x0A0 6 registers 0x28 - 0x2d ++#define MAC_ADDR 0x30 // 0x0C0 6 registers 0x30 - 0x35 ++#define MAC_INT_CLK_THRESH 0x38 // 0x0E0 1 register ++#define MAC_UNI_ADDR 0x3c // 0x0F0 6 registers 0x3c - 0x41 ++#define MAC_CORE_CNTRL 0x7f // 0x1fC + -+config IXP4XX_MAC -+ tristate "IXP4xx MAC support" -+ depends on IXP4XX_NPE -+ depends on IXP4XX_QMGR -+ depends on NET_ETHERNET -+ select MII -+ help -+ The IXP4XX MAC driver supports the MACs on the IXP4XX CPUs. -+ There are 2 on ixp425 and up to 5 on ixdp465. -+ You can either use this OR the Intel Access Library (IAL) ++/* TX Control Register 1*/ ++ ++#define TX_CNTRL1_TX_EN BIT(0) ++#define TX_CNTRL1_DUPLEX BIT(1) ++#define TX_CNTRL1_RETRY BIT(2) ++#define TX_CNTRL1_PAD_EN BIT(3) ++#define TX_CNTRL1_FCS_EN BIT(4) ++#define TX_CNTRL1_2DEFER BIT(5) ++#define TX_CNTRL1_RMII BIT(6) ++ ++/* TX Control Register 2 */ ++#define TX_CNTRL2_RETRIES_MASK 0xf ++ ++/* RX Control Register 1 */ ++#define RX_CNTRL1_RX_EN BIT(0) ++#define RX_CNTRL1_PADSTRIP_EN BIT(1) ++#define RX_CNTRL1_CRC_EN BIT(2) ++#define RX_CNTRL1_PAUSE_EN BIT(3) ++#define RX_CNTRL1_LOOP_EN BIT(4) ++#define RX_CNTRL1_ADDR_FLTR_EN BIT(5) ++#define RX_CNTRL1_RX_RUNT_EN BIT(6) ++#define RX_CNTRL1_BCAST_DIS BIT(7) ++ ++/* RX Control Register 2 */ ++#define RX_CNTRL2_DEFER_EN BIT(0) ++ ++/* Core Control Register */ ++#define CORE_RESET BIT(0) ++#define CORE_RX_FIFO_FLUSH BIT(1) ++#define CORE_TX_FIFO_FLUSH BIT(2) ++#define CORE_SEND_JAM BIT(3) ++#define CORE_MDC_EN BIT(4) ++ ++/* Definitions for MII access routines*/ ++ ++#define MII_REG_SHL 16 ++#define MII_ADDR_SHL 21 ++ ++#define MII_GO BIT(31) ++#define MII_WRITE BIT(26) ++#define MII_READ_FAIL BIT(31) ++ ++#define MII_TIMEOUT_10TH_SECS 5 ++#define MII_10TH_SEC_IN_MILLIS 100 ++ ++/* ++ * ++ * Default values ++ * ++ */ ++ ++#define MAC_DEF_MSG_ENABLE (NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_LINK) ++ ++#define MAC_TX_CNTRL1_DEFAULT (\ ++ TX_CNTRL1_TX_EN | \ ++ TX_CNTRL1_RETRY | \ ++ TX_CNTRL1_FCS_EN | \ ++ TX_CNTRL1_2DEFER | \ ++ TX_CNTRL1_PAD_EN ) ++ ++#define MAC_TX_MAX_RETRIES_DEFAULT 0x0f ++ ++#define MAC_RX_CNTRL1_DEFAULT ( \ ++ RX_CNTRL1_PADSTRIP_EN | \ ++ RX_CNTRL1_CRC_EN | \ ++ RX_CNTRL1_RX_EN ) ++ ++#define MAC_RX_CNTRL2_DEFAULT 0x0 ++#define MAC_TX_CNTRL2_DEFAULT TX_CNTRL2_RETRIES_MASK ++ ++/* Thresholds determined by NPE firmware FS */ ++#define MAC_THRESH_P_EMPTY_DEFAULT 0x12 ++#define MAC_THRESH_P_FULL_DEFAULT 0x30 ++ ++/* Number of bytes that must be in the tx fifo before ++ * transmission commences */ ++#define MAC_BUF_SIZE_TX_DEFAULT 0x8 ++ ++/* One-part deferral values */ ++#define MAC_TX_DEFER_DEFAULT 0x15 ++#define MAC_RX_DEFER_DEFAULT 0x16 ++ ++/* Two-part deferral values... */ ++#define MAC_TX_TWO_DEFER_1_DEFAULT 0x08 ++#define MAC_TX_TWO_DEFER_2_DEFAULT 0x07 ++ ++/* This value applies to MII */ ++#define MAC_SLOT_TIME_DEFAULT 0x80 ++ ++/* This value applies to RMII */ ++#define MAC_SLOT_TIME_RMII_DEFAULT 0xFF ++ ++#define MAC_ADDR_MASK_DEFAULT 0xFF ++ ++#define MAC_INT_CLK_THRESH_DEFAULT 0x1 ++/* The following is a value chosen at random */ ++#define MAC_RANDOM_SEED_DEFAULT 0x8 ++ ++/* By default we must configure the MAC to generate the MDC clock*/ ++#define CORE_DEFAULT (CORE_MDC_EN) ++ ++/* End of Intel provided register information */ ++ ++extern int ++mdio_read_register(struct net_device *dev, int phy_addr, int phy_reg); ++extern void ++mdio_write_register(struct net_device *dev, int phy_addr, int phy_reg, int val); ++extern void init_mdio(struct net_device *dev, int phy_id); ++ ++struct mac_info { ++ u32 __iomem *addr; ++ struct resource *res; ++ struct device *npe_dev; ++ struct net_device *netdev; ++ struct qm_qmgr *qmgr; ++ struct qm_queue *rxq; ++ struct qm_queue *txq; ++ struct qm_queue *rxdoneq; ++ u32 irqflags; ++ struct net_device_stats stat; ++ struct mii_if_info mii; ++ struct delayed_work mdio_thread; ++ int rxq_pkt; ++ int txq_pkt; ++ int unloading; ++ struct mac_plat_info *plat; ++ int npe_stat_num; ++ spinlock_t rx_lock; ++ u32 msg_enable; ++}; ++ ++static inline void mac_write_reg(struct mac_info *mac, int offset, u32 val) ++{ ++ *(mac->addr + offset) = val; ++} ++static inline u32 mac_read_reg(struct mac_info *mac, int offset) ++{ ++ return *(mac->addr + offset); ++} ++static inline void mac_set_regbit(struct mac_info *mac, int offset, u32 bit) ++{ ++ mac_write_reg(mac, offset, mac_read_reg(mac, offset) | bit); ++} ++static inline void mac_reset_regbit(struct mac_info *mac, int offset, u32 bit) ++{ ++ mac_write_reg(mac, offset, mac_read_reg(mac, offset) & ~bit); ++} ++ ++static inline void mac_mdio_cmd_write(struct mac_info *mac, u32 cmd) ++{ ++ int i; ++ for(i=0; i<4; i++) { ++ mac_write_reg(mac, MAC_MDIO_CMD + i, cmd & 0xff); ++ cmd >>=8; ++ } ++} ++ ++#define mac_mdio_cmd_read(mac) mac_mdio_read((mac), MAC_MDIO_CMD) ++#define mac_mdio_status_read(mac) mac_mdio_read((mac), MAC_MDIO_STS) ++static inline u32 mac_mdio_read(struct mac_info *mac, int offset) ++{ ++ int i; ++ u32 data = 0; ++ for(i=0; i<4; i++) { ++ data |= (mac_read_reg(mac, offset + i) & 0xff) << (i*8); ++ } ++ return data; ++} ++ ++static inline u32 mdio_cmd(int phy_addr, int phy_reg) ++{ ++ return phy_addr << MII_ADDR_SHL | ++ phy_reg << MII_REG_SHL | ++ MII_GO; ++} ++ ++#define MAC_REG_LIST { \ ++ MAC_TX_CNTRL1, MAC_TX_CNTRL2, \ ++ MAC_RX_CNTRL1, MAC_RX_CNTRL2, \ ++ MAC_RANDOM_SEED, MAC_THRESH_P_EMPTY, MAC_THRESH_P_FULL, \ ++ MAC_BUF_SIZE_TX, MAC_TX_DEFER, MAC_RX_DEFER, \ ++ MAC_TX_TWO_DEFER_1, MAC_TX_TWO_DEFER_2, MAC_SLOT_TIME, \ ++ MAC_ADDR_MASK +0, MAC_ADDR_MASK +1, MAC_ADDR_MASK +2, \ ++ MAC_ADDR_MASK +3, MAC_ADDR_MASK +4, MAC_ADDR_MASK +5, \ ++ MAC_ADDR +0, MAC_ADDR +1, MAC_ADDR +2, \ ++ MAC_ADDR +3, MAC_ADDR +4, MAC_ADDR +5, \ ++ MAC_INT_CLK_THRESH, \ ++ MAC_UNI_ADDR +0, MAC_UNI_ADDR +1, MAC_UNI_ADDR +2, \ ++ MAC_UNI_ADDR +3, MAC_UNI_ADDR +4, MAC_UNI_ADDR +5, \ ++ MAC_CORE_CNTRL \ ++} ++ ++#define NPE_STAT_NUM 34 ++#define NPE_STAT_NUM_BASE 22 ++#define NPE_Q_STAT_NUM 4 ++ ++#define NPE_Q_STAT_STRINGS \ ++ {"RX ready to use queue len "}, \ ++ {"RX received queue len "}, \ ++ {"TX to be send queue len "}, \ ++ {"TX done queue len "}, + -+config IXP4XX_CRYPTO -+ tristate "IXP4xx crypto support" -+ depends on IXP4XX_NPE -+ depends on IXP4XX_QMGR -+ help -+ This driver is a generic NPE-crypto access layer. -+ You need additional code in OCF for example. -diff -Naur linux-2.6.19.orig/drivers/net/ixp4xx/mac_driver.c linux-2.6.19/drivers/net/ixp4xx/mac_driver.c ---- linux-2.6.19.orig/drivers/net/ixp4xx/mac_driver.c 1969-12-31 17:00:00.000000000 -0700 -+++ linux-2.6.19/drivers/net/ixp4xx/mac_driver.c 2007-01-12 21:54:40.000000000 -0700 -@@ -0,0 +1,849 @@ ++#define NPE_STAT_STRINGS \ ++ {"StatsAlignmentErrors "}, \ ++ {"StatsFCSErrors "}, \ ++ {"StatsInternalMacReceiveErrors "}, \ ++ {"RxOverrunDiscards "}, \ ++ {"RxLearnedEntryDiscards "}, \ ++ {"RxLargeFramesDiscards "}, \ ++ {"RxSTPBlockedDiscards "}, \ ++ {"RxVLANTypeFilterDiscards "}, \ ++ {"RxVLANIdFilterDiscards "}, \ ++ {"RxInvalidSourceDiscards "}, \ ++ {"RxBlackListDiscards "}, \ ++ {"RxWhiteListDiscards "}, \ ++ {"RxUnderflowEntryDiscards "}, \ ++ {"StatsSingleCollisionFrames "}, \ ++ {"StatsMultipleCollisionFrames "}, \ ++ {"StatsDeferredTransmissions "}, \ ++ {"StatsLateCollisions "}, \ ++ {"StatsExcessiveCollsions "}, \ ++ {"StatsInternalMacTransmitErrors"}, \ ++ {"StatsCarrierSenseErrors "}, \ ++ {"TxLargeFrameDiscards "}, \ ++ {"TxVLANIdFilterDiscards "}, \ ++\ ++ {"RxValidFramesTotalOctets "}, \ ++ {"RxUcastPkts "}, \ ++ {"RxBcastPkts "}, \ ++ {"RxMcastPkts "}, \ ++ {"RxPkts64Octets "}, \ ++ {"RxPkts65to127Octets "}, \ ++ {"RxPkts128to255Octets "}, \ ++ {"RxPkts256to511Octets "}, \ ++ {"RxPkts512to1023Octets "}, \ ++ {"RxPkts1024to1518Octets "}, \ ++ {"RxInternalNPEReceiveErrors "}, \ ++ {"TxInternalNPETransmitErrors "} ++ +Index: linux-2.6.21-rc1-arm/drivers/net/ixp4xx/mac_driver.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.21-rc1-arm/drivers/net/ixp4xx/mac_driver.c 2007-02-21 02:24:46.000000000 -0800 +@@ -0,0 +1,850 @@ +/* + * mac_driver.c - provide a network interface for each MAC + * @@ -2468,10 +2797,11 @@ diff -Naur linux-2.6.19.orig/drivers/net/ixp4xx/mac_driver.c linux-2.6.19/driver + .get_ethtool_stats = ixmac_get_ethtool_stats, +}; + -+static void mac_mdio_thread(void *_data) ++static void mac_mdio_thread(struct work_struct *work) +{ -+ struct net_device *dev = _data; -+ struct mac_info *mac = netdev_priv(dev); ++ struct mac_info *mac = container_of(work, struct mac_info, ++ mdio_thread.work); ++ struct net_device *dev = mac->netdev; + + media_check(dev, 0); + schedule_delayed_work(&mac->mdio_thread, MDIO_INTERVAL); @@ -2570,7 +2900,7 @@ diff -Naur linux-2.6.19.orig/drivers/net/ixp4xx/mac_driver.c linux-2.6.19/driver + + init_mdio(dev, plat->phy_id); + -+ INIT_WORK(&mac->mdio_thread, mac_mdio_thread, dev); ++ INIT_DELAYED_WORK(&mac->mdio_thread, mac_mdio_thread); + + /* The place of the MAC address is very system dependent. + * Here we use a random one to be replaced by one of the @@ -2620,407 +2950,118 @@ diff -Naur linux-2.6.19.orig/drivers/net/ixp4xx/mac_driver.c linux-2.6.19/driver + * We switch the MAC in loopback mode and send a pseudo packet + * that will be returned by the NPE in its last SKB. + * We will also try to isolate the PHY to keep the packets internal. -+ */ -+ -+ if (mac->txq_pkt <2) -+ mac->txq_pkt += init_buffer(tx_doneq, 5); -+ -+ if (npe_status(npe) & IX_NPEDL_EXCTL_STATUS_RUN) { -+ mac_reset_regbit(mac, MAC_CORE_CNTRL, CORE_MDC_EN); -+ mac_set_regbit(mac, MAC_RX_CNTRL1, RX_CNTRL1_LOOP_EN); -+ -+ npe_mh_npe_loopback_mode(npe, mac->plat, 1); -+ mdelay(200); -+ -+ while (mac->rxq_pkt && loop++ < 2000 ) { -+ phys = queue_get_entry(tx_doneq) & ~0xf; -+ if (!phys) -+ break; -+ cont = dma_to_virt(queue->dev, phys); -+ /* actually the packets should never leave the system, -+ * but if they do, they shall contain 0s instead of -+ * intresting random data.... -+ */ -+ memset(cont->data, 0, 64); -+ cont->eth.pkt_len = 64; -+ dma_sync_single(mac->txq->dev, phys, 64 + DMA_HDR_SIZE, -+ DMA_TO_DEVICE); -+ queue_put_entry(mac->txq, phys); -+ if (queue_stat(mac->txq) == 2) { /* overflow */ -+ queue_put_entry(tx_doneq, phys); -+ break; -+ } -+ mdelay(1); -+ mac->rxq_pkt -= destroy_buffer(mac->rxdoneq, -+ mac->rxq_pkt); -+ } -+ npe_mh_npe_loopback_mode(npe, mac->plat, 0); -+ } -+ /* Flush MAC TX fifo to drain the bogus packages */ -+ mac_set_regbit(mac, MAC_CORE_CNTRL, CORE_TX_FIFO_FLUSH); -+ mac_reset_regbit(mac, MAC_RX_CNTRL1, RX_CNTRL1_RX_EN); -+ mac_reset_regbit(mac, MAC_TX_CNTRL1, TX_CNTRL1_TX_EN); -+ mac_reset_regbit(mac, MAC_RX_CNTRL1, RX_CNTRL1_LOOP_EN); -+ mac_reset_regbit(mac, MAC_CORE_CNTRL, CORE_TX_FIFO_FLUSH); -+ mac_reset_regbit(mac, MAC_CORE_CNTRL, CORE_TX_FIFO_FLUSH); -+} -+ -+static int mac_remove(struct platform_device *pdev) -+{ -+ struct net_device* dev = platform_get_drvdata(pdev); -+ struct mac_info *mac = netdev_priv(dev); -+ -+ unregister_netdev(dev); -+ -+ mac->rxq_pkt -= destroy_buffer(mac->rxq, mac->rxq_pkt); -+ if (mac->rxq_pkt) -+ drain_npe(mac); -+ -+ mac->txq_pkt -= destroy_buffer(mac->txq, mac->txq_pkt); -+ mac->txq_pkt -= destroy_buffer(tx_doneq, mac->txq_pkt); -+ -+ if (mac->rxq_pkt || mac->txq_pkt) -+ printk("Buffers lost in NPE: RX:%d, TX:%d\n", -+ mac->rxq_pkt, mac->txq_pkt); -+ -+ release_queue(mac->txq); -+ release_queue(mac->rxq); -+ release_queue(mac->rxdoneq); -+ -+ flush_scheduled_work(); -+ return_npe_dev(mac->npe_dev); -+ -+ iounmap(mac->addr); -+ release_resource(mac->res); -+ platform_set_drvdata(pdev, NULL); -+ free_netdev(dev); -+ return 0; -+} -+ -+static struct platform_driver ixp4xx_mac = { -+ .driver.name = IXMAC_NAME, -+ .probe = mac_probe, -+ .remove = mac_remove, -+}; -+ -+static int __init init_mac(void) -+{ -+ /* The TX done Queue handles skbs sent out by the NPE */ -+ tx_doneq = request_queue(TX_DONE_QID, 128); -+ if (IS_ERR(tx_doneq)) { -+ printk(KERN_ERR "Error requesting Q: %d\n", TX_DONE_QID); -+ return -EBUSY; -+ } -+ return platform_driver_register(&ixp4xx_mac); -+} -+ -+static void __exit finish_mac(void) -+{ -+ platform_driver_unregister(&ixp4xx_mac); -+ if (tx_doneq) { -+ release_queue(tx_doneq); -+ } -+} -+ -+module_init(init_mac); -+module_exit(finish_mac); -+ -+MODULE_LICENSE("GPL"); -+MODULE_AUTHOR("Christian Hohnstaedt "); -+ -diff -Naur linux-2.6.19.orig/drivers/net/ixp4xx/mac.h linux-2.6.19/drivers/net/ixp4xx/mac.h ---- linux-2.6.19.orig/drivers/net/ixp4xx/mac.h 1969-12-31 17:00:00.000000000 -0700 -+++ linux-2.6.19/drivers/net/ixp4xx/mac.h 2007-01-12 21:54:40.000000000 -0700 -@@ -0,0 +1,275 @@ -+/* -+ * Copyright (C) 2002-2006 Christian Hohnstaedt -+ * -+ * This file is released under the GPLv2 -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+/* 32 bit offsets to be added to u32 *pointers */ -+#define MAC_TX_CNTRL1 0x00 // 0x000 -+#define MAC_TX_CNTRL2 0x01 // 0x004 -+#define MAC_RX_CNTRL1 0x04 // 0x010 -+#define MAC_RX_CNTRL2 0x05 // 0x014 -+#define MAC_RANDOM_SEED 0x08 // 0x020 -+#define MAC_THRESH_P_EMPTY 0x0c // 0x030 -+#define MAC_THRESH_P_FULL 0x0e // 0x038 -+#define MAC_BUF_SIZE_TX 0x10 // 0x040 -+#define MAC_TX_DEFER 0x14 // 0x050 -+#define MAC_RX_DEFER 0x15 // 0x054 -+#define MAC_TX_TWO_DEFER_1 0x18 // 0x060 -+#define MAC_TX_TWO_DEFER_2 0x19 // 0x064 -+#define MAC_SLOT_TIME 0x1c // 0x070 -+#define MAC_MDIO_CMD 0x20 // 0x080 4 registers 0x20 - 0x23 -+#define MAC_MDIO_STS 0x24 // 0x090 4 registers 0x24 - 0x27 -+#define MAC_ADDR_MASK 0x28 // 0x0A0 6 registers 0x28 - 0x2d -+#define MAC_ADDR 0x30 // 0x0C0 6 registers 0x30 - 0x35 -+#define MAC_INT_CLK_THRESH 0x38 // 0x0E0 1 register -+#define MAC_UNI_ADDR 0x3c // 0x0F0 6 registers 0x3c - 0x41 -+#define MAC_CORE_CNTRL 0x7f // 0x1fC -+ -+/* TX Control Register 1*/ -+ -+#define TX_CNTRL1_TX_EN BIT(0) -+#define TX_CNTRL1_DUPLEX BIT(1) -+#define TX_CNTRL1_RETRY BIT(2) -+#define TX_CNTRL1_PAD_EN BIT(3) -+#define TX_CNTRL1_FCS_EN BIT(4) -+#define TX_CNTRL1_2DEFER BIT(5) -+#define TX_CNTRL1_RMII BIT(6) -+ -+/* TX Control Register 2 */ -+#define TX_CNTRL2_RETRIES_MASK 0xf -+ -+/* RX Control Register 1 */ -+#define RX_CNTRL1_RX_EN BIT(0) -+#define RX_CNTRL1_PADSTRIP_EN BIT(1) -+#define RX_CNTRL1_CRC_EN BIT(2) -+#define RX_CNTRL1_PAUSE_EN BIT(3) -+#define RX_CNTRL1_LOOP_EN BIT(4) -+#define RX_CNTRL1_ADDR_FLTR_EN BIT(5) -+#define RX_CNTRL1_RX_RUNT_EN BIT(6) -+#define RX_CNTRL1_BCAST_DIS BIT(7) -+ -+/* RX Control Register 2 */ -+#define RX_CNTRL2_DEFER_EN BIT(0) -+ -+/* Core Control Register */ -+#define CORE_RESET BIT(0) -+#define CORE_RX_FIFO_FLUSH BIT(1) -+#define CORE_TX_FIFO_FLUSH BIT(2) -+#define CORE_SEND_JAM BIT(3) -+#define CORE_MDC_EN BIT(4) -+ -+/* Definitions for MII access routines*/ -+ -+#define MII_REG_SHL 16 -+#define MII_ADDR_SHL 21 -+ -+#define MII_GO BIT(31) -+#define MII_WRITE BIT(26) -+#define MII_READ_FAIL BIT(31) -+ -+#define MII_TIMEOUT_10TH_SECS 5 -+#define MII_10TH_SEC_IN_MILLIS 100 -+ -+/* -+ * -+ * Default values -+ * -+ */ -+ -+#define MAC_DEF_MSG_ENABLE (NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_LINK) -+ -+#define MAC_TX_CNTRL1_DEFAULT (\ -+ TX_CNTRL1_TX_EN | \ -+ TX_CNTRL1_RETRY | \ -+ TX_CNTRL1_FCS_EN | \ -+ TX_CNTRL1_2DEFER | \ -+ TX_CNTRL1_PAD_EN ) -+ -+#define MAC_TX_MAX_RETRIES_DEFAULT 0x0f -+ -+#define MAC_RX_CNTRL1_DEFAULT ( \ -+ RX_CNTRL1_PADSTRIP_EN | \ -+ RX_CNTRL1_CRC_EN | \ -+ RX_CNTRL1_RX_EN ) ++ */ + -+#define MAC_RX_CNTRL2_DEFAULT 0x0 -+#define MAC_TX_CNTRL2_DEFAULT TX_CNTRL2_RETRIES_MASK ++ if (mac->txq_pkt <2) ++ mac->txq_pkt += init_buffer(tx_doneq, 5); + -+/* Thresholds determined by NPE firmware FS */ -+#define MAC_THRESH_P_EMPTY_DEFAULT 0x12 -+#define MAC_THRESH_P_FULL_DEFAULT 0x30 ++ if (npe_status(npe) & IX_NPEDL_EXCTL_STATUS_RUN) { ++ mac_reset_regbit(mac, MAC_CORE_CNTRL, CORE_MDC_EN); ++ mac_set_regbit(mac, MAC_RX_CNTRL1, RX_CNTRL1_LOOP_EN); + -+/* Number of bytes that must be in the tx fifo before -+ * transmission commences */ -+#define MAC_BUF_SIZE_TX_DEFAULT 0x8 ++ npe_mh_npe_loopback_mode(npe, mac->plat, 1); ++ mdelay(200); + -+/* One-part deferral values */ -+#define MAC_TX_DEFER_DEFAULT 0x15 -+#define MAC_RX_DEFER_DEFAULT 0x16 ++ while (mac->rxq_pkt && loop++ < 2000 ) { ++ phys = queue_get_entry(tx_doneq) & ~0xf; ++ if (!phys) ++ break; ++ cont = dma_to_virt(queue->dev, phys); ++ /* actually the packets should never leave the system, ++ * but if they do, they shall contain 0s instead of ++ * intresting random data.... ++ */ ++ memset(cont->data, 0, 64); ++ cont->eth.pkt_len = 64; ++ dma_sync_single(mac->txq->dev, phys, 64 + DMA_HDR_SIZE, ++ DMA_TO_DEVICE); ++ queue_put_entry(mac->txq, phys); ++ if (queue_stat(mac->txq) == 2) { /* overflow */ ++ queue_put_entry(tx_doneq, phys); ++ break; ++ } ++ mdelay(1); ++ mac->rxq_pkt -= destroy_buffer(mac->rxdoneq, ++ mac->rxq_pkt); ++ } ++ npe_mh_npe_loopback_mode(npe, mac->plat, 0); ++ } ++ /* Flush MAC TX fifo to drain the bogus packages */ ++ mac_set_regbit(mac, MAC_CORE_CNTRL, CORE_TX_FIFO_FLUSH); ++ mac_reset_regbit(mac, MAC_RX_CNTRL1, RX_CNTRL1_RX_EN); ++ mac_reset_regbit(mac, MAC_TX_CNTRL1, TX_CNTRL1_TX_EN); ++ mac_reset_regbit(mac, MAC_RX_CNTRL1, RX_CNTRL1_LOOP_EN); ++ mac_reset_regbit(mac, MAC_CORE_CNTRL, CORE_TX_FIFO_FLUSH); ++ mac_reset_regbit(mac, MAC_CORE_CNTRL, CORE_TX_FIFO_FLUSH); ++} + -+/* Two-part deferral values... */ -+#define MAC_TX_TWO_DEFER_1_DEFAULT 0x08 -+#define MAC_TX_TWO_DEFER_2_DEFAULT 0x07 ++static int mac_remove(struct platform_device *pdev) ++{ ++ struct net_device* dev = platform_get_drvdata(pdev); ++ struct mac_info *mac = netdev_priv(dev); + -+/* This value applies to MII */ -+#define MAC_SLOT_TIME_DEFAULT 0x80 ++ unregister_netdev(dev); + -+/* This value applies to RMII */ -+#define MAC_SLOT_TIME_RMII_DEFAULT 0xFF ++ mac->rxq_pkt -= destroy_buffer(mac->rxq, mac->rxq_pkt); ++ if (mac->rxq_pkt) ++ drain_npe(mac); + -+#define MAC_ADDR_MASK_DEFAULT 0xFF ++ mac->txq_pkt -= destroy_buffer(mac->txq, mac->txq_pkt); ++ mac->txq_pkt -= destroy_buffer(tx_doneq, mac->txq_pkt); + -+#define MAC_INT_CLK_THRESH_DEFAULT 0x1 -+/* The following is a value chosen at random */ -+#define MAC_RANDOM_SEED_DEFAULT 0x8 ++ if (mac->rxq_pkt || mac->txq_pkt) ++ printk("Buffers lost in NPE: RX:%d, TX:%d\n", ++ mac->rxq_pkt, mac->txq_pkt); + -+/* By default we must configure the MAC to generate the MDC clock*/ -+#define CORE_DEFAULT (CORE_MDC_EN) ++ release_queue(mac->txq); ++ release_queue(mac->rxq); ++ release_queue(mac->rxdoneq); + -+/* End of Intel provided register information */ ++ flush_scheduled_work(); ++ return_npe_dev(mac->npe_dev); + -+extern int -+mdio_read_register(struct net_device *dev, int phy_addr, int phy_reg); -+extern void -+mdio_write_register(struct net_device *dev, int phy_addr, int phy_reg, int val); -+extern void init_mdio(struct net_device *dev, int phy_id); ++ iounmap(mac->addr); ++ release_resource(mac->res); ++ platform_set_drvdata(pdev, NULL); ++ free_netdev(dev); ++ return 0; ++} + -+struct mac_info { -+ u32 __iomem *addr; -+ struct resource *res; -+ struct device *npe_dev; -+ struct net_device *netdev; -+ struct qm_qmgr *qmgr; -+ struct qm_queue *rxq; -+ struct qm_queue *txq; -+ struct qm_queue *rxdoneq; -+ u32 irqflags; -+ struct net_device_stats stat; -+ struct mii_if_info mii; -+ struct work_struct mdio_thread; -+ int rxq_pkt; -+ int txq_pkt; -+ int unloading; -+ struct mac_plat_info *plat; -+ int npe_stat_num; -+ spinlock_t rx_lock; -+ u32 msg_enable; ++static struct platform_driver ixp4xx_mac = { ++ .driver.name = IXMAC_NAME, ++ .probe = mac_probe, ++ .remove = mac_remove, +}; + -+static inline void mac_write_reg(struct mac_info *mac, int offset, u32 val) -+{ -+ *(mac->addr + offset) = val; -+} -+static inline u32 mac_read_reg(struct mac_info *mac, int offset) -+{ -+ return *(mac->addr + offset); -+} -+static inline void mac_set_regbit(struct mac_info *mac, int offset, u32 bit) -+{ -+ mac_write_reg(mac, offset, mac_read_reg(mac, offset) | bit); -+} -+static inline void mac_reset_regbit(struct mac_info *mac, int offset, u32 bit) -+{ -+ mac_write_reg(mac, offset, mac_read_reg(mac, offset) & ~bit); -+} -+ -+static inline void mac_mdio_cmd_write(struct mac_info *mac, u32 cmd) ++static int __init init_mac(void) +{ -+ int i; -+ for(i=0; i<4; i++) { -+ mac_write_reg(mac, MAC_MDIO_CMD + i, cmd & 0xff); -+ cmd >>=8; ++ /* The TX done Queue handles skbs sent out by the NPE */ ++ tx_doneq = request_queue(TX_DONE_QID, 128); ++ if (IS_ERR(tx_doneq)) { ++ printk(KERN_ERR "Error requesting Q: %d\n", TX_DONE_QID); ++ return -EBUSY; + } ++ return platform_driver_register(&ixp4xx_mac); +} + -+#define mac_mdio_cmd_read(mac) mac_mdio_read((mac), MAC_MDIO_CMD) -+#define mac_mdio_status_read(mac) mac_mdio_read((mac), MAC_MDIO_STS) -+static inline u32 mac_mdio_read(struct mac_info *mac, int offset) ++static void __exit finish_mac(void) +{ -+ int i; -+ u32 data = 0; -+ for(i=0; i<4; i++) { -+ data |= (mac_read_reg(mac, offset + i) & 0xff) << (i*8); ++ platform_driver_unregister(&ixp4xx_mac); ++ if (tx_doneq) { ++ release_queue(tx_doneq); + } -+ return data; -+} -+ -+static inline u32 mdio_cmd(int phy_addr, int phy_reg) -+{ -+ return phy_addr << MII_ADDR_SHL | -+ phy_reg << MII_REG_SHL | -+ MII_GO; -+} -+ -+#define MAC_REG_LIST { \ -+ MAC_TX_CNTRL1, MAC_TX_CNTRL2, \ -+ MAC_RX_CNTRL1, MAC_RX_CNTRL2, \ -+ MAC_RANDOM_SEED, MAC_THRESH_P_EMPTY, MAC_THRESH_P_FULL, \ -+ MAC_BUF_SIZE_TX, MAC_TX_DEFER, MAC_RX_DEFER, \ -+ MAC_TX_TWO_DEFER_1, MAC_TX_TWO_DEFER_2, MAC_SLOT_TIME, \ -+ MAC_ADDR_MASK +0, MAC_ADDR_MASK +1, MAC_ADDR_MASK +2, \ -+ MAC_ADDR_MASK +3, MAC_ADDR_MASK +4, MAC_ADDR_MASK +5, \ -+ MAC_ADDR +0, MAC_ADDR +1, MAC_ADDR +2, \ -+ MAC_ADDR +3, MAC_ADDR +4, MAC_ADDR +5, \ -+ MAC_INT_CLK_THRESH, \ -+ MAC_UNI_ADDR +0, MAC_UNI_ADDR +1, MAC_UNI_ADDR +2, \ -+ MAC_UNI_ADDR +3, MAC_UNI_ADDR +4, MAC_UNI_ADDR +5, \ -+ MAC_CORE_CNTRL \ +} + -+#define NPE_STAT_NUM 34 -+#define NPE_STAT_NUM_BASE 22 -+#define NPE_Q_STAT_NUM 4 -+ -+#define NPE_Q_STAT_STRINGS \ -+ {"RX ready to use queue len "}, \ -+ {"RX received queue len "}, \ -+ {"TX to be send queue len "}, \ -+ {"TX done queue len "}, -+ -+#define NPE_STAT_STRINGS \ -+ {"StatsAlignmentErrors "}, \ -+ {"StatsFCSErrors "}, \ -+ {"StatsInternalMacReceiveErrors "}, \ -+ {"RxOverrunDiscards "}, \ -+ {"RxLearnedEntryDiscards "}, \ -+ {"RxLargeFramesDiscards "}, \ -+ {"RxSTPBlockedDiscards "}, \ -+ {"RxVLANTypeFilterDiscards "}, \ -+ {"RxVLANIdFilterDiscards "}, \ -+ {"RxInvalidSourceDiscards "}, \ -+ {"RxBlackListDiscards "}, \ -+ {"RxWhiteListDiscards "}, \ -+ {"RxUnderflowEntryDiscards "}, \ -+ {"StatsSingleCollisionFrames "}, \ -+ {"StatsMultipleCollisionFrames "}, \ -+ {"StatsDeferredTransmissions "}, \ -+ {"StatsLateCollisions "}, \ -+ {"StatsExcessiveCollsions "}, \ -+ {"StatsInternalMacTransmitErrors"}, \ -+ {"StatsCarrierSenseErrors "}, \ -+ {"TxLargeFrameDiscards "}, \ -+ {"TxVLANIdFilterDiscards "}, \ -+\ -+ {"RxValidFramesTotalOctets "}, \ -+ {"RxUcastPkts "}, \ -+ {"RxBcastPkts "}, \ -+ {"RxMcastPkts "}, \ -+ {"RxPkts64Octets "}, \ -+ {"RxPkts65to127Octets "}, \ -+ {"RxPkts128to255Octets "}, \ -+ {"RxPkts256to511Octets "}, \ -+ {"RxPkts512to1023Octets "}, \ -+ {"RxPkts1024to1518Octets "}, \ -+ {"RxInternalNPEReceiveErrors "}, \ -+ {"TxInternalNPETransmitErrors "} ++module_init(init_mac); ++module_exit(finish_mac); + -diff -Naur linux-2.6.19.orig/drivers/net/ixp4xx/Makefile linux-2.6.19/drivers/net/ixp4xx/Makefile ---- linux-2.6.19.orig/drivers/net/ixp4xx/Makefile 1969-12-31 17:00:00.000000000 -0700 -+++ linux-2.6.19/drivers/net/ixp4xx/Makefile 2007-01-12 21:54:40.000000000 -0700 -@@ -0,0 +1,7 @@ -+obj-$(CONFIG_IXP4XX_QMGR) += ixp4xx_qmgr.o -+obj-$(CONFIG_IXP4XX_NPE) += ixp4xx_npe.o -+obj-$(CONFIG_IXP4XX_MAC) += ixp4xx_mac.o -+obj-$(CONFIG_IXP4XX_CRYPTO) += ixp4xx_crypto.o ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Christian Hohnstaedt "); + -+ixp4xx_npe-objs := ucode_dl.o npe_mh.o npe.o -+ixp4xx_mac-objs := mac_driver.o phy.o -diff -Naur linux-2.6.19.orig/drivers/net/ixp4xx/npe.c linux-2.6.19/drivers/net/ixp4xx/npe.c ---- linux-2.6.19.orig/drivers/net/ixp4xx/npe.c 1969-12-31 17:00:00.000000000 -0700 -+++ linux-2.6.19/drivers/net/ixp4xx/npe.c 2007-01-12 21:54:40.000000000 -0700 +Index: linux-2.6.21-rc1-arm/drivers/net/ixp4xx/npe.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.21-rc1-arm/drivers/net/ixp4xx/npe.c 2007-02-21 02:24:35.000000000 -0800 @@ -0,0 +1,291 @@ + +#include @@ -3313,9 +3354,10 @@ diff -Naur linux-2.6.19.orig/drivers/net/ixp4xx/npe.c linux-2.6.19/drivers/net/i +EXPORT_SYMBOL(npe_stop); +EXPORT_SYMBOL(npe_start); +EXPORT_SYMBOL(npe_reset); -diff -Naur linux-2.6.19.orig/drivers/net/ixp4xx/npe_mh.c linux-2.6.19/drivers/net/ixp4xx/npe_mh.c ---- linux-2.6.19.orig/drivers/net/ixp4xx/npe_mh.c 1969-12-31 17:00:00.000000000 -0700 -+++ linux-2.6.19/drivers/net/ixp4xx/npe_mh.c 2007-01-12 21:54:40.000000000 -0700 +Index: linux-2.6.21-rc1-arm/drivers/net/ixp4xx/npe_mh.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.21-rc1-arm/drivers/net/ixp4xx/npe_mh.c 2007-02-21 02:24:35.000000000 -0800 @@ -0,0 +1,170 @@ +/* + * npe_mh.c - NPE message handler. @@ -3487,9 +3529,10 @@ diff -Naur linux-2.6.19.orig/drivers/net/ixp4xx/npe_mh.c linux-2.6.19/drivers/ne +EXPORT_SYMBOL(npe_mh_set_rxqid); +EXPORT_SYMBOL(npe_mh_npe_loopback_mode); +EXPORT_SYMBOL(npe_mh_get_stats); -diff -Naur linux-2.6.19.orig/drivers/net/ixp4xx/phy.c linux-2.6.19/drivers/net/ixp4xx/phy.c ---- linux-2.6.19.orig/drivers/net/ixp4xx/phy.c 1969-12-31 17:00:00.000000000 -0700 -+++ linux-2.6.19/drivers/net/ixp4xx/phy.c 2007-01-12 21:54:40.000000000 -0700 +Index: linux-2.6.21-rc1-arm/drivers/net/ixp4xx/phy.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.21-rc1-arm/drivers/net/ixp4xx/phy.c 2007-02-21 02:24:35.000000000 -0800 @@ -0,0 +1,113 @@ +/* + * phy.c - MDIO functions and mii initialisation @@ -3604,9 +3647,10 @@ diff -Naur linux-2.6.19.orig/drivers/net/ixp4xx/phy.c linux-2.6.19/drivers/net/i + mac->mii.mdio_write = mdio_write_register; +} + -diff -Naur linux-2.6.19.orig/drivers/net/ixp4xx/ucode_dl.c linux-2.6.19/drivers/net/ixp4xx/ucode_dl.c ---- linux-2.6.19.orig/drivers/net/ixp4xx/ucode_dl.c 1969-12-31 17:00:00.000000000 -0700 -+++ linux-2.6.19/drivers/net/ixp4xx/ucode_dl.c 2007-01-12 21:54:40.000000000 -0700 +Index: linux-2.6.21-rc1-arm/drivers/net/ixp4xx/ucode_dl.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.21-rc1-arm/drivers/net/ixp4xx/ucode_dl.c 2007-02-21 02:24:35.000000000 -0800 @@ -0,0 +1,479 @@ +/* + * ucode_dl.c - provide an NPE device and a char-dev for microcode download @@ -4087,32 +4131,10 @@ diff -Naur linux-2.6.19.orig/drivers/net/ixp4xx/ucode_dl.c linux-2.6.19/drivers/ + +EXPORT_SYMBOL(get_npe_by_id); +EXPORT_SYMBOL(return_npe_dev); -diff -Naur linux-2.6.19.orig/drivers/net/Kconfig linux-2.6.19/drivers/net/Kconfig ---- linux-2.6.19.orig/drivers/net/Kconfig 2006-11-29 14:57:37.000000000 -0700 -+++ linux-2.6.19/drivers/net/Kconfig 2007-01-12 21:54:40.000000000 -0700 -@@ -190,6 +190,8 @@ - - source "drivers/net/arm/Kconfig" - -+source "drivers/net/ixp4xx/Kconfig" -+ - config MACE - tristate "MACE (Power Mac ethernet) support" - depends on NET_ETHERNET && PPC_PMAC && PPC32 -diff -Naur linux-2.6.19.orig/drivers/net/Makefile linux-2.6.19/drivers/net/Makefile ---- linux-2.6.19.orig/drivers/net/Makefile 2006-11-29 14:57:37.000000000 -0700 -+++ linux-2.6.19/drivers/net/Makefile 2007-01-12 21:54:40.000000000 -0700 -@@ -209,6 +209,7 @@ - obj-$(CONFIG_IRDA) += irda/ - obj-$(CONFIG_ETRAX_ETHERNET) += cris/ - obj-$(CONFIG_ENP2611_MSF_NET) += ixp2000/ -+obj-$(CONFIG_IXP4XX_NPE) += ixp4xx/ - - obj-$(CONFIG_NETCONSOLE) += netconsole.o - -diff -Naur linux-2.6.19.orig/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h linux-2.6.19/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h ---- linux-2.6.19.orig/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h 2006-11-29 14:57:37.000000000 -0700 -+++ linux-2.6.19/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h 2007-01-12 21:54:40.000000000 -0700 +Index: linux-2.6.21-rc1-arm/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h +=================================================================== +--- linux-2.6.21-rc1-arm.orig/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h 2007-02-21 02:24:18.000000000 -0800 ++++ linux-2.6.21-rc1-arm/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h 2007-02-21 02:24:35.000000000 -0800 @@ -22,6 +22,8 @@ #ifndef _ASM_ARM_IXP4XX_H_ #define _ASM_ARM_IXP4XX_H_ @@ -4214,9 +4236,10 @@ diff -Naur linux-2.6.19.orig/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h linux-2.6 #endif #endif -diff -Naur linux-2.6.19.orig/include/asm-arm/arch-ixp4xx/npe_regs.h linux-2.6.19/include/asm-arm/arch-ixp4xx/npe_regs.h ---- linux-2.6.19.orig/include/asm-arm/arch-ixp4xx/npe_regs.h 1969-12-31 17:00:00.000000000 -0700 -+++ linux-2.6.19/include/asm-arm/arch-ixp4xx/npe_regs.h 2007-01-12 21:54:40.000000000 -0700 +Index: linux-2.6.21-rc1-arm/include/asm-arm/arch-ixp4xx/npe_regs.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.21-rc1-arm/include/asm-arm/arch-ixp4xx/npe_regs.h 2007-02-21 02:24:35.000000000 -0800 @@ -0,0 +1,82 @@ +#ifndef NPE_REGS_H +#define NPE_REGS_H @@ -4300,12 +4323,13 @@ diff -Naur linux-2.6.19.orig/include/asm-arm/arch-ixp4xx/npe_regs.h linux-2.6.19 + +#endif + -diff -Naur linux-2.6.19.orig/include/asm-arm/arch-ixp4xx/platform.h linux-2.6.19/include/asm-arm/arch-ixp4xx/platform.h ---- linux-2.6.19.orig/include/asm-arm/arch-ixp4xx/platform.h 2006-11-29 14:57:37.000000000 -0700 -+++ linux-2.6.19/include/asm-arm/arch-ixp4xx/platform.h 2007-01-12 21:54:40.000000000 -0700 -@@ -89,6 +89,25 @@ - - struct sys_timer; +Index: linux-2.6.21-rc1-arm/include/asm-arm/arch-ixp4xx/platform.h +=================================================================== +--- linux-2.6.21-rc1-arm.orig/include/asm-arm/arch-ixp4xx/platform.h 2007-02-21 02:24:18.000000000 -0800 ++++ linux-2.6.21-rc1-arm/include/asm-arm/arch-ixp4xx/platform.h 2007-02-21 02:24:35.000000000 -0800 +@@ -86,6 +86,25 @@ + unsigned long scl_pin; + }; +struct npe_plat_data { + const char *name; @@ -4327,11 +4351,12 @@ diff -Naur linux-2.6.19.orig/include/asm-arm/arch-ixp4xx/platform.h linux-2.6.19 +}; + /* - * Frequency of clock used for primary clocksource - */ -diff -Naur linux-2.6.19.orig/include/linux/ixp_crypto.h linux-2.6.19/include/linux/ixp_crypto.h ---- linux-2.6.19.orig/include/linux/ixp_crypto.h 1969-12-31 17:00:00.000000000 -0700 -+++ linux-2.6.19/include/linux/ixp_crypto.h 2007-01-12 21:54:40.000000000 -0700 + * This structure provide a means for the board setup code + * to give information to th pata_ixp4xx driver. It is +Index: linux-2.6.21-rc1-arm/include/linux/ixp_crypto.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.21-rc1-arm/include/linux/ixp_crypto.h 2007-02-21 02:24:35.000000000 -0800 @@ -0,0 +1,192 @@ + +#ifndef IX_CRYPTO_H @@ -4525,9 +4550,10 @@ diff -Naur linux-2.6.19.orig/include/linux/ixp_crypto.h linux-2.6.19/include/lin + const struct ix_hash_algo *auth, int len); + +#endif -diff -Naur linux-2.6.19.orig/include/linux/ixp_npe.h linux-2.6.19/include/linux/ixp_npe.h ---- linux-2.6.19.orig/include/linux/ixp_npe.h 1969-12-31 17:00:00.000000000 -0700 -+++ linux-2.6.19/include/linux/ixp_npe.h 2007-01-12 21:54:40.000000000 -0700 +Index: linux-2.6.21-rc1-arm/include/linux/ixp_npe.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.21-rc1-arm/include/linux/ixp_npe.h 2007-02-21 02:24:35.000000000 -0800 @@ -0,0 +1,117 @@ +/* + * Copyright (C) 2006 Christian Hohnstaedt @@ -4646,9 +4672,10 @@ diff -Naur linux-2.6.19.orig/include/linux/ixp_npe.h linux-2.6.19/include/linux/ +npe_mh_get_stats(struct npe_info *npe, struct mac_plat_info *mp, u32 phys, int reset); + +#endif -diff -Naur linux-2.6.19.orig/include/linux/ixp_qmgr.h linux-2.6.19/include/linux/ixp_qmgr.h ---- linux-2.6.19.orig/include/linux/ixp_qmgr.h 1969-12-31 17:00:00.000000000 -0700 -+++ linux-2.6.19/include/linux/ixp_qmgr.h 2007-01-12 21:54:40.000000000 -0700 +Index: linux-2.6.21-rc1-arm/include/linux/ixp_qmgr.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.21-rc1-arm/include/linux/ixp_qmgr.h 2007-02-21 02:24:35.000000000 -0800 @@ -0,0 +1,202 @@ +/* + * Copyright (C) 2006 Christian Hohnstaedt diff --git a/target/linux/ixp4xx-2.6/patches/102-nslu2_led_swap.patch b/target/linux/ixp4xx-2.6/patches/102-nslu2_led_swap.patch deleted file mode 100644 index f6ea98bbd3..0000000000 --- a/target/linux/ixp4xx-2.6/patches/102-nslu2_led_swap.patch +++ /dev/null @@ -1,36 +0,0 @@ -Submitted as http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=3984/1 - -This patch fixes an error in the numbering of the disk LEDs on the -Linksys NSLU2. The error crept in because the physical location -of the LEDs has the Disk 2 LED *above* the Disk 1 LED. - -Thanks to Gordon Farquharson for reporting this. - -Signed-off-by: Rod Whitby - -PATCH FOLLOWS -KernelVersion: 2.6.19 - -Index: linux-2.6.19/include/asm-arm/arch-ixp4xx/nslu2.h -=================================================================== ---- linux-2.6.19.orig/include/asm-arm/arch-ixp4xx/nslu2.h -+++ linux-2.6.19/include/asm-arm/arch-ixp4xx/nslu2.h -@@ -76,6 +76,7 @@ - - #define NSLU2_GPIO_BUZZ 4 - #define NSLU2_BZ_BM (1L << NSLU2_GPIO_BUZZ) -+ - /* LEDs */ - - #define NSLU2_LED_RED NSLU2_GPIO0 -@@ -84,8 +85,8 @@ - #define NSLU2_LED_RED_BM (1L << NSLU2_LED_RED) - #define NSLU2_LED_GRN_BM (1L << NSLU2_LED_GRN) - --#define NSLU2_LED_DISK1 NSLU2_GPIO2 --#define NSLU2_LED_DISK2 NSLU2_GPIO3 -+#define NSLU2_LED_DISK1 NSLU2_GPIO3 -+#define NSLU2_LED_DISK2 NSLU2_GPIO2 - - #define NSLU2_LED_DISK1_BM (1L << NSLU2_GPIO2) - #define NSLU2_LED_DISK2_BM (1L << NSLU2_GPIO3) diff --git a/target/linux/ixp4xx-2.6/patches/110-ixp4xx_net_driver_fix_mac_handling.patch b/target/linux/ixp4xx-2.6/patches/110-ixp4xx_net_driver_fix_mac_handling.patch new file mode 100644 index 0000000000..1050702d88 --- /dev/null +++ b/target/linux/ixp4xx-2.6/patches/110-ixp4xx_net_driver_fix_mac_handling.patch @@ -0,0 +1,17 @@ +--- + drivers/net/ixp4xx/mac_driver.c | 24 ++++++++++-------------- + 1 file changed, 10 insertions(+), 14 deletions(-) + +Index: linux-2.6.21-rc4-git6-arm/drivers/net/ixp4xx/mac_driver.c +=================================================================== +--- linux-2.6.21-rc4-git6-arm.orig/drivers/net/ixp4xx/mac_driver.c 2007-03-22 10:32:20.735684085 +0000 ++++ linux-2.6.21-rc4-git6-arm/drivers/net/ixp4xx/mac_driver.c 2007-03-22 10:33:29.355972584 +0000 +@@ -842,7 +842,7 @@ + } + } + +-module_init(init_mac); ++late_initcall(init_mac); + module_exit(finish_mac); + + MODULE_LICENSE("GPL"); diff --git a/target/linux/ixp4xx-2.6/patches/133-ixp4xx_net_driver_improve_mac_handling.patch b/target/linux/ixp4xx-2.6/patches/133-ixp4xx_net_driver_improve_mac_handling.patch deleted file mode 100644 index d632b3045b..0000000000 --- a/target/linux/ixp4xx-2.6/patches/133-ixp4xx_net_driver_improve_mac_handling.patch +++ /dev/null @@ -1,41 +0,0 @@ -diff -Naupr a/drivers/net/ixp4xx/mac_driver.c b/drivers/net/ixp4xx/mac_driver.c ---- a/drivers/net/ixp4xx/mac_driver.c 2007-01-12 21:54:40.000000000 -0700 -+++ b/drivers/net/ixp4xx/mac_driver.c 2007-01-12 22:27:18.000000000 -0700 -@@ -350,6 +350,16 @@ static int ixmac_open (struct net_device - mac->npe_stat_num = inpe_stat_num += NPE_Q_STAT_NUM; - -+ /* Only use platform or random if there's currently no device hw addr */ -+ if (is_zero_ether_addr(dev->dev_addr)) { -+ if (is_zero_ether_addr(mac->plat->hwaddr)) { -+ random_ether_addr(dev->dev_addr); -+ dev->dev_addr[5] = mac->plat->phy_id; -+ } -+ else -+ memcpy(dev->dev_addr, mac->plat->hwaddr, 6); -+ } -+ - mac_set_uniaddr(dev); - media_check(dev, 1); - ixmac_set_rx_mode(dev); -@@ -691,20 +701,6 @@ static int mac_probe(struct platform_dev - - INIT_WORK(&mac->mdio_thread, mac_mdio_thread, dev); - -- /* The place of the MAC address is very system dependent. -- * Here we use a random one to be replaced by one of the -- * following commands: -- * "ip link set address 02:03:04:04:04:01 dev eth0" -- * "ifconfig eth0 hw ether 02:03:04:04:04:07" -- */ -- -- if (is_zero_ether_addr(plat->hwaddr)) { -- random_ether_addr(dev->dev_addr); -- dev->dev_addr[5] = plat->phy_id; -- } -- else -- memcpy(dev->dev_addr, plat->hwaddr, 6); -- - printk(KERN_INFO IXMAC_NAME " driver " IXMAC_VERSION - ": %s on %s with PHY[%d] initialized\n", - dev->name, npe->plat->name, plat->phy_id); diff --git a/target/linux/ixp4xx-2.6/patches/139-ixp4xx_net_driver_mtd_load_fw.patch b/target/linux/ixp4xx-2.6/patches/139-ixp4xx_net_driver_mtd_load_fw.patch index 0f81a0a0ed..46ba858f1c 100644 --- a/target/linux/ixp4xx-2.6/patches/139-ixp4xx_net_driver_mtd_load_fw.patch +++ b/target/linux/ixp4xx-2.6/patches/139-ixp4xx_net_driver_mtd_load_fw.patch @@ -1,7 +1,17 @@ -diff -Naupr a/drivers/net/ixp4xx/Kconfig b/drivers/net/ixp4xx/Kconfig ---- a/drivers/net/ixp4xx/Kconfig 2007-01-12 21:54:40.000000000 -0700 -+++ b/drivers/net/ixp4xx/Kconfig 2007-01-12 23:28:50.000000000 -0700 -@@ -11,6 +11,7 @@ config IXP4XX_NPE +--- + drivers/net/ixp4xx/Kconfig | 10 + + drivers/net/ixp4xx/Makefile | 1 + drivers/net/ixp4xx/npe_ucode.c | 185 +++++++++++++++++++++++++++++++++ + drivers/net/ixp4xx/ucode_dl.c | 43 ++++--- + include/asm-arm/arch-ixp4xx/platform.h | 19 +++ + include/linux/ixp_npe.h | 1 + 6 files changed, 239 insertions(+), 20 deletions(-) + +Index: linux-2.6.20-rc3/drivers/net/ixp4xx/Kconfig +=================================================================== +--- linux-2.6.20-rc3.orig/drivers/net/ixp4xx/Kconfig ++++ linux-2.6.20-rc3/drivers/net/ixp4xx/Kconfig +@@ -11,6 +11,7 @@ tristate "IXP4xx NPE support" depends on ARCH_IXP4XX depends on NET_ETHERNET @@ -9,7 +19,7 @@ diff -Naupr a/drivers/net/ixp4xx/Kconfig b/drivers/net/ixp4xx/Kconfig help The IXP4XX NPE driver supports the 3 CPU co-processors called "Network Processing Engines" (NPE). It adds support fo downloading -@@ -18,7 +19,7 @@ config IXP4XX_NPE +@@ -18,7 +19,7 @@ More about this at: Documentation/networking/ixp4xx/README. You can either use this OR the Intel Access Library (IAL) @@ -18,7 +28,7 @@ diff -Naupr a/drivers/net/ixp4xx/Kconfig b/drivers/net/ixp4xx/Kconfig bool "Use Firmware hotplug for Microcode download" depends on IXP4XX_NPE select HOTPLUG -@@ -28,6 +29,13 @@ config IXP4XX_FW_LOAD +@@ -28,6 +29,13 @@ /usr/lib/hotplug/firmware/NPE-[ABC] see Documentation/firmware_class/hotplug-script @@ -32,9 +42,10 @@ diff -Naupr a/drivers/net/ixp4xx/Kconfig b/drivers/net/ixp4xx/Kconfig config IXP4XX_MAC tristate "IXP4xx MAC support" depends on IXP4XX_NPE -diff -Naupr a/drivers/net/ixp4xx/Makefile b/drivers/net/ixp4xx/Makefile ---- a/drivers/net/ixp4xx/Makefile 2007-01-12 21:54:40.000000000 -0700 -+++ b/drivers/net/ixp4xx/Makefile 2007-01-12 23:28:50.000000000 -0700 +Index: linux-2.6.20-rc3/drivers/net/ixp4xx/Makefile +=================================================================== +--- linux-2.6.20-rc3.orig/drivers/net/ixp4xx/Makefile ++++ linux-2.6.20-rc3/drivers/net/ixp4xx/Makefile @@ -1,5 +1,6 @@ obj-$(CONFIG_IXP4XX_QMGR) += ixp4xx_qmgr.o obj-$(CONFIG_IXP4XX_NPE) += ixp4xx_npe.o @@ -42,9 +53,10 @@ diff -Naupr a/drivers/net/ixp4xx/Makefile b/drivers/net/ixp4xx/Makefile obj-$(CONFIG_IXP4XX_MAC) += ixp4xx_mac.o obj-$(CONFIG_IXP4XX_CRYPTO) += ixp4xx_crypto.o -diff -Naupr a/drivers/net/ixp4xx/npe_ucode.c b/drivers/net/ixp4xx/npe_ucode.c ---- a/drivers/net/ixp4xx/npe_ucode.c 1969-12-31 17:00:00.000000000 -0700 -+++ b/drivers/net/ixp4xx/npe_ucode.c 2007-01-12 23:28:50.000000000 -0700 +Index: linux-2.6.20-rc3/drivers/net/ixp4xx/npe_ucode.c +=================================================================== +--- /dev/null ++++ linux-2.6.20-rc3/drivers/net/ixp4xx/npe_ucode.c @@ -0,0 +1,185 @@ +/* + * Provide an NPE platform device for microcode handling @@ -231,9 +243,10 @@ diff -Naupr a/drivers/net/ixp4xx/npe_ucode.c b/drivers/net/ixp4xx/npe_ucode.c + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Alessandro Zummo "); -diff -Naupr a/drivers/net/ixp4xx/ucode_dl.c b/drivers/net/ixp4xx/ucode_dl.c ---- a/drivers/net/ixp4xx/ucode_dl.c 2007-01-12 21:54:40.000000000 -0700 -+++ b/drivers/net/ixp4xx/ucode_dl.c 2007-01-12 23:28:50.000000000 -0700 +Index: linux-2.6.20-rc3/drivers/net/ixp4xx/ucode_dl.c +=================================================================== +--- linux-2.6.20-rc3.orig/drivers/net/ixp4xx/ucode_dl.c ++++ linux-2.6.20-rc3/drivers/net/ixp4xx/ucode_dl.c @@ -16,6 +16,7 @@ #include #include @@ -255,7 +268,7 @@ diff -Naupr a/drivers/net/ixp4xx/ucode_dl.c b/drivers/net/ixp4xx/ucode_dl.c #define EOF_BLOCK 0xf #define IMG_SIZE(image) (((image)->size * sizeof(u32)) + \ sizeof(struct dl_image)) -@@ -38,21 +45,6 @@ enum blk_type { +@@ -38,21 +45,6 @@ data, }; @@ -277,7 +290,7 @@ diff -Naupr a/drivers/net/ixp4xx/ucode_dl.c b/drivers/net/ixp4xx/ucode_dl.c struct dl_codeblock { u32 npe_addr; u32 size; -@@ -127,20 +119,33 @@ download_block(struct npe_info *npe, str +@@ -127,20 +119,33 @@ return 0; } @@ -313,7 +326,7 @@ diff -Naupr a/drivers/net/ixp4xx/ucode_dl.c b/drivers/net/ixp4xx/ucode_dl.c npe = dev_get_drvdata(dev); if (npe->loaded && (npe->usage > 0)) { printk(KERN_INFO "Cowardly refusing to reload an Image " -@@ -267,8 +272,7 @@ static ssize_t ucode_write(struct file * +@@ -267,8 +272,7 @@ static void npe_firmware_probe(struct device *dev) { @@ -323,17 +336,18 @@ diff -Naupr a/drivers/net/ixp4xx/ucode_dl.c b/drivers/net/ixp4xx/ucode_dl.c const struct firmware *fw_entry; struct npe_info *npe = dev_get_drvdata(dev); struct dl_image *image; -@@ -477,3 +481,4 @@ MODULE_AUTHOR("Christian Hohnstaedt */ -- .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, -- .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, -- .map_io = ixp4xx_map_io, -- .init_irq = ixp4xx_init_irq, -- .timer = &ixp4xx_timer, -- .boot_params = 0x0100, -- .init_machine = ixdp425_init, --MACHINE_END --#endif -- diff --git a/target/linux/ixp4xx-2.6/patches/710-avila_loft_setup.patch b/target/linux/ixp4xx-2.6/patches/710-avila_loft_setup.patch deleted file mode 100644 index 4fb597d7db..0000000000 --- a/target/linux/ixp4xx-2.6/patches/710-avila_loft_setup.patch +++ /dev/null @@ -1,381 +0,0 @@ -This patch adds support for the Gateworks Avila Network Platform in -a separate set of setup files to the IXDP425. This is necessary now -that a driver for the Avila CF card slot is available. It also adds -support for a minor variant on the Avila board known as the Loft, -which has a different number of maximum PCI devices. - -Signed-off-by: Michael-Luke Jones cam.ac.uk> - -Index: linux-2.6.19/arch/arm/mach-ixp4xx/Kconfig -=================================================================== ---- linux-2.6.19.orig/arch/arm/mach-ixp4xx/Kconfig -+++ linux-2.6.19/arch/arm/mach-ixp4xx/Kconfig -@@ -17,7 +17,7 @@ config MACH_NSLU2 - NSLU2 NAS device. For more information on this platform, - see http://www.nslu2-linux.org - --config ARCH_AVILA -+config MACH_AVILA - bool "Avila" - select PCI - help -@@ -25,6 +25,14 @@ config ARCH_AVILA - Avila Network Platform. For more information on this platform, - see . - -+config MACH_LOFT -+ bool "Loft" -+ depends on MACH_AVILA -+ help -+ Say 'Y' here if you want your kernel to support the Giant -+ Shoulder Inc Loft board (a minor variation on the standard -+ Gateworks Avila Network Platform). -+ - config ARCH_ADI_COYOTE - bool "Coyote" - select PCI -@@ -86,7 +94,7 @@ config MACH_NAS100D - # - config ARCH_IXDP4XX - bool -- depends on ARCH_IXDP425 || ARCH_AVILA || MACH_IXDP465 -+ depends on ARCH_IXDP425 || MACH_IXDP465 - default y - - # -Index: linux-2.6.19/arch/arm/mach-ixp4xx/Makefile -=================================================================== ---- linux-2.6.19.orig/arch/arm/mach-ixp4xx/Makefile -+++ linux-2.6.19/arch/arm/mach-ixp4xx/Makefile -@@ -6,6 +6,7 @@ obj-pci-y := - obj-pci-n := - - obj-pci-$(CONFIG_ARCH_IXDP4XX) += ixdp425-pci.o -+obj-pci-$(CONFIG_MACH_AVILA) += avila-pci.o - obj-pci-$(CONFIG_MACH_IXDPG425) += ixdpg425-pci.o - obj-pci-$(CONFIG_ARCH_ADI_COYOTE) += coyote-pci.o - obj-pci-$(CONFIG_MACH_GTWX5715) += gtwx5715-pci.o -@@ -15,6 +16,7 @@ obj-pci-$(CONFIG_MACH_NAS100D) += nas10 - obj-y += common.o - - obj-$(CONFIG_ARCH_IXDP4XX) += ixdp425-setup.o -+obj-$(CONFIG_MACH_AVILA) += avila-setup.o - obj-$(CONFIG_MACH_IXDPG425) += coyote-setup.o - obj-$(CONFIG_ARCH_ADI_COYOTE) += coyote-setup.o - obj-$(CONFIG_MACH_GTWX5715) += gtwx5715-setup.o -Index: linux-2.6.19/arch/arm/mach-ixp4xx/avila-pci.c -=================================================================== ---- /dev/null -+++ linux-2.6.19/arch/arm/mach-ixp4xx/avila-pci.c -@@ -0,0 +1,78 @@ -+/* -+ * arch/arm/mach-ixp4xx/avila-pci.c -+ * -+ * Gateworks Avila board-level PCI initialization -+ * -+ * Author: Michael-Luke Jones -+ * -+ * Based on ixdp-pci.c -+ * Copyright (C) 2002 Intel Corporation. -+ * Copyright (C) 2003-2004 MontaVista Software, Inc. -+ * -+ * Maintainer: Deepak Saxena -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+void __init avila_pci_preinit(void) -+{ -+ set_irq_type(IRQ_AVILA_PCI_INTA, IRQT_LOW); -+ set_irq_type(IRQ_AVILA_PCI_INTB, IRQT_LOW); -+ set_irq_type(IRQ_AVILA_PCI_INTC, IRQT_LOW); -+ set_irq_type(IRQ_AVILA_PCI_INTD, IRQT_LOW); -+ -+ ixp4xx_pci_preinit(); -+} -+ -+static int __init avila_map_irq(struct pci_dev *dev, u8 slot, u8 pin) -+{ -+ static int pci_irq_table[AVILA_PCI_IRQ_LINES] = { -+ IRQ_AVILA_PCI_INTA, -+ IRQ_AVILA_PCI_INTB, -+ IRQ_AVILA_PCI_INTC, -+ IRQ_AVILA_PCI_INTD -+ }; -+ -+ int irq = -1; -+ -+ if (slot >= 1 && -+ slot <= (machine_is_loft() ? LOFT_PCI_MAX_DEV : AVILA_PCI_MAX_DEV) && -+ pin >= 1 && pin <= AVILA_PCI_IRQ_LINES) { -+ irq = pci_irq_table[(slot + pin - 2) % 4]; -+ } -+ -+ return irq; -+} -+ -+struct hw_pci avila_pci __initdata = { -+ .nr_controllers = 1, -+ .preinit = avila_pci_preinit, -+ .swizzle = pci_std_swizzle, -+ .setup = ixp4xx_setup, -+ .scan = ixp4xx_scan_bus, -+ .map_irq = avila_map_irq, -+}; -+ -+int __init avila_pci_init(void) -+{ -+ if (machine_is_avila() || machine_is_loft()) -+ pci_common_init(&avila_pci); -+ return 0; -+} -+ -+subsys_initcall(avila_pci_init); -+ -Index: linux-2.6.19/arch/arm/mach-ixp4xx/avila-setup.c -=================================================================== ---- /dev/null -+++ linux-2.6.19/arch/arm/mach-ixp4xx/avila-setup.c -@@ -0,0 +1,152 @@ -+/* -+ * arch/arm/mach-ixp4xx/avila-setup.c -+ * -+ * Gateworks Avila board-setup -+ * -+ * Author: Michael-Luke Jones -+ * -+ * Based on ixdp-setup.c -+ * Copyright (C) 2003-2005 MontaVista Software, Inc. -+ * -+ * Author: Deepak Saxena -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static struct flash_platform_data avila_flash_data = { -+ .map_name = "cfi_probe", -+ .width = 2, -+}; -+ -+static struct resource avila_flash_resource = { -+ .flags = IORESOURCE_MEM, -+}; -+ -+static struct platform_device avila_flash = { -+ .name = "IXP4XX-Flash", -+ .id = 0, -+ .dev = { -+ .platform_data = &avila_flash_data, -+ }, -+ .num_resources = 1, -+ .resource = &avila_flash_resource, -+}; -+ -+static struct ixp4xx_i2c_pins avila_i2c_gpio_pins = { -+ .sda_pin = AVILA_SDA_PIN, -+ .scl_pin = AVILA_SCL_PIN, -+}; -+ -+static struct platform_device avila_i2c_controller = { -+ .name = "IXP4XX-I2C", -+ .id = 0, -+ .dev = { -+ .platform_data = &avila_i2c_gpio_pins, -+ }, -+ .num_resources = 0 -+}; -+ -+static struct resource avila_uart_resources[] = { -+ { -+ .start = IXP4XX_UART1_BASE_PHYS, -+ .end = IXP4XX_UART1_BASE_PHYS + 0x0fff, -+ .flags = IORESOURCE_MEM -+ }, -+ { -+ .start = IXP4XX_UART2_BASE_PHYS, -+ .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, -+ .flags = IORESOURCE_MEM -+ } -+}; -+ -+static struct plat_serial8250_port avila_uart_data[] = { -+ { -+ .mapbase = IXP4XX_UART1_BASE_PHYS, -+ .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET, -+ .irq = IRQ_IXP4XX_UART1, -+ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, -+ .iotype = UPIO_MEM, -+ .regshift = 2, -+ .uartclk = IXP4XX_UART_XTAL, -+ }, -+ { -+ .mapbase = IXP4XX_UART2_BASE_PHYS, -+ .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, -+ .irq = IRQ_IXP4XX_UART2, -+ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, -+ .iotype = UPIO_MEM, -+ .regshift = 2, -+ .uartclk = IXP4XX_UART_XTAL, -+ }, -+ { }, -+}; -+ -+static struct platform_device avila_uart = { -+ .name = "serial8250", -+ .id = PLAT8250_DEV_PLATFORM, -+ .dev.platform_data = avila_uart_data, -+ .num_resources = 2, -+ .resource = avila_uart_resources -+}; -+ -+static struct platform_device *avila_devices[] __initdata = { -+ &avila_i2c_controller, -+ &avila_flash, -+ &avila_uart -+}; -+ -+static void __init avila_init(void) -+{ -+ ixp4xx_sys_init(); -+ -+ avila_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); -+ avila_flash_resource.end = -+ IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1; -+ -+ platform_add_devices(avila_devices, ARRAY_SIZE(avila_devices)); -+} -+ -+MACHINE_START(AVILA, "Gateworks Avila Network Platform") -+ /* Maintainer: Deepak Saxena */ -+ .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, -+ .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, -+ .map_io = ixp4xx_map_io, -+ .init_irq = ixp4xx_init_irq, -+ .timer = &ixp4xx_timer, -+ .boot_params = 0x0100, -+ .init_machine = avila_init, -+MACHINE_END -+ -+ /* -+ * Loft is functionally equivalent to Avila except that it has a -+ * different number for the maximum PCI devices. The MACHINE -+ * structure below is identical to Avila except for the comment. -+ */ -+#ifdef CONFIG_MACH_LOFT -+MACHINE_START(LOFT, "Giant Shoulder Inc Loft board") -+ /* Maintainer: Tom Billman */ -+ .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, -+ .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, -+ .map_io = ixp4xx_map_io, -+ .init_irq = ixp4xx_init_irq, -+ .timer = &ixp4xx_timer, -+ .boot_params = 0x0100, -+ .init_machine = avila_init, -+MACHINE_END -+#endif -+ -Index: linux-2.6.19/include/asm-arm/arch-ixp4xx/avila.h -=================================================================== ---- /dev/null -+++ linux-2.6.19/include/asm-arm/arch-ixp4xx/avila.h -@@ -0,0 +1,39 @@ -+/* -+ * include/asm-arm/arch-ixp4xx/avila.h -+ * -+ * Gateworks Avila platform specific definitions -+ * -+ * Author: Michael-Luke Jones -+ * -+ * Based on ixdp425.h -+ * Author: Deepak Saxena -+ * -+ * Copyright 2004 (c) MontaVista, Software, Inc. -+ * -+ * This file is licensed under the terms of the GNU General Public -+ * License version 2. This program is licensed "as is" without any -+ * warranty of any kind, whether express or implied. -+ */ -+ -+#ifndef __ASM_ARCH_HARDWARE_H__ -+#error "Do not include this directly, instead #include " -+#endif -+ -+#define AVILA_SDA_PIN 7 -+#define AVILA_SCL_PIN 6 -+ -+/* -+ * AVILA PCI IRQs -+ */ -+#define AVILA_PCI_MAX_DEV 4 -+#define LOFT_PCI_MAX_DEV 6 -+#define AVILA_PCI_IRQ_LINES 4 -+ -+ -+/* PCI controller GPIO to IRQ pin mappings */ -+#define AVILA_PCI_INTA_PIN 11 -+#define AVILA_PCI_INTB_PIN 10 -+#define AVILA_PCI_INTC_PIN 9 -+#define AVILA_PCI_INTD_PIN 8 -+ -+ -Index: linux-2.6.19/include/asm-arm/arch-ixp4xx/hardware.h -=================================================================== ---- linux-2.6.19.orig/include/asm-arm/arch-ixp4xx/hardware.h -+++ linux-2.6.19/include/asm-arm/arch-ixp4xx/hardware.h -@@ -42,6 +42,7 @@ extern unsigned int processor_id; - - /* Platform specific details */ - #include "ixdp425.h" -+#include "avila.h" - #include "coyote.h" - #include "prpmc1100.h" - #include "nslu2.h" -Index: linux-2.6.19/include/asm-arm/arch-ixp4xx/irqs.h -=================================================================== ---- linux-2.6.19.orig/include/asm-arm/arch-ixp4xx/irqs.h -+++ linux-2.6.19/include/asm-arm/arch-ixp4xx/irqs.h -@@ -79,6 +79,15 @@ - #define IRQ_IXDP425_PCI_INTD IRQ_IXP4XX_GPIO8 - - /* -+ * Gateworks Avila board IRQs -+ */ -+#define IRQ_AVILA_PCI_INTA IRQ_IXP4XX_GPIO11 -+#define IRQ_AVILA_PCI_INTB IRQ_IXP4XX_GPIO10 -+#define IRQ_AVILA_PCI_INTC IRQ_IXP4XX_GPIO9 -+#define IRQ_AVILA_PCI_INTD IRQ_IXP4XX_GPIO8 -+ -+ -+/* - * PrPMC1100 Board IRQs - */ - #define IRQ_PRPMC1100_PCI_INTA IRQ_IXP4XX_GPIO11 diff --git a/target/linux/ixp4xx-2.6/patches/800-eeprom_new_notifier.patch b/target/linux/ixp4xx-2.6/patches/800-eeprom_new_notifier.patch index 6c461089aa..79a097128c 100644 --- a/target/linux/ixp4xx-2.6/patches/800-eeprom_new_notifier.patch +++ b/target/linux/ixp4xx-2.6/patches/800-eeprom_new_notifier.patch @@ -9,11 +9,11 @@ the 'maclist' code and read out by the ethernet config. Signed-off-by: John Bowler -Index: linux-2.6.19/drivers/i2c/chips/eeprom.c +Index: linux-2.6.21-rc1-arm/drivers/i2c/chips/eeprom.c =================================================================== ---- linux-2.6.19.orig/drivers/i2c/chips/eeprom.c -+++ linux-2.6.19/drivers/i2c/chips/eeprom.c -@@ -34,6 +34,8 @@ +--- linux-2.6.21-rc1-arm.orig/drivers/i2c/chips/eeprom.c 2007-02-21 02:24:14.000000000 -0800 ++++ linux-2.6.21-rc1-arm/drivers/i2c/chips/eeprom.c 2007-02-21 02:25:01.000000000 -0800 +@@ -33,6 +33,8 @@ #include #include #include @@ -22,7 +22,7 @@ Index: linux-2.6.19/drivers/i2c/chips/eeprom.c /* Addresses to scan */ static unsigned short normal_i2c[] = { 0x50, 0x51, 0x52, 0x53, 0x54, -@@ -42,26 +44,7 @@ static unsigned short normal_i2c[] = { 0 +@@ -41,26 +43,7 @@ /* Insmod parameters */ I2C_CLIENT_INSMOD_1(eeprom); @@ -50,7 +50,7 @@ Index: linux-2.6.19/drivers/i2c/chips/eeprom.c static int eeprom_attach_adapter(struct i2c_adapter *adapter); static int eeprom_detect(struct i2c_adapter *adapter, int address, int kind); -@@ -190,6 +173,7 @@ static int eeprom_detect(struct i2c_adap +@@ -189,6 +172,7 @@ data->valid = 0; mutex_init(&data->update_lock); data->nature = UNKNOWN; @@ -58,7 +58,7 @@ Index: linux-2.6.19/drivers/i2c/chips/eeprom.c /* Tell the I2C layer a new client has arrived */ if ((err = i2c_attach_client(new_client))) -@@ -213,6 +197,9 @@ static int eeprom_detect(struct i2c_adap +@@ -212,6 +196,9 @@ if (err) goto exit_detach; @@ -68,7 +68,7 @@ Index: linux-2.6.19/drivers/i2c/chips/eeprom.c return 0; exit_detach: -@@ -238,6 +225,41 @@ static int eeprom_detach_client(struct i +@@ -237,6 +224,41 @@ return 0; } @@ -110,10 +110,10 @@ Index: linux-2.6.19/drivers/i2c/chips/eeprom.c static int __init eeprom_init(void) { return i2c_add_driver(&eeprom_driver); -Index: linux-2.6.19/include/linux/eeprom.h +Index: linux-2.6.21-rc1-arm/include/linux/eeprom.h =================================================================== ---- /dev/null -+++ linux-2.6.19/include/linux/eeprom.h +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.21-rc1-arm/include/linux/eeprom.h 2007-02-21 02:25:01.000000000 -0800 @@ -0,0 +1,71 @@ +#ifndef _LINUX_EEPROM_H +#define _LINUX_EEPROM_H @@ -186,11 +186,11 @@ Index: linux-2.6.19/include/linux/eeprom.h +extern int unregister_eeprom_notifier(struct notifier_block *nb); + +#endif /* _LINUX_EEPROM_H */ -Index: linux-2.6.19/include/linux/notifier.h +Index: linux-2.6.21-rc1-arm/include/linux/notifier.h =================================================================== ---- linux-2.6.19.orig/include/linux/notifier.h -+++ linux-2.6.19/include/linux/notifier.h -@@ -187,5 +187,8 @@ extern int srcu_notifier_call_chain(stru +--- linux-2.6.21-rc1-arm.orig/include/linux/notifier.h 2007-02-21 02:24:14.000000000 -0800 ++++ linux-2.6.21-rc1-arm/include/linux/notifier.h 2007-02-21 02:25:01.000000000 -0800 +@@ -187,5 +187,8 @@ #define CPU_DOWN_FAILED 0x0006 /* CPU (unsigned)v NOT going down */ #define CPU_DEAD 0x0007 /* CPU (unsigned)v dead */ -- cgit v1.2.3