Kernel Update

Netstatusseite mit ip-Befehlen gemacht


git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@434 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8
This commit is contained in:
ms
2007-03-01 16:44:47 +00:00
parent 44254afd44
commit 376e42ce69
45 changed files with 61292 additions and 4557 deletions

View File

@@ -1,111 +0,0 @@
--- grub-0.90/stage2/stage2.c.append Thu Dec 20 08:20:48 2001
+++ grub-0.90/stage2/stage2.c Thu Dec 20 17:01:20 2001
@@ -500,7 +500,8 @@
if (config_entries)
printf ("\
Press enter to boot the selected OS, \'e\' to edit the\n\
- commands before booting, or \'c\' for a command-line.");
+ commands before booting, \'a\' to modify the kernel arguments\n\
+ before booting, or \'c\' for a command-line.");
else
printf ("\
Press \'b\' to boot, \'e\' to edit the selected command in the\n\
@@ -787,6 +788,98 @@
enter_cmdline (heap, 0);
goto restart;
}
+ if (config_entries && c == 'a')
+ {
+ int new_num_entries = 0, i = 0, j;
+ int needs_padding, amount;
+ char *new_heap;
+ char * entries;
+ char * entry_copy;
+ char * append_line;
+ char * start;
+
+ entry_copy = new_heap = heap;
+ cur_entry = get_entry (config_entries, first_entry + entryno,
+ 1);
+
+ do
+ {
+ while ((*(new_heap++) = cur_entry[i++]) != 0);
+ new_num_entries++;
+ }
+ while (config_entries && cur_entry[i]);
+
+ /* this only needs to be done if config_entries is non-NULL,
+ but it doesn't hurt to do it always */
+ *(new_heap++) = 0;
+
+ new_heap = heap + NEW_HEAPSIZE + 1;
+
+ entries = entry_copy;
+ while (*entries)
+ {
+ if ((strstr(entries, "kernel") == entries) &&
+ isspace(entries[6]))
+ break;
+
+ while (*entries) entries++;
+ entries++;
+ }
+
+ if (!*entries)
+ goto restart;
+
+ start = entries + 6;
+
+ /* skip the white space */
+ while (*start && isspace(*start)) start++;
+ /* skip the kernel name */
+ while (*start && !isspace(*start)) start++;
+
+ /* skip the white space */
+ needs_padding = (!*start || !isspace(*start));
+ while (*start && isspace(*start)) start++;
+
+ append_line = new_heap;
+ grub_strcpy(append_line, start);
+
+ cls();
+ print_cmdline_message (CMDLINE_EDIT_MODE);
+
+ if (get_cmdline(PACKAGE " append> ",
+ append_line, NEW_HEAPSIZE + 1,
+ 0, 1))
+ goto restart;
+
+ /* have new args; append_line points to the
+ new args and start points to the old
+ args */
+
+ i = grub_strlen(start);
+ j = grub_strlen(append_line);
+
+ if (i > (j + needs_padding))
+ amount = i;
+ else
+ amount = j + needs_padding;
+
+ /* align rest of commands properly */
+ memmove (start + j + needs_padding, start + i,
+ ((int) append_line) - ((int) start) - (amount));
+
+ if (needs_padding)
+ *start = ' ';
+
+ /* copy command to correct area */
+ memmove (start + needs_padding, append_line, j);
+
+ /* set up this entry to boot */
+ config_entries = NULL;
+ cur_entry = entry_copy;
+ heap = new_heap;
+
+ break;
+ }
#ifdef GRUB_UTIL
if (c == 'q')
{

View File

@@ -1,16 +0,0 @@
Only in grub: ChangeLog~
diff -ur grub-0.90/util/grub-install.in grub/util/grub-install.in
--- grub-0.90/util/grub-install.in Wed Sep 5 15:50:06 2001
+++ grub/util/grub-install.in Wed Sep 5 15:50:24 2001
@@ -320,6 +320,10 @@
exit 1
fi
+if ! test -e ${grubdir}/grub.conf ; then
+ test -e ${grubdir}/menu.lst && ln -s ./menu.lst ${grubdir}/grub.conf
+fi
+
# Create a safe temporary file.
test -x /bin/mktemp && log_file=`/bin/mktemp /tmp/grub-install.log.XXXXXX`
Only in grub/util: grub-install.in.orig

View File

@@ -1,249 +0,0 @@
To: bug-grub@gnu.org
cc: Keir.Fraser@cl.cam.ac.uk
Subject: PATCH (updated): 'lilo -R' functionality
From: Keir Fraser <Keir.Fraser@cl.cam.ac.uk>
Message-Id: <E16iFu3-0002VK-00@wisbech.cl.cam.ac.uk>
The following is a slight modification to the patch I submitted a week
or so ago. This will cause GRUB to skip displaying the boot menu if a
one-shot default has been specified (just as lilo does with '-R').
Same caveats as for previous patch:
* The new 'savedefault' function in the GRUB shell is incomplete.
Only works if the filesystem containing stage2 file is mounted.
* Patch is against grub-0.90, but patches directly to 0.91
I hope this goes into CVS in the next round of updates :-)
-- Keir Fraser
diff -urBP grub-0.90-old/stage2/builtins.c grub-0.90-modified/stage2/builtins.c
--- grub-0.90-old/stage2/builtins.c Fri Feb 22 11:59:57 2002
+++ grub-0.90-modified/stage2/builtins.c Fri Feb 22 13:48:36 2002
@@ -785,6 +785,17 @@
default_func (char *arg, int flags)
{
#ifndef SUPPORT_DISKLESS
+#ifndef GRUB_UTIL
+ /* Has a forced once-only default been specified? */
+ static int savedefault_helper(int);
+ if ((saved_entryno & STAGE2_ONCEONLY_ENTRY) != 0)
+ {
+ grub_timeout = 0;
+ default_entry = saved_entryno & ~STAGE2_ONCEONLY_ENTRY;
+ savedefault_helper(0);
+ return 0;
+ }
+#endif
if (grub_strcmp (arg, "saved") == 0)
{
default_entry = saved_entryno;
@@ -3074,22 +3085,15 @@
};
-/* savedefault */
+
+#if !defined(SUPPORT_DISKLESS) && !defined(GRUB_UTIL)
+/* Write specified default entry number into stage2 file. */
static int
-savedefault_func (char *arg, int flags)
+savedefault_helper(int new_default)
{
-#if !defined(SUPPORT_DISKLESS) && !defined(GRUB_UTIL)
char buffer[512];
int *entryno_ptr;
-
- /* This command is only useful when you boot an entry from the menu
- interface. */
- if (! (flags & BUILTIN_SCRIPT))
- {
- errnum = ERR_UNRECOGNIZED;
- return 1;
- }
-
+
/* Get the geometry of the boot drive (i.e. the disk which contains
this stage2). */
if (get_diskinfo (boot_drive, &buf_geom))
@@ -3115,10 +3119,10 @@
entryno_ptr = (int *) (buffer + STAGE2_SAVED_ENTRYNO);
/* Check if the saved entry number differs from current entry number. */
- if (*entryno_ptr != current_entryno)
+ if (*entryno_ptr != new_default)
{
/* Overwrite the saved entry number. */
- *entryno_ptr = current_entryno;
+ *entryno_ptr = new_default;
/* Save the image in the disk. */
if (! rawwrite (boot_drive, install_second_sector, buffer))
@@ -3129,6 +3133,117 @@
}
return 0;
+}
+#endif
+
+#if !defined(SUPPORT_DISKLESS) && defined(GRUB_UTIL)
+/*
+ * Full implementation of new `savedefault' for GRUB shell.
+ * XXX This needs fixing for stage2 files which aren't accessible
+ * through a mounted filesystem.
+ */
+static int
+savedefault_shell(char *arg, int flags)
+{
+ char *stage2_os_file = "/boot/grub/stage2"; /* Default filename */
+ FILE *fp;
+ char buffer[512];
+ int *entryno_ptr;
+ int new_default = 0;
+
+ while (1)
+ {
+ if (grub_memcmp ("--stage2=", arg, sizeof ("--stage2=") - 1) == 0)
+ {
+ stage2_os_file = arg + sizeof ("--stage2=") - 1;
+ arg = skip_to (0, arg);
+ nul_terminate (stage2_os_file);
+ }
+ else if (grub_memcmp ("--default=", arg, sizeof ("--default=") - 1) == 0)
+ {
+ char *p = arg + sizeof ("--default=") - 1;
+ if (! safe_parse_maxint (&p, &new_default))
+ return 1;
+ arg = skip_to (0, arg);
+ }
+ else if (grub_memcmp ("--once", arg, sizeof ("--once") - 1) == 0)
+ {
+ new_default |= STAGE2_ONCEONLY_ENTRY;
+ arg = skip_to (0, arg);
+ }
+ else
+ break;
+ }
+
+ if (! (fp = fopen(stage2_os_file, "r+")))
+ {
+ errnum = ERR_FILE_NOT_FOUND;
+ return 1;
+ }
+
+ if (fseek (fp, SECTOR_SIZE, SEEK_SET) != 0)
+ {
+ fclose (fp);
+ errnum = ERR_BAD_VERSION;
+ return 1;
+ }
+
+ if (fread (buffer, 1, SECTOR_SIZE, fp) != SECTOR_SIZE)
+ {
+ fclose (fp);
+ errnum = ERR_READ;
+ return 1;
+ }
+
+ /* Sanity check. */
+ if (buffer[STAGE2_STAGE2_ID] != STAGE2_ID_STAGE2
+ || *((short *) (buffer + STAGE2_VER_MAJ_OFFS)) != COMPAT_VERSION)
+ {
+ errnum = ERR_BAD_VERSION;
+ return 1;
+ }
+
+ entryno_ptr = (int *) (buffer + STAGE2_SAVED_ENTRYNO);
+ *entryno_ptr = new_default;
+
+ if (fseek (fp, SECTOR_SIZE, SEEK_SET) != 0)
+ {
+ fclose (fp);
+ errnum = ERR_BAD_VERSION;
+ return 1;
+ }
+
+ if (fwrite (buffer, 1, SECTOR_SIZE, fp) != SECTOR_SIZE)
+ {
+ fclose (fp);
+ errnum = ERR_WRITE;
+ return 1;
+ }
+
+ (void)fflush (fp);
+ fclose (fp);
+ return 0;
+}
+#endif
+
+/* savedefault */
+static int
+savedefault_func (char *arg, int flags)
+{
+#if !defined(SUPPORT_DISKLESS)
+#if !defined(GRUB_UTIL)
+ /* This command is only useful when you boot an entry from the menu
+ interface. */
+ if (! (flags & BUILTIN_SCRIPT))
+ {
+ errnum = ERR_UNRECOGNIZED;
+ return 1;
+ }
+
+ return savedefault_helper(current_entryno);
+#else /* defined(GRUB_UTIL) */
+ return savedefault_shell(arg, flags);
+#endif
#else /* ! SUPPORT_DISKLESS && ! GRUB_UTIL */
errnum = ERR_UNRECOGNIZED;
return 1;
@@ -3140,8 +3255,14 @@
"savedefault",
savedefault_func,
BUILTIN_CMDLINE,
+#ifdef GRUB_UTIL
+ "savedefault [--stage2=STAGE2_FILE] [--default=DEFAULT] [--once]",
+ "Save DEFAULT as the default boot entry in STAGE2_FILE. If '--once'"
+ " is specified, the default is reset after the next reboot."
+#else
"savedefault",
"Save the current entry as the default boot entry."
+#endif
};
@@ -4217,6 +4338,15 @@
static int
timeout_func (char *arg, int flags)
{
+ /* One-shot default shenanigans -- don't piss around with the menu! */
+ if (grub_timeout != -1)
+ return 0;
+ if ((saved_entryno & STAGE2_ONCEONLY_ENTRY) != 0)
+ {
+ grub_timeout = 0;
+ return 0;
+ }
+
if (! safe_parse_maxint (&arg, &grub_timeout))
return 1;
diff -urBP grub-0.90-old/stage2/shared.h grub-0.90-modified/stage2/shared.h
--- grub-0.90-old/stage2/shared.h Fri Feb 22 11:59:53 2002
+++ grub-0.90-modified/stage2/shared.h Fri Feb 22 10:51:49 2002
@@ -199,6 +199,8 @@
#define STAGE2_FORCE_LBA 0x11
#define STAGE2_VER_STR_OFFS 0x12
+#define STAGE2_ONCEONLY_ENTRY 0x10000
+
/* Stage 2 identifiers */
#define STAGE2_ID_STAGE2 0
#define STAGE2_ID_FFS_STAGE1_5 1
_______________________________________________
Bug-grub mailing list
Bug-grub@gnu.org
http://mail.gnu.org/mailman/listinfo/bug-grub

View File

@@ -1,28 +0,0 @@
diff -ur grub-0.91/docs/grub.texi grub/docs/grub.texi
--- grub-0.91/docs/grub.texi Mon Jan 21 22:57:46 2002
+++ grub/docs/grub.texi Mon Jan 21 22:57:51 2002
@@ -1891,6 +1891,7 @@
* rarp:: Initialize a network device via RARP
* serial:: Set up a serial device
* setkey:: Configure the key map
+* splashimage:: Use a splash image
* terminal:: Choose a terminal
* tftpserver:: Specify a TFTP server
* unhide:: Unhide a partition
@@ -2260,6 +2261,16 @@
@end deffn
+@node splashimage
+@subsection splashimage
+
+@deffn Command splashimage file
+Select an image to use as the background image. This should be
+specified using normal GRUB device naming syntax. The format of the
+file is a gzipped xpm which is 640x480 with a 14 color palette.
+@end deffn
+
+
@node terminal
@subsection terminal

View File

@@ -1,75 +0,0 @@
--- grub-0.93/stage2/asm.S.config 2002-12-02 18:18:56.000000000 -0500
+++ grub-0.93/stage2/asm.S 2002-12-28 22:01:24.000000000 -0500
@@ -97,7 +97,7 @@
.string VERSION
VARIABLE(config_file)
#ifndef STAGE1_5
- .string "/boot/grub/menu.lst"
+ .string "/boot/grub/grub.conf"
#else /* STAGE1_5 */
.long 0xffffffff
.string "/boot/grub/stage2"
--- grub-0.93/stage2/builtins.c.config 2002-12-03 23:41:57.000000000 -0500
+++ grub-0.93/stage2/builtins.c 2002-12-28 22:01:24.000000000 -0500
@@ -3838,7 +3838,7 @@
/* The prefix was determined. */
grub_sprintf (stage2, "%s%s", prefix, "/stage2");
- grub_sprintf (config_filename, "%s%s", prefix, "/menu.lst");
+ grub_sprintf (config_filename, "%s%s", prefix, "/grub.conf");
*real_config_filename = 0;
/* Check if stage2 exists. */
--- grub-0.93/grub/asmstub.c.config 2002-12-02 18:20:45.000000000 -0500
+++ grub-0.93/grub/asmstub.c 2002-12-28 22:01:24.000000000 -0500
@@ -71,7 +71,7 @@
unsigned long boot_drive = 0;
int saved_entryno = 0;
char version_string[] = VERSION;
-char config_file[128] = "/boot/grub/menu.lst"; /* FIXME: arbitrary */
+char config_file[128] = "/boot/grub/grub.conf"; /* FIXME: arbitrary */
unsigned long linux_text_len = 0;
char *linux_data_tmp_addr = 0;
char *linux_data_real_addr = 0;
--- grub-0.93/docs/grub.8.config 2002-12-07 22:17:59.000000000 -0500
+++ grub-0.93/docs/grub.8 2002-12-28 22:01:24.000000000 -0500
@@ -15,7 +15,7 @@
specify stage2 boot_drive [default=0x0]
.TP
\fB\-\-config\-file\fR=\fIFILE\fR
-specify stage2 config_file [default=/boot/grub/menu.lst]
+specify stage2 config_file [default=/boot/grub/grub.conf]
.TP
\fB\-\-device\-map\fR=\fIFILE\fR
use the device map file FILE
--- grub-0.93/docs/grub.texi.config 2002-12-02 17:35:28.000000000 -0500
+++ grub-0.93/docs/grub.texi 2002-12-28 22:01:24.000000000 -0500
@@ -989,7 +989,7 @@
keys) that will do everything to boot an OS.
To enable the menu, you need a configuration file,
-@file{menu.lst} under the boot directory. We'll analyze an example
+@file{grub.conf} under the boot directory. We'll analyze an example
file.
The file first contains some general settings, the menu interface
@@ -1596,8 +1596,8 @@
An absolute file name resembles a Unix absolute file name, using
@samp{/} for the directory separator (not @samp{\} as in DOS). One
-example is @samp{(hd0,0)/boot/grub/menu.lst}. This means the file
-@file{/boot/grub/menu.lst} in the first partition of the first hard
+example is @samp{(hd0,0)/boot/grub/grub.conf}. This means the file
+@file{/boot/grub/grub.conf} in the first partition of the first hard
disk. If you omit the device name in an absolute file name, GRUB uses
GRUB's @dfn{root device} implicitly. So if you set the root device to,
say, @samp{(hd1,0)} by the command @command{root} (@pxref{root}), then
@@ -3249,7 +3249,7 @@
@item --config-file=@var{file}
Read the configuration file @var{file} instead of
-@file{/boot/grub/menu.lst}. The format is the same as the normal GRUB
+@file{/boot/grub/grub.conf}. The format is the same as the normal GRUB
syntax. See @ref{Filesystem}, for more information.
@item --boot-drive=@var{drive}

View File

@@ -1,77 +0,0 @@
Index: stage2/cmdline.c
===================================================================
RCS file: /cvsroot/grub/grub/stage2/cmdline.c,v
retrieving revision 1.27
diff -u -r1.27 cmdline.c
--- stage2/cmdline.c 3 Dec 2002 00:02:53 -0000 1.27
+++ stage2/cmdline.c 6 Jan 2003 05:33:33 -0000
@@ -48,12 +48,17 @@
/* Print a helpful message for the command-line interface. */
void
-print_cmdline_message (int forever)
+print_cmdline_message (int type)
{
printf (" [ Minimal BASH-like line editing is supported. For the first word, TAB\n"
" lists possible command completions. Anywhere else TAB lists the possible\n"
- " completions of a device/filename.%s ]\n",
- (forever ? "" : " ESC at any time exits."));
+ " completions of a device/filename.");
+ if (type == CMDLINE_NORMAL_MODE)
+ printf(" ESC at any time exits.");
+ if (type == CMDLINE_EDIT_MODE)
+ printf(" ESC at any time cancels. ENTER \n"
+ " at any time accepts your changes.");
+ printf("]\n");
}
/* Find the builtin whose command name is COMMAND and return the
@@ -128,7 +133,7 @@
print_network_configuration ();
grub_putchar ('\n');
#endif
- print_cmdline_message (forever);
+ print_cmdline_message (forever ? CMDLINE_FOREVER_MODE : CMDLINE_NORMAL_MODE);
while (1)
{
Index: stage2/shared.h
===================================================================
RCS file: /cvsroot/grub/grub/stage2/shared.h,v
retrieving revision 1.90
diff -u -r1.90 shared.h
--- stage2/shared.h 3 Dec 2002 00:02:53 -0000 1.90
+++ stage2/shared.h 6 Jan 2003 05:33:33 -0000
@@ -843,9 +843,15 @@
void init_config (void);
char *skip_to (int after_equal, char *cmdline);
struct builtin *find_command (char *command);
-void print_cmdline_message (int forever);
void enter_cmdline (char *heap, int forever);
int run_script (char *script, char *heap);
+
+/* the flags for the cmdline message */
+#define CMDLINE_FOREVER_MODE 0x0
+#define CMDLINE_NORMAL_MODE 0x1
+#define CMDLINE_EDIT_MODE 0x2
+
+void print_cmdline_message (int type);
#endif
/* C library replacement functions with identical semantics. */
Index: stage2/stage2.c
===================================================================
RCS file: /cvsroot/grub/grub/stage2/stage2.c,v
retrieving revision 1.42
diff -u -r1.42 stage2.c
--- stage2/stage2.c 4 Dec 2002 00:55:45 -0000 1.42
+++ stage2/stage2.c 6 Jan 2003 05:33:33 -0000
@@ -655,7 +655,7 @@
else
{
cls ();
- print_cmdline_message (0);
+ print_cmdline_message (CMDLINE_EDIT_MODE);
new_heap = heap + NEW_HEAPSIZE + 1;

View File

@@ -1,39 +0,0 @@
--- grub-0.93/stage2/builtins.c.bootterm 2002-12-29 02:01:50.000000000 -0500
+++ grub-0.93/stage2/builtins.c 2002-12-29 02:01:07.000000000 -0500
@@ -233,12 +233,22 @@
static int
boot_func (char *arg, int flags)
{
+ struct term_entry *prev_term = current_term;
/* Clear the int15 handler if we can boot the kernel successfully.
This assumes that the boot code never fails only if KERNEL_TYPE is
not KERNEL_TYPE_NONE. Is this assumption is bad? */
if (kernel_type != KERNEL_TYPE_NONE)
unset_int15_handler ();
+ /* if our terminal needed initialization, we should shut it down
+ * before booting the kernel, but we want to save what it was so
+ * we can come back if needed */
+ if (current_term->shutdown)
+ {
+ (*current_term->shutdown)();
+ current_term = term_table; /* assumption: console is first */
+ }
+
#ifdef SUPPORT_NETBOOT
/* Shut down the networking. */
cleanup_net ();
@@ -302,6 +312,13 @@
return 1;
}
+ /* if we get back here, we should go back to what our term was before */
+ current_term = prev_term;
+ if (current_term->startup)
+ /* if our terminal fails to initialize, fall back to console since
+ * it should always work */
+ if ((*current_term->startup)() == 0)
+ current_term = term_table; /* we know that console is first */
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,183 +0,0 @@
--- rtl8139.c.old 2004-01-25 17:49:38.000000000 +0000
+++ rtl8139.c 2004-01-25 18:20:29.000000000 +0000
@@ -161,19 +161,11 @@
/* The RTL8139 can only transmit from a contiguous, aligned memory block. */
static unsigned char tx_buffer[TX_BUF_SIZE] __attribute__((aligned(4)));
-/* I know that this is a MEGA HACK, but the tagged boot image specification
- * states that we can do whatever we want below 0x10000 - so we do! */
-/* But we still give the user the choice of using an internal buffer
- just in case - Ken */
-#ifdef USE_LOWMEM_BUFFER
-#define rx_ring ((unsigned char *)(0x10000 - (RX_BUF_LEN + 16)))
-#else
static unsigned char rx_ring[RX_BUF_LEN+16] __attribute__((aligned(4)));
-#endif
struct nic *rtl8139_probe(struct nic *nic, unsigned short *probeaddrs,
struct pci_device *pci);
-static int read_eeprom(int location);
+static int read_eeprom(int location, int addr_len);
static void rtl_reset(struct nic *nic);
static void rtl_transmit(struct nic *nic, const char *destaddr,
unsigned int type, unsigned int len, const char *data);
@@ -186,6 +178,8 @@
{
int i;
int speed10, fullduplex;
+ int addr_len;
+ unsigned short *ap = (unsigned short*)nic->node_addr;
/* There are enough "RTL8139" strings on the console already, so
* be brief and concentrate on the interesting pieces of info... */
@@ -199,15 +193,9 @@
/* Bring the chip out of low-power mode. */
outb(0x00, ioaddr + Config1);
- if (read_eeprom(0) != 0xffff) {
- unsigned short *ap = (unsigned short*)nic->node_addr;
- for (i = 0; i < 3; i++)
- *ap++ = read_eeprom(i + 7);
- } else {
- unsigned char *ap = (unsigned char*)nic->node_addr;
- for (i = 0; i < ETH_ALEN; i++)
- *ap++ = inb(ioaddr + MAC0 + i);
- }
+ addr_len = read_eeprom(0,8) == 0x8129 ? 8 : 6;
+ for (i = 0; i < 3; i++)
+ *ap++ = read_eeprom(i + 7,addr_len);
speed10 = inb(ioaddr + MediaStatus) & MSRSpeed10;
fullduplex = inw(ioaddr + MII_BMCR) & BMCRDuplex;
@@ -217,6 +205,10 @@
rtl_reset(nic);
+ if (inb(ioaddr + MediaStatus) & MSRLinkFail) {
+ printf("Cable not connected or other link failure\n");
+ return(0);
+ }
nic->reset = rtl_reset;
nic->poll = rtl_poll;
nic->transmit = rtl_transmit;
@@ -244,22 +236,23 @@
#define eeprom_delay() inl(ee_addr)
/* The EEPROM commands include the alway-set leading bit. */
-#define EE_WRITE_CMD (5 << 6)
-#define EE_READ_CMD (6 << 6)
-#define EE_ERASE_CMD (7 << 6)
+#define EE_WRITE_CMD (5)
+#define EE_READ_CMD (6)
+#define EE_ERASE_CMD (7)
-static int read_eeprom(int location)
+static int read_eeprom(int location, int addr_len)
{
int i;
unsigned int retval = 0;
long ee_addr = ioaddr + Cfg9346;
- int read_cmd = location | EE_READ_CMD;
+ int read_cmd = location | (EE_READ_CMD << addr_len);
outb(EE_ENB & ~EE_CS, ee_addr);
outb(EE_ENB, ee_addr);
+ eeprom_delay();
/* Shift the read command bits out. */
- for (i = 10; i >= 0; i--) {
+ for (i = 4 + addr_len; i >= 0; i--) {
int dataval = (read_cmd & (1 << i)) ? EE_DATA_WRITE : 0;
outb(EE_ENB | dataval, ee_addr);
eeprom_delay();
@@ -279,9 +272,28 @@
/* Terminate the EEPROM access. */
outb(~EE_CS, ee_addr);
+ eeprom_delay();
return retval;
}
+static const unsigned int rtl8139_rx_config =
+ (RX_BUF_LEN_IDX << 11) |
+ (RX_FIFO_THRESH << 13) |
+ (RX_DMA_BURST << 8);
+
+static void set_rx_mode(struct nic *nic) {
+ unsigned int mc_filter[2];
+ int rx_mode;
+ /* !IFF_PROMISC */
+ rx_mode = AcceptBroadcast | AcceptMulticast | AcceptMyPhys;
+ mc_filter[1] = mc_filter[0] = 0xffffffff;
+
+ outl(rtl8139_rx_config | rx_mode, ioaddr + RxConfig);
+
+ outl(mc_filter[0], ioaddr + MAR0 + 0);
+ outl(mc_filter[1], ioaddr + MAR0 + 4);
+}
+
static void rtl_reset(struct nic* nic)
{
int i;
@@ -316,17 +328,24 @@
#ifdef DEBUG_RX
printf("rx ring address is %X\n",(unsigned long)rx_ring);
#endif
- outl((unsigned long)rx_ring, ioaddr + RxBuf);
+ outl((unsigned long)rx_ring, ioaddr + RxBuf);
+
+
- /* Start the chip's Tx and Rx process. */
- outl(0, ioaddr + RxMissed);
- /* set_rx_mode */
- outb(AcceptBroadcast|AcceptMyPhys, ioaddr + RxConfig);
/* If we add multicast support, the MAR0 register would have to be
* initialized to 0xffffffffffffffff (two 32 bit accesses). Etherboot
* only needs broadcast (for ARP/RARP/BOOTP/DHCP) and unicast. */
+
outb(CmdRxEnb | CmdTxEnb, ioaddr + ChipCmd);
+
+ outl(rtl8139_rx_config, ioaddr + RxConfig);
+
+ /* Start the chip's Tx and Rx process. */
+ outl(0, ioaddr + RxMissed);
+ /* set_rx_mode */
+ set_rx_mode(nic);
+
/* Disable all known interrupts by setting the interrupt mask. */
outw(0, ioaddr + IntrMask);
}
@@ -337,10 +356,11 @@
unsigned int status, to, nstype;
unsigned long txstatus;
+ /* nstype assignment moved up here to avoid gcc 3.0.3 compiler bug */
+ nstype = htons(type);
memcpy(tx_buffer, destaddr, ETH_ALEN);
memcpy(tx_buffer + ETH_ALEN, nic->node_addr, ETH_ALEN);
- nstype = htons(type);
- memcpy(tx_buffer + 2 * ETH_ALEN, (char*)&nstype, 2);
+ memcpy(tx_buffer + 2 * ETH_ALEN, &nstype, 2);
memcpy(tx_buffer + ETH_HLEN, data, len);
len += ETH_HLEN;
@@ -354,7 +374,7 @@
tx_buffer[len++] = '\0';
}
- outl((unsigned long)tx_buffer, ioaddr + TxAddr0 + cur_tx*4);
+ outl((unsigned long)tx_buffer, ioaddr + TxAddr0 + cur_tx*4);
outl(((TX_FIFO_THRESH<<11) & 0x003f0000) | len,
ioaddr + TxStatus0 + cur_tx*4);
@@ -448,6 +468,8 @@
static void rtl_disable(struct nic *nic)
{
+ rtl_reset(nic);
+
/* reset the chip */
outb(CmdReset, ioaddr + ChipCmd);

View File

@@ -1,18 +0,0 @@
--- grub-0.93/lib/device.c.raid 2002-05-20 05:53:46.000000000 -0400
+++ grub-0.93/lib/device.c 2002-12-28 23:24:10.000000000 -0500
@@ -689,7 +689,14 @@
if (strcmp (dev + strlen(dev) - 5, "/disc") == 0)
strcpy (dev + strlen(dev) - 5, "/part");
}
- sprintf (dev + strlen(dev), "%d", ((partition >> 16) & 0xFF) + 1);
+
+ sprintf (dev + strlen(dev), "%s%d",
+ /* Compaq smart and others */
+ (strncmp(dev, "/dev/ida/", 9) == 0 ||
+ strncmp(dev, "/dev/ataraid/", 13) == 0 ||
+ strncmp(dev, "/dev/cciss/", 11) == 0 ||
+ strncmp(dev, "/dev/rd/", 8) == 0) ? "p" : "",
+ ((partition >> 16) & 0xFF) + 1);
/* Open the partition. */
fd = open (dev, O_RDWR);

View File

@@ -1,55 +0,0 @@
Only in grub-0.94/docs: grub.info
Only in grub-0.94/docs: multiboot.info
diff -ur grub-0.94/lib/device.c grub-0.94.new/lib/device.c
--- grub-0.94/lib/device.c 2004-05-07 04:50:36.375238696 +0200
+++ grub-0.94.new/lib/device.c 2004-05-07 04:48:57.611253104 +0200
@@ -419,6 +419,12 @@
{
sprintf (name, "/dev/rd/c%dd%d", controller, drive);
}
+
+static void
+get_i2o_disk_name (char *name, int unit)
+{
+ sprintf (name, "/dev/i2o/hd%c", unit + 'a');
+}
#endif
/* Check if DEVICE can be read. If an error occurs, return zero,
@@ -789,6 +795,26 @@
}
}
}
+
+ /* I2O disks. */
+ for (i = 0; i < 8; i++)
+ {
+ char name[16];
+
+ get_i2o_disk_name (name, i);
+ if (check_device (name))
+ {
+ (*map)[num_hd + 0x80] = strdup (name);
+ assert ((*map)[num_hd + 0x80]);
+
+ /* If the device map file is opened, write the map. */
+ if (fp)
+ fprintf (fp, "(hd%d)\t%s\n", num_hd, name);
+
+ num_hd++;
+ }
+ }
+
#endif /* __linux__ */
/* OK, close the device map file if opened. */
@@ -844,7 +870,8 @@
(strncmp(dev, "/dev/ida/", 9) == 0 ||
strncmp(dev, "/dev/ataraid/", 13) == 0 ||
strncmp(dev, "/dev/cciss/", 11) == 0 ||
- strncmp(dev, "/dev/rd/", 8) == 0) ? "p" : "",
+ strncmp(dev, "/dev/rd/", 8) == 0 ||
+ strncmp(dev, "/dev/i2o/", 9) == 0) ? "p" : "",
((partition >> 16) & 0xFF) + 1);
/* Open the partition. */

View File

@@ -1,18 +0,0 @@
diff -ruN openswan-1.0.1.bak/pluto/server.c openswan-1.0.1/pluto/server.c
--- openswan-1.0.1.bak/pluto/server.c 2003-11-17 00:32:11.000000000 +0100
+++ openswan-1.0.1/pluto/server.c 2004-03-12 14:58:00.000000000 +0100
@@ -98,12 +98,13 @@
else
{
/* to keep control socket secure, use umask */
- mode_t ou = umask(~S_IRWXU);
+ mode_t ou = umask(~(S_IRWXU | S_IRWXG));
if (bind(ctl_fd, (struct sockaddr *)&ctl_addr
, offsetof(struct sockaddr_un, sun_path) + strlen(ctl_addr.sun_path)) < 0)
failed = "bind";
umask(ou);
+ chown(ctl_addr.sun_path, 0, 99);
}
/* 5 is a haphazardly chosen limit for the backlog.

View File

@@ -1,342 +0,0 @@
--- openswan-1.0.6.old/klips/net/ipsec/ipsec_tunnel.c 2003-12-04 03:03:24.000000000 +0000
+++ openswan-1.0.6/klips/net/ipsec/ipsec_tunnel.c 2004-09-01 21:20:46.870711465 +0100
@@ -3186,6 +3186,174 @@
return 0;
}
+static struct device dev_ipsec15 =
+{
+ "ipsec15\0 ", /* name */
+ 0, /* recv memory end */
+ 0, /* recv memory start */
+ 0, /* memory end */
+ 0, /* memory start */
+ 0x0, /* base I/O address */
+ 0, /* IRQ */
+ 0, 0, 0, /* flags */
+ NULL, /* next device */
+ ipsec_tunnel_probe /* setup */
+};
+
+static struct device dev_ipsec14 =
+{
+ "ipsec14\0 ", /* name */
+ 0, /* recv memory end */
+ 0, /* recv memory start */
+ 0, /* memory end */
+ 0, /* memory start */
+ 0x0, /* base I/O address */
+ 0, /* IRQ */
+ 0, 0, 0, /* flags */
+ NULL, /* next device */
+ ipsec_tunnel_probe /* setup */
+};
+
+static struct device dev_ipsec13 =
+{
+ "ipsec13\0 ", /* name */
+ 0, /* recv memory end */
+ 0, /* recv memory start */
+ 0, /* memory end */
+ 0, /* memory start */
+ 0x0, /* base I/O address */
+ 0, /* IRQ */
+ 0, 0, 0, /* flags */
+ NULL, /* next device */
+ ipsec_tunnel_probe /* setup */
+};
+
+static struct device dev_ipsec12 =
+{
+ "ipsec12\0 ", /* name */
+ 0, /* recv memory end */
+ 0, /* recv memory start */
+ 0, /* memory end */
+ 0, /* memory start */
+ 0x0, /* base I/O address */
+ 0, /* IRQ */
+ 0, 0, 0, /* flags */
+ NULL, /* next device */
+ ipsec_tunnel_probe /* setup */
+};
+
+static struct device dev_ipsec11 =
+{
+ "ipsec11\0 ", /* name */
+ 0, /* recv memory end */
+ 0, /* recv memory start */
+ 0, /* memory end */
+ 0, /* memory start */
+ 0x0, /* base I/O address */
+ 0, /* IRQ */
+ 0, 0, 0, /* flags */
+ NULL, /* next device */
+ ipsec_tunnel_probe /* setup */
+};
+
+static struct device dev_ipsec10 =
+{
+ "ipsec10\0 ", /* name */
+ 0, /* recv memory end */
+ 0, /* recv memory start */
+ 0, /* memory end */
+ 0, /* memory start */
+ 0x0, /* base I/O address */
+ 0, /* IRQ */
+ 0, 0, 0, /* flags */
+ NULL, /* next device */
+ ipsec_tunnel_probe /* setup */
+};
+
+static struct device dev_ipsec9 =
+{
+ "ipsec9\0 ", /* name */
+ 0, /* recv memory end */
+ 0, /* recv memory start */
+ 0, /* memory end */
+ 0, /* memory start */
+ 0x0, /* base I/O address */
+ 0, /* IRQ */
+ 0, 0, 0, /* flags */
+ NULL, /* next device */
+ ipsec_tunnel_probe /* setup */
+};
+
+static struct device dev_ipsec8 =
+{
+ "ipsec8\0 ", /* name */
+ 0, /* recv memory end */
+ 0, /* recv memory start */
+ 0, /* memory end */
+ 0, /* memory start */
+ 0x0, /* base I/O address */
+ 0, /* IRQ */
+ 0, 0, 0, /* flags */
+ NULL, /* next device */
+ ipsec_tunnel_probe /* setup */
+};
+
+static struct device dev_ipsec7 =
+{
+ "ipsec7\0 ", /* name */
+ 0, /* recv memory end */
+ 0, /* recv memory start */
+ 0, /* memory end */
+ 0, /* memory start */
+ 0x0, /* base I/O address */
+ 0, /* IRQ */
+ 0, 0, 0, /* flags */
+ NULL, /* next device */
+ ipsec_tunnel_probe /* setup */
+};
+
+static struct device dev_ipsec6 =
+{
+ "ipsec6\0 ", /* name */
+ 0, /* recv memory end */
+ 0, /* recv memory start */
+ 0, /* memory end */
+ 0, /* memory start */
+ 0x0, /* base I/O address */
+ 0, /* IRQ */
+ 0, 0, 0, /* flags */
+ NULL, /* next device */
+ ipsec_tunnel_probe /* setup */
+};
+
+static struct device dev_ipsec5 =
+{
+ "ipsec5\0 ", /* name */
+ 0, /* recv memory end */
+ 0, /* recv memory start */
+ 0, /* memory end */
+ 0, /* memory start */
+ 0x0, /* base I/O address */
+ 0, /* IRQ */
+ 0, 0, 0, /* flags */
+ NULL, /* next device */
+ ipsec_tunnel_probe /* setup */
+};
+
+static struct device dev_ipsec4 =
+{
+ "ipsec4\0 ", /* name */
+ 0, /* recv memory end */
+ 0, /* recv memory start */
+ 0, /* memory end */
+ 0, /* memory start */
+ 0x0, /* base I/O address */
+ 0, /* IRQ */
+ 0, 0, 0, /* flags */
+ NULL, /* next device */
+ ipsec_tunnel_probe /* setup */
+};
+
static struct device dev_ipsec3 =
{
"ipsec3\0 ", /* name */
@@ -3277,6 +3445,102 @@
#endif
if (register_netdev(&dev_ipsec3) != 0)
return -EIO;
+#if 0
+ KLIPS_PRINT(debug_tunnel & DB_TN_INIT,
+ "klips_debug:ipsec_tunnel_init_devices: "
+ "registering device %s\n",
+ dev_ipsec4.name);
+#endif
+ if (register_netdev(&dev_ipsec4) != 0)
+ return -EIO;
+#if 0
+ KLIPS_PRINT(debug_tunnel & DB_TN_INIT,
+ "klips_debug:ipsec_tunnel_init_devices: "
+ "registering device %s\n",
+ dev_ipsec5.name);
+#endif
+ if (register_netdev(&dev_ipsec5) != 0)
+ return -EIO;
+#if 0
+ KLIPS_PRINT(debug_tunnel & DB_TN_INIT,
+ "klips_debug:ipsec_tunnel_init_devices: "
+ "registering device %s\n",
+ dev_ipsec6.name);
+#endif
+ if (register_netdev(&dev_ipsec6) != 0)
+ return -EIO;
+#if 0
+ KLIPS_PRINT(debug_tunnel & DB_TN_INIT,
+ "klips_debug:ipsec_tunnel_init_devices: "
+ "registering device %s\n",
+ dev_ipsec7.name);
+#endif
+ if (register_netdev(&dev_ipsec7) != 0)
+ return -EIO;
+#if 0
+ KLIPS_PRINT(debug_tunnel & DB_TN_INIT,
+ "klips_debug:ipsec_tunnel_init_devices: "
+ "registering device %s\n",
+ dev_ipsec8.name);
+#endif
+ if (register_netdev(&dev_ipsec8) != 0)
+ return -EIO;
+#if 0
+ KLIPS_PRINT(debug_tunnel & DB_TN_INIT,
+ "klips_debug:ipsec_tunnel_init_devices: "
+ "registering device %s\n",
+ dev_ipsec9.name);
+#endif
+ if (register_netdev(&dev_ipsec9) != 0)
+ return -EIO;
+#if 0
+ KLIPS_PRINT(debug_tunnel & DB_TN_INIT,
+ "klips_debug:ipsec_tunnel_init_devices: "
+ "registering device %s\n",
+ dev_ipsec10.name);
+#endif
+ if (register_netdev(&dev_ipsec10) != 0)
+ return -EIO;
+#if 0
+ KLIPS_PRINT(debug_tunnel & DB_TN_INIT,
+ "klips_debug:ipsec_tunnel_init_devices: "
+ "registering device %s\n",
+ dev_ipsec11.name);
+#endif
+ if (register_netdev(&dev_ipsec11) != 0)
+ return -EIO;
+#if 0
+ KLIPS_PRINT(debug_tunnel & DB_TN_INIT,
+ "klips_debug:ipsec_tunnel_init_devices: "
+ "registering device %s\n",
+ dev_ipsec12.name);
+#endif
+ if (register_netdev(&dev_ipsec12) != 0)
+ return -EIO;
+#if 0
+ KLIPS_PRINT(debug_tunnel & DB_TN_INIT,
+ "klips_debug:ipsec_tunnel_init_devices: "
+ "registering device %s\n",
+ dev_ipsec13.name);
+#endif
+ if (register_netdev(&dev_ipsec13) != 0)
+ return -EIO;
+#if 0
+ KLIPS_PRINT(debug_tunnel & DB_TN_INIT,
+ "klips_debug:ipsec_tunnel_init_devices: "
+ "registering device %s\n",
+ dev_ipsec14.name);
+#endif
+ if (register_netdev(&dev_ipsec14) != 0)
+ return -EIO;
+#if 0
+ KLIPS_PRINT(debug_tunnel & DB_TN_INIT,
+ "klips_debug:ipsec_tunnel_init_devices: "
+ "registering device %s\n",
+ dev_ipsec15.name);
+#endif
+ if (register_netdev(&dev_ipsec15) != 0)
+ return -EIO;
return 0;
}
@@ -3290,14 +3554,50 @@
unregister_netdev(&dev_ipsec1);
unregister_netdev(&dev_ipsec2);
unregister_netdev(&dev_ipsec3);
+ unregister_netdev(&dev_ipsec4);
+ unregister_netdev(&dev_ipsec5);
+ unregister_netdev(&dev_ipsec6);
+ unregister_netdev(&dev_ipsec7);
+ unregister_netdev(&dev_ipsec8);
+ unregister_netdev(&dev_ipsec9);
+ unregister_netdev(&dev_ipsec10);
+ unregister_netdev(&dev_ipsec11);
+ unregister_netdev(&dev_ipsec12);
+ unregister_netdev(&dev_ipsec13);
+ unregister_netdev(&dev_ipsec14);
+ unregister_netdev(&dev_ipsec15);
kfree(dev_ipsec0.priv);
kfree(dev_ipsec1.priv);
kfree(dev_ipsec2.priv);
kfree(dev_ipsec3.priv);
+ kfree(dev_ipsec4.priv);
+ kfree(dev_ipsec5.priv);
+ kfree(dev_ipsec6.priv);
+ kfree(dev_ipsec7.priv);
+ kfree(dev_ipsec8.priv);
+ kfree(dev_ipsec9.priv);
+ kfree(dev_ipsec10.priv);
+ kfree(dev_ipsec11.priv);
+ kfree(dev_ipsec12.priv);
+ kfree(dev_ipsec13.priv);
+ kfree(dev_ipsec14.priv);
+ kfree(dev_ipsec15.priv);
dev_ipsec0.priv=NULL;
dev_ipsec1.priv=NULL;
dev_ipsec2.priv=NULL;
dev_ipsec3.priv=NULL;
+ dev_ipsec4.priv=NULL;
+ dev_ipsec5.priv=NULL;
+ dev_ipsec6.priv=NULL;
+ dev_ipsec7.priv=NULL;
+ dev_ipsec8.priv=NULL;
+ dev_ipsec9.priv=NULL;
+ dev_ipsec10.priv=NULL;
+ dev_ipsec11.priv=NULL;
+ dev_ipsec12.priv=NULL;
+ dev_ipsec13.priv=NULL;
+ dev_ipsec14.priv=NULL;
+ dev_ipsec15.priv=NULL;
return error;
}
--- openswan-1.0.6.old/klips/net/ipsec/ipsec_tunnel.h 2002-09-05 05:13:17.000000000 +0200
+++ openswan-1.0.6/klips/net/ipsec/ipsec_tunnel.h 2004-08-25 12:30:01.000000000 +0200
@@ -98,7 +98,7 @@
int mtu; /* What is the desired MTU? */
};
-#define IPSEC_NUM_IF 4
+#define IPSEC_NUM_IF 16
extern char ipsec_tunnel_c_version[];

View File

@@ -1,73 +0,0 @@
diff -rNu pluto.orig/constants.h pluto/constants.h
--- pluto.orig/constants.h 2004-07-21 16:33:16.000000000 +0200
+++ pluto/constants.h 2004-08-22 22:45:59.000000000 +0200
@@ -298,8 +298,9 @@
/* Dead Peer Detection actions */
enum dpd_action {
- DPD_ACTION_CLEAR = 0,
- DPD_ACTION_HOLD = 1
+ DPD_ACTION_CLEAR = 0,
+ DPD_ACTION_HOLD = 1,
+ DPD_ACTION_RESTART = 2
};
/* Timer events */
diff -rNu pluto.orig/ipsec_doi.c pluto/ipsec_doi.c
--- pluto.orig/ipsec_doi.c 2004-04-03 18:48:10.000000000 +0200
+++ pluto/ipsec_doi.c 2004-08-22 22:32:15.000000000 +0200
@@ -5504,7 +5528,7 @@
action = st->st_connection->dpd_action;
- passert(action == DPD_ACTION_HOLD || action == DPD_ACTION_CLEAR);
+ passert(action == DPD_ACTION_HOLD || action == DPD_ACTION_CLEAR || action == DPD_ACTION_RESTART);
loglog(RC_LOG_SERIOUS, "DPD: Info: No response from peer - declaring peer dead");
@@ -5521,11 +5545,20 @@
force an initiation of the conn again. */
loglog(RC_LOG_SERIOUS, "DPD: Info: Putting connection into %%trap");
- } else {
+ } else if(action == DPD_ACTION_CLEAR) {
/* dpdaction=clear - Wipe the SA, eroute - everything */
loglog(RC_LOG_SERIOUS, "DPD: Info: Clearing Connection");
unroute_connection(c);
+ } else {
+ /* dpdaction=clear - Wipe the SA, eroute - everything, then restart */
+
+ loglog(RC_LOG_SERIOUS, "DPD: Info: Restarting Connection");
+ unroute_connection(c);
+ if (c->kind == CK_PERMANENT) {
+ c->initiated = TRUE;
+ ipsecdoi_initiate(NULL_FD, c, c->policy, 1, SOS_NOBODY);
+ }
}
}
#endif
diff -rNu pluto.orig/whack.c pluto/whack.c
--- pluto.orig/whack.c 2004-03-01 13:54:10.000000000 +0100
+++ pluto/whack.c 2004-08-22 22:34:56.000000000 +0200
@@ -1033,6 +1033,9 @@
if( strcmp(optarg, "hold") == 0) {
msg.dpd_action = DPD_ACTION_HOLD;
}
+ if( strcmp(optarg, "restart") == 0) {
+ msg.dpd_action = DPD_ACTION_RESTART;
+ }
continue;
#endif
@@ -1235,8 +1238,8 @@
diag("dpddelay specified, but dpdtimeout is zero, both should be specified");
if(!msg.dpd_delay && msg.dpd_timeout)
diag("dpdtimeout specified, but dpddelay is zero, both should be specified");
- if(msg.dpd_action != DPD_ACTION_CLEAR && msg.dpd_action != DPD_ACTION_HOLD) {
- diag("dpdaction can only be \"clear\" or \"hold\", defaulting to \"hold\"");
+ if(msg.dpd_action != DPD_ACTION_CLEAR && msg.dpd_action != DPD_ACTION_HOLD && msg.dpd_action != DPD_ACTION_RESTART) {
+ diag("dpdaction can only be \"restart\", \"clear\" or \"hold\", defaulting to \"hold\"");
msg.dpd_action = DPD_ACTION_HOLD;
}
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,166 @@
packaging/utils/nattpatch 2.6
--- /dev/null Tue Mar 11 13:02:56 2003
+++ nat-t/include/net/xfrmudp.h Mon Feb 9 13:51:03 2004
@@ -0,0 +1,10 @@
+/*
+ * pointer to function for type that xfrm4_input wants, to permit
+ * decoupling of XFRM from udp.c
+ */
+#define HAVE_XFRM4_UDP_REGISTER
+
+typedef int (*xfrm4_rcv_encap_t)(struct sk_buff *skb, __u16 encap_type);
+extern int udp4_register_esp_rcvencap(xfrm4_rcv_encap_t func
+ , xfrm4_rcv_encap_t *oldfunc);
+extern int udp4_unregister_esp_rcvencap(xfrm4_rcv_encap_t func);
--- /distros/kernel/linux-2.6.11.2/net/ipv4/Kconfig 2005-03-09 03:12:33.000000000 -0500
+++ swan26/net/ipv4/Kconfig 2005-04-04 18:46:13.000000000 -0400
@@ -351,2 +351,8 @@
+config IPSEC_NAT_TRAVERSAL
+ bool "IPSEC NAT-Traversal (KLIPS compatible)"
+ depends on INET
+ ---help---
+ Includes support for RFC3947/RFC3948 NAT-Traversal of ESP over UDP.
+
config IP_TCPDIAG
--- plain26/net/ipv4/udp.c.orig 2006-01-02 22:21:10.000000000 -0500
+++ plain26/net/ipv4/udp.c 2006-01-10 20:07:21.000000000 -0500
@@ -108,11 +108,14 @@
#include <net/inet_common.h>
#include <net/checksum.h>
#include <net/xfrm.h>
+#include <net/xfrmudp.h>
/*
* Snmp MIB for the UDP layer
*/
+static xfrm4_rcv_encap_t xfrm4_rcv_encap_func;
+
DEFINE_SNMP_STAT(struct udp_mib, udp_statistics) __read_mostly;
struct hlist_head udp_hash[UDP_HTABLE_SIZE];
@@ -894,6 +897,42 @@
sk_common_release(sk);
}
+#if defined(CONFIG_XFRM) || defined(CONFIG_IPSEC_NAT_TRAVERSAL)
+
+/* if XFRM isn't a module, then register it directly. */
+#if 0 && !defined(CONFIG_XFRM_MODULE) && !defined(CONFIG_IPSEC_NAT_TRAVERSAL)
+static xfrm4_rcv_encap_t xfrm4_rcv_encap_func = xfrm4_rcv_encap;
+#else
+static xfrm4_rcv_encap_t xfrm4_rcv_encap_func = NULL;
+#endif
+
+int udp4_register_esp_rcvencap(xfrm4_rcv_encap_t func
+ , xfrm4_rcv_encap_t *oldfunc)
+{
+ if(oldfunc != NULL) {
+ *oldfunc = xfrm4_rcv_encap_func;
+ }
+
+#if 0
+ if(xfrm4_rcv_encap_func != NULL)
+ return -1;
+#endif
+
+ xfrm4_rcv_encap_func = func;
+ return 0;
+}
+
+int udp4_unregister_esp_rcvencap(xfrm4_rcv_encap_t func)
+{
+ if(xfrm4_rcv_encap_func != func)
+ return -1;
+
+ xfrm4_rcv_encap_func = NULL;
+ return 0;
+}
+#endif /* CONFIG_XFRM_MODULE || CONFIG_IPSEC_NAT_TRAVERSAL */
+
+
/* return:
* 1 if the the UDP system should process it
* 0 if we should drop this packet
@@ -901,9 +940,9 @@
*/
static int udp_encap_rcv(struct sock * sk, struct sk_buff *skb)
{
-#ifndef CONFIG_XFRM
+#if !defined(CONFIG_XFRM) && !defined(CONFIG_IPSEC_NAT_TRAVERSAL)
return 1;
-#else
+#else /* either CONFIG_XFRM or CONFIG_IPSEC_NAT_TRAVERSAL */
struct udp_sock *up = udp_sk(sk);
struct udphdr *uh = skb->h.uh;
struct iphdr *iph;
@@ -915,11 +954,11 @@
/* if we're overly short, let UDP handle it */
len = skb->len - sizeof(struct udphdr);
if (len <= 0)
- return 1;
+ return 2;
/* if this is not encapsulated socket, then just return now */
if (!encap_type)
- return 1;
+ return 3;
len = skb->tail - udpdata;
@@ -934,7 +973,7 @@
len = sizeof(struct udphdr);
} else
/* Must be an IKE packet.. pass it through */
- return 1;
+ return 4;
break;
case UDP_ENCAP_ESPINUDP_NON_IKE:
/* Check if this is a keepalive packet. If so, eat it. */
@@ -947,7 +986,7 @@
len = sizeof(struct udphdr) + 2 * sizeof(u32);
} else
/* Must be an IKE packet.. pass it through */
- return 1;
+ return 5;
break;
}
@@ -1021,10 +1060,14 @@
return 0;
}
if (ret < 0) {
- /* process the ESP packet */
- ret = xfrm4_rcv_encap(skb, up->encap_type);
- UDP_INC_STATS_BH(UDP_MIB_INDATAGRAMS);
- return -ret;
+ if(xfrm4_rcv_encap_func != NULL) {
+ ret = (*xfrm4_rcv_encap_func)(skb, up->encap_type);
+ UDP_INC_STATS_BH(UDP_MIB_INDATAGRAMS);
+ } else {
+ UDP_INC_STATS_BH(UDP_MIB_INERRORS);
+ ret = 1;
+ }
+ return ret;
}
/* FALLTHROUGH -- it's a UDP Packet */
}
@@ -1114,7 +1157,6 @@
/*
* All we need to do is get the socket, and then do a checksum.
*/
-
int udp_rcv(struct sk_buff *skb)
{
struct sock *sk;
@@ -1571,3 +1613,9 @@
EXPORT_SYMBOL(udp_proc_register);
EXPORT_SYMBOL(udp_proc_unregister);
#endif
+
+#if defined(CONFIG_IPSEC_NAT_TRAVERSAL)
+EXPORT_SYMBOL(udp4_register_esp_rcvencap);
+EXPORT_SYMBOL(udp4_unregister_esp_rcvencap);
+#endif
+