From 4aca87515a5083ae0e31ce3177189fd43b6d05ac Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sat, 3 Jan 2015 13:58:15 +0100 Subject: patch to Vanilla Tomato 1.28 --- release/src/linux/linux/include/linux/fs.h | 2 +- release/src/linux/linux/include/linux/imq.h | 9 + release/src/linux/linux/include/linux/jhash.h | 143 ++++ release/src/linux/linux/include/linux/list.h | 27 + .../include/linux/netfilter_ipv4/ip_conntrack.h | 52 +- .../linux/netfilter_ipv4/ip_conntrack_h323.h | 1 + .../linux/netfilter_ipv4/ip_conntrack_proto_esp.h | 0 .../linux/netfilter_ipv4/ip_conntrack_proto_gre.h | 4 +- .../linux/netfilter_ipv4/ip_conntrack_tuple.h | 1 - .../linux/include/linux/netfilter_ipv4/ip_tables.h | 3 +- .../include/linux/netfilter_ipv4/ipt_BCOUNT.h | 16 + .../include/linux/netfilter_ipv4/ipt_CLASSIFY.h | 8 + .../include/linux/netfilter_ipv4/ipt_CONNMARK.h | 26 + .../linux/include/linux/netfilter_ipv4/ipt_IMQ.h | 8 + .../include/linux/netfilter_ipv4/ipt_MACSAVE.h | 16 + .../linux/include/linux/netfilter_ipv4/ipt_ROUTE.h | 23 + .../linux/include/linux/netfilter_ipv4/ipt_TTL.h | 21 + .../include/linux/netfilter_ipv4/ipt_account.h | 26 + .../include/linux/netfilter_ipv4/ipt_bcount.h | 18 + .../include/linux/netfilter_ipv4/ipt_condition.h | 11 + .../include/linux/netfilter_ipv4/ipt_connlimit.h | 12 + .../include/linux/netfilter_ipv4/ipt_connmark.h | 18 + .../linux/include/linux/netfilter_ipv4/ipt_exp.h | 15 + .../linux/include/linux/netfilter_ipv4/ipt_geoip.h | 51 ++ .../linux/include/linux/netfilter_ipv4/ipt_ipp2p.h | 31 + .../include/linux/netfilter_ipv4/ipt_iprange.h | 23 + .../include/linux/netfilter_ipv4/ipt_layer7.h | 26 + .../include/linux/netfilter_ipv4/ipt_macsave.h | 17 + .../linux/include/linux/netfilter_ipv4/ipt_quota.h | 12 + .../include/linux/netfilter_ipv4/ipt_recent.h | 28 + .../include/linux/netfilter_ipv4/ipt_string.h | 21 + .../linux/include/linux/netfilter_ipv4/ipt_time.h | 10 +- .../linux/include/linux/netfilter_ipv4/ipt_u32.h | 40 ++ .../linux/include/linux/netfilter_ipv4/ipt_web.h | 30 + .../linux/include/linux/netfilter_ipv6/ip6t_IMQ.h | 8 + .../include/linux/netfilter_ipv6/ip6t_ROUTE.h | 23 + .../include/linux/netfilter_ipv6/ip6t_condition.h | 11 + release/src/linux/linux/include/linux/pkt_sched.h | 59 ++ release/src/linux/linux/include/linux/rbtree.h | 6 + release/src/linux/linux/include/linux/skbuff.h | 8 +- .../src/linux/linux/include/linux/squashfs_fs.h | 777 ++++++++++++++++----- .../src/linux/linux/include/linux/squashfs_fs_i.h | 27 +- .../src/linux/linux/include/linux/squashfs_fs_sb.h | 43 +- release/src/linux/linux/include/linux/sysctl.h | 6 +- release/src/linux/linux/include/net/pkt_cls.h | 6 +- release/src/linux/linux/include/net/pkt_sched.h | 15 +- release/src/linux/linux/include/net/sock.h | 14 +- release/src/linux/linux/include/net/tcp.h | 59 +- 48 files changed, 1586 insertions(+), 225 deletions(-) create mode 100644 release/src/linux/linux/include/linux/imq.h create mode 100644 release/src/linux/linux/include/linux/jhash.h mode change 100755 => 100644 release/src/linux/linux/include/linux/netfilter_ipv4/ip_conntrack_proto_esp.h create mode 100644 release/src/linux/linux/include/linux/netfilter_ipv4/ipt_BCOUNT.h create mode 100644 release/src/linux/linux/include/linux/netfilter_ipv4/ipt_CLASSIFY.h create mode 100644 release/src/linux/linux/include/linux/netfilter_ipv4/ipt_CONNMARK.h create mode 100644 release/src/linux/linux/include/linux/netfilter_ipv4/ipt_IMQ.h create mode 100644 release/src/linux/linux/include/linux/netfilter_ipv4/ipt_MACSAVE.h create mode 100644 release/src/linux/linux/include/linux/netfilter_ipv4/ipt_ROUTE.h create mode 100644 release/src/linux/linux/include/linux/netfilter_ipv4/ipt_TTL.h create mode 100644 release/src/linux/linux/include/linux/netfilter_ipv4/ipt_account.h create mode 100644 release/src/linux/linux/include/linux/netfilter_ipv4/ipt_bcount.h create mode 100644 release/src/linux/linux/include/linux/netfilter_ipv4/ipt_condition.h create mode 100644 release/src/linux/linux/include/linux/netfilter_ipv4/ipt_connlimit.h create mode 100644 release/src/linux/linux/include/linux/netfilter_ipv4/ipt_connmark.h create mode 100644 release/src/linux/linux/include/linux/netfilter_ipv4/ipt_exp.h create mode 100644 release/src/linux/linux/include/linux/netfilter_ipv4/ipt_geoip.h create mode 100644 release/src/linux/linux/include/linux/netfilter_ipv4/ipt_ipp2p.h create mode 100644 release/src/linux/linux/include/linux/netfilter_ipv4/ipt_iprange.h create mode 100644 release/src/linux/linux/include/linux/netfilter_ipv4/ipt_layer7.h create mode 100644 release/src/linux/linux/include/linux/netfilter_ipv4/ipt_macsave.h create mode 100644 release/src/linux/linux/include/linux/netfilter_ipv4/ipt_quota.h create mode 100644 release/src/linux/linux/include/linux/netfilter_ipv4/ipt_recent.h create mode 100644 release/src/linux/linux/include/linux/netfilter_ipv4/ipt_string.h create mode 100644 release/src/linux/linux/include/linux/netfilter_ipv4/ipt_u32.h create mode 100644 release/src/linux/linux/include/linux/netfilter_ipv4/ipt_web.h create mode 100644 release/src/linux/linux/include/linux/netfilter_ipv6/ip6t_IMQ.h create mode 100644 release/src/linux/linux/include/linux/netfilter_ipv6/ip6t_ROUTE.h create mode 100644 release/src/linux/linux/include/linux/netfilter_ipv6/ip6t_condition.h (limited to 'release/src/linux/linux/include') diff --git a/release/src/linux/linux/include/linux/fs.h b/release/src/linux/linux/include/linux/fs.h index 0b85bf9e..db1a1572 100644 --- a/release/src/linux/linux/include/linux/fs.h +++ b/release/src/linux/linux/include/linux/fs.h @@ -1421,7 +1421,7 @@ extern int block_write_full_page(struct page*, get_block_t*); extern int block_read_full_page(struct page*, get_block_t*); extern int block_prepare_write(struct page*, unsigned, unsigned, get_block_t*); extern int cont_prepare_write(struct page*, unsigned, unsigned, get_block_t*, - unsigned long *); + loff_t *); extern int generic_cont_expand(struct inode *inode, loff_t size) ; extern int block_commit_write(struct page *page, unsigned from, unsigned to); extern int block_sync_page(struct page *); diff --git a/release/src/linux/linux/include/linux/imq.h b/release/src/linux/linux/include/linux/imq.h new file mode 100644 index 00000000..8bf3f959 --- /dev/null +++ b/release/src/linux/linux/include/linux/imq.h @@ -0,0 +1,9 @@ +#ifndef _IMQ_H +#define _IMQ_H + +#define IMQ_MAX_DEVS 16 + +#define IMQ_F_IFMASK 0x7f +#define IMQ_F_ENQUEUE 0x80 + +#endif /* _IMQ_H */ diff --git a/release/src/linux/linux/include/linux/jhash.h b/release/src/linux/linux/include/linux/jhash.h new file mode 100644 index 00000000..82c7ae41 --- /dev/null +++ b/release/src/linux/linux/include/linux/jhash.h @@ -0,0 +1,143 @@ +#ifndef _LINUX_JHASH_H +#define _LINUX_JHASH_H + +/* jhash.h: Jenkins hash support. + * + * Copyright (C) 1996 Bob Jenkins (bob_jenkins@burtleburtle.net) + * + * http://burtleburtle.net/bob/hash/ + * + * These are the credits from Bob's sources: + * + * lookup2.c, by Bob Jenkins, December 1996, Public Domain. + * hash(), hash2(), hash3, and mix() are externally useful functions. + * Routines to test the hash are included if SELF_TEST is defined. + * You can use this free for any purpose. It has no warranty. + * + * Copyright (C) 2003 David S. Miller (davem@redhat.com) + * + * I've modified Bob's hash to be useful in the Linux kernel, and + * any bugs present are surely my fault. -DaveM + */ + +/* NOTE: Arguments are modified. */ +#define __jhash_mix(a, b, c) \ +{ \ + a -= b; a -= c; a ^= (c>>13); \ + b -= c; b -= a; b ^= (a<<8); \ + c -= a; c -= b; c ^= (b>>13); \ + a -= b; a -= c; a ^= (c>>12); \ + b -= c; b -= a; b ^= (a<<16); \ + c -= a; c -= b; c ^= (b>>5); \ + a -= b; a -= c; a ^= (c>>3); \ + b -= c; b -= a; b ^= (a<<10); \ + c -= a; c -= b; c ^= (b>>15); \ +} + +/* The golden ration: an arbitrary value */ +#define JHASH_GOLDEN_RATIO 0x9e3779b9 + +/* The most generic version, hashes an arbitrary sequence + * of bytes. No alignment or length assumptions are made about + * the input key. + */ +static inline u32 jhash(const void *key, u32 length, u32 initval) +{ + u32 a, b, c, len; + const u8 *k = key; + + len = length; + a = b = JHASH_GOLDEN_RATIO; + c = initval; + + while (len >= 12) { + a += (k[0] +((u32)k[1]<<8) +((u32)k[2]<<16) +((u32)k[3]<<24)); + b += (k[4] +((u32)k[5]<<8) +((u32)k[6]<<16) +((u32)k[7]<<24)); + c += (k[8] +((u32)k[9]<<8) +((u32)k[10]<<16)+((u32)k[11]<<24)); + + __jhash_mix(a,b,c); + + k += 12; + len -= 12; + } + + c += length; + switch (len) { + case 11: c += ((u32)k[10]<<24); + case 10: c += ((u32)k[9]<<16); + case 9 : c += ((u32)k[8]<<8); + case 8 : b += ((u32)k[7]<<24); + case 7 : b += ((u32)k[6]<<16); + case 6 : b += ((u32)k[5]<<8); + case 5 : b += k[4]; + case 4 : a += ((u32)k[3]<<24); + case 3 : a += ((u32)k[2]<<16); + case 2 : a += ((u32)k[1]<<8); + case 1 : a += k[0]; + }; + + __jhash_mix(a,b,c); + + return c; +} + +/* A special optimized version that handles 1 or more of u32s. + * The length parameter here is the number of u32s in the key. + */ +static inline u32 jhash2(u32 *k, u32 length, u32 initval) +{ + u32 a, b, c, len; + + a = b = JHASH_GOLDEN_RATIO; + c = initval; + len = length; + + while (len >= 3) { + a += k[0]; + b += k[1]; + c += k[2]; + __jhash_mix(a, b, c); + k += 3; len -= 3; + } + + c += length * 4; + + switch (len) { + case 2 : b += k[1]; + case 1 : a += k[0]; + }; + + __jhash_mix(a,b,c); + + return c; +} + + +/* A special ultra-optimized versions that knows they are hashing exactly + * 3, 2 or 1 word(s). + * + * NOTE: In partilar the "c += length; __jhash_mix(a,b,c);" normally + * done at the end is not done here. + */ +static inline u32 jhash_3words(u32 a, u32 b, u32 c, u32 initval) +{ + a += JHASH_GOLDEN_RATIO; + b += JHASH_GOLDEN_RATIO; + c += initval; + + __jhash_mix(a, b, c); + + return c; +} + +static inline u32 jhash_2words(u32 a, u32 b, u32 initval) +{ + return jhash_3words(a, b, 0, initval); +} + +static inline u32 jhash_1word(u32 a, u32 initval) +{ + return jhash_3words(a, 0, 0, initval); +} + +#endif /* _LINUX_JHASH_H */ diff --git a/release/src/linux/linux/include/linux/list.h b/release/src/linux/linux/include/linux/list.h index 9d98ba31..dafdfc87 100644 --- a/release/src/linux/linux/include/linux/list.h +++ b/release/src/linux/linux/include/linux/list.h @@ -227,6 +227,33 @@ static inline void list_splice_init(struct list_head *list, pos = list_entry(pos->member.next, typeof(*pos), member), \ prefetch(pos->member.next)) +/** + * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry + * @pos: the type * to use as a loop counter. + * @n: another type * to use as temporary storage + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + */ +#define list_for_each_entry_safe(pos, n, head, member) \ + for (pos = list_entry((head)->next, typeof(*pos), member), \ + n = list_entry(pos->member.next, typeof(*pos), member); \ + &pos->member != (head); \ + pos = n, n = list_entry(n->member.next, typeof(*n), member)) + +/** + * list_for_each_entry_continue - iterate over list of given type + * continuing after existing point + * @pos: the type * to use as a loop counter. + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + */ +#define list_for_each_entry_continue(pos, head, member) \ + for (pos = list_entry(pos->member.next, typeof(*pos), member), \ + prefetch(pos->member.next); \ + &pos->member != (head); \ + pos = list_entry(pos->member.next, typeof(*pos), member), \ + prefetch(pos->member.next)) + #endif /* __KERNEL__ || _LVM_H_INCLUDE */ #endif diff --git a/release/src/linux/linux/include/linux/netfilter_ipv4/ip_conntrack.h b/release/src/linux/linux/include/linux/netfilter_ipv4/ip_conntrack.h index 314f6cc3..2e75b782 100644 --- a/release/src/linux/linux/include/linux/netfilter_ipv4/ip_conntrack.h +++ b/release/src/linux/linux/include/linux/netfilter_ipv4/ip_conntrack.h @@ -6,6 +6,7 @@ #include #include +#include #include enum ip_conntrack_info @@ -41,6 +42,10 @@ enum ip_conntrack_status { /* Conntrack should never be early-expired. */ IPS_ASSURED_BIT = 2, IPS_ASSURED = (1 << IPS_ASSURED_BIT), + + /* Connection is confirmed: originating packet has left box */ + IPS_CONFIRMED_BIT = 3, + IPS_CONFIRMED = (1 << IPS_CONFIRMED_BIT), }; #include @@ -62,31 +67,27 @@ union ip_conntrack_expect_proto { }; /* Add protocol helper include file here */ +#include #include #include #include -#include - #include #include -#ifdef CONFIG_IP_NF_NAT_RTSP -#include -#endif #include +#include /* per expectation: application helper private data */ union ip_conntrack_expect_help { /* insert conntrack helper private data (expect) here */ + struct ip_ct_h225_expect exp_h225_info; struct ip_ct_pptp_expect exp_pptp_info; struct ip_ct_sip_expect exp_sip_info; struct ip_ct_mms_expect exp_mms_info; - struct ip_ct_h225_expect exp_h225_info; struct ip_ct_ftp_expect exp_ftp_info; struct ip_ct_irc_expect exp_irc_info; struct ip_autofw_expect exp_autofw_info; -#ifdef CONFIG_IP_NF_NAT_RTSP - struct ip_ct_rtsp_expect exp_rtsp_info; -#endif + struct ip_ct_rtsp_expect exp_rtsp_info; + #ifdef CONFIG_IP_NF_NAT_NEEDED union { /* insert nat helper private data (expect) here */ @@ -97,15 +98,13 @@ union ip_conntrack_expect_help { /* per conntrack: application helper private data */ union ip_conntrack_help { /* insert conntrack helper private data (master) here */ + struct ip_ct_h225_master ct_h225_info; struct ip_ct_pptp_master ct_pptp_info; struct ip_ct_sip_master ct_sip_info; struct ip_ct_mms_master ct_mms_info; - struct ip_ct_h225_master ct_h225_info; struct ip_ct_ftp_master ct_ftp_info; struct ip_ct_irc_master ct_irc_info; -#ifdef CONFIG_IP_NF_NAT_RTSP - struct ip_ct_rtsp_master ct_rtsp_info; -#endif + struct ip_ct_rtsp_master ct_rtsp_info; }; #ifdef CONFIG_IP_NF_NAT_NEEDED @@ -188,7 +187,7 @@ struct ip_conntrack struct ip_conntrack_tuple_hash tuplehash[IP_CT_DIR_MAX]; /* Have we seen traffic both ways yet? (bitset) */ - volatile unsigned long status; + unsigned long status; /* Timer function; drops refcnt when it goes off. */ struct timer_list timeout; @@ -227,6 +226,29 @@ struct ip_conntrack } nat; #endif /* CONFIG_IP_NF_NAT_NEEDED */ +#if defined(CONFIG_IP_NF_CONNTRACK_MARK) + unsigned long mark; +#endif + +#if defined(CONFIG_IP_NF_MATCH_LAYER7) || defined(CONFIG_IP_NF_MATCH_LAYER7_MODULE) + struct { + unsigned int numpackets; /* surely this is kept track of somewhere else, right? I can't find it... */ + char * app_proto; /* "http", "ftp", etc. NULL if unclassifed */ + + /* the application layer data so far. NULL if ->numpackets > numpackets */ + char * app_data; + + unsigned int app_data_len; + } layer7; +#endif + +#if defined(CONFIG_IP_NF_TARGET_BCOUNT) || defined(CONFIG_IP_NF_TARGET_BCOUNT_MODULE) + u_int32_t bcount; +#endif + +#if defined(CONFIG_IP_NF_TARGET_MACSAVE) || defined(CONFIG_IP_NF_TARGET_MACSAVE_MODULE) + unsigned char macsave[6]; +#endif }; /* get master conntrack via master expectation */ @@ -283,7 +305,7 @@ ip_ct_selective_cleanup(int (*kill)(const struct ip_conntrack *i, void *data), /* It's confirmed if it is, or has been in the hash table. */ static inline int is_confirmed(struct ip_conntrack *ct) { - return ct->tuplehash[IP_CT_DIR_ORIGINAL].list.next != NULL; + return test_bit(IPS_CONFIRMED_BIT, &ct->status); } extern unsigned int ip_conntrack_htable_size; diff --git a/release/src/linux/linux/include/linux/netfilter_ipv4/ip_conntrack_h323.h b/release/src/linux/linux/include/linux/netfilter_ipv4/ip_conntrack_h323.h index 10221fe9..3803c126 100644 --- a/release/src/linux/linux/include/linux/netfilter_ipv4/ip_conntrack_h323.h +++ b/release/src/linux/linux/include/linux/netfilter_ipv4/ip_conntrack_h323.h @@ -4,6 +4,7 @@ #ifdef __KERNEL__ /* Protects H.323 related data */ +#include DECLARE_LOCK_EXTERN(ip_h323_lock); #endif diff --git a/release/src/linux/linux/include/linux/netfilter_ipv4/ip_conntrack_proto_esp.h b/release/src/linux/linux/include/linux/netfilter_ipv4/ip_conntrack_proto_esp.h old mode 100755 new mode 100644 diff --git a/release/src/linux/linux/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h b/release/src/linux/linux/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h index 738e99a2..07646857 100644 --- a/release/src/linux/linux/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h +++ b/release/src/linux/linux/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h @@ -77,13 +77,13 @@ struct ip_ct_gre_expect { }; #ifdef __KERNEL__ +struct ip_conntrack_expect; /* structure for original <-> reply keymap */ struct ip_ct_gre_keymap { struct list_head list; struct ip_conntrack_tuple tuple; - struct ip_conntrack_expect *master; }; @@ -96,6 +96,8 @@ int ip_ct_gre_keymap_add(struct ip_conntrack_expect *exp, void ip_ct_gre_keymap_change(struct ip_ct_gre_keymap *km, struct ip_conntrack_tuple *t); +/* delete keymap entries */ +void ip_ct_gre_keymap_destroy(struct ip_conntrack_expect *exp); /* get pointer to gre key, if present */ diff --git a/release/src/linux/linux/include/linux/netfilter_ipv4/ip_conntrack_tuple.h b/release/src/linux/linux/include/linux/netfilter_ipv4/ip_conntrack_tuple.h index 770935d3..0f103d35 100644 --- a/release/src/linux/linux/include/linux/netfilter_ipv4/ip_conntrack_tuple.h +++ b/release/src/linux/linux/include/linux/netfilter_ipv4/ip_conntrack_tuple.h @@ -57,7 +57,6 @@ struct ip_conntrack_tuple } tcp; struct { u_int16_t port; - unsigned int init_cookie;//xiaoqin add for multi-ipsec passthrough,2005.12.19 } udp; struct { u_int8_t type, code; diff --git a/release/src/linux/linux/include/linux/netfilter_ipv4/ip_tables.h b/release/src/linux/linux/include/linux/netfilter_ipv4/ip_tables.h index d2a7f4b4..11e0cfcf 100644 --- a/release/src/linux/linux/include/linux/netfilter_ipv4/ip_tables.h +++ b/release/src/linux/linux/include/linux/netfilter_ipv4/ip_tables.h @@ -104,7 +104,8 @@ struct ipt_counters /* Values for "flag" field in struct ipt_ip (general ip structure). */ #define IPT_F_FRAG 0x01 /* Set if rule is a fragment rule */ -#define IPT_F_MASK 0x01 /* All possible flag bits mask. */ +#define IPT_F_GOTO 0x02 /* Set if jump is a goto */ +#define IPT_F_MASK 0x03 /* All possible flag bits mask. */ /* Values for "inv" field in struct ipt_ip. */ #define IPT_INV_VIA_IN 0x01 /* Invert the sense of IN IFACE. */ diff --git a/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_BCOUNT.h b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_BCOUNT.h new file mode 100644 index 00000000..34b56aef --- /dev/null +++ b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_BCOUNT.h @@ -0,0 +1,16 @@ +/* + + BCOUNT target + Copyright (C) 2006 Jonathan Zarate + + Licensed under GNU GPL v2 or later. + +*/ +#ifndef _IPT_BCOUNT_TARGET_H +#define _IPT_BCOUNT_TARGET_H + +struct ipt_BCOUNT_target { +// int debug; +}; + +#endif diff --git a/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_CLASSIFY.h b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_CLASSIFY.h new file mode 100644 index 00000000..7596e3dd --- /dev/null +++ b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_CLASSIFY.h @@ -0,0 +1,8 @@ +#ifndef _IPT_CLASSIFY_H +#define _IPT_CLASSIFY_H + +struct ipt_classify_target_info { + u_int32_t priority; +}; + +#endif /*_IPT_CLASSIFY_H */ diff --git a/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_CONNMARK.h b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_CONNMARK.h new file mode 100644 index 00000000..f9099f92 --- /dev/null +++ b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_CONNMARK.h @@ -0,0 +1,26 @@ +#ifndef _IPT_CONNMARK_H_target +#define _IPT_CONNMARK_H_target + +/* Copyright (C) 2002,2004 MARA Systems AB + * by Henrik Nordstrom + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +enum { + IPT_CONNMARK_SET = 0, + IPT_CONNMARK_SAVE, + IPT_CONNMARK_RESTORE, + IPT_CONNMARK_SET_RETURN +}; + +struct ipt_connmark_target_info { + unsigned long mark; + unsigned long mask; + u_int8_t mode; +}; + +#endif /*_IPT_CONNMARK_H_target*/ diff --git a/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_IMQ.h b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_IMQ.h new file mode 100644 index 00000000..45d57713 --- /dev/null +++ b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_IMQ.h @@ -0,0 +1,8 @@ +#ifndef _IPT_IMQ_H +#define _IPT_IMQ_H + +struct ipt_imq_info { + unsigned int todev; /* target imq device */ +}; + +#endif /* _IPT_IMQ_H */ diff --git a/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_MACSAVE.h b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_MACSAVE.h new file mode 100644 index 00000000..dc426893 --- /dev/null +++ b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_MACSAVE.h @@ -0,0 +1,16 @@ +/* + + MACSAVE target + Copyright (C) 2006 Jonathan Zarate + + Licensed under GNU GPL v2 or later. + +*/ +#ifndef _IPT_MACSAVE_TARGET_H +#define _IPT_MACSAVE_TARGET_H + +struct ipt_MACSAVE_target_info { +// int debug; +}; + +#endif diff --git a/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_ROUTE.h b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_ROUTE.h new file mode 100644 index 00000000..41b1a9c8 --- /dev/null +++ b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_ROUTE.h @@ -0,0 +1,23 @@ +/* Header file for iptables ipt_ROUTE target + * + * (C) 2002 by Cédric de Launois + * + * This software is distributed under GNU GPL v2, 1991 + */ +#ifndef _IPT_ROUTE_H_target +#define _IPT_ROUTE_H_target + +#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; +}; + +/* Values for "flags" field */ +#define IPT_ROUTE_CONTINUE 0x01 +#define IPT_ROUTE_TEE 0x02 + +#endif /*_IPT_ROUTE_H_target*/ diff --git a/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_TTL.h b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_TTL.h new file mode 100644 index 00000000..edf49e80 --- /dev/null +++ b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_TTL.h @@ -0,0 +1,21 @@ +/* TTL modification module for IP tables + * (C) 2000 by Harald Welte */ + +#ifndef _IPT_TTL_H +#define _IPT_TTL_H + +enum { + IPT_TTL_SET = 0, + IPT_TTL_INC, + IPT_TTL_DEC +}; + +#define IPT_TTL_MAXMODE IPT_TTL_DEC + +struct ipt_TTL_info { + u_int8_t mode; + u_int8_t ttl; +}; + + +#endif diff --git a/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_account.h b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_account.h new file mode 100644 index 00000000..6068d86d --- /dev/null +++ b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_account.h @@ -0,0 +1,26 @@ +/* + * accounting match (ipt_account.c) + * (C) 2003,2004 by Piotr Gasidlo (quaker@barbara.eu.org) + * + * Version: 0.1.7 + * + * This software is distributed under the terms of GNU GPL + */ + +#ifndef _IPT_ACCOUNT_H_ +#define _IPT_ACCOUNT_H_ + +#define IPT_ACCOUNT_NAME_LEN 64 + +#define IPT_ACCOUNT_NAME "ipt_account" +#define IPT_ACCOUNT_VERSION "0.1.7" + +struct t_ipt_account_info { + char name[IPT_ACCOUNT_NAME_LEN]; + u_int32_t network; + u_int32_t netmask; + int shortlisting:1; +}; + +#endif + diff --git a/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_bcount.h b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_bcount.h new file mode 100644 index 00000000..66f5ed9c --- /dev/null +++ b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_bcount.h @@ -0,0 +1,18 @@ +/* + + bcount match (experimental) + Copyright (C) 2006 Jonathan Zarate + + Licensed under GNU GPL v2 or later. + +*/ +#ifndef _IPT_BCOUNT_H +#define _IPT_BCOUNT_H + +struct ipt_bcount_match { + u_int32_t min; + u_int32_t max; + int invert; +}; + +#endif diff --git a/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_condition.h b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_condition.h new file mode 100644 index 00000000..2bc5b0c8 --- /dev/null +++ b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_condition.h @@ -0,0 +1,11 @@ +#ifndef __IPT_CONDITION_MATCH__ +#define __IPT_CONDITION_MATCH__ + +#define CONDITION_NAME_LEN 32 + +struct condition_info { + char name[CONDITION_NAME_LEN]; + int invert; +}; + +#endif diff --git a/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_connlimit.h b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_connlimit.h new file mode 100644 index 00000000..d99193b7 --- /dev/null +++ b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_connlimit.h @@ -0,0 +1,12 @@ +#ifndef _IPT_CONNLIMIT_H +#define _IPT_CONNLIMIT_H + +struct ipt_connlimit_data; + +struct ipt_connlimit_info { + int limit; + int inverse; + u_int32_t mask; + struct ipt_connlimit_data *data; +}; +#endif /* _IPT_CONNLIMIT_H */ diff --git a/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_connmark.h b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_connmark.h new file mode 100644 index 00000000..46573270 --- /dev/null +++ b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_connmark.h @@ -0,0 +1,18 @@ +#ifndef _IPT_CONNMARK_H +#define _IPT_CONNMARK_H + +/* Copyright (C) 2002,2004 MARA Systems AB + * by Henrik Nordstrom + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +struct ipt_connmark_info { + unsigned long mark, mask; + u_int8_t invert; +}; + +#endif /*_IPT_CONNMARK_H*/ diff --git a/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_exp.h b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_exp.h new file mode 100644 index 00000000..51319cb2 --- /dev/null +++ b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_exp.h @@ -0,0 +1,15 @@ +/* + + Experimental Netfilter Crap + Copyright (C) 2006 Jonathan Zarate + +*/ + +#ifndef _IPT_EXP_H +#define _IPT_EXP_H + +struct ipt_exp_info { + char dummy; +}; + +#endif diff --git a/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_geoip.h b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_geoip.h new file mode 100644 index 00000000..15764e8b --- /dev/null +++ b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_geoip.h @@ -0,0 +1,51 @@ +/* ipt_geoip.h header file for libipt_geoip.c and ipt_geoip.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Copyright (c) 2004 Cookinglinux + */ +#ifndef _IPT_GEOIP_H +#define _IPT_GEOIP_H + +#define IPT_GEOIP_SRC 0x01 /* Perform check on Source IP */ +#define IPT_GEOIP_DST 0x02 /* Perform check on Destination IP */ +#define IPT_GEOIP_INV 0x04 /* Negate the condition */ + +#define IPT_GEOIP_MAX 15 /* Maximum of countries */ + +struct geoip_subnet { + u_int32_t begin; + u_int32_t end; +}; + +struct geoip_info { + struct geoip_subnet *subnets; + u_int32_t count; + u_int32_t ref; + u_int16_t cc; + struct geoip_info *next; + struct geoip_info *prev; +}; + +struct ipt_geoip_info { + u_int8_t flags; + u_int8_t count; + u_int16_t cc[IPT_GEOIP_MAX]; + + /* Used internally by the kernel */ + struct geoip_info *mem[IPT_GEOIP_MAX]; + u_int8_t *refcount; + + /* not implemented yet: + void *fini; + */ +}; + +#define COUNTRY(cc) (cc >> 8), (cc & 0x00FF) + +#endif + +/* End of ipt_geoip.h */ diff --git a/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_ipp2p.h b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_ipp2p.h new file mode 100644 index 00000000..1bd3f649 --- /dev/null +++ b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_ipp2p.h @@ -0,0 +1,31 @@ +#ifndef __IPT_IPP2P_H +#define __IPT_IPP2P_H +#define IPP2P_VERSION "0.8.1_rc1" + +struct ipt_p2p_info { + int cmd; + int debug; +}; + +#endif //__IPT_IPP2P_H + +#define SHORT_HAND_IPP2P 1 /* --ipp2p switch*/ +//#define SHORT_HAND_DATA 4 /* --ipp2p-data switch*/ +#define SHORT_HAND_NONE 5 /* no short hand*/ + +#define IPP2P_EDK (1 << 1) +#define IPP2P_DATA_KAZAA (1 << 2) +#define IPP2P_DATA_EDK (1 << 3) +#define IPP2P_DATA_DC (1 << 4) +#define IPP2P_DC (1 << 5) +#define IPP2P_DATA_GNU (1 << 6) +#define IPP2P_GNU (1 << 7) +#define IPP2P_KAZAA (1 << 8) +#define IPP2P_BIT (1 << 9) +#define IPP2P_APPLE (1 << 10) +#define IPP2P_SOUL (1 << 11) +#define IPP2P_WINMX (1 << 12) +#define IPP2P_ARES (1 << 13) +#define IPP2P_MUTE (1 << 14) +#define IPP2P_WASTE (1 << 15) +#define IPP2P_XDCC (1 << 16) diff --git a/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_iprange.h b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_iprange.h new file mode 100644 index 00000000..3ecb3bd6 --- /dev/null +++ b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_iprange.h @@ -0,0 +1,23 @@ +#ifndef _IPT_IPRANGE_H +#define _IPT_IPRANGE_H + +#define IPRANGE_SRC 0x01 /* Match source IP address */ +#define IPRANGE_DST 0x02 /* Match destination IP address */ +#define IPRANGE_SRC_INV 0x10 /* Negate the condition */ +#define IPRANGE_DST_INV 0x20 /* Negate the condition */ + +struct ipt_iprange { + /* Inclusive: network order. */ + u_int32_t min_ip, max_ip; +}; + +struct ipt_iprange_info +{ + struct ipt_iprange src; + struct ipt_iprange dst; + + /* Flags from above */ + u_int8_t flags; +}; + +#endif /* _IPT_IPRANGE_H */ diff --git a/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_layer7.h b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_layer7.h new file mode 100644 index 00000000..aee1f5d5 --- /dev/null +++ b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_layer7.h @@ -0,0 +1,26 @@ +/* + By Matthew Strait , Dec 2003. + http://l7-filter.sf.net + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version + 2 of the License, or (at your option) any later version. + http://www.gnu.org/licenses/gpl.txt +*/ + +#ifndef _IPT_LAYER7_H +#define _IPT_LAYER7_H + +#define MAX_PATTERN_LEN 8192 +#define MAX_PROTOCOL_LEN 256 + +typedef char *(*proc_ipt_search) (char *, char, char *); + +struct ipt_layer7_info { + char protocol[MAX_PROTOCOL_LEN]; + char invert:1; + char pattern[MAX_PATTERN_LEN]; +}; + +#endif /* _IPT_LAYER7_H */ diff --git a/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_macsave.h b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_macsave.h new file mode 100644 index 00000000..9d5b218d --- /dev/null +++ b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_macsave.h @@ -0,0 +1,17 @@ +/* + + macsave match + Copyright (C) 2006 Jonathan Zarate + + Licensed under GNU GPL v2 or later. + +*/ +#ifndef _IPT_MACSAVE_MATCH_H +#define _IPT_MACSAVE_MATCH_H + +struct ipt_macsave_match_info { + int invert; + unsigned char mac[6]; +}; + +#endif diff --git a/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_quota.h b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_quota.h new file mode 100644 index 00000000..f2a06716 --- /dev/null +++ b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_quota.h @@ -0,0 +1,12 @@ +#ifndef _IPT_QUOTA_H +#define _IPT_QUOTA_H + +/* print debug info in both kernel/netfilter module & iptable library */ +//#define DEBUG_IPT_QUOTA + +struct ipt_quota_info { + u_int64_t quota; + struct ipt_quota_info *master; +}; + +#endif /*_IPT_QUOTA_H*/ diff --git a/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_recent.h b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_recent.h new file mode 100644 index 00000000..eb008fb4 --- /dev/null +++ b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_recent.h @@ -0,0 +1,28 @@ +#ifndef _IPT_RECENT_H +#define _IPT_RECENT_H + +#define RECENT_NAME "ipt_recent" +#define RECENT_VER "v0.3.1" + +#define IPT_RECENT_CHECK 1 +#define IPT_RECENT_SET 2 +#define IPT_RECENT_UPDATE 4 +#define IPT_RECENT_REMOVE 8 +#define IPT_RECENT_TTL 16 + +#define IPT_RECENT_SOURCE 0 +#define IPT_RECENT_DEST 1 + +#define IPT_RECENT_NAME_LEN 200 + +struct ipt_recent_info { + u_int32_t seconds; + u_int32_t hit_count; + u_int8_t check_set; + u_int8_t invert; + char name[IPT_RECENT_NAME_LEN]; + u_int8_t side; +}; + +#endif /*_IPT_RECENT_H*/ + diff --git a/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_string.h b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_string.h new file mode 100644 index 00000000..17d71034 --- /dev/null +++ b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_string.h @@ -0,0 +1,21 @@ +#ifndef _IPT_STRING_H +#define _IPT_STRING_H + +/* *** PERFORMANCE TWEAK *** + * Packet size and search string threshold, + * above which sublinear searches is used. */ +#define IPT_STRING_HAYSTACK_THRESH 100 +#define IPT_STRING_NEEDLE_THRESH 20 + +#define BM_MAX_NLEN 256 +#define BM_MAX_HLEN 1024 + +typedef char *(*proc_ipt_search) (char *, char *, int, int); + +struct ipt_string_info { + char string[BM_MAX_NLEN]; + u_int16_t invert; + u_int16_t len; +}; + +#endif /* _IPT_STRING_H */ diff --git a/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_time.h b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_time.h index 1ccdbb3d..277c6de5 100644 --- a/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_time.h +++ b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_time.h @@ -3,10 +3,12 @@ struct ipt_time_info { - unsigned int days_match; /* 1 bit per day (bit 0 = Sunday) */ - unsigned int time_start; /* 0 < time_start < 24*60*60-1 = 86399 */ - unsigned int time_stop; /* 0 < time_end < 24*60*60-1 = 86399 */ - int kerneltime; /* ignore skb time (and use kerneltime) or not. */ + u_int8_t days_match; /* 1 bit per day. -SMTWTFS */ + u_int16_t time_start; /* 0 < time_start < 23*60+59 = 1439 */ + u_int16_t time_stop; /* 0:0 < time_stat < 23:59 */ + u_int8_t kerneltime; /* ignore skb time (and use kerneltime) or not. */ + time_t date_start; + time_t date_stop; }; diff --git a/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_u32.h b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_u32.h new file mode 100644 index 00000000..694fdc08 --- /dev/null +++ b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_u32.h @@ -0,0 +1,40 @@ +#ifndef _IPT_U32_H +#define _IPT_U32_H +#include + +enum ipt_u32_ops +{ + IPT_U32_AND, + IPT_U32_LEFTSH, + IPT_U32_RIGHTSH, + IPT_U32_AT +}; + +struct ipt_u32_location_element +{ + u_int32_t number; + u_int8_t nextop; +}; +struct ipt_u32_value_element +{ + u_int32_t min; + u_int32_t max; +}; +/* *** any way to allow for an arbitrary number of elements? + for now I settle for a limit of 10 of each */ +#define U32MAXSIZE 10 +struct ipt_u32_test +{ + u_int8_t nnums; + struct ipt_u32_location_element location[U32MAXSIZE+1]; + u_int8_t nvalues; + struct ipt_u32_value_element value[U32MAXSIZE+1]; +}; + +struct ipt_u32 +{ + u_int8_t ntests; + struct ipt_u32_test tests[U32MAXSIZE+1]; +}; + +#endif /*_IPT_U32_H*/ diff --git a/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_web.h b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_web.h new file mode 100644 index 00000000..176208e2 --- /dev/null +++ b/release/src/linux/linux/include/linux/netfilter_ipv4/ipt_web.h @@ -0,0 +1,30 @@ +/* + + web (experimental) + HTTP client match + Copyright (C) 2006 Jonathan Zarate + + Licensed under GNU GPL v2 or later. + +*/ +#ifndef _IPT_WEB_H +#define _IPT_WEB_H + +#define IPT_WEB_MAXTEXT 512 + +typedef enum { + IPT_WEB_HTTP, + IPT_WEB_RURI, + IPT_WEB_PATH, + IPT_WEB_QUERY, + IPT_WEB_HOST, + IPT_WEB_HORE +} ipt_web_mode_t; + +struct ipt_web_info { + ipt_web_mode_t mode; + int invert; + char text[IPT_WEB_MAXTEXT]; +}; + +#endif diff --git a/release/src/linux/linux/include/linux/netfilter_ipv6/ip6t_IMQ.h b/release/src/linux/linux/include/linux/netfilter_ipv6/ip6t_IMQ.h new file mode 100644 index 00000000..4eefa612 --- /dev/null +++ b/release/src/linux/linux/include/linux/netfilter_ipv6/ip6t_IMQ.h @@ -0,0 +1,8 @@ +#ifndef _IP6T_IMQ_H +#define _IP6T_IMQ_H + +struct ip6t_imq_info { + unsigned int todev; /* target imq device */ +}; + +#endif /* _IP6T_IMQ_H */ diff --git a/release/src/linux/linux/include/linux/netfilter_ipv6/ip6t_ROUTE.h b/release/src/linux/linux/include/linux/netfilter_ipv6/ip6t_ROUTE.h new file mode 100644 index 00000000..c5ec871b --- /dev/null +++ b/release/src/linux/linux/include/linux/netfilter_ipv6/ip6t_ROUTE.h @@ -0,0 +1,23 @@ +/* Header file for iptables ip6t_ROUTE target + * + * (C) 2003 by Cédric de Launois + * + * This software is distributed under GNU GPL v2, 1991 + */ +#ifndef _IPT_ROUTE_H_target +#define _IPT_ROUTE_H_target + +#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; +}; + +/* Values for "flags" field */ +#define IP6T_ROUTE_CONTINUE 0x01 +#define IP6T_ROUTE_TEE 0x02 + +#endif /*_IP6T_ROUTE_H_target*/ diff --git a/release/src/linux/linux/include/linux/netfilter_ipv6/ip6t_condition.h b/release/src/linux/linux/include/linux/netfilter_ipv6/ip6t_condition.h new file mode 100644 index 00000000..164ff86e --- /dev/null +++ b/release/src/linux/linux/include/linux/netfilter_ipv6/ip6t_condition.h @@ -0,0 +1,11 @@ +#ifndef __IP6T_CONDITION_MATCH__ +#define __IP6T_CONDITION_MATCH__ + +#define CONDITION6_NAME_LEN 32 + +struct condition6_info { + char name[CONDITION6_NAME_LEN]; + int invert; +}; + +#endif diff --git a/release/src/linux/linux/include/linux/pkt_sched.h b/release/src/linux/linux/include/linux/pkt_sched.h index fec8ad62..331feebf 100644 --- a/release/src/linux/linux/include/linux/pkt_sched.h +++ b/release/src/linux/linux/include/linux/pkt_sched.h @@ -173,8 +173,36 @@ struct tc_sfq_qopt * * The only reason for this is efficiency, it is possible * to change these parameters in compile time. + * + * If you need to play with these values use esfq instead. */ +/* ESFQ section */ + +enum +{ + /* traditional */ + TCA_SFQ_HASH_CLASSIC, + TCA_SFQ_HASH_DST, + TCA_SFQ_HASH_SRC, + TCA_SFQ_HASH_FWMARK, + /* direct */ + TCA_SFQ_HASH_DSTDIR, + TCA_SFQ_HASH_SRCDIR, + TCA_SFQ_HASH_FWMARKDIR, +}; + +struct tc_esfq_qopt +{ + unsigned quantum; /* Bytes per round allocated to flow */ + int perturb_period; /* Period of hash perturbation */ + __u32 limit; /* Maximal packets in queue */ + unsigned divisor; /* Hash divisor */ + unsigned flows; /* Maximal number of flows */ + unsigned hash_kind; /* Hash function to use for flow identification */ +}; + + /* RED section */ enum @@ -290,6 +318,37 @@ struct tc_htb_xstats __u32 ctokens; }; +/* HFSC section */ + +struct tc_hfsc_qopt +{ + __u16 defcls; /* default class */ +}; + +struct tc_service_curve +{ + __u32 m1; /* slope of the first segment in bps */ + __u32 d; /* x-projection of the first segment in us */ + __u32 m2; /* slope of the second segment in bps */ +}; + +struct tc_hfsc_stats +{ + __u64 work; /* total work done */ + __u64 rtwork; /* work done by real-time criteria */ + __u32 period; /* current period */ + __u32 level; /* class level in hierarchy */ +}; + +enum +{ + TCA_HFSC_UNSPEC, + TCA_HFSC_RSC, + TCA_HFSC_FSC, + TCA_HFSC_USC, + TCA_HFSC_MAX = TCA_HFSC_USC +}; + /* CBQ section */ #define TC_CBQ_MAXPRIO 8 diff --git a/release/src/linux/linux/include/linux/rbtree.h b/release/src/linux/linux/include/linux/rbtree.h index 96f20e14..d7ba5df4 100644 --- a/release/src/linux/linux/include/linux/rbtree.h +++ b/release/src/linux/linux/include/linux/rbtree.h @@ -121,6 +121,12 @@ rb_root_t; extern void rb_insert_color(rb_node_t *, rb_root_t *); extern void rb_erase(rb_node_t *, rb_root_t *); +/* Find logical next and previous nodes in a tree */ +extern rb_node_t *rb_next(rb_node_t *); +extern rb_node_t *rb_prev(rb_node_t *); +extern rb_node_t *rb_first(rb_root_t *); +extern rb_node_t *rb_last(rb_root_t *); + static inline void rb_link_node(rb_node_t * node, rb_node_t * parent, rb_node_t ** rb_link) { node->rb_parent = parent; diff --git a/release/src/linux/linux/include/linux/skbuff.h b/release/src/linux/linux/include/linux/skbuff.h index 7529ded2..c39889d6 100644 --- a/release/src/linux/linux/include/linux/skbuff.h +++ b/release/src/linux/linux/include/linux/skbuff.h @@ -93,6 +93,9 @@ struct nf_ct_info { struct nf_conntrack *master; }; #endif +#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) +struct nf_info; +#endif struct sk_buff_head { /* These two members must be first. */ @@ -178,7 +181,7 @@ struct sk_buff { unsigned int len; /* Length of actual data */ unsigned int data_len; unsigned int csum; /* Checksum */ - unsigned char __unused, /* Dead field, may be reused */ + unsigned char imq_flags, /* intermediate queueing device */ cloned, /* head may be cloned (check refcnt to be sure). */ pkt_type, /* Packet class */ ip_summed; /* Driver fed us an IP checksum */ @@ -215,6 +218,9 @@ struct sk_buff { #ifdef CONFIG_NET_SCHED __u32 tc_index; /* traffic control index */ #endif +#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) + struct nf_info *nf_info; +#endif }; #define SK_WMEM_MAX 65535 diff --git a/release/src/linux/linux/include/linux/squashfs_fs.h b/release/src/linux/linux/include/linux/squashfs_fs.h index d810c596..5c79e38b 100644 --- a/release/src/linux/linux/include/linux/squashfs_fs.h +++ b/release/src/linux/linux/include/linux/squashfs_fs.h @@ -1,9 +1,11 @@ #ifndef SQUASHFS_FS #define SQUASHFS_FS + /* * Squashfs * - * Copyright (c) 2002, 2003, 2004 Phillip Lougher + * Copyright (c) 2002, 2003, 2004, 2005, 2006 + * Phillip Lougher * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -22,7 +24,23 @@ * squashfs_fs.h */ -#define SQUASHFS_MAJOR 2 +#ifndef CONFIG_SQUASHFS_2_0_COMPATIBILITY +#define CONFIG_SQUASHFS_2_0_COMPATIBILITY +#endif + +#ifdef CONFIG_SQUASHFS_VMALLOC +#define SQUASHFS_ALLOC(a) vmalloc(a) +#define SQUASHFS_FREE(a) vfree(a) +#else +#define SQUASHFS_ALLOC(a) kmalloc(a, GFP_KERNEL) +#define SQUASHFS_FREE(a) kfree(a) +#endif +#ifdef CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE +#define SQUASHFS_CACHED_FRAGMENTS CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE +#else +#define SQUASHFS_CACHED_FRAGMENTS 3 +#endif +#define SQUASHFS_MAJOR 3 #define SQUASHFS_MINOR 0 #define SQUASHFS_MAGIC 0x73717368 #define SQUASHFS_MAGIC_SWAP 0x68737173 @@ -46,8 +64,9 @@ #define SQUASHFS_NAME_LEN 256 #define SQUASHFS_INVALID ((long long) 0xffffffffffff) -#define SQUASHFS_INVALID_BLK ((long long) 0xffffffff) -#define SQUASHFS_USED_BLK ((long long) 0xfffffffe) +#define SQUASHFS_INVALID_FRAG ((unsigned int) 0xffffffff) +#define SQUASHFS_INVALID_BLK ((long long) -1) +#define SQUASHFS_USED_BLK ((long long) -2) /* Filesystem flags */ #define SQUASHFS_NOI 0 @@ -57,15 +76,34 @@ #define SQUASHFS_NO_FRAG 4 #define SQUASHFS_ALWAYS_FRAG 5 #define SQUASHFS_DUPLICATE 6 + #define SQUASHFS_BIT(flag, bit) ((flag >> bit) & 1) -#define SQUASHFS_UNCOMPRESSED_INODES(flags) SQUASHFS_BIT(flags, SQUASHFS_NOI) -#define SQUASHFS_UNCOMPRESSED_DATA(flags) SQUASHFS_BIT(flags, SQUASHFS_NOD) -#define SQUASHFS_UNCOMPRESSED_FRAGMENTS(flags) SQUASHFS_BIT(flags, SQUASHFS_NOF) -#define SQUASHFS_NO_FRAGMENTS(flags) SQUASHFS_BIT(flags, SQUASHFS_NO_FRAG) -#define SQUASHFS_ALWAYS_FRAGMENTS(flags) SQUASHFS_BIT(flags, SQUASHFS_ALWAYS_FRAG) -#define SQUASHFS_DUPLICATES(flags) SQUASHFS_BIT(flags, SQUASHFS_DUPLICATE) -#define SQUASHFS_CHECK_DATA(flags) SQUASHFS_BIT(flags, SQUASHFS_CHECK) -#define SQUASHFS_MKFLAGS(noi, nod, check_data, nof, no_frag, always_frag, duplicate_checking) (noi | (nod << 1) | (check_data << 2) | (nof << 3) | (no_frag << 4) | (always_frag << 5) | (duplicate_checking << 6)) + +#define SQUASHFS_UNCOMPRESSED_INODES(flags) SQUASHFS_BIT(flags, \ + SQUASHFS_NOI) + +#define SQUASHFS_UNCOMPRESSED_DATA(flags) SQUASHFS_BIT(flags, \ + SQUASHFS_NOD) + +#define SQUASHFS_UNCOMPRESSED_FRAGMENTS(flags) SQUASHFS_BIT(flags, \ + SQUASHFS_NOF) + +#define SQUASHFS_NO_FRAGMENTS(flags) SQUASHFS_BIT(flags, \ + SQUASHFS_NO_FRAG) + +#define SQUASHFS_ALWAYS_FRAGMENTS(flags) SQUASHFS_BIT(flags, \ + SQUASHFS_ALWAYS_FRAG) + +#define SQUASHFS_DUPLICATES(flags) SQUASHFS_BIT(flags, \ + SQUASHFS_DUPLICATE) + +#define SQUASHFS_CHECK_DATA(flags) SQUASHFS_BIT(flags, \ + SQUASHFS_CHECK) + +#define SQUASHFS_MKFLAGS(noi, nod, check_data, nof, no_frag, always_frag, \ + duplicate_checking) (noi | (nod << 1) | (check_data << 2) \ + | (nof << 3) | (no_frag << 4) | (always_frag << 5) | \ + (duplicate_checking << 6)) /* Max number of types and file types */ #define SQUASHFS_DIR_TYPE 1 @@ -75,73 +113,114 @@ #define SQUASHFS_CHRDEV_TYPE 5 #define SQUASHFS_FIFO_TYPE 6 #define SQUASHFS_SOCKET_TYPE 7 +#define SQUASHFS_LDIR_TYPE 8 +#define SQUASHFS_LREG_TYPE 9 /* 1.0 filesystem type definitions */ #define SQUASHFS_TYPES 5 #define SQUASHFS_IPC_TYPE 0 -/* Flag whether block is compressed or uncompressed, bit is set if block is uncompressed */ +/* Flag whether block is compressed or uncompressed, bit is set if block is + * uncompressed */ #define SQUASHFS_COMPRESSED_BIT (1 << 15) + #define SQUASHFS_COMPRESSED_SIZE(B) (((B) & ~SQUASHFS_COMPRESSED_BIT) ? \ - (B) & ~SQUASHFS_COMPRESSED_BIT : SQUASHFS_COMPRESSED_BIT) + (B) & ~SQUASHFS_COMPRESSED_BIT : SQUASHFS_COMPRESSED_BIT) #define SQUASHFS_COMPRESSED(B) (!((B) & SQUASHFS_COMPRESSED_BIT)) #define SQUASHFS_COMPRESSED_BIT_BLOCK (1 << 24) -#define SQUASHFS_COMPRESSED_SIZE_BLOCK(B) (((B) & ~SQUASHFS_COMPRESSED_BIT_BLOCK) ? \ - (B) & ~SQUASHFS_COMPRESSED_BIT_BLOCK : SQUASHFS_COMPRESSED_BIT_BLOCK) -#define SQUASHFS_COMPRESSED_BLOCK(B) (!((B) & SQUASHFS_COMPRESSED_BIT_BLOCK)) +#define SQUASHFS_COMPRESSED_SIZE_BLOCK(B) (((B) & \ + ~SQUASHFS_COMPRESSED_BIT_BLOCK) ? (B) & \ + ~SQUASHFS_COMPRESSED_BIT_BLOCK : SQUASHFS_COMPRESSED_BIT_BLOCK) + +#define SQUASHFS_COMPRESSED_BLOCK(B) (!((B) & SQUASHFS_COMPRESSED_BIT_BLOCK)) /* - * Inode number ops. Inodes consist of a compressed block number, and an uncompressed - * offset within that block + * Inode number ops. Inodes consist of a compressed block number, and an + * uncompressed offset within that block */ #define SQUASHFS_INODE_BLK(a) ((unsigned int) ((a) >> 16)) + #define SQUASHFS_INODE_OFFSET(a) ((unsigned int) ((a) & 0xffff)) -#define SQUASHFS_MKINODE(A, B) ((squashfs_inode)(((squashfs_inode) (A) << 16)\ - + (B))) + +#define SQUASHFS_MKINODE(A, B) ((squashfs_inode_t)(((squashfs_inode_t) (A)\ + << 16) + (B))) /* Compute 32 bit VFS inode number from squashfs inode number */ -#define SQUASHFS_MK_VFS_INODE(a, b) ((unsigned int) (((a) << 8) + ((b) >> 2) + 1)) +#define SQUASHFS_MK_VFS_INODE(a, b) ((unsigned int) (((a) << 8) + \ + ((b) >> 2) + 1)) +/* XXX */ /* Translate between VFS mode and squashfs mode */ #define SQUASHFS_MODE(a) ((a) & 0xfff) /* fragment and fragment table defines */ -typedef unsigned int squashfs_fragment_index; -#define SQUASHFS_FRAGMENT_BYTES(A) (A * sizeof(squashfs_fragment_entry)) -#define SQUASHFS_FRAGMENT_INDEX(A) (SQUASHFS_FRAGMENT_BYTES(A) / SQUASHFS_METADATA_SIZE) -#define SQUASHFS_FRAGMENT_INDEX_OFFSET(A) (SQUASHFS_FRAGMENT_BYTES(A) % SQUASHFS_METADATA_SIZE) -#define SQUASHFS_FRAGMENT_INDEXES(A) ((SQUASHFS_FRAGMENT_BYTES(A) + SQUASHFS_METADATA_SIZE - 1) / SQUASHFS_METADATA_SIZE) -#define SQUASHFS_FRAGMENT_INDEX_BYTES(A) (SQUASHFS_FRAGMENT_INDEXES(A) * sizeof(squashfs_fragment_index)) -#define SQUASHFS_CACHED_FRAGMENTS 3 +#define SQUASHFS_FRAGMENT_BYTES(A) (A * sizeof(struct squashfs_fragment_entry)) + +#define SQUASHFS_FRAGMENT_INDEX(A) (SQUASHFS_FRAGMENT_BYTES(A) / \ + SQUASHFS_METADATA_SIZE) + +#define SQUASHFS_FRAGMENT_INDEX_OFFSET(A) (SQUASHFS_FRAGMENT_BYTES(A) % \ + SQUASHFS_METADATA_SIZE) + +#define SQUASHFS_FRAGMENT_INDEXES(A) ((SQUASHFS_FRAGMENT_BYTES(A) + \ + SQUASHFS_METADATA_SIZE - 1) / \ + SQUASHFS_METADATA_SIZE) + +#define SQUASHFS_FRAGMENT_INDEX_BYTES(A) (SQUASHFS_FRAGMENT_INDEXES(A) *\ + sizeof(long long)) /* cached data constants for filesystem */ #define SQUASHFS_CACHED_BLKS 8 -#define SQUASHFS_MAX_FILE_SIZE_LOG 32 -#define SQUASHFS_MAX_FILE_SIZE ((long long) 1 << (SQUASHFS_MAX_FILE_SIZE_LOG - 1)) +#define SQUASHFS_MAX_FILE_SIZE_LOG 64 + +#define SQUASHFS_MAX_FILE_SIZE ((long long) 1 << \ + (SQUASHFS_MAX_FILE_SIZE_LOG - 2)) #define SQUASHFS_MARKER_BYTE 0xff +/* meta index cache */ +#define SQUASHFS_META_INDEXES (SQUASHFS_METADATA_SIZE / sizeof(unsigned int)) +#define SQUASHFS_META_ENTRIES 31 +#define SQUASHFS_META_NUMBER 8 +#define SQUASHFS_SLOTS 4 + +struct meta_entry { + long long data_block; + unsigned int index_block; + unsigned short offset; + unsigned short pad; +}; + +struct meta_index { + unsigned int inode_number; + unsigned int offset; + unsigned short entries; + unsigned short skip; + unsigned short locked; + unsigned short pad; + struct meta_entry meta_entry[SQUASHFS_META_ENTRIES]; +}; + + /* * definitions for structures on disk */ -typedef unsigned int squashfs_block; -typedef long long squashfs_inode; - -typedef unsigned int squashfs_uid; +typedef long long squashfs_block_t; +typedef long long squashfs_inode_t; -typedef struct squashfs_super_block { +struct squashfs_super_block { unsigned int s_magic; unsigned int inodes; - unsigned int bytes_used; - unsigned int uid_start; - unsigned int guid_start; - unsigned int inode_table_start; - unsigned int directory_table_start; + unsigned int bytes_used_2; + unsigned int uid_start_2; + unsigned int guid_start_2; + unsigned int inode_table_start_2; + unsigned int directory_table_start_2; unsigned int s_major:16; unsigned int s_minor:16; unsigned int block_size_1:16; @@ -150,88 +229,125 @@ typedef struct squashfs_super_block { unsigned int no_uids:8; unsigned int no_guids:8; unsigned int mkfs_time /* time of filesystem creation */; - squashfs_inode root_inode; + squashfs_inode_t root_inode; unsigned int block_size; unsigned int fragments; - unsigned int fragment_table_start; -} __attribute__ ((packed)) squashfs_super_block; - -typedef struct { - unsigned int inode_type:4; - unsigned int mode:12; /* protection */ - unsigned int uid:8; /* index into uid table */ - unsigned int guid:8; /* index into guid table */ -} __attribute__ ((packed)) squashfs_base_inode_header; - -typedef squashfs_base_inode_header squashfs_ipc_inode_header; - -typedef struct { - unsigned int inode_type:4; - unsigned int mode:12; /* protection */ - unsigned int uid:8; /* index into uid table */ - unsigned int guid:8; /* index into guid table */ + unsigned int fragment_table_start_2; + long long bytes_used; + long long uid_start; + long long guid_start; + long long inode_table_start; + long long directory_table_start; + long long fragment_table_start; + long long unused; +} __attribute__ ((packed)); + +struct squashfs_dir_index { + unsigned int index; + unsigned int start_block; + unsigned char size; + unsigned char name[0]; +} __attribute__ ((packed)); + +#define SQUASHFS_BASE_INODE_HEADER \ + unsigned int inode_type:4; \ + unsigned int mode:12; \ + unsigned int uid:8; \ + unsigned int guid:8; \ + unsigned int mtime; \ + unsigned int inode_number; + +struct squashfs_base_inode_header { + SQUASHFS_BASE_INODE_HEADER; +} __attribute__ ((packed)); + +struct squashfs_ipc_inode_header { + SQUASHFS_BASE_INODE_HEADER; + unsigned int nlink; +} __attribute__ ((packed)); + +struct squashfs_dev_inode_header { + SQUASHFS_BASE_INODE_HEADER; + unsigned int nlink; unsigned short rdev; -} __attribute__ ((packed)) squashfs_dev_inode_header; +} __attribute__ ((packed)); -typedef struct { - unsigned int inode_type:4; - unsigned int mode:12; /* protection */ - unsigned int uid:8; /* index into uid table */ - unsigned int guid:8; /* index into guid table */ +struct squashfs_symlink_inode_header { + SQUASHFS_BASE_INODE_HEADER; + unsigned int nlink; unsigned short symlink_size; char symlink[0]; -} __attribute__ ((packed)) squashfs_symlink_inode_header; +} __attribute__ ((packed)); -typedef struct { - unsigned int inode_type:4; - unsigned int mode:12; /* protection */ - unsigned int uid:8; /* index into uid table */ - unsigned int guid:8; /* index into guid table */ - unsigned int mtime; - squashfs_block start_block; +struct squashfs_reg_inode_header { + SQUASHFS_BASE_INODE_HEADER; + squashfs_block_t start_block; unsigned int fragment; unsigned int offset; - unsigned int file_size:SQUASHFS_MAX_FILE_SIZE_LOG; + unsigned int file_size; unsigned short block_list[0]; -} __attribute__ ((packed)) squashfs_reg_inode_header; +} __attribute__ ((packed)); -typedef struct { - unsigned int inode_type:4; - unsigned int mode:12; /* protection */ - unsigned int uid:8; /* index into uid table */ - unsigned int guid:8; /* index into guid table */ +struct squashfs_lreg_inode_header { + SQUASHFS_BASE_INODE_HEADER; + unsigned int nlink; + squashfs_block_t start_block; + unsigned int fragment; + unsigned int offset; + long long file_size; + unsigned short block_list[0]; +} __attribute__ ((packed)); + +struct squashfs_dir_inode_header { + SQUASHFS_BASE_INODE_HEADER; + unsigned int nlink; unsigned int file_size:19; unsigned int offset:13; - unsigned int mtime; - unsigned int start_block:24; -} __attribute__ ((packed)) squashfs_dir_inode_header; - -typedef union { - squashfs_base_inode_header base; - squashfs_dev_inode_header dev; - squashfs_symlink_inode_header symlink; - squashfs_reg_inode_header reg; - squashfs_dir_inode_header dir; - squashfs_ipc_inode_header ipc; -} squashfs_inode_header; + unsigned int start_block; + unsigned int parent_inode; +} __attribute__ ((packed)); + +struct squashfs_ldir_inode_header { + SQUASHFS_BASE_INODE_HEADER; + unsigned int nlink; + unsigned int file_size:27; + unsigned int offset:13; + unsigned int start_block; + unsigned int i_count:16; + unsigned int parent_inode; + struct squashfs_dir_index index[0]; +} __attribute__ ((packed)); + +union squashfs_inode_header { + struct squashfs_base_inode_header base; + struct squashfs_dev_inode_header dev; + struct squashfs_symlink_inode_header symlink; + struct squashfs_reg_inode_header reg; + struct squashfs_lreg_inode_header lreg; + struct squashfs_dir_inode_header dir; + struct squashfs_ldir_inode_header ldir; + struct squashfs_ipc_inode_header ipc; +}; -typedef struct { +struct squashfs_dir_entry { unsigned int offset:13; unsigned int type:3; unsigned int size:8; + int inode_number:16; char name[0]; -} __attribute__ ((packed)) squashfs_dir_entry; +} __attribute__ ((packed)); -typedef struct { +struct squashfs_dir_header { unsigned int count:8; - unsigned int start_block:24; -} __attribute__ ((packed)) squashfs_dir_header; - - -typedef struct { unsigned int start_block; + unsigned int inode_number; +} __attribute__ ((packed)); + +struct squashfs_fragment_entry { + long long start_block; unsigned int size; -} __attribute__ ((packed)) squashfs_fragment_entry; + unsigned int unused; +} __attribute__ ((packed)); extern int squashfs_uncompress_block(void *d, int dstlen, void *s, int srclen); extern int squashfs_uncompress_init(void); @@ -239,20 +355,28 @@ extern int squashfs_uncompress_exit(void); /* * macros to convert each packed bitfield structure from little endian to big - * endian and vice versa. These are needed when creating or using a filesystem on a - * machine with different byte ordering to the target architecture. + * endian and vice versa. These are needed when creating or using a filesystem + * on a machine with different byte ordering to the target architecture. * */ +#define SQUASHFS_SWAP_START \ + int bits;\ + int b_pos;\ + unsigned long long val;\ + unsigned char *s;\ + unsigned char *d; + #define SQUASHFS_SWAP_SUPER_BLOCK(s, d) {\ - SQUASHFS_MEMSET(s, d, sizeof(squashfs_super_block));\ + SQUASHFS_SWAP_START\ + SQUASHFS_MEMSET(s, d, sizeof(struct squashfs_super_block));\ SQUASHFS_SWAP((s)->s_magic, d, 0, 32);\ SQUASHFS_SWAP((s)->inodes, d, 32, 32);\ - SQUASHFS_SWAP((s)->bytes_used, d, 64, 32);\ - SQUASHFS_SWAP((s)->uid_start, d, 96, 32);\ - SQUASHFS_SWAP((s)->guid_start, d, 128, 32);\ - SQUASHFS_SWAP((s)->inode_table_start, d, 160, 32);\ - SQUASHFS_SWAP((s)->directory_table_start, d, 192, 32);\ + SQUASHFS_SWAP((s)->bytes_used_2, d, 64, 32);\ + SQUASHFS_SWAP((s)->uid_start_2, d, 96, 32);\ + SQUASHFS_SWAP((s)->guid_start_2, d, 128, 32);\ + SQUASHFS_SWAP((s)->inode_table_start_2, d, 160, 32);\ + SQUASHFS_SWAP((s)->directory_table_start_2, d, 192, 32);\ SQUASHFS_SWAP((s)->s_major, d, 224, 16);\ SQUASHFS_SWAP((s)->s_minor, d, 240, 16);\ SQUASHFS_SWAP((s)->block_size_1, d, 256, 16);\ @@ -264,137 +388,218 @@ extern int squashfs_uncompress_exit(void); SQUASHFS_SWAP((s)->root_inode, d, 344, 64);\ SQUASHFS_SWAP((s)->block_size, d, 408, 32);\ SQUASHFS_SWAP((s)->fragments, d, 440, 32);\ - SQUASHFS_SWAP((s)->fragment_table_start, d, 472, 32);\ + SQUASHFS_SWAP((s)->fragment_table_start_2, d, 472, 32);\ + SQUASHFS_SWAP((s)->bytes_used, d, 504, 64);\ + SQUASHFS_SWAP((s)->uid_start, d, 568, 64);\ + SQUASHFS_SWAP((s)->guid_start, d, 632, 64);\ + SQUASHFS_SWAP((s)->inode_table_start, d, 696, 64);\ + SQUASHFS_SWAP((s)->directory_table_start, d, 760, 64);\ + SQUASHFS_SWAP((s)->fragment_table_start, d, 824, 64);\ + SQUASHFS_SWAP((s)->unused, d, 888, 64);\ } -#define SQUASHFS_SWAP_BASE_INODE_HEADER(s, d, n) {\ +#define SQUASHFS_SWAP_BASE_INODE_CORE(s, d, n)\ SQUASHFS_MEMSET(s, d, n);\ SQUASHFS_SWAP((s)->inode_type, d, 0, 4);\ SQUASHFS_SWAP((s)->mode, d, 4, 12);\ SQUASHFS_SWAP((s)->uid, d, 16, 8);\ SQUASHFS_SWAP((s)->guid, d, 24, 8);\ + SQUASHFS_SWAP((s)->mtime, d, 32, 32);\ + SQUASHFS_SWAP((s)->inode_number, d, 64, 32); + +#define SQUASHFS_SWAP_BASE_INODE_HEADER(s, d, n) {\ + SQUASHFS_SWAP_START\ + SQUASHFS_SWAP_BASE_INODE_CORE(s, d, n)\ } -#define SQUASHFS_SWAP_IPC_INODE_HEADER(s, d) SQUASHFS_SWAP_BASE_INODE_HEADER(s, d, sizeof(squashfs_ipc_inode_header)) +#define SQUASHFS_SWAP_IPC_INODE_HEADER(s, d) {\ + SQUASHFS_SWAP_START\ + SQUASHFS_SWAP_BASE_INODE_CORE(s, d, \ + sizeof(struct squashfs_ipc_inode_header))\ + SQUASHFS_SWAP((s)->nlink, d, 96, 32);\ +} #define SQUASHFS_SWAP_DEV_INODE_HEADER(s, d) {\ - SQUASHFS_SWAP_BASE_INODE_HEADER(s, d, sizeof(squashfs_dev_inode_header));\ - SQUASHFS_SWAP((s)->rdev, d, 32, 16);\ + SQUASHFS_SWAP_START\ + SQUASHFS_SWAP_BASE_INODE_CORE(s, d, \ + sizeof(struct squashfs_dev_inode_header)); \ + SQUASHFS_SWAP((s)->nlink, d, 96, 32);\ + SQUASHFS_SWAP((s)->rdev, d, 128, 16);\ } #define SQUASHFS_SWAP_SYMLINK_INODE_HEADER(s, d) {\ - SQUASHFS_SWAP_BASE_INODE_HEADER(s, d, sizeof(squashfs_symlink_inode_header));\ - SQUASHFS_SWAP((s)->symlink_size, d, 32, 16);\ + SQUASHFS_SWAP_START\ + SQUASHFS_SWAP_BASE_INODE_CORE(s, d, \ + sizeof(struct squashfs_symlink_inode_header));\ + SQUASHFS_SWAP((s)->nlink, d, 96, 32);\ + SQUASHFS_SWAP((s)->symlink_size, d, 128, 16);\ } #define SQUASHFS_SWAP_REG_INODE_HEADER(s, d) {\ - SQUASHFS_SWAP_BASE_INODE_HEADER(s, d, sizeof(squashfs_reg_inode_header));\ - SQUASHFS_SWAP((s)->mtime, d, 32, 32);\ - SQUASHFS_SWAP((s)->start_block, d, 64, 32);\ - SQUASHFS_SWAP((s)->fragment, d, 96, 32);\ - SQUASHFS_SWAP((s)->offset, d, 128, 32);\ - SQUASHFS_SWAP((s)->file_size, d, 160, SQUASHFS_MAX_FILE_SIZE_LOG);\ + SQUASHFS_SWAP_START\ + SQUASHFS_SWAP_BASE_INODE_CORE(s, d, \ + sizeof(struct squashfs_reg_inode_header));\ + SQUASHFS_SWAP((s)->start_block, d, 96, 64);\ + SQUASHFS_SWAP((s)->fragment, d, 160, 32);\ + SQUASHFS_SWAP((s)->offset, d, 192, 32);\ + SQUASHFS_SWAP((s)->file_size, d, 224, 32);\ +} + +#define SQUASHFS_SWAP_LREG_INODE_HEADER(s, d) {\ + SQUASHFS_SWAP_START\ + SQUASHFS_SWAP_BASE_INODE_CORE(s, d, \ + sizeof(struct squashfs_lreg_inode_header));\ + SQUASHFS_SWAP((s)->nlink, d, 96, 32);\ + SQUASHFS_SWAP((s)->start_block, d, 128, 64);\ + SQUASHFS_SWAP((s)->fragment, d, 192, 32);\ + SQUASHFS_SWAP((s)->offset, d, 224, 32);\ + SQUASHFS_SWAP((s)->file_size, d, 256, 64);\ } #define SQUASHFS_SWAP_DIR_INODE_HEADER(s, d) {\ - SQUASHFS_SWAP_BASE_INODE_HEADER(s, d, sizeof(squashfs_dir_inode_header));\ - SQUASHFS_SWAP((s)->file_size, d, 32, 19);\ - SQUASHFS_SWAP((s)->offset, d, 51, 13);\ - SQUASHFS_SWAP((s)->mtime, d, 64, 32);\ - SQUASHFS_SWAP((s)->start_block, d, 96, 24);\ + SQUASHFS_SWAP_START\ + SQUASHFS_SWAP_BASE_INODE_CORE(s, d, \ + sizeof(struct squashfs_dir_inode_header));\ + SQUASHFS_SWAP((s)->nlink, d, 96, 32);\ + SQUASHFS_SWAP((s)->file_size, d, 128, 19);\ + SQUASHFS_SWAP((s)->offset, d, 147, 13);\ + SQUASHFS_SWAP((s)->start_block, d, 160, 32);\ + SQUASHFS_SWAP((s)->parent_inode, d, 192, 32);\ +} + +#define SQUASHFS_SWAP_LDIR_INODE_HEADER(s, d) {\ + SQUASHFS_SWAP_START\ + SQUASHFS_SWAP_BASE_INODE_CORE(s, d, \ + sizeof(struct squashfs_ldir_inode_header));\ + SQUASHFS_SWAP((s)->nlink, d, 96, 32);\ + SQUASHFS_SWAP((s)->file_size, d, 128, 27);\ + SQUASHFS_SWAP((s)->offset, d, 155, 13);\ + SQUASHFS_SWAP((s)->start_block, d, 168, 32);\ + SQUASHFS_SWAP((s)->i_count, d, 200, 16);\ + SQUASHFS_SWAP((s)->parent_inode, d, 216, 32);\ +} + +#define SQUASHFS_SWAP_DIR_INDEX(s, d) {\ + SQUASHFS_SWAP_START\ + SQUASHFS_MEMSET(s, d, sizeof(struct squashfs_dir_index));\ + SQUASHFS_SWAP((s)->index, d, 0, 32);\ + SQUASHFS_SWAP((s)->start_block, d, 32, 32);\ + SQUASHFS_SWAP((s)->size, d, 64, 8);\ } #define SQUASHFS_SWAP_DIR_HEADER(s, d) {\ - SQUASHFS_MEMSET(s, d, sizeof(squashfs_dir_header));\ + SQUASHFS_SWAP_START\ + SQUASHFS_MEMSET(s, d, sizeof(struct squashfs_dir_header));\ SQUASHFS_SWAP((s)->count, d, 0, 8);\ - SQUASHFS_SWAP((s)->start_block, d, 8, 24);\ + SQUASHFS_SWAP((s)->start_block, d, 8, 32);\ + SQUASHFS_SWAP((s)->inode_number, d, 40, 32);\ } #define SQUASHFS_SWAP_DIR_ENTRY(s, d) {\ - SQUASHFS_MEMSET(s, d, sizeof(squashfs_dir_entry));\ + SQUASHFS_SWAP_START\ + SQUASHFS_MEMSET(s, d, sizeof(struct squashfs_dir_entry));\ SQUASHFS_SWAP((s)->offset, d, 0, 13);\ SQUASHFS_SWAP((s)->type, d, 13, 3);\ SQUASHFS_SWAP((s)->size, d, 16, 8);\ + SQUASHFS_SWAP((s)->inode_number, d, 24, 16);\ } #define SQUASHFS_SWAP_FRAGMENT_ENTRY(s, d) {\ - SQUASHFS_MEMSET(s, d, sizeof(squashfs_fragment_entry));\ - SQUASHFS_SWAP((s)->start_block, d, 0, 32);\ - SQUASHFS_SWAP((s)->size, d, 32, 32);\ + SQUASHFS_SWAP_START\ + SQUASHFS_MEMSET(s, d, sizeof(struct squashfs_fragment_entry));\ + SQUASHFS_SWAP((s)->start_block, d, 0, 64);\ + SQUASHFS_SWAP((s)->size, d, 64, 32);\ } #define SQUASHFS_SWAP_SHORTS(s, d, n) {\ int entry;\ int bit_position;\ + SQUASHFS_SWAP_START\ SQUASHFS_MEMSET(s, d, n * 2);\ - for(entry = 0, bit_position = 0; entry < n; entry++, bit_position += 16)\ + for(entry = 0, bit_position = 0; entry < n; entry++, bit_position += \ + 16)\ SQUASHFS_SWAP(s[entry], d, bit_position, 16);\ } #define SQUASHFS_SWAP_INTS(s, d, n) {\ int entry;\ int bit_position;\ + SQUASHFS_SWAP_START\ SQUASHFS_MEMSET(s, d, n * 4);\ - for(entry = 0, bit_position = 0; entry < n; entry++, bit_position += 32)\ + for(entry = 0, bit_position = 0; entry < n; entry++, bit_position += \ + 32)\ SQUASHFS_SWAP(s[entry], d, bit_position, 32);\ } +#define SQUASHFS_SWAP_LONG_LONGS(s, d, n) {\ + int entry;\ + int bit_position;\ + SQUASHFS_SWAP_START\ + SQUASHFS_MEMSET(s, d, n * 8);\ + for(entry = 0, bit_position = 0; entry < n; entry++, bit_position += \ + 64)\ + SQUASHFS_SWAP(s[entry], d, bit_position, 64);\ +} + #define SQUASHFS_SWAP_DATA(s, d, n, bits) {\ int entry;\ int bit_position;\ + SQUASHFS_SWAP_START\ SQUASHFS_MEMSET(s, d, n * bits / 8);\ - for(entry = 0, bit_position = 0; entry < n; entry++, bit_position += bits)\ + for(entry = 0, bit_position = 0; entry < n; entry++, bit_position += \ + bits)\ SQUASHFS_SWAP(s[entry], d, bit_position, bits);\ } -#define SQUASHFS_SWAP_FRAGMENT_INDEXES(s, d, n) SQUASHFS_SWAP_INTS(s, d, n) +#define SQUASHFS_SWAP_FRAGMENT_INDEXES(s, d, n) SQUASHFS_SWAP_LONG_LONGS(s, d, n) -#ifdef SQUASHFS_1_0_COMPATIBILITY -typedef struct { +#ifdef CONFIG_SQUASHFS_1_0_COMPATIBILITY + +struct squashfs_base_inode_header_1 { unsigned int inode_type:4; unsigned int mode:12; /* protection */ unsigned int uid:4; /* index into uid table */ unsigned int guid:4; /* index into guid table */ -} __attribute__ ((packed)) squashfs_base_inode_header_1; +} __attribute__ ((packed)); -typedef struct { +struct squashfs_ipc_inode_header_1 { unsigned int inode_type:4; unsigned int mode:12; /* protection */ unsigned int uid:4; /* index into uid table */ unsigned int guid:4; /* index into guid table */ unsigned int type:4; unsigned int offset:4; -} __attribute__ ((packed)) squashfs_ipc_inode_header_1; +} __attribute__ ((packed)); -typedef struct { +struct squashfs_dev_inode_header_1 { unsigned int inode_type:4; unsigned int mode:12; /* protection */ unsigned int uid:4; /* index into uid table */ unsigned int guid:4; /* index into guid table */ unsigned short rdev; -} __attribute__ ((packed)) squashfs_dev_inode_header_1; +} __attribute__ ((packed)); -typedef struct { +struct squashfs_symlink_inode_header_1 { unsigned int inode_type:4; unsigned int mode:12; /* protection */ unsigned int uid:4; /* index into uid table */ unsigned int guid:4; /* index into guid table */ unsigned short symlink_size; char symlink[0]; -} __attribute__ ((packed)) squashfs_symlink_inode_header_1; +} __attribute__ ((packed)); -typedef struct { +struct squashfs_reg_inode_header_1 { unsigned int inode_type:4; unsigned int mode:12; /* protection */ unsigned int uid:4; /* index into uid table */ unsigned int guid:4; /* index into guid table */ unsigned int mtime; - squashfs_block start_block; - unsigned int file_size:SQUASHFS_MAX_FILE_SIZE_LOG; + unsigned int start_block; + unsigned int file_size:32; unsigned short block_list[0]; -} __attribute__ ((packed)) squashfs_reg_inode_header_1; +} __attribute__ ((packed)); -typedef struct { +struct squashfs_dir_inode_header_1 { unsigned int inode_type:4; unsigned int mode:12; /* protection */ unsigned int uid:4; /* index into uid table */ @@ -403,72 +608,308 @@ typedef struct { unsigned int offset:13; unsigned int mtime; unsigned int start_block:24; -} __attribute__ ((packed)) squashfs_dir_inode_header_1; +} __attribute__ ((packed)); -#define SQUASHFS_SWAP_BASE_INODE_HEADER_1(s, d, n) {\ +#define SQUASHFS_SWAP_BASE_INODE_CORE_1(s, d, n) \ SQUASHFS_MEMSET(s, d, n);\ SQUASHFS_SWAP((s)->inode_type, d, 0, 4);\ SQUASHFS_SWAP((s)->mode, d, 4, 12);\ SQUASHFS_SWAP((s)->uid, d, 16, 4);\ - SQUASHFS_SWAP((s)->guid, d, 20, 4);\ + SQUASHFS_SWAP((s)->guid, d, 20, 4); + +#define SQUASHFS_SWAP_BASE_INODE_HEADER_1(s, d, n) {\ + SQUASHFS_SWAP_START\ + SQUASHFS_SWAP_BASE_INODE_CORE_1(s, d, n)\ } #define SQUASHFS_SWAP_IPC_INODE_HEADER_1(s, d) {\ - SQUASHFS_SWAP_BASE_INODE_HEADER_1(s, d, sizeof(squashfs_ipc_inode_header_1));\ + SQUASHFS_SWAP_START\ + SQUASHFS_SWAP_BASE_INODE_CORE_1(s, d, \ + sizeof(struct squashfs_ipc_inode_header_1));\ SQUASHFS_SWAP((s)->type, d, 24, 4);\ SQUASHFS_SWAP((s)->offset, d, 28, 4);\ } #define SQUASHFS_SWAP_DEV_INODE_HEADER_1(s, d) {\ - SQUASHFS_SWAP_BASE_INODE_HEADER_1(s, d, sizeof(squashfs_dev_inode_header_1));\ + SQUASHFS_SWAP_START\ + SQUASHFS_SWAP_BASE_INODE_CORE_1(s, d, \ + sizeof(struct squashfs_dev_inode_header_1));\ SQUASHFS_SWAP((s)->rdev, d, 24, 16);\ } #define SQUASHFS_SWAP_SYMLINK_INODE_HEADER_1(s, d) {\ - SQUASHFS_SWAP_BASE_INODE_HEADER(s, d, sizeof(squashfs_symlink_inode_header_1));\ + SQUASHFS_SWAP_START\ + SQUASHFS_SWAP_BASE_INODE_CORE_1(s, d, \ + sizeof(struct squashfs_symlink_inode_header_1));\ SQUASHFS_SWAP((s)->symlink_size, d, 24, 16);\ } #define SQUASHFS_SWAP_REG_INODE_HEADER_1(s, d) {\ - SQUASHFS_SWAP_BASE_INODE_HEADER(s, d, sizeof(squashfs_reg_inode_header_1));\ + SQUASHFS_SWAP_START\ + SQUASHFS_SWAP_BASE_INODE_CORE_1(s, d, \ + sizeof(struct squashfs_reg_inode_header_1));\ SQUASHFS_SWAP((s)->mtime, d, 24, 32);\ SQUASHFS_SWAP((s)->start_block, d, 56, 32);\ - SQUASHFS_SWAP((s)->file_size, d, 88, SQUASHFS_MAX_FILE_SIZE_LOG);\ + SQUASHFS_SWAP((s)->file_size, d, 88, 32);\ } #define SQUASHFS_SWAP_DIR_INODE_HEADER_1(s, d) {\ - SQUASHFS_SWAP_BASE_INODE_HEADER(s, d, sizeof(squashfs_dir_inode_header_1));\ + SQUASHFS_SWAP_START\ + SQUASHFS_SWAP_BASE_INODE_CORE_1(s, d, \ + sizeof(struct squashfs_dir_inode_header_1));\ SQUASHFS_SWAP((s)->file_size, d, 24, 19);\ SQUASHFS_SWAP((s)->offset, d, 43, 13);\ SQUASHFS_SWAP((s)->mtime, d, 56, 32);\ SQUASHFS_SWAP((s)->start_block, d, 88, 24);\ } + +#endif + +#ifdef CONFIG_SQUASHFS_2_0_COMPATIBILITY + +struct squashfs_dir_index_2 { + unsigned int index:27; + unsigned int start_block:29; + unsigned char size; + unsigned char name[0]; +} __attribute__ ((packed)); + +struct squashfs_base_inode_header_2 { + unsigned int inode_type:4; + unsigned int mode:12; /* protection */ + unsigned int uid:8; /* index into uid table */ + unsigned int guid:8; /* index into guid table */ +} __attribute__ ((packed)); + +struct squashfs_ipc_inode_header_2 { + unsigned int inode_type:4; + unsigned int mode:12; /* protection */ + unsigned int uid:8; /* index into uid table */ + unsigned int guid:8; /* index into guid table */ +} __attribute__ ((packed)); + +struct squashfs_dev_inode_header_2 { + unsigned int inode_type:4; + unsigned int mode:12; /* protection */ + unsigned int uid:8; /* index into uid table */ + unsigned int guid:8; /* index into guid table */ + unsigned short rdev; +} __attribute__ ((packed)); + +struct squashfs_symlink_inode_header_2 { + unsigned int inode_type:4; + unsigned int mode:12; /* protection */ + unsigned int uid:8; /* index into uid table */ + unsigned int guid:8; /* index into guid table */ + unsigned short symlink_size; + char symlink[0]; +} __attribute__ ((packed)); + +struct squashfs_reg_inode_header_2 { + unsigned int inode_type:4; + unsigned int mode:12; /* protection */ + unsigned int uid:8; /* index into uid table */ + unsigned int guid:8; /* index into guid table */ + unsigned int mtime; + unsigned int start_block; + unsigned int fragment; + unsigned int offset; + unsigned int file_size:32; + unsigned short block_list[0]; +} __attribute__ ((packed)); + +struct squashfs_dir_inode_header_2 { + unsigned int inode_type:4; + unsigned int mode:12; /* protection */ + unsigned int uid:8; /* index into uid table */ + unsigned int guid:8; /* index into guid table */ + unsigned int file_size:19; + unsigned int offset:13; + unsigned int mtime; + unsigned int start_block:24; +} __attribute__ ((packed)); + +struct squashfs_ldir_inode_header_2 { + unsigned int inode_type:4; + unsigned int mode:12; /* protection */ + unsigned int uid:8; /* index into uid table */ + unsigned int guid:8; /* index into guid table */ + unsigned int file_size:27; + unsigned int offset:13; + unsigned int mtime; + unsigned int start_block:24; + unsigned int i_count:16; + struct squashfs_dir_index_2 index[0]; +} __attribute__ ((packed)); + +union squashfs_inode_header_2 { + struct squashfs_base_inode_header_2 base; + struct squashfs_dev_inode_header_2 dev; + struct squashfs_symlink_inode_header_2 symlink; + struct squashfs_reg_inode_header_2 reg; + struct squashfs_dir_inode_header_2 dir; + struct squashfs_ldir_inode_header_2 ldir; + struct squashfs_ipc_inode_header_2 ipc; +}; + +struct squashfs_dir_header_2 { + unsigned int count:8; + unsigned int start_block:24; +} __attribute__ ((packed)); + +struct squashfs_dir_entry_2 { + unsigned int offset:13; + unsigned int type:3; + unsigned int size:8; + char name[0]; +} __attribute__ ((packed)); + +struct squashfs_fragment_entry_2 { + unsigned int start_block; + unsigned int size; +} __attribute__ ((packed)); + +#define SQUASHFS_SWAP_BASE_INODE_CORE_2(s, d, n)\ + SQUASHFS_MEMSET(s, d, n);\ + SQUASHFS_SWAP((s)->inode_type, d, 0, 4);\ + SQUASHFS_SWAP((s)->mode, d, 4, 12);\ + SQUASHFS_SWAP((s)->uid, d, 16, 8);\ + SQUASHFS_SWAP((s)->guid, d, 24, 8);\ + +#define SQUASHFS_SWAP_BASE_INODE_HEADER_2(s, d, n) {\ + SQUASHFS_SWAP_START\ + SQUASHFS_SWAP_BASE_INODE_CORE_2(s, d, n)\ +} + +#define SQUASHFS_SWAP_IPC_INODE_HEADER_2(s, d) \ + SQUASHFS_SWAP_BASE_INODE_HEADER_2(s, d, sizeof(struct squashfs_ipc_inode_header_2)) + +#define SQUASHFS_SWAP_DEV_INODE_HEADER_2(s, d) {\ + SQUASHFS_SWAP_START\ + SQUASHFS_SWAP_BASE_INODE_CORE_2(s, d, \ + sizeof(struct squashfs_dev_inode_header_2)); \ + SQUASHFS_SWAP((s)->rdev, d, 32, 16);\ +} + +#define SQUASHFS_SWAP_SYMLINK_INODE_HEADER_2(s, d) {\ + SQUASHFS_SWAP_START\ + SQUASHFS_SWAP_BASE_INODE_CORE_2(s, d, \ + sizeof(struct squashfs_symlink_inode_header_2));\ + SQUASHFS_SWAP((s)->symlink_size, d, 32, 16);\ +} + +#define SQUASHFS_SWAP_REG_INODE_HEADER_2(s, d) {\ + SQUASHFS_SWAP_START\ + SQUASHFS_SWAP_BASE_INODE_CORE_2(s, d, \ + sizeof(struct squashfs_reg_inode_header_2));\ + SQUASHFS_SWAP((s)->mtime, d, 32, 32);\ + SQUASHFS_SWAP((s)->start_block, d, 64, 32);\ + SQUASHFS_SWAP((s)->fragment, d, 96, 32);\ + SQUASHFS_SWAP((s)->offset, d, 128, 32);\ + SQUASHFS_SWAP((s)->file_size, d, 160, 32);\ +} + +#define SQUASHFS_SWAP_DIR_INODE_HEADER_2(s, d) {\ + SQUASHFS_SWAP_START\ + SQUASHFS_SWAP_BASE_INODE_CORE_2(s, d, \ + sizeof(struct squashfs_dir_inode_header_2));\ + SQUASHFS_SWAP((s)->file_size, d, 32, 19);\ + SQUASHFS_SWAP((s)->offset, d, 51, 13);\ + SQUASHFS_SWAP((s)->mtime, d, 64, 32);\ + SQUASHFS_SWAP((s)->start_block, d, 96, 24);\ +} + +#define SQUASHFS_SWAP_LDIR_INODE_HEADER_2(s, d) {\ + SQUASHFS_SWAP_START\ + SQUASHFS_SWAP_BASE_INODE_CORE_2(s, d, \ + sizeof(struct squashfs_ldir_inode_header_2));\ + SQUASHFS_SWAP((s)->file_size, d, 32, 27);\ + SQUASHFS_SWAP((s)->offset, d, 59, 13);\ + SQUASHFS_SWAP((s)->mtime, d, 72, 32);\ + SQUASHFS_SWAP((s)->start_block, d, 104, 24);\ + SQUASHFS_SWAP((s)->i_count, d, 128, 16);\ +} + +#define SQUASHFS_SWAP_DIR_INDEX_2(s, d) {\ + SQUASHFS_SWAP_START\ + SQUASHFS_MEMSET(s, d, sizeof(struct squashfs_dir_index_2));\ + SQUASHFS_SWAP((s)->index, d, 0, 27);\ + SQUASHFS_SWAP((s)->start_block, d, 27, 29);\ + SQUASHFS_SWAP((s)->size, d, 56, 8);\ +} +#define SQUASHFS_SWAP_DIR_HEADER_2(s, d) {\ + SQUASHFS_SWAP_START\ + SQUASHFS_MEMSET(s, d, sizeof(struct squashfs_dir_header_2));\ + SQUASHFS_SWAP((s)->count, d, 0, 8);\ + SQUASHFS_SWAP((s)->start_block, d, 8, 24);\ +} + +#define SQUASHFS_SWAP_DIR_ENTRY_2(s, d) {\ + SQUASHFS_SWAP_START\ + SQUASHFS_MEMSET(s, d, sizeof(struct squashfs_dir_entry_2));\ + SQUASHFS_SWAP((s)->offset, d, 0, 13);\ + SQUASHFS_SWAP((s)->type, d, 13, 3);\ + SQUASHFS_SWAP((s)->size, d, 16, 8);\ +} + +#define SQUASHFS_SWAP_FRAGMENT_ENTRY_2(s, d) {\ + SQUASHFS_SWAP_START\ + SQUASHFS_MEMSET(s, d, sizeof(struct squashfs_fragment_entry_2));\ + SQUASHFS_SWAP((s)->start_block, d, 0, 32);\ + SQUASHFS_SWAP((s)->size, d, 32, 32);\ +} + +#define SQUASHFS_SWAP_FRAGMENT_INDEXES_2(s, d, n) SQUASHFS_SWAP_INTS(s, d, n) + +/* fragment and fragment table defines */ +#define SQUASHFS_FRAGMENT_BYTES_2(A) (A * sizeof(struct squashfs_fragment_entry_2)) + +#define SQUASHFS_FRAGMENT_INDEX_2(A) (SQUASHFS_FRAGMENT_BYTES_2(A) / \ + SQUASHFS_METADATA_SIZE) + +#define SQUASHFS_FRAGMENT_INDEX_OFFSET_2(A) (SQUASHFS_FRAGMENT_BYTES_2(A) % \ + SQUASHFS_METADATA_SIZE) + +#define SQUASHFS_FRAGMENT_INDEXES_2(A) ((SQUASHFS_FRAGMENT_BYTES_2(A) + \ + SQUASHFS_METADATA_SIZE - 1) / \ + SQUASHFS_METADATA_SIZE) + +#define SQUASHFS_FRAGMENT_INDEX_BYTES_2(A) (SQUASHFS_FRAGMENT_INDEXES_2(A) *\ + sizeof(int)) + #endif #ifdef __KERNEL__ + /* * macros used to swap each structure entry, taking into account - * bitfields and different bitfield placing conventions on differing architectures + * bitfields and different bitfield placing conventions on differing + * architectures */ + #include + #ifdef __BIG_ENDIAN /* convert from little endian to big endian */ -#define SQUASHFS_SWAP(value, p, pos, tbits) _SQUASHFS_SWAP(value, p, pos, tbits, b_pos) +#define SQUASHFS_SWAP(value, p, pos, tbits) _SQUASHFS_SWAP(value, p, pos, \ + tbits, b_pos) #else /* convert from big endian to little endian */ -#define SQUASHFS_SWAP(value, p, pos, tbits) _SQUASHFS_SWAP(value, p, pos, tbits, 64 - tbits - b_pos) +#define SQUASHFS_SWAP(value, p, pos, tbits) _SQUASHFS_SWAP(value, p, pos, \ + tbits, 64 - tbits - b_pos) #endif #define _SQUASHFS_SWAP(value, p, pos, tbits, SHIFT) {\ - int bits;\ - int b_pos = pos % 8;\ - unsigned long long val = 0;\ - unsigned char *s = (unsigned char *)p + (pos / 8);\ - unsigned char *d = ((unsigned char *) &val) + 7;\ + b_pos = pos % 8;\ + val = 0;\ + s = (unsigned char *)p + (pos / 8);\ + d = ((unsigned char *) &val) + 7;\ for(bits = 0; bits < (tbits + b_pos); bits += 8) \ *d-- = *s++;\ value = (val >> (SHIFT))/* & ((1 << tbits) - 1)*/;\ } + #define SQUASHFS_MEMSET(s, d, n) memset(s, 0, n); + #endif #endif diff --git a/release/src/linux/linux/include/linux/squashfs_fs_i.h b/release/src/linux/linux/include/linux/squashfs_fs_i.h index 47043b37..0fe28cc4 100644 --- a/release/src/linux/linux/include/linux/squashfs_fs_i.h +++ b/release/src/linux/linux/include/linux/squashfs_fs_i.h @@ -3,7 +3,8 @@ /* * Squashfs * - * Copyright (c) 2002, 2003, 2004 Phillip Lougher + * Copyright (c) 2002, 2003, 2004, 2005, 2006 + * Phillip Lougher * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -22,12 +23,22 @@ * squashfs_fs_i.h */ -typedef struct squashfs_inode_info { - unsigned int start_block; - unsigned int block_list_start; +struct squashfs_inode_info { + long long start_block; unsigned int offset; - unsigned int fragment_start_block; - unsigned int fragment_size; - unsigned int fragment_offset; - } squashfs_inode_info; + union { + struct { + long long fragment_start_block; + unsigned int fragment_size; + unsigned int fragment_offset; + long long block_list_start; + } s1; + struct { + long long directory_index_start; + unsigned int directory_index_offset; + unsigned int directory_index_count; + unsigned int parent_inode; + } s2; + } u; +}; #endif diff --git a/release/src/linux/linux/include/linux/squashfs_fs_sb.h b/release/src/linux/linux/include/linux/squashfs_fs_sb.h index 6ce5e228..9ea7a11c 100644 --- a/release/src/linux/linux/include/linux/squashfs_fs_sb.h +++ b/release/src/linux/linux/include/linux/squashfs_fs_sb.h @@ -3,7 +3,8 @@ /* * Squashfs * - * Copyright (c) 2002, 2003, 2004 Phillip Lougher + * Copyright (c) 2002, 2003, 2004, 2005, 2006 + * Phillip Lougher * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -24,42 +25,50 @@ #include -typedef struct { - unsigned int block; +struct squashfs_cache { + long long block; int length; - unsigned int next_index; + long long next_index; char *data; - } squashfs_cache; +}; struct squashfs_fragment_cache { - unsigned int block; + long long block; int length; unsigned int locked; char *data; - }; +}; -typedef struct squashfs_sb_info { - squashfs_super_block sBlk; +struct squashfs_sb_info { + struct squashfs_super_block sblk; int devblksize; int devblksize_log2; int swap; - squashfs_cache *block_cache; + struct squashfs_cache *block_cache; struct squashfs_fragment_cache *fragment; int next_cache; int next_fragment; - squashfs_uid *uid; - squashfs_uid *guid; - squashfs_fragment_index *fragment_index; + int next_meta_index; + unsigned int *uid; + unsigned int *guid; + long long *fragment_index; + unsigned int *fragment_index_2; unsigned int read_size; char *read_data; char *read_page; + struct semaphore read_data_mutex; struct semaphore read_page_mutex; struct semaphore block_cache_mutex; struct semaphore fragment_mutex; + struct semaphore meta_index_mutex; wait_queue_head_t waitq; wait_queue_head_t fragment_wait_queue; - struct inode *(*iget)(struct super_block *s, squashfs_inode inode); - unsigned int (*read_blocklist)(struct inode *inode, int index, int readahead_blks, - char *block_list, char **block_p, unsigned int *bsize); - } squashfs_sb_info; + struct meta_index *meta_index; + struct inode *(*iget)(struct super_block *s, squashfs_inode_t \ + inode); + long long (*read_blocklist)(struct inode *inode, int \ + index, int readahead_blks, char *block_list, \ + unsigned short **block_p, unsigned int *bsize); + int (*read_fragment_index_table)(struct super_block *s); +}; #endif diff --git a/release/src/linux/linux/include/linux/sysctl.h b/release/src/linux/linux/include/linux/sysctl.h index ef417f6b..5742f382 100644 --- a/release/src/linux/linux/include/linux/sysctl.h +++ b/release/src/linux/linux/include/linux/sysctl.h @@ -292,7 +292,11 @@ enum NET_IPV4_NONLOCAL_BIND=88, NET_IPV4_ICMP_RATELIMIT=89, NET_IPV4_ICMP_RATEMASK=90, - NET_TCP_TW_REUSE=91 + NET_TCP_TW_REUSE=91, + NET_TCP_VEGAS=92, + NET_TCP_VEGAS_ALPHA=93, + NET_TCP_VEGAS_BETA=94, + NET_TCP_VEGAS_GAMMA=95 }; enum { diff --git a/release/src/linux/linux/include/net/pkt_cls.h b/release/src/linux/linux/include/net/pkt_cls.h index cb2bde23..0926f823 100644 --- a/release/src/linux/linux/include/net/pkt_cls.h +++ b/release/src/linux/linux/include/net/pkt_cls.h @@ -77,7 +77,11 @@ static inline int tc_classify(struct sk_buff *skb, struct tcf_proto *tp, struct return -1; } - +static inline void tcf_destroy(struct tcf_proto *tp) +{ + tp->ops->destroy(tp); + kfree(tp); +} extern int register_tcf_proto_ops(struct tcf_proto_ops *ops); extern int unregister_tcf_proto_ops(struct tcf_proto_ops *ops); diff --git a/release/src/linux/linux/include/net/pkt_sched.h b/release/src/linux/linux/include/net/pkt_sched.h index a9027b90..7b91dac6 100644 --- a/release/src/linux/linux/include/net/pkt_sched.h +++ b/release/src/linux/linux/include/net/pkt_sched.h @@ -198,6 +198,7 @@ typedef long psched_tdiff_t; #define PSCHED_GET_TIME(stamp) do_gettimeofday(&(stamp)) #define PSCHED_US2JIFFIE(usecs) (((usecs)+(1000000/HZ-1))/(1000000/HZ)) +#define PSCHED_JIFFIE2US(delay) ((delay)*(1000000/HZ)) #define PSCHED_EXPORTLIST EXPORT_SYMBOL(psched_tod_diff); @@ -212,12 +213,16 @@ extern psched_time_t psched_time_base; #if PSCHED_CLOCK_SOURCE == PSCHED_JIFFIES -#if HZ == 100 +#if HZ < 96 +#define PSCHED_JSCALE 14 +#elif HZ >= 96 && HZ < 192 #define PSCHED_JSCALE 13 -#elif HZ == 1024 +#elif HZ >= 192 && HZ < 384 +#define PSCHED_JSCALE 12 +#elif HZ >= 384 && HZ < 768 +#define PSCHED_JSCALE 11 +#elif HZ >= 768 #define PSCHED_JSCALE 10 -#else -#define PSCHED_JSCALE 0 #endif #define PSCHED_EXPORTLIST_2 @@ -242,6 +247,7 @@ extern PSCHED_WATCHER psched_time_mark; #endif #define PSCHED_US2JIFFIE(delay) (((delay)+(1<>PSCHED_JSCALE) +#define PSCHED_JIFFIE2US(delay) ((delay)<snd_cwnd >> 1U, 2U); } +/* Stop taking Vegas samples for now. */ +#define tcp_vegas_disable(__tp) ((__tp)->vegas.doing_vegas_now = 0) + +/* Is this TCP connection using Vegas (regardless of whether it is taking + * Vegas measurements at the current time)? + */ +#define tcp_is_vegas(__tp) ((__tp)->vegas.do_vegas) + +static inline void tcp_vegas_enable(struct tcp_opt *tp) +{ + /* There are several situations when we must "re-start" Vegas: + * + * o when a connection is established + * o after an RTO + * o after fast recovery + * o when we send a packet and there is no outstanding + * unacknowledged data (restarting an idle connection) + * + * In these circumstances we cannot do a Vegas calculation at the + * end of the first RTT, because any calculation we do is using + * stale info -- both the saved cwnd and congestion feedback are + * stale. + * + * Instead we must wait until the completion of an RTT during + * which we actually receive ACKs. + */ + + /* Begin taking Vegas samples next time we send something. */ + tp->vegas.doing_vegas_now = 1; + + /* Set the beginning of the next send window. */ + tp->vegas.beg_snd_nxt = tp->snd_nxt; + + tp->vegas.cntRTT = 0; + tp->vegas.minRTT = 0x7fffffff; +} + +/* Should we be taking Vegas samples right now? */ +#define tcp_vegas_enabled(__tp) ((__tp)->vegas.doing_vegas_now) + +extern void tcp_vegas_init(struct tcp_opt *tp); + +static inline void tcp_set_ca_state(struct tcp_opt *tp, u8 ca_state) +{ + if (tcp_is_vegas(tp)) { + if (ca_state == TCP_CA_Open) + tcp_vegas_enable(tp); + else + tcp_vegas_disable(tp); + } + tp->ca_state = ca_state; +} + /* If cwnd > ssthresh, we may raise ssthresh to be half-way to cwnd. * The exception is rate halving phase, when cwnd is decreasing towards * ssthresh. @@ -1129,7 +1186,7 @@ static inline void tcp_enter_cwr(struct tcp_opt *tp) tp->prior_ssthresh = 0; if (tp->ca_state < TCP_CA_CWR) { __tcp_enter_cwr(tp); - tp->ca_state = TCP_CA_CWR; + tcp_set_ca_state(tp, TCP_CA_CWR); } } -- cgit v1.2.3-54-g00ecf