mirror of https://github.com/hak5/openwrt.git
add all patches in a well defined form. added with cvs -ko to disable keyword substitution. 001-bcm47xx.patch contains new source code from Asus GPL package 1941. the stuff need a lot of testing. please add information about existing and new kernel patches into ../README
SVN-Revision: 1061lede-17.01
parent
9677bb2d2d
commit
548c3308d3
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,332 @@
|
|||
diff -Nur linux-2.4.30/include/linux/netdevice.h linux-2.4.30-wl-fix/include/linux/netdevice.h
|
||||
--- linux-2.4.30/include/linux/netdevice.h 2004-11-17 12:54:22.000000000 +0100
|
||||
+++ linux-2.4.30-wl-fix/include/linux/netdevice.h 2005-05-09 16:31:08.000000000 +0200
|
||||
@@ -297,7 +297,7 @@
|
||||
* See <net/iw_handler.h> for details. Jean II */
|
||||
struct iw_handler_def * wireless_handlers;
|
||||
|
||||
- struct ethtool_ops *ethtool_ops;
|
||||
+
|
||||
|
||||
/*
|
||||
* This marks the end of the "visible" part of the structure. All
|
||||
@@ -353,7 +353,14 @@
|
||||
struct Qdisc *qdisc;
|
||||
struct Qdisc *qdisc_sleeping;
|
||||
struct Qdisc *qdisc_ingress;
|
||||
+ /*
|
||||
+ * this is needed for the wlan driver binary blob from linksys
|
||||
+ */
|
||||
+#ifdef CONFIG_BCM4710
|
||||
+ struct Qdisc *qdisc_list;
|
||||
+#else
|
||||
struct list_head qdisc_list;
|
||||
+#endif
|
||||
unsigned long tx_queue_len; /* Max frames per queue allowed */
|
||||
|
||||
/* hard_start_xmit synchronizer */
|
||||
@@ -453,6 +460,7 @@
|
||||
/* this will get initialized at each interface type init routine */
|
||||
struct divert_blk *divert;
|
||||
#endif /* CONFIG_NET_DIVERT */
|
||||
+ struct ethtool_ops *ethtool_ops;
|
||||
};
|
||||
|
||||
/* 2.6 compatibility */
|
||||
diff -Nur linux-2.4.30/include/linux/skbuff.h linux-2.4.30-wl-fix/include/linux/skbuff.h
|
||||
--- linux-2.4.30/include/linux/skbuff.h 2005-04-04 03:42:20.000000000 +0200
|
||||
+++ linux-2.4.30-wl-fix/include/linux/skbuff.h 2005-05-08 00:50:55.000000000 +0200
|
||||
@@ -135,10 +135,6 @@
|
||||
struct sock *sk; /* Socket we are owned by */
|
||||
struct timeval stamp; /* Time we arrived */
|
||||
struct net_device *dev; /* Device we arrived on/are leaving by */
|
||||
- struct net_device *real_dev; /* For support of point to point protocols
|
||||
- (e.g. 802.3ad) over bonding, we must save the
|
||||
- physical device that got the packet before
|
||||
- replacing skb->dev with the virtual device. */
|
||||
|
||||
/* Transport layer header */
|
||||
union
|
||||
@@ -219,6 +215,10 @@
|
||||
#ifdef CONFIG_NET_SCHED
|
||||
__u32 tc_index; /* traffic control index */
|
||||
#endif
|
||||
+ struct net_device *real_dev; /* For support of point to point protocols
|
||||
+ (e.g. 802.3ad) over bonding, we must save the
|
||||
+ physical device that got the packet before
|
||||
+ replacing skb->dev with the virtual device. */
|
||||
};
|
||||
|
||||
#ifdef __KERNEL__
|
||||
diff -Nur linux-2.4.30/include/net/pkt_sched.h linux-2.4.30-wl-fix/include/net/pkt_sched.h
|
||||
--- linux-2.4.30/include/net/pkt_sched.h 2004-11-17 12:54:22.000000000 +0100
|
||||
+++ linux-2.4.30-wl-fix/include/net/pkt_sched.h 2005-05-08 01:05:48.000000000 +0200
|
||||
@@ -59,8 +59,11 @@
|
||||
int (*enqueue)(struct sk_buff *, struct Qdisc *);
|
||||
struct sk_buff * (*dequeue)(struct Qdisc *);
|
||||
int (*requeue)(struct sk_buff *, struct Qdisc *);
|
||||
- unsigned int (*drop)(struct Qdisc *);
|
||||
-
|
||||
+#ifdef CONFIG_BCM4710
|
||||
+ int (*drop)(struct Qdisc *);
|
||||
+#else
|
||||
+ unsigned int (*drop)(struct Qdisc *);
|
||||
+#endif
|
||||
int (*init)(struct Qdisc *, struct rtattr *arg);
|
||||
void (*reset)(struct Qdisc *);
|
||||
void (*destroy)(struct Qdisc *);
|
||||
@@ -80,12 +83,19 @@
|
||||
#define TCQ_F_THROTTLED 2
|
||||
#define TCQ_F_INGRESS 4
|
||||
struct Qdisc_ops *ops;
|
||||
+#ifdef CONFIG_BCM4710
|
||||
+ struct Qdisc *next;
|
||||
+#endif
|
||||
u32 handle;
|
||||
- u32 parent;
|
||||
+#ifndef CONFIG_BCM4710
|
||||
+ u32 parent;
|
||||
+#endif
|
||||
atomic_t refcnt;
|
||||
struct sk_buff_head q;
|
||||
struct net_device *dev;
|
||||
- struct list_head list;
|
||||
+#ifndef CONFIG_BCM4710
|
||||
+ struct list_head list;
|
||||
+#endif
|
||||
|
||||
struct tc_stats stats;
|
||||
int (*reshape_fail)(struct sk_buff *skb, struct Qdisc *q);
|
||||
diff -Nur linux-2.4.30/net/core/dev.c linux-2.4.30-wl-fix/net/core/dev.c
|
||||
--- linux-2.4.30/net/core/dev.c 2005-04-04 03:42:20.000000000 +0200
|
||||
+++ linux-2.4.30-wl-fix/net/core/dev.c 2005-05-08 00:51:08.000000000 +0200
|
||||
@@ -2311,6 +2311,7 @@
|
||||
}
|
||||
return ret;
|
||||
|
||||
+#ifndef CONFIG_BCM4710
|
||||
case SIOCETHTOOL:
|
||||
dev_load(ifr.ifr_name);
|
||||
rtnl_lock();
|
||||
@@ -2324,6 +2325,7 @@
|
||||
ret = -EFAULT;
|
||||
}
|
||||
return ret;
|
||||
+#endif
|
||||
|
||||
/*
|
||||
* These ioctl calls:
|
||||
diff -Nur linux-2.4.30/net/core/Makefile linux-2.4.30-wl-fix/net/core/Makefile
|
||||
--- linux-2.4.30/net/core/Makefile 2004-11-17 12:54:22.000000000 +0100
|
||||
+++ linux-2.4.30-wl-fix/net/core/Makefile 2005-05-08 00:51:02.000000000 +0200
|
||||
@@ -9,7 +9,11 @@
|
||||
|
||||
O_TARGET := core.o
|
||||
|
||||
+ifeq ($(CONFIG_BCM4710),y)
|
||||
+export-objs := netfilter.o profile.o neighbour.o
|
||||
+else
|
||||
export-objs := netfilter.o profile.o ethtool.o neighbour.o
|
||||
+endif
|
||||
|
||||
obj-y := sock.o skbuff.o iovec.o datagram.o scm.o
|
||||
|
||||
@@ -21,8 +25,13 @@
|
||||
|
||||
obj-$(CONFIG_FILTER) += filter.o
|
||||
|
||||
+ifeq ($(CONFIG_BCM4710),y)
|
||||
+obj-$(CONFIG_NET) += dev.o dev_mcast.o dst.o neighbour.o \
|
||||
+ rtnetlink.o utils.o
|
||||
+else
|
||||
obj-$(CONFIG_NET) += dev.o ethtool.o dev_mcast.o dst.o neighbour.o \
|
||||
rtnetlink.o utils.o
|
||||
+endif
|
||||
|
||||
obj-$(CONFIG_NETFILTER) += netfilter.o
|
||||
obj-$(CONFIG_NET_DIVERT) += dv.o
|
||||
diff -Nur linux-2.4.30/net/sched/sch_api.c linux-2.4.30-wl-fix/net/sched/sch_api.c
|
||||
--- linux-2.4.30/net/sched/sch_api.c 2004-11-17 12:54:22.000000000 +0100
|
||||
+++ linux-2.4.30-wl-fix/net/sched/sch_api.c 2005-05-08 00:51:14.000000000 +0200
|
||||
@@ -194,11 +194,12 @@
|
||||
{
|
||||
struct Qdisc *q;
|
||||
|
||||
- list_for_each_entry(q, &dev->qdisc_list, list) {
|
||||
+ for (q = dev->qdisc_list; q; q = q->next) {
|
||||
if (q->handle == handle)
|
||||
return q;
|
||||
}
|
||||
return NULL;
|
||||
+
|
||||
}
|
||||
|
||||
struct Qdisc *qdisc_leaf(struct Qdisc *p, u32 classid)
|
||||
@@ -371,8 +372,6 @@
|
||||
unsigned long cl = cops->get(parent, classid);
|
||||
if (cl) {
|
||||
err = cops->graft(parent, cl, new, old);
|
||||
- if (new)
|
||||
- new->parent = classid;
|
||||
cops->put(parent, cl);
|
||||
}
|
||||
}
|
||||
@@ -427,7 +426,6 @@
|
||||
|
||||
memset(sch, 0, size);
|
||||
|
||||
- INIT_LIST_HEAD(&sch->list);
|
||||
skb_queue_head_init(&sch->q);
|
||||
|
||||
if (handle == TC_H_INGRESS)
|
||||
@@ -453,7 +451,8 @@
|
||||
|
||||
if (!ops->init || (err = ops->init(sch, tca[TCA_OPTIONS-1])) == 0) {
|
||||
write_lock(&qdisc_tree_lock);
|
||||
- list_add_tail(&sch->list, &dev->qdisc_list);
|
||||
+ sch->next = dev->qdisc_list;
|
||||
+ dev->qdisc_list = sch;
|
||||
write_unlock(&qdisc_tree_lock);
|
||||
#ifdef CONFIG_NET_ESTIMATOR
|
||||
if (tca[TCA_RATE-1])
|
||||
@@ -808,19 +807,16 @@
|
||||
if (idx > s_idx)
|
||||
s_q_idx = 0;
|
||||
read_lock(&qdisc_tree_lock);
|
||||
- q_idx = 0;
|
||||
- list_for_each_entry(q, &dev->qdisc_list, list) {
|
||||
- if (q_idx < s_q_idx) {
|
||||
- q_idx++;
|
||||
- continue;
|
||||
- }
|
||||
- if (tc_fill_qdisc(skb, q, q->parent, NETLINK_CB(cb->skb).pid,
|
||||
- cb->nlh->nlmsg_seq, NLM_F_MULTI, RTM_NEWQDISC) <= 0) {
|
||||
- read_unlock(&qdisc_tree_lock);
|
||||
- goto done;
|
||||
- }
|
||||
- q_idx++;
|
||||
- }
|
||||
+ for (q = dev->qdisc_list, q_idx = 0; q;
|
||||
+ q = q->next, q_idx++) {
|
||||
+ if (q_idx < s_q_idx)
|
||||
+ continue;
|
||||
+ if (tc_fill_qdisc(skb, q, 0, NETLINK_CB(cb->skb).pid,
|
||||
+ cb->nlh->nlmsg_seq, NLM_F_MULTI, RTM_NEWQDISC) <= 0) {
|
||||
+ read_unlock(&qdisc_tree_lock);
|
||||
+ goto done;
|
||||
+ }
|
||||
+ }
|
||||
read_unlock(&qdisc_tree_lock);
|
||||
}
|
||||
|
||||
@@ -1033,27 +1029,24 @@
|
||||
t = 0;
|
||||
|
||||
read_lock(&qdisc_tree_lock);
|
||||
- list_for_each_entry(q, &dev->qdisc_list, list) {
|
||||
- if (t < s_t || !q->ops->cl_ops ||
|
||||
- (tcm->tcm_parent &&
|
||||
- TC_H_MAJ(tcm->tcm_parent) != q->handle)) {
|
||||
- t++;
|
||||
- continue;
|
||||
- }
|
||||
- if (t > s_t)
|
||||
- memset(&cb->args[1], 0, sizeof(cb->args)-sizeof(cb->args[0]));
|
||||
- arg.w.fn = qdisc_class_dump;
|
||||
- arg.skb = skb;
|
||||
- arg.cb = cb;
|
||||
- arg.w.stop = 0;
|
||||
- arg.w.skip = cb->args[1];
|
||||
- arg.w.count = 0;
|
||||
- q->ops->cl_ops->walk(q, &arg.w);
|
||||
- cb->args[1] = arg.w.count;
|
||||
- if (arg.w.stop)
|
||||
- break;
|
||||
- t++;
|
||||
- }
|
||||
+ for (q=dev->qdisc_list, t=0; q; q = q->next, t++) {
|
||||
+ if (t < s_t) continue;
|
||||
+ if (!q->ops->cl_ops) continue;
|
||||
+ if (tcm->tcm_parent && TC_H_MAJ(tcm->tcm_parent) != q->handle)
|
||||
+ continue;
|
||||
+ if (t > s_t)
|
||||
+ memset(&cb->args[1], 0, sizeof(cb->args)-sizeof(cb->args[0]));
|
||||
+ arg.w.fn = qdisc_class_dump;
|
||||
+ arg.skb = skb;
|
||||
+ arg.cb = cb;
|
||||
+ arg.w.stop = 0;
|
||||
+ arg.w.skip = cb->args[1];
|
||||
+ arg.w.count = 0;
|
||||
+ q->ops->cl_ops->walk(q, &arg.w);
|
||||
+ cb->args[1] = arg.w.count;
|
||||
+ if (arg.w.stop)
|
||||
+ break;
|
||||
+ }
|
||||
read_unlock(&qdisc_tree_lock);
|
||||
|
||||
cb->args[0] = t;
|
||||
diff -Nur linux-2.4.30/net/sched/sch_generic.c linux-2.4.30-wl-fix/net/sched/sch_generic.c
|
||||
--- linux-2.4.30/net/sched/sch_generic.c 2004-11-17 12:54:22.000000000 +0100
|
||||
+++ linux-2.4.30-wl-fix/net/sched/sch_generic.c 2005-05-08 00:51:20.000000000 +0200
|
||||
@@ -392,7 +392,6 @@
|
||||
return NULL;
|
||||
memset(sch, 0, size);
|
||||
|
||||
- INIT_LIST_HEAD(&sch->list);
|
||||
skb_queue_head_init(&sch->q);
|
||||
sch->ops = ops;
|
||||
sch->enqueue = ops->enqueue;
|
||||
@@ -422,11 +421,22 @@
|
||||
void qdisc_destroy(struct Qdisc *qdisc)
|
||||
{
|
||||
struct Qdisc_ops *ops = qdisc->ops;
|
||||
+ struct net_device *dev;
|
||||
|
||||
if (qdisc->flags&TCQ_F_BUILTIN ||
|
||||
!atomic_dec_and_test(&qdisc->refcnt))
|
||||
return;
|
||||
- list_del(&qdisc->list);
|
||||
+
|
||||
+ dev = qdisc->dev;
|
||||
+ if (dev) {
|
||||
+ struct Qdisc *q, **qp;
|
||||
+ for (qp = &qdisc->dev->qdisc_list; (q=*qp) != NULL; qp = &q->next) {
|
||||
+ if (q == qdisc) {
|
||||
+ *qp = q->next;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
#ifdef CONFIG_NET_ESTIMATOR
|
||||
qdisc_kill_estimator(&qdisc->stats);
|
||||
#endif
|
||||
@@ -455,9 +465,9 @@
|
||||
return;
|
||||
}
|
||||
write_lock(&qdisc_tree_lock);
|
||||
- list_add_tail(&qdisc->list, &dev->qdisc_list);
|
||||
+ qdisc->next = dev->qdisc_list;
|
||||
+ dev->qdisc_list = qdisc;
|
||||
write_unlock(&qdisc_tree_lock);
|
||||
-
|
||||
} else {
|
||||
qdisc = &noqueue_qdisc;
|
||||
}
|
||||
@@ -501,7 +511,7 @@
|
||||
dev->qdisc = &noop_qdisc;
|
||||
spin_unlock_bh(&dev->queue_lock);
|
||||
dev->qdisc_sleeping = &noop_qdisc;
|
||||
- INIT_LIST_HEAD(&dev->qdisc_list);
|
||||
+ dev->qdisc_list = NULL;
|
||||
write_unlock(&qdisc_tree_lock);
|
||||
|
||||
dev_watchdog_init(dev);
|
||||
@@ -523,7 +533,7 @@
|
||||
qdisc_destroy(qdisc);
|
||||
}
|
||||
#endif
|
||||
- BUG_TRAP(list_empty(&dev->qdisc_list));
|
||||
+ BUG_TRAP(dev->qdisc_list == NULL);
|
||||
BUG_TRAP(!timer_pending(&dev->watchdog_timer));
|
||||
spin_unlock_bh(&dev->queue_lock);
|
||||
write_unlock(&qdisc_tree_lock);
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,887 @@
|
|||
This patch adds LZMA support to the squashfs code, you should also
|
||||
change mksquashfs appropriately.
|
||||
|
||||
Oleg I. Vdovikin <oleg@cs.msu.su>
|
||||
|
||||
--- linuz/fs/squashfs/inode.c 2004-12-15 22:56:47.000000000 +0300
|
||||
+++ linux/fs/squashfs/inode.c 2005-01-20 20:27:27.490010968 +0300
|
||||
@@ -3,6 +3,9 @@
|
||||
*
|
||||
* Copyright (c) 2002, 2003, 2004 Phillip Lougher <plougher@users.sourceforge.net>
|
||||
*
|
||||
+ * LZMA decompressor support added by Oleg I. Vdovikin
|
||||
+ * Copyright (c) 2005 Oleg I.Vdovikin <oleg@cs.msu.su>
|
||||
+ *
|
||||
* 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,
|
||||
@@ -21,7 +24,11 @@
|
||||
* inode.c
|
||||
*/
|
||||
|
||||
+#define SQUASHFS_LZMA
|
||||
+
|
||||
+#ifndef SQUASHFS_LZMA
|
||||
#define SQUASHFS_1_0_COMPATIBILITY
|
||||
+#endif
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/squashfs_fs.h>
|
||||
@@ -39,6 +46,19 @@
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/vmalloc.h>
|
||||
|
||||
+#ifdef SQUASHFS_LZMA
|
||||
+#include "LzmaDecode.h"
|
||||
+
|
||||
+/* default LZMA settings, should be in sync with mksquashfs */
|
||||
+#define LZMA_LC 3
|
||||
+#define LZMA_LP 0
|
||||
+#define LZMA_PB 2
|
||||
+
|
||||
+#define LZMA_WORKSPACE_SIZE ((LZMA_BASE_SIZE + \
|
||||
+ (LZMA_LIT_SIZE << (LZMA_LC + LZMA_LP))) * sizeof(CProb))
|
||||
+
|
||||
+#endif
|
||||
+
|
||||
#ifdef SQUASHFS_TRACE
|
||||
#define TRACE(s, args...) printk(KERN_NOTICE "SQUASHFS: "s, ## args)
|
||||
#else
|
||||
@@ -77,7 +97,11 @@
|
||||
|
||||
DECLARE_MUTEX(read_data_mutex);
|
||||
|
||||
+#ifdef SQUASHFS_LZMA
|
||||
+static unsigned char lzma_workspace[LZMA_WORKSPACE_SIZE];
|
||||
+#else
|
||||
static z_stream stream;
|
||||
+#endif
|
||||
|
||||
static DECLARE_FSTYPE_DEV(squashfs_fs_type, "squashfs", squashfs_read_super);
|
||||
|
||||
@@ -232,6 +256,15 @@
|
||||
if(compressed) {
|
||||
int zlib_err;
|
||||
|
||||
+#ifdef SQUASHFS_LZMA
|
||||
+ if ((zlib_err = LzmaDecode(lzma_workspace,
|
||||
+ LZMA_WORKSPACE_SIZE, LZMA_LC, LZMA_LP, LZMA_PB,
|
||||
+ c_buffer, c_byte, buffer, msBlk->read_size, &bytes)) != LZMA_RESULT_OK)
|
||||
+ {
|
||||
+ ERROR("lzma returned unexpected result 0x%x\n", zlib_err);
|
||||
+ bytes = 0;
|
||||
+ }
|
||||
+#else
|
||||
stream.next_in = c_buffer;
|
||||
stream.avail_in = c_byte;
|
||||
stream.next_out = buffer;
|
||||
@@ -243,6 +276,7 @@
|
||||
bytes = 0;
|
||||
} else
|
||||
bytes = stream.total_out;
|
||||
+#endif
|
||||
up(&read_data_mutex);
|
||||
}
|
||||
|
||||
@@ -1491,17 +1525,21 @@
|
||||
static int __init init_squashfs_fs(void)
|
||||
{
|
||||
|
||||
+#ifndef SQUASHFS_LZMA
|
||||
if(!(stream.workspace = (char *) vmalloc(zlib_inflate_workspacesize()))) {
|
||||
ERROR("Failed to allocate zlib workspace\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
+#endif
|
||||
return register_filesystem(&squashfs_fs_type);
|
||||
}
|
||||
|
||||
|
||||
static void __exit exit_squashfs_fs(void)
|
||||
{
|
||||
+#ifndef SQUASHFS_LZMA
|
||||
vfree(stream.workspace);
|
||||
+#endif
|
||||
unregister_filesystem(&squashfs_fs_type);
|
||||
}
|
||||
|
||||
--- linuz/fs/squashfs/LzmaDecode.c 1970-01-01 03:00:00.000000000 +0300
|
||||
+++ linux/fs/squashfs/LzmaDecode.c 2005-01-20 19:40:35.400513552 +0300
|
||||
@@ -0,0 +1,663 @@
|
||||
+/*
|
||||
+ LzmaDecode.c
|
||||
+ LZMA Decoder
|
||||
+
|
||||
+ 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.
|
||||
+*/
|
||||
+
|
||||
+#include "LzmaDecode.h"
|
||||
+
|
||||
+#ifndef Byte
|
||||
+#define Byte unsigned char
|
||||
+#endif
|
||||
+
|
||||
+#define kNumTopBits 24
|
||||
+#define kTopValue ((UInt32)1 << kNumTopBits)
|
||||
+
|
||||
+#define kNumBitModelTotalBits 11
|
||||
+#define kBitModelTotal (1 << kNumBitModelTotalBits)
|
||||
+#define kNumMoveBits 5
|
||||
+
|
||||
+typedef struct _CRangeDecoder
|
||||
+{
|
||||
+ Byte *Buffer;
|
||||
+ Byte *BufferLim;
|
||||
+ UInt32 Range;
|
||||
+ UInt32 Code;
|
||||
+ #ifdef _LZMA_IN_CB
|
||||
+ ILzmaInCallback *InCallback;
|
||||
+ int Result;
|
||||
+ #endif
|
||||
+ int ExtraBytes;
|
||||
+} CRangeDecoder;
|
||||
+
|
||||
+Byte RangeDecoderReadByte(CRangeDecoder *rd)
|
||||
+{
|
||||
+ if (rd->Buffer == rd->BufferLim)
|
||||
+ {
|
||||
+ #ifdef _LZMA_IN_CB
|
||||
+ UInt32 size;
|
||||
+ rd->Result = rd->InCallback->Read(rd->InCallback, &rd->Buffer, &size);
|
||||
+ rd->BufferLim = rd->Buffer + size;
|
||||
+ if (size == 0)
|
||||
+ #endif
|
||||
+ {
|
||||
+ rd->ExtraBytes = 1;
|
||||
+ return 0xFF;
|
||||
+ }
|
||||
+ }
|
||||
+ return (*rd->Buffer++);
|
||||
+}
|
||||
+
|
||||
+/* #define ReadByte (*rd->Buffer++) */
|
||||
+#define ReadByte (RangeDecoderReadByte(rd))
|
||||
+
|
||||
+void RangeDecoderInit(CRangeDecoder *rd,
|
||||
+ #ifdef _LZMA_IN_CB
|
||||
+ ILzmaInCallback *inCallback
|
||||
+ #else
|
||||
+ Byte *stream, UInt32 bufferSize
|
||||
+ #endif
|
||||
+ )
|
||||
+{
|
||||
+ int i;
|
||||
+ #ifdef _LZMA_IN_CB
|
||||
+ rd->InCallback = inCallback;
|
||||
+ rd->Buffer = rd->BufferLim = 0;
|
||||
+ #else
|
||||
+ rd->Buffer = stream;
|
||||
+ rd->BufferLim = stream + bufferSize;
|
||||
+ #endif
|
||||
+ rd->ExtraBytes = 0;
|
||||
+ rd->Code = 0;
|
||||
+ rd->Range = (0xFFFFFFFF);
|
||||
+ for(i = 0; i < 5; i++)
|
||||
+ rd->Code = (rd->Code << 8) | ReadByte;
|
||||
+}
|
||||
+
|
||||
+#define RC_INIT_VAR UInt32 range = rd->Range; UInt32 code = rd->Code;
|
||||
+#define RC_FLUSH_VAR rd->Range = range; rd->Code = code;
|
||||
+#define RC_NORMALIZE if (range < kTopValue) { range <<= 8; code = (code << 8) | ReadByte; }
|
||||
+
|
||||
+UInt32 RangeDecoderDecodeDirectBits(CRangeDecoder *rd, int numTotalBits)
|
||||
+{
|
||||
+ RC_INIT_VAR
|
||||
+ UInt32 result = 0;
|
||||
+ int i;
|
||||
+ for (i = numTotalBits; i > 0; i--)
|
||||
+ {
|
||||
+ /* UInt32 t; */
|
||||
+ range >>= 1;
|
||||
+
|
||||
+ result <<= 1;
|
||||
+ if (code >= range)
|
||||
+ {
|
||||
+ code -= range;
|
||||
+ result |= 1;
|
||||
+ }
|
||||
+ /*
|
||||
+ t = (code - range) >> 31;
|
||||
+ t &= 1;
|
||||
+ code -= range & (t - 1);
|
||||
+ result = (result + result) | (1 - t);
|
||||
+ */
|
||||
+ RC_NORMALIZE
|
||||
+ }
|
||||
+ RC_FLUSH_VAR
|
||||
+ return result;
|
||||
+}
|
||||
+
|
||||
+int RangeDecoderBitDecode(CProb *prob, CRangeDecoder *rd)
|
||||
+{
|
||||
+ UInt32 bound = (rd->Range >> kNumBitModelTotalBits) * *prob;
|
||||
+ if (rd->Code < bound)
|
||||
+ {
|
||||
+ rd->Range = bound;
|
||||
+ *prob += (kBitModelTotal - *prob) >> kNumMoveBits;
|
||||
+ if (rd->Range < kTopValue)
|
||||
+ {
|
||||
+ rd->Code = (rd->Code << 8) | ReadByte;
|
||||
+ rd->Range <<= 8;
|
||||
+ }
|
||||
+ return 0;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ rd->Range -= bound;
|
||||
+ rd->Code -= bound;
|
||||
+ *prob -= (*prob) >> kNumMoveBits;
|
||||
+ if (rd->Range < kTopValue)
|
||||
+ {
|
||||
+ rd->Code = (rd->Code << 8) | ReadByte;
|
||||
+ rd->Range <<= 8;
|
||||
+ }
|
||||
+ return 1;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+#define RC_GET_BIT2(prob, mi, A0, A1) \
|
||||
+ UInt32 bound = (range >> kNumBitModelTotalBits) * *prob; \
|
||||
+ if (code < bound) \
|
||||
+ { A0; range = bound; *prob += (kBitModelTotal - *prob) >> kNumMoveBits; mi <<= 1; } \
|
||||
+ else \
|
||||
+ { A1; range -= bound; code -= bound; *prob -= (*prob) >> kNumMoveBits; mi = (mi + mi) + 1; } \
|
||||
+ RC_NORMALIZE
|
||||
+
|
||||
+#define RC_GET_BIT(prob, mi) RC_GET_BIT2(prob, mi, ; , ;)
|
||||
+
|
||||
+int RangeDecoderBitTreeDecode(CProb *probs, int numLevels, CRangeDecoder *rd)
|
||||
+{
|
||||
+ int mi = 1;
|
||||
+ int i;
|
||||
+ #ifdef _LZMA_LOC_OPT
|
||||
+ RC_INIT_VAR
|
||||
+ #endif
|
||||
+ for(i = numLevels; i > 0; i--)
|
||||
+ {
|
||||
+ #ifdef _LZMA_LOC_OPT
|
||||
+ CProb *prob = probs + mi;
|
||||
+ RC_GET_BIT(prob, mi)
|
||||
+ #else
|
||||
+ mi = (mi + mi) + RangeDecoderBitDecode(probs + mi, rd);
|
||||
+ #endif
|
||||
+ }
|
||||
+ #ifdef _LZMA_LOC_OPT
|
||||
+ RC_FLUSH_VAR
|
||||
+ #endif
|
||||
+ return mi - (1 << numLevels);
|
||||
+}
|
||||
+
|
||||
+int RangeDecoderReverseBitTreeDecode(CProb *probs, int numLevels, CRangeDecoder *rd)
|
||||
+{
|
||||
+ int mi = 1;
|
||||
+ int i;
|
||||
+ int symbol = 0;
|
||||
+ #ifdef _LZMA_LOC_OPT
|
||||
+ RC_INIT_VAR
|
||||
+ #endif
|
||||
+ for(i = 0; i < numLevels; i++)
|
||||
+ {
|
||||
+ #ifdef _LZMA_LOC_OPT
|
||||
+ CProb *prob = probs + mi;
|
||||
+ RC_GET_BIT2(prob, mi, ; , symbol |= (1 << i))
|
||||
+ #else
|
||||
+ int bit = RangeDecoderBitDecode(probs + mi, rd);
|
||||
+ mi = mi + mi + bit;
|
||||
+ symbol |= (bit << i);
|
||||
+ #endif
|
||||
+ }
|
||||
+ #ifdef _LZMA_LOC_OPT
|
||||
+ RC_FLUSH_VAR
|
||||
+ #endif
|
||||
+ return symbol;
|
||||
+}
|
||||
+
|
||||
+Byte LzmaLiteralDecode(CProb *probs, CRangeDecoder *rd)
|
||||
+{
|
||||
+ int symbol = 1;
|
||||
+ #ifdef _LZMA_LOC_OPT
|
||||
+ RC_INIT_VAR
|
||||
+ #endif
|
||||
+ do
|
||||
+ {
|
||||
+ #ifdef _LZMA_LOC_OPT
|
||||
+ CProb *prob = probs + symbol;
|
||||
+ RC_GET_BIT(prob, symbol)
|
||||
+ #else
|
||||
+ symbol = (symbol + symbol) | RangeDecoderBitDecode(probs + symbol, rd);
|
||||
+ #endif
|
||||
+ }
|
||||
+ while (symbol < 0x100);
|
||||
+ #ifdef _LZMA_LOC_OPT
|
||||
+ RC_FLUSH_VAR
|
||||
+ #endif
|
||||
+ return symbol;
|
||||
+}
|
||||
+
|
||||
+Byte LzmaLiteralDecodeMatch(CProb *probs, CRangeDecoder *rd, Byte matchByte)
|
||||
+{
|
||||
+ int symbol = 1;
|
||||
+ #ifdef _LZMA_LOC_OPT
|
||||
+ RC_INIT_VAR
|
||||
+ #endif
|
||||
+ do
|
||||
+ {
|
||||
+ int bit;
|
||||
+ int matchBit = (matchByte >> 7) & 1;
|
||||
+ matchByte <<= 1;
|
||||
+ #ifdef _LZMA_LOC_OPT
|
||||
+ {
|
||||
+ CProb *prob = probs + ((1 + matchBit) << 8) + symbol;
|
||||
+ RC_GET_BIT2(prob, symbol, bit = 0, bit = 1)
|
||||
+ }
|
||||
+ #else
|
||||
+ bit = RangeDecoderBitDecode(probs + ((1 + matchBit) << 8) + symbol, rd);
|
||||
+ symbol = (symbol << 1) | bit;
|
||||
+ #endif
|
||||
+ if (matchBit != bit)
|
||||
+ {
|
||||
+ while (symbol < 0x100)
|
||||
+ {
|
||||
+ #ifdef _LZMA_LOC_OPT
|
||||
+ CProb *prob = probs + symbol;
|
||||
+ RC_GET_BIT(prob, symbol)
|
||||
+ #else
|
||||
+ symbol = (symbol + symbol) | RangeDecoderBitDecode(probs + symbol, rd);
|
||||
+ #endif
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ while (symbol < 0x100);
|
||||
+ #ifdef _LZMA_LOC_OPT
|
||||
+ RC_FLUSH_VAR
|
||||
+ #endif
|
||||
+ return symbol;
|
||||
+}
|
||||
+
|
||||
+#define kNumPosBitsMax 4
|
||||
+#define kNumPosStatesMax (1 << kNumPosBitsMax)
|
||||
+
|
||||
+#define kLenNumLowBits 3
|
||||
+#define kLenNumLowSymbols (1 << kLenNumLowBits)
|
||||
+#define kLenNumMidBits 3
|
||||
+#define kLenNumMidSymbols (1 << kLenNumMidBits)
|
||||
+#define kLenNumHighBits 8
|
||||
+#define kLenNumHighSymbols (1 << kLenNumHighBits)
|
||||
+
|
||||
+#define LenChoice 0
|
||||
+#define LenChoice2 (LenChoice + 1)
|
||||
+#define LenLow (LenChoice2 + 1)
|
||||
+#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits))
|
||||
+#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits))
|
||||
+#define kNumLenProbs (LenHigh + kLenNumHighSymbols)
|
||||
+
|
||||
+int LzmaLenDecode(CProb *p, CRangeDecoder *rd, int posState)
|
||||
+{
|
||||
+ if(RangeDecoderBitDecode(p + LenChoice, rd) == 0)
|
||||
+ return RangeDecoderBitTreeDecode(p + LenLow +
|
||||
+ (posState << kLenNumLowBits), kLenNumLowBits, rd);
|
||||
+ if(RangeDecoderBitDecode(p + LenChoice2, rd) == 0)
|
||||
+ return kLenNumLowSymbols + RangeDecoderBitTreeDecode(p + LenMid +
|
||||
+ (posState << kLenNumMidBits), kLenNumMidBits, rd);
|
||||
+ return kLenNumLowSymbols + kLenNumMidSymbols +
|
||||
+ RangeDecoderBitTreeDecode(p + LenHigh, kLenNumHighBits, rd);
|
||||
+}
|
||||
+
|
||||
+#define kNumStates 12
|
||||
+
|
||||
+#define kStartPosModelIndex 4
|
||||
+#define kEndPosModelIndex 14
|
||||
+#define kNumFullDistances (1 << (kEndPosModelIndex >> 1))
|
||||
+
|
||||
+#define kNumPosSlotBits 6
|
||||
+#define kNumLenToPosStates 4
|
||||
+
|
||||
+#define kNumAlignBits 4
|
||||
+#define kAlignTableSize (1 << kNumAlignBits)
|
||||
+
|
||||
+#define kMatchMinLen 2
|
||||
+
|
||||
+#define IsMatch 0
|
||||
+#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax))
|
||||
+#define IsRepG0 (IsRep + kNumStates)
|
||||
+#define IsRepG1 (IsRepG0 + kNumStates)
|
||||
+#define IsRepG2 (IsRepG1 + kNumStates)
|
||||
+#define IsRep0Long (IsRepG2 + kNumStates)
|
||||
+#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax))
|
||||
+#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits))
|
||||
+#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex)
|
||||
+#define LenCoder (Align + kAlignTableSize)
|
||||
+#define RepLenCoder (LenCoder + kNumLenProbs)
|
||||
+#define Literal (RepLenCoder + kNumLenProbs)
|
||||
+
|
||||
+#if Literal != LZMA_BASE_SIZE
|
||||
+StopCompilingDueBUG
|
||||
+#endif
|
||||
+
|
||||
+#ifdef _LZMA_OUT_READ
|
||||
+
|
||||
+typedef struct _LzmaVarState
|
||||
+{
|
||||
+ CRangeDecoder RangeDecoder;
|
||||
+ Byte *Dictionary;
|
||||
+ UInt32 DictionarySize;
|
||||
+ UInt32 DictionaryPos;
|
||||
+ UInt32 GlobalPos;
|
||||
+ UInt32 Reps[4];
|
||||
+ int lc;
|
||||
+ int lp;
|
||||
+ int pb;
|
||||
+ int State;
|
||||
+ int PreviousIsMatch;
|
||||
+ int RemainLen;
|
||||
+} LzmaVarState;
|
||||
+
|
||||
+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
|
||||
+ )
|
||||
+{
|
||||
+ LzmaVarState *vs = (LzmaVarState *)buffer;
|
||||
+ CProb *p = (CProb *)(buffer + sizeof(LzmaVarState));
|
||||
+ UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + lp));
|
||||
+ UInt32 i;
|
||||
+ if (bufferSize < numProbs * sizeof(CProb) + sizeof(LzmaVarState))
|
||||
+ return LZMA_RESULT_NOT_ENOUGH_MEM;
|
||||
+ vs->Dictionary = dictionary;
|
||||
+ vs->DictionarySize = dictionarySize;
|
||||
+ vs->DictionaryPos = 0;
|
||||
+ vs->GlobalPos = 0;
|
||||
+ vs->Reps[0] = vs->Reps[1] = vs->Reps[2] = vs->Reps[3] = 1;
|
||||
+ vs->lc = lc;
|
||||
+ vs->lp = lp;
|
||||
+ vs->pb = pb;
|
||||
+ vs->State = 0;
|
||||
+ vs->PreviousIsMatch = 0;
|
||||
+ vs->RemainLen = 0;
|
||||
+ dictionary[dictionarySize - 1] = 0;
|
||||
+ for (i = 0; i < numProbs; i++)
|
||||
+ p[i] = kBitModelTotal >> 1;
|
||||
+ RangeDecoderInit(&vs->RangeDecoder,
|
||||
+ #ifdef _LZMA_IN_CB
|
||||
+ inCallback
|
||||
+ #else
|
||||
+ inStream, inSize
|
||||
+ #endif
|
||||
+ );
|
||||
+ return LZMA_RESULT_OK;
|
||||
+}
|
||||
+
|
||||
+int LzmaDecode(unsigned char *buffer,
|
||||
+ unsigned char *outStream, UInt32 outSize,
|
||||
+ UInt32 *outSizeProcessed)
|
||||
+{
|
||||
+ LzmaVarState *vs = (LzmaVarState *)buffer;
|
||||
+ CProb *p = (CProb *)(buffer + sizeof(LzmaVarState));
|
||||
+ CRangeDecoder rd = vs->RangeDecoder;
|
||||
+ int state = vs->State;
|
||||
+ int previousIsMatch = vs->PreviousIsMatch;
|
||||
+ Byte previousByte;
|
||||
+ UInt32 rep0 = vs->Reps[0], rep1 = vs->Reps[1], rep2 = vs->Reps[2], rep3 = vs->Reps[3];
|
||||
+ UInt32 nowPos = 0;
|
||||
+ UInt32 posStateMask = (1 << (vs->pb)) - 1;
|
||||
+ UInt32 literalPosMask = (1 << (vs->lp)) - 1;
|
||||
+ int lc = vs->lc;
|
||||
+ int len = vs->RemainLen;
|
||||
+ UInt32 globalPos = vs->GlobalPos;
|
||||
+
|
||||
+ Byte *dictionary = vs->Dictionary;
|
||||
+ UInt32 dictionarySize = vs->DictionarySize;
|
||||
+ UInt32 dictionaryPos = vs->DictionaryPos;
|
||||
+
|
||||
+ if (len == -1)
|
||||
+ {
|
||||
+ *outSizeProcessed = 0;
|
||||
+ return LZMA_RESULT_OK;
|
||||
+ }
|
||||
+
|
||||
+ while(len > 0 && nowPos < outSize)
|
||||
+ {
|
||||
+ UInt32 pos = dictionaryPos - rep0;
|
||||
+ if (pos >= dictionarySize)
|
||||
+ pos += dictionarySize;
|
||||
+ outStream[nowPos++] = dictionary[dictionaryPos] = dictionary[pos];
|
||||
+ if (++dictionaryPos == dictionarySize)
|
||||
+ dictionaryPos = 0;
|
||||
+ len--;
|
||||
+ }
|
||||
+ if (dictionaryPos == 0)
|
||||
+ previousByte = dictionary[dictionarySize - 1];
|
||||
+ else
|
||||
+ previousByte = dictionary[dictionaryPos - 1];
|
||||
+#else
|
||||
+
|
||||
+int LzmaDecode(
|
||||
+ Byte *buffer, UInt32 bufferSize,
|
||||
+ int lc, int lp, int pb,
|
||||
+ #ifdef _LZMA_IN_CB
|
||||
+ ILzmaInCallback *inCallback,
|
||||
+ #else
|
||||
+ unsigned char *inStream, UInt32 inSize,
|
||||
+ #endif
|
||||
+ unsigned char *outStream, UInt32 outSize,
|
||||
+ UInt32 *outSizeProcessed)
|
||||
+{
|
||||
+ UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + lp));
|
||||
+ CProb *p = (CProb *)buffer;
|
||||
+ CRangeDecoder rd;
|
||||
+ UInt32 i;
|
||||
+ int state = 0;
|
||||
+ int previousIsMatch = 0;
|
||||
+ Byte previousByte = 0;
|
||||
+ UInt32 rep0 = 1, rep1 = 1, rep2 = 1, rep3 = 1;
|
||||
+ UInt32 nowPos = 0;
|
||||
+ UInt32 posStateMask = (1 << pb) - 1;
|
||||
+ UInt32 literalPosMask = (1 << lp) - 1;
|
||||
+ int len = 0;
|
||||
+ if (bufferSize < numProbs * sizeof(CProb))
|
||||
+ return LZMA_RESULT_NOT_ENOUGH_MEM;
|
||||
+ for (i = 0; i < numProbs; i++)
|
||||
+ p[i] = kBitModelTotal >> 1;
|
||||
+ RangeDecoderInit(&rd,
|
||||
+ #ifdef _LZMA_IN_CB
|
||||
+ inCallback
|
||||
+ #else
|
||||
+ inStream, inSize
|
||||
+ #endif
|
||||
+ );
|
||||
+#endif
|
||||
+
|
||||
+ *outSizeProcessed = 0;
|
||||
+ while(nowPos < outSize)
|
||||
+ {
|
||||
+ int posState = (int)(
|
||||
+ (nowPos
|
||||
+ #ifdef _LZMA_OUT_READ
|
||||
+ + globalPos
|
||||
+ #endif
|
||||
+ )
|
||||
+ & posStateMask);
|
||||
+ #ifdef _LZMA_IN_CB
|
||||
+ if (rd.Result != LZMA_RESULT_OK)
|
||||
+ return rd.Result;
|
||||
+ #endif
|
||||
+ if (rd.ExtraBytes != 0)
|
||||
+ return LZMA_RESULT_DATA_ERROR;
|
||||
+ if (RangeDecoderBitDecode(p + IsMatch + (state << kNumPosBitsMax) + posState, &rd) == 0)
|
||||
+ {
|
||||
+ CProb *probs = p + Literal + (LZMA_LIT_SIZE *
|
||||
+ (((
|
||||
+ (nowPos
|
||||
+ #ifdef _LZMA_OUT_READ
|
||||
+ + globalPos
|
||||
+ #endif
|
||||
+ )
|
||||
+ & literalPosMask) << lc) + (previousByte >> (8 - lc))));
|
||||
+
|
||||
+ if (state < 4) state = 0;
|
||||
+ else if (state < 10) state -= 3;
|
||||
+ else state -= 6;
|
||||
+ if (previousIsMatch)
|
||||
+ {
|
||||
+ Byte matchByte;
|
||||
+ #ifdef _LZMA_OUT_READ
|
||||
+ UInt32 pos = dictionaryPos - rep0;
|
||||
+ if (pos >= dictionarySize)
|
||||
+ pos += dictionarySize;
|
||||
+ matchByte = dictionary[pos];
|
||||
+ #else
|
||||
+ matchByte = outStream[nowPos - rep0];
|
||||
+ #endif
|
||||
+ previousByte = LzmaLiteralDecodeMatch(probs, &rd, matchByte);
|
||||
+ previousIsMatch = 0;
|
||||
+ }
|
||||
+ else
|
||||
+ previousByte = LzmaLiteralDecode(probs, &rd);
|
||||
+ outStream[nowPos++] = previousByte;
|
||||
+ #ifdef _LZMA_OUT_READ
|
||||
+ dictionary[dictionaryPos] = previousByte;
|
||||
+ if (++dictionaryPos == dictionarySize)
|
||||
+ dictionaryPos = 0;
|
||||
+ #endif
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ previousIsMatch = 1;
|
||||
+ if (RangeDecoderBitDecode(p + IsRep + state, &rd) == 1)
|
||||
+ {
|
||||
+ if (RangeDecoderBitDecode(p + IsRepG0 + state, &rd) == 0)
|
||||
+ {
|
||||
+ if (RangeDecoderBitDecode(p + IsRep0Long + (state << kNumPosBitsMax) + posState, &rd) == 0)
|
||||
+ {
|
||||
+ #ifdef _LZMA_OUT_READ
|
||||
+ UInt32 pos;
|
||||
+ #endif
|
||||
+ if (
|
||||
+ (nowPos
|
||||
+ #ifdef _LZMA_OUT_READ
|
||||
+ + globalPos
|
||||
+ #endif
|
||||
+ )
|
||||
+ == 0)
|
||||
+ return LZMA_RESULT_DATA_ERROR;
|
||||
+ state = state < 7 ? 9 : 11;
|
||||
+ #ifdef _LZMA_OUT_READ
|
||||
+ pos = dictionaryPos - rep0;
|
||||
+ if (pos >= dictionarySize)
|
||||
+ pos += dictionarySize;
|
||||
+ previousByte = dictionary[pos];
|
||||
+ dictionary[dictionaryPos] = previousByte;
|
||||
+ if (++dictionaryPos == dictionarySize)
|
||||
+ dictionaryPos = 0;
|
||||
+ #else
|
||||
+ previousByte = outStream[nowPos - rep0];
|
||||
+ #endif
|
||||
+ outStream[nowPos++] = previousByte;
|
||||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ UInt32 distance;
|
||||
+ if(RangeDecoderBitDecode(p + IsRepG1 + state, &rd) == 0)
|
||||
+ distance = rep1;
|
||||
+ else
|
||||
+ {
|
||||
+ if(RangeDecoderBitDecode(p + IsRepG2 + state, &rd) == 0)
|
||||
+ distance = rep2;
|
||||
+ else
|
||||
+ {
|
||||
+ distance = rep3;
|
||||
+ rep3 = rep2;
|
||||
+ }
|
||||
+ rep2 = rep1;
|
||||
+ }
|
||||
+ rep1 = rep0;
|
||||
+ rep0 = distance;
|
||||
+ }
|
||||
+ len = LzmaLenDecode(p + RepLenCoder, &rd, posState);
|
||||
+ state = state < 7 ? 8 : 11;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ int posSlot;
|
||||
+ rep3 = rep2;
|
||||
+ rep2 = rep1;
|
||||
+ rep1 = rep0;
|
||||
+ state = state < 7 ? 7 : 10;
|
||||
+ len = LzmaLenDecode(p + LenCoder, &rd, posState);
|
||||
+ posSlot = RangeDecoderBitTreeDecode(p + PosSlot +
|
||||
+ ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) <<
|
||||
+ kNumPosSlotBits), kNumPosSlotBits, &rd);
|
||||
+ if (posSlot >= kStartPosModelIndex)
|
||||
+ {
|
||||
+ int numDirectBits = ((posSlot >> 1) - 1);
|
||||
+ rep0 = ((2 | ((UInt32)posSlot & 1)) << numDirectBits);
|
||||
+ if (posSlot < kEndPosModelIndex)
|
||||
+ {
|
||||
+ rep0 += RangeDecoderReverseBitTreeDecode(
|
||||
+ p + SpecPos + rep0 - posSlot - 1, numDirectBits, &rd);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ rep0 += RangeDecoderDecodeDirectBits(&rd,
|
||||
+ numDirectBits - kNumAlignBits) << kNumAlignBits;
|
||||
+ rep0 += RangeDecoderReverseBitTreeDecode(p + Align, kNumAlignBits, &rd);
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ rep0 = posSlot;
|
||||
+ rep0++;
|
||||
+ }
|
||||
+ if (rep0 == (UInt32)(0))
|
||||
+ {
|
||||
+ /* it's for stream version */
|
||||
+ len = -1;
|
||||
+ break;
|
||||
+ }
|
||||
+ if (rep0 > nowPos
|
||||
+ #ifdef _LZMA_OUT_READ
|
||||
+ + globalPos
|
||||
+ #endif
|
||||
+ )
|
||||
+ {
|
||||
+ return LZMA_RESULT_DATA_ERROR;
|
||||
+ }
|
||||
+ len += kMatchMinLen;
|
||||
+ do
|
||||
+ {
|
||||
+ #ifdef _LZMA_OUT_READ
|
||||
+ UInt32 pos = dictionaryPos - rep0;
|
||||
+ if (pos >= dictionarySize)
|
||||
+ pos += dictionarySize;
|
||||
+ previousByte = dictionary[pos];
|
||||
+ dictionary[dictionaryPos] = previousByte;
|
||||
+ if (++dictionaryPos == dictionarySize)
|
||||
+ dictionaryPos = 0;
|
||||
+ #else
|
||||
+ previousByte = outStream[nowPos - rep0];
|
||||
+ #endif
|
||||
+ outStream[nowPos++] = previousByte;
|
||||
+ len--;
|
||||
+ }
|
||||
+ while(len > 0 && nowPos < outSize);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ #ifdef _LZMA_OUT_READ
|
||||
+ vs->RangeDecoder = rd;
|
||||
+ vs->DictionaryPos = dictionaryPos;
|
||||
+ vs->GlobalPos = globalPos + nowPos;
|
||||
+ vs->Reps[0] = rep0;
|
||||
+ vs->Reps[1] = rep1;
|
||||
+ vs->Reps[2] = rep2;
|
||||
+ vs->Reps[3] = rep3;
|
||||
+ vs->State = state;
|
||||
+ vs->PreviousIsMatch = previousIsMatch;
|
||||
+ vs->RemainLen = len;
|
||||
+ #endif
|
||||
+
|
||||
+ *outSizeProcessed = nowPos;
|
||||
+ return LZMA_RESULT_OK;
|
||||
+}
|
||||
--- linuz/fs/squashfs/LzmaDecode.h 1970-01-01 03:00:00.000000000 +0300
|
||||
+++ linux/fs/squashfs/LzmaDecode.h 2005-01-20 19:40:36.794301664 +0300
|
||||
@@ -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
|
||||
--- linuz/fs/squashfs/Makefile 2004-12-15 22:56:47.000000000 +0300
|
||||
+++ linux/fs/squashfs/Makefile 2005-01-19 23:04:25.000000000 +0300
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
O_TARGET := squashfs.o
|
||||
|
||||
-obj-y := inode.o
|
||||
+obj-y := inode.o LzmaDecode.o
|
||||
|
||||
obj-m := $(O_TARGET)
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,720 @@
|
|||
diff -urN linux-2.4.29.old/include/linux/netfilter_ipv4/ipt_ipp2p.h linux-2.4.29/include/linux/netfilter_ipv4/ipt_ipp2p.h
|
||||
--- linux-2.4.29.old/include/linux/netfilter_ipv4/ipt_ipp2p.h 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ linux-2.4.29/include/linux/netfilter_ipv4/ipt_ipp2p.h 2005-03-12 00:44:17.000000000 +0100
|
||||
@@ -0,0 +1,29 @@
|
||||
+#ifndef __IPT_IPP2P_H
|
||||
+#define __IPT_IPP2P_H
|
||||
+#define IPP2P_VERSION "0.7.4"
|
||||
+
|
||||
+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 2
|
||||
+#define IPP2P_DATA_KAZAA 8
|
||||
+#define IPP2P_DATA_EDK 16
|
||||
+#define IPP2P_DATA_DC 32
|
||||
+#define IPP2P_DC 64
|
||||
+#define IPP2P_DATA_GNU 128
|
||||
+#define IPP2P_GNU 256
|
||||
+#define IPP2P_KAZAA 512
|
||||
+#define IPP2P_BIT 1024
|
||||
+#define IPP2P_APPLE 2048
|
||||
+#define IPP2P_SOUL 4096
|
||||
+#define IPP2P_WINMX 8192
|
||||
+#define IPP2P_ARES 16384
|
||||
+
|
||||
diff -urN linux-2.4.29.old/net/ipv4/netfilter/Config.in linux-2.4.29/net/ipv4/netfilter/Config.in
|
||||
--- linux-2.4.29.old/net/ipv4/netfilter/Config.in 2005-03-12 00:40:38.000000000 +0100
|
||||
+++ linux-2.4.29/net/ipv4/netfilter/Config.in 2005-03-12 00:42:57.000000000 +0100
|
||||
@@ -26,6 +26,7 @@
|
||||
dep_tristate ' TOS match support' CONFIG_IP_NF_MATCH_TOS $CONFIG_IP_NF_IPTABLES
|
||||
dep_tristate ' recent match support' CONFIG_IP_NF_MATCH_RECENT $CONFIG_IP_NF_IPTABLES
|
||||
dep_tristate ' ECN match support' CONFIG_IP_NF_MATCH_ECN $CONFIG_IP_NF_IPTABLES
|
||||
+ dep_tristate ' peer to peer traffic match support' CONFIG_IP_NF_MATCH_IPP2P $CONFIG_IP_NF_IPTABLES
|
||||
|
||||
dep_tristate ' DSCP match support' CONFIG_IP_NF_MATCH_DSCP $CONFIG_IP_NF_IPTABLES
|
||||
|
||||
diff -urN linux-2.4.29.old/net/ipv4/netfilter/ipt_ipp2p.c linux-2.4.29/net/ipv4/netfilter/ipt_ipp2p.c
|
||||
--- linux-2.4.29.old/net/ipv4/netfilter/ipt_ipp2p.c 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ linux-2.4.29/net/ipv4/netfilter/ipt_ipp2p.c 2005-03-12 00:44:02.000000000 +0100
|
||||
@@ -0,0 +1,661 @@
|
||||
+#if defined(MODVERSIONS)
|
||||
+#include <linux/modversions.h>
|
||||
+#endif
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/netfilter_ipv4/ip_tables.h>
|
||||
+#include <linux/version.h>
|
||||
+#include <linux/netfilter_ipv4/ipt_ipp2p.h>
|
||||
+//#include "ipt_ipp2p.h"
|
||||
+#include <net/tcp.h>
|
||||
+#include <net/udp.h>
|
||||
+
|
||||
+#define get_u8(X,O) (*(__u8 *)(X + O))
|
||||
+#define get_u16(X,O) (*(__u16 *)(X + O))
|
||||
+#define get_u32(X,O) (*(__u32 *)(X + O))
|
||||
+
|
||||
+MODULE_AUTHOR("Eicke Friedrich <ipp2p@ipp2p.org>");
|
||||
+MODULE_DESCRIPTION("An extension to iptables to identify P2P traffic.");
|
||||
+MODULE_LICENSE("GPL");
|
||||
+
|
||||
+
|
||||
+/*Search for UDP eDonkey/eMule/Kad commands*/
|
||||
+int
|
||||
+udp_search_edk (unsigned char *haystack, int packet_len)
|
||||
+{
|
||||
+ unsigned char *t = haystack;
|
||||
+ t += 8;
|
||||
+
|
||||
+ switch (t[0]) {
|
||||
+ case 0xe3: { /*edonkey*/
|
||||
+ switch (t[1]) {
|
||||
+ /* e3 9a + 16Bytes Hash | size == 26 */
|
||||
+ case 0x9a: if (packet_len == 26) return ((IPP2P_EDK * 100) + 1);
|
||||
+ /* e3 96 xx yy zz kk | size == 14 | server status request */
|
||||
+ case 0x96: if (packet_len == 14) return ((IPP2P_EDK * 100) + 2);
|
||||
+ /* e3 a2 | size == 10 or 14 <-- recheck*/
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ case 0xc5: { /*emule*/
|
||||
+ switch (t[1]) {
|
||||
+ /* c5 91 xx yy | size == 12 (8+4) | xx != 0x00 -- xx yy queue rating */
|
||||
+ case 0x91: if ((packet_len == 12) && (t[2] != 0x00)) return ((IPP2P_EDK * 100) + 3);
|
||||
+ /* c5 90 xx .. yy | size == 26 (8+2+16) | xx .. yy == hash -- file ping */
|
||||
+ case 0x90: if ((packet_len == 26) && (t[2] != 0x00)) return ((IPP2P_EDK * 100) + 4);
|
||||
+ /* c5 92 | size == 10 (8+2) -- file not found */
|
||||
+ case 0x92: if (packet_len == 10) return ((IPP2P_EDK * 100) + 5);
|
||||
+ /* c5 93 | size == 10 (8+2) -- queue full */
|
||||
+ case 0x93: if (packet_len == 10) return ((IPP2P_EDK * 100) + 6);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ case 0xe4: { /*kad*/
|
||||
+ switch (t[1]) {
|
||||
+ /* e4 50 | size == 12 */
|
||||
+ case 0x50: if (packet_len == 12) return ((IPP2P_EDK * 100) + 7);
|
||||
+ /* e4 58 | size == 14 */
|
||||
+ case 0x58: if ((packet_len == 14) && (t[2] != 0x00)) return ((IPP2P_EDK * 100) + 8);
|
||||
+ /* e4 59 | size == 10 */
|
||||
+ case 0x59: if (packet_len == 10) return ((IPP2P_EDK * 100) + 9);
|
||||
+ /* e4 30 .. | t[18] == 0x01 | size > 26 | --> search */
|
||||
+ case 0x30: if ((packet_len > 26) && (t[18] == 0x01)) return ((IPP2P_EDK * 100) + 10);
|
||||
+ /* e4 28 .. 00 | t[68] == 0x00 | size > 76 */
|
||||
+ case 0x28: if ((packet_len > 76) && (t[68] == 0x00)) return ((IPP2P_EDK * 100) + 11);
|
||||
+ /* e4 20 .. | size == 43 */
|
||||
+ case 0x20: if ((packet_len == 43) && (t[2] != 0x00) && (t[34] != 0x00)) return ((IPP2P_EDK * 100) + 12);
|
||||
+ /* e4 00 .. 00 | size == 35 ? */
|
||||
+ case 0x00: if ((packet_len == 35) && (t[26] == 0x00)) return ((IPP2P_EDK * 100) + 13);
|
||||
+ /* e4 10 .. 00 | size == 35 ? */
|
||||
+ case 0x10: if ((packet_len == 35) && (t[26] == 0x00)) return ((IPP2P_EDK * 100) + 14);
|
||||
+ /* e4 18 .. 00 | size == 35 ? */
|
||||
+ case 0x18: if ((packet_len == 35) && (t[26] == 0x00)) return ((IPP2P_EDK * 100) + 15);
|
||||
+ /* e4 40 .. | t[18] == 0x01 | t[19] == 0x00 | size > 40 */
|
||||
+ case 0x40: if ((packet_len > 40) && (t[18] == 0x01) && (t[19] == 0x00)) return ((IPP2P_EDK * 100) + 16);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ default: return 0;
|
||||
+ } /* end of switch (t[0]) */
|
||||
+}/*udp_search_edk*/
|
||||
+
|
||||
+
|
||||
+/*Search for UDP Gnutella commands*/
|
||||
+int
|
||||
+udp_search_gnu (unsigned char *haystack, int packet_len)
|
||||
+{
|
||||
+ unsigned char *t = haystack;
|
||||
+ t += 8;
|
||||
+
|
||||
+ if (memcmp(t, "GND", 3) == 0) return ((IPP2P_GNU * 100) + 1);
|
||||
+ if (memcmp(t, "GNUTELLA ", 9) == 0) return ((IPP2P_GNU * 100) + 2);
|
||||
+ return 0;
|
||||
+}/*udp_search_gnu*/
|
||||
+
|
||||
+
|
||||
+/*Search for UDP KaZaA commands*/
|
||||
+int
|
||||
+udp_search_kazaa (unsigned char *haystack, int packet_len)
|
||||
+{
|
||||
+ unsigned char *t = haystack;
|
||||
+
|
||||
+ if (t[packet_len-1] == 0x00){
|
||||
+ t += (packet_len - 6);
|
||||
+ if (memcmp(t, "KaZaA", 5) == 0) return (IPP2P_KAZAA * 100);
|
||||
+ }
|
||||
+ return 0;
|
||||
+}/*udp_search_kazaa*/
|
||||
+
|
||||
+
|
||||
+/*Search for UDP BitTorrent commands*/
|
||||
+int
|
||||
+udp_search_bit (unsigned char *haystack, int packet_len)
|
||||
+{
|
||||
+ unsigned char *t = haystack;
|
||||
+
|
||||
+ /* packet_len has to be 24 */
|
||||
+ if (packet_len != 24) return 0;
|
||||
+
|
||||
+ t += 8;
|
||||
+
|
||||
+ /* ^ 00 00 04 17 27 10 19 80 */
|
||||
+ if ((ntohl(get_u32(t, 0)) == 0x00000417) && (ntohl(get_u32(t, 4)) == 0x27101980)) return (IPP2P_BIT * 100);
|
||||
+
|
||||
+ return 0;
|
||||
+}/*udp_search_bit*/
|
||||
+
|
||||
+
|
||||
+
|
||||
+/*Search for Ares commands*/
|
||||
+int
|
||||
+search_ares (unsigned char *haystack, int packet_len, int head_len)
|
||||
+{
|
||||
+ unsigned char *t = haystack;
|
||||
+ t += head_len;
|
||||
+
|
||||
+ if ((packet_len - head_len) == 6){ /* possible connect command*/
|
||||
+ if ((t[0] == 0x03) && (t[1] == 0x00) && (t[2] == 0x5a) && (t[3] == 0x04) && (t[4] == 0x03) && (t[5] == 0x05))
|
||||
+ return ((IPP2P_ARES * 100) + 1); /* found connect packet: 03 00 5a 04 03 05 */
|
||||
+ }
|
||||
+ if ((packet_len - head_len) == 60){ /* possible download command*/
|
||||
+ if ((t[59] == 0x0a) && (t[58] == 0x0a)){
|
||||
+ if (memcmp(t, "PUSH SHA1:", 10) == 0) /* found download command */
|
||||
+ return ((IPP2P_ARES * 100) + 2);
|
||||
+ }
|
||||
+ }
|
||||
+ return 0;
|
||||
+} /*search_ares*/
|
||||
+
|
||||
+
|
||||
+/*Search for SoulSeek commands*/
|
||||
+int
|
||||
+search_soul (unsigned char *haystack, int packet_len, int head_len)
|
||||
+{
|
||||
+ unsigned char *t = haystack;
|
||||
+ t += head_len;
|
||||
+
|
||||
+ if (get_u16(t, 0) == (packet_len - head_len - 4)){
|
||||
+ /* xx xx 00 00 yy zz 00 00 .. | xx = sizeof(payload) - 4 */
|
||||
+ if ((get_u16(t,2) == 0x0000) &&(t[4] != 0x00) && (get_u16(t,6) == 0x0000))
|
||||
+ return ((IPP2P_SOUL * 100) + 1);
|
||||
+ } else {
|
||||
+ /* 00 00 00 00 00 00 00 00 + sizeof(payload) == 8*/
|
||||
+ if (((packet_len - head_len) == 8) && (get_u32(t, 0) == 0x00000000) && (get_u32(t, 4) == 0x00000000))
|
||||
+ return ((IPP2P_SOUL * 100) + 2);
|
||||
+ }
|
||||
+
|
||||
+ /* 01 xx 00 00 00 yy .. zz 00 00 00 .. | xx == sizeof(nick) | yy .. zz == nick */
|
||||
+ if ((t[0] == 0x01) && (t[2] == 0x00) && (get_u16(t,3) == 0x0000) && ((packet_len - head_len) > ((get_u8(t,1))+6)) &&
|
||||
+ (t[(get_u8(t,1))+4] != 0x00) && (t[(get_u8(t,1))+5] == 0x01) && (t[(get_u8(t,1))+6] == 0x00))
|
||||
+ return ((IPP2P_SOUL * 100) + 3);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/*Search for WinMX commands*/
|
||||
+int
|
||||
+search_winmx (unsigned char *haystack, int packet_len, int head_len)
|
||||
+{
|
||||
+ unsigned char *t = haystack;
|
||||
+ int c;
|
||||
+ t += head_len;
|
||||
+
|
||||
+ if (((packet_len - head_len) == 4) && (memcmp(t, "SEND", 4) == 0)) return ((IPP2P_WINMX * 100) + 1);
|
||||
+ if (((packet_len - head_len) == 3) && (memcmp(t, "GET", 3) == 0)) return ((IPP2P_WINMX * 100) + 2);
|
||||
+ if (packet_len < (head_len + 10)) return 0;
|
||||
+
|
||||
+ if ((memcmp(t, "SEND", 4) == 0) || (memcmp(t, "GET", 3) == 0)){
|
||||
+ c = head_len + 4;
|
||||
+ t += 4;
|
||||
+ while (c < packet_len - 5) {
|
||||
+ if ((t[0] == 0x20) && (t[1] == 0x22)){
|
||||
+ c += 2;
|
||||
+ t += 2;
|
||||
+ while (c < packet_len - 2) {
|
||||
+ if ((t[0] == 0x22) && (t[1] == 0x20)) return ((IPP2P_WINMX * 100) + 3);
|
||||
+ t++;
|
||||
+ c++;
|
||||
+ }
|
||||
+ }
|
||||
+ t++;
|
||||
+ c++;
|
||||
+ }
|
||||
+ }
|
||||
+ return 0;
|
||||
+} /*search_winmx*/
|
||||
+
|
||||
+
|
||||
+/*Search for appleJuice commands*/
|
||||
+int
|
||||
+search_apple (unsigned char *haystack, int packet_len, int head_len)
|
||||
+{
|
||||
+ unsigned char *t = haystack;
|
||||
+ t += head_len;
|
||||
+
|
||||
+ if ((memcmp(t, "ajprot", 6) == 0) && (t[6] == 0x0d) && (t[7] == 0x0a)) return (IPP2P_APPLE * 100);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/*Search for BitTorrent commands*/
|
||||
+int
|
||||
+search_bittorrent (unsigned char *haystack, int packet_len, int head_len)
|
||||
+{
|
||||
+
|
||||
+ unsigned char *t = haystack;
|
||||
+ if (*(haystack+head_len) != 0x13) return 0; /*Bail out of first byte != 0x13*/
|
||||
+
|
||||
+ t += head_len + 1;
|
||||
+
|
||||
+ if (memcmp(t, "BitTorrent protocol", 19) == 0) return (IPP2P_BIT * 100);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+
|
||||
+/*check for Kazaa get command*/
|
||||
+int
|
||||
+search_kazaa (unsigned char *haystack, int packet_len, int head_len)
|
||||
+{
|
||||
+ unsigned char *t = haystack;
|
||||
+
|
||||
+ if (!((*(haystack + packet_len - 2) == 0x0d) && (*(haystack + packet_len - 1) == 0x0a))) return 0;
|
||||
+
|
||||
+ t += head_len;
|
||||
+ if (memcmp(t, "GET /.hash=", 11) == 0)
|
||||
+ return (IPP2P_DATA_KAZAA * 100);
|
||||
+ else
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/*check for gnutella get command*/
|
||||
+int
|
||||
+search_gnu (unsigned char *haystack, int packet_len, int head_len)
|
||||
+{
|
||||
+ unsigned char *t = haystack;
|
||||
+
|
||||
+ if (!((*(haystack + packet_len - 2) == 0x0d) && (*(haystack + packet_len - 1) == 0x0a))) return 0;
|
||||
+
|
||||
+ t += head_len;
|
||||
+ if (memcmp(t, "GET /get/", 9) == 0) return ((IPP2P_DATA_GNU * 100) + 1);
|
||||
+ if (memcmp(t, "GET /uri-res/", 13) == 0) return ((IPP2P_DATA_GNU * 100) + 2);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/*check for gnutella get commands and other typical data*/
|
||||
+int
|
||||
+search_all_gnu (unsigned char *haystack, int packet_len, int head_len)
|
||||
+{
|
||||
+ unsigned char *t = haystack;
|
||||
+ int c;
|
||||
+
|
||||
+ if (!((*(haystack + packet_len - 2) == 0x0d) && (*(haystack + packet_len - 1) == 0x0a))) return 0;
|
||||
+
|
||||
+ t += head_len;
|
||||
+
|
||||
+ if (memcmp(t, "GNUTELLA CONNECT/", 17) == 0) return ((IPP2P_GNU * 100) + 1);
|
||||
+ if (memcmp(t, "GNUTELLA/", 9) == 0) return ((IPP2P_GNU * 100) + 2);
|
||||
+
|
||||
+ if ((memcmp(t, "GET /get/", 9) == 0) || (memcmp(t, "GET /uri-res/", 13) == 0))
|
||||
+ {
|
||||
+ c = head_len + 8;
|
||||
+ t += 8;
|
||||
+ while (c < packet_len - 22) {
|
||||
+ if ((t[0] == 0x0d) && (t[1] == 0x0a)) {
|
||||
+ t += 2;
|
||||
+ c += 2;
|
||||
+ if ((memcmp(t, "X-Gnutella-", 11) == 0) || (memcmp(t, "X-Queue:", 8) == 0)) return ((IPP2P_GNU * 100) + 3);
|
||||
+ } else {
|
||||
+ t++;
|
||||
+ c++;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/*check for KaZaA download commands and other typical data*/
|
||||
+int
|
||||
+search_all_kazaa (unsigned char *haystack, int packet_len, int head_len)
|
||||
+{
|
||||
+ unsigned char *t = haystack;
|
||||
+ int c;
|
||||
+
|
||||
+ if (!((*(haystack + packet_len - 2) == 0x0d) && (*(haystack + packet_len - 1) == 0x0a))) return 0;
|
||||
+
|
||||
+ t += head_len;
|
||||
+ if (memcmp(t, "GIVE ", 5) == 0) return ((IPP2P_KAZAA * 100) + 1);
|
||||
+
|
||||
+ if (memcmp(t, "GET /", 5) == 0) {
|
||||
+ c = head_len + 8;
|
||||
+ t += 8;
|
||||
+ while (c < packet_len - 22) {
|
||||
+ if ((t[0] == 0x0d) && (t[1] == 0x0a)) {
|
||||
+ t += 2;
|
||||
+ c += 2;
|
||||
+ if ( memcmp(t, "X-Kazaa-Username: ", 18) == 0 ) return ((IPP2P_KAZAA * 100) + 2);
|
||||
+ if ( memcmp(t, "User-Agent: PeerEnabler/", 24) == 0 ) return ((IPP2P_KAZAA * 100) + 3);
|
||||
+ } else {
|
||||
+ t++;
|
||||
+ c++;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/*fast check for edonkey file segment transfer command*/
|
||||
+int
|
||||
+search_edk (unsigned char *haystack, int packet_len, int head_len)
|
||||
+{
|
||||
+ if (*(haystack+head_len) != 0xe3)
|
||||
+ return 0;
|
||||
+ else {
|
||||
+ if (*(haystack+head_len+5) == 0x47)
|
||||
+ return (IPP2P_DATA_EDK * 100);
|
||||
+ else
|
||||
+ return 0;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+
|
||||
+
|
||||
+/*intensive but slower search for some edonkey packets including size-check*/
|
||||
+int
|
||||
+search_all_edk (unsigned char *haystack, int packet_len, int head_len)
|
||||
+{
|
||||
+ unsigned char *t = haystack;
|
||||
+ int cmd;
|
||||
+
|
||||
+ if (*(haystack+head_len) == 0xd4) {
|
||||
+ t += head_len;
|
||||
+ cmd = get_u16(t, 1);
|
||||
+ if (cmd == (packet_len - head_len - 5)) {
|
||||
+ switch (t[5]) {
|
||||
+ case 0x82: return ((IPP2P_EDK * 100) + 42);
|
||||
+ case 0x15: return ((IPP2P_EDK * 100) + 43);
|
||||
+ default: return 0;
|
||||
+ }
|
||||
+ }
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ if (*(haystack+head_len) == 0xc5) { /*search for additional eMule packets*/
|
||||
+ t += head_len;
|
||||
+ cmd = get_u16(t, 1);
|
||||
+
|
||||
+ if (cmd == (packet_len - head_len - 5)) {
|
||||
+ switch (t[5]) {
|
||||
+ case 0x01: return ((IPP2P_EDK * 100) + 30);
|
||||
+ case 0x02: return ((IPP2P_EDK * 100) + 31);
|
||||
+ case 0x60: return ((IPP2P_EDK * 100) + 32);
|
||||
+ case 0x81: return ((IPP2P_EDK * 100) + 33);
|
||||
+ case 0x82: return ((IPP2P_EDK * 100) + 34);
|
||||
+ case 0x85: return ((IPP2P_EDK * 100) + 35);
|
||||
+ case 0x86: return ((IPP2P_EDK * 100) + 36);
|
||||
+ case 0x87: return ((IPP2P_EDK * 100) + 37);
|
||||
+ case 0x40: return ((IPP2P_EDK * 100) + 38);
|
||||
+ case 0x92: return ((IPP2P_EDK * 100) + 39);
|
||||
+ case 0x93: return ((IPP2P_EDK * 100) + 40);
|
||||
+ case 0x12: return ((IPP2P_EDK * 100) + 41);
|
||||
+ default: return 0;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ if (*(haystack+head_len) != 0xe3)
|
||||
+ return 0;
|
||||
+ else {
|
||||
+ t += head_len;
|
||||
+ cmd = get_u16(t, 1);
|
||||
+ if (cmd == (packet_len - head_len - 5)) {
|
||||
+ switch (t[5]) {
|
||||
+ case 0x01: return ((IPP2P_EDK * 100) + 1); /*Client: hello or Server:hello*/
|
||||
+ case 0x50: return ((IPP2P_EDK * 100) + 2); /*Client: file status*/
|
||||
+ case 0x16: return ((IPP2P_EDK * 100) + 3); /*Client: search*/
|
||||
+ case 0x58: return ((IPP2P_EDK * 100) + 4); /*Client: file request*/
|
||||
+ case 0x48: return ((IPP2P_EDK * 100) + 5); /*???*/
|
||||
+ case 0x54: return ((IPP2P_EDK * 100) + 6); /*???*/
|
||||
+ case 0x47: return ((IPP2P_EDK * 100) + 7); /*Client: file segment request*/
|
||||
+ case 0x46: return ((IPP2P_EDK * 100) + 8); /*Client: download segment*/
|
||||
+ case 0x4c: return ((IPP2P_EDK * 100) + 9); /*Client: Hello-Answer*/
|
||||
+ case 0x4f: return ((IPP2P_EDK * 100) + 10); /*Client: file status request*/
|
||||
+ case 0x59: return ((IPP2P_EDK * 100) + 11); /*Client: file request answer*/
|
||||
+ case 0x65: return ((IPP2P_EDK * 100) + 12); /*Client: ???*/
|
||||
+ case 0x66: return ((IPP2P_EDK * 100) + 13); /*Client: ???*/
|
||||
+ case 0x51: return ((IPP2P_EDK * 100) + 14); /*Client: ???*/
|
||||
+ case 0x52: return ((IPP2P_EDK * 100) + 15); /*Client: ???*/
|
||||
+ case 0x4d: return ((IPP2P_EDK * 100) + 16); /*Client: ???*/
|
||||
+ case 0x5c: return ((IPP2P_EDK * 100) + 17); /*Client: ???*/
|
||||
+ case 0x38: return ((IPP2P_EDK * 100) + 18); /*Client: ???*/
|
||||
+ case 0x69: return ((IPP2P_EDK * 100) + 19); /*Client: ???*/
|
||||
+ case 0x19: return ((IPP2P_EDK * 100) + 20); /*Client: ???*/
|
||||
+ case 0x42: return ((IPP2P_EDK * 100) + 21); /*Client: ???*/
|
||||
+ case 0x34: return ((IPP2P_EDK * 100) + 22); /*Client: ???*/
|
||||
+ case 0x94: return ((IPP2P_EDK * 100) + 23); /*Client: ???*/
|
||||
+ case 0x1c: return ((IPP2P_EDK * 100) + 24); /*Client: ???*/
|
||||
+ case 0x6a: return ((IPP2P_EDK * 100) + 25); /*Client: ???*/
|
||||
+ default: return 0;
|
||||
+ }
|
||||
+ } else {
|
||||
+ if (cmd > packet_len - head_len - 5) {
|
||||
+ if ((t[3] == 0x00) && (t[4] == 0x00)) {
|
||||
+ if (t[5] == 0x01) return ((IPP2P_EDK * 100) + 26);
|
||||
+ if (t[5] == 0x4c) return ((IPP2P_EDK * 100) + 27);
|
||||
+ }
|
||||
+ return 0;
|
||||
+
|
||||
+ } /*non edk packet*/
|
||||
+ if (t[cmd+5] == 0xe3) return ((IPP2P_EDK * 100) + 28);/*found another edk-command*/
|
||||
+ if (t[cmd+5] == 0xc5) return ((IPP2P_EDK * 100) + 29);/*found an emule-command*/
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/*fast check for Direct Connect send command*/
|
||||
+int
|
||||
+search_dc (unsigned char *haystack, int packet_len, int head_len)
|
||||
+{
|
||||
+ unsigned char *t = haystack;
|
||||
+
|
||||
+ if (*(haystack+head_len) != 0x24 )
|
||||
+ return 0;
|
||||
+ else {
|
||||
+ t += head_len + 1;
|
||||
+ if (memcmp(t, "Send|", 5) == 0)
|
||||
+ return (IPP2P_DATA_DC * 100);
|
||||
+ else
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/*intensive but slower check for all direct connect packets*/
|
||||
+int
|
||||
+search_all_dc (unsigned char *haystack, int packet_len, int head_len)
|
||||
+{
|
||||
+ unsigned char *t = haystack;
|
||||
+
|
||||
+ if ((*(haystack + head_len) == 0x24) && (*(haystack + packet_len - 1) == 0x7c)) {
|
||||
+ t += head_len + 1;
|
||||
+ if (memcmp(t, "Lock ", 5) == 0) return ((IPP2P_DC * 100) + 1); /*hub: hello*/
|
||||
+ if (memcmp(t, "Key ", 4) == 0) return ((IPP2P_DC * 100) + 2); /*client: hello*/
|
||||
+ if (memcmp(t, "Hello ", 6) == 0) return ((IPP2P_DC * 100) + 3); /*hub:connected*/
|
||||
+ if (memcmp(t, "MyNick ", 7) == 0) return ((IPP2P_DC * 100) + 4); /*client-client: hello*/
|
||||
+ if (memcmp(t, "Search ", 7) == 0) return ((IPP2P_DC * 100) + 5); /*client: search*/
|
||||
+ if (memcmp(t, "Send", 4) == 0) return ((IPP2P_DC * 100) + 6); /*client: start download*/
|
||||
+ return 0;
|
||||
+ } else
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static struct {
|
||||
+ int command;
|
||||
+ __u8 short_hand; /*for fucntions included in short hands*/
|
||||
+ int packet_len;
|
||||
+ int (*function_name) (unsigned char *, int, int);
|
||||
+} matchlist[] = {
|
||||
+ {IPP2P_EDK,SHORT_HAND_IPP2P,40, &search_all_edk},
|
||||
+ {IPP2P_DATA_KAZAA,SHORT_HAND_DATA,200, &search_kazaa},
|
||||
+ {IPP2P_DATA_EDK,SHORT_HAND_DATA,60, &search_edk},
|
||||
+ {IPP2P_DATA_DC,SHORT_HAND_DATA,26, &search_dc},
|
||||
+ {IPP2P_DC,SHORT_HAND_IPP2P,25, search_all_dc},
|
||||
+ {IPP2P_DATA_GNU,SHORT_HAND_DATA,40, &search_gnu},
|
||||
+ {IPP2P_GNU,SHORT_HAND_IPP2P,35, &search_all_gnu},
|
||||
+ {IPP2P_KAZAA,SHORT_HAND_IPP2P,35, &search_all_kazaa},
|
||||
+ {IPP2P_BIT,SHORT_HAND_NONE,40, &search_bittorrent},
|
||||
+ {IPP2P_APPLE,SHORT_HAND_NONE,20, &search_apple},
|
||||
+ {IPP2P_SOUL,SHORT_HAND_NONE,25, &search_soul},
|
||||
+ {IPP2P_WINMX,SHORT_HAND_NONE,20, &search_winmx},
|
||||
+ {IPP2P_ARES,SHORT_HAND_NONE,25, &search_ares},
|
||||
+ {0,0,0,NULL}
|
||||
+};
|
||||
+
|
||||
+
|
||||
+static struct {
|
||||
+ int command;
|
||||
+ __u8 short_hand; /*for fucntions included in short hands*/
|
||||
+ int packet_len;
|
||||
+ int (*function_name) (unsigned char *, int);
|
||||
+} udp_list[] = {
|
||||
+ {IPP2P_KAZAA,SHORT_HAND_IPP2P,14, &udp_search_kazaa},
|
||||
+ {IPP2P_BIT,SHORT_HAND_NONE,23, &udp_search_bit},
|
||||
+ {IPP2P_GNU,SHORT_HAND_IPP2P,11, &udp_search_gnu},
|
||||
+ {IPP2P_EDK,SHORT_HAND_IPP2P,9, &udp_search_edk},
|
||||
+ {0,0,0,NULL}
|
||||
+};
|
||||
+
|
||||
+
|
||||
+static int
|
||||
+match(const struct sk_buff *skb,
|
||||
+ const struct net_device *in,
|
||||
+ const struct net_device *out,
|
||||
+ const void *matchinfo,
|
||||
+ int offset,
|
||||
+
|
||||
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
|
||||
+ const void *hdr,
|
||||
+ u_int16_t datalen,
|
||||
+#endif
|
||||
+
|
||||
+ int *hotdrop)
|
||||
+{
|
||||
+ const struct ipt_p2p_info *info = matchinfo;
|
||||
+ unsigned char *haystack;
|
||||
+ struct iphdr *ip = skb->nh.iph;
|
||||
+ int p2p_result = 0, i = 0;
|
||||
+ int head_len;
|
||||
+ int hlen = ntohs(ip->tot_len)-(ip->ihl*4); /*hlen = packet-data length*/
|
||||
+
|
||||
+ /*must not be a fragment*/
|
||||
+ if (offset) {
|
||||
+ if (info->debug) printk("IPP2P.match: offset found %i \n",offset);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ /*make sure that skb is linear*/
|
||||
+ if(skb_is_nonlinear(skb)){
|
||||
+ if (info->debug) printk("IPP2P.match: nonlinear skb found\n");
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ haystack=(char *)ip+(ip->ihl*4); /*haystack = packet data*/
|
||||
+
|
||||
+ switch (ip->protocol){
|
||||
+ case IPPROTO_TCP: /*what to do with a TCP packet*/
|
||||
+ {
|
||||
+ struct tcphdr *tcph = (void *) ip + ip->ihl * 4;
|
||||
+
|
||||
+ if (tcph->fin) return 0; /*if FIN bit is set bail out*/
|
||||
+ if (tcph->syn) return 0; /*if SYN bit is set bail out*/
|
||||
+ if (tcph->rst) return 0; /*if RST bit is set bail out*/
|
||||
+ head_len = tcph->doff * 4; /*get TCP-Header-Size*/
|
||||
+ while (matchlist[i].command) {
|
||||
+ if ((((info->cmd & matchlist[i].command) == matchlist[i].command) ||
|
||||
+ ((info->cmd & matchlist[i].short_hand) == matchlist[i].short_hand)) &&
|
||||
+ (hlen > matchlist[i].packet_len)) {
|
||||
+ p2p_result = matchlist[i].function_name(haystack, hlen, head_len);
|
||||
+ if (p2p_result)
|
||||
+ {
|
||||
+ if (info->debug) printk("IPP2P.debug:TCP-match: %i from: %u.%u.%u.%u:%i to: %u.%u.%u.%u:%i Length: %i\n",
|
||||
+ p2p_result, NIPQUAD(ip->saddr),ntohs(tcph->source), NIPQUAD(ip->daddr),ntohs(tcph->dest),hlen);
|
||||
+ return p2p_result;
|
||||
+ }
|
||||
+ }
|
||||
+ i++;
|
||||
+ }
|
||||
+ return p2p_result;
|
||||
+ }
|
||||
+
|
||||
+ case IPPROTO_UDP: /*what to do with an UDP packet*/
|
||||
+ {
|
||||
+ struct udphdr *udph = (void *) ip + ip->ihl * 4;
|
||||
+
|
||||
+ while (udp_list[i].command){
|
||||
+ if ((((info->cmd & udp_list[i].command) == udp_list[i].command) ||
|
||||
+ ((info->cmd & udp_list[i].short_hand) == udp_list[i].short_hand)) &&
|
||||
+ (hlen > udp_list[i].packet_len)) {
|
||||
+ p2p_result = udp_list[i].function_name(haystack, hlen);
|
||||
+ if (p2p_result){
|
||||
+ if (info->debug) printk("IPP2P.debug:UDP-match: %i from: %u.%u.%u.%u:%i to: %u.%u.%u.%u:%i Length: %i\n",
|
||||
+ p2p_result, NIPQUAD(ip->saddr),ntohs(udph->source), NIPQUAD(ip->daddr),ntohs(udph->dest),hlen);
|
||||
+ return p2p_result;
|
||||
+ }
|
||||
+ }
|
||||
+ i++;
|
||||
+ }
|
||||
+ return p2p_result;
|
||||
+ }
|
||||
+
|
||||
+ default: return 0;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+
|
||||
+
|
||||
+static int
|
||||
+checkentry(const char *tablename,
|
||||
+ const struct ipt_ip *ip,
|
||||
+ void *matchinfo,
|
||||
+ unsigned int matchsize,
|
||||
+ unsigned int hook_mask)
|
||||
+{
|
||||
+ /* Must specify -p tcp */
|
||||
+/* if (ip->proto != IPPROTO_TCP || (ip->invflags & IPT_INV_PROTO)) {
|
||||
+ * printk("ipp2p: Only works on TCP packets, use -p tcp\n");
|
||||
+ * return 0;
|
||||
+ * }*/
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+
|
||||
+
|
||||
+static struct ipt_match ipp2p_match = {
|
||||
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
|
||||
+ { NULL, NULL },
|
||||
+ "ipp2p",
|
||||
+ &match,
|
||||
+ &checkentry,
|
||||
+ NULL,
|
||||
+ THIS_MODULE
|
||||
+#endif
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
|
||||
+ .name = "ipp2p",
|
||||
+ .match = &match,
|
||||
+ .checkentry = &checkentry,
|
||||
+ .me = THIS_MODULE,
|
||||
+#endif
|
||||
+};
|
||||
+
|
||||
+
|
||||
+static int __init init(void)
|
||||
+{
|
||||
+ printk(KERN_INFO "IPP2P v%s loading\n", IPP2P_VERSION);
|
||||
+ return ipt_register_match(&ipp2p_match);
|
||||
+}
|
||||
+
|
||||
+static void __exit fini(void)
|
||||
+{
|
||||
+ ipt_unregister_match(&ipp2p_match);
|
||||
+ printk(KERN_INFO "IPP2P v%s unloaded\n", IPP2P_VERSION);
|
||||
+}
|
||||
+
|
||||
+module_init(init);
|
||||
+module_exit(fini);
|
||||
+
|
||||
+
|
||||
diff -urN linux-2.4.29.old/net/ipv4/netfilter/Makefile linux-2.4.29/net/ipv4/netfilter/Makefile
|
||||
--- linux-2.4.29.old/net/ipv4/netfilter/Makefile 2005-03-12 00:40:38.000000000 +0100
|
||||
+++ linux-2.4.29/net/ipv4/netfilter/Makefile 2005-03-12 00:42:57.000000000 +0100
|
||||
@@ -67,6 +67,7 @@
|
||||
obj-$(CONFIG_IP_NF_MATCH_LIMIT) += ipt_limit.o
|
||||
obj-$(CONFIG_IP_NF_MATCH_MARK) += ipt_mark.o
|
||||
obj-$(CONFIG_IP_NF_MATCH_MAC) += ipt_mac.o
|
||||
+obj-$(CONFIG_IP_NF_MATCH_IPP2P) += ipt_ipp2p.o
|
||||
|
||||
obj-$(CONFIG_IP_NF_MATCH_PKTTYPE) += ipt_pkttype.o
|
||||
obj-$(CONFIG_IP_NF_MATCH_MULTIPORT) += ipt_multiport.o
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,20 @@
|
|||
--- ../../buildroot-unpacked/build_mipsel/linux/net/ipv4/netfilter/ip_conntrack_core.c 2004-11-28 22:59:36.000000000 -0500
|
||||
+++ linux/net/ipv4/netfilter/ip_conntrack_core.c 2004-11-30 05:05:32.000000000 -0500
|
||||
@@ -1386,7 +1386,7 @@
|
||||
nf_unregister_sockopt(&so_getorigdst);
|
||||
}
|
||||
|
||||
-static int hashsize = 0;
|
||||
+static int hashsize = 5953;
|
||||
MODULE_PARM(hashsize, "i");
|
||||
|
||||
int __init ip_conntrack_init(void)
|
||||
@@ -1407,7 +1407,7 @@
|
||||
if (ip_conntrack_htable_size < 16)
|
||||
ip_conntrack_htable_size = 16;
|
||||
}
|
||||
- ip_conntrack_max = 8 * ip_conntrack_htable_size;
|
||||
+ ip_conntrack_max = ip_conntrack_htable_size;
|
||||
|
||||
printk("ip_conntrack version %s (%u buckets, %d max)"
|
||||
" - %Zd bytes per conntrack\n", IP_CONNTRACK_VERSION,
|
|
@ -0,0 +1,180 @@
|
|||
diff -urN linux-2.4.30.old/Documentation/Configure.help linux-2.4.30.dev/Documentation/Configure.help
|
||||
--- linux-2.4.30.old/Documentation/Configure.help 2005-04-27 11:35:46.000000000 +0200
|
||||
+++ linux-2.4.30.dev/Documentation/Configure.help 2005-04-27 11:43:49.000000000 +0200
|
||||
@@ -3209,6 +3209,15 @@
|
||||
If you want to compile it as a module, say M here and read
|
||||
<file:Documentation/modules.txt>. If unsure, say `N'.
|
||||
|
||||
+TTL target support
|
||||
+CONFIG_IP_NF_TARGET_TTL
|
||||
+ This option adds a `TTL' target, which enables the user to set
|
||||
+ the TTL value or increment / decrement the TTL value by a given
|
||||
+ amount.
|
||||
+
|
||||
+ If you want to compile it as a module, say M here and read
|
||||
+ Documentation/modules.txt. If unsure, say `N'.
|
||||
+
|
||||
ipchains (2.2-style) support
|
||||
CONFIG_IP_NF_COMPAT_IPCHAINS
|
||||
This option places ipchains (with masquerading and redirection
|
||||
diff -urN linux-2.4.30.old/include/linux/netfilter_ipv4/ipt_TTL.h linux-2.4.30.dev/include/linux/netfilter_ipv4/ipt_TTL.h
|
||||
--- linux-2.4.30.old/include/linux/netfilter_ipv4/ipt_TTL.h 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ linux-2.4.30.dev/include/linux/netfilter_ipv4/ipt_TTL.h 2005-04-27 11:43:49.000000000 +0200
|
||||
@@ -0,0 +1,21 @@
|
||||
+/* TTL modification module for IP tables
|
||||
+ * (C) 2000 by Harald Welte <laforge@gnumonks.org> */
|
||||
+
|
||||
+#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 -urN linux-2.4.30.old/net/ipv4/netfilter/Config.in linux-2.4.30.dev/net/ipv4/netfilter/Config.in
|
||||
--- linux-2.4.30.old/net/ipv4/netfilter/Config.in 2005-04-27 11:35:45.000000000 +0200
|
||||
+++ linux-2.4.30.dev/net/ipv4/netfilter/Config.in 2005-04-27 11:43:49.000000000 +0200
|
||||
@@ -129,6 +129,7 @@
|
||||
dep_tristate ' MARK target support' CONFIG_IP_NF_TARGET_MARK $CONFIG_IP_NF_MANGLE
|
||||
fi
|
||||
dep_tristate ' LOG target support' CONFIG_IP_NF_TARGET_LOG $CONFIG_IP_NF_IPTABLES
|
||||
+ dep_tristate ' TTL target support' CONFIG_IP_NF_TARGET_TTL $CONFIG_IP_NF_IPTABLES
|
||||
dep_tristate ' ULOG target support' CONFIG_IP_NF_TARGET_ULOG $CONFIG_IP_NF_IPTABLES
|
||||
dep_tristate ' TCPMSS target support' CONFIG_IP_NF_TARGET_TCPMSS $CONFIG_IP_NF_IPTABLES
|
||||
fi
|
||||
diff -urN linux-2.4.30.old/net/ipv4/netfilter/ipt_TTL.c linux-2.4.30.dev/net/ipv4/netfilter/ipt_TTL.c
|
||||
--- linux-2.4.30.old/net/ipv4/netfilter/ipt_TTL.c 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ linux-2.4.30.dev/net/ipv4/netfilter/ipt_TTL.c 2005-04-27 11:43:49.000000000 +0200
|
||||
@@ -0,0 +1,110 @@
|
||||
+/* TTL modification target for IP tables
|
||||
+ * (C) 2000 by Harald Welte <laforge@gnumonks.org>
|
||||
+ *
|
||||
+ * Version: $Revision: 1.1 $
|
||||
+ *
|
||||
+ * This software is distributed under the terms of GNU GPL
|
||||
+ */
|
||||
+
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/skbuff.h>
|
||||
+#include <linux/ip.h>
|
||||
+#include <net/checksum.h>
|
||||
+
|
||||
+#include <linux/netfilter_ipv4/ip_tables.h>
|
||||
+#include <linux/netfilter_ipv4/ipt_TTL.h>
|
||||
+
|
||||
+MODULE_AUTHOR("Harald Welte <laforge@gnumonks.org>");
|
||||
+MODULE_DESCRIPTION("IP tables TTL modification module");
|
||||
+MODULE_LICENSE("GPL");
|
||||
+
|
||||
+static unsigned int ipt_ttl_target(struct sk_buff **pskb, unsigned int hooknum,
|
||||
+ const struct net_device *in, const struct net_device *out,
|
||||
+ const void *targinfo, void *userinfo)
|
||||
+{
|
||||
+ struct iphdr *iph = (*pskb)->nh.iph;
|
||||
+ const struct ipt_TTL_info *info = targinfo;
|
||||
+ u_int16_t diffs[2];
|
||||
+ int new_ttl;
|
||||
+
|
||||
+ switch (info->mode) {
|
||||
+ case IPT_TTL_SET:
|
||||
+ new_ttl = info->ttl;
|
||||
+ break;
|
||||
+ case IPT_TTL_INC:
|
||||
+ new_ttl = iph->ttl + info->ttl;
|
||||
+ if (new_ttl > 255)
|
||||
+ new_ttl = 255;
|
||||
+ break;
|
||||
+ case IPT_TTL_DEC:
|
||||
+ new_ttl = iph->ttl - info->ttl;
|
||||
+ if (new_ttl < 0)
|
||||
+ new_ttl = 0;
|
||||
+ break;
|
||||
+ default:
|
||||
+ new_ttl = iph->ttl;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if (new_ttl != iph->ttl) {
|
||||
+ diffs[0] = htons(((unsigned)iph->ttl) << 8) ^ 0xFFFF;
|
||||
+ iph->ttl = new_ttl;
|
||||
+ diffs[1] = htons(((unsigned)iph->ttl) << 8);
|
||||
+ iph->check = csum_fold(csum_partial((char *)diffs,
|
||||
+ sizeof(diffs),
|
||||
+ iph->check^0xFFFF));
|
||||
+ (*pskb)->nfcache |= NFC_ALTERED;
|
||||
+ }
|
||||
+
|
||||
+ return IPT_CONTINUE;
|
||||
+}
|
||||
+
|
||||
+static int ipt_ttl_checkentry(const char *tablename,
|
||||
+ const struct ipt_entry *e,
|
||||
+ void *targinfo,
|
||||
+ unsigned int targinfosize,
|
||||
+ unsigned int hook_mask)
|
||||
+{
|
||||
+ struct ipt_TTL_info *info = targinfo;
|
||||
+
|
||||
+ if (targinfosize != IPT_ALIGN(sizeof(struct ipt_TTL_info))) {
|
||||
+ printk(KERN_WARNING "TTL: targinfosize %u != %Zu\n",
|
||||
+ targinfosize,
|
||||
+ IPT_ALIGN(sizeof(struct ipt_TTL_info)));
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ if (strcmp(tablename, "mangle")) {
|
||||
+ printk(KERN_WARNING "TTL: can only be called from \"mangle\" table, not \"%s\"\n", tablename);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ if (info->mode > IPT_TTL_MAXMODE) {
|
||||
+ printk(KERN_WARNING "TTL: invalid or unknown Mode %u\n",
|
||||
+ info->mode);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ if ((info->mode != IPT_TTL_SET) && (info->ttl == 0)) {
|
||||
+ printk(KERN_WARNING "TTL: increment/decrement doesn't make sense with value 0\n");
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+static struct ipt_target ipt_TTL = { { NULL, NULL }, "TTL",
|
||||
+ ipt_ttl_target, ipt_ttl_checkentry, NULL, THIS_MODULE };
|
||||
+
|
||||
+static int __init init(void)
|
||||
+{
|
||||
+ return ipt_register_target(&ipt_TTL);
|
||||
+}
|
||||
+
|
||||
+static void __exit fini(void)
|
||||
+{
|
||||
+ ipt_unregister_target(&ipt_TTL);
|
||||
+}
|
||||
+
|
||||
+module_init(init);
|
||||
+module_exit(fini);
|
||||
diff -urN linux-2.4.30.old/net/ipv4/netfilter/Makefile linux-2.4.30.dev/net/ipv4/netfilter/Makefile
|
||||
--- linux-2.4.30.old/net/ipv4/netfilter/Makefile 2005-04-27 11:35:45.000000000 +0200
|
||||
+++ linux-2.4.30.dev/net/ipv4/netfilter/Makefile 2005-04-27 11:43:49.000000000 +0200
|
||||
@@ -112,6 +112,7 @@
|
||||
obj-$(CONFIG_IP_NF_TARGET_REDIRECT) += ipt_REDIRECT.o
|
||||
obj-$(CONFIG_IP_NF_NAT_SNMP_BASIC) += ip_nat_snmp_basic.o
|
||||
obj-$(CONFIG_IP_NF_TARGET_LOG) += ipt_LOG.o
|
||||
+obj-$(CONFIG_IP_NF_TARGET_TTL) += ipt_TTL.o
|
||||
obj-$(CONFIG_IP_NF_TARGET_ULOG) += ipt_ULOG.o
|
||||
obj-$(CONFIG_IP_NF_TARGET_TCPMSS) += ipt_TCPMSS.o
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,688 @@
|
|||
diff -urPX nopatch linux-2.4.26/Documentation/Configure.help linux/Documentation/Configure.help
|
||||
--- linux-2.4.26/Documentation/Configure.help Sat Apr 17 02:10:25 2004
|
||||
+++ linux/Documentation/Configure.help Sat Apr 17 02:13:54 2004
|
||||
@@ -4622,6 +4622,12 @@
|
||||
will be called binfmt_elf.o. Saying M or N here is dangerous because
|
||||
some crucial programs on your system might be in ELF format.
|
||||
|
||||
+ELF binaries with a.out format interpreters or a.out libraries
|
||||
+CONFIG_BINFMT_ELF_AOUT
|
||||
+ The kernel may support ELF executables which use an a.out format
|
||||
+ interpreter (dynamic linker) and/or a.out shared libraries, in
|
||||
+ addition to the usual ELF-ELF setups. You shouldn't need this.
|
||||
+
|
||||
Kernel support for a.out binaries
|
||||
CONFIG_BINFMT_AOUT
|
||||
A.out (Assembler.OUTput) is a set of formats for libraries and
|
||||
@@ -4635,13 +4641,11 @@
|
||||
warrant removing support. However its removal is a good idea if you
|
||||
wish to ensure that absolutely none of your programs will use this
|
||||
older executable format. If you don't know what to answer at this
|
||||
- point then answer Y. If someone told you "You need a kernel with
|
||||
+ point then answer N. If someone told you "You need a kernel with
|
||||
QMAGIC support" then you'll have to say Y here. You may answer M to
|
||||
compile a.out support as a module and later load the module when you
|
||||
want to use a program or library in a.out format. The module will be
|
||||
- called binfmt_aout.o. Saying M or N here is dangerous though,
|
||||
- because some crucial programs on your system might still be in A.OUT
|
||||
- format.
|
||||
+ called binfmt_aout.o.
|
||||
|
||||
OSF/1 v4 readv/writev compatibility
|
||||
CONFIG_OSF4_COMPAT
|
||||
diff -urPX nopatch linux-2.4.26/arch/alpha/config.in linux/arch/alpha/config.in
|
||||
--- linux-2.4.26/arch/alpha/config.in Fri Feb 20 10:07:20 2004
|
||||
+++ linux/arch/alpha/config.in Sat Apr 17 02:13:54 2004
|
||||
@@ -315,6 +315,9 @@
|
||||
fi
|
||||
|
||||
bool 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
|
||||
+if [ "$CONFIG_BINFMT_ELF" != "n" ]; then
|
||||
+ bool ' ELF binaries with a.out format interpreters or a.out libraries' CONFIG_BINFMT_ELF_AOUT
|
||||
+fi
|
||||
tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
|
||||
tristate 'Kernel support for Linux/Intel ELF binaries' CONFIG_BINFMT_EM86
|
||||
source drivers/parport/Config.in
|
||||
diff -urPX nopatch linux-2.4.26/arch/alpha/defconfig linux/arch/alpha/defconfig
|
||||
--- linux-2.4.26/arch/alpha/defconfig Fri Feb 20 10:07:20 2004
|
||||
+++ linux/arch/alpha/defconfig Sat Apr 17 02:13:54 2004
|
||||
@@ -72,6 +72,7 @@
|
||||
# CONFIG_KCORE_AOUT is not set
|
||||
# CONFIG_BINFMT_AOUT is not set
|
||||
CONFIG_BINFMT_ELF=y
|
||||
+# CONFIG_BINFMT_ELF_AOUT is not set
|
||||
# CONFIG_BINFMT_MISC is not set
|
||||
# CONFIG_BINFMT_EM86 is not set
|
||||
|
||||
diff -urPX nopatch linux-2.4.26/arch/arm/config.in linux/arch/arm/config.in
|
||||
--- linux-2.4.26/arch/arm/config.in Fri Feb 20 10:07:20 2004
|
||||
+++ linux/arch/arm/config.in Sat Apr 17 02:13:54 2004
|
||||
@@ -499,6 +499,9 @@
|
||||
A.OUT CONFIG_KCORE_AOUT" ELF
|
||||
tristate 'Kernel support for a.out binaries' CONFIG_BINFMT_AOUT
|
||||
bool 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
|
||||
+if [ "$CONFIG_BINFMT_ELF" != "n" ]; then
|
||||
+ bool ' ELF binaries with a.out format interpreters or a.out libraries' CONFIG_BINFMT_ELF_AOUT
|
||||
+fi
|
||||
tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
|
||||
dep_bool 'Power Management support (experimental)' CONFIG_PM $CONFIG_EXPERIMENTAL
|
||||
dep_tristate 'RISC OS personality' CONFIG_ARTHUR $CONFIG_CPU_32
|
||||
diff -urPX nopatch linux-2.4.26/arch/arm/defconfig linux/arch/arm/defconfig
|
||||
--- linux-2.4.26/arch/arm/defconfig Fri Feb 20 10:07:21 2004
|
||||
+++ linux/arch/arm/defconfig Sat Apr 17 02:13:54 2004
|
||||
@@ -83,8 +83,9 @@
|
||||
CONFIG_NWFPE=y
|
||||
CONFIG_KCORE_ELF=y
|
||||
# CONFIG_KCORE_AOUT is not set
|
||||
-CONFIG_BINFMT_AOUT=y
|
||||
+# CONFIG_BINFMT_AOUT is not set
|
||||
CONFIG_BINFMT_ELF=y
|
||||
+# CONFIG_BINFMT_ELF_AOUT is not set
|
||||
# CONFIG_BINFMT_MISC is not set
|
||||
# CONFIG_PM is not set
|
||||
# CONFIG_ARTHUR is not set
|
||||
diff -urPX nopatch linux-2.4.26/arch/cris/config.in linux/arch/cris/config.in
|
||||
--- linux-2.4.26/arch/cris/config.in Fri Feb 20 10:07:21 2004
|
||||
+++ linux/arch/cris/config.in Sat Apr 17 02:13:54 2004
|
||||
@@ -31,6 +31,9 @@
|
||||
bool 'Sysctl support' CONFIG_SYSCTL
|
||||
|
||||
bool 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
|
||||
+if [ "$CONFIG_BINFMT_ELF" != "n" ]; then
|
||||
+ bool ' ELF binaries with a.out format interpreters or a.out libraries' CONFIG_BINFMT_ELF_AOUT
|
||||
+fi
|
||||
|
||||
string 'Kernel command line' CONFIG_ETRAX_CMDLINE "root=/dev/mtdblock3"
|
||||
|
||||
diff -urPX nopatch linux-2.4.26/arch/cris/defconfig linux/arch/cris/defconfig
|
||||
--- linux-2.4.26/arch/cris/defconfig Fri Feb 20 10:07:21 2004
|
||||
+++ linux/arch/cris/defconfig Sat Apr 17 02:13:54 2004
|
||||
@@ -18,6 +18,7 @@
|
||||
# CONFIG_BSD_PROCESS_ACCT is not set
|
||||
# CONFIG_SYSCTL is not set
|
||||
CONFIG_BINFMT_ELF=y
|
||||
+# CONFIG_BINFMT_ELF_AOUT is not set
|
||||
# CONFIG_ETRAX_KGDB is not set
|
||||
# CONFIG_ETRAX_WATCHDOG is not set
|
||||
|
||||
diff -urPX nopatch linux-2.4.26/arch/i386/config.in linux/arch/i386/config.in
|
||||
--- linux-2.4.26/arch/i386/config.in Fri Feb 20 10:07:21 2004
|
||||
+++ linux/arch/i386/config.in Sat Apr 17 02:13:54 2004
|
||||
@@ -327,6 +327,9 @@
|
||||
fi
|
||||
tristate 'Kernel support for a.out binaries' CONFIG_BINFMT_AOUT
|
||||
bool 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
|
||||
+if [ "$CONFIG_BINFMT_ELF" != "n" ]; then
|
||||
+ bool ' ELF binaries with a.out format interpreters or a.out libraries' CONFIG_BINFMT_ELF_AOUT
|
||||
+fi
|
||||
tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
|
||||
bool 'Select task to kill on out of memory condition' CONFIG_OOM_KILLER
|
||||
|
||||
diff -urPX nopatch linux-2.4.26/arch/i386/defconfig linux/arch/i386/defconfig
|
||||
--- linux-2.4.26/arch/i386/defconfig Sat Apr 17 02:10:25 2004
|
||||
+++ linux/arch/i386/defconfig Sat Apr 17 02:23:27 2004
|
||||
@@ -110,9 +110,10 @@
|
||||
CONFIG_SYSCTL=y
|
||||
CONFIG_KCORE_ELF=y
|
||||
# CONFIG_KCORE_AOUT is not set
|
||||
-CONFIG_BINFMT_AOUT=y
|
||||
+# CONFIG_BINFMT_AOUT is not set
|
||||
CONFIG_BINFMT_ELF=y
|
||||
-CONFIG_BINFMT_MISC=y
|
||||
+# CONFIG_BINFMT_ELF_AOUT is not set
|
||||
+# CONFIG_BINFMT_MISC is not set
|
||||
# CONFIG_OOM_KILLER is not set
|
||||
CONFIG_PM=y
|
||||
# CONFIG_APM is not set
|
||||
diff -urPX nopatch linux-2.4.26/arch/ia64/config.in linux/arch/ia64/config.in
|
||||
--- linux-2.4.26/arch/ia64/config.in Fri Feb 20 10:07:21 2004
|
||||
+++ linux/arch/ia64/config.in Sat Apr 17 02:13:54 2004
|
||||
@@ -124,6 +124,9 @@
|
||||
bool 'BSD Process Accounting' CONFIG_BSD_PROCESS_ACCT
|
||||
bool 'Sysctl support' CONFIG_SYSCTL
|
||||
bool 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
|
||||
+if [ "$CONFIG_BINFMT_ELF" != "n" ]; then
|
||||
+ bool ' ELF binaries with a.out format interpreters or a.out libraries' CONFIG_BINFMT_ELF_AOUT
|
||||
+fi
|
||||
tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
|
||||
|
||||
if [ "$CONFIG_IA64_HP_SIM" = "n" ]; then
|
||||
diff -urPX nopatch linux-2.4.26/arch/ia64/defconfig linux/arch/ia64/defconfig
|
||||
--- linux-2.4.26/arch/ia64/defconfig Fri Feb 20 10:07:21 2004
|
||||
+++ linux/arch/ia64/defconfig Sat Apr 17 02:13:54 2004
|
||||
@@ -60,6 +60,7 @@
|
||||
# CONFIG_BSD_PROCESS_ACCT is not set
|
||||
CONFIG_SYSCTL=y
|
||||
CONFIG_BINFMT_ELF=y
|
||||
+# CONFIG_BINFMT_ELF_AOUT is not set
|
||||
# CONFIG_BINFMT_MISC is not set
|
||||
CONFIG_ACPI=y
|
||||
CONFIG_ACPI_EFI=y
|
||||
diff -urPX nopatch linux-2.4.26/arch/m68k/config.in linux/arch/m68k/config.in
|
||||
--- linux-2.4.26/arch/m68k/config.in Fri Feb 20 10:07:22 2004
|
||||
+++ linux/arch/m68k/config.in Sat Apr 17 02:13:55 2004
|
||||
@@ -99,6 +99,9 @@
|
||||
fi
|
||||
tristate 'Kernel support for a.out binaries' CONFIG_BINFMT_AOUT
|
||||
bool 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
|
||||
+if [ "$CONFIG_BINFMT_ELF" != "n" ]; then
|
||||
+ bool ' ELF binaries with a.out format interpreters or a.out libraries' CONFIG_BINFMT_ELF_AOUT
|
||||
+fi
|
||||
tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
|
||||
|
||||
if [ "$CONFIG_AMIGA" = "y" ]; then
|
||||
diff -urPX nopatch linux-2.4.26/arch/m68k/defconfig linux/arch/m68k/defconfig
|
||||
--- linux-2.4.26/arch/m68k/defconfig Fri Feb 20 10:07:22 2004
|
||||
+++ linux/arch/m68k/defconfig Sat Apr 17 02:13:55 2004
|
||||
@@ -44,8 +44,9 @@
|
||||
CONFIG_SYSCTL=y
|
||||
CONFIG_KCORE_ELF=y
|
||||
# CONFIG_KCORE_AOUT is not set
|
||||
-CONFIG_BINFMT_AOUT=y
|
||||
+# CONFIG_BINFMT_AOUT is not set
|
||||
CONFIG_BINFMT_ELF=y
|
||||
+# CONFIG_BINFMT_ELF_AOUT is not set
|
||||
# CONFIG_BINFMT_MISC is not set
|
||||
CONFIG_ZORRO=y
|
||||
# CONFIG_AMIGA_PCMCIA is not set
|
||||
diff -urPX nopatch linux-2.4.26/arch/mips/config-shared.in linux/arch/mips/config-shared.in
|
||||
--- linux-2.4.26/arch/mips/config-shared.in Fri Feb 20 10:07:22 2004
|
||||
+++ linux/arch/mips/config-shared.in Sat Apr 17 02:13:55 2004
|
||||
@@ -944,6 +944,9 @@
|
||||
define_bool CONFIG_KCORE_AOUT n
|
||||
define_bool CONFIG_BINFMT_AOUT n
|
||||
bool 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
|
||||
+if [ "$CONFIG_BINFMT_ELF" != "n" ]; then
|
||||
+ bool ' ELF binaries with a.out format interpreters or a.out libraries' CONFIG_BINFMT_ELF_AOUT
|
||||
+fi
|
||||
dep_bool 'Kernel support for Linux/MIPS 32-bit binary compatibility' CONFIG_MIPS32_COMPAT $CONFIG_MIPS64
|
||||
dep_bool 'Kernel support for o32 binaries' CONFIG_MIPS32_O32 $CONFIG_MIPS32_COMPAT
|
||||
dep_bool 'Kernel support for n32 binaries' CONFIG_MIPS32_N32 $CONFIG_MIPS32_COMPAT
|
||||
diff -urPX nopatch linux-2.4.26/arch/mips/defconfig linux/arch/mips/defconfig
|
||||
--- linux-2.4.26/arch/mips/defconfig Fri Feb 20 10:07:22 2004
|
||||
+++ linux/arch/mips/defconfig Sat Apr 17 02:13:55 2004
|
||||
@@ -139,6 +139,7 @@
|
||||
# CONFIG_KCORE_AOUT is not set
|
||||
# CONFIG_BINFMT_AOUT is not set
|
||||
CONFIG_BINFMT_ELF=y
|
||||
+# CONFIG_BINFMT_ELF_AOUT is not set
|
||||
# CONFIG_MIPS32_COMPAT is not set
|
||||
# CONFIG_MIPS32_O32 is not set
|
||||
# CONFIG_MIPS32_N32 is not set
|
||||
diff -urPX nopatch linux-2.4.26/arch/mips/kernel/irixelf.c linux/arch/mips/kernel/irixelf.c
|
||||
--- linux-2.4.26/arch/mips/kernel/irixelf.c Mon Aug 25 11:44:40 2003
|
||||
+++ linux/arch/mips/kernel/irixelf.c Sat Apr 17 02:13:55 2004
|
||||
@@ -8,6 +8,7 @@
|
||||
* Copyright 1993, 1994: Eric Youngdale (ericy@cais.com).
|
||||
*/
|
||||
|
||||
+#include <linux/config.h>
|
||||
#include <linux/module.h>
|
||||
|
||||
#include <linux/fs.h>
|
||||
@@ -48,7 +49,12 @@
|
||||
extern int dump_fpu (elf_fpregset_t *);
|
||||
|
||||
static struct linux_binfmt irix_format = {
|
||||
- NULL, THIS_MODULE, load_irix_binary, load_irix_library,
|
||||
+ NULL, THIS_MODULE, load_irix_binary,
|
||||
+#ifdef CONFIG_BINFMT_ELF_AOUT
|
||||
+ load_irix_library,
|
||||
+#else
|
||||
+ NULL,
|
||||
+#endif
|
||||
irix_core_dump, PAGE_SIZE
|
||||
};
|
||||
|
||||
@@ -787,6 +793,7 @@
|
||||
goto out;
|
||||
}
|
||||
|
||||
+#ifdef CONFIG_BINFMT_ELF_AOUT
|
||||
/* This is really simpleminded and specialized - we are loading an
|
||||
* a.out library that is given an ELF header.
|
||||
*/
|
||||
@@ -863,6 +870,7 @@
|
||||
kfree(elf_phdata);
|
||||
return 0;
|
||||
}
|
||||
+#endif
|
||||
|
||||
/* Called through irix_syssgi() to map an elf image given an FD,
|
||||
* a phdr ptr USER_PHDRP in userspace, and a count CNT telling how many
|
||||
diff -urPX nopatch linux-2.4.26/arch/mips64/defconfig linux/arch/mips64/defconfig
|
||||
--- linux-2.4.26/arch/mips64/defconfig Fri Feb 20 10:07:24 2004
|
||||
+++ linux/arch/mips64/defconfig Sat Apr 17 02:13:55 2004
|
||||
@@ -137,6 +137,7 @@
|
||||
# CONFIG_KCORE_AOUT is not set
|
||||
# CONFIG_BINFMT_AOUT is not set
|
||||
CONFIG_BINFMT_ELF=y
|
||||
+# CONFIG_BINFMT_ELF_AOUT is not set
|
||||
CONFIG_MIPS32_COMPAT=y
|
||||
CONFIG_MIPS32_O32=y
|
||||
# CONFIG_MIPS32_N32 is not set
|
||||
diff -urPX nopatch linux-2.4.26/arch/parisc/config.in linux/arch/parisc/config.in
|
||||
--- linux-2.4.26/arch/parisc/config.in Fri Feb 20 10:07:25 2004
|
||||
+++ linux/arch/parisc/config.in Sat Apr 17 02:13:55 2004
|
||||
@@ -89,6 +89,9 @@
|
||||
bool 'Sysctl support' CONFIG_SYSCTL
|
||||
define_bool CONFIG_KCORE_ELF y
|
||||
bool 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
|
||||
+if [ "$CONFIG_BINFMT_ELF" != "n" ]; then
|
||||
+ bool ' ELF binaries with a.out format interpreters or a.out libraries' CONFIG_BINFMT_ELF_AOUT
|
||||
+fi
|
||||
tristate 'Kernel support for SOM binaries' CONFIG_BINFMT_SOM
|
||||
tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
|
||||
|
||||
diff -urPX nopatch linux-2.4.26/arch/parisc/defconfig linux/arch/parisc/defconfig
|
||||
--- linux-2.4.26/arch/parisc/defconfig Fri Feb 20 10:07:25 2004
|
||||
+++ linux/arch/parisc/defconfig Sat Apr 17 02:13:55 2004
|
||||
@@ -56,6 +56,7 @@
|
||||
CONFIG_SYSCTL=y
|
||||
CONFIG_KCORE_ELF=y
|
||||
CONFIG_BINFMT_ELF=y
|
||||
+# CONFIG_BINFMT_ELF_AOUT is not set
|
||||
CONFIG_BINFMT_SOM=y
|
||||
# CONFIG_BINFMT_MISC is not set
|
||||
# CONFIG_PM is not set
|
||||
diff -urPX nopatch linux-2.4.26/arch/ppc/config.in linux/arch/ppc/config.in
|
||||
--- linux-2.4.26/arch/ppc/config.in Sat Apr 17 02:10:25 2004
|
||||
+++ linux/arch/ppc/config.in Sat Apr 17 02:13:55 2004
|
||||
@@ -384,6 +384,7 @@
|
||||
fi
|
||||
define_bool CONFIG_BINFMT_ELF y
|
||||
define_bool CONFIG_KERNEL_ELF y
|
||||
+bool 'ELF binaries with a.out format interpreters or a.out libraries' CONFIG_BINFMT_ELF_AOUT
|
||||
tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
|
||||
bool 'Select task to kill on out of memory condition' CONFIG_OOM_KILLER
|
||||
|
||||
diff -urPX nopatch linux-2.4.26/arch/ppc/defconfig linux/arch/ppc/defconfig
|
||||
--- linux-2.4.26/arch/ppc/defconfig Fri Feb 20 10:07:25 2004
|
||||
+++ linux/arch/ppc/defconfig Sat Apr 17 02:13:55 2004
|
||||
@@ -59,7 +59,8 @@
|
||||
CONFIG_KCORE_ELF=y
|
||||
CONFIG_BINFMT_ELF=y
|
||||
CONFIG_KERNEL_ELF=y
|
||||
-CONFIG_BINFMT_MISC=m
|
||||
+# CONFIG_BINFMT_ELF_AOUT is not set
|
||||
+# CONFIG_BINFMT_MISC is not set
|
||||
# CONFIG_OOM_KILLER is not set
|
||||
CONFIG_PCI_NAMES=y
|
||||
CONFIG_HOTPLUG=y
|
||||
diff -urPX nopatch linux-2.4.26/arch/ppc64/config.in linux/arch/ppc64/config.in
|
||||
--- linux-2.4.26/arch/ppc64/config.in Fri Feb 20 10:07:25 2004
|
||||
+++ linux/arch/ppc64/config.in Sat Apr 17 02:13:55 2004
|
||||
@@ -82,6 +82,9 @@
|
||||
fi
|
||||
|
||||
bool 'Kernel support for 64 bit ELF binaries' CONFIG_BINFMT_ELF
|
||||
+if [ "$CONFIG_BINFMT_ELF" != "n" ]; then
|
||||
+ bool ' ELF binaries with a.out format interpreters or a.out libraries' CONFIG_BINFMT_ELF_AOUT
|
||||
+fi
|
||||
|
||||
tristate 'Kernel support for 32 bit ELF binaries' CONFIG_BINFMT_ELF32
|
||||
|
||||
diff -urPX nopatch linux-2.4.26/arch/ppc64/defconfig linux/arch/ppc64/defconfig
|
||||
--- linux-2.4.26/arch/ppc64/defconfig Fri Feb 20 10:07:25 2004
|
||||
+++ linux/arch/ppc64/defconfig Sat Apr 17 02:13:55 2004
|
||||
@@ -56,6 +56,7 @@
|
||||
# CONFIG_BSD_PROCESS_ACCT is not set
|
||||
CONFIG_KCORE_ELF=y
|
||||
CONFIG_BINFMT_ELF=y
|
||||
+# CONFIG_BINFMT_ELF_AOUT is not set
|
||||
CONFIG_BINFMT_ELF32=y
|
||||
# CONFIG_BINFMT_MISC is not set
|
||||
CONFIG_PCI_NAMES=y
|
||||
diff -urPX nopatch linux-2.4.26/arch/s390/config.in linux/arch/s390/config.in
|
||||
--- linux-2.4.26/arch/s390/config.in Fri Nov 28 18:26:19 2003
|
||||
+++ linux/arch/s390/config.in Sat Apr 17 02:13:55 2004
|
||||
@@ -58,6 +58,9 @@
|
||||
bool 'Sysctl support' CONFIG_SYSCTL
|
||||
define_bool CONFIG_KCORE_ELF y
|
||||
bool 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
|
||||
+if [ "$CONFIG_BINFMT_ELF" != "n" ]; then
|
||||
+ bool ' ELF binaries with a.out format interpreters or a.out libraries' CONFIG_BINFMT_ELF_AOUT
|
||||
+fi
|
||||
tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
|
||||
bool 'Show crashed user process info' CONFIG_PROCESS_DEBUG
|
||||
bool 'Pseudo page fault support' CONFIG_PFAULT
|
||||
diff -urPX nopatch linux-2.4.26/arch/s390/defconfig linux/arch/s390/defconfig
|
||||
--- linux-2.4.26/arch/s390/defconfig Fri Feb 20 10:07:26 2004
|
||||
+++ linux/arch/s390/defconfig Sat Apr 17 02:13:55 2004
|
||||
@@ -46,6 +46,7 @@
|
||||
CONFIG_SYSCTL=y
|
||||
CONFIG_KCORE_ELF=y
|
||||
CONFIG_BINFMT_ELF=y
|
||||
+# CONFIG_BINFMT_ELF_AOUT is not set
|
||||
# CONFIG_BINFMT_MISC is not set
|
||||
# CONFIG_PROCESS_DEBUG is not set
|
||||
CONFIG_PFAULT=y
|
||||
diff -urPX nopatch linux-2.4.26/arch/s390x/config.in linux/arch/s390x/config.in
|
||||
--- linux-2.4.26/arch/s390x/config.in Fri Nov 28 18:26:19 2003
|
||||
+++ linux/arch/s390x/config.in Sat Apr 17 02:13:55 2004
|
||||
@@ -61,6 +61,9 @@
|
||||
bool 'Sysctl support' CONFIG_SYSCTL
|
||||
define_bool CONFIG_KCORE_ELF y
|
||||
bool 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
|
||||
+if [ "$CONFIG_BINFMT_ELF" != "n" ]; then
|
||||
+ bool ' ELF binaries with a.out format interpreters or a.out libraries' CONFIG_BINFMT_ELF_AOUT
|
||||
+fi
|
||||
tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
|
||||
bool 'Show crashed user process info' CONFIG_PROCESS_DEBUG
|
||||
bool 'Pseudo page fault support' CONFIG_PFAULT
|
||||
diff -urPX nopatch linux-2.4.26/arch/s390x/defconfig linux/arch/s390x/defconfig
|
||||
--- linux-2.4.26/arch/s390x/defconfig Fri Feb 20 10:07:26 2004
|
||||
+++ linux/arch/s390x/defconfig Sat Apr 17 02:13:55 2004
|
||||
@@ -47,6 +47,7 @@
|
||||
CONFIG_SYSCTL=y
|
||||
CONFIG_KCORE_ELF=y
|
||||
CONFIG_BINFMT_ELF=y
|
||||
+# CONFIG_BINFMT_ELF_AOUT is not set
|
||||
# CONFIG_BINFMT_MISC is not set
|
||||
# CONFIG_PROCESS_DEBUG is not set
|
||||
CONFIG_PFAULT=y
|
||||
diff -urPX nopatch linux-2.4.26/arch/sh/config.in linux/arch/sh/config.in
|
||||
--- linux-2.4.26/arch/sh/config.in Fri Feb 20 10:07:26 2004
|
||||
+++ linux/arch/sh/config.in Sat Apr 17 02:13:55 2004
|
||||
@@ -283,6 +283,9 @@
|
||||
A.OUT CONFIG_KCORE_AOUT" ELF
|
||||
fi
|
||||
bool 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
|
||||
+if [ "$CONFIG_BINFMT_ELF" != "n" ]; then
|
||||
+ bool ' ELF binaries with a.out format interpreters or a.out libraries' CONFIG_BINFMT_ELF_AOUT
|
||||
+fi
|
||||
tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
|
||||
|
||||
bool 'Select task to kill on out of memory condition' CONFIG_OOM_KILLER
|
||||
diff -urPX nopatch linux-2.4.26/arch/sh/defconfig linux/arch/sh/defconfig
|
||||
--- linux-2.4.26/arch/sh/defconfig Fri Feb 20 10:07:26 2004
|
||||
+++ linux/arch/sh/defconfig Sat Apr 17 02:13:55 2004
|
||||
@@ -48,6 +48,7 @@
|
||||
CONFIG_KCORE_ELF=y
|
||||
# CONFIG_KCORE_AOUT is not set
|
||||
CONFIG_BINFMT_ELF=y
|
||||
+# CONFIG_BINFMT_ELF_AOUT is not set
|
||||
# CONFIG_BINFMT_MISC is not set
|
||||
|
||||
#
|
||||
diff -urPX nopatch linux-2.4.26/arch/sparc/config.in linux/arch/sparc/config.in
|
||||
--- linux-2.4.26/arch/sparc/config.in Fri Feb 20 10:07:26 2004
|
||||
+++ linux/arch/sparc/config.in Sat Apr 17 02:13:55 2004
|
||||
@@ -74,6 +74,9 @@
|
||||
fi
|
||||
tristate 'Kernel support for a.out binaries' CONFIG_BINFMT_AOUT
|
||||
bool 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
|
||||
+if [ "$CONFIG_BINFMT_ELF" != "n" ]; then
|
||||
+ bool ' ELF binaries with a.out format interpreters or a.out libraries' CONFIG_BINFMT_ELF_AOUT
|
||||
+fi
|
||||
tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
|
||||
bool 'SunOS binary emulation' CONFIG_SUNOS_EMUL
|
||||
bool 'Select task to kill on out of memory condition' CONFIG_OOM_KILLER
|
||||
diff -urPX nopatch linux-2.4.26/arch/sparc/defconfig linux/arch/sparc/defconfig
|
||||
--- linux-2.4.26/arch/sparc/defconfig Sat Apr 17 02:10:25 2004
|
||||
+++ linux/arch/sparc/defconfig Sat Apr 17 02:13:55 2004
|
||||
@@ -49,9 +49,10 @@
|
||||
# CONFIG_BSD_PROCESS_ACCT is not set
|
||||
CONFIG_SYSCTL=y
|
||||
CONFIG_KCORE_ELF=y
|
||||
-CONFIG_BINFMT_AOUT=y
|
||||
+# CONFIG_BINFMT_AOUT is not set
|
||||
CONFIG_BINFMT_ELF=y
|
||||
-CONFIG_BINFMT_MISC=m
|
||||
+# CONFIG_BINFMT_ELF_AOUT is not set
|
||||
+# CONFIG_BINFMT_MISC is not set
|
||||
CONFIG_SUNOS_EMUL=y
|
||||
# CONFIG_OOM_KILLER is not set
|
||||
|
||||
diff -urPX nopatch linux-2.4.26/arch/sparc64/config.in linux/arch/sparc64/config.in
|
||||
--- linux-2.4.26/arch/sparc64/config.in Fri Feb 20 10:07:26 2004
|
||||
+++ linux/arch/sparc64/config.in Sat Apr 17 02:13:55 2004
|
||||
@@ -77,6 +77,9 @@
|
||||
bool ' Kernel support for 32-bit (ie. SunOS) a.out binaries' CONFIG_BINFMT_AOUT32
|
||||
fi
|
||||
bool 'Kernel support for 64-bit ELF binaries' CONFIG_BINFMT_ELF
|
||||
+if [ "$CONFIG_BINFMT_ELF" != "n" ]; then
|
||||
+ bool ' ELF binaries with a.out format interpreters or a.out libraries' CONFIG_BINFMT_ELF_AOUT
|
||||
+fi
|
||||
tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
|
||||
bool 'SunOS binary emulation' CONFIG_SUNOS_EMUL
|
||||
if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
|
||||
diff -urPX nopatch linux-2.4.26/arch/sparc64/defconfig linux/arch/sparc64/defconfig
|
||||
--- linux-2.4.26/arch/sparc64/defconfig Sat Apr 17 02:10:26 2004
|
||||
+++ linux/arch/sparc64/defconfig Sat Apr 17 02:13:55 2004
|
||||
@@ -56,7 +56,8 @@
|
||||
CONFIG_BINFMT_ELF32=y
|
||||
# CONFIG_BINFMT_AOUT32 is not set
|
||||
CONFIG_BINFMT_ELF=y
|
||||
-CONFIG_BINFMT_MISC=m
|
||||
+# CONFIG_BINFMT_ELF_AOUT is not set
|
||||
+# CONFIG_BINFMT_MISC is not set
|
||||
# CONFIG_SUNOS_EMUL is not set
|
||||
CONFIG_SOLARIS_EMUL=m
|
||||
# CONFIG_OOM_KILLER is not set
|
||||
diff -urPX nopatch linux-2.4.26/arch/x86_64/config.in linux/arch/x86_64/config.in
|
||||
--- linux-2.4.26/arch/x86_64/config.in Sat Apr 17 02:10:26 2004
|
||||
+++ linux/arch/x86_64/config.in Sat Apr 17 02:13:55 2004
|
||||
@@ -118,6 +118,9 @@
|
||||
fi
|
||||
#tristate 'Kernel support for a.out binaries' CONFIG_BINFMT_AOUT
|
||||
bool 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
|
||||
+if [ "$CONFIG_BINFMT_ELF" != "n" ]; then
|
||||
+ bool ' ELF binaries with a.out format interpreters or a.out libraries' CONFIG_BINFMT_ELF_AOUT
|
||||
+fi
|
||||
tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
|
||||
|
||||
bool 'Power Management support' CONFIG_PM
|
||||
diff -urPX nopatch linux-2.4.26/arch/x86_64/defconfig linux/arch/x86_64/defconfig
|
||||
--- linux-2.4.26/arch/x86_64/defconfig Sat Apr 17 02:10:26 2004
|
||||
+++ linux/arch/x86_64/defconfig Sat Apr 17 02:13:55 2004
|
||||
@@ -67,6 +67,7 @@
|
||||
CONFIG_SYSCTL=y
|
||||
CONFIG_KCORE_ELF=y
|
||||
CONFIG_BINFMT_ELF=y
|
||||
+# CONFIG_BINFMT_ELF_AOUT is not set
|
||||
# CONFIG_BINFMT_MISC is not set
|
||||
CONFIG_PM=y
|
||||
CONFIG_IA32_EMULATION=y
|
||||
diff -urPX nopatch linux-2.4.26/fs/binfmt_elf.c linux/fs/binfmt_elf.c
|
||||
--- linux-2.4.26/fs/binfmt_elf.c Sat Apr 17 02:10:31 2004
|
||||
+++ linux/fs/binfmt_elf.c Sat Apr 17 02:13:55 2004
|
||||
@@ -9,6 +9,7 @@
|
||||
* Copyright 1993, 1994: Eric Youngdale (ericy@cais.com).
|
||||
*/
|
||||
|
||||
+#include <linux/config.h>
|
||||
#include <linux/module.h>
|
||||
|
||||
#include <linux/fs.h>
|
||||
@@ -43,7 +44,9 @@
|
||||
#include <linux/elf.h>
|
||||
|
||||
static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs);
|
||||
+#ifdef CONFIG_BINFMT_ELF_AOUT
|
||||
static int load_elf_library(struct file*);
|
||||
+#endif
|
||||
static unsigned long elf_map (struct file *, unsigned long, struct elf_phdr *, int, int);
|
||||
extern int dump_fpu (struct pt_regs *, elf_fpregset_t *);
|
||||
extern void dump_thread(struct pt_regs *, struct user *);
|
||||
@@ -73,8 +76,14 @@
|
||||
#define ELF_PAGEOFFSET(_v) ((_v) & (ELF_MIN_ALIGN-1))
|
||||
#define ELF_PAGEALIGN(_v) (((_v) + ELF_MIN_ALIGN - 1) & ~(ELF_MIN_ALIGN - 1))
|
||||
|
||||
-static struct linux_binfmt elf_format = {
|
||||
- NULL, THIS_MODULE, load_elf_binary, load_elf_library, elf_core_dump, ELF_EXEC_PAGESIZE
|
||||
+static struct linux_binfmt elf_format = {
|
||||
+ NULL, THIS_MODULE, load_elf_binary,
|
||||
+#ifdef CONFIG_BINFMT_ELF_AOUT
|
||||
+ load_elf_library,
|
||||
+#else
|
||||
+ NULL,
|
||||
+#endif
|
||||
+ elf_core_dump, ELF_EXEC_PAGESIZE
|
||||
};
|
||||
|
||||
#define BAD_ADDR(x) ((unsigned long)(x) > TASK_SIZE)
|
||||
@@ -369,6 +378,7 @@
|
||||
return error;
|
||||
}
|
||||
|
||||
+#ifdef CONFIG_BINFMT_ELF_AOUT
|
||||
static unsigned long load_aout_interp(struct exec * interp_ex,
|
||||
struct file * interpreter)
|
||||
{
|
||||
@@ -413,6 +423,7 @@
|
||||
out:
|
||||
return elf_entry;
|
||||
}
|
||||
+#endif
|
||||
|
||||
/*
|
||||
* These are the functions used to load ELF style executables and shared
|
||||
@@ -420,7 +431,9 @@
|
||||
*/
|
||||
|
||||
#define INTERPRETER_NONE 0
|
||||
+#ifdef CONFIG_BINFMT_ELF_AOUT
|
||||
#define INTERPRETER_AOUT 1
|
||||
+#endif
|
||||
#define INTERPRETER_ELF 2
|
||||
|
||||
|
||||
@@ -444,7 +457,9 @@
|
||||
struct elfhdr elf_ex;
|
||||
struct elfhdr interp_elf_ex;
|
||||
struct exec interp_ex;
|
||||
+#ifdef CONFIG_BINFMT_ELF_AOUT
|
||||
char passed_fileno[6];
|
||||
+#endif
|
||||
struct files_struct *files;
|
||||
|
||||
/* Get the exec-header */
|
||||
@@ -556,6 +571,7 @@
|
||||
|
||||
/* Some simple consistency checks for the interpreter */
|
||||
if (elf_interpreter) {
|
||||
+#ifdef CONFIG_BINFMT_ELF_AOUT
|
||||
interpreter_type = INTERPRETER_ELF | INTERPRETER_AOUT;
|
||||
|
||||
/* Now figure out which format our binary is */
|
||||
@@ -563,6 +579,9 @@
|
||||
(N_MAGIC(interp_ex) != ZMAGIC) &&
|
||||
(N_MAGIC(interp_ex) != QMAGIC))
|
||||
interpreter_type = INTERPRETER_ELF;
|
||||
+#else
|
||||
+ interpreter_type = INTERPRETER_ELF;
|
||||
+#endif
|
||||
|
||||
if (memcmp(interp_elf_ex.e_ident, ELFMAG, SELFMAG) != 0)
|
||||
interpreter_type &= ~INTERPRETER_ELF;
|
||||
@@ -571,6 +590,7 @@
|
||||
if (!interpreter_type)
|
||||
goto out_free_dentry;
|
||||
|
||||
+#ifdef CONFIG_BINFMT_ELF_AOUT
|
||||
/* Make sure only one type was selected */
|
||||
if ((interpreter_type & INTERPRETER_ELF) &&
|
||||
interpreter_type != INTERPRETER_ELF) {
|
||||
@@ -578,6 +598,7 @@
|
||||
// printk(KERN_WARNING "ELF: Ambiguous type, using ELF\n");
|
||||
interpreter_type = INTERPRETER_ELF;
|
||||
}
|
||||
+#endif
|
||||
/* Verify the interpreter has a valid arch */
|
||||
if ((interpreter_type == INTERPRETER_ELF) &&
|
||||
!elf_check_arch(&interp_elf_ex))
|
||||
@@ -590,6 +611,7 @@
|
||||
/* OK, we are done with that, now set up the arg stuff,
|
||||
and then start this sucker up */
|
||||
|
||||
+#ifdef CONFIG_BINFMT_ELF_AOUT
|
||||
if (!bprm->sh_bang) {
|
||||
char * passed_p;
|
||||
|
||||
@@ -605,6 +627,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
+#endif
|
||||
|
||||
/* Flush all traces of the currently running executable */
|
||||
retval = flush_old_exec(bprm);
|
||||
@@ -721,10 +744,12 @@
|
||||
end_data += load_bias;
|
||||
|
||||
if (elf_interpreter) {
|
||||
+#ifdef CONFIG_BINFMT_ELF_AOUT
|
||||
if (interpreter_type == INTERPRETER_AOUT)
|
||||
elf_entry = load_aout_interp(&interp_ex,
|
||||
interpreter);
|
||||
else
|
||||
+#endif
|
||||
elf_entry = load_elf_interp(&interp_elf_ex,
|
||||
interpreter,
|
||||
&interp_load_addr);
|
||||
@@ -743,7 +768,9 @@
|
||||
|
||||
kfree(elf_phdata);
|
||||
|
||||
+#ifdef CONFIG_BINFMT_ELF_AOUT
|
||||
if (interpreter_type != INTERPRETER_AOUT)
|
||||
+#endif
|
||||
sys_close(elf_exec_fileno);
|
||||
|
||||
set_binfmt(&elf_format);
|
||||
@@ -757,10 +784,14 @@
|
||||
&elf_ex,
|
||||
load_addr, load_bias,
|
||||
interp_load_addr,
|
||||
+#ifdef CONFIG_BINFMT_ELF_AOUT
|
||||
(interpreter_type == INTERPRETER_AOUT ? 0 : 1));
|
||||
/* N.B. passed_fileno might not be initialized? */
|
||||
if (interpreter_type == INTERPRETER_AOUT)
|
||||
current->mm->arg_start += strlen(passed_fileno) + 1;
|
||||
+#else
|
||||
+ 1);
|
||||
+#endif
|
||||
current->mm->start_brk = current->mm->brk = elf_brk;
|
||||
current->mm->end_code = end_code;
|
||||
current->mm->start_code = start_code;
|
||||
@@ -838,9 +869,9 @@
|
||||
goto out;
|
||||
}
|
||||
|
||||
+#ifdef CONFIG_BINFMT_ELF_AOUT
|
||||
/* This is really simpleminded and specialized - we are loading an
|
||||
a.out library that is given an ELF header. */
|
||||
-
|
||||
static int load_elf_library(struct file *file)
|
||||
{
|
||||
struct elf_phdr *elf_phdata;
|
||||
@@ -911,6 +942,7 @@
|
||||
out:
|
||||
return error;
|
||||
}
|
||||
+#endif
|
||||
|
||||
/*
|
||||
* Note that some platforms still use traditional core dumps and not
|
||||
diff -urPX nopatch linux-2.4.26/fs/exec.c linux/fs/exec.c
|
||||
--- linux-2.4.26/fs/exec.c Fri Feb 20 10:07:36 2004
|
||||
+++ linux/fs/exec.c Sat Apr 17 02:13:55 2004
|
||||
@@ -109,6 +109,7 @@
|
||||
*/
|
||||
asmlinkage long sys_uselib(const char * library)
|
||||
{
|
||||
+#if defined(CONFIG_BINFMT_AOUT) || defined(CONFIG_BINFMT_ELF_AOUT)
|
||||
struct file * file;
|
||||
struct nameidata nd;
|
||||
int error;
|
||||
@@ -155,6 +156,9 @@
|
||||
exit:
|
||||
path_release(&nd);
|
||||
goto out;
|
||||
+#else
|
||||
+ return -ENOSYS;
|
||||
+#endif
|
||||
}
|
||||
|
||||
/*
|
|
@ -0,0 +1,140 @@
|
|||
packaging/utils/nattpatch 2.4
|
||||
--- linux/include/net/sock.h 2002/02/06 15:25:10 1.1
|
||||
+++ linux/include/net/sock.h 2002/05/22 12:14:56
|
||||
@@ -488,7 +488,13 @@
|
||||
} bictcp;
|
||||
};
|
||||
|
||||
-
|
||||
+#if 1
|
||||
+#define UDP_OPT_IN_SOCK 1
|
||||
+struct udp_opt {
|
||||
+ __u32 esp_in_udp;
|
||||
+};
|
||||
+#endif
|
||||
+
|
||||
/*
|
||||
* This structure really needs to be cleaned up.
|
||||
* Most of it is for TCP, and not used by any of
|
||||
@@ -655,6 +661,9 @@
|
||||
#if defined(CONFIG_SPX) || defined (CONFIG_SPX_MODULE)
|
||||
struct spx_opt af_spx;
|
||||
#endif /* CONFIG_SPX */
|
||||
+#if 1
|
||||
+ struct udp_opt af_udp;
|
||||
+#endif
|
||||
|
||||
} tp_pinfo;
|
||||
|
||||
--- linux/net/Config.in.orig Fri Feb 9 14:34:13 2001
|
||||
+++ linux/net/Config.in Thu Feb 22 19:40:08 2001
|
||||
@@ -88,3 +88,5 @@
|
||||
endmenu
|
||||
|
||||
+bool 'IPSEC NAT-Traversal' CONFIG_IPSEC_NAT_TRAVERSAL
|
||||
+
|
||||
endmenu
|
||||
--- linux/net/ipv4/udp.c.1 Wed Jan 28 15:57:05 2004
|
||||
+++ linux/net/ipv4/udp.c Wed Jan 28 15:58:56 2004
|
||||
@@ -787,6 +787,9 @@
|
||||
|
||||
static int udp_queue_rcv_skb(struct sock * sk, struct sk_buff *skb)
|
||||
{
|
||||
+#ifdef CONFIG_IPSEC_NAT_TRAVERSAL
|
||||
+ struct udp_opt *tp = &(sk->tp_pinfo.af_udp);
|
||||
+#endif
|
||||
/*
|
||||
* Charge it to the socket, dropping if the queue is full.
|
||||
*/
|
||||
@@ -804,6 +807,40 @@
|
||||
}
|
||||
#endif
|
||||
|
||||
+#ifdef CONFIG_IPSEC_NAT_TRAVERSAL
|
||||
+ if (tp->esp_in_udp) {
|
||||
+ /*
|
||||
+ * Set skb->sk and xmit packet to ipsec_rcv.
|
||||
+ *
|
||||
+ * If ret != 0, ipsec_rcv refused the packet (not ESPinUDP),
|
||||
+ * restore skb->sk and fall back to sock_queue_rcv_skb
|
||||
+ */
|
||||
+ struct inet_protocol *esp = NULL;
|
||||
+
|
||||
+#if defined(CONFIG_KLIPS) && !defined(CONFIG_KLIPS_MODULE)
|
||||
+ /* optomize only when we know it is statically linked */
|
||||
+ extern struct inet_protocol esp_protocol;
|
||||
+ esp = &esp_protocol;
|
||||
+#else
|
||||
+ for (esp = (struct inet_protocol *)inet_protos[IPPROTO_ESP & (MAX_INET_PROTOS - 1)];
|
||||
+ (esp) && (esp->protocol != IPPROTO_ESP);
|
||||
+ esp = esp->next);
|
||||
+#endif
|
||||
+
|
||||
+ if (esp && esp->handler) {
|
||||
+ struct sock *sav_sk = skb->sk;
|
||||
+ skb->sk = sk;
|
||||
+ if (esp->handler(skb) == 0) {
|
||||
+ skb->sk = sav_sk;
|
||||
+ /*not sure we might count ESPinUDP as UDP...*/
|
||||
+ UDP_INC_STATS_BH(UdpInDatagrams);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ skb->sk = sav_sk;
|
||||
+ }
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
if (sock_queue_rcv_skb(sk,skb)<0) {
|
||||
UDP_INC_STATS_BH(UdpInErrors);
|
||||
IP_INC_STATS_BH(IpInDiscards);
|
||||
@@ -1027,13 +1064,49 @@
|
||||
return len;
|
||||
}
|
||||
|
||||
+static int udp_setsockopt(struct sock *sk, int level, int optname,
|
||||
+ char *optval, int optlen)
|
||||
+{
|
||||
+ struct udp_opt *tp = &(sk->tp_pinfo.af_udp);
|
||||
+ int val;
|
||||
+ int err = 0;
|
||||
+
|
||||
+ if (level != SOL_UDP)
|
||||
+ return ip_setsockopt(sk, level, optname, optval, optlen);
|
||||
+
|
||||
+ if(optlen<sizeof(int))
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ if (get_user(val, (int *)optval))
|
||||
+ return -EFAULT;
|
||||
+
|
||||
+ lock_sock(sk);
|
||||
+
|
||||
+ switch(optname) {
|
||||
+#ifdef CONFIG_IPSEC_NAT_TRAVERSAL
|
||||
+#ifndef UDP_ESPINUDP
|
||||
+#define UDP_ESPINUDP 100
|
||||
+#endif
|
||||
+ case UDP_ESPINUDP:
|
||||
+ tp->esp_in_udp = val;
|
||||
+ break;
|
||||
+#endif
|
||||
+ default:
|
||||
+ err = -ENOPROTOOPT;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ release_sock(sk);
|
||||
+ return err;
|
||||
+}
|
||||
+
|
||||
struct proto udp_prot = {
|
||||
name: "UDP",
|
||||
close: udp_close,
|
||||
connect: udp_connect,
|
||||
disconnect: udp_disconnect,
|
||||
ioctl: udp_ioctl,
|
||||
- setsockopt: ip_setsockopt,
|
||||
+ setsockopt: udp_setsockopt,
|
||||
getsockopt: ip_getsockopt,
|
||||
sendmsg: udp_sendmsg,
|
||||
recvmsg: udp_recvmsg,
|
|
@ -0,0 +1,296 @@
|
|||
diff -urN linux-2.4.26-pre5/Documentation/Configure.help linux-2.4.26-pre5-netdev-core/Documentation/Configure.help
|
||||
--- linux-2.4.26-pre5/Documentation/Configure.help Sat Mar 20 10:08:18 2004
|
||||
+++ linux-2.4.26-pre5-netdev-core/Documentation/Configure.help Sun Mar 21 10:16:14 2004
|
||||
@@ -10419,6 +10419,20 @@
|
||||
|
||||
If you don't know what to use this for, you don't need it.
|
||||
|
||||
+Allow Net Devices to contribute to /dev/random
|
||||
+CONFIG_NET_RANDOM
|
||||
+ If you say Y here, network device interrupts will contribute to the
|
||||
+ kernel entropy pool. Normally, block devices and some other devices
|
||||
+ feed the pool. Some systems, such as those that are headless or diskless,
|
||||
+ need additional entropy sources. Some people, however, feel that network
|
||||
+ devices should not contribute to /dev/random because an external attacker
|
||||
+ could observe incoming packets in an attempt to learn the entropy pool's
|
||||
+ state. If you say N, no network device will contribute entropy.
|
||||
+
|
||||
+ If you believe there is a chance of your network packets being observed
|
||||
+ and you doubt the security of the entropy pool's one-way hash, do not
|
||||
+ enable this. If unsure, say N.
|
||||
+
|
||||
Ethertap network tap (OBSOLETE)
|
||||
CONFIG_ETHERTAP
|
||||
If you say Y here (and have said Y to "Kernel/User network link
|
||||
diff -urN linux-2.4.26-pre5/drivers/net/Config.in linux-2.4.26-pre5-netdev-core/drivers/net/Config.in
|
||||
--- linux-2.4.26-pre5/drivers/net/Config.in Sat Mar 20 10:08:18 2004
|
||||
+++ linux-2.4.26-pre5-netdev-core/drivers/net/Config.in Sun Mar 21 10:16:14 2004
|
||||
@@ -8,6 +8,7 @@
|
||||
tristate 'Bonding driver support' CONFIG_BONDING
|
||||
tristate 'EQL (serial line load balancing) support' CONFIG_EQUALIZER
|
||||
tristate 'Universal TUN/TAP device driver support' CONFIG_TUN
|
||||
+bool 'Allow Net Devices to contribute to /dev/random' CONFIG_NET_RANDOM
|
||||
if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
|
||||
tristate 'Ethertap network tap (OBSOLETE)' CONFIG_ETHERTAP
|
||||
fi
|
||||
diff -urN linux-2.4.26-pre5/include/asm-alpha/signal.h linux-2.4.26-pre5-netdev-core/include/asm-alpha/signal.h
|
||||
--- linux-2.4.26-pre5/include/asm-alpha/signal.h Sat Dec 1 18:27:14 2001
|
||||
+++ linux-2.4.26-pre5-netdev-core/include/asm-alpha/signal.h Sun Mar 21 10:16:14 2004
|
||||
@@ -121,7 +121,14 @@
|
||||
#define SA_PROBE SA_ONESHOT
|
||||
#define SA_SAMPLE_RANDOM SA_RESTART
|
||||
#define SA_SHIRQ 0x40000000
|
||||
+
|
||||
+#ifdef CONFIG_NET_RANDOM
|
||||
+#define SA_NET_RANDOM SA_SAMPLE_RANDOM
|
||||
+#else
|
||||
+#define SA_NET_RANDOM 0
|
||||
#endif
|
||||
+
|
||||
+#endif /* __KERNEL__ */
|
||||
|
||||
#define SIG_BLOCK 1 /* for blocking signals */
|
||||
#define SIG_UNBLOCK 2 /* for unblocking signals */
|
||||
diff -urN linux-2.4.26-pre5/include/asm-arm/signal.h linux-2.4.26-pre5-netdev-core/include/asm-arm/signal.h
|
||||
--- linux-2.4.26-pre5/include/asm-arm/signal.h Sat Sep 13 07:57:29 2003
|
||||
+++ linux-2.4.26-pre5-netdev-core/include/asm-arm/signal.h Sun Mar 21 10:16:14 2004
|
||||
@@ -125,7 +125,14 @@
|
||||
#define SA_PROBE 0x80000000
|
||||
#define SA_SAMPLE_RANDOM 0x10000000
|
||||
#define SA_SHIRQ 0x04000000
|
||||
+
|
||||
+#ifdef CONFIG_NET_RANDOM
|
||||
+#define SA_NET_RANDOM SA_SAMPLE_RANDOM
|
||||
+#else
|
||||
+#define SA_NET_RANDOM 0
|
||||
#endif
|
||||
+
|
||||
+#endif /* __KERNEL__ */
|
||||
|
||||
#define SIG_BLOCK 0 /* for blocking signals */
|
||||
#define SIG_UNBLOCK 1 /* for unblocking signals */
|
||||
diff -urN linux-2.4.26-pre5/include/asm-cris/signal.h linux-2.4.26-pre5-netdev-core/include/asm-cris/signal.h
|
||||
--- linux-2.4.26-pre5/include/asm-cris/signal.h Sat Dec 1 18:27:14 2001
|
||||
+++ linux-2.4.26-pre5-netdev-core/include/asm-cris/signal.h Sun Mar 21 10:16:14 2004
|
||||
@@ -120,7 +120,14 @@
|
||||
#define SA_PROBE SA_ONESHOT
|
||||
#define SA_SAMPLE_RANDOM SA_RESTART
|
||||
#define SA_SHIRQ 0x04000000
|
||||
+
|
||||
+#ifdef CONFIG_NET_RANDOM
|
||||
+#define SA_NET_RANDOM SA_SAMPLE_RANDOM
|
||||
+#else
|
||||
+#define SA_NET_RANDOM 0
|
||||
#endif
|
||||
+
|
||||
+#endif /* __KERNEL__ */
|
||||
|
||||
#define SIG_BLOCK 0 /* for blocking signals */
|
||||
#define SIG_UNBLOCK 1 /* for unblocking signals */
|
||||
diff -urN linux-2.4.26-pre5/include/asm-i386/signal.h linux-2.4.26-pre5-netdev-core/include/asm-i386/signal.h
|
||||
--- linux-2.4.26-pre5/include/asm-i386/signal.h Sun Mar 21 00:00:43 2004
|
||||
+++ linux-2.4.26-pre5-netdev-core/include/asm-i386/signal.h Sun Mar 21 10:16:14 2004
|
||||
@@ -119,7 +119,14 @@
|
||||
#define SA_PROBE SA_ONESHOT
|
||||
#define SA_SAMPLE_RANDOM SA_RESTART
|
||||
#define SA_SHIRQ 0x04000000
|
||||
+
|
||||
+#ifdef CONFIG_NET_RANDOM
|
||||
+#define SA_NET_RANDOM SA_SAMPLE_RANDOM
|
||||
+#else
|
||||
+#define SA_NET_RANDOM 0
|
||||
#endif
|
||||
+
|
||||
+#endif /* __KERNEL__ */
|
||||
|
||||
#define SIG_BLOCK 0 /* for blocking signals */
|
||||
#define SIG_UNBLOCK 1 /* for unblocking signals */
|
||||
diff -urN linux-2.4.26-pre5/include/asm-ia64/signal.h linux-2.4.26-pre5-netdev-core/include/asm-ia64/signal.h
|
||||
--- linux-2.4.26-pre5/include/asm-ia64/signal.h Sat Mar 20 10:08:20 2004
|
||||
+++ linux-2.4.26-pre5-netdev-core/include/asm-ia64/signal.h Sun Mar 21 10:16:14 2004
|
||||
@@ -117,6 +117,12 @@
|
||||
#define SA_SHIRQ 0x04000000
|
||||
#define SA_PERCPU_IRQ 0x02000000
|
||||
|
||||
+#ifdef CONFIG_NET_RANDOM
|
||||
+#define SA_NET_RANDOM SA_SAMPLE_RANDOM
|
||||
+#else
|
||||
+#define SA_NET_RANDOM 0
|
||||
+#endif
|
||||
+
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#define SIG_BLOCK 0 /* for blocking signals */
|
||||
diff -urN linux-2.4.26-pre5/include/asm-m68k/signal.h linux-2.4.26-pre5-netdev-core/include/asm-m68k/signal.h
|
||||
--- linux-2.4.26-pre5/include/asm-m68k/signal.h Fri Feb 20 07:38:33 2004
|
||||
+++ linux-2.4.26-pre5-netdev-core/include/asm-m68k/signal.h Sun Mar 21 10:16:14 2004
|
||||
@@ -116,7 +116,14 @@
|
||||
#define SA_PROBE SA_ONESHOT
|
||||
#define SA_SAMPLE_RANDOM SA_RESTART
|
||||
#define SA_SHIRQ 0x04000000
|
||||
+
|
||||
+#ifdef CONFIG_NET_RANDOM
|
||||
+#define SA_NET_RANDOM SA_SAMPLE_RANDOM
|
||||
+#else
|
||||
+#define SA_NET_RANDOM 0
|
||||
#endif
|
||||
+
|
||||
+#endif /* __KERNEL__ */
|
||||
|
||||
#define SIG_BLOCK 0 /* for blocking signals */
|
||||
#define SIG_UNBLOCK 1 /* for unblocking signals */
|
||||
diff -urN linux-2.4.26-pre5/include/asm-mips/signal.h linux-2.4.26-pre5-netdev-core/include/asm-mips/signal.h
|
||||
--- linux-2.4.26-pre5/include/asm-mips/signal.h Sat Sep 13 07:57:31 2003
|
||||
+++ linux-2.4.26-pre5-netdev-core/include/asm-mips/signal.h Sun Mar 21 10:16:14 2004
|
||||
@@ -111,6 +111,12 @@
|
||||
#define SA_SAMPLE_RANDOM SA_RESTART
|
||||
#define SA_SHIRQ 0x02000000
|
||||
|
||||
+#ifdef CONFIG_NET_RANDOM
|
||||
+#define SA_NET_RANDOM SA_SAMPLE_RANDOM
|
||||
+#else
|
||||
+#define SA_NET_RANDOM 0
|
||||
+#endif
|
||||
+
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#define SIG_BLOCK 1 /* for blocking signals */
|
||||
diff -urN linux-2.4.26-pre5/include/asm-mips64/signal.h linux-2.4.26-pre5-netdev-core/include/asm-mips64/signal.h
|
||||
--- linux-2.4.26-pre5/include/asm-mips64/signal.h Sat Sep 13 07:57:32 2003
|
||||
+++ linux-2.4.26-pre5-netdev-core/include/asm-mips64/signal.h Sun Mar 21 10:16:14 2004
|
||||
@@ -119,6 +119,12 @@
|
||||
#define SA_SAMPLE_RANDOM SA_RESTART
|
||||
#define SA_SHIRQ 0x02000000
|
||||
|
||||
+#ifdef CONFIG_NET_RANDOM
|
||||
+#define SA_NET_RANDOM SA_SAMPLE_RANDOM
|
||||
+#else
|
||||
+#define SA_NET_RANDOM 0
|
||||
+#endif
|
||||
+
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#define SIG_BLOCK 1 /* for blocking signals */
|
||||
diff -urN linux-2.4.26-pre5/include/asm-parisc/signal.h linux-2.4.26-pre5-netdev-core/include/asm-parisc/signal.h
|
||||
--- linux-2.4.26-pre5/include/asm-parisc/signal.h Sun Jan 11 18:48:21 2004
|
||||
+++ linux-2.4.26-pre5-netdev-core/include/asm-parisc/signal.h Sun Mar 21 10:16:14 2004
|
||||
@@ -100,6 +100,12 @@
|
||||
#define SA_SAMPLE_RANDOM SA_RESTART
|
||||
#define SA_SHIRQ 0x04000000
|
||||
|
||||
+#ifdef CONFIG_NET_RANDOM
|
||||
+#define SA_NET_RANDOM SA_SAMPLE_RANDOM
|
||||
+#else
|
||||
+#define SA_NET_RANDOM 0
|
||||
+#endif
|
||||
+
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#define SIG_BLOCK 0 /* for blocking signals */
|
||||
diff -urN linux-2.4.26-pre5/include/asm-ppc/signal.h linux-2.4.26-pre5-netdev-core/include/asm-ppc/signal.h
|
||||
--- linux-2.4.26-pre5/include/asm-ppc/signal.h Sat Sep 13 07:57:32 2003
|
||||
+++ linux-2.4.26-pre5-netdev-core/include/asm-ppc/signal.h Sun Mar 21 10:16:14 2004
|
||||
@@ -111,6 +111,13 @@
|
||||
#define SA_PROBE SA_ONESHOT
|
||||
#define SA_SAMPLE_RANDOM SA_RESTART
|
||||
#define SA_SHIRQ 0x04000000
|
||||
+
|
||||
+#ifdef CONFIG_NET_RANDOM
|
||||
+#define SA_NET_RANDOM SA_SAMPLE_RANDOM
|
||||
+#else
|
||||
+#define SA_NET_RANDOM 0
|
||||
+#endif
|
||||
+
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#define SIG_BLOCK 0 /* for blocking signals */
|
||||
diff -urN linux-2.4.26-pre5/include/asm-s390/signal.h linux-2.4.26-pre5-netdev-core/include/asm-s390/signal.h
|
||||
--- linux-2.4.26-pre5/include/asm-s390/signal.h Fri Feb 20 07:38:34 2004
|
||||
+++ linux-2.4.26-pre5-netdev-core/include/asm-s390/signal.h Sun Mar 21 10:16:14 2004
|
||||
@@ -129,7 +129,14 @@
|
||||
#define SA_SHIRQ 0x04000000
|
||||
#define SA_DOPATHGROUP 0x00100000
|
||||
#define SA_FORCE 0x00200000
|
||||
+
|
||||
+#ifdef CONFIG_NET_RANDOM
|
||||
+#define SA_NET_RANDOM SA_SAMPLE_RANDOM
|
||||
+#else
|
||||
+#define SA_NET_RANDOM 0
|
||||
#endif
|
||||
+
|
||||
+#endif /* __KERNEL__ */
|
||||
|
||||
#define SIG_BLOCK 0 /* for blocking signals */
|
||||
#define SIG_UNBLOCK 1 /* for unblocking signals */
|
||||
diff -urN linux-2.4.26-pre5/include/asm-s390x/signal.h linux-2.4.26-pre5-netdev-core/include/asm-s390x/signal.h
|
||||
--- linux-2.4.26-pre5/include/asm-s390x/signal.h Fri Feb 20 07:38:34 2004
|
||||
+++ linux-2.4.26-pre5-netdev-core/include/asm-s390x/signal.h Sun Mar 21 10:16:14 2004
|
||||
@@ -129,7 +129,14 @@
|
||||
#define SA_SHIRQ 0x04000000
|
||||
#define SA_DOPATHGROUP 0x00100000
|
||||
#define SA_FORCE 0x00200000
|
||||
+
|
||||
+#ifdef CONFIG_NET_RANDOM
|
||||
+#define SA_NET_RANDOM SA_SAMPLE_RANDOM
|
||||
+#else
|
||||
+#define SA_NET_RANDOM 0
|
||||
#endif
|
||||
+
|
||||
+#endif /* __KERNEL__ */
|
||||
|
||||
#define SIG_BLOCK 0 /* for blocking signals */
|
||||
#define SIG_UNBLOCK 1 /* for unblocking signals */
|
||||
diff -urN linux-2.4.26-pre5/include/asm-sh/signal.h linux-2.4.26-pre5-netdev-core/include/asm-sh/signal.h
|
||||
--- linux-2.4.26-pre5/include/asm-sh/signal.h Sat Dec 1 18:27:13 2001
|
||||
+++ linux-2.4.26-pre5-netdev-core/include/asm-sh/signal.h Sun Mar 21 10:16:14 2004
|
||||
@@ -107,7 +107,14 @@
|
||||
#define SA_PROBE SA_ONESHOT
|
||||
#define SA_SAMPLE_RANDOM SA_RESTART
|
||||
#define SA_SHIRQ 0x04000000
|
||||
+
|
||||
+#ifdef CONFIG_NET_RANDOM
|
||||
+#define SA_NET_RANDOM SA_SAMPLE_RANDOM
|
||||
+#else
|
||||
+#define SA_NET_RANDOM 0
|
||||
#endif
|
||||
+
|
||||
+#endif /* __KERNEL__ */
|
||||
|
||||
#define SIG_BLOCK 0 /* for blocking signals */
|
||||
#define SIG_UNBLOCK 1 /* for unblocking signals */
|
||||
diff -urN linux-2.4.26-pre5/include/asm-sparc/signal.h linux-2.4.26-pre5-netdev-core/include/asm-sparc/signal.h
|
||||
--- linux-2.4.26-pre5/include/asm-sparc/signal.h Sat Dec 1 18:27:14 2001
|
||||
+++ linux-2.4.26-pre5-netdev-core/include/asm-sparc/signal.h Sun Mar 21 10:16:14 2004
|
||||
@@ -176,7 +176,14 @@
|
||||
#define SA_PROBE SA_ONESHOT
|
||||
#define SA_SAMPLE_RANDOM SA_RESTART
|
||||
#define SA_STATIC_ALLOC 0x80
|
||||
+
|
||||
+#ifdef CONFIG_NET_RANDOM
|
||||
+#define SA_NET_RANDOM SA_SAMPLE_RANDOM
|
||||
+#else
|
||||
+#define SA_NET_RANDOM 0
|
||||
#endif
|
||||
+
|
||||
+#endif /* __KERNEL__ */
|
||||
|
||||
/* Type of a signal handler. */
|
||||
#ifdef __KERNEL__
|
||||
diff -urN linux-2.4.26-pre5/include/asm-sparc64/signal.h linux-2.4.26-pre5-netdev-core/include/asm-sparc64/signal.h
|
||||
--- linux-2.4.26-pre5/include/asm-sparc64/signal.h Sat Dec 1 18:27:14 2001
|
||||
+++ linux-2.4.26-pre5-netdev-core/include/asm-sparc64/signal.h Sun Mar 21 10:16:14 2004
|
||||
@@ -192,7 +192,14 @@
|
||||
#define SA_PROBE SA_ONESHOT
|
||||
#define SA_SAMPLE_RANDOM SA_RESTART
|
||||
#define SA_STATIC_ALLOC 0x80
|
||||
+
|
||||
+#ifdef CONFIG_NET_RANDOM
|
||||
+#define SA_NET_RANDOM SA_SAMPLE_RANDOM
|
||||
+#else
|
||||
+#define SA_NET_RANDOM 0
|
||||
#endif
|
||||
+
|
||||
+#endif /* __KERNEL__ */
|
||||
|
||||
/* Type of a signal handler. */
|
||||
#ifdef __KERNEL__
|
|
@ -0,0 +1,11 @@
|
|||
--- linux-2.4.30.old/drivers/net/et/et_linux.c 2005-05-05 02:53:35.000000000 +0200
|
||||
+++ linux-2.4.30/drivers/net/et/et_linux.c 2005-05-05 02:54:01.000000000 +0200
|
||||
@@ -192,7 +192,7 @@
|
||||
#endif
|
||||
|
||||
/* register our interrupt handler */
|
||||
- if (request_irq(pdev->irq, et_isr, SA_SHIRQ, dev->name, et)) {
|
||||
+ if (request_irq(pdev->irq, et_isr, SA_SHIRQ | SA_NET_RANDOM, dev->name, et)) {
|
||||
ET_ERROR(("et%d: request_irq() failed\n", unit));
|
||||
goto fail;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,738 @@
|
|||
diff -rNu linux-2.4.29.old/drivers/usb/serial/pl2303.c linux-2.4.29/drivers/usb/serial/pl2303.c
|
||||
--- linux-2.4.29.old/drivers/usb/serial/pl2303.c 2005-03-22 14:48:04.000000000 +0100
|
||||
+++ linux-2.4.29/drivers/usb/serial/pl2303.c 2005-03-22 15:33:05.735943352 +0100
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Prolific PL2303 USB to serial adaptor driver
|
||||
*
|
||||
- * Copyright (C) 2001-2003 Greg Kroah-Hartman (greg@kroah.com)
|
||||
+ * Copyright (C) 2001-2004 Greg Kroah-Hartman (greg@kroah.com)
|
||||
* Copyright (C) 2003 IBM Corp.
|
||||
*
|
||||
* Original driver for 2.2.x by anonymous
|
||||
@@ -12,8 +12,16 @@
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* See Documentation/usb/usb-serial.txt for more information on using this driver
|
||||
- * 2003_Apr_24 gkh
|
||||
- * Added line error reporting support. Hopefully it is correct...
|
||||
+ *
|
||||
+ *
|
||||
+ * 2005_Mar_05 grsch
|
||||
+ * ported 2.6.8 pl2303.c to 2.4.20 format
|
||||
+ * (HX model works fine now, ID table should be brought up to date)
|
||||
+ * Gregor Schaffrath <gschaff@ran-dom.org>
|
||||
+ *
|
||||
+ * 2002_Mar_26 gkh
|
||||
+ * allowed driver to work properly if there is no tty assigned to a port
|
||||
+ * (this happens for serial console devices.)
|
||||
*
|
||||
* 2001_Oct_06 gkh
|
||||
* Added RTS and DTR line control. Thanks to joe@bndlg.de for parts of it.
|
||||
@@ -33,6 +41,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
+static int debug;
|
||||
+
|
||||
+
|
||||
#include <linux/config.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/errno.h>
|
||||
@@ -46,43 +57,44 @@
|
||||
#include <linux/spinlock.h>
|
||||
#include <asm/uaccess.h>
|
||||
#include <linux/usb.h>
|
||||
-
|
||||
-#ifdef CONFIG_USB_SERIAL_DEBUG
|
||||
- static int debug = 1;
|
||||
-#else
|
||||
- static int debug;
|
||||
-#endif
|
||||
-
|
||||
#include "usb-serial.h"
|
||||
#include "pl2303.h"
|
||||
|
||||
/*
|
||||
* Version Information
|
||||
*/
|
||||
-#define DRIVER_VERSION "v0.10"
|
||||
+#define DRIVER_VERSION "v0.11"
|
||||
#define DRIVER_DESC "Prolific PL2303 USB to serial adaptor driver"
|
||||
|
||||
-
|
||||
-
|
||||
static struct usb_device_id id_table [] = {
|
||||
{ USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID) },
|
||||
{ USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_RSAQ2) },
|
||||
{ USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) },
|
||||
{ USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) },
|
||||
- { USB_DEVICE(ATEN_VENDOR_ID2, ATEN_PRODUCT_ID) },
|
||||
{ USB_DEVICE(ELCOM_VENDOR_ID, ELCOM_PRODUCT_ID) },
|
||||
{ USB_DEVICE(ITEGNO_VENDOR_ID, ITEGNO_PRODUCT_ID) },
|
||||
{ USB_DEVICE(MA620_VENDOR_ID, MA620_PRODUCT_ID) },
|
||||
- { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID) },
|
||||
- { USB_DEVICE(TRIPP_VENDOR_ID, TRIPP_PRODUCT_ID) },
|
||||
- { USB_DEVICE(RADIOSHACK_VENDOR_ID, RADIOSHACK_PRODUCT_ID) },
|
||||
- { USB_DEVICE(DCU10_VENDOR_ID, DCU10_PRODUCT_ID) },
|
||||
- { USB_DEVICE(SITECOM_VENDOR_ID, SITECOM_PRODUCT_ID) },
|
||||
+ { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID) },
|
||||
+ { USB_DEVICE(TRIPP_VENDOR_ID, TRIPP_PRODUCT_ID) },
|
||||
+ { USB_DEVICE(RADIOSHACK_VENDOR_ID, RADIOSHACK_PRODUCT_ID) },
|
||||
+ { USB_DEVICE(DCU10_VENDOR_ID, DCU10_PRODUCT_ID) },
|
||||
+ { USB_DEVICE(SITECOM_VENDOR_ID, SITECOM_PRODUCT_ID) },
|
||||
+ { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_ID) },
|
||||
+ { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_ID) },
|
||||
{ } /* Terminating entry */
|
||||
};
|
||||
|
||||
MODULE_DEVICE_TABLE (usb, id_table);
|
||||
|
||||
+/*
|
||||
+static struct usb_driver pl2303_driver = {
|
||||
+ .owner = THIS_MODULE,
|
||||
+ .name = "pl2303",
|
||||
+ .probe = usb_serial_probe,
|
||||
+ .disconnect = usb_serial_disconnect,
|
||||
+ .id_table = id_table,
|
||||
+};
|
||||
+*/
|
||||
|
||||
#define SET_LINE_REQUEST_TYPE 0x21
|
||||
#define SET_LINE_REQUEST 0x20
|
||||
@@ -130,6 +142,9 @@
|
||||
static int pl2303_write (struct usb_serial_port *port, int from_user,
|
||||
const unsigned char *buf, int count);
|
||||
static void pl2303_break_ctl(struct usb_serial_port *port,int break_state);
|
||||
+static int pl2303_tiocmget (struct usb_serial_port *port, struct file *file);
|
||||
+static int pl2303_tiocmset (struct usb_serial_port *port, struct file *file,
|
||||
+ unsigned int set, unsigned int clear);
|
||||
static int pl2303_startup (struct usb_serial *serial);
|
||||
static void pl2303_shutdown (struct usb_serial *serial);
|
||||
|
||||
@@ -149,27 +164,48 @@
|
||||
.ioctl = pl2303_ioctl,
|
||||
.break_ctl = pl2303_break_ctl,
|
||||
.set_termios = pl2303_set_termios,
|
||||
+ //.tiocmget = pl2303_tiocmget,
|
||||
+ //.tiocmset = pl2303_tiocmset,
|
||||
.read_bulk_callback = pl2303_read_bulk_callback,
|
||||
.read_int_callback = pl2303_read_int_callback,
|
||||
.write_bulk_callback = pl2303_write_bulk_callback,
|
||||
+ //.attach = pl2303_startup,
|
||||
.startup = pl2303_startup,
|
||||
.shutdown = pl2303_shutdown,
|
||||
};
|
||||
|
||||
+enum pl2303_type {
|
||||
+ type_0, /* don't know the difference between type 0 and */
|
||||
+ type_1, /* type 1, until someone from prolific tells us... */
|
||||
+ HX, /* HX version of the pl2303 chip */
|
||||
+};
|
||||
+
|
||||
struct pl2303_private {
|
||||
spinlock_t lock;
|
||||
wait_queue_head_t delta_msr_wait;
|
||||
u8 line_control;
|
||||
u8 line_status;
|
||||
u8 termios_initialized;
|
||||
+ enum pl2303_type type;
|
||||
};
|
||||
|
||||
|
||||
static int pl2303_startup (struct usb_serial *serial)
|
||||
{
|
||||
struct pl2303_private *priv;
|
||||
+ enum pl2303_type type = type_0;
|
||||
int i;
|
||||
|
||||
+ if (serial->dev->descriptor.bDeviceClass == 0x02)
|
||||
+ type = type_0;
|
||||
+ else if (serial->dev->descriptor.bMaxPacketSize0 == 0x40)
|
||||
+ type = HX;
|
||||
+ else if (serial->dev->descriptor.bDeviceClass == 0x00)
|
||||
+ type = type_1;
|
||||
+ else if (serial->dev->descriptor.bDeviceClass == 0xFF)
|
||||
+ type = type_1;
|
||||
+ dbg("device type: %d", type);
|
||||
+
|
||||
for (i = 0; i < serial->num_ports; ++i) {
|
||||
priv = kmalloc (sizeof (struct pl2303_private), GFP_KERNEL);
|
||||
if (!priv)
|
||||
@@ -177,7 +213,8 @@
|
||||
memset (priv, 0x00, sizeof (struct pl2303_private));
|
||||
spin_lock_init(&priv->lock);
|
||||
init_waitqueue_head(&priv->delta_msr_wait);
|
||||
- usb_set_serial_port_data(&serial->port[i], priv);
|
||||
+ priv->type = type;
|
||||
+ serial->port[i].private = priv;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -215,13 +252,13 @@
|
||||
memcpy (port->write_urb->transfer_buffer, buf, count);
|
||||
}
|
||||
|
||||
- usb_serial_debug_data (__FILE__, __FUNCTION__, count, port->write_urb->transfer_buffer);
|
||||
+ usb_serial_debug_data(__FILE__, __FUNCTION__, count, port->write_urb->transfer_buffer);
|
||||
|
||||
port->write_urb->transfer_buffer_length = count;
|
||||
port->write_urb->dev = port->serial->dev;
|
||||
result = usb_submit_urb (port->write_urb);
|
||||
if (result)
|
||||
- err("%s - failed submitting write urb, error %d", __FUNCTION__, result);
|
||||
+ err("%s - failed submitting write urb, error %d\n", __FUNCTION__, result);
|
||||
else
|
||||
result = count;
|
||||
|
||||
@@ -233,7 +270,7 @@
|
||||
static void pl2303_set_termios (struct usb_serial_port *port, struct termios *old_termios)
|
||||
{
|
||||
struct usb_serial *serial = port->serial;
|
||||
- struct pl2303_private *priv = usb_get_serial_port_data(port);
|
||||
+ struct pl2303_private *priv = port->private;
|
||||
unsigned long flags;
|
||||
unsigned int cflag;
|
||||
unsigned char *buf;
|
||||
@@ -241,8 +278,7 @@
|
||||
int i;
|
||||
u8 control;
|
||||
|
||||
- dbg("%s - port %d, initialized = %d", __FUNCTION__, port->number,
|
||||
- priv->termios_initialized);
|
||||
+ dbg("%s - port %d", __FUNCTION__, port->number);
|
||||
|
||||
if ((!port->tty) || (!port->tty->termios)) {
|
||||
dbg("%s - no tty structures", __FUNCTION__);
|
||||
@@ -269,7 +305,7 @@
|
||||
|
||||
buf = kmalloc (7, GFP_KERNEL);
|
||||
if (!buf) {
|
||||
- err("%s - out of memory.", __FUNCTION__);
|
||||
+ err("%s - out of memory.\n", __FUNCTION__);
|
||||
return;
|
||||
}
|
||||
memset (buf, 0x00, 0x07);
|
||||
@@ -311,7 +347,7 @@
|
||||
case B230400: baud = 230400; break;
|
||||
case B460800: baud = 460800; break;
|
||||
default:
|
||||
- err ("pl2303 driver does not support the baudrate requested (fix it)");
|
||||
+ err("pl2303 driver does not support the baudrate requested (fix it)\n");
|
||||
break;
|
||||
}
|
||||
dbg("%s - baud = %d", __FUNCTION__, baud);
|
||||
@@ -380,26 +416,30 @@
|
||||
buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6]);
|
||||
|
||||
if (cflag & CRTSCTS) {
|
||||
- i = usb_control_msg (serial->dev, usb_sndctrlpipe (serial->dev, 0),
|
||||
- VENDOR_WRITE_REQUEST, VENDOR_WRITE_REQUEST_TYPE,
|
||||
- 0x0, 0x41, NULL, 0, 100);
|
||||
- dbg ("0x40:0x1:0x0:0x41 %d", i);
|
||||
+ __u16 index;
|
||||
+ if (priv->type == HX)
|
||||
+ index = 0x61;
|
||||
+ else
|
||||
+ index = 0x41;
|
||||
+ i = usb_control_msg(serial->dev,
|
||||
+ usb_sndctrlpipe(serial->dev, 0),
|
||||
+ VENDOR_WRITE_REQUEST,
|
||||
+ VENDOR_WRITE_REQUEST_TYPE,
|
||||
+ 0x0, index, NULL, 0, 100);
|
||||
+ dbg ("0x40:0x1:0x0:0x%x %d", index, i);
|
||||
}
|
||||
|
||||
kfree (buf);
|
||||
-}
|
||||
-
|
||||
+}
|
||||
|
||||
static int pl2303_open (struct usb_serial_port *port, struct file *filp)
|
||||
{
|
||||
struct termios tmp_termios;
|
||||
struct usb_serial *serial = port->serial;
|
||||
+ struct pl2303_private *priv = port->private;
|
||||
unsigned char *buf;
|
||||
int result;
|
||||
|
||||
- if (port_paranoia_check (port, __FUNCTION__))
|
||||
- return -ENODEV;
|
||||
-
|
||||
dbg("%s - port %d", __FUNCTION__, port->number);
|
||||
|
||||
usb_clear_halt(serial->dev, port->write_urb->pipe);
|
||||
@@ -427,6 +467,18 @@
|
||||
SOUP (VENDOR_WRITE_REQUEST_TYPE, VENDOR_WRITE_REQUEST, 0x0404, 1);
|
||||
FISH (VENDOR_READ_REQUEST_TYPE, VENDOR_READ_REQUEST, 0x8484, 0);
|
||||
FISH (VENDOR_READ_REQUEST_TYPE, VENDOR_READ_REQUEST, 0x8383, 0);
|
||||
+ SOUP (VENDOR_WRITE_REQUEST_TYPE, VENDOR_WRITE_REQUEST, 0, 1);
|
||||
+ SOUP (VENDOR_WRITE_REQUEST_TYPE, VENDOR_WRITE_REQUEST, 1, 0);
|
||||
+
|
||||
+ if (priv->type == HX) {
|
||||
+ /* HX chip */
|
||||
+ SOUP (VENDOR_WRITE_REQUEST_TYPE, VENDOR_WRITE_REQUEST, 2, 0x44);
|
||||
+ /* reset upstream data pipes */
|
||||
+ SOUP (VENDOR_WRITE_REQUEST_TYPE, VENDOR_WRITE_REQUEST, 8, 0);
|
||||
+ SOUP (VENDOR_WRITE_REQUEST_TYPE, VENDOR_WRITE_REQUEST, 9, 0);
|
||||
+ } else {
|
||||
+ SOUP (VENDOR_WRITE_REQUEST_TYPE, VENDOR_WRITE_REQUEST, 2, 0x24);
|
||||
+ }
|
||||
|
||||
kfree(buf);
|
||||
|
||||
@@ -441,7 +493,7 @@
|
||||
port->read_urb->dev = serial->dev;
|
||||
result = usb_submit_urb (port->read_urb);
|
||||
if (result) {
|
||||
- err("%s - failed submitting read urb, error %d", __FUNCTION__, result);
|
||||
+ err("%s - failed submitting read urb, error %d\n", __FUNCTION__, result);
|
||||
pl2303_close (port, NULL);
|
||||
return -EPROTO;
|
||||
}
|
||||
@@ -450,7 +502,7 @@
|
||||
port->interrupt_in_urb->dev = serial->dev;
|
||||
result = usb_submit_urb (port->interrupt_in_urb);
|
||||
if (result) {
|
||||
- err("%s - failed submitting interrupt urb, error %d", __FUNCTION__, result);
|
||||
+ err("%s - failed submitting interrupt urb, error %d\n", __FUNCTION__, result);
|
||||
pl2303_close (port, NULL);
|
||||
return -EPROTO;
|
||||
}
|
||||
@@ -460,125 +512,103 @@
|
||||
|
||||
static void pl2303_close (struct usb_serial_port *port, struct file *filp)
|
||||
{
|
||||
- struct usb_serial *serial;
|
||||
struct pl2303_private *priv;
|
||||
unsigned long flags;
|
||||
unsigned int c_cflag;
|
||||
int result;
|
||||
|
||||
- if (port_paranoia_check (port, __FUNCTION__))
|
||||
- return;
|
||||
- serial = get_usb_serial (port, __FUNCTION__);
|
||||
- if (!serial)
|
||||
- return;
|
||||
-
|
||||
dbg("%s - port %d", __FUNCTION__, port->number);
|
||||
|
||||
- if (serial->dev) {
|
||||
- if (port->tty) {
|
||||
- c_cflag = port->tty->termios->c_cflag;
|
||||
- if (c_cflag & HUPCL) {
|
||||
- /* drop DTR and RTS */
|
||||
- priv = usb_get_serial_port_data(port);
|
||||
- spin_lock_irqsave(&priv->lock, flags);
|
||||
- priv->line_control = 0;
|
||||
- spin_unlock_irqrestore (&priv->lock, flags);
|
||||
- set_control_lines (port->serial->dev, 0);
|
||||
- }
|
||||
- }
|
||||
+ /* shutdown our urbs */
|
||||
+ dbg("%s - shutting down urbs", __FUNCTION__);
|
||||
+ result = usb_unlink_urb (port->write_urb);
|
||||
+ if (result)
|
||||
+ dbg("%s - usb_unlink_urb (write_urb)"
|
||||
+ " failed with reason: %d", __FUNCTION__,
|
||||
+ result);
|
||||
|
||||
- /* shutdown our urbs */
|
||||
- dbg("%s - shutting down urbs", __FUNCTION__);
|
||||
- result = usb_unlink_urb (port->write_urb);
|
||||
- if (result)
|
||||
- dbg("%s - usb_unlink_urb (write_urb)"
|
||||
- " failed with reason: %d", __FUNCTION__,
|
||||
- result);
|
||||
+ result = usb_unlink_urb (port->read_urb);
|
||||
+ if (result)
|
||||
+ dbg("%s - usb_unlink_urb (read_urb) "
|
||||
+ "failed with reason: %d", __FUNCTION__,
|
||||
+ result);
|
||||
|
||||
- result = usb_unlink_urb (port->read_urb);
|
||||
- if (result)
|
||||
- dbg("%s - usb_unlink_urb (read_urb) "
|
||||
- "failed with reason: %d", __FUNCTION__,
|
||||
- result);
|
||||
+ result = usb_unlink_urb (port->interrupt_in_urb);
|
||||
+ if (result)
|
||||
+ dbg("%s - usb_unlink_urb (interrupt_in_urb)"
|
||||
+ " failed with reason: %d", __FUNCTION__,
|
||||
+ result);
|
||||
|
||||
- result = usb_unlink_urb (port->interrupt_in_urb);
|
||||
- if (result)
|
||||
- dbg("%s - usb_unlink_urb (interrupt_in_urb)"
|
||||
- " failed with reason: %d", __FUNCTION__,
|
||||
- result);
|
||||
+ if (port->tty) {
|
||||
+ c_cflag = port->tty->termios->c_cflag;
|
||||
+ if (c_cflag & HUPCL) {
|
||||
+ /* drop DTR and RTS */
|
||||
+ priv = port->private;
|
||||
+ spin_lock_irqsave(&priv->lock, flags);
|
||||
+ priv->line_control = 0;
|
||||
+ spin_unlock_irqrestore (&priv->lock, flags);
|
||||
+ set_control_lines (port->serial->dev, 0);
|
||||
+ }
|
||||
}
|
||||
+
|
||||
}
|
||||
|
||||
+/* taken from 2.4.20 driver */
|
||||
static int set_modem_info (struct usb_serial_port *port, unsigned int cmd, unsigned int *value)
|
||||
{
|
||||
- struct pl2303_private *priv = usb_get_serial_port_data(port);
|
||||
- unsigned long flags;
|
||||
- unsigned int arg;
|
||||
- u8 control;
|
||||
-
|
||||
- if (copy_from_user(&arg, value, sizeof(int)))
|
||||
- return -EFAULT;
|
||||
-
|
||||
- spin_lock_irqsave (&priv->lock, flags);
|
||||
- switch (cmd) {
|
||||
- case TIOCMBIS:
|
||||
- if (arg & TIOCM_RTS)
|
||||
- priv->line_control |= CONTROL_RTS;
|
||||
- if (arg & TIOCM_DTR)
|
||||
- priv->line_control |= CONTROL_DTR;
|
||||
- break;
|
||||
-
|
||||
- case TIOCMBIC:
|
||||
- if (arg & TIOCM_RTS)
|
||||
- priv->line_control &= ~CONTROL_RTS;
|
||||
- if (arg & TIOCM_DTR)
|
||||
- priv->line_control &= ~CONTROL_DTR;
|
||||
- break;
|
||||
+ struct pl2303_private *priv = port->private;
|
||||
+ unsigned int arg;
|
||||
|
||||
- case TIOCMSET:
|
||||
- /* turn off RTS and DTR and then only turn
|
||||
- on what was asked to */
|
||||
- priv->line_control &= ~(CONTROL_RTS | CONTROL_DTR);
|
||||
- priv->line_control |= ((arg & TIOCM_RTS) ? CONTROL_RTS : 0);
|
||||
- priv->line_control |= ((arg & TIOCM_DTR) ? CONTROL_DTR : 0);
|
||||
- break;
|
||||
- }
|
||||
- control = priv->line_control;
|
||||
- spin_unlock_irqrestore (&priv->lock, flags);
|
||||
-
|
||||
- return set_control_lines (port->serial->dev, control);
|
||||
+ if (copy_from_user(&arg, value, sizeof(int)))
|
||||
+ return -EFAULT;
|
||||
+
|
||||
+ switch (cmd) {
|
||||
+ case TIOCMBIS:
|
||||
+ if (arg & TIOCM_RTS)
|
||||
+ priv->line_control |= CONTROL_RTS;
|
||||
+ if (arg & TIOCM_DTR)
|
||||
+ priv->line_control |= CONTROL_DTR;
|
||||
+ break;
|
||||
+
|
||||
+ case TIOCMBIC:
|
||||
+ if (arg & TIOCM_RTS)
|
||||
+ priv->line_control &= ~CONTROL_RTS;
|
||||
+ if (arg & TIOCM_DTR)
|
||||
+ priv->line_control &= ~CONTROL_DTR;
|
||||
+ break;
|
||||
+
|
||||
+ case TIOCMSET:
|
||||
+ /* turn off RTS and DTR and then only turn
|
||||
+ on what was asked to */
|
||||
+ priv->line_control &= ~(CONTROL_RTS | CONTROL_DTR);
|
||||
+ priv->line_control |= ((arg & TIOCM_RTS) ? CONTROL_RTS : 0);
|
||||
+ priv->line_control |= ((arg & TIOCM_DTR) ? CONTROL_DTR : 0);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ return set_control_lines (port->serial->dev, priv->line_control);
|
||||
}
|
||||
|
||||
static int get_modem_info (struct usb_serial_port *port, unsigned int *value)
|
||||
{
|
||||
- struct pl2303_private *priv = usb_get_serial_port_data(port);
|
||||
- unsigned long flags;
|
||||
- unsigned int mcr;
|
||||
- unsigned int status;
|
||||
- unsigned int result;
|
||||
-
|
||||
- spin_lock_irqsave (&priv->lock, flags);
|
||||
- mcr = priv->line_control;
|
||||
- status = priv->line_status;
|
||||
- spin_unlock_irqrestore (&priv->lock, flags);
|
||||
-
|
||||
- result = ((mcr & CONTROL_DTR) ? TIOCM_DTR : 0)
|
||||
- | ((mcr & CONTROL_RTS) ? TIOCM_RTS : 0)
|
||||
- | ((status & UART_CTS) ? TIOCM_CTS : 0)
|
||||
- | ((status & UART_DSR) ? TIOCM_DSR : 0)
|
||||
- | ((status & UART_RING) ? TIOCM_RI : 0)
|
||||
- | ((status & UART_DCD) ? TIOCM_CD : 0);
|
||||
-
|
||||
- dbg("%s - result = %x", __FUNCTION__, result);
|
||||
-
|
||||
- if (copy_to_user(value, &result, sizeof(int)))
|
||||
- return -EFAULT;
|
||||
- return 0;
|
||||
+ struct pl2303_private *priv = port->private;
|
||||
+ unsigned int mcr = priv->line_control;
|
||||
+ unsigned int result;
|
||||
+
|
||||
+ result = ((mcr & CONTROL_DTR) ? TIOCM_DTR : 0)
|
||||
+ | ((mcr & CONTROL_RTS) ? TIOCM_RTS : 0);
|
||||
+
|
||||
+ dbg("%s - result = %x", __FUNCTION__, result);
|
||||
+
|
||||
+ if (copy_to_user(value, &result, sizeof(int)))
|
||||
+ return -EFAULT;
|
||||
+ return 0;
|
||||
}
|
||||
+/* end of 2.4.20 kernel part - grsch */
|
||||
|
||||
static int wait_modem_info(struct usb_serial_port *port, unsigned int arg)
|
||||
{
|
||||
- struct pl2303_private *priv = usb_get_serial_port_data(port);
|
||||
+ struct pl2303_private *priv = port->private;
|
||||
unsigned long flags;
|
||||
unsigned int prevstatus;
|
||||
unsigned int status;
|
||||
@@ -617,21 +647,10 @@
|
||||
dbg("%s (%d) cmd = 0x%04x", __FUNCTION__, port->number, cmd);
|
||||
|
||||
switch (cmd) {
|
||||
-
|
||||
- case TIOCMGET:
|
||||
- dbg("%s (%d) TIOCMGET", __FUNCTION__, port->number);
|
||||
- return get_modem_info (port, (unsigned int *)arg);
|
||||
-
|
||||
- case TIOCMBIS:
|
||||
- case TIOCMBIC:
|
||||
- case TIOCMSET:
|
||||
- dbg("%s (%d) TIOCMSET/TIOCMBIC/TIOCMSET", __FUNCTION__, port->number);
|
||||
- return set_modem_info(port, cmd, (unsigned int *) arg);
|
||||
-
|
||||
case TIOCMIWAIT:
|
||||
dbg("%s (%d) TIOCMIWAIT", __FUNCTION__, port->number);
|
||||
return wait_modem_info(port, arg);
|
||||
-
|
||||
+
|
||||
default:
|
||||
dbg("%s not supported = 0x%04x", __FUNCTION__, cmd);
|
||||
break;
|
||||
@@ -652,7 +671,7 @@
|
||||
state = BREAK_OFF;
|
||||
else
|
||||
state = BREAK_ON;
|
||||
- dbg("%s - turning break %s", __FUNCTION__, state==BREAK_OFF ? "off" : "on");
|
||||
+ dbg("%s - turning break %s", state==BREAK_OFF ? "off" : "on", __FUNCTION__);
|
||||
|
||||
result = usb_control_msg (serial->dev, usb_sndctrlpipe (serial->dev, 0),
|
||||
BREAK_REQUEST, BREAK_REQUEST_TYPE, state,
|
||||
@@ -669,8 +688,8 @@
|
||||
dbg("%s", __FUNCTION__);
|
||||
|
||||
for (i = 0; i < serial->num_ports; ++i) {
|
||||
- kfree (usb_get_serial_port_data(&serial->port[i]));
|
||||
- usb_set_serial_port_data(&serial->port[i], NULL);
|
||||
+ kfree (serial->port[i].private);
|
||||
+ serial->port[i].private = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -678,16 +697,14 @@
|
||||
static void pl2303_read_int_callback (struct urb *urb)
|
||||
{
|
||||
struct usb_serial_port *port = (struct usb_serial_port *) urb->context;
|
||||
- struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
|
||||
- struct pl2303_private *priv = usb_get_serial_port_data(port);
|
||||
+ struct pl2303_private *priv = port->private;
|
||||
unsigned char *data = urb->transfer_buffer;
|
||||
unsigned long flags;
|
||||
+ int status;
|
||||
u8 uart_state;
|
||||
|
||||
dbg("%s (%d)", __FUNCTION__, port->number);
|
||||
|
||||
- /* ints auto restart... */
|
||||
-
|
||||
switch (urb->status) {
|
||||
case 0:
|
||||
/* success */
|
||||
@@ -700,17 +717,14 @@
|
||||
return;
|
||||
default:
|
||||
dbg("%s - nonzero urb status received: %d", __FUNCTION__, urb->status);
|
||||
- return;
|
||||
+ goto exit;
|
||||
}
|
||||
|
||||
- if (!serial) {
|
||||
- return;
|
||||
- }
|
||||
|
||||
- usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, urb->transfer_buffer);
|
||||
+ usb_serial_debug_data(__FILE__, __FUNCTION__, urb->actual_length, urb->transfer_buffer);
|
||||
|
||||
if (urb->actual_length < UART_STATE)
|
||||
- return;
|
||||
+ goto exit;
|
||||
|
||||
/* Save off the uart status for others to look at */
|
||||
uart_state = data[UART_STATE];
|
||||
@@ -718,17 +732,19 @@
|
||||
uart_state |= (priv->line_status & UART_STATE_TRANSIENT_MASK);
|
||||
priv->line_status = uart_state;
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
- wake_up_interruptible (&priv->delta_msr_wait);
|
||||
-
|
||||
- return;
|
||||
+
|
||||
+exit:
|
||||
+ status = usb_submit_urb (urb);
|
||||
+ if (status)
|
||||
+ err("%s - usb_submit_urb failed with result %d\n",
|
||||
+ __FUNCTION__, status);
|
||||
}
|
||||
|
||||
|
||||
static void pl2303_read_bulk_callback (struct urb *urb)
|
||||
{
|
||||
struct usb_serial_port *port = (struct usb_serial_port *) urb->context;
|
||||
- struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
|
||||
- struct pl2303_private *priv = usb_get_serial_port_data(port);
|
||||
+ struct pl2303_private *priv = port->private;
|
||||
struct tty_struct *tty;
|
||||
unsigned char *data = urb->transfer_buffer;
|
||||
unsigned long flags;
|
||||
@@ -737,16 +753,8 @@
|
||||
u8 status;
|
||||
char tty_flag;
|
||||
|
||||
- if (port_paranoia_check (port, __FUNCTION__))
|
||||
- return;
|
||||
-
|
||||
dbg("%s - port %d", __FUNCTION__, port->number);
|
||||
|
||||
- if (!serial) {
|
||||
- dbg("%s - bad serial pointer, exiting", __FUNCTION__);
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
if (urb->status) {
|
||||
dbg("%s - urb->status = %d", __FUNCTION__, urb->status);
|
||||
if (!port->open_count) {
|
||||
@@ -757,17 +765,17 @@
|
||||
/* PL2303 mysteriously fails with -EPROTO reschedule the read */
|
||||
dbg("%s - caught -EPROTO, resubmitting the urb", __FUNCTION__);
|
||||
urb->status = 0;
|
||||
- urb->dev = serial->dev;
|
||||
+ urb->dev = port->serial->dev;
|
||||
result = usb_submit_urb(urb);
|
||||
if (result)
|
||||
- err("%s - failed resubmitting read urb, error %d", __FUNCTION__, result);
|
||||
+ err("%s - failed resubmitting read urb, error %d\n", __FUNCTION__, result);
|
||||
return;
|
||||
}
|
||||
dbg("%s - unable to handle the error, exiting.", __FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
||||
- usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, data);
|
||||
+ usb_serial_debug_data(__FILE__, __FUNCTION__, urb->actual_length, data);
|
||||
|
||||
/* get tty_flag from status */
|
||||
tty_flag = TTY_NORMAL;
|
||||
@@ -776,7 +784,7 @@
|
||||
status = priv->line_status;
|
||||
priv->line_status &= ~UART_STATE_TRANSIENT_MASK;
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
- wake_up_interruptible (&priv->delta_msr_wait); //AF from 2.6
|
||||
+ wake_up_interruptible (&priv->delta_msr_wait);
|
||||
|
||||
/* break takes precedence over parity, */
|
||||
/* which takes precedence over framing errors */
|
||||
@@ -805,10 +813,10 @@
|
||||
|
||||
/* Schedule the next read _if_ we are still open */
|
||||
if (port->open_count) {
|
||||
- urb->dev = serial->dev;
|
||||
+ urb->dev = port->serial->dev;
|
||||
result = usb_submit_urb(urb);
|
||||
if (result)
|
||||
- err("%s - failed resubmitting read urb, error %d", __FUNCTION__, result);
|
||||
+ err("%s - failed resubmitting read urb, error %d\n", __FUNCTION__, result);
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -821,44 +829,32 @@
|
||||
struct usb_serial_port *port = (struct usb_serial_port *) urb->context;
|
||||
int result;
|
||||
|
||||
- if (port_paranoia_check (port, __FUNCTION__))
|
||||
- return;
|
||||
-
|
||||
dbg("%s - port %d", __FUNCTION__, port->number);
|
||||
|
||||
if (urb->status) {
|
||||
/* error in the urb, so we have to resubmit it */
|
||||
- if (serial_paranoia_check (port->serial, __FUNCTION__)) {
|
||||
- return;
|
||||
- }
|
||||
dbg("%s - Overflow in write", __FUNCTION__);
|
||||
dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, urb->status);
|
||||
port->write_urb->transfer_buffer_length = 1;
|
||||
port->write_urb->dev = port->serial->dev;
|
||||
result = usb_submit_urb (port->write_urb);
|
||||
if (result)
|
||||
- err("%s - failed resubmitting write urb, error %d", __FUNCTION__, result);
|
||||
+ err("%s - failed resubmitting write urb, error %d\n", __FUNCTION__, result);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
- queue_task(&port->tqueue, &tq_immediate);
|
||||
- mark_bh(IMMEDIATE_BH);
|
||||
|
||||
- return;
|
||||
+ queue_task(&port->tqueue, &tq_immediate);
|
||||
+ mark_bh(IMMEDIATE_BH);
|
||||
}
|
||||
|
||||
|
||||
static int __init pl2303_init (void)
|
||||
{
|
||||
- int retval;
|
||||
- retval = usb_serial_register(&pl2303_device);
|
||||
- if (retval)
|
||||
- goto failed_usb_serial_register;
|
||||
+ usb_serial_register(&pl2303_device);
|
||||
info(DRIVER_DESC " " DRIVER_VERSION);
|
||||
return 0;
|
||||
-failed_usb_serial_register:
|
||||
- return retval;
|
||||
}
|
||||
|
||||
|
||||
@@ -877,3 +873,4 @@
|
||||
MODULE_PARM(debug, "i");
|
||||
MODULE_PARM_DESC(debug, "Debug enabled or not");
|
||||
|
||||
+//this is an error
|
||||
diff -rNu linux-2.4.29.old/drivers/usb/serial/pl2303.h linux-2.4.29/drivers/usb/serial/pl2303.h
|
||||
--- linux-2.4.29.old/drivers/usb/serial/pl2303.h 2005-03-22 14:48:04.000000000 +0100
|
||||
+++ linux-2.4.29/drivers/usb/serial/pl2303.h 2005-03-22 15:33:05.758939856 +0100
|
||||
@@ -41,3 +41,12 @@
|
||||
|
||||
#define SITECOM_VENDOR_ID 0x6189
|
||||
#define SITECOM_PRODUCT_ID 0x2068
|
||||
+
|
||||
+/* Alcatel OT535/735 USB cable */
|
||||
+#define ALCATEL_VENDOR_ID 0x11f7
|
||||
+#define ALCATEL_PRODUCT_ID 0x02df
|
||||
+
|
||||
+/* Samsung I330 phone cradle */
|
||||
+#define SAMSUNG_VENDOR_ID 0x04e8
|
||||
+#define SAMSUNG_PRODUCT_ID 0x8001
|
||||
+
|
|
@ -0,0 +1,23 @@
|
|||
diff -urN linux-2.4.30.old/fs/hfsplus/super.c linux-2.4.30.dev/fs/hfsplus/super.c
|
||||
--- linux-2.4.30.old/fs/hfsplus/super.c 2003-08-25 13:44:43.000000000 +0200
|
||||
+++ linux-2.4.30.dev/fs/hfsplus/super.c 2005-04-27 19:54:40.000000000 +0200
|
||||
@@ -240,8 +240,7 @@
|
||||
if (!(*flags & MS_RDONLY)) {
|
||||
struct hfsplus_vh *vhdr = HFSPLUS_SB(sb).s_vhdr;
|
||||
|
||||
- if ((vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_INCNSTNT)) ||
|
||||
- !(vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_UNMNT))) {
|
||||
+ if (!(vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_UNMNT))) {
|
||||
printk("HFS+-fs warning: Filesystem was not cleanly unmounted, "
|
||||
"running fsck.hfsplus is recommended. leaving read-only.\n");
|
||||
sb->s_flags |= MS_RDONLY;
|
||||
@@ -343,8 +342,7 @@
|
||||
/* Set up operations so we can load metadata */
|
||||
sb->s_op = &hfsplus_sops;
|
||||
|
||||
- if ((vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_INCNSTNT)) ||
|
||||
- !(vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_UNMNT))) {
|
||||
+ if (!(vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_UNMNT))) {
|
||||
if (!silent)
|
||||
printk("HFS+-fs warning: Filesystem was not cleanly unmounted, "
|
||||
"running fsck.hfsplus is recommended. mounting read-only.\n");
|
|
@ -0,0 +1,364 @@
|
|||
diff -Nur linux-2.4.30/drivers/net/b44.c linux-2.4.30-b44/drivers/net/b44.c
|
||||
--- linux-2.4.30/drivers/net/b44.c 2004-08-08 01:26:05.000000000 +0200
|
||||
+++ linux-2.4.30-b44/drivers/net/b44.c 2005-05-26 14:08:48.000000000 +0200
|
||||
@@ -1,7 +1,8 @@
|
||||
/* b44.c: Broadcom 4400 device driver.
|
||||
*
|
||||
* Copyright (C) 2002 David S. Miller (davem@redhat.com)
|
||||
- * Fixed by Pekka Pietikainen (pp@ee.oulu.fi)
|
||||
+ * Copyright (C) 2004 Pekka Pietikainen (pp@ee.oulu.fi)
|
||||
+ * Copyright (C) 2004 Florian Schirmer (jolt@tuxbox.org)
|
||||
*
|
||||
* Distribute under GPL.
|
||||
*/
|
||||
@@ -25,6 +26,16 @@
|
||||
|
||||
#include "b44.h"
|
||||
|
||||
+#include <typedefs.h>
|
||||
+#include <bcmdevs.h>
|
||||
+#include <bcmutils.h>
|
||||
+#include <osl.h>
|
||||
+#include <bcmutils.h>
|
||||
+#include <bcmnvram.h>
|
||||
+#include <sbconfig.h>
|
||||
+#include <sbchipc.h>
|
||||
+#include <sflash.h>
|
||||
+
|
||||
#define DRV_MODULE_NAME "b44"
|
||||
#define PFX DRV_MODULE_NAME ": "
|
||||
#define DRV_MODULE_VERSION "0.93"
|
||||
@@ -75,7 +86,7 @@
|
||||
DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
|
||||
|
||||
MODULE_AUTHOR("David S. Miller (davem@redhat.com)");
|
||||
-MODULE_DESCRIPTION("Broadcom 4400 10/100 PCI ethernet driver");
|
||||
+MODULE_DESCRIPTION("Broadcom 4400/47xx 10/100 PCI ethernet driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_PARM(b44_debug, "i");
|
||||
MODULE_PARM_DESC(b44_debug, "B44 bitmapped debugging message enable value");
|
||||
@@ -89,6 +100,8 @@
|
||||
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
|
||||
{ PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_BCM4401B1,
|
||||
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
|
||||
+ { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_BCM4713,
|
||||
+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
|
||||
{ } /* terminate list with empty entry */
|
||||
};
|
||||
|
||||
@@ -236,6 +249,8 @@
|
||||
udelay(1);
|
||||
}
|
||||
|
||||
+static int b44_4713_instance;
|
||||
+
|
||||
static int ssb_core_unit(struct b44 *bp)
|
||||
{
|
||||
#if 0
|
||||
@@ -258,6 +273,9 @@
|
||||
break;
|
||||
};
|
||||
#endif
|
||||
+ if (bp->pdev->device == PCI_DEVICE_ID_BCM4713)
|
||||
+ return b44_4713_instance++;
|
||||
+ else
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -267,6 +285,28 @@
|
||||
== SBTMSLOW_CLOCK);
|
||||
}
|
||||
|
||||
+static void __b44_cam_read(struct b44 *bp, unsigned char *data, int index)
|
||||
+{
|
||||
+ u32 val;
|
||||
+
|
||||
+ bw32(B44_CAM_CTRL, (CAM_CTRL_READ |
|
||||
+ (index << CAM_CTRL_INDEX_SHIFT)));
|
||||
+
|
||||
+ b44_wait_bit(bp, B44_CAM_CTRL, CAM_CTRL_BUSY, 100, 1);
|
||||
+
|
||||
+ val = br32(B44_CAM_DATA_LO);
|
||||
+
|
||||
+ data[2] = (val >> 24) & 0xFF;
|
||||
+ data[3] = (val >> 16) & 0xFF;
|
||||
+ data[4] = (val >> 8) & 0xFF;
|
||||
+ data[5] = (val >> 0) & 0xFF;
|
||||
+
|
||||
+ val = br32(B44_CAM_DATA_HI);
|
||||
+
|
||||
+ data[0] = (val >> 8) & 0xFF;
|
||||
+ data[1] = (val >> 0) & 0xFF;
|
||||
+}
|
||||
+
|
||||
static void __b44_cam_write(struct b44 *bp, unsigned char *data, int index)
|
||||
{
|
||||
u32 val;
|
||||
@@ -303,14 +343,14 @@
|
||||
bw32(B44_IMASK, bp->imask);
|
||||
}
|
||||
|
||||
-static int b44_readphy(struct b44 *bp, int reg, u32 *val)
|
||||
+static int __b44_readphy(struct b44 *bp, int phy_addr, int reg, u32 *val)
|
||||
{
|
||||
int err;
|
||||
|
||||
bw32(B44_EMAC_ISTAT, EMAC_INT_MII);
|
||||
bw32(B44_MDIO_DATA, (MDIO_DATA_SB_START |
|
||||
(MDIO_OP_READ << MDIO_DATA_OP_SHIFT) |
|
||||
- (bp->phy_addr << MDIO_DATA_PMD_SHIFT) |
|
||||
+ (phy_addr << MDIO_DATA_PMD_SHIFT) |
|
||||
(reg << MDIO_DATA_RA_SHIFT) |
|
||||
(MDIO_TA_VALID << MDIO_DATA_TA_SHIFT)));
|
||||
err = b44_wait_bit(bp, B44_EMAC_ISTAT, EMAC_INT_MII, 100, 0);
|
||||
@@ -319,23 +359,42 @@
|
||||
return err;
|
||||
}
|
||||
|
||||
-static int b44_writephy(struct b44 *bp, int reg, u32 val)
|
||||
+static int b44_readphy(struct b44 *bp, int reg, u32 *val)
|
||||
+{
|
||||
+ if (bp->phy_addr == B44_PHY_ADDR_NO_PHY)
|
||||
+ return 0;
|
||||
+
|
||||
+ return __b44_readphy(bp, bp->phy_addr, reg, val);
|
||||
+}
|
||||
+
|
||||
+static int __b44_writephy(struct b44 *bp, int phy_addr, int reg, u32 val)
|
||||
{
|
||||
bw32(B44_EMAC_ISTAT, EMAC_INT_MII);
|
||||
bw32(B44_MDIO_DATA, (MDIO_DATA_SB_START |
|
||||
(MDIO_OP_WRITE << MDIO_DATA_OP_SHIFT) |
|
||||
- (bp->phy_addr << MDIO_DATA_PMD_SHIFT) |
|
||||
+ (phy_addr << MDIO_DATA_PMD_SHIFT) |
|
||||
(reg << MDIO_DATA_RA_SHIFT) |
|
||||
(MDIO_TA_VALID << MDIO_DATA_TA_SHIFT) |
|
||||
(val & MDIO_DATA_DATA)));
|
||||
return b44_wait_bit(bp, B44_EMAC_ISTAT, EMAC_INT_MII, 100, 0);
|
||||
}
|
||||
|
||||
+static int b44_writephy(struct b44 *bp, int reg, u32 val)
|
||||
+{
|
||||
+ if (bp->phy_addr == B44_PHY_ADDR_NO_PHY)
|
||||
+ return 0;
|
||||
+
|
||||
+ return __b44_writephy(bp, bp->phy_addr, reg, val);
|
||||
+}
|
||||
+
|
||||
static int b44_phy_reset(struct b44 *bp)
|
||||
{
|
||||
u32 val;
|
||||
int err;
|
||||
|
||||
+ if (bp->phy_addr == B44_PHY_ADDR_NO_PHY)
|
||||
+ return 0;
|
||||
+
|
||||
err = b44_writephy(bp, MII_BMCR, BMCR_RESET);
|
||||
if (err)
|
||||
return err;
|
||||
@@ -406,6 +465,9 @@
|
||||
u32 val;
|
||||
int err;
|
||||
|
||||
+ if (bp->phy_addr == B44_PHY_ADDR_NO_PHY)
|
||||
+ return 0;
|
||||
+
|
||||
if ((err = b44_readphy(bp, B44_MII_ALEDCTRL, &val)) != 0)
|
||||
goto out;
|
||||
if ((err = b44_writephy(bp, B44_MII_ALEDCTRL,
|
||||
@@ -498,6 +560,19 @@
|
||||
{
|
||||
u32 bmsr, aux;
|
||||
|
||||
+ if (bp->phy_addr == B44_PHY_ADDR_NO_PHY) {
|
||||
+ bp->flags |= B44_FLAG_100_BASE_T;
|
||||
+ bp->flags |= B44_FLAG_FULL_DUPLEX;
|
||||
+ if (!netif_carrier_ok(bp->dev)) {
|
||||
+ u32 val = br32(B44_TX_CTRL);
|
||||
+ val |= TX_CTRL_DUPLEX;
|
||||
+ bw32(B44_TX_CTRL, val);
|
||||
+ netif_carrier_on(bp->dev);
|
||||
+ b44_link_report(bp);
|
||||
+ }
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
if (!b44_readphy(bp, MII_BMSR, &bmsr) &&
|
||||
!b44_readphy(bp, B44_MII_AUXCTRL, &aux) &&
|
||||
(bmsr != 0xffff)) {
|
||||
@@ -1092,6 +1167,8 @@
|
||||
/* bp->lock is held. */
|
||||
static void b44_chip_reset(struct b44 *bp)
|
||||
{
|
||||
+ unsigned int sb_clock;
|
||||
+
|
||||
if (ssb_is_core_up(bp)) {
|
||||
bw32(B44_RCV_LAZY, 0);
|
||||
bw32(B44_ENET_CTRL, ENET_CTRL_DISABLE);
|
||||
@@ -1105,9 +1182,10 @@
|
||||
bw32(B44_DMARX_CTRL, 0);
|
||||
bp->rx_prod = bp->rx_cons = 0;
|
||||
} else {
|
||||
- ssb_pci_setup(bp, (bp->core_unit == 0 ?
|
||||
- SBINTVEC_ENET0 :
|
||||
- SBINTVEC_ENET1));
|
||||
+ /*if (bp->pdev->device != PCI_DEVICE_ID_BCM4713)*/
|
||||
+ ssb_pci_setup(bp, (bp->core_unit == 0 ?
|
||||
+ SBINTVEC_ENET0 :
|
||||
+ SBINTVEC_ENET1));
|
||||
}
|
||||
|
||||
ssb_core_reset(bp);
|
||||
@@ -1115,6 +1193,11 @@
|
||||
b44_clear_stats(bp);
|
||||
|
||||
/* Make PHY accessible. */
|
||||
+ if (bp->pdev->device == PCI_DEVICE_ID_BCM4713)
|
||||
+ sb_clock = 100000000; /* 100 MHz */
|
||||
+ else
|
||||
+ sb_clock = 62500000; /* 62.5 MHz */
|
||||
+
|
||||
bw32(B44_MDIO_CTRL, (MDIO_CTRL_PREAMBLE |
|
||||
(0x0d & MDIO_CTRL_MAXF_MASK)));
|
||||
br32(B44_MDIO_CTRL);
|
||||
@@ -1628,7 +1711,7 @@
|
||||
u32 mii_regval;
|
||||
|
||||
spin_lock_irq(&bp->lock);
|
||||
- err = b44_readphy(bp, data->reg_num & 0x1f, &mii_regval);
|
||||
+ err = __b44_readphy(bp, data->phy_id & 0x1f, data->reg_num & 0x1f, &mii_regval);
|
||||
spin_unlock_irq(&bp->lock);
|
||||
|
||||
data->val_out = mii_regval;
|
||||
@@ -1641,7 +1724,7 @@
|
||||
return -EPERM;
|
||||
|
||||
spin_lock_irq(&bp->lock);
|
||||
- err = b44_writephy(bp, data->reg_num & 0x1f, data->val_in);
|
||||
+ err = __b44_writephy(bp, data->phy_id & 0x1f, data->reg_num & 0x1f, data->val_in);
|
||||
spin_unlock_irq(&bp->lock);
|
||||
|
||||
return err;
|
||||
@@ -1669,20 +1752,42 @@
|
||||
{
|
||||
u8 eeprom[128];
|
||||
int err;
|
||||
+ unsigned long flags;
|
||||
|
||||
- err = b44_read_eeprom(bp, &eeprom[0]);
|
||||
- if (err)
|
||||
- goto out;
|
||||
-
|
||||
- bp->dev->dev_addr[0] = eeprom[79];
|
||||
- bp->dev->dev_addr[1] = eeprom[78];
|
||||
- bp->dev->dev_addr[2] = eeprom[81];
|
||||
- bp->dev->dev_addr[3] = eeprom[80];
|
||||
- bp->dev->dev_addr[4] = eeprom[83];
|
||||
- bp->dev->dev_addr[5] = eeprom[82];
|
||||
-
|
||||
- bp->phy_addr = eeprom[90] & 0x1f;
|
||||
- bp->mdc_port = (eeprom[90] >> 14) & 0x1;
|
||||
+ if (bp->pdev->device == PCI_DEVICE_ID_BCM4713) {
|
||||
+ /*
|
||||
+ * BCM47xx boards don't have a EEPROM. The MAC is stored in
|
||||
+ * a NVRAM area somewhere in the flash memory. As we don't
|
||||
+ * know the location and/or the format of the NVRAM area
|
||||
+ * here, we simply rely on the bootloader to write the
|
||||
+ * MAC into the CAM.
|
||||
+ */
|
||||
+ spin_lock_irqsave(&bp->lock, flags);
|
||||
+ __b44_cam_read(bp, bp->dev->dev_addr, 0);
|
||||
+ spin_unlock_irqrestore(&bp->lock, flags);
|
||||
+
|
||||
+ /*
|
||||
+ * BCM47xx boards don't have a PHY. Usually there is a switch
|
||||
+ * chip with multiple PHYs connected to the PHY port.
|
||||
+ */
|
||||
+ bp->phy_addr = B44_PHY_ADDR_NO_PHY;
|
||||
+ bp->dma_offset = 0;
|
||||
+ } else {
|
||||
+ err = b44_read_eeprom(bp, &eeprom[0]);
|
||||
+ if (err)
|
||||
+ return err;
|
||||
+
|
||||
+ bp->dev->dev_addr[0] = eeprom[79];
|
||||
+ bp->dev->dev_addr[1] = eeprom[78];
|
||||
+ bp->dev->dev_addr[2] = eeprom[81];
|
||||
+ bp->dev->dev_addr[3] = eeprom[80];
|
||||
+ bp->dev->dev_addr[4] = eeprom[83];
|
||||
+ bp->dev->dev_addr[5] = eeprom[82];
|
||||
+
|
||||
+ bp->phy_addr = eeprom[90] & 0x1f;
|
||||
+ bp->dma_offset = SB_PCI_DMA;
|
||||
+ bp->mdc_port = (eeprom[90] >> 14) & 0x1;
|
||||
+ }
|
||||
|
||||
/* With this, plus the rx_header prepended to the data by the
|
||||
* hardware, we'll land the ethernet header on a 2-byte boundary.
|
||||
@@ -1692,13 +1797,12 @@
|
||||
bp->imask = IMASK_DEF;
|
||||
|
||||
bp->core_unit = ssb_core_unit(bp);
|
||||
- bp->dma_offset = ssb_get_addr(bp, SBID_PCI_DMA, 0);
|
||||
|
||||
/* XXX - really required?
|
||||
bp->flags |= B44_FLAG_BUGGY_TXPTR;
|
||||
*/
|
||||
-out:
|
||||
- return err;
|
||||
+
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
static int __devinit b44_init_one(struct pci_dev *pdev,
|
||||
@@ -1819,11 +1923,17 @@
|
||||
|
||||
pci_save_state(bp->pdev, bp->pci_cfg_state);
|
||||
|
||||
- printk(KERN_INFO "%s: Broadcom 4400 10/100BaseT Ethernet ", dev->name);
|
||||
+ printk(KERN_INFO "%s: Broadcom %s 10/100BaseT Ethernet ", dev->name,
|
||||
+ (pdev->device == PCI_DEVICE_ID_BCM4713) ? "47xx" : "4400");
|
||||
for (i = 0; i < 6; i++)
|
||||
printk("%2.2x%c", dev->dev_addr[i],
|
||||
i == 5 ? '\n' : ':');
|
||||
|
||||
+ /* Initialize phy */
|
||||
+ spin_lock_irq(&bp->lock);
|
||||
+ b44_chip_reset(bp);
|
||||
+ spin_unlock_irq(&bp->lock);
|
||||
+
|
||||
return 0;
|
||||
|
||||
err_out_iounmap:
|
||||
diff -Nur linux-2.4.30/drivers/net/b44.h linux-2.4.30-b44/drivers/net/b44.h
|
||||
--- linux-2.4.30/drivers/net/b44.h 2003-08-25 13:44:42.000000000 +0200
|
||||
+++ linux-2.4.30-b44/drivers/net/b44.h 2005-05-26 16:45:10.000000000 +0200
|
||||
@@ -229,8 +229,6 @@
|
||||
#define SBIPSFLAG_IMASK4 0x3f000000 /* Which sbflags --> mips interrupt 4 */
|
||||
#define SBIPSFLAG_ISHIFT4 24
|
||||
#define B44_SBTPSFLAG 0x0F18UL /* SB Target Port OCP Slave Flag */
|
||||
-#define SBTPS_NUM0_MASK 0x0000003f
|
||||
-#define SBTPS_F0EN0 0x00000040
|
||||
#define B44_SBADMATCH3 0x0F60UL /* SB Address Match 3 */
|
||||
#define B44_SBADMATCH2 0x0F68UL /* SB Address Match 2 */
|
||||
#define B44_SBADMATCH1 0x0F70UL /* SB Address Match 1 */
|
||||
@@ -461,6 +459,8 @@
|
||||
};
|
||||
|
||||
#define B44_MCAST_TABLE_SIZE 32
|
||||
+#define B44_PHY_ADDR_NO_PHY 30
|
||||
+#define B44_MDC_RATIO 5000000
|
||||
|
||||
/* SW copy of device statistics, kept up to date by periodic timer
|
||||
* which probes HW values. Must have same relative layout as HW
|
||||
diff -Nur linux-2.4.30/include/linux/pci_ids.h linux-2.4.30-b44/include/linux/pci_ids.h
|
||||
--- linux-2.4.30/include/linux/pci_ids.h 2005-04-04 03:42:20.000000000 +0200
|
||||
+++ linux-2.4.30-b44/include/linux/pci_ids.h 2005-05-26 14:08:41.000000000 +0200
|
||||
@@ -1735,6 +1735,7 @@
|
||||
#define PCI_DEVICE_ID_TIGON3_5901_2 0x170e
|
||||
#define PCI_DEVICE_ID_BCM4401 0x4401
|
||||
#define PCI_DEVICE_ID_BCM4401B0 0x4402
|
||||
+#define PCI_DEVICE_ID_BCM4713 0x4713
|
||||
|
||||
#define PCI_VENDOR_ID_ENE 0x1524
|
||||
#define PCI_DEVICE_ID_ENE_1211 0x1211
|
|
@ -0,0 +1,10 @@
|
|||
--- linux-2.4.30.old/arch/mips/ld.script.in 2005-04-28 23:22:23.513764016 +0400
|
||||
+++ linux-2.4.30/arch/mips/ld.script.in 2005-04-28 23:22:36.329673152 +0400
|
||||
@@ -9,6 +9,7 @@
|
||||
{
|
||||
_ftext = . ;
|
||||
*(.text)
|
||||
+ *(.fixup)
|
||||
*(.rodata)
|
||||
*(.rodata.*)
|
||||
*(.rodata1)
|
|
@ -0,0 +1,214 @@
|
|||
diff -Nur linux-2.4.29/arch/mips/kernel/signal.c linux-2.4.29-gcc3.4/arch/mips/kernel/signal.c
|
||||
--- linux-2.4.29/arch/mips/kernel/signal.c 2005-01-19 15:09:29.000000000 +0100
|
||||
+++ linux-2.4.29-gcc3.4/arch/mips/kernel/signal.c 2005-03-27 23:09:57.000000000 +0200
|
||||
@@ -6,8 +6,10 @@
|
||||
* Copyright (C) 1991, 1992 Linus Torvalds
|
||||
* Copyright (C) 1994 - 1999 Ralf Baechle
|
||||
* Copyright (C) 1999 Silicon Graphics, Inc.
|
||||
+ * Copyright (C) 2004 Maciej W. Rozycki
|
||||
*/
|
||||
#include <linux/config.h>
|
||||
+#include <linux/compiler.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/smp.h>
|
||||
@@ -76,7 +78,9 @@
|
||||
* Atomically swap in the new signal mask, and wait for a signal.
|
||||
*/
|
||||
save_static_function(sys_sigsuspend);
|
||||
-static_unused int _sys_sigsuspend(struct pt_regs regs)
|
||||
+static int _sys_sigsuspend(struct pt_regs regs)
|
||||
+ __asm__("_sys_sigsuspend") __attribute_used__;
|
||||
+static int _sys_sigsuspend(struct pt_regs regs)
|
||||
{
|
||||
sigset_t *uset, saveset, newset;
|
||||
|
||||
@@ -102,7 +106,9 @@
|
||||
}
|
||||
|
||||
save_static_function(sys_rt_sigsuspend);
|
||||
-static_unused int _sys_rt_sigsuspend(struct pt_regs regs)
|
||||
+static int _sys_rt_sigsuspend(struct pt_regs regs)
|
||||
+ __asm__("_sys_rt_sigsuspend") __attribute_used__;
|
||||
+static int _sys_rt_sigsuspend(struct pt_regs regs)
|
||||
{
|
||||
sigset_t *unewset, saveset, newset;
|
||||
size_t sigsetsize;
|
||||
diff -Nur linux-2.4.29/arch/mips/kernel/syscall.c linux-2.4.29-gcc3.4/arch/mips/kernel/syscall.c
|
||||
--- linux-2.4.29/arch/mips/kernel/syscall.c 2005-01-19 15:09:29.000000000 +0100
|
||||
+++ linux-2.4.29-gcc3.4/arch/mips/kernel/syscall.c 2005-03-27 23:09:57.000000000 +0200
|
||||
@@ -5,6 +5,7 @@
|
||||
*
|
||||
* Copyright (C) 1995 - 2000 by Ralf Baechle
|
||||
* Copyright (C) 2000 Silicon Graphics, Inc.
|
||||
+ * Copyright (C) 2004 Maciej W. Rozycki
|
||||
*
|
||||
* TODO: Implement the compatibility syscalls.
|
||||
* Don't waste that much memory for empty entries in the syscall
|
||||
@@ -158,7 +159,9 @@
|
||||
}
|
||||
|
||||
save_static_function(sys_fork);
|
||||
-static_unused int _sys_fork(struct pt_regs regs)
|
||||
+static int _sys_fork(struct pt_regs regs)
|
||||
+ __asm__("_sys_fork") __attribute_used__;
|
||||
+static int _sys_fork(struct pt_regs regs)
|
||||
{
|
||||
int res;
|
||||
|
||||
@@ -168,7 +171,9 @@
|
||||
|
||||
|
||||
save_static_function(sys_clone);
|
||||
-static_unused int _sys_clone(struct pt_regs regs)
|
||||
+static int _sys_clone(struct pt_regs regs)
|
||||
+ __asm__("_sys_clone") __attribute_used__;
|
||||
+static int _sys_clone(struct pt_regs regs)
|
||||
{
|
||||
unsigned long clone_flags;
|
||||
unsigned long newsp;
|
||||
diff -Nur linux-2.4.29/arch/mips64/kernel/signal.c linux-2.4.29-gcc3.4/arch/mips64/kernel/signal.c
|
||||
--- linux-2.4.29/arch/mips64/kernel/signal.c 2005-01-19 15:09:32.000000000 +0100
|
||||
+++ linux-2.4.29-gcc3.4/arch/mips64/kernel/signal.c 2005-03-27 23:09:57.000000000 +0200
|
||||
@@ -6,8 +6,10 @@
|
||||
* Copyright (C) 1991, 1992 Linus Torvalds
|
||||
* Copyright (C) 1994 - 2000 Ralf Baechle
|
||||
* Copyright (C) 1999, 2000 Silicon Graphics, Inc.
|
||||
+ * Copyright (C) 2004 Maciej W. Rozycki
|
||||
*/
|
||||
#include <linux/config.h>
|
||||
+#include <linux/compiler.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/smp.h>
|
||||
@@ -75,7 +77,9 @@
|
||||
* Atomically swap in the new signal mask, and wait for a signal.
|
||||
*/
|
||||
save_static_function(sys_rt_sigsuspend);
|
||||
-static_unused int _sys_rt_sigsuspend(abi64_no_regargs, struct pt_regs regs)
|
||||
+static int _sys_rt_sigsuspend(abi64_no_regargs, struct pt_regs regs)
|
||||
+ __asm__("_sys_rt_sigsuspend") __attribute_used__;
|
||||
+static int _sys_rt_sigsuspend(abi64_no_regargs, struct pt_regs regs)
|
||||
{
|
||||
sigset_t *unewset, saveset, newset;
|
||||
size_t sigsetsize;
|
||||
diff -Nur linux-2.4.29/arch/mips64/kernel/signal32.c linux-2.4.29-gcc3.4/arch/mips64/kernel/signal32.c
|
||||
--- linux-2.4.29/arch/mips64/kernel/signal32.c 2005-01-19 15:09:33.000000000 +0100
|
||||
+++ linux-2.4.29-gcc3.4/arch/mips64/kernel/signal32.c 2005-03-27 23:09:57.000000000 +0200
|
||||
@@ -6,7 +6,9 @@
|
||||
* Copyright (C) 1991, 1992 Linus Torvalds
|
||||
* Copyright (C) 1994 - 2000 Ralf Baechle
|
||||
* Copyright (C) 1999, 2000 Silicon Graphics, Inc.
|
||||
+ * Copyright (C) 2004 Maciej W. Rozycki
|
||||
*/
|
||||
+#include <linux/compiler.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/smp.h>
|
||||
@@ -192,7 +194,9 @@
|
||||
* Atomically swap in the new signal mask, and wait for a signal.
|
||||
*/
|
||||
save_static_function(sys32_sigsuspend);
|
||||
-static_unused int _sys32_sigsuspend(abi64_no_regargs, struct pt_regs regs)
|
||||
+static int _sys32_sigsuspend(abi64_no_regargs, struct pt_regs regs)
|
||||
+ __asm__("_sys32_sigsuspend") __attribute_used__;
|
||||
+static int _sys32_sigsuspend(abi64_no_regargs, struct pt_regs regs)
|
||||
{
|
||||
sigset32_t *uset;
|
||||
sigset_t newset, saveset;
|
||||
@@ -219,7 +223,9 @@
|
||||
}
|
||||
|
||||
save_static_function(sys32_rt_sigsuspend);
|
||||
-static_unused int _sys32_rt_sigsuspend(abi64_no_regargs, struct pt_regs regs)
|
||||
+static int _sys32_rt_sigsuspend(abi64_no_regargs, struct pt_regs regs)
|
||||
+ __asm__("_sys32_rt_sigsuspend") __attribute_used__;
|
||||
+static int _sys32_rt_sigsuspend(abi64_no_regargs, struct pt_regs regs)
|
||||
{
|
||||
sigset32_t *uset;
|
||||
sigset_t newset, saveset;
|
||||
diff -Nur linux-2.4.29/arch/mips64/kernel/syscall.c linux-2.4.29-gcc3.4/arch/mips64/kernel/syscall.c
|
||||
--- linux-2.4.29/arch/mips64/kernel/syscall.c 2005-01-19 15:09:33.000000000 +0100
|
||||
+++ linux-2.4.29-gcc3.4/arch/mips64/kernel/syscall.c 2005-03-27 23:09:57.000000000 +0200
|
||||
@@ -6,7 +6,9 @@
|
||||
* Copyright (C) 1995 - 2000, 2001 by Ralf Baechle
|
||||
* Copyright (C) 1999, 2000 Silicon Graphics, Inc.
|
||||
* Copyright (C) 2001 MIPS Technologies, Inc.
|
||||
+ * Copyright (C) 2004 Maciej W. Rozycki
|
||||
*/
|
||||
+#include <linux/compiler.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/linkage.h>
|
||||
#include <linux/mm.h>
|
||||
@@ -151,7 +153,9 @@
|
||||
}
|
||||
|
||||
save_static_function(sys_fork);
|
||||
-static_unused int _sys_fork(abi64_no_regargs, struct pt_regs regs)
|
||||
+static int _sys_fork(abi64_no_regargs, struct pt_regs regs)
|
||||
+ __asm__("_sys_fork") __attribute_used__;
|
||||
+static int _sys_fork(abi64_no_regargs, struct pt_regs regs)
|
||||
{
|
||||
int res;
|
||||
|
||||
@@ -160,7 +164,9 @@
|
||||
}
|
||||
|
||||
save_static_function(sys_clone);
|
||||
-static_unused int _sys_clone(abi64_no_regargs, struct pt_regs regs)
|
||||
+static int _sys_clone(abi64_no_regargs, struct pt_regs regs)
|
||||
+ __asm__("_sys_clone") __attribute_used__;
|
||||
+static int _sys_clone(abi64_no_regargs, struct pt_regs regs)
|
||||
{
|
||||
unsigned long clone_flags;
|
||||
unsigned long newsp;
|
||||
diff -Nur linux-2.4.29/include/asm-mips/ptrace.h linux-2.4.29-gcc3.4/include/asm-mips/ptrace.h
|
||||
--- linux-2.4.29/include/asm-mips/ptrace.h 2004-02-18 14:36:32.000000000 +0100
|
||||
+++ linux-2.4.29-gcc3.4/include/asm-mips/ptrace.h 2005-03-27 23:09:57.000000000 +0200
|
||||
@@ -4,6 +4,7 @@
|
||||
* for more details.
|
||||
*
|
||||
* Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000 by Ralf Baechle
|
||||
+ * Copyright (C) 2004 Maciej W. Rozycki
|
||||
*
|
||||
* Machine dependent structs and defines to help the user use
|
||||
* the ptrace system call.
|
||||
@@ -64,12 +65,10 @@
|
||||
"sw\t$22,"__str(PT_R22)"($29)\n\t" \
|
||||
"sw\t$23,"__str(PT_R23)"($29)\n\t" \
|
||||
"sw\t$30,"__str(PT_R30)"($29)\n\t" \
|
||||
+ "j\t_" #symbol "\n\t" \
|
||||
".end\t" #symbol "\n\t" \
|
||||
".size\t" #symbol",. - " #symbol)
|
||||
|
||||
-/* Used in declaration of save_static functions. */
|
||||
-#define static_unused static __attribute__((unused))
|
||||
-
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
|
||||
/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
|
||||
diff -Nur linux-2.4.29/include/asm-mips64/ptrace.h linux-2.4.29-gcc3.4/include/asm-mips64/ptrace.h
|
||||
--- linux-2.4.29/include/asm-mips64/ptrace.h 2004-02-18 14:36:32.000000000 +0100
|
||||
+++ linux-2.4.29-gcc3.4/include/asm-mips64/ptrace.h 2005-03-27 23:09:57.000000000 +0200
|
||||
@@ -5,6 +5,7 @@
|
||||
*
|
||||
* Copyright (C) 1994, 95, 96, 97, 98, 99, 2000 by Ralf Baechle
|
||||
* Copyright (C) 1999, 2000 Silicon Graphics, Inc.
|
||||
+ * Copyright (C) 2004 Maciej W. Rozycki
|
||||
*/
|
||||
#ifndef _ASM_PTRACE_H
|
||||
#define _ASM_PTRACE_H
|
||||
@@ -61,12 +62,10 @@
|
||||
"sd\t$22,"__str(PT_R22)"($29)\n\t" \
|
||||
"sd\t$23,"__str(PT_R23)"($29)\n\t" \
|
||||
"sd\t$30,"__str(PT_R30)"($29)\n\t" \
|
||||
+ "j\t_" #symbol "\n\t" \
|
||||
".end\t" #symbol "\n\t" \
|
||||
".size\t" #symbol",. - " #symbol)
|
||||
|
||||
-/* Used in declaration of save_static functions. */
|
||||
-#define static_unused static __attribute__((unused))
|
||||
-
|
||||
#define abi64_no_regargs \
|
||||
unsigned long __dummy0, \
|
||||
unsigned long __dummy1, \
|
|
@ -0,0 +1,198 @@
|
|||
diff -urN linux-2.4.30.old/drivers/i2c/i2c-core.c linux-2.4.30.dev/drivers/i2c/i2c-core.c
|
||||
--- linux-2.4.30.old/drivers/i2c/i2c-core.c 2005-04-29 17:59:04.000000000 +0200
|
||||
+++ linux-2.4.30.dev/drivers/i2c/i2c-core.c 2005-04-29 18:42:37.000000000 +0200
|
||||
@@ -750,7 +750,7 @@
|
||||
msg.addr = client->addr;
|
||||
msg.flags = client->flags & I2C_M_TEN;
|
||||
msg.len = count;
|
||||
- (const char *)msg.buf = buf;
|
||||
+ msg.buf = (__u8 *)buf;
|
||||
|
||||
DEB2(printk(KERN_DEBUG "i2c-core.o: master_send: writing %d bytes on %s.\n",
|
||||
count,client->adapter->name));
|
||||
@@ -780,7 +780,7 @@
|
||||
msg.flags = client->flags & I2C_M_TEN;
|
||||
msg.flags |= I2C_M_RD;
|
||||
msg.len = count;
|
||||
- msg.buf = buf;
|
||||
+ msg.buf = (__u8 *)buf;
|
||||
|
||||
DEB2(printk(KERN_DEBUG "i2c-core.o: master_recv: reading %d bytes on %s.\n",
|
||||
count,client->adapter->name));
|
||||
diff -urN linux-2.4.30.old/drivers/usb/inode.c linux-2.4.30.dev/drivers/usb/inode.c
|
||||
--- linux-2.4.30.old/drivers/usb/inode.c 2004-02-18 14:36:31.000000000 +0100
|
||||
+++ linux-2.4.30.dev/drivers/usb/inode.c 2005-04-29 18:42:37.000000000 +0200
|
||||
@@ -42,6 +42,8 @@
|
||||
#include <asm/uaccess.h>
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
+static struct file_operations usbdevfs_bus_file_operations;
|
||||
+static struct inode_operations usbdevfs_bus_inode_operations;
|
||||
|
||||
/*
|
||||
* This list of superblocks is still used,
|
||||
diff -urN linux-2.4.30.old/include/asm-mips/uaccess.h linux-2.4.30.dev/include/asm-mips/uaccess.h
|
||||
--- linux-2.4.30.old/include/asm-mips/uaccess.h 2005-01-19 15:10:12.000000000 +0100
|
||||
+++ linux-2.4.30.dev/include/asm-mips/uaccess.h 2005-04-29 18:42:37.000000000 +0200
|
||||
@@ -149,7 +149,7 @@
|
||||
* Returns zero on success, or -EFAULT on error.
|
||||
*/
|
||||
#define put_user(x,ptr) \
|
||||
- __put_user_check((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr)))
|
||||
+ __put_user_check((x),(ptr),sizeof(*(ptr)))
|
||||
|
||||
/*
|
||||
* get_user: - Get a simple variable from user space.
|
||||
@@ -169,7 +169,7 @@
|
||||
* On error, the variable @x is set to zero.
|
||||
*/
|
||||
#define get_user(x,ptr) \
|
||||
- __get_user_check((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr)))
|
||||
+ __get_user_check((x),(ptr),sizeof(*(ptr)))
|
||||
|
||||
/*
|
||||
* __put_user: - Write a simple value into user space, with less checking.
|
||||
@@ -191,7 +191,7 @@
|
||||
* Returns zero on success, or -EFAULT on error.
|
||||
*/
|
||||
#define __put_user(x,ptr) \
|
||||
- __put_user_nocheck((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr)))
|
||||
+ __put_user_nocheck((x),(ptr),sizeof(*(ptr)))
|
||||
|
||||
/*
|
||||
* __get_user: - Get a simple variable from user space, with less checking.
|
||||
@@ -214,7 +214,7 @@
|
||||
* On error, the variable @x is set to zero.
|
||||
*/
|
||||
#define __get_user(x,ptr) \
|
||||
- __get_user_nocheck((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr)))
|
||||
+ __get_user_nocheck((x),(ptr),sizeof(*(ptr)))
|
||||
|
||||
struct __large_struct { unsigned long buf[100]; };
|
||||
#define __m(x) (*(struct __large_struct *)(x))
|
||||
@@ -232,7 +232,7 @@
|
||||
#define __get_user_nocheck(x,ptr,size) \
|
||||
({ \
|
||||
long __gu_err = 0; \
|
||||
- __typeof(*(ptr)) __gu_val = 0; \
|
||||
+ __typeof(*(ptr)) __gu_val = (__typeof(*(ptr))) 0; \
|
||||
long __gu_addr; \
|
||||
__gu_addr = (long) (ptr); \
|
||||
switch (size) { \
|
||||
diff -urN linux-2.4.30.old/include/linux/byteorder/swab.h linux-2.4.30.dev/include/linux/byteorder/swab.h
|
||||
--- linux-2.4.30.old/include/linux/byteorder/swab.h 2002-11-29 00:53:15.000000000 +0100
|
||||
+++ linux-2.4.30.dev/include/linux/byteorder/swab.h 2005-04-29 18:42:37.000000000 +0200
|
||||
@@ -156,7 +156,7 @@
|
||||
#endif /* OPTIMIZE */
|
||||
|
||||
|
||||
-static __inline__ __const__ __u16 __fswab16(__u16 x)
|
||||
+static __inline__ __u16 __fswab16(__u16 x)
|
||||
{
|
||||
return __arch__swab16(x);
|
||||
}
|
||||
@@ -169,7 +169,7 @@
|
||||
__arch__swab16s(addr);
|
||||
}
|
||||
|
||||
-static __inline__ __const__ __u32 __fswab24(__u32 x)
|
||||
+static __inline__ __u32 __fswab24(__u32 x)
|
||||
{
|
||||
return __arch__swab24(x);
|
||||
}
|
||||
@@ -182,7 +182,7 @@
|
||||
__arch__swab24s(addr);
|
||||
}
|
||||
|
||||
-static __inline__ __const__ __u32 __fswab32(__u32 x)
|
||||
+static __inline__ __u32 __fswab32(__u32 x)
|
||||
{
|
||||
return __arch__swab32(x);
|
||||
}
|
||||
@@ -196,7 +196,7 @@
|
||||
}
|
||||
|
||||
#ifdef __BYTEORDER_HAS_U64__
|
||||
-static __inline__ __const__ __u64 __fswab64(__u64 x)
|
||||
+static __inline__ __u64 __fswab64(__u64 x)
|
||||
{
|
||||
# ifdef __SWAB_64_THRU_32__
|
||||
__u32 h = x >> 32;
|
||||
diff -urN linux-2.4.30.old/include/linux/fs.h linux-2.4.30.dev/include/linux/fs.h
|
||||
--- linux-2.4.30.old/include/linux/fs.h 2005-04-29 17:59:08.000000000 +0200
|
||||
+++ linux-2.4.30.dev/include/linux/fs.h 2005-04-29 18:42:37.000000000 +0200
|
||||
@@ -1563,7 +1563,6 @@
|
||||
unsigned long generate_cluster(kdev_t, int b[], int);
|
||||
unsigned long generate_cluster_swab32(kdev_t, int b[], int);
|
||||
extern kdev_t ROOT_DEV;
|
||||
-extern char root_device_name[];
|
||||
|
||||
|
||||
extern void show_buffers(void);
|
||||
diff -urN linux-2.4.30.old/include/linux/i2c.h linux-2.4.30.dev/include/linux/i2c.h
|
||||
--- linux-2.4.30.old/include/linux/i2c.h 2005-01-19 15:10:12.000000000 +0100
|
||||
+++ linux-2.4.30.dev/include/linux/i2c.h 2005-04-29 18:42:37.000000000 +0200
|
||||
@@ -70,7 +70,7 @@
|
||||
|
||||
/* Transfer num messages.
|
||||
*/
|
||||
-extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[],int num);
|
||||
+extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msg, int num);
|
||||
|
||||
/*
|
||||
* Some adapter types (i.e. PCF 8584 based ones) may support slave behaviuor.
|
||||
@@ -197,7 +197,7 @@
|
||||
to NULL. If an adapter algorithm can do SMBus access, set
|
||||
smbus_xfer. If set to NULL, the SMBus protocol is simulated
|
||||
using common I2C messages */
|
||||
- int (*master_xfer)(struct i2c_adapter *adap,struct i2c_msg msgs[],
|
||||
+ int (*master_xfer)(struct i2c_adapter *adap,struct i2c_msg *msgs,
|
||||
int num);
|
||||
int (*smbus_xfer) (struct i2c_adapter *adap, u16 addr,
|
||||
unsigned short flags, char read_write,
|
||||
diff -urN linux-2.4.30.old/include/linux/usbdevice_fs.h linux-2.4.30.dev/include/linux/usbdevice_fs.h
|
||||
--- linux-2.4.30.old/include/linux/usbdevice_fs.h 2003-11-28 19:26:21.000000000 +0100
|
||||
+++ linux-2.4.30.dev/include/linux/usbdevice_fs.h 2005-04-29 18:42:37.000000000 +0200
|
||||
@@ -185,8 +185,6 @@
|
||||
extern struct file_operations usbdevfs_devices_fops;
|
||||
extern struct file_operations usbdevfs_device_file_operations;
|
||||
extern struct inode_operations usbdevfs_device_inode_operations;
|
||||
-extern struct inode_operations usbdevfs_bus_inode_operations;
|
||||
-extern struct file_operations usbdevfs_bus_file_operations;
|
||||
extern void usbdevfs_conn_disc_event(void);
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
diff -urN linux-2.4.30.old/include/net/icmp.h linux-2.4.30.dev/include/net/icmp.h
|
||||
--- linux-2.4.30.old/include/net/icmp.h 2001-11-22 20:47:15.000000000 +0100
|
||||
+++ linux-2.4.30.dev/include/net/icmp.h 2005-04-29 18:42:37.000000000 +0200
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
#include <net/sock.h>
|
||||
#include <net/protocol.h>
|
||||
+#include <net/snmp.h>
|
||||
|
||||
struct icmp_err {
|
||||
int errno;
|
||||
diff -urN linux-2.4.30.old/include/net/ipv6.h linux-2.4.30.dev/include/net/ipv6.h
|
||||
--- linux-2.4.30.old/include/net/ipv6.h 2004-11-17 12:54:22.000000000 +0100
|
||||
+++ linux-2.4.30.dev/include/net/ipv6.h 2005-04-29 18:42:37.000000000 +0200
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <asm/hardirq.h>
|
||||
#include <net/ndisc.h>
|
||||
#include <net/flow.h>
|
||||
+#include <net/snmp.h>
|
||||
|
||||
#define SIN6_LEN_RFC2133 24
|
||||
|
||||
diff -urN linux-2.4.30.old/include/linux/netfilter_ipv4/ip_tables.h linux-2.4.30.dev/include/linux/netfilter_ipv4/ip_tables.h
|
||||
--- linux-2.4.30.old/include/linux/netfilter_ipv4/ip_tables.h 2005-04-29 17:59:08.000000000 +0200
|
||||
+++ linux-2.4.30.dev/include/linux/netfilter_ipv4/ip_tables.h 2005-04-29 19:06:36.000000000 +0200
|
||||
@@ -283,7 +283,7 @@
|
||||
struct ipt_entry entrytable[0];
|
||||
};
|
||||
|
||||
-extern struct semaphore ipt_mutex;
|
||||
+// extern struct semaphore ipt_mutex;
|
||||
|
||||
/* Standard return verdict, or do jump. */
|
||||
#define IPT_STANDARD_TARGET ""
|
Loading…
Reference in New Issue