-Index: linux-2.6.0-test5/drivers/dump/dump_netdev.c
+Index: linux-2.6.0-test6/drivers/dump/dump_netdev.c
===================================================================
---- linux-2.6.0-test5.orig/drivers/dump/dump_netdev.c 2003-09-27 21:53:32.000000000 +0800
-+++ linux-2.6.0-test5/drivers/dump/dump_netdev.c 2003-09-30 22:26:22.709337152 +0800
+--- linux-2.6.0-test6.orig/drivers/dump/dump_netdev.c 2003-10-07 16:08:57.000000000 +0800
++++ linux-2.6.0-test6/drivers/dump/dump_netdev.c 2003-10-09 17:36:18.000000000 +0800
@@ -14,6 +14,7 @@
*
* Copyright (C) 2001 Ingo Molnar <mingo@redhat.com>
static u64 dump_magic;
#define MAX_UDP_CHUNK 1460
-@@ -64,300 +55,26 @@
+@@ -64,300 +55,28 @@
#define MAX_SKB_SIZE \
(MAX_UDP_CHUNK + sizeof(struct udphdr) + \
sizeof(struct iphdr) + sizeof(struct ethhdr))
- struct udphdr *uh;
- __u32 len, saddr, daddr, ulen;
req_t *__req;
-+
-+ __req = (req_t *)msg;
-
+-
- /*
- * First check if were are dumping or doing startup handshake, if
- * not quickly return.
- */
-- if (!netdump_in_progress)
++
+ if (!netdump_in_progress)
- return NET_RX_SUCCESS;
--
++ goto out;
++ __req = (req_t *)msg;
+
- if (skb->dev->type != ARPHRD_ETHER)
- goto out;
-
if ((ntohl(__req->command) != COMM_GET_MAGIC) &&
(ntohl(__req->command) != COMM_HELLO) &&
(ntohl(__req->command) != COMM_START_WRITE_NETDUMP_ACK) &&
-@@ -372,11 +89,27 @@
+@@ -372,11 +91,27 @@
req.nr = ntohl(__req->nr);
new_req = 1;
out:
{
int i;
-@@ -392,7 +125,7 @@
+@@ -392,7 +127,7 @@
unsigned int offset = i*1024;
reply.code = REPLY_MEM;
reply.info = offset;
}
}
static void dump_do_sysrq(int key)
-@@ -400,9 +133,16 @@
+@@ -400,9 +135,16 @@
struct pt_regs regs;
get_current_regs(®s);
/*
* This function waits for the client to acknowledge the receipt
* of the netdump startup reply, with the possibility of packets
-@@ -433,24 +173,27 @@
+@@ -433,24 +175,27 @@
/* send 300 handshake packets before declaring failure */
for (i = 0; i < 300; i++) {
/*
* check if the new request is of the expected type,
* if so, return, else try sending the handshaking
-@@ -504,10 +247,12 @@
+@@ -504,10 +249,12 @@
repeatCounter = 0;
total_loop = 0;
while (1) {
if (!new_req) {
repeatCounter++;
-@@ -532,13 +277,15 @@
+@@ -532,13 +279,15 @@
repeatCounter = 0;
counter = 0;
total_loop = 0;
break;
case COMM_EXIT:
-@@ -549,10 +296,11 @@
+@@ -549,10 +298,11 @@
case COMM_HELLO:
sprintf(tmp, "Hello, this is netdump version "
"0.%02d\n", NETCONSOLE_VERSION);
break;
case COMM_GET_PAGE_SIZE:
-@@ -560,7 +308,7 @@
+@@ -560,7 +310,7 @@
reply.code = REPLY_PAGE_SIZE;
reply.nr = req.nr;
reply.info = PAGE_SIZE;
break;
case COMM_GET_NR_PAGES:
-@@ -569,15 +317,14 @@
+@@ -569,15 +319,14 @@
reply.info = num_physpages;
reply.info = page_counter;
sprintf(tmp, "Number of pages: %ld\n", num_physpages);
break;
case COMM_SYSRQ:
dump_do_sysrq(req.from);
-@@ -585,7 +332,7 @@
+@@ -585,7 +334,7 @@
reply.nr = req.nr;
reply.info = req.from;
sprintf(tmp, "SYSRQ command %d \n", req.from);
break;
default:
reply.code = REPLY_ERROR;
-@@ -593,7 +340,7 @@
+@@ -593,7 +342,7 @@
reply.info = req.command;
sprintf(tmp, "Got unknown command code %d!\n",
req.command);
break;
}
}
-@@ -605,45 +352,45 @@
+@@ -605,45 +354,45 @@
static int
dump_validate_config(void)
{
printk("(Broadcast)");
printk("\n");
return 0;
-@@ -659,31 +406,24 @@
+@@ -659,31 +408,24 @@
dump_net_open(struct dump_dev *net_dev, unsigned long arg)
{
int retval = 0;
if ((retval = dump_validate_config()) < 0)
goto err2;
-@@ -694,7 +434,7 @@
+@@ -694,7 +436,7 @@
err2:
in_dev_put(dump_in_dev);
err1:
return retval;
}
-@@ -707,8 +447,8 @@
+@@ -707,8 +449,8 @@
{
if (dump_in_dev)
in_dev_put(dump_in_dev);
return 0;
}
-@@ -720,7 +460,6 @@
+@@ -720,7 +462,6 @@
dump_net_silence(struct dump_dev *net_dev)
{
local_irq_save(flags_global);
startup_handshake = 1;
net_dev->curr_offset = 0;
printk("Dumping to network device %s on CPU %d ...\n", device_name,
-@@ -740,7 +479,7 @@
+@@ -740,7 +481,7 @@
reply_t reply;
char tmp[200];
return (0);
sprintf(tmp, "NETDUMP end.\n");
-@@ -748,11 +487,10 @@
+@@ -748,11 +489,10 @@
reply.code = REPLY_END_NETDUMP;
reply.nr = 0;
reply.info = 0;
startup_handshake = 0;
return 0;
}
-@@ -809,18 +547,19 @@
+@@ -809,18 +549,19 @@
static int
dump_net_ioctl(struct dump_dev *net_dev, unsigned int cmd, unsigned long arg)
{
break;
case DIOGTARGETIP:
case DIOGTARGETPORT:
-@@ -830,6 +569,7 @@
+@@ -830,6 +571,7 @@
default:
return -EINVAL;
}
return 0;
}
-@@ -851,17 +591,28 @@
+@@ -851,17 +593,28 @@
.curr_offset = 0
};
get_random_bytes(&dump_magic, sizeof(dump_magic));
return 0;
}
-@@ -870,6 +621,7 @@
+@@ -870,6 +623,7 @@
dump_netdev_cleanup(void)
{
dump_unregister_device(&default_dump_netdev);